graview 0.1.63 → 0.1.64

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 (179) hide show
  1. package/dist/preview/chunk.2D7K2IJQ.js +4 -0
  2. package/dist/preview/{chunk.GHN62OMG.js → chunk.2DH42I7L.js} +1 -1
  3. package/dist/preview/chunk.2E62YCMZ.js +1 -0
  4. package/dist/preview/{chunk.DIFIHNR3.js → chunk.2G5WLG3Z.js} +1 -1
  5. package/dist/preview/chunk.2HV5FF6O.js +1 -0
  6. package/dist/preview/{chunk.6Z2GHQQH.js → chunk.2JDAUKSN.js} +3 -3
  7. package/dist/preview/{chunk.DZSZUX34.js → chunk.2JEN2RCB.js} +1 -1
  8. package/dist/preview/{chunk.NEPQBMFT.js → chunk.2TCOLAL2.js} +1 -1
  9. package/dist/preview/{chunk.VZDHRY3U.js → chunk.2V7QTIAV.js} +1 -1
  10. package/dist/preview/{chunk.T3JIZNE7.js → chunk.2VIS2NAT.js} +1 -1
  11. package/dist/preview/{chunk.2PJ6STKA.js → chunk.2VYGDY5Z.js} +1 -1
  12. package/dist/preview/{chunk.5QXQ7PBI.js → chunk.37I45R6V.js} +1 -1
  13. package/dist/preview/chunk.3FKKH2XU.js +74 -0
  14. package/dist/preview/chunk.3J7XLJP2.js +1 -0
  15. package/dist/preview/chunk.3OEODIHB.js +1 -0
  16. package/dist/preview/{chunk.R4HDKNT3.js → chunk.3RD4JHVG.js} +1 -1
  17. package/dist/preview/{chunk.XCEZCOX4.js → chunk.3RUV4HE4.js} +1 -1
  18. package/dist/preview/{chunk.WUVXIUA7.js → chunk.3SAESG6X.js} +1 -1
  19. package/dist/preview/{chunk.OIMGD7FR.js → chunk.47N2G7A5.js} +1 -1
  20. package/dist/preview/{chunk.B5PJCYBU.js → chunk.4DZOAB4D.js} +1 -1
  21. package/dist/preview/chunk.4HTB6TX2.js +1 -0
  22. package/dist/preview/{chunk.EJ2WE764.js → chunk.4Q5PCMGZ.js} +4 -4
  23. package/dist/preview/{chunk.2F4AZZQR.js → chunk.4U45EY5M.js} +1 -1
  24. package/dist/preview/{chunk.PDMX3GTL.js → chunk.4VRX7FCO.js} +1 -1
  25. package/dist/preview/{chunk.HRNNRA2I.js → chunk.4XCYZRZ3.js} +1 -1
  26. package/dist/preview/chunk.52MBXPEK.js +1 -0
  27. package/dist/preview/{chunk.D5LOTCBU.js → chunk.5AD2QHWH.js} +1 -1
  28. package/dist/preview/{chunk.36OE6RKG.js → chunk.5B7NG6WH.js} +1 -1
  29. package/dist/preview/chunk.5HJ2GTKZ.js +1 -0
  30. package/dist/preview/{chunk.2KIWGQXC.js → chunk.5IEZF433.js} +1 -1
  31. package/dist/preview/{chunk.UAVK54Z6.js → chunk.5PPCK7QT.js} +1 -1
  32. package/dist/preview/{chunk.SSAETRHR.js → chunk.6NRWLCIZ.js} +2 -2
  33. package/dist/preview/{chunk.REUMBCSV.js → chunk.75JQCTR6.js} +1 -1
  34. package/dist/preview/{chunk.A2R53GWF.js → chunk.77JI5T4F.js} +1 -1
  35. package/dist/preview/{chunk.BQM3YAMR.js → chunk.77MLXWZV.js} +1 -1
  36. package/dist/preview/{chunk.33XNYHI6.js → chunk.7AOEZJRM.js} +1 -1
  37. package/dist/preview/{chunk.4EXC26LI.js → chunk.7CLKGKSF.js} +1 -1
  38. package/dist/preview/{chunk.NTC2H5ZX.js → chunk.7SRSE5IS.js} +1 -1
  39. package/dist/preview/{chunk.SMHP2CQH.js → chunk.7VAHHEDX.js} +1 -1
  40. package/dist/preview/{chunk.4MEQUUG4.js → chunk.7ZG77OI3.js} +1 -1
  41. package/dist/preview/chunk.7ZHH7WBN.js +1 -0
  42. package/dist/preview/{chunk.ZY7US4Y7.js → chunk.AJEK3I5X.js} +1 -1
  43. package/dist/preview/{chunk.T535ZLRM.js → chunk.APRWUIE3.js} +1 -1
  44. package/dist/preview/{chunk.KXFNRJ46.js → chunk.APUQIELA.js} +1 -1
  45. package/dist/preview/{chunk.OXWOUE3W.js → chunk.ATHLE33D.js} +1 -1
  46. package/dist/preview/chunk.B2YTHEX5.js +1 -0
  47. package/dist/preview/{chunk.KB5BCW23.js → chunk.B6JR7EQO.js} +1 -1
  48. package/dist/preview/{chunk.H5SN46VK.js → chunk.BN42H3C6.js} +1 -1
  49. package/dist/preview/{chunk.OM2NIQWA.js → chunk.BVIJXL4J.js} +1 -1
  50. package/dist/preview/{chunk.N3T2O6EW.js → chunk.CC7P435K.js} +2 -2
  51. package/dist/preview/{chunk.XBYJCGPU.js → chunk.CJHYGRWV.js} +1 -1
  52. package/dist/preview/chunk.CM65MCHA.js +1 -0
  53. package/dist/preview/{chunk.STDJ6XG5.js → chunk.D2XLECMP.js} +1 -1
  54. package/dist/preview/{chunk.72YXFJKC.js → chunk.DJIF7IAQ.js} +1 -1
  55. package/dist/preview/{chunk.CGK2PY76.js → chunk.DLWFULWE.js} +1 -1
  56. package/dist/preview/{chunk.MT5DXJKN.js → chunk.DMENNIHT.js} +1 -1
  57. package/dist/preview/{chunk.Q4GJIJAU.js → chunk.DN7UCBOA.js} +1 -1
  58. package/dist/preview/{chunk.EJ4MSVX2.js → chunk.DQAMVVE6.js} +1 -1
  59. package/dist/preview/{chunk.75GENXGP.js → chunk.DUP2CGVH.js} +1 -1
  60. package/dist/preview/{chunk.6XHPBJ5F.js → chunk.DYRULRFX.js} +1 -1
  61. package/dist/preview/{chunk.MY5HJW2Z.js → chunk.E4TXLT25.js} +1 -1
  62. package/dist/preview/{chunk.BN7C5ZYX.js → chunk.F6BNFLQM.js} +1 -1
  63. package/dist/preview/chunk.FN34P4IS.js +1 -0
  64. package/dist/preview/{chunk.MBB5A6BT.js → chunk.FUPYIOXZ.js} +1 -1
  65. package/dist/preview/{chunk.HSMJHCR3.js → chunk.FXRYMT3U.js} +1 -1
  66. package/dist/preview/{chunk.CI4RZL4Z.js → chunk.G5BVZLCM.js} +1 -1
  67. package/dist/preview/{chunk.4TH3CGAZ.js → chunk.G7YLK4PX.js} +1 -1
  68. package/dist/preview/chunk.GF62K25C.js +1 -0
  69. package/dist/preview/chunk.GFQPO3NC.js +1 -0
  70. package/dist/preview/{chunk.YOUB3J3Y.js → chunk.GH5UBSQI.js} +1 -1
  71. package/dist/preview/{chunk.DBFJVVWF.js → chunk.GHHKRFPD.js} +1 -1
  72. package/dist/preview/{chunk.24HNOLUS.js → chunk.GP5DAA4P.js} +1 -1
  73. package/dist/preview/{chunk.DWK3GXRR.js → chunk.HPG6CNKM.js} +1 -1
  74. package/dist/preview/chunk.HSJEOM3W.js +1 -0
  75. package/dist/preview/{chunk.JVDPRQ7J.js → chunk.HZPRMHSL.js} +1 -1
  76. package/dist/preview/{chunk.Q4MI53KK.js → chunk.IQGSEAQ2.js} +5 -5
  77. package/dist/preview/{chunk.JIEDJEHK.js → chunk.ITBG37WJ.js} +1 -1
  78. package/dist/preview/{chunk.HOFATBGD.js → chunk.JHUCKEJS.js} +1 -1
  79. package/dist/preview/{chunk.Y4ZM75WL.js → chunk.JOM6MFVE.js} +1 -1
  80. package/dist/preview/{chunk.ZSGDVNVN.js → chunk.JS2UZYGB.js} +1 -1
  81. package/dist/preview/{chunk.DDFRFSVN.js → chunk.K2PXP5H6.js} +1 -1
  82. package/dist/preview/{chunk.KL5H7KEV.js → chunk.K54ISAXN.js} +1 -1
  83. package/dist/preview/{chunk.YXAKHXYB.js → chunk.K5YFUMRS.js} +1 -1
  84. package/dist/preview/chunk.KHXRJLLU.js +50 -0
  85. package/dist/preview/{chunk.E3XJMO7Q.js → chunk.KMIFSPGQ.js} +1 -1
  86. package/dist/preview/chunk.L4V5VLSM.js +1 -0
  87. package/dist/preview/{chunk.VCTAFSZ5.js → chunk.LDMBJC3B.js} +1 -1
  88. package/dist/preview/{chunk.MIE3ODQ2.js → chunk.LTOQ22ZJ.js} +1 -1
  89. package/dist/preview/{chunk.CCQMDZHO.js → chunk.M5VHUIDB.js} +1 -1
  90. package/dist/preview/chunk.N643PVQA.js +1 -0
  91. package/dist/preview/{chunk.XUO67YMT.js → chunk.NGRL3QOI.js} +1 -1
  92. package/dist/preview/{chunk.ZELWW7UA.js → chunk.NRPBTV6O.js} +2 -2
  93. package/dist/preview/{chunk.ZLTHWCKL.js → chunk.O7HHNQK4.js} +2 -2
  94. package/dist/preview/{chunk.SGPXYDSG.js → chunk.OW3M4OBN.js} +1 -1
  95. package/dist/preview/{chunk.KQPKYWDM.js → chunk.OXFDB5BB.js} +1 -1
  96. package/dist/preview/{chunk.ZZAI57VI.js → chunk.P4TAX3HE.js} +1 -1
  97. package/dist/preview/{chunk.XUXZW7DU.js → chunk.P6FNJR6E.js} +1 -1
  98. package/dist/preview/{chunk.25CQCCLN.js → chunk.PR74PGLC.js} +1 -1
  99. package/dist/preview/{chunk.AW26EETU.js → chunk.PVDDSBRG.js} +1 -1
  100. package/dist/preview/{chunk.SME4HD5I.js → chunk.QROPDEJF.js} +1 -1
  101. package/dist/preview/{chunk.AWUO3M5D.js → chunk.QRT6BZR6.js} +1 -1
  102. package/dist/preview/{chunk.AHPYNDVA.js → chunk.R5MLRKAO.js} +1 -1
  103. package/dist/preview/{chunk.NWWJNNEK.js → chunk.RDA35HZB.js} +1 -1
  104. package/dist/preview/{chunk.FXCQJPN4.js → chunk.REXU6ARY.js} +1 -1
  105. package/dist/preview/{chunk.OMRQTLI5.js → chunk.S6QZBWCJ.js} +1 -1
  106. package/dist/preview/{chunk.RUFYORIJ.js → chunk.S7SHWDPR.js} +1 -1
  107. package/dist/preview/{chunk.QAMW5QDT.js → chunk.SADHOSRC.js} +1 -1
  108. package/dist/preview/chunk.SJHUC4TL.js +1 -0
  109. package/dist/preview/chunk.SL5FXE3R.js +1 -0
  110. package/dist/preview/{chunk.WBS7ND2C.js → chunk.T4JP6BGP.js} +1 -1
  111. package/dist/preview/{chunk.34DRUCH2.js → chunk.T4TRJDBF.js} +1 -1
  112. package/dist/preview/{chunk.QS32TO4N.js → chunk.TA2JTUNX.js} +1 -1
  113. package/dist/preview/{chunk.PWAP2GJS.js → chunk.TMHVYI5R.js} +1 -1
  114. package/dist/preview/chunk.TOLW64EO.js +1 -0
  115. package/dist/preview/chunk.TP3PZRHE.js +1 -0
  116. package/dist/preview/{chunk.57YDGGJK.js → chunk.TQ2G4AM4.js} +1 -1
  117. package/dist/preview/{chunk.O3YIWIVQ.js → chunk.TUR2DA2M.js} +1 -1
  118. package/dist/preview/{chunk.CAXILB7K.js → chunk.TYIBLD2D.js} +1 -1
  119. package/dist/preview/{chunk.FFXBDOKA.js → chunk.UD2GGG7L.js} +1 -1
  120. package/dist/preview/{chunk.Q2EGESEZ.js → chunk.UDU545CL.js} +1 -1
  121. package/dist/preview/{chunk.IEDCFSN5.js → chunk.UDYFGYJP.js} +1 -1
  122. package/dist/preview/{chunk.K7TK3KRB.js → chunk.UJNLT3L6.js} +1 -1
  123. package/dist/preview/chunk.UN2IAA5R.js +1 -0
  124. package/dist/preview/chunk.VLX7YWVH.js +25 -0
  125. package/dist/preview/{chunk.735AFUP5.js → chunk.VT4YBFZL.js} +1 -1
  126. package/dist/preview/{chunk.2RASWDMQ.js → chunk.VZAF3452.js} +2 -2
  127. package/dist/preview/{chunk.OTSBF367.js → chunk.WFCE7NLK.js} +2 -2
  128. package/dist/preview/{chunk.XCWZFLIB.js → chunk.WHX47OJM.js} +1 -1
  129. package/dist/preview/{chunk.ZRH5X3MR.js → chunk.WMARJ5E3.js} +1 -1
  130. package/dist/preview/chunk.WPQP54FM.js +1 -0
  131. package/dist/preview/{chunk.HMMK7LCL.js → chunk.WX23K7ZU.js} +1 -1
  132. package/dist/preview/{chunk.H7AH3IW4.js → chunk.X36BYTEG.js} +1 -1
  133. package/dist/preview/{chunk.B46UZHGW.js → chunk.XCLW4GP7.js} +1 -1
  134. package/dist/preview/{chunk.JO3BBRSR.js → chunk.XEG7ZDRG.js} +1 -1
  135. package/dist/preview/{chunk.KPQLM4TM.js → chunk.XIVELWAM.js} +1 -1
  136. package/dist/preview/{chunk.PDS4HT46.js → chunk.XJWKIXPV.js} +1 -1
  137. package/dist/preview/{chunk.5GC4VAHU.js → chunk.XQ5RTPEF.js} +1 -1
  138. package/dist/preview/{chunk.NIAM7OTV.js → chunk.YEXFVDRA.js} +1 -1
  139. package/dist/preview/{chunk.FGDGTES4.js → chunk.YIZPW7IK.js} +2 -2
  140. package/dist/preview/chunk.YLOGIJOH.js +1 -0
  141. package/dist/preview/chunk.YMXWS4XN.js +3 -0
  142. package/dist/preview/{chunk.WYPCLZL7.js → chunk.YSBTE3PX.js} +1 -1
  143. package/dist/preview/{chunk.V4HVFLFQ.js → chunk.Z26T5E76.js} +1 -1
  144. package/dist/preview/{chunk.37FLKAVZ.js → chunk.Z4XGEV34.js} +1 -1
  145. package/dist/preview/{chunk.XYGNS637.js → chunk.ZA5TDCBC.js} +1 -1
  146. package/dist/preview/{chunk.3OQ6S6H4.js → chunk.ZNDVJGTY.js} +1 -1
  147. package/dist/preview/{chunk.YZBJUAS6.js → chunk.ZQGLPP7A.js} +1 -1
  148. package/dist/preview/index.html +53 -53
  149. package/dist/preview/page.js +2 -2
  150. package/dist/preview/splash.js +3 -3
  151. package/package.json +6 -6
  152. package/dist/preview/chunk.26H33GJC.js +0 -50
  153. package/dist/preview/chunk.3JCHJLH6.js +0 -1
  154. package/dist/preview/chunk.47QEWSSE.js +0 -1
  155. package/dist/preview/chunk.4DAKQXDG.js +0 -1
  156. package/dist/preview/chunk.6CSHRMJC.js +0 -1
  157. package/dist/preview/chunk.6HKWAHPT.js +0 -1
  158. package/dist/preview/chunk.6YK5E7ZQ.js +0 -4
  159. package/dist/preview/chunk.ATDIDPKZ.js +0 -1
  160. package/dist/preview/chunk.BF3EZCG3.js +0 -1
  161. package/dist/preview/chunk.BKQICGFW.js +0 -1
  162. package/dist/preview/chunk.C65EHQ7V.js +0 -1
  163. package/dist/preview/chunk.CYTTZOYL.js +0 -25
  164. package/dist/preview/chunk.ERPILTRY.js +0 -1
  165. package/dist/preview/chunk.FNVGNISQ.js +0 -3
  166. package/dist/preview/chunk.G2JAYG2Z.js +0 -1
  167. package/dist/preview/chunk.JNIDS66Z.js +0 -1
  168. package/dist/preview/chunk.KZUMXT5J.js +0 -74
  169. package/dist/preview/chunk.MAHNJO6U.js +0 -1
  170. package/dist/preview/chunk.MENLUNM5.js +0 -1
  171. package/dist/preview/chunk.O67JXUVG.js +0 -1
  172. package/dist/preview/chunk.QSPLKCTX.js +0 -1
  173. package/dist/preview/chunk.SJUXFPTI.js +0 -1
  174. package/dist/preview/chunk.V6IL7CIZ.js +0 -1
  175. package/dist/preview/chunk.WNS5LEO5.js +0 -1
  176. package/dist/preview/chunk.XIW4SZHD.js +0 -1
  177. package/dist/preview/chunk.Z2ZQJ3DD.js +0 -1
  178. package/dist/preview/chunk.ZP7JEVVU.js +0 -1
  179. package/dist/preview/chunk.ZVG4FXJK.js +0 -1
