graview 0.1.62 → 0.1.63
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/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/preview/{chunk.THVC2BEC.js → chunk.24HNOLUS.js} +1 -1
- package/dist/preview/chunk.25CQCCLN.js +1 -0
- package/dist/preview/{chunk.YP2QSPXU.js → chunk.26H33GJC.js} +1 -1
- package/dist/preview/{chunk.DPEIT3TW.js → chunk.2F4AZZQR.js} +1 -1
- package/dist/preview/chunk.2KIWGQXC.js +2 -0
- package/dist/preview/{chunk.UQQKDBIH.js → chunk.2PJ6STKA.js} +1 -1
- package/dist/preview/{chunk.ELTV44HU.js → chunk.2RASWDMQ.js} +2 -2
- package/dist/preview/chunk.33XNYHI6.js +1 -0
- package/dist/preview/{chunk.TIALD6SC.js → chunk.34DRUCH2.js} +1 -1
- package/dist/preview/{chunk.MDEX6ZVE.js → chunk.36OE6RKG.js} +1 -1
- package/dist/preview/{chunk.A3OL2BI2.js → chunk.37FLKAVZ.js} +1 -1
- package/dist/preview/chunk.3JCHJLH6.js +1 -0
- package/dist/preview/chunk.3OQ6S6H4.js +1 -0
- package/dist/preview/chunk.47QEWSSE.js +1 -0
- package/dist/preview/{chunk.7M4HNKDR.js → chunk.4DAKQXDG.js} +1 -1
- package/dist/preview/{chunk.QIPASE42.js → chunk.4EXC26LI.js} +1 -1
- package/dist/preview/{chunk.VJBBVLGZ.js → chunk.4MEQUUG4.js} +1 -1
- package/dist/preview/{chunk.Y2YYH3JN.js → chunk.4TH3CGAZ.js} +1 -1
- package/dist/preview/{chunk.PZQNR4KZ.js → chunk.57YDGGJK.js} +1 -1
- package/dist/preview/{chunk.O75HWF3F.js → chunk.5GC4VAHU.js} +1 -1
- package/dist/preview/{chunk.WEOVK2T4.js → chunk.5QXQ7PBI.js} +1 -1
- package/dist/preview/chunk.6CSHRMJC.js +1 -0
- package/dist/preview/chunk.6HKWAHPT.js +1 -0
- package/dist/preview/{chunk.TM4EPUNO.js → chunk.6XHPBJ5F.js} +1 -1
- package/dist/preview/chunk.6YK5E7ZQ.js +4 -0
- package/dist/preview/{chunk.LGRLVJGS.js → chunk.6Z2GHQQH.js} +3 -3
- package/dist/preview/chunk.72YXFJKC.js +2 -0
- package/dist/preview/{chunk.T3UQ7ZQK.js → chunk.735AFUP5.js} +1 -1
- package/dist/preview/chunk.75GENXGP.js +1 -0
- package/dist/preview/{chunk.KMV6PJFL.js → chunk.A2R53GWF.js} +1 -1
- package/dist/preview/{chunk.OWT3VVOT.js → chunk.AHPYNDVA.js} +2 -2
- package/dist/preview/chunk.ATDIDPKZ.js +1 -0
- package/dist/preview/{chunk.F7YXLYLX.js → chunk.AW26EETU.js} +1 -1
- package/dist/preview/{chunk.I77ZGIFE.js → chunk.AWUO3M5D.js} +1 -1
- package/dist/preview/{chunk.AQRB7LDA.js → chunk.B46UZHGW.js} +1 -1
- package/dist/preview/{chunk.A3ZC2JBO.js → chunk.B5PJCYBU.js} +1 -1
- package/dist/preview/{chunk.VACKSKGJ.js → chunk.BF3EZCG3.js} +1 -1
- package/dist/preview/chunk.BKQICGFW.js +1 -0
- package/dist/preview/{chunk.DDUCIUVW.js → chunk.BN7C5ZYX.js} +1 -1
- package/dist/preview/chunk.BQM3YAMR.js +35 -0
- package/dist/preview/chunk.C65EHQ7V.js +1 -0
- package/dist/preview/{chunk.B23WZQXQ.js → chunk.CAXILB7K.js} +1 -1
- package/dist/preview/{chunk.UVA7AALY.js → chunk.CCQMDZHO.js} +1 -1
- package/dist/preview/{chunk.G4ULQK64.js → chunk.CGK2PY76.js} +1 -1
- package/dist/preview/{chunk.DEAP3H2L.js → chunk.CI4RZL4Z.js} +1 -1
- package/dist/preview/chunk.CYTTZOYL.js +25 -0
- package/dist/preview/chunk.D5LOTCBU.js +3 -0
- package/dist/preview/chunk.DBFJVVWF.js +1 -0
- package/dist/preview/{chunk.7XLS6XTY.js → chunk.DDFRFSVN.js} +1 -1
- package/dist/preview/{chunk.GX4G4BX3.js → chunk.DIFIHNR3.js} +1 -1
- package/dist/preview/{chunk.VN23AGIY.js → chunk.DWK3GXRR.js} +1 -1
- package/dist/preview/{chunk.ZN3PUM2I.js → chunk.DZSZUX34.js} +1 -1
- package/dist/preview/chunk.E3XJMO7Q.js +1 -0
- package/dist/preview/chunk.EJ2WE764.js +18 -0
- package/dist/preview/{chunk.22BZU7ME.js → chunk.EJ4MSVX2.js} +1 -1
- package/dist/preview/chunk.ERPILTRY.js +1 -0
- package/dist/preview/{chunk.DC35FJAB.js → chunk.FFXBDOKA.js} +1 -1
- package/dist/preview/{chunk.UXMPFPFH.js → chunk.FGDGTES4.js} +2 -2
- package/dist/preview/chunk.FNVGNISQ.js +3 -0
- package/dist/preview/{chunk.ROZTJ6IY.js → chunk.FXCQJPN4.js} +1 -1
- package/dist/preview/chunk.G2JAYG2Z.js +1 -0
- package/dist/preview/{chunk.UFDJXQQQ.js → chunk.GHN62OMG.js} +6 -6
- package/dist/preview/{chunk.5ODHHH35.js → chunk.H5SN46VK.js} +1 -1
- package/dist/preview/{chunk.W4BKYSZX.js → chunk.H7AH3IW4.js} +1 -1
- package/dist/preview/{chunk.6JO5HQDR.js → chunk.HMMK7LCL.js} +1 -1
- package/dist/preview/{chunk.SVPKUWZU.js → chunk.HOFATBGD.js} +1 -1
- package/dist/preview/{chunk.JT3MFPRD.js → chunk.HRNNRA2I.js} +1 -1
- package/dist/preview/{chunk.7KVUUEZA.js → chunk.HSMJHCR3.js} +1 -1
- package/dist/preview/{chunk.RPDH32XV.js → chunk.IEDCFSN5.js} +1 -1
- package/dist/preview/{chunk.PCDUV3WP.js → chunk.JIEDJEHK.js} +1 -1
- package/dist/preview/chunk.JNIDS66Z.js +1 -0
- package/dist/preview/{chunk.DDO3GLEJ.js → chunk.JO3BBRSR.js} +1 -1
- package/dist/preview/{chunk.H5S7OL2U.js → chunk.JVDPRQ7J.js} +1 -1
- package/dist/preview/{chunk.SEHRPTNA.js → chunk.K7TK3KRB.js} +1 -1
- package/dist/preview/{chunk.ELOFPE25.js → chunk.KB5BCW23.js} +1 -1
- package/dist/preview/{chunk.6AKW7TXM.js → chunk.KL5H7KEV.js} +1 -1
- package/dist/preview/{chunk.ILIIBSGA.js → chunk.KPQLM4TM.js} +1 -1
- package/dist/preview/{chunk.2N4Z5K5S.js → chunk.KQPKYWDM.js} +1 -1
- package/dist/preview/{chunk.QHY5NVYH.js → chunk.KXFNRJ46.js} +1 -1
- package/dist/preview/chunk.KZUMXT5J.js +74 -0
- package/dist/preview/chunk.MAHNJO6U.js +1 -0
- package/dist/preview/{chunk.AJSUHPBE.js → chunk.MBB5A6BT.js} +1 -1
- package/dist/preview/chunk.MENLUNM5.js +1 -0
- package/dist/preview/{chunk.PLTH2LW5.js → chunk.MIE3ODQ2.js} +1 -1
- package/dist/preview/{chunk.QDWSU47A.js → chunk.MT5DXJKN.js} +1 -1
- package/dist/preview/{chunk.AFNSAQEQ.js → chunk.MY5HJW2Z.js} +1 -1
- package/dist/preview/{chunk.5HGD6OWL.js → chunk.N3T2O6EW.js} +2 -2
- package/dist/preview/{chunk.66P5IDTH.js → chunk.NEPQBMFT.js} +1 -1
- package/dist/preview/{chunk.NOGGSLVG.js → chunk.NIAM7OTV.js} +1 -1
- package/dist/preview/{chunk.BZMQDEIY.js → chunk.NTC2H5ZX.js} +1 -1
- package/dist/preview/chunk.NWWJNNEK.js +2 -0
- package/dist/preview/{chunk.5J3O2FVG.js → chunk.O3YIWIVQ.js} +1 -1
- package/dist/preview/chunk.O67JXUVG.js +1 -0
- package/dist/preview/{chunk.4HEFUOLV.js → chunk.OIMGD7FR.js} +1 -1
- package/dist/preview/{chunk.DD2NKFDX.js → chunk.OM2NIQWA.js} +1 -1
- package/dist/preview/chunk.OMRQTLI5.js +1 -0
- package/dist/preview/{chunk.O2BHPYA4.js → chunk.OTSBF367.js} +2 -2
- package/dist/preview/{chunk.Y4FZKUOK.js → chunk.OXWOUE3W.js} +1 -1
- package/dist/preview/{chunk.2B6P4GPS.js → chunk.PDMX3GTL.js} +1 -1
- package/dist/preview/{chunk.75GVFX7L.js → chunk.PDS4HT46.js} +1 -1
- package/dist/preview/{chunk.EVBCEEQ4.js → chunk.PWAP2GJS.js} +1 -1
- package/dist/preview/chunk.Q2EGESEZ.js +1 -0
- package/dist/preview/{chunk.L3WTKQQL.js → chunk.Q4GJIJAU.js} +1 -1
- package/dist/preview/chunk.Q4MI53KK.js +5 -0
- package/dist/preview/{chunk.SWMDFXUX.js → chunk.QAMW5QDT.js} +1 -1
- package/dist/preview/{chunk.M4AYA2PL.js → chunk.QS32TO4N.js} +1 -1
- package/dist/preview/{chunk.BLUKSGI4.js → chunk.QSPLKCTX.js} +1 -1
- package/dist/preview/{chunk.WPXPVD33.js → chunk.R4HDKNT3.js} +1 -1
- package/dist/preview/chunk.REUMBCSV.js +1 -0
- package/dist/preview/{chunk.MAKODQO3.js → chunk.RUFYORIJ.js} +1 -1
- package/dist/preview/{chunk.5YAOKOGV.js → chunk.SGPXYDSG.js} +1 -1
- package/dist/preview/chunk.SJUXFPTI.js +1 -0
- package/dist/preview/{chunk.OUDATENL.js → chunk.SME4HD5I.js} +1 -1
- package/dist/preview/{chunk.2GEJNG2U.js → chunk.SMHP2CQH.js} +1 -1
- package/dist/preview/chunk.SSAETRHR.js +5 -0
- package/dist/preview/{chunk.MYNMBOLD.js → chunk.STDJ6XG5.js} +1 -1
- package/dist/preview/{chunk.IQ3PRWGO.js → chunk.T3JIZNE7.js} +2 -2
- package/dist/preview/chunk.T535ZLRM.js +1 -0
- package/dist/preview/{chunk.QGU5QTR6.js → chunk.UAVK54Z6.js} +1 -1
- package/dist/preview/{chunk.RD2X25XB.js → chunk.V4HVFLFQ.js} +1 -1
- package/dist/preview/chunk.V6IL7CIZ.js +1 -0
- package/dist/preview/{chunk.T6WHGKWR.js → chunk.VCTAFSZ5.js} +1 -1
- package/dist/preview/{chunk.OWOOKLIU.js → chunk.VZDHRY3U.js} +1 -1
- package/dist/preview/{chunk.X6KYRBL6.js → chunk.WBS7ND2C.js} +1 -1
- package/dist/preview/chunk.WNS5LEO5.js +1 -0
- package/dist/preview/chunk.WUVXIUA7.js +1 -0
- package/dist/preview/{chunk.Z2TDZSMN.js → chunk.WYPCLZL7.js} +1 -1
- package/dist/preview/{chunk.IQMD7DG3.js → chunk.XBYJCGPU.js} +1 -1
- package/dist/preview/{chunk.CHHYIMB7.js → chunk.XCEZCOX4.js} +1 -1
- package/dist/preview/{chunk.CY3ELWCM.js → chunk.XCWZFLIB.js} +1 -1
- package/dist/preview/chunk.XIW4SZHD.js +1 -0
- package/dist/preview/{chunk.FULEUL34.js → chunk.XUO67YMT.js} +1 -1
- package/dist/preview/{chunk.RYRQ66JN.js → chunk.XUXZW7DU.js} +1 -1
- package/dist/preview/chunk.XYGNS637.js +1 -0
- package/dist/preview/{chunk.H7N7WN4U.js → chunk.Y4ZM75WL.js} +1 -1
- package/dist/preview/{chunk.5STU3KYG.js → chunk.YOUB3J3Y.js} +1 -1
- package/dist/preview/{chunk.3FON2Y72.js → chunk.YXAKHXYB.js} +1 -1
- package/dist/preview/chunk.YZBJUAS6.js +1 -0
- package/dist/preview/{chunk.7V56P2A7.js → chunk.Z2ZQJ3DD.js} +1 -1
- package/dist/preview/{chunk.OFWNMTGB.js → chunk.ZELWW7UA.js} +2 -2
- package/dist/preview/{chunk.N6EJXXQK.js → chunk.ZLTHWCKL.js} +2 -2
- package/dist/preview/chunk.ZP7JEVVU.js +1 -0
- package/dist/preview/{chunk.NUWDMH47.js → chunk.ZRH5X3MR.js} +1 -1
- package/dist/preview/{chunk.DNVWSWL2.js → chunk.ZSGDVNVN.js} +1 -1
- package/dist/preview/chunk.ZVG4FXJK.js +1 -0
- package/dist/preview/chunk.ZY7US4Y7.js +6 -0
- package/dist/preview/{chunk.4TX6VCBT.js → chunk.ZZAI57VI.js} +1 -1
- package/dist/preview/index.html +53 -52
- package/dist/preview/page.js +2 -2
- package/dist/preview/splash.js +7 -6
- package/package.json +6 -6
- package/dist/preview/chunk.2AT3GRXM.js +0 -1
- package/dist/preview/chunk.4HRYB7HF.js +0 -1
- package/dist/preview/chunk.5MZYCELA.js +0 -6
- package/dist/preview/chunk.7OBIBPYH.js +0 -1
- package/dist/preview/chunk.7YOAW7ED.js +0 -1
- package/dist/preview/chunk.ACTXR2MI.js +0 -3
- package/dist/preview/chunk.AI34V6WV.js +0 -74
- package/dist/preview/chunk.CAKFNKN5.js +0 -1
- package/dist/preview/chunk.CGALLZ54.js +0 -1
- package/dist/preview/chunk.DHJ3FQTR.js +0 -1
- package/dist/preview/chunk.DZZL5IDD.js +0 -5
- package/dist/preview/chunk.H24OC6OE.js +0 -1
- package/dist/preview/chunk.H73ZPYUX.js +0 -1
- package/dist/preview/chunk.HANJZ6FA.js +0 -1
- package/dist/preview/chunk.HIMQ65QT.js +0 -1
- package/dist/preview/chunk.IQPILSV3.js +0 -18
- package/dist/preview/chunk.IYBEXENQ.js +0 -1
- package/dist/preview/chunk.J7Q2WAF4.js +0 -28
- package/dist/preview/chunk.JYFZCJ4N.js +0 -2
- package/dist/preview/chunk.KDXU5DT3.js +0 -1
- package/dist/preview/chunk.KL7E4YHJ.js +0 -1
- package/dist/preview/chunk.LAYQ5PFS.js +0 -1
- package/dist/preview/chunk.LTZUF5VG.js +0 -1
- package/dist/preview/chunk.M7RESZB6.js +0 -25
- package/dist/preview/chunk.MGALQLRW.js +0 -1
- package/dist/preview/chunk.NAD7ZXYP.js +0 -1
- package/dist/preview/chunk.NHTGAP3G.js +0 -3
- package/dist/preview/chunk.NUYA4BWI.js +0 -1
- package/dist/preview/chunk.OKZT2QBM.js +0 -2
- package/dist/preview/chunk.OUPURRDE.js +0 -1
- package/dist/preview/chunk.PD2DECOP.js +0 -1
- package/dist/preview/chunk.PKWQKFPE.js +0 -2
- package/dist/preview/chunk.RMR24LFJ.js +0 -4
- package/dist/preview/chunk.RRKI24WY.js +0 -1
- package/dist/preview/chunk.SGCW2XRC.js +0 -1
- package/dist/preview/chunk.SS7234R6.js +0 -1
- package/dist/preview/chunk.TKUNRFDE.js +0 -1
- package/dist/preview/chunk.U6ZRJKVM.js +0 -1
- package/dist/preview/chunk.UKQUUPKE.js +0 -1
- package/dist/preview/chunk.VC3V7HLL.js +0 -1
- package/dist/preview/chunk.VIH5AX7S.js +0 -5
- package/dist/preview/chunk.WKI5INH7.js +0 -1
- package/dist/preview/chunk.Y4S7CDRB.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as fe,b as Ne,d as Ze,e as He,f as he,g as F,h as ke,j as We}from"./chunk.75GENXGP.js";import{h as Je,i as Xe,j as Qe}from"./chunk.4EXC26LI.js";import{a as ae,b as ce,c as J,d as Ye,e as Q,g as se,h as en}from"./chunk.AHPYNDVA.js";import{c as Be,h as k,i as Ue,j as ze,t as ye}from"./chunk.FNVGNISQ.js";import{A as re,Ha as Ie,Ic as qe,Jc as Ve,Oa as Ke,Pa as oe,Qa as me,b as Z,c as U,e as ue,f as Me,g as P,h as O,hc as Pe,ic as ge,jc as Le,k as L,kc as Ge,l as X,lc as Ce,m as _,n as _e,o as H,p as I,r as $,s as te,t as R,u as j,v as C,w as T,x as n,y as N,z as Y}from"./chunk.Q4MI53KK.js";var be=e=>Object.entries(e).map(([s,i])=>[s,Object.keys(oe(i?.edges))]),$e=(e,s)=>Le(e,be(s));function nn(e){return[...Object.keys(e.acts??{}),...Object.keys(e.kinds).flatMap(s=>Pe(s)),...Ge(be(e.kinds))]}var V=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function tn(e){if(!V(e)||!V(e.kinds))return e;let s;try{let f=Object.fromEntries(Object.entries(e.kinds).map(([g,l])=>[g,V(l)&&V(l.edges)?{edges:l.edges}:{}]));s=nn({acts:V(e.acts)?e.acts:{},kinds:f})}catch{return e}let i=new Set(s),t=!1,o=f=>{if(typeof f!="string"||i.has(f))return f;let g=qe(f,s);return g===void 0?f:(t=!0,g)},a=V(e.policy)&&Array.isArray(e.policy.grants)?{...e.policy,grants:e.policy.grants.map(f=>V(f)&&Array.isArray(f.mutations)?{...f,mutations:f.mutations.map(o)}:f)}:void 0,u=V(e.rules)?Object.fromEntries(Object.entries(e.rules).map(([f,g])=>[f,V(g)&&Array.isArray(g.repairs)?{...g,repairs:g.repairs.map(l=>V(l)?{...l,act:o(l.act)}:l)}:g])):void 0;return t?{...e,...a?{policy:a}:{},...u?{rules:u}:{}}:e}function we(e,s){let i=Ve(e,nn(s));return i&&i!==e?`did you mean "${i}"?`:void 0}var Oe="graview-document",je=1,xe=256*1024,ee=64*1024,vn=["plain","editorial","shader","ascii"];var Se=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ve=/^[a-z][A-Za-z0-9]*$/,On=/^[a-z0-9\u00df-\u00ff'-]+( [a-z0-9\u00df-\u00ff'-]+){0,2}$/,on=12,sn=60,jn=new Set(["id","kind"]),xn=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,An=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"];function En(){let e=h=>h in Object.prototype,s=Y(h=>!e(h),"every object already has this name \u2014 choose another"),i=(h,D)=>[...h===void 0?[]:[Me(h)],...D===void 0?[]:[ue(D)]],t=(h,D)=>O().check(...i(h,D)),o=(h,D,ne)=>I(h).check(...i(D,ne)),a=h=>O().check(P(Se,`${h} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),u=O().check(P(xn,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),s),f=O().check(P(ve,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),Y(h=>!jn.has(h),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),s),g=t(1,500),l=O().check(ue(40),P(On,'an alias is up to three lower-case words, like "supplier"')),r=t(1,2e3),p=t(1,300),y=$({type:C(An),required:n(_()),description:n(g),label:n(t(1,60)),aliases:n(o(l,1,on)),options:n(o(t(1,80),1,100)),multiple:n(_()),optionLabels:n(j(t(1,80),t(1,80))),of:n(C(["string","number","date","image","video","file"])),default:n(H()),unit:n(t(void 0,12)),format:n(C(["money","percent","duration","markdown"])),places:n(T(0)),min:n(L()),max:n(L()),step:n(L()),renamedFrom:n(O().check(P(ve))),repeats:n(_()),collaborative:n(_())}).check(re((h,D)=>{h.type==="enum"&&!h.options&&D.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),h.type!=="enum"&&h.options&&D.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]}),h.type!=="enum"&&h.multiple!==void 0&&D.addIssue({code:"custom",message:'"multiple" belongs only on an enum field: a choice that takes several of its options',path:["multiple"]});for(let ne of Object.keys(h.optionLabels??{}))h.options?.includes(ne)||D.addIssue({code:"custom",message:`"${ne}" is labeled, and is none of the field's options`,path:["optionLabels",ne]});h.type!=="list"&&h.of&&D.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),h.places!==void 0&&!(h.format==="money"||!h.format&&/^[A-Z]{3}$/.test(h.unit??""))&&D.addIssue({code:"custom",message:'"places" belongs only on money: a number field with "format": "money"',path:["places"]}),h.repeats&&h.type!=="date"&&h.type!=="datetime"&&D.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),m=O().check(P(new RegExp(`${Se.source}|${Ie.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),d=$({to:R([o(m,1),T("*")]),cardinality:n(C(["one","many"])),description:n(g),inverse:n(t(1,80)),appendOnly:n(_()),renamedFrom:n(O()),tidying:n(T("never"))}),c=R([r,$({expr:r,label:n(t(1,60)),description:n(g),format:n(C(["money","percent","duration"])),unit:n(t(1,12)),places:n(T(0)),hidden:n(_())})]),w=R([O(),L(),_(),_e(),I(H()),$({expr:r})]),b=$({noun:n(t(1,40)),plural:n(t(1,40)),aliases:n(o(l,1,on)),description:n(g),fields:j(f,y).check(Y(h=>Object.keys(h).length>0,"a kind has at least one field")),label:n(p),describe:n(p),lifecycle:n($({field:f,retired:o(R([O(),L(),_()]),1)})),figure:n(t(void 0,2e4)),glance:n(o(f,1,20)),page:n($({fields:n(o(f,1,40)),groups:n(o($({title:t(1,60),fields:o(f,1,40)}),1,12))})),edges:n(j(u,d)),computed:n(j(O(),c).check(Y(h=>Object.keys(h).length<=sn,`a kind works out at most ${sn} computed fields`))),fieldRoles:n(j(O(),O())),renamedFrom:n(O().check(P(Se))),people:n(_()),archives:n(T(!1)),tidying:n(C(["never","no-links"])),derives:n($({from:a("kind"),via:u,set:j(f,w)}))}),S=O().check(P(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),x=R([$({create:a("kind"),as:n(O().check(P(ve))),set:n(j(f,w))}),$({set:j(f,w),target:n(S)}),$({connect:u,from:S,to:S}),$({sever:u,from:S,to:S}),$({remove:S})]),E=$({title:n(t(1,80)),description:n(g),fromTheOtherEnd:n(t(1,80)),on:n(R([a("kind"),o(a("kind"),1)])),creates:n(a("kind")),sets:n(j(f,w)),writes:n(o(f,1)),connects:n(u),severs:n(u),setsOther:n(j(f,w)),setsLinked:n(j(u,j(f,w))),replaces:n(R([T(!0),o(u,1,10)])),removes:n(T(!0)),args:n(j(f,y)),effects:n(o(x,1,20)),allowedWhen:n(r),refusal:n(p),destructive:n(_())}),v=$({act:a("act"),label:n(t(1,80)),args:n(j(O(),w))}),B=$({every:a("kind"),through:u,via:n(u)}),G=$({title:n(t(1,120)),description:n(g),over:R([T("graph"),a("kind")]),when:n(r),require:n(r),covers:n(B),says:n(p),repairs:n(o(v,void 0,10))}).check(re((h,D)=>{!h.require&&!h.covers&&D.addIssue({code:"custom",message:'a rule says what must hold in "require", or what each record must be linked to in "covers"',path:["require"]}),h.require&&h.covers&&D.addIssue({code:"custom",message:'a rule is judged by "require" or by "covers", not both',path:["covers"]}),h.covers&&h.over==="graph"&&D.addIssue({code:"custom",message:'a coverage rule is over a kind, whose records it follows through their links; name the kind in "over"',path:["over"]})})),z=$({roles:R([o(a("role"),1),T("*")]),mutations:R([o(a("act")),T("*")]),kinds:n(R([I(a("kind")),T("*")])),describe:n(g),self:n(_()),ownEnd:n(_()),propose:n(R([o(a("act"),1),T("*")]))}).check(re((h,D)=>{Array.isArray(h.mutations)&&h.mutations.length===0&&h.propose===void 0&&D.addIssue({code:"custom",message:'a grant names at least one act in "mutations", or the acts it lets these roles propose in "propose"',path:["mutations"]})})),A=n(o(f,1)),M=$({roles:R([o(a("role"),1),T("*")]),kinds:o(a("kind"),1),own:n(_()),via:n(u),fields:A,hide:A}),ie=$({grants:I(z),sees:n(I(M))}),W=$({accent:n(O().check(P(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),ground:n(R([O().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"')),$({light:n(O().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"'))),dark:n(O().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#101826"')))})])),name:n(t(1,60)),currency:n(O().check(P(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:n(t(2,35)),timeZone:n(t(1,64)),logo:n(R([t(1,ee),$({src:t(1,ee),alt:n(t(1,120))}),$({light:t(1,ee),dark:n(t(1,ee)),alt:n(t(1,120)),darkFallback:n(T("invert"))})])),favicon:n(R([t(1,ee),$({emoji:O()})])),typography:n($({display:n(t(1,200)),body:n(t(1,200)),mono:n(t(1,200))})),shape:n($({radius:n(L().check(U(0),Z(32))),density:n(L().check(U(.75),Z(1.5)))})),accents:n(j(O(),L().check(U(0),Z(360)))),scheme:n(C(["light","dark","auto"])),subtitle:n(T(!1)),splash:n($({style:C(vn),image:n(t(1,ee)),title:n(t(1,80)),kicker:n(t(1,80)),shader:n(t(1,40))})),views:n($({css:n(t(1)),motion:n(C(["none","fade"]))}))}),q=j(O(),H()),Fe=R([t(1,120),$({by:t(1,120),direction:n(C(["asc","desc"]))})]),De=L().check(X(),U(1),Z(9999)),hn=te({create:n(_()),options:n(te({sort:n(Fe),columnSort:n(Fe),search:n(o(t(1,120),void 0,40)),filters:n(o(t(1,120),void 0,40)),horizon:n(R([L().check(X(),U(1),Z(200)),te({years:L().check(X(),U(1),Z(200)),title:t(1,80),from:n(De),to:n(De)})]))}))}),kn=$({card:n(I(H())),row:n(I(H())),page:n(I(H()))}),bn=()=>{let h=n(C(["asc","desc"]));return R([t(1,120),$({by:t(1,120),direction:h,then:n(R([t(1,120),$({by:t(1,120),direction:h})]))})])},$n=()=>R([t(1,120),$({by:t(1,120),order:n(o(t(1,80),void 0,40)),closed:n(o(t(1,80),void 0,40))})]),Te=te({order:n(I(O())),hide:n(I(O())),first:n(O()),primary:n(o(t(1,80),void 0,40)),scene:n(t(1,40)),pages:n(t(1,40)),lists:n(j(O(),$({filters:n(o(t(1,120),void 0,40)),sort:n(bn()),group:n($n()),export:n(_())})))}),wn=$({act:a("act"),title:n(t(1,80)),intro:n(g),fields:n(o(f,1,40)),say:n(g),submit:n(t(1,80)),role:n(a("role"))}),Sn=$({$schema:n(O()),format:T(Oe),formatVersion:T(je),name:t(1,80),description:n(g),version:n(L().check(X(),U(1))),kinds:j(a("kind"),b).check(Y(h=>Object.keys(h).length>0,"a document declares at least one kind"),Y(h=>Object.keys(h).length<=40,"a document declares at most 40 kinds")),computed:n(j(O(),c)),acts:n(j(a("act"),E)),rules:n(j(a("rule"),G)),roles:n(I(a("role"))),policy:n(ie),modules:n(q),lenses:n(I(hn)),pages:n(Te),views:n(j(O(),R([kn,I(H())]))),brand:n(W),settings:n(I(q)),migrations:n(I(q)),connections:n(j(a("connection"),q)),purpose:n(q),workflows:n(j(a("workflow"),q)),forms:n(j(a("form"),wn)),publishing:n($({mode:C(["live","on-publish"]),working:o(a("role"),void 0,40),publishers:n(o(a("role"),1,40))})),tidying:n($({autoAcceptAt:n(L().check(X(),U(1),Z(1e4)))}))});return{FieldSpec:y,EdgeSpec:d,ComputedSpec:c,KindSpec:b,ValueSpec:w,EffectSpec:x,ActSpec:E,RepairSpec:v,CoverSpec:B,RuleSpec:G,GrantSpec:z,SightSpec:M,PolicySpec:ie,BrandSpec:W,PagesSpec:Te,DocumentSpec:Sn}}var Rn,K=()=>Rn??=En(),Xn=N(()=>K().FieldSpec),Qn=N(()=>K().EdgeSpec),et=N(()=>K().ComputedSpec),nt=N(()=>K().KindSpec),tt=N(()=>K().ValueSpec),ot=N(()=>K().EffectSpec),st=N(()=>K().ActSpec),it=N(()=>K().RepairSpec),rt=N(()=>K().CoverSpec),at=N(()=>K().RuleSpec),ct=N(()=>K().GrantSpec),lt=N(()=>K().SightSpec),dt=N(()=>K().PolicySpec),pt=N(()=>K().BrandSpec),ft=N(()=>K().PagesSpec),rn=N(()=>K().DocumentSpec);var Fn={};function an(e,s=Fn,i=je){let{document:t,respelled:o}=Ne(e),a=o.length>0?{respelled:o}:{};if(!t||typeof t!="object"||Array.isArray(t))return{document:t};let u=t;if(u.format!==Oe||typeof u.formatVersion!="number"||u.formatVersion>=i)return{document:t,...a};let f=u.formatVersion,g=structuredClone(u);for(let l=f;l<i;l++){let r=s[l];if(!r)throw new Error(`there is no upgrade from format ${l} to ${l+1}`);g={...r(g),formatVersion:l+1}}return{document:g,from:f,...a}}function Ae(e,s,i){let t=Object.keys(e).filter(f=>e[f].edges?.[s]!==void 0);if(t.length===0)return;let o=t.map(f=>e[f].edges[s].to),a=o.some(f=>f==="*")?"*":[...new Set(o.flatMap(f=>f))];if(i.length===0||i.some(f=>t.includes(f)))return{reversed:!1,kinds:a};let u=t.filter(f=>{let g=e[f].edges[s].to;return g==="*"||i.every(l=>g.includes(l))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:a}}var dn=(e,s)=>{let i=e?.fields[s];return i!==void 0&&(i.type==="duration"||(i.type==="number"||i.type==="integer")&&i.format==="duration")};function cn(e,s,i,t){if(t==="out"){let o=e[s]?.edges?.[i]?.to;return o===void 0?[]:o==="*"?Object.keys(e):o}return Object.entries(e).filter(([,o])=>{let a=o.edges?.[i]?.to;return a!==void 0&&(a==="*"||a.includes(s))}).map(([o])=>o)}function Ee(e,s,i){if(i.t==="ident")return e[s]?.edges?.[i.name]?cn(e,s,i.name,"out"):void 0;if(i.t==="where")return Ee(e,s,i.set);if(i.t==="call"&&(i.fn==="out"||i.fn==="in")&&i.args[0]?.t==="lit"&&typeof i.args[0].value=="string")return cn(e,s,i.args[0].value,i.fn)}var ln=(e,s,i)=>{let t=s.filter(o=>e[o]?.fields[i]!==void 0);return t.length>0&&t.every(o=>dn(e[o],i))};function pn(e,s,i){let t=e.kinds,o=t[s],a=new Map(i),u=new Map,f=(l,r)=>{if(r>8)return!1;switch(l.t){case"ident":return dn(o,l.name)||g(l.name,r+1);case"member":{let p=Ee(t,s,l.object);return p!==void 0&&ln(t,p,l.name)}case"call":{if(l.fn!=="sum"&&l.fn!=="min"&&l.fn!=="max")return!1;let[p,y]=l.args,m=p&&Ee(t,s,p);return m!==void 0&&y?.t==="ident"&&ln(t,m,y.name)}case"binary":return(l.op==="+"||l.op==="-")&&f(l.left,r)&&f(l.right,r);case"unary":return l.op==="-"&&f(l.operand,r);default:return!1}},g=(l,r)=>{if(o?.computed?.[l]===void 0)return!1;if(u.has(l))return u.get(l);u.set(l,!1);let p=a.get(l),y=p!==void 0&&f(p,r);return u.set(l,y),y};return i.map(([l])=>l).filter(l=>g(l,0))}var Dn="several choices";var Tn={title:["string","text"],rich_text:["string","text"],number:["number","integer"],select:["enum","string"],status:["enum","string"],multi_select:["list",Dn],date:["date","datetime"],checkbox:["boolean"],url:["url","string"],email:["email","string"],phone_number:["phone","string"],people:["string","text","list"]};var fn=new Set(Object.values(Tn).flat());function un(e,s){let i=new Map;if(!e||typeof e!="object")return new Map;let t=Object.values(e).flatMap(o=>o&&typeof o=="object"&&o.system==="notion"&&Array.isArray(o.sources)?o.sources.filter(a=>a&&typeof a=="object").map(a=>({system:"notion",kind:a.kind,properties:a.properties})):[o]);for(let o of t){if(!o||typeof o!="object"||typeof o.kind!="string")continue;let a=s[o.kind]?.fields;if(!a)continue;let u=[];o.system==="google-calendar"&&o.fields&&typeof o.fields=="object"?u=Object.values(o.fields).filter(g=>typeof g=="string"):o.system==="notion"&&(u=o.properties&&typeof o.properties=="object"?Object.keys(o.properties):Object.keys(a).filter(g=>fn.has(a[g].type)));let f=i.get(o.kind)??new Set;for(let g of u)Object.hasOwn(a,g)&&f.add(g);i.set(o.kind,f)}return new Map([...i].filter(([,o])=>o.size>0).map(([o,a])=>[o,Object.keys(s[o].fields).filter(u=>a.has(u))]))}function mn(e,s,i=`kinds.${e}.page`){let t=s.page;if(!t)return[];let o=[],a=[...Object.keys(s.fields),...Object.keys(s.computed??{})],u=new Set,f=(l,r)=>{a.includes(l)?u.has(l)&&o.push(k("page-field-twice",r,`"${l}" is on ${e}'s page twice; name each field once`)):o.push(k("page-field",r,`${e}'s page is to show "${l}", and ${e} has no field or computed field called that`,`use one of: ${a.join(", ")}`)),u.add(l)};(t.fields??[]).forEach((l,r)=>f(l,`${i}.fields.${r}`));let g=new Set;return(t.groups??[]).forEach((l,r)=>{let p=l.title.trim().toLowerCase();g.has(p)&&o.push(k("page-group-twice",`${i}.groups.${r}.title`,`${e}'s page has two groups called "${l.title}"; give each its own title`)),g.add(p),l.fields.forEach((y,m)=>f(y,`${i}.groups.${r}.fields.${m}`))}),o}function gn(e,s=[]){return Ce({declared:Object.keys(e.fields),paged:[...e.page?.fields??[],...(e.page?.groups??[]).flatMap(i=>i.fields)],must:i=>!!e.fields[i].required&&e.fields[i].default===void 0,naming:s})}var Nn=new Set(["subject","now","today","me"]);function Mn(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>xe)return{findings:[k("too-large","",`a document may be at most ${xe/1024} KB`)]};if(typeof e=="string")try{e=JSON.parse(e)}catch(t){return{findings:[k("not-json","",`this is not JSON: ${t.message}`)]}}try{e=an(e).document}catch(t){return{findings:[k("format","formatVersion",t.message)]}}e=tn(e);let s=rn.safeParse(e);if(!s.success)return{findings:s.error.issues.map(t=>{let o=t.path.map(String).join(".");if(t.code==="unrecognized_keys")return k("unknown-key",o,`${t.keys.map(a=>`"${a}"`).join(", ")} ${t.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(t.code==="invalid_union"&&/\.effects\.\d+$/.test(o))return k("effect-shape",o,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(t.code==="invalid_key"){let a=t.issues?.[0]?.message;return k("shape",o,`the name "${String(t.path.at(-1))}" is not allowed here${a?`: ${a}`:""}`)}return k("shape",o,t.message)})};let i=s.data;return{document:i,findings:_n(i)}}var pe=e=>[e??[]].flat();function zn(e){let s=new Map;for(let[i,t]of Object.entries(e.kinds))for(let[o,a]of Object.entries(oe(t.edges))){let u=s.get(o);s.set(o,{name:o,from:[...u?.from??[],i],to:a.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...a.to])],cardinality:a.cardinality??"many"})}return s}function Ht(e){let s=new Map;for(let[t,o]of Object.entries(e.kinds)){let a=se(o),u=me(o.edges);s.set(t,{fields:new Set([...Object.keys(o.fields),...u.keys()]),edges:new Map(Object.entries(oe(o.edges)).map(([f,g])=>[f,g.cardinality??"many"])),...a?{computed:a}:{},...u.size>0?{linked:u}:{}})}let i=se(e);return i&&s.set(Be,{computed:i}),s}function yn(e,s){let i=[],t=pe(e.on),o=(a,u)=>{let f=Ae(s.kinds,a,t)?.reversed===!0,[g,l]=f?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:a,from:g,to:l}:{sever:a,from:g,to:l}};if(e.creates){let a=s.kinds[e.creates],u={};for(let f of Object.keys(a?.fields??{}))u[f]=`$${f}`;for(let f of e.effects??[])"set"in f&&!("create"in f)&&F(f.target)==="new"&&Object.assign(u,f.set);i.push({create:e.creates,as:"new",set:u})}if(e.sets&&i.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&i.push({set:Object.fromEntries(e.writes.map(a=>[a,`$${a}`]))}),e.connects&&(e.replaces&&i.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),i.push(o(e.connects,"connect"))),e.severs&&i.push(o(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&i.push({set:e.setsOther,target:"$to"}),e.setsLinked&&t.length>0)for(let[a,u]of Object.entries(e.setsLinked))i.push({set:u,through:a});return e.removes&&i.push({remove:"$subject"}),e.effects&&i.push(...e.effects.filter(a=>!(e.creates&&"set"in a&&!("create"in a)&&F(a.target)==="new"))),i}function le(e,s,i){try{let t=J(e),o=ae(t);for(let a of o.unknownFunctions)i.push(k("unknown-function",s,`"${a}" is not a function the rule language knows`,"see the rule language in the graview-invariant skill"));return t}catch(t){if(t instanceof ce){i.push(k("expression",s,t.sentence+` (at character ${t.at+1})`));return}throw t}}function Re(e,s,i){try{return Q(e)}catch(t){if(t instanceof Ye||t instanceof ce){i.push(k("template",s,(t instanceof ce,t.sentence)));return}throw t}}function _n(e){let s=[],i=new Set(Object.keys(e.kinds)),t=zn(e),o=e.acts??{},a=new Set(e.roles??[]),u=(l,r)=>me(e.kinds[l]?.edges).has(r),f=l=>Object.keys(e.kinds).some(r=>u(r,l));for(let[l,r]of Object.entries(e.kinds)){let p=`kinds.${l}`;for(let[m,d]of Object.entries(r.edges??{})){if(!Ke(d)&&d.to!=="*")for(let c of d.to)i.has(c)||s.push(k("edge-target",`${p}.edges.${m}.to`,`"${c}" is not a kind this document declares`));r.fields[m]&&s.push(k("edge-field-clash",`${p}.edges.${m}`,`"${m}" is both a field and a relation of ${l}`,"rename one of them"))}r.lifecycle&&!r.fields[r.lifecycle.field]&&s.push(k("lifecycle-field",`${p}.lifecycle.field`,`${l} has no field "${r.lifecycle.field}"`));let y=m=>r.computed!==void 0&&Object.hasOwn(r.computed,m);for(let m of r.glance??[])!r.fields[m]&&!y(m)&&s.push(k("glance-field",`${p}.glance`,`a glance at ${l} is to say "${m}", and ${l} has no field or computed field called that`,`use one of: ${[...Object.keys(r.fields),...Object.keys(r.computed??{})].join(", ")}`));s.push(...mn(l,r));for(let m of["label","describe"]){let d=r[m];if(!d)continue;let c=Re(d,`${p}.${m}`,s);for(let w of c??[])if(w.expr){for(let b of ae(w.expr).names)if(!r.fields[b]){if(y(b)){en(r,b)||s.push(k("template-field",`${p}.${m}`,`${l}'s ${b} is worked out from beyond the record, and a ${m} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${l}'s own fields`));continue}s.push(k("template-field",`${p}.${m}`,`${l} has no field "${b}" for its ${m} to show`,m==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[m,d]of Object.entries(r.derives?.set??{}))fe(d)&&"expr"in d&&le(String(d.expr),`${p}.derives.set.${m}`,s);for(let[m,d]of Object.entries(r.fields)){if(d.default!==void 0&&d.type==="enum"){let b=(d.multiple?Array.isArray(d.default)?d.default:[d.default]:[d.default]).find(S=>!d.options?.includes(String(S)));(b!==void 0||!d.multiple&&Array.isArray(d.default))&&s.push(k("default-option",`${p}.fields.${m}.default`,`"${String(b??d.default)}" is not one of ${m}'s options`))}let c=`${m}Repeat`;d.repeats&&(r.fields[c]||r.edges?.[c]||r.computed?.[c])&&s.push(k("repeat-clash",`${p}.fields.${m}.repeats`,`${l} already has "${c}", where how ${m} repeats is kept`))}}for(let[l,r]of Object.entries(o)){let p=`acts.${l}`;for(let c of pe(r.on))i.has(c)||s.push(k("act-kind",`${p}.on`,`"${c}" is not a kind this document declares`));let y=pe(r.on),m=yn(r,e);if(r.creates&&r.on===void 0&&r.writes&&i.has(r.creates)){for(let c of r.writes)if(!e.kinds[r.creates].fields[c])if(e.kinds[r.creates].computed?.[c]!==void 0)s.push(k("computed-written",`${p}.writes`,`${r.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(r.creates,c))continue;s.push(k("act-field",`${p}.writes`,`${r.creates} has no field "${c}"`))}}m.length===0&&s.push(k("act-empty",p,`"${l}" does nothing`,"give it effects or a shorthand such as sets or creates"));let d=new Map;m.forEach((c,w)=>{let b=m.length-(r.effects?.length??0),S=r.effects&&w>=b?`${p}.effects.${w-b}`:p;if("create"in c){if(!i.has(c.create))s.push(k("act-kind",`${S}.create`,`"${c.create}" is not a kind this document declares`));else for(let v of Object.keys(c.set??{}))e.kinds[c.create].fields[v]||(e.kinds[c.create].computed?.[v]!==void 0?s.push(k("computed-written",`${S}.set.${v}`,`${c.create}'s ${v} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):s.push(k("act-field",`${S}.set.${v}`,`${c.create} has no field "${v}"`)));c.as&&d.set(c.as,c.create)}else if("connect"in c||"sever"in c){let v="connect"in c?c.connect:c.sever;!t.has(v)&&!f(v)&&s.push(k("act-edge",`${S}.${"connect"in c?"connect":"sever"}`,`"${v}" is not a relation any kind declares`)),F(c.from)==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${l}" acts on "$subject" but does not say which kinds it is "on"`))}else if(!("through"in c))if("set"in c){let v=F(c.target??"$subject"),B=v==="subject"?y:d.has(v??"")?[d.get(v)]:[];v==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${l}" changes "$subject" but does not say which kinds it is "on"`));for(let G of Object.keys(c.set))for(let z of B)if(!(!i.has(z)||e.kinds[z].fields[G]))if(e.kinds[z].computed?.[G]!==void 0)s.push(k("computed-written",`${S}.set.${G}`,`${z}'s ${G} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(z,G))continue;s.push(k("act-field",`${S}.set.${G}`,`${z} has no field "${G}"`))}}else"remove"in c&&F(c.remove)==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${l}" removes "$subject" but does not say which kinds it is "on"`));let x="set"in c&&c.set?Object.values(c.set):[],E="through"in c?`${p}.setsLinked.${c.through}`:`${S}.set`;x.forEach(v=>{v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v&&le(v.expr,E,s)})}),r.allowedWhen&&le(r.allowedWhen,`${p}.allowedWhen`,s),r.refusal&&Re(r.refusal,`${p}.refusal`,s)}for(let[l,r]of Object.entries(e.rules??{})){let p=`rules.${l}`;r.over!=="graph"&&!i.has(r.over)&&s.push(k("rule-kind",`${p}.over`,`"${r.over}" is not a kind this document declares`));let y=r.over==="graph"?void 0:e.kinds[r.over];if(r.covers&&y){let m=ye(r.over,r.covers,d=>t.get(d),d=>i.has(d));if("problem"in m){let{key:d,message:c,fix:w}=m.problem;d==="every"?s.push(k("rule-kind",`${p}.covers.every`,c,w)):s.push(k("rule-covers-relation",`${p}.covers.${d}`,c,w))}}for(let m of["when","require"]){let d=r[m];if(!d)continue;let c=le(d,`${p}.${m}`,s);if(!c)continue;let w=ae(c);for(let b of w.names)if(r.over==="graph")s.push(k("rule-name",`${p}.${m}`,`"${b}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(y&&!y.fields[b]&&!y.edges?.[b]&&y.computed?.[b]===void 0){let S=Object.keys(y.edges??{}).find(x=>x.includes("-")&&x.split("-").includes(b));s.push(k("rule-name",`${p}.${m}`,`${r.over} has no field or relation called "${b}"`,S?`"${S}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${S.replace(/-([a-z0-9])/g,(x,E)=>E.toUpperCase())}"`:void 0))}for(let b of w.edges)!t.has(b)&&!f(b)&&s.push(k("rule-edge",`${p}.${m}`,`"${b}" is not a relation any kind declares`));for(let b of w.sweeps)i.has(b)?r.over!=="graph"&&s.push(Ue("rule-cost",`${p}.${m}`,`this rule looks at every ${b} for every ${r.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):s.push(k("rule-kind",`${p}.${m}`,`"${b}" is not a kind this document declares`))}r.says&&Re(r.says,`${p}.says`,s),(r.repairs??[]).forEach((m,d)=>{!o[m.act]&&!ge(m.act)&&!$e(m.act,e.kinds)&&s.push(k("repair-act",`${p}.repairs.${d}.act`,`"${m.act}" is not an act this document declares`,we(m.act,e)))})}let g=e.policy;return g&&(g.grants.forEach((l,r)=>{if(l.roles!=="*"&&a.size>0)for(let p of l.roles)a.has(p)||s.push(k("grant-role",`policy.grants.${r}.roles`,`"${p}" is not one of the document's roles`));for(let p of["mutations","propose"]){let y=l[p];if(y!==void 0&&y!=="*")for(let m of y)!o[m]&&!ge(m)&&!$e(m,e.kinds)&&s.push(k("grant-act",`policy.grants.${r}.${p}`,`"${m}" is not an act this document declares`,we(m,e)))}}),(g.sees??[]).forEach((l,r)=>{for(let p of l.kinds)i.has(p)||s.push(k("sight-kind",`policy.sees.${r}.kinds`,`"${p}" is not a kind this document declares`));if(l.roles!=="*"&&a.size>0)for(let p of l.roles)a.has(p)||s.push(k("sight-role",`policy.sees.${r}.roles`,`"${p}" is not one of the document's roles`))})),s.push(...Qe(e)),s}function In(e){return e.label?[...e.label.matchAll(/\{\s*([A-Za-z_][A-Za-z0-9_]*)/g)].map(s=>s[1]):[ke(e)??[]].flat()}function Kn(e,s,i,t){let o=new Map,a=pe(e.on),u=new Map,f=new Map;(a.length>0||s.some(d=>"remove"in d&&F(d.remove)==="subject"||"from"in d&&(F(d.from)==="subject"||F(d.to)==="subject")||"set"in d&&!("create"in d)&&!("through"in d)&&F(d.target??"$subject")==="subject"||"through"in d))&&o.set(he,{ref:a.length>0?a:"*",required:!0});let l=e.args??{},r=e.writes?.length===1,p=(d,c)=>c&&d.type===c.type&&d.min===void 0&&d.max===void 0&&d.step===void 0?{...d,...c.min===void 0?{}:{min:c.min},...c.max===void 0?{}:{max:c.max},...c.step===void 0?{}:{step:c.step}}:d,y=(d,c)=>c&&d.type===c.type&&d.format===void 0&&d.unit===void 0?{...p(d,c),...c.format?{format:c.format}:{},...c.unit?{unit:c.unit}:{}}:p(d,c),m=(d,c,w)=>{if(d===he||Nn.has(d)||u.has(d)||o.has(d))return;let b=l[d]?y(l[d],w):void 0;o.set(d,b?{field:b,optional:!b.required,required:!!b.required}:c())};for(let d of s)if("create"in d){let c=i.kinds[d.create],w=c?gn(c,In(c)):[],b=S=>w.includes(S)?w.indexOf(S):w.length;for(let[S,x]of Object.entries(d.set??{}).sort(([E],[v])=>b(E)-b(v))){let E=F(x),v=c?.fields[S];if(E&&v){let B=!!v.required&&v.default===void 0;m(E,()=>({field:v,optional:!B,required:B}),v)}}d.as&&u.set(d.as,d.create)}else if("connect"in d||"sever"in d){let c=t.get("connect"in d?d.connect:d.sever);for(let[w,b]of[["from",d.from],["to",d.to]]){let S=F(b);if(!S)continue;let x=w==="to"?c?.to??"*":c?.from??"*";x!=="*"&&!f.has(S)&&f.set(S,x),m(S,()=>({ref:x,required:!0}))}}else if("through"in d){let c=Ae(i.kinds,d.through,a),w=c&&c.kinds!=="*"?c.kinds[0]:void 0;for(let[b,S]of Object.entries(d.set)){let x=F(S);if(!x||x==="to")continue;let E=w?i.kinds[w]?.fields[b]:void 0;m(x,()=>E?{field:E,optional:!0,required:!1}:{any:!0,required:!1},E)}}else if("set"in d){let c=F(d.target??"$subject"),w=c==="subject"?a[0]:u.get(c??"")??f.get(c??"")?.[0];c&&c!=="subject"&&!u.has(c)&&m(c,()=>({ref:"*",required:!0}));for(let[b,S]of Object.entries(d.set)){let x=F(S);if(!x)continue;let E=w?i.kinds[w]?.fields[b]:void 0;m(x,()=>E?{field:E,optional:!r,required:r}:{any:!0,required:!1},E)}}else if("remove"in d){let c=F(d.remove);c&&m(c,()=>({ref:"*",required:!0}))}for(let[d,c]of Object.entries(l))o.has(d)||o.set(d,{field:c,optional:!c.required,required:!!c.required});return o}function Wt(e,s={}){let i=Mn(e);if(!i.document||ze(i.findings))return{ok:!1,findings:i.findings};let t=i.document,o=[...i.findings];s.previous&&o.push(...Gn(t,s.previous));let a=Ln(t,o);return ze(a.findings)?{ok:!1,findings:a.findings}:We(a,s)}function de(e,s,i){return e.map(t=>{if(t.format||t.expr?.t!=="ident")return t;let o=t.expr.name,a=i?.[o],u=s?.[o]??(typeof a=="object"?a:void 0),f=u?.format;return f==="money"||f==="percent"?{...t,format:f,...f==="money"&&u?.places===0?{formatArgs:["0"]}:{}}:t})}function Pn(e,s,i){let t=i.kinds[e]?.edges?.[s.via]!==void 0?"to":"from",o=i.kinds[s.from],a=[],u={};for(let[f,g]of Object.entries(s.set))if(fe(g)&&"expr"in g){let l=J(g.expr);a.push([f,{expr:l}]),l.t==="ident"&&o?.fields[l.name]&&(u[f]=l.name)}else a.push([f,{value:typeof g=="string"&&g.startsWith("$$")?g.slice(1):g}]);return{from:s.from,via:s.via,sourceEnd:t,set:a,back:u}}function Ln(e,s){let i=zn(e),t={},o=un(e.connections,e.kinds);for(let[r,p]of Object.entries(e.kinds)){let y=ke(p),m=p.label??(y?`{${y}}`:void 0),d=se(p),c=d?pn(e,r,[...d]):[];t[r]={...m?{label:de(Q(m),p.fields,p.computed)}:{},...p.describe?{describe:de(Q(p.describe),p.fields,p.computed)}:{},...d?{computed:[...d]}:{},...c.length>0?{durations:c}:{},...o.has(r)?{keptInStep:o.get(r)}:{},...p.derives?{derives:Pn(r,p.derives,e)}:{}}}let a={};for(let[r,p]of Object.entries(e.acts??{})){let y=yn(p,e),m=Kn(p,y,e,i),d=p.destructive??y.some(z=>"remove"in z||"sever"in z||"replace"in z),c=[...new Set(y.flatMap(z=>"create"in z?[z.create]:[]))],w=[...new Set(y.flatMap(z=>"connect"in z?[z.connect]:[]))],b=[...new Set(y.flatMap(z=>"sever"in z?[z.sever]:"replace"in z?z.replace:[]))],S=[...new Set(y.flatMap(z=>"set"in z&&!("create"in z)&&!("through"in z)&&F(z.target??"$subject")==="subject"?Object.keys(z.set):[]))],x=new Map;for(let z of y){if(!("connect"in z)&&!("sever"in z))continue;let A=i.get("connect"in z?z.connect:z.sever);for(let[M,ie]of[["from",z.from],["to",z.to]]){let W=F(ie),q=M==="to"?A?.to:A?.from;W&&W!=="subject"&&q&&q!=="*"&&x.set(W,[...new Set([...x.get(W)??[],...q])])}}let E={};for(let z of y){if(!("set"in z)||"create"in z||"through"in z)continue;let A=F(z.target??"$subject");for(let M of A&&A!=="subject"&&x.get(A)||[])E[M]=[...new Set([...E[M]??[],...Object.keys(z.set)])]}let v={};for(let z of y)if(!(!("set"in z)||"create"in z||"through"in z||F(z.target??"$subject")!=="subject"))for(let[A,M]of Object.entries(z.set??{}))typeof M=="string"&&F(M)===void 0||typeof M=="number"||typeof M=="boolean"?v[A]=typeof M=="string"&&M.startsWith("$$")?M.slice(1):M:delete v[A];let B=c.length===0&&y.every(z=>!("set"in z)||!z.set||Object.values(z.set).every(A=>!(A&&typeof A=="object"&&!Array.isArray(A)&&"expr"in A))),G=new Map;for(let z of y)if(!(!("set"in z)||!z.set))for(let A of Object.values(z.set))A&&typeof A=="object"&&!Array.isArray(A)&&"expr"in A&&G.set(A.expr,J(A.expr));a[r]={title:p.title??r.replace(/-/g," "),effects:y,args:[...m],...p.allowedWhen?{guard:J(p.allowedWhen)}:{},...p.refusal?{refusal:de(Q(p.refusal),e.kinds[[p.on??[]].flat()[0]??""]?.fields)}:{},exprs:[...G],destructive:d,idempotent:B,creates:c,connects:w,severs:b,writes:S,writesOther:E,sets:v}}let u={};for(let[r,p]of Object.entries(e.rules??{})){let y=p.covers&&p.over!=="graph"?ye(p.over,p.covers,m=>i.get(m),m=>m in e.kinds):void 0;u[r]={title:p.title??r.replace(/-/g," "),...p.require?{require:J(p.require)}:{},...y&&"plan"in y?{covers:y.plan}:{},...p.when?{when:J(p.when)}:{},...p.says?{says:de(Q(p.says),e.kinds[p.over]?.fields)}:{}}}let f=Ze(e,s),g=Je(e),l=Xe(e);return{format:He,document:e,findings:s,kinds:t,...e.computed?{facts:[...se(e)??[]]}:{},edges:[...i].map(([r,{from:p,to:y,cardinality:m}])=>[r,{from:p,to:y,cardinality:m}]),acts:a,rules:u,brand:f,...Object.keys(g).length>0?{viewSpecs:g}:{},...l?{home:l}:{}}}function Yt(e,s,i){let t=/^defineNode\("([^"]+)"\)/.exec(s)?.[1],o=t?i.kinds[t]:void 0;if(!t||!o)return e;let a=Object.keys(o.fields).filter(u=>u!=="label").slice(0,3);return{...e,path:`kinds.${t}.glance`,fix:`Say which: "glance": [${a.map(u=>`"${u}"`).join(", ")}] on kinds.${t} \u2014 the facts a person compares one by, at a glance.`}}function Gn(e,s){let i=[],t=new Set(Object.values(s.kinds).flatMap(o=>Object.keys(o.edges??{})));for(let[o,a]of Object.entries(e.kinds)){let u=a.renamedFrom;u&&!s.kinds[u]&&i.push(k("renamed-from-nothing",`kinds.${o}.renamedFrom`,`${o} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let f=s.kinds[u??o];for(let[g,l]of Object.entries(a.fields)){let r=l.renamedFrom;r&&!f?.fields[r]&&i.push(k("renamed-from-nothing",`kinds.${o}.fields.${g}.renamedFrom`,`${g} says it was ${r}, and the previous ${u??o} has no field called ${r}`,"name the field it was, or drop renamedFrom"))}for(let[g,l]of Object.entries(a.edges??{})){let r=l.renamedFrom;r&&!t.has(r)&&i.push(k("renamed-from-nothing",`kinds.${o}.edges.${g}.renamedFrom`,`${g} says it was ${r}, and the previous version has no relation called ${r}`,"name the relation it was, or drop renamedFrom"))}}return i}export{Mn as a,Ht as b,yn as c,Wt as d,Yt as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as m}from"./chunk.
|
|
1
|
+
import{j as m}from"./chunk.KZUMXT5J.js";import{G as N,T as f,X as y}from"./chunk.CYTTZOYL.js";import{b as g}from"./chunk.AJZBJBMO.js";var p=g(N(),1);var a=g(f(),1);var R={default:{background:"var(--graview-panel, #ffffff)",color:"var(--graview-ink, #1a1a1a)"},muted:{background:"var(--graview-panel-muted, #f7f5f1)",color:"var(--graview-ink, #1a1a1a)"},warning:{background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)"}},T={color:"var(--graview-ink-muted, #55514a)"},C={color:"var(--graview-ink-faint, #625d55)"};function H(e){let[l,o]=(0,p.useState)(z);return(0,p.useEffect)(()=>{let r=e.current;if(!r||typeof ResizeObserver>"u")return;let t=()=>{let i=W(r,parseFloat(getComputedStyle(r).paddingBottom)||0);o(s=>s.overflowing===i.overflowing&&s.above===i.above&&s.below===i.below?s:i)};t();let d=new ResizeObserver(t);d.observe(r);for(let i of r.children)d.observe(i);return r.addEventListener("scroll",t,{passive:!0}),()=>{d.disconnect(),r.removeEventListener("scroll",t)}}),l}var z={overflowing:!1,above:!1,below:!1};function W(e,l=0){let o=e.scrollHeight>e.clientHeight+1,r=e.scrollWidth>e.clientWidth+1;return{overflowing:o||r,above:o&&e.scrollTop>1,below:o&&e.scrollTop+e.clientHeight<e.scrollHeight-l-1}}var A=(0,p.createContext)(null),I=(0,p.createContext)(null);function O({level:e,said:l=!0,style:o,children:r}){if(e===void 0)return(0,a.jsx)("strong",{style:o,...l?{}:{"aria-hidden":!0},children:r});let t=`h${e}`;return(0,a.jsx)(t,{style:{margin:0,...o},children:r})}function E({title:e,subtitle:l,meta:o,selected:r,tone:t="default",children:d,style:i,fit:s=!1,variant:w,heading:b}){let c=(0,p.useRef)(null),{overflowing:v,above:x,below:S}=H(c),P=y(),n=(w??(P==="fullscreen"?"page":"card"))==="page",k=(0,p.useContext)(A),u=(0,p.useContext)(I);return(0,a.jsxs)("div",{"data-graview-primitive":"panel","data-graview-variant":n?"page":"card","data-selected":r||void 0,style:{display:"flex",flexDirection:"column",gap:n?12:"var(--graview-gap, 7px)",height:n||s?"auto":"100%",maxHeight:n?"none":"100%",padding:n?0:"var(--graview-pad, 15px)",boxSizing:"border-box",borderRadius:n?0:"var(--graview-radius, 12px)",border:n?"none":`1px solid ${r?"var(--graview-accent, #2f6f5e)":"var(--graview-edge, #e4e0d8)"}`,boxShadow:n?"none":r?"0 0 0 1px var(--graview-accent-dim), var(--graview-lift-low)":"var(--graview-lift-low)",overflow:n?"visible":"hidden",...R[t],...n?{background:"transparent"}:{},...i},children:[t==="warning"?(0,a.jsx)("span",{"data-graview-broken":"",style:m,children:"Implicated in a problem."}):null,e===void 0||e===k?null:(0,a.jsxs)("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:8,minWidth:0},children:[t==="warning"?(0,a.jsx)("span",{"aria-hidden":"true",title:"Implicated in a problem",style:{color:"var(--graview-warn)",flex:"0 0 auto"},children:"\u26A0"}):null,(0,a.jsx)(O,{level:b,said:u===null||e!==u,style:{fontFamily:"var(--graview-font-display, inherit)",fontSize:n?"1.5625rem":"0.9375rem",lineHeight:n?1.15:1.25,fontWeight:n?600:560,letterSpacing:n?"-0.012em":"0.005em",minWidth:0,overflowWrap:"anywhere"},children:e}),o===void 0?null:(0,a.jsx)("span",{style:{marginLeft:"auto",fontSize:"0.75rem",letterSpacing:"0.08em",textTransform:"uppercase",minWidth:0,overflowWrap:"anywhere",...C},children:o})]}),l===void 0?null:(0,a.jsx)("div",{style:{fontSize:n?"0.90625rem":"0.8125rem",lineHeight:1.5,...T},children:l}),(0,a.jsx)("div",{ref:c,className:n?void 0:"graview-scroll",...v&&!n?{tabIndex:0,role:"region",...typeof e=="string"?{"aria-label":e}:{}}:{},style:{display:"flex",flexDirection:"column",gap:n?22:"var(--graview-gap, 7px)",flex:"1 1 auto",...n?{overflow:"visible"}:{marginBottom:"calc(-1 * var(--graview-pad, 15px))",paddingBottom:"var(--graview-pad, 15px)"},...!n&&!v?{overflow:"hidden"}:{}},"data-graview-more-above":x&&!n?"":void 0,"data-graview-more-below":S&&!n?"":void 0,children:d})]})}function h({label:e,hue:l,selected:o,title:r,pickId:t,emphasis:d}){let i=typeof e=="string"?e:void 0,s=l===void 0?void 0:Math.round(l);return(0,a.jsxs)("span",{"data-graview-primitive":"chip","data-selected":o||void 0,"data-graview-pick":t,"data-graview-emphasis":d,title:r??i,style:{cursor:t?"pointer":void 0,display:"inline-flex",alignItems:"center",alignSelf:"flex-start",minHeight:24,boxSizing:"border-box",padding:"3px 9px",borderRadius:6,fontSize:"0.8125rem",lineHeight:1.5,whiteSpace:"nowrap",maxWidth:"min(28ch, 100%)",overflow:"hidden",letterSpacing:"0.01em",border:`1px solid ${o?"var(--graview-accent)":s===void 0?"var(--graview-edge)":`hsl(${s} 55% var(--graview-tint-lightness) / 0.45)`}`,background:s===void 0?"var(--graview-panel-muted)":`hsl(${s} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * 0.65))`,color:"var(--graview-ink, #1a1a1a)",boxShadow:o?"0 0 14px -4px var(--graview-accent)":void 0},children:[s===void 0?null:(0,a.jsx)("span",{"aria-hidden":"true",style:{width:9,height:6,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",flex:"0 0 auto",marginRight:6,background:`hsl(${s} 55% var(--graview-tint-lightness) / 0.9)`}}),(0,a.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]})}function L({items:e,max:l=8,selectedIds:o=[],pick:r=!1}){let t=e.slice(0,l),d=e.length-t.length;return(0,a.jsxs)("div",{"data-graview-primitive":"roster",style:{display:"flex",flexWrap:"wrap",gap:6,alignContent:"flex-start"},children:[t.map(i=>(0,a.jsx)(h,{label:i.label,...i.hue===void 0?{}:{hue:i.hue},...r?{pickId:i.id}:{},...i.emphasis===void 0?{}:{emphasis:i.emphasis},selected:o.includes(i.id)},i.id)),d>0?(0,a.jsx)(h,{label:`+${d} more`}):null]})}function F({label:e,count:l,items:o,onExpand:r,flagged:t,problems:d}){return(0,a.jsx)(E,{title:e,meta:d?(0,a.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[d,(0,a.jsx)("span",{children:l})]}):l,tone:t?"warning":"muted",style:r?{cursor:"zoom-in"}:void 0,children:o&&o.length>0?(0,a.jsx)(L,{items:o,max:6,pick:!0}):null})}export{A as a,I as b,E as c,h as d,L as e,F as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk.KB5BCW23.js";import"./chunk.72YXFJKC.js";import"./chunk.JVDPRQ7J.js";import"./chunk.57YDGGJK.js";import"./chunk.H7AH3IW4.js";import"./chunk.4TH3CGAZ.js";import"./chunk.XYGNS637.js";import"./chunk.DZSZUX34.js";import"./chunk.4EXC26LI.js";import"./chunk.PWAP2GJS.js";import"./chunk.AHPYNDVA.js";import"./chunk.FNVGNISQ.js";import"./chunk.REUMBCSV.js";import"./chunk.2KIWGQXC.js";import"./chunk.D5LOTCBU.js";import"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{b as actOnSeveral,a as actsForSeveral};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as B,b as ve}from"./chunk.
|
|
1
|
+
import{a as B,b as ve}from"./chunk.NEPQBMFT.js";import{a as ye,c as he,d as be,f as we}from"./chunk.ERPILTRY.js";import{b as S,c as fe,d as me,j as ce,k as ge}from"./chunk.REUMBCSV.js";import{b as pe,k as q}from"./chunk.2KIWGQXC.js";import{c as de,f as ue}from"./chunk.D5LOTCBU.js";import{G as Re,T as se,ca as le,h as ae,u as ie}from"./chunk.CYTTZOYL.js";import{Ma as te,Xa as re,Ya as oe,ga as Z,la as ee,ta as ne}from"./chunk.Q4MI53KK.js";import{b as W}from"./chunk.AJZBJBMO.js";var l=W(Re(),1);var i=W(se(),1);function qe({affordance:n,onApply:a,onCancel:u,store:w}){let y=le(),s=w??y?.store,[x,_]=(0,l.useState)({}),[p,D]=(0,l.useState)(""),[I,F]=(0,l.useState)(G),[J,V]=(0,l.useState)(void 0),U=(0,l.useId)(),L=(0,l.useRef)(null),A=n.open.filter(e=>!(e.name in x)),o=A[0],v=s.allMutations().find(e=>e.name===n.mutation),P=(0,l.useMemo)(()=>De(v,s,n.args??{}),[v,s,n.args]),d=o?P[o.name]:void 0,E=ge(n.open.filter(e=>e.shape?.type==="date").map(e=>e.name)),Se=(()=>{if(!E||o?.name!==E.end||o.shape?.type!=="date")return;let e=x[E.start];if(typeof e!="string")return;let r=P[E.start];return ce(typeof r=="string"?r:void 0,e,typeof d=="string"?d:void 0,{time:o.shape.time===!0,instant:o.shape.instant===!0})})();(0,l.useEffect)(()=>{D(Se??ke(d,o?.shape)),F(Array.isArray(d)?d:G),V(d)},[o?.name]),(0,l.useEffect)(()=>{L.current?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[o?.name]),(0,l.useLayoutEffect)(()=>{let e=L.current,r=typeof document>"u"?null:document.activeElement,f=r instanceof HTMLElement&&r.getAttribute("data-affordance")===n.id;if(!e||r&&r!==document.body&&!e.contains(r)&&!f)return;let b=e.querySelector('[data-testid="ask-filter"], form input, [role=group] button:not([disabled])');b&&b!==r&&b.focus()},[o?.name]);let Y=ve({flow:"both",letters:!0});if(!o)return null;let h=e=>{let r=d!==void 0&&JSON.stringify(e)===JSON.stringify(d)?void 0:e,f={...x,[o.name]:r};if(n.open.filter(R=>!(R.name in f)).length===0){let R=a(Object.fromEntries(Object.entries(f).filter(([,M])=>M!==void 0)));R&&R.length>0&&_(Object.fromEntries(Object.entries(f).filter(([M])=>!R.includes(M))))}else _(f)},O=o.optional?(0,i.jsx)("button",{type:"button",onClick:()=>h(void 0),style:{fontSize:"0.8125rem"},children:"Skip"}):null,t=o.shape??{type:"unknown"},c=t.type==="number"?t.amount:void 0,g=Ee(o,t),m=q(s.schema,v,o.name),Q=te((v?.input?.shape??{})[o.name]),xe=oe((v?.input?.shape??{})[o.name]),N=re(o.name),Ae=typeof d=="boolean"?d?"yes":"no":d,[T,Oe]=(0,l.useState)(""),X=(0,l.useMemo)(()=>{let e=g.map(r=>s.graph.getNode(r)).filter(r=>r!==void 0);return pe(e,r=>s.schema.tryDefinition(r))},[g,s]),j=e=>{let r=Ce(s,t,e),f=t.type==="choice"||t.type==="several"&&t.of.type==="choice"?m.option(e):r,b=X.get(e);return b?`${f} \xB7 ${b}`:f},$=(0,l.useMemo)(()=>{let e=T.trim().toLowerCase();return e===""?g:g.filter(r=>j(r).toLowerCase().includes(e))},[g,T,s,t,X]),k=t.type==="several",H=t.type==="file"?t:t.type==="several"&&t.of.type==="file"?t.of:void 0,K=k&&g.length===0,C=o.kinds&&o.kinds.length>0&&!o.kinds.includes("*")?o.kinds.map(e=>Z(ne(s.schema.tryDefinition(e),e))).join(" or "):m.label,Ne=n.open.length>1?`${C} \xB7 ${n.open.length-A.length+1} of ${n.open.length}`:C;return(0,i.jsxs)("div",{ref:L,"data-graview-asking":n.id,style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:4,padding:"5px 0 2px"},children:[n.open.length>1||g.length>0?(0,i.jsx)("span",{id:U,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:Ne}):null,g.length>z?(0,i.jsx)("input",{type:"search",value:T,onChange:e=>Oe(e.target.value),placeholder:`Filter ${g.length}\u2026`,"aria-label":`Filter ${C}`,"data-testid":"ask-filter",onKeyDown:e=>{if(e.key!=="ArrowDown"||e.metaKey||e.ctrlKey||e.altKey)return;let r=Y.ref.current?.querySelector(`[${B}][tabindex="0"]`);r&&(e.preventDefault(),r.focus())},style:{font:"inherit",fontSize:"0.8125rem",minWidth:0,padding:"3px 7px"}}):null,xe?(0,i.jsxs)("form",{style:{display:"grid",gap:4},onSubmit:e=>{e.preventDefault(),h(J??(d===void 0?void 0:null))},children:[(0,i.jsx)(be,{value:J,onChange:V,start:N?x[N]??P[N]:void 0,label:`${N?q(s.schema,v,N).label:m.label} repeats`,name:o.name}),(0,i.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,i.jsx)("button",{type:"submit",style:{fontSize:"0.8125rem"},children:A.length>1?"Next":"Apply"}),O]})]}):Q?(0,i.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,i.jsx)(he,{relation:Q,value:d,onChange:h,label:m.label}),O]}):H?(0,i.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,i.jsx)(ye,{as:"control",value:d,onChange:h,several:k,image:H.image===!0,video:H.video===!0,label:m.label}),O]}):g.length>0?(0,i.jsxs)("div",{...Y,role:"group","aria-labelledby":U,style:{display:"flex",flexWrap:"wrap",gap:4},children:[$.slice(0,z).map(e=>{let r=k?I.includes(e):e===Ae;return(0,i.jsx)("button",{type:"button",[B]:"","aria-label":`${C}: ${j(e)}`,...k?{"aria-pressed":r}:r?{"aria-current":!0}:{},style:{padding:"3px 9px",fontSize:"0.8125rem",...r?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},onClick:()=>k?F(f=>f.includes(e)?f.filter(b=>b!==e):[...f,e]):h(t.type==="boolean"?e==="yes":e),children:j(e)},e)}),$.length>z?(0,i.jsxs)("span",{"data-testid":"ask-more",style:{alignSelf:"center",fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:[$.length-z," more \u2014 type to narrow"]}):null,$.length===0?(0,i.jsxs)("span",{"data-testid":"ask-none",style:{alignSelf:"center",fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["None of the ",g.length," match that."]}):null,k?(0,i.jsx)("button",{type:"button",disabled:I.length===0,style:{fontSize:"0.8125rem"},onClick:()=>{let e=I;F(G),h(e)},children:A.length>1?"Next":"Apply"}):null,O]}):(0,i.jsxs)("form",{style:{display:"flex",flexWrap:"wrap",gap:4},onSubmit:e=>{if(e.preventDefault(),d!==void 0&&p===ke(d,t)){h(void 0);return}if(K){h(p.split(/[,\n]/).map(r=>r.trim()).filter(Boolean));return}if(p.trim().length!==0){if(c){let r=me(p,c);r!==void 0&&h(r);return}h(t.type==="number"?t.duration?ue(p)??p:Number(p):p)}},children:[t.type==="text"&&t.long?(0,i.jsx)("textarea",{autoFocus:!0,name:o.name,"aria-label":m.label,placeholder:m.label,value:p,rows:4,onChange:e=>D(e.target.value),onKeyDown:e=>{e.key==="Escape"?u():e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},style:{flex:"1 1 100%",minWidth:0,font:"inherit",fontSize:"0.875rem",lineHeight:1.45,padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",resize:"vertical",fieldSizing:"content",minHeight:"5.5em",maxHeight:"40vh"}}):t.type==="date"?(0,i.jsx)(we,{autoFocus:!0,name:o.name,label:m.label,value:p===""?void 0:p,time:t.time===!0,instant:t.instant===!0,partial:t.partial===!0,onChange:e=>D(e??""),onCancel:u,boxStyle:{fontSize:"0.875rem",padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):(0,i.jsx)("input",{autoFocus:!0,type:t.type==="number"&&!t.duration&&!c?"number":t.type==="text"&&t.holds==="phone"?"tel":"text",...c?{inputMode:"decimal","data-graview-amount":c.format??"unit"}:{},name:o.name,"aria-label":m.label,placeholder:K?`${m.label}, separated by commas`:c?`${m.label}, ${S(c).hint} \u2014 ${S(c).prefix??""}${S(c).placeholder}${S(c).suffix?` ${S(c).suffix}`:""}`:m.label,value:p,...t.type==="number"&&t.min!==void 0?{min:t.min}:{},...t.type==="number"&&t.max!==void 0?{max:t.max}:{},...t.type==="number"&&t.step!==void 0?{step:t.step}:{},onChange:e=>D(e.target.value),onKeyDown:e=>{e.key==="Escape"&&u()},style:{flex:1,minWidth:0,font:"inherit",fontSize:"0.875rem",padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}),(0,i.jsx)("button",{type:"submit",disabled:!K&&p.trim().length===0,style:{fontSize:"0.8125rem"},children:A.length>1?"Next":"Apply"}),O]})]})}var G=[];function De(n,a,u){let w=n?.derived?.act==="edit"&&n.subject?u[n.subject.arg]:void 0,y=typeof w=="string"?a.graph.getNode(w):void 0;return y?Object.fromEntries((n.writes??[]).filter(s=>y[s]!==void 0&&y[s]!==null).map(s=>[s,y[s]])):{}}function ke(n,a){return typeof n=="number"?a?.type==="number"&&a.amount?fe(n,a.amount):String(n):Array.isArray(n)?n.every(u=>typeof u=="string")?n.join(", "):"":typeof n!="string"?"":n}var z=10;function Ee(n,a){return n.candidates&&n.candidates.length>0?n.candidates:a.type==="choice"?a.options:a.type==="several"&&a.of.type==="choice"?a.of.options:a.type==="boolean"?$e:[]}var $e=["yes","no"];function Ce(n,a,u){return a.type==="boolean"||a.type==="choice"||a.type==="several"&&a.of.type==="choice"?u:ze(n,u)}function ze(n,a){let u=ae(a);if(u){let s=de(n.schema,n.graph.getNode(u.from)?.kind??"",u.kind,"out");return s.charAt(0).toUpperCase()+s.slice(1)}let w=ie(a);if(w.length>0)return w.map(s=>n.schema.tryDefinition(s)?.plural??`${s}s`).join(" + ");let y=n.graph.getNode(a);return y?ee(n.schema.tryDefinition(y.kind),y):a}export{qe as a,ze as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{
|
|
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{Lb as L,P as H,S as N,kd as j}from"./chunk.Q4MI53KK.js";var D=()=>(__graviewPreload(import.meta.url,["./chunk.WBS7ND2C.js","./chunk.NTC2H5ZX.js","./chunk.B3WVCSW5.js","./chunk.JVDPRQ7J.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.DWK3GXRR.js"));function W(n,l,c){let i=new Map;for(let u of c?.kinds??[])for(let o of n.nodesOfKind(u))l.has(o.id)||i.set(o.id,o);let t=new Set([...l,...i.keys()]),p=new Set(c?.edges??[]),k=new Set;if(p.size>0&&l.size>0){for(let u of l)for(let o of n.outEdges(u))p.has(o.kind)&&i.has(o.to)&&k.add(o.to);for(let u of i.keys())n.outEdges(u).some(o=>p.has(o.kind)&&l.has(o.to))&&k.add(u)}let R=new Map([...[...i].filter(([u])=>k.has(u)),...[...i].filter(([u])=>!k.has(u))]),h=[];if(p.size>0)for(let u of t)for(let o of n.outEdges(u))p.has(o.kind)&&t.has(o.to)&&h.push({kind:o.kind,from:o.from,to:o.to});return{nodes:[...R.values()],edges:h}}function E(n,l,c){let i=[];return()=>{let t=c();for(;i.length>0&&i[0]<=t-l;)i.shift();return i.length>=n?!1:(i.push(t),!0)}}function C(n={},l=Date.now){return{act:E(n.acts??30,n.actWindowMs??6e4,l),message:E(n.messages??120,n.messageWindowMs??1e3,l)}}var v=n=>typeof n=="object"&&n!==null&&!Array.isArray(n);function K(n,l){let c=l.flatMap(t=>v(t)&&typeof t.kind=="string"?[t.kind]:[]),i=j(n,c);return Object.keys(i).length>0?{choices:i}:{}}function J(n,l){let c=structuredClone(l),i=n.schema.tryDefinition(c.kind),t=c.label;return{...c,label:i?.label?i.label(c):typeof t=="string"&&t.length>0?t:c.id}}function I(n){let l=n.limiter??C(n.limits,n.now),c=n.limits?.maxHeight??4e3,i=`view:${n.view}`,t={applied:0,refused:0,dropped:0},p=()=>n.store.seenBy(n.principal),k=e=>J(n.store,e),R=()=>{if(n.props)return n.props();let e=p(),d=e.graph,r=n.input?.()??{},y=r.node?d.getNode(r.node.id):void 0,a=r.nodes?.flatMap(s=>{let m=d.getNode(s.id);return m?[m]:[]}),g=new Set([...y?[y.id]:[],...(a??[]).map(s=>s.id)]),f=[];for(let s of g)for(let m of d.outEdges(s))g.has(m.to)&&f.push({kind:m.kind,from:m.from,to:m.to});let b=W(d,g,n.reads),A=new Set(f.map(s=>`${s.kind} ${s.from} ${s.to}`));for(let s of b.edges)A.has(`${s.kind} ${s.from} ${s.to}`)||f.push(s);let w=b.nodes.length>0?[...a??[],...b.nodes]:a,S=s=>s?.filter(m=>d.has(m)),$=e.permittedMutations(n.principal).map(s=>({name:s.name,title:s.title??s.name,...s.description!==void 0?{description:s.description}:{},...s.subject?{subject:{kinds:s.subject.kinds,arg:s.subject.arg}}:{}}));return{view:n.view,...y?{node:k(y)}:{},...w?{nodes:w.map(k)}:{},edges:f,...r.label!==void 0?{label:r.label}:{},...r.fidelity!==void 0?{fidelity:r.fidelity}:{},...r.cardinality!==void 0?{cardinality:r.cardinality}:{},...r.mode!==void 0?{mode:r.mode}:{},...r.selected!==void 0?{selected:r.selected}:{},...r.implicated?{implicated:S(r.implicated)}:{},...r.flagged?{flagged:S(r.flagged)}:{},acts:$,...n.theme?{theme:n.theme()}:{},locale:H(),timeZone:N(),...K(n.store.schema,[...y?[y]:[],...w??[]]),...n.placesShown?{places:n.placesShown().map(({as:s,title:m,kind:F})=>({as:s,title:m,kind:F}))}:{}}},h=!1,u=0,o=new Set,M=()=>{if(h)return;u+=1,o.add(u),o.size>100&&o.delete(o.values().next().value);let e=R();n.send({type:"props",props:n.hand?n.hand(e):e,push:u})},P=!1,O=n.store.subscribe(()=>{P||(P=!0,queueMicrotask(()=>{P=!1,M()}))}),G=(e,d)=>(t.refused+=1,{ok:!1,reason:e,message:d}),z=(e,d,r)=>x([{name:e,args:d}],r),x=(e,d,r)=>{if(!l.act())return G("rate-limited","Too many acts asked for at once; this one was not applied.");let y=[];for(let{name:a,args:g}of e){if(d){let f=d(a,g);if(!f.ok)return G(f.reason,f.message);a=f.name,g=f.args}if(!n.store.allMutations().some(f=>f.name===a))return G("unknown-act","There is no act by that name here.");y.push({name:a,args:g})}try{let a=n.store.applyAll(y,{author:n.principal,via:i,...r?{intent:r}:{}});return t.applied+=1,{ok:!0,intent:a.intent}}catch(a){return a instanceof L?G("refused",a.refusal.message):G("failed","The act could not be applied.")}},T=(e,d,r)=>{let y=Array.isArray(r);if(typeof d!="string"||(y?r.length===0||r.length>100||!r.every(v):!v(r)))return t.refused+=1,n.send({type:"answer",id:e,ok:!1,reason:"malformed",message:"An act is asked for by name, with its arguments as an object, or a list of 1 to 100 of them for several as one change."});let a=x((y?r:[r]).map(g=>({name:d,args:g})),n.judgeAct);n.send(a.ok?{type:"answer",id:e,ok:!0,intent:a.intent}:{type:"answer",id:e,ok:!1,reason:a.reason,message:a.message})};return{receive(e){if(h)return;if(!(v(e)&&e.nonce===n.nonce&&e.type==="pushed"&&typeof e.push=="number"&&o.delete(e.push))&&!l.message()){t.dropped+=1,n.onFlood?.();return}if(!v(e)||e.nonce!==n.nonce){t.dropped+=1;return}if(e.type==="act"&&(typeof e.id=="string"||typeof e.id=="number"))return T(e.id,e.name,e.args);if(e.type==="navigate"&&n.onArrive&&(typeof e.place=="string"||typeof e.to=="string")){let r={...e.where!==void 0?{where:e.where}:{},...e.section!==void 0?{section:e.section}:{}},y=typeof e.place=="string"?{place:e.place,...r}:{record:e.to,...r},a=n.onArrive;D().then(({judgeDestination:g,listsOf:f,placeVocabulary:b})=>{if(h)return;let A=new Set([...n.store.kindsKeptFrom(n.principal),...n.store.modules.disabledKinds]),w=g(y,{sees:S=>p().graph.has(S),places:b(n.store.schema,n.placesShown?.()??[],{kept:A}),lists:f(n.store.schema,A),schema:n.store.schema});w.ok?a(w.arrival):(t.dropped+=1,n.onLost?.(w.says))});return}if(e.type==="navigate"&&typeof e.place=="string"){n.places?.().includes(e.place)?n.onNavigatePlace?.(e.place):t.dropped+=1;return}if(e.type==="navigate"&&typeof e.to=="string"){p().graph.has(e.to)?n.onNavigate?.(e.to):t.dropped+=1;return}if(e.type==="render"&&Array.isArray(e.records)&&n.onRender){n.onRender(e.records);return}if(e.type==="style"&&Array.isArray(e.sheets)&&e.sheets.every(r=>typeof r=="string")&&n.onStyle){n.onStyle(e.sheets);return}if(e.type==="hears"&&Array.isArray(e.events)&&n.onHears){n.onHears(e.events.filter(r=>typeof r=="string").slice(0,20));return}if(e.type==="clicks"&&Array.isArray(e.selectors)){n.onClicks?.(e.selectors.filter(r=>typeof r=="string"&&r.length<=500).slice(0,200));return}if(e.type==="gestures"&&Array.isArray(e.bound)&&n.onGestures){n.onGestures(e.bound.slice(0,32));return}if(e.type==="pushed"&&typeof e.push=="number"&&typeof e.ms=="number"&&n.onPushed){n.onPushed(e.push,e.ms);return}if(e.type==="size"&&typeof e.height=="number"&&Number.isFinite(e.height)){n.onSize?.(Math.max(0,Math.min(c,Math.round(e.height))));return}t.dropped+=1},push:M,pressed(e){return h?{ok:!1,reason:"refused",message:"The view has gone."}:e.ok?z(e.name,e.args):(t.refused+=1,e)},change(e,d){return h?{ok:!1,reason:"refused",message:"The view has gone."}:x(e,void 0,d)},get stats(){return t},dispose(){h=!0,O()}}}export{W as a,C as b,K as c,J as d,I as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as yt}from"./chunk.NOGGSLVG.js";import{a as mt}from"./chunk.EVBCEEQ4.js";import{f as pt}from"./chunk.OWT3VVOT.js";import{a as C,f as J}from"./chunk.NHTGAP3G.js";import{Ad as dt,F as X,J as k,L as tt,T as q,W as nt,Xb as ct,Y as et,Z as rt,ea as ot,ga as V,ja as F,ma as at,ob as ut,pa as st,ra as it,rb as ft}from"./chunk.DZZL5IDD.js";import{e as lt}from"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";function z(t){let e=[],n=!0;for(let r of t){if(r.text.length===0)continue;let o=r.as==="close"||r.text===","||r.text===":"||r.text.startsWith("'")||n;e.push({part:r,space:!o}),n=r.as==="open"}return e}function D(t,e){return z(t).map(({part:n,space:r})=>`${r?" ":""}${e?n.said??n.text:n.text}`).join("")}function Pt(t){return D(t,!1)}function Lt(t){return D(t,!0)}function gt(t,e=!1){let n=e?t.said:t.text;return t.record!==void 0?`${t.record} \u2014 ${n}`:n}function G(t){let e=l=>z(l).map(({part:a,space:s})=>({...a,space:s})),n=e(t.parts),r=t.when&&t.when.length>0?e(t.when):void 0,o=l=>`${D(n,l)}${r?`, when ${D(r,l)}`:""}`;return{...t,parts:n,...r?{when:r}:{},text:o(!1),said:o(!0)}}function jt(t,e=!1){return t.line?gt(t.line,e):t.message}var ht=60,b=t=>({text:t,as:"name"}),f=(t,e)=>e===void 0?{text:t,as:"word"}:{text:t,as:"word",said:e},P=(t,e)=>e===void 0||e===t?{text:t,as:"value"}:{text:t,as:"value",said:e},v=(t,e)=>({text:t,as:"op",said:e}),R={text:"(",as:"open"},w={text:")",as:"close"},W={text:"\u2014",as:"value",said:"empty"},M={">=":["\u2265","at least"],"<=":["\u2264","at most"],"<":["<","less than"],">":[">","more than"],"==":["=","is"],"!=":["\u2260","is not"]},B={">=":"<","<=":">","<":">=",">":"<=","==":"!=","!=":"=="},At={"+":["+","plus"],"-":["\u2212","minus"],"*":["\xD7","times"],"/":["\xF7","divided by"],"%":["mod","modulo"]},bt=t=>t.t==="binary"&&t.op in M;function T(t){return ot(t)}function vt(t){let{schema:e}=t,n=i=>i===null?void 0:e.tryDefinition(i),r=(i,d)=>{let y=n(i)?.edges;return y&&Object.hasOwn(y,d)?y[d]:void 0},o=(i,d)=>{let y=r(i,d)?.to;return Array.isArray(y)&&y.length===1?y[0]:null},l=(i,d)=>{let y=(e.edge(d)?.from??[]).filter(j=>{let $=r(j,d)?.to;return i===null||$==="*"||Array.isArray($)&&$.includes(i)});return y.length===1?y[0]:null},a=(i,d)=>r(i,d)?V(d).toLowerCase():T(st(n(i),d)),s=i=>T(at(e,i)),m=i=>T(pt(e).get(i)?.label??V(i)),g=i=>T(it(n(i),i)),S=(i,d)=>{let y=i===null?void 0:t.formatOf?.(i,d);if(y?.format)return y;let j=t.said?.get(d);return j?{...y,format:j}:y},u=i=>F(e.tryDefinition(i.kind),i),p=t.money?.locale,h=(i,d)=>{if(i==null)return W;if(i instanceof C){if(i.nodes.length===0)return W;let L=i.nodes.slice(0,3).map(u),Q=i.nodes.length-L.length;return P(Q>0?`${L.join(", ")} and ${Q} more`:L.length>1?`${L.slice(0,-1).join(", ")} and ${L[L.length-1]}`:L[0])}if(Array.isArray(i))return P(`{${i.map(L=>h(L,d).text).join(", ")}}`,i.map(L=>h(L,d).text).join(" or "));if(typeof i=="object")return P(u(i));if(typeof i=="boolean")return P(i?"yes":"no");let y=d?.format??(d?S(d.kind,d.key):void 0);if(typeof i=="number")return P(y&&y.format!=="date"?ct(i,{...t.money,...y}):rt(i,p));if(X.test(i)||y?.format==="date")return P(q(et(i,t.money?.timeZone)??i.slice(0,10),p));if(k.test(i))return P(nt(i,p,t.money?.timeZone));let j=d&&d.kind!==null?n(d.kind)?.display?.format?.[d.key]:void 0;if(j)return P(j(i));let $=i.length>ht?`${i.slice(0,ht-1).trimEnd()}\u2026`:i;return P(/^[a-z][a-z0-9]*([-_][a-z0-9]+)*$/.test($)?$.replace(/[-_]+/g," "):$)};return{definition:n,relation:r,farOf:o,nearOf:l,fieldName:a,plural:s,noun:g,factName:m,formatOf:S,valueWords:h,locale:p}}function E(t,e,n){if(t.t==="ident")return{kind:e,key:t.name};if(t.t==="member")return{kind:O(t.object,e,n),key:t.name};if(t.t==="call"&&(t.fn==="sum"||t.fn==="min"||t.fn==="max")&&t.args.length===2){let r=O(t.args[0],e,n),o=t.args[1];if(o.t==="ident")return{kind:r,key:o.name};if(o.t==="lit"&&typeof o.value=="string")return{kind:r,key:o.value}}if(t.t==="binary"&&(t.op==="+"||t.op==="-"))return E(t.left,e,n)??E(t.right,e,n);if(t.t==="call"&&t.fn==="if"&&t.args.length===3)return E(t.args[1],e,n)??E(t.args[2],e,n)}function O(t,e,n){switch(t.t){case"ident":return n.relation(e,t.name)?n.farOf(e,t.name):null;case"member":return n.farOf(O(t.object,e,n),t.name);case"where":return O(t.set,e,n);case"binary":return t.op==="|"||t.op==="&"||t.op==="-"?O(t.left,e,n):null;case"call":{let r=o=>{let l=t.args[o];return l?.t==="lit"&&typeof l.value=="string"?l.value:void 0};return t.fn==="all"?r(0)??null:t.fn==="out"?t.args.length===2?n.farOf(O(t.args[0],e,n),r(1)??""):n.farOf(e,r(0)??""):t.fn==="in"?t.args.length===2?n.nearOf(O(t.args[0],e,n),r(1)??""):n.nearOf(e,r(0)??""):(t.fn==="first"||t.fn==="sort")&&t.args[0]?O(t.args[0],e,n):null}default:return null}}function A(t){return t.t==="binary"?t.op==="||"?U(t)?4:1:t.op==="&&"?2:t.op in M||t.op==="in"?4:t.op==="+"||t.op==="-"?5:t.op==="*"||t.op==="/"||t.op==="%"?6:4.5:t.t==="unary"&&t.op==="!"?3:t.t==="where"?3.5:9}var K=t=>t.t==="lit",x=(t,e)=>t.t==="call"&&t.fn===e;function I(t,e){return t.t==="binary"&&t.op===e?[...I(t.left,e),...I(t.right,e)]:[t]}function U(t){if(t.t!=="binary"||t.op!=="||")return;let e=[];e.push(...I(t,"||"));let n,r=[];for(let o of e){if(o.t!=="binary"||o.op!=="=="||!K(o.right)||typeof o.right.value!="string"||n&&JSON.stringify(xt(n))!==JSON.stringify(xt(o.left)))return;n=o.left,r.push(o.right)}return n?{subject:n,values:r}:void 0}var xt=t=>JSON.parse(JSON.stringify(t,(e,n)=>e==="at"?void 0:n));function c(t,e,n,r){let o=(l,a,s=e)=>A(l)<a?[R,...c(l,s,n),w]:c(l,s,n);switch(t.t){case"lit":return[n.valueWords(t.value,r)];case"list":return[n.valueWords(t.items.map(l=>l.t==="lit"?l.value:null),r)];case"ident":return[b(n.fieldName(e,t.name))];case"member":{let l=x(t.object,"first")&&t.object.args[0]&&x(t.object.args[0],"all"),a=O(t.object,e,n);if(l&&a)return e!==null&&n.fieldName(e,t.name)===n.fieldName(a,t.name)&&n.definition(e)?.fields?.shape&&Object.prototype.hasOwnProperty.call(n.definition(e).fields.shape,t.name)?[b(`${n.noun(a)}'s ${n.fieldName(a,t.name)}`)]:[b(n.fieldName(a,t.name))];let s=c(t.object,e,n),m=s[s.length-1];return s.length===1&&m?.as==="name"?[b(`${m.text}'s ${n.fieldName(a,t.name)}`)]:[...s,f("'s"),b(n.fieldName(a,t.name))]}case"unary":return t.op==="-"?[v("\u2212","minus"),...o(t.operand,7)]:_(t.operand,e,n);case"where":{let l=O(t.set,e,n),a=c(t.filter,l,n),s=a.every(m=>m.as==="name"||m.as==="word"&&m.text==="not");return[...o(t.set,4),...s?[]:[f("with")],...A(t.filter)<=2?[R,...a,w]:a]}case"binary":return Rt(t,e,n);case"call":return St(t,e,n)}}function _(t,e,n){return bt(t)?Rt({...t,op:B[t.op]},e,n):x(t,"present")||x(t,"exists")?[...c(t.args[0],e,n),v("=","is"),W]:t.t==="ident"?[f("not"),b(n.fieldName(e,t.name))]:[f("not"),R,...c(t,e,n),w]}function Rt(t,e,n){let r=(a,s)=>A(a)<s?[R,...c(a,e,n),w]:c(a,e,n);if(t.op==="&&"||t.op==="||"){let a=U(t);if(a){let m=E(a.subject,e,n);return[...c(a.subject,e,n),v("\u2208","is one of"),n.valueWords(a.values.map(g=>g.value),m)]}let s=t.op==="&&"?2:1;return[...r(t.left,s),f(t.op==="&&"?"and":"or"),...r(t.right,s+.5)]}if(t.op in M){if(K(t.right)&&typeof t.right.value=="boolean"&&(t.op==="=="||t.op==="!="))return t.op==="=="===t.right.value?c(t.left,e,n):_(t.left,e,n);let[a,s]=M[t.op],m=E(t.left,e,n),g=E(t.right,e,n);return[...N(t.left,e,n,g),v(a,s),...N(t.right,e,n,m)]}if(t.op==="in")return[...r(t.left,5),v("\u2208","is one of"),...N(t.right,e,n,E(t.left,e,n))];let o=At[t.op];if(o){let a=A(t);return[...r(t.left,a),v(o[0],o[1]),...r(t.right,a+.5)]}let l={"|":"or","&":"and also","-":"except"};return[...r(t.left,5),f(l[t.op]??t.op),...r(t.right,5)]}function N(t,e,n,r){return t.t==="lit"||t.t==="list"?c(t,e,n,r):A(t)<5?[R,...c(t,e,n),w]:c(t,e,n)}function St(t,e,n){let r=a=>t.args[a],o=a=>{let s=t.args[a];return s?.t==="lit"&&typeof s.value=="string"?s.value:void 0},l=a=>{let s=r(a);return A(s)<9&&s.t!=="where"?[R,...c(s,e,n),w]:c(s,e,n)};switch(t.fn){case"out":{let a=o(t.args.length-1)??"",s=b(V(a).toLowerCase());return t.args.length===2?[s,f("of"),...l(0)]:[s]}case"in":{let a=o(t.args.length-1)??"",s=t.args.length===2?n.nearOf(O(r(0),e,n),a):n.nearOf(e,a),m=b(s?n.plural(s):V(a).toLowerCase());return t.args.length===2?[m,f("of"),...l(0)]:[m]}case"all":{let a=o(0),s=t.args[1]?.t==="lit"?t.args[1].value:void 0,m=s===!0?[f("archived")]:s==="all"?[f("archived or not")]:[];return s===!0?[...m,b(a?n.plural(a):"everything")]:[b(a?n.plural(a):"everything"),...m]}case"fact":{let a=o(0);return[b(a?n.factName(a):"fact")]}case"count":return[f("number of"),...l(0)];case"exists":return[...l(0),v("\u2260","is not"),W];case"present":return[...c(r(0),e,n),v("\u2260","is not"),W];case"some":case"every":{let a=O(r(0),e,n),s=r(1);return[...t.fn==="some"?[f("some")]:[],...l(0),f(t.fn==="some"?"with":"all with"),...A(s)<=2?[R,...c(s,a,n),w]:c(s,a,n)]}case"sum":case"min":case"max":{let a=O(r(0),e,n),s=r(1),m=s.t==="lit"&&typeof s.value=="string"?[b(n.fieldName(a,s.value))]:A(s)<9?[R,...c(s,a,n),w]:c(s,a,n);return[f(t.fn==="sum"?"total":t.fn==="min"?"least":"most"),...m,f("of"),...l(0)]}case"first":{let a=r(0);if(x(a,"all")){let s=a.args[0]?.value;if(typeof s=="string")return[b(`the ${n.noun(s)}`)]}return[f("first of"),...l(0)]}case"sort":return[...l(0),f("by"),...c(r(1),O(r(0),e,n),n)];case"len":return[f("length of"),...c(r(0),e,n)];case"lower":return c(r(0),e,n);case"round":return[...c(r(0),e,n),f(t.args.length===2&&K(r(1))?`rounded to ${String(r(1).value)} places`:"rounded")];case"contains":case"startsWith":return[...c(r(0),e,n),f(t.fn==="contains"?"contains":"starts with"),...N(r(1),e,n,E(r(0),e,n))];case"today":return[P("today")];case"now":return[P("now")];case"date":return K(r(0))&&typeof r(0).value=="string"?[P(q(String(r(0).value),n.locale))]:c(r(0),e,n);case"days":case"hours":{let a=t.fn,[s,m]=[r(0),r(1)];return x(m,"today")||x(m,"now")?[f(`${a} since`),...c(s,e,n)]:x(s,"today")||x(s,"now")?[f(`${a} until`),...c(m,e,n)]:[f(`${a} from`),...c(s,e,n),f("to"),...c(m,e,n)]}case"if":return[R,...c(r(1),e,n),f("if"),...c(r(0),e,n),f(","),f("else"),...c(r(2),e,n),w];case"either":return t.args.flatMap((a,s)=>s===0?c(a,e,n):[f(","),f("else"),...c(a,e,n)]);default:return[f(t.fn),R,...t.args.flatMap((a,s)=>s===0?c(a,e,n):[f(","),...c(a,e,n)]),w]}}function H(t){let e=n=>b(V(n).toLowerCase());return[f("through"),e(t.through.relation),...t.via?[f(","),f("then"),e(t.via.relation)]:[]]}function Z(t,e){let n=vt(e),r=t.over==="graph"?null:t.over,o=t.covers?[f("reaches every"),b(n.noun(t.covers.every)),...H(t.covers)]:c(t.require,r,n);return G({...r===null?{}:{kind:r},parts:o,...t.when?{when:c(t.when,r,n)}:{}})}function Y(t,e,n,r){let o=vt(e),l=t.over==="graph"?null:t.over,a=n.subject;if(t.covers)return G({...l===null?{}:{kind:l},parts:r?[f("does not reach"),o.valueWords(r),...H(t.covers)]:[f("does not reach every"),b(o.noun(t.covers.every)),...H(t.covers)],...a?{record:F(e.schema.tryDefinition(a.kind),a)}:{}});let s=u=>{try{return J(u,{...n,budget:2e3})}catch{return}},m=(u,p)=>{let h=N(u,l,o,p);if(u.t==="lit"||u.t==="list"||x(u,"today")||x(u,"now")||x(u,"date"))return h;let i=s(u);if(i===void 0)return h;let d=E(u,l,o),y=o.valueWords(i,d?{...d,format:o.formatOf(d.kind,d.key)??(p?o.formatOf(p.kind,p.key):void 0)}:p);return i instanceof C?[...h,f(":"),y]:[...h,y]},g=u=>{if(u.t==="binary"&&u.op==="&&"){let p=[];p.push(...I(u,"&&"));let h=p.filter(i=>s(i)!==!0);return(h.length>0?h:p).flatMap((i,d)=>[...d>0?[f("and")]:[],...A(i)<=2?[R,...g(i),w]:g(i)])}if(u.t==="binary"&&u.op==="||"){let p=U(u);if(p){let i=E(p.subject,l,o);return[...m(p.subject),v("\u2209","is not one of"),o.valueWords(p.values.map(d=>d.value),i)]}let h=[];return h.push(...I(u,"||")),h.flatMap((i,d)=>[...d>0?[f("and")]:[],...A(i)<=2?[R,...g(i),w]:g(i)])}if(u.t==="binary"&&u.op in M){if(K(u.right)&&typeof u.right.value=="boolean"&&(u.op==="=="||u.op==="!="))return u.op==="=="===u.right.value?_(u.left,l,o):c(u.left,l,o);let p=B[u.op],[h,i]=M[p],d=E(u.left,l,o),y=E(u.right,l,o);if(K(u.right)&&u.right.value===null)return[...p==="=="?N(u.left,l,o,y):m(u.left,y),v(h,i),W];let j=p==="=="&&(K(u.right)||K(u.left));return[...j?N(u.left,l,o,y):m(u.left,y),v(h,i),...j?N(u.right,l,o,d):m(u.right,d)]}if(u.t==="binary"&&u.op==="in")return[...m(u.left),v("\u2209","is not one of"),...N(u.right,l,o,E(u.left,l,o))];if(u.t==="unary"&&u.op==="!"){let p=u.operand;return bt(p)?g({...p,op:B[p.op]}):x(p,"present")||x(p,"exists")?[...m(p.args[0]),v("\u2260","is not"),W]:p.t==="ident"?c(p,l,o):[f("not"),R,..._(p,l,o),w]}if(x(u,"present")||x(u,"exists"))return[...c(u.args[0],l,o),v("=","is"),W];if(x(u,"some"))return[...c(u,l,o).slice(1),v("=","is"),W];if(x(u,"every")&&u.args.length===2){let p=s(u.args[0]);if(p instanceof C){let h=p.nodes.filter(i=>{try{return J(u.args[1],{...n,subject:i,budget:2e3})!==!0}catch{return!0}});return[...c(u,l,o),f(","),f("not"),o.valueWords(new C(h))]}}return u.t==="ident"?[f("not"),b(o.fieldName(l,u.name))]:[f("not"),R,...c(u,l,o),w]},S;try{S=g(t.require)}catch{S=[f("not"),R,...c(t.require,l,o),w]}return G({...l===null?{}:{kind:l},parts:S,...a?{record:F(e.schema.tryDefinition(a.kind),a)}:{}})}function wt(t){let e=new Map;for(let n of t??[])n.expr?.t==="ident"&&n.format&&(n.format==="money"||n.format==="percent"||n.format==="date")&&e.set(n.expr.name,n.format);return e}function Nt(t){return(e,n)=>{let r=t[e]?.fields?.[n],o=r?.format??(r?.type==="date"?"date":void 0);return o||r?.unit?{...o?{format:o}:{},...r?.unit?{unit:r.unit}:{}}:void 0}}function Et(t,e){return{schema:e,said:wt(t.says),...t.declared?{formatOf:Nt(t.declared)}:{},...t.money?{money:t.money}:{}}}function Xt(t,e){return t.shape?Z(t.shape,Et(t.shape,e)):void 0}var Ot=new WeakMap;function Wt(t,e){let n=new Map(t.allInvariants().map(r=>[r.name,r]));return e.map(r=>{let o=Vt(r),l=n.get(o.invariant)?.shape;if(!l||o.status&&o.status!=="violated")return o;let a=o.subjectId?t.graph.getNode(o.subjectId):void 0;if(l.over!=="graph"&&!a)return o;let s=l.kinds;s||(s=Ot.get(t.schema),s||Ot.set(t.schema,s=mt(t.schema)));try{let m=t.today?.()??l.today?.()??tt(),g=l.covers?o.nodeIds.find(p=>p!==o.subjectId):void 0,S=g?t.graph.getNode(g):void 0,u=Y(l,Et(l,t.schema),{graph:t.graph,subject:a??null,kinds:s,today:m},S);return{...o,line:u,...l.says||l.covers?{}:{message:`${o.message} \u2014 ${u.text}`}}}catch{return o}})}function $t(){ft((t,e,n,r)=>Wt({graph:t,schema:t.schema,allInvariants:()=>e,today:()=>r},n)),yt(Kt)}function Kt(t,e,n,r){let o=e.graph,l=ut.from(t.schema,o.snapshot(),{validate:!1});for(let g of n?[...r].reverse().map(lt):r)try{l.applyPrimitives([g],{restoring:!0})}catch{}let a=g=>t.violations(void 0,g),s=a(n?l:o),m=a(n?o:l);return{...dt(t.allInvariants(),s,m),violationsAfter:m}}function Vt(t){if(!t.line)return t;let{line:e,...n}=t,r=` \u2014 ${e.text}`;return n.message.endsWith(r)?{...n,message:n.message.slice(0,-r.length)}:n}$t();export{Y as brokenLineOf,$t as judgeWithLines,Kt as judgedForASeat,jt as problemWords,Xt as ruleLine,Z as ruleLineOf,gt as ruleLineWords,z as ruleSpacing,Lt as ruleSpoken,Pt as ruleText,Vt as unlined,Wt as withLines};
|
|
1
|
+
import{b as yt}from"./chunk.NIAM7OTV.js";import{a as mt}from"./chunk.PWAP2GJS.js";import{f as pt}from"./chunk.AHPYNDVA.js";import{a as C,f as J}from"./chunk.FNVGNISQ.js";import{F as X,Id as dt,J as k,L as tt,T as q,W as nt,Y as et,Z as rt,ac as ct,ea as ot,ga as V,la as F,oa as at,qb as ut,ra as st,ta as it,tb as ft}from"./chunk.Q4MI53KK.js";import{e as lt}from"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";function z(t){let e=[],n=!0;for(let r of t){if(r.text.length===0)continue;let o=r.as==="close"||r.text===","||r.text===":"||r.text.startsWith("'")||n;e.push({part:r,space:!o}),n=r.as==="open"}return e}function D(t,e){return z(t).map(({part:n,space:r})=>`${r?" ":""}${e?n.said??n.text:n.text}`).join("")}function Pt(t){return D(t,!1)}function Lt(t){return D(t,!0)}function gt(t,e=!1){let n=e?t.said:t.text;return t.record!==void 0?`${t.record} \u2014 ${n}`:n}function G(t){let e=l=>z(l).map(({part:a,space:s})=>({...a,space:s})),n=e(t.parts),r=t.when&&t.when.length>0?e(t.when):void 0,o=l=>`${D(n,l)}${r?`, when ${D(r,l)}`:""}`;return{...t,parts:n,...r?{when:r}:{},text:o(!1),said:o(!0)}}function jt(t,e=!1){return t.line?gt(t.line,e):t.message}var ht=60,b=t=>({text:t,as:"name"}),f=(t,e)=>e===void 0?{text:t,as:"word"}:{text:t,as:"word",said:e},P=(t,e)=>e===void 0||e===t?{text:t,as:"value"}:{text:t,as:"value",said:e},v=(t,e)=>({text:t,as:"op",said:e}),R={text:"(",as:"open"},w={text:")",as:"close"},W={text:"\u2014",as:"value",said:"empty"},M={">=":["\u2265","at least"],"<=":["\u2264","at most"],"<":["<","less than"],">":[">","more than"],"==":["=","is"],"!=":["\u2260","is not"]},B={">=":"<","<=":">","<":">=",">":"<=","==":"!=","!=":"=="},At={"+":["+","plus"],"-":["\u2212","minus"],"*":["\xD7","times"],"/":["\xF7","divided by"],"%":["mod","modulo"]},bt=t=>t.t==="binary"&&t.op in M;function T(t){return ot(t)}function vt(t){let{schema:e}=t,n=i=>i===null?void 0:e.tryDefinition(i),r=(i,d)=>{let y=n(i)?.edges;return y&&Object.hasOwn(y,d)?y[d]:void 0},o=(i,d)=>{let y=r(i,d)?.to;return Array.isArray(y)&&y.length===1?y[0]:null},l=(i,d)=>{let y=(e.edge(d)?.from??[]).filter(j=>{let $=r(j,d)?.to;return i===null||$==="*"||Array.isArray($)&&$.includes(i)});return y.length===1?y[0]:null},a=(i,d)=>r(i,d)?V(d).toLowerCase():T(st(n(i),d)),s=i=>T(at(e,i)),m=i=>T(pt(e).get(i)?.label??V(i)),g=i=>T(it(n(i),i)),S=(i,d)=>{let y=i===null?void 0:t.formatOf?.(i,d);if(y?.format)return y;let j=t.said?.get(d);return j?{...y,format:j}:y},u=i=>F(e.tryDefinition(i.kind),i),p=t.money?.locale,h=(i,d)=>{if(i==null)return W;if(i instanceof C){if(i.nodes.length===0)return W;let L=i.nodes.slice(0,3).map(u),Q=i.nodes.length-L.length;return P(Q>0?`${L.join(", ")} and ${Q} more`:L.length>1?`${L.slice(0,-1).join(", ")} and ${L[L.length-1]}`:L[0])}if(Array.isArray(i))return P(`{${i.map(L=>h(L,d).text).join(", ")}}`,i.map(L=>h(L,d).text).join(" or "));if(typeof i=="object")return P(u(i));if(typeof i=="boolean")return P(i?"yes":"no");let y=d?.format??(d?S(d.kind,d.key):void 0);if(typeof i=="number")return P(y&&y.format!=="date"?ct(i,{...t.money,...y}):rt(i,p));if(X.test(i)||y?.format==="date")return P(q(et(i,t.money?.timeZone)??i.slice(0,10),p));if(k.test(i))return P(nt(i,p,t.money?.timeZone));let j=d&&d.kind!==null?n(d.kind)?.display?.format?.[d.key]:void 0;if(j)return P(j(i));let $=i.length>ht?`${i.slice(0,ht-1).trimEnd()}\u2026`:i;return P(/^[a-z][a-z0-9]*([-_][a-z0-9]+)*$/.test($)?$.replace(/[-_]+/g," "):$)};return{definition:n,relation:r,farOf:o,nearOf:l,fieldName:a,plural:s,noun:g,factName:m,formatOf:S,valueWords:h,locale:p}}function E(t,e,n){if(t.t==="ident")return{kind:e,key:t.name};if(t.t==="member")return{kind:O(t.object,e,n),key:t.name};if(t.t==="call"&&(t.fn==="sum"||t.fn==="min"||t.fn==="max")&&t.args.length===2){let r=O(t.args[0],e,n),o=t.args[1];if(o.t==="ident")return{kind:r,key:o.name};if(o.t==="lit"&&typeof o.value=="string")return{kind:r,key:o.value}}if(t.t==="binary"&&(t.op==="+"||t.op==="-"))return E(t.left,e,n)??E(t.right,e,n);if(t.t==="call"&&t.fn==="if"&&t.args.length===3)return E(t.args[1],e,n)??E(t.args[2],e,n)}function O(t,e,n){switch(t.t){case"ident":return n.relation(e,t.name)?n.farOf(e,t.name):null;case"member":return n.farOf(O(t.object,e,n),t.name);case"where":return O(t.set,e,n);case"binary":return t.op==="|"||t.op==="&"||t.op==="-"?O(t.left,e,n):null;case"call":{let r=o=>{let l=t.args[o];return l?.t==="lit"&&typeof l.value=="string"?l.value:void 0};return t.fn==="all"?r(0)??null:t.fn==="out"?t.args.length===2?n.farOf(O(t.args[0],e,n),r(1)??""):n.farOf(e,r(0)??""):t.fn==="in"?t.args.length===2?n.nearOf(O(t.args[0],e,n),r(1)??""):n.nearOf(e,r(0)??""):(t.fn==="first"||t.fn==="sort")&&t.args[0]?O(t.args[0],e,n):null}default:return null}}function A(t){return t.t==="binary"?t.op==="||"?U(t)?4:1:t.op==="&&"?2:t.op in M||t.op==="in"?4:t.op==="+"||t.op==="-"?5:t.op==="*"||t.op==="/"||t.op==="%"?6:4.5:t.t==="unary"&&t.op==="!"?3:t.t==="where"?3.5:9}var K=t=>t.t==="lit",x=(t,e)=>t.t==="call"&&t.fn===e;function I(t,e){return t.t==="binary"&&t.op===e?[...I(t.left,e),...I(t.right,e)]:[t]}function U(t){if(t.t!=="binary"||t.op!=="||")return;let e=[];e.push(...I(t,"||"));let n,r=[];for(let o of e){if(o.t!=="binary"||o.op!=="=="||!K(o.right)||typeof o.right.value!="string"||n&&JSON.stringify(xt(n))!==JSON.stringify(xt(o.left)))return;n=o.left,r.push(o.right)}return n?{subject:n,values:r}:void 0}var xt=t=>JSON.parse(JSON.stringify(t,(e,n)=>e==="at"?void 0:n));function c(t,e,n,r){let o=(l,a,s=e)=>A(l)<a?[R,...c(l,s,n),w]:c(l,s,n);switch(t.t){case"lit":return[n.valueWords(t.value,r)];case"list":return[n.valueWords(t.items.map(l=>l.t==="lit"?l.value:null),r)];case"ident":return[b(n.fieldName(e,t.name))];case"member":{let l=x(t.object,"first")&&t.object.args[0]&&x(t.object.args[0],"all"),a=O(t.object,e,n);if(l&&a)return e!==null&&n.fieldName(e,t.name)===n.fieldName(a,t.name)&&n.definition(e)?.fields?.shape&&Object.prototype.hasOwnProperty.call(n.definition(e).fields.shape,t.name)?[b(`${n.noun(a)}'s ${n.fieldName(a,t.name)}`)]:[b(n.fieldName(a,t.name))];let s=c(t.object,e,n),m=s[s.length-1];return s.length===1&&m?.as==="name"?[b(`${m.text}'s ${n.fieldName(a,t.name)}`)]:[...s,f("'s"),b(n.fieldName(a,t.name))]}case"unary":return t.op==="-"?[v("\u2212","minus"),...o(t.operand,7)]:_(t.operand,e,n);case"where":{let l=O(t.set,e,n),a=c(t.filter,l,n),s=a.every(m=>m.as==="name"||m.as==="word"&&m.text==="not");return[...o(t.set,4),...s?[]:[f("with")],...A(t.filter)<=2?[R,...a,w]:a]}case"binary":return Rt(t,e,n);case"call":return St(t,e,n)}}function _(t,e,n){return bt(t)?Rt({...t,op:B[t.op]},e,n):x(t,"present")||x(t,"exists")?[...c(t.args[0],e,n),v("=","is"),W]:t.t==="ident"?[f("not"),b(n.fieldName(e,t.name))]:[f("not"),R,...c(t,e,n),w]}function Rt(t,e,n){let r=(a,s)=>A(a)<s?[R,...c(a,e,n),w]:c(a,e,n);if(t.op==="&&"||t.op==="||"){let a=U(t);if(a){let m=E(a.subject,e,n);return[...c(a.subject,e,n),v("\u2208","is one of"),n.valueWords(a.values.map(g=>g.value),m)]}let s=t.op==="&&"?2:1;return[...r(t.left,s),f(t.op==="&&"?"and":"or"),...r(t.right,s+.5)]}if(t.op in M){if(K(t.right)&&typeof t.right.value=="boolean"&&(t.op==="=="||t.op==="!="))return t.op==="=="===t.right.value?c(t.left,e,n):_(t.left,e,n);let[a,s]=M[t.op],m=E(t.left,e,n),g=E(t.right,e,n);return[...N(t.left,e,n,g),v(a,s),...N(t.right,e,n,m)]}if(t.op==="in")return[...r(t.left,5),v("\u2208","is one of"),...N(t.right,e,n,E(t.left,e,n))];let o=At[t.op];if(o){let a=A(t);return[...r(t.left,a),v(o[0],o[1]),...r(t.right,a+.5)]}let l={"|":"or","&":"and also","-":"except"};return[...r(t.left,5),f(l[t.op]??t.op),...r(t.right,5)]}function N(t,e,n,r){return t.t==="lit"||t.t==="list"?c(t,e,n,r):A(t)<5?[R,...c(t,e,n),w]:c(t,e,n)}function St(t,e,n){let r=a=>t.args[a],o=a=>{let s=t.args[a];return s?.t==="lit"&&typeof s.value=="string"?s.value:void 0},l=a=>{let s=r(a);return A(s)<9&&s.t!=="where"?[R,...c(s,e,n),w]:c(s,e,n)};switch(t.fn){case"out":{let a=o(t.args.length-1)??"",s=b(V(a).toLowerCase());return t.args.length===2?[s,f("of"),...l(0)]:[s]}case"in":{let a=o(t.args.length-1)??"",s=t.args.length===2?n.nearOf(O(r(0),e,n),a):n.nearOf(e,a),m=b(s?n.plural(s):V(a).toLowerCase());return t.args.length===2?[m,f("of"),...l(0)]:[m]}case"all":{let a=o(0),s=t.args[1]?.t==="lit"?t.args[1].value:void 0,m=s===!0?[f("archived")]:s==="all"?[f("archived or not")]:[];return s===!0?[...m,b(a?n.plural(a):"everything")]:[b(a?n.plural(a):"everything"),...m]}case"fact":{let a=o(0);return[b(a?n.factName(a):"fact")]}case"count":return[f("number of"),...l(0)];case"exists":return[...l(0),v("\u2260","is not"),W];case"present":return[...c(r(0),e,n),v("\u2260","is not"),W];case"some":case"every":{let a=O(r(0),e,n),s=r(1);return[...t.fn==="some"?[f("some")]:[],...l(0),f(t.fn==="some"?"with":"all with"),...A(s)<=2?[R,...c(s,a,n),w]:c(s,a,n)]}case"sum":case"min":case"max":{let a=O(r(0),e,n),s=r(1),m=s.t==="lit"&&typeof s.value=="string"?[b(n.fieldName(a,s.value))]:A(s)<9?[R,...c(s,a,n),w]:c(s,a,n);return[f(t.fn==="sum"?"total":t.fn==="min"?"least":"most"),...m,f("of"),...l(0)]}case"first":{let a=r(0);if(x(a,"all")){let s=a.args[0]?.value;if(typeof s=="string")return[b(`the ${n.noun(s)}`)]}return[f("first of"),...l(0)]}case"sort":return[...l(0),f("by"),...c(r(1),O(r(0),e,n),n)];case"len":return[f("length of"),...c(r(0),e,n)];case"lower":return c(r(0),e,n);case"round":return[...c(r(0),e,n),f(t.args.length===2&&K(r(1))?`rounded to ${String(r(1).value)} places`:"rounded")];case"contains":case"startsWith":return[...c(r(0),e,n),f(t.fn==="contains"?"contains":"starts with"),...N(r(1),e,n,E(r(0),e,n))];case"today":return[P("today")];case"now":return[P("now")];case"date":return K(r(0))&&typeof r(0).value=="string"?[P(q(String(r(0).value),n.locale))]:c(r(0),e,n);case"days":case"hours":{let a=t.fn,[s,m]=[r(0),r(1)];return x(m,"today")||x(m,"now")?[f(`${a} since`),...c(s,e,n)]:x(s,"today")||x(s,"now")?[f(`${a} until`),...c(m,e,n)]:[f(`${a} from`),...c(s,e,n),f("to"),...c(m,e,n)]}case"if":return[R,...c(r(1),e,n),f("if"),...c(r(0),e,n),f(","),f("else"),...c(r(2),e,n),w];case"either":return t.args.flatMap((a,s)=>s===0?c(a,e,n):[f(","),f("else"),...c(a,e,n)]);default:return[f(t.fn),R,...t.args.flatMap((a,s)=>s===0?c(a,e,n):[f(","),...c(a,e,n)]),w]}}function H(t){let e=n=>b(V(n).toLowerCase());return[f("through"),e(t.through.relation),...t.via?[f(","),f("then"),e(t.via.relation)]:[]]}function Z(t,e){let n=vt(e),r=t.over==="graph"?null:t.over,o=t.covers?[f("reaches every"),b(n.noun(t.covers.every)),...H(t.covers)]:c(t.require,r,n);return G({...r===null?{}:{kind:r},parts:o,...t.when?{when:c(t.when,r,n)}:{}})}function Y(t,e,n,r){let o=vt(e),l=t.over==="graph"?null:t.over,a=n.subject;if(t.covers)return G({...l===null?{}:{kind:l},parts:r?[f("does not reach"),o.valueWords(r),...H(t.covers)]:[f("does not reach every"),b(o.noun(t.covers.every)),...H(t.covers)],...a?{record:F(e.schema.tryDefinition(a.kind),a)}:{}});let s=u=>{try{return J(u,{...n,budget:2e3})}catch{return}},m=(u,p)=>{let h=N(u,l,o,p);if(u.t==="lit"||u.t==="list"||x(u,"today")||x(u,"now")||x(u,"date"))return h;let i=s(u);if(i===void 0)return h;let d=E(u,l,o),y=o.valueWords(i,d?{...d,format:o.formatOf(d.kind,d.key)??(p?o.formatOf(p.kind,p.key):void 0)}:p);return i instanceof C?[...h,f(":"),y]:[...h,y]},g=u=>{if(u.t==="binary"&&u.op==="&&"){let p=[];p.push(...I(u,"&&"));let h=p.filter(i=>s(i)!==!0);return(h.length>0?h:p).flatMap((i,d)=>[...d>0?[f("and")]:[],...A(i)<=2?[R,...g(i),w]:g(i)])}if(u.t==="binary"&&u.op==="||"){let p=U(u);if(p){let i=E(p.subject,l,o);return[...m(p.subject),v("\u2209","is not one of"),o.valueWords(p.values.map(d=>d.value),i)]}let h=[];return h.push(...I(u,"||")),h.flatMap((i,d)=>[...d>0?[f("and")]:[],...A(i)<=2?[R,...g(i),w]:g(i)])}if(u.t==="binary"&&u.op in M){if(K(u.right)&&typeof u.right.value=="boolean"&&(u.op==="=="||u.op==="!="))return u.op==="=="===u.right.value?_(u.left,l,o):c(u.left,l,o);let p=B[u.op],[h,i]=M[p],d=E(u.left,l,o),y=E(u.right,l,o);if(K(u.right)&&u.right.value===null)return[...p==="=="?N(u.left,l,o,y):m(u.left,y),v(h,i),W];let j=p==="=="&&(K(u.right)||K(u.left));return[...j?N(u.left,l,o,y):m(u.left,y),v(h,i),...j?N(u.right,l,o,d):m(u.right,d)]}if(u.t==="binary"&&u.op==="in")return[...m(u.left),v("\u2209","is not one of"),...N(u.right,l,o,E(u.left,l,o))];if(u.t==="unary"&&u.op==="!"){let p=u.operand;return bt(p)?g({...p,op:B[p.op]}):x(p,"present")||x(p,"exists")?[...m(p.args[0]),v("\u2260","is not"),W]:p.t==="ident"?c(p,l,o):[f("not"),R,..._(p,l,o),w]}if(x(u,"present")||x(u,"exists"))return[...c(u.args[0],l,o),v("=","is"),W];if(x(u,"some"))return[...c(u,l,o).slice(1),v("=","is"),W];if(x(u,"every")&&u.args.length===2){let p=s(u.args[0]);if(p instanceof C){let h=p.nodes.filter(i=>{try{return J(u.args[1],{...n,subject:i,budget:2e3})!==!0}catch{return!0}});return[...c(u,l,o),f(","),f("not"),o.valueWords(new C(h))]}}return u.t==="ident"?[f("not"),b(o.fieldName(l,u.name))]:[f("not"),R,...c(u,l,o),w]},S;try{S=g(t.require)}catch{S=[f("not"),R,...c(t.require,l,o),w]}return G({...l===null?{}:{kind:l},parts:S,...a?{record:F(e.schema.tryDefinition(a.kind),a)}:{}})}function wt(t){let e=new Map;for(let n of t??[])n.expr?.t==="ident"&&n.format&&(n.format==="money"||n.format==="percent"||n.format==="date")&&e.set(n.expr.name,n.format);return e}function Nt(t){return(e,n)=>{let r=t[e]?.fields?.[n],o=r?.format??(r?.type==="date"?"date":void 0);return o||r?.unit?{...o?{format:o}:{},...r?.unit?{unit:r.unit}:{}}:void 0}}function Et(t,e){return{schema:e,said:wt(t.says),...t.declared?{formatOf:Nt(t.declared)}:{},...t.money?{money:t.money}:{}}}function Xt(t,e){return t.shape?Z(t.shape,Et(t.shape,e)):void 0}var Ot=new WeakMap;function Wt(t,e){let n=new Map(t.allInvariants().map(r=>[r.name,r]));return e.map(r=>{let o=Vt(r),l=n.get(o.invariant)?.shape;if(!l||o.status&&o.status!=="violated")return o;let a=o.subjectId?t.graph.getNode(o.subjectId):void 0;if(l.over!=="graph"&&!a)return o;let s=l.kinds;s||(s=Ot.get(t.schema),s||Ot.set(t.schema,s=mt(t.schema)));try{let m=t.today?.()??l.today?.()??tt(),g=l.covers?o.nodeIds.find(p=>p!==o.subjectId):void 0,S=g?t.graph.getNode(g):void 0,u=Y(l,Et(l,t.schema),{graph:t.graph,subject:a??null,kinds:s,today:m},S);return{...o,line:u,...l.says||l.covers?{}:{message:`${o.message} \u2014 ${u.text}`}}}catch{return o}})}function $t(){ft((t,e,n,r)=>Wt({graph:t,schema:t.schema,allInvariants:()=>e,today:()=>r},n)),yt(Kt)}function Kt(t,e,n,r){let o=e.graph,l=ut.from(t.schema,o.snapshot(),{validate:!1});for(let g of n?[...r].reverse().map(lt):r)try{l.applyPrimitives([g],{restoring:!0})}catch{}let a=g=>t.violations(void 0,g),s=a(n?l:o),m=a(n?o:l);return{...dt(t.allInvariants(),s,m),violationsAfter:m}}function Vt(t){if(!t.line)return t;let{line:e,...n}=t,r=` \u2014 ${e.text}`;return n.message.endsWith(r)?{...n,message:n.message.slice(0,-r.length)}:n}$t();export{Y as brokenLineOf,$t as judgeWithLines,Kt as judgedForASeat,jt as problemWords,Xt as ruleLine,Z as ruleLineOf,gt as ruleLineWords,z as ruleSpacing,Lt as ruleSpoken,Pt as ruleText,Vt as unlined,Wt as withLines};
|
|
@@ -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 ie}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 ie}from"./chunk.OXWOUE3W.js";import{a as X,c as H,d as J,e as Q}from"./chunk.ZZAI57VI.js";import"./chunk.34DRUCH2.js";import"./chunk.KXFNRJ46.js";import"./chunk.OMRQTLI5.js";import"./chunk.MIE3ODQ2.js";import"./chunk.NEPQBMFT.js";import"./chunk.2PJ6STKA.js";import"./chunk.MBB5A6BT.js";import"./chunk.ERPILTRY.js";import"./chunk.H7AH3IW4.js";import"./chunk.U5P23GO7.js";import"./chunk.GZHZLJBF.js";import"./chunk.WUVXIUA7.js";import"./chunk.OJGHDWI6.js";import"./chunk.BN7C5ZYX.js";import"./chunk.REUMBCSV.js";import"./chunk.2KIWGQXC.js";import"./chunk.D5LOTCBU.js";import"./chunk.KZUMXT5J.js";import"./chunk.CGK2PY76.js";import{F as K,G as q,Ia as z,Ra as U,T as x,U as F,Va as Y,ba as b,c as j,x as V}from"./chunk.CYTTZOYL.js";import{a as N}from"./chunk.SDO3U72B.js";import{Ib as W,cb as _,db as D,ga as I,la as G,pa as B}from"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as w}from"./chunk.AJZBJBMO.js";var ae=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 Z(){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=oe(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 oe(e,t){return e.kind===t.kind&&e.id===t.id}var E=w(q(),1),c=w(x(),1),se=`
|
|
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}`,le={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"};function de(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 ee=e=>e.name&&e.onBehalfOfName?`${e.name}, for ${e.onBehalfOfName}`:e.name??"",te=e=>e===1?"1 viewer":`${e} viewers`;function pe(e){let t=e.map(ee).filter(Boolean),i=t.length<e.length?[...t,te(e.length-t.length)]:t,a=i.pop();return`${i.length>0?`${i.join(", ")} and ${a}`:a} ${e.length===1?"is":"are"} here`}function ce(e,t){let{store:i,hidden:a,pictures:l}=t,d=j(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=V(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)?G(i.schema.tryDefinition(h.kind),h):null}function ue(e,t){let i=o=>o.id!==void 0&&(o.id===t.principal.id||o.onBehalfOf?.id===t.principal.id),a=e.filter(o=>!W(o)&&_(o.author)!=="system"&&!i(o.author)),l=a[0];if(!l)return null;let d=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 ge(e,t,i){let a=ue(e,t);a&&(i(""),setTimeout(()=>i(a),50))}function he({scene:e,compact:t}){let{who:i,principal:a,store:l,views:d,hiddenKinds:s,follow:o}=b(),g=Y("here"),p=de(i,a),h=p.length===0?"":pe(p),[u,S]=(0,E.useState)("");if((0,E.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:se}),(0,c.jsx)("span",{role:"status","aria-live":"polite",style:le,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)(O,{one:r},r.participant))}):(0,c.jsx)(O,{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:U,children:[f.map(r=>{let v=ce(r.stop,{store:l,principal:a,hidden:s,pictures:T}),A=ee(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)(O,{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)(O,{count:k}),(0,c.jsxs)("span",{children:[te(k),(0,c.jsx)("small",{children:"Not signed in"})]})]})}):null]})]})}function O({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 me(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 L(e,t,i,a,l,d){let s=me(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},ne=500,ye=10;function fe(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()},L(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?L(t,p,l,d):L(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)>ye&&(f=!0)};document.addEventListener("pointermove",y),setTimeout(()=>{document.removeEventListener("pointermove",y),!(f||s.at!==0&&s.at-S<ne)&&(R={on:t,at:Date.now()},t.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation()},{capture:!0,once:!0}),L(t,p,l,d,h,u))},Math.max(0,ne-(Date.now()-S)))}var n=w(x(),1),Ge=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.AI34V6WV.js","./chunk.G4ULQK64.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.SEHRPTNA.js")))).part((e,t)=>(0,n.jsx)(e.TidyGroups,{...t}),{quiet:!0}),ve=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.Z2TDZSMN.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=X(i,e);return(0,n.jsx)(n.Fragment,{children:d.map((s,o)=>{let g=Q(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)(J,{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=>I(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:re,children:r.label}):(0,n.jsx)("button",{type:"button","data-testid":"host-action",className:"graview-host-action",onClick:()=>{T.setOpen(!1),r.onSelect?.()},style:{...re,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)(Z,{})]}):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,K(m)?(0,n.jsx)(ae.Suspense,{fallback:null,children:(0,n.jsx)(ve,{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:we}}),"Graview"]})]}):null]})})}var we='<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>',re={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{ie as ActivityRail,he as Here,Be as ProblemRows,_e as ProfilePane,Ge as TidyFoot,fe as placeGesture,ge as sayTheirChange};
|
|
9
|
+
.graview-bar[data-finding] .graview-here{display:none}`,le={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"};function de(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 ee=e=>e.name&&e.onBehalfOfName?`${e.name}, for ${e.onBehalfOfName}`:e.name??"",te=e=>e===1?"1 viewer":`${e} viewers`;function pe(e){let t=e.map(ee).filter(Boolean),i=t.length<e.length?[...t,te(e.length-t.length)]:t,a=i.pop();return`${i.length>0?`${i.join(", ")} and ${a}`:a} ${e.length===1?"is":"are"} here`}function ce(e,t){let{store:i,hidden:a,pictures:l}=t,d=j(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=V(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)?G(i.schema.tryDefinition(h.kind),h):null}function ue(e,t){let i=o=>o.id!==void 0&&(o.id===t.principal.id||o.onBehalfOf?.id===t.principal.id),a=e.filter(o=>!W(o)&&_(o.author)!=="system"&&!i(o.author)),l=a[0];if(!l)return null;let d=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 ge(e,t,i){let a=ue(e,t);a&&(i(""),setTimeout(()=>i(a),50))}function he({scene:e,compact:t}){let{who:i,principal:a,store:l,views:d,hiddenKinds:s,follow:o}=b(),g=Y("here"),p=de(i,a),h=p.length===0?"":pe(p),[u,S]=(0,E.useState)("");if((0,E.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:se}),(0,c.jsx)("span",{role:"status","aria-live":"polite",style:le,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)(O,{one:r},r.participant))}):(0,c.jsx)(O,{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:U,children:[f.map(r=>{let v=ce(r.stop,{store:l,principal:a,hidden:s,pictures:T}),A=ee(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)(O,{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)(O,{count:k}),(0,c.jsxs)("span",{children:[te(k),(0,c.jsx)("small",{children:"Not signed in"})]})]})}):null]})]})}function O({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 me(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 L(e,t,i,a,l,d){let s=me(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},ne=500,ye=10;function fe(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()},L(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?L(t,p,l,d):L(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)>ye&&(f=!0)};document.addEventListener("pointermove",y),setTimeout(()=>{document.removeEventListener("pointermove",y),!(f||s.at!==0&&s.at-S<ne)&&(R={on:t,at:Date.now()},t.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation()},{capture:!0,once:!0}),L(t,p,l,d,h,u))},Math.max(0,ne-(Date.now()-S)))}var n=w(x(),1),Ge=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.K7TK3KRB.js")))).part((e,t)=>(0,n.jsx)(e.TidyGroups,{...t}),{quiet:!0}),ve=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.WYPCLZL7.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=X(i,e);return(0,n.jsx)(n.Fragment,{children:d.map((s,o)=>{let g=Q(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)(J,{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=>I(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:re,children:r.label}):(0,n.jsx)("button",{type:"button","data-testid":"host-action",className:"graview-host-action",onClick:()=>{T.setOpen(!1),r.onSelect?.()},style:{...re,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)(Z,{})]}):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,K(m)?(0,n.jsx)(ae.Suspense,{fallback:null,children:(0,n.jsx)(ve,{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:we}}),"Graview"]})]}):null]})})}var we='<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>',re={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{ie as ActivityRail,he as Here,Be as ProblemRows,_e as ProfilePane,Ge as TidyFoot,fe as placeGesture,ge as sayTheirChange};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as T}from"./chunk.
|
|
1
|
+
import{G as T}from"./chunk.CYTTZOYL.js";import{b as g}from"./chunk.AJZBJBMO.js";var s=g(T(),1),m="data-graview-roving",E="data-graview-roving-item",L={ArrowDown:{column:1,both:1},ArrowUp:{column:-1,both:-1},ArrowRight:{column:0,both:1},ArrowLeft:{column:0,both:-1}},w=e=>e instanceof HTMLElement&&(e.isContentEditable||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLInputElement&&!["button","checkbox","radio","submit"].includes(e.type));function p(e){return[...e.querySelectorAll(`[${E}]`)].filter(c=>c.closest(`[${m}]`)===e&&!c.disabled&&c.getAttribute("aria-hidden")!=="true")}var M=e=>(e.textContent?.trim()||e.getAttribute("aria-label")||"").toLowerCase();function H({flow:e="column",letters:c=!1}={}){let a=(0,s.useRef)(null),i=(0,s.useRef)(null),f=(0,s.useCallback)(()=>{let t=a.current;if(!t)return;let n=p(t);if(n.length===0)return;let o=typeof document>"u"?null:document.activeElement,u=n.find(r=>r===o)??(i.current&&n.includes(i.current)?i.current:n[0]);for(let r of n){let l=r===u?"0":"-1";r.getAttribute("tabindex")!==l&&r.setAttribute("tabindex",l)}},[]);(0,s.useLayoutEffect)(f);let d=t=>{t&&(i.current=t,t.focus(),f())};return{ref:a,[m]:c?"letters":"",onFocus:t=>{let n=t.target.closest?.(`[${E}]`);n&&n.closest(`[${m}]`)===a.current&&i.current!==n&&(i.current=n,f())},onKeyDown:t=>{let n=a.current;if(!n||t.metaKey||t.ctrlKey||t.altKey||w(t.target))return;let o=p(n),u=o.findIndex(l=>l===t.target||l.contains(t.target));if(u<0)return;let r=L[t.key]?.[e];if(r){t.preventDefault(),t.stopPropagation(),d(o[Math.max(0,Math.min(o.length-1,u+r))]);return}if(t.key==="Home"||t.key==="End"){t.preventDefault(),t.stopPropagation(),d(t.key==="Home"?o[0]:o[o.length-1]);return}if(c&&t.key.length===1&&t.key.trim()!==""){let l=t.key.toLowerCase(),y=[...o.slice(u+1),...o.slice(0,u+1)].find(b=>M(b).startsWith(l));if(!y)return;t.preventDefault(),t.stopPropagation(),d(y)}}}}export{E as a,H as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Gb as O,Hb as P,Jb as h,Kb as j,Tb as x,sd as E,td as G,vd as F,wd as J,xb as k}from"./chunk.Q4MI53KK.js";var W=(o,a)=>{let t=o.kindOf(a);return t===void 0?void 0:o.kept?.({id:a,kind:t})};function w(o,a){return o.flatMap(t=>{if(t.op==="splice-text")return W(a,t.id)?.(t.field)?[]:[t];if(t.op!=="patch-node")return[t];let i=W(a,t.id);if(!i||!Object.keys(t.after).some(i))return[t];let c=r=>Object.fromEntries(Object.entries(r).filter(([f])=>!i(f))),n=c(t.after);return Object.keys(n).length===0?[]:[{op:"patch-node",id:t.id,before:c(t.before),after:n}]})}function _(o,a,t){if(!G(o,a))return t;let i=F(o,a),c=r=>o.graph.getNode(r)!==void 0||x(o.log).kindOf(r)!==void 0,n={...t};if(t.diff){let r=t.diff,f=E(o.log),l=o.log.length??o.log.all().length,u=t.ops?.[0]?.seq??l,M=k(a).id,y=(e,s)=>d=>f.writerAt(e,d,s),m=(e,s)=>i.shows(e.id)?i.servedWith(e,s):void 0,b=(e,s)=>e.flatMap(d=>m(d,s(d.id))??[]),S=e=>i.shows(e.from)&&i.shows(e.to)&&!h(e,i.sees),v=(e,s)=>t.ops?y(e,l):d=>s===void 0||s.includes(d)?M:f.writerAt(e,d,l),D=r.changedNodes.flatMap(e=>{let s=m(e.before,y(e.before.id,u)),d=m(e.after,v(e.after.id,e.fields));return s&&d?[{before:s,after:d,fields:e.fields.filter(p=>p in s||p in d)}]:[]}),B=new Set(r.changedNodes.map(e=>e.after.id)),g=new Map;for(let e of t.ops?.flatMap(s=>s.primitives)??t.primitives??[])e.op!=="patch-node"&&e.op!=="splice-text"||B.has(e.id)||g.set(e.id,[...g.get(e.id)??[],...e.op==="splice-text"?[e.field]:Object.keys(e.after)]);let I=[...g].flatMap(([e,s])=>{let d=o.graph.getNode(e);if(!d)return[];let p=m(d,y(e,u)),N=m(d,v(e,s));return p&&N&&JSON.stringify(p)!==JSON.stringify(N)?[{before:p,after:N,fields:s}]:[]});n.diff={addedNodes:b(r.addedNodes,e=>v(e)),removedNodes:b(r.removedNodes,e=>y(e,u)),changedNodes:[...D,...I],addedEdges:r.addedEdges.filter(S),removedEdges:r.removedEdges.filter(S),touched:[...r.touched.filter(i.shows),...[...g.keys()].filter(e=>i.shows(e)&&!r.touched.includes(e))]}}if(t.ops&&(n.ops=j(t.ops,i)),t.primitives){let r=n.ops;n.primitives=r?r.flatMap(f=>f.primitives):i.timeline?O(t.primitives,i.timeline,{served:(f,l)=>i.servedWith(f,l),edgeClean:f=>!h(f,i.sees),sees:i.sees},k(a).id):j([{id:"",seq:0,batch:"",author:{kind:"system"},intent:"",mutation:null,primitives:t.primitives,reads:[],writes:[],at:""}],i)[0].primitives}return i.kept&&n.primitives&&(n.primitives=w(n.primitives,i)),t.reads&&(n.reads=t.reads.filter(r=>i.shows(r)&&c(r))),t.writes&&(n.writes=t.writes.filter(i.shows)),t.intent!==void 0&&h(t.intent,i.sees)&&(n.intent=P),t.violationsAfter&&Object.assign(n,A?A(o,J(o,a),!!t.ops,n.primitives??[]):{introduces:[],resolves:[],violationsAfter:[]}),n}var A,z=o=>void(A=o);export{_ as a,z as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as l}from"./chunk.
|
|
1
|
+
import{b as l}from"./chunk.JVDPRQ7J.js";import{ge as i}from"./chunk.Q4MI53KK.js";function c(e){return e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-|-$/g,"")}function p(e,n={}){let[t="/",a=""]=e.split("#")[0].split("?"),r=new URLSearchParams(a);n.filter&&r.set("filter",n.filter);let s=r.toString(),o=n.section?c(n.section):"";return`${t}${s?`?${s}`:""}${o?`#${o}`:""}`}var m=e=>({as:e.slug,title:e.title,kind:e.kind,is:e.kind===null?e.slug===i?"home":"overview":e.address.startsWith("/places/")?"place":"list",...e.hidden?{hidden:!0}:{}});function d(e,n){let t=[];for(let a of e)a.kind!==null&&n.has(a.kind)||a.over?.some(r=>n.has(r))||t.some(r=>r.as===a.slug)||t.push(m(a));return t}function y(e,n,t={}){return d(l(e,n,t.pages?{pages:t.pages}:{}),t.kept??new Set)}export{c as a,p as b,y as c};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as te,b as Ke}from"./chunk.KHRS2SKB.js";import"./chunk.25CQCCLN.js";import"./chunk.T6PU3NKP.js";import"./chunk.KB5BCW23.js";import{j as qe,k as Be,l as Fe}from"./chunk.6YK5E7ZQ.js";import"./chunk.A2R53GWF.js";import"./chunk.Q2EGESEZ.js";import"./chunk.SMHP2CQH.js";import"./chunk.HJCQ6I3S.js";import"./chunk.EJ4MSVX2.js";import"./chunk.KQPKYWDM.js";import"./chunk.72YXFJKC.js";import"./chunk.OMRQTLI5.js";import{a as Oe,b as S}from"./chunk.MIE3ODQ2.js";import{a as ee,b as Ne}from"./chunk.NEPQBMFT.js";import"./chunk.MBB5A6BT.js";import"./chunk.ERPILTRY.js";import"./chunk.BIDL7GQD.js";import"./chunk.QS32TO4N.js";import"./chunk.JVDPRQ7J.js";import"./chunk.57YDGGJK.js";import{b as $e,c as We}from"./chunk.H7AH3IW4.js";import"./chunk.VCTAFSZ5.js";import"./chunk.XOZU4OFA.js";import"./chunk.4TH3CGAZ.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.MAHNJO6U.js";import"./chunk.75GENXGP.js";import"./chunk.YFVJUHAK.js";import"./chunk.NIAM7OTV.js";import"./chunk.XYGNS637.js";import"./chunk.DZSZUX34.js";import"./chunk.4EXC26LI.js";import"./chunk.PWAP2GJS.js";import"./chunk.AHPYNDVA.js";import"./chunk.FNVGNISQ.js";import{v as De}from"./chunk.WUVXIUA7.js";import"./chunk.OJGHDWI6.js";import"./chunk.BN7C5ZYX.js";import"./chunk.REUMBCSV.js";import{l as Le}from"./chunk.2KIWGQXC.js";import{c as Re}from"./chunk.D5LOTCBU.js";import{j as Pe}from"./chunk.KZUMXT5J.js";import"./chunk.CGK2PY76.js";import{G as dt,Ma as Z,Ra as Ce,T as Ie,Va as ze,ba as B,h as He,u as Ee}from"./chunk.CYTTZOYL.js";import"./chunk.SDO3U72B.js";import{Mc as Ae,Ob as Se,Oc as Te,qd as Me,sa as X,ta as q}from"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as J}from"./chunk.AJZBJBMO.js";var a=J(dt(),1);var n=J(Ie(),1);function St(u,o,r){let g=o.on??o.about[o.about.length-1];qe(u,o.about,{...r,pins:te(),...g===void 0?{}:{focus:g}})}function At({placement:u="float",chosen:o=!0}={}){let{menuAt:r}=B();return u==="menu"&&r===null?o?(0,n.jsx)(ut,{}):null:(0,n.jsx)(ct,{placement:u})}function ut(){let{store:u,setMenuAt:o,view:r}=B(),{selection:g}=Z(),h=(0,a.useRef)(null),[C,v]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let b=h.current?.offsetParent??h.current?.parentElement;if(!b)return;let m=Math.round(b.getBoundingClientRect().width);m!==C&&v(m)});let y=g.length===1&&!r.overview?u.graph.getNode(g[0]):void 0;return!y||C===null||C>=je?(0,n.jsx)("span",{ref:h,hidden:!0}):(0,n.jsx)("button",{type:"button",ref:h,"data-testid":"chosen-acts","aria-label":`What can be done with ${S(u,y.id)}`,"aria-haspopup":"menu",onClick:b=>{let m=b.currentTarget.getBoundingClientRect();o({x:Math.round(m.right),y:Math.round(m.bottom+4),on:y.id})},style:{position:"absolute",right:"calc(14px + var(--graview-dock, 0px))",top:98,zIndex:"var(--graview-layer-overview, 10)",minHeight:30,padding:"0 12px",borderRadius:8,fontSize:"0.8125rem",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Acts\u2026"})}var je=564;function ct({placement:u}){let{store:o,menuAt:r,setMenuAt:g,view:h,signIn:C}=B(),v=(0,a.useRef)(null),y=(0,a.useRef)(null),b=(0,a.useRef)(null),m=(0,a.useRef)(null);r?.returnTo&&(m.current=r.returnTo);let Ue=e=>{let i=e.closest("[data-graview-asking]")?.getAttribute("data-graview-asking"),t=e.getAttribute("data-pin-for"),l=i??e.getAttribute("data-affordance")??(t===null?null:`pin:${t}`)??e.getAttribute("data-menu-item");y.current=l===null?null:{key:l,element:e}};(0,a.useEffect)(()=>{let e=v.current,i=y.current;if(i===null||document.activeElement!==document.body||i.element.isConnected)return;let t=i.key;if(!e){y.current=null;let k=m.current;m.current=null,(k?.isConnected?k:b.current)?.focus();return}((t.startsWith("pin:")?e.querySelector(`[data-pin-for="${CSS.escape(t.slice(4))}"]`):null)??e.querySelector(`[data-affordance="${CSS.escape(t)}"]:not([disabled])`)??e).focus()});let[Ve,Ge]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let e=v.current?.offsetParent??v.current?.parentElement;if(e instanceof HTMLElement&&(b.current=e),!e)return;let i=e.getBoundingClientRect();Ge(t=>t&&t.left===i.left&&t.top===i.top&&t.width===i.width&&t.height===i.height?t:{left:i.left,top:i.top,width:i.width,height:i.height})});let{selection:Ye,set:Qe,clear:Je}=Z(),d=r?.about??Ye,[F,Xe]=(0,a.useState)(()=>te()),K=r?.on??d[d.length-1],_=r?.about,Ze=(0,a.useMemo)(()=>({pins:F,...K===void 0?{}:{focus:K},..._?{about:_}:{}}),[F,K,_]),et=(0,a.useMemo)(()=>new Set(o.allMutations().filter(e=>e.pinned).map(e=>e.name)),[o]),{affordances:p,withheld:ne,observations:ie}=Be(Ze),z=Te(ne,C),f=z?pt:ne,tt=r===null?null:{face:r.face??"scene",on:r.on,about:d,field:r.field,place:r.place,href:r.href,act:r.act,column:r.column,element:r.returnTo},re=De(tt),oe=ie.some(e=>e.id.startsWith("schema:waits:")),{apply:nt,preview:it}=Fe(),[P,A]=(0,a.useState)(null),[j,rt]=(0,a.useState)(null),[ot,ae]=(0,a.useState)(!1),[le,se]=(0,a.useState)(!1),[L,$]=(0,a.useState)(""),at=Ne({letters:!0}),[de,U]=(0,a.useState)(null),V=(0,a.useRef)([]),W=(e,i)=>{try{return it(e,i),nt(e,i),U(null),g(null),V.current=[],!0}catch(t){return U(Le(o.schema,o.allMutations(),t)),V.current=t instanceof Se?t.issues.map(l=>String(l.path[0]??"")).filter(Boolean):[],!1}},D=[...new Set(d.flatMap(e=>{let i=o.graph.getNode(e);return i?[i.kind]:[]}))],x=D.length>0?D:[...new Set(d.flatMap(e=>Ee(e)))],c=d.length===1?He(d[0]):null,G=c?{from:o.graph.getNode(c.from),to:o.graph.getNode(c.to)}:null,ue=c?We(o,c):void 0,ce=ue?.provisional?ue:void 0,pe=c?(()=>{let e=o.schema.tryDefinition(o.graph.getNode(c.from)?.kind??"")?.edges?.[c.kind],i=o.graph.getNode(c.to);return e?.inverse&&i?`From ${S(o,i.id)}: ${e.inverse}`:null})():null;(0,a.useEffect)(()=>{A(null),ae(!1),se(!1),U(null),$("")},[d,r?.about]);let ge=(0,a.useRef)(null);(0,a.useEffect)(()=>{let e=r?.begin;if(!e||ge.current===r)return;let i=p.find(l=>l.mutation===e.act);if(!i)return;ge.current=r;let t={...e.given};rt({id:i.id,given:t}),i.open.every(l=>l.name in t)?W({...i,args:{...i.args,...t},open:[]}):A(i.id)},[r,p]);let s=r!==null,lt=u==="menu"&&!s,T=(0,a.useRef)(r);T.current=r;let he=ze("acts",{open:s&&u==="menu",onOpenChange:e=>{e||g(null)},at:()=>T.current?{x:T.current.x,y:T.current.y}:null,returnTo:()=>{let e=T.current?.returnTo;if(e?.isConnected)return e;let i=T.current?.on;return i?document.querySelector(`[data-graview-view="${CSS.escape(i)}"]`):null},align:"start"}),me=(Ve?.width??Number.POSITIVE_INFINITY)<je;if((0,a.useLayoutEffect)(()=>{let e=v.current?.offsetParent;if(!e||!me||s)return;let i=v.current?.getBoundingClientRect().height??0,t=`${Math.round(i)+20}px`;if(e.style.paddingBottom===t)return;let l=e.style.paddingBottom;return e.style.paddingBottom=t,()=>{e.style.paddingBottom=l}}),d.length===0&&!s)return null;let fe=r?.title!==void 0||d.length>0&&!(d.length===1&&d[0]===h.focusId),ve=Math.max(1,Math.min(9,p.length)),M=[...p.filter(e=>e.provider==="invariant"&&!e.destructive),...p.filter(e=>e.pinned&&e.provider!=="invariant"&&!e.destructive),...p.filter(e=>!e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...p.filter(e=>e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...p.filter(e=>e.destructive)],ye=M.length>ve&&!s,we=L.trim().toLowerCase(),w=ye&&we.length>0?M.filter(e=>`${e.label} ${e.why}`.toLowerCase().includes(we)):null,Y=w??(ot||s?M:M.slice(0,ve)),be=w?0:M.length-Y.length,N=[];for(let e of Y){let i=!s&&e.provider==="invariant",t=!s&&!i&&e.pinned!==void 0&&!e.destructive,l=!s&&!i&&!t&&e.ties===!0&&!e.destructive,k=i?e.why:t?"pinned":l?"its ties":null,O=i?"violation":t||l?"ties":null,I=N[N.length-1];I&&I.heading===k?I.items.push(e):N.push({heading:k,tone:O,items:[e]})}let H=p.find(e=>e.id===P),Q=H&&j?.id===H.id?{...H,args:{...H.args,...j.given},open:H.open.filter(e=>!(e.name in j.given))}:H,R=d.length===1?S(o,d[0]):null,xe=e=>{if(!R)return e;let i=e.startsWith(`"${R}"`)?e.slice(R.length+2):e.startsWith(R)?e.slice(R.length):null;if(i===null)return e;let t=i.trimStart();return t.length===0?e:t[0].toUpperCase()+t.slice(1)},st=new Set(s?[]:Y.filter(e=>e.provider==="invariant").map(e=>e.why)),E=ie.filter(e=>!st.has(e.text)).map(e=>({...e,text:xe(e.text)}));return lt?null:(0,n.jsxs)("section",{...s?he.pane:{},ref:e=>{v.current=e,s&&he.pane.ref(e)},"aria-label":"Inspector","data-graview-offstage":"","data-testid":s?"context-menu":"inspector-strip",tabIndex:-1,onFocus:e=>Ue(e.target),onBlur:e=>{e.relatedTarget!==null&&(y.current=null)},onMouseDown:e=>e.stopPropagation(),style:{...s?Ce:{position:"absolute",zIndex:Me("rail")},boxSizing:"border-box",display:"flex",flexDirection:"column",gap:7,padding:"9px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",...s?{width:300,maxHeight:"min(52cqh, 420px)",overflow:"auto"}:me?{left:10,right:10,width:"auto",bottom:10,maxHeight:"min(42cqh, 300px)",overflow:"auto"}:{left:14,top:h.overview?"min(296px, 38cqh)":44,width:236,maxHeight:h.overview?"calc(100cqh - min(296px, 38cqh) - 20px)":"calc(68cqh - 94px)",overflow:"auto"}},children:[(0,n.jsx)("h2",{style:{...Pe,margin:0},children:"Inspector"}),(0,n.jsxs)("div",{style:{display:fe||!s?"flex":"none",alignItems:"baseline",flexWrap:"wrap",gap:"2px 8px",minWidth:0,paddingRight:s?0:24},children:[fe?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("strong",{style:{fontSize:"0.9375rem",whiteSpace:"nowrap"},children:r?.title??(d.length===1?S(o,d[0]):`${d.length} selected`)}),D.length>0||c?(0,n.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:c?"relation":D.map(e=>q(o.schema.tryDefinition(e),e)).join(" \xB7 ")}):null,d.length===1&&!c&&r?.face!=="pages"?(0,n.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:h.expanded.includes(d[0])?"\xB7 double-click closes":"\xB7 double-click opens"}):null]}):null,(0,n.jsx)("span",{style:{flex:"1 1 auto"}})]}),s?null:(0,n.jsx)("button",{type:"button",onClick:()=>{g(null),Je()},"aria-label":"Clear selection",title:"Clear selection",style:{position:"absolute",top:6,right:6,flex:"0 0 auto",width:24,height:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.875rem",lineHeight:1,borderRadius:7},children:"\xD7"}),c&&G?(0,n.jsxs)("div",{style:{display:"grid",gap:6},children:[pe?(0,n.jsx)("p",{"data-testid":"edge-said",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:pe}):null,ce?(0,n.jsx)("p",{"data-testid":"edge-provisional",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:$e(ce)}):null,(0,n.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[["from",G.from],["to",G.to]].map(([e,i],t)=>(0,n.jsxs)(a.Fragment,{children:[t===1?(0,n.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-ink-faint)"},children:"\u2192"}):null,i?(0,n.jsx)("button",{type:"button","data-testid":`edge-${e}`,onClick:()=>Qe([i.id]),title:`Select ${S(o,i.id)}`,style:{fontSize:"0.8125rem",padding:"3px 9px",borderRadius:6},children:S(o,i.id)}):(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"gone"})]},e))})]}):null,!c&&d.length===1&&Ae(o,d[0])?(0,n.jsx)("p",{"data-testid":"left-alone",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:"Left alone: nothing automated changes it."}):null,E.length>0?(0,n.jsx)("div",{"data-testid":"observations",title:E.map(e=>e.text).join(`
|
|
2
|
+
`),style:{display:"grid",gap:3},children:E.slice(0,2).map(e=>(0,n.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[e.text,e===E[1]&&E.length>2?(0,n.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" +",E.length-2]}):null]},e.id))}):null,s?re.start.map(e=>(0,n.jsx)(_e,{section:e,close:()=>g(null)},e.id)):null,de?(0,n.jsx)("p",{"data-testid":"refused",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-warn)"},children:de}):null,ye?(0,n.jsx)("input",{"data-testid":"action-filter",value:L,onChange:e=>$(e.target.value),placeholder:`Filter ${M.length} actions\u2026`,"aria-label":"Filter actions",onKeyDown:e=>{if(e.key==="Escape"){e.stopPropagation(),L.length>0?$(""):e.currentTarget.blur();return}if(e.key==="Enter"&&w?.length===1){let i=w[0];if(i.destructive)return;i.open.length>0?A(i.id):W(i)&&$("")}},style:{font:"inherit",fontSize:"0.875rem",padding:"5px 9px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):null,w!==null&&w.length===0?(0,n.jsxs)("p",{"data-testid":"no-matches",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:["Nothing offered here matches \u201C",L.trim(),"\u201D."]}):null,z&&p.length===0||p.length===0&&!oe&&d.length===0?null:p.length===0&&!oe?(0,n.jsx)("p",{"data-testid":"no-affordances",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:f.length>0?`Nothing you may do with ${c?"this relation":x.length===1?X(q(o.schema.tryDefinition(x[0]),x[0])):"this mix of kinds"} \u2014 ${f.length} action${f.length===1?"":"s"} withheld.`:c?`Nothing can be done with this line yet \u2014 nothing this app declares makes or breaks \u201C${Re(o.schema,o.graph.getNode(c.from)?.kind??"",c.kind,"out")}\u201D.`:`Nothing can be done with ${x.length===1?X(q(o.schema.tryDefinition(x[0]),x[0])):"this mix of kinds"} yet \u2014 nothing this app declares acts on ${x.length===1?"it":"them"}.`}):(0,n.jsxs)("ol",{...at,"data-testid":"affordances",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[N.map((e,i)=>(0,n.jsxs)(a.Fragment,{children:[e.heading?(0,n.jsxs)("li",{"data-graview-heading":e.tone,style:{fontSize:"0.75rem",lineHeight:1.4,color:e.tone==="violation"?"var(--graview-warn)":"var(--graview-ink-faint)",...e.tone!=="violation"?{letterSpacing:"0.12em",textTransform:"uppercase",fontSize:"0.75rem"}:{},padding:"2px 2px 1px",marginTop:i>0?6:0},children:[e.tone==="violation"?"\u26A0 ":"",e.tone==="violation"?xe(e.heading):e.heading]}):i>0?(0,n.jsx)("li",{"aria-hidden":"true",style:{borderTop:"1px solid var(--graview-edge)",margin:"6px 0 3px"}}):null,e.items.map(t=>(0,n.jsxs)("li",{style:{display:"flex",gap:2,alignItems:"stretch"},onKeyDown:l=>{if(l.metaKey||l.ctrlKey||l.altKey)return;let k=l.currentTarget.querySelector("[data-affordance]"),O=l.currentTarget.querySelector("[data-pin-for]"),I=l.target===O,ke=l.key==="ArrowRight"&&!I?O:I&&["ArrowLeft","ArrowUp","ArrowDown"].includes(l.key)?k:null;ke&&(l.preventDefault(),l.stopPropagation(),ke.focus())},children:[(0,n.jsxs)("button",{type:"button",[ee]:"","data-affordance":t.id,"data-rank":t.rank,"data-graview-destructive":t.destructive||void 0,"aria-pressed":P===t.id,title:t.why,style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:P===t.id?"var(--graview-accent)":s?"transparent":"var(--graview-edge)",background:s?"none":"var(--graview-panel)",boxShadow:"none",...t.destructive?{color:"var(--graview-warn)"}:{},...P===t.id?{color:"var(--graview-accent)"}:{}},onClick:()=>{if(t.open.length>0){A(P===t.id?null:t.id);return}W(t)},children:[t.label,t.open.length>0?(0,n.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:" \u2026"}):null,w?.length===1&&w[0]?.id===t.id&&!t.destructive?(0,n.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}):null]}),(0,n.jsx)("button",{type:"button","data-testid":"pin-toggle",tabIndex:-1,"data-pin-for":t.mutation,"aria-pressed":t.pinned!==void 0,"aria-label":t.pinned!==void 0?`Unpin ${t.label}`:`Pin ${t.label}`,title:t.pinned==="declared"?"Pinned by the app \u2014 unpin it for yourself":t.pinned==="user"?"Unpin":"Pin to the top",onClick:()=>Xe(Ke(F,t.mutation,et.has(t.mutation))),style:{flex:"0 0 auto",width:24,minHeight:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.75rem",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7,color:t.pinned==="user"?"var(--graview-accent)":t.pinned==="declared"?"var(--graview-ink-muted)":"var(--graview-ink-faint)"},children:t.pinned!==void 0?"\u2605":"\u2606"})]},t.id))]},`${e.heading??"plain"}-${i}`)),be>0?(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button",[ee]:"",onClick:()=>ae(!0),title:`Show all ${p.length} actions`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",be," more"]})}):null]}),z?(0,n.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>{g(null),z.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left"},children:z.label}):null,f.length>0?(0,n.jsxs)("ul",{"data-testid":"withheld",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[f.slice(0,s||le?f.length:3).map(e=>(0,n.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,n.jsx)("button",{type:"button",disabled:!0,"data-affordance":e.id,"data-rank":e.rank,"data-withheld":e.refusal.wouldNeed.join(",")||"nobody",style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8,borderStyle:"dashed",width:"100%",textAlign:"left",background:"none"},children:(0,n.jsx)("s",{children:e.label})}),(0,n.jsx)("span",{"data-testid":"withheld-why",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-ink-muted)",padding:"0 10px"},children:e.refusal.message})]},e.id)),!s&&!le&&f.length>3?(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button","data-testid":"withheld-more",onClick:()=>se(!0),title:`Show all ${f.length} actions this seat may not take`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",f.length-3," more withheld"]})}):null]}):null,s?re.end.map(e=>(0,n.jsx)(_e,{section:e,close:()=>g(null)},e.id)):null,Q?(0,n.jsx)(Oe,{affordance:Q,onApply:e=>{if(W(Q,e))A(null);else return V.current},onCancel:()=>A(null)}):null]})}var pt=[];function _e({section:u,close:o}){return(0,n.jsxs)("div",{"data-menu-section":u.id,...u.heading?{role:"group","aria-label":u.heading}:{},style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5},children:[u.heading?(0,n.jsx)("p",{"aria-hidden":"true",style:{margin:0,padding:"2px 2px 1px",fontSize:"0.75rem",lineHeight:1.4,letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:u.heading}):null,u.items&&u.items.length>0?(0,n.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:u.items.map(r=>(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button","data-menu-item":r.id,onClick:()=>{o(),r.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},children:[r.label,r.hint?(0,n.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",r.hint]}):null]})},r.id))}):null,u.render?.(o)]})}export{At as InspectorPane,St as prepareActs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as U,b as V,d as b,e as B,f as C,g as W}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{a as U,b as V,d as b,e as B,f as C,g as W}from"./chunk.HMMK7LCL.js";import{a as p,b as T,c as S,e as _}from"./chunk.BBLIT7S7.js";import{b as z}from"./chunk.CI4RZL4Z.js";import{a as J,b as h,e as A}from"./chunk.MT5DXJKN.js";import{a as R}from"./chunk.SDO3U72B.js";import"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var Q=R(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.K2HDEL7I.js")));function te(d,e){let f=d.ownerDocument,u=f.defaultView,t=f.createElement("iframe");t.setAttribute("sandbox",T),t.setAttribute("referrerpolicy","no-referrer"),t.setAttribute("allow",""),t.setAttribute("title",e.title??e.view),t.setAttribute("data-guest-view",e.view),t.setAttribute("aria-busy","true"),t.style.border="0",t.style.width="100%",t.style.display="block",t.src=e.url;let a={applied:0,refused:0,dropped:0},P=h(e.limits),i,y,o={applied:0,refused:0,dropped:0},v=()=>{if(!i)return;let r=i.stats;a.applied+=r.applied-o.applied,a.refused+=r.refused-o.refused,a.dropped+=r.dropped-o.dropped,o={...r}},O=W(u,()=>l(),"data"),g=()=>C(()=>e.theme?.()??b(d),e.brand,O),L="",l=()=>{i&&(L=JSON.stringify(g()),i.push())},k=B(f,()=>{i&&JSON.stringify(g())!==L&&l()}),n,w=!1,D=e.pictures?z(Q,({createGuestPictures:r})=>{n=r(u,{as:"data",view:`"${e.title??e.view}"`,pictures:e.pictures,...e.limits?{limits:e.limits}:{},...e.file?{file:e.file}:{},moved:()=>{i?.push(),G&&E()}}),w&&x()}):()=>{},G=!1,c,N=()=>{!G||n?.waiting()||(clearTimeout(c),t.removeAttribute("data-guest-view-failed"),t.removeAttribute("aria-busy"),t.setAttribute("data-guest-view-drawn",""))},E=()=>{clearTimeout(c),c=setTimeout(N,250)},F=setTimeout(()=>{i||(t.removeAttribute("aria-busy"),t.setAttribute("data-guest-view-failed","silent"))},e.limits?.readyMs??8e3),H=()=>{v(),i?.dispose(),y?.close(),i=void 0,y=void 0,o={applied:0,refused:0,dropped:0}},M=r=>{if(!(r.source===null||r.source!==t.contentWindow)){if(r.origin!==S||!P.message()){a.dropped+=1;return}if(!_(r.data)||r.data.protocol!==1){a.dropped+=1;return}if(e.pictures&&!n){w=!0;return}x()}},x=()=>{w=!1,H();let r=U(),m=new MessageChannel;y=m.port1;let I=A({store:e.store,principal:e.principal,view:e.view,nonce:r,send:s=>m.port1.postMessage(s),...e.input?{input:e.input}:{},...e.reads?{reads:e.reads}:{},...n?{hand:n.hand}:{},theme:g,...e.places?{places:()=>[...new Set(e.places().map(s=>s.as))],placesShown:e.places}:{},...e.onNavigatePlace?{onNavigatePlace:e.onNavigatePlace}:{},...e.onNavigate?{onNavigate:e.onNavigate}:{},...e.onArrive?{onArrive:e.onArrive}:e.goTo?{onArrive:s=>V(e.goTo(),s)}:{},...e.onLost?{onLost:e.onLost}:{},onSize:s=>{e.onSize?e.onSize(s):t.style.height=`${s}px`,N()},...e.limits?{limits:e.limits}:{},limiter:P});i=I,m.port1.onmessage=s=>{I.receive(s.data),v()};let j={graview:"host-hello",protocol:1,nonce:r,view:e.view};t.contentWindow.postMessage(j,"*",[m.port2]),l(),G=!0,E()};return u.addEventListener("message",M),d.appendChild(t),d.removeAttribute("aria-busy"),{iframe:t,update:l,get stats(){return v(),a},dispose(){H(),clearTimeout(F),clearTimeout(c),k(),O.dispose(),D(),n?.dispose(),u.removeEventListener("message",M),t.remove()}}}export{p as GUEST_PROTOCOL,T as GUEST_SANDBOX,S as OPAQUE_ORIGIN,A as createGuestHost,h as createGuestLimiter,te as mountGuestView,J as readAcross,b as readTheme};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{k as a,l as b,m as c,n as d,o as e,p as f,q as g,r as h,s as i}from"./chunk.ZLTHWCKL.js";import"./chunk.BJUUSIQY.js";import"./chunk.57YDGGJK.js";import"./chunk.H7AH3IW4.js";import"./chunk.VCTAFSZ5.js";import"./chunk.XOZU4OFA.js";import"./chunk.4TH3CGAZ.js";import"./chunk.YOUB3J3Y.js";import"./chunk.DZSZUX34.js";import"./chunk.REUMBCSV.js";import"./chunk.2KIWGQXC.js";import"./chunk.D5LOTCBU.js";import"./chunk.KZUMXT5J.js";import"./chunk.CGK2PY76.js";import"./chunk.CYTTZOYL.js";import"./chunk.SDO3U72B.js";import"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{i as GhostTray,h as InlineAiMenu,g as askAgain,c as askInline,a as askOf,b as drawPanel,d as heldSuggestion,e as suggestOnce,f as takeOffer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{f as k,h,i as b,n as S,o as w,p as I}from"./chunk.
|
|
1
|
+
import{f as k,h,i as b,n as S,o as w,p as I}from"./chunk.ZLTHWCKL.js";import"./chunk.BJUUSIQY.js";import"./chunk.57YDGGJK.js";import"./chunk.H7AH3IW4.js";import"./chunk.VCTAFSZ5.js";import"./chunk.XOZU4OFA.js";import"./chunk.4TH3CGAZ.js";import{a as A}from"./chunk.YOUB3J3Y.js";import"./chunk.DZSZUX34.js";import"./chunk.REUMBCSV.js";import"./chunk.2KIWGQXC.js";import"./chunk.D5LOTCBU.js";import"./chunk.KZUMXT5J.js";import"./chunk.CGK2PY76.js";import{G as M,T as f}from"./chunk.CYTTZOYL.js";import"./chunk.SDO3U72B.js";import"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as d}from"./chunk.AJZBJBMO.js";var n=d(M(),1);var r=d(f(),1),C="several";function T({chosen:c,acts:p,onAct:N}){let t=A(),u=(0,n.useMemo)(()=>[...c].sort(),[c]),i=u.join(`
|
|
2
2
|
`),o=(0,n.useMemo)(()=>({on:"selection",ids:u}),[i]),l=(0,n.useMemo)(()=>p.filter(e=>e.open.length===0&&!e.more&&!e.destructive),[p]),g=(0,n.useMemo)(()=>new Map(l.map(e=>[h(e.id),e])),[l]),v=S(t,o,C),[y,x]=(0,n.useState)(null);(0,n.useEffect)(()=>{if(v!==void 0)return;let e=!0;return w(t,o,{by:C,ask:()=>b(t.ai,{store:t.store,target:o,principal:t.principal,interaction:k(),places:t.places,selection:t.selection,...t.place?{place:t.place}:{},shared:l.map(a=>({id:a.id,label:a.label,mutation:a.mutation,args:a.args}))})}).then(a=>{e&&x({key:i,result:a})}),()=>{e=!1}},[i]);let s=v??(y?.key===i?y.result:void 0);if(s===void 0)return(0,r.jsx)("span",{role:"status",className:"graview-several-quiet","data-testid":"several-ai-thinking",style:{textDecoration:"none"},children:"AI: thinking\u2026"});let m=s.offers.filter(e=>e.type!=="act"||g.has(e.id));if(m.length===0)return null;let E=e=>{let a=g.get(e.id);if(a){t.desk.record({...s.interaction,outcome:"accepted",accepted:[e.id]}),N(a);return}I(t,s,e)};return(0,r.jsx)("div",{role:"group","aria-label":"Suggested by AI",className:"graview-several-acts","data-testid":"several-ai",children:m.map(e=>(0,r.jsxs)("button",{type:"button",className:"graview-several-act","data-testid":"several-ai-offer","data-ai-offer":e.id,"data-ai-offer-type":e.type,onClick:()=>E(e),children:[e.label,(0,r.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontWeight:400},children:" \xB7 suggested"})]},e.id))})}export{T as SeveralAi};
|