graview 0.1.59 → 0.1.61
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/README.md +4 -2
- package/dist/preview/{chunk.KE6ZRUMP.js → chunk.2AWVQ5SW.js} +1 -1
- package/dist/preview/{chunk.WEGPDJTB.js → chunk.2LNSENPV.js} +1 -1
- package/dist/preview/chunk.2QFKNTAZ.js +1 -0
- package/dist/preview/{chunk.PS5SEND3.js → chunk.2WZAFKJ2.js} +1 -1
- package/dist/preview/{chunk.UITZ74YJ.js → chunk.2XSIJH5J.js} +1 -1
- package/dist/preview/{chunk.WTUB7W2D.js → chunk.3FUUYYR5.js} +1 -1
- package/dist/preview/{chunk.ZLMI2NHC.js → chunk.3HFUO3DC.js} +1 -1
- package/dist/preview/chunk.3ICWPRRJ.js +1 -0
- package/dist/preview/{chunk.M3JIIF32.js → chunk.3RW677X6.js} +1 -1
- package/dist/preview/{chunk.GDUM2UOM.js → chunk.3SMNWZ3M.js} +1 -1
- package/dist/preview/{chunk.LKE2FBXL.js → chunk.4G32374Q.js} +1 -1
- package/dist/preview/{chunk.4T5QIZKB.js → chunk.4LG34OC2.js} +2 -2
- package/dist/preview/{chunk.TCPTVTFU.js → chunk.4OEWFPH3.js} +1 -1
- package/dist/preview/{chunk.SZG6HJWH.js → chunk.4STDIZVI.js} +1 -1
- package/dist/preview/{chunk.X2G4ZRB2.js → chunk.5POG3G2C.js} +1 -1
- package/dist/preview/{chunk.GR2B7SKI.js → chunk.5S7IGASX.js} +1 -1
- package/dist/preview/chunk.5T53SF2K.js +1 -0
- package/dist/preview/{chunk.E22DDEQI.js → chunk.5X22RKB3.js} +1 -1
- package/dist/preview/{chunk.4OMOP77U.js → chunk.65KFZV3A.js} +1 -1
- package/dist/preview/chunk.66IKLMYX.js +104 -0
- package/dist/preview/chunk.6DOOLVT4.js +1 -0
- package/dist/preview/{chunk.KSVJHSRH.js → chunk.6HZY5NRX.js} +1 -1
- package/dist/preview/{chunk.ATSKKTUO.js → chunk.6SO64TUI.js} +1 -1
- package/dist/preview/{chunk.J4HTSXUA.js → chunk.6VLCMBRE.js} +1 -1
- package/dist/preview/{chunk.OVSZXILB.js → chunk.747OH3EE.js} +1 -1
- package/dist/preview/chunk.7CETF4A6.js +1 -0
- package/dist/preview/{chunk.XOTES3PI.js → chunk.7LZ6JDJA.js} +2 -2
- package/dist/preview/{chunk.HKINU7VO.js → chunk.7R727IKU.js} +1 -1
- package/dist/preview/chunk.A2ZQASQV.js +1 -0
- package/dist/preview/chunk.AVFOTYZR.js +74 -0
- package/dist/preview/{chunk.IIESMHXY.js → chunk.BDTT4ENI.js} +2 -2
- package/dist/preview/{chunk.ROHSF4WM.js → chunk.BFDJTWGX.js} +1 -1
- package/dist/preview/{chunk.N4LOI3YA.js → chunk.BI6DS3PZ.js} +1 -1
- package/dist/preview/{chunk.R4YDAJRL.js → chunk.BJI2C3IZ.js} +1 -1
- package/dist/preview/{chunk.G7HIAUEA.js → chunk.C634A6ZC.js} +1 -1
- package/dist/preview/{chunk.EGJUFZD5.js → chunk.CRCJ3TAG.js} +1 -1
- package/dist/preview/{chunk.QC4YXFF7.js → chunk.CUTLO6DA.js} +1 -1
- package/dist/preview/chunk.D4TA5XDC.js +4 -0
- package/dist/preview/{chunk.QLTHHWBA.js → chunk.D5Q64GA4.js} +1 -1
- package/dist/preview/{chunk.VDGMFX5C.js → chunk.DHJI7LIW.js} +1 -1
- package/dist/preview/{chunk.CYUMQPMH.js → chunk.DHY7KOBV.js} +1 -1
- package/dist/preview/chunk.DKXVEVDG.js +1 -0
- package/dist/preview/{chunk.V6EEDYYW.js → chunk.DLDP6OWD.js} +1 -1
- package/dist/preview/{chunk.VS25R6R2.js → chunk.DP5DUV6F.js} +1 -1
- package/dist/preview/chunk.DXWTM4SH.js +1 -0
- package/dist/preview/{chunk.BDBLGGFJ.js → chunk.E6RNMWFN.js} +1 -1
- package/dist/preview/{chunk.CLR6KAA3.js → chunk.E7UDVC4V.js} +1 -1
- package/dist/preview/{chunk.W2VOD6SD.js → chunk.EN2ABVIP.js} +1 -1
- package/dist/preview/{chunk.2QESVWUW.js → chunk.EVEHSENK.js} +1 -1
- package/dist/preview/{chunk.3XIIJHQ6.js → chunk.F4VHCQNP.js} +1 -1
- package/dist/preview/{chunk.IPPZEGBX.js → chunk.F7IQ4B6A.js} +1 -1
- package/dist/preview/chunk.F7PIW2EM.js +5 -0
- package/dist/preview/{chunk.QL555VQ2.js → chunk.FC6AF6CC.js} +1 -1
- package/dist/preview/{chunk.SU6WKQ73.js → chunk.FJIXSGYU.js} +1 -1
- package/dist/preview/{chunk.6N7LNTB6.js → chunk.FWUG7Y6C.js} +1 -1
- package/dist/preview/chunk.G4VMRYS4.js +1 -0
- package/dist/preview/{chunk.7JOG6XFC.js → chunk.GI6XQF5X.js} +1 -1
- package/dist/preview/{chunk.S7ZLGODY.js → chunk.GIW657OR.js} +1 -1
- package/dist/preview/chunk.GPWYWALF.js +1 -0
- package/dist/preview/{chunk.F6P3WSMW.js → chunk.GQNSNJTJ.js} +1 -1
- package/dist/preview/chunk.HGVBGSRS.js +6 -0
- package/dist/preview/{chunk.CUJX3IVA.js → chunk.HOQMD6WQ.js} +1 -1
- package/dist/preview/{chunk.U5PX2ECA.js → chunk.HQNE4I4M.js} +1 -1
- package/dist/preview/{chunk.2FOIJ5ID.js → chunk.HZHNM2KI.js} +1 -1
- package/dist/preview/{chunk.D3AISGQH.js → chunk.IA5ZBMRD.js} +1 -1
- package/dist/preview/{chunk.ZFH4SCCF.js → chunk.ISRQQVS4.js} +1 -1
- package/dist/preview/{chunk.BPC4XQFZ.js → chunk.ISXNAFRC.js} +2 -2
- package/dist/preview/{chunk.6VNKGTLF.js → chunk.JEQO24GS.js} +1 -1
- package/dist/preview/{chunk.MZJ3KTEU.js → chunk.JHAFQNGC.js} +1 -1
- package/dist/preview/chunk.JU3BCCQM.js +1 -0
- package/dist/preview/{chunk.EZ3CRUBU.js → chunk.K2AC536Q.js} +2 -2
- package/dist/preview/chunk.K3UOXAZS.js +1 -0
- package/dist/preview/{chunk.WGTBQHHE.js → chunk.KRFRREEW.js} +1 -1
- package/dist/preview/chunk.LA2DMHZC.js +1 -0
- package/dist/preview/chunk.LQAT7FA6.js +3 -0
- package/dist/preview/{chunk.UHUBQ4EX.js → chunk.LTI5PKTS.js} +1 -1
- package/dist/preview/chunk.MBP7VDYM.js +1 -0
- package/dist/preview/{chunk.UFTAGUTU.js → chunk.MBPOYZ3J.js} +1 -1
- package/dist/preview/chunk.MBU7UH6J.js +1 -0
- package/dist/preview/chunk.MH6CCHEX.js +1 -0
- package/dist/preview/{chunk.G2TCFWYX.js → chunk.MK72IRIY.js} +1 -1
- package/dist/preview/{chunk.QXMQUIQZ.js → chunk.MNRTA2CB.js} +1 -1
- package/dist/preview/chunk.MU3XII7I.js +1 -0
- package/dist/preview/chunk.MYVED5LU.js +1 -0
- package/dist/preview/chunk.N5WDQAIM.js +5 -0
- package/dist/preview/{chunk.VNJKGSGZ.js → chunk.N7T7VB77.js} +1 -1
- package/dist/preview/{chunk.JPNBQFJ3.js → chunk.NUEPFPRA.js} +1 -1
- package/dist/preview/chunk.ODVRO2BJ.js +1 -0
- package/dist/preview/{chunk.DGM3Y2FB.js → chunk.OVPFROL3.js} +1 -1
- package/dist/preview/{chunk.RKZ4J3H2.js → chunk.PGA5TUSN.js} +1 -1
- package/dist/preview/{chunk.VGHZQEHS.js → chunk.PJ5AO7CK.js} +1 -1
- package/dist/preview/{chunk.E2REVMAG.js → chunk.PYVWGTQS.js} +1 -1
- package/dist/preview/{chunk.CIB65YO6.js → chunk.PZXTSWDH.js} +1 -1
- package/dist/preview/chunk.Q5I5M3FR.js +1 -0
- package/dist/preview/chunk.QATUGE34.js +1 -0
- package/dist/preview/{chunk.T227XQIO.js → chunk.QL77K3D4.js} +1 -1
- package/dist/preview/{chunk.VNBEAF62.js → chunk.R3N73BJO.js} +1 -1
- package/dist/preview/{chunk.3UTRR5YM.js → chunk.R5547CJ7.js} +1 -1
- package/dist/preview/chunk.REH6RXNH.js +1 -0
- package/dist/preview/{chunk.HJOVOA52.js → chunk.RZ5PPQBV.js} +1 -1
- package/dist/preview/{chunk.ATVPAYS6.js → chunk.SAYAFOF6.js} +1 -1
- package/dist/preview/{chunk.UM5H2VVR.js → chunk.SBLYBRDU.js} +1 -1
- package/dist/preview/{chunk.7XSDXX5Z.js → chunk.SCGF4ZPP.js} +1 -1
- package/dist/preview/{chunk.2MFXP3FB.js → chunk.SIYBHZDD.js} +1 -1
- package/dist/preview/{chunk.YMRVKG6W.js → chunk.SJALH7IX.js} +1 -1
- package/dist/preview/{chunk.P6CHNBRR.js → chunk.SKQO467Y.js} +1 -1
- package/dist/preview/chunk.SLAZFFCQ.js +1 -0
- package/dist/preview/chunk.SLPJWOKC.js +1 -0
- package/dist/preview/{chunk.ZUKYMU6C.js → chunk.TKLYUVMR.js} +1 -1
- package/dist/preview/chunk.TMAZNDA6.js +1 -0
- package/dist/preview/{chunk.4QWTSI7V.js → chunk.U2ISOUM2.js} +1 -1
- package/dist/preview/{chunk.BFN6B4C4.js → chunk.U3JK2DNC.js} +1 -1
- package/dist/preview/chunk.U5P23GO7.js +1 -0
- package/dist/preview/{chunk.Q3Y5EV5A.js → chunk.UACSX64H.js} +3 -3
- package/dist/preview/{chunk.7AMBLGVB.js → chunk.ULHB3RYK.js} +1 -1
- package/dist/preview/{chunk.NSGQXCH6.js → chunk.UO544PZH.js} +1 -1
- package/dist/preview/{chunk.L3K25NCS.js → chunk.UXOBUK3C.js} +1 -1
- package/dist/preview/{chunk.B5HLA45D.js → chunk.VKHAAH32.js} +1 -1
- package/dist/preview/{chunk.IZ2ZTNEV.js → chunk.VN7I7XIO.js} +1 -1
- package/dist/preview/{chunk.HF5SNUTK.js → chunk.VOOOIECX.js} +1 -1
- package/dist/preview/chunk.VS6NT5C4.js +1 -0
- package/dist/preview/{chunk.VFRURRNI.js → chunk.VUAOCYG2.js} +1 -1
- package/dist/preview/{chunk.P3CUCDHO.js → chunk.VX65S2FA.js} +1 -1
- package/dist/preview/chunk.VYFMUCBT.js +1 -0
- package/dist/preview/{chunk.HVUUJQRE.js → chunk.W5TVQYAI.js} +1 -1
- package/dist/preview/{chunk.LDYOQCY7.js → chunk.WD4VPMEE.js} +1 -1
- package/dist/preview/{chunk.DO45KXLM.js → chunk.WICFQROI.js} +1 -1
- package/dist/preview/{chunk.MRYN42EQ.js → chunk.WS7LAT4Z.js} +1 -1
- package/dist/preview/{chunk.CZH27V2R.js → chunk.X2I3XH2E.js} +1 -1
- package/dist/preview/{chunk.KOGUYWHG.js → chunk.XFSGB6EU.js} +1 -1
- package/dist/preview/{chunk.U7G56KXT.js → chunk.XWWSW3ZV.js} +1 -1
- package/dist/preview/chunk.XZUHFXME.js +1 -0
- package/dist/preview/{chunk.Z4CJJ4QP.js → chunk.XZWXDQ3N.js} +1 -1
- package/dist/preview/chunk.Y7H5O2SL.js +1 -0
- package/dist/preview/chunk.YFVJUHAK.js +1 -0
- package/dist/preview/chunk.YGIJDHAV.js +2 -0
- package/dist/preview/{chunk.MOAUE3N2.js → chunk.YOT7ESDG.js} +3 -3
- package/dist/preview/{chunk.QT6UV7HN.js → chunk.ZC3FRCJQ.js} +1 -1
- package/dist/preview/{chunk.6O3YPUW3.js → chunk.ZJCM62GH.js} +1 -1
- package/dist/preview/{chunk.DWHPZBPZ.js → chunk.ZKAZA6UJ.js} +1 -1
- package/dist/preview/{chunk.2XTCDFWU.js → chunk.ZQHCNFJK.js} +1 -1
- package/dist/preview/{chunk.2NJDT47T.js → chunk.ZVG3DR5G.js} +1 -1
- package/dist/preview/chunk.ZYNUMVEC.js +1 -0
- package/dist/preview/index.html +50 -50
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.2FP4KEEG.js +0 -1
- package/dist/preview/chunk.3XLOFZRM.js +0 -1
- package/dist/preview/chunk.6BLNFVB4.js +0 -1
- package/dist/preview/chunk.6E36I2GC.js +0 -1
- package/dist/preview/chunk.6IUEGPCZ.js +0 -67
- package/dist/preview/chunk.AXXYJCSW.js +0 -1
- package/dist/preview/chunk.CJUIJ6TL.js +0 -1
- package/dist/preview/chunk.E4SYOBGB.js +0 -1
- package/dist/preview/chunk.FJTVY6AE.js +0 -1
- package/dist/preview/chunk.GQHFLOTZ.js +0 -5
- package/dist/preview/chunk.KHZA5F7A.js +0 -1
- package/dist/preview/chunk.KKQXGN5U.js +0 -104
- package/dist/preview/chunk.LDLTQNJ2.js +0 -1
- package/dist/preview/chunk.LHJWII6C.js +0 -1
- package/dist/preview/chunk.MHILFBK6.js +0 -1
- package/dist/preview/chunk.MMWLLWFS.js +0 -1
- package/dist/preview/chunk.NIFQDN6R.js +0 -6
- package/dist/preview/chunk.NOLGJFA4.js +0 -2
- package/dist/preview/chunk.OLW44AP5.js +0 -1
- package/dist/preview/chunk.P52UTBNO.js +0 -4
- package/dist/preview/chunk.PCVPH5KM.js +0 -1
- package/dist/preview/chunk.Q6LLURRM.js +0 -1
- package/dist/preview/chunk.QDZAITMN.js +0 -1
- package/dist/preview/chunk.QHU3KUZZ.js +0 -1
- package/dist/preview/chunk.S6VON4LU.js +0 -1
- package/dist/preview/chunk.U37WZMUO.js +0 -1
- package/dist/preview/chunk.U5JFW2YM.js +0 -1
- package/dist/preview/chunk.V5MOMBZG.js +0 -1
- package/dist/preview/chunk.VUSJ7HPC.js +0 -1
- package/dist/preview/chunk.VXRECLX6.js +0 -1
- package/dist/preview/chunk.W66VMALY.js +0 -1
- package/dist/preview/chunk.WGVIJDV5.js +0 -1
- package/dist/preview/chunk.X3MMJ3QC.js +0 -5
- package/dist/preview/chunk.X5YRNNHU.js +0 -1
- package/dist/preview/chunk.YGZCESXY.js +0 -3
- package/dist/preview/chunk.YMC2T2HN.js +0 -1
- package/dist/preview/chunk.YN6BXZHO.js +0 -1
- package/dist/preview/chunk.ZT3NEAFI.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as Ee,b as Ve,c as qe,d as me,e as R,f as ge,h as Be}from"./chunk.PCVPH5KM.js";import{h as Ze,i as We,j as Ye}from"./chunk.N4LOI3YA.js";import{a as re,b as ae,c as J,d as Ue,e as X,g as oe,h as He}from"./chunk.HKINU7VO.js";import{c as Ce,h as z,i as Le,j as ue}from"./chunk.YGZCESXY.js";import{A as De,Ca as Ne,Db as bn,Ja as Te,Ka as te,La as pe,Ub as Me,Vb as fe,Wb as Ke,Xb as _e,Yb as Ie,b as W,c as U,e as de,f as Re,g as K,h as S,k as G,l as ee,m as _,n as Fe,nc as Pe,o as Z,oc as Ge,p as N,r as w,s as ne,t as x,u as A,v as V,w as I,x as t,y as T,z as Y}from"./chunk.X3MMJ3QC.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var ze=e=>Object.entries(e).map(([o,s])=>[o,Object.keys(te(s?.edges))]),ye=(e,o)=>Ke(e,ze(o));function Je(e){return[...Object.keys(e.acts??{}),...Object.keys(e.kinds).flatMap(o=>Me(o)),..._e(ze(e.kinds))]}var B=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Xe(e){if(!B(e)||!B(e.kinds))return e;let o;try{let f=Object.fromEntries(Object.entries(e.kinds).map(([g,a])=>[g,B(a)&&B(a.edges)?{edges:a.edges}:{}]));o=Je({acts:B(e.acts)?e.acts:{},kinds:f})}catch{return e}let s=new Set(o),n=!1,r=f=>{if(typeof f!="string"||s.has(f))return f;let g=Pe(f,o);return g===void 0?f:(n=!0,g)},l=B(e.policy)&&Array.isArray(e.policy.grants)?{...e.policy,grants:e.policy.grants.map(f=>B(f)&&Array.isArray(f.mutations)?{...f,mutations:f.mutations.map(r)}:f)}:void 0,u=B(e.rules)?Object.fromEntries(Object.entries(e.rules).map(([f,g])=>[f,B(g)&&Array.isArray(g.repairs)?{...g,repairs:g.repairs.map(a=>B(a)?{...a,act:r(a.act)}:a)}:g])):void 0;return n?{...e,...l?{policy:l}:{},...u?{rules:u}:{}}:e}function he(e,o){let s=Ge(e,Je(o));return s&&s!==e?`did you mean "${s}"?`:void 0}var $e="graview-document",we=1,Se=256*1024,se=64*1024,ke=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,be=/^[a-z][A-Za-z0-9]*$/,$n=/^[a-z0-9\u00df-\u00ff'-]+( [a-z0-9\u00df-\u00ff'-]+){0,2}$/,Qe=12,wn=new Set(["id","kind"]),Sn=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,On=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"];function jn(){let e=$=>$ in Object.prototype,o=Y($=>!e($),"every object already has this name \u2014 choose another"),s=($,L)=>[...$===void 0?[]:[Re($)],...L===void 0?[]:[de(L)]],n=($,L)=>S().check(...s($,L)),r=($,L,Q)=>N($).check(...s(L,Q)),l=$=>S().check(K(ke,`${$} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),u=S().check(K(Sn,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),o),f=S().check(K(be,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),Y($=>!wn.has($),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),o),g=n(1,500),a=S().check(de(40),K($n,'an alias is up to three lower-case words, like "supplier"')),i=n(1,2e3),d=n(1,300),h=w({type:V(On),required:t(_()),description:t(g),label:t(n(1,60)),aliases:t(r(a,1,Qe)),options:t(r(n(1,80),1,100)),optionLabels:t(A(n(1,80),n(1,80))),of:t(V(["string","number","date","image","video","file"])),default:t(Z()),unit:t(n(void 0,12)),format:t(V(["money","percent","duration","markdown"])),min:t(G()),max:t(G()),step:t(G()),renamedFrom:t(S().check(K(be))),repeats:t(_()),collaborative:t(_())}).check(De(($,L)=>{$.type==="enum"&&!$.options&&L.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),$.type!=="enum"&&$.options&&L.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]});for(let Q of Object.keys($.optionLabels??{}))$.options?.includes(Q)||L.addIssue({code:"custom",message:`"${Q}" is labeled, and is none of the field's options`,path:["optionLabels",Q]});$.type!=="list"&&$.of&&L.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),$.repeats&&$.type!=="date"&&$.type!=="datetime"&&L.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),m=S().check(K(new RegExp(`${ke.source}|${Ne.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),p=w({to:x([r(m,1),I("*")]),cardinality:t(V(["one","many"])),description:t(g),inverse:t(n(1,80)),appendOnly:t(_()),renamedFrom:t(S()),tidying:t(I("never"))}),c=x([i,w({expr:i,label:t(n(1,60)),description:t(g),format:t(V(["money","percent","duration"])),unit:t(n(1,12)),hidden:t(_())})]),j=w({noun:t(n(1,40)),plural:t(n(1,40)),aliases:t(r(a,1,Qe)),description:t(g),fields:A(f,h).check(Y($=>Object.keys($).length>0,"a kind has at least one field")),label:t(d),describe:t(d),lifecycle:t(w({field:f,retired:r(x([S(),G(),_()]),1)})),figure:t(n(void 0,2e4)),glance:t(r(f,1,20)),page:t(w({fields:t(r(f,1,40)),groups:t(r(w({title:n(1,60),fields:r(f,1,40)}),1,12))})),edges:t(A(u,p)),computed:t(A(S(),c).check(Y($=>Object.keys($).length<=20,"a kind works out at most 20 computed fields"))),fieldRoles:t(A(S(),S())),renamedFrom:t(S().check(K(ke))),people:t(_()),archives:t(I(!1)),tidying:t(V(["never","no-links"]))}),k=x([S(),G(),_(),Fe(),N(Z()),w({expr:i})]),O=S().check(K(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),E=x([w({create:l("kind"),as:t(S().check(K(be))),set:t(A(f,k))}),w({set:A(f,k),target:t(O)}),w({connect:u,from:O,to:O}),w({sever:u,from:O,to:O}),w({remove:O})]),b=w({title:t(n(1,80)),description:t(g),fromTheOtherEnd:t(n(1,80)),on:t(x([l("kind"),r(l("kind"),1)])),creates:t(l("kind")),sets:t(A(f,k)),writes:t(r(f,1)),connects:t(u),severs:t(u),setsOther:t(A(f,k)),replaces:t(x([I(!0),r(u,1,10)])),removes:t(I(!0)),args:t(A(f,h)),effects:t(r(E,1,20)),allowedWhen:t(i),refusal:t(d),destructive:t(_())}),F=w({act:l("act"),label:t(n(1,80)),args:t(A(S(),k))}),M=w({title:t(n(1,120)),description:t(g),over:x([I("graph"),l("kind")]),when:t(i),require:i,says:t(d),repairs:t(r(F,void 0,10))}),C=w({roles:x([r(l("role"),1),I("*")]),mutations:x([r(l("act"),1),I("*")]),kinds:t(x([N(l("kind")),I("*")])),describe:t(g),self:t(_()),ownEnd:t(_())}),y=t(r(l("field"),1)),v=w({roles:x([r(l("role"),1),I("*")]),kinds:r(l("kind"),1),own:t(_()),via:t(u),fields:y,hide:y}),D=w({grants:N(C),sees:t(N(v))}),ie=w({accent:t(S().check(K(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),ground:t(x([S().check(K(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"')),w({light:t(S().check(K(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"'))),dark:t(S().check(K(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#101826"')))})])),name:t(n(1,60)),currency:t(S().check(K(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:t(n(2,35)),timeZone:t(n(1,64)),logo:t(x([n(1,se),w({src:n(1,se),alt:t(n(1,120))}),w({light:n(1,se),dark:t(n(1,se)),alt:t(n(1,120)),darkFallback:t(I("invert"))})])),favicon:t(x([n(1,se),w({emoji:S()})])),typography:t(w({display:t(n(1,200)),body:t(n(1,200)),mono:t(n(1,200))})),shape:t(w({radius:t(G().check(U(0),W(32))),density:t(G().check(U(.75),W(1.5)))})),accents:t(A(S(),G().check(U(0),W(360)))),scheme:t(V(["light","dark","auto"])),subtitle:t(I(!1))}),q=A(S(),Z()),H=x([n(1,120),w({by:n(1,120),direction:t(V(["asc","desc"]))})]),xe=G().check(ee(),U(1),W(9999)),mn=ne({create:t(_()),options:t(ne({sort:t(H),columnSort:t(H),search:t(r(n(1,120),void 0,40)),filters:t(r(n(1,120),void 0,40)),horizon:t(x([G().check(ee(),U(1),W(200)),ne({years:G().check(ee(),U(1),W(200)),title:n(1,80),from:t(xe),to:t(xe)})]))}))}),gn=w({card:t(N(Z())),row:t(N(Z())),page:t(N(Z()))}),zn=()=>{let $=t(V(["asc","desc"]));return x([n(1,120),w({by:n(1,120),direction:$,then:t(x([n(1,120),w({by:n(1,120),direction:$})]))})])},yn=()=>x([n(1,120),w({by:n(1,120),order:t(r(n(1,80),void 0,40)),closed:t(r(n(1,80),void 0,40))})]),Ae=ne({order:t(N(S())),hide:t(N(S())),first:t(S()),primary:t(r(n(1,80),void 0,40)),scene:t(n(1,40)),pages:t(n(1,40)),lists:t(A(S(),w({filters:t(r(n(1,120),void 0,40)),sort:t(zn()),group:t(yn()),export:t(_())})))}),hn=w({act:l("act"),title:t(n(1,80)),intro:t(g),fields:t(r(f,1,40)),say:t(g),submit:t(n(1,80)),role:t(l("role"))}),kn=w({$schema:t(S()),format:I($e),formatVersion:I(we),name:n(1,80),description:t(g),version:t(G().check(ee(),U(1))),kinds:A(l("kind"),j).check(Y($=>Object.keys($).length>0,"a document declares at least one kind"),Y($=>Object.keys($).length<=40,"a document declares at most 40 kinds")),computed:t(A(S(),c)),acts:t(A(l("act"),b)),rules:t(A(l("rule"),M)),roles:t(N(l("role"))),policy:t(D),modules:t(q),lenses:t(N(mn)),pages:t(Ae),views:t(A(S(),x([gn,N(Z())]))),brand:t(ie),settings:t(N(q)),migrations:t(N(q)),connections:t(A(l("connection"),q)),purpose:t(q),forms:t(A(l("form"),hn)),publishing:t(w({mode:V(["live","on-publish"]),working:r(l("role"),void 0,40),publishers:t(r(l("role"),1,40))}))});return{FieldSpec:h,EdgeSpec:p,ComputedSpec:c,KindSpec:j,ValueSpec:k,EffectSpec:E,ActSpec:b,RepairSpec:F,RuleSpec:M,GrantSpec:C,SightSpec:v,PolicySpec:D,BrandSpec:ie,PagesSpec:Ae,DocumentSpec:kn}}var vn,P=()=>vn??=jn(),Un=T(()=>P().FieldSpec),Zn=T(()=>P().EdgeSpec),Wn=T(()=>P().ComputedSpec),Yn=T(()=>P().KindSpec),Hn=T(()=>P().ValueSpec),Jn=T(()=>P().EffectSpec),Xn=T(()=>P().ActSpec),Qn=T(()=>P().RepairSpec),et=T(()=>P().RuleSpec),nt=T(()=>P().GrantSpec),tt=T(()=>P().SightSpec),ot=T(()=>P().PolicySpec),st=T(()=>P().BrandSpec),it=T(()=>P().PagesSpec),en=T(()=>P().DocumentSpec);var xn={};function nn(e,o=xn,s=we){let{document:n,respelled:r}=Ee(e),l=r.length>0?{respelled:r}:{};if(!n||typeof n!="object"||Array.isArray(n))return{document:n};let u=n;if(u.format!==$e||typeof u.formatVersion!="number"||u.formatVersion>=s)return{document:n,...l};let f=u.formatVersion,g=structuredClone(u);for(let a=f;a<s;a++){let i=o[a];if(!i)throw new Error(`there is no upgrade from format ${a} to ${a+1}`);g={...i(g),formatVersion:a+1}}return{document:g,from:f,...l}}function tn(e,o,s){let n=Object.keys(e).filter(f=>e[f].edges?.[o]!==void 0);if(n.length===0)return;let r=n.map(f=>e[f].edges[o].to),l=r.some(f=>f==="*")?"*":[...new Set(r.flatMap(f=>f))];if(s.length===0||s.some(f=>n.includes(f)))return{reversed:!1,kinds:l};let u=n.filter(f=>{let g=e[f].edges[o].to;return g==="*"||s.every(a=>g.includes(a))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:l}}var rn=(e,o)=>{let s=e?.fields[o];return s!==void 0&&(s.type==="duration"||(s.type==="number"||s.type==="integer")&&s.format==="duration")};function on(e,o,s,n){if(n==="out"){let r=e[o]?.edges?.[s]?.to;return r===void 0?[]:r==="*"?Object.keys(e):r}return Object.entries(e).filter(([,r])=>{let l=r.edges?.[s]?.to;return l!==void 0&&(l==="*"||l.includes(o))}).map(([r])=>r)}function Oe(e,o,s){if(s.t==="ident")return e[o]?.edges?.[s.name]?on(e,o,s.name,"out"):void 0;if(s.t==="where")return Oe(e,o,s.set);if(s.t==="call"&&(s.fn==="out"||s.fn==="in")&&s.args[0]?.t==="lit"&&typeof s.args[0].value=="string")return on(e,o,s.args[0].value,s.fn)}var sn=(e,o,s)=>{let n=o.filter(r=>e[r]?.fields[s]!==void 0);return n.length>0&&n.every(r=>rn(e[r],s))};function an(e,o,s){let n=e.kinds,r=n[o],l=new Map(s),u=new Map,f=(a,i)=>{if(i>8)return!1;switch(a.t){case"ident":return rn(r,a.name)||g(a.name,i+1);case"member":{let d=Oe(n,o,a.object);return d!==void 0&&sn(n,d,a.name)}case"call":{if(a.fn!=="sum"&&a.fn!=="min"&&a.fn!=="max")return!1;let[d,h]=a.args,m=d&&Oe(n,o,d);return m!==void 0&&h?.t==="ident"&&sn(n,m,h.name)}case"binary":return(a.op==="+"||a.op==="-")&&f(a.left,i)&&f(a.right,i);case"unary":return a.op==="-"&&f(a.operand,i);default:return!1}},g=(a,i)=>{if(r?.computed?.[a]===void 0)return!1;if(u.has(a))return u.get(a);u.set(a,!1);let d=l.get(a),h=d!==void 0&&f(d,i);return u.set(a,h),h};return s.map(([a])=>a).filter(a=>g(a,0))}var An={title:["string","text"],rich_text:["string","text"],number:["number","integer"],select:["enum","string"],status:["enum","string"],multi_select:["list"],date:["date","datetime"],checkbox:["boolean"],url:["url","string"],email:["email","string"],phone_number:["phone","string"],people:["string","text","list"]};var cn=new Set(Object.values(An).flat());function ln(e,o){let s=new Map;if(!e||typeof e!="object")return new Map;for(let n of Object.values(e)){if(!n||typeof n!="object"||typeof n.kind!="string")continue;let r=o[n.kind]?.fields;if(!r)continue;let l=[];n.system==="google-calendar"&&n.fields&&typeof n.fields=="object"?l=Object.values(n.fields).filter(f=>typeof f=="string"):n.system==="notion"&&(l=n.properties&&typeof n.properties=="object"?Object.keys(n.properties):Object.keys(r).filter(f=>cn.has(r[f].type)));let u=s.get(n.kind)??new Set;for(let f of l)Object.hasOwn(r,f)&&u.add(f);s.set(n.kind,u)}return new Map([...s].filter(([,n])=>n.size>0).map(([n,r])=>[n,Object.keys(o[n].fields).filter(l=>r.has(l))]))}function dn(e,o,s=`kinds.${e}.page`){let n=o.page;if(!n)return[];let r=[],l=[...Object.keys(o.fields),...Object.keys(o.computed??{})],u=new Set,f=(a,i)=>{l.includes(a)?u.has(a)&&r.push(z("page-field-twice",i,`"${a}" is on ${e}'s page twice; name each field once`)):r.push(z("page-field",i,`${e}'s page is to show "${a}", and ${e} has no field or computed field called that`,`use one of: ${l.join(", ")}`)),u.add(a)};(n.fields??[]).forEach((a,i)=>f(a,`${s}.fields.${i}`));let g=new Set;return(n.groups??[]).forEach((a,i)=>{let d=a.title.trim().toLowerCase();g.has(d)&&r.push(z("page-group-twice",`${s}.groups.${i}.title`,`${e}'s page has two groups called "${a.title}"; give each its own title`)),g.add(d),a.fields.forEach((h,m)=>f(h,`${s}.groups.${i}.fields.${m}`))}),r}function pn(e,o=[]){return Ie({declared:Object.keys(e.fields),paged:[...e.page?.fields??[],...(e.page?.groups??[]).flatMap(s=>s.fields)],must:s=>!!e.fields[s].required&&e.fields[s].default===void 0,naming:o})}var En=new Set(["subject","now","today","me"]);function Rn(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>Se)return{findings:[z("too-large","",`a document may be at most ${Se/1024} KB`)]};if(typeof e=="string")try{e=JSON.parse(e)}catch(n){return{findings:[z("not-json","",`this is not JSON: ${n.message}`)]}}try{e=nn(e).document}catch(n){return{findings:[z("format","formatVersion",n.message)]}}e=Xe(e);let o=en.safeParse(e);if(!o.success)return{findings:o.error.issues.map(n=>{let r=n.path.map(String).join(".");if(n.code==="unrecognized_keys")return z("unknown-key",r,`${n.keys.map(l=>`"${l}"`).join(", ")} ${n.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(n.code==="invalid_union"&&/\.effects\.\d+$/.test(r))return z("effect-shape",r,"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(n.code==="invalid_key"){let l=n.issues?.[0]?.message;return z("shape",r,`the name "${String(n.path.at(-1))}" is not allowed here${l?`: ${l}`:""}`)}return z("shape",r,n.message)})};let s=o.data;return{document:s,findings:Fn(s)}}var le=e=>[e??[]].flat();function fn(e){let o=new Map;for(let[s,n]of Object.entries(e.kinds))for(let[r,l]of Object.entries(te(n.edges))){let u=o.get(r);o.set(r,{name:r,from:[...u?.from??[],s],to:l.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...l.to])],cardinality:l.cardinality??"many"})}return o}function It(e){let o=new Map;for(let[n,r]of Object.entries(e.kinds)){let l=oe(r),u=pe(r.edges);o.set(n,{fields:new Set([...Object.keys(r.fields),...u.keys()]),edges:new Map(Object.entries(te(r.edges)).map(([f,g])=>[f,g.cardinality??"many"])),...l?{computed:l}:{},...u.size>0?{linked:u}:{}})}let s=oe(e);return s&&o.set(Ce,{computed:s}),o}function un(e,o){let s=[],n=le(e.on),r=(l,u)=>{let f=tn(o.kinds,l,n)?.reversed===!0,[g,a]=f?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:l,from:g,to:a}:{sever:l,from:g,to:a}};if(e.creates){let l=o.kinds[e.creates],u={};for(let f of Object.keys(l?.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);s.push({create:e.creates,as:"new",set:u})}return e.sets&&s.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&s.push({set:Object.fromEntries(e.writes.map(l=>[l,`$${l}`]))}),e.connects&&(e.replaces&&s.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),s.push(r(e.connects,"connect"))),e.severs&&s.push(r(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&s.push({set:e.setsOther,target:"$to"}),e.removes&&s.push({remove:"$subject"}),e.effects&&s.push(...e.effects.filter(l=>!(e.creates&&"set"in l&&!("create"in l)&&R(l.target)==="new"))),s}function je(e,o,s){try{let n=J(e),r=re(n);for(let l of r.unknownFunctions)s.push(z("unknown-function",o,`"${l}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));return n}catch(n){if(n instanceof ae){s.push(z("expression",o,n.sentence+` (at character ${n.at+1})`));return}throw n}}function ve(e,o,s){try{return X(e)}catch(n){if(n instanceof Ue||n instanceof ae){s.push(z("template",o,(n instanceof ae,n.sentence)));return}throw n}}function Fn(e){let o=[],s=new Set(Object.keys(e.kinds)),n=fn(e),r=e.acts??{},l=new Set(e.roles??[]),u=(a,i)=>pe(e.kinds[a]?.edges).has(i),f=a=>Object.keys(e.kinds).some(i=>u(i,a));for(let[a,i]of Object.entries(e.kinds)){let d=`kinds.${a}`;for(let[m,p]of Object.entries(i.edges??{})){if(!Te(p)&&p.to!=="*")for(let c of p.to)s.has(c)||o.push(z("edge-target",`${d}.edges.${m}.to`,`"${c}" is not a kind this document declares`));i.fields[m]&&o.push(z("edge-field-clash",`${d}.edges.${m}`,`"${m}" is both a field and a relation of ${a}`,"rename one of them"))}i.lifecycle&&!i.fields[i.lifecycle.field]&&o.push(z("lifecycle-field",`${d}.lifecycle.field`,`${a} has no field "${i.lifecycle.field}"`));let h=m=>i.computed!==void 0&&Object.hasOwn(i.computed,m);for(let m of i.glance??[])!i.fields[m]&&!h(m)&&o.push(z("glance-field",`${d}.glance`,`a glance at ${a} is to say "${m}", and ${a} has no field or computed field called that`,`use one of: ${[...Object.keys(i.fields),...Object.keys(i.computed??{})].join(", ")}`));o.push(...dn(a,i));for(let m of["label","describe"]){let p=i[m];if(!p)continue;let c=ve(p,`${d}.${m}`,o);for(let j of c??[])if(j.expr){for(let k of re(j.expr).names)if(!i.fields[k]){if(h(k)){He(i,k)||o.push(z("template-field",`${d}.${m}`,`${a}'s ${k} 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 ${a}'s own fields`));continue}o.push(z("template-field",`${d}.${m}`,`${a} has no field "${k}" 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,p]of Object.entries(i.fields)){p.default!==void 0&&p.type==="enum"&&!p.options?.includes(String(p.default))&&o.push(z("default-option",`${d}.fields.${m}.default`,`"${String(p.default)}" is not one of ${m}'s options`));let c=`${m}Repeat`;p.repeats&&(i.fields[c]||i.edges?.[c]||i.computed?.[c])&&o.push(z("repeat-clash",`${d}.fields.${m}.repeats`,`${a} already has "${c}", where how ${m} repeats is kept`))}}for(let[a,i]of Object.entries(r)){let d=`acts.${a}`;for(let c of le(i.on))s.has(c)||o.push(z("act-kind",`${d}.on`,`"${c}" is not a kind this document declares`));let h=le(i.on),m=un(i,e);if(i.creates&&i.on===void 0&&i.writes&&s.has(i.creates)){for(let c of i.writes)if(!e.kinds[i.creates].fields[c])if(e.kinds[i.creates].computed?.[c]!==void 0)o.push(z("computed-written",`${d}.writes`,`${i.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(i.creates,c))continue;o.push(z("act-field",`${d}.writes`,`${i.creates} has no field "${c}"`))}}m.length===0&&o.push(z("act-empty",d,`"${a}" does nothing`,"give it effects or a shorthand such as sets or creates"));let p=new Map;m.forEach((c,j)=>{let k=m.length-(i.effects?.length??0),O=i.effects&&j>=k?`${d}.effects.${j-k}`:d;if("create"in c){if(!s.has(c.create))o.push(z("act-kind",`${O}.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?o.push(z("computed-written",`${O}.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")):o.push(z("act-field",`${O}.set.${b}`,`${c.create} has no field "${b}"`)));c.as&&p.set(c.as,c.create)}else if("connect"in c||"sever"in c){let b="connect"in c?c.connect:c.sever;!n.has(b)&&!f(b)&&o.push(z("act-edge",`${O}.${"connect"in c?"connect":"sever"}`,`"${b}" is not a relation any kind declares`)),R(c.from)==="subject"&&h.length===0&&o.push(z("act-subject",`${d}.on`,`"${a}" acts on "$subject" but does not say which kinds it is "on"`))}else if("set"in c){let b=R(c.target??"$subject"),F=b==="subject"?h:p.has(b??"")?[p.get(b)]:[];b==="subject"&&h.length===0&&o.push(z("act-subject",`${d}.on`,`"${a}" changes "$subject" but does not say which kinds it is "on"`));for(let M of Object.keys(c.set))for(let C of F)if(!(!s.has(C)||e.kinds[C].fields[M]))if(e.kinds[C].computed?.[M]!==void 0)o.push(z("computed-written",`${O}.set.${M}`,`${C}'s ${M} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(C,M))continue;o.push(z("act-field",`${O}.set.${M}`,`${C} has no field "${M}"`))}}else"remove"in c&&R(c.remove)==="subject"&&h.length===0&&o.push(z("act-subject",`${d}.on`,`"${a}" 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&&je(b.expr,`${O}.set`,o)})}),i.allowedWhen&&je(i.allowedWhen,`${d}.allowedWhen`,o),i.refusal&&ve(i.refusal,`${d}.refusal`,o)}for(let[a,i]of Object.entries(e.rules??{})){let d=`rules.${a}`;i.over!=="graph"&&!s.has(i.over)&&o.push(z("rule-kind",`${d}.over`,`"${i.over}" is not a kind this document declares`));let h=i.over==="graph"?void 0:e.kinds[i.over];for(let m of["when","require"]){let p=i[m];if(!p)continue;let c=je(p,`${d}.${m}`,o);if(!c)continue;let j=re(c);for(let k of j.names)if(i.over==="graph")o.push(z("rule-name",`${d}.${m}`,`"${k}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(h&&!h.fields[k]&&!h.edges?.[k]&&h.computed?.[k]===void 0){let O=Object.keys(h.edges??{}).find(E=>E.includes("-")&&E.split("-").includes(k));o.push(z("rule-name",`${d}.${m}`,`${i.over} has no field or relation called "${k}"`,O?`"${O}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${O.replace(/-([a-z0-9])/g,(E,b)=>b.toUpperCase())}"`:void 0))}for(let k of j.edges)!n.has(k)&&!f(k)&&o.push(z("rule-edge",`${d}.${m}`,`"${k}" is not a relation any kind declares`));for(let k of j.sweeps)s.has(k)?i.over!=="graph"&&o.push(Le("rule-cost",`${d}.${m}`,`this rule looks at every ${k} for every ${i.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):o.push(z("rule-kind",`${d}.${m}`,`"${k}" is not a kind this document declares`))}i.says&&ve(i.says,`${d}.says`,o),(i.repairs??[]).forEach((m,p)=>{!r[m.act]&&!fe(m.act)&&!ye(m.act,e.kinds)&&o.push(z("repair-act",`${d}.repairs.${p}.act`,`"${m.act}" is not an act this document declares`,he(m.act,e)))})}let g=e.policy;return g&&(g.grants.forEach((a,i)=>{if(a.roles!=="*"&&l.size>0)for(let d of a.roles)l.has(d)||o.push(z("grant-role",`policy.grants.${i}.roles`,`"${d}" is not one of the document's roles`));if(a.mutations!=="*")for(let d of a.mutations)!r[d]&&!fe(d)&&!ye(d,e.kinds)&&o.push(z("grant-act",`policy.grants.${i}.mutations`,`"${d}" is not an act this document declares`,he(d,e)))}),(g.sees??[]).forEach((a,i)=>{for(let d of a.kinds)s.has(d)||o.push(z("sight-kind",`policy.sees.${i}.kinds`,`"${d}" is not a kind this document declares`));if(a.roles!=="*"&&l.size>0)for(let d of a.roles)l.has(d)||o.push(z("sight-role",`policy.sees.${i}.roles`,`"${d}" is not one of the document's roles`))})),o.push(...Ye(e)),o}function Dn(e){return e.label?[...e.label.matchAll(/\{\s*([A-Za-z_][A-Za-z0-9_]*)/g)].map(o=>o[1]):[ge(e)??[]].flat()}function Nn(e,o,s,n){let r=new Map,l=le(e.on),u=new Map,f=new Map;(l.length>0||o.some(p=>"remove"in p&&R(p.remove)==="subject"||"from"in p&&(R(p.from)==="subject"||R(p.to)==="subject")||"set"in p&&!("create"in p)&&R(p.target??"$subject")==="subject"))&&r.set(me,{ref:l.length>0?l:"*",required:!0});let a=e.args??{},i=e.writes?.length===1,d=(p,c)=>c&&p.type===c.type&&p.min===void 0&&p.max===void 0&&p.step===void 0?{...p,...c.min===void 0?{}:{min:c.min},...c.max===void 0?{}:{max:c.max},...c.step===void 0?{}:{step:c.step}}:p,h=(p,c)=>c&&p.type===c.type&&p.format===void 0&&p.unit===void 0?{...d(p,c),...c.format?{format:c.format}:{},...c.unit?{unit:c.unit}:{}}:d(p,c),m=(p,c,j)=>{if(p===me||En.has(p)||u.has(p)||r.has(p))return;let k=a[p]?h(a[p],j):void 0;r.set(p,k?{field:k,optional:!k.required,required:!!k.required}:c())};for(let p of o)if("create"in p){let c=s.kinds[p.create],j=c?pn(c,Dn(c)):[],k=O=>j.includes(O)?j.indexOf(O):j.length;for(let[O,E]of Object.entries(p.set??{}).sort(([b],[F])=>k(b)-k(F))){let b=R(E),F=c?.fields[O];if(b&&F){let M=!!F.required&&F.default===void 0;m(b,()=>({field:F,optional:!M,required:M}),F)}}p.as&&u.set(p.as,p.create)}else if("connect"in p||"sever"in p){let c=n.get("connect"in p?p.connect:p.sever);for(let[j,k]of[["from",p.from],["to",p.to]]){let O=R(k);if(!O)continue;let E=j==="to"?c?.to??"*":c?.from??"*";E!=="*"&&!f.has(O)&&f.set(O,E),m(O,()=>({ref:E,required:!0}))}}else if("set"in p){let c=R(p.target??"$subject"),j=c==="subject"?l[0]:u.get(c??"")??f.get(c??"")?.[0];c&&c!=="subject"&&!u.has(c)&&m(c,()=>({ref:"*",required:!0}));for(let[k,O]of Object.entries(p.set)){let E=R(O);if(!E)continue;let b=j?s.kinds[j]?.fields[k]:void 0;m(E,()=>b?{field:b,optional:!i,required:i}:{any:!0,required:!1},b)}}else if("remove"in p){let c=R(p.remove);c&&m(c,()=>({ref:"*",required:!0}))}for(let[p,c]of Object.entries(a))r.has(p)||r.set(p,{field:c,optional:!c.required,required:!!c.required});return r}function Pt(e,o={}){let s=Rn(e);if(!s.document||ue(s.findings))return{ok:!1,findings:s.findings};let n=s.document,r=[...s.findings];o.previous&&r.push(...Mn(n,o.previous));let l=Tn(n,r);return ue(l.findings)?{ok:!1,findings:l.findings}:Be(l,o)}function ce(e,o){return e.map(s=>{let n=!s.format&&s.expr?.t==="ident"?o?.[s.expr.name]?.format:void 0;return n==="money"||n==="percent"?{...s,format:n}:s})}function Tn(e,o){let s=fn(e),n={},r=ln(e.connections,e.kinds);for(let[i,d]of Object.entries(e.kinds)){let h=ge(d),m=d.label??(h?`{${h}}`:void 0),p=oe(d),c=p?an(e,i,[...p]):[];n[i]={...m?{label:ce(X(m),d.fields)}:{},...d.describe?{describe:ce(X(d.describe),d.fields)}:{},...p?{computed:[...p]}:{},...c.length>0?{durations:c}:{},...r.has(i)?{keptInStep:r.get(i)}:{}}}let l={};for(let[i,d]of Object.entries(e.acts??{})){let h=un(d,e),m=Nn(d,h,e,s),p=d.destructive??h.some(y=>"remove"in y||"sever"in y||"replace"in y),c=[...new Set(h.flatMap(y=>"create"in y?[y.create]:[]))],j=[...new Set(h.flatMap(y=>"connect"in y?[y.connect]:[]))],k=[...new Set(h.flatMap(y=>"sever"in y?[y.sever]:"replace"in y?y.replace:[]))],O=[...new Set(h.flatMap(y=>"set"in y&&!("create"in y)&&R(y.target??"$subject")==="subject"?Object.keys(y.set):[]))],E=new Map;for(let y of h){if(!("connect"in y)&&!("sever"in y))continue;let v=s.get("connect"in y?y.connect:y.sever);for(let[D,ie]of[["from",y.from],["to",y.to]]){let q=R(ie),H=D==="to"?v?.to:v?.from;q&&q!=="subject"&&H&&H!=="*"&&E.set(q,[...new Set([...E.get(q)??[],...H])])}}let b={};for(let y of h){if(!("set"in y)||"create"in y)continue;let v=R(y.target??"$subject");for(let D of v&&v!=="subject"&&E.get(v)||[])b[D]=[...new Set([...b[D]??[],...Object.keys(y.set)])]}let F={};for(let y of h)if(!(!("set"in y)||"create"in y||R(y.target??"$subject")!=="subject"))for(let[v,D]of Object.entries(y.set??{}))typeof D=="string"&&R(D)===void 0||typeof D=="number"||typeof D=="boolean"?F[v]=typeof D=="string"&&D.startsWith("$$")?D.slice(1):D:delete F[v];let M=c.length===0&&h.every(y=>!("set"in y)||!y.set||Object.values(y.set).every(v=>!(v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v))),C=new Map;for(let y of h)if(!(!("set"in y)||!y.set))for(let v of Object.values(y.set))v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v&&C.set(v.expr,J(v.expr));l[i]={title:d.title??i.replace(/-/g," "),effects:h,args:[...m],...d.allowedWhen?{guard:J(d.allowedWhen)}:{},...d.refusal?{refusal:ce(X(d.refusal),e.kinds[[d.on??[]].flat()[0]??""]?.fields)}:{},exprs:[...C],destructive:p,idempotent:M,creates:c,connects:j,severs:k,writes:O,writesOther:b,sets:F}}let u={};for(let[i,d]of Object.entries(e.rules??{}))u[i]={title:d.title??i.replace(/-/g," "),require:J(d.require),...d.when?{when:J(d.when)}:{},...d.says?{says:ce(X(d.says),e.kinds[d.over]?.fields)}:{}};let f=Ve(e,o),g=Ze(e),a=We(e);return{format:qe,document:e,findings:o,kinds:n,...e.computed?{facts:[...oe(e)??[]]}:{},edges:[...s].map(([i,{from:d,to:h,cardinality:m}])=>[i,{from:d,to:h,cardinality:m}]),acts:l,rules:u,brand:f,...Object.keys(g).length>0?{viewSpecs:g}:{},...a?{home:a}:{}}}function Gt(e,o,s){let n=/^defineNode\("([^"]+)"\)/.exec(o)?.[1],r=n?s.kinds[n]:void 0;if(!n||!r)return e;let l=Object.keys(r.fields).filter(u=>u!=="label").slice(0,3);return{...e,path:`kinds.${n}.glance`,fix:`Say which: "glance": [${l.map(u=>`"${u}"`).join(", ")}] on kinds.${n} \u2014 the facts a person compares one by, at a glance.`}}function Mn(e,o){let s=[],n=new Set(Object.values(o.kinds).flatMap(r=>Object.keys(r.edges??{})));for(let[r,l]of Object.entries(e.kinds)){let u=l.renamedFrom;u&&!o.kinds[u]&&s.push(z("renamed-from-nothing",`kinds.${r}.renamedFrom`,`${r} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let f=o.kinds[u??r];for(let[g,a]of Object.entries(l.fields)){let i=a.renamedFrom;i&&!f?.fields[i]&&s.push(z("renamed-from-nothing",`kinds.${r}.fields.${g}.renamedFrom`,`${g} says it was ${i}, and the previous ${u??r} has no field called ${i}`,"name the field it was, or drop renamedFrom"))}for(let[g,a]of Object.entries(l.edges??{})){let i=a.renamedFrom;i&&!n.has(i)&&s.push(z("renamed-from-nothing",`kinds.${r}.edges.${g}.renamedFrom`,`${g} says it was ${i}, and the previous version has no relation called ${i}`,"name the relation it was, or drop renamedFrom"))}}return s}export{bn as ActRefusal,Pt as compileDocumentWithoutCheck,un as effectsOf,Gt as inDocumentWords,It as kindShapes,Rn as readDocument};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk.QHU3KUZZ.js";import"./chunk.YMRVKG6W.js";import"./chunk.P3CUCDHO.js";import"./chunk.OVSZXILB.js";import"./chunk.BDBLGGFJ.js";import"./chunk.IZ2ZTNEV.js";import"./chunk.CJUIJ6TL.js";import"./chunk.UITZ74YJ.js";import{b as n}from"./chunk.E4SYOBGB.js";import"./chunk.QLTHHWBA.js";import"./chunk.GZHZLJBF.js";import"./chunk.KHZA5F7A.js";import"./chunk.OJGHDWI6.js";import"./chunk.KSVJHSRH.js";import"./chunk.NSGQXCH6.js";import"./chunk.SZG6HJWH.js";import"./chunk.2FOIJ5ID.js";import"./chunk.6IUEGPCZ.js";import"./chunk.CUJX3IVA.js";import{T as i}from"./chunk.VNJKGSGZ.js";import"./chunk.SDO3U72B.js";import"./chunk.X3MMJ3QC.js";import"./chunk.FQLNBIQ5.js";import{b as o}from"./chunk.AJZBJBMO.js";var e=o(i(),1);function m({entries:d,style:l,headingStyle:p,className:r}){return(0,e.jsxs)("section",{...r?{className:r}:{},"data-testid":"record-ai","aria-label":"What AI did here",style:{display:"grid",gap:10,...l},children:[(0,e.jsx)("h2",{style:p??{margin:0,fontSize:"1rem"},children:"What AI did here"}),(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8,fontSize:"0.875rem"},children:d.slice(0,8).map(t=>(0,e.jsx)(n,{entry:t,undo:s=>(0,e.jsx)(a,{batch:s})},t.id))})]})}export{m as RecordInteractions};
|