@@ -1 +1 @@
1
- import{a as v,b as w,c as x}from"./chunk.MB7LKKUD.js";import"./chunk.KZUMXT5J.js";import"./chunk.CGK2PY76.js";import{G as R,Sa as g,T as y,Ua as h}from"./chunk.CYTTZOYL.js";import"./chunk.SDO3U72B.js";import{kb as b,qd as m}from"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as p}from"./chunk.AJZBJBMO.js";var c=p(R(),1);var r=p(y(),1);function W({notices:e,anchor:n,board:a,report:i}){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(k,{notices:e.filter(s=>s.kind==="banner"),at:"top",anchor:n,board:a,report:i}),(0,r.jsx)(k,{notices:e.filter(s=>s.kind==="toast"),at:"foot",anchor:n,board:a,report:i})]})}var E={info:"var(--graview-accent)",good:"var(--graview-good)",warn:"var(--graview-warn)",bad:"var(--graview-bad)"},C={info:"i",good:"\u2713",warn:"!",bad:"!"};function k({notices:e,at:n,anchor:a,board:i,report:s}){let l=(0,c.useRef)(null),t=e.length>0;return(0,c.useLayoutEffect)(()=>{let o=l.current;if(!t||!o)return;if(typeof o.showPopover=="function"&&!g(o))try{o.showPopover()}catch{}let d=()=>(n==="top"?x:w)(o,a());d(),n==="foot"&&i.hold?.(()=>o.matches(":hover")||o.contains(document.activeElement));let N=h(o);addEventListener("resize",d),addEventListener("scroll",d,!0),n==="foot"&&addEventListener(v,d);let u=typeof ResizeObserver=="function"?new ResizeObserver(d):null;return u?.observe(o),()=>{if(N(),u?.disconnect(),removeEventListener("resize",d),removeEventListener("scroll",d,!0),removeEventListener(v,d),o.isConnected&&g(o))try{o.hidePopover()}catch{}}},[t,n,a,i]),t?(0,r.jsx)("div",{ref:l,popover:"manual",role:"region","aria-label":n==="top"?"Notices":"Messages","data-testid":n==="top"?"notices-banners":"notices-toasts","data-graview-offstage":"",style:{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:m("toast"),width:"max-content",height:"auto",maxWidth:"min(560px, calc(100vw - 32px))",display:"grid",gap:8,color:"var(--graview-ink)"},children:e.map(o=>(0,r.jsx)(O,{notice:o,board:i,report:s},o.id))}):null}var T=e=>e.split(/\s+/).filter(Boolean).map(n=>n.replace(/^Meta\+/,"\u2318").replace(/^Control\+/,"Ctrl+").replace(/^Alt\+/,"Alt+")).join(" or "),H=e=>/^.*?[.!?](?=\s|$)/.exec(e.trim())?.[0]??e.trim(),L=e=>e.from==="framework"&&(e.tone==="bad"||e.tone==="warn");function O({notice:e,board:n,report:a}){let i=e.tone??"info",s=[...e.action?[e.action]:[],...e.actions??[]],l=()=>n.dismiss(e.id);return(0,r.jsxs)("div",{"data-testid":"notice","data-kind":e.kind,"data-tone":i,style:{boxSizing:"border-box",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px 12px",padding:e.kind==="banner"?"8px 10px 8px 12px":"10px 12px 10px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,r.jsx)("span",{"aria-hidden":"true","data-testid":"notice-chip",style:{width:20,height:20,borderRadius:"var(--graview-radius-sm, 6px)",flex:"0 0 auto",display:"inline-grid",placeItems:"center",fontSize:"0.75rem",fontWeight:700,lineHeight:1,color:"var(--graview-ink)",background:`color-mix(in srgb, ${E[i]} 22%, transparent)`},children:C[i]}),(0,r.jsx)("span",{"data-testid":"notice-sentence",style:{flex:"1 1 16rem",minWidth:0},children:e.sentence}),s.length>0?(0,r.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.map((t,o)=>t.href!==void 0?(0,r.jsx)("a",{href:t.href,...t.target?{target:t.target,rel:"noopener"}:{},"data-testid":"notice-action",onClick:()=>{t.onSelect?.(),l()},style:{...f,...o===0?S:{}},children:t.label},t.label):(0,r.jsx)("button",{type:"button","data-testid":"notice-action",...t.keys?{"aria-keyshortcuts":t.keys,title:`${t.label} \u2014 ${T(t.keys)}`}:{},onClick:()=>{l(),t.onSelect?.()},style:{...f,...o===0?S:{}},children:t.label},t.label))}):null,a&&L(e)?(0,r.jsx)("button",{type:"button","data-testid":"notice-report","aria-label":`Report this: ${H(e.sentence)}`,onClick:()=>a.tell({message:e.sentence,...e.code?{code:e.code}:{},...a.where(),version:b}),style:f,children:"Report this"}):null,(0,r.jsx)("button",{type:"button","data-testid":"notice-dismiss","aria-label":`Dismiss: ${e.sentence}`,title:"Dismiss",onClick:l,style:z,children:"\xD7"})]})}var f={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 12px",borderRadius:9,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",font:"inherit",fontWeight:500,textDecoration:"none",cursor:"pointer"},S={background:"var(--graview-accent)",borderColor:"var(--graview-accent)",color:"var(--graview-accent-ink)"},z={minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",fontSize:"1rem",cursor:"pointer"};export{W as NoticeStacks,H as firstSentenceOf,L as reportable};
1
+ import{a as v,b as w,c as x}from"./chunk.MB7LKKUD.js";import"./chunk.3FKKH2XU.js";import"./chunk.DLWFULWE.js";import{G as R,Ua as g,V as y,Wa as h}from"./chunk.VLX7YWVH.js";import"./chunk.SDO3U72B.js";import{kb as b,sd as m}from"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import{b as p}from"./chunk.AJZBJBMO.js";var c=p(R(),1);var r=p(y(),1);function W({notices:e,anchor:n,board:a,report:i}){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(k,{notices:e.filter(s=>s.kind==="banner"),at:"top",anchor:n,board:a,report:i}),(0,r.jsx)(k,{notices:e.filter(s=>s.kind==="toast"),at:"foot",anchor:n,board:a,report:i})]})}var E={info:"var(--graview-accent)",good:"var(--graview-good)",warn:"var(--graview-warn)",bad:"var(--graview-bad)"},C={info:"i",good:"\u2713",warn:"!",bad:"!"};function k({notices:e,at:n,anchor:a,board:i,report:s}){let l=(0,c.useRef)(null),t=e.length>0;return(0,c.useLayoutEffect)(()=>{let o=l.current;if(!t||!o)return;if(typeof o.showPopover=="function"&&!g(o))try{o.showPopover()}catch{}let d=()=>(n==="top"?x:w)(o,a());d(),n==="foot"&&i.hold?.(()=>o.matches(":hover")||o.contains(document.activeElement));let N=h(o);addEventListener("resize",d),addEventListener("scroll",d,!0),n==="foot"&&addEventListener(v,d);let u=typeof ResizeObserver=="function"?new ResizeObserver(d):null;return u?.observe(o),()=>{if(N(),u?.disconnect(),removeEventListener("resize",d),removeEventListener("scroll",d,!0),removeEventListener(v,d),o.isConnected&&g(o))try{o.hidePopover()}catch{}}},[t,n,a,i]),t?(0,r.jsx)("div",{ref:l,popover:"manual",role:"region","aria-label":n==="top"?"Notices":"Messages","data-testid":n==="top"?"notices-banners":"notices-toasts","data-graview-offstage":"",style:{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:m("toast"),width:"max-content",height:"auto",maxWidth:"min(560px, calc(100vw - 32px))",display:"grid",gap:8,color:"var(--graview-ink)"},children:e.map(o=>(0,r.jsx)(O,{notice:o,board:i,report:s},o.id))}):null}var T=e=>e.split(/\s+/).filter(Boolean).map(n=>n.replace(/^Meta\+/,"\u2318").replace(/^Control\+/,"Ctrl+").replace(/^Alt\+/,"Alt+")).join(" or "),H=e=>/^.*?[.!?](?=\s|$)/.exec(e.trim())?.[0]??e.trim(),L=e=>e.from==="framework"&&(e.tone==="bad"||e.tone==="warn");function O({notice:e,board:n,report:a}){let i=e.tone??"info",s=[...e.action?[e.action]:[],...e.actions??[]],l=()=>n.dismiss(e.id);return(0,r.jsxs)("div",{"data-testid":"notice","data-kind":e.kind,"data-tone":i,style:{boxSizing:"border-box",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px 12px",padding:e.kind==="banner"?"8px 10px 8px 12px":"10px 12px 10px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,r.jsx)("span",{"aria-hidden":"true","data-testid":"notice-chip",style:{width:20,height:20,borderRadius:"var(--graview-radius-sm, 6px)",flex:"0 0 auto",display:"inline-grid",placeItems:"center",fontSize:"0.75rem",fontWeight:700,lineHeight:1,color:"var(--graview-ink)",background:`color-mix(in srgb, ${E[i]} 22%, transparent)`},children:C[i]}),(0,r.jsx)("span",{"data-testid":"notice-sentence",style:{flex:"1 1 16rem",minWidth:0},children:e.sentence}),s.length>0?(0,r.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.map((t,o)=>t.href!==void 0?(0,r.jsx)("a",{href:t.href,...t.target?{target:t.target,rel:"noopener"}:{},"data-testid":"notice-action",onClick:()=>{t.onSelect?.(),l()},style:{...f,...o===0?S:{}},children:t.label},t.label):(0,r.jsx)("button",{type:"button","data-testid":"notice-action",...t.keys?{"aria-keyshortcuts":t.keys,title:`${t.label} \u2014 ${T(t.keys)}`}:{},onClick:()=>{l(),t.onSelect?.()},style:{...f,...o===0?S:{}},children:t.label},t.label))}):null,a&&L(e)?(0,r.jsx)("button",{type:"button","data-testid":"notice-report","aria-label":`Report this: ${H(e.sentence)}`,onClick:()=>a.tell({message:e.sentence,...e.code?{code:e.code}:{},...a.where(),version:b}),style:f,children:"Report this"}):null,(0,r.jsx)("button",{type:"button","data-testid":"notice-dismiss","aria-label":`Dismiss: ${e.sentence}`,title:"Dismiss",onClick:l,style:z,children:"\xD7"})]})}var f={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 12px",borderRadius:9,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",font:"inherit",fontWeight:500,textDecoration:"none",cursor:"pointer"},S={background:"var(--graview-accent)",borderColor:"var(--graview-accent)",color:"var(--graview-accent-ink)"},z={minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",fontSize:"1rem",cursor:"pointer"};export{W as NoticeStacks,H as firstSentenceOf,L as reportable};
@@ -1 +1 @@
1
- import{G as h}from"./chunk.CYTTZOYL.js";import{Kd as u,Qc as a,bd as m}from"./chunk.Q4MI53KK.js";import{b as l}from"./chunk.AJZBJBMO.js";function f(e){let t=[e?.typography?.body,e?.typography?.display,e?.typography?.mono],o=[];for(let i of t){let n=i?.split(",")[0]?.trim().replace(/^["']|["']$/g,"");!n||m(n)||n.toLowerCase()!==a.toLowerCase()&&(o.includes(n)||o.push(n))}return o}function g(e){let t=f(e);return t.length===0?null:`https://fonts.googleapis.com/css2?${t.map(i=>`family=${encodeURIComponent(i).replace(/%20/g,"+")}:wght@400;500;600;700`).join("&")}&display=swap`}var r=l(h(),1);function k(e,t){return new u({schema:e.schema,mutations:e.mutations??[],invariants:e.invariants??[],...t?{snapshot:t}:{},...e.policy?{policy:e.policy}:{},...e.publishing?{publishing:e.publishing}:{},...e.tidying?{tidying:e.tidying}:{},...e.intelligence?{intelligence:e.intelligence}:{},...e.brand?.timeZone?{timeZone:e.brand.timeZone}:{}})}function d(e){if(typeof document>"u")return e==="dark"?"dark":"light";let t=document.documentElement.dataset.theme;return t==="dark"||t==="light"?t:e==="dark"||e==="light"?e:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function v(e,t){let[o,i]=(0,r.useState)(()=>d(t));return(0,r.useEffect)(()=>{if(!e||typeof document>"u")return;let n=()=>i(d(t));n();let s=new MutationObserver(n);s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});let c=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):null;return c?.addEventListener?.("change",n),()=>{s.disconnect(),c?.removeEventListener?.("change",n)}},[e,t]),o}export{g as a,k as b,v as c};
1
+ import{G as h}from"./chunk.VLX7YWVH.js";import{Md as u,Rc as a,dd as m}from"./chunk.IQGSEAQ2.js";import{b as l}from"./chunk.AJZBJBMO.js";function f(e){let t=[e?.typography?.body,e?.typography?.display,e?.typography?.mono],o=[];for(let i of t){let n=i?.split(",")[0]?.trim().replace(/^["']|["']$/g,"");!n||m(n)||n.toLowerCase()!==a.toLowerCase()&&(o.includes(n)||o.push(n))}return o}function g(e){let t=f(e);return t.length===0?null:`https://fonts.googleapis.com/css2?${t.map(i=>`family=${encodeURIComponent(i).replace(/%20/g,"+")}:wght@400;500;600;700`).join("&")}&display=swap`}var r=l(h(),1);function k(e,t){return new u({schema:e.schema,mutations:e.mutations??[],invariants:e.invariants??[],...t?{snapshot:t}:{},...e.policy?{policy:e.policy}:{},...e.publishing?{publishing:e.publishing}:{},...e.tidying?{tidying:e.tidying}:{},...e.intelligence?{intelligence:e.intelligence}:{},...e.brand?.timeZone?{timeZone:e.brand.timeZone}:{}})}function d(e){if(typeof document>"u")return e==="dark"?"dark":"light";let t=document.documentElement.dataset.theme;return t==="dark"||t==="light"?t:e==="dark"||e==="light"?e:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function v(e,t){let[o,i]=(0,r.useState)(()=>d(t));return(0,r.useEffect)(()=>{if(!e||typeof document>"u")return;let n=()=>i(d(t));n();let s=new MutationObserver(n);s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});let c=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):null;return c?.addEventListener?.("change",n),()=>{s.disconnect(),c?.removeEventListener?.("change",n)}},[e,t]),o}export{g as a,k as b,v as c};
@@ -1 +1 @@
1
- import{fa as V,ga as w}from"./chunk.CYTTZOYL.js";import"./chunk.SDO3U72B.js";import{Od as u,Sd as h}from"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var c=i=>[i,...u.filter(o=>o!==i)];function p(i,o){if(o.hidden.length===0&&o.removed.length===0)return i;let a=new Set(o.removed.filter(e=>!e.lens).map(e=>e.name)),f=new Set(o.hidden),r=e=>e?.name!==void 0&&(a.has(e.name)||e.title!==void 0&&f.has(e.name)),m=()=>(i.homes?.()??[]).filter(e=>e.name===void 0||!a.has(e.name)),l=(e,t,d)=>[...i.registrations()].reverse().find(n=>n.kind===e&&n.cardinality===t&&n.fidelity===d&&!n.beside&&!n.hidden&&!r(n)),y=(e,t)=>{for(let d of c(t.fidelity)){let n=l(e,t.cardinality,d);if(n)return n}if(t.cardinality==="one")for(let d of c(t.fidelity)){let n=l(e,"many",d);if(n)return n}},s={...i,register(e,t,d,n){return i.register(e,t,d,n),s},...i.home?{home(e,t){return i.home(e,t),s}}:{},...i.homes?{homes:m,homeView:()=>m().at(-1)?.view}:{},lookup(e,t){return i.lookup(e,t)===void 0?void 0:l(e,t.cardinality,t.fidelity)?.view},places:()=>i.places().filter(e=>!(e.name!==void 0&&a.has(e.name))).map(e=>e.name!==void 0&&f.has(e.name)&&!e.hidden?{...e,hidden:!0}:e),resolve(e,t,d){let n=i.resolve(e,t,d);return!n||!r(n)||d!==void 0&&n.name!==void 0&&!a.has(n.name)&&n.title!==void 0&&h(n.title)===d?n:y(e,t)},all:()=>i.all().filter(e=>!(e.name!==void 0&&a.has(e.name))),homes:()=>(i.homes?.()??[]).filter(e=>!(e.name!==void 0&&a.has(e.name))),homeView:()=>i.homes?s.homes().at(-1)?.view:i.homeView?.()};return V(i)&&w(s),s}function R(i,o,a){let f,r=()=>{let m=o.current();f&&m.hidden===f.hidden&&m.removed===f.removed||(f=m,a(p(i,m)))};return r(),o.onChange?.(r)??(()=>{})}export{p as tidyViews,R as watchTidied};
1
+ import{ha as V,ia as w}from"./chunk.VLX7YWVH.js";import"./chunk.SDO3U72B.js";import{Qd as u,Ud as h}from"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var c=i=>[i,...u.filter(o=>o!==i)];function p(i,o){if(o.hidden.length===0&&o.removed.length===0)return i;let a=new Set(o.removed.filter(e=>!e.lens).map(e=>e.name)),f=new Set(o.hidden),r=e=>e?.name!==void 0&&(a.has(e.name)||e.title!==void 0&&f.has(e.name)),m=()=>(i.homes?.()??[]).filter(e=>e.name===void 0||!a.has(e.name)),l=(e,t,d)=>[...i.registrations()].reverse().find(n=>n.kind===e&&n.cardinality===t&&n.fidelity===d&&!n.beside&&!n.hidden&&!r(n)),y=(e,t)=>{for(let d of c(t.fidelity)){let n=l(e,t.cardinality,d);if(n)return n}if(t.cardinality==="one")for(let d of c(t.fidelity)){let n=l(e,"many",d);if(n)return n}},s={...i,register(e,t,d,n){return i.register(e,t,d,n),s},...i.home?{home(e,t){return i.home(e,t),s}}:{},...i.homes?{homes:m,homeView:()=>m().at(-1)?.view}:{},lookup(e,t){return i.lookup(e,t)===void 0?void 0:l(e,t.cardinality,t.fidelity)?.view},places:()=>i.places().filter(e=>!(e.name!==void 0&&a.has(e.name))).map(e=>e.name!==void 0&&f.has(e.name)&&!e.hidden?{...e,hidden:!0}:e),resolve(e,t,d){let n=i.resolve(e,t,d);return!n||!r(n)||d!==void 0&&n.name!==void 0&&!a.has(n.name)&&n.title!==void 0&&h(n.title)===d?n:y(e,t)},all:()=>i.all().filter(e=>!(e.name!==void 0&&a.has(e.name))),homes:()=>(i.homes?.()??[]).filter(e=>!(e.name!==void 0&&a.has(e.name))),homeView:()=>i.homes?s.homes().at(-1)?.view:i.homeView?.()};return V(i)&&w(s),s}function R(i,o,a){let f,r=()=>{let m=o.current();f&&m.hidden===f.hidden&&m.removed===f.removed||(f=m,a(p(i,m)))};return r(),o.onChange?.(r)??(()=>{})}export{p as tidyViews,R as watchTidied};
@@ -0,0 +1 @@
1
+ import{k as a,l as o}from"./chunk.QRT6BZR6.js";import"./chunk.2V7QTIAV.js";import"./chunk.Z26T5E76.js";import"./chunk.77JI5T4F.js";import"./chunk.4DZOAB4D.js";import"./chunk.UDU545CL.js";import"./chunk.7VAHHEDX.js";import"./chunk.2VYGDY5Z.js";import"./chunk.FUPYIOXZ.js";import"./chunk.APRWUIE3.js";import"./chunk.3OEODIHB.js";import"./chunk.WFCE7NLK.js";import"./chunk.WVUJXDXZ.js";import"./chunk.ZA5TDCBC.js";import"./chunk.2JEN2RCB.js";import"./chunk.7CLKGKSF.js";import"./chunk.TMHVYI5R.js";import"./chunk.R5MLRKAO.js";import"./chunk.YMXWS4XN.js";import"./chunk.GZHZLJBF.js";import"./chunk.3SAESG6X.js";import"./chunk.OJGHDWI6.js";import"./chunk.F6BNFLQM.js";import"./chunk.75JQCTR6.js";import"./chunk.5IEZF433.js";import"./chunk.5AD2QHWH.js";import"./chunk.3FKKH2XU.js";import"./chunk.DLWFULWE.js";import{xa as n}from"./chunk.VLX7YWVH.js";import"./chunk.SDO3U72B.js";import"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var w=new WeakMap;function p(e,i){let t=w.get(e);t||w.set(e,t=new Map);let r=t.get(i);return r||t.set(i,r=a(o(e,n(e)),e,i)),r}export{p as frameworkViews};
@@ -1,3 +1,3 @@
1
- import{C as b,P as h,Z as g,bc as w,fc as x,ga as $,ha as k}from"./chunk.Q4MI53KK.js";function G(t,n,e){let r=t?.display?.format?.[n];return r?r(e):typeof e=="string"?k(e):String(e)}function Q(t,n,e,r){let s=t.tryDefinition(n)?.edges,i=s&&Object.hasOwn(s,e)?s[e]:void 0;return(r==="out"?i?.description:i?.inverse)??$(e).toLowerCase()}var S=Symbol.for("@graview/core:markdown");function F(t){let n=b(t);return!!n&&(n[S]===1||F(n.innerType))}var R=/^ {0,3}#{1,6}(?:[ \t]+|$)/,m=/^[ \t]*(?:[-*+•]|\d{1,9}[.)])[ \t]+(?:\[[ xX]\][ \t]+)?/,O=/^ {0,3}(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/,N=/^ {0,3}(?:`{3,}|~{3,})/,M=/^ {0,3}(?:>[ \t]?)+/,W=/^\|?\s*:?-{2,}:?\s*(?:\|\s*:?-{2,}:?\s*)*\|?$/,_={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'",nbsp:" "};function j(t){return t.replace(/!?\[([^\]\n]{0,500})\]\([^)\n]{0,500}\)/g,"$1").replace(/<((?:https?:|mailto:)[^>\s]*)>/gi,"$1").replace(/<\/?[A-Za-z][^<>\n]*>/g,"").replace(/`+([^`\n]*)`+/g,"$1").replace(/(\*\*|__|~~)(?=\S)([^\n]{0,500}?\S)\1/g,"$2").replace(/(^|[^\w*])\*(?=\S)([^*\n]{0,500}?\S)\*(?![\w*])/g,"$1$2").replace(/(^|\W)_(?=\S)([^_\n]{0,500}?\S)_(?!\w)/g,"$1$2").replace(/\\([\\`*_{}[\]()#+\-.!>|~])/g,"$1").replace(/&(amp|lt|gt|quot|#39|nbsp);/g,(n,e)=>_[e]??"")}function T(t,n,e){let r=t.replace(/\r\n?/g,`
1
+ import{C as b,P as h,Z as g,bc as w,fc as x,ga as $,ha as k}from"./chunk.IQGSEAQ2.js";function G(t,n,e){let r=t?.display?.format?.[n];return r?r(e):typeof e=="string"?k(e):String(e)}function Q(t,n,e,r){let s=t.tryDefinition(n)?.edges,i=s&&Object.hasOwn(s,e)?s[e]:void 0;return(r==="out"?i?.description:i?.inverse)??$(e).toLowerCase()}var S=Symbol.for("@graview/core:markdown");function F(t){let n=b(t);return!!n&&(n[S]===1||F(n.innerType))}var R=/^ {0,3}#{1,6}(?:[ \t]+|$)/,m=/^[ \t]*(?:[-*+•]|\d{1,9}[.)])[ \t]+(?:\[[ xX]\][ \t]+)?/,O=/^ {0,3}(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/,N=/^ {0,3}(?:`{3,}|~{3,})/,M=/^ {0,3}(?:>[ \t]?)+/,W=/^\|?\s*:?-{2,}:?\s*(?:\|\s*:?-{2,}:?\s*)*\|?$/,_={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'",nbsp:" "};function j(t){return t.replace(/!?\[([^\]\n]{0,500})\]\([^)\n]{0,500}\)/g,"$1").replace(/<((?:https?:|mailto:)[^>\s]*)>/gi,"$1").replace(/<\/?[A-Za-z][^<>\n]*>/g,"").replace(/`+([^`\n]*)`+/g,"$1").replace(/(\*\*|__|~~)(?=\S)([^\n]{0,500}?\S)\1/g,"$2").replace(/(^|[^\w*])\*(?=\S)([^*\n]{0,500}?\S)\*(?![\w*])/g,"$1$2").replace(/(^|\W)_(?=\S)([^_\n]{0,500}?\S)_(?!\w)/g,"$1$2").replace(/\\([\\`*_{}[\]()#+\-.!>|~])/g,"$1").replace(/&(amp|lt|gt|quot|#39|nbsp);/g,(n,e)=>_[e]??"")}function T(t,n,e){let r=t.replace(/\r\n?/g,`
2
2
  `).split(`
3
3
  `),s=[],i=[],u=0,d=!1,a=()=>{let o=i.join(" ").replace(/\s+/g," ").trim();o&&(s.push(o),u+=o.length),i=[]},c=0;for(;c<r.length&&u<=e;){let o=r[c++];if(n&&N.test(o)){d=!d,d||a();continue}if(!d&&(o.trim().length===0||n&&(O.test(o)||W.test(o.trim())))){a();continue}let f=!d&&n&&R.test(o),l=!d&&m.test(o);if((f||l)&&a(),n&&!d?(o=o.replace(M,""),f&&(o=o.replace(R,"").replace(/[ \t]+#+[ \t]*$/,"")),l&&(o=o.replace(m,"")),o.includes("|")&&(o=o.replace(/^[ \t]*\||\|[ \t]*$/g,"").split("|").map(p=>p.trim()).filter(Boolean).join(" \xB7 ")),o=j(Number.isFinite(e)?o.slice(0,e*2+200):o)):l&&(o=o.replace(m,"")),i.push(o),f&&a(),i.reduce((p,A)=>p+A.length,0)>e)break}return a(),{blocks:s,more:r.slice(c).some(o=>o.trim().length>0&&!(n&&(N.test(o)||O.test(o))))}}function E(t,n){return`${(t.slice(0,n+1).replace(/\s+\S*$/,"")||t.slice(0,n)).replace(/[\s,;:.—-]+$/,"")}\u2026`}function K(t,n={}){let e=n.most??160,{blocks:r,more:s}=T(t,n.markdown===!0,e),i=r[0]??"";if(i.length<=e)return(s||r.length>1)&&i.length>0&&!/[.!?…:]$/.test(i)?`${i}\u2026`:i;let u=x(i);return u&&u.length<=e?u:E(i,e)}var v=t=>T(t,!0,Number.POSITIVE_INFINITY).blocks.join(" ");var I={d:1440,h:60,m:1};function rn(t){if(typeof t=="number")return Number.isFinite(t)&&t>=0?Math.round(t):void 0;if(typeof t!="string")return;let n=t.trim().toLowerCase();if(/^\d+$/.test(n))return Number(n);let e=/^(\d+):([0-5]\d)(?::([0-5]\d))?$/.exec(n);if(e)return Number(e[1])*60+Number(e[2])+Math.round(Number(e[3]??0)/60);let r=0,s=!1,i=n.replace(/(\d*[.,]?\d+) *(days?|d|hours?|hrs?|hr|h|minutes?|mins?|min|m)(?![a-z])/g,(u,d,a)=>(s=!0,r+=Number(d.replace(",","."))*I[a[0]]," "));return s&&/^[\s,+]*(?:and[\s,+]*)*$/.test(i)?Math.round(r):void 0}function D(t,n){if(!Number.isFinite(t))return String(t);let e=Math.round(Math.abs(t)),r=Math.floor(e/60),s=e%60,i=[r?`${g(r,n)} h`:"",s||!r?`${g(s,n)} min`:""].filter(Boolean).join(" ");return t<0?`\u2212${i}`:i}var P=/^(\+?1[ .-]?)?\(?([2-9]\d\d)\)?[ .-]?(\d{3})[ .-]?(\d{4})(?: *(?:ext\.?|x|#) *(\d+))?$/i;function L(t,n){let e=t.trim(),r=/[-_](US|CA)\b/i.test(h(n))?P.exec(e):null;if(!r)return e;let[,s,i,u,d,a]=r;return`${s?.startsWith("+")?"+1 ":""}(${i}) ${u}-${d}${a?` ext. ${a}`:""}`}function q(t){let[,n="",e]=/^(.*?)(?: *(?:ext\.?|x|#) *(\d+))?$/i.exec(t.trim())??[],r=n.replace(/\D/g,"");return r.length<3?void 0:`tel:${n.startsWith("+")?"+":""}${r}${e?`;ext=${e}`:""}`}var C=()=>/Mac|iPhone|iPad|iPod/.test(globalThis.navigator?.userAgent??"");function H(t,n=C()){let e=encodeURIComponent(t.trim());return n?`https://maps.apple.com/?q=${e}`:`https://www.google.com/maps/search/?api=1&query=${e}`}var U=t=>t?.fields?.shape??{},z=(t,n)=>{let e=U(t);return Object.hasOwn(e,n)?w(e[n]):void 0},y=(t,n)=>{let e=t?.computed,r=e&&Object.hasOwn(e,n)?e[n]:void 0;return typeof r=="object"?r:void 0},B=(t,n)=>{let e=y(t,n);return e?.as??(e?.format==="duration"?"duration":void 0)};function on(t,n){let e=y(t,n);if(!e)return;if(e.amount)return e.amount;let r=e.format==="money"||e.format==="percent"?e.format:void 0;return r||!e.format&&e.unit?{...r?{format:r}:{},...e.unit?{unit:e.unit}:{}}:void 0}function sn(t,n){return y(t,n)?.hidden===!0}function dn(t,n){return z(t,n)??(t&&B(t,n)==="duration"?"duration":void 0)}function un(t,n,e){return t==="duration"?typeof n=="number"?D(n,e):void 0:t==="phone"?typeof n=="string"?L(n,e):void 0:t==="place"&&typeof n=="string"?n.trim():void 0}function an(t,n){if(!(typeof n!="string"||!n.trim()))return t==="phone"?q(n):t==="place"?H(n):void 0}export{F as a,G as b,Q as c,K as d,v as e,rn as f,on as g,sn as h,dn as i,un as j,an as k};
@@ -1 +1 @@
1
- import{c as m}from"./chunk.AHPYNDVA.js";import{ga as c,la as u,ma as p,oa as f,sa as h,ta as l}from"./chunk.Q4MI53KK.js";function M(t,e){let n=t.schema.kinds,r="kind"in e?e.kind:void 0;if(r!==void 0&&!n.includes(r))return`There is no kind "${r}" in this app. Its kinds are: ${n.join(", ")}.`;if(e.on==="act"&&e.act!==void 0&&t.allMutations&&!t.allMutations().some(i=>i.name===e.act))return`There is no act "${e.act}" in this app.`;let o="record"in e?e.record:void 0;if(o!==void 0&&t.graph&&!t.graph.getNode(o))return`No record "${o}" is here to be told about.`;if(o!==void 0&&r!==void 0&&t.graph&&t.graph.getNode(o)?.kind!==r)return`\u201C${o}\u201D is not ${h(r)}.`;if(e.on==="changed"&&e.kind===void 0&&e.record===void 0)return"Say which kind, or which record, to be told about.";if(e.on==="reaches"){if(e.condition.trim()==="")return"Say what it should reach: a condition like done == true.";try{m(e.condition)}catch(i){return`The condition does not read: ${i instanceof Error?i.message:String(i)}.`}}}function d(t,e){let n=t.graph?.getNode(e);return n?u(t.schema.tryDefinition(n.kind),n):e}function g(t,e){let n=t.allMutations?.().find(r=>r.name===e);return n?p(n):c(e)}function v(t,e){let{when:n}=e,r=e.alsoMine?"anyone":"someone else",o=s=>l(t.schema.tryDefinition(s),s),i=s=>{let a=o(s);return`${/^[aeiou]/i.test(a)?"an":"a"} ${a}`};switch(n.on){case"act":{let s=n.act!==void 0?`\u201C${g(t,n.act)}\u201D`:"an act";return`When ${r} runs ${s}${n.record!==void 0?` on \u201C${d(t,n.record)}\u201D`:""}`}case"created":return`When ${r} adds ${i(n.kind)}`;case"changed":return n.record!==void 0?`When ${r} changes \u201C${d(t,n.record)}\u201D`:`When ${r} changes any of the ${f(t.schema,n.kind)}`;case"reaches":return`When ${n.record!==void 0?`\u201C${d(t,n.record)}\u201D`:i(n.kind)} reaches ${n.condition}${e.alsoMine?"":" (by someone else)"}`}}export{M as a,v as b};
1
+ import{c as m}from"./chunk.R5MLRKAO.js";import{ga as c,la as u,ma as p,oa as f,sa as h,ta as l}from"./chunk.IQGSEAQ2.js";function M(t,e){let n=t.schema.kinds,r="kind"in e?e.kind:void 0;if(r!==void 0&&!n.includes(r))return`There is no kind "${r}" in this app. Its kinds are: ${n.join(", ")}.`;if(e.on==="act"&&e.act!==void 0&&t.allMutations&&!t.allMutations().some(i=>i.name===e.act))return`There is no act "${e.act}" in this app.`;let o="record"in e?e.record:void 0;if(o!==void 0&&t.graph&&!t.graph.getNode(o))return`No record "${o}" is here to be told about.`;if(o!==void 0&&r!==void 0&&t.graph&&t.graph.getNode(o)?.kind!==r)return`\u201C${o}\u201D is not ${h(r)}.`;if(e.on==="changed"&&e.kind===void 0&&e.record===void 0)return"Say which kind, or which record, to be told about.";if(e.on==="reaches"){if(e.condition.trim()==="")return"Say what it should reach: a condition like done == true.";try{m(e.condition)}catch(i){return`The condition does not read: ${i instanceof Error?i.message:String(i)}.`}}}function d(t,e){let n=t.graph?.getNode(e);return n?u(t.schema.tryDefinition(n.kind),n):e}function g(t,e){let n=t.allMutations?.().find(r=>r.name===e);return n?p(n):c(e)}function v(t,e){let{when:n}=e,r=e.alsoMine?"anyone":"someone else",o=s=>l(t.schema.tryDefinition(s),s),i=s=>{let a=o(s);return`${/^[aeiou]/i.test(a)?"an":"a"} ${a}`};switch(n.on){case"act":{let s=n.act!==void 0?`\u201C${g(t,n.act)}\u201D`:"an act";return`When ${r} runs ${s}${n.record!==void 0?` on \u201C${d(t,n.record)}\u201D`:""}`}case"created":return`When ${r} adds ${i(n.kind)}`;case"changed":return n.record!==void 0?`When ${r} changes \u201C${d(t,n.record)}\u201D`:`When ${r} changes any of the ${f(t.schema,n.kind)}`;case"reaches":return`When ${n.record!==void 0?`\u201C${d(t,n.record)}\u201D`:i(n.kind)} reaches ${n.condition}${e.alsoMine?"":" (by someone else)"}`}}export{M as a,v as b};
@@ -0,0 +1 @@
1
+ import"./chunk.WVUJXDXZ.js";import{k as m,m as i}from"./chunk.ZA5TDCBC.js";import"./chunk.2JEN2RCB.js";import"./chunk.7CLKGKSF.js";import"./chunk.TMHVYI5R.js";import"./chunk.R5MLRKAO.js";import"./chunk.YMXWS4XN.js";import"./chunk.5AD2QHWH.js";import"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";function a(t){let r=new Map;return(s,o)=>{let e=o.kind,n=r.get(e);return n===void 0&&r.set(e,n=i(t,e).length),n===0?{}:m(t,s,o).values}}export{a as computedOn};
@@ -1,2 +1,2 @@
1
- import{a as ue,b as P,d as pe,g as me,h as ge,i as he,j as ke,k as be}from"./chunk.D5LOTCBU.js";import{$ as C,Aa as re,Ba as ie,C as W,Ca as se,Fa as U,H as v,J as E,K as Y,Ka as de,L as q,Ma as V,Ob as ce,T as S,Ua as G,W as J,X as Q,Ya as ae,_a as le,_b as O,ab as fe,ac as ye,ba as ee,bc as K,ea as ne,ha as I,la as M,ra as R,ta as te,za as oe}from"./chunk.Q4MI53KK.js";var ve=t=>`${t}${t%100>=11&&t%100<=13?"th":["th","st","nd","rd"][t%10]??"th"}`,Se={day:"day",week:"week",month:"month",year:"year"},N=t=>t.length<2?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`;function Oe(t,e,n){let r=e.interval??1,d=Se[e.every],a=t.slice(0,10),l=r===1?`Every ${d}`:r===2?`Every other ${d}`:`Every ${r} ${d}s`,s;if(e.every==="week"){let c=(e.on?.length?e.on:[G[new Date(`${a}T00:00:00Z`).getUTCDay()]]).map(i=>ee(G.indexOf(i),"long",n));s=r===1?`Every ${N(c)}`:r===2?`Every other ${N(c)}`:`${l} on ${N(c)}`}else if(e.every==="month"){let c=(e.on?.length?e.on:[+a.slice(8,10)]).map(i=>i===-1?"the last day":`the ${ve(Number(i))}`);s=`${l} on ${N(c)}`}else e.every==="year"?s=`${l} on ${C(a,n)}`:s=l;return E.test(t)&&(s+=` at ${Q(t,n)}`),e.until&&(s+=`, until ${S(e.until,n)}`),e.count&&(s+=`, ${e.count===1?"once":`${e.count} times`}`),s}function we(t,e,n={}){if(!le(e)||typeof t!="string")return;let r=n.today??q(),d=fe(t,e,r),a=Oe(t,e,n.locale),l=d.slice(0,4)===r.slice(0,4)?C(d.slice(0,10),n.locale):S(d.slice(0,10),n.locale);return d.slice(0,10)<r?`${a}, last ${l}`:`${a}, next ${l}`}function ln(t,e){let n=new Map,r=new Map;for(let d of t){let a=M(e(d.kind),d).trim().toLowerCase();r.set(a,[...r.get(a)??[],d])}for(let d of r.values()){if(d.length<2)continue;let a=new Map;for(let l of d)a.set(l.kind,[...a.get(l.kind)??[],l]);for(let[l,s]of a){if(s.length===1){n.set(s[0].id,te(e(l),l));continue}let c=s.map(o=>new Map(Ne(o,e(o.kind)).map(p=>[p.key,p.alone]))),i=[...new Set(c.flatMap(o=>[...o.keys()]))],u=o=>c.every(p=>!/\d/.test(p.get(o)??"")),g=[...i.filter(u),...i.filter(o=>!u(o))],h=(o,p)=>p.map(y=>c[o].get(y)??"").filter(Boolean).join(" \xB7 "),z=o=>new Set(s.map((p,y)=>h(y,o))).size===s.length&&s.every((p,y)=>h(y,o)!==""),$=g.find(o=>z([o])),f=$?void 0:g.flatMap((o,p)=>g.slice(p+1).map(y=>[o,y])).find(o=>z(o));s.forEach((o,p)=>{if($||f)return void n.set(o.id,h(p,$?[$]:f));let y=g.find(k=>{let b=c[p].get(k);return b!==void 0&&b!==""&&c.every((_,x)=>x===p||_.get(k)!==b)});n.set(o.id,y?c[p].get(y):`${p+1} of ${s.length}`)})}}return n}function fn(t,e){return t?.describe?t.describe(e):`${e.kind} ${M(t,e)}`}var Ee=new Set(["id","kind","label"]);function Me(t,e){if(e.length===0)return!1;let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[\\s\xB7,(/])${n}($|[\\s\xB7,)/])`).test(t)}function Ne(t,e,n={}){let r=e?.display,d=new Set([...Ee,...r?.hide??[]]);typeof t.label=="string"&&e?.label&&!M(e,t).includes(t.label)&&d.delete("label");let a=(n.said??[]).filter(f=>!!f),l=a.filter(f=>f.endsWith("\u2026")).map(f=>f.replace(/…$/,"").trim()).filter(f=>f.length>12),s=[],c=e?.fields?.shape,i=e?.fieldRoles,u=n.glance?r?.glance??[i?.who,i?.when].filter(f=>!!f):Ae(r?.page),g=n.glance&&r?.glance!==void 0,h=new Set(n.glance?[]:n.blanks??[]),$=[...new Set(g?u:[...u,...je(e),...Object.keys(t)])].filter(f=>Object.hasOwn(t,f)||h.has(f)).map(f=>[f,t[f]]);for(let[f,o]of $){if(d.has(f)||ge(e,f))continue;let p=c?.[f];if(h.has(f)&&!U(p)&&!V(p)&&(o==null||o===""||Array.isArray(o)&&o.length===0)){s.push({key:f,label:R(e,f),value:"",stored:"",alone:"",long:!1,blank:!0});continue}if(o==null)continue;let y=r?.format?.[f],k=y?[]:ie(o);if(k[0]&&n.glance)continue;let b=e?.fields?.shape?.[f],_=!y&&typeof o=="string"&&U(b)?o:void 0,x=!y&&typeof o=="string"&&ue(b);if(_&&n.glance)continue;let D=y?void 0:V(b),w=D?{relation:D,refs:de(o,D)}:void 0;if(w&&(n.glance||w.refs.length===0)||!k[0]&&typeof o=="object"&&(!Array.isArray(o)||o.some(m=>typeof m=="object"&&m!==null))&&y===void 0)continue;let Z=typeof o=="string"&&!y?we(o,t[`${f}Repeat`],{locale:n.locale}):void 0,F=k[0]?k.map(m=>`${m.caption?`${m.name} \u2014 ${m.caption}`:m.name}${oe(m)?` (${re(m)})`:""}`).join(", "):Array.isArray(o)?o.join(", "):typeof o=="boolean"?o?"Yes":"No":String(o),T=y?void 0:he(e,f),B=be(T,o),H=!y&&!T&&typeof o=="number"?O(e?.fields?.shape?.[f])??me(e,f):void 0,j=w?w.refs.length>1?`${w.refs.length} linked records`:"linked record":y?y(o):H?ye(o,H):ke(T,o,n.locale)??(Array.isArray(o)||typeof o=="boolean"?F:typeof o=="string"&&Z!==void 0?Z:typeof o=="string"&&v.test(o)&&(o.length===10||Fe(e,f))?S(o,n.locale):typeof o=="string"&&E.test(o)?J(o,n.locale,n.timeZone):typeof o=="string"&&Te(e,f)?P(e,f,o):F),X=typeof o=="string"&&Ie(e,f,j),A=(n.glance||n.excerpt)&&!y&&(X||x)?pe(j,{markdown:x}):j;if(a.includes(A)||l.some(m=>A.startsWith(m))||n.glance&&(typeof o=="string"||typeof o=="number")&&a.some(m=>Me(m,A)))continue;let L=R(e,f),xe=typeof o=="number"?`${L} ${A}`:typeof o=="boolean"&&!y?`${L}: ${A.toLowerCase()}`:A;if(s.push({key:f,label:L,value:A,stored:F,alone:xe,long:X,...x?{markdown:!0}:{},...k[0]?{files:k}:{},..._?{app:_}:{},...w?{linked:w}:{},...B?{href:B}:{},...ae(c?.[`${f}Repeat`])?{repeats:!0}:{}}),n.limit!==void 0&&s.length>=n.limit)break}return ze(s,e)}function ze(t,e){let n=new Map;for(let r of t){let d=De(e,r.key);d&&n.set(r.key,new Set(d.map(a=>P(e,r.key,a).toLowerCase())))}return n.size<2?t:t.map(r=>{let d=n.get(r.key);return d!==void 0&&[...n].some(([l,s])=>l!==r.key&&[...d].some(c=>s.has(c)))?{...r,alone:`${r.label}: ${r.value.toLowerCase()}`}:r})}function De(t,e){let n=t?.fields?.shape?.[e];for(let r=0;r<6&&n?._zod?.def?.innerType!==void 0;r++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"&&n._zod.def.entries?Object.values(n._zod.def.entries).map(String):void 0}function Fe(t,e){let n=t?.fields?.shape?.[e]?._zod?.def;for(let r=0;r<6&&n?.innerType!==void 0;r++)n=n.innerType._zod?.def;return n?.type==="string"&&(n.checks??[]).some(r=>r._zod?.def?.pattern?.source===v.source)}function Te(t,e){let n=t?.fields?.shape?.[e];for(let r=0;r<6&&n?._zod?.def?.innerType!==void 0;r++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"}function je(t){let e=t?.fields?.shape;return[...Object.keys(e??{}),...Object.keys(t?.computed??{})]}function Ae(t){return[...t?.fields??[],...(t?.groups??[]).flatMap(e=>e.fields)]}var Le=500,We=160;function Ce(t){let e=t;for(let n=0;n<6&&e?._zod?.def?.innerType!==void 0;n++)e=e._zod.def.innerType;return e?._zod?.def?.type==="string"?e._zod.def:void 0}function Ie(t,e,n){return Ce(t?.fields?.shape?.[e])?.checks?.some(d=>d._zod?.def?.check==="max_length"&&(d._zod.def.maximum??0)>Le)?!0:typeof n=="string"&&(n.includes(`
1
+ import{a as ue,b as P,d as pe,g as me,h as ge,i as he,j as ke,k as be}from"./chunk.5AD2QHWH.js";import{$ as C,Aa as re,Ba as ie,C as W,Ca as se,Fa as U,H as v,J as E,K as Y,Ka as de,L as q,Ma as V,Ob as ce,T as S,Ua as G,W as J,X as Q,Ya as ae,_a as le,_b as O,ab as fe,ac as ye,ba as ee,bc as K,ea as ne,ha as I,la as M,ra as R,ta as te,za as oe}from"./chunk.IQGSEAQ2.js";var ve=t=>`${t}${t%100>=11&&t%100<=13?"th":["th","st","nd","rd"][t%10]??"th"}`,Se={day:"day",week:"week",month:"month",year:"year"},N=t=>t.length<2?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`;function Oe(t,e,n){let r=e.interval??1,d=Se[e.every],a=t.slice(0,10),l=r===1?`Every ${d}`:r===2?`Every other ${d}`:`Every ${r} ${d}s`,s;if(e.every==="week"){let c=(e.on?.length?e.on:[G[new Date(`${a}T00:00:00Z`).getUTCDay()]]).map(i=>ee(G.indexOf(i),"long",n));s=r===1?`Every ${N(c)}`:r===2?`Every other ${N(c)}`:`${l} on ${N(c)}`}else if(e.every==="month"){let c=(e.on?.length?e.on:[+a.slice(8,10)]).map(i=>i===-1?"the last day":`the ${ve(Number(i))}`);s=`${l} on ${N(c)}`}else e.every==="year"?s=`${l} on ${C(a,n)}`:s=l;return E.test(t)&&(s+=` at ${Q(t,n)}`),e.until&&(s+=`, until ${S(e.until,n)}`),e.count&&(s+=`, ${e.count===1?"once":`${e.count} times`}`),s}function we(t,e,n={}){if(!le(e)||typeof t!="string")return;let r=n.today??q(),d=fe(t,e,r),a=Oe(t,e,n.locale),l=d.slice(0,4)===r.slice(0,4)?C(d.slice(0,10),n.locale):S(d.slice(0,10),n.locale);return d.slice(0,10)<r?`${a}, last ${l}`:`${a}, next ${l}`}function ln(t,e){let n=new Map,r=new Map;for(let d of t){let a=M(e(d.kind),d).trim().toLowerCase();r.set(a,[...r.get(a)??[],d])}for(let d of r.values()){if(d.length<2)continue;let a=new Map;for(let l of d)a.set(l.kind,[...a.get(l.kind)??[],l]);for(let[l,s]of a){if(s.length===1){n.set(s[0].id,te(e(l),l));continue}let c=s.map(o=>new Map(Ne(o,e(o.kind)).map(p=>[p.key,p.alone]))),i=[...new Set(c.flatMap(o=>[...o.keys()]))],u=o=>c.every(p=>!/\d/.test(p.get(o)??"")),g=[...i.filter(u),...i.filter(o=>!u(o))],h=(o,p)=>p.map(y=>c[o].get(y)??"").filter(Boolean).join(" \xB7 "),z=o=>new Set(s.map((p,y)=>h(y,o))).size===s.length&&s.every((p,y)=>h(y,o)!==""),$=g.find(o=>z([o])),f=$?void 0:g.flatMap((o,p)=>g.slice(p+1).map(y=>[o,y])).find(o=>z(o));s.forEach((o,p)=>{if($||f)return void n.set(o.id,h(p,$?[$]:f));let y=g.find(k=>{let b=c[p].get(k);return b!==void 0&&b!==""&&c.every((_,x)=>x===p||_.get(k)!==b)});n.set(o.id,y?c[p].get(y):`${p+1} of ${s.length}`)})}}return n}function fn(t,e){return t?.describe?t.describe(e):`${e.kind} ${M(t,e)}`}var Ee=new Set(["id","kind","label"]);function Me(t,e){if(e.length===0)return!1;let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[\\s\xB7,(/])${n}($|[\\s\xB7,)/])`).test(t)}function Ne(t,e,n={}){let r=e?.display,d=new Set([...Ee,...r?.hide??[]]);typeof t.label=="string"&&e?.label&&!M(e,t).includes(t.label)&&d.delete("label");let a=(n.said??[]).filter(f=>!!f),l=a.filter(f=>f.endsWith("\u2026")).map(f=>f.replace(/…$/,"").trim()).filter(f=>f.length>12),s=[],c=e?.fields?.shape,i=e?.fieldRoles,u=n.glance?r?.glance??[i?.who,i?.when].filter(f=>!!f):Ae(r?.page),g=n.glance&&r?.glance!==void 0,h=new Set(n.glance?[]:n.blanks??[]),$=[...new Set(g?u:[...u,...je(e),...Object.keys(t)])].filter(f=>Object.hasOwn(t,f)||h.has(f)).map(f=>[f,t[f]]);for(let[f,o]of $){if(d.has(f)||ge(e,f))continue;let p=c?.[f];if(h.has(f)&&!U(p)&&!V(p)&&(o==null||o===""||Array.isArray(o)&&o.length===0)){s.push({key:f,label:R(e,f),value:"",stored:"",alone:"",long:!1,blank:!0});continue}if(o==null)continue;let y=r?.format?.[f],k=y?[]:ie(o);if(k[0]&&n.glance)continue;let b=e?.fields?.shape?.[f],_=!y&&typeof o=="string"&&U(b)?o:void 0,x=!y&&typeof o=="string"&&ue(b);if(_&&n.glance)continue;let D=y?void 0:V(b),w=D?{relation:D,refs:de(o,D)}:void 0;if(w&&(n.glance||w.refs.length===0)||!k[0]&&typeof o=="object"&&(!Array.isArray(o)||o.some(m=>typeof m=="object"&&m!==null))&&y===void 0)continue;let Z=typeof o=="string"&&!y?we(o,t[`${f}Repeat`],{locale:n.locale}):void 0,F=k[0]?k.map(m=>`${m.caption?`${m.name} \u2014 ${m.caption}`:m.name}${oe(m)?` (${re(m)})`:""}`).join(", "):Array.isArray(o)?o.join(", "):typeof o=="boolean"?o?"Yes":"No":String(o),T=y?void 0:he(e,f),B=be(T,o),H=!y&&!T&&typeof o=="number"?O(e?.fields?.shape?.[f])??me(e,f):void 0,j=w?w.refs.length>1?`${w.refs.length} linked records`:"linked record":y?y(o):H?ye(o,H):ke(T,o,n.locale)??(Array.isArray(o)||typeof o=="boolean"?F:typeof o=="string"&&Z!==void 0?Z:typeof o=="string"&&v.test(o)&&(o.length===10||Fe(e,f))?S(o,n.locale):typeof o=="string"&&E.test(o)?J(o,n.locale,n.timeZone):typeof o=="string"&&Te(e,f)?P(e,f,o):F),X=typeof o=="string"&&Ie(e,f,j),A=(n.glance||n.excerpt)&&!y&&(X||x)?pe(j,{markdown:x}):j;if(a.includes(A)||l.some(m=>A.startsWith(m))||n.glance&&(typeof o=="string"||typeof o=="number")&&a.some(m=>Me(m,A)))continue;let L=R(e,f),xe=typeof o=="number"?`${L} ${A}`:typeof o=="boolean"&&!y?`${L}: ${A.toLowerCase()}`:A;if(s.push({key:f,label:L,value:A,stored:F,alone:xe,long:X,...x?{markdown:!0}:{},...k[0]?{files:k}:{},..._?{app:_}:{},...w?{linked:w}:{},...B?{href:B}:{},...ae(c?.[`${f}Repeat`])?{repeats:!0}:{}}),n.limit!==void 0&&s.length>=n.limit)break}return ze(s,e)}function ze(t,e){let n=new Map;for(let r of t){let d=De(e,r.key);d&&n.set(r.key,new Set(d.map(a=>P(e,r.key,a).toLowerCase())))}return n.size<2?t:t.map(r=>{let d=n.get(r.key);return d!==void 0&&[...n].some(([l,s])=>l!==r.key&&[...d].some(c=>s.has(c)))?{...r,alone:`${r.label}: ${r.value.toLowerCase()}`}:r})}function De(t,e){let n=t?.fields?.shape?.[e];for(let r=0;r<6&&n?._zod?.def?.innerType!==void 0;r++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"&&n._zod.def.entries?Object.values(n._zod.def.entries).map(String):void 0}function Fe(t,e){let n=t?.fields?.shape?.[e]?._zod?.def;for(let r=0;r<6&&n?.innerType!==void 0;r++)n=n.innerType._zod?.def;return n?.type==="string"&&(n.checks??[]).some(r=>r._zod?.def?.pattern?.source===v.source)}function Te(t,e){let n=t?.fields?.shape?.[e];for(let r=0;r<6&&n?._zod?.def?.innerType!==void 0;r++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"}function je(t){let e=t?.fields?.shape;return[...Object.keys(e??{}),...Object.keys(t?.computed??{})]}function Ae(t){return[...t?.fields??[],...(t?.groups??[]).flatMap(e=>e.fields)]}var Le=500,We=160;function Ce(t){let e=t;for(let n=0;n<6&&e?._zod?.def?.innerType!==void 0;n++)e=e._zod.def.innerType;return e?._zod?.def?.type==="string"?e._zod.def:void 0}function Ie(t,e,n){return Ce(t?.fields?.shape?.[e])?.checks?.some(d=>d._zod?.def?.check==="max_length"&&(d._zod.def.maximum??0)>Le)?!0:typeof n=="string"&&(n.includes(`
2
2
  `)||n.length>We)}function un(t,e){let n=t?.display?.page,r=n?.groups??[],d=new Map(e.map(i=>[i.key,i])),a=new Set(Ae(n)),l=i=>i.flatMap(u=>d.has(u)?[d.get(u)]:[]),s=e.filter(i=>!a.has(i.key));return[{fields:[...l(n?.fields??[]),...r.length>0?[]:s]},...r.map(i=>({title:i.title,fields:l(i.fields)})),...r.length>0?[{title:"Details",fields:s}]:[]].filter(i=>i.fields.length>0)}function Ue(t,e,n){let r=[...e?.creates??[],...e?.subject&&e.subject.kinds!=="*"?e.subject.kinds:[]];for(let d of r){let a=t.tryDefinition(d),l=a?.fields?.shape??{};if(!a||!(n in l))continue;let s=a.display?.format?.[n];return{label:a.display?.labels?.[n]??R(a,n),option:i=>s?s(i):I(i)}}return{label:R(void 0,n),option:d=>I(d)}}function gn(t,e,n){if(n instanceof ce){let r=e.find(a=>a.name===n.mutation);return`Not yet: ${n.issues.map(a=>{let l=a.path.length>0?Ue(t,r,String(a.path[0])).label:void 0;return l?`${l} \u2014 ${ne(a.message)}`:a.message}).join("; ")}.`}return n instanceof Error?n.message:String(n)}var Ve=t=>/^[A-Z]{3}$/.test(t??"");function $e(t){let{format:e,unit:n,currency:r,locale:d,places:a}=t,l=Ve(n),s=e==="money"||!e&&l,c=s?l?n:r:void 0;return{...s?{format:"money"}:e?{format:e}:{},...n&&!(s&&l)?{unit:n}:{},...c?{currency:c}:{},...d?{locale:d}:{},...s&&a===0?{places:a}:{}}}function kn(t){switch(t.format){case"money":return t.currency?`An amount of money in ${t.currency}: a plain number, 1250.5 for 1,250.50 ${t.currency}.`:"An amount of money, in no named currency: a plain number.";case"percent":return"A fraction said as a percent: 0.15 is 15%.";default:return t.unit?`A number of ${t.unit}.`:"A number."}}function Re(t){let e=W(t)?.innerType;return e===void 0?t:Re(e)}var Ge={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ke=t=>(t?._zod?.def?.checks??[]).map(e=>e._zod?.def).filter(e=>e!==void 0);function _e(t){let e=Re(t),n=W(e),r=n?.type,d=Ke(e);if(r==="enum")return{type:"choice",options:Object.keys(n?.entries??{})};let a=se(e);if(a)return a==="image"?{type:"file",image:!0}:a==="video"?{type:"file",video:!0}:{type:"file"};if(r==="boolean")return{type:"boolean"};if(r==="array"){let l=_e(n?.element);return l.type==="unknown"?{type:"unknown"}:{type:"several",of:l}}if(r==="number"){let l,s,c;for(let i of d){i.check==="multiple_of"&&typeof i.value=="number"?c=i.value:i.check==="number_format"&&(i.format==="safeint"||i.format==="int32"||i.format==="uint32")&&(c??=1);let u=i.check==="number_format"&&i.format?Ge[i.format]:void 0,g=u?u[0]:i.check==="greater_than"&&i.inclusive&&typeof i.value=="number"?i.value:void 0,h=u?u[1]:i.check==="less_than"&&i.inclusive&&typeof i.value=="number"?i.value:void 0;g!==void 0&&(l=l===void 0?g:Math.max(l,g)),h!==void 0&&(s=s===void 0?h:Math.min(s,h))}return{type:"number",...l===void 0?{}:{min:l},...s===void 0?{}:{max:s},...c===void 0?{}:{step:c},...K(e)==="duration"?{duration:!0}:{},...O(t)?{amount:$e(O(t))}:{}}}if(r==="string"){if(d.some(u=>u.fn===Y||u.format==="datetime")||n?.format==="datetime")return{type:"date",time:!0,instant:!0};let s=[n?.pattern,...d.map(u=>u.pattern)].filter(u=>u instanceof RegExp).map(u=>u.source);if(s.some(u=>u.includes("\\d{4}")))return s.some(u=>u.includes("\\d{2}:\\d{2}"))?{type:"date",time:!0}:s.includes(v.source)?{type:"date",partial:!0}:{type:"date"};let c=d.some(u=>u.check==="max_length"&&typeof u.maximum=="number"&&u.maximum>500),i=K(e);return c?{type:"text",long:!0}:i==="phone"||i==="place"?{type:"text",holds:i}:{type:"text"}}return{type:"unknown"}}function vn(t,e){let n=t?.shape;return!n||!(e in n)?{type:"unknown"}:_e(n[e])}export{Oe as a,ln as b,fn as c,Ne as d,un as e,$e as f,kn as g,Re as h,_e as i,vn as j,Ue as k,gn as l};
@@ -1 +1 @@
1
- import{G as C,Ra as H,T as F,Ta as A}from"./chunk.CYTTZOYL.js";import"./chunk.SDO3U72B.js";import"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as x}from"./chunk.AJZBJBMO.js";var t=x(C(),1),f=x(F(),1),q={faces:'[data-testid="app-faces"]',problems:'[data-testid="standing"], [data-testid="standing-link"]',activity:'[data-testid="activity-button"]',ask:'[data-testid="app-find"], [data-testid="app-find-open"]',find:'[data-testid="app-find"], [data-testid="app-find-open"]',profile:'[data-testid="profile-button"]',home:'[data-testid="app-home"]'};function D(e){if(!e.isConnected||e.closest("[hidden], [inert], [aria-hidden='true']"))return!1;if(typeof e.checkVisibility!="function")return!0;if(!e.checkVisibility({visibilityProperty:!0}))return!1;let a=e.getBoundingClientRect();return a.width>1&&a.height>1}function E(e,a){if(!e||a==="ask"&&!e.querySelector("[data-graview-quick-ask]"))return null;for(let d of e.querySelectorAll(q[a]))if(D(d))return d;return null}function W(e){let a=(u,h,c)=>e.querySelector(u)?.getAttribute(h)?.trim()||c,d=a('[data-testid="app-face-scene"]',"title","Scene"),n=a('[data-testid="app-face-pages"]',"title","Pages");return[{anchor:"faces",title:`${d} or ${n}`,words:`One app, two ways to see it: ${d} draws every record as one picture, ${n} as lists and pages to read and change.`},{anchor:"problems",title:"Whether all is in order",words:"The dot is green while every rule holds. When one is broken it counts what is wrong, and pressing it shows each one and where."},{anchor:"activity",title:"Activity",words:"What has happened here and who did it, each change with its way back."},{anchor:"ask",title:"Ask",words:"Press \u2318K (Ctrl+K) to ask about what you have selected, or right-click it and choose Ask about this\u2026. The answer stands beside it, and a change it proposes waits for you to accept it."}]}var R=300,O=1200,$=15e3;function _({root:e,steps:a,onEnd:d}){let[n,u]=(0,t.useState)(null),h=(0,t.useRef)(null),c=(0,t.useRef)(!1),p=(0,t.useRef)(d);p.current=d,(0,t.useEffect)(()=>{let r=Date.now(),o=Date.now(),s=null,i,v=new MutationObserver(()=>o=Date.now());v.observe(document.body,{childList:!0,subtree:!0});let k=()=>{let L=e(),S=Date.now();if(L?.querySelector('[data-testid="app-bar"]')){if(s??=S,S-o>=R||S-s>=O){let T=[...W(L),...a].filter(P=>E(L,P.anchor)!==null);if(T.length===0){c.current=!0,p.current(null);return}h.current=document.activeElement,u({list:T,at:0});return}}else if(S-r>=$){c.current=!0,p.current(null);return}i=setTimeout(k,100)};return i=setTimeout(k,100),()=>{clearTimeout(i),v.disconnect()}},[]);let y=(0,t.useCallback)(()=>{let r=h.current;(r instanceof HTMLElement&&r!==document.body&&r.isConnected?r:e()?.querySelector('[data-testid="app-home"]'))?.focus({preventScroll:!0})},[e]),m=(0,t.useCallback)((r,o)=>{if(c.current)return;c.current=!0;let s=document.querySelector("[data-testid='first-look']"),i=document.activeElement,v=i===null||i===document.body||s!==null&&s.contains(i);u(null),p.current(r),!(!o&&!v)&&(y(),requestAnimationFrame(()=>{let k=document.activeElement;(k===null||k===document.body)&&y()}))},[y]),b=(0,t.useCallback)((r,o)=>{let s=e();for(let i=o;i<r.length;i++)if(E(s,r[i].anchor))return i;return-1},[e]),g=(0,t.useCallback)(()=>{if(!n)return;let r=b(n.list,n.at+1);r<0?m("finished",!0):u({list:n.list,at:r})},[n,b,m]);if((0,t.useEffect)(()=>{if(!n)return;let r=e();if(!r)return;let o=0,s=()=>{cancelAnimationFrame(o),o=requestAnimationFrame(()=>{E(e(),n.list[n.at].anchor)||g()})},i=new MutationObserver(s);return i.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden","class","data-switch-drawn"]}),()=>{cancelAnimationFrame(o),i.disconnect()}},[n,e,g]),!n)return null;let w=n.list[n.at],l=b(n.list,n.at+1)<0;return(0,f.jsx)(I,{root:e,step:w,position:n.at+1,total:n.list.length,last:l,onNext:g,onEnd:m},n.at)}var N={...H,width:"min(320px, calc(100vw - 24px))",maxHeight:"min(70vh, 420px)",overflow:"auto",padding:"12px 14px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)",fontSize:"0.875rem",lineHeight:1.45,overflowWrap:"anywhere"},M={minHeight:32,padding:"0 12px",borderRadius:8,font:"inherit",fontWeight:600,cursor:"pointer"};function I({root:e,step:a,position:d,total:n,last:u,onNext:h,onEnd:c}){let p=(0,t.useRef)(null),y=(0,t.useRef)(null),m=(0,t.useId)().replace(/:/g,""),b=(0,t.useMemo)(()=>({get current(){return E(e(),a.anchor)}}),[e,a.anchor]),[g]=(0,t.useState)(()=>{let l=b.current?.getBoundingClientRect(),r=typeof document>"u"?0:document.documentElement.clientWidth||innerWidth;return l&&l.left+l.width/2<r/2?"start":"end"});A(p,!0,b,{align:g}),(0,t.useLayoutEffect)(()=>{y.current?.focus({preventScroll:!0})},[]);let w=(0,t.useRef)(c);return w.current=c,(0,t.useEffect)(()=>{let l=o=>{o.target instanceof Node&&p.current?.contains(o.target)||w.current("dismissed",!1)},r=o=>{if(o.key!=="Escape"||o.defaultPrevented)return;let s=o.target;s instanceof Node&&p.current?.contains(s)||s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||[...document.querySelectorAll("[data-graview-overlay]:not([hidden])")].some(i=>i!==p.current)||w.current("dismissed",!0)};return document.addEventListener("pointerdown",l,!0),document.addEventListener("keydown",r),()=>{document.removeEventListener("pointerdown",l,!0),document.removeEventListener("keydown",r)}},[]),(0,f.jsxs)("div",{ref:p,popover:"manual",role:"dialog","aria-modal":"false","aria-labelledby":`${m}-title`,"aria-describedby":`${m}-words`,tabIndex:-1,"data-testid":"first-look","data-first-look-anchor":a.anchor,"data-graview-overlay":"",onKeyDown:l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),c("dismissed",!0))},style:N,children:[(0,f.jsxs)("p",{style:{margin:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},"data-testid":"first-look-count",children:[d," of ",n]}),(0,f.jsx)("p",{id:`${m}-title`,style:{margin:"2px 0 4px",fontWeight:600,fontSize:"0.9375rem"},"data-testid":"first-look-title",children:a.title}),(0,f.jsx)("p",{id:`${m}-words`,style:{margin:0},"data-testid":"first-look-words",children:a.words}),(0,f.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-end",gap:8,marginTop:12},children:[u?null:(0,f.jsx)("button",{type:"button","data-testid":"first-look-skip",onClick:()=>c("dismissed",!0),style:{...M,fontWeight:500,border:"1px solid transparent",background:"none",color:"var(--graview-ink-muted)"},children:"Skip"}),(0,f.jsx)("button",{ref:y,type:"button","data-testid":u?"first-look-done":"first-look-next",onClick:()=>u?c("finished",!0):h(),style:{...M,border:"1px solid var(--graview-accent)",background:"var(--graview-accent)",color:"var(--graview-accent-ink)"},children:u?"Done":"Next"})]})]})}export{_ as FirstLookHints,E as firstLookAnchor};
1
+ import{G as C,Ta as H,V as F,Va as A}from"./chunk.VLX7YWVH.js";import"./chunk.SDO3U72B.js";import"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.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,5 +1,5 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{q as v}from"./chunk.KZUMXT5J.js";import{G as B,Ia as w,J as h,T as n,ba as S}from"./chunk.CYTTZOYL.js";import{a as y}from"./chunk.SDO3U72B.js";import{qd as k}from"./chunk.Q4MI53KK.js";import{b as s}from"./chunk.AJZBJBMO.js";var b=s(n(),1),R=v.part(e=>(0,b.jsx)(e.ActivityRail,{calls:[]}),{quiet:!0});var p=s(n(),1),A=e=>e.tabIndex>=0&&!e.disabled&&e.getClientRects().length>0;function T(e){if(!e)return!1;if(A(e))return e.focus({preventScroll:!1}),!0;let o=[...e.querySelectorAll("a[href], button, input, select, textarea, [tabindex]")].find(A);return o?(o.focus(),!0):(e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),e.focus(),!0)}var I=`.graview-skips{display:contents}
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{r as v}from"./chunk.3FKKH2XU.js";import{G as B,J as h,Ka as w,V as n,da as S}from"./chunk.VLX7YWVH.js";import{a as y}from"./chunk.SDO3U72B.js";import{sd as k}from"./chunk.IQGSEAQ2.js";import{b as s}from"./chunk.AJZBJBMO.js";var b=s(n(),1),T=v.part(e=>(0,b.jsx)(e.ActivityRail,{calls:[]}),{quiet:!0});var p=s(n(),1),A=e=>e.tabIndex>=0&&!e.disabled&&e.getClientRects().length>0;function R(e){if(!e)return!1;if(A(e))return e.focus({preventScroll:!1}),!0;let o=[...e.querySelectorAll("a[href], button, input, select, textarea, [tabindex]")].find(A);return o?(o.focus(),!0):(e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),e.focus(),!0)}var I=`.graview-skips{display:contents}
2
2
  .graview-skip{position:absolute;width:0;height:0;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
3
3
  .graview-skip:focus{width:auto;height:auto;overflow:visible;clip-path:none;padding:6px 12px;border-radius:8px;border:1px solid var(--graview-accent);background:var(--graview-float,var(--graview-panel));color:var(--graview-ink);font:inherit;font-size:.875rem;font-weight:600;box-shadow:var(--graview-lift-high);outline:2px solid var(--graview-accent);outline-offset:1px}
4
4
  .graview-skips[data-place=bar] .graview-skip:focus{position:fixed;left:8px;top:6px;z-index:${k("toast")}}
5
- .graview-skips[data-place=here] .graview-skip:focus{position:static;justify-self:start}`;function O({to:e,place:o="bar"}){return e.length===0?null:(0,p.jsxs)("span",{className:"graview-skips","data-place":o,children:[(0,p.jsx)("style",{children:I}),e.map(r=>(0,p.jsx)("button",{type:"button",className:"graview-skip","data-graview-skip":r.testid,"data-testid":`skip-${r.testid}`,...r.opens?{"data-graview-skip-opens":""}:{},onClick:r.go,children:r.label},r.testid))]})}var a=s(B(),1),f=s(n(),1),C=w(y(()=>(__graviewPreload(import.meta.url,["./chunk.OXWOUE3W.js","./chunk.34DRUCH2.js","./chunk.KXFNRJ46.js","./chunk.OMRQTLI5.js","./chunk.MIE3ODQ2.js","./chunk.NEPQBMFT.js","./chunk.MBB5A6BT.js","./chunk.ERPILTRY.js","./chunk.H7AH3IW4.js","./chunk.DDFRFSVN.js","./chunk.U5P23GO7.js","./chunk.YOUB3J3Y.js","./chunk.GZHZLJBF.js","./chunk.WUVXIUA7.js","./chunk.OJGHDWI6.js","./chunk.BN7C5ZYX.js","./chunk.REUMBCSV.js","./chunk.2KIWGQXC.js","./chunk.D5LOTCBU.js","./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.JNIDS66Z.js")))),F=C.part((e,o)=>{let r=e.RecordInteractions;return(0,f.jsx)(r,{...o})},{quiet:!0});function D(e,o,r){let t=e.target;return(t.on==="record"||t.on==="field"?t.id===o:t.on==="selection"?t.ids.includes(o):t.on==="act"?t.id===o:!1)||e.offered.some(i=>i.id===`record:${o}`||i.id.startsWith(`fill:${o}:`))||(e.batches??[]).some(i=>r(i).includes(o))}function E({id:e,style:o,headingStyle:r,className:t}){let{ai:m,aiDesk:i,store:l}=S(),{entries:u}=h(i),c=m.off===!0;(0,a.useEffect)(()=>{c||i.load()},[i,c]);let L=l.log.length,x=(0,a.useMemo)(()=>{let P=d=>l.log.all().flatMap(g=>g.batch===d?g.writes:[]);return u.filter(d=>D(d,e,P))},[u,e,l,L]);return c||x.length===0?null:(0,f.jsx)(a.Suspense,{fallback:null,children:(0,f.jsx)(F,{entries:x,...o?{style:o}:{},...r?{headingStyle:r}:{},...t?{className:t}:{}})})}export{R as a,T as b,O as c,E as d};
5
+ .graview-skips[data-place=here] .graview-skip:focus{position:static;justify-self:start}`;function O({to:e,place:o="bar"}){return e.length===0?null:(0,p.jsxs)("span",{className:"graview-skips","data-place":o,children:[(0,p.jsx)("style",{children:I}),e.map(r=>(0,p.jsx)("button",{type:"button",className:"graview-skip","data-graview-skip":r.testid,"data-testid":`skip-${r.testid}`,...r.opens?{"data-graview-skip-opens":""}:{},onClick:r.go,children:r.label},r.testid))]})}var a=s(B(),1),f=s(n(),1),C=w(y(()=>(__graviewPreload(import.meta.url,["./chunk.ATHLE33D.js","./chunk.T4TRJDBF.js","./chunk.APUQIELA.js","./chunk.S6QZBWCJ.js","./chunk.LTOQ22ZJ.js","./chunk.2TCOLAL2.js","./chunk.FUPYIOXZ.js","./chunk.3OEODIHB.js","./chunk.X36BYTEG.js","./chunk.K2PXP5H6.js","./chunk.U5P23GO7.js","./chunk.GH5UBSQI.js","./chunk.GZHZLJBF.js","./chunk.3SAESG6X.js","./chunk.OJGHDWI6.js","./chunk.F6BNFLQM.js","./chunk.75JQCTR6.js","./chunk.5IEZF433.js","./chunk.5AD2QHWH.js","./chunk.3FKKH2XU.js","./chunk.DLWFULWE.js","./chunk.VLX7YWVH.js","./chunk.SDO3U72B.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.SL5FXE3R.js")))),F=C.part((e,o)=>{let r=e.RecordInteractions;return(0,f.jsx)(r,{...o})},{quiet:!0});function D(e,o,r){let t=e.target;return(t.on==="record"||t.on==="field"?t.id===o:t.on==="selection"?t.ids.includes(o):t.on==="act"?t.id===o:!1)||e.offered.some(i=>i.id===`record:${o}`||i.id.startsWith(`fill:${o}:`))||(e.batches??[]).some(i=>r(i).includes(o))}function E({id:e,style:o,headingStyle:r,className:t}){let{ai:m,aiDesk:i,store:l}=S(),{entries:u}=h(i),c=m.off===!0;(0,a.useEffect)(()=>{c||i.load()},[i,c]);let L=l.log.length,x=(0,a.useMemo)(()=>{let P=d=>l.log.all().flatMap(g=>g.batch===d?g.writes:[]);return u.filter(d=>D(d,e,P))},[u,e,l,L]);return c||x.length===0?null:(0,f.jsx)(a.Suspense,{fallback:null,children:(0,f.jsx)(F,{entries:x,...o?{style:o}:{},...r?{headingStyle:r}:{},...t?{className:t}:{}})})}export{T as a,R as b,O as c,E as d};
@@ -1 +1 @@
1
- import{E as x,P as $,R as N,S as O,U as W,V as I,Z as p}from"./chunk.Q4MI53KK.js";var h=864e5,z=/^(\d{4})-(\d{2})-(\d{2})/,y=e=>String(e).padStart(2,"0"),D=e=>new Date(e).toISOString().slice(0,10),f=e=>Date.UTC(+e.slice(0,4),+e.slice(5,7)-1,+e.slice(8,10)),b=(e,t)=>D(f(e)+t*h),F=e=>new Date(f(e)).getUTCDay();function m(e,t,r){if(!(t>=1&&t<=12&&r>=1&&r<=31))return;let i=`${String(e).padStart(4,"0")}-${y(t)}-${y(r)}`;return D(f(i))===i?i:void 0}function E(e=new Date){let t=N();return t?W(e.getTime(),t):{day:`${e.getFullYear()}-${y(e.getMonth()+1)}-${y(e.getDate())}`,minutes:e.getHours()*60+e.getMinutes()}}var w=e=>/T\d\d:\d\d(:[\d.]+)?(Z|[+-]\d\d:?\d\d)$/.test(e);function g(e){if(typeof e!="string")return;if(w(e)){let i=new Date(e);return Number.isNaN(i.getTime())?void 0:E(i)}let t=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!t||!m(Number(t[1]),Number(t[2]),Number(t[3])))return;let r=e.slice(0,10);return t[4]===void 0?{day:r}:{day:r,minutes:Number(t[4])*60+Number(t[5])}}function A(e,t){if(!t.time)return e.day;let r=e.minutes??9*60;if(!t.instant)return`${e.day}T${y(Math.floor(r/60))}:${y(r%60)}`;let i=N(),[,n,o,d]=z.exec(e.day);return(i?new Date(I(e.day,r,i)):new Date(Number(n),Number(o)-1,Number(d),Math.floor(r/60),r%60)).toISOString().replace(/\.\d{3}Z$/,"Z")}function C(e,t=new Date){let r=O(),i=r;try{i=new Intl.DateTimeFormat(e??x,{timeZoneName:"short",timeZone:r}).formatToParts(t).find(n=>n.type==="timeZoneName")?.value??r}catch{i=r}return{zone:r,short:i}}function H(e,t,r,i){let n=g(t);if(!n)return r;let o=e===void 0?void 0:g(e),d=r===void 0?void 0:g(r),s=u=>f(u.day)+(u.minutes??0)*6e4,a=(u,l)=>{let c=s(u)+l;return{day:D(c),...i.time?{minutes:Math.round(c%h/6e4)}:{}}};return o&&d?A(a(d,s(n)-s(o)),i):d&&s(d)>=s(n)?r:i.time?A(a(n,36e5),i):r}var Y=/^(start|starts|startsAt|startsOn|startAt|begins|from|opens|checkIn)$/i,B=/^(end|ends|endsAt|endsOn|endAt|until|to|finish|finishes|closes|through|checkOut)$/i;function Z(e,t={}){let r=(t.start&&e.includes(t.start)?t.start:void 0)??e.find(n=>Y.test(n)),i=(t.end&&e.includes(t.end)?t.end:void 0)??e.find(n=>n!==r&&B.test(n));return r&&i?{start:r,end:i}:void 0}var k=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],K=["sun","mon","tue","wed","thu","fri","sat"],S="(jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|june?|july?|aug(?:ust)?|sept?(?:ember)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?)",R="(sun(?:day)?|mon(?:day)?|tue(?:s|sday)?|wed(?:nesday)?|thu(?:r|rs|rsday)?|fri(?:day)?|sat(?:urday)?)",_=e=>k.indexOf(e.slice(0,3))+1,M=e=>e===void 0?void 0:e.length===2?2e3+Number(e):Number(e);function U(e){try{let t=new Intl.DateTimeFormat(e,{month:"numeric",day:"numeric"}).formatToParts(0).map(r=>r.type);return t.indexOf("month")<t.indexOf("day")}catch{return!0}}function v(e){let t=(n,o)=>({minutes:o,rest:`${e.slice(0,n.index)} ${e.slice(n.index+n[0].length)}`}),r=/\b(noon|midday)\b/.exec(e);if(r)return t(r,12*60);if(r=/\bmidnight\b/.exec(e),r)return t(r,0);if(r=/\b(\d{1,2})(?::(\d{2}))?\s*([ap])\.?m?\.?(?=\s|$)/.exec(e),r){let n=Number(r[1]),o=Number(r[2]??0);return n<1||n>12||o>59?{rest:e,bad:!0}:t(r,(n%12+(r[3]==="p"?12:0))*60+o)}if(r=/\b(\d{1,2}):(\d{2})\b/.exec(e),r){let n=Number(r[1]),o=Number(r[2]);return n>23||o>59?{rest:e,bad:!0}:t(r,n*60+o)}if(r=/\bat\s+(\d{1,2})\b/.exec(e),r){let n=Number(r[1]);return n>23?{rest:e,bad:!0}:t(r,(n>=1&&n<=7?n+12:n)*60)}let i=/\b(morning|afternoon|evening|tonight)\b/.exec(e);return i?{minutes:{morning:9,afternoon:15,evening:18,tonight:20}[i[1]]*60,rest:i[1]==="tonight"?`${e.slice(0,i.index)} today ${e.slice(i.index+i[0].length)}`:`${e.slice(0,i.index)} ${e.slice(i.index+i[0].length)}`}:{rest:e}}function G(e,t,r){let i=e.replace(/\b(on|at|the|of|this)\b/g," ").replace(/\s+/g," ").trim();if(i==="")return null;if(i==="today"||i==="now")return t;if(i==="tomorrow"||i==="tmrw"||i==="tmr")return b(t,1);if(i==="yesterday")return b(t,-1);if(i==="next week")return b(t,7);let n=/^in (\d{1,3}) (day|days|week|weeks)$/.exec(i);if(n)return b(t,Number(n[1])*(n[2].startsWith("week")?7:1));if(n=new RegExp(`^(next )?${R}$`).exec(i),n){let u=(K.indexOf(n[2].slice(0,3))-F(t)+7)%7;return b(t,n[1]&&u===0?7:u)}if(n=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(i),n)return m(Number(n[1]),Number(n[2]),Number(n[3]));let o=i.replace(new RegExp(`^${R} `),"");n=new RegExp(`^(\\d{1,2})(?:st|nd|rd|th)? ${S}(?: (\\d{4}))?$`).exec(o);let d=n?{date:n[1],month:n[2],year:n[3]}:void 0;n=new RegExp(`^${S} (\\d{1,2})(?:st|nd|rd|th)?(?: (\\d{4}))?$`).exec(o);let s=d??(n?{date:n[2],month:n[1],year:n[3]}:void 0);if(s)return j(t,M(s.year),_(s.month),Number(s.date));if(n=/^(\d{1,2})[/.-](\d{1,2})(?:[/.-](\d{2}|\d{4}))?$/.exec(o),n){let[a,u]=[Number(n[1]),Number(n[2])],[l,c]=U(r)?[a,u]:[u,a];return j(t,M(n[3]),l,c)}}function j(e,t,r,i){if(t!==void 0)return m(t,r,i);let n=Number(e.slice(0,4)),o=m(n,r,i);return o===void 0?m(n+1,r,i):f(e)-f(o)>183*h?m(n+1,r,i):o}function X(e){if(typeof e=="number")return Number.isInteger(e)&&e>=1e3&&e<=9999?String(e):void 0;let t=String(e).trim().toLowerCase().replace(/,/g," ").replace(/\s+/g," ");if(/^\d{4}$/.test(t))return Number(t)>=1e3?t:void 0;let r=(n,o)=>o>=1&&o<=12&&Number(n)>=1e3?`${n}-${String(o).padStart(2,"0")}`:void 0,i=/^(\d{4})[-/](\d{1,2})$/.exec(t);if(i)return r(i[1],Number(i[2]));if(i=/^(\d{1,2})\/(\d{4})$/.exec(t),i)return r(i[2],Number(i[1]));if(i=new RegExp(`^${S}\\.? (\\d{4})$`).exec(t),i)return r(i[2],_(i[1]))}function q(e,t){let r=e.trim();if(w(r)){let s=g(r);if(s)return t.time?s:{day:s.day}}let i=e.toLowerCase().replace(/,/g," ").replace(/(\d{4}-\d{2}-\d{2})t(\d\d:\d\d)(:\d\d(\.\d+)?)?/,"$1 $2").replace(/\s+/g," ").trim();if(i==="")return;let n=v(i);if(n.bad)return;let o=G(n.rest,t.today,t.locale??x);if(o===void 0||o===null&&n.minutes===void 0)return;let d=o??t.base?.day??t.today;return t.time?{day:d,minutes:n.minutes??t.base?.minutes??9*60}:{day:d}}function J(e){if(e===void 0||e==="web"||e.startsWith("ai:")||e.startsWith("app:"))return;if(e==="api")return"via the API";if(e==="cli")return"via the command line";let[t,...r]=e.split(":"),i=r.join(":");return(t==="mcp"||t==="view")&&i?`via ${i}`:t==="mcp"?"via an agent's tools":`via ${e}`}var L=e=>{if(!e.currency)return{before:!0};try{let t=$(e.locale),r=new Intl.NumberFormat(t,{style:"currency",currency:e.currency}).formatToParts(1),i=r.findIndex(d=>d.type==="currency"),n=r.findIndex(d=>d.type==="integer"),o;try{o=new Intl.DisplayNames([t],{type:"currency"}).of(e.currency)}catch{}return{...i>=0?{symbol:r[i].value}:{},before:i<n,...o?{name:o}:{}}}catch{return{symbol:e.currency,before:!0}}};function Q(e){let t=e.locale;if(e.format==="money"){let{symbol:r,before:i,name:n}=L(e),o=p(1250,t,{minimumFractionDigits:2,maximumFractionDigits:2});return{...r?i?{prefix:r}:{suffix:r}:{},placeholder:o,hint:n?`in ${n}`:e.currency?`in ${e.currency}`:"an amount of money"}}return e.format==="percent"?{suffix:"%",placeholder:p(15,t),hint:"as a percent"}:{...e.unit?{suffix:e.unit}:{},placeholder:"",hint:e.unit?`in ${e.unit}`:"a number"}}function V(e,t){return e===void 0||!Number.isFinite(e)?"":t.format==="money"?p(e,t.locale,Number.isInteger(e)?{maximumFractionDigits:0}:{minimumFractionDigits:2,maximumFractionDigits:2}):t.format==="percent"?p(e*100,t.locale,{maximumFractionDigits:4}):p(e,t.locale,{maximumFractionDigits:6})}function ee(e){try{let t=new Intl.NumberFormat($(e)).formatToParts(12345.6);return{group:t.find(r=>r.type==="group")?.value??",",decimal:t.find(r=>r.type==="decimal")?.value??"."}}catch{return{group:",",decimal:"."}}}function ne(e,t){let{group:r,decimal:i}=ee(t),n=e.replace(/[\s  ']/g,"").replace(/[−–]/g,"-");if(i!=="."&&!n.includes(i)&&/^-?\d+\.\d{1,2}$/.test(n))return Number(n);if(r&&(n=n.split(r).join("")),i!=="."&&(n=n.replace(i,".")),!/^-?(\d+\.?\d*|\.\d+)$/.test(n))return;let o=Number(n);return Number.isFinite(o)?o:void 0}function te(e,t){let r=e.trim();if(r==="")return;let i=t?.format==="money"&&t.currency?L(t).symbol:void 0,n=r;i&&(n=n.split(i).join("")),t?.currency&&(n=n.replace(new RegExp(t.currency,"gi"),"")),n=n.replace(/^[$€£¥₹]|[$€£¥₹]$/g,""),/%\s*$/.test(n)&&(n=n.replace(/%\s*$/,"")),t?.unit&&t.format!=="money"&&(n=n.replace(new RegExp(`\\s*${t.unit.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*$`),""));let d=ne(n,t?.locale);if(d!==void 0)return t?.format==="percent"?d/100:d}var T=/^[0-9a-f]{32}$/,P=e=>e.replace(/-/g,"").toLowerCase();function re(e,t,r){if(!(!e||typeof e!="object"))for(let[i,n]of Object.entries(e)){if(!n||typeof n!="object")continue;if(n.system==="google-calendar"&&n.kind===t)return{connection:i,system:"google-calendar",words:"Google Calendar"};if(n.system!=="notion")continue;let d=(Array.isArray(n.sources)?n.sources:[{kind:n.kind,source:n.source}]).find(c=>c&&c.kind===t);if(!d)continue;let s=typeof d.source=="string"&&!T.test(P(d.source))?d.source:void 0,a=r.startsWith(`${t}:${i}-`)?r.slice(`${t}:${i}-`.length):void 0,u=typeof n.database=="string"?P(n.database):void 0,l=a&&T.test(a)?a:u&&T.test(u)?u:void 0;return{connection:i,system:"notion",words:s?`Notion \xB7 ${s}`:"Notion",...l?{href:`https://www.notion.so/${l}`}:{}}}}export{J as a,Q as b,V as c,te as d,E as e,w as f,g,A as h,C as i,H as j,Z as k,X as l,q as m,re as n};
1
+ import{E as x,P as $,R as N,S as O,U as W,V as I,Z as p}from"./chunk.IQGSEAQ2.js";var h=864e5,z=/^(\d{4})-(\d{2})-(\d{2})/,y=e=>String(e).padStart(2,"0"),D=e=>new Date(e).toISOString().slice(0,10),f=e=>Date.UTC(+e.slice(0,4),+e.slice(5,7)-1,+e.slice(8,10)),b=(e,t)=>D(f(e)+t*h),F=e=>new Date(f(e)).getUTCDay();function m(e,t,r){if(!(t>=1&&t<=12&&r>=1&&r<=31))return;let i=`${String(e).padStart(4,"0")}-${y(t)}-${y(r)}`;return D(f(i))===i?i:void 0}function E(e=new Date){let t=N();return t?W(e.getTime(),t):{day:`${e.getFullYear()}-${y(e.getMonth()+1)}-${y(e.getDate())}`,minutes:e.getHours()*60+e.getMinutes()}}var w=e=>/T\d\d:\d\d(:[\d.]+)?(Z|[+-]\d\d:?\d\d)$/.test(e);function g(e){if(typeof e!="string")return;if(w(e)){let i=new Date(e);return Number.isNaN(i.getTime())?void 0:E(i)}let t=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!t||!m(Number(t[1]),Number(t[2]),Number(t[3])))return;let r=e.slice(0,10);return t[4]===void 0?{day:r}:{day:r,minutes:Number(t[4])*60+Number(t[5])}}function A(e,t){if(!t.time)return e.day;let r=e.minutes??9*60;if(!t.instant)return`${e.day}T${y(Math.floor(r/60))}:${y(r%60)}`;let i=N(),[,n,o,d]=z.exec(e.day);return(i?new Date(I(e.day,r,i)):new Date(Number(n),Number(o)-1,Number(d),Math.floor(r/60),r%60)).toISOString().replace(/\.\d{3}Z$/,"Z")}function C(e,t=new Date){let r=O(),i=r;try{i=new Intl.DateTimeFormat(e??x,{timeZoneName:"short",timeZone:r}).formatToParts(t).find(n=>n.type==="timeZoneName")?.value??r}catch{i=r}return{zone:r,short:i}}function H(e,t,r,i){let n=g(t);if(!n)return r;let o=e===void 0?void 0:g(e),d=r===void 0?void 0:g(r),s=u=>f(u.day)+(u.minutes??0)*6e4,a=(u,l)=>{let c=s(u)+l;return{day:D(c),...i.time?{minutes:Math.round(c%h/6e4)}:{}}};return o&&d?A(a(d,s(n)-s(o)),i):d&&s(d)>=s(n)?r:i.time?A(a(n,36e5),i):r}var Y=/^(start|starts|startsAt|startsOn|startAt|begins|from|opens|checkIn)$/i,B=/^(end|ends|endsAt|endsOn|endAt|until|to|finish|finishes|closes|through|checkOut)$/i;function Z(e,t={}){let r=(t.start&&e.includes(t.start)?t.start:void 0)??e.find(n=>Y.test(n)),i=(t.end&&e.includes(t.end)?t.end:void 0)??e.find(n=>n!==r&&B.test(n));return r&&i?{start:r,end:i}:void 0}var k=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],K=["sun","mon","tue","wed","thu","fri","sat"],S="(jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|june?|july?|aug(?:ust)?|sept?(?:ember)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?)",R="(sun(?:day)?|mon(?:day)?|tue(?:s|sday)?|wed(?:nesday)?|thu(?:r|rs|rsday)?|fri(?:day)?|sat(?:urday)?)",_=e=>k.indexOf(e.slice(0,3))+1,M=e=>e===void 0?void 0:e.length===2?2e3+Number(e):Number(e);function U(e){try{let t=new Intl.DateTimeFormat(e,{month:"numeric",day:"numeric"}).formatToParts(0).map(r=>r.type);return t.indexOf("month")<t.indexOf("day")}catch{return!0}}function v(e){let t=(n,o)=>({minutes:o,rest:`${e.slice(0,n.index)} ${e.slice(n.index+n[0].length)}`}),r=/\b(noon|midday)\b/.exec(e);if(r)return t(r,12*60);if(r=/\bmidnight\b/.exec(e),r)return t(r,0);if(r=/\b(\d{1,2})(?::(\d{2}))?\s*([ap])\.?m?\.?(?=\s|$)/.exec(e),r){let n=Number(r[1]),o=Number(r[2]??0);return n<1||n>12||o>59?{rest:e,bad:!0}:t(r,(n%12+(r[3]==="p"?12:0))*60+o)}if(r=/\b(\d{1,2}):(\d{2})\b/.exec(e),r){let n=Number(r[1]),o=Number(r[2]);return n>23||o>59?{rest:e,bad:!0}:t(r,n*60+o)}if(r=/\bat\s+(\d{1,2})\b/.exec(e),r){let n=Number(r[1]);return n>23?{rest:e,bad:!0}:t(r,(n>=1&&n<=7?n+12:n)*60)}let i=/\b(morning|afternoon|evening|tonight)\b/.exec(e);return i?{minutes:{morning:9,afternoon:15,evening:18,tonight:20}[i[1]]*60,rest:i[1]==="tonight"?`${e.slice(0,i.index)} today ${e.slice(i.index+i[0].length)}`:`${e.slice(0,i.index)} ${e.slice(i.index+i[0].length)}`}:{rest:e}}function G(e,t,r){let i=e.replace(/\b(on|at|the|of|this)\b/g," ").replace(/\s+/g," ").trim();if(i==="")return null;if(i==="today"||i==="now")return t;if(i==="tomorrow"||i==="tmrw"||i==="tmr")return b(t,1);if(i==="yesterday")return b(t,-1);if(i==="next week")return b(t,7);let n=/^in (\d{1,3}) (day|days|week|weeks)$/.exec(i);if(n)return b(t,Number(n[1])*(n[2].startsWith("week")?7:1));if(n=new RegExp(`^(next )?${R}$`).exec(i),n){let u=(K.indexOf(n[2].slice(0,3))-F(t)+7)%7;return b(t,n[1]&&u===0?7:u)}if(n=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(i),n)return m(Number(n[1]),Number(n[2]),Number(n[3]));let o=i.replace(new RegExp(`^${R} `),"");n=new RegExp(`^(\\d{1,2})(?:st|nd|rd|th)? ${S}(?: (\\d{4}))?$`).exec(o);let d=n?{date:n[1],month:n[2],year:n[3]}:void 0;n=new RegExp(`^${S} (\\d{1,2})(?:st|nd|rd|th)?(?: (\\d{4}))?$`).exec(o);let s=d??(n?{date:n[2],month:n[1],year:n[3]}:void 0);if(s)return j(t,M(s.year),_(s.month),Number(s.date));if(n=/^(\d{1,2})[/.-](\d{1,2})(?:[/.-](\d{2}|\d{4}))?$/.exec(o),n){let[a,u]=[Number(n[1]),Number(n[2])],[l,c]=U(r)?[a,u]:[u,a];return j(t,M(n[3]),l,c)}}function j(e,t,r,i){if(t!==void 0)return m(t,r,i);let n=Number(e.slice(0,4)),o=m(n,r,i);return o===void 0?m(n+1,r,i):f(e)-f(o)>183*h?m(n+1,r,i):o}function X(e){if(typeof e=="number")return Number.isInteger(e)&&e>=1e3&&e<=9999?String(e):void 0;let t=String(e).trim().toLowerCase().replace(/,/g," ").replace(/\s+/g," ");if(/^\d{4}$/.test(t))return Number(t)>=1e3?t:void 0;let r=(n,o)=>o>=1&&o<=12&&Number(n)>=1e3?`${n}-${String(o).padStart(2,"0")}`:void 0,i=/^(\d{4})[-/](\d{1,2})$/.exec(t);if(i)return r(i[1],Number(i[2]));if(i=/^(\d{1,2})\/(\d{4})$/.exec(t),i)return r(i[2],Number(i[1]));if(i=new RegExp(`^${S}\\.? (\\d{4})$`).exec(t),i)return r(i[2],_(i[1]))}function q(e,t){let r=e.trim();if(w(r)){let s=g(r);if(s)return t.time?s:{day:s.day}}let i=e.toLowerCase().replace(/,/g," ").replace(/(\d{4}-\d{2}-\d{2})t(\d\d:\d\d)(:\d\d(\.\d+)?)?/,"$1 $2").replace(/\s+/g," ").trim();if(i==="")return;let n=v(i);if(n.bad)return;let o=G(n.rest,t.today,t.locale??x);if(o===void 0||o===null&&n.minutes===void 0)return;let d=o??t.base?.day??t.today;return t.time?{day:d,minutes:n.minutes??t.base?.minutes??9*60}:{day:d}}function J(e){if(e===void 0||e==="web"||e.startsWith("ai:")||e.startsWith("app:"))return;if(e==="api")return"via the API";if(e==="cli")return"via the command line";let[t,...r]=e.split(":"),i=r.join(":");return(t==="mcp"||t==="view")&&i?`via ${i}`:t==="mcp"?"via an agent's tools":`via ${e}`}var L=e=>{if(!e.currency)return{before:!0};try{let t=$(e.locale),r=new Intl.NumberFormat(t,{style:"currency",currency:e.currency}).formatToParts(1),i=r.findIndex(d=>d.type==="currency"),n=r.findIndex(d=>d.type==="integer"),o;try{o=new Intl.DisplayNames([t],{type:"currency"}).of(e.currency)}catch{}return{...i>=0?{symbol:r[i].value}:{},before:i<n,...o?{name:o}:{}}}catch{return{symbol:e.currency,before:!0}}};function Q(e){let t=e.locale;if(e.format==="money"){let{symbol:r,before:i,name:n}=L(e),o=p(1250,t,{minimumFractionDigits:2,maximumFractionDigits:2});return{...r?i?{prefix:r}:{suffix:r}:{},placeholder:o,hint:n?`in ${n}`:e.currency?`in ${e.currency}`:"an amount of money"}}return e.format==="percent"?{suffix:"%",placeholder:p(15,t),hint:"as a percent"}:{...e.unit?{suffix:e.unit}:{},placeholder:"",hint:e.unit?`in ${e.unit}`:"a number"}}function V(e,t){return e===void 0||!Number.isFinite(e)?"":t.format==="money"?p(e,t.locale,Number.isInteger(e)?{maximumFractionDigits:0}:{minimumFractionDigits:2,maximumFractionDigits:2}):t.format==="percent"?p(e*100,t.locale,{maximumFractionDigits:4}):p(e,t.locale,{maximumFractionDigits:6})}function ee(e){try{let t=new Intl.NumberFormat($(e)).formatToParts(12345.6);return{group:t.find(r=>r.type==="group")?.value??",",decimal:t.find(r=>r.type==="decimal")?.value??"."}}catch{return{group:",",decimal:"."}}}function ne(e,t){let{group:r,decimal:i}=ee(t),n=e.replace(/[\s  ']/g,"").replace(/[−–]/g,"-");if(i!=="."&&!n.includes(i)&&/^-?\d+\.\d{1,2}$/.test(n))return Number(n);if(r&&(n=n.split(r).join("")),i!=="."&&(n=n.replace(i,".")),!/^-?(\d+\.?\d*|\.\d+)$/.test(n))return;let o=Number(n);return Number.isFinite(o)?o:void 0}function te(e,t){let r=e.trim();if(r==="")return;let i=t?.format==="money"&&t.currency?L(t).symbol:void 0,n=r;i&&(n=n.split(i).join("")),t?.currency&&(n=n.replace(new RegExp(t.currency,"gi"),"")),n=n.replace(/^[$€£¥₹]|[$€£¥₹]$/g,""),/%\s*$/.test(n)&&(n=n.replace(/%\s*$/,"")),t?.unit&&t.format!=="money"&&(n=n.replace(new RegExp(`\\s*${t.unit.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*$`),""));let d=ne(n,t?.locale);if(d!==void 0)return t?.format==="percent"?d/100:d}var T=/^[0-9a-f]{32}$/,P=e=>e.replace(/-/g,"").toLowerCase();function re(e,t,r){if(!(!e||typeof e!="object"))for(let[i,n]of Object.entries(e)){if(!n||typeof n!="object")continue;if(n.system==="google-calendar"&&n.kind===t)return{connection:i,system:"google-calendar",words:"Google Calendar"};if(n.system!=="notion")continue;let d=(Array.isArray(n.sources)?n.sources:[{kind:n.kind,source:n.source}]).find(c=>c&&c.kind===t);if(!d)continue;let s=typeof d.source=="string"&&!T.test(P(d.source))?d.source:void 0,a=r.startsWith(`${t}:${i}-`)?r.slice(`${t}:${i}-`.length):void 0,u=typeof n.database=="string"?P(n.database):void 0,l=a&&T.test(a)?a:u&&T.test(u)?u:void 0;return{connection:i,system:"notion",words:s?`Notion \xB7 ${s}`:"Notion",...l?{href:`https://www.notion.so/${l}`}:{}}}}export{J as a,Q as b,V as c,te as d,E as e,w as f,g,A as h,C as i,H as j,Z as k,X as l,q as m,re as n};
@@ -1 +1 @@
1
- import{g as o,l as u}from"./chunk.CYTTZOYL.js";function c(t,n,i){let e=r=>encodeURIComponent(r);return`${o}${e(t)}:${e(n)}:${e(i)}`}function S(t,n,i){let e=new Set(t.shown??[]);if(i?e.add(n):e.delete(n),e.size===0){let{shown:r,...w}=t;return w}return{...t,shown:[...e].sort()}}function l(t,n){if(n===null||n.trim().length===0){let{q:i,...e}=t;return e}return{...t,q:n}}function p(t){let n=t.q!==void 0&&t.within?.q===t.q;return l(n?u(t,"q",null):t,null)}function h(t,n){if(!n){let{past:i,...e}=t;return e}return{...t,past:!0}}function f(t,n){if(n===null||n.x===0&&n.y===0){let{pan:i,...e}=t;return e}return{...t,pan:n}}function d(t,n,i){let e={...t.pins};return i===null?delete e[n]:e[n]=i,{...t,pins:e}}export{c as a,S as b,l as c,p as d,h as e,f,d as g};
1
+ import{g as o,l as u}from"./chunk.VLX7YWVH.js";function c(t,n,i){let e=r=>encodeURIComponent(r);return`${o}${e(t)}:${e(n)}:${e(i)}`}function S(t,n,i){let e=new Set(t.shown??[]);if(i?e.add(n):e.delete(n),e.size===0){let{shown:r,...w}=t;return w}return{...t,shown:[...e].sort()}}function l(t,n){if(n===null||n.trim().length===0){let{q:i,...e}=t;return e}return{...t,q:n}}function p(t){let n=t.q!==void 0&&t.within?.q===t.q;return l(n?u(t,"q",null):t,null)}function h(t,n){if(!n){let{past:i,...e}=t;return e}return{...t,past:!0}}function f(t,n){if(n===null||n.x===0&&n.y===0){let{pan:i,...e}=t;return e}return{...t,pan:n}}function d(t,n,i){let e={...t.pins};return i===null?delete e[n]:e[n]=i,{...t,pins:e}}export{c as a,S as b,l as c,p as d,h as e,f,d as g};
@@ -1,4 +1,4 @@
1
- import{a as Ee,b as Re,c as Le,d as we,e as U,f as ue,g as pe,h as fe}from"./chunk.XIW4SZHD.js";import{c as j,e as ce}from"./chunk.KQPKYWDM.js";import{a as ge}from"./chunk.BN7C5ZYX.js";import{G as H,T as z,ba as le,da as de}from"./chunk.CYTTZOYL.js";import"./chunk.SDO3U72B.js";import{Z as q,la as ae,oa as se,od as _}from"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as C}from"./chunk.AJZBJBMO.js";var b=C(H(),1);var I=C(H(),1),Ae=(e,t)=>`graview:last-visit:${t??"anyone"}:${e.join(",")}`;function Oe(e,t,o){let n=new Set;for(let r of e)if(!(r.author.id!==void 0&&r.author.id===o)&&Date.parse(r.at)>t)for(let i of r.writes)n.add(i);return n}function ye(e,t,o){let n=Ae(t,o?.id),[r]=(0,I.useState)(()=>{try{let i=globalThis.localStorage?.getItem(n);return i?Number(i):null}catch{return null}});return(0,I.useEffect)(()=>{let i=()=>{if(document.visibilityState==="hidden")try{globalThis.localStorage?.setItem(n,String(Date.now()))}catch{}};return document.addEventListener("visibilitychange",i),window.addEventListener("pagehide",i),()=>{document.removeEventListener("visibilitychange",i),window.removeEventListener("pagehide",i)}},[n]),(0,I.useMemo)(()=>r===null?new Set:Oe(e,r,o?.id),[e,r,o?.id])}function me(e,t,o){let n=new Set;if(o===void 0)return n;n.add(o);for(let r of[...e.out(o),...e.in(o)])n.add(r.id);for(let r of t)if(r.author.id===o)for(let i of r.primitives)i.op==="add-node"&&n.add(i.node.id);return n}var J=C(H(),1);var v=C(z(),1),Ce=`.graview-workflows{position:absolute;left:0;top:0;pointer-events:none;z-index:${_.plots};opacity:var(--graview-altitude);transition:opacity 640ms cubic-bezier(.33,0,.2,1)}
1
+ import{a as Ee,b as Re,c as Le,d as we,e as U,f as ue,g as pe,h as fe}from"./chunk.WPQP54FM.js";import{c as j,e as ce}from"./chunk.OXFDB5BB.js";import{a as ge}from"./chunk.F6BNFLQM.js";import{G as H,V as z,da as le,fa as de}from"./chunk.VLX7YWVH.js";import"./chunk.SDO3U72B.js";import{Z as q,la as ae,oa as se,qd as _}from"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import{b as C}from"./chunk.AJZBJBMO.js";var b=C(H(),1);var I=C(H(),1),Ae=(e,t)=>`graview:last-visit:${t??"anyone"}:${e.join(",")}`;function Oe(e,t,o){let n=new Set;for(let r of e)if(!(r.author.id!==void 0&&r.author.id===o)&&Date.parse(r.at)>t)for(let i of r.writes)n.add(i);return n}function ye(e,t,o){let n=Ae(t,o?.id),[r]=(0,I.useState)(()=>{try{let i=globalThis.localStorage?.getItem(n);return i?Number(i):null}catch{return null}});return(0,I.useEffect)(()=>{let i=()=>{if(document.visibilityState==="hidden")try{globalThis.localStorage?.setItem(n,String(Date.now()))}catch{}};return document.addEventListener("visibilitychange",i),window.addEventListener("pagehide",i),()=>{document.removeEventListener("visibilitychange",i),window.removeEventListener("pagehide",i)}},[n]),(0,I.useMemo)(()=>r===null?new Set:Oe(e,r,o?.id),[e,r,o?.id])}function me(e,t,o){let n=new Set;if(o===void 0)return n;n.add(o);for(let r of[...e.out(o),...e.in(o)])n.add(r.id);for(let r of t)if(r.author.id===o)for(let i of r.primitives)i.op==="add-node"&&n.add(i.node.id);return n}var J=C(H(),1);var v=C(z(),1),Ce=`.graview-workflows{position:absolute;left:0;top:0;pointer-events:none;z-index:${_.plots};opacity:var(--graview-altitude);transition:opacity 640ms cubic-bezier(.33,0,.2,1)}
2
2
  .graview-workflow-wire{fill:none;stroke:var(--graview-accent);stroke-width:1.5;stroke-opacity:.7;stroke-linecap:round}
3
3
  .graview-workflow-wire[data-wire=reads]{stroke-dasharray:3 4;stroke-opacity:.55}
4
4
  .graview-workflow-spot{fill:var(--graview-accent);stroke:var(--graview-panel);stroke-width:1.5}
@@ -1 +1 @@
1
- import{a as Q,b as Z}from"./chunk.25VJPUDH.js";import{a as J}from"./chunk.KXFNRJ46.js";import{e as _,f as U,g as F,h as R,i as X,j,k as z}from"./chunk.OMRQTLI5.js";import{b as K}from"./chunk.MIE3ODQ2.js";import"./chunk.NEPQBMFT.js";import"./chunk.MBB5A6BT.js";import"./chunk.ERPILTRY.js";import{a as B}from"./chunk.H7AH3IW4.js";import"./chunk.REUMBCSV.js";import"./chunk.2KIWGQXC.js";import"./chunk.D5LOTCBU.js";import{j as $}from"./chunk.KZUMXT5J.js";import"./chunk.CGK2PY76.js";import{G as N,Ra as V,T as D,Va as Y,ba as A,da as P,la as G}from"./chunk.CYTTZOYL.js";import"./chunk.SDO3U72B.js";import{Cc as M,db as q,xb as L}from"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as k}from"./chunk.AJZBJBMO.js";var r=k(N(),1);var te=k(N(),1),h=k(D(),1),ee={minWidth:0,overflowWrap:"anywhere"};function ne({suggestion:e,decides:n,heard:l}){let{store:u,principal:v}=A(),[s,a]=(0,te.useState)(null),S=e.items;if(S.length<2)return null;let x=(i,y)=>{a(null);try{R(u,e.id,{author:v,items:[i]}),l("Accepted that change; the rest still wait."),requestAnimationFrame(()=>{let g=document.querySelector(`[data-suggestion="${CSS.escape(e.id)}"]`);(g?.querySelectorAll('[data-testid="suggestion-item-accept"]')[y]??g?.querySelectorAll('[data-testid="suggestion-item-accept"]')[y-1]??g?.querySelector('[data-testid="suggestion-accept"]'))?.focus()})}catch(g){a(g instanceof Error?g.message:String(g))}};return(0,h.jsxs)("details",{"data-testid":"suggestion-items",style:{minWidth:0},children:[(0,h.jsx)("summary",{style:{cursor:"pointer",fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:`Show the ${S.length} changes`}),(0,h.jsx)("ol",{style:{margin:"6px 0 0",padding:0,listStyle:"none",display:"grid",gap:4,minWidth:0},children:S.map((i,y)=>(0,h.jsxs)("li",{"data-testid":"suggestion-item","data-item":i.at,style:{display:"flex",alignItems:"baseline",gap:6,minWidth:0,fontSize:"0.75rem"},children:[(0,h.jsx)("span",{style:{...ee,flex:"1 1 auto"},children:i.intent}),n?(0,h.jsx)("button",{type:"button","data-testid":"suggestion-item-accept","aria-label":`Accept: ${i.intent}`,onClick:()=>x(i.at,y),style:{minHeight:24,padding:"1px 8px",fontSize:"0.75rem",flex:"0 0 auto"},children:"Accept"}):null]},i.at))}),s?(0,h.jsx)("span",{"data-testid":"suggestion-item-refused",role:"alert",style:{...ee,display:"block",fontSize:"0.75rem",color:"var(--graview-warn)"},children:s}):null]})}var t=k(D(),1);function ie(e,n,l=0){let u=[e>0?`${e===1?"one suggestion":`${e} suggestions`} waiting`:"",e>0&&l>0?`${l===1?"a reader agrees":`${l} readers agree`} with one that waits`:"",n>0?`tidied ${n===1?"one thing":`${n} things`} while you were away`:""].filter(Boolean);return u.length>0?u.join(" \xB7 ").replace(/^./,v=>v.toUpperCase()):void 0}function be(){let{store:e,principal:n,dismissals:l,whileAway:u,app:v}=A(),s=P(),a=(0,r.useMemo)(()=>Z(l,v?.name??"app",n),[l,v?.name,n]),[S,x]=(0,r.useReducer)(d=>d+1,0);(0,r.useEffect)(()=>a.onChange?.(x),[a]),(0,r.useEffect)(()=>e.subscribe((d,o)=>o.some(w=>w.vote!==void 0)&&x()),[e]);let i=(0,r.useMemo)(()=>_(e,n,{dismissed:a.list()}),[e,n,s,a,S]),[y,g]=(0,r.useState)(""),m=Y("suggested"),C=G(),T=d=>e.graph.has(d)?o=>{m.setOpen(!1),C.record(o)}:null,b=u?.tidied??0,f=u?ie(i.length,b,u.agreed):void 0;if(i.length===0&&b===0)return null;let p=d=>{if(g(d),i.length>1){requestAnimationFrame(()=>document.querySelector('[data-testid="suggested"] [data-testid="suggestion-accept"]')?.focus());return}m.setOpen(!1),(document.querySelector('[data-testid="activity-button"]')??document.querySelector('[data-graview-app-bar] button:not([data-testid="suggested-button"])'))?.focus()};return(0,t.jsxs)("div",{style:{position:"relative"},children:[(0,t.jsxs)("button",{type:"button","data-testid":"suggested-button",...m.trigger,onClick:m.toggle,title:f??"What tidying suggests, waiting for you",...f?{"aria-label":`Suggested: ${f}`}:{},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?i.length:`Tidied ${b}`,(0,t.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,t.jsx)("path",{d:"M3 4.5 H13 M3 8 H10 M3 11.5 H8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,t.jsx)("circle",{cx:"12.25",cy:"11.5",r:"1.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]}),i.length>0?(0,t.jsx)("span",{className:"graview-activity-word",children:" Suggested"}):null]}),m.open?(0,t.jsxs)("section",{...m.pane,"aria-label":"Suggested","data-testid":"suggested","data-graview-offstage":"",style:{...V,width:"min(320px, calc(100vw - 16px))",maxHeight:"min(52cqh, 460px)",overflowX:"hidden",overflowY:"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,t.jsx)("h2",{style:{...$,margin:0},children:"Suggested"}),f?(0,t.jsxs)("p",{"data-testid":"while-away",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[f,"."]}):null,(0,t.jsx)("p",{style:{margin:0,fontSize:"0.75rem",lineHeight:1.45,color:"var(--graview-ink-faint)"},children:i.length>0?"Not made yet: each waits for you.":"What it did is in Activity."}),[i.filter(z),i.filter(d=>!z(d))].map((d,o)=>d.length===0?null:(0,t.jsxs)("div",{style:{display:"grid",gap:6,minWidth:0},children:[i.some(z)?(0,t.jsx)("h3",{style:{margin:0,fontSize:"0.75rem",fontWeight:600,color:"var(--graview-ink-muted)"},children:o===0?"Proposed":"Suggested by the app"}):null,(0,t.jsx)("ol",{"data-testid":o===0?"proposals":"suggestions",style:{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:10,fontSize:"0.8125rem",minWidth:0},children:d.map(w=>(0,t.jsx)(de,{suggestion:w,notNow:a,settled:p,heard:g,goes:T},w.id))})]},o)),(0,t.jsx)("span",{role:"status","data-testid":"suggestion-heard",style:$,children:y})]}):null]})}var E={minWidth:0,overflowWrap:"anywhere"},ae={accept:"Accepted.",decline:"Declined: it will not be suggested again.",later:"Hidden from you until tomorrow.",withdraw:"Withdrawn."},O={recorded:"Your vote was recorded.",withdrawn:"Your vote was withdrawn."},oe=(e,n)=>n.startsWith(`${e}: `)?n.slice(e.length+2):n,re=e=>{let n=`${e.for} for, ${e.against} against`,l=se(e.advisory);return l?`${n} \xB7 ${l}`:n};function se(e){if(!e)return"";let n=e.for===0?"":e.for===1?"a visitor agrees":`${e.for} visitors agree`,l=e.against===0?"":e.against===1?`${n?"one":"a visitor"} disagrees`:`${e.against}${n?"":" visitors"} disagree`;return[n,l].filter(Boolean).join(", ")}function de({suggestion:e,notNow:n,settled:l,heard:u,goes:v}){let{store:s,principal:a,seats:S,people:x,signIn:i}=A(),[y,g]=(0,r.useState)(null),[m,C]=(0,r.useState)(null),T=(0,r.useId)(),b=(0,r.useId)(),f=q(e.author,{graph:s.graph,schema:s.schema,seats:S,people:x}),p=(0,r.useMemo)(()=>U(s,e,a),[s,e,a]),d=(0,r.useMemo)(()=>p||s.permits({name:M,args:{suggestion:e.id,vote:"for"}},a).ok,[p,s,e.id,a]),{tally:o}=e,w=z(e),W=w&&a!==void 0&&!p&&L(a).id===e.lineage.proposedBy,H=async c=>{g(null);try{if(c==="withdraw")j(s,e.id,{author:a});else if(c==="accept"||c==="decline"){if((c==="accept"?R(s,e.id,{author:a}):X(s,e.id,{author:a})).voted!==void 0){C(O.recorded),u(O.recorded);return}}else if(c==="unvote"){F(s,e.id,null,{author:a}),C(O.withdrawn),u(O.withdrawn);return}else await n.dismiss({suggestion:e.id,at:new Date().toISOString(),until:Q()});l(ae[c])}catch(I){g(I instanceof Error?I.message:String(I))}};return(0,t.jsxs)("li",{"data-testid":"suggestion","data-suggestion":e.id,style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:5,lineHeight:1.45,minWidth:0},children:[(0,t.jsxs)("span",{"data-graview-suggestion-words":"",style:E,children:[w?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{"data-testid":"proposed-by",style:{color:"var(--graview-ink-muted)"},children:["Proposed by ",(0,t.jsx)("strong",{style:{fontWeight:600,color:"var(--graview-ink)"},children:W?"you":f}),":"]})," "]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("strong",{style:{fontWeight:600},children:f})," ",(0,t.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:"suggests"})," "]}),e.items.length>1?oe(f,e.headline??e.intent):e.intent]}),(0,t.jsx)(ne,{suggestion:e,decides:p,heard:u}),e.lineage&&!(w&&e.lineage.basis.startsWith("Proposed by "))?(0,t.jsx)("span",{"data-graview-lineage":"",style:{...E,color:"var(--graview-ink-faint)"},children:B(e.lineage)}):null,e.about.length>0?(0,t.jsx)("div",{"data-graview-suggestion-records":"",style:{display:"flex",flexWrap:"wrap",gap:4,minWidth:0},children:e.about.slice(0,4).map(c=>(0,t.jsx)(J,{id:c,label:K(s,c),go:v(c),testId:"suggestion-record"},c))}):null,(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:6,minWidth:0},children:[W?(0,t.jsx)("button",{type:"button","data-testid":"proposal-withdraw",onClick:()=>void H("withdraw"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Withdraw"}):d?(0,t.jsx)("button",{type:"button","data-testid":"suggestion-accept",onClick:()=>void H("accept"),...p?{}:{"aria-pressed":o.mine==="for","aria-describedby":b},style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:p&&e.items.length>1?"Accept all":"Accept"}):i?(0,t.jsx)("button",{type:"button","data-testid":"suggestion-sign-in",onClick:()=>i.run(),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Sign in to vote"}):null,p&&o.for+o.against+(o.advisory?o.advisory.for+o.advisory.against:0)>0?(0,t.jsx)("span",{"data-testid":"suggestion-tally",style:{...E,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:re(o)}):null,d&&!W?(0,t.jsx)("button",{type:"button","data-testid":"suggestion-decline",onClick:()=>void H("decline"),...p?{}:{"aria-pressed":o.mine==="against","aria-describedby":b},style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Decline"}):null,!p&&d&&!W?(0,t.jsx)("span",{id:b,style:$,children:"Counts as your vote; somebody who may make it decides."}):null,!p&&d&&!W&&o.mine!==void 0?(0,t.jsx)("button",{type:"button","data-testid":"suggestion-withdraw-vote",onClick:()=>void H("unvote"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem",border:"1px solid transparent",background:"transparent",boxShadow:"none",color:"var(--graview-ink-muted)"},children:"Withdraw vote"}):null,(0,t.jsx)("button",{type:"button","data-testid":"suggestion-not-now",onClick:()=>void H("later"),title:"Hide it from you until tomorrow. It still waits for everyone else.","aria-describedby":T,style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem",marginInlineStart:"auto",border:"1px solid transparent",background:"transparent",boxShadow:"none",color:"var(--graview-ink-muted)"},children:"Not now"}),(0,t.jsx)("span",{id:T,style:$,children:"Hides it from you until tomorrow; it still waits for everyone else."})]}),m?(0,t.jsx)("span",{"data-testid":"suggestion-voted",role:"status",style:{...E,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:m}):null,y?(0,t.jsx)("span",{"data-testid":"suggestion-refused",role:"alert",style:{...E,fontSize:"0.75rem",color:"var(--graview-warn)"},children:y}):null]})}export{be as SuggestedTray,se as advisoryWords,ie as awayWords,re as tallyWords};
1
+ import{a as Q,b as Z}from"./chunk.25VJPUDH.js";import{a as J}from"./chunk.APUQIELA.js";import{e as _,f as U,g as F,h as R,i as X,j,k as z}from"./chunk.S6QZBWCJ.js";import{b as K}from"./chunk.LTOQ22ZJ.js";import"./chunk.2TCOLAL2.js";import"./chunk.FUPYIOXZ.js";import"./chunk.3OEODIHB.js";import{a as B}from"./chunk.X36BYTEG.js";import"./chunk.75JQCTR6.js";import"./chunk.5IEZF433.js";import"./chunk.5AD2QHWH.js";import{k as $}from"./chunk.3FKKH2XU.js";import"./chunk.DLWFULWE.js";import{G as N,Ta as V,V as D,Xa as Y,da as A,fa as P,na as G}from"./chunk.VLX7YWVH.js";import"./chunk.SDO3U72B.js";import{Cc as M,db as q,xb as L}from"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import{b as k}from"./chunk.AJZBJBMO.js";var r=k(N(),1);var te=k(N(),1),h=k(D(),1),ee={minWidth:0,overflowWrap:"anywhere"};function ne({suggestion:e,decides:n,heard:l}){let{store:u,principal:v}=A(),[s,a]=(0,te.useState)(null),S=e.items;if(S.length<2)return null;let x=(i,y)=>{a(null);try{R(u,e.id,{author:v,items:[i]}),l("Accepted that change; the rest still wait."),requestAnimationFrame(()=>{let g=document.querySelector(`[data-suggestion="${CSS.escape(e.id)}"]`);(g?.querySelectorAll('[data-testid="suggestion-item-accept"]')[y]??g?.querySelectorAll('[data-testid="suggestion-item-accept"]')[y-1]??g?.querySelector('[data-testid="suggestion-accept"]'))?.focus()})}catch(g){a(g instanceof Error?g.message:String(g))}};return(0,h.jsxs)("details",{"data-testid":"suggestion-items",style:{minWidth:0},children:[(0,h.jsx)("summary",{style:{cursor:"pointer",fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:`Show the ${S.length} changes`}),(0,h.jsx)("ol",{style:{margin:"6px 0 0",padding:0,listStyle:"none",display:"grid",gap:4,minWidth:0},children:S.map((i,y)=>(0,h.jsxs)("li",{"data-testid":"suggestion-item","data-item":i.at,style:{display:"flex",alignItems:"baseline",gap:6,minWidth:0,fontSize:"0.75rem"},children:[(0,h.jsx)("span",{style:{...ee,flex:"1 1 auto"},children:i.intent}),n?(0,h.jsx)("button",{type:"button","data-testid":"suggestion-item-accept","aria-label":`Accept: ${i.intent}`,onClick:()=>x(i.at,y),style:{minHeight:24,padding:"1px 8px",fontSize:"0.75rem",flex:"0 0 auto"},children:"Accept"}):null]},i.at))}),s?(0,h.jsx)("span",{"data-testid":"suggestion-item-refused",role:"alert",style:{...ee,display:"block",fontSize:"0.75rem",color:"var(--graview-warn)"},children:s}):null]})}var t=k(D(),1);function ie(e,n,l=0){let u=[e>0?`${e===1?"one suggestion":`${e} suggestions`} waiting`:"",e>0&&l>0?`${l===1?"a reader agrees":`${l} readers agree`} with one that waits`:"",n>0?`tidied ${n===1?"one thing":`${n} things`} while you were away`:""].filter(Boolean);return u.length>0?u.join(" \xB7 ").replace(/^./,v=>v.toUpperCase()):void 0}function be(){let{store:e,principal:n,dismissals:l,whileAway:u,app:v}=A(),s=P(),a=(0,r.useMemo)(()=>Z(l,v?.name??"app",n),[l,v?.name,n]),[S,x]=(0,r.useReducer)(d=>d+1,0);(0,r.useEffect)(()=>a.onChange?.(x),[a]),(0,r.useEffect)(()=>e.subscribe((d,o)=>o.some(w=>w.vote!==void 0)&&x()),[e]);let i=(0,r.useMemo)(()=>_(e,n,{dismissed:a.list()}),[e,n,s,a,S]),[y,g]=(0,r.useState)(""),m=Y("suggested"),C=G(),T=d=>e.graph.has(d)?o=>{m.setOpen(!1),C.record(o)}:null,b=u?.tidied??0,f=u?ie(i.length,b,u.agreed):void 0;if(i.length===0&&b===0)return null;let p=d=>{if(g(d),i.length>1){requestAnimationFrame(()=>document.querySelector('[data-testid="suggested"] [data-testid="suggestion-accept"]')?.focus());return}m.setOpen(!1),(document.querySelector('[data-testid="activity-button"]')??document.querySelector('[data-graview-app-bar] button:not([data-testid="suggested-button"])'))?.focus()};return(0,t.jsxs)("div",{style:{position:"relative"},children:[(0,t.jsxs)("button",{type:"button","data-testid":"suggested-button",...m.trigger,onClick:m.toggle,title:f??"What tidying suggests, waiting for you",...f?{"aria-label":`Suggested: ${f}`}:{},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?i.length:`Tidied ${b}`,(0,t.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,t.jsx)("path",{d:"M3 4.5 H13 M3 8 H10 M3 11.5 H8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,t.jsx)("circle",{cx:"12.25",cy:"11.5",r:"1.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]}),i.length>0?(0,t.jsx)("span",{className:"graview-activity-word",children:" Suggested"}):null]}),m.open?(0,t.jsxs)("section",{...m.pane,"aria-label":"Suggested","data-testid":"suggested","data-graview-offstage":"",style:{...V,width:"min(320px, calc(100vw - 16px))",maxHeight:"min(52cqh, 460px)",overflowX:"hidden",overflowY:"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,t.jsx)("h2",{style:{...$,margin:0},children:"Suggested"}),f?(0,t.jsxs)("p",{"data-testid":"while-away",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[f,"."]}):null,(0,t.jsx)("p",{style:{margin:0,fontSize:"0.75rem",lineHeight:1.45,color:"var(--graview-ink-faint)"},children:i.length>0?"Not made yet: each waits for you.":"What it did is in Activity."}),[i.filter(z),i.filter(d=>!z(d))].map((d,o)=>d.length===0?null:(0,t.jsxs)("div",{style:{display:"grid",gap:6,minWidth:0},children:[i.some(z)?(0,t.jsx)("h3",{style:{margin:0,fontSize:"0.75rem",fontWeight:600,color:"var(--graview-ink-muted)"},children:o===0?"Proposed":"Suggested by the app"}):null,(0,t.jsx)("ol",{"data-testid":o===0?"proposals":"suggestions",style:{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:10,fontSize:"0.8125rem",minWidth:0},children:d.map(w=>(0,t.jsx)(de,{suggestion:w,notNow:a,settled:p,heard:g,goes:T},w.id))})]},o)),(0,t.jsx)("span",{role:"status","data-testid":"suggestion-heard",style:$,children:y})]}):null]})}var E={minWidth:0,overflowWrap:"anywhere"},ae={accept:"Accepted.",decline:"Declined: it will not be suggested again.",later:"Hidden from you until tomorrow.",withdraw:"Withdrawn."},O={recorded:"Your vote was recorded.",withdrawn:"Your vote was withdrawn."},oe=(e,n)=>n.startsWith(`${e}: `)?n.slice(e.length+2):n,re=e=>{let n=`${e.for} for, ${e.against} against`,l=se(e.advisory);return l?`${n} \xB7 ${l}`:n};function se(e){if(!e)return"";let n=e.for===0?"":e.for===1?"a visitor agrees":`${e.for} visitors agree`,l=e.against===0?"":e.against===1?`${n?"one":"a visitor"} disagrees`:`${e.against}${n?"":" visitors"} disagree`;return[n,l].filter(Boolean).join(", ")}function de({suggestion:e,notNow:n,settled:l,heard:u,goes:v}){let{store:s,principal:a,seats:S,people:x,signIn:i}=A(),[y,g]=(0,r.useState)(null),[m,C]=(0,r.useState)(null),T=(0,r.useId)(),b=(0,r.useId)(),f=q(e.author,{graph:s.graph,schema:s.schema,seats:S,people:x}),p=(0,r.useMemo)(()=>U(s,e,a),[s,e,a]),d=(0,r.useMemo)(()=>p||s.permits({name:M,args:{suggestion:e.id,vote:"for"}},a).ok,[p,s,e.id,a]),{tally:o}=e,w=z(e),W=w&&a!==void 0&&!p&&L(a).id===e.lineage.proposedBy,H=async c=>{g(null);try{if(c==="withdraw")j(s,e.id,{author:a});else if(c==="accept"||c==="decline"){if((c==="accept"?R(s,e.id,{author:a}):X(s,e.id,{author:a})).voted!==void 0){C(O.recorded),u(O.recorded);return}}else if(c==="unvote"){F(s,e.id,null,{author:a}),C(O.withdrawn),u(O.withdrawn);return}else await n.dismiss({suggestion:e.id,at:new Date().toISOString(),until:Q()});l(ae[c])}catch(I){g(I instanceof Error?I.message:String(I))}};return(0,t.jsxs)("li",{"data-testid":"suggestion","data-suggestion":e.id,style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:5,lineHeight:1.45,minWidth:0},children:[(0,t.jsxs)("span",{"data-graview-suggestion-words":"",style:E,children:[w?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{"data-testid":"proposed-by",style:{color:"var(--graview-ink-muted)"},children:["Proposed by ",(0,t.jsx)("strong",{style:{fontWeight:600,color:"var(--graview-ink)"},children:W?"you":f}),":"]})," "]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("strong",{style:{fontWeight:600},children:f})," ",(0,t.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:"suggests"})," "]}),e.items.length>1?oe(f,e.headline??e.intent):e.intent]}),(0,t.jsx)(ne,{suggestion:e,decides:p,heard:u}),e.lineage&&!(w&&e.lineage.basis.startsWith("Proposed by "))?(0,t.jsx)("span",{"data-graview-lineage":"",style:{...E,color:"var(--graview-ink-faint)"},children:B(e.lineage)}):null,e.about.length>0?(0,t.jsx)("div",{"data-graview-suggestion-records":"",style:{display:"flex",flexWrap:"wrap",gap:4,minWidth:0},children:e.about.slice(0,4).map(c=>(0,t.jsx)(J,{id:c,label:K(s,c),go:v(c),testId:"suggestion-record"},c))}):null,(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:6,minWidth:0},children:[W?(0,t.jsx)("button",{type:"button","data-testid":"proposal-withdraw",onClick:()=>void H("withdraw"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Withdraw"}):d?(0,t.jsx)("button",{type:"button","data-testid":"suggestion-accept",onClick:()=>void H("accept"),...p?{}:{"aria-pressed":o.mine==="for","aria-describedby":b},style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:p&&e.items.length>1?"Accept all":"Accept"}):i?(0,t.jsx)("button",{type:"button","data-testid":"suggestion-sign-in",onClick:()=>i.run(),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Sign in to vote"}):null,p&&o.for+o.against+(o.advisory?o.advisory.for+o.advisory.against:0)>0?(0,t.jsx)("span",{"data-testid":"suggestion-tally",style:{...E,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:re(o)}):null,d&&!W?(0,t.jsx)("button",{type:"button","data-testid":"suggestion-decline",onClick:()=>void H("decline"),...p?{}:{"aria-pressed":o.mine==="against","aria-describedby":b},style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Decline"}):null,!p&&d&&!W?(0,t.jsx)("span",{id:b,style:$,children:"Counts as your vote; somebody who may make it decides."}):null,!p&&d&&!W&&o.mine!==void 0?(0,t.jsx)("button",{type:"button","data-testid":"suggestion-withdraw-vote",onClick:()=>void H("unvote"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem",border:"1px solid transparent",background:"transparent",boxShadow:"none",color:"var(--graview-ink-muted)"},children:"Withdraw vote"}):null,(0,t.jsx)("button",{type:"button","data-testid":"suggestion-not-now",onClick:()=>void H("later"),title:"Hide it from you until tomorrow. It still waits for everyone else.","aria-describedby":T,style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem",marginInlineStart:"auto",border:"1px solid transparent",background:"transparent",boxShadow:"none",color:"var(--graview-ink-muted)"},children:"Not now"}),(0,t.jsx)("span",{id:T,style:$,children:"Hides it from you until tomorrow; it still waits for everyone else."})]}),m?(0,t.jsx)("span",{"data-testid":"suggestion-voted",role:"status",style:{...E,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:m}):null,y?(0,t.jsx)("span",{"data-testid":"suggestion-refused",role:"alert",style:{...E,fontSize:"0.75rem",color:"var(--graview-warn)"},children:y}):null]})}export{be as SuggestedTray,se as advisoryWords,ie as awayWords,re as tallyWords};
@@ -1 +1 @@
1
- import{a as O,b,c as w,d as R,e as V}from"./chunk.AHPYNDVA.js";import{h as d,i as S}from"./chunk.FNVGNISQ.js";import{Pa as $,Qa as F}from"./chunk.Q4MI53KK.js";var E=["card","row","page"],j=["good","warn","bad","neutral","accent"],U=["money","percent","date","time","datetime","relative","count"],_=4,T=40,I=120,L=["number","money","percent"],B=["large"],C=["card","row"],M=1e3,ce=100;function X(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","lines"],badge:["tone"],field:["as","currency","label"],image:["as","label"],progress:["label"],group:["direction"],when:["show"],divider:[],figure:["as","currency","label","emphasis"]},Z=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"?, "lines"?: 0-12}, {"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}`,Y=e=>/^(image|video|file)$/.test(e?.of??e?.type??"");function ge(e){return Object.fromEntries(Object.entries(e.views??{}).filter(([,n])=>!Array.isArray(n)))}function ye(e){let n=e.views?.home;return Array.isArray(n)?n:void 0}var q={field:()=>!1,relation:()=>!1,figure:!1},z=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 W(e,n,t){let s=O(e);for(let a of s.unknownFunctions)t.findings.push(d("unknown-function",n,`"${a}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let a of s.names){if(t.kind===null){t.findings.push(d("view-name",n,`"${a}" 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}a==="id"||t.spec.field(a)||t.spec.relation(a)||t.findings.push(d("view-name",n,`${t.kind} has no field or relation called "${a}"`))}for(let a of s.edges)t.edges.has(a)||t.findings.push(d("view-edge",n,`"${a}" is not a relation any kind declares`));for(let a of s.sweeps)t.kinds.has(a)||t.findings.push(d("view-kind",n,`"${a}" is not a kind this document declares`))}function k(e,n,t){if(typeof e!="string"||e.length===0||e.length>2e3){t.findings.push(d("view-expression",n,`an expression is a line of the rule language, like "status == 'booked'"`));return}try{W(w(e),n,t)}catch(s){if(!(s instanceof b))throw s;t.findings.push(d("expression",n,`${s.sentence} (at character ${s.at+1})`))}}function A(e,n,t,s,a=!1){let l=s==="text";if(typeof e!="string"||e.length===0||e.length>300){t.findings.push(d("view-template",n,'a template is words with {field} in braces, like "{name}" or "{quote|money}", at most 300 characters'));return}let r;try{r=V(e)}catch(i){if(i instanceof R||i instanceof b){t.findings.push(d("template",n,i.sentence));return}throw i}for(let i of r)if(i.expr){if(W(i.expr,n,t),l&&!a&&!i.format&&i.expr.t==="ident"&&(t.slot==="card"||t.slot==="row")&&t.spec.prose?.(i.expr.name)){let o=i.expr.name;t.findings.push(S("view-whole-text",n,`${t.kind} ${t.slot} shows ${o} whole; it will be clamped. Use {${o}|excerpt} or move it to the page.`,`write {${o}|excerpt}, or {${o}|excerpt: 80} for fewer characters`))}if(s==="headline"&&!i.format&&i.expr.t==="ident"&&t.spec.prose?.(i.expr.name)){let o=i.expr.name;t.findings.push(S("view-headline-long",n,`${z(t)}${t.slot?` ${t.slot}`:""} heads it with ${o}, a long text, drawn at a headline's size; a headline is a few words.`,`say it in a text block, {"text": "{${o}}"}, or head it with {${o}|excerpt: 60}`))}}}var K=12;function J(e,n,t){typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=K||t.findings.push(d("view-lines",n,`lines is ${JSON.stringify(e)}, and a text block's lines is a whole number from 1 to ${K}, or 0 to show it whole`,'{"text": "{awards}", "lines": 6}, or "lines": 0 for no cut at all'))}function Q(e,n,t){if(typeof e=="string"){j.includes(e)||t.findings.push(d("view-tone",n,`"${e}" is not a tone`,`use one of ${j.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`,t);return}t.findings.push(d("view-tone",n,'a tone is a word or {"expr": \u2026}',`one of ${j.join(", ")}`))}function x(e,n,t,s){if(!Array.isArray(e)){s.findings.push(d("view-shape",n,"a view is a list of blocks"));return}if(t>_){s.findings.push(d("view-depth",n,`blocks nest at most ${_} deep`,"flatten a group or a condition"));return}e.forEach((a,l)=>ee(a,`${n}.${l}`,t,s))}function ee(e,n,t,s){if(t===1&&s.count++,s.all++,!g(e)){s.findings.push(d("view-block",n,"a block is an object naming what it shows",`one of ${G}`));return}let a=Object.keys(e),l=a.filter(o=>Z.includes(o)&&!(o==="group"&&a.includes("list")));if(l.length===0){s.findings.push(d("view-block",n,`${a.length>0?a.map(o=>`"${o}"`).join(", "):"an empty object"} is not a block Graview knows`,`one of ${G}`));return}if(l.length>1){s.findings.push(d("view-block",n,`a block is one thing, and this says ${l.map(o=>`"${o}"`).join(" and ")}`,"split it into two blocks"));return}let r=l[0];for(let o of a)o!==r&&o!="key"&&!v[r].includes(o)&&s.findings.push(d("unknown-key",`${n}.${o}`,`"${o}" is not part of a ${r} block`,v[r].length>0?`a ${r} block may also say ${v[r].map(f=>`"${f}"`).join(", ")}`:`a ${r} block says nothing else`));let i=e[r];switch(r){case"title":case"headline":case"text":case"badge":A(i,`${n}.${r}`,s,r==="text"||r==="headline"?r:void 0,r==="text"&&"lines"in e),"tone"in e&&Q(e.tone,`${n}.tone`,s),r==="text"&&"lines"in e&&J(e.lines,`${n}.lines`,s);return;case"image":case"field":{let o=r==="image";if(typeof i!="string"||!(o?s.spec.files?.(i):s.spec.field(i))){let u=typeof i=="string"&&s.spec.relation(i);s.findings.push(d(`view-${r}`,`${n}.${r}`,`${s.kind} has no ${o?"image, video or file ":""}field ${typeof i=="string"?`"${i}"`:"by that name"}`,u?`"${i}" is a relation; show it with {"text": "{${i}.name}"}`:void 0))}let f=o?["thumb","gallery"]:U;"as"in e&&!f.includes(e.as)&&s.findings.push(d("view-format",`${n}.as`,`"${String(e.as)}" is not a way to show ${o?"pictures":"a field"}`,`use one of ${f.join(", ")}`)),o||D(e,n,s,"field"),"label"in e&&oe(e.label,`${n}.label`,s);return}case"progress":{!g(i)||Object.keys(i).some(o=>o!=="value"&&o!=="max")||!("value"in i)||!("max"in i)?s.findings.push(d("view-progress",`${n}.progress`,'progress is {"value": expression, "max": expression}')):(k(i.value,`${n}.progress.value`,s),k(i.max,`${n}.progress.max`,s)),"label"in e&&A(e.label,`${n}.label`,s);return}case"group":"direction"in e&&e.direction!=="row"&&e.direction!=="column"&&s.findings.push(d("view-direction",`${n}.direction`,`a group runs "row" or "column", not "${String(e.direction)}"`)),x(i,`${n}.group`,t+1,s);return;case"when":k(i,`${n}.when`,s),"show"in e?x(e.show,`${n}.show`,t+1,s):s.findings.push(d("view-when",n,'a condition says what it shows: {"when": expr, "show": [blocks]}'));return;case"figure":if(typeof i=="string")return ne(e,n,s);for(let o of["as","currency","label","emphasis"])o in e&&s.findings.push(d("unknown-key",`${n}.${o}`,`"${o}" 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?s.findings.push(d("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}`)):s.spec.figure||s.findings.push(d("view-figure",`${n}.figure`,`${z(s)} has no figure to show`,s.kind===null?`work a number out: {"figure": "count(all('offer'))"}`:'give the kind a "figure", or leave this block out'));return;case"list":return te(e,n,s);case"divider":i!==!0&&s.findings.push(d("view-block",`${n}.${r}`,`write {"${r}": true}`));return}}function ne(e,n,t){k(e.figure,`${n}.figure`,t),"as"in e&&!L.includes(e.as)&&t.findings.push(d("view-format",`${n}.as`,`"${String(e.as)}" is not a way to say a figure`,`use one of ${L.join(", ")}`)),D(e,n,t,"figure"),"label"in e&&A(e.label,`${n}.label`,t),"emphasis"in e&&!B.includes(e.emphasis)&&t.findings.push(d("view-emphasis",`${n}.emphasis`,`"${String(e.emphasis)}" is not how loudly a figure is said`,`use ${B.map(s=>`"${s}"`).join(", ")}, or leave it out for the figure's own size`))}function D(e,n,t,s){"currency"in e&&(typeof e.currency!="string"||!/^[A-Z]{3}$/.test(e.currency)?t.findings.push(d("view-currency",`${n}.currency`,'a currency is its three-letter code, like "USD" or "EUR"')):e.as!=="money"&&t.findings.push(d("view-currency",`${n}.currency`,`a currency belongs on a ${s} shown as money`,'add "as": "money"')))}function ie(e,n){let t=[...n.kinds],s=(l,r)=>{let i=new Set;for(let o of l){let f=n.vocabulary.namesOf(o)?.targets?.(r);if(f==="*")return t;for(let u of f??[])i.add(u)}return i.size>0?[...i]:void 0},a=l=>{switch(l.t){case"ident":return n.kind!==null&&n.spec.relation(l.name)?s([n.kind],l.name):void 0;case"member":{let r=a(l.object);return r?s(r,l.name):void 0}case"where":return a(l.set);case"call":{let r=l.args[0],i=r?.t==="lit"&&typeof r.value=="string"?r.value:void 0;if(l.fn==="all")return i!==void 0&&n.kinds.has(i)?[i]:void 0;let o=l.args.length===2&&l.args[1]?.t==="lit"&&typeof l.args[1].value=="string"?l.args[1].value:void 0;if(l.fn==="out"&&o!==void 0){let f=a(r);return f?s(f,o):void 0}if(l.fn==="out")return i!==void 0&&n.kind!==null?s([n.kind],i):void 0;if(l.fn==="in"){let f=o??i,u=o!==void 0?a(r):n.kind!==null?[n.kind]:void 0,c=f!==void 0?n.vocabulary.sources(f).filter(p=>{let y=n.vocabulary.namesOf(p)?.targets?.(f);return!u||y==="*"||u.some(h=>y?.includes(h))}):[];return c.length>0?c:void 0}if((l.fn==="sort"||l.fn==="first")&&r)return a(r);if(l.fn==="either"){let f=l.args.map(a);return f.every(u=>u!==void 0)?[...new Set(f.flatMap(u=>u??[]))]:void 0}return}default:return}};return a(e)}function N(e,n,t,s){let a;try{a=w(e)}catch(r){if(!(r instanceof b))throw r;s.findings.push(d("expression",n,`${r.sentence} (at character ${r.at+1})`));return}let l=O(a);for(let r of l.unknownFunctions)s.findings.push(d("unknown-function",n,`"${r}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let r of l.edges)s.edges.has(r)||s.findings.push(d("view-edge",n,`"${r}" is not a relation any kind declares`));if(t)for(let r of l.names)r==="id"||t.some(i=>s.vocabulary.namesOf(i)?.field(r)||s.vocabulary.namesOf(i)?.relation(r))||s.findings.push(d("view-name",n,`${t.join(" and ")} ${t.length===1?"has":"have"} no field or relation called "${r}"`))}function te(e,n,t){let s=e.list;k(s,`${n}.list`,t);let a;if(typeof s=="string")try{a=ie(w(s),t)}catch{a=void 0}let l=i=>{if(!a)return[...t.kinds].map(f=>t.vocabulary.namesOf(f)?.choices?.(i)).find(f=>f!==void 0);let o=a.map(f=>t.vocabulary.namesOf(f)?.choices?.(i));return o.every(f=>f!==void 0)?[...new Set(o.flatMap(f=>f??[]))]:void 0},r=a?a.join(" and "):"any kind";if("sort"in e){let i=e.sort;if(typeof i=="string")N(i,`${n}.sort`,a,t);else if(g(i)&&typeof i.by=="string"&&Object.keys(i).every(o=>o==="by"||o==="direction")){let o=i.direction;o!==void 0&&o!=="asc"&&o!=="desc"&&o!=="choices"?t.findings.push(d("list-sort",`${n}.sort.direction`,`a list is sorted "asc", "desc" or "choices", not "${String(o)}"`,'"choices" puts a choice field in the order its choices are declared')):o==="choices"?l(i.by)===void 0&&t.findings.push(d("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"')):N(i.by,`${n}.sort.by`,a,t)}else t.findings.push(d("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)&&t.findings.push(d("list-limit",`${n}.limit`,`a limit is a whole number from 1 to ${M}`))}if("group"in e){let i=e.group,o=typeof i=="string"?i:g(i)&&typeof i.by=="string"?i.by:void 0;if(!(typeof i=="string"||g(i)&&Object.keys(i).every(u=>u==="by"||u==="headings"))||o===void 0)t.findings.push(d("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 u=l(o),c=u===void 0?X(o):void 0,p=c!==void 0&&(c.way!==void 0?t.edges.has(c.edge):a?a.every(y=>t.vocabulary.namesOf(y)?.relation(c.edge)):t.edges.has(c.edge));if(u===void 0&&!p&&t.findings.push(d("list-group",`${n}.group`,`"${o}" 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))t.findings.push(d("list-group",`${n}.group.headings`,'headings are words per choice, like {"pain": "What hurts"}, at most 80 characters each'));else if(u)for(let h of Object.keys(y))u.includes(h)||t.findings.push(d("list-group",`${n}.group.headings.${h}`,`"${h}" is not one of ${o}'s choices`,`use ${u.join(", ")}`))}}}"empty"in e&&(typeof e.empty!="string"||e.empty.length===0||e.empty.length>200)&&t.findings.push(d("list-empty",`${n}.empty`,"what an empty list says is a sentence, at most 200 characters")),"as"in e&&!C.includes(e.as)&&t.findings.push(d("list-as",`${n}.as`,`a list draws each record as its "card" or its "row", not "${String(e.as)}"`))}function oe(e,n,t){(typeof e!="string"||e.length===0||e.length>60)&&t.findings.push(d("view-label",n,"a label is a few words, at most 60 characters"))}function P(e,n,t,s,a,l,r){let i={kind:null,spec:q,kinds:s,edges:a,vocabulary:t,findings:l,count:0,all:0};Array.isArray(e)&&e.length===0&&l.push(d("view-shape",n,`${r} has no blocks`,'give it one: {"headline": "\u2026"}')),x(e,n,1,i),H(i,n,r,"show less")}function H(e,n,t,s){e.count>T?e.findings.push(d("view-size",n,`${t} has ${e.count} blocks at its top; a view has at most ${T} there, a group or a condition counting as one`,`${s}, or gather some into a group`)):e.all>I&&e.findings.push(d("view-size",n,`${t} has ${e.all} blocks counting the ones inside its groups and conditions; a view has at most ${I} in all`,s))}function se(e,n,t,s,a){Array.isArray(e)&&e.forEach((l,r)=>{if(!g(l)||l.name!=="blocks"||!g(l.options)||!("blocks"in l.options))return;let i=[];P(l.options.blocks,`lenses.${r}.options.blocks`,n,t,s,i,`the lens "${String(l.title??r)}"`);for(let o of i)a.push({...o,severity:"warning"})})}function re(e,n,t,s,a,l,r){let i=[];if(e===void 0)return i;if(!g(e))return i.push(d("view-shape",n,'views are an object of kinds, each with a "card", a "row" or a "page"')),i;for(let[o,f]of Object.entries(e)){if(o==="home"&&Array.isArray(f)){P(f,`${n}.home`,r,s,a,i,"the home");continue}let u=t(o);if(!u){i.push(d("view-kind",`${n}.${o}`,`"${o}" is not a kind this ${l} declares`));continue}if(!g(f)){i.push(d("view-shape",`${n}.${o}`,`a kind's views are {"card": [blocks], "row": [blocks], "page": [blocks]}`));continue}for(let c of Object.keys(f))E.includes(c)||i.push(d("view-slot",`${n}.${o}.${c}`,`"${c}" is not a place a view is drawn`,`use ${E.map(p=>`"${p}"`).join(", ")}`));for(let c of E){let p=f[c];if(p===void 0)continue;let y={kind:o,spec:u,kinds:s,edges:a,vocabulary:r,findings:i,count:0,all:0,slot:c};x(p,`${n}.${o}.${c}`,1,y),H(y,`${n}.${o}.${c}`,`this ${c}`,"show less, or move detail to the page")}}return i}function he(e){let n=new Set(Object.keys(e.kinds)),t=new Set(Object.values(e.kinds).flatMap(r=>Object.keys($(r.edges)))),s=r=>{let i=m(e.kinds,r)?e.kinds[r]:void 0;return i?{field:o=>m(i.fields,o)||m(i.computed,o)||F(i.edges).has(o),relation:o=>m($(i.edges),o),figure:i.figure!==void 0,files:o=>m(i.fields,o)&&Y(i.fields[o]),choices:o=>m(i.fields,o)&&i.fields[o].type==="enum"?i.fields[o].options:void 0,targets:o=>m($(i.edges),o)?i.edges[o].to:void 0,prose:o=>m(i.fields,o)&&i.fields[o].type==="text"}:void 0},a={namesOf:s,sources:r=>Object.keys(e.kinds).filter(i=>m(e.kinds[i].edges,r))},l=re(e.views,"views",s,n,t,"document",a);return se(e.lenses,a,n,t,l),l}export{j as a,U as b,L as c,B as d,M as e,ce as f,X as g,ge as h,ye as i,he as j};
1
+ import{a as O,b,c as w,d as R,e as V}from"./chunk.R5MLRKAO.js";import{h as d,i as S}from"./chunk.YMXWS4XN.js";import{Pa as $,Qa as F}from"./chunk.IQGSEAQ2.js";var E=["card","row","page"],j=["good","warn","bad","neutral","accent"],U=["money","percent","date","time","datetime","relative","count"],_=4,T=40,I=120,L=["number","money","percent"],B=["large"],C=["card","row"],M=1e3,ce=100;function X(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","lines"],badge:["tone"],field:["as","currency","label"],image:["as","label"],progress:["label"],group:["direction"],when:["show"],divider:[],figure:["as","currency","label","emphasis"]},Z=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"?, "lines"?: 0-12}, {"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}`,Y=e=>/^(image|video|file)$/.test(e?.of??e?.type??"");function ge(e){return Object.fromEntries(Object.entries(e.views??{}).filter(([,n])=>!Array.isArray(n)))}function ye(e){let n=e.views?.home;return Array.isArray(n)?n:void 0}var q={field:()=>!1,relation:()=>!1,figure:!1},z=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 W(e,n,t){let s=O(e);for(let a of s.unknownFunctions)t.findings.push(d("unknown-function",n,`"${a}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let a of s.names){if(t.kind===null){t.findings.push(d("view-name",n,`"${a}" 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}a==="id"||t.spec.field(a)||t.spec.relation(a)||t.findings.push(d("view-name",n,`${t.kind} has no field or relation called "${a}"`))}for(let a of s.edges)t.edges.has(a)||t.findings.push(d("view-edge",n,`"${a}" is not a relation any kind declares`));for(let a of s.sweeps)t.kinds.has(a)||t.findings.push(d("view-kind",n,`"${a}" is not a kind this document declares`))}function k(e,n,t){if(typeof e!="string"||e.length===0||e.length>2e3){t.findings.push(d("view-expression",n,`an expression is a line of the rule language, like "status == 'booked'"`));return}try{W(w(e),n,t)}catch(s){if(!(s instanceof b))throw s;t.findings.push(d("expression",n,`${s.sentence} (at character ${s.at+1})`))}}function A(e,n,t,s,a=!1){let l=s==="text";if(typeof e!="string"||e.length===0||e.length>300){t.findings.push(d("view-template",n,'a template is words with {field} in braces, like "{name}" or "{quote|money}", at most 300 characters'));return}let r;try{r=V(e)}catch(i){if(i instanceof R||i instanceof b){t.findings.push(d("template",n,i.sentence));return}throw i}for(let i of r)if(i.expr){if(W(i.expr,n,t),l&&!a&&!i.format&&i.expr.t==="ident"&&(t.slot==="card"||t.slot==="row")&&t.spec.prose?.(i.expr.name)){let o=i.expr.name;t.findings.push(S("view-whole-text",n,`${t.kind} ${t.slot} shows ${o} whole; it will be clamped. Use {${o}|excerpt} or move it to the page.`,`write {${o}|excerpt}, or {${o}|excerpt: 80} for fewer characters`))}if(s==="headline"&&!i.format&&i.expr.t==="ident"&&t.spec.prose?.(i.expr.name)){let o=i.expr.name;t.findings.push(S("view-headline-long",n,`${z(t)}${t.slot?` ${t.slot}`:""} heads it with ${o}, a long text, drawn at a headline's size; a headline is a few words.`,`say it in a text block, {"text": "{${o}}"}, or head it with {${o}|excerpt: 60}`))}}}var K=12;function J(e,n,t){typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=K||t.findings.push(d("view-lines",n,`lines is ${JSON.stringify(e)}, and a text block's lines is a whole number from 1 to ${K}, or 0 to show it whole`,'{"text": "{awards}", "lines": 6}, or "lines": 0 for no cut at all'))}function Q(e,n,t){if(typeof e=="string"){j.includes(e)||t.findings.push(d("view-tone",n,`"${e}" is not a tone`,`use one of ${j.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`,t);return}t.findings.push(d("view-tone",n,'a tone is a word or {"expr": \u2026}',`one of ${j.join(", ")}`))}function x(e,n,t,s){if(!Array.isArray(e)){s.findings.push(d("view-shape",n,"a view is a list of blocks"));return}if(t>_){s.findings.push(d("view-depth",n,`blocks nest at most ${_} deep`,"flatten a group or a condition"));return}e.forEach((a,l)=>ee(a,`${n}.${l}`,t,s))}function ee(e,n,t,s){if(t===1&&s.count++,s.all++,!g(e)){s.findings.push(d("view-block",n,"a block is an object naming what it shows",`one of ${G}`));return}let a=Object.keys(e),l=a.filter(o=>Z.includes(o)&&!(o==="group"&&a.includes("list")));if(l.length===0){s.findings.push(d("view-block",n,`${a.length>0?a.map(o=>`"${o}"`).join(", "):"an empty object"} is not a block Graview knows`,`one of ${G}`));return}if(l.length>1){s.findings.push(d("view-block",n,`a block is one thing, and this says ${l.map(o=>`"${o}"`).join(" and ")}`,"split it into two blocks"));return}let r=l[0];for(let o of a)o!==r&&o!="key"&&!v[r].includes(o)&&s.findings.push(d("unknown-key",`${n}.${o}`,`"${o}" is not part of a ${r} block`,v[r].length>0?`a ${r} block may also say ${v[r].map(f=>`"${f}"`).join(", ")}`:`a ${r} block says nothing else`));let i=e[r];switch(r){case"title":case"headline":case"text":case"badge":A(i,`${n}.${r}`,s,r==="text"||r==="headline"?r:void 0,r==="text"&&"lines"in e),"tone"in e&&Q(e.tone,`${n}.tone`,s),r==="text"&&"lines"in e&&J(e.lines,`${n}.lines`,s);return;case"image":case"field":{let o=r==="image";if(typeof i!="string"||!(o?s.spec.files?.(i):s.spec.field(i))){let u=typeof i=="string"&&s.spec.relation(i);s.findings.push(d(`view-${r}`,`${n}.${r}`,`${s.kind} has no ${o?"image, video or file ":""}field ${typeof i=="string"?`"${i}"`:"by that name"}`,u?`"${i}" is a relation; show it with {"text": "{${i}.name}"}`:void 0))}let f=o?["thumb","gallery"]:U;"as"in e&&!f.includes(e.as)&&s.findings.push(d("view-format",`${n}.as`,`"${String(e.as)}" is not a way to show ${o?"pictures":"a field"}`,`use one of ${f.join(", ")}`)),o||D(e,n,s,"field"),"label"in e&&oe(e.label,`${n}.label`,s);return}case"progress":{!g(i)||Object.keys(i).some(o=>o!=="value"&&o!=="max")||!("value"in i)||!("max"in i)?s.findings.push(d("view-progress",`${n}.progress`,'progress is {"value": expression, "max": expression}')):(k(i.value,`${n}.progress.value`,s),k(i.max,`${n}.progress.max`,s)),"label"in e&&A(e.label,`${n}.label`,s);return}case"group":"direction"in e&&e.direction!=="row"&&e.direction!=="column"&&s.findings.push(d("view-direction",`${n}.direction`,`a group runs "row" or "column", not "${String(e.direction)}"`)),x(i,`${n}.group`,t+1,s);return;case"when":k(i,`${n}.when`,s),"show"in e?x(e.show,`${n}.show`,t+1,s):s.findings.push(d("view-when",n,'a condition says what it shows: {"when": expr, "show": [blocks]}'));return;case"figure":if(typeof i=="string")return ne(e,n,s);for(let o of["as","currency","label","emphasis"])o in e&&s.findings.push(d("unknown-key",`${n}.${o}`,`"${o}" 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?s.findings.push(d("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}`)):s.spec.figure||s.findings.push(d("view-figure",`${n}.figure`,`${z(s)} has no figure to show`,s.kind===null?`work a number out: {"figure": "count(all('offer'))"}`:'give the kind a "figure", or leave this block out'));return;case"list":return te(e,n,s);case"divider":i!==!0&&s.findings.push(d("view-block",`${n}.${r}`,`write {"${r}": true}`));return}}function ne(e,n,t){k(e.figure,`${n}.figure`,t),"as"in e&&!L.includes(e.as)&&t.findings.push(d("view-format",`${n}.as`,`"${String(e.as)}" is not a way to say a figure`,`use one of ${L.join(", ")}`)),D(e,n,t,"figure"),"label"in e&&A(e.label,`${n}.label`,t),"emphasis"in e&&!B.includes(e.emphasis)&&t.findings.push(d("view-emphasis",`${n}.emphasis`,`"${String(e.emphasis)}" is not how loudly a figure is said`,`use ${B.map(s=>`"${s}"`).join(", ")}, or leave it out for the figure's own size`))}function D(e,n,t,s){"currency"in e&&(typeof e.currency!="string"||!/^[A-Z]{3}$/.test(e.currency)?t.findings.push(d("view-currency",`${n}.currency`,'a currency is its three-letter code, like "USD" or "EUR"')):e.as!=="money"&&t.findings.push(d("view-currency",`${n}.currency`,`a currency belongs on a ${s} shown as money`,'add "as": "money"')))}function ie(e,n){let t=[...n.kinds],s=(l,r)=>{let i=new Set;for(let o of l){let f=n.vocabulary.namesOf(o)?.targets?.(r);if(f==="*")return t;for(let u of f??[])i.add(u)}return i.size>0?[...i]:void 0},a=l=>{switch(l.t){case"ident":return n.kind!==null&&n.spec.relation(l.name)?s([n.kind],l.name):void 0;case"member":{let r=a(l.object);return r?s(r,l.name):void 0}case"where":return a(l.set);case"call":{let r=l.args[0],i=r?.t==="lit"&&typeof r.value=="string"?r.value:void 0;if(l.fn==="all")return i!==void 0&&n.kinds.has(i)?[i]:void 0;let o=l.args.length===2&&l.args[1]?.t==="lit"&&typeof l.args[1].value=="string"?l.args[1].value:void 0;if(l.fn==="out"&&o!==void 0){let f=a(r);return f?s(f,o):void 0}if(l.fn==="out")return i!==void 0&&n.kind!==null?s([n.kind],i):void 0;if(l.fn==="in"){let f=o??i,u=o!==void 0?a(r):n.kind!==null?[n.kind]:void 0,c=f!==void 0?n.vocabulary.sources(f).filter(p=>{let y=n.vocabulary.namesOf(p)?.targets?.(f);return!u||y==="*"||u.some(h=>y?.includes(h))}):[];return c.length>0?c:void 0}if((l.fn==="sort"||l.fn==="first")&&r)return a(r);if(l.fn==="either"){let f=l.args.map(a);return f.every(u=>u!==void 0)?[...new Set(f.flatMap(u=>u??[]))]:void 0}return}default:return}};return a(e)}function N(e,n,t,s){let a;try{a=w(e)}catch(r){if(!(r instanceof b))throw r;s.findings.push(d("expression",n,`${r.sentence} (at character ${r.at+1})`));return}let l=O(a);for(let r of l.unknownFunctions)s.findings.push(d("unknown-function",n,`"${r}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let r of l.edges)s.edges.has(r)||s.findings.push(d("view-edge",n,`"${r}" is not a relation any kind declares`));if(t)for(let r of l.names)r==="id"||t.some(i=>s.vocabulary.namesOf(i)?.field(r)||s.vocabulary.namesOf(i)?.relation(r))||s.findings.push(d("view-name",n,`${t.join(" and ")} ${t.length===1?"has":"have"} no field or relation called "${r}"`))}function te(e,n,t){let s=e.list;k(s,`${n}.list`,t);let a;if(typeof s=="string")try{a=ie(w(s),t)}catch{a=void 0}let l=i=>{if(!a)return[...t.kinds].map(f=>t.vocabulary.namesOf(f)?.choices?.(i)).find(f=>f!==void 0);let o=a.map(f=>t.vocabulary.namesOf(f)?.choices?.(i));return o.every(f=>f!==void 0)?[...new Set(o.flatMap(f=>f??[]))]:void 0},r=a?a.join(" and "):"any kind";if("sort"in e){let i=e.sort;if(typeof i=="string")N(i,`${n}.sort`,a,t);else if(g(i)&&typeof i.by=="string"&&Object.keys(i).every(o=>o==="by"||o==="direction")){let o=i.direction;o!==void 0&&o!=="asc"&&o!=="desc"&&o!=="choices"?t.findings.push(d("list-sort",`${n}.sort.direction`,`a list is sorted "asc", "desc" or "choices", not "${String(o)}"`,'"choices" puts a choice field in the order its choices are declared')):o==="choices"?l(i.by)===void 0&&t.findings.push(d("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"')):N(i.by,`${n}.sort.by`,a,t)}else t.findings.push(d("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)&&t.findings.push(d("list-limit",`${n}.limit`,`a limit is a whole number from 1 to ${M}`))}if("group"in e){let i=e.group,o=typeof i=="string"?i:g(i)&&typeof i.by=="string"?i.by:void 0;if(!(typeof i=="string"||g(i)&&Object.keys(i).every(u=>u==="by"||u==="headings"))||o===void 0)t.findings.push(d("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 u=l(o),c=u===void 0?X(o):void 0,p=c!==void 0&&(c.way!==void 0?t.edges.has(c.edge):a?a.every(y=>t.vocabulary.namesOf(y)?.relation(c.edge)):t.edges.has(c.edge));if(u===void 0&&!p&&t.findings.push(d("list-group",`${n}.group`,`"${o}" 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))t.findings.push(d("list-group",`${n}.group.headings`,'headings are words per choice, like {"pain": "What hurts"}, at most 80 characters each'));else if(u)for(let h of Object.keys(y))u.includes(h)||t.findings.push(d("list-group",`${n}.group.headings.${h}`,`"${h}" is not one of ${o}'s choices`,`use ${u.join(", ")}`))}}}"empty"in e&&(typeof e.empty!="string"||e.empty.length===0||e.empty.length>200)&&t.findings.push(d("list-empty",`${n}.empty`,"what an empty list says is a sentence, at most 200 characters")),"as"in e&&!C.includes(e.as)&&t.findings.push(d("list-as",`${n}.as`,`a list draws each record as its "card" or its "row", not "${String(e.as)}"`))}function oe(e,n,t){(typeof e!="string"||e.length===0||e.length>60)&&t.findings.push(d("view-label",n,"a label is a few words, at most 60 characters"))}function P(e,n,t,s,a,l,r){let i={kind:null,spec:q,kinds:s,edges:a,vocabulary:t,findings:l,count:0,all:0};Array.isArray(e)&&e.length===0&&l.push(d("view-shape",n,`${r} has no blocks`,'give it one: {"headline": "\u2026"}')),x(e,n,1,i),H(i,n,r,"show less")}function H(e,n,t,s){e.count>T?e.findings.push(d("view-size",n,`${t} has ${e.count} blocks at its top; a view has at most ${T} there, a group or a condition counting as one`,`${s}, or gather some into a group`)):e.all>I&&e.findings.push(d("view-size",n,`${t} has ${e.all} blocks counting the ones inside its groups and conditions; a view has at most ${I} in all`,s))}function se(e,n,t,s,a){Array.isArray(e)&&e.forEach((l,r)=>{if(!g(l)||l.name!=="blocks"||!g(l.options)||!("blocks"in l.options))return;let i=[];P(l.options.blocks,`lenses.${r}.options.blocks`,n,t,s,i,`the lens "${String(l.title??r)}"`);for(let o of i)a.push({...o,severity:"warning"})})}function re(e,n,t,s,a,l,r){let i=[];if(e===void 0)return i;if(!g(e))return i.push(d("view-shape",n,'views are an object of kinds, each with a "card", a "row" or a "page"')),i;for(let[o,f]of Object.entries(e)){if(o==="home"&&Array.isArray(f)){P(f,`${n}.home`,r,s,a,i,"the home");continue}let u=t(o);if(!u){i.push(d("view-kind",`${n}.${o}`,`"${o}" is not a kind this ${l} declares`));continue}if(!g(f)){i.push(d("view-shape",`${n}.${o}`,`a kind's views are {"card": [blocks], "row": [blocks], "page": [blocks]}`));continue}for(let c of Object.keys(f))E.includes(c)||i.push(d("view-slot",`${n}.${o}.${c}`,`"${c}" is not a place a view is drawn`,`use ${E.map(p=>`"${p}"`).join(", ")}`));for(let c of E){let p=f[c];if(p===void 0)continue;let y={kind:o,spec:u,kinds:s,edges:a,vocabulary:r,findings:i,count:0,all:0,slot:c};x(p,`${n}.${o}.${c}`,1,y),H(y,`${n}.${o}.${c}`,`this ${c}`,"show less, or move detail to the page")}}return i}function he(e){let n=new Set(Object.keys(e.kinds)),t=new Set(Object.values(e.kinds).flatMap(r=>Object.keys($(r.edges)))),s=r=>{let i=m(e.kinds,r)?e.kinds[r]:void 0;return i?{field:o=>m(i.fields,o)||m(i.computed,o)||F(i.edges).has(o),relation:o=>m($(i.edges),o),figure:i.figure!==void 0,files:o=>m(i.fields,o)&&Y(i.fields[o]),choices:o=>m(i.fields,o)&&i.fields[o].type==="enum"?i.fields[o].options:void 0,targets:o=>m($(i.edges),o)?i.edges[o].to:void 0,prose:o=>m(i.fields,o)&&i.fields[o].type==="text"}:void 0},a={namesOf:s,sources:r=>Object.keys(e.kinds).filter(i=>m(e.kinds[i].edges,r))},l=re(e.views,"views",s,n,t,"document",a);return se(e.lenses,a,n,t,l),l}export{j as a,U as b,L as c,B as d,M as e,ce as f,X as g,ge as h,ye as i,he as j};
@@ -1 +1 @@
1
- import{b as l}from"./chunk.JVDPRQ7J.js";import{ge as i}from"./chunk.Q4MI53KK.js";function c(e){return e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-|-$/g,"")}function p(e,n={}){let[t="/",a=""]=e.split("#")[0].split("?"),r=new URLSearchParams(a);n.filter&&r.set("filter",n.filter);let s=r.toString(),o=n.section?c(n.section):"";return`${t}${s?`?${s}`:""}${o?`#${o}`:""}`}var m=e=>({as:e.slug,title:e.title,kind:e.kind,is:e.kind===null?e.slug===i?"home":"overview":e.address.startsWith("/places/")?"place":"list",...e.hidden?{hidden:!0}:{}});function d(e,n){let t=[];for(let a of e)a.kind!==null&&n.has(a.kind)||a.over?.some(r=>n.has(r))||t.some(r=>r.as===a.slug)||t.push(m(a));return t}function y(e,n,t={}){return d(l(e,n,t.pages?{pages:t.pages}:{}),t.kept??new Set)}export{c as a,p as b,y as c};
1
+ import{b as l}from"./chunk.HZPRMHSL.js";import{ie as i}from"./chunk.IQGSEAQ2.js";function c(e){return e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-|-$/g,"")}function p(e,n={}){let[t="/",a=""]=e.split("#")[0].split("?"),r=new URLSearchParams(a);n.filter&&r.set("filter",n.filter);let s=r.toString(),o=n.section?c(n.section):"";return`${t}${s?`?${s}`:""}${o?`#${o}`:""}`}var m=e=>({as:e.slug,title:e.title,kind:e.kind,is:e.kind===null?e.slug===i?"home":"overview":e.address.startsWith("/places/")?"place":"list",...e.hidden?{hidden:!0}:{}});function d(e,n){let t=[];for(let a of e)a.kind!==null&&n.has(a.kind)||a.over?.some(r=>n.has(r))||t.some(r=>r.as===a.slug)||t.push(m(a));return t}function y(e,n,t={}){return d(l(e,n,t.pages?{pages:t.pages}:{}),t.kept??new Set)}export{c as a,p as b,y as c};
@@ -1 +1 @@
1
- import{b as Ce,d as $e,i as U}from"./chunk.2KIWGQXC.js";import{e as Te}from"./chunk.D5LOTCBU.js";import{L as ke,Lc as se,Pb as ae,Qd as Re,Td as De,Vd as We,Wd as Me,bb as Se,da as M,fa as xe,fb as G,ga as W,ka as _,la as z,ma as Ae,oa as we,pa as Ne,pe as je,td as ve,ud as Oe}from"./chunk.Q4MI53KK.js";function V(n,e){return n.display?.labels?.[e]??W(e)}function de(n){let e=U(n);switch(e.type){case"text":case"date":case"number":case"boolean":case"choice":return e.type;default:return}}function Je(n,e){let t=new Map,i=n.tryDefinition(e);for(let[r,a]of Object.entries(i?.edges??{}))t.set(r,{key:r,label:a.description?M(a.description):W(r),about:"edge",far:a.to==="*"?[...n.kinds]:[...a.to]});for(let r of n.definitions)if(r.kind!==e)for(let[a,s]of Object.entries(r.edges??{}))t.has(a)||s.to!=="*"&&!s.to.includes(e)||t.set(a,{key:a,label:s.inverse?M(s.inverse):W(a),about:"edge",far:[r.kind]});return[...t.values()]}var Ze=["current","past","any","flagged","clear"];function Fe(n,e){let t=n?.lifecycle;if(!t||t.retired==="date")return!1;let i=t.retired.map(String);return e.some(r=>r.key===t.field&&i.includes(r.value))}function Be(n,e){let t=n.tryDefinition(e);if(!t)return{kind:e,sorts:[],filters:[],groups:[]};let i=new Set(t.display?.hide??[]),r=t.fields.shape??{},a=[{key:"label",label:"Name",about:"label",type:"text"}],s=[],u=[];for(let[g,k]of Object.entries(r)){if(g==="id"||g==="kind"||g==="label"||i.has(g))continue;let A=en(k);if(A){s.push({key:g,label:V(t,g),about:"field",type:"choice",options:A});continue}let w=de(k);if(!w)continue;let N=V(t,g),O=w==="choice"?Le(k):w==="boolean"?["true","false"]:void 0,S={key:g,label:N,about:"field",type:w,...O?{options:O}:{}};a.push(S),s.push(S),(w==="boolean"||w==="choice")&&u.push(S),w==="date"&&u.push({...S,buckets:["day","week","month","year","decade"]})}for(let g of Je(n,e))a.push(g),s.push(g),u.push(g);let l={key:"is",label:t.lifecycle?"Standing and currency":"Standing",about:"is",type:"choice",options:t.lifecycle?[...Ze]:["flagged","clear"]};s.push(l);let y=t.fieldRoles?.order,f=y&&(y in r||y==="label")?{by:y,direction:"asc"}:void 0;return{kind:e,sorts:a,filters:s,groups:u,...f?{natural:f}:{}}}function On(n,e){let t=[];for(let r of e.filters){let a=r.about==="edge"&&r.far?.length===1?n.tryDefinition(r.far[0]):void 0;if(!(!a||a.kind===e.kind))for(let[s,u]of Object.entries(a.fields.shape??{}))de(u)!=="choice"||a.display?.hide?.includes(s)||t.push({key:`${r.key}.${s}`,label:`${r.label} \xB7 ${V(a,s)}`,about:"via",type:"choice",options:Le(u),far:[a.kind]})}if(t.length===0)return e;let i=e.filters.filter(r=>r.about!=="is");return{...e,filters:[...i,...t,...e.filters.filter(r=>r.about==="is")]}}function Rn(n,e){let t=n.tryDefinition(e.kind),i=Object.entries(t?.computed??{});if(!t||i.length===0)return e;let r=i.filter(([a])=>!e.sorts.some(s=>s.key===a)).map(([a,s])=>({key:a,label:(typeof s=="object"?s.label:void 0)??V(t,a),about:"field",type:"number"}));return{...e,sorts:[...e.sorts,...r]}}function Le(n){let e=U(n);return e.type==="choice"?e.options:[]}function en(n){let e=U(n);return e.type==="several"&&e.of.type==="choice"?e.of.options:void 0}var Ie=n=>n,Pe=n=>n;function nn(n,e,t){let i=new Map;for(let r of[...n.out(e,t),...n.in(e,t)])i.set(r.id,r);return[...i.values()]}function le(n,e,t){let i=n.schema.tryDefinition(e.kind);if(t.key==="is")switch(t.value){case"current":return _(i,Pe(e),n.today);case"past":return!_(i,Pe(e),n.today);case"any":return!0;case"flagged":return n.flagged?.has(e.id)??!1;case"clear":return!(n.flagged?.has(e.id)??!1);default:return!0}let r=i?.fields.shape??{};if(t.key in r){let l=Se(Ie(e),t.key,n.today??ke()),y=de(r[t.key]);if(y==="date"){let[f,g]=t.value.split(":");if(typeof l!="string"||!g)return!1;let k=l.slice(0,10);return f==="before"?k<g:f==="after"?k>g:k===g}if(y==="boolean")return String(l)===t.value;if(Array.isArray(l))return l.some(f=>String(f)===t.value);if(y==="number"){let f=t.value.lastIndexOf(":"),g=f>0?t.value.slice(0,f):"",k=Number(t.value.slice(f+1));if(g==="at-most"||g==="at-least")return typeof l!="number"||!Number.isFinite(k)?!1:g==="at-most"?l<=k:l>=k}return String(l)===t.value}let[a,s]=t.key.split("."),u=nn(n.graph,e.id,a);return s?u.some(l=>String(Ie(l)[s])===t.value):t.value==="*"?u.length>0:t.value==="none"?u.length===0:u.some(l=>l.id===t.value)}var tn=5;function ze(n){return n.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function ce(n){return ze(n).replace(/ /g,"")}var X=new Map,rn=5e4;function $(n){let e=X.get(n);if(e===void 0){X.size>=rn&&X.clear();let t=ze(n);e={tokens:t.split(" ").filter(Boolean),whole:t.replace(/ /g,"")},X.set(n,e)}return e}var T=n=>[...$(n).tokens];function j(n,e){if(e.length===0)return;let{whole:t,tokens:i}=$(n),r=e.join("");if(t.length===0)return;if(t===r)return"exact";if(e.every(s=>i.some(u=>u.startsWith(s))))return t.startsWith(r)?"prefix":e.every(s=>i.includes(s))?"word":"part"}function q(n,e,t=48){let i=n.replace(/\s+/g," ").trim();if(i.length<=t)return i;let r=e[0],a=i.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase(),s=r?a.search(new RegExp(`(^|[^\\p{L}\\p{N}])${on(r)}`,"u")):-1,u=s<0?0:s+(a[s]&&/[\p{L}\p{N}]/u.test(a[s])?0:1),l=Math.max(0,u-Math.floor(t/3));if(l>0){let f=i.lastIndexOf(" ",l);l=f<0?0:f+1}let y=Math.min(i.length,l+t);if(y<i.length){let f=i.indexOf(" ",y);y=f<0||f-y>16?y:f}return`${l>0?"\u2026":""}${i.slice(l,y).trim()}${y<i.length?"\u2026":""}`}var on=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),an=/^([\p{L}][\p{L}\p{N}_-]*):(\S+)$/u;function sn(n){let e=[],t=[];for(let i of n.trim().split(/\s+/).filter(Boolean)){let r=an.exec(i);r?t.push({key:r[1],value:r[2]}):e.push(i)}return{words:e.join(" "),conditions:t}}var Ee=new WeakMap;function Q(n,e){let t=Ee.get(e);if(t&&t.definition===n)return t.texts;let i=dn(n,e);return Ee.set(e,{definition:n,texts:i}),i}function dn(n,e){let t=z(n,e),i=[{field:"label",reading:"Name",text:t}];for(let r of $e(e,n,{limit:Number.POSITIVE_INFINITY}))r.key==="label"||r.value===t||typeof e[r.key]!="boolean"&&i.push({field:r.key,reading:r.label,text:r.markdown?Te(r.value):r.value});return i}var I={exact:0,prefix:1,word:2,part:3,field:4,near:5},Ge=new Set(["a","an","the","of","and","or","for","to","in","on","at","by","with","my","our","is"]);function Ke(n){let e=n;e.length>4&&e.endsWith("ies")?e=`${e.slice(0,-3)}y`:e.length>4&&/(ss|x|ch|sh|z)es$/.test(e)?e=e.slice(0,-2):e.length>3&&e.endsWith("s")&&!/(ss|us|is)$/.test(e)&&(e=e.slice(0,-1));for(let t of["ing","ed"])if(e.length>t.length+2&&e.endsWith(t)){e=e.slice(0,-t.length),/([b-df-hj-km-np-rtv-z])\1$/.test(e)&&(e=e.slice(0,-1));break}return e.length>3&&e.endsWith("e")?e.slice(0,-1):e}function He(n,e,t){if(Math.abs(n.length-e.length)>t)return t+1;let i=[],r=Array.from({length:e.length+1},(a,s)=>s);for(let a=1;a<=n.length;a++){let s=[a],u=a;for(let l=1;l<=e.length;l++){let y=Math.min(r[l]+1,s[l-1]+1,r[l-1]+(n[a-1]===e[l-1]?0:1));a>1&&l>1&&n[a-1]===e[l-2]&&n[a-2]===e[l-1]&&(y=Math.min(y,i[l-2]+1)),s[l]=y,y<u&&(u=y)}if(u>t)return t+1;i=r,r=s}return r[e.length]}var Y=new Map;function ln(n,e){let t=Y.get(n);t||(Y.size>=64&&Y.clear(),Y.set(n,t=new Map));let i=t.get(e);return i===void 0&&(i=cn(n,e)??null,t.set(e,i)),i??void 0}function cn(n,e){if(/\d/.test(n))return;let t=Ke(n);if(t.length>=3&&(Ke(e)===t||t.length>=4&&e.startsWith(t)))return"stem";let i=n.length<4?0:n.length<=7?1:2;if(i!==0){if(He(n,e,i)<=i)return"spelling";if(n.length>=5){for(let r=n.length-i;r<=n.length+i;r++)if(r<e.length&&He(n,e.slice(0,r),i)<=i)return"spelling"}}}function fn(n,e){let t=e.length>1?e.filter(r=>!Ge.has(r)):e;if(t.length===0)return;let i;for(let r of t){let a;for(let s of n){for(let u of $(s.text).tokens){if(u.startsWith(r)){a={text:s,matched:u};break}let l=a?void 0:ln(r,u);l&&(a={text:s,matched:u,by:l})}if(a&&!a.by)break}if(!a)return;a.by&&!i&&(i={text:a.text,asked:r,matched:a.matched,by:a.by})}if(i)return{field:i.text.field,reading:i.text.reading,fragment:q(i.text.text,[i.matched]),strength:"near",asked:i.asked,matched:i.matched,by:i.by}}var un=80;function gn(n,e,t){let i=T(e).filter(s=>!Ge.has(s)).join(" ")||e,r=t===void 0?[]:T(t),a=r.length>0&&n.find(s=>r.every(u=>$(s.text).tokens.some(l=>l.startsWith(u))))||n[0];return{field:a.field,reading:a.reading,fragment:q(a.text,r),strength:"near",asked:i,matched:(t??a.text).slice(0,un),by:"meaning"}}function _e(n,e,t,i){let r=T(t);if(r.length===0)return;if(i){let A=Q(n,e),w=i.includes("label")||i.some(v=>typeof e[v]=="string"&&e[v]===A[0].text),N=A.filter((v,D)=>D===0?w:i.includes(v.field)),O=v=>D=>$(D.text).tokens.some(P=>P.startsWith(v));if(!r.every(v=>N.some(O(v))))return;let S=N.find(O(r[0]));return{field:S.field,reading:S.reading,fragment:q(S.text,r),strength:S.field==="label"?j(S.text,r)??"field":"field"}}let a=Q(n,e),[s,...u]=a,l=j(s.text,r);if(l)return{field:"label",reading:s.reading,fragment:q(s.text,r),strength:l};let y=A=>w=>$(w.text).tokens.some(N=>N.startsWith(A));if(!r.every(A=>a.some(y(A))))return;let f=T(s.text),g=r.find(A=>!f.some(w=>w.startsWith(A)))??r[0],k=u.find(y(g));return{field:k.field,reading:k.reading,fragment:q(k.text,[g]),strength:"field"}}var yn=512,hn=64;function pn(n){let e=new Map;if(n.length===0)return e;let t=n.slice(-yn),i=n[n.length-1].seq;for(let r of t){let a=Math.pow(.5,(i-r.seq)/hn);for(let s of r.writes)e.set(s,(e.get(s)??0)+a)}return e}var ue=(n,e)=>we({tryDefinition:()=>n},e),fe=(n,e)=>De({tryDefinition:()=>n},e);function mn(n,e,t){let i=n.tryDefinition(e),r=[{field:"plural",text:ue(i,e)},{field:"kind",text:W(e)},...i?.noun?[{field:"noun",text:i.noun}]:[],...(i?.aliases??[]).map(s=>({field:"alias",text:s}))],a;for(let s of r){let u=j(s.text,t);u&&(!a||I[u]<I[a.strength])&&(a={strength:u,...s})}return a}var bn,kn=(n,e)=>(bn??=new Intl.Collator(void 0,{sensitivity:"base",numeric:!0})).compare(n,e),qe=(n,e)=>(n.nearly??0)-(e.nearly??0)||(n.archived??0)-(e.archived??0)||n.tier-e.tier||n.inKind-e.inKind||n.near-e.near||n.past-e.past||n.touched-e.touched||n.flagged-e.flagged||kn(n.name,e.name)||(n.id<e.id?-1:n.id>e.id?1:0);function En(n,e,t={}){let i=n.schema,r=sn(e),a=T(r.words),s=t.principal??{kind:"human"},u=n.kindsKeptFrom(s),l=n.modules.disabledKinds,y=r.conditions.filter(o=>o.key==="kind").map(o=>o.value),f=r.conditions.filter(o=>o.key==="is").map(o=>o.value),g=f.includes("any")||f.includes("past"),k=f.includes("past")&&!f.includes("any")&&!f.includes("current"),A=f.includes("archived")?!0:t.archived??"all",w=(o,d)=>{let c=ce(d),h=i.tryDefinition(o);return ce(o)===c||ce(ue(h,o))===c},N=i.kinds.filter(o=>!u.has(o)&&!l.has(o)&&(t.kinds===void 0||t.kinds.includes(o))&&(y.length===0||y.some(d=>w(o,d)))),S=r.conditions.filter(o=>o.key!=="kind").map(o=>({...o,admittedBy:N.filter(d=>Be(i,d).filters.some(c=>c.key===o.key))})),v=S.filter(o=>o.key!=="is"),D=f.filter(o=>o==="flagged"||o==="clear"||o==="past"||o==="archived"),P={kinds:N,past:g},Qe={hits:[],words:r.words,conditions:S,searched:P,byKind:{},total:0,matched:[]};if(a.length===0&&v.length===0&&D.length===0)return Qe;let J=t.today,F=t.flagged??new Set(n.violations().flatMap(o=>o.nodeIds)),Ue=t.touched??pn(n.log.all()),Z=new Set;for(let o of t.from??[]){Z.add(o);for(let d of n.graph.neighbors(o))Z.add(d.id)}let ge=ve(n,s)?Oe(n,s):void 0,ee=ae.keptFrom?.(n,s)&&n.seenBy(s).graph,ne=o=>je(o,t.basePath===void 0?{}:{basePath:t.basePath}),ye={schema:i,graph:n.graph,flagged:F,...J?{today:J}:{}},R=[],B={},L=[],E=[],K=(o,d,c,h,p,m)=>{let x=z(c,o);B[d]=(B[d]??0)+1,R.push({hit:{about:"node",id:o.id,kind:d,label:x,why:p,current:h,flagged:F.has(o.id),address:ne(`${fe(c,d)}/${encodeURIComponent(o.id)}`),...m===void 0?{}:{near:!0},...G(o)?{archived:!0}:{}},...m===void 0?{}:{nearly:2-m},tier:I[p.strength],inKind:d===t.inKind?0:1,near:Z.has(o.id)?0:1,past:h?0:1,archived:G(o)?1:0,touched:-(Ue.get(o.id)??0),flagged:F.has(o.id)?0:1,name:x,id:o.id})};for(let o of N){let d=i.tryDefinition(o),c=S.filter(p=>p.key!=="is"&&p.admittedBy.includes(o));if(a.length===0&&c.length===0&&D.length===0)continue;let h=Fe(d,c);for(let p of n.graph.nodesOfKind(o,{archived:A})){if(ge&&!ge(p.id))continue;let m=ee?ee.getNode(p.id):p;if(!m)continue;let x=_(d,m,J);if(!g&&!h&&!x){if(a.length>0&&f.length===0&&c.every(b=>le(ye,m,b))){let b=_e(d,m,r.words);b&&E.push({node:m,kind:o,definition:d,why:b})}continue}if(k&&x||!c.every(b=>le(ye,m,b))||f.includes("flagged")&&!F.has(m.id)||f.includes("clear")&&F.has(m.id))continue;let C=a.length>0?_e(d,m,r.words):c[0]?{field:c[0].key,reading:W(c[0].key),fragment:`${c[0].key}:${c[0].value}`,strength:"field"}:{field:"is",reading:"Is",fragment:`is:${D[0]}`,strength:"field"};C?K(m,o,d,x,C):a.length>0&&L.push({node:m,kind:o,definition:d,current:x})}}let te=o=>o.strength!=="field",re=!1;if(E.length>0&&R.length===0){re=!0;for(let o of E)K(o.node,o.kind,o.definition,!1,o.why)}else if(E.some(o=>te(o.why))&&!R.some(o=>te(o.hit.why))){re=!0;for(let o of E)te(o.why)&&K(o.node,o.kind,o.definition,!1,o.why)}let he=t.near!==!1&&a.length>0&&R.length<tn&&L.length>0,ie=new Set;if(he)for(let o of L){let d=fn(Q(o.definition,o.node),a);d&&(ie.add(o.node.id),K(o.node,o.kind,o.definition,o.current,d,d.by==="stem"?.9:.8))}let Ve=o=>o==="exact"||o==="prefix"?-1:I[o],oe=(o,d,c,h)=>({hit:o,tier:Ve(d),inKind:1,near:1,past:0,touched:0,flagged:1,name:c,id:h});if(a.length>0){for(let d of N){let c=mn(i,d,a);if(!c)continue;let h=Ne(i,d),p={field:c.field,reading:c.field==="plural"?"Plural":"Kind",fragment:c.text,strength:c.strength};R.push(oe({about:"kind",kind:d,label:h,why:p,count:B[d]??0,address:ne(fe(i.tryDefinition(d),d))},c.strength,h,`kind:${d}`))}let o=t.places??[];for(let d of Re(o.filter(c=>N.includes(c.kind)))){if(d.across&&u.has(d.across))continue;let c=j(d.title,a);if(!c)continue;let h={field:"title",reading:"Title",fragment:d.title,strength:c},p=Me(d,o)?fe(i.tryDefinition(d.kind),d.kind).slice(1):void 0,m=ne(We(d.as,p));R.push(oe({about:"place",kind:d.kind,title:d.title,as:d.as,why:h,address:m},c,d.title,`place:${d.kind}:${d.as}`))}for(let d of n.allInvariants()){let c=d.scope==="graph"?void 0:d.scope.kind;if(c&&!N.includes(c))continue;let h=d.label??W(d.name),p=j(h,a),m=p?void 0:j(W(d.name),a),x=p??m;if(!x)continue;let C={field:p?"label":"name",reading:p?"Rule":"Name",fragment:p?h:d.name,strength:x};R.push(oe({about:"rule",name:d.name,label:h,...c?{kind:c}:{},why:C},x,h,`rule:${d.name}`))}}let pe=()=>{R.sort(qe);let o=t.limit??50,d=R.slice(0,o).map(b=>b.hit),c=d.flatMap(b=>b.about==="node"?[(ee||n.graph).getNode(b.id)]:[]).filter(Boolean),h=Ce(c,b=>i.tryDefinition(b)),p=d.map(b=>b.about==="node"&&h.has(b.id)?{...b,apart:h.get(b.id)}:b),m=Object.values(B).reduce((b,Ye)=>b+Ye,0),x=R.flatMap(b=>b.hit.about==="node"?[b.hit.id]:[]),C=t.subject&&N.includes(String(n.graph.getNode(t.subject)?.kind))?xn(n,t.subject,r.words,{principal:s}):[];return{hits:[...p,...C],words:r.words,conditions:S,searched:re?{...P,past:!0}:P,byKind:{...B},total:m,matched:x}},H=pe(),me=t.rank;if(!he||!me)return H;let be=L.filter(o=>!ie.has(o.node.id)).map(({node:o,kind:d,definition:c})=>({id:o.id,kind:d,label:z(c,o),texts:Q(c,o)}));if(be.length===0)return H;let Xe=(async()=>{let o;try{o=await me(r.words,be)}catch{return H}let d=new Map(L.filter(h=>!ie.has(h.node.id)).map(h=>[h.node.id,h])),c=!1;for(let{id:h,score:p,matched:m}of Array.isArray(o)?o:[]){let x=d.get(h);!x||!(p>0)||(d.delete(h),c=!0,K(x.node,x.kind,x.definition,x.current,gn(Q(x.definition,x.node),r.words,typeof m=="string"?m:void 0),Math.min(1,p)))}return c?pe():H})();return{...H,later:Xe}}function xn(n,e,t,i={}){let r=i.principal??{kind:"human"},a=(ae.keptFrom?.(n,r)?n.seenBy(r):n).graph.getNode(e);if(!a)return[];if(n.kindsKeptFrom(r).has(a.kind))return[];let s=T(t),u=z(n.schema.tryDefinition(a.kind),a),l=[];for(let f of n.allMutations()){let g=f.subject;if(!g||g.kinds!=="*"&&!g.kinds.includes(a.kind))continue;let k=f.derived?.act;if((k==="archive"||k==="merge")&&G(a)||k==="unarchive"&&!G(a)||k==="leave-alone"&&se(a)||k==="allow-tidying"&&!se(a)||!n.permits({name:f.name,args:{[g.arg]:a.id}},r).ok)continue;let A=Ae(f),w=T(A),N=s.filter(v=>w.some(D=>D.startsWith(v))),O=N.length>0?j(A,N):void 0,S=O?{field:"title",reading:"Act",fragment:A,strength:O}:{field:"subject",reading:"On",fragment:u,strength:"field"};l.push({hit:{about:"act",name:f.name,title:A,subject:a.id,why:S,destructive:f.destructive===!0},tier:O?I[O]:I.field+1,inKind:0,near:0,past:f.destructive?1:0,touched:0,flagged:f.pinned?0:1,name:A,id:`act:${f.name}`})}l.sort(qe);let y=l.map(f=>f.hit);return i.limit===void 0?y:y.slice(0,i.limit)}function Kn(n,e){let t=e.kinds.map((a,s)=>{let u=ue(n.tryDefinition(a),a);return s===0?u:u.toLowerCase()}),i=xe(t)||"Nothing";return e.kinds.some(a=>n.tryDefinition(a)?.lifecycle)?e.past?`${M(i)}, past ones included.`:`${M(i)}, current ones; add is:any for past ones.`:`${M(i)}.`}export{V as a,de as b,Je as c,Fe as d,Be as e,On as f,Rn as g,Le as h,Ie as i,Pe as j,nn as k,le as l,ze as m,ce as n,sn as o,_e as p,pn as q,En as r,xn as s,Kn as t};
1
+ import{b as Ce,d as $e,i as U}from"./chunk.5IEZF433.js";import{e as Te}from"./chunk.5AD2QHWH.js";import{L as ke,Lc as se,Pb as ae,Sd as Re,Vd as De,Xd as We,Yd as Me,bb as Se,da as M,fa as xe,fb as G,ga as W,ka as _,la as z,ma as Ae,oa as we,pa as Ne,re as je,vd as ve,wd as Oe}from"./chunk.IQGSEAQ2.js";function V(n,e){return n.display?.labels?.[e]??W(e)}function de(n){let e=U(n);switch(e.type){case"text":case"date":case"number":case"boolean":case"choice":return e.type;default:return}}function Je(n,e){let t=new Map,i=n.tryDefinition(e);for(let[r,a]of Object.entries(i?.edges??{}))t.set(r,{key:r,label:a.description?M(a.description):W(r),about:"edge",far:a.to==="*"?[...n.kinds]:[...a.to]});for(let r of n.definitions)if(r.kind!==e)for(let[a,s]of Object.entries(r.edges??{}))t.has(a)||s.to!=="*"&&!s.to.includes(e)||t.set(a,{key:a,label:s.inverse?M(s.inverse):W(a),about:"edge",far:[r.kind]});return[...t.values()]}var Ze=["current","past","any","flagged","clear"];function Fe(n,e){let t=n?.lifecycle;if(!t||t.retired==="date")return!1;let i=t.retired.map(String);return e.some(r=>r.key===t.field&&i.includes(r.value))}function Be(n,e){let t=n.tryDefinition(e);if(!t)return{kind:e,sorts:[],filters:[],groups:[]};let i=new Set(t.display?.hide??[]),r=t.fields.shape??{},a=[{key:"label",label:"Name",about:"label",type:"text"}],s=[],u=[];for(let[g,k]of Object.entries(r)){if(g==="id"||g==="kind"||g==="label"||i.has(g))continue;let A=en(k);if(A){s.push({key:g,label:V(t,g),about:"field",type:"choice",options:A});continue}let w=de(k);if(!w)continue;let N=V(t,g),O=w==="choice"?Le(k):w==="boolean"?["true","false"]:void 0,S={key:g,label:N,about:"field",type:w,...O?{options:O}:{}};a.push(S),s.push(S),(w==="boolean"||w==="choice")&&u.push(S),w==="date"&&u.push({...S,buckets:["day","week","month","year","decade"]})}for(let g of Je(n,e))a.push(g),s.push(g),u.push(g);let l={key:"is",label:t.lifecycle?"Standing and currency":"Standing",about:"is",type:"choice",options:t.lifecycle?[...Ze]:["flagged","clear"]};s.push(l);let y=t.fieldRoles?.order,f=y&&(y in r||y==="label")?{by:y,direction:"asc"}:void 0;return{kind:e,sorts:a,filters:s,groups:u,...f?{natural:f}:{}}}function On(n,e){let t=[];for(let r of e.filters){let a=r.about==="edge"&&r.far?.length===1?n.tryDefinition(r.far[0]):void 0;if(!(!a||a.kind===e.kind))for(let[s,u]of Object.entries(a.fields.shape??{}))de(u)!=="choice"||a.display?.hide?.includes(s)||t.push({key:`${r.key}.${s}`,label:`${r.label} \xB7 ${V(a,s)}`,about:"via",type:"choice",options:Le(u),far:[a.kind]})}if(t.length===0)return e;let i=e.filters.filter(r=>r.about!=="is");return{...e,filters:[...i,...t,...e.filters.filter(r=>r.about==="is")]}}function Rn(n,e){let t=n.tryDefinition(e.kind),i=Object.entries(t?.computed??{});if(!t||i.length===0)return e;let r=i.filter(([a])=>!e.sorts.some(s=>s.key===a)).map(([a,s])=>({key:a,label:(typeof s=="object"?s.label:void 0)??V(t,a),about:"field",type:"number"}));return{...e,sorts:[...e.sorts,...r]}}function Le(n){let e=U(n);return e.type==="choice"?e.options:[]}function en(n){let e=U(n);return e.type==="several"&&e.of.type==="choice"?e.of.options:void 0}var Ie=n=>n,Pe=n=>n;function nn(n,e,t){let i=new Map;for(let r of[...n.out(e,t),...n.in(e,t)])i.set(r.id,r);return[...i.values()]}function le(n,e,t){let i=n.schema.tryDefinition(e.kind);if(t.key==="is")switch(t.value){case"current":return _(i,Pe(e),n.today);case"past":return!_(i,Pe(e),n.today);case"any":return!0;case"flagged":return n.flagged?.has(e.id)??!1;case"clear":return!(n.flagged?.has(e.id)??!1);default:return!0}let r=i?.fields.shape??{};if(t.key in r){let l=Se(Ie(e),t.key,n.today??ke()),y=de(r[t.key]);if(y==="date"){let[f,g]=t.value.split(":");if(typeof l!="string"||!g)return!1;let k=l.slice(0,10);return f==="before"?k<g:f==="after"?k>g:k===g}if(y==="boolean")return String(l)===t.value;if(Array.isArray(l))return l.some(f=>String(f)===t.value);if(y==="number"){let f=t.value.lastIndexOf(":"),g=f>0?t.value.slice(0,f):"",k=Number(t.value.slice(f+1));if(g==="at-most"||g==="at-least")return typeof l!="number"||!Number.isFinite(k)?!1:g==="at-most"?l<=k:l>=k}return String(l)===t.value}let[a,s]=t.key.split("."),u=nn(n.graph,e.id,a);return s?u.some(l=>String(Ie(l)[s])===t.value):t.value==="*"?u.length>0:t.value==="none"?u.length===0:u.some(l=>l.id===t.value)}var tn=5;function ze(n){return n.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function ce(n){return ze(n).replace(/ /g,"")}var X=new Map,rn=5e4;function $(n){let e=X.get(n);if(e===void 0){X.size>=rn&&X.clear();let t=ze(n);e={tokens:t.split(" ").filter(Boolean),whole:t.replace(/ /g,"")},X.set(n,e)}return e}var T=n=>[...$(n).tokens];function j(n,e){if(e.length===0)return;let{whole:t,tokens:i}=$(n),r=e.join("");if(t.length===0)return;if(t===r)return"exact";if(e.every(s=>i.some(u=>u.startsWith(s))))return t.startsWith(r)?"prefix":e.every(s=>i.includes(s))?"word":"part"}function q(n,e,t=48){let i=n.replace(/\s+/g," ").trim();if(i.length<=t)return i;let r=e[0],a=i.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase(),s=r?a.search(new RegExp(`(^|[^\\p{L}\\p{N}])${on(r)}`,"u")):-1,u=s<0?0:s+(a[s]&&/[\p{L}\p{N}]/u.test(a[s])?0:1),l=Math.max(0,u-Math.floor(t/3));if(l>0){let f=i.lastIndexOf(" ",l);l=f<0?0:f+1}let y=Math.min(i.length,l+t);if(y<i.length){let f=i.indexOf(" ",y);y=f<0||f-y>16?y:f}return`${l>0?"\u2026":""}${i.slice(l,y).trim()}${y<i.length?"\u2026":""}`}var on=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),an=/^([\p{L}][\p{L}\p{N}_-]*):(\S+)$/u;function sn(n){let e=[],t=[];for(let i of n.trim().split(/\s+/).filter(Boolean)){let r=an.exec(i);r?t.push({key:r[1],value:r[2]}):e.push(i)}return{words:e.join(" "),conditions:t}}var Ee=new WeakMap;function Q(n,e){let t=Ee.get(e);if(t&&t.definition===n)return t.texts;let i=dn(n,e);return Ee.set(e,{definition:n,texts:i}),i}function dn(n,e){let t=z(n,e),i=[{field:"label",reading:"Name",text:t}];for(let r of $e(e,n,{limit:Number.POSITIVE_INFINITY}))r.key==="label"||r.value===t||typeof e[r.key]!="boolean"&&i.push({field:r.key,reading:r.label,text:r.markdown?Te(r.value):r.value});return i}var I={exact:0,prefix:1,word:2,part:3,field:4,near:5},Ge=new Set(["a","an","the","of","and","or","for","to","in","on","at","by","with","my","our","is"]);function Ke(n){let e=n;e.length>4&&e.endsWith("ies")?e=`${e.slice(0,-3)}y`:e.length>4&&/(ss|x|ch|sh|z)es$/.test(e)?e=e.slice(0,-2):e.length>3&&e.endsWith("s")&&!/(ss|us|is)$/.test(e)&&(e=e.slice(0,-1));for(let t of["ing","ed"])if(e.length>t.length+2&&e.endsWith(t)){e=e.slice(0,-t.length),/([b-df-hj-km-np-rtv-z])\1$/.test(e)&&(e=e.slice(0,-1));break}return e.length>3&&e.endsWith("e")?e.slice(0,-1):e}function He(n,e,t){if(Math.abs(n.length-e.length)>t)return t+1;let i=[],r=Array.from({length:e.length+1},(a,s)=>s);for(let a=1;a<=n.length;a++){let s=[a],u=a;for(let l=1;l<=e.length;l++){let y=Math.min(r[l]+1,s[l-1]+1,r[l-1]+(n[a-1]===e[l-1]?0:1));a>1&&l>1&&n[a-1]===e[l-2]&&n[a-2]===e[l-1]&&(y=Math.min(y,i[l-2]+1)),s[l]=y,y<u&&(u=y)}if(u>t)return t+1;i=r,r=s}return r[e.length]}var Y=new Map;function ln(n,e){let t=Y.get(n);t||(Y.size>=64&&Y.clear(),Y.set(n,t=new Map));let i=t.get(e);return i===void 0&&(i=cn(n,e)??null,t.set(e,i)),i??void 0}function cn(n,e){if(/\d/.test(n))return;let t=Ke(n);if(t.length>=3&&(Ke(e)===t||t.length>=4&&e.startsWith(t)))return"stem";let i=n.length<4?0:n.length<=7?1:2;if(i!==0){if(He(n,e,i)<=i)return"spelling";if(n.length>=5){for(let r=n.length-i;r<=n.length+i;r++)if(r<e.length&&He(n,e.slice(0,r),i)<=i)return"spelling"}}}function fn(n,e){let t=e.length>1?e.filter(r=>!Ge.has(r)):e;if(t.length===0)return;let i;for(let r of t){let a;for(let s of n){for(let u of $(s.text).tokens){if(u.startsWith(r)){a={text:s,matched:u};break}let l=a?void 0:ln(r,u);l&&(a={text:s,matched:u,by:l})}if(a&&!a.by)break}if(!a)return;a.by&&!i&&(i={text:a.text,asked:r,matched:a.matched,by:a.by})}if(i)return{field:i.text.field,reading:i.text.reading,fragment:q(i.text.text,[i.matched]),strength:"near",asked:i.asked,matched:i.matched,by:i.by}}var un=80;function gn(n,e,t){let i=T(e).filter(s=>!Ge.has(s)).join(" ")||e,r=t===void 0?[]:T(t),a=r.length>0&&n.find(s=>r.every(u=>$(s.text).tokens.some(l=>l.startsWith(u))))||n[0];return{field:a.field,reading:a.reading,fragment:q(a.text,r),strength:"near",asked:i,matched:(t??a.text).slice(0,un),by:"meaning"}}function _e(n,e,t,i){let r=T(t);if(r.length===0)return;if(i){let A=Q(n,e),w=i.includes("label")||i.some(v=>typeof e[v]=="string"&&e[v]===A[0].text),N=A.filter((v,D)=>D===0?w:i.includes(v.field)),O=v=>D=>$(D.text).tokens.some(P=>P.startsWith(v));if(!r.every(v=>N.some(O(v))))return;let S=N.find(O(r[0]));return{field:S.field,reading:S.reading,fragment:q(S.text,r),strength:S.field==="label"?j(S.text,r)??"field":"field"}}let a=Q(n,e),[s,...u]=a,l=j(s.text,r);if(l)return{field:"label",reading:s.reading,fragment:q(s.text,r),strength:l};let y=A=>w=>$(w.text).tokens.some(N=>N.startsWith(A));if(!r.every(A=>a.some(y(A))))return;let f=T(s.text),g=r.find(A=>!f.some(w=>w.startsWith(A)))??r[0],k=u.find(y(g));return{field:k.field,reading:k.reading,fragment:q(k.text,[g]),strength:"field"}}var yn=512,hn=64;function pn(n){let e=new Map;if(n.length===0)return e;let t=n.slice(-yn),i=n[n.length-1].seq;for(let r of t){let a=Math.pow(.5,(i-r.seq)/hn);for(let s of r.writes)e.set(s,(e.get(s)??0)+a)}return e}var ue=(n,e)=>we({tryDefinition:()=>n},e),fe=(n,e)=>De({tryDefinition:()=>n},e);function mn(n,e,t){let i=n.tryDefinition(e),r=[{field:"plural",text:ue(i,e)},{field:"kind",text:W(e)},...i?.noun?[{field:"noun",text:i.noun}]:[],...(i?.aliases??[]).map(s=>({field:"alias",text:s}))],a;for(let s of r){let u=j(s.text,t);u&&(!a||I[u]<I[a.strength])&&(a={strength:u,...s})}return a}var bn,kn=(n,e)=>(bn??=new Intl.Collator(void 0,{sensitivity:"base",numeric:!0})).compare(n,e),qe=(n,e)=>(n.nearly??0)-(e.nearly??0)||(n.archived??0)-(e.archived??0)||n.tier-e.tier||n.inKind-e.inKind||n.near-e.near||n.past-e.past||n.touched-e.touched||n.flagged-e.flagged||kn(n.name,e.name)||(n.id<e.id?-1:n.id>e.id?1:0);function En(n,e,t={}){let i=n.schema,r=sn(e),a=T(r.words),s=t.principal??{kind:"human"},u=n.kindsKeptFrom(s),l=n.modules.disabledKinds,y=r.conditions.filter(o=>o.key==="kind").map(o=>o.value),f=r.conditions.filter(o=>o.key==="is").map(o=>o.value),g=f.includes("any")||f.includes("past"),k=f.includes("past")&&!f.includes("any")&&!f.includes("current"),A=f.includes("archived")?!0:t.archived??"all",w=(o,d)=>{let c=ce(d),h=i.tryDefinition(o);return ce(o)===c||ce(ue(h,o))===c},N=i.kinds.filter(o=>!u.has(o)&&!l.has(o)&&(t.kinds===void 0||t.kinds.includes(o))&&(y.length===0||y.some(d=>w(o,d)))),S=r.conditions.filter(o=>o.key!=="kind").map(o=>({...o,admittedBy:N.filter(d=>Be(i,d).filters.some(c=>c.key===o.key))})),v=S.filter(o=>o.key!=="is"),D=f.filter(o=>o==="flagged"||o==="clear"||o==="past"||o==="archived"),P={kinds:N,past:g},Qe={hits:[],words:r.words,conditions:S,searched:P,byKind:{},total:0,matched:[]};if(a.length===0&&v.length===0&&D.length===0)return Qe;let J=t.today,F=t.flagged??new Set(n.violations().flatMap(o=>o.nodeIds)),Ue=t.touched??pn(n.log.all()),Z=new Set;for(let o of t.from??[]){Z.add(o);for(let d of n.graph.neighbors(o))Z.add(d.id)}let ge=ve(n,s)?Oe(n,s):void 0,ee=ae.keptFrom?.(n,s)&&n.seenBy(s).graph,ne=o=>je(o,t.basePath===void 0?{}:{basePath:t.basePath}),ye={schema:i,graph:n.graph,flagged:F,...J?{today:J}:{}},R=[],B={},L=[],E=[],K=(o,d,c,h,p,m)=>{let x=z(c,o);B[d]=(B[d]??0)+1,R.push({hit:{about:"node",id:o.id,kind:d,label:x,why:p,current:h,flagged:F.has(o.id),address:ne(`${fe(c,d)}/${encodeURIComponent(o.id)}`),...m===void 0?{}:{near:!0},...G(o)?{archived:!0}:{}},...m===void 0?{}:{nearly:2-m},tier:I[p.strength],inKind:d===t.inKind?0:1,near:Z.has(o.id)?0:1,past:h?0:1,archived:G(o)?1:0,touched:-(Ue.get(o.id)??0),flagged:F.has(o.id)?0:1,name:x,id:o.id})};for(let o of N){let d=i.tryDefinition(o),c=S.filter(p=>p.key!=="is"&&p.admittedBy.includes(o));if(a.length===0&&c.length===0&&D.length===0)continue;let h=Fe(d,c);for(let p of n.graph.nodesOfKind(o,{archived:A})){if(ge&&!ge(p.id))continue;let m=ee?ee.getNode(p.id):p;if(!m)continue;let x=_(d,m,J);if(!g&&!h&&!x){if(a.length>0&&f.length===0&&c.every(b=>le(ye,m,b))){let b=_e(d,m,r.words);b&&E.push({node:m,kind:o,definition:d,why:b})}continue}if(k&&x||!c.every(b=>le(ye,m,b))||f.includes("flagged")&&!F.has(m.id)||f.includes("clear")&&F.has(m.id))continue;let C=a.length>0?_e(d,m,r.words):c[0]?{field:c[0].key,reading:W(c[0].key),fragment:`${c[0].key}:${c[0].value}`,strength:"field"}:{field:"is",reading:"Is",fragment:`is:${D[0]}`,strength:"field"};C?K(m,o,d,x,C):a.length>0&&L.push({node:m,kind:o,definition:d,current:x})}}let te=o=>o.strength!=="field",re=!1;if(E.length>0&&R.length===0){re=!0;for(let o of E)K(o.node,o.kind,o.definition,!1,o.why)}else if(E.some(o=>te(o.why))&&!R.some(o=>te(o.hit.why))){re=!0;for(let o of E)te(o.why)&&K(o.node,o.kind,o.definition,!1,o.why)}let he=t.near!==!1&&a.length>0&&R.length<tn&&L.length>0,ie=new Set;if(he)for(let o of L){let d=fn(Q(o.definition,o.node),a);d&&(ie.add(o.node.id),K(o.node,o.kind,o.definition,o.current,d,d.by==="stem"?.9:.8))}let Ve=o=>o==="exact"||o==="prefix"?-1:I[o],oe=(o,d,c,h)=>({hit:o,tier:Ve(d),inKind:1,near:1,past:0,touched:0,flagged:1,name:c,id:h});if(a.length>0){for(let d of N){let c=mn(i,d,a);if(!c)continue;let h=Ne(i,d),p={field:c.field,reading:c.field==="plural"?"Plural":"Kind",fragment:c.text,strength:c.strength};R.push(oe({about:"kind",kind:d,label:h,why:p,count:B[d]??0,address:ne(fe(i.tryDefinition(d),d))},c.strength,h,`kind:${d}`))}let o=t.places??[];for(let d of Re(o.filter(c=>N.includes(c.kind)))){if(d.across&&u.has(d.across))continue;let c=j(d.title,a);if(!c)continue;let h={field:"title",reading:"Title",fragment:d.title,strength:c},p=Me(d,o)?fe(i.tryDefinition(d.kind),d.kind).slice(1):void 0,m=ne(We(d.as,p));R.push(oe({about:"place",kind:d.kind,title:d.title,as:d.as,why:h,address:m},c,d.title,`place:${d.kind}:${d.as}`))}for(let d of n.allInvariants()){let c=d.scope==="graph"?void 0:d.scope.kind;if(c&&!N.includes(c))continue;let h=d.label??W(d.name),p=j(h,a),m=p?void 0:j(W(d.name),a),x=p??m;if(!x)continue;let C={field:p?"label":"name",reading:p?"Rule":"Name",fragment:p?h:d.name,strength:x};R.push(oe({about:"rule",name:d.name,label:h,...c?{kind:c}:{},why:C},x,h,`rule:${d.name}`))}}let pe=()=>{R.sort(qe);let o=t.limit??50,d=R.slice(0,o).map(b=>b.hit),c=d.flatMap(b=>b.about==="node"?[(ee||n.graph).getNode(b.id)]:[]).filter(Boolean),h=Ce(c,b=>i.tryDefinition(b)),p=d.map(b=>b.about==="node"&&h.has(b.id)?{...b,apart:h.get(b.id)}:b),m=Object.values(B).reduce((b,Ye)=>b+Ye,0),x=R.flatMap(b=>b.hit.about==="node"?[b.hit.id]:[]),C=t.subject&&N.includes(String(n.graph.getNode(t.subject)?.kind))?xn(n,t.subject,r.words,{principal:s}):[];return{hits:[...p,...C],words:r.words,conditions:S,searched:re?{...P,past:!0}:P,byKind:{...B},total:m,matched:x}},H=pe(),me=t.rank;if(!he||!me)return H;let be=L.filter(o=>!ie.has(o.node.id)).map(({node:o,kind:d,definition:c})=>({id:o.id,kind:d,label:z(c,o),texts:Q(c,o)}));if(be.length===0)return H;let Xe=(async()=>{let o;try{o=await me(r.words,be)}catch{return H}let d=new Map(L.filter(h=>!ie.has(h.node.id)).map(h=>[h.node.id,h])),c=!1;for(let{id:h,score:p,matched:m}of Array.isArray(o)?o:[]){let x=d.get(h);!x||!(p>0)||(d.delete(h),c=!0,K(x.node,x.kind,x.definition,x.current,gn(Q(x.definition,x.node),r.words,typeof m=="string"?m:void 0),Math.min(1,p)))}return c?pe():H})();return{...H,later:Xe}}function xn(n,e,t,i={}){let r=i.principal??{kind:"human"},a=(ae.keptFrom?.(n,r)?n.seenBy(r):n).graph.getNode(e);if(!a)return[];if(n.kindsKeptFrom(r).has(a.kind))return[];let s=T(t),u=z(n.schema.tryDefinition(a.kind),a),l=[];for(let f of n.allMutations()){let g=f.subject;if(!g||g.kinds!=="*"&&!g.kinds.includes(a.kind))continue;let k=f.derived?.act;if((k==="archive"||k==="merge")&&G(a)||k==="unarchive"&&!G(a)||k==="leave-alone"&&se(a)||k==="allow-tidying"&&!se(a)||!n.permits({name:f.name,args:{[g.arg]:a.id}},r).ok)continue;let A=Ae(f),w=T(A),N=s.filter(v=>w.some(D=>D.startsWith(v))),O=N.length>0?j(A,N):void 0,S=O?{field:"title",reading:"Act",fragment:A,strength:O}:{field:"subject",reading:"On",fragment:u,strength:"field"};l.push({hit:{about:"act",name:f.name,title:A,subject:a.id,why:S,destructive:f.destructive===!0},tier:O?I[O]:I.field+1,inKind:0,near:0,past:f.destructive?1:0,touched:0,flagged:f.pinned?0:1,name:A,id:`act:${f.name}`})}l.sort(qe);let y=l.map(f=>f.hit);return i.limit===void 0?y:y.slice(0,i.limit)}function Kn(n,e){let t=e.kinds.map((a,s)=>{let u=ue(n.tryDefinition(a),a);return s===0?u:u.toLowerCase()}),i=xe(t)||"Nothing";return e.kinds.some(a=>n.tryDefinition(a)?.lifecycle)?e.past?`${M(i)}, past ones included.`:`${M(i)}, current ones; add is:any for past ones.`:`${M(i)}.`}export{V as a,de as b,Je as c,Fe as d,Be as e,On as f,Rn as g,Le as h,Ie as i,Pe as j,nn as k,le as l,ze as m,ce as n,sn as o,_e as p,pn as q,En as r,xn as s,Kn as t};