graview 0.1.42 → 0.1.44

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 (204) hide show
  1. package/dist/preview/{chunk.XDPIS7RS.js → chunk.27ZVVPRZ.js} +1 -1
  2. package/dist/preview/chunk.2AZTW66C.js +1 -0
  3. package/dist/preview/{chunk.CSWX7YGI.js → chunk.2CPC3HQI.js} +1 -1
  4. package/dist/preview/{chunk.HQMGTPDC.js → chunk.2EXY4AHX.js} +4 -4
  5. package/dist/preview/chunk.2O2THM2R.js +1 -0
  6. package/dist/preview/{chunk.J7ZMNAWB.js → chunk.3IUJ4GW7.js} +1 -1
  7. package/dist/preview/chunk.3L7OEBJH.js +1 -0
  8. package/dist/preview/{chunk.QHLD4TZW.js → chunk.3M4VCAA3.js} +1 -1
  9. package/dist/preview/chunk.3OKJ4GOA.js +1 -0
  10. package/dist/preview/chunk.3PNDXNX6.js +1 -0
  11. package/dist/preview/{chunk.WERBD5ZR.js → chunk.3TBH2FMZ.js} +1 -1
  12. package/dist/preview/{chunk.IWLVZGW5.js → chunk.4B4DKCS4.js} +1 -1
  13. package/dist/preview/{chunk.PCTVLNOS.js → chunk.4EPT2CQG.js} +1 -1
  14. package/dist/preview/chunk.4JWT6LIS.js +25 -0
  15. package/dist/preview/chunk.4WCQWILK.js +1 -0
  16. package/dist/preview/chunk.56DR42FA.js +1 -0
  17. package/dist/preview/chunk.5JPELFMA.js +2 -0
  18. package/dist/preview/chunk.5WEEZ7WD.js +1 -0
  19. package/dist/preview/chunk.64QDUERE.js +1 -0
  20. package/dist/preview/{chunk.I7QCXRP7.js → chunk.6BIRNR5P.js} +1 -1
  21. package/dist/preview/{chunk.7EB6SDUQ.js → chunk.6NFR2LYQ.js} +1 -1
  22. package/dist/preview/chunk.6VIZGLDK.js +1 -0
  23. package/dist/preview/{chunk.L6HKDIZB.js → chunk.7AEE3VHC.js} +1 -1
  24. package/dist/preview/chunk.7B5BZZBG.js +1 -0
  25. package/dist/preview/chunk.7HL7CFXJ.js +1 -0
  26. package/dist/preview/chunk.7JVBVB4A.js +1 -0
  27. package/dist/preview/{chunk.QXMTGLHR.js → chunk.7PUFYK3B.js} +1 -1
  28. package/dist/preview/{chunk.ARTJL3X2.js → chunk.7UV7ODXU.js} +1 -1
  29. package/dist/preview/chunk.ALFW4ZJQ.js +1 -0
  30. package/dist/preview/{chunk.HG2IO5NS.js → chunk.ATKKTPJS.js} +1 -1
  31. package/dist/preview/chunk.AW2T3KFV.js +5 -0
  32. package/dist/preview/{chunk.PACJFDDU.js → chunk.B2CIQ66N.js} +1 -1
  33. package/dist/preview/{chunk.5FHH5NR6.js → chunk.B7FZLIAO.js} +1 -1
  34. package/dist/preview/{chunk.NS3Z7QNP.js → chunk.BA4KQR5H.js} +1 -1
  35. package/dist/preview/chunk.CDFVEL2Y.js +1 -0
  36. package/dist/preview/chunk.CSQNDAEK.js +1 -0
  37. package/dist/preview/chunk.D2RK2KJD.js +35 -0
  38. package/dist/preview/chunk.DAZEFSWI.js +1 -0
  39. package/dist/preview/{chunk.KMGGP6XT.js → chunk.DGXWL4GC.js} +2 -2
  40. package/dist/preview/chunk.DLVNW4HU.js +1 -0
  41. package/dist/preview/chunk.E2AJ7U5Z.js +1 -0
  42. package/dist/preview/chunk.EJAWDI2V.js +1 -0
  43. package/dist/preview/chunk.EJOTTZWZ.js +1 -0
  44. package/dist/preview/{chunk.WVN62OMH.js → chunk.ESU2DD3J.js} +1 -1
  45. package/dist/preview/chunk.EW364363.js +9 -0
  46. package/dist/preview/chunk.EYEIDL3T.js +1 -0
  47. package/dist/preview/chunk.EZRGGPAN.js +1 -0
  48. package/dist/preview/{chunk.SUQU4AXG.js → chunk.F4DWRBO7.js} +1 -1
  49. package/dist/preview/{chunk.K63BUJBF.js → chunk.FBIK4LTM.js} +2 -2
  50. package/dist/preview/{chunk.ILPD5CZG.js → chunk.FIJNKSMQ.js} +1 -1
  51. package/dist/preview/{chunk.Y2QDZLSY.js → chunk.FNF6XQI5.js} +1 -1
  52. package/dist/preview/chunk.FNXW46U4.js +349 -0
  53. package/dist/preview/chunk.FUYMLDNJ.js +7 -0
  54. package/dist/preview/chunk.FVHECT47.js +1 -0
  55. package/dist/preview/{chunk.KZDLDXLB.js → chunk.GAN77YDU.js} +1 -1
  56. package/dist/preview/{chunk.O7VHAKSA.js → chunk.GBCWI2LF.js} +1 -1
  57. package/dist/preview/chunk.H4GHKBMH.js +1 -0
  58. package/dist/preview/chunk.HB34VQKQ.js +1 -0
  59. package/dist/preview/chunk.HKA27VJO.js +1 -0
  60. package/dist/preview/{chunk.4YBP552Z.js → chunk.HKD5SR45.js} +2 -2
  61. package/dist/preview/{chunk.6HUS5UHZ.js → chunk.HP72LB3B.js} +1 -1
  62. package/dist/preview/{chunk.B6DKKNVR.js → chunk.IBWPRK2R.js} +1 -1
  63. package/dist/preview/{chunk.V3K32XD7.js → chunk.IIB22IIP.js} +1 -1
  64. package/dist/preview/{chunk.57R4ZUMM.js → chunk.IN4PKQO5.js} +1 -1
  65. package/dist/preview/chunk.IPHWGBZE.js +6 -0
  66. package/dist/preview/{chunk.B7DCQJXV.js → chunk.IQWKEGWG.js} +1 -1
  67. package/dist/preview/chunk.JEMQ66FT.js +19 -0
  68. package/dist/preview/chunk.JGYGSNQY.js +1 -0
  69. package/dist/preview/{chunk.EC2T2UVH.js → chunk.JLOSQ5UY.js} +2 -2
  70. package/dist/preview/{chunk.X5WIS4BC.js → chunk.JQ7WY2VZ.js} +1 -1
  71. package/dist/preview/chunk.JUT2VCFW.js +1 -0
  72. package/dist/preview/{chunk.VTUMPH4Z.js → chunk.KERLVJ6I.js} +1 -1
  73. package/dist/preview/chunk.L6FWIQXS.js +1 -0
  74. package/dist/preview/{chunk.U3MQUIJL.js → chunk.LKF4BBCW.js} +1 -1
  75. package/dist/preview/chunk.LKXYZK5H.js +1 -0
  76. package/dist/preview/chunk.LULTKYE3.js +1 -0
  77. package/dist/preview/chunk.LUPBT6YM.js +1 -0
  78. package/dist/preview/{chunk.VO6DBVZR.js → chunk.LYSHLKAX.js} +1 -1
  79. package/dist/preview/chunk.LYUPJ4VV.js +1 -0
  80. package/dist/preview/{chunk.ZQCGDTQ3.js → chunk.MFLJIFZD.js} +1 -1
  81. package/dist/preview/chunk.MOF2D6DV.js +1 -0
  82. package/dist/preview/{chunk.CAZX6OPN.js → chunk.MWUP5X47.js} +1 -1
  83. package/dist/preview/{chunk.LFJH6X6O.js → chunk.MZOIPCDA.js} +1 -1
  84. package/dist/preview/{chunk.VMBIFUYX.js → chunk.N5ULWKR4.js} +1 -1
  85. package/dist/preview/{chunk.27P37343.js → chunk.NBOZPPSM.js} +1 -1
  86. package/dist/preview/chunk.NPS2WN7T.js +1 -0
  87. package/dist/preview/chunk.NTFCZYOR.js +1 -0
  88. package/dist/preview/chunk.O4VSQ2ER.js +1 -0
  89. package/dist/preview/{chunk.ROHM3ETN.js → chunk.OAWAUB4P.js} +1 -1
  90. package/dist/preview/chunk.OG6GNGTX.js +21 -0
  91. package/dist/preview/{chunk.V5VQCANB.js → chunk.OGF6UORU.js} +1 -1
  92. package/dist/preview/chunk.OK4FSBHI.js +1 -0
  93. package/dist/preview/chunk.P546VMA5.js +1 -0
  94. package/dist/preview/chunk.P5K7EYDK.js +1 -0
  95. package/dist/preview/{chunk.BZ4VZ6WQ.js → chunk.PL2P2OON.js} +1 -1
  96. package/dist/preview/chunk.PSTE3LZL.js +5 -0
  97. package/dist/preview/chunk.PX6VAZFJ.js +1 -0
  98. package/dist/preview/{chunk.P6J6VFF5.js → chunk.QJJKITXF.js} +1 -1
  99. package/dist/preview/{chunk.U6YOAS4X.js → chunk.QNJYXB3U.js} +1 -1
  100. package/dist/preview/chunk.RDGFZPKN.js +1 -0
  101. package/dist/preview/{chunk.LWAZ6ZO6.js → chunk.REEDZSCG.js} +2 -2
  102. package/dist/preview/chunk.REOYQTFP.js +1 -0
  103. package/dist/preview/{chunk.2ZGICECC.js → chunk.RLMW7DU6.js} +1 -1
  104. package/dist/preview/{chunk.VEP4EJ2N.js → chunk.RNUGQRJI.js} +1 -1
  105. package/dist/preview/{chunk.ZRIDKFTV.js → chunk.RVQYXPCM.js} +1 -1
  106. package/dist/preview/{chunk.LQGXUMUX.js → chunk.RYNCEZ6Q.js} +1 -1
  107. package/dist/preview/{chunk.WUQOSVQU.js → chunk.T6S3CEW7.js} +2 -2
  108. package/dist/preview/{chunk.PH5ITX3N.js → chunk.TDCO7LEA.js} +1 -1
  109. package/dist/preview/chunk.TJO5Y2OJ.js +1 -0
  110. package/dist/preview/chunk.TTSNHX3F.js +1 -0
  111. package/dist/preview/{chunk.QHP7AJUV.js → chunk.U3CV5CCL.js} +1 -1
  112. package/dist/preview/{chunk.VKJAGZNU.js → chunk.UG23RICT.js} +1 -1
  113. package/dist/preview/chunk.URCC626R.js +1 -0
  114. package/dist/preview/{chunk.37NF3YXZ.js → chunk.UXLJZIYX.js} +1 -1
  115. package/dist/preview/{chunk.AQTCN7KQ.js → chunk.UZSZPMRC.js} +1 -1
  116. package/dist/preview/chunk.V4DR25S4.js +1 -0
  117. package/dist/preview/chunk.VAUG5TGZ.js +1 -0
  118. package/dist/preview/{chunk.HAY22FPJ.js → chunk.WE5SA6TP.js} +1 -1
  119. package/dist/preview/chunk.WNYPP52L.js +1 -0
  120. package/dist/preview/chunk.WPLKHIO5.js +88 -0
  121. package/dist/preview/{chunk.XNW7PUAF.js → chunk.XPIDPZKS.js} +1 -1
  122. package/dist/preview/{chunk.P7ISPJAQ.js → chunk.Y2MIG2C2.js} +1 -1
  123. package/dist/preview/chunk.YE4GZVOX.js +1 -0
  124. package/dist/preview/chunk.YERDP6YF.js +1 -0
  125. package/dist/preview/{chunk.5NDYYTT4.js → chunk.YGX2AE36.js} +1 -1
  126. package/dist/preview/chunk.YTXEPWVW.js +1 -0
  127. package/dist/preview/chunk.YTZDCIX2.js +1 -0
  128. package/dist/preview/chunk.YYPK7IDM.js +1 -0
  129. package/dist/preview/chunk.ZKBSEUK4.js +1 -0
  130. package/dist/preview/chunk.ZN77U6SU.js +1 -0
  131. package/dist/preview/{chunk.HOTOH7ZB.js → chunk.ZP6PS5Z4.js} +1 -1
  132. package/dist/preview/chunk.ZZ5F5I3O.js +1 -0
  133. package/dist/preview/index.html +46 -45
  134. package/dist/preview/page.js +6 -6
  135. package/package.json +6 -6
  136. package/dist/preview/chunk.22QEYFWI.js +0 -1
  137. package/dist/preview/chunk.35FR36BQ.js +0 -1
  138. package/dist/preview/chunk.36LP3I7Z.js +0 -21
  139. package/dist/preview/chunk.3K2KBIRG.js +0 -1
  140. package/dist/preview/chunk.3SKUJWFC.js +0 -1
  141. package/dist/preview/chunk.3WABA2WQ.js +0 -1
  142. package/dist/preview/chunk.4NBB44YU.js +0 -1
  143. package/dist/preview/chunk.4QEDYRES.js +0 -349
  144. package/dist/preview/chunk.4YRCKOX2.js +0 -1
  145. package/dist/preview/chunk.6MLAJKYM.js +0 -1
  146. package/dist/preview/chunk.6NF32PAT.js +0 -1
  147. package/dist/preview/chunk.6WB24MS3.js +0 -1
  148. package/dist/preview/chunk.7HZVCW3Q.js +0 -1
  149. package/dist/preview/chunk.7MJM3OVC.js +0 -1
  150. package/dist/preview/chunk.7OSL64QH.js +0 -1
  151. package/dist/preview/chunk.7XDNCCLG.js +0 -6
  152. package/dist/preview/chunk.7Z2GTKA4.js +0 -1
  153. package/dist/preview/chunk.AOC2KUFE.js +0 -1
  154. package/dist/preview/chunk.AWSUMY3D.js +0 -1
  155. package/dist/preview/chunk.B65HPL4I.js +0 -1
  156. package/dist/preview/chunk.BJET6KOG.js +0 -1
  157. package/dist/preview/chunk.D3ELYLME.js +0 -1
  158. package/dist/preview/chunk.DNMBZONP.js +0 -1
  159. package/dist/preview/chunk.DXAUXGNN.js +0 -1
  160. package/dist/preview/chunk.EHMCRUYR.js +0 -1
  161. package/dist/preview/chunk.EQIQPY4O.js +0 -1
  162. package/dist/preview/chunk.ETWOZQWL.js +0 -1
  163. package/dist/preview/chunk.EVHXF7LZ.js +0 -19
  164. package/dist/preview/chunk.FFRWSODT.js +0 -1
  165. package/dist/preview/chunk.G4AY6NGN.js +0 -1
  166. package/dist/preview/chunk.GN2SZEFH.js +0 -1
  167. package/dist/preview/chunk.GXWOEOUY.js +0 -1
  168. package/dist/preview/chunk.IGA7OD3L.js +0 -1
  169. package/dist/preview/chunk.IXS5XBG6.js +0 -1
  170. package/dist/preview/chunk.JCTT2LAK.js +0 -1
  171. package/dist/preview/chunk.JE4QQEJE.js +0 -25
  172. package/dist/preview/chunk.JEBB3WM7.js +0 -1
  173. package/dist/preview/chunk.JPD2I4Z7.js +0 -1
  174. package/dist/preview/chunk.LKGDN25E.js +0 -1
  175. package/dist/preview/chunk.LMUFLZYT.js +0 -1
  176. package/dist/preview/chunk.LZH65VSN.js +0 -7
  177. package/dist/preview/chunk.MUBZIU6F.js +0 -1
  178. package/dist/preview/chunk.MZ6I2Q4E.js +0 -1
  179. package/dist/preview/chunk.NTJNBKWC.js +0 -1
  180. package/dist/preview/chunk.OMCXJGDI.js +0 -1
  181. package/dist/preview/chunk.OTHGZPUC.js +0 -1
  182. package/dist/preview/chunk.P6FGIYWP.js +0 -35
  183. package/dist/preview/chunk.PYFQGBU3.js +0 -1
  184. package/dist/preview/chunk.RFCTUGMU.js +0 -1
  185. package/dist/preview/chunk.RR4RZH4S.js +0 -1
  186. package/dist/preview/chunk.S5K4FLLG.js +0 -1
  187. package/dist/preview/chunk.SZKVNPEF.js +0 -1
  188. package/dist/preview/chunk.T3F6BKIO.js +0 -1
  189. package/dist/preview/chunk.UG727PEE.js +0 -5
  190. package/dist/preview/chunk.VXZFW52D.js +0 -1
  191. package/dist/preview/chunk.VYPR2MZO.js +0 -1
  192. package/dist/preview/chunk.W77OH637.js +0 -1
  193. package/dist/preview/chunk.WODEO2JF.js +0 -9
  194. package/dist/preview/chunk.WZEA2UK6.js +0 -1
  195. package/dist/preview/chunk.X2M7IOQA.js +0 -1
  196. package/dist/preview/chunk.XPML6T3P.js +0 -1
  197. package/dist/preview/chunk.YJM23BJL.js +0 -88
  198. package/dist/preview/chunk.YLGSXLXF.js +0 -1
  199. package/dist/preview/chunk.YLI6I6XP.js +0 -1
  200. package/dist/preview/chunk.YRYEWVNP.js +0 -1
  201. package/dist/preview/chunk.Z2TYCMBT.js +0 -5
  202. package/dist/preview/chunk.ZAFIZXGX.js +0 -1
  203. package/dist/preview/chunk.ZBYLAC3B.js +0 -2
  204. package/dist/preview/chunk.ZOS5APMD.js +0 -1
