graview 0.1.38 → 0.1.40

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 (205) hide show
  1. package/dist/preview/{chunk.XHWL7QBF.js → chunk.242EUAPE.js} +1 -1
  2. package/dist/preview/chunk.2CF2XKOS.js +1 -0
  3. package/dist/preview/chunk.2FGYWAID.js +1 -0
  4. package/dist/preview/{chunk.MWZK3HVG.js → chunk.2FLPDPEL.js} +1 -1
  5. package/dist/preview/{chunk.6IHXTT6Z.js → chunk.2GDXNTY5.js} +1 -1
  6. package/dist/preview/chunk.2JB4Y2ET.js +1 -0
  7. package/dist/preview/chunk.2NXH7VAI.js +1 -0
  8. package/dist/preview/chunk.2OSNYF5C.js +1 -0
  9. package/dist/preview/{chunk.GR5Q4HTW.js → chunk.2RVUDRRY.js} +1 -1
  10. package/dist/preview/chunk.2WACBAUN.js +9 -0
  11. package/dist/preview/chunk.35PHXNOC.js +1 -0
  12. package/dist/preview/chunk.3Q75TIGL.js +1 -0
  13. package/dist/preview/chunk.42XSBKPO.js +1 -0
  14. package/dist/preview/chunk.47KHZCNG.js +1 -0
  15. package/dist/preview/{chunk.Z3ZKYSPN.js → chunk.4QPVS2ZM.js} +1 -1
  16. package/dist/preview/{chunk.WERYQENC.js → chunk.4VG2KN7G.js} +1 -1
  17. package/dist/preview/{chunk.ZRQI5VJF.js → chunk.5RABSIF7.js} +1 -1
  18. package/dist/preview/{chunk.2VIGF4FO.js → chunk.67WWRC6Y.js} +1 -1
  19. package/dist/preview/chunk.6AVZWLRF.js +1 -0
  20. package/dist/preview/chunk.6CRRPXKP.js +1 -0
  21. package/dist/preview/{chunk.FUJM7GDV.js → chunk.6FNMDAX5.js} +1 -1
  22. package/dist/preview/chunk.6J37UQKG.js +1 -0
  23. package/dist/preview/chunk.6JEU3ZNE.js +1 -0
  24. package/dist/preview/chunk.6PSWHBL2.js +1 -0
  25. package/dist/preview/chunk.74NOI7QN.js +1 -0
  26. package/dist/preview/chunk.7LIKEE5Z.js +1 -0
  27. package/dist/preview/chunk.7WPCP2LZ.js +1 -0
  28. package/dist/preview/{chunk.JWJQ2VXS.js → chunk.ACBUAIDF.js} +1 -1
  29. package/dist/preview/{chunk.IEDXW36H.js → chunk.AKQXF7GW.js} +1 -1
  30. package/dist/preview/chunk.AUBGUDO5.js +1 -0
  31. package/dist/preview/chunk.AVKDWISO.js +1 -0
  32. package/dist/preview/{chunk.36SQJMEE.js → chunk.AWX7GP72.js} +1 -1
  33. package/dist/preview/chunk.BFNVG5JE.js +1 -0
  34. package/dist/preview/chunk.BNVMMOOY.js +1 -0
  35. package/dist/preview/{chunk.7H5KVW2F.js → chunk.BSAXZQSY.js} +1 -1
  36. package/dist/preview/{chunk.V2NBJDAX.js → chunk.BXT6FDT4.js} +1 -1
  37. package/dist/preview/{chunk.TKSGC6XH.js → chunk.C2PECN4C.js} +1 -1
  38. package/dist/preview/chunk.CL2ZS5EQ.js +1 -0
  39. package/dist/preview/chunk.CN5WAKHJ.js +5 -0
  40. package/dist/preview/{chunk.LF7PU77M.js → chunk.CNFL5IN5.js} +1 -1
  41. package/dist/preview/chunk.D25XEVKO.js +1 -0
  42. package/dist/preview/chunk.DL26BKT7.js +1 -0
  43. package/dist/preview/chunk.DPZTW24D.js +1 -0
  44. package/dist/preview/chunk.ESSSNLEO.js +1 -0
  45. package/dist/preview/chunk.ETOGQE2V.js +1 -0
  46. package/dist/preview/chunk.FDE3TSTK.js +1 -0
  47. package/dist/preview/chunk.FFZBOP65.js +1 -0
  48. package/dist/preview/chunk.FOQZADMA.js +25 -0
  49. package/dist/preview/chunk.G6VZNRQ5.js +1 -0
  50. package/dist/preview/chunk.GAFYE37S.js +3 -0
  51. package/dist/preview/{chunk.KNJZ2YNJ.js → chunk.GT2BITLW.js} +1 -1
  52. package/dist/preview/{chunk.ZLXPIEUC.js → chunk.GTV2VZAS.js} +2 -2
  53. package/dist/preview/{chunk.AZCFXPEL.js → chunk.GY6RYJHM.js} +1 -1
  54. package/dist/preview/chunk.GZIVMOY4.js +117 -0
  55. package/dist/preview/{chunk.VKHKYK5L.js → chunk.H5ADMSE7.js} +1 -1
  56. package/dist/preview/chunk.H5HWN7A2.js +1 -0
  57. package/dist/preview/chunk.H6XKMLDQ.js +1 -0
  58. package/dist/preview/chunk.H7POIT3V.js +1 -0
  59. package/dist/preview/{chunk.SGB6IMWN.js → chunk.HB7ELBVK.js} +1 -1
  60. package/dist/preview/chunk.HFYUAK5Z.js +6 -0
  61. package/dist/preview/{chunk.MCVY6RRS.js → chunk.HPAGOEZG.js} +1 -1
  62. package/dist/preview/{chunk.EUGWV3S6.js → chunk.I7XSDXQ3.js} +1 -1
  63. package/dist/preview/chunk.IDUPJMJO.js +1 -0
  64. package/dist/preview/chunk.IFTWVUJO.js +2 -0
  65. package/dist/preview/{chunk.RZVZG2BQ.js → chunk.ISXFH3CK.js} +1 -1
  66. package/dist/preview/chunk.J4IULZFD.js +1 -0
  67. package/dist/preview/chunk.JACGQ2PR.js +4 -0
  68. package/dist/preview/{chunk.67WL7BGF.js → chunk.JDRLSVOI.js} +1 -1
  69. package/dist/preview/chunk.JLDBFX6O.js +1 -0
  70. package/dist/preview/{chunk.RVJYEOFN.js → chunk.JQEYZB5I.js} +1 -1
  71. package/dist/preview/chunk.L3A6YLMT.js +21 -0
  72. package/dist/preview/chunk.LLEFYJPJ.js +344 -0
  73. package/dist/preview/chunk.LOZJQ5ZX.js +1 -0
  74. package/dist/preview/chunk.LPBM5AES.js +19 -0
  75. package/dist/preview/chunk.LPE4FLC6.js +6 -0
  76. package/dist/preview/{chunk.SZWX56WR.js → chunk.MIM2QLF5.js} +2 -2
  77. package/dist/preview/{chunk.FMVWXSQ7.js → chunk.N2K25KH3.js} +1 -1
  78. package/dist/preview/{chunk.2EJAIT33.js → chunk.N6MVK3KD.js} +1 -1
  79. package/dist/preview/{chunk.33GN2NUT.js → chunk.NGDXH66B.js} +1 -1
  80. package/dist/preview/chunk.O5JKDFDH.js +1 -0
  81. package/dist/preview/chunk.O6F3K6CU.js +1 -0
  82. package/dist/preview/{chunk.V5ZT5NSJ.js → chunk.OW7NSJ4H.js} +1 -1
  83. package/dist/preview/chunk.P5ODICND.js +32 -0
  84. package/dist/preview/{chunk.YPY5BOEI.js → chunk.PPG2SEIY.js} +1 -1
  85. package/dist/preview/chunk.PXQVXBNG.js +1 -0
  86. package/dist/preview/chunk.PYNYHNDS.js +1 -0
  87. package/dist/preview/{chunk.MVNUWK5Y.js → chunk.Q4TZHWQX.js} +1 -1
  88. package/dist/preview/chunk.QCWZSSNC.js +1 -0
  89. package/dist/preview/chunk.QIV65FWE.js +1 -0
  90. package/dist/preview/chunk.R5WY567U.js +88 -0
  91. package/dist/preview/{chunk.VNBR4DHD.js → chunk.RCM7NOPF.js} +2 -1
  92. package/dist/preview/chunk.S2U5CEP4.js +1 -0
  93. package/dist/preview/chunk.S356ACK2.js +1 -0
  94. package/dist/preview/chunk.SDO3U72B.js +1 -0
  95. package/dist/preview/chunk.SHNYYBNW.js +1 -0
  96. package/dist/preview/{chunk.DL637Q3W.js → chunk.SIGC3G7S.js} +1 -1
  97. package/dist/preview/chunk.STI447YW.js +1 -0
  98. package/dist/preview/chunk.T3TYD7QI.js +1 -0
  99. package/dist/preview/chunk.T73RB7LC.js +1 -0
  100. package/dist/preview/chunk.TD2LNFUB.js +1 -0
  101. package/dist/preview/{chunk.5XJEGXDO.js → chunk.TGVUIFKD.js} +1 -1
  102. package/dist/preview/chunk.TIH2PDFH.js +1 -0
  103. package/dist/preview/chunk.TKUNRFDE.js +1 -0
  104. package/dist/preview/{chunk.74RMHUCX.js → chunk.TNESS3LQ.js} +1 -1
  105. package/dist/preview/chunk.UHI3D7JC.js +1 -0
  106. package/dist/preview/{chunk.TOWYHWPB.js → chunk.UOPKRN55.js} +1 -1
  107. package/dist/preview/{chunk.BUVAMSOZ.js → chunk.UTCB3CE7.js} +2 -2
  108. package/dist/preview/{chunk.3D5T3XIE.js → chunk.UUBYFBPN.js} +1 -1
  109. package/dist/preview/{chunk.YUJG5SN5.js → chunk.UWW6ZEPY.js} +2 -2
  110. package/dist/preview/chunk.V5MYKNL7.js +5 -0
  111. package/dist/preview/{chunk.6UCRL4OF.js → chunk.VDAMCTNL.js} +1 -1
  112. package/dist/preview/chunk.VF7P3ZVZ.js +35 -0
  113. package/dist/preview/chunk.VIYECFKZ.js +6 -0
  114. package/dist/preview/{chunk.5MSO3KRO.js → chunk.VJXXCUKS.js} +1 -1
  115. package/dist/preview/{chunk.GZ3IXNA4.js → chunk.VNUHESMZ.js} +1 -1
  116. package/dist/preview/chunk.VZYCILPJ.js +1 -0
  117. package/dist/preview/chunk.W4HBRXMY.js +1 -0
  118. package/dist/preview/chunk.W7R2GFBW.js +47 -0
  119. package/dist/preview/chunk.WBLHCH5M.js +1 -0
  120. package/dist/preview/{chunk.NPX7SPXM.js → chunk.WVDKYUF3.js} +1 -1
  121. package/dist/preview/{chunk.LHO7L3CS.js → chunk.XEKLEHC3.js} +1 -1
  122. package/dist/preview/{chunk.IM7LXLIB.js → chunk.XFZKP4IF.js} +1 -1
  123. package/dist/preview/chunk.XQHDP5C3.js +1 -0
  124. package/dist/preview/chunk.XQTMO5PW.js +1 -0
  125. package/dist/preview/{chunk.UXIFQIHA.js → chunk.XRYTJNA7.js} +1 -1
  126. package/dist/preview/chunk.YO24NALN.js +1 -0
  127. package/dist/preview/{chunk.B5ILKGEF.js → chunk.YWNHCZQ5.js} +1 -1
  128. package/dist/preview/chunk.YWVOACSX.js +5 -0
  129. package/dist/preview/chunk.YYFLTMNN.js +1 -0
  130. package/dist/preview/chunk.YYIKSH2F.js +3 -0
  131. package/dist/preview/{chunk.QYRPELLU.js → chunk.Z5AB2DBF.js} +1 -1
  132. package/dist/preview/{chunk.6ONRWFA6.js → chunk.Z7LDT55A.js} +1 -1
  133. package/dist/preview/chunk.ZGCRMNER.js +1 -0
  134. package/dist/preview/{chunk.OE4QOBJF.js → chunk.ZHLQWMV5.js} +1 -1
  135. package/dist/preview/{chunk.ROGYDMES.js → chunk.ZJMDLRC5.js} +1 -1
  136. package/dist/preview/chunk.ZK3X23EU.js +1 -0
  137. package/dist/preview/chunk.ZOR6FKNI.js +1 -0
  138. package/dist/preview/chunk.ZRLXVYPG.js +1 -0
  139. package/dist/preview/index.html +47 -43
  140. package/dist/preview/page.js +8 -8
  141. package/package.json +6 -6
  142. package/dist/preview/chunk.2HFRVWWM.js +0 -1
  143. package/dist/preview/chunk.3FW4QNGV.js +0 -1
  144. package/dist/preview/chunk.3RT2GUZ5.js +0 -1
  145. package/dist/preview/chunk.3ZRHHB7X.js +0 -1
  146. package/dist/preview/chunk.4DEUD66C.js +0 -6
  147. package/dist/preview/chunk.4EQSP7I3.js +0 -1
  148. package/dist/preview/chunk.4Y6BCHV2.js +0 -1
  149. package/dist/preview/chunk.5VBBQ6Z3.js +0 -1
  150. package/dist/preview/chunk.6CKBIY7L.js +0 -1
  151. package/dist/preview/chunk.6XJP7F3I.js +0 -1
  152. package/dist/preview/chunk.7RSZMIAL.js +0 -1
  153. package/dist/preview/chunk.AFY35RJP.js +0 -1
  154. package/dist/preview/chunk.BRHRAVU2.js +0 -3
  155. package/dist/preview/chunk.DFVVS6C5.js +0 -1
  156. package/dist/preview/chunk.DQJAEU4V.js +0 -1
  157. package/dist/preview/chunk.ESSQAMPM.js +0 -1
  158. package/dist/preview/chunk.EV553KRT.js +0 -1
  159. package/dist/preview/chunk.EZP4FHDX.js +0 -35
  160. package/dist/preview/chunk.F6PIK2J2.js +0 -1
  161. package/dist/preview/chunk.FTJBW25J.js +0 -1
  162. package/dist/preview/chunk.FYIQZMVF.js +0 -1
  163. package/dist/preview/chunk.HUSFMFXH.js +0 -1
  164. package/dist/preview/chunk.HVTGPEVW.js +0 -1
  165. package/dist/preview/chunk.I3SQJ2L2.js +0 -1
  166. package/dist/preview/chunk.IU6ISXXC.js +0 -1
  167. package/dist/preview/chunk.K5KEECHL.js +0 -88
  168. package/dist/preview/chunk.L34FY7QQ.js +0 -1
  169. package/dist/preview/chunk.L73VUBXN.js +0 -4
  170. package/dist/preview/chunk.L7JKEEMM.js +0 -1
  171. package/dist/preview/chunk.LAW5PQEM.js +0 -1
  172. package/dist/preview/chunk.LDD3QX7G.js +0 -1
  173. package/dist/preview/chunk.LU5LSXSW.js +0 -1
  174. package/dist/preview/chunk.MQ7FNHXG.js +0 -25
  175. package/dist/preview/chunk.NH5TDAB2.js +0 -1
  176. package/dist/preview/chunk.NORRCKGN.js +0 -1
  177. package/dist/preview/chunk.NQQHOSOK.js +0 -1
  178. package/dist/preview/chunk.NWWMUOZM.js +0 -1
  179. package/dist/preview/chunk.OEF3GPRM.js +0 -1
  180. package/dist/preview/chunk.OS3L4ZOF.js +0 -2
  181. package/dist/preview/chunk.OTL3Z345.js +0 -1
  182. package/dist/preview/chunk.P3UPCI23.js +0 -1
  183. package/dist/preview/chunk.PGKIEDYV.js +0 -9
  184. package/dist/preview/chunk.PKUWET2F.js +0 -1
  185. package/dist/preview/chunk.POHEWJKZ.js +0 -1
  186. package/dist/preview/chunk.PUBG2L6F.js +0 -117
  187. package/dist/preview/chunk.QT4XGC5Z.js +0 -344
  188. package/dist/preview/chunk.QTTBZJ6W.js +0 -1
  189. package/dist/preview/chunk.RJDZOF2L.js +0 -1
  190. package/dist/preview/chunk.SGLJTSTD.js +0 -1
  191. package/dist/preview/chunk.SITFEJES.js +0 -1
  192. package/dist/preview/chunk.UF3L6FJO.js +0 -1
  193. package/dist/preview/chunk.VSYHU5MA.js +0 -1
  194. package/dist/preview/chunk.VTWFVPKD.js +0 -19
  195. package/dist/preview/chunk.VV4BPOIK.js +0 -1
  196. package/dist/preview/chunk.W2HCJQVK.js +0 -32
  197. package/dist/preview/chunk.WG5NIR23.js +0 -47
  198. package/dist/preview/chunk.WLPTY4BF.js +0 -5
  199. package/dist/preview/chunk.XDYAG276.js +0 -1
  200. package/dist/preview/chunk.XM3NPZLP.js +0 -1
  201. package/dist/preview/chunk.YAXZNQY6.js +0 -1
  202. package/dist/preview/chunk.YG423NEB.js +0 -1
  203. package/dist/preview/chunk.YVR3ZMTV.js +0 -1
  204. package/dist/preview/chunk.YXH3IWNR.js +0 -1
  205. package/dist/preview/chunk.ZYCNEOAQ.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graview",
3
- "version": "0.1.38",
3
+ "version": "0.1.40",
4
4
  "type": "module",
5
5
  "description": "The Graview command line: start a product, check its declaration, write its agent docs, serve its store, preview a document with no product and photograph its places, say whether a product is on one release, host it for an agent over MCP, apply an act to it, sync its seed, install the authoring skills. The tool; @graview/* is the framework.",
