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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as ge,b as U}from"./chunk.NNK2E2EP.js";import{a as ke}from"./chunk.CEQQIW7Z.js";import{a as pe,e as ye}from"./chunk.VUE6ILQV.js";import{b as ie,c as se,d as le,e as de,f as ce,g as ue,h as me,i as fe,j as we}from"./chunk.2IOJNFCR.js";import"./chunk.AAPXF6NP.js";import"./chunk.QDVGHI7R.js";import{a as Q,b as X,d as Y}from"./chunk.TBLOBXZ2.js";import"./chunk.MIE4TJRW.js";import{w as D}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{Ba as z,G as ae,N as O,P as E,R as L,Sa as J,T as K,_ as $,ja as A,pa as _,sa as P,va as S,wa as q,ya as F}from"./chunk.ASNVH2G4.js";import"./chunk.SDO3U72B.js";import"./chunk.ZDUKVXBI.js";import"./chunk.FQLNBIQ5.js";import{b as C}from"./chunk.AJZBJBMO.js";var i=C(ae(),1);var a=C($(),1);function he(e,t){let n=e?.logo;if(!t||!n)return e;let s=o=>o.startsWith("/graview/assets/")?t(o):o;return{...e,logo:typeof n=="string"?s(n):{...n,light:s(n.light),...n.dark?{dark:s(n.dark)}:{}}}}var Ve=e=>({...e.node?{node:{id:e.node.id}}:{},...e.nodes?{nodes:e.nodes.map(t=>({id:t.id}))}:{},...e.label!==void 0?{label:e.label}:{},fidelity:e.fidelity,cardinality:e.cardinality,mode:e.mode,selected:e.selected,...e.implicated?{implicated:e.implicated}:{},...e.flagged?{flagged:e.flagged}:{}});function ne(e){let t=K(),n=t?.past?.seq,s=t?.host?.viewAt,o=(0,i.useMemo)(()=>n===void 0||!s||e.draft||e.keepsNothing?void 0:s(e.manifest.name,n),[s,n,e]);return(0,i.useMemo)(()=>o===null?null:o===void 0?e:{...e,worker:o},[o,e])}var T=new WeakMap,H=new Set,We=e=>(H.add(e),()=>void H.delete(e));function ve(e,t){t===void 0?T.delete(e):T.set(e,t);for(let n of[...H])n()}function re({definition:e,store:t,principal:n,input:s,goTo:o,places:l,arrangement:d,scheme:c,brand:f,onFailure:m,drawsItsOwn:w,tick:p}){let y=(0,i.useSyncExternalStore)(We,()=>T.get(e),()=>{}),r=(0,i.useMemo)(()=>y===void 0?e:{...e,worker:{source:y}},[e,y]),V=(0,i.useRef)(null),k=(0,i.useRef)(null),v=O(),b=E(),I=L(),R=(0,i.useContext)(_),x=(0,i.useMemo)(()=>he(f,b),[f,b]),u=(0,i.useRef)({input:s,goTo:o,places:l,arrangement:d,onFailure:m,brand:x,hostFiles:v,hostAssets:b,viewerState:I,told:R});u.current={input:s,goTo:o,places:l,arrangement:d,onFailure:m,brand:x,hostFiles:v,hostAssets:b,viewerState:I,told:R},(0,i.useEffect)(()=>{let W=V.current;if(!W)return;let j=r.file??(u.current.hostFiles?.src?g=>u.current.hostFiles?.src?.(g)??g:void 0);typeof r.worker=="function"&&U(r.worker).catch(()=>{});let B=g=>({manifest:r.manifest,worker:g,store:t,principal:n,input:()=>u.current.input?.()??{},goTo:()=>u.current.goTo,places:()=>u.current.places?.()??[],arrangement:()=>u.current.arrangement?.(),brand:()=>u.current.brand,onFailure:(h,oe)=>u.current.onFailure(h,oe),...w?{fallback:!1}:{},...r.limits?{limits:r.limits}:{},...r.author?{author:r.author}:{},...r.onProblem?{onProblem:r.onProblem}:{},...r.asset?{asset:r.asset}:u.current.hostAssets?{asset:h=>u.current.hostAssets?.(h)??h}:{},...j?{file:j}:{},...r.images?{images:r.images}:{},...r.fonts?{fonts:r.fonts}:{},...r.links?{links:r.links}:{},files:()=>u.current.hostFiles,...r.draft||r.keepsNothing?{draft:!0}:{viewerState:()=>u.current.viewerState},onContentHeight:h=>u.current.told?.(h)}),te=X(Q,g=>{k.current=g.mountWorkerView(W,B(r.worker)),D(W,g.viewPlaceHandle({element:W,definition:r,mounted:()=>k.current,optionsFor:B,draw:h=>ve(e,h),mount:g.mountWorkerView,pressing:Y}))});return()=>{te(),D(W,null),k.current?.dispose(),k.current=null}},[r,t,n]),(0,i.useEffect)(()=>k.current?.update(),[c,x,p]);let N=(0,a.jsx)("div",{ref:V,"data-worker-view-place":r.manifest.name,style:{minWidth:0}});if(!r.draft)return N;let M=r.manifest.title??r.manifest.name;return(0,a.jsxs)("div",{role:"group","aria-label":`Draft: ${M}`,"data-graview-draft-view":r.manifest.name,style:{display:"grid",gap:8,alignContent:"start",minWidth:0},children:[(0,a.jsxs)("p",{"data-testid":"draft-view-line",style:be,children:[(0,a.jsxs)("span",{children:["Draft \u2014 ",(0,a.jsx)("span",{style:{color:"var(--graview-ink)",fontWeight:600},children:M})]}),(0,a.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,a.jsx)("span",{children:"Not kept"})]}),N]})}var be={margin:0,display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 8px",fontSize:"0.875rem",color:"var(--graview-ink-muted)",borderBottom:"1px solid var(--graview-edge)",paddingBottom:8};function Z({view:e,props:t,fellBack:n}){return(0,a.jsx)("div",{"data-worker-view-fallback":"",...n?{"data-worker-view-fell-back":n.name,"data-worker-view-failed":n.reason}:{},style:{display:"contents"},children:(0,a.jsx)(e,{...t})})}var ee=(0,a.jsx)("div",{"data-worker-view-fallback":"",style:{display:"contents"}});function Se({name:e,reason:t,children:n}){return(0,a.jsx)("div",{"data-worker-view-fell-back":e,"data-worker-view-failed":t,style:{display:"contents"},children:n})}function G(e,t={}){let n=t.fallback,s=e.manifest.replaces==="page";function o(l){let d=A(),c=P(),f=(0,i.useContext)(J),[m,w]=(0,i.useState)(null),p=(0,i.useRef)(l);p.current=l;let y=ne(e);if(!d)return null;if(y===null)return n&&!(f&&S(n)&&!s)?(0,a.jsx)(Z,{view:n,props:l}):ee;if(m&&n)return f&&S(n)&&!s?ee:(0,a.jsx)(Z,{view:n,props:l,fellBack:{name:e.manifest.name,reason:m}});let r=t.beside&&!(f&&S(t.beside))?t.beside:void 0,V=(0,a.jsx)(re,{definition:y,store:d.store,principal:d.principal,input:()=>Ve(p.current),goTo:c,places:()=>d.views.places(),arrangement:()=>d.views.arrangement?.(),scheme:d.scheme,brand:d.brand,tick:l,drawsItsOwn:n!==void 0,onFailure:(k,v)=>{w(k),e.onFailure?.(k,v)}});return r?(0,a.jsxs)("div",{"data-worker-view-beside":e.manifest.name,style:{display:"grid",gap:12,minWidth:0},children:[V,e.manifest.bleed==="full"?(0,a.jsx)("div",{"data-worker-view-beside-under":"",style:{minWidth:0},children:(0,a.jsx)(r,{...l})}):(0,a.jsx)(r,{...l})]}):V}return o.displayName=`WorkerView(${e.manifest.name})`,o}function xe(e,t){let{manifest:n}=t;if(n.attach==="home"){if(!e.home)throw new Error(`The worker view "${n.name}" is the home's body: draw it with workerHome, on the home.`);let m=e.homes?.(),w=t.draft?void 0:m?m.filter(y=>y.name===void 0).at(-1)?.view:e.homeView?.(),p=G(t,w?{fallback:w}:{});return e.home(n.bleed===!0||n.bleed==="full"?F(p,n.bleed):p,t.draft?void 0:{name:n.name}),e}let s={cardinality:n.cardinality,fidelity:"full"},o=e.lookup(n.attach,s)??e.resolve(n.attach,s)?.view,l=n.cardinality==="one",d=t.draft===!0,c=G(t,{...o&&!d?{fallback:o}:{},...l&&n.replaces!=="page"&&o?{beside:o}:{}});n.replaces==="page"&&q(c);let f=o?.says;return l&&n.replaces!=="page"&&typeof f=="function"&&(c.says=f),(n.bleed===!0||n.bleed==="full")&&F(c,n.bleed),c.flows=n.flows!==!1,n.heading==="own"&&(c.ownHeading=!0),z(c,n.scene?.maxHeight!==void 0?{maxHeight:n.scene.maxHeight}:{}),e.register(n.attach,s,c,n.title?{title:n.title,...d?{}:{name:n.name},lens:"view",...n.reads?.kinds?.length?{reads:n.reads.kinds}:{}}:d?void 0:{name:n.name}),e}function Ce(e,t={}){let n=t.fallback;function s({context:o}){let l=A(),d=P(),[c,f]=(0,i.useState)(null),m=ne(e);return c&&n?(0,a.jsx)(Se,{name:e.manifest.name,reason:c,children:(0,a.jsx)(n,{context:o})}):m===null&&n?(0,a.jsx)(n,{context:o}):m===null?null:(0,a.jsx)(re,{definition:m,store:o.store,principal:o.principal??l?.principal??{kind:"human"},goTo:d,...l?{places:()=>l.views.places(),arrangement:()=>l.views.arrangement?.(),scheme:l.scheme,brand:l.brand}:{},drawsItsOwn:n!==void 0,onFailure:(w,p)=>{f(w),e.onFailure?.(w,p)}})}return s.displayName=`WorkerHome(${e.manifest.name})`,s}export{se as checkManifest,ke as checkViewSource,ue as edgesReadWithoutTheirKinds,me as edgesReadWithoutTheirKindsSaid,ye as judgeCodeAct,ie as manifestActs,ce as ownKindRelations,fe as readsComputed,xe as registerWorkerView,pe as sightIsTotal,le as unreadEdges,de as unreadEdgesSentence,ge as viewScript,Ce as workerHome,G as workerView,we as workerViewProps};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var j={nav:"div",header:"div",footer:"div",aside:"div",search:"div",output:"span"},L=["all","display","position","top","right","bottom","left","inset","inset-block","inset-inline","inset-block-start","inset-block-end","inset-inline-start","inset-inline-end","width","height","min-width","min-height","max-width","max-height","inline-size","block-size","min-inline-size","min-block-size","max-inline-size","max-block-size","margin","margin-top","margin-right","margin-bottom","margin-left","margin-block","margin-inline","margin-block-start","margin-block-end","margin-inline-start","margin-inline-end","padding","padding-top","padding-right","padding-bottom","padding-left","padding-block","padding-inline","padding-block-start","padding-block-end","padding-inline-start","padding-inline-end","box-sizing","overflow","overflow-x","overflow-y","overflow-wrap","float","clear","z-index","aspect-ratio","object-fit","object-position","vertical-align","isolation","contain","container","container-type","container-name","content-visibility","flex","flex-direction","flex-wrap","flex-flow","flex-grow","flex-shrink","flex-basis","order","grid","grid-template","grid-template-columns","grid-template-rows","grid-template-areas","grid-auto-columns","grid-auto-rows","grid-auto-flow","grid-area","grid-column","grid-row","grid-column-start","grid-column-end","grid-row-start","grid-row-end","gap","row-gap","column-gap","align-items","align-content","align-self","justify-items","justify-content","justify-self","place-items","place-content","place-self","columns","column-count","column-width","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-fill","break-inside","break-before","break-after","page-break-inside","page-break-before","page-break-after","orphans","widows","box-decoration-break","-webkit-box-decoration-break","color","background","background-color","background-image","background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode","border","border-top","border-right","border-bottom","border-left","border-block","border-inline","border-block-start","border-block-end","border-inline-start","border-inline-end","border-width","border-style","border-color","border-top-width","border-right-width","border-bottom-width","border-left-width","border-top-style","border-right-style","border-bottom-style","border-left-style","border-top-color","border-right-color","border-bottom-color","border-left-color","border-radius","border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius","border-start-start-radius","border-start-end-radius","border-end-start-radius","border-end-end-radius","border-collapse","border-spacing","outline","outline-width","outline-style","outline-color","outline-offset","box-shadow","opacity","visibility","mix-blend-mode","filter","backdrop-filter","clip-path","accent-color","caret-color","color-scheme","appearance","-webkit-appearance","mask-image","mask-size","mask-position","mask-repeat","mask-origin","mask-clip","mask-composite","mask-mode","mask-type","-webkit-mask","-webkit-mask-image","-webkit-mask-size","-webkit-mask-position","-webkit-mask-repeat","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-composite","font","font-family","font-size","font-weight","font-style","font-stretch","font-variant","font-variant-numeric","font-variant-caps","font-variant-ligatures","font-feature-settings","font-variation-settings","font-kerning","font-optical-sizing","font-size-adjust","font-synthesis","line-height","letter-spacing","word-spacing","text-align","text-align-last","text-indent","text-transform","text-decoration","text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-underline-position","text-shadow","text-overflow","text-wrap","text-wrap-mode","text-wrap-style","white-space","white-space-collapse","word-break","line-break","hyphens","tab-size","direction","unicode-bidi","writing-mode","text-orientation","text-rendering","-webkit-font-smoothing","-webkit-line-clamp","-webkit-box-orient","line-clamp","-webkit-text-fill-color","-webkit-background-clip","-webkit-text-stroke","-webkit-text-stroke-width","-webkit-text-stroke-color","list-style","list-style-type","list-style-position","content","quotes","counter-reset","counter-increment","counter-set","table-layout","caption-side","empty-cells","transform","transform-origin","transform-box","transform-style","translate","rotate","scale","perspective","perspective-origin","backface-visibility","transition","transition-property","transition-duration","transition-timing-function","transition-delay","transition-behavior","animation","animation-name","animation-duration","animation-timing-function","animation-delay","animation-iteration-count","animation-direction","animation-fill-mode","animation-play-state","animation-composition","will-change","animation-timeline","animation-range","animation-range-start","animation-range-end","scroll-timeline","scroll-timeline-name","scroll-timeline-axis","view-timeline","view-timeline-name","view-timeline-axis","view-timeline-inset","timeline-scope","cursor","pointer-events","user-select","-webkit-user-select","touch-action","resize","scroll-behavior","overscroll-behavior","overscroll-behavior-x","overscroll-behavior-y","scroll-snap-type","scroll-snap-align","scroll-snap-stop","scroll-margin","scroll-padding","scroll-margin-top","scroll-margin-right","scroll-margin-bottom","scroll-margin-left","scroll-margin-block","scroll-margin-block-start","scroll-margin-block-end","scroll-margin-inline","scroll-margin-inline-start","scroll-margin-inline-end","scroll-padding-top","scroll-padding-right","scroll-padding-bottom","scroll-padding-left","scroll-padding-block","scroll-padding-block-start","scroll-padding-block-end","scroll-padding-inline","scroll-padding-inline-start","scroll-padding-inline-end","scrollbar-width","scrollbar-color","scrollbar-gutter","fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray","stroke-dashoffset","stroke-opacity","stroke-miterlimit","stop-color","stop-opacity","clip-rule","marker","marker-start","marker-mid","marker-end","paint-order","vector-effect","shape-rendering","text-anchor","dominant-baseline","alignment-baseline","r","cx","cy","rx","ry","x","y","d","mask","flood-color","flood-opacity","lighting-color","color-interpolation-filters"],W=["var","env","calc","min","max","clamp","round","mod","rem","abs","sign","sin","cos","tan","asin","acos","atan","atan2","pow","sqrt","hypot","log","exp","rgb","rgba","hsl","hsla","hwb","lab","lch","oklab","oklch","color","color-mix","light-dark","linear-gradient","radial-gradient","conic-gradient","repeating-linear-gradient","repeating-radial-gradient","repeating-conic-gradient","translate","translatex","translatey","translatez","translate3d","rotate","rotatex","rotatey","rotatez","rotate3d","scale","scalex","scaley","scalez","scale3d","skew","skewx","skewy","matrix","matrix3d","perspective","cubic-bezier","steps","linear","repeat","minmax","fit-content","blur","brightness","contrast","drop-shadow","grayscale","hue-rotate","invert","saturate","sepia","opacity","circle","ellipse","inset","polygon","path","xywh","rect","counter","counters","scroll","view"],U=["fill","stroke","clip-path","mask","marker","marker-start","marker-mid","marker-end","filter"],M=["media","supports","container","keyframes"],K={position:["static","relative","absolute","sticky"],all:[],appearance:["auto","none","menulist-button","textfield"],"-webkit-appearance":["auto","none","menulist-button","textfield"]},X=["host","host-context","slotted","part","backdrop","picker","view-transition","view-transition-group","view-transition-image-pair","view-transition-old","view-transition-new"],Z=["-webkit-details-marker"],S=64e3;var p=e=>e>=48&&e<=57,H=e=>p(e)||e>=65&&e<=70||e>=97&&e<=102,D=e=>e>=65&&e<=90||e>=97&&e<=122,A=e=>e>=128,v=e=>D(e)||A(e)||e===95,G=e=>v(e)||p(e)||e===45,Y=e=>e===10,h=e=>e===10||e===9||e===32,fe=e=>e>=0&&e<=8||e===11||e>=14&&e<=31||e===127,g=-1;function me(e){let r=[];for(let t=0;t<e.length;t+=1){let n=e.codePointAt(t);n>65535&&(t+=1),n===13?(e.charCodeAt(t+1)===10&&(t+=1),n=10):n===12?n=10:(n===0||n>=55296&&n<=57343)&&(n=65533),r.push(n)}return r}function ee(e){let r=me(e),t=0,n=(s=0)=>t+s<r.length?r[t+s]:g,i=[],o=(s,l)=>s===92&&l!==10&&l!==g,a=(s,l,m)=>s===45?v(l)||l===45||o(l,m):v(s)?!0:o(s,l),u=(s,l,m)=>s===43||s===45?p(l)||l===46&&p(m):p(s===46?l:s),c=()=>{let s=n();if(t+=1,s===g)return 65533;if(H(s)){let l=String.fromCodePoint(s);for(;l.length<6&&H(n());)l+=String.fromCodePoint(n()),t+=1;h(n())&&(t+=1);let m=parseInt(l,16);return m===0||m>=55296&&m<=57343||m>1114111?65533:m}return s},d=()=>{let s="";for(;;){let l=n();if(G(l))s+=String.fromCodePoint(l),t+=1;else if(o(l,n(1)))t+=1,s+=String.fromCodePoint(c());else return s}},f=()=>{let s="";for((n()===43||n()===45)&&(s+=String.fromCodePoint(r[t++]));p(n());)s+=String.fromCodePoint(r[t++]);if(n()===46&&p(n(1)))for(s+=String.fromCodePoint(r[t++],r[t++]);p(n());)s+=String.fromCodePoint(r[t++]);if((n()===69||n()===101)&&(p(n(1))||(n(1)===43||n(1)===45)&&p(n(2))))for(s+=String.fromCodePoint(r[t++]),p(n())||(s+=String.fromCodePoint(r[t++]));p(n());)s+=String.fromCodePoint(r[t++]);return s},x=()=>{let s=f();return a(n(),n(1),n(2))?{type:"dimension",repr:s,unit:d()}:n()===37?(t+=1,{type:"percentage",repr:s}):{type:"number",repr:s}},b=()=>{for(;;){let s=n();if(t+=1,s===41||s===g)return;o(s,n())&&c()}},de=()=>{let s="";for(;h(n());)t+=1;for(;;){let l=n();if(t+=1,l===41)return{type:"url",value:s};if(l===g)return{type:"url",value:s};if(h(l)){for(;h(n());)t+=1;return n()===41||n()===g?(n()===41&&(t+=1),{type:"url",value:s}):(b(),{type:"bad-url"})}if(l===34||l===39||l===40||fe(l))return b(),{type:"bad-url"};if(l===92){if(o(l,n()))s+=String.fromCodePoint(c());else return b(),{type:"bad-url"};continue}s+=String.fromCodePoint(l)}},O=()=>{let s=d();if(s.toLowerCase()==="url"&&n()===40){for(t+=1;h(n())&&h(n(1));)t+=1;let l=h(n())?n(1):n();return l===34||l===39?{type:"function",value:s}:de()}return n()===40?(t+=1,{type:"function",value:s}):{type:"ident",value:s}},pe=s=>{let l="";for(;;){let m=n();if(t+=1,m===s||m===g)return{type:"string",value:l};if(Y(m))return t-=1,{type:"bad-string"};if(m===92){if(n()===g)continue;if(Y(n())){t+=1;continue}l+=String.fromCodePoint(c());continue}l+=String.fromCodePoint(m)}};for(;;){for(;n()===47&&n(1)===42;){for(t+=2;n()!==g&&!(n()===42&&n(1)===47);)t+=1;n()!==g&&(t+=2)}let s=n();if(s===g)return i;if(h(s)){for(;h(n());)t+=1;i.push({type:"whitespace"});continue}switch(t+=1,s){case 34:case 39:i.push(pe(s));continue;case 35:if(G(n())||o(n(),n(1))){let l=a(n(),n(1),n(2));i.push({type:"hash",value:d(),id:l})}else i.push({type:"delim",value:"#"});continue;case 40:i.push({type:"("});continue;case 41:i.push({type:")"});continue;case 43:case 46:u(s,n(),n(1))?(t-=1,i.push(x())):i.push({type:"delim",value:String.fromCodePoint(s)});continue;case 44:i.push({type:","});continue;case 45:u(s,n(),n(1))?(t-=1,i.push(x())):n()===45&&n(1)===62?(t+=2,i.push({type:"CDC"})):a(s,n(),n(1))?(t-=1,i.push(O())):i.push({type:"delim",value:"-"});continue;case 58:i.push({type:":"});continue;case 59:i.push({type:";"});continue;case 60:n()===33&&n(1)===45&&n(2)===45?(t+=3,i.push({type:"CDO"})):i.push({type:"delim",value:"<"});continue;case 64:a(n(),n(1),n(2))?i.push({type:"at-keyword",value:d()}):i.push({type:"delim",value:"@"});continue;case 91:i.push({type:"["});continue;case 92:o(s,n())?(t-=1,i.push(O())):i.push({type:"delim",value:"\\"});continue;case 93:i.push({type:"]"});continue;case 123:i.push({type:"{"});continue;case 125:i.push({type:"}"});continue;default:p(s)?(t-=1,i.push(x())):v(s)?(t-=1,i.push(O())):i.push({type:"delim",value:String.fromCodePoint(s)})}}}var ne={"{":"}","[":"]","(":")"},te=32,P=class{constructor(r){this.tokens=r}i=0;peek(){return this.tokens[this.i]}next(){return this.tokens[this.i++]}};function re(e,r){let t=e.next();return t.type==="{"||t.type==="["||t.type==="("?{type:"block",open:t.type,value:q(e,ne[t.type],r+1)}:t.type==="function"?{type:"func",name:t.value,value:q(e,")",r+1)}:t}function q(e,r,t){let n=[];for(;;){let i=e.peek();if(!i)return n;if(i.type===r)return e.next(),n;if(t>te){e.next(),n.push({type:"bad-string"});continue}n.push(re(e,t))}}function w(e,r){let t=[],n=0;for(;n<e.length;){let i=e[n];if(i.type==="whitespace"||r&&(i.type==="CDO"||i.type==="CDC")){n+=1;continue}if(i.type==="at-keyword"){let u=[];n+=1;let c;for(;n<e.length;){let d=e[n];if(n+=1,d.type===";")break;if(d.type==="block"&&d.open==="{"){c=d.value;break}u.push(d)}t.push({type:"at-rule",name:i.value,prelude:u,...c?{block:c}:{}});continue}let o=[],a;for(;n<e.length;){let u=e[n];if(n+=1,u.type==="block"&&u.open==="{"){a=u.value;break}o.push(u)}a&&t.push({type:"qualified",prelude:o,block:a})}return t}function F(e){let r=[],t=0;for(;t<e.length;){let n=e[t];if(n.type==="whitespace"||n.type===";"){t+=1;continue}if(n.type==="at-keyword"){let o=(()=>{for(let a=t+1;a<e.length;a+=1){let u=e[a];if(u.type===";"||u.type==="block"&&u.open==="{")return a+1}return e.length})();r.push(...w(e.slice(t,o),!1)),t=o;continue}if(n.type==="ident"){let o=t+1;for(;e[o]?.type==="whitespace";)o+=1;if(e[o]?.type===":"){let a=o+1;for(;a<e.length&&e[a].type!==";";)a+=1;let u=ie(n.value,e.slice(o+1,a));if(u.value.some(c=>c.type==="block"&&c.open==="{")){let c=e.findIndex((d,f)=>f>t&&d.type==="block"&&d.open==="{");r.push(...w(e.slice(t,c+1),!1)),t=c+1;continue}r.push(u),t=a+1;continue}}let i=t;for(;i<e.length&&!(e[i].type==="block"&&e[i].open==="{")&&e[i].type!==";";)i+=1;i<e.length&&e[i].type==="block"&&r.push(...w(e.slice(t,i+1),!1)),t=i+1}return r}function ie(e,r){let t=[...r];for(;t[0]?.type==="whitespace";)t.shift();for(;t.at(-1)?.type==="whitespace";)t.pop();let n=!1,o=t.length-1;if(t[o]?.type==="ident"&&t[o].value.toLowerCase()==="important"){for(o-=1;t[o]?.type==="whitespace";)o-=1;let a=t[o];if(a?.type==="delim"&&a.value==="!")for(n=!0,t.length=o;t.at(-1)?.type==="whitespace";)t.pop()}return{type:"declaration",name:e,value:t,important:n}}function N(e){let r=new P(ee(e)),t=[];for(;r.peek();)t.push(re(r,0));return t}function C(e){let r="",t=[...e].map(n=>n.codePointAt(0));return t.forEach((n,i)=>{n===0?r+="\uFFFD":n>=1&&n<=31||n===127||i===0&&p(n)||i===1&&p(n)&&t[0]===45?r+=`\\${n.toString(16)} `:i===0&&n===45&&t.length===1?r+="\\-":A(n)||n===45||n===95||p(n)||D(n)?r+=String.fromCodePoint(n):r+=`\\${String.fromCodePoint(n)}`}),r}function E(e){let r="";for(let t of e){let n=t.codePointAt(0);A(n)||n===45||n===95||p(n)||D(n)?r+=t:n>=1&&n<=31||n===127?r+=`\\${n.toString(16)} `:r+=`\\${t}`}return r}function R(e){let r='"';for(let t of e){let n=t.codePointAt(0);n===0?r+="\uFFFD":n>=1&&n<=31||n===127||n===60||n===62?r+=`\\${n.toString(16)} `:n===34||n===92?r+=`\\${t}`:r+=t}return`${r}"`}function ye(e){let r=E(e);return/^[eE]([0-9]|[+-][0-9])/.test(e)?`\\${e.codePointAt(0).toString(16)} ${E(e.slice(1))}`:r}var B=e=>{switch(e.type){case"ident":case"url":case"bad-url":case"number":case"percentage":case"dimension":case"CDC":case"hash":case"at-keyword":return e.type;case"func":case"function":return"function";case"block":return e.open==="("?"(":"other";case"(":return"(";case"delim":return`delim${e.value}`;default:return"other"}};function ge(e,r){let t=["ident","function","url","bad-url","delim-","number","percentage","dimension","CDC"];return e==="ident"?[...t,"("].includes(r):e==="at-keyword"||e==="hash"||e==="dimension"||e==="delim#"||e==="delim-"?t.includes(r):e==="number"?["ident","function","url","bad-url","number","percentage","dimension","delim%"].includes(r):e==="delim@"?["ident","function","url","bad-url","delim-","CDC"].includes(r):e==="delim."||e==="delim+"?["number","percentage","dimension"].includes(r):e==="delim/"?r==="delim*":!1}function be(e){switch(e.type){case"whitespace":return" ";case"ident":return C(e.value);case"at-keyword":return`@${C(e.value)}`;case"hash":return`#${E(e.value)}`;case"string":return R(e.value);case"url":return`url(${R(e.value)})`;case"delim":return e.value==="\\"?`\\
|
|
2
|
-
`:e.value;case"CDO":return"<!--";case"CDC":return"-->";case"number":return e.repr;case"percentage":return`${e.repr}%`;case"dimension":return`${e.repr}${ye(e.unit)}`;case"func":return`${C(e.name)}(${k(e.value)})`;case"block":return`${e.open}${k(e.value)}${ne[e.open]}`;case":":case";":case",":case"[":case"]":case"(":case")":case"{":case"}":return e.type;default:return""}}function k(e){let r="",t;for(let n of e)n.type==="whitespace"&&t?.type==="whitespace"||(t&&ge(B(t),B(n))&&(r+="/**/"),r+=be(n),t=n);return r}var he=new Set(L),
|
|
3
|
-
`),refused:t}}function Oe(e,r=S){let t=[],n=[],
|
|
4
|
-
`),refused:n}}function ze(e,r=S){let t=[];if(e.length>r)return{css:"",refused:[{reason:"size"}]};let n=
|
|
1
|
+
var j={nav:"div",header:"div",footer:"div",aside:"div",search:"div",output:"span"},L=["all","display","position","top","right","bottom","left","inset","inset-block","inset-inline","inset-block-start","inset-block-end","inset-inline-start","inset-inline-end","width","height","min-width","min-height","max-width","max-height","inline-size","block-size","min-inline-size","min-block-size","max-inline-size","max-block-size","margin","margin-top","margin-right","margin-bottom","margin-left","margin-block","margin-inline","margin-block-start","margin-block-end","margin-inline-start","margin-inline-end","padding","padding-top","padding-right","padding-bottom","padding-left","padding-block","padding-inline","padding-block-start","padding-block-end","padding-inline-start","padding-inline-end","box-sizing","overflow","overflow-x","overflow-y","overflow-wrap","float","clear","z-index","aspect-ratio","object-fit","object-position","vertical-align","isolation","contain","container","container-type","container-name","content-visibility","flex","flex-direction","flex-wrap","flex-flow","flex-grow","flex-shrink","flex-basis","order","grid","grid-template","grid-template-columns","grid-template-rows","grid-template-areas","grid-auto-columns","grid-auto-rows","grid-auto-flow","grid-area","grid-column","grid-row","grid-column-start","grid-column-end","grid-row-start","grid-row-end","gap","row-gap","column-gap","align-items","align-content","align-self","justify-items","justify-content","justify-self","place-items","place-content","place-self","columns","column-count","column-width","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-fill","break-inside","break-before","break-after","page-break-inside","page-break-before","page-break-after","orphans","widows","box-decoration-break","-webkit-box-decoration-break","color","background","background-color","background-image","background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode","border","border-top","border-right","border-bottom","border-left","border-block","border-inline","border-block-start","border-block-end","border-inline-start","border-inline-end","border-width","border-style","border-color","border-top-width","border-right-width","border-bottom-width","border-left-width","border-top-style","border-right-style","border-bottom-style","border-left-style","border-top-color","border-right-color","border-bottom-color","border-left-color","border-radius","border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius","border-start-start-radius","border-start-end-radius","border-end-start-radius","border-end-end-radius","border-collapse","border-spacing","outline","outline-width","outline-style","outline-color","outline-offset","box-shadow","opacity","visibility","mix-blend-mode","filter","backdrop-filter","clip-path","accent-color","caret-color","color-scheme","appearance","-webkit-appearance","mask-image","mask-size","mask-position","mask-repeat","mask-origin","mask-clip","mask-composite","mask-mode","mask-type","-webkit-mask","-webkit-mask-image","-webkit-mask-size","-webkit-mask-position","-webkit-mask-repeat","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-composite","font","font-family","font-size","font-weight","font-style","font-stretch","font-variant","font-variant-numeric","font-variant-caps","font-variant-ligatures","font-feature-settings","font-variation-settings","font-kerning","font-optical-sizing","font-size-adjust","font-synthesis","line-height","letter-spacing","word-spacing","text-align","text-align-last","text-indent","text-transform","text-decoration","text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-underline-position","text-shadow","text-overflow","text-wrap","text-wrap-mode","text-wrap-style","white-space","white-space-collapse","word-break","line-break","hyphens","tab-size","direction","unicode-bidi","writing-mode","text-orientation","text-rendering","-webkit-font-smoothing","-webkit-line-clamp","-webkit-box-orient","line-clamp","-webkit-text-fill-color","-webkit-background-clip","-webkit-text-stroke","-webkit-text-stroke-width","-webkit-text-stroke-color","list-style","list-style-type","list-style-position","content","quotes","counter-reset","counter-increment","counter-set","table-layout","caption-side","empty-cells","transform","transform-origin","transform-box","transform-style","translate","rotate","scale","perspective","perspective-origin","backface-visibility","transition","transition-property","transition-duration","transition-timing-function","transition-delay","transition-behavior","animation","animation-name","animation-duration","animation-timing-function","animation-delay","animation-iteration-count","animation-direction","animation-fill-mode","animation-play-state","animation-composition","will-change","animation-timeline","animation-range","animation-range-start","animation-range-end","scroll-timeline","scroll-timeline-name","scroll-timeline-axis","view-timeline","view-timeline-name","view-timeline-axis","view-timeline-inset","timeline-scope","cursor","pointer-events","user-select","-webkit-user-select","touch-action","resize","scroll-behavior","overscroll-behavior","overscroll-behavior-x","overscroll-behavior-y","scroll-snap-type","scroll-snap-align","scroll-snap-stop","scroll-margin","scroll-padding","scroll-margin-top","scroll-margin-right","scroll-margin-bottom","scroll-margin-left","scroll-margin-block","scroll-margin-block-start","scroll-margin-block-end","scroll-margin-inline","scroll-margin-inline-start","scroll-margin-inline-end","scroll-padding-top","scroll-padding-right","scroll-padding-bottom","scroll-padding-left","scroll-padding-block","scroll-padding-block-start","scroll-padding-block-end","scroll-padding-inline","scroll-padding-inline-start","scroll-padding-inline-end","scrollbar-width","scrollbar-color","scrollbar-gutter","fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray","stroke-dashoffset","stroke-opacity","stroke-miterlimit","stop-color","stop-opacity","clip-rule","marker","marker-start","marker-mid","marker-end","paint-order","vector-effect","shape-rendering","text-anchor","dominant-baseline","alignment-baseline","r","cx","cy","rx","ry","x","y","d","mask","flood-color","flood-opacity","lighting-color","color-interpolation-filters"],W=["var","env","calc","min","max","clamp","round","mod","rem","abs","sign","sin","cos","tan","asin","acos","atan","atan2","pow","sqrt","hypot","log","exp","rgb","rgba","hsl","hsla","hwb","lab","lch","oklab","oklch","color","color-mix","light-dark","linear-gradient","radial-gradient","conic-gradient","repeating-linear-gradient","repeating-radial-gradient","repeating-conic-gradient","translate","translatex","translatey","translatez","translate3d","rotate","rotatex","rotatey","rotatez","rotate3d","scale","scalex","scaley","scalez","scale3d","skew","skewx","skewy","matrix","matrix3d","perspective","cubic-bezier","steps","linear","repeat","minmax","fit-content","blur","brightness","contrast","drop-shadow","grayscale","hue-rotate","invert","saturate","sepia","opacity","circle","ellipse","inset","polygon","path","xywh","rect","counter","counters","scroll","view"],M=["fill","stroke","clip-path","mask","marker","marker-start","marker-mid","marker-end","filter"],U=["media","supports","container","keyframes"],K={position:["static","relative","absolute","sticky"],all:[],appearance:["auto","none","menulist-button","textfield"],"-webkit-appearance":["auto","none","menulist-button","textfield"]},X=["host","host-context","slotted","part","backdrop","picker","view-transition","view-transition-group","view-transition-image-pair","view-transition-old","view-transition-new"],Y=["-webkit-details-marker"],S=64e3;var p=e=>e>=48&&e<=57,Z=e=>p(e)||e>=65&&e<=70||e>=97&&e<=102,D=e=>e>=65&&e<=90||e>=97&&e<=122,F=e=>e>=128,v=e=>D(e)||F(e)||e===95,H=e=>v(e)||p(e)||e===45,G=e=>e===10,h=e=>e===10||e===9||e===32,fe=e=>e>=0&&e<=8||e===11||e>=14&&e<=31||e===127,g=-1;function me(e){let r=[];for(let t=0;t<e.length;t+=1){let n=e.codePointAt(t);n>65535&&(t+=1),n===13?(e.charCodeAt(t+1)===10&&(t+=1),n=10):n===12?n=10:(n===0||n>=55296&&n<=57343)&&(n=65533),r.push(n)}return r}function ee(e){let r=me(e),t=0,n=(s=0)=>t+s<r.length?r[t+s]:g,o=[],i=(s,l)=>s===92&&l!==10&&l!==g,a=(s,l,m)=>s===45?v(l)||l===45||i(l,m):v(s)?!0:i(s,l),u=(s,l,m)=>s===43||s===45?p(l)||l===46&&p(m):p(s===46?l:s),c=()=>{let s=n();if(t+=1,s===g)return 65533;if(Z(s)){let l=String.fromCodePoint(s);for(;l.length<6&&Z(n());)l+=String.fromCodePoint(n()),t+=1;h(n())&&(t+=1);let m=parseInt(l,16);return m===0||m>=55296&&m<=57343||m>1114111?65533:m}return s},d=()=>{let s="";for(;;){let l=n();if(H(l))s+=String.fromCodePoint(l),t+=1;else if(i(l,n(1)))t+=1,s+=String.fromCodePoint(c());else return s}},f=()=>{let s="";for((n()===43||n()===45)&&(s+=String.fromCodePoint(r[t++]));p(n());)s+=String.fromCodePoint(r[t++]);if(n()===46&&p(n(1)))for(s+=String.fromCodePoint(r[t++],r[t++]);p(n());)s+=String.fromCodePoint(r[t++]);if((n()===69||n()===101)&&(p(n(1))||(n(1)===43||n(1)===45)&&p(n(2))))for(s+=String.fromCodePoint(r[t++]),p(n())||(s+=String.fromCodePoint(r[t++]));p(n());)s+=String.fromCodePoint(r[t++]);return s},x=()=>{let s=f();return a(n(),n(1),n(2))?{type:"dimension",repr:s,unit:d()}:n()===37?(t+=1,{type:"percentage",repr:s}):{type:"number",repr:s}},b=()=>{for(;;){let s=n();if(t+=1,s===41||s===g)return;i(s,n())&&c()}},de=()=>{let s="";for(;h(n());)t+=1;for(;;){let l=n();if(t+=1,l===41)return{type:"url",value:s};if(l===g)return{type:"url",value:s};if(h(l)){for(;h(n());)t+=1;return n()===41||n()===g?(n()===41&&(t+=1),{type:"url",value:s}):(b(),{type:"bad-url"})}if(l===34||l===39||l===40||fe(l))return b(),{type:"bad-url"};if(l===92){if(i(l,n()))s+=String.fromCodePoint(c());else return b(),{type:"bad-url"};continue}s+=String.fromCodePoint(l)}},O=()=>{let s=d();if(s.toLowerCase()==="url"&&n()===40){for(t+=1;h(n())&&h(n(1));)t+=1;let l=h(n())?n(1):n();return l===34||l===39?{type:"function",value:s}:de()}return n()===40?(t+=1,{type:"function",value:s}):{type:"ident",value:s}},pe=s=>{let l="";for(;;){let m=n();if(t+=1,m===s||m===g)return{type:"string",value:l};if(G(m))return t-=1,{type:"bad-string"};if(m===92){if(n()===g)continue;if(G(n())){t+=1;continue}l+=String.fromCodePoint(c());continue}l+=String.fromCodePoint(m)}};for(;;){for(;n()===47&&n(1)===42;){for(t+=2;n()!==g&&!(n()===42&&n(1)===47);)t+=1;n()!==g&&(t+=2)}let s=n();if(s===g)return o;if(h(s)){for(;h(n());)t+=1;o.push({type:"whitespace"});continue}switch(t+=1,s){case 34:case 39:o.push(pe(s));continue;case 35:if(H(n())||i(n(),n(1))){let l=a(n(),n(1),n(2));o.push({type:"hash",value:d(),id:l})}else o.push({type:"delim",value:"#"});continue;case 40:o.push({type:"("});continue;case 41:o.push({type:")"});continue;case 43:case 46:u(s,n(),n(1))?(t-=1,o.push(x())):o.push({type:"delim",value:String.fromCodePoint(s)});continue;case 44:o.push({type:","});continue;case 45:u(s,n(),n(1))?(t-=1,o.push(x())):n()===45&&n(1)===62?(t+=2,o.push({type:"CDC"})):a(s,n(),n(1))?(t-=1,o.push(O())):o.push({type:"delim",value:"-"});continue;case 58:o.push({type:":"});continue;case 59:o.push({type:";"});continue;case 60:n()===33&&n(1)===45&&n(2)===45?(t+=3,o.push({type:"CDO"})):o.push({type:"delim",value:"<"});continue;case 64:a(n(),n(1),n(2))?o.push({type:"at-keyword",value:d()}):o.push({type:"delim",value:"@"});continue;case 91:o.push({type:"["});continue;case 92:i(s,n())?(t-=1,o.push(O())):o.push({type:"delim",value:"\\"});continue;case 93:o.push({type:"]"});continue;case 123:o.push({type:"{"});continue;case 125:o.push({type:"}"});continue;default:p(s)?(t-=1,o.push(x())):v(s)?(t-=1,o.push(O())):o.push({type:"delim",value:String.fromCodePoint(s)})}}}var ne={"{":"}","[":"]","(":")"},te=32,P=class{constructor(r){this.tokens=r}i=0;peek(){return this.tokens[this.i]}next(){return this.tokens[this.i++]}};function re(e,r){let t=e.next();return t.type==="{"||t.type==="["||t.type==="("?{type:"block",open:t.type,value:q(e,ne[t.type],r+1)}:t.type==="function"?{type:"func",name:t.value,value:q(e,")",r+1)}:t}function q(e,r,t){let n=[];for(;;){let o=e.peek();if(!o)return n;if(o.type===r)return e.next(),n;if(t>te){e.next(),n.push({type:"bad-string"});continue}n.push(re(e,t))}}function w(e,r){let t=[],n=0;for(;n<e.length;){let o=e[n];if(o.type==="whitespace"||r&&(o.type==="CDO"||o.type==="CDC")){n+=1;continue}if(o.type==="at-keyword"){let u=[];n+=1;let c;for(;n<e.length;){let d=e[n];if(n+=1,d.type===";")break;if(d.type==="block"&&d.open==="{"){c=d.value;break}u.push(d)}t.push({type:"at-rule",name:o.value,prelude:u,...c?{block:c}:{}});continue}let i=[],a;for(;n<e.length;){let u=e[n];if(n+=1,u.type==="block"&&u.open==="{"){a=u.value;break}i.push(u)}a&&t.push({type:"qualified",prelude:i,block:a})}return t}function A(e){let r=[],t=0;for(;t<e.length;){let n=e[t];if(n.type==="whitespace"||n.type===";"){t+=1;continue}if(n.type==="at-keyword"){let i=(()=>{for(let a=t+1;a<e.length;a+=1){let u=e[a];if(u.type===";"||u.type==="block"&&u.open==="{")return a+1}return e.length})();r.push(...w(e.slice(t,i),!1)),t=i;continue}if(n.type==="ident"){let i=t+1;for(;e[i]?.type==="whitespace";)i+=1;if(e[i]?.type===":"){let a=i+1;for(;a<e.length&&e[a].type!==";";)a+=1;let u=oe(n.value,e.slice(i+1,a));if(u.value.some(c=>c.type==="block"&&c.open==="{")){let c=e.findIndex((d,f)=>f>t&&d.type==="block"&&d.open==="{");r.push(...w(e.slice(t,c+1),!1)),t=c+1;continue}r.push(u),t=a+1;continue}}let o=t;for(;o<e.length&&!(e[o].type==="block"&&e[o].open==="{")&&e[o].type!==";";)o+=1;o<e.length&&e[o].type==="block"&&r.push(...w(e.slice(t,o+1),!1)),t=o+1}return r}function oe(e,r){let t=[...r];for(;t[0]?.type==="whitespace";)t.shift();for(;t.at(-1)?.type==="whitespace";)t.pop();let n=!1,i=t.length-1;if(t[i]?.type==="ident"&&t[i].value.toLowerCase()==="important"){for(i-=1;t[i]?.type==="whitespace";)i-=1;let a=t[i];if(a?.type==="delim"&&a.value==="!")for(n=!0,t.length=i;t.at(-1)?.type==="whitespace";)t.pop()}return{type:"declaration",name:e,value:t,important:n}}function N(e){let r=new P(ee(e)),t=[];for(;r.peek();)t.push(re(r,0));return t}function C(e){let r="",t=[...e].map(n=>n.codePointAt(0));return t.forEach((n,o)=>{n===0?r+="\uFFFD":n>=1&&n<=31||n===127||o===0&&p(n)||o===1&&p(n)&&t[0]===45?r+=`\\${n.toString(16)} `:o===0&&n===45&&t.length===1?r+="\\-":F(n)||n===45||n===95||p(n)||D(n)?r+=String.fromCodePoint(n):r+=`\\${String.fromCodePoint(n)}`}),r}function E(e){let r="";for(let t of e){let n=t.codePointAt(0);F(n)||n===45||n===95||p(n)||D(n)?r+=t:n>=1&&n<=31||n===127?r+=`\\${n.toString(16)} `:r+=`\\${t}`}return r}function R(e){let r='"';for(let t of e){let n=t.codePointAt(0);n===0?r+="\uFFFD":n>=1&&n<=31||n===127||n===60||n===62?r+=`\\${n.toString(16)} `:n===34||n===92?r+=`\\${t}`:r+=t}return`${r}"`}function ye(e){let r=E(e);return/^[eE]([0-9]|[+-][0-9])/.test(e)?`\\${e.codePointAt(0).toString(16)} ${E(e.slice(1))}`:r}var B=e=>{switch(e.type){case"ident":case"url":case"bad-url":case"number":case"percentage":case"dimension":case"CDC":case"hash":case"at-keyword":return e.type;case"func":case"function":return"function";case"block":return e.open==="("?"(":"other";case"(":return"(";case"delim":return`delim${e.value}`;default:return"other"}};function ge(e,r){let t=["ident","function","url","bad-url","delim-","number","percentage","dimension","CDC"];return e==="ident"?[...t,"("].includes(r):e==="at-keyword"||e==="hash"||e==="dimension"||e==="delim#"||e==="delim-"?t.includes(r):e==="number"?["ident","function","url","bad-url","number","percentage","dimension","delim%"].includes(r):e==="delim@"?["ident","function","url","bad-url","delim-","CDC"].includes(r):e==="delim."||e==="delim+"?["number","percentage","dimension"].includes(r):e==="delim/"?r==="delim*":!1}function be(e){switch(e.type){case"whitespace":return" ";case"ident":return C(e.value);case"at-keyword":return`@${C(e.value)}`;case"hash":return`#${E(e.value)}`;case"string":return R(e.value);case"url":return`url(${R(e.value)})`;case"delim":return e.value==="\\"?`\\
|
|
2
|
+
`:e.value;case"CDO":return"<!--";case"CDC":return"-->";case"number":return e.repr;case"percentage":return`${e.repr}%`;case"dimension":return`${e.repr}${ye(e.unit)}`;case"func":return`${C(e.name)}(${k(e.value)})`;case"block":return`${e.open}${k(e.value)}${ne[e.open]}`;case":":case";":case",":case"[":case"]":case"(":case")":case"{":case"}":return e.type;default:return""}}function k(e){let r="",t;for(let n of e)n.type==="whitespace"&&t?.type==="whitespace"||(t&&ge(B(t),B(n))&&(r+="/**/"),r+=be(n),t=n);return r}var he=new Set(L),ie=new Set(W),J=new Set(M),ke=new Set(U),xe=new Set(X),we=new Set(Y),Q=/^#[A-Za-z_][A-Za-z0-9_.:-]*$/,y=e=>e.replace(/[A-Z]/g,r=>r.toLowerCase()),Ce=e=>y(e);function $(e,r,t){let n=[];for(let o of r){if(o.type==="bad-url"||o.type==="bad-string"){t({reason:"unreadable",...e?{name:e}:{}});return}if(o.type==="url"){if(e&&J.has(e)&&Q.test(o.value)){n.push({type:"func",name:"url",value:[{type:"string",value:o.value}]});continue}t({reason:"url",...e?{name:e}:{}});return}if(o.type==="func"){let i=y(o.name);if(i==="url"||i==="src"){let u=o.value.filter(d=>d.type!=="whitespace"),c=u[0];if(i==="url"&&u.length===1&&c?.type==="string"&&e&&J.has(e)&&Q.test(c.value)){n.push({type:"func",name:"url",value:[{type:"string",value:c.value}]});continue}t({reason:"url",...e?{name:e}:{}});return}if(!ie.has(i)){t({reason:"function",name:i});return}let a=$(e,o.value,t);if(!a)return;i==="var"?n.push({type:"whitespace"},{type:"func",name:i,value:a},{type:"whitespace"}):n.push({type:"func",name:i,value:a});continue}if(o.type==="block"){if(o.open==="{"||o.open==="("&&n.at(-1)?.type==="ident"){t({reason:"unreadable",...e?{name:e}:{}});return}let i=$(e,o.value,t);if(!i)return;n.push({type:"block",open:o.open,value:i});continue}if(o.type==="at-keyword"||o.type==="CDO"||o.type==="CDC"||o.type==="{"||o.type==="}"||o.type===";"||o.type===")"||o.type==="]"||o.type==="delim"&&o.value==="\\"){t({reason:"unreadable",...e?{name:e}:{}});return}n.push(o)}return n}var Se=/^(animation|transition|scroll-behavior|outline)/,ve="--graview-ring-color",Ee="--graview-focus-color",Re=e=>{let r=e.filter(n=>n.type!=="whitespace"),t=r[0];return r.length!==1||!t?!1:t.type==="hash"?/^(?:[0-9a-f]{3}|[0-9a-f]{6})$/i.test(t.value):t.type==="ident"&&!["transparent","currentcolor"].includes(y(t.value))},_e=new Set(["url","src","image-set","-webkit-image-set"]),ae=e=>{for(let r of e){if(r.type==="func"&&_e.has(y(r.name)))return y(r.name);if(r.type==="func"||r.type==="block"){let t=ae(r.value);if(t)return t}}};function T(e,r,t=!1){let n=e.name.startsWith("--"),o=n?e.name:Ce(e.name);if(o===ve||!n&&!he.has(o)){r({reason:"property",name:o});return}if(o===Ee&&!Re(e.value)){r({reason:"value",name:o});return}let i=K[o];if(i){let c=e.value.filter(x=>x.type!=="whitespace"),d=c[0],f=c.length===1&&d?.type==="ident"?y(d.value):void 0;if(!f||![...i,"inherit","initial","unset","revert"].includes(f)){r({reason:"value",name:o});return}return`${o}: ${f}${e.important&&!(t&&o==="all")?" !important":""}`}let a=$(n?void 0:o,e.value,r);if(!a)return;let u=k(a).trim();return`${n?`--${E(e.name.slice(2))}`:o}: ${u}${e.important&&!(t&&Se.test(o))?" !important":""}`}var I=e=>e.some(r=>r.type==="}"||r.type===";"||r.type===")"||r.type==="]"||r.type==="at-keyword"||r.type==="CDO"||r.type==="CDC"||r.type==="delim"&&r.value==="\\"||(r.type==="func"||r.type==="block")&&I(r.value));function se(e,r){if(I(e))return r({reason:"unreadable",name:"selector"}),!1;let t=ae(e);if(t)return r({reason:"url",name:t}),!1;let n=o=>{for(let i=0;i<o.length;i+=1){let a=o[i];if(i>0&&o[i-1].type===":"&&(a.type==="ident"||a.type==="func")){let c=y(a.type==="ident"?a.value:a.name);if(xe.has(c)||(c.startsWith("-webkit-")||c.startsWith("-moz-"))&&!we.has(c))return r({reason:"selector",name:c}),!1}if(a.type==="url"||a.type==="bad-url"||a.type==="bad-string"||a.type==="at-keyword"||a.type==="CDO"||a.type==="CDC"||a.type==="block"&&a.open==="{")return r({reason:"unreadable",name:"selector"}),!1;if(a.type==="func"&&!n(a.value)||a.type==="block"&&!n(a.value))return!1}return!0};return n(e)}function z(e,r,t){let n=[];for(let o of A(e))if(o.type==="declaration"){let i=T(o,r);i&&n.push(`${i};`)}else{let i=_(o,r,t+1,"style");i&&n.push(i)}return n.join(" ")}function Te(e,r,t){if(I(e)){t({reason:"unreadable",name:`@${r}`});return}let n=o=>o.every(i=>{if(i.type==="url"||i.type==="bad-url"||i.type==="bad-string"||i.type==="block"&&i.open==="{")return t({reason:i.type==="url"?"url":"unreadable",name:`@${r}`}),!1;if(i.type==="func"){let a=y(i.name);return r==="supports"&&a==="selector"?se(i.value,t):ie.has(a)?n(i.value):(t({reason:"function",name:a}),!1)}if(i.type==="block"){if(r==="supports"){let a=A(i.value);if(a.length===1&&a[0].type==="declaration")return T(a[0],t)!==void 0}return n(i.value)}return!0});return n(e)?k(e).trim():void 0}function V(e){return e.map((r,t)=>{let n=e[t-1],o=n?.type===":"||n?.type==="delim"&&(n.value==="."||n.value==="|");return r.type==="ident"&&!o&&Object.prototype.hasOwnProperty.call(j,y(r.value))?{type:"block",open:"[",value:[{type:"ident",value:"data-graview-as"},{type:"delim",value:"="},{type:"string",value:y(r.value)}]}:r.type==="func"?{type:"func",name:r.name,value:V(r.value)}:r.type==="block"&&r.open==="("?{type:"block",open:"(",value:V(r.value)}:r})}function _(e,r,t,n){if(t>te){r({reason:"unreadable",name:"nesting"});return}if(e.type==="qualified"){if(n==="keyframes"){if(!e.prelude.every(f=>f.type==="whitespace"||f.type===","||f.type==="percentage"||f.type==="ident"&&["from","to"].includes(y(f.value)))){r({reason:"unreadable",name:"keyframe"});return}return`${k(e.prelude).trim()} { ${z(e.block,r,t)} }`}if(!se(e.prelude,r))return;let c=k(V(e.prelude)).trim();if(c===""){r({reason:"unreadable",name:"selector"});return}return`${c} { ${z(e.block,r,t)} }`}let o=y(e.name),i=o==="-webkit-keyframes"?"keyframes":o;if(!ke.has(i)||n==="keyframes"){r({reason:"at-rule",name:`@${o}`});return}if(!e.block){r({reason:"unreadable",name:`@${o}`});return}if(i==="keyframes"){if(n!=="sheet"){r({reason:"at-rule",name:"@keyframes"});return}let c=e.prelude.filter(b=>b.type!=="whitespace"),d=c[0];if(c.length!==1||!d||d.type!=="ident"&&d.type!=="string"){r({reason:"unreadable",name:"@keyframes"});return}let f=w(e.block,!1).map(b=>_(b,r,t+1,"keyframes")).filter(b=>b!==void 0);return`@keyframes ${d.type==="ident"?C(d.value):R(d.value)} { ${f.join(" ")} }`}let a=Te(e.prelude,i,r);if(a===void 0)return;let u=n==="style"?z(e.block,r,t):w(e.block,!1).map(c=>_(c,r,t+1,"sheet")).filter(c=>c!==void 0).join(" ");return`@${i} ${a} { ${u} }`}function le(e,r=S){let t=[];if(e.length>r)return{css:"",refused:[{reason:"size"}]};let n=i=>void t.push(i);return{css:w(N(e),!0).map(i=>_(i,n,0,"sheet")).filter(i=>i!==void 0).join(`
|
|
3
|
+
`),refused:t}}function Oe(e,r=S){let t=[],n=[],o=0;for(let i of e){if(o+i.length>r){n.push({reason:"size"});continue}o+=i.length;let a=le(i,r);a.css&&t.push(a.css),n.push(...a.refused)}return{css:t.join(`
|
|
4
|
+
`),refused:n}}function ze(e,r=S){let t=[];if(e.length>r)return{css:"",refused:[{reason:"size"}]};let n=i=>void t.push(i),o=[];for(let i of A(N(e))){if(i.type!=="declaration"){n({reason:"unreadable",name:"a rule in a style attribute"});continue}let a=T(i,n,!0);a&&o.push(a)}return{css:o.join("; "),refused:t}}function Pe(e,r){let t,n=T(oe(e,N(r)),o=>t??=o);return n===void 0||t?{refused:t??{reason:"unreadable",name:e}}:{value:n.slice(n.indexOf(":")+1).trim()}}var ce=["montserrat","serif","sans-serif","monospace","cursive","fantasy","system-ui","math","emoji","-apple-system","blinkmacsystemfont","georgia","times new roman","times","iowan old style","palatino","palatino linotype","charter","cambria","baskerville","optima","helvetica","helvetica neue","arial","verdana","segoe ui","roboto","avenir","avenir next","gill sans","menlo","monaco","consolas","sf mono","sfmono-regular","courier new"],$e=/^\/graview\/assets\/[0-9a-f]{64}\.(?:woff2|woff|ttf|otf)$/,Ve=/^https:\/\/([a-z0-9.-]+(?::\d+)?)\/[A-Za-z0-9._~!$&*+,;=:@%/-]*\.(?:woff2|woff|ttf|otf)(?:\?[A-Za-z0-9._~!$&*+,;=:@%/?-]*)?$/i,De=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","math","emoji","fangsong","inherit","initial","unset","revert","default"]);function ue(e){if($e.test(e))return{asset:e};let r=Ve.exec(e);return r?{https:e,origin:`https://${r[1].toLowerCase()}`}:void 0}var Fe=e=>{let r=n=>Number.isInteger(n)&&n>=1&&n<=1e3;if(typeof e=="number")return r(e);if(typeof e!="string")return!1;let t=e.trim().split(/\s+/).map(Number);return t.length>=1&&t.length<=2&&t.every(r)&&(t.length===1||t[0]<=t[1])};function Ae(e){return[e?.body,e?.display,e?.mono].flatMap(r=>typeof r=="string"?r.split(",").map(t=>t.trim().replace(/^["']|["']$/g,"").trim().replace(/\s+/g," ")).filter(t=>t!==""):[])}function Ne(e,r=[]){if(typeof e!="object"||e===null||Array.isArray(e))return'a face is { "family": <its name>, "src": <its file> }';let{family:t,src:n,weight:o,style:i}=e;if(typeof t!="string"||t.length>60||!/^[A-Za-z0-9][A-Za-z0-9-]*(?: [A-Za-z0-9-]+)*$/.test(t))return"its family is words of letters, digits and hyphens with single spaces between them, at most 60 characters";if(De.has(t.toLowerCase()))return`"${t}" is a name CSS keeps for itself`;let a=t.toLowerCase();return ce.includes(a)||a.startsWith("ui-")||r.some(u=>u.toLowerCase()===a)?`"${t}" would replace a face the page already draws in: call it something of its own`:typeof n!="string"||!ue(n)?`its src is a file the app holds (/graview/assets/<sha256>.woff2) or an https: address of a WOFF2, WOFF, TTF or OTF file, not ${JSON.stringify(n)}`:o!==void 0&&!Fe(o)?'its weight is a whole number from 1 to 1000, or a range of two ("300 700")':i!==void 0&&i!=="normal"&&i!=="italic"?'its style is "normal" or "italic"':null}export{ee as a,le as b,Oe as c,ze as d,Pe as e,ue as f,Ae as g,Ne as h};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as f}from"./chunk.2YSE3SQN.js";import"./chunk.Q6WOIE5I.js";import"./chunk.4TDYDIIM.js";import"./chunk.STHWM422.js";import"./chunk.Q355UPFG.js";import{p as g}from"./chunk.IZUAZ6EV.js";import"./chunk.KFYSKZC4.js";import"./chunk.VNI6HZEF.js";import"./chunk.THLT6NVO.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.MB7LKKUD.js";import"./chunk.I46VNAMS.js";import"./chunk.3BE4SHZD.js";import"./chunk.LG2BQ5LB.js";import"./chunk.L3ST2YKI.js";import"./chunk.7VCYVCYM.js";import"./chunk.CJHCUHVN.js";import"./chunk.MFNWHXGL.js";import"./chunk.DCIYOZYP.js";import"./chunk.O5P6LXHF.js";import"./chunk.BJUUSIQY.js";import"./chunk.VGQDPEB5.js";import"./chunk.WIVNFOQR.js";import"./chunk.XOZU4OFA.js";import"./chunk.53GQQETN.js";import"./chunk.WVUJXDXZ.js";import"./chunk.J7GH2CGV.js";import"./chunk.SMF5S4DQ.js";import"./chunk.XP4IVKKR.js";import"./chunk.R5YGW5ZX.js";import"./chunk.QMGBAKX6.js";import"./chunk.PS765ODQ.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{G as b,_ as h}from"./chunk.ASNVH2G4.js";import"./chunk.SDO3U72B.js";import{Ae as n}from"./chunk.ZDUKVXBI.js";import"./chunk.FQLNBIQ5.js";import{b as t}from"./chunk.AJZBJBMO.js";var m=t(b(),1),a=t(h(),1);function P({store:c,auto:y,brand:i,views:u,presence:s,steering:r,overview:o,scope:d,titleLevel:w=2,quickAsk:l,props:e}){let v=(0,m.useMemo)(()=>g({scope:`.${d}`}),[d]);return(0,a.jsxs)("div",{"data-embed-content":"",style:y?{flex:"0 0 auto",background:"var(--graview-ground)"}:{flex:"1 1 auto",minHeight:0,overflow:"auto",background:"var(--graview-ground)"},children:[(0,a.jsx)("style",{children:v}),(0,a.jsx)("div",{"data-embed-measure":"",style:{display:"flow-root"},children:(0,a.jsx)(f,{context:{store:c,embedded:!0,...e.bar!==!1?{barAbove:!0}:{},...o?{overview:o}:{},titleLevel:w,views:u,settings:e.app.settings??[],app:e.app,...s?{presence:s}:{},...i?{brand:i}:{},...e.locale?{locale:e.locale}:{},...e.timeZone?{timeZone:e.timeZone}:{},...e.principal?{principal:e.principal}:{},...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{},...e.subscriptions?{subscriptions:e.subscriptions}:{},dismissals:e.dismissals,whileAway:e.whileAway,...e.signIn?{signIn:e.signIn}:{},...l!==void 0?{quickAsk:l}:{}},...e.pages?{registry:e.pages}:{},...r?{steering:r}:{},...e.routing==="address"?n(e.basePath)===""?{}:{basename:n(e.basePath)}:{initialPath:e.path??"/"},...e.path!==void 0?{path:e.path}:{},...e.hrefOf?{hrefOf:e.hrefOf}:e.routing==="address"?{}:{hrefOf:!1},...e.onNavigate?{onNavigate:e.onNavigate}:{}})})]})}export{P as PagesContent};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{F as j,G as D,H as cn,I as q,J as _,L as v,M as gn,Ma as bn,Q as yn,T as L,U as pn,Ua as kn,V as hn,W as J,X as mn,Y as B,Z as Q,da as X,db as An,fa as nn,ia as wn,ja as $n,kc as tn,rb as Sn,rc as xn,ua as en}from"./chunk.ZDUKVXBI.js";var rn="$subject",on="$arg",we=e=>e.t==="ident"?e.name===rn?"subject":e.name===on?"arg":void 0:void 0;var Qn=864e5,Z=e=>String(e).padStart(2,"0"),K=e=>new Date(e).toISOString().slice(0,10),T=e=>Date.UTC(+e.slice(0,4),+e.slice(5,7)-1,+e.slice(8,10)),Xn=(e,t)=>K(T(e)+t*Qn),En=e=>new Date(T(e)).getUTCDay(),ne=e=>/T\d\d:\d\d(:[\d.]+)?(Z|[+-]\d\d:?\d\d)$/.test(e),an=["sun","mon","tue","wed","thu","fri","sat"],Tn=e=>gn(e)??"UTC";function Gn(e,t){if(j.test(e))return K(T(e))===e?{day:e}:void 0;if(D.test(e))return{day:e.length===4?`${e}-01-01`:`${e}-01`};if(_.test(e)&&!ne(e)){let l=e.slice(0,10);return K(T(l))!==l?void 0:{day:l,minutes:Number(e.slice(11,13))*60+Number(e.slice(14,16))}}let s=Date.parse(e);if(!Number.isNaN(s))return{...pn(s,t),stamp:s}}var Nn=["EEEE","EEE","MMMM","MMM","yyyy","HH","mm","h","a","d"],Mn=/[A-Za-z]+/y;function ee(e){let t=[],s=0;for(;s<e.length;){let l=e[s];if(l==="'"){let f="",c=s+1;for(;c<e.length;c++){if(e[c]==="'"){if(e[c+1]==="'"){f+="'",c++;continue}break}f+=e[c]}if(c>=e.length)return`the quoted words in "${e}" are never closed`;t.push({text:f}),s=c+1;continue}Mn.lastIndex=s;let u=Mn.exec(e);if(u){let f=u[0];for(;f.length>0;){let c=Nn.find(w=>f.startsWith(w));if(!c)return`"${f}" is not a piece of a date pattern; the pieces are ${Nn.map(w=>`${w}`).join(", ")}, and other words go in single quotes`;t.push(c),f=f.slice(c.length)}s+=u[0].length;continue}t.push({text:l}),s++}return t}var Rn="UTC",On=new Map;function te(e,t){let s=`${e}|${JSON.stringify(t)}`,l=On.get(s);if(!l){try{l=new Intl.DateTimeFormat(e,{...t,timeZone:Rn})}catch{l=new Intl.DateTimeFormat("en-US",{...t,timeZone:Rn})}On.set(s,l)}return l}var P=(e,t,s,l)=>te(e,t).formatToParts(s).find(u=>u.type===l)?.value??"";function Fn(e,t,s){let l=ee(t);if(typeof l=="string")return{problem:l};let u=yn(s),f=T(e.day),c=e.minutes,w=c===void 0?void 0:f+c*6e4;return l.map(k=>{if(typeof k!="string")return k.text;switch(k){case"EEEE":return P(u,{weekday:"long"},f,"weekday");case"EEE":return P(u,{weekday:"short"},f,"weekday");case"MMMM":return P(u,{month:"long"},f,"month");case"MMM":return P(u,{month:"short"},f,"month");case"yyyy":return e.day.slice(0,4);case"d":return String(Number(e.day.slice(8,10)));case"HH":return c===void 0?"":Z(Math.floor(c/60));case"mm":return c===void 0?"":Z(c%60);case"h":return c===void 0?"":String((Math.floor(c/60)+11)%12+1);case"a":return w===void 0?"":P(u,{hour:"numeric",hour12:!0},w,"dayPeriod")}}).join("")}var re=/^(\d{1,2}):(\d{2})$/;function Vn(e){let t=re.exec(e.trim());if(!t)return;let s=Number(t[1]),l=Number(t[2]);return s<=23&&l<=59?s*60+l:void 0}var Dn=e=>new Date(e).toISOString().replace(/\.\d{3}Z$/,"Z"),oe=(e,t)=>`${e}T${Z(Math.floor(t/60))}:${Z(t%60)}`;function _n(e,t,s){return Dn(hn(e.day,t,s))}function Wn(e,t){if(e.stamp!==void 0)return Dn(e.stamp+t*6e4);let s=T(e.day)+(e.minutes??0)*6e4+t*6e4,l=K(s);return oe(l,Math.round((s-T(l))/6e4))}var Cn=e=>an[En(e.day)];function In(e,t){let s=(En(e.day)-an.indexOf(t)+7)%7;return Xn(e.day,-s)}var jn=e=>typeof e=="string"&&an.includes(e);var Ln=1e4,$=class{constructor(t){this.nodes=t}},Un=Symbol.for("@graview/core:far-record"),ae=e=>typeof e=="object"&&e!==null&&e[Un]===!0;function ie(e){let t={...e.fields,id:`@${e.address}/${e.kind}:${e.id}`,kind:`@${e.address}/${e.kind}`,label:e.label};return Object.defineProperty(t,Un,{value:!0}),t}function Ee(e){let t=`the linked record in ${e.ref.address}`;return e.reason==="denied"?`${t} is not one this viewer may open`:`${t} has not been read`}var se="",y=class extends Error{constructor(s,l){super(s);this.sentence=s;this.at=l}},sn=class extends y{},G=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof $)&&typeof e.id=="string",Pn=e=>{let t=new Set;return new $(e.filter(s=>!t.has(s.id)&&t.add(s.id)))},A=e=>e===null?"nothing":e instanceof $?"a set of records":Array.isArray(e)?"a list":G(e)?"a record":typeof e=="string"?"a word":typeof e;function de(e,t){if(!D.test(e)&&!D.test(t))return;let s=f=>q(_.test(f)?f.slice(0,10):f),l=s(e),u=s(t);return l&&u?[l,u]:void 0}function vn(e,t){let s=t.budget??Ln,l=(n,i)=>{if(s-=n,s<0)throw new sn("this rule looks at too much of the graph to judge in one go",i)},u=t.today??v(),f=t.now??new Date().toISOString(),c=Tn(t.timeZone),w=new Map,k=new Set,S=t.bindings,F=t.args,W=t.subject,O=!1,ln=(n,i,o,a)=>{let p=`${n?.id}\0${i}`;if(w.has(p))return w.get(p);if(k.has(p))throw new y(`"${i}"${n?` of ${en(n.kind)}`:""} depends on itself`,a);k.add(p);let[r,d,g,h]=[S,F,W,O];S=F=void 0,W=n,O=!1;let b=s;s=Math.max(b,Ln);try{let m=x(o,n);return w.set(p,m),m}finally{s=b,S=r,F=d,W=g,O=h,k.delete(p)}},C=(n,i,o)=>{l(1,o);let a=t.kinds.get(n.kind),p=a?.computed?.get(i);if(p)return ln(n,i,p,o);let r=a?.linked?.get(i);if(r){let h=bn(Object.hasOwn(n,i)?n[i]:void 0,r);l(h.length,o);let b=t.linked??kn(t.graph),m=h.flatMap(N=>{let Y=b?b(N):{unread:!0};return"record"in Y?[ie(Y.record)]:(t.onUnread?.({relation:i,ref:N,reason:"denied"in Y?"denied":"unread"}),[])});return r.cardinality==="one"?m[0]??null:new $(m)}let d=Object.hasOwn(n,i);if(a?.fields.has(i)||d){let h=d?An(n,i,u):void 0;return h===void 0?null:h}let g=a?.edges.get(i);if(g){let h=t.graph.out(n.id,i);return l(h.length,o),g==="one"?h[0]??null:new $(h)}if(i==="id")return n.id;if(ae(n))return null;throw new y(`${en(n.kind)} has no field or relation called "${i}"`,o)},M=(n,i,o)=>{if(n instanceof $)return n;if(n===null)return new $([]);if(G(n))return new $([n]);throw new y(`${o}(\u2026) needs a set of records, and was given ${A(n)}`,i)},E=(n,i,o)=>{if(n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean")return String(n);throw new y(`${o}(\u2026) needs a word, and was given ${A(n)}`,i)},H=(n,i,o)=>{let a=E(n,i,o);if(a===null)return null;let p=D.test(a)?q(a).from:a,r=Date.parse(p.length===10?`${p}T00:00:00Z`:p);if(Number.isNaN(r))throw new y(`${o}(\u2026) needs a date, and "${a}" is not one`,i);return r},I=(n,i,o)=>{if(n===null)return null;if(typeof n!="string")throw new y(`${o}(\u2026) needs a date, and was given ${A(n)}`,i);let a=Gn(n,c);if(!a)throw new y(`${o}(\u2026) needs a date, and "${n}" is not one`,i);return a},V=(n,i)=>G(n)&&G(i)?n.id===i.id:G(n)&&typeof i=="string"?n.id===i:typeof n=="string"&&G(i)?n===i.id:Array.isArray(n)&&Array.isArray(i)?n.length===i.length&&n.every((o,a)=>V(o,i[a])):n===i,R=(n,i,o)=>{if(n===null)return!1;if(typeof n=="boolean")return n;throw new y(`${o} must be true or false, and was ${A(n)}`,i)},U=(n,i)=>{let o=O;O=!0;try{return x(i,n)}finally{O=o}},qn=(n,i)=>{let o=t.kinds.get(n.kind);return o?o.fields.has(i)||o.edges.has(i)||o.computed?.has(i)===!0||o.linked?.has(i)===!0:Object.hasOwn(n,i)};function x(n,i){switch(l(1,n.at),n.t){case"lit":return n.value;case"list":return n.items.map(o=>x(o,i));case"ident":{if(n.name===rn){if(W)return W}else{if(O&&i&&qn(i,n.name))return C(i,n.name,n.at);let o=S&&Object.hasOwn(S,n.name)?S[n.name]:void 0;if(o!==void 0)return o;if(i)return C(i,n.name,n.at)}throw new y(`"${n.name}" means nothing in a rule over the whole graph`,n.at)}case"member":{if(n.object.t==="ident"&&n.object.name===on)return F&&Object.hasOwn(F,n.name)?F[n.name]??null:null;let o=x(n.object,i);if(o===null)return null;if(G(o))return C(o,n.name,n.at);throw new y(`".${n.name}" needs a record before it, and was given ${A(o)}`,n.at)}case"unary":{let o=x(n.operand,i);if(n.op==="!")return!R(o,n.at,"what follows not");if(o===null)return null;if(typeof o!="number")throw new y(`"-" needs a number, and was given ${A(o)}`,n.at);return-o}case"where":{let o=M(x(n.set,i),n.at,"where");return l(o.nodes.length,n.at),new $(o.nodes.filter(a=>R(U(a,n.filter),n.at,"a where condition")))}case"binary":return Jn(n,i);case"call":return Bn(n,i)}}function Jn(n,i){if(n.op==="&&")return R(x(n.left,i),n.at,"each side of and")&&R(x(n.right,i),n.at,"each side of and");if(n.op==="||")return R(x(n.left,i),n.at,"each side of or")||R(x(n.right,i),n.at,"each side of or");let o=x(n.left,i),a=x(n.right,i);if(n.op==="&"||n.op==="|"||n.op==="-"&&(o instanceof $||a instanceof $)){let p=M(o,n.at,n.op).nodes,r=M(a,n.at,n.op).nodes;l(p.length+r.length,n.at);let d=new Set(r.map(g=>g.id));return Pn(n.op==="|"?[...p,...r]:p.filter(g=>d.has(g.id)===(n.op==="&")))}switch(n.op){case"==":return V(o,a);case"!=":return!V(o,a);case"in":{if(a===null)return!1;if(a instanceof $)return a.nodes.some(p=>V(o,p));if(Array.isArray(a))return a.some(p=>V(o,p));if(typeof a=="string"&&typeof o=="string")return a.includes(o);throw new y(`"in" needs a list or a set on its right, and was given ${A(a)}`,n.at)}case"<":case"<=":case">":case">=":{if(o===null||a===null)return!1;if(!(typeof o=="number"&&typeof a=="number"||typeof o=="string"&&typeof a=="string"))throw new y(`cannot compare ${A(o)} with ${A(a)}`,n.at);let r=typeof o=="string"&&typeof a=="string"?de(o,a):void 0;if(r){let[d,g]=r,h=d.to<g.from,b=d.from>g.to,m=d.from===g.from&&d.to===g.to;return n.op==="<"?h:n.op==="<="?h||m:n.op===">"?b:b||m}return n.op==="<"?o<a:n.op==="<="?o<=a:n.op===">"?o>a:o>=a}default:{if(o===null||a===null)return null;if(n.op==="+"&&(typeof o=="string"||typeof a=="string")){let p=`${E(o,n.at,"+")}${E(a,n.at,"+")}`;if(p.length>1e4)throw new y("that makes a word too long",n.at);return p}if(typeof o!="number"||typeof a!="number")throw new y(`"${n.op}" needs numbers, and was given ${A(o)} and ${A(a)}`,n.at);return(n.op==="/"||n.op==="%")&&a===0?null:n.op==="+"?o+a:n.op==="-"?o-a:n.op==="*"?o*a:n.op==="/"?o/a:o%a}}}function un(n,i){let o=n.t==="call"&&(n.fn==="in"||n.fn==="out")&&n.args.length===1?n.args[0]:void 0;if(!(!i||o?.t!=="lit"||typeof o.value!="string"))return l(1,n.at),n.fn==="out"?t.graph.out(i.id,o.value):t.graph.in(i.id,o.value)}function Bn(n,i){let o=(r,d=r)=>{if(n.args.length<r||n.args.length>d)throw new y(`${n.fn}(\u2026) takes ${r===d?r:`${r} to ${d}`} argument${d===1?"":"s"}`,n.at)},a=r=>x(n.args[r],i),p=r=>{let d=a(r);if(typeof d!="string")throw new y(`${n.fn}(\u2026) needs a quoted name, like ${n.fn}('name')`,n.at);return d};switch(n.fn){case"out":case"in":{o(1,2);let r=(h,b)=>n.fn==="out"?t.graph.out(h,b):t.graph.in(h,b);if(n.args.length===2){let h=M(a(0),n.at,n.fn).nodes,b=p(1);return Pn(h.flatMap(m=>{let N=r(m.id,b);return l(N.length+1,n.at),N}))}let d=p(0);if(!i)throw new y(`${n.fn}('${d}') needs a record to start from`,n.at);let g=r(i.id,d);return l(g.length,n.at),new $(g)}case"all":{o(1,2);let r=t.graph.nodesOfKind(p(0),{archived:n.args.length===2?a(1):!1});return l(r.length,n.at),new $(r)}case"archived":return o(0,1),Sn(n.args.length===1?a(0):i);case"count":return o(1),(un(n.args[0],i)??M(a(0),n.at,"count").nodes).length;case"exists":return o(1),(un(n.args[0],i)??M(a(0),n.at,"exists").nodes).length>0;case"every":case"some":{o(2);let r=M(a(0),n.at,n.fn);l(r.nodes.length,n.at);let d=g=>R(U(g,n.args[1]),n.at,`the condition in ${n.fn}(\u2026)`);return n.fn==="every"?r.nodes.every(d):r.nodes.some(d)}case"sum":case"min":case"max":{o(2);let r=M(a(0),n.at,n.fn);l(r.nodes.length,n.at);let d=n.args[1],g=d.t==="lit"&&typeof d.value=="string"?d.value:void 0,h=d.t==="ident"?`'${d.name}'`:g!==void 0?`'${g}'`:"\u2026",b=r.nodes.map(m=>d.t==="ident"?C(m,d.name,n.at):g!==void 0?C(m,g,n.at):U(m,d)).filter(m=>{if(m===null)return!1;if(typeof m!="number")throw new y(`${n.fn}(\u2026, ${h}) needs a number for each member, and found ${A(m)}`,n.at);return!0});return n.fn==="sum"?b.reduce((m,N)=>m+N,0):b.length===0?null:n.fn==="min"?Math.min(...b):Math.max(...b)}case"fact":{o(1);let r=p(0),d=t.kinds.get(se)?.computed?.get(r);if(!d)throw new y(`no fact is called "${r}"`,n.at);return ln(null,r,d,n.at)}case"first":return o(1),M(a(0),n.at,"first").nodes[0]??null;case"sort":{o(2,3);let r=M(a(0),n.at,"sort"),d=n.args.length===3?a(2):"asc";if(d!=="asc"&&d!=="desc")throw new y("sort(\u2026) goes 'asc' or 'desc'",n.at);let g=r.nodes.length;l(g+g*Math.ceil(Math.log2(g+1)),n.at);let h=r.nodes.map((m,N)=>({node:m,i:N,key:U(m,n.args[1])})),b=d==="desc"?-1:1;return h.sort((m,N)=>fn(m.key,N.key,b,n.at)||m.i-N.i),new $(h.map(m=>m.node))}case"either":{if(n.args.length<1)throw new y("either(\u2026) takes at least one argument",n.at);for(let r=0;r<n.args.length;r++){let d=a(r);if(d!==null&&!(d instanceof $&&d.nodes.length===0))return d}return null}case"present":{o(1);let r=a(0);return r===null||r===""?!1:Array.isArray(r)?r.length>0:r instanceof $?r.nodes.length>0:!0}case"len":{o(1);let r=a(0);if(r===null)return 0;if(typeof r=="string"||Array.isArray(r))return r.length;if(r instanceof $)return r.nodes.length;throw new y(`len(\u2026) needs a word or a list, and was given ${A(r)}`,n.at)}case"contains":case"startsWith":{o(2);let r=a(0),d=a(1);if(r===null||d===null)return!1;if(n.fn==="contains"&&Array.isArray(r))return r.some(b=>V(b,d));let g=E(r,n.at,n.fn),h=E(d,n.at,n.fn);return n.fn==="contains"?g.toLowerCase().includes(h.toLowerCase()):g.startsWith(h)}case"lower":{o(1);let r=E(a(0),n.at,"lower");return r===null?null:r.toLowerCase()}case"concat":{if(n.args.length<1)throw new y("concat(\u2026) takes at least one argument",n.at);let r="";for(let d=0;d<n.args.length;d++)r+=E(a(d),n.at,"concat")??"";if(r.length>1e4)throw new y("that makes a word too long",n.at);return r}case"format":{o(2);let r=I(a(0),n.at,"format"),d=a(1);if(typeof d!="string")throw new y("format(\u2026) says its pattern in quotes, like format(start, 'EEE h:mm a')",n.at);if(r===null)return null;let g=Fn(r,d,t.locale);if(typeof g!="string")throw new y(g.problem,n.at);return g}case"datetime":case"at":{o(2);let r=I(a(0),n.at,n.fn),d=a(1);if(d===null||r===null)return null;let g=typeof d=="string"?Vn(d):void 0;if(g===void 0)throw new y(`${n.fn}(\u2026) needs a time of day written like '09:30', and was given ${typeof d=="string"?`"${d}"`:A(d)}`,n.at);return _n(r,g,c)}case"addMinutes":{o(2);let r=I(a(0),n.at,"addMinutes"),d=a(1);if(r===null||d===null)return null;if(typeof d!="number"||!Number.isFinite(d))throw new y(`addMinutes(\u2026) needs a number of minutes, and was given ${A(d)}`,n.at);return Wn(r,Math.round(d))}case"weekday":{o(1);let r=I(a(0),n.at,"weekday");return r===null?null:Cn(r)}case"startOfWeek":{o(1,2);let r=I(a(0),n.at,"startOfWeek"),d=n.args.length===2?a(1):"mon";if(!jn(d))throw new y("startOfWeek(\u2026) starts the week on a day said 'mon' to 'sun'",n.at);return r===null?null:In(r,d)}case"today":return o(0),u;case"now":return o(0),f;case"date":{o(1);let r=H(a(0),n.at,"date");return r===null?null:new Date(r).toISOString().slice(0,10)}case"days":case"hours":{o(2);let r=H(a(0),n.at,n.fn),d=H(a(1),n.at,n.fn);if(r===null||d===null)return null;let g=(d-r)/(n.fn==="days"?864e5:36e5);return n.fn==="days"?Math.round(g):g}case"round":{o(1,2);let r=a(0);if(r===null)return null;if(typeof r!="number")throw new y(`round(\u2026) needs a number, and was given ${A(r)}`,n.at);let d=n.args.length===2?a(1):0;if(typeof d!="number"||!Number.isInteger(d)||d<0||d>12)throw new y("round(\u2026, places) takes a whole number of places from 0 to 12",n.at);let g=10**d,h=Math.sign(r)*Math.round(Math.abs(r)*g*(1+Number.EPSILON))/g;return Object.is(h,-0)?0:h}case"if":return o(3),R(a(0),n.at,"the condition in if(\u2026)")?a(1):a(2);default:throw new y(`"${n.fn}" is not a function the rule language knows`,n.at)}}function fn(n,i,o,a){if(n===null||i===null)return n===i?0:n===null?1:-1;if(Array.isArray(n)&&Array.isArray(i)){for(let r=0;r<Math.max(n.length,i.length);r++){let d=fn(n[r]??null,i[r]??null,o,a);if(d!==0)return d}return 0}let p=r=>typeof r=="number"||typeof r=="string"||typeof r=="boolean"?typeof r:A(r);if(p(n)!==p(i)||typeof n=="object"||typeof i=="object")throw new y(`sort(\u2026) cannot put ${A(n)} and ${A(i)} in order`,a);return typeof n=="string"?o*(n<i?-1:n>i?1:0):o*(Number(n)-Number(i))}return x(e,t.subject)}var Te=["out","in","all","count","exists","every","some","sum","min","max","present","len","contains","startsWith","lower","today","now","date","days","hours","if","first","sort","either","fact","archived","round","concat","format","datetime","at","addMinutes","weekday","startOfWeek"];var le=(e,t,s,l,u)=>({severity:"error",code:e,path:t,message:s,...l?{fix:l}:{},...u}),Fe=(e,t,s,l,u)=>({...le(e,t,s,l,u?.length?{edits:u}:void 0),severity:"warning"}),Ve=e=>e.some(t=>t.severity==="error");function ue(e,t){return[...(e.edits??[]).map(s=>`${t}edit: ${JSON.stringify(s)}`),...e.details?[`${t}details: ${e.details}`]:[],...(e.fixes??[]).flatMap(s=>[`${t}fix: ${s.label}`,...(s.edits??[]).map(l=>`${t} edit: ${JSON.stringify(l)}`)])].map(s=>`
|
|
2
|
+
${s}`).join("")}function De(e){return e.map(t=>`${t.severity==="error"?"\u2717":t.severity==="warning"?"!":"\xB7"} ${t.path||"(document)"}: ${t.message}${t.fix?` \u2014 ${t.fix}`:""}${ue(t," ")}`).join(`
|
|
3
|
+
`)}var fe=(e,t)=>e.to==="*"||e.to.includes(t);function Zn(e,t,s){let l=s(e);if(l){if(t.some(u=>l.from.includes(u)))return{step:{relation:e,out:!0},far:l.to};if(t.some(u=>fe(l,u)))return{step:{relation:e,out:!1},far:l.from}}}function We(e,t,s,l){if(!l(t.every))return{problem:{key:"every",message:`"${t.every}" is not a kind this document declares`}};let u=Zn(t.through,[e],s);if(!u){let S=s(t.through);return{problem:{key:"through",message:S?`"${t.through}" is a relation of ${S.from.join(", ")}, not of ${e}, so a ${e} cannot be followed through it`:`"${t.through}" is not a relation any kind declares`,fix:S?`name a relation ${e} declares, or one that points at ${e}`:void 0}}}let f=u.far==="*"?"*":u.far;if(!t.via)return f==="*"||f.includes(t.every)?{plan:{every:t.every,through:u.step}}:{problem:{key:"through",message:`"${t.through}" reaches ${f.join(", ")}, not ${t.every}`,fix:`add "via": the relation from ${f.join(" or ")} to ${t.every}, or name a relation that reaches ${t.every}`}};let c=f==="*"?[t.every]:f,w=Zn(t.via,c,s);if(!w){let S=s(t.via);return{problem:{key:"via",message:S?`"${t.via}" is a relation of ${S.from.join(", ")}, which "${t.through}" does not reach`:`"${t.via}" is not a relation any kind declares`,fix:S?`name a relation of ${c.join(" or ")}, or one that points at it`:void 0}}}let k=f==="*"?[t.every]:w.far;return k==="*"||k.includes(t.every)?{plan:{every:t.every,through:u.step,via:f==="*"?{relation:w.step.relation,out:!w.step.out}:w.step}}:{problem:{key:"via",message:`"${t.via}" reaches ${k.join(", ")}, not ${t.every}`,fix:`name a relation that reaches ${t.every}`}}}var Kn=(e,t,s)=>s.out?e.out(t,s.relation):e.in(t,s.relation);function Ce(e,t,s){let l=new Set;for(let u of Kn(e,t.id,s.through)){if(!s.via){l.add(u.id);continue}for(let f of Kn(e,u.id,s.via))l.add(f.id)}return e.nodesOfKind(s.every).filter(u=>!l.has(u.id))}var Ke=["money","percent","date","time","datetime","relative","upper","lower","count","words","and","plural","excerpt"],ce={getNode:()=>{},allNodes:()=>[],allEdges:()=>[],nodesOfKind:()=>[],edgesOfKind:()=>[],out:()=>[],in:()=>[],neighbors:()=>[],has:()=>!1};function ze(e,t,s,l=[],u,f=z){return dn(e,t,s,l,u,f)}var zn=(e,t)=>e.capital?X(t):t,ge=new Set(["words","plural","relative"]);function He(e,t){let s=e[0];return!s||s.text!==void 0||!s.format||!ge.has(s.format)?t:/^[a-z][a-z'’-]*(?=\s|$|[,.;:!?])/.test(t)?X(t):t}function ye(e){return e?t=>{let s=e.tryDefinition(t.kind)?.label;return s?s(t):z(t)}:z}var Hn=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],Yn=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];function pe(e,t){return!Number.isInteger(e)||e<0||e>99?Q(e,t):e<20?Hn[e]:e%10===0?Yn[e/10]:`${Yn[Math.floor(e/10)]}-${Hn[e%10]}`}function he(e){return/[^aeiou]y$/i.test(e)?`${e.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/i.test(e)?`${e}es`:`${e}s`}var z=e=>String(e.name??e.title??e.label??e.id);function dn(e,t,s,l=[],u,f=z){if(t==="plural"){let c=e instanceof $?e.nodes.length:Array.isArray(e)?e.length:typeof e=="number"?e:null;return c===null||l[0]===void 0?"\u2014":c===1?l[0]:l[1]??he(l[0])}if(e===null)return"\u2014";if(e instanceof $)return t==="count"?String(e.nodes.length):t==="and"?nn(e.nodes.map(f)):e.nodes.map(f).join(", ");if(Array.isArray(e)){if(t==="count")return String(e.length);let c=e.map(w=>dn(w,void 0,s,[],u,f));return t==="and"?nn(c):c.join(", ")}if(typeof e=="object")return f(e);switch(t){case"words":return typeof e=="number"?pe(e,u?.locale):String(e);case"money":return typeof e=="number"?tn(e,u,l[0]==="0"?0:void 0):String(e);case"percent":return typeof e=="number"?Q(e,u?.locale,{style:"percent",maximumFractionDigits:0}):String(e);case"upper":return String(e).toUpperCase();case"lower":return String(e).toLowerCase();case"excerpt":return xn(String(e),Number(l[0])||void 0);case"date":return L(B(String(e),u?.timeZone)??String(e).slice(0,10),u?.locale);case"time":return typeof e=="string"&&j.test(e)?L(e,u?.locale):mn(String(e),u?.locale,u?.timeZone);case"datetime":return typeof e=="string"&&j.test(e)?L(e,u?.locale):J(String(e),u?.locale,u?.timeZone);case"relative":{let c=B(String(e),u?.timeZone),w=c===void 0?Date.parse(String(e)):Date.parse(`${c}T00:00:00Z`);if(Number.isNaN(w))return String(e);let k=Math.round((w-Date.parse(`${s}T00:00:00Z`))/864e5);return k===0?"today":k===1?"tomorrow":k===-1?"yesterday":k>0?`in ${k} days`:`${-k} days ago`}default:return typeof e=="string"&&cn.test(e)?L(e,u?.locale):typeof e=="string"&&_.test(e)?J(e,u?.locale,u?.timeZone):String(e)}}function me(e,t,s){return(Array.isArray(e)?e:[e]).map(l=>t[String(l)]??(s?wn(String(l)):$n(String(l)))).join(", ")}function Ye(e,t){let s=t.today??v(),l=t.name??ye(t.graph?.schema);return e.map(u=>{if(u.text!==void 0)return u.text;try{let f=vn(u.expr,{graph:t.graph??ce,subject:t.node,kinds:t.kinds,today:s,budget:t.budget??500,...t.bindings?{bindings:t.bindings}:{},...t.args?{args:t.args}:{}}),c=u.expr,w=c.t==="ident"||c.t==="member"&&c.object.t==="ident"&&c.object.name[0]==="$"?c.name:void 0,k=!u.format&&w!==void 0&&t.node?t.kinds.get(t.node.kind)?.choices?.get(w):void 0;return k&&(typeof f=="string"||Array.isArray(f))?zn(u,me(f,k,e.length===1)):zn(u,dn(f,u.format,s,u.formatArgs,t.money,l))}catch(f){if(f instanceof y)return"\u2014";throw f}}).join("")}export{rn as a,on as b,we as c,$ as d,Ee as e,se as f,y as g,sn as h,vn as i,Te as j,le as k,Fe as l,Ve as m,De as n,Ke as o,ce as p,ze as q,zn as r,He as s,ye as t,me as u,Ye as v,We as w,Ce as x};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as Ce,d as $e,i as U}from"./chunk.YIDNZTON.js";import{d as Te}from"./chunk.QILGAV7H.js";import{Be as je,Cd as ve,Dd as Oe,L as ke,Pb as ae,_b as se,ae as Re,da as M,db as Se,de as De,fa as xe,fe as We,ge as Me,ha as W,la as _,ma as z,na as Ae,pa as we,qa as Ne,rb as G}from"./chunk.IUVRJDL3.js";function V(n,e){return n.display?.labels?.[e]??W(e)}function de(n){let e=U(n);switch(e.type){case"text":case"date":case"number":case"boolean":case"choice":return e.type;default:return}}function Je(n,e){let t=new Map,i=n.tryDefinition(e);for(let[r,a]of Object.entries(i?.edges??{}))t.set(r,{key:r,label:a.description?M(a.description):W(r),about:"edge",far:a.to==="*"?[...n.kinds]:[...a.to]});for(let r of n.definitions)if(r.kind!==e)for(let[a,s]of Object.entries(r.edges??{}))t.has(a)||s.to!=="*"&&!s.to.includes(e)||t.set(a,{key:a,label:s.inverse?M(s.inverse):W(a),about:"edge",far:[r.kind]});return[...t.values()]}var Ze=["current","past","any","flagged","clear"];function Fe(n,e){let t=n?.lifecycle;if(!t||t.retired==="date")return!1;let i=t.retired.map(String);return e.some(r=>r.key===t.field&&i.includes(r.value))}function Be(n,e){let t=n.tryDefinition(e);if(!t)return{kind:e,sorts:[],filters:[],groups:[]};let i=new Set(t.display?.hide??[]),r=t.fields.shape??{},a=[{key:"label",label:"Name",about:"label",type:"text"}],s=[],u=[];for(let[g,k]of Object.entries(r)){if(g==="id"||g==="kind"||g==="label"||i.has(g))continue;let A=en(k);if(A){s.push({key:g,label:V(t,g),about:"field",type:"choice",options:A});continue}let w=de(k);if(!w)continue;let N=V(t,g),O=w==="choice"?Le(k):w==="boolean"?["true","false"]:void 0,S={key:g,label:N,about:"field",type:w,...O?{options:O}:{}};a.push(S),s.push(S),(w==="boolean"||w==="choice")&&u.push(S),w==="date"&&u.push({...S,buckets:["day","week","month","year","decade"]})}for(let g of Je(n,e))a.push(g),s.push(g),u.push(g);let l={key:"is",label:t.lifecycle?"Standing and currency":"Standing",about:"is",type:"choice",options:t.lifecycle?[...Ze]:["flagged","clear"]};s.push(l);let y=t.fieldRoles?.order,f=y&&(y in r||y==="label")?{by:y,direction:"asc"}:void 0;return{kind:e,sorts:a,filters:s,groups:u,...f?{natural:f}:{}}}function On(n,e){let t=[];for(let r of e.filters){let a=r.about==="edge"&&r.far?.length===1?n.tryDefinition(r.far[0]):void 0;if(!(!a||a.kind===e.kind))for(let[s,u]of Object.entries(a.fields.shape??{}))de(u)!=="choice"||a.display?.hide?.includes(s)||t.push({key:`${r.key}.${s}`,label:`${r.label} \xB7 ${V(a,s)}`,about:"via",type:"choice",options:Le(u),far:[a.kind]})}if(t.length===0)return e;let i=e.filters.filter(r=>r.about!=="is");return{...e,filters:[...i,...t,...e.filters.filter(r=>r.about==="is")]}}function Rn(n,e){let t=n.tryDefinition(e.kind),i=Object.entries(t?.computed??{});if(!t||i.length===0)return e;let r=i.filter(([a])=>!e.sorts.some(s=>s.key===a)).map(([a,s])=>({key:a,label:(typeof s=="object"?s.label:void 0)??V(t,a),about:"field",type:"number"}));return{...e,sorts:[...e.sorts,...r]}}function Le(n){let e=U(n);return e.type==="choice"?e.options:[]}function en(n){let e=U(n);return e.type==="several"&&e.of.type==="choice"?e.of.options:void 0}var Ie=n=>n,Pe=n=>n;function nn(n,e,t){let i=new Map;for(let r of[...n.out(e,t),...n.in(e,t)])i.set(r.id,r);return[...i.values()]}function le(n,e,t){let i=n.schema.tryDefinition(e.kind);if(t.key==="is")switch(t.value){case"current":return _(i,Pe(e),n.today);case"past":return!_(i,Pe(e),n.today);case"any":return!0;case"flagged":return n.flagged?.has(e.id)??!1;case"clear":return!(n.flagged?.has(e.id)??!1);default:return!0}let r=i?.fields.shape??{};if(t.key in r){let l=Se(Ie(e),t.key,n.today??ke()),y=de(r[t.key]);if(y==="date"){let[f,g]=t.value.split(":");if(typeof l!="string"||!g)return!1;let k=l.slice(0,10);return f==="before"?k<g:f==="after"?k>g:k===g}if(y==="boolean")return String(l)===t.value;if(Array.isArray(l))return l.some(f=>String(f)===t.value);if(y==="number"){let f=t.value.lastIndexOf(":"),g=f>0?t.value.slice(0,f):"",k=Number(t.value.slice(f+1));if(g==="at-most"||g==="at-least")return typeof l!="number"||!Number.isFinite(k)?!1:g==="at-most"?l<=k:l>=k}return String(l)===t.value}let[a,s]=t.key.split("."),u=nn(n.graph,e.id,a);return s?u.some(l=>String(Ie(l)[s])===t.value):t.value==="*"?u.length>0:t.value==="none"?u.length===0:u.some(l=>l.id===t.value)}var tn=5;function ze(n){return n.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function ce(n){return ze(n).replace(/ /g,"")}var X=new Map,rn=5e4;function $(n){let e=X.get(n);if(e===void 0){X.size>=rn&&X.clear();let t=ze(n);e={tokens:t.split(" ").filter(Boolean),whole:t.replace(/ /g,"")},X.set(n,e)}return e}var T=n=>[...$(n).tokens];function j(n,e){if(e.length===0)return;let{whole:t,tokens:i}=$(n),r=e.join("");if(t.length===0)return;if(t===r)return"exact";if(e.every(s=>i.some(u=>u.startsWith(s))))return t.startsWith(r)?"prefix":e.every(s=>i.includes(s))?"word":"part"}function q(n,e,t=48){let i=n.replace(/\s+/g," ").trim();if(i.length<=t)return i;let r=e[0],a=i.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase(),s=r?a.search(new RegExp(`(^|[^\\p{L}\\p{N}])${on(r)}`,"u")):-1,u=s<0?0:s+(a[s]&&/[\p{L}\p{N}]/u.test(a[s])?0:1),l=Math.max(0,u-Math.floor(t/3));if(l>0){let f=i.lastIndexOf(" ",l);l=f<0?0:f+1}let y=Math.min(i.length,l+t);if(y<i.length){let f=i.indexOf(" ",y);y=f<0||f-y>16?y:f}return`${l>0?"\u2026":""}${i.slice(l,y).trim()}${y<i.length?"\u2026":""}`}var on=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),an=/^([\p{L}][\p{L}\p{N}_-]*):(\S+)$/u;function sn(n){let e=[],t=[];for(let i of n.trim().split(/\s+/).filter(Boolean)){let r=an.exec(i);r?t.push({key:r[1],value:r[2]}):e.push(i)}return{words:e.join(" "),conditions:t}}var Ee=new WeakMap;function Q(n,e){let t=Ee.get(e);if(t&&t.definition===n)return t.texts;let i=dn(n,e);return Ee.set(e,{definition:n,texts:i}),i}function dn(n,e){let t=z(n,e),i=[{field:"label",reading:"Name",text:t}];for(let r of $e(e,n,{limit:Number.POSITIVE_INFINITY}))r.key==="label"||r.value===t||typeof e[r.key]!="boolean"&&i.push({field:r.key,reading:r.label,text:r.markdown?Te(r.value):r.value});return i}var I={exact:0,prefix:1,word:2,part:3,field:4,near:5},Ge=new Set(["a","an","the","of","and","or","for","to","in","on","at","by","with","my","our","is"]);function Ke(n){let e=n;e.length>4&&e.endsWith("ies")?e=`${e.slice(0,-3)}y`:e.length>4&&/(ss|x|ch|sh|z)es$/.test(e)?e=e.slice(0,-2):e.length>3&&e.endsWith("s")&&!/(ss|us|is)$/.test(e)&&(e=e.slice(0,-1));for(let t of["ing","ed"])if(e.length>t.length+2&&e.endsWith(t)){e=e.slice(0,-t.length),/([b-df-hj-km-np-rtv-z])\1$/.test(e)&&(e=e.slice(0,-1));break}return e.length>3&&e.endsWith("e")?e.slice(0,-1):e}function He(n,e,t){if(Math.abs(n.length-e.length)>t)return t+1;let i=[],r=Array.from({length:e.length+1},(a,s)=>s);for(let a=1;a<=n.length;a++){let s=[a],u=a;for(let l=1;l<=e.length;l++){let y=Math.min(r[l]+1,s[l-1]+1,r[l-1]+(n[a-1]===e[l-1]?0:1));a>1&&l>1&&n[a-1]===e[l-2]&&n[a-2]===e[l-1]&&(y=Math.min(y,i[l-2]+1)),s[l]=y,y<u&&(u=y)}if(u>t)return t+1;i=r,r=s}return r[e.length]}var Y=new Map;function ln(n,e){let t=Y.get(n);t||(Y.size>=64&&Y.clear(),Y.set(n,t=new Map));let i=t.get(e);return i===void 0&&(i=cn(n,e)??null,t.set(e,i)),i??void 0}function cn(n,e){if(/\d/.test(n))return;let t=Ke(n);if(t.length>=3&&(Ke(e)===t||t.length>=4&&e.startsWith(t)))return"stem";let i=n.length<4?0:n.length<=7?1:2;if(i!==0){if(He(n,e,i)<=i)return"spelling";if(n.length>=5){for(let r=n.length-i;r<=n.length+i;r++)if(r<e.length&&He(n,e.slice(0,r),i)<=i)return"spelling"}}}function fn(n,e){let t=e.length>1?e.filter(r=>!Ge.has(r)):e;if(t.length===0)return;let i;for(let r of t){let a;for(let s of n){for(let u of $(s.text).tokens){if(u.startsWith(r)){a={text:s,matched:u};break}let l=a?void 0:ln(r,u);l&&(a={text:s,matched:u,by:l})}if(a&&!a.by)break}if(!a)return;a.by&&!i&&(i={text:a.text,asked:r,matched:a.matched,by:a.by})}if(i)return{field:i.text.field,reading:i.text.reading,fragment:q(i.text.text,[i.matched]),strength:"near",asked:i.asked,matched:i.matched,by:i.by}}var un=80;function gn(n,e,t){let i=T(e).filter(s=>!Ge.has(s)).join(" ")||e,r=t===void 0?[]:T(t),a=r.length>0&&n.find(s=>r.every(u=>$(s.text).tokens.some(l=>l.startsWith(u))))||n[0];return{field:a.field,reading:a.reading,fragment:q(a.text,r),strength:"near",asked:i,matched:(t??a.text).slice(0,un),by:"meaning"}}function _e(n,e,t,i){let r=T(t);if(r.length===0)return;if(i){let A=Q(n,e),w=i.includes("label")||i.some(v=>typeof e[v]=="string"&&e[v]===A[0].text),N=A.filter((v,D)=>D===0?w:i.includes(v.field)),O=v=>D=>$(D.text).tokens.some(P=>P.startsWith(v));if(!r.every(v=>N.some(O(v))))return;let S=N.find(O(r[0]));return{field:S.field,reading:S.reading,fragment:q(S.text,r),strength:S.field==="label"?j(S.text,r)??"field":"field"}}let a=Q(n,e),[s,...u]=a,l=j(s.text,r);if(l)return{field:"label",reading:s.reading,fragment:q(s.text,r),strength:l};let y=A=>w=>$(w.text).tokens.some(N=>N.startsWith(A));if(!r.every(A=>a.some(y(A))))return;let f=T(s.text),g=r.find(A=>!f.some(w=>w.startsWith(A)))??r[0],k=u.find(y(g));return{field:k.field,reading:k.reading,fragment:q(k.text,[g]),strength:"field"}}var yn=512,hn=64;function pn(n){let e=new Map;if(n.length===0)return e;let t=n.slice(-yn),i=n[n.length-1].seq;for(let r of t){let a=Math.pow(.5,(i-r.seq)/hn);for(let s of r.writes)e.set(s,(e.get(s)??0)+a)}return e}var ue=(n,e)=>we({tryDefinition:()=>n},e),fe=(n,e)=>De({tryDefinition:()=>n},e);function mn(n,e,t){let i=n.tryDefinition(e),r=[{field:"plural",text:ue(i,e)},{field:"kind",text:W(e)},...i?.noun?[{field:"noun",text:i.noun}]:[],...(i?.aliases??[]).map(s=>({field:"alias",text:s}))],a;for(let s of r){let u=j(s.text,t);u&&(!a||I[u]<I[a.strength])&&(a={strength:u,...s})}return a}var bn,kn=(n,e)=>(bn??=new Intl.Collator(void 0,{sensitivity:"base",numeric:!0})).compare(n,e),qe=(n,e)=>(n.nearly??0)-(e.nearly??0)||(n.archived??0)-(e.archived??0)||n.tier-e.tier||n.inKind-e.inKind||n.near-e.near||n.past-e.past||n.touched-e.touched||n.flagged-e.flagged||kn(n.name,e.name)||(n.id<e.id?-1:n.id>e.id?1:0);function En(n,e,t={}){let i=n.schema,r=sn(e),a=T(r.words),s=t.principal??{kind:"human"},u=n.kindsKeptFrom(s),l=n.modules.disabledKinds,y=r.conditions.filter(o=>o.key==="kind").map(o=>o.value),f=r.conditions.filter(o=>o.key==="is").map(o=>o.value),g=f.includes("any")||f.includes("past"),k=f.includes("past")&&!f.includes("any")&&!f.includes("current"),A=f.includes("archived")?!0:t.archived??"all",w=(o,d)=>{let c=ce(d),h=i.tryDefinition(o);return ce(o)===c||ce(ue(h,o))===c},N=i.kinds.filter(o=>!u.has(o)&&!l.has(o)&&(t.kinds===void 0||t.kinds.includes(o))&&(y.length===0||y.some(d=>w(o,d)))),S=r.conditions.filter(o=>o.key!=="kind").map(o=>({...o,admittedBy:N.filter(d=>Be(i,d).filters.some(c=>c.key===o.key))})),v=S.filter(o=>o.key!=="is"),D=f.filter(o=>o==="flagged"||o==="clear"||o==="past"||o==="archived"),P={kinds:N,past:g},Qe={hits:[],words:r.words,conditions:S,searched:P,byKind:{},total:0,matched:[]};if(a.length===0&&v.length===0&&D.length===0)return Qe;let J=t.today,F=t.flagged??new Set(n.violations().flatMap(o=>o.nodeIds)),Ue=t.touched??pn(n.log.all()),Z=new Set;for(let o of t.from??[]){Z.add(o);for(let d of n.graph.neighbors(o))Z.add(d.id)}let ge=ve(n,s)?Oe(n,s):void 0,ee=se.keptFrom?.(n,s)&&n.seenBy(s).graph,ne=o=>je(o,t.basePath===void 0?{}:{basePath:t.basePath}),ye={schema:i,graph:n.graph,flagged:F,...J?{today:J}:{}},R=[],B={},L=[],E=[],K=(o,d,c,h,p,m)=>{let x=z(c,o);B[d]=(B[d]??0)+1,R.push({hit:{about:"node",id:o.id,kind:d,label:x,why:p,current:h,flagged:F.has(o.id),address:ne(`${fe(c,d)}/${encodeURIComponent(o.id)}`),...m===void 0?{}:{near:!0},...G(o)?{archived:!0}:{}},...m===void 0?{}:{nearly:2-m},tier:I[p.strength],inKind:d===t.inKind?0:1,near:Z.has(o.id)?0:1,past:h?0:1,archived:G(o)?1:0,touched:-(Ue.get(o.id)??0),flagged:F.has(o.id)?0:1,name:x,id:o.id})};for(let o of N){let d=i.tryDefinition(o),c=S.filter(p=>p.key!=="is"&&p.admittedBy.includes(o));if(a.length===0&&c.length===0&&D.length===0)continue;let h=Fe(d,c);for(let p of n.graph.nodesOfKind(o,{archived:A})){if(ge&&!ge(p.id))continue;let m=ee?ee.getNode(p.id):p;if(!m)continue;let x=_(d,m,J);if(!g&&!h&&!x){if(a.length>0&&f.length===0&&c.every(b=>le(ye,m,b))){let b=_e(d,m,r.words);b&&E.push({node:m,kind:o,definition:d,why:b})}continue}if(k&&x||!c.every(b=>le(ye,m,b))||f.includes("flagged")&&!F.has(m.id)||f.includes("clear")&&F.has(m.id))continue;let C=a.length>0?_e(d,m,r.words):c[0]?{field:c[0].key,reading:W(c[0].key),fragment:`${c[0].key}:${c[0].value}`,strength:"field"}:{field:"is",reading:"Is",fragment:`is:${D[0]}`,strength:"field"};C?K(m,o,d,x,C):a.length>0&&L.push({node:m,kind:o,definition:d,current:x})}}let te=o=>o.strength!=="field",re=!1;if(E.length>0&&R.length===0){re=!0;for(let o of E)K(o.node,o.kind,o.definition,!1,o.why)}else if(E.some(o=>te(o.why))&&!R.some(o=>te(o.hit.why))){re=!0;for(let o of E)te(o.why)&&K(o.node,o.kind,o.definition,!1,o.why)}let he=t.near!==!1&&a.length>0&&R.length<tn&&L.length>0,ie=new Set;if(he)for(let o of L){let d=fn(Q(o.definition,o.node),a);d&&(ie.add(o.node.id),K(o.node,o.kind,o.definition,o.current,d,d.by==="stem"?.9:.8))}let Ve=o=>o==="exact"||o==="prefix"?-1:I[o],oe=(o,d,c,h)=>({hit:o,tier:Ve(d),inKind:1,near:1,past:0,touched:0,flagged:1,name:c,id:h});if(a.length>0){for(let d of N){let c=mn(i,d,a);if(!c)continue;let h=Ne(i,d),p={field:c.field,reading:c.field==="plural"?"Plural":"Kind",fragment:c.text,strength:c.strength};R.push(oe({about:"kind",kind:d,label:h,why:p,count:B[d]??0,address:ne(fe(i.tryDefinition(d),d))},c.strength,h,`kind:${d}`))}let o=t.places??[];for(let d of Re(o.filter(c=>N.includes(c.kind)))){if(d.across&&u.has(d.across))continue;let c=j(d.title,a);if(!c)continue;let h={field:"title",reading:"Title",fragment:d.title,strength:c},p=Me(d,o)?fe(i.tryDefinition(d.kind),d.kind).slice(1):void 0,m=ne(We(d.as,p));R.push(oe({about:"place",kind:d.kind,title:d.title,as:d.as,why:h,address:m},c,d.title,`place:${d.kind}:${d.as}`))}for(let d of n.allInvariants()){let c=d.scope==="graph"?void 0:d.scope.kind;if(c&&!N.includes(c))continue;let h=d.label??W(d.name),p=j(h,a),m=p?void 0:j(W(d.name),a),x=p??m;if(!x)continue;let C={field:p?"label":"name",reading:p?"Rule":"Name",fragment:p?h:d.name,strength:x};R.push(oe({about:"rule",name:d.name,label:h,...c?{kind:c}:{},why:C},x,h,`rule:${d.name}`))}}let pe=()=>{R.sort(qe);let o=t.limit??50,d=R.slice(0,o).map(b=>b.hit),c=d.flatMap(b=>b.about==="node"?[(ee||n.graph).getNode(b.id)]:[]).filter(Boolean),h=Ce(c,b=>i.tryDefinition(b)),p=d.map(b=>b.about==="node"&&h.has(b.id)?{...b,apart:h.get(b.id)}:b),m=Object.values(B).reduce((b,Ye)=>b+Ye,0),x=R.flatMap(b=>b.hit.about==="node"?[b.hit.id]:[]),C=t.subject&&N.includes(String(n.graph.getNode(t.subject)?.kind))?xn(n,t.subject,r.words,{principal:s}):[];return{hits:[...p,...C],words:r.words,conditions:S,searched:re?{...P,past:!0}:P,byKind:{...B},total:m,matched:x}},H=pe(),me=t.rank;if(!he||!me)return H;let be=L.filter(o=>!ie.has(o.node.id)).map(({node:o,kind:d,definition:c})=>({id:o.id,kind:d,label:z(c,o),texts:Q(c,o)}));if(be.length===0)return H;let Xe=(async()=>{let o;try{o=await me(r.words,be)}catch{return H}let d=new Map(L.filter(h=>!ie.has(h.node.id)).map(h=>[h.node.id,h])),c=!1;for(let{id:h,score:p,matched:m}of Array.isArray(o)?o:[]){let x=d.get(h);!x||!(p>0)||(d.delete(h),c=!0,K(x.node,x.kind,x.definition,x.current,gn(Q(x.definition,x.node),r.words,typeof m=="string"?m:void 0),Math.min(1,p)))}return c?pe():H})();return{...H,later:Xe}}function xn(n,e,t,i={}){let r=i.principal??{kind:"human"},a=(se.keptFrom?.(n,r)?n.seenBy(r):n).graph.getNode(e);if(!a)return[];if(n.kindsKeptFrom(r).has(a.kind))return[];let s=T(t),u=z(n.schema.tryDefinition(a.kind),a),l=[];for(let f of n.allMutations()){let g=f.subject;if(!g||g.kinds!=="*"&&!g.kinds.includes(a.kind))continue;let k=f.derived?.act;if((k==="archive"||k==="merge")&&G(a)||k==="unarchive"&&!G(a)||k==="leave-alone"&&ae(a)||k==="allow-tidying"&&!ae(a)||!n.permits({name:f.name,args:{[g.arg]:a.id}},r).ok)continue;let A=Ae(f),w=T(A),N=s.filter(v=>w.some(D=>D.startsWith(v))),O=N.length>0?j(A,N):void 0,S=O?{field:"title",reading:"Act",fragment:A,strength:O}:{field:"subject",reading:"On",fragment:u,strength:"field"};l.push({hit:{about:"act",name:f.name,title:A,subject:a.id,why:S,destructive:f.destructive===!0},tier:O?I[O]:I.field+1,inKind:0,near:0,past:f.destructive?1:0,touched:0,flagged:f.pinned?0:1,name:A,id:`act:${f.name}`})}l.sort(qe);let y=l.map(f=>f.hit);return i.limit===void 0?y:y.slice(0,i.limit)}function Kn(n,e){let t=e.kinds.map((a,s)=>{let u=ue(n.tryDefinition(a),a);return s===0?u:u.toLowerCase()}),i=xe(t)||"Nothing";return e.kinds.some(a=>n.tryDefinition(a)?.lifecycle)?e.past?`${M(i)}, past ones included.`:`${M(i)}, current ones; add is:any for past ones.`:`${M(i)}.`}export{V as a,de as b,Je as c,Fe as d,Be as e,On as f,Rn as g,Le as h,Ie as i,Pe as j,nn as k,le as l,ze as m,ce as n,sn as o,_e as p,pn as q,En as r,xn as s,Kn as t};
|
|
1
|
+
import{b as Ce,d as $e,i as U}from"./chunk.P3Z4ZCL3.js";import{d as Te}from"./chunk.45OLF6BK.js";import{Be as je,Cd as ve,Dd as Oe,L as ke,Pb as ae,_b as se,ae as Re,da as M,db as Se,de as De,fa as xe,fe as We,ge as Me,ha as W,la as _,ma as z,na as Ae,pa as we,qa as Ne,rb as G}from"./chunk.ZDUKVXBI.js";function V(n,e){return n.display?.labels?.[e]??W(e)}function de(n){let e=U(n);switch(e.type){case"text":case"date":case"number":case"boolean":case"choice":return e.type;default:return}}function Je(n,e){let t=new Map,i=n.tryDefinition(e);for(let[r,a]of Object.entries(i?.edges??{}))t.set(r,{key:r,label:a.description?M(a.description):W(r),about:"edge",far:a.to==="*"?[...n.kinds]:[...a.to]});for(let r of n.definitions)if(r.kind!==e)for(let[a,s]of Object.entries(r.edges??{}))t.has(a)||s.to!=="*"&&!s.to.includes(e)||t.set(a,{key:a,label:s.inverse?M(s.inverse):W(a),about:"edge",far:[r.kind]});return[...t.values()]}var Ze=["current","past","any","flagged","clear"];function Fe(n,e){let t=n?.lifecycle;if(!t||t.retired==="date")return!1;let i=t.retired.map(String);return e.some(r=>r.key===t.field&&i.includes(r.value))}function Be(n,e){let t=n.tryDefinition(e);if(!t)return{kind:e,sorts:[],filters:[],groups:[]};let i=new Set(t.display?.hide??[]),r=t.fields.shape??{},a=[{key:"label",label:"Name",about:"label",type:"text"}],s=[],u=[];for(let[g,k]of Object.entries(r)){if(g==="id"||g==="kind"||g==="label"||i.has(g))continue;let A=en(k);if(A){s.push({key:g,label:V(t,g),about:"field",type:"choice",options:A});continue}let w=de(k);if(!w)continue;let N=V(t,g),O=w==="choice"?Le(k):w==="boolean"?["true","false"]:void 0,S={key:g,label:N,about:"field",type:w,...O?{options:O}:{}};a.push(S),s.push(S),(w==="boolean"||w==="choice")&&u.push(S),w==="date"&&u.push({...S,buckets:["day","week","month","year","decade"]})}for(let g of Je(n,e))a.push(g),s.push(g),u.push(g);let l={key:"is",label:t.lifecycle?"Standing and currency":"Standing",about:"is",type:"choice",options:t.lifecycle?[...Ze]:["flagged","clear"]};s.push(l);let y=t.fieldRoles?.order,f=y&&(y in r||y==="label")?{by:y,direction:"asc"}:void 0;return{kind:e,sorts:a,filters:s,groups:u,...f?{natural:f}:{}}}function On(n,e){let t=[];for(let r of e.filters){let a=r.about==="edge"&&r.far?.length===1?n.tryDefinition(r.far[0]):void 0;if(!(!a||a.kind===e.kind))for(let[s,u]of Object.entries(a.fields.shape??{}))de(u)!=="choice"||a.display?.hide?.includes(s)||t.push({key:`${r.key}.${s}`,label:`${r.label} \xB7 ${V(a,s)}`,about:"via",type:"choice",options:Le(u),far:[a.kind]})}if(t.length===0)return e;let i=e.filters.filter(r=>r.about!=="is");return{...e,filters:[...i,...t,...e.filters.filter(r=>r.about==="is")]}}function Rn(n,e){let t=n.tryDefinition(e.kind),i=Object.entries(t?.computed??{});if(!t||i.length===0)return e;let r=i.filter(([a])=>!e.sorts.some(s=>s.key===a)).map(([a,s])=>({key:a,label:(typeof s=="object"?s.label:void 0)??V(t,a),about:"field",type:"number"}));return{...e,sorts:[...e.sorts,...r]}}function Le(n){let e=U(n);return e.type==="choice"?e.options:[]}function en(n){let e=U(n);return e.type==="several"&&e.of.type==="choice"?e.of.options:void 0}var Ie=n=>n,Pe=n=>n;function nn(n,e,t){let i=new Map;for(let r of[...n.out(e,t),...n.in(e,t)])i.set(r.id,r);return[...i.values()]}function le(n,e,t){let i=n.schema.tryDefinition(e.kind);if(t.key==="is")switch(t.value){case"current":return _(i,Pe(e),n.today);case"past":return!_(i,Pe(e),n.today);case"any":return!0;case"flagged":return n.flagged?.has(e.id)??!1;case"clear":return!(n.flagged?.has(e.id)??!1);default:return!0}let r=i?.fields.shape??{};if(t.key in r){let l=Se(Ie(e),t.key,n.today??ke()),y=de(r[t.key]);if(y==="date"){let[f,g]=t.value.split(":");if(typeof l!="string"||!g)return!1;let k=l.slice(0,10);return f==="before"?k<g:f==="after"?k>g:k===g}if(y==="boolean")return String(l)===t.value;if(Array.isArray(l))return l.some(f=>String(f)===t.value);if(y==="number"){let f=t.value.lastIndexOf(":"),g=f>0?t.value.slice(0,f):"",k=Number(t.value.slice(f+1));if(g==="at-most"||g==="at-least")return typeof l!="number"||!Number.isFinite(k)?!1:g==="at-most"?l<=k:l>=k}return String(l)===t.value}let[a,s]=t.key.split("."),u=nn(n.graph,e.id,a);return s?u.some(l=>String(Ie(l)[s])===t.value):t.value==="*"?u.length>0:t.value==="none"?u.length===0:u.some(l=>l.id===t.value)}var tn=5;function ze(n){return n.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function ce(n){return ze(n).replace(/ /g,"")}var X=new Map,rn=5e4;function $(n){let e=X.get(n);if(e===void 0){X.size>=rn&&X.clear();let t=ze(n);e={tokens:t.split(" ").filter(Boolean),whole:t.replace(/ /g,"")},X.set(n,e)}return e}var T=n=>[...$(n).tokens];function j(n,e){if(e.length===0)return;let{whole:t,tokens:i}=$(n),r=e.join("");if(t.length===0)return;if(t===r)return"exact";if(e.every(s=>i.some(u=>u.startsWith(s))))return t.startsWith(r)?"prefix":e.every(s=>i.includes(s))?"word":"part"}function q(n,e,t=48){let i=n.replace(/\s+/g," ").trim();if(i.length<=t)return i;let r=e[0],a=i.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase(),s=r?a.search(new RegExp(`(^|[^\\p{L}\\p{N}])${on(r)}`,"u")):-1,u=s<0?0:s+(a[s]&&/[\p{L}\p{N}]/u.test(a[s])?0:1),l=Math.max(0,u-Math.floor(t/3));if(l>0){let f=i.lastIndexOf(" ",l);l=f<0?0:f+1}let y=Math.min(i.length,l+t);if(y<i.length){let f=i.indexOf(" ",y);y=f<0||f-y>16?y:f}return`${l>0?"\u2026":""}${i.slice(l,y).trim()}${y<i.length?"\u2026":""}`}var on=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),an=/^([\p{L}][\p{L}\p{N}_-]*):(\S+)$/u;function sn(n){let e=[],t=[];for(let i of n.trim().split(/\s+/).filter(Boolean)){let r=an.exec(i);r?t.push({key:r[1],value:r[2]}):e.push(i)}return{words:e.join(" "),conditions:t}}var Ee=new WeakMap;function Q(n,e){let t=Ee.get(e);if(t&&t.definition===n)return t.texts;let i=dn(n,e);return Ee.set(e,{definition:n,texts:i}),i}function dn(n,e){let t=z(n,e),i=[{field:"label",reading:"Name",text:t}];for(let r of $e(e,n,{limit:Number.POSITIVE_INFINITY}))r.key==="label"||r.value===t||typeof e[r.key]!="boolean"&&i.push({field:r.key,reading:r.label,text:r.markdown?Te(r.value):r.value});return i}var I={exact:0,prefix:1,word:2,part:3,field:4,near:5},Ge=new Set(["a","an","the","of","and","or","for","to","in","on","at","by","with","my","our","is"]);function Ke(n){let e=n;e.length>4&&e.endsWith("ies")?e=`${e.slice(0,-3)}y`:e.length>4&&/(ss|x|ch|sh|z)es$/.test(e)?e=e.slice(0,-2):e.length>3&&e.endsWith("s")&&!/(ss|us|is)$/.test(e)&&(e=e.slice(0,-1));for(let t of["ing","ed"])if(e.length>t.length+2&&e.endsWith(t)){e=e.slice(0,-t.length),/([b-df-hj-km-np-rtv-z])\1$/.test(e)&&(e=e.slice(0,-1));break}return e.length>3&&e.endsWith("e")?e.slice(0,-1):e}function He(n,e,t){if(Math.abs(n.length-e.length)>t)return t+1;let i=[],r=Array.from({length:e.length+1},(a,s)=>s);for(let a=1;a<=n.length;a++){let s=[a],u=a;for(let l=1;l<=e.length;l++){let y=Math.min(r[l]+1,s[l-1]+1,r[l-1]+(n[a-1]===e[l-1]?0:1));a>1&&l>1&&n[a-1]===e[l-2]&&n[a-2]===e[l-1]&&(y=Math.min(y,i[l-2]+1)),s[l]=y,y<u&&(u=y)}if(u>t)return t+1;i=r,r=s}return r[e.length]}var Y=new Map;function ln(n,e){let t=Y.get(n);t||(Y.size>=64&&Y.clear(),Y.set(n,t=new Map));let i=t.get(e);return i===void 0&&(i=cn(n,e)??null,t.set(e,i)),i??void 0}function cn(n,e){if(/\d/.test(n))return;let t=Ke(n);if(t.length>=3&&(Ke(e)===t||t.length>=4&&e.startsWith(t)))return"stem";let i=n.length<4?0:n.length<=7?1:2;if(i!==0){if(He(n,e,i)<=i)return"spelling";if(n.length>=5){for(let r=n.length-i;r<=n.length+i;r++)if(r<e.length&&He(n,e.slice(0,r),i)<=i)return"spelling"}}}function fn(n,e){let t=e.length>1?e.filter(r=>!Ge.has(r)):e;if(t.length===0)return;let i;for(let r of t){let a;for(let s of n){for(let u of $(s.text).tokens){if(u.startsWith(r)){a={text:s,matched:u};break}let l=a?void 0:ln(r,u);l&&(a={text:s,matched:u,by:l})}if(a&&!a.by)break}if(!a)return;a.by&&!i&&(i={text:a.text,asked:r,matched:a.matched,by:a.by})}if(i)return{field:i.text.field,reading:i.text.reading,fragment:q(i.text.text,[i.matched]),strength:"near",asked:i.asked,matched:i.matched,by:i.by}}var un=80;function gn(n,e,t){let i=T(e).filter(s=>!Ge.has(s)).join(" ")||e,r=t===void 0?[]:T(t),a=r.length>0&&n.find(s=>r.every(u=>$(s.text).tokens.some(l=>l.startsWith(u))))||n[0];return{field:a.field,reading:a.reading,fragment:q(a.text,r),strength:"near",asked:i,matched:(t??a.text).slice(0,un),by:"meaning"}}function _e(n,e,t,i){let r=T(t);if(r.length===0)return;if(i){let A=Q(n,e),w=i.includes("label")||i.some(v=>typeof e[v]=="string"&&e[v]===A[0].text),N=A.filter((v,D)=>D===0?w:i.includes(v.field)),O=v=>D=>$(D.text).tokens.some(P=>P.startsWith(v));if(!r.every(v=>N.some(O(v))))return;let S=N.find(O(r[0]));return{field:S.field,reading:S.reading,fragment:q(S.text,r),strength:S.field==="label"?j(S.text,r)??"field":"field"}}let a=Q(n,e),[s,...u]=a,l=j(s.text,r);if(l)return{field:"label",reading:s.reading,fragment:q(s.text,r),strength:l};let y=A=>w=>$(w.text).tokens.some(N=>N.startsWith(A));if(!r.every(A=>a.some(y(A))))return;let f=T(s.text),g=r.find(A=>!f.some(w=>w.startsWith(A)))??r[0],k=u.find(y(g));return{field:k.field,reading:k.reading,fragment:q(k.text,[g]),strength:"field"}}var yn=512,hn=64;function pn(n){let e=new Map;if(n.length===0)return e;let t=n.slice(-yn),i=n[n.length-1].seq;for(let r of t){let a=Math.pow(.5,(i-r.seq)/hn);for(let s of r.writes)e.set(s,(e.get(s)??0)+a)}return e}var ue=(n,e)=>we({tryDefinition:()=>n},e),fe=(n,e)=>De({tryDefinition:()=>n},e);function mn(n,e,t){let i=n.tryDefinition(e),r=[{field:"plural",text:ue(i,e)},{field:"kind",text:W(e)},...i?.noun?[{field:"noun",text:i.noun}]:[],...(i?.aliases??[]).map(s=>({field:"alias",text:s}))],a;for(let s of r){let u=j(s.text,t);u&&(!a||I[u]<I[a.strength])&&(a={strength:u,...s})}return a}var bn,kn=(n,e)=>(bn??=new Intl.Collator(void 0,{sensitivity:"base",numeric:!0})).compare(n,e),qe=(n,e)=>(n.nearly??0)-(e.nearly??0)||(n.archived??0)-(e.archived??0)||n.tier-e.tier||n.inKind-e.inKind||n.near-e.near||n.past-e.past||n.touched-e.touched||n.flagged-e.flagged||kn(n.name,e.name)||(n.id<e.id?-1:n.id>e.id?1:0);function En(n,e,t={}){let i=n.schema,r=sn(e),a=T(r.words),s=t.principal??{kind:"human"},u=n.kindsKeptFrom(s),l=n.modules.disabledKinds,y=r.conditions.filter(o=>o.key==="kind").map(o=>o.value),f=r.conditions.filter(o=>o.key==="is").map(o=>o.value),g=f.includes("any")||f.includes("past"),k=f.includes("past")&&!f.includes("any")&&!f.includes("current"),A=f.includes("archived")?!0:t.archived??"all",w=(o,d)=>{let c=ce(d),h=i.tryDefinition(o);return ce(o)===c||ce(ue(h,o))===c},N=i.kinds.filter(o=>!u.has(o)&&!l.has(o)&&(t.kinds===void 0||t.kinds.includes(o))&&(y.length===0||y.some(d=>w(o,d)))),S=r.conditions.filter(o=>o.key!=="kind").map(o=>({...o,admittedBy:N.filter(d=>Be(i,d).filters.some(c=>c.key===o.key))})),v=S.filter(o=>o.key!=="is"),D=f.filter(o=>o==="flagged"||o==="clear"||o==="past"||o==="archived"),P={kinds:N,past:g},Qe={hits:[],words:r.words,conditions:S,searched:P,byKind:{},total:0,matched:[]};if(a.length===0&&v.length===0&&D.length===0)return Qe;let J=t.today,F=t.flagged??new Set(n.violations().flatMap(o=>o.nodeIds)),Ue=t.touched??pn(n.log.all()),Z=new Set;for(let o of t.from??[]){Z.add(o);for(let d of n.graph.neighbors(o))Z.add(d.id)}let ge=ve(n,s)?Oe(n,s):void 0,ee=se.keptFrom?.(n,s)&&n.seenBy(s).graph,ne=o=>je(o,t.basePath===void 0?{}:{basePath:t.basePath}),ye={schema:i,graph:n.graph,flagged:F,...J?{today:J}:{}},R=[],B={},L=[],E=[],K=(o,d,c,h,p,m)=>{let x=z(c,o);B[d]=(B[d]??0)+1,R.push({hit:{about:"node",id:o.id,kind:d,label:x,why:p,current:h,flagged:F.has(o.id),address:ne(`${fe(c,d)}/${encodeURIComponent(o.id)}`),...m===void 0?{}:{near:!0},...G(o)?{archived:!0}:{}},...m===void 0?{}:{nearly:2-m},tier:I[p.strength],inKind:d===t.inKind?0:1,near:Z.has(o.id)?0:1,past:h?0:1,archived:G(o)?1:0,touched:-(Ue.get(o.id)??0),flagged:F.has(o.id)?0:1,name:x,id:o.id})};for(let o of N){let d=i.tryDefinition(o),c=S.filter(p=>p.key!=="is"&&p.admittedBy.includes(o));if(a.length===0&&c.length===0&&D.length===0)continue;let h=Fe(d,c);for(let p of n.graph.nodesOfKind(o,{archived:A})){if(ge&&!ge(p.id))continue;let m=ee?ee.getNode(p.id):p;if(!m)continue;let x=_(d,m,J);if(!g&&!h&&!x){if(a.length>0&&f.length===0&&c.every(b=>le(ye,m,b))){let b=_e(d,m,r.words);b&&E.push({node:m,kind:o,definition:d,why:b})}continue}if(k&&x||!c.every(b=>le(ye,m,b))||f.includes("flagged")&&!F.has(m.id)||f.includes("clear")&&F.has(m.id))continue;let C=a.length>0?_e(d,m,r.words):c[0]?{field:c[0].key,reading:W(c[0].key),fragment:`${c[0].key}:${c[0].value}`,strength:"field"}:{field:"is",reading:"Is",fragment:`is:${D[0]}`,strength:"field"};C?K(m,o,d,x,C):a.length>0&&L.push({node:m,kind:o,definition:d,current:x})}}let te=o=>o.strength!=="field",re=!1;if(E.length>0&&R.length===0){re=!0;for(let o of E)K(o.node,o.kind,o.definition,!1,o.why)}else if(E.some(o=>te(o.why))&&!R.some(o=>te(o.hit.why))){re=!0;for(let o of E)te(o.why)&&K(o.node,o.kind,o.definition,!1,o.why)}let he=t.near!==!1&&a.length>0&&R.length<tn&&L.length>0,ie=new Set;if(he)for(let o of L){let d=fn(Q(o.definition,o.node),a);d&&(ie.add(o.node.id),K(o.node,o.kind,o.definition,o.current,d,d.by==="stem"?.9:.8))}let Ve=o=>o==="exact"||o==="prefix"?-1:I[o],oe=(o,d,c,h)=>({hit:o,tier:Ve(d),inKind:1,near:1,past:0,touched:0,flagged:1,name:c,id:h});if(a.length>0){for(let d of N){let c=mn(i,d,a);if(!c)continue;let h=Ne(i,d),p={field:c.field,reading:c.field==="plural"?"Plural":"Kind",fragment:c.text,strength:c.strength};R.push(oe({about:"kind",kind:d,label:h,why:p,count:B[d]??0,address:ne(fe(i.tryDefinition(d),d))},c.strength,h,`kind:${d}`))}let o=t.places??[];for(let d of Re(o.filter(c=>N.includes(c.kind)))){if(d.across&&u.has(d.across))continue;let c=j(d.title,a);if(!c)continue;let h={field:"title",reading:"Title",fragment:d.title,strength:c},p=Me(d,o)?fe(i.tryDefinition(d.kind),d.kind).slice(1):void 0,m=ne(We(d.as,p));R.push(oe({about:"place",kind:d.kind,title:d.title,as:d.as,why:h,address:m},c,d.title,`place:${d.kind}:${d.as}`))}for(let d of n.allInvariants()){let c=d.scope==="graph"?void 0:d.scope.kind;if(c&&!N.includes(c))continue;let h=d.label??W(d.name),p=j(h,a),m=p?void 0:j(W(d.name),a),x=p??m;if(!x)continue;let C={field:p?"label":"name",reading:p?"Rule":"Name",fragment:p?h:d.name,strength:x};R.push(oe({about:"rule",name:d.name,label:h,...c?{kind:c}:{},why:C},x,h,`rule:${d.name}`))}}let pe=()=>{R.sort(qe);let o=t.limit??50,d=R.slice(0,o).map(b=>b.hit),c=d.flatMap(b=>b.about==="node"?[(ee||n.graph).getNode(b.id)]:[]).filter(Boolean),h=Ce(c,b=>i.tryDefinition(b)),p=d.map(b=>b.about==="node"&&h.has(b.id)?{...b,apart:h.get(b.id)}:b),m=Object.values(B).reduce((b,Ye)=>b+Ye,0),x=R.flatMap(b=>b.hit.about==="node"?[b.hit.id]:[]),C=t.subject&&N.includes(String(n.graph.getNode(t.subject)?.kind))?xn(n,t.subject,r.words,{principal:s}):[];return{hits:[...p,...C],words:r.words,conditions:S,searched:re?{...P,past:!0}:P,byKind:{...B},total:m,matched:x}},H=pe(),me=t.rank;if(!he||!me)return H;let be=L.filter(o=>!ie.has(o.node.id)).map(({node:o,kind:d,definition:c})=>({id:o.id,kind:d,label:z(c,o),texts:Q(c,o)}));if(be.length===0)return H;let Xe=(async()=>{let o;try{o=await me(r.words,be)}catch{return H}let d=new Map(L.filter(h=>!ie.has(h.node.id)).map(h=>[h.node.id,h])),c=!1;for(let{id:h,score:p,matched:m}of Array.isArray(o)?o:[]){let x=d.get(h);!x||!(p>0)||(d.delete(h),c=!0,K(x.node,x.kind,x.definition,x.current,gn(Q(x.definition,x.node),r.words,typeof m=="string"?m:void 0),Math.min(1,p)))}return c?pe():H})();return{...H,later:Xe}}function xn(n,e,t,i={}){let r=i.principal??{kind:"human"},a=(se.keptFrom?.(n,r)?n.seenBy(r):n).graph.getNode(e);if(!a)return[];if(n.kindsKeptFrom(r).has(a.kind))return[];let s=T(t),u=z(n.schema.tryDefinition(a.kind),a),l=[];for(let f of n.allMutations()){let g=f.subject;if(!g||g.kinds!=="*"&&!g.kinds.includes(a.kind))continue;let k=f.derived?.act;if((k==="archive"||k==="merge")&&G(a)||k==="unarchive"&&!G(a)||k==="leave-alone"&&ae(a)||k==="allow-tidying"&&!ae(a)||!n.permits({name:f.name,args:{[g.arg]:a.id}},r).ok)continue;let A=Ae(f),w=T(A),N=s.filter(v=>w.some(D=>D.startsWith(v))),O=N.length>0?j(A,N):void 0,S=O?{field:"title",reading:"Act",fragment:A,strength:O}:{field:"subject",reading:"On",fragment:u,strength:"field"};l.push({hit:{about:"act",name:f.name,title:A,subject:a.id,why:S,destructive:f.destructive===!0},tier:O?I[O]:I.field+1,inKind:0,near:0,past:f.destructive?1:0,touched:0,flagged:f.pinned?0:1,name:A,id:`act:${f.name}`})}l.sort(qe);let y=l.map(f=>f.hit);return i.limit===void 0?y:y.slice(0,i.limit)}function Kn(n,e){let t=e.kinds.map((a,s)=>{let u=ue(n.tryDefinition(a),a);return s===0?u:u.toLowerCase()}),i=xe(t)||"Nothing";return e.kinds.some(a=>n.tryDefinition(a)?.lifecycle)?e.past?`${M(i)}, past ones included.`:`${M(i)}, current ones; add is:any for past ones.`:`${M(i)}.`}export{V as a,de as b,Je as c,Fe as d,Be as e,On as f,Rn as g,Le as h,Ie as i,Pe as j,nn as k,le as l,ze as m,ce as n,sn as o,_e as p,pn as q,En as r,xn as s,Kn as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as W,c as I,d as q,f as H}from"./chunk.
|
|
1
|
+
import{a as W,c as I,d as q,f as H}from"./chunk.DCIYOZYP.js";import{a as re,b as ie}from"./chunk.XOZU4OFA.js";import{b as te,c as ne,d as oe}from"./chunk.53GQQETN.js";import{b as X,c as Z,d as L}from"./chunk.T3RFZ66S.js";import{k as ee,l as ae}from"./chunk.TDWJU6GW.js";import{b as Q,k as U,l as T}from"./chunk.P3Z4ZCL3.js";import{G as ge,_ as J}from"./chunk.ASNVH2G4.js";import{Ld as Y,Mc as _,Yb as V,ha as E,ia as K,ma as $,va as B}from"./chunk.ZDUKVXBI.js";import{b as O}from"./chunk.AJZBJBMO.js";var b=O(ge(),1),a=O(J(),1),fe=`
|
|
2
2
|
form:where([data-graview-part="form"]) {
|
|
3
3
|
/* A grid item of the section above it and a grid container for the
|
|
4
4
|
fields below: both halves are allowed to be narrower than what is in
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as te}from"./chunk.I3ADXJQW.js";import"./chunk.BJUUSIQY.js";import"./chunk.7QWGIGHM.js";import"./chunk.I6HIVTXU.js";import"./chunk.PYGNO2AV.js";import"./chunk.3HFBHLXC.js";import{G as ne,Y as N}from"./chunk.CUA7F3YJ.js";import"./chunk.SDO3U72B.js";import{Dd as $,ma as Q,pa as X,pb as Z,zd as ee}from"./chunk.IUVRJDL3.js";import"./chunk.FQLNBIQ5.js";import{b as P}from"./chunk.AJZBJBMO.js";var D=new WeakMap,we=5e3;function I(n){let e=D.get(n);if(e&&Date.now()-e.at<we)return e.list;let t={at:Date.now(),list:Promise.resolve([])};return t.list=Promise.resolve().then(()=>n.list()).catch(()=>[]).then(o=>t.value=[...o,...(t.value??[]).filter(i=>!o.some(l=>l.id===i.id))]),e?.value&&(t.value=e.value),D.set(n,t),t.list}var oe=n=>D.get(n)?.value;function re(n,e){let t=D.get(n);if(!t)return;let o=i=>[...i.filter(l=>l.id!==e.id),e];t.value&&(t.value=o(t.value)),D.set(n,{at:t.at,list:t.list.then(o),...t.value?{value:t.value}:{}})}function A(n,e){let t=$(n,e);return o=>n.graph.getNode(o)!==void 0&&t(o)}var z=["previewed","accepted","declined","undone","abandoned"],ve=["graph","light","full"],S={words:300,should:300,name:80,records:200,people:20,stages:8,examples:5},Se=365,xe=5e3,be=new RegExp("[\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2066-\\u2069]","g");function ie(n,e){if(typeof n!="string")return;let t=n.replace(be," ").replace(/\s+/g," ").trim();return t.length===0?void 0:t.slice(0,e).trimEnd()}function h(n){return typeof n=="string"&&n.length>0&&n.length<=S.name&&/^[\p{L}\p{N}_][\p{L}\p{N}_.:/-]*$/u.test(n)?n:void 0}var W=(n,e)=>Array.isArray(n)?[...new Set(n.flatMap(t=>h(t)??[]))].slice(0,e):[];function ae(n){let e=typeof n.id=="string"?n.id.slice(0,S.name):void 0;return{kind:n.kind,...e!==void 0?{id:e}:{},...n.onBehalfOf?{onBehalfOf:ae(n.onBehalfOf)}:{}}}var le=n=>n?.kind==="visitor"||n?.onBehalfOf?.kind==="visitor",ke=()=>`tl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,Oe=new Set(["record","field","selection","list","lens","place","act"]);function Pe(n){let e=n,t=o=>typeof o=="number"&&Number.isFinite(o)&&o>=0?Math.min(1e4,Math.round(o)):0;switch(e?.type){case"act":{let o=h(e.act);return o?{type:"act",act:o,records:t(e.records)}:void 0}case"plan":return{type:"plan",edits:t(e.edits)};case"answer":return{type:"answer"};case"refusal":return{type:"refusal"};case"view":{let o=typeof e.section=="string"?e.section.replace(/\s+/g," ").trim().slice(0,S.name):"";return o?{type:"view",section:o}:void 0}default:return}}function se(n,e,t={}){if(!n||typeof n!="object"||!e||le(e))return;let o=n,i=ie(o.words,S.words),l=Pe(o.decided),d=o.target;if(!i||!l||!d||!Oe.has(String(d.on)))return;let s={on:d.on,...h(d.kind)?{kind:h(d.kind)}:{},...h(d.id)?{id:h(d.id)}:{},...h(d.place)?{place:h(d.place)}:{}},c=o.reading,a=c&&(c.which==="itself"||c.which==="held")&&h(c.kind)?{which:c.which,kind:h(c.kind),records:W(c.records,S.records)}:void 0,g=W(o.people,S.people),f=Array.isArray(o.stages)?o.stages.flatMap(Te=>{let L=Te,V=h(L?.stage),E=L?.ms;return V&&typeof E=="number"&&Number.isFinite(E)&&E>=0?[{stage:V,ms:Math.round(E),...h(L.model)?{model:h(L.model)}:{}}]:[]}).slice(0,S.stages):[],w=z.includes(o.outcome)?o.outcome:"previewed",y=ve.includes(o.slot)?o.slot:void 0,b=o.rating==="up"||o.rating==="down"?o.rating:void 0,k=b==="down"?ie(o.should,S.should):void 0,O=typeof o.ms=="number"&&Number.isFinite(o.ms)&&o.ms>=0?Math.round(o.ms):void 0,r=t.id??h(o.id)??ke(),p=h(o.conversation)??r,m=h(o.follows),Y=h(o.interaction),J=W(o.examples,S.examples);return{id:r,at:t.at??new Date().toISOString(),by:ae(e),words:i,target:s,...a?{reading:a}:{},...g.length>0?{people:g}:{},decided:l,...y?{slot:y}:{},...f.length>0?{stages:f}:{},...O!==void 0?{ms:O}:{},outcome:w,...b?{rating:b}:{},...k?{should:k}:{},conversation:p,...m?{follows:m}:{},...Y?{interaction:Y}:{},...J.length>0?{examples:J}:{}}}function Ae(n,e){let t=e.outcome===void 0||e.outcome==="previewed"||n.outcome==="accepted"&&e.outcome!=="undone"||n.outcome==="undone"||(n.outcome==="declined"||n.outcome==="abandoned")&&e.outcome==="abandoned"?n.outcome:e.outcome,o=e.rating===void 0?n.rating:e.rating??void 0,i=o!=="down"?void 0:e.should===void 0?n.should:e.should??void 0,{rating:l,should:d,...s}=n;return{...s,outcome:t,...o?{rating:o}:{},...i?{should:i}:{},...e.examples?{examples:e.examples}:{},...e.pinned!==void 0?{pinned:e.pinned}:{},...e.excluded!==void 0?{excluded:e.excluded}:{}}}function Ce(n,e={}){let t=(e.now??Date.now())-(e.retentionDays??Se)*864e5,o=new Map;for(let d of n){let s=Date.parse(d.at);Number.isFinite(s)&&s>=t&&!le(d.by)&&o.set(d.id,d)}let i=[...o.values()],l=e.most??xe;return i.length>l?i.slice(i.length-l):i}function H(n,e,t={}){return"add"in e?Ce([...n,e.add],t):"remove"in e?n.filter(o=>o.id!==e.remove):n.map(o=>o.id===e.change?Ae(o,e.with):o)}var C=n=>n.onBehalfOf?C(n.onBehalfOf):n.id!==void 0?`${n.kind}:${n.id}`:`${n.kind}:?`,Re=n=>[...new Set([...n.target.id?[n.target.id]:[],...n.reading?.records??[],...n.people??[]])];function R(n,e){return n.filter(t=>Re(t).every(e))}var B=n=>!n.excluded&&n.rating!=="down"&&n.outcome!=="undone"&&(n.outcome==="accepted"||n.rating==="up"),U=n=>{let e=n.reading?.kind??n.target.kind??"";return n.decided.type==="act"?`act:${n.decided.act}:${e}:${n.reading?.which??""}`:n.decided.type==="plan"?`plan:${e}`:void 0};function De(n,e={}){let t=Math.max(1,e.minPeople??2),o=e.reader?C(e.reader):void 0,i=new Map;for(let l of n){let d=U(l);!d||!B(l)||C(l.by)===o||i.set(d,(i.get(d)??new Set).add(C(l.by)))}return new Set([...i].filter(([,l])=>l.size>=t).map(([l])=>l))}function ce(n,e){return n.filter(t=>(e.rating===void 0||(e.rating==="none"?t.rating===void 0:t.rating===e.rating))&&(e.outcome===void 0||t.outcome===e.outcome)&&(e.kind===void 0||(t.reading?.kind??t.target.kind)===e.kind))}var Le=n=>n.filter(e=>B(e)&&U(e)!==void 0);function ue(n){let e=Le(n).length;return e===0?"Nothing told here teaches suggestions yet: a telling that is accepted or rated \u{1F44D} will.":`Suggestions come from ${e} rated ${e===1?"telling":"tellings"} in this app.`}function ge(n,e=t=>t){switch(n.decided.type){case"act":return`${e(n.decided.act)}, over ${n.decided.records} ${n.decided.records===1?"record":"records"}`;case"plan":return`A plan of ${n.decided.edits} ${n.decided.edits===1?"change":"changes"} to the app`;case"answer":return"An open answer";case"refusal":return"Nothing it could do";case"view":return`A revision of \u201C${n.decided.section}\u201D`}}var G={previewed:"Previewed",accepted:"Accepted",declined:"Declined",undone:"Undone",abandoned:"Closed with nothing done"},Ee=new Set("a an and are as at be by can do does for from has have how i in is it its me my of on or our please the their them these they this those to was we what when where which who why will with you your all each every".split(" "));function de(n){return[...new Set(n.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").split(/[^\p{L}\p{N}]+/u).filter(e=>e.length>1&&!Ee.has(e)).map(e=>e.length>3&&e.endsWith("s")&&!e.endsWith("ss")?e.slice(0,-1):e))]}function M(n,e,t={}){let o=de(e.words);if(o.length===0)return[];let i=t.reader?C(t.reader):void 0,l=De(n,{...t.reader?{reader:t.reader}:{},...t.minPeople!==void 0?{minPeople:t.minPeople}:{}}),d=n.flatMap(a=>{let g=U(a);if(!g||!B(a)||t.rated&&a.rating!=="up")return[];if(!(i!==void 0&&C(a.by)===i)&&!l.has(g))return[];let w=de(a.words),y=o.filter(p=>w.some(m=>m===p||p.length>=3&&m.startsWith(p))).length;if(y===0)return[];let b=y/new Set([...o,...w]).size,k=e.kind!==void 0&&(a.target.kind===e.kind||a.reading?.kind===e.kind)?.25:e.kind!==void 0?-.25:0,O=e.act!==void 0&&a.decided.type==="act"&&a.decided.act===e.act?.15:0,r=Math.max(0,Math.min(1,b*.6+.25+k+O+(a.pinned?.1:0)));return r>=(t.floor??.35)?[{telling:a,score:r,lesson:g}]:[]});d.sort((a,g)=>g.score-a.score||Number(g.telling.pinned??!1)-Number(a.telling.pinned??!1)||(a.telling.at<g.telling.at?1:-1));let s=new Set,c=[];for(let a of d)if(!s.has(a.lesson)&&(s.add(a.lesson),c.push({telling:a.telling,score:a.score}),c.length>=(t.most??2)))break;return c}function pe(n){return n.map(({telling:e})=>({said:e.words,did:e.decided.type==="act"?`act ${e.decided.act} over ${e.reading?.which==="itself"?"the record itself":"each record it holds"}`:e.decided.type==="plan"?"a plan that changes the app":e.decided.type==="view"?"a revision of a view's section":e.decided.type,...e.reading?{reading:e.reading.which}:{}}))}var x=P(ne(),1),T=P(N(),1);function ye(n,e){if(e.on==="list"||e.on==="lens")return e.kind;let t=te(e)[0];return t?n.graph.getNode(t)?.kind:void 0}function $e(n,e,t,o,i){let l=n?oe(n):void 0;if(!l)return{examples:[],ids:[]};let d=ye(e,i),s=M(R(l,A(e,t)),{words:o,...d?{kind:d}:{}},{reader:t,rated:!0,most:3});return{examples:pe(s),ids:s.map(c=>c.telling.id)}}function Ne(n){let e=new Set((n.stages??[]).map(t=>t.stage));return e.has("thinking")?"full":e.has("light")?"light":e.has("fast")?"graph":(n.usage??[]).some(t=>t.tier==="thinking")?"full":void 0}function Ie(n,e){if(n.interaction.outcome==="failed"||e&&"refused"in e)return{type:"refusal"};if(e&&"question"in e)return e.proposal?{type:"plan",edits:e.parts.length}:{type:"refusal"};let t=n.ghost?.proposals??[];return t.length>0?{type:"act",act:t[0].call.name,records:new Set(t.map(i=>i.record??i.id)).size}:{type:"answer"}}function Me(n,e){let t=new Set;for(let o of e.ghost?.proposals??[])for(let i of Object.values(o.call.args))typeof i=="string"&&i!==o.record&&n.graph.getNode(i)&&t.add(i);return[...t]}function _e(n,e){let{target:t,result:o}=e,i=ye(n,t),l=t.on==="record"||t.on==="field"?t.id:void 0,d=t.on==="lens"||t.on==="place"?t.place:void 0,s=o.reading?{which:o.reading.which,kind:o.reading.kind,records:o.reading.records}:void 0,c=Me(n,o),a=Ne(o.interaction),g=Ie(o,e.plan);return{words:e.words,target:{on:t.on,...i?{kind:i}:{},...l?{id:l}:{},...d?{place:d}:{}},...s?{reading:s}:{},...c.length>0?{people:c}:{},decided:g,...a?{slot:a}:{},...o.interaction.stages?{stages:o.interaction.stages}:{},ms:e.ms,outcome:"previewed",...e.conversation?{conversation:e.conversation}:{},...e.follows?{follows:e.follows}:{},interaction:o.interaction.id,...e.examples&&e.examples.length>0?{examples:e.examples}:{}}}function Fe(n,e,t){if(!n)return;let o=se(e,t);if(o)return re(n,o),Promise.resolve().then(()=>n.add(o)).catch(()=>{}),o}function _(n,e,t){n&&Promise.resolve().then(()=>n.change(e,t)).catch(()=>{})}var We={accepted:"accepted",partly:"accepted",drawn:"accepted",dismissed:"declined"};function ze(n,e,t){let o,i=()=>{let c=n.get().entries.find(g=>g.id===t.interaction);if(!c)return;let a=c.undone?"undone":We[c.outcome];!a||a===o||(o=a,_(e,t.id,{outcome:a}),a==="undone"&&s())},l=n.subscribe(i),d=setTimeout(()=>s(),30*6e4),s=()=>{l(),clearTimeout(d)};return s}function He({told:n,telling:e}){let[t,o]=(0,x.useState)(e.rating),[i,l]=(0,x.useState)(""),[d,s]=(0,x.useState)(!1),c=(0,x.useId)();(0,x.useEffect)(()=>{o(e.rating),l(""),s(!1)},[e.id,e.rating]);let a=f=>{let w=t===f?void 0:f;o(w),s(!1),_(n,e.id,{rating:w??null})},g=()=>{let f=i.trim();!f||t!=="down"||(_(n,e.id,{should:f}),s(!0))};return(0,T.jsxs)("div",{"data-testid":"quick-ask-rating","data-rating":t??"",style:{display:"grid",gap:6},children:[(0,T.jsxs)("div",{role:"group","aria-label":"Was this right?",style:{display:"flex",gap:4,justifyContent:"flex-end"},children:[(0,T.jsx)("button",{type:"button","data-testid":"quick-ask-right","aria-label":"This was right",title:"This was right","aria-pressed":t==="up",onClick:()=>a("up"),style:t==="up"?fe:K,children:(0,T.jsx)("span",{"aria-hidden":"true",children:"\u{1F44D}"})}),(0,T.jsx)("button",{type:"button","data-testid":"quick-ask-wrong","aria-label":"This was wrong",title:"This was wrong","aria-pressed":t==="down",onClick:()=>a("down"),style:t==="down"?fe:K,children:(0,T.jsx)("span",{"aria-hidden":"true",children:"\u{1F44E}"})})]}),t==="down"?(0,T.jsxs)("div",{style:{display:"grid",gap:2},children:[(0,T.jsxs)("label",{htmlFor:c,style:{fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:["What should it have done? ",(0,T.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:"(optional)"})]}),(0,T.jsx)("input",{id:c,type:"text","data-testid":"quick-ask-should",value:i,maxLength:300,autoComplete:"off",enterKeyHint:"done",onChange:f=>{l(f.target.value),s(!1)},onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),g())},onBlur:g,style:Be}),d?(0,T.jsx)("span",{role:"status","data-testid":"quick-ask-should-kept",style:{fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:n.keptSays?.trim()||"Kept, to learn from."}):null]}):null]})}var K={display:"inline-grid",placeItems:"center",width:30,height:28,padding:0,font:"inherit",fontSize:"0.875rem",lineHeight:1,background:"transparent",border:"1px solid transparent",borderRadius:6,boxShadow:"none",cursor:"pointer",opacity:.7},fe={...K,opacity:1,borderColor:"var(--graview-accent)",background:"var(--graview-panel)"},Be={boxSizing:"border-box",width:"100%",height:32,padding:"0 8px",font:"inherit",fontSize:"max(1rem,16px)",color:"var(--graview-ink)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:8};var j=n=>n.charAt(0).toUpperCase()+n.slice(1);function me(n,e){if(!e)return;let t=n.graph.getNode(e);if(t)return t.kind;let o=/^(?:kind|aggregate):(.+)$/.exec(e)?.[1];return o&&n.schema.tryDefinition(o)?o:void 0}function he(n,e,t){let o=n.schema;if(e.decided.type==="plan")return j(e.words);if(e.decided.type!=="act")return;let i=e.decided.act,l=n.allMutations().find(y=>y.name===i);if(!l)return;let d=l.title??l.name,s=y=>/\b(?:it|this|them)\b/i.test(d)?d.replace(/\b(?:it|this|them)\b/i,y):`${d} ${y}`,c=t?n.graph.getNode(t):void 0,a=c?Q(o.tryDefinition(c.kind),c):void 0,g=e.reading?.kind??e.target.kind;if(!g||!o.tryDefinition(g))return;if(e.reading?.which==="itself"||!e.reading&&c?.kind===g)return c&&c.kind===g&&a?j(s(a)):void 0;let f=c?new Set([...n.graph.in(c.id),...n.graph.out(c.id)].filter(y=>y.kind===g).map(y=>y.id)).size:me(n,t)===g?n.graph.allNodes().filter(y=>y.kind===g).length:0;if(f===0)return;let w=f===1?(o.tryDefinition(g)?.noun??g).toLowerCase():X(o,g).toLowerCase();return j(s(`the ${f} ${w}${a?` in ${a}`:""}`))}async function Ue(n,e,t){return R(await I(n),A(e,t))}function Ge(n,e,t,o,i,l=4){if(o.trim()==="")return[];let d=me(e,i);return M(n,{words:o,...d?{kind:d}:{}},{reader:t,most:l}).flatMap(({telling:s})=>{let c=he(e,s,i);return c?[{key:`told:${s.id}`,telling:s,label:c}]:[]})}function Ke(n,e,t,o,i=3){let l=new Set,d=[];for(let s of[...n].reverse()){if(d.length>=i)break;if(!(s.rating==="up"||s.outcome==="accepted")||s.by!==void 0&&t.id!==void 0&&s.by.id!==void 0&&s.by.id!==t.id)continue;let c=he(e,s,o);!c||l.has(c.toLowerCase())||(l.add(c.toLowerCase()),d.push({key:`told:${s.id}`,telling:s,label:c}))}return d}var v=P(ne(),1),u=P(N(),1);function je({told:n,store:e,principal:t,onClose:o}){let[i,l]=(0,v.useState)(null),[d,s]=(0,v.useState)({}),c=(0,v.useRef)(null);(0,v.useEffect)(()=>{let r=!0;return Promise.resolve().then(()=>n.list()).then(p=>r&&l(p),()=>r&&l([])),c.current?.focus({preventScroll:!0}),()=>{r=!1}},[n]);let a=(0,v.useMemo)(()=>i?R(i,$(e,t)):[],[i,e,t]),g=(0,v.useMemo)(()=>[...ce(a,d)].sort((r,p)=>r.at<p.at?1:-1),[a,d]),f=(0,v.useMemo)(()=>[...new Set(a.flatMap(r=>r.reading?.kind??r.target.kind??[]))].sort(),[a]),w=r=>e.allMutations().find(p=>p.name===r)?.title??r,y=r=>e.schema.tryDefinition(r)?.plural??r,b=r=>{try{return Z(r.by,{graph:e.graph,schema:e.schema})}catch{return r.by.id??r.by.kind}},k=(r,p)=>{l(m=>m&&H(m,{change:r,with:p})),Promise.resolve().then(()=>n.change(r,p)).catch(()=>{})},O=r=>{l(p=>p&&H(p,{remove:r})),Promise.resolve().then(()=>n.remove(r)).catch(()=>{})};return(0,u.jsxs)("section",{ref:c,tabIndex:-1,"data-testid":"told-panel","data-graview-overlay":"","aria-label":"What Graview has been told",onKeyDown:r=>{r.key==="Escape"&&(r.stopPropagation(),o())},style:qe,children:[(0,u.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[(0,u.jsx)("h2",{style:{margin:0,fontSize:"1rem",fontWeight:600,flex:"1 1 auto"},children:"What Graview has been told"}),(0,u.jsx)("button",{type:"button","data-testid":"told-close",onClick:o,style:F,children:"Close"})]}),(0,u.jsx)("p",{"data-testid":"told-teaching",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:i===null?"Reading what was told\u2026":ue(a)}),(0,u.jsxs)("div",{role:"group","aria-label":"Show only",style:{display:"flex",flexWrap:"wrap",gap:8,fontSize:"0.8125rem"},children:[(0,u.jsxs)("label",{style:q,children:["Rating",(0,u.jsxs)("select",{"data-testid":"told-filter-rating",value:d.rating??"",onChange:r=>s(({rating:p,...m})=>r.target.value?{...m,rating:r.target.value}:m),children:[(0,u.jsx)("option",{value:"",children:"Any"}),(0,u.jsx)("option",{value:"up",children:"\u{1F44D} Right"}),(0,u.jsx)("option",{value:"down",children:"\u{1F44E} Wrong"}),(0,u.jsx)("option",{value:"none",children:"Not rated"})]})]}),(0,u.jsxs)("label",{style:q,children:["Outcome",(0,u.jsxs)("select",{"data-testid":"told-filter-outcome",value:d.outcome??"",onChange:r=>s(({outcome:p,...m})=>r.target.value?{...m,outcome:r.target.value}:m),children:[(0,u.jsx)("option",{value:"",children:"Any"}),z.map(r=>(0,u.jsx)("option",{value:r,children:G[r]},r))]})]}),(0,u.jsxs)("label",{style:q,children:["Kind",(0,u.jsxs)("select",{"data-testid":"told-filter-kind",value:d.kind??"",onChange:r=>s(({kind:p,...m})=>r.target.value?{...m,kind:r.target.value}:m),children:[(0,u.jsx)("option",{value:"",children:"Any"}),f.map(r=>(0,u.jsx)("option",{value:r,children:y(r)},r))]})]})]}),i!==null&&g.length===0?(0,u.jsx)("p",{"data-testid":"told-none",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:a.length===0?"Nothing has been told here yet.":"Nothing told here fits these."}):null,(0,u.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8,overflowY:"auto"},children:g.map(r=>(0,u.jsxs)("li",{"data-testid":"told-entry","data-telling":r.id,"data-outcome":r.outcome,"data-rating":r.rating??"","data-excluded":r.excluded?"":void 0,"data-pinned":r.pinned?"":void 0,style:Ye,children:[(0,u.jsxs)("p",{style:{margin:0,fontWeight:550,overflowWrap:"anywhere"},children:["\u201C",r.words,"\u201D"]}),(0,u.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem"},children:[ge(r,w)," \xB7 ",G[r.outcome],r.rating?` \xB7 ${r.rating==="up"?"\u{1F44D} right":"\u{1F44E} wrong"}`:"",r.pinned?" \xB7 a good example":"",r.excluded?" \xB7 excluded from suggestions":""]}),r.should?(0,u.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",fontStyle:"italic"},children:["Should have: ",r.should]}):null,(0,u.jsxs)("p",{style:{margin:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:[b(r)," \xB7 ",(0,u.jsx)("time",{dateTime:r.at,children:new Date(r.at).toLocaleString()}),r.ms!==void 0?` \xB7 ${r.ms<1e3?`${r.ms} ms`:`${(r.ms/1e3).toFixed(1)} s`}`:""]}),(0,u.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:[(0,u.jsx)("button",{type:"button","data-testid":"told-pin","aria-pressed":r.pinned===!0,onClick:()=>k(r.id,{pinned:!r.pinned}),style:F,children:r.pinned?"Not a good example":"A good example"}),(0,u.jsx)("button",{type:"button","data-testid":"told-exclude","aria-pressed":r.excluded===!0,onClick:()=>k(r.id,{excluded:!r.excluded}),style:F,children:r.excluded?"Suggest it again":"Exclude from suggestions"}),(0,u.jsx)("button",{type:"button","data-testid":"told-delete",onClick:()=>O(r.id),style:F,children:"Delete"})]})]},r.id))})]})}var qe={position:"absolute",insetBlock:"60px 12px",insetInlineEnd:12,width:"min(440px, calc(100% - 24px))",boxSizing:"border-box",display:"flex",flexDirection:"column",gap:10,padding:14,borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",zIndex:ee("popover"),overflow:"hidden"},Ye={display:"grid",gap:4,padding:10,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)"},F={padding:"2px 10px",minHeight:28,font:"inherit",fontSize:"0.8125rem",borderRadius:8},q={display:"inline-flex",alignItems:"center",gap:4};export{He as RateTelling,je as ToldPanel,_ as changeTelling,$e as examplesHere,Fe as keepTelling,Ue as readToldHere,A as seenOnThisPage,_e as tellingDraftOf,Ke as toldForHere,I as toldListed,Ge as toldSuggestionsFrom,ze as watchTelling};
|
|
1
|
+
import{c as te}from"./chunk.FQ2QUDZS.js";import"./chunk.BJUUSIQY.js";import"./chunk.SMF5S4DQ.js";import"./chunk.T6ISUVUP.js";import"./chunk.GH6QX7JR.js";import"./chunk.J4D4BIB4.js";import{G as ne,_ as N}from"./chunk.ASNVH2G4.js";import"./chunk.SDO3U72B.js";import{Dd as $,ma as Q,pa as X,pb as Z,zd as ee}from"./chunk.ZDUKVXBI.js";import"./chunk.FQLNBIQ5.js";import{b as P}from"./chunk.AJZBJBMO.js";var D=new WeakMap,we=5e3;function I(n){let e=D.get(n);if(e&&Date.now()-e.at<we)return e.list;let t={at:Date.now(),list:Promise.resolve([])};return t.list=Promise.resolve().then(()=>n.list()).catch(()=>[]).then(o=>t.value=[...o,...(t.value??[]).filter(i=>!o.some(l=>l.id===i.id))]),e?.value&&(t.value=e.value),D.set(n,t),t.list}var oe=n=>D.get(n)?.value;function re(n,e){let t=D.get(n);if(!t)return;let o=i=>[...i.filter(l=>l.id!==e.id),e];t.value&&(t.value=o(t.value)),D.set(n,{at:t.at,list:t.list.then(o),...t.value?{value:t.value}:{}})}function A(n,e){let t=$(n,e);return o=>n.graph.getNode(o)!==void 0&&t(o)}var z=["previewed","accepted","declined","undone","abandoned"],ve=["graph","light","full"],S={words:300,should:300,name:80,records:200,people:20,stages:8,examples:5},Se=365,xe=5e3,be=new RegExp("[\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2066-\\u2069]","g");function ie(n,e){if(typeof n!="string")return;let t=n.replace(be," ").replace(/\s+/g," ").trim();return t.length===0?void 0:t.slice(0,e).trimEnd()}function h(n){return typeof n=="string"&&n.length>0&&n.length<=S.name&&/^[\p{L}\p{N}_][\p{L}\p{N}_.:/-]*$/u.test(n)?n:void 0}var W=(n,e)=>Array.isArray(n)?[...new Set(n.flatMap(t=>h(t)??[]))].slice(0,e):[];function ae(n){let e=typeof n.id=="string"?n.id.slice(0,S.name):void 0;return{kind:n.kind,...e!==void 0?{id:e}:{},...n.onBehalfOf?{onBehalfOf:ae(n.onBehalfOf)}:{}}}var le=n=>n?.kind==="visitor"||n?.onBehalfOf?.kind==="visitor",ke=()=>`tl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,Oe=new Set(["record","field","selection","list","lens","place","act"]);function Pe(n){let e=n,t=o=>typeof o=="number"&&Number.isFinite(o)&&o>=0?Math.min(1e4,Math.round(o)):0;switch(e?.type){case"act":{let o=h(e.act);return o?{type:"act",act:o,records:t(e.records)}:void 0}case"plan":return{type:"plan",edits:t(e.edits)};case"answer":return{type:"answer"};case"refusal":return{type:"refusal"};case"view":{let o=typeof e.section=="string"?e.section.replace(/\s+/g," ").trim().slice(0,S.name):"";return o?{type:"view",section:o}:void 0}default:return}}function se(n,e,t={}){if(!n||typeof n!="object"||!e||le(e))return;let o=n,i=ie(o.words,S.words),l=Pe(o.decided),d=o.target;if(!i||!l||!d||!Oe.has(String(d.on)))return;let s={on:d.on,...h(d.kind)?{kind:h(d.kind)}:{},...h(d.id)?{id:h(d.id)}:{},...h(d.place)?{place:h(d.place)}:{}},c=o.reading,a=c&&(c.which==="itself"||c.which==="held")&&h(c.kind)?{which:c.which,kind:h(c.kind),records:W(c.records,S.records)}:void 0,g=W(o.people,S.people),f=Array.isArray(o.stages)?o.stages.flatMap(Te=>{let L=Te,V=h(L?.stage),E=L?.ms;return V&&typeof E=="number"&&Number.isFinite(E)&&E>=0?[{stage:V,ms:Math.round(E),...h(L.model)?{model:h(L.model)}:{}}]:[]}).slice(0,S.stages):[],w=z.includes(o.outcome)?o.outcome:"previewed",y=ve.includes(o.slot)?o.slot:void 0,b=o.rating==="up"||o.rating==="down"?o.rating:void 0,k=b==="down"?ie(o.should,S.should):void 0,O=typeof o.ms=="number"&&Number.isFinite(o.ms)&&o.ms>=0?Math.round(o.ms):void 0,r=t.id??h(o.id)??ke(),p=h(o.conversation)??r,m=h(o.follows),Y=h(o.interaction),J=W(o.examples,S.examples);return{id:r,at:t.at??new Date().toISOString(),by:ae(e),words:i,target:s,...a?{reading:a}:{},...g.length>0?{people:g}:{},decided:l,...y?{slot:y}:{},...f.length>0?{stages:f}:{},...O!==void 0?{ms:O}:{},outcome:w,...b?{rating:b}:{},...k?{should:k}:{},conversation:p,...m?{follows:m}:{},...Y?{interaction:Y}:{},...J.length>0?{examples:J}:{}}}function Ae(n,e){let t=e.outcome===void 0||e.outcome==="previewed"||n.outcome==="accepted"&&e.outcome!=="undone"||n.outcome==="undone"||(n.outcome==="declined"||n.outcome==="abandoned")&&e.outcome==="abandoned"?n.outcome:e.outcome,o=e.rating===void 0?n.rating:e.rating??void 0,i=o!=="down"?void 0:e.should===void 0?n.should:e.should??void 0,{rating:l,should:d,...s}=n;return{...s,outcome:t,...o?{rating:o}:{},...i?{should:i}:{},...e.examples?{examples:e.examples}:{},...e.pinned!==void 0?{pinned:e.pinned}:{},...e.excluded!==void 0?{excluded:e.excluded}:{}}}function Ce(n,e={}){let t=(e.now??Date.now())-(e.retentionDays??Se)*864e5,o=new Map;for(let d of n){let s=Date.parse(d.at);Number.isFinite(s)&&s>=t&&!le(d.by)&&o.set(d.id,d)}let i=[...o.values()],l=e.most??xe;return i.length>l?i.slice(i.length-l):i}function H(n,e,t={}){return"add"in e?Ce([...n,e.add],t):"remove"in e?n.filter(o=>o.id!==e.remove):n.map(o=>o.id===e.change?Ae(o,e.with):o)}var C=n=>n.onBehalfOf?C(n.onBehalfOf):n.id!==void 0?`${n.kind}:${n.id}`:`${n.kind}:?`,Re=n=>[...new Set([...n.target.id?[n.target.id]:[],...n.reading?.records??[],...n.people??[]])];function R(n,e){return n.filter(t=>Re(t).every(e))}var B=n=>!n.excluded&&n.rating!=="down"&&n.outcome!=="undone"&&(n.outcome==="accepted"||n.rating==="up"),U=n=>{let e=n.reading?.kind??n.target.kind??"";return n.decided.type==="act"?`act:${n.decided.act}:${e}:${n.reading?.which??""}`:n.decided.type==="plan"?`plan:${e}`:void 0};function De(n,e={}){let t=Math.max(1,e.minPeople??2),o=e.reader?C(e.reader):void 0,i=new Map;for(let l of n){let d=U(l);!d||!B(l)||C(l.by)===o||i.set(d,(i.get(d)??new Set).add(C(l.by)))}return new Set([...i].filter(([,l])=>l.size>=t).map(([l])=>l))}function ce(n,e){return n.filter(t=>(e.rating===void 0||(e.rating==="none"?t.rating===void 0:t.rating===e.rating))&&(e.outcome===void 0||t.outcome===e.outcome)&&(e.kind===void 0||(t.reading?.kind??t.target.kind)===e.kind))}var Le=n=>n.filter(e=>B(e)&&U(e)!==void 0);function ue(n){let e=Le(n).length;return e===0?"Nothing told here teaches suggestions yet: a telling that is accepted or rated \u{1F44D} will.":`Suggestions come from ${e} rated ${e===1?"telling":"tellings"} in this app.`}function ge(n,e=t=>t){switch(n.decided.type){case"act":return`${e(n.decided.act)}, over ${n.decided.records} ${n.decided.records===1?"record":"records"}`;case"plan":return`A plan of ${n.decided.edits} ${n.decided.edits===1?"change":"changes"} to the app`;case"answer":return"An open answer";case"refusal":return"Nothing it could do";case"view":return`A revision of \u201C${n.decided.section}\u201D`}}var G={previewed:"Previewed",accepted:"Accepted",declined:"Declined",undone:"Undone",abandoned:"Closed with nothing done"},Ee=new Set("a an and are as at be by can do does for from has have how i in is it its me my of on or our please the their them these they this those to was we what when where which who why will with you your all each every".split(" "));function de(n){return[...new Set(n.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").split(/[^\p{L}\p{N}]+/u).filter(e=>e.length>1&&!Ee.has(e)).map(e=>e.length>3&&e.endsWith("s")&&!e.endsWith("ss")?e.slice(0,-1):e))]}function M(n,e,t={}){let o=de(e.words);if(o.length===0)return[];let i=t.reader?C(t.reader):void 0,l=De(n,{...t.reader?{reader:t.reader}:{},...t.minPeople!==void 0?{minPeople:t.minPeople}:{}}),d=n.flatMap(a=>{let g=U(a);if(!g||!B(a)||t.rated&&a.rating!=="up")return[];if(!(i!==void 0&&C(a.by)===i)&&!l.has(g))return[];let w=de(a.words),y=o.filter(p=>w.some(m=>m===p||p.length>=3&&m.startsWith(p))).length;if(y===0)return[];let b=y/new Set([...o,...w]).size,k=e.kind!==void 0&&(a.target.kind===e.kind||a.reading?.kind===e.kind)?.25:e.kind!==void 0?-.25:0,O=e.act!==void 0&&a.decided.type==="act"&&a.decided.act===e.act?.15:0,r=Math.max(0,Math.min(1,b*.6+.25+k+O+(a.pinned?.1:0)));return r>=(t.floor??.35)?[{telling:a,score:r,lesson:g}]:[]});d.sort((a,g)=>g.score-a.score||Number(g.telling.pinned??!1)-Number(a.telling.pinned??!1)||(a.telling.at<g.telling.at?1:-1));let s=new Set,c=[];for(let a of d)if(!s.has(a.lesson)&&(s.add(a.lesson),c.push({telling:a.telling,score:a.score}),c.length>=(t.most??2)))break;return c}function pe(n){return n.map(({telling:e})=>({said:e.words,did:e.decided.type==="act"?`act ${e.decided.act} over ${e.reading?.which==="itself"?"the record itself":"each record it holds"}`:e.decided.type==="plan"?"a plan that changes the app":e.decided.type==="view"?"a revision of a view's section":e.decided.type,...e.reading?{reading:e.reading.which}:{}}))}var x=P(ne(),1),T=P(N(),1);function ye(n,e){if(e.on==="list"||e.on==="lens")return e.kind;let t=te(e)[0];return t?n.graph.getNode(t)?.kind:void 0}function $e(n,e,t,o,i){let l=n?oe(n):void 0;if(!l)return{examples:[],ids:[]};let d=ye(e,i),s=M(R(l,A(e,t)),{words:o,...d?{kind:d}:{}},{reader:t,rated:!0,most:3});return{examples:pe(s),ids:s.map(c=>c.telling.id)}}function Ne(n){let e=new Set((n.stages??[]).map(t=>t.stage));return e.has("thinking")?"full":e.has("light")?"light":e.has("fast")?"graph":(n.usage??[]).some(t=>t.tier==="thinking")?"full":void 0}function Ie(n,e){if(n.interaction.outcome==="failed"||e&&"refused"in e)return{type:"refusal"};if(e&&"question"in e)return e.proposal?{type:"plan",edits:e.parts.length}:{type:"refusal"};let t=n.ghost?.proposals??[];return t.length>0?{type:"act",act:t[0].call.name,records:new Set(t.map(i=>i.record??i.id)).size}:{type:"answer"}}function Me(n,e){let t=new Set;for(let o of e.ghost?.proposals??[])for(let i of Object.values(o.call.args))typeof i=="string"&&i!==o.record&&n.graph.getNode(i)&&t.add(i);return[...t]}function _e(n,e){let{target:t,result:o}=e,i=ye(n,t),l=t.on==="record"||t.on==="field"?t.id:void 0,d=t.on==="lens"||t.on==="place"?t.place:void 0,s=o.reading?{which:o.reading.which,kind:o.reading.kind,records:o.reading.records}:void 0,c=Me(n,o),a=Ne(o.interaction),g=Ie(o,e.plan);return{words:e.words,target:{on:t.on,...i?{kind:i}:{},...l?{id:l}:{},...d?{place:d}:{}},...s?{reading:s}:{},...c.length>0?{people:c}:{},decided:g,...a?{slot:a}:{},...o.interaction.stages?{stages:o.interaction.stages}:{},ms:e.ms,outcome:"previewed",...e.conversation?{conversation:e.conversation}:{},...e.follows?{follows:e.follows}:{},interaction:o.interaction.id,...e.examples&&e.examples.length>0?{examples:e.examples}:{}}}function Fe(n,e,t){if(!n)return;let o=se(e,t);if(o)return re(n,o),Promise.resolve().then(()=>n.add(o)).catch(()=>{}),o}function _(n,e,t){n&&Promise.resolve().then(()=>n.change(e,t)).catch(()=>{})}var We={accepted:"accepted",partly:"accepted",drawn:"accepted",dismissed:"declined"};function ze(n,e,t){let o,i=()=>{let c=n.get().entries.find(g=>g.id===t.interaction);if(!c)return;let a=c.undone?"undone":We[c.outcome];!a||a===o||(o=a,_(e,t.id,{outcome:a}),a==="undone"&&s())},l=n.subscribe(i),d=setTimeout(()=>s(),30*6e4),s=()=>{l(),clearTimeout(d)};return s}function He({told:n,telling:e}){let[t,o]=(0,x.useState)(e.rating),[i,l]=(0,x.useState)(""),[d,s]=(0,x.useState)(!1),c=(0,x.useId)();(0,x.useEffect)(()=>{o(e.rating),l(""),s(!1)},[e.id,e.rating]);let a=f=>{let w=t===f?void 0:f;o(w),s(!1),_(n,e.id,{rating:w??null})},g=()=>{let f=i.trim();!f||t!=="down"||(_(n,e.id,{should:f}),s(!0))};return(0,T.jsxs)("div",{"data-testid":"quick-ask-rating","data-rating":t??"",style:{display:"grid",gap:6},children:[(0,T.jsxs)("div",{role:"group","aria-label":"Was this right?",style:{display:"flex",gap:4,justifyContent:"flex-end"},children:[(0,T.jsx)("button",{type:"button","data-testid":"quick-ask-right","aria-label":"This was right",title:"This was right","aria-pressed":t==="up",onClick:()=>a("up"),style:t==="up"?fe:K,children:(0,T.jsx)("span",{"aria-hidden":"true",children:"\u{1F44D}"})}),(0,T.jsx)("button",{type:"button","data-testid":"quick-ask-wrong","aria-label":"This was wrong",title:"This was wrong","aria-pressed":t==="down",onClick:()=>a("down"),style:t==="down"?fe:K,children:(0,T.jsx)("span",{"aria-hidden":"true",children:"\u{1F44E}"})})]}),t==="down"?(0,T.jsxs)("div",{style:{display:"grid",gap:2},children:[(0,T.jsxs)("label",{htmlFor:c,style:{fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:["What should it have done? ",(0,T.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:"(optional)"})]}),(0,T.jsx)("input",{id:c,type:"text","data-testid":"quick-ask-should",value:i,maxLength:300,autoComplete:"off",enterKeyHint:"done",onChange:f=>{l(f.target.value),s(!1)},onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),g())},onBlur:g,style:Be}),d?(0,T.jsx)("span",{role:"status","data-testid":"quick-ask-should-kept",style:{fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:n.keptSays?.trim()||"Kept, to learn from."}):null]}):null]})}var K={display:"inline-grid",placeItems:"center",width:30,height:28,padding:0,font:"inherit",fontSize:"0.875rem",lineHeight:1,background:"transparent",border:"1px solid transparent",borderRadius:6,boxShadow:"none",cursor:"pointer",opacity:.7},fe={...K,opacity:1,borderColor:"var(--graview-accent)",background:"var(--graview-panel)"},Be={boxSizing:"border-box",width:"100%",height:32,padding:"0 8px",font:"inherit",fontSize:"max(1rem,16px)",color:"var(--graview-ink)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:8};var j=n=>n.charAt(0).toUpperCase()+n.slice(1);function me(n,e){if(!e)return;let t=n.graph.getNode(e);if(t)return t.kind;let o=/^(?:kind|aggregate):(.+)$/.exec(e)?.[1];return o&&n.schema.tryDefinition(o)?o:void 0}function he(n,e,t){let o=n.schema;if(e.decided.type==="plan")return j(e.words);if(e.decided.type!=="act")return;let i=e.decided.act,l=n.allMutations().find(y=>y.name===i);if(!l)return;let d=l.title??l.name,s=y=>/\b(?:it|this|them)\b/i.test(d)?d.replace(/\b(?:it|this|them)\b/i,y):`${d} ${y}`,c=t?n.graph.getNode(t):void 0,a=c?Q(o.tryDefinition(c.kind),c):void 0,g=e.reading?.kind??e.target.kind;if(!g||!o.tryDefinition(g))return;if(e.reading?.which==="itself"||!e.reading&&c?.kind===g)return c&&c.kind===g&&a?j(s(a)):void 0;let f=c?new Set([...n.graph.in(c.id),...n.graph.out(c.id)].filter(y=>y.kind===g).map(y=>y.id)).size:me(n,t)===g?n.graph.allNodes().filter(y=>y.kind===g).length:0;if(f===0)return;let w=f===1?(o.tryDefinition(g)?.noun??g).toLowerCase():X(o,g).toLowerCase();return j(s(`the ${f} ${w}${a?` in ${a}`:""}`))}async function Ue(n,e,t){return R(await I(n),A(e,t))}function Ge(n,e,t,o,i,l=4){if(o.trim()==="")return[];let d=me(e,i);return M(n,{words:o,...d?{kind:d}:{}},{reader:t,most:l}).flatMap(({telling:s})=>{let c=he(e,s,i);return c?[{key:`told:${s.id}`,telling:s,label:c}]:[]})}function Ke(n,e,t,o,i=3){let l=new Set,d=[];for(let s of[...n].reverse()){if(d.length>=i)break;if(!(s.rating==="up"||s.outcome==="accepted")||s.by!==void 0&&t.id!==void 0&&s.by.id!==void 0&&s.by.id!==t.id)continue;let c=he(e,s,o);!c||l.has(c.toLowerCase())||(l.add(c.toLowerCase()),d.push({key:`told:${s.id}`,telling:s,label:c}))}return d}var v=P(ne(),1),u=P(N(),1);function je({told:n,store:e,principal:t,onClose:o}){let[i,l]=(0,v.useState)(null),[d,s]=(0,v.useState)({}),c=(0,v.useRef)(null);(0,v.useEffect)(()=>{let r=!0;return Promise.resolve().then(()=>n.list()).then(p=>r&&l(p),()=>r&&l([])),c.current?.focus({preventScroll:!0}),()=>{r=!1}},[n]);let a=(0,v.useMemo)(()=>i?R(i,$(e,t)):[],[i,e,t]),g=(0,v.useMemo)(()=>[...ce(a,d)].sort((r,p)=>r.at<p.at?1:-1),[a,d]),f=(0,v.useMemo)(()=>[...new Set(a.flatMap(r=>r.reading?.kind??r.target.kind??[]))].sort(),[a]),w=r=>e.allMutations().find(p=>p.name===r)?.title??r,y=r=>e.schema.tryDefinition(r)?.plural??r,b=r=>{try{return Z(r.by,{graph:e.graph,schema:e.schema})}catch{return r.by.id??r.by.kind}},k=(r,p)=>{l(m=>m&&H(m,{change:r,with:p})),Promise.resolve().then(()=>n.change(r,p)).catch(()=>{})},O=r=>{l(p=>p&&H(p,{remove:r})),Promise.resolve().then(()=>n.remove(r)).catch(()=>{})};return(0,u.jsxs)("section",{ref:c,tabIndex:-1,"data-testid":"told-panel","data-graview-overlay":"","aria-label":"What Graview has been told",onKeyDown:r=>{r.key==="Escape"&&(r.stopPropagation(),o())},style:qe,children:[(0,u.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[(0,u.jsx)("h2",{style:{margin:0,fontSize:"1rem",fontWeight:600,flex:"1 1 auto"},children:"What Graview has been told"}),(0,u.jsx)("button",{type:"button","data-testid":"told-close",onClick:o,style:F,children:"Close"})]}),(0,u.jsx)("p",{"data-testid":"told-teaching",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:i===null?"Reading what was told\u2026":ue(a)}),(0,u.jsxs)("div",{role:"group","aria-label":"Show only",style:{display:"flex",flexWrap:"wrap",gap:8,fontSize:"0.8125rem"},children:[(0,u.jsxs)("label",{style:q,children:["Rating",(0,u.jsxs)("select",{"data-testid":"told-filter-rating",value:d.rating??"",onChange:r=>s(({rating:p,...m})=>r.target.value?{...m,rating:r.target.value}:m),children:[(0,u.jsx)("option",{value:"",children:"Any"}),(0,u.jsx)("option",{value:"up",children:"\u{1F44D} Right"}),(0,u.jsx)("option",{value:"down",children:"\u{1F44E} Wrong"}),(0,u.jsx)("option",{value:"none",children:"Not rated"})]})]}),(0,u.jsxs)("label",{style:q,children:["Outcome",(0,u.jsxs)("select",{"data-testid":"told-filter-outcome",value:d.outcome??"",onChange:r=>s(({outcome:p,...m})=>r.target.value?{...m,outcome:r.target.value}:m),children:[(0,u.jsx)("option",{value:"",children:"Any"}),z.map(r=>(0,u.jsx)("option",{value:r,children:G[r]},r))]})]}),(0,u.jsxs)("label",{style:q,children:["Kind",(0,u.jsxs)("select",{"data-testid":"told-filter-kind",value:d.kind??"",onChange:r=>s(({kind:p,...m})=>r.target.value?{...m,kind:r.target.value}:m),children:[(0,u.jsx)("option",{value:"",children:"Any"}),f.map(r=>(0,u.jsx)("option",{value:r,children:y(r)},r))]})]})]}),i!==null&&g.length===0?(0,u.jsx)("p",{"data-testid":"told-none",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:a.length===0?"Nothing has been told here yet.":"Nothing told here fits these."}):null,(0,u.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8,overflowY:"auto"},children:g.map(r=>(0,u.jsxs)("li",{"data-testid":"told-entry","data-telling":r.id,"data-outcome":r.outcome,"data-rating":r.rating??"","data-excluded":r.excluded?"":void 0,"data-pinned":r.pinned?"":void 0,style:Ye,children:[(0,u.jsxs)("p",{style:{margin:0,fontWeight:550,overflowWrap:"anywhere"},children:["\u201C",r.words,"\u201D"]}),(0,u.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem"},children:[ge(r,w)," \xB7 ",G[r.outcome],r.rating?` \xB7 ${r.rating==="up"?"\u{1F44D} right":"\u{1F44E} wrong"}`:"",r.pinned?" \xB7 a good example":"",r.excluded?" \xB7 excluded from suggestions":""]}),r.should?(0,u.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",fontStyle:"italic"},children:["Should have: ",r.should]}):null,(0,u.jsxs)("p",{style:{margin:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:[b(r)," \xB7 ",(0,u.jsx)("time",{dateTime:r.at,children:new Date(r.at).toLocaleString()}),r.ms!==void 0?` \xB7 ${r.ms<1e3?`${r.ms} ms`:`${(r.ms/1e3).toFixed(1)} s`}`:""]}),(0,u.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:[(0,u.jsx)("button",{type:"button","data-testid":"told-pin","aria-pressed":r.pinned===!0,onClick:()=>k(r.id,{pinned:!r.pinned}),style:F,children:r.pinned?"Not a good example":"A good example"}),(0,u.jsx)("button",{type:"button","data-testid":"told-exclude","aria-pressed":r.excluded===!0,onClick:()=>k(r.id,{excluded:!r.excluded}),style:F,children:r.excluded?"Suggest it again":"Exclude from suggestions"}),(0,u.jsx)("button",{type:"button","data-testid":"told-delete",onClick:()=>O(r.id),style:F,children:"Delete"})]})]},r.id))})]})}var qe={position:"absolute",insetBlock:"60px 12px",insetInlineEnd:12,width:"min(440px, calc(100% - 24px))",boxSizing:"border-box",display:"flex",flexDirection:"column",gap:10,padding:14,borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",zIndex:ee("popover"),overflow:"hidden"},Ye={display:"grid",gap:4,padding:10,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)"},F={padding:"2px 10px",minHeight:28,font:"inherit",fontSize:"0.8125rem",borderRadius:8},q={display:"inline-flex",alignItems:"center",gap:4};export{He as RateTelling,je as ToldPanel,_ as changeTelling,$e as examplesHere,Fe as keepTelling,Ue as readToldHere,A as seenOnThisPage,_e as tellingDraftOf,Ke as toldForHere,I as toldListed,Ge as toldSuggestionsFrom,ze as watchTelling};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i}from"./chunk.GMHBAS45.js";import"./chunk.4VX7GPFS.js";import"./chunk.FQ2QUDZS.js";import"./chunk.BJUUSIQY.js";import"./chunk.VGQDPEB5.js";import"./chunk.6YKKZI4H.js";import"./chunk.WIVNFOQR.js";import"./chunk.ONVYKLRX.js";import"./chunk.XOZU4OFA.js";import"./chunk.53GQQETN.js";import"./chunk.SMF5S4DQ.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"./chunk.ASNVH2G4.js";import"./chunk.SDO3U72B.js";import"./chunk.ZDUKVXBI.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{i as GhostTray,h as InlineAiMenu,g as askAgain,c as askInline,a as askOf,b as drawPanel,d as heldSuggestion,e as suggestOnce,f as takeOffer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as $,b as R,c as O,j as T,o as b}from"./chunk.PS765ODQ.js";function G(t,o){return o===1&&["every","some","sum","min","max","sort"].includes(t.fn)}function C(t){let o=new Set,e=new Set,r=[],a=[],s=new Set(T),i=(l,f)=>{switch(l.t){case"lit":return;case"ident":!f&&O(l)===void 0&&o.add(l.name);return;case"list":l.items.forEach(c=>i(c,f));return;case"member":{let c=O(l.object);c==="subject"?o.add(l.name):c===void 0&&i(l.object,f);return}case"unary":i(l.operand,f);return;case"binary":i(l.left,f),i(l.right,f);return;case"where":i(l.set,f),i(l.filter,!0);return;case"call":{e.add(l.fn);let c=(l.fn==="out"||l.fn==="in")&&l.args.length===2?l.args[1]:l.args[0],g=c?.t==="lit"&&typeof c.value=="string"?c.value:void 0;l.fn==="all"&&g&&r.push(g),(l.fn==="out"||l.fn==="in")&&g&&a.push(g),l.args.forEach((v,k)=>i(v,f||G(l,k)));return}}};return i(t,!1),{names:o,functions:e,unknownFunctions:[...e].filter(l=>!s.has(l)),sweeps:r,edges:a}}var p=class extends Error{constructor(e,r,a){super(`${e} (at character ${r+1} of "${a}")`);this.sentence=e;this.at=r;this.source=a}},H=["||","&&","==","!=","<=",">=","<",">","!","|","&","+","-","*","/","%","(",")","[","]",",","."],A={and:"&&",or:"||",not:"!"},P=2e3;function Z(t){let o=[],e=0;for(;e<t.length;){let r=t[e];if(r===" "||r===" "||r===`
|
|
2
|
+
`||r==="\r"){e++;continue}if(r>="0"&&r<="9"){let s=e;for(;e<t.length&&/[0-9.]/.test(t[e]);)e++;let i=t.slice(s,e),l=Number(i);if(!Number.isFinite(l)||i.split(".").length>2)throw new p(`"${i}" is not a number`,s,t);o.push({k:"num",v:l,at:s});continue}if(r==="'"||r==='"'){let s=e++,i="";for(;e<t.length&&t[e]!==r;)t[e]==="\\"&&e+1<t.length&&e++,i+=t[e++];if(e>=t.length)throw new p("a quoted word is never closed",s,t);e++,o.push({k:"str",v:i,at:s});continue}if(/[A-Za-z_$]/.test(r)){let s=e++;for(;e<t.length&&/[A-Za-z0-9_]/.test(t[e]);)e++;let i=t.slice(s,e);if(r==="$"&&i!==$&&i!==R)throw new p(`"${i}": say ${$} or ${R}`,s,t);let l=Object.hasOwn(A,i)?A[i]:void 0;o.push(l?{k:"op",v:l,at:s}:{k:"id",v:i,at:s});continue}let a=H.find(s=>t.startsWith(s,e));if(!a)throw new p(`"${r}" is not part of the rule language`,e,t);o.push({k:"op",v:a,at:e}),e+=a.length}return o.push({k:"end",at:t.length}),o}function w(t){if(t.length>P)throw new p(`an expression may be at most ${P} characters`,0,t.slice(0,40));let o=Z(t),e=0,r=()=>o[e],a=n=>{let d=r();return d.k==="op"&&d.v===n},s=n=>{let d=r();return d.k==="id"&&d.v===n},i=(n,d)=>{if(!a(n))throw new p(`expected ${d}`,r().at,t);e++},l=0,f=(n,d)=>{if(++l>64)throw new p("the expression nests too deeply",n,t);try{return d()}finally{l--}},c=(n,d)=>()=>{let m=d();for(;;){let y=r(),j=y.k==="op"?n.find(D=>D===y.v):y.k==="id"&&y.v==="in"&&n.includes("in")?"in":void 0;if(!j)return m;e++,m={t:"binary",op:j,left:m,right:d(),at:y.at}}},g=()=>{let n=r();if(n.k==="num")return e++,{t:"lit",value:n.v,at:n.at};if(n.k==="str")return e++,{t:"lit",value:n.v,at:n.at};if(n.k==="id"){if(e++,n.v==="true"||n.v==="false")return{t:"lit",value:n.v==="true",at:n.at};if(n.v==="null")return{t:"lit",value:null,at:n.at};if(a("(")){e++;let d=[];if(!a(")"))for(;;){if(d.push(h()),a(",")){e++;continue}break}return i(")",`")" to close ${n.v}(\u2026)`),{t:"call",fn:n.v,args:d,at:n.at}}return{t:"ident",name:n.v,at:n.at}}if(n.k==="op"&&n.v==="("){e++;let d=f(n.at,h);return i(")",'a ")"'),d}if(n.k==="op"&&n.v==="["){e++;let d=[];if(!a("]"))for(;;){if(d.push(h()),a(",")){e++;continue}break}return i("]",'a "]" to close the list'),{t:"list",items:d,at:n.at}}throw n.k==="end"?new p("the expression ends too soon",n.at,t):new p(`"${n.k==="op"?n.v:""}" cannot start a value here`,n.at,t)},v=()=>{let n=g();for(;;){if(a(".")){let d=r();e++;let m=r();if(m.k!=="id"||m.v.startsWith("$"))throw new p('expected a field name after "."',m.at,t);e++,n={t:"member",object:n,name:m.v,at:d.at};continue}if(s("where")){let d=r().at;e++,n={t:"where",set:n,filter:f(d,h),at:d};continue}return n}},k=()=>{let n=r();return n.k==="op"&&(n.v==="!"||n.v==="-")?(e++,{t:"unary",op:n.v,operand:f(n.at,k),at:n.at}):v()},z=c(["*","/","%"],k),B=c(["+","-"],z),I=c(["&"],B),F=c(["|"],I),K=()=>{let n=F(),d=r(),m=d.k==="op"&&["==","!=","<","<=",">",">="].includes(d.v)?d.v:d.k==="id"&&d.v==="in"?"in":void 0;return m?(e++,{t:"binary",op:m,left:n,right:F(),at:d.at}):n},M=()=>{let n=r();return n.k==="op"&&n.v==="!"?(e++,{t:"unary",op:"!",operand:f(n.at,M),at:n.at}):K()},q=c(["&&"],M),L=c(["||"],q);function h(){return L()}let U=h();if(r().k!=="end")throw new p("there is more after the end of the expression",r().at,t);return U}function E(t){let o,e=-1,r=0;for(let a=0;a<t.length;a++){let s=t[a];if(o){s==="\\"?a++:s===o&&(o=void 0);continue}s==="'"||s==='"'?o=s:s==="("||s==="["?r++:s===")"||s==="]"?r--:s==="|"&&r===0&&(t[a+1]==="|"?a++:e=a)}if(e>0&&t.slice(e+1).trim()===x){let a=E(t.slice(0,e));if(a>=0)return a}return e}var x="capital",S=/\s*(?:'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)")\s*(,|$)/y;function X(t){let o=E(t);if(o>=0){if(t.slice(o+1).trim()!==x)throw new u('only "capital" may follow another formatter, like {n | words | capital}');let e=t.slice(0,o);if(e.trim()===x)throw new u('"capital" is said once');return{...N(e),capital:!0}}return t.trim()===x?{args:[],capital:!0}:N(t)}function N(t){let o=t.indexOf(":"),e=(o>=0?t.slice(0,o):t).trim();if(!b.includes(e))throw new u(`"${e}" is not a formatter; use one of ${[...b,x].join(", ")}`);let r=[];if(o>=0&&e==="excerpt"){let a=t.slice(o+1).trim();if(!/^\d+$/.test(a)||Number(a)<20||Number(a)>1e3)throw new u("excerpt is told at most how many characters, 20 to 1000: {summary | excerpt: 80}");r.push(a)}else if(o>=0&&e==="money"){if(t.slice(o+1).trim()!=="0")throw new u("money is told 0 for whole units, rounded \u2014 {total | money: 0} \u2014 or nothing, for cents only where a sum has them");r.push("0")}else if(o>=0){let a=t.slice(o+1),s=0;for(;s<a.length;){S.lastIndex=s;let i=S.exec(a);if(!i)throw new u(`"${e}" is told quoted words, like ${e}: 'offer'`);if(r.push((i[1]??i[2]??"").replace(/\\(.)/g,"$1")),s=S.lastIndex,i[3]==="")break}}if(e==="plural"&&(r.length<1||r.length>2))throw new u("plural is told its noun, like {count | plural: 'offer'}, and its plural where English does not make it: plural: 'person', 'people'");if(e!=="plural"&&e!=="excerpt"&&e!=="money"&&r.length>0)throw new u(`"${e}" takes nothing after it`);return{format:e,args:r}}var u=class extends Error{constructor(e){super(e);this.sentence=e}};function re(t){let o=[],e=0;for(;e<t.length;){let r=t.indexOf("{",e);if(r<0){o.push({text:t.slice(e)});break}r>e&&o.push({text:t.slice(e,r)});let a=t.indexOf("}",r);if(a<0)throw new u(`a "{" at character ${r+1} is never closed`);let s=t.slice(r+1,a),i=E(s),l=(i>=0?s.slice(0,i):s).trim(),f=i>=0?X(s.slice(i+1)):void 0,c=E(l);if(c>=0&&b.includes(l.slice(c+1).split(":")[0].trim()))throw new u('only "capital" may follow another formatter, like {n | words | capital}');o.push({expr:w(l),source:l,...f?.format?{format:f.format}:{},...f&&f.args.length>0?{formatArgs:f.args}:{},...f?.capital?{capital:!0}:{}}),e=a+1}return o}function _(t){let o=new Map;for(let[e,r]of Object.entries(t?.computed??{}))o.set(e,typeof r=="string"?{expr:r}:r);return o}function le(t){let o=_(t);if(o.size===0)return;let e=new Map;for(let[r,a]of o)try{e.set(r,w(a.expr))}catch(s){if(!(s instanceof p))throw s}return e}function J(t,o,e=new Set){let r=_(t).get(o);if(!r||e.has(o))return!1;let a;try{a=w(r.expr)}catch{return!1}let s=C(a);if(s.edges.length>0||s.sweeps.length>0||[...s.functions].some(c=>c==="out"||c==="in"||c==="all"))return!1;let i=t.fields,l=c=>i instanceof Set?i.has(c):Object.hasOwn(i,c),f=new Set([...e,o]);return[...s.names].every(c=>l(c)||J(t,c,f))}export{C as a,p as b,w as c,u as d,re as e,_ as f,le as g,J as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as u}from"./chunk.
|
|
1
|
+
import{b as u}from"./chunk.45OLF6BK.js";import{oa as l}from"./chunk.ZDUKVXBI.js";function a(e,n){let s=new Map;for(let o of e){let t=n(o.from),i=n(o.to);if(t===void 0||i===void 0)continue;let d=`${o.kind}|${t}|${i}`,r=s.get(d);r||s.set(d,r={edge:o.kind,from:t,to:i,links:0,froms:new Set,tos:new Set}),r.links+=1,r.froms.add(o.from),r.tos.add(o.to)}return[...s.entries()].sort(([o],[t])=>o<t?-1:o>t?1:0).map(([o,t])=>({key:o,edge:t.edge,from:t.from,to:t.to,links:t.links,fromCount:t.froms.size,toCount:t.tos.size}))}function m(e,n,s){let o=[],t=[];for(let d of e){let r=f(d);if(r!==null){o.includes(r)||o.push(r);continue}s(d)!==void 0&&t.push(d)}let i=n.overview&&n.focusId!==null?f(n.focusId):null;return n.beside&&n.overview&&i===null&&n.focusId!==null&&t.length===0&&o.length===0&&s(n.focusId)!==void 0&&t.push(n.focusId),{districts:o,records:t,lens:i}}function f(e){return e.startsWith("kind:")?e.slice(5)||null:e.startsWith("aggregate:")&&!e.includes("|")&&e.slice(10)||null}function y(e,n){let s=u(e,n.from,n.edge,"out"),o=n.from===n.to?" of their own":"";return`${l(e,n.from,n.fromCount)} \u2192 ${l(e,n.to,n.toCount)}${o}, ${s}`}export{a,m as b,f as c,y as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as X}from"./chunk.7VCYVCYM.js";import"./chunk.GH6QX7JR.js";import"./chunk.J4D4BIB4.js";import{G as ce,_ as Y,ia as N,la as _}from"./chunk.ASNVH2G4.js";import"./chunk.SDO3U72B.js";import{Ee as U,Jb as R}from"./chunk.ZDUKVXBI.js";import"./chunk.FQLNBIQ5.js";import{b as O}from"./chunk.AJZBJBMO.js";var u=O(ce(),1);function M(e,t,s=!1){if(e<t.at||e===t.at&&s)return e;let i=t.at+t.removed.length;return e>=i?e+t.inserted.length-t.removed.length:s?t.at:t.at+t.inserted.length}var G=e=>e>=55296&&e<=56319,V=e=>e>=56320&&e<=57343;function q(e,t,s){let i=Math.min(e.length,t.length),n=0,l=Math.max(0,Math.min(i,t.length-s));for(;n<l&&e.charCodeAt(e.length-1-n)===t.charCodeAt(t.length-1-n);)n++;let r=0;for(;r<i-n&&e.charCodeAt(r)===t.charCodeAt(r);)r++;return r>0&&G(e.charCodeAt(r-1))&&r--,n>0&&V(e.charCodeAt(e.length-n))&&n--,{at:r,removed:e.slice(r,e.length-n),inserted:t.slice(r,t.length-n)}}function B(e,t){let s=Math.min(e.length,t.length),i=0;for(;i<s&&e.charCodeAt(i)===t.charCodeAt(i);)i++;i>0&&G(e.charCodeAt(i-1))&&i--;let n=0;for(;n<s-i&&e.charCodeAt(e.length-1-n)===t.charCodeAt(t.length-1-n);)n++;return n>0&&V(e.charCodeAt(e.length-n))&&n--,{at:i,removed:e.slice(i,e.length-n),inserted:t.slice(i,t.length-n)}}function Z(e,t){let s=c=>c.at+c.removed.length;if(s(e)<t.at)return e;if(e.at>s(t))return{...e,at:e.at+t.inserted.length-t.removed.length};let i=Math.min(e.at,t.at),n=s(e)-s(t),l=e.removed.slice(0,t.at-i)+t.inserted+(n>0?e.removed.slice(e.removed.length-n):""),r=t.at<=e.at?t.inserted+e.inserted:e.inserted+t.inserted,d=B(l,r);return{...d,at:i+d.at}}function I(e,t){let s=M(e.start,t,!0),i=e.end===e.start?s:M(e.end,t);return{start:s,end:Math.max(s,i)}}function le(e,t){let{kind:s,id:i,session:n}=e.author,l=`${s}:${i??""}:`;return t.startsWith(l)&&(!n||t.slice(l.length)===n)}function J(e,t,s,i){let n=e.anchor,l=e.head;for(let d of s)if(!(d.seq<e.rev||le(d,t)))for(let c of d.primitives)c.op!=="splice-text"||c.id!==e.node||c.field!==e.field||(n=M(n,c),l=M(l,c));let r=d=>Math.max(0,Math.min(i,d));return{start:r(n),end:r(l)}}var W=(e,t,s)=>e.ops.length>0&&e.ops.every(i=>{let n=i.mutation?.args;return i.mutation?.name===R&&n?.node===t&&n.field===s}),de=(e,t,s,i)=>t.ops.length>0&&t.ops.every(n=>n.undoes!==void 0)&&e.batches().some(n=>t.ops.some(l=>l.undoes===n.id||l.undoes===n.ops[0]?.id)&&W(n,s,i)),Q=(e,t)=>e.author.kind==="human"&&(t?.id===void 0||e.author.id===void 0||e.author.id===t.id);function j(e,t,s,i){let n=e.batches();for(let l=n.length-1;l>=0;l--){let r=n[l];if(!(!Q(r,t)||r.undone||!W(r,s,i))&&e.canUndo(r.id).ok)return r.id}}function ee(e,t,s,i){let n=e.batches();for(let l=n.length-1;l>=0;l--){let r=n[l];if(Q(r,t)){if(W(r,s,i))return;if(de(e,r,s,i))return r.undone?void 0:r.id}}}var p=O(Y(),1);function ue(e){let{store:t}=N(),{live:s,nodeId:i,field:n}=e,[l,r]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let d=!0;return s.typing(i,n).then(c=>d&&r(c)),()=>{d=!1}},[i,n]),l&&!t.collaborative(i,n)?(0,p.jsx)(p.Fragment,{children:e.writtenWhole}):(0,p.jsx)(pe,{...e,typing:l})}function pe({nodeId:e,field:t,label:s,markdown:i,live:n,onDone:l,typing:r}){let{store:d,principal:c}=N(),m=_(e),f=ne(m?.[t]),[T,ie]=(0,u.useState)(!1),v=(0,u.useRef)(null),D=(0,u.useRef)(f),E=(0,u.useRef)(!1),H=(0,u.useRef)(n);H.current=n;let K=()=>ne(d.graph.getNode(e)?.[t]),b=!r||d.permits({name:R,args:{node:e,field:t,at:0,remove:0,insert:""}},c).ok;(0,u.useEffect)(()=>v.current?.focus(),[T,r]);let C=(0,u.useRef)(void 0),k=()=>{C.current===void 0&&(C.current=setTimeout(()=>{C.current=void 0;let o=v.current;if(!o||o.ownerDocument.activeElement!==o)return;let a=o.selectionDirection==="backward";H.current.sayCaret({node:e,field:t,anchor:a?o.selectionEnd:o.selectionStart,head:a?o.selectionStart:o.selectionEnd,rev:d.log.length})},ge))};(0,u.useEffect)(()=>()=>{clearTimeout(C.current),H.current.sayCaret(null)},[]);let F=o=>{let a=v.current;if(a){if(a.value!==o){let h=I({start:a.selectionStart,end:a.selectionEnd},B(a.value,o)),g=a.selectionDirection??"none";a.value=o,a.setSelectionRange(h.start,h.end,g)}D.current=o}},$=()=>{let o=v.current;if(!o||!r||!b||E.current)return;let a=D.current,h=K(),g=q(a,o.value,o.selectionEnd);if(g.removed===""&&g.inserted==="")return F(h);let y=a===h?g:Z(g,B(a,h));try{r.splice(y.at,y.removed.length,y.inserted)}catch{}let w=K();if(o.value!==w){o.value=w;let S=Math.min(w.length,y.at+y.inserted.length);o.setSelectionRange(S,S)}D.current=w,k()};(0,u.useLayoutEffect)(()=>{E.current||F(f)},[f]);let ae=async o=>{if(!r)return;r.flush();for(let h=0;r.waiting()>0&&h<100;h++)await new Promise(g=>setTimeout(g,30));let a=o?ee(d,c,e,t):j(d,c,e,t);if(a)try{o?d.redo(a,{author:c}):d.undo(a,{author:c})}catch{}},x=o=>{r?.flush(),n.sayCaret(null),l(o)},A=(0,u.useRef)(void 0);(0,u.useEffect)(()=>()=>A.current?.(),[]);let se=o=>{A.current?.();let a=o.ownerDocument,h=v.current?.closest("[data-graview-live]"),g=P=>{let L=P.target;if(L instanceof Node&&h?.contains(L))return S();L instanceof Element&&L.closest(te)||(S(),x(!0))},y=()=>{let P=a.activeElement;P!==null&&P!==a.body||o.isConnected&&fe(o)||(S(),v.current?.focus({preventScroll:!0}))},w=new MutationObserver(y);w.observe(a.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["open","hidden"]}),a.addEventListener("focusin",g),a.addEventListener("toggle",y,!0);let S=()=>{A.current=void 0,w.disconnect(),a.removeEventListener("focusin",g),a.removeEventListener("toggle",y,!0)};A.current=S},z=[...n.who.values()].filter(o=>o.caret?.node===e&&o.caret.field===t);return(0,p.jsxs)("div",{style:{display:"grid",gap:8,minWidth:0},"data-graview-live":t,children:[T?(0,p.jsx)("div",{"data-graview-preview":t,"aria-label":`${s}, as it will read`,role:"region",style:ye,children:(0,p.jsx)(X,{text:f,markdown:!0})}):(0,p.jsxs)("div",{style:{position:"relative",minWidth:0},children:[(0,p.jsx)("textarea",{ref:v,"aria-label":s,"data-graview-field":t,defaultValue:f,readOnly:!r||!b,rows:3,onInput:$,onCompositionStart:()=>{E.current=!0},onCompositionEnd:()=>{E.current=!1,$()},onSelect:k,onFocus:k,onPointerDown:()=>r?.flush(),onKeyDown:o=>{let a=o.key;a==="Escape"?(o.preventDefault(),x(!1)):(o.metaKey||o.ctrlKey)&&!o.altKey&&a.toLowerCase()==="z"?(o.preventDefault(),ae(o.shiftKey)):(o.metaKey||o.ctrlKey)&&a==="Enter"?(o.preventDefault(),x(!1)):(a==="Enter"||me.has(a))&&r?.flush()},onKeyUp:k,onBlur:o=>{r?.flush(),n.sayCaret(null);let a=o.relatedTarget;if(a instanceof Node&&o.currentTarget.closest("[data-graview-live]")?.contains(a))return;let h=a instanceof Element?a.closest(te):null;if(h)return se(h);x(!0)},style:ve}),z.length>0?(0,p.jsx)(he,{text:f,others:z,area:v,log:d.log.all()}):null]}),(0,p.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,p.jsx)("button",{type:"button",onClick:()=>x(!1),style:re,children:"Done"}),i?(0,p.jsx)("button",{type:"button","aria-pressed":T,onClick:()=>ie(!T),style:re,children:T?"Write":"Preview"}):null,(0,p.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},...b?{}:{"data-graview-readonly":""},children:b?"Saved as you type \xB7 Ctrl or \u2318 Z takes back your typing":`Read only: the ${s.toLowerCase()} can't be changed here now`})]})]})}function he({text:e,others:t,area:s,log:i}){let n=(0,u.useRef)(null);(0,u.useLayoutEffect)(()=>{let c=s.current,m=n.current;if(!c||!m)return;let f=()=>{m.scrollTop=c.scrollTop};return f(),c.addEventListener("scroll",f),()=>c.removeEventListener("scroll",f)});let l=t.map(c=>({one:c,at:J(c.caret,c.participant,i,e.length).end})).sort((c,m)=>c.at-m.at),r=[],d=0;for(let{one:c,at:m}of l){r.push(e.slice(d,m)),d=m;let f=U(c)||"Somebody";r.push((0,p.jsx)("span",{"data-graview-caret":c.participant,title:`${f} is typing here`,style:{borderLeft:`2px solid hsl(${Math.round(c.hue)} 55% 52%)`,marginLeft:-1,marginRight:-1,pointerEvents:"auto"}},c.participant))}return r.push(`${e.slice(d)}\u200B`),(0,p.jsx)("div",{ref:n,"aria-hidden":"true",style:we,children:r})}var te='[data-graview-overlay], dialog, [role="dialog"], [role="alertdialog"], [popover]',fe=e=>{if(e.hasAttribute("hidden")||e instanceof HTMLDialogElement&&!e.open)return!1;if(e.hasAttribute("popover"))try{return e.matches(":popover-open")}catch{}return!0},ge=120,ne=e=>typeof e=="string"?e:"",me=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"]),ye={minHeight:"7.5em",padding:"8px 10px",border:"1px dashed var(--graview-edge-bright)",borderRadius:6,lineHeight:1.6,minWidth:0},re={font:"inherit",fontSize:"0.8125rem",minHeight:28,padding:"2px 12px"},oe={font:"inherit",lineHeight:1.5,width:"100%",boxSizing:"border-box",minHeight:"7.5em",padding:"8px 10px",borderRadius:6},ve={...oe,resize:"vertical",fieldSizing:"content",color:"var(--graview-ink)",background:"var(--graview-panel, transparent)",border:"1px solid var(--graview-edge-bright)"},we={...oe,position:"absolute",inset:0,height:"100%",border:"1px solid transparent",color:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word",overflow:"hidden",pointerEvents:"none"};export{ue as default};
|