graview 0.1.47 → 0.1.48
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.SWWAEOZ7.js → chunk.2GLJH253.js} +1 -1
- package/dist/preview/{chunk.ETPKXUAN.js → chunk.2QNGGF55.js} +1 -1
- package/dist/preview/{chunk.O4WEJ47H.js → chunk.2UIUMG23.js} +3 -3
- package/dist/preview/{chunk.IXOQQBJE.js → chunk.2VTMTW7K.js} +1 -1
- package/dist/preview/chunk.37CJSWLL.js +1 -0
- package/dist/preview/{chunk.RG6WNOBW.js → chunk.3BAHAK6W.js} +1 -1
- package/dist/preview/{chunk.T42S2WMB.js → chunk.3RP3N2JP.js} +1 -1
- package/dist/preview/{chunk.C3NHNYA6.js → chunk.3UD7GG5B.js} +1 -1
- package/dist/preview/{chunk.L4YNDNX7.js → chunk.44G5A53D.js} +1 -1
- package/dist/preview/chunk.4GQA3AJU.js +1 -0
- package/dist/preview/{chunk.QGG6ZRJ5.js → chunk.4KX53HCV.js} +2 -2
- package/dist/preview/chunk.4TJOS4C7.js +5 -0
- package/dist/preview/{chunk.FWSCBHZ5.js → chunk.4VW6THJF.js} +1 -1
- package/dist/preview/{chunk.MCB26YCQ.js → chunk.5IM645XQ.js} +1 -1
- package/dist/preview/{chunk.RBJAPOZ3.js → chunk.5IPH2SCE.js} +1 -1
- package/dist/preview/{chunk.TBQOSI4J.js → chunk.5Y3Q7ONN.js} +1 -1
- package/dist/preview/chunk.664PBQAQ.js +1 -0
- package/dist/preview/{chunk.2MCZ4CU5.js → chunk.6TKILWRM.js} +1 -1
- package/dist/preview/{chunk.DQS7D2W2.js → chunk.6VAFNCR4.js} +1 -1
- package/dist/preview/chunk.72OZLWJL.js +1 -0
- package/dist/preview/chunk.72W6S746.js +1 -0
- package/dist/preview/{chunk.OONCUAOH.js → chunk.76W2FXEC.js} +1 -1
- package/dist/preview/{chunk.64WM4IBI.js → chunk.7FRPNQU4.js} +1 -1
- package/dist/preview/chunk.7LL7OSBY.js +6 -0
- package/dist/preview/chunk.7QZYFLBS.js +1 -0
- package/dist/preview/{chunk.6RY6OSE6.js → chunk.7VT3TRHR.js} +1 -1
- package/dist/preview/{chunk.W6COSBO2.js → chunk.B2IIEVBF.js} +2 -2
- package/dist/preview/{chunk.IQ2HKGJS.js → chunk.BDHKWVNX.js} +1 -1
- package/dist/preview/{chunk.57ZSMK3R.js → chunk.CH5ROV7N.js} +1 -1
- package/dist/preview/{chunk.RZF3QM4E.js → chunk.CJ23XTSW.js} +1 -1
- package/dist/preview/{chunk.VAFSSSSI.js → chunk.D5ETRTAF.js} +1 -1
- package/dist/preview/{chunk.47RTA6M3.js → chunk.DAUC2DFY.js} +1 -1
- package/dist/preview/{chunk.63JLXGYX.js → chunk.DFK2NA6L.js} +1 -1
- package/dist/preview/{chunk.7N2GXZYI.js → chunk.DHAK6PPX.js} +2 -2
- package/dist/preview/{chunk.NFIGGSMJ.js → chunk.DOBQ4LO4.js} +1 -1
- package/dist/preview/{chunk.H7KCWCB4.js → chunk.DPHTUTOS.js} +1 -1
- package/dist/preview/chunk.DQ7M3LFV.js +1 -0
- package/dist/preview/{chunk.63MS2LOP.js → chunk.DUWYF7BO.js} +1 -1
- package/dist/preview/{chunk.TCXKPILZ.js → chunk.DWPU56S5.js} +1 -1
- package/dist/preview/{chunk.WBHM5I3I.js → chunk.E5GM2SMO.js} +1 -1
- package/dist/preview/{chunk.N7JT6MG2.js → chunk.EMQ5POGB.js} +1 -1
- package/dist/preview/{chunk.SD6N4DGF.js → chunk.ENPCLMP2.js} +1 -1
- package/dist/preview/chunk.EXEZBZGW.js +1 -0
- package/dist/preview/{chunk.CMOXKRWT.js → chunk.EZJNUFNQ.js} +1 -1
- package/dist/preview/{chunk.C44MC5X3.js → chunk.FOP5RBGF.js} +1 -1
- package/dist/preview/chunk.FPYL6REZ.js +1 -0
- package/dist/preview/chunk.FQYOTK34.js +1 -0
- package/dist/preview/chunk.G7WDMUDV.js +1 -0
- package/dist/preview/{chunk.VSNHCGKC.js → chunk.GACKGEUY.js} +1 -1
- package/dist/preview/chunk.GH2SWMCW.js +1 -0
- package/dist/preview/chunk.GNBN3BK7.js +1 -0
- package/dist/preview/{chunk.KSM6NVAT.js → chunk.GT3F6FQ6.js} +1 -1
- package/dist/preview/chunk.GTPC6JOW.js +2 -0
- package/dist/preview/{chunk.IROYMLER.js → chunk.GUMJEVVP.js} +1 -1
- package/dist/preview/{chunk.3LDYUO77.js → chunk.GVNYPFIM.js} +1 -1
- package/dist/preview/{chunk.EYI3Y2DY.js → chunk.HC5N3CT2.js} +1 -1
- package/dist/preview/{chunk.6TIEX67B.js → chunk.HDE2MGGU.js} +1 -1
- package/dist/preview/{chunk.6YD2DLIC.js → chunk.HG4DDNPG.js} +1 -1
- package/dist/preview/{chunk.MBETS27C.js → chunk.HKA5T7DL.js} +1 -1
- package/dist/preview/{chunk.7ELB37JU.js → chunk.I5TOMBIF.js} +1 -1
- package/dist/preview/{chunk.76GF5US2.js → chunk.I7QIHN66.js} +1 -1
- package/dist/preview/chunk.ILZYRJDS.js +1 -0
- package/dist/preview/{chunk.QZEZHCOI.js → chunk.IRHSTUZM.js} +1 -1
- package/dist/preview/{chunk.PYE3WZM7.js → chunk.J2V76Z6G.js} +1 -1
- package/dist/preview/{chunk.WHEUTAXA.js → chunk.J6ANRF6E.js} +1 -1
- package/dist/preview/{chunk.Y4ZUJUUT.js → chunk.KA44WNB4.js} +1 -1
- package/dist/preview/chunk.KTFUVR4V.js +2 -0
- package/dist/preview/{chunk.BNPQUI3F.js → chunk.KVEDIBXS.js} +1 -1
- package/dist/preview/chunk.KVJFY7N5.js +2 -0
- package/dist/preview/{chunk.F67F6QZ6.js → chunk.KW65F4WA.js} +1 -1
- package/dist/preview/chunk.LGSFGNWE.js +1 -0
- package/dist/preview/{chunk.VXVWUIGO.js → chunk.LNON6P7K.js} +1 -1
- package/dist/preview/{chunk.2W22AWSL.js → chunk.LPD74WBI.js} +1 -1
- package/dist/preview/{chunk.SZR3Z43B.js → chunk.LXCJVZF3.js} +1 -1
- package/dist/preview/{chunk.Q7RQC3F7.js → chunk.MAFFUPCR.js} +1 -1
- package/dist/preview/chunk.MTXEURFE.js +1 -0
- package/dist/preview/{chunk.DNROW6LX.js → chunk.MVRG75ZD.js} +1 -1
- package/dist/preview/{chunk.5TM5VA2H.js → chunk.MVSV7T6E.js} +1 -1
- package/dist/preview/{chunk.4YXJPKXD.js → chunk.MZLWLIKR.js} +1 -1
- package/dist/preview/chunk.N4M54YK6.js +1 -0
- package/dist/preview/{chunk.KSXB4LDF.js → chunk.NB6WN4DO.js} +1 -1
- package/dist/preview/{chunk.UHX4WTM7.js → chunk.NFDLCUCC.js} +1 -1
- package/dist/preview/{chunk.AGIO2GRV.js → chunk.NLBIX7LH.js} +1 -1
- package/dist/preview/{chunk.FOQ27RAR.js → chunk.NQZ73QV7.js} +1 -1
- package/dist/preview/chunk.NR5ODXMO.js +1 -0
- package/dist/preview/{chunk.VC3UGFHY.js → chunk.NTLHEHOM.js} +1 -1
- package/dist/preview/{chunk.TJEV5ZAM.js → chunk.NWT5FPEK.js} +2 -2
- package/dist/preview/chunk.NX7IIZLO.js +1 -0
- package/dist/preview/{chunk.UKAPFIPJ.js → chunk.O45VO36H.js} +1 -1
- package/dist/preview/{chunk.OCTOGZVJ.js → chunk.OAIWGWGU.js} +2 -2
- package/dist/preview/{chunk.PC6PID5X.js → chunk.ODRL5OWR.js} +1 -1
- package/dist/preview/{chunk.24OZGU7J.js → chunk.OFRGDJYX.js} +1 -1
- package/dist/preview/chunk.OVO6L5IP.js +88 -0
- package/dist/preview/{chunk.RUPRZDN3.js → chunk.OZGETOTK.js} +1 -1
- package/dist/preview/{chunk.ZCYGUP3I.js → chunk.P6FQAILU.js} +1 -1
- package/dist/preview/{chunk.5M4TMZXC.js → chunk.PCEYZQAW.js} +1 -1
- package/dist/preview/{chunk.IPAZOKMQ.js → chunk.PMJUGHW4.js} +1 -1
- package/dist/preview/{chunk.RNEJYIQ7.js → chunk.PPRSGM64.js} +1 -1
- package/dist/preview/chunk.PQVUQVRL.js +1 -0
- package/dist/preview/{chunk.NEEOVRB7.js → chunk.PTXLOFQW.js} +1 -1
- package/dist/preview/{chunk.P4KCZRIG.js → chunk.PVEPU6EA.js} +1 -1
- package/dist/preview/chunk.QGE6YKSU.js +1 -0
- package/dist/preview/{chunk.Z6TMIAAB.js → chunk.QII2C5OV.js} +1 -1
- package/dist/preview/{chunk.FOJDVK2Q.js → chunk.QO7MDWID.js} +1 -1
- package/dist/preview/{chunk.RVJXO5GG.js → chunk.QPICKSSM.js} +1 -1
- package/dist/preview/{chunk.KRGM25HF.js → chunk.QQCDCRR2.js} +1 -1
- package/dist/preview/{chunk.F2VMMCVK.js → chunk.QQTRAY5W.js} +1 -1
- package/dist/preview/{chunk.ZWVN75EY.js → chunk.RLXKDXPB.js} +1 -1
- package/dist/preview/{chunk.5AGW4NRZ.js → chunk.RQBEQYB2.js} +1 -1
- package/dist/preview/chunk.SA34Y3X5.js +2 -0
- package/dist/preview/chunk.SAHNXAV3.js +1 -0
- package/dist/preview/{chunk.52VGZBO3.js → chunk.SFAAM4KE.js} +1 -1
- package/dist/preview/{chunk.4YS7547F.js → chunk.SKJJBLXF.js} +1 -1
- package/dist/preview/chunk.SUPWMV2F.js +1 -0
- package/dist/preview/{chunk.WJS6P7GI.js → chunk.TBRJOKIK.js} +1 -1
- package/dist/preview/{chunk.S5IQFZ5Z.js → chunk.TKMQROXF.js} +1 -1
- package/dist/preview/chunk.TMDI7KRS.js +18 -0
- package/dist/preview/chunk.TPG6IY4M.js +1 -0
- package/dist/preview/{chunk.PKUDIWIF.js → chunk.UGJSMNVO.js} +1 -1
- package/dist/preview/{chunk.EUPSAYEI.js → chunk.UJRBOUGC.js} +1 -1
- package/dist/preview/{chunk.IJNOT4S4.js → chunk.V2GSBYDK.js} +2 -2
- package/dist/preview/chunk.V3N34DSU.js +1 -0
- package/dist/preview/{chunk.ZQY6ODXC.js → chunk.V4BCB7N2.js} +1 -1
- package/dist/preview/{chunk.CTQULC5F.js → chunk.VQAQQW4Q.js} +1 -1
- package/dist/preview/{chunk.A7RKTSOH.js → chunk.W72TTRLX.js} +2 -2
- package/dist/preview/{chunk.IKX4VDTW.js → chunk.X7JMJSLU.js} +1 -1
- package/dist/preview/{chunk.GCKZ2YRJ.js → chunk.X7N3JUO4.js} +2 -2
- package/dist/preview/chunk.XOZU4OFA.js +1 -0
- package/dist/preview/{chunk.O2WWYZI7.js → chunk.XTMOFRHL.js} +1 -1
- package/dist/preview/{chunk.V7XHNRQM.js → chunk.Y4MQGEUS.js} +2 -2
- package/dist/preview/{chunk.MF73YBJL.js → chunk.YDL5BSTG.js} +1 -1
- package/dist/preview/chunk.YEVA72L2.js +1 -0
- package/dist/preview/chunk.YLWON7X3.js +1 -0
- package/dist/preview/chunk.YUH43J2K.js +1 -0
- package/dist/preview/{chunk.UV3YU64Z.js → chunk.YVOABA2U.js} +1 -1
- package/dist/preview/{chunk.R6V37SR7.js → chunk.ZH4NWRWB.js} +1 -1
- package/dist/preview/chunk.ZXZNAG35.js +1 -0
- package/dist/preview/index.html +50 -49
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.2CLANQHZ.js +0 -1
- package/dist/preview/chunk.2L3VFGHX.js +0 -1
- package/dist/preview/chunk.4OGOTHRD.js +0 -1
- package/dist/preview/chunk.5G53VDOC.js +0 -1
- package/dist/preview/chunk.6QVXXQCW.js +0 -2
- package/dist/preview/chunk.7NNI7YH4.js +0 -1
- package/dist/preview/chunk.A3RNSSUQ.js +0 -1
- package/dist/preview/chunk.AS4CQBOQ.js +0 -5
- package/dist/preview/chunk.AWXDZUKH.js +0 -1
- package/dist/preview/chunk.AYA7SYIU.js +0 -1
- package/dist/preview/chunk.BBS5C2BY.js +0 -1
- package/dist/preview/chunk.COYLGLTI.js +0 -1
- package/dist/preview/chunk.DX357TZ3.js +0 -2
- package/dist/preview/chunk.GQHAAKJG.js +0 -1
- package/dist/preview/chunk.HDRD33II.js +0 -1
- package/dist/preview/chunk.I6JLOEJU.js +0 -1
- package/dist/preview/chunk.ISNEX772.js +0 -1
- package/dist/preview/chunk.IW7YFPGG.js +0 -1
- package/dist/preview/chunk.IYIN6VSN.js +0 -1
- package/dist/preview/chunk.JUWWRRHA.js +0 -1
- package/dist/preview/chunk.K2NCGPCL.js +0 -1
- package/dist/preview/chunk.KWQ7QOHD.js +0 -2
- package/dist/preview/chunk.MCCUVGTE.js +0 -1
- package/dist/preview/chunk.NDWW5EER.js +0 -1
- package/dist/preview/chunk.OJGUIWDD.js +0 -88
- package/dist/preview/chunk.PBKO5CKD.js +0 -1
- package/dist/preview/chunk.QGVLJTZS.js +0 -1
- package/dist/preview/chunk.RX2M4C5W.js +0 -2
- package/dist/preview/chunk.SGKK4UKP.js +0 -1
- package/dist/preview/chunk.T7RJCEJB.js +0 -18
- package/dist/preview/chunk.VW2VCPJX.js +0 -1
- package/dist/preview/chunk.WAB7UDHU.js +0 -1
- package/dist/preview/chunk.XYEFZ2OO.js +0 -1
- package/dist/preview/chunk.YHH4TWZ2.js +0 -1
- package/dist/preview/chunk.YVONXFKE.js +0 -6
- package/dist/preview/chunk.ZIEHF67C.js +0 -1
- package/dist/preview/chunk.ZL7ZBJUU.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Se,b as Ke,c as Me,d as le,e as R,f as pe,h as Te}from"./chunk.HG4DDNPG.js";import{h as Ge,i as Ce,j as _e}from"./chunk.X7JMJSLU.js";import{a as oe,b as se,c as H,d as Pe,e as Y,g as ee,h as Ne}from"./chunk.5Y3Q7ONN.js";import{c as Fe,h as z,i as De,j as de}from"./chunk.KTFUVR4V.js";import{A as xe,Aa as Ee,Ha as Ae,Ia as Q,Ja as ae,Mb as ce,Nb as Re,b as U,c as B,e as je,f as Oe,g as q,h as O,k as C,l as J,m as _,n as ve,o as L,p as K,r as $,s as X,t as x,u as E,v as V,w as T,x as n,y as M,z as W}from"./chunk.4TJOS4C7.js";var rn=e=>Object.entries(e).map(([s,r])=>[s,Object.keys(Q(r?.edges))]),fe=(e,s)=>Re(e,rn(s));var ge="graview-document",ze=1,ye=256*1024,ne=64*1024,ue=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,me=/^[a-z][A-Za-z0-9]*$/,an=new Set(["id","kind"]),cn=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,dn=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"];function ln(){let e=k=>k in Object.prototype,s=W(k=>!e(k),"every object already has this name \u2014 choose another"),r=(k,N)=>[...k===void 0?[]:[Oe(k)],...N===void 0?[]:[je(N)]],t=(k,N)=>O().check(...r(k,N)),a=(k,N,sn)=>K(k).check(...r(N,sn)),d=k=>O().check(q(ue,`${k} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),u=O().check(q(cn,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),s),f=O().check(q(me,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),W(k=>!an.has(k),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),s),h=t(1,500),i=t(1,2e3),o=t(1,300),p=$({type:V(dn),required:n(_()),description:n(h),label:n(t(1,60)),options:n(a(t(1,80),1,100)),of:n(V(["string","number","date","image","video","file"])),default:n(L()),unit:n(t(void 0,12)),format:n(V(["money","percent","duration","markdown"])),min:n(C()),max:n(C()),step:n(C()),renamedFrom:n(O().check(q(me))),repeats:n(_())}).check(xe((k,N)=>{k.type==="enum"&&!k.options&&N.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),k.type!=="enum"&&k.options&&N.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]}),k.type!=="list"&&k.of&&N.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),k.repeats&&k.type!=="date"&&k.type!=="datetime"&&N.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),w=O().check(q(new RegExp(`${ue.source}|${Ee.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),m=$({to:x([a(w,1),T("*")]),cardinality:n(V(["one","many"])),description:n(h),inverse:n(t(1,80)),appendOnly:n(_()),renamedFrom:n(O()),tidying:n(T("never"))}),l=x([i,$({expr:i,label:n(t(1,60)),description:n(h)})]),c=$({noun:n(t(1,40)),plural:n(t(1,40)),description:n(h),fields:E(f,p).check(W(k=>Object.keys(k).length>0,"a kind has at least one field")),label:n(o),describe:n(o),lifecycle:n($({field:f,retired:a(x([O(),C(),_()]),1)})),figure:n(t(void 0,2e4)),glance:n(a(f,1,20)),page:n($({fields:n(a(f,1,40)),groups:n(a($({title:t(1,60),fields:a(f,1,40)}),1,12))})),edges:n(E(u,m)),computed:n(E(O(),l).check(W(k=>Object.keys(k).length<=20,"a kind works out at most 20 computed fields"))),fieldRoles:n(E(O(),O())),renamedFrom:n(O().check(q(ue))),people:n(_()),archives:n(T(!1)),tidying:n(V(["never","no-links"]))}),j=x([O(),C(),_(),ve(),K(L()),$({expr:i})]),y=O().check(q(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),S=x([$({create:d("kind"),as:n(O().check(q(me))),set:n(E(f,j))}),$({set:E(f,j),target:n(y)}),$({connect:u,from:y,to:y}),$({sever:u,from:y,to:y}),$({remove:y})]),A=$({title:n(t(1,80)),description:n(h),fromTheOtherEnd:n(t(1,80)),on:n(x([d("kind"),a(d("kind"),1)])),creates:n(d("kind")),sets:n(E(f,j)),writes:n(a(f,1)),connects:n(u),severs:n(u),setsOther:n(E(f,j)),replaces:n(x([T(!0),a(u,1,10)])),removes:n(T(!0)),args:n(E(f,p)),effects:n(a(S,1,20)),allowedWhen:n(i),refusal:n(o),destructive:n(_())}),b=$({act:d("act"),label:n(t(1,80)),args:n(E(O(),j))}),G=$({title:n(t(1,120)),description:n(h),over:x([T("graph"),d("kind")]),when:n(i),require:i,says:n(o),repairs:n(a(b,void 0,10))}),F=$({roles:x([a(d("role"),1),T("*")]),mutations:x([a(d("act"),1),T("*")]),kinds:n(x([K(d("kind")),T("*")])),describe:n(h),self:n(_()),ownEnd:n(_())}),g=n(a(d("field"),1)),v=$({roles:x([a(d("role"),1),T("*")]),kinds:a(d("kind"),1),own:n(_()),via:n(u),fields:g,hide:g}),D=$({grants:K(F),sees:n(K(v))}),te=$({accent:n(O().check(q(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),name:n(t(1,60)),currency:n(O().check(q(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:n(t(2,35)),timeZone:n(t(1,64)),logo:n(x([t(1,ne),$({src:t(1,ne),alt:n(t(1,120))}),$({light:t(1,ne),dark:n(t(1,ne)),alt:n(t(1,120)),darkFallback:n(T("invert"))})])),favicon:n(x([t(1,ne),$({emoji:O()})])),typography:n($({display:n(t(1,200)),body:n(t(1,200)),mono:n(t(1,200))})),shape:n($({radius:n(C().check(B(0),U(32))),density:n(C().check(B(.75),U(1.5)))})),accents:n(E(O(),C().check(B(0),U(360)))),scheme:n(V(["light","dark","auto"])),subtitle:n(T(!1))}),I=E(O(),L()),Z=x([t(1,120),$({by:t(1,120),direction:n(V(["asc","desc"]))})]),$e=C().check(J(),B(1),U(9999)),Xe=X({create:n(_()),options:n(X({sort:n(Z),columnSort:n(Z),search:n(a(t(1,120),void 0,40)),filters:n(a(t(1,120),void 0,40)),horizon:n(x([C().check(J(),B(1),U(200)),X({years:C().check(J(),B(1),U(200)),title:t(1,80),from:n($e),to:n($e)})]))}))}),Qe=$({card:n(K(L())),row:n(K(L())),page:n(K(L()))}),en=()=>{let k=n(V(["asc","desc"]));return x([t(1,120),$({by:t(1,120),direction:k,then:n(x([t(1,120),$({by:t(1,120),direction:k})]))})])},nn=()=>x([t(1,120),$({by:t(1,120),order:n(a(t(1,80),void 0,40)),closed:n(a(t(1,80),void 0,40))})]),we=X({order:n(K(O())),hide:n(K(O())),first:n(O()),primary:n(a(t(1,80),void 0,40)),scene:n(t(1,40)),pages:n(t(1,40)),lists:n(E(O(),$({filters:n(a(t(1,120),void 0,40)),sort:n(en()),group:n(nn())})))}),tn=$({act:d("act"),title:n(t(1,80)),intro:n(h),fields:n(a(f,1,40)),say:n(h),submit:n(t(1,80)),role:n(d("role"))}),on=$({$schema:n(O()),format:T(ge),formatVersion:T(ze),name:t(1,80),description:n(h),version:n(C().check(J(),B(1))),kinds:E(d("kind"),c).check(W(k=>Object.keys(k).length>0,"a document declares at least one kind"),W(k=>Object.keys(k).length<=40,"a document declares at most 40 kinds")),computed:n(E(O(),l)),acts:n(E(d("act"),A)),rules:n(E(d("rule"),G)),roles:n(K(d("role"))),policy:n(D),modules:n(I),lenses:n(K(Xe)),pages:n(we),views:n(E(O(),x([Qe,K(L())]))),brand:n(te),settings:n(K(I)),migrations:n(K(I)),connections:n(E(d("connection"),I)),forms:n(E(d("form"),tn))});return{FieldSpec:p,EdgeSpec:m,ComputedSpec:l,KindSpec:c,ValueSpec:j,EffectSpec:S,ActSpec:A,RepairSpec:b,RuleSpec:G,GrantSpec:F,SightSpec:v,PolicySpec:D,BrandSpec:te,PagesSpec:we,DocumentSpec:on}}var pn,P=()=>pn??=ln(),vn=M(()=>P().FieldSpec),xn=M(()=>P().EdgeSpec),En=M(()=>P().ComputedSpec),An=M(()=>P().KindSpec),Rn=M(()=>P().ValueSpec),Fn=M(()=>P().EffectSpec),Dn=M(()=>P().ActSpec),Kn=M(()=>P().RepairSpec),Mn=M(()=>P().RuleSpec),Tn=M(()=>P().GrantSpec),Pn=M(()=>P().SightSpec),Gn=M(()=>P().PolicySpec),Cn=M(()=>P().BrandSpec),_n=M(()=>P().PagesSpec),qe=M(()=>P().DocumentSpec);var fn={};function Ie(e,s=fn,r=ze){let{document:t,respelled:a}=Se(e),d=a.length>0?{respelled:a}:{};if(!t||typeof t!="object"||Array.isArray(t))return{document:t};let u=t;if(u.format!==ge||typeof u.formatVersion!="number"||u.formatVersion>=r)return{document:t,...d};let f=u.formatVersion,h=structuredClone(u);for(let i=f;i<r;i++){let o=s[i];if(!o)throw new Error(`there is no upgrade from format ${i} to ${i+1}`);h={...o(h),formatVersion:i+1}}return{document:h,from:f,...d}}function Ve(e,s,r){let t=Object.keys(e).filter(f=>e[f].edges?.[s]!==void 0);if(t.length===0)return;let a=t.map(f=>e[f].edges[s].to),d=a.some(f=>f==="*")?"*":[...new Set(a.flatMap(f=>f))];if(r.length===0||r.some(f=>t.includes(f)))return{reversed:!1,kinds:d};let u=t.filter(f=>{let h=e[f].edges[s].to;return h==="*"||r.every(i=>h.includes(i))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:d}}var Ue=(e,s)=>{let r=e?.fields[s];return r!==void 0&&(r.type==="duration"||(r.type==="number"||r.type==="integer")&&r.format==="duration")};function Be(e,s,r,t){if(t==="out"){let a=e[s]?.edges?.[r]?.to;return a===void 0?[]:a==="*"?Object.keys(e):a}return Object.entries(e).filter(([,a])=>{let d=a.edges?.[r]?.to;return d!==void 0&&(d==="*"||d.includes(s))}).map(([a])=>a)}function he(e,s,r){if(r.t==="ident")return e[s]?.edges?.[r.name]?Be(e,s,r.name,"out"):void 0;if(r.t==="where")return he(e,s,r.set);if(r.t==="call"&&(r.fn==="out"||r.fn==="in")&&r.args[0]?.t==="lit"&&typeof r.args[0].value=="string")return Be(e,s,r.args[0].value,r.fn)}var Le=(e,s,r)=>{let t=s.filter(a=>e[a]?.fields[r]!==void 0);return t.length>0&&t.every(a=>Ue(e[a],r))};function We(e,s,r){let t=e.kinds,a=t[s],d=new Map(r),u=new Map,f=(i,o)=>{if(o>8)return!1;switch(i.t){case"ident":return Ue(a,i.name)||h(i.name,o+1);case"member":{let p=he(t,s,i.object);return p!==void 0&&Le(t,p,i.name)}case"call":{if(i.fn!=="sum"&&i.fn!=="min"&&i.fn!=="max")return!1;let[p,w]=i.args,m=p&&he(t,s,p);return m!==void 0&&w?.t==="ident"&&Le(t,m,w.name)}case"binary":return(i.op==="+"||i.op==="-")&&f(i.left,o)&&f(i.right,o);case"unary":return i.op==="-"&&f(i.operand,o);default:return!1}},h=(i,o)=>{if(a?.computed?.[i]===void 0)return!1;if(u.has(i))return u.get(i);u.set(i,!1);let p=d.get(i),w=p!==void 0&&f(p,o);return u.set(i,w),w};return r.map(([i])=>i).filter(i=>h(i,0))}function Ze(e,s,r=`kinds.${e}.page`){let t=s.page;if(!t)return[];let a=[],d=[...Object.keys(s.fields),...Object.keys(s.computed??{})],u=new Set,f=(i,o)=>{d.includes(i)?u.has(i)&&a.push(z("page-field-twice",o,`"${i}" is on ${e}'s page twice; name each field once`)):a.push(z("page-field",o,`${e}'s page is to show "${i}", and ${e} has no field or computed field called that`,`use one of: ${d.join(", ")}`)),u.add(i)};(t.fields??[]).forEach((i,o)=>f(i,`${r}.fields.${o}`));let h=new Set;return(t.groups??[]).forEach((i,o)=>{let p=i.title.trim().toLowerCase();h.has(p)&&a.push(z("page-group-twice",`${r}.groups.${o}.title`,`${e}'s page has two groups called "${i.title}"; give each its own title`)),h.add(p),i.fields.forEach((w,m)=>f(w,`${r}.groups.${o}.fields.${m}`))}),a}function He(e,s=[]){let r=Object.keys(e.fields),t=[...e.page?.fields??[],...(e.page?.groups??[]).flatMap(f=>f.fields)].filter(f=>Object.hasOwn(e.fields,f)),a=[...new Set([...t,...r])],d=f=>!!e.fields[f].required&&e.fields[f].default===void 0,u=s.filter(f=>Object.hasOwn(e.fields,f));return[...new Set([...u,...a.filter(d),...a])]}var un=new Set(["subject","now","today","me"]);function mn(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>ye)return{findings:[z("too-large","",`a document may be at most ${ye/1024} KB`)]};if(typeof e=="string")try{e=JSON.parse(e)}catch(t){return{findings:[z("not-json","",`this is not JSON: ${t.message}`)]}}try{e=Ie(e).document}catch(t){return{findings:[z("format","formatVersion",t.message)]}}let s=qe.safeParse(e);if(!s.success)return{findings:s.error.issues.map(t=>{let a=t.path.map(String).join(".");if(t.code==="unrecognized_keys")return z("unknown-key",a,`${t.keys.map(d=>`"${d}"`).join(", ")} ${t.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(t.code==="invalid_union"&&/\.effects\.\d+$/.test(a))return z("effect-shape",a,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(t.code==="invalid_key"){let d=t.issues?.[0]?.message;return z("shape",a,`the name "${String(t.path.at(-1))}" is not allowed here${d?`: ${d}`:""}`)}return z("shape",a,t.message)})};let r=s.data;return{document:r,findings:gn(r)}}var re=e=>[e??[]].flat();function Ye(e){let s=new Map;for(let[r,t]of Object.entries(e.kinds))for(let[a,d]of Object.entries(Q(t.edges))){let u=s.get(a);s.set(a,{name:a,from:[...u?.from??[],r],to:d.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...d.to])],cardinality:d.cardinality??"many"})}return s}function ut(e){let s=new Map;for(let[t,a]of Object.entries(e.kinds)){let d=ee(a),u=ae(a.edges);s.set(t,{fields:new Set([...Object.keys(a.fields),...u.keys()]),edges:new Map(Object.entries(Q(a.edges)).map(([f,h])=>[f,h.cardinality??"many"])),...d?{computed:d}:{},...u.size>0?{linked:u}:{}})}let r=ee(e);return r&&s.set(Fe,{computed:r}),s}function Je(e,s){let r=[],t=re(e.on),a=(d,u)=>{let f=Ve(s.kinds,d,t)?.reversed===!0,[h,i]=f?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:d,from:h,to:i}:{sever:d,from:h,to:i}};if(e.creates){let d=s.kinds[e.creates],u={};for(let f of Object.keys(d?.fields??{}))u[f]=`$${f}`;for(let f of e.effects??[])"set"in f&&!("create"in f)&&R(f.target)==="new"&&Object.assign(u,f.set);r.push({create:e.creates,as:"new",set:u})}return e.sets&&r.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&r.push({set:Object.fromEntries(e.writes.map(d=>[d,`$${d}`]))}),e.connects&&(e.replaces&&r.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),r.push(a(e.connects,"connect"))),e.severs&&r.push(a(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&r.push({set:e.setsOther,target:"$to"}),e.removes&&r.push({remove:"$subject"}),e.effects&&r.push(...e.effects.filter(d=>!(e.creates&&"set"in d&&!("create"in d)&&R(d.target)==="new"))),r}function be(e,s,r){try{let t=H(e),a=oe(t);for(let d of a.unknownFunctions)r.push(z("unknown-function",s,`"${d}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));return t}catch(t){if(t instanceof se){r.push(z("expression",s,t.sentence+` (at character ${t.at+1})`));return}throw t}}function ke(e,s,r){try{return Y(e)}catch(t){if(t instanceof Pe||t instanceof se){r.push(z("template",s,(t instanceof se,t.sentence)));return}throw t}}function gn(e){let s=[],r=new Set(Object.keys(e.kinds)),t=Ye(e),a=e.acts??{},d=new Set(e.roles??[]),u=(i,o)=>ae(e.kinds[i]?.edges).has(o),f=i=>Object.keys(e.kinds).some(o=>u(o,i));for(let[i,o]of Object.entries(e.kinds)){let p=`kinds.${i}`;for(let[m,l]of Object.entries(o.edges??{})){if(!Ae(l)&&l.to!=="*")for(let c of l.to)r.has(c)||s.push(z("edge-target",`${p}.edges.${m}.to`,`"${c}" is not a kind this document declares`));o.fields[m]&&s.push(z("edge-field-clash",`${p}.edges.${m}`,`"${m}" is both a field and a relation of ${i}`,"rename one of them"))}o.lifecycle&&!o.fields[o.lifecycle.field]&&s.push(z("lifecycle-field",`${p}.lifecycle.field`,`${i} has no field "${o.lifecycle.field}"`));let w=m=>o.computed!==void 0&&Object.hasOwn(o.computed,m);for(let m of o.glance??[])!o.fields[m]&&!w(m)&&s.push(z("glance-field",`${p}.glance`,`a glance at ${i} is to say "${m}", and ${i} has no field or computed field called that`,`use one of: ${[...Object.keys(o.fields),...Object.keys(o.computed??{})].join(", ")}`));s.push(...Ze(i,o));for(let m of["label","describe"]){let l=o[m];if(!l)continue;let c=ke(l,`${p}.${m}`,s);for(let j of c??[])if(j.expr){for(let y of oe(j.expr).names)if(!o.fields[y]){if(w(y)){Ne(o,y)||s.push(z("template-field",`${p}.${m}`,`${i}'s ${y} is worked out from beyond the record, and a ${m} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${i}'s own fields`));continue}s.push(z("template-field",`${p}.${m}`,`${i} has no field "${y}" for its ${m} to show`,m==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[m,l]of Object.entries(o.fields)){l.default!==void 0&&l.type==="enum"&&!l.options?.includes(String(l.default))&&s.push(z("default-option",`${p}.fields.${m}.default`,`"${String(l.default)}" is not one of ${m}'s options`));let c=`${m}Repeat`;l.repeats&&(o.fields[c]||o.edges?.[c]||o.computed?.[c])&&s.push(z("repeat-clash",`${p}.fields.${m}.repeats`,`${i} already has "${c}", where how ${m} repeats is kept`))}}for(let[i,o]of Object.entries(a)){let p=`acts.${i}`;for(let c of re(o.on))r.has(c)||s.push(z("act-kind",`${p}.on`,`"${c}" is not a kind this document declares`));let w=re(o.on),m=Je(o,e);if(o.creates&&o.on===void 0&&o.writes&&r.has(o.creates)){for(let c of o.writes)if(!e.kinds[o.creates].fields[c])if(e.kinds[o.creates].computed?.[c]!==void 0)s.push(z("computed-written",`${p}.writes`,`${o.creates}'s ${c} is worked out, not written: no act can set it`,"write the stored fields it is worked out from"));else{if(u(o.creates,c))continue;s.push(z("act-field",`${p}.writes`,`${o.creates} has no field "${c}"`))}}m.length===0&&s.push(z("act-empty",p,`"${i}" does nothing`,"give it effects or a shorthand such as sets or creates"));let l=new Map;m.forEach((c,j)=>{let y=m.length-(o.effects?.length??0),S=o.effects&&j>=y?`${p}.effects.${j-y}`:p;if("create"in c){if(!r.has(c.create))s.push(z("act-kind",`${S}.create`,`"${c.create}" is not a kind this document declares`));else for(let b of Object.keys(c.set??{}))e.kinds[c.create].fields[b]||(e.kinds[c.create].computed?.[b]!==void 0?s.push(z("computed-written",`${S}.set.${b}`,`${c.create}'s ${b} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):s.push(z("act-field",`${S}.set.${b}`,`${c.create} has no field "${b}"`)));c.as&&l.set(c.as,c.create)}else if("connect"in c||"sever"in c){let b="connect"in c?c.connect:c.sever;!t.has(b)&&!f(b)&&s.push(z("act-edge",`${S}.${"connect"in c?"connect":"sever"}`,`"${b}" is not a relation any kind declares`)),R(c.from)==="subject"&&w.length===0&&s.push(z("act-subject",`${p}.on`,`"${i}" acts on "$subject" but does not say which kinds it is "on"`))}else if("set"in c){let b=R(c.target??"$subject"),G=b==="subject"?w:l.has(b??"")?[l.get(b)]:[];b==="subject"&&w.length===0&&s.push(z("act-subject",`${p}.on`,`"${i}" changes "$subject" but does not say which kinds it is "on"`));for(let F of Object.keys(c.set))for(let g of G)if(!(!r.has(g)||e.kinds[g].fields[F]))if(e.kinds[g].computed?.[F]!==void 0)s.push(z("computed-written",`${S}.set.${F}`,`${g}'s ${F} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(g,F))continue;s.push(z("act-field",`${S}.set.${F}`,`${g} has no field "${F}"`))}}else"remove"in c&&R(c.remove)==="subject"&&w.length===0&&s.push(z("act-subject",`${p}.on`,`"${i}" removes "$subject" but does not say which kinds it is "on"`));("set"in c&&c.set?Object.values(c.set):[]).forEach(b=>{b&&typeof b=="object"&&!Array.isArray(b)&&"expr"in b&&be(b.expr,`${S}.set`,s)})}),o.allowedWhen&&be(o.allowedWhen,`${p}.allowedWhen`,s),o.refusal&&ke(o.refusal,`${p}.refusal`,s)}for(let[i,o]of Object.entries(e.rules??{})){let p=`rules.${i}`;o.over!=="graph"&&!r.has(o.over)&&s.push(z("rule-kind",`${p}.over`,`"${o.over}" is not a kind this document declares`));let w=o.over==="graph"?void 0:e.kinds[o.over];for(let m of["when","require"]){let l=o[m];if(!l)continue;let c=be(l,`${p}.${m}`,s);if(!c)continue;let j=oe(c);for(let y of j.names)if(o.over==="graph")s.push(z("rule-name",`${p}.${m}`,`"${y}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(w&&!w.fields[y]&&!w.edges?.[y]&&w.computed?.[y]===void 0){let S=Object.keys(w.edges??{}).find(A=>A.includes("-")&&A.split("-").includes(y));s.push(z("rule-name",`${p}.${m}`,`${o.over} has no field or relation called "${y}"`,S?`"${S}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${S.replace(/-([a-z0-9])/g,(A,b)=>b.toUpperCase())}"`:void 0))}for(let y of j.edges)!t.has(y)&&!f(y)&&s.push(z("rule-edge",`${p}.${m}`,`"${y}" is not a relation any kind declares`));for(let y of j.sweeps)r.has(y)?o.over!=="graph"&&s.push(De("rule-cost",`${p}.${m}`,`this rule looks at every ${y} for every ${o.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):s.push(z("rule-kind",`${p}.${m}`,`"${y}" is not a kind this document declares`))}o.says&&ke(o.says,`${p}.says`,s),(o.repairs??[]).forEach((m,l)=>{!a[m.act]&&!ce(m.act)&&!fe(m.act,e.kinds)&&s.push(z("repair-act",`${p}.repairs.${l}.act`,`"${m.act}" is not an act this document declares`))})}let h=e.policy;return h&&(h.grants.forEach((i,o)=>{if(i.roles!=="*"&&d.size>0)for(let p of i.roles)d.has(p)||s.push(z("grant-role",`policy.grants.${o}.roles`,`"${p}" is not one of the document's roles`));if(i.mutations!=="*")for(let p of i.mutations)!a[p]&&!ce(p)&&!fe(p,e.kinds)&&s.push(z("grant-act",`policy.grants.${o}.mutations`,`"${p}" is not an act this document declares`))}),(h.sees??[]).forEach((i,o)=>{for(let p of i.kinds)r.has(p)||s.push(z("sight-kind",`policy.sees.${o}.kinds`,`"${p}" is not a kind this document declares`));if(i.roles!=="*"&&d.size>0)for(let p of i.roles)d.has(p)||s.push(z("sight-role",`policy.sees.${o}.roles`,`"${p}" is not one of the document's roles`))})),s.push(..._e(e)),s}function zn(e){return e.label?[...e.label.matchAll(/\{\s*([A-Za-z_][A-Za-z0-9_]*)/g)].map(s=>s[1]):[pe(e)??[]].flat()}function yn(e,s,r,t){let a=new Map,d=re(e.on),u=new Map,f=new Map;(d.length>0||s.some(l=>"remove"in l&&R(l.remove)==="subject"||"from"in l&&(R(l.from)==="subject"||R(l.to)==="subject")||"set"in l&&!("create"in l)&&R(l.target??"$subject")==="subject"))&&a.set(le,{ref:d.length>0?d:"*",required:!0});let i=e.args??{},o=e.writes?.length===1,p=(l,c)=>c&&l.type===c.type&&l.min===void 0&&l.max===void 0&&l.step===void 0?{...l,...c.min===void 0?{}:{min:c.min},...c.max===void 0?{}:{max:c.max},...c.step===void 0?{}:{step:c.step}}:l,w=(l,c)=>c&&l.type===c.type&&l.format===void 0&&l.unit===void 0?{...p(l,c),...c.format?{format:c.format}:{},...c.unit?{unit:c.unit}:{}}:p(l,c),m=(l,c,j)=>{if(l===le||un.has(l)||u.has(l)||a.has(l))return;let y=i[l]?w(i[l],j):void 0;a.set(l,y?{field:y,optional:!y.required,required:!!y.required}:c())};for(let l of s)if("create"in l){let c=r.kinds[l.create],j=c?He(c,zn(c)):[],y=S=>j.includes(S)?j.indexOf(S):j.length;for(let[S,A]of Object.entries(l.set??{}).sort(([b],[G])=>y(b)-y(G))){let b=R(A),G=c?.fields[S];if(b&&G){let F=!!G.required&&G.default===void 0;m(b,()=>({field:G,optional:!F,required:F}),G)}}l.as&&u.set(l.as,l.create)}else if("connect"in l||"sever"in l){let c=t.get("connect"in l?l.connect:l.sever);for(let[j,y]of[["from",l.from],["to",l.to]]){let S=R(y);if(!S)continue;let A=j==="to"?c?.to??"*":c?.from??"*";A!=="*"&&!f.has(S)&&f.set(S,A),m(S,()=>({ref:A,required:!0}))}}else if("set"in l){let c=R(l.target??"$subject"),j=c==="subject"?d[0]:u.get(c??"")??f.get(c??"")?.[0];c&&c!=="subject"&&!u.has(c)&&m(c,()=>({ref:"*",required:!0}));for(let[y,S]of Object.entries(l.set)){let A=R(S);if(!A)continue;let b=j?r.kinds[j]?.fields[y]:void 0;m(A,()=>b?{field:b,optional:!o,required:o}:{any:!0,required:!1},b)}}else if("remove"in l){let c=R(l.remove);c&&m(c,()=>({ref:"*",required:!0}))}for(let[l,c]of Object.entries(i))a.has(l)||a.set(l,{field:c,optional:!c.required,required:!!c.required});return a}function mt(e,s={}){let r=mn(e);if(!r.document||de(r.findings))return{ok:!1,findings:r.findings};let t=r.document,a=[...r.findings];s.previous&&a.push(...bn(t,s.previous));let d=hn(t,a);return de(d.findings)?{ok:!1,findings:d.findings}:Te(d,s)}function ie(e,s){return e.map(r=>{let t=!r.format&&r.expr?.t==="ident"?s?.[r.expr.name]?.format:void 0;return t==="money"||t==="percent"?{...r,format:t}:r})}function hn(e,s){let r=Ye(e),t={};for(let[i,o]of Object.entries(e.kinds)){let p=pe(o),w=o.label??(p?`{${p}}`:void 0),m=ee(o),l=m?We(e,i,[...m]):[];t[i]={...w?{label:ie(Y(w),o.fields)}:{},...o.describe?{describe:ie(Y(o.describe),o.fields)}:{},...m?{computed:[...m]}:{},...l.length>0?{durations:l}:{}}}let a={};for(let[i,o]of Object.entries(e.acts??{})){let p=Je(o,e),w=yn(o,p,e,r),m=o.destructive??p.some(g=>"remove"in g||"sever"in g||"replace"in g),l=[...new Set(p.flatMap(g=>"create"in g?[g.create]:[]))],c=[...new Set(p.flatMap(g=>"connect"in g?[g.connect]:[]))],j=[...new Set(p.flatMap(g=>"sever"in g?[g.sever]:"replace"in g?g.replace:[]))],y=[...new Set(p.flatMap(g=>"set"in g&&!("create"in g)&&R(g.target??"$subject")==="subject"?Object.keys(g.set):[]))],S=new Map;for(let g of p){if(!("connect"in g)&&!("sever"in g))continue;let v=r.get("connect"in g?g.connect:g.sever);for(let[D,te]of[["from",g.from],["to",g.to]]){let I=R(te),Z=D==="to"?v?.to:v?.from;I&&I!=="subject"&&Z&&Z!=="*"&&S.set(I,[...new Set([...S.get(I)??[],...Z])])}}let A={};for(let g of p){if(!("set"in g)||"create"in g)continue;let v=R(g.target??"$subject");for(let D of v&&v!=="subject"&&S.get(v)||[])A[D]=[...new Set([...A[D]??[],...Object.keys(g.set)])]}let b={};for(let g of p)if(!(!("set"in g)||"create"in g||R(g.target??"$subject")!=="subject"))for(let[v,D]of Object.entries(g.set??{}))typeof D=="string"&&R(D)===void 0||typeof D=="number"||typeof D=="boolean"?b[v]=typeof D=="string"&&D.startsWith("$$")?D.slice(1):D:delete b[v];let G=l.length===0&&p.every(g=>!("set"in g)||!g.set||Object.values(g.set).every(v=>!(v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v))),F=new Map;for(let g of p)if(!(!("set"in g)||!g.set))for(let v of Object.values(g.set))v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v&&F.set(v.expr,H(v.expr));a[i]={title:o.title??i.replace(/-/g," "),effects:p,args:[...w],...o.allowedWhen?{guard:H(o.allowedWhen)}:{},...o.refusal?{refusal:ie(Y(o.refusal),e.kinds[[o.on??[]].flat()[0]??""]?.fields)}:{},exprs:[...F],destructive:m,idempotent:G,creates:l,connects:c,severs:j,writes:y,writesOther:A,sets:b}}let d={};for(let[i,o]of Object.entries(e.rules??{}))d[i]={title:o.title??i.replace(/-/g," "),require:H(o.require),...o.when?{when:H(o.when)}:{},...o.says?{says:ie(Y(o.says),e.kinds[o.over]?.fields)}:{}};let u=Ke(e,s),f=Ge(e),h=Ce(e);return{format:Me,document:e,findings:s,kinds:t,...e.computed?{facts:[...ee(e)??[]]}:{},edges:[...r].map(([i,{from:o,to:p,cardinality:w}])=>[i,{from:o,to:p,cardinality:w}]),acts:a,rules:d,brand:u,...Object.keys(f).length>0?{viewSpecs:f}:{},...h?{home:h}:{}}}function gt(e,s,r){let t=/^defineNode\("([^"]+)"\)/.exec(s)?.[1],a=t?r.kinds[t]:void 0;if(!t||!a)return e;let d=Object.keys(a.fields).filter(u=>u!=="label").slice(0,3);return{...e,path:`kinds.${t}.glance`,fix:`Say which: "glance": [${d.map(u=>`"${u}"`).join(", ")}] on kinds.${t} \u2014 the facts a person compares one by, at a glance.`}}function bn(e,s){let r=[],t=new Set(Object.values(s.kinds).flatMap(a=>Object.keys(a.edges??{})));for(let[a,d]of Object.entries(e.kinds)){let u=d.renamedFrom;u&&!s.kinds[u]&&r.push(z("renamed-from-nothing",`kinds.${a}.renamedFrom`,`${a} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let f=s.kinds[u??a];for(let[h,i]of Object.entries(d.fields)){let o=i.renamedFrom;o&&!f?.fields[o]&&r.push(z("renamed-from-nothing",`kinds.${a}.fields.${h}.renamedFrom`,`${h} says it was ${o}, and the previous ${u??a} has no field called ${o}`,"name the field it was, or drop renamedFrom"))}for(let[h,i]of Object.entries(d.edges??{})){let o=i.renamedFrom;o&&!t.has(o)&&r.push(z("renamed-from-nothing",`kinds.${a}.edges.${h}.renamedFrom`,`${h} says it was ${o}, and the previous version has no relation called ${o}`,"name the relation it was, or drop renamedFrom"))}}return r}export{mn as a,ut as b,Je as c,mt as d,gt as e};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{b as ae}from"./chunk.
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{b as ae}from"./chunk.VQAQQW4Q.js";import{a as Y,c as H,d as X,e as J}from"./chunk.UJRBOUGC.js";import"./chunk.DWPU56S5.js";import"./chunk.7FRPNQU4.js";import"./chunk.BDHKWVNX.js";import"./chunk.ZH4NWRWB.js";import"./chunk.2GLJH253.js";import"./chunk.GUMJEVVP.js";import"./chunk.SAHNXAV3.js";import"./chunk.UT6642FC.js";import"./chunk.TI4OSTQV.js";import"./chunk.GZHZLJBF.js";import"./chunk.RQBEQYB2.js";import"./chunk.OJGHDWI6.js";import"./chunk.6VAFNCR4.js";import"./chunk.N4M54YK6.js";import"./chunk.KVJFY7N5.js";import"./chunk.DPHTUTOS.js";import"./chunk.2UIUMG23.js";import{Da as z,F as V,G as q,Oa as K,R as x,S as F,Sa as U,_ as b,c as W,x as j}from"./chunk.KA44WNB4.js";import{a as N}from"./chunk.SDO3U72B.js";import{Xa as _,da as I,fa as G,ia as B,rb as D}from"./chunk.4TJOS4C7.js";import"./chunk.2AZTW66C.js";import{b as w}from"./chunk.AJZBJBMO.js";var re=w(q(),1);function P(e){return{minHeight:24,padding:"3px 10px",borderRadius:6,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:e?"transparent":"var(--graview-edge)",color:e?"var(--graview-ink)":"var(--graview-ink-muted)",fontWeight:e?600:400,background:e?"color-mix(in srgb, var(--graview-accent) 16%, transparent)":"transparent"}}var M=w(x(),1);function Q(){let{seats:e,principal:t,takeSeat:i}=b();return e.length<2?null:(0,M.jsxs)("div",{role:"group","aria-label":"Seat","data-testid":"seats",style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6,rowGap:4},children:[(0,M.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"As"}),e.map(a=>{let l=ie(t,a.principal);return(0,M.jsx)("button",{type:"button","aria-pressed":l,"data-testid":`seat-${a.principal.id??a.label}`,title:`Sit down as ${a.label}: the acts, the kinds and the pages narrow to what this seat may do`,onClick:()=>i(a.principal),style:{...P(l),whiteSpace:"nowrap"},children:a.label},a.principal.id??a.label)})]})}function ie(e,t){return e.kind===t.kind&&e.id===t.id}var L=w(q(),1),c=w(x(),1),oe=`
|
|
2
2
|
.graview-here{display:flex;flex:none}
|
|
3
3
|
.graview-here>button{display:inline-flex;align-items:center;gap:4px;height:30px;margin:0;padding:0 4px;border:1px solid transparent;border-radius:8px;background:none;box-shadow:none;font:inherit;font-size:.75rem;color:var(--graview-ink-muted);cursor:pointer}
|
|
4
4
|
.graview-here-mark{display:inline-flex;align-items:center;justify-content:center;flex:none;box-sizing:border-box;width:24px;height:24px;border-radius:50%;border:1.5px solid hsl(var(--graview-hue) 50% 48%);background:var(--graview-panel-muted);color:var(--graview-ink);font-size:.75rem;font-weight:600;box-shadow:0 0 0 2px var(--graview-bar)}
|
|
@@ -6,4 +6,4 @@ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=gl
|
|
|
6
6
|
.graview-here-mark[data-agent]{border-radius:5px}
|
|
7
7
|
.graview-here-mark[data-counted]{--graview-hue:0;border-color:var(--graview-edge)}
|
|
8
8
|
.graview-here small{display:block;font-size:.75rem;color:var(--graview-ink-muted)}
|
|
9
|
-
.graview-bar[data-finding] .graview-here{display:none}`,se={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"};function le(e,t){let i=t.id===void 0?null:`${t.kind}:${t.id}`,a=new Map;for(let l of e.values()){let d=l.participant.slice(0,l.participant.lastIndexOf(":"));if(d===i)continue;let s=d.endsWith(":")?l.participant:d,o=a.get(s);(!o||o.at<l.at)&&a.set(s,l)}return[...a.values()]}var Z=e=>e.name&&e.onBehalfOfName?`${e.name}, for ${e.onBehalfOfName}`:e.name??"",ee=e=>e===1?"1 viewer":`${e} viewers`;function de(e){let t=e.map(Z).filter(Boolean),i=t.length<e.length?[...t,ee(e.length-t.length)]:t,a=i.pop();return`${i.length>0?`${i.join(", ")} and ${a}`:a} ${e.length===1?"is":"are"} here`}function pe(e,t){let{store:i,hidden:a,pictures:l}=t,d=W(e),s=i.kindsKeptFrom(t.principal),o=u=>!a.has(u)&&!s.has(u)&&!i.modules.disabledKinds.has(u),g=l.find(u=>u.as===d.within?.view&&o(u.kind));if(g)return g.title;if(!d.focusId)return d.overview?"the whole thing":null;let p=j(d.focusId);if(p.length>0)return p.every(o)?p.map(u=>B(i.schema,u)).join(" and "):null;let h=i.graph.getNode(d.focusId);return h&&o(h.kind)?I(i.schema.tryDefinition(h.kind),h):null}function ce(e,t){let i=o=>o.id!==void 0&&(o.id===t.principal.id||o.onBehalfOf?.id===t.principal.id),a=e.filter(o=>!D(o)&&o.author.kind!=="system"&&!i(o.author)),l=a[0];if(!l)return null;let d=_(l.author,{graph:t.store.graph,schema:t.store.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}}),s=[...new Set(a.map(o=>o.intent))].join("; ");return`${d}: ${s}`}function ue(e,t,i){let a=ce(e,t);a&&(i(""),setTimeout(()=>i(a),50))}function ge({scene:e,compact:t}){let{who:i,principal:a,store:l,views:d,hiddenKinds:s,follow:o}=b(),g=U("here"),p=le(i,a),h=p.length===0?"":de(p),[u,S]=(0,L.useState)("");if((0,L.useEffect)(()=>S(h),[h]),p.length===0)return null;let f=p.filter(r=>r.name),y=f.slice(0,t?2:3),m=p.length-y.length,k=p.length-f.length,T=d.places();return(0,c.jsxs)("div",{className:"graview-here","data-testid":"here",children:[(0,c.jsx)("style",{children:oe}),(0,c.jsx)("span",{role:"status","aria-live":"polite",style:se,children:u}),(0,c.jsxs)("button",{type:"button","data-testid":"here-open",...g.trigger,onClick:g.toggle,"aria-label":`${h} \u2014 who and where`,title:h,children:[y.length>0?(0,c.jsx)("span",{style:{display:"flex"},children:y.map(r=>(0,c.jsx)(E,{one:r},r.participant))}):(0,c.jsx)(E,{count:m}),y.length>0&&m>0?(0,c.jsxs)("span",{"aria-hidden":"true",children:["+",m]}):null]}),(0,c.jsxs)("ul",{...g.pane,"aria-label":"Who is here","data-testid":"here-list",hidden:!g.open,className:"graview-bar-list",style:K,children:[f.map(r=>{let v=pe(r.stop,{store:l,principal:a,hidden:s,pictures:T}),A=Z(r);return(0,c.jsx)("li",{children:(0,c.jsxs)(e?"button":"span",{className:"graview-bar-item","data-testid":"here-one",...e?{type:"button",title:`Go where ${A} is`,onClick:()=>{g.setOpen(!1),o(r.participant)}}:{style:{cursor:"default"}},children:[(0,c.jsx)(E,{one:r}),(0,c.jsxs)("span",{children:[A,v?(0,c.jsxs)("small",{children:["On ",v]}):null]})]})},r.participant)}),k>0?(0,c.jsx)("li",{children:(0,c.jsxs)("span",{className:"graview-bar-item","data-testid":"here-viewers",style:{cursor:"default"},children:[(0,c.jsx)(E,{count:k}),(0,c.jsxs)("span",{children:[ee(k),(0,c.jsx)("small",{children:"Not signed in"})]})]})}):null]})]})}function E({one:e,count:t}){return(0,c.jsx)("span",{className:"graview-here-mark","aria-hidden":"true",...e?{style:{"--graview-hue":Math.round(e.hue)}}:{"data-counted":""},...e?.kind==="agent"?{"data-agent":""}:{},children:e?(e.name??"").trim().charAt(0).toUpperCase():t})}function he(e){let t=/^(?:place|scene):([^:]+):(.+)$/.exec(e.key);return t?{place:t[2],about:[`aggregate:${t[1]}`],title:e.label}:{about:e.group==="lists"&&e.kind?[`aggregate:${e.kind}`]:[],title:e.label}}function O(e,t,i,a,l,d){let s=he(t),o=e.getBoundingClientRect(),g={...s,face:i?"scene":"pages",x:Math.round(l??o.left+Math.min(16,o.width/2)),y:Math.round(d??Math.min(o.bottom,o.top+36)),returnTo:e},p=i?null:e.closest("[data-graview-embed], [data-graview-shell]")?.querySelector("[data-graview-face='pages']")??document.querySelector("[data-graview-face='pages']");p?p.dispatchEvent(new CustomEvent(F,{detail:g})):a(g)}var R={on:null,at:0},te=500,me=10;function ye(e,t,i,a,l,d,s){let o=t.getAttribute("data-testid")??"",g=o==="app-places-open"?a:o.slice(10),p=i.find(m=>m.key===g);if(!p)return;if(e.type==="keydown")return R={on:t,at:Date.now()},O(t,p,l,d);let{clientX:h,clientY:u}=e;if(e.type==="contextmenu")return R.on===t&&Date.now()-R.at<700?void 0:h===0&&u===0?O(t,p,l,d):O(t,p,l,d,h,u);let S=Date.now()-Math.max(0,performance.now()-e.timeStamp),f=!1,y=m=>{Math.hypot(m.clientX-h,m.clientY-u)>me&&(f=!0)};document.addEventListener("pointermove",y),setTimeout(()=>{document.removeEventListener("pointermove",y),!(f||s.at!==0&&s.at-S<te)&&(R={on:t,at:Date.now()},t.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation()},{capture:!0,once:!0}),O(t,p,l,d,h,u))},Math.max(0,te-(Date.now()-S)))}var n=w(x(),1),Ie=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.O4WEJ47H.js","./chunk.Y4ZUJUUT.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.57ZSMK3R.js")))).part((e,t)=>(0,n.jsx)(e.TidyGroups,{...t}),{quiet:!0}),fe=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.Y4ZUJUUT.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.P4KCZRIG.js")))).part((e,t)=>(0,n.jsx)(e.HoverChipsSwitch,{...t}),{quiet:!0});function Be({violations:e,pick:t}){let{store:i,brand:a,setMenuAt:l}=b(),d=Y(i,e);return(0,n.jsx)(n.Fragment,{children:d.map((s,o)=>{let g=J(s),p=s.repairs.length>0?`${s.repairs.length} ${s.repairs.length===1?"way":"ways"} to fix`:"";return(0,n.jsx)("li",{style:{borderTop:o===0?"none":"1px solid var(--graview-edge)"},children:(0,n.jsxs)("button",{type:"button",onClick:h=>{let u=h.currentTarget.closest("ol").getBoundingClientRect();t(s),l({x:u.left,y:u.top,on:s.subjectId})},...H(s)!==void 0?{title:H(s)}:{},style:{width:"100%",textAlign:"left",fontSize:"0.8125rem",lineHeight:1.4,padding:"7px 8px",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7},children:[s.line?(0,n.jsx)(X,{line:s.line,schema:i.schema,...a?{brand:a}:{},stacked:!0,style:{display:"block",color:"var(--graview-ink)"}}):(0,n.jsx)("span",{style:{display:"block",color:"var(--graview-ink)"},children:s.message}),g||p?(0,n.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:[g,p].filter(Boolean).join(" \xB7 ")}):null]})},`${s.invariant}:${o}`)})})}function _e({name:e,me:t,scheme:i,onScheme:a,profileHref:l,hostActions:d,close:s,part:o,signature:g=!1}){let{principal:p,seats:h,settings:u,settingValues:S,chooseSetting:f,sharing:y,ai:m}=b(),k=p.roles??[],T={setOpen:r=>s()};return(0,n.jsx)(n.Fragment,{children:o==="top"?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{style:{display:"grid",gap:3},children:[(0,n.jsx)("span",{style:$,children:"Signed in as"}),(0,n.jsx)("strong",{style:{fontSize:"1rem",fontWeight:550},children:e}),(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:k.length>0?k.map(r=>G(r)).join(", "):t===void 0?"This app has no sign-in; everything here is yours.":"No role in particular"}),t!==void 0&&l!==void 0?(0,n.jsx)("a",{href:l(t.id),"data-testid":"profile-record",style:{display:"inline-flex",alignItems:"center",minHeight:24,justifySelf:"start",fontSize:"0.875rem",color:"var(--graview-accent)"},children:"Your record \u2197"}):null,y?(0,n.jsxs)("span",{"data-testid":"profile-seen-as",style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["Seen by others as ",y.name]}):null]}),d.length>0?(0,n.jsx)("ul",{role:"list","aria-label":"From the host","data-testid":"host-actions",style:{...C,margin:0,paddingLeft:0,listStyle:"none",display:"grid",gap:2},children:d.map(r=>(0,n.jsx)("li",{children:r.href!==void 0?(0,n.jsx)("a",{href:r.href,"data-testid":"host-action",className:"graview-host-action",...r.target?{target:r.target,rel:"noopener"}:{},onClick:()=>{r.onSelect?.(),T.setOpen(!1)},style:ne,children:r.label}):(0,n.jsx)("button",{type:"button","data-testid":"host-action",className:"graview-host-action",onClick:()=>{T.setOpen(!1),r.onSelect?.()},style:{...ne,width:"100%",textAlign:"left",border:"none",background:"none",boxShadow:"none",font:"inherit",cursor:"pointer"},children:r.label})},r.label))}):null]}):(0,n.jsxs)(n.Fragment,{children:[h.length>1?(0,n.jsxs)("div",{style:{display:"grid",gap:6,...C},children:[(0,n.jsx)("span",{style:$,children:"Sit as somebody else"}),(0,n.jsx)(Q,{})]}):null,u.length>0?(0,n.jsx)("div",{style:{display:"grid",gap:10,...C},children:u.map(r=>(0,n.jsxs)("fieldset",{"data-testid":`setting-${r.name}`,style:{border:0,margin:0,padding:0,display:"grid",gap:5},children:[(0,n.jsx)("legend",{style:{...$,padding:0},children:r.title}),r.description?(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:r.description}):null,(0,n.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:r.options.map(v=>{let A=(S[r.name]??r.initial)===v.value;return(0,n.jsx)("button",{type:"button","aria-pressed":A,"data-testid":`setting-${r.name}-${v.value}`,onClick:()=>f(r.name,v.value),style:P(A),children:v.label},v.value)})})]},r.name))}):null,V(m)?(0,n.jsx)(re.Suspense,{fallback:null,children:(0,n.jsx)(fe,{legend:$,style:C,choice:P})}):null,i!==void 0&&a!==void 0?(0,n.jsxs)("div",{style:{display:"grid",gap:5,...C},children:[(0,n.jsx)("span",{style:$,children:"Scheme"}),(0,n.jsx)("div",{style:{display:"flex",gap:4},children:["light","dark"].map(r=>(0,n.jsx)("button",{type:"button","aria-pressed":i===r,"data-testid":`profile-scheme-${r}`,onClick:()=>a(r),style:P(i===r),children:r==="light"?"\u2600 Light":"\u263E Dark"},r))})]}):null,g?(0,n.jsxs)("p",{"data-testid":"graview-signature",style:{...C,margin:0,display:"flex",alignItems:"center",gap:6,fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["Built with",(0,n.jsxs)("a",{href:"https://graview.dev",target:"_blank",rel:"noopener",style:{display:"inline-flex",alignItems:"center",gap:4,minHeight:24,color:"var(--graview-ink-muted)",fontWeight:600,textDecoration:"none"},children:[(0,n.jsx)("span",{"data-testid":"graview-mark",style:{display:"inline-flex",lineHeight:0},dangerouslySetInnerHTML:{__html:ve}}),"Graview"]})]}):null]})})}var ve='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="14" height="14" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="2.4" stroke-linejoin="round"><path d="M13 11 L3 8 L14 3 H29 L21 9"/><path d="M10 18 L3 23 L16.5 28 L29 21 L22 19"/><path d="M16.5 18.5 V23.5" stroke-linecap="round"/></g><circle cx="16.5" cy="13.5" r="2" fill="var(--graview-mark-point, currentColor)"/></svg>',ne={display:"flex",alignItems:"center",minHeight:28,padding:"2px 8px",borderRadius:7,fontSize:"0.875rem",color:"var(--graview-ink)",textDecoration:"none"},$={fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},C={paddingTop:10,borderTop:"1px solid var(--graview-edge)"};export{ae as ActivityRail,ge as Here,Be as ProblemRows,_e as ProfilePane,Ie as TidyFoot,ye as placeGesture,ue as sayTheirChange};
|
|
9
|
+
.graview-bar[data-finding] .graview-here{display:none}`,se={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"};function le(e,t){let i=t.id===void 0?null:`${t.kind}:${t.id}`,a=new Map;for(let l of e.values()){let d=l.participant.slice(0,l.participant.lastIndexOf(":"));if(d===i)continue;let s=d.endsWith(":")?l.participant:d,o=a.get(s);(!o||o.at<l.at)&&a.set(s,l)}return[...a.values()]}var Z=e=>e.name&&e.onBehalfOfName?`${e.name}, for ${e.onBehalfOfName}`:e.name??"",ee=e=>e===1?"1 viewer":`${e} viewers`;function de(e){let t=e.map(Z).filter(Boolean),i=t.length<e.length?[...t,ee(e.length-t.length)]:t,a=i.pop();return`${i.length>0?`${i.join(", ")} and ${a}`:a} ${e.length===1?"is":"are"} here`}function pe(e,t){let{store:i,hidden:a,pictures:l}=t,d=W(e),s=i.kindsKeptFrom(t.principal),o=u=>!a.has(u)&&!s.has(u)&&!i.modules.disabledKinds.has(u),g=l.find(u=>u.as===d.within?.view&&o(u.kind));if(g)return g.title;if(!d.focusId)return d.overview?"the whole thing":null;let p=j(d.focusId);if(p.length>0)return p.every(o)?p.map(u=>B(i.schema,u)).join(" and "):null;let h=i.graph.getNode(d.focusId);return h&&o(h.kind)?I(i.schema.tryDefinition(h.kind),h):null}function ce(e,t){let i=o=>o.id!==void 0&&(o.id===t.principal.id||o.onBehalfOf?.id===t.principal.id),a=e.filter(o=>!D(o)&&o.author.kind!=="system"&&!i(o.author)),l=a[0];if(!l)return null;let d=_(l.author,{graph:t.store.graph,schema:t.store.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}}),s=[...new Set(a.map(o=>o.intent))].join("; ");return`${d}: ${s}`}function ue(e,t,i){let a=ce(e,t);a&&(i(""),setTimeout(()=>i(a),50))}function ge({scene:e,compact:t}){let{who:i,principal:a,store:l,views:d,hiddenKinds:s,follow:o}=b(),g=U("here"),p=le(i,a),h=p.length===0?"":de(p),[u,S]=(0,L.useState)("");if((0,L.useEffect)(()=>S(h),[h]),p.length===0)return null;let f=p.filter(r=>r.name),y=f.slice(0,t?2:3),m=p.length-y.length,k=p.length-f.length,T=d.places();return(0,c.jsxs)("div",{className:"graview-here","data-testid":"here",children:[(0,c.jsx)("style",{children:oe}),(0,c.jsx)("span",{role:"status","aria-live":"polite",style:se,children:u}),(0,c.jsxs)("button",{type:"button","data-testid":"here-open",...g.trigger,onClick:g.toggle,"aria-label":`${h} \u2014 who and where`,title:h,children:[y.length>0?(0,c.jsx)("span",{style:{display:"flex"},children:y.map(r=>(0,c.jsx)(E,{one:r},r.participant))}):(0,c.jsx)(E,{count:m}),y.length>0&&m>0?(0,c.jsxs)("span",{"aria-hidden":"true",children:["+",m]}):null]}),(0,c.jsxs)("ul",{...g.pane,"aria-label":"Who is here","data-testid":"here-list",hidden:!g.open,className:"graview-bar-list",style:K,children:[f.map(r=>{let v=pe(r.stop,{store:l,principal:a,hidden:s,pictures:T}),A=Z(r);return(0,c.jsx)("li",{children:(0,c.jsxs)(e?"button":"span",{className:"graview-bar-item","data-testid":"here-one",...e?{type:"button",title:`Go where ${A} is`,onClick:()=>{g.setOpen(!1),o(r.participant)}}:{style:{cursor:"default"}},children:[(0,c.jsx)(E,{one:r}),(0,c.jsxs)("span",{children:[A,v?(0,c.jsxs)("small",{children:["On ",v]}):null]})]})},r.participant)}),k>0?(0,c.jsx)("li",{children:(0,c.jsxs)("span",{className:"graview-bar-item","data-testid":"here-viewers",style:{cursor:"default"},children:[(0,c.jsx)(E,{count:k}),(0,c.jsxs)("span",{children:[ee(k),(0,c.jsx)("small",{children:"Not signed in"})]})]})}):null]})]})}function E({one:e,count:t}){return(0,c.jsx)("span",{className:"graview-here-mark","aria-hidden":"true",...e?{style:{"--graview-hue":Math.round(e.hue)}}:{"data-counted":""},...e?.kind==="agent"?{"data-agent":""}:{},children:e?(e.name??"").trim().charAt(0).toUpperCase():t})}function he(e){let t=/^(?:place|scene):([^:]+):(.+)$/.exec(e.key);return t?{place:t[2],about:[`aggregate:${t[1]}`],title:e.label}:{about:e.group==="lists"&&e.kind?[`aggregate:${e.kind}`]:[],title:e.label}}function O(e,t,i,a,l,d){let s=he(t),o=e.getBoundingClientRect(),g={...s,face:i?"scene":"pages",x:Math.round(l??o.left+Math.min(16,o.width/2)),y:Math.round(d??Math.min(o.bottom,o.top+36)),returnTo:e},p=i?null:e.closest("[data-graview-embed], [data-graview-shell]")?.querySelector("[data-graview-face='pages']")??document.querySelector("[data-graview-face='pages']");p?p.dispatchEvent(new CustomEvent(F,{detail:g})):a(g)}var R={on:null,at:0},te=500,me=10;function ye(e,t,i,a,l,d,s){let o=t.getAttribute("data-testid")??"",g=o==="app-places-open"?a:o.slice(10),p=i.find(m=>m.key===g);if(!p)return;if(e.type==="keydown")return R={on:t,at:Date.now()},O(t,p,l,d);let{clientX:h,clientY:u}=e;if(e.type==="contextmenu")return R.on===t&&Date.now()-R.at<700?void 0:h===0&&u===0?O(t,p,l,d):O(t,p,l,d,h,u);let S=Date.now()-Math.max(0,performance.now()-e.timeStamp),f=!1,y=m=>{Math.hypot(m.clientX-h,m.clientY-u)>me&&(f=!0)};document.addEventListener("pointermove",y),setTimeout(()=>{document.removeEventListener("pointermove",y),!(f||s.at!==0&&s.at-S<te)&&(R={on:t,at:Date.now()},t.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation()},{capture:!0,once:!0}),O(t,p,l,d,h,u))},Math.max(0,te-(Date.now()-S)))}var n=w(x(),1),Ie=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.2UIUMG23.js","./chunk.KA44WNB4.js","./chunk.SDO3U72B.js","./chunk.4TJOS4C7.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.CH5ROV7N.js")))).part((e,t)=>(0,n.jsx)(e.TidyGroups,{...t}),{quiet:!0}),fe=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.KA44WNB4.js","./chunk.SDO3U72B.js","./chunk.4TJOS4C7.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.PVEPU6EA.js")))).part((e,t)=>(0,n.jsx)(e.HoverChipsSwitch,{...t}),{quiet:!0});function Be({violations:e,pick:t}){let{store:i,brand:a,setMenuAt:l}=b(),d=Y(i,e);return(0,n.jsx)(n.Fragment,{children:d.map((s,o)=>{let g=J(s),p=s.repairs.length>0?`${s.repairs.length} ${s.repairs.length===1?"way":"ways"} to fix`:"";return(0,n.jsx)("li",{style:{borderTop:o===0?"none":"1px solid var(--graview-edge)"},children:(0,n.jsxs)("button",{type:"button",onClick:h=>{let u=h.currentTarget.closest("ol").getBoundingClientRect();t(s),l({x:u.left,y:u.top,on:s.subjectId})},...H(s)!==void 0?{title:H(s)}:{},style:{width:"100%",textAlign:"left",fontSize:"0.8125rem",lineHeight:1.4,padding:"7px 8px",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7},children:[s.line?(0,n.jsx)(X,{line:s.line,schema:i.schema,...a?{brand:a}:{},stacked:!0,style:{display:"block",color:"var(--graview-ink)"}}):(0,n.jsx)("span",{style:{display:"block",color:"var(--graview-ink)"},children:s.message}),g||p?(0,n.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:[g,p].filter(Boolean).join(" \xB7 ")}):null]})},`${s.invariant}:${o}`)})})}function _e({name:e,me:t,scheme:i,onScheme:a,profileHref:l,hostActions:d,close:s,part:o,signature:g=!1}){let{principal:p,seats:h,settings:u,settingValues:S,chooseSetting:f,sharing:y,ai:m}=b(),k=p.roles??[],T={setOpen:r=>s()};return(0,n.jsx)(n.Fragment,{children:o==="top"?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{style:{display:"grid",gap:3},children:[(0,n.jsx)("span",{style:$,children:"Signed in as"}),(0,n.jsx)("strong",{style:{fontSize:"1rem",fontWeight:550},children:e}),(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:k.length>0?k.map(r=>G(r)).join(", "):t===void 0?"This app has no sign-in; everything here is yours.":"No role in particular"}),t!==void 0&&l!==void 0?(0,n.jsx)("a",{href:l(t.id),"data-testid":"profile-record",style:{display:"inline-flex",alignItems:"center",minHeight:24,justifySelf:"start",fontSize:"0.875rem",color:"var(--graview-accent)"},children:"Your record \u2197"}):null,y?(0,n.jsxs)("span",{"data-testid":"profile-seen-as",style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["Seen by others as ",y.name]}):null]}),d.length>0?(0,n.jsx)("ul",{role:"list","aria-label":"From the host","data-testid":"host-actions",style:{...C,margin:0,paddingLeft:0,listStyle:"none",display:"grid",gap:2},children:d.map(r=>(0,n.jsx)("li",{children:r.href!==void 0?(0,n.jsx)("a",{href:r.href,"data-testid":"host-action",className:"graview-host-action",...r.target?{target:r.target,rel:"noopener"}:{},onClick:()=>{r.onSelect?.(),T.setOpen(!1)},style:ne,children:r.label}):(0,n.jsx)("button",{type:"button","data-testid":"host-action",className:"graview-host-action",onClick:()=>{T.setOpen(!1),r.onSelect?.()},style:{...ne,width:"100%",textAlign:"left",border:"none",background:"none",boxShadow:"none",font:"inherit",cursor:"pointer"},children:r.label})},r.label))}):null]}):(0,n.jsxs)(n.Fragment,{children:[h.length>1?(0,n.jsxs)("div",{style:{display:"grid",gap:6,...C},children:[(0,n.jsx)("span",{style:$,children:"Sit as somebody else"}),(0,n.jsx)(Q,{})]}):null,u.length>0?(0,n.jsx)("div",{style:{display:"grid",gap:10,...C},children:u.map(r=>(0,n.jsxs)("fieldset",{"data-testid":`setting-${r.name}`,style:{border:0,margin:0,padding:0,display:"grid",gap:5},children:[(0,n.jsx)("legend",{style:{...$,padding:0},children:r.title}),r.description?(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:r.description}):null,(0,n.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:r.options.map(v=>{let A=(S[r.name]??r.initial)===v.value;return(0,n.jsx)("button",{type:"button","aria-pressed":A,"data-testid":`setting-${r.name}-${v.value}`,onClick:()=>f(r.name,v.value),style:P(A),children:v.label},v.value)})})]},r.name))}):null,V(m)?(0,n.jsx)(re.Suspense,{fallback:null,children:(0,n.jsx)(fe,{legend:$,style:C,choice:P})}):null,i!==void 0&&a!==void 0?(0,n.jsxs)("div",{style:{display:"grid",gap:5,...C},children:[(0,n.jsx)("span",{style:$,children:"Scheme"}),(0,n.jsx)("div",{style:{display:"flex",gap:4},children:["light","dark"].map(r=>(0,n.jsx)("button",{type:"button","aria-pressed":i===r,"data-testid":`profile-scheme-${r}`,onClick:()=>a(r),style:P(i===r),children:r==="light"?"\u2600 Light":"\u263E Dark"},r))})]}):null,g?(0,n.jsxs)("p",{"data-testid":"graview-signature",style:{...C,margin:0,display:"flex",alignItems:"center",gap:6,fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["Built with",(0,n.jsxs)("a",{href:"https://graview.dev",target:"_blank",rel:"noopener",style:{display:"inline-flex",alignItems:"center",gap:4,minHeight:24,color:"var(--graview-ink-muted)",fontWeight:600,textDecoration:"none"},children:[(0,n.jsx)("span",{"data-testid":"graview-mark",style:{display:"inline-flex",lineHeight:0},dangerouslySetInnerHTML:{__html:ve}}),"Graview"]})]}):null]})})}var ve='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="14" height="14" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="2.4" stroke-linejoin="round"><path d="M13 11 L3 8 L14 3 H29 L21 9"/><path d="M10 18 L3 23 L16.5 28 L29 21 L22 19"/><path d="M16.5 18.5 V23.5" stroke-linecap="round"/></g><circle cx="16.5" cy="13.5" r="2" fill="var(--graview-mark-point, currentColor)"/></svg>',ne={display:"flex",alignItems:"center",minHeight:28,padding:"2px 8px",borderRadius:7,fontSize:"0.875rem",color:"var(--graview-ink)",textDecoration:"none"},$={fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},C={paddingTop:10,borderTop:"1px solid var(--graview-edge)"};export{ae as ActivityRail,ge as Here,Be as ProblemRows,_e as ProfilePane,Ie as TidyFoot,ye as placeGesture,ue as sayTheirChange};
|