graview 0.1.67 → 0.1.68
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.
- package/dist/preview/{chunk.YCD4JSXD.js → chunk.2BMZPALF.js} +1 -1
- package/dist/preview/{chunk.SNHKYH72.js → chunk.2KCDLCB2.js} +1 -1
- package/dist/preview/{chunk.O2OL6RQQ.js → chunk.2ME4DVBI.js} +1 -1
- package/dist/preview/chunk.2TUEBU7X.js +8 -0
- package/dist/preview/{chunk.LYEGRY77.js → chunk.2U6HB4XU.js} +1 -1
- package/dist/preview/{chunk.7S6ZRMW4.js → chunk.32JE2WS7.js} +1 -1
- package/dist/preview/{chunk.RG5G6YQD.js → chunk.3DEWQDP7.js} +1 -1
- package/dist/preview/{chunk.GVT4UUQA.js → chunk.3JMQKANL.js} +1 -1
- package/dist/preview/{chunk.A5PSEU3W.js → chunk.3VEZ5MOC.js} +1 -1
- package/dist/preview/chunk.3WPCS6KP.js +1 -0
- package/dist/preview/{chunk.5R744JGZ.js → chunk.42C3FIKK.js} +1 -1
- package/dist/preview/{chunk.IAEGJDF3.js → chunk.42KHFGN6.js} +1 -1
- package/dist/preview/{chunk.DZMIYEHQ.js → chunk.4DXPPM6T.js} +1 -1
- package/dist/preview/chunk.4GVKKBQL.js +1 -0
- package/dist/preview/{chunk.KX5ZBHMA.js → chunk.4TT3ZHSJ.js} +1 -1
- package/dist/preview/{chunk.QXLJGHMC.js → chunk.4YAO3A5Q.js} +3 -3
- package/dist/preview/{chunk.Z4TY44CD.js → chunk.5JKUT2OM.js} +1 -1
- package/dist/preview/chunk.5L4ADKTW.js +1 -0
- package/dist/preview/{chunk.BKYZSV2Y.js → chunk.64LCHHZB.js} +1 -1
- package/dist/preview/{chunk.ZEZUKRC6.js → chunk.6AANHELP.js} +1 -1
- package/dist/preview/{chunk.ZAQ4IDX6.js → chunk.6DMCEBSO.js} +1 -1
- package/dist/preview/{chunk.NKLPL7QD.js → chunk.6IR5LBJU.js} +1 -1
- package/dist/preview/{chunk.X226YATK.js → chunk.6WB2TYK7.js} +1 -1
- package/dist/preview/chunk.6ZENHSTQ.js +1 -0
- package/dist/preview/{chunk.EJ2EZL2G.js → chunk.7K2V5FUB.js} +1 -1
- package/dist/preview/chunk.7OL6H4LF.js +1 -0
- package/dist/preview/{chunk.4W57E7AX.js → chunk.7TDML5YU.js} +1 -1
- package/dist/preview/{chunk.AJMVRFYX.js → chunk.7WPVLEX2.js} +2 -2
- package/dist/preview/{chunk.XSWSBTUO.js → chunk.7ZTGB4O7.js} +1 -1
- package/dist/preview/{chunk.FRQSLWP4.js → chunk.ACNOP2IU.js} +1 -1
- package/dist/preview/{chunk.N4ZKZ4GM.js → chunk.AENP662H.js} +1 -1
- package/dist/preview/{chunk.SFBHPYRD.js → chunk.AQ2PI6MR.js} +1 -1
- package/dist/preview/chunk.ARS4HJD2.js +1 -0
- package/dist/preview/{chunk.STPA7HBK.js → chunk.AWV57UBJ.js} +1 -1
- package/dist/preview/{chunk.D7NWMXSX.js → chunk.AYZL3LCR.js} +3 -3
- package/dist/preview/{chunk.URQTF5SY.js → chunk.BHJRT57H.js} +1 -1
- package/dist/preview/{chunk.7UHPHEH5.js → chunk.BPNW5KCP.js} +1 -1
- package/dist/preview/{chunk.TTSGCNPT.js → chunk.BQAFFEOA.js} +1 -1
- package/dist/preview/chunk.C2QKA6XY.js +1 -0
- package/dist/preview/{chunk.6KJGRM7A.js → chunk.CE3NKAF7.js} +1 -1
- package/dist/preview/{chunk.QRQ5WPZI.js → chunk.CFE3MHWZ.js} +1 -1
- package/dist/preview/{chunk.H6KIEDZN.js → chunk.CGBOPPNL.js} +1 -1
- package/dist/preview/{chunk.LP2ZMAT2.js → chunk.CNN32262.js} +1 -1
- package/dist/preview/{chunk.HJUZMOW2.js → chunk.DCLF4WWZ.js} +1 -1
- package/dist/preview/{chunk.GMLONS5L.js → chunk.DGDW54KE.js} +1 -1
- package/dist/preview/{chunk.3GNT5MKP.js → chunk.DLSS56EU.js} +1 -1
- package/dist/preview/{chunk.QAM76AXV.js → chunk.DMZRFXH7.js} +1 -1
- package/dist/preview/{chunk.Z2XUVJAL.js → chunk.DPHH5ZVL.js} +1 -1
- package/dist/preview/{chunk.Z27NSSYL.js → chunk.DZ6UDZOB.js} +2 -2
- package/dist/preview/{chunk.6W6XMLSF.js → chunk.E423JCOS.js} +1 -1
- package/dist/preview/{chunk.35KMZHB7.js → chunk.EB7PZJEO.js} +1 -1
- package/dist/preview/{chunk.V7H4BUEB.js → chunk.ECNGVD25.js} +1 -1
- package/dist/preview/{chunk.B7KZBT27.js → chunk.EGSOHTZZ.js} +1 -1
- package/dist/preview/{chunk.OCXY5DCD.js → chunk.EGVM24ND.js} +1 -1
- package/dist/preview/{chunk.UDHPMVC4.js → chunk.ENLIIZF2.js} +1 -1
- package/dist/preview/{chunk.H3EGBDW2.js → chunk.EP5JS7ZH.js} +1 -1
- package/dist/preview/{chunk.TI5FR2QQ.js → chunk.F5GNNVSQ.js} +1 -1
- package/dist/preview/chunk.FHQ25SWY.js +1 -0
- package/dist/preview/{chunk.F464JKHZ.js → chunk.FSW535EA.js} +1 -1
- package/dist/preview/{chunk.G5GVT6JY.js → chunk.FZELUSK5.js} +1 -1
- package/dist/preview/{chunk.UWS4RMM3.js → chunk.G2BDEWJC.js} +1 -1
- package/dist/preview/chunk.GF3ZCX46.js +2 -0
- package/dist/preview/{chunk.UW52CMGJ.js → chunk.GJTEV6CK.js} +1 -1
- package/dist/preview/{chunk.A7GVTE5Y.js → chunk.GKTQ5CZA.js} +2 -2
- package/dist/preview/{chunk.ZG5VGP5U.js → chunk.GONZB3J3.js} +1 -1
- package/dist/preview/{chunk.FLJXYESX.js → chunk.GRBWXTST.js} +1 -1
- package/dist/preview/{chunk.Z3O2VZAJ.js → chunk.GRTBEA7O.js} +1 -1
- package/dist/preview/{chunk.QNP5OR3P.js → chunk.H3IGXHZR.js} +2 -2
- package/dist/preview/{chunk.ILJDLBPJ.js → chunk.H3W5C3XQ.js} +1 -1
- package/dist/preview/{chunk.O5VFKVZS.js → chunk.H4VNIAHN.js} +1 -1
- package/dist/preview/{chunk.7ARRVNUR.js → chunk.HH4D3JEI.js} +1 -1
- package/dist/preview/{chunk.MUSMNKE4.js → chunk.HWFJQ42Y.js} +1 -1
- package/dist/preview/{chunk.37RFCHSS.js → chunk.HXTKBISQ.js} +1 -1
- package/dist/preview/{chunk.J2OPIS3H.js → chunk.I34BWUB4.js} +1 -1
- package/dist/preview/{chunk.ZAPS4J6G.js → chunk.I63462I3.js} +1 -1
- package/dist/preview/{chunk.6UQFV53C.js → chunk.IKKKHHRN.js} +1 -1
- package/dist/preview/{chunk.GRFD42WM.js → chunk.IPGLITWA.js} +1 -1
- package/dist/preview/{chunk.3NSV3WKM.js → chunk.IT5DVKXY.js} +2 -2
- package/dist/preview/{chunk.JQ2WNKDW.js → chunk.IXMIU4D4.js} +1 -1
- package/dist/preview/{chunk.JVB5KDSG.js → chunk.JCETQQ7J.js} +1 -1
- package/dist/preview/{chunk.M7KXQGQL.js → chunk.JGRSUTPJ.js} +1 -1
- package/dist/preview/{chunk.KFT7JIEH.js → chunk.JLDJZET2.js} +1 -1
- package/dist/preview/{chunk.JQ63N4MZ.js → chunk.JULD4XFB.js} +1 -1
- package/dist/preview/{chunk.LVOTLGJB.js → chunk.JV432T4Q.js} +1 -1
- package/dist/preview/{chunk.6SJEZWH3.js → chunk.KAM73WVF.js} +1 -1
- package/dist/preview/{chunk.AKJS2NUM.js → chunk.KUCBNMIY.js} +1 -1
- package/dist/preview/{chunk.DWM7AR5Y.js → chunk.L7XKYGV7.js} +1 -1
- package/dist/preview/{chunk.EP6Q32WT.js → chunk.LFFJB6D3.js} +1 -1
- package/dist/preview/{chunk.264PB572.js → chunk.LMTG5NPG.js} +1 -1
- package/dist/preview/{chunk.EGPCVMDU.js → chunk.LOKGUALC.js} +1 -1
- package/dist/preview/{chunk.FPHRAO3R.js → chunk.LZ6MSQ5O.js} +1 -1
- package/dist/preview/chunk.MBTEOF4R.js +1 -0
- package/dist/preview/{chunk.RJY7VJBH.js → chunk.MIOLBZBS.js} +1 -1
- package/dist/preview/{chunk.G3GFDVO2.js → chunk.MK5RPEB2.js} +1 -1
- package/dist/preview/{chunk.NSOPYIT4.js → chunk.MKL4THIV.js} +1 -1
- package/dist/preview/{chunk.FVQKSN33.js → chunk.MPWLDQOG.js} +1 -1
- package/dist/preview/chunk.MSUZAJ2K.js +4 -0
- package/dist/preview/{chunk.MSAYU25L.js → chunk.N5Z34V7U.js} +1 -1
- package/dist/preview/chunk.N64RVSH3.js +1 -0
- package/dist/preview/{chunk.HAOB6O72.js → chunk.ND3DEDWB.js} +1 -1
- package/dist/preview/{chunk.GFLH7RCI.js → chunk.NFTPJAMJ.js} +1 -1
- package/dist/preview/{chunk.QZQCQWQG.js → chunk.NRCWMYLH.js} +1 -1
- package/dist/preview/{chunk.47XEJZ3O.js → chunk.O2VXTYUJ.js} +1 -1
- package/dist/preview/{chunk.6N4PE3U5.js → chunk.O32F6LGK.js} +1 -1
- package/dist/preview/{chunk.PZ7KY6XH.js → chunk.O5FTWXA2.js} +1 -1
- package/dist/preview/{chunk.T2OUHRAA.js → chunk.ODYJEDIW.js} +1 -1
- package/dist/preview/{chunk.DKEIEH2D.js → chunk.OQ4ZO3YY.js} +1 -1
- package/dist/preview/chunk.PI4RFOBU.js +1 -0
- package/dist/preview/{chunk.E5PYNAYT.js → chunk.PIMAG4WT.js} +2 -2
- package/dist/preview/{chunk.EFVSZKB5.js → chunk.PLIV3IQK.js} +1 -1
- package/dist/preview/{chunk.77C556NM.js → chunk.PPCDPYYU.js} +1 -1
- package/dist/preview/{chunk.MW7R5G3C.js → chunk.PZQ5P6WK.js} +1 -1
- package/dist/preview/chunk.Q42R2KW4.js +1 -0
- package/dist/preview/{chunk.WEMUKZKH.js → chunk.Q4VFLLUT.js} +1 -1
- package/dist/preview/{chunk.SY5ID44D.js → chunk.Q6H5HESF.js} +1 -1
- package/dist/preview/chunk.QM54TGU6.js +3 -0
- package/dist/preview/{chunk.HN4ZJ4B4.js → chunk.QOQ26NXM.js} +1 -1
- package/dist/preview/{chunk.SJQPTDAT.js → chunk.QUETLFBJ.js} +1 -1
- package/dist/preview/{chunk.P2EKKKK2.js → chunk.QWLK3GKG.js} +1 -1
- package/dist/preview/{chunk.JEC5FDKX.js → chunk.QYPU444Y.js} +1 -1
- package/dist/preview/{chunk.TXZQEJ5T.js → chunk.QZP3ARLH.js} +1 -1
- package/dist/preview/{chunk.WALVW3KJ.js → chunk.R3GE37OI.js} +1 -1
- package/dist/preview/chunk.R66ZVMWB.js +1 -0
- package/dist/preview/{chunk.YZPESGCP.js → chunk.RQG672MJ.js} +1 -1
- package/dist/preview/chunk.RYA7A4NA.js +1 -0
- package/dist/preview/{chunk.LRNFE3UK.js → chunk.SADR3MQI.js} +1 -1
- package/dist/preview/{chunk.MJY4SLWA.js → chunk.SS6KL5NT.js} +1 -1
- package/dist/preview/chunk.SUG6LIOX.js +1 -0
- package/dist/preview/{chunk.SO6NT5K7.js → chunk.TFJA4QV4.js} +1 -1
- package/dist/preview/{chunk.D4WJ7OM5.js → chunk.TOUSIUJF.js} +1 -1
- package/dist/preview/{chunk.ARWO4WOV.js → chunk.TR4YFVZN.js} +1 -1
- package/dist/preview/{chunk.XFLGSUYO.js → chunk.TRNJKHIA.js} +1 -1
- package/dist/preview/{chunk.5AKZROMR.js → chunk.TVWK3SGD.js} +1 -1
- package/dist/preview/chunk.U7PAFLUM.js +1 -0
- package/dist/preview/{chunk.NKYWIGC7.js → chunk.UAMPR4MD.js} +1 -1
- package/dist/preview/{chunk.UGQYMN4J.js → chunk.UD7VLXPM.js} +1 -1
- package/dist/preview/{chunk.UQIPEMJ5.js → chunk.UFURYU4R.js} +1 -1
- package/dist/preview/{chunk.R6JBA7UK.js → chunk.UODTUBQ7.js} +1 -1
- package/dist/preview/{chunk.NRURQGXV.js → chunk.VES4XMZX.js} +1 -1
- package/dist/preview/{chunk.QWGWOEBZ.js → chunk.VLXLBGMY.js} +1 -1
- package/dist/preview/{chunk.IDALEKIW.js → chunk.VTDOWXCP.js} +1 -1
- package/dist/preview/{chunk.4EMKCKDB.js → chunk.VV5JAM5W.js} +1 -1
- package/dist/preview/{chunk.JU6UFWS3.js → chunk.VW632VNJ.js} +1 -1
- package/dist/preview/{chunk.25QFDTCU.js → chunk.WC5WE34A.js} +1 -1
- package/dist/preview/chunk.WN7SAAH6.js +1 -0
- package/dist/preview/{chunk.4UUJHLHR.js → chunk.WV45KLXC.js} +1 -1
- package/dist/preview/{chunk.NAXOXBOF.js → chunk.XDZDNZ7B.js} +1 -1
- package/dist/preview/{chunk.MAKCZ6B6.js → chunk.XFH6GHBQ.js} +1 -1
- package/dist/preview/{chunk.2VUX54XH.js → chunk.XRE7SHLD.js} +1 -1
- package/dist/preview/{chunk.J6HF7IRQ.js → chunk.XXCHO2A5.js} +1 -1
- package/dist/preview/{chunk.A4EZAGG7.js → chunk.Y7OGJOPA.js} +1 -1
- package/dist/preview/{chunk.6NG76MDA.js → chunk.YBQ5GVAX.js} +2 -2
- package/dist/preview/{chunk.QF5QB5YR.js → chunk.YL2RBZFE.js} +1 -1
- package/dist/preview/{chunk.RSQ432QN.js → chunk.YM6SWEUI.js} +1 -1
- package/dist/preview/{chunk.7BJRHPE3.js → chunk.Z2X7BFCB.js} +2 -2
- package/dist/preview/{chunk.VBLQJVQ5.js → chunk.Z67LBSQO.js} +1 -1
- package/dist/preview/{chunk.OHAO6KKH.js → chunk.ZKXIZBCN.js} +1 -1
- package/dist/preview/{chunk.BDNQMKDG.js → chunk.ZLEBOR5T.js} +1 -1
- package/dist/preview/{chunk.CKDCTFLU.js → chunk.ZLNUZ6LR.js} +1 -1
- package/dist/preview/chunk.ZMADWPJO.js +1 -0
- package/dist/preview/chunk.ZO6VMEPP.js +1 -0
- package/dist/preview/chunk.ZUG7U7AT.js +1 -0
- package/dist/preview/index.html +55 -55
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.2FHIINXG.js +0 -2
- package/dist/preview/chunk.3ENPWZBG.js +0 -1
- package/dist/preview/chunk.3ZODN6BW.js +0 -1
- package/dist/preview/chunk.55G4IPOO.js +0 -1
- package/dist/preview/chunk.5J6DVR7S.js +0 -1
- package/dist/preview/chunk.7WHQWLL6.js +0 -1
- package/dist/preview/chunk.B5SJMCTT.js +0 -7
- package/dist/preview/chunk.CTUJZ3IV.js +0 -1
- package/dist/preview/chunk.CY7FFKEZ.js +0 -1
- package/dist/preview/chunk.DEKRFTRN.js +0 -4
- package/dist/preview/chunk.EBKH3ILT.js +0 -1
- package/dist/preview/chunk.FOUBDGL3.js +0 -1
- package/dist/preview/chunk.HB5NWHFP.js +0 -3
- package/dist/preview/chunk.HVBKI5ZO.js +0 -1
- package/dist/preview/chunk.I3SDKMQS.js +0 -1
- package/dist/preview/chunk.J5OLYVZ4.js +0 -1
- package/dist/preview/chunk.JKFVNQY7.js +0 -1
- package/dist/preview/chunk.KGMSSXZL.js +0 -1
- package/dist/preview/chunk.NXZL5CA2.js +0 -1
- package/dist/preview/chunk.PSNMZBVS.js +0 -1
- package/dist/preview/chunk.R7CRBRD4.js +0 -1
- package/dist/preview/chunk.RR25BGWP.js +0 -1
- package/dist/preview/chunk.T27QKVKP.js +0 -1
- package/dist/preview/chunk.T3WCRS6M.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ot}from"./chunk.T6PU3NKP.js";import"./chunk.J6HF7IRQ.js";import{e as V,l as ue,n as G,r as st}from"./chunk.LRNFE3UK.js";import{a as ee}from"./chunk.G4JJXA63.js";import"./chunk.URQTF5SY.js";import{c as nt}from"./chunk.LP2ZMAT2.js";import{d as tt}from"./chunk.M7KXQGQL.js";import"./chunk.XOZU4OFA.js";import"./chunk.H3EGBDW2.js";import"./chunk.B7KZBT27.js";import"./chunk.SO6NT5K7.js";import"./chunk.MUSMNKE4.js";import{d as et}from"./chunk.SJQPTDAT.js";import{b as Ze}from"./chunk.JQ63N4MZ.js";import"./chunk.Z3O2VZAJ.js";import{L as ze,Zd as Ne,_ as Je,_d as Xe,la as Ye,oa as qe,ta as Ae,ua as F,vb as Ve,wb as Qe}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var At="Nothing by that name here.",$=o=>o.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[’']/g,"'").replace(/[^\p{L}\p{N}' ]+/gu," ").replace(/\s+/g," ").trim(),Nt=/^(?:(?:can you |could you |please )?(?:go|take me|bring me|head|jump|navigate|switch|get me)(?: back)? to|(?:please )?(?:open|show(?: me)?|bring up|let me see|view)) (.+)$/,St=/^(?:(?:can you |could you |please )?tell me (?:about|of)|what(?: is|'s| are) (?:in |on )?|describe|explain|who(?: is|'s)) (.+)$/,Ot=/^(?:what(?: is|'s| am i looking at| do i see)(?: (?:here|this|on (?:this|the) (?:page|screen)|in view|this place|this page))?|where am i|describe (?:this|here|this place|this page)|tell me about (?:this|here|this place|this page))$/,rt=new Set(["here","this","this place","this page","on this page","on the page","on this screen","in view"]),Ct=/^(?:date|day|when|on|at|the date|the day)$/,jt=/^(?:what(?: is|'s) (?:wrong|broken|the (?:problem|matter|trouble))|what needs (?:fixing|attention|doing)|any (?:problems|issues|trouble)|(?:show(?: me)? |go to |open )?(?:the )?(?:problems|issues|trouble|standing|what's wrong)|is (?:anything|something) (?:wrong|broken)|are there (?:any )?(?:problems|issues))(?: (?:with|about|on|in) (.+))?$/,z=o=>o.replace(/^(?:the|a|an|my|our) /,""),te=new Set(["the","a","an","my","our","all","any","of","that","which","who","are","is","be","what","whats","what's","with","me","show","list","every","there","do","i","have","we","due","for","please","were","was","by","from","in","on"]),ft=864e5,he=o=>Date.UTC(Number(o.slice(0,4)),Number(o.slice(5,7))-1,Number(o.slice(8,10))),xe=o=>new Date(o).toISOString().slice(0,10),C=(o,i)=>xe(he(o)+i*ft),xt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Mt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Wt="(monday|tuesday|tues|wednesday|thursday|thurs|friday|saturday|sunday)",it="(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sept|sep|oct|nov|dec)",at="(\\d{1,2})(?:st|nd|rd|th)?",Dt=o=>xt.findIndex(i=>i.startsWith(o.slice(0,3))),dt=o=>Mt.findIndex(i=>o.startsWith(i.toLowerCase()));function Rt(o,i){return Je(o,{year:o.slice(0,4)!==i.slice(0,4)})}function Se(o,i,y){if(o<0||i<1||i>31)return;let f=Number(y.slice(0,4)),c=k=>{let j=Date.UTC(k,o,i);return new Date(j).getUTCMonth()===o?xe(j):void 0},p=c(f);if(p)return he(p)<he(y)-183*ft?c(f+1):p}function Oe(o,i,y){let f=new Date(he(i)).getUTCDay(),c=u=>{let S=(f-y+7)%7,w=C(i,-S+u*7);return{from:w,to:C(w,6)}},p=()=>{let u=`${i.slice(0,8)}01`,S=new Date(Date.UTC(Number(i.slice(0,4)),Number(i.slice(5,7)),1));return{from:u,to:C(xe(S.getTime()),-1)}},k=u=>u?{from:u,to:u,day:Rt(u,i)}:void 0,j=(u,S)=>{let w=Dt(S);return k(u==="this"||u==="next"?C(c(u==="next"?1:0).from,(w-y+7)%7):u==="last"?C(i,-((f-w+6)%7+1)):C(i,(w-f+7)%7))},J=u=>{let S=C(i,f===0?-1:6-f);return{from:C(S,u*7),to:C(S,u*7+1)}},B="\\b(?:(?:due |for |on |by )(?:the )?)?",P=[[/\b(?:overdue|past due|late)\b/,()=>({overdue:!0,to:C(i,-1)})],[/\b(?:due |for |on )?today\b/,()=>({from:i,to:i})],[/\b(?:due |for |on )?tomorrow\b/,()=>k(C(i,1))],[/\b(?:due |for |on )?yesterday\b/,()=>k(C(i,-1))],[/\b(?:due |for |on )?this week\b/,()=>c(0)],[/\b(?:due |for |on )?next week\b/,()=>c(1)],[/\b(?:due |for |on )?(?:last|previous) week\b/,()=>c(-1)],[/\b(?:due |for |on )?next weekend\b/,()=>J(1)],[/\b(?:due |for |on )?(?:this |the )?weekend\b/,()=>J(0)],[/\b(?:due |for |on )?this month\b/,()=>p()],[new RegExp(`${B}(\\d{4}) (\\d{2}) (\\d{2})\\b`),u=>k(Se(Number(u[2])-1,Number(u[3]),`${u[1]}-01-01`))],[new RegExp(`${B}${at} (?:of )?${it}\\b`),u=>k(Se(dt(u[2]),Number(u[1]),i))],[new RegExp(`${B}${it} (?:the )?${at}\\b`),u=>k(Se(dt(u[1]),Number(u[2]),i))],[new RegExp(`${B}(?:(this|next|last|coming) )?${Wt}\\b`),u=>j(u[1],u[2])]];for(let[u,S]of P){let w=o.match(u);if(!w)continue;let N=S(w);if(N)return{ask:{words:w[0],...N},rest:o.replace(w[0]," ").replace(/\s+/g," ").trim()}}}function ht(o,i,y={}){let f=y.principal??{kind:"human"},c=o.seenBy(f),p=c.schema,k=y.today??o.today?.()??ze(),j=y.weekStartsOn??1,J=o.kindsKeptFrom(f),B=o.modules.disabledKinds,P=p.kinds.filter(e=>!J.has(e)&&!B.has(e)),u=new Set(P),S=(y.places??[]).filter(e=>e.kind===null||u.has(e.kind)),w=c.graph,N=$(i).replace(/[?.!]+$/,"").trim();if(N.length===0)return{unresolved:!0};let M=e=>p.tryDefinition(e),H=e=>Ye(M(e.kind),e),I=e=>qe(p,e),se=e=>S.find(t=>t.kind===e&&t.address===Ne(p,e))?.address??Ne(p,e),ge=e=>Xe(p,e.kind,e.id),Me=e=>({to:"record",id:e.id,kind:e.kind,label:H(e),address:ge(e),said:`Went to ${H(e)}.`}),We=e=>{let t=`Went to ${e.title}.`;return e.kind===null?{to:"place",slug:e.slug,title:e.title,address:e.address,...e.slug==="overview"?{face:"scene"}:{},said:t}:e.lens||e.address.startsWith("/places/")?{to:"picture",kind:e.kind,as:e.slug,title:e.title,address:e.address,said:t}:{to:"kind",kind:e.kind,title:e.title,address:e.address,said:t}},De=()=>({unresolved:!0,say:At}),oe=e=>{let t=M(e.kind),s=et(e,t,{limit:3,excerpt:!0}).map(r=>r.alone.startsWith(r.label)?r.alone:`${r.label.toLowerCase()} ${r.alone}`).join(", "),n=c.violations().filter(r=>r.nodeIds.includes(e.id));return[`${H(e)} \u2014 ${Ae(F(t,e.kind))}${s?` (${s})`:""}.`,n.length>0?`Trouble: ${n.map(r=>r.message).join("; ")}.`:""].filter(Boolean).join(" ")},re=e=>{let t=new Set([G(e),G(z(e))]);for(let n of[" page"," view"," lens"," place"," picture"," list"])e.endsWith(n)&&(t.add(G(e.slice(0,-n.length))),t.add(G(z(e.slice(0,-n.length)))));t.delete("");let s=n=>t.has(G(n.title))||t.has(G(z($(n.title))))||t.has(G(n.slug));return S.find(n=>n.kind!==null&&n.address.startsWith("/places/")&&s(n))??S.find(s)},pe=e=>{let t=st(o,e,{principal:f,today:k,limit:6,near:!1,...y.selection?{from:y.selection}:{}}),s=t.hits.filter(r=>r.about==="node"&&u.has(r.kind)&&w.getNode(r.id)!==void 0),n=s.filter(r=>r.why.field==="label"&&r.why.strength==="exact");return n.length===1?{one:w.getNode(n[0].id),picks:s}:n.length>1?{picks:n}:s.length===1&&t.total===1?{one:w.getNode(s[0].id),picks:s}:{picks:s}},Re=e=>{let t=e.map(s=>`${s.label} (${F(M(s.kind),s.kind)})`);return`${e.length===1?"One thing matches":`${e.length} things match`}: ${t.join("; ")}.`},Ee=(e,t)=>{if(rt.has(e))return Le();let s=t?pe(z(e)||e):void 0,n=s?.one&&$(H(s.one))===$(z(e)||e)?void 0:re(e);if(n){let l=We(n);return{about:"place",say:t?`${l.said} ${me(n)}`:l.said,moves:[l],subject:n.slug}}let r=pe(z(e)||e);if(r.one){let l=Me(r.one);return{about:t?"describe":"record",say:t?`${l.said} ${oe(r.one)}`:l.said,moves:[l],subject:r.one.id}}if(r.picks.length>0)return{about:"picks",say:Re(r.picks),moves:[],picks:r.picks};let h=ae(e);if(h)return h;let d=Pe(e);if(d){if(d.rest.split(" ").every(l=>l===""||te.has(l))){let l=I(d.kind),v={to:"kind",kind:d.kind,title:l,address:se(d.kind),said:`Went to the ${l.toLowerCase()}.`};return{about:"kind",say:v.said,moves:[v]}}return{unresolved:!0}}return De()},me=e=>{if(e.kind===null){let h=P.map(l=>({kind:l,count:w.nodesOfKind(l).length})).filter(l=>l.count>0).map(l=>`${l.count} ${(l.count===1?F(M(l.kind),l.kind):I(l.kind)).toLowerCase()}`),d=c.violations().length;return[h.length>0?`It holds ${fe(h)}.`:"It holds nothing yet.",d>0?`${d===1?"One problem":`${d} problems`} to see to.`:""].filter(Boolean).join(" ")}let t=w.nodesOfKind(e.kind).length,s=I(e.kind).toLowerCase(),n=new Set(c.violations().flatMap(h=>h.nodeIds)),r=w.nodesOfKind(e.kind).filter(h=>n.has(h.id)).length;return[e.lens?`It draws the ${s} as ${Ae(e.lens)}${t>0?` \u2014 ${t} of them`:""}.`:`${t===0?"No":t} ${t===1?F(M(e.kind),e.kind):s} ${t===1?"is":"are"} here.`,r>0?`${r} ${r===1?"has":"have"} a problem.`:""].filter(Boolean).join(" ")},Le=()=>{let e=(y.selection??[]).map(s=>w.getNode(s)).find(s=>s!==void 0);if(e)return{about:"here",say:oe(e),moves:[],subject:e.id};let t=S.find(s=>s.slug===y.place)??S.find(s=>s.slug==="home");return t?{about:"here",say:`${t.title}. ${me(t)}`,moves:[],subject:t.slug}:{about:"here",say:me({slug:"home",title:"Home",kind:null,cardinality:"many",address:"/",stop:"#"}),moves:[]}},Pe=e=>{let t=P.flatMap(s=>[I(s),F(M(s),s),s].map(n=>({kind:s,name:$(n)}))).filter(s=>s.name.length>0).sort((s,n)=>n.name.length-s.name.length);for(let{kind:s,name:n}of t)if(!(` ${e} `.indexOf(` ${n} `)<0))return{kind:s,rest:` ${e} `.replace(` ${n} `," ").replace(/\s+/g," ").trim()}},ie=(e,t)=>{let s=V(p,e).filters.filter(d=>d.about==="field"&&d.type==="date");if(s.length===0)return;let n=s.find(d=>t.some(l=>$(d.key)===l||$(d.label)===l));if(n)return n;let r=M(e)?.fieldRoles??{};for(let d of["due","deadline","date","when","start","end"]){let l=r[d],v=l?s.find(x=>x.key===l):void 0;if(v)return v}return s.find(d=>["due","deadline","date","when","on","at"].includes(d.key.toLowerCase()))??(s.length===1?s[0]:void 0)},He=e=>{let t=M(e),s=V(p,e).filters;if(t?.lifecycle)return{conditions:[{key:"is",value:"current"}],holds:d=>ue(be,d,{key:"is",value:"current"})};let r=s.find(d=>d.about==="field"&&d.type==="boolean"&&ne.has($(d.key)));if(r)return{conditions:[{key:r.key,value:"false"}],holds:d=>d[r.key]!==!0};let h=s.find(d=>d.about==="field"&&d.type==="choice"&&(d.options??[]).some(l=>ne.has($(l))));if(h){let d=new Set((h.options??[]).filter(v=>ne.has($(v)))),l=(h.options??[]).filter(v=>!d.has(v));return l.length===1?{conditions:[{key:h.key,value:l[0]}],holds:v=>v[h.key]===l[0]}:"unsayable"}return{conditions:[],holds:()=>!0}},Ie=(e,t)=>{let s=e.words.startsWith("due")||$(t.key)==="due",n=Ct.test($(t.label));if(e.day)return s?`due ${e.day}`:n?`on ${e.day}`:`${t.label.toLowerCase()} on ${e.day}`;let r=e.words.replace(/^(?:due|for|on|by) (?:the )?/,"");return s?`due ${r}`:n?r:`${t.label.toLowerCase()} ${r}`},ye=new Set(c.violations().flatMap(e=>e.nodeIds)),be={schema:p,graph:c.graph,flagged:ye,today:k},ae=e=>{let t=Oe(e,k,j),s=Pe(t?.rest??e),n=s?.kind,r=(s?.rest??t?.rest??e).split(" ").filter(Boolean);if(!n&&t){let g=e.split(" "),m=P.filter(L=>ie(L,g)!==void 0),E=m.filter(L=>{let b=ie(L,g);return g.some(O=>$(b.key)===O||$(b.label)===O)}),U=m.length===1?m:E;if(U.length!==1)return;n=U[0]}if(!n)return;let h=V(p,n).filters,d=[],l=[],v=[],x=[],q=!1,de=[];for(let g=0;g<r.length;g++){let m=r[g],E=g>0&&(r[g-1]==="not"||r[g-1]==="un"),U=h.find(b=>b.about==="field"&&b.type==="choice"&&(b.options??[]).some(O=>$(O)===m));if(U&&!E){let b=(U.options??[]).find(O=>$(O)===m);d.push({key:U.key,value:b}),l.push(b);continue}let L=h.find(b=>b.about==="field"&&b.type==="boolean"&&[$(b.key),$(b.label)].some(O=>O===m||O===m.replace(/^un/,"")));if(L){let b=!E&&!(m.startsWith("un")&&!$(L.key).startsWith("un"));d.push({key:L.key,value:String(b)}),l.push(b?m:`not ${m.replace(/^un/,"")}`);continue}if(Pt.has(m)&&!E){let b=He(n);b==="unsayable"?(q=!0,x.push(O=>!ut(p,O))):(d.push(...b.conditions),x.push(b.holds)),l.push(m);continue}m==="not"||m==="un"||t&&h.some(b=>b.type==="date"&&($(b.key)===m||$(b.label)===m))||de.push(m)}if(r=de,r.some(g=>!te.has(g))||!t&&d.length===0&&x.length===0)return;let T=I(n).toLowerCase(),Q=I(n);if(t){let g=ie(n,e.split(" "));if(!g){let m={to:"kind",kind:n,title:Q,address:se(n),said:`Went to the ${T}.`};return{about:"kind",say:`${ee(Q)} carry no date, so I can't tell which are ${/^(?:due|for|on|overdue|past due|late)\b/.test(t.ask.words)?t.ask.words:`due ${t.ask.words}`}. ${m.said}`,moves:[m]}}if(t.ask.from&&d.push({key:g.key,value:`after:${C(t.ask.from,-1)}`}),t.ask.to&&d.push({key:g.key,value:`before:${C(t.ask.to,1)}`}),t.ask.overdue){let m=He(n);m==="unsayable"?(q=!0,x.push(E=>!ut(p,E))):(d.push(...m.conditions),x.push(m.holds))}t.ask.overdue?l.push("overdue"):v.push(Ie(t.ask,g))}let R=w.nodesOfKind(n).filter(g=>d.every(m=>ue(be,g,m))&&x.every(m=>m(g))),K=[...l,...v].join(" and "),Y=[...l,T,...v].join(" "),W=R.slice(0,6).map(g=>({about:"node",id:g.id,kind:n,label:H(g),why:{field:d[0]?.key??"label",reading:d[0]?.key??"Name",fragment:K,strength:"field"},current:!0,flagged:ye.has(g.id),address:ge(g)})),X=R.length===0?`No ${T} are ${K}.`:`${R.length===1?`One ${F(M(n),n)} is`:`${R.length} ${T} are`} ${K}: ${fe(R.slice(0,6).map(H))}${R.length>6?`, and ${R.length-6} more`:""}.`;if(q)return{about:"kind",say:X,moves:[],picks:W,offer:{draft:Y,label:"Show as a view"}};let Z=d.map(g=>`${g.key}:${g.value}`).join(","),we=`${se(n)}?${new URLSearchParams({filter:Z}).toString()}`,_={to:"kind",kind:n,title:ee(Y),filter:Z,address:we,said:`Went to the ${Y}.`};return{about:"kind",say:`${_.said} ${X}`,moves:[_],picks:W}},Te=e=>M(e)?.figure==="person"?!0:[e,F(M(e),e),I(e)].some(s=>$(s).split(" ").some(n=>Et.has(n))),pt=e=>{let t=[],s=n=>M(n)?.edges??{};for(let[n,r]of Object.entries(s(e)))for(let h of r.to??[])u.has(h)&&t.push({key:n,direction:"out",far:h,words:ct(`${r.description??""} ${n}`)});for(let n of P)for(let[r,h]of Object.entries(s(n)))(h.to??[]).includes(e)&&t.push({key:r,direction:"in",far:n,words:ct(`${h.inverse??""} ${r}`)});return t},mt=e=>{let t=e.match(/^(who|which|what)\b/)?.[1];if(!t)return;let s=Oe(e,k,j);if(!s||s.ask.overdue)return;let n=s.rest.split(" ").filter(Boolean),r=P.flatMap(a=>[I(a),F(M(a),a),a].map(A=>({kind:a,name:$(A)}))).filter(a=>a.name.length>0).sort((a,A)=>A.name.length-a.name.length),h=` ${n.join(" ")} `,d=[];for(let{kind:a,name:A}of r)h.includes(` ${A} `)&&(h=h.replace(` ${A} `," "),d.includes(a)||d.push(a));let l=h.match(/\b(?:is|are|was|were)\b|'s\b/)?.[0],v=h.replace(/'s\b/g," ").split(" ").filter(a=>a.length>0&&!te.has(a)&&!Ce.has(a)),x=t==="who"?d.find(Te):d[0];if(!x&&t!=="who")return;let q=d.find(a=>a!==x),de=v.flatMap(a=>[je(a),...lt.has(je(a))?[...lt]:[]]),T=P.filter(a=>q?a===q:a!==x).flatMap(a=>{let A=ie(a,e.split(" "))??V(p,a).filters.find(D=>D.about==="field"&&D.type==="date");return A?pt(a).filter(D=>(x?D.far===x:Te(D.far))&&D.far!==a).map(D=>({kind:a,field:A,relation:D,said:v.length===0||de.some(ve=>D.words.some(vt=>Lt(vt,ve)))})):[]}).filter(a=>a.said);if(T.length===0)return;let Q=T.filter(a=>n.some(A=>$(a.field.key)===A||$(a.field.label)===A)),R=T.length===1?T[0]:Q.length===1?Q[0]:void 0;if(!R)return;let{kind:K,field:Y,relation:W}=R,X=[...s.ask.from?[{key:Y.key,value:`after:${C(s.ask.from,-1)}`}]:[],...s.ask.to?[{key:Y.key,value:`before:${C(s.ask.to,1)}`}]:[]],Z=w.nodesOfKind(K).filter(a=>X.every(A=>ue(be,a,A))),we=a=>(W.direction==="out"?c.graph.out(a.id,W.key):c.graph.in(a.id,W.key)).filter(A=>A.kind===W.far&&u.has(W.far)),_=[],g=[];for(let a of Z){let A=we(a);A.length===0&&g.push(a);for(let D of A)_.some(ve=>ve.id===D.id)||_.push(D)}let m=Ie(s.ask,Y),E=s.ask.day?`On ${s.ask.day}`:ee(s.ask.words.replace(/^(?:due|for|on|by) (?:the )?/,"")),U=I(K).toLowerCase(),L=X.map(a=>`${a.key}:${a.value}`).join(","),b=`${U} ${m}`,O={to:"kind",kind:K,title:ee(b),filter:L,address:`${se(K)}?${new URLSearchParams({filter:L}).toString()}`,said:`Went to the ${b}.`};if(Z.length===0)return{about:"related",say:`No ${b}. ${O.said}`,moves:[O]};let le=v.join(" "),yt=l==="was"||l==="were",Ge=a=>yt?a===1?"was":"were":a===1?"is":"are",ce=_.map(H),bt=ce.length>8?[...ce.slice(0,8),`${ce.length-8} more`]:ce,kt=_.length===0?`${E}: nobody ${Ge(1)}${le?` ${le}`:""}.`:`${E}: ${fe(bt)}${le?` ${Ge(_.length)} ${le}`:""}.`,$t=t==="who"&&g.length>0?`${fe(g.slice(0,4).map(H))}${g.length>4?` and ${g.length-4} more`:""} ${g.length===1?"has":"have"} nobody.`:"",wt=_.slice(0,8).map(a=>({about:"node",id:a.id,kind:a.kind,label:H(a),why:{field:W.key,reading:Ze(p,W.direction==="out"?K:W.far,W.key,W.direction==="out"?"out":"in"),fragment:m,strength:"field"},current:!0,flagged:ye.has(a.id),address:ge(a)}));return{about:"related",say:[kt,$t,O.said].filter(Boolean).join(" "),moves:[O],picks:wt}},Ke=N.match(jt);if(Ke){let e=Ke[1];if(e&&!rt.has(e)&&!/^(?:it|this|that)$/.test(e)){let n=re(e),r=n?void 0:pe(z(e)||e);if(r?.one){let h=Me(r.one);return{about:"describe",say:`${h.said} ${oe(r.one)}`,moves:[h],subject:r.one.id}}if(!n)return r&&r.picks.length>0?{about:"picks",say:Re(r.picks),moves:[],picks:r.picks}:De()}if(e&&/^(?:it|this|that)$|^(?:here|this place|this page)$/.test(e)){let n=(y.selection??[]).map(r=>w.getNode(r)).find(r=>r!==void 0);if(n)return{about:"describe",say:oe(n),moves:[],subject:n.id}}let t=c.violations();if(t.length===0)return{about:"problems",say:"Nothing is wrong \u2014 every rule holds.",moves:[]};let s={to:"problems",address:"/problems",said:"Went to the problems."};return{about:"problems",say:`${s.said} ${Qe(t)}: ${t.slice(0,4).map(n=>n.message).join("; ")}${t.length>4?"\u2026":"."}`,moves:[s]}}if(Ot.test(N))return Le();let _e=mt(N);if(_e)return _e;let ke=Oe(N,k,j);if(ke&&!re(z(ke.ask.words))&&ke.rest.replace(/'s\b/g,"").split(" ").every(e=>e===""||te.has(e)||Ce.has(e))){let e=ae(N);if(e)return e}if(/^open /.test(N)){let e=ae(N);if(e)return e}let Fe=N.match(Nt)??N.match(/^(?:go|take me|head|get me)(?: back)? (home)$/);if(Fe)return Ee(Fe[1].trim(),!1);let Be=N.match(St);if(Be){let e=Ee(Be[1].trim(),!0);return"unresolved"in e&&e.unresolved&&!/^tell me|^describe/.test(N)?{unresolved:!0}:e}let $e=re(N);if($e){let e=We($e);return{about:"place",say:e.said,moves:[e],subject:$e.slug}}let Ue=ae(N);return Ue||{unresolved:!0}}var Ce=new Set(["who","whom","whose","which","what","whats","what's","who's"]),Et=new Set(["person","people","user","users","member","members","volunteer","volunteers","gardener","gardeners","player","players","staff","worker","workers","employee","employees","owner","owners","assignee","assignees","helper","helpers","student","students","teacher","teachers","customer","customers","client","clients","contact","contacts","author","authors"]),lt=new Set(["work","cover","staff","assign","do","run","schedul","roster","book","duty","serv","help"]);function je(o){let i=o.toLowerCase().replace(/'s$/,"");for(let y of["ing","ed","es","s"])if(i.length>y.length+2&&i.endsWith(y)){let f=i.slice(0,-y.length);return f.length>3&&f[f.length-1]===f[f.length-2]?f.slice(0,-1):f}return i}function ct(o){return o.toLowerCase().split(/[^a-z']+/).filter(i=>i.length>1&&!te.has(i)&&!Ce.has(i)&&!["it","they","them","their","its","this","here","to","at"].includes(i)).map(je)}var Lt=(o,i)=>o===i||o.length>=4&&i.length>=4&&(o.startsWith(i)||i.startsWith(o)),ne=new Set(["done","finished","complete","completed","closed","resolved","agreed","canceled","archived","shipped","delivered"]),Pt=new Set(["open","unfinished","outstanding","pending","remaining","undone","incomplete"]);function ut(o,i){return V(o,i.kind).filters.some(f=>f.about==="field"&&(f.type==="boolean"&&ne.has(f.key.toLowerCase())&&i[f.key]===!0||f.type==="choice"&&typeof i[f.key]=="string"&&ne.has(String(i[f.key]).toLowerCase())))}function fe(o){return o.length<=1?o[0]??"":`${o.slice(0,-1).join(", ")} and ${o[o.length-1]}`}function zt(o,i,y={}){let f=y.scene!==void 0?{...y.pages,scene:y.scene}:y.pages;return[...nt(o,i,f?{pages:f}:{})].map(({first:c,hidden:p,lens:k,...j})=>j)}function gt(o,i){return{...o.principal?{principal:o.principal}:{},...o.places?{places:o.places}:{},...o.selection?{selection:o.selection}:{},...o.place?{place:o.place}:{},...i??o.today?{today:i??o.today}:{},...o.weekStartsOn!==void 0?{weekStartsOn:o.weekStartsOn}:{}}}function Jt(o,i,y,f){let c=ht(o,i,gt(y,f));if(c.unresolved)return c.say?{reply:{say:c.say,proposals:[],grounded:!0}}:{};if(c.about==="picks")return{};let p=c.moves.length>0?{moves:c.moves}:{},k=c.subject?o.graph.getNode(c.subject):void 0;if(c.about==="problems")return{...p,problems:!0};if(k&&(c.about==="describe"||c.about==="here"))return{...p,told:k.id};let j=k?tt(o,ot(Ve(o.violations(),[k.id])).slice(0,3)):[];return{reply:{say:c.say,proposals:j,grounded:!0,...p,...c.picks&&c.picks.length>0?{picks:c.picks}:{},...c.offer?{offer:c.offer}:{}}}}function Yt(o,i,y={}){let f=gt(y),c=[];for(let p of i){let k=typeof p=="string"?p:typeof p=="object"&&p!==null&&typeof p.to=="string"?p.to:void 0;if(!k||k.trim().length===0)continue;let j=ht(o,/^(?:go|take me|open|show)\b/i.test(k.trim())?k:`go to ${k}`,f);if("moves"in j)for(let J of j.moves)c.some(B=>B.address===J.address)||c.push(J)}return c}export{At as NOTHING_BY_THAT_NAME,gt as askContextOf,Jt as goingFrom,Yt as movesFromNames,zt as placesFromViews,ht as resolveAsk};
|
|
1
|
+
import{a as ot}from"./chunk.T6PU3NKP.js";import"./chunk.XXCHO2A5.js";import{e as V,l as ue,n as G,r as st}from"./chunk.SADR3MQI.js";import{a as ee}from"./chunk.G4JJXA63.js";import"./chunk.BHJRT57H.js";import{c as nt}from"./chunk.CNN32262.js";import{d as tt}from"./chunk.JGRSUTPJ.js";import"./chunk.XOZU4OFA.js";import"./chunk.EP5JS7ZH.js";import"./chunk.EGSOHTZZ.js";import"./chunk.TFJA4QV4.js";import"./chunk.HWFJQ42Y.js";import{d as et}from"./chunk.QUETLFBJ.js";import{b as Ze}from"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import{L as ze,Zd as Ne,_ as Je,_d as Xe,la as Ye,oa as qe,ta as Ae,ua as F,vb as Ve,wb as Qe}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var At="Nothing by that name here.",$=o=>o.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[’']/g,"'").replace(/[^\p{L}\p{N}' ]+/gu," ").replace(/\s+/g," ").trim(),Nt=/^(?:(?:can you |could you |please )?(?:go|take me|bring me|head|jump|navigate|switch|get me)(?: back)? to|(?:please )?(?:open|show(?: me)?|bring up|let me see|view)) (.+)$/,St=/^(?:(?:can you |could you |please )?tell me (?:about|of)|what(?: is|'s| are) (?:in |on )?|describe|explain|who(?: is|'s)) (.+)$/,Ot=/^(?:what(?: is|'s| am i looking at| do i see)(?: (?:here|this|on (?:this|the) (?:page|screen)|in view|this place|this page))?|where am i|describe (?:this|here|this place|this page)|tell me about (?:this|here|this place|this page))$/,rt=new Set(["here","this","this place","this page","on this page","on the page","on this screen","in view"]),Ct=/^(?:date|day|when|on|at|the date|the day)$/,jt=/^(?:what(?: is|'s) (?:wrong|broken|the (?:problem|matter|trouble))|what needs (?:fixing|attention|doing)|any (?:problems|issues|trouble)|(?:show(?: me)? |go to |open )?(?:the )?(?:problems|issues|trouble|standing|what's wrong)|is (?:anything|something) (?:wrong|broken)|are there (?:any )?(?:problems|issues))(?: (?:with|about|on|in) (.+))?$/,z=o=>o.replace(/^(?:the|a|an|my|our) /,""),te=new Set(["the","a","an","my","our","all","any","of","that","which","who","are","is","be","what","whats","what's","with","me","show","list","every","there","do","i","have","we","due","for","please","were","was","by","from","in","on"]),ft=864e5,he=o=>Date.UTC(Number(o.slice(0,4)),Number(o.slice(5,7))-1,Number(o.slice(8,10))),xe=o=>new Date(o).toISOString().slice(0,10),C=(o,i)=>xe(he(o)+i*ft),xt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Mt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Wt="(monday|tuesday|tues|wednesday|thursday|thurs|friday|saturday|sunday)",it="(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sept|sep|oct|nov|dec)",at="(\\d{1,2})(?:st|nd|rd|th)?",Dt=o=>xt.findIndex(i=>i.startsWith(o.slice(0,3))),dt=o=>Mt.findIndex(i=>o.startsWith(i.toLowerCase()));function Rt(o,i){return Je(o,{year:o.slice(0,4)!==i.slice(0,4)})}function Se(o,i,y){if(o<0||i<1||i>31)return;let f=Number(y.slice(0,4)),c=k=>{let j=Date.UTC(k,o,i);return new Date(j).getUTCMonth()===o?xe(j):void 0},p=c(f);if(p)return he(p)<he(y)-183*ft?c(f+1):p}function Oe(o,i,y){let f=new Date(he(i)).getUTCDay(),c=u=>{let S=(f-y+7)%7,w=C(i,-S+u*7);return{from:w,to:C(w,6)}},p=()=>{let u=`${i.slice(0,8)}01`,S=new Date(Date.UTC(Number(i.slice(0,4)),Number(i.slice(5,7)),1));return{from:u,to:C(xe(S.getTime()),-1)}},k=u=>u?{from:u,to:u,day:Rt(u,i)}:void 0,j=(u,S)=>{let w=Dt(S);return k(u==="this"||u==="next"?C(c(u==="next"?1:0).from,(w-y+7)%7):u==="last"?C(i,-((f-w+6)%7+1)):C(i,(w-f+7)%7))},J=u=>{let S=C(i,f===0?-1:6-f);return{from:C(S,u*7),to:C(S,u*7+1)}},B="\\b(?:(?:due |for |on |by )(?:the )?)?",P=[[/\b(?:overdue|past due|late)\b/,()=>({overdue:!0,to:C(i,-1)})],[/\b(?:due |for |on )?today\b/,()=>({from:i,to:i})],[/\b(?:due |for |on )?tomorrow\b/,()=>k(C(i,1))],[/\b(?:due |for |on )?yesterday\b/,()=>k(C(i,-1))],[/\b(?:due |for |on )?this week\b/,()=>c(0)],[/\b(?:due |for |on )?next week\b/,()=>c(1)],[/\b(?:due |for |on )?(?:last|previous) week\b/,()=>c(-1)],[/\b(?:due |for |on )?next weekend\b/,()=>J(1)],[/\b(?:due |for |on )?(?:this |the )?weekend\b/,()=>J(0)],[/\b(?:due |for |on )?this month\b/,()=>p()],[new RegExp(`${B}(\\d{4}) (\\d{2}) (\\d{2})\\b`),u=>k(Se(Number(u[2])-1,Number(u[3]),`${u[1]}-01-01`))],[new RegExp(`${B}${at} (?:of )?${it}\\b`),u=>k(Se(dt(u[2]),Number(u[1]),i))],[new RegExp(`${B}${it} (?:the )?${at}\\b`),u=>k(Se(dt(u[1]),Number(u[2]),i))],[new RegExp(`${B}(?:(this|next|last|coming) )?${Wt}\\b`),u=>j(u[1],u[2])]];for(let[u,S]of P){let w=o.match(u);if(!w)continue;let N=S(w);if(N)return{ask:{words:w[0],...N},rest:o.replace(w[0]," ").replace(/\s+/g," ").trim()}}}function ht(o,i,y={}){let f=y.principal??{kind:"human"},c=o.seenBy(f),p=c.schema,k=y.today??o.today?.()??ze(),j=y.weekStartsOn??1,J=o.kindsKeptFrom(f),B=o.modules.disabledKinds,P=p.kinds.filter(e=>!J.has(e)&&!B.has(e)),u=new Set(P),S=(y.places??[]).filter(e=>e.kind===null||u.has(e.kind)),w=c.graph,N=$(i).replace(/[?.!]+$/,"").trim();if(N.length===0)return{unresolved:!0};let M=e=>p.tryDefinition(e),H=e=>Ye(M(e.kind),e),I=e=>qe(p,e),se=e=>S.find(t=>t.kind===e&&t.address===Ne(p,e))?.address??Ne(p,e),ge=e=>Xe(p,e.kind,e.id),Me=e=>({to:"record",id:e.id,kind:e.kind,label:H(e),address:ge(e),said:`Went to ${H(e)}.`}),We=e=>{let t=`Went to ${e.title}.`;return e.kind===null?{to:"place",slug:e.slug,title:e.title,address:e.address,...e.slug==="overview"?{face:"scene"}:{},said:t}:e.lens||e.address.startsWith("/places/")?{to:"picture",kind:e.kind,as:e.slug,title:e.title,address:e.address,said:t}:{to:"kind",kind:e.kind,title:e.title,address:e.address,said:t}},De=()=>({unresolved:!0,say:At}),oe=e=>{let t=M(e.kind),s=et(e,t,{limit:3,excerpt:!0}).map(r=>r.alone.startsWith(r.label)?r.alone:`${r.label.toLowerCase()} ${r.alone}`).join(", "),n=c.violations().filter(r=>r.nodeIds.includes(e.id));return[`${H(e)} \u2014 ${Ae(F(t,e.kind))}${s?` (${s})`:""}.`,n.length>0?`Trouble: ${n.map(r=>r.message).join("; ")}.`:""].filter(Boolean).join(" ")},re=e=>{let t=new Set([G(e),G(z(e))]);for(let n of[" page"," view"," lens"," place"," picture"," list"])e.endsWith(n)&&(t.add(G(e.slice(0,-n.length))),t.add(G(z(e.slice(0,-n.length)))));t.delete("");let s=n=>t.has(G(n.title))||t.has(G(z($(n.title))))||t.has(G(n.slug));return S.find(n=>n.kind!==null&&n.address.startsWith("/places/")&&s(n))??S.find(s)},pe=e=>{let t=st(o,e,{principal:f,today:k,limit:6,near:!1,...y.selection?{from:y.selection}:{}}),s=t.hits.filter(r=>r.about==="node"&&u.has(r.kind)&&w.getNode(r.id)!==void 0),n=s.filter(r=>r.why.field==="label"&&r.why.strength==="exact");return n.length===1?{one:w.getNode(n[0].id),picks:s}:n.length>1?{picks:n}:s.length===1&&t.total===1?{one:w.getNode(s[0].id),picks:s}:{picks:s}},Re=e=>{let t=e.map(s=>`${s.label} (${F(M(s.kind),s.kind)})`);return`${e.length===1?"One thing matches":`${e.length} things match`}: ${t.join("; ")}.`},Ee=(e,t)=>{if(rt.has(e))return Le();let s=t?pe(z(e)||e):void 0,n=s?.one&&$(H(s.one))===$(z(e)||e)?void 0:re(e);if(n){let l=We(n);return{about:"place",say:t?`${l.said} ${me(n)}`:l.said,moves:[l],subject:n.slug}}let r=pe(z(e)||e);if(r.one){let l=Me(r.one);return{about:t?"describe":"record",say:t?`${l.said} ${oe(r.one)}`:l.said,moves:[l],subject:r.one.id}}if(r.picks.length>0)return{about:"picks",say:Re(r.picks),moves:[],picks:r.picks};let h=ae(e);if(h)return h;let d=Pe(e);if(d){if(d.rest.split(" ").every(l=>l===""||te.has(l))){let l=I(d.kind),v={to:"kind",kind:d.kind,title:l,address:se(d.kind),said:`Went to the ${l.toLowerCase()}.`};return{about:"kind",say:v.said,moves:[v]}}return{unresolved:!0}}return De()},me=e=>{if(e.kind===null){let h=P.map(l=>({kind:l,count:w.nodesOfKind(l).length})).filter(l=>l.count>0).map(l=>`${l.count} ${(l.count===1?F(M(l.kind),l.kind):I(l.kind)).toLowerCase()}`),d=c.violations().length;return[h.length>0?`It holds ${fe(h)}.`:"It holds nothing yet.",d>0?`${d===1?"One problem":`${d} problems`} to see to.`:""].filter(Boolean).join(" ")}let t=w.nodesOfKind(e.kind).length,s=I(e.kind).toLowerCase(),n=new Set(c.violations().flatMap(h=>h.nodeIds)),r=w.nodesOfKind(e.kind).filter(h=>n.has(h.id)).length;return[e.lens?`It draws the ${s} as ${Ae(e.lens)}${t>0?` \u2014 ${t} of them`:""}.`:`${t===0?"No":t} ${t===1?F(M(e.kind),e.kind):s} ${t===1?"is":"are"} here.`,r>0?`${r} ${r===1?"has":"have"} a problem.`:""].filter(Boolean).join(" ")},Le=()=>{let e=(y.selection??[]).map(s=>w.getNode(s)).find(s=>s!==void 0);if(e)return{about:"here",say:oe(e),moves:[],subject:e.id};let t=S.find(s=>s.slug===y.place)??S.find(s=>s.slug==="home");return t?{about:"here",say:`${t.title}. ${me(t)}`,moves:[],subject:t.slug}:{about:"here",say:me({slug:"home",title:"Home",kind:null,cardinality:"many",address:"/",stop:"#"}),moves:[]}},Pe=e=>{let t=P.flatMap(s=>[I(s),F(M(s),s),s].map(n=>({kind:s,name:$(n)}))).filter(s=>s.name.length>0).sort((s,n)=>n.name.length-s.name.length);for(let{kind:s,name:n}of t)if(!(` ${e} `.indexOf(` ${n} `)<0))return{kind:s,rest:` ${e} `.replace(` ${n} `," ").replace(/\s+/g," ").trim()}},ie=(e,t)=>{let s=V(p,e).filters.filter(d=>d.about==="field"&&d.type==="date");if(s.length===0)return;let n=s.find(d=>t.some(l=>$(d.key)===l||$(d.label)===l));if(n)return n;let r=M(e)?.fieldRoles??{};for(let d of["due","deadline","date","when","start","end"]){let l=r[d],v=l?s.find(x=>x.key===l):void 0;if(v)return v}return s.find(d=>["due","deadline","date","when","on","at"].includes(d.key.toLowerCase()))??(s.length===1?s[0]:void 0)},He=e=>{let t=M(e),s=V(p,e).filters;if(t?.lifecycle)return{conditions:[{key:"is",value:"current"}],holds:d=>ue(be,d,{key:"is",value:"current"})};let r=s.find(d=>d.about==="field"&&d.type==="boolean"&&ne.has($(d.key)));if(r)return{conditions:[{key:r.key,value:"false"}],holds:d=>d[r.key]!==!0};let h=s.find(d=>d.about==="field"&&d.type==="choice"&&(d.options??[]).some(l=>ne.has($(l))));if(h){let d=new Set((h.options??[]).filter(v=>ne.has($(v)))),l=(h.options??[]).filter(v=>!d.has(v));return l.length===1?{conditions:[{key:h.key,value:l[0]}],holds:v=>v[h.key]===l[0]}:"unsayable"}return{conditions:[],holds:()=>!0}},Ie=(e,t)=>{let s=e.words.startsWith("due")||$(t.key)==="due",n=Ct.test($(t.label));if(e.day)return s?`due ${e.day}`:n?`on ${e.day}`:`${t.label.toLowerCase()} on ${e.day}`;let r=e.words.replace(/^(?:due|for|on|by) (?:the )?/,"");return s?`due ${r}`:n?r:`${t.label.toLowerCase()} ${r}`},ye=new Set(c.violations().flatMap(e=>e.nodeIds)),be={schema:p,graph:c.graph,flagged:ye,today:k},ae=e=>{let t=Oe(e,k,j),s=Pe(t?.rest??e),n=s?.kind,r=(s?.rest??t?.rest??e).split(" ").filter(Boolean);if(!n&&t){let g=e.split(" "),m=P.filter(L=>ie(L,g)!==void 0),E=m.filter(L=>{let b=ie(L,g);return g.some(O=>$(b.key)===O||$(b.label)===O)}),U=m.length===1?m:E;if(U.length!==1)return;n=U[0]}if(!n)return;let h=V(p,n).filters,d=[],l=[],v=[],x=[],q=!1,de=[];for(let g=0;g<r.length;g++){let m=r[g],E=g>0&&(r[g-1]==="not"||r[g-1]==="un"),U=h.find(b=>b.about==="field"&&b.type==="choice"&&(b.options??[]).some(O=>$(O)===m));if(U&&!E){let b=(U.options??[]).find(O=>$(O)===m);d.push({key:U.key,value:b}),l.push(b);continue}let L=h.find(b=>b.about==="field"&&b.type==="boolean"&&[$(b.key),$(b.label)].some(O=>O===m||O===m.replace(/^un/,"")));if(L){let b=!E&&!(m.startsWith("un")&&!$(L.key).startsWith("un"));d.push({key:L.key,value:String(b)}),l.push(b?m:`not ${m.replace(/^un/,"")}`);continue}if(Pt.has(m)&&!E){let b=He(n);b==="unsayable"?(q=!0,x.push(O=>!ut(p,O))):(d.push(...b.conditions),x.push(b.holds)),l.push(m);continue}m==="not"||m==="un"||t&&h.some(b=>b.type==="date"&&($(b.key)===m||$(b.label)===m))||de.push(m)}if(r=de,r.some(g=>!te.has(g))||!t&&d.length===0&&x.length===0)return;let T=I(n).toLowerCase(),Q=I(n);if(t){let g=ie(n,e.split(" "));if(!g){let m={to:"kind",kind:n,title:Q,address:se(n),said:`Went to the ${T}.`};return{about:"kind",say:`${ee(Q)} carry no date, so I can't tell which are ${/^(?:due|for|on|overdue|past due|late)\b/.test(t.ask.words)?t.ask.words:`due ${t.ask.words}`}. ${m.said}`,moves:[m]}}if(t.ask.from&&d.push({key:g.key,value:`after:${C(t.ask.from,-1)}`}),t.ask.to&&d.push({key:g.key,value:`before:${C(t.ask.to,1)}`}),t.ask.overdue){let m=He(n);m==="unsayable"?(q=!0,x.push(E=>!ut(p,E))):(d.push(...m.conditions),x.push(m.holds))}t.ask.overdue?l.push("overdue"):v.push(Ie(t.ask,g))}let R=w.nodesOfKind(n).filter(g=>d.every(m=>ue(be,g,m))&&x.every(m=>m(g))),K=[...l,...v].join(" and "),Y=[...l,T,...v].join(" "),W=R.slice(0,6).map(g=>({about:"node",id:g.id,kind:n,label:H(g),why:{field:d[0]?.key??"label",reading:d[0]?.key??"Name",fragment:K,strength:"field"},current:!0,flagged:ye.has(g.id),address:ge(g)})),X=R.length===0?`No ${T} are ${K}.`:`${R.length===1?`One ${F(M(n),n)} is`:`${R.length} ${T} are`} ${K}: ${fe(R.slice(0,6).map(H))}${R.length>6?`, and ${R.length-6} more`:""}.`;if(q)return{about:"kind",say:X,moves:[],picks:W,offer:{draft:Y,label:"Show as a view"}};let Z=d.map(g=>`${g.key}:${g.value}`).join(","),we=`${se(n)}?${new URLSearchParams({filter:Z}).toString()}`,_={to:"kind",kind:n,title:ee(Y),filter:Z,address:we,said:`Went to the ${Y}.`};return{about:"kind",say:`${_.said} ${X}`,moves:[_],picks:W}},Te=e=>M(e)?.figure==="person"?!0:[e,F(M(e),e),I(e)].some(s=>$(s).split(" ").some(n=>Et.has(n))),pt=e=>{let t=[],s=n=>M(n)?.edges??{};for(let[n,r]of Object.entries(s(e)))for(let h of r.to??[])u.has(h)&&t.push({key:n,direction:"out",far:h,words:ct(`${r.description??""} ${n}`)});for(let n of P)for(let[r,h]of Object.entries(s(n)))(h.to??[]).includes(e)&&t.push({key:r,direction:"in",far:n,words:ct(`${h.inverse??""} ${r}`)});return t},mt=e=>{let t=e.match(/^(who|which|what)\b/)?.[1];if(!t)return;let s=Oe(e,k,j);if(!s||s.ask.overdue)return;let n=s.rest.split(" ").filter(Boolean),r=P.flatMap(a=>[I(a),F(M(a),a),a].map(A=>({kind:a,name:$(A)}))).filter(a=>a.name.length>0).sort((a,A)=>A.name.length-a.name.length),h=` ${n.join(" ")} `,d=[];for(let{kind:a,name:A}of r)h.includes(` ${A} `)&&(h=h.replace(` ${A} `," "),d.includes(a)||d.push(a));let l=h.match(/\b(?:is|are|was|were)\b|'s\b/)?.[0],v=h.replace(/'s\b/g," ").split(" ").filter(a=>a.length>0&&!te.has(a)&&!Ce.has(a)),x=t==="who"?d.find(Te):d[0];if(!x&&t!=="who")return;let q=d.find(a=>a!==x),de=v.flatMap(a=>[je(a),...lt.has(je(a))?[...lt]:[]]),T=P.filter(a=>q?a===q:a!==x).flatMap(a=>{let A=ie(a,e.split(" "))??V(p,a).filters.find(D=>D.about==="field"&&D.type==="date");return A?pt(a).filter(D=>(x?D.far===x:Te(D.far))&&D.far!==a).map(D=>({kind:a,field:A,relation:D,said:v.length===0||de.some(ve=>D.words.some(vt=>Lt(vt,ve)))})):[]}).filter(a=>a.said);if(T.length===0)return;let Q=T.filter(a=>n.some(A=>$(a.field.key)===A||$(a.field.label)===A)),R=T.length===1?T[0]:Q.length===1?Q[0]:void 0;if(!R)return;let{kind:K,field:Y,relation:W}=R,X=[...s.ask.from?[{key:Y.key,value:`after:${C(s.ask.from,-1)}`}]:[],...s.ask.to?[{key:Y.key,value:`before:${C(s.ask.to,1)}`}]:[]],Z=w.nodesOfKind(K).filter(a=>X.every(A=>ue(be,a,A))),we=a=>(W.direction==="out"?c.graph.out(a.id,W.key):c.graph.in(a.id,W.key)).filter(A=>A.kind===W.far&&u.has(W.far)),_=[],g=[];for(let a of Z){let A=we(a);A.length===0&&g.push(a);for(let D of A)_.some(ve=>ve.id===D.id)||_.push(D)}let m=Ie(s.ask,Y),E=s.ask.day?`On ${s.ask.day}`:ee(s.ask.words.replace(/^(?:due|for|on|by) (?:the )?/,"")),U=I(K).toLowerCase(),L=X.map(a=>`${a.key}:${a.value}`).join(","),b=`${U} ${m}`,O={to:"kind",kind:K,title:ee(b),filter:L,address:`${se(K)}?${new URLSearchParams({filter:L}).toString()}`,said:`Went to the ${b}.`};if(Z.length===0)return{about:"related",say:`No ${b}. ${O.said}`,moves:[O]};let le=v.join(" "),yt=l==="was"||l==="were",Ge=a=>yt?a===1?"was":"were":a===1?"is":"are",ce=_.map(H),bt=ce.length>8?[...ce.slice(0,8),`${ce.length-8} more`]:ce,kt=_.length===0?`${E}: nobody ${Ge(1)}${le?` ${le}`:""}.`:`${E}: ${fe(bt)}${le?` ${Ge(_.length)} ${le}`:""}.`,$t=t==="who"&&g.length>0?`${fe(g.slice(0,4).map(H))}${g.length>4?` and ${g.length-4} more`:""} ${g.length===1?"has":"have"} nobody.`:"",wt=_.slice(0,8).map(a=>({about:"node",id:a.id,kind:a.kind,label:H(a),why:{field:W.key,reading:Ze(p,W.direction==="out"?K:W.far,W.key,W.direction==="out"?"out":"in"),fragment:m,strength:"field"},current:!0,flagged:ye.has(a.id),address:ge(a)}));return{about:"related",say:[kt,$t,O.said].filter(Boolean).join(" "),moves:[O],picks:wt}},Ke=N.match(jt);if(Ke){let e=Ke[1];if(e&&!rt.has(e)&&!/^(?:it|this|that)$/.test(e)){let n=re(e),r=n?void 0:pe(z(e)||e);if(r?.one){let h=Me(r.one);return{about:"describe",say:`${h.said} ${oe(r.one)}`,moves:[h],subject:r.one.id}}if(!n)return r&&r.picks.length>0?{about:"picks",say:Re(r.picks),moves:[],picks:r.picks}:De()}if(e&&/^(?:it|this|that)$|^(?:here|this place|this page)$/.test(e)){let n=(y.selection??[]).map(r=>w.getNode(r)).find(r=>r!==void 0);if(n)return{about:"describe",say:oe(n),moves:[],subject:n.id}}let t=c.violations();if(t.length===0)return{about:"problems",say:"Nothing is wrong \u2014 every rule holds.",moves:[]};let s={to:"problems",address:"/problems",said:"Went to the problems."};return{about:"problems",say:`${s.said} ${Qe(t)}: ${t.slice(0,4).map(n=>n.message).join("; ")}${t.length>4?"\u2026":"."}`,moves:[s]}}if(Ot.test(N))return Le();let _e=mt(N);if(_e)return _e;let ke=Oe(N,k,j);if(ke&&!re(z(ke.ask.words))&&ke.rest.replace(/'s\b/g,"").split(" ").every(e=>e===""||te.has(e)||Ce.has(e))){let e=ae(N);if(e)return e}if(/^open /.test(N)){let e=ae(N);if(e)return e}let Fe=N.match(Nt)??N.match(/^(?:go|take me|head|get me)(?: back)? (home)$/);if(Fe)return Ee(Fe[1].trim(),!1);let Be=N.match(St);if(Be){let e=Ee(Be[1].trim(),!0);return"unresolved"in e&&e.unresolved&&!/^tell me|^describe/.test(N)?{unresolved:!0}:e}let $e=re(N);if($e){let e=We($e);return{about:"place",say:e.said,moves:[e],subject:$e.slug}}let Ue=ae(N);return Ue||{unresolved:!0}}var Ce=new Set(["who","whom","whose","which","what","whats","what's","who's"]),Et=new Set(["person","people","user","users","member","members","volunteer","volunteers","gardener","gardeners","player","players","staff","worker","workers","employee","employees","owner","owners","assignee","assignees","helper","helpers","student","students","teacher","teachers","customer","customers","client","clients","contact","contacts","author","authors"]),lt=new Set(["work","cover","staff","assign","do","run","schedul","roster","book","duty","serv","help"]);function je(o){let i=o.toLowerCase().replace(/'s$/,"");for(let y of["ing","ed","es","s"])if(i.length>y.length+2&&i.endsWith(y)){let f=i.slice(0,-y.length);return f.length>3&&f[f.length-1]===f[f.length-2]?f.slice(0,-1):f}return i}function ct(o){return o.toLowerCase().split(/[^a-z']+/).filter(i=>i.length>1&&!te.has(i)&&!Ce.has(i)&&!["it","they","them","their","its","this","here","to","at"].includes(i)).map(je)}var Lt=(o,i)=>o===i||o.length>=4&&i.length>=4&&(o.startsWith(i)||i.startsWith(o)),ne=new Set(["done","finished","complete","completed","closed","resolved","agreed","canceled","archived","shipped","delivered"]),Pt=new Set(["open","unfinished","outstanding","pending","remaining","undone","incomplete"]);function ut(o,i){return V(o,i.kind).filters.some(f=>f.about==="field"&&(f.type==="boolean"&&ne.has(f.key.toLowerCase())&&i[f.key]===!0||f.type==="choice"&&typeof i[f.key]=="string"&&ne.has(String(i[f.key]).toLowerCase())))}function fe(o){return o.length<=1?o[0]??"":`${o.slice(0,-1).join(", ")} and ${o[o.length-1]}`}function zt(o,i,y={}){let f=y.scene!==void 0?{...y.pages,scene:y.scene}:y.pages;return[...nt(o,i,f?{pages:f}:{})].map(({first:c,hidden:p,lens:k,...j})=>j)}function gt(o,i){return{...o.principal?{principal:o.principal}:{},...o.places?{places:o.places}:{},...o.selection?{selection:o.selection}:{},...o.place?{place:o.place}:{},...i??o.today?{today:i??o.today}:{},...o.weekStartsOn!==void 0?{weekStartsOn:o.weekStartsOn}:{}}}function Jt(o,i,y,f){let c=ht(o,i,gt(y,f));if(c.unresolved)return c.say?{reply:{say:c.say,proposals:[],grounded:!0}}:{};if(c.about==="picks")return{};let p=c.moves.length>0?{moves:c.moves}:{},k=c.subject?o.graph.getNode(c.subject):void 0;if(c.about==="problems")return{...p,problems:!0};if(k&&(c.about==="describe"||c.about==="here"))return{...p,told:k.id};let j=k?tt(o,ot(Ve(o.violations(),[k.id])).slice(0,3)):[];return{reply:{say:c.say,proposals:j,grounded:!0,...p,...c.picks&&c.picks.length>0?{picks:c.picks}:{},...c.offer?{offer:c.offer}:{}}}}function Yt(o,i,y={}){let f=gt(y),c=[];for(let p of i){let k=typeof p=="string"?p:typeof p=="object"&&p!==null&&typeof p.to=="string"?p.to:void 0;if(!k||k.trim().length===0)continue;let j=ht(o,/^(?:go|take me|open|show)\b/i.test(k.trim())?k:`go to ${k}`,f);if("moves"in j)for(let J of j.moves)c.some(B=>B.address===J.address)||c.push(J)}return c}export{At as NOTHING_BY_THAT_NAME,gt as askContextOf,Jt as goingFrom,Yt as movesFromNames,zt as placesFromViews,ht as resolveAsk};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as L}from"./chunk.
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as L}from"./chunk.6WB2TYK7.js";import"./chunk.BJUUSIQY.js";import"./chunk.CE3NKAF7.js";import"./chunk.GRTBEA7O.js";import{Qd as I,oa as O,ua as j}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var m=e=>e.charAt(0).toUpperCase()+e.slice(1),N=e=>/^(?:[aeio]|u(?![sn]i|se|ser))/i.test(e),q=e=>e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"one",D=(e,s)=>e===s?`step ${e}`:`steps ${e}\u2013${s}`;function G(e){let s=e.store.schema,t=Object.fromEntries(s.definitions.map(o=>[o.kind,{noun:j(o,o.kind),plural:O(s,o.kind),fields:Object.fromEntries(Object.keys(o.fields.shape??{}).map(c=>[c,{type:"string"}])),edges:o.edges??{}}]));return{name:e.app.name??"app",kinds:t,acts:{}}}function H(e){let s=(e.store.policy?.grants??[]).filter(o=>o.mutations==="*"&&!o.self&&o.roles!=="*").flatMap(o=>o.roles),t=[...new Set(s)];return t.length>0?`${N(t[0])?"an":"a"} ${t.join(" or ")}`:"whoever may change this app"}function K(e){let s=e.place?e.places.find(t=>t.as===e.place):void 0;return s?`in ${s.title}`:"here"}async function U(e,s){let{missing:t}=s;if(!t.need)return{refused:t.said};let o=await (__graviewPreload(import.meta.url,["./chunk.7ZTGB4O7.js","./chunk.TBY5IR7C.js","./chunk.BIDL7GQD.js","./chunk.Q5WEOX3Q.js","./chunk.KAM73WVF.js","./chunk.O32F6LGK.js","./chunk.R3GE37OI.js","./chunk.2KCDLCB2.js","./chunk.UD7VLXPM.js","./chunk.3DEWQDP7.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZMADWPJO.js")),c=o.documentOfApp(e.app),k=c??G(e),a=L(k,t.need);if("refused"in a)return{refused:`${t.said} ${a.refused}`};let i=a.steps.map(n=>({part:"app",said:n})),b=i.length,C=n=>n.filter(r=>e.store.graph.getNode(r)?.kind===a.on),x=n=>[...e.store.graph.in(n),...e.store.graph.out(n)].filter(r=>r.kind===a.on).map(r=>r.id),f=C(s.members).length>0?C(s.members):[...new Set(s.members.flatMap(x))],p=[],y=f.length,w=n=>k.kinds[n]??void 0,P=n=>(w(n)?.plural??`${w(n)?.noun??n}s`).toLowerCase(),R=n=>(w(n)?.noun??n).toLowerCase(),S=s.where?`in ${s.where}`:K(e);if(y===0)return{refused:`${t.said} There is nothing here to do it to.`};let $=y===1?`the ${R(a.on)} ${S}`:`the ${y} ${P(a.on)} ${S}`,v=m(a.called);if(a.relation&&a.to){let n=t.who;if(!n)return{refused:`${t.said} Say whom to give them to.`};let r=a.made?m(a.edits[0].plural??"people"):m(P(a.to)),h=(a.made?void 0:e.store.graph.allNodes().find(d=>d.kind===a.to&&Object.values(d).some(l=>typeof l=="string"&&l.toLowerCase()===n.toLowerCase())))?.id;if(!h){h=`${a.to}-${q(n)}`;let d=a.makes??e.store.allMutations().find(l=>l.creates?.includes(a.to))?.name;if(!d){let l=e.store.graph.allNodes().filter(g=>g.kind===a.to).slice(0,3).map(g=>String(g.label??g.name??"")).filter(Boolean);return{refused:`${t.said} There is nobody called ${n} among the ${r.toLowerCase()} here${l.length>0?` (${l.join(", ")})`:""}, and no way to add one from here.`}}p.push({name:d,args:{name:n},mintedHint:h}),i.push({part:"record",said:`Add ${n} to ${r}.`})}for(let d of f)p.push({name:a.act,args:{id:d,[a.arg]:h}});let M=/^(\w+?)ed to$/i.exec(a.called)?.[1];i.push({part:"record",said:M?`${m(M.toLowerCase())} ${n} to ${$}.`:`Set \u201C${v}\u201D to ${n} on ${$}.`})}else if(a.field){let n=t.value;if(n===void 0)return{refused:`${t.said} Say what to set it to.`};for(let r of f)p.push({name:a.act,args:{id:r,[a.arg]:n}});i.push({part:"record",said:`Set \u201C${v}\u201D to ${n} on ${$}.`})}let A=i.length;if(!(!!c&&s.host&&s.compose!==void 0&&o.mayChangeDeclaration(e.store,e.principal))){let n=c?!s.host||!s.compose?"whoever hosts this app":H(e):"whoever develops this app";return{question:`${t.said} ${m(n)} would add ${D(1,b)}; then I can do ${D(b+1,A)}.`,parts:i,whoMay:n}}let E=s.compose({document:c,edits:a.edits});if(!E.ok)return{refused:`${t.said} That change could not be made here.`};let u=E.app;try{new I({schema:u.schema,mutations:u.mutations??[],invariants:u.invariants??[],...u.policy?{policy:u.policy}:{},snapshot:e.store.graph.snapshot()}).previewAll(p,{author:e.principal})}catch{return{refused:`${t.said} I could not make that work here.`}}return{question:`${t.said} I can do it in ${A} steps. Should I?`,parts:i,proposal:{said:s.said,add:[],drop:[],card:{said:i.map(n=>n.said).join(" "),adds:[],keeps:[],drops:[],breaking:[]},edits:a.edits,records:p,via:`ai:${e.ai.name??"model"}`}}}export{U as planFor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as b,R as c,S as T,U as p,V as D}from"./chunk.
|
|
1
|
+
import{E as b,R as c,S as T,U as p,V as D}from"./chunk.6AANHELP.js";var S=864e5,N=/^(\d{4})-(\d{2})-(\d{2})/,s=n=>String(n).padStart(2,"0"),g=n=>new Date(n).toISOString().slice(0,10),m=n=>Date.UTC(+n.slice(0,4),+n.slice(5,7)-1,+n.slice(8,10)),W=(n,e)=>g(m(n)+e*S),M=n=>new Date(m(n)).getUTCDay();function A(n,e,t){if(!(e>=1&&e<=12&&t>=1&&t<=31))return;let r=`${String(n).padStart(4,"0")}-${s(e)}-${s(t)}`;return g(m(r))===r?r:void 0}function O(n=new Date){let e=c();return e?p(n.getTime(),e):{day:`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())}`,minutes:n.getHours()*60+n.getMinutes()}}var $=n=>/T\d\d:\d\d(:[\d.]+)?(Z|[+-]\d\d:?\d\d)$/.test(n);function f(n){if(typeof n!="string")return;if($(n)){let r=new Date(n);return Number.isNaN(r.getTime())?void 0:O(r)}let e=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(n);if(!e||!A(Number(e[1]),Number(e[2]),Number(e[3])))return;let t=n.slice(0,10);return e[4]===void 0?{day:t}:{day:t,minutes:Number(e[4])*60+Number(e[5])}}function x(n,e){if(!e.time)return n.day;let t=n.minutes??9*60;if(!e.instant)return`${n.day}T${s(Math.floor(t/60))}:${s(t%60)}`;let r=c(),[,i,a,d]=N.exec(n.day);return(r?new Date(D(n.day,t,r)):new Date(Number(i),Number(a)-1,Number(d),Math.floor(t/60),t%60)).toISOString().replace(/\.\d{3}Z$/,"Z")}function Z(n,e=new Date){let t=T(),r=t;try{r=new Intl.DateTimeFormat(n??b,{timeZoneName:"short",timeZone:t}).formatToParts(e).find(i=>i.type==="timeZoneName")?.value??t}catch{r=t}return{zone:t,short:r}}function z(n,e,t,r){let i=f(e);if(!i)return t;let a=n===void 0?void 0:f(n),d=t===void 0?void 0:f(t),o=u=>m(u.day)+(u.minutes??0)*6e4,l=(u,h)=>{let y=o(u)+h;return{day:g(y),...r.time?{minutes:Math.round(y%S/6e4)}:{}}};return a&&d?x(l(d,o(i)-o(a)),r):d&&o(d)>=o(i)?t:r.time?x(l(i,36e5),r):t}var _=/^(start|starts|startsAt|startsOn|startAt|begins|from|opens|checkIn)$/i,w=/^(end|ends|endsAt|endsOn|endAt|until|to|finish|finishes|closes|through|checkOut)$/i;function F(n,e={}){let t=(e.start&&n.includes(e.start)?e.start:void 0)??n.find(i=>_.test(i)),r=(e.end&&n.includes(e.end)?e.end:void 0)??n.find(i=>i!==t&&w.test(i));return t&&r?{start:t,end:r}:void 0}export{S as a,m as b,W as c,M as d,A as e,O as f,$ as g,f as h,x as i,Z as j,z as k,F as l};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{G as w,Qa as c,da as f,ea as h,ga as g}from"./chunk.
|
|
1
|
+
import{G as w,Qa as c,da as f,ea as h,ga as g}from"./chunk.3VEZ5MOC.js";import{b as m}from"./chunk.AJZBJBMO.js";var d=m(w(),1);function j(){let e=c();return(0,d.useMemo)(()=>[...new Set(e.flatMap(n=>n.nodeIds))],[e])}function x(){let e=I(),n=f();return(0,d.useMemo)(()=>{if(!n)return e;let t=n.matched;return t.length===0&&e.length===0?[k]:[...new Set([...e,...t])]},[n,e])}function I(){let{store:e,selection:n}=h(),t=g(),r=c();return(0,d.useMemo)(()=>{if(n.length===0)return v;let u=n.join(`
|
|
2
2
|
`),s=y.get(e);if(s&&s.violations===r&&s.key===u)return s.reached;let a=new Set(n),i=new Set(a);for(let o of e.graph.allEdges())a.has(o.from)&&i.add(o.to),a.has(o.to)&&i.add(o.from);for(let o of r)if(o.subjectId!==void 0&&a.has(o.subjectId))for(let p of o.nodeIds)i.add(p);let l=[...i];return y.set(e,{violations:r,key:u,reached:l}),l},[e,n,t,r])}var v=[],y=new WeakMap,k="search:nothing";export{j as a,x as b,I as c};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as je,c as Ge}from"./chunk.TTSGCNPT.js";import{b as _e}from"./chunk.STPA7HBK.js";import{a as He,b as ze,c as Ve,d as Q}from"./chunk.6NG76MDA.js";import"./chunk.35KMZHB7.js";import{k as qe,l as Ke}from"./chunk.DEKRFTRN.js";import"./chunk.BKYZSV2Y.js";import"./chunk.IAEGJDF3.js";import"./chunk.YZPESGCP.js";import"./chunk.SY5ID44D.js";import{e as Pe}from"./chunk.GVT4UUQA.js";import{m as Be}from"./chunk.5R744JGZ.js";import{a as Fe,b as Ie}from"./chunk.O2OL6RQQ.js";import{h as Me}from"./chunk.J6HF7IRQ.js";import{e as Re,f as Ee}from"./chunk.LRNFE3UK.js";import"./chunk.HJCQ6I3S.js";import"./chunk.YCD4JSXD.js";import{e as de}from"./chunk.ZG5VGP5U.js";import"./chunk.EP6Q32WT.js";import"./chunk.QAM76AXV.js";import"./chunk.Z27NSSYL.js";import{a as Ce}from"./chunk.6W6XMLSF.js";import"./chunk.PZ7KY6XH.js";import"./chunk.WEMUKZKH.js";import"./chunk.T27QKVKP.js";import{a as De,b as Te,j as Le}from"./chunk.IDALEKIW.js";import"./chunk.G4JJXA63.js";import{a as $e}from"./chunk.TBY5IR7C.js";import"./chunk.URQTF5SY.js";import"./chunk.BIDL7GQD.js";import"./chunk.LP2ZMAT2.js";import"./chunk.MSAYU25L.js";import"./chunk.EGPCVMDU.js";import"./chunk.M7KXQGQL.js";import"./chunk.XOZU4OFA.js";import"./chunk.H3EGBDW2.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.6SJEZWH3.js";import"./chunk.6N4PE3U5.js";import"./chunk.B7KZBT27.js";import"./chunk.WVUJXDXZ.js";import"./chunk.DWM7AR5Y.js";import{a as Ne}from"./chunk.6KJGRM7A.js";import"./chunk.WALVW3KJ.js";import"./chunk.SNHKYH72.js";import"./chunk.UGQYMN4J.js";import"./chunk.RG5G6YQD.js";import"./chunk.MIE4TJRW.js";import{s as Ae}from"./chunk.QRQ5WPZI.js";import"./chunk.RD2FSSLV.js";import"./chunk.37RFCHSS.js";import"./chunk.SO6NT5K7.js";import"./chunk.MUSMNKE4.js";import{d as se,l as Se}from"./chunk.SJQPTDAT.js";import{b as xe}from"./chunk.JQ63N4MZ.js";import"./chunk.Z3O2VZAJ.js";import{F as Oe,t as te}from"./chunk.QNP5OR3P.js";import"./chunk.4W57E7AX.js";import{G as st,Qa as re,Ra as ee,W as be,Z as ke,ea as K,ga as oe,j as fe,l as he,m as me,r as X,ra as ye}from"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import{L as ge,T as ue,Z as $,cb as J,la as W,na as ae,pa as we,ra as ve}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import{b as ie}from"./chunk.AJZBJBMO.js";var g=ie(st(),1);var dt=300,lt=14,Z=50,pt=3,ct=2;function We(e,n,o){let s=e.tryDefinition(n)?.fields?.shape;return(s?.[o]===void 0?void 0:Ne(s[o]))?.type}var gt=(e,n)=>Object.keys(e.tryDefinition(n)?.fields?.shape??{}),ut=e=>e==="date"||e==="datetime",Qe=/^(due|dueOn|dueAt|dueDate|deadline|by)$/i,wt=/^(date|on|day|when|at|start|starts|startsOn|startsAt|begins|from|sown|scheduled|scheduledFor|planned|plannedFor)$/i,vt=/^(done|finished|complete|completed|closed)$/i;function pe(e,n){let o=e.tryDefinition(n),s=gt(e,n),a=s.filter(c=>ut(We(e,n,c)));if(a.length===0)return;let i=o?.fieldRoles??{},r=c=>i[c]!==void 0&&a.includes(i[c])?i[c]:void 0,p=r("start")??r("when")??a.find(c=>Qe.test(c))??a.find(c=>wt.test(c));if(!p)return;let k=r("end")??a.find(c=>c!==p&&/^(end|ends|until|to|finish|finished|harvested|through)$/i.test(c)),m=s.find(c=>vt.test(c)&&We(e,n,c)==="boolean");return{field:p,due:Qe.test(p),...k?{end:k}:{},...m?{done:m}:{}}}function le(e,n){return Math.round((Date.parse(`${n.slice(0,10)}T00:00:00Z`)-Date.parse(`${e.slice(0,10)}T00:00:00Z`))/864e5)}var _=e=>typeof e=="string"&&/^\d{4}-\d{2}-\d{2}/.test(e)?e.slice(0,10):void 0;function Ze(e,n,o,s){let a=de(e,n);if(a&&o.length>0&&o.length<=dt)return{shape:"board",field:a.field};let i=pe(e,n);if(i&&!i.due){let r=l=>{let v=_(l[i.field]),b=_(J(l,i.field,s));return v&&b?le(v,b):0},p=o.map(l=>({from:_(J(l,i.field,s)),to:i.end&&_(l[i.end])?H(_(l[i.end]),r(l)):void 0})).filter(l=>l.from!==void 0).map(l=>({from:l.from,to:l.to&&l.to>l.from?l.to:l.from})),k=`${s.slice(0,7)}-01`,m=H(`${H(k,31).slice(0,7)}-01`,-1),c=p.filter(l=>l.from<=m&&l.to>=k),w=p.map(l=>le(l.from,l.to)).sort((l,v)=>l-v),u=w[Math.floor(w.length/2)]??0;if(c.length>0&&u<=lt){let l=H(s,-((new Date(`${s}T00:00:00Z`).getUTCDay()+6)%7)),v=H(l,6),b=c.every(f=>f.from>=l&&f.to<=v);return{shape:"calendar",start:i.field,...i.end?{end:i.end}:{},...i.done?{done:i.done}:{},range:b?"week":"month"}}}return{shape:"table"}}function Ue(e,n){let o=pe(e,n);return o?{by:o.field,direction:o.due?"asc":"desc"}:void 0}function Ye(e,n,o={}){switch(n.shape){case"board":return{lens:"columns",kind:e,column:n.field};case"calendar":return{lens:"calendar",kind:e,start:n.start,...n.end?{end:n.end}:{},...n.done?{done:n.done}:{},range:n.range};case"table":return{lens:"blocks",kind:e,as:"row",...o.group?.by?{group:o.group.by}:{},...o.sort?{sort:{by:o.sort.by,...o.sort.direction==="desc"?{direction:"desc"}:{}}}:{}}}}var ft=60;function Je(e,n,o,s){let a=e.tryDefinition(n),i=o.slice(0,ft),r=new Map;i.forEach(w=>{let u=W(a,w);se(w,a,{glance:!0,said:[u]}).forEach((l,v)=>{if(l.long||l.files||l.app)return;let b=r.get(l.key);b?b.count++:r.set(l.key,{label:l.label,count:1,at:v})})});let p=Math.max(1,Math.ceil(i.length/3)),k=[...r.entries()].filter(([,w])=>w.count>=p).sort((w,u)=>w[1].at-u[1].at).slice(0,pt).map(([w,u])=>({about:"field",key:w,label:u.label})),m=new Map;for(let w of i){let u=new Set;for(let[l,v]of[["out",s.outEdges(w.id)],["in",s.inEdges(w.id)]])for(let b of v){let f=s.getNode(l==="out"?b.to:b.from);if(!f||f.id===w.id)continue;let x=`${b.kind}|${l}`;if(u.has(x))continue;u.add(x);let y=m.get(x);y?y.count++:m.set(x,{edge:b.kind,direction:l,far:f.kind,count:1})}}let c=[...m.entries()].sort((w,u)=>u[1].count-w[1].count).slice(0,ct).map(([w,u])=>{let l=xe(e,u.direction==="out"?n:u.far,u.edge,u.direction);return{about:"edge",key:w,label:l.charAt(0).toUpperCase()+l.slice(1),edge:u.edge,direction:u.direction}});return[...k,...c]}function Xe(e,n,o,s){if(o.about==="field"){let r=e.tryDefinition(n.kind);return{text:se(n,r,{excerpt:!0}).find(k=>k.key===o.key)?.value??""}}let i=(o.direction==="out"?s.outEdges(n.id):s.inEdges(n.id)).filter(r=>r.kind===o.edge).map(r=>s.getNode(o.direction==="out"?r.to:r.from)).filter(r=>r!==void 0).map(r=>W(e.tryDefinition(r.kind),r));return i.length===0?{text:""}:i.length===1?{text:i[0]}:{text:`${i[0]} +${i.length-1}`,title:i.join(", ")}}function et(e,n,o=()=>{}){let s=new Map;for(let a of e){let i=a.nodeIds.filter(p=>n.has(p));if(i.length===0&&!(a.subjectId!==void 0&&n.has(a.subjectId)))continue;let r=s.get(a.invariant)??{invariant:a.invariant,label:o(a.invariant)||a.label||a.message,violations:[],records:new Set};r.violations.push(a);for(let p of i)r.records.add(p);a.subjectId!==void 0&&n.has(a.subjectId)&&r.records.add(a.subjectId),s.set(a.invariant,r)}return[...s.values()].sort((a,i)=>i.violations.length-a.violations.length).map(a=>({invariant:a.invariant,label:a.label,violations:a.violations,records:[...a.records]}))}var tt=6;function nt(e,n,o,s){let a=pe(e,n);if(!a)return;let i=de(e,n),r=m=>{if(a.done!==void 0&&m[a.done]===!0)return!0;if(!i)return!1;let c=i.values.indexOf(String(m[i.field]));return c>=0&&i.tiers[c]==="done"},p=0,k=0;for(let m of o){let c=_(J(m,a.field,s));if(!c||r(m))continue;let w=le(s,c);a.due&&w<0?p++:w>=0&&w<=tt&&k++}if(!(p===0&&k===0))return{field:a.field,due:a.due,overdue:p,soon:k}}function H(e,n){return new Date(Date.parse(`${e.slice(0,10)}T00:00:00Z`)+n*864e5).toISOString().slice(0,10)}function ce(e,n,o){return n==="overdue"?[{key:e.field,value:`before:${o}`}]:[{key:e.field,value:`after:${H(o,-1)}`},{key:e.field,value:`before:${H(o,tt+1)}`}]}function it(e,n,o,s){let a=new Set,i=new Set;for(let r of e)if(!(r.at<=o))for(let p of r.primitives)p.op==="add-node"&&p.node?.kind===n?a.add(p.node.id):(p.op==="patch-node"||p.op==="splice-text")&&p.id!==void 0&&s(p.id)===n&&i.add(p.id);for(let r of a)i.delete(r);return{added:[...a].filter(r=>s(r)===n).length,changed:[...i].filter(r=>s(r)===n).length}}var t=ie(be(),1),ht=560;function mt(e,n){let[o,s]=(0,g.useState)(0);return(0,g.useEffect)(()=>{let a=e.current;if(!a||!n){s(0);return}let i=0,r=()=>{i=0;let c=a.getBoundingClientRect().bottom;s([...a.querySelectorAll('[data-testid="kind-stop-table"] tbody tr[data-graview-pick]')].filter(w=>w.getBoundingClientRect().top>c-24).length)},p=()=>{i||(i=requestAnimationFrame(r))};r(),a.addEventListener("scroll",p,{passive:!0});let k=typeof ResizeObserver>"u"?null:new ResizeObserver(p);k?.observe(a);let m=a.querySelector('[data-testid="kind-stop-body"]');return m&&k?.observe(m),()=>{a.removeEventListener("scroll",p),k?.disconnect(),i&&cancelAnimationFrame(i)}},[e,n]),o}function bt({narrow:e,at:n,children:o}){return e?(0,t.jsx)("div",{ref:n,className:"graview-kind-stop-scroll","data-testid":"kind-stop-scroll",children:o}):(0,t.jsx)(t.Fragment,{children:o})}function kt(e){let[n,o]=(0,g.useState)(!1);return(0,g.useLayoutEffect)(()=>{let s=e.current;if(!s)return;let a=()=>{let r=s.getBoundingClientRect().width;r>0&&o(r<ht)};if(a(),typeof ResizeObserver>"u")return;let i=new ResizeObserver(a);return i.observe(s),()=>i.disconnect()},[e]),n}var ot="as",yt=(e,n)=>`graview:kind-seen:${e}:${n}`;function xt(e){try{return localStorage.getItem(e)}catch{return null}}function St(e,n){try{localStorage.setItem(e,n)}catch{}}var Nt=(e,n)=>({...fe(me(e,!1),n),relation:null});function rn({kind:e,members:n,flagged:o=[],label:s,retired:a=0}){let{store:i,brand:r,principal:p,views:k,view:m}=K(),{go:c}=ee(),w=oe(),u=i.schema,l=u.tryDefinition(e),v=s??we(u,e),b=i.today()??ge(),f=n,x=(0,g.useId)(),y=(0,g.useMemo)(()=>Ze(u,e,f,b),[u,e,f,b]),N=m.within?.[ot]==="table"?{shape:"table"}:y,R=Fe(m),D=N.shape==="table"&&!R.sort?Ue(u,e):void 0,E=D?{...R,sort:D}:R,L=(0,g.useMemo)(()=>new Set(o),[o]),h=(0,g.useMemo)(()=>Me(f,E,{schema:u,graph:i.graph,flagged:L,today:b}),[f,E,u,i,L,b,w]),C=(0,g.useMemo)(()=>Ee(u,Re(u,e)),[u,e]),P=k.arrangement?.()?.lists?.[e]?.filters,q=M=>c(Ie(m,M)),j=(0,g.useMemo)(()=>({name:r?.name??"app",schema:u,...i.policy?{policy:i.policy}:{}}),[r,u,i]),U=JSON.stringify(Ye(e,N,E)),F=(0,g.useMemo)(()=>{let M=Le(JSON.parse(U),{app:j,sight:Te(j,p)});return De(M)?void 0:M},[U,j,p]),G=N.shape!=="table"&&F!==void 0,z=(0,g.useRef)(null),O=kt(z),[V,d]=(0,g.useState)(!1),A=(0,g.useId)(),I=(0,g.useMemo)(()=>$e(i,p),[i,p]),B=(f.length>1||a>0)&&!G?(0,t.jsx)(Be,{schema:u,graph:i.graph,kind:e,arrangement:E,onChange:q,offers:C,...P?{filters:P}:{},kept:{shown:h.nodes.length,of:f.length},testId:"kind-arrange",chips:{nodes:f,flagged:L,today:b},...a>0?{past:{count:a,widen:()=>c(Pe(m,!0))}}:{}}):null,T=!!E.query||(E.filter?.length??0)>0,Y=(0,g.useRef)(null),ne=mt(Y,O&&!G);return(0,t.jsxs)("section",{ref:z,"aria-labelledby":x,className:"graview-kind-stop","data-testid":"kind-stop","data-graview-kind-stop":e,"data-graview-shape":N.shape,"data-graview-narrow":O||void 0,children:[(0,t.jsx)("style",{children:Lt}),(0,t.jsxs)(bt,{narrow:O,at:Y,children:[(0,t.jsx)(At,{kind:e,plural:v,count:f.length,headingId:x,description:l?.description,...O?{tools:{open:V,id:A,toggle:()=>d(M=>!M),narrowed:T}}:{}}),O&&V?(0,t.jsxs)("div",{id:A,className:"graview-kind-stop-tools","data-testid":"kind-stop-tools",role:"group","aria-label":`Find, filter and arrange the ${v.toLowerCase()}`,children:[B,f.length>0?(0,t.jsx)(at,{derived:y,shape:N,draft:F,author:!1}):null,(0,t.jsx)(rt,{kind:e,plural:v})]}):null,(0,t.jsx)(Rt,{kind:e,plural:v,members:f,today:b,arrangement:E,onArrange:q,compact:O}),O&&T&&!V?(0,t.jsxs)("p",{className:"graview-kind-stop-narrowed","data-testid":"kind-stop-narrowed",children:[(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:[$(h.nodes.length)," of ",$(f.length)," shown"]})," ",(0,t.jsx)("button",{type:"button",className:"graview-kind-stop-link",onClick:()=>q({}),children:"Show all"})]}):null,O?null:B,f.length>0&&!O?(0,t.jsx)(at,{derived:y,shape:N,draft:F,author:I}):null,(0,t.jsx)("div",{className:"graview-kind-stop-body","data-testid":"kind-stop-body",children:f.length===0?(0,t.jsx)("p",{className:"graview-kind-stop-empty","data-testid":"kind-stop-empty",children:"Nothing here yet."}):G?(0,t.jsx)(Dt,{draft:F,nodes:f}):h.nodes.length===0?(0,t.jsxs)("p",{className:"graview-kind-stop-empty","data-testid":"kind-stop-none-kept",children:["None of the ",$(f.length)," ",v.toLowerCase()," ",E.query?`says \u201C${E.query}\u201D`:"is kept by these filters","."," ",(0,t.jsx)("button",{type:"button",className:"graview-kind-stop-link",onClick:()=>q({}),children:"Show them all"})]}):(0,t.jsx)(Tt,{kind:e,nodes:h.nodes,groups:h.grouped?h.groups.map(M=>({key:M.key,label:M.label,nodes:M.nodes})):void 0,flagged:L,plural:v,arrangement:E})})]}),ne>0?(0,t.jsxs)("button",{type:"button",className:"graview-kind-stop-below","data-testid":"kind-stop-below","data-graview-below":ne,onClick:()=>Y.current?.scrollBy({top:Math.round(Y.current.clientHeight*.8),behavior:"smooth"}),children:[ae(u,e,ne).replace(/^(\S+)\s/,"$1 more ")," below ",(0,t.jsx)("span",{"aria-hidden":"true",children:"\u2193"})]}):null]})}function rt({kind:e,plural:n}){let{setSelection:o,setMenuAt:s}=K();return(0,t.jsx)("button",{type:"button",className:"graview-kind-stop-quiet","data-testid":"kind-stop-acts","aria-haspopup":"menu","aria-label":`What can be done with the ${n.toLowerCase()}`,onClick:a=>{let i=a.currentTarget.getBoundingClientRect();o([X(e)]),s({x:Math.round(i.left),y:Math.round(i.bottom+4),on:X(e)})},children:"Acts\u2026"})}function At({kind:e,plural:n,count:o,headingId:s,description:a,tools:i}){let{store:r}=K(),p=(0,g.useMemo)(()=>({about:[X(e)]}),[e]),{affordances:k}=qe(p),{apply:m,preview:c}=Ke(),w=(0,g.useMemo)(()=>{let S=N=>r.allMutations().find(R=>R.name===N.mutation)?.creates?.includes(e)??!1;return k.find(N=>!N.destructive&&!N.setsAside&&S(N))},[k,r,e]),[u,l]=(0,g.useState)(!1),[v,b]=(0,g.useState)(null),f=(0,g.useRef)(null),x=(0,g.useRef)(null);(0,g.useEffect)(()=>{let S=x.current;if(!S||S.closest('[data-testid="kind-stop"]')?.contains(document.activeElement))return;let N=!1;try{N=document.activeElement instanceof HTMLElement&&document.activeElement!==document.body&&document.activeElement.matches(":focus-visible")}catch{N=!0}N?delete S.dataset.graviewQuietFocus:S.dataset.graviewQuietFocus="",S.focus({preventScroll:!0})},[e]);let y=(S,N)=>{try{c(S,N),m(S,N),b(null),l(!1),requestAnimationFrame(()=>f.current?.focus())}catch(R){return b(Se(r.schema,r.allMutations(),R)),[]}};return(0,t.jsxs)("header",{className:"graview-kind-stop-head",children:[(0,t.jsxs)("div",{className:"graview-kind-stop-title",children:[(0,t.jsx)("h2",{id:s,ref:x,tabIndex:-1,"data-testid":"kind-stop-title",onKeyDown:S=>delete S.currentTarget.dataset.graviewQuietFocus,onBlur:S=>delete S.currentTarget.dataset.graviewQuietFocus,children:n}),(0,t.jsxs)("p",{"data-testid":"kind-stop-count",children:[ae(r.schema,e,o),a?` \xB7 ${a}`:""]})]}),(0,t.jsxs)("div",{className:"graview-kind-stop-acts",children:[w?(0,t.jsx)("button",{ref:f,type:"button",className:"graview-kind-stop-primary","data-testid":"kind-stop-primary","data-affordance":w.id,"aria-expanded":w.open.length>0?u:void 0,onClick:()=>{b(null),w.open.length===0?y(w):l(S=>!S)},children:w.label}):null,i?(0,t.jsx)("button",{type:"button",className:"graview-kind-stop-more-tools","data-testid":"kind-stop-tools-open","aria-expanded":i.open,"aria-controls":i.open?i.id:void 0,"aria-label":`Find, filter, arrange and act on the ${n.toLowerCase()}`,title:"Find, filter, arrange and acts","data-narrowed":i.narrowed||void 0,onClick:i.toggle,children:(0,t.jsx)("span",{"aria-hidden":"true",children:"\u22EF"})}):(0,t.jsx)(rt,{kind:e,plural:n})]}),u&&w?(0,t.jsx)("div",{className:"graview-kind-stop-ask","data-testid":"kind-stop-ask","aria-label":w.label,role:"group",children:(0,t.jsx)(Ce,{affordance:w,onApply:S=>y(w,S),onCancel:()=>{l(!1),f.current?.focus()}})}):null,v?(0,t.jsx)("p",{role:"alert",className:"graview-kind-stop-failed","data-testid":"kind-stop-failed",children:v}):null]})}var Ct=te.part((e,n)=>(0,t.jsx)(e.ProblemRows,{...n}),{what:"The problems",as:"li"});function Rt({kind:e,plural:n,members:o,today:s,arrangement:a,onArrange:i,compact:r=!1}){let{store:p,brand:k,setSelection:m}=K(),c=p.schema,w=re(),u=(0,g.useMemo)(()=>new Set(o.map(h=>h.id)),[o]),l=(0,g.useMemo)(()=>et(w,u,h=>p.allInvariants().find(C=>C.name===h)?.label),[w,u,p]),v=(0,g.useMemo)(()=>nt(c,e,o,s),[c,e,o,s]),b=yt(Oe(k,c),e),[f]=(0,g.useState)(()=>xt(b));(0,g.useEffect)(()=>()=>St(b,new Date().toISOString()),[b]);let x=oe(),y=(0,g.useMemo)(()=>f?it(p.log.all(),e,f,h=>p.graph.getNode(h)?.kind):null,[f,p,e,x]),[S,N]=(0,g.useState)(null),R=h=>i({...a,filter:[...(a.filter??[]).filter(C=>!h?.some(P=>P.key===C.key)),...h??[]]}),D=l.reduce((h,C)=>h+C.violations.length,0),E=[];if(v&&(v.overdue>0||v.soon>0)){let h=v.field;E.push((0,t.jsxs)("li",{"data-testid":"kind-stop-dates",children:[v.overdue>0?(0,t.jsxs)("button",{type:"button",className:"graview-kind-stop-fact","data-tone":"warn",onClick:()=>R(ce(v,"overdue",s)),"aria-label":`${$(v.overdue)} overdue \u2014 show only these`,children:[$(v.overdue)," overdue"]}):null,v.soon>0?(0,t.jsxs)("button",{type:"button",className:"graview-kind-stop-fact",onClick:()=>R(ce(v,"soon",s)),"aria-label":`${$(v.soon)} in the next 7 days \u2014 show only these`,children:[$(v.soon)," ",v.due?"due":""," in the next 7 days"]}):null,(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:[" by ",ve(c.tryDefinition(e),h).toLowerCase()]})]},"dates"))}let L=(a.filter??[]).some(h=>h.key==="is"&&h.value==="flagged");if(l.length>0&&r){let h=l.map(C=>C.label).join(", ");E.push((0,t.jsxs)("li",{className:"graview-kind-stop-problems-line","data-testid":"kind-stop-problems","data-graview-problems":D,children:[(0,t.jsxs)("span",{className:"graview-kind-stop-warn",children:[(0,t.jsx)("span",{"aria-hidden":"true",children:"\u26A0 "}),D===1?"1 problem":`${$(D)} problems`]}),(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text graview-kind-stop-rules-said",title:h,children:[" ","\xB7 ",h]}),(0,t.jsx)("button",{type:"button",className:"graview-kind-stop-link","data-testid":"kind-stop-only-problems","aria-pressed":L,"aria-label":L?`Show all the ${n.toLowerCase()}`:`Show only the ${n.toLowerCase()} with a problem`,onClick:()=>L?i({...a,filter:(a.filter??[]).filter(C=>!(C.key==="is"&&C.value==="flagged"))}):R([{key:"is",value:"flagged"}]),children:L?"Show all":"Show"})]},"problems"))}else l.length>0&&E.push((0,t.jsxs)("li",{"data-testid":"kind-stop-problems","data-graview-problems":D,children:[(0,t.jsxs)("span",{className:"graview-kind-stop-warn",children:[(0,t.jsx)("span",{"aria-hidden":"true",children:"\u26A0 "}),D===1?"1 problem":`${$(D)} problems`]}),(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:[" in ",n.toLowerCase(),":"]}),(0,t.jsx)("ul",{className:"graview-kind-stop-rules",children:l.map(h=>(0,t.jsx)(Et,{group:h,open:S===h.invariant,onToggle:()=>N(C=>C===h.invariant?null:h.invariant),onPick:C=>m([C])},h.invariant))}),(0,t.jsxs)("button",{type:"button",className:"graview-kind-stop-link","data-testid":"kind-stop-only-problems",onClick:()=>R([{key:"is",value:"flagged"}]),children:["Show only the ",n.toLowerCase()," with a problem"]})]},"problems"));if(y&&(y.added>0||y.changed>0)){let h=[y.added>0?`${$(y.added)} added`:"",y.changed>0?`${$(y.changed)} changed`:""].filter(Boolean);E.push((0,t.jsxs)("li",{"data-testid":"kind-stop-since",children:[(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:["Since you last looked (",ue(f.slice(0,10)),"):"]})," ",h.join(", ")]},"since"))}return E.length===0?null:(0,t.jsx)("ul",{className:"graview-kind-stop-going-on","aria-label":`What is going on in the ${n.toLowerCase()}`,"data-testid":"kind-stop-going-on",children:E})}function Et({group:e,open:n,onToggle:o,onPick:s}){let a=(0,g.useId)();return(0,t.jsxs)("li",{"data-graview-rule":e.invariant,children:[(0,t.jsxs)("button",{type:"button",className:"graview-kind-stop-rule","aria-expanded":n,"aria-controls":a,onClick:o,onPointerEnter:te.prefetch,onFocus:te.prefetch,children:[(0,t.jsx)("span",{"aria-hidden":"true",className:"graview-kind-stop-chevron","data-open":n||void 0,children:"\u203A"}),e.label," ",(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:["\xB7 ",$(e.violations.length)]})]}),n?(0,t.jsx)("ol",{id:a,className:"graview-kind-stop-problem-rows","data-testid":"kind-stop-problem-rows",children:(0,t.jsx)(g.Suspense,{fallback:null,children:(0,t.jsx)(Ct,{violations:e.violations,pick:i=>{let r=i.subjectId??e.records[0]??i.nodeIds[0];r!==void 0&&s(r)}})})}):null]})}var $t={board:"Board",calendar:"Calendar",table:"Table"};function at({derived:e,shape:n,draft:o,author:s}){let{view:a}=K(),{go:i}=ee(),{keep:r}=je(Ge()),[p,k]=(0,g.useState)(!1),m=e.shape==="table"?[]:[e.shape,"table"];return!s&&m.length===0?null:(0,t.jsxs)("div",{className:"graview-kind-stop-shape","data-testid":"kind-stop-shape",children:[m.length>0?(0,t.jsx)("span",{role:"group","aria-label":"Show as",className:"graview-kind-stop-switch",children:m.map(c=>(0,t.jsx)("button",{type:"button","aria-pressed":n.shape===c,"data-testid":`kind-stop-as-${c}`,onClick:()=>i(he(a,ot,c===e.shape?null:c)),children:$t[c]},c))}):null,s?(0,t.jsx)("span",{className:"graview-kind-stop-quiet-text","data-testid":"kind-stop-derived",children:o?`${o.said.replace(/\.$/,"")}, derived from the declaration`:"Derived from the declaration"}):null,o&&s?(0,t.jsx)("button",{type:"button",className:"graview-kind-stop-link","data-testid":"kind-stop-keep",disabled:p,title:`Keep \u201C${o.title}\u201D as a lens: a place of its own`,onClick:()=>{k(!0),r(o).finally(()=>k(!1))},children:"Keep as a lens"}):null]})}function Dt({draft:e,nodes:n}){let o=_e(e.drawn);return(0,t.jsx)("div",{className:"graview-kind-stop-lens","data-graview-draft":e.lens.name,children:(0,t.jsx)(ke,{mode:"scene",children:(0,t.jsx)(Ae,{kind:e.kind,view:e.title,children:(0,t.jsx)(o,{nodes:n,label:e.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1})})})})}function Tt({kind:e,nodes:n,groups:o,flagged:s,plural:a,arrangement:i}){let{store:r,views:p,view:k,selection:m,setSelection:c,setMenuAt:w,principal:u}=K(),{go:l}=ee(),v=r.schema,b=r.graph,f=(0,g.useMemo)(()=>(o?o.flatMap(d=>d.nodes):n).map(d=>d.id),[n,o]),x=He(f),y=(0,g.useMemo)(()=>r.permittedMutations(u).some(d=>{let A=d.subject?.kinds;return A!==void 0&&(A==="*"||A.includes(e))}),[r,u,e]),S=(0,g.useRef)(null),N=d=>{x.choose(d),requestAnimationFrame(()=>{let A=x.list.current;((d[0]===void 0?null:A?.querySelector(`[data-graview-choose-box="${CSS.escape(d[0])}"]`))??A)?.focus({preventScroll:!0})})},R=x.chosen.length,D=p.lookup(e,{cardinality:"one",fidelity:"glyph"}),E=D!==void 0&&!ye(D)?D:void 0,L=d=>m.includes(d),h=re(),C=(0,g.useMemo)(()=>Je(v,e,n,b),[v,e,n,b]),[P,q]=(0,g.useState)(Z);(0,g.useEffect)(()=>q(Z),[i.query,i.filter?.length,i.sort?.by,i.group?.by]);let j=v.tryDefinition(e),U=d=>h.filter(A=>A.nodeIds.includes(d)||A.subjectId===d).map(A=>A.message),F=i.sort?.by,G=`${a}${i.sort?`, in order of ${C.find(d=>d.key===F)?.label.toLowerCase()??F}`:""}`,z=P,O=d=>{let A=W(j,d),I=s.has(d.id)?U(d.id):[];return(0,t.jsxs)("tr",{"data-graview-pick":d.id,tabIndex:-1,"data-graview-record":d.id,"data-flagged":I.length>0||void 0,...y?{"data-graview-choose":d.id}:{},children:[y?(0,t.jsx)("td",{className:"graview-choose-at",children:(0,t.jsx)("input",{...x.boxProps(d.id,A),onPointerEnter:Q,onFocus:Q})}):null,(0,t.jsxs)("th",{scope:"row",className:"graview-kind-stop-name",children:[E?(0,t.jsx)("div",{"data-graview-pick":d.id,className:"graview-kind-stop-own-row",children:(0,t.jsx)(E,{node:d,cardinality:"one",fidelity:"glyph",mode:"scene",selected:L(d.id),...I.length>0?{flagged:[d.id]}:{}})}):(0,t.jsx)("button",{type:"button","data-testid":"kind-stop-row-go",title:`Go to ${A}`,onClick:()=>l(Nt(k,d.id)),children:A}),I.length>0?(0,t.jsxs)("span",{className:"graview-kind-stop-flag",title:I.join(" \xB7 "),children:[(0,t.jsx)("span",{"aria-hidden":"true",children:"\u26A0"}),(0,t.jsx)("span",{className:"graview-kind-stop-hidden",children:`Problem: ${I.join(". ")}`})]}):null]}),C.map(B=>{let T=Xe(v,d,B,b);return(0,t.jsx)("td",{"data-label":B.label,"data-short":T.text.length>0&&T.text.length<=14||void 0,"data-empty":T.text?void 0:"",...T.title?{title:T.title}:{},children:T.text?(0,t.jsx)("span",{children:T.text}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("b",{"aria-hidden":"true",children:"\u2014"}),(0,t.jsx)("i",{className:"graview-kind-stop-hidden",children:"none"})]})},B.key)}),(0,t.jsx)("td",{className:"graview-kind-stop-row-acts",children:(0,t.jsx)("button",{type:"button","data-testid":"kind-stop-row-acts","aria-haspopup":"menu","aria-label":`What can be done with ${A}`,onClick:B=>{let T=B.currentTarget.getBoundingClientRect();c([d.id]),w({x:Math.round(T.left),y:Math.round(T.bottom+4),on:d.id})},children:(0,t.jsx)("span",{"aria-hidden":"true",children:"\u22EF"})})})]},d.id)},V=d=>{let A=d.slice(0,Math.max(0,z));return z-=A.length,A.map(O)};return(0,t.jsxs)("div",{className:"graview-kind-stop-table-at",...y?{...x.listProps,ref:d=>{S.current=d,x.list.current=d},tabIndex:-1,role:"group","aria-label":R>0?`${a}, ${R} chosen`:a,"data-graview-choosable":""}:{},children:[y?(0,t.jsx)("style",{children:ze}):null,(0,t.jsxs)("table",{className:"graview-kind-stop-table","data-testid":"kind-stop-table",children:[(0,t.jsx)("caption",{className:"graview-kind-stop-hidden",children:G}),(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[y?(0,t.jsx)("td",{className:"graview-choose-at graview-choose-all",children:(0,t.jsx)("input",{type:"checkbox",className:"graview-choose-box","data-testid":"kind-stop-choose-all","aria-label":`Choose all ${$(n.length)} ${a.toLowerCase()}`,checked:R>0&&R===n.length,ref:d=>{d&&(d.indeterminate=R>0&&R<n.length)},onPointerEnter:Q,onFocus:Q,onChange:()=>R===n.length?x.clear():x.choose(f)})}):null,(0,t.jsx)("th",{scope:"col","aria-sort":F==="label"?i.sort?.direction==="desc"?"descending":"ascending":void 0,children:"Name"}),C.map(d=>(0,t.jsx)("th",{scope:"col","aria-sort":d.about==="field"&&d.key===F?i.sort?.direction==="desc"?"descending":"ascending":void 0,children:d.label},d.key)),(0,t.jsx)("th",{scope:"col",children:(0,t.jsx)("span",{className:"graview-kind-stop-hidden",children:"Acts"})})]})}),o?o.map(d=>z<=0?null:(0,t.jsxs)("tbody",{"data-graview-group":d.key,children:[(0,t.jsx)("tr",{className:"graview-kind-stop-group",children:(0,t.jsxs)("th",{scope:"rowgroup",colSpan:C.length+(y?3:2),children:[d.label," ",(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:["\xB7 ",$(d.nodes.length)]})]})}),V(d.nodes)]},d.key||"-")):(0,t.jsx)("tbody",{children:V(n)})]}),y?(0,t.jsx)(Ve,{store:r,chosen:x.chosen,principal:u,anchor:()=>S.current?.closest('[data-testid="kind-stop"]')??null,of:f.length,onChooseAll:()=>x.choose(f),onClear:x.clear,onActed:N}):null,n.length>P?(0,t.jsxs)("p",{className:"graview-kind-stop-more",children:[(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text","data-testid":"kind-stop-shown",children:[$(P)," of ",$(n.length)," shown"]})," ",(0,t.jsxs)("button",{type:"button",className:"graview-kind-stop-link","data-testid":"kind-stop-more",onClick:()=>q(d=>d+Z),children:["Show ",$(Math.min(Z,n.length-P))," more"]})]}):null]})}var Lt=`
|
|
1
|
+
import{a as je,c as Ge}from"./chunk.BQAFFEOA.js";import{b as _e}from"./chunk.AWV57UBJ.js";import{a as He,b as ze,c as Ve,d as Q}from"./chunk.YBQ5GVAX.js";import"./chunk.EB7PZJEO.js";import{k as qe,l as Ke}from"./chunk.MSUZAJ2K.js";import"./chunk.64LCHHZB.js";import"./chunk.42KHFGN6.js";import"./chunk.RQG672MJ.js";import"./chunk.Q6H5HESF.js";import{e as Pe}from"./chunk.3JMQKANL.js";import{m as Be}from"./chunk.42C3FIKK.js";import{a as Fe,b as Ie}from"./chunk.2ME4DVBI.js";import{h as Me}from"./chunk.XXCHO2A5.js";import{e as Re,f as Ee}from"./chunk.SADR3MQI.js";import"./chunk.HJCQ6I3S.js";import"./chunk.2BMZPALF.js";import{e as de}from"./chunk.GONZB3J3.js";import"./chunk.LFFJB6D3.js";import"./chunk.DMZRFXH7.js";import"./chunk.DZ6UDZOB.js";import{a as Ce}from"./chunk.E423JCOS.js";import"./chunk.O5FTWXA2.js";import"./chunk.Q4VFLLUT.js";import"./chunk.6ZENHSTQ.js";import{a as De,b as Te,j as Le}from"./chunk.VTDOWXCP.js";import"./chunk.G4JJXA63.js";import{a as $e}from"./chunk.TBY5IR7C.js";import"./chunk.BHJRT57H.js";import"./chunk.BIDL7GQD.js";import"./chunk.CNN32262.js";import"./chunk.N5Z34V7U.js";import"./chunk.LOKGUALC.js";import"./chunk.JGRSUTPJ.js";import"./chunk.XOZU4OFA.js";import"./chunk.EP5JS7ZH.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.KAM73WVF.js";import"./chunk.O32F6LGK.js";import"./chunk.EGSOHTZZ.js";import"./chunk.WVUJXDXZ.js";import"./chunk.L7XKYGV7.js";import{a as Ne}from"./chunk.CE3NKAF7.js";import"./chunk.R3GE37OI.js";import"./chunk.2KCDLCB2.js";import"./chunk.UD7VLXPM.js";import"./chunk.3DEWQDP7.js";import"./chunk.MIE4TJRW.js";import{s as Ae}from"./chunk.CFE3MHWZ.js";import"./chunk.RD2FSSLV.js";import"./chunk.HXTKBISQ.js";import"./chunk.TFJA4QV4.js";import"./chunk.HWFJQ42Y.js";import{d as se,l as Se}from"./chunk.QUETLFBJ.js";import{b as xe}from"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import{F as Oe,t as te}from"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{G as st,Qa as re,Ra as ee,W as be,Z as ke,ea as K,ga as oe,j as fe,l as he,m as me,r as X,ra as ye}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import{L as ge,T as ue,Z as $,cb as J,la as W,na as ae,pa as we,ra as ve}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as ie}from"./chunk.AJZBJBMO.js";var g=ie(st(),1);var dt=300,lt=14,Z=50,pt=3,ct=2;function We(e,n,o){let s=e.tryDefinition(n)?.fields?.shape;return(s?.[o]===void 0?void 0:Ne(s[o]))?.type}var gt=(e,n)=>Object.keys(e.tryDefinition(n)?.fields?.shape??{}),ut=e=>e==="date"||e==="datetime",Qe=/^(due|dueOn|dueAt|dueDate|deadline|by)$/i,wt=/^(date|on|day|when|at|start|starts|startsOn|startsAt|begins|from|sown|scheduled|scheduledFor|planned|plannedFor)$/i,vt=/^(done|finished|complete|completed|closed)$/i;function pe(e,n){let o=e.tryDefinition(n),s=gt(e,n),a=s.filter(c=>ut(We(e,n,c)));if(a.length===0)return;let i=o?.fieldRoles??{},r=c=>i[c]!==void 0&&a.includes(i[c])?i[c]:void 0,p=r("start")??r("when")??a.find(c=>Qe.test(c))??a.find(c=>wt.test(c));if(!p)return;let k=r("end")??a.find(c=>c!==p&&/^(end|ends|until|to|finish|finished|harvested|through)$/i.test(c)),m=s.find(c=>vt.test(c)&&We(e,n,c)==="boolean");return{field:p,due:Qe.test(p),...k?{end:k}:{},...m?{done:m}:{}}}function le(e,n){return Math.round((Date.parse(`${n.slice(0,10)}T00:00:00Z`)-Date.parse(`${e.slice(0,10)}T00:00:00Z`))/864e5)}var _=e=>typeof e=="string"&&/^\d{4}-\d{2}-\d{2}/.test(e)?e.slice(0,10):void 0;function Ze(e,n,o,s){let a=de(e,n);if(a&&o.length>0&&o.length<=dt)return{shape:"board",field:a.field};let i=pe(e,n);if(i&&!i.due){let r=l=>{let v=_(l[i.field]),b=_(J(l,i.field,s));return v&&b?le(v,b):0},p=o.map(l=>({from:_(J(l,i.field,s)),to:i.end&&_(l[i.end])?H(_(l[i.end]),r(l)):void 0})).filter(l=>l.from!==void 0).map(l=>({from:l.from,to:l.to&&l.to>l.from?l.to:l.from})),k=`${s.slice(0,7)}-01`,m=H(`${H(k,31).slice(0,7)}-01`,-1),c=p.filter(l=>l.from<=m&&l.to>=k),w=p.map(l=>le(l.from,l.to)).sort((l,v)=>l-v),u=w[Math.floor(w.length/2)]??0;if(c.length>0&&u<=lt){let l=H(s,-((new Date(`${s}T00:00:00Z`).getUTCDay()+6)%7)),v=H(l,6),b=c.every(f=>f.from>=l&&f.to<=v);return{shape:"calendar",start:i.field,...i.end?{end:i.end}:{},...i.done?{done:i.done}:{},range:b?"week":"month"}}}return{shape:"table"}}function Ue(e,n){let o=pe(e,n);return o?{by:o.field,direction:o.due?"asc":"desc"}:void 0}function Ye(e,n,o={}){switch(n.shape){case"board":return{lens:"columns",kind:e,column:n.field};case"calendar":return{lens:"calendar",kind:e,start:n.start,...n.end?{end:n.end}:{},...n.done?{done:n.done}:{},range:n.range};case"table":return{lens:"blocks",kind:e,as:"row",...o.group?.by?{group:o.group.by}:{},...o.sort?{sort:{by:o.sort.by,...o.sort.direction==="desc"?{direction:"desc"}:{}}}:{}}}}var ft=60;function Je(e,n,o,s){let a=e.tryDefinition(n),i=o.slice(0,ft),r=new Map;i.forEach(w=>{let u=W(a,w);se(w,a,{glance:!0,said:[u]}).forEach((l,v)=>{if(l.long||l.files||l.app)return;let b=r.get(l.key);b?b.count++:r.set(l.key,{label:l.label,count:1,at:v})})});let p=Math.max(1,Math.ceil(i.length/3)),k=[...r.entries()].filter(([,w])=>w.count>=p).sort((w,u)=>w[1].at-u[1].at).slice(0,pt).map(([w,u])=>({about:"field",key:w,label:u.label})),m=new Map;for(let w of i){let u=new Set;for(let[l,v]of[["out",s.outEdges(w.id)],["in",s.inEdges(w.id)]])for(let b of v){let f=s.getNode(l==="out"?b.to:b.from);if(!f||f.id===w.id)continue;let x=`${b.kind}|${l}`;if(u.has(x))continue;u.add(x);let y=m.get(x);y?y.count++:m.set(x,{edge:b.kind,direction:l,far:f.kind,count:1})}}let c=[...m.entries()].sort((w,u)=>u[1].count-w[1].count).slice(0,ct).map(([w,u])=>{let l=xe(e,u.direction==="out"?n:u.far,u.edge,u.direction);return{about:"edge",key:w,label:l.charAt(0).toUpperCase()+l.slice(1),edge:u.edge,direction:u.direction}});return[...k,...c]}function Xe(e,n,o,s){if(o.about==="field"){let r=e.tryDefinition(n.kind);return{text:se(n,r,{excerpt:!0}).find(k=>k.key===o.key)?.value??""}}let i=(o.direction==="out"?s.outEdges(n.id):s.inEdges(n.id)).filter(r=>r.kind===o.edge).map(r=>s.getNode(o.direction==="out"?r.to:r.from)).filter(r=>r!==void 0).map(r=>W(e.tryDefinition(r.kind),r));return i.length===0?{text:""}:i.length===1?{text:i[0]}:{text:`${i[0]} +${i.length-1}`,title:i.join(", ")}}function et(e,n,o=()=>{}){let s=new Map;for(let a of e){let i=a.nodeIds.filter(p=>n.has(p));if(i.length===0&&!(a.subjectId!==void 0&&n.has(a.subjectId)))continue;let r=s.get(a.invariant)??{invariant:a.invariant,label:o(a.invariant)||a.label||a.message,violations:[],records:new Set};r.violations.push(a);for(let p of i)r.records.add(p);a.subjectId!==void 0&&n.has(a.subjectId)&&r.records.add(a.subjectId),s.set(a.invariant,r)}return[...s.values()].sort((a,i)=>i.violations.length-a.violations.length).map(a=>({invariant:a.invariant,label:a.label,violations:a.violations,records:[...a.records]}))}var tt=6;function nt(e,n,o,s){let a=pe(e,n);if(!a)return;let i=de(e,n),r=m=>{if(a.done!==void 0&&m[a.done]===!0)return!0;if(!i)return!1;let c=i.values.indexOf(String(m[i.field]));return c>=0&&i.tiers[c]==="done"},p=0,k=0;for(let m of o){let c=_(J(m,a.field,s));if(!c||r(m))continue;let w=le(s,c);a.due&&w<0?p++:w>=0&&w<=tt&&k++}if(!(p===0&&k===0))return{field:a.field,due:a.due,overdue:p,soon:k}}function H(e,n){return new Date(Date.parse(`${e.slice(0,10)}T00:00:00Z`)+n*864e5).toISOString().slice(0,10)}function ce(e,n,o){return n==="overdue"?[{key:e.field,value:`before:${o}`}]:[{key:e.field,value:`after:${H(o,-1)}`},{key:e.field,value:`before:${H(o,tt+1)}`}]}function it(e,n,o,s){let a=new Set,i=new Set;for(let r of e)if(!(r.at<=o))for(let p of r.primitives)p.op==="add-node"&&p.node?.kind===n?a.add(p.node.id):(p.op==="patch-node"||p.op==="splice-text")&&p.id!==void 0&&s(p.id)===n&&i.add(p.id);for(let r of a)i.delete(r);return{added:[...a].filter(r=>s(r)===n).length,changed:[...i].filter(r=>s(r)===n).length}}var t=ie(be(),1),ht=560;function mt(e,n){let[o,s]=(0,g.useState)(0);return(0,g.useEffect)(()=>{let a=e.current;if(!a||!n){s(0);return}let i=0,r=()=>{i=0;let c=a.getBoundingClientRect().bottom;s([...a.querySelectorAll('[data-testid="kind-stop-table"] tbody tr[data-graview-pick]')].filter(w=>w.getBoundingClientRect().top>c-24).length)},p=()=>{i||(i=requestAnimationFrame(r))};r(),a.addEventListener("scroll",p,{passive:!0});let k=typeof ResizeObserver>"u"?null:new ResizeObserver(p);k?.observe(a);let m=a.querySelector('[data-testid="kind-stop-body"]');return m&&k?.observe(m),()=>{a.removeEventListener("scroll",p),k?.disconnect(),i&&cancelAnimationFrame(i)}},[e,n]),o}function bt({narrow:e,at:n,children:o}){return e?(0,t.jsx)("div",{ref:n,className:"graview-kind-stop-scroll","data-testid":"kind-stop-scroll",children:o}):(0,t.jsx)(t.Fragment,{children:o})}function kt(e){let[n,o]=(0,g.useState)(!1);return(0,g.useLayoutEffect)(()=>{let s=e.current;if(!s)return;let a=()=>{let r=s.getBoundingClientRect().width;r>0&&o(r<ht)};if(a(),typeof ResizeObserver>"u")return;let i=new ResizeObserver(a);return i.observe(s),()=>i.disconnect()},[e]),n}var ot="as",yt=(e,n)=>`graview:kind-seen:${e}:${n}`;function xt(e){try{return localStorage.getItem(e)}catch{return null}}function St(e,n){try{localStorage.setItem(e,n)}catch{}}var Nt=(e,n)=>({...fe(me(e,!1),n),relation:null});function rn({kind:e,members:n,flagged:o=[],label:s,retired:a=0}){let{store:i,brand:r,principal:p,views:k,view:m}=K(),{go:c}=ee(),w=oe(),u=i.schema,l=u.tryDefinition(e),v=s??we(u,e),b=i.today()??ge(),f=n,x=(0,g.useId)(),y=(0,g.useMemo)(()=>Ze(u,e,f,b),[u,e,f,b]),N=m.within?.[ot]==="table"?{shape:"table"}:y,R=Fe(m),D=N.shape==="table"&&!R.sort?Ue(u,e):void 0,E=D?{...R,sort:D}:R,L=(0,g.useMemo)(()=>new Set(o),[o]),h=(0,g.useMemo)(()=>Me(f,E,{schema:u,graph:i.graph,flagged:L,today:b}),[f,E,u,i,L,b,w]),C=(0,g.useMemo)(()=>Ee(u,Re(u,e)),[u,e]),P=k.arrangement?.()?.lists?.[e]?.filters,q=M=>c(Ie(m,M)),j=(0,g.useMemo)(()=>({name:r?.name??"app",schema:u,...i.policy?{policy:i.policy}:{}}),[r,u,i]),U=JSON.stringify(Ye(e,N,E)),F=(0,g.useMemo)(()=>{let M=Le(JSON.parse(U),{app:j,sight:Te(j,p)});return De(M)?void 0:M},[U,j,p]),G=N.shape!=="table"&&F!==void 0,z=(0,g.useRef)(null),O=kt(z),[V,d]=(0,g.useState)(!1),A=(0,g.useId)(),I=(0,g.useMemo)(()=>$e(i,p),[i,p]),B=(f.length>1||a>0)&&!G?(0,t.jsx)(Be,{schema:u,graph:i.graph,kind:e,arrangement:E,onChange:q,offers:C,...P?{filters:P}:{},kept:{shown:h.nodes.length,of:f.length},testId:"kind-arrange",chips:{nodes:f,flagged:L,today:b},...a>0?{past:{count:a,widen:()=>c(Pe(m,!0))}}:{}}):null,T=!!E.query||(E.filter?.length??0)>0,Y=(0,g.useRef)(null),ne=mt(Y,O&&!G);return(0,t.jsxs)("section",{ref:z,"aria-labelledby":x,className:"graview-kind-stop","data-testid":"kind-stop","data-graview-kind-stop":e,"data-graview-shape":N.shape,"data-graview-narrow":O||void 0,children:[(0,t.jsx)("style",{children:Lt}),(0,t.jsxs)(bt,{narrow:O,at:Y,children:[(0,t.jsx)(At,{kind:e,plural:v,count:f.length,headingId:x,description:l?.description,...O?{tools:{open:V,id:A,toggle:()=>d(M=>!M),narrowed:T}}:{}}),O&&V?(0,t.jsxs)("div",{id:A,className:"graview-kind-stop-tools","data-testid":"kind-stop-tools",role:"group","aria-label":`Find, filter and arrange the ${v.toLowerCase()}`,children:[B,f.length>0?(0,t.jsx)(at,{derived:y,shape:N,draft:F,author:!1}):null,(0,t.jsx)(rt,{kind:e,plural:v})]}):null,(0,t.jsx)(Rt,{kind:e,plural:v,members:f,today:b,arrangement:E,onArrange:q,compact:O}),O&&T&&!V?(0,t.jsxs)("p",{className:"graview-kind-stop-narrowed","data-testid":"kind-stop-narrowed",children:[(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:[$(h.nodes.length)," of ",$(f.length)," shown"]})," ",(0,t.jsx)("button",{type:"button",className:"graview-kind-stop-link",onClick:()=>q({}),children:"Show all"})]}):null,O?null:B,f.length>0&&!O?(0,t.jsx)(at,{derived:y,shape:N,draft:F,author:I}):null,(0,t.jsx)("div",{className:"graview-kind-stop-body","data-testid":"kind-stop-body",children:f.length===0?(0,t.jsx)("p",{className:"graview-kind-stop-empty","data-testid":"kind-stop-empty",children:"Nothing here yet."}):G?(0,t.jsx)(Dt,{draft:F,nodes:f}):h.nodes.length===0?(0,t.jsxs)("p",{className:"graview-kind-stop-empty","data-testid":"kind-stop-none-kept",children:["None of the ",$(f.length)," ",v.toLowerCase()," ",E.query?`says \u201C${E.query}\u201D`:"is kept by these filters","."," ",(0,t.jsx)("button",{type:"button",className:"graview-kind-stop-link",onClick:()=>q({}),children:"Show them all"})]}):(0,t.jsx)(Tt,{kind:e,nodes:h.nodes,groups:h.grouped?h.groups.map(M=>({key:M.key,label:M.label,nodes:M.nodes})):void 0,flagged:L,plural:v,arrangement:E})})]}),ne>0?(0,t.jsxs)("button",{type:"button",className:"graview-kind-stop-below","data-testid":"kind-stop-below","data-graview-below":ne,onClick:()=>Y.current?.scrollBy({top:Math.round(Y.current.clientHeight*.8),behavior:"smooth"}),children:[ae(u,e,ne).replace(/^(\S+)\s/,"$1 more ")," below ",(0,t.jsx)("span",{"aria-hidden":"true",children:"\u2193"})]}):null]})}function rt({kind:e,plural:n}){let{setSelection:o,setMenuAt:s}=K();return(0,t.jsx)("button",{type:"button",className:"graview-kind-stop-quiet","data-testid":"kind-stop-acts","aria-haspopup":"menu","aria-label":`What can be done with the ${n.toLowerCase()}`,onClick:a=>{let i=a.currentTarget.getBoundingClientRect();o([X(e)]),s({x:Math.round(i.left),y:Math.round(i.bottom+4),on:X(e)})},children:"Acts\u2026"})}function At({kind:e,plural:n,count:o,headingId:s,description:a,tools:i}){let{store:r}=K(),p=(0,g.useMemo)(()=>({about:[X(e)]}),[e]),{affordances:k}=qe(p),{apply:m,preview:c}=Ke(),w=(0,g.useMemo)(()=>{let S=N=>r.allMutations().find(R=>R.name===N.mutation)?.creates?.includes(e)??!1;return k.find(N=>!N.destructive&&!N.setsAside&&S(N))},[k,r,e]),[u,l]=(0,g.useState)(!1),[v,b]=(0,g.useState)(null),f=(0,g.useRef)(null),x=(0,g.useRef)(null);(0,g.useEffect)(()=>{let S=x.current;if(!S||S.closest('[data-testid="kind-stop"]')?.contains(document.activeElement))return;let N=!1;try{N=document.activeElement instanceof HTMLElement&&document.activeElement!==document.body&&document.activeElement.matches(":focus-visible")}catch{N=!0}N?delete S.dataset.graviewQuietFocus:S.dataset.graviewQuietFocus="",S.focus({preventScroll:!0})},[e]);let y=(S,N)=>{try{c(S,N),m(S,N),b(null),l(!1),requestAnimationFrame(()=>f.current?.focus())}catch(R){return b(Se(r.schema,r.allMutations(),R)),[]}};return(0,t.jsxs)("header",{className:"graview-kind-stop-head",children:[(0,t.jsxs)("div",{className:"graview-kind-stop-title",children:[(0,t.jsx)("h2",{id:s,ref:x,tabIndex:-1,"data-testid":"kind-stop-title",onKeyDown:S=>delete S.currentTarget.dataset.graviewQuietFocus,onBlur:S=>delete S.currentTarget.dataset.graviewQuietFocus,children:n}),(0,t.jsxs)("p",{"data-testid":"kind-stop-count",children:[ae(r.schema,e,o),a?` \xB7 ${a}`:""]})]}),(0,t.jsxs)("div",{className:"graview-kind-stop-acts",children:[w?(0,t.jsx)("button",{ref:f,type:"button",className:"graview-kind-stop-primary","data-testid":"kind-stop-primary","data-affordance":w.id,"aria-expanded":w.open.length>0?u:void 0,onClick:()=>{b(null),w.open.length===0?y(w):l(S=>!S)},children:w.label}):null,i?(0,t.jsx)("button",{type:"button",className:"graview-kind-stop-more-tools","data-testid":"kind-stop-tools-open","aria-expanded":i.open,"aria-controls":i.open?i.id:void 0,"aria-label":`Find, filter, arrange and act on the ${n.toLowerCase()}`,title:"Find, filter, arrange and acts","data-narrowed":i.narrowed||void 0,onClick:i.toggle,children:(0,t.jsx)("span",{"aria-hidden":"true",children:"\u22EF"})}):(0,t.jsx)(rt,{kind:e,plural:n})]}),u&&w?(0,t.jsx)("div",{className:"graview-kind-stop-ask","data-testid":"kind-stop-ask","aria-label":w.label,role:"group",children:(0,t.jsx)(Ce,{affordance:w,onApply:S=>y(w,S),onCancel:()=>{l(!1),f.current?.focus()}})}):null,v?(0,t.jsx)("p",{role:"alert",className:"graview-kind-stop-failed","data-testid":"kind-stop-failed",children:v}):null]})}var Ct=te.part((e,n)=>(0,t.jsx)(e.ProblemRows,{...n}),{what:"The problems",as:"li"});function Rt({kind:e,plural:n,members:o,today:s,arrangement:a,onArrange:i,compact:r=!1}){let{store:p,brand:k,setSelection:m}=K(),c=p.schema,w=re(),u=(0,g.useMemo)(()=>new Set(o.map(h=>h.id)),[o]),l=(0,g.useMemo)(()=>et(w,u,h=>p.allInvariants().find(C=>C.name===h)?.label),[w,u,p]),v=(0,g.useMemo)(()=>nt(c,e,o,s),[c,e,o,s]),b=yt(Oe(k,c),e),[f]=(0,g.useState)(()=>xt(b));(0,g.useEffect)(()=>()=>St(b,new Date().toISOString()),[b]);let x=oe(),y=(0,g.useMemo)(()=>f?it(p.log.all(),e,f,h=>p.graph.getNode(h)?.kind):null,[f,p,e,x]),[S,N]=(0,g.useState)(null),R=h=>i({...a,filter:[...(a.filter??[]).filter(C=>!h?.some(P=>P.key===C.key)),...h??[]]}),D=l.reduce((h,C)=>h+C.violations.length,0),E=[];if(v&&(v.overdue>0||v.soon>0)){let h=v.field;E.push((0,t.jsxs)("li",{"data-testid":"kind-stop-dates",children:[v.overdue>0?(0,t.jsxs)("button",{type:"button",className:"graview-kind-stop-fact","data-tone":"warn",onClick:()=>R(ce(v,"overdue",s)),"aria-label":`${$(v.overdue)} overdue \u2014 show only these`,children:[$(v.overdue)," overdue"]}):null,v.soon>0?(0,t.jsxs)("button",{type:"button",className:"graview-kind-stop-fact",onClick:()=>R(ce(v,"soon",s)),"aria-label":`${$(v.soon)} in the next 7 days \u2014 show only these`,children:[$(v.soon)," ",v.due?"due":""," in the next 7 days"]}):null,(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:[" by ",ve(c.tryDefinition(e),h).toLowerCase()]})]},"dates"))}let L=(a.filter??[]).some(h=>h.key==="is"&&h.value==="flagged");if(l.length>0&&r){let h=l.map(C=>C.label).join(", ");E.push((0,t.jsxs)("li",{className:"graview-kind-stop-problems-line","data-testid":"kind-stop-problems","data-graview-problems":D,children:[(0,t.jsxs)("span",{className:"graview-kind-stop-warn",children:[(0,t.jsx)("span",{"aria-hidden":"true",children:"\u26A0 "}),D===1?"1 problem":`${$(D)} problems`]}),(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text graview-kind-stop-rules-said",title:h,children:[" ","\xB7 ",h]}),(0,t.jsx)("button",{type:"button",className:"graview-kind-stop-link","data-testid":"kind-stop-only-problems","aria-pressed":L,"aria-label":L?`Show all the ${n.toLowerCase()}`:`Show only the ${n.toLowerCase()} with a problem`,onClick:()=>L?i({...a,filter:(a.filter??[]).filter(C=>!(C.key==="is"&&C.value==="flagged"))}):R([{key:"is",value:"flagged"}]),children:L?"Show all":"Show"})]},"problems"))}else l.length>0&&E.push((0,t.jsxs)("li",{"data-testid":"kind-stop-problems","data-graview-problems":D,children:[(0,t.jsxs)("span",{className:"graview-kind-stop-warn",children:[(0,t.jsx)("span",{"aria-hidden":"true",children:"\u26A0 "}),D===1?"1 problem":`${$(D)} problems`]}),(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:[" in ",n.toLowerCase(),":"]}),(0,t.jsx)("ul",{className:"graview-kind-stop-rules",children:l.map(h=>(0,t.jsx)(Et,{group:h,open:S===h.invariant,onToggle:()=>N(C=>C===h.invariant?null:h.invariant),onPick:C=>m([C])},h.invariant))}),(0,t.jsxs)("button",{type:"button",className:"graview-kind-stop-link","data-testid":"kind-stop-only-problems",onClick:()=>R([{key:"is",value:"flagged"}]),children:["Show only the ",n.toLowerCase()," with a problem"]})]},"problems"));if(y&&(y.added>0||y.changed>0)){let h=[y.added>0?`${$(y.added)} added`:"",y.changed>0?`${$(y.changed)} changed`:""].filter(Boolean);E.push((0,t.jsxs)("li",{"data-testid":"kind-stop-since",children:[(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:["Since you last looked (",ue(f.slice(0,10)),"):"]})," ",h.join(", ")]},"since"))}return E.length===0?null:(0,t.jsx)("ul",{className:"graview-kind-stop-going-on","aria-label":`What is going on in the ${n.toLowerCase()}`,"data-testid":"kind-stop-going-on",children:E})}function Et({group:e,open:n,onToggle:o,onPick:s}){let a=(0,g.useId)();return(0,t.jsxs)("li",{"data-graview-rule":e.invariant,children:[(0,t.jsxs)("button",{type:"button",className:"graview-kind-stop-rule","aria-expanded":n,"aria-controls":a,onClick:o,onPointerEnter:te.prefetch,onFocus:te.prefetch,children:[(0,t.jsx)("span",{"aria-hidden":"true",className:"graview-kind-stop-chevron","data-open":n||void 0,children:"\u203A"}),e.label," ",(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:["\xB7 ",$(e.violations.length)]})]}),n?(0,t.jsx)("ol",{id:a,className:"graview-kind-stop-problem-rows","data-testid":"kind-stop-problem-rows",children:(0,t.jsx)(g.Suspense,{fallback:null,children:(0,t.jsx)(Ct,{violations:e.violations,pick:i=>{let r=i.subjectId??e.records[0]??i.nodeIds[0];r!==void 0&&s(r)}})})}):null]})}var $t={board:"Board",calendar:"Calendar",table:"Table"};function at({derived:e,shape:n,draft:o,author:s}){let{view:a}=K(),{go:i}=ee(),{keep:r}=je(Ge()),[p,k]=(0,g.useState)(!1),m=e.shape==="table"?[]:[e.shape,"table"];return!s&&m.length===0?null:(0,t.jsxs)("div",{className:"graview-kind-stop-shape","data-testid":"kind-stop-shape",children:[m.length>0?(0,t.jsx)("span",{role:"group","aria-label":"Show as",className:"graview-kind-stop-switch",children:m.map(c=>(0,t.jsx)("button",{type:"button","aria-pressed":n.shape===c,"data-testid":`kind-stop-as-${c}`,onClick:()=>i(he(a,ot,c===e.shape?null:c)),children:$t[c]},c))}):null,s?(0,t.jsx)("span",{className:"graview-kind-stop-quiet-text","data-testid":"kind-stop-derived",children:o?`${o.said.replace(/\.$/,"")}, derived from the declaration`:"Derived from the declaration"}):null,o&&s?(0,t.jsx)("button",{type:"button",className:"graview-kind-stop-link","data-testid":"kind-stop-keep",disabled:p,title:`Keep \u201C${o.title}\u201D as a lens: a place of its own`,onClick:()=>{k(!0),r(o).finally(()=>k(!1))},children:"Keep as a lens"}):null]})}function Dt({draft:e,nodes:n}){let o=_e(e.drawn);return(0,t.jsx)("div",{className:"graview-kind-stop-lens","data-graview-draft":e.lens.name,children:(0,t.jsx)(ke,{mode:"scene",children:(0,t.jsx)(Ae,{kind:e.kind,view:e.title,children:(0,t.jsx)(o,{nodes:n,label:e.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1})})})})}function Tt({kind:e,nodes:n,groups:o,flagged:s,plural:a,arrangement:i}){let{store:r,views:p,view:k,selection:m,setSelection:c,setMenuAt:w,principal:u}=K(),{go:l}=ee(),v=r.schema,b=r.graph,f=(0,g.useMemo)(()=>(o?o.flatMap(d=>d.nodes):n).map(d=>d.id),[n,o]),x=He(f),y=(0,g.useMemo)(()=>r.permittedMutations(u).some(d=>{let A=d.subject?.kinds;return A!==void 0&&(A==="*"||A.includes(e))}),[r,u,e]),S=(0,g.useRef)(null),N=d=>{x.choose(d),requestAnimationFrame(()=>{let A=x.list.current;((d[0]===void 0?null:A?.querySelector(`[data-graview-choose-box="${CSS.escape(d[0])}"]`))??A)?.focus({preventScroll:!0})})},R=x.chosen.length,D=p.lookup(e,{cardinality:"one",fidelity:"glyph"}),E=D!==void 0&&!ye(D)?D:void 0,L=d=>m.includes(d),h=re(),C=(0,g.useMemo)(()=>Je(v,e,n,b),[v,e,n,b]),[P,q]=(0,g.useState)(Z);(0,g.useEffect)(()=>q(Z),[i.query,i.filter?.length,i.sort?.by,i.group?.by]);let j=v.tryDefinition(e),U=d=>h.filter(A=>A.nodeIds.includes(d)||A.subjectId===d).map(A=>A.message),F=i.sort?.by,G=`${a}${i.sort?`, in order of ${C.find(d=>d.key===F)?.label.toLowerCase()??F}`:""}`,z=P,O=d=>{let A=W(j,d),I=s.has(d.id)?U(d.id):[];return(0,t.jsxs)("tr",{"data-graview-pick":d.id,tabIndex:-1,"data-graview-record":d.id,"data-flagged":I.length>0||void 0,...y?{"data-graview-choose":d.id}:{},children:[y?(0,t.jsx)("td",{className:"graview-choose-at",children:(0,t.jsx)("input",{...x.boxProps(d.id,A),onPointerEnter:Q,onFocus:Q})}):null,(0,t.jsxs)("th",{scope:"row",className:"graview-kind-stop-name",children:[E?(0,t.jsx)("div",{"data-graview-pick":d.id,className:"graview-kind-stop-own-row",children:(0,t.jsx)(E,{node:d,cardinality:"one",fidelity:"glyph",mode:"scene",selected:L(d.id),...I.length>0?{flagged:[d.id]}:{}})}):(0,t.jsx)("button",{type:"button","data-testid":"kind-stop-row-go",title:`Go to ${A}`,onClick:()=>l(Nt(k,d.id)),children:A}),I.length>0?(0,t.jsxs)("span",{className:"graview-kind-stop-flag",title:I.join(" \xB7 "),children:[(0,t.jsx)("span",{"aria-hidden":"true",children:"\u26A0"}),(0,t.jsx)("span",{className:"graview-kind-stop-hidden",children:`Problem: ${I.join(". ")}`})]}):null]}),C.map(B=>{let T=Xe(v,d,B,b);return(0,t.jsx)("td",{"data-label":B.label,"data-short":T.text.length>0&&T.text.length<=14||void 0,"data-empty":T.text?void 0:"",...T.title?{title:T.title}:{},children:T.text?(0,t.jsx)("span",{children:T.text}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("b",{"aria-hidden":"true",children:"\u2014"}),(0,t.jsx)("i",{className:"graview-kind-stop-hidden",children:"none"})]})},B.key)}),(0,t.jsx)("td",{className:"graview-kind-stop-row-acts",children:(0,t.jsx)("button",{type:"button","data-testid":"kind-stop-row-acts","aria-haspopup":"menu","aria-label":`What can be done with ${A}`,onClick:B=>{let T=B.currentTarget.getBoundingClientRect();c([d.id]),w({x:Math.round(T.left),y:Math.round(T.bottom+4),on:d.id})},children:(0,t.jsx)("span",{"aria-hidden":"true",children:"\u22EF"})})})]},d.id)},V=d=>{let A=d.slice(0,Math.max(0,z));return z-=A.length,A.map(O)};return(0,t.jsxs)("div",{className:"graview-kind-stop-table-at",...y?{...x.listProps,ref:d=>{S.current=d,x.list.current=d},tabIndex:-1,role:"group","aria-label":R>0?`${a}, ${R} chosen`:a,"data-graview-choosable":""}:{},children:[y?(0,t.jsx)("style",{children:ze}):null,(0,t.jsxs)("table",{className:"graview-kind-stop-table","data-testid":"kind-stop-table",children:[(0,t.jsx)("caption",{className:"graview-kind-stop-hidden",children:G}),(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[y?(0,t.jsx)("td",{className:"graview-choose-at graview-choose-all",children:(0,t.jsx)("input",{type:"checkbox",className:"graview-choose-box","data-testid":"kind-stop-choose-all","aria-label":`Choose all ${$(n.length)} ${a.toLowerCase()}`,checked:R>0&&R===n.length,ref:d=>{d&&(d.indeterminate=R>0&&R<n.length)},onPointerEnter:Q,onFocus:Q,onChange:()=>R===n.length?x.clear():x.choose(f)})}):null,(0,t.jsx)("th",{scope:"col","aria-sort":F==="label"?i.sort?.direction==="desc"?"descending":"ascending":void 0,children:"Name"}),C.map(d=>(0,t.jsx)("th",{scope:"col","aria-sort":d.about==="field"&&d.key===F?i.sort?.direction==="desc"?"descending":"ascending":void 0,children:d.label},d.key)),(0,t.jsx)("th",{scope:"col",children:(0,t.jsx)("span",{className:"graview-kind-stop-hidden",children:"Acts"})})]})}),o?o.map(d=>z<=0?null:(0,t.jsxs)("tbody",{"data-graview-group":d.key,children:[(0,t.jsx)("tr",{className:"graview-kind-stop-group",children:(0,t.jsxs)("th",{scope:"rowgroup",colSpan:C.length+(y?3:2),children:[d.label," ",(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:["\xB7 ",$(d.nodes.length)]})]})}),V(d.nodes)]},d.key||"-")):(0,t.jsx)("tbody",{children:V(n)})]}),y?(0,t.jsx)(Ve,{store:r,chosen:x.chosen,principal:u,anchor:()=>S.current?.closest('[data-testid="kind-stop"]')??null,of:f.length,onChooseAll:()=>x.choose(f),onClear:x.clear,onActed:N}):null,n.length>P?(0,t.jsxs)("p",{className:"graview-kind-stop-more",children:[(0,t.jsxs)("span",{className:"graview-kind-stop-quiet-text","data-testid":"kind-stop-shown",children:[$(P)," of ",$(n.length)," shown"]})," ",(0,t.jsxs)("button",{type:"button",className:"graview-kind-stop-link","data-testid":"kind-stop-more",onClick:()=>q(d=>d+Z),children:["Show ",$(Math.min(Z,n.length-P))," more"]})]}):null]})}var Lt=`
|
|
2
2
|
.graview-kind-stop{container-type:inline-size;box-sizing:border-box;height:100%;min-height:0;display:flex;flex-direction:column;gap:10px;padding:16px 18px 12px;border:1px solid var(--graview-edge);border-radius:var(--graview-radius,12px);background:var(--graview-panel);color:var(--graview-ink);box-shadow:var(--graview-lift-low);overflow:auto;overscroll-behavior:contain}
|
|
3
3
|
[data-graview-map-panel] .graview-kind-stop{height:auto;padding:4px 6px 12px;border:0;box-shadow:none;background:none;overflow:visible}
|
|
4
4
|
.graview-kind-stop :focus-visible{outline:2px solid var(--graview-accent);outline-offset:2px}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as S,e as w,f as I}from"./chunk.
|
|
1
|
+
import{d as S,e as w,f as I}from"./chunk.AQ2PI6MR.js";import{d as k,g as h,h as b}from"./chunk.H3W5C3XQ.js";import"./chunk.6WB2TYK7.js";import"./chunk.BJUUSIQY.js";import"./chunk.N5Z34V7U.js";import{a as A}from"./chunk.YL2RBZFE.js";import"./chunk.LOKGUALC.js";import"./chunk.JGRSUTPJ.js";import"./chunk.XOZU4OFA.js";import"./chunk.EP5JS7ZH.js";import"./chunk.CE3NKAF7.js";import"./chunk.TFJA4QV4.js";import"./chunk.HWFJQ42Y.js";import"./chunk.QUETLFBJ.js";import"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{G as M,W as f}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as d}from"./chunk.AJZBJBMO.js";var n=d(M(),1);var r=d(f(),1),C="several";function T({chosen:c,acts:p,onAct:N}){let t=A(),u=(0,n.useMemo)(()=>[...c].sort(),[c]),i=u.join(`
|
|
2
2
|
`),o=(0,n.useMemo)(()=>({on:"selection",ids:u}),[i]),l=(0,n.useMemo)(()=>p.filter(e=>e.open.length===0&&!e.more&&!e.destructive),[p]),g=(0,n.useMemo)(()=>new Map(l.map(e=>[h(e.id),e])),[l]),v=S(t,o,C),[y,x]=(0,n.useState)(null);(0,n.useEffect)(()=>{if(v!==void 0)return;let e=!0;return w(t,o,{by:C,ask:()=>b(t.ai,{store:t.store,target:o,principal:t.principal,interaction:k(),places:t.places,selection:t.selection,...t.place?{place:t.place}:{},shared:l.map(a=>({id:a.id,label:a.label,mutation:a.mutation,args:a.args}))})}).then(a=>{e&&x({key:i,result:a})}),()=>{e=!1}},[i]);let s=v??(y?.key===i?y.result:void 0);if(s===void 0)return(0,r.jsx)("span",{role:"status",className:"graview-several-quiet","data-testid":"several-ai-thinking",style:{textDecoration:"none"},children:"AI: thinking\u2026"});let m=s.offers.filter(e=>e.type!=="act"||g.has(e.id));if(m.length===0)return null;let E=e=>{let a=g.get(e.id);if(a){t.desk.record({...s.interaction,outcome:"accepted",accepted:[e.id]}),N(a);return}I(t,s,e)};return(0,r.jsx)("div",{role:"group","aria-label":"Suggested by AI",className:"graview-several-acts","data-testid":"several-ai",children:m.map(e=>(0,r.jsxs)("button",{type:"button",className:"graview-several-act","data-testid":"several-ai-offer","data-ai-offer":e.id,"data-ai-offer-type":e.type,onClick:()=>E(e),children:[e.label,(0,r.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontWeight:400},children:" \xB7 suggested"})]},e.id))})}export{T as SeveralAi};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as N,g as ae,h as ie}from"./chunk.GRFD42WM.js";import{a as S,b as T,c as A,d as j}from"./chunk.U5P23GO7.js";import{a as R}from"./chunk.HJUZMOW2.js";import{a as Z,b as ee,c as te}from"./chunk.NAXOXBOF.js";import{b as k}from"./chunk.6W6XMLSF.js";import{a as ne}from"./chunk.EGPCVMDU.js";import{a as C}from"./chunk.SO6NT5K7.js";import{m as Q}from"./chunk.QNP5OR3P.js";import{G,J as _,La as K,R as H,S as z,W as X,ea as b,oa as J}from"./chunk.A5PSEU3W.js";import{a as Y}from"./chunk.SDO3U72B.js";import{Ce as U,Jb as x,eb as q,fb as B,ga as V,la as P}from"./chunk.ZEZUKRC6.js";import{b as D}from"./chunk.AJZBJBMO.js";var u=D(G(),1);var oe=D(G(),1);function E(){let{ai:n,aiDesk:a}=b(),{entries:o}=_(a),i=n.off===!0;return(0,oe.useEffect)(()=>{i||a.load()},[a,i]),i?[]:o}var t=D(X(),1),se=K(Y(()=>(__graviewPreload(import.meta.url,["./chunk.7UHPHEH5.js","./chunk.U5P23GO7.js","./chunk.QF5QB5YR.js","./chunk.QNP5OR3P.js","./chunk.4W57E7AX.js","./chunk.A5PSEU3W.js","./chunk.SDO3U72B.js","./chunk.ZEZUKRC6.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.3ENPWZBG.js")))),he=se.part((n,a)=>(0,t.jsx)(n.InteractionRow,{...a}),{quiet:!0,as:"li"}),ye=se.part((n,a)=>(0,t.jsx)(n.ActivityFilter,{...a}),{quiet:!0,as:"div"}),fe=n=>n.undoes===void 0&&n.primitives.some(a=>a.op==="remove-node"||a.op==="patch-node"&&a.after[B]===!0&&a.before[B]!==!0);function ve(n){let a=[...new Set(n.ops.filter(o=>!x(o)&&fe(o)).map(o=>o.intent))].filter(o=>o!==n.intent);return a.length===0?n.intent:`${n.intent} \u2014 ${a.join("; ")}`}var re=(n,a,o=le(n,[a]))=>({intent:ve(a),author:a.author.kind,...a.author.id?{authorId:a.author.id}:{},by:a.author,...a.ops[0]?.via?{via:a.ops[0].via}:{},...a.lineage?{basis:ne(a.lineage)}:{},touched:[...new Set(a.ops.filter(i=>!x(i)).flatMap(i=>i.writes))],...me(a.ops.filter(i=>!x(i)).flatMap(i=>i.writes),o),batch:a.id,at:a.at,...a.lineage?.interaction?{interaction:a.lineage.interaction}:{},seq:a.ops.at(-1).seq+1,...a.ops.every(x)?{withheld:!0}:{}});function de(n=4){let{store:a,principal:o}=b(),i=z(a,o),s=i.log.length;return(0,u.useMemo)(()=>{let l=i.batches(),d=le(i,l);return ee(l,r=>i.log.get(r)).reverse().slice(0,n).map(r=>{if("batch"in r){let p=re(i,r.batch,d);return r.typed?{...p,intent:Z(r.typed,i.schema,i.graph),batches:r.typed.batches.filter(v=>!v.undone).map(v=>v.id)}:p}let h=[...r.digest.batches].reverse().map(p=>re(i,p,d));return{intent:te(r.digest),author:r.digest.author.kind,...r.digest.author.id?{authorId:r.digest.author.id}:{},by:r.digest.author,touched:[...new Set(h.flatMap(p=>p.touched))],batch:"",...h[0]?.at?{at:h[0].at}:{},seq:h[0]?.seq??0,digest:h}})},[i,s,n])}function le(n,a){let o=new Map;for(let i of a)for(let s of i.ops)if(!x(s))for(let l of s.primitives)(l.op==="add-node"||l.op==="remove-node")&&l.node&&o.set(l.node.id,P(n.schema.tryDefinition(l.node.kind),l.node));return o}function me(n,a){let o={};for(let i of n){let s=a.get(i);s!==void 0&&(o[i]=s)}return Object.keys(o).length>0?{named:o}:{}}function we({change:n}){let{store:a,principal:o,seats:i,people:s}=b();return(0,t.jsxs)("strong",{style:{fontWeight:600},children:[n.author==="human"&&n.by?.onBehalfOf===void 0&&(n.authorId===void 0||o.id===void 0||n.authorId===o.id)?"you":q(n.by??{kind:n.author,id:n.authorId},{graph:a.graph,schema:a.schema,seats:i,people:s}),C(n.via)?(0,t.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",C(n.via)]}):null]})}function be({change:n,goes:a}){let{store:o}=b(),[i,s]=(0,u.useState)(!1),l=n.digest??[];return(0,t.jsxs)("li",{"data-testid":"activity-digest",style:{...S,gap:5},children:[(0,t.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,t.jsxs)("span",{"data-graview-activity-words":"",style:A,children:[(0,t.jsx)(we,{change:n})," ",(0,t.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:n.intent})]}),(0,t.jsx)("button",{type:"button","data-testid":"digest-toggle","aria-expanded":i,onClick:()=>s(d=>!d),style:{marginLeft:"auto",flex:"0 0 auto",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem"},children:i?"Hide":"Show each"})]}),i?(0,t.jsx)("ol",{"data-testid":"digest-changes",style:{margin:0,padding:"0 0 0 10px",listStyle:"none",display:"grid",gap:6,borderLeft:"1px solid var(--graview-edge)"},children:l.map(d=>(0,t.jsxs)("li",{"data-testid":"digest-change",style:S,children:[(0,t.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,t.jsxs)("span",{"data-graview-activity-words":"",style:A,children:[(0,t.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:d.intent}),d.basis?(0,t.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",d.basis]}):null]}),d.withheld?null:(0,t.jsx)($,{batch:d.batch})]}),d.touched.length>0?(0,t.jsx)("div",{"data-touched":d.touched.join(" "),style:j,children:d.touched.slice(0,4).map(r=>(0,t.jsx)(R,{id:r,label:o.graph.has(r)?k(o,r):d.named?.[r]??k(o,r),go:a(r),testId:"activity-record"},r))}):null]},d.batch))}):null]})}function $({batch:n}){let{store:a,principal:o,noteSeat:i}=b(),s=z(a,o),l=H()?.open??!1,d=s.log.length,[r,h]=(0,u.useState)(null),p=(0,u.useMemo)(()=>s.canUndo(n),[s,n,d]),v=(0,u.useMemo)(()=>p.ok?s.mayUndo(n,o):{ok:!0},[s,n,d,o,p]);if(l||!p.ok&&p.ops.length===0||!v.ok)return null;let m=!p.ok,W=m?p.includeBatches:[];return(0,t.jsxs)("span",{style:{marginLeft:"auto",flex:"0 0 auto",display:"grid",justifyItems:"end",gap:2},children:[(0,t.jsx)("button",{type:"button","data-testid":"undo-turn",title:m?`${p.message} \u2014 undo those too`:"Take this back, keeping everything since",onClick:()=>{h(null);try{let y=typeof n=="string"?[n]:n,L=s.log.all().find(I=>y.includes(I.batch)&&I.author.kind==="agent");s.undo(m?[...y,...W]:typeof n=="string"?n:[...n],{author:o}),L&&i({type:"home",author:L.author})}catch(y){h(y instanceof Error?y.message:String(y))}},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem",...m?{borderColor:"var(--graview-warn)",color:"var(--graview-warn)"}:{}},children:m?`undo +${W.length}`:"undo"}),r?(0,t.jsx)("span",{"data-testid":"undo-refused",role:"alert",style:{fontSize:"0.75rem",lineHeight:1.4,color:"var(--graview-warn)",maxWidth:260,textAlign:"right"},children:r}):null]})}function ke({seq:n,intent:a}){let o=H();if(!o)return null;let i=o.past?.seq===n;return(0,t.jsx)("button",{type:"button","data-testid":"show-past","aria-label":`Show the app as it was after \u201C${a}\u201D`,title:"Show the app as it was here","aria-pressed":i,onPointerEnter:N,onFocus:N,onClick:()=>o.show(n),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minHeight:24,minWidth:24,padding:"1px 6px",fontSize:"0.75rem",flex:"0 0 auto"},children:(0,t.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M2.5 8 a5.5 5.5 0 1 0 1.6-3.9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,t.jsx)("path",{d:"M2 2.5 V5.5 H5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,t.jsx)("path",{d:"M8 5 V8 L10 9.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}function xe(){let n=()=>U(window.location.href);return(0,t.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:a=>{a.preventDefault(),window.location.assign(n())},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",textDecoration:"underline",textDecorationColor:"var(--graview-edge-bright)",textUnderlineOffset:3},children:"Start fresh"})}function Ee({calls:n,seat:a,remembers:o=!1,close:i,headed:s=!0}){let l=de(),{store:d,principal:r,seats:h,people:p}=b(),v=E(),[m,W]=(0,u.useState)("all"),[y,L]=(0,u.useState)(!1),I=e=>e!==void 0&&(e.id===r.id||e.onBehalfOf?.id===r.id)&&r.id!==void 0,pe=new Set(v.map(e=>e.id)),ge=l.filter(e=>!(e.interaction!==void 0&&pe.has(e.interaction))&&(!y||I(e.by))),ce=v.filter(e=>!y||I(e.by)).slice(0,4),O=[...m==="ai"?[]:ge.map(e=>({at:e.at??"",change:e})),...m==="changes"?[]:ce.map(e=>({at:e.at,entry:e}))].sort((e,f)=>e.at<f.at?1:e.at>f.at?-1:0),w=z(d,r),ue=J(),F=H(),M=e=>w.graph.has(e)?f=>{i(),F?.past&&F.show(null),ue.record(f)}:null;return(0,t.jsxs)(t.Fragment,{children:[s?(0,t.jsx)("h2",{style:{...Q,margin:0},children:"Activity"}):null,a!==void 0?(0,t.jsxs)("div",{"data-testid":"agent-seat-row",style:{display:"grid",gap:5,paddingBottom:n.length>0||O.length>0?9:0,...n.length>0||O.length>0?{borderBottom:"1px solid var(--graview-edge)"}:{}},children:[(0,t.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"The agent's seat"}),a]}):null,n.length>0?(0,t.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:7},children:n.slice(0,6).map((e,f)=>(0,t.jsxs)("li",{style:{...S,gap:2,fontSize:"0.8125rem"},children:[(0,t.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,t.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,flex:"0 0 auto",background:e.phase==="running"?"var(--graview-accent)":e.phase==="failed"?"var(--graview-warn)":"var(--graview-edge-bright)"}}),(0,t.jsxs)("span",{"data-graview-activity-words":"",style:{...A,color:"var(--graview-ink)"},children:[e.mutating?"changed":"read"," \xB7"," ",w.allMutations().find(g=>g.name===e.name)?.title??V(e.name)]})]}),!e.mutating&&e.reads&&e.reads.length>0?(0,t.jsxs)("div",{"data-testid":"activity-reads",style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:[[...new Set(e.reads)].slice(0,3).map(g=>(0,t.jsx)(R,{id:g,label:k(w,g),go:M(g),testId:"activity-record"},g)),new Set(e.reads).size>3?(0,t.jsxs)("span",{style:{color:"var(--graview-ink-muted)"},children:["+",new Set(e.reads).size-3]}):null]}):Object.values(e.args).some(g=>typeof g=="string")?(0,t.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:Object.entries(e.args).filter(g=>typeof g[1]=="string").slice(0,3).map(([g,c])=>(0,t.jsx)(R,{id:c,label:k(w,c),go:M(c),testId:"activity-record"},g))}):null,e.error?(0,t.jsx)("div",{style:{paddingLeft:12,color:"var(--graview-warn)"},children:e.error}):null]},`${e.at}:${f}`))}):null,v.length>0?(0,t.jsx)(u.Suspense,{fallback:null,children:(0,t.jsx)(ye,{shows:m,onShows:W,mine:y,onMine:L})}):null,O.length>0?(0,t.jsx)("ol",{"data-testid":"diff-log",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6,fontSize:"0.8125rem"},children:O.map(({change:e,entry:f},g)=>f!==void 0?(0,t.jsx)(u.Suspense,{fallback:null,children:(0,t.jsx)(he,{entry:f,undo:c=>(0,t.jsx)($,{batch:c})})},`ai:${f.id}`):e.digest?(0,t.jsx)(be,{change:e,goes:M},`digest:${e.digest[0]?.batch??g}`):e.withheld?(0,t.jsx)("li",{"data-testid":"withheld-change",style:S,children:(0,t.jsx)("span",{"data-touched":"",style:{...A,color:"var(--graview-ink-muted)",fontStyle:"italic"},children:e.intent})},`change:${g}`):(0,t.jsxs)("li",{"data-batch":e.batch,style:S,children:[(0,t.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,t.jsxs)("span",{"data-graview-activity-words":"",style:A,children:[(0,t.jsxs)("strong",{style:{fontWeight:600},children:[e.author==="human"&&e.by?.onBehalfOf===void 0&&(e.authorId===void 0||r.id===void 0||e.authorId===r.id)?"you":q(e.by??{kind:e.author,id:e.authorId},{graph:w.graph,schema:w.schema,seats:h,people:p}),C(e.via)?(0,t.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",C(e.via)]}):null]})," ",(0,t.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:e.intent}),e.basis?(0,t.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",e.basis]}):null]}),e.batch?(0,t.jsx)(ke,{seq:e.seq,intent:e.intent}):null,e.batch?(0,t.jsx)($,{batch:e.batches&&e.batches.length>0?e.batches.length===1?e.batches[0]:e.batches:e.batch}):null]}),(0,t.jsx)("div",{"data-touched":e.touched.join(" "),style:j,children:e.touched.slice(0,4).map(c=>(0,t.jsx)(R,{id:c,label:w.graph.has(c)?k(w,c):e.named?.[c]??k(w,c),go:M(c),testId:"activity-record"},c))})]},`change:${g}`))}):null,(0,t.jsx)(ie,{style:{paddingTop:8,borderTop:"1px solid var(--graview-edge)"}}),o?(0,t.jsxs)("div",{"data-testid":"remembered",style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:10,paddingTop:8,borderTop:"1px solid var(--graview-edge)",fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:[(0,t.jsx)("span",{children:"Remembered in this browser"}),(0,t.jsx)(xe,{})]}):null]})}function $e({calls:n,seat:a,remembers:o=!1}){let i=de(),s=E(),l=ae();return{has:!(a===void 0&&n.length===0&&i.length===0&&s.length===0&&!o&&l===0),recent:i.length,running:n.some(d=>d.phase==="running")}}export{E as a,he as b,$ as c,Ee as d,$e as e};
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as N,g as ae,h as ie}from"./chunk.IPGLITWA.js";import{a as S,b as T,c as A,d as j}from"./chunk.U5P23GO7.js";import{a as R}from"./chunk.DCLF4WWZ.js";import{a as Z,b as ee,c as te}from"./chunk.XDZDNZ7B.js";import{b as k}from"./chunk.E423JCOS.js";import{a as ne}from"./chunk.LOKGUALC.js";import{a as C}from"./chunk.TFJA4QV4.js";import{m as Q}from"./chunk.H3IGXHZR.js";import{G,J as _,La as K,R as H,S as z,W as X,ea as b,oa as J}from"./chunk.3VEZ5MOC.js";import{a as Y}from"./chunk.SDO3U72B.js";import{Ce as U,Jb as x,eb as q,fb as B,ga as V,la as P}from"./chunk.6AANHELP.js";import{b as D}from"./chunk.AJZBJBMO.js";var u=D(G(),1);var oe=D(G(),1);function E(){let{ai:n,aiDesk:a}=b(),{entries:o}=_(a),i=n.off===!0;return(0,oe.useEffect)(()=>{i||a.load()},[a,i]),i?[]:o}var t=D(X(),1),se=K(Y(()=>(__graviewPreload(import.meta.url,["./chunk.BPNW5KCP.js","./chunk.U5P23GO7.js","./chunk.YL2RBZFE.js","./chunk.H3IGXHZR.js","./chunk.7TDML5YU.js","./chunk.3VEZ5MOC.js","./chunk.SDO3U72B.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.SUG6LIOX.js")))),he=se.part((n,a)=>(0,t.jsx)(n.InteractionRow,{...a}),{quiet:!0,as:"li"}),ye=se.part((n,a)=>(0,t.jsx)(n.ActivityFilter,{...a}),{quiet:!0,as:"div"}),fe=n=>n.undoes===void 0&&n.primitives.some(a=>a.op==="remove-node"||a.op==="patch-node"&&a.after[B]===!0&&a.before[B]!==!0);function ve(n){let a=[...new Set(n.ops.filter(o=>!x(o)&&fe(o)).map(o=>o.intent))].filter(o=>o!==n.intent);return a.length===0?n.intent:`${n.intent} \u2014 ${a.join("; ")}`}var re=(n,a,o=le(n,[a]))=>({intent:ve(a),author:a.author.kind,...a.author.id?{authorId:a.author.id}:{},by:a.author,...a.ops[0]?.via?{via:a.ops[0].via}:{},...a.lineage?{basis:ne(a.lineage)}:{},touched:[...new Set(a.ops.filter(i=>!x(i)).flatMap(i=>i.writes))],...me(a.ops.filter(i=>!x(i)).flatMap(i=>i.writes),o),batch:a.id,at:a.at,...a.lineage?.interaction?{interaction:a.lineage.interaction}:{},seq:a.ops.at(-1).seq+1,...a.ops.every(x)?{withheld:!0}:{}});function de(n=4){let{store:a,principal:o}=b(),i=z(a,o),s=i.log.length;return(0,u.useMemo)(()=>{let l=i.batches(),d=le(i,l);return ee(l,r=>i.log.get(r)).reverse().slice(0,n).map(r=>{if("batch"in r){let p=re(i,r.batch,d);return r.typed?{...p,intent:Z(r.typed,i.schema,i.graph),batches:r.typed.batches.filter(v=>!v.undone).map(v=>v.id)}:p}let h=[...r.digest.batches].reverse().map(p=>re(i,p,d));return{intent:te(r.digest),author:r.digest.author.kind,...r.digest.author.id?{authorId:r.digest.author.id}:{},by:r.digest.author,touched:[...new Set(h.flatMap(p=>p.touched))],batch:"",...h[0]?.at?{at:h[0].at}:{},seq:h[0]?.seq??0,digest:h}})},[i,s,n])}function le(n,a){let o=new Map;for(let i of a)for(let s of i.ops)if(!x(s))for(let l of s.primitives)(l.op==="add-node"||l.op==="remove-node")&&l.node&&o.set(l.node.id,P(n.schema.tryDefinition(l.node.kind),l.node));return o}function me(n,a){let o={};for(let i of n){let s=a.get(i);s!==void 0&&(o[i]=s)}return Object.keys(o).length>0?{named:o}:{}}function we({change:n}){let{store:a,principal:o,seats:i,people:s}=b();return(0,t.jsxs)("strong",{style:{fontWeight:600},children:[n.author==="human"&&n.by?.onBehalfOf===void 0&&(n.authorId===void 0||o.id===void 0||n.authorId===o.id)?"you":q(n.by??{kind:n.author,id:n.authorId},{graph:a.graph,schema:a.schema,seats:i,people:s}),C(n.via)?(0,t.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",C(n.via)]}):null]})}function be({change:n,goes:a}){let{store:o}=b(),[i,s]=(0,u.useState)(!1),l=n.digest??[];return(0,t.jsxs)("li",{"data-testid":"activity-digest",style:{...S,gap:5},children:[(0,t.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,t.jsxs)("span",{"data-graview-activity-words":"",style:A,children:[(0,t.jsx)(we,{change:n})," ",(0,t.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:n.intent})]}),(0,t.jsx)("button",{type:"button","data-testid":"digest-toggle","aria-expanded":i,onClick:()=>s(d=>!d),style:{marginLeft:"auto",flex:"0 0 auto",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem"},children:i?"Hide":"Show each"})]}),i?(0,t.jsx)("ol",{"data-testid":"digest-changes",style:{margin:0,padding:"0 0 0 10px",listStyle:"none",display:"grid",gap:6,borderLeft:"1px solid var(--graview-edge)"},children:l.map(d=>(0,t.jsxs)("li",{"data-testid":"digest-change",style:S,children:[(0,t.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,t.jsxs)("span",{"data-graview-activity-words":"",style:A,children:[(0,t.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:d.intent}),d.basis?(0,t.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",d.basis]}):null]}),d.withheld?null:(0,t.jsx)($,{batch:d.batch})]}),d.touched.length>0?(0,t.jsx)("div",{"data-touched":d.touched.join(" "),style:j,children:d.touched.slice(0,4).map(r=>(0,t.jsx)(R,{id:r,label:o.graph.has(r)?k(o,r):d.named?.[r]??k(o,r),go:a(r),testId:"activity-record"},r))}):null]},d.batch))}):null]})}function $({batch:n}){let{store:a,principal:o,noteSeat:i}=b(),s=z(a,o),l=H()?.open??!1,d=s.log.length,[r,h]=(0,u.useState)(null),p=(0,u.useMemo)(()=>s.canUndo(n),[s,n,d]),v=(0,u.useMemo)(()=>p.ok?s.mayUndo(n,o):{ok:!0},[s,n,d,o,p]);if(l||!p.ok&&p.ops.length===0||!v.ok)return null;let m=!p.ok,W=m?p.includeBatches:[];return(0,t.jsxs)("span",{style:{marginLeft:"auto",flex:"0 0 auto",display:"grid",justifyItems:"end",gap:2},children:[(0,t.jsx)("button",{type:"button","data-testid":"undo-turn",title:m?`${p.message} \u2014 undo those too`:"Take this back, keeping everything since",onClick:()=>{h(null);try{let y=typeof n=="string"?[n]:n,L=s.log.all().find(I=>y.includes(I.batch)&&I.author.kind==="agent");s.undo(m?[...y,...W]:typeof n=="string"?n:[...n],{author:o}),L&&i({type:"home",author:L.author})}catch(y){h(y instanceof Error?y.message:String(y))}},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem",...m?{borderColor:"var(--graview-warn)",color:"var(--graview-warn)"}:{}},children:m?`undo +${W.length}`:"undo"}),r?(0,t.jsx)("span",{"data-testid":"undo-refused",role:"alert",style:{fontSize:"0.75rem",lineHeight:1.4,color:"var(--graview-warn)",maxWidth:260,textAlign:"right"},children:r}):null]})}function ke({seq:n,intent:a}){let o=H();if(!o)return null;let i=o.past?.seq===n;return(0,t.jsx)("button",{type:"button","data-testid":"show-past","aria-label":`Show the app as it was after \u201C${a}\u201D`,title:"Show the app as it was here","aria-pressed":i,onPointerEnter:N,onFocus:N,onClick:()=>o.show(n),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minHeight:24,minWidth:24,padding:"1px 6px",fontSize:"0.75rem",flex:"0 0 auto"},children:(0,t.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M2.5 8 a5.5 5.5 0 1 0 1.6-3.9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,t.jsx)("path",{d:"M2 2.5 V5.5 H5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,t.jsx)("path",{d:"M8 5 V8 L10 9.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}function xe(){let n=()=>U(window.location.href);return(0,t.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:a=>{a.preventDefault(),window.location.assign(n())},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",textDecoration:"underline",textDecorationColor:"var(--graview-edge-bright)",textUnderlineOffset:3},children:"Start fresh"})}function Ee({calls:n,seat:a,remembers:o=!1,close:i,headed:s=!0}){let l=de(),{store:d,principal:r,seats:h,people:p}=b(),v=E(),[m,W]=(0,u.useState)("all"),[y,L]=(0,u.useState)(!1),I=e=>e!==void 0&&(e.id===r.id||e.onBehalfOf?.id===r.id)&&r.id!==void 0,pe=new Set(v.map(e=>e.id)),ge=l.filter(e=>!(e.interaction!==void 0&&pe.has(e.interaction))&&(!y||I(e.by))),ce=v.filter(e=>!y||I(e.by)).slice(0,4),O=[...m==="ai"?[]:ge.map(e=>({at:e.at??"",change:e})),...m==="changes"?[]:ce.map(e=>({at:e.at,entry:e}))].sort((e,f)=>e.at<f.at?1:e.at>f.at?-1:0),w=z(d,r),ue=J(),F=H(),M=e=>w.graph.has(e)?f=>{i(),F?.past&&F.show(null),ue.record(f)}:null;return(0,t.jsxs)(t.Fragment,{children:[s?(0,t.jsx)("h2",{style:{...Q,margin:0},children:"Activity"}):null,a!==void 0?(0,t.jsxs)("div",{"data-testid":"agent-seat-row",style:{display:"grid",gap:5,paddingBottom:n.length>0||O.length>0?9:0,...n.length>0||O.length>0?{borderBottom:"1px solid var(--graview-edge)"}:{}},children:[(0,t.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"The agent's seat"}),a]}):null,n.length>0?(0,t.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:7},children:n.slice(0,6).map((e,f)=>(0,t.jsxs)("li",{style:{...S,gap:2,fontSize:"0.8125rem"},children:[(0,t.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,t.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,flex:"0 0 auto",background:e.phase==="running"?"var(--graview-accent)":e.phase==="failed"?"var(--graview-warn)":"var(--graview-edge-bright)"}}),(0,t.jsxs)("span",{"data-graview-activity-words":"",style:{...A,color:"var(--graview-ink)"},children:[e.mutating?"changed":"read"," \xB7"," ",w.allMutations().find(g=>g.name===e.name)?.title??V(e.name)]})]}),!e.mutating&&e.reads&&e.reads.length>0?(0,t.jsxs)("div",{"data-testid":"activity-reads",style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:[[...new Set(e.reads)].slice(0,3).map(g=>(0,t.jsx)(R,{id:g,label:k(w,g),go:M(g),testId:"activity-record"},g)),new Set(e.reads).size>3?(0,t.jsxs)("span",{style:{color:"var(--graview-ink-muted)"},children:["+",new Set(e.reads).size-3]}):null]}):Object.values(e.args).some(g=>typeof g=="string")?(0,t.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:Object.entries(e.args).filter(g=>typeof g[1]=="string").slice(0,3).map(([g,c])=>(0,t.jsx)(R,{id:c,label:k(w,c),go:M(c),testId:"activity-record"},g))}):null,e.error?(0,t.jsx)("div",{style:{paddingLeft:12,color:"var(--graview-warn)"},children:e.error}):null]},`${e.at}:${f}`))}):null,v.length>0?(0,t.jsx)(u.Suspense,{fallback:null,children:(0,t.jsx)(ye,{shows:m,onShows:W,mine:y,onMine:L})}):null,O.length>0?(0,t.jsx)("ol",{"data-testid":"diff-log",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6,fontSize:"0.8125rem"},children:O.map(({change:e,entry:f},g)=>f!==void 0?(0,t.jsx)(u.Suspense,{fallback:null,children:(0,t.jsx)(he,{entry:f,undo:c=>(0,t.jsx)($,{batch:c})})},`ai:${f.id}`):e.digest?(0,t.jsx)(be,{change:e,goes:M},`digest:${e.digest[0]?.batch??g}`):e.withheld?(0,t.jsx)("li",{"data-testid":"withheld-change",style:S,children:(0,t.jsx)("span",{"data-touched":"",style:{...A,color:"var(--graview-ink-muted)",fontStyle:"italic"},children:e.intent})},`change:${g}`):(0,t.jsxs)("li",{"data-batch":e.batch,style:S,children:[(0,t.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,t.jsxs)("span",{"data-graview-activity-words":"",style:A,children:[(0,t.jsxs)("strong",{style:{fontWeight:600},children:[e.author==="human"&&e.by?.onBehalfOf===void 0&&(e.authorId===void 0||r.id===void 0||e.authorId===r.id)?"you":q(e.by??{kind:e.author,id:e.authorId},{graph:w.graph,schema:w.schema,seats:h,people:p}),C(e.via)?(0,t.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",C(e.via)]}):null]})," ",(0,t.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:e.intent}),e.basis?(0,t.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",e.basis]}):null]}),e.batch?(0,t.jsx)(ke,{seq:e.seq,intent:e.intent}):null,e.batch?(0,t.jsx)($,{batch:e.batches&&e.batches.length>0?e.batches.length===1?e.batches[0]:e.batches:e.batch}):null]}),(0,t.jsx)("div",{"data-touched":e.touched.join(" "),style:j,children:e.touched.slice(0,4).map(c=>(0,t.jsx)(R,{id:c,label:w.graph.has(c)?k(w,c):e.named?.[c]??k(w,c),go:M(c),testId:"activity-record"},c))})]},`change:${g}`))}):null,(0,t.jsx)(ie,{style:{paddingTop:8,borderTop:"1px solid var(--graview-edge)"}}),o?(0,t.jsxs)("div",{"data-testid":"remembered",style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:10,paddingTop:8,borderTop:"1px solid var(--graview-edge)",fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:[(0,t.jsx)("span",{children:"Remembered in this browser"}),(0,t.jsx)(xe,{})]}):null]})}function $e({calls:n,seat:a,remembers:o=!1}){let i=de(),s=E(),l=ae();return{has:!(a===void 0&&n.length===0&&i.length===0&&s.length===0&&!o&&l===0),recent:i.length,running:n.some(d=>d.phase==="running")}}export{E as a,he as b,$ as c,Ee as d,$e as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{t as P}from"./chunk.
|
|
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{t as P}from"./chunk.CFE3MHWZ.js";import{G as M,La as S,R as w,W as y,ea as m,fa as I,s as b,w as T,x as A}from"./chunk.3VEZ5MOC.js";import{a as p}from"./chunk.SDO3U72B.js";import{b as f}from"./chunk.AJZBJBMO.js";var C=f(M(),1),h=f(y(),1),x=S(p(()=>(__graviewPreload(import.meta.url,["./chunk.WV45KLXC.js","./chunk.H3IGXHZR.js","./chunk.7TDML5YU.js","./chunk.3VEZ5MOC.js","./chunk.SDO3U72B.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.5JKUT2OM.js")))),O=x.part((e,n)=>(0,h.jsx)(e.Timeline,{...n}),{what:"The timeline"}),q=()=>x.prefetch();function K({face:e}){return w()?.open?(0,h.jsx)(C.Suspense,{fallback:null,children:(0,h.jsx)(O,{face:e})}):null}var i=f(M(),1),u=f(y(),1),v=new WeakMap,D=e=>{let n=v.get(e);return n||v.set(e,n={ask:null,doors:[],listeners:new Set}),n},k=e=>{for(let n of e.listeners)n()};function g(e,n){let t=D(e);t.ask=n,k(t)}var N=S(p(()=>(__graviewPreload(import.meta.url,["./chunk.SS6KL5NT.js","./chunk.WV45KLXC.js","./chunk.2KCDLCB2.js","./chunk.UD7VLXPM.js","./chunk.3DEWQDP7.js","./chunk.H3IGXHZR.js","./chunk.7TDML5YU.js","./chunk.3VEZ5MOC.js","./chunk.SDO3U72B.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.F5GNNVSQ.js")))),B=N.part((e,n)=>{let t=e.NotifySheet;return(0,u.jsx)(t,{...n})},{what:"Notify me"}),W=N.part((e,n)=>{let t=e.NotifiedList;return(0,u.jsx)(t,{...n})},{quiet:!0}),E=(e,n)=>n===void 0&&(e.onBehalfOf??e).id!==void 0;function F(e,n,t){let c=d=>t.tryDefinition(d)?.noun??d.replace(/[-_]+/g," "),o=e.on!==void 0?e.on:e.about.length===1?e.about[0]:void 0;if(e.act!==void 0){let d=o!==void 0&&n(o)!==void 0?o:void 0;return{label:"Notify me when someone does this\u2026",choices:[{on:"act",act:e.act,...d!==void 0?{record:d}:{}},...d!==void 0?[{on:"act",act:e.act}]:[]]}}if(o===void 0)return null;let s=n(o);if(s!==void 0)return{label:"Notify me when this changes\u2026",choices:[{on:"changed",record:o},{on:"act",record:o},{on:"reaches",kind:s,condition:"",record:o}]};let r=b(o)!==null?[b(o)]:T(o)?A(o):[];if(r.length!==1||!t.kinds.includes(r[0]))return null;let l=r[0],a=c(l);return{label:`Notify me when ${/^[aeiou]/i.test(a)?"an":"a"} ${a} is added\u2026`,choices:[{on:"created",kind:l},{on:"changed",kind:l},{on:"reaches",kind:l,condition:""}]}}function L(){let{store:e,principal:n,subscriptions:t,signIn:c}=m(),o=E(n,c);return(0,i.useMemo)(()=>o?s=>{let r=F(s,a=>e.graph.getNode(a)?.kind,e.schema);return r?{id:"notify",items:[{id:"notify-me",label:r.label,run:()=>g(t,{choices:r.choices,returnTo:s.element??null})}],prepare:()=>N.prefetch()}:null}:null,[o,e,t])}var z=[];function U({children:e}){let n=L(),t=(0,i.useMemo)(()=>n?[n]:z,[n]);return(0,u.jsx)(P,{sections:t,children:e})}function V(){let{subscriptions:e}=m(),n=(0,i.useId)(),t=D(e);(0,i.useEffect)(()=>(t.doors.push(n),k(t),()=>{t.doors.splice(t.doors.indexOf(n),1),k(t)}),[t,n]);let c=(0,i.useMemo)(()=>r=>(t.listeners.add(r),()=>void t.listeners.delete(r)),[t]),o=(0,i.useSyncExternalStore)(c,()=>t.ask,()=>null),s=(0,i.useSyncExternalStore)(c,()=>t.doors[0]===n,()=>!1);return!o||!s?null:(0,u.jsx)(i.Suspense,{fallback:null,children:(0,u.jsx)(B,{ask:o,close:()=>g(e,null)})})}function X({choices:e,label:n="Notify me",style:t,className:c,testId:o="notify-me"}){let{principal:s,subscriptions:r,signIn:l}=m();return E(s,l)?(0,u.jsx)("button",{type:"button","data-testid":o,className:c,onClick:a=>g(r,{choices:e,returnTo:a.currentTarget}),style:t,children:n}):null}function G(){let e=I(),n=e?.subscriptions,t=e?(e.principal.onBehalfOf??e.principal).id:void 0,[c,o]=(0,i.useState)(0);return(0,i.useEffect)(()=>{if(t===void 0||!n)return;let s=!0,r=()=>void Promise.resolve(n.list(t)).then(a=>s&&o(a.length),()=>s&&o(0));r();let l=n.onChange?.(r);return()=>{s=!1,l?.()}},[n,t]),c}function Y({style:e}){return G()===0?null:(0,u.jsx)(i.Suspense,{fallback:null,children:(0,u.jsx)(W,{...e?{style:e}:{}})})}export{q as a,K as b,L as c,U as d,V as e,X as f,G as g,Y as h};
|