graview 0.1.50 → 0.1.52

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 (195) hide show
  1. package/dist/preview/chunk.2EB7COX5.js +1 -0
  2. package/dist/preview/{chunk.FKUVIG6D.js → chunk.2K3YQJW3.js} +1 -1
  3. package/dist/preview/{chunk.2P66HH5Y.js → chunk.2X3UZJWI.js} +1 -1
  4. package/dist/preview/chunk.337JMOTL.js +1 -0
  5. package/dist/preview/{chunk.YEKHDZ45.js → chunk.3FKP32RG.js} +2 -2
  6. package/dist/preview/{chunk.MQISKON2.js → chunk.3TME4BG3.js} +1 -1
  7. package/dist/preview/chunk.3ZQAPPJ5.js +18 -0
  8. package/dist/preview/{chunk.KZ3UPV2L.js → chunk.4LI73QOY.js} +1 -1
  9. package/dist/preview/{chunk.T4UYLB3Y.js → chunk.4VI3EYDL.js} +1 -1
  10. package/dist/preview/chunk.4ZLCMATU.js +2 -0
  11. package/dist/preview/{chunk.ETWREHXF.js → chunk.52J42KR5.js} +1 -1
  12. package/dist/preview/{chunk.ETX4QMM2.js → chunk.5DDHFNZM.js} +1 -1
  13. package/dist/preview/chunk.5LWPNOJA.js +1 -0
  14. package/dist/preview/{chunk.KFHXTHIY.js → chunk.5WU2UTP7.js} +1 -1
  15. package/dist/preview/{chunk.OUNLAMBA.js → chunk.63SRVTG2.js} +2 -2
  16. package/dist/preview/chunk.6BA6RUK7.js +1 -0
  17. package/dist/preview/{chunk.QZMBEG4E.js → chunk.6CY3EA6U.js} +1 -1
  18. package/dist/preview/chunk.6JERQFZI.js +1 -0
  19. package/dist/preview/chunk.6NIE3ILA.js +1 -0
  20. package/dist/preview/{chunk.OB7XLVK6.js → chunk.6QNBUBGD.js} +1 -1
  21. package/dist/preview/chunk.6YGRRXJB.js +2 -0
  22. package/dist/preview/{chunk.IDQHSAAQ.js → chunk.7354O67H.js} +1 -1
  23. package/dist/preview/{chunk.LJXAZ5TF.js → chunk.73EKJ4JN.js} +1 -1
  24. package/dist/preview/{chunk.O6SKKF4V.js → chunk.7EA7THSM.js} +1 -1
  25. package/dist/preview/{chunk.F7AFJRPP.js → chunk.7FMS57QO.js} +1 -1
  26. package/dist/preview/{chunk.L5MDUZLQ.js → chunk.7FZY5E2U.js} +1 -1
  27. package/dist/preview/chunk.7IOC6U3C.js +1 -0
  28. package/dist/preview/{chunk.7VX6TBNY.js → chunk.7KZ44FEU.js} +1 -1
  29. package/dist/preview/chunk.7OAXW7QF.js +1 -0
  30. package/dist/preview/chunk.7SNIX56B.js +1 -0
  31. package/dist/preview/{chunk.GZEZMU2T.js → chunk.7UJZP3YK.js} +2 -2
  32. package/dist/preview/{chunk.YUV7HZYG.js → chunk.7UXDIEPK.js} +1 -1
  33. package/dist/preview/{chunk.ZITDUHX3.js → chunk.7XJ3XQZD.js} +1 -1
  34. package/dist/preview/chunk.AI2HBKVP.js +359 -0
  35. package/dist/preview/chunk.BDQ4FUKO.js +1 -0
  36. package/dist/preview/{chunk.IMFAPZ6J.js → chunk.BHPZK4WJ.js} +2 -2
  37. package/dist/preview/{chunk.AXMC6XVT.js → chunk.BJL6EL6B.js} +1 -1
  38. package/dist/preview/{chunk.HGP3Q7QX.js → chunk.C4EPMV7O.js} +1 -1
  39. package/dist/preview/chunk.C4UNAJWC.js +1 -0
  40. package/dist/preview/{chunk.CR5MQMOL.js → chunk.C7EEYSAM.js} +1 -1
  41. package/dist/preview/{chunk.LGHMUUTG.js → chunk.CBGKWYGI.js} +1 -1
  42. package/dist/preview/chunk.CC7E6NUQ.js +1 -0
  43. package/dist/preview/chunk.CHMUL36A.js +1 -0
  44. package/dist/preview/{chunk.TT6QBWRA.js → chunk.CV4QA4ZF.js} +1 -1
  45. package/dist/preview/chunk.D2T563AA.js +1 -0
  46. package/dist/preview/{chunk.UDTBFAS5.js → chunk.D62V3TBW.js} +1 -1
  47. package/dist/preview/{chunk.ECSWXLBI.js → chunk.DC7M56NM.js} +2 -2
  48. package/dist/preview/chunk.DGWNVDZB.js +1 -0
  49. package/dist/preview/{chunk.73BJYIYS.js → chunk.DIS7JS7X.js} +1 -1
  50. package/dist/preview/{chunk.A53G42QO.js → chunk.DVLWSCIC.js} +1 -1
  51. package/dist/preview/{chunk.LDE5HLTM.js → chunk.DXZ5VYCQ.js} +1 -1
  52. package/dist/preview/{chunk.GPJFNLEJ.js → chunk.EHOEMVQP.js} +1 -1
  53. package/dist/preview/chunk.EIWTZC4A.js +1 -0
  54. package/dist/preview/chunk.EME5HQ3H.js +1 -0
  55. package/dist/preview/{chunk.JJP5OL5E.js → chunk.FEBCIEI3.js} +1 -1
  56. package/dist/preview/{chunk.CDZVUCEK.js → chunk.FJC6PMOG.js} +1 -1
  57. package/dist/preview/{chunk.U2M4SGUU.js → chunk.FJEXINFF.js} +1 -1
  58. package/dist/preview/{chunk.UOC3SIYT.js → chunk.FLNYLE6S.js} +1 -1
  59. package/dist/preview/{chunk.QSZLY62B.js → chunk.G7XKQNOL.js} +1 -1
  60. package/dist/preview/{chunk.MRUDTYOL.js → chunk.GL3YVGAP.js} +2 -2
  61. package/dist/preview/{chunk.UGJ32SEL.js → chunk.GZHEGKPF.js} +1 -1
  62. package/dist/preview/{chunk.S64LCR23.js → chunk.HSGUXMAO.js} +1 -1
  63. package/dist/preview/{chunk.ODHCSYXX.js → chunk.HST7BYFW.js} +1 -1
  64. package/dist/preview/{chunk.TY6VILZB.js → chunk.I2W7HSBU.js} +1 -1
  65. package/dist/preview/{chunk.GQX57JIE.js → chunk.I43ONAEL.js} +1 -1
  66. package/dist/preview/{chunk.QFI4L2HK.js → chunk.INL4OZI7.js} +1 -1
  67. package/dist/preview/{chunk.ZBBCUK2K.js → chunk.IVI3HRSF.js} +1 -1
  68. package/dist/preview/{chunk.JYJNRCK5.js → chunk.J263VQF5.js} +1 -1
  69. package/dist/preview/{chunk.GTUBIJTP.js → chunk.J2R55TM7.js} +1 -1
  70. package/dist/preview/{chunk.MCPLU2U4.js → chunk.J6IB2HUZ.js} +1 -1
  71. package/dist/preview/{chunk.TL7UGUY4.js → chunk.JOWJNIWH.js} +2 -2
  72. package/dist/preview/{chunk.XWLGHTH6.js → chunk.JQBP6QWQ.js} +1 -1
  73. package/dist/preview/chunk.JV7FLVUV.js +1 -0
  74. package/dist/preview/{chunk.KOPRZLJH.js → chunk.KFTZLNHY.js} +2 -2
  75. package/dist/preview/{chunk.DUIKIJKC.js → chunk.KPUX27ZT.js} +1 -1
  76. package/dist/preview/chunk.KSJ3J5UN.js +1 -0
  77. package/dist/preview/chunk.LESRQN3Y.js +32 -0
  78. package/dist/preview/{chunk.FFPG4PHX.js → chunk.LSL25VXW.js} +1 -1
  79. package/dist/preview/{chunk.VVRI7DNK.js → chunk.LTJYKQJG.js} +1 -1
  80. package/dist/preview/chunk.LXJW2Z2M.js +1 -0
  81. package/dist/preview/{chunk.AXCRFJDL.js → chunk.M33LUF3Q.js} +1 -1
  82. package/dist/preview/chunk.MBNZ2HK7.js +1 -0
  83. package/dist/preview/chunk.MYKRJ4SV.js +1 -0
  84. package/dist/preview/{chunk.L2AV6JRA.js → chunk.N7D5LKBI.js} +1 -1
  85. package/dist/preview/{chunk.WGRF6EHC.js → chunk.NAPTE3S6.js} +1 -1
  86. package/dist/preview/{chunk.BBNF52IB.js → chunk.NHIPVAGR.js} +1 -1
  87. package/dist/preview/chunk.NICCIJV4.js +1 -0
  88. package/dist/preview/{chunk.UJTRKSCK.js → chunk.NQPNK6I5.js} +1 -1
  89. package/dist/preview/{chunk.JLPBXG4P.js → chunk.NVNQSZ43.js} +1 -1
  90. package/dist/preview/{chunk.7QW6JYGP.js → chunk.NWK4E7TJ.js} +1 -1
  91. package/dist/preview/chunk.NZB5S5UO.js +1 -0
  92. package/dist/preview/{chunk.53BGPCM6.js → chunk.OS3WZV6C.js} +1 -1
  93. package/dist/preview/{chunk.UCS3CBT4.js → chunk.OYRZ2DEI.js} +1 -1
  94. package/dist/preview/{chunk.KGGWFL54.js → chunk.P5PXWOHI.js} +1 -1
  95. package/dist/preview/chunk.PFXGWY3P.js +1 -0
  96. package/dist/preview/chunk.PRCWGE7A.js +1 -0
  97. package/dist/preview/{chunk.4SHSEIHT.js → chunk.PXHBPLTQ.js} +1 -1
  98. package/dist/preview/chunk.PXVJBL2C.js +1 -0
  99. package/dist/preview/chunk.Q3XKNZQW.js +1 -0
  100. package/dist/preview/chunk.Q5IAXTF5.js +25 -0
  101. package/dist/preview/{chunk.V5IWJ3ZV.js → chunk.QPP3OJVR.js} +1 -1
  102. package/dist/preview/{chunk.6SHF6IL5.js → chunk.QRCTTDDQ.js} +1 -1
  103. package/dist/preview/{chunk.ZOQ3OKKI.js → chunk.QWQBPJ4U.js} +1 -1
  104. package/dist/preview/chunk.QXCYAFRT.js +1 -0
  105. package/dist/preview/chunk.R6FHEEJ7.js +1 -0
  106. package/dist/preview/chunk.R77TACXU.js +1 -0
  107. package/dist/preview/{chunk.RK6BK5FD.js → chunk.R7CRV2FE.js} +1 -1
  108. package/dist/preview/chunk.R7ZZJOJW.js +1 -0
  109. package/dist/preview/{chunk.4BQNG3W3.js → chunk.RBWYXVUW.js} +1 -1
  110. package/dist/preview/chunk.RMRO5JZX.js +1 -0
  111. package/dist/preview/{chunk.4XOSDCCE.js → chunk.RWCWRJJC.js} +1 -1
  112. package/dist/preview/{chunk.M55U47A6.js → chunk.S4ZWBCYC.js} +1 -1
  113. package/dist/preview/{chunk.ZKDJQDKX.js → chunk.SELLAVIQ.js} +1 -1
  114. package/dist/preview/chunk.SLBWPVIY.js +1 -0
  115. package/dist/preview/{chunk.GDYI5QDS.js → chunk.SM6HTPYF.js} +1 -1
  116. package/dist/preview/chunk.SZCZD2GM.js +1 -0
  117. package/dist/preview/{chunk.YZ6UKKEL.js → chunk.T2Q3AAQI.js} +1 -1
  118. package/dist/preview/{chunk.YCJ74LZS.js → chunk.T6KKNWZT.js} +1 -1
  119. package/dist/preview/{chunk.BJAQRV2R.js → chunk.U6PCKJ26.js} +1 -1
  120. package/dist/preview/chunk.UEPVA6IS.js +1 -0
  121. package/dist/preview/{chunk.JC5NXMG3.js → chunk.ULAMIQ52.js} +1 -1
  122. package/dist/preview/chunk.UMS7XRPO.js +1 -0
  123. package/dist/preview/{chunk.FDFVGHQE.js → chunk.VGIWQNJB.js} +1 -1
  124. package/dist/preview/{chunk.64TFAR5Z.js → chunk.VGTEEANA.js} +1 -1
  125. package/dist/preview/{chunk.BORCUDGS.js → chunk.VKOCD5CL.js} +1 -1
  126. package/dist/preview/chunk.VOHRQXCF.js +5 -0
  127. package/dist/preview/chunk.W5UJLKIT.js +1 -0
  128. package/dist/preview/chunk.WUEU3QBL.js +1 -0
  129. package/dist/preview/chunk.WWUMSCYC.js +1 -0
  130. package/dist/preview/{chunk.Q7RI4SI4.js → chunk.XLM4ONUB.js} +1 -1
  131. package/dist/preview/{chunk.QAUZDLDA.js → chunk.XPR3QFF4.js} +1 -1
  132. package/dist/preview/{chunk.UN2OB6OD.js → chunk.XZLKTOJE.js} +1 -1
  133. package/dist/preview/chunk.Y37DXEHG.js +1 -0
  134. package/dist/preview/chunk.YKACMLLU.js +1 -0
  135. package/dist/preview/{chunk.DUJUJN35.js → chunk.YKXUDACI.js} +1 -1
  136. package/dist/preview/{chunk.3SY6WWWQ.js → chunk.YUEOUV7G.js} +2 -2
  137. package/dist/preview/chunk.YYWLYVAW.js +1 -0
  138. package/dist/preview/chunk.Z2JMTRF4.js +1 -0
  139. package/dist/preview/chunk.Z2UFPOAN.js +88 -0
  140. package/dist/preview/chunk.ZEKKIMKI.js +1 -0
  141. package/dist/preview/{chunk.SVH3OMU2.js → chunk.ZJXUWOG3.js} +1 -1
  142. package/dist/preview/{chunk.SWLDDQJS.js → chunk.ZK42LPF5.js} +1 -1
  143. package/dist/preview/{chunk.SRU2YDTJ.js → chunk.ZZGXVYW2.js} +1 -1
  144. package/dist/preview/index.html +51 -51
  145. package/dist/preview/page.js +2 -2
  146. package/package.json +6 -6
  147. package/dist/preview/chunk.24MUPV4Y.js +0 -1
  148. package/dist/preview/chunk.2VZSC2MB.js +0 -1
  149. package/dist/preview/chunk.3L5USMQD.js +0 -1
  150. package/dist/preview/chunk.3O3H37WD.js +0 -1
  151. package/dist/preview/chunk.4VJARLJ5.js +0 -1
  152. package/dist/preview/chunk.5DZR46YG.js +0 -1
  153. package/dist/preview/chunk.5RNB6IC5.js +0 -1
  154. package/dist/preview/chunk.6BMCZPT6.js +0 -1
  155. package/dist/preview/chunk.6VA5XFRR.js +0 -1
  156. package/dist/preview/chunk.7PJVMADH.js +0 -2
  157. package/dist/preview/chunk.ATWNWPME.js +0 -1
  158. package/dist/preview/chunk.AVCW7C6V.js +0 -1
  159. package/dist/preview/chunk.BLS2G3CD.js +0 -5
  160. package/dist/preview/chunk.BNQL37AC.js +0 -88
  161. package/dist/preview/chunk.CBJHYNNT.js +0 -1
  162. package/dist/preview/chunk.EF3UB7US.js +0 -1
  163. package/dist/preview/chunk.EJUZGIQ5.js +0 -1
  164. package/dist/preview/chunk.F5FJHKWV.js +0 -1
  165. package/dist/preview/chunk.GQI53L5P.js +0 -1
  166. package/dist/preview/chunk.HG34MT7C.js +0 -1
  167. package/dist/preview/chunk.IATLUWAD.js +0 -1
  168. package/dist/preview/chunk.JLR74UFP.js +0 -1
  169. package/dist/preview/chunk.K4ITS63T.js +0 -1
  170. package/dist/preview/chunk.KT2LXHSI.js +0 -1
  171. package/dist/preview/chunk.M5RHVUZ6.js +0 -1
  172. package/dist/preview/chunk.MBZ6N5SO.js +0 -1
  173. package/dist/preview/chunk.N7FIUTVY.js +0 -1
  174. package/dist/preview/chunk.NPU4WYRB.js +0 -1
  175. package/dist/preview/chunk.OHAWUOUN.js +0 -1
  176. package/dist/preview/chunk.OKQ4JXTW.js +0 -1
  177. package/dist/preview/chunk.OYQ6ZA6T.js +0 -1
  178. package/dist/preview/chunk.Q7UQ5OXA.js +0 -1
  179. package/dist/preview/chunk.ROJZLOKZ.js +0 -1
  180. package/dist/preview/chunk.RXJBYP7B.js +0 -1
  181. package/dist/preview/chunk.S7OFTGBQ.js +0 -18
  182. package/dist/preview/chunk.SGMVLKZO.js +0 -25
  183. package/dist/preview/chunk.SJRXBTGP.js +0 -1
  184. package/dist/preview/chunk.THTHNY4N.js +0 -1
  185. package/dist/preview/chunk.U6FGWVGB.js +0 -1
  186. package/dist/preview/chunk.UEL7FLL7.js +0 -1
  187. package/dist/preview/chunk.VM43YREJ.js +0 -1
  188. package/dist/preview/chunk.YAS6LXQ7.js +0 -1
  189. package/dist/preview/chunk.YEMNR4WU.js +0 -1
  190. package/dist/preview/chunk.YG3BLY67.js +0 -32
  191. package/dist/preview/chunk.YYS45ZGQ.js +0 -1
  192. package/dist/preview/chunk.ZI66HRES.js +0 -1
  193. package/dist/preview/chunk.ZK446PSX.js +0 -359
  194. package/dist/preview/chunk.ZVETGRUM.js +0 -1
  195. package/dist/preview/chunk.ZVOP2HHI.js +0 -1
