graview 0.1.70 → 0.1.72
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.2IOJNFCR.js +1 -0
- package/dist/preview/{chunk.I7CSRZC2.js → chunk.2Q4ZXP7P.js} +1 -1
- package/dist/preview/{chunk.O2XPLDMM.js → chunk.2TTKQAWQ.js} +1 -1
- package/dist/preview/chunk.2YSE3SQN.js +23 -0
- package/dist/preview/{chunk.NZFO6BM3.js → chunk.2ZPR6FRI.js} +1 -1
- package/dist/preview/chunk.3BE4SHZD.js +1 -0
- package/dist/preview/{chunk.QODVFVWE.js → chunk.43HWCHBN.js} +1 -1
- package/dist/preview/{chunk.QILGAV7H.js → chunk.45OLF6BK.js} +1 -1
- package/dist/preview/{chunk.NTAC5NNE.js → chunk.47QWCVZD.js} +1 -1
- package/dist/preview/{chunk.7HNMG6LG.js → chunk.4A7BRBEA.js} +1 -1
- package/dist/preview/chunk.4EPCI6VY.js +1 -0
- package/dist/preview/{chunk.OXXZGPJZ.js → chunk.4PB5UFUJ.js} +1 -1
- package/dist/preview/{chunk.SWY6DIE4.js → chunk.4TDYDIIM.js} +3 -3
- package/dist/preview/{chunk.6VG2LCES.js → chunk.4VX7GPFS.js} +1 -1
- package/dist/preview/{chunk.TUVPQLFL.js → chunk.523X2YEQ.js} +1 -1
- package/dist/preview/{chunk.CHG522KL.js → chunk.53GQQETN.js} +1 -1
- package/dist/preview/{chunk.NBB5ALVJ.js → chunk.5MKZTHU2.js} +1 -1
- package/dist/preview/chunk.5OS4SYHE.js +1 -0
- package/dist/preview/{chunk.ZTHZHBVN.js → chunk.5ZT4R227.js} +1 -1
- package/dist/preview/{chunk.RIP2SAQ5.js → chunk.65SI77M7.js} +1 -1
- package/dist/preview/chunk.6ESAFTWB.js +1 -0
- package/dist/preview/chunk.6GUIFP2A.js +1 -0
- package/dist/preview/{chunk.M3HLZX6Q.js → chunk.6GZYKHEN.js} +1 -1
- package/dist/preview/{chunk.UVMHC6VM.js → chunk.6YKKZI4H.js} +1 -1
- package/dist/preview/{chunk.BBLA4PSP.js → chunk.73RMM4W7.js} +1 -1
- package/dist/preview/chunk.7DCBIMOI.js +1 -0
- package/dist/preview/chunk.7JE3J7H4.js +1 -0
- package/dist/preview/{chunk.YTRUZ56A.js → chunk.7QGDWAHH.js} +1 -1
- package/dist/preview/{chunk.JEQ6CA5M.js → chunk.7VCYVCYM.js} +2 -2
- package/dist/preview/{chunk.X7HMTN3Z.js → chunk.A4TBVXHQ.js} +1 -1
- package/dist/preview/{chunk.J4NY2K2A.js → chunk.A6LJPXJ3.js} +1 -1
- package/dist/preview/chunk.AAPXF6NP.js +1 -0
- package/dist/preview/chunk.APUICV5Z.js +1 -0
- package/dist/preview/chunk.ASNVH2G4.js +25 -0
- package/dist/preview/{chunk.CM7EDQ4E.js → chunk.CJHCUHVN.js} +1 -1
- package/dist/preview/chunk.CUEPNS3Z.js +1 -0
- package/dist/preview/{chunk.U3CV227I.js → chunk.CUJRWBPX.js} +1 -1
- package/dist/preview/{chunk.7TZXDPPO.js → chunk.D5PW6YWF.js} +3 -3
- package/dist/preview/chunk.DCIYOZYP.js +1 -0
- package/dist/preview/chunk.DEBW4FH6.js +1 -0
- package/dist/preview/{chunk.MR776WQ2.js → chunk.DYPSFTRP.js} +1 -1
- package/dist/preview/{chunk.BBMX3IIO.js → chunk.E6QZUT4L.js} +1 -1
- package/dist/preview/chunk.E7QZZRAQ.js +17 -0
- package/dist/preview/chunk.EHCMBAZO.js +3 -0
- package/dist/preview/chunk.EXTD5JWD.js +1 -0
- package/dist/preview/{chunk.KOVTQCHX.js → chunk.EZF2T3XQ.js} +1 -1
- package/dist/preview/chunk.EZSST3IU.js +1 -0
- package/dist/preview/{chunk.DIVANC3G.js → chunk.F2BZ4SC4.js} +1 -1
- package/dist/preview/chunk.F2I7ERGM.js +1 -0
- package/dist/preview/{chunk.UWEFODVV.js → chunk.FCV3NX6L.js} +1 -1
- package/dist/preview/{chunk.NZ5TJKPT.js → chunk.FFTBUXKX.js} +2 -2
- package/dist/preview/chunk.FILBI7XA.js +1 -0
- package/dist/preview/{chunk.MGG5DH2S.js → chunk.FKSI5522.js} +1 -1
- package/dist/preview/{chunk.I3ADXJQW.js → chunk.FQ2QUDZS.js} +1 -1
- package/dist/preview/{chunk.A5ENJJZN.js → chunk.G2ZDDO3C.js} +1 -1
- package/dist/preview/{chunk.IPKODEOZ.js → chunk.GAVEWSXU.js} +1 -1
- package/dist/preview/chunk.GH6QX7JR.js +87 -0
- package/dist/preview/chunk.GMHBAS45.js +1 -0
- package/dist/preview/{chunk.YCMMATFK.js → chunk.GOVRX2YX.js} +1 -1
- package/dist/preview/chunk.GXK5PI7I.js +1 -0
- package/dist/preview/{chunk.RECTEAG4.js → chunk.GYP3EF6Z.js} +1 -1
- package/dist/preview/chunk.H2RVMT4Y.js +111 -0
- package/dist/preview/chunk.HCHGKI64.js +1 -0
- package/dist/preview/chunk.HE7SAJKZ.js +1 -0
- package/dist/preview/{chunk.WAIIXXVI.js → chunk.HIIYDKFC.js} +2 -2
- package/dist/preview/chunk.HPDUGKEF.js +32 -0
- package/dist/preview/{chunk.DGDOZHYK.js → chunk.HQRPOGTS.js} +1 -1
- package/dist/preview/chunk.HUJLELZ3.js +1 -0
- package/dist/preview/chunk.HVRUHRXR.js +1 -0
- package/dist/preview/{chunk.6KYTCEIH.js → chunk.I46VNAMS.js} +1 -1
- package/dist/preview/{chunk.QAERSZVB.js → chunk.ID4GOKT6.js} +1 -1
- package/dist/preview/{chunk.RJ7UV3XI.js → chunk.IZKCTF2R.js} +1 -1
- package/dist/preview/chunk.IZUAZ6EV.js +1 -0
- package/dist/preview/{chunk.ZIGW5VOT.js → chunk.J3CUBMUZ.js} +1 -1
- package/dist/preview/{chunk.3HFBHLXC.js → chunk.J4D4BIB4.js} +1 -1
- package/dist/preview/{chunk.IRPMGHZN.js → chunk.J7GH2CGV.js} +1 -1
- package/dist/preview/{chunk.SSHEFQ4R.js → chunk.JE4RBRKH.js} +1 -1
- package/dist/preview/{chunk.4BSEYZMS.js → chunk.JJSZLCNU.js} +1 -1
- package/dist/preview/{chunk.KV3N6VRG.js → chunk.JKX4J3KG.js} +1 -1
- package/dist/preview/{chunk.FUTSLXWN.js → chunk.JMXBMLKH.js} +1 -1
- package/dist/preview/chunk.JOB3EKS6.js +1 -0
- package/dist/preview/{chunk.5IM2X3VT.js → chunk.JP33TNCH.js} +1 -1
- package/dist/preview/{chunk.BZXJKWNI.js → chunk.K6EN2YR4.js} +1 -1
- package/dist/preview/chunk.K6YKXTKC.js +1 -0
- package/dist/preview/{chunk.A7JORJJL.js → chunk.KAIZDIRK.js} +1 -1
- package/dist/preview/{chunk.7LAXSQQY.js → chunk.KAQGSLC6.js} +3 -3
- package/dist/preview/{chunk.QG3LV4RH.js → chunk.KFYSKZC4.js} +1 -1
- package/dist/preview/{chunk.VBHV4TLG.js → chunk.KHRS2SKB.js} +1 -1
- package/dist/preview/chunk.KHVW6Q3T.js +1 -0
- package/dist/preview/chunk.KMFH26SS.js +1 -0
- package/dist/preview/{chunk.2T24FYAO.js → chunk.L3ST2YKI.js} +1 -1
- package/dist/preview/{chunk.HIJ72QX6.js → chunk.L6BLZJ6K.js} +1 -1
- package/dist/preview/{chunk.NCBUECIW.js → chunk.LG2BQ5LB.js} +1 -1
- package/dist/preview/{chunk.LZ3HO3HM.js → chunk.LLYHHG67.js} +1 -1
- package/dist/preview/{chunk.VKQONZKR.js → chunk.LPWANRBL.js} +1 -1
- package/dist/preview/{chunk.3MPLUSVY.js → chunk.LSS64NAA.js} +1 -1
- package/dist/preview/{chunk.SUYYDJGZ.js → chunk.MFNWHXGL.js} +1 -1
- package/dist/preview/{chunk.UJF6YTEO.js → chunk.MNH3WUAB.js} +1 -1
- package/dist/preview/chunk.MQ7AB5N4.js +1 -0
- package/dist/preview/{chunk.CZUUFO6A.js → chunk.MU5JK5TK.js} +1 -1
- package/dist/preview/{chunk.RXUL6P7Y.js → chunk.N5CACZ5F.js} +1 -1
- package/dist/preview/{chunk.S6IKR6RD.js → chunk.NFC2TYA6.js} +1 -1
- package/dist/preview/{chunk.TD2V74XU.js → chunk.NKRDVOLJ.js} +1 -1
- package/dist/preview/{chunk.SGYZM6ZU.js → chunk.NNK2E2EP.js} +1 -1
- package/dist/preview/{chunk.J65CZJIC.js → chunk.NVPKYWMF.js} +1 -1
- package/dist/preview/{chunk.DWMFLLJO.js → chunk.NWJ7ELHN.js} +1 -1
- package/dist/preview/{chunk.NKUNCQB3.js → chunk.O5P6LXHF.js} +1 -1
- package/dist/preview/{chunk.2MWEYNVH.js → chunk.OFK6673S.js} +1 -1
- package/dist/preview/{chunk.C4LC2UEU.js → chunk.OG6FEP3K.js} +1 -1
- package/dist/preview/{chunk.CZI6J5CE.js → chunk.OHGAZ3D5.js} +1 -1
- package/dist/preview/{chunk.XJ4JYROM.js → chunk.ONVYKLRX.js} +1 -1
- package/dist/preview/chunk.OQ3FKUP2.js +1 -0
- package/dist/preview/chunk.OUJV4CYS.js +1 -0
- package/dist/preview/{chunk.T552MHMU.js → chunk.OWHH7JDV.js} +1 -1
- package/dist/preview/{chunk.SCN6IYDG.js → chunk.OXDCGGZV.js} +1 -1
- package/dist/preview/{chunk.YIDNZTON.js → chunk.P3Z4ZCL3.js} +1 -1
- package/dist/preview/chunk.PF7XQ5R5.js +1 -0
- package/dist/preview/{chunk.FSZQTX3K.js → chunk.PGT4ZQDG.js} +4 -4
- package/dist/preview/chunk.PH547SON.js +1 -0
- package/dist/preview/chunk.PS765ODQ.js +3 -0
- package/dist/preview/{chunk.MZSWWMX6.js → chunk.PVAYYFT2.js} +1 -1
- package/dist/preview/{chunk.F5STM4DX.js → chunk.Q6WOIE5I.js} +1 -1
- package/dist/preview/{chunk.55C7WO4X.js → chunk.QE257AXE.js} +1 -1
- package/dist/preview/chunk.QKNC5OUC.js +1 -0
- package/dist/preview/chunk.QMGBAKX6.js +2 -0
- package/dist/preview/{chunk.4QBW46XV.js → chunk.QNFX5VHW.js} +1 -1
- package/dist/preview/chunk.QPCDAQTW.js +1 -0
- package/dist/preview/{chunk.TS5APXWC.js → chunk.QPTQIGLX.js} +1 -1
- package/dist/preview/{chunk.LZNHTROY.js → chunk.R5YGW5ZX.js} +1 -1
- package/dist/preview/{chunk.4VTUC5TF.js → chunk.RJ6KEVZC.js} +1 -1
- package/dist/preview/{chunk.6QMRDSTD.js → chunk.RKVMRP7B.js} +1 -1
- package/dist/preview/{chunk.YBQUP3KE.js → chunk.S7U2CHHG.js} +1 -1
- package/dist/preview/{chunk.CLJKQLK2.js → chunk.SD2UYSV6.js} +2 -2
- package/dist/preview/chunk.SI5GGFQR.js +1 -0
- package/dist/preview/{chunk.7QWGIGHM.js → chunk.SMF5S4DQ.js} +1 -1
- package/dist/preview/{chunk.LEZGBHPZ.js → chunk.SNDFIJVX.js} +1 -1
- package/dist/preview/{chunk.F5756PXX.js → chunk.STHWM422.js} +2 -2
- package/dist/preview/{chunk.JIEBGUCA.js → chunk.SV75TRCH.js} +1 -1
- package/dist/preview/{chunk.U2DZE7A5.js → chunk.SXGPRFA4.js} +1 -1
- package/dist/preview/{chunk.ZGJUCVT5.js → chunk.T3RFZ66S.js} +1 -1
- package/dist/preview/{chunk.I6HIVTXU.js → chunk.T6ISUVUP.js} +1 -1
- package/dist/preview/{chunk.R65YX332.js → chunk.TBLOBXZ2.js} +1 -1
- package/dist/preview/{chunk.CVVNHQPO.js → chunk.TDWJU6GW.js} +1 -1
- package/dist/preview/{chunk.2QALBEWP.js → chunk.THLT6NVO.js} +1 -1
- package/dist/preview/{chunk.7FTATAH2.js → chunk.TQCVEKPH.js} +1 -1
- package/dist/preview/{chunk.PAIBRJVZ.js → chunk.TQF5XCUS.js} +1 -1
- package/dist/preview/{chunk.F5XWYO5W.js → chunk.TRP66PHK.js} +1 -1
- package/dist/preview/chunk.TWXYI5AP.js +2 -0
- package/dist/preview/{chunk.IQCMV5WD.js → chunk.UOUQZYVD.js} +1 -1
- package/dist/preview/{chunk.FJXKQZZS.js → chunk.UPL3D3ZO.js} +1 -1
- package/dist/preview/{chunk.U5Q7EVZQ.js → chunk.UXW43HNW.js} +1 -1
- package/dist/preview/{chunk.ZOSTOVXR.js → chunk.V4GSVXSV.js} +1 -1
- package/dist/preview/chunk.VCEDSOAK.js +1 -0
- package/dist/preview/{chunk.4O3STSC4.js → chunk.VE4AQFLW.js} +1 -1
- package/dist/preview/{chunk.HMV4ILAC.js → chunk.VGQDPEB5.js} +1 -1
- package/dist/preview/{chunk.5A5DI36V.js → chunk.VMYXBFPE.js} +1 -1
- package/dist/preview/{chunk.BQWMHHAZ.js → chunk.VNI6HZEF.js} +2 -2
- package/dist/preview/chunk.VQRY2NQ6.js +1 -0
- package/dist/preview/{chunk.K6EKSURO.js → chunk.VUE6ILQV.js} +1 -1
- package/dist/preview/{chunk.3KF5RYPW.js → chunk.W2VSEEKX.js} +1 -1
- package/dist/preview/{chunk.KP7HUXH5.js → chunk.WAPY4RCS.js} +1 -1
- package/dist/preview/chunk.WFRSGGU5.js +1 -0
- package/dist/preview/{chunk.XAN7QXMQ.js → chunk.WIVNFOQR.js} +1 -1
- package/dist/preview/chunk.WRIBFLVG.js +1 -0
- package/dist/preview/{chunk.TVNY7F64.js → chunk.WWD2TS47.js} +1 -1
- package/dist/preview/{chunk.5W7EGQCQ.js → chunk.WWFOQDPR.js} +2 -2
- package/dist/preview/{chunk.FBDCHJS2.js → chunk.X45EITTK.js} +1 -1
- package/dist/preview/{chunk.5FQHZVE3.js → chunk.X5MCAUFX.js} +1 -1
- package/dist/preview/{chunk.IJVR7ZL7.js → chunk.XBWFQ54R.js} +1 -1
- package/dist/preview/{chunk.JPJHM62B.js → chunk.XMBGT6UT.js} +1 -1
- package/dist/preview/chunk.XP4IVKKR.js +1 -0
- package/dist/preview/chunk.XYBWBMNU.js +1 -0
- package/dist/preview/{chunk.MYR36HW4.js → chunk.YC2IDHQX.js} +1 -1
- package/dist/preview/{chunk.ZQSV5XVB.js → chunk.YCYJHPWS.js} +1 -1
- package/dist/preview/{chunk.BJ3G7J2Z.js → chunk.YF5GCOSZ.js} +3 -2
- package/dist/preview/{chunk.3I2SGKKF.js → chunk.YGGBGHZU.js} +1 -1
- package/dist/preview/chunk.YRC6PKXP.js +1 -0
- package/dist/preview/{chunk.6NYSB6OZ.js → chunk.YRN67Z5K.js} +1 -1
- package/dist/preview/chunk.ZDUKVXBI.js +5 -0
- package/dist/preview/index.html +55 -55
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.2QOB62XU.js +0 -1
- package/dist/preview/chunk.36FKQJFM.js +0 -2
- package/dist/preview/chunk.3A3DCALP.js +0 -1
- package/dist/preview/chunk.3GPYKWAD.js +0 -1
- package/dist/preview/chunk.3QPMFUMV.js +0 -1
- package/dist/preview/chunk.3ZP6IDUC.js +0 -1
- package/dist/preview/chunk.53HW224Y.js +0 -1
- package/dist/preview/chunk.AW74DZ5V.js +0 -17
- package/dist/preview/chunk.C67TMA4U.js +0 -111
- package/dist/preview/chunk.CCCSZRKU.js +0 -1
- package/dist/preview/chunk.CUA7F3YJ.js +0 -25
- package/dist/preview/chunk.DBSSCJQM.js +0 -1
- package/dist/preview/chunk.DW6KXAUM.js +0 -1
- package/dist/preview/chunk.DWPM7AWA.js +0 -1
- package/dist/preview/chunk.FXCKKVT5.js +0 -1
- package/dist/preview/chunk.HHQUCFN4.js +0 -1
- package/dist/preview/chunk.HPWMCS3H.js +0 -23
- package/dist/preview/chunk.HRLCDBMO.js +0 -1
- package/dist/preview/chunk.I7ODVOO5.js +0 -1
- package/dist/preview/chunk.IANOWT3Z.js +0 -1
- package/dist/preview/chunk.IFPJPJ4M.js +0 -1
- package/dist/preview/chunk.IUVRJDL3.js +0 -5
- package/dist/preview/chunk.J4CSY2D5.js +0 -2
- package/dist/preview/chunk.JJIKTTXB.js +0 -1
- package/dist/preview/chunk.KDOJC4FX.js +0 -1
- package/dist/preview/chunk.KJAOJTZZ.js +0 -1
- package/dist/preview/chunk.KLZPUTMU.js +0 -1
- package/dist/preview/chunk.LQ2PDW2M.js +0 -32
- package/dist/preview/chunk.M7DJJRFH.js +0 -1
- package/dist/preview/chunk.MNWP3TPN.js +0 -1
- package/dist/preview/chunk.MSWOETXN.js +0 -1
- package/dist/preview/chunk.NILR2BWR.js +0 -1
- package/dist/preview/chunk.NNYKLENL.js +0 -1
- package/dist/preview/chunk.PYGNO2AV.js +0 -87
- package/dist/preview/chunk.PZHCWMKT.js +0 -1
- package/dist/preview/chunk.QQUZ5RTQ.js +0 -1
- package/dist/preview/chunk.QVID5WHS.js +0 -1
- package/dist/preview/chunk.RHV73CBA.js +0 -3
- package/dist/preview/chunk.RP6C2IUM.js +0 -1
- package/dist/preview/chunk.RPHZY7N4.js +0 -1
- package/dist/preview/chunk.RSMCTI2N.js +0 -1
- package/dist/preview/chunk.S4QSZRKH.js +0 -1
- package/dist/preview/chunk.T4QRIJE4.js +0 -1
- package/dist/preview/chunk.UJM5EZDM.js +0 -3
- package/dist/preview/chunk.UJPX3BUV.js +0 -1
- package/dist/preview/chunk.UYBSVE2W.js +0 -1
- package/dist/preview/chunk.WMZ2BINI.js +0 -1
- package/dist/preview/chunk.X2RHBTJI.js +0 -1
- package/dist/preview/chunk.X3FPVFFB.js +0 -1
- package/dist/preview/chunk.X4PFLIXB.js +0 -1
- package/dist/preview/chunk.YR7DKU5T.js +0 -1
- package/dist/preview/chunk.ZBK3FCVE.js +0 -1
- package/dist/preview/chunk.ZH5L746C.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ot}from"./chunk.T6PU3NKP.js";import"./chunk.FUTSLXWN.js";import{e as V,l as ue,n as G,r as st}from"./chunk.MZSWWMX6.js";import{a as ee}from"./chunk.G4JJXA63.js";import"./chunk.5IM2X3VT.js";import{c as nt}from"./chunk.NKUNCQB3.js";import{d as tt}from"./chunk.XJ4JYROM.js";import"./chunk.XOZU4OFA.js";import"./chunk.CHG522KL.js";import"./chunk.MR776WQ2.js";import"./chunk.ZGJUCVT5.js";import"./chunk.CVVNHQPO.js";import{d as et}from"./chunk.YIDNZTON.js";import{b as Ze}from"./chunk.QILGAV7H.js";import"./chunk.I6HIVTXU.js";import{Gb as Ve,Hb as Qe,L as ze,_ as Je,de as Ne,ee as Xe,ma as Ye,pa as qe,ua as Ae,va as F}from"./chunk.IUVRJDL3.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.JMXBMLKH.js";import{e as V,l as ue,n as G,r as st}from"./chunk.PVAYYFT2.js";import{a as ee}from"./chunk.G4JJXA63.js";import"./chunk.JP33TNCH.js";import{c as nt}from"./chunk.O5P6LXHF.js";import{d as tt}from"./chunk.ONVYKLRX.js";import"./chunk.XOZU4OFA.js";import"./chunk.53GQQETN.js";import"./chunk.DYPSFTRP.js";import"./chunk.T3RFZ66S.js";import"./chunk.TDWJU6GW.js";import{d as et}from"./chunk.P3Z4ZCL3.js";import{b as Ze}from"./chunk.45OLF6BK.js";import"./chunk.T6ISUVUP.js";import{Gb as Ve,Hb as Qe,L as ze,_ as Je,de as Ne,ee as Xe,ma as Ye,pa as qe,ua as Ae,va as F}from"./chunk.ZDUKVXBI.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
|
-
import{G as g,U as y,
|
|
1
|
+
import{G as g,U as y,ia as m,sa as d}from"./chunk.ASNVH2G4.js";import{b as S}from"./chunk.AJZBJBMO.js";var v=S(g(),1);function k(){let{store:w,principal:a,ai:n,aiDesk:r,seatTalk:i,views:p,app:t,brand:l,view:A,selection:s}=m(),e=y(w,a),c=d(),o=A.within?.view;return(0,v.useMemo)(()=>({store:e,principal:a,ai:n,desk:r,seatTalk:i,goTo:c,places:[...p.places()],app:t??{name:l?.name??"app",schema:e.schema,...e.policy?{policy:e.policy}:{}},...o?{place:o}:{},selection:s}),[e,a,n,r,i,c,p,t,l,o,s])}export{k as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as D,c as L}from"./chunk.
|
|
1
|
+
import{a as D,c as L}from"./chunk.KFYSKZC4.js";import{a as R,g as T,h as W,i as I,j as K}from"./chunk.M5FP4Y4Q.js";import{de as N,te as j}from"./chunk.ZDUKVXBI.js";var J=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),G=e=>e?._zod?.def;function S(e){let t=G(e);for(;t&&(t.type==="optional"||t.type==="default"||t.type==="nullable"||t.type==="prefault");)t=G(t.innerType);return t}function q(e){if(e?.type==="boolean")return["true","false"];if(e?.type==="array"&&(e=S(e.element)),e?.type==="enum")return(e.entries?Object.values(e.entries):e.values??[]).filter(t=>typeof t=="string")}var A=e=>e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[-_]/g," ").replace(/^./,t=>t.toUpperCase());function _(e,t,s){let d=e.tryDefinition(t);if(!d)return[];let c=new Set(d.display?.hide??[]),a=[];for(let[l,o]of Object.entries(d.fields.shape??{})){if(l==="id"||l==="kind"||l==="label"||c.has(l))continue;let i=S(o);if(i?.type==="array"||i?.type==="object"||i?.type==="record")continue;let f=q(i);a.push({key:l,label:A(l),...f?{options:f}:{}})}let g=new Map;for(let[l,o]of Object.entries(d.edges??{}))g.set(l,o.to==="*"?[]:[...o.to]);for(let l of e.definitions)if(l.kind!==t)for(let[o,i]of Object.entries(l.edges??{}))!g.has(o)&&(i.to==="*"||i.to.includes(t))&&g.set(o,[l.kind]);let u=[];for(let[l,o]of g){a.push({key:l,label:A(l)});let i=s&&o.length===1&&o[0]!==t?e.tryDefinition(o[0]):void 0;for(let[f,p]of Object.entries(i?.fields.shape??{})){let y=S(p);y?.type==="enum"&&!i?.display?.hide?.includes(f)&&u.push({key:`${l}.${f}`,label:`${A(l)} \xB7 ${A(f)}`,options:q(y)})}}return a.push(...u),a.push({key:"is",label:"Is",options:d.lifecycle?["current","past","any","flagged","clear"]:["flagged","clear"]}),a}var C=e=>e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function F(e,t,s,d={}){if(s==null)return{ok:!0};if(!J(s))return{ok:!1,says:'A filter is an object of a field and the value it keeps, like { where: { stage: "building" } }.'};let c=Object.entries(s);if(c.length===0)return{ok:!0};let a=[];for(let o of t)for(let i of _(e,o,d.through===!0))a.some(f=>f.key===i.key)||a.push(i);let g=t[0]?e.tryDefinition(t[0]):void 0,u=g?g.plural??`${A(g.kind)}s`:"These",l=[];for(let[o,i]of c){let f=a.find(y=>y.key===o);if(!f)return{ok:!1,says:`${u.replace(/^./,y=>y.toUpperCase())} have no field "${o}" to filter by${a.length>0?`; they filter by ${C(a.map(y=>y.key))}`:""}.`};if(typeof i!="string"&&typeof i!="number"&&typeof i!="boolean")return{ok:!1,says:`The filter on "${o}" is ${Array.isArray(i)?"a list":i===null?"null":`a ${typeof i}`}; it keeps one value: a word, a number, or true or false.`};let p=String(i);if(p.trim().length===0)return{ok:!1,says:`The filter on "${o}" keeps nothing; give it a value, or leave "${o}" out.`};if(p.includes(","))return{ok:!1,says:`The filter on "${o}" holds a comma, which an address reads as a second filter; keep one value.`};if(f.options&&f.options.length>0&&!f.options.includes(p))return{ok:!1,says:`${f.label} has no choice "${p}"; its choices are ${C(f.options.map(y=>`"${y}"`))}.`};l.push(`${o}:${p}`)}return{ok:!0,filter:l.join(",")}}var U=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");function V(e,t){let s=e.find(a=>a.as===t);if(s)return s;let d=t.trim().toLowerCase(),c=U(t);return e.find(a=>a.title!==void 0&&a.title.trim().toLowerCase()===d)??(c?e.find(a=>a.as===c||a.title!==void 0&&U(a.title)===c):void 0)}function ee(e){let t=[];for(let s of e){if(typeof s!="object"||s===null)continue;let{as:d,slug:c,title:a,kind:g}=s,u=typeof d=="string"&&d.length>0?d:typeof c=="string"&&c.length>0?c:void 0;!u||t.some(l=>l.as===u)||t.push({as:u,title:typeof a=="string"?a:u,kind:typeof g=="string"?g:""})}return t}var M=e=>` Its places: ${e.map(t=>typeof t=="string"?`"${t}"`:t.title&&t.title!==t.as?`"${t.as}" (${t.title})`:`"${t.as}"`).join(", ")||"none"}.`,ne=" This run was not handed the views the host keeps, so a titled view's place is not among these: if it names one, the link goes there.",m=e=>`"${e.length>80?`${e.slice(0,79)}\u2026`:e}"`,O=(e,t)=>`${"place"in e?`The place ${m(e.place)}`:`${m(e.record)} is no record this viewer may see and`} is no place of this app: it goes nowhere.${M(t)}`;function E(e){let t={};for(let s of e.split(",")){let d=s.indexOf(":");d>0&&(t[s.slice(0,d).trim()]=s.slice(d+1).trim())}return t}function le(e,t=new Set){return e.kinds.filter(s=>!t.has(s)).map(s=>({slug:N(e,s).slice(1),kind:s}))}function de(e,t,s={}){let d=[],c;for(let g of t){if(typeof g!="object"||g===null)continue;let{as:u,slug:l,title:o,kind:i,over:f,hidden:p,name:y}=g,h=typeof u=="string"&&u.length>0?u:typeof l=="string"&&l.length>0?l:void 0;if(h){if(typeof i!="string"||i.length===0){h===j&&typeof o=="string"&&o.length>0&&(c=o);continue}d.push({kind:i,title:typeof o=="string"&&o.length>0?o:h,as:h,...Array.isArray(f)&&f.every(n=>typeof n=="string")?{over:f}:{},...p===!0?{hidden:!0}:{},...typeof y=="string"?{name:y}:{}})}}let a=s.pages??(c!==void 0?{scene:c}:void 0);return L(e,d,{...a?{pages:a}:{},...s.kept?{kept:s.kept}:{}})}var H=(e,t)=>e.find(s=>s.is==="list"&&(s.as===t||s.kind===t));function Z(e,t){let s=t.places.filter((r,k,w)=>r.is!=="list"&&w.findIndex(b=>b.as===r.as)===k),d=[...new Set(t.places.map(r=>r.as))],c=[...new Set([...t.places.filter(r=>r.is==="list").map(r=>r.as),...t.lists.map(r=>r.slug).filter(r=>!d.includes(r))])],a;if(e.section!==void 0&&e.section!==null){if(typeof e.section!="string"||D(e.section).length===0||e.section.length>120)return{ok:!1,says:`The section ${typeof e.section=="string"?m(e.section):"asked for"} names nothing on a page: a section is a heading's words or an element's id, like "shipping-soon". It goes nowhere.`};a=e.section}let g=a!==void 0?{section:a}:{};if("record"in e&&t.sees(e.record))return e.where!==void 0&&e.where!==null?{ok:!1,says:`${m(e.record)} is one record, and a filter narrows a list or a place: it goes nowhere. Go to { place, where } for a list narrowed.`}:{ok:!0,arrival:{record:e.record,...g}};let u="place"in e?e.place:e.record,l=V(t.places,u),o=l?.is==="list"?void 0:l,i=o?void 0:l?.is==="list"?l:H(t.places,u),f=o||i?void 0:t.lists.find(r=>r.slug===u||r.kind===u),p=i?i.kind??void 0:f?.kind;if(!o&&p===void 0)return{ok:!1,says:`${O(e,s)}${B(c)}`};let y=o?o.kind?[o.kind]:[]:[p],h;if(e.where!==void 0&&e.where!==null){if(!t.schema||y.length===0)return{ok:!1,says:`The place ${m(u)} cannot be narrowed here: it goes nowhere.`};let r=F(t.schema,y,e.where,{through:p!==void 0});if(!r.ok)return{ok:!1,says:`The filter on ${m(u)} goes nowhere: ${r.says}`};h=r.filter}let n=h?{filter:h}:{};return{ok:!0,arrival:o?{place:o.as,...n,...g}:{list:p,...n,...g}}}var B=e=>e.length===0?"":` Its lists: ${e.slice(0,8).map(t=>`"${t}"`).join(", ")}${e.length>8?` and ${e.length-8} more`:""}.`,z="http://www.w3.org/1999/xhtml",Q="http://www.w3.org/2000/svg",X=e=>{let t=e;return t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||e.type==="click"&&typeof t.button=="number"&&t.button!==0};function fe(e){let t=new WeakSet,s=new WeakSet,d=new WeakMap,c=new WeakMap,a=n=>Z(n,{sees:e.sees,places:e.places(),lists:e.lists?.()??[],...e.schema?{schema:e.schema}:{}}),g=n=>{let r=a(n);return r.ok?e.onNavigate?.(r.arrival):e.onLost?.(r.says),r.ok},u=n=>{let r=n.getAttribute("data-record"),k=n.getAttribute("data-place"),w=n.getAttribute("data-filter"),b=n.getAttribute("data-section"),v={...w?{where:E(w)}:{},...b?{section:b}:{}};if(r)return{record:r,...v};if(k)return{place:k,...v}},l=n=>{if(!e.hrefOf)return;let r=u(n),k=r?a(r):void 0;return k?.ok?e.hrefOf(k.arrival):void 0},o=n=>n.hasAttribute("tabindex")?!1:(n.setAttribute("tabindex","0"),t.add(n),!0),i=n=>{t.delete(n)&&n.removeAttribute("tabindex")},f=n=>{s.delete(n)&&n.getAttribute("role")==="link"&&n.removeAttribute("role")},p=n=>{let r=d.get(n);r&&(d.delete(n),n.getAttribute("href")===r.href&&n.removeAttribute("href"),r.target!==null&&!n.hasAttribute("target")&&n.setAttribute("target",r.target))},y=n=>{let r=c.get(n);r&&(c.delete(n),i(r))},h={link(n){if(!W(n,[...n.querySelectorAll("input, select, textarea")].some(R))){if(!n.hasAttribute("data-graview-link"))return;n.removeAttribute("data-graview-link"),f(n),i(n),p(n),y(n);return}n.hasAttribute("data-graview-link")||n.setAttribute("data-graview-link","");let k=n.localName==="a"&&(n.namespaceURI===z||n.namespaceURI===Q),w=n.getAttribute("href"),b=d.get(n),v=w!==null&&b?.href!==w,$=k&&!v?l(n):void 0;if($!==void 0){w!==$&&n.setAttribute("href",$),d.set(n,{href:$,target:b?b.target:n.getAttribute("target")}),n.removeAttribute("target"),f(n),i(n);return}if(v?d.delete(n):p(n),I(n,n.querySelectorAll("a"))){f(n),i(n),y(n);return}if(!n.hasAttribute("role")&&(k||T(n))&&(n.setAttribute("role","link"),s.add(n)),n.localName==="tr"&&n.namespaceURI===z){i(n);let x=[...n.children].find(P=>P.localName==="td"||P.localName==="th");c.get(n)!==x&&y(n),x&&!c.has(n)&&o(x)&&c.set(n,x);return}n.localName!=="button"&&o(n)},refresh(n){for(let r of n.querySelectorAll("[data-record], [data-place], [data-graview-link]"))h.link(r)},pressed(n,r,k){if(n.type!=="click"&&!(n.type==="keydown"&&n.key==="Enter"))return!1;let w=K(r,k,b=>b.hasAttribute("data-graview-link"));return w?(n.stopPropagation(),d.has(w)&&X(n)||(n.preventDefault(),h.follow(w)),!0):!1},follow(n){let r=u(n);r&&g(r)},go:g};return h}export{V as a,ee as b,M as c,ne as d,m as e,O as f,E as g,le as h,de as i,Z as j,fe as k};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as fe,b as Ne,d as Ze,e as He,f as he,g as F,h as ke,j as We}from"./chunk.GXK5PI7I.js";import{h as Je,i as Xe,j as Qe}from"./chunk.XP4IVKKR.js";import{a as ae,b as ce,c as J,d as Ye,e as ee,g as se,h as en}from"./chunk.QMGBAKX6.js";import{f as Be,k,l as Ue,m as ze,w as ye}from"./chunk.PS765ODQ.js";import{A as re,Ja as Ie,Qa as Ke,Ra as Q,Rd as qe,Sa as me,Sd as Ve,b as Z,c as U,e as ue,f as Me,g as P,h as v,k as L,l as X,m as I,n as _e,o as H,p as N,r as $,s as oe,sc as Pe,t as R,tc as ge,u as j,uc as Le,v as G,vc as Ge,w as T,wc as Ce,x as n,y as M,z as Y}from"./chunk.ZDUKVXBI.js";var be=e=>Object.entries(e).map(([s,r])=>[s,Object.keys(Q(r?.edges))]),$e=(e,s)=>Le(e,be(s));function nn(e){return[...Object.keys(e.acts??{}),...Object.keys(e.kinds).flatMap(s=>Pe(s)),...Ge(be(e.kinds))]}var B=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function tn(e){if(!B(e)||!B(e.kinds))return e;let s;try{let f=Object.fromEntries(Object.entries(e.kinds).map(([g,c])=>[g,B(c)&&B(c.edges)?{edges:c.edges}:{}]));s=nn({acts:B(e.acts)?e.acts:{},kinds:f})}catch{return e}let r=new Set(s),t=!1,o=f=>{if(typeof f!="string"||r.has(f))return f;let g=qe(f,s);return g===void 0?f:(t=!0,g)},a=B(e.policy)&&Array.isArray(e.policy.grants)?{...e.policy,grants:e.policy.grants.map(f=>B(f)&&Array.isArray(f.mutations)?{...f,mutations:f.mutations.map(o)}:f)}:void 0,u=B(e.rules)?Object.fromEntries(Object.entries(e.rules).map(([f,g])=>[f,B(g)&&Array.isArray(g.repairs)?{...g,repairs:g.repairs.map(c=>B(c)?{...c,act:o(c.act)}:c)}:g])):void 0;return t?{...e,...a?{policy:a}:{},...u?{rules:u}:{}}:e}function we(e,s){let r=Ve(e,nn(s));return r&&r!==e?`did you mean "${r}"?`:void 0}var Oe="graview-document",je=1,xe=256*1024,ne=64*1024,vn=["plain","editorial","shader","ascii"];var Se=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ve=/^[a-z][A-Za-z0-9]*$/,On=/^[a-z0-9\u00df-\u00ff'-]+( [a-z0-9\u00df-\u00ff'-]+){0,2}$/,on=12,sn=60,jn=new Set(["id","kind"]),xn=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,An=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"];function En(){let e=h=>h in Object.prototype,s=Y(h=>!e(h),"every object already has this name \u2014 choose another"),r=(h,D)=>[...h===void 0?[]:[Me(h)],...D===void 0?[]:[ue(D)]],t=(h,D)=>v().check(...r(h,D)),o=(h,D,te)=>N(h).check(...r(D,te)),a=h=>v().check(P(Se,`${h} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),u=v().check(P(xn,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),s),f=v().check(P(ve,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),Y(h=>!jn.has(h),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),s),g=t(1,500),c=v().check(ue(40),P(On,'an alias is up to three lower-case words, like "supplier"')),i=t(1,2e3),p=t(1,300),y=$({type:G(An),required:n(I()),description:n(g),label:n(t(1,60)),aliases:n(o(c,1,on)),options:n(o(t(1,80),1,100)),multiple:n(I()),optionLabels:n(j(t(1,80),t(1,80))),of:n(G(["string","number","date","image","video","file"])),default:n(H()),unit:n(t(void 0,12)),format:n(G(["money","percent","duration","markdown"])),places:n(T(0)),min:n(L()),max:n(L()),step:n(L()),renamedFrom:n(v().check(P(ve))),repeats:n(I()),collaborative:n(I())}).check(re((h,D)=>{h.type==="enum"&&!h.options&&D.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),h.type!=="enum"&&h.options&&D.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]}),h.type!=="enum"&&h.multiple!==void 0&&D.addIssue({code:"custom",message:'"multiple" belongs only on an enum field: a choice that takes several of its options',path:["multiple"]});for(let te of Object.keys(h.optionLabels??{}))h.options?.includes(te)||D.addIssue({code:"custom",message:`"${te}" is labeled, and is none of the field's options`,path:["optionLabels",te]});h.type!=="list"&&h.of&&D.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),h.places!==void 0&&!(h.format==="money"||!h.format&&/^[A-Z]{3}$/.test(h.unit??""))&&D.addIssue({code:"custom",message:'"places" belongs only on money: a number field with "format": "money"',path:["places"]}),h.repeats&&h.type!=="date"&&h.type!=="datetime"&&D.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),m=v().check(P(new RegExp(`${Se.source}|${Ie.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),d=$({to:R([o(m,1),T("*")]),cardinality:n(G(["one","many"])),description:n(g),inverse:n(t(1,80)),appendOnly:n(I()),renamedFrom:n(v()),tidying:n(T("never"))}),l=R([i,$({expr:i,label:n(t(1,60)),description:n(g),format:n(G(["money","percent","duration"])),unit:n(t(1,12)),places:n(T(0)),hidden:n(I())})]),S=R([v(),L(),I(),_e(),N(H()),$({expr:i})]),b=$({noun:n(t(1,40)),plural:n(t(1,40)),aliases:n(o(c,1,on)),description:n(g),fields:j(f,y).check(Y(h=>Object.keys(h).length>0,"a kind has at least one field")),label:n(p),describe:n(p),lifecycle:n($({field:f,retired:o(R([v(),L(),I()]),1)})),figure:n(t(void 0,2e4)),glance:n(o(f,1,20)),page:n($({fields:n(o(f,1,40)),groups:n(o($({title:t(1,60),fields:o(f,1,40)}),1,12))})),edges:n(j(u,d)),computed:n(j(v(),l).check(Y(h=>Object.keys(h).length<=sn,`a kind works out at most ${sn} computed fields`))),fieldRoles:n(j(v(),v())),renamedFrom:n(v().check(P(Se))),people:n(I()),archives:n(T(!1)),tidying:n(G(["never","no-links"])),derives:n($({from:a("kind"),via:u,set:j(f,S)}))}),O=v().check(P(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),x=R([$({create:a("kind"),as:n(v().check(P(ve))),set:n(j(f,S))}),$({set:j(f,S),target:n(O)}),$({connect:u,from:O,to:O}),$({sever:u,from:O,to:O}),$({remove:O})]),A=$({title:n(t(1,80)),description:n(g),fromTheOtherEnd:n(t(1,80)),on:n(R([a("kind"),o(a("kind"),1)])),creates:n(a("kind")),sets:n(j(f,S)),writes:n(o(f,1)),connects:n(u),severs:n(u),setsOther:n(j(f,S)),setsLinked:n(j(u,j(f,S))),replaces:n(R([T(!0),o(u,1,10)])),removes:n(T(!0)),args:n(j(f,y)),effects:n(o(x,1,20)),allowedWhen:n(i),refusal:n(p),destructive:n(I())}),w=$({act:a("act"),label:n(t(1,80)),args:n(j(v(),S))}),C=$({every:a("kind"),through:u,via:n(u)}),q=$({title:n(t(1,120)),description:n(g),over:R([T("graph"),a("kind")]),when:n(i),require:n(i),covers:n(C),says:n(p),repairs:n(o(w,void 0,10))}).check(re((h,D)=>{!h.require&&!h.covers&&D.addIssue({code:"custom",message:'a rule says what must hold in "require", or what each record must be linked to in "covers"',path:["require"]}),h.require&&h.covers&&D.addIssue({code:"custom",message:'a rule is judged by "require" or by "covers", not both',path:["covers"]}),h.covers&&h.over==="graph"&&D.addIssue({code:"custom",message:'a coverage rule is over a kind, whose records it follows through their links; name the kind in "over"',path:["over"]})})),z=$({roles:R([o(a("role"),1),T("*")]),mutations:R([o(a("act")),T("*")]),kinds:n(R([N(a("kind")),T("*")])),describe:n(g),self:n(I()),ownEnd:n(I()),propose:n(R([o(a("act"),1),T("*")]))}).check(re((h,D)=>{Array.isArray(h.mutations)&&h.mutations.length===0&&h.propose===void 0&&D.addIssue({code:"custom",message:'a grant names at least one act in "mutations", or the acts it lets these roles propose in "propose"',path:["mutations"]})})),E=n(o(f,1)),_=$({roles:R([o(a("role"),1),T("*")]),kinds:o(a("kind"),1),own:n(I()),via:n(u),fields:E,hide:E}),ie=$({grants:N(z),sees:n(N(_))}),W=$({accent:n(v().check(P(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),ground:n(R([v().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"')),$({light:n(v().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"'))),dark:n(v().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#101826"')))})])),name:n(t(1,60)),currency:n(v().check(P(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:n(t(2,35)),timeZone:n(t(1,64)),logo:n(R([t(1,ne),$({src:t(1,ne),alt:n(t(1,120))}),$({light:t(1,ne),dark:n(t(1,ne)),alt:n(t(1,120)),darkFallback:n(T("invert"))})])),favicon:n(R([t(1,ne),$({emoji:v()})])),typography:n($({display:n(t(1,200)),body:n(t(1,200)),mono:n(t(1,200))})),shape:n($({radius:n(L().check(U(0),Z(32))),density:n(L().check(U(.75),Z(1.5)))})),accents:n(j(v(),L().check(U(0),Z(360)))),scheme:n(G(["light","dark","auto"])),subtitle:n(T(!1)),splash:n($({style:G(vn),image:n(t(1,ne)),title:n(t(1,80)),kicker:n(t(1,80)),shader:n(t(1,40)),scheme:n(G(["light","dark","device"]))})),views:n($({css:n(t(1)),motion:n(G(["none","fade"])),fonts:n(N($({family:t(1),src:t(1),weight:n(R([L(),v()])),style:n(G(["normal","italic"]))})))}))}),V=j(v(),H()),Fe=R([t(1,120),$({by:t(1,120),direction:n(G(["asc","desc"]))})]),De=L().check(X(),U(1),Z(9999)),hn=oe({create:n(I()),options:n(oe({sort:n(Fe),columnSort:n(Fe),search:n(o(t(1,120),void 0,40)),filters:n(o(t(1,120),void 0,40)),horizon:n(R([L().check(X(),U(1),Z(200)),oe({years:L().check(X(),U(1),Z(200)),title:t(1,80),from:n(De),to:n(De)})]))}))}),kn=$({card:n(N(H())),row:n(N(H())),page:n(N(H()))}),bn=()=>{let h=n(G(["asc","desc"]));return R([t(1,120),$({by:t(1,120),direction:h,then:n(R([t(1,120),$({by:t(1,120),direction:h})]))})])},$n=()=>R([t(1,120),$({by:t(1,120),order:n(o(t(1,80),void 0,40)),closed:n(o(t(1,80),void 0,40))})]),Te=oe({order:n(N(v())),hide:n(N(v())),first:n(v()),primary:n(o(t(1,80),void 0,40)),scene:n(t(1,40)),pages:n(t(1,40)),lists:n(j(v(),$({filters:n(o(t(1,120),void 0,40)),sort:n(bn()),group:n($n()),export:n(I()),opens:n(t(1,80))})))}),wn=$({act:a("act"),title:n(t(1,80)),intro:n(g),fields:n(o(f,1,40)),say:n(g),submit:n(t(1,80)),role:n(a("role"))}),Sn=$({$schema:n(v()),format:T(Oe),formatVersion:T(je),name:t(1,80),description:n(g),version:n(L().check(X(),U(1))),kinds:j(a("kind"),b).check(Y(h=>Object.keys(h).length>0,"a document declares at least one kind"),Y(h=>Object.keys(h).length<=40,"a document declares at most 40 kinds")),computed:n(j(v(),l)),acts:n(j(a("act"),A)),rules:n(j(a("rule"),q)),roles:n(N(a("role"))),policy:n(ie),modules:n(V),lenses:n(N(hn)),pages:n(Te),views:n(j(v(),R([kn,N(H())]))),brand:n(W),settings:n(N(V)),migrations:n(N(V)),connections:n(j(a("connection"),V)),purpose:n(V),workflows:n(j(a("workflow"),V)),forms:n(j(a("form"),wn)),publishing:n($({mode:G(["live","on-publish"]),working:o(a("role"),void 0,40),publishers:n(o(a("role"),1,40))})),tidying:n($({autoAcceptAt:n(L().check(X(),U(1),Z(1e4)))}))});return{FieldSpec:y,EdgeSpec:d,ComputedSpec:l,KindSpec:b,ValueSpec:S,EffectSpec:x,ActSpec:A,RepairSpec:w,CoverSpec:C,RuleSpec:q,GrantSpec:z,SightSpec:_,PolicySpec:ie,BrandSpec:W,PagesSpec:Te,DocumentSpec:Sn}}var Rn,K=()=>Rn??=En(),Xn=M(()=>K().FieldSpec),Qn=M(()=>K().EdgeSpec),et=M(()=>K().ComputedSpec),nt=M(()=>K().KindSpec),tt=M(()=>K().ValueSpec),ot=M(()=>K().EffectSpec),st=M(()=>K().ActSpec),it=M(()=>K().RepairSpec),rt=M(()=>K().CoverSpec),at=M(()=>K().RuleSpec),ct=M(()=>K().GrantSpec),lt=M(()=>K().SightSpec),dt=M(()=>K().PolicySpec),pt=M(()=>K().BrandSpec),ft=M(()=>K().PagesSpec),rn=M(()=>K().DocumentSpec);var Fn={};function an(e,s=Fn,r=je){let{document:t,respelled:o}=Ne(e),a=o.length>0?{respelled:o}:{};if(!t||typeof t!="object"||Array.isArray(t))return{document:t};let u=t;if(u.format!==Oe||typeof u.formatVersion!="number"||u.formatVersion>=r)return{document:t,...a};let f=u.formatVersion,g=structuredClone(u);for(let c=f;c<r;c++){let i=s[c];if(!i)throw new Error(`there is no upgrade from format ${c} to ${c+1}`);g={...i(g),formatVersion:c+1}}return{document:g,from:f,...a}}function Ae(e,s,r){let t=Object.keys(e).filter(f=>e[f].edges?.[s]!==void 0);if(t.length===0)return;let o=t.map(f=>e[f].edges[s].to),a=o.some(f=>f==="*")?"*":[...new Set(o.flatMap(f=>f))];if(r.length===0||r.some(f=>t.includes(f)))return{reversed:!1,kinds:a};let u=t.filter(f=>{let g=e[f].edges[s].to;return g==="*"||r.every(c=>g.includes(c))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:a}}var dn=(e,s)=>{let r=e?.fields[s];return r!==void 0&&(r.type==="duration"||(r.type==="number"||r.type==="integer")&&r.format==="duration")};function cn(e,s,r,t){if(t==="out"){let o=e[s]?.edges?.[r]?.to;return o===void 0?[]:o==="*"?Object.keys(e):o}return Object.entries(e).filter(([,o])=>{let a=o.edges?.[r]?.to;return a!==void 0&&(a==="*"||a.includes(s))}).map(([o])=>o)}function Ee(e,s,r){if(r.t==="ident")return e[s]?.edges?.[r.name]?cn(e,s,r.name,"out"):void 0;if(r.t==="where")return Ee(e,s,r.set);if(r.t==="call"&&(r.fn==="out"||r.fn==="in")&&r.args[0]?.t==="lit"&&typeof r.args[0].value=="string")return cn(e,s,r.args[0].value,r.fn)}var ln=(e,s,r)=>{let t=s.filter(o=>e[o]?.fields[r]!==void 0);return t.length>0&&t.every(o=>dn(e[o],r))};function pn(e,s,r){let t=e.kinds,o=t[s],a=new Map(r),u=new Map,f=(c,i)=>{if(i>8)return!1;switch(c.t){case"ident":return dn(o,c.name)||g(c.name,i+1);case"member":{let p=Ee(t,s,c.object);return p!==void 0&&ln(t,p,c.name)}case"call":{if(c.fn!=="sum"&&c.fn!=="min"&&c.fn!=="max")return!1;let[p,y]=c.args,m=p&&Ee(t,s,p);return m!==void 0&&y?.t==="ident"&&ln(t,m,y.name)}case"binary":return(c.op==="+"||c.op==="-")&&f(c.left,i)&&f(c.right,i);case"unary":return c.op==="-"&&f(c.operand,i);default:return!1}},g=(c,i)=>{if(o?.computed?.[c]===void 0)return!1;if(u.has(c))return u.get(c);u.set(c,!1);let p=a.get(c),y=p!==void 0&&f(p,i);return u.set(c,y),y};return r.map(([c])=>c).filter(c=>g(c,0))}var Dn="several choices";var Tn={title:["string","text"],rich_text:["string","text"],number:["number","integer"],select:["enum","string"],status:["enum","string"],multi_select:["list",Dn],date:["date","datetime"],checkbox:["boolean"],url:["url","string"],email:["email","string"],phone_number:["phone","string"],people:["string","text","list"]};var fn=new Set(Object.values(Tn).flat());function un(e,s){let r=new Map;if(!e||typeof e!="object")return new Map;let t=Object.values(e).flatMap(o=>o&&typeof o=="object"&&o.system==="notion"&&Array.isArray(o.sources)?o.sources.filter(a=>a&&typeof a=="object").map(a=>({system:"notion",kind:a.kind,properties:a.properties})):[o]);for(let o of t){if(!o||typeof o!="object"||typeof o.kind!="string")continue;let a=s[o.kind]?.fields;if(!a)continue;let u=[];o.system==="google-calendar"&&o.fields&&typeof o.fields=="object"?u=Object.values(o.fields).filter(g=>typeof g=="string"):o.system==="notion"&&(u=o.properties&&typeof o.properties=="object"?Object.keys(o.properties):Object.keys(a).filter(g=>fn.has(a[g].type)));let f=r.get(o.kind)??new Set;for(let g of u)Object.hasOwn(a,g)&&f.add(g);r.set(o.kind,f)}return new Map([...r].filter(([,o])=>o.size>0).map(([o,a])=>[o,Object.keys(s[o].fields).filter(u=>a.has(u))]))}function mn(e,s,r=`kinds.${e}.page`){let t=s.page;if(!t)return[];let o=[],a=[...Object.keys(s.fields),...Object.keys(s.computed??{})],u=new Set,f=(c,i)=>{a.includes(c)?u.has(c)&&o.push(k("page-field-twice",i,`"${c}" is on ${e}'s page twice; name each field once`)):o.push(k("page-field",i,`${e}'s page is to show "${c}", and ${e} has no field or computed field called that`,`use one of: ${a.join(", ")}`)),u.add(c)};(t.fields??[]).forEach((c,i)=>f(c,`${r}.fields.${i}`));let g=new Set;return(t.groups??[]).forEach((c,i)=>{let p=c.title.trim().toLowerCase();g.has(p)&&o.push(k("page-group-twice",`${r}.groups.${i}.title`,`${e}'s page has two groups called "${c.title}"; give each its own title`)),g.add(p),c.fields.forEach((y,m)=>f(y,`${r}.groups.${i}.fields.${m}`))}),o}function gn(e,s=[]){return Ce({declared:Object.keys(e.fields),paged:[...e.page?.fields??[],...(e.page?.groups??[]).flatMap(r=>r.fields)],must:r=>!!e.fields[r].required&&e.fields[r].default===void 0,naming:s})}var Nn=new Set(["subject","now","today","me"]);function Mn(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>xe)return{findings:[k("too-large","",`a document may be at most ${xe/1024} KB`)]};if(typeof e=="string")try{e=JSON.parse(e)}catch(t){return{findings:[k("not-json","",`this is not JSON: ${t.message}`)]}}try{e=an(e).document}catch(t){return{findings:[k("format","formatVersion",t.message)]}}e=tn(e);let s=rn.safeParse(e);if(!s.success)return{findings:s.error.issues.map(t=>{let o=t.path.map(String).join(".");if(t.code==="unrecognized_keys")return k("unknown-key",o,`${t.keys.map(a=>`"${a}"`).join(", ")} ${t.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(t.code==="invalid_union"&&/\.effects\.\d+$/.test(o))return k("effect-shape",o,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(t.code==="invalid_key"){let a=t.issues?.[0]?.message;return k("shape",o,`the name "${String(t.path.at(-1))}" is not allowed here${a?`: ${a}`:""}`)}return k("shape",o,t.message)})};let r=s.data;return{document:r,findings:_n(r)}}var pe=e=>[e??[]].flat();function zn(e){let s=new Map;for(let[r,t]of Object.entries(e.kinds))for(let[o,a]of Object.entries(Q(t.edges))){let u=s.get(o);s.set(o,{name:o,from:[...u?.from??[],r],to:a.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...a.to])],cardinality:a.cardinality??"many"})}return s}function Ht(e){let s=new Map;for(let[t,o]of Object.entries(e.kinds)){let a=se(o),u=me(o.edges);s.set(t,{fields:new Set([...Object.keys(o.fields),...u.keys()]),edges:new Map(Object.entries(Q(o.edges)).map(([f,g])=>[f,g.cardinality??"many"])),...a?{computed:a}:{},...u.size>0?{linked:u}:{}})}let r=se(e);return r&&s.set(Be,{computed:r}),s}function yn(e,s){let r=[],t=pe(e.on),o=(a,u)=>{let f=Ae(s.kinds,a,t)?.reversed===!0,[g,c]=f?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:a,from:g,to:c}:{sever:a,from:g,to:c}};if(e.creates){let a=s.kinds[e.creates],u={};for(let f of Object.keys(a?.fields??{}))u[f]=`$${f}`;for(let f of e.effects??[])"set"in f&&!("create"in f)&&F(f.target)==="new"&&Object.assign(u,f.set);r.push({create:e.creates,as:"new",set:u})}if(e.sets&&r.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&r.push({set:Object.fromEntries(e.writes.map(a=>[a,`$${a}`]))}),e.connects&&(e.replaces&&r.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),r.push(o(e.connects,"connect"))),e.severs&&r.push(o(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&r.push({set:e.setsOther,target:"$to"}),e.setsLinked&&t.length>0)for(let[a,u]of Object.entries(e.setsLinked))r.push({set:u,through:a});return e.removes&&r.push({remove:"$subject"}),e.effects&&r.push(...e.effects.filter(a=>!(e.creates&&"set"in a&&!("create"in a)&&F(a.target)==="new"))),r}function le(e,s,r){try{let t=J(e),o=ae(t);for(let a of o.unknownFunctions)r.push(k("unknown-function",s,`"${a}" is not a function the rule language knows`,"see the rule language in the graview-invariant skill"));return t}catch(t){if(t instanceof ce){r.push(k("expression",s,t.sentence+` (at character ${t.at+1})`));return}throw t}}function Re(e,s,r){try{return ee(e)}catch(t){if(t instanceof Ye||t instanceof ce){r.push(k("template",s,(t instanceof ce,t.sentence)));return}throw t}}function _n(e){let s=[],r=new Set(Object.keys(e.kinds)),t=zn(e),o=e.acts??{},a=new Set(e.roles??[]),u=(c,i)=>me(e.kinds[c]?.edges).has(i),f=c=>Object.keys(e.kinds).some(i=>u(i,c));for(let[c,i]of Object.entries(e.kinds)){let p=`kinds.${c}`;for(let[m,d]of Object.entries(i.edges??{})){if(!Ke(d)&&d.to!=="*")for(let l of d.to)r.has(l)||s.push(k("edge-target",`${p}.edges.${m}.to`,`"${l}" is not a kind this document declares`));i.fields[m]&&s.push(k("edge-field-clash",`${p}.edges.${m}`,`"${m}" is both a field and a relation of ${c}`,"rename one of them"))}i.lifecycle&&!i.fields[i.lifecycle.field]&&s.push(k("lifecycle-field",`${p}.lifecycle.field`,`${c} has no field "${i.lifecycle.field}"`));let y=m=>i.computed!==void 0&&Object.hasOwn(i.computed,m);for(let m of i.glance??[])!i.fields[m]&&!y(m)&&s.push(k("glance-field",`${p}.glance`,`a glance at ${c} is to say "${m}", and ${c} has no field or computed field called that`,`use one of: ${[...Object.keys(i.fields),...Object.keys(i.computed??{})].join(", ")}`));s.push(...mn(c,i));for(let m of["label","describe"]){let d=i[m];if(!d)continue;let l=Re(d,`${p}.${m}`,s);for(let S of l??[])if(S.expr){for(let b of ae(S.expr).names)if(!i.fields[b]){if(y(b)){en(i,b)||s.push(k("template-field",`${p}.${m}`,`${c}'s ${b} is worked out from beyond the record, and a ${m} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${c}'s own fields`));continue}s.push(k("template-field",`${p}.${m}`,`${c} has no field "${b}" for its ${m} to show`,m==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[m,d]of Object.entries(i.derives?.set??{}))fe(d)&&"expr"in d&&le(String(d.expr),`${p}.derives.set.${m}`,s);for(let[m,d]of Object.entries(i.fields)){if(d.default!==void 0&&d.type==="enum"){let b=(d.multiple?Array.isArray(d.default)?d.default:[d.default]:[d.default]).find(O=>!d.options?.includes(String(O)));(b!==void 0||!d.multiple&&Array.isArray(d.default))&&s.push(k("default-option",`${p}.fields.${m}.default`,`"${String(b??d.default)}" is not one of ${m}'s options`))}let l=`${m}Repeat`;d.repeats&&(i.fields[l]||i.edges?.[l]||i.computed?.[l])&&s.push(k("repeat-clash",`${p}.fields.${m}.repeats`,`${c} already has "${l}", where how ${m} repeats is kept`))}}for(let[c,i]of Object.entries(o)){let p=`acts.${c}`;for(let l of pe(i.on))r.has(l)||s.push(k("act-kind",`${p}.on`,`"${l}" is not a kind this document declares`));let y=pe(i.on),m=yn(i,e);if(i.creates&&i.on===void 0&&i.writes&&r.has(i.creates)){for(let l of i.writes)if(!e.kinds[i.creates].fields[l])if(e.kinds[i.creates].computed?.[l]!==void 0)s.push(k("computed-written",`${p}.writes`,`${i.creates}'s ${l} is worked out, not written: no act can set it`,"write the stored fields it is worked out from"));else{if(u(i.creates,l))continue;s.push(k("act-field",`${p}.writes`,`${i.creates} has no field "${l}"`))}}m.length===0&&s.push(k("act-empty",p,`"${c}" does nothing`,"give it effects or a shorthand such as sets or creates"));let d=new Map;m.forEach((l,S)=>{let b=m.length-(i.effects?.length??0),O=i.effects&&S>=b?`${p}.effects.${S-b}`:p;if("create"in l){if(!r.has(l.create))s.push(k("act-kind",`${O}.create`,`"${l.create}" is not a kind this document declares`));else for(let w of Object.keys(l.set??{}))e.kinds[l.create].fields[w]||(e.kinds[l.create].computed?.[w]!==void 0?s.push(k("computed-written",`${O}.set.${w}`,`${l.create}'s ${w} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):s.push(k("act-field",`${O}.set.${w}`,`${l.create} has no field "${w}"`)));l.as&&d.set(l.as,l.create)}else if("connect"in l||"sever"in l){let w="connect"in l?l.connect:l.sever;!t.has(w)&&!f(w)&&s.push(k("act-edge",`${O}.${"connect"in l?"connect":"sever"}`,`"${w}" is not a relation any kind declares`)),F(l.from)==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${c}" acts on "$subject" but does not say which kinds it is "on"`))}else if(!("through"in l))if("set"in l){let w=F(l.target??"$subject"),C=w==="subject"?y:d.has(w??"")?[d.get(w)]:[];w==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${c}" changes "$subject" but does not say which kinds it is "on"`));for(let q of Object.keys(l.set))for(let z of C)if(!(!r.has(z)||e.kinds[z].fields[q]))if(e.kinds[z].computed?.[q]!==void 0)s.push(k("computed-written",`${O}.set.${q}`,`${z}'s ${q} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(z,q))continue;s.push(k("act-field",`${O}.set.${q}`,`${z} has no field "${q}"`))}}else"remove"in l&&F(l.remove)==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${c}" removes "$subject" but does not say which kinds it is "on"`));let x="set"in l&&l.set?Object.values(l.set):[],A="through"in l?`${p}.setsLinked.${l.through}`:`${O}.set`;x.forEach(w=>{w&&typeof w=="object"&&!Array.isArray(w)&&"expr"in w&&le(w.expr,A,s)})}),i.allowedWhen&&le(i.allowedWhen,`${p}.allowedWhen`,s),i.refusal&&Re(i.refusal,`${p}.refusal`,s)}for(let[c,i]of Object.entries(e.rules??{})){let p=`rules.${c}`;i.over!=="graph"&&!r.has(i.over)&&s.push(k("rule-kind",`${p}.over`,`"${i.over}" is not a kind this document declares`));let y=i.over==="graph"?void 0:e.kinds[i.over];if(i.covers&&y){let m=ye(i.over,i.covers,d=>t.get(d),d=>r.has(d));if("problem"in m){let{key:d,message:l,fix:S}=m.problem;d==="every"?s.push(k("rule-kind",`${p}.covers.every`,l,S)):s.push(k("rule-covers-relation",`${p}.covers.${d}`,l,S))}}for(let m of["when","require"]){let d=i[m];if(!d)continue;let l=le(d,`${p}.${m}`,s);if(!l)continue;let S=ae(l);for(let b of S.names)if(i.over==="graph")s.push(k("rule-name",`${p}.${m}`,`"${b}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(y&&!y.fields[b]&&!y.edges?.[b]&&y.computed?.[b]===void 0){let O=Object.keys(y.edges??{}).find(x=>x.includes("-")&&x.split("-").includes(b));s.push(k("rule-name",`${p}.${m}`,`${i.over} has no field or relation called "${b}"`,O?`"${O}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${O.replace(/-([a-z0-9])/g,(x,A)=>A.toUpperCase())}"`:void 0))}for(let b of S.edges)!t.has(b)&&!f(b)&&s.push(k("rule-edge",`${p}.${m}`,`"${b}" is not a relation any kind declares`));for(let b of S.sweeps)r.has(b)?i.over!=="graph"&&s.push(Ue("rule-cost",`${p}.${m}`,`this rule looks at every ${b} for every ${i.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):s.push(k("rule-kind",`${p}.${m}`,`"${b}" is not a kind this document declares`))}i.says&&Re(i.says,`${p}.says`,s),(i.repairs??[]).forEach((m,d)=>{!o[m.act]&&!ge(m.act)&&!$e(m.act,e.kinds)&&s.push(k("repair-act",`${p}.repairs.${d}.act`,`"${m.act}" is not an act this document declares`,we(m.act,e)))})}let g=e.policy;return g&&(g.grants.forEach((c,i)=>{if(c.roles!=="*"&&a.size>0)for(let p of c.roles)a.has(p)||s.push(k("grant-role",`policy.grants.${i}.roles`,`"${p}" is not one of the document's roles`));for(let p of["mutations","propose"]){let y=c[p];if(y!==void 0&&y!=="*")for(let m of y)!o[m]&&!ge(m)&&!$e(m,e.kinds)&&s.push(k("grant-act",`policy.grants.${i}.${p}`,`"${m}" is not an act this document declares`,we(m,e)))}}),(g.sees??[]).forEach((c,i)=>{for(let p of c.kinds)r.has(p)||s.push(k("sight-kind",`policy.sees.${i}.kinds`,`"${p}" is not a kind this document declares`));if(c.roles!=="*"&&a.size>0)for(let p of c.roles)a.has(p)||s.push(k("sight-role",`policy.sees.${i}.roles`,`"${p}" is not one of the document's roles`))})),s.push(...Qe(e)),s}function In(e){return e.label?[...e.label.matchAll(/\{\s*([A-Za-z_][A-Za-z0-9_]*)/g)].map(s=>s[1]):[ke(e)??[]].flat()}function Kn(e,s,r,t){let o=new Map,a=pe(e.on),u=new Map,f=new Map;(a.length>0||s.some(d=>"remove"in d&&F(d.remove)==="subject"||"from"in d&&(F(d.from)==="subject"||F(d.to)==="subject")||"set"in d&&!("create"in d)&&!("through"in d)&&F(d.target??"$subject")==="subject"||"through"in d))&&o.set(he,{ref:a.length>0?a:"*",required:!0});let c=e.args??{},i=e.writes?.length===1,p=(d,l)=>l&&d.type===l.type&&d.min===void 0&&d.max===void 0&&d.step===void 0?{...d,...l.min===void 0?{}:{min:l.min},...l.max===void 0?{}:{max:l.max},...l.step===void 0?{}:{step:l.step}}:d,y=(d,l)=>l&&d.type===l.type&&d.format===void 0&&d.unit===void 0?{...p(d,l),...l.format?{format:l.format}:{},...l.unit?{unit:l.unit}:{}}:p(d,l),m=(d,l,S)=>{if(d===he||Nn.has(d)||u.has(d)||o.has(d))return;let b=c[d]?y(c[d],S):void 0;o.set(d,b?{field:b,optional:!b.required,required:!!b.required}:l())};for(let d of s)if("create"in d){let l=r.kinds[d.create],S=l?gn(l,In(l)):[],b=O=>S.includes(O)?S.indexOf(O):S.length;for(let[O,x]of Object.entries(d.set??{}).sort(([A],[w])=>b(A)-b(w))){let A=F(x),w=l?.fields[O];if(A&&w){let C=!!w.required&&w.default===void 0;m(A,()=>({field:w,optional:!C,required:C}),w)}}d.as&&u.set(d.as,d.create)}else if("connect"in d||"sever"in d){let l="connect"in d?d.connect:d.sever,S=t.get(l),b=F(d.from)==="subject"&&a.length>0?a.map(x=>Q(r.kinds[x]?.edges)[l]?.to):[],O=b.length>0&&b.every(Boolean)?b.includes("*")?"*":[...new Set(b.flat())]:void 0;for(let[x,A]of[["from",d.from],["to",d.to]]){let w=F(A);if(!w)continue;let C=x==="to"?O??S?.to??"*":S?.from??"*";C!=="*"&&!f.has(w)&&f.set(w,C),m(w,()=>({ref:C,required:!0}))}}else if("through"in d){let l=Ae(r.kinds,d.through,a),S=l&&l.kinds!=="*"?l.kinds[0]:void 0;for(let[b,O]of Object.entries(d.set)){let x=F(O);if(!x||x==="to")continue;let A=S?r.kinds[S]?.fields[b]:void 0;m(x,()=>A?{field:A,optional:!0,required:!1}:{any:!0,required:!1},A)}}else if("set"in d){let l=F(d.target??"$subject"),S=l==="subject"?a[0]:u.get(l??"")??f.get(l??"")?.[0];l&&l!=="subject"&&!u.has(l)&&m(l,()=>({ref:"*",required:!0}));for(let[b,O]of Object.entries(d.set)){let x=F(O);if(!x)continue;let A=S?r.kinds[S]?.fields[b]:void 0;m(x,()=>A?{field:A,optional:!i,required:i}:{any:!0,required:!1},A)}}else if("remove"in d){let l=F(d.remove);l&&m(l,()=>({ref:"*",required:!0}))}for(let[d,l]of Object.entries(c))o.has(d)||o.set(d,{field:l,optional:!l.required,required:!!l.required});return o}function Wt(e,s={}){let r=Mn(e);if(!r.document||ze(r.findings))return{ok:!1,findings:r.findings};let t=r.document,o=[...r.findings];s.previous&&o.push(...Gn(t,s.previous));let a=Ln(t,o);return ze(a.findings)?{ok:!1,findings:a.findings}:We(a,s)}function de(e,s,r,t){return e.map(o=>{let a=o.expr,u=a?.t==="member"&&a.object.t==="ident"?a.object.name:void 0;if(o.format||!a||a.t!=="ident"&&u!=="$subject"&&u!=="$arg")return o;let f=a.name,g=u==="$arg"?void 0:r?.[f],c=(u==="$arg"?t?.[f]:void 0)??s?.[f]??(typeof g=="object"?g:void 0),i=c?.format;return i==="money"||i==="percent"?{...o,format:i,...i==="money"&&c?.places===0?{formatArgs:["0"]}:{}}:o})}function Pn(e,s,r){let t=r.kinds[e]?.edges?.[s.via]!==void 0?"to":"from",o=r.kinds[s.from],a=[],u={};for(let[f,g]of Object.entries(s.set))if(fe(g)&&"expr"in g){let c=J(g.expr);a.push([f,{expr:c}]),c.t==="ident"&&o?.fields[c.name]&&(u[f]=c.name)}else a.push([f,{value:typeof g=="string"&&g.startsWith("$$")?g.slice(1):g}]);return{from:s.from,via:s.via,sourceEnd:t,set:a,back:u}}function Ln(e,s){let r=zn(e),t={},o=un(e.connections,e.kinds);for(let[i,p]of Object.entries(e.kinds)){let y=ke(p),m=p.label??(y?`{${y}}`:void 0),d=se(p),l=d?pn(e,i,[...d]):[];t[i]={...m?{label:de(ee(m),p.fields,p.computed)}:{},...p.describe?{describe:de(ee(p.describe),p.fields,p.computed)}:{},...d?{computed:[...d]}:{},...l.length>0?{durations:l}:{},...o.has(i)?{keptInStep:o.get(i)}:{},...p.derives?{derives:Pn(i,p.derives,e)}:{}}}let a={};for(let[i,p]of Object.entries(e.acts??{})){let y=yn(p,e),m=Kn(p,y,e,r),d=p.destructive??y.some(z=>"remove"in z||"sever"in z||"replace"in z),l=[...new Set(y.flatMap(z=>"create"in z?[z.create]:[]))],S=[...new Set(y.flatMap(z=>"connect"in z?[z.connect]:[]))],b=[...new Set(y.flatMap(z=>"sever"in z?[z.sever]:"replace"in z?z.replace:[]))],O=[...new Set(y.flatMap(z=>"set"in z&&!("create"in z)&&!("through"in z)&&F(z.target??"$subject")==="subject"?Object.keys(z.set):[]))],x=new Map;for(let z of y){if(!("connect"in z)&&!("sever"in z))continue;let E=r.get("connect"in z?z.connect:z.sever);for(let[_,ie]of[["from",z.from],["to",z.to]]){let W=F(ie),V=_==="to"?E?.to:E?.from;W&&W!=="subject"&&V&&V!=="*"&&x.set(W,[...new Set([...x.get(W)??[],...V])])}}let A={};for(let z of y){if(!("set"in z)||"create"in z||"through"in z)continue;let E=F(z.target??"$subject");for(let _ of E&&E!=="subject"&&x.get(E)||[])A[_]=[...new Set([...A[_]??[],...Object.keys(z.set)])]}let w={};for(let z of y)if(!(!("set"in z)||"create"in z||"through"in z||F(z.target??"$subject")!=="subject"))for(let[E,_]of Object.entries(z.set??{}))typeof _=="string"&&F(_)===void 0||typeof _=="number"||typeof _=="boolean"?w[E]=typeof _=="string"&&_.startsWith("$$")?_.slice(1):_:delete w[E];let C=l.length===0&&y.every(z=>!("set"in z)||!z.set||Object.values(z.set).every(E=>!(E&&typeof E=="object"&&!Array.isArray(E)&&"expr"in E))),q=new Map;for(let z of y)if(!(!("set"in z)||!z.set))for(let E of Object.values(z.set))E&&typeof E=="object"&&!Array.isArray(E)&&"expr"in E&&q.set(E.expr,J(E.expr));a[i]={title:p.title??i.replace(/-/g," "),effects:y,args:[...m],...p.allowedWhen?{guard:J(p.allowedWhen)}:{},...p.refusal?{refusal:de(ee(p.refusal),e.kinds[[p.on??[]].flat()[0]??""]?.fields,void 0,p.args)}:{},exprs:[...q],destructive:d,idempotent:C,creates:l,connects:S,severs:b,writes:O,writesOther:A,sets:w}}let u={};for(let[i,p]of Object.entries(e.rules??{})){let y=p.covers&&p.over!=="graph"?ye(p.over,p.covers,m=>r.get(m),m=>m in e.kinds):void 0;u[i]={title:p.title??i.replace(/-/g," "),...p.require?{require:J(p.require)}:{},...y&&"plan"in y?{covers:y.plan}:{},...p.when?{when:J(p.when)}:{},...p.says?{says:de(ee(p.says),e.kinds[p.over]?.fields)}:{}}}let f=Ze(e,s),g=Je(e),c=Xe(e);return{format:He,document:e,findings:s,kinds:t,...e.computed?{facts:[...se(e)??[]]}:{},edges:[...r].map(([i,{from:p,to:y,cardinality:m}])=>[i,{from:p,to:y,cardinality:m}]),acts:a,rules:u,brand:f,...Object.keys(g).length>0?{viewSpecs:g}:{},...c?{home:c}:{}}}function Yt(e,s,r){let t=/^defineNode\("([^"]+)"\)/.exec(s)?.[1],o=t?r.kinds[t]:void 0;if(!t||!o)return e;let a=Object.keys(o.fields).filter(u=>u!=="label").slice(0,3);return{...e,path:`kinds.${t}.glance`,fix:`Say which: "glance": [${a.map(u=>`"${u}"`).join(", ")}] on kinds.${t} \u2014 the facts a person compares one by, at a glance.`}}function Gn(e,s){let r=[],t=new Set(Object.values(s.kinds).flatMap(o=>Object.keys(o.edges??{})));for(let[o,a]of Object.entries(e.kinds)){let u=a.renamedFrom;u&&!s.kinds[u]&&r.push(k("renamed-from-nothing",`kinds.${o}.renamedFrom`,`${o} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let f=s.kinds[u??o];for(let[g,c]of Object.entries(a.fields)){let i=c.renamedFrom;i&&!f?.fields[i]&&r.push(k("renamed-from-nothing",`kinds.${o}.fields.${g}.renamedFrom`,`${g} says it was ${i}, and the previous ${u??o} has no field called ${i}`,"name the field it was, or drop renamedFrom"))}for(let[g,c]of Object.entries(a.edges??{})){let i=c.renamedFrom;i&&!t.has(i)&&r.push(k("renamed-from-nothing",`kinds.${o}.edges.${g}.renamedFrom`,`${g} says it was ${i}, and the previous version has no relation called ${i}`,"name the relation it was, or drop renamedFrom"))}}return r}export{Mn as a,Ht as b,yn as c,Wt as d,Yt as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as n}from"./chunk.EZF2T3XQ.js";import{c as a}from"./chunk.LPWANRBL.js";import"./chunk.3BE4SHZD.js";import"./chunk.U5P23GO7.js";import"./chunk.SNDFIJVX.js";import"./chunk.2TTKQAWQ.js";import"./chunk.CJHCUHVN.js";import"./chunk.MFNWHXGL.js";import"./chunk.DCIYOZYP.js";import"./chunk.A4TBVXHQ.js";import"./chunk.7QGDWAHH.js";import"./chunk.YC2IDHQX.js";import"./chunk.6YKKZI4H.js";import"./chunk.WIVNFOQR.js";import"./chunk.MIE4TJRW.js";import"./chunk.DEBW4FH6.js";import"./chunk.RD2FSSLV.js";import"./chunk.OWHH7JDV.js";import"./chunk.T3RFZ66S.js";import"./chunk.TDWJU6GW.js";import"./chunk.P3Z4ZCL3.js";import"./chunk.45OLF6BK.js";import"./chunk.T6ISUVUP.js";import"./chunk.GH6QX7JR.js";import"./chunk.J4D4BIB4.js";import{_ as i}from"./chunk.ASNVH2G4.js";import"./chunk.SDO3U72B.js";import"./chunk.ZDUKVXBI.js";import"./chunk.FQLNBIQ5.js";import{b as o}from"./chunk.AJZBJBMO.js";var e=o(i(),1);function m({entries:d,style:l,headingStyle:p,className:r}){return(0,e.jsxs)("section",{...r?{className:r}:{},"data-testid":"record-ai","aria-label":"What AI did here",style:{display:"grid",gap:10,...l},children:[(0,e.jsx)("h2",{style:p??{margin:0,fontSize:"1rem"},children:"What AI did here"}),(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8,fontSize:"0.875rem"},children:d.slice(0,8).map(t=>(0,e.jsx)(n,{entry:t,undo:s=>(0,e.jsx)(a,{batch:s})},t.id))})]})}export{m as RecordInteractions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as v,Jb as w,L as p,Mb as B,Ob as O,R as m,U as b,Y as h,sa as k}from"./chunk.
|
|
1
|
+
import{$ as v,Jb as w,L as p,Mb as B,Ob as O,R as m,U as b,Y as h,sa as k}from"./chunk.ZDUKVXBI.js";function $(e,t){return e.ops.length>0&&e.ops.every(n=>n.suggests!==void 0||n.undoes!==void 0&&t(n.undoes)?.suggests!==void 0&&!O(n,t(n.undoes)))}var l=e=>[...e].length;function A(e){let t,n=0,o=0;for(let i of e.ops){let d=i.mutation?.name===w&&i.withheld!==!0&&i.undoes===void 0?i.mutation.args:void 0;if(typeof d?.node!="string"||typeof d.field!="string"||t&&(t.node!==d.node||t.field!==d.field))return;t={node:d.node,field:d.field};for(let r of i.primitives)r.op==="splice-text"?(n+=l(r.inserted),o+=l(r.removed)):r.op==="patch-node"&&typeof r.after[d.field]=="string"&&(n+=l(r.after[d.field]))}return t&&{...t,inserted:n,removed:o}}function W(e,t,n){let o=n.getNode(e.node)?.kind,i=[...e.inserted>0||e.removed===0?[`+${e.inserted}`]:[],...e.removed>0?[`\u2212${e.removed}`]:[]];return`Wrote in ${k(o?t.tryDefinition(o):void 0,e.field)} (${i.join(" ")})`}var c=e=>JSON.stringify([e.kind,e.id??"",e.name??"",...e.profile?[e.profile.id]:[]]),R=e=>e.ops.find(t=>t.lineage?.run!==void 0)?.lineage?.run;function P(e,t=()=>{}){let n=[];for(let o of e){if($(o,t))continue;if(!B(o.author)){let s=A(o),a=n.at(-1),f=s&&a&&"batch"in a&&c(a.batch.author)===c(o.author)&&a.typed?.node===s.node&&a.typed.field===s.field?a.typed:void 0;f?n[n.length-1]={batch:o,typed:{...f,batches:[...f.batches,o],inserted:f.inserted+s.inserted,removed:f.removed+s.removed}}:n.push(s?{batch:o,typed:{batches:[o],...s}}:{batch:o});continue}let i=R(o),d=c(o.author),r=i!==void 0?n.findIndex(s=>"digest"in s&&s.digest.run===i&&c(s.digest.author)===d):n.length-1,u=n[r],g=u!==void 0&&"digest"in u&&c(u.digest.author)===d&&u.digest.run===i?u.digest:void 0,y=[...g?.batches??[],o];g&&n.splice(r,1),n.push({digest:{author:o.author,batches:y,things:T(y),at:o.at,...i!==void 0?{run:i}:{}}})}return n}var T=e=>e.reduce((t,n)=>t+(n.undone?0:n.ops.length),0),x=e=>{let t=Date.parse(e);if(Number.isNaN(t))return!1;let{minutes:n}=b(t,m());return n<6*60||n>=21*60};function j(e,t=h(new Date().toISOString())??p()){let n=h(e.at)??e.at.slice(0,10),i=e.run!==void 0&&n===t&&[e.at,...(e.batches??[]).map(r=>r.at)].every(x)?"overnight":n===t?"today":`on ${v(n)}`,d=e.things===1?"one thing":`${e.things} things`;return e.author?.id?.startsWith("workflow:")&&e.author.name?`${e.author.name}: ${d} ${i}`:`Tidied ${d} ${i}`}export{W as a,P as b,j as c};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{G as f,
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{G as f,La as u,_ as m}from"./chunk.ASNVH2G4.js";import{b as d}from"./chunk.AJZBJBMO.js";var g=d(f(),1),n=d(m(),1),c=/^\s*(\d{1,6})[.)]\s+(.*)$/s,S=/^\s*[-*•]\s+(.*)$/s;function h(o){let s=[];for(let p of o.replace(/\r\n?/g,`
|
|
2
2
|
`).split(/\n[ \t]*\n+/)){let t=null,a=()=>{t&&(t.t==="p"?t.lines.length>0:t.items.length>0)&&s.push(t),t=null};for(let e of p.split(`
|
|
3
|
-
`)){let i=c.exec(e),l=i?null:S.exec(e);if(i)t?.t!=="ol"&&(a(),t={t:"ol",start:Number(i[1]),items:[]}),t.items.push(i[2]);else if(l)t?.t!=="ul"&&(a(),t={t:"ul",items:[]}),t.items.push(l[1]);else if(t&&t.t!=="p"&&/^\s+\S/.test(e)){let r=t.items;r[r.length-1]=`${r[r.length-1]} ${e.trim()}`}else e.trim().length>0&&(t?.t!=="p"&&(a(),t={t:"p",lines:[]}),t.lines.push(e.trim()))}a()}return s}function P(o){return/[\r\n]/.test(o)}var k={display:"grid",gap:"0.7em",minWidth:0,overflowWrap:"anywhere"},x={margin:0},y={margin:0,paddingInlineStart:"1.6em",display:"grid",gap:"0.3em"},B=u(()=>(__graviewPreload(import.meta.url,["./chunk.
|
|
3
|
+
`)){let i=c.exec(e),l=i?null:S.exec(e);if(i)t?.t!=="ol"&&(a(),t={t:"ol",start:Number(i[1]),items:[]}),t.items.push(i[2]);else if(l)t?.t!=="ul"&&(a(),t={t:"ul",items:[]}),t.items.push(l[1]);else if(t&&t.t!=="p"&&/^\s+\S/.test(e)){let r=t.items;r[r.length-1]=`${r[r.length-1]} ${e.trim()}`}else e.trim().length>0&&(t?.t!=="p"&&(a(),t={t:"p",lines:[]}),t.lines.push(e.trim()))}a()}return s}function P(o){return/[\r\n]/.test(o)}var k={display:"grid",gap:"0.7em",minWidth:0,overflowWrap:"anywhere"},x={margin:0},y={margin:0,paddingInlineStart:"1.6em",display:"grid",gap:"0.3em"},B=u(()=>(__graviewPreload(import.meta.url,["./chunk.GH6QX7JR.js","./chunk.J4D4BIB4.js","./chunk.ASNVH2G4.js","./chunk.SDO3U72B.js","./chunk.ZDUKVXBI.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.RKVMRP7B.js")));function b({text:o,className:s,style:p,markdown:t,headingsFrom:a}){return t?(0,n.jsx)(g.Suspense,{fallback:(0,n.jsx)(b,{text:o,...s?{className:s}:{},...p?{style:p}:{}}),children:(0,n.jsx)(B,{text:o,...s?{className:s}:{},...p?{style:p}:{},...a?{headingsFrom:a}:{}})}):(0,n.jsx)("div",{"data-graview-text-body":"",...s?{className:s}:{},style:{...k,...p},children:h(o).map((e,i)=>e.t==="p"?(0,n.jsx)("p",{style:x,children:e.lines.map((l,r)=>(0,n.jsxs)("span",{children:[r>0?(0,n.jsx)("br",{}):null,l]},r))},i):e.t==="ol"?(0,n.jsx)("ol",{start:e.start,style:y,children:e.items.map((l,r)=>(0,n.jsx)("li",{children:l},r))},i):(0,n.jsx)("ul",{style:y,children:e.items.map((l,r)=>(0,n.jsx)("li",{children:l},r))},i))})}export{P as a,b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as f,b as m,c as g,d as c}from"./chunk.
|
|
1
|
+
import{a as f,b as m,c as g,d as c}from"./chunk.YC2IDHQX.js";import{eb as y,gb as p,pb as u}from"./chunk.ZDUKVXBI.js";function b(n,r){let t=y(n);return t==="agent"?"agent":t!=="human"&&t!=="visitor"?"app":n.onBehalfOf!==void 0||r?.id!==void 0&&p(n)?.id!==p(r)?.id?"person":n.id===void 0||r?.id===void 0||n.id===r.id?"you":"person"}var S=n=>n.ops.filter(r=>r.withheld!==!0);function $(n,r={}){let t=[];for(let e of n.batches()){let a=e.ops[0],s=e.ops.at(-1),i=S(e).length===0,o=i?void 0:m(e.ops),d=t.at(-1);if(o&&d?.typed&&d.author&&f(d.author,e.author)&&d.typed.node===o.node&&d.typed.field===o.field){let h=g(d.typed,o);t[t.length-1]={...d,seq:s.seq+1,at:s.at,batch:e.id,batches:[...d.batches??[],e.id],typed:h,said:c(h,n.schema,n.graph,!1)};continue}t.push({seq:s.seq+1,from:a.seq,at:s.at,batch:e.id,maker:i?"person":b(e.author,r.me),author:i?void 0:e.author,said:o?c(o,n.schema,n.graph,!1):e.intent,declaration:!1,withheld:i,...o?{batches:[e.id],typed:o}:{}})}let l=[...n.log.epochs().filter(e=>e.change!==void 0).map(e=>({seq:e.seq,sentence:e.change,...e.at?{at:e.at}:{}})),...r.declarations??[]];for(let e of l){if(e.seq<n.log.horizon||e.seq>n.log.length)continue;let a=t.findIndex(s=>s.seq===e.seq);if(a>=0&&!t[a].withheld){t[a]={...t[a],declaration:!0,said:e.sentence};continue}t.push({seq:e.seq,from:e.seq,at:e.at,batch:void 0,maker:e.author?b(e.author,r.me):"app",author:e.author,said:e.sentence,declaration:!0,withheld:!1})}return t.sort((e,a)=>e.seq-a.seq||+(e.batch!==void 0)-+(a.batch!==void 0))}function j(n,r){let t=n.log.all(),l=new Map(t.map(e=>[e.id,e.seq]));return n.batches().filter(e=>!e.undone&&e.ops[0].seq>=r).filter(e=>!e.ops.every(a=>a.sentOut!==void 0)).filter(e=>!e.ops.every(a=>a.undoes!==void 0&&(l.get(a.undoes)??-1)>=r)).map(e=>e.id)}function v(n,r){return n.withheld?"Someone":n.maker==="you"?"you":n.author?u(n.author,r):"the app"}export{b as a,$ as b,j as c,v as d};
|
|
@@ -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{b as v}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{b as v}from"./chunk.7VCYVCYM.js";import"./chunk.GH6QX7JR.js";import"./chunk.J4D4BIB4.js";import{G as S,Z as y,_ as b}from"./chunk.ASNVH2G4.js";import"./chunk.SDO3U72B.js";import"./chunk.ZDUKVXBI.js";import"./chunk.FQLNBIQ5.js";import{b as u}from"./chunk.AJZBJBMO.js";var r=u(S(),1);var t=u(b(),1);function E(o){let a=(0,r.useContext)(y),l=(0,t.jsx)(C,{...o});return!a||o.nodeId===void 0?l:(0,t.jsx)(P,{nodeId:o.nodeId,field:o.field,label:o.label,...o.markdown?{markdown:!0}:{},live:a,onDone:d=>o.onDone?o.onDone(d):o.onCancel(),writtenWhole:l})}var P=(0,r.lazy)(()=>(__graviewPreload(import.meta.url,["./chunk.7VCYVCYM.js","./chunk.GH6QX7JR.js","./chunk.J4D4BIB4.js","./chunk.ASNVH2G4.js","./chunk.SDO3U72B.js","./chunk.ZDUKVXBI.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.QPCDAQTW.js")));function C({field:o,label:a,value:l,markdown:d,onSave:s,onCancel:c}){let[i,h]=(0,r.useState)(l),[n,w]=(0,r.useState)(!1),f=(0,r.useRef)(null);return(0,r.useEffect)(()=>f.current?.focus(),[n]),(0,r.useLayoutEffect)(()=>{let e=f.current;if(!e||n||typeof CSS<"u"&&CSS.supports?.("field-sizing","content"))return;let p=()=>{e.style.height="auto";let m=getComputedStyle(e);e.style.height=`${e.scrollHeight+parseFloat(m.borderTopWidth)+parseFloat(m.borderBottomWidth)}px`};p();let x=requestAnimationFrame(p);return()=>cancelAnimationFrame(x)},[i,n]),(0,t.jsxs)("form",{style:{display:"grid",gap:8,minWidth:0},onSubmit:e=>{e.preventDefault(),s(i,!1)},children:[n?(0,t.jsx)("div",{"data-graview-preview":o,"aria-label":`${a}, as it will read`,role:"region",style:k,children:(0,t.jsx)(v,{text:i,markdown:!0})}):(0,t.jsx)("textarea",{ref:f,"aria-label":a,"data-graview-field":o,value:i,rows:3,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key==="Escape"?(e.preventDefault(),c()):e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),s(i,!1))},onBlur:e=>{e.relatedTarget instanceof Node&&e.currentTarget.form?.contains(e.relatedTarget)||s(i,!0)},style:T}),(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,t.jsx)("button",{type:"submit",style:g,children:"Save"}),(0,t.jsx)("button",{type:"button",onClick:c,style:g,children:"Cancel"}),d?(0,t.jsx)("button",{type:"button","aria-pressed":n,onClick:()=>w(!n),style:g,children:n?"Write":"Preview"}):null,(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"Ctrl or \u2318 Enter saves \xB7 Esc puts it back"})]})]})}var k={minHeight:"7.5em",padding:"8px 10px",border:"1px dashed var(--graview-edge-bright)",borderRadius:6,lineHeight:1.6,minWidth:0},g={font:"inherit",fontSize:"0.8125rem",minHeight:28,padding:"2px 12px"},T={font:"inherit",lineHeight:1.5,width:"100%",boxSizing:"border-box",minHeight:"7.5em",padding:"8px 10px",resize:"vertical",fieldSizing:"content",color:"var(--graview-ink)",background:"var(--graview-panel, transparent)",border:"1px solid var(--graview-edge-bright)",borderRadius:6};export{E as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{L as N,P as T,S as L,Wb as O,Zb as z,td as E}from"./chunk.ZDUKVXBI.js";var _=()=>(__graviewPreload(import.meta.url,["./chunk.73RMM4W7.js","./chunk.KFYSKZC4.js","./chunk.M5FP4Y4Q.js","./chunk.O5P6LXHF.js","./chunk.ZDUKVXBI.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.MU5JK5TK.js"));function I(n,c,u){let o=new Map;for(let i of u?.kinds??[])for(let l of n.nodesOfKind(i))c.has(l.id)||o.set(l.id,l);let s=new Set([...c,...o.keys()]),m=new Set(u?.edges??[]),p=new Set;if(m.size>0&&c.size>0){for(let i of c)for(let l of n.outEdges(i))m.has(l.kind)&&o.has(l.to)&&p.add(l.to);for(let i of o.keys())n.outEdges(i).some(l=>m.has(l.kind)&&c.has(l.to))&&p.add(i)}let w=new Map([...[...o].filter(([i])=>p.has(i)),...[...o].filter(([i])=>!p.has(i))]),g=[];if(m.size>0)for(let i of s)for(let l of n.outEdges(i))m.has(l.kind)&&s.has(l.to)&&g.push({kind:l.kind,from:l.from,to:l.to});return{nodes:[...w.values()],edges:g}}function W(n,c,u){let o=[];return()=>{let s=u();for(;o.length>0&&o[0]<=s-c;)o.shift();return o.length>=n?!1:(o.push(s),!0)}}function J(n={},c=Date.now){return{act:W(n.acts??30,n.actWindowMs??6e4,c),message:W(n.messages??120,n.messageWindowMs??1e3,c)}}var M=n=>typeof n=="object"&&n!==null&&!Array.isArray(n);function U(n,c){let u=c.flatMap(s=>M(s)&&typeof s.kind=="string"?[s.kind]:[]),o=E(n,u);return Object.keys(o).length>0?{choices:o}:{}}function V(n,c){let u=structuredClone(c),o=n.schema.tryDefinition(u.kind),s=u.label;return{...u,label:o?.label?o.label(u):typeof s=="string"&&s.length>0?s:u.id}}var Z=3;function q(n,c){let u=c.later??((t,v)=>{let k=setTimeout(t,v);return()=>clearTimeout(k)}),o=(t,v,k)=>Math.abs(t-v-k.over)<=1||Math.abs(t/v-k.ratio)<=.002,s,m,p=0,w,g,i,l=()=>{w?.cancel(),g?.cancel(),w=void 0,g=void 0,i=void 0,m=void 0,p=0},b=t=>(s=t,!0),R=(t,v)=>Math.abs(t-v)<=1;return{takes(t){if(s===void 0||s<=0||t<=s)return l(),b(t);if(i!==void 0)return R(t,i)?!1:(l(),b(t));if(w)return R(t,w.refused)?!1:(l(),b(t));if(g){let x=g;return g.cancel(),g=void 0,o(t,s,x.step)?(i=t,c.say(`The view "${n}" asked to be ${x.step.over}px taller than its frame each time its frame was made taller, ${x.times} times running, so it is held at ${s}px: a page sized by its own frame (100vh) grows with it. Size the page by its content, or ask for a height (guest.size).`,s),!1):(l(),b(t))}let v={over:t-s,ratio:t/s};if(p=m&&o(t,s,m)?p+1:0,m=v,p<Z)return b(t);let k=p+2;return w={refused:t,cancel:u(()=>{w=void 0,s=t,g={step:v,times:k,cancel:u(()=>{g=void 0,m=void 0,p=0},C)},c.apply(t)},C)},!1},pushed(){w||g||i!==void 0||(m=void 0,p=0)},dispose(){w?.cancel(),g?.cancel()}}}var C=600;function ee(n){let c=n.limiter??J(n.limits,n.now),u=n.limits?.maxHeight??4e3,o=`view:${n.view}`,s={applied:0,refused:0,dropped:0},m=()=>n.store.seenBy(n.principal),p=e=>V(n.store,e),w=()=>{if(n.props)return n.props();let e=m(),f=e.graph,r=n.input?.()??{},y=r.node?f.getNode(r.node.id):void 0,a=r.nodes?.flatMap(d=>{let S=f.getNode(d.id);return S?[S]:[]}),G=new Set([...y?[y.id]:[],...(a??[]).map(d=>d.id)]),h=[];for(let d of G)for(let S of f.outEdges(d))G.has(S.to)&&h.push({kind:S.kind,from:S.from,to:S.to});let P=I(f,G,n.reads),$=new Set(h.map(d=>`${d.kind} ${d.from} ${d.to}`));for(let d of P.edges)$.has(`${d.kind} ${d.from} ${d.to}`)||h.push(d);let A=P.nodes.length>0?[...a??[],...P.nodes]:a,H=d=>d?.filter(S=>f.has(S)),F=e.permittedMutations(n.principal).map(d=>({name:d.name,title:d.title??d.name,...d.description!==void 0?{description:d.description}:{},...d.subject?{subject:{kinds:d.subject.kinds,arg:d.subject.arg}}:{}}));return{view:n.view,...y?{node:p(y)}:{},...A?{nodes:A.map(p)}:{},edges:h,...r.label!==void 0?{label:r.label}:{},...r.fidelity!==void 0?{fidelity:r.fidelity}:{},...r.cardinality!==void 0?{cardinality:r.cardinality}:{},...r.mode!==void 0?{mode:r.mode}:{},...r.selected!==void 0?{selected:r.selected}:{},...r.implicated?{implicated:H(r.implicated)}:{},...r.flagged?{flagged:H(r.flagged)}:{},acts:F,...n.theme?{theme:n.theme()}:{},locale:T(),timeZone:L(),today:n.store.today()??N(),...U(n.store.schema,[...y?[y]:[],...A??[]]),...n.placesShown?{places:n.placesShown().map(({as:d,title:S,kind:K})=>({as:d,title:S,kind:K}))}:{}}},g=q(n.view,{say:(e,f)=>n.onHeld?.(e,f),apply:e=>!i&&n.onSize?.(e)}),i=!1,l=0,b=new Set,R=()=>{if(i)return;l+=1,g.pushed(),b.add(l),b.size>100&&b.delete(b.values().next().value);let e=w();n.send({type:"props",props:n.hand?n.hand(e):e,push:l})},t=!1,v=n.store.subscribe(()=>{t||(t=!0,queueMicrotask(()=>{t=!1,R()}))}),k=(e,f)=>(s.refused+=1,{ok:!1,reason:e,message:f}),x=(e,f,r)=>j([{name:e,args:f}],r),j=(e,f,r)=>{if(!c.act())return k("rate-limited","Too many acts asked for at once; this one was not applied.");let y=[];for(let{name:a,args:G}of e){if(f){let h=f(a,G);if(!h.ok)return k(h.reason,h.message);a=h.name,G=h.args}if(!n.store.allMutations().some(h=>h.name===a))return k("unknown-act","There is no act by that name here.");y.push({name:a,args:G})}try{let a=n.store.applyAll(y,{author:n.principal,via:o,...r?{intent:r}:{}});return s.applied+=1,{ok:!0,intent:a.intent}}catch(a){return a instanceof O?k("refused",a.refusal.message):a instanceof z?k("failed",Q(a)):k("failed","The act could not be applied.")}},D=(e,f,r)=>{let y=Array.isArray(r);if(typeof f!="string"||(y?r.length===0||r.length>100||!r.every(M):!M(r)))return s.refused+=1,n.send({type:"answer",id:e,ok:!1,reason:"malformed",message:"An act is asked for by name, with its arguments as an object, or a list of 1 to 100 of them for several as one change."});let a=j((y?r:[r]).map(G=>({name:f,args:G})),n.judgeAct);n.send(a.ok?{type:"answer",id:e,ok:!0,intent:a.intent}:{type:"answer",id:e,ok:!1,reason:a.reason,message:a.message})};return{receive(e){if(i)return;if(!(M(e)&&e.nonce===n.nonce&&e.type==="pushed"&&typeof e.push=="number"&&b.delete(e.push))&&!c.message()){s.dropped+=1,n.onFlood?.();return}if(!M(e)||e.nonce!==n.nonce){s.dropped+=1;return}if(e.type==="act"&&(typeof e.id=="string"||typeof e.id=="number"))return D(e.id,e.name,e.args);if(e.type==="navigate"&&n.onArrive&&(typeof e.place=="string"||typeof e.to=="string")){let r={...e.where!==void 0?{where:e.where}:{},...e.section!==void 0?{section:e.section}:{}},y=typeof e.place=="string"?{place:e.place,...r}:{record:e.to,...r},a=n.onArrive;_().then(({judgeDestination:G,listsOf:h,placeVocabulary:P})=>{if(i)return;let $=new Set([...n.store.kindsKeptFrom(n.principal),...n.store.modules.disabledKinds]),A=G(y,{sees:H=>m().graph.has(H),places:P(n.store.schema,n.placesShown?.()??[],{kept:$}),lists:h(n.store.schema,$),schema:n.store.schema});A.ok?a(A.arrival):(s.dropped+=1,n.onLost?.(A.says))});return}if(e.type==="navigate"&&typeof e.place=="string"){n.places?.().includes(e.place)?n.onNavigatePlace?.(e.place):s.dropped+=1;return}if(e.type==="navigate"&&typeof e.to=="string"){m().graph.has(e.to)?n.onNavigate?.(e.to):s.dropped+=1;return}if(e.type==="mine"&&(typeof e.id=="string"||typeof e.id=="number")&&n.mine){let r=e.id,y=a=>{i||n.send({type:"mine-answer",id:r,...a})};e.op==="set"?n.mine.set(e.key,e.value).then(y):typeof e.key=="string"?n.mine.get(e.key).then(y):y({ok:!0,value:null});return}if(e.type==="render"&&Array.isArray(e.records)&&n.onRender){n.onRender(e.records);return}if(e.type==="style"&&Array.isArray(e.sheets)&&e.sheets.every(r=>typeof r=="string")&&n.onStyle){n.onStyle(e.sheets);return}if(e.type==="hears"&&Array.isArray(e.events)&&n.onHears){n.onHears(e.events.filter(r=>typeof r=="string").slice(0,20));return}if(e.type==="clicks"&&Array.isArray(e.selectors)){let r=y=>(Array.isArray(y)?y:[]).filter(a=>typeof a=="string"&&a.length<=500).slice(0,200);n.onClicks?.(r(e.selectors),r(e.acted));return}if(e.type==="gestures"&&Array.isArray(e.bound)&&n.onGestures){n.onGestures(e.bound.slice(0,32));return}if(e.type==="pushed"&&typeof e.push=="number"&&typeof e.ms=="number"&&n.onPushed){n.onPushed(e.push,e.ms);return}if(e.type==="size"&&typeof e.height=="number"&&Number.isFinite(e.height)){let r=Math.max(0,Math.min(u,Math.round(e.height)));g.takes(r)&&n.onSize?.(r);return}s.dropped+=1},push:R,pressed(e){return i?{ok:!1,reason:"refused",message:"The view has gone."}:e.ok?x(e.name,e.args):(s.refused+=1,e)},change(e,f){return i?{ok:!1,reason:"refused",message:"The view has gone."}:j(e,void 0,f)},get stats(){return s},dispose(){i=!0,g.dispose(),v()}}}var B=n=>({number:"a number",string:"text",boolean:"yes or no",date:"a date",array:"a list",object:"a set of values"})[n.toLowerCase()]??`a ${n}`;function Q(n){return`Not applied: ${X(n)}.`}function X(n){return n.issues.slice(0,4).map(u=>{let o=u.path.map(String).join("."),s=/expected (\w+)/i.exec(u.message)?.[1];return o?s&&/^invalid (input|type)/i.test(u.message)?`\u201C${o}\u201D expects ${B(s)}`:`\u201C${o}\u201D: ${u.message.charAt(0).toLowerCase()}${u.message.slice(1)}`:u.message}).join("; ")||"its arguments did not fit"}export{I as a,J as b,U as c,V as d,ee as e,Q as f,X as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as G,b as q}from"./chunk.SI5GGFQR.js";import{e as Ke}from"./chunk.XMBGT6UT.js";import"./chunk.NVPKYWMF.js";import{b as je}from"./chunk.YGGBGHZU.js";import"./chunk.PGT4ZQDG.js";import{a as Ne,c as K,d as Me}from"./chunk.FKSI5522.js";import{b as He}from"./chunk.L6BLZJ6K.js";import"./chunk.VNI6HZEF.js";import"./chunk.THLT6NVO.js";import"./chunk.HIIYDKFC.js";import"./chunk.GYP3EF6Z.js";import"./chunk.KMFH26SS.js";import"./chunk.YF5GCOSZ.js";import"./chunk.F2BZ4SC4.js";import"./chunk.WAPY4RCS.js";import"./chunk.JJSZLCNU.js";import"./chunk.JKX4J3KG.js";import"./chunk.JMXBMLKH.js";import"./chunk.PVAYYFT2.js";import"./chunk.HJCQ6I3S.js";import"./chunk.QNFX5VHW.js";import{e as Te}from"./chunk.UXW43HNW.js";import"./chunk.LG2BQ5LB.js";import"./chunk.L3ST2YKI.js";import"./chunk.7VCYVCYM.js";import"./chunk.MFNWHXGL.js";import"./chunk.DCIYOZYP.js";import{a as ee,b as Ie,c as ne,f as Pe,j as $e,l as Re}from"./chunk.IZKCTF2R.js";import"./chunk.G4JJXA63.js";import{a as xe}from"./chunk.TBY5IR7C.js";import"./chunk.JP33TNCH.js";import"./chunk.BIDL7GQD.js";import"./chunk.O5P6LXHF.js";import"./chunk.4VX7GPFS.js";import"./chunk.FQ2QUDZS.js";import"./chunk.BJUUSIQY.js";import"./chunk.VGQDPEB5.js";import"./chunk.WIVNFOQR.js";import"./chunk.ONVYKLRX.js";import"./chunk.XOZU4OFA.js";import"./chunk.53GQQETN.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.7DCBIMOI.js";import"./chunk.GXK5PI7I.js";import"./chunk.DYPSFTRP.js";import"./chunk.WVUJXDXZ.js";import"./chunk.J7GH2CGV.js";import{a as Ae}from"./chunk.SMF5S4DQ.js";import"./chunk.XP4IVKKR.js";import"./chunk.R5YGW5ZX.js";import"./chunk.QMGBAKX6.js";import"./chunk.PS765ODQ.js";import"./chunk.MIE4TJRW.js";import{s as Ee}from"./chunk.DEBW4FH6.js";import"./chunk.RD2FSSLV.js";import"./chunk.OWHH7JDV.js";import"./chunk.T3RFZ66S.js";import"./chunk.TDWJU6GW.js";import"./chunk.P3Z4ZCL3.js";import"./chunk.45OLF6BK.js";import"./chunk.T6ISUVUP.js";import{G as Le}from"./chunk.GH6QX7JR.js";import{c as mn}from"./chunk.J4D4BIB4.js";import{D as ve,G as hn,_ as De,ia as Z,ka as Ce}from"./chunk.ASNVH2G4.js";import"./chunk.SDO3U72B.js";import{L as we,ea as ke,la as Y,ma as be,sa as Oe,va as Se}from"./chunk.ZDUKVXBI.js";import"./chunk.FQLNBIQ5.js";import{b as _}from"./chunk.AJZBJBMO.js";var u=_(hn(),1),sn=_(mn(),1);var ie=e=>e.lens==="blocks",te=(e,n)=>e.place===void 0&&e.filter!==void 0&&e.filter!==""&&ie(n),Fe=4,gn=/^\d{4}-\d{2}-\d{2}/,wn=e=>e.charAt(0).toUpperCase()+e.slice(1),We=(e,n)=>e.tryDefinition(n)?.fields?.shape??{};function kn(e,n){let t=We(e,n),r=Object.keys(t).filter(i=>{let d=Ae(t[i]);return d?.type==="enum"&&!d.multiple}),o=Te(e,n)?.field;return o&&r.includes(o)?[o,...r.filter(i=>i!==o)]:r}function bn(e,n,t){let r=d=>t.some(c=>typeof c[d]=="string"&&gn.test(c[d])),o=Me(e,n);if(o&&r(o.field))return{start:o.field,...o.end?{end:o.end}:{},...o.done?{done:o.done}:{}};let i=Object.keys(We(e,n)).find(d=>["date","datetime"].includes(K(e,n,d)??"")&&r(d));return i?{start:i}:void 0}function On(e){let{app:n,kind:t,nodes:r,today:o}=e,i=n.schema,d=i.tryDefinition(t),c=m=>Oe(d,m).toLowerCase(),s=m=>r.some(C=>C[m]!==void 0&&C[m]!==null&&C[m]!==""),h=kn(i,t).filter(s),p=[],l=h[0];l&&r.length<=Ne&&p.push({recipe:{lens:"columns",kind:t,column:l},label:`Board by ${c(l)}`,phrase:`a board by ${c(l)}`,shape:"board"});let y=bn(i,t,r);if(y){let m=o.slice(0,7),C=r.some(b=>typeof b[y.start]=="string"&&b[y.start].startsWith(m)),A={lens:"calendar",kind:t,start:y.start,...y.end?{end:y.end}:{},...y.done?{done:y.done}:{},range:"month"};p.push(C?{recipe:A,label:`Calendar by ${c(y.start)}`,phrase:`a calendar by ${c(y.start)}`,shape:"calendar"}:{recipe:{lens:"blocks",kind:t,as:"row",sort:{by:y.start}},label:`In order of ${c(y.start)}`,phrase:`a list in order of ${c(y.start)}`,shape:"order"})}let S=d?.fieldRoles??{},[v,I,D]=[S.start,S.end,S.column??S.day];v&&I&&D&&K(i,t,v)==="number"&&K(i,t,I)==="number"&&K(i,t,D)==="enum"&&s(v)&&s(D)&&p.push({recipe:{lens:"timeline",kind:t,start:v,end:I,column:D},label:`Timeline by ${c(D)}`,phrase:`a timeline by ${c(D)}`,shape:"timeline"});for(let[m,C]of Object.entries(d?.edges??{})){let A=Array.isArray(C?.to)?C.to.find(w=>w!==t&&i.tryDefinition(w)):void 0;if(!A||!e.linked||!r.some(w=>e.linked(w.id,m)))continue;let b=Se(i.tryDefinition(A),A);p.push({recipe:{lens:"coverage",kind:t,across:A,link:m},label:`Grid by ${b}`,phrase:`a grid by ${b}`,shape:"grid"});break}return p.push({recipe:{lens:"blocks",kind:t,as:"card"},label:"Cards",phrase:"cards",shape:"cards"}),l?p.push({recipe:{lens:"blocks",kind:t,as:"row",group:l},label:`Rows by ${c(l)}`,phrase:`rows by ${c(l)}`,shape:"rows"}):e.place!==void 0&&p.push({recipe:{lens:"blocks",kind:t,as:"row"},label:"Rows",phrase:"rows",shape:"rows"}),p}var L=e=>JSON.stringify([e.name??e.lens,e.bindings??{},e.options?.blocks??e.options?.range??null]);function _e(e){return e.name==="columns"?"board":e.name==="coverage"?"grid":e.name==="blocks"?e.options?.blocks?.some(n=>n.as==="card")?"cards":"rows":e.name}var T=e=>e.lenses??[],Ge=(e,n)=>e.on===n||e.on===void 0&&Object.prototype.hasOwnProperty.call(e.bindings??{},n),se=e=>e.app.pages?.lists?.[e.kind]?.opens;function qe(e,n){let t={lens:n.name,on:e.kind,...n.bindings?{bindings:n.bindings}:{},...n.options?{options:n.options}:{}};if(e.place!==void 0){let r=T(e.app).find(o=>o.title===e.place);return[{op:"add-lens",title:e.place,...t,replace:e.place,...r?.create===!1?{create:!1}:{}}]}return[{op:"add-lens",title:n.title,...t},{op:"set-lens-hidden",title:n.title,on:e.kind,hidden:!0},B(e,n.title)]}var B=(e,n)=>({op:"arrange-pages",opens:{[e.kind]:n}}),Be=(e,n)=>{if(e.place!==void 0)return;let t=L(n),r=JSON.stringify(n.options??{});return T(e.app).find(o=>o.hidden===!0&&Ge(o,e.kind)&&L(o)===t&&JSON.stringify(o.options??{})===r)};function oe(e,n){if(!e.compose||!e.document)return!1;try{return e.compose({document:e.document,edits:n}).ok}catch{return!1}}function Sn(e,n){let t=new Set(T(e).map(r=>r.title));if(!t.has(n))return n;for(let r=2;;r++)if(!t.has(`${n} ${r}`))return`${n} ${r}`}var Ue=e=>{let n=e.place===void 0?void 0:T(e.app).find(t=>t.title===e.place);return n!==void 0&&G(n,e.kind)};function Je(e){let n=e.place??se(e),t=n===void 0?void 0:T(e.app).find(r=>r.title===n);return t&&!G(t,e.kind)?L(t):void 0}function Ve(e,n,t){if(Ue(e))return;let r=Pe(n),o=L(r);if(o===Je(e))return;let i={...r,on:e.kind,title:Sn(e.app,r.title)},d=ne(e.app,i,e.sight);if(!d.ok||te(e,d.drawn))return;let c=Be(e,i);if(c&&c.title===se(e))return;let s=c?[B(e,c.title)]:qe(e,i);if(oe(e,s))return{...t,shape:_e(i),title:c?.title??i.title,drawing:o,drawn:d.drawn,edits:s}}function ze(e){if(e.nodes.length===0||Ue(e))return[];let n=Je(e),t=new Set(n?[n]:[]),r=[];if(e.place===void 0)for(let o of T(e.app)){if(o.title===void 0||o.hidden===!0||!Ge(o,e.kind)||o.title===se(e)||G(o,e.kind))continue;let i=ne({...e.app,lenses:T(e.app).filter(s=>s!==o)},{...o,on:e.kind},e.sight);if(!i.ok||te(e,i.drawn))continue;let d=[B(e,o.title)];if(!oe(e,d))continue;let c=L(o);t.add(c),r.push({key:`place:${o.title}`,label:o.title,phrase:`\u201C${o.title}\u201D`,shape:_e(o),from:"place",title:o.title,drawing:c,drawn:i.drawn,edits:d})}for(let o of On(e)){let i=$e(o.recipe,{app:e.app,...e.sight?{sight:e.sight}:{}});if(ee(i)||te(e,i.drawn))continue;let d=L(i.lens);if(t.has(d))continue;let c=Be(e,i.lens),s=c?[B(e,c.title)]:qe(e,i.lens);oe(e,s)&&(t.add(d),r.push({key:`${o.shape}:${d}`,label:o.label,phrase:o.phrase,shape:o.shape,from:"graview",title:c?.title??i.lens.title,drawing:d,drawn:i.drawn,edits:s}))}for(let o of e.offers??[]){let i=ae(e,o);!i||t.has(i.drawing)||(t.add(i.drawing),r.push(i))}return Cn(r,e.choices??[],e.kind)}var vn=e=>{let n=e;return typeof n?.id=="string"&&n.id!==""&&typeof n.label=="string"&&n.label!==""&&typeof n.lens=="object"&&n.lens!==null};function ae(e,n){if(vn(n))try{return Ve(e,n.lens,{key:`host:${n.id}`,label:n.label,phrase:ke(n.label),from:"host",hostId:n.id,...typeof n.weight=="number"?{weight:n.weight}:{}})}catch{return}}function Qe(e,n){try{let t=e?.offers?.(n);if(Array.isArray(t))return{now:t};if(typeof t?.then=="function")return{now:[],late:Promise.resolve(t).then(r=>Array.isArray(r)?r:[],()=>[])}}catch{}return{now:[]}}function Xe(e){try{let n=e?.chosen?.();return Array.isArray(n)?n.filter(Ze):[]}catch{return[]}}async function Ye(e,n){try{let t=await Re(`Whatever would make ${e.name.toLowerCase()} clearest to read`,{app:e.app,complete:n,...e.sight?{sight:e.sight}:{}});if(ee(t))return;let r=t.lens;return Ve(e,{lens:r.name,title:r.title,...r.bindings?{bindings:r.bindings}:{},...r.options?{options:r.options}:{}},{key:`model:${L(r)}`,label:wn(r.title),phrase:`\u201C${r.title}\u201D`,from:"model"})}catch{return}}function Dn(e,n,t){let r=o=>n.reduce((i,d)=>i+(d.key===o.key||d.shape===o.shape?d.kind===t?3:1:0),o.weight??0);return e.map((o,i)=>({option:o,at:i,score:r(o)})).sort((o,i)=>i.score-o.score||o.at-i.at).map(o=>o.option)}function Cn(e,n,t){let r=Dn(e,n,t),o=r.slice(0,Fe),i=r.find(d=>d.from==="host");return i&&!o.includes(i)&&(o[o.length-1]=i),o}var Ze=e=>{let n=e;return typeof n?.key=="string"&&typeof n.shape=="string"&&typeof n.kind=="string"},re=e=>`graview:display-choices:${e}`,An=40,en=new Map;function U(e){try{let n=JSON.parse(localStorage.getItem(re(e))??"null");if(Array.isArray(n))return n.filter(Ze)}catch{}return en.get(e)??[]}function nn(e,n){en.set(e,n);try{n.length===0?localStorage.removeItem(re(e)):localStorage.setItem(re(e),JSON.stringify(n))}catch{}}function En(e,n){nn(e,[...U(e),n].slice(-An))}function xn(e,n,t){nn(e,U(e).filter(r=>!(r.key===n&&r.at===t)))}function In(e,n){let t=`${n} shows as ${e.phrase}.`;return{said:t,add:[],drop:[],card:{said:t,adds:[],keeps:[],drops:[],breaking:[]},edits:e.edits}}function tn(e){let n=new Set,t={options:e.options,shown:null,phase:"choosing",canUndo:!1},r,o,i=[],d=s=>{t={...t,...s},n.forEach(h=>h())},c=s=>{if(o)try{e.onKept?.({kept:o,offered:i,undone:s})}catch{}};return{get:()=>t,subscribe(s){return n.add(s),()=>void n.delete(s)},flip(s){if(t.phase!=="choosing"||s===t.shown||s!==null&&!t.options.some(l=>l.key===s))return;let{said:h,...p}=t;t=p,d({shown:s})},join(s){if(t.phase!=="choosing")return;let h=s.filter(l=>!t.options.some(y=>y.key===l.key||y.drawing===l.drawing));if(h.length===0)return;let p=[...t.options,...h];for(let l=p.length-1;l>=0&&p.length>Fe;l--)p[l].from!=="host"&&p[l].from!=="model"&&p[l].key!==t.shown&&p.splice(l,1);d({options:p})},drop(s){t.options.some(h=>h.key===s)&&d({options:t.options.filter(h=>h.key!==s),shown:t.shown===s?null:t.shown})},async keep(){let s=t.options.find(p=>p.key===t.shown);if(!s||t.phase!=="choosing")return;d({phase:"keeping"});let h;try{h=await e.propose(In(s,e.name))}catch{return d({phase:"choosing",said:"It couldn't be kept."})}if(h==="declined")return d({phase:"choosing",said:"It wasn't kept."});typeof h=="object"&&(r=h.undo),i=t.options.map(p=>p.key),o={key:s.key,kind:e.kind??"",shape:s.shape,from:s.from,...s.hostId?{hostId:s.hostId}:{},at:new Date().toISOString()},e.appKey!==void 0&&En(e.appKey,o),c(!1),d({phase:"kept",said:`${e.name} now shows as ${s.phrase}.`,canUndo:r!==void 0,...typeof h=="object"&&h.note?{note:h.note}:{}})},async undo(){let s=r;if(t.phase!=="kept"||!s)return;r=void 0;try{await s()}catch{return r=s,d({said:"It couldn't be put back."})}o&&e.appKey!==void 0&&xn(e.appKey,o.key,o.at),c(!0);let{note:h,...p}=t;t=p,d({phase:"undone",said:`${e.name} is as it was.`,canUndo:!1})}}}function on(e,n,t){let r=e.tryDefinition(n);return t.slice(0,200).map(o=>be(r,o)).filter(o=>o.length>1)}var k=_(De(),1),de=new Map,Pn=e=>e?.querySelector("main")??e??null,J=e=>Pn(e.main?.isConnected?e.main:document.querySelector("[data-graview-page-main], main")??document.querySelector("[data-graview-face]"));function rn(e){let n=e.querySelector("[data-graview-page-title]"),t=n?.closest("header")??n?.parentElement??null;return t&&t!==e&&e.contains(t)?t:null}var M="data-graview-under-option",le="data-graview-option-wide",N="__now__",$n=(0,u.memo)(function({option:n,shown:t,names:r,nodes:o,drew:i,failed:d}){let c=(0,u.useRef)(null),s=(0,u.useRef)(null);(0,u.useLayoutEffect)(()=>{s.current&&(s.current.inert=!0)},[]),(0,u.useLayoutEffect)(()=>{let l=()=>{let S=(c.current?.textContent??"").toLowerCase();return r.some(v=>S.includes(v.toLowerCase()))};if(l())return i(n.key);let y=[100,400,1500].map((S,v,I)=>setTimeout(()=>{l()?i(n.key):v===I.length-1&&d(n.key)},S));return()=>y.forEach(clearTimeout)},[n.key]);let h=(0,u.useMemo)(()=>He(n.drawn),[n.drawn]),p=ie(n.drawn);return(0,k.jsx)("div",{ref:c,"data-testid":"display-option-pane","data-display-option":n.key,"data-shown":t?"":void 0,style:{...p?Hn:Tn,...t?{}:Nn},children:(0,k.jsx)("div",{ref:s,style:p?void 0:Mn,children:(0,k.jsx)(Ee,{kind:n.drawn.kinds[0]??"",view:n.title,children:(0,k.jsx)(h,{nodes:o,label:n.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1})})})})});function Rn({options:e,shown:n,names:t,drew:r,failed:o,kind:i,filter:d}){let{store:c}=Z();Ce();let s=c.schema.tryDefinition(i),h=c.graph.nodesOfKind(i).filter(y=>Y(s,y)),p=d?new Set(c.violations().flatMap(y=>y.nodeIds)):void 0,l=q(c.schema,c.graph,i,h,d,p);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)("style",{children:`[${M}]{display:none !important}[${le}]{max-width:1160px !important}`}),e.map(y=>(0,k.jsx)($n,{option:y,shown:y.key===n,names:t,nodes:l,drew:r,failed:o},y.key))]})}function rt({ask:e,close:n}){let t=Z(),{ai:r,app:o,brand:i,composeChange:d,displayOptions:c,onProposeChange:s,principal:h,store:p}=t,l=e.part,y=l.kind,S=Le(i,p.schema),v=()=>p.graph.nodesOfKind(y).filter(a=>Y(p.schema.tryDefinition(y),a)),[I]=(0,u.useState)(()=>on(p.schema,y,q(p.schema,p.graph,y,v(),l.filter,l.filter?new Set(p.violations().flatMap(a=>a.nodeIds)):void 0))),[D]=(0,u.useState)(()=>{let a=de.get(e.at);if(a)return a;let f={...o,schema:p.schema},g={app:f,document:je(o??{}),compose:d,kind:y,name:l.name,nodes:v(),today:p.today()??we(),sight:Ie(f,h),linked:(x,H)=>p.graph.outEdges(x).some(R=>R.kind===H),...l.slot==="place"?{place:l.name}:{},...l.filter?{filter:l.filter}:{}},E=[...U(S),...Xe(c)],un={kind:y,name:l.name,...l.slot==="place"?{place:l.name}:{}},me=Qe(c,un),X=tn({options:ze({...g,choices:E,offers:me.now}),name:l.name,kind:y,appKey:S,propose:x=>s(x),...c?.onChoice?{onKept:c.onChoice}:{}});if(me.late?.then(x=>X.join(x.flatMap(H=>ae(g,H)??[]))),ve(r)){let x=r.thinking,H=x?R=>x.think({prompt:R.prompt,system:R.system??"",state:{},catalog:[]}):r.complete;H&&Ye(g,H).then(R=>R?X.join([R]):void 0)}let ge={flips:X,opened:!1};return de.set(e.at,ge),ge}),{flips:m}=D,C=(0,u.useSyncExternalStore)(m.subscribe,m.get,m.get),{options:A,shown:b,phase:w,said:ce,note:pe}=C,P=w==="choosing"||w==="keeping",[dn,ln]=(0,u.useState)(()=>new Set),cn=(0,u.useMemo)(()=>a=>ln(f=>f.has(a)?f:new Set([...f,a])),[]),pn=(0,u.useMemo)(()=>a=>m.drop(a),[m]),j=A.filter(a=>dn.has(a.key));(0,u.useEffect)(()=>{D.opened||w!=="choosing"||j.length===0||(D.opened=!0,m.flip(j[0].key))},[D,m,w,j]);let[O,fe]=(0,u.useState)(null);(0,u.useLayoutEffect)(()=>{if(!P)return;let a=J(l);if(!a)return;let f=document.createElement("div");f.setAttribute("data-testid","display-options-stage"),Object.assign(f.style,Ln);let g=rn(a);return g?.parentElement?g.parentElement.insertBefore(f,g.nextSibling):a.insertBefore(f,a.firstChild),fe(f),()=>{f.remove(),fe(null)}},[P]),(0,u.useLayoutEffect)(()=>{let a=O?J(l):null;if(!a)return;let f=b===null;if(O.style.position=f?"absolute":"relative",O.style.height=f?"0":"auto",O.style.visibility=f?"hidden":"visible",O.setAttribute("data-display-shown",b??N),!f){a.setAttribute(le,"");for(let g=O;g!==a&&g.parentElement;g=g.parentElement)for(let E of g.parentElement.children)E!==g&&E!==rn(a)&&E.localName!=="style"&&E.setAttribute(M,"")}return()=>{a.removeAttribute(le);for(let g of a.querySelectorAll(`[${M}]`))g.removeAttribute(M)}});let ye=()=>{de.delete(e.at),n()},F=()=>{let a=J(l);for(let g of a?.querySelectorAll(`[${M}]`)??[])g.removeAttribute(M);O&&(O.style.display="none");let f=e.returnTo?.isConnected?e.returnTo:document.querySelector("[data-graview-page-title], main h1");f&&!f.hasAttribute("tabindex")&&!f.matches("a[href], button, input, select, textarea")&&f.setAttribute("tabindex","-1"),f?.focus?.({preventScroll:!0}),ye()};(0,u.useEffect)(()=>{if(!P||!O)return;let a=location.pathname,f=()=>J(l)?.querySelector("[data-graview-page-title]")?.textContent??null,g=f(),E=setInterval(()=>{m.get().phase!=="keeping"&&(location.pathname!==a||!O.isConnected||f()!==g)&&ye()},250);return()=>clearInterval(E)},[P,O]);let ue=(0,u.useRef)(F);ue.current=F,(0,u.useEffect)(()=>{let a=f=>{f.key!=="Escape"||m.get().phase==="keeping"||document.querySelector("[data-graview-popover]:not([data-better-bar]):not([hidden]), [data-testid='context-menu']")||(f.preventDefault(),ue.current())};return document.addEventListener("keydown",a,!0),()=>document.removeEventListener("keydown",a,!0)},[m]);let W=xe(p,h);(0,u.useEffect)(()=>{!W&&w==="choosing"&&F()},[W,w]);let V=(0,u.useRef)(null),he=(0,u.useRef)(!1);(0,u.useEffect)(()=>{w!=="choosing"||b===null||he.current||(he.current=!0,V.current?.querySelector('[role="radio"][aria-checked="true"]')?.focus({preventScroll:!0}))},[w,j.length,b]);let $=[{key:N,label:"As it is now"},...j],fn=a=>{let f=a.key==="ArrowRight"||a.key==="ArrowDown"?1:a.key==="ArrowLeft"||a.key==="ArrowUp"?-1:0,g=f!==0?$[($.findIndex(E=>E.key===(b??N))+f+$.length)%$.length]:a.key==="Home"?$[0]:a.key==="End"?$.at(-1):void 0;g&&(a.preventDefault(),m.flip(g.key===N?null:g.key),V.current?.querySelector(`[data-option="${CSS.escape(g.key)}"]`)?.focus({preventScroll:!0}))},z=A.find(a=>a.key===b),yn=P?ce??(z?z.label:`${l.name} as it is now`):ce??"",Q=w==="choosing"&&A.length===0;return(0,k.jsxs)(k.Fragment,{children:[O&&P?(0,sn.createPortal)((0,k.jsx)(Rn,{options:A,shown:b,names:I,drew:cn,failed:pn,kind:y,filter:l.filter}),O):null,(0,k.jsx)(Ke,{phase:`options-${w}`,name:l.name,said:Q?`There are no other ways to show ${l.name} yet.`:yn,...P&&!Q?{scope:"Nothing changes until you keep one. Everyone in this app sees the one you keep."}:{},...pe?{note:pe}:{},...w==="choosing"&&z&&W?{keep:()=>void m.keep()}:{},...w==="kept"&&C.canUndo&&W?{undo:()=>void m.undo()}:{},...w!=="keeping"?{close:F}:{},children:w==="choosing"&&!Q?(0,k.jsx)("div",{ref:V,role:"radiogroup","aria-label":`Ways to show ${l.name}`,"data-testid":"display-options",onKeyDown:fn,style:jn,children:$.map(a=>{let f=a.key===(b??N);return(0,k.jsx)("button",{type:"button",role:"radio","aria-checked":f,tabIndex:f?0:-1,"data-testid":"display-option","data-option":a.key,onClick:()=>m.flip(a.key===N?null:a.key),style:f?Kn:an,children:a.label},a.key)})}):null})]})}var Ln={position:"relative",minWidth:"0",maxWidth:"100%",width:"100%",overflow:"clip"},Tn={boxSizing:"border-box",height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",gridTemplateColumns:"minmax(0, 1fr)",overflow:"auto",maxWidth:"100%",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)"},Hn={display:"grid",gridTemplateColumns:"minmax(0, 1fr)",maxWidth:"100%"},Nn={position:"absolute",top:0,left:0,right:0,visibility:"hidden",pointerEvents:"none"},Mn={display:"grid",gridTemplateRows:"minmax(0, 1fr)",gridTemplateColumns:"minmax(0, 1fr)",minWidth:0,minHeight:0},jn={display:"flex",flexWrap:"wrap",gap:6,marginTop:4},an={minHeight:34,padding:"0 12px",font:"inherit",borderRadius:8,cursor:"pointer",color:"var(--graview-ink)",background:"transparent",border:"1px solid var(--graview-edge)"},Kn={...an,fontWeight:600,border:"1px solid var(--graview-accent)",boxShadow:"inset 0 0 0 1px var(--graview-accent)"};export{rt as DisplaySwitch};
|