6
6
  "keywords": [
@@ -29,11 +29,11 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@graview/guest": "0.1.38",
33
- "@graview/core": "0.1.38",
34
- "@graview/ship": "0.1.38",
35
- "@graview/skills": "0.1.38",
36
- "@graview/tools": "0.1.38"
32
+ "@graview/core": "0.1.40",
33
+ "@graview/guest": "0.1.40",
34
+ "@graview/ship": "0.1.40",
35
+ "@graview/skills": "0.1.40",
36
+ "@graview/tools": "0.1.40"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=22"
@@ -1 +0,0 @@
1
- import{c as k,d as x,e as H}from"./chunk.IEDXW36H.js";import{b as A}from"./chunk.7RSZMIAL.js";import{d as E}from"./chunk.6IHXTT6Z.js";import"./chunk.OEF3GPRM.js";import{a as b}from"./chunk.UT6642FC.js";import"./chunk.TI4OSTQV.js";import"./chunk.MWZK3HVG.js";import"./chunk.3D5T3XIE.js";import"./chunk.GR5Q4HTW.js";import{m as S}from"./chunk.QT4XGC5Z.js";import{$ as p,Ba as w,H as L,S as h,ba as f,xa as v}from"./chunk.MQ7FNHXG.js";import{Ua as m}from"./chunk.WLPTY4BF.js";import{b as g}from"./chunk.AJZBJBMO.js";var l=g(L(),1);var e=g(h(),1);function I(){let{store:t,principal:r}=p(),a=f(),i=(0,l.useMemo)(()=>k(t,r),[t,r,a]),n=w("suggested");return i.length===0?null:(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"suggested-button",...n.trigger,onClick:n.toggle,title:"What tidying suggests, waiting for you",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:[i.length,(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("path",{d:"M3 4.5 H13 M3 8 H10 M3 11.5 H8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12.25",cy:"11.5",r:"1.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]}),(0,e.jsx)("span",{className:"graview-activity-word",children:" Suggested"})]}),n.open?(0,e.jsxs)("section",{...n.pane,"aria-label":"Suggested","data-testid":"suggested","data-graview-offstage":"",style:{...v,width:320,maxHeight:"min(52cqh, 460px)",overflow:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...S,margin:0},children:"Suggested"}),(0,e.jsx)("p",{style:{margin:0,fontSize:"0.75rem",lineHeight:1.45,color:"var(--graview-ink-faint)"},children:"Not made yet: each waits for you."}),(0,e.jsx)("ol",{"data-testid":"suggestions",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10,fontSize:"0.8125rem"},children:i.map(s=>(0,e.jsx)(O,{suggestion:s,...i.length===1?{settled:()=>{n.setOpen(!1),document.querySelector('[data-testid="activity-button"]')?.focus()}}:{}},s.id))})]}):null]})}function O({suggestion:t,settled:r}){let{store:a,principal:i,seats:n,people:s}=p(),[c,u]=(0,l.useState)(null),T=m(t.author,{graph:a.graph,schema:a.schema,seats:n,people:s}),y=o=>{u(null);try{o==="accept"?x(a,t.id,{author:i}):H(a,t.id,{author:i}),r?.()}catch(d){u(d instanceof Error?d.message:String(d))}};return(0,e.jsxs)("li",{"data-testid":"suggestion","data-suggestion":t.id,style:{display:"grid",gap:5,lineHeight:1.45},children:[(0,e.jsxs)("span",{children:[(0,e.jsx)("strong",{style:{fontWeight:600},children:T})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:"suggests"})," ",t.intent]}),t.lineage?(0,e.jsx)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:b(t.lineage)}):null,t.about.length>0?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:t.about.slice(0,4).map(o=>(0,e.jsx)(E,{label:A(a,o),pickId:o},o))}):null,(0,e.jsxs)("div",{style:{display:"flex",gap:6},children:[(0,e.jsx)("button",{type:"button","data-testid":"suggestion-accept",onClick:()=>y("accept"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Accept"}),(0,e.jsx)("button",{type:"button","data-testid":"suggestion-decline",onClick:()=>y("decline"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Decline"})]}),c?(0,e.jsx)("span",{"data-testid":"suggestion-refused",role:"alert",style:{fontSize:"0.75rem",color:"var(--graview-warn)"},children:c}):null]})}export{I as SuggestedTray};
@@ -1 +0,0 @@
1
- import{b as c}from"./chunk.PUBG2L6F.js";import"./chunk.WG5NIR23.js";import"./chunk.3ZRHHB7X.js";import"./chunk.UGFDSE37.js";import{l as m}from"./chunk.ZYCNEOAQ.js";import"./chunk.4DEUD66C.js";import"./chunk.LHO7L3CS.js";import"./chunk.YG423NEB.js";import"./chunk.VNBR4DHD.js";import"./chunk.Z3ZKYSPN.js";import"./chunk.6ONRWFA6.js";import"./chunk.AFY35RJP.js";import"./chunk.POHEWJKZ.js";import"./chunk.ROGYDMES.js";import"./chunk.6IHXTT6Z.js";import"./chunk.YXH3IWNR.js";import"./chunk.OEF3GPRM.js";import"./chunk.BRHRAVU2.js";import"./chunk.VTWFVPKD.js";import"./chunk.ZRQI5VJF.js";import"./chunk.33GN2NUT.js";import"./chunk.2VIGF4FO.js";import"./chunk.FTJBW25J.js";import"./chunk.UT6642FC.js";import"./chunk.RZVZG2BQ.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.2EJAIT33.js";import"./chunk.EUGWV3S6.js";import"./chunk.6XJP7F3I.js";import"./chunk.NPX7SPXM.js";import"./chunk.OE4QOBJF.js";import"./chunk.74RMHUCX.js";import"./chunk.GZHZLJBF.js";import"./chunk.I3SQJ2L2.js";import"./chunk.OJGHDWI6.js";import"./chunk.FUJM7GDV.js";import"./chunk.MWZK3HVG.js";import"./chunk.3D5T3XIE.js";import"./chunk.GR5Q4HTW.js";import"./chunk.QT4XGC5Z.js";import{H as S,S as g}from"./chunk.MQ7FNHXG.js";import{jd as n}from"./chunk.WLPTY4BF.js";import{b as t}from"./chunk.AJZBJBMO.js";var y=t(S(),1),a=t(g(),1);function E({store:h,auto:f,brand:i,views:u,presence:o,steering:r,overview:s,scope:d,titleLevel:v=2,quickAsk:l,props:e}){let b=(0,y.useMemo)(()=>m({scope:`.${d}`}),[d]);return(0,a.jsxs)("div",{"data-embed-content":"",style:f?{flex:"0 0 auto",background:"var(--graview-ground)"}:{flex:"1 1 auto",minHeight:0,overflow:"auto",background:"var(--graview-ground)"},children:[(0,a.jsx)("style",{children:b}),(0,a.jsx)("div",{"data-embed-measure":"",style:{display:"flow-root"},children:(0,a.jsx)(c,{context:{store:h,embedded:!0,...e.bar!==!1?{barAbove:!0}:{},...s?{overview:s}:{},titleLevel:v,views:u,settings:e.app.settings??[],...o?{presence:o}:{},...i?{brand:i}:{},...e.locale?{locale:e.locale}:{},...e.timeZone?{timeZone:e.timeZone}:{},...e.principal?{principal:e.principal}:{},...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{},...e.subscriptions?{subscriptions:e.subscriptions}:{},...e.signIn?{signIn:e.signIn}:{},...l!==void 0?{quickAsk:l}:{}},...e.pages?{registry:e.pages}:{},...r?{steering:r}:{},...e.routing==="address"?n(e.basePath)===""?{}:{basename:n(e.basePath)}:{initialPath:e.path??"/"},...e.path!==void 0?{path:e.path}:{},...e.onNavigate?{onNavigate:e.onNavigate}:{}})})]})}export{E as PagesContent};
@@ -1 +0,0 @@
1
- import{b as x}from"./chunk.YXH3IWNR.js";import"./chunk.OEF3GPRM.js";import"./chunk.BRHRAVU2.js";import"./chunk.WVUJXDXZ.js";import"./chunk.2EJAIT33.js";import"./chunk.EUGWV3S6.js";import"./chunk.6XJP7F3I.js";import"./chunk.NPX7SPXM.js";import"./chunk.OE4QOBJF.js";import"./chunk.74RMHUCX.js";import"./chunk.GZHZLJBF.js";import{n as R}from"./chunk.I3SQJ2L2.js";import"./chunk.OJGHDWI6.js";import"./chunk.FUJM7GDV.js";import"./chunk.MWZK3HVG.js";import"./chunk.3D5T3XIE.js";import"./chunk.GR5Q4HTW.js";import"./chunk.QT4XGC5Z.js";import{H as A,S as v,aa as g}from"./chunk.MQ7FNHXG.js";import{ia as y,ma as c,pc as k}from"./chunk.WLPTY4BF.js";import{b as u}from"./chunk.AJZBJBMO.js";var f=u(A(),1);var L=u(A(),1),S=(0,L.createContext)(void 0);var i=u(v(),1),W=new WeakMap,m=new WeakMap,P=(e,n)=>`${n.kind}\0${n.id??""}\0${e}`;function b(e,n,a){let p=P(n,a),o=W.get(e);o||W.set(e,o=new Map);let t=o.get(p);return t||(t=Promise.resolve().then(()=>e(n,a)).then(r=>C(r)?r:null,()=>null).then(r=>{let s=m.get(e);return s||m.set(e,s=new Map),s.set(p,r),r}),o.set(p,t)),t}function C(e){if(e===null)return!0;if(typeof e!="object"||e===void 0)return!1;if(e.denied===!0)return!0;let n=e;return typeof n.name=="string"&&n.name.trim()!==""&&typeof n.href=="string"}function h(e){if(/^https?:\/\//i.test(e))try{return new URL(e).href}catch{return}}var N=e=>h(e)??(c(e)?e:void 0),E=e=>h(e)??(e.startsWith("/")&&c(e)?e:void 0),I={kind:"human"},w={color:"var(--graview-ink-muted)"};function M({icon:e}){if(!e)return null;let n=E(e);if(n)return(0,i.jsx)("img",{src:n,alt:"",width:20,height:20,"data-graview-app-icon":"",style:{width:20,height:20,borderRadius:5,objectFit:"cover",flex:"0 0 auto"}});let a=[...e.trim()].slice(0,2).join("");return a?(0,i.jsx)("span",{"aria-hidden":"true","data-graview-app-icon":"",style:{flex:"0 0 auto",lineHeight:"20px"},children:a}):null}function V(e){let n=g(),a=(0,f.useContext)(S)??n?.resolveApp,p=n?.principal??I,o=()=>a?m.get(a)?.get(P(e,p))??"asking":null,[t,r]=(0,f.useState)(o);return(0,f.useEffect)(()=>{let s=o();if(r(s),s!=="asking"||!a)return;let l=!0;return b(a,e,p).then(d=>l&&r(d)),()=>{l=!1}},[a,e,p.kind,p.id]),t}function D({address:e,as:n="chip",nodeId:a,field:p,style:o}){let t=V(e),r={position:"relative",zIndex:k.raised,overflowWrap:"anywhere",minWidth:0,maxWidth:"100%",...o},s;if(t==="asking")s=(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"asking","aria-busy":"true",style:{...w,...r},children:"Linked app"});else if(t&&"denied"in t)s=(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"denied",style:{...w,fontStyle:"italic",...r},children:"linked app (no access)"});else if(t){let l=N(t.href),d=n==="record"?t.headline?.trim():void 0;s=(0,i.jsxs)(l?"a":"span",{"data-graview-app-link":"","data-graview-app-state":"found",...l?{href:l}:{},...!d&&t.headline?{title:t.headline}:{},style:{display:"inline-flex",alignItems:d?"flex-start":"center",minHeight:24,gap:8,color:"inherit",textUnderlineOffset:3,...r},children:[(0,i.jsx)(M,{icon:t.icon}),(0,i.jsxs)("span",{style:{display:"grid",minWidth:0},children:[(0,i.jsx)("span",{"data-graview-app-name":"",style:{fontWeight:600},children:t.name}),d?(0,i.jsx)("span",{"data-graview-app-headline":"",style:{...w,fontSize:"0.8125em",fontWeight:400},children:d}):null]})]})}else{let l=h(e);s=l?(0,i.jsx)("a",{"data-graview-app-link":"","data-graview-app-state":"plain",href:l,rel:"noopener noreferrer",target:"_blank",style:{color:"var(--graview-accent)",display:"inline-flex",alignItems:"center",minHeight:24,...r},children:e}):(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"plain",style:r,children:e})}return a&&p?(0,i.jsx)(H,{nodeId:a,field:p,address:e,drawn:s}):s}function H({nodeId:e,field:n,address:a,drawn:p}){let o=R(e).fields.some(s=>s.field===n),t=g()?.store;if(!o)return p;let r=y(t?t.schema.tryDefinition(String(t.graph.getNode(e)?.kind)):void 0,n).toLowerCase();return(0,i.jsxs)("span",{style:{display:"inline-flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px",maxWidth:"100%",minWidth:0},children:[p,(0,i.jsx)("span",{style:{fontSize:"0.8125rem"},children:(0,i.jsx)(x,{nodeId:e,field:n,value:"Change",stored:a,said:`Change the ${r}`})})]})}var _=e=>(0,i.jsx)(D,{...e});export{D as AppLink,_ as drawAppLink};
@@ -1 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{r as b}from"./chunk.QT4XGC5Z.js";import{$ as v,H as w,K as P,S as p,a as A,oa as R}from"./chunk.MQ7FNHXG.js";import{fd as k}from"./chunk.WLPTY4BF.js";import{b as a}from"./chunk.AJZBJBMO.js";var L=a(p(),1),B=b.part(e=>(0,L.jsx)(e.ActivityRail,{calls:[]}),{quiet:!0});var l=a(w(),1),g=a(p(),1),C=R(A(()=>(__graviewPreload(import.meta.url,["./chunk.RJDZOF2L.js","./chunk.POHEWJKZ.js","./chunk.IEDXW36H.js","./chunk.7RSZMIAL.js","./chunk.6IHXTT6Z.js","./chunk.OEF3GPRM.js","./chunk.UT6642FC.js","./chunk.YPY5BOEI.js","./chunk.VKHKYK5L.js","./chunk.TI4OSTQV.js","./chunk.GZHZLJBF.js","./chunk.I3SQJ2L2.js","./chunk.OJGHDWI6.js","./chunk.FUJM7GDV.js","./chunk.MWZK3HVG.js","./chunk.3D5T3XIE.js","./chunk.GR5Q4HTW.js","./chunk.QT4XGC5Z.js","./chunk.MQ7FNHXG.js","./chunk.WLPTY4BF.js","./chunk.AJZBJBMO.js"]),import("./chunk.ESSQAMPM.js")))),T=C.part((e,r)=>{let t=e.RecordInteractions;return(0,g.jsx)(t,{...r})},{quiet:!0});function F(e,r,t){let o=e.target;return(o.on==="record"||o.on==="field"?o.id===r:o.on==="selection"?o.ids.includes(r):o.on==="act"?o.id===r:!1)||e.offered.some(n=>n.id===`record:${r}`||n.id.startsWith(`fill:${r}:`))||(e.batches??[]).some(n=>t(n).includes(r))}function I({id:e,style:r,headingStyle:t,className:o}){let{ai:d,aiDesk:n,store:f}=v(),{entries:y}=P(n),s=d.off===!0;(0,l.useEffect)(()=>{s||n.load()},[n,s]);let S=f.log.length,m=(0,l.useMemo)(()=>{let x=u=>f.log.all().flatMap(h=>h.batch===u?h.writes:[]);return y.filter(u=>F(u,e,x))},[y,e,f,S]);return s||m.length===0?null:(0,g.jsx)(l.Suspense,{fallback:null,children:(0,g.jsx)(T,{entries:m,...r?{style:r}:{},...t?{headingStyle:t}:{},...o?{className:o}:{}})})}var c=a(w(),1),i=a(p(),1);function po({context:e,stop:r,title:t,label:o,style:d,className:n,children:f,...y}){let s=k(e.views?.arrangement?.()),S=f??(0,i.jsxs)(i.Fragment,{children:["In ",s==="Scene"?"the scene":s.replace(/^The /,"the ")," ",(0,i.jsx)("span",{"aria-hidden":"true",children:"\u2197"})]}),m=o?{"aria-label":o}:{};if(e.overview){let x=e.overview;return(0,i.jsx)("a",{href:r,...y,...m,...t?{title:t}:{},style:d,...n?{className:n}:{},onClick:u=>{u.preventDefault(),x(r)},children:S})}return e.embedded?null:(0,i.jsx)("a",{href:`${e.sceneHref??"/"}${r}`,...y,...m,...t?{title:t}:{},style:d,...n?{className:n}:{},children:S})}function lo(){return(0,i.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:e=>{e.preventDefault();let r=new URL(window.location.href);r.searchParams.set("fresh","1"),window.location.assign(r.toString())},style:{color:"inherit",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24},children:"Start fresh"})}function co(e){let r=(0,c.useRef)(0),t=(0,c.useCallback)(o=>e.subscribe(()=>{r.current+=1,o()}),[e]);return(0,c.useSyncExternalStore)(t,()=>r.current,()=>0)}export{B as a,I as b,po as c,lo as d,co as e};
@@ -1,6 +0,0 @@
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{H as C,S as k,a as H,oa as K}from"./chunk.MQ7FNHXG.js";import{b}from"./chunk.AJZBJBMO.js";var n=b(C(),1),N=450,_=10,O=t=>t instanceof HTMLInputElement?t.dataset.graviewChooseBox??void 0:void 0,q={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:-1/0,End:1/0},S=t=>t instanceof Element?t.closest("[data-graview-choose]"):null,G=t=>t instanceof HTMLElement&&(t.isContentEditable||t instanceof HTMLInputElement&&t.type!=="checkbox"||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement);function Y(t){let[i,d]=(0,n.useState)(()=>new Set),l=(0,n.useRef)(null),x=(0,n.useRef)(null),[E,P]=(0,n.useState)(null),R=E!==null&&t.includes(E)?E:t[0],L=(0,n.useMemo)(()=>t.filter(e=>i.has(e)),[t,i]),M=(0,n.useMemo)(()=>new Set(t),[t]);(0,n.useEffect)(()=>{[...i].some(e=>!M.has(e))&&d(e=>new Set([...e].filter(o=>M.has(o))))},[M,i]);let u=(0,n.useCallback)((e,o=!1)=>{let a=l.current;d(s=>{let r=new Set(s),f=a===null?-1:t.indexOf(a),y=t.indexOf(e);if(o&&f>=0&&y>=0){let T=s.has(a);for(let p of t.slice(Math.min(f,y),Math.max(f,y)+1))T?r.add(p):r.delete(p)}else r.has(e)?r.delete(e):r.add(e);return r}),l.current=e},[t]),v=(0,n.useCallback)(e=>d(new Set(e)),[]),A=(0,n.useCallback)(()=>{l.current=null,d(new Set)},[]),c=(0,n.useRef)(null),g=(0,n.useRef)(!1),m=L.length>0,h=()=>{c.current&&clearTimeout(c.current.timer),c.current=null};(0,n.useEffect)(()=>h,[]);let B={ref:x,onKeyDown:e=>{if(G(e.target))return;let o=O(e.target);if(e.key==="Tab"&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&o!==void 0&&m){let s=document.querySelector('[data-testid="several-bar"]'),r=s?.querySelector("[data-mutation]:not([disabled])")??s?.querySelector("button:not([disabled])");if(r){e.preventDefault(),e.stopPropagation(),r.focus();return}}let a=q[e.key];if(o!==void 0&&a!==void 0&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let s=t.indexOf(o),r=t[Math.max(0,Math.min(t.length-1,s+(Number.isFinite(a)?a:a>0?t.length:-t.length)))];if(e.preventDefault(),e.stopPropagation(),r===void 0||r===o)return;if(e.shiftKey){let f=l.current!==null&&t.includes(l.current)?l.current:o,[y,T]=[t.indexOf(f),t.indexOf(r)].sort((p,F)=>p-F);d(p=>new Set([...p,...t.slice(y,T+1)])),l.current=f}P(r),x.current?.querySelector(`[data-graview-choose-box="${CSS.escape(r)}"]`)?.focus();return}if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="a"){e.preventDefault(),e.stopPropagation(),v(t);return}if(e.key===" "&&!e.metaKey&&!e.ctrlKey){let s=S(e.target),r=e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement&&e.target.type==="checkbox";if(!s||r)return;e.preventDefault(),u(s.dataset.graviewChoose,e.shiftKey)}},onFocus:e=>{let o=O(e.target);o!==void 0&&P(o)},onPointerDown:e=>{if(g.current=!1,e.pointerType==="mouse"||e.button>0)return;let o=S(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox")return;let a=o.dataset.graviewChoose;h(),c.current={id:a,x:e.clientX,y:e.clientY,timer:setTimeout(()=>{c.current=null,g.current=!0,u(a)},N)}},onPointerMove:e=>{let o=c.current;o&&Math.hypot(e.clientX-o.x,e.clientY-o.y)>_&&h()},onPointerUp:h,onPointerCancel:h,onClickCapture:e=>{let o=S(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox"&&e.target.hasAttribute("data-graview-choose-box"))return;if(g.current){g.current=!1,e.preventDefault(),e.stopPropagation();return}let s=o.dataset.graviewChoose;if(e.shiftKey&&(m||l.current!==null)){e.preventDefault(),e.stopPropagation(),u(s,!0);return}m&&matchMedia?.("(pointer: coarse)").matches&&(e.preventDefault(),e.stopPropagation(),u(s))},onContextMenu:e=>{(g.current||c.current)&&(e.preventDefault(),e.stopPropagation())},...m?{"data-graview-choosing":""}:{}},j=(0,n.useCallback)(e=>i.has(e),[i]);return{chosen:L,has:j,toggle:u,choose:v,clear:A,listProps:B,boxProps:(e,o)=>({type:"checkbox",className:"graview-choose-box","data-graview-choose-box":e,"aria-label":`Choose ${o}`,tabIndex:e===R?0:-1,checked:i.has(e),onChange:()=>{},onClick:a=>{a.stopPropagation(),u(e,a.shiftKey)}}),list:x}}var $=`
2
- .graview-choose-box{width:24px;height:24px;margin:0;accent-color:var(--graview-accent);cursor:pointer;opacity:0}
3
- [data-graview-choose]:hover .graview-choose-box,[data-graview-choose]:focus-within .graview-choose-box,.graview-choose-box:focus-visible,.graview-choose-box:checked,[data-graview-choosing] .graview-choose-box{opacity:1}
4
- [data-graview-choose]{-webkit-touch-callout:none}
5
- [data-graview-choosing] [data-graview-choose]{-webkit-user-select:none;user-select:none}
6
- `;var D=b(C(),1),w=b(k(),1),I=K(H(()=>(__graviewPreload(import.meta.url,["./chunk.TKSGC6XH.js","./chunk.IM7LXLIB.js","./chunk.7RSZMIAL.js","./chunk.OEF3GPRM.js","./chunk.QYRPELLU.js","./chunk.FTJBW25J.js","./chunk.UT6642FC.js","./chunk.MB7LKKUD.js","./chunk.2EJAIT33.js","./chunk.EUGWV3S6.js","./chunk.6XJP7F3I.js","./chunk.NPX7SPXM.js","./chunk.OE4QOBJF.js","./chunk.74RMHUCX.js","./chunk.MWZK3HVG.js","./chunk.3D5T3XIE.js","./chunk.GR5Q4HTW.js","./chunk.QT4XGC5Z.js","./chunk.MQ7FNHXG.js","./chunk.WLPTY4BF.js","./chunk.AJZBJBMO.js"]),import("./chunk.TOWYHWPB.js")))),U=I.part((t,i)=>(0,w.jsx)(t.SeveralBar,{...i}),{what:"The selection bar"});function Q(t){return t.chosen.length===0?null:(0,w.jsx)(D.Suspense,{fallback:null,children:(0,w.jsx)(U,{...t})})}var W=()=>I.prefetch();export{Y as a,$ as b,Q as c,W as d};
@@ -1 +0,0 @@
1
- import{a as xe}from"./chunk.HJCQ6I3S.js";import{a as je,b as Ee,c as Ie,d as Re}from"./chunk.GZ3IXNA4.js";import"./chunk.XDYAG276.js";import{c as he}from"./chunk.FMVWXSQ7.js";import"./chunk.MWZK3HVG.js";import"./chunk.3D5T3XIE.js";import"./chunk.GR5Q4HTW.js";import{H as Ke,S as Pe}from"./chunk.MQ7FNHXG.js";import"./chunk.WLPTY4BF.js";import{b as pe}from"./chunk.AJZBJBMO.js";var P=pe(Ke(),1);var E=.5,fe=1,ye=.76,Le=3,We=3,Ae=.6;function Oe(c){let{ribbons:m,plots:u,cell:i}=c,a=c.tilt??.5,g=c.labels??[],b=[...u.values()],k=new Map;if(b.length===0||i<=0)return k;let L=Math.min(...b.map(n=>n.col))-3,A=Math.min(...b.map(n=>n.row))-3,G=Math.max(...b.map(n=>n.col+n.side))+3,ce=Math.max(...b.map(n=>n.row+n.side))+3,h=Math.round((G-L)/E)+1,p=Math.round((ce-A)/E)+1,N=n=>L+n*E,B=n=>A+n*E,I=4,_=!0,C=(n,e)=>{if(!_)return!1;let t=he(n,e,i,a);return g.some(s=>t.x>s.x-I&&t.x<s.x+s.width+I&&t.y>s.y-I&&t.y<s.y+s.height+I)},H=(n,e)=>b.some(t=>n>t.col-ye&&n<t.col+t.side+ye&&e>t.row-ye&&e<t.row+t.side+ye),F=new Uint8Array(h*p),J=new Uint8Array(h*p);for(let n=0;n<h;n++)for(let e=0;e<p;e++){let t=N(n),s=B(e);J[e*h+n]=H(t,s)?0:1,F[e*h+n]=J[e*h+n]&&!C(t,s)?1:0}let Q=F,se=new Float32Array(h*p);for(let n=0;n<h;n++)for(let e=0;e<p;e++){let t=N(n),s=B(e);se[e*h+n]=Math.min(...b.map(o=>Math.max(0,o.col-t,t-(o.col+o.side),o.row-s,s-(o.row+o.side))))}let Z=(n,e,t,s)=>{let o=N(n)+t*E/2,l=B(e)+s*E/2;return!H(o,l)&&!C(o,l)},ue=n=>{let e=[],t=(o,l)=>{let w=[],d=Math.min(1,l/3);for(let y=Math.ceil((o+d)/E-1e-9)*E;y<=o+l-d+1e-9;y+=E)w.push(y);return w},s=(o,l,w,d)=>{let y=Math.round((o-L)/E),r=Math.round((l-A)/E);y>=0&&r>=0&&y<h&&r<p&&Q[r*h+y]&&e.push({i:y,j:r,out:w,curb:d})};for(let o of t(n.row,n.side))s(n.col-fe,o,1,{col:n.col,row:o}),s(n.col+n.side+fe,o,0,{col:n.col+n.side,row:o});for(let o of t(n.col,n.side))s(o,n.row-fe,3,{col:o,row:n.row}),s(o,n.row+n.side+fe,2,{col:o,row:n.row+n.side});return e},ee=new Map,V=(n,e,t,s)=>n<t||n===t&&e<s?`${n},${e}-${t},${s}`:`${t},${s}-${n},${e}`,de=[[1,0],[-1,0],[0,1],[0,-1]],X=new Map;for(let n of m){let e=u.get(n.from),t=u.get(n.to);if(!e||!t||e===t)continue;let s=-1,o=[],l=new Map,w=new Int32Array(0),d=1/0,y=[];for(let f of[!0,!1]){s=-1,d=1/0,_=f,Q=f?F:J,o=ue(e);let W=ue(t);if(o.length===0||W.length===0){y.push({reached:-1,starts:o,goal:l,back:w,best:d});continue}l=new Map(W.map(j=>[j.j*h+j.i,j]));let ne=(j,R)=>{let re=N(j),ae=B(R);return(Math.max(0,t.col-re,re-(t.col+t.side))+Math.max(0,t.row-ae,ae-(t.row+t.side)))*Ae},oe=h*p*4,ie=new Float64Array(oe).fill(1/0);w=new Int32Array(oe).fill(-1);let le=new ke;for(let j of o){let R=(j.j*h+j.i)*4+j.out;ie[R]=0,le.push(R,ne(j.i,j.j))}let Ce=[1,0,3,2];for(;le.size>0&&!(le.peekKey()>=d);){let R=le.pop(),re=Math.floor(R/4),ae=R%4,ge=re%h,we=Math.floor(re/h),ve=l.get(re);if(ve){let q=ie[R]+(ae===Ce[ve.out]?0:Le);q<d&&(d=q,s=R);continue}for(let q=0;q<4;q++){let[Me,$e]=de[q],U=ge+Me,z=we+$e;if(U<0||z<0||U>=h||z>=p||!Q[z*h+U]||!Z(ge,we,Me,$e))continue;let Te=E*(ee.has(V(ge,we,U,z))?Ae:1)*(1+Math.max(0,se[z*h+U]-We))+(q===ae?0:Le),me=(z*h+U)*4+q,be=ie[R]+Te;be<ie[me]&&(ie[me]=be,w[me]=R,le.push(me,be+ne(U,z)))}}y.push({reached:s,starts:o,goal:l,back:w,best:d})}_=!0,Q=F;let[r,v]=y,M=r&&r.reached!==-1&&(!v||v.reached===-1||r.best<=1.3*v.best+2)?r:v;if(!M||M.reached===-1)continue;({reached:s,starts:o,goal:l,back:w}=M);let x=[];for(let f=s;f!==-1;f=w[f]){let W=Math.floor(f/4),ne=x[x.length-1],oe={i:W%h,j:Math.floor(W/h)};(!ne||ne.i!==oe.i||ne.j!==oe.j)&&x.push(oe)}x.reverse();for(let f=1;f<x.length;f++){let W=V(x[f-1].i,x[f-1].j,x[f].i,x[f].j);ee.set(W,[...ee.get(W)??[],n.key])}let D=o.find(f=>f.i===x[0].i&&f.j===x[0].j),$=l.get(x[x.length-1].j*h+x[x.length-1].i);X.set(n.key,{cells:x,start:D.curb,end:$.curb})}let O=new Map(m.map(n=>[n.key,n.width])),T=new Map(m.map((n,e)=>[n.key,e])),te=i*a/Math.sqrt(1+a*a),Y=(n,e)=>n==="col"?`r${e.row.toFixed(2)}`:`c${e.col.toFixed(2)}`,K=new Map;for(let[n,e]of X)for(let t=1;t<e.cells.length;t++){let s=e.cells[t-1],o=e.cells[t],l=Y(s.i!==o.i?"col":"row",{col:N(s.i),row:B(s.j)});K.set(l,(K.get(l)??new Set).add(n))}for(let[n,e]of X){let t=[e.start,...e.cells.map(r=>({col:N(r.i),row:B(r.j)})),e.end],s=r=>r>=2&&r<=e.cells.length?V(e.cells[r-2].i,e.cells[r-2].j,e.cells[r-1].i,e.cells[r-1].j):null,o=[];for(let r=1;r<t.length;r++){let v=Math.abs(t[r].col-t[r-1].col)>1e-9?"col":"row",M=o[o.length-1];M&&M.axis===v?M.to=r:o.push({from:r-1,to:r,axis:v})}if(o.length===0)continue;let l=o.map(r=>{if(!Array.from({length:r.to-r.from},($,f)=>s(r.from+1+f)).some($=>$!==null))return 0;let v=K.get(Y(r.axis,t[r.from]))??new Set;if(!v.has(n))return 0;let M=[...v].sort(($,f)=>(T.get($)??0)-(T.get(f)??0)),D=-(M.reduce(($,f)=>$+(O.get(f)??2)+2,0)-2)/2;for(let $ of M){if($===n)return(D+(O.get($)??2)/2)/te;D+=(O.get($)??2)+2}return 0}),w=r=>{let v=o[r],M=t[v.from];return v.axis==="col"?{row:M.row+l[r]}:{col:M.col+l[r]}},d=(r,v,M)=>({col:r.col??v.col??M.col,row:r.row??v.row??M.row}),y=[d(w(0),{},t[0])];for(let r=0;r+1<o.length;r++)y.push(d(w(r),w(r+1),t[o[r].to]));y.push(d(w(o.length-1),{},t[t.length-1])),k.set(n,y.map(r=>he(r.col,r.row,i,a)))}return k}var ke=class{items=[];keys=[];get size(){return this.items.length}peekKey(){return this.keys[0]??1/0}push(m,u){this.items.push(m),this.keys.push(u);let i=this.items.length-1;for(;i>0;){let a=i-1>>1;if(this.keys[a]<=this.keys[i])break;this.swap(i,a),i=a}}pop(){let m=this.items[0],u=this.items.pop(),i=this.keys.pop();if(this.items.length>0){this.items[0]=u,this.keys[0]=i;let a=0;for(;;){let g=2*a+1,b=g+1,k=a;if(g<this.items.length&&this.keys[g]<this.keys[k]&&(k=g),b<this.items.length&&this.keys[b]<this.keys[k]&&(k=b),k===a)break;this.swap(a,k),a=k}}return m}swap(m,u){[this.items[m],this.items[u]]=[this.items[u],this.items[m]],[this.keys[m],this.keys[u]]=[this.keys[u],this.keys[m]]}};function Se(c,m){let u=c.col+c.side,i=u+.25+.22*Math.max(0,m),a=c.row+c.side*Math.max(.1,.3-.06*m),g=c.row+c.side*Math.min(.9,.7+.06*m);return[{col:u,row:a},{col:i,row:a},{col:i,row:g},{col:u,row:g}]}function Be(c,m){return c.map(u=>he(u.col,u.row,m.cell,m.tilt))}function Fe(c){return c.map((m,u)=>`${u===0?"M":"L"} ${m.x.toFixed(1)} ${m.y.toFixed(1)}`).join(" ")}function Ne(c){if(c.length===0)return{x:0,y:0};let m=0;for(let i=1;i<c.length;i++)m+=Math.hypot(c[i].x-c[i-1].x,c[i].y-c[i-1].y);let u=m/2;for(let i=1;i<c.length;i++){let a=c[i-1],g=c[i],b=Math.hypot(g.x-a.x,g.y-a.y);if(b>=u&&b>0)return{x:a.x+(g.x-a.x)*u/b,y:a.y+(g.y-a.y)*u/b};u-=b}return c[c.length-1]}var S=pe(Pe(),1);function Ue({frame:c,width:m,height:u,pan:i,store:a,graphVersion:g,selection:b,view:k,emphasis:L,hiddenKinds:A,drawn:G}){let[ce,h]=(0,P.useState)(null),p=c.city,N=e=>a.graph.getNode(e)?.kind,B=(0,P.useMemo)(()=>je(a.graph.allEdges(),e=>a.graph.getNode(e)?.kind),[a,g]),I=new Map;for(let e of c.nodes){let t=e.id.startsWith("kind:")?Ie(e.id):null;t!==null&&e.plot&&Math.round(e.plane)===2&&I.set(t,e.plot)}let _=[...I].map(([e,t])=>`${e}:${t.col},${t.row},${t.side}`).join(";"),C=p?.cell??0,H=B.filter(e=>I.has(e.from)&&I.has(e.to)&&!A.has(e.from)&&!A.has(e.to)&&G(e.edge)),F=p?.tilt??.5,[J,Q]=(0,P.useState)([]),se=J.map(e=>`${Math.round(e.x)},${Math.round(e.y)},${Math.round(e.width)},${Math.round(e.height)}`).join(";"),[Z,ue]=(0,P.useState)(null),ee=c.t>=1;(0,P.useLayoutEffect)(()=>{let e=Z?.parentElement;if(!e||!p||!ee)return;let t=e.getBoundingClientRect(),s=p.originX+i.x,o=p.originY+i.y,l=[...e.querySelectorAll('[data-graview-view^="kind:"] .graview-kind-face')].flatMap(d=>{let y=d.getBoundingClientRect();return y.width>0&&y.height>0?[{x:y.left-t.left-s,y:y.top-t.top-o,width:y.width,height:y.height}]:[]});l.map(d=>`${Math.round(d.x)},${Math.round(d.y)},${Math.round(d.width)},${Math.round(d.height)}`).join(";")!==se&&Q(l)},[Z,ee,_,C,F]);let V=(0,P.useMemo)(()=>{if(C===0)return[];let e=new Map,t=Math.max(0,...H.map(o=>o.links)),s=Oe({ribbons:H.map(o=>({key:o.key,from:o.from,to:o.to,width:xe(o.links,t)})),plots:I,cell:C,tilt:F,labels:J});return H.flatMap(o=>{let l;if(o.from===o.to){let w=e.get(o.from)??0;e.set(o.from,w+1),l=Be(Se(I.get(o.from),w),{cell:C,tilt:F})}else l=s.get(o.key);return!l||l.length<2?[]:[{ribbon:o,points:l,d:Fe(l),middle:Ne(l),width:xe(o.links,t)}]})},[C,F,_,B,G,A,se]),de=(0,P.useRef)([]),X=(0,P.useRef)({x:0,y:0});if(X.current=p?{x:p.originX+i.x,y:p.originY+i.y}:{x:0,y:0},(0,P.useEffect)(()=>{let e=Z?.parentElement;if(!e||typeof window>"u")return;let t=0,s=null,o=()=>{t=0;let d=s;if(!d)return;let y=d.target;if(d.pointerType==="touch"||d.buttons!==0||y?.closest("[data-graview-view], button, a, input, select, textarea, [data-graview-overlay], [data-graview-offstage]")){h(null);return}let r=e.getBoundingClientRect(),v=d.clientX-r.left-X.current.x,M=d.clientY-r.top-X.current.y,x=null,D=1/0;for(let $ of de.current){let f=qe($.points,v,M);f<=$.reach&&f<D&&(D=f,x=$.key)}h(x)},l=d=>{s=d,t===0&&(t=requestAnimationFrame(o))},w=()=>h(null);return e.addEventListener("pointermove",l,{passive:!0}),e.addEventListener("pointerleave",w),()=>{t!==0&&cancelAnimationFrame(t),e.removeEventListener("pointermove",l),e.removeEventListener("pointerleave",w)}},[Z]),!p||!k.overview||V.length===0)return null;let O=Ee(b,k,N);if(O.records.length>0||O.lens!==null)return null;let T=O.districts.length>0?V.filter(({ribbon:e})=>O.districts.includes(e.from)||O.districts.includes(e.to)):V;if(T.length===0)return null;let te=L??null,Y=T.find(({ribbon:e})=>e.key===ce);de.current=T.map(({ribbon:e,points:t,width:s})=>({key:e.key,points:t,reach:s/2+6}));let K={x:p.originX+i.x,y:p.originY+i.y},n=`translate(${K.x.toFixed(1)} ${K.y.toFixed(1)})`;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("svg",{ref:ue,className:"graview-ribbons","aria-hidden":"true","data-graview-world":"","data-graview-ribbons":T.length,width:m,height:u,style:{position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible"},children:(0,S.jsx)("g",{transform:n,children:T.map(({ribbon:e,d:t,width:s})=>{let o=ce===e.key||te!==null&&te===e.edge||O.districts.length>0,l=te!==null&&te!==e.edge;return(0,S.jsx)("g",{className:"graview-ribbon","data-graview-ribbon":e.edge,"data-graview-from":`kind:${e.from}`,"data-graview-to":`kind:${e.to}`,"data-graview-links":e.links,"data-graview-lit":o&&!l?"":void 0,"data-graview-receded":l?"":void 0,children:(0,S.jsx)("path",{className:"graview-ribbon-band",d:t,style:{strokeWidth:s}})},e.key)})})}),Y?(0,S.jsx)("div",{className:"graview-ribbon-said","data-graview-world":"","data-testid":"ribbon-said",role:"status",style:{position:"absolute",left:K.x+Y.middle.x,top:K.y+Y.middle.y,pointerEvents:"none"},children:Re(a.schema,Y.ribbon)}):null]})}function qe(c,m,u){let i=1/0;for(let a=1;a<c.length;a++){let g=c[a-1],b=c[a],k=b.x-g.x,L=b.y-g.y,A=k*k+L*L,G=A===0?0:Math.max(0,Math.min(1,((m-g.x)*k+(u-g.y)*L)/A));i=Math.min(i,Math.hypot(m-(g.x+G*k),u-(g.y+G*L)))}return i}export{Ue as Ribbons,qe as distanceTo};
@@ -1 +0,0 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}from"./chunk.67WL7BGF.js";import"./chunk.G4JJXA63.js";import"./chunk.5MSO3KRO.js";import"./chunk.QYRPELLU.js";import"./chunk.MCVY6RRS.js";import"./chunk.RZVZG2BQ.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.XHWL7QBF.js";import"./chunk.6UCRL4OF.js";import"./chunk.V2NBJDAX.js";import"./chunk.WVUJXDXZ.js";import"./chunk.2EJAIT33.js";import"./chunk.EUGWV3S6.js";import"./chunk.6XJP7F3I.js";import"./chunk.NPX7SPXM.js";import"./chunk.OE4QOBJF.js";import"./chunk.74RMHUCX.js";import"./chunk.MWZK3HVG.js";import"./chunk.3D5T3XIE.js";import"./chunk.GR5Q4HTW.js";import"./chunk.WLPTY4BF.js";import"./chunk.AJZBJBMO.js";export{i as draftAnswer,h as draftFromLens,b as draftSight,l as draftView,a as isDraftFailure,c as judgeLens,d as lensEditOf,f as lensFromSpec,j as recipeDraft,g as recipeOfLens,m as refineDraft,o as runDraftTool,e as takeBackEditOf,k as templateDraft,n as withReaderLenses};
@@ -1 +0,0 @@
1
- import{e as L}from"./chunk.3ZRHHB7X.js";import{a as R,b as O,c as v,d as P}from"./chunk.UGFDSE37.js";import"./chunk.ZYCNEOAQ.js";import"./chunk.4DEUD66C.js";import"./chunk.LHO7L3CS.js";import"./chunk.YG423NEB.js";import"./chunk.VNBR4DHD.js";import"./chunk.Z3ZKYSPN.js";import"./chunk.6ONRWFA6.js";import"./chunk.AFY35RJP.js";import"./chunk.POHEWJKZ.js";import"./chunk.ROGYDMES.js";import"./chunk.6IHXTT6Z.js";import"./chunk.YXH3IWNR.js";import"./chunk.OEF3GPRM.js";import"./chunk.BRHRAVU2.js";import"./chunk.VTWFVPKD.js";import"./chunk.ZRQI5VJF.js";import"./chunk.33GN2NUT.js";import"./chunk.2VIGF4FO.js";import{a as E,b as T}from"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.2EJAIT33.js";import"./chunk.EUGWV3S6.js";import"./chunk.6XJP7F3I.js";import"./chunk.NPX7SPXM.js";import"./chunk.OE4QOBJF.js";import"./chunk.74RMHUCX.js";import"./chunk.GZHZLJBF.js";import"./chunk.I3SQJ2L2.js";import"./chunk.OJGHDWI6.js";import"./chunk.FUJM7GDV.js";import"./chunk.MWZK3HVG.js";import"./chunk.3D5T3XIE.js";import"./chunk.GR5Q4HTW.js";import"./chunk.QT4XGC5Z.js";import{H as D,S as C,ya as x}from"./chunk.MQ7FNHXG.js";import{qc as k}from"./chunk.WLPTY4BF.js";import{b as S}from"./chunk.AJZBJBMO.js";var o=S(D(),1);var i=S(C(),1);function W(c){let e=document.activeElement;if(e!==null&&e!==document.body&&e!==document.documentElement&&e.isConnected)return;let r=c??document,a=r.querySelector("main")??r.querySelector("[data-graview-page]")??null,n=r.querySelector("[data-graview-page-title]")??a?.querySelector("h1, h2")??a;n instanceof HTMLElement&&(n.hasAttribute("tabindex")||n.setAttribute("tabindex","-1"),n.focus({preventScroll:!0}))}var H=1500;function z(c,e,r){let{store:a,principal:n}=c,u=L(a),l=(0,o.useMemo)(()=>R(a,n),[a,n,u]),b=(0,o.useRef)(r),[p,m]=(0,o.useState)(),[s,f]=(0,o.useState)("");(0,o.useEffect)(()=>{let t=O(a,n,b.current);b.current=a.batches().length,t&&(m({batch:t.batch,at:e,when:Date.now()}),f(""))},[a,n,u]),(0,o.useEffect)(()=>{m(t=>!t||t.at===e?t:Date.now()-t.when<H?{...t,at:e}:void 0)},[e]);let[g,h]=(0,o.useState)(null),y=(0,o.useCallback)(()=>{m(void 0),h(null)},[]),w=(0,o.useCallback)(()=>{h(null);try{let t=P(a,n);t&&f(`Took back \u201C${t.intent}\u201D`)}catch(t){h(t instanceof Error?t.message:String(t))}},[a,n]),d=l&&p?.batch===l.batch&&p.at===e?l:void 0;return{change:l,offered:d,close:y,takeBack:w,refused:g,said:s}}function Y({context:c,docked:e,at:r,since:a}){let{change:n,offered:u,close:l,takeBack:b,refused:p,said:m}=z(c,r,a),s=e?u:n,f=(0,o.useRef)(null),g=e&&(s!==void 0||p!==null);B(f,g),(0,o.useEffect)(()=>{if(!g)return;let d,t=()=>d=setTimeout(()=>f.current?.matches(":hover, :focus-within")?t():l(),1e4);return t(),()=>clearTimeout(d)},[g,s?.batch,p,l]);let h=m||(e&&s?v(s):""),y=e?{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:k("toast"),width:"max-content",height:"auto",bottom:"calc(16px + env(safe-area-inset-bottom, 0px))",left:16,justifyItems:"start",color:"var(--graview-ink)",...g?{}:{display:"none"}}:{},w=s?(0,i.jsxs)("button",{type:"button","data-testid":"page-undo",title:`${v(s)} \u2014 \u2318Z or Ctrl+Z`,"aria-keyshortcuts":"Meta+Z Control+Z",onClick:d=>{let t=d.currentTarget.closest("[data-graview-face]");b(),requestAnimationFrame(()=>W(t))},style:e?I:A,children:[(0,i.jsx)("span",{"aria-hidden":"true",children:"\u21B6"}),(0,i.jsx)("span",{style:e?j:F,children:v(s)})]}):null;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{role:"status","aria-live":"polite",style:N,children:h}),(0,i.jsxs)("div",{ref:f,...e?{popover:"manual","data-graview-foot":"","data-graview-offstage":""}:{},"data-testid":e?"face-undo-dock":"page-undo-place",style:{display:"grid",justifyItems:"end",gap:4,maxWidth:"100%",minWidth:0,...y},children:[e&&s?(0,i.jsxs)("div",{"data-testid":"page-undo-notice",style:_,children:[w,(0,i.jsx)("button",{type:"button","data-testid":"page-undo-dismiss","aria-label":`Dismiss: ${v(s)}`,title:"Dismiss",onClick:d=>{let t=d.currentTarget.closest("[data-graview-face]");l(),requestAnimationFrame(()=>W(t))},style:q,children:"\xD7"})]}):w,p?(0,i.jsx)("span",{"data-testid":"page-undo-refused",role:"alert",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-warn)",background:e?"var(--graview-float)":void 0,padding:e?"4px 8px":void 0,borderRadius:6},children:p}):null]})]})}function B(c,e){(0,o.useLayoutEffect)(()=>{let r=c.current;if(!r||!e)return;if(typeof r.showPopover=="function"&&!x(r))try{r.showPopover()}catch{}let a=()=>r.parentElement?.closest("[data-embed-content]")??null,n=()=>{T(r,a()),dispatchEvent(new Event(E))};n(),addEventListener("resize",n),addEventListener("scroll",n,!0);let u=typeof ResizeObserver=="function"?new ResizeObserver(n):null;return u?.observe(r),()=>{if(u?.disconnect(),removeEventListener("resize",n),removeEventListener("scroll",n,!0),r.isConnected&&x(r))try{r.hidePopover()}catch{}dispatchEvent(new Event(E))}},[c,e])}var A={display:"inline-flex",alignItems:"center",gap:6,minHeight:36,maxWidth:"100%",minWidth:0,padding:"0 14px",borderRadius:999,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",font:"inherit",fontSize:"0.875rem",cursor:"pointer"},I={...A,textAlign:"start",lineHeight:1.4,padding:"8px 4px 8px 14px",border:"none",background:"none",color:"inherit"},_={display:"flex",alignItems:"center",gap:2,maxWidth:"100%",minWidth:0,paddingRight:6,borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},q={flex:"0 0 auto",minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"1rem",cursor:"pointer"},F={minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},j={minWidth:0,overflow:"hidden",overflowWrap:"anywhere",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:4},N={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};export{Y as TakeBack};
@@ -1 +0,0 @@
1
- import{H as C,S as F,xa as H,za as A}from"./chunk.MQ7FNHXG.js";import"./chunk.WLPTY4BF.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 +0,0 @@
1
- import{a as S,b as $,c as w,d as R,e as V}from"./chunk.OE4QOBJF.js";import{h as l,i as F}from"./chunk.74RMHUCX.js";import{Fa as b,Ga as A}from"./chunk.WLPTY4BF.js";var O=["card","row","page"],E=["good","warn","bad","neutral","accent"],P=["money","percent","date","time","datetime","relative","count"],_=4,T=40,I=120,L=["number","money","percent"],B=["large"],H=["card","row"],M=1e3,ue=100;function U(e){let n=/^\s*(out|in)\(\s*['"]([A-Za-z][A-Za-z0-9_-]*)['"]\s*\)\s*$/.exec(e);return n?{edge:n[2],way:n[1]}:/^[A-Za-z][A-Za-z0-9_-]*$/.test(e)?{edge:e}:void 0}var v={title:[],headline:[],list:["sort","limit","group","empty","as"],text:["tone"],badge:["tone"],field:["as","currency","label"],image:["as","label"],progress:["label"],group:["direction"],when:["show"],divider:[],figure:["as","currency","label","emphasis"]},C=Object.keys(v),G=`{"title": "{name}"}, {"headline": "{count(all('offer'))} offers"}, {"figure": expr, "as"?: "number"|"money"|"percent", "currency"?, "label"?, "emphasis"?: "large"}, {"list": expr, "sort"?, "limit"?, "group"?, "empty"?, "as"?: "card"|"row"}, {"text": "\u2026", "tone"?}, {"badge": "{status}", "tone"?}, {"field": "quote", "as"?, "currency"?, "label"?}, {"image": "photos", "as"?: "thumb"|"gallery"}, {"progress": {"value": expr, "max": expr}, "label"?}, {"group": [blocks], "direction"?: "row"|"column"}, {"when": expr, "show": [blocks]}, {"divider": true}, {"figure": true}`,Z=e=>/^(image|video|file)$/.test(e?.of??e?.type??"");function fe(e){return Object.fromEntries(Object.entries(e.views??{}).filter(([,n])=>!Array.isArray(n)))}function ce(e){let n=e.views?.home;return Array.isArray(n)?n:void 0}var X={field:()=>!1,relation:()=>!1,figure:!1},Y=e=>e.kind??"the home",m=(e,n)=>e!==void 0&&Object.hasOwn(e,n),g=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function z(e,n,o){let t=S(e);for(let d of t.unknownFunctions)o.findings.push(l("unknown-function",n,`"${d}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let d of t.names){if(o.kind===null){o.findings.push(l("view-name",n,`"${d}" names nothing here: these blocks are about no one record`,"reach records with all('<kind>'), like count(all('offer')) or first(all('party') where role == 'client').name"));continue}d==="id"||o.spec.field(d)||o.spec.relation(d)||o.findings.push(l("view-name",n,`${o.kind} has no field or relation called "${d}"`))}for(let d of t.edges)o.edges.has(d)||o.findings.push(l("view-edge",n,`"${d}" is not a relation any kind declares`));for(let d of t.sweeps)o.kinds.has(d)||o.findings.push(l("view-kind",n,`"${d}" is not a kind this document declares`))}function k(e,n,o){if(typeof e!="string"||e.length===0||e.length>2e3){o.findings.push(l("view-expression",n,`an expression is a line of the rule language, like "status == 'booked'"`));return}try{z(w(e),n,o)}catch(t){if(!(t instanceof $))throw t;o.findings.push(l("expression",n,`${t.sentence} (at character ${t.at+1})`))}}function j(e,n,o,t=!1){if(typeof e!="string"||e.length===0||e.length>300){o.findings.push(l("view-template",n,'a template is words with {field} in braces, like "{name}" or "{quote|money}", at most 300 characters'));return}let d;try{d=V(e)}catch(a){if(a instanceof R||a instanceof $){o.findings.push(l("template",n,a.sentence));return}throw a}for(let a of d)if(a.expr&&(z(a.expr,n,o),t&&!a.format&&a.expr.t==="ident"&&(o.slot==="card"||o.slot==="row")&&o.spec.prose?.(a.expr.name))){let r=a.expr.name;o.findings.push(F("view-whole-text",n,`${o.kind} ${o.slot} shows ${r} whole; it will be clamped. Use {${r}|excerpt} or move it to the page.`,`write {${r}|excerpt}, or {${r}|excerpt: 80} for fewer characters`))}}function q(e,n,o){if(typeof e=="string"){E.includes(e)||o.findings.push(l("view-tone",n,`"${e}" is not a tone`,`use one of ${E.join(", ")}, or {"expr": "if(status == 'booked', 'good', 'neutral')"}`));return}if(g(e)&&Object.keys(e).length===1&&"expr"in e){k(e.expr,`${n}.expr`,o);return}o.findings.push(l("view-tone",n,'a tone is a word or {"expr": \u2026}',`one of ${E.join(", ")}`))}function x(e,n,o,t){if(!Array.isArray(e)){t.findings.push(l("view-shape",n,"a view is a list of blocks"));return}if(o>_){t.findings.push(l("view-depth",n,`blocks nest at most ${_} deep`,"flatten a group or a condition"));return}e.forEach((d,a)=>J(d,`${n}.${a}`,o,t))}function J(e,n,o,t){if(o===1&&t.count++,t.all++,!g(e)){t.findings.push(l("view-block",n,"a block is an object naming what it shows",`one of ${G}`));return}let d=Object.keys(e),a=d.filter(s=>C.includes(s)&&!(s==="group"&&d.includes("list")));if(a.length===0){t.findings.push(l("view-block",n,`${d.length>0?d.map(s=>`"${s}"`).join(", "):"an empty object"} is not a block Graview knows`,`one of ${G}`));return}if(a.length>1){t.findings.push(l("view-block",n,`a block is one thing, and this says ${a.map(s=>`"${s}"`).join(" and ")}`,"split it into two blocks"));return}let r=a[0];for(let s of d)s!==r&&s!="key"&&!v[r].includes(s)&&t.findings.push(l("unknown-key",`${n}.${s}`,`"${s}" is not part of a ${r} block`,v[r].length>0?`a ${r} block may also say ${v[r].map(u=>`"${u}"`).join(", ")}`:`a ${r} block says nothing else`));let i=e[r];switch(r){case"title":case"headline":case"text":case"badge":j(i,`${n}.${r}`,t,r==="text"),"tone"in e&&q(e.tone,`${n}.tone`,t);return;case"image":case"field":{let s=r==="image";if(typeof i!="string"||!(s?t.spec.files?.(i):t.spec.field(i))){let f=typeof i=="string"&&t.spec.relation(i);t.findings.push(l(`view-${r}`,`${n}.${r}`,`${t.kind} has no ${s?"image, video or file ":""}field ${typeof i=="string"?`"${i}"`:"by that name"}`,f?`"${i}" is a relation; show it with {"text": "{${i}.name}"}`:void 0))}let u=s?["thumb","gallery"]:P;"as"in e&&!u.includes(e.as)&&t.findings.push(l("view-format",`${n}.as`,`"${String(e.as)}" is not a way to show ${s?"pictures":"a field"}`,`use one of ${u.join(", ")}`)),s||N(e,n,t,"field"),"label"in e&&ie(e.label,`${n}.label`,t);return}case"progress":{!g(i)||Object.keys(i).some(s=>s!=="value"&&s!=="max")||!("value"in i)||!("max"in i)?t.findings.push(l("view-progress",`${n}.progress`,'progress is {"value": expression, "max": expression}')):(k(i.value,`${n}.progress.value`,t),k(i.max,`${n}.progress.max`,t)),"label"in e&&j(e.label,`${n}.label`,t);return}case"group":"direction"in e&&e.direction!=="row"&&e.direction!=="column"&&t.findings.push(l("view-direction",`${n}.direction`,`a group runs "row" or "column", not "${String(e.direction)}"`)),x(i,`${n}.group`,o+1,t);return;case"when":k(i,`${n}.when`,t),"show"in e?x(e.show,`${n}.show`,o+1,t):t.findings.push(l("view-when",n,'a condition says what it shows: {"when": expr, "show": [blocks]}'));return;case"figure":if(typeof i=="string")return Q(e,n,t);for(let s of["as","currency","label","emphasis"])s in e&&t.findings.push(l("unknown-key",`${n}.${s}`,`"${s}" belongs to a figure that works a number out; {"figure": true} is the kind's picture`,`write {"figure": "count(all('offer'))", "as": "number"}`));i!==!0?t.findings.push(l("view-block",`${n}.figure`,`a figure is a number worked out, {"figure": "sum(all('offer'), net)", "as": "money"}, or the kind's picture, {"figure": true}`)):t.spec.figure||t.findings.push(l("view-figure",`${n}.figure`,`${Y(t)} has no figure to show`,t.kind===null?`work a number out: {"figure": "count(all('offer'))"}`:'give the kind a "figure", or leave this block out'));return;case"list":return ne(e,n,t);case"divider":i!==!0&&t.findings.push(l("view-block",`${n}.${r}`,`write {"${r}": true}`));return}}function Q(e,n,o){k(e.figure,`${n}.figure`,o),"as"in e&&!L.includes(e.as)&&o.findings.push(l("view-format",`${n}.as`,`"${String(e.as)}" is not a way to say a figure`,`use one of ${L.join(", ")}`)),N(e,n,o,"figure"),"label"in e&&j(e.label,`${n}.label`,o),"emphasis"in e&&!B.includes(e.emphasis)&&o.findings.push(l("view-emphasis",`${n}.emphasis`,`"${String(e.emphasis)}" is not how loudly a figure is said`,`use ${B.map(t=>`"${t}"`).join(", ")}, or leave it out for the figure's own size`))}function N(e,n,o,t){"currency"in e&&(typeof e.currency!="string"||!/^[A-Z]{3}$/.test(e.currency)?o.findings.push(l("view-currency",`${n}.currency`,'a currency is its three-letter code, like "USD" or "EUR"')):e.as!=="money"&&o.findings.push(l("view-currency",`${n}.currency`,`a currency belongs on a ${t} shown as money`,'add "as": "money"')))}function ee(e,n){let o=[...n.kinds],t=(a,r)=>{let i=new Set;for(let s of a){let u=n.vocabulary.namesOf(s)?.targets?.(r);if(u==="*")return o;for(let f of u??[])i.add(f)}return i.size>0?[...i]:void 0},d=a=>{switch(a.t){case"ident":return n.kind!==null&&n.spec.relation(a.name)?t([n.kind],a.name):void 0;case"member":{let r=d(a.object);return r?t(r,a.name):void 0}case"where":return d(a.set);case"call":{let r=a.args[0],i=r?.t==="lit"&&typeof r.value=="string"?r.value:void 0;if(a.fn==="all")return i!==void 0&&n.kinds.has(i)?[i]:void 0;let s=a.args.length===2&&a.args[1]?.t==="lit"&&typeof a.args[1].value=="string"?a.args[1].value:void 0;if(a.fn==="out"&&s!==void 0){let u=d(r);return u?t(u,s):void 0}if(a.fn==="out")return i!==void 0&&n.kind!==null?t([n.kind],i):void 0;if(a.fn==="in"){let u=s??i,f=s!==void 0?d(r):n.kind!==null?[n.kind]:void 0,c=u!==void 0?n.vocabulary.sources(u).filter(p=>{let y=n.vocabulary.namesOf(p)?.targets?.(u);return!f||y==="*"||f.some(h=>y?.includes(h))}):[];return c.length>0?c:void 0}if((a.fn==="sort"||a.fn==="first")&&r)return d(r);if(a.fn==="either"){let u=a.args.map(d);return u.every(f=>f!==void 0)?[...new Set(u.flatMap(f=>f??[]))]:void 0}return}default:return}};return d(e)}function K(e,n,o,t){let d;try{d=w(e)}catch(r){if(!(r instanceof $))throw r;t.findings.push(l("expression",n,`${r.sentence} (at character ${r.at+1})`));return}let a=S(d);for(let r of a.unknownFunctions)t.findings.push(l("unknown-function",n,`"${r}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let r of a.edges)t.edges.has(r)||t.findings.push(l("view-edge",n,`"${r}" is not a relation any kind declares`));if(o)for(let r of a.names)r==="id"||o.some(i=>t.vocabulary.namesOf(i)?.field(r)||t.vocabulary.namesOf(i)?.relation(r))||t.findings.push(l("view-name",n,`${o.join(" and ")} ${o.length===1?"has":"have"} no field or relation called "${r}"`))}function ne(e,n,o){let t=e.list;k(t,`${n}.list`,o);let d;if(typeof t=="string")try{d=ee(w(t),o)}catch{d=void 0}let a=i=>{if(!d)return[...o.kinds].map(u=>o.vocabulary.namesOf(u)?.choices?.(i)).find(u=>u!==void 0);let s=d.map(u=>o.vocabulary.namesOf(u)?.choices?.(i));return s.every(u=>u!==void 0)?[...new Set(s.flatMap(u=>u??[]))]:void 0},r=d?d.join(" and "):"any kind";if("sort"in e){let i=e.sort;if(typeof i=="string")K(i,`${n}.sort`,d,o);else if(g(i)&&typeof i.by=="string"&&Object.keys(i).every(s=>s==="by"||s==="direction")){let s=i.direction;s!==void 0&&s!=="asc"&&s!=="desc"&&s!=="choices"?o.findings.push(l("list-sort",`${n}.sort.direction`,`a list is sorted "asc", "desc" or "choices", not "${String(s)}"`,'"choices" puts a choice field in the order its choices are declared')):s==="choices"?a(i.by)===void 0&&o.findings.push(l("list-sort",`${n}.sort.by`,`"${i.by}" is not a choice field of ${r}, so it has no declared order`,'sort by a choice field, or say "asc" or "desc"')):K(i.by,`${n}.sort.by`,d,o)}else o.findings.push(l("list-sort",`${n}.sort`,'a sort is a key, like "net", or {"by": key, "direction": "asc" | "desc" | "choices"}'))}if("limit"in e){let i=e.limit;(typeof i!="number"||!Number.isInteger(i)||i<1||i>M)&&o.findings.push(l("list-limit",`${n}.limit`,`a limit is a whole number from 1 to ${M}`))}if("group"in e){let i=e.group,s=typeof i=="string"?i:g(i)&&typeof i.by=="string"?i.by:void 0;if(!(typeof i=="string"||g(i)&&Object.keys(i).every(f=>f==="by"||f==="headings"))||s===void 0)o.findings.push(l("list-group",`${n}.group`,'a group is a choice field, like "type", or {"by": "type", "headings": {"pain": "What hurts"}} \u2014 or a relation, like "inGenre", a heading per linked record'));else{let f=a(s),c=f===void 0?U(s):void 0,p=c!==void 0&&(c.way!==void 0?o.edges.has(c.edge):d?d.every(y=>o.vocabulary.namesOf(y)?.relation(c.edge)):o.edges.has(c.edge));if(f===void 0&&!p&&o.findings.push(l("list-group",`${n}.group`,`"${s}" is not a choice field or a relation of ${r}, so it has nothing to group by`,'group by a field whose type is enum, or by a relation of the kind listed, like "inGenre"')),g(i)&&"headings"in i){let y=i.headings;if(!g(y)||Object.values(y).some(h=>typeof h!="string"||h.length===0||h.length>80))o.findings.push(l("list-group",`${n}.group.headings`,'headings are words per choice, like {"pain": "What hurts"}, at most 80 characters each'));else if(f)for(let h of Object.keys(y))f.includes(h)||o.findings.push(l("list-group",`${n}.group.headings.${h}`,`"${h}" is not one of ${s}'s choices`,`use ${f.join(", ")}`))}}}"empty"in e&&(typeof e.empty!="string"||e.empty.length===0||e.empty.length>200)&&o.findings.push(l("list-empty",`${n}.empty`,"what an empty list says is a sentence, at most 200 characters")),"as"in e&&!H.includes(e.as)&&o.findings.push(l("list-as",`${n}.as`,`a list draws each record as its "card" or its "row", not "${String(e.as)}"`))}function ie(e,n,o){(typeof e!="string"||e.length===0||e.length>60)&&o.findings.push(l("view-label",n,"a label is a few words, at most 60 characters"))}function W(e,n,o,t,d,a,r){let i={kind:null,spec:X,kinds:t,edges:d,vocabulary:o,findings:a,count:0,all:0};Array.isArray(e)&&e.length===0&&a.push(l("view-shape",n,`${r} has no blocks`,'give it one: {"headline": "\u2026"}')),x(e,n,1,i),D(i,n,r,"show less")}function D(e,n,o,t){e.count>T?e.findings.push(l("view-size",n,`${o} has ${e.count} blocks at its top; a view has at most ${T} there, a group or a condition counting as one`,`${t}, or gather some into a group`)):e.all>I&&e.findings.push(l("view-size",n,`${o} has ${e.all} blocks counting the ones inside its groups and conditions; a view has at most ${I} in all`,t))}function oe(e,n,o,t,d){Array.isArray(e)&&e.forEach((a,r)=>{if(!g(a)||a.name!=="blocks"||!g(a.options)||!("blocks"in a.options))return;let i=[];W(a.options.blocks,`lenses.${r}.options.blocks`,n,o,t,i,`the lens "${String(a.title??r)}"`);for(let s of i)d.push({...s,severity:"warning"})})}function te(e,n,o,t,d,a,r){let i=[];if(e===void 0)return i;if(!g(e))return i.push(l("view-shape",n,'views are an object of kinds, each with a "card", a "row" or a "page"')),i;for(let[s,u]of Object.entries(e)){if(s==="home"&&Array.isArray(u)){W(u,`${n}.home`,r,t,d,i,"the home");continue}let f=o(s);if(!f){i.push(l("view-kind",`${n}.${s}`,`"${s}" is not a kind this ${a} declares`));continue}if(!g(u)){i.push(l("view-shape",`${n}.${s}`,`a kind's views are {"card": [blocks], "row": [blocks], "page": [blocks]}`));continue}for(let c of Object.keys(u))O.includes(c)||i.push(l("view-slot",`${n}.${s}.${c}`,`"${c}" is not a place a view is drawn`,`use ${O.map(p=>`"${p}"`).join(", ")}`));for(let c of O){let p=u[c];if(p===void 0)continue;let y={kind:s,spec:f,kinds:t,edges:d,vocabulary:r,findings:i,count:0,all:0,slot:c};x(p,`${n}.${s}.${c}`,1,y),D(y,`${n}.${s}.${c}`,`this ${c}`,"show less, or move detail to the page")}}return i}function ge(e){let n=new Set(Object.keys(e.kinds)),o=new Set(Object.values(e.kinds).flatMap(r=>Object.keys(b(r.edges)))),t=r=>{let i=m(e.kinds,r)?e.kinds[r]:void 0;return i?{field:s=>m(i.fields,s)||m(i.computed,s)||A(i.edges).has(s),relation:s=>m(b(i.edges),s),figure:i.figure!==void 0,files:s=>m(i.fields,s)&&Z(i.fields[s]),choices:s=>m(i.fields,s)&&i.fields[s].type==="enum"?i.fields[s].options:void 0,targets:s=>m(b(i.edges),s)?i.edges[s].to:void 0,prose:s=>m(i.fields,s)&&i.fields[s].type==="text"}:void 0},d={namesOf:t,sources:r=>Object.keys(e.kinds).filter(i=>m(e.kinds[i].edges,r))},a=te(e.views,"views",t,n,o,"document",d);return oe(e.lenses,d,n,o,a),a}export{E as a,P as b,L as c,B as d,M as e,ue as f,U as g,fe as h,ce as i,ge as j};
@@ -1 +0,0 @@
1
- import{a as ce,c as ge,d as ye,f as he}from"./chunk.OEF3GPRM.js";import{f as q,i as k,j as pe,k as ue,q as fe,r as me}from"./chunk.MWZK3HVG.js";import{b as de}from"./chunk.3D5T3XIE.js";import{c as se,f as le}from"./chunk.GR5Q4HTW.js";import{H as Ae,S as ae,aa as ie,i as re,v as oe}from"./chunk.MQ7FNHXG.js";import{Ca as ee,Na as ne,Oa as te,ba as Q,da as X,ka as Z}from"./chunk.WLPTY4BF.js";import{b as T}from"./chunk.AJZBJBMO.js";var l=T(Ae(),1),i=T(ae(),1);function He({affordance:n,onApply:a,onCancel:p,store:b}){let y=ie(),s=b??y?.store,[S,G]=(0,l.useState)({}),[f,C]=(0,l.useState)(""),[F,I]=(0,l.useState)(B),[J,_]=(0,l.useState)(void 0),U=(0,l.useId)(),P=(0,l.useRef)(null),x=n.open.filter(e=>!(e.name in S)),o=x[0],w=s.allMutations().find(e=>e.name===n.mutation),j=(0,l.useMemo)(()=>Oe(w,s,n.args??{}),[w,s,n.args]),d=o?j[o.name]:void 0,$=me(n.open.filter(e=>e.shape?.type==="date").map(e=>e.name)),we=(()=>{if(!$||o?.name!==$.end||o.shape?.type!=="date")return;let e=S[$.start];if(typeof e!="string")return;let r=j[$.start];return fe(typeof r=="string"?r:void 0,e,typeof d=="string"?d:void 0,{time:o.shape.time===!0,instant:o.shape.instant===!0})})();if((0,l.useEffect)(()=>{C(we??be(d,o?.shape)),I(Array.isArray(d)?d:B),_(d)},[o?.name]),(0,l.useEffect)(()=>{P.current?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[o?.name]),(0,l.useLayoutEffect)(()=>{let e=P.current,r=typeof document>"u"?null:document.activeElement;if(!e||r&&r!==document.body&&!e.contains(r))return;let u=e.querySelector("form input, [role=group] button:not([disabled])");u&&u!==r&&u.focus()},[o?.name]),!o)return null;let h=e=>{let r=d!==void 0&&JSON.stringify(e)===JSON.stringify(d)?void 0:e,u={...S,[o.name]:r};if(n.open.filter(R=>!(R.name in u)).length===0){let R=a(Object.fromEntries(Object.entries(u).filter(([,M])=>M!==void 0)));R&&R.length>0&&G(Object.fromEntries(Object.entries(u).filter(([M])=>!R.includes(M))))}else G(u)},A=o.optional?(0,i.jsx)("button",{type:"button",onClick:()=>h(void 0),style:{fontSize:"0.8125rem"},children:"Skip"}):null,t=o.shape??{type:"unknown"},c=t.type==="number"?t.amount:void 0,g=Ne(o,t),m=q(s.schema,w,o.name),V=ee((w?.input?.shape??{})[o.name]),ve=te((w?.input?.shape??{})[o.name]),O=ne(o.name),ke=typeof d=="boolean"?d?"yes":"no":d,[W,Se]=(0,l.useState)(""),Y=(0,l.useMemo)(()=>{let e=g.map(r=>s.graph.getNode(r)).filter(r=>r!==void 0);return de(e,r=>s.schema.tryDefinition(r))},[g,s]),L=e=>{let r=Ce(s,t,e),u=t.type==="choice"||t.type==="several"&&t.of.type==="choice"?m.option(e):r,N=Y.get(e);return N?`${u} \xB7 ${N}`:u},z=(0,l.useMemo)(()=>{let e=W.trim().toLowerCase();return e===""?g:g.filter(r=>L(r).toLowerCase().includes(e))},[g,W,s,t,Y]),v=t.type==="several",H=t.type==="file"?t:t.type==="several"&&t.of.type==="file"?t.of:void 0,K=v&&g.length===0,D=o.kinds&&o.kinds.length>0&&!o.kinds.includes("*")?o.kinds.map(e=>X(Z(s.schema.tryDefinition(e),e))).join(" or "):m.label,xe=n.open.length>1?`${D} \xB7 ${n.open.length-x.length+1} of ${n.open.length}`:D;return(0,i.jsxs)("div",{ref:P,"data-graview-asking":n.id,style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:4,padding:"5px 0 2px"},children:[n.open.length>1||g.length>0?(0,i.jsx)("span",{id:U,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:xe}):null,g.length>E?(0,i.jsx)("input",{type:"search",value:W,onChange:e=>Se(e.target.value),placeholder:`Filter ${g.length}\u2026`,"aria-label":`Filter ${D}`,"data-testid":"ask-filter",style:{font:"inherit",fontSize:"0.8125rem",minWidth:0,padding:"3px 7px"}}):null,ve?(0,i.jsxs)("form",{style:{display:"grid",gap:4},onSubmit:e=>{e.preventDefault(),h(J??(d===void 0?void 0:null))},children:[(0,i.jsx)(ye,{value:J,onChange:_,start:O?S[O]??j[O]:void 0,label:`${O?q(s.schema,w,O).label:m.label} repeats`,name:o.name}),(0,i.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,i.jsx)("button",{type:"submit",style:{fontSize:"0.8125rem"},children:x.length>1?"Next":"Apply"}),A]})]}):V?(0,i.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,i.jsx)(ge,{relation:V,value:d,onChange:h,label:m.label}),A]}):H?(0,i.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,i.jsx)(ce,{as:"control",value:d,onChange:h,several:v,image:H.image===!0,video:H.video===!0,label:m.label}),A]}):g.length>0?(0,i.jsxs)("div",{role:"group","aria-labelledby":U,style:{display:"flex",flexWrap:"wrap",gap:4},children:[z.slice(0,E).map(e=>{let r=v?F.includes(e):e===ke;return(0,i.jsx)("button",{type:"button","aria-label":`${D}: ${L(e)}`,...v?{"aria-pressed":r}:r?{"aria-current":!0}:{},style:{padding:"3px 9px",fontSize:"0.8125rem",...r?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},onClick:()=>v?I(u=>u.includes(e)?u.filter(N=>N!==e):[...u,e]):h(t.type==="boolean"?e==="yes":e),children:L(e)},e)}),z.length>E?(0,i.jsxs)("span",{"data-testid":"ask-more",style:{alignSelf:"center",fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:[z.length-E," more \u2014 type to narrow"]}):null,z.length===0?(0,i.jsxs)("span",{"data-testid":"ask-none",style:{alignSelf:"center",fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["None of the ",g.length," match that."]}):null,v?(0,i.jsx)("button",{type:"button",disabled:F.length===0,style:{fontSize:"0.8125rem"},onClick:()=>{let e=F;I(B),h(e)},children:x.length>1?"Next":"Apply"}):null,A]}):(0,i.jsxs)("form",{style:{display:"flex",flexWrap:"wrap",gap:4},onSubmit:e=>{if(e.preventDefault(),d!==void 0&&f===be(d,t)){h(void 0);return}if(K){h(f.split(/[,\n]/).map(r=>r.trim()).filter(Boolean));return}if(f.trim().length!==0){if(c){let r=ue(f,c);r!==void 0&&h(r);return}h(t.type==="number"?t.duration?le(f)??f:Number(f):f)}},children:[t.type==="text"&&t.long?(0,i.jsx)("textarea",{autoFocus:!0,name:o.name,"aria-label":m.label,placeholder:m.label,value:f,rows:4,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key==="Escape"?p():e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},style:{flex:"1 1 100%",minWidth:0,font:"inherit",fontSize:"0.875rem",lineHeight:1.45,padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",resize:"vertical",fieldSizing:"content",minHeight:"5.5em",maxHeight:"40vh"}}):t.type==="date"?(0,i.jsx)(he,{autoFocus:!0,name:o.name,label:m.label,value:f===""?void 0:f,time:t.time===!0,instant:t.instant===!0,onChange:e=>C(e??""),onCancel:p,boxStyle:{fontSize:"0.875rem",padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):(0,i.jsx)("input",{autoFocus:!0,type:t.type==="number"&&!t.duration&&!c?"number":t.type==="text"&&t.holds==="phone"?"tel":"text",...c?{inputMode:"decimal","data-graview-amount":c.format??"unit"}:{},name:o.name,"aria-label":m.label,placeholder:K?`${m.label}, separated by commas`:c?`${m.label}, ${k(c).hint} \u2014 ${k(c).prefix??""}${k(c).placeholder}${k(c).suffix?` ${k(c).suffix}`:""}`:m.label,value:f,...t.type==="number"&&t.min!==void 0?{min:t.min}:{},...t.type==="number"&&t.max!==void 0?{max:t.max}:{},...t.type==="number"&&t.step!==void 0?{step:t.step}:{},onChange:e=>C(e.target.value),onKeyDown:e=>{e.key==="Escape"&&p()},style:{flex:1,minWidth:0,font:"inherit",fontSize:"0.875rem",padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}),(0,i.jsx)("button",{type:"submit",disabled:!K&&f.trim().length===0,style:{fontSize:"0.8125rem"},children:x.length>1?"Next":"Apply"}),A]})]})}var B=[];function Oe(n,a,p){let b=n?.derived?.act==="edit"&&n.subject?p[n.subject.arg]:void 0,y=typeof b=="string"?a.graph.getNode(b):void 0;return y?Object.fromEntries((n.writes??[]).filter(s=>y[s]!==void 0&&y[s]!==null).map(s=>[s,y[s]])):{}}function be(n,a){return typeof n=="number"?a?.type==="number"&&a.amount?pe(n,a.amount):String(n):Array.isArray(n)?n.every(p=>typeof p=="string")?n.join(", "):"":typeof n!="string"?"":n}var E=10;function Ne(n,a){return n.candidates&&n.candidates.length>0?n.candidates:a.type==="choice"?a.options:a.type==="several"&&a.of.type==="choice"?a.of.options:a.type==="boolean"?Re:[]}var Re=["yes","no"];function Ce(n,a,p){return a.type==="boolean"||a.type==="choice"||a.type==="several"&&a.of.type==="choice"?p:$e(n,p)}function $e(n,a){let p=re(a);if(p){let s=se(n.schema,n.graph.getNode(p.from)?.kind??"",p.kind,"out");return s.charAt(0).toUpperCase()+s.slice(1)}let b=oe(a);if(b.length>0)return b.map(s=>n.schema.tryDefinition(s)?.plural??`${s}s`).join(" + ");let y=n.graph.getNode(a);return y?Q(n.schema.tryDefinition(y.kind),y):a}export{He as a,$e as b};
@@ -1 +0,0 @@
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 y}from"./chunk.ROGYDMES.js";import{m as g}from"./chunk.QT4XGC5Z.js";import{H as R,S as c,a as f,oa as m}from"./chunk.MQ7FNHXG.js";import{ka as p}from"./chunk.WLPTY4BF.js";import{b as u}from"./chunk.AJZBJBMO.js";var o=u(R(),1);var r=u(c(),1),S,h=()=>S??=m(f(()=>(__graviewPreload(import.meta.url,["./chunk.V2NBJDAX.js","./chunk.NPX7SPXM.js","./chunk.OE4QOBJF.js","./chunk.74RMHUCX.js","./chunk.WLPTY4BF.js","./chunk.AJZBJBMO.js"]),import("./chunk.V5ZT5NSJ.js"))));function L(e){let[n,t]=(0,o.useState)(()=>h().current);return(0,o.useEffect)(()=>{if(!e||n)return;let i=!0;return h().load().then(a=>i&&t(a),()=>{}),()=>{i=!1}},[e,n]),n}function D(e,n){let t=L(n.length>0);return(0,o.useMemo)(()=>t?t.withLines(e,n):n,[t,e,n])}function I(e,n){let t=L(n.some(i=>i.shape));return(0,o.useMemo)(()=>{let i=new Map;if(!t)return i;for(let a of n){let l=t.ruleLine(a,e);l&&i.set(a.name,l)}return i},[t,e,n])}function M(e){let n=e.line;if(!(!n||e.message.endsWith(` \u2014 ${n.text}`)||e.message===b(e)))return e.message}function b(e){let n=e.line;return n?n.record!==void 0?`${n.record} \u2014 ${n.text}`:n.text:e.message}var P={name:{},op:{color:"var(--graview-ink-muted)",fontWeight:500},value:{fontWeight:600,fontVariantNumeric:"tabular-nums"},word:{color:"var(--graview-ink-muted)"},open:{color:"var(--graview-ink-faint)"},close:{color:"var(--graview-ink-faint)"}};function w({parts:e}){return(0,r.jsx)(r.Fragment,{children:e.map((n,t)=>(0,r.jsxs)("span",{children:[n.space?" ":"",(0,r.jsx)("span",{"data-graview-rule-part":n.as,style:P[n.as],children:n.text})]},t))})}function x(e,n){let t=p(e?.tryDefinition(n),n);return t.charAt(0).toUpperCase()+t.slice(1)}function C({line:e,schema:n,brand:t,lead:i=e.record===void 0?"kind":"record",stacked:a=!1,style:l}){let d=e.kind,s=i==="kind"?d?x(n,d):void 0:i==="record"?e.record:void 0,k=i==="kind"&&s?`${s}: ${e.said}`:i==="record"&&s?`${s} \u2014 ${e.said}`:e.said;return(0,r.jsxs)("span",{"data-graview-rule-line":"",style:{overflowWrap:"anywhere",...l},children:[(0,r.jsx)("span",{style:g,children:k}),(0,r.jsxs)("span",{"aria-hidden":"true",children:[i!=="none"&&d?(0,r.jsx)("span",{style:{display:"inline-flex",verticalAlign:"-0.1em",marginRight:"0.4em"},children:(0,r.jsx)(y,{kind:d,...n?{schema:n}:{},...t?{brand:t}:{},size:13})}):null,s?(0,r.jsxs)("span",{"data-graview-rule-head":"",style:{fontWeight:600,marginRight:i==="record"||a?0:"0.6em"},children:[s,i==="record"&&!a?(0,r.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontWeight:400},children:" \u2014 "}):null]}):null,a&&s?(0,r.jsx)("br",{}):null,(0,r.jsx)(w,{parts:e.parts}),e.when&&e.when.length>0?(0,r.jsxs)("span",{"data-graview-rule-when":"",style:{color:"var(--graview-ink-faint)"},children:[", when ",(0,r.jsx)(w,{parts:e.when})]}):null]})]})}function z(e){return e.line?e.label&&e.label.trim().length>0?e.label:void 0:e.label&&e.label!==e.message&&!e.message.startsWith(e.label)?e.label:void 0}export{D as a,I as b,M as c,C as d,z as e};
@@ -1,3 +0,0 @@
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{H as g,S as u}from"./chunk.MQ7FNHXG.js";import{b as m}from"./chunk.AJZBJBMO.js";var d=m(g(),1),n=m(u(),1),f=/^\s*(\d{1,6})[.)]\s+(.*)$/s,c=/^\s*[-*•]\s+(.*)$/s;function S(o){let s=[];for(let p of o.replace(/\r\n?/g,`
2
- `).split(/\n[ \t]*\n+/)){let t=null,a=()=>{t&&(t.t==="p"?t.lines.length>0:t.items.length>0)&&s.push(t),t=null};for(let e of p.split(`
3
- `)){let i=f.exec(e),l=i?null:c.exec(e);if(i)t?.t!=="ol"&&(a(),t={t:"ol",start:Number(i[1]),items:[]}),t.items.push(i[2]);else if(l)t?.t!=="ul"&&(a(),t={t:"ul",items:[]}),t.items.push(l[1]);else if(t&&t.t!=="p"&&/^\s+\S/.test(e)){let r=t.items;r[r.length-1]=`${r[r.length-1]} ${e.trim()}`}else e.trim().length>0&&(t?.t!=="p"&&(a(),t={t:"p",lines:[]}),t.lines.push(e.trim()))}a()}return s}function b(o){return/[\r\n]/.test(o)}var h={display:"grid",gap:"0.7em",minWidth:0,overflowWrap:"anywhere"},k={margin:0},y={margin:0,paddingInlineStart:"1.6em",display:"grid",gap:"0.3em"},x=(0,d.lazy)(()=>(__graviewPreload(import.meta.url,["./chunk.QT4XGC5Z.js","./chunk.MQ7FNHXG.js","./chunk.WLPTY4BF.js","./chunk.AJZBJBMO.js"]),import("./chunk.JWJQ2VXS.js")));function B({text:o,className:s,style:p,markdown:t,headingsFrom:a}){return t?(0,n.jsx)(d.Suspense,{fallback:(0,n.jsx)(B,{text:o,...s?{className:s}:{},...p?{style:p}:{}}),children:(0,n.jsx)(x,{text:o,...s?{className:s}:{},...p?{style:p}:{},...a?{headingsFrom:a}:{}})}):(0,n.jsx)("div",{"data-graview-text-body":"",...s?{className:s}:{},style:{...h,...p},children:S(o).map((e,i)=>e.t==="p"?(0,n.jsx)("p",{style:k,children:e.lines.map((l,r)=>(0,n.jsxs)("span",{children:[r>0?(0,n.jsx)("br",{}):null,l]},r))},i):e.t==="ol"?(0,n.jsx)("ol",{start:e.start,style:y,children:e.items.map((l,r)=>(0,n.jsx)("li",{children:l},r))},i):(0,n.jsx)("ul",{style:y,children:e.items.map((l,r)=>(0,n.jsx)("li",{children:l},r))},i))})}export{b as a,B as b};
@@ -1 +0,0 @@
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.MWZK3HVG.js";import"./chunk.3D5T3XIE.js";import"./chunk.GR5Q4HTW.js";import"./chunk.QT4XGC5Z.js";import{H as te,S as W,a as L,oa as q}from"./chunk.MQ7FNHXG.js";import"./chunk.WLPTY4BF.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.QT4XGC5Z.js","./chunk.MQ7FNHXG.js","./chunk.WLPTY4BF.js","./chunk.AJZBJBMO.js"]),import("./chunk.NH5TDAB2.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};
@@ -1 +0,0 @@
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{G as g,H as T,S as v,a as m,aa as S,oa as C}from"./chunk.MQ7FNHXG.js";import"./chunk.WLPTY4BF.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.BUVAMSOZ.js","./chunk.FTJBW25J.js","./chunk.UT6642FC.js","./chunk.MCVY6RRS.js","./chunk.RZVZG2BQ.js","./chunk.VKHKYK5L.js","./chunk.TI4OSTQV.js","./chunk.EUGWV3S6.js","./chunk.MWZK3HVG.js","./chunk.3D5T3XIE.js","./chunk.GR5Q4HTW.js","./chunk.QT4XGC5Z.js","./chunk.MQ7FNHXG.js","./chunk.WLPTY4BF.js","./chunk.AJZBJBMO.js"]),import("./chunk.LDD3QX7G.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};
@@ -1 +0,0 @@
1
- import{a}from"./chunk.RJDZOF2L.js";import"./chunk.POHEWJKZ.js";import"./chunk.IEDXW36H.js";import"./chunk.7RSZMIAL.js";import"./chunk.6IHXTT6Z.js";import"./chunk.OEF3GPRM.js";import"./chunk.UT6642FC.js";import{b as n}from"./chunk.YPY5BOEI.js";import"./chunk.VKHKYK5L.js";import"./chunk.TI4OSTQV.js";import"./chunk.GZHZLJBF.js";import"./chunk.I3SQJ2L2.js";import"./chunk.OJGHDWI6.js";import"./chunk.FUJM7GDV.js";import"./chunk.MWZK3HVG.js";import"./chunk.3D5T3XIE.js";import"./chunk.GR5Q4HTW.js";import"./chunk.QT4XGC5Z.js";import{S as i}from"./chunk.MQ7FNHXG.js";import"./chunk.WLPTY4BF.js";import{b as o}from"./chunk.AJZBJBMO.js";var e=o(i(),1);function g({entries:d,style:l,headingStyle:p,className:r}){return(0,e.jsxs)("section",{...r?{className:r}:{},"data-testid":"record-ai","aria-label":"What AI did here",style:{display:"grid",gap:10,...l},children:[(0,e.jsx)("h2",{style:p??{margin:0,fontSize:"1rem"},children:"What AI did here"}),(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8,fontSize:"0.875rem"},children:d.slice(0,8).map(t=>(0,e.jsx)(n,{entry:t,undo:s=>(0,e.jsx)(a,{batch:s})},t.id))})]})}export{g as RecordInteractions};
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk.W2HCJQVK.js";import"./chunk.4DEUD66C.js";import"./chunk.LHO7L3CS.js";import"./chunk.L73VUBXN.js";import"./chunk.YG423NEB.js";import"./chunk.VNBR4DHD.js";import"./chunk.Z3ZKYSPN.js";import"./chunk.6ONRWFA6.js";import"./chunk.HJCQ6I3S.js";import"./chunk.GZ3IXNA4.js";import"./chunk.FMVWXSQ7.js";import"./chunk.IM7LXLIB.js";import"./chunk.ROGYDMES.js";import"./chunk.6IHXTT6Z.js";import"./chunk.YXH3IWNR.js";import"./chunk.OEF3GPRM.js";import"./chunk.BRHRAVU2.js";import"./chunk.VTWFVPKD.js";import"./chunk.ZRQI5VJF.js";import"./chunk.33GN2NUT.js";import"./chunk.2VIGF4FO.js";import"./chunk.5MSO3KRO.js";import"./chunk.QYRPELLU.js";import"./chunk.FTJBW25J.js";import"./chunk.UT6642FC.js";import"./chunk.V2NBJDAX.js";import"./chunk.WVUJXDXZ.js";import"./chunk.2EJAIT33.js";import"./chunk.EUGWV3S6.js";import"./chunk.6XJP7F3I.js";import"./chunk.NPX7SPXM.js";import"./chunk.OE4QOBJF.js";import"./chunk.74RMHUCX.js";import"./chunk.GZHZLJBF.js";import"./chunk.I3SQJ2L2.js";import"./chunk.OJGHDWI6.js";import"./chunk.FUJM7GDV.js";import"./chunk.MWZK3HVG.js";import"./chunk.3D5T3XIE.js";import"./chunk.GR5Q4HTW.js";import"./chunk.QT4XGC5Z.js";import"./chunk.MQ7FNHXG.js";import"./chunk.WLPTY4BF.js";import"./chunk.AJZBJBMO.js";export{b as declaredLensView,a as formatFor};
@@ -1,35 +0,0 @@
1
- import{a as I,j as M,k as O}from"./chunk.VTWFVPKD.js";import"./chunk.ZRQI5VJF.js";import{g as P}from"./chunk.33GN2NUT.js";import{l as D}from"./chunk.2VIGF4FO.js";import"./chunk.MWZK3HVG.js";import"./chunk.3D5T3XIE.js";import{b as C}from"./chunk.GR5Q4HTW.js";import"./chunk.QT4XGC5Z.js";import{H as q,S as F}from"./chunk.MQ7FNHXG.js";import{ba as L,pc as E}from"./chunk.WLPTY4BF.js";import{b as N}from"./chunk.AJZBJBMO.js";var f=N(q(),1);var n=N(F(),1),R=40,B=60;function T(l,o,s){return l.allNodes().filter(i=>i.kind===o).map(i=>i[s])}function Y(l){if(l.length<2)return[];let o=[...l].sort((a,d)=>a-d),s=o[o.length-1]-o[0];if(s<=0)return[];let i=Math.max(1,10**Math.floor(Math.log10(s/4))),e=s/4>=i*5?i*5:i,t=a=>Math.round(a/e)*e;return[...new Set([.2,.4,.6,.8].map(a=>t(o[Math.floor(a*(o.length-1))])))].filter(a=>a>0)}function _(l,o,s){let i=new Set(s.far??[]),e=new Map;for(let t of o.allNodes())i.has(t.kind)&&e.set(t.id,L(l.tryDefinition(t.kind),t));return[...e.entries()].map(([t,a])=>({id:t,label:a}))}function K(l,o,s){let i=_(l,o,s);return(i.length<=R?i:i.map(t=>({end:t,ties:o.out(t.id).length+o.in(t.id).length})).sort((t,a)=>a.ties-t.ties||t.end.label.localeCompare(a.end.label)).slice(0,R).map(t=>t.end)).sort((t,a)=>t.label.localeCompare(a.label))}function U(l,o,s){let i=[];for(let e of s.filters){let t=i.length;if(e.about==="is")for(let a of e.options??[])i.push({value:`is:${a}`,label:a,group:e.label,condition:{key:"is",value:a}});else if(e.about==="edge"){i.push({value:`${e.key}:*`,label:"anything",group:e.label,condition:{key:e.key,value:"*"}}),i.push({value:`${e.key}:none`,label:"nothing",group:e.label,condition:{key:e.key,value:"none"}});for(let a of K(l,o,e))i.push({value:`${e.key}:${a.id}`,label:a.label,group:e.label,condition:{key:e.key,value:a.id}})}else if(e.type==="date")for(let a of["before","after","on"])i.push({value:`${e.key}:${a}`,label:`${a}\u2026`,group:e.label,ask:{key:e.key,op:a,label:e.label}});else if(e.type==="number"){let a=l.tryDefinition(s.kind),d=Y(T(o,s.kind,e.key).filter(p=>typeof p=="number"));for(let p of["at-most","at-least"])for(let v of p==="at-most"?d:[...d].reverse())i.push({value:`${e.key}:${p}:${v}`,label:`${p==="at-most"?"at most":"at least"} ${C(a,e.key,v)}`,group:e.label,condition:{key:e.key,value:`${p}:${v}`}})}else if(e.type==="text"){let a=[...new Set(T(o,s.kind,e.key).filter(d=>typeof d=="string"&&d.length>0&&!d.includes(",")))].sort((d,p)=>d.localeCompare(p));if(a.length>=2&&a.length<=B)for(let d of a)i.push({value:`${e.key}:${d}`,label:d,group:e.label,condition:{key:e.key,value:d}})}else if(e.type==="boolean")i.push({value:`${e.key}:true`,label:"yes",group:e.label,condition:{key:e.key,value:"true"}}),i.push({value:`${e.key}:false`,label:"no",group:e.label,condition:{key:e.key,value:"false"}});else if(e.about==="via"){let a=l.tryDefinition(e.far?.[0]??"");for(let d of e.options??[])i.push({value:`${e.key}:${d}`,label:C(a,e.key.split(".")[1],d),group:e.label,condition:{key:e.key,value:d}})}else for(let a of e.options??[])i.push({value:`${e.key}:${a}`,label:C(l.tryDefinition(s.kind),e.key,a),group:e.label,condition:{key:e.key,value:a}});for(let a=t;a<i.length;a++)i[a]={...i[a],key:e.key}}return i}function V(l,o,s,i){let e=l.tryDefinition(o);return["at-most","at-least"].map(t=>({value:`${s.key}:${t}:${i}`,label:`${t==="at-most"?"at most":"at least"} ${C(e,s.key,i)}`,group:s.label,key:s.key,condition:{key:s.key,value:`${t}:${i}`}}))}function G(l){let o=l.trim().replace(/(?<=\d),(?=\d{3}\b)/g,"");return/^-?\d+(\.\d+)?$/.test(o)?Number(o):null}function j(l,o,s){let i=U(l,o,s);return s.filters.flatMap(e=>{let t=i.filter(d=>d.key===e.key);if(e.type==="number"&&e.about!=="edge")return[{key:e.key,label:e.label,entries:t,atNumber:d=>V(l,s.kind,e,d)}];if(t.length===0)return[];if(e.about!=="edge")return[{key:e.key,label:e.label,entries:t}];let a=_(l,o,e);return a.length<I?[{key:e.key,label:e.label,entries:t}]:[{key:e.key,label:e.label,entries:t.filter(d=>d.value===`${e.key}:*`||d.value===`${e.key}:none`),typed:[...a].sort((d,p)=>d.label.localeCompare(p.label))}]})}var z=8;function H(l,o){let s=o.trim().toLocaleLowerCase();if(!s)return{shown:[],more:0};let e=[...l.filter(t=>t.label.toLocaleLowerCase().includes(s))].sort((t,a)=>+!t.label.toLocaleLowerCase().startsWith(s)-+!a.label.toLocaleLowerCase().startsWith(s));return{shown:e.slice(0,z),more:Math.max(0,e.length-z)}}var J=["day","week","month","year","decade"];function le(l){let{which:o,schema:s,graph:i,offers:e,arrangement:t,set:a,toggle:d,has:p,done:v}=l,m=l.testId,A=(0,f.useRef)(null);(0,f.useEffect)(()=>{let u=A.current?.closest("[data-graview-popover]");!u||document.activeElement!==u||(u.querySelector('[aria-pressed="true"]')??u.querySelector("button, input"))?.focus({preventScroll:!0})},[]);let y=t.sort?e.sorts.find(u=>u.key===t.sort.by):void 0,S=t.group?e.groups.find(u=>u.key===t.group.by):void 0,b=O(y),r=e.natural?e.sorts.find(u=>u.key===e.natural.by):void 0,k=o==="filter"||o==="all"&&l.parts?.filter?j(s,i,e):[],w=u=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{children:"Sort by"}),(0,n.jsx)($,{testId:`${m}-sort-default`,value:"",on:!t.sort,onPress:()=>(a({sort:void 0}),u()),children:r?`As declared (${M(r.label)})`:"As they were added"}),e.sorts.map(g=>(0,n.jsx)($,{value:g.key,on:t.sort?.by===g.key,onPress:()=>(a({sort:{by:g.key,direction:t.sort?.direction??"asc"}}),u()),children:g.label},g.key)),t.sort?(0,n.jsxs)("div",{role:"group","aria-label":"Order","data-testid":`${m}-direction`,children:[(0,n.jsx)("p",{"aria-hidden":"true",children:"Order"}),["asc","desc"].map(g=>(0,n.jsx)($,{testId:`${m}-direction-${g}`,value:g,on:t.sort.direction===g,onPress:()=>(a({sort:{by:t.sort.by,direction:g}}),u()),children:b[g]},g))]}):null]}),c=u=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{children:"Group by"}),(0,n.jsx)($,{testId:`${m}-group-none`,value:"",on:!t.group,onPress:()=>(a({group:void 0}),u()),children:"Not grouped"}),e.groups.map(g=>(0,n.jsx)($,{value:g.key,on:t.group?.by===g.key,onPress:()=>(a({group:{by:g.key}}),u()),children:g.label},g.key)),t.group&&S?.buckets?(0,n.jsxs)("div",{role:"group","aria-label":"How wide a group is","data-testid":`${m}-bucket`,children:[(0,n.jsx)("p",{"aria-hidden":"true",children:"Each group"}),J.map(g=>(0,n.jsx)($,{testId:`${m}-bucket-${g}`,value:g,on:(t.group.bucket??"day")===g,onPress:()=>(a({group:{by:t.group.by,bucket:g}}),u()),children:`A ${g}`},g))]}):null]}),x=u=>(0,n.jsx)(Q,{sections:k,has:p,testId:m,onToggle:g=>(d(g),u())}),h=l.parts??{sort:!0,group:!0,filter:!0};return(0,n.jsxs)("div",{ref:A,style:{display:"contents"},children:[(0,n.jsx)("style",{children:Z}),o==="sort"?w(v):o==="group"?c(v):o==="filter"?x(v):(0,n.jsxs)(n.Fragment,{children:[h.sort?(0,n.jsx)("div",{role:"group","aria-label":"Sort",children:w(v)}):null,h.group?(0,n.jsx)("div",{role:"group","aria-label":"Group",children:c(v)}):null,h.filter?(0,n.jsx)("div",{role:"group","aria-label":"Filter",children:x(v)}):null]})]})}function $({value:l,on:o,onPress:s,testId:i,children:e}){return(0,n.jsx)("button",{type:"button",className:"graview-arrange-item",value:l,"data-value":l,"aria-pressed":o,onClick:s,...i?{"data-testid":i}:{},children:e})}function Q({sections:l,has:o,testId:s,onToggle:i}){let[e,t]=(0,f.useState)(null),[a,d]=(0,f.useState)(""),[p,v]=(0,f.useState)(()=>new Set(l.length===1?[l[0].key]:[])),[m,A]=(0,f.useState)({});if(e)return(0,n.jsx)(X,{ask:e,testId:s,onDay:r=>i({key:e.key,value:`${e.op}:${r}`}),onCancel:()=>t(null)});let y=r=>(0,n.jsx)($,{value:r.value,on:r.condition?o(r.condition):!1,onPress:()=>r.condition?i(r.condition):t(r.ask),children:r.label},r.value),S=(r,k)=>{let w=(r.typed??[]).filter(h=>o({key:r.key,value:h.id})),c=H(r.typed??[],k),x=[...w,...c.shown.filter(h=>!w.includes(h))];return(0,n.jsxs)(n.Fragment,{children:[x.map(h=>y({value:`${r.key}:${h.id}`,label:h.label,group:r.label,key:r.key,condition:{key:r.key,value:h.id}})),k.trim()&&c.shown.length===0?(0,n.jsx)("span",{className:"graview-arrange-none",children:"None is called that."}):null,c.more>0?(0,n.jsx)("span",{className:"graview-arrange-none",children:`${c.more} more \u2014 type more of the name`}):null]})},b=a.trim().toLocaleLowerCase();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("label",{className:"graview-arrange-find",children:[(0,n.jsx)("span",{style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"},children:"Find a filter"}),(0,n.jsx)("input",{type:"search","data-testid":`${s}-filter-find`,value:a,placeholder:"Find a filter, a name or a number\u2026",onChange:r=>d(r.target.value)})]}),l.map(r=>{let k=r.entries.filter(c=>c.condition&&o(c.condition)).length+(r.typed??[]).filter(c=>o({key:r.key,value:c.id})).length;if(b){let c=r.label.toLocaleLowerCase().includes(b),x=r.atNumber&&G(b)!==null?r.atNumber(G(b)):[],h=[...x,...c?r.entries:r.entries.filter(g=>g.label.toLocaleLowerCase().includes(b)&&!x.some(W=>W.value===g.value))],u=r.typed?H(r.typed,b):{shown:[],more:0};return h.length===0&&u.shown.length===0?null:(0,n.jsxs)("div",{role:"group","aria-label":r.label,"data-section":r.key,children:[(0,n.jsx)("p",{"aria-hidden":"true",children:r.label}),h.map(y),r.typed?S(r,b):null]},r.key)}if(r.entries.length===0&&!r.typed)return null;let w=p.has(r.key);return(0,n.jsxs)("div",{role:"group","aria-label":r.label,"data-section":r.key,children:[(0,n.jsxs)("button",{type:"button",className:"graview-arrange-section","data-testid":`${s}-section`,"data-key":r.key,"aria-expanded":w,onClick:()=>v(c=>c.has(r.key)?new Set([...c].filter(x=>x!==r.key)):new Set([...c,r.key])),children:[(0,n.jsx)("span",{children:r.label}),k>0?(0,n.jsx)("span",{className:"graview-arrange-on",children:`${k} on`}):null]}),w?(0,n.jsxs)(n.Fragment,{children:[r.typed?(0,n.jsx)("input",{type:"search",className:"graview-arrange-far","data-testid":`${s}-far-find`,"data-key":r.key,"aria-label":`${r.label}: type a name`,placeholder:`Type a name (${r.typed.length})\u2026`,autoFocus:!0,value:m[r.key]??"",onChange:c=>A({...m,[r.key]:c.target.value})}):null,r.entries.map(y),r.typed?S(r,m[r.key]??""):null]}):null]},r.key)})]})}function X({ask:l,testId:o,onDay:s,onCancel:i}){let[e,t]=(0,f.useState)(""),a=/^\d{4}-\d{2}-\d{2}$/.test(e)&&Number(e.slice(0,4))>=1e3,d=()=>{a&&s(e)};return(0,n.jsxs)("div",{role:"group","aria-label":`${l.label} ${l.op} which day`,"data-testid":`${o}-ask-day`,className:"graview-arrange-ask",children:[(0,n.jsx)("p",{"aria-hidden":"true",children:`${l.label} ${l.op}`}),(0,n.jsx)("input",{type:"date","data-testid":`${o}-day`,"aria-label":`${l.label} ${l.op} which day`,autoFocus:!0,value:e,onChange:p=>t(p.target.value),onKeyDown:p=>{p.key==="Enter"?(p.preventDefault(),d()):p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),p.nativeEvent.stopImmediatePropagation(),i())}}),(0,n.jsxs)("span",{children:[(0,n.jsx)("button",{type:"button","data-testid":`${o}-day-add`,disabled:!a,onClick:d,children:"Add"}),(0,n.jsx)("button",{type:"button",onClick:i,children:"Never mind"})]})]})}var Z=`
2
- .graview-arrange-list{display:grid;align-content:start;width:min(300px,calc(100vw - 24px));height:auto;max-height:min(70vh,520px);overflow:auto;overscroll-behavior:contain;margin:0;padding:0 6px 6px;border-radius:10px;border:1px solid var(--graview-edge);background:linear-gradient(var(--graview-float),var(--graview-float)),var(--graview-panel);box-shadow:var(--graview-lift-high);color:var(--graview-ink);font-size:.875rem;line-height:1.3}
3
- .graview-arrange-list>*:first-child:not(.graview-arrange-find){margin-top:6px}
4
- @media (max-width:519px){.graview-arrange-list{left:0!important;right:0!important;top:auto!important;bottom:0!important;width:100%!important;max-height:min(80dvh,560px)!important;border-radius:14px 14px 0 0;padding-bottom:calc(10px + env(safe-area-inset-bottom))}}
5
- .graview-arrange-find{position:sticky;top:0;z-index:${E.raised};display:block;margin:0 -6px 2px;padding:6px;background:linear-gradient(var(--graview-float),var(--graview-float)),var(--graview-panel);border-bottom:1px solid var(--graview-edge)}
6
- .graview-arrange-find input,.graview-arrange-far{box-sizing:border-box;width:100%;min-height:32px;margin:0;padding:0 8px;border:1px solid var(--graview-edge);border-radius:7px;background:var(--graview-panel);font:inherit;color:var(--graview-ink)}
7
- .graview-arrange-far{width:calc(100% - 16px);margin:2px 8px 4px}
8
- .graview-arrange-section{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;min-height:32px;margin:0;padding:6px 8px;border:0;border-radius:7px;background:none;font:inherit;font-weight:600;text-align:left;color:var(--graview-ink);cursor:pointer}
9
- .graview-arrange-section::after{content:"";flex:0 0 7px;height:7px;margin-left:auto;border:solid var(--graview-ink-muted);border-width:0 1.5px 1.5px 0;transform:rotate(-45deg)}
10
- .graview-arrange-section[aria-expanded=true]::after{transform:rotate(45deg)}
11
- .graview-arrange-section:hover{background:color-mix(in srgb,var(--graview-ink) 7%,transparent)}
12
- .graview-arrange-on{font-weight:400;color:var(--graview-accent)}
13
- .graview-arrange-none{display:block;padding:4px 8px 6px 28px;color:var(--graview-ink-muted)}
14
- .graview-arrange-list [role=group]{display:grid}
15
- .graview-arrange-list p{margin:8px 8px 2px;font-size:.6875rem;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--graview-ink-muted)}
16
- .graview-arrange-item{display:flex;align-items:flex-start;gap:8px;width:100%;min-height:30px;margin:0;padding:6px 8px;border:0;border-radius:7px;background:none;font:inherit;text-align:left;color:var(--graview-ink);cursor:pointer;overflow-wrap:anywhere}
17
- .graview-arrange-item::before{content:"";flex:0 0 12px}
18
- .graview-arrange-item[aria-pressed=true]{font-weight:600}
19
- .graview-arrange-item[aria-pressed=true]::before{content:"\u2713";color:var(--graview-accent)}
20
- .graview-arrange-item:hover{background:color-mix(in srgb,var(--graview-ink) 7%,transparent)}
21
- .graview-arrange-ask{display:grid;gap:8px;padding:0 8px 8px}
22
- .graview-arrange-ask p{margin:8px 0 0}
23
- .graview-arrange-ask input{box-sizing:border-box;width:100%;min-height:32px;padding:0 8px;border:1px solid var(--graview-edge);border-radius:7px;background:var(--graview-panel);font:inherit;color:var(--graview-ink)}
24
- .graview-arrange-ask span{display:flex;gap:8px}
25
- .graview-arrange-ask button{min-height:30px;padding:0 12px;border:1px solid var(--graview-edge);border-radius:7px;background:var(--graview-panel);font:inherit;color:var(--graview-ink);cursor:pointer}
26
- .graview-arrange-ask button:disabled{opacity:.5;cursor:default}
27
- `;function se({offers:l,chips:o,schema:s,graph:i,kind:e,arrangement:t,has:a,choose:d,testId:p}){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("style",{children:re}),(0,n.jsx)(ee,{offers:l,chips:o,schema:s,graph:i,kind:e,arrangement:t,has:a,choose:d,testId:p})]})}function ee({offers:l,chips:o,schema:s,graph:i,kind:e,arrangement:t,has:a,choose:d,testId:p}){let v={schema:s,graph:i,...o.flagged?{flagged:o.flagged}:{},...o.today?{today:o.today}:{}},m=s.tryDefinition(e),A=o.nodes.filter(y=>!t.query||P(v,y,t.query));return(0,n.jsx)("div",{className:"graview-arrange-chips","data-testid":`${p}-chips`,children:l.map(y=>{let S=(t.filter??[]).filter(r=>r.key!==y.key),b=new Map;for(let r of A){if(!S.every(w=>D(v,r,w)))continue;let k=String(r[y.key]);b.set(k,(b.get(k)??0)+1)}return(0,n.jsxs)("div",{role:"group","aria-label":y.label,className:"graview-arrange-chip-row","data-field":y.key,children:[(0,n.jsx)("span",{className:"graview-arrange-chip-label","aria-hidden":"true",children:y.label}),(y.options??[]).filter(r=>(b.get(r)??0)>0||a({key:y.key,value:r})).map(r=>{let k=C(m,y.key,r),w=b.get(r)??0;return(0,n.jsxs)("button",{type:"button",className:"graview-arrange-chip","data-testid":`${p}-chip`,"data-value":`${y.key}:${r}`,"aria-pressed":a({key:y.key,value:r}),"aria-label":`${y.label}: ${k}, ${w}`,onClick:()=>d(y.key,r),children:[k,(0,n.jsx)("span",{className:"graview-arrange-chip-count","aria-hidden":"true",children:w})]},r)})]},y.key)})})}var re=`
28
- .graview-arrange-chips,.graview-arrange-chip-row{display:contents}
29
- @container (max-width:519px){.graview-arrange-chips{display:flex;flex:1 1 10rem;align-items:center;gap:6px;min-width:0;overflow-x:auto;scrollbar-width:none}.graview-arrange-chip-label{margin:0}.graview-arrange-chip{flex:0 0 auto;white-space:nowrap}}
30
- .graview-arrange-chip-label{margin:0 0 0 8px;font-size:.8125rem;color:var(--graview-ink-muted)}
31
- .graview-arrange-chip{display:inline-flex;align-items:center;gap:6px;min-height:28px;max-width:100%;box-sizing:border-box;margin:0;padding:0 10px;border:1px solid var(--graview-edge);border-radius:999px;background:var(--graview-panel);font:inherit;font-size:.8125rem;line-height:1.2;color:var(--graview-ink);cursor:pointer;overflow-wrap:anywhere;text-align:left}
32
- .graview-arrange-chip:hover{border-color:var(--graview-edge-bright,var(--graview-edge))}
33
- .graview-arrange-chip[aria-pressed=true]{border-color:var(--graview-accent);background:color-mix(in srgb,var(--graview-accent) 12%,var(--graview-panel));font-weight:600}
34
- .graview-arrange-chip-count{color:var(--graview-ink-muted);font-variant-numeric:tabular-nums;font-weight:400}
35
- `;export{se as ArrangeChips,le as ArrangeLists,R as FAR_ENDS,z as TYPED_MATCHES,U as filterEntries,j as filterSections,Y as roundSteps,H as typedMatches,G as typedNumber};
@@ -1 +0,0 @@
1
- import"./chunk.5A4AOFOA.js";import"./chunk.KSXB4LDF.js";import"./chunk.DL637Q3W.js";import{a as L,b as R,c as E}from"./chunk.AZCFXPEL.js";import{b as T}from"./chunk.W2HCJQVK.js";import"./chunk.4DEUD66C.js";import"./chunk.LHO7L3CS.js";import"./chunk.L73VUBXN.js";import"./chunk.YG423NEB.js";import"./chunk.VNBR4DHD.js";import"./chunk.Z3ZKYSPN.js";import"./chunk.6ONRWFA6.js";import"./chunk.HJCQ6I3S.js";import"./chunk.GZ3IXNA4.js";import"./chunk.FMVWXSQ7.js";import"./chunk.TKSGC6XH.js";import"./chunk.IM7LXLIB.js";import"./chunk.IEDXW36H.js";import"./chunk.7RSZMIAL.js";import"./chunk.ROGYDMES.js";import"./chunk.6IHXTT6Z.js";import"./chunk.YXH3IWNR.js";import"./chunk.OEF3GPRM.js";import"./chunk.BRHRAVU2.js";import"./chunk.VTWFVPKD.js";import"./chunk.ZRQI5VJF.js";import"./chunk.33GN2NUT.js";import"./chunk.2VIGF4FO.js";import"./chunk.5MSO3KRO.js";import"./chunk.QYRPELLU.js";import"./chunk.FTJBW25J.js";import"./chunk.UT6642FC.js";import"./chunk.MCVY6RRS.js";import"./chunk.RZVZG2BQ.js";import"./chunk.TI4OSTQV.js";import"./chunk.V2NBJDAX.js";import"./chunk.WVUJXDXZ.js";import"./chunk.2EJAIT33.js";import"./chunk.EUGWV3S6.js";import"./chunk.6XJP7F3I.js";import"./chunk.NPX7SPXM.js";import"./chunk.OE4QOBJF.js";import"./chunk.74RMHUCX.js";import"./chunk.GZHZLJBF.js";import{r as A}from"./chunk.I3SQJ2L2.js";import"./chunk.OJGHDWI6.js";import"./chunk.FUJM7GDV.js";import"./chunk.MWZK3HVG.js";import"./chunk.3D5T3XIE.js";import"./chunk.GR5Q4HTW.js";import"./chunk.QT4XGC5Z.js";import{$ as x,H as S,J as $,S as p,ba as C}from"./chunk.MQ7FNHXG.js";import{aa as h,qc as k}from"./chunk.WLPTY4BF.js";import{b as i}from"./chunk.AJZBJBMO.js";var r=i(S(),1);var l=i(S(),1);var g=i(p(),1);var m={font:"inherit",fontSize:"0.875rem",minHeight:24,padding:0,border:0,borderRadius:2,background:"transparent",boxShadow:"none",color:"var(--graview-accent)",textDecoration:"underline",textUnderlineOffset:3,textAlign:"start",cursor:"pointer"};var e=i(p(),1);function Y({page:n=!1,go:D,onPick:y,onDiscard:M}){let{store:d,seatTalk:c}=x(),u=$(c),N=E(),b=D??N,{keep:P}=L(b),[H,f]=(0,r.useState)(!1);C();let t=u.draft;(0,r.useEffect)(()=>f(!1),[t]),(0,r.useEffect)(()=>{n||R(!1)},[n]);let v=(0,r.useRef)(null),w=t!==null&&!n;if((0,r.useLayoutEffect)(()=>{let s=v.current;if(!w||!s?.parentElement)return;let o=[];for(let a=s.previousElementSibling;a;a=a.previousElementSibling)a instanceof HTMLElement&&!a.inert&&a.tagName!=="STYLE"&&(a.inert=!0,o.push(a));return()=>{for(let a of o)a.inert=!1}},[w]),!t)return null;let G=T(t.drawn),F=d.schema.tryDefinition(t.kind),q=d.graph.nodesOfKind(t.kind).filter(s=>h(F,s)),z=()=>{c.setDraft(null),M?.()};return(0,e.jsxs)("section",{ref:v,"data-testid":"draft-frame","data-graview-draft-frame":n?"page":"scene","aria-label":`Draft: ${t.title}`,style:n?{display:"grid",gap:12,minWidth:0}:{position:"absolute",inset:12,zIndex:k("rail"),display:"grid",gridTemplateRows:"auto auto minmax(0, 1fr)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:12,boxShadow:"var(--graview-lift-high)",overflow:"hidden",minHeight:0},children:[(0,e.jsxs)("p",{"data-testid":"draft-line",style:{...K,...n?{}:{padding:"10px 16px"}},children:[n?(0,e.jsx)("span",{children:"Draft"}):(0,e.jsxs)("span",{children:["Draft \u2014 ",(0,e.jsx)("span",{"data-testid":"draft-title",style:{color:"var(--graview-ink)",fontWeight:600},children:t.title})]}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-keep",disabled:H,title:`Keep \u201C${t.title}\u201D as a lens: a place of its own`,onClick:()=>{f(!0),P(t).finally(()=>f(!1))},style:m,children:"Keep as a lens"}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-discard",onClick:z,style:m,children:"Discard"})]}),u.draftNote?(0,e.jsx)("p",{"data-testid":"draft-note",role:"status",style:{margin:0,padding:n?0:"0 16px 8px",fontSize:"0.8125rem",color:"var(--graview-warn)"},children:u.draftNote}):(0,e.jsx)("span",{}),(0,e.jsx)("div",{"data-testid":"draft-lens","data-graview-draft":t.lens.name,style:n?{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",scrollbarGutter:"stable",border:"1px solid var(--graview-edge)",borderRadius:12,background:"var(--graview-panel)"}:{minHeight:0,overflow:"auto",scrollbarGutter:"stable",display:"grid",gridTemplateRows:"minmax(0, 1fr)"},onClick:s=>{let o=s.target?.closest("[data-graview-pick]")?.getAttribute("data-graview-pick");if(!o||!d.graph.getNode(o))return;s.preventDefault();let a=d.graph.getNode(o);y?(c.setDraft(null),y(o)):b({to:"record",id:o,kind:a.kind,label:o,address:"",said:""})},children:(0,e.jsx)(A,{kind:t.kind,view:t.title,children:(0,e.jsx)(G,{nodes:q,label:t.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1})})})]})}var K={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};export{Y as DraftFrame};
@@ -1 +0,0 @@
1
- import{b as on,c as rn}from"./chunk.UT6642FC.js";import{e as N}from"./chunk.MWZK3HVG.js";import{c as B}from"./chunk.GR5Q4HTW.js";import{Eb as sn,Fb as E,Rb as V,Ub as Q,Va as H,ba as F,ca as K,da as q,ea as nn,fa as en,ia as tn,ja as J,ka as T}from"./chunk.WLPTY4BF.js";function an(){return{name:"insight",derive({store:n,nodes:a,kindSelection:t}){let l=[],v=f=>F(n.schema.tryDefinition(f.kind),f);for(let f of a){if([...n.schema.edgeKinds].reduce((c,S)=>c+n.graph.out(f.id,S).length+n.graph.in(f.id,S).length,0)===0){l.push({id:`insight:island:${f.id}`,text:`${v(f)} is connected to nothing yet`,nodeIds:[f.id]});continue}for(let c of n.schema.edgeKinds){let S=n.graph.in(f.id,c).length;if(S<3)continue;let s=[...n.graph.allEdges()].filter(r=>r.kind===c),e=s.length;e>=4&&S/e>.6&&l.push({id:`insight:load:${f.id}:${c}`,text:`${v(f)} ${mn(n,s,c,S)}`,nodeIds:[f.id]})}}for(let f of t){if(n.graph.nodesOfKind(f).length>0)continue;let A=n.schema.definitions.filter(c=>c.kind!==f).filter(c=>Object.values(c.edges).some(S=>S.to!=="*"&&S.to.includes(f))).map(c=>c.plural??`${c.kind}s`);A.length>0&&l.push({id:`insight:gap:${f}`,text:`Nothing here yet, though ${A.join(" and ")} expect to connect to these`,nodeIds:[]})}return{observations:l}}}}function mn(n,a,t,l){let v=new Set(a.map(s=>n.graph.getNode(s.from)?.kind).filter(s=>s!==void 0)),f=v.size===1?[...v][0]:void 0,A=a.length,c=B(n.schema,f??[...v][0]??"",t,"in"),S=s=>f?nn(n.schema,f,s):String(s);return l===A?`${c}: all ${S(l)}`:`${c}: ${l} of the ${S(A)}`}function dn(n){let a=new Map;if(n.length===0)return a;let t=n.slice(-512),l=new Set;for(let f of t)f.undoes&&l.add(f.undoes);let v=n[n.length-1].seq;for(let f of t){if(!f.mutation||l.has(f.id))continue;let A=Math.pow(.5,(v-f.seq)/64);a.set(f.mutation.name,(a.get(f.mutation.name)??0)+A)}return a}function cn(n){return 8*(n/(n+1))}var pn=100;function un(){return{name:"invariant",derive({store:n,selection:a,nodes:t,violations:l}){let v=s=>F(n.schema.tryDefinition(s.kind),s),f=new Set(a),A=l.filter(s=>s.nodeIds.some(e=>f.has(e))||s.subjectId!==void 0&&f.has(s.subjectId)),c=[],S=[];A.forEach((s,e)=>{S.push({id:`violation:${s.invariant}:${e}`,text:s.message,nodeIds:s.nodeIds}),s.repairs.forEach((r,h)=>{c.push({id:`invariant:${s.invariant}:${e}:${h}`,label:r.label,provider:"invariant",mutation:r.mutation,args:r.args??{},open:(r.missing??[]).map(k=>{let d=n.allMutations().find(p=>p.name===r.mutation);if(!d)return{name:k};let o=E(d.input).find(p=>p.name===k),m=o?o.kinds.includes("*")?n.graph.allNodes().map(p=>p.id):o.kinds.flatMap(p=>n.graph.nodesOfKind(p).map($=>$.id)):void 0;return{name:k,shape:N(d.input,k),...o?{kinds:o.kinds}:{},...m?{candidates:m}:{}}}),score:pn-h-(r.missing?.length??0),why:s.message,nodeIds:s.nodeIds,...s.subjectId===void 0?{}:{subjectId:s.subjectId}})})});for(let s of t){let e=n.allInvariants().filter(r=>{if(r.scope==="graph")return!1;let h=r.scope;return h.kind!==s.kind?!1:h.match?h.match(s):!0});e.length!==0&&(A.some(r=>r.subjectId===s.id||r.nodeIds.includes(s.id))||S.push({id:`holds:${s.id}`,text:`${v(s)} holds \u2014 nothing currently breaks ${e.length===1?"it":`any of its ${e.length} rules`}`,nodeIds:[s.id]}))}return{affordances:c,observations:S}}}}var U=40;function fn(){return{name:"schema",derive({store:n,selection:a,nodes:t,kindSelection:l,edgeSelection:v,principal:f}){let A=(e,r)=>f!==void 0&&!n.permits({name:e,args:r},f).ok,c=[];if(t.length===0&&v.length>0){for(let e of v){let r=n.graph.getNode(e.from),h=n.graph.getNode(e.to);if(!r||!h)continue;let k=rn(n,e);k?.provisional&&c.push({id:`schema:edge:${V}:${e.kind}:${e.from}:${e.to}`,label:"Keep this link",provider:"schema",mutation:V,args:{kind:e.kind,from:e.from,to:e.to},open:[],score:64,why:on(k),nodeIds:[e.from,e.to]});for(let d of n.allMutations()){let o=(d.connects??[]).includes(e.kind),m=(d.severs??[]).includes(e.kind);if(!o&&!m||d.derived?.relation!==void 0&&d.derived.kind!==r.kind)continue;let p={},$=[],j=E(d.input);for(let g of j){let w=g.kinds.includes("*")||g.kinds.includes(r.kind),P=g.kinds.includes("*")||g.kinds.includes(h.kind),y=w&&!j.some(I=>I!==g&&(I.kinds.includes(r.kind)||I.kinds.includes("*")));w&&!P?p[g.name]=e.from:P&&!w?p[g.name]=e.to:w&&P&&y?p[g.name]=e.from:$.push({name:g.name,kinds:g.kinds,candidates:[e.from,e.to],shape:N(d.input,g.name)})}for(let g of G(d.input,""))g in p||$.some(w=>w.name===g)||$.push({name:g,shape:N(d.input,g)});$.every(g=>g.optional===!0?!0:g.kinds!==void 0?(g.candidates?.length??0)>0:(g.candidates?.length??0)>0||g.shape!==void 0&&g.shape.type!=="unknown")&&(o&&!m&&$.length===0||c.push({id:`schema:edge:${d.name}:${e.kind}:${e.from}:${e.to}`,label:K(d),provider:"schema",mutation:d.name,args:p,open:$,...d.destructive?{destructive:!0}:{},score:(m?62:58)-$.length,why:`this line is "${B(n.schema,n.graph.getNode(e.from)?.kind??"",e.kind,"out")}"`,nodeIds:[e.from,e.to]}))}}return{affordances:c}}if(t.length===0&&l.length>0){let e=new Set(l),r=[];for(let h of n.allMutations()){if(!(h.creates??[]).some(o=>e.has(o)))continue;let k=[];for(let o of E(h.input)){let m=o.kinds.includes("*")?n.graph.allNodes().map(p=>p.id):o.kinds.flatMap(p=>n.graph.nodesOfKind(p).map($=>$.id));k.push({name:o.name,kinds:o.kinds,candidates:m,shape:N(h.input,o.name),...o.optional?{optional:!0}:{}})}for(let o of G(h.input,""))k.some(m=>m.name===o)||k.push({name:o,shape:N(h.input,o)});if(!k.every(o=>o.optional===!0?!0:o.kinds!==void 0?(o.candidates?.length??0)>0:(o.candidates?.length??0)>0||o.shape!==void 0&&o.shape.type!=="unknown")&&!A(h.name,{})){let o=k.filter(m=>m.optional!==!0&&m.kinds!==void 0&&!m.kinds.includes("*")&&(m.candidates?.length??0)===0);if(o.length>0){let m=[...new Set(o.flatMap(p=>p.kinds??[]))].map(p=>J(T(n.schema.tryDefinition(p),p)));r.push({id:`schema:waits:${h.name}`,text:`"${h.title??h.name}" cannot begin until there is ${m.length===1?m[0]:`${m.slice(0,-1).join(", ")} and ${m[m.length-1]}`}.`,nodeIds:[]})}continue}c.push({id:`schema:add:${h.name}`,label:K(h),provider:"schema",mutation:h.name,args:{},open:k,score:U-k.length,why:`this makes ${(h.creates??[]).filter(o=>e.has(o)).map(o=>J(T(n.schema.tryDefinition(o),o))).join(", ")}`,nodeIds:[]})}return{affordances:c,observations:r}}if(t.length===0)return{};let S=new Set(t.map(e=>e.kind)),s=(e,r,h)=>{let k=[];for(let d of n.graph.allEdges()){if(!r.includes(d.kind))continue;let o=d.from===e?d.to:d.to===e?d.from:null;if(!o)continue;let m=n.graph.getNode(o);m&&(!h.includes("*")&&!h.includes(m.kind)||k.includes(o)||k.push(o))}return k};for(let e of n.allMutations()){let r=e.subject;if(!r||!(r.kinds==="*"?!0:[...S].every(u=>r.kinds.includes(u))))continue;let k=e.derived?.act;if((k==="archive"||k==="merge")&&t.some(u=>H(u))||k==="unarchive"&&!t.some(u=>H(u))||k==="leave-alone"&&t.every(u=>Q(n,u.id))||k==="allow-tidying"&&!t.some(u=>Q(n,u.id)))continue;let d=t.length===1?t[0].id:null,o=e.severs??[],m=e.connects??[];if(d&&o.length>0&&m.length===0&&s(d,o,["*"]).length===0)continue;let p=[];for(let u of E(e.input)){if(u.name===r.arg)continue;let g=u.kinds.includes("*")?n.graph.allNodes().map(w=>w.id):u.kinds.flatMap(w=>n.graph.nodesOfKind(w).map(P=>P.id));if(d&&m.length>0){let w=new Set(s(d,m,u.kinds));g=g.filter(P=>!w.has(P))}else d&&o.length>0&&(g=s(d,o,u.kinds));p.push({name:u.name,kinds:u.kinds,candidates:g.filter(w=>!a.includes(w)),shape:N(e.input,u.name),...u.optional?{optional:!0}:{}})}for(let u of G(e.input,r.arg))p.some(g=>g.name===u)||p.push({name:u,shape:N(e.input,u)});if(p.length===0&&d){let u=kn(e.input,r.arg);if(u.length>0&&!yn(n,e.name,{[r.arg]:d}))for(let g of u){let w=E(e.input).find(P=>P.name===g);p.push({name:g,optional:!0,...w?{kinds:w.kinds}:{},shape:N(e.input,g)})}}if(!p.every(u=>u.optional===!0?!0:u.kinds!==void 0?(u.candidates?.length??0)>0:(u.candidates?.length??0)>0||u.shape!==void 0&&u.shape.type!=="unknown")&&!A(e.name,d?{[r.arg]:d}:{}))continue;let j=t.map(u=>({[r.arg]:u.id}));p.length===0&&!j.some(u=>n.wouldChange({name:e.name,args:u}))||c.push({id:`schema:${e.name}`,label:t.length>1?`${K(e)} (${t.length})`:K(e),provider:"schema",mutation:e.name,args:j[0]??{},open:p,...e.destructive?{destructive:!0}:{},...e.derived?.act==="archive"||e.derived?.act==="merge"||e.derived?.act==="leave-alone"||e.derived?.act==="allow-tidying"?{setsAside:!0}:{},...o.length>0||m.length>0?{ties:!0}:{},...t.length>1?{batch:j}:{},score:U-p.length,why:t.length>1?`all ${t.length} selected nodes are ${[...S].map(u=>en(n.schema,u).toLowerCase()).join(" or ")}`:`this is ${J(T(n.schema.tryDefinition(t[0].kind),t[0].kind))}`,nodeIds:t.map(u=>u.id)})}if(t.length===1){let e=t[0];for(let r of n.allMutations()){let h=r.subject,k=r.severs??[],d=r.connects??[];if(!h||k.length===0&&d.length===0)continue;let o=h.kinds==="*"?"*":h.kinds;if(o==="*"||o.includes(e.kind))continue;let m=E(r.input),p=m.find(y=>y.name!==h.arg&&(y.kinds.includes("*")||y.kinds.includes(e.kind)));if(!p)continue;let $=o,j=$.includes("*")?n.graph.allNodes().map(y=>y.id):$.flatMap(y=>n.graph.nodesOfKind(y).map(I=>I.id)),u=new Set(s(e.id,d.length>0?d:k,$)),g=d.length>0?j.filter(y=>!u.has(y)):j.filter(y=>u.has(y));if(g.length===0)continue;let w=[{name:h.arg,kinds:$,candidates:g,shape:N(r.input,h.arg)}];for(let y of m){if(y.name===p.name||y.name===h.arg)continue;let I=y.kinds.includes("*")?n.graph.allNodes().map(D=>D.id):y.kinds.flatMap(D=>n.graph.nodesOfKind(D).map(O=>O.id));w.push({name:y.name,kinds:y.kinds,candidates:I,shape:N(r.input,y.name),...y.optional?{optional:!0}:{}})}for(let y of G(r.input,p.name))y===h.arg||w.some(I=>I.name===y)||w.push({name:y,shape:N(r.input,y)});w.every(y=>y.optional===!0?!0:y.kinds!==void 0?(y.candidates?.length??0)>0:(y.candidates?.length??0)>0||y.shape!==void 0&&y.shape.type!=="unknown")&&c.push({id:`schema:tie:${r.name}:${e.id}`,label:r.fromTheOtherEnd??K(r),provider:"schema",mutation:r.name,args:{[p.name]:e.id},open:w,ties:!0,...r.destructive?{destructive:!0}:{},score:U-w.length+2,why:`${k.length>0?"this one is on":"this one could join"} ${w[0].candidates.length===1?"it":"one of these"}`,nodeIds:[e.id]})}}return{affordances:c}}}}function kn(n,a){let t=n.shape;return t?Object.entries(t).filter(([l,v])=>l!==a&&v.safeParse(void 0).success).map(([l])=>l):[]}function yn(n,a,t){try{return n.preview({name:a,args:t}),!0}catch{return!1}}function G(n,a){let t=n.shape;return t?Object.entries(t).filter(([l,v])=>l!==a&&!v.safeParse(void 0).success).map(([l])=>l):[]}var vn=70,bn=80,Sn=new Set(["id","kind"]);function ln(){return{name:"structure",derive({store:n,nodes:a}){let t=c=>F(n.schema.tryDefinition(c.kind),c);if(a.length<2)return{};let l=[],v=[],f=a.map(c=>c.id);for(let c of n.schema.edgeKinds){let S=wn(a.map(e=>new Set([...n.graph.out(e.id,c).map(r=>r.id),...n.graph.in(e.id,c).map(r=>r.id)])));for(let e of S){let r=n.graph.getNode(e);r&&l.push({id:`shared:${c}:${e}`,text:`all ${a.length} share "${t(r)}" (${q(c).toLowerCase()})`,nodeIds:[...f,e]})}let s=new Map;for(let e of a)for(let r of[...n.graph.out(e.id,c),...n.graph.in(e.id,c)])s.set(r.id,(s.get(r.id)??0)+1);for(let[e,r]of s){if(r!==a.length-1||a.length<3||f.includes(e))continue;let h=n.graph.getNode(e);if(!h)continue;let k=a.find(d=>![...n.graph.out(d.id,c),...n.graph.in(d.id,c)].some(o=>o.id===e));if(k){l.push({id:`near-shared:${c}:${e}`,text:`all but "${t(k)}" share "${t(h)}" (${q(c).toLowerCase()})`,nodeIds:[...f,e]});for(let d of n.allMutations()){let o=d.subject;if(!o||o.kinds!=="*"&&!o.kinds.includes(k.kind))continue;let m=An(d.input,h.kind);m&&v.push({id:`structure:join:${d.name}:${k.id}:${e}`,label:`${K(d)}: bring "${t(k)}" in line with the others`,provider:"structure",mutation:d.name,args:{[o.arg]:k.id,[m]:e},open:[],score:vn,why:`every other selected node is connected to "${t(h)}"`,nodeIds:[k.id,e]})}}}}let A=new Map;for(let c of a)A.set(c.kind,[...A.get(c.kind)??[],c]);for(let[c,S]of A){if(S.length<2)continue;let s=S,e=S.map(d=>d.id),r=A.size>1?`${c}:`:"",h=new Set;for(let d of s)for(let o of Object.keys(d))Sn.has(o)||h.add(o);let k=d=>n.schema.definitions.find(o=>o.kind===d);for(let d of[...h].sort()){let o=k(s[0].kind),m=tn(o,d).toLowerCase(),p=o?.display?.format?.[d],$=O=>{if(!p)return O;try{return String(p(JSON.parse(O)))}catch{return O}},j=s.map(O=>O[d]),u=new Map;if(j.forEach((O,R)=>{let L=JSON.stringify(O??null),x=u.get(L);x?x.push(s[R]):u.set(L,[s[R]])}),u.size===1){let O=[...u.keys()][0];if(O==="null")continue;l.push({id:`agree:${r}${d}`,text:`all ${s.length} share the ${m} ${$(O)}`,nodeIds:e});continue}if(s.length<3||u.size!==2)continue;let g=[...u.entries()].sort((O,R)=>R[1].length-O[1].length),[w,P]=g[0],[,y]=g[1];if(y.length!==1||w==="null")continue;let I=y[0],D=JSON.parse(w);l.push({id:`odd-one-out:${r}${d}`,text:`${P.length} share the ${m} ${$(w)}; "${t(I)}" does not`,nodeIds:e});for(let O of n.allMutations()){let R=O.subject;if(!R||R.kinds!=="*"&&!R.kinds.includes(I.kind))continue;let L=hn(O.input);if(!L||!(d in L))continue;let x={[R.arg]:I.id,[d]:D},_=!0;for(let[C,Z]of Object.entries(L)){if(C in x||Z.safeParse(void 0).success)continue;let i=I[C];if(i===void 0){_=!1;break}x[C]=i}!_||!O.input.safeParse(x).success||v.push({id:`structure:align:${O.name}:${d}:${I.id}`,label:`Align the ${m} of "${t(I)}" with the other ${P.length}`,provider:"structure",mutation:O.name,args:x,open:[],score:bn,why:`${P.length} of ${s.length} share the ${m} ${$(w)}`,nodeIds:e})}}}return{affordances:v,observations:l}}}}function wn(n){if(n.length===0)return[];let[a,...t]=n;return[...a].filter(l=>t.every(v=>v.has(l))).sort()}function hn(n){return n.shape??null}function An(n,a){let t=hn(n);if(!t)return null;for(let[l]of Object.entries(t)){let v=sn(t[l]);if(v&&(v.includes("*")||v.includes(a)))return l}return null}function $n(){return[un(),ln(),fn(),an()]}function Hn(n,a,t={}){let l=gn(),v=t.providers??$n(),f=a.map(i=>n.graph.getNode(i)).filter(i=>i!==void 0),A={store:n,selection:a,nodes:f,kindSelection:t.kindSelection??[],edgeSelection:t.edgeSelection??[],violations:n.violations(t.context),context:t.context??{},principal:t.principal??{kind:"human"}},c=[],S=[];for(let i of v){let b=i.derive(A);c.push(...b.affordances??[]),S.push(...b.observations??[])}let s=new Set(n.allMutations().filter(i=>i.pinned).map(i=>i.name)),e=new Set(t.pins?.pinned??[]),r=new Set(t.pins?.unpinned??[]),h=i=>e.has(i.mutation)?"user":s.has(i.mutation)&&!r.has(i.mutation)?"declared":void 0,k=i=>{let b=h(i);return b?{...i,pinned:b}:i},d=new Map;for(let[i,b]of dn(n.log.all()))d.set(i,cn(b));let o=i=>i.pinned==="user"?0:i.pinned==="declared"?1:2,m=i=>i.score+(d.get(i.mutation)??0),p=new Map(n.allMutations().map(i=>[i.name,i])),$=new Map,j=i=>{let b=p.get(i.mutation);if(!b)return[];let M=$.get(i.mutation);M||(M=E(b.input).map(W=>W.name),$.set(i.mutation,M));let z=[];for(let W of i.batch??[i.args])for(let X of M){let Y=W[X]??i.args[X];typeof Y=="string"&&z.push(Y)}return z},u=t.focus,g=4,w=i=>i.open.length>0?1:0,P=i=>{if(u===void 0)return g;let b=j(i);return b.length>0?b.includes(u)?y(i,0):g:i.nodeIds.includes(u)||i.subjectId===u?y(i,1):g},y=(i,b)=>i.provider==="invariant"?b:2+w(i),I=i=>i.setsAside?1:0,D=On(c).map(k),O=new Map(D.map((i,b)=>[i,b])),R=D.sort((i,b)=>{let M=Number(i.destructive??!1)-Number(b.destructive??!1);if(M!==0)return M;let z=I(i)-I(b);if(z!==0)return z;let W=P(i)-P(b);return W!==0?W:P(i)<2?O.get(i)-O.get(b):+(b.provider==="invariant")-+(i.provider==="invariant")||o(i)-o(b)||m(b)-m(i)||i.id.localeCompare(b.id)}),L=t.principal??{kind:"human"},x=[],_=[];for(let i of R){let b=n.permits({name:i.mutation,args:{...i.args,...i.batch?.[0]??{}}},L);if(b.ok)x.push(i);else{let M=Pn(n,i,L);if(M==="done")continue;M?x.push(M):_.push({...i,refusal:b.refusal})}}let C=x.map((i,b)=>({...i,rank:b})),Z=_.map((i,b)=>({...i,rank:x.length+b}));return{affordances:t.limit===void 0?C:C.slice(0,t.limit),withheld:Z,observations:In(S),ms:gn()-l}}function On(n){let a=new Map;for(let t of n){let l=[t.mutation,JSON.stringify(t.args),JSON.stringify(t.batch??null)].join("|"),v=a.get(l);(!v||t.score>v.score)&&a.set(l,t)}return[...a.values()]}function In(n){let a=new Map;for(let t of n)a.set(t.text,t);return[...a.values()]}function gn(){return typeof performance<"u"?performance.now():Date.now()}function Vn(n,a,t={},l={}){let v=(a.batch??[a.args]).map(A=>({name:a.mutation,args:{...a.args,...A,...t}})),f=n.allMutations().find(A=>A.name===a.mutation);return n.applyAll(v,{...f?.describe?{}:{intent:a.label},...l.author?{author:l.author}:{}})}function Qn(n,a,t={}){return n.preview({name:a.mutation,args:{...a.args,...t}})}function Pn(n,a,t){let l=n.allMutations().find(s=>s.name===a.mutation)?.subject,v=l!==void 0&&a.args[l.arg]===void 0,f=v?a.open.find(s=>s.name===l.arg):a.open.find(s=>s.name!==l?.arg&&s.candidates);if(!f?.candidates)return;let A=s=>n.permits({name:a.mutation,args:{...a.args,...a.batch?.[0]??{},[f.name]:s}},t).ok,c=f.candidates.filter(A),S=t.id===void 0?void 0:n.graph.getNode(t.id);if(c.length===0){let s=v?l.kinds:"*";return S!==void 0&&(s==="*"||s.includes(S.kind))&&A(S.id)?"done":void 0}return c.length===1&&c[0]===t.id?{...a,args:{...a.args,[f.name]:t.id},open:a.open.filter(s=>s!==f)}:{...a,open:a.open.map(s=>s===f?{...s,candidates:c}:s)}}export{Hn as a,Vn as b,Qn as c};
@@ -1 +0,0 @@
1
- import{b as y}from"./chunk.BRHRAVU2.js";import"./chunk.QT4XGC5Z.js";import{H as w,S as c}from"./chunk.MQ7FNHXG.js";import"./chunk.WLPTY4BF.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 +0,0 @@
1
- import{a as b,b as c,c as d,d as e,e as f}from"./chunk.XHWL7QBF.js";import"./chunk.6UCRL4OF.js";import"./chunk.6XJP7F3I.js";import"./chunk.OE4QOBJF.js";import"./chunk.74RMHUCX.js";import{rb as a}from"./chunk.WLPTY4BF.js";import"./chunk.AJZBJBMO.js";export{a as ActRefusal,e as compileDocumentWithoutCheck,d as effectsOf,f as inDocumentWords,c as kindShapes,b as readDocument};
@@ -1 +0,0 @@
1
- import"./chunk.GZHZLJBF.js";import{n as P}from"./chunk.I3SQJ2L2.js";import"./chunk.OJGHDWI6.js";import"./chunk.FUJM7GDV.js";import"./chunk.MWZK3HVG.js";import"./chunk.3D5T3XIE.js";import"./chunk.GR5Q4HTW.js";import"./chunk.QT4XGC5Z.js";import{H as A,S,aa as b}from"./chunk.MQ7FNHXG.js";import{ma as L,pc as x,ya as w}from"./chunk.WLPTY4BF.js";import{b as R}from"./chunk.AJZBJBMO.js";var u=R(A(),1);var n=R(S(),1),C={kind:"human"},p={color:"var(--graview-ink-muted)"};function I(e){if(e){if(/^https?:\/\//i.test(e))try{return new URL(e).href}catch{return}return L(e)?e:void 0}}function z(e){let o=b(),t=o?.linkedReads,[i,a]=(0,u.useState)(()=>t?t.answered(e)??"asking":null);return(0,u.useEffect)(()=>{if(!t){a(o?.linkedRecords?"asking":null);return}let d=t.answered(e);if(a(d===void 0?"asking":d),d!==void 0)return;let s=!0;return t.ask(e).then(l=>s&&a(l)),()=>{s=!1}},[t,o?.linkedRecords,e.address,e.kind,e.id]),i}function V({reference:e,as:o}){let t=b(),i=z(e),a={position:"relative",zIndex:x.raised,overflowWrap:"anywhere",minWidth:0,maxWidth:"100%"};if(i==="asking")return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"asking","aria-busy":"true",style:{...p,...a},children:"Linked record"});if(i&&"denied"in i)return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"denied",style:{...p,fontStyle:"italic",...a},children:"linked record (no access)"});if(!i)return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"missing",style:{...p,fontStyle:"italic",...a},children:"linked record (not found)"});let d=I(i.href),s=t?.linkedRecords,l=t?.principal??C,g=s?.open?c=>{c.metaKey||c.ctrlKey||(c.preventDefault(),s.open(e,l))}:void 0,k=(0,n.jsx)("a",{"data-graview-linked-title":"",...d?{href:d}:{role:"link",tabIndex:0},...g?{onClick:g,onKeyDown:c=>!d&&(c.key==="Enter"||c.key===" ")?g(c):void 0}:{},style:{fontWeight:600,color:"inherit",textUnderlineOffset:3,cursor:d||g?"pointer":"default"},children:i.label});return o==="chip"?(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"found",title:i.describe,style:{display:"inline-flex",alignItems:"center",minHeight:24,...a},children:k}):(0,n.jsx)(D,{record:i,title:k,base:a})}function D({record:e,title:o,base:t}){return(0,n.jsxs)("span",{"data-graview-linked":"","data-graview-linked-state":"found",style:{display:"grid",gap:2,padding:"8px 10px",border:"1px solid var(--graview-line)",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-surface)",...t},children:[(0,n.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"2px 8px"},children:[o,e.app?(0,n.jsxs)("span",{"data-graview-linked-app":"",style:{...p,fontSize:"0.75rem"},children:["in ",e.app]}):null]}),e.describe?(0,n.jsx)("span",{"data-graview-linked-describe":"",style:{...p,fontSize:"0.8125rem"},children:e.describe}):null,e.card&&e.card.length>0?(0,n.jsx)("span",{"data-graview-linked-card":"",style:{display:"flex",flexWrap:"wrap",gap:"2px 12px",fontSize:"0.8125rem"},children:e.card.map(i=>(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{style:p,children:i.label})," ",i.text]},i.label))}):null]})}function H({relation:e,refs:o,as:t="record",nodeId:i,field:a,style:d}){let s=(0,n.jsx)("span",{"data-graview-linked-list":"",style:{display:"grid",gap:6,minWidth:0,...d},children:o.map(l=>(0,n.jsx)(V,{reference:l,as:t},w(l)))});return i&&a?(0,n.jsx)(K,{nodeId:i,field:a,relation:e,refs:o,drawn:s}):s}function K({nodeId:e,field:o,relation:t,refs:i,drawn:a}){let{fields:d,commit:s}=P(e),l=d.find(f=>f.field===o),[g,k]=(0,u.useState)(!1);if(!l)return a;let c=t.cardinality==="one"?i[0]?w(i[0]):void 0:i.map(w);return(0,n.jsxs)("span",{style:{display:"grid",gap:6,minWidth:0},children:[a,g?(0,n.jsx)(N,{relation:t,value:c,label:"Link another record",onChange:f=>{s(l,f),k(!1)},onCancel:()=>k(!1)}):(0,n.jsx)("button",{type:"button","data-graview-linked-change":"",onClick:()=>k(!0),style:{justifySelf:"start",font:"inherit",fontSize:"0.8125rem",background:"none",border:0,padding:"4px 0",color:"var(--graview-accent)",cursor:"pointer",minHeight:24},children:"Change"})]})}function N({relation:e,value:o,onChange:t,onCancel:i,label:a}){let d=b(),s=d?.linkedRecords,l=d?.principal??C,g=(0,u.useId)(),[k,c]=(0,u.useState)(""),[f,m]=(0,u.useState)("asking");(0,u.useEffect)(()=>{if(!s)return;let r=!0;m("asking");let y=setTimeout(()=>{Promise.resolve().then(()=>s.find({address:e.address,kinds:e.kinds,query:k,limit:20},l)).then(h=>r&&m(Array.isArray(h)?h:"denied"),()=>r&&m([]))},150);return()=>{r=!1,clearTimeout(y)}},[s,e.address,e.kinds.join(","),k,l.kind,l.id]);let v=new Set([o].flat().filter(r=>typeof r=="string")),W=r=>{let y=w(r);if(e.cardinality==="one")return t(y);t(v.has(y)?[...v].filter(h=>h!==y):[...v,y])};return s?(0,n.jsxs)("span",{"data-graview-linked-picker":"",style:{display:"grid",gap:6,minWidth:0},children:[(0,n.jsx)("label",{htmlFor:g,style:{...p,fontSize:"0.8125rem"},children:a}),(0,n.jsx)("input",{id:g,type:"search",value:k,placeholder:`Find one in ${e.address}`,onChange:r=>c(r.target.value),style:{font:"inherit",minHeight:32,padding:"4px 8px",border:"1px solid var(--graview-line)",borderRadius:6,background:"var(--graview-surface)",color:"inherit",minWidth:0}}),f==="asking"?(0,n.jsx)("span",{"aria-busy":"true",style:p,children:"Looking\u2026"}):f==="denied"?(0,n.jsx)("span",{"data-graview-linked-state":"denied",style:{...p,fontStyle:"italic"},children:"linked record (no access)"}):f.length===0?(0,n.jsx)("span",{style:p,children:"Nothing there matches."}):(0,n.jsx)("ul",{role:"list",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:4},children:f.map(r=>{let y=v.has(w(r));return(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button","data-graview-linked-candidate":w(r),"aria-pressed":y,onClick:()=>W(r),style:{display:"grid",gap:2,width:"100%",textAlign:"start",font:"inherit",padding:"6px 8px",minHeight:32,border:"1px solid var(--graview-line)",borderRadius:6,background:y?"var(--graview-accent-soft, var(--graview-surface))":"var(--graview-surface)",color:"inherit",cursor:"pointer"},children:[(0,n.jsx)("span",{style:{fontWeight:600},children:r.label}),r.describe?(0,n.jsx)("span",{style:{...p,fontSize:"0.8125rem"},children:r.describe}):null]})},w(r))})}),i?(0,n.jsx)("button",{type:"button",onClick:i,style:{justifySelf:"start",font:"inherit",fontSize:"0.8125rem",background:"none",border:0,padding:"4px 0",color:"var(--graview-ink-muted)",cursor:"pointer",minHeight:24},children:"Keep it as it is"}):null]}):(0,n.jsxs)("span",{"data-graview-linked-picker":"","data-graview-linked-state":"no-host",style:p,children:["This page cannot read ",e.address,", so nothing there can be linked here."]})}var U=e=>(0,n.jsx)(H,{...e}),j=e=>(0,n.jsx)(N,{...e});export{N as LinkedPicker,H as LinkedRecordView,j as drawLinkedPicker,U as drawLinkedRecord};
@@ -1 +0,0 @@
1
- import{l as O}from"./chunk.OJGHDWI6.js";import{e as C}from"./chunk.MWZK3HVG.js";import{$ as w,H as x,S as M,aa as I,ba as W,d as V,ra as G,y as B}from"./chunk.MQ7FNHXG.js";import{B as D,Fb as F,Lb as N,lc as _,mc as L,sc as j}from"./chunk.WLPTY4BF.js";import{b as m}from"./chunk.AJZBJBMO.js";function H(t,e){let n=t.graph.getNode(e);if(!n)return[];let i=n.kind,a=t.schema.tryDefinition(i);if(!a)return[];let c=t.seenFor,u=c?j.keptFrom?.(t,c)?.(n):void 0,o=new Map;for(let r of t.allMutations()){let s=r.subject;if(!s||!(s.kinds==="*"||s.kinds.includes(i)))continue;let l=r.input.shape??{};for(let d of N(r,a)){if(u?.(d))continue;let b=d in l,k=[];for(let h of Object.keys(l)){if(h===s.arg||h===d||X(l[h]))continue;let v=F(r.input).find(S=>S.name===h);k.push({name:h,...v?{kinds:v.kinds}:{},...v?{candidates:v.kinds.includes("*")?t.graph.allNodes().map(S=>S.id):v.kinds.flatMap(S=>t.graph.nodesOfKind(S).map(J=>J.id))}:{},shape:C(r.input,h)})}let Q={field:d,mutation:r.name,title:r.title??r.name,shape:b?C(r.input,d):{type:"unknown"},takesValue:b,alternatives:[],open:k,call:h=>({name:r.name,args:b?{[s.arg]:e,[d]:h}:{[s.arg]:e}})};o.set(d,[...o.get(d)??[],Q])}}return[...o.values()].map(r=>{let s=[...r.filter(d=>d.takesValue),...r.filter(d=>!d.takesValue)],[f,...l]=s;return{...f,alternatives:l}})}function X(t){let e=D(t)?.type;return e==="optional"||e==="default"||e==="nullable"}var R=m(x(),1);function be(t){let{store:e,principal:n}=w(),i=W(),a=(0,R.useMemo)(()=>t===null?[]:H(e,t),[e,t,i]),c=(0,R.useCallback)((u,o,r={})=>{let s=u.call(o);e.apply({name:s.name,args:{...s.args,...r}},{author:n})},[e,n]);return{fields:a,commit:c}}var K=m(x(),1);function Qe(){let{brand:t}=w(),e=t?.kit;return(0,K.useMemo)(()=>_(e),[e])}function Je(t,e){let n=L(t,e),i={...n.color!==void 0?{color:n.color}:{},...n.pattern!==void 0?{pattern:n.pattern}:{},...n.width!==void 0?{width:n.width}:{},...n.cap!==void 0?{cap:n.cap}:{},...n.opacity!==void 0?{opacity:n.opacity}:{}};return{connector:n,style:O(e,{[e]:i})}}var $=m(x(),1);var g=m(M(),1);function Z(t){let e=t?.hint;return typeof e=="string"&&e.length>0?e:void 0}function ee(t){if(t instanceof Error&&t.message)return t.message;let e=String(t);return e==="[object Object]"?"The view threw without a message.":e}var U=class extends $.Component{static contextType=G;state={};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,n){console.error(`[graview] the ${this.props.view??"view"} of ${this.props.kind} threw while rendering`,e,n.componentStack),this.context?.(e,{module:"@graview/react"})}render(){let{error:e}=this.state;if(!e)return this.props.children;let n=Z(e);return(0,g.jsxs)("div",{role:"alert","data-graview-view-error":this.props.kind,style:{display:"flex",flexDirection:"column",gap:"0.375rem",padding:"var(--graview-pad, 12px)",height:"100%",overflow:"auto",boxSizing:"border-box",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)",font:"var(--graview-font-body, 13px/1.45 system-ui)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,g.jsx)("strong",{style:{color:"var(--graview-warn, #b4462a)"},children:this.props.view?`${this.props.view} could not draw`:"This view could not draw"}),(0,g.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:this.props.kind}),(0,g.jsx)("span",{children:ee(e)}),n?(0,g.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:n}):null]})}};var y=m(x(),1);var q=m(M(),1),A=(0,y.createContext)([]);function nt({sections:t,children:e}){let n=(0,y.useContext)(A),i=(0,y.useMemo)(()=>[...n,...t.filter(a=>!n.includes(a))],[n,t]);return(0,q.jsx)(A.Provider,{value:i,children:e})}function z(){let t=(0,y.useContext)(A),e=I()?.menuSections;return(0,y.useMemo)(()=>e?[...t,...e.filter(n=>!t.includes(n))]:t,[t,e])}function rt(){let t=z();return(0,y.useCallback)(e=>{for(let n of t)try{n(e)?.prepare?.()}catch{}},[t])}function ot(t){let e=z();if(t===null||e.length===0)return{start:[],end:[]};let n=e.flatMap(i=>{try{let a=i(t);return a&&((a.items?.length??0)>0||a.render)?[a]:[]}catch{return[]}});return{start:n.filter(i=>i.at==="start"),end:n.filter(i=>i.at!=="start")}}var te=m(x(),1);function st(){return w().activity}var P=(t,e)=>t.length*e*.58;var ne=156,re=2,E=ne-18,oe=7.1,ie=16;function ae(t,e){let n=0,i=E;for(let a of t.split(" ")){let c=e(a),u=i+e(" ")+c;if(u<=E)i=u;else{let o=Math.ceil(c/E)||1;n+=o,i=c-(o-1)*E}}return n}var se=16.25,Y=27,ce=(t,e)=>{let n=Math.ceil(t.length*oe/E);return e?Math.max(Y,Math.ceil(Math.max(n,ae(t,e))*se)+6):Math.max(Y,n*ie+6)};function ut(t,e,n){return t.length===0?0:10+t.reduce((i,a)=>i+ce(a,n),0)+(t.length-1)*re}var de=27,ue=8,lt=4,le=64,pt=t=>Math.max(1,Math.min(ue,t)),ft=t=>t*de+le;var p=m(x(),1);function gt(t,{units:e,target:n=0,legibleAt:i=260}){let[a,c]=(0,p.useState)(e);(0,p.useEffect)(()=>{let o=t.current;if(o===null||typeof ResizeObserver>"u")return;let r=new ResizeObserver(([s])=>{let f=s?.contentRect.width??0;f>0&&c(f)});return r.observe(o),()=>r.disconnect()},[t]);let u=a/e;return{scale:u,width:a,touchable:u*n>=24,legible:a>=i}}function xt(t="--graview-font-body",e="sans-serif"){let n=(0,p.useRef)(void 0),i=(0,p.useMemo)(()=>{if(typeof getComputedStyle!="function"||typeof document>"u")return e;let a=getComputedStyle(document.documentElement).getPropertyValue(t).trim();return a.length>0?a:e},[t,e]);return(0,p.useMemo)(()=>{n.current===void 0&&(n.current=typeof document>"u"?null:document.createElement("canvas").getContext("2d")??null);let a=n.current;return a===null?P:(c,u)=>{a.font=`${u}px ${i}`;let o=a.measureText(c).width;return o>0?o:P(c,u)}},[i])}var wt=(0,p.createContext)(void 0);var T=3;function pe(t){let e=V(t),n=e.focusId;if(!n)return null;if(e.within?.view){let[a]=B(n);if(a)return{at:`screen:${a}`,audience:!0}}return{at:n,audience:!1}}var fe=102,me=32;function St(t,e,n){let i=[],a=new Map,c=new Map,u=0;for(let o of t){let r=pe(o.stop),s=r?e(r.at):null;if(!r||!s){o.name&&i.push({kind:"edge",presence:o,point:{x:n-8,y:fe+u++*me}});continue}if(!o.name){let k=c.get(r.at);c.set(r.at,{n:(k?.n??0)+1,box:s});continue}let f=a.get(r.at)??[];if(f.push(o),a.set(r.at,f),f.length>T)continue;let l=s,d=f.length-1,b=r.audience?{x:l.x+l.width*.5+(d-1)*26,y:l.y+Math.min(l.height,24)}:{x:l.x+l.width*.5-26-d*26,y:l.y+l.height-4};i.push({kind:"person",presence:o,point:b,at:r.at,index:d,of:f.length,audience:r.audience})}for(let[o,r]of a){if(r.length<=T)continue;let s=e(o);s&&i.push({kind:"count",at:o,point:{x:s.x+s.width*.5+2*26+18,y:s.y+s.height-4},n:r.length-T})}for(let[o,{n:r,box:s}]of c)i.push({kind:"count",at:o,point:{x:s.x+s.width*.5+40,y:s.y+s.height-4},n:r});for(let o of t)if(o.name){if(o.robot?.at&&o.robot.mode!=="docked"){let r=e(o.robot.at);r&&i.push({kind:"robot",presence:o,point:{x:r.x+r.width/2+22,y:r.y+r.height-4},mode:o.robot.mode})}if(o.over){let r=e(o.over);r&&i.push({kind:"over",presence:o,box:r})}}return i}export{st as a,P as b,ne as c,re as d,Y as e,ut as f,de as g,lt as h,le as i,pt as j,ft as k,gt as l,xt as m,be as n,Qe as o,Je as p,St as q,U as r,nt as s,rt as t,ot as u};
@@ -1 +0,0 @@
1
- import{q as ce}from"./chunk.2VIGF4FO.js";import{a as Z,b as C,c as ee,d as te,g as oe,j as re,k as P,l as se,p as le,s as de}from"./chunk.BUVAMSOZ.js";import{a as ie,b as ne,c as ae}from"./chunk.FTJBW25J.js";import"./chunk.UT6642FC.js";import"./chunk.MCVY6RRS.js";import"./chunk.RZVZG2BQ.js";import{a as X}from"./chunk.VKHKYK5L.js";import"./chunk.TI4OSTQV.js";import"./chunk.EUGWV3S6.js";import"./chunk.MWZK3HVG.js";import"./chunk.3D5T3XIE.js";import"./chunk.GR5Q4HTW.js";import{e as _,m as J}from"./chunk.QT4XGC5Z.js";import{$ as j,H as me,K as U,S as V}from"./chunk.MQ7FNHXG.js";import{fa as B,qc as Y}from"./chunk.WLPTY4BF.js";import{b as O}from"./chunk.AJZBJBMO.js";var a=O(me(),1);var d=O(V(),1),ke=new Set(["show","go","to","open","the","a","an","me"]),ge=s=>s.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,""),W=(s,p)=>{let r=ge(s);return p.every(t=>r.includes(t))},pe=s=>s&&`${s[0].toLowerCase()}${s.slice(1)}`,I={act:4,show:3,place:3,record:4},we=360,h=12;function Oe({face:s,opening:p,close:r}){let t=X(),{setMenuAt:v}=j(),n=(0,a.useMemo)(()=>p.target??Z(p.pointed??{about:[]},e=>t.store.graph.has(e)),[p,t.store]),f=(0,a.useMemo)(()=>oe(t.store,n,t.places),[t.store,n,t.places]),[u,y]=(0,a.useState)(""),[b,m]=(0,a.useState)(-1),[l,$]=(0,a.useState)(null),[A,L]=(0,a.useState)(null),E=(0,a.useRef)(null),z=(0,a.useRef)(null),T=(0,a.useId)(),R=(0,a.useRef)(!0),{ghost:G}=U(t.desk);(0,a.useEffect)(()=>()=>{R.current=!1;let e=t.desk.get().ghost;e?.onCard&&t.desk.setGhost({...e,onCard:!1})},[t.desk]);let M=(0,a.useMemo)(()=>{let e=P(t,n);return ee(t.store,n,{principal:t.principal,places:t.places,...e.acts?{acts:e.acts}:{}})},[t,n]),K=(0,a.useMemo)(()=>{let e=C(n);if(e.length===0)return[];let i=new Set(M.candidates.flatMap(c=>c.type==="act"?[c.mutation]:[]));return ie(t.store,e,{principal:t.principal,...e.length===1?{focus:e[0]}:{}}).affordances.filter(c=>!c.destructive&&i.has(c.mutation))},[t.store,t.principal,n,M]),q=(0,a.useCallback)(()=>{let e=p.returnTo,i=ue(E.current,n,s);r(),requestAnimationFrame(()=>{if(e?.isConnected&&!e.closest("[inert]"))return e.focus({preventScroll:!0});let c=(i&&i.tabIndex>=0?i:null)??document.querySelector("[data-graview-page-title]")??document.querySelector("main");c&&c.tabIndex<0&&!c.hasAttribute("tabindex")&&c.setAttribute("tabindex","-1"),c?.focus({preventScroll:!0})})},[p.returnTo,n,s,r]),F=(0,a.useCallback)(e=>{if(e.open.length>0){let i=E.current?.getBoundingClientRect();r(),v({x:i?.left??0,y:i?.top??0,on:e.args.id??C(n)[0],about:C(n)});return}try{ae(t.store,e,{}),ne(t.store,e,{},{author:t.principal}),q()}catch(i){L(i instanceof Error?i.message:String(i))}},[t.store,t.principal,r,q,v,n]),H=(0,a.useCallback)(async e=>{let i=e.trim();if(!i)return;let c=l?.result?.answer?{said:l.said,answer:l.result.answer}:void 0;y(""),m(-1),L(null),$({said:i,result:null});let S=await re(t.ai,{...P(t,n,i),said:i,...c?{follows:c}:{}});t.desk.record(S.interaction),S.ghost&&S.ghost.proposals.length>0&&t.desk.setGhost({ghost:S.ghost,onCard:!0}),R.current&&$({said:i,result:S})},[l,t,n]),N=(0,a.useRef)(p.asked);(0,a.useEffect)(()=>{let e=N.current;N.current=void 0,e&&H(e)},[]);let k=(0,a.useMemo)(()=>{let e=u.trim();if(!e&&l)return[];let i=ge(e).split(/\s+/).filter(o=>o&&!ke.has(o)),c=/^show\b/i.test(e),S=/^(go|open)\b/i.test(e),x=[];if(!c&&!S)for(let o of K.filter(g=>W(g.label,i)).slice(0,I.act))x.push({id:`act:${o.id}`,kind:"act",label:o.label,hint:o.open.length>0?"asks more":"do it",take:()=>F(o)});let Q=e&&!/\?\s*$/.test(e)?te(t.store,n,{principal:t.principal,places:t.places,said:e}):[];for(let o of Q)x.push({id:`place:${o.place}`,kind:"place",label:o.fit==="full"?`Open ${o.title}`:`Open and adjust ${o.title}`,hint:o.fit==="full"?"a view you have":"adjust it",take:()=>{r(),t.goTo.place(o.place),o.fit==="partial"&&_(t.desk,{target:{on:"lens",place:o.place,...o.kind?{kind:o.kind}:{}},asked:e})}});if(!S){let o=M.candidates.filter(g=>g.type==="panel");for(let g of o.filter(D=>W(`show ${D.label}`,i)).slice(0,I.show))x.push({id:g.id,kind:"show",label:`Show ${pe(g.label)}`,hint:"a panel",take:()=>{r(),se(t,{title:g.label,recipe:{...g.panel,title:g.label}})}})}if(!c){for(let o of t.places.filter(g=>W(g.title,i)&&!Q.some(D=>D.place===g.as)).slice(0,I.place))x.push({id:`place:${o.as}`,kind:"place",label:`Go to ${o.title}`,take:()=>(r(),t.goTo.place(o.as))});if(i.length>0){let o=ce(t.store,e.replace(/^(go to|open)\s+/i,""),{principal:t.principal,from:C(n),limit:I.record}).hits;for(let g of o)g.about==="node"&&x.push({id:`record:${g.id}`,kind:"record",label:g.label,hint:B(t.store.schema,g.kind),take:()=>(r(),t.goTo.record(g.id))})}}return e&&x.push({id:"ask",kind:"ask",label:e,take:()=>void H(e)}),x},[u,K,M,t,n,F,H,r,l]);(0,a.useEffect)(()=>m(u.trim()?0:-1),[u]),(0,a.useLayoutEffect)(()=>{let e=E.current;if(!e)return;if(typeof e.showPopover=="function")try{e.showPopover()}catch{}z.current?.focus({preventScroll:!0});let i=0,c=()=>{be(e,ue(e,n,s)),i=requestAnimationFrame(c)};return c(),()=>cancelAnimationFrame(i)},[n,s]),(0,a.useEffect)(()=>{if(l)return;let e=i=>{i.target instanceof Node&&E.current?.contains(i.target)||r()};return document.addEventListener("pointerdown",e,!0),()=>document.removeEventListener("pointerdown",e,!0)},[l,r]);let fe=e=>{if(e.key==="ArrowDown"&&k.length>0)e.preventDefault(),m(i=>Math.min(k.length-1,i+1));else if(e.key==="ArrowUp"&&k.length>0)e.preventDefault(),m(i=>Math.max(0,i-1));else if(e.key==="Enter"){e.preventDefault();let i=k[b];i?i.take():u.trim()&&H(u)}},w=l?.result??null,he=k[b];return(0,d.jsxs)("section",{ref:E,popover:"manual",role:"region","aria-label":l?`Answer about ${f}`:`Ask about ${f}`,"data-testid":"quick-ask","data-quick-ask":l?"answer":"bar","data-quick-ask-face":s,"data-graview-offstage":"","data-graview-overlay":"",onKeyDown:e=>{e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),q())},onMouseDown:e=>e.stopPropagation(),style:ve,children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[(0,d.jsxs)("p",{"data-testid":"quick-ask-about",style:{margin:0,flex:"1 1 auto",minWidth:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)",overflowWrap:"anywhere"},children:["About ",f]}),(0,d.jsx)("button",{type:"button","data-testid":"quick-ask-close","aria-label":"Close",title:"Close",onClick:q,style:ye,children:(0,d.jsx)("span",{"aria-hidden":"true",children:"\u2715"})})]}),l?(0,d.jsxs)("div",{"data-testid":"quick-answer",style:{display:"grid",gap:8},children:[(0,d.jsxs)("p",{"data-testid":"quick-answer-asked",style:{margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",fontStyle:"italic",overflowWrap:"anywhere"},children:["\u201C",l.said,"\u201D"]}),(0,d.jsx)("p",{"data-testid":"quick-answer-text","aria-live":"polite",style:{margin:0,fontSize:"0.9375rem",lineHeight:1.45,color:w?.interaction.outcome==="failed"?"var(--graview-warn)":"var(--graview-ink)",overflowWrap:"anywhere"},children:w===null?"Thinking\u2026":w.interaction.outcome==="failed"?w.interaction.failed??"The AI could not answer that here.":w.answer??""}),w&&w.offers.length>0?(0,d.jsx)("ul",{"aria-label":"What acts on it",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:6},children:w.offers.map(e=>(0,d.jsx)("li",{children:(0,d.jsx)("button",{type:"button","data-testid":"quick-answer-offer","data-ai-offer":e.id,"data-ai-offer-type":e.type,onClick:()=>{le(t,w,e,r).then(i=>{i&&R.current&&L(i)})},style:xe,children:e.type==="panel"?`Show ${pe(e.label)}`:e.type==="place"?`Go to ${e.label}`:e.label})},e.id))}):null,G?.onCard&&G.ghost.interaction===w?.interaction.id?(0,d.jsx)(de,{placement:"card"}):null]}):null,(0,d.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,d.jsx)("input",{ref:z,type:"text",role:"combobox","data-testid":"quick-ask-input","aria-label":l?`Ask a follow-up about ${f}`:`Ask about ${f}, or go somewhere`,"aria-expanded":k.length>0,"aria-controls":T,"aria-autocomplete":"list",...he?{"aria-activedescendant":`${T}-${b}`}:{},autoComplete:"off",enterKeyHint:"go",placeholder:l?"Ask a follow-up\u2026":"Ask, or go to\u2026",value:u,readOnly:l!==null&&w===null,"aria-busy":l!==null&&w===null,onChange:e=>y(e.target.value),onKeyDown:fe,style:Ae}),(0,d.jsx)("div",{id:T,role:"listbox","aria-label":u.trim()?`What \u201C${u.trim()}\u201D finds here`:"What can be done here",hidden:k.length===0,style:{display:k.length===0?"none":"grid",gap:1,maxHeight:280,overflowY:"auto"},children:k.map((e,i)=>(0,d.jsx)("div",{id:`${T}-${i}`,role:"option","aria-selected":i===b,"data-testid":"quick-ask-option","data-quick-ask-kind":e.kind,"data-quick-ask-row":e.id,onMouseEnter:()=>m(i),onMouseDown:c=>c.preventDefault(),onClick:e.take,style:{...Se,background:i===b?"var(--graview-panel-muted)":"transparent",...e.kind==="ask"?{borderTop:"1px solid var(--graview-edge)",marginTop:2}:{}},children:e.kind==="ask"?(0,d.jsxs)("span",{children:["Ask: ",(0,d.jsxs)("span",{style:{fontWeight:600},children:["\u2018",e.label,"\u2019"]})]}):(0,d.jsxs)("span",{children:[e.label,e.hint?(0,d.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",e.hint]}):null]})},e.id))})]}),A?(0,d.jsx)("p",{role:"alert","data-testid":"quick-ask-refused",style:{margin:0,fontSize:"0.8125rem",color:"var(--graview-warn)"},children:A}):null,(0,d.jsx)("span",{style:J,"aria-live":"polite",children:k.length>0&&u.trim()?`${k.length} ${k.length===1?"way":"ways"} to go on`:""})]})}function ue(s,p,r){let t=s?.closest("[data-graview-embed]")??document,v=p.on==="list"?[`aggregate:${p.kind}`,`kind:${p.kind}`]:p.on==="lens"&&p.kind?[`aggregate:${p.kind}`]:C(p);for(let n of v)for(let f of t.querySelectorAll(`[data-graview-view="${CSS.escape(n)}"], [data-graview-pick="${CSS.escape(n)}"]`)){if(s?.contains(f))continue;let u=f.getBoundingClientRect();if(u.width>0&&u.height>0)return f}return r==="pages"?t.querySelector("main [data-graview-page-title]")??t.querySelector("main h1"):null}function be(s,p){let r={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},t=Math.min(we,r.width-2*h),v=s.getBoundingClientRect().height,n=p?.getBoundingClientRect(),f,u,y,b=A=>Math.max(h,Math.min(A,r.height-v-h));if(n&&n.width>0&&n.bottom>0&&n.top<r.height)if(n.right+h+t<=r.width-h)f=n.right+h,u=b(n.top),y="right";else if(n.left-h-t>=h)f=n.left-h-t,u=b(n.top),y="left";else{f=Math.max(h,Math.min(n.left,r.width-t-h));let A=n.bottom+h;u=A+v<=r.height-h?A:b(n.top-h-v),y=A+v<=r.height-h?"below":"above"}else f=(r.width-t)/2,u=b(72),y="top";let m=s.style,l={left:`${Math.round(f)}px`,top:`${Math.round(u)}px`,width:`${Math.round(t)}px`};m.left!==l.left&&(m.left=l.left),m.top!==l.top&&(m.top=l.top),m.width!==l.width&&(m.width=l.width);let $=p?.getAttribute("data-graview-view")??p?.getAttribute("data-graview-pick")??(p?"page":"");s.getAttribute("data-quick-ask-beside")!==$&&s.setAttribute("data-quick-ask-beside",$),s.getAttribute("data-quick-ask-side")!==y&&s.setAttribute("data-quick-ask-side",y)}var ve={position:"fixed",inset:"auto",margin:0,zIndex:Y("popover"),boxSizing:"border-box",display:"grid",gap:10,padding:12,borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",maxHeight:"calc(100dvh - 24px)",overflowY:"auto",fontSize:"0.875rem"},ye={display:"inline-grid",placeItems:"center",width:28,height:28,padding:0,font:"inherit",fontSize:"0.875rem",lineHeight:1,color:"var(--graview-ink-muted)",background:"transparent",border:"1px solid transparent",borderRadius:6,boxShadow:"none",cursor:"pointer"},Ae={boxSizing:"border-box",width:"100%",height:36,padding:"0 10px",font:"inherit",fontSize:"max(1rem,16px)",color:"var(--graview-ink)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:8},Se={display:"flex",alignItems:"center",minHeight:30,padding:"4px 8px",borderRadius:6,cursor:"pointer",overflowWrap:"anywhere"},xe={display:"inline-flex",alignItems:"center",minHeight:30,padding:"2px 10px",font:"inherit",fontSize:"0.8125rem",borderRadius:8};export{Oe as QuickAskCard};