graview 0.1.67 → 0.1.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/preview/{chunk.YCD4JSXD.js → chunk.2BMZPALF.js} +1 -1
- package/dist/preview/{chunk.SNHKYH72.js → chunk.2KCDLCB2.js} +1 -1
- package/dist/preview/{chunk.O2OL6RQQ.js → chunk.2ME4DVBI.js} +1 -1
- package/dist/preview/chunk.2TUEBU7X.js +8 -0
- package/dist/preview/{chunk.LYEGRY77.js → chunk.2U6HB4XU.js} +1 -1
- package/dist/preview/{chunk.7S6ZRMW4.js → chunk.32JE2WS7.js} +1 -1
- package/dist/preview/{chunk.RG5G6YQD.js → chunk.3DEWQDP7.js} +1 -1
- package/dist/preview/{chunk.GVT4UUQA.js → chunk.3JMQKANL.js} +1 -1
- package/dist/preview/{chunk.A5PSEU3W.js → chunk.3VEZ5MOC.js} +1 -1
- package/dist/preview/chunk.3WPCS6KP.js +1 -0
- package/dist/preview/{chunk.5R744JGZ.js → chunk.42C3FIKK.js} +1 -1
- package/dist/preview/{chunk.IAEGJDF3.js → chunk.42KHFGN6.js} +1 -1
- package/dist/preview/{chunk.DZMIYEHQ.js → chunk.4DXPPM6T.js} +1 -1
- package/dist/preview/chunk.4GVKKBQL.js +1 -0
- package/dist/preview/{chunk.KX5ZBHMA.js → chunk.4TT3ZHSJ.js} +1 -1
- package/dist/preview/{chunk.QXLJGHMC.js → chunk.4YAO3A5Q.js} +3 -3
- package/dist/preview/{chunk.Z4TY44CD.js → chunk.5JKUT2OM.js} +1 -1
- package/dist/preview/chunk.5L4ADKTW.js +1 -0
- package/dist/preview/{chunk.BKYZSV2Y.js → chunk.64LCHHZB.js} +1 -1
- package/dist/preview/{chunk.ZEZUKRC6.js → chunk.6AANHELP.js} +1 -1
- package/dist/preview/{chunk.ZAQ4IDX6.js → chunk.6DMCEBSO.js} +1 -1
- package/dist/preview/{chunk.NKLPL7QD.js → chunk.6IR5LBJU.js} +1 -1
- package/dist/preview/{chunk.X226YATK.js → chunk.6WB2TYK7.js} +1 -1
- package/dist/preview/chunk.6ZENHSTQ.js +1 -0
- package/dist/preview/{chunk.EJ2EZL2G.js → chunk.7K2V5FUB.js} +1 -1
- package/dist/preview/chunk.7OL6H4LF.js +1 -0
- package/dist/preview/{chunk.4W57E7AX.js → chunk.7TDML5YU.js} +1 -1
- package/dist/preview/{chunk.AJMVRFYX.js → chunk.7WPVLEX2.js} +2 -2
- package/dist/preview/{chunk.XSWSBTUO.js → chunk.7ZTGB4O7.js} +1 -1
- package/dist/preview/{chunk.FRQSLWP4.js → chunk.ACNOP2IU.js} +1 -1
- package/dist/preview/{chunk.N4ZKZ4GM.js → chunk.AENP662H.js} +1 -1
- package/dist/preview/{chunk.SFBHPYRD.js → chunk.AQ2PI6MR.js} +1 -1
- package/dist/preview/chunk.ARS4HJD2.js +1 -0
- package/dist/preview/{chunk.STPA7HBK.js → chunk.AWV57UBJ.js} +1 -1
- package/dist/preview/{chunk.D7NWMXSX.js → chunk.AYZL3LCR.js} +3 -3
- package/dist/preview/{chunk.URQTF5SY.js → chunk.BHJRT57H.js} +1 -1
- package/dist/preview/{chunk.7UHPHEH5.js → chunk.BPNW5KCP.js} +1 -1
- package/dist/preview/{chunk.TTSGCNPT.js → chunk.BQAFFEOA.js} +1 -1
- package/dist/preview/chunk.C2QKA6XY.js +1 -0
- package/dist/preview/{chunk.6KJGRM7A.js → chunk.CE3NKAF7.js} +1 -1
- package/dist/preview/{chunk.QRQ5WPZI.js → chunk.CFE3MHWZ.js} +1 -1
- package/dist/preview/{chunk.H6KIEDZN.js → chunk.CGBOPPNL.js} +1 -1
- package/dist/preview/{chunk.LP2ZMAT2.js → chunk.CNN32262.js} +1 -1
- package/dist/preview/{chunk.HJUZMOW2.js → chunk.DCLF4WWZ.js} +1 -1
- package/dist/preview/{chunk.GMLONS5L.js → chunk.DGDW54KE.js} +1 -1
- package/dist/preview/{chunk.3GNT5MKP.js → chunk.DLSS56EU.js} +1 -1
- package/dist/preview/{chunk.QAM76AXV.js → chunk.DMZRFXH7.js} +1 -1
- package/dist/preview/{chunk.Z2XUVJAL.js → chunk.DPHH5ZVL.js} +1 -1
- package/dist/preview/{chunk.Z27NSSYL.js → chunk.DZ6UDZOB.js} +2 -2
- package/dist/preview/{chunk.6W6XMLSF.js → chunk.E423JCOS.js} +1 -1
- package/dist/preview/{chunk.35KMZHB7.js → chunk.EB7PZJEO.js} +1 -1
- package/dist/preview/{chunk.V7H4BUEB.js → chunk.ECNGVD25.js} +1 -1
- package/dist/preview/{chunk.B7KZBT27.js → chunk.EGSOHTZZ.js} +1 -1
- package/dist/preview/{chunk.OCXY5DCD.js → chunk.EGVM24ND.js} +1 -1
- package/dist/preview/{chunk.UDHPMVC4.js → chunk.ENLIIZF2.js} +1 -1
- package/dist/preview/{chunk.H3EGBDW2.js → chunk.EP5JS7ZH.js} +1 -1
- package/dist/preview/{chunk.TI5FR2QQ.js → chunk.F5GNNVSQ.js} +1 -1
- package/dist/preview/chunk.FHQ25SWY.js +1 -0
- package/dist/preview/{chunk.F464JKHZ.js → chunk.FSW535EA.js} +1 -1
- package/dist/preview/{chunk.G5GVT6JY.js → chunk.FZELUSK5.js} +1 -1
- package/dist/preview/{chunk.UWS4RMM3.js → chunk.G2BDEWJC.js} +1 -1
- package/dist/preview/chunk.GF3ZCX46.js +2 -0
- package/dist/preview/{chunk.UW52CMGJ.js → chunk.GJTEV6CK.js} +1 -1
- package/dist/preview/{chunk.A7GVTE5Y.js → chunk.GKTQ5CZA.js} +2 -2
- package/dist/preview/{chunk.ZG5VGP5U.js → chunk.GONZB3J3.js} +1 -1
- package/dist/preview/{chunk.FLJXYESX.js → chunk.GRBWXTST.js} +1 -1
- package/dist/preview/{chunk.Z3O2VZAJ.js → chunk.GRTBEA7O.js} +1 -1
- package/dist/preview/{chunk.QNP5OR3P.js → chunk.H3IGXHZR.js} +2 -2
- package/dist/preview/{chunk.ILJDLBPJ.js → chunk.H3W5C3XQ.js} +1 -1
- package/dist/preview/{chunk.O5VFKVZS.js → chunk.H4VNIAHN.js} +1 -1
- package/dist/preview/{chunk.7ARRVNUR.js → chunk.HH4D3JEI.js} +1 -1
- package/dist/preview/{chunk.MUSMNKE4.js → chunk.HWFJQ42Y.js} +1 -1
- package/dist/preview/{chunk.37RFCHSS.js → chunk.HXTKBISQ.js} +1 -1
- package/dist/preview/{chunk.J2OPIS3H.js → chunk.I34BWUB4.js} +1 -1
- package/dist/preview/{chunk.ZAPS4J6G.js → chunk.I63462I3.js} +1 -1
- package/dist/preview/{chunk.6UQFV53C.js → chunk.IKKKHHRN.js} +1 -1
- package/dist/preview/{chunk.GRFD42WM.js → chunk.IPGLITWA.js} +1 -1
- package/dist/preview/{chunk.3NSV3WKM.js → chunk.IT5DVKXY.js} +2 -2
- package/dist/preview/{chunk.JQ2WNKDW.js → chunk.IXMIU4D4.js} +1 -1
- package/dist/preview/{chunk.JVB5KDSG.js → chunk.JCETQQ7J.js} +1 -1
- package/dist/preview/{chunk.M7KXQGQL.js → chunk.JGRSUTPJ.js} +1 -1
- package/dist/preview/{chunk.KFT7JIEH.js → chunk.JLDJZET2.js} +1 -1
- package/dist/preview/{chunk.JQ63N4MZ.js → chunk.JULD4XFB.js} +1 -1
- package/dist/preview/{chunk.LVOTLGJB.js → chunk.JV432T4Q.js} +1 -1
- package/dist/preview/{chunk.6SJEZWH3.js → chunk.KAM73WVF.js} +1 -1
- package/dist/preview/{chunk.AKJS2NUM.js → chunk.KUCBNMIY.js} +1 -1
- package/dist/preview/{chunk.DWM7AR5Y.js → chunk.L7XKYGV7.js} +1 -1
- package/dist/preview/{chunk.EP6Q32WT.js → chunk.LFFJB6D3.js} +1 -1
- package/dist/preview/{chunk.264PB572.js → chunk.LMTG5NPG.js} +1 -1
- package/dist/preview/{chunk.EGPCVMDU.js → chunk.LOKGUALC.js} +1 -1
- package/dist/preview/{chunk.FPHRAO3R.js → chunk.LZ6MSQ5O.js} +1 -1
- package/dist/preview/chunk.MBTEOF4R.js +1 -0
- package/dist/preview/{chunk.RJY7VJBH.js → chunk.MIOLBZBS.js} +1 -1
- package/dist/preview/{chunk.G3GFDVO2.js → chunk.MK5RPEB2.js} +1 -1
- package/dist/preview/{chunk.NSOPYIT4.js → chunk.MKL4THIV.js} +1 -1
- package/dist/preview/{chunk.FVQKSN33.js → chunk.MPWLDQOG.js} +1 -1
- package/dist/preview/chunk.MSUZAJ2K.js +4 -0
- package/dist/preview/{chunk.MSAYU25L.js → chunk.N5Z34V7U.js} +1 -1
- package/dist/preview/chunk.N64RVSH3.js +1 -0
- package/dist/preview/{chunk.HAOB6O72.js → chunk.ND3DEDWB.js} +1 -1
- package/dist/preview/{chunk.GFLH7RCI.js → chunk.NFTPJAMJ.js} +1 -1
- package/dist/preview/{chunk.QZQCQWQG.js → chunk.NRCWMYLH.js} +1 -1
- package/dist/preview/{chunk.47XEJZ3O.js → chunk.O2VXTYUJ.js} +1 -1
- package/dist/preview/{chunk.6N4PE3U5.js → chunk.O32F6LGK.js} +1 -1
- package/dist/preview/{chunk.PZ7KY6XH.js → chunk.O5FTWXA2.js} +1 -1
- package/dist/preview/{chunk.T2OUHRAA.js → chunk.ODYJEDIW.js} +1 -1
- package/dist/preview/{chunk.DKEIEH2D.js → chunk.OQ4ZO3YY.js} +1 -1
- package/dist/preview/chunk.PI4RFOBU.js +1 -0
- package/dist/preview/{chunk.E5PYNAYT.js → chunk.PIMAG4WT.js} +2 -2
- package/dist/preview/{chunk.EFVSZKB5.js → chunk.PLIV3IQK.js} +1 -1
- package/dist/preview/{chunk.77C556NM.js → chunk.PPCDPYYU.js} +1 -1
- package/dist/preview/{chunk.MW7R5G3C.js → chunk.PZQ5P6WK.js} +1 -1
- package/dist/preview/chunk.Q42R2KW4.js +1 -0
- package/dist/preview/{chunk.WEMUKZKH.js → chunk.Q4VFLLUT.js} +1 -1
- package/dist/preview/{chunk.SY5ID44D.js → chunk.Q6H5HESF.js} +1 -1
- package/dist/preview/chunk.QM54TGU6.js +3 -0
- package/dist/preview/{chunk.HN4ZJ4B4.js → chunk.QOQ26NXM.js} +1 -1
- package/dist/preview/{chunk.SJQPTDAT.js → chunk.QUETLFBJ.js} +1 -1
- package/dist/preview/{chunk.P2EKKKK2.js → chunk.QWLK3GKG.js} +1 -1
- package/dist/preview/{chunk.JEC5FDKX.js → chunk.QYPU444Y.js} +1 -1
- package/dist/preview/{chunk.TXZQEJ5T.js → chunk.QZP3ARLH.js} +1 -1
- package/dist/preview/{chunk.WALVW3KJ.js → chunk.R3GE37OI.js} +1 -1
- package/dist/preview/chunk.R66ZVMWB.js +1 -0
- package/dist/preview/{chunk.YZPESGCP.js → chunk.RQG672MJ.js} +1 -1
- package/dist/preview/chunk.RYA7A4NA.js +1 -0
- package/dist/preview/{chunk.LRNFE3UK.js → chunk.SADR3MQI.js} +1 -1
- package/dist/preview/{chunk.MJY4SLWA.js → chunk.SS6KL5NT.js} +1 -1
- package/dist/preview/chunk.SUG6LIOX.js +1 -0
- package/dist/preview/{chunk.SO6NT5K7.js → chunk.TFJA4QV4.js} +1 -1
- package/dist/preview/{chunk.D4WJ7OM5.js → chunk.TOUSIUJF.js} +1 -1
- package/dist/preview/{chunk.ARWO4WOV.js → chunk.TR4YFVZN.js} +1 -1
- package/dist/preview/{chunk.XFLGSUYO.js → chunk.TRNJKHIA.js} +1 -1
- package/dist/preview/{chunk.5AKZROMR.js → chunk.TVWK3SGD.js} +1 -1
- package/dist/preview/chunk.U7PAFLUM.js +1 -0
- package/dist/preview/{chunk.NKYWIGC7.js → chunk.UAMPR4MD.js} +1 -1
- package/dist/preview/{chunk.UGQYMN4J.js → chunk.UD7VLXPM.js} +1 -1
- package/dist/preview/{chunk.UQIPEMJ5.js → chunk.UFURYU4R.js} +1 -1
- package/dist/preview/{chunk.R6JBA7UK.js → chunk.UODTUBQ7.js} +1 -1
- package/dist/preview/{chunk.NRURQGXV.js → chunk.VES4XMZX.js} +1 -1
- package/dist/preview/{chunk.QWGWOEBZ.js → chunk.VLXLBGMY.js} +1 -1
- package/dist/preview/{chunk.IDALEKIW.js → chunk.VTDOWXCP.js} +1 -1
- package/dist/preview/{chunk.4EMKCKDB.js → chunk.VV5JAM5W.js} +1 -1
- package/dist/preview/{chunk.JU6UFWS3.js → chunk.VW632VNJ.js} +1 -1
- package/dist/preview/{chunk.25QFDTCU.js → chunk.WC5WE34A.js} +1 -1
- package/dist/preview/chunk.WN7SAAH6.js +1 -0
- package/dist/preview/{chunk.4UUJHLHR.js → chunk.WV45KLXC.js} +1 -1
- package/dist/preview/{chunk.NAXOXBOF.js → chunk.XDZDNZ7B.js} +1 -1
- package/dist/preview/{chunk.MAKCZ6B6.js → chunk.XFH6GHBQ.js} +1 -1
- package/dist/preview/{chunk.2VUX54XH.js → chunk.XRE7SHLD.js} +1 -1
- package/dist/preview/{chunk.J6HF7IRQ.js → chunk.XXCHO2A5.js} +1 -1
- package/dist/preview/{chunk.A4EZAGG7.js → chunk.Y7OGJOPA.js} +1 -1
- package/dist/preview/{chunk.6NG76MDA.js → chunk.YBQ5GVAX.js} +2 -2
- package/dist/preview/{chunk.QF5QB5YR.js → chunk.YL2RBZFE.js} +1 -1
- package/dist/preview/{chunk.RSQ432QN.js → chunk.YM6SWEUI.js} +1 -1
- package/dist/preview/{chunk.7BJRHPE3.js → chunk.Z2X7BFCB.js} +2 -2
- package/dist/preview/{chunk.VBLQJVQ5.js → chunk.Z67LBSQO.js} +1 -1
- package/dist/preview/{chunk.OHAO6KKH.js → chunk.ZKXIZBCN.js} +1 -1
- package/dist/preview/{chunk.BDNQMKDG.js → chunk.ZLEBOR5T.js} +1 -1
- package/dist/preview/{chunk.CKDCTFLU.js → chunk.ZLNUZ6LR.js} +1 -1
- package/dist/preview/chunk.ZMADWPJO.js +1 -0
- package/dist/preview/chunk.ZO6VMEPP.js +1 -0
- package/dist/preview/chunk.ZUG7U7AT.js +1 -0
- package/dist/preview/index.html +55 -55
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.2FHIINXG.js +0 -2
- package/dist/preview/chunk.3ENPWZBG.js +0 -1
- package/dist/preview/chunk.3ZODN6BW.js +0 -1
- package/dist/preview/chunk.55G4IPOO.js +0 -1
- package/dist/preview/chunk.5J6DVR7S.js +0 -1
- package/dist/preview/chunk.7WHQWLL6.js +0 -1
- package/dist/preview/chunk.B5SJMCTT.js +0 -7
- package/dist/preview/chunk.CTUJZ3IV.js +0 -1
- package/dist/preview/chunk.CY7FFKEZ.js +0 -1
- package/dist/preview/chunk.DEKRFTRN.js +0 -4
- package/dist/preview/chunk.EBKH3ILT.js +0 -1
- package/dist/preview/chunk.FOUBDGL3.js +0 -1
- package/dist/preview/chunk.HB5NWHFP.js +0 -3
- package/dist/preview/chunk.HVBKI5ZO.js +0 -1
- package/dist/preview/chunk.I3SDKMQS.js +0 -1
- package/dist/preview/chunk.J5OLYVZ4.js +0 -1
- package/dist/preview/chunk.JKFVNQY7.js +0 -1
- package/dist/preview/chunk.KGMSSXZL.js +0 -1
- package/dist/preview/chunk.NXZL5CA2.js +0 -1
- package/dist/preview/chunk.PSNMZBVS.js +0 -1
- package/dist/preview/chunk.R7CRBRD4.js +0 -1
- package/dist/preview/chunk.RR25BGWP.js +0 -1
- package/dist/preview/chunk.T27QKVKP.js +0 -1
- package/dist/preview/chunk.T3WCRS6M.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as U,b as Y,c as G,d as D}from"./chunk.
|
|
1
|
+
import{a as U,b as Y,c as G,d as D}from"./chunk.WV45KLXC.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{G as ae,R as L,S as F,W as V,fa as _}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import{W as H,db as K,eb as B,td as M}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as R}from"./chunk.AJZBJBMO.js";function O(n,t){let r=K(n);return r==="agent"?"agent":r!=="human"&&r!=="visitor"?"app":n.onBehalfOf!==void 0?"person":n.id===void 0||t?.id===void 0||n.id===t.id?"you":"person"}var re=n=>n.ops.filter(t=>t.withheld!==!0);function X(n,t={}){let r=[];for(let e of n.batches()){let s=e.ops[0],d=e.ops.at(-1),l=re(e).length===0,h=l?void 0:Y(e.ops),c=r.at(-1);if(h&&c?.typed&&c.author&&U(c.author,e.author)&&c.typed.node===h.node&&c.typed.field===h.field){let S=G(c.typed,h);r[r.length-1]={...c,seq:d.seq+1,at:d.at,batch:e.id,batches:[...c.batches??[],e.id],typed:S,said:D(S,n.schema,n.graph,!1)};continue}r.push({seq:d.seq+1,from:s.seq,at:d.at,batch:e.id,maker:l?"person":O(e.author,t.me),author:l?void 0:e.author,said:h?D(h,n.schema,n.graph,!1):e.intent,declaration:!1,withheld:l,...h?{batches:[e.id],typed:h}:{}})}let i=[...n.log.epochs().filter(e=>e.change!==void 0).map(e=>({seq:e.seq,sentence:e.change,...e.at?{at:e.at}:{}})),...t.declarations??[]];for(let e of i){if(e.seq<n.log.horizon||e.seq>n.log.length)continue;let s=r.findIndex(d=>d.seq===e.seq);if(s>=0&&!r[s].withheld){r[s]={...r[s],declaration:!0,said:e.sentence};continue}r.push({seq:e.seq,from:e.seq,at:e.at,batch:void 0,maker:e.author?O(e.author,t.me):"app",author:e.author,said:e.sentence,declaration:!0,withheld:!1})}return r.sort((e,s)=>e.seq-s.seq||+(e.batch!==void 0)-+(s.batch!==void 0))}function J(n,t){let r=n.log.all(),i=new Map(r.map(e=>[e.id,e.seq]));return n.batches().filter(e=>!e.undone&&e.ops[0].seq>=t).filter(e=>!e.ops.every(s=>s.sentOut!==void 0)).filter(e=>!e.ops.every(s=>s.undoes!==void 0&&(i.get(s.undoes)??-1)>=t)).map(e=>e.id)}function Q(n,t){return n.withheld?"Someone":n.maker==="you"?"you":n.author?B(n.author,t):"the app"}var p=R(ae(),1);var o=R(V(),1),oe={kind:"human"},ie=[1,2,4,8],se=900,E={you:"You",person:"A person",agent:"An agent",app:"The app"},Z={you:"var(--graview-accent)",person:"var(--graview-ink-muted)",agent:"var(--graview-activity, var(--graview-good))",app:"var(--graview-edge-bright)"};function de(n,t,r){return[...new Set([...r,t,...n.map(i=>i.seq)])].sort((i,e)=>i-e)}function le(n,t){let r=n.withheld===!0;return{seq:n.seq+1,from:n.seq,at:n.at,batch:n.batch,maker:r?"person":O(n.author,t),author:r?void 0:n.author,said:n.batchIntent??n.intent,declaration:!1,withheld:r}}function ce(n,t){let r=0;for(let i=0;i<n.length;i++)n[i]<=t&&(r=i);return r}function pe(n,t,r){let i=J(n,t);if(i.length===0)return null;let e=n.canUndo(i);if(!e.ok)return null;let s=new Set(n.permittedMutations(r).map(d=>d.name));return e.ops.every(d=>d.mutation!==null&&s.has(d.mutation.name))?i:null}function we({face:n}){let t=L(),r=_(),i=r?.principal??oe,e=F(t.live,i),s=e.log.length,d=(0,p.useMemo)(()=>X(e,{me:i,...t.host?.declarations?{declarations:t.host.declarations}:{}}),[e,i,t.host,s]),l=e.log.horizon,h=l>0&&t.host?.archived!==void 0,c=t.kept,S=(0,p.useMemo)(()=>h?c?.stops??Array.from({length:l},(a,g)=>g):[],[h,c,l]),m=(0,p.useMemo)(()=>de(d,l,S),[d,l,S]),f=t.archive,y=f?.seq??t.past?.seq??s,x=t.host?.kept&&(f?.behindKept||c!==void 0&&(y<=c.through||c.from>0&&y<=c.from))?t.host.kept:void 0,w=ce(m,y),b=m.length-1,j=y<l&&t.past?.seq===y?t.past.store.log.all().at(-1):void 0,q=j?le(j,i):y<l?void 0:[...d].reverse().find(a=>a.seq<=y&&a.seq>(m[w-1]??-1))??[...d].reverse().find(a=>a.seq<=y),[k,A]=(0,p.useState)(!1),[T,ee]=(0,p.useState)(1),[C,W]=(0,p.useState)(null);(0,p.useEffect)(()=>{if(!k)return;if(w>=b){A(!1);return}let a=setTimeout(()=>t.show(m[w+1]),se/T);return()=>clearTimeout(a)},[k,w,b,T,m,t]);let z=(0,p.useMemo)(()=>t.past&&!f&&y>=l?pe(e,y,i):null,[t.past,f,e,y,l,i,s]),N=a=>Q(a,{graph:e.graph,schema:e.schema,...r?.seats?{seats:r.seats}:{},...r?.people?{people:r.people}:{}}),v=t.past?t.past.at?H(t.past.at,r?.locale):"the start":null,$=f?f.refused?"The archive could not be read":f.behindKept?"Nothing this far back is kept":"Reading the older changes from the archive\u2026":q?`${N(q)==="you"?"You":N(q)}: ${q.said}`:"Nothing had happened yet",I=(0,p.useRef)(null);(0,p.useLayoutEffect)(()=>{let a=I.current,g=a?.parentElement;if(n!=="scene"||!a||!g)return;let u=()=>g.style.setProperty("--graview-sheet",`${Math.ceil(a.getBoundingClientRect().height)+24}px`);u();let P=typeof ResizeObserver>"u"?null:new ResizeObserver(u);return P?.observe(a),()=>{P?.disconnect(),g.style.removeProperty("--graview-sheet")}},[n]);let te=n==="scene"?{position:"absolute",left:"50%",bottom:12,transform:"translateX(-50%)",width:"min(720px, calc(100% - 32px))",zIndex:M("rail")}:{position:"sticky",top:0,zIndex:M("rail"),margin:"0 auto 12px",maxWidth:960,width:"100%"};return(0,o.jsxs)("section",{ref:I,"aria-label":"Timeline","data-testid":"timeline","data-graview-past":t.past?String(t.past.seq):"now","data-graview-offstage":"",style:{...te,boxSizing:"border-box",display:"grid",gap:8,padding:"10px 12px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontSize:"0.8125rem"},children:[(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px"},children:[(0,o.jsx)("strong",{"data-testid":"as-of",role:"status",style:{fontWeight:600},children:f?"Archived changes":v?`As of ${v}`:"Now"}),(0,o.jsx)("span",{"data-testid":"timeline-caption",style:{color:"var(--graview-ink-muted)",minWidth:0,overflowWrap:"anywhere"},children:$}),v?(0,o.jsx)("span",{style:{color:"var(--graview-ink-faint)"},"data-testid":"past-read-only",children:"Nothing changes while you look back."}):null]}),(0,o.jsxs)("div",{style:{position:"relative",height:22},"aria-hidden":"true",children:[h?(0,o.jsx)("span",{"data-testid":"timeline-archived",title:"Changes read from the archive as you scrub back",style:{position:"absolute",left:0,bottom:0,height:6,width:`${b===0?0:m.indexOf(l)/b*100}%`,borderRadius:2,background:"var(--graview-edge)"}}):null,m.slice(1).map((a,g)=>{let u=[...d].reverse().find(ne=>ne.seq===a);if(!u)return null;let P=b===0?0:(g+1)/b*100;return(0,o.jsx)("span",{"data-graview-tick":a,"data-maker":u.maker,...u.declaration?{"data-declaration":""}:{},title:`${E[u.maker]}: ${u.said}`,style:{position:"absolute",left:`calc(${P}% - 1px)`,bottom:0,width:u.declaration?4:2,height:u.declaration?22:12,borderRadius:2,background:u.declaration?"var(--graview-ink)":Z[u.maker],opacity:a<=y?1:.45}},`${a}:${u.batch??"declaration"}`)})]}),(0,o.jsx)("input",{type:"range","data-testid":"scrubber","aria-label":"Moment",min:0,max:b,step:1,value:w,"aria-valuetext":v?`As of ${v}. ${$}`:`Now. ${$}`,onChange:a=>{A(!1),t.show(m[Number(a.currentTarget.value)]??s)},style:{width:"100%",margin:0,accentColor:"var(--graview-accent)"}}),(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,o.jsx)("button",{type:"button","data-testid":"play","aria-pressed":k,onClick:()=>{!k&&w>=b&&t.show(m[0]),A(!k)},style:{minHeight:28,minWidth:64},children:k?"Pause":"Play"}),(0,o.jsxs)("label",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--graview-ink-muted)"},children:["Speed",(0,o.jsx)("select",{"data-testid":"speed",value:T,onChange:a=>ee(Number(a.currentTarget.value)),style:{minHeight:28},children:ie.map(a=>(0,o.jsxs)("option",{value:a,children:[a,"\xD7"]},a))})]}),(0,o.jsx)("span",{"aria-hidden":"true",style:{display:"inline-flex",gap:10,color:"var(--graview-ink-faint)",flexWrap:"wrap"},children:Object.keys(E).filter(a=>d.some(g=>g.maker===a)).map(a=>(0,o.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[(0,o.jsx)("span",{style:{width:8,height:8,borderRadius:2,background:Z[a]}}),E[a]]},a))}),(0,o.jsxs)("span",{style:{marginLeft:"auto",display:"inline-flex",gap:8},children:[z?(0,o.jsx)("button",{type:"button","data-testid":"restore-here",title:"Take back every change since, as one change you can undo",onClick:()=>{W(null);try{e.undo([...z],{author:i,intent:v?`Restore to ${v}`:"Restore"}),t.show(null)}catch(a){W(a instanceof Error?a.message:String(a))}},style:{minHeight:28},children:"Restore to here"}):null,(0,o.jsx)("button",{type:"button","data-testid":"back-to-now",onClick:()=>t.show(null),style:{minHeight:28},children:"Back to now"})]})]}),C?(0,o.jsx)("span",{role:"alert","data-testid":"restore-refused",style:{color:"var(--graview-warn)"},children:C}):null,f?.refused?(0,o.jsx)("span",{role:"alert","data-testid":"archive-refused",style:{color:"var(--graview-warn)"},children:f.refused}):null,x?(0,o.jsxs)("span",{"data-testid":"timeline-kept",style:{color:"var(--graview-ink-faint)"},children:[x.sentence,x.action?(0,o.jsxs)(o.Fragment,{children:[" ",(0,o.jsx)("a",{"data-testid":"timeline-kept-action",href:x.action.href,style:{color:"var(--graview-ink-muted)"},children:x.action.label})]}):null]}):null,l>0&&!h?(0,o.jsx)("span",{"data-testid":"timeline-horizon",style:{color:"var(--graview-ink-faint)"},children:"The changes before the timeline's start were archived."}):null]})}export{we as Timeline};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as p}from"./chunk.VTDOWXCP.js";import"./chunk.G4JJXA63.js";import{a}from"./chunk.TBY5IR7C.js";import"./chunk.BHJRT57H.js";import"./chunk.BIDL7GQD.js";import"./chunk.CNN32262.js";import"./chunk.JGRSUTPJ.js";import"./chunk.XOZU4OFA.js";import"./chunk.EP5JS7ZH.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.KAM73WVF.js";import"./chunk.O32F6LGK.js";import"./chunk.EGSOHTZZ.js";import"./chunk.WVUJXDXZ.js";import"./chunk.L7XKYGV7.js";import"./chunk.CE3NKAF7.js";import"./chunk.R3GE37OI.js";import"./chunk.2KCDLCB2.js";import"./chunk.UD7VLXPM.js";import"./chunk.3DEWQDP7.js";import"./chunk.TFJA4QV4.js";import"./chunk.HWFJQ42Y.js";import"./chunk.QUETLFBJ.js";import"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{j as draftAnswer,i as draftFromLens,c as draftSight,m as draftView,b as isDraftFailure,d as judgeLens,e as lensEditOf,g as lensFromSpec,a as mayChangeDeclaration,k as recipeDraft,h as recipeOfLens,n as refineDraft,p as runDraftTool,f as takeBackEditOf,l as templateDraft,o as withReaderLenses};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as Ve}from"./chunk.LP2ZMAT2.js";import{c as Be,d as Ie,f as Ge}from"./chunk.H3EGBDW2.js";import{e as Re,f as Fe,k as Me,l as ne,n as Oe}from"./chunk.DWM7AR5Y.js";import{f as Ae}from"./chunk.UGQYMN4J.js";import{d as z,e as Ce,k as te}from"./chunk.SJQPTDAT.js";import{a as je,d as Pe}from"./chunk.JQ63N4MZ.js";import{C as J,Gd as ke,L as ce,Yb as he,Yc as we,_c as be,_d as xe,ad as $e,ea as de,ga as U,ha as ue,ie as Se,ka as H,la as W,ld as Z,ma as me,md as ve,na as Q,oa as pe,pc as ee,qc as ye,ra as fe,re as De,sa as ge,ua as _}from"./chunk.ZEZUKRC6.js";function Ye(t,e,n){let o=t.tryDefinition(e)?.fields.shape,r=J(o?.[n]),a=!1,s=!1;for(;r&&(r.type==="optional"||r.type==="default"||r.type==="nullable"||r.type==="prefault");)(r.type==="optional"||r.type==="nullable")&&(a=!0),(r.type==="default"||r.type==="prefault")&&(s=!0),r=J(r.innerType);if(r?.type!=="enum")return;let p=(r.entries?Object.values(r.entries):r.values??[]).filter(m=>typeof m=="string");return p.length>0?{values:p,empty:a&&!s}:void 0}function E(t,e,n){let o=Ye(t,e,n);if(!o)return[];let r=t.tryDefinition(e),a=o.values.map(s=>({value:s,label:je(r,n,s)}));return o.empty&&a.push({value:null,label:`No ${ge(r,n)}`}),a}function q(t,e,n){let o=t[e];return typeof o=="string"&&n.some(r=>r.value===o)?o:null}function re(t,e,n,o,r=E(t.schema,n.kind,o)){return Ne(t,e,n,o,r).flatMap(a=>a.move?[a.move]:[])}function Ne(t,e,n,o,r=E(t.schema,n.kind,o)){let a=Ke(t.schema,t.allMutations(),n.kind,o,r),s=q(n,o,r),p=_(t.schema.tryDefinition(n.kind),n.kind),m=[];for(let{value:A,label:C,by:R,acts:F}of a){if(A===s)continue;let x,G,V;for(let c of F){let w=R==="step"?{[c.subject.arg]:n.id}:{[c.subject.arg]:n.id,[o]:A},S={name:c.name,args:w};if(!c.input.safeParse(w).success){V??=`${c.title??c.name} asks for more than the ${p} itself.`;continue}let k=t.permits(S,e);if(!k.ok){G??=k.refusal?.message??`You may not ${c.title??c.name}.`;continue}try{he(t.graph,c,w)}catch(f){G??=f instanceof Error?f.message:String(f);continue}x={to:A,call:S,title:c.title??c.name};break}m.push(x?{to:A,label:C,move:x}:{to:A,label:C,why:G??V??`Nothing in this app moves a ${p} to ${C}.`})}return m}function Ke(t,e,n,o,r=E(t,n,o)){let a=Te(t,e,n,o),s=We(t,e,n,o);return r.flatMap(p=>{if(p.value===null)return[];let m=a.filter(A=>A.sets?.[o]===p.value);return[{value:p.value,label:p.label,by:m.length>0?"step":s.length>0?"value":"none",acts:m.length>0?m:s}]})}function Te(t,e,n,o){return e.filter(r=>r.subject!==void 0&&r.derived===void 0&&typeof r.sets?.[o]=="string"&&ee(t,r).includes(n))}function We(t,e,n,o){let r=t.tryDefinition(n);return r?e.filter(a=>{if(!a.subject||!ee(t,a).includes(n)||!ye(a,r).includes(o))return!1;let s=a.input.shape;return s!==void 0&&o in s}).sort((a,s)=>+(a.derived!==void 0)-+(s.derived!==void 0)):[]}var se=(t,e)=>e&&t[e]!==void 0?String(t[e]):"";function Je(t,e,n){let o=c=>t.tryDefinition(c)?e.nodesOfKind(c).filter(w=>H(t.tryDefinition(c),w)):[],r=o(n.rows),a=o(n.columns),s=new Set(r.map(c=>c.id)),p=new Set(a.map(c=>c.id)),m=e.allEdges(),A=[],C=n.link;if(typeof C=="string"){let c=f=>t.tryDefinition(f)?.edges?.[C]?.to,w=(c(n.columns)??[]).some(f=>f===n.rows||f==="*"),S=(c(n.rows)??[]).some(f=>f===n.columns||f==="*"),k=w||!S;for(let f of m){if(f.kind!==C)continue;let j=k?f.to:f.from,i=k?f.from:f.to;s.has(j)&&p.has(i)&&A.push({rowId:j,columnId:i,via:[]})}}else{let c=new Map(C.path.map(S=>[S,new Map]));for(let S of m){let k=c.get(S.kind);if(!k)continue;let f=k.get(S.from);f?f.push(S.to):k.set(S.from,[S.to]);let j=k.get(S.to);j?j.push(S.from):k.set(S.to,[S.from])}let w=new Set;for(let S of a){let k=[{id:S.id,via:[]}];for(let f of C.path){let j=[],i=new Set;for(let v of k)for(let b of c.get(f).get(v.id)??[])i.has(`${v.id}|${b}`)||(i.add(`${v.id}|${b}`),j.push({id:b,via:[...v.via,v.id]}));k=j}for(let f of k){let j=`${f.id}|${S.id}`;!s.has(f.id)||w.has(j)||(w.add(j),A.push({rowId:f.id,columnId:S.id,via:f.via.slice(1)}))}}}let R=n.groupOrder??[],F=c=>R.indexOf(c)===-1?R.length:R.indexOf(c),x=(c,w)=>w==="label"?W(t.tryDefinition(c.kind),c):c[w],G=Z(r,n.sort,x).map(c=>{let w=c;return{node:c,label:W(t.tryDefinition(c.kind),c),group:se(w,n.rowGroup),ref:se(w,n.rowRef)}}).sort((c,w)=>F(c.group)-F(w.group)||(n.sort!==void 0?0:c.ref<w.ref?-1:c.ref>w.ref?1:0)),V=Z(a,n.columnSort,x).map(c=>({node:c,label:W(t.tryDefinition(c.kind),c),group:se(c,n.columnGroup)})).sort((c,w)=>c.group<w.group?-1:c.group>w.group?1:n.columnSort!==void 0?0:c.node.id<w.node.id?-1:c.node.id>w.node.id?1:0);return{rows:G,columns:V,cells:A}}function He(t,e,n){let{rows:o,columns:r,cells:a}=Je(t,e,n),s=(i,v)=>Q(t,i,v),p=i=>Q(t,i,1).replace(/^1 /,""),m=i=>({id:i.id,kind:i.kind,title:W(t.tryDefinition(i.kind),i),parts:[]}),A=i=>{let v=e.getNode(i);if(!v)return null;let b=t.tryDefinition(v.kind),P=W(b,v),N=z(v,b,{limit:3,said:[P],glance:!0}).map(K=>K.alone.startsWith(K.label)?`${K.label.toLowerCase()}${K.alone.slice(K.label.length)}`:K.alone);return[P,...N].join(", ")},C=typeof n.link=="string"?[]:n.link.path.slice(0,-1).flatMap((i,v,b)=>{let P=ke(t,n.columns,b.slice(0,v+1));return P.ok?[...P.reached]:[]}),R=ve(t,n,{rows:o.length,columns:r.length,cells:a.length});if(R)return[{t:"text",text:`${s(n.rows,o.length)} against ${s(n.columns,r.length)}.`},{t:"text",text:R}];let F=[{t:"text",text:`${s(n.rows,o.length)} against ${s(n.columns,r.length)}${C.length>0?`, through ${[...new Set(C)].map(i=>s(i,2).replace(/^2 /,"")).join(" and ")}`:""}${r.length>0?`: ${r.map(i=>i.label).join(", ")}`:""}.`}],x=new Map(r.map(i=>[i.node.id,i.label])),G=new Map(r.map((i,v)=>[i.node.id,v])),V=new Map,c=new Map;for(let i of a){let v=V.get(i.rowId);v?v.push(i):V.set(i.rowId,[i]);let b=c.get(i.columnId);b?b.add(i.rowId):c.set(i.columnId,new Set([i.rowId]))}for(let i of o){let b=[...V.get(i.node.id)??[]].sort((P,N)=>G.get(P.columnId)-G.get(N.columnId)).map(P=>{let N=P.via.map(A).filter(K=>K!==null);return`${x.get(P.columnId)}${N.length>0?` (${N.join("; ")})`:""}`});F.push({t:"field",label:i.label,text:b.length>0?b.join(", "):"none"})}F.push({t:"list",as:"name",columns:1,groups:r.map(i=>{let v=c.get(i.node.id)??new Set,b=o.filter(P=>v.has(P.node.id)).map(P=>m(P.node));return{heading:`${i.label} (${b.length})`,items:b}})});let w=new Set(a.map(i=>i.rowId)),S=new Set(a.map(i=>i.columnId)),k=o.filter(i=>!w.has(i.node.id)),f=r.filter(i=>!S.has(i.node.id)),j=n.rows===n.columns;return k.length>0&&F.push({t:"text",text:`${j?`${k.length} with none across`:`${s(n.rows,k.length)} with no ${p(n.columns)}`}: ${k.map(i=>i.label).join(", ")}.`}),f.length>0&&F.push({t:"text",text:`${j?`${f.length} with none down`:`${s(n.columns,f.length)} on no ${p(n.rows)}`}: ${f.map(i=>i.label).join(", ")}.`}),F}function oe(t,e,n,o={}){let{app:r,blocks:a=n?r?.viewSpecs?.[n.kind]?.[o.slot??"page"]:r?.home}=o;if(!a?.length)return[];let s=o.firstHeading??(n||o.blocks?void 0:1),p=Oe(t,e,n,{...o,money:o.money??r?.brand,firstHeading:s});return n&&!p.node?[]:Fe(typeof a[0]?.t=="string"?a:Re(a),p)}function X(t,e,n){let o=!(e.optional||e.control==="boolean"),r=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(s=>U(_(t.tryDefinition(s),s))).join(" or "):n(e.name).label,a={name:e.name,label:r,required:o};switch(e.control){case"text":return{...a,input:e.holds==="duration"?"length of time":e.holds??(e.markdown?"Markdown text":e.long?"long text":e.app?"app address":"text")};case"date":return{...a,input:e.time||e.instant?"date and time":"date"};case"number":return{...a,input:e.amount?"amount":"number",...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max}};case"choice":return{...a,input:"choice",choices:(e.options??[]).map(s=>n(e.name).option(s))};case"boolean":return{...a,input:"yes or no"};case"node":return{...a,input:"record",kinds:e.kinds};case"linked":return{...a,input:"record in another app"};case"file":return{...a,input:e.image?"picture":e.video?"video":"file"};case"repeat":return{...a,input:"how it repeats"};case"list":return{...a,input:`list of ${X(t,e.item,n).input}`};case"group":return{...a,input:"group",fields:e.fields.map(s=>X(t,s,n))};case"variant":return{...a,input:"one of",choices:e.options.map(s=>ue(s.value))};default:return{...a,input:"answer"}}}function Ee(t,e,n){let o=Ie(t,e,n),r=t.schema,a=Be(r,n).filter(p=>p.name!==n.subject?.arg&&!o.has(p.name)),s=me(n);return{act:n.name,title:s,submit:s,fields:a.map(p=>X(r,p,m=>te(r,n,m)))}}function Le(t,e){return{act:e.act.name,title:e.title,submit:e.submit,visitor:e.name,fields:e.fields.map(n=>X(t,n,o=>te(t,e.act,o)))}}function Ze(t,e,n){return t.permittedMutations(e).filter(o=>!o.derived&&!o.subject&&(o.creates??[]).includes(n))}function ze(t,e=""){let n=[`${e}Form "${t.title}" (${t.visitor?`the visitor form ${t.visitor}, running `:""}act ${t.act}), button "${t.submit}":`],o=(r,a)=>{for(let s of r){let p=s.choices?`${s.input}: ${s.choices.join(", ")}`:s.kinds?`${s.input} (${s.kinds.join(" or ")})`:s.input,m=s.min!==void 0||s.max!==void 0?`, ${s.min??"\u2026"} to ${s.max??"\u2026"}`:"";n.push(`${a}- ${s.label}${s.required?" *":""} (${s.name}) \u2014 ${p}${m}`),s.fields&&o(s.fields,`${a} `)}};return o(t.fields,`${e} `),t.fields.length===0&&n.push(`${e} (asks nothing)`),n}function _e(t,e){let n=t.viewSpecs??{};return e.filter(o=>o.cardinality==="one"&&o.replaces==="page"&&(n[o.attach]?.page?.length??0)>0).map(o=>{let r=L(t.schema,o.attach,1);return{at:`views.${o.attach}.page`,says:`The view "${o.name}" replaces ${Qe(r)}'s page, so its page slot is never drawn: leave out replaces to draw the slot under the view, or draw what the slot says in the view.`}})}var Qe=t=>`${/^[aeiou]/i.test(t)?"an":"a"} ${t}`,et=240,Ue=10,tt=1160,nt=40,qe=640,rt=3,st=t=>Math.max(1,Math.floor((Math.min(t,tt)-nt+Ue)/(et+Ue)));function ot(t,e,n,o){let{app:r}=o,a=o.width??1440,s=o.today??t.today()??ce(r.brand?.timeZone),p=t.seenBy(e),m=p.schema,A=p.graph,C=Ve(r,o.views?{views:o.views}:{}),R=typeof n=="string"?n.trim():n.slug,F=typeof n=="string"?C.find(l=>l.slug===R||l.title===R||l.address===R):C.find(l=>l.slug===n.slug&&l.kind===n.kind)??n,x=!F&&typeof n=="string"?A.getNode(R):void 0,G=!F&&!x?/^\/?forms\/(.+)$/.exec(R)?.[1]:void 0,V=G!==void 0?Ge(r,G):void 0;if(V)return{ok:!0,description:it(m,V,a)};if(!F&&!x)return{ok:!1,error:`"${R}" is not a place this app has, nor a record this seat can see.`,places:[...C.map(l=>l.slug),...Object.keys(r.forms??{}).map(l=>`forms/${l}`)]};let c=[],w=r.viewSpecs??{},S=st(a),k=(l,h)=>oe(p,null,l,{app:r,today:s,...h}),f=(l,h,M)=>{let d=m.tryDefinition(l.kind),g=W(d,l);if(h==="name")return{id:l.id,kind:l.kind,title:g,parts:[]};if(w[l.kind]?.[h]){let I=k(l,{slot:h}),[B,...O]=I,y=B?.t==="title"||h==="row"&&B?.t==="headline";return{id:l.id,kind:l.kind,title:y?B.text:g,parts:j(y?O:I,M,`views.${l.kind}.${h}`,` (${l.id})`,y?1:0)}}if(h==="row")return{id:l.id,kind:l.kind,title:g,parts:[]};let u=d?.computed?ne(m,A,l):l,T=z(u,d,{limit:3,said:[g],glance:!0,locale:r.brand?.locale,timeZone:r.brand?.timeZone});return{id:l.id,kind:l.kind,title:g,parts:T.map(I=>({t:"text",text:I.alone}))}};function j(l,h,M,d="",g=0){let $=[];return l.forEach((u,T)=>{let I=`${M}.${T+g}`;switch("problem"in u&&u.problem&&c.push({at:`${I}${d}`,says:u.problem}),u.t){case"title":$.push({t:"heading",level:3,text:u.text});return;case"text":$.push({t:"text",text:u.markdown?Pe(u.text):u.runs?ct(u.runs):u.text,...u.tone?{tone:u.tone}:{}});return;case"badge":$.push({t:"badge",text:u.text});return;case"field":case"image":$.push({t:"field",label:u.label,text:u.text});return;case"progress":$.push({t:"progress",label:u.label,text:u.text});return;case"group":$.push(...j(u.blocks,h,`${I}.group`,d));return;case"when":$.push(...j(u.blocks,h,`${I}.show`,d));return;case"divider":case"figure":return;case"headline":$.push({t:"heading",level:u.level,text:u.text});return;case"number":$.push({t:"figure",text:u.text,...u.label?{label:u.label}:{}});return;case"list":{if(u.failed){$.push({t:"text",text:"\u2014"});return}if(u.members.length===0){u.empty&&$.push({t:"list",as:u.as,columns:1,groups:[],empty:u.empty});return}let B=h+1,O=B>rt?"name":u.as,y=(u.groups??[{value:null,members:u.members}]).map(D=>({..."heading"in D&&D.heading?{heading:D.heading,count:(u.everyGroup?.find(Y=>Y.value===D.value)??D).members.length}:{},items:D.members.map(Y=>f(Y,O,B))}));$.push({t:"list",as:O,columns:O==="card"?S:1,groups:y,...u.more>0?{more:u.more}:{}});return}}}),$}let i=[],v,b,P,N=[];if(x){b="record";let l=m.tryDefinition(x.kind),h=W(l,x);P={slug:x.id,title:h,kind:x.kind,address:xe(m,x.kind,x.id)};let M=w[x.kind]?.page,d=o.views?.find(g=>g.attach===x.kind&&g.cardinality==="one");if(d&&i.push({t:"view",name:d.name,...d.title?{title:d.title}:{},...d.replaces==="page"?{replaces:!0}:{},...d.parts?{parts:d.parts}:{}}),d?.replaces==="page")b=`view:${d.name}`,c.push(..._e(r,[d]));else{M&&i.push(...j(k(x,{slot:"page"}),1,`views.${x.kind}.page`));let g=l?.computed?ne(m,A,x):x;for(let $ of Ce(l,z(g,l,{said:[h],locale:r.brand?.locale,timeZone:r.brand?.timeZone}))){$.title&&i.push({t:"heading",level:2,text:$.title});for(let u of $.fields)i.push({t:"field",label:u.label,text:u.value,...u.long?{long:!0}:{},...u.markdown?{markdown:!0}:{}})}}}else{let l=F;P={slug:l.slug,title:l.title,kind:l.kind,address:l.address};let h=l.lens?Se(r).drawn.find(d=>d.as===l.slug&&(l.kind===null||d.kinds.includes(l.kind))):void 0,M=l.kind!==null&&l.view===void 0&&!h?o.views?.find(d=>d.attach===l.kind&&d.cardinality==="many"&&d.replaces==="page"&&!d.hidden):void 0;if(l.kind!==null&&h?.create!==!1&&l.view===void 0&&!M&&(N=Ze(t,e,l.kind).map(d=>Ee(t,e,d))),l.view!==void 0&&!h){let d=o.views?.find(g=>g.name===l.view);b=`view:${l.view}`,i.push({t:"view",name:l.view,title:d?.title??l.title,...typeof d?.flows=="boolean"?{flows:d.flows}:{},...d?.parts?{parts:d.parts}:{}})}else if(l.kind===null){let d=r.brand,g=d?.name??r.name,$=$e(d)?.light,u=$&&be($)?$:void 0;if(v={name:g,...d?.subtitle&&d.subtitleDrawn!==!1?{subtitle:d.subtitle}:{},...u?{logo:{alt:d?.logoAlt??g,...we(u)?{drawn:"inline SVG"}:{drawn:"image",src:u}}}:{}},r.home)b="blocks",i=j(k(null,{}),0,"views.home");else{b="derived";let T=t.kindsKeptFrom(e),I=new Set([...r.pages?.hide??[],...T,...t.modules.disabledKinds]),B=De(m.kinds,r.pages?.order).filter(O=>!I.has(O));i.push({t:"heading",level:1,text:r.name??"Home"});for(let O of B){let y=A.nodesOfKind(O).filter(D=>H(m.tryDefinition(O),D)).length;y>0&&i.push({t:"text",text:`${y} ${L(m,O,y)}`})}}}else if(h?.lens==="blocks")b="lens:blocks",i=j(k(null,{blocks:h.options.blocks??[]}),0,`lenses.${h.index}.options.blocks`);else if(h?.lens==="columns"){b="lens:columns";let d=h.options.bindings??{};for(let g of Object.keys(d)){let $=d[g]?.column;if(!$)continue;let u=E(m,g,$),T=Z(A.nodesOfKind(g).filter(y=>H(m.tryDefinition(g),y)),h.options.sort,(y,D)=>D==="label"?W(m.tryDefinition(y.kind),y):y[D]);Object.keys(d).length>1&&i.push({t:"heading",level:2,text:L(m,g,2).replace(/^./,y=>y.toUpperCase())}),i.push({t:"text",text:`${T.length} ${L(m,g,T.length)} in columns by ${fe(m.tryDefinition(g),$).toLowerCase()}.`});let I=u.map(y=>({column:y,items:T.filter(D=>q(D,$,u)===y.value).map(D=>f(D,"card",1))})).filter(({column:y,items:D})=>y.value!==null||D.length>0).map(({column:y,items:D})=>({heading:`${y.label} (${D.length})`,items:D}));i.push({t:"list",as:"card",columns:1,groups:I});let B=new Map;for(let y of T)for(let D of re(t,e,y,$,u))B.set(D.to,(B.get(D.to)??new Set).add(`"${D.title}"`));let O=u.filter(y=>y.value!==null&&B.has(y.value)).map(y=>`to ${y.label} by ${[...B.get(y.value)].join(" or ")}`);i.push({t:"text",text:O.length>0?`Moves: ${O.join("; ")}.`:"Moves: none for this seat."})}}else if(h?.lens==="coverage")b="lens:coverage",i=He(m,A,h.options);else if(h){b=`lens:${h.lens}`;let d=h.kinds.flatMap(g=>A.nodesOfKind(g).filter($=>H(m.tryDefinition(g),$)));i.push({t:"text",text:`A ${h.lens} of ${d.length} ${h.kinds.map(g=>L(m,g,d.length)).join(" and ")}.`}),i.push({t:"list",as:"name",columns:1,groups:[{items:d.map(g=>f(g,"name",1))}]})}else if(M)b=`view:${M.name}`,i.push({t:"heading",level:1,text:l.title}),i.push({t:"view",name:M.name,...M.title?{title:M.title}:{},replaces:!0,...M.parts?{parts:M.parts}:{}});else{b="derived";let d=A.nodesOfKind(l.kind).filter(g=>H(m.tryDefinition(l.kind),g));i.push({t:"heading",level:1,text:l.title}),d.length===0?i.push({t:"list",as:"row",columns:1,groups:[],empty:`No ${L(m,l.kind,0)} yet.`}):i.push({t:"list",as:"row",columns:1,groups:[{items:d.map(g=>f(g,"row",1))}]})}}let K=e.kind==="system"?"the system":(e.roles??[]).length>0?(e.roles??[]).join(", "):e.kind,Xe=a<qe?"phone":"wide",ae=P.kind===null?at(m,A):[],le={...v?{masthead:v}:{},...ae.length>0?{facts:ae}:{},place:P,seat:K,width:a,variant:Xe,drawnBy:b,parts:i,...N.length>0?{forms:N}:{},problems:c};return{ok:!0,description:{...le,text:ie(le)}}}function it(t,e,n){let o=[{t:"heading",level:1,text:e.title},...e.intro?[{t:"text",text:e.intro}]:[]],r={place:{slug:`forms/${e.name}`,title:e.title,kind:null,address:`/forms/${e.name}`},seat:`a visitor (${e.role})`,width:n,variant:n<qe?"phone":"wide",drawnBy:"form",parts:o,forms:[Le(t,e)],problems:[]};return{...r,text:ie(r)}}function at(t,e){let n=Me(t,e,null),o=r=>Array.isArray(r)?r.map(o).join(", "):r===null?"nothing":typeof r=="boolean"?r?"yes":"no":typeof r=="object"?r.label:String(r);return[...Ae(t)].map(([r,a])=>{let s=a.label??U(r);return Object.hasOwn(n.values,r)?{name:r,label:s,value:o(n.values[r])}:{name:r,label:s,refused:n.refused[r]??"it could not be worked out"}})}function L(t,e,n){let o=t.tryDefinition(e);if(n===1)return o?.noun??e;let r=pe(t,e);return de(r)}function ie(t){let e=[`${t.place.title} (${t.place.address}) \u2014 as ${t.seat}, ${t.width} wide (${t.variant}).`],n=t.masthead;n&&e.push(`Masthead: ${n.logo?`the logo ("${n.logo.alt}", ${n.logo.drawn==="image"?n.logo.src:"inline SVG"}), `:""}${n.name}${n.subtitle?` \u2014 ${n.subtitle}`:""}`);let o=(r,a)=>{for(let s of r)switch(s.t){case"heading":e.push(`${a}${"#".repeat(s.level)} ${s.text}`);break;case"text":e.push(`${a}${s.text}`);break;case"badge":e.push(`${a}[${s.text}]`);break;case"field":case"progress":e.push(`${a}${s.label}: ${s.text}`);break;case"figure":e.push(`${a}${s.text}${s.label?` \u2014 ${s.label}`:""}`);break;case"list":if(s.groups.length===0){s.empty&&e.push(`${a}(${s.empty})`);break}for(let p of s.groups){p.heading&&e.push(`${a}${p.heading}${p.count!==void 0?` (${p.count})`:""}:`);for(let m of p.items)e.push(`${a}${p.heading?" ":""}- ${m.title}`),o(m.parts,`${a}${p.heading?" ":" "}`)}s.as==="card"&&s.columns>1&&e.push(`${a}(cards, ${s.columns} across)`),s.more&&e.push(`${a}and ${s.more} more`);break;case"view":e.push(`${a}[the view "${s.title??s.name}"${s.replaces?", in place of the page":""}${s.flows===!0?", flowing with the page":s.flows===!1?", in a frame of its own":""}]`),s.parts&&o(s.parts,`${a} `);break}};o(t.parts,"");for(let r of t.forms??[])e.push(...ze(r));if(t.facts){e.push("Facts of the whole graph (what fact('<name>') reads):");for(let r of t.facts)e.push(`- ${r.label} (${r.name}): ${r.value??`not worked out \u2014 ${r.refused}`}`)}if(t.videos&&t.videos.length>0){e.push("Videos:");for(let r of t.videos)e.push(`- ${lt(r)}`)}if(t.problems.length>0){e.push("Problems:");for(let r of t.problems)e.push(`- ${r.at}: ${r.says}`)}return e.join(`
|
|
1
|
+
import{b as Ve}from"./chunk.CNN32262.js";import{c as Be,d as Ie,f as Ge}from"./chunk.EP5JS7ZH.js";import{e as Re,f as Fe,k as Me,l as ne,n as Oe}from"./chunk.L7XKYGV7.js";import{f as Ae}from"./chunk.UD7VLXPM.js";import{d as z,e as Ce,k as te}from"./chunk.QUETLFBJ.js";import{a as je,d as Pe}from"./chunk.JULD4XFB.js";import{C as J,Gd as ke,L as ce,Yb as he,Yc as we,_c as be,_d as xe,ad as $e,ea as de,ga as U,ha as ue,ie as Se,ka as H,la as W,ld as Z,ma as me,md as ve,na as Q,oa as pe,pc as ee,qc as ye,ra as fe,re as De,sa as ge,ua as _}from"./chunk.6AANHELP.js";function Ye(t,e,n){let o=t.tryDefinition(e)?.fields.shape,r=J(o?.[n]),a=!1,s=!1;for(;r&&(r.type==="optional"||r.type==="default"||r.type==="nullable"||r.type==="prefault");)(r.type==="optional"||r.type==="nullable")&&(a=!0),(r.type==="default"||r.type==="prefault")&&(s=!0),r=J(r.innerType);if(r?.type!=="enum")return;let p=(r.entries?Object.values(r.entries):r.values??[]).filter(m=>typeof m=="string");return p.length>0?{values:p,empty:a&&!s}:void 0}function E(t,e,n){let o=Ye(t,e,n);if(!o)return[];let r=t.tryDefinition(e),a=o.values.map(s=>({value:s,label:je(r,n,s)}));return o.empty&&a.push({value:null,label:`No ${ge(r,n)}`}),a}function q(t,e,n){let o=t[e];return typeof o=="string"&&n.some(r=>r.value===o)?o:null}function re(t,e,n,o,r=E(t.schema,n.kind,o)){return Ne(t,e,n,o,r).flatMap(a=>a.move?[a.move]:[])}function Ne(t,e,n,o,r=E(t.schema,n.kind,o)){let a=Ke(t.schema,t.allMutations(),n.kind,o,r),s=q(n,o,r),p=_(t.schema.tryDefinition(n.kind),n.kind),m=[];for(let{value:A,label:C,by:R,acts:F}of a){if(A===s)continue;let x,G,V;for(let c of F){let w=R==="step"?{[c.subject.arg]:n.id}:{[c.subject.arg]:n.id,[o]:A},S={name:c.name,args:w};if(!c.input.safeParse(w).success){V??=`${c.title??c.name} asks for more than the ${p} itself.`;continue}let k=t.permits(S,e);if(!k.ok){G??=k.refusal?.message??`You may not ${c.title??c.name}.`;continue}try{he(t.graph,c,w)}catch(f){G??=f instanceof Error?f.message:String(f);continue}x={to:A,call:S,title:c.title??c.name};break}m.push(x?{to:A,label:C,move:x}:{to:A,label:C,why:G??V??`Nothing in this app moves a ${p} to ${C}.`})}return m}function Ke(t,e,n,o,r=E(t,n,o)){let a=Te(t,e,n,o),s=We(t,e,n,o);return r.flatMap(p=>{if(p.value===null)return[];let m=a.filter(A=>A.sets?.[o]===p.value);return[{value:p.value,label:p.label,by:m.length>0?"step":s.length>0?"value":"none",acts:m.length>0?m:s}]})}function Te(t,e,n,o){return e.filter(r=>r.subject!==void 0&&r.derived===void 0&&typeof r.sets?.[o]=="string"&&ee(t,r).includes(n))}function We(t,e,n,o){let r=t.tryDefinition(n);return r?e.filter(a=>{if(!a.subject||!ee(t,a).includes(n)||!ye(a,r).includes(o))return!1;let s=a.input.shape;return s!==void 0&&o in s}).sort((a,s)=>+(a.derived!==void 0)-+(s.derived!==void 0)):[]}var se=(t,e)=>e&&t[e]!==void 0?String(t[e]):"";function Je(t,e,n){let o=c=>t.tryDefinition(c)?e.nodesOfKind(c).filter(w=>H(t.tryDefinition(c),w)):[],r=o(n.rows),a=o(n.columns),s=new Set(r.map(c=>c.id)),p=new Set(a.map(c=>c.id)),m=e.allEdges(),A=[],C=n.link;if(typeof C=="string"){let c=f=>t.tryDefinition(f)?.edges?.[C]?.to,w=(c(n.columns)??[]).some(f=>f===n.rows||f==="*"),S=(c(n.rows)??[]).some(f=>f===n.columns||f==="*"),k=w||!S;for(let f of m){if(f.kind!==C)continue;let j=k?f.to:f.from,i=k?f.from:f.to;s.has(j)&&p.has(i)&&A.push({rowId:j,columnId:i,via:[]})}}else{let c=new Map(C.path.map(S=>[S,new Map]));for(let S of m){let k=c.get(S.kind);if(!k)continue;let f=k.get(S.from);f?f.push(S.to):k.set(S.from,[S.to]);let j=k.get(S.to);j?j.push(S.from):k.set(S.to,[S.from])}let w=new Set;for(let S of a){let k=[{id:S.id,via:[]}];for(let f of C.path){let j=[],i=new Set;for(let v of k)for(let b of c.get(f).get(v.id)??[])i.has(`${v.id}|${b}`)||(i.add(`${v.id}|${b}`),j.push({id:b,via:[...v.via,v.id]}));k=j}for(let f of k){let j=`${f.id}|${S.id}`;!s.has(f.id)||w.has(j)||(w.add(j),A.push({rowId:f.id,columnId:S.id,via:f.via.slice(1)}))}}}let R=n.groupOrder??[],F=c=>R.indexOf(c)===-1?R.length:R.indexOf(c),x=(c,w)=>w==="label"?W(t.tryDefinition(c.kind),c):c[w],G=Z(r,n.sort,x).map(c=>{let w=c;return{node:c,label:W(t.tryDefinition(c.kind),c),group:se(w,n.rowGroup),ref:se(w,n.rowRef)}}).sort((c,w)=>F(c.group)-F(w.group)||(n.sort!==void 0?0:c.ref<w.ref?-1:c.ref>w.ref?1:0)),V=Z(a,n.columnSort,x).map(c=>({node:c,label:W(t.tryDefinition(c.kind),c),group:se(c,n.columnGroup)})).sort((c,w)=>c.group<w.group?-1:c.group>w.group?1:n.columnSort!==void 0?0:c.node.id<w.node.id?-1:c.node.id>w.node.id?1:0);return{rows:G,columns:V,cells:A}}function He(t,e,n){let{rows:o,columns:r,cells:a}=Je(t,e,n),s=(i,v)=>Q(t,i,v),p=i=>Q(t,i,1).replace(/^1 /,""),m=i=>({id:i.id,kind:i.kind,title:W(t.tryDefinition(i.kind),i),parts:[]}),A=i=>{let v=e.getNode(i);if(!v)return null;let b=t.tryDefinition(v.kind),P=W(b,v),N=z(v,b,{limit:3,said:[P],glance:!0}).map(K=>K.alone.startsWith(K.label)?`${K.label.toLowerCase()}${K.alone.slice(K.label.length)}`:K.alone);return[P,...N].join(", ")},C=typeof n.link=="string"?[]:n.link.path.slice(0,-1).flatMap((i,v,b)=>{let P=ke(t,n.columns,b.slice(0,v+1));return P.ok?[...P.reached]:[]}),R=ve(t,n,{rows:o.length,columns:r.length,cells:a.length});if(R)return[{t:"text",text:`${s(n.rows,o.length)} against ${s(n.columns,r.length)}.`},{t:"text",text:R}];let F=[{t:"text",text:`${s(n.rows,o.length)} against ${s(n.columns,r.length)}${C.length>0?`, through ${[...new Set(C)].map(i=>s(i,2).replace(/^2 /,"")).join(" and ")}`:""}${r.length>0?`: ${r.map(i=>i.label).join(", ")}`:""}.`}],x=new Map(r.map(i=>[i.node.id,i.label])),G=new Map(r.map((i,v)=>[i.node.id,v])),V=new Map,c=new Map;for(let i of a){let v=V.get(i.rowId);v?v.push(i):V.set(i.rowId,[i]);let b=c.get(i.columnId);b?b.add(i.rowId):c.set(i.columnId,new Set([i.rowId]))}for(let i of o){let b=[...V.get(i.node.id)??[]].sort((P,N)=>G.get(P.columnId)-G.get(N.columnId)).map(P=>{let N=P.via.map(A).filter(K=>K!==null);return`${x.get(P.columnId)}${N.length>0?` (${N.join("; ")})`:""}`});F.push({t:"field",label:i.label,text:b.length>0?b.join(", "):"none"})}F.push({t:"list",as:"name",columns:1,groups:r.map(i=>{let v=c.get(i.node.id)??new Set,b=o.filter(P=>v.has(P.node.id)).map(P=>m(P.node));return{heading:`${i.label} (${b.length})`,items:b}})});let w=new Set(a.map(i=>i.rowId)),S=new Set(a.map(i=>i.columnId)),k=o.filter(i=>!w.has(i.node.id)),f=r.filter(i=>!S.has(i.node.id)),j=n.rows===n.columns;return k.length>0&&F.push({t:"text",text:`${j?`${k.length} with none across`:`${s(n.rows,k.length)} with no ${p(n.columns)}`}: ${k.map(i=>i.label).join(", ")}.`}),f.length>0&&F.push({t:"text",text:`${j?`${f.length} with none down`:`${s(n.columns,f.length)} on no ${p(n.rows)}`}: ${f.map(i=>i.label).join(", ")}.`}),F}function oe(t,e,n,o={}){let{app:r,blocks:a=n?r?.viewSpecs?.[n.kind]?.[o.slot??"page"]:r?.home}=o;if(!a?.length)return[];let s=o.firstHeading??(n||o.blocks?void 0:1),p=Oe(t,e,n,{...o,money:o.money??r?.brand,firstHeading:s});return n&&!p.node?[]:Fe(typeof a[0]?.t=="string"?a:Re(a),p)}function X(t,e,n){let o=!(e.optional||e.control==="boolean"),r=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(s=>U(_(t.tryDefinition(s),s))).join(" or "):n(e.name).label,a={name:e.name,label:r,required:o};switch(e.control){case"text":return{...a,input:e.holds==="duration"?"length of time":e.holds??(e.markdown?"Markdown text":e.long?"long text":e.app?"app address":"text")};case"date":return{...a,input:e.time||e.instant?"date and time":"date"};case"number":return{...a,input:e.amount?"amount":"number",...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max}};case"choice":return{...a,input:"choice",choices:(e.options??[]).map(s=>n(e.name).option(s))};case"boolean":return{...a,input:"yes or no"};case"node":return{...a,input:"record",kinds:e.kinds};case"linked":return{...a,input:"record in another app"};case"file":return{...a,input:e.image?"picture":e.video?"video":"file"};case"repeat":return{...a,input:"how it repeats"};case"list":return{...a,input:`list of ${X(t,e.item,n).input}`};case"group":return{...a,input:"group",fields:e.fields.map(s=>X(t,s,n))};case"variant":return{...a,input:"one of",choices:e.options.map(s=>ue(s.value))};default:return{...a,input:"answer"}}}function Ee(t,e,n){let o=Ie(t,e,n),r=t.schema,a=Be(r,n).filter(p=>p.name!==n.subject?.arg&&!o.has(p.name)),s=me(n);return{act:n.name,title:s,submit:s,fields:a.map(p=>X(r,p,m=>te(r,n,m)))}}function Le(t,e){return{act:e.act.name,title:e.title,submit:e.submit,visitor:e.name,fields:e.fields.map(n=>X(t,n,o=>te(t,e.act,o)))}}function Ze(t,e,n){return t.permittedMutations(e).filter(o=>!o.derived&&!o.subject&&(o.creates??[]).includes(n))}function ze(t,e=""){let n=[`${e}Form "${t.title}" (${t.visitor?`the visitor form ${t.visitor}, running `:""}act ${t.act}), button "${t.submit}":`],o=(r,a)=>{for(let s of r){let p=s.choices?`${s.input}: ${s.choices.join(", ")}`:s.kinds?`${s.input} (${s.kinds.join(" or ")})`:s.input,m=s.min!==void 0||s.max!==void 0?`, ${s.min??"\u2026"} to ${s.max??"\u2026"}`:"";n.push(`${a}- ${s.label}${s.required?" *":""} (${s.name}) \u2014 ${p}${m}`),s.fields&&o(s.fields,`${a} `)}};return o(t.fields,`${e} `),t.fields.length===0&&n.push(`${e} (asks nothing)`),n}function _e(t,e){let n=t.viewSpecs??{};return e.filter(o=>o.cardinality==="one"&&o.replaces==="page"&&(n[o.attach]?.page?.length??0)>0).map(o=>{let r=L(t.schema,o.attach,1);return{at:`views.${o.attach}.page`,says:`The view "${o.name}" replaces ${Qe(r)}'s page, so its page slot is never drawn: leave out replaces to draw the slot under the view, or draw what the slot says in the view.`}})}var Qe=t=>`${/^[aeiou]/i.test(t)?"an":"a"} ${t}`,et=240,Ue=10,tt=1160,nt=40,qe=640,rt=3,st=t=>Math.max(1,Math.floor((Math.min(t,tt)-nt+Ue)/(et+Ue)));function ot(t,e,n,o){let{app:r}=o,a=o.width??1440,s=o.today??t.today()??ce(r.brand?.timeZone),p=t.seenBy(e),m=p.schema,A=p.graph,C=Ve(r,o.views?{views:o.views}:{}),R=typeof n=="string"?n.trim():n.slug,F=typeof n=="string"?C.find(l=>l.slug===R||l.title===R||l.address===R):C.find(l=>l.slug===n.slug&&l.kind===n.kind)??n,x=!F&&typeof n=="string"?A.getNode(R):void 0,G=!F&&!x?/^\/?forms\/(.+)$/.exec(R)?.[1]:void 0,V=G!==void 0?Ge(r,G):void 0;if(V)return{ok:!0,description:it(m,V,a)};if(!F&&!x)return{ok:!1,error:`"${R}" is not a place this app has, nor a record this seat can see.`,places:[...C.map(l=>l.slug),...Object.keys(r.forms??{}).map(l=>`forms/${l}`)]};let c=[],w=r.viewSpecs??{},S=st(a),k=(l,h)=>oe(p,null,l,{app:r,today:s,...h}),f=(l,h,M)=>{let d=m.tryDefinition(l.kind),g=W(d,l);if(h==="name")return{id:l.id,kind:l.kind,title:g,parts:[]};if(w[l.kind]?.[h]){let I=k(l,{slot:h}),[B,...O]=I,y=B?.t==="title"||h==="row"&&B?.t==="headline";return{id:l.id,kind:l.kind,title:y?B.text:g,parts:j(y?O:I,M,`views.${l.kind}.${h}`,` (${l.id})`,y?1:0)}}if(h==="row")return{id:l.id,kind:l.kind,title:g,parts:[]};let u=d?.computed?ne(m,A,l):l,T=z(u,d,{limit:3,said:[g],glance:!0,locale:r.brand?.locale,timeZone:r.brand?.timeZone});return{id:l.id,kind:l.kind,title:g,parts:T.map(I=>({t:"text",text:I.alone}))}};function j(l,h,M,d="",g=0){let $=[];return l.forEach((u,T)=>{let I=`${M}.${T+g}`;switch("problem"in u&&u.problem&&c.push({at:`${I}${d}`,says:u.problem}),u.t){case"title":$.push({t:"heading",level:3,text:u.text});return;case"text":$.push({t:"text",text:u.markdown?Pe(u.text):u.runs?ct(u.runs):u.text,...u.tone?{tone:u.tone}:{}});return;case"badge":$.push({t:"badge",text:u.text});return;case"field":case"image":$.push({t:"field",label:u.label,text:u.text});return;case"progress":$.push({t:"progress",label:u.label,text:u.text});return;case"group":$.push(...j(u.blocks,h,`${I}.group`,d));return;case"when":$.push(...j(u.blocks,h,`${I}.show`,d));return;case"divider":case"figure":return;case"headline":$.push({t:"heading",level:u.level,text:u.text});return;case"number":$.push({t:"figure",text:u.text,...u.label?{label:u.label}:{}});return;case"list":{if(u.failed){$.push({t:"text",text:"\u2014"});return}if(u.members.length===0){u.empty&&$.push({t:"list",as:u.as,columns:1,groups:[],empty:u.empty});return}let B=h+1,O=B>rt?"name":u.as,y=(u.groups??[{value:null,members:u.members}]).map(D=>({..."heading"in D&&D.heading?{heading:D.heading,count:(u.everyGroup?.find(Y=>Y.value===D.value)??D).members.length}:{},items:D.members.map(Y=>f(Y,O,B))}));$.push({t:"list",as:O,columns:O==="card"?S:1,groups:y,...u.more>0?{more:u.more}:{}});return}}}),$}let i=[],v,b,P,N=[];if(x){b="record";let l=m.tryDefinition(x.kind),h=W(l,x);P={slug:x.id,title:h,kind:x.kind,address:xe(m,x.kind,x.id)};let M=w[x.kind]?.page,d=o.views?.find(g=>g.attach===x.kind&&g.cardinality==="one");if(d&&i.push({t:"view",name:d.name,...d.title?{title:d.title}:{},...d.replaces==="page"?{replaces:!0}:{},...d.parts?{parts:d.parts}:{}}),d?.replaces==="page")b=`view:${d.name}`,c.push(..._e(r,[d]));else{M&&i.push(...j(k(x,{slot:"page"}),1,`views.${x.kind}.page`));let g=l?.computed?ne(m,A,x):x;for(let $ of Ce(l,z(g,l,{said:[h],locale:r.brand?.locale,timeZone:r.brand?.timeZone}))){$.title&&i.push({t:"heading",level:2,text:$.title});for(let u of $.fields)i.push({t:"field",label:u.label,text:u.value,...u.long?{long:!0}:{},...u.markdown?{markdown:!0}:{}})}}}else{let l=F;P={slug:l.slug,title:l.title,kind:l.kind,address:l.address};let h=l.lens?Se(r).drawn.find(d=>d.as===l.slug&&(l.kind===null||d.kinds.includes(l.kind))):void 0,M=l.kind!==null&&l.view===void 0&&!h?o.views?.find(d=>d.attach===l.kind&&d.cardinality==="many"&&d.replaces==="page"&&!d.hidden):void 0;if(l.kind!==null&&h?.create!==!1&&l.view===void 0&&!M&&(N=Ze(t,e,l.kind).map(d=>Ee(t,e,d))),l.view!==void 0&&!h){let d=o.views?.find(g=>g.name===l.view);b=`view:${l.view}`,i.push({t:"view",name:l.view,title:d?.title??l.title,...typeof d?.flows=="boolean"?{flows:d.flows}:{},...d?.parts?{parts:d.parts}:{}})}else if(l.kind===null){let d=r.brand,g=d?.name??r.name,$=$e(d)?.light,u=$&&be($)?$:void 0;if(v={name:g,...d?.subtitle&&d.subtitleDrawn!==!1?{subtitle:d.subtitle}:{},...u?{logo:{alt:d?.logoAlt??g,...we(u)?{drawn:"inline SVG"}:{drawn:"image",src:u}}}:{}},r.home)b="blocks",i=j(k(null,{}),0,"views.home");else{b="derived";let T=t.kindsKeptFrom(e),I=new Set([...r.pages?.hide??[],...T,...t.modules.disabledKinds]),B=De(m.kinds,r.pages?.order).filter(O=>!I.has(O));i.push({t:"heading",level:1,text:r.name??"Home"});for(let O of B){let y=A.nodesOfKind(O).filter(D=>H(m.tryDefinition(O),D)).length;y>0&&i.push({t:"text",text:`${y} ${L(m,O,y)}`})}}}else if(h?.lens==="blocks")b="lens:blocks",i=j(k(null,{blocks:h.options.blocks??[]}),0,`lenses.${h.index}.options.blocks`);else if(h?.lens==="columns"){b="lens:columns";let d=h.options.bindings??{};for(let g of Object.keys(d)){let $=d[g]?.column;if(!$)continue;let u=E(m,g,$),T=Z(A.nodesOfKind(g).filter(y=>H(m.tryDefinition(g),y)),h.options.sort,(y,D)=>D==="label"?W(m.tryDefinition(y.kind),y):y[D]);Object.keys(d).length>1&&i.push({t:"heading",level:2,text:L(m,g,2).replace(/^./,y=>y.toUpperCase())}),i.push({t:"text",text:`${T.length} ${L(m,g,T.length)} in columns by ${fe(m.tryDefinition(g),$).toLowerCase()}.`});let I=u.map(y=>({column:y,items:T.filter(D=>q(D,$,u)===y.value).map(D=>f(D,"card",1))})).filter(({column:y,items:D})=>y.value!==null||D.length>0).map(({column:y,items:D})=>({heading:`${y.label} (${D.length})`,items:D}));i.push({t:"list",as:"card",columns:1,groups:I});let B=new Map;for(let y of T)for(let D of re(t,e,y,$,u))B.set(D.to,(B.get(D.to)??new Set).add(`"${D.title}"`));let O=u.filter(y=>y.value!==null&&B.has(y.value)).map(y=>`to ${y.label} by ${[...B.get(y.value)].join(" or ")}`);i.push({t:"text",text:O.length>0?`Moves: ${O.join("; ")}.`:"Moves: none for this seat."})}}else if(h?.lens==="coverage")b="lens:coverage",i=He(m,A,h.options);else if(h){b=`lens:${h.lens}`;let d=h.kinds.flatMap(g=>A.nodesOfKind(g).filter($=>H(m.tryDefinition(g),$)));i.push({t:"text",text:`A ${h.lens} of ${d.length} ${h.kinds.map(g=>L(m,g,d.length)).join(" and ")}.`}),i.push({t:"list",as:"name",columns:1,groups:[{items:d.map(g=>f(g,"name",1))}]})}else if(M)b=`view:${M.name}`,i.push({t:"heading",level:1,text:l.title}),i.push({t:"view",name:M.name,...M.title?{title:M.title}:{},replaces:!0,...M.parts?{parts:M.parts}:{}});else{b="derived";let d=A.nodesOfKind(l.kind).filter(g=>H(m.tryDefinition(l.kind),g));i.push({t:"heading",level:1,text:l.title}),d.length===0?i.push({t:"list",as:"row",columns:1,groups:[],empty:`No ${L(m,l.kind,0)} yet.`}):i.push({t:"list",as:"row",columns:1,groups:[{items:d.map(g=>f(g,"row",1))}]})}}let K=e.kind==="system"?"the system":(e.roles??[]).length>0?(e.roles??[]).join(", "):e.kind,Xe=a<qe?"phone":"wide",ae=P.kind===null?at(m,A):[],le={...v?{masthead:v}:{},...ae.length>0?{facts:ae}:{},place:P,seat:K,width:a,variant:Xe,drawnBy:b,parts:i,...N.length>0?{forms:N}:{},problems:c};return{ok:!0,description:{...le,text:ie(le)}}}function it(t,e,n){let o=[{t:"heading",level:1,text:e.title},...e.intro?[{t:"text",text:e.intro}]:[]],r={place:{slug:`forms/${e.name}`,title:e.title,kind:null,address:`/forms/${e.name}`},seat:`a visitor (${e.role})`,width:n,variant:n<qe?"phone":"wide",drawnBy:"form",parts:o,forms:[Le(t,e)],problems:[]};return{...r,text:ie(r)}}function at(t,e){let n=Me(t,e,null),o=r=>Array.isArray(r)?r.map(o).join(", "):r===null?"nothing":typeof r=="boolean"?r?"yes":"no":typeof r=="object"?r.label:String(r);return[...Ae(t)].map(([r,a])=>{let s=a.label??U(r);return Object.hasOwn(n.values,r)?{name:r,label:s,value:o(n.values[r])}:{name:r,label:s,refused:n.refused[r]??"it could not be worked out"}})}function L(t,e,n){let o=t.tryDefinition(e);if(n===1)return o?.noun??e;let r=pe(t,e);return de(r)}function ie(t){let e=[`${t.place.title} (${t.place.address}) \u2014 as ${t.seat}, ${t.width} wide (${t.variant}).`],n=t.masthead;n&&e.push(`Masthead: ${n.logo?`the logo ("${n.logo.alt}", ${n.logo.drawn==="image"?n.logo.src:"inline SVG"}), `:""}${n.name}${n.subtitle?` \u2014 ${n.subtitle}`:""}`);let o=(r,a)=>{for(let s of r)switch(s.t){case"heading":e.push(`${a}${"#".repeat(s.level)} ${s.text}`);break;case"text":e.push(`${a}${s.text}`);break;case"badge":e.push(`${a}[${s.text}]`);break;case"field":case"progress":e.push(`${a}${s.label}: ${s.text}`);break;case"figure":e.push(`${a}${s.text}${s.label?` \u2014 ${s.label}`:""}`);break;case"list":if(s.groups.length===0){s.empty&&e.push(`${a}(${s.empty})`);break}for(let p of s.groups){p.heading&&e.push(`${a}${p.heading}${p.count!==void 0?` (${p.count})`:""}:`);for(let m of p.items)e.push(`${a}${p.heading?" ":""}- ${m.title}`),o(m.parts,`${a}${p.heading?" ":" "}`)}s.as==="card"&&s.columns>1&&e.push(`${a}(cards, ${s.columns} across)`),s.more&&e.push(`${a}and ${s.more} more`);break;case"view":e.push(`${a}[the view "${s.title??s.name}"${s.replaces?", in place of the page":""}${s.flows===!0?", flowing with the page":s.flows===!1?", in a frame of its own":""}]`),s.parts&&o(s.parts,`${a} `);break}};o(t.parts,"");for(let r of t.forms??[])e.push(...ze(r));if(t.facts){e.push("Facts of the whole graph (what fact('<name>') reads):");for(let r of t.facts)e.push(`- ${r.label} (${r.name}): ${r.value??`not worked out \u2014 ${r.refused}`}`)}if(t.videos&&t.videos.length>0){e.push("Videos:");for(let r of t.videos)e.push(`- ${lt(r)}`)}if(t.problems.length>0){e.push("Problems:");for(let r of t.problems)e.push(`- ${r.at}: ${r.says}`)}return e.join(`
|
|
2
2
|
`)}function lt(t){let e=t.autoplay?"plays as a background, muted and looping, with no controls":"plays with the browser's controls";return`${t.text} (${t.field} of ${t.record}): ${t.source}${t.duration!==void 0?`, ${Math.round(t.duration)} s`:""}, ${t.poster?"with a poster":"no poster"}; ${e}${t.cover?", filling its box":""}; ${t.playable?"playable":`not playable: ${t.why??"it is not a video a browser plays"}`}.`}function ct(t){return t.map((e,n)=>(n===0?"":e.field===void 0&&t[n-1].field===void 0?" \xB7 ":" ")+e.text).join("")}export{E as a,q as b,re as c,Ne as d,Ke as e,Te as f,We as g,oe as h,_e as i,ot as j,ie as k};
|