@@ -1,2 +1,2 @@
1
- import{g as F,l as b}from"./chunk.VKJAGZNU.js";function L(t,o){return o===1&&["every","some","sum","min","max","sort"].includes(t.fn)}function M(t){let o=new Set,e=new Set,r=[],s=[],a=new Set(F),i=(l,f)=>{switch(l.t){case"lit":return;case"ident":f||o.add(l.name);return;case"list":l.items.forEach(c=>i(c,f));return;case"member":i(l.object,f);return;case"unary":i(l.operand,f);return;case"binary":i(l.left,f),i(l.right,f);return;case"where":i(l.set,f),i(l.filter,!0);return;case"call":{e.add(l.fn);let c=(l.fn==="out"||l.fn==="in")&&l.args.length===2?l.args[1]:l.args[0],m=c?.t==="lit"&&typeof c.value=="string"?c.value:void 0;l.fn==="all"&&m&&r.push(m),(l.fn==="out"||l.fn==="in")&&m&&s.push(m),l.args.forEach((v,k)=>i(v,f||L(l,k)));return}}};return i(t,!1),{names:o,functions:e,unknownFunctions:[...e].filter(l=>!a.has(l)),sweeps:r,edges:s}}var p=class extends Error{constructor(e,r,s){super(`${e} (at character ${r+1} of "${s}")`);this.sentence=e;this.at=r;this.source=s}},D=["||","&&","==","!=","<=",">=","<",">","!","|","&","+","-","*","/","%","(",")","[","]",",","."],j={and:"&&",or:"||",not:"!"},T=2e3;function H(t){let o=[],e=0;for(;e<t.length;){let r=t[e];if(r===" "||r===" "||r===`
1
+ import{g as F,l as b}from"./chunk.UG23RICT.js";function L(t,o){return o===1&&["every","some","sum","min","max","sort"].includes(t.fn)}function M(t){let o=new Set,e=new Set,r=[],s=[],a=new Set(F),i=(l,f)=>{switch(l.t){case"lit":return;case"ident":f||o.add(l.name);return;case"list":l.items.forEach(c=>i(c,f));return;case"member":i(l.object,f);return;case"unary":i(l.operand,f);return;case"binary":i(l.left,f),i(l.right,f);return;case"where":i(l.set,f),i(l.filter,!0);return;case"call":{e.add(l.fn);let c=(l.fn==="out"||l.fn==="in")&&l.args.length===2?l.args[1]:l.args[0],m=c?.t==="lit"&&typeof c.value=="string"?c.value:void 0;l.fn==="all"&&m&&r.push(m),(l.fn==="out"||l.fn==="in")&&m&&s.push(m),l.args.forEach((v,k)=>i(v,f||L(l,k)));return}}};return i(t,!1),{names:o,functions:e,unknownFunctions:[...e].filter(l=>!a.has(l)),sweeps:r,edges:s}}var p=class extends Error{constructor(e,r,s){super(`${e} (at character ${r+1} of "${s}")`);this.sentence=e;this.at=r;this.source=s}},D=["||","&&","==","!=","<=",">=","<",">","!","|","&","+","-","*","/","%","(",")","[","]",",","."],j={and:"&&",or:"||",not:"!"},T=2e3;function H(t){let o=[],e=0;for(;e<t.length;){let r=t[e];if(r===" "||r===" "||r===`
2
2
  `||r==="\r"){e++;continue}if(r>="0"&&r<="9"){let a=e;for(;e<t.length&&/[0-9.]/.test(t[e]);)e++;let i=t.slice(a,e),l=Number(i);if(!Number.isFinite(l)||i.split(".").length>2)throw new p(`"${i}" is not a number`,a,t);o.push({k:"num",v:l,at:a});continue}if(r==="'"||r==='"'){let a=e++,i="";for(;e<t.length&&t[e]!==r;)t[e]==="\\"&&e+1<t.length&&e++,i+=t[e++];if(e>=t.length)throw new p("a quoted word is never closed",a,t);e++,o.push({k:"str",v:i,at:a});continue}if(/[A-Za-z_]/.test(r)){let a=e;for(;e<t.length&&/[A-Za-z0-9_]/.test(t[e]);)e++;let i=t.slice(a,e),l=Object.hasOwn(j,i)?j[i]:void 0;o.push(l?{k:"op",v:l,at:a}:{k:"id",v:i,at:a});continue}let s=D.find(a=>t.startsWith(a,e));if(!s)throw new p(`"${r}" is not part of the rule language`,e,t);o.push({k:"op",v:s,at:e}),e+=s.length}return o.push({k:"end",at:t.length}),o}function w(t){if(t.length>T)throw new p(`an expression may be at most ${T} characters`,0,t.slice(0,40));let o=H(t),e=0,r=()=>o[e],s=n=>{let d=r();return d.k==="op"&&d.v===n},a=n=>{let d=r();return d.k==="id"&&d.v===n},i=(n,d)=>{if(!s(n))throw new p(`expected ${d}`,r().at,t);e++},l=0,f=(n,d)=>{if(++l>64)throw new p("the expression nests too deeply",n,t);try{return d()}finally{l--}},c=(n,d)=>()=>{let g=d();for(;;){let y=r(),S=y.k==="op"?n.find(q=>q===y.v):y.k==="id"&&y.v==="in"&&n.includes("in")?"in":void 0;if(!S)return g;e++,g={t:"binary",op:S,left:g,right:d(),at:y.at}}},m=()=>{let n=r();if(n.k==="num")return e++,{t:"lit",value:n.v,at:n.at};if(n.k==="str")return e++,{t:"lit",value:n.v,at:n.at};if(n.k==="id"){if(e++,n.v==="true"||n.v==="false")return{t:"lit",value:n.v==="true",at:n.at};if(n.v==="null")return{t:"lit",value:null,at:n.at};if(s("(")){e++;let d=[];if(!s(")"))for(;;){if(d.push(h()),s(",")){e++;continue}break}return i(")",`")" to close ${n.v}(\u2026)`),{t:"call",fn:n.v,args:d,at:n.at}}return{t:"ident",name:n.v,at:n.at}}if(n.k==="op"&&n.v==="("){e++;let d=f(n.at,h);return i(")",'a ")"'),d}if(n.k==="op"&&n.v==="["){e++;let d=[];if(!s("]"))for(;;){if(d.push(h()),s(",")){e++;continue}break}return i("]",'a "]" to close the list'),{t:"list",items:d,at:n.at}}throw n.k==="end"?new p("the expression ends too soon",n.at,t):new p(`"${n.k==="op"?n.v:""}" cannot start a value here`,n.at,t)},v=()=>{let n=m();for(;;){if(s(".")){let d=r();e++;let g=r();if(g.k!=="id")throw new p('expected a field name after "."',g.at,t);e++,n={t:"member",object:n,name:g.v,at:d.at};continue}if(a("where")){let d=r().at;e++,n={t:"where",set:n,filter:f(d,h),at:d};continue}return n}},k=()=>{let n=r();return n.k==="op"&&(n.v==="!"||n.v==="-")?(e++,{t:"unary",op:n.v,operand:f(n.at,k),at:n.at}):v()},P=c(["*","/","%"],k),z=c(["+","-"],P),N=c(["&"],z),R=c(["|"],N),_=()=>{let n=R(),d=r(),g=d.k==="op"&&["==","!=","<","<=",">",">="].includes(d.v)?d.v:d.k==="id"&&d.v==="in"?"in":void 0;return g?(e++,{t:"binary",op:g,left:n,right:R(),at:d.at}):n},O=()=>{let n=r();return n.k==="op"&&n.v==="!"?(e++,{t:"unary",op:"!",operand:f(n.at,O),at:n.at}):_()},B=c(["&&"],O),I=c(["||"],B);function h(){return I()}let K=h();if(r().k!=="end")throw new p("there is more after the end of the expression",r().at,t);return K}function E(t){let o,e=-1,r=0;for(let s=0;s<t.length;s++){let a=t[s];if(o){a==="\\"?s++:a===o&&(o=void 0);continue}a==="'"||a==='"'?o=a:a==="("||a==="["?r++:a===")"||a==="]"?r--:a==="|"&&r===0&&(t[s+1]==="|"?s++:e=s)}if(e>0&&t.slice(e+1).trim()===x){let s=E(t.slice(0,e));if(s>=0)return s}return e}var x="capital",$=/\s*(?:'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)")\s*(,|$)/y;function U(t){let o=E(t);if(o>=0){if(t.slice(o+1).trim()!==x)throw new u('only "capital" may follow another formatter, like {n | words | capital}');let e=t.slice(0,o);if(e.trim()===x)throw new u('"capital" is said once');return{...C(e),capital:!0}}return t.trim()===x?{args:[],capital:!0}:C(t)}function C(t){let o=t.indexOf(":"),e=(o>=0?t.slice(0,o):t).trim();if(!b.includes(e))throw new u(`"${e}" is not a formatter; use one of ${[...b,x].join(", ")}`);let r=[];if(o>=0&&e==="excerpt"){let s=t.slice(o+1).trim();if(!/^\d+$/.test(s)||Number(s)<20||Number(s)>1e3)throw new u("excerpt is told at most how many characters, 20 to 1000: {summary | excerpt: 80}");r.push(s)}else if(o>=0){let s=t.slice(o+1),a=0;for(;a<s.length;){$.lastIndex=a;let i=$.exec(s);if(!i)throw new u(`"${e}" is told quoted words, like ${e}: 'offer'`);if(r.push((i[1]??i[2]??"").replace(/\\(.)/g,"$1")),a=$.lastIndex,i[3]==="")break}}if(e==="plural"&&(r.length<1||r.length>2))throw new u("plural is told its noun, like {count | plural: 'offer'}, and its plural where English does not make it: plural: 'person', 'people'");if(e!=="plural"&&e!=="excerpt"&&r.length>0)throw new u(`"${e}" takes nothing after it`);return{format:e,args:r}}var u=class extends Error{constructor(e){super(e);this.sentence=e}};function Y(t){let o=[],e=0;for(;e<t.length;){let r=t.indexOf("{",e);if(r<0){o.push({text:t.slice(e)});break}r>e&&o.push({text:t.slice(e,r)});let s=t.indexOf("}",r);if(s<0)throw new u(`a "{" at character ${r+1} is never closed`);let a=t.slice(r+1,s),i=E(a),l=(i>=0?a.slice(0,i):a).trim(),f=i>=0?U(a.slice(i+1)):void 0,c=E(l);if(c>=0&&b.includes(l.slice(c+1).split(":")[0].trim()))throw new u('only "capital" may follow another formatter, like {n | words | capital}');o.push({expr:w(l),source:l,...f?.format?{format:f.format}:{},...f&&f.args.length>0?{formatArgs:f.args}:{},...f?.capital?{capital:!0}:{}}),e=s+1}return o}function A(t){let o=new Map;for(let[e,r]of Object.entries(t?.computed??{}))o.set(e,typeof r=="string"?{expr:r}:r);return o}function re(t){let o=A(t);if(o.size===0)return;let e=new Map;for(let[r,s]of o)try{e.set(r,w(s.expr))}catch(a){if(!(a instanceof p))throw a}return e}function Z(t,o,e=new Set){let r=A(t).get(o);if(!r||e.has(o))return!1;let s;try{s=w(r.expr)}catch{return!1}let a=M(s);if(a.edges.length>0||a.sweeps.length>0||[...a.functions].some(c=>c==="out"||c==="in"||c==="all"))return!1;let i=t.fields,l=c=>i instanceof Set?i.has(c):Object.hasOwn(i,c),f=new Set([...e,o]);return[...a.names].every(c=>l(c)||Z(t,c,f))}export{M as a,p as b,w as c,u as d,Y as e,A as f,re as g,Z as h};
@@ -0,0 +1 @@
1
+ import{b as y}from"./chunk.HKD5SR45.js";import"./chunk.FNXW46U4.js";import{G as w,R as c}from"./chunk.4JWT6LIS.js";import"./chunk.SDO3U72B.js";import"./chunk.AW2T3KFV.js";import"./chunk.2AZTW66C.js";import{b as l}from"./chunk.AJZBJBMO.js";var r=l(w(),1);var t=l(c(),1);function x({field:d,label:p,value:m,markdown:b,onSave:n,onCancel:u}){let[a,v]=(0,r.useState)(m),[i,h]=(0,r.useState)(!1),o=(0,r.useRef)(null);return(0,r.useEffect)(()=>o.current?.focus(),[i]),(0,r.useLayoutEffect)(()=>{let e=o.current;if(!e||i||typeof CSS<"u"&&CSS.supports?.("field-sizing","content"))return;let f=()=>{e.style.height="auto";let g=getComputedStyle(e);e.style.height=`${e.scrollHeight+parseFloat(g.borderTopWidth)+parseFloat(g.borderBottomWidth)}px`};f();let S=requestAnimationFrame(f);return()=>cancelAnimationFrame(S)},[a,i]),(0,t.jsxs)("form",{style:{display:"grid",gap:8,minWidth:0},onSubmit:e=>{e.preventDefault(),n(a,!1)},children:[i?(0,t.jsx)("div",{"data-graview-preview":d,"aria-label":`${p}, as it will read`,role:"region",style:C,children:(0,t.jsx)(y,{text:a,markdown:!0})}):(0,t.jsx)("textarea",{ref:o,"aria-label":p,"data-graview-field":d,value:a,rows:3,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key==="Escape"?(e.preventDefault(),u()):e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),n(a,!1))},onBlur:e=>{e.relatedTarget instanceof Node&&e.currentTarget.form?.contains(e.relatedTarget)||n(a,!0)},style:E}),(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,t.jsx)("button",{type:"submit",style:s,children:"Save"}),(0,t.jsx)("button",{type:"button",onClick:u,style:s,children:"Cancel"}),b?(0,t.jsx)("button",{type:"button","aria-pressed":i,onClick:()=>h(!i),style:s,children:i?"Write":"Preview"}):null,(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"Ctrl or \u2318 Enter saves \xB7 Esc puts it back"})]})]})}var C={minHeight:"7.5em",padding:"8px 10px",border:"1px dashed var(--graview-edge-bright)",borderRadius:6,lineHeight:1.6,minWidth:0},s={font:"inherit",fontSize:"0.8125rem",minHeight:28,padding:"2px 12px"},E={font:"inherit",lineHeight:1.5,width:"100%",boxSizing:"border-box",minHeight:"7.5em",padding:"8px 10px",resize:"vertical",fieldSizing:"content",color:"var(--graview-ink)",background:"var(--graview-panel, transparent)",border:"1px solid var(--graview-edge-bright)",borderRadius:6};export{x as default};
@@ -1 +1 @@
1
- import{H as $}from"./chunk.4QEDYRES.js";import{Aa as U,G as L,a as I,b as R,c as E,d as f,e as k,j as W,m as F,v as j}from"./chunk.JE4QQEJE.js";import{ld as s,rd as b,sd as r}from"./chunk.UG727PEE.js";import{b as H}from"./chunk.AJZBJBMO.js";var u=H(L(),1),_=e=>typeof e=="object"&&e!==null&&"idx"in e;function S(e){let n=r(window.location.pathname,e);return n===null?null:n!==s&&n!=="/"?"pages":n===s||window.location.href.includes("#")?f(window.location.hash).overview?"graview":"scene":_(window.history.state)?"pages":null}function K(e){let n=e.face??(e.stop&&E(e.stop).overview?"graview":"scene");return e.routing!=="address"||typeof window>"u"?n:S(e.basePath)??n}function Q(e){return e.routing!=="address"||typeof window>"u"?!1:r(window.location.pathname,e.basePath)==="/"&&S(e.basePath)===null}function X(e){if(typeof window>"u")return;let n=r(window.location.pathname,e);return n===s||n==="/"&&window.location.href.includes("#")?R(f(window.location.hash)):void 0}function Z({basePath:e,pagesWere:n,shown:t,onFace:i,toggle:l,kinds:N,places:w,opens:B,landed:V}){let{view:O,go:p}=U(),g=(0,u.useRef)({shown:t,view:O,onFace:i,landed:V});g.current={shown:t,view:O,onFace:i,landed:V};let m=(0,u.useRef)(n??"/"),P=()=>{m.current=`${r(window.location.pathname,e)??"/"}${window.location.search}`};return l.current=(o,c,a)=>{let{shown:d,view:h,onFace:A}=g.current;if(o==="pages"&&d!=="pages")window.history.pushState(null,"",b(c??m.current,{basePath:e}));else if(o!=="pages"&&d==="pages"){P();let y=a===void 0?h:M(E(a),w),v=q(y)?z(B):y,T=v!==y&&v.overview?"graview":o,x=Y(T,v,N);p(x),window.history.pushState(null,"",`${b(s,{basePath:e})}${k(x)}`),A?.(T);return}A?.(o)},(0,u.useEffect)(()=>{let o=()=>{if(r(window.location.pathname,e)===null)return;let c=S(e)??"pages",{shown:a,onFace:d,landed:h}=g.current;if(c==="pages"){P(),h?.(m.current),a!=="pages"&&d?.("pages");return}a==="pages"&&(p(M(f(window.location.hash),w)),d?.(c))};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[e,p,w]),null}function M(e,n){let t=e.within?.view,i=t!==void 0&&!e.focusId?n.find(l=>l.as===t):void 0;return i?{...e,focusId:j(i.kind)}:e}function Y(e,n,t){return e==="graview"?F(n,!0):n.overview?W(F(n,!1),$(n,t)):n}function q(e){return e.focusId===null&&e.overview!==!0}function z(e){return e??{...I,overview:!0}}export{K as a,Q as b,X as c,Z as d,M as e,Y as f,q as g,z as h};
1
+ import{H as $}from"./chunk.FNXW46U4.js";import{Aa as U,G as L,a as I,b as R,c as E,d as f,e as k,j as W,m as F,v as j}from"./chunk.4JWT6LIS.js";import{ld as s,sd as b,td as r}from"./chunk.AW2T3KFV.js";import{b as H}from"./chunk.AJZBJBMO.js";var u=H(L(),1),_=e=>typeof e=="object"&&e!==null&&"idx"in e;function S(e){let n=r(window.location.pathname,e);return n===null?null:n!==s&&n!=="/"?"pages":n===s||window.location.href.includes("#")?f(window.location.hash).overview?"graview":"scene":_(window.history.state)?"pages":null}function K(e){let n=e.face??(e.stop&&E(e.stop).overview?"graview":"scene");return e.routing!=="address"||typeof window>"u"?n:S(e.basePath)??n}function Q(e){return e.routing!=="address"||typeof window>"u"?!1:r(window.location.pathname,e.basePath)==="/"&&S(e.basePath)===null}function X(e){if(typeof window>"u")return;let n=r(window.location.pathname,e);return n===s||n==="/"&&window.location.href.includes("#")?R(f(window.location.hash)):void 0}function Z({basePath:e,pagesWere:n,shown:t,onFace:i,toggle:l,kinds:N,places:w,opens:B,landed:V}){let{view:O,go:p}=U(),g=(0,u.useRef)({shown:t,view:O,onFace:i,landed:V});g.current={shown:t,view:O,onFace:i,landed:V};let m=(0,u.useRef)(n??"/"),P=()=>{m.current=`${r(window.location.pathname,e)??"/"}${window.location.search}`};return l.current=(o,c,a)=>{let{shown:d,view:h,onFace:A}=g.current;if(o==="pages"&&d!=="pages")window.history.pushState(null,"",b(c??m.current,{basePath:e}));else if(o!=="pages"&&d==="pages"){P();let y=a===void 0?h:M(E(a),w),v=q(y)?z(B):y,T=v!==y&&v.overview?"graview":o,x=Y(T,v,N);p(x),window.history.pushState(null,"",`${b(s,{basePath:e})}${k(x)}`),A?.(T);return}A?.(o)},(0,u.useEffect)(()=>{let o=()=>{if(r(window.location.pathname,e)===null)return;let c=S(e)??"pages",{shown:a,onFace:d,landed:h}=g.current;if(c==="pages"){P(),h?.(m.current),a!=="pages"&&d?.("pages");return}a==="pages"&&(p(M(f(window.location.hash),w)),d?.(c))};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[e,p,w]),null}function M(e,n){let t=e.within?.view,i=t!==void 0&&!e.focusId?n.find(l=>l.as===t):void 0;return i?{...e,focusId:j(i.kind)}:e}function Y(e,n,t){return e==="graview"?F(n,!0):n.overview?W(F(n,!1),$(n,t)):n}function q(e){return e.focusId===null&&e.overview!==!0}function z(e){return e??{...I,overview:!0}}export{K as a,Q as b,X as c,Z as d,M as e,Y as f,q as g,z as h};
@@ -0,0 +1 @@
1
+ import{a as j,b as H}from"./chunk.7JVBVB4A.js";import{a as z,b as J,c as D}from"./chunk.IQ3LUSD6.js";import{a as K,e as q}from"./chunk.F4DWRBO7.js";import{e as E,f as N,g as $}from"./chunk.RVQYXPCM.js";import"./chunk.EJOTTZWZ.js";import{$ as b,G as B,M as F,O as P,R as A,ga as v,ja as V,ka as T,wa as G}from"./chunk.4JWT6LIS.js";import"./chunk.SDO3U72B.js";import"./chunk.AW2T3KFV.js";import"./chunk.2AZTW66C.js";import{b as W}from"./chunk.AJZBJBMO.js";var s=W(B(),1);var i=W(A(),1),_=e=>({...e.node?{node:{id:e.node.id}}:{},...e.nodes?{nodes:e.nodes.map(t=>({id:t.id}))}:{},...e.label!==void 0?{label:e.label}:{},fidelity:e.fidelity,cardinality:e.cardinality,mode:e.mode,selected:e.selected,...e.implicated?{implicated:e.implicated}:{},...e.flagged?{flagged:e.flagged}:{}});function I(e){let t=P(),r=t?.past?.seq,a=t?.host?.viewAt,n=(0,s.useMemo)(()=>r===void 0||!a||e.draft?void 0:a(e.manifest.name,r),[a,r,e]);return(0,s.useMemo)(()=>n===null?null:n===void 0?e:{...e,worker:n},[n,e])}function M({definition:e,store:t,principal:r,input:a,goTo:n,places:o,scheme:l,brand:u,onFailure:d,drawsItsOwn:m,tick:f}){let p=(0,s.useRef)(null),w=(0,s.useRef)(null),y=F(),c=(0,s.useRef)({input:a,goTo:n,places:o,onFailure:d,brand:u,hostFiles:y});c.current={input:a,goTo:n,places:o,onFailure:d,brand:u,hostFiles:y},(0,s.useEffect)(()=>{let S=p.current;if(!S)return;let C=e.file??(c.current.hostFiles?.src?g=>c.current.hostFiles?.src?.(g)??g:void 0);typeof e.worker=="function"&&D(e.worker).catch(()=>{});let L=H(j,({mountWorkerView:g})=>{w.current=g(S,{manifest:e.manifest,worker:e.worker,store:t,principal:r,input:()=>c.current.input?.()??{},goTo:()=>c.current.goTo,places:()=>c.current.places?.()??[],brand:()=>c.current.brand,onFailure:(O,R)=>c.current.onFailure(O,R),...m?{fallback:!1}:{},...e.limits?{limits:e.limits}:{},...e.author?{author:e.author}:{},...e.onProblem?{onProblem:e.onProblem}:{},...e.asset?{asset:e.asset}:{},...C?{file:C}:{},...e.images?{images:e.images}:{},files:()=>c.current.hostFiles})});return()=>{L(),w.current?.dispose(),w.current=null}},[e,t,r]),(0,s.useEffect)(()=>w.current?.update(),[l,u,f]);let k=(0,i.jsx)("div",{ref:p,"data-worker-view-place":e.manifest.name});if(!e.draft)return k;let h=e.manifest.title??e.manifest.name;return(0,i.jsxs)("div",{role:"group","aria-label":`Draft: ${h}`,"data-graview-draft-view":e.manifest.name,style:{display:"grid",gap:8,alignContent:"start",minWidth:0},children:[(0,i.jsxs)("p",{"data-testid":"draft-view-line",style:Q,children:[(0,i.jsxs)("span",{children:["Draft \u2014 ",(0,i.jsx)("span",{style:{color:"var(--graview-ink)",fontWeight:600},children:h})]}),(0,i.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,i.jsx)("span",{children:"Not kept"})]}),k]})}var Q={margin:0,display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 8px",fontSize:"0.875rem",color:"var(--graview-ink-muted)",borderBottom:"1px solid var(--graview-edge)",paddingBottom:8};function x(e,t={}){let r=t.fallback,a=e.manifest.replaces==="page";function n(o){let l=b(),u=v(),d=(0,s.useContext)(G),[m,f]=(0,s.useState)(null),p=(0,s.useRef)(o);p.current=o;let w=I(e);if(!l)return null;if(w===null)return r&&!(d&&V(r)&&!a)?(0,i.jsx)(r,{...o}):null;if(m&&r)return d&&V(r)&&!a?null:(0,i.jsx)(r,{...o});let y=t.beside&&!(d&&V(t.beside))?t.beside:void 0,c=(0,i.jsx)(M,{definition:w,store:l.store,principal:l.principal,input:()=>_(p.current),goTo:u,places:()=>l.views.places(),scheme:l.scheme,brand:l.brand,tick:o,drawsItsOwn:r!==void 0,onFailure:(k,h)=>{f(k),e.onFailure?.(k,h)}});return y?(0,i.jsxs)("div",{"data-worker-view-beside":e.manifest.name,style:{display:"grid",gap:12,minWidth:0},children:[c,(0,i.jsx)(y,{...o})]}):c}return n.displayName=`WorkerView(${e.manifest.name})`,n}function U(e,t){let{manifest:r}=t;if(r.attach==="home"){if(!e.home)throw new Error(`The worker view "${r.name}" is the home's body: draw it with workerHome, on the home.`);let d=t.draft?void 0:e.homeView?.();return e.home(x(t,d?{fallback:d}:{})),e}let a={cardinality:r.cardinality,fidelity:"full"},n=e.lookup(r.attach,a)??e.resolve(r.attach,a)?.view,o=r.cardinality==="one",l=t.draft===!0,u=x(t,{...n&&!l?{fallback:n}:{},...o&&r.replaces!=="page"&&n?{beside:n}:{}});return e.register(r.attach,a,o&&r.replaces==="page"?T(u):u,r.title?{title:r.title,...l?{}:{name:r.name},lens:"view",...r.reads?.kinds?.length?{reads:r.reads.kinds}:{}}:void 0),e}function X(e,t={}){let r=t.fallback;function a({context:n}){let o=b(),l=v(),[u,d]=(0,s.useState)(null),m=I(e);return(u||m===null)&&r?(0,i.jsx)(r,{context:n}):m===null?null:(0,i.jsx)(M,{definition:m,store:n.store,principal:n.principal??o?.principal??{kind:"human"},goTo:l,...o?{places:()=>o.views.places(),scheme:o.scheme,brand:o.brand}:{},drawsItsOwn:r!==void 0,onFailure:(f,p)=>{d(f),e.onFailure?.(f,p)}})}return a.displayName=`WorkerHome(${e.manifest.name})`,a}export{N as checkManifest,z as checkViewSource,q as judgeCodeAct,E as manifestActs,U as registerWorkerView,K as sightIsTotal,J as viewScript,X as workerHome,x as workerView,$ as workerViewProps};
@@ -0,0 +1 @@
1
+ import{h as n}from"./chunk.LUPBT6YM.js";import"./chunk.IBWPRK2R.js";import"./chunk.RNUGQRJI.js";import"./chunk.6NFR2LYQ.js";import"./chunk.U3CV5CCL.js";import"./chunk.LKF4BBCW.js";import"./chunk.NPS2WN7T.js";import"./chunk.JUT2VCFW.js";import"./chunk.HKD5SR45.js";import"./chunk.7UV7ODXU.js";import"./chunk.IIB22IIP.js";import"./chunk.MWUP5X47.js";import"./chunk.WVUJXDXZ.js";import{e as p}from"./chunk.ESU2DD3J.js";import"./chunk.PL2P2OON.js";import"./chunk.27ZVVPRZ.js";import"./chunk.IN4PKQO5.js";import"./chunk.3IUJ4GW7.js";import"./chunk.UG23RICT.js";import"./chunk.GZHZLJBF.js";import"./chunk.ATKKTPJS.js";import"./chunk.OJGHDWI6.js";import"./chunk.UZSZPMRC.js";import"./chunk.MZOIPCDA.js";import"./chunk.KERLVJ6I.js";import"./chunk.4EPT2CQG.js";import"./chunk.FNXW46U4.js";import{R as m}from"./chunk.4JWT6LIS.js";import"./chunk.SDO3U72B.js";import"./chunk.AW2T3KFV.js";import"./chunk.2AZTW66C.js";import{b as t}from"./chunk.AJZBJBMO.js";var i=t(m(),1),a=new WeakMap;function s(o){let e=a.get(o);if(!e){let r=p(o);e=c=>c.mode==="fullscreen"?(0,i.jsx)(n,{blocks:r,slot:"home",heading:2,firstHeading:1}):(0,i.jsx)(n,{blocks:r,slot:"home",heading:3,firstHeading:2}),a.set(o,e)}return e}export{s as homeView};
@@ -1 +1 @@
1
- import{a as f}from"./chunk.HAY22FPJ.js";import{ca as d}from"./chunk.UG727PEE.js";function w(n){let o=n.indexOf("{"),r=n.indexOf("["),t=r!==-1&&(o===-1||r<o)?r:o;if(t===-1)return;let e=n[t],a=e==="["?"]":"}",i=0,c=!1,l=!1;for(let s=t;s<n.length;s++){let u=n[s];if(c){l?l=!1:u==="\\"?l=!0:u==='"'&&(c=!1);continue}if(u==='"')c=!0;else if(u===e)i+=1;else if(u===a&&(i-=1,i===0))try{return JSON.parse(n.slice(t,s+1))}catch{return}}}function v(n,o){let r;try{r=n.mutation(o.mutation)}catch{return o}let t={...o.args},e=!1;for(let a of f(r.input)){if(a.control!=="node")continue;let i=t[a.name];if(typeof i!="string"||i.length===0||n.graph.getNode(i))continue;let c=i.trim().toLowerCase(),l=[...n.graph.allNodes()].filter(s=>(a.kinds.includes("*")||a.kinds.includes(s.kind))&&d(n.schema.tryDefinition(s.kind),s).trim().toLowerCase()===c);l.length===1&&(t[a.name]=l[0].id,e=!0)}return e?{...o,args:t}:o}function P(n,o,r){let t=r===void 0?null:new Set(r),e=[];for(let a of o){if(typeof a.mutation!="string")continue;let i=!0;try{n.mutation(a.mutation)}catch{i=!1}i?t&&!t.has(a.mutation)&&e.push({proposal:a,why:"not-allowed"}):e.push({proposal:a,why:"unknown"})}return e}function x(n,o,r){let t=r===void 0?null:new Set(r);return o.filter(e=>{if(typeof e.mutation!="string"||t&&!t.has(e.mutation))return!1;try{n.mutation(e.mutation)}catch{return!1}return e.args!==null&&typeof e.args=="object"})}export{w as a,v as b,P as c,x as d};
1
+ import{a as f}from"./chunk.WE5SA6TP.js";import{ca as d}from"./chunk.AW2T3KFV.js";function w(n){let o=n.indexOf("{"),r=n.indexOf("["),t=r!==-1&&(o===-1||r<o)?r:o;if(t===-1)return;let e=n[t],a=e==="["?"]":"}",i=0,c=!1,l=!1;for(let s=t;s<n.length;s++){let u=n[s];if(c){l?l=!1:u==="\\"?l=!0:u==='"'&&(c=!1);continue}if(u==='"')c=!0;else if(u===e)i+=1;else if(u===a&&(i-=1,i===0))try{return JSON.parse(n.slice(t,s+1))}catch{return}}}function v(n,o){let r;try{r=n.mutation(o.mutation)}catch{return o}let t={...o.args},e=!1;for(let a of f(r.input)){if(a.control!=="node")continue;let i=t[a.name];if(typeof i!="string"||i.length===0||n.graph.getNode(i))continue;let c=i.trim().toLowerCase(),l=[...n.graph.allNodes()].filter(s=>(a.kinds.includes("*")||a.kinds.includes(s.kind))&&d(n.schema.tryDefinition(s.kind),s).trim().toLowerCase()===c);l.length===1&&(t[a.name]=l[0].id,e=!0)}return e?{...o,args:t}:o}function P(n,o,r){let t=r===void 0?null:new Set(r),e=[];for(let a of o){if(typeof a.mutation!="string")continue;let i=!0;try{n.mutation(a.mutation)}catch{i=!1}i?t&&!t.has(a.mutation)&&e.push({proposal:a,why:"not-allowed"}):e.push({proposal:a,why:"unknown"})}return e}function x(n,o,r){let t=r===void 0?null:new Set(r);return o.filter(e=>{if(typeof e.mutation!="string"||t&&!t.has(e.mutation))return!1;try{n.mutation(e.mutation)}catch{return!1}return e.args!==null&&typeof e.args=="object"})}export{w as a,v as b,P as c,x as d};
@@ -1 +1 @@
1
- import{a as we,b as De,c as Ke,d as le,e as A,f as Me,h as Te}from"./chunk.X5WIS4BC.js";import{h as Ge,i as Ce,j as Ne}from"./chunk.XDPIS7RS.js";import{a as oe,b as se,c as Y,d as Pe,e as J,g as ee,h as _e}from"./chunk.J7ZMNAWB.js";import{c as Ae,h as z,i as Fe,j as de}from"./chunk.VKJAGZNU.js";import{A as ve,Ga as Ee,Ha as Q,Ia as ae,Lb as ce,Mb as Re,b as L,c as V,e as Se,f as je,g as _,h as S,k as G,l as H,m as C,n as Oe,o as B,p as D,r as $,s as X,t as E,u as R,v as q,w as T,x as e,y as K,z as U,za as xe}from"./chunk.UG727PEE.js";var on=n=>Object.entries(n).map(([s,r])=>[s,Object.keys(Q(r?.edges))]),pe=(n,s)=>Re(n,on(s));var me="graview-document",ge=1,ze=256*1024,ne=64*1024,fe=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ue=/^[a-z][A-Za-z0-9]*$/,sn=new Set(["id","kind"]),rn=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,an=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"];function cn(){let n=k=>k in Object.prototype,s=U(k=>!n(k),"every object already has this name \u2014 choose another"),r=(k,N)=>[...k===void 0?[]:[je(k)],...N===void 0?[]:[Se(N)]],t=(k,N)=>S().check(...r(k,N)),a=(k,N,tn)=>D(k).check(...r(N,tn)),l=k=>S().check(_(fe,`${k} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),u=S().check(_(rn,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),s),m=S().check(_(ue,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),U(k=>!sn.has(k),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),s),y=t(1,500),i=t(1,2e3),o=t(1,300),p=$({type:q(an),required:e(C()),description:e(y),label:e(t(1,60)),options:e(a(t(1,80),1,100)),of:e(q(["string","number","date","image","video","file"])),default:e(B()),unit:e(t(void 0,12)),format:e(q(["money","percent","duration","markdown"])),min:e(G()),max:e(G()),step:e(G()),renamedFrom:e(S().check(_(ue))),repeats:e(C())}).check(ve((k,N)=>{k.type==="enum"&&!k.options&&N.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),k.type!=="enum"&&k.options&&N.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]}),k.type!=="list"&&k.of&&N.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),k.repeats&&k.type!=="date"&&k.type!=="datetime"&&N.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),w=S().check(_(new RegExp(`${fe.source}|${xe.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),f=$({to:E([a(w,1),T("*")]),cardinality:e(q(["one","many"])),description:e(y),inverse:e(t(1,80)),appendOnly:e(C()),renamedFrom:e(S()),tidying:e(T("never"))}),d=E([i,$({expr:i,label:e(t(1,60)),description:e(y)})]),c=$({noun:e(t(1,40)),plural:e(t(1,40)),description:e(y),fields:R(m,p).check(U(k=>Object.keys(k).length>0,"a kind has at least one field")),label:e(o),describe:e(o),lifecycle:e($({field:m,retired:a(E([S(),G(),C()]),1)})),figure:e(t(void 0,2e4)),glance:e(a(m,1,20)),page:e($({fields:e(a(m,1,40)),groups:e(a($({title:t(1,60),fields:a(m,1,40)}),1,12))})),edges:e(R(u,f)),computed:e(R(S(),d).check(U(k=>Object.keys(k).length<=20,"a kind works out at most 20 computed fields"))),fieldRoles:e(R(S(),S())),renamedFrom:e(S().check(_(fe))),people:e(C()),archives:e(T(!1)),tidying:e(q(["never","no-links"]))}),O=E([S(),G(),C(),Oe(),D(B()),$({expr:i})]),h=S().check(_(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),j=E([$({create:l("kind"),as:e(S().check(_(ue))),set:e(R(m,O))}),$({set:R(m,O),target:e(h)}),$({connect:u,from:h,to:h}),$({sever:u,from:h,to:h}),$({remove:h})]),v=$({title:e(t(1,80)),description:e(y),fromTheOtherEnd:e(t(1,80)),on:e(E([l("kind"),a(l("kind"),1)])),creates:e(l("kind")),sets:e(R(m,O)),writes:e(a(m,1)),connects:e(u),severs:e(u),setsOther:e(R(m,O)),replaces:e(E([T(!0),a(u,1,10)])),removes:e(T(!0)),args:e(R(m,p)),effects:e(a(j,1,20)),allowedWhen:e(i),refusal:e(o),destructive:e(C())}),b=$({act:l("act"),label:e(t(1,80)),args:e(R(S(),O))}),W=$({title:e(t(1,120)),description:e(y),over:E([T("graph"),l("kind")]),when:e(i),require:i,says:e(o),repairs:e(a(b,void 0,10))}),P=$({roles:E([a(l("role"),1),T("*")]),mutations:E([a(l("act"),1),T("*")]),kinds:e(E([D(l("kind")),T("*")])),describe:e(y),self:e(C()),ownEnd:e(C())}),g=e(a(l("field"),1)),x=$({roles:E([a(l("role"),1),T("*")]),kinds:a(l("kind"),1),own:e(C()),via:e(u),fields:g,hide:g}),F=$({grants:D(P),sees:e(D(x))}),te=$({accent:e(S().check(_(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),name:e(t(1,60)),currency:e(S().check(_(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:e(t(2,35)),timeZone:e(t(1,64)),logo:e(E([t(1,ne),$({src:t(1,ne),alt:e(t(1,120))}),$({light:t(1,ne),dark:e(t(1,ne)),alt:e(t(1,120)),darkFallback:e(T("invert"))})])),favicon:e(E([t(1,ne),$({emoji:S()})])),typography:e($({display:e(t(1,200)),body:e(t(1,200)),mono:e(t(1,200))})),shape:e($({radius:e(G().check(V(0),L(32))),density:e(G().check(V(.75),L(1.5)))})),accents:e(R(S(),G().check(V(0),L(360)))),scheme:e(q(["light","dark","auto"]))}),I=R(S(),B()),Z=E([t(1,120),$({by:t(1,120),direction:e(q(["asc","desc"]))})]),ke=G().check(H(),V(1),L(9999)),He=X({create:e(C()),options:e(X({sort:e(Z),columnSort:e(Z),search:e(a(t(1,120),void 0,40)),filters:e(a(t(1,120),void 0,40)),horizon:e(E([G().check(H(),V(1),L(200)),X({years:G().check(H(),V(1),L(200)),title:t(1,80),from:e(ke),to:e(ke)})]))}))}),Xe=$({card:e(D(B())),row:e(D(B())),page:e(D(B()))}),Qe=()=>{let k=e(q(["asc","desc"]));return E([t(1,120),$({by:t(1,120),direction:k,then:e(E([t(1,120),$({by:t(1,120),direction:k})]))})])},en=()=>E([t(1,120),$({by:t(1,120),order:e(a(t(1,80),void 0,40)),closed:e(a(t(1,80),void 0,40))})]),$e=X({order:e(D(S())),hide:e(D(S())),first:e(S()),primary:e(a(t(1,80),void 0,40)),scene:e(t(1,40)),pages:e(t(1,40)),lists:e(R(S(),$({filters:e(a(t(1,120),void 0,40)),sort:e(Qe()),group:e(en())})))}),nn=$({$schema:e(S()),format:T(me),formatVersion:T(ge),name:t(1,80),description:e(y),version:e(G().check(H(),V(1))),kinds:R(l("kind"),c).check(U(k=>Object.keys(k).length>0,"a document declares at least one kind"),U(k=>Object.keys(k).length<=40,"a document declares at most 40 kinds")),computed:e(R(S(),d)),acts:e(R(l("act"),v)),rules:e(R(l("rule"),W)),roles:e(D(l("role"))),policy:e(F),modules:e(I),lenses:e(D(He)),pages:e($e),views:e(R(S(),E([Xe,D(B())]))),brand:e(te),settings:e(D(I)),migrations:e(D(I)),connections:e(R(l("connection"),I))});return{FieldSpec:p,EdgeSpec:f,ComputedSpec:d,KindSpec:c,ValueSpec:O,EffectSpec:j,ActSpec:v,RepairSpec:b,RuleSpec:W,GrantSpec:P,SightSpec:x,PolicySpec:F,BrandSpec:te,PagesSpec:$e,DocumentSpec:nn}}var dn,M=()=>dn??=cn(),Sn=K(()=>M().FieldSpec),jn=K(()=>M().EdgeSpec),On=K(()=>M().ComputedSpec),vn=K(()=>M().KindSpec),xn=K(()=>M().ValueSpec),En=K(()=>M().EffectSpec),Rn=K(()=>M().ActSpec),An=K(()=>M().RepairSpec),Fn=K(()=>M().RuleSpec),Dn=K(()=>M().GrantSpec),Kn=K(()=>M().SightSpec),Mn=K(()=>M().PolicySpec),Tn=K(()=>M().BrandSpec),Pn=K(()=>M().PagesSpec),Ie=K(()=>M().DocumentSpec);var ln={};function qe(n,s=ln,r=ge){let{document:t,respelled:a}=we(n),l=a.length>0?{respelled:a}:{};if(!t||typeof t!="object"||Array.isArray(t))return{document:t};let u=t;if(u.format!==me||typeof u.formatVersion!="number"||u.formatVersion>=r)return{document:t,...l};let m=u.formatVersion,y=structuredClone(u);for(let i=m;i<r;i++){let o=s[i];if(!o)throw new Error(`there is no upgrade from format ${i} to ${i+1}`);y={...o(y),formatVersion:i+1}}return{document:y,from:m,...l}}function Ve(n,s,r){let t=Object.keys(n).filter(m=>n[m].edges?.[s]!==void 0);if(t.length===0)return;let a=t.map(m=>n[m].edges[s].to),l=a.some(m=>m==="*")?"*":[...new Set(a.flatMap(m=>m))];if(r.length===0||r.some(m=>t.includes(m)))return{reversed:!1,kinds:l};let u=t.filter(m=>{let y=n[m].edges[s].to;return y==="*"||r.every(i=>y.includes(i))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:l}}var Ue=(n,s)=>{let r=n?.fields[s];return r!==void 0&&(r.type==="duration"||(r.type==="number"||r.type==="integer")&&r.format==="duration")};function Be(n,s,r,t){if(t==="out"){let a=n[s]?.edges?.[r]?.to;return a===void 0?[]:a==="*"?Object.keys(n):a}return Object.entries(n).filter(([,a])=>{let l=a.edges?.[r]?.to;return l!==void 0&&(l==="*"||l.includes(s))}).map(([a])=>a)}function he(n,s,r){if(r.t==="ident")return n[s]?.edges?.[r.name]?Be(n,s,r.name,"out"):void 0;if(r.t==="where")return he(n,s,r.set);if(r.t==="call"&&(r.fn==="out"||r.fn==="in")&&r.args[0]?.t==="lit"&&typeof r.args[0].value=="string")return Be(n,s,r.args[0].value,r.fn)}var Le=(n,s,r)=>{let t=s.filter(a=>n[a]?.fields[r]!==void 0);return t.length>0&&t.every(a=>Ue(n[a],r))};function We(n,s,r){let t=n.kinds,a=t[s],l=new Map(r),u=new Map,m=(i,o)=>{if(o>8)return!1;switch(i.t){case"ident":return Ue(a,i.name)||y(i.name,o+1);case"member":{let p=he(t,s,i.object);return p!==void 0&&Le(t,p,i.name)}case"call":{if(i.fn!=="sum"&&i.fn!=="min"&&i.fn!=="max")return!1;let[p,w]=i.args,f=p&&he(t,s,p);return f!==void 0&&w?.t==="ident"&&Le(t,f,w.name)}case"binary":return(i.op==="+"||i.op==="-")&&m(i.left,o)&&m(i.right,o);case"unary":return i.op==="-"&&m(i.operand,o);default:return!1}},y=(i,o)=>{if(a?.computed?.[i]===void 0)return!1;if(u.has(i))return u.get(i);u.set(i,!1);let p=l.get(i),w=p!==void 0&&m(p,o);return u.set(i,w),w};return r.map(([i])=>i).filter(i=>y(i,0))}function Ze(n,s,r=`kinds.${n}.page`){let t=s.page;if(!t)return[];let a=[],l=[...Object.keys(s.fields),...Object.keys(s.computed??{})],u=new Set,m=(i,o)=>{l.includes(i)?u.has(i)&&a.push(z("page-field-twice",o,`"${i}" is on ${n}'s page twice; name each field once`)):a.push(z("page-field",o,`${n}'s page is to show "${i}", and ${n} has no field or computed field called that`,`use one of: ${l.join(", ")}`)),u.add(i)};(t.fields??[]).forEach((i,o)=>m(i,`${r}.fields.${o}`));let y=new Set;return(t.groups??[]).forEach((i,o)=>{let p=i.title.trim().toLowerCase();y.has(p)&&a.push(z("page-group-twice",`${r}.groups.${o}.title`,`${n}'s page has two groups called "${i.title}"; give each its own title`)),y.add(p),i.fields.forEach((w,f)=>m(w,`${r}.groups.${o}.fields.${f}`))}),a}var pn=new Set(["subject","now","today","me"]);function fn(n){if((typeof n=="string"?n:JSON.stringify(n??null)).length>ze)return{findings:[z("too-large","",`a document may be at most ${ze/1024} KB`)]};if(typeof n=="string")try{n=JSON.parse(n)}catch(t){return{findings:[z("not-json","",`this is not JSON: ${t.message}`)]}}try{n=qe(n).document}catch(t){return{findings:[z("format","formatVersion",t.message)]}}let s=Ie.safeParse(n);if(!s.success)return{findings:s.error.issues.map(t=>{let a=t.path.map(String).join(".");if(t.code==="unrecognized_keys")return z("unknown-key",a,`${t.keys.map(l=>`"${l}"`).join(", ")} ${t.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(t.code==="invalid_union"&&/\.effects\.\d+$/.test(a))return z("effect-shape",a,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(t.code==="invalid_key"){let l=t.issues?.[0]?.message;return z("shape",a,`the name "${String(t.path.at(-1))}" is not allowed here${l?`: ${l}`:""}`)}return z("shape",a,t.message)})};let r=s.data;return{document:r,findings:un(r)}}var re=n=>[n??[]].flat();function Ye(n){let s=new Map;for(let[r,t]of Object.entries(n.kinds))for(let[a,l]of Object.entries(Q(t.edges))){let u=s.get(a);s.set(a,{name:a,from:[...u?.from??[],r],to:l.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...l.to])],cardinality:l.cardinality??"many"})}return s}function lt(n){let s=new Map;for(let[t,a]of Object.entries(n.kinds)){let l=ee(a),u=ae(a.edges);s.set(t,{fields:new Set([...Object.keys(a.fields),...u.keys()]),edges:new Map(Object.entries(Q(a.edges)).map(([m,y])=>[m,y.cardinality??"many"])),...l?{computed:l}:{},...u.size>0?{linked:u}:{}})}let r=ee(n);return r&&s.set(Ae,{computed:r}),s}function Je(n,s){let r=[],t=re(n.on),a=(l,u)=>{let m=Ve(s.kinds,l,t)?.reversed===!0,[y,i]=m?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:l,from:y,to:i}:{sever:l,from:y,to:i}};if(n.creates){let l=s.kinds[n.creates],u={};for(let m of Object.keys(l?.fields??{}))u[m]=`$${m}`;for(let m of n.effects??[])"set"in m&&!("create"in m)&&A(m.target)==="new"&&Object.assign(u,m.set);r.push({create:n.creates,as:"new",set:u})}return n.sets&&r.push({set:n.sets}),n.writes&&!(n.creates&&n.on===void 0)&&r.push({set:Object.fromEntries(n.writes.map(l=>[l,`$${l}`]))}),n.connects&&(n.replaces&&r.push({replace:n.replaces===!0?[n.connects]:[...n.replaces],keep:n.connects}),r.push(a(n.connects,"connect"))),n.severs&&r.push(a(n.severs,"sever")),n.setsOther&&(n.connects||n.severs)&&r.push({set:n.setsOther,target:"$to"}),n.removes&&r.push({remove:"$subject"}),n.effects&&r.push(...n.effects.filter(l=>!(n.creates&&"set"in l&&!("create"in l)&&A(l.target)==="new"))),r}function ye(n,s,r){try{let t=Y(n),a=oe(t);for(let l of a.unknownFunctions)r.push(z("unknown-function",s,`"${l}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));return t}catch(t){if(t instanceof se){r.push(z("expression",s,t.sentence+` (at character ${t.at+1})`));return}throw t}}function be(n,s,r){try{return J(n)}catch(t){if(t instanceof Pe||t instanceof se){r.push(z("template",s,(t instanceof se,t.sentence)));return}throw t}}function un(n){let s=[],r=new Set(Object.keys(n.kinds)),t=Ye(n),a=n.acts??{},l=new Set(n.roles??[]),u=(i,o)=>ae(n.kinds[i]?.edges).has(o),m=i=>Object.keys(n.kinds).some(o=>u(o,i));for(let[i,o]of Object.entries(n.kinds)){let p=`kinds.${i}`;for(let[f,d]of Object.entries(o.edges??{})){if(!Ee(d)&&d.to!=="*")for(let c of d.to)r.has(c)||s.push(z("edge-target",`${p}.edges.${f}.to`,`"${c}" is not a kind this document declares`));o.fields[f]&&s.push(z("edge-field-clash",`${p}.edges.${f}`,`"${f}" is both a field and a relation of ${i}`,"rename one of them"))}o.lifecycle&&!o.fields[o.lifecycle.field]&&s.push(z("lifecycle-field",`${p}.lifecycle.field`,`${i} has no field "${o.lifecycle.field}"`));let w=f=>o.computed!==void 0&&Object.hasOwn(o.computed,f);for(let f of o.glance??[])!o.fields[f]&&!w(f)&&s.push(z("glance-field",`${p}.glance`,`a glance at ${i} is to say "${f}", and ${i} has no field or computed field called that`,`use one of: ${[...Object.keys(o.fields),...Object.keys(o.computed??{})].join(", ")}`));s.push(...Ze(i,o));for(let f of["label","describe"]){let d=o[f];if(!d)continue;let c=be(d,`${p}.${f}`,s);for(let O of c??[])if(O.expr){for(let h of oe(O.expr).names)if(!o.fields[h]){if(w(h)){_e(o,h)||s.push(z("template-field",`${p}.${f}`,`${i}'s ${h} is worked out from beyond the record, and a ${f} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${i}'s own fields`));continue}s.push(z("template-field",`${p}.${f}`,`${i} has no field "${h}" for its ${f} to show`,f==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[f,d]of Object.entries(o.fields)){d.default!==void 0&&d.type==="enum"&&!d.options?.includes(String(d.default))&&s.push(z("default-option",`${p}.fields.${f}.default`,`"${String(d.default)}" is not one of ${f}'s options`));let c=`${f}Repeat`;d.repeats&&(o.fields[c]||o.edges?.[c]||o.computed?.[c])&&s.push(z("repeat-clash",`${p}.fields.${f}.repeats`,`${i} already has "${c}", where how ${f} repeats is kept`))}}for(let[i,o]of Object.entries(a)){let p=`acts.${i}`;for(let c of re(o.on))r.has(c)||s.push(z("act-kind",`${p}.on`,`"${c}" is not a kind this document declares`));let w=re(o.on),f=Je(o,n);if(o.creates&&o.on===void 0&&o.writes&&r.has(o.creates)){for(let c of o.writes)if(!n.kinds[o.creates].fields[c])if(n.kinds[o.creates].computed?.[c]!==void 0)s.push(z("computed-written",`${p}.writes`,`${o.creates}'s ${c} is worked out, not written: no act can set it`,"write the stored fields it is worked out from"));else{if(u(o.creates,c))continue;s.push(z("act-field",`${p}.writes`,`${o.creates} has no field "${c}"`))}}f.length===0&&s.push(z("act-empty",p,`"${i}" does nothing`,"give it effects or a shorthand such as sets or creates"));let d=new Map;f.forEach((c,O)=>{let h=f.length-(o.effects?.length??0),j=o.effects&&O>=h?`${p}.effects.${O-h}`:p;if("create"in c){if(!r.has(c.create))s.push(z("act-kind",`${j}.create`,`"${c.create}" is not a kind this document declares`));else for(let b of Object.keys(c.set??{}))n.kinds[c.create].fields[b]||(n.kinds[c.create].computed?.[b]!==void 0?s.push(z("computed-written",`${j}.set.${b}`,`${c.create}'s ${b} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):s.push(z("act-field",`${j}.set.${b}`,`${c.create} has no field "${b}"`)));c.as&&d.set(c.as,c.create)}else if("connect"in c||"sever"in c){let b="connect"in c?c.connect:c.sever;!t.has(b)&&!m(b)&&s.push(z("act-edge",`${j}.${"connect"in c?"connect":"sever"}`,`"${b}" is not a relation any kind declares`)),A(c.from)==="subject"&&w.length===0&&s.push(z("act-subject",`${p}.on`,`"${i}" acts on "$subject" but does not say which kinds it is "on"`))}else if("set"in c){let b=A(c.target??"$subject"),W=b==="subject"?w:d.has(b??"")?[d.get(b)]:[];b==="subject"&&w.length===0&&s.push(z("act-subject",`${p}.on`,`"${i}" changes "$subject" but does not say which kinds it is "on"`));for(let P of Object.keys(c.set))for(let g of W)if(!(!r.has(g)||n.kinds[g].fields[P]))if(n.kinds[g].computed?.[P]!==void 0)s.push(z("computed-written",`${j}.set.${P}`,`${g}'s ${P} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(g,P))continue;s.push(z("act-field",`${j}.set.${P}`,`${g} has no field "${P}"`))}}else"remove"in c&&A(c.remove)==="subject"&&w.length===0&&s.push(z("act-subject",`${p}.on`,`"${i}" removes "$subject" but does not say which kinds it is "on"`));("set"in c&&c.set?Object.values(c.set):[]).forEach(b=>{b&&typeof b=="object"&&!Array.isArray(b)&&"expr"in b&&ye(b.expr,`${j}.set`,s)})}),o.allowedWhen&&ye(o.allowedWhen,`${p}.allowedWhen`,s),o.refusal&&be(o.refusal,`${p}.refusal`,s)}for(let[i,o]of Object.entries(n.rules??{})){let p=`rules.${i}`;o.over!=="graph"&&!r.has(o.over)&&s.push(z("rule-kind",`${p}.over`,`"${o.over}" is not a kind this document declares`));let w=o.over==="graph"?void 0:n.kinds[o.over];for(let f of["when","require"]){let d=o[f];if(!d)continue;let c=ye(d,`${p}.${f}`,s);if(!c)continue;let O=oe(c);for(let h of O.names)if(o.over==="graph")s.push(z("rule-name",`${p}.${f}`,`"${h}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(w&&!w.fields[h]&&!w.edges?.[h]&&w.computed?.[h]===void 0){let j=Object.keys(w.edges??{}).find(v=>v.includes("-")&&v.split("-").includes(h));s.push(z("rule-name",`${p}.${f}`,`${o.over} has no field or relation called "${h}"`,j?`"${j}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${j.replace(/-([a-z0-9])/g,(v,b)=>b.toUpperCase())}"`:void 0))}for(let h of O.edges)!t.has(h)&&!m(h)&&s.push(z("rule-edge",`${p}.${f}`,`"${h}" is not a relation any kind declares`));for(let h of O.sweeps)r.has(h)?o.over!=="graph"&&s.push(Fe("rule-cost",`${p}.${f}`,`this rule looks at every ${h} for every ${o.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):s.push(z("rule-kind",`${p}.${f}`,`"${h}" is not a kind this document declares`))}o.says&&be(o.says,`${p}.says`,s),(o.repairs??[]).forEach((f,d)=>{!a[f.act]&&!ce(f.act)&&!pe(f.act,n.kinds)&&s.push(z("repair-act",`${p}.repairs.${d}.act`,`"${f.act}" is not an act this document declares`))})}let y=n.policy;return y&&(y.grants.forEach((i,o)=>{if(i.roles!=="*"&&l.size>0)for(let p of i.roles)l.has(p)||s.push(z("grant-role",`policy.grants.${o}.roles`,`"${p}" is not one of the document's roles`));if(i.mutations!=="*")for(let p of i.mutations)!a[p]&&!ce(p)&&!pe(p,n.kinds)&&s.push(z("grant-act",`policy.grants.${o}.mutations`,`"${p}" is not an act this document declares`))}),(y.sees??[]).forEach((i,o)=>{for(let p of i.kinds)r.has(p)||s.push(z("sight-kind",`policy.sees.${o}.kinds`,`"${p}" is not a kind this document declares`));if(i.roles!=="*"&&l.size>0)for(let p of i.roles)l.has(p)||s.push(z("sight-role",`policy.sees.${o}.roles`,`"${p}" is not one of the document's roles`))})),s.push(...Ne(n)),s}function mn(n,s,r,t){let a=new Map,l=re(n.on),u=new Map,m=new Map;(l.length>0||s.some(d=>"remove"in d&&A(d.remove)==="subject"||"from"in d&&(A(d.from)==="subject"||A(d.to)==="subject")||"set"in d&&!("create"in d)&&A(d.target??"$subject")==="subject"))&&a.set(le,{ref:l.length>0?l:"*",required:!0});let i=n.args??{},o=n.writes?.length===1,p=(d,c)=>c&&d.type===c.type&&d.min===void 0&&d.max===void 0&&d.step===void 0?{...d,...c.min===void 0?{}:{min:c.min},...c.max===void 0?{}:{max:c.max},...c.step===void 0?{}:{step:c.step}}:d,w=(d,c)=>c&&d.type===c.type&&d.format===void 0&&d.unit===void 0?{...p(d,c),...c.format?{format:c.format}:{},...c.unit?{unit:c.unit}:{}}:p(d,c),f=(d,c,O)=>{if(d===le||pn.has(d)||u.has(d)||a.has(d))return;let h=i[d]?w(i[d],O):void 0;a.set(d,h?{field:h,optional:!h.required,required:!!h.required}:c())};for(let d of s)if("create"in d){let c=r.kinds[d.create];for(let[O,h]of Object.entries(d.set??{})){let j=A(h),v=c?.fields[O];if(j&&v){let b=!!v.required&&v.default===void 0;f(j,()=>({field:v,optional:!b,required:b}),v)}}d.as&&u.set(d.as,d.create)}else if("connect"in d||"sever"in d){let c=t.get("connect"in d?d.connect:d.sever);for(let[O,h]of[["from",d.from],["to",d.to]]){let j=A(h);if(!j)continue;let v=O==="to"?c?.to??"*":c?.from??"*";v!=="*"&&!m.has(j)&&m.set(j,v),f(j,()=>({ref:v,required:!0}))}}else if("set"in d){let c=A(d.target??"$subject"),O=c==="subject"?l[0]:u.get(c??"")??m.get(c??"")?.[0];c&&c!=="subject"&&!u.has(c)&&f(c,()=>({ref:"*",required:!0}));for(let[h,j]of Object.entries(d.set)){let v=A(j);if(!v)continue;let b=O?r.kinds[O]?.fields[h]:void 0;f(v,()=>b?{field:b,optional:!o,required:o}:{any:!0,required:!1},b)}}else if("remove"in d){let c=A(d.remove);c&&f(c,()=>({ref:"*",required:!0}))}for(let[d,c]of Object.entries(i))a.has(d)||a.set(d,{field:c,optional:!c.required,required:!!c.required});return a}function pt(n,s={}){let r=fn(n);if(!r.document||de(r.findings))return{ok:!1,findings:r.findings};let t=r.document,a=[...r.findings];s.previous&&a.push(...zn(t,s.previous));let l=gn(t,a);return de(l.findings)?{ok:!1,findings:l.findings}:Te(l,s)}function ie(n,s){return n.map(r=>{let t=!r.format&&r.expr?.t==="ident"?s?.[r.expr.name]?.format:void 0;return t==="money"||t==="percent"?{...r,format:t}:r})}function gn(n,s){let r=Ye(n),t={};for(let[i,o]of Object.entries(n.kinds)){let p=Me(o),w=o.label??(p?`{${p}}`:void 0),f=ee(o),d=f?We(n,i,[...f]):[];t[i]={...w?{label:ie(J(w),o.fields)}:{},...o.describe?{describe:ie(J(o.describe),o.fields)}:{},...f?{computed:[...f]}:{},...d.length>0?{durations:d}:{}}}let a={};for(let[i,o]of Object.entries(n.acts??{})){let p=Je(o,n),w=mn(o,p,n,r),f=o.destructive??p.some(g=>"remove"in g||"sever"in g||"replace"in g),d=[...new Set(p.flatMap(g=>"create"in g?[g.create]:[]))],c=[...new Set(p.flatMap(g=>"connect"in g?[g.connect]:[]))],O=[...new Set(p.flatMap(g=>"sever"in g?[g.sever]:"replace"in g?g.replace:[]))],h=[...new Set(p.flatMap(g=>"set"in g&&!("create"in g)&&A(g.target??"$subject")==="subject"?Object.keys(g.set):[]))],j=new Map;for(let g of p){if(!("connect"in g)&&!("sever"in g))continue;let x=r.get("connect"in g?g.connect:g.sever);for(let[F,te]of[["from",g.from],["to",g.to]]){let I=A(te),Z=F==="to"?x?.to:x?.from;I&&I!=="subject"&&Z&&Z!=="*"&&j.set(I,[...new Set([...j.get(I)??[],...Z])])}}let v={};for(let g of p){if(!("set"in g)||"create"in g)continue;let x=A(g.target??"$subject");for(let F of x&&x!=="subject"&&j.get(x)||[])v[F]=[...new Set([...v[F]??[],...Object.keys(g.set)])]}let b={};for(let g of p)if(!(!("set"in g)||"create"in g||A(g.target??"$subject")!=="subject"))for(let[x,F]of Object.entries(g.set??{}))typeof F=="string"&&A(F)===void 0||typeof F=="number"||typeof F=="boolean"?b[x]=typeof F=="string"&&F.startsWith("$$")?F.slice(1):F:delete b[x];let W=d.length===0&&p.every(g=>!("set"in g)||!g.set||Object.values(g.set).every(x=>!(x&&typeof x=="object"&&!Array.isArray(x)&&"expr"in x))),P=new Map;for(let g of p)if(!(!("set"in g)||!g.set))for(let x of Object.values(g.set))x&&typeof x=="object"&&!Array.isArray(x)&&"expr"in x&&P.set(x.expr,Y(x.expr));a[i]={title:o.title??i.replace(/-/g," "),effects:p,args:[...w],...o.allowedWhen?{guard:Y(o.allowedWhen)}:{},...o.refusal?{refusal:ie(J(o.refusal),n.kinds[[o.on??[]].flat()[0]??""]?.fields)}:{},exprs:[...P],destructive:f,idempotent:W,creates:d,connects:c,severs:O,writes:h,writesOther:v,sets:b}}let l={};for(let[i,o]of Object.entries(n.rules??{}))l[i]={title:o.title??i.replace(/-/g," "),require:Y(o.require),...o.when?{when:Y(o.when)}:{},...o.says?{says:ie(J(o.says),n.kinds[o.over]?.fields)}:{}};let u=De(n,s),m=Ge(n),y=Ce(n);return{format:Ke,document:n,findings:s,kinds:t,...n.computed?{facts:[...ee(n)??[]]}:{},edges:[...r].map(([i,{from:o,to:p,cardinality:w}])=>[i,{from:o,to:p,cardinality:w}]),acts:a,rules:l,brand:u,...Object.keys(m).length>0?{viewSpecs:m}:{},...y?{home:y}:{}}}function ft(n,s,r){let t=/^defineNode\("([^"]+)"\)/.exec(s)?.[1],a=t?r.kinds[t]:void 0;if(!t||!a)return n;let l=Object.keys(a.fields).filter(u=>u!=="label").slice(0,3);return{...n,path:`kinds.${t}.glance`,fix:`Say which: "glance": [${l.map(u=>`"${u}"`).join(", ")}] on kinds.${t} \u2014 the facts a person compares one by, at a glance.`}}function zn(n,s){let r=[],t=new Set(Object.values(s.kinds).flatMap(a=>Object.keys(a.edges??{})));for(let[a,l]of Object.entries(n.kinds)){let u=l.renamedFrom;u&&!s.kinds[u]&&r.push(z("renamed-from-nothing",`kinds.${a}.renamedFrom`,`${a} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let m=s.kinds[u??a];for(let[y,i]of Object.entries(l.fields)){let o=i.renamedFrom;o&&!m?.fields[o]&&r.push(z("renamed-from-nothing",`kinds.${a}.fields.${y}.renamedFrom`,`${y} says it was ${o}, and the previous ${u??a} has no field called ${o}`,"name the field it was, or drop renamedFrom"))}for(let[y,i]of Object.entries(l.edges??{})){let o=i.renamedFrom;o&&!t.has(o)&&r.push(z("renamed-from-nothing",`kinds.${a}.edges.${y}.renamedFrom`,`${y} says it was ${o}, and the previous version has no relation called ${o}`,"name the relation it was, or drop renamedFrom"))}}return r}export{fn as a,lt as b,Je as c,pt as d,ft as e};
1
+ import{a as we,b as De,c as Ke,d as le,e as A,f as Me,h as Te}from"./chunk.JQ7WY2VZ.js";import{h as Ge,i as Ce,j as Ne}from"./chunk.27ZVVPRZ.js";import{a as oe,b as se,c as H,d as Pe,e as Y,g as ee,h as _e}from"./chunk.3IUJ4GW7.js";import{c as Ae,h as z,i as Fe,j as de}from"./chunk.UG23RICT.js";import{A as ve,Ga as Ee,Ha as Q,Ia as ae,Lb as ce,Mb as Re,b as L,c as q,e as Se,f as je,g as _,h as S,k as G,l as J,m as C,n as Oe,o as B,p as D,r as $,s as X,t as E,u as R,v as V,w as T,x as e,y as K,z as U,za as xe}from"./chunk.AW2T3KFV.js";var on=n=>Object.entries(n).map(([s,r])=>[s,Object.keys(Q(r?.edges))]),pe=(n,s)=>Re(n,on(s));var me="graview-document",ge=1,ze=256*1024,ne=64*1024,fe=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ue=/^[a-z][A-Za-z0-9]*$/,sn=new Set(["id","kind"]),rn=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,an=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"];function cn(){let n=k=>k in Object.prototype,s=U(k=>!n(k),"every object already has this name \u2014 choose another"),r=(k,N)=>[...k===void 0?[]:[je(k)],...N===void 0?[]:[Se(N)]],t=(k,N)=>S().check(...r(k,N)),a=(k,N,tn)=>D(k).check(...r(N,tn)),l=k=>S().check(_(fe,`${k} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),u=S().check(_(rn,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),s),m=S().check(_(ue,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),U(k=>!sn.has(k),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),s),h=t(1,500),i=t(1,2e3),o=t(1,300),p=$({type:V(an),required:e(C()),description:e(h),label:e(t(1,60)),options:e(a(t(1,80),1,100)),of:e(V(["string","number","date","image","video","file"])),default:e(B()),unit:e(t(void 0,12)),format:e(V(["money","percent","duration","markdown"])),min:e(G()),max:e(G()),step:e(G()),renamedFrom:e(S().check(_(ue))),repeats:e(C())}).check(ve((k,N)=>{k.type==="enum"&&!k.options&&N.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),k.type!=="enum"&&k.options&&N.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]}),k.type!=="list"&&k.of&&N.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),k.repeats&&k.type!=="date"&&k.type!=="datetime"&&N.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),w=S().check(_(new RegExp(`${fe.source}|${xe.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),f=$({to:E([a(w,1),T("*")]),cardinality:e(V(["one","many"])),description:e(h),inverse:e(t(1,80)),appendOnly:e(C()),renamedFrom:e(S()),tidying:e(T("never"))}),d=E([i,$({expr:i,label:e(t(1,60)),description:e(h)})]),c=$({noun:e(t(1,40)),plural:e(t(1,40)),description:e(h),fields:R(m,p).check(U(k=>Object.keys(k).length>0,"a kind has at least one field")),label:e(o),describe:e(o),lifecycle:e($({field:m,retired:a(E([S(),G(),C()]),1)})),figure:e(t(void 0,2e4)),glance:e(a(m,1,20)),page:e($({fields:e(a(m,1,40)),groups:e(a($({title:t(1,60),fields:a(m,1,40)}),1,12))})),edges:e(R(u,f)),computed:e(R(S(),d).check(U(k=>Object.keys(k).length<=20,"a kind works out at most 20 computed fields"))),fieldRoles:e(R(S(),S())),renamedFrom:e(S().check(_(fe))),people:e(C()),archives:e(T(!1)),tidying:e(V(["never","no-links"]))}),O=E([S(),G(),C(),Oe(),D(B()),$({expr:i})]),y=S().check(_(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),j=E([$({create:l("kind"),as:e(S().check(_(ue))),set:e(R(m,O))}),$({set:R(m,O),target:e(y)}),$({connect:u,from:y,to:y}),$({sever:u,from:y,to:y}),$({remove:y})]),v=$({title:e(t(1,80)),description:e(h),fromTheOtherEnd:e(t(1,80)),on:e(E([l("kind"),a(l("kind"),1)])),creates:e(l("kind")),sets:e(R(m,O)),writes:e(a(m,1)),connects:e(u),severs:e(u),setsOther:e(R(m,O)),replaces:e(E([T(!0),a(u,1,10)])),removes:e(T(!0)),args:e(R(m,p)),effects:e(a(j,1,20)),allowedWhen:e(i),refusal:e(o),destructive:e(C())}),b=$({act:l("act"),label:e(t(1,80)),args:e(R(S(),O))}),W=$({title:e(t(1,120)),description:e(h),over:E([T("graph"),l("kind")]),when:e(i),require:i,says:e(o),repairs:e(a(b,void 0,10))}),P=$({roles:E([a(l("role"),1),T("*")]),mutations:E([a(l("act"),1),T("*")]),kinds:e(E([D(l("kind")),T("*")])),describe:e(h),self:e(C()),ownEnd:e(C())}),g=e(a(l("field"),1)),x=$({roles:E([a(l("role"),1),T("*")]),kinds:a(l("kind"),1),own:e(C()),via:e(u),fields:g,hide:g}),F=$({grants:D(P),sees:e(D(x))}),te=$({accent:e(S().check(_(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),name:e(t(1,60)),currency:e(S().check(_(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:e(t(2,35)),timeZone:e(t(1,64)),logo:e(E([t(1,ne),$({src:t(1,ne),alt:e(t(1,120))}),$({light:t(1,ne),dark:e(t(1,ne)),alt:e(t(1,120)),darkFallback:e(T("invert"))})])),favicon:e(E([t(1,ne),$({emoji:S()})])),typography:e($({display:e(t(1,200)),body:e(t(1,200)),mono:e(t(1,200))})),shape:e($({radius:e(G().check(q(0),L(32))),density:e(G().check(q(.75),L(1.5)))})),accents:e(R(S(),G().check(q(0),L(360)))),scheme:e(V(["light","dark","auto"]))}),I=R(S(),B()),Z=E([t(1,120),$({by:t(1,120),direction:e(V(["asc","desc"]))})]),ke=G().check(J(),q(1),L(9999)),Je=X({create:e(C()),options:e(X({sort:e(Z),columnSort:e(Z),search:e(a(t(1,120),void 0,40)),filters:e(a(t(1,120),void 0,40)),horizon:e(E([G().check(J(),q(1),L(200)),X({years:G().check(J(),q(1),L(200)),title:t(1,80),from:e(ke),to:e(ke)})]))}))}),Xe=$({card:e(D(B())),row:e(D(B())),page:e(D(B()))}),Qe=()=>{let k=e(V(["asc","desc"]));return E([t(1,120),$({by:t(1,120),direction:k,then:e(E([t(1,120),$({by:t(1,120),direction:k})]))})])},en=()=>E([t(1,120),$({by:t(1,120),order:e(a(t(1,80),void 0,40)),closed:e(a(t(1,80),void 0,40))})]),$e=X({order:e(D(S())),hide:e(D(S())),first:e(S()),primary:e(a(t(1,80),void 0,40)),scene:e(t(1,40)),pages:e(t(1,40)),lists:e(R(S(),$({filters:e(a(t(1,120),void 0,40)),sort:e(Qe()),group:e(en())})))}),nn=$({$schema:e(S()),format:T(me),formatVersion:T(ge),name:t(1,80),description:e(h),version:e(G().check(J(),q(1))),kinds:R(l("kind"),c).check(U(k=>Object.keys(k).length>0,"a document declares at least one kind"),U(k=>Object.keys(k).length<=40,"a document declares at most 40 kinds")),computed:e(R(S(),d)),acts:e(R(l("act"),v)),rules:e(R(l("rule"),W)),roles:e(D(l("role"))),policy:e(F),modules:e(I),lenses:e(D(Je)),pages:e($e),views:e(R(S(),E([Xe,D(B())]))),brand:e(te),settings:e(D(I)),migrations:e(D(I)),connections:e(R(l("connection"),I))});return{FieldSpec:p,EdgeSpec:f,ComputedSpec:d,KindSpec:c,ValueSpec:O,EffectSpec:j,ActSpec:v,RepairSpec:b,RuleSpec:W,GrantSpec:P,SightSpec:x,PolicySpec:F,BrandSpec:te,PagesSpec:$e,DocumentSpec:nn}}var dn,M=()=>dn??=cn(),Sn=K(()=>M().FieldSpec),jn=K(()=>M().EdgeSpec),On=K(()=>M().ComputedSpec),vn=K(()=>M().KindSpec),xn=K(()=>M().ValueSpec),En=K(()=>M().EffectSpec),Rn=K(()=>M().ActSpec),An=K(()=>M().RepairSpec),Fn=K(()=>M().RuleSpec),Dn=K(()=>M().GrantSpec),Kn=K(()=>M().SightSpec),Mn=K(()=>M().PolicySpec),Tn=K(()=>M().BrandSpec),Pn=K(()=>M().PagesSpec),Ie=K(()=>M().DocumentSpec);var ln={};function Ve(n,s=ln,r=ge){let{document:t,respelled:a}=we(n),l=a.length>0?{respelled:a}:{};if(!t||typeof t!="object"||Array.isArray(t))return{document:t};let u=t;if(u.format!==me||typeof u.formatVersion!="number"||u.formatVersion>=r)return{document:t,...l};let m=u.formatVersion,h=structuredClone(u);for(let i=m;i<r;i++){let o=s[i];if(!o)throw new Error(`there is no upgrade from format ${i} to ${i+1}`);h={...o(h),formatVersion:i+1}}return{document:h,from:m,...l}}function qe(n,s,r){let t=Object.keys(n).filter(m=>n[m].edges?.[s]!==void 0);if(t.length===0)return;let a=t.map(m=>n[m].edges[s].to),l=a.some(m=>m==="*")?"*":[...new Set(a.flatMap(m=>m))];if(r.length===0||r.some(m=>t.includes(m)))return{reversed:!1,kinds:l};let u=t.filter(m=>{let h=n[m].edges[s].to;return h==="*"||r.every(i=>h.includes(i))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:l}}var Ue=(n,s)=>{let r=n?.fields[s];return r!==void 0&&(r.type==="duration"||(r.type==="number"||r.type==="integer")&&r.format==="duration")};function Be(n,s,r,t){if(t==="out"){let a=n[s]?.edges?.[r]?.to;return a===void 0?[]:a==="*"?Object.keys(n):a}return Object.entries(n).filter(([,a])=>{let l=a.edges?.[r]?.to;return l!==void 0&&(l==="*"||l.includes(s))}).map(([a])=>a)}function ye(n,s,r){if(r.t==="ident")return n[s]?.edges?.[r.name]?Be(n,s,r.name,"out"):void 0;if(r.t==="where")return ye(n,s,r.set);if(r.t==="call"&&(r.fn==="out"||r.fn==="in")&&r.args[0]?.t==="lit"&&typeof r.args[0].value=="string")return Be(n,s,r.args[0].value,r.fn)}var Le=(n,s,r)=>{let t=s.filter(a=>n[a]?.fields[r]!==void 0);return t.length>0&&t.every(a=>Ue(n[a],r))};function We(n,s,r){let t=n.kinds,a=t[s],l=new Map(r),u=new Map,m=(i,o)=>{if(o>8)return!1;switch(i.t){case"ident":return Ue(a,i.name)||h(i.name,o+1);case"member":{let p=ye(t,s,i.object);return p!==void 0&&Le(t,p,i.name)}case"call":{if(i.fn!=="sum"&&i.fn!=="min"&&i.fn!=="max")return!1;let[p,w]=i.args,f=p&&ye(t,s,p);return f!==void 0&&w?.t==="ident"&&Le(t,f,w.name)}case"binary":return(i.op==="+"||i.op==="-")&&m(i.left,o)&&m(i.right,o);case"unary":return i.op==="-"&&m(i.operand,o);default:return!1}},h=(i,o)=>{if(a?.computed?.[i]===void 0)return!1;if(u.has(i))return u.get(i);u.set(i,!1);let p=l.get(i),w=p!==void 0&&m(p,o);return u.set(i,w),w};return r.map(([i])=>i).filter(i=>h(i,0))}function Ze(n,s,r=`kinds.${n}.page`){let t=s.page;if(!t)return[];let a=[],l=[...Object.keys(s.fields),...Object.keys(s.computed??{})],u=new Set,m=(i,o)=>{l.includes(i)?u.has(i)&&a.push(z("page-field-twice",o,`"${i}" is on ${n}'s page twice; name each field once`)):a.push(z("page-field",o,`${n}'s page is to show "${i}", and ${n} has no field or computed field called that`,`use one of: ${l.join(", ")}`)),u.add(i)};(t.fields??[]).forEach((i,o)=>m(i,`${r}.fields.${o}`));let h=new Set;return(t.groups??[]).forEach((i,o)=>{let p=i.title.trim().toLowerCase();h.has(p)&&a.push(z("page-group-twice",`${r}.groups.${o}.title`,`${n}'s page has two groups called "${i.title}"; give each its own title`)),h.add(p),i.fields.forEach((w,f)=>m(w,`${r}.groups.${o}.fields.${f}`))}),a}var pn=new Set(["subject","now","today","me"]);function fn(n){if((typeof n=="string"?n:JSON.stringify(n??null)).length>ze)return{findings:[z("too-large","",`a document may be at most ${ze/1024} KB`)]};if(typeof n=="string")try{n=JSON.parse(n)}catch(t){return{findings:[z("not-json","",`this is not JSON: ${t.message}`)]}}try{n=Ve(n).document}catch(t){return{findings:[z("format","formatVersion",t.message)]}}let s=Ie.safeParse(n);if(!s.success)return{findings:s.error.issues.map(t=>{let a=t.path.map(String).join(".");if(t.code==="unrecognized_keys")return z("unknown-key",a,`${t.keys.map(l=>`"${l}"`).join(", ")} ${t.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(t.code==="invalid_union"&&/\.effects\.\d+$/.test(a))return z("effect-shape",a,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(t.code==="invalid_key"){let l=t.issues?.[0]?.message;return z("shape",a,`the name "${String(t.path.at(-1))}" is not allowed here${l?`: ${l}`:""}`)}return z("shape",a,t.message)})};let r=s.data;return{document:r,findings:un(r)}}var re=n=>[n??[]].flat();function He(n){let s=new Map;for(let[r,t]of Object.entries(n.kinds))for(let[a,l]of Object.entries(Q(t.edges))){let u=s.get(a);s.set(a,{name:a,from:[...u?.from??[],r],to:l.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...l.to])],cardinality:l.cardinality??"many"})}return s}function lt(n){let s=new Map;for(let[t,a]of Object.entries(n.kinds)){let l=ee(a),u=ae(a.edges);s.set(t,{fields:new Set([...Object.keys(a.fields),...u.keys()]),edges:new Map(Object.entries(Q(a.edges)).map(([m,h])=>[m,h.cardinality??"many"])),...l?{computed:l}:{},...u.size>0?{linked:u}:{}})}let r=ee(n);return r&&s.set(Ae,{computed:r}),s}function Ye(n,s){let r=[],t=re(n.on),a=(l,u)=>{let m=qe(s.kinds,l,t)?.reversed===!0,[h,i]=m?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:l,from:h,to:i}:{sever:l,from:h,to:i}};if(n.creates){let l=s.kinds[n.creates],u={};for(let m of Object.keys(l?.fields??{}))u[m]=`$${m}`;for(let m of n.effects??[])"set"in m&&!("create"in m)&&A(m.target)==="new"&&Object.assign(u,m.set);r.push({create:n.creates,as:"new",set:u})}return n.sets&&r.push({set:n.sets}),n.writes&&!(n.creates&&n.on===void 0)&&r.push({set:Object.fromEntries(n.writes.map(l=>[l,`$${l}`]))}),n.connects&&(n.replaces&&r.push({replace:n.replaces===!0?[n.connects]:[...n.replaces],keep:n.connects}),r.push(a(n.connects,"connect"))),n.severs&&r.push(a(n.severs,"sever")),n.setsOther&&(n.connects||n.severs)&&r.push({set:n.setsOther,target:"$to"}),n.removes&&r.push({remove:"$subject"}),n.effects&&r.push(...n.effects.filter(l=>!(n.creates&&"set"in l&&!("create"in l)&&A(l.target)==="new"))),r}function he(n,s,r){try{let t=H(n),a=oe(t);for(let l of a.unknownFunctions)r.push(z("unknown-function",s,`"${l}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));return t}catch(t){if(t instanceof se){r.push(z("expression",s,t.sentence+` (at character ${t.at+1})`));return}throw t}}function be(n,s,r){try{return Y(n)}catch(t){if(t instanceof Pe||t instanceof se){r.push(z("template",s,(t instanceof se,t.sentence)));return}throw t}}function un(n){let s=[],r=new Set(Object.keys(n.kinds)),t=He(n),a=n.acts??{},l=new Set(n.roles??[]),u=(i,o)=>ae(n.kinds[i]?.edges).has(o),m=i=>Object.keys(n.kinds).some(o=>u(o,i));for(let[i,o]of Object.entries(n.kinds)){let p=`kinds.${i}`;for(let[f,d]of Object.entries(o.edges??{})){if(!Ee(d)&&d.to!=="*")for(let c of d.to)r.has(c)||s.push(z("edge-target",`${p}.edges.${f}.to`,`"${c}" is not a kind this document declares`));o.fields[f]&&s.push(z("edge-field-clash",`${p}.edges.${f}`,`"${f}" is both a field and a relation of ${i}`,"rename one of them"))}o.lifecycle&&!o.fields[o.lifecycle.field]&&s.push(z("lifecycle-field",`${p}.lifecycle.field`,`${i} has no field "${o.lifecycle.field}"`));let w=f=>o.computed!==void 0&&Object.hasOwn(o.computed,f);for(let f of o.glance??[])!o.fields[f]&&!w(f)&&s.push(z("glance-field",`${p}.glance`,`a glance at ${i} is to say "${f}", and ${i} has no field or computed field called that`,`use one of: ${[...Object.keys(o.fields),...Object.keys(o.computed??{})].join(", ")}`));s.push(...Ze(i,o));for(let f of["label","describe"]){let d=o[f];if(!d)continue;let c=be(d,`${p}.${f}`,s);for(let O of c??[])if(O.expr){for(let y of oe(O.expr).names)if(!o.fields[y]){if(w(y)){_e(o,y)||s.push(z("template-field",`${p}.${f}`,`${i}'s ${y} is worked out from beyond the record, and a ${f} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${i}'s own fields`));continue}s.push(z("template-field",`${p}.${f}`,`${i} has no field "${y}" for its ${f} to show`,f==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[f,d]of Object.entries(o.fields)){d.default!==void 0&&d.type==="enum"&&!d.options?.includes(String(d.default))&&s.push(z("default-option",`${p}.fields.${f}.default`,`"${String(d.default)}" is not one of ${f}'s options`));let c=`${f}Repeat`;d.repeats&&(o.fields[c]||o.edges?.[c]||o.computed?.[c])&&s.push(z("repeat-clash",`${p}.fields.${f}.repeats`,`${i} already has "${c}", where how ${f} repeats is kept`))}}for(let[i,o]of Object.entries(a)){let p=`acts.${i}`;for(let c of re(o.on))r.has(c)||s.push(z("act-kind",`${p}.on`,`"${c}" is not a kind this document declares`));let w=re(o.on),f=Ye(o,n);if(o.creates&&o.on===void 0&&o.writes&&r.has(o.creates)){for(let c of o.writes)if(!n.kinds[o.creates].fields[c])if(n.kinds[o.creates].computed?.[c]!==void 0)s.push(z("computed-written",`${p}.writes`,`${o.creates}'s ${c} is worked out, not written: no act can set it`,"write the stored fields it is worked out from"));else{if(u(o.creates,c))continue;s.push(z("act-field",`${p}.writes`,`${o.creates} has no field "${c}"`))}}f.length===0&&s.push(z("act-empty",p,`"${i}" does nothing`,"give it effects or a shorthand such as sets or creates"));let d=new Map;f.forEach((c,O)=>{let y=f.length-(o.effects?.length??0),j=o.effects&&O>=y?`${p}.effects.${O-y}`:p;if("create"in c){if(!r.has(c.create))s.push(z("act-kind",`${j}.create`,`"${c.create}" is not a kind this document declares`));else for(let b of Object.keys(c.set??{}))n.kinds[c.create].fields[b]||(n.kinds[c.create].computed?.[b]!==void 0?s.push(z("computed-written",`${j}.set.${b}`,`${c.create}'s ${b} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):s.push(z("act-field",`${j}.set.${b}`,`${c.create} has no field "${b}"`)));c.as&&d.set(c.as,c.create)}else if("connect"in c||"sever"in c){let b="connect"in c?c.connect:c.sever;!t.has(b)&&!m(b)&&s.push(z("act-edge",`${j}.${"connect"in c?"connect":"sever"}`,`"${b}" is not a relation any kind declares`)),A(c.from)==="subject"&&w.length===0&&s.push(z("act-subject",`${p}.on`,`"${i}" acts on "$subject" but does not say which kinds it is "on"`))}else if("set"in c){let b=A(c.target??"$subject"),W=b==="subject"?w:d.has(b??"")?[d.get(b)]:[];b==="subject"&&w.length===0&&s.push(z("act-subject",`${p}.on`,`"${i}" changes "$subject" but does not say which kinds it is "on"`));for(let P of Object.keys(c.set))for(let g of W)if(!(!r.has(g)||n.kinds[g].fields[P]))if(n.kinds[g].computed?.[P]!==void 0)s.push(z("computed-written",`${j}.set.${P}`,`${g}'s ${P} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(g,P))continue;s.push(z("act-field",`${j}.set.${P}`,`${g} has no field "${P}"`))}}else"remove"in c&&A(c.remove)==="subject"&&w.length===0&&s.push(z("act-subject",`${p}.on`,`"${i}" removes "$subject" but does not say which kinds it is "on"`));("set"in c&&c.set?Object.values(c.set):[]).forEach(b=>{b&&typeof b=="object"&&!Array.isArray(b)&&"expr"in b&&he(b.expr,`${j}.set`,s)})}),o.allowedWhen&&he(o.allowedWhen,`${p}.allowedWhen`,s),o.refusal&&be(o.refusal,`${p}.refusal`,s)}for(let[i,o]of Object.entries(n.rules??{})){let p=`rules.${i}`;o.over!=="graph"&&!r.has(o.over)&&s.push(z("rule-kind",`${p}.over`,`"${o.over}" is not a kind this document declares`));let w=o.over==="graph"?void 0:n.kinds[o.over];for(let f of["when","require"]){let d=o[f];if(!d)continue;let c=he(d,`${p}.${f}`,s);if(!c)continue;let O=oe(c);for(let y of O.names)if(o.over==="graph")s.push(z("rule-name",`${p}.${f}`,`"${y}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(w&&!w.fields[y]&&!w.edges?.[y]&&w.computed?.[y]===void 0){let j=Object.keys(w.edges??{}).find(v=>v.includes("-")&&v.split("-").includes(y));s.push(z("rule-name",`${p}.${f}`,`${o.over} has no field or relation called "${y}"`,j?`"${j}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${j.replace(/-([a-z0-9])/g,(v,b)=>b.toUpperCase())}"`:void 0))}for(let y of O.edges)!t.has(y)&&!m(y)&&s.push(z("rule-edge",`${p}.${f}`,`"${y}" is not a relation any kind declares`));for(let y of O.sweeps)r.has(y)?o.over!=="graph"&&s.push(Fe("rule-cost",`${p}.${f}`,`this rule looks at every ${y} for every ${o.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):s.push(z("rule-kind",`${p}.${f}`,`"${y}" is not a kind this document declares`))}o.says&&be(o.says,`${p}.says`,s),(o.repairs??[]).forEach((f,d)=>{!a[f.act]&&!ce(f.act)&&!pe(f.act,n.kinds)&&s.push(z("repair-act",`${p}.repairs.${d}.act`,`"${f.act}" is not an act this document declares`))})}let h=n.policy;return h&&(h.grants.forEach((i,o)=>{if(i.roles!=="*"&&l.size>0)for(let p of i.roles)l.has(p)||s.push(z("grant-role",`policy.grants.${o}.roles`,`"${p}" is not one of the document's roles`));if(i.mutations!=="*")for(let p of i.mutations)!a[p]&&!ce(p)&&!pe(p,n.kinds)&&s.push(z("grant-act",`policy.grants.${o}.mutations`,`"${p}" is not an act this document declares`))}),(h.sees??[]).forEach((i,o)=>{for(let p of i.kinds)r.has(p)||s.push(z("sight-kind",`policy.sees.${o}.kinds`,`"${p}" is not a kind this document declares`));if(i.roles!=="*"&&l.size>0)for(let p of i.roles)l.has(p)||s.push(z("sight-role",`policy.sees.${o}.roles`,`"${p}" is not one of the document's roles`))})),s.push(...Ne(n)),s}function mn(n,s,r,t){let a=new Map,l=re(n.on),u=new Map,m=new Map;(l.length>0||s.some(d=>"remove"in d&&A(d.remove)==="subject"||"from"in d&&(A(d.from)==="subject"||A(d.to)==="subject")||"set"in d&&!("create"in d)&&A(d.target??"$subject")==="subject"))&&a.set(le,{ref:l.length>0?l:"*",required:!0});let i=n.args??{},o=n.writes?.length===1,p=(d,c)=>c&&d.type===c.type&&d.min===void 0&&d.max===void 0&&d.step===void 0?{...d,...c.min===void 0?{}:{min:c.min},...c.max===void 0?{}:{max:c.max},...c.step===void 0?{}:{step:c.step}}:d,w=(d,c)=>c&&d.type===c.type&&d.format===void 0&&d.unit===void 0?{...p(d,c),...c.format?{format:c.format}:{},...c.unit?{unit:c.unit}:{}}:p(d,c),f=(d,c,O)=>{if(d===le||pn.has(d)||u.has(d)||a.has(d))return;let y=i[d]?w(i[d],O):void 0;a.set(d,y?{field:y,optional:!y.required,required:!!y.required}:c())};for(let d of s)if("create"in d){let c=r.kinds[d.create];for(let[O,y]of Object.entries(d.set??{})){let j=A(y),v=c?.fields[O];if(j&&v){let b=!!v.required&&v.default===void 0;f(j,()=>({field:v,optional:!b,required:b}),v)}}d.as&&u.set(d.as,d.create)}else if("connect"in d||"sever"in d){let c=t.get("connect"in d?d.connect:d.sever);for(let[O,y]of[["from",d.from],["to",d.to]]){let j=A(y);if(!j)continue;let v=O==="to"?c?.to??"*":c?.from??"*";v!=="*"&&!m.has(j)&&m.set(j,v),f(j,()=>({ref:v,required:!0}))}}else if("set"in d){let c=A(d.target??"$subject"),O=c==="subject"?l[0]:u.get(c??"")??m.get(c??"")?.[0];c&&c!=="subject"&&!u.has(c)&&f(c,()=>({ref:"*",required:!0}));for(let[y,j]of Object.entries(d.set)){let v=A(j);if(!v)continue;let b=O?r.kinds[O]?.fields[y]:void 0;f(v,()=>b?{field:b,optional:!o,required:o}:{any:!0,required:!1},b)}}else if("remove"in d){let c=A(d.remove);c&&f(c,()=>({ref:"*",required:!0}))}for(let[d,c]of Object.entries(i))a.has(d)||a.set(d,{field:c,optional:!c.required,required:!!c.required});return a}function pt(n,s={}){let r=fn(n);if(!r.document||de(r.findings))return{ok:!1,findings:r.findings};let t=r.document,a=[...r.findings];s.previous&&a.push(...zn(t,s.previous));let l=gn(t,a);return de(l.findings)?{ok:!1,findings:l.findings}:Te(l,s)}function ie(n,s){return n.map(r=>{let t=!r.format&&r.expr?.t==="ident"?s?.[r.expr.name]?.format:void 0;return t==="money"||t==="percent"?{...r,format:t}:r})}function gn(n,s){let r=He(n),t={};for(let[i,o]of Object.entries(n.kinds)){let p=Me(o),w=o.label??(p?`{${p}}`:void 0),f=ee(o),d=f?We(n,i,[...f]):[];t[i]={...w?{label:ie(Y(w),o.fields)}:{},...o.describe?{describe:ie(Y(o.describe),o.fields)}:{},...f?{computed:[...f]}:{},...d.length>0?{durations:d}:{}}}let a={};for(let[i,o]of Object.entries(n.acts??{})){let p=Ye(o,n),w=mn(o,p,n,r),f=o.destructive??p.some(g=>"remove"in g||"sever"in g||"replace"in g),d=[...new Set(p.flatMap(g=>"create"in g?[g.create]:[]))],c=[...new Set(p.flatMap(g=>"connect"in g?[g.connect]:[]))],O=[...new Set(p.flatMap(g=>"sever"in g?[g.sever]:"replace"in g?g.replace:[]))],y=[...new Set(p.flatMap(g=>"set"in g&&!("create"in g)&&A(g.target??"$subject")==="subject"?Object.keys(g.set):[]))],j=new Map;for(let g of p){if(!("connect"in g)&&!("sever"in g))continue;let x=r.get("connect"in g?g.connect:g.sever);for(let[F,te]of[["from",g.from],["to",g.to]]){let I=A(te),Z=F==="to"?x?.to:x?.from;I&&I!=="subject"&&Z&&Z!=="*"&&j.set(I,[...new Set([...j.get(I)??[],...Z])])}}let v={};for(let g of p){if(!("set"in g)||"create"in g)continue;let x=A(g.target??"$subject");for(let F of x&&x!=="subject"&&j.get(x)||[])v[F]=[...new Set([...v[F]??[],...Object.keys(g.set)])]}let b={};for(let g of p)if(!(!("set"in g)||"create"in g||A(g.target??"$subject")!=="subject"))for(let[x,F]of Object.entries(g.set??{}))typeof F=="string"&&A(F)===void 0||typeof F=="number"||typeof F=="boolean"?b[x]=typeof F=="string"&&F.startsWith("$$")?F.slice(1):F:delete b[x];let W=d.length===0&&p.every(g=>!("set"in g)||!g.set||Object.values(g.set).every(x=>!(x&&typeof x=="object"&&!Array.isArray(x)&&"expr"in x))),P=new Map;for(let g of p)if(!(!("set"in g)||!g.set))for(let x of Object.values(g.set))x&&typeof x=="object"&&!Array.isArray(x)&&"expr"in x&&P.set(x.expr,H(x.expr));a[i]={title:o.title??i.replace(/-/g," "),effects:p,args:[...w],...o.allowedWhen?{guard:H(o.allowedWhen)}:{},...o.refusal?{refusal:ie(Y(o.refusal),n.kinds[[o.on??[]].flat()[0]??""]?.fields)}:{},exprs:[...P],destructive:f,idempotent:W,creates:d,connects:c,severs:O,writes:y,writesOther:v,sets:b}}let l={};for(let[i,o]of Object.entries(n.rules??{}))l[i]={title:o.title??i.replace(/-/g," "),require:H(o.require),...o.when?{when:H(o.when)}:{},...o.says?{says:ie(Y(o.says),n.kinds[o.over]?.fields)}:{}};let u=De(n,s),m=Ge(n),h=Ce(n);return{format:Ke,document:n,findings:s,kinds:t,...n.computed?{facts:[...ee(n)??[]]}:{},edges:[...r].map(([i,{from:o,to:p,cardinality:w}])=>[i,{from:o,to:p,cardinality:w}]),acts:a,rules:l,brand:u,...Object.keys(m).length>0?{viewSpecs:m}:{},...h?{home:h}:{}}}function ft(n,s,r){let t=/^defineNode\("([^"]+)"\)/.exec(s)?.[1],a=t?r.kinds[t]:void 0;if(!t||!a)return n;let l=Object.keys(a.fields).filter(u=>u!=="label").slice(0,3);return{...n,path:`kinds.${t}.glance`,fix:`Say which: "glance": [${l.map(u=>`"${u}"`).join(", ")}] on kinds.${t} \u2014 the facts a person compares one by, at a glance.`}}function zn(n,s){let r=[],t=new Set(Object.values(s.kinds).flatMap(a=>Object.keys(a.edges??{})));for(let[a,l]of Object.entries(n.kinds)){let u=l.renamedFrom;u&&!s.kinds[u]&&r.push(z("renamed-from-nothing",`kinds.${a}.renamedFrom`,`${a} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let m=s.kinds[u??a];for(let[h,i]of Object.entries(l.fields)){let o=i.renamedFrom;o&&!m?.fields[o]&&r.push(z("renamed-from-nothing",`kinds.${a}.fields.${h}.renamedFrom`,`${h} says it was ${o}, and the previous ${u??a} has no field called ${o}`,"name the field it was, or drop renamedFrom"))}for(let[h,i]of Object.entries(l.edges??{})){let o=i.renamedFrom;o&&!t.has(o)&&r.push(z("renamed-from-nothing",`kinds.${a}.edges.${h}.renamedFrom`,`${h} says it was ${o}, and the previous version has no relation called ${o}`,"name the relation it was, or drop renamedFrom"))}}return r}export{fn as a,lt as b,Ye as c,pt as d,ft as e};
@@ -1,3 +1,3 @@
1
- import{C as y,Fb as $,Jb as x,L as h,U as g,ea as m}from"./chunk.UG727PEE.js";function B(n,e,t){let o=n?.display?.format?.[e];return o?o(t):typeof t=="string"?m(t):String(t)}function G(n,e,t,o){let s=n.tryDefinition(e)?.edges,i=s&&Object.hasOwn(s,t)?s[t]:void 0;return(o==="out"?i?.description:i?.inverse)??m(t).toLowerCase()}var O=Symbol.for("@graview/core:markdown");function S(n){let e=y(n);return!!e&&(e[O]===1||S(e.innerType))}var w=/^ {0,3}#{1,6}(?:[ \t]+|$)/,b=/^[ \t]*(?:[-*+•]|\d{1,9}[.)])[ \t]+(?:\[[ xX]\][ \t]+)?/,k=/^ {0,3}(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/,R=/^ {0,3}(?:`{3,}|~{3,})/,F=/^ {0,3}(?:>[ \t]?)+/,A=/^\|?\s*:?-{2,}:?\s*(?:\|\s*:?-{2,}:?\s*)*\|?$/,_={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'",nbsp:" "};function E(n){return n.replace(/!?\[([^\]\n]{0,500})\]\([^)\n]{0,500}\)/g,"$1").replace(/<((?:https?:|mailto:)[^>\s]*)>/gi,"$1").replace(/<\/?[A-Za-z][^<>\n]*>/g,"").replace(/`+([^`\n]*)`+/g,"$1").replace(/(\*\*|__|~~)(?=\S)([^\n]{0,500}?\S)\1/g,"$2").replace(/(^|[^\w*])\*(?=\S)([^*\n]{0,500}?\S)\*(?![\w*])/g,"$1$2").replace(/(^|\W)_(?=\S)([^_\n]{0,500}?\S)_(?!\w)/g,"$1$2").replace(/\\([\\`*_{}[\]()#+\-.!>|~])/g,"$1").replace(/&(amp|lt|gt|quot|#39|nbsp);/g,(e,t)=>_[t]??"")}function N(n,e,t){let o=n.replace(/\r\n?/g,`
1
+ import{C as y,Fb as $,Jb as x,L as h,U as g,ea as m}from"./chunk.AW2T3KFV.js";function B(n,e,t){let o=n?.display?.format?.[e];return o?o(t):typeof t=="string"?m(t):String(t)}function G(n,e,t,o){let s=n.tryDefinition(e)?.edges,i=s&&Object.hasOwn(s,t)?s[t]:void 0;return(o==="out"?i?.description:i?.inverse)??m(t).toLowerCase()}var O=Symbol.for("@graview/core:markdown");function S(n){let e=y(n);return!!e&&(e[O]===1||S(e.innerType))}var w=/^ {0,3}#{1,6}(?:[ \t]+|$)/,b=/^[ \t]*(?:[-*+•]|\d{1,9}[.)])[ \t]+(?:\[[ xX]\][ \t]+)?/,k=/^ {0,3}(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/,R=/^ {0,3}(?:`{3,}|~{3,})/,F=/^ {0,3}(?:>[ \t]?)+/,A=/^\|?\s*:?-{2,}:?\s*(?:\|\s*:?-{2,}:?\s*)*\|?$/,_={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'",nbsp:" "};function E(n){return n.replace(/!?\[([^\]\n]{0,500})\]\([^)\n]{0,500}\)/g,"$1").replace(/<((?:https?:|mailto:)[^>\s]*)>/gi,"$1").replace(/<\/?[A-Za-z][^<>\n]*>/g,"").replace(/`+([^`\n]*)`+/g,"$1").replace(/(\*\*|__|~~)(?=\S)([^\n]{0,500}?\S)\1/g,"$2").replace(/(^|[^\w*])\*(?=\S)([^*\n]{0,500}?\S)\*(?![\w*])/g,"$1$2").replace(/(^|\W)_(?=\S)([^_\n]{0,500}?\S)_(?!\w)/g,"$1$2").replace(/\\([\\`*_{}[\]()#+\-.!>|~])/g,"$1").replace(/&(amp|lt|gt|quot|#39|nbsp);/g,(e,t)=>_[t]??"")}function N(n,e,t){let o=n.replace(/\r\n?/g,`
2
2
  `).split(`
3
3
  `),s=[],i=[],c=0,d=!1,u=()=>{let r=i.join(" ").replace(/\s+/g," ").trim();r&&(s.push(r),c+=r.length),i=[]},a=0;for(;a<o.length&&c<=t;){let r=o[a++];if(e&&R.test(r)){d=!d,d||u();continue}if(!d&&(r.trim().length===0||e&&(k.test(r)||A.test(r.trim())))){u();continue}let f=!d&&e&&w.test(r),l=!d&&b.test(r);if((f||l)&&u(),e&&!d?(r=r.replace(F,""),f&&(r=r.replace(w,"").replace(/[ \t]+#+[ \t]*$/,"")),l&&(r=r.replace(b,"")),r.includes("|")&&(r=r.replace(/^[ \t]*\||\|[ \t]*$/g,"").split("|").map(p=>p.trim()).filter(Boolean).join(" \xB7 ")),r=E(Number.isFinite(t)?r.slice(0,t*2+200):r)):l&&(r=r.replace(b,"")),i.push(r),f&&u(),i.reduce((p,T)=>p+T.length,0)>t)break}return u(),{blocks:s,more:o.slice(a).some(r=>r.trim().length>0&&!(e&&(R.test(r)||k.test(r))))}}function M(n,e){return`${(n.slice(0,e+1).replace(/\s+\S*$/,"")||n.slice(0,e)).replace(/[\s,;:.—-]+$/,"")}\u2026`}function Z(n,e={}){let t=e.most??160,{blocks:o,more:s}=N(n,e.markdown===!0,t),i=o[0]??"";if(i.length<=t)return(s||o.length>1)&&i.length>0&&!/[.!?…:]$/.test(i)?`${i}\u2026`:i;let c=x(i);return c&&c.length<=t?c:M(i,t)}var J=n=>N(n,!0,Number.POSITIVE_INFINITY).blocks.join(" ");var j={d:1440,h:60,m:1};function ne(n){if(typeof n=="number")return Number.isFinite(n)&&n>=0?Math.round(n):void 0;if(typeof n!="string")return;let e=n.trim().toLowerCase();if(/^\d+$/.test(e))return Number(e);let t=/^(\d+):([0-5]\d)(?::([0-5]\d))?$/.exec(e);if(t)return Number(t[1])*60+Number(t[2])+Math.round(Number(t[3]??0)/60);let o=0,s=!1,i=e.replace(/(\d*[.,]?\d+) *(days?|d|hours?|hrs?|hr|h|minutes?|mins?|min|m)(?![a-z])/g,(c,d,u)=>(s=!0,o+=Number(d.replace(",","."))*j[u[0]]," "));return s&&/^[\s,+]*(?:and[\s,+]*)*$/.test(i)?Math.round(o):void 0}function I(n,e){if(!Number.isFinite(n))return String(n);let t=Math.round(Math.abs(n)),o=Math.floor(t/60),s=t%60,i=[o?`${g(o,e)} h`:"",s||!o?`${g(s,e)} min`:""].filter(Boolean).join(" ");return n<0?`\u2212${i}`:i}var D=/^(\+?1[ .-]?)?\(?([2-9]\d\d)\)?[ .-]?(\d{3})[ .-]?(\d{4})(?: *(?:ext\.?|x|#) *(\d+))?$/i;function W(n,e){let t=n.trim(),o=/[-_](US|CA)\b/i.test(h(e))?D.exec(t):null;if(!o)return t;let[,s,i,c,d,u]=o;return`${s?.startsWith("+")?"+1 ":""}(${i}) ${c}-${d}${u?` ext. ${u}`:""}`}function P(n){let[,e="",t]=/^(.*?)(?: *(?:ext\.?|x|#) *(\d+))?$/i.exec(n.trim())??[],o=e.replace(/\D/g,"");return o.length<3?void 0:`tel:${e.startsWith("+")?"+":""}${o}${t?`;ext=${t}`:""}`}var L=()=>/Mac|iPhone|iPad|iPod/.test(globalThis.navigator?.userAgent??"");function q(n,e=L()){let t=encodeURIComponent(n.trim());return e?`https://maps.apple.com/?q=${t}`:`https://www.google.com/maps/search/?api=1&query=${t}`}var C=n=>n?.fields?.shape??{},U=(n,e)=>{let t=C(n);return Object.hasOwn(t,e)?$(t[e]):void 0},H=(n,e)=>{let t=n.computed,o=t&&Object.hasOwn(t,e)?t[e]:void 0;return typeof o=="object"?o.as:void 0};function te(n,e){return U(n,e)??(n&&H(n,e)==="duration"?"duration":void 0)}function re(n,e,t){return n==="duration"?typeof e=="number"?I(e,t):void 0:n==="phone"?typeof e=="string"?W(e,t):void 0:n==="place"&&typeof e=="string"?e.trim():void 0}function oe(n,e){if(!(typeof e!="string"||!e.trim()))return n==="phone"?P(e):n==="place"?q(e):void 0}export{S as a,B as b,G as c,Z as d,J as e,ne as f,te as g,re as h,oe as i};
@@ -0,0 +1,25 @@
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Ke}from"./chunk.SDO3U72B.js";import{$b as Dn,Fa as _n,Hc as jn,J as Cn,Ja as mt,Kc as Gn,La as Ln,Nc as Wn,Wa as Hn,ad as Fn,qd as Kn,vd as Fe,wc as Nn,wd as gt}from"./chunk.AW2T3KFV.js";import{a as We,b as _}from"./chunk.AJZBJBMO.js";var lo=We(w=>{"use strict";var At=Symbol.for("react.transitional.element"),Tr=Symbol.for("react.portal"),Mr=Symbol.for("react.fragment"),Or=Symbol.for("react.strict_mode"),Vr=Symbol.for("react.profiler"),Ir=Symbol.for("react.consumer"),Cr=Symbol.for("react.context"),_r=Symbol.for("react.forward_ref"),Lr=Symbol.for("react.suspense"),Hr=Symbol.for("react.memo"),no=Symbol.for("react.lazy"),Dr=Symbol.for("react.activity"),Jn=Symbol.iterator;function Nr(e){return e===null||typeof e!="object"?null:(e=Jn&&e[Jn]||e["@@iterator"],typeof e=="function"?e:null)}var oo={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ro=Object.assign,io={};function ge(e,t,n){this.props=e,this.context=t,this.refs=io,this.updater=n||oo}ge.prototype.isReactComponent={};ge.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ge.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function ao(){}ao.prototype=ge.prototype;function kt(e,t,n){this.props=e,this.context=t,this.refs=io,this.updater=n||oo}var Pt=kt.prototype=new ao;Pt.constructor=kt;ro(Pt,ge.prototype);Pt.isPureReactComponent=!0;var Qn=Array.isArray;function Et(){}var M={H:null,A:null,T:null,S:null},so=Object.prototype.hasOwnProperty;function Rt(e,t,n){var o=n.ref;return{$$typeof:At,type:e,key:t,ref:o!==void 0?o:null,props:n}}function jr(e,t){return Rt(e.type,t,e.props)}function Tt(e){return typeof e=="object"&&e!==null&&e.$$typeof===At}function Gr(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var eo=/\/+/g;function xt(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Gr(""+e.key):t.toString(36)}function Wr(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Et,Et):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function me(e,t,n,o,r){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case At:case Tr:a=!0;break;case no:return a=e._init,me(a(e._payload),t,n,o,r)}}if(a)return r=r(e),a=o===""?"."+xt(e,0):o,Qn(r)?(n="",a!=null&&(n=a.replace(eo,"$&/")+"/"),me(r,t,n,"",function(u){return u})):r!=null&&(Tt(r)&&(r=jr(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(eo,"$&/")+"/")+a)),t.push(r)),1;a=0;var d=o===""?".":o+":";if(Qn(e))for(var s=0;s<e.length;s++)o=e[s],i=d+xt(o,s),a+=me(o,t,n,i,r);else if(s=Nr(e),typeof s=="function")for(e=s.call(e),s=0;!(o=e.next()).done;)o=o.value,i=d+xt(o,s++),a+=me(o,t,n,i,r);else if(i==="object"){if(typeof e.then=="function")return me(Wr(e),t,n,o,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return a}function Xe(e,t,n){if(e==null)return e;var o=[],r=0;return me(e,o,"","",function(i){return t.call(n,i,r++)}),o}function Fr(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var to=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Kr={map:Xe,forEach:function(e,t,n){Xe(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Xe(e,function(){t++}),t},toArray:function(e){return Xe(e,function(t){return t})||[]},only:function(e){if(!Tt(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};w.Activity=Dr;w.Children=Kr;w.Component=ge;w.Fragment=Mr;w.Profiler=Vr;w.PureComponent=kt;w.StrictMode=Or;w.Suspense=Lr;w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=M;w.__COMPILER_RUNTIME={__proto__:null,c:function(e){return M.H.useMemoCache(e)}};w.cache=function(e){return function(){return e.apply(null,arguments)}};w.cacheSignal=function(){return null};w.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var o=ro({},e.props),r=e.key;if(t!=null)for(i in t.key!==void 0&&(r=""+t.key),t)!so.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(o[i]=t[i]);var i=arguments.length-2;if(i===1)o.children=n;else if(1<i){for(var a=Array(i),d=0;d<i;d++)a[d]=arguments[d+2];o.children=a}return Rt(e.type,r,o)};w.createContext=function(e){return e={$$typeof:Cr,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Ir,_context:e},e};w.createElement=function(e,t,n){var o,r={},i=null;if(t!=null)for(o in t.key!==void 0&&(i=""+t.key),t)so.call(t,o)&&o!=="key"&&o!=="__self"&&o!=="__source"&&(r[o]=t[o]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var d=Array(a),s=0;s<a;s++)d[s]=arguments[s+2];r.children=d}if(e&&e.defaultProps)for(o in a=e.defaultProps,a)r[o]===void 0&&(r[o]=a[o]);return Rt(e,i,r)};w.createRef=function(){return{current:null}};w.forwardRef=function(e){return{$$typeof:_r,render:e}};w.isValidElement=Tt;w.lazy=function(e){return{$$typeof:no,_payload:{_status:-1,_result:e},_init:Fr}};w.memo=function(e,t){return{$$typeof:Hr,type:e,compare:t===void 0?null:t}};w.startTransition=function(e){var t=M.T,n={};M.T=n;try{var o=e(),r=M.S;r!==null&&r(n,o),typeof o=="object"&&o!==null&&typeof o.then=="function"&&o.then(Et,to)}catch(i){to(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),M.T=t}};w.unstable_useCacheRefresh=function(){return M.H.useCacheRefresh()};w.use=function(e){return M.H.use(e)};w.useActionState=function(e,t,n){return M.H.useActionState(e,t,n)};w.useCallback=function(e,t){return M.H.useCallback(e,t)};w.useContext=function(e){return M.H.useContext(e)};w.useDebugValue=function(){};w.useDeferredValue=function(e,t){return M.H.useDeferredValue(e,t)};w.useEffect=function(e,t){return M.H.useEffect(e,t)};w.useEffectEvent=function(e){return M.H.useEffectEvent(e)};w.useId=function(){return M.H.useId()};w.useImperativeHandle=function(e,t,n){return M.H.useImperativeHandle(e,t,n)};w.useInsertionEffect=function(e,t){return M.H.useInsertionEffect(e,t)};w.useLayoutEffect=function(e,t){return M.H.useLayoutEffect(e,t)};w.useMemo=function(e,t){return M.H.useMemo(e,t)};w.useOptimistic=function(e,t){return M.H.useOptimistic(e,t)};w.useReducer=function(e,t,n){return M.H.useReducer(e,t,n)};w.useRef=function(e){return M.H.useRef(e)};w.useState=function(e){return M.H.useState(e)};w.useSyncExternalStore=function(e,t,n){return M.H.useSyncExternalStore(e,t,n)};w.useTransition=function(){return M.H.useTransition()};w.version="19.2.8"});var N=We((xa,uo)=>{"use strict";uo.exports=lo()});var wo=We(et=>{"use strict";var ei=Symbol.for("react.transitional.element"),ti=Symbol.for("react.fragment");function So(e,t,n){var o=null;if(n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:ei,type:e,key:o,ref:t!==void 0?t:null,props:n}}et.Fragment=ti;et.jsx=So;et.jsxs=So});var Ce=We((Oa,vo)=>{"use strict";vo.exports=wo()});var fe={focusId:null,relation:null,expanded:[],pins:{}},qe=e=>{let t=Number(e);return Number.isFinite(t)?t:null};function te(e){let t=new URLSearchParams;e.focusId&&t.set("focus",e.focusId),e.relation&&t.set("relation",e.relation),e.overview&&t.set("overview","1"),e.zoom&&t.set("zoom","1"),e.past&&t.set("past","1"),e.shown&&e.shown.length>0&&t.set("show",[...e.shown].sort().join(",")),e.selection!==void 0&&e.selection.length>0&&t.set("sel",[...e.selection].sort().join(",")),e.expanded.length>0&&t.set("expand",[...e.expanded].sort().join(","));for(let o of Object.keys(e.pins).sort()){let r=e.pins[o];t.set(`pin.${o}`,`${Be(r.x)},${Be(r.y)}`)}e.pan&&(e.pan.x!==0||e.pan.y!==0)&&t.set("pan",`${Be(e.pan.x)},${Be(e.pan.y)}`);for(let o of Object.keys(e.within??{}).sort()){let r=e.within[o];r.length>0&&t.set(`in.${o}`,r)}e.q&&e.q.trim().length>0&&t.set("q",e.q);let n=t.toString();return n?`#${n}`:"#"}function xr(e){return e&&e.startsWith("agg:")?`aggregate:${e.slice(4)}`:e}function $e(e){let t=e.includes("#")?e.slice(e.indexOf("#")+1):e,n=new URLSearchParams(t),o=Object.create(null);for(let[m,p]of n){if(!m.startsWith("pin."))continue;let[g,v]=p.split(","),k=g===void 0?null:qe(g),y=v===void 0?null:qe(v);k===null||y===null||(o[m.slice(4)]={x:k,y})}let r=Object.create(null);for(let[m,p]of n)!m.startsWith("in.")||p.length===0||(r[m.slice(3)]=p);let i=n.get("view");i&&i.length>0&&r.view===void 0&&(r.view=i);let a=n.get("pan")?.split(",")??[],d=a[0]===void 0?null:qe(a[0]),s=a[1]===void 0?null:qe(a[1]),u=(n.get("sel")??"").split(",").filter(m=>m.length>0).sort(),f=n.get("overview")==="1";return{...u.length>0?{selection:u}:{},...f?{overview:!0}:{},...n.get("zoom")==="1"?{zoom:!0}:{},...n.get("past")==="1"?{past:!0}:{},...n.get("show")?{shown:[...new Set(n.get("show").split(",").filter(Boolean))].sort()}:{},...d!==null&&s!==null?{pan:{x:d,y:s}}:{},...Object.keys(r).length>0?{within:r}:{},...n.get("q")?.trim()?{q:n.get("q")}:{},focusId:xr(n.get("focus")),relation:n.get("relation"),expanded:(n.get("expand")??"").split(",").filter(m=>m.length>0&&(f||!m.startsWith("kind:"))).sort(),pins:o}}function ia(e){let t=$e(e);return te(t)==="#"?{...t,overview:!0}:t}function aa(e){let t=te(e);return t==="#overview=1"?"":t}function Be(e){return Math.round(e*100)/100}function Bn(e,t){return te(e)===te(t)}var qn="edge:";function $n(e){if(!e.startsWith(qn))return null;let t=e.slice(qn.length).split(":");if(t.length!==3)return null;let[n,o,r]=t;if(!n||!o||!r)return null;try{return{kind:decodeURIComponent(n),from:decodeURIComponent(o),to:decodeURIComponent(r)}}catch{return null}}function ht(e){let{pan:t,...n}=e;return{...n,pins:{}}}function B(e,t){if(t===e.focusId)return{...e,focusId:t};let n=ht(e);return{...n.within?.q!==void 0?ae(n,"q",null):n,focusId:t}}function zn(e,t){return{...e,relation:t}}function ae(e,t,n){let o={...e.within??{}};if(n===null?delete o[t]:o[t]=n,Object.keys(o).length===0){let{within:r,...i}=e;return i}return{...e,within:o}}function pe(e,t){if(t!==e.overview&&(e=ht(e)),!t){let n=e.expanded.filter(o=>!o.startsWith("kind:"));return{...e,overview:!1,expanded:n}}return{...e,overview:t}}function ze(e,t){if(t.length===0){let{selection:n,...o}=e;return o}return{...e,selection:[...t]}}function Ve(e,t){if(t!==(e.zoom===!0)&&(e=ht(e)),!t){let{zoom:n,...o}=e;return o}return{...e,zoom:!0}}function Ue(e,t){let n=new Set(e.expanded);return n.has(t)?n.delete(t):n.add(t),{...e,expanded:[...n].sort()}}var Ze="aggregate:",Ye="kind:";function St(e){return`${Ye}${e}`}function ye(e){return e.startsWith(Ye)?e.slice(Ye.length):null}var da="kinds:beyond";function Er(e){let t=ye(e);return t?[t]:se(e)}function ne(...e){return`${Ze}${[...e].sort().join("+")}`}function Un(e){return e.startsWith(Ze)}function se(e){return!Un(e)||e.includes("|")?[]:e.slice(Ze.length).split("+").filter(Boolean)}function Yn(e,t,n={}){let o=ye(t);if(o!==null&&e.overview&&n.ownPicture!==!0)return Ue(e,t);let r=o!==null?ne(o):t;if(e.zoom&&e.focusId===r&&!(o!==null&&n.carry))return Ve(e,!1);if(o!==null&&n.carry){let i=pe({...B(e,r),relation:null},!1);return ae(Ve(i,!0),"q",n.carry)}return Ve({...B(e,r),relation:null},!0)}function Ar(e,t,n){return ae(pe(B(e,ne(t)),!1),"view",n)}function ua(e,t){return e.id<t.id?-1:e.id>t.id?1:0}var Zn="aggregate:";function wt(e){return e.startsWith(Zn)&&e.includes("|")}var vt=e=>e?.off===!0,kr=e=>e!==void 0&&!vt(e)&&(e.fast!==void 0||e.thinking!==void 0||e.answer!==void 0||e.decide!==void 0||e.complete!==void 0||e.turn!==void 0),Xn=e=>e!==void 0&&!vt(e)&&(e.fast!==void 0||e.decide!==void 0),Pr=e=>e?.suggestOnOpen!==!1&&Xn(e),Rr=e=>e?.hoverChips===!0&&Xn(e);var bt={};var co=_(N(),1),qr={turns:[],outcomes:new Map,busy:!1,pending:null,draft:null,draftNote:null},fo=e=>`graview:seat:${e}`;function Br(e){if(!e)return{};try{let t=sessionStorage.getItem(e);if(!t)return{};let n=JSON.parse(t);return{...Array.isArray(n.turns)?{turns:n.turns}:{},...Array.isArray(n.outcomes)?{outcomes:new Map(n.outcomes)}:{},...n.draft?.drawn?{draft:n.draft}:{}}}catch{return{}}}function $r(e,t){if(e)try{sessionStorage.setItem(e,JSON.stringify({turns:t.turns.slice(-40),outcomes:[...t.outcomes],draft:t.draft}))}catch{}}function Mt(e){let t=e===null?null:fo(e),n={...qr,...Br(t)},o=new Set,r=(i,a=!0)=>{n=i,a&&$r(t,n);for(let d of[...o])d()};return{get:()=>n,subscribe(i){return o.add(i),()=>void o.delete(i)},setTurns:i=>r({...n,turns:i(n.turns)}),settle:(i,a)=>r({...n,outcomes:new Map(n.outcomes).set(i,a)}),setBusy:i=>r({...n,busy:i},!1),ask:i=>r({...n,pending:i.trim()||null}),takePending(){let i=n.pending;return i!==null&&r({...n,pending:null},!1),i},setDraft:(i,a=null)=>r({...n,draft:i,draftNote:a})}}function zr(e){return(0,co.useSyncExternalStore)(e.subscribe,e.get,e.get)}var yo=_(N(),1),Ur={entries:[],ghost:null,loaded:!1};function po(e,t){let n=new Map(e.map(o=>[o.id,o]));for(let o of t)n.set(o.id,{...n.get(o.id),...o});return[...n.values()].sort((o,r)=>o.at<r.at?1:o.at>r.at?-1:0)}function Ot(e){let t=Ur,n=new Set,o=r=>{t=r;for(let i of[...n])i()};return{get:()=>t,subscribe:r=>(n.add(r),()=>n.delete(r)),record:r=>{o({...t,entries:po(t.entries,[r])}),Promise.resolve(e()?.keep?.(r)).catch(i=>{console.warn("The host did not keep an AI interaction:",i)})},setGhost:r=>o({...t,ghost:r}),load:()=>{if(t.loaded)return;o({...t,loaded:!0});let r=e()?.load;r&&Promise.resolve(r()).then(i=>o({...t,entries:po(t.entries,i)})).catch(i=>{console.warn("The host's AI interactions could not be read:",i)})}}}function Yr(e){return(0,yo.useSyncExternalStore)(e.subscribe,e.get,e.get)}function mo(e){return e?.closest?.("[data-graview-pick]")?.getAttribute("data-graview-pick")??null}var Je=_(N(),1),Qe=(0,Je.createContext)(void 0),Zr=()=>(0,Je.useContext)(Qe);var A=_(N(),1),Ie=(0,A.createContext)(null);function ho(){return(0,A.useContext)(Ie)}function Xr(e,t){let n=ho(),o=(0,A.useMemo)(()=>n?n.live.seenBy(t):e,[n,e,t]),r=(0,A.useRef)(0),i=(0,A.useCallback)(a=>o.subscribe(()=>{r.current+=1,a()}),[o]);return(0,A.useSyncExternalStore)(i,()=>r.current,()=>0),o}var Jr=Ke(()=>(__graviewPreload(import.meta.url,["./chunk.TI4OSTQV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.E2AJ7U5Z.js"))),go,Qr=400;function Vt(e,t,n){let o=(0,A.useContext)(Ie),r=o!==null&&o.owns(e,t),[i,a]=(0,A.useState)(null),[d,s]=(0,A.useState)(go);(0,A.useEffect)(()=>{if(d||r||i===null)return;let x=!0;return Jr().then(V=>{go=V,x&&s(V)},()=>{}),()=>{x=!1}},[d,r,i]);let[u,f]=(0,A.useState)(0),m=(0,A.useMemo)(()=>r||i===null||i>=e.log.length||!d?void 0:d.askArchived(e,i,n)??d.askDeclaration(n,i),[r,e,i,n,d,u]),p=m&&"waiting"in m?m.waiting:void 0,g=m&&"seq"in m?m:null,[v,k]=(0,A.useState)(void 0);(0,A.useEffect)(()=>{if(!p)return;let x=!0,V=setTimeout(()=>x&&k(p),Qr);return p.then(()=>x&&f(O=>O+1)),()=>{x=!1,clearTimeout(V)}},[p]);let y=p!==void 0&&v!==p||g!==null,b=(0,A.useMemo)(()=>{if(r||i===null||i>=e.log.length||!d||y)return null;try{let x=d.pastAt(e,i,n);return{seq:i,at:x.past?.at,store:x}}catch{return null}},[r,e,i,n,d,y,u]),h=(0,A.useRef)(null),E=y?h.current:b;(0,A.useEffect)(()=>{h.current=E},[E]);let P=(0,A.useCallback)(x=>a(x===null?null:x>=e.log.length?Number.POSITIVE_INFINITY:x),[e]),D=(0,A.useCallback)((x,V)=>[e,E?.store].some(O=>O!==void 0&&(O===x||O.seenBy(V)===x)),[e,E]),C=i!==null,G=(0,A.useMemo)(()=>({past:E,open:C,show:P,live:e,host:n,owns:D,archive:g}),[E,C,P,e,n,D,g]);return r?o:G}var bo=e=>`graview:setting:${e}`;function xo(){return localStorage}function Eo(e,t){try{let n=(t??xo()).getItem(bo(e.name));if(n!==null&&e.options.some(o=>o.value===n))return n}catch{}return e.initial}function Ao(e,t,n){try{(n??xo()).setItem(bo(e.name),t)}catch{}}function ko(e,t){if(typeof document>"u")return;let n=document.documentElement;if(e.honored==="root-font-size"){n.style.fontSize=t===e.initial?"":t;return}let o=`graview${e.name.replace(/-([a-z0-9])/g,(r,i)=>i.toUpperCase()).replace(/^[a-z]/,r=>r.toUpperCase())}`;t===e.initial?delete n.dataset[o]:n.dataset[o]=t}var L=_(N(),1);function It(e){return Fe(e)}var ni=12,oi=4;function ri(e,t,n){let o=It(t);return e.get(o)??{participant:o,who:t.id??t.kind,at:null,mode:"docked",since:n,trail:[]}}var tt=(e,t)=>t===null||e[e.length-1]===t?e:[...e,t].slice(-ni);function Po(e,t){let n=e.filter(r=>r.length>0);if(n.length===0)return null;if(n.length<=oi)return n[0];let o=new Set(n.map(r=>t(r)).filter(r=>r!==void 0));return o.size===1?St([...o][0]):n[0]}function Ct(e,t,n){let o=new Map(e);if(t.type==="rest"){for(let[a,d]of e)d.mode!=="asking"&&d.mode!=="docked"&&t.at-d.since>=t.holdMs&&o.set(a,{...d,mode:"docked",at:null,trail:[],say:void 0,confidence:void 0});return o}if(t.author.kind!=="agent")return o;let r=ri(e,t.author,t.at),i=a=>o.set(r.participant,{...r,...a,since:t.at});switch(t.type){case"read":{let a=Po(t.ids,n);return i({at:a,mode:"reading",trail:tt(r.trail,a)}),o}case"about-to-write":case"write":{let a=Po(t.ids,n);return i({at:a,mode:"writing",trail:tt(r.trail,a),say:void 0,confidence:void 0}),o}case"refused":return i({at:t.where,mode:"refused",say:t.say,confidence:void 0,trail:tt(r.trail,t.where)}),o;case"asking":return i({at:t.where??r.at,mode:"asking",say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},trail:tt(r.trail,t.where)}),o;case"said":return i({say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},...t.caption?{caption:t.caption}:{}}),o;case"over":return i({over:t.over}),o;case"home":return i({at:null,mode:"docked",trail:[],say:void 0,confidence:void 0,over:null}),o;default:return o}}var Ro="graview:session";function To(e){let t=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);try{let n=e??sessionStorage,o=n.getItem(Ro);if(o)return o;let r=t();return n.setItem(Ro,r),r}catch{return t()}}var _t={name:"share-where",title:"Where you are",description:"Whether the others here see which stop you are on.",honored:"root-attribute",options:[{value:"shared",label:"Shown"},{value:"private",label:"Hidden"}],initial:"shared"},Lt={name:"share-over",title:"What you point at",description:"Whether the others see the thing under your pointer, outlined in your color.",honored:"root-attribute",options:[{value:"private",label:"Kept to yourself"},{value:"shared",label:"Outlined for others"}],initial:"private"},Mo=[_t,Lt],ai=800;function Oo(e){let{channel:t,store:n,view:o,principal:r,session:i,robots:a,seatWho:d,settingValues:s,setView:u,ttlMs:f=1e4,people:m,seats:p}=e,[g,v]=(0,L.useState)(()=>new Map),[k,y]=(0,L.useState)(null),[b,h]=(0,L.useState)(null),[E,P]=(0,L.useState)(null),D=typeof r.id=="string"&&r.id.length>0,C=D&&(s[_t.name]??_t.initial)==="shared",G=C&&(s[Lt.name]??Lt.initial)==="shared",x=It({kind:r.kind,...r.id?{id:r.id}:{},session:i}),V=D?Hn(r,{graph:n.graph,schema:n.schema,...p?{seats:p}:{},...m?{people:m}:{}}):"",O=d?a.get(`agent:${d}:${i}`):void 0,W=(0,L.useMemo)(()=>!t||!C?null:{participant:x,kind:r.kind,name:V,...r.onBehalfOf?.id?{onBehalfOf:r.onBehalfOf.id,...r.onBehalfOf.name?{onBehalfOfName:r.onBehalfOf.name}:{}}:{},hue:Dn(r.id??"nobody"),stop:E??te(o),...G?{over:k}:{},...O?{robot:{at:O.at,mode:O.mode}}:{},at:new Date().toISOString()},[t,C,G,x,V,r.id,r.kind,r.onBehalfOf?.id,r.onBehalfOf?.name,o,E,k,O?.at,O?.mode]);(0,L.useEffect)(()=>{if(!t||!W)return;t.here(W);let I=setInterval(()=>t.here({...W,at:new Date().toISOString()}),ai);return()=>clearInterval(I)},[t,W]),(0,L.useEffect)(()=>t?t.onWho(K=>v(gt(new Map,K,Date.now(),f))):void 0,[t,f]);let Z=g.size>0;(0,L.useEffect)(()=>{if(!Z)return;let I=setInterval(()=>{v(K=>{let Q=gt(K,[],Date.now(),f);return Q.size===K.size?K:Q})},Math.max(250,Math.min(1e3,f/4)));return()=>clearInterval(I)},[Z,f]),(0,L.useEffect)(()=>{if(!t||typeof window>"u")return;let I=()=>t.leave();return window.addEventListener("pagehide",I),()=>window.removeEventListener("pagehide",I)},[t]),(0,L.useEffect)(()=>{if(!G||typeof document>"u")return;let I=null,K=Q=>{let Ee=mo(Q.target);Ee!==I&&(I=Ee,y(Ee))};return document.addEventListener("pointermove",K,{passive:!0}),()=>document.removeEventListener("pointermove",K)},[G]);let X=(0,L.useRef)(null),$=b?g.get(b)??null:null,de=(0,L.useCallback)(I=>{X.current=null,h(I)},[]);return(0,L.useEffect)(()=>{if(b){if(!$){h(null);return}$.stop!==X.current?.stop&&(X.current={stop:$.stop,at:Date.now()},u($e($.stop)))}},[b,$,u]),(0,L.useEffect)(()=>{let I=X.current;!b||I===null||Date.now()-I.at<400||Bn(o,$e(I.stop))||h(null)},[o,b]),(0,L.useEffect)(()=>{if(!b||typeof document>"u")return;let I=K=>{K.key==="Escape"&&h(null)};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[b]),(0,L.useMemo)(()=>({who:g,sharing:W?{participant:x,name:V}:null,following:$,follow:de,sayWhere:P}),[g,W,x,V,$,de])}var U=_(N(),1);function Vo(e){return Fe(e.author)}function si(e,t){return e.length>1?"co-edited":t==="rule"?"rule":t==="agent"?"autonomous":"directed"}function Io(e,t,n,o,r){let i=new Map;for(let[s,u]of e)o-u.at<r&&i.set(s,u);let a=new Set(n.flatMap(s=>s.nodeIds)),d=(s,u,f)=>{let m=i.get(s),p=m?.participants.includes(Vo(u))?m.participants:[...m?.participants??[],Vo(u)];i.set(s,{at:o,manner:si(p,u.author.kind),intent:u.intent,wrote:(m?.wrote??!1)||(f.wrote??!1),read:(m?.read??!1)||(f.read??!1),broke:(m?.broke??!1)||a.has(s),participants:p})};for(let s of t){for(let u of s.writes)d(u,s,{wrote:!0});for(let u of s.reads)s.writes.includes(u)||d(u,s,{read:!0})}for(let s of n)for(let u of s.nodeIds){let f=i.get(u);i.set(u,{at:o,manner:f?.manner??"rule",intent:f?.intent??s.message,wrote:f?.wrote??!1,read:f?.read??!1,broke:!0,participants:f?.participants??["rule::"]})}return i}var li=2600;function Co(e,t=li){let[n,o]=(0,U.useState)(()=>new Map),r=(0,U.useRef)(n);r.current=n;let i=(0,U.useRef)(null),a=(0,U.useCallback)(s=>{r.current=s,o(s),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{r.current=new Map,o(new Map)},t)},[t]);(0,U.useEffect)(()=>{let s=e.violations(),u=e.subscribe((f,m)=>{let p=e.violations(),g=Wn(e.allInvariants(),s,p).introduces;s=p,a(Io(r.current,m,g.map(v=>({nodeIds:v.nodeIds,message:v.message})),Date.now(),t))});return()=>{u(),i.current&&clearTimeout(i.current)}},[e,t,a]);let d=(0,U.useCallback)(s=>{s.reads.length!==0&&a(Io(r.current,[di(s)],[],Date.now(),t))},[t,a]);return{activity:n,noteAttention:d}}function di(e){return{id:`attention:${e.intent}`,seq:-1,batch:"attention",author:e.author,intent:e.intent,mutation:null,primitives:[],reads:e.reads,writes:[],at:new Date().toISOString()}}var l=_(N(),1);function _o(){let e=null,t=new Set,n=new Set,o=r=>{for(let i of n)i(r)};return{subscribe(r){return t.add(r),t.size===1&&o(!0),()=>{t.delete(r),t.size===0&&(e=null,o(!1))}},snapshot:()=>e,set(r){if(!(e===r||e&&r&&e.x===r.x&&e.y===r.y)){e=r;for(let i of t)i()}},get listeners(){return t.size},onActive(r){return n.add(r),()=>void n.delete(r)}}}var nt=_(N(),1),ui=e=>e.definitions.some(t=>_n(t).size>0);function Lo(e,t,n){let[o,r]=(0,nt.useState)(void 0),i=(n.roles??[]).join("\0");return(0,nt.useEffect)(()=>{if(!t||!ui(e.schema)){r(void 0);return}let a=!0,d=!1,s=e.graph,u=()=>{d||(d=!0,queueMicrotask(()=>{d=!1,a&&e.reread()}))},f=Ln(t,{kind:n.kind,...n.id===void 0?{}:{id:n.id},...n.roles?{roles:n.roles}:{}},u);return mt(s,f.read),r(f),e.reread(),()=>{a=!1,mt(s,void 0)}},[e,t,n.kind,n.id,i]),o}function Ho(){let e=!1,t=new Set;return{moving:()=>e,set(n){if(n!==e){e=n;for(let o of t)o()}},subscribe(n){return t.add(n),()=>t.delete(n)}}}var le=_(Ce(),1),ci="graview:place-menu",_e=(0,l.createContext)(null),Go=(0,l.createContext)("scene");function fi({mode:e,children:t}){return(0,le.jsx)(Go.Provider,{value:e,children:t})}function pi(){return(0,l.useContext)(Go)}var Wo={kind:"human"},yi=[],mi=[],gi=[],Ht=[];function Fo(e,t){let n=(0,l.useId)();(0,l.useEffect)(()=>{if(!globalThis.__graviewWatch)return;let o=t??Wo,r=()=>Gn(e,o,n);r();let i,a=e.subscribe(()=>{clearTimeout(i),i=setTimeout(r,250)});return()=>{clearTimeout(i),a(),globalThis.__graviewWatch?.unseen?.({words:[],from:n,gone:!0})}},[e,t,n])}var hi={off:!0};function Si({store:e,views:t,initialView:n,scheme:o="dark",initialSelection:r,principal:i,seats:a=yi,onSeat:d,people:s=mi,memory:u,presenceTtlMs:f,app:m,settings:p=m?.settings??gi,presence:g,brand:v,locale:k,timeZone:y,onKeepLens:b,providers:h,ai:E,files:P,resolveApp:D,history:C,linkedRecords:G,menuSections:x,keptViews:V,subscriptions:O,signIn:W,view:Z,onViewChange:X,children:$}){let de=(0,l.useContext)(_e),I=x??de?.menuSections,K=W??de?.signIn,Q=V??de?.keptViews,[Ee,dr]=(0,l.useState)(null),ue=Ee??i??a[0]?.principal??Wo,He=Vt(e,ue,C),Xt=He.past&&He.live===e?He.past.store:e,H=(0,l.useMemo)(()=>Xt.seenBy(ue),[Xt,ue]);Fo(e,ue);let[re]=(0,l.useState)(()=>To(u)),[Jt,ur]=(0,l.useState)(!1),Qt=(0,l.useCallback)(()=>ur(!0),[]),ie=(0,l.useMemo)(()=>g?[...p,...Mo]:p,[p,g]),[ut]=(0,l.useState)(()=>n??Gt(t,e.schema)),[cr,en]=(0,l.useState)(()=>ze(ut??fe,r??ut?.selection??[])),Ae=(0,l.useRef)(ut??fe).current,[tn,fr]=(0,l.useState)(null),[nn,pr]=(0,l.useState)(null),J=(0,l.useContext)(_e),[on]=(0,l.useState)(()=>J?.seatTalk??Mt(v?.name??e.schema.kinds.join(","))),ct=E??J?.ai??bt,De=(0,l.useMemo)(()=>ct.off?hi:ct,[ct]),rn=(0,l.useRef)(De.interactions);rn.current=De.interactions;let[an]=(0,l.useState)(()=>J?.aiDesk??Ot(()=>rn.current)),[yr]=(0,l.useState)(()=>J?.subscriptions??jn()),sn=O??J?.subscriptions??yr,ft=b??J?.onKeepLens,Ne=m??J?.app,je=k??J?.locale,mr=v?.locale??Ne?.brand?.locale,Ge=y??J?.timeZone;Cn({reader:je,app:mr,readerTimeZone:Ge,appTimeZone:v?.timeZone??Ne?.brand?.timeZone});let ln=(0,l.useRef)(null),dn=(0,l.useCallback)(c=>{ln.current=c},[]),un=(0,l.useCallback)(c=>ln.current?.whereIs(c)??null,[]),[cn]=(0,l.useState)(()=>_o()),[fn]=(0,l.useState)(()=>Ho()),[pt,gr]=(0,l.useState)(null),[ke,pn]=(0,l.useState)(()=>new Map),Pe=(0,l.useRef)(ke);Pe.current=ke;let Re=(0,l.useRef)(null),yt=(0,l.useCallback)(c=>H.graph.getNode(c)?.kind,[H]),ee=(0,l.useCallback)(c=>{let S=Ct(Pe.current,c,yt);Pe.current=S,pn(S),Re.current&&clearTimeout(Re.current),[...S.values()].some(T=>T.mode!=="docked"&&T.mode!=="asking")&&(Re.current=setTimeout(()=>{let T=Ct(Pe.current,{type:"rest",at:Date.now(),holdMs:jt},yt);Pe.current=T,pn(T)},jt+20))},[yt]),yn=(0,l.useCallback)(c=>ee({...c,at:c.at??Date.now()}),[ee]),mn=(0,l.useCallback)(c=>{gr(c),c&&ee({type:"home",author:{kind:"agent",id:c,session:re},at:Date.now()})},[ee,re]);(0,l.useEffect)(()=>H.subscribe((c,S)=>{for(let R of S)R.author.kind==="agent"&&ee({type:"write",author:R.author,ids:R.writes,at:Date.now()})}),[H,ee]),(0,l.useEffect)(()=>()=>{Re.current&&clearTimeout(Re.current)},[]);let z=(0,l.useMemo)(()=>({...ue,session:re}),[ue,re]),gn=Lo(H,G,z),hn=(0,l.useCallback)(c=>{dr(c),d?.(c)},[d]),[Te,hr]=(0,l.useState)(()=>Object.fromEntries(ie.map(c=>[c.name,Eo(c,u)])));(0,l.useEffect)(()=>{for(let c of ie)ko(c,Te[c.name]??c.initial)},[ie,Te]);let Sn=(0,l.useCallback)((c,S)=>{let R=ie.find(T=>T.name===c);!R||!R.options.some(T=>T.value===S)||(Ao(R,S,u),hr(T=>({...T,[c]:S})))},[ie,u]),[wn,Sr]=(0,l.useState)(null),{activity:vn,noteAttention:bn}=Co(H),xn=(0,l.useCallback)(c=>{bn(c),ee({type:"read",author:c.author,ids:c.reads,at:Date.now()})},[bn,ee]),ce=(0,l.useCallback)(c=>{if(ye(c)!==null||se(c).length>0||wt(c))return!0;let S=$n(c);return S?H.graph.allEdges().some(R=>R.kind===S.kind&&R.from===S.from&&R.to===S.to):H.graph.getNode(c)!==void 0},[H]),En=(0,l.useCallback)(c=>{let S=c.selection??Ht,R=S.filter(ce),T=R.length===S.length?c:ze(c,R);return T.focusId!==null&&!ce(T.focusId)&&(T=B(T,null)),T},[ce]),Me=(0,l.useCallback)(c=>{let S=En(c),R=jo(H,z,S.shown);if(S.focusId!==null&&R.size>0){let T=se(S.focusId),In=H.graph.getNode(S.focusId);(T.length>0?T.every(br=>R.has(br)):In?R.has(In.kind):!1)&&(S={...S,focusId:null})}if(!S.overview&&S.focusId===null){let T=Ae.focusId!==null&&!ce(Ae.focusId)?Gt(t,e.schema)??{...fe,overview:!0}:Ae;T.focusId!==null&&ce(T.focusId)?S={...S,focusId:T.focusId}:T.overview===!0&&(S={...S,overview:!0})}return S},[En,ce,H,Ae,z,t,e.schema]),q=Me(Z??cr),An=(0,l.useMemo)(()=>jo(H,z,q.shown),[H,z,q.shown]),kn=(0,l.useMemo)(()=>[...H.modules.administered.entries()].map(([c,S])=>{let R=H.mayAdminister(c,z);return{name:c,...S.description?{description:S.description}:{},kinds:S.kinds??[],canShow:R,shown:R&&(q.shown??[]).includes(c)}}),[H,z,q.shown]),Oe=(0,l.useCallback)(c=>{let S=R=>Me(typeof c=="function"?c(R):c);if(Z!==void 0){X?.(S(Z));return}X&&X(S(q)),en(R=>S(R))},[q,X,Z,Me]);(0,l.useEffect)(()=>{Z===void 0&&en(c=>{let S=Me(c);return S===c?c:S})},[q,Z,Me]);let Pn=q.selection??Ht,Rn=(0,l.useCallback)(c=>{Oe(S=>ze(S,typeof c=="function"?c(S.selection??Ht):c))},[Oe]),{who:Tn,following:Mn,follow:On,sayWhere:wr,sharing:Vn}=Oo({channel:g,store:H,view:q,principal:z,session:re,robots:ke,seatWho:pt,settingValues:Te,setView:Oe,seats:a,people:s,...f!==void 0?{ttlMs:f}:{}}),vr=(0,l.useMemo)(()=>({store:H,scheme:o,views:t,view:q,setView:Oe,homeView:Ae,selection:Pn,setSelection:Rn,menuAt:tn,setMenuAt:fr,whereIs:un,pointer:cn,motion:fn,registerScene:dn,robots:ke,noteSeat:yn,seatWho:pt,registerSeatWho:mn,actsDoor:nn,registerActsDoor:pr,seatTalk:on,aiDesk:an,...u?{memory:u}:{},who:Tn,following:Mn,follow:On,sayWhere:wr,sharing:Vn,session:re,ai:De,resolveApp:D,linkedRecords:G,menuSections:I,...Q?{keptViews:Q}:{},subscriptions:sn,signIn:K,linkedReads:gn,movedByHand:Jt,noteMoved:Qt,emphasis:wn,setEmphasis:Sr,activity:vn,noteAttention:xn,principal:z,seats:a,people:s,takeSeat:hn,settings:ie,settingValues:Te,chooseSetting:Sn,hiddenKinds:An,administered:kn,...h?{providers:h}:{},...v?{brand:v}:{},...ft?{onKeepLens:ft}:{},app:Ne,...je?{locale:je}:{},...Ge?{timeZone:Ge}:{}}),[H,o,t,q,Oe,Pn,Rn,tn,un,cn,fn,dn,ke,yn,pt,mn,nn,on,an,u,Tn,Mn,On,Vn,re,De,D,G,I,Q,sn,K,gn,Jt,Qt,wn,vn,xn,z,a,s,hn,ie,Te,Sn,An,kn,h,v,ft,Ne,je,Ge]);return(0,le.jsx)(_e.Provider,{value:vr,children:(0,le.jsx)(Ie.Provider,{value:He,children:(0,le.jsx)(Ei,{children:P?(0,le.jsx)(Qe.Provider,{value:P,children:$}):$})})})}var Ko=(0,l.createContext)(null),Dt,Nt=new Set,wi=e=>(Nt.add(e),()=>void Nt.delete(e)),Do=()=>Dt;function vi(e){if(!Dt){Dt=e;for(let t of[...Nt])t()}}var bi=300;function xi(e){let t=0;return async(n,o)=>{let r=++t;return await new Promise(i=>setTimeout(i,bi)),r===t?e(n,o):[]}}function Ei({children:e}){let{store:t,view:n,views:o,principal:r,hiddenKinds:i,selection:a,ai:d}=oe(),s=ot(),u=n.q,f=n.focusId,m=!!(u&&u.trim().length>0),p=(0,l.useSyncExternalStore)(wi,Do,Do),g=(0,l.useMemo)(()=>m&&p?{flagged:new Set(t.violations().flatMap(E=>E.nodeIds)),touched:p.touchWeights(t.log.all())}:null,[t,s,m,p]),v=f?t.graph.getNode(f)?.kind??ye(f)??(se(f).length===1?se(f)[0]:void 0):void 0,k=(0,l.useMemo)(()=>d.near&&xi(d.near),[d.near]),y=(0,l.useMemo)(()=>!u||!g||!p?null:p.search(t,u,{...v?{inKind:v}:{},principal:r,places:o.places(),kinds:t.schema.kinds.filter(E=>!i.has(E)),from:[...a,...f&&t.graph.has(f)?[f]:[]],flagged:g.flagged,touched:g.touched,limit:200,rank:k}),[t,u,r,o,i,a,f,v,g,k]),[b,h]=(0,l.useState)();return(0,l.useEffect)(()=>void y?.later?.then(E=>h([y,E])),[y]),(0,le.jsx)(Ko.Provider,{value:b?.[0]===y?b[1]:y,children:e})}var No=new WeakMap;function as(e){let t=No.get(e);return t||No.set(e,t=new Set(e.matched)),t}function Ai(){return(0,l.useContext)(Ko)}function oe(){let e=(0,l.useContext)(_e);if(!e)throw new Error("useGraview must be used inside a <GraviewProvider>.");return e}function Wt(){return(0,l.useContext)(_e)??null}function ot(){let{store:e}=oe(),t=(0,l.useRef)(null),n=(0,l.useRef)(null),o=(0,l.useCallback)(()=>(n.current!==e&&(n.current=e,t.current=null),t.current??=e.graph.allNodes(),t.current),[e]),r=(0,l.useCallback)(i=>e.subscribe(()=>{t.current=null,i()}),[e]);return(0,l.useSyncExternalStore)(r,o,o)}function ki(e){let{store:t}=oe(),n=(0,l.useCallback)(r=>t.subscribe(r),[t]),o=(0,l.useCallback)(()=>e===null?void 0:t.graph.getNode(e),[t,e]);return(0,l.useSyncExternalStore)(n,o,o)}function jo(e,t,n){let o=new Set(e.modules.disabledKinds);for(let r of e.kindsKeptFrom(t))o.add(r);for(let[r,i]of e.modules.administered)if(!(e.mayAdminister(r,t)&&(n??[]).includes(r)))for(let a of i.kinds??[])o.add(a);return o}var jt=2600;var qo=new WeakSet,Pi=e=>qo.has(e),Ri=e=>void qo.add(e);function Gt(e,t){let n=Kn(e.arrangement?.()?.first,t,e.places());if(!(!n||n.to==="home"))return n.to==="place"?{...fe,focusId:ne(n.place.kind),within:{view:n.place.as}}:{...fe,focusId:ne(n.kind)}}var Bo=_(N(),1),Ti=(0,Bo.createContext)(!1);var rt=Symbol.for("graview.default-view");function $o(e){return Object.defineProperty(e,rt,{value:!0,enumerable:!1}),e}function zo(e){return typeof e=="function"&&e[rt]===!0}var it=Symbol.for("graview.replaces-page");function Uo(e){return Object.defineProperty(e,it,{value:!0,enumerable:!1}),e}function Yo(e){return typeof e=="function"&&e[it]===!0}function Mi(e){return Fn(e)}function Oi(e,t){if(t===e)return e;for(let r of t.registrations())e.register(r.kind,r,r.view,r);let n=t.arrangement?.();n&&e.arrange?.(n);let o=t.homeView?.();return o&&e.home?.(o),e}var F=_(N(),1),Y=_(Ce(),1),Ft=new Set,at=0;function Jo(e){return()=>{at+=1;let t=e();return t.then(()=>void(at-=1),()=>void(at-=1)),t}}var Vi=()=>at,Qo=!1,er=!1,st=new Set;function Ii(){Qo=!0}function Ci(){er=!0;for(let e of[...st])e();st.clear()}var tr=()=>er||!Qo;function _i(e){return tr()?(e(),()=>{}):(st.add(e),()=>void st.delete(e))}var Zo=!1;function Kt(){for(let e of[...Ft])e()}function Li(){Zo||typeof window>"u"||(Zo=!0,window.addEventListener("online",Kt))}function qt(e){let t,n=!1,o=!1,r,i=0,a=new Set,d=()=>{i+=1;for(let p of[...a])p()},s=p=>(a.add(p),()=>void a.delete(p)),u=()=>i,f=()=>void m().catch(()=>{});function m(){if(n)return Promise.resolve(t);if(r)return r;let p=e().then(g=>(t=g,n=!0,o=!1,r=void 0,Ft.delete(f),d(),g),g=>{throw r=void 0,o=!0,Ft.add(f),Li(),d(),g});return p.catch(()=>{}),r=p,p}return{load:m,prefetch:f,get current(){return t},get failed(){return o},part(p,g={}){let v=g.what??"This part";function k(h){(0,F.useSyncExternalStore)(s,u,u);let E=(0,F.useRef)(null),P=(0,F.useRef)(null),D=(0,F.useRef)(!1);return(0,F.useEffect)(()=>{o&&r===void 0&&f()},[]),n&&typeof document<"u"&&E.current!==null&&document.activeElement===E.current&&(D.current=!0),(0,F.useLayoutEffect)(()=>{if(!(!n||!D.current)){D.current=!1;for(let C=P.current?.nextElementSibling??null;C!==null;C=C.nextElementSibling){let G=C.matches(Xo)?C:C.querySelector(Xo);if(G instanceof HTMLElement){G.focus();return}}}}),n?(0,Y.jsxs)(Y.Fragment,{children:[D.current?(0,Y.jsx)("span",{ref:P,hidden:!0}):null,p(t,h)]}):g.quiet?null:(0,Y.jsx)(Hi,{what:v,button:E,...g.as?{as:g.as}:{}})}let y=(0,F.lazy)(Jo(()=>m().then(()=>({default:k}),()=>({default:k}))));function b(h){let[E]=(0,F.useState)(()=>n||o);return(0,F.createElement)(E?k:y,h)}return b}}}var Xo="button,a[href],input,select,textarea,[tabindex]:not([tabindex='-1'])";function Hi({what:e,button:t,as:n="p"}){let r=typeof navigator<"u"&&navigator.onLine===!1?`${e} will load when you're back online.`:`${e} didn't load.`;return(0,Y.jsxs)(n,{"data-testid":"lazy-part-missing",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:[(0,Y.jsx)("span",{role:"status",children:r})," ",(0,Y.jsx)("button",{ref:t,type:"button","data-testid":"lazy-part-retry",onClick:Kt,style:{font:"inherit",fontWeight:600,color:"var(--graview-ink)",background:"none",border:"1px solid var(--graview-edge)",borderRadius:6,padding:"2px 10px"},children:"Try again"})]})}var Se=_(N(),1);function Di(){let{selection:e,setSelection:t}=oe();return(0,Se.useMemo)(()=>({selection:e,set:n=>t(n),clear:()=>t([]),toggle:n=>t(o=>o.includes(n)?o.filter(r=>r!==n):[...o,n]),isSelected:n=>e.includes(n)}),[e,t])}function Ni(){let{store:e}=oe(),t=ot();return(0,Se.useMemo)(()=>ji(e),[e,t])}var nr=new WeakMap;function ji(e){let t=nr.get(e);if(!t){let n={violations:null};e.subscribe(()=>{n.violations=null}),nr.set(e,n),t=n}return t.violations??=e.violations(),t.violations}function Gi(){let{view:e,setView:t}=oe();return(0,Se.useMemo)(()=>({view:e,url:te(e),focus:n=>t(o=>B(o,n)),show:n=>t(o=>zn(o,n)),toggle:n=>t(o=>Ue(o,n)),go:n=>t(n)}),[e,t])}var he={at:0,depth:0,listeners:new Set,tell(){for(let e of this.listeners)e()}};typeof window<"u"&&window.addEventListener("popstate",e=>{let t=e.state;he.at=typeof t?.graview=="number"?t.graview:0,he.at>he.depth&&(he.depth=he.at),he.tell()});var j=_(N(),1),$t={profile:{trigger:"profile-button",pane:"profile",opens:"press",focus:"into",drawn:["shell","embed"]},problems:{trigger:"standing",pane:"problems",opens:"press",focus:"into",drawn:["shell","embed"]},places:{trigger:"app-places-open",pane:"app-places",opens:"press",focus:"into",drawn:["embed"]},here:{trigger:"here-open",pane:"here-list",opens:"press",focus:"into",drawn:["shell","embed","pages"]},suggested:{trigger:"suggested-button",pane:"suggested",opens:"press",focus:"into",drawn:["shell","embed","pages"]},activity:{trigger:"activity-button",pane:"activity",opens:"press",focus:"into",drawn:["shell","embed","pages"]},find:{trigger:"find-box",pane:"find-strip",opens:"typing",focus:"stays",drawn:["shell"]},districts:{trigger:"beyond-more",pane:"beyond-list",opens:"press",focus:"into",drawn:["shell","embed"]},acts:{trigger:null,pane:"context-menu",opens:"context-menu",focus:"into",drawn:["shell","embed","pages"]},arrange:{trigger:"arrange-add",pane:"arrange-list",opens:"press",focus:"into",drawn:["pages"]},"studio-ask":{trigger:"studio-agent",pane:"studio-agent-panel",opens:"press",focus:"into",drawn:["studio"]}},Wi={position:"fixed",inset:"auto",margin:0,zIndex:Nn("popover"),boxSizing:"border-box"},lt=6,we=8,Fi=e=>typeof e.showPopover=="function";function dt(e){try{return e.matches(":popover-open")}catch{return!1}}function Ki(e){if(typeof e=="function"){let o=e();return o?{left:o.x,right:o.x,top:o.y,bottom:o.y}:null}let t=e.current;if(!t||!t.isConnected)return null;let n=t.getBoundingClientRect();return{left:n.left,right:n.right,top:n.top,bottom:n.bottom}}function zt(e,t,n={}){let o=Ki(t);if(!o)return;let r={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},i=e.dataset.graviewDesignedHeight??=e.style.maxHeight;e.style.maxHeight=i;let a=e.getBoundingClientRect(),d=r.height-o.bottom-lt-we,s=o.top-lt-we,u=a.height<=d||d>=s,f=Math.max(96,Math.floor(u?d:s)),m=Math.min(a.height,f);a.height>f&&(e.style.maxHeight=i?`min(${i}, ${f}px)`:`${f}px`);let p=a.width,g=n.align==="start"?o.left:o.right-p,v=typeof t=="function"?null:t.current?.closest("[data-graview-embed]")?.getBoundingClientRect();v&&p<=v.right-v.left&&(g<v.left?g=o.left+p<=v.right?o.left:v.left:g+p>v.right&&(g=o.right-p>=v.left?o.right-p:v.right-p));let k=p>=r.width-2*we?Math.max(0,(r.width-p)/2):Math.max(we,Math.min(g,r.width-we-p)),y=u?o.bottom+lt:Math.max(we,o.top-lt-m);e.style.left=`${Math.round(k)}px`,e.style.top=`${Math.round(y)}px`}function or(e,t,n,o={}){let r=o.align??"end";(0,j.useLayoutEffect)(()=>{let i=e.current;if(!t||!i)return;if(Fi(i)&&!dt(i))try{i.showPopover(),Bi()}catch{}let a=0,d=u=>{u?.target instanceof Node&&i.contains(u.target)||(cancelAnimationFrame(a),a=requestAnimationFrame(()=>zt(i,n,{align:r})))};zt(i,n,{align:r}),addEventListener("resize",d),addEventListener("scroll",d,!0);let s=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>d());return s?.observe(i),()=>{if(cancelAnimationFrame(a),removeEventListener("resize",d),removeEventListener("scroll",d,!0),s?.disconnect(),i.isConnected&&dt(i))try{i.hidePopover()}catch{}}},[t,e,r])}var Ut=new Set;function qi(e){return Ut.add(e),()=>Ut.delete(e)}function Bi(){for(let e of Ut)if(!(!e.isConnected||!dt(e)))try{e.hidePopover(),e.showPopover()}catch{}}var ve=null,$i='button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])';function zi(e){for(let t of e.querySelectorAll($i))if(t.closest("[hidden]")===null&&getComputedStyle(t).visibility!=="hidden")return t;return e}var Bt=()=>{let e=document.activeElement;return e===null||e===document.body};function Ui(e,t={}){let{at:n,returnTo:o,onOpenChange:r}=t,i=t.popover!==!1,[a,d]=(0,j.useState)(!1),s=t.open??a,u=(0,j.useRef)(null),f=(0,j.useRef)(null),m=(0,j.useCallback)(h=>{u.current=h},[]),p=(0,j.useCallback)(h=>{f.current=h},[]),g=`graview-popover-${(0,j.useId)().replace(/:/g,"")}`,v=(0,j.useRef)({onOpenChange:r,returnTo:o,controlled:t.open!==void 0});v.current={onOpenChange:r,returnTo:o,controlled:t.open!==void 0};let k=(0,j.useCallback)(h=>{v.current.controlled||d(h),v.current.onOpenChange?.(h)},[]),y=(0,j.useCallback)(()=>{(document.querySelector(`[aria-controls="${g}"]`)??u.current??v.current.returnTo?.()??null)?.focus({preventScroll:!0})},[g]),b=(0,j.useCallback)(h=>{let E=f.current,P=typeof document>"u"?null:document.activeElement,D=P===null||P===document.body||E!==null&&E.contains(P);k(!1),!(!h||!D)&&(y(),requestAnimationFrame(()=>{Bt()&&y()}))},[k,y]);return or(f,i&&s,n??u,t.align?{align:t.align}:{}),(0,j.useEffect)(()=>{if(!i||!s)return;let h={name:e,close:()=>b(!1)};if(ve&&ve.close!==h.close&&ve.close(),ve=h,$t[e].focus==="into"){let x=f.current;x&&!x.contains(document.activeElement)&&zi(x).focus({preventScroll:!0})}let E=x=>{x.key==="Escape"&&b(!0)},P=x=>{let V=x.target;if(!(V instanceof Node))return;let O=f.current;if(O?.contains(V)||u.current?.contains(V))return;let W=V instanceof Element?V.closest('[role="dialog"], [role="alertdialog"]'):null;W&&!(O&&W.contains(O))||(b(!1),$t[e].focus==="into"&&requestAnimationFrame(()=>{(Bt()||O!==null&&O.contains(document.activeElement))&&y()}))},D=null,C=null,G=x=>{let V=x.target;if(!(V instanceof Element))return;let O=f.current,W=V.closest('[role="dialog"], [role="alertdialog"]');!W||O&&(O.contains(W)||W.contains(O))||(D=W,b(!1))};return document.addEventListener("keydown",E),document.addEventListener("pointerdown",P,!0),document.addEventListener("focusin",G),()=>{document.removeEventListener("keydown",E),document.removeEventListener("pointerdown",P,!0),document.removeEventListener("focusin",G);let x=D;x&&typeof MutationObserver<"u"&&(C?.disconnect(),C=new MutationObserver(()=>{x.isConnected||(C?.disconnect(),requestAnimationFrame(()=>{(Bt()||document.activeElement.closest("[hidden]")!==null)&&y()}))}),C.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>C?.disconnect(),10*6e4)),ve?.close===h.close&&(ve=null)}},[i,s,e,b,y]),{open:s,setOpen:h=>h?k(!0):b(!0),toggle:()=>s?b(!0):k(!0),trigger:{ref:m,"aria-expanded":s,"aria-controls":g,"data-graview-popover-trigger":e},pane:{ref:p,id:g,popover:"manual",tabIndex:-1,"data-graview-popover":e,"data-graview-overlay":""}}}var be=_(N(),1);var rr=(0,be.createContext)(null);function Yi(){let e=(0,be.useContext)(rr),t=Wt(),n=(o,r,i)=>t?.setView(a=>ae(ae(pe(B(a,ne(o)),!1),"view",r),"filter",i?.filter??null));return(0,be.useMemo)(()=>e??{record:o=>{t&&(t.setView(r=>B(pe(r,!1),o)),t.setSelection([o]))},place:(o,r)=>{let i=t?.views.places().find(a=>a.as===o);i&&n(i.kind,i.as,r)},list:(o,r)=>n(o,null,r)},[e,t])}var xe=_(N(),1);var Zi=qt(Ke(()=>(__graviewPreload(import.meta.url,["./chunk.4JWT6LIS.js","./chunk.SDO3U72B.js","./chunk.AW2T3KFV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZN77U6SU.js"))));function Xi(e,t,n){let o,r=!1,i=()=>{let{hidden:d,removed:s}=t.current();o||r||d.length+s.length===0||(o=()=>{},Zi.load().then(u=>{r||(o=u.watchTidied(e,t,n))},String))};i();let a=t.onChange?.(i);return()=>{r=!0,a?.(),o?.()}}function Ji(e,t){let[n,o]=(0,xe.useState)();return(0,xe.useEffect)(()=>t?Xi(e,t,r=>o([e,r])):void 0,[e,t]),n?.[0]===e?n[1]:e}var ir=_(N(),1),Qi=(0,ir.createContext)(!1);var ar=_(N(),1),ea=(0,ar.createContext)(null);var sr=_(N(),1),Yt='button:not([disabled]), a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])',Zt=e=>e instanceof HTMLElement&&(e.matches(Yt)||e.hasAttribute("tabindex")),Le=e=>typeof e.checkVisibility=="function"?e.checkVisibility():e.getClientRects().length>0;function ta(e,t){let n=s=>s.replace(/["\\]/g,"\\$&"),o=t.getAttribute("data-testid"),r=t.getAttribute("data-graview-pick"),i=t.getAttribute("aria-label"),a=o?`[data-testid="${n(o)}"]`:r?`[data-graview-pick="${n(r)}"]`:i?`${t.tagName.toLowerCase()}[aria-label="${n(i)}"]`:null;if(!a)return null;let d=e.querySelector(a);return d&&Zt(d)&&Le(d)?d:null}var na=e=>e.isConnected&&Zt(e)&&!e.matches(":disabled")&&e instanceof HTMLElement&&Le(e);function lr(e,t){let n=t?ta(e,t):null;if(n)return n;let o=e.querySelector("[data-graview-view][tabindex]");if(o&&Le(o))return o;for(let r of e.querySelectorAll(Yt))if(Le(r))return r;return Zt(e)&&Le(e)?e:null}function oa(e){(0,sr.useEffect)(()=>{let t=e.current;if(!t||typeof MutationObserver>"u")return;let n=[],o=y=>{let b=y.target;if(b instanceof Element){n=[];for(let h=b;h&&h!==t.parentElement;h=h.parentElement)n.push(h)}},r=!1,i=!1,a=t.ownerDocument,d=()=>!i&&a.defaultView!==null,s=(y,b)=>void setTimeout(()=>d()&&b(),y),u=y=>void requestAnimationFrame(()=>d()&&y()),f=y=>{if(r=!1,i)return;let b=a.activeElement;if(!(!(b===null||b===a.body||b===a.documentElement)||n.length===0)){if(na(n[0])){y&&n[0]instanceof HTMLElement&&n[0].focus({preventScroll:!0});return}for(let E of n.slice(1)){if(!E.isConnected)continue;let P=lr(E,n[0]);if(P){P.focus({preventScroll:!0}),n=[];return}}}},m=(y,b=Date.now()+2500)=>{s(100,()=>{f(y);let h=a.activeElement;(h===null||h===a.body||h===a.documentElement)&&n.length>0&&Date.now()<b&&m(y,b)})},p=()=>{r||n.length===0||(r=!0,s(60,()=>u(()=>{f(!1),m(!1)})))},g=y=>{if(!(y instanceof KeyboardEvent&&!["Enter"," ","Escape"].includes(y.key))){if(!(y instanceof KeyboardEvent)){let b=y.target instanceof Element?y.target.closest(Yt):null,h=a.activeElement,E=h===null||h===a.body||h===a.documentElement;if(b&&E&&t.contains(b)){n=[];for(let P=b;P&&P!==t.parentElement;P=P.parentElement)n.push(P);s(150,()=>u(()=>{f(!1),m(!1)}));return}}!(y instanceof KeyboardEvent)&&!(y.target instanceof Node&&n[0]?.contains(y.target))||s(150,()=>u(()=>{f(!0),m(!0)}))}},v=new MutationObserver(()=>{n.length>0&&!n[0].isConnected&&p()}),k=y=>{y.relatedTarget===null&&p()};return t.addEventListener("focusin",o),t.addEventListener("focusout",k),t.addEventListener("click",g),t.addEventListener("keydown",g),v.observe(t,{childList:!0,subtree:!0}),()=>{i=!0,t.removeEventListener("focusin",o),t.removeEventListener("focusout",k),t.removeEventListener("click",g),t.removeEventListener("keydown",g),v.disconnect()}},[e])}export{fe as a,te as b,$e as c,ia as d,aa as e,Bn as f,qn as g,$n as h,ht as i,B as j,zn as k,ae as l,pe as m,ze as n,Ve as o,Ue as p,Ze as q,St as r,ye as s,da as t,Er as u,ne as v,Un as w,se as x,Yn as y,Ar as z,ua as A,Zn as B,wt as C,kr as D,Pr as E,Rr as F,N as G,Mt as H,zr as I,Yr as J,mo as K,Qe as L,Zr as M,Ie as N,ho as O,Xr as P,Vt as Q,Ce as R,ci as S,fi as T,pi as U,Fo as V,Si as W,vi as X,as as Y,Ai as Z,oe as _,Wt as $,ot as aa,ki as ba,Pi as ca,Ri as da,Gt as ea,rr as fa,Yi as ga,Ti as ha,$o as ia,zo as ja,Uo as ka,Yo as la,Mi as ma,Oi as na,Jo as oa,Vi as pa,Ii as qa,Ci as ra,tr as sa,_i as ta,qt as ua,Ji as va,Qi as wa,ea as xa,Di as ya,Ni as za,Gi as Aa,he as Ba,oa as Ca,Wi as Da,dt as Ea,or as Fa,qi as Ga,Ui as Ha};
2
+ /*! Bundled license information:
3
+
4
+ react/cjs/react.production.js:
5
+ (**
6
+ * @license React
7
+ * react.production.js
8
+ *
9
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
10
+ *
11
+ * This source code is licensed under the MIT license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ *)
14
+
15
+ react/cjs/react-jsx-runtime.production.js:
16
+ (**
17
+ * @license React
18
+ * react-jsx-runtime.production.js
19
+ *
20
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
21
+ *
22
+ * This source code is licensed under the MIT license found in the
23
+ * LICENSE file in the root directory of this source tree.
24
+ *)
25
+ */
@@ -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{l as k,n as M,o as I,p as B,s as P}from"./chunk.MZOIPCDA.js";import"./chunk.KERLVJ6I.js";import"./chunk.4EPT2CQG.js";import"./chunk.FNXW46U4.js";import{G as te,R as W,ua as q}from"./chunk.4JWT6LIS.js";import{a as L}from"./chunk.SDO3U72B.js";import"./chunk.AW2T3KFV.js";import"./chunk.2AZTW66C.js";import{b as h}from"./chunk.AJZBJBMO.js";var r=h(te(),1);var A=h(W(),1),U=q(L(()=>(__graviewPreload(import.meta.url,["./chunk.FNXW46U4.js","./chunk.4JWT6LIS.js","./chunk.SDO3U72B.js","./chunk.AW2T3KFV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.56DR42FA.js")))),v={Part:U.part((n,t)=>(0,A.jsx)(n.WhenMonth,{...t}),{quiet:!0}),prefetch:()=>U.prefetch()};var o=h(W(),1),z="try \u201Ctomorrow 3pm\u201D, \u201CFri 10:30\u201D or \u201C17 Oct\u201D";function K(n,t,d,p=!1){let S=Date.UTC(+n.day.slice(0,4),+n.day.slice(5,7)-1,+n.day.slice(8,10),0,t?n.minutes??0:0),g={weekday:p?"long":"short",year:"numeric",month:p?"long":"short",day:"numeric",...t?{hour:"numeric",minute:"2-digit"}:{},timeZone:"UTC"},m;try{m=new Intl.DateTimeFormat(d??"en-US",g)}catch{m=new Intl.DateTimeFormat("en-US",g)}return m.format(S).replace(/ /g," ")}function ce({value:n,time:t,instant:d=!1,label:p,name:S,required:g,autoFocus:m,autoSelect:H,locale:s,onChange:j,onLeave:_,onCancel:V,inputRef:w,boxStyle:Z}){let x=(0,r.useId)(),u=(0,r.useRef)(null),D=(0,r.useRef)(null),b=e=>{let a=M(e);return a?K(a,t,s):e??""},[T,C]=(0,r.useState)(()=>b(n)),[F,y]=(0,r.useState)(!1),[G,E]=(0,r.useState)(n),[J,Q]=(0,r.useState)(n);n!==J&&(Q(n),n!==G&&(E(n),C(b(n)))),(0,r.useEffect)(()=>{H&&(u.current?.focus(),u.current?.select())},[H]);let i=t&&d?B(s):void 0,N=T===b(n),l=M(n),c=N?l:P(T,{today:k().day,time:t,...l?{base:l}:{},...s?{locale:s}:{}}),X=N?n:c?I(c,{time:t,instant:d}):void 0,$=T.trim()==="",f=!$&&c===void 0;(0,r.useEffect)(()=>{u.current?.setCustomValidity(f?`Not a date this reads \u2014 ${z}`:"")},[f]);let O=e=>{E(e),j(e)},Y=e=>{C(e);let a=e.trim()===""?void 0:P(e,{today:k().day,time:t,...l?{base:l}:{},...s?{locale:s}:{}});O(a?I(a,{time:t,instant:d}):void 0)},ee=e=>{let a=t?{day:e,minutes:c?.minutes??l?.minutes??540}:{day:e},R=I(a,{time:t,instant:d});C(b(R)),O(R),y(!1),requestAnimationFrame(()=>{u.current?.focus(),u.current?.select()})},ne=$?`Type a date, or pick one \u2014 ${z}`:f?`Not a date this reads \u2014 ${z}`:c?`${K(c,t,s,!0)}${i?` ${i.short}`:""}`:"";return(0,o.jsxs)("span",{"data-graview-when":t?d?"instant":"moment":"day",style:{display:"inline-flex",flex:"1 1 14rem",flexWrap:"wrap",alignItems:"center",gap:"4px 6px",maxWidth:"100%",minWidth:0},onBlur:e=>{let a=e.relatedTarget;a&&e.currentTarget.contains(a)||!a&&typeof document<"u"&&!document.hasFocus()||(y(!1),_?.(X))},children:[(0,o.jsx)("input",{ref:e=>{u.current=e,typeof w=="function"?w(e):w&&(w.current=e)},type:"text",name:S,required:g,autoFocus:m,"aria-label":p,"aria-describedby":`${x}-said`,"aria-invalid":f||void 0,autoComplete:"off",spellCheck:!1,enterKeyHint:"done",placeholder:t?"tomorrow 3pm":"17 Oct",value:T,"data-graview-part":"control",onChange:e=>Y(e.target.value),onKeyDown:e=>{e.key==="Escape"?(e.preventDefault(),V?.()):e.key==="ArrowDown"&&e.altKey&&(e.preventDefault(),y(!0))},style:{flex:"1 1 12ch",minWidth:"10ch",maxWidth:"100%",boxSizing:"border-box",font:"inherit",...Z}}),(0,o.jsx)("button",{ref:D,type:"button","aria-label":`Pick a date for ${p}`,"aria-expanded":F,"aria-controls":`${x}-month`,"data-graview-part":"when-pick",onClick:()=>y(e=>!e),onPointerEnter:()=>v.prefetch(),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:32,minHeight:32,padding:0,borderRadius:6},children:(0,o.jsxs)("svg",{"aria-hidden":"true",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:[(0,o.jsx)("rect",{x:"2",y:"3",width:"12",height:"11",rx:"1.5"}),(0,o.jsx)("path",{d:"M2 6.5h12M5.5 1.5v3M10.5 1.5v3"})]})}),(0,o.jsxs)("span",{id:`${x}-said`,"aria-live":"polite","data-graview-part":"when-said",...i?{"data-graview-zone":i.zone,title:`Times are in ${i.zone.replace(/_/g," ")} (${i.short})`}:{},style:{flexBasis:"100%",fontSize:"0.75rem",color:f?"var(--graview-bad)":"var(--graview-ink-faint)"},children:[ne,i&&!f&&!$?(0,o.jsx)("span",{"data-graview-part":"when-zone",children:` \xB7 ${(i.zone.split("/").at(-1)??i.zone).replace(/_/g," ")} time`}):null]}),F?(0,o.jsx)(r.Suspense,{fallback:null,children:(0,o.jsx)(v.Part,{id:`${x}-month`,label:p,selected:c?.day??l?.day,today:k().day,locale:s,onPick:ee,onClose:()=>{y(!1),D.current?.focus()}})}):null]})}export{ce as WhenInput,K as wallAsRead};
@@ -0,0 +1 @@
1
+ import"./chunk.FNXW46U4.js";import{G as W,R as x}from"./chunk.4JWT6LIS.js";import"./chunk.SDO3U72B.js";import"./chunk.AW2T3KFV.js";import"./chunk.2AZTW66C.js";import{b as D}from"./chunk.AJZBJBMO.js";var g=D(W(),1);var o=D(x(),1),v=864e5,l=t=>Date.UTC(+t.slice(0,4),+t.slice(5,7)-1,+t.slice(8,10)),I=t=>new Date(t).toISOString().slice(0,10),s=(t,i)=>I(l(t)+i*v),m=(t,i)=>{let a=new Date(l(t)),u=a.getUTCMonth()+i,d=Date.UTC(a.getUTCFullYear(),u,1),w=new Date(Date.UTC(a.getUTCFullYear(),u+1,0)).getUTCDate();return I(d+(Math.min(a.getUTCDate(),w)-1)*v)};function p(t,i,a){try{return new Intl.DateTimeFormat(t??"en-US",{...i,timeZone:"UTC"}).format(a)}catch{return new Intl.DateTimeFormat("en-US",{...i,timeZone:"UTC"}).format(a)}}function F(t){try{let i=new Intl.Locale(t??"en-US"),a=i.getWeekInfo?.().firstDay??i.weekInfo?.firstDay;if(a!==void 0)return a%7}catch{return 0}return/^en-US|^en$|-(US|CA|JP|BR|IL|MX|PH)$/.test(t??"en-US")?0:1}function L({id:t,label:i,selected:a,today:u,locale:d,onPick:w,onClose:T}){let[r,f]=(0,g.useState)(a??u),U=(0,g.useRef)(null),y=F(d),b=`${r.slice(0,7)}-01`,M=(new Date(l(b)).getUTCDay()-y+7)%7,P=s(b,-M),A=Array.from({length:6},(e,n)=>Array.from({length:7},(S,c)=>s(P,n*7+c))),$=p(d,{month:"long",year:"numeric"},l(b)),h=(0,g.useRef)(!0);(0,g.useEffect)(()=>{h.current&&U.current?.querySelector(`[data-day="${r}"]`)?.focus(),h.current=!1},[r]);let E=e=>{let n={ArrowLeft:()=>s(r,-1),ArrowRight:()=>s(r,1),ArrowUp:()=>s(r,-7),ArrowDown:()=>s(r,7),PageUp:()=>m(r,e.shiftKey?-12:-1),PageDown:()=>m(r,e.shiftKey?12:1),Home:()=>s(r,-((new Date(l(r)).getUTCDay()-y+7)%7)),End:()=>s(r,6-(new Date(l(r)).getUTCDay()-y+7)%7)};n[e.key]?(e.preventDefault(),h.current=!0,f(n[e.key]())):e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),T())},R=Array.from({length:7},(e,n)=>l("1970-01-04")+(y+n)%7*v),C={minWidth:32,minHeight:32,padding:"0 8px",borderRadius:6};return(0,o.jsxs)("div",{id:t,role:"group","aria-label":`Pick a date for ${i}`,"data-graview-part":"when-month",onKeyDown:e=>{e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),T())},style:{flexBasis:"100%",width:"min(100%, 20rem)",boxSizing:"border-box",padding:8,border:"1px solid var(--graview-edge)",borderRadius:8,background:"var(--graview-panel)",color:"var(--graview-ink)"},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:6,marginBottom:6},children:[(0,o.jsx)("button",{type:"button","aria-label":"Previous month",onClick:()=>f(m(r,-1)),style:C,children:"\u2039"}),(0,o.jsx)("span",{id:`${t}-title`,"aria-live":"polite",style:{fontWeight:600,fontSize:"0.875rem"},children:$}),(0,o.jsx)("button",{type:"button","aria-label":"Next month",onClick:()=>f(m(r,1)),style:C,children:"\u203A"})]}),(0,o.jsxs)("table",{ref:U,role:"grid","aria-labelledby":`${t}-title`,onKeyDown:E,style:{width:"100%",borderCollapse:"collapse",tableLayout:"fixed",fontSize:"0.8125rem"},children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:R.map(e=>(0,o.jsx)("th",{scope:"col",abbr:p(d,{weekday:"long"},e),style:{fontWeight:500,color:"var(--graview-ink-faint)",padding:"2px 0"},children:p(d,{weekday:"narrow"},e)},e))})}),(0,o.jsx)("tbody",{children:A.map(e=>(0,o.jsx)("tr",{children:e.map(n=>{let S=n.slice(0,7)===b.slice(0,7),c=n===a,k=n===u;return(0,o.jsx)("td",{role:"gridcell","aria-selected":c||void 0,style:{padding:1,textAlign:"center"},children:(0,o.jsx)("button",{type:"button","data-day":n,tabIndex:n===r?0:-1,"aria-label":`${p(d,{weekday:"long",year:"numeric",month:"long",day:"numeric"},l(n))}${k?", today":""}${c?", selected":""}`,...k?{"aria-current":"date"}:{},onClick:()=>w(n),onFocus:()=>n!==r&&f(n),style:{width:"100%",minHeight:36,padding:0,borderRadius:6,border:k?"1px solid var(--graview-accent)":"1px solid transparent",background:c?"var(--graview-accent)":"transparent",color:c?"var(--graview-accent-ink)":S?"var(--graview-ink)":"var(--graview-ink-faint)",fontWeight:c?600:400},children:Number(n.slice(8,10))})},n)})},e[0]))})]})]})}export{L as WhenMonth};
@@ -0,0 +1,2 @@
1
+ import{a as Z,b as qe}from"./chunk.5A4AOFOA.js";import"./chunk.KSXB4LDF.js";import"./chunk.CDFVEL2Y.js";import{i as De,j as Ne,k as Oe}from"./chunk.T6S3CEW7.js";import"./chunk.6NFR2LYQ.js";import"./chunk.HJCQ6I3S.js";import"./chunk.B7FZLIAO.js";import"./chunk.N5ULWKR4.js";import"./chunk.6BIRNR5P.js";import"./chunk.GBCWI2LF.js";import"./chunk.7PUFYK3B.js";import{a as We,b as S}from"./chunk.QJJKITXF.js";import{a as X,b as $e}from"./chunk.7AEE3VHC.js";import"./chunk.LKF4BBCW.js";import"./chunk.JUT2VCFW.js";import"./chunk.IIB22IIP.js";import"./chunk.MWUP5X47.js";import"./chunk.OK4FSBHI.js";import"./chunk.DAZEFSWI.js";import"./chunk.OGF6UORU.js";import{b as Pe,c as Le}from"./chunk.UT6642FC.js";import"./chunk.3TBH2FMZ.js";import"./chunk.WE5SA6TP.js";import"./chunk.TI4OSTQV.js";import"./chunk.TDCO7LEA.js";import"./chunk.ESU2DD3J.js";import"./chunk.PL2P2OON.js";import"./chunk.27ZVVPRZ.js";import"./chunk.IN4PKQO5.js";import"./chunk.3IUJ4GW7.js";import"./chunk.UG23RICT.js";import{u as Re}from"./chunk.ATKKTPJS.js";import"./chunk.OJGHDWI6.js";import"./chunk.UZSZPMRC.js";import{g as ze}from"./chunk.MZOIPCDA.js";import"./chunk.KERLVJ6I.js";import{c as Ce}from"./chunk.4EPT2CQG.js";import{m as Ie}from"./chunk.FNXW46U4.js";import{Da as He,G as ot,Ha as Ee,R as Me,_ as O,h as Ae,u as Te,ya as J}from"./chunk.4JWT6LIS.js";import"./chunk.SDO3U72B.js";import{Zb as xe,_b as ke,ka as Q,la as N,wb as be,wc as Se}from"./chunk.AW2T3KFV.js";import"./chunk.2AZTW66C.js";import{b as Y}from"./chunk.AJZBJBMO.js";var a=Y(ot(),1);var t=Y(Me(),1);function bt(u,r,o){let c=r.on??r.about[r.about.length-1];De(u,r.about,{...o,pins:Z(),...c===void 0?{}:{focus:c}})}function xt({placement:u="float",chosen:r=!0}={}){let{menuAt:o}=O();return u==="menu"&&o===null?r?(0,t.jsx)(at,{}):null:(0,t.jsx)(lt,{placement:u})}function at(){let{store:u,setMenuAt:r,view:o}=O(),{selection:c}=J(),h=(0,a.useRef)(null),[E,y]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let b=h.current?.offsetParent??h.current?.parentElement;if(!b)return;let m=Math.round(b.getBoundingClientRect().width);m!==E&&y(m)});let v=c.length===1&&!o.overview?u.graph.getNode(c[0]):void 0;return!v||E===null||E>=Be?(0,t.jsx)("span",{ref:h,hidden:!0}):(0,t.jsx)("button",{type:"button",ref:h,"data-testid":"chosen-acts","aria-label":`What can be done with ${S(u,v.id)}`,"aria-haspopup":"menu",onClick:b=>{let m=b.currentTarget.getBoundingClientRect();r({x:Math.round(m.right),y:Math.round(m.bottom+4),on:v.id})},style:{position:"absolute",right:"calc(14px + var(--graview-dock, 0px))",top:98,zIndex:"var(--graview-layer-overview, 10)",minHeight:30,padding:"0 12px",borderRadius:8,fontSize:"0.8125rem",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Acts\u2026"})}var Be=564;function lt({placement:u}){let{store:r,menuAt:o,setMenuAt:c,view:h,signIn:E}=O(),y=(0,a.useRef)(null),v=(0,a.useRef)(null),b=(0,a.useRef)(null),m=(0,a.useRef)(null);o?.returnTo&&(m.current=o.returnTo);let Ke=e=>{let i=e.closest("[data-graview-asking]")?.getAttribute("data-graview-asking"),n=e.getAttribute("data-pin-for"),d=i??e.getAttribute("data-affordance")??(n===null?null:`pin:${n}`)??e.getAttribute("data-menu-item");v.current=d===null?null:{key:d,element:e}};(0,a.useEffect)(()=>{let e=y.current,i=v.current;if(i===null||document.activeElement!==document.body||i.element.isConnected)return;let n=i.key;if(!e){v.current=null;let k=m.current;m.current=null,(k?.isConnected?k:b.current)?.focus();return}((n.startsWith("pin:")?e.querySelector(`[data-pin-for="${CSS.escape(n.slice(4))}"]`):null)??e.querySelector(`[data-affordance="${CSS.escape(n)}"]:not([disabled])`)??e).focus()});let[_e,je]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let e=y.current?.offsetParent??y.current?.parentElement;if(e instanceof HTMLElement&&(b.current=e),!e)return;let i=e.getBoundingClientRect();je(n=>n&&n.left===i.left&&n.top===i.top&&n.width===i.width&&n.height===i.height?n:{left:i.left,top:i.top,width:i.width,height:i.height})});let{selection:Ue,set:Ve,clear:Ge}=J(),s=o?.about??Ue,[q,Ye]=(0,a.useState)(()=>Z()),F=o?.on??s[s.length-1],B=o?.about,Qe=(0,a.useMemo)(()=>({pins:q,...F===void 0?{}:{focus:F},...B?{about:B}:{}}),[q,F,B]),Je=(0,a.useMemo)(()=>new Set(r.allMutations().filter(e=>e.pinned).map(e=>e.name)),[r]),{affordances:g,withheld:ee,observations:te}=Ne(Qe),I=ke(ee,E),f=I?st:ee,Xe=o===null?null:{face:o.face??"scene",on:o.on,about:s,field:o.field,place:o.place,href:o.href,act:o.act,element:o.returnTo},ne=Re(Xe),ie=te.some(e=>e.id.startsWith("schema:waits:")),{apply:Ze,preview:et}=Oe(),[C,z]=(0,a.useState)(null),[tt,re]=(0,a.useState)(!1),[oe,ae]=(0,a.useState)(!1),[L,R]=(0,a.useState)(""),nt=$e({letters:!0}),[le,K]=(0,a.useState)(null),_=(0,a.useRef)([]),j=(e,i)=>{try{return et(e,i),Ze(e,i),K(null),c(null),_.current=[],!0}catch(n){return K(ze(r.schema,r.allMutations(),n)),_.current=n instanceof be?n.issues.map(d=>String(d.path[0]??"")).filter(Boolean):[],!1}},$=[...new Set(s.flatMap(e=>{let i=r.graph.getNode(e);return i?[i.kind]:[]}))],x=$.length>0?$:[...new Set(s.flatMap(e=>Te(e)))],p=s.length===1?Ae(s[0]):null,U=p?{from:r.graph.getNode(p.from),to:r.graph.getNode(p.to)}:null,se=p?Le(r,p):void 0,de=se?.provisional?se:void 0,ue=p?(()=>{let e=r.schema.tryDefinition(r.graph.getNode(p.from)?.kind??"")?.edges?.[p.kind],i=r.graph.getNode(p.to);return e?.inverse&&i?`From ${S(r,i.id)}: ${e.inverse}`:null})():null;(0,a.useEffect)(()=>{z(null),re(!1),ae(!1),K(null),R("")},[s,o?.about]);let l=o!==null,it=u==="menu"&&!l,A=(0,a.useRef)(o);A.current=o;let pe=Ee("acts",{open:l&&u==="menu",onOpenChange:e=>{e||c(null)},at:()=>A.current?{x:A.current.x,y:A.current.y}:null,returnTo:()=>{let e=A.current?.returnTo;if(e?.isConnected)return e;let i=A.current?.on;return i?document.querySelector(`[data-graview-view="${CSS.escape(i)}"]`):null},align:"start"}),ce=(_e?.width??Number.POSITIVE_INFINITY)<Be;if((0,a.useLayoutEffect)(()=>{let e=y.current?.offsetParent;if(!e||!ce||l)return;let i=y.current?.getBoundingClientRect().height??0,n=`${Math.round(i)+20}px`;if(e.style.paddingBottom===n)return;let d=e.style.paddingBottom;return e.style.paddingBottom=n,()=>{e.style.paddingBottom=d}}),s.length===0&&!l)return null;let ge=o?.title!==void 0||s.length>0&&!(s.length===1&&s[0]===h.focusId),he=Math.max(1,Math.min(9,g.length)),T=[...g.filter(e=>e.provider==="invariant"&&!e.destructive),...g.filter(e=>e.pinned&&e.provider!=="invariant"&&!e.destructive),...g.filter(e=>!e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...g.filter(e=>e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...g.filter(e=>e.destructive)],me=T.length>he&&!l,fe=L.trim().toLowerCase(),w=me&&fe.length>0?T.filter(e=>`${e.label} ${e.why}`.toLowerCase().includes(fe)):null,V=w??(tt||l?T:T.slice(0,he)),ye=w?0:T.length-V.length,W=[];for(let e of V){let i=!l&&e.provider==="invariant",n=!l&&!i&&e.pinned!==void 0&&!e.destructive,d=!l&&!i&&!n&&e.ties===!0&&!e.destructive,k=i?e.why:n?"pinned":d?"its ties":null,D=i?"violation":n||d?"ties":null,H=W[W.length-1];H&&H.heading===k?H.items.push(e):W.push({heading:k,tone:D,items:[e]})}let G=g.find(e=>e.id===C),P=s.length===1?S(r,s[0]):null,ve=e=>{if(!P)return e;let i=e.startsWith(`"${P}"`)?e.slice(P.length+2):e.startsWith(P)?e.slice(P.length):null;if(i===null)return e;let n=i.trimStart();return n.length===0?e:n[0].toUpperCase()+n.slice(1)},rt=new Set(l?[]:V.filter(e=>e.provider==="invariant").map(e=>e.why)),M=te.filter(e=>!rt.has(e.text)).map(e=>({...e,text:ve(e.text)}));return it?null:(0,t.jsxs)("section",{...l?pe.pane:{},ref:e=>{y.current=e,l&&pe.pane.ref(e)},"aria-label":"Inspector","data-graview-offstage":"","data-testid":l?"context-menu":"inspector-strip",tabIndex:-1,onFocus:e=>Ke(e.target),onBlur:e=>{e.relatedTarget!==null&&(v.current=null)},onMouseDown:e=>e.stopPropagation(),style:{...l?He:{position:"absolute",zIndex:Se("rail")},boxSizing:"border-box",display:"flex",flexDirection:"column",gap:7,padding:"9px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",...l?{width:300,maxHeight:"min(52cqh, 420px)",overflow:"auto"}:ce?{left:10,right:10,width:"auto",bottom:10,maxHeight:"min(42cqh, 300px)",overflow:"auto"}:{left:14,top:h.overview?"min(296px, 38cqh)":44,width:236,maxHeight:h.overview?"calc(100cqh - min(296px, 38cqh) - 20px)":"calc(68cqh - 94px)",overflow:"auto"}},children:[(0,t.jsx)("h2",{style:{...Ie,margin:0},children:"Inspector"}),(0,t.jsxs)("div",{style:{display:ge||!l?"flex":"none",alignItems:"baseline",flexWrap:"wrap",gap:"2px 8px",minWidth:0,paddingRight:l?0:24},children:[ge?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("strong",{style:{fontSize:"0.9375rem",whiteSpace:"nowrap"},children:o?.title??(s.length===1?S(r,s[0]):`${s.length} selected`)}),$.length>0||p?(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:p?"relation":$.map(e=>N(r.schema.tryDefinition(e),e)).join(" \xB7 ")}):null,s.length===1&&!p&&o?.face!=="pages"?(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:h.expanded.includes(s[0])?"\xB7 double-click closes":"\xB7 double-click opens"}):null]}):null,(0,t.jsx)("span",{style:{flex:"1 1 auto"}})]}),l?null:(0,t.jsx)("button",{type:"button",onClick:()=>{c(null),Ge()},"aria-label":"Clear selection",title:"Clear selection",style:{position:"absolute",top:6,right:6,flex:"0 0 auto",width:24,height:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.875rem",lineHeight:1,borderRadius:7},children:"\xD7"}),p&&U?(0,t.jsxs)("div",{style:{display:"grid",gap:6},children:[ue?(0,t.jsx)("p",{"data-testid":"edge-said",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:ue}):null,de?(0,t.jsx)("p",{"data-testid":"edge-provisional",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:Pe(de)}):null,(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[["from",U.from],["to",U.to]].map(([e,i],n)=>(0,t.jsxs)(a.Fragment,{children:[n===1?(0,t.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-ink-faint)"},children:"\u2192"}):null,i?(0,t.jsx)("button",{type:"button","data-testid":`edge-${e}`,onClick:()=>Ve([i.id]),title:`Select ${S(r,i.id)}`,style:{fontSize:"0.8125rem",padding:"3px 9px",borderRadius:6},children:S(r,i.id)}):(0,t.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"gone"})]},e))})]}):null,!p&&s.length===1&&xe(r,s[0])?(0,t.jsx)("p",{"data-testid":"left-alone",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:"Left alone: nothing automated changes it."}):null,M.length>0?(0,t.jsx)("div",{"data-testid":"observations",title:M.map(e=>e.text).join(`
2
+ `),style:{display:"grid",gap:3},children:M.slice(0,2).map(e=>(0,t.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[e.text,e===M[1]&&M.length>2?(0,t.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" +",M.length-2]}):null]},e.id))}):null,l?ne.start.map(e=>(0,t.jsx)(Fe,{section:e,close:()=>c(null)},e.id)):null,le?(0,t.jsx)("p",{"data-testid":"refused",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-warn)"},children:le}):null,me?(0,t.jsx)("input",{"data-testid":"action-filter",value:L,onChange:e=>R(e.target.value),placeholder:`Filter ${T.length} actions\u2026`,"aria-label":"Filter actions",onKeyDown:e=>{if(e.key==="Escape"){e.stopPropagation(),L.length>0?R(""):e.currentTarget.blur();return}if(e.key==="Enter"&&w?.length===1){let i=w[0];if(i.destructive)return;i.open.length>0?z(i.id):j(i)&&R("")}},style:{font:"inherit",fontSize:"0.875rem",padding:"5px 9px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):null,w!==null&&w.length===0?(0,t.jsxs)("p",{"data-testid":"no-matches",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:["Nothing offered here matches \u201C",L.trim(),"\u201D."]}):null,I&&g.length===0||g.length===0&&!ie&&s.length===0?null:g.length===0&&!ie?(0,t.jsx)("p",{"data-testid":"no-affordances",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:f.length>0?`Nothing you may do with ${p?"this relation":x.length===1?Q(N(r.schema.tryDefinition(x[0]),x[0])):"this mix of kinds"} \u2014 ${f.length} action${f.length===1?"":"s"} withheld.`:p?`Nothing can be done with this line yet \u2014 nothing this app declares makes or breaks \u201C${Ce(r.schema,r.graph.getNode(p.from)?.kind??"",p.kind,"out")}\u201D.`:`Nothing can be done with ${x.length===1?Q(N(r.schema.tryDefinition(x[0]),x[0])):"this mix of kinds"} yet \u2014 nothing this app declares acts on ${x.length===1?"it":"them"}.`}):(0,t.jsxs)("ol",{...nt,"data-testid":"affordances",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[W.map((e,i)=>(0,t.jsxs)(a.Fragment,{children:[e.heading?(0,t.jsxs)("li",{"data-graview-heading":e.tone,style:{fontSize:"0.75rem",lineHeight:1.4,color:e.tone==="violation"?"var(--graview-warn)":"var(--graview-ink-faint)",...e.tone!=="violation"?{letterSpacing:"0.12em",textTransform:"uppercase",fontSize:"0.75rem"}:{},padding:"2px 2px 1px",marginTop:i>0?6:0},children:[e.tone==="violation"?"\u26A0 ":"",e.tone==="violation"?ve(e.heading):e.heading]}):i>0?(0,t.jsx)("li",{"aria-hidden":"true",style:{borderTop:"1px solid var(--graview-edge)",margin:"6px 0 3px"}}):null,e.items.map(n=>(0,t.jsxs)("li",{style:{display:"flex",gap:2,alignItems:"stretch"},onKeyDown:d=>{if(d.metaKey||d.ctrlKey||d.altKey)return;let k=d.currentTarget.querySelector("[data-affordance]"),D=d.currentTarget.querySelector("[data-pin-for]"),H=d.target===D,we=d.key==="ArrowRight"&&!H?D:H&&["ArrowLeft","ArrowUp","ArrowDown"].includes(d.key)?k:null;we&&(d.preventDefault(),d.stopPropagation(),we.focus())},children:[(0,t.jsxs)("button",{type:"button",[X]:"","data-affordance":n.id,"data-rank":n.rank,"data-graview-destructive":n.destructive||void 0,"aria-pressed":C===n.id,title:n.why,style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:C===n.id?"var(--graview-accent)":l?"transparent":"var(--graview-edge)",background:l?"none":"var(--graview-panel)",boxShadow:"none",...n.destructive?{color:"var(--graview-warn)"}:{},...C===n.id?{color:"var(--graview-accent)"}:{}},onClick:()=>{if(n.open.length>0){z(C===n.id?null:n.id);return}j(n)},children:[n.label,n.open.length>0?(0,t.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:" \u2026"}):null,w?.length===1&&w[0]?.id===n.id&&!n.destructive?(0,t.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}):null]}),(0,t.jsx)("button",{type:"button","data-testid":"pin-toggle",tabIndex:-1,"data-pin-for":n.mutation,"aria-pressed":n.pinned!==void 0,"aria-label":n.pinned!==void 0?`Unpin ${n.label}`:`Pin ${n.label}`,title:n.pinned==="declared"?"Pinned by the app \u2014 unpin it for yourself":n.pinned==="user"?"Unpin":"Pin to the top",onClick:()=>Ye(qe(q,n.mutation,Je.has(n.mutation))),style:{flex:"0 0 auto",width:24,minHeight:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.75rem",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7,color:n.pinned==="user"?"var(--graview-accent)":n.pinned==="declared"?"var(--graview-ink-muted)":"var(--graview-ink-faint)"},children:n.pinned!==void 0?"\u2605":"\u2606"})]},n.id))]},`${e.heading??"plain"}-${i}`)),ye>0?(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button",[X]:"",onClick:()=>re(!0),title:`Show all ${g.length} actions`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",ye," more"]})}):null]}),I?(0,t.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>{c(null),I.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left"},children:I.label}):null,f.length>0?(0,t.jsxs)("ul",{"data-testid":"withheld",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[f.slice(0,l||oe?f.length:3).map(e=>(0,t.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,t.jsx)("button",{type:"button",disabled:!0,"data-affordance":e.id,"data-rank":e.rank,"data-withheld":e.refusal.wouldNeed.join(",")||"nobody",style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8,borderStyle:"dashed",width:"100%",textAlign:"left",background:"none"},children:(0,t.jsx)("s",{children:e.label})}),(0,t.jsx)("span",{"data-testid":"withheld-why",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-ink-muted)",padding:"0 10px"},children:e.refusal.message})]},e.id)),!l&&!oe&&f.length>3?(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button","data-testid":"withheld-more",onClick:()=>ae(!0),title:`Show all ${f.length} actions this seat may not take`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",f.length-3," more withheld"]})}):null]}):null,l?ne.end.map(e=>(0,t.jsx)(Fe,{section:e,close:()=>c(null)},e.id)):null,G?(0,t.jsx)(We,{affordance:G,onApply:e=>{if(j(G,e))z(null);else return _.current},onCancel:()=>z(null)}):null]})}var st=[];function Fe({section:u,close:r}){return(0,t.jsxs)("div",{"data-menu-section":u.id,...u.heading?{role:"group","aria-label":u.heading}:{},style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5},children:[u.heading?(0,t.jsx)("p",{"aria-hidden":"true",style:{margin:0,padding:"2px 2px 1px",fontSize:"0.75rem",lineHeight:1.4,letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:u.heading}):null,u.items&&u.items.length>0?(0,t.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:u.items.map(o=>(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button","data-menu-item":o.id,onClick:()=>{r(),o.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},children:[o.label,o.hint?(0,t.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",o.hint]}):null]})},o.id))}):null,u.render?.(r)]})}export{xt as InspectorPane,bt as prepareActs};
@@ -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{$ as S,F as g,G as T,R as v,ua as C}from"./chunk.4JWT6LIS.js";import{a as m}from"./chunk.SDO3U72B.js";import"./chunk.AW2T3KFV.js";import"./chunk.2AZTW66C.js";import{b as c}from"./chunk.AJZBJBMO.js";var n=c(T(),1),r=c(v(),1),s=null,u=null,f=new Set,a=()=>{for(let e of f)e()},y=e=>(f.add(e),()=>void f.delete(e)),E=300,d=()=>{u!==null&&clearTimeout(u),u=null};function q(e,t){d(),x.prefetch(),!(s?.element===t&&s.target.on===e.on)&&(s={target:e,element:t},a())}function M(e=!1){if(d(),s!==null){if(e){s=null,a();return}u=setTimeout(()=>{u=null,s=null,a()},E)}}var R=()=>d(),P=()=>s,b="graview:hover-chips",h;function A(e){if(h!==void 0)return h;try{return(e??localStorage).getItem(b)!=="off"}catch{return!0}}function I(e,t){h=e;try{(t??localStorage).setItem(b,e?"on":"off")}catch{}e||(s=null),a()}function w(){let e=S(),t=g(e?.ai),o=e?.memory,l=(0,n.useSyncExternalStore)(y,()=>A(o),()=>!1),i=(0,n.useCallback)(H=>I(H,o),[o]);return{offered:t,on:t&&l,set:i}}function z({legend:e,style:t,choice:o}){let l=w();return l.offered?(0,r.jsxs)("fieldset",{"data-testid":"setting-hover-chips",style:{border:0,margin:0,padding:0,display:"grid",gap:5,...t},children:[(0,r.jsx)("legend",{style:{...e,padding:0},children:"AI suggestions on hover"}),(0,r.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:"A quiet suggestion beside a record the pointer rests on, when the AI is sure of one."}),(0,r.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[!0,!1].map(i=>(0,r.jsx)("button",{type:"button","aria-pressed":l.on===i,"data-testid":`setting-hover-chips-${i?"on":"off"}`,onClick:()=>l.set(i),style:o(l.on===i),children:i?"On":"Off"},String(i)))})]}):null}var x=C(m(()=>(__graviewPreload(import.meta.url,["./chunk.REEDZSCG.js","./chunk.OGF6UORU.js","./chunk.UT6642FC.js","./chunk.3TBH2FMZ.js","./chunk.WE5SA6TP.js","./chunk.QNJYXB3U.js","./chunk.TI4OSTQV.js","./chunk.PL2P2OON.js","./chunk.MZOIPCDA.js","./chunk.KERLVJ6I.js","./chunk.4EPT2CQG.js","./chunk.FNXW46U4.js","./chunk.4JWT6LIS.js","./chunk.SDO3U72B.js","./chunk.AW2T3KFV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.FVHECT47.js")))),k=x.part((e,t)=>{let o=e.HoverChip;return(0,r.jsx)(o,{...t})},{quiet:!0}),p=null,O=()=>p;function L(){let{on:e}=w(),t=(0,n.useSyncExternalStore)(y,P,()=>null),[o]=(0,n.useState)(()=>Symbol("hover-chip")),l=(0,n.useSyncExternalStore)(y,O,()=>null);return(0,n.useEffect)(()=>{if(e)return p===null&&(p=o,a()),()=>{p===o&&(p=null,s=null,d(),a())}},[e,o,l]),!e||t===null||l!==o||!t.element.isConnected?null:(0,r.jsx)(n.Suspense,{fallback:null,children:(0,r.jsx)(k,{rest:t,hold:R,leave:M})})}export{L as HoverChipDoor,z as HoverChipsSwitch,R as holdRest,A as hoverChipsWanted,M as leaveRest,q as restOn,I as setHoverChipsWanted,w as useHoverChipsSetting};
@@ -0,0 +1 @@
1
+ import{Da as H,Fa as A,G as C,R as F}from"./chunk.4JWT6LIS.js";import"./chunk.SDO3U72B.js";import"./chunk.AW2T3KFV.js";import"./chunk.2AZTW66C.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{e as $}from"./chunk.O7VHAKSA.js";import{a as C}from"./chunk.V5VQCANB.js";import{g as M}from"./chunk.LFJH6X6O.js";import{ca as k,da as v,fa as j,vb as x}from"./chunk.UG727PEE.js";function N(a,s){let c=a.tryDefinition(s),r=Object.keys(c?.fields?.shape??{}),m=[c?.lifecycle?.field,...r.filter(l=>/^(status|stage|state|phase)$/i.test(l))].filter(l=>l!==void 0&&r.includes(l));return[...new Set(m)].slice(0,1)}function P(a,s){return a.tryDefinition(s)?.fieldRoles?.title??"label"}function V(a,s,c={}){let r=s.map(e=>a.graph.getNode(e)).filter(e=>e!==void 0);if(r.length===0)return{acts:[],withheld:[]};let u=c.principal??{kind:"human"},m=C(a,r.map(e=>e.id),{...c.derive,principal:u,...c.context?{context:c.context}:{}}),l=new Map(a.allMutations().map(e=>[e.name,e])),g=[...new Set(r.map(e=>e.kind))],p=new Set(g.map(e=>P(a.schema,e))),h=new Set(m.affordances.filter(e=>e.provider==="schema").map(e=>e.mutation)),o=e=>{let n=l.get(e.mutation);if(!n?.subject)return;let t=r.length===1&&e.provider==="invariant"&&!h.has(e.mutation)&&e.args[n.subject.arg]===r[0].id;if(!(e.provider!=="schema"&&!t)&&!(r.length>1&&e.batch?.length!==r.length)&&n.derived?.act!=="edit"&&!e.open.some(i=>p.has(i.name)))return n},y=[],b=new Set;for(let e of m.affordances){let n=o(e);if(!n||b.has(n.name))continue;b.add(n.name);let{[n.subject.arg]:t,...i}=e.args;y.push({id:e.id,label:v(n),mutation:n.name,subject:n.subject.arg,args:i,open:e.open,...e.destructive||e.setsAside?{more:!0}:{},...e.destructive?{destructive:!0}:{},affordance:{...e,label:v(n)}})}if(g.length===1){let e=g[0];for(let n of N(a.schema,e))for(let t of $(a.schema,[...l.values()],e,n)){if(t.by==="none"||r.every(d=>d[n]===t.value))continue;let i=r.find(d=>d[n]!==t.value),f=t.acts.find(d=>{let D=t.by==="step"?{[d.subject.arg]:i.id}:{[d.subject.arg]:i.id,[n]:t.value};return a.permits({name:d.name,args:D},u).ok});if(!f)continue;let w=t.by==="step"?{}:{[n]:t.value};if(t.by==="step"&&y.some(d=>d.mutation===f.name))continue;let R=t.by==="step"?v(f):`Move to ${t.label}`,O=`set:${n}:${t.value}`;y.push({id:O,label:R,mutation:f.name,subject:f.subject.arg,args:w,open:[],affordance:{id:O,label:R,provider:"schema",mutation:f.name,args:{[f.subject.arg]:i.id,...w},open:[],score:0,why:`every one is ${e}`,nodeIds:r.map(d=>d.id)}})}}let S=[...y.filter(e=>!e.more),...y.filter(e=>e.more)],A=m.withheld.filter(e=>{let n=l.get(e.mutation);return n?.subject!==void 0&&n.derived?.act!=="edit"&&(r.length===1||e.batch?.length===r.length)}).map(e=>({label:v(l.get(e.mutation)),message:e.refusal.message}));return{acts:S,withheld:A}}function _(a,s,c,r={}){let u=r.author,m=a.allMutations().find(e=>e.name===s.mutation),l=e=>M(a.schema,a.allMutations(),e),g=e=>{let n=a.graph.getNode(e);return n?k(a.schema.tryDefinition(n.kind),n):e},p=[],h=[],o=[];for(let e of[...new Set(c)]){let n={name:s.mutation,args:{...s.args,[s.subject]:e}};if(!m){p.push({id:e,label:g(e),message:`There is no act \u201C${s.mutation}\u201D.`,reason:"invalid"});continue}let t=a.permits(n,u);if(!t.ok){p.push({id:e,label:g(e),message:t.refusal.message,reason:"forbidden"});continue}if(!a.wouldChange(n,u)){h.push(e);continue}o.push({id:e,call:n})}let y=e=>a.previewAll(e,{...u?{author:u}:{},...r.context?{context:r.context}:{}});for(let e=0;o.length>0;e+=1)try{y(o.map(n=>n.call));break}catch(n){let t=[];for(let i of o)try{y([i.call]),t.push(i)}catch(f){p.push({id:i.id,label:g(i.id),message:l(f),reason:x(f).reason})}if(t.length===o.length||e>o.length){for(let i of t)p.push({id:i.id,label:g(i.id),message:l(n),reason:x(n).reason});o=[];break}o=t}if(o.length===0)return{applied:[],unchanged:h,refused:p};let b=s.label??(m?v(m):s.mutation),S=[...new Set(o.map(e=>a.graph.getNode(e.id)?.kind))],A=`${b} \u2014 ${S.length===1&&S[0]?j(a.schema,S[0],o.length):`${o.length} records`}`;try{let e=a.applyAll(o.map(n=>n.call),{intent:A,...u?{author:u}:{},...r.via?{via:r.via}:{}});return{batch:e.batch,intent:A,applied:o.map(n=>n.id),unchanged:h,refused:p,result:e}}catch(e){let n=l(e),t=x(e).reason;return{applied:[],unchanged:h,refused:[...p,...o.map(i=>({id:i.id,label:g(i.id),message:n,reason:t}))],allOrNothing:!0}}}export{V as a,_ as b};
1
+ import{e as $}from"./chunk.GBCWI2LF.js";import{a as C}from"./chunk.OGF6UORU.js";import{g as M}from"./chunk.MZOIPCDA.js";import{ca as k,da as v,fa as j,vb as x}from"./chunk.AW2T3KFV.js";function N(a,s){let c=a.tryDefinition(s),r=Object.keys(c?.fields?.shape??{}),m=[c?.lifecycle?.field,...r.filter(l=>/^(status|stage|state|phase)$/i.test(l))].filter(l=>l!==void 0&&r.includes(l));return[...new Set(m)].slice(0,1)}function P(a,s){return a.tryDefinition(s)?.fieldRoles?.title??"label"}function V(a,s,c={}){let r=s.map(e=>a.graph.getNode(e)).filter(e=>e!==void 0);if(r.length===0)return{acts:[],withheld:[]};let u=c.principal??{kind:"human"},m=C(a,r.map(e=>e.id),{...c.derive,principal:u,...c.context?{context:c.context}:{}}),l=new Map(a.allMutations().map(e=>[e.name,e])),g=[...new Set(r.map(e=>e.kind))],p=new Set(g.map(e=>P(a.schema,e))),h=new Set(m.affordances.filter(e=>e.provider==="schema").map(e=>e.mutation)),o=e=>{let n=l.get(e.mutation);if(!n?.subject)return;let t=r.length===1&&e.provider==="invariant"&&!h.has(e.mutation)&&e.args[n.subject.arg]===r[0].id;if(!(e.provider!=="schema"&&!t)&&!(r.length>1&&e.batch?.length!==r.length)&&n.derived?.act!=="edit"&&!e.open.some(i=>p.has(i.name)))return n},y=[],b=new Set;for(let e of m.affordances){let n=o(e);if(!n||b.has(n.name))continue;b.add(n.name);let{[n.subject.arg]:t,...i}=e.args;y.push({id:e.id,label:v(n),mutation:n.name,subject:n.subject.arg,args:i,open:e.open,...e.destructive||e.setsAside?{more:!0}:{},...e.destructive?{destructive:!0}:{},affordance:{...e,label:v(n)}})}if(g.length===1){let e=g[0];for(let n of N(a.schema,e))for(let t of $(a.schema,[...l.values()],e,n)){if(t.by==="none"||r.every(d=>d[n]===t.value))continue;let i=r.find(d=>d[n]!==t.value),f=t.acts.find(d=>{let D=t.by==="step"?{[d.subject.arg]:i.id}:{[d.subject.arg]:i.id,[n]:t.value};return a.permits({name:d.name,args:D},u).ok});if(!f)continue;let w=t.by==="step"?{}:{[n]:t.value};if(t.by==="step"&&y.some(d=>d.mutation===f.name))continue;let R=t.by==="step"?v(f):`Move to ${t.label}`,O=`set:${n}:${t.value}`;y.push({id:O,label:R,mutation:f.name,subject:f.subject.arg,args:w,open:[],affordance:{id:O,label:R,provider:"schema",mutation:f.name,args:{[f.subject.arg]:i.id,...w},open:[],score:0,why:`every one is ${e}`,nodeIds:r.map(d=>d.id)}})}}let S=[...y.filter(e=>!e.more),...y.filter(e=>e.more)],A=m.withheld.filter(e=>{let n=l.get(e.mutation);return n?.subject!==void 0&&n.derived?.act!=="edit"&&(r.length===1||e.batch?.length===r.length)}).map(e=>({label:v(l.get(e.mutation)),message:e.refusal.message}));return{acts:S,withheld:A}}function _(a,s,c,r={}){let u=r.author,m=a.allMutations().find(e=>e.name===s.mutation),l=e=>M(a.schema,a.allMutations(),e),g=e=>{let n=a.graph.getNode(e);return n?k(a.schema.tryDefinition(n.kind),n):e},p=[],h=[],o=[];for(let e of[...new Set(c)]){let n={name:s.mutation,args:{...s.args,[s.subject]:e}};if(!m){p.push({id:e,label:g(e),message:`There is no act \u201C${s.mutation}\u201D.`,reason:"invalid"});continue}let t=a.permits(n,u);if(!t.ok){p.push({id:e,label:g(e),message:t.refusal.message,reason:"forbidden"});continue}if(!a.wouldChange(n,u)){h.push(e);continue}o.push({id:e,call:n})}let y=e=>a.previewAll(e,{...u?{author:u}:{},...r.context?{context:r.context}:{}});for(let e=0;o.length>0;e+=1)try{y(o.map(n=>n.call));break}catch(n){let t=[];for(let i of o)try{y([i.call]),t.push(i)}catch(f){p.push({id:i.id,label:g(i.id),message:l(f),reason:x(f).reason})}if(t.length===o.length||e>o.length){for(let i of t)p.push({id:i.id,label:g(i.id),message:l(n),reason:x(n).reason});o=[];break}o=t}if(o.length===0)return{applied:[],unchanged:h,refused:p};let b=s.label??(m?v(m):s.mutation),S=[...new Set(o.map(e=>a.graph.getNode(e.id)?.kind))],A=`${b} \u2014 ${S.length===1&&S[0]?j(a.schema,S[0],o.length):`${o.length} records`}`;try{let e=a.applyAll(o.map(n=>n.call),{intent:A,...u?{author:u}:{},...r.via?{via:r.via}:{}});return{batch:e.batch,intent:A,applied:o.map(n=>n.id),unchanged:h,refused:p,result:e}}catch(e){let n=l(e),t=x(e).reason;return{applied:[],unchanged:h,refused:[...p,...o.map(i=>({id:i.id,label:g(i.id),message:n,reason:t}))],allOrNothing:!0}}}export{V as a,_ as b};
@@ -1 +1 @@
1
- import{g as o,l as u}from"./chunk.JE4QQEJE.js";function c(t,n,i){let e=r=>encodeURIComponent(r);return`${o}${e(t)}:${e(n)}:${e(i)}`}function S(t,n,i){let e=new Set(t.shown??[]);if(i?e.add(n):e.delete(n),e.size===0){let{shown:r,...w}=t;return w}return{...t,shown:[...e].sort()}}function l(t,n){if(n===null||n.trim().length===0){let{q:i,...e}=t;return e}return{...t,q:n}}function p(t){let n=t.q!==void 0&&t.within?.q===t.q;return l(n?u(t,"q",null):t,null)}function h(t,n){if(!n){let{past:i,...e}=t;return e}return{...t,past:!0}}function f(t,n){if(n===null||n.x===0&&n.y===0){let{pan:i,...e}=t;return e}return{...t,pan:n}}function d(t,n,i){let e={...t.pins};return i===null?delete e[n]:e[n]=i,{...t,pins:e}}export{c as a,S as b,l as c,p as d,h as e,f,d as g};
1
+ import{g as o,l as u}from"./chunk.4JWT6LIS.js";function c(t,n,i){let e=r=>encodeURIComponent(r);return`${o}${e(t)}:${e(n)}:${e(i)}`}function S(t,n,i){let e=new Set(t.shown??[]);if(i?e.add(n):e.delete(n),e.size===0){let{shown:r,...w}=t;return w}return{...t,shown:[...e].sort()}}function l(t,n){if(n===null||n.trim().length===0){let{q:i,...e}=t;return e}return{...t,q:n}}function p(t){let n=t.q!==void 0&&t.within?.q===t.q;return l(n?u(t,"q",null):t,null)}function h(t,n){if(!n){let{past:i,...e}=t;return e}return{...t,past:!0}}function f(t,n){if(n===null||n.x===0&&n.y===0){let{pan:i,...e}=t;return e}return{...t,pan:n}}function d(t,n,i){let e={...t.pins};return i===null?delete e[n]:e[n]=i,{...t,pins:e}}export{c as a,S as b,l as c,p as d,h as e,f,d as g};
@@ -0,0 +1 @@
1
+ import{b as a,c as b,d as c,e as d,f as e,g as f,h as g}from"./chunk.RLMW7DU6.js";import"./chunk.PXQVXBNG.js";import"./chunk.AW2T3KFV.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";export{g as createLinks,f as judgeDestination,e as listsOf,c as nowhere,a as placesSaid,b as quoted,d as whereOfWords};