graview 0.1.62 → 0.1.64
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.2D7K2IJQ.js +4 -0
- package/dist/preview/{chunk.UFDJXQQQ.js → chunk.2DH42I7L.js} +6 -6
- package/dist/preview/chunk.2E62YCMZ.js +1 -0
- package/dist/preview/{chunk.GX4G4BX3.js → chunk.2G5WLG3Z.js} +1 -1
- package/dist/preview/chunk.2HV5FF6O.js +1 -0
- package/dist/preview/{chunk.LGRLVJGS.js → chunk.2JDAUKSN.js} +3 -3
- package/dist/preview/{chunk.ZN3PUM2I.js → chunk.2JEN2RCB.js} +1 -1
- package/dist/preview/{chunk.66P5IDTH.js → chunk.2TCOLAL2.js} +1 -1
- package/dist/preview/{chunk.OWOOKLIU.js → chunk.2V7QTIAV.js} +1 -1
- package/dist/preview/{chunk.IQ3PRWGO.js → chunk.2VIS2NAT.js} +2 -2
- package/dist/preview/{chunk.UQQKDBIH.js → chunk.2VYGDY5Z.js} +1 -1
- package/dist/preview/{chunk.WEOVK2T4.js → chunk.37I45R6V.js} +1 -1
- package/dist/preview/chunk.3FKKH2XU.js +74 -0
- package/dist/preview/chunk.3J7XLJP2.js +1 -0
- package/dist/preview/chunk.3OEODIHB.js +1 -0
- package/dist/preview/{chunk.WPXPVD33.js → chunk.3RD4JHVG.js} +1 -1
- package/dist/preview/{chunk.CHHYIMB7.js → chunk.3RUV4HE4.js} +1 -1
- package/dist/preview/chunk.3SAESG6X.js +1 -0
- package/dist/preview/{chunk.4HEFUOLV.js → chunk.47N2G7A5.js} +1 -1
- package/dist/preview/{chunk.A3ZC2JBO.js → chunk.4DZOAB4D.js} +1 -1
- package/dist/preview/chunk.4HTB6TX2.js +1 -0
- package/dist/preview/chunk.4Q5PCMGZ.js +18 -0
- package/dist/preview/{chunk.DPEIT3TW.js → chunk.4U45EY5M.js} +1 -1
- package/dist/preview/{chunk.2B6P4GPS.js → chunk.4VRX7FCO.js} +1 -1
- package/dist/preview/{chunk.JT3MFPRD.js → chunk.4XCYZRZ3.js} +1 -1
- package/dist/preview/chunk.52MBXPEK.js +1 -0
- package/dist/preview/chunk.5AD2QHWH.js +3 -0
- package/dist/preview/{chunk.MDEX6ZVE.js → chunk.5B7NG6WH.js} +1 -1
- package/dist/preview/chunk.5HJ2GTKZ.js +1 -0
- package/dist/preview/chunk.5IEZF433.js +2 -0
- package/dist/preview/{chunk.QGU5QTR6.js → chunk.5PPCK7QT.js} +1 -1
- package/dist/preview/chunk.6NRWLCIZ.js +5 -0
- package/dist/preview/chunk.75JQCTR6.js +1 -0
- package/dist/preview/{chunk.KMV6PJFL.js → chunk.77JI5T4F.js} +1 -1
- package/dist/preview/chunk.77MLXWZV.js +35 -0
- package/dist/preview/chunk.7AOEZJRM.js +1 -0
- package/dist/preview/{chunk.QIPASE42.js → chunk.7CLKGKSF.js} +1 -1
- package/dist/preview/{chunk.BZMQDEIY.js → chunk.7SRSE5IS.js} +1 -1
- package/dist/preview/{chunk.2GEJNG2U.js → chunk.7VAHHEDX.js} +1 -1
- package/dist/preview/{chunk.VJBBVLGZ.js → chunk.7ZG77OI3.js} +1 -1
- package/dist/preview/chunk.7ZHH7WBN.js +1 -0
- package/dist/preview/chunk.AJEK3I5X.js +6 -0
- package/dist/preview/chunk.APRWUIE3.js +1 -0
- package/dist/preview/{chunk.QHY5NVYH.js → chunk.APUQIELA.js} +1 -1
- package/dist/preview/{chunk.Y4FZKUOK.js → chunk.ATHLE33D.js} +1 -1
- package/dist/preview/chunk.B2YTHEX5.js +1 -0
- package/dist/preview/{chunk.ELOFPE25.js → chunk.B6JR7EQO.js} +1 -1
- package/dist/preview/{chunk.5ODHHH35.js → chunk.BN42H3C6.js} +1 -1
- package/dist/preview/{chunk.DD2NKFDX.js → chunk.BVIJXL4J.js} +1 -1
- package/dist/preview/{chunk.5HGD6OWL.js → chunk.CC7P435K.js} +2 -2
- package/dist/preview/{chunk.IQMD7DG3.js → chunk.CJHYGRWV.js} +1 -1
- package/dist/preview/chunk.CM65MCHA.js +1 -0
- package/dist/preview/{chunk.MYNMBOLD.js → chunk.D2XLECMP.js} +1 -1
- package/dist/preview/chunk.DJIF7IAQ.js +2 -0
- package/dist/preview/{chunk.G4ULQK64.js → chunk.DLWFULWE.js} +1 -1
- package/dist/preview/{chunk.QDWSU47A.js → chunk.DMENNIHT.js} +1 -1
- package/dist/preview/{chunk.L3WTKQQL.js → chunk.DN7UCBOA.js} +1 -1
- package/dist/preview/{chunk.22BZU7ME.js → chunk.DQAMVVE6.js} +1 -1
- package/dist/preview/chunk.DUP2CGVH.js +1 -0
- package/dist/preview/{chunk.TM4EPUNO.js → chunk.DYRULRFX.js} +1 -1
- package/dist/preview/{chunk.AFNSAQEQ.js → chunk.E4TXLT25.js} +1 -1
- package/dist/preview/{chunk.DDUCIUVW.js → chunk.F6BNFLQM.js} +1 -1
- package/dist/preview/chunk.FN34P4IS.js +1 -0
- package/dist/preview/{chunk.AJSUHPBE.js → chunk.FUPYIOXZ.js} +1 -1
- package/dist/preview/{chunk.7KVUUEZA.js → chunk.FXRYMT3U.js} +1 -1
- package/dist/preview/{chunk.DEAP3H2L.js → chunk.G5BVZLCM.js} +1 -1
- package/dist/preview/{chunk.Y2YYH3JN.js → chunk.G7YLK4PX.js} +1 -1
- package/dist/preview/chunk.GF62K25C.js +1 -0
- package/dist/preview/chunk.GFQPO3NC.js +1 -0
- package/dist/preview/{chunk.5STU3KYG.js → chunk.GH5UBSQI.js} +1 -1
- package/dist/preview/chunk.GHHKRFPD.js +1 -0
- package/dist/preview/{chunk.THVC2BEC.js → chunk.GP5DAA4P.js} +1 -1
- package/dist/preview/{chunk.VN23AGIY.js → chunk.HPG6CNKM.js} +1 -1
- package/dist/preview/chunk.HSJEOM3W.js +1 -0
- package/dist/preview/{chunk.H5S7OL2U.js → chunk.HZPRMHSL.js} +1 -1
- package/dist/preview/chunk.IQGSEAQ2.js +5 -0
- package/dist/preview/{chunk.PCDUV3WP.js → chunk.ITBG37WJ.js} +1 -1
- package/dist/preview/{chunk.SVPKUWZU.js → chunk.JHUCKEJS.js} +1 -1
- package/dist/preview/{chunk.H7N7WN4U.js → chunk.JOM6MFVE.js} +1 -1
- package/dist/preview/{chunk.DNVWSWL2.js → chunk.JS2UZYGB.js} +1 -1
- package/dist/preview/{chunk.7XLS6XTY.js → chunk.K2PXP5H6.js} +1 -1
- package/dist/preview/{chunk.6AKW7TXM.js → chunk.K54ISAXN.js} +1 -1
- package/dist/preview/{chunk.3FON2Y72.js → chunk.K5YFUMRS.js} +1 -1
- package/dist/preview/chunk.KHXRJLLU.js +50 -0
- package/dist/preview/chunk.KMIFSPGQ.js +1 -0
- package/dist/preview/chunk.L4V5VLSM.js +1 -0
- package/dist/preview/{chunk.T6WHGKWR.js → chunk.LDMBJC3B.js} +1 -1
- package/dist/preview/{chunk.PLTH2LW5.js → chunk.LTOQ22ZJ.js} +1 -1
- package/dist/preview/{chunk.UVA7AALY.js → chunk.M5VHUIDB.js} +1 -1
- package/dist/preview/chunk.N643PVQA.js +1 -0
- package/dist/preview/{chunk.FULEUL34.js → chunk.NGRL3QOI.js} +1 -1
- package/dist/preview/{chunk.OFWNMTGB.js → chunk.NRPBTV6O.js} +2 -2
- package/dist/preview/{chunk.N6EJXXQK.js → chunk.O7HHNQK4.js} +2 -2
- package/dist/preview/{chunk.5YAOKOGV.js → chunk.OW3M4OBN.js} +1 -1
- package/dist/preview/{chunk.2N4Z5K5S.js → chunk.OXFDB5BB.js} +1 -1
- package/dist/preview/{chunk.4TX6VCBT.js → chunk.P4TAX3HE.js} +1 -1
- package/dist/preview/{chunk.RYRQ66JN.js → chunk.P6FNJR6E.js} +1 -1
- package/dist/preview/chunk.PR74PGLC.js +1 -0
- package/dist/preview/{chunk.F7YXLYLX.js → chunk.PVDDSBRG.js} +1 -1
- package/dist/preview/{chunk.OUDATENL.js → chunk.QROPDEJF.js} +1 -1
- package/dist/preview/{chunk.I77ZGIFE.js → chunk.QRT6BZR6.js} +1 -1
- package/dist/preview/{chunk.OWT3VVOT.js → chunk.R5MLRKAO.js} +2 -2
- package/dist/preview/chunk.RDA35HZB.js +2 -0
- package/dist/preview/{chunk.ROZTJ6IY.js → chunk.REXU6ARY.js} +1 -1
- package/dist/preview/chunk.S6QZBWCJ.js +1 -0
- package/dist/preview/{chunk.MAKODQO3.js → chunk.S7SHWDPR.js} +1 -1
- package/dist/preview/{chunk.SWMDFXUX.js → chunk.SADHOSRC.js} +1 -1
- package/dist/preview/chunk.SJHUC4TL.js +1 -0
- package/dist/preview/chunk.SL5FXE3R.js +1 -0
- package/dist/preview/{chunk.X6KYRBL6.js → chunk.T4JP6BGP.js} +1 -1
- package/dist/preview/{chunk.TIALD6SC.js → chunk.T4TRJDBF.js} +1 -1
- package/dist/preview/{chunk.M4AYA2PL.js → chunk.TA2JTUNX.js} +1 -1
- package/dist/preview/{chunk.EVBCEEQ4.js → chunk.TMHVYI5R.js} +1 -1
- package/dist/preview/chunk.TOLW64EO.js +1 -0
- package/dist/preview/chunk.TP3PZRHE.js +1 -0
- package/dist/preview/{chunk.PZQNR4KZ.js → chunk.TQ2G4AM4.js} +1 -1
- package/dist/preview/{chunk.5J3O2FVG.js → chunk.TUR2DA2M.js} +1 -1
- package/dist/preview/{chunk.B23WZQXQ.js → chunk.TYIBLD2D.js} +1 -1
- package/dist/preview/{chunk.DC35FJAB.js → chunk.UD2GGG7L.js} +1 -1
- package/dist/preview/chunk.UDU545CL.js +1 -0
- package/dist/preview/{chunk.RPDH32XV.js → chunk.UDYFGYJP.js} +1 -1
- package/dist/preview/{chunk.SEHRPTNA.js → chunk.UJNLT3L6.js} +1 -1
- package/dist/preview/chunk.UN2IAA5R.js +1 -0
- package/dist/preview/chunk.VLX7YWVH.js +25 -0
- package/dist/preview/{chunk.T3UQ7ZQK.js → chunk.VT4YBFZL.js} +1 -1
- package/dist/preview/{chunk.ELTV44HU.js → chunk.VZAF3452.js} +2 -2
- package/dist/preview/{chunk.O2BHPYA4.js → chunk.WFCE7NLK.js} +2 -2
- package/dist/preview/{chunk.CY3ELWCM.js → chunk.WHX47OJM.js} +1 -1
- package/dist/preview/{chunk.NUWDMH47.js → chunk.WMARJ5E3.js} +1 -1
- package/dist/preview/chunk.WPQP54FM.js +1 -0
- package/dist/preview/{chunk.6JO5HQDR.js → chunk.WX23K7ZU.js} +1 -1
- package/dist/preview/{chunk.W4BKYSZX.js → chunk.X36BYTEG.js} +1 -1
- package/dist/preview/{chunk.AQRB7LDA.js → chunk.XCLW4GP7.js} +1 -1
- package/dist/preview/{chunk.DDO3GLEJ.js → chunk.XEG7ZDRG.js} +1 -1
- package/dist/preview/{chunk.ILIIBSGA.js → chunk.XIVELWAM.js} +1 -1
- package/dist/preview/{chunk.75GVFX7L.js → chunk.XJWKIXPV.js} +1 -1
- package/dist/preview/{chunk.O75HWF3F.js → chunk.XQ5RTPEF.js} +1 -1
- package/dist/preview/{chunk.NOGGSLVG.js → chunk.YEXFVDRA.js} +1 -1
- package/dist/preview/{chunk.UXMPFPFH.js → chunk.YIZPW7IK.js} +2 -2
- package/dist/preview/chunk.YLOGIJOH.js +1 -0
- package/dist/preview/chunk.YMXWS4XN.js +3 -0
- package/dist/preview/{chunk.Z2TDZSMN.js → chunk.YSBTE3PX.js} +1 -1
- package/dist/preview/{chunk.RD2X25XB.js → chunk.Z26T5E76.js} +1 -1
- package/dist/preview/{chunk.A3OL2BI2.js → chunk.Z4XGEV34.js} +1 -1
- package/dist/preview/chunk.ZA5TDCBC.js +1 -0
- package/dist/preview/chunk.ZNDVJGTY.js +1 -0
- package/dist/preview/chunk.ZQGLPP7A.js +1 -0
- 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.7M4HNKDR.js +0 -1
- package/dist/preview/chunk.7OBIBPYH.js +0 -1
- package/dist/preview/chunk.7V56P2A7.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.BLUKSGI4.js +0 -1
- 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.VACKSKGJ.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
- package/dist/preview/chunk.YP2QSPXU.js +0 -50
|
@@ -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.DUP2CGVH.js";import{h as Je,i as Xe,j as Qe}from"./chunk.7CLKGKSF.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.R5MLRKAO.js";import{c as Be,h as k,i as Ue,j as ze,t as ye}from"./chunk.YMXWS4XN.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 G,w as T,x as n,y as N,z as Y}from"./chunk.IQGSEAQ2.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:G(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(G(["string","number","date","image","video","file"])),default:n(H()),unit:n(t(void 0,12)),format:n(G(["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(G(["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(G(["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(G(["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)}),C=$({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(G(["light","dark","auto"])),subtitle:n(T(!1)),splash:n($({style:G(vn),image:n(t(1,ee)),title:n(t(1,80)),kicker:n(t(1,80)),shader:n(t(1,40)),scheme:n(G(["light","dark","device"]))})),views:n($({css:n(t(1)),motion:n(G(["none","fade"]))}))}),q=j(O(),H()),Fe=R([t(1,120),$({by:t(1,120),direction:n(G(["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(G(["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"),C)),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:G(["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:C,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 C of Object.keys(c.set))for(let z of B)if(!(!i.has(z)||e.kinds[z].fields[C]))if(e.kinds[z].computed?.[C]!==void 0)s.push(k("computed-written",`${S}.set.${C}`,`${z}'s ${C} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(z,C))continue;s.push(k("act-field",`${S}.set.${C}`,`${z} has no field "${C}"`))}}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))),C=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&&C.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:[...C],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,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{a as G,b as J}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 G,b as J}from"./chunk.B6JR7EQO.js";import"./chunk.DJIF7IAQ.js";import{a as K}from"./chunk.LTOQ22ZJ.js";import"./chunk.2TCOLAL2.js";import"./chunk.3OEODIHB.js";import"./chunk.HZPRMHSL.js";import"./chunk.TQ2G4AM4.js";import"./chunk.X36BYTEG.js";import"./chunk.G7YLK4PX.js";import{a as S,b as W}from"./chunk.MB7LKKUD.js";import"./chunk.ZA5TDCBC.js";import"./chunk.2JEN2RCB.js";import"./chunk.7CLKGKSF.js";import"./chunk.TMHVYI5R.js";import"./chunk.R5MLRKAO.js";import"./chunk.YMXWS4XN.js";import"./chunk.75JQCTR6.js";import"./chunk.5IEZF433.js";import"./chunk.5AD2QHWH.js";import"./chunk.3FKKH2XU.js";import"./chunk.DLWFULWE.js";import{D as H,E as V,G as ee,Ka as _,Ua as x,V as D,ea as F}from"./chunk.VLX7YWVH.js";import{a as j}from"./chunk.SDO3U72B.js";import{na as q,sd as B}from"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import{b}from"./chunk.AJZBJBMO.js";var t=b(ee(),1);var a=b(D(),1);function ae(n){let r=[];return n.applied.length>0&&n.intent&&r.push(`${n.intent}.`),n.unchanged.length>0&&r.push(`${n.unchanged.length} already so.`),n.allOrNothing&&r.push("None of it was kept."),r.join(" ")}var re=_(j(()=>(__graviewPreload(import.meta.url,["./chunk.O7HHNQK4.js","./chunk.BJUUSIQY.js","./chunk.TQ2G4AM4.js","./chunk.X36BYTEG.js","./chunk.LDMBJC3B.js","./chunk.XOZU4OFA.js","./chunk.G7YLK4PX.js","./chunk.GH5UBSQI.js","./chunk.2JEN2RCB.js","./chunk.75JQCTR6.js","./chunk.5IEZF433.js","./chunk.5AD2QHWH.js","./chunk.3FKKH2XU.js","./chunk.DLWFULWE.js","./chunk.VLX7YWVH.js","./chunk.SDO3U72B.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.47N2G7A5.js")))),te=re.part((n,r)=>(0,a.jsx)(n.SeveralAi,{...r}),{quiet:!0});function ne(n){let r=F()?.ai;return!H(r)||!V(r)?null:(0,a.jsx)(t.Suspense,{fallback:null,children:(0,a.jsx)(te,{...n})})}function ge({store:n,chosen:r,principal:d,context:v,via:k,anchor:A,of:g,onChooseAll:E,onClear:m,onActed:Q}){let[U,X]=(0,t.useState)(0);(0,t.useEffect)(()=>n.subscribe(()=>X(e=>e+1)),[n]);let f=r.join(`
|
|
2
2
|
`),{acts:c,withheld:N}=(0,t.useMemo)(()=>G(n,r,{...d?{principal:d}:{},...v?{context:v}:{}}),[n,f,d,v,U]),[O,p]=(0,t.useState)(!1),[l,u]=(0,t.useState)(null),[s,P]=(0,t.useState)(null),h=(0,t.useRef)(null),L=(0,t.useId)(),w=(0,t.useMemo)(()=>[...new Set(r.map(e=>n.graph.getNode(e)?.kind))],[n,f]),Y=w.length===1&&w[0]?`${q(n.schema,w[0],r.length)} chosen`:`${r.length} chosen`,M=typeof matchMedia=="function"&&matchMedia("(pointer: coarse), (max-width: 599px)").matches?2:3,C=c.filter(e=>!e.more),Z=C.slice(0,M),R=[...C.slice(M),...c.filter(e=>e.more)];(0,t.useEffect)(()=>{u(null),p(!1)},[f]),(0,t.useLayoutEffect)(()=>{let e=h.current;if(!e)return;if(typeof e.showPopover=="function"&&!x(e))try{e.showPopover()}catch{}let i=()=>{W(e,A?.()??null),dispatchEvent(new Event(S))};i(),addEventListener("resize",i),addEventListener("scroll",i,!0);let o=typeof ResizeObserver=="function"?new ResizeObserver(i):null;return o?.observe(e),()=>{if(o?.disconnect(),removeEventListener("resize",i),removeEventListener("scroll",i,!0),e.isConnected&&x(e))try{e.hidePopover()}catch{}dispatchEvent(new Event(S))}},[A]);let y=(0,t.useRef)({asking:l,onClear:m});y.current={asking:l,onClear:m},(0,t.useEffect)(()=>{let e=i=>{if(i.key!=="Escape"||i.defaultPrevented)return;let o=document.activeElement;if(!(!(h.current?.contains(o)??!1)&&(o instanceof HTMLTextAreaElement||o instanceof HTMLInputElement&&o.type!=="checkbox"||o instanceof HTMLSelectElement))){if(i.preventDefault(),i.stopPropagation(),y.current.asking){u(null);return}y.current.onClear()}};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]);let T=(e,i={})=>{let o=J(n,{mutation:e.mutation,subject:e.subject,args:{...e.args,...i},label:e.label},r,{...d?{author:d}:{},...k?{via:k}:{},...v?{context:v}:{}});u(null),p(!1),P(o.refused.length>0||o.applied.length===0?o:null),Q(o.refused.map(I=>I.id))},$=e=>{P(null),p(!1),e.open.length>0?u(e):T(e)},z=e=>(0,a.jsxs)("button",{type:"button",className:"graview-several-act","data-testid":"several-act","data-act":e.id,"data-mutation":e.mutation,...e.destructive?{"data-tone":"warn"}:{},"aria-pressed":l?.id===e.id?!0:void 0,onClick:()=>$(e),children:[e.label,e.open.length>0?"\u2026":""]},e.id);return(0,a.jsxs)("div",{ref:h,popover:"manual",role:"region","aria-label":"The chosen records",className:"graview-several-bar","data-testid":"several-bar","data-graview-foot":"","data-graview-overlay":"","data-graview-popover":"","data-graview-offstage":"",style:ie,children:[(0,a.jsx)("style",{children:oe}),(0,a.jsxs)("div",{className:"graview-several-line",children:[(0,a.jsx)("span",{role:"status","aria-live":"polite",className:"graview-several-count","data-testid":"several-count",children:Y}),(0,a.jsxs)("div",{role:"group","aria-label":`What to do with the ${r.length} chosen`,className:"graview-several-acts",children:[Z.map(z),R.length>0?(0,a.jsx)("button",{type:"button",className:"graview-several-act","data-testid":"several-more","aria-expanded":O,"aria-controls":L,onClick:()=>p(e=>!e),children:"More"}):null,E&&g!==void 0&&g>r.length?(0,a.jsxs)("button",{type:"button",className:"graview-several-quiet","data-testid":"several-all",onClick:E,children:["Choose all ",g]}):null,(0,a.jsx)("button",{type:"button",className:"graview-several-quiet","data-testid":"several-clear","aria-keyshortcuts":"Escape",title:"Put the choice down \u2014 Escape",onClick:m,children:"Clear"})]})]}),c.length>0&&r.length>1?(0,a.jsx)(ne,{chosen:r,acts:c,onAct:$}):null,O?(0,a.jsx)("div",{id:L,role:"group","aria-label":"More",className:"graview-several-acts","data-testid":"several-more-acts",children:R.map(z)}):null,c.length===0?(0,a.jsx)("p",{className:"graview-several-said","data-testid":"several-none",children:N.length>0?`Nothing here can be done to all of them by you: ${N[0].message}`:"Nothing can be done to all of these at once."}):null,l?(0,a.jsx)("div",{className:"graview-several-ask",role:"group","aria-label":`${l.label}, for all ${r.length}`,"data-testid":"several-ask",children:(0,a.jsx)(K,{store:n,affordance:l.affordance,onApply:e=>T(l,e),onCancel:()=>u(null)})}):null,s?(0,a.jsxs)("div",{role:"alert",className:"graview-several-said","data-testid":"several-outcome",children:[ae(s),s.refused.length>0?(0,a.jsxs)(a.Fragment,{children:[" ",s.refused.length===1?"One was not changed, and is still chosen:":`${s.refused.length} were not changed, and are still chosen:`,(0,a.jsx)("ul",{"data-testid":"several-refused",children:s.refused.map(e=>(0,a.jsxs)("li",{"data-record":e.id,children:["\u201C",e.label,"\u201D \u2014 ",e.message]},e.id))})]}):null]}):null]})}var ie={position:"fixed",inset:"auto",margin:0,zIndex:B("toast"),boxSizing:"border-box",width:"max-content",height:"auto",bottom:"calc(16px + env(safe-area-inset-bottom, 0px))",left:16,overflow:"visible"},oe=`
|
|
3
3
|
.graview-several-bar{display:grid;gap:8px;padding:8px 10px;border:1px solid var(--graview-edge);border-radius:var(--graview-radius,12px);background:var(--graview-float);color:var(--graview-ink);box-shadow:var(--graview-lift-high);font-size:.875rem;line-height:1.4;max-height:70vh;overflow:auto}
|
|
4
4
|
.graview-several-line{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;min-width:0}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk.B6JR7EQO.js";import"./chunk.DJIF7IAQ.js";import"./chunk.HZPRMHSL.js";import"./chunk.TQ2G4AM4.js";import"./chunk.X36BYTEG.js";import"./chunk.G7YLK4PX.js";import"./chunk.ZA5TDCBC.js";import"./chunk.2JEN2RCB.js";import"./chunk.7CLKGKSF.js";import"./chunk.TMHVYI5R.js";import"./chunk.R5MLRKAO.js";import"./chunk.YMXWS4XN.js";import"./chunk.75JQCTR6.js";import"./chunk.5IEZF433.js";import"./chunk.5AD2QHWH.js";import"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{b as actOnSeveral,a as actsForSeveral};
|
|
@@ -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{a as Qe,b as Xe,c as Je,d as at,e as tt,h as Ze,i as ea,k as aa,l as ta,m as rt}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 Qe,b as Xe,c as Je,d as at,e as tt,h as Ze,i as ea,k as aa,l as ta,m as rt}from"./chunk.ZQGLPP7A.js";import{c as je}from"./chunk.WHX47OJM.js";import{g as Qa,h as Ja,i as Za}from"./chunk.2D7K2IJQ.js";import"./chunk.2V7QTIAV.js";import{b as Ua,c as Va,d as Ye,e as Ya}from"./chunk.77JI5T4F.js";import"./chunk.UDU545CL.js";import{m as Re,q as qa,r as _a,s as Ga}from"./chunk.7VAHHEDX.js";import{a as Xa}from"./chunk.HJCQ6I3S.js";import{b as ja}from"./chunk.DQAMVVE6.js";import"./chunk.OXFDB5BB.js";import{b as Wa}from"./chunk.ATHLE33D.js";import{b as _e,d as Ue,e as Ve}from"./chunk.T4TRJDBF.js";import"./chunk.APUQIELA.js";import"./chunk.S6QZBWCJ.js";import{b as Ge}from"./chunk.LTOQ22ZJ.js";import"./chunk.2TCOLAL2.js";import"./chunk.FUPYIOXZ.js";import"./chunk.3OEODIHB.js";import"./chunk.BIDL7GQD.js";import"./chunk.TA2JTUNX.js";import"./chunk.HZPRMHSL.js";import"./chunk.TQ2G4AM4.js";import"./chunk.X36BYTEG.js";import"./chunk.U5P23GO7.js";import{e as et}from"./chunk.TOLW64EO.js";import"./chunk.4VRX7FCO.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.2E62YCMZ.js";import"./chunk.DUP2CGVH.js";import"./chunk.YEXFVDRA.js";import"./chunk.7CLKGKSF.js";import"./chunk.TMHVYI5R.js";import"./chunk.R5MLRKAO.js";import"./chunk.YMXWS4XN.js";import"./chunk.GZHZLJBF.js";import{c as Ha,d as Oa,e as we,p as Da}from"./chunk.3SAESG6X.js";import"./chunk.OJGHDWI6.js";import"./chunk.F6BNFLQM.js";import"./chunk.75JQCTR6.js";import"./chunk.5IEZF433.js";import"./chunk.5AD2QHWH.js";import{H as Fa,c as Na,d as Ia,k as qe,o as Ba,v as Ka}from"./chunk.3FKKH2XU.js";import{b as Ea,c as $t}from"./chunk.DLWFULWE.js";import{G,Ka as Ee,Pa as Ma,Qa as U,Ta as La,V as $,Xa as Pa,aa as Ra,ca as Ta,da as T,fa as Ce,i as Ke,j as $e,m as ee,n as Ae,o as Fe,oa as za,r as ve,x as Aa,y as ue,z as Ca}from"./chunk.VLX7YWVH.js";import{a as ie}from"./chunk.SDO3U72B.js";import{Qc as $a,Z as re,na as ka,oa as Se,pa as _,qd as H,sd as D,ta as Sa}from"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import{b as m}from"./chunk.AJZBJBMO.js";function At(e){return`
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
.graview-altitude-control {
|
|
@@ -1128,6 +1128,6 @@ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=gl
|
|
|
1128
1128
|
}
|
|
1129
1129
|
[data-graview-connector][data-graview-activity] {
|
|
1130
1130
|
animation: graview-relation 1200ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
1131
|
-
}`}function ra(e="dark",o={}){let d=At(e);return o.scope===void 0?d:Ea(d,o.scope)}var O=m(G(),1);var V=m($(),1),Ct=Ee(ie(()=>(__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.IQMD7DG3.js")))).part(e=>(0,V.jsx)(e.MapKey,{}),{quiet:!0});function ia(){let{store:e}=T(),{view:o}=U(),d=Ce(),s=(0,O.useMemo)(()=>e.graph.allEdges().length>0,[e,d]),[n,w]=(0,O.useState)(!1),v=(0,O.useId)(),g=(0,O.useRef)(null),x=(0,O.useRef)(null);return(0,O.useEffect)(()=>{if(!n)return;let h=c=>{let C=c.target;C&&(x.current?.contains(C)||g.current?.contains(C))||w(!1)};return document.addEventListener("pointerdown",h,!0),()=>document.removeEventListener("pointerdown",h,!0)},[n]),s?(0,V.jsxs)("div",{style:{display:"contents"},onKeyDown:h=>{h.key!=="Escape"||!n||(h.preventDefault(),h.stopPropagation(),w(!1),g.current?.focus({preventScroll:!0}))},children:[(0,V.jsx)("button",{ref:g,type:"button","data-testid":"lines-key","aria-expanded":n,"aria-controls":v,title:"What the lines mean",onClick:()=>w(h=>!h),style:{position:"absolute",top:60,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("overview"),height:30,padding:"0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.8125rem",color:n?"var(--graview-accent)":"var(--graview-ink-muted)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Key"}),n?(0,V.jsxs)("div",{ref:x,id:v,"data-testid":"lines-key-pane","data-graview-offstage":"",style:{position:"absolute",top:98,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("rail"),width:tt,maxHeight:"calc(100cqh - 120px)",overflowY:"auto",boxSizing:"border-box",padding:"8px 8px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[o.overview?(0,V.jsx)(Ct,{}):null,(0,V.jsx)(at,{inside:!0,widthOf:Xa})]}):null]}):null}var ze=m(G(),1),Te=m($(),1);function it(e){return e.lens!==null?{what:"lens",kind:e.lens}:e.records.length===1&&e.districts.length===0?{what:"record",id:e.records[0]}:e.districts.length===1&&e.records.length===0?{what:"district",kind:e.districts[0]}:null}var Et=Ee(ie(()=>(__graviewPreload(import.meta.url,["./chunk.RMR24LFJ.js","./chunk.RD2X25XB.js","./chunk.KMV6PJFL.js","./chunk.NAD7ZXYP.js","./chunk.2GEJNG2U.js","./chunk.HJCQ6I3S.js","./chunk.22BZU7ME.js","./chunk.2N4Z5K5S.js","./chunk.AJSUHPBE.js","./chunk.LAYQ5PFS.js","./chunk.KDXU5DT3.js","./chunk.O2BHPYA4.js","./chunk.M4AYA2PL.js","./chunk.H5S7OL2U.js","./chunk.PZQNR4KZ.js","./chunk.W4BKYSZX.js","./chunk.NOGGSLVG.js","./chunk.WVUJXDXZ.js","./chunk.SGCW2XRC.js","./chunk.ZN3PUM2I.js","./chunk.QIPASE42.js","./chunk.EVBCEEQ4.js","./chunk.OWT3VVOT.js","./chunk.NHTGAP3G.js","./chunk.GZHZLJBF.js","./chunk.UKQUUPKE.js","./chunk.OJGHDWI6.js","./chunk.DDUCIUVW.js","./chunk.NUYA4BWI.js","./chunk.OKZT2QBM.js","./chunk.ACTXR2MI.js","./chunk.AI34V6WV.js","./chunk.G4ULQK64.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.THVC2BEC.js")))),Rt=Et.part((e,o)=>(0,Te.jsx)(e.MapPanelFor,{showing:o.showing}),{what:"This panel",quiet:!0});function na(){let{store:e,view:o,selection:d,hiddenKinds:s,seatTalk:n}=T();Ce();let w=(0,ze.useSyncExternalStore)(n.subscribe,()=>n.get().draft!==null,()=>!1);if(!o.overview||w)return null;let v=it(ja(d,{...o,beside:!0},g=>e.graph.getNode(g)?.kind));return!v||v.what!=="record"&&(s.has(v.kind)||!e.schema.kinds.includes(v.kind))?null:(0,Te.jsx)(ze.Suspense,{fallback:null,children:(0,Te.jsx)(Rt,{showing:v})})}var Tt=m(G(),1);var W=m($(),1);function oa(){let{view:e,go:o}=U(),{store:d,views:s,hiddenKinds:n}=T(),w=e.overview??!1,v=s.places().map(E=>E.kind).filter(E=>!n.has(E)),g=Fa(e,d.schema.kinds,v),x=()=>{o($e(ee(e,!1),g))},h=(()=>{if(!g)return null;let E=Aa(g)[0],b=e.within?.view,R=(b?s.places().find(N=>N.as===b):void 0)??(E?s.places().filter(N=>N.kind===E).at(-1):void 0);return R?R.title:E?_(d.schema,E):d.graph.getNode(g)?.label??null})(),c=w?"Close the map":"Up",C=w&&h?`Close the map, down to ${h}`:c;return(0,W.jsxs)("button",{type:"button","data-testid":"overview",className:"graview-altitude-control","aria-pressed":w,"aria-label":C,title:w?C:"Up \u2014 the whole thing, from above",onClick:()=>w?x():o(ee(e,!0)),style:{position:"absolute",top:14,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("overview"),display:"inline-flex",alignItems:"center",justifyContent:"center",gap:7,height:38,padding:"0 13px 0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.875rem",whiteSpace:"nowrap",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)","--graview-altitude":w?1:0,...w?{color:"var(--graview-accent)"}:{}},children:[(0,W.jsxs)("svg",{className:"graview-altitude-mark",width:"16",height:"16",viewBox:"0 0 12 12","aria-hidden":"true",children:[(0,W.jsx)("ellipse",{className:"graview-altitude-mark-ring",cx:"6",cy:"6.6",rx:"5",ry:"2.6",fill:"none",stroke:"currentColor",strokeWidth:"0.9"}),(0,W.jsx)("circle",{className:"graview-altitude-mark-apex",cx:"6",cy:"4",r:"1.5",fill:"currentColor"}),(0,W.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"left",cx:"1.6",cy:"7.4",r:"1.2",fill:"currentColor"}),(0,W.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"right",cx:"10.4",cy:"7.4",r:"1.2",fill:"currentColor"})]}),(0,W.jsx)("span",{className:"graview-altitude-label",children:c})]})}var sa=m($(),1);function da(){let{administered:e}=T(),{view:o,go:d}=U(),s=e.filter(n=>n.canShow);return s.length===0?null:(0,sa.jsx)("div",{role:"group","aria-label":"Administered","data-testid":"administered",style:{display:"flex",gap:6},children:s.map(n=>(0,sa.jsx)("button",{type:"button","aria-pressed":n.shown,"data-testid":`show-${n.name}`,title:n.shown?`Hide the ${n.name}'s own districts again`:n.description??`Show the ${n.name}'s own districts beside the domain`,onClick:()=>d(Ua(o,n.name,!n.shown)),style:{padding:"3px 11px",borderRadius:999,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:n.shown?"var(--graview-accent)":"var(--graview-edge)",color:n.shown?"var(--graview-accent)":"var(--graview-ink-muted)",background:n.shown?"var(--graview-panel)":"transparent"},children:n.shown?`Hide the ${n.name}`:`Show the ${n.name}`},n.name))})}var u=m(G(),1);var t=m($(),1);Ra({search:_a,touchWeights:qa});var ne=e=>e!==void 0&&"act"in e,Me=e=>e!==void 0&&"hit"in e&&e.hit.about==="node"?e:void 0,zt=e=>e.about==="rule"?"rule:":e.about==="act"?"act:":e.kind;function Mt(e){let o=()=>typeof window>"u"||window.innerWidth>=Ft,[d,s]=(0,u.useState)(o);return(0,u.useEffect)(()=>{let n=()=>s(o());return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),d&&!e}function dt({compact:e=!1}){let{store:o,view:d,setView:s,principal:n,setMenuAt:w,brand:v,aiDesk:g,selection:x}=T(),h=Ia(g),c=Ta(),C=Ma(),E=Da().marks.flag,b=Mt(e),R=(0,u.useRef)(null),N=(0,u.useRef)(null),z=(0,u.useRef)(null),B=(0,u.useId)(),[Le,I]=(0,u.useState)(!1),[K,se]=(0,u.useState)(null),[ft,he]=(0,u.useState)(null),[Pe,be]=(0,u.useState)([]),M=d.q??"";(0,u.useEffect)(()=>{let a=r=>{if(r.defaultPrevented)return;let i=r.key.toLowerCase()==="k"&&(r.metaKey||r.ctrlKey)&&!r.altKey&&!r.shiftKey,l=r.key==="/"&&!r.metaKey&&!r.ctrlKey&&!r.altKey;if(!i&&!l)return;let p=R.current;if(!p)return;let f=p.closest("[data-graview-embed]"),S=r.target,J=S===document.body||S===document.documentElement||S===window;if(f&&!(i&&J||S instanceof Node&&f.contains(S)))return;let Z=document.activeElement,ge=Z instanceof HTMLInputElement||Z instanceof HTMLTextAreaElement||Z instanceof HTMLSelectElement||Z instanceof HTMLElement&&Z.isContentEditable;l&&ge||(r.preventDefault(),p.getClientRects().length===0&&p.closest("[data-graview-app-bar]")?.querySelector('[data-testid="app-find-open"]')?.click(),p.focus({preventScroll:!0}),p.select(),I(!0))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]);let Ne=(0,u.useMemo)(()=>{let a=new Map;for(let[i,l]of(c?.hits??[]).entries()){if(l.about==="act")continue;let p=zt(l),f=a.get(p)??[];f.push({id:`${B}-${i}`,hit:l}),a.set(p,f)}let r=[...a.values()].filter(i=>i.some(l=>l.hit.about==="node")).length>1;return[...a.entries()].map(([i,l])=>{let p=0,f=l.filter(ge=>ge.hit.about!=="node"||!r||++p<=Wt),S=f.filter(ge=>ge.hit.about==="node").length,J=i.endsWith(":")?l.length:c?.byKind[i]??S,Z=!i.endsWith(":")&&S>0&&J>S?{id:`${B}-all-${i}`,all:i,count:J}:null;return{key:i,rows:f,count:J,more:Z}})},[c,B]),ae=h&&M.trim()?{id:`${B}-ask`,ask:M.trim()}:null,k=(0,u.useMemo)(()=>[...Ne.flatMap(a=>a.more?[...a.rows,a.more]:a.rows),...ae?[ae]:[]],[Ne,ae?.ask]),wa=(c?.hits??[]).filter(a=>a.about==="node").length,xe=c?.words??M,Ie=(0,u.useMemo)(()=>Re(xe).split(" ").filter(Boolean),[xe]),F=(0,u.useCallback)(a=>a.hit.about==="node"?Ga(o,a.hit.id,xe,{principal:n,limit:Bt}).map((r,i)=>({id:`${a.id}-act-${i}`,act:r,of:a.id})):[],[o,xe,n]),He=k.find(a=>a.id===K),q=k.find(a=>a.id===ft)??He??k[0],de=(0,u.useMemo)(()=>b&&Me(q)?F(q):[],[b,q?.id,F]),ye=(0,u.useMemo)(()=>b?new Map:new Map(Pe.flatMap(a=>{let r=Me(k.find(i=>i.id===a));return r?[[a,F(r)]]:[]})),[b,Pe,k,F]),ht=(0,u.useMemo)(()=>b?new Set:new Set(k.flatMap(a=>Me(a)&&F(a).length>0?[a.id]:[])),[b,k,F]),Oe=(0,u.useMemo)(()=>b?de:[...ye.values()].flat(),[b,de,ye]),L=He??Oe.find(a=>a.id===K)??k[0];(0,u.useEffect)(()=>{se(null),he(null),be([])},[M]);let le=(0,u.useRef)(null);(0,u.useEffect)(()=>{let a=le.current;if(!a)return;le.current=null;let r=0,i=()=>{let l=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`),p=document.activeElement;if(!(!p||p===document.body||p===document.documentElement||p===R.current||p===z.current||p===l))return;let S=[...l?.querySelectorAll('[role="group"][aria-label="Arrange"] :is(button, input)')??[]].find(J=>J.checkVisibility?.()??!0);if(S)return S.focus({preventScroll:!0});l&&l.tabIndex>=0&&p!==l&&l.focus({preventScroll:!0}),++r<240?requestAnimationFrame(i):document.activeElement===z.current&&z.current?.blur()};requestAnimationFrame(i)},[d]);let De=(a,r)=>{let i=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`);if(i&&i.tabIndex>=0)return i.focus({preventScroll:!0});let l=z.current;if(!l)return R.current?.blur();l.setAttribute("aria-label",r),l.focus({preventScroll:!0})},ma=(0,u.useRef)({x:Number.NaN,y:Number.NaN,moved:!1});(0,u.useEffect)(()=>{let a=r=>{let i=ma.current;i.moved=r.clientX!==i.x||r.clientY!==i.y,i.x=r.clientX,i.y=r.clientY};return window.addEventListener("mousemove",a,{capture:!0,passive:!0}),()=>window.removeEventListener("mousemove",a,{capture:!0})},[]);let ce=(0,u.useRef)(void 0);(0,u.useEffect)(()=>()=>clearTimeout(ce.current),[]);let te=a=>{a&&(clearTimeout(ce.current),se(a.id),ne(a)||he(a.id))},fa=a=>{if(!ma.current.moved)return;let r=a.target.closest?.('[role="option"]')?.id;if(!r||r===K)return;let i=k.find(l=>l.id===r)??Oe.find(l=>l.id===r);i&&(se(i.id),!ne(i)&&(clearTimeout(ce.current),ce.current=setTimeout(()=>he(i.id),Kt)))},bt=()=>{clearTimeout(ce.current),q&&!ne(L)&&se(q.id)},xt=a=>be(r=>r.includes(a.id)?r.filter(i=>i!==a.id):[...r,a.id]),ha=a=>{let r=N.current,i=r?.querySelector('[role="option"]')?.getBoundingClientRect().height??0,l=r?.clientHeight??0;return Math.min(a,i>0&&l>0?Math.max(1,Math.floor(l/i)-1):Ot)};(0,u.useEffect)(()=>{K&&document.getElementById(K)?.scrollIntoView?.({block:"nearest"})},[K]);let We=a=>{if(!a)return;if("ask"in a){Na(g,{pointed:{...x[0]!==void 0?{on:x[0]}:{},about:x},asked:a.ask}),s(i=>Ye(i)),I(!1);return}if("all"in a)return s(i=>ue(ee(i,!1),ve(a.all),{ownPicture:!0,...i.q?{carry:i.q}:{}})),le.current=a.all,I(!1),De(a.all,`Opening ${_(o.schema,a.all)} matching \u201C${M.trim()}\u201D\u2026`);if(ne(a)){let i=a.act.subject;s(p=>Ae(p,[i]));let l=R.current?.getBoundingClientRect();w({x:l?.left??0,y:(l?.bottom??0)+6,on:i}),I(!1),R.current?.blur();return}let r=a.hit;switch(r.about){case"node":s(i=>Ae($e(ee(i,!1),r.id),[r.id]));break;case"kind":return s(i=>ue(ee(i,!1),ve(r.kind),{ownPicture:!0})),le.current=r.kind,I(!1),De(r.kind,`Opening ${r.label}\u2026`);case"place":return s(i=>Ca(i,r.kind,r.as)),le.current=r.kind,I(!1),De(r.kind,`Opening ${r.title}\u2026`);case"rule":{let i=C.filter(l=>l.invariant===r.name).flatMap(l=>l.nodeIds);s(l=>Ae(l,[...new Set(i)]));break}case"act":break}I(!1),R.current?.blur()},yt=c?Ht(c.byKind,c.hits,o.schema):"",pe=Le&&M.trim().length>0,kt=(0,u.useCallback)(()=>{let a=R.current?.closest("[data-graview-app-bar]")?.getBoundingClientRect();if(a)return{x:a.right,y:a.bottom-Ut};let r=R.current?.getBoundingClientRect();return r?{x:r.right,y:r.bottom}:null},[]),ba=Pa("find",{open:pe,onOpenChange:a=>{a||I(!1)},...e?{at:kt}:{}}),ke=k.every(a=>"ask"in a),xa=a=>ne(a)?Oe.filter(r=>r.of===a.of):[],St=a=>{let r=ne(L)&&K!==null,i=r?k.find(p=>p.id===L.of):K!==null?He:void 0,l=i?k.indexOf(i):-1;if(a.key==="ArrowDown"){if(a.preventDefault(),I(!0),r){let p=xa(L),f=p.indexOf(L)+1;if(f<p.length)return te(p[f]);if(b)return}te(k[Math.min(k.length-1,l+1)])}else if(a.key==="ArrowUp"){if(a.preventDefault(),r){let p=xa(L),f=p.indexOf(L)-1;return te(f>=0?p[f]:i)}te(k[Math.max(0,l-1)])}else if((a.key==="PageDown"||a.key==="PageUp")&&k.length>0){a.preventDefault(),I(!0);let p=a.key==="PageDown"?ha(k.length):-ha(k.length);te(k[Math.min(k.length-1,Math.max(0,(l<0?-1:l)+p))])}else if(a.key==="ArrowRight"&&!r&&Me(L)){let p=L,f=b?p.id===q?.id?de:F(p):ye.get(p.id)??F(p);if(f.length===0)return;a.preventDefault(),!b&&!Pe.includes(p.id)&&be(S=>[...S,p.id]),he(p.id),se(f[0].id)}else if(a.key==="ArrowLeft"&&r){a.preventDefault();let p=L.of;b||be(f=>f.filter(S=>S!==p)),te(k.find(f=>f.id===p))}else a.key==="Enter"?(a.preventDefault(),We(L)):a.key==="Escape"&&(a.preventDefault(),M?s(p=>Ye(p)):R.current?.blur())},Be=(a,r,i={},l={})=>{let p=a.id===L?.id;return(0,t.jsx)("div",{id:a.id,role:"option","aria-selected":p,onClick:()=>We(a),style:{...Zt,...p?er:null,...i},...l,children:r},a.id)},ya=(a,r)=>{let i=a.id===L?.id;return(0,t.jsx)("div",{id:a.id,role:"option","aria-selected":i,"data-testid":"find-act","data-about":"act",onClick:()=>We(a),style:{...r?ir:ct,...i?nr:null,...a.act.destructive?{color:"var(--graview-warn)"}:null},children:a.act.title},a.id)};return(0,t.jsxs)("div",{style:{position:"relative",minWidth:0,flex:"1 1 auto"},"data-testid":"find",children:[(0,t.jsx)("input",{ref:a=>{R.current=a,ba.trigger.ref(a)},"data-graview-popover-trigger":"find",type:"search",role:"combobox","aria-label":"Find anything","aria-expanded":pe,"aria-controls":B,"aria-autocomplete":"list",...pe&&L?{"aria-activedescendant":L.id}:{},"data-testid":"find-box",placeholder:"Find\u2026","aria-keyshortcuts":"/ Meta+K Control+K",value:M,onChange:a=>{let r=a.target.value;I(!0),s(i=>Va(i,r.length>0?r:null))},onFocus:()=>I(!0),onBlur:()=>I(!1),onKeyDown:St,style:{width:"100%",boxSizing:"border-box",minWidth:0,height:30,padding:"0 var(--graview-bar-find-end, 10px) 0 10px",font:"inherit",fontSize:"0.875rem",color:"var(--graview-ink)",background:"var(--graview-panel)",border:`1px solid ${M?"var(--graview-accent)":"var(--graview-edge)"}`,borderRadius:8}}),(0,t.jsx)("span",{role:"status","aria-live":"polite",style:qe,"data-testid":"find-count",children:M.trim()?yt:""}),(0,t.jsx)("span",{ref:z,tabIndex:-1,role:"status",style:qe,"data-testid":"find-landing"}),(0,t.jsxs)("div",{...ba.pane,id:B,role:"listbox","aria-label":M?`What \u201C${M}\u201D finds`:"What the words find","data-testid":"find-strip","data-graview-find":b?"panel":"narrow",hidden:!pe,onMouseDown:a=>a.preventDefault(),style:{..._t,...e?Vt:b&&!ke?Gt:null,...pe?{display:"flex"}:null},children:[(0,t.jsxs)("div",{style:{...Yt,gridTemplateColumns:b&&!ke?`minmax(0, 1fr) ${qt}`:"minmax(0, 1fr)"},children:[(0,t.jsxs)("div",{ref:N,role:"presentation","data-testid":"find-list",onMouseMove:fa,style:jt,children:[ke?(0,t.jsxs)("p",{role:"presentation",style:{margin:0,padding:"10px 12px",color:"var(--graview-ink-muted)",fontSize:"0.875rem"},"data-testid":"find-nothing",children:["Nothing here is called \u201C",c?.words||M,"\u201D."]}):Ne.map(a=>(0,t.jsxs)("div",{role:"group","aria-label":ot(a.key,o.schema),children:[(0,t.jsxs)("div",{role:"presentation",style:la,children:[a.key!=="rule:"&&a.key!=="act:"?(0,t.jsx)(lt,{kind:a.key,accents:v?.accents}):null,(0,t.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ot(a.key,o.schema)}),(0,t.jsx)("span",{"aria-hidden":"true",style:Jt,"data-testid":"find-group-count",children:re(a.count)})]}),a.rows.map(r=>{let i=r.hit,l=i.about==="node"?i:null,p=!b&&l!==null&&ht.has(r.id),f=ye.get(r.id);return(0,t.jsxs)(u.Fragment,{children:[Be(r,(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Pt,{hit:i,flag:E,words:l?.near&&l.why.matched?[...Ie,Re(l.why.matched)]:Ie}),p?(0,t.jsx)("span",{"aria-hidden":"true","data-testid":"find-acts-open","data-open":f?"":void 0,title:f?"Put its actions away":"Actions",onClick:S=>{S.stopPropagation(),xt(r)},style:{...sr,...f?dr:null},children:(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"3.5",cy:"8",r:"1.4",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"1.4",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"12.5",cy:"8",r:"1.4",fill:"currentColor"})]})}):null]}),p?{paddingRight:48}:{},{"data-testid":"find-hit","data-about":i.about,...l?.near?{"data-near":""}:{},title:It(i)}),f?(0,t.jsx)("div",{role:"group","aria-label":`What can be done about ${l?.label??"it"}`,style:or,children:f.map(S=>ya(S,!0))}):null]},r.id)}),a.more?Be(a.more,(0,t.jsxs)("span",{style:Q,children:["All ",re(a.more.count)," ",Se(o.schema,a.more.all).toLowerCase()," matching \u201C",M.trim(),"\u201D"]}),ar,{"data-testid":"find-all","data-about":"all"}):null]},a.key)),ae?Be(ae,(0,t.jsxs)("span",{style:Q,children:["Ask: ",(0,t.jsxs)("span",{style:{fontWeight:600},children:["\u2018",ae.ask,"\u2019"]})]}),{borderTop:"1px solid var(--graview-edge)",marginTop:4},{"data-testid":"find-ask"}):null,wa>Dt?(0,t.jsxs)("p",{role:"presentation",style:st,"data-testid":"find-more-words",children:[re(wa)," found: another word of the name narrows them."]}):null,c&&c.searched.past===!1&&c.searched.kinds.some(a=>o.schema.tryDefinition(a)?.lifecycle)?(0,t.jsx)("p",{role:"presentation",style:st,children:"Current ones; add is:any for the past."}):null]}),b&&!ke&&q?(0,t.jsxs)("div",{role:"group","aria-label":"The one lit","data-testid":"find-panel",onMouseEnter:bt,onMouseMove:fa,style:Qt,children:[(0,t.jsx)(Lt,{row:q,schema:o.schema,accents:v?.accents,marking:Ie,q:M.trim(),flag:E}),de.length>0?(0,t.jsxs)("div",{role:"group","aria-label":"Actions",style:{display:"grid",gap:4},children:[(0,t.jsx)("div",{role:"presentation",style:{...la,padding:"10px 0 4px"},children:"Actions"}),de.map(a=>ya(a,!1))]}):null]}):null]}),e?null:(0,t.jsxs)("div",{"aria-hidden":"true",style:lr,"data-testid":"find-keys",children:[(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"\u2191"}),(0,t.jsx)("kbd",{style:fe,children:"\u2193"})," move"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"\u21B5"})," open"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"\u2192"})," actions"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"esc"})," close"]})]})]})]})}function Lt({row:e,schema:o,accents:d,marking:s,q:n,flag:w}){let v=null,g="",x,h=null;if("ask"in e)g="Ask",x=`\u2018${e.ask}\u2019`,h=(0,t.jsx)("p",{style:Y,children:"Asks it of what is selected; the answer comes on a card beside it."});else if("all"in e)v=e.all,g=_(o,e.all),x=`All ${re(e.count)} matching \u201C${n}\u201D`,h=(0,t.jsxs)("p",{style:Y,children:["Opens the ",Se(o,e.all).toLowerCase(),", narrowed by these words."]});else{let c=e.hit;switch(c.about){case"node":{v=c.kind,g=nt(Sa(o.tryDefinition(c.kind),c.kind)),x=(0,t.jsxs)(t.Fragment,{children:[c.flagged?(0,t.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[w," "]}):null,(0,t.jsx)(j,{text:c.label,words:s})]});let C=[c.apart,c.current?null:"past",c.archived?"set aside":null].filter(Boolean).join(" \xB7 ");h=(0,t.jsxs)(t.Fragment,{children:[C?(0,t.jsx)("p",{style:Y,children:nt(C)}):null,c.near?(0,t.jsxs)("p",{style:Y,children:["Near \u201C",c.why.asked,"\u201D",c.why.field!=="label"?` \u2014 ${c.why.reading.toLowerCase()}: ${c.why.fragment}`:""]}):c.why.field!=="label"?(0,t.jsxs)("p",{style:Y,children:[(0,t.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:c.why.reading}),(0,t.jsx)("br",{}),(0,t.jsx)(j,{text:c.why.fragment,words:s})]}):null]});break}case"kind":v=c.kind,g="Kind",x=c.label,h=(0,t.jsxs)("p",{style:Y,children:["Goes into the ",c.label.toLowerCase(),", all of them",c.count>0?`; ${re(c.count)} match these words`:"","."]});break;case"place":v=c.kind,g="Place",x=c.title,h=(0,t.jsxs)("p",{style:Y,children:["A picture of the ",Se(o,c.kind).toLowerCase(),"."]});break;case"rule":g="Rule",x=c.label,h=(0,t.jsx)("p",{style:Y,children:"Selects what it flags."});break;case"act":g="Act",x=c.title;break}}return(0,t.jsxs)("div",{role:"presentation","data-testid":"find-said",style:{display:"grid",gap:6},children:[(0,t.jsxs)("div",{style:{...la,padding:0},children:[v?(0,t.jsx)(lt,{kind:v,accents:d}):null,g]}),(0,t.jsx)("div",{style:Xt,children:x}),h]})}function Pt({hit:e,flag:o,words:d}){switch(e.about){case"node":return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{style:tr,children:[e.flagged?(0,t.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[o," "]}):null,(0,t.jsx)(j,{text:e.label,words:d}),e.apart?(0,t.jsxs)("span",{style:me,children:[" \xB7 ",e.apart]}):null,e.current?null:(0,t.jsx)("span",{style:me,children:" \xB7 past"})]}),e.near?(0,t.jsxs)("span",{style:{...Q,...me},"data-testid":"find-near",children:["Near \u201C",e.why.asked,"\u201D",e.why.field!=="label"?` \u2014 ${e.why.reading.toLowerCase()}: `:"",e.why.field!=="label"?(0,t.jsx)(j,{text:e.why.fragment,words:d}):null]}):e.why.field!=="label"?(0,t.jsxs)("span",{style:{...Q,...me},children:[e.why.reading.toLowerCase(),": ",(0,t.jsx)(j,{text:e.why.fragment,words:d})]}):null]});case"kind":return(0,t.jsxs)("span",{style:Q,children:[(0,t.jsx)(j,{text:e.label,words:d}),(0,t.jsxs)("span",{style:me,children:[" \xB7 ",e.count," match"]})]});case"place":return(0,t.jsxs)("span",{style:Q,children:["Go to ",(0,t.jsx)(j,{text:e.title,words:d})]});case"rule":return(0,t.jsxs)("span",{style:Q,children:["The rule \u201C",(0,t.jsx)(j,{text:e.label,words:d}),"\u201D"]});case"act":return(0,t.jsx)("span",{style:Q,children:e.title})}}function Nt(e,o){if(o.length===0)return[{text:e}];let d=[],s=0;for(let n of e.matchAll(/[\p{L}\p{N}]+/gu)){let w=n[0],v=Re(w).replace(/ /g,""),g=o.filter(c=>v.startsWith(c)).sort((c,C)=>C.length-c.length)[0];if(!g)continue;let x=v.length===w.length?g.length:w.length,h=n.index??0;h>s&&d.push({text:e.slice(s,h)}),d.push({text:w.slice(0,x),marked:!0}),s=h+x}return s<e.length&&d.push({text:e.slice(s)}),d}function j({text:e,words:o}){return(0,t.jsx)(t.Fragment,{children:Nt(e,o).map((d,s)=>d.marked?(0,t.jsx)("mark",{style:rr,children:d.text},s):(0,t.jsx)(u.Fragment,{children:d.text},s))})}function It(e){if(e.about!=="node")return"";let o=e.near?`Near \u201C${e.why.asked}\u201D`:e.why.field!=="label"?`${e.why.reading}: ${e.why.fragment}`:"";return o?`${e.label}
|
|
1132
|
-
${o}`:e.label}var nt=e=>e&&e[0].toUpperCase()+e.slice(1);function lt({kind:e,accents:o}){let d=Math.round($a(e,o));return(0,t.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:2,flex:"0 0 auto",background:`hsl(${d} 55% 52%)`}})}function ot(e,o){return e==="rule:"?"Rules":e==="act:"?"Acts":_(o,e)}function Ht(e,o,d){let s=Object.entries(e).map(([v,g])=>ka(d,v,g)),n=o.filter(v=>v.about==="kind"||v.about==="place"||v.about==="rule").length;n>0&&s.push(`${n} ${n===1?"place or rule":"places and rules"}`);let w=o.filter(v=>v.about==="node"&&v.near).length;return s.length===0?"Nothing found":`${s.join(", ")} found${w>0?`, ${w} of them near`:""}`}var Ot=10,Dt=12,Wt=5,Bt=6,Kt=140,Ft=760,qt="15.5rem",_t={...La,flexDirection:"column",width:"min(26rem, calc(100vw - 24px))",maxHeight:"min(64vh, 30rem)",overflow:"hidden",boxSizing:"border-box",background:"linear-gradient(var(--graview-panel), var(--graview-panel)) var(--graview-ground, var(--graview-panel))",borderTop:"1px solid var(--graview-edge)",borderRight:"1px solid var(--graview-edge)",borderBottom:"1px solid var(--graview-edge)",borderLeft:"1px solid var(--graview-edge)",borderRadius:10,boxShadow:"0 10px 28px rgb(0 0 0 / 0.18)",padding:0},Gt={width:"min(42rem, calc(100vw - 24px))"},Ut=6,Vt={width:"var(--graview-bar-width, 100vw)",maxHeight:"55vh",borderRadius:0,borderLeft:"none",borderRight:"none"},Yt={display:"grid",gridTemplateRows:"minmax(0, 1fr)",flex:"1 1 auto",minHeight:0},jt={overflowY:"auto",overflowX:"hidden",minHeight:0,padding:"4px 0",overscrollBehavior:"contain"},Qt={overflowY:"auto",minHeight:0,padding:"12px 14px",borderLeft:"1px solid var(--graview-edge)",background:"var(--graview-panel-muted)",display:"flex",flexDirection:"column",gap:4},Xt={fontWeight:600,fontSize:"0.9375rem",lineHeight:1.35,color:"var(--graview-ink)",overflowWrap:"anywhere"},Y={margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)",overflowWrap:"anywhere"},la={display:"flex",alignItems:"center",gap:6,padding:"10px 12px 4px",fontSize:"0.6875rem",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},Jt={marginLeft:"auto",fontWeight:400,letterSpacing:0,fontVariantNumeric:"tabular-nums",color:"var(--graview-ink-faint)"},Zt={position:"relative",display:"grid",gap:1,minHeight:34,padding:"5px 12px",alignContent:"center",cursor:"pointer",fontSize:"0.875rem",lineHeight:1.35,color:"var(--graview-ink)",minWidth:0},er={background:"color-mix(in srgb, var(--graview-accent) 12%, var(--graview-panel))",boxShadow:"inset 3px 0 0 var(--graview-accent)"},ar={color:"var(--graview-accent)",fontSize:"0.8125rem",minHeight:30},Q={display:"block",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},tr={display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,minWidth:0,overflow:"hidden",overflowWrap:"anywhere",fontWeight:600},me={color:"var(--graview-ink-muted)",fontSize:"0.8125rem",fontWeight:400},rr={background:"color-mix(in srgb, var(--graview-accent) 24%, transparent)",color:"inherit",borderRadius:2,padding:0,boxShadow:"0 1px 0 color-mix(in srgb, var(--graview-accent) 70%, transparent)"},ct={display:"flex",alignItems:"center",minHeight:32,padding:"4px 10px",boxSizing:"border-box",borderWidth:1,borderStyle:"solid",borderColor:"var(--graview-edge)",borderRadius:6,background:"var(--graview-panel)",color:"var(--graview-ink)",fontSize:"0.8125rem",lineHeight:1.3,cursor:"pointer",overflowWrap:"anywhere"},ir={...ct,minHeight:32,margin:"0 12px 4px 24px"},nr={borderColor:"var(--graview-accent)",boxShadow:"inset 0 0 0 1px var(--graview-accent)",background:"color-mix(in srgb, var(--graview-accent) 12%, var(--graview-panel))"},or={display:"grid",padding:"2px 0 6px"},sr={position:"absolute",top:"50%",right:6,transform:"translateY(-50%)",width:36,height:32,display:"grid",placeItems:"center",borderRadius:6,color:"var(--graview-ink-muted)",borderWidth:1,borderStyle:"solid",borderColor:"transparent"},dr={color:"var(--graview-accent)",borderColor:"var(--graview-edge)",background:"var(--graview-panel)"},st={margin:0,padding:"6px 12px 4px",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},lr={display:"flex",flexWrap:"wrap",gap:"4px 14px",padding:"7px 12px",borderTop:"1px solid var(--graview-edge)",color:"var(--graview-ink-faint)",fontSize:"0.75rem",flex:"0 0 auto"},fe={display:"inline-block",minWidth:16,padding:"0 4px",marginRight:3,border:"1px solid var(--graview-edge)",borderRadius:4,font:"inherit",fontSize:"0.6875rem",lineHeight:"16px",textAlign:"center",color:"var(--graview-ink-muted)",background:"var(--graview-panel)"};var oe=m(G(),1);var ca=m($t(),1);var gt=m($(),1);function pt(){let{following:e,follow:o}=T();return e?(0,gt.jsxs)("button",{type:"button","data-testid":"following-who",onClick:()=>o(null),title:"Press, or Escape, to stop following",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,padding:"2px 9px",borderRadius:999,border:"1px solid var(--graview-accent)",background:"transparent",color:"var(--graview-accent)",fontSize:"0.875rem",whiteSpace:"nowrap"},children:["following ",e.name]}):null}var vt=m(G(),1);var A=m($(),1);function ut({home:e,homeLabel:o,children:d,onPicture:s=!1}){let{view:n,focus:w,show:v,go:g}=U(),{store:x}=T(),{movedByHand:h}=T(),c=h&&(n.pan!==void 0||Object.keys(n.pins).length>0),C=n.focusId&&n.focusId!==e?x.graph.getNode(n.focusId):void 0,E=z=>_(x.schema,z),b={display:"inline-flex",alignItems:"center",gap:6,minHeight:26,padding:"2px 6px",fontSize:"0.8125rem",borderRadius:6,border:"1px solid transparent",boxShadow:"none",background:"transparent",color:"var(--graview-ink-muted)",whiteSpace:"nowrap"},R=o!==void 0&&C!==void 0,N=[];if(C&&!s&&N.push({key:"focused",node:(0,A.jsxs)("button",{type:"button","data-testid":"focused",onClick:()=>g(Fe({...n,focusId:e},!1)),title:Ge(x,C.id),style:{...b,maxWidth:"min(14rem, 15vw)"},children:[(0,A.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:Ge(x,C.id)}),(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),n.past&&N.push({key:"past",node:(0,A.jsxs)("button",{type:"button","data-testid":"past",onClick:()=>g(Ya(n,!1)),title:"Back to now \u2014 retired things leave the picture again",style:b,children:["the past",(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),n.zoom&&N.push({key:"zoomed",node:(0,A.jsxs)("button",{type:"button","data-testid":"zoomed",onClick:()=>g(Fe(n,!1)),title:"Zoom back out",style:b,children:["zoomed in",(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),c&&N.push({key:"moved",node:(0,A.jsx)("button",{type:"button","data-testid":"moved",onClick:()=>g(Ke(n)),title:"Put the camera and everything you dragged back where the layout wanted them",style:b,children:"Reset view"})}),n.relation){let z=n.relation;N.push({key:"raised",node:(0,A.jsxs)("span",{style:{display:"inline-flex",alignItems:"center"},children:[(0,A.jsxs)("button",{type:"button","data-testid":"raised-into",onClick:()=>g(ue(n,ve(z),{ownPicture:!0})),title:`Go into the ${E(z).toLowerCase()}`,"aria-label":`Go into the ${E(z).toLowerCase()}`,style:{...b,color:"var(--graview-ink)"},children:[E(z),(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\u2198"})]}),(0,A.jsx)("button",{type:"button","data-testid":"raised",onClick:()=>v(null),title:`Stop showing ${E(z).toLowerCase()}`,"aria-label":`Stop showing ${E(z).toLowerCase()}`,style:{...b,minWidth:26,justifyContent:"center"},children:(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})})]})})}return s&&!R&&N.length===0&&d===void 0?null:(0,A.jsxs)("nav",{"aria-label":"View","data-testid":"trail",style:{display:"flex",alignItems:"center",gap:8,fontSize:"0.875rem",minWidth:0,...s?{pointerEvents:"auto",padding:"4px 6px",borderRadius:8,background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",overflow:"hidden"}:{}},children:[R?(0,A.jsx)("button",{type:"button",onClick:()=>w(e),style:{border:"none",background:"none",padding:"3px 0",minHeight:24,whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:o}):null,N.map(({key:z,node:B},Le)=>(0,A.jsxs)(vt.Fragment,{children:[R||Le>0?(0,A.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:"\u203A"}):null,B]},z)),d]})}var P=m($(),1);function pa(){let[e,o]=(0,oe.useState)([]),d=(0,oe.useCallback)(s=>{o(n=>{let w=s.phase!=="running"&&n[0]?.name===s.name&&n[0]?.at===s.at;return[s,...w?n.slice(1):n].slice(0,12)})},[]);return[e,d]}function ga({find:e,calls:o,seat:d,remembers:s=!1}){return e?(0,P.jsxs)(P.Fragment,{children:[(0,ca.createPortal)((0,P.jsx)(dt,{compact:e.compact}),e.slot),e.own?(0,ca.createPortal)((0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(oe.Suspense,{fallback:null,children:(0,P.jsx)(rt,{})}),(0,P.jsx)(Wa,{calls:o,remembers:s,...d!==void 0?{seat:d}:{}})]}),e.own):null]}):null}function va({home:e=null}){return(0,P.jsxs)("div",{"data-graview-scene-trail":"",style:{position:"absolute",top:14,left:14,maxWidth:"calc(100% - 150px - var(--graview-dock, 0px))",zIndex:D("overview"),display:"flex",alignItems:"center",gap:6,minWidth:0,pointerEvents:"none"},children:[(0,P.jsx)(ut,{home:e,onPicture:!0}),(0,P.jsx)("span",{style:{pointerEvents:"auto"},children:(0,P.jsx)(pt,{})})]})}var X=m(G(),1);var wt=m($(),1),cr=ie(()=>(__graviewPreload(import.meta.url,["./chunk.Q355UPFG.js","./chunk.AI34V6WV.js","./chunk.G4ULQK64.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.F7YXLYLX.js")));function ua(){let{store:e,principal:o}=T(),d=(0,X.useContext)(Ba),s=(0,X.useRef)(null),n=(0,X.useRef)(!1);return(0,X.useEffect)(()=>()=>void(n.current=!0),[]),(0,X.useEffect)(()=>{let w=e.batches().length,v=cr().then(g=>g.sceneWay(e,o,d,w,s.current),()=>{});return()=>void v.then(g=>g?.(n.current))},[e,o,d]),(0,wt.jsx)("span",{ref:s,hidden:!0})}var mt=m(G(),1);var y=m($(),1);function qi({address:e=!1,auto:o,quickAsk:d=!0,scheme:s,scope:n}){let w=(0,mt.useMemo)(()=>`${ta({scope:`.${n}`})}
|
|
1131
|
+
}`}function ra(e="dark",o={}){let d=At(e);return o.scope===void 0?d:Ea(d,o.scope)}var O=m(G(),1);var V=m($(),1),Ct=Ee(ie(()=>(__graviewPreload(import.meta.url,["./chunk.3FKKH2XU.js","./chunk.DLWFULWE.js","./chunk.VLX7YWVH.js","./chunk.SDO3U72B.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.CJHYGRWV.js")))).part(e=>(0,V.jsx)(e.MapKey,{}),{quiet:!0});function ia(){let{store:e}=T(),{view:o}=U(),d=Ce(),s=(0,O.useMemo)(()=>e.graph.allEdges().length>0,[e,d]),[n,w]=(0,O.useState)(!1),v=(0,O.useId)(),g=(0,O.useRef)(null),x=(0,O.useRef)(null);return(0,O.useEffect)(()=>{if(!n)return;let h=c=>{let C=c.target;C&&(x.current?.contains(C)||g.current?.contains(C))||w(!1)};return document.addEventListener("pointerdown",h,!0),()=>document.removeEventListener("pointerdown",h,!0)},[n]),s?(0,V.jsxs)("div",{style:{display:"contents"},onKeyDown:h=>{h.key!=="Escape"||!n||(h.preventDefault(),h.stopPropagation(),w(!1),g.current?.focus({preventScroll:!0}))},children:[(0,V.jsx)("button",{ref:g,type:"button","data-testid":"lines-key","aria-expanded":n,"aria-controls":v,title:"What the lines mean",onClick:()=>w(h=>!h),style:{position:"absolute",top:60,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("overview"),height:30,padding:"0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.8125rem",color:n?"var(--graview-accent)":"var(--graview-ink-muted)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Key"}),n?(0,V.jsxs)("div",{ref:x,id:v,"data-testid":"lines-key-pane","data-graview-offstage":"",style:{position:"absolute",top:98,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("rail"),width:tt,maxHeight:"calc(100cqh - 120px)",overflowY:"auto",boxSizing:"border-box",padding:"8px 8px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[o.overview?(0,V.jsx)(Ct,{}):null,(0,V.jsx)(at,{inside:!0,widthOf:Xa})]}):null]}):null}var ze=m(G(),1),Te=m($(),1);function it(e){return e.lens!==null?{what:"lens",kind:e.lens}:e.records.length===1&&e.districts.length===0?{what:"record",id:e.records[0]}:e.districts.length===1&&e.records.length===0?{what:"district",kind:e.districts[0]}:null}var Et=Ee(ie(()=>(__graviewPreload(import.meta.url,["./chunk.2D7K2IJQ.js","./chunk.Z26T5E76.js","./chunk.77JI5T4F.js","./chunk.UDU545CL.js","./chunk.7VAHHEDX.js","./chunk.HJCQ6I3S.js","./chunk.DQAMVVE6.js","./chunk.OXFDB5BB.js","./chunk.FUPYIOXZ.js","./chunk.APRWUIE3.js","./chunk.3OEODIHB.js","./chunk.WFCE7NLK.js","./chunk.BIDL7GQD.js","./chunk.TA2JTUNX.js","./chunk.HZPRMHSL.js","./chunk.TQ2G4AM4.js","./chunk.X36BYTEG.js","./chunk.Q5WEOX3Q.js","./chunk.2E62YCMZ.js","./chunk.DUP2CGVH.js","./chunk.YEXFVDRA.js","./chunk.WVUJXDXZ.js","./chunk.ZA5TDCBC.js","./chunk.2JEN2RCB.js","./chunk.7CLKGKSF.js","./chunk.TMHVYI5R.js","./chunk.R5MLRKAO.js","./chunk.YMXWS4XN.js","./chunk.GZHZLJBF.js","./chunk.3SAESG6X.js","./chunk.OJGHDWI6.js","./chunk.F6BNFLQM.js","./chunk.75JQCTR6.js","./chunk.5IEZF433.js","./chunk.5AD2QHWH.js","./chunk.3FKKH2XU.js","./chunk.DLWFULWE.js","./chunk.VLX7YWVH.js","./chunk.SDO3U72B.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.GP5DAA4P.js")))),Rt=Et.part((e,o)=>(0,Te.jsx)(e.MapPanelFor,{showing:o.showing}),{what:"This panel",quiet:!0});function na(){let{store:e,view:o,selection:d,hiddenKinds:s,seatTalk:n}=T();Ce();let w=(0,ze.useSyncExternalStore)(n.subscribe,()=>n.get().draft!==null,()=>!1);if(!o.overview||w)return null;let v=it(ja(d,{...o,beside:!0},g=>e.graph.getNode(g)?.kind));return!v||v.what!=="record"&&(s.has(v.kind)||!e.schema.kinds.includes(v.kind))?null:(0,Te.jsx)(ze.Suspense,{fallback:null,children:(0,Te.jsx)(Rt,{showing:v})})}var Tt=m(G(),1);var W=m($(),1);function oa(){let{view:e,go:o}=U(),{store:d,views:s,hiddenKinds:n}=T(),w=e.overview??!1,v=s.places().map(E=>E.kind).filter(E=>!n.has(E)),g=Fa(e,d.schema.kinds,v),x=()=>{o($e(ee(e,!1),g))},h=(()=>{if(!g)return null;let E=Aa(g)[0],b=e.within?.view,R=(b?s.places().find(N=>N.as===b):void 0)??(E?s.places().filter(N=>N.kind===E).at(-1):void 0);return R?R.title:E?_(d.schema,E):d.graph.getNode(g)?.label??null})(),c=w?"Close the map":"Up",C=w&&h?`Close the map, down to ${h}`:c;return(0,W.jsxs)("button",{type:"button","data-testid":"overview",className:"graview-altitude-control","aria-pressed":w,"aria-label":C,title:w?C:"Up \u2014 the whole thing, from above",onClick:()=>w?x():o(ee(e,!0)),style:{position:"absolute",top:14,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("overview"),display:"inline-flex",alignItems:"center",justifyContent:"center",gap:7,height:38,padding:"0 13px 0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.875rem",whiteSpace:"nowrap",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)","--graview-altitude":w?1:0,...w?{color:"var(--graview-accent)"}:{}},children:[(0,W.jsxs)("svg",{className:"graview-altitude-mark",width:"16",height:"16",viewBox:"0 0 12 12","aria-hidden":"true",children:[(0,W.jsx)("ellipse",{className:"graview-altitude-mark-ring",cx:"6",cy:"6.6",rx:"5",ry:"2.6",fill:"none",stroke:"currentColor",strokeWidth:"0.9"}),(0,W.jsx)("circle",{className:"graview-altitude-mark-apex",cx:"6",cy:"4",r:"1.5",fill:"currentColor"}),(0,W.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"left",cx:"1.6",cy:"7.4",r:"1.2",fill:"currentColor"}),(0,W.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"right",cx:"10.4",cy:"7.4",r:"1.2",fill:"currentColor"})]}),(0,W.jsx)("span",{className:"graview-altitude-label",children:c})]})}var sa=m($(),1);function da(){let{administered:e}=T(),{view:o,go:d}=U(),s=e.filter(n=>n.canShow);return s.length===0?null:(0,sa.jsx)("div",{role:"group","aria-label":"Administered","data-testid":"administered",style:{display:"flex",gap:6},children:s.map(n=>(0,sa.jsx)("button",{type:"button","aria-pressed":n.shown,"data-testid":`show-${n.name}`,title:n.shown?`Hide the ${n.name}'s own districts again`:n.description??`Show the ${n.name}'s own districts beside the domain`,onClick:()=>d(Ua(o,n.name,!n.shown)),style:{padding:"3px 11px",borderRadius:999,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:n.shown?"var(--graview-accent)":"var(--graview-edge)",color:n.shown?"var(--graview-accent)":"var(--graview-ink-muted)",background:n.shown?"var(--graview-panel)":"transparent"},children:n.shown?`Hide the ${n.name}`:`Show the ${n.name}`},n.name))})}var u=m(G(),1);var t=m($(),1);Ra({search:_a,touchWeights:qa});var ne=e=>e!==void 0&&"act"in e,Me=e=>e!==void 0&&"hit"in e&&e.hit.about==="node"?e:void 0,zt=e=>e.about==="rule"?"rule:":e.about==="act"?"act:":e.kind;function Mt(e){let o=()=>typeof window>"u"||window.innerWidth>=Ft,[d,s]=(0,u.useState)(o);return(0,u.useEffect)(()=>{let n=()=>s(o());return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),d&&!e}function dt({compact:e=!1}){let{store:o,view:d,setView:s,principal:n,setMenuAt:w,brand:v,aiDesk:g,selection:x}=T(),h=Ia(g),c=Ta(),C=Ma(),E=Da().marks.flag,b=Mt(e),R=(0,u.useRef)(null),N=(0,u.useRef)(null),z=(0,u.useRef)(null),B=(0,u.useId)(),[Le,I]=(0,u.useState)(!1),[K,se]=(0,u.useState)(null),[ft,he]=(0,u.useState)(null),[Pe,be]=(0,u.useState)([]),M=d.q??"";(0,u.useEffect)(()=>{let a=r=>{if(r.defaultPrevented)return;let i=r.key.toLowerCase()==="k"&&(r.metaKey||r.ctrlKey)&&!r.altKey&&!r.shiftKey,l=r.key==="/"&&!r.metaKey&&!r.ctrlKey&&!r.altKey;if(!i&&!l)return;let p=R.current;if(!p)return;let f=p.closest("[data-graview-embed]"),S=r.target,J=S===document.body||S===document.documentElement||S===window;if(f&&!(i&&J||S instanceof Node&&f.contains(S)))return;let Z=document.activeElement,ge=Z instanceof HTMLInputElement||Z instanceof HTMLTextAreaElement||Z instanceof HTMLSelectElement||Z instanceof HTMLElement&&Z.isContentEditable;l&&ge||(r.preventDefault(),p.getClientRects().length===0&&p.closest("[data-graview-app-bar]")?.querySelector('[data-testid="app-find-open"]')?.click(),p.focus({preventScroll:!0}),p.select(),I(!0))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]);let Ne=(0,u.useMemo)(()=>{let a=new Map;for(let[i,l]of(c?.hits??[]).entries()){if(l.about==="act")continue;let p=zt(l),f=a.get(p)??[];f.push({id:`${B}-${i}`,hit:l}),a.set(p,f)}let r=[...a.values()].filter(i=>i.some(l=>l.hit.about==="node")).length>1;return[...a.entries()].map(([i,l])=>{let p=0,f=l.filter(ge=>ge.hit.about!=="node"||!r||++p<=Wt),S=f.filter(ge=>ge.hit.about==="node").length,J=i.endsWith(":")?l.length:c?.byKind[i]??S,Z=!i.endsWith(":")&&S>0&&J>S?{id:`${B}-all-${i}`,all:i,count:J}:null;return{key:i,rows:f,count:J,more:Z}})},[c,B]),ae=h&&M.trim()?{id:`${B}-ask`,ask:M.trim()}:null,k=(0,u.useMemo)(()=>[...Ne.flatMap(a=>a.more?[...a.rows,a.more]:a.rows),...ae?[ae]:[]],[Ne,ae?.ask]),wa=(c?.hits??[]).filter(a=>a.about==="node").length,xe=c?.words??M,Ie=(0,u.useMemo)(()=>Re(xe).split(" ").filter(Boolean),[xe]),F=(0,u.useCallback)(a=>a.hit.about==="node"?Ga(o,a.hit.id,xe,{principal:n,limit:Bt}).map((r,i)=>({id:`${a.id}-act-${i}`,act:r,of:a.id})):[],[o,xe,n]),He=k.find(a=>a.id===K),q=k.find(a=>a.id===ft)??He??k[0],de=(0,u.useMemo)(()=>b&&Me(q)?F(q):[],[b,q?.id,F]),ye=(0,u.useMemo)(()=>b?new Map:new Map(Pe.flatMap(a=>{let r=Me(k.find(i=>i.id===a));return r?[[a,F(r)]]:[]})),[b,Pe,k,F]),ht=(0,u.useMemo)(()=>b?new Set:new Set(k.flatMap(a=>Me(a)&&F(a).length>0?[a.id]:[])),[b,k,F]),Oe=(0,u.useMemo)(()=>b?de:[...ye.values()].flat(),[b,de,ye]),L=He??Oe.find(a=>a.id===K)??k[0];(0,u.useEffect)(()=>{se(null),he(null),be([])},[M]);let le=(0,u.useRef)(null);(0,u.useEffect)(()=>{let a=le.current;if(!a)return;le.current=null;let r=0,i=()=>{let l=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`),p=document.activeElement;if(!(!p||p===document.body||p===document.documentElement||p===R.current||p===z.current||p===l))return;let S=[...l?.querySelectorAll('[role="group"][aria-label="Arrange"] :is(button, input)')??[]].find(J=>J.checkVisibility?.()??!0);if(S)return S.focus({preventScroll:!0});l&&l.tabIndex>=0&&p!==l&&l.focus({preventScroll:!0}),++r<240?requestAnimationFrame(i):document.activeElement===z.current&&z.current?.blur()};requestAnimationFrame(i)},[d]);let De=(a,r)=>{let i=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`);if(i&&i.tabIndex>=0)return i.focus({preventScroll:!0});let l=z.current;if(!l)return R.current?.blur();l.setAttribute("aria-label",r),l.focus({preventScroll:!0})},ma=(0,u.useRef)({x:Number.NaN,y:Number.NaN,moved:!1});(0,u.useEffect)(()=>{let a=r=>{let i=ma.current;i.moved=r.clientX!==i.x||r.clientY!==i.y,i.x=r.clientX,i.y=r.clientY};return window.addEventListener("mousemove",a,{capture:!0,passive:!0}),()=>window.removeEventListener("mousemove",a,{capture:!0})},[]);let ce=(0,u.useRef)(void 0);(0,u.useEffect)(()=>()=>clearTimeout(ce.current),[]);let te=a=>{a&&(clearTimeout(ce.current),se(a.id),ne(a)||he(a.id))},fa=a=>{if(!ma.current.moved)return;let r=a.target.closest?.('[role="option"]')?.id;if(!r||r===K)return;let i=k.find(l=>l.id===r)??Oe.find(l=>l.id===r);i&&(se(i.id),!ne(i)&&(clearTimeout(ce.current),ce.current=setTimeout(()=>he(i.id),Kt)))},bt=()=>{clearTimeout(ce.current),q&&!ne(L)&&se(q.id)},xt=a=>be(r=>r.includes(a.id)?r.filter(i=>i!==a.id):[...r,a.id]),ha=a=>{let r=N.current,i=r?.querySelector('[role="option"]')?.getBoundingClientRect().height??0,l=r?.clientHeight??0;return Math.min(a,i>0&&l>0?Math.max(1,Math.floor(l/i)-1):Ot)};(0,u.useEffect)(()=>{K&&document.getElementById(K)?.scrollIntoView?.({block:"nearest"})},[K]);let We=a=>{if(!a)return;if("ask"in a){Na(g,{pointed:{...x[0]!==void 0?{on:x[0]}:{},about:x},asked:a.ask}),s(i=>Ye(i)),I(!1);return}if("all"in a)return s(i=>ue(ee(i,!1),ve(a.all),{ownPicture:!0,...i.q?{carry:i.q}:{}})),le.current=a.all,I(!1),De(a.all,`Opening ${_(o.schema,a.all)} matching \u201C${M.trim()}\u201D\u2026`);if(ne(a)){let i=a.act.subject;s(p=>Ae(p,[i]));let l=R.current?.getBoundingClientRect();w({x:l?.left??0,y:(l?.bottom??0)+6,on:i}),I(!1),R.current?.blur();return}let r=a.hit;switch(r.about){case"node":s(i=>Ae($e(ee(i,!1),r.id),[r.id]));break;case"kind":return s(i=>ue(ee(i,!1),ve(r.kind),{ownPicture:!0})),le.current=r.kind,I(!1),De(r.kind,`Opening ${r.label}\u2026`);case"place":return s(i=>Ca(i,r.kind,r.as)),le.current=r.kind,I(!1),De(r.kind,`Opening ${r.title}\u2026`);case"rule":{let i=C.filter(l=>l.invariant===r.name).flatMap(l=>l.nodeIds);s(l=>Ae(l,[...new Set(i)]));break}case"act":break}I(!1),R.current?.blur()},yt=c?Ht(c.byKind,c.hits,o.schema):"",pe=Le&&M.trim().length>0,kt=(0,u.useCallback)(()=>{let a=R.current?.closest("[data-graview-app-bar]")?.getBoundingClientRect();if(a)return{x:a.right,y:a.bottom-Ut};let r=R.current?.getBoundingClientRect();return r?{x:r.right,y:r.bottom}:null},[]),ba=Pa("find",{open:pe,onOpenChange:a=>{a||I(!1)},...e?{at:kt}:{}}),ke=k.every(a=>"ask"in a),xa=a=>ne(a)?Oe.filter(r=>r.of===a.of):[],St=a=>{let r=ne(L)&&K!==null,i=r?k.find(p=>p.id===L.of):K!==null?He:void 0,l=i?k.indexOf(i):-1;if(a.key==="ArrowDown"){if(a.preventDefault(),I(!0),r){let p=xa(L),f=p.indexOf(L)+1;if(f<p.length)return te(p[f]);if(b)return}te(k[Math.min(k.length-1,l+1)])}else if(a.key==="ArrowUp"){if(a.preventDefault(),r){let p=xa(L),f=p.indexOf(L)-1;return te(f>=0?p[f]:i)}te(k[Math.max(0,l-1)])}else if((a.key==="PageDown"||a.key==="PageUp")&&k.length>0){a.preventDefault(),I(!0);let p=a.key==="PageDown"?ha(k.length):-ha(k.length);te(k[Math.min(k.length-1,Math.max(0,(l<0?-1:l)+p))])}else if(a.key==="ArrowRight"&&!r&&Me(L)){let p=L,f=b?p.id===q?.id?de:F(p):ye.get(p.id)??F(p);if(f.length===0)return;a.preventDefault(),!b&&!Pe.includes(p.id)&&be(S=>[...S,p.id]),he(p.id),se(f[0].id)}else if(a.key==="ArrowLeft"&&r){a.preventDefault();let p=L.of;b||be(f=>f.filter(S=>S!==p)),te(k.find(f=>f.id===p))}else a.key==="Enter"?(a.preventDefault(),We(L)):a.key==="Escape"&&(a.preventDefault(),M?s(p=>Ye(p)):R.current?.blur())},Be=(a,r,i={},l={})=>{let p=a.id===L?.id;return(0,t.jsx)("div",{id:a.id,role:"option","aria-selected":p,onClick:()=>We(a),style:{...Zt,...p?er:null,...i},...l,children:r},a.id)},ya=(a,r)=>{let i=a.id===L?.id;return(0,t.jsx)("div",{id:a.id,role:"option","aria-selected":i,"data-testid":"find-act","data-about":"act",onClick:()=>We(a),style:{...r?ir:ct,...i?nr:null,...a.act.destructive?{color:"var(--graview-warn)"}:null},children:a.act.title},a.id)};return(0,t.jsxs)("div",{style:{position:"relative",minWidth:0,flex:"1 1 auto"},"data-testid":"find",children:[(0,t.jsx)("input",{ref:a=>{R.current=a,ba.trigger.ref(a)},"data-graview-popover-trigger":"find",type:"search",role:"combobox","aria-label":"Find anything","aria-expanded":pe,"aria-controls":B,"aria-autocomplete":"list",...pe&&L?{"aria-activedescendant":L.id}:{},"data-testid":"find-box",placeholder:"Find\u2026","aria-keyshortcuts":"/ Meta+K Control+K",value:M,onChange:a=>{let r=a.target.value;I(!0),s(i=>Va(i,r.length>0?r:null))},onFocus:()=>I(!0),onBlur:()=>I(!1),onKeyDown:St,style:{width:"100%",boxSizing:"border-box",minWidth:0,height:30,padding:"0 var(--graview-bar-find-end, 10px) 0 10px",font:"inherit",fontSize:"0.875rem",color:"var(--graview-ink)",background:"var(--graview-panel)",border:`1px solid ${M?"var(--graview-accent)":"var(--graview-edge)"}`,borderRadius:8}}),(0,t.jsx)("span",{role:"status","aria-live":"polite",style:qe,"data-testid":"find-count",children:M.trim()?yt:""}),(0,t.jsx)("span",{ref:z,tabIndex:-1,role:"status",style:qe,"data-testid":"find-landing"}),(0,t.jsxs)("div",{...ba.pane,id:B,role:"listbox","aria-label":M?`What \u201C${M}\u201D finds`:"What the words find","data-testid":"find-strip","data-graview-find":b?"panel":"narrow",hidden:!pe,onMouseDown:a=>a.preventDefault(),style:{..._t,...e?Vt:b&&!ke?Gt:null,...pe?{display:"flex"}:null},children:[(0,t.jsxs)("div",{style:{...Yt,gridTemplateColumns:b&&!ke?`minmax(0, 1fr) ${qt}`:"minmax(0, 1fr)"},children:[(0,t.jsxs)("div",{ref:N,role:"presentation","data-testid":"find-list",onMouseMove:fa,style:jt,children:[ke?(0,t.jsxs)("p",{role:"presentation",style:{margin:0,padding:"10px 12px",color:"var(--graview-ink-muted)",fontSize:"0.875rem"},"data-testid":"find-nothing",children:["Nothing here is called \u201C",c?.words||M,"\u201D."]}):Ne.map(a=>(0,t.jsxs)("div",{role:"group","aria-label":ot(a.key,o.schema),children:[(0,t.jsxs)("div",{role:"presentation",style:la,children:[a.key!=="rule:"&&a.key!=="act:"?(0,t.jsx)(lt,{kind:a.key,accents:v?.accents}):null,(0,t.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ot(a.key,o.schema)}),(0,t.jsx)("span",{"aria-hidden":"true",style:Jt,"data-testid":"find-group-count",children:re(a.count)})]}),a.rows.map(r=>{let i=r.hit,l=i.about==="node"?i:null,p=!b&&l!==null&&ht.has(r.id),f=ye.get(r.id);return(0,t.jsxs)(u.Fragment,{children:[Be(r,(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Pt,{hit:i,flag:E,words:l?.near&&l.why.matched?[...Ie,Re(l.why.matched)]:Ie}),p?(0,t.jsx)("span",{"aria-hidden":"true","data-testid":"find-acts-open","data-open":f?"":void 0,title:f?"Put its actions away":"Actions",onClick:S=>{S.stopPropagation(),xt(r)},style:{...sr,...f?dr:null},children:(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"3.5",cy:"8",r:"1.4",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"1.4",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"12.5",cy:"8",r:"1.4",fill:"currentColor"})]})}):null]}),p?{paddingRight:48}:{},{"data-testid":"find-hit","data-about":i.about,...l?.near?{"data-near":""}:{},title:It(i)}),f?(0,t.jsx)("div",{role:"group","aria-label":`What can be done about ${l?.label??"it"}`,style:or,children:f.map(S=>ya(S,!0))}):null]},r.id)}),a.more?Be(a.more,(0,t.jsxs)("span",{style:Q,children:["All ",re(a.more.count)," ",Se(o.schema,a.more.all).toLowerCase()," matching \u201C",M.trim(),"\u201D"]}),ar,{"data-testid":"find-all","data-about":"all"}):null]},a.key)),ae?Be(ae,(0,t.jsxs)("span",{style:Q,children:["Ask: ",(0,t.jsxs)("span",{style:{fontWeight:600},children:["\u2018",ae.ask,"\u2019"]})]}),{borderTop:"1px solid var(--graview-edge)",marginTop:4},{"data-testid":"find-ask"}):null,wa>Dt?(0,t.jsxs)("p",{role:"presentation",style:st,"data-testid":"find-more-words",children:[re(wa)," found: another word of the name narrows them."]}):null,c&&c.searched.past===!1&&c.searched.kinds.some(a=>o.schema.tryDefinition(a)?.lifecycle)?(0,t.jsx)("p",{role:"presentation",style:st,children:"Current ones; add is:any for the past."}):null]}),b&&!ke&&q?(0,t.jsxs)("div",{role:"group","aria-label":"The one lit","data-testid":"find-panel",onMouseEnter:bt,onMouseMove:fa,style:Qt,children:[(0,t.jsx)(Lt,{row:q,schema:o.schema,accents:v?.accents,marking:Ie,q:M.trim(),flag:E}),de.length>0?(0,t.jsxs)("div",{role:"group","aria-label":"Actions",style:{display:"grid",gap:4},children:[(0,t.jsx)("div",{role:"presentation",style:{...la,padding:"10px 0 4px"},children:"Actions"}),de.map(a=>ya(a,!1))]}):null]}):null]}),e?null:(0,t.jsxs)("div",{"aria-hidden":"true",style:lr,"data-testid":"find-keys",children:[(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"\u2191"}),(0,t.jsx)("kbd",{style:fe,children:"\u2193"})," move"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"\u21B5"})," open"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"\u2192"})," actions"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"esc"})," close"]})]})]})]})}function Lt({row:e,schema:o,accents:d,marking:s,q:n,flag:w}){let v=null,g="",x,h=null;if("ask"in e)g="Ask",x=`\u2018${e.ask}\u2019`,h=(0,t.jsx)("p",{style:Y,children:"Asks it of what is selected; the answer comes on a card beside it."});else if("all"in e)v=e.all,g=_(o,e.all),x=`All ${re(e.count)} matching \u201C${n}\u201D`,h=(0,t.jsxs)("p",{style:Y,children:["Opens the ",Se(o,e.all).toLowerCase(),", narrowed by these words."]});else{let c=e.hit;switch(c.about){case"node":{v=c.kind,g=nt(Sa(o.tryDefinition(c.kind),c.kind)),x=(0,t.jsxs)(t.Fragment,{children:[c.flagged?(0,t.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[w," "]}):null,(0,t.jsx)(j,{text:c.label,words:s})]});let C=[c.apart,c.current?null:"past",c.archived?"set aside":null].filter(Boolean).join(" \xB7 ");h=(0,t.jsxs)(t.Fragment,{children:[C?(0,t.jsx)("p",{style:Y,children:nt(C)}):null,c.near?(0,t.jsxs)("p",{style:Y,children:["Near \u201C",c.why.asked,"\u201D",c.why.field!=="label"?` \u2014 ${c.why.reading.toLowerCase()}: ${c.why.fragment}`:""]}):c.why.field!=="label"?(0,t.jsxs)("p",{style:Y,children:[(0,t.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:c.why.reading}),(0,t.jsx)("br",{}),(0,t.jsx)(j,{text:c.why.fragment,words:s})]}):null]});break}case"kind":v=c.kind,g="Kind",x=c.label,h=(0,t.jsxs)("p",{style:Y,children:["Goes into the ",c.label.toLowerCase(),", all of them",c.count>0?`; ${re(c.count)} match these words`:"","."]});break;case"place":v=c.kind,g="Place",x=c.title,h=(0,t.jsxs)("p",{style:Y,children:["A picture of the ",Se(o,c.kind).toLowerCase(),"."]});break;case"rule":g="Rule",x=c.label,h=(0,t.jsx)("p",{style:Y,children:"Selects what it flags."});break;case"act":g="Act",x=c.title;break}}return(0,t.jsxs)("div",{role:"presentation","data-testid":"find-said",style:{display:"grid",gap:6},children:[(0,t.jsxs)("div",{style:{...la,padding:0},children:[v?(0,t.jsx)(lt,{kind:v,accents:d}):null,g]}),(0,t.jsx)("div",{style:Xt,children:x}),h]})}function Pt({hit:e,flag:o,words:d}){switch(e.about){case"node":return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{style:tr,children:[e.flagged?(0,t.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[o," "]}):null,(0,t.jsx)(j,{text:e.label,words:d}),e.apart?(0,t.jsxs)("span",{style:me,children:[" \xB7 ",e.apart]}):null,e.current?null:(0,t.jsx)("span",{style:me,children:" \xB7 past"})]}),e.near?(0,t.jsxs)("span",{style:{...Q,...me},"data-testid":"find-near",children:["Near \u201C",e.why.asked,"\u201D",e.why.field!=="label"?` \u2014 ${e.why.reading.toLowerCase()}: `:"",e.why.field!=="label"?(0,t.jsx)(j,{text:e.why.fragment,words:d}):null]}):e.why.field!=="label"?(0,t.jsxs)("span",{style:{...Q,...me},children:[e.why.reading.toLowerCase(),": ",(0,t.jsx)(j,{text:e.why.fragment,words:d})]}):null]});case"kind":return(0,t.jsxs)("span",{style:Q,children:[(0,t.jsx)(j,{text:e.label,words:d}),(0,t.jsxs)("span",{style:me,children:[" \xB7 ",e.count," match"]})]});case"place":return(0,t.jsxs)("span",{style:Q,children:["Go to ",(0,t.jsx)(j,{text:e.title,words:d})]});case"rule":return(0,t.jsxs)("span",{style:Q,children:["The rule \u201C",(0,t.jsx)(j,{text:e.label,words:d}),"\u201D"]});case"act":return(0,t.jsx)("span",{style:Q,children:e.title})}}function Nt(e,o){if(o.length===0)return[{text:e}];let d=[],s=0;for(let n of e.matchAll(/[\p{L}\p{N}]+/gu)){let w=n[0],v=Re(w).replace(/ /g,""),g=o.filter(c=>v.startsWith(c)).sort((c,C)=>C.length-c.length)[0];if(!g)continue;let x=v.length===w.length?g.length:w.length,h=n.index??0;h>s&&d.push({text:e.slice(s,h)}),d.push({text:w.slice(0,x),marked:!0}),s=h+x}return s<e.length&&d.push({text:e.slice(s)}),d}function j({text:e,words:o}){return(0,t.jsx)(t.Fragment,{children:Nt(e,o).map((d,s)=>d.marked?(0,t.jsx)("mark",{style:rr,children:d.text},s):(0,t.jsx)(u.Fragment,{children:d.text},s))})}function It(e){if(e.about!=="node")return"";let o=e.near?`Near \u201C${e.why.asked}\u201D`:e.why.field!=="label"?`${e.why.reading}: ${e.why.fragment}`:"";return o?`${e.label}
|
|
1132
|
+
${o}`:e.label}var nt=e=>e&&e[0].toUpperCase()+e.slice(1);function lt({kind:e,accents:o}){let d=Math.round($a(e,o));return(0,t.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:2,flex:"0 0 auto",background:`hsl(${d} 55% 52%)`}})}function ot(e,o){return e==="rule:"?"Rules":e==="act:"?"Acts":_(o,e)}function Ht(e,o,d){let s=Object.entries(e).map(([v,g])=>ka(d,v,g)),n=o.filter(v=>v.about==="kind"||v.about==="place"||v.about==="rule").length;n>0&&s.push(`${n} ${n===1?"place or rule":"places and rules"}`);let w=o.filter(v=>v.about==="node"&&v.near).length;return s.length===0?"Nothing found":`${s.join(", ")} found${w>0?`, ${w} of them near`:""}`}var Ot=10,Dt=12,Wt=5,Bt=6,Kt=140,Ft=760,qt="15.5rem",_t={...La,flexDirection:"column",width:"min(26rem, calc(100vw - 24px))",maxHeight:"min(64vh, 30rem)",overflow:"hidden",boxSizing:"border-box",background:"linear-gradient(var(--graview-panel), var(--graview-panel)) var(--graview-ground, var(--graview-panel))",borderTop:"1px solid var(--graview-edge)",borderRight:"1px solid var(--graview-edge)",borderBottom:"1px solid var(--graview-edge)",borderLeft:"1px solid var(--graview-edge)",borderRadius:10,boxShadow:"0 10px 28px rgb(0 0 0 / 0.18)",padding:0},Gt={width:"min(42rem, calc(100vw - 24px))"},Ut=6,Vt={width:"var(--graview-bar-width, 100vw)",maxHeight:"55vh",borderRadius:0,borderLeft:"none",borderRight:"none"},Yt={display:"grid",gridTemplateRows:"minmax(0, 1fr)",flex:"1 1 auto",minHeight:0},jt={overflowY:"auto",overflowX:"hidden",minHeight:0,padding:"4px 0",overscrollBehavior:"contain"},Qt={overflowY:"auto",minHeight:0,padding:"12px 14px",borderLeft:"1px solid var(--graview-edge)",background:"var(--graview-panel-muted)",display:"flex",flexDirection:"column",gap:4},Xt={fontWeight:600,fontSize:"0.9375rem",lineHeight:1.35,color:"var(--graview-ink)",overflowWrap:"anywhere"},Y={margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)",overflowWrap:"anywhere"},la={display:"flex",alignItems:"center",gap:6,padding:"10px 12px 4px",fontSize:"0.6875rem",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},Jt={marginLeft:"auto",fontWeight:400,letterSpacing:0,fontVariantNumeric:"tabular-nums",color:"var(--graview-ink-faint)"},Zt={position:"relative",display:"grid",gap:1,minHeight:34,padding:"5px 12px",alignContent:"center",cursor:"pointer",fontSize:"0.875rem",lineHeight:1.35,color:"var(--graview-ink)",minWidth:0},er={background:"color-mix(in srgb, var(--graview-accent) 12%, var(--graview-panel))",boxShadow:"inset 3px 0 0 var(--graview-accent)"},ar={color:"var(--graview-accent)",fontSize:"0.8125rem",minHeight:30},Q={display:"block",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},tr={display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,minWidth:0,overflow:"hidden",overflowWrap:"anywhere",fontWeight:600},me={color:"var(--graview-ink-muted)",fontSize:"0.8125rem",fontWeight:400},rr={background:"color-mix(in srgb, var(--graview-accent) 24%, transparent)",color:"inherit",borderRadius:2,padding:0,boxShadow:"0 1px 0 color-mix(in srgb, var(--graview-accent) 70%, transparent)"},ct={display:"flex",alignItems:"center",minHeight:32,padding:"4px 10px",boxSizing:"border-box",borderWidth:1,borderStyle:"solid",borderColor:"var(--graview-edge)",borderRadius:6,background:"var(--graview-panel)",color:"var(--graview-ink)",fontSize:"0.8125rem",lineHeight:1.3,cursor:"pointer",overflowWrap:"anywhere"},ir={...ct,minHeight:32,margin:"0 12px 4px 24px"},nr={borderColor:"var(--graview-accent)",boxShadow:"inset 0 0 0 1px var(--graview-accent)",background:"color-mix(in srgb, var(--graview-accent) 12%, var(--graview-panel))"},or={display:"grid",padding:"2px 0 6px"},sr={position:"absolute",top:"50%",right:6,transform:"translateY(-50%)",width:36,height:32,display:"grid",placeItems:"center",borderRadius:6,color:"var(--graview-ink-muted)",borderWidth:1,borderStyle:"solid",borderColor:"transparent"},dr={color:"var(--graview-accent)",borderColor:"var(--graview-edge)",background:"var(--graview-panel)"},st={margin:0,padding:"6px 12px 4px",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},lr={display:"flex",flexWrap:"wrap",gap:"4px 14px",padding:"7px 12px",borderTop:"1px solid var(--graview-edge)",color:"var(--graview-ink-faint)",fontSize:"0.75rem",flex:"0 0 auto"},fe={display:"inline-block",minWidth:16,padding:"0 4px",marginRight:3,border:"1px solid var(--graview-edge)",borderRadius:4,font:"inherit",fontSize:"0.6875rem",lineHeight:"16px",textAlign:"center",color:"var(--graview-ink-muted)",background:"var(--graview-panel)"};var oe=m(G(),1);var ca=m($t(),1);var gt=m($(),1);function pt(){let{following:e,follow:o}=T();return e?(0,gt.jsxs)("button",{type:"button","data-testid":"following-who",onClick:()=>o(null),title:"Press, or Escape, to stop following",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,padding:"2px 9px",borderRadius:999,border:"1px solid var(--graview-accent)",background:"transparent",color:"var(--graview-accent)",fontSize:"0.875rem",whiteSpace:"nowrap"},children:["following ",e.name]}):null}var vt=m(G(),1);var A=m($(),1);function ut({home:e,homeLabel:o,children:d,onPicture:s=!1}){let{view:n,focus:w,show:v,go:g}=U(),{store:x}=T(),{movedByHand:h}=T(),c=h&&(n.pan!==void 0||Object.keys(n.pins).length>0),C=n.focusId&&n.focusId!==e?x.graph.getNode(n.focusId):void 0,E=z=>_(x.schema,z),b={display:"inline-flex",alignItems:"center",gap:6,minHeight:26,padding:"2px 6px",fontSize:"0.8125rem",borderRadius:6,border:"1px solid transparent",boxShadow:"none",background:"transparent",color:"var(--graview-ink-muted)",whiteSpace:"nowrap"},R=o!==void 0&&C!==void 0,N=[];if(C&&!s&&N.push({key:"focused",node:(0,A.jsxs)("button",{type:"button","data-testid":"focused",onClick:()=>g(Fe({...n,focusId:e},!1)),title:Ge(x,C.id),style:{...b,maxWidth:"min(14rem, 15vw)"},children:[(0,A.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:Ge(x,C.id)}),(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),n.past&&N.push({key:"past",node:(0,A.jsxs)("button",{type:"button","data-testid":"past",onClick:()=>g(Ya(n,!1)),title:"Back to now \u2014 retired things leave the picture again",style:b,children:["the past",(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),n.zoom&&N.push({key:"zoomed",node:(0,A.jsxs)("button",{type:"button","data-testid":"zoomed",onClick:()=>g(Fe(n,!1)),title:"Zoom back out",style:b,children:["zoomed in",(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),c&&N.push({key:"moved",node:(0,A.jsx)("button",{type:"button","data-testid":"moved",onClick:()=>g(Ke(n)),title:"Put the camera and everything you dragged back where the layout wanted them",style:b,children:"Reset view"})}),n.relation){let z=n.relation;N.push({key:"raised",node:(0,A.jsxs)("span",{style:{display:"inline-flex",alignItems:"center"},children:[(0,A.jsxs)("button",{type:"button","data-testid":"raised-into",onClick:()=>g(ue(n,ve(z),{ownPicture:!0})),title:`Go into the ${E(z).toLowerCase()}`,"aria-label":`Go into the ${E(z).toLowerCase()}`,style:{...b,color:"var(--graview-ink)"},children:[E(z),(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\u2198"})]}),(0,A.jsx)("button",{type:"button","data-testid":"raised",onClick:()=>v(null),title:`Stop showing ${E(z).toLowerCase()}`,"aria-label":`Stop showing ${E(z).toLowerCase()}`,style:{...b,minWidth:26,justifyContent:"center"},children:(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})})]})})}return s&&!R&&N.length===0&&d===void 0?null:(0,A.jsxs)("nav",{"aria-label":"View","data-testid":"trail",style:{display:"flex",alignItems:"center",gap:8,fontSize:"0.875rem",minWidth:0,...s?{pointerEvents:"auto",padding:"4px 6px",borderRadius:8,background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",overflow:"hidden"}:{}},children:[R?(0,A.jsx)("button",{type:"button",onClick:()=>w(e),style:{border:"none",background:"none",padding:"3px 0",minHeight:24,whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:o}):null,N.map(({key:z,node:B},Le)=>(0,A.jsxs)(vt.Fragment,{children:[R||Le>0?(0,A.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:"\u203A"}):null,B]},z)),d]})}var P=m($(),1);function pa(){let[e,o]=(0,oe.useState)([]),d=(0,oe.useCallback)(s=>{o(n=>{let w=s.phase!=="running"&&n[0]?.name===s.name&&n[0]?.at===s.at;return[s,...w?n.slice(1):n].slice(0,12)})},[]);return[e,d]}function ga({find:e,calls:o,seat:d,remembers:s=!1}){return e?(0,P.jsxs)(P.Fragment,{children:[(0,ca.createPortal)((0,P.jsx)(dt,{compact:e.compact}),e.slot),e.own?(0,ca.createPortal)((0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(oe.Suspense,{fallback:null,children:(0,P.jsx)(rt,{})}),(0,P.jsx)(Wa,{calls:o,remembers:s,...d!==void 0?{seat:d}:{}})]}),e.own):null]}):null}function va({home:e=null}){return(0,P.jsxs)("div",{"data-graview-scene-trail":"",style:{position:"absolute",top:14,left:14,maxWidth:"calc(100% - 150px - var(--graview-dock, 0px))",zIndex:D("overview"),display:"flex",alignItems:"center",gap:6,minWidth:0,pointerEvents:"none"},children:[(0,P.jsx)(ut,{home:e,onPicture:!0}),(0,P.jsx)("span",{style:{pointerEvents:"auto"},children:(0,P.jsx)(pt,{})})]})}var X=m(G(),1);var wt=m($(),1),cr=ie(()=>(__graviewPreload(import.meta.url,["./chunk.Q355UPFG.js","./chunk.3FKKH2XU.js","./chunk.DLWFULWE.js","./chunk.VLX7YWVH.js","./chunk.SDO3U72B.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.PVDDSBRG.js")));function ua(){let{store:e,principal:o}=T(),d=(0,X.useContext)(Ba),s=(0,X.useRef)(null),n=(0,X.useRef)(!1);return(0,X.useEffect)(()=>()=>void(n.current=!0),[]),(0,X.useEffect)(()=>{let w=e.batches().length,v=cr().then(g=>g.sceneWay(e,o,d,w,s.current),()=>{});return()=>void v.then(g=>g?.(n.current))},[e,o,d]),(0,wt.jsx)("span",{ref:s,hidden:!0})}var mt=m(G(),1);var y=m($(),1);function qi({address:e=!1,auto:o,quickAsk:d=!0,scheme:s,scope:n}){let w=(0,mt.useMemo)(()=>`${ta({scope:`.${n}`})}
|
|
1133
1133
|
${ra(s,{scope:`.${n}`})}`,[s,n]),v=Ka(),[g]=pa();return(0,y.jsx)(za.Provider,{value:!0,children:(0,y.jsxs)("div",{"data-embed-content":"",style:{position:"relative",flex:o?`0 0 ${et}px`:"1 1 auto",minHeight:0,containerType:"size"},children:[(0,y.jsx)("style",{children:w}),e?(0,y.jsx)(Za,{}):null,(0,y.jsx)(Ja,{}),(0,y.jsx)(va,{}),(0,y.jsx)(oa,{}),(0,y.jsx)(ia,{}),(0,y.jsxs)(Qa,{children:[(0,y.jsx)(Xe,{}),(0,y.jsx)(Je,{face:"scene",on:d}),(0,y.jsx)(na,{}),(0,y.jsx)(Ue,{children:(0,y.jsx)(je,{children:(0,y.jsx)(Ze,{children:(0,y.jsx)(aa,{children:(0,y.jsx)(Qe,{placement:"menu"})})})})}),(0,y.jsx)(Ve,{}),(0,y.jsx)(ea,{}),(0,y.jsx)(ga,{find:v,calls:g}),(0,y.jsx)(ua,{}),(0,y.jsx)(_e,{face:"scene"})]})]})})}function _i(){return(0,y.jsx)(da,{})}export{qi as SceneFace,_i as SceneKeeping};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h}from"./chunk.
|
|
1
|
+
import{a as h}from"./chunk.5AD2QHWH.js";import{Ca as a,D as g,Fa as b,H as k,K as w,bc as x}from"./chunk.IQGSEAQ2.js";var s=i=>i?._zod?.def,O=Symbol.for("@graview/core:collaborative"),v=/^\^\\d\{4\}-\\d\{2\}-\\d\{2\}\$$/;function R(i){let t=s(i),u=!0,f;for(let e=0;t&&e<4;e++){if(t.type==="optional"||t.type==="nullable")u=!1;else if(t.type==="default")u=!1,f=t.defaultValue;else break;t=s(t.innerType)}if(!t)return{why:"it is not a zod field"};let l=g(i),r={...u?{required:!0}:{},...f!==void 0?{default:f}:{},...l?{description:l}:{}},p=(t.checks??[]).map(e=>s(e)),c=a(i);if(c)return{spec:{type:c,...r}};if(b(i))return{spec:{type:"app-link",...r}};let d;for(let e=s(i),n=0;e&&d===void 0&&n<4;e=s(e.innerType),n++)d=e[O];let m=e=>d!==void 0&&d===1!=(e==="text")?{collaborative:d===1}:{};if(h(i))return{spec:{type:"text",format:"markdown",...r,...m("text")}};let y=x(i);if(y)return{spec:{type:y,...r}};switch(t.type){case"string":{let e=t.format;return e==="email"?{spec:{type:"email",...r}}:e==="url"?{spec:{type:"url",...r}}:e==="date"?{spec:{type:"date",...r}}:e==="datetime"||p.some(n=>n?.fn===w)?{spec:{type:"datetime",...r}}:p.some(n=>n?.format==="regex"&&(v.test(String(n?.pattern?.source??""))||n?.pattern?.source===k.source))?{spec:{type:"date",...r}}:{spec:{type:"string",...r,...m("string")}}}case"number":{let e={};for(let n of p){let o=n?.value;typeof o=="number"&&(n?.check==="greater_than"&&n.inclusive?e.min=Math.max(e.min??o,o):n?.check==="less_than"&&n.inclusive?e.max=Math.min(e.max??o,o):n?.check==="multiple_of"&&(e.step=o))}return{spec:{type:p.some(n=>n?.format==="safeint"||n?.format==="int")?"integer":"number",...e,...r}}}case"boolean":return{spec:{type:"boolean",...r}};case"enum":{let e=Object.keys(t.entries??{});return e.length>0?{spec:{type:"enum",options:e,...r}}:{why:"it is an enum with no options"}}case"array":{let e=s(t.element);if(e?.type==="enum"){let o=Object.keys(e.entries??{});return o.length>0?{spec:{type:"enum",multiple:!0,options:o,...r}}:{why:"it is a list of an enum with no options"}}let n=a(t.element)??(e?.type==="number"?"number":e?.type==="string"?"string":void 0);return n?{spec:{type:"list",of:n,...r}}:{why:`it is a list of ${String(e?.type??"something")}, and a document lists words, numbers, dates, images, videos or files`}}default:return{why:`it is a ${String(t.type)}, which a document has no field type for`}}}function T(i){let t=R(i);return"spec"in t?t.spec:void 0}export{T as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as T}from"./chunk.
|
|
1
|
+
import{G as T}from"./chunk.VLX7YWVH.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,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{rd as e}from"./chunk.IQGSEAQ2.js";var i=`
|
|
2
2
|
.graview-spec{display:flex;flex-direction:column;gap:6px;min-width:0;color:var(--graview-ink)}
|
|
3
3
|
|
|
4
4
|
.graview-spec-row{flex-direction:row;flex-wrap:wrap;align-items:center;gap:4px 10px;box-sizing:border-box;max-width:100%;padding:5px 10px;border:1px solid var(--graview-edge);border-radius:var(--graview-radius-sm,8px);background:var(--graview-panel);font-size:.875rem}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as W,c as I,d as q,f as H}from"./chunk.3OEODIHB.js";import{a as re,b as ie}from"./chunk.XOZU4OFA.js";import{b as te,c as ne,d as oe}from"./chunk.G7YLK4PX.js";import{b as X,c as Z,d as L,j as ee,k as ae}from"./chunk.75JQCTR6.js";import{b as Q,k as U,l as T}from"./chunk.5IEZF433.js";import{G as ge,V as J}from"./chunk.VLX7YWVH.js";import{Bc as _,Ed as Y,Nb as V,ga as E,ha as K,la as $,ta as B}from"./chunk.IQGSEAQ2.js";import{b as O}from"./chunk.AJZBJBMO.js";var b=O(ge(),1),a=O(J(),1),fe=`
|
|
2
2
|
form:where([data-graview-part="form"]) {
|
|
3
3
|
/* A grid item of the section above it and a grid container for the
|
|
4
4
|
fields below: both halves are allowed to be narrower than what is in
|
|
@@ -101,4 +101,4 @@ p:where([data-graview-part="refused"]) {
|
|
|
101
101
|
color: var(--graview-warn);
|
|
102
102
|
font-size: 0.875rem;
|
|
103
103
|
}
|
|
104
|
-
`;function pe({title:i,name:e,optional:t,amount:o,value:v,onChange:h}){let p=J(o),[S,f]=(0,y.useState)(()=>typeof v=="number"?Q(v,o):""),A=S.trim()!==""&&N(S,o)===void 0;return(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":"number","data-graview-amount":o.format??"unit",children:[(0,a.jsx)("span",{"data-graview-part":"label",children:i}),(0,a.jsxs)("span",{"data-graview-part":"amount",style:{display:"flex",alignItems:"center",gap:6},children:[p.prefix?(0,a.jsx)("span",{"data-graview-part":"amount-symbol","aria-hidden":"true",children:p.prefix}):null,(0,a.jsx)("input",{type:"text",inputMode:"decimal",name:e,required:!t,placeholder:p.placeholder,title:p.hint,"aria-invalid":A||void 0,value:S,onChange:u=>{f(u.target.value),h(N(u.target.value,o))},"data-graview-part":"control",style:{flex:1,minWidth:0}}),p.suffix?(0,a.jsx)("span",{"data-graview-part":"amount-symbol","aria-hidden":"true",children:p.suffix}):null]}),A?(0,a.jsxs)("span",{"data-graview-part":"hint",role:"status",children:["Not an amount ",p.hint,": write it like ",p.prefix??"",p.placeholder,p.suffix?` ${p.suffix}`:""]}):null]})}function re({children:i}){return(0,a.jsxs)("span",{"data-graview-part":"picker",children:[i,(0,a.jsx)("span",{"aria-hidden":"true","data-graview-part":"chevron",children:"\u25BE"})]})}var ue=i=>({label:E(i),option:e=>e}),ge={phone:"+1 555 123 4567",place:"An address or a place's name",duration:"1h 30m, 90 or 1:30"};function M({store:i,spec:e,value:t,onChange:o,prefilled:v,open:h,words:p=ue,values:S}){if(e.name in v&&e.control!=="group"&&e.control!=="variant")return null;let f=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(n=>E(G(i.schema.tryDefinition(n),n))).join(" or "):p(e.name).label,A=!(e.optional||e.control==="boolean"),u=A?(0,a.jsxs)(a.Fragment,{children:[f,(0,a.jsx)("span",{"aria-hidden":"true",children:" *"})]}):f;switch(e.control){case"text":case"date":return e.control==="text"&&e.long?(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":"text",children:[(0,a.jsxs)("span",{"data-graview-part":"label",children:[u,e.markdown?(0,a.jsx)("span",{style:{fontWeight:"normal",color:"var(--graview-ink-faint)"},children:" \xB7 Markdown"}):null]}),(0,a.jsx)("textarea",{name:e.name,required:!e.optional,rows:6,value:typeof t=="string"?t:"",onChange:n=>o(n.target.value),"data-graview-part":"control",style:{fieldSizing:"content",minHeight:"7.5em",resize:"vertical",font:"inherit",lineHeight:1.5}})]}):e.control==="date"?(0,a.jsxs)("div",{"data-graview-part":"field","data-graview-field":"date",children:[(0,a.jsx)("span",{"data-graview-part":"label",children:u}),(0,a.jsx)(I,{name:e.name,label:p(e.name).label,required:!e.optional,value:typeof t=="string"&&t!==""?t:void 0,time:e.time===!0,instant:e.instant===!0,partial:e.partial===!0,onChange:o})]}):(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control==="text"&&e.holds?e.holds:e.control,children:[(0,a.jsx)("span",{"data-graview-part":"label",children:u}),(0,a.jsx)("input",{type:e.control==="text"&&e.holds==="phone"?"tel":"text",name:e.name,required:!e.optional,...e.control==="text"&&e.app?{placeholder:"@owner/app or https://\u2026"}:{},...e.control==="text"&&e.holds?{placeholder:ge[e.holds]}:{},...e.control==="text"&&e.holds==="phone"?{autoComplete:"tel"}:{},value:typeof t=="string"?t:typeof t=="number"?String(t):"",onChange:n=>o(n.target.value),"data-graview-part":"control"})]});case"number":return e.amount?(0,a.jsx)(pe,{title:u,name:e.name,optional:e.optional,amount:e.amount,value:t,onChange:o}):(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,a.jsx)("span",{"data-graview-part":"label",children:u}),(0,a.jsx)("input",{type:"number",name:e.name,required:!e.optional,...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max},...e.step===void 0?{}:{step:e.step},value:typeof t=="number"?t:"",onChange:n=>o(n.target.value===""?void 0:Number(n.target.value)),"data-graview-part":"control"})]});case"boolean":return(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":"boolean",children:[(0,a.jsx)("input",{type:"checkbox",name:e.name,checked:t===!0,onChange:n=>o(n.target.checked),"data-graview-part":"control"}),(0,a.jsx)("span",{"data-graview-part":"label",children:u})]});case"choice":if(e.multiple){let n=Array.isArray(t)?t.map(String):[];return(0,a.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":"choices","data-graview-choices":e.name,children:[(0,a.jsx)("legend",{"data-graview-part":"label",children:u}),(e.options??[]).map(l=>(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":"boolean",children:[(0,a.jsx)("input",{type:"checkbox",name:e.name,value:l,checked:n.includes(l),onChange:m=>{let d=m.target.checked?[...n.filter(r=>r!==l),l]:n.filter(r=>r!==l),w=(e.options??[]).filter(r=>d.includes(r));o(w.length>0?w:void 0)},"data-graview-part":"control"}),(0,a.jsx)("span",{"data-graview-part":"label",children:p(e.name).option(l)})]},l))]})}return(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,a.jsx)("span",{"data-graview-part":"label",children:u}),(0,a.jsx)(re,{children:(0,a.jsxs)("select",{name:e.name,required:!e.optional,value:typeof t=="string"?t:"",onChange:n=>o(n.target.value||void 0),"data-graview-part":"control",children:[(0,a.jsx)("option",{value:"",children:"\u2014"}),(e.options??[]).map(n=>(0,a.jsx)("option",{value:n,children:p(e.name).option(n)},n))]})})]});case"node":{let n=h.find(r=>r.name===e.name)?.candidates,l=new Set(Object.values(v).filter(r=>typeof r=="string")),m=(e.kinds.includes("*")?[...i.graph.allNodes()]:e.kinds.flatMap(r=>i.graph.nodesOfKind(r))).filter(r=>!l.has(r.id)),d=n?n.map(r=>i.graph.getNode(r)).filter(r=>r!==void 0):m,w=V(d,r=>i.schema.tryDefinition(r));return(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,a.jsx)("span",{"data-graview-part":"label",children:u}),(0,a.jsx)(re,{children:(0,a.jsxs)("select",{name:e.name,required:!e.optional,value:typeof t=="string"?t:"",onChange:r=>o(r.target.value||void 0),"data-graview-part":"control",children:[(0,a.jsx)("option",{value:"",children:"\u2014"}),d.map(r=>{let F=w.get(r.id);return(0,a.jsxs)("option",{value:r.id,children:[z(i.schema.tryDefinition(r.kind),r),F?` \xB7 ${F}`:""]},r.id)})]})})]})}case"group":{let n=t??{};return(0,a.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.control,children:[(0,a.jsx)("legend",{"data-graview-part":"label",children:u}),e.fields.map(l=>(0,a.jsx)(M,{store:i,spec:l,value:n[l.name],onChange:m=>o({...n,[l.name]:m}),prefilled:v,open:h,words:p},l.name))]})}case"variant":{let n=t??{},l=typeof n[e.tag]=="string"?n[e.tag]:"",m=e.options.find(d=>d.value===l);return(0,a.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.control,children:[(0,a.jsx)("legend",{"data-graview-part":"label",children:u}),(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":"choice",children:[(0,a.jsx)("span",{"data-graview-part":"label",children:E(e.tag)}),(0,a.jsxs)("select",{value:l,onChange:d=>o({[e.tag]:d.target.value}),"data-graview-part":"control",children:[(0,a.jsx)("option",{value:"",children:"\u2014"}),e.options.map(d=>(0,a.jsx)("option",{value:d.value,children:E(d.value)},d.value))]})]}),m?.fields.map(d=>(0,a.jsx)(M,{store:i,spec:d,value:n[d.name],onChange:w=>o({...n,[d.name]:w}),prefilled:v,open:h,words:p},d.name))]})}case"file":case"list":{let n=e.control==="file"?e:e.item.control==="file"?e.item:void 0;if(n||e.control==="file")return(0,a.jsx)(L,{as:"control",title:A?`${f} *`:f,value:t,onChange:o,several:n!==e,image:n?.image===!0,video:n?.video===!0,label:f});let l=Array.isArray(t)?t:[];return(0,a.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":"list",children:[(0,a.jsx)("legend",{"data-graview-part":"label",children:u}),l.map((m,d)=>(0,a.jsxs)("div",{"data-graview-part":"item",children:[(0,a.jsx)("div",{style:{flex:1},children:(0,a.jsx)(M,{store:i,spec:{...e.item,optional:!1},value:m,onChange:w=>o(l.map((r,F)=>F===d?w:r)),prefilled:v,open:h,words:p})}),(0,a.jsx)("button",{type:"button","data-graview-part":"remove",onClick:()=>o(l.filter((w,r)=>r!==d)),children:"remove"})]},d)),(0,a.jsx)("button",{type:"button","data-graview-part":"add",onClick:()=>o([...l,void 0]),children:"add another"})]})}case"linked":return(0,a.jsx)("div",{"data-graview-part":"field","data-graview-field":"linked",children:(0,a.jsx)(O,{relation:e.relation,value:t,onChange:o,label:f})});case"repeat":return(0,a.jsx)(W,{value:t,onChange:o,start:e.of?S?.[e.of]:void 0,label:`${e.of?p(e.of).label:f} repeats`,name:e.name});case"opaque":return(0,a.jsxs)("p",{"data-graview-part":"unasked",children:["\u201C",E(e.name),"\u201D needs a structured answer this form cannot ask for yet."]})}}function me(i){let e=[...i.querySelectorAll("input:not([type=hidden]), select, textarea")].filter(t=>!t.disabled&&!t.closest("[hidden], [inert], [aria-hidden='true']"));return e.find(t=>t.required&&t.value==="")??e[0]??i.querySelector('button[type="submit"]')}function Fe({store:i,mutation:e,prefilled:t={},open:o=[],onDone:v,principal:h,initial:p,label:S,only:f,autoFocus:A=!1}){let u=()=>ae(e,i.graph,t),[n,l]=(0,y.useState)(u),[m,d]=(0,y.useState)(()=>({...n,...p})),[w,r]=(0,y.useState)(null),F=h??i.seenFor,q=e.subject&&t[e.subject.arg],ie=F?ne(i,F,e,typeof q=="string"?q:void 0):void 0,j=ee(i.schema,e),C=(f===void 0?j:f.flatMap(s=>j.find(g=>g.name===s)??[])).filter(s=>!ie?.has(s.name)),oe=s=>Y(i.schema,e,s),P=X(C.filter(s=>s.control==="date").map(s=>s.name)),D=(0,y.useRef)(void 0),le=(s,g)=>d(b=>{let x={...b,[s.name]:g};if(P&&s.name===P.start&&s.control==="date"){let c=k=>typeof k=="string"&&k!==""?k:void 0,R=c(b[P.start])??D.current;if(c(g)){D.current=c(g);let k=U(R,c(g),c(b[P.end]),{time:s.time===!0,instant:s.instant===!0});k!==void 0&&(x[P.end]=k)}}return x}),H=(0,y.useRef)(null);return(0,y.useEffect)(()=>{if(!A)return;let s=document.activeElement,g=0,b=0,x=()=>{let c=H.current;if(!c)return;let R=document.activeElement;if(R!==s&&R!==document.body&&R!==null&&!c.contains(R)||c.contains(R))return;let k=c.querySelector("[data-graview-when-arriving]")&&b<30?null:me(c);if(k){k.focus();return}b+=1,b<=30&&(g=requestAnimationFrame(x))};return g=requestAnimationFrame(x),()=>cancelAnimationFrame(g)},[]),(0,a.jsxs)("form",{ref:H,"data-testid":`form-${e.name}`,onSubmit:s=>{s.preventDefault();try{i.apply({name:e.name,args:{...te(Z(C,m),n),...t}},h?{author:h}:{}),r(null);let g=u();l(g),d({...g}),v?.()}catch(g){r(_(i.schema,i.allMutations(),g));let b=e.subject?t[e.subject.arg]:void 0,x=typeof b=="string"?i.graph.getNode(b)?.kind:void 0;$(i,{type:"refused",act:e.name,code:K(g).reason,...x?{kind:x}:{}},h)}},"data-graview-part":"form",children:[(0,a.jsx)("style",{children:se}),C.map(s=>(0,a.jsx)(M,{store:i,spec:s,value:m[s.name],values:m,onChange:g=>le(s,g),prefilled:t,open:o,words:oe},s.name)),w?(0,a.jsx)("p",{"data-testid":"refused","data-graview-part":"refused",role:"alert",children:w}):null,(0,a.jsx)("button",{type:"submit","data-graview-part":"submit",children:S??e.title??e.name})]})}export{Fe as a};
|
|
104
|
+
`;function he({title:i,name:e,optional:t,amount:o,value:v,onChange:y}){let p=X(o),[S,w]=(0,b.useState)(()=>typeof v=="number"?Z(v,o):""),P=S.trim()!==""&&L(S,o)===void 0;return(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":"number","data-graview-amount":o.format??"unit",children:[(0,a.jsx)("span",{"data-graview-part":"label",children:i}),(0,a.jsxs)("span",{"data-graview-part":"amount",style:{display:"flex",alignItems:"center",gap:6},children:[p.prefix?(0,a.jsx)("span",{"data-graview-part":"amount-symbol","aria-hidden":"true",children:p.prefix}):null,(0,a.jsx)("input",{type:"text",inputMode:"decimal",name:e,required:!t,placeholder:p.placeholder,title:p.hint,"aria-invalid":P||void 0,value:S,onChange:u=>{w(u.target.value),y(L(u.target.value,o))},"data-graview-part":"control",style:{flex:1,minWidth:0}}),p.suffix?(0,a.jsx)("span",{"data-graview-part":"amount-symbol","aria-hidden":"true",children:p.suffix}):null]}),P?(0,a.jsxs)("span",{"data-graview-part":"hint",role:"status",children:["Not an amount ",p.hint,": write it like ",p.prefix??"",p.placeholder,p.suffix?` ${p.suffix}`:""]}):null]})}function le({children:i}){return(0,a.jsxs)("span",{"data-graview-part":"picker",children:[i,(0,a.jsx)("span",{"aria-hidden":"true","data-graview-part":"chevron",children:"\u25BE"})]})}var we=i=>({label:E(i),option:e=>e}),ce={phone:"+1 555 123 4567",place:"An address or a place's name",duration:"1h 30m, 90 or 1:30"};function M({store:i,spec:e,value:t,onChange:o,prefilled:v,open:y,words:p=we,values:S}){if(e.name in v&&e.control!=="group"&&e.control!=="variant")return null;let w=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(n=>E(B(i.schema.tryDefinition(n),n))).join(" or "):p(e.name).label,P=!(e.optional||e.control==="boolean"),u=P?(0,a.jsxs)(a.Fragment,{children:[w,(0,a.jsx)("span",{"aria-hidden":"true",children:" *"})]}):w;switch(e.control){case"text":case"date":return e.control==="text"&&e.long?(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":"text",children:[(0,a.jsxs)("span",{"data-graview-part":"label",children:[u,e.markdown?(0,a.jsx)("span",{style:{fontWeight:"normal",color:"var(--graview-ink-faint)"},children:" \xB7 Markdown"}):null]}),(0,a.jsx)("textarea",{name:e.name,required:!e.optional,rows:6,value:typeof t=="string"?t:"",onChange:n=>o(n.target.value),"data-graview-part":"control",style:{fieldSizing:"content",minHeight:"7.5em",resize:"vertical",font:"inherit",lineHeight:1.5}})]}):e.control==="date"?(0,a.jsxs)("div",{"data-graview-part":"field","data-graview-field":"date",children:[(0,a.jsx)("span",{"data-graview-part":"label",children:u}),(0,a.jsx)(H,{name:e.name,label:p(e.name).label,required:!e.optional,value:typeof t=="string"&&t!==""?t:void 0,time:e.time===!0,instant:e.instant===!0,partial:e.partial===!0,onChange:o})]}):(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control==="text"&&e.holds?e.holds:e.control,children:[(0,a.jsx)("span",{"data-graview-part":"label",children:u}),(0,a.jsx)("input",{type:e.control==="text"&&e.holds==="phone"?"tel":"text",name:e.name,required:!e.optional,...e.control==="text"&&e.app?{placeholder:"@owner/app or https://\u2026"}:{},...e.control==="text"&&e.holds?{placeholder:ce[e.holds]}:{},...e.control==="text"&&e.holds==="phone"?{autoComplete:"tel"}:{},value:typeof t=="string"?t:typeof t=="number"?String(t):"",onChange:n=>o(n.target.value),"data-graview-part":"control"})]});case"number":return e.amount?(0,a.jsx)(he,{title:u,name:e.name,optional:e.optional,amount:e.amount,value:t,onChange:o}):(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,a.jsx)("span",{"data-graview-part":"label",children:u}),(0,a.jsx)("input",{type:"number",name:e.name,required:!e.optional,...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max},...e.step===void 0?{}:{step:e.step},value:typeof t=="number"?t:"",onChange:n=>o(n.target.value===""?void 0:Number(n.target.value)),"data-graview-part":"control"})]});case"boolean":return(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":"boolean",children:[(0,a.jsx)("input",{type:"checkbox",name:e.name,checked:t===!0,onChange:n=>o(n.target.checked),"data-graview-part":"control"}),(0,a.jsx)("span",{"data-graview-part":"label",children:u})]});case"choice":if(e.multiple){let n=Array.isArray(t)?t.map(String):[];return(0,a.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":"choices","data-graview-choices":e.name,children:[(0,a.jsx)("legend",{"data-graview-part":"label",children:u}),(e.options??[]).map(l=>(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":"boolean",children:[(0,a.jsx)("input",{type:"checkbox",name:e.name,value:l,checked:n.includes(l),onChange:h=>{let d=h.target.checked?[...n.filter(r=>r!==l),l]:n.filter(r=>r!==l),c=(e.options??[]).filter(r=>d.includes(r));o(c.length>0?c:void 0)},"data-graview-part":"control"}),(0,a.jsx)("span",{"data-graview-part":"label",children:p(e.name).option(l)})]},l))]})}return(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,a.jsx)("span",{"data-graview-part":"label",children:u}),(0,a.jsx)(le,{children:(0,a.jsxs)("select",{name:e.name,required:!e.optional,value:typeof t=="string"?t:"",onChange:n=>o(n.target.value||void 0),"data-graview-part":"control",children:[(0,a.jsx)("option",{value:"",children:"\u2014"}),(e.options??[]).map(n=>(0,a.jsx)("option",{value:n,children:p(e.name).option(n)},n))]})})]});case"node":{let n=y.find(r=>r.name===e.name)?.candidates,l=new Set(Object.values(v).filter(r=>typeof r=="string")),h=(e.kinds.includes("*")?[...i.graph.allNodes()]:e.kinds.flatMap(r=>i.graph.nodesOfKind(r))).filter(r=>!l.has(r.id)),d=n?n.map(r=>i.graph.getNode(r)).filter(r=>r!==void 0):h,c=Q(d,r=>i.schema.tryDefinition(r));return(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,a.jsx)("span",{"data-graview-part":"label",children:u}),(0,a.jsx)(le,{children:(0,a.jsxs)("select",{name:e.name,required:!e.optional,value:typeof t=="string"?t:"",onChange:r=>o(r.target.value||void 0),"data-graview-part":"control",children:[(0,a.jsx)("option",{value:"",children:"\u2014"}),d.map(r=>{let k=c.get(r.id);return(0,a.jsxs)("option",{value:r.id,children:[$(i.schema.tryDefinition(r.kind),r),k?` \xB7 ${k}`:""]},r.id)})]})})]})}case"group":{let n=t??{};return(0,a.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.control,children:[(0,a.jsx)("legend",{"data-graview-part":"label",children:u}),e.fields.map(l=>(0,a.jsx)(M,{store:i,spec:l,value:n[l.name],onChange:h=>o({...n,[l.name]:h}),prefilled:v,open:y,words:p},l.name))]})}case"variant":{let n=t??{},l=typeof n[e.tag]=="string"?n[e.tag]:"",h=e.options.find(d=>d.value===l);return(0,a.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.control,children:[(0,a.jsx)("legend",{"data-graview-part":"label",children:u}),(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":"choice",children:[(0,a.jsx)("span",{"data-graview-part":"label",children:E(e.tag)}),(0,a.jsxs)("select",{value:l,onChange:d=>o({[e.tag]:d.target.value}),"data-graview-part":"control",children:[(0,a.jsx)("option",{value:"",children:"\u2014"}),e.options.map(d=>(0,a.jsx)("option",{value:d.value,children:K(d.value)},d.value))]})]}),h?.fields.map(d=>(0,a.jsx)(M,{store:i,spec:d,value:n[d.name],onChange:c=>o({...n,[d.name]:c}),prefilled:v,open:y,words:p},d.name))]})}case"file":case"list":{let n=e.control==="file"?e:e.item.control==="file"?e.item:void 0;if(n||e.control==="file")return(0,a.jsx)(W,{as:"control",title:P?`${w} *`:w,value:t,onChange:o,several:n!==e,image:n?.image===!0,video:n?.video===!0,label:w});let l=Array.isArray(t)?t:[];return(0,a.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":"list",children:[(0,a.jsx)("legend",{"data-graview-part":"label",children:u}),l.map((h,d)=>(0,a.jsxs)("div",{"data-graview-part":"item",children:[(0,a.jsx)("div",{style:{flex:1},children:(0,a.jsx)(M,{store:i,spec:{...e.item,optional:!1},value:h,onChange:c=>o(l.map((r,k)=>k===d?c:r)),prefilled:v,open:y,words:p})}),(0,a.jsx)("button",{type:"button","data-graview-part":"remove",onClick:()=>o(l.filter((c,r)=>r!==d)),children:"remove"})]},d)),(0,a.jsx)("button",{type:"button","data-graview-part":"add",onClick:()=>o([...l,void 0]),children:"add another"})]})}case"linked":return(0,a.jsx)("div",{"data-graview-part":"field","data-graview-field":"linked",children:(0,a.jsx)(I,{relation:e.relation,value:t,onChange:o,label:w})});case"repeat":return(0,a.jsx)(q,{value:t,onChange:o,start:e.of?S?.[e.of]:void 0,label:`${e.of?p(e.of).label:w} repeats`,name:e.name});case"opaque":return(0,a.jsxs)("p",{"data-graview-part":"unasked",children:["\u201C",E(e.name),"\u201D needs a structured answer this form cannot ask for yet."]})}}function ve(i){let e=[...i.querySelectorAll("input:not([type=hidden]), select, textarea")].filter(t=>!t.disabled&&!t.closest("[hidden], [inert], [aria-hidden='true']"));return e.find(t=>t.required&&t.value==="")??e[0]??i.querySelector('button[type="submit"]')}function Ne({store:i,mutation:e,prefilled:t={},open:o=[],onDone:v,principal:y,initial:p,label:S,only:w,autoFocus:P=!1}){let u=()=>re(e,i.graph,t),[n,l]=(0,b.useState)(u),[h,d]=(0,b.useState)(()=>({...n,...p})),[c,r]=(0,b.useState)(null),k=y??i.seenFor,j=e.subject&&t[e.subject.arg],de=k?oe(i,k,e,typeof j=="string"?j:void 0):void 0,z=ne(i.schema,e),C=(w===void 0?z:w.flatMap(s=>z.find(m=>m.name===s)??[])).filter(s=>!de?.has(s.name)),se=s=>U(i.schema,e,s),N=k!==void 0&&i.mayPropose({name:e.name,args:{...t}},k),[pe,ue]=(0,b.useState)(!1),F=ae(C.filter(s=>s.control==="date").map(s=>s.name)),D=(0,b.useRef)(void 0),me=(s,m)=>d(g=>{let A={...g,[s.name]:m};if(F&&s.name===F.start&&s.control==="date"){let f=x=>typeof x=="string"&&x!==""?x:void 0,R=f(g[F.start])??D.current;if(f(m)){D.current=f(m);let x=ee(R,f(m),f(g[F.end]),{time:s.time===!0,instant:s.instant===!0});x!==void 0&&(A[F.end]=x)}}return A}),G=(0,b.useRef)(null);return(0,b.useEffect)(()=>{if(!P)return;let s=document.activeElement,m=0,g=0,A=()=>{let f=G.current;if(!f)return;let R=document.activeElement;if(R!==s&&R!==document.body&&R!==null&&!f.contains(R)||f.contains(R))return;let x=f.querySelector("[data-graview-when-arriving]")&&g<30?null:ve(f);if(x){x.focus();return}g+=1,g<=30&&(m=requestAnimationFrame(A))};return m=requestAnimationFrame(A),()=>cancelAnimationFrame(m)},[]),(0,a.jsxs)("form",{ref:G,"data-testid":`form-${e.name}`,onSubmit:s=>{s.preventDefault();let m={name:e.name,args:{...ie(te(C,h),n),...t}};if(N){try{i.apply({name:_,args:{calls:[m]}},{author:k}),r(null),ue(!0),v?.()}catch(g){r(T(i.schema,i.allMutations(),g))}return}try{i.apply(m,y?{author:y}:{}),r(null);let g=u();l(g),d({...g}),v?.()}catch(g){r(T(i.schema,i.allMutations(),g));let A=e.subject?t[e.subject.arg]:void 0,f=typeof A=="string"?i.graph.getNode(A)?.kind:void 0;Y(i,{type:"refused",act:e.name,code:V(g).reason,...f?{kind:f}:{}},y)}},"data-graview-part":"form",children:[(0,a.jsx)("style",{children:fe}),C.map(s=>(0,a.jsx)(M,{store:i,spec:s,value:h[s.name],values:h,onChange:m=>me(s,m),prefilled:t,open:o,words:se},s.name)),c?(0,a.jsx)("p",{"data-testid":"refused","data-graview-part":"refused",role:"alert",children:c}):null,pe?(0,a.jsx)("p",{"data-testid":"proposed","data-graview-part":"proposed",role:"status",children:"Proposed: it waits in Suggested for somebody who may make it."}):null,(0,a.jsx)("button",{type:"submit","data-graview-part":"submit",...N?{"data-graview-proposes":"",title:`${S??e.title??e.name}: you may propose it, and somebody who may make it decides`}:{},children:N?"Propose":S??e.title??e.name})]})}export{Ne as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as g}from"./chunk.
|
|
1
|
+
import{f as g}from"./chunk.3FKKH2XU.js";import{V as p}from"./chunk.VLX7YWVH.js";import{Qc as u,Yc as c}from"./chunk.IQGSEAQ2.js";import{b as h}from"./chunk.AJZBJBMO.js";var s={person:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><circle cx="11.6" cy="5.4" r="2.5"/><path d="M7.9 12.4c0-2.1 1.7-3.8 3.7-3.8s3.7 1.7 3.7 3.8v3.2H7.9z"/><path d="M8 12.6 6.4 17.2"/><path d="M15.2 12.6 16.8 17.2"/><path d="M9.8 15.6v5"/><path d="M13.4 15.6v5"/></svg>',plot:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.6 9.4 12 4.6l9.4 4.8-9.4 4.8z"/><path d="M2.6 9.4v4.4l9.4 4.8 9.4-4.8V9.4"/><path d="M12 14.2v4.4"/><path d="M7 11.9v3"/><path d="M17 11.9v3"/></svg>',box:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.4 7.9 12 3.6l8.6 4.3-8.6 4.3z"/><path d="M3.4 7.9v8.2L12 20.4l8.6-4.3V7.9"/><path d="M12 12.2v8.2"/></svg>',task:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M4.4 6.6 12 2.9l7.6 3.7v9.5L12 19.8 4.4 16.1z"/><path d="M12 12.4v7.4"/><path d="M4.4 6.6 12 10.3l7.6-3.7"/><path d="M8 9.6l2.4 2.4L16 8.4"/></svg>',shift:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.2 8.2 12 4l8.8 4.2-8.8 4.2z"/><path d="M3.2 8.2v7.2L12 19.6l8.8-4.2V8.2"/><path d="M12 12.4v7.2"/><path d="M6.6 10.8v3.4"/><path d="M9.3 12v3.4"/></svg>',list:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 10.4 12 6l9.2 4.4-9.2 4.4z"/><path d="M2.8 10.4v3.2L12 18l9.2-4.4v-3.2"/><path d="M6.6 8.6 15.8 13"/><path d="M9.4 7.2 18.6 11.6"/></svg>',vehicle:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 14.2 5 9.4l8.6-1.6 5.4 3-1 3.6z"/><path d="M2.8 14.2v2.2h2.4"/><path d="M18 16.4h1.9l.1-2.2"/><circle cx="7.6" cy="16.6" r="1.9"/><circle cx="16.1" cy="16.6" r="1.9"/><path d="M8.6 8.2 9.8 12l7.2-1"/></svg>',rule:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M5.4 19.4V6.6l12 12.8z"/><path d="M5.4 6.6 7.6 5.5l12 12.8-2.2 1.1"/><path d="M5.4 19.4 7.6 18.3h12"/><path d="M5.4 10.1h1.7"/><path d="M5.4 13.3h1.7"/><path d="M5.4 16.5h1.7"/></svg>',note:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M6.2 6.2 14.8 10.5v9L6.2 15.2z"/><path d="M12.4 9.3 14.8 10.5l-.6 2.3"/><path d="M8.2 10.6 12.8 12.9"/><path d="M8.2 13.2 11.4 14.8"/></svg>'},w=Object.keys(s);function o(e){if(!e)return;let t=s[e];return t||(e.trimStart().startsWith("<svg")&&c(e)===null?e:void 0)}var a=h(p(),1);function j({kind:e,schema:t,brand:i,size:r=16,title:n}){let f=t?.tryDefinition?.(e)?.figure,d=o(i?.figures?.[e]??f),l=Math.round(u(e,i?.accents)),v=g(d);return d?(0,a.jsx)("span",{"aria-hidden":n===void 0?"true":void 0,...n===void 0?{}:{role:"img","aria-label":n},"data-graview-figure":e,"data-graview-figure-kind":"figure",dangerouslySetInnerHTML:v,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:r,height:r,flex:"0 0 auto",color:`hsl(${l} 55% 52%)`,"--graview-figure-size":`${r}px`}}):(0,a.jsx)("span",{"aria-hidden":n===void 0?"true":void 0,...n===void 0?{}:{role:"img","aria-label":n},"data-graview-figure":e,"data-graview-figure-kind":"dot",style:{display:"inline-block",width:Math.round(r*.8),height:Math.round(r*.5),flex:"0 0 auto",background:`hsl(${l} 55% 52%)`,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)"}})}function A(e,t,i){return o(i?.figures?.[e]??t?.tryDefinition?.(e)?.figure)!==void 0}export{j as a,A as b};
|