@@ -0,0 +1 @@
1
+ import"./chunk.WVUJXDXZ.js";import{a as k,b as q,c as pe}from"./chunk.QRCTTDDQ.js";import"./chunk.3TME4BG3.js";import"./chunk.I43ONAEL.js";import"./chunk.73EKJ4JN.js";import"./chunk.INL4OZI7.js";import"./chunk.5WU2UTP7.js";import"./chunk.GZHZLJBF.js";import{n as me}from"./chunk.YKACMLLU.js";import"./chunk.OJGHDWI6.js";import"./chunk.337JMOTL.js";import"./chunk.CV4QA4ZF.js";import"./chunk.OYRZ2DEI.js";import"./chunk.7EA7THSM.js";import"./chunk.AI2HBKVP.js";import{G as Le,M as S,O as ue,T as ce,aa as ge,da as he}from"./chunk.Q5IAXTF5.js";import"./chunk.SDO3U72B.js";import{Nc as de,ka as oe,na as w,pa as le,ra as E,sa as x,ta as se,ua as Y}from"./chunk.VOHRQXCF.js";import"./chunk.SLBWPVIY.js";import{b as U}from"./chunk.AJZBJBMO.js";var h=U(Le(),1);async function ye(e,n){let i=await createImageBitmap(e);try{let r=Math.min(1,n/Math.max(i.width,i.height)),a=document.createElement("canvas");a.width=Math.max(1,Math.round(i.width*r)),a.height=Math.max(1,Math.round(i.height*r));let l=a.getContext("2d");if(l===null)throw new Error("This browser will not give us a canvas to resize with.");return l.drawImage(i,0,0,a.width,a.height),a}finally{i.close()}}var t=U(ce(),1),Ve=2048,Ie=.85;function _(e){return e<1e3?`${e} bytes`:e<1e6?`${Math.round(e/1e3)} KB`:`${(e/1e6).toFixed(e<1e7?1:0)} MB`}function z(e){if(e.type==="application/pdf")return"PDF";let n=/\.([a-z0-9]{2,5})$/i.exec(e.name??"")?.[1];return n?n.toUpperCase():(e.type.split("/")[1]??e.type).replace(/^x-|^vnd\./,"").split(/[.+-]/)[0].toUpperCase()}function ke(e){let n=[...new Set(e.map(i=>i==="image/*"?"pictures":i==="video/*"?"videos":i==="*/*"||i==="*"?"any file":`${z({type:i})} files`))];return n.length<=1?n[0]??"no files":`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`}function Fe(e,n){if(e.length===0)return!0;let i=`${n.split("/")[0]}/*`;return e.some(r=>r==="*"||r==="*/*"||r===n||r===i)}var fe=/^image\/hei[cf]$|\.hei[cf]$/i,be=e=>fe.test(e.type)||fe.test(e.name),De={mov:"video/quicktime",mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",ogv:"video/ogg"},Be=e=>De[/\.([a-z0-9]{2,4})$/i.exec(e)?.[1]?.toLowerCase()??""];async function je(e,n,i){let r=e.name||(i.camera?"photo.jpg":"file"),a=e.type||(be({type:"",name:r})?"image/heic":Be(r)??"application/octet-stream"),l=be({type:a,name:r}),u=a.startsWith("image/")||l;if(i.image&&!u)return{refused:`\u201C${r}\u201D isn\u2019t a picture.`};if(i.video)return a.startsWith("video/")?K({blob:e,name:r,type:a},n):{refused:`\u201C${r}\u201D isn\u2019t a video.`};if(l||u&&/^image\/(jpeg|webp)$/.test(a)&&(i.camera||e.size>n.maxBytes||e.size>15e5))try{let c=await ye(e,Ve),b=await new Promise(p=>c.toBlob(p,"image/jpeg",Ie));if(b)return K({blob:b,name:l?r.replace(/\.hei[cf]$/i,"")+".jpg":r,type:"image/jpeg",width:c.width,height:c.height},n)}catch{if(l&&!Fe(n.kinds,a))return{refused:`\u201C${r}\u201D is a HEIC photo, which this browser can\u2019t turn into a JPEG and this host doesn\u2019t take. Save it as a JPEG and try again.`}}let y={};if(u&&!l)try{let c=await createImageBitmap(e);y={width:c.width,height:c.height},c.close()}catch{}return K({blob:e,name:r,type:a,...y},n)}function K(e,n){return Fe(n.kinds,e.type)?e.blob.size>n.maxBytes?{refused:`\u201C${e.name}\u201D is ${_(e.blob.size)}; this host takes files up to ${_(n.maxBytes)}.`}:e:{refused:`\u201C${e.name}\u201D is a ${z(e)} file; this host takes ${ke(n.kinds)}.`}}async function _e(e,n,i,r=!1){let a;try{a=await n.upload(e.blob,e.name)}catch(u){let s=u instanceof Error&&u.message.trim()?u.message.trim():"the host refused it";return{refused:`\u201C${e.name}\u201D wasn\u2019t kept: ${s}`}}return le(a)?i&&!E(a)?{refused:`\u201C${e.name}\u201D isn\u2019t a picture.`}:r&&!x(a)?{refused:`The host kept \u201C${e.name}\u201D as ${z(a)}, not as a video.`}:{...a,...a.width===void 0&&e.width?{width:e.width}:{},...a.height===void 0&&e.height?{height:e.height}:{}}:{refused:`The host\u2019s answer for \u201C${e.name}\u201D isn\u2019t a file a record can keep.`}}var F="var(--graview-radius, 8px)",P={color:"var(--graview-ink-muted)",fontSize:"0.8125rem"};function Z(e){let n=S(),i=ue()?.past!=null,[r,a]=(0,h.useState)(!1),l=n?.kept?ze(n,e.href):!0,[,u]=(0,h.useState)(0);return(0,h.useEffect)(()=>{if(typeof l!="object")return;let s=!0;return l.then(()=>s&&u(y=>y+1)),()=>void(s=!1)},[l]),[l===!1||i&&r,()=>a(!0)]}var J=new WeakMap;function ze(e,n){let i=J.get(e)?.get(n);if(i!==void 0)return i;let r;try{r=e.kept(n)}catch{return!0}if(typeof r=="boolean")return r;let a=J.get(e)??new Map;J.set(e,a);let l=Promise.resolve(r).then(u=>u!==!1,()=>!0);return a.set(n,l),l.then(u=>a.set(n,u)),l}function ee({file:e,style:n}){return(0,t.jsx)("span",{role:"img","aria-label":`${k(e)}, removed later`,"data-graview-removed-later":e.href,style:{display:"grid",placeItems:"center",textAlign:"center",padding:4,boxSizing:"border-box",fontSize:"0.6875rem",lineHeight:1.2,color:"var(--graview-ink-muted)",border:"1px dashed var(--graview-edge-bright)",borderRadius:F,...n},children:"removed later"})}function Q({file:e,size:n=56,style:i}){let r=S(),[a,l]=Z(e);return a?(0,t.jsx)(ee,{file:e,style:{width:n,height:n,flex:"none",...i}}):x(e)?(0,t.jsx)(Ae,{file:e,size:n,...i?{style:i}:{},onError:l}):(0,t.jsx)("img",{onError:l,src:w(r,e.href),alt:k(e),width:n,height:n,loading:"lazy",decoding:"async","data-graview-thumb":e.href,style:{width:n,height:n,objectFit:"cover",borderRadius:F,display:"block",flex:"none",background:"var(--graview-edge)",...i}})}function $e(e){let[n,i]=(0,h.useState)({}),r=e.duration??n.duration;return[{...r!==void 0?{duration:r}:{},width:e.width??n.width,height:e.height??n.height},u=>{let s=u.currentTarget;i({...Number.isFinite(s.duration)&&s.duration>0?{duration:s.duration}:{},...s.videoWidth>0&&s.videoHeight>0?{width:s.videoWidth,height:s.videoHeight}:{}})}]}var Ne=320,xe=(e,n)=>`${k(e)}, ${se({...n!==void 0?{duration:n}:{}})}`,Oe=(0,t.jsx)("span",{"data-graview-play-glyph":"","aria-hidden":"true",style:{position:"absolute",inset:0,display:"grid",placeItems:"center",pointerEvents:"none"},children:(0,t.jsxs)("svg",{viewBox:"0 0 24 24",width:"40%",height:"40%",style:{maxWidth:40,maxHeight:40,filter:"drop-shadow(0 1px 2px rgb(0 0 0 / 0.5))"},children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"11",fill:"rgb(0 0 0 / 0.55)"}),(0,t.jsx)("path",{d:"M9.5 7.5v9l7-4.5z",fill:"#fff"})]})});function Ae({file:e,size:n,style:i,onError:r}){let a=S(),[l,u]=$e(e),s={width:n,height:n,objectFit:"cover",display:"block",borderRadius:F,background:"var(--graview-edge)"};return(0,t.jsxs)("span",{role:"img","aria-label":xe(e,l.duration),"data-graview-thumb":e.href,"data-graview-video-thumb":"",style:{position:"relative",display:"block",width:n,height:n,flex:"none",...i},children:[e.poster?(0,t.jsx)("img",{src:w(a,e.poster),alt:"",width:n,height:n,loading:"lazy",decoding:"async",onError:r,style:s}):(0,t.jsx)("video",{src:w(a,e.href),preload:"metadata",muted:!0,playsInline:!0,"aria-hidden":"true",tabIndex:-1,width:n,height:n,onLoadedMetadata:u,onError:r,style:s}),Oe,l.duration!==void 0?(0,t.jsx)("span",{"data-graview-video-clock":"","aria-hidden":"true",style:{position:"absolute",right:3,bottom:3,padding:"0 4px",borderRadius:4,background:"rgb(0 0 0 / 0.65)",color:"#fff",fontSize:"0.6875rem",lineHeight:"16px",fontVariantNumeric:"tabular-nums"},children:q(l.duration)}):null]})}function Ge({file:e}){let n=S(),[i,r]=Z(e),[a,l]=$e(e);if(i)return(0,t.jsx)(ee,{file:e,style:{width:"100%",aspectRatio:"16 / 9"}});let u=a.width!==void 0&&a.height!==void 0;return(0,t.jsxs)("figure",{"data-graview-video-figure":e.href,style:{margin:0,display:"grid",gap:4,minWidth:0},children:[(0,t.jsx)("video",{"data-graview-video":e.href,src:w(n,e.href),...e.poster?{poster:w(n,e.poster)}:{},controls:!0,preload:"metadata",playsInline:!0,...u?{width:a.width,height:a.height}:{},"aria-label":xe(e,a.duration),onLoadedMetadata:l,onError:r,style:{display:"block",width:"100%",maxWidth:u?Math.max(a.width,Ne):"100%",height:"auto",maxHeight:"80vh",aspectRatio:u?`${a.width} / ${a.height}`:"16 / 9",borderRadius:F,background:"#000"},children:e.captions?(0,t.jsx)("track",{kind:"captions",src:w(n,e.captions),srcLang:"en",label:"Captions",default:!0}):null}),(0,t.jsx)("figcaption",{"data-graview-video-said":"",style:P,children:[e.caption??e.name,...a.duration!==void 0?[q(a.duration)]:[]].join(" \xB7 ")})]})}function Ue({file:e,onOpen:n}){let i=S(),[r,a]=Z(e);return r?(0,t.jsx)(ee,{file:e,style:{width:"100%",aspectRatio:"1"}}):(0,t.jsx)("button",{type:"button","aria-label":`Open ${k(e)} full size`,onClick:l=>n(l.currentTarget),style:{padding:0,border:0,background:"none",cursor:"zoom-in",display:"block",width:"100%",borderRadius:F},children:(0,t.jsx)("img",{src:w(i,e.href),alt:k(e),loading:"lazy",decoding:"async",onError:a,style:{width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:F,display:"block",background:"var(--graview-edge)"}})})}function X({files:e,label:n}){let i=S(),r=d=>w(i,d.href),a=e.filter(E),l=e.filter(x),u=e.filter(d=>!E(d)&&!x(d)),[s,y]=(0,h.useState)(null),c=(0,h.useRef)(null),b=(0,h.useRef)(null);(0,h.useEffect)(()=>{let d=c.current;s!==null&&d&&!d.open&&d.showModal?.()},[s]);let p=s===null?void 0:a[s];return(0,t.jsxs)("div",{style:{display:"grid",gap:10,minWidth:0},children:[a.length>0?(0,t.jsx)("ul",{"data-graview-gallery":"","aria-label":n,style:{listStyle:"none",margin:0,padding:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(96px, 1fr))",gap:8},children:a.map((d,T)=>(0,t.jsx)("li",{style:{minWidth:0},children:(0,t.jsx)(Ue,{file:d,onOpen:R=>{b.current=R,y(T)}})},d.href))}):null,l.length>0?(0,t.jsx)("ul",{"data-graview-videos":"","aria-label":n,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:12},children:l.map(d=>(0,t.jsx)("li",{style:{minWidth:0},children:(0,t.jsx)(Ge,{file:d})},d.href))}):null,u.length>0?(0,t.jsx)("ul",{"data-graview-documents":"",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:10},children:u.map(d=>(0,t.jsxs)("li",{"data-graview-document":d.type,style:{display:"grid",gap:6,minWidth:0},children:[d.type==="application/pdf"?(0,t.jsx)("object",{data:r(d),type:"application/pdf","aria-label":k(d),style:{width:"100%",height:420,border:"1px solid var(--graview-edge)",borderRadius:F},children:(0,t.jsxs)("p",{style:{margin:0,padding:12},children:["This browser shows no PDF here: ",(0,t.jsxs)("a",{href:r(d),download:d.name,children:["download ",d.name]}),"."]})}):null,(0,t.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",gap:"2px 10px",alignItems:"baseline",minWidth:0,overflowWrap:"anywhere"},children:[(0,t.jsx)("a",{href:r(d),download:d.name,...d.type==="application/pdf"?{target:"_blank",rel:"noopener"}:{},children:d.name}),(0,t.jsxs)("span",{style:P,children:[z(d)," \xB7 ",_(d.bytes)]})]}),d.caption?(0,t.jsx)("span",{style:P,children:d.caption}):null]},d.href))}):null,p?(0,t.jsx)("dialog",{ref:c,"data-graview-full":p.href,"aria-label":k(p),onClose:()=>{y(null),b.current?.focus()},onClick:d=>{d.target===d.currentTarget&&d.currentTarget.close()},style:{padding:0,border:0,borderRadius:F,maxWidth:"min(96vw, 1600px)",maxHeight:"94vh",background:"var(--graview-panel)",color:"var(--graview-ink)"},children:(0,t.jsxs)("figure",{style:{margin:0,display:"grid",gap:8,padding:10},children:[(0,t.jsx)("img",{src:r(p),alt:k(p),style:{maxWidth:"100%",maxHeight:"80vh",objectFit:"contain",display:"block",margin:"0 auto"}}),(0,t.jsxs)("figcaption",{style:{display:"flex",gap:12,alignItems:"center",justifyContent:"space-between"},children:[(0,t.jsx)("span",{children:p.caption??p.name}),(0,t.jsx)("form",{method:"dialog",style:{margin:0},children:(0,t.jsx)("button",{type:"submit",autoFocus:!0,children:"Close"})})]})]})}):null]})}function Se({value:e,onChange:n,several:i,image:r,video:a=!1,label:l,thumbs:u=!0}){let s=S(),y=(0,h.useId)(),c=(0,h.useRef)(null),b=(0,h.useRef)(null),[p,d]=(0,h.useState)(null),[T,R]=(0,h.useState)(null),[te,H]=(0,h.useState)([]),[N,O]=(0,h.useState)(!1),W=r?"image/":a?"video/":void 0,C=s?W?s.kinds.filter(o=>o.startsWith(W)||o==="*"||o==="*/*"):s.kinds:[],Pe=s?s.kinds.length===0||C.length>0:!1,Re=!a&&(s?s.kinds.length===0||(r?C:s.kinds).some(o=>o.startsWith("image/")||o.startsWith("*")):!1),ne=!!s&&s.maxBytes>0,L=ne&&(!W||Pe),V=r?"picture":a?"video":"file",ae=i?`${V}s`:`a ${V}`,ie=W?C.length>0?C.join(","):`${W}*`:s?.kinds.join(",")||void 0,We=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,A=(0,h.useRef)(e);A.current=e;let re=(0,h.useRef)(null),I=(0,h.useRef)(null);(0,h.useEffect)(()=>{let o=I.current;if(!o||o.from===e)return;I.current=null;let g=re.current?.children,f=g?.[Math.min(o.at,g.length-1)];((o.what==="move"?f?.querySelector("[data-graview-file-move]"):null)??f?.querySelector("[data-graview-file-remove]")??c.current?.parentElement?.querySelector("[data-graview-file-choose]"))?.focus()});let D=async(o,g)=>{if(!s||o.length===0)return;let f=i?o:o.slice(0,1),m=[],$=[];f.length<o.length&&$.push(`${l} holds one ${V}, so ${o.slice(1).map(v=>`\u201C${v.name||"the photo"}\u201D`).join(", ")} ${o.length>2?"were":"was"} left out.`),H([]),R(null);for(let v of f){d(`Sending ${v.name||"the photo"}\u2026`);let G=await je(v,s,{image:r,video:a,camera:g==="camera"});if("refused"in G){$.push(G.refused);continue}let M=await _e(G,s,r,a);"refused"in M?$.push(M.refused):[...i?A.current:[],...m].some(He=>He.href===M.href)?$.push(`\u201C${M.name}\u201D is already here.`):m.push(M)}if(d(null),H($),m.length!==0)try{n(i?[...A.current,...m]:m.slice(-1)),R(`Added ${m.map(v=>v.name).join(", ")}.`)}catch(v){H([...$,v instanceof Error?v.message:String(v)])}},B=(o,g,f)=>{try{I.current=f?{...f,from:e}:null,n(o),R(g)}catch(m){I.current=null,H([m instanceof Error?m.message:String(m)])}},j=o=>o?Array.from(o):[],Me=o=>{let g=j(o.clipboardData?.files);!L||g.length===0||(o.preventDefault(),D(g,"pasted"))},Te=o=>{O(!1),L&&(o.preventDefault(),D(j(o.dataTransfer?.files),"dropped"))};return(0,t.jsxs)("div",{role:"group","aria-labelledby":`${y}-label`,"data-graview-file-editor":"","data-graview-dropping":N?"":void 0,onPaste:Me,onDragOver:o=>{L&&(o.preventDefault(),O(!0))},onDragLeave:()=>O(!1),onDrop:Te,style:{display:"grid",gap:8,minWidth:0,padding:N?6:0,outline:N?"2px dashed var(--graview-accent)":"none",borderRadius:F},children:[(0,t.jsx)("span",{id:`${y}-label`,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap"},children:l}),e.length>0&&(i||e.length>1)?(0,t.jsx)("ul",{ref:re,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:6},children:e.map((o,g)=>(0,t.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",minWidth:0},children:[u&&(E(o)||x(o))?(0,t.jsx)(Q,{file:o,size:40}):null,(0,t.jsx)("span",{style:{flex:"1 1 8rem",minWidth:0,overflowWrap:"anywhere"},children:o.name}),(0,t.jsx)(we,{file:o,onCaption:f=>B(e.map((m,$)=>$===g?ve(m,f):m),f?`${o.name} now says \u201C${f}\u201D.`:`${o.name} says its name again.`)}),i&&g>0?(0,t.jsx)("button",{type:"button","data-graview-file-move":"","aria-label":`Move ${o.name} earlier`,onClick:()=>B(e.map((f,m)=>m===g-1?o:m===g?e[g-1]:f),`Moved ${o.name} earlier.`,{at:g-1,what:"move"}),children:"\u2191"}):null,i?(0,t.jsx)("button",{type:"button","data-graview-file-remove":"","aria-label":`Remove ${o.name}`,onClick:()=>B(e.filter((f,m)=>m!==g),`Removed ${o.name}.`,{at:g,what:"remove"}),children:"Remove"}):null]},`${g}:${o.href}`))}):e.length===1?(0,t.jsx)(we,{file:e[0],onCaption:o=>B([ve(e[0],o)],o?`${e[0].name} now says \u201C${o}\u201D.`:`${e[0].name} says its name again.`)}):null,L?(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center"},children:[(0,t.jsx)("input",{ref:c,type:"file",hidden:!0,multiple:i,...ie?{accept:ie}:{},"data-graview-file-input":"","aria-label":`Choose ${ae}`,onChange:o=>{let g=j(o.currentTarget.files);o.currentTarget.value="",D(g,"picked")}}),(0,t.jsx)("button",{type:"button",disabled:p!==null,onClick:()=>c.current?.click(),"data-graview-file-choose":"",children:e.length>0&&!i?`Replace the ${V}`:`Choose ${ae}`}),Re?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:b,type:"file",hidden:!0,accept:"image/*",capture:"environment","data-graview-photo-input":"","aria-label":"Take a photo",onChange:o=>{let g=j(o.currentTarget.files);o.currentTarget.value="",D(g,"camera")}}),We?(0,t.jsx)("button",{type:"button",disabled:p!==null,onClick:()=>b.current?.click(),children:"Take a photo"}):null]}):null,(0,t.jsxs)("span",{style:P,"data-graview-file-takes":"",children:["or drop or paste ",i?"them":"it"," here \xB7 ",s.kinds.length>0?ke(C.length>0?C:s.kinds):"any file",", up to ",_(s.maxBytes)]})]}):(0,t.jsx)("p",{style:{...P,margin:0},"data-graview-file-none":"",children:ne?`This host doesn\u2019t take ${a?"videos":"pictures"}, so none can be added here.`:"This host doesn\u2019t take files, so none can be added here."}),(0,t.jsx)("p",{"aria-live":"polite",style:{...P,margin:0,minHeight:p||T?void 0:0},"data-graview-file-status":"",children:p??T??""}),te.length>0?(0,t.jsx)("div",{role:"alert","data-graview-file-refused":"",style:{color:"var(--graview-warn)",fontSize:"0.875rem",display:"grid",gap:2},children:te.map((o,g)=>(0,t.jsx)("p",{style:{margin:0},children:o},g))}):null]})}var ve=(e,n)=>{let{caption:i,...r}=e;return n?{...r,caption:n}:r};function we({file:e,onCaption:n}){let[i,r]=(0,h.useState)(e.caption??"");(0,h.useEffect)(()=>r(e.caption??""),[e.caption]);let a=()=>{let l=i.trim().slice(0,500);l!==(e.caption??"")&&n(l)};return(0,t.jsx)("input",{type:"text",value:i,placeholder:E(e)||x(e)?"What it shows":"What it is","aria-label":`What ${e.name} ${E(e)||x(e)?"shows":"is"}`,"data-graview-file-caption":e.href,onChange:l=>r(l.target.value),onBlur:a,onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),a())},style:{flex:"1 1 10rem",minWidth:0,font:"inherit",fontSize:"0.875rem",minHeight:24}})}function Ee({field:e,label:n,labelStyle:i,valueStyle:r,style:a,children:l}){return(0,t.jsxs)("div",{"data-graview-files":e,style:{display:"grid",gap:6,minWidth:0,gridColumn:"1 / -1",...a},children:[(0,t.jsx)("dt",{style:i,children:n}),(0,t.jsx)("dd",{style:{margin:0,minWidth:0,display:"grid",gap:10,...r},children:l})]})}function Ce(e){let{nodeId:n,field:i,label:r,files:a}=e,{fields:l,commit:u}=me(n),s=l.find(p=>p.field===i&&p.takesValue),y=s?.shape,c=y?.type==="several"?y.of:y,b=y?.type==="several";return a.length===0&&c?.type!=="file"?null:(0,t.jsxs)(Ee,{...e,children:[(0,t.jsx)(X,{files:a,label:r}),s&&c?.type==="file"?(0,t.jsx)(Se,{value:a,thumbs:!1,several:b,image:c.image===!0,video:c.video===!0,label:r,onChange:p=>{let d=b?p:p[p.length-1];d!==void 0&&u(s,d)}}):null]})}function tt(e){switch(e.as){case"field":return e.read?e.files.length>0?(0,t.jsx)(Ee,{...e,children:(0,t.jsx)(X,{files:e.files,label:e.label})}):null:(0,t.jsx)(Ce,{...e});case"unfilled":return(0,t.jsx)(Ye,{...e});case"thumb":return(0,t.jsx)(Q,{...e});case"block":return e.files.length>0?(0,t.jsx)("span",{className:"graview-spec-image","data-graview-field":e.field,"data-graview-image":e.view,style:{display:"block",minWidth:0,...e.view==="gallery"?{position:"relative",zIndex:de.raised}:{}},children:e.view==="thumb"?(0,t.jsx)(Q,{file:e.files[0],size:72}):(0,t.jsx)(X,{files:e.files,label:e.label})}):null;case"control":{let n=(0,t.jsx)(Se,{value:Y(e.value),several:e.several,image:e.image,video:e.video===!0,label:e.label,onChange:i=>e.onChange(e.several?i:i[i.length-1])});return e.title===void 0?n:(0,t.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.several?"files":"file",children:[(0,t.jsx)("legend",{"data-graview-part":"label",children:e.title}),n]})}}}function Ye({nodeId:e,skip:n,labels:i,labelStyle:r,style:a}){let{store:l}=ge(),u=he(e),s=u?l.schema.tryDefinition(u.kind):void 0,y=pe(s).filter(c=>!n.includes(c)&&!(s?.display?.hide??[]).includes(c)&&Y(u?.[c]).length===0);return y.length===0?null:(0,t.jsx)("dl",{style:{margin:0,display:"grid",gap:14,minWidth:0},children:y.map(c=>(0,t.jsx)(Ce,{nodeId:e,field:c,label:i?.[c]??oe(s,c),files:[],...r?{labelStyle:r}:{},...a?{style:a}:{}},c))})}export{Se as FilesEditor,Ve as SEND_EDGE,tt as drawFiles,ke as kindsWords,je as prepare,_e as send,_ as sizeWords,Fe as takes,z as typeWords};
@@ -0,0 +1 @@
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{s as P}from"./chunk.YKACMLLU.js";import{Fa as S,G as M,O as w,T as y,aa as m,ba as I,s as b,w as T,x as A}from"./chunk.Q5IAXTF5.js";import{a as p}from"./chunk.SDO3U72B.js";import{b as f}from"./chunk.AJZBJBMO.js";var C=f(M(),1),h=f(y(),1),x=S(p(()=>(__graviewPreload(import.meta.url,["./chunk.R7ZZJOJW.js","./chunk.AI2HBKVP.js","./chunk.Q5IAXTF5.js","./chunk.SDO3U72B.js","./chunk.VOHRQXCF.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.MYKRJ4SV.js")))),O=x.part((e,n)=>(0,h.jsx)(e.Timeline,{...n}),{what:"The timeline"}),q=()=>x.prefetch();function K({face:e}){return w()?.open?(0,h.jsx)(C.Suspense,{fallback:null,children:(0,h.jsx)(O,{face:e})}):null}var i=f(M(),1),u=f(y(),1),v=new WeakMap,D=e=>{let n=v.get(e);return n||v.set(e,n={ask:null,doors:[],listeners:new Set}),n},k=e=>{for(let n of e.listeners)n()};function g(e,n){let t=D(e);t.ask=n,k(t)}var N=S(p(()=>(__graviewPreload(import.meta.url,["./chunk.XZLKTOJE.js","./chunk.R7ZZJOJW.js","./chunk.73EKJ4JN.js","./chunk.INL4OZI7.js","./chunk.5WU2UTP7.js","./chunk.AI2HBKVP.js","./chunk.Q5IAXTF5.js","./chunk.SDO3U72B.js","./chunk.VOHRQXCF.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.RMRO5JZX.js")))),B=N.part((e,n)=>{let t=e.NotifySheet;return(0,u.jsx)(t,{...n})},{what:"Notify me"}),W=N.part((e,n)=>{let t=e.NotifiedList;return(0,u.jsx)(t,{...n})},{quiet:!0}),E=(e,n)=>n===void 0&&(e.onBehalfOf??e).id!==void 0;function F(e,n,t){let c=d=>t.tryDefinition(d)?.noun??d.replace(/[-_]+/g," "),o=e.on!==void 0?e.on:e.about.length===1?e.about[0]:void 0;if(e.act!==void 0){let d=o!==void 0&&n(o)!==void 0?o:void 0;return{label:"Notify me when someone does this\u2026",choices:[{on:"act",act:e.act,...d!==void 0?{record:d}:{}},...d!==void 0?[{on:"act",act:e.act}]:[]]}}if(o===void 0)return null;let s=n(o);if(s!==void 0)return{label:"Notify me when this changes\u2026",choices:[{on:"changed",record:o},{on:"act",record:o},{on:"reaches",kind:s,condition:"",record:o}]};let r=b(o)!==null?[b(o)]:T(o)?A(o):[];if(r.length!==1||!t.kinds.includes(r[0]))return null;let l=r[0],a=c(l);return{label:`Notify me when ${/^[aeiou]/i.test(a)?"an":"a"} ${a} is added\u2026`,choices:[{on:"created",kind:l},{on:"changed",kind:l},{on:"reaches",kind:l,condition:""}]}}function L(){let{store:e,principal:n,subscriptions:t,signIn:c}=m(),o=E(n,c);return(0,i.useMemo)(()=>o?s=>{let r=F(s,a=>e.graph.getNode(a)?.kind,e.schema);return r?{id:"notify",items:[{id:"notify-me",label:r.label,run:()=>g(t,{choices:r.choices,returnTo:s.element??null})}],prepare:()=>N.prefetch()}:null}:null,[o,e,t])}var z=[];function U({children:e}){let n=L(),t=(0,i.useMemo)(()=>n?[n]:z,[n]);return(0,u.jsx)(P,{sections:t,children:e})}function V(){let{subscriptions:e}=m(),n=(0,i.useId)(),t=D(e);(0,i.useEffect)(()=>(t.doors.push(n),k(t),()=>{t.doors.splice(t.doors.indexOf(n),1),k(t)}),[t,n]);let c=(0,i.useMemo)(()=>r=>(t.listeners.add(r),()=>void t.listeners.delete(r)),[t]),o=(0,i.useSyncExternalStore)(c,()=>t.ask,()=>null),s=(0,i.useSyncExternalStore)(c,()=>t.doors[0]===n,()=>!1);return!o||!s?null:(0,u.jsx)(i.Suspense,{fallback:null,children:(0,u.jsx)(B,{ask:o,close:()=>g(e,null)})})}function X({choices:e,label:n="Notify me",style:t,className:c,testId:o="notify-me"}){let{principal:s,subscriptions:r,signIn:l}=m();return E(s,l)?(0,u.jsx)("button",{type:"button","data-testid":o,className:c,onClick:a=>g(r,{choices:e,returnTo:a.currentTarget}),style:t,children:n}):null}function G(){let e=I(),n=e?.subscriptions,t=e?(e.principal.onBehalfOf??e.principal).id:void 0,[c,o]=(0,i.useState)(0);return(0,i.useEffect)(()=>{if(t===void 0||!n)return;let s=!0,r=()=>void Promise.resolve(n.list(t)).then(a=>s&&o(a.length),()=>s&&o(0));r();let l=n.onChange?.(r);return()=>{s=!1,l?.()}},[n,t]),c}function Y({style:e}){return G()===0?null:(0,u.jsx)(i.Suspense,{fallback:null,children:(0,u.jsx)(W,{...e?{style:e}:{}})})}export{q as a,K as b,L as c,U as d,V as e,X as f,G as g,Y as h};
@@ -1 +1 @@
1
- import{a as f}from"./chunk.CR5MQMOL.js";import{da as d}from"./chunk.BLS2G3CD.js";function x(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 v(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 C(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 P(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{x as a,v as b,C as c,P as d};
1
+ import{a as f}from"./chunk.C7EEYSAM.js";import{da as d}from"./chunk.VOHRQXCF.js";function x(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 v(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 C(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 P(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{x as a,v as b,C as c,P as d};
@@ -1 +1 @@
1
- import{G as w,S as d}from"./chunk.SGMVLKZO.js";import{zd as m}from"./chunk.BLS2G3CD.js";import{b as i}from"./chunk.AJZBJBMO.js";var a=i(w(),1);var t=i(d(),1),b={textDecorationLine:"underline",textDecorationColor:"color-mix(in srgb, currentColor 50%, transparent)",textDecorationThickness:1,textUnderlineOffset:"0.2em"};function f({children:e,mark:r="\u2192"}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{style:b,children:e}),(0,t.jsx)("span",{"aria-hidden":"true",children:r})]})}var n=i(d(),1);function R({context:e,stop:r,title:o,label:s,style:y,className:l,children:g,...p}){let c=m(e.views?.arrangement?.()),S=g??(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(f,{mark:"\u2197",children:["In ",c==="Scene"?"the scene":c.replace(/^The /,"the ")]})}),u=s?{"aria-label":s}:{};if(e.overview){let h=e.overview;return(0,n.jsx)("a",{href:r,...p,...u,...o?{title:o}:{},style:y,...l?{className:l}:{},onClick:v=>{v.preventDefault(),h(r)},children:S})}return e.embedded?null:(0,n.jsx)("a",{href:`${e.sceneHref??"/"}${r}`,...p,...u,...o?{title:o}:{},style:y,...l?{className:l}:{},children:S})}function P(){return(0,n.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:e=>{e.preventDefault();let r=new URL(window.location.href);r.searchParams.set("fresh","1"),window.location.assign(r.toString())},style:{color:"inherit",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24},children:"Start fresh"})}function k(e){let r=(0,a.useRef)(0),o=(0,a.useCallback)(s=>e.subscribe(()=>{r.current+=1,s()}),[e]);return(0,a.useSyncExternalStore)(o,()=>r.current,()=>0)}function L(e){return e===void 0?{}:e==="sm"||e==="md"?{"data-size":e}:{style:{"--graview-control-height":typeof e=="number"?`${e}px`:e}}}var D=(e,r)=>r?`${e} ${r}`:e;export{f as a,R as b,P as c,k as d,L as e,D as f};
1
+ import{G as w,T as d}from"./chunk.Q5IAXTF5.js";import{Gd as m}from"./chunk.VOHRQXCF.js";import{b as i}from"./chunk.AJZBJBMO.js";var a=i(w(),1);var t=i(d(),1),b={textDecorationLine:"underline",textDecorationColor:"color-mix(in srgb, currentColor 50%, transparent)",textDecorationThickness:1,textUnderlineOffset:"0.2em"};function f({children:e,mark:r="\u2192"}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{style:b,children:e}),(0,t.jsx)("span",{"aria-hidden":"true",children:r})]})}var n=i(d(),1);function R({context:e,stop:r,title:o,label:s,style:y,className:l,children:g,...p}){let c=m(e.views?.arrangement?.()),S=g??(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(f,{mark:"\u2197",children:["In ",c==="Scene"?"the scene":c.replace(/^The /,"the ")]})}),u=s?{"aria-label":s}:{};if(e.overview){let h=e.overview;return(0,n.jsx)("a",{href:r,...p,...u,...o?{title:o}:{},style:y,...l?{className:l}:{},onClick:v=>{v.preventDefault(),h(r)},children:S})}return e.embedded?null:(0,n.jsx)("a",{href:`${e.sceneHref??"/"}${r}`,...p,...u,...o?{title:o}:{},style:y,...l?{className:l}:{},children:S})}function P(){return(0,n.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:e=>{e.preventDefault();let r=new URL(window.location.href);r.searchParams.set("fresh","1"),window.location.assign(r.toString())},style:{color:"inherit",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24},children:"Start fresh"})}function k(e){let r=(0,a.useRef)(0),o=(0,a.useCallback)(s=>e.subscribe(()=>{r.current+=1,s()}),[e]);return(0,a.useSyncExternalStore)(o,()=>r.current,()=>0)}function L(e){return e===void 0?{}:e==="sm"||e==="md"?{"data-size":e}:{style:{"--graview-control-height":typeof e=="number"?`${e}px`:e}}}var D=(e,r)=>r?`${e} ${r}`:e;export{f as a,R as b,P as c,k as d,L as e,D as f};
@@ -1 +1 @@
1
- import{c as m}from"./chunk.QFI4L2HK.js";import{da as c,ea as f,fa as u,ha as p,la as h,ma as l}from"./chunk.BLS2G3CD.js";function A(t,e){let n=t.schema.kinds,r="kind"in e?e.kind:void 0;if(r!==void 0&&!n.includes(r))return`There is no kind "${r}" in this app. Its kinds are: ${n.join(", ")}.`;if(e.on==="act"&&e.act!==void 0&&t.allMutations&&!t.allMutations().some(i=>i.name===e.act))return`There is no act "${e.act}" in this app.`;let o="record"in e?e.record:void 0;if(o!==void 0&&t.graph&&!t.graph.getNode(o))return`No record "${o}" is here to be told about.`;if(o!==void 0&&r!==void 0&&t.graph&&t.graph.getNode(o)?.kind!==r)return`\u201C${o}\u201D is not ${h(r)}.`;if(e.on==="changed"&&e.kind===void 0&&e.record===void 0)return"Say which kind, or which record, to be told about.";if(e.on==="reaches"){if(e.condition.trim()==="")return"Say what it should reach: a condition like done == true.";try{m(e.condition)}catch(i){return`The condition does not read: ${i instanceof Error?i.message:String(i)}.`}}}function a(t,e){let n=t.graph?.getNode(e);return n?c(t.schema.tryDefinition(n.kind),n):e}function g(t,e){let n=t.allMutations?.().find(r=>r.name===e);return n?f(n):u(e)}function M(t,e){let{when:n}=e,r=e.alsoMine?"anyone":"someone else",o=d=>l(t.schema.tryDefinition(d),d),i=d=>{let s=o(d);return`${/^[aeiou]/i.test(s)?"an":"a"} ${s}`};switch(n.on){case"act":{let d=n.act!==void 0?`\u201C${g(t,n.act)}\u201D`:"an act";return`When ${r} runs ${d}${n.record!==void 0?` on \u201C${a(t,n.record)}\u201D`:""}`}case"created":return`When ${r} adds ${i(n.kind)}`;case"changed":return n.record!==void 0?`When ${r} changes \u201C${a(t,n.record)}\u201D`:`When ${r} changes any of the ${p(t.schema,n.kind)}`;case"reaches":return`When ${n.record!==void 0?`\u201C${a(t,n.record)}\u201D`:i(n.kind)} reaches ${n.condition}${e.alsoMine?"":" (by someone else)"}`}}export{A as a,M as b};
1
+ import{c as m}from"./chunk.INL4OZI7.js";import{da as c,ea as p,fa as u,ha as f,la as h,ma as l}from"./chunk.VOHRQXCF.js";function M(t,e){let n=t.schema.kinds,r="kind"in e?e.kind:void 0;if(r!==void 0&&!n.includes(r))return`There is no kind "${r}" in this app. Its kinds are: ${n.join(", ")}.`;if(e.on==="act"&&e.act!==void 0&&t.allMutations&&!t.allMutations().some(i=>i.name===e.act))return`There is no act "${e.act}" in this app.`;let o="record"in e?e.record:void 0;if(o!==void 0&&t.graph&&!t.graph.getNode(o))return`No record "${o}" is here to be told about.`;if(o!==void 0&&r!==void 0&&t.graph&&t.graph.getNode(o)?.kind!==r)return`\u201C${o}\u201D is not ${h(r)}.`;if(e.on==="changed"&&e.kind===void 0&&e.record===void 0)return"Say which kind, or which record, to be told about.";if(e.on==="reaches"){if(e.condition.trim()==="")return"Say what it should reach: a condition like done == true.";try{m(e.condition)}catch(i){return`The condition does not read: ${i instanceof Error?i.message:String(i)}.`}}}function d(t,e){let n=t.graph?.getNode(e);return n?c(t.schema.tryDefinition(n.kind),n):e}function y(t,e){let n=t.allMutations?.().find(r=>r.name===e);return n?p(n):u(e)}function v(t,e){let{when:n}=e,r=e.alsoMine?"anyone":"someone else",o=s=>l(t.schema.tryDefinition(s),s),i=s=>{let a=o(s);return`${/^[aeiou]/i.test(a)?"an":"a"} ${a}`};switch(n.on){case"act":{let s=n.act!==void 0?`\u201C${y(t,n.act)}\u201D`:"an act";return`When ${r} runs ${s}${n.record!==void 0?` on \u201C${d(t,n.record)}\u201D`:""}`}case"created":return`When ${r} adds ${i(n.kind)}`;case"changed":return n.record!==void 0?`When ${r} changes \u201C${d(t,n.record)}\u201D`:`When ${r} changes any of the ${f(t.schema,n.kind)}`;case"reaches":return`When ${n.record!==void 0?`\u201C${d(t,n.record)}\u201D`:i(n.kind)} reaches ${n.condition}${e.alsoMine?"":" (by someone else)"}`}}export{M as a,v as b};
@@ -0,0 +1 @@
1
+ import{a as h}from"./chunk.TI4OSTQV.js";import{I as k,M as I,P as M,T as w,W as R,dc as T,eb as j,fb as y,gc as N,ka as P,mc as K,ob as B,pc as b}from"./chunk.VOHRQXCF.js";var O=(e,i)=>e.expiresAt!==void 0&&Date.parse(e.expiresAt)<=Date.parse(i),L=(e,i,n)=>(e??[]).some(t=>t.suggestion===i&&(t.until===void 0||Date.parse(t.until)>Date.parse(n)));function $(e,i=()=>!0,n={}){let t=T(e),o=new Set(e.map(r=>r.lineage?.suggestion)),s=n.now??new Date().toISOString();return e.filter(r=>r.suggests&&!r.withheld&&!t.has(r.id)&&!o.has(r.id)&&!O(r,s)&&!L(n.dismissed,r.id,s)).map(({id:r,batch:g,suggests:p,intent:c,author:a,lineage:d,at:l,expiresAt:f})=>{let u=new Set;return JSON.stringify(p.map(D=>D.args),(D,x)=>(typeof x=="string"&&i(x)&&u.add(x),x)),{id:r,batch:g,calls:p,intent:c,author:a,...d?{lineage:d}:{},at:l,expiresAt:f,about:[...u]}})}function W(e,i){return e.ops.length>0&&e.ops.every(n=>n.suggests!==void 0||n.undoes!==void 0&&i(n.undoes)?.suggests!==void 0)}var v=e=>[...e].length;function F(e){let i,n=0,t=0;for(let o of e.ops){let s=o.mutation?.name===B&&o.withheld!==!0&&o.undoes===void 0?o.mutation.args:void 0;if(typeof s?.node!="string"||typeof s.field!="string"||i&&(i.node!==s.node||i.field!==s.field))return;i={node:s.node,field:s.field};for(let r of o.primitives)r.op==="splice-text"?(n+=v(r.inserted),t+=v(r.removed)):r.op==="patch-node"&&typeof r.after[s.field]=="string"&&(n+=v(r.after[s.field]))}return i&&{...i,inserted:n,removed:t}}function V(e,i,n){let t=n.getNode(e.node)?.kind,o=[...e.inserted>0||e.removed===0?[`+${e.inserted}`]:[],...e.removed>0?[`\u2212${e.removed}`]:[]];return`Wrote in ${P(t?i.tryDefinition(t):void 0,e.field)} (${o.join(" ")})`}var m=e=>JSON.stringify([e.kind,e.id??"",e.name??""]),_=e=>e.ops.find(i=>i.lineage?.run!==void 0)?.lineage?.run;function J(e,i=()=>{}){let n=[];for(let t of e){if(W(t,i))continue;if(!K(t.author)){let a=F(t),d=n.at(-1),l=a&&d&&"batch"in d&&m(d.batch.author)===m(t.author)&&d.typed?.node===a.node&&d.typed.field===a.field?d.typed:void 0;l?n[n.length-1]={batch:t,typed:{...l,batches:[...l.batches,t],inserted:l.inserted+a.inserted,removed:l.removed+a.removed}}:n.push(a?{batch:t,typed:{batches:[t],...a}}:{batch:t});continue}let o=_(t),s=m(t.author),r=o!==void 0?n.findIndex(a=>"digest"in a&&a.digest.run===o&&m(a.digest.author)===s):n.length-1,g=n[r],p=g!==void 0&&"digest"in g&&m(g.digest.author)===s&&g.digest.run===o?g.digest:void 0,c=[...p?.batches??[],t];p&&n.splice(r,1),n.push({digest:{author:t.author,batches:c,things:Y(c),at:t.at,...o!==void 0?{run:o}:{}}})}return n}var Y=e=>e.reduce((i,n)=>i+(n.undone?0:n.ops.length),0),q=e=>{let i=Date.parse(e);if(Number.isNaN(i))return!1;let{minutes:n}=M(i,I());return n<6*60||n>=21*60};function z(e,i=w(new Date().toISOString())??k()){let n=w(e.at)??e.at.slice(0,10),o=e.run!==void 0&&n===i&&[e.at,...(e.batches??[]).map(s=>s.at)].every(q)?"overnight":n===i?"today":`on ${R(n)}`;return`Tidied ${e.things===1?"one thing":`${e.things} things`} ${o}`}var S=e=>e,A=(e,i)=>i===void 0?{}:{[e]:i};function de(e,i,n){let t=h(e)?.store??e,o=S(t),s=N(n.lineage);if(s===void 0)throw new y("A suggestion says what it is based on: { basis, confidence? }");let r=n.author??o.by;if(n.expiresAt!==void 0&&Number.isNaN(Date.parse(n.expiresAt)))throw new y(`A suggestion expires at a time: "${n.expiresAt}" is not one (an ISO time, like 2026-10-23T06:00:00Z).`);let g=o.actMeanings(),p=b(i,g),c=C(t).find(u=>b(u.calls,g)===p);if(c)return t.log.get(c.id);o.refuseDeclined(i,r);let a=o.rehearsal();a.suggesting=!0;let d=a.applying(i,{author:r,lineage:s,...A("via",n.via)});if(d.ops.length===0)return;let l=[...new Set(d.ops.flatMap(u=>u.described??[]))],f={id:o.nextId(),seq:t.log.length,batch:o.mintBatch("batch"),author:r,intent:d.ops.map(u=>u.intent).join("; "),...A("batchIntent",n.intent),mutation:null,primitives:[],reads:[],writes:[],...l.length>0?{described:l}:{},at:o.now(),...A("via",n.via),lineage:s,suggests:i,...A("expiresAt",n.expiresAt)};return t.log.append(f),t.notify(j,[f]),f}function C(e,i,n={}){let t=h(e),o=t?.store??e,s=i??t?.principal,r=(s!==void 0?o.seenBy(s):o).log.all();return $(r,g=>o.graph.has(g),{now:S(o).now(),dismissed:n.dismissed})}function E(e,i,n){let t=C(e,n).find(s=>s.id===i),o=t?void 0:e.log.get(i);if(o?.suggests&&O(o,S(e).now()))throw new y(`That suggestion expired on ${o.expiresAt.slice(0,10)}.`);if(!t)throw new y("That suggestion is no longer waiting: it was accepted or declined, or it is not one you can see.");return t}function ge(e,i,n={}){let t=h(e)?.store??e,o=n.author??S(t).by,s=E(t,i,o);return t.applyAll(s.calls,{...n,author:o,lineage:{...s.lineage,suggestion:i}})}function le(e,i,n={}){let t=h(e)?.store??e,o=n.author??S(t).by,s=E(t,i,o);return t.undo(s.batch,{...n,author:o})}export{V as a,J as b,z as c,de as d,C as e,ge as f,le as g};
@@ -0,0 +1 @@
1
+ import{l as O}from"./chunk.OJGHDWI6.js";import{j as C}from"./chunk.OYRZ2DEI.js";import{G as x,Ka as G,T as M,aa as w,ba as I,c as V,ca as W,x as B}from"./chunk.Q5IAXTF5.js";import{C as D,Jc as _,Kc as L,Ob as F,Qc as j,Zb as N}from"./chunk.VOHRQXCF.js";import{b as m}from"./chunk.AJZBJBMO.js";function H(t,e){let n=t.graph.getNode(e);if(!n)return[];let i=n.kind,a=t.schema.tryDefinition(i);if(!a)return[];let c=t.seenFor,u=c?j.keptFrom?.(t,c)?.(n):void 0,o=new Map;for(let r of t.allMutations()){let s=r.subject;if(!s||!(s.kinds==="*"||s.kinds.includes(i)))continue;let l=r.input.shape??{};for(let d of N(r,a)){if(u?.(d))continue;let b=d in l,k=[];for(let h of Object.keys(l)){if(h===s.arg||h===d||X(l[h]))continue;let v=F(r.input).find(S=>S.name===h);k.push({name:h,...v?{kinds:v.kinds}:{},...v?{candidates:v.kinds.includes("*")?t.graph.allNodes().map(S=>S.id):v.kinds.flatMap(S=>t.graph.nodesOfKind(S).map(J=>J.id))}:{},shape:C(r.input,h)})}let Q={field:d,mutation:r.name,title:r.title??r.name,shape:b?C(r.input,d):{type:"unknown"},takesValue:b,alternatives:[],open:k,call:h=>({name:r.name,args:b?{[s.arg]:e,[d]:h}:{[s.arg]:e}})};o.set(d,[...o.get(d)??[],Q])}}return[...o.values()].map(r=>{let s=[...r.filter(d=>d.takesValue),...r.filter(d=>!d.takesValue)],[f,...l]=s;return{...f,alternatives:l}})}function X(t){let e=D(t)?.type;return e==="optional"||e==="default"||e==="nullable"}var R=m(x(),1);function be(t){let{store:e,principal:n}=w(),i=W(),a=(0,R.useMemo)(()=>t===null?[]:H(e,t),[e,t,i]),c=(0,R.useCallback)((u,o,r={})=>{let s=u.call(o);e.apply({name:s.name,args:{...s.args,...r}},{author:n})},[e,n]);return{fields:a,commit:c}}var K=m(x(),1);function Qe(){let{brand:t}=w(),e=t?.kit;return(0,K.useMemo)(()=>_(e),[e])}function Je(t,e){let n=L(t,e),i={...n.color!==void 0?{color:n.color}:{},...n.pattern!==void 0?{pattern:n.pattern}:{},...n.width!==void 0?{width:n.width}:{},...n.cap!==void 0?{cap:n.cap}:{},...n.opacity!==void 0?{opacity:n.opacity}:{}};return{connector:n,style:O(e,{[e]:i})}}var $=m(x(),1);var g=m(M(),1);function Z(t){let e=t?.hint;return typeof e=="string"&&e.length>0?e:void 0}function ee(t){if(t instanceof Error&&t.message)return t.message;let e=String(t);return e==="[object Object]"?"The view threw without a message.":e}var U=class extends $.Component{static contextType=G;state={};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,n){console.error(`[graview] the ${this.props.view??"view"} of ${this.props.kind} threw while rendering`,e,n.componentStack),this.context?.(e,{module:"@graview/react"})}render(){let{error:e}=this.state;if(!e)return this.props.children;let n=Z(e);return(0,g.jsxs)("div",{role:"alert","data-graview-view-error":this.props.kind,style:{display:"flex",flexDirection:"column",gap:"0.375rem",padding:"var(--graview-pad, 12px)",height:"100%",overflow:"auto",boxSizing:"border-box",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)",font:"var(--graview-font-body, 13px/1.45 system-ui)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,g.jsx)("strong",{style:{color:"var(--graview-warn, #b4462a)"},children:this.props.view?`${this.props.view} could not draw`:"This view could not draw"}),(0,g.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:this.props.kind}),(0,g.jsx)("span",{children:ee(e)}),n?(0,g.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:n}):null]})}};var y=m(x(),1);var q=m(M(),1),A=(0,y.createContext)([]);function nt({sections:t,children:e}){let n=(0,y.useContext)(A),i=(0,y.useMemo)(()=>[...n,...t.filter(a=>!n.includes(a))],[n,t]);return(0,q.jsx)(A.Provider,{value:i,children:e})}function z(){let t=(0,y.useContext)(A),e=I()?.menuSections;return(0,y.useMemo)(()=>e?[...t,...e.filter(n=>!t.includes(n))]:t,[t,e])}function rt(){let t=z();return(0,y.useCallback)(e=>{for(let n of t)try{n(e)?.prepare?.()}catch{}},[t])}function ot(t){let e=z();if(t===null||e.length===0)return{start:[],end:[]};let n=e.flatMap(i=>{try{let a=i(t);return a&&((a.items?.length??0)>0||a.render)?[a]:[]}catch{return[]}});return{start:n.filter(i=>i.at==="start"),end:n.filter(i=>i.at!=="start")}}var te=m(x(),1);function st(){return w().activity}var P=(t,e)=>t.length*e*.58;var ne=156,re=2,E=ne-18,oe=7.1,ie=16;function ae(t,e){let n=0,i=E;for(let a of t.split(" ")){let c=e(a),u=i+e(" ")+c;if(u<=E)i=u;else{let o=Math.ceil(c/E)||1;n+=o,i=c-(o-1)*E}}return n}var se=16.25,Y=27,ce=(t,e)=>{let n=Math.ceil(t.length*oe/E);return e?Math.max(Y,Math.ceil(Math.max(n,ae(t,e))*se)+6):Math.max(Y,n*ie+6)};function ut(t,e,n){return t.length===0?0:10+t.reduce((i,a)=>i+ce(a,n),0)+(t.length-1)*re}var de=27,ue=8,lt=4,le=64,pt=t=>Math.max(1,Math.min(ue,t)),ft=t=>t*de+le;var p=m(x(),1);function gt(t,{units:e,target:n=0,legibleAt:i=260}){let[a,c]=(0,p.useState)(e);(0,p.useEffect)(()=>{let o=t.current;if(o===null||typeof ResizeObserver>"u")return;let r=new ResizeObserver(([s])=>{let f=s?.contentRect.width??0;f>0&&c(f)});return r.observe(o),()=>r.disconnect()},[t]);let u=a/e;return{scale:u,width:a,touchable:u*n>=24,legible:a>=i}}function xt(t="--graview-font-body",e="sans-serif"){let n=(0,p.useRef)(void 0),i=(0,p.useMemo)(()=>{if(typeof getComputedStyle!="function"||typeof document>"u")return e;let a=getComputedStyle(document.documentElement).getPropertyValue(t).trim();return a.length>0?a:e},[t,e]);return(0,p.useMemo)(()=>{n.current===void 0&&(n.current=typeof document>"u"?null:document.createElement("canvas").getContext("2d")??null);let a=n.current;return a===null?P:(c,u)=>{a.font=`${u}px ${i}`;let o=a.measureText(c).width;return o>0?o:P(c,u)}},[i])}var wt=(0,p.createContext)(void 0);var T=3;function pe(t){let e=V(t),n=e.focusId;if(!n)return null;if(e.within?.view){let[a]=B(n);if(a)return{at:`screen:${a}`,audience:!0}}return{at:n,audience:!1}}var fe=102,me=32;function St(t,e,n){let i=[],a=new Map,c=new Map,u=0;for(let o of t){let r=pe(o.stop),s=r?e(r.at):null;if(!r||!s){o.name&&i.push({kind:"edge",presence:o,point:{x:n-8,y:fe+u++*me}});continue}if(!o.name){let k=c.get(r.at);c.set(r.at,{n:(k?.n??0)+1,box:s});continue}let f=a.get(r.at)??[];if(f.push(o),a.set(r.at,f),f.length>T)continue;let l=s,d=f.length-1,b=r.audience?{x:l.x+l.width*.5+(d-1)*26,y:l.y+Math.min(l.height,24)}:{x:l.x+l.width*.5-26-d*26,y:l.y+l.height-4};i.push({kind:"person",presence:o,point:b,at:r.at,index:d,of:f.length,audience:r.audience})}for(let[o,r]of a){if(r.length<=T)continue;let s=e(o);s&&i.push({kind:"count",at:o,point:{x:s.x+s.width*.5+2*26+18,y:s.y+s.height-4},n:r.length-T})}for(let[o,{n:r,box:s}]of c)i.push({kind:"count",at:o,point:{x:s.x+s.width*.5+40,y:s.y+s.height-4},n:r});for(let o of t)if(o.name){if(o.robot?.at&&o.robot.mode!=="docked"){let r=e(o.robot.at);r&&i.push({kind:"robot",presence:o,point:{x:r.x+r.width/2+22,y:r.y+r.height-4},mode:o.robot.mode})}if(o.over){let r=e(o.over);r&&i.push({kind:"over",presence:o,box:r})}}return i}export{st as a,P as b,ne as c,re as d,Y as e,ut as f,de as g,lt as h,le as i,pt as j,ft as k,gt as l,xt as m,be as n,Qe as o,Je as p,St as q,U as r,nt as s,rt as t,ot as u};
@@ -1,4 +1,4 @@
1
- import{a as he,b as xe,c as be,d as ie,e as I}from"./chunk.TKUNRFDE.js";import{c as A,e as re}from"./chunk.TY6VILZB.js";import{a as te}from"./chunk.HG34MT7C.js";import{$ as ee,G as U,S as Z,ba as ne}from"./chunk.SGMVLKZO.js";import"./chunk.SDO3U72B.js";import{Gc as Q,U as j,da as J}from"./chunk.BLS2G3CD.js";import"./chunk.EJUZGIQ5.js";import{b as C}from"./chunk.AJZBJBMO.js";var w=C(U(),1);var P=C(U(),1),ke=(e,n)=>`graview:last-visit:${n??"anyone"}:${e.join(",")}`;function Pe(e,n,r){let t=new Set;for(let i of e)if(!(i.author.id!==void 0&&i.author.id===r)&&Date.parse(i.at)>n)for(let o of i.writes)t.add(o);return t}function oe(e,n,r){let t=ke(n,r?.id),[i]=(0,P.useState)(()=>{try{let o=globalThis.localStorage?.getItem(t);return o?Number(o):null}catch{return null}});return(0,P.useEffect)(()=>{let o=()=>{if(document.visibilityState==="hidden")try{globalThis.localStorage?.setItem(t,String(Date.now()))}catch{}};return document.addEventListener("visibilitychange",o),window.addEventListener("pagehide",o),()=>{document.removeEventListener("visibilitychange",o),window.removeEventListener("pagehide",o)}},[t]),(0,P.useMemo)(()=>i===null?new Set:Pe(e,i,r?.id),[e,i,r?.id])}function ae(e,n,r){let t=new Set;if(r===void 0)return t;t.add(r);for(let i of[...e.out(r),...e.in(r)])t.add(i.id);for(let i of n)if(i.author.id===r)for(let o of i.primitives)o.op==="add-node"&&t.add(o.node.id);return t}var g=C(Z(),1);function Se(e,n,r={x:0,y:0}){let t=(i,o)=>{let c=A(i,o,n.cell,n.tilt);return{x:n.originX+r.x+c.x,y:n.originY+r.y+c.y}};return[t(e.col,e.row),t(e.col+e.side,e.row),t(e.col+e.side,e.row+e.side),t(e.col,e.row+e.side)]}var B=e=>e.map(n=>`${n.x.toFixed(1)},${n.y.toFixed(1)}`).join(" ");function Ie({frame:e,width:n,height:r,pan:t,pinned:i,close:o,today:c,swallowed:y,chosen:p=[],onFocus:f}){let{selection:u,store:d,scheme:S,principal:x}=ee(),b=ne(),a=(0,w.useMemo)(()=>d.log.all(),[d,b]),m=oe(a,d.schema.kinds,x),$=(0,w.useMemo)(()=>ae(d.graph,a,x?.id),[d,a,x?.id]),se=te(),E=e.city,D=e.nodes.filter(l=>l.plot!==void 0&&Math.round(l.plane)===2),R=E?.cell??0,F=E?.tilt??.5,K=(0,w.useRef)(f);K.current=f;let le=(0,w.useCallback)(l=>!K.current||y?.current?!1:(K.current(l),!0),[y]),X=(0,w.useRef)(new Map),M=new Map;for(let l of D){let O=l.aggregate?.memberIds??[],v=re(d.schema,l.kind),z=s=>v?d.graph.getNode(s)?.[v.field]:void 0,L=O.filter(s=>p.includes(s)),G=`${R}|${F}|${l.plot.col},${l.plot.row},${l.plot.side}|${L.join(",")}|${O.map(s=>`${s}=${String(z(s))}`).join(",")}`,T=X.current.get(l.id);if(T&&T.key===G){M.set(l.id,T);continue}let V={cell:R,originX:0,originY:0,tilt:F},q={x:0,y:0},we=d.schema.tryDefinition(l.kind),ye=s=>{let h=d.graph.getNode(s);return h?J(we,h):s},k=v?v.values.map(()=>[]):[[]],N=v?[...v.tiers]:["waiting"];for(let s of L.length>0?[...L,...O.filter(h=>!L.includes(h))]:O){let h=v?v.values.indexOf(z(s)):0;h>=0?k[h].push(s):(k.length===N.length&&(k.push([]),N.push("waiting")),k[k.length-1].push(s))}let{blocks:pe,rests:ve}=I(l.plot,k,N.map(s=>ie[s])),me=Se(l.plot,V,q),H=v?Le(d.schema,l.kind):void 0;M.set(l.id,{key:G,tile:B(me),rests:ve.map(s=>({count:s.count,rows:s.rows,at:A(s.col,s.row,R,F)})),buildings:pe.map(s=>{let W=(H?d.graph.getNode(s.id):void 0)?.[H];return{id:s.id,tier:N[s.lane],overdue:typeof W=="string"&&N[s.lane]!=="done"&&W.slice(0,10)<(c??new Date().toISOString().slice(0,10)),name:ye(s.id),width:s.footprint*R,...Ce(s,V,q)}})})}if(X.current=M,!E)return null;let de={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible"},ge=u.join(`
1
+ import{a as he,b as xe,c as be,d as ie,e as I}from"./chunk.TKUNRFDE.js";import{c as A,e as re}from"./chunk.I2W7HSBU.js";import{a as te}from"./chunk.337JMOTL.js";import{G as U,T as Z,aa as ee,ca as ne}from"./chunk.Q5IAXTF5.js";import"./chunk.SDO3U72B.js";import{Mc as Q,U as j,da as J}from"./chunk.VOHRQXCF.js";import"./chunk.SLBWPVIY.js";import{b as C}from"./chunk.AJZBJBMO.js";var w=C(U(),1);var P=C(U(),1),ke=(e,n)=>`graview:last-visit:${n??"anyone"}:${e.join(",")}`;function Pe(e,n,r){let t=new Set;for(let i of e)if(!(i.author.id!==void 0&&i.author.id===r)&&Date.parse(i.at)>n)for(let o of i.writes)t.add(o);return t}function oe(e,n,r){let t=ke(n,r?.id),[i]=(0,P.useState)(()=>{try{let o=globalThis.localStorage?.getItem(t);return o?Number(o):null}catch{return null}});return(0,P.useEffect)(()=>{let o=()=>{if(document.visibilityState==="hidden")try{globalThis.localStorage?.setItem(t,String(Date.now()))}catch{}};return document.addEventListener("visibilitychange",o),window.addEventListener("pagehide",o),()=>{document.removeEventListener("visibilitychange",o),window.removeEventListener("pagehide",o)}},[t]),(0,P.useMemo)(()=>i===null?new Set:Pe(e,i,r?.id),[e,i,r?.id])}function ae(e,n,r){let t=new Set;if(r===void 0)return t;t.add(r);for(let i of[...e.out(r),...e.in(r)])t.add(i.id);for(let i of n)if(i.author.id===r)for(let o of i.primitives)o.op==="add-node"&&t.add(o.node.id);return t}var g=C(Z(),1);function Se(e,n,r={x:0,y:0}){let t=(i,o)=>{let c=A(i,o,n.cell,n.tilt);return{x:n.originX+r.x+c.x,y:n.originY+r.y+c.y}};return[t(e.col,e.row),t(e.col+e.side,e.row),t(e.col+e.side,e.row+e.side),t(e.col,e.row+e.side)]}var B=e=>e.map(n=>`${n.x.toFixed(1)},${n.y.toFixed(1)}`).join(" ");function Ie({frame:e,width:n,height:r,pan:t,pinned:i,close:o,today:c,swallowed:y,chosen:p=[],onFocus:f}){let{selection:u,store:d,scheme:S,principal:x}=ee(),b=ne(),a=(0,w.useMemo)(()=>d.log.all(),[d,b]),m=oe(a,d.schema.kinds,x),$=(0,w.useMemo)(()=>ae(d.graph,a,x?.id),[d,a,x?.id]),se=te(),E=e.city,D=e.nodes.filter(l=>l.plot!==void 0&&Math.round(l.plane)===2),R=E?.cell??0,F=E?.tilt??.5,K=(0,w.useRef)(f);K.current=f;let le=(0,w.useCallback)(l=>!K.current||y?.current?!1:(K.current(l),!0),[y]),X=(0,w.useRef)(new Map),M=new Map;for(let l of D){let O=l.aggregate?.memberIds??[],v=re(d.schema,l.kind),z=s=>v?d.graph.getNode(s)?.[v.field]:void 0,L=O.filter(s=>p.includes(s)),G=`${R}|${F}|${l.plot.col},${l.plot.row},${l.plot.side}|${L.join(",")}|${O.map(s=>`${s}=${String(z(s))}`).join(",")}`,T=X.current.get(l.id);if(T&&T.key===G){M.set(l.id,T);continue}let V={cell:R,originX:0,originY:0,tilt:F},q={x:0,y:0},we=d.schema.tryDefinition(l.kind),ye=s=>{let h=d.graph.getNode(s);return h?J(we,h):s},k=v?v.values.map(()=>[]):[[]],N=v?[...v.tiers]:["waiting"];for(let s of L.length>0?[...L,...O.filter(h=>!L.includes(h))]:O){let h=v?v.values.indexOf(z(s)):0;h>=0?k[h].push(s):(k.length===N.length&&(k.push([]),N.push("waiting")),k[k.length-1].push(s))}let{blocks:pe,rests:ve}=I(l.plot,k,N.map(s=>ie[s])),me=Se(l.plot,V,q),H=v?Le(d.schema,l.kind):void 0;M.set(l.id,{key:G,tile:B(me),rests:ve.map(s=>({count:s.count,rows:s.rows,at:A(s.col,s.row,R,F)})),buildings:pe.map(s=>{let W=(H?d.graph.getNode(s.id):void 0)?.[H];return{id:s.id,tier:N[s.lane],overdue:typeof W=="string"&&N[s.lane]!=="done"&&W.slice(0,10)<(c??new Date().toISOString().slice(0,10)),name:ye(s.id),width:s.footprint*R,...Ce(s,V,q)}})})}if(X.current=M,!E)return null;let de={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible"},ge=u.join(`
2
2
  `),ce=se.join(`
3
3
  `),ue=m?[...m].join(`
4
4
  `):"",fe=$?[...$].join(`
@@ -1,5 +1,5 @@
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{r as v}from"./chunk.ZK446PSX.js";import{$ as S,Ea as w,G as B,J as h,S as n}from"./chunk.SGMVLKZO.js";import{a as y}from"./chunk.SDO3U72B.js";import{Ic as k}from"./chunk.BLS2G3CD.js";import{b as s}from"./chunk.AJZBJBMO.js";var b=s(n(),1),R=v.part(e=>(0,b.jsx)(e.ActivityRail,{calls:[]}),{quiet:!0});var p=s(n(),1),A=e=>e.tabIndex>=0&&!e.disabled&&e.getClientRects().length>0;function T(e){if(!e)return!1;if(A(e))return e.focus({preventScroll:!1}),!0;let o=[...e.querySelectorAll("a[href], button, input, select, textarea, [tabindex]")].find(A);return o?(o.focus(),!0):(e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),e.focus(),!0)}var I=`.graview-skips{display:contents}
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{r as v}from"./chunk.AI2HBKVP.js";import{Fa as w,G as B,J as h,T as n,aa as S}from"./chunk.Q5IAXTF5.js";import{a as y}from"./chunk.SDO3U72B.js";import{Oc as k}from"./chunk.VOHRQXCF.js";import{b as s}from"./chunk.AJZBJBMO.js";var b=s(n(),1),R=v.part(e=>(0,b.jsx)(e.ActivityRail,{calls:[]}),{quiet:!0});var p=s(n(),1),A=e=>e.tabIndex>=0&&!e.disabled&&e.getClientRects().length>0;function T(e){if(!e)return!1;if(A(e))return e.focus({preventScroll:!1}),!0;let o=[...e.querySelectorAll("a[href], button, input, select, textarea, [tabindex]")].find(A);return o?(o.focus(),!0):(e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),e.focus(),!0)}var I=`.graview-skips{display:contents}
2
2
  .graview-skip{position:absolute;width:0;height:0;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
3
3
  .graview-skip:focus{width:auto;height:auto;overflow:visible;clip-path:none;padding:6px 12px;border-radius:8px;border:1px solid var(--graview-accent);background:var(--graview-float,var(--graview-panel));color:var(--graview-ink);font:inherit;font-size:.875rem;font-weight:600;box-shadow:var(--graview-lift-high);outline:2px solid var(--graview-accent);outline-offset:1px}
4
4
  .graview-skips[data-place=bar] .graview-skip:focus{position:fixed;left:8px;top:6px;z-index:${k("toast")}}
5
- .graview-skips[data-place=here] .graview-skip:focus{position:static;justify-self:start}`;function O({to:e,place:o="bar"}){return e.length===0?null:(0,p.jsxs)("span",{className:"graview-skips","data-place":o,children:[(0,p.jsx)("style",{children:I}),e.map(r=>(0,p.jsx)("button",{type:"button",className:"graview-skip","data-graview-skip":r.testid,"data-testid":`skip-${r.testid}`,...r.opens?{"data-graview-skip-opens":""}:{},onClick:r.go,children:r.label},r.testid))]})}var a=s(B(),1),f=s(n(),1),C=w(y(()=>(__graviewPreload(import.meta.url,["./chunk.F5FJHKWV.js","./chunk.3L5USMQD.js","./chunk.GQI53L5P.js","./chunk.LDE5HLTM.js","./chunk.GTUBIJTP.js","./chunk.73BJYIYS.js","./chunk.M5RHVUZ6.js","./chunk.IDQHSAAQ.js","./chunk.ROJZLOKZ.js","./chunk.VM43YREJ.js","./chunk.TI4OSTQV.js","./chunk.GZHZLJBF.js","./chunk.JLR74UFP.js","./chunk.OJGHDWI6.js","./chunk.HG34MT7C.js","./chunk.TT6QBWRA.js","./chunk.UCS3CBT4.js","./chunk.O6SKKF4V.js","./chunk.ZK446PSX.js","./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.AVCW7C6V.js")))),F=C.part((e,o)=>{let r=e.RecordInteractions;return(0,f.jsx)(r,{...o})},{quiet:!0});function D(e,o,r){let t=e.target;return(t.on==="record"||t.on==="field"?t.id===o:t.on==="selection"?t.ids.includes(o):t.on==="act"?t.id===o:!1)||e.offered.some(i=>i.id===`record:${o}`||i.id.startsWith(`fill:${o}:`))||(e.batches??[]).some(i=>r(i).includes(o))}function E({id:e,style:o,headingStyle:r,className:t}){let{ai:m,aiDesk:i,store:l}=S(),{entries:u}=h(i),c=m.off===!0;(0,a.useEffect)(()=>{c||i.load()},[i,c]);let L=l.log.length,x=(0,a.useMemo)(()=>{let P=d=>l.log.all().flatMap(g=>g.batch===d?g.writes:[]);return u.filter(d=>D(d,e,P))},[u,e,l,L]);return c||x.length===0?null:(0,f.jsx)(a.Suspense,{fallback:null,children:(0,f.jsx)(F,{entries:x,...o?{style:o}:{},...r?{headingStyle:r}:{},...t?{className:t}:{}})})}export{R as a,T as b,O as c,E as d};
5
+ .graview-skips[data-place=here] .graview-skip:focus{position:static;justify-self:start}`;function O({to:e,place:o="bar"}){return e.length===0?null:(0,p.jsxs)("span",{className:"graview-skips","data-place":o,children:[(0,p.jsx)("style",{children:I}),e.map(r=>(0,p.jsx)("button",{type:"button",className:"graview-skip","data-graview-skip":r.testid,"data-testid":`skip-${r.testid}`,...r.opens?{"data-graview-skip-opens":""}:{},onClick:r.go,children:r.label},r.testid))]})}var a=s(B(),1),f=s(n(),1),C=w(y(()=>(__graviewPreload(import.meta.url,["./chunk.UEPVA6IS.js","./chunk.WWUMSCYC.js","./chunk.Y37DXEHG.js","./chunk.DXZ5VYCQ.js","./chunk.J2R55TM7.js","./chunk.DIS7JS7X.js","./chunk.JV7FLVUV.js","./chunk.7354O67H.js","./chunk.PRCWGE7A.js","./chunk.DGWNVDZB.js","./chunk.TI4OSTQV.js","./chunk.GZHZLJBF.js","./chunk.YKACMLLU.js","./chunk.OJGHDWI6.js","./chunk.337JMOTL.js","./chunk.CV4QA4ZF.js","./chunk.OYRZ2DEI.js","./chunk.7EA7THSM.js","./chunk.AI2HBKVP.js","./chunk.Q5IAXTF5.js","./chunk.SDO3U72B.js","./chunk.VOHRQXCF.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.7SNIX56B.js")))),F=C.part((e,o)=>{let r=e.RecordInteractions;return(0,f.jsx)(r,{...o})},{quiet:!0});function D(e,o,r){let t=e.target;return(t.on==="record"||t.on==="field"?t.id===o:t.on==="selection"?t.ids.includes(o):t.on==="act"?t.id===o:!1)||e.offered.some(i=>i.id===`record:${o}`||i.id.startsWith(`fill:${o}:`))||(e.batches??[]).some(i=>r(i).includes(o))}function E({id:e,style:o,headingStyle:r,className:t}){let{ai:m,aiDesk:i,store:l}=S(),{entries:u}=h(i),c=m.off===!0;(0,a.useEffect)(()=>{c||i.load()},[i,c]);let L=l.log.length,x=(0,a.useMemo)(()=>{let P=d=>l.log.all().flatMap(g=>g.batch===d?g.writes:[]);return u.filter(d=>D(d,e,P))},[u,e,l,L]);return c||x.length===0?null:(0,f.jsx)(a.Suspense,{fallback:null,children:(0,f.jsx)(F,{entries:x,...o?{style:o}:{},...r?{headingStyle:r}:{},...t?{className:t}:{}})})}export{R as a,T as b,O as c,E as d};
@@ -0,0 +1 @@
1
+ import{a,b}from"./chunk.PRCWGE7A.js";import"./chunk.DGWNVDZB.js";import"./chunk.AI2HBKVP.js";import"./chunk.Q5IAXTF5.js";import"./chunk.SDO3U72B.js";import"./chunk.VOHRQXCF.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";export{a as ActivityFilter,b as InteractionRow};
@@ -0,0 +1 @@
1
+ import{a,b}from"./chunk.NHIPVAGR.js";import"./chunk.BJL6EL6B.js";import"./chunk.SZCZD2GM.js";import"./chunk.7FZY5E2U.js";import"./chunk.7354O67H.js";import"./chunk.C7EEYSAM.js";import"./chunk.QRCTTDDQ.js";import"./chunk.3TME4BG3.js";import"./chunk.I43ONAEL.js";import"./chunk.73EKJ4JN.js";import"./chunk.INL4OZI7.js";import"./chunk.5WU2UTP7.js";import"./chunk.CV4QA4ZF.js";import"./chunk.OYRZ2DEI.js";import"./chunk.7EA7THSM.js";import"./chunk.VOHRQXCF.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";export{b as actOnSeveral,a as actsForSeveral};
@@ -0,0 +1,88 @@
1
+ import{a as qe,c as Be}from"./chunk.R6FHEEJ7.js";import{b as Ve}from"./chunk.LESRQN3Y.js";import{a as Ie,b as Ke,c as Fe,d as j}from"./chunk.7UJZP3YK.js";import"./chunk.R77TACXU.js";import{j as Me,k as Le}from"./chunk.JOWJNIWH.js";import"./chunk.6JERQFZI.js";import"./chunk.7XJ3XQZD.js";import"./chunk.52J42KR5.js";import{e as Ee}from"./chunk.T2Q3AAQI.js";import{m as Pe}from"./chunk.63SRVTG2.js";import{a as Te,b as Oe}from"./chunk.C4EPMV7O.js";import{h as $e}from"./chunk.G7XKQNOL.js";import{e as Re,f as De}from"./chunk.7KZ44FEU.js";import"./chunk.HJCQ6I3S.js";import"./chunk.JQBP6QWQ.js";import{e as ne}from"./chunk.I2W7HSBU.js";import"./chunk.BJL6EL6B.js";import{a as xe}from"./chunk.DXZ5VYCQ.js";import"./chunk.J2R55TM7.js";import"./chunk.KPUX27ZT.js";import"./chunk.DIS7JS7X.js";import"./chunk.D2T563AA.js";import"./chunk.JV7FLVUV.js";import"./chunk.GL3YVGAP.js";import{a as Se,b as Ne,j as Ae}from"./chunk.4LI73QOY.js";import"./chunk.G4JJXA63.js";import"./chunk.VGTEEANA.js";import"./chunk.SZCZD2GM.js";import"./chunk.7FZY5E2U.js";import"./chunk.7354O67H.js";import"./chunk.XLM4ONUB.js";import"./chunk.XOZU4OFA.js";import"./chunk.C7EEYSAM.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.CHMUL36A.js";import"./chunk.U6PCKJ26.js";import"./chunk.FEBCIEI3.js";import"./chunk.WVUJXDXZ.js";import"./chunk.QRCTTDDQ.js";import{a as ye}from"./chunk.3TME4BG3.js";import"./chunk.I43ONAEL.js";import"./chunk.73EKJ4JN.js";import"./chunk.INL4OZI7.js";import"./chunk.5WU2UTP7.js";import"./chunk.GZHZLJBF.js";import{r as ke}from"./chunk.YKACMLLU.js";import"./chunk.OJGHDWI6.js";import"./chunk.337JMOTL.js";import"./chunk.CV4QA4ZF.js";import{d as te,l as be}from"./chunk.OYRZ2DEI.js";import{c as me}from"./chunk.7EA7THSM.js";import{C as Ce,r as J}from"./chunk.AI2HBKVP.js";import{G as tt,Ma as ee,Na as Y,T as we,V as ve,aa as V,ca as X,j as ge,l as ue,la as he,m as fe,r as U}from"./chunk.Q5IAXTF5.js";import"./chunk.SDO3U72B.js";import{I as se,O as de,U as D,Wa as Z,da as G,ga as le,ia as pe,ka as ce}from"./chunk.VOHRQXCF.js";import"./chunk.SLBWPVIY.js";import{b as Q}from"./chunk.AJZBJBMO.js";var f=Q(tt(),1);var nt=300,it=14,z=50,at=3,ot=2;function _e(e,n,o){let p=e.tryDefinition(n)?.fields?.shape;return(p?.[o]===void 0?void 0:ye(p[o]))?.type}var rt=(e,n)=>Object.keys(e.tryDefinition(n)?.fields?.shape??{}),st=e=>e==="date"||e==="datetime",Ge=/^(due|dueOn|dueAt|dueDate|deadline|by)$/i,dt=/^(date|on|day|when|at|start|starts|startsOn|startsAt|begins|from|sown|scheduled|scheduledFor|planned|plannedFor)$/i,lt=/^(done|finished|complete|completed|closed)$/i;function ae(e,n){let o=e.tryDefinition(n),p=rt(e,n),a=p.filter(u=>st(_e(e,n,u)));if(a.length===0)return;let i=o?.fieldRoles??{},s=u=>i[u]!==void 0&&a.includes(i[u])?i[u]:void 0,c=s("start")??s("when")??a.find(u=>Ge.test(u))??a.find(u=>dt.test(u));if(!c)return;let S=s("end")??a.find(u=>u!==c&&/^(end|ends|until|to|finish|finished|harvested|through)$/i.test(u)),g=p.find(u=>lt.test(u)&&_e(e,n,u)==="boolean");return{field:c,due:Ge.test(c),...S?{end:S}:{},...g?{done:g}:{}}}function ie(e,n){return Math.round((Date.parse(`${n.slice(0,10)}T00:00:00Z`)-Date.parse(`${e.slice(0,10)}T00:00:00Z`))/864e5)}var q=e=>typeof e=="string"&&/^\d{4}-\d{2}-\d{2}/.test(e)?e.slice(0,10):void 0;function je(e,n,o,p){let a=ne(e,n);if(a&&o.length>0&&o.length<=nt)return{shape:"board",field:a.field};let i=ae(e,n);if(i&&!i.due){let s=r=>{let y=q(r[i.field]),h=q(Z(r,i.field,p));return y&&h?ie(y,h):0},c=o.map(r=>({from:q(Z(r,i.field,p)),to:i.end&&q(r[i.end])?L(q(r[i.end]),s(r)):void 0})).filter(r=>r.from!==void 0).map(r=>({from:r.from,to:r.to&&r.to>r.from?r.to:r.from})),S=`${p.slice(0,7)}-01`,g=L(`${L(S,31).slice(0,7)}-01`,-1),u=c.filter(r=>r.from<=g&&r.to>=S),w=c.map(r=>ie(r.from,r.to)).sort((r,y)=>r-y),l=w[Math.floor(w.length/2)]??0;if(u.length>0&&l<=it){let r=L(p,-((new Date(`${p}T00:00:00Z`).getUTCDay()+6)%7)),y=L(r,6),h=u.every(m=>m.from>=r&&m.to<=y);return{shape:"calendar",start:i.field,...i.end?{end:i.end}:{},...i.done?{done:i.done}:{},range:h?"week":"month"}}}return{shape:"table"}}function ze(e,n){let o=ae(e,n);return o?{by:o.field,direction:o.due?"asc":"desc"}:void 0}function He(e,n,o={}){switch(n.shape){case"board":return{lens:"columns",kind:e,column:n.field};case"calendar":return{lens:"calendar",kind:e,start:n.start,...n.end?{end:n.end}:{},...n.done?{done:n.done}:{},range:n.range};case"table":return{lens:"blocks",kind:e,as:"row",...o.group?.by?{group:o.group.by}:{},...o.sort?{sort:{by:o.sort.by,...o.sort.direction==="desc"?{direction:"desc"}:{}}}:{}}}}var pt=60;function We(e,n,o,p){let a=e.tryDefinition(n),i=o.slice(0,pt),s=new Map;i.forEach(w=>{let l=G(a,w);te(w,a,{glance:!0,said:[l]}).forEach((r,y)=>{if(r.long||r.files||r.app)return;let h=s.get(r.key);h?h.count++:s.set(r.key,{label:r.label,count:1,at:y})})});let c=Math.max(1,Math.ceil(i.length/3)),S=[...s.entries()].filter(([,w])=>w.count>=c).sort((w,l)=>w[1].at-l[1].at).slice(0,at).map(([w,l])=>({about:"field",key:w,label:l.label})),g=new Map;for(let w of i){let l=new Set;for(let[r,y]of[["out",p.outEdges(w.id)],["in",p.inEdges(w.id)]])for(let h of y){let m=p.getNode(r==="out"?h.to:h.from);if(!m||m.id===w.id)continue;let b=`${h.kind}|${r}`;if(l.has(b))continue;l.add(b);let A=g.get(b);A?A.count++:g.set(b,{edge:h.kind,direction:r,far:m.kind,count:1})}}let u=[...g.entries()].sort((w,l)=>l[1].count-w[1].count).slice(0,ot).map(([w,l])=>{let r=me(e,l.direction==="out"?n:l.far,l.edge,l.direction);return{about:"edge",key:w,label:r.charAt(0).toUpperCase()+r.slice(1),edge:l.edge,direction:l.direction}});return[...S,...u]}function Ze(e,n,o,p){if(o.about==="field"){let s=e.tryDefinition(n.kind);return{text:te(n,s,{excerpt:!0}).find(S=>S.key===o.key)?.value??""}}let i=(o.direction==="out"?p.outEdges(n.id):p.inEdges(n.id)).filter(s=>s.kind===o.edge).map(s=>p.getNode(o.direction==="out"?s.to:s.from)).filter(s=>s!==void 0).map(s=>G(e.tryDefinition(s.kind),s));return i.length===0?{text:""}:i.length===1?{text:i[0]}:{text:`${i[0]} +${i.length-1}`,title:i.join(", ")}}function Ue(e,n,o=()=>{}){let p=new Map;for(let a of e){let i=a.nodeIds.filter(c=>n.has(c));if(i.length===0&&!(a.subjectId!==void 0&&n.has(a.subjectId)))continue;let s=p.get(a.invariant)??{invariant:a.invariant,label:o(a.invariant)||a.label||a.message,violations:[],records:new Set};s.violations.push(a);for(let c of i)s.records.add(c);a.subjectId!==void 0&&n.has(a.subjectId)&&s.records.add(a.subjectId),p.set(a.invariant,s)}return[...p.values()].sort((a,i)=>i.violations.length-a.violations.length).map(a=>({invariant:a.invariant,label:a.label,violations:a.violations,records:[...a.records]}))}var Ye=6;function Je(e,n,o,p){let a=ae(e,n);if(!a)return;let i=ne(e,n),s=g=>{if(a.done!==void 0&&g[a.done]===!0)return!0;if(!i)return!1;let u=i.values.indexOf(String(g[i.field]));return u>=0&&i.tiers[u]==="done"},c=0,S=0;for(let g of o){let u=q(Z(g,a.field,p));if(!u||s(g))continue;let w=ie(p,u);a.due&&w<0?c++:w>=0&&w<=Ye&&S++}if(!(c===0&&S===0))return{field:a.field,due:a.due,overdue:c,soon:S}}function L(e,n){return new Date(Date.parse(`${e.slice(0,10)}T00:00:00Z`)+n*864e5).toISOString().slice(0,10)}function oe(e,n,o){return n==="overdue"?[{key:e.field,value:`before:${o}`}]:[{key:e.field,value:`after:${L(o,-1)}`},{key:e.field,value:`before:${L(o,Ye+1)}`}]}function Qe(e,n,o,p){let a=new Set,i=new Set;for(let s of e)if(!(s.at<=o))for(let c of s.primitives)c.op==="add-node"&&c.node?.kind===n?a.add(c.node.id):(c.op==="patch-node"||c.op==="splice-text")&&c.id!==void 0&&p(c.id)===n&&i.add(c.id);for(let s of a)i.delete(s);return{added:[...a].filter(s=>p(s)===n).length,changed:[...i].filter(s=>p(s)===n).length}}var t=Q(we(),1),Xe="as",ct=(e,n)=>`graview:kind-seen:${e}:${n}`;function gt(e){try{return localStorage.getItem(e)}catch{return null}}function ut(e,n){try{localStorage.setItem(e,n)}catch{}}var ft=(e,n)=>({...ge(fe(e,!1),n),relation:null});function Jt({kind:e,members:n,flagged:o=[],label:p,retired:a=0}){let{store:i,brand:s,principal:c,views:S,view:g}=V(),{go:u}=Y(),w=X(),l=i.schema,r=l.tryDefinition(e),y=p??pe(l,e),h=i.today()??se(),m=n,b=(0,f.useId)(),A=(0,f.useMemo)(()=>je(l,e,m,h),[l,e,m,h]),x=g.within?.[Xe]==="table"?{shape:"table"}:A,k=Te(g),C=x.shape==="table"&&!k.sort?ze(l,e):void 0,v=C?{...k,sort:C}:k,R=(0,f.useMemo)(()=>new Set(o),[o]),T=(0,f.useMemo)(()=>$e(m,v,{schema:l,graph:i.graph,flagged:R,today:h}),[m,v,l,i,R,h,w]),I=(0,f.useMemo)(()=>De(l,Re(l,e)),[l,e]),M=S.arrangement?.()?.lists?.[e]?.filters,K=$=>u(Oe(g,$)),B=(0,f.useMemo)(()=>({name:s?.name??"app",schema:l,...i.policy?{policy:i.policy}:{}}),[s,l,i]),H=JSON.stringify(He(e,x,v)),P=(0,f.useMemo)(()=>{let $=Ae(JSON.parse(H),{app:B,sight:Ne(B,c)});return Se($)?void 0:$},[H,B,c]),W=x.shape!=="table"&&P!==void 0;return(0,t.jsxs)("section",{"aria-labelledby":b,className:"graview-kind-stop","data-testid":"kind-stop","data-graview-kind-stop":e,"data-graview-shape":x.shape,children:[(0,t.jsx)("style",{children:St}),(0,t.jsx)(wt,{kind:e,plural:y,count:m.length,headingId:b,description:r?.description}),(0,t.jsx)(ht,{kind:e,plural:y,members:m,today:h,arrangement:v,onArrange:K}),(m.length>1||a>0)&&!W?(0,t.jsx)(Pe,{schema:l,graph:i.graph,kind:e,arrangement:v,onChange:K,offers:I,...M?{filters:M}:{},kept:{shown:T.nodes.length,of:m.length},testId:"kind-arrange",chips:{nodes:m,flagged:R,today:h},...a>0?{past:{count:a,widen:()=>u(Ee(g,!0))}}:{}}):null,m.length>0?(0,t.jsx)(yt,{derived:A,shape:x,draft:P}):null,(0,t.jsx)("div",{className:"graview-kind-stop-body","data-testid":"kind-stop-body",children:m.length===0?(0,t.jsx)("p",{className:"graview-kind-stop-empty","data-testid":"kind-stop-empty",children:"Nothing here yet."}):W?(0,t.jsx)(kt,{draft:P,nodes:m}):T.nodes.length===0?(0,t.jsxs)("p",{className:"graview-kind-stop-empty","data-testid":"kind-stop-none-kept",children:["None of the ",D(m.length)," ",y.toLowerCase()," ",v.query?`says \u201C${v.query}\u201D`:"is kept by these filters","."," ",(0,t.jsx)("button",{type:"button",className:"graview-kind-stop-link",onClick:()=>K({}),children:"Show them all"})]}):(0,t.jsx)(xt,{kind:e,nodes:T.nodes,groups:T.grouped?T.groups.map($=>({key:$.key,label:$.label,nodes:$.nodes})):void 0,flagged:R,plural:y,arrangement:v})})]})}function wt({kind:e,plural:n,count:o,headingId:p,description:a}){let{store:i,setSelection:s,setMenuAt:c}=V(),S=(0,f.useMemo)(()=>({about:[U(e)]}),[e]),{affordances:g}=Me(S),{apply:u,preview:w}=Le(),l=(0,f.useMemo)(()=>{let x=k=>i.allMutations().find(C=>C.name===k.mutation)?.creates?.includes(e)??!1;return g.find(k=>!k.destructive&&!k.setsAside&&x(k))},[g,i,e]),[r,y]=(0,f.useState)(!1),[h,m]=(0,f.useState)(null),b=(0,f.useRef)(null),A=(0,f.useRef)(null);(0,f.useEffect)(()=>{let x=A.current;!x||x.closest('[data-testid="kind-stop"]')?.contains(document.activeElement)||x.focus({preventScroll:!0})},[e]);let O=(x,k)=>{try{w(x,k),u(x,k),m(null),y(!1),requestAnimationFrame(()=>b.current?.focus())}catch(C){return m(be(i.schema,i.allMutations(),C)),[]}};return(0,t.jsxs)("header",{className:"graview-kind-stop-head",children:[(0,t.jsxs)("div",{className:"graview-kind-stop-title",children:[(0,t.jsx)("h2",{id:p,ref:A,tabIndex:-1,"data-testid":"kind-stop-title",children:n}),(0,t.jsxs)("p",{"data-testid":"kind-stop-count",children:[le(i.schema,e,o),a?` \xB7 ${a}`:""]})]}),(0,t.jsxs)("div",{className:"graview-kind-stop-acts",children:[l?(0,t.jsx)("button",{ref:b,type:"button",className:"graview-kind-stop-primary","data-testid":"kind-stop-primary","data-affordance":l.id,"aria-expanded":l.open.length>0?r:void 0,onClick:()=>{m(null),l.open.length===0?O(l):y(x=>!x)},children:l.label}):null,(0,t.jsx)("button",{type:"button",className:"graview-kind-stop-quiet","data-testid":"kind-stop-acts","aria-haspopup":"menu","aria-label":`What can be done with the ${n.toLowerCase()}`,onClick:x=>{let k=x.currentTarget.getBoundingClientRect();s([U(e)]),c({x:Math.round(k.left),y:Math.round(k.bottom+4),on:U(e)})},children:"Acts\u2026"})]}),r&&l?(0,t.jsx)("div",{className:"graview-kind-stop-ask","data-testid":"kind-stop-ask","aria-label":l.label,role:"group",children:(0,t.jsx)(xe,{affordance:l,onApply:x=>O(l,x),onCancel:()=>{y(!1),b.current?.focus()}})}):null,h?(0,t.jsx)("p",{role:"alert",className:"graview-kind-stop-failed","data-testid":"kind-stop-failed",children:h}):null]})}var vt=J.part((e,n)=>(0,t.jsx)(e.ProblemRows,{...n}),{what:"The problems",as:"li"});function ht({kind:e,plural:n,members:o,today:p,arrangement:a,onArrange:i}){let{store:s,brand:c,setSelection:S}=V(),g=s.schema,u=ee(),w=(0,f.useMemo)(()=>new Set(o.map(v=>v.id)),[o]),l=(0,f.useMemo)(()=>Ue(u,w,v=>s.allInvariants().find(R=>R.name===v)?.label),[u,w,s]),r=(0,f.useMemo)(()=>Je(g,e,o,p),[g,e,o,p]),y=ct(Ce(c,g),e),[h]=(0,f.useState)(()=>gt(y));(0,f.useEffect)(()=>()=>ut(y,new Date().toISOString()),[y]);let m=X(),b=(0,f.useMemo)(()=>h?Qe(s.log.all(),e,h,v=>s.graph.getNode(v)?.kind):null,[h,s,e,m]),[A,O]=(0,f.useState)(null),x=v=>i({...a,filter:[...(a.filter??[]).filter(R=>!v?.some(T=>T.key===R.key)),...v??[]]}),k=l.reduce((v,R)=>v+R.violations.length,0),C=[];if(r&&(r.overdue>0||r.soon>0)){let v=r.field;C.push((0,t.jsxs)("li",{"data-testid":"kind-stop-dates",children:[r.overdue>0?(0,t.jsxs)("button",{type:"button",className:"graview-kind-stop-fact","data-tone":"warn",onClick:()=>x(oe(r,"overdue",p)),"aria-label":`${D(r.overdue)} overdue \u2014 show only these`,children:[D(r.overdue)," overdue"]}):null,r.soon>0?(0,t.jsxs)("button",{type:"button",className:"graview-kind-stop-fact",onClick:()=>x(oe(r,"soon",p)),"aria-label":`${D(r.soon)} in the next 7 days \u2014 show only these`,children:[D(r.soon)," ",r.due?"due":""," in the next 7 days"]}):null,(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:[" by ",ce(g.tryDefinition(e),v).toLowerCase()]})]},"dates"))}if(l.length>0&&C.push((0,t.jsxs)("li",{"data-testid":"kind-stop-problems","data-graview-problems":k,children:[(0,t.jsxs)("span",{className:"graview-kind-stop-warn",children:[(0,t.jsx)("span",{"aria-hidden":"true",children:"\u26A0 "}),k===1?"1 problem":`${D(k)} problems`]}),(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:[" in ",n.toLowerCase(),":"]}),(0,t.jsx)("ul",{className:"graview-kind-stop-rules",children:l.map(v=>(0,t.jsx)(mt,{group:v,open:A===v.invariant,onToggle:()=>O(R=>R===v.invariant?null:v.invariant),onPick:R=>S([R])},v.invariant))}),(0,t.jsxs)("button",{type:"button",className:"graview-kind-stop-link","data-testid":"kind-stop-only-problems",onClick:()=>x([{key:"is",value:"flagged"}]),children:["Show only the ",n.toLowerCase()," with a problem"]})]},"problems")),b&&(b.added>0||b.changed>0)){let v=[b.added>0?`${D(b.added)} added`:"",b.changed>0?`${D(b.changed)} changed`:""].filter(Boolean);C.push((0,t.jsxs)("li",{"data-testid":"kind-stop-since",children:[(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:["Since you last looked (",de(h.slice(0,10)),"):"]})," ",v.join(", ")]},"since"))}return C.length===0?null:(0,t.jsx)("ul",{className:"graview-kind-stop-going-on","aria-label":`What is going on in the ${n.toLowerCase()}`,"data-testid":"kind-stop-going-on",children:C})}function mt({group:e,open:n,onToggle:o,onPick:p}){let a=(0,f.useId)();return(0,t.jsxs)("li",{"data-graview-rule":e.invariant,children:[(0,t.jsxs)("button",{type:"button",className:"graview-kind-stop-rule","aria-expanded":n,"aria-controls":a,onClick:o,onPointerEnter:J.prefetch,onFocus:J.prefetch,children:[(0,t.jsx)("span",{"aria-hidden":"true",className:"graview-kind-stop-chevron","data-open":n||void 0,children:"\u203A"}),e.label," ",(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:["\xB7 ",D(e.violations.length)]})]}),n?(0,t.jsx)("ol",{id:a,className:"graview-kind-stop-problem-rows","data-testid":"kind-stop-problem-rows",children:(0,t.jsx)(f.Suspense,{fallback:null,children:(0,t.jsx)(vt,{violations:e.violations,pick:i=>{let s=i.subjectId??e.records[0]??i.nodeIds[0];s!==void 0&&p(s)}})})}):null]})}var bt={board:"Board",calendar:"Calendar",table:"Table"};function yt({derived:e,shape:n,draft:o}){let{view:p}=V(),{go:a}=Y(),{keep:i}=qe(Be()),[s,c]=(0,f.useState)(!1),S=e.shape==="table"?[]:[e.shape,"table"];return(0,t.jsxs)("div",{className:"graview-kind-stop-shape","data-testid":"kind-stop-shape",children:[S.length>0?(0,t.jsx)("span",{role:"group","aria-label":"Show as",className:"graview-kind-stop-switch",children:S.map(g=>(0,t.jsx)("button",{type:"button","aria-pressed":n.shape===g,"data-testid":`kind-stop-as-${g}`,onClick:()=>a(ue(p,Xe,g===e.shape?null:g)),children:bt[g]},g))}):null,(0,t.jsx)("span",{className:"graview-kind-stop-quiet-text","data-testid":"kind-stop-derived",children:o?`${o.said.replace(/\.$/,"")}, derived from the declaration`:"Derived from the declaration"}),o?(0,t.jsx)("button",{type:"button",className:"graview-kind-stop-link","data-testid":"kind-stop-keep",disabled:s,title:`Keep \u201C${o.title}\u201D as a lens: a place of its own`,onClick:()=>{c(!0),i(o).finally(()=>c(!1))},children:"Keep as a lens"}):null]})}function kt({draft:e,nodes:n}){let o=Ve(e.drawn);return(0,t.jsx)("div",{className:"graview-kind-stop-lens","data-graview-draft":e.lens.name,children:(0,t.jsx)(ve,{mode:"scene",children:(0,t.jsx)(ke,{kind:e.kind,view:e.title,children:(0,t.jsx)(o,{nodes:n,label:e.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1})})})})}function xt({kind:e,nodes:n,groups:o,flagged:p,plural:a,arrangement:i}){let{store:s,views:c,view:S,selection:g,setSelection:u,setMenuAt:w,principal:l}=V(),{go:r}=Y(),y=s.schema,h=s.graph,m=(0,f.useMemo)(()=>(o?o.flatMap(d=>d.nodes):n).map(d=>d.id),[n,o]),b=Ie(m),A=(0,f.useMemo)(()=>s.permittedMutations(l).some(d=>{let N=d.subject?.kinds;return N!==void 0&&(N==="*"||N.includes(e))}),[s,l,e]),O=(0,f.useRef)(null),x=d=>{b.choose(d),requestAnimationFrame(()=>{let N=b.list.current;((d[0]===void 0?null:N?.querySelector(`[data-graview-choose-box="${CSS.escape(d[0])}"]`))??N)?.focus({preventScroll:!0})})},k=b.chosen.length,C=c.lookup(e,{cardinality:"one",fidelity:"glyph"}),v=C!==void 0&&!he(C)?C:void 0,R=d=>g.includes(d),T=ee(),I=(0,f.useMemo)(()=>We(y,e,n,h),[y,e,n,h]),[M,K]=(0,f.useState)(z);(0,f.useEffect)(()=>K(z),[i.query,i.filter?.length,i.sort?.by,i.group?.by]);let B=y.tryDefinition(e),H=d=>T.filter(N=>N.nodeIds.includes(d)||N.subjectId===d).map(N=>N.message),P=i.sort?.by,W=`${a}${i.sort?`, in order of ${I.find(d=>d.key===P)?.label.toLowerCase()??P}`:""}`,$=M,et=d=>{let N=G(B,d),F=p.has(d.id)?H(d.id):[];return(0,t.jsxs)("tr",{"data-graview-pick":d.id,tabIndex:-1,"data-graview-record":d.id,"data-flagged":F.length>0||void 0,...A?{"data-graview-choose":d.id}:{},children:[A?(0,t.jsx)("td",{className:"graview-choose-at",children:(0,t.jsx)("input",{...b.boxProps(d.id,N),onPointerEnter:j,onFocus:j})}):null,(0,t.jsxs)("th",{scope:"row",className:"graview-kind-stop-name",children:[v?(0,t.jsx)("div",{"data-graview-pick":d.id,className:"graview-kind-stop-own-row",children:(0,t.jsx)(v,{node:d,cardinality:"one",fidelity:"glyph",mode:"scene",selected:R(d.id),...F.length>0?{flagged:[d.id]}:{}})}):(0,t.jsx)("button",{type:"button","data-testid":"kind-stop-row-go",title:`Go to ${N}`,onClick:()=>r(ft(S,d.id)),children:N}),F.length>0?(0,t.jsxs)("span",{className:"graview-kind-stop-flag",title:F.join(" \xB7 "),children:[(0,t.jsx)("span",{"aria-hidden":"true",children:"\u26A0"}),(0,t.jsx)("span",{className:"graview-kind-stop-hidden",children:`Problem: ${F.join(". ")}`})]}):null]}),I.map(_=>{let E=Ze(y,d,_,h);return(0,t.jsx)("td",{"data-label":_.label,"data-short":E.text.length>0&&E.text.length<=14||void 0,"data-empty":E.text?void 0:"",...E.title?{title:E.title}:{},children:E.text?(0,t.jsx)("span",{children:E.text}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("b",{"aria-hidden":"true",children:"\u2014"}),(0,t.jsx)("i",{className:"graview-kind-stop-hidden",children:"none"})]})},_.key)}),(0,t.jsx)("td",{className:"graview-kind-stop-row-acts",children:(0,t.jsx)("button",{type:"button","data-testid":"kind-stop-row-acts","aria-haspopup":"menu","aria-label":`What can be done with ${N}`,onClick:_=>{let E=_.currentTarget.getBoundingClientRect();u([d.id]),w({x:Math.round(E.left),y:Math.round(E.bottom+4),on:d.id})},children:(0,t.jsx)("span",{"aria-hidden":"true",children:"\u22EF"})})})]},d.id)},re=d=>{let N=d.slice(0,Math.max(0,$));return $-=N.length,N.map(et)};return(0,t.jsxs)("div",{className:"graview-kind-stop-table-at",...A?{...b.listProps,ref:d=>{O.current=d,b.list.current=d},tabIndex:-1,role:"group","aria-label":k>0?`${a}, ${k} chosen`:a,"data-graview-choosable":""}:{},children:[A?(0,t.jsx)("style",{children:Ke}):null,(0,t.jsxs)("table",{className:"graview-kind-stop-table","data-testid":"kind-stop-table",children:[(0,t.jsx)("caption",{className:"graview-kind-stop-hidden",children:W}),(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[A?(0,t.jsx)("td",{className:"graview-choose-at graview-choose-all",children:(0,t.jsx)("input",{type:"checkbox",className:"graview-choose-box","data-testid":"kind-stop-choose-all","aria-label":`Choose all ${D(n.length)} ${a.toLowerCase()}`,checked:k>0&&k===n.length,ref:d=>{d&&(d.indeterminate=k>0&&k<n.length)},onPointerEnter:j,onFocus:j,onChange:()=>k===n.length?b.clear():b.choose(m)})}):null,(0,t.jsx)("th",{scope:"col","aria-sort":P==="label"?i.sort?.direction==="desc"?"descending":"ascending":void 0,children:"Name"}),I.map(d=>(0,t.jsx)("th",{scope:"col","aria-sort":d.about==="field"&&d.key===P?i.sort?.direction==="desc"?"descending":"ascending":void 0,children:d.label},d.key)),(0,t.jsx)("th",{scope:"col",children:(0,t.jsx)("span",{className:"graview-kind-stop-hidden",children:"Acts"})})]})}),o?o.map(d=>$<=0?null:(0,t.jsxs)("tbody",{"data-graview-group":d.key,children:[(0,t.jsx)("tr",{className:"graview-kind-stop-group",children:(0,t.jsxs)("th",{scope:"rowgroup",colSpan:I.length+(A?3:2),children:[d.label," ",(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:["\xB7 ",D(d.nodes.length)]})]})}),re(d.nodes)]},d.key||"-")):(0,t.jsx)("tbody",{children:re(n)})]}),A?(0,t.jsx)(Fe,{store:s,chosen:b.chosen,principal:l,anchor:()=>O.current?.closest('[data-testid="kind-stop"]')??null,of:m.length,onChooseAll:()=>b.choose(m),onClear:b.clear,onActed:x}):null,n.length>M?(0,t.jsxs)("p",{className:"graview-kind-stop-more",children:[(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text","data-testid":"kind-stop-shown",children:[D(M)," of ",D(n.length)," shown"]})," ",(0,t.jsxs)("button",{type:"button",className:"graview-kind-stop-link","data-testid":"kind-stop-more",onClick:()=>K(d=>d+z),children:["Show ",D(Math.min(z,n.length-M))," more"]})]}):null]})}var St=`
2
+ .graview-kind-stop{container-type:inline-size;box-sizing:border-box;height:100%;min-height:0;display:flex;flex-direction:column;gap:10px;padding:16px 18px 12px;border:1px solid var(--graview-edge);border-radius:var(--graview-radius,12px);background:var(--graview-panel);color:var(--graview-ink);box-shadow:var(--graview-lift-low);overflow:auto;overscroll-behavior:contain}
3
+ [data-graview-map-panel] .graview-kind-stop{height:auto;padding:4px 6px 12px;border:0;box-shadow:none;background:none;overflow:visible}
4
+ .graview-kind-stop :focus-visible{outline:2px solid var(--graview-accent);outline-offset:2px}
5
+ .graview-kind-stop button{font:inherit;cursor:pointer}
6
+ .graview-kind-stop :is(.graview-kind-stop-link,.graview-kind-stop-rule,.graview-kind-stop-name button,.graview-kind-stop-row-acts button,.graview-kind-stop-fact,.graview-kind-stop-switch button){box-shadow:none}
7
+ .graview-kind-stop-head{display:flex;flex-wrap:wrap;align-items:flex-start;gap:8px 16px}
8
+ .graview-kind-stop-title{flex:1 1 16rem;min-width:0}
9
+ .graview-kind-stop-title h2{margin:0;outline-offset:2px;font-size:var(--graview-text-heading);line-height:1.3;overflow-wrap:anywhere}
10
+ .graview-kind-stop-title p{margin:2px 0 0;font-size:.875rem;color:var(--graview-ink-muted);overflow-wrap:anywhere}
11
+ .graview-kind-stop-acts{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
12
+ .graview-kind-stop-primary,.graview-kind-stop-quiet{min-height:32px;padding:0 14px;border-radius:8px;font-size:.875rem}
13
+ .graview-kind-stop-primary{border:1px solid var(--graview-accent);background:var(--graview-accent);color:var(--graview-accent-ink);font-weight:600}
14
+ .graview-kind-stop-quiet{border:1px solid var(--graview-edge);background:transparent;color:var(--graview-ink)}
15
+ .graview-kind-stop-ask{flex:1 1 100%;min-width:0;padding:10px 12px;border:1px solid var(--graview-edge);border-radius:10px}
16
+ .graview-kind-stop-failed{flex:1 1 100%;margin:0;font-size:var(--graview-text-small);color:var(--graview-warn)}
17
+ .graview-kind-stop-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
18
+ .graview-kind-stop-going-on{list-style:none;margin:0;padding:0;display:grid;gap:6px;font-size:.875rem}
19
+ .graview-kind-stop-going-on>li{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;min-width:0}
20
+ .graview-kind-stop-fact{min-height:28px;padding:0 10px;border:1px solid var(--graview-edge);border-radius:999px;background:transparent;color:var(--graview-ink)}
21
+ .graview-kind-stop-fact[data-tone=warn],.graview-kind-stop-warn{color:var(--graview-warn);font-weight:600}
22
+ .graview-kind-stop-quiet-text{color:var(--graview-ink-muted)}
23
+ .graview-kind-stop-rules{list-style:none;margin:0;padding:0;flex:1 1 100%;display:grid;gap:2px}
24
+ .graview-kind-stop-rule{display:inline-flex;align-items:center;gap:6px;min-height:28px;max-width:100%;padding:0 6px;border:1px solid transparent;border-radius:7px;background:none;color:var(--graview-ink);text-align:left;overflow-wrap:anywhere}
25
+ .graview-kind-stop-rule:hover{border-color:var(--graview-edge)}
26
+ .graview-kind-stop-chevron{display:inline-block;width:.8em}
27
+ .graview-kind-stop-chevron[data-open]{transform:rotate(90deg)}
28
+ .graview-kind-stop-problem-rows{list-style:none;margin:2px 0 6px 18px;padding:0;max-width:44rem}
29
+ .graview-kind-stop-link{min-height:28px;padding:0 4px;border:0;background:none;color:var(--graview-accent);text-decoration:underline;text-underline-offset:2px}
30
+ .graview-kind-stop-link:disabled{opacity:.6;cursor:default}
31
+ .graview-kind-stop-shape{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px;font-size:var(--graview-text-small)}
32
+ .graview-kind-stop-switch{display:inline-flex;border:1px solid var(--graview-edge);border-radius:8px;overflow:hidden}
33
+ .graview-kind-stop-switch button{min-height:28px;padding:0 12px;border:0;background:transparent;color:var(--graview-ink-muted)}
34
+ .graview-kind-stop-switch button+button{border-left:1px solid var(--graview-edge)}
35
+ .graview-kind-stop-switch button[aria-pressed=true]{background:color-mix(in srgb,var(--graview-accent) 16%,transparent);color:var(--graview-ink);font-weight:600}
36
+ .graview-kind-stop-body{flex:1 0 auto;min-width:0}
37
+ .graview-kind-stop-empty{margin:24px 0;color:var(--graview-ink-muted)}
38
+ .graview-kind-stop-lens{min-width:0}
39
+
40
+ .graview-kind-stop-table-at{min-width:0}
41
+ .graview-kind-stop-table{width:100%;border-collapse:collapse;font-size:.875rem}
42
+ .graview-kind-stop-table th,.graview-kind-stop-table td{padding:7px 8px;text-align:left;vertical-align:top;border-top:1px solid var(--graview-edge);overflow-wrap:break-word}
43
+ .graview-kind-stop-table td{color:var(--graview-ink)}
44
+ .graview-kind-stop-table td>span{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
45
+ .graview-kind-stop-table td[data-short]{white-space:nowrap;font-variant-numeric:tabular-nums}
46
+ .graview-kind-stop-table thead th{border-top:0;font-size:var(--graview-text-small);font-weight:600;letter-spacing:.04em;color:var(--graview-ink-muted)}
47
+ .graview-kind-stop-name{font-weight:500;min-width:8rem;max-width:22rem}
48
+ .graview-kind-stop-name button{display:inline-block;min-width:24px;min-height:24px;padding:0;border:0;background:none;color:var(--graview-ink);font-weight:500;text-align:left;text-decoration:underline;text-decoration-color:var(--graview-edge);text-underline-offset:3px}
49
+ .graview-kind-stop-name button:hover{text-decoration-color:currentColor}
50
+ .graview-kind-stop-own-row{display:inline-block;max-width:100%;cursor:pointer}
51
+ .graview-kind-stop-flag{margin-left:6px;color:var(--graview-warn)}
52
+ .graview-kind-stop-group th{padding-top:12px;font-weight:600;color:var(--graview-ink)}
53
+ .graview-kind-stop-row-acts{width:1%;white-space:nowrap;text-align:right}
54
+ .graview-kind-stop-row-acts button{min-width:32px;min-height:28px;border:1px solid var(--graview-edge-bright,var(--graview-edge));border-radius:7px;background:none;color:var(--graview-ink);font-size:1.125rem;font-weight:700;line-height:1}
55
+ .graview-kind-stop-row-acts button:hover{background:color-mix(in srgb,var(--graview-ink) 8%,transparent)}
56
+ .graview-kind-stop-table td[data-empty] b{font-weight:400;color:var(--graview-ink-faint)}
57
+ .graview-kind-stop-table tr[data-graview-pick]{cursor:default}
58
+ .graview-kind-stop-more{margin:10px 0 0;font-size:.875rem}
59
+ .graview-kind-stop-table-at[data-graview-choosable]{outline:none}
60
+ [data-graview-choosable]:hover .graview-choose-all .graview-choose-box{opacity:1}
61
+ .graview-kind-stop-table .graview-choose-at{width:1%;padding-right:0;vertical-align:middle}
62
+ @container (max-width: 559px){
63
+ .graview-kind-stop{padding:12px}
64
+ .graview-kind-stop-acts{flex:1 1 100%}
65
+ .graview-kind-stop-primary{flex:1 1 auto}
66
+ .graview-kind-stop-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
67
+ .graview-kind-stop-table,.graview-kind-stop-table tbody,.graview-kind-stop-table tr{display:block}
68
+ .graview-kind-stop-table tr{position:relative;padding:8px 40px 8px 0;border-top:1px solid var(--graview-edge)}
69
+ .graview-kind-stop-table th,.graview-kind-stop-table td{display:block;padding:1px 0;border:0}
70
+ .graview-kind-stop-table td>span{display:inline}
71
+ .graview-kind-stop-table td[data-short]{white-space:normal}
72
+ .graview-kind-stop-table td[data-label]::before{content:attr(data-label) " \xB7 ";color:var(--graview-ink-muted)}
73
+ .graview-kind-stop-row-acts{position:absolute;top:6px;right:0;width:auto}
74
+ .graview-kind-stop-table [data-graview-choose]{padding-left:34px}
75
+ .graview-kind-stop-table td.graview-choose-at{position:absolute;left:0;top:8px;width:auto;padding:0}
76
+ .graview-kind-stop-table thead .graview-choose-at{position:static}
77
+ }
78
+ @media (pointer: coarse){
79
+ .graview-kind-stop-table-at:not([data-graview-choosing]) .graview-choose-at{display:none}
80
+ .graview-kind-stop-table-at:not([data-graview-choosing]) [data-graview-choose]{padding-left:0}
81
+ }
82
+ @media (pointer: coarse){
83
+ .graview-kind-stop-primary,.graview-kind-stop-quiet,.graview-kind-stop-fact,.graview-kind-stop-rule,.graview-kind-stop-link,.graview-kind-stop-switch button,.graview-kind-stop-row-acts button{min-height:44px}
84
+ .graview-kind-stop-row-acts button{min-width:44px}
85
+ .graview-kind-stop-name button{min-height:44px}
86
+ }
87
+ @media (prefers-reduced-motion: reduce){.graview-kind-stop *{transition:none!important;animation:none!important}}
88
+ `;export{Jt as KindStop};
@@ -0,0 +1 @@
1
+ import{b as f}from"./chunk.3ZQAPPJ5.js";import"./chunk.D62V3TBW.js";import"./chunk.FJC6PMOG.js";import"./chunk.XPR3QFF4.js";import"./chunk.YUEOUV7G.js";import"./chunk.UGFDSE37.js";import{l as g}from"./chunk.W5UJLKIT.js";import"./chunk.PXQVXBNG.js";import"./chunk.7UJZP3YK.js";import"./chunk.R77TACXU.js";import"./chunk.6JERQFZI.js";import"./chunk.7XJ3XQZD.js";import"./chunk.52J42KR5.js";import"./chunk.T2Q3AAQI.js";import"./chunk.63SRVTG2.js";import"./chunk.C4EPMV7O.js";import"./chunk.G7XKQNOL.js";import"./chunk.7KZ44FEU.js";import"./chunk.LSL25VXW.js";import"./chunk.WWUMSCYC.js";import"./chunk.J2R55TM7.js";import"./chunk.KPUX27ZT.js";import"./chunk.DIS7JS7X.js";import"./chunk.D2T563AA.js";import"./chunk.JV7FLVUV.js";import"./chunk.GL3YVGAP.js";import"./chunk.7FZY5E2U.js";import"./chunk.7354O67H.js";import"./chunk.XOZU4OFA.js";import"./chunk.C7EEYSAM.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.QRCTTDDQ.js";import"./chunk.3TME4BG3.js";import"./chunk.I43ONAEL.js";import"./chunk.73EKJ4JN.js";import"./chunk.INL4OZI7.js";import"./chunk.5WU2UTP7.js";import"./chunk.GZHZLJBF.js";import"./chunk.YKACMLLU.js";import"./chunk.OJGHDWI6.js";import"./chunk.337JMOTL.js";import"./chunk.CV4QA4ZF.js";import"./chunk.OYRZ2DEI.js";import"./chunk.7EA7THSM.js";import"./chunk.AI2HBKVP.js";import{G as b,T as h}from"./chunk.Q5IAXTF5.js";import"./chunk.SDO3U72B.js";import{Ld as n}from"./chunk.VOHRQXCF.js";import"./chunk.SLBWPVIY.js";import{b as t}from"./chunk.AJZBJBMO.js";var m=t(b(),1),a=t(h(),1);function P({store:c,auto:y,brand:i,views:u,presence:s,steering:r,overview:o,scope:d,titleLevel:w=2,quickAsk:l,props:e}){let v=(0,m.useMemo)(()=>g({scope:`.${d}`}),[d]);return(0,a.jsxs)("div",{"data-embed-content":"",style:y?{flex:"0 0 auto",background:"var(--graview-ground)"}:{flex:"1 1 auto",minHeight:0,overflow:"auto",background:"var(--graview-ground)"},children:[(0,a.jsx)("style",{children:v}),(0,a.jsx)("div",{"data-embed-measure":"",style:{display:"flow-root"},children:(0,a.jsx)(f,{context:{store:c,embedded:!0,...e.bar!==!1?{barAbove:!0}:{},...o?{overview:o}:{},titleLevel:w,views:u,settings:e.app.settings??[],...s?{presence:s}:{},...i?{brand:i}:{},...e.locale?{locale:e.locale}:{},...e.timeZone?{timeZone:e.timeZone}:{},...e.principal?{principal:e.principal}:{},...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{},...e.subscriptions?{subscriptions:e.subscriptions}:{},dismissals:e.dismissals,whileAway:e.whileAway,...e.signIn?{signIn:e.signIn}:{},...l!==void 0?{quickAsk:l}:{}},...e.pages?{registry:e.pages}:{},...r?{steering:r}:{},...e.routing==="address"?n(e.basePath)===""?{}:{basename:n(e.basePath)}:{initialPath:e.path??"/"},...e.path!==void 0?{path:e.path}:{},...e.hrefOf?{hrefOf:e.hrefOf}:e.routing==="address"?{}:{hrefOf:!1},...e.onNavigate?{onNavigate:e.onNavigate}:{}})})]})}export{P as PagesContent};
@@ -1 +1 @@
1
- import{a as N}from"./chunk.TI4OSTQV.js";import{h as E}from"./chunk.EJUZGIQ5.js";var S=globalThis[Symbol.for("@graview/core:publishing")]??={},T=()=>S.kit,P="publish",x=e=>e?.mode==="on-publish",Q=Symbol.for("@graview/core:seat"),G=(e,n)=>{let s=Reflect.get(e,n,e);return typeof s=="function"?s.bind(e):s},X,Y=()=>X??={name:P,title:"Publish",description:"Publish what collaborators have changed, so readers see it.",input:S.input(),apply(){}};var I=new WeakMap;function z(e){let n=e.all(),s=n.at(-1)?.id,o=I.get(e);if(o&&o.length===n.length&&o.last===s)return o.seq;let a,r;for(let t=n.length-1;t>=0;t--){let i=n[t];if(!(i.publishedThrough===void 0||(r??=e.undoneIds()).has(i.id))){a=i.publishedThrough;break}}return I.set(e,{length:n.length,last:s,seq:a}),a}function ee(e,n){if(!x(e))return{mutation:P,message:"this app is live: every edit reaches its readers as it is made, so there is nothing to publish.",wouldNeed:[]};let s=e.publishers??e.working;if(T().reads({mode:"on-publish",working:s},n))return{mutation:P,message:`only ${s.join(", ")||"nobody"} may publish.`,wouldNeed:[...s]}}var ne=(e,n,s,o,a,r)=>{let{log:t}=e,i=t.length,d=s.args.through;if(d!==void 0&&(!Number.isInteger(d)||d<t.horizon||d>i))throw new RangeError(`Cannot publish through seq ${String(d)}: this store holds seqs ${t.horizon} to ${i}.`);let f=d??i+1,p=z(t)??t.horizon,c=t.batches().filter(b=>!b.undone&&b.ops.some(m=>m.seq>=p&&m.seq<f&&m.publishedThrough===void 0)).length,g={id:n.id,seq:i,batch:o,author:a,intent:f<p?"Take back what was published":`Publish ${c===1?"1 change":`${c} changes`}`,...r.intent!==void 0?{batchIntent:r.intent}:{},mutation:s,primitives:[],reads:[],writes:[],at:n.at,...r.via!==void 0?{via:r.via}:{},publishedThrough:f};return t.append(g),g},te=new Set(["graph","log","snapshot","batches","violations","findings","canUndo","servedSeq","checkpoint"]);function se(e,n){let{seatView:s,viewsOf:o,viewKey:a,diff:r}=T(),t=o(e),i=a(n,"published"),d=t.get(i);if(d)return d;let f=s(e,n),p,c=()=>{let h=Math.max(e.publishedSeq??e.log.horizon,e.log.horizon);if(h>=e.log.length)return f;let u=e.log.all()[h-1-e.log.horizon]?.id;return(p?.seq!==h||p.id!==u)&&(p={seq:h,id:u,view:s(O(e,h),n)}),p.view},g=h=>h.servedSeq,b=h=>{let u=g(c()),v=c().graph.snapshot();return e.subscribe(()=>{let y=c(),k=g(y);if(k===u)return;let q=y.graph.snapshot(),M=k>u?y.log.all().filter(w=>w.seq>=u):[],l=r(v,q);[u,v]=[k,q],h(l,M)})},m=new Proxy(f,{get(h,u){switch(u){case Q:return{store:e,principal:n};case"subscribe":return b;case"seenBy":return(v,y)=>e.seenBy(v,y);case"seenFor":return n;default:return te.has(u)?G(c(),u):G(h,u)}}});return t.set(i,m),m}S.served=se;S.act=(e,n)=>x(e.publishing)&&!e.past&&!n.has(P)?Y():void 0;S.verdict=(e,n)=>{let s=ee(e.publishing,n);return s?{ok:!1,refusal:s}:{ok:!0}};S.seq=e=>x(e.publishing)?z(e.log):void 0;S.op=ne;function K(e,n){let s;for(let o of[...e??[]].sort((a,r)=>a.seq-r.seq)){if(o.seq>n)break;o.declaration&&(s=o.declaration)}return s}var R=new WeakMap;function oe(e,n){let s=K(e?.declarations,n),o=e?.declarationAt,a=[...e?.declarations??[]].filter(i=>i.seq<=n).sort((i,d)=>i.seq-d.seq).at(-1);if(!o||!a||a.declaration)return{declaration:s};let r=R.get(o);r||R.set(o,r=new Map);let t=r.get(a.seq);if(!t){let i={settled:!0,declaration:void 0,waiting:Promise.resolve()};try{let d=o(a.seq);d instanceof Promise?(i.settled=!1,i.waiting=d.then(f=>void Object.assign(i,{settled:!0,declaration:f}),()=>void(i.settled=!0))):i.declaration=d}catch{}r.set(a.seq,t=i)}return t.settled?{declaration:t.declaration??s}:{waiting:t.waiting}}var V=e=>e,$=new WeakMap,B=new WeakMap;function j(e,n){let s=typeof n=="string"?Date.parse(n):n.getTime();if(Number.isNaN(s))throw new RangeError(`\u201C${String(n)}\u201D is not a time`);let a=e.log.all().findIndex(r=>Date.parse(r.at)>s);return a===-1?e.log.length:e.log.horizon+a}function O(e,n,s={}){let o=N(e);if(o){let l=typeof n=="number"?n:j(e,n);if(l>e.servedSeq)throw new RangeError(`No moment at seq ${l}: this seat is served through seq ${e.servedSeq}`);return O(o.store,l,s).seenBy(o.principal)}let a=e.log,r=a.horizon,t=typeof n=="number"?n:j(e,n);if(!Number.isInteger(t)||t<r||t>a.length)throw new RangeError(`No moment at seq ${t}: this store holds seqs ${r} to ${a.length}${r>0?"; what is before its horizon is in the archive":""}`);let i=a.all(),d=s.declaration,f=d?.schema??e.schema,p=a.epochs().filter(l=>l.seq<=t),c=p.at(-1),g=c?.seq??r,b=l=>l>r?i[l-1-r]?.id:void 0,m=($.get(e)??[]).filter(l=>l.seq<=a.length&&b(l.seq)===l.id);$.set(e,m);let h=[...m].reverse().find(l=>l.seq>=g&&l.seq<=t),u=h?.seq??g,v=h?.base??c?.base??ae(e),y=U(e,f,v),k=e.pastEvery,q=(l,w)=>{m.some(D=>D.seq===l)||(m.push({seq:l,id:w,base:y.snapshot()}),m.sort((D,J)=>D.seq-J.seq))};for(let l=u;l<t;l++){let w=i[l-r];try{_(y,w)}catch{}(l+1)%k===0&&l+1<t&&q(l+1,w.id)}t-u>=k&&q(t,b(t));let M=i[t-1-r]?.at??c?.at;return L(e,d,{graph:y,log:i.slice(0,t-r),epochs:p,...r>0&&!p.some(l=>l.horizon)?{horizon:r}:{},seq:t,at:M,from:u})}var A=(e,n)=>n===void 0?{}:{[e]:n};function L(e,n,s){let o=V(e),a=e.constructor;return new a({schema:n?.schema??e.schema,invariants:n?.invariants??o.invariants,invariantOptions:o.invariantOptions,...A("policy",n?n.policy:e.policy),...A("modules",n?.modules??o.declaredModules),...A("enabledModules",o.startingModules),...A("timeZone",e.timeZone),intelligence:e.intelligence,principal:o.by,log:[...s.log],epochs:[...s.epochs],...A("horizon",s.horizon),snapshot:s.graph.snapshot(),validate:!1,now:o.now,past:{seq:s.seq,...A("at",s.at),foldedFrom:s.from,folded:s.seq-s.from}})}function U(e,n,s){let o=e.graph.constructor;try{return o.from(n,s,{validate:V(e).validate})}catch{return o.from(n,s,{validate:!1})}}var W=256,C=new WeakMap;function F(e){let n=C.get(e);return n||C.set(e,n={ops:new Map,epochs:new Map,chunks:new Map,marks:new Map}),n}function H(e,n){let s=-1,o;for(let[i,d]of e.epochs)i<=n&&i>s&&([s,o]=[i,d.base]);for(let[i,d]of e.marks)i<=n&&i>s&&([s,o]=[i,d]);let a=-1;for(let i=n-1;i>=Math.max(s,0);i--)if(!e.ops.has(i)){a=i;break}if(a<0&&o)return{from:s,base:o};let r=a<0?0:a-a%W,t=e.chunks.get(r);return!t||t.settled&&!t.refused&&a>=t.to?{ask:r}:t.settled?t.refused?{refused:t.refused}:a<0?{from:0,base:{nodes:[],edges:[]}}:{refused:`The archive is missing a change this moment needs (seq ${a})`}:{waiting:t.waiting}}function re(e,n,s,o){let a=Math.min(s+W,o),r={to:a,settled:!1,waiting:Promise.resolve()};r.waiting=Promise.resolve().then(()=>n(s,a)).then(t=>{let i=Array.isArray(t)?{ops:t}:t;if(!Array.isArray(i?.ops))throw new Error("its answer held no ops");for(let d of i.ops)Number.isInteger(d?.seq)&&d.seq<o&&!e.ops.has(d.seq)&&e.ops.set(d.seq,d);for(let d of i.epochs??[])Number.isInteger(d?.seq)&&d.seq<o&&d.base&&e.epochs.set(d.seq,d)}).then(()=>void(r.settled=!0),t=>void Object.assign(r,{settled:!0,refused:`Could not read the older changes from the archive: ${t instanceof Error?t.message:String(t)}`})),e.chunks.set(s,r)}function pe(e,n,s){let o=s?.archived,a=e.log.horizon;if(!o||n>=a)return;let r=F(o),t=H(r,n);return"ask"in t&&(re(r,o,t.ask,a),t=H(r,n)),"base"in t||"ask"in t?void 0:{seq:n,...t}}function Z(e,n,s,o){let a=N(e);if(a)return Z(a.store,n,s,o).seenBy(a.principal);if(!Number.isInteger(n)||n<0)throw new RangeError(`No moment at seq ${n}`);let r=F(s),t=H(r,n);if(!("base"in t))throw new RangeError("refused"in t?t.refused:`The changes before seq ${n} are still being read from the archive`);let i=U(e,o?.schema??e.schema,t.base),d=[],f=e.pastEvery;for(let c=t.from;c<n;c++){let g=r.ops.get(c);d.push(g);try{_(i,g)}catch{}(c+1)%f===0&&c+1<n&&!r.marks.has(c+1)&&r.marks.set(c+1,i.snapshot())}n-t.from>=f&&r.marks.set(n,i.snapshot());let p=r.epochs.get(t.from);return L(e,o,{graph:i,log:d,epochs:p?[p]:[],...t.from>0?{horizon:t.from}:{},seq:n,at:d.at(-1)?.at??p?.at,from:t.from})}function ae(e){let n=e.log.all(),s=e.log.horizon,o=n[0]?.id,a=B.get(e);if(a&&a.firstId===o)return a.base;let r=e.log.epochs().find(d=>d.seq>s),t=e.graph.constructor.from(e.schema,r?.base??e.graph.snapshot(),{validate:!1});for(let d=(r?.seq??e.log.length)-1;d>=s;d--)try{t.applyPrimitives(E(n[d-s]),{restoring:!0})}catch{}let i=t.snapshot();return B.set(e,{firstId:o,base:i}),i}function he(e,n,s={}){let o=typeof n=="number"?n:j(e,n),a=oe(s,o),r="declaration"in a?a.declaration:K(s.declarations,o);return s.archived&&o<e.log.horizon?Z(e,o,s.archived,r):O(e,o,{declaration:r})}function _(e,n){if(n.undoes!==void 0){e.applyPrimitives(n.primitives,{restoring:!0});return}try{e.applyPrimitives(n.primitives)}catch{e.applyPrimitives(n.primitives,{restoring:!0})}}export{K as a,oe as b,j as c,O as d,pe as e,he as f};
1
+ import{a as N}from"./chunk.TI4OSTQV.js";import{h as E}from"./chunk.SLBWPVIY.js";var S=globalThis[Symbol.for("@graview/core:publishing")]??={},T=()=>S.kit,P="publish",x=e=>e?.mode==="on-publish",Q=Symbol.for("@graview/core:seat"),G=(e,n)=>{let s=Reflect.get(e,n,e);return typeof s=="function"?s.bind(e):s},X,Y=()=>X??={name:P,title:"Publish",description:"Publish what collaborators have changed, so readers see it.",input:S.input(),apply(){}};var I=new WeakMap;function z(e){let n=e.all(),s=n.at(-1)?.id,o=I.get(e);if(o&&o.length===n.length&&o.last===s)return o.seq;let a,r;for(let t=n.length-1;t>=0;t--){let i=n[t];if(!(i.publishedThrough===void 0||(r??=e.undoneIds()).has(i.id))){a=i.publishedThrough;break}}return I.set(e,{length:n.length,last:s,seq:a}),a}function ee(e,n){if(!x(e))return{mutation:P,message:"this app is live: every edit reaches its readers as it is made, so there is nothing to publish.",wouldNeed:[]};let s=e.publishers??e.working;if(T().reads({mode:"on-publish",working:s},n))return{mutation:P,message:`only ${s.join(", ")||"nobody"} may publish.`,wouldNeed:[...s]}}var ne=(e,n,s,o,a,r)=>{let{log:t}=e,i=t.length,d=s.args.through;if(d!==void 0&&(!Number.isInteger(d)||d<t.horizon||d>i))throw new RangeError(`Cannot publish through seq ${String(d)}: this store holds seqs ${t.horizon} to ${i}.`);let f=d??i+1,p=z(t)??t.horizon,c=t.batches().filter(b=>!b.undone&&b.ops.some(m=>m.seq>=p&&m.seq<f&&m.publishedThrough===void 0)).length,g={id:n.id,seq:i,batch:o,author:a,intent:f<p?"Take back what was published":`Publish ${c===1?"1 change":`${c} changes`}`,...r.intent!==void 0?{batchIntent:r.intent}:{},mutation:s,primitives:[],reads:[],writes:[],at:n.at,...r.via!==void 0?{via:r.via}:{},publishedThrough:f};return t.append(g),g},te=new Set(["graph","log","snapshot","batches","violations","findings","canUndo","servedSeq","checkpoint"]);function se(e,n){let{seatView:s,viewsOf:o,viewKey:a,diff:r}=T(),t=o(e),i=a(n,"published"),d=t.get(i);if(d)return d;let f=s(e,n),p,c=()=>{let h=Math.max(e.publishedSeq??e.log.horizon,e.log.horizon);if(h>=e.log.length)return f;let u=e.log.all()[h-1-e.log.horizon]?.id;return(p?.seq!==h||p.id!==u)&&(p={seq:h,id:u,view:s(O(e,h),n)}),p.view},g=h=>h.servedSeq,b=h=>{let u=g(c()),v=c().graph.snapshot();return e.subscribe(()=>{let y=c(),k=g(y);if(k===u)return;let q=y.graph.snapshot(),M=k>u?y.log.all().filter(w=>w.seq>=u):[],l=r(v,q);[u,v]=[k,q],h(l,M)})},m=new Proxy(f,{get(h,u){switch(u){case Q:return{store:e,principal:n};case"subscribe":return b;case"seenBy":return(v,y)=>e.seenBy(v,y);case"seenFor":return n;default:return te.has(u)?G(c(),u):G(h,u)}}});return t.set(i,m),m}S.served=se;S.act=(e,n)=>x(e.publishing)&&!e.past&&!n.has(P)?Y():void 0;S.verdict=(e,n)=>{let s=ee(e.publishing,n);return s?{ok:!1,refusal:s}:{ok:!0}};S.seq=e=>x(e.publishing)?z(e.log):void 0;S.op=ne;function K(e,n){let s;for(let o of[...e??[]].sort((a,r)=>a.seq-r.seq)){if(o.seq>n)break;o.declaration&&(s=o.declaration)}return s}var R=new WeakMap;function oe(e,n){let s=K(e?.declarations,n),o=e?.declarationAt,a=[...e?.declarations??[]].filter(i=>i.seq<=n).sort((i,d)=>i.seq-d.seq).at(-1);if(!o||!a||a.declaration)return{declaration:s};let r=R.get(o);r||R.set(o,r=new Map);let t=r.get(a.seq);if(!t){let i={settled:!0,declaration:void 0,waiting:Promise.resolve()};try{let d=o(a.seq);d instanceof Promise?(i.settled=!1,i.waiting=d.then(f=>void Object.assign(i,{settled:!0,declaration:f}),()=>void(i.settled=!0))):i.declaration=d}catch{}r.set(a.seq,t=i)}return t.settled?{declaration:t.declaration??s}:{waiting:t.waiting}}var V=e=>e,$=new WeakMap,B=new WeakMap;function j(e,n){let s=typeof n=="string"?Date.parse(n):n.getTime();if(Number.isNaN(s))throw new RangeError(`\u201C${String(n)}\u201D is not a time`);let a=e.log.all().findIndex(r=>Date.parse(r.at)>s);return a===-1?e.log.length:e.log.horizon+a}function O(e,n,s={}){let o=N(e);if(o){let l=typeof n=="number"?n:j(e,n);if(l>e.servedSeq)throw new RangeError(`No moment at seq ${l}: this seat is served through seq ${e.servedSeq}`);return O(o.store,l,s).seenBy(o.principal)}let a=e.log,r=a.horizon,t=typeof n=="number"?n:j(e,n);if(!Number.isInteger(t)||t<r||t>a.length)throw new RangeError(`No moment at seq ${t}: this store holds seqs ${r} to ${a.length}${r>0?"; what is before its horizon is in the archive":""}`);let i=a.all(),d=s.declaration,f=d?.schema??e.schema,p=a.epochs().filter(l=>l.seq<=t),c=p.at(-1),g=c?.seq??r,b=l=>l>r?i[l-1-r]?.id:void 0,m=($.get(e)??[]).filter(l=>l.seq<=a.length&&b(l.seq)===l.id);$.set(e,m);let h=[...m].reverse().find(l=>l.seq>=g&&l.seq<=t),u=h?.seq??g,v=h?.base??c?.base??ae(e),y=U(e,f,v),k=e.pastEvery,q=(l,w)=>{m.some(D=>D.seq===l)||(m.push({seq:l,id:w,base:y.snapshot()}),m.sort((D,J)=>D.seq-J.seq))};for(let l=u;l<t;l++){let w=i[l-r];try{_(y,w)}catch{}(l+1)%k===0&&l+1<t&&q(l+1,w.id)}t-u>=k&&q(t,b(t));let M=i[t-1-r]?.at??c?.at;return L(e,d,{graph:y,log:i.slice(0,t-r),epochs:p,...r>0&&!p.some(l=>l.horizon)?{horizon:r}:{},seq:t,at:M,from:u})}var A=(e,n)=>n===void 0?{}:{[e]:n};function L(e,n,s){let o=V(e),a=e.constructor;return new a({schema:n?.schema??e.schema,invariants:n?.invariants??o.invariants,invariantOptions:o.invariantOptions,...A("policy",n?n.policy:e.policy),...A("modules",n?.modules??o.declaredModules),...A("enabledModules",o.startingModules),...A("timeZone",e.timeZone),intelligence:e.intelligence,principal:o.by,log:[...s.log],epochs:[...s.epochs],...A("horizon",s.horizon),snapshot:s.graph.snapshot(),validate:!1,now:o.now,past:{seq:s.seq,...A("at",s.at),foldedFrom:s.from,folded:s.seq-s.from}})}function U(e,n,s){let o=e.graph.constructor;try{return o.from(n,s,{validate:V(e).validate})}catch{return o.from(n,s,{validate:!1})}}var W=256,C=new WeakMap;function F(e){let n=C.get(e);return n||C.set(e,n={ops:new Map,epochs:new Map,chunks:new Map,marks:new Map}),n}function H(e,n){let s=-1,o;for(let[i,d]of e.epochs)i<=n&&i>s&&([s,o]=[i,d.base]);for(let[i,d]of e.marks)i<=n&&i>s&&([s,o]=[i,d]);let a=-1;for(let i=n-1;i>=Math.max(s,0);i--)if(!e.ops.has(i)){a=i;break}if(a<0&&o)return{from:s,base:o};let r=a<0?0:a-a%W,t=e.chunks.get(r);return!t||t.settled&&!t.refused&&a>=t.to?{ask:r}:t.settled?t.refused?{refused:t.refused}:a<0?{from:0,base:{nodes:[],edges:[]}}:{refused:`The archive is missing a change this moment needs (seq ${a})`}:{waiting:t.waiting}}function re(e,n,s,o){let a=Math.min(s+W,o),r={to:a,settled:!1,waiting:Promise.resolve()};r.waiting=Promise.resolve().then(()=>n(s,a)).then(t=>{let i=Array.isArray(t)?{ops:t}:t;if(!Array.isArray(i?.ops))throw new Error("its answer held no ops");for(let d of i.ops)Number.isInteger(d?.seq)&&d.seq<o&&!e.ops.has(d.seq)&&e.ops.set(d.seq,d);for(let d of i.epochs??[])Number.isInteger(d?.seq)&&d.seq<o&&d.base&&e.epochs.set(d.seq,d)}).then(()=>void(r.settled=!0),t=>void Object.assign(r,{settled:!0,refused:`Could not read the older changes from the archive: ${t instanceof Error?t.message:String(t)}`})),e.chunks.set(s,r)}function pe(e,n,s){let o=s?.archived,a=e.log.horizon;if(!o||n>=a)return;let r=F(o),t=H(r,n);return"ask"in t&&(re(r,o,t.ask,a),t=H(r,n)),"base"in t||"ask"in t?void 0:{seq:n,...t}}function Z(e,n,s,o){let a=N(e);if(a)return Z(a.store,n,s,o).seenBy(a.principal);if(!Number.isInteger(n)||n<0)throw new RangeError(`No moment at seq ${n}`);let r=F(s),t=H(r,n);if(!("base"in t))throw new RangeError("refused"in t?t.refused:`The changes before seq ${n} are still being read from the archive`);let i=U(e,o?.schema??e.schema,t.base),d=[],f=e.pastEvery;for(let c=t.from;c<n;c++){let g=r.ops.get(c);d.push(g);try{_(i,g)}catch{}(c+1)%f===0&&c+1<n&&!r.marks.has(c+1)&&r.marks.set(c+1,i.snapshot())}n-t.from>=f&&r.marks.set(n,i.snapshot());let p=r.epochs.get(t.from);return L(e,o,{graph:i,log:d,epochs:p?[p]:[],...t.from>0?{horizon:t.from}:{},seq:n,at:d.at(-1)?.at??p?.at,from:t.from})}function ae(e){let n=e.log.all(),s=e.log.horizon,o=n[0]?.id,a=B.get(e);if(a&&a.firstId===o)return a.base;let r=e.log.epochs().find(d=>d.seq>s),t=e.graph.constructor.from(e.schema,r?.base??e.graph.snapshot(),{validate:!1});for(let d=(r?.seq??e.log.length)-1;d>=s;d--)try{t.applyPrimitives(E(n[d-s]),{restoring:!0})}catch{}let i=t.snapshot();return B.set(e,{firstId:o,base:i}),i}function he(e,n,s={}){let o=typeof n=="number"?n:j(e,n),a=oe(s,o),r="declaration"in a?a.declaration:K(s.declarations,o);return s.archived&&o<e.log.horizon?Z(e,o,s.archived,r):O(e,o,{declaration:r})}function _(e,n){if(n.undoes!==void 0){e.applyPrimitives(n.primitives,{restoring:!0});return}try{e.applyPrimitives(n.primitives)}catch{e.applyPrimitives(n.primitives,{restoring:!0})}}export{K as a,oe as b,j as c,O as d,pe as e,he as f};
@@ -1 +1 @@
1
- import{G as C,Pa as H,Ra as A,S as F}from"./chunk.SGMVLKZO.js";import"./chunk.SDO3U72B.js";import"./chunk.BLS2G3CD.js";import"./chunk.EJUZGIQ5.js";import{b as x}from"./chunk.AJZBJBMO.js";var t=x(C(),1),f=x(F(),1),q={faces:'[data-testid="app-faces"]',problems:'[data-testid="standing"], [data-testid="standing-link"]',activity:'[data-testid="activity-button"]',ask:'[data-testid="app-find"], [data-testid="app-find-open"]',find:'[data-testid="app-find"], [data-testid="app-find-open"]',profile:'[data-testid="profile-button"]',home:'[data-testid="app-home"]'};function D(e){if(!e.isConnected||e.closest("[hidden], [inert], [aria-hidden='true']"))return!1;if(typeof e.checkVisibility!="function")return!0;if(!e.checkVisibility({visibilityProperty:!0}))return!1;let a=e.getBoundingClientRect();return a.width>1&&a.height>1}function E(e,a){if(!e||a==="ask"&&!e.querySelector("[data-graview-quick-ask]"))return null;for(let d of e.querySelectorAll(q[a]))if(D(d))return d;return null}function W(e){let a=(u,h,c)=>e.querySelector(u)?.getAttribute(h)?.trim()||c,d=a('[data-testid="app-face-scene"]',"title","Scene"),n=a('[data-testid="app-face-pages"]',"title","Pages");return[{anchor:"faces",title:`${d} or ${n}`,words:`One app, two ways to see it: ${d} draws every record as one picture, ${n} as lists and pages to read and change.`},{anchor:"problems",title:"Whether all is in order",words:"The dot is green while every rule holds. When one is broken it counts what is wrong, and pressing it shows each one and where."},{anchor:"activity",title:"Activity",words:"What has happened here and who did it, each change with its way back."},{anchor:"ask",title:"Ask",words:"Press \u2318K (Ctrl+K) to ask about what you have selected, or right-click it and choose Ask about this\u2026. The answer stands beside it, and a change it proposes waits for you to accept it."}]}var R=300,O=1200,$=15e3;function _({root:e,steps:a,onEnd:d}){let[n,u]=(0,t.useState)(null),h=(0,t.useRef)(null),c=(0,t.useRef)(!1),p=(0,t.useRef)(d);p.current=d,(0,t.useEffect)(()=>{let r=Date.now(),o=Date.now(),s=null,i,v=new MutationObserver(()=>o=Date.now());v.observe(document.body,{childList:!0,subtree:!0});let k=()=>{let L=e(),S=Date.now();if(L?.querySelector('[data-testid="app-bar"]')){if(s??=S,S-o>=R||S-s>=O){let T=[...W(L),...a].filter(P=>E(L,P.anchor)!==null);if(T.length===0){c.current=!0,p.current(null);return}h.current=document.activeElement,u({list:T,at:0});return}}else if(S-r>=$){c.current=!0,p.current(null);return}i=setTimeout(k,100)};return i=setTimeout(k,100),()=>{clearTimeout(i),v.disconnect()}},[]);let y=(0,t.useCallback)(()=>{let r=h.current;(r instanceof HTMLElement&&r!==document.body&&r.isConnected?r:e()?.querySelector('[data-testid="app-home"]'))?.focus({preventScroll:!0})},[e]),m=(0,t.useCallback)((r,o)=>{if(c.current)return;c.current=!0;let s=document.querySelector("[data-testid='first-look']"),i=document.activeElement,v=i===null||i===document.body||s!==null&&s.contains(i);u(null),p.current(r),!(!o&&!v)&&(y(),requestAnimationFrame(()=>{let k=document.activeElement;(k===null||k===document.body)&&y()}))},[y]),b=(0,t.useCallback)((r,o)=>{let s=e();for(let i=o;i<r.length;i++)if(E(s,r[i].anchor))return i;return-1},[e]),g=(0,t.useCallback)(()=>{if(!n)return;let r=b(n.list,n.at+1);r<0?m("finished",!0):u({list:n.list,at:r})},[n,b,m]);if((0,t.useEffect)(()=>{if(!n)return;let r=e();if(!r)return;let o=0,s=()=>{cancelAnimationFrame(o),o=requestAnimationFrame(()=>{E(e(),n.list[n.at].anchor)||g()})},i=new MutationObserver(s);return i.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden","class","data-switch-drawn"]}),()=>{cancelAnimationFrame(o),i.disconnect()}},[n,e,g]),!n)return null;let w=n.list[n.at],l=b(n.list,n.at+1)<0;return(0,f.jsx)(I,{root:e,step:w,position:n.at+1,total:n.list.length,last:l,onNext:g,onEnd:m},n.at)}var N={...H,width:"min(320px, calc(100vw - 24px))",maxHeight:"min(70vh, 420px)",overflow:"auto",padding:"12px 14px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)",fontSize:"0.875rem",lineHeight:1.45,overflowWrap:"anywhere"},M={minHeight:32,padding:"0 12px",borderRadius:8,font:"inherit",fontWeight:600,cursor:"pointer"};function I({root:e,step:a,position:d,total:n,last:u,onNext:h,onEnd:c}){let p=(0,t.useRef)(null),y=(0,t.useRef)(null),m=(0,t.useId)().replace(/:/g,""),b=(0,t.useMemo)(()=>({get current(){return E(e(),a.anchor)}}),[e,a.anchor]),[g]=(0,t.useState)(()=>{let l=b.current?.getBoundingClientRect(),r=typeof document>"u"?0:document.documentElement.clientWidth||innerWidth;return l&&l.left+l.width/2<r/2?"start":"end"});A(p,!0,b,{align:g}),(0,t.useLayoutEffect)(()=>{y.current?.focus({preventScroll:!0})},[]);let w=(0,t.useRef)(c);return w.current=c,(0,t.useEffect)(()=>{let l=o=>{o.target instanceof Node&&p.current?.contains(o.target)||w.current("dismissed",!1)},r=o=>{if(o.key!=="Escape"||o.defaultPrevented)return;let s=o.target;s instanceof Node&&p.current?.contains(s)||s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||[...document.querySelectorAll("[data-graview-overlay]:not([hidden])")].some(i=>i!==p.current)||w.current("dismissed",!0)};return document.addEventListener("pointerdown",l,!0),document.addEventListener("keydown",r),()=>{document.removeEventListener("pointerdown",l,!0),document.removeEventListener("keydown",r)}},[]),(0,f.jsxs)("div",{ref:p,popover:"manual",role:"dialog","aria-modal":"false","aria-labelledby":`${m}-title`,"aria-describedby":`${m}-words`,tabIndex:-1,"data-testid":"first-look","data-first-look-anchor":a.anchor,"data-graview-overlay":"",onKeyDown:l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),c("dismissed",!0))},style:N,children:[(0,f.jsxs)("p",{style:{margin:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},"data-testid":"first-look-count",children:[d," of ",n]}),(0,f.jsx)("p",{id:`${m}-title`,style:{margin:"2px 0 4px",fontWeight:600,fontSize:"0.9375rem"},"data-testid":"first-look-title",children:a.title}),(0,f.jsx)("p",{id:`${m}-words`,style:{margin:0},"data-testid":"first-look-words",children:a.words}),(0,f.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-end",gap:8,marginTop:12},children:[u?null:(0,f.jsx)("button",{type:"button","data-testid":"first-look-skip",onClick:()=>c("dismissed",!0),style:{...M,fontWeight:500,border:"1px solid transparent",background:"none",color:"var(--graview-ink-muted)"},children:"Skip"}),(0,f.jsx)("button",{ref:y,type:"button","data-testid":u?"first-look-done":"first-look-next",onClick:()=>u?c("finished",!0):h(),style:{...M,border:"1px solid var(--graview-accent)",background:"var(--graview-accent)",color:"var(--graview-accent-ink)"},children:u?"Done":"Next"})]})]})}export{_ as FirstLookHints,E as firstLookAnchor};
1
+ import{G as C,Qa as H,Sa as A,T as F}from"./chunk.Q5IAXTF5.js";import"./chunk.SDO3U72B.js";import"./chunk.VOHRQXCF.js";import"./chunk.SLBWPVIY.js";import{b as x}from"./chunk.AJZBJBMO.js";var t=x(C(),1),f=x(F(),1),q={faces:'[data-testid="app-faces"]',problems:'[data-testid="standing"], [data-testid="standing-link"]',activity:'[data-testid="activity-button"]',ask:'[data-testid="app-find"], [data-testid="app-find-open"]',find:'[data-testid="app-find"], [data-testid="app-find-open"]',profile:'[data-testid="profile-button"]',home:'[data-testid="app-home"]'};function D(e){if(!e.isConnected||e.closest("[hidden], [inert], [aria-hidden='true']"))return!1;if(typeof e.checkVisibility!="function")return!0;if(!e.checkVisibility({visibilityProperty:!0}))return!1;let a=e.getBoundingClientRect();return a.width>1&&a.height>1}function E(e,a){if(!e||a==="ask"&&!e.querySelector("[data-graview-quick-ask]"))return null;for(let d of e.querySelectorAll(q[a]))if(D(d))return d;return null}function W(e){let a=(u,h,c)=>e.querySelector(u)?.getAttribute(h)?.trim()||c,d=a('[data-testid="app-face-scene"]',"title","Scene"),n=a('[data-testid="app-face-pages"]',"title","Pages");return[{anchor:"faces",title:`${d} or ${n}`,words:`One app, two ways to see it: ${d} draws every record as one picture, ${n} as lists and pages to read and change.`},{anchor:"problems",title:"Whether all is in order",words:"The dot is green while every rule holds. When one is broken it counts what is wrong, and pressing it shows each one and where."},{anchor:"activity",title:"Activity",words:"What has happened here and who did it, each change with its way back."},{anchor:"ask",title:"Ask",words:"Press \u2318K (Ctrl+K) to ask about what you have selected, or right-click it and choose Ask about this\u2026. The answer stands beside it, and a change it proposes waits for you to accept it."}]}var R=300,O=1200,$=15e3;function _({root:e,steps:a,onEnd:d}){let[n,u]=(0,t.useState)(null),h=(0,t.useRef)(null),c=(0,t.useRef)(!1),p=(0,t.useRef)(d);p.current=d,(0,t.useEffect)(()=>{let r=Date.now(),o=Date.now(),s=null,i,v=new MutationObserver(()=>o=Date.now());v.observe(document.body,{childList:!0,subtree:!0});let k=()=>{let L=e(),S=Date.now();if(L?.querySelector('[data-testid="app-bar"]')){if(s??=S,S-o>=R||S-s>=O){let T=[...W(L),...a].filter(P=>E(L,P.anchor)!==null);if(T.length===0){c.current=!0,p.current(null);return}h.current=document.activeElement,u({list:T,at:0});return}}else if(S-r>=$){c.current=!0,p.current(null);return}i=setTimeout(k,100)};return i=setTimeout(k,100),()=>{clearTimeout(i),v.disconnect()}},[]);let y=(0,t.useCallback)(()=>{let r=h.current;(r instanceof HTMLElement&&r!==document.body&&r.isConnected?r:e()?.querySelector('[data-testid="app-home"]'))?.focus({preventScroll:!0})},[e]),m=(0,t.useCallback)((r,o)=>{if(c.current)return;c.current=!0;let s=document.querySelector("[data-testid='first-look']"),i=document.activeElement,v=i===null||i===document.body||s!==null&&s.contains(i);u(null),p.current(r),!(!o&&!v)&&(y(),requestAnimationFrame(()=>{let k=document.activeElement;(k===null||k===document.body)&&y()}))},[y]),b=(0,t.useCallback)((r,o)=>{let s=e();for(let i=o;i<r.length;i++)if(E(s,r[i].anchor))return i;return-1},[e]),g=(0,t.useCallback)(()=>{if(!n)return;let r=b(n.list,n.at+1);r<0?m("finished",!0):u({list:n.list,at:r})},[n,b,m]);if((0,t.useEffect)(()=>{if(!n)return;let r=e();if(!r)return;let o=0,s=()=>{cancelAnimationFrame(o),o=requestAnimationFrame(()=>{E(e(),n.list[n.at].anchor)||g()})},i=new MutationObserver(s);return i.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden","class","data-switch-drawn"]}),()=>{cancelAnimationFrame(o),i.disconnect()}},[n,e,g]),!n)return null;let w=n.list[n.at],l=b(n.list,n.at+1)<0;return(0,f.jsx)(I,{root:e,step:w,position:n.at+1,total:n.list.length,last:l,onNext:g,onEnd:m},n.at)}var N={...H,width:"min(320px, calc(100vw - 24px))",maxHeight:"min(70vh, 420px)",overflow:"auto",padding:"12px 14px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)",fontSize:"0.875rem",lineHeight:1.45,overflowWrap:"anywhere"},M={minHeight:32,padding:"0 12px",borderRadius:8,font:"inherit",fontWeight:600,cursor:"pointer"};function I({root:e,step:a,position:d,total:n,last:u,onNext:h,onEnd:c}){let p=(0,t.useRef)(null),y=(0,t.useRef)(null),m=(0,t.useId)().replace(/:/g,""),b=(0,t.useMemo)(()=>({get current(){return E(e(),a.anchor)}}),[e,a.anchor]),[g]=(0,t.useState)(()=>{let l=b.current?.getBoundingClientRect(),r=typeof document>"u"?0:document.documentElement.clientWidth||innerWidth;return l&&l.left+l.width/2<r/2?"start":"end"});A(p,!0,b,{align:g}),(0,t.useLayoutEffect)(()=>{y.current?.focus({preventScroll:!0})},[]);let w=(0,t.useRef)(c);return w.current=c,(0,t.useEffect)(()=>{let l=o=>{o.target instanceof Node&&p.current?.contains(o.target)||w.current("dismissed",!1)},r=o=>{if(o.key!=="Escape"||o.defaultPrevented)return;let s=o.target;s instanceof Node&&p.current?.contains(s)||s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||[...document.querySelectorAll("[data-graview-overlay]:not([hidden])")].some(i=>i!==p.current)||w.current("dismissed",!0)};return document.addEventListener("pointerdown",l,!0),document.addEventListener("keydown",r),()=>{document.removeEventListener("pointerdown",l,!0),document.removeEventListener("keydown",r)}},[]),(0,f.jsxs)("div",{ref:p,popover:"manual",role:"dialog","aria-modal":"false","aria-labelledby":`${m}-title`,"aria-describedby":`${m}-words`,tabIndex:-1,"data-testid":"first-look","data-first-look-anchor":a.anchor,"data-graview-overlay":"",onKeyDown:l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),c("dismissed",!0))},style:N,children:[(0,f.jsxs)("p",{style:{margin:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},"data-testid":"first-look-count",children:[d," of ",n]}),(0,f.jsx)("p",{id:`${m}-title`,style:{margin:"2px 0 4px",fontWeight:600,fontSize:"0.9375rem"},"data-testid":"first-look-title",children:a.title}),(0,f.jsx)("p",{id:`${m}-words`,style:{margin:0},"data-testid":"first-look-words",children:a.words}),(0,f.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-end",gap:8,marginTop:12},children:[u?null:(0,f.jsx)("button",{type:"button","data-testid":"first-look-skip",onClick:()=>c("dismissed",!0),style:{...M,fontWeight:500,border:"1px solid transparent",background:"none",color:"var(--graview-ink-muted)"},children:"Skip"}),(0,f.jsx)("button",{ref:y,type:"button","data-testid":u?"first-look-done":"first-look-next",onClick:()=>u?c("finished",!0):h(),style:{...M,border:"1px solid var(--graview-accent)",background:"var(--graview-accent)",color:"var(--graview-accent-ink)"},children:u?"Done":"Next"})]})]})}export{_ as FirstLookHints,E as firstLookAnchor};
@@ -1 +1 @@
1
- import{a as C,e as L,n as H,o as R,p as k}from"./chunk.SJRXBTGP.js";import"./chunk.L5MDUZLQ.js";import"./chunk.IDQHSAAQ.js";import"./chunk.Q7RI4SI4.js";import"./chunk.XOZU4OFA.js";import"./chunk.CR5MQMOL.js";import{a as S}from"./chunk.VM43YREJ.js";import"./chunk.TI4OSTQV.js";import"./chunk.MQISKON2.js";import"./chunk.TT6QBWRA.js";import"./chunk.UCS3CBT4.js";import"./chunk.O6SKKF4V.js";import"./chunk.ZK446PSX.js";import{G as T,Qa as E,S as b}from"./chunk.SGMVLKZO.js";import"./chunk.SDO3U72B.js";import{Ic as x}from"./chunk.BLS2G3CD.js";import"./chunk.EJUZGIQ5.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 j({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{j as HoverChip};
1
+ import{a as C,e as L,n as H,o as R,p as k}from"./chunk.7IOC6U3C.js";import"./chunk.7FZY5E2U.js";import"./chunk.7354O67H.js";import"./chunk.XLM4ONUB.js";import"./chunk.XOZU4OFA.js";import"./chunk.C7EEYSAM.js";import{a as S}from"./chunk.DGWNVDZB.js";import"./chunk.TI4OSTQV.js";import"./chunk.3TME4BG3.js";import"./chunk.CV4QA4ZF.js";import"./chunk.OYRZ2DEI.js";import"./chunk.7EA7THSM.js";import"./chunk.AI2HBKVP.js";import{G as T,Ra as E,T as b}from"./chunk.Q5IAXTF5.js";import"./chunk.SDO3U72B.js";import{Oc as x}from"./chunk.VOHRQXCF.js";import"./chunk.SLBWPVIY.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 j({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{j as HoverChip};