graview 0.1.56 → 0.1.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/preview/{chunk.5B4HNQGR.js → chunk.2PWVDUOU.js} +1 -1
- package/dist/preview/{chunk.DWMAFMYZ.js → chunk.33PZEW5A.js} +1 -1
- package/dist/preview/{chunk.D4LN33J2.js → chunk.3DPTDMJ7.js} +1 -1
- package/dist/preview/{chunk.PJCVFYFU.js → chunk.47T3KUAA.js} +1 -1
- package/dist/preview/{chunk.AKVBU5K5.js → chunk.4BRM5SGO.js} +1 -1
- package/dist/preview/{chunk.NQ4VGKEC.js → chunk.4HFCOMR3.js} +1 -1
- package/dist/preview/{chunk.PMPDLE56.js → chunk.4HPP35XQ.js} +1 -1
- package/dist/preview/{chunk.USB6B6L3.js → chunk.4JDHBNEA.js} +1 -1
- package/dist/preview/{chunk.4EUH6TLG.js → chunk.4K6VAC2S.js} +2 -2
- package/dist/preview/{chunk.VDD3RHLB.js → chunk.4L4F47QP.js} +1 -1
- package/dist/preview/{chunk.J3YBEZKE.js → chunk.4NPXMYA5.js} +1 -1
- package/dist/preview/{chunk.TAIYNHSW.js → chunk.4OP4IEEY.js} +1 -1
- package/dist/preview/chunk.4SBYXHCQ.js +1 -0
- package/dist/preview/{chunk.QW3QLE53.js → chunk.4UQBMFJZ.js} +1 -1
- package/dist/preview/{chunk.MLRPCZVS.js → chunk.4W5GCPAP.js} +1 -1
- package/dist/preview/{chunk.NUE5VG4G.js → chunk.4XKRCAJZ.js} +1 -1
- package/dist/preview/{chunk.PRV3KYT6.js → chunk.534TBZJ3.js} +2 -2
- package/dist/preview/{chunk.2HZGUVB2.js → chunk.53U6E5LD.js} +1 -1
- package/dist/preview/{chunk.AQCU6TPV.js → chunk.547FQPYG.js} +1 -1
- package/dist/preview/{chunk.N3Q5CPVA.js → chunk.57BKS5KD.js} +1 -1
- package/dist/preview/chunk.57KRCHQT.js +1 -0
- package/dist/preview/{chunk.6HLKAUWF.js → chunk.5BPRGXIW.js} +1 -1
- package/dist/preview/{chunk.E4EN4X5F.js → chunk.5GTOF5D5.js} +1 -1
- package/dist/preview/{chunk.KY7QD22S.js → chunk.5IEFTFKQ.js} +1 -1
- package/dist/preview/{chunk.IT763BYH.js → chunk.5NZDFT6R.js} +1 -1
- package/dist/preview/{chunk.K2JE3PD7.js → chunk.66LWZIY5.js} +1 -1
- package/dist/preview/{chunk.QYFZ7AZS.js → chunk.6AH26OL7.js} +2 -2
- package/dist/preview/{chunk.EC5IWN74.js → chunk.6SD7YZ4U.js} +2 -2
- package/dist/preview/{chunk.N7EEPFYV.js → chunk.72IHABM5.js} +1 -1
- package/dist/preview/chunk.7INWDFNG.js +1 -0
- package/dist/preview/{chunk.7O6Z3BFR.js → chunk.7IXTNST2.js} +1 -1
- package/dist/preview/{chunk.DTSTUC2W.js → chunk.7ML2BWSP.js} +1 -1
- package/dist/preview/{chunk.QAIYYIZQ.js → chunk.7UBABS2T.js} +1 -1
- package/dist/preview/{chunk.KBL4Y4UN.js → chunk.7VIFAN3O.js} +1 -1
- package/dist/preview/chunk.7VZA34T4.js +1 -0
- package/dist/preview/{chunk.JQY2UKU6.js → chunk.AD3EC5DU.js} +1 -1
- package/dist/preview/{chunk.RDL6652E.js → chunk.BCE6LIDR.js} +1 -1
- package/dist/preview/{chunk.Q7X2IVLH.js → chunk.BPEUHOKH.js} +1 -1
- package/dist/preview/{chunk.SRC37GNP.js → chunk.BUSFJM6P.js} +1 -1
- package/dist/preview/{chunk.FCUDBMGC.js → chunk.BZEJM2PY.js} +1 -1
- package/dist/preview/{chunk.22MIRLL6.js → chunk.C5EFUODO.js} +1 -1
- package/dist/preview/{chunk.64IKLRUS.js → chunk.C7EJPV2N.js} +1 -1
- package/dist/preview/chunk.CMLNBJZG.js +3 -0
- package/dist/preview/{chunk.RXYE2DAJ.js → chunk.CUKRUQQ2.js} +1 -1
- package/dist/preview/chunk.CXB4BSI4.js +1 -0
- package/dist/preview/{chunk.2E6EWVWR.js → chunk.D3LQJXVP.js} +1 -1
- package/dist/preview/{chunk.I2C5LPB5.js → chunk.D4EP7FEC.js} +1 -1
- package/dist/preview/{chunk.NPAWTPLQ.js → chunk.DBMZ3AQB.js} +1 -1
- package/dist/preview/{chunk.YEJ4LNUP.js → chunk.DIFR37EZ.js} +1 -1
- package/dist/preview/{chunk.LLOZKUCA.js → chunk.DJ4A76SX.js} +1 -1
- package/dist/preview/{chunk.VEOS25PQ.js → chunk.DM5X3JBH.js} +1 -1
- package/dist/preview/chunk.DQUISKTC.js +1 -0
- package/dist/preview/chunk.DSLGMCB6.js +1 -0
- package/dist/preview/chunk.DSWMXM57.js +1 -0
- package/dist/preview/{chunk.C2VFDBSG.js → chunk.DWLKJGVT.js} +1 -1
- package/dist/preview/{chunk.WMB2NNBD.js → chunk.EQAAKYLA.js} +1 -1
- package/dist/preview/{chunk.2YNZVNCA.js → chunk.EXZLG3HK.js} +1 -1
- package/dist/preview/{chunk.LP3SHWJG.js → chunk.EZ4NUZWX.js} +1 -1
- package/dist/preview/{chunk.E33EJU3Q.js → chunk.EZ4TZUMM.js} +1 -1
- package/dist/preview/{chunk.AKW6NR3X.js → chunk.FJTWAU7N.js} +1 -1
- package/dist/preview/{chunk.VYW7DSUW.js → chunk.FLMNWVSY.js} +2 -2
- package/dist/preview/{chunk.ILSK2E3R.js → chunk.FLVE6IBM.js} +1 -1
- package/dist/preview/{chunk.SOTB6C5A.js → chunk.FPGU43SC.js} +1 -1
- package/dist/preview/{chunk.K5YLQAFW.js → chunk.FRERJWZJ.js} +1 -1
- package/dist/preview/{chunk.D6BMAGPR.js → chunk.G3BDQ6EA.js} +1 -1
- package/dist/preview/chunk.GBAUQXXD.js +1 -0
- package/dist/preview/{chunk.WPJVMVAL.js → chunk.H5CRRBNU.js} +1 -1
- package/dist/preview/{chunk.4KMY24YC.js → chunk.HFSG3F5Z.js} +1 -1
- package/dist/preview/chunk.I2NI7CT7.js +1 -0
- package/dist/preview/{chunk.T6HG2XIP.js → chunk.I5PSHASU.js} +1 -1
- package/dist/preview/{chunk.XGCOWCA2.js → chunk.I636CZE4.js} +1 -1
- package/dist/preview/chunk.I6H3HRWT.js +1 -0
- package/dist/preview/{chunk.CGM7OER2.js → chunk.IRQOJATD.js} +1 -1
- package/dist/preview/chunk.IV7AUO53.js +1 -0
- package/dist/preview/{chunk.ONGZ3YQF.js → chunk.IX63LTRQ.js} +1 -1
- package/dist/preview/{chunk.JZDKHWRL.js → chunk.JBSW7ZNH.js} +1 -1
- package/dist/preview/chunk.JD5HSAMC.js +18 -0
- package/dist/preview/{chunk.LKK7VQBA.js → chunk.JETT6ELP.js} +1 -1
- package/dist/preview/{chunk.IF4FCQPG.js → chunk.JNNBHD4Z.js} +1 -1
- package/dist/preview/{chunk.HFVMGTNL.js → chunk.JQFIZRAZ.js} +2 -2
- package/dist/preview/chunk.KNYLY7MH.js +1 -0
- package/dist/preview/chunk.KO7IOFNY.js +1 -0
- package/dist/preview/{chunk.XY5EVI22.js → chunk.KPIDJYIU.js} +1 -1
- package/dist/preview/{chunk.APXYWI3L.js → chunk.KTV24HY7.js} +1 -1
- package/dist/preview/{chunk.YL5ZCRHQ.js → chunk.KYOI7BG3.js} +1 -1
- package/dist/preview/{chunk.SVAQGVS4.js → chunk.LE2KAR25.js} +1 -1
- package/dist/preview/{chunk.VLBY66PB.js → chunk.LHIT3EZD.js} +2 -2
- package/dist/preview/{chunk.7Z4USR3Y.js → chunk.LKJ6FD6Y.js} +1 -1
- package/dist/preview/chunk.LUIRQ5UF.js +2 -0
- package/dist/preview/chunk.LWRXCO2Z.js +1 -0
- package/dist/preview/{chunk.AZUTYY2S.js → chunk.M72JKVHP.js} +4 -4
- package/dist/preview/{chunk.65Q5MKDW.js → chunk.MAZFQIL5.js} +1 -1
- package/dist/preview/{chunk.V3NPUAPB.js → chunk.MBLFZF5R.js} +1 -1
- package/dist/preview/{chunk.QNNRSPIJ.js → chunk.MRHPOUA4.js} +1 -1
- package/dist/preview/{chunk.BNEOLRQG.js → chunk.MWWOI5PW.js} +1 -1
- package/dist/preview/{chunk.4EY6WPSM.js → chunk.N2DM42SG.js} +2 -2
- package/dist/preview/chunk.N33WUCAN.js +3 -0
- package/dist/preview/{chunk.MFDSWA2W.js → chunk.N5MQARN6.js} +1 -1
- package/dist/preview/{chunk.2OX4YI46.js → chunk.NF72Z2HG.js} +1 -1
- package/dist/preview/{chunk.TXWCTHMI.js → chunk.NGK6IRV3.js} +1 -1
- package/dist/preview/{chunk.2DETYEJM.js → chunk.NL3AJZ3N.js} +1 -1
- package/dist/preview/{chunk.GUP7LC5O.js → chunk.NUS5K56R.js} +2 -2
- package/dist/preview/{chunk.7NP2I2UP.js → chunk.NX7CR4AE.js} +1 -1
- package/dist/preview/{chunk.7RJGEU3Y.js → chunk.NZDWXX6H.js} +1 -1
- package/dist/preview/{chunk.QSO5BP2H.js → chunk.O47MN7E5.js} +1 -1
- package/dist/preview/chunk.OYUDK3LK.js +1 -0
- package/dist/preview/chunk.PF5P5YVD.js +1 -0
- package/dist/preview/{chunk.V6X3U3JF.js → chunk.PHC2MI4C.js} +1 -1
- package/dist/preview/{chunk.MJMVGW6Z.js → chunk.PQMMISCQ.js} +1 -1
- package/dist/preview/{chunk.E4HSSGF7.js → chunk.Q6OZLBNL.js} +1 -1
- package/dist/preview/{chunk.AM2YRNOQ.js → chunk.QMYHXMRV.js} +1 -1
- package/dist/preview/chunk.QPL3OXW3.js +1 -0
- package/dist/preview/{chunk.ZFXHZZHW.js → chunk.QS6YW7UY.js} +1 -1
- package/dist/preview/chunk.QUJS63OJ.js +13 -0
- package/dist/preview/{chunk.USQNSNIA.js → chunk.RALAID6N.js} +1 -1
- package/dist/preview/{chunk.XJFAUOJS.js → chunk.RQX4CQJN.js} +1 -1
- package/dist/preview/{chunk.NBLMANHT.js → chunk.RVR6FWAF.js} +1 -1
- package/dist/preview/{chunk.O6LDZWLR.js → chunk.S5ECRIG5.js} +1 -1
- package/dist/preview/{chunk.CKV2QCH5.js → chunk.SAJLIA5M.js} +1 -1
- package/dist/preview/{chunk.IRMO4FUC.js → chunk.TBRXNU6T.js} +1 -1
- package/dist/preview/{chunk.MORMTKVR.js → chunk.TVURUMU4.js} +1 -1
- package/dist/preview/{chunk.3X3GLNWQ.js → chunk.UBNZDSS7.js} +1 -1
- package/dist/preview/chunk.UDCDK7XJ.js +4 -0
- package/dist/preview/{chunk.NFU4UM6F.js → chunk.UGOKORIF.js} +1 -1
- package/dist/preview/{chunk.CU2NQ5WF.js → chunk.UV3U4FRT.js} +1 -1
- package/dist/preview/{chunk.IUQOSPQX.js → chunk.UWQ3I5OW.js} +1 -1
- package/dist/preview/chunk.V6FUYRZI.js +1 -0
- package/dist/preview/{chunk.DH7M57SE.js → chunk.VDS3IOTK.js} +1 -1
- package/dist/preview/{chunk.OBUKZQCZ.js → chunk.VHPGGC2P.js} +1 -1
- package/dist/preview/{chunk.FBR4HJ2Q.js → chunk.VSGTNYM2.js} +1 -1
- package/dist/preview/{chunk.G3ORIU7C.js → chunk.VW4JAQCH.js} +1 -1
- package/dist/preview/{chunk.VSM72NVF.js → chunk.WASWMHND.js} +1 -1
- package/dist/preview/chunk.WYPL2QUA.js +1 -0
- package/dist/preview/{chunk.UQQAGT3R.js → chunk.XTBS64IT.js} +1 -1
- package/dist/preview/chunk.XVN3CQKH.js +2 -0
- package/dist/preview/{chunk.D6KF72MZ.js → chunk.Y3EOGXRS.js} +1 -1
- package/dist/preview/chunk.Y4KNR76Z.js +1 -0
- package/dist/preview/chunk.YDTXCVBU.js +1 -0
- package/dist/preview/{chunk.YLMOGGEP.js → chunk.YPP7FSEZ.js} +1 -1
- package/dist/preview/{chunk.45VIF2SX.js → chunk.YQXA4WAM.js} +2 -2
- package/dist/preview/{chunk.JHFHIG4P.js → chunk.YR75TWDV.js} +1 -1
- package/dist/preview/{chunk.AIK3Z25Y.js → chunk.YS5U3DUX.js} +1 -1
- package/dist/preview/chunk.Z5UVYOGC.js +1 -0
- package/dist/preview/{chunk.5MS2TQFX.js → chunk.ZNXRHOUI.js} +1 -1
- package/dist/preview/index.html +50 -50
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.2BLRCT3E.js +0 -1
- package/dist/preview/chunk.3V2WH6F7.js +0 -1
- package/dist/preview/chunk.4YI6656P.js +0 -1
- package/dist/preview/chunk.5MSWUTDB.js +0 -1
- package/dist/preview/chunk.6Q6BW4QT.js +0 -2
- package/dist/preview/chunk.7U2JO7ET.js +0 -3
- package/dist/preview/chunk.7Z2PRPYE.js +0 -1
- package/dist/preview/chunk.AGTFYPXY.js +0 -1
- package/dist/preview/chunk.BT7RLFPO.js +0 -1
- package/dist/preview/chunk.DPPT6WAJ.js +0 -2
- package/dist/preview/chunk.DVG47BK3.js +0 -1
- package/dist/preview/chunk.DZYLH5IM.js +0 -1
- package/dist/preview/chunk.E5XNQTEU.js +0 -1
- package/dist/preview/chunk.F5RN6YXG.js +0 -4
- package/dist/preview/chunk.FOQENWF5.js +0 -1
- package/dist/preview/chunk.GNQW4JOG.js +0 -18
- package/dist/preview/chunk.HVN2DVP3.js +0 -1
- package/dist/preview/chunk.JL4DGITZ.js +0 -1
- package/dist/preview/chunk.K4MO22RM.js +0 -1
- package/dist/preview/chunk.KMEKMCKG.js +0 -3
- package/dist/preview/chunk.LVOVPU64.js +0 -1
- package/dist/preview/chunk.MEJUAV3Y.js +0 -1
- package/dist/preview/chunk.OYGPNO7A.js +0 -1
- package/dist/preview/chunk.RR2IFETZ.js +0 -1
- package/dist/preview/chunk.T2RME6XF.js +0 -1
- package/dist/preview/chunk.TAJ2R44N.js +0 -1
- package/dist/preview/chunk.TQCRFZ53.js +0 -1
- package/dist/preview/chunk.UE5YS3GN.js +0 -1
- package/dist/preview/chunk.VIQ6EF2O.js +0 -1
- package/dist/preview/chunk.XE72DFBV.js +0 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as B,b as ve}from"./chunk.
|
|
1
|
+
import{a as B,b as ve}from"./chunk.VDS3IOTK.js";import{a as ye,c as he,d as be,f as we}from"./chunk.I2NI7CT7.js";import{b as S,c as fe,d as me,j as ce,k as ge}from"./chunk.RQX4CQJN.js";import{b as pe,k as q}from"./chunk.LUIRQ5UF.js";import{c as de,f as ue}from"./chunk.N33WUCAN.js";import{G as Re,T as se,ca as le,h as ae,u as ie}from"./chunk.DBMZ3AQB.js";import{Ha as te,Sa as re,Ta as oe,da as Z,ga as ee,oa as ne}from"./chunk.DIFR37EZ.js";import{b as W}from"./chunk.AJZBJBMO.js";var l=W(Re(),1);var i=W(se(),1);function qe({affordance:n,onApply:a,onCancel:u,store:w}){let y=le(),s=w??y?.store,[x,_]=(0,l.useState)({}),[p,D]=(0,l.useState)(""),[I,F]=(0,l.useState)(G),[J,V]=(0,l.useState)(void 0),U=(0,l.useId)(),L=(0,l.useRef)(null),A=n.open.filter(e=>!(e.name in x)),o=A[0],v=s.allMutations().find(e=>e.name===n.mutation),P=(0,l.useMemo)(()=>De(v,s,n.args??{}),[v,s,n.args]),d=o?P[o.name]:void 0,E=ge(n.open.filter(e=>e.shape?.type==="date").map(e=>e.name)),Se=(()=>{if(!E||o?.name!==E.end||o.shape?.type!=="date")return;let e=x[E.start];if(typeof e!="string")return;let r=P[E.start];return ce(typeof r=="string"?r:void 0,e,typeof d=="string"?d:void 0,{time:o.shape.time===!0,instant:o.shape.instant===!0})})();(0,l.useEffect)(()=>{D(Se??ke(d,o?.shape)),F(Array.isArray(d)?d:G),V(d)},[o?.name]),(0,l.useEffect)(()=>{L.current?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[o?.name]),(0,l.useLayoutEffect)(()=>{let e=L.current,r=typeof document>"u"?null:document.activeElement,f=r instanceof HTMLElement&&r.getAttribute("data-affordance")===n.id;if(!e||r&&r!==document.body&&!e.contains(r)&&!f)return;let b=e.querySelector('[data-testid="ask-filter"], form input, [role=group] button:not([disabled])');b&&b!==r&&b.focus()},[o?.name]);let Y=ve({flow:"both",letters:!0});if(!o)return null;let h=e=>{let r=d!==void 0&&JSON.stringify(e)===JSON.stringify(d)?void 0:e,f={...x,[o.name]:r};if(n.open.filter(R=>!(R.name in f)).length===0){let R=a(Object.fromEntries(Object.entries(f).filter(([,M])=>M!==void 0)));R&&R.length>0&&_(Object.fromEntries(Object.entries(f).filter(([M])=>!R.includes(M))))}else _(f)},O=o.optional?(0,i.jsx)("button",{type:"button",onClick:()=>h(void 0),style:{fontSize:"0.8125rem"},children:"Skip"}):null,t=o.shape??{type:"unknown"},c=t.type==="number"?t.amount:void 0,g=Ee(o,t),m=q(s.schema,v,o.name),Q=te((v?.input?.shape??{})[o.name]),xe=oe((v?.input?.shape??{})[o.name]),N=re(o.name),Ae=typeof d=="boolean"?d?"yes":"no":d,[T,Oe]=(0,l.useState)(""),X=(0,l.useMemo)(()=>{let e=g.map(r=>s.graph.getNode(r)).filter(r=>r!==void 0);return pe(e,r=>s.schema.tryDefinition(r))},[g,s]),j=e=>{let r=Ce(s,t,e),f=t.type==="choice"||t.type==="several"&&t.of.type==="choice"?m.option(e):r,b=X.get(e);return b?`${f} \xB7 ${b}`:f},$=(0,l.useMemo)(()=>{let e=T.trim().toLowerCase();return e===""?g:g.filter(r=>j(r).toLowerCase().includes(e))},[g,T,s,t,X]),k=t.type==="several",H=t.type==="file"?t:t.type==="several"&&t.of.type==="file"?t.of:void 0,K=k&&g.length===0,C=o.kinds&&o.kinds.length>0&&!o.kinds.includes("*")?o.kinds.map(e=>Z(ne(s.schema.tryDefinition(e),e))).join(" or "):m.label,Ne=n.open.length>1?`${C} \xB7 ${n.open.length-A.length+1} of ${n.open.length}`:C;return(0,i.jsxs)("div",{ref:L,"data-graview-asking":n.id,style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:4,padding:"5px 0 2px"},children:[n.open.length>1||g.length>0?(0,i.jsx)("span",{id:U,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:Ne}):null,g.length>z?(0,i.jsx)("input",{type:"search",value:T,onChange:e=>Oe(e.target.value),placeholder:`Filter ${g.length}\u2026`,"aria-label":`Filter ${C}`,"data-testid":"ask-filter",onKeyDown:e=>{if(e.key!=="ArrowDown"||e.metaKey||e.ctrlKey||e.altKey)return;let r=Y.ref.current?.querySelector(`[${B}][tabindex="0"]`);r&&(e.preventDefault(),r.focus())},style:{font:"inherit",fontSize:"0.8125rem",minWidth:0,padding:"3px 7px"}}):null,xe?(0,i.jsxs)("form",{style:{display:"grid",gap:4},onSubmit:e=>{e.preventDefault(),h(J??(d===void 0?void 0:null))},children:[(0,i.jsx)(be,{value:J,onChange:V,start:N?x[N]??P[N]:void 0,label:`${N?q(s.schema,v,N).label:m.label} repeats`,name:o.name}),(0,i.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,i.jsx)("button",{type:"submit",style:{fontSize:"0.8125rem"},children:A.length>1?"Next":"Apply"}),O]})]}):Q?(0,i.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,i.jsx)(he,{relation:Q,value:d,onChange:h,label:m.label}),O]}):H?(0,i.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,i.jsx)(ye,{as:"control",value:d,onChange:h,several:k,image:H.image===!0,video:H.video===!0,label:m.label}),O]}):g.length>0?(0,i.jsxs)("div",{...Y,role:"group","aria-labelledby":U,style:{display:"flex",flexWrap:"wrap",gap:4},children:[$.slice(0,z).map(e=>{let r=k?I.includes(e):e===Ae;return(0,i.jsx)("button",{type:"button",[B]:"","aria-label":`${C}: ${j(e)}`,...k?{"aria-pressed":r}:r?{"aria-current":!0}:{},style:{padding:"3px 9px",fontSize:"0.8125rem",...r?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},onClick:()=>k?F(f=>f.includes(e)?f.filter(b=>b!==e):[...f,e]):h(t.type==="boolean"?e==="yes":e),children:j(e)},e)}),$.length>z?(0,i.jsxs)("span",{"data-testid":"ask-more",style:{alignSelf:"center",fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:[$.length-z," more \u2014 type to narrow"]}):null,$.length===0?(0,i.jsxs)("span",{"data-testid":"ask-none",style:{alignSelf:"center",fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["None of the ",g.length," match that."]}):null,k?(0,i.jsx)("button",{type:"button",disabled:I.length===0,style:{fontSize:"0.8125rem"},onClick:()=>{let e=I;F(G),h(e)},children:A.length>1?"Next":"Apply"}):null,O]}):(0,i.jsxs)("form",{style:{display:"flex",flexWrap:"wrap",gap:4},onSubmit:e=>{if(e.preventDefault(),d!==void 0&&p===ke(d,t)){h(void 0);return}if(K){h(p.split(/[,\n]/).map(r=>r.trim()).filter(Boolean));return}if(p.trim().length!==0){if(c){let r=me(p,c);r!==void 0&&h(r);return}h(t.type==="number"?t.duration?ue(p)??p:Number(p):p)}},children:[t.type==="text"&&t.long?(0,i.jsx)("textarea",{autoFocus:!0,name:o.name,"aria-label":m.label,placeholder:m.label,value:p,rows:4,onChange:e=>D(e.target.value),onKeyDown:e=>{e.key==="Escape"?u():e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},style:{flex:"1 1 100%",minWidth:0,font:"inherit",fontSize:"0.875rem",lineHeight:1.45,padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",resize:"vertical",fieldSizing:"content",minHeight:"5.5em",maxHeight:"40vh"}}):t.type==="date"?(0,i.jsx)(we,{autoFocus:!0,name:o.name,label:m.label,value:p===""?void 0:p,time:t.time===!0,instant:t.instant===!0,partial:t.partial===!0,onChange:e=>D(e??""),onCancel:u,boxStyle:{fontSize:"0.875rem",padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):(0,i.jsx)("input",{autoFocus:!0,type:t.type==="number"&&!t.duration&&!c?"number":t.type==="text"&&t.holds==="phone"?"tel":"text",...c?{inputMode:"decimal","data-graview-amount":c.format??"unit"}:{},name:o.name,"aria-label":m.label,placeholder:K?`${m.label}, separated by commas`:c?`${m.label}, ${S(c).hint} \u2014 ${S(c).prefix??""}${S(c).placeholder}${S(c).suffix?` ${S(c).suffix}`:""}`:m.label,value:p,...t.type==="number"&&t.min!==void 0?{min:t.min}:{},...t.type==="number"&&t.max!==void 0?{max:t.max}:{},...t.type==="number"&&t.step!==void 0?{step:t.step}:{},onChange:e=>D(e.target.value),onKeyDown:e=>{e.key==="Escape"&&u()},style:{flex:1,minWidth:0,font:"inherit",fontSize:"0.875rem",padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}),(0,i.jsx)("button",{type:"submit",disabled:!K&&p.trim().length===0,style:{fontSize:"0.8125rem"},children:A.length>1?"Next":"Apply"}),O]})]})}var G=[];function De(n,a,u){let w=n?.derived?.act==="edit"&&n.subject?u[n.subject.arg]:void 0,y=typeof w=="string"?a.graph.getNode(w):void 0;return y?Object.fromEntries((n.writes??[]).filter(s=>y[s]!==void 0&&y[s]!==null).map(s=>[s,y[s]])):{}}function ke(n,a){return typeof n=="number"?a?.type==="number"&&a.amount?fe(n,a.amount):String(n):Array.isArray(n)?n.every(u=>typeof u=="string")?n.join(", "):"":typeof n!="string"?"":n}var z=10;function Ee(n,a){return n.candidates&&n.candidates.length>0?n.candidates:a.type==="choice"?a.options:a.type==="several"&&a.of.type==="choice"?a.of.options:a.type==="boolean"?$e:[]}var $e=["yes","no"];function Ce(n,a,u){return a.type==="boolean"||a.type==="choice"||a.type==="several"&&a.of.type==="choice"?u:ze(n,u)}function ze(n,a){let u=ae(a);if(u){let s=de(n.schema,n.graph.getNode(u.from)?.kind??"",u.kind,"out");return s.charAt(0).toUpperCase()+s.slice(1)}let w=ie(a);if(w.length>0)return w.map(s=>n.schema.tryDefinition(s)?.plural??`${s}s`).join(" + ");let y=n.graph.getNode(a);return y?ee(n.schema.tryDefinition(y.kind),y):a}export{qe as a,ze as b};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{b as te}from"./chunk.
|
|
1
|
+
import{b as te}from"./chunk.7IXTNST2.js";import"./chunk.RQX4CQJN.js";import"./chunk.LUIRQ5UF.js";import{c as ne}from"./chunk.N33WUCAN.js";import{G as ge,T as ee}from"./chunk.DBMZ3AQB.js";import"./chunk.SDO3U72B.js";import{Tc as q,ga as X,ia as Z}from"./chunk.DIFR37EZ.js";import"./chunk.FQLNBIQ5.js";import{b as T}from"./chunk.AJZBJBMO.js";var M=T(ge(),1);var ye=6;function re($,S,m,x,E){let t=new Set($),o=new Map;for(let i of S)for(let[h,l,b]of[[i.from,i.to,"out"],[i.to,i.from,"in"]]){if(!t.has(h)||t.has(l))continue;let f=m(l);if(f===void 0)continue;let p=`${h}|${i.kind}|${b}|${f}`,v=o.get(p);v?v.others.includes(l)||v.others.push(l):o.set(p,{self:h,edge:i.kind,direction:b,kind:f,others:[l]})}let d=[];for(let i of o.values()){let h=m(i.self)??"",l=ne(E,i.direction==="out"?h:i.kind,i.edge,i.direction);if(i.others.length>ye){d.push({...i,others:i.others,lands:"district",words:l});continue}let b=[],f=[];for(let p of i.others)(x(p)?b:f).push(p);for(let p of b)d.push({...i,others:[p],lands:"record",words:l});f.length>0&&d.push({...i,others:f,lands:"district",words:l})}return d}function ie($,S=[]){let m=[...S],x=new Map,E=t=>m.some(o=>t.x<o.x+o.width&&o.x<t.x+t.width&&t.y<o.y+o.height&&o.y<t.y+t.height);for(let t of[...$].sort((o,d)=>o.y-d.y||o.x-d.x)){let o={x:t.x-t.width/2,y:t.y-t.height,width:t.width,height:t.height};for(let d=0;d<12&&E(o);d++)o.y+=t.height+2;m.push(o),x.set(t.key,{x:o.x,y:o.y})}return x}var s=T(ee(),1),he=4;function xe({frame:$,width:S,height:m,stageRef:x,tick:E,store:t,graphVersion:o,selection:d,view:i,rulers:{visibleRect:h,clipQuadratic:l,unsureOf:b,unsureDash:f,unsureOpacity:p}}){let v=n=>t.graph.getNode(n)?.kind,C=te(d,i,v),R=C.lens===null&&C.records.length<=he?C.records:[],oe=R.join(`
|
|
2
2
|
`),[y,K]=(0,M.useState)(null);(0,M.useLayoutEffect)(()=>{let n=x.current;if(!i.overview||R.length===0||!n||typeof document>"u"||$.t<1){K(null);return}let w=n.getBoundingClientRect(),B=e=>({x:e.left-w.left,y:e.top-w.top,width:e.width,height:e.height}),D=new Map,se=R.map(e=>`[data-graview-view="${CSS.escape(e)}"]`).join(","),k=null,H=()=>{if(k)return k;k={drawn:new Map,buildings:new Map};for(let e of n.querySelectorAll("[data-graview-pick], [data-graview-view], [data-graview-building]")){let r=e.getAttribute("data-graview-pick"),a=e.getAttribute("data-graview-view");for(let c of r!==null&&r===a?[r]:[r,a]){if(c===null)continue;let u=k.drawn.get(c);u?u.push(e):k.drawn.set(c,[e])}let L=e.getAttribute("data-graview-building");L!==null&&!k.buildings.has(L)&&k.buildings.set(L,e)}return k},P=e=>{if(D.has(e))return D.get(e);let r=null;for(let a of H().drawn.get(e)??[])if(!a.closest("[data-graview-offstage], [data-graview-screen]")&&!(!R.includes(e)&&a.closest(se))&&(r=h(a,n),r))break;if(!r){let a=H().buildings.get(e);a&&(r=B(a.getBoundingClientRect()))}return D.set(e,r),r},W=e=>{let r=n.querySelector(`[data-graview-plot="kind:${CSS.escape(e)}"] .graview-plot-tile`);return r?B(r.getBoundingClientRect()):null},de=re(R,t.graph.allEdges(),v,e=>P(e)!==null,t.schema),z=[];for(let e of n.querySelectorAll('[data-graview-view^="kind:"] .graview-kind-face')){let r=h(e,n);r&&z.push(r)}let Q=e=>({x:e.x+e.width/2,y:e.y+e.height/2}),O=[],V=new Set(R),I=new Set;for(let e of de){let r=v(e.self),a=P(e.self)??(r?W(r):null),L=e.lands==="record"?P(e.others[0]):W(e.kind);if(!a||!L)continue;for(let g of e.others)V.add(g);I.add(e.kind),r&&I.add(r);let c=Q(a),u=Q(L),A=Math.hypot(u.x-c.x,u.y-c.y);if(A<6)continue;let G=Math.min(40,A*.12)*(O.length%2===0?1:-1),le={x:(c.x+u.x)/2-(u.y-c.y)/A*G,y:(c.y+u.y)/2+(u.x-c.x)/A*G},J=l({p0:c,c:le,p1:u},z);if(J.length===0)continue;let ce=J.map(g=>`M ${g.p0.x.toFixed(1)} ${g.p0.y.toFixed(1)} Q ${g.c.x.toFixed(1)} ${g.c.y.toFixed(1)} ${g.p1.x.toFixed(1)} ${g.p1.y.toFixed(1)}`).join(" "),ue=g=>{let j=t.graph.getNode(g);return j?X(t.schema.tryDefinition(j.kind),j):g},U=e.lands==="record"?`${e.words}: ${ue(e.others[0])}`:`${e.words}: ${Z(t.schema,e.kind,e.others.length)}`,F=e.others[0],_=e.lands==="record"?b?.(e.edge,e.direction==="out"?e.self:F,e.direction==="out"?F:e.self):void 0;O.push({key:`${e.self}|${e.edge}|${e.direction}|${e.lands}|${F}`,link:e,d:ce,end:u,said:_!==void 0?`${U} \xB7 unsure`:U,..._!==void 0?{unsure:_}:{}})}let Y=[];for(let e of n.querySelectorAll(".graview-kind-face[data-graview-nameplate]")){let r=h(e,n);r&&Y.push(r)}let ae=ie(O.map(e=>({key:e.key,x:e.end.x,y:e.end.y-6,width:Math.min(260,14+e.said.length*6.6),height:20})),Y);K({lines:O,labels:ae,reached:[...V],districts:[...I]})},[oe,i.overview,$,o,E,S,m,x,t]);let N=(0,M.useMemo)(()=>{if(!y)return"";let n=y.reached.map(B=>`[data-graview-building="${CSS.escape(B)}"]`).join(","),w=y.districts.map(B=>`[data-graview-plot="kind:${CSS.escape(B)}"]`).join(",");return[".graview-ground[data-graview-altitude] .graview-building { opacity: 0.22; }",n?`.graview-ground[data-graview-altitude] .graview-building:is(${n}) { opacity: 1; }`:"",w?`.graview-ground[data-graview-altitude] .graview-plot:not(:is(${w})) .graview-plot-tile { opacity: 0.4; }`:""].join(`
|
|
3
3
|
`)},[y]);return!y||y.lines.length===0?N?(0,s.jsx)("style",{children:N}):null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("style",{children:N}),(0,s.jsx)("svg",{className:"graview-record-links","data-graview-world":"","data-graview-record-links":y.lines.length,"aria-hidden":"true",width:S,height:m,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:q.lines},children:y.lines.map(n=>(0,s.jsxs)("g",{className:"graview-record-link","data-graview-link":n.link.edge,"data-graview-lands":n.link.lands,"data-graview-direction":n.link.direction,"data-graview-provisional":n.unsure!==void 0||void 0,children:[(0,s.jsx)("path",{className:"graview-record-link-line",d:n.d,...n.unsure!==void 0?{strokeDasharray:f,strokeOpacity:p}:{}}),n.link.lands==="record"?(0,s.jsx)("circle",{className:"graview-record-link-end",cx:n.end.x,cy:n.end.y,r:3}):null]},n.key))}),(0,s.jsx)("div",{"aria-hidden":"true","data-graview-world":"",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:q.tieLabels},children:y.lines.map(n=>{let w=y.labels.get(n.key);return w?(0,s.jsx)("span",{className:"graview-record-link-said","data-graview-link-said":n.link.edge,"data-graview-lands":n.link.lands,...n.unsure!==void 0?{title:n.unsure}:{},style:{position:"absolute",left:w.x,top:w.y,...n.unsure!==void 0?{pointerEvents:"auto"}:{}},children:n.said},n.key):null})})]})}export{xe as RecordLinks};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Ee,b as Le,c as Ve,d as ue,e as R,f as me,h as Be}from"./chunk.IV7AUO53.js";import{h as Ze,i as We,j as Ye}from"./chunk.V6FUYRZI.js";import{a as ie,b as re,c as H,d as Ue,e as J,g as te,h as He}from"./chunk.BZEJM2PY.js";import{c as Ne,h as y,i as qe,j as fe}from"./chunk.CMLNBJZG.js";import{A as De,Ca as Ke,Db as hn,Ja as Me,Ka as ne,La as de,Ub as Pe,Vb as pe,Wb as Te,Xb as Ge,Yb as Ce,b as W,c as B,e as le,f as Re,g as P,h as j,k as I,l as Q,m as T,n as Fe,nc as _e,o as U,oc as Ie,p as K,r as $,s as ee,t as x,u as A,v as q,w as G,x as n,y as M,z as Y}from"./chunk.DIFR37EZ.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var ge=e=>Object.entries(e).map(([s,i])=>[s,Object.keys(ne(i?.edges))]),ze=(e,s)=>Te(e,ge(s));function Je(e){return[...Object.keys(e.acts??{}),...Object.keys(e.kinds).flatMap(s=>Pe(s)),...Ge(ge(e.kinds))]}var L=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Xe(e){if(!L(e)||!L(e.kinds))return e;let s;try{let f=Object.fromEntries(Object.entries(e.kinds).map(([z,r])=>[z,L(r)&&L(r.edges)?{edges:r.edges}:{}]));s=Je({acts:L(e.acts)?e.acts:{},kinds:f})}catch{return e}let i=new Set(s),t=!1,a=f=>{if(typeof f!="string"||i.has(f))return f;let z=_e(f,s);return z===void 0?f:(t=!0,z)},l=L(e.policy)&&Array.isArray(e.policy.grants)?{...e.policy,grants:e.policy.grants.map(f=>L(f)&&Array.isArray(f.mutations)?{...f,mutations:f.mutations.map(a)}:f)}:void 0,u=L(e.rules)?Object.fromEntries(Object.entries(e.rules).map(([f,z])=>[f,L(z)&&Array.isArray(z.repairs)?{...z,repairs:z.repairs.map(r=>L(r)?{...r,act:a(r.act)}:r)}:z])):void 0;return t?{...e,...l?{policy:l}:{},...u?{rules:u}:{}}:e}function ye(e,s){let i=Ie(e,Je(s));return i&&i!==e?`did you mean "${i}"?`:void 0}var ke="graview-document",$e=1,we=256*1024,oe=64*1024,he=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,be=/^[a-z][A-Za-z0-9]*$/,bn=/^[a-z0-9\u00df-\u00ff'-]+( [a-z0-9\u00df-\u00ff'-]+){0,2}$/,Qe=12,kn=new Set(["id","kind"]),$n=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,wn=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"];function Sn(){let e=k=>k in Object.prototype,s=Y(k=>!e(k),"every object already has this name \u2014 choose another"),i=(k,N)=>[...k===void 0?[]:[Re(k)],...N===void 0?[]:[le(N)]],t=(k,N)=>j().check(...i(k,N)),a=(k,N,X)=>K(k).check(...i(N,X)),l=k=>j().check(P(he,`${k} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),u=j().check(P($n,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),s),f=j().check(P(be,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),Y(k=>!kn.has(k),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),s),z=t(1,500),r=j().check(le(40),P(bn,'an alias is up to three lower-case words, like "supplier"')),o=t(1,2e3),d=t(1,300),w=$({type:q(wn),required:n(T()),description:n(z),label:n(t(1,60)),aliases:n(a(r,1,Qe)),options:n(a(t(1,80),1,100)),optionLabels:n(A(t(1,80),t(1,80))),of:n(q(["string","number","date","image","video","file"])),default:n(U()),unit:n(t(void 0,12)),format:n(q(["money","percent","duration","markdown"])),min:n(I()),max:n(I()),step:n(I()),renamedFrom:n(j().check(P(be))),repeats:n(T()),collaborative:n(T())}).check(De((k,N)=>{k.type==="enum"&&!k.options&&N.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),k.type!=="enum"&&k.options&&N.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]});for(let X of Object.keys(k.optionLabels??{}))k.options?.includes(X)||N.addIssue({code:"custom",message:`"${X}" is labeled, and is none of the field's options`,path:["optionLabels",X]});k.type!=="list"&&k.of&&N.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),k.repeats&&k.type!=="date"&&k.type!=="datetime"&&N.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),m=j().check(P(new RegExp(`${he.source}|${Ke.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),p=$({to:x([a(m,1),G("*")]),cardinality:n(q(["one","many"])),description:n(z),inverse:n(t(1,80)),appendOnly:n(T()),renamedFrom:n(j()),tidying:n(G("never"))}),c=x([o,$({expr:o,label:n(t(1,60)),description:n(z),format:n(q(["money","percent","duration"])),unit:n(t(1,12)),hidden:n(T())})]),O=$({noun:n(t(1,40)),plural:n(t(1,40)),aliases:n(a(r,1,Qe)),description:n(z),fields:A(f,w).check(Y(k=>Object.keys(k).length>0,"a kind has at least one field")),label:n(d),describe:n(d),lifecycle:n($({field:f,retired:a(x([j(),I(),T()]),1)})),figure:n(t(void 0,2e4)),glance:n(a(f,1,20)),page:n($({fields:n(a(f,1,40)),groups:n(a($({title:t(1,60),fields:a(f,1,40)}),1,12))})),edges:n(A(u,p)),computed:n(A(j(),c).check(Y(k=>Object.keys(k).length<=20,"a kind works out at most 20 computed fields"))),fieldRoles:n(A(j(),j())),renamedFrom:n(j().check(P(he))),people:n(T()),archives:n(G(!1)),tidying:n(q(["never","no-links"]))}),h=x([j(),I(),T(),Fe(),K(U()),$({expr:o})]),S=j().check(P(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),E=x([$({create:l("kind"),as:n(j().check(P(be))),set:n(A(f,h))}),$({set:A(f,h),target:n(S)}),$({connect:u,from:S,to:S}),$({sever:u,from:S,to:S}),$({remove:S})]),b=$({title:n(t(1,80)),description:n(z),fromTheOtherEnd:n(t(1,80)),on:n(x([l("kind"),a(l("kind"),1)])),creates:n(l("kind")),sets:n(A(f,h)),writes:n(a(f,1)),connects:n(u),severs:n(u),setsOther:n(A(f,h)),replaces:n(x([G(!0),a(u,1,10)])),removes:n(G(!0)),args:n(A(f,w)),effects:n(a(E,1,20)),allowedWhen:n(o),refusal:n(d),destructive:n(T())}),_=$({act:l("act"),label:n(t(1,80)),args:n(A(j(),h))}),F=$({title:n(t(1,120)),description:n(z),over:x([G("graph"),l("kind")]),when:n(o),require:o,says:n(d),repairs:n(a(_,void 0,10))}),g=$({roles:x([a(l("role"),1),G("*")]),mutations:x([a(l("act"),1),G("*")]),kinds:n(x([K(l("kind")),G("*")])),describe:n(z),self:n(T()),ownEnd:n(T())}),v=n(a(l("field"),1)),D=$({roles:x([a(l("role"),1),G("*")]),kinds:a(l("kind"),1),own:n(T()),via:n(u),fields:v,hide:v}),se=$({grants:K(g),sees:n(K(D))}),Z=$({accent:n(j().check(P(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),ground:n(x([j().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"')),$({light:n(j().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"'))),dark:n(j().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#101826"')))})])),name:n(t(1,60)),currency:n(j().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(x([t(1,oe),$({src:t(1,oe),alt:n(t(1,120))}),$({light:t(1,oe),dark:n(t(1,oe)),alt:n(t(1,120)),darkFallback:n(G("invert"))})])),favicon:n(x([t(1,oe),$({emoji:j()})])),typography:n($({display:n(t(1,200)),body:n(t(1,200)),mono:n(t(1,200))})),shape:n($({radius:n(I().check(B(0),W(32))),density:n(I().check(B(.75),W(1.5)))})),accents:n(A(j(),I().check(B(0),W(360)))),scheme:n(q(["light","dark","auto"])),subtitle:n(G(!1))}),V=A(j(),U()),ve=x([t(1,120),$({by:t(1,120),direction:n(q(["asc","desc"]))})]),xe=I().check(Q(),B(1),W(9999)),fn=ee({create:n(T()),options:n(ee({sort:n(ve),columnSort:n(ve),search:n(a(t(1,120),void 0,40)),filters:n(a(t(1,120),void 0,40)),horizon:n(x([I().check(Q(),B(1),W(200)),ee({years:I().check(Q(),B(1),W(200)),title:t(1,80),from:n(xe),to:n(xe)})]))}))}),un=$({card:n(K(U())),row:n(K(U())),page:n(K(U()))}),mn=()=>{let k=n(q(["asc","desc"]));return x([t(1,120),$({by:t(1,120),direction:k,then:n(x([t(1,120),$({by:t(1,120),direction:k})]))})])},gn=()=>x([t(1,120),$({by:t(1,120),order:n(a(t(1,80),void 0,40)),closed:n(a(t(1,80),void 0,40))})]),Ae=ee({order:n(K(j())),hide:n(K(j())),first:n(j()),primary:n(a(t(1,80),void 0,40)),scene:n(t(1,40)),pages:n(t(1,40)),lists:n(A(j(),$({filters:n(a(t(1,120),void 0,40)),sort:n(mn()),group:n(gn()),export:n(T())})))}),zn=$({act:l("act"),title:n(t(1,80)),intro:n(z),fields:n(a(f,1,40)),say:n(z),submit:n(t(1,80)),role:n(l("role"))}),yn=$({$schema:n(j()),format:G(ke),formatVersion:G($e),name:t(1,80),description:n(z),version:n(I().check(Q(),B(1))),kinds:A(l("kind"),O).check(Y(k=>Object.keys(k).length>0,"a document declares at least one kind"),Y(k=>Object.keys(k).length<=40,"a document declares at most 40 kinds")),computed:n(A(j(),c)),acts:n(A(l("act"),b)),rules:n(A(l("rule"),F)),roles:n(K(l("role"))),policy:n(se),modules:n(V),lenses:n(K(fn)),pages:n(Ae),views:n(A(j(),x([un,K(U())]))),brand:n(Z),settings:n(K(V)),migrations:n(K(V)),connections:n(A(l("connection"),V)),purpose:n(V),forms:n(A(l("form"),zn)),publishing:n($({mode:q(["live","on-publish"]),working:a(l("role"),void 0,40),publishers:n(a(l("role"),1,40))}))});return{FieldSpec:w,EdgeSpec:p,ComputedSpec:c,KindSpec:O,ValueSpec:h,EffectSpec:E,ActSpec:b,RepairSpec:_,RuleSpec:F,GrantSpec:g,SightSpec:D,PolicySpec:se,BrandSpec:Z,PagesSpec:Ae,DocumentSpec:yn}}var jn,C=()=>jn??=Sn(),Ln=M(()=>C().FieldSpec),Vn=M(()=>C().EdgeSpec),Bn=M(()=>C().ComputedSpec),Un=M(()=>C().KindSpec),Zn=M(()=>C().ValueSpec),Wn=M(()=>C().EffectSpec),Yn=M(()=>C().ActSpec),Hn=M(()=>C().RepairSpec),Jn=M(()=>C().RuleSpec),Xn=M(()=>C().GrantSpec),Qn=M(()=>C().SightSpec),et=M(()=>C().PolicySpec),nt=M(()=>C().BrandSpec),tt=M(()=>C().PagesSpec),en=M(()=>C().DocumentSpec);var On={};function nn(e,s=On,i=$e){let{document:t,respelled:a}=Ee(e),l=a.length>0?{respelled:a}:{};if(!t||typeof t!="object"||Array.isArray(t))return{document:t};let u=t;if(u.format!==ke||typeof u.formatVersion!="number"||u.formatVersion>=i)return{document:t,...l};let f=u.formatVersion,z=structuredClone(u);for(let r=f;r<i;r++){let o=s[r];if(!o)throw new Error(`there is no upgrade from format ${r} to ${r+1}`);z={...o(z),formatVersion:r+1}}return{document:z,from:f,...l}}function tn(e,s,i){let t=Object.keys(e).filter(f=>e[f].edges?.[s]!==void 0);if(t.length===0)return;let a=t.map(f=>e[f].edges[s].to),l=a.some(f=>f==="*")?"*":[...new Set(a.flatMap(f=>f))];if(i.length===0||i.some(f=>t.includes(f)))return{reversed:!1,kinds:l};let u=t.filter(f=>{let z=e[f].edges[s].to;return z==="*"||i.every(r=>z.includes(r))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:l}}var rn=(e,s)=>{let i=e?.fields[s];return i!==void 0&&(i.type==="duration"||(i.type==="number"||i.type==="integer")&&i.format==="duration")};function on(e,s,i,t){if(t==="out"){let a=e[s]?.edges?.[i]?.to;return a===void 0?[]:a==="*"?Object.keys(e):a}return Object.entries(e).filter(([,a])=>{let l=a.edges?.[i]?.to;return l!==void 0&&(l==="*"||l.includes(s))}).map(([a])=>a)}function Se(e,s,i){if(i.t==="ident")return e[s]?.edges?.[i.name]?on(e,s,i.name,"out"):void 0;if(i.t==="where")return Se(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 on(e,s,i.args[0].value,i.fn)}var sn=(e,s,i)=>{let t=s.filter(a=>e[a]?.fields[i]!==void 0);return t.length>0&&t.every(a=>rn(e[a],i))};function an(e,s,i){let t=e.kinds,a=t[s],l=new Map(i),u=new Map,f=(r,o)=>{if(o>8)return!1;switch(r.t){case"ident":return rn(a,r.name)||z(r.name,o+1);case"member":{let d=Se(t,s,r.object);return d!==void 0&&sn(t,d,r.name)}case"call":{if(r.fn!=="sum"&&r.fn!=="min"&&r.fn!=="max")return!1;let[d,w]=r.args,m=d&&Se(t,s,d);return m!==void 0&&w?.t==="ident"&&sn(t,m,w.name)}case"binary":return(r.op==="+"||r.op==="-")&&f(r.left,o)&&f(r.right,o);case"unary":return r.op==="-"&&f(r.operand,o);default:return!1}},z=(r,o)=>{if(a?.computed?.[r]===void 0)return!1;if(u.has(r))return u.get(r);u.set(r,!1);let d=l.get(r),w=d!==void 0&&f(d,o);return u.set(r,w),w};return i.map(([r])=>r).filter(r=>z(r,0))}function cn(e,s,i=`kinds.${e}.page`){let t=s.page;if(!t)return[];let a=[],l=[...Object.keys(s.fields),...Object.keys(s.computed??{})],u=new Set,f=(r,o)=>{l.includes(r)?u.has(r)&&a.push(y("page-field-twice",o,`"${r}" is on ${e}'s page twice; name each field once`)):a.push(y("page-field",o,`${e}'s page is to show "${r}", and ${e} has no field or computed field called that`,`use one of: ${l.join(", ")}`)),u.add(r)};(t.fields??[]).forEach((r,o)=>f(r,`${i}.fields.${o}`));let z=new Set;return(t.groups??[]).forEach((r,o)=>{let d=r.title.trim().toLowerCase();z.has(d)&&a.push(y("page-group-twice",`${i}.groups.${o}.title`,`${e}'s page has two groups called "${r.title}"; give each its own title`)),z.add(d),r.fields.forEach((w,m)=>f(w,`${i}.groups.${o}.fields.${m}`))}),a}function ln(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 vn=new Set(["subject","now","today","me"]);function xn(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>we)return{findings:[y("too-large","",`a document may be at most ${we/1024} KB`)]};if(typeof e=="string")try{e=JSON.parse(e)}catch(t){return{findings:[y("not-json","",`this is not JSON: ${t.message}`)]}}try{e=nn(e).document}catch(t){return{findings:[y("format","formatVersion",t.message)]}}e=Xe(e);let s=en.safeParse(e);if(!s.success)return{findings:s.error.issues.map(t=>{let a=t.path.map(String).join(".");if(t.code==="unrecognized_keys")return y("unknown-key",a,`${t.keys.map(l=>`"${l}"`).join(", ")} ${t.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(t.code==="invalid_union"&&/\.effects\.\d+$/.test(a))return y("effect-shape",a,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(t.code==="invalid_key"){let l=t.issues?.[0]?.message;return y("shape",a,`the name "${String(t.path.at(-1))}" is not allowed here${l?`: ${l}`:""}`)}return y("shape",a,t.message)})};let i=s.data;return{document:i,findings:An(i)}}var ce=e=>[e??[]].flat();function dn(e){let s=new Map;for(let[i,t]of Object.entries(e.kinds))for(let[a,l]of Object.entries(ne(t.edges))){let u=s.get(a);s.set(a,{name:a,from:[...u?.from??[],i],to:l.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...l.to])],cardinality:l.cardinality??"many"})}return s}function Ft(e){let s=new Map;for(let[t,a]of Object.entries(e.kinds)){let l=te(a),u=de(a.edges);s.set(t,{fields:new Set([...Object.keys(a.fields),...u.keys()]),edges:new Map(Object.entries(ne(a.edges)).map(([f,z])=>[f,z.cardinality??"many"])),...l?{computed:l}:{},...u.size>0?{linked:u}:{}})}let i=te(e);return i&&s.set(Ne,{computed:i}),s}function pn(e,s){let i=[],t=ce(e.on),a=(l,u)=>{let f=tn(s.kinds,l,t)?.reversed===!0,[z,r]=f?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:l,from:z,to:r}:{sever:l,from:z,to:r}};if(e.creates){let l=s.kinds[e.creates],u={};for(let f of Object.keys(l?.fields??{}))u[f]=`$${f}`;for(let f of e.effects??[])"set"in f&&!("create"in f)&&R(f.target)==="new"&&Object.assign(u,f.set);i.push({create:e.creates,as:"new",set:u})}return e.sets&&i.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&i.push({set:Object.fromEntries(e.writes.map(l=>[l,`$${l}`]))}),e.connects&&(e.replaces&&i.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),i.push(a(e.connects,"connect"))),e.severs&&i.push(a(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&i.push({set:e.setsOther,target:"$to"}),e.removes&&i.push({remove:"$subject"}),e.effects&&i.push(...e.effects.filter(l=>!(e.creates&&"set"in l&&!("create"in l)&&R(l.target)==="new"))),i}function je(e,s,i){try{let t=H(e),a=ie(t);for(let l of a.unknownFunctions)i.push(y("unknown-function",s,`"${l}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));return t}catch(t){if(t instanceof re){i.push(y("expression",s,t.sentence+` (at character ${t.at+1})`));return}throw t}}function Oe(e,s,i){try{return J(e)}catch(t){if(t instanceof Ue||t instanceof re){i.push(y("template",s,(t instanceof re,t.sentence)));return}throw t}}function An(e){let s=[],i=new Set(Object.keys(e.kinds)),t=dn(e),a=e.acts??{},l=new Set(e.roles??[]),u=(r,o)=>de(e.kinds[r]?.edges).has(o),f=r=>Object.keys(e.kinds).some(o=>u(o,r));for(let[r,o]of Object.entries(e.kinds)){let d=`kinds.${r}`;for(let[m,p]of Object.entries(o.edges??{})){if(!Me(p)&&p.to!=="*")for(let c of p.to)i.has(c)||s.push(y("edge-target",`${d}.edges.${m}.to`,`"${c}" is not a kind this document declares`));o.fields[m]&&s.push(y("edge-field-clash",`${d}.edges.${m}`,`"${m}" is both a field and a relation of ${r}`,"rename one of them"))}o.lifecycle&&!o.fields[o.lifecycle.field]&&s.push(y("lifecycle-field",`${d}.lifecycle.field`,`${r} has no field "${o.lifecycle.field}"`));let w=m=>o.computed!==void 0&&Object.hasOwn(o.computed,m);for(let m of o.glance??[])!o.fields[m]&&!w(m)&&s.push(y("glance-field",`${d}.glance`,`a glance at ${r} is to say "${m}", and ${r} has no field or computed field called that`,`use one of: ${[...Object.keys(o.fields),...Object.keys(o.computed??{})].join(", ")}`));s.push(...cn(r,o));for(let m of["label","describe"]){let p=o[m];if(!p)continue;let c=Oe(p,`${d}.${m}`,s);for(let O of c??[])if(O.expr){for(let h of ie(O.expr).names)if(!o.fields[h]){if(w(h)){He(o,h)||s.push(y("template-field",`${d}.${m}`,`${r}'s ${h} 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 ${r}'s own fields`));continue}s.push(y("template-field",`${d}.${m}`,`${r} has no field "${h}" for its ${m} to show`,m==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[m,p]of Object.entries(o.fields)){p.default!==void 0&&p.type==="enum"&&!p.options?.includes(String(p.default))&&s.push(y("default-option",`${d}.fields.${m}.default`,`"${String(p.default)}" is not one of ${m}'s options`));let c=`${m}Repeat`;p.repeats&&(o.fields[c]||o.edges?.[c]||o.computed?.[c])&&s.push(y("repeat-clash",`${d}.fields.${m}.repeats`,`${r} already has "${c}", where how ${m} repeats is kept`))}}for(let[r,o]of Object.entries(a)){let d=`acts.${r}`;for(let c of ce(o.on))i.has(c)||s.push(y("act-kind",`${d}.on`,`"${c}" is not a kind this document declares`));let w=ce(o.on),m=pn(o,e);if(o.creates&&o.on===void 0&&o.writes&&i.has(o.creates)){for(let c of o.writes)if(!e.kinds[o.creates].fields[c])if(e.kinds[o.creates].computed?.[c]!==void 0)s.push(y("computed-written",`${d}.writes`,`${o.creates}'s ${c} is worked out, not written: no act can set it`,"write the stored fields it is worked out from"));else{if(u(o.creates,c))continue;s.push(y("act-field",`${d}.writes`,`${o.creates} has no field "${c}"`))}}m.length===0&&s.push(y("act-empty",d,`"${r}" does nothing`,"give it effects or a shorthand such as sets or creates"));let p=new Map;m.forEach((c,O)=>{let h=m.length-(o.effects?.length??0),S=o.effects&&O>=h?`${d}.effects.${O-h}`:d;if("create"in c){if(!i.has(c.create))s.push(y("act-kind",`${S}.create`,`"${c.create}" is not a kind this document declares`));else for(let b of Object.keys(c.set??{}))e.kinds[c.create].fields[b]||(e.kinds[c.create].computed?.[b]!==void 0?s.push(y("computed-written",`${S}.set.${b}`,`${c.create}'s ${b} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):s.push(y("act-field",`${S}.set.${b}`,`${c.create} has no field "${b}"`)));c.as&&p.set(c.as,c.create)}else if("connect"in c||"sever"in c){let b="connect"in c?c.connect:c.sever;!t.has(b)&&!f(b)&&s.push(y("act-edge",`${S}.${"connect"in c?"connect":"sever"}`,`"${b}" is not a relation any kind declares`)),R(c.from)==="subject"&&w.length===0&&s.push(y("act-subject",`${d}.on`,`"${r}" acts on "$subject" but does not say which kinds it is "on"`))}else if("set"in c){let b=R(c.target??"$subject"),_=b==="subject"?w:p.has(b??"")?[p.get(b)]:[];b==="subject"&&w.length===0&&s.push(y("act-subject",`${d}.on`,`"${r}" changes "$subject" but does not say which kinds it is "on"`));for(let F of Object.keys(c.set))for(let g of _)if(!(!i.has(g)||e.kinds[g].fields[F]))if(e.kinds[g].computed?.[F]!==void 0)s.push(y("computed-written",`${S}.set.${F}`,`${g}'s ${F} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(g,F))continue;s.push(y("act-field",`${S}.set.${F}`,`${g} has no field "${F}"`))}}else"remove"in c&&R(c.remove)==="subject"&&w.length===0&&s.push(y("act-subject",`${d}.on`,`"${r}" removes "$subject" but does not say which kinds it is "on"`));("set"in c&&c.set?Object.values(c.set):[]).forEach(b=>{b&&typeof b=="object"&&!Array.isArray(b)&&"expr"in b&&je(b.expr,`${S}.set`,s)})}),o.allowedWhen&&je(o.allowedWhen,`${d}.allowedWhen`,s),o.refusal&&Oe(o.refusal,`${d}.refusal`,s)}for(let[r,o]of Object.entries(e.rules??{})){let d=`rules.${r}`;o.over!=="graph"&&!i.has(o.over)&&s.push(y("rule-kind",`${d}.over`,`"${o.over}" is not a kind this document declares`));let w=o.over==="graph"?void 0:e.kinds[o.over];for(let m of["when","require"]){let p=o[m];if(!p)continue;let c=je(p,`${d}.${m}`,s);if(!c)continue;let O=ie(c);for(let h of O.names)if(o.over==="graph")s.push(y("rule-name",`${d}.${m}`,`"${h}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(w&&!w.fields[h]&&!w.edges?.[h]&&w.computed?.[h]===void 0){let S=Object.keys(w.edges??{}).find(E=>E.includes("-")&&E.split("-").includes(h));s.push(y("rule-name",`${d}.${m}`,`${o.over} has no field or relation called "${h}"`,S?`"${S}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${S.replace(/-([a-z0-9])/g,(E,b)=>b.toUpperCase())}"`:void 0))}for(let h of O.edges)!t.has(h)&&!f(h)&&s.push(y("rule-edge",`${d}.${m}`,`"${h}" is not a relation any kind declares`));for(let h of O.sweeps)i.has(h)?o.over!=="graph"&&s.push(qe("rule-cost",`${d}.${m}`,`this rule looks at every ${h} for every ${o.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):s.push(y("rule-kind",`${d}.${m}`,`"${h}" is not a kind this document declares`))}o.says&&Oe(o.says,`${d}.says`,s),(o.repairs??[]).forEach((m,p)=>{!a[m.act]&&!pe(m.act)&&!ze(m.act,e.kinds)&&s.push(y("repair-act",`${d}.repairs.${p}.act`,`"${m.act}" is not an act this document declares`,ye(m.act,e)))})}let z=e.policy;return z&&(z.grants.forEach((r,o)=>{if(r.roles!=="*"&&l.size>0)for(let d of r.roles)l.has(d)||s.push(y("grant-role",`policy.grants.${o}.roles`,`"${d}" is not one of the document's roles`));if(r.mutations!=="*")for(let d of r.mutations)!a[d]&&!pe(d)&&!ze(d,e.kinds)&&s.push(y("grant-act",`policy.grants.${o}.mutations`,`"${d}" is not an act this document declares`,ye(d,e)))}),(z.sees??[]).forEach((r,o)=>{for(let d of r.kinds)i.has(d)||s.push(y("sight-kind",`policy.sees.${o}.kinds`,`"${d}" is not a kind this document declares`));if(r.roles!=="*"&&l.size>0)for(let d of r.roles)l.has(d)||s.push(y("sight-role",`policy.sees.${o}.roles`,`"${d}" is not one of the document's roles`))})),s.push(...Ye(e)),s}function En(e){return e.label?[...e.label.matchAll(/\{\s*([A-Za-z_][A-Za-z0-9_]*)/g)].map(s=>s[1]):[me(e)??[]].flat()}function Rn(e,s,i,t){let a=new Map,l=ce(e.on),u=new Map,f=new Map;(l.length>0||s.some(p=>"remove"in p&&R(p.remove)==="subject"||"from"in p&&(R(p.from)==="subject"||R(p.to)==="subject")||"set"in p&&!("create"in p)&&R(p.target??"$subject")==="subject"))&&a.set(ue,{ref:l.length>0?l:"*",required:!0});let r=e.args??{},o=e.writes?.length===1,d=(p,c)=>c&&p.type===c.type&&p.min===void 0&&p.max===void 0&&p.step===void 0?{...p,...c.min===void 0?{}:{min:c.min},...c.max===void 0?{}:{max:c.max},...c.step===void 0?{}:{step:c.step}}:p,w=(p,c)=>c&&p.type===c.type&&p.format===void 0&&p.unit===void 0?{...d(p,c),...c.format?{format:c.format}:{},...c.unit?{unit:c.unit}:{}}:d(p,c),m=(p,c,O)=>{if(p===ue||vn.has(p)||u.has(p)||a.has(p))return;let h=r[p]?w(r[p],O):void 0;a.set(p,h?{field:h,optional:!h.required,required:!!h.required}:c())};for(let p of s)if("create"in p){let c=i.kinds[p.create],O=c?ln(c,En(c)):[],h=S=>O.includes(S)?O.indexOf(S):O.length;for(let[S,E]of Object.entries(p.set??{}).sort(([b],[_])=>h(b)-h(_))){let b=R(E),_=c?.fields[S];if(b&&_){let F=!!_.required&&_.default===void 0;m(b,()=>({field:_,optional:!F,required:F}),_)}}p.as&&u.set(p.as,p.create)}else if("connect"in p||"sever"in p){let c=t.get("connect"in p?p.connect:p.sever);for(let[O,h]of[["from",p.from],["to",p.to]]){let S=R(h);if(!S)continue;let E=O==="to"?c?.to??"*":c?.from??"*";E!=="*"&&!f.has(S)&&f.set(S,E),m(S,()=>({ref:E,required:!0}))}}else if("set"in p){let c=R(p.target??"$subject"),O=c==="subject"?l[0]:u.get(c??"")??f.get(c??"")?.[0];c&&c!=="subject"&&!u.has(c)&&m(c,()=>({ref:"*",required:!0}));for(let[h,S]of Object.entries(p.set)){let E=R(S);if(!E)continue;let b=O?i.kinds[O]?.fields[h]:void 0;m(E,()=>b?{field:b,optional:!o,required:o}:{any:!0,required:!1},b)}}else if("remove"in p){let c=R(p.remove);c&&m(c,()=>({ref:"*",required:!0}))}for(let[p,c]of Object.entries(r))a.has(p)||a.set(p,{field:c,optional:!c.required,required:!!c.required});return a}function Dt(e,s={}){let i=xn(e);if(!i.document||fe(i.findings))return{ok:!1,findings:i.findings};let t=i.document,a=[...i.findings];s.previous&&a.push(...Dn(t,s.previous));let l=Fn(t,a);return fe(l.findings)?{ok:!1,findings:l.findings}:Be(l,s)}function ae(e,s){return e.map(i=>{let t=!i.format&&i.expr?.t==="ident"?s?.[i.expr.name]?.format:void 0;return t==="money"||t==="percent"?{...i,format:t}:i})}function Fn(e,s){let i=dn(e),t={};for(let[r,o]of Object.entries(e.kinds)){let d=me(o),w=o.label??(d?`{${d}}`:void 0),m=te(o),p=m?an(e,r,[...m]):[];t[r]={...w?{label:ae(J(w),o.fields)}:{},...o.describe?{describe:ae(J(o.describe),o.fields)}:{},...m?{computed:[...m]}:{},...p.length>0?{durations:p}:{}}}let a={};for(let[r,o]of Object.entries(e.acts??{})){let d=pn(o,e),w=Rn(o,d,e,i),m=o.destructive??d.some(g=>"remove"in g||"sever"in g||"replace"in g),p=[...new Set(d.flatMap(g=>"create"in g?[g.create]:[]))],c=[...new Set(d.flatMap(g=>"connect"in g?[g.connect]:[]))],O=[...new Set(d.flatMap(g=>"sever"in g?[g.sever]:"replace"in g?g.replace:[]))],h=[...new Set(d.flatMap(g=>"set"in g&&!("create"in g)&&R(g.target??"$subject")==="subject"?Object.keys(g.set):[]))],S=new Map;for(let g of d){if(!("connect"in g)&&!("sever"in g))continue;let v=i.get("connect"in g?g.connect:g.sever);for(let[D,se]of[["from",g.from],["to",g.to]]){let Z=R(se),V=D==="to"?v?.to:v?.from;Z&&Z!=="subject"&&V&&V!=="*"&&S.set(Z,[...new Set([...S.get(Z)??[],...V])])}}let E={};for(let g of d){if(!("set"in g)||"create"in g)continue;let v=R(g.target??"$subject");for(let D of v&&v!=="subject"&&S.get(v)||[])E[D]=[...new Set([...E[D]??[],...Object.keys(g.set)])]}let b={};for(let g of d)if(!(!("set"in g)||"create"in g||R(g.target??"$subject")!=="subject"))for(let[v,D]of Object.entries(g.set??{}))typeof D=="string"&&R(D)===void 0||typeof D=="number"||typeof D=="boolean"?b[v]=typeof D=="string"&&D.startsWith("$$")?D.slice(1):D:delete b[v];let _=p.length===0&&d.every(g=>!("set"in g)||!g.set||Object.values(g.set).every(v=>!(v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v))),F=new Map;for(let g of d)if(!(!("set"in g)||!g.set))for(let v of Object.values(g.set))v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v&&F.set(v.expr,H(v.expr));a[r]={title:o.title??r.replace(/-/g," "),effects:d,args:[...w],...o.allowedWhen?{guard:H(o.allowedWhen)}:{},...o.refusal?{refusal:ae(J(o.refusal),e.kinds[[o.on??[]].flat()[0]??""]?.fields)}:{},exprs:[...F],destructive:m,idempotent:_,creates:p,connects:c,severs:O,writes:h,writesOther:E,sets:b}}let l={};for(let[r,o]of Object.entries(e.rules??{}))l[r]={title:o.title??r.replace(/-/g," "),require:H(o.require),...o.when?{when:H(o.when)}:{},...o.says?{says:ae(J(o.says),e.kinds[o.over]?.fields)}:{}};let u=Le(e,s),f=Ze(e),z=We(e);return{format:Ve,document:e,findings:s,kinds:t,...e.computed?{facts:[...te(e)??[]]}:{},edges:[...i].map(([r,{from:o,to:d,cardinality:w}])=>[r,{from:o,to:d,cardinality:w}]),acts:a,rules:l,brand:u,...Object.keys(f).length>0?{viewSpecs:f}:{},...z?{home:z}:{}}}function Kt(e,s,i){let t=/^defineNode\("([^"]+)"\)/.exec(s)?.[1],a=t?i.kinds[t]:void 0;if(!t||!a)return e;let l=Object.keys(a.fields).filter(u=>u!=="label").slice(0,3);return{...e,path:`kinds.${t}.glance`,fix:`Say which: "glance": [${l.map(u=>`"${u}"`).join(", ")}] on kinds.${t} \u2014 the facts a person compares one by, at a glance.`}}function Dn(e,s){let i=[],t=new Set(Object.values(s.kinds).flatMap(a=>Object.keys(a.edges??{})));for(let[a,l]of Object.entries(e.kinds)){let u=l.renamedFrom;u&&!s.kinds[u]&&i.push(y("renamed-from-nothing",`kinds.${a}.renamedFrom`,`${a} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let f=s.kinds[u??a];for(let[z,r]of Object.entries(l.fields)){let o=r.renamedFrom;o&&!f?.fields[o]&&i.push(y("renamed-from-nothing",`kinds.${a}.fields.${z}.renamedFrom`,`${z} says it was ${o}, and the previous ${u??a} has no field called ${o}`,"name the field it was, or drop renamedFrom"))}for(let[z,r]of Object.entries(l.edges??{})){let o=r.renamedFrom;o&&!t.has(o)&&i.push(y("renamed-from-nothing",`kinds.${a}.edges.${z}.renamedFrom`,`${z} says it was ${o}, and the previous version has no relation called ${o}`,"name the relation it was, or drop renamedFrom"))}}return i}export{hn as ActRefusal,Dt as compileDocumentWithoutCheck,pn as effectsOf,Kt as inDocumentWords,Ft as kindShapes,xn as readDocument};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{d as be,f as ke}from"./chunk.I636CZE4.js";import{e as ft}from"./chunk.TVURUMU4.js";import{a as wt,b as yt}from"./chunk.EZ4TZUMM.js";import{h as ht}from"./chunk.47T3KUAA.js";import{a as ie,b as at}from"./chunk.YS5U3DUX.js";import{b as we,c as J,d as Y,e as ot,f as st}from"./chunk.SAJLIA5M.js";import{a as St,d as bt,f as kt}from"./chunk.LWRXCO2Z.js";import{a as Se,b as mt}from"./chunk.I2NI7CT7.js";import{a as Ce,b as vt}from"./chunk.LHIT3EZD.js";import{d as lt,e as re,f as j,g as dt,h as ye,i as ct,l as gt,n as oe}from"./chunk.7INWDFNG.js";import{j as ut,o as ve}from"./chunk.QPL3OXW3.js";import{c as pt}from"./chunk.FRERJWZJ.js";import{c as rt,d as Pe}from"./chunk.LUIRQ5UF.js";import{c as it}from"./chunk.N33WUCAN.js";import{G as U,Ga as fe,Ia as nt,Ma as Ne,Na as X,Oa as Re,T as W,W as Qe,aa as et,ba as V,da as pe,j as qe,ka as tt,l as Ue,la as _,m as Xe,ma as me,r as ae,ta as he,v as Je,y as Ye,z as Ze}from"./chunk.DBMZ3AQB.js";import{a as ue}from"./chunk.SDO3U72B.js";import{W as ee,da as te,ga as $,oa as H,ob as je,uc as ne}from"./chunk.DIFR37EZ.js";import{b as E}from"./chunk.AJZBJBMO.js";var f=E(U(),1);var xt=E(U(),1);function Nt(e){(0,xt.useLayoutEffect)(()=>{let n=e.current,t=n?.parentElement;if(!n||!t)return;let a=n.style.bottom,o=()=>{let d=t.querySelector(Kt);if(!d){n.style.bottom=a;return}let u=t.getBoundingClientRect(),m=d.getBoundingClientRect(),g=u.height>0?t.offsetHeight/u.height:1;n.style.bottom=`${Math.max(0,Math.round((u.bottom-m.top)*g))}px`};if(o(),typeof ResizeObserver>"u")return;let s=new ResizeObserver(o);return s.observe(t),()=>s.disconnect()},[e])}var Kt=".graview-spec-listing";var $e=E(U(),1);var P=E(U(),1);var Rt=E(U(),1);var B=E(W(),1);function Pt({id:e,max:n=8,empty:t,hide:a}){let{store:o}=V();pe();let s=jt(o,e,X()),[d,u]=(0,Rt.useState)(()=>new Set),m=a?s.flatMap(g=>{let w=g.ids.filter(r=>!a.has(r));return w.length>0?[{...g,ids:w}]:[]}):s;return m.length===0?t&&s.length===0?(0,B.jsx)("p",{style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-faint)"},children:t}):null:(0,B.jsx)("div",{"data-graview-primitive":"connections",style:{display:"flex",flexDirection:"column",gap:12},children:m.map(g=>{let w=d.has(g.key),r=g.ids.length>n,c=w?g.ids:g.ids.slice(0,n),y=g.ids.length-Math.min(n,g.ids.length),k=`graview-more-${e}-${g.key}`.replace(/[^A-Za-z0-9_-]/g,"-");return(0,B.jsxs)("section",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,B.jsx)("h2",{...g.said?{"aria-label":g.said}:{},style:{margin:0,fontSize:"0.75rem",fontWeight:600,letterSpacing:"0.09em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:g.label}),(0,B.jsxs)("div",{id:k,style:{display:"flex",flexWrap:"wrap",gap:6},children:[c.map(h=>{let S=o.graph.getNode(h);return S?(0,B.jsx)(Y,{pickId:h,hue:ne(S.kind),title:`Go to the ${H(o.schema.tryDefinition(S.kind),S.kind)}`,label:$(o.schema.tryDefinition(S.kind),S)},h):null}),r?(0,B.jsx)("button",{type:"button","data-graview-more":g.key,"aria-expanded":w,"aria-controls":k,...w?{}:{"aria-label":`${y} more: ${g.said??g.label}`},onClick:h=>{h.stopPropagation(),u(S=>{let b=new Set(S);return b.has(g.key)?b.delete(g.key):b.add(g.key),b})},style:_t,children:w?"Show fewer":`+${y} more`}):null]})]},g.key)})})}var _t={display:"inline-flex",alignItems:"center",alignSelf:"flex-start",minHeight:24,boxSizing:"border-box",padding:"3px 9px",borderRadius:6,border:"1px solid var(--graview-edge)",background:"var(--graview-panel-muted)",color:"var(--graview-accent)",font:"inherit",fontSize:"0.8125rem",lineHeight:1.5,whiteSpace:"nowrap",cursor:"pointer"};function jt(e,n,t=[]){let a=e.graph.getNode(n);if(!a)return[];let o=new Map,s=[];for(let d of t)if(d.subjectId===n)for(let u of d.nodeIds)u!==n&&!s.includes(u)&&e.graph.has(u)&&s.push(u);s.length>0&&o.set("judges",{key:"judges",label:"what it finds wrong",ids:s});for(let d of e.graph.allEdges()){let u=d.from===n?d.to:d.to===n?d.from:null;if(u===null||u===n)continue;let m=e.graph.getNode(u);if(!m)continue;let g=d.from===n?"out":"in",w=g==="out"?a.kind:m.kind,r=qt(e.schema,w,d.kind,g),c=`${d.kind}:${g}:${r.label}`,y=o.get(c)??{key:c,...r,ids:[]};y.ids.includes(u)||y.ids.push(u),o.set(c,y)}for(let d of o.values())d.ids.sort();return[...o.values()].sort((d,u)=>d.key<u.key?-1:d.key>u.key?1:0)}function qt(e,n,t,a){let o=it(e,n,t,a),s=te(t).toLowerCase();return o.trim().toLowerCase()!==s?{label:o}:a==="out"?{label:`\u2192 ${s}`,said:s}:{label:`\u2190 ${s}`,said:`${s}, pointing here`}}var Ct=E(U(),1),se=(0,Ct.createContext)(null);var l=E(W(),1),Ut=fe(ue(()=>(__graviewPreload(import.meta.url,["./chunk.UV3U4FRT.js","./chunk.EZ4TZUMM.js","./chunk.47T3KUAA.js","./chunk.NZDWXX6H.js","./chunk.RQX4CQJN.js","./chunk.LUIRQ5UF.js","./chunk.N33WUCAN.js","./chunk.JQFIZRAZ.js","./chunk.LKJ6FD6Y.js","./chunk.DBMZ3AQB.js","./chunk.SDO3U72B.js","./chunk.DIFR37EZ.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.WASWMHND.js")))).part((e,n)=>(0,l.jsx)(e.ArrangeBar,{...n}),{what:"Arranging this list"}),Xt=fe(ue(()=>(__graviewPreload(import.meta.url,["./chunk.TBRXNU6T.js","./chunk.H5CRRBNU.js","./chunk.FLMNWVSY.js","./chunk.JETT6ELP.js","./chunk.6SD7YZ4U.js","./chunk.DSLGMCB6.js","./chunk.IX63LTRQ.js","./chunk.I636CZE4.js","./chunk.TVURUMU4.js","./chunk.UV3U4FRT.js","./chunk.EZ4TZUMM.js","./chunk.47T3KUAA.js","./chunk.NZDWXX6H.js","./chunk.HJCQ6I3S.js","./chunk.7IXTNST2.js","./chunk.D4EP7FEC.js","./chunk.XVN3CQKH.js","./chunk.DJ4A76SX.js","./chunk.VDS3IOTK.js","./chunk.YS5U3DUX.js","./chunk.SAJLIA5M.js","./chunk.LWRXCO2Z.js","./chunk.I2NI7CT7.js","./chunk.LHIT3EZD.js","./chunk.4W5GCPAP.js","./chunk.G4JJXA63.js","./chunk.C7EJPV2N.js","./chunk.7ML2BWSP.js","./chunk.BCE6LIDR.js","./chunk.MBLFZF5R.js","./chunk.RALAID6N.js","./chunk.XOZU4OFA.js","./chunk.5NZDFT6R.js","./chunk.XTBS64IT.js","./chunk.WVUJXDXZ.js","./chunk.7INWDFNG.js","./chunk.FPGU43SC.js","./chunk.V6FUYRZI.js","./chunk.5BPRGXIW.js","./chunk.BZEJM2PY.js","./chunk.CMLNBJZG.js","./chunk.GZHZLJBF.js","./chunk.QPL3OXW3.js","./chunk.OJGHDWI6.js","./chunk.FRERJWZJ.js","./chunk.RQX4CQJN.js","./chunk.LUIRQ5UF.js","./chunk.N33WUCAN.js","./chunk.JQFIZRAZ.js","./chunk.LKJ6FD6Y.js","./chunk.DBMZ3AQB.js","./chunk.SDO3U72B.js","./chunk.DIFR37EZ.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.NX7CR4AE.js")))).part((e,n)=>(0,l.jsx)(e.KindStop,{...n}),{what:"This list"});function Ae(e){let{brand:n}=V();return ne(e,n?.accents)}function Jt(e,n){if(!n.endsWith("\u2026")&&!n.endsWith("..."))return;let t=n.replace(/[…]|\.\.\.$/g,"").trim();if(!(t.length<12)){for(let a of Object.values(e))if(typeof a=="string"&&a.length>t.length&&a.startsWith(t))return a}}function Yt(e,n){let a=Math.max(0,...e.slice(0,n*2).map(s=>s.length))*7.5+28<=212/2?2:1,o=n*a;return{columns:a,shown:Math.min(e.length,o)}}var Zt=8,At=500,Qt=12;function Vt(e){return{x:e.clientX,y:e.clientY,pointerType:e.pointerType??""}}function en(e,n,t){let a=performance.now()+At,o=["pointerdown","pointerup","mousedown","mouseup","dblclick"],s=r=>{if(performance.now()>a||!(r instanceof MouseEvent))return!1;let c=Vt(r);return n.pointerType&&c.pointerType&&n.pointerType!==c.pointerType?!1:Math.hypot(c.x-n.x,c.y-n.y)<=Qt},d=r=>{if(!s(r))return g();r.stopPropagation()},u=r=>{if(!s(r))return g();r.stopPropagation(),r.preventDefault(),e.removeEventListener("click",u,!0),setTimeout(g,50),t()},m=!1,g=()=>{if(!m){m=!0,clearTimeout(w),e.removeEventListener("click",u,!0);for(let r of o)e.removeEventListener(r,d,!0)}};for(let r of o)e.addEventListener(r,d,!0);e.addEventListener("click",u,!0);let w=setTimeout(g,At)}function tn({View:e,members:n,mode:t,flagged:a}){let{isSelected:o}=Ne(),s=n.slice(0,Zt);return(0,l.jsxs)("div",{"data-graview-rows":"",style:{display:"grid",gap:4,minWidth:0},children:[s.map(d=>(0,l.jsx)("div",{"data-graview-pick":d.id,style:{minWidth:0,cursor:"pointer"},children:(0,l.jsx)(e,{node:d,cardinality:"one",fidelity:"glyph",mode:t,selected:o(d.id),...a?.includes(d.id)?{flagged:[d.id]}:{}})},d.id)),n.length>s.length?(0,l.jsx)(Y,{label:`+${n.length-s.length} more`}):null]})}var nn=11/15,an=fe(ue(()=>(__graviewPreload(import.meta.url,["./chunk.RQX4CQJN.js","./chunk.LUIRQ5UF.js","./chunk.N33WUCAN.js","./chunk.JQFIZRAZ.js","./chunk.LKJ6FD6Y.js","./chunk.DBMZ3AQB.js","./chunk.SDO3U72B.js","./chunk.DIFR37EZ.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.4XKRCAJZ.js")))).part((e,n)=>(0,l.jsx)(e.StatesBar,{...n}),{quiet:!0});function rn({text:e,accent:n}){let t=(0,P.useRef)(null),a=(0,P.useRef)(null),[o,s]=(0,P.useState)(1),[d,u]=(0,P.useState)(!1),m=o<1?`${o}em`:void 0;return(0,P.useLayoutEffect)(()=>{let g=t.current,w=a.current;if(!g||!w)return;let r=()=>{let y=g.clientWidth,k=w.offsetWidth;if(y<=0||k<=0)return;let h=parseFloat(getComputedStyle(w).fontSize)/parseFloat(getComputedStyle(g).fontSize)||1,S=k/h,b=Math.max(nn,Math.min(1,Math.floor(y/S*100)/100));s(N=>Math.abs(N-b)<.01?N:b),u(S*b>y+.5)};if(r(),typeof ResizeObserver>"u")return;let c=new ResizeObserver(r);return c.observe(g),()=>c.disconnect()},[e]),(0,l.jsx)("span",{ref:t,"data-graview-district-name":"",...o<1?{"data-graview-fitted":""}:{},...d?{title:e}:{},style:{display:"block",minWidth:0,fontSize:"0.9375rem",lineHeight:1.25,letterSpacing:"0.05em",textTransform:"uppercase",color:n?"var(--graview-accent)":"var(--graview-ink-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:(0,l.jsx)("span",{ref:a,style:{fontSize:m},children:e})})}function $t(e,n){return!!e?.display?.page?.groups?.length||Pe(n,e).some(t=>t.long)}function Lt(e,n=he(e)){for(let t of e.kinds){let a=e.tryDefinition(t),o=a?.plural??`${String(t)}s`,s=r=>{let c=r.node,y=X(),k=(0,P.useContext)(se);if(!c)return null;let h=k?.nodeId===c.id?k:null,S=$(a,c),b=r.mode==="fullscreen"?Jt(c,S)??S:S,N=je(y,[c.id]);return(0,l.jsxs)(J,{title:(0,l.jsx)(kt,{nodeId:c.id,children:h?.title??b}),...h?{}:{subtitle:a?.describe?rt(a,c):a?.description??String(t)},selected:r.selected,...r.flagged?.includes(c.id)?{tone:"warning"}:{},fit:!0,children:[h?(0,l.jsx)(se.Provider,{value:null,children:h.body}):null,(0,l.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"22px 34px",alignItems:"flex-start"},children:[(0,l.jsx)("div",{style:{flex:$t(a,c)?"1 1 100%":"1 1 0",minWidth:"min(200px, 100%)"},children:(0,l.jsx)(bt,{id:c.id,shown:[b,S,a?.description,h?.title],...h?{hide:[...h.fields]}:{}})}),(0,l.jsx)("div",{style:{flex:$t(a,c)?"1 1 100%":"1.4 1 0",minWidth:"min(220px, 100%)"},children:(0,l.jsx)(Pt,{id:c.id,empty:`Nothing is connected to this ${H(a,String(t))} yet.`,...h?{hide:h.records}:{}})})]}),N.length>0?(0,l.jsx)("p",{"data-graview-broken":"",style:{margin:"14px 0 0",paddingTop:12,borderTop:"1px solid var(--graview-edge)",fontSize:"0.875rem",color:"var(--graview-warn)"},children:N.map(v=>v.message).join(" \xB7 ")}):null]})},d=r=>{let c=r.node;if(!c)return null;let{store:y}=V(),k=a?.computed?gt(y.schema,y.graph,c):c,h=Pe(k,a,{limit:3,said:[$(a,c)],glance:!0}),S=Ae(t),b=h.filter(x=>!x.long&&!x.markdown),N=h.find(x=>x.long||x.markdown),v=lt(c,a);return(0,l.jsxs)(J,{title:$(a,c),selected:r.selected,tone:r.flagged?.includes(c.id)?"warning":"muted",fit:!0,children:[v?(0,l.jsx)(Se,{as:"thumb",file:v,size:64,style:{marginBottom:6}}):null,(0,l.jsx)(ot,{items:b.map(x=>({id:x.key,label:x.alone,hue:S})),max:3}),N?(0,l.jsx)("p",{"data-graview-excerpt":N.key,title:N.value,style:{margin:b.length>0?"6px 0 0":0,fontSize:"0.8125rem",lineHeight:1.35,color:"var(--graview-ink-muted)",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:N.value}):null]})},u=r=>{let c=r.node,y=Ae(t),k=ve().marks.flag;if(!c)return null;let h=r.flagged?.includes(c.id)??!1;return(0,l.jsx)(Y,{label:h?`${$(a,c)} ${k}`:$(a,c),hue:y,selected:r.selected,title:h?`${te(H(a,String(t)))} \u2014 implicated in a problem`:te(H(a,String(t)))})},m=r=>r.fidelity==="full"?(0,l.jsx)(P.Suspense,{fallback:(0,l.jsx)(g,{...r}),children:(0,l.jsx)(Xt,{kind:String(t),members:r.nodes??[],...r.flagged?{flagged:r.flagged}:{},...r.label?{label:r.label}:{},...r.retired?{retired:r.retired}:{}})}):(0,l.jsx)(g,{...r}),g=r=>{let{brand:c,store:y,views:k}=V(),{view:h,go:S}=Re(),b=r.nodes??[],N=k.lookup(String(t),{cardinality:"one",fidelity:"glyph"}),v=N!==void 0&&!me(N)?N:void 0,x=wt(h),C=ht(b,x,{schema:e,graph:y.graph,flagged:new Set(r.flagged??[])}),M=R=>({id:R.id,label:$(e.tryDefinition(R.kind),R),hue:ne(R.kind,c?.accents)}),I=r.fidelity==="full"&&b.length>1?(0,l.jsx)(P.Suspense,{fallback:null,children:(0,l.jsx)(Ut,{schema:e,graph:y.graph,kind:String(t),arrangement:x,onChange:R=>S(yt(h,R)),kept:{shown:C.nodes.length,of:b.length},style:{marginBottom:8}})}):null,le=R=>R.some(A=>r.flagged?.includes(A.id)),de=X(),Z=ve().marks.flag,z=(R,A,ce)=>v?(0,l.jsx)(J,{title:R,meta:(0,l.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[(0,l.jsx)(ke,{kind:String(t),plural:o,problems:be(de,A),flag:Z}),(0,l.jsx)("span",{title:`${ee(A.length)} ${A.length===1?H(a,String(t)):o.toLowerCase()}`,children:ee(A.length)})]}),tone:le(A)?"warning":"muted",children:(0,l.jsx)(tn,{View:v,members:A,mode:r.mode,...r.flagged?{flagged:r.flagged}:{}})},ce):(0,l.jsx)(st,{label:R,count:A.length,flagged:le(A),items:A.map(M),problems:(0,l.jsx)(ke,{kind:String(t),plural:o,problems:be(de,A),flag:Z})},ce);return C.grouped?(0,l.jsxs)("div",{style:{display:"grid",gap:8},"data-graview-grouped":x.group?.by,children:[I,C.groups.map(R=>z(`${r.label??o} \xB7 ${R.label}`,R.nodes,R.key||"-"))]}):(0,l.jsxs)("div",{style:{display:"grid",gap:4},children:[I,z(r.label??o,C.nodes)]})},w=r=>{let c=r.nodes??[],y=Yt(c.map(p=>$(a,p)),r.openedRows??ut(c.length)),k=Ae(t),{brand:h}=V(),S=at(String(t),e,h),b=ve().marks.flag,{selection:N,set:v,clear:x}=Ne(),{toggle:C,view:M,go:I}=Re(),{views:le,hiddenKinds:de}=V(),Z=(0,P.useContext)(tt),z=M.overview&&!de.has(String(t))?le.places().filter(p=>p.kind===String(t)):[],R=r.focused?M.within?.view??z[0]?.as:void 0,A=c.filter(p=>r.flagged?.includes(p.id)).length,ce=A>0,Wt=X(),It=be(Wt,c),F=(M.overview??!1)&&r.nestedUnder===void 0,G=r.focused||r.raised,Ie=r.rank==="secondary"&&!G,L=r.nestedUnder!==void 0,ze=new Set(N),K=Z?N.length===1&&N[0]===ae(String(t)):r.opened??!1,zt=pt(),O=G||F?0:c.filter(p=>zt.includes(p.id)&&!ze.has(p.id)).length,xe=O>0&&!ce,ge=et(),q=ge&&!L?ge.byKind[String(t)]??0:0,Fe=(0,P.useRef)(null),Ke=(0,P.useRef)(null);(0,P.useLayoutEffect)(()=>{let p=Ke.current,T=Fe.current;if(!p||!T||!F)return;let D=()=>T.style.setProperty("--graview-plate-h",`${p.offsetHeight}px`);if(D(),typeof ResizeObserver>"u")return;let Q=new ResizeObserver(D);return Q.observe(p,{box:"border-box"}),()=>Q.disconnect()},[F]);let Ft=L?8:Math.min(46,10+Math.round(Math.sqrt(c.length)*8)),_e=L?(0,l.jsx)("span",{style:{fontSize:"0.75rem",lineHeight:1.25,letterSpacing:"0.05em",textTransform:"uppercase",color:G?"var(--graview-accent)":"var(--graview-ink-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r.label??o}):(0,l.jsx)(rn,{text:r.label??o,accent:!!G});return(0,l.jsxs)("div",{ref:Fe,className:"graview-kind-card","data-graview-rank":r.rank,"data-graview-landmark":S||void 0,"data-graview-nested":L||void 0,"data-graview-tied":O||void 0,"data-graview-hits":ge&&!L?q:void 0,"data-graview-emphasis":ge&&!L?q>0?"lit":"dimmed":void 0,...a?.description||L?{title:L?[r.label??o,a?.description].filter(Boolean).join(" \u2014 "):a.description}:{},style:{position:"relative",height:"100%","--graview-hue":Math.round(k)},children:[S?(0,l.jsx)("span",{className:"graview-kind-block graview-kind-landmark","data-graview-opened":r.opened||void 0,"aria-hidden":"true",style:{"--graview-rise":Ft},children:(0,l.jsx)(ie,{kind:String(t),schema:e,...h?{brand:h}:{},size:96})}):null,(0,l.jsxs)("div",{ref:Ke,className:"graview-kind-face","data-graview-opened":r.opened||void 0,"data-graview-nameplate":F?r.nameplate??"full":void 0,style:{display:"flex",flexDirection:"column",gap:L?1:3,padding:L?"5px 7px":"7px 10px",borderRadius:"var(--graview-radius-sm, 9px)",justifyContent:"center",position:"relative",height:"100%",overflow:"hidden",boxSizing:"border-box",border:G?"1px solid var(--graview-accent)":O>0?"1px solid var(--graview-accent-dim)":`1px solid hsl(${Math.round(k)} 55% var(--graview-tint-lightness) / 0.34)`,backgroundColor:"var(--graview-panel)",backgroundImage:`linear-gradient(hsl(${Math.round(k)} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * ${G?1.1:Ie?.28:.5})), hsl(${Math.round(k)} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * ${G?1.1:Ie?.28:.5})))`,boxShadow:G?"0 0 0 1px var(--graview-accent-dim)":void 0},children:[!L&&!F&&c.length>0?(0,l.jsx)("div",{"data-graview-tally":c.length,"data-graview-broken":A||void 0,"aria-hidden":"true",style:{position:"absolute",left:0,right:0,top:0,display:"flex",height:3,background:`hsl(${Math.round(k)} 55% var(--graview-tint-lightness) / 0.4)`},children:A>0?(0,l.jsx)("span",{style:{width:`${Math.max(6,Math.round(A/c.length*100))}%`,background:"var(--graview-warn)"}}):null}):null,S?(0,l.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:L?4:6},children:[(0,l.jsx)(ie,{kind:String(t),schema:e,...h?{brand:h}:{},size:L?14:18}),_e]}):_e,(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:5,fontSize:"0.875rem"},children:[(0,l.jsx)("span",{title:c.length>0?`${ee(c.length)} ${c.length===1?H(a,String(t)):o.toLowerCase()}`:void 0,style:{fontVariantNumeric:"tabular-nums",color:xe?"var(--graview-accent)":"var(--graview-ink-faint)"},children:c.length===0?"none yet":xe?O===c.length?`${O} tied`:`${O} of ${c.length} tied`:ee(c.length)}),(0,l.jsx)(ke,{kind:String(t),plural:o,problems:It,flag:b,listed:K}),(r.retired??0)>0?(0,l.jsxs)("button",{type:"button",className:"graview-kind-past","data-graview-retired":r.retired,title:`${r.retired} retired ${o.toLowerCase()} \u2014 press to widen the view to the past`,onClick:p=>{p.stopPropagation(),I(ft(M,!0))},onDoubleClick:p=>p.stopPropagation(),onPointerDown:p=>p.stopPropagation(),children:["+",r.retired," past"]}):null,q>0?(0,l.jsxs)("button",{type:"button",className:"graview-kind-hits","data-testid":`hits-${String(t)}`,title:`${q} ${q===1?"match":"matches"} for \u201C${M.q??""}\u201D \u2014 press to go in, narrowed`,onClick:p=>{p.stopPropagation(),I(Ye(M,ae(String(t)),{ownPicture:!0,...M.q?{carry:M.q}:{}}))},onDoubleClick:p=>p.stopPropagation(),onPointerDown:p=>p.stopPropagation(),children:[q," match"]}):null,O>0&&!xe?(0,l.jsxs)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-accent)"},children:[O," tied"]}):null,r.hasOwnView&&!F?(0,l.jsx)("span",{title:`${o} has a view of its own`,"aria-label":"has its own view",style:{fontSize:"0.6875rem",color:"var(--graview-accent)"},children:"\u25C6"}):null,!L&&c.length>0&&!r.focused?(0,l.jsxs)("button",{type:"button",className:"graview-kind-open","data-testid":`open-${String(t)}`,"aria-expanded":K,"aria-label":K?`Close up the ${o}`:`See the ${o} in here`,title:K?"Close it up":`See the ${o} in here`,onClick:p=>{p.stopPropagation(),Z?K?x():v([ae(String(t))]):C(ae(String(t)))},onDoubleClick:p=>p.stopPropagation(),onPointerDown:p=>p.stopPropagation(),children:[(0,l.jsx)("span",{className:"graview-kind-open-word",children:K?"close":"open"})," ",(0,l.jsx)("span",{"aria-hidden":"true",children:K?"\u25B4":"\u25BE"})]}):null]}),F&&r.states?(0,l.jsx)(P.Suspense,{fallback:null,children:(0,l.jsx)(an,{states:r.states,definition:a})}):null,r.opened?(0,l.jsxs)("div",{className:"graview-kind-members","data-graview-buildings":r.plot?.side??1,style:{display:"grid",gridTemplateColumns:`repeat(${y.columns}, minmax(0, 1fr))`,gap:3},children:[c.slice(0,y.shown).map(p=>{let T=r.flagged?.includes(p.id)??!1,D=$(a,p);return(0,l.jsx)(Y,{pickId:p.id,label:T?`${D} ${b}`:D,title:T?`${D} \u2014 implicated in a problem`:void 0,hue:k,selected:ze.has(p.id)},p.id)}),c.length>y.shown?(0,l.jsxs)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",padding:"2px 4px",gridColumn:"1 / -1"},children:["+",c.length-y.shown," more \u2014 double-click to go in"]}):null]}):null]}),!L&&z.length>0?(0,l.jsx)("div",{className:"graview-drive-in","data-testid":`drive-in-${String(t)}`,"data-graview-showing":R,onPointerDown:p=>p.stopPropagation(),onDoubleClick:p=>p.stopPropagation(),children:(0,l.jsx)("div",{className:"graview-drive-in-marquee",role:"group","aria-label":`${o}: pictures`,"data-graview-thumbs":z.length===1?"one":"two",children:z.map(p=>{let T=R===p.as;return(0,l.jsxs)("div",{className:"graview-drive-in-thumb","data-graview-pressed":T||void 0,children:[(0,l.jsx)("span",{className:"graview-drive-in-thumb-title","aria-hidden":"true",children:p.title}),(0,l.jsx)("button",{type:"button",className:"graview-drive-in-thumb-press","data-testid":`showing-${p.as}`,"aria-label":`${o}: ${p.title}`,"aria-pressed":T,title:T?`${p.title} is showing \u2014 press again to open it`:`Show ${p.title} on the billboard \u2014 double-click to open it`,onClick:D=>{D.stopPropagation();let Q=()=>I(Ze(M,String(t),p.as));if(D.detail>=2||T&&r.focused){Q();return}I(Ue(qe(Xe(M,!0),Je(String(t))),"view",p.as)),D.detail===1&&en(D.currentTarget.ownerDocument,Vt(D.nativeEvent),Q)}})]},p.as)})})}):null]})};m.generic=!0,w.generic=!0,n.register(t,{cardinality:"one",fidelity:"full"},_(s)).register(t,{cardinality:"one",fidelity:"summary"},_(d)).register(t,{cardinality:"one",fidelity:"glyph"},_(u)).register(t,{cardinality:"many",fidelity:"full"},_(m)).register(t,{cardinality:"many",fidelity:"summary"},_(m)).register(t,{cardinality:"many",fidelity:"glyph"},_(w))}return n}var Le=E(W(),1),Et=new WeakMap;function on(e){let n=Et.get(e);return n||Et.set(e,n=Lt(e,he(e))),n}var Ve=nt;function Mt(){return(0,$e.useContext)(Ve)}function Un({children:e}){return(0,Le.jsx)(Ve.Provider,{value:!0,children:e})}function Dt(e){let n=(0,$e.useContext)(Ve),{store:t}=V();if(n)return null;let a=e.kind??e.node?.kind??e.nodes?.[0]?.kind;if(!a)return null;let o=on(t.schema).lookup(a,{cardinality:e.cardinality,fidelity:e.fidelity});return o?(0,Le.jsx)(o,{...e}):null}var i=E(W(),1);function Ee(e,n){return e===void 0?{}:e===0?{"data-graview-lines":"all",style:{WebkitLineClamp:"none",lineClamp:"none",maxHeight:"none",overflow:"visible"}}:{"data-graview-lines":String(e),style:{...n?{display:"-webkit-box",WebkitBoxOrient:"vertical"}:{},WebkitLineClamp:e,lineClamp:e,overflow:"hidden",maxHeight:`${e*1.45}em`}}}var sn=90,Bt=(0,f.createContext)(null),Me=(e,n)=>e.trim().toLowerCase().replace(/[_-]+/g," ")===n.trim().toLowerCase().replace(/[_-]+/g," "),ln=(0,f.createContext)(null),Oe=(0,f.createContext)(null);function Tt({block:e}){let n=(0,f.useContext)(Oe),t=n?.slots?.[e.key],a=(0,i.jsx)(dn,{block:e});return t?(0,i.jsx)(f.Suspense,{fallback:a,children:(0,i.jsx)(t,{block:e,node:n.node,drawn:a})}):a}function dn({block:e}){let n=(0,f.useContext)(Bt),t=(0,f.useContext)(gn),a=(0,f.useContext)(Be),o=(0,f.useContext)(we);if(n&&e.t==="badge"&&n.values.some(s=>Me(s,e.text))||n&&e.t==="field"&&n.field!==void 0&&e.field===n.field||e.t==="badge"&&/^0(?:\s+\p{L}+)?$/u.test(e.text.trim()))return null;switch(e.t){case"title":return(0,i.jsx)("strong",{className:"graview-spec-title",...o!==null&&Me(o,e.text)?{"aria-hidden":!0}:{},children:e.text});case"text":return e.markdown||Ce(e.text)?(0,i.jsx)("div",{className:"graview-spec-text",...e.tone?{"data-graview-tone":e.tone}:{},...Ee(e.lines,!0),children:(0,i.jsx)(vt,{text:e.text,markdown:e.markdown})}):e.runs?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-meta",...e.tone?{"data-graview-tone":e.tone}:{},...Ee(e.lines,!1),children:e.runs.map((s,d)=>(0,i.jsxs)(f.Fragment,{children:[d>0?" ":null,s.field!==void 0?(0,i.jsx)("span",{className:"graview-spec-chip","data-graview-field":s.field,children:s.text}):(0,i.jsx)("span",{className:"graview-spec-meta-words",children:d>0&&e.runs[d-1].field===void 0?`\xB7 ${s.text}`:s.text})]},d))}):(0,i.jsx)("p",{className:"graview-spec-text",...e.tone?{"data-graview-tone":e.tone}:{},...Ee(e.lines,!0),children:e.text});case"badge":return(0,i.jsx)("span",{className:"graview-spec-badge","data-graview-tone":e.tone,children:e.text});case"field":return(0,i.jsxs)("span",{className:"graview-spec-field","data-graview-field":e.field,children:[(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,i.jsx)("span",{className:"graview-spec-value",...Ce(e.text)?{style:{whiteSpace:"pre-line"}}:{},children:e.linked?(0,i.jsx)(mt,{relation:e.linked.relation,refs:e.linked.refs,as:"chip"}):e.app?(0,i.jsx)(St,{address:e.app}):e.href?(0,i.jsx)("a",{className:"graview-spec-link",href:e.href,...e.href.startsWith("tel:")?{}:{rel:"noopener noreferrer",target:"_blank"},children:e.text}):e.text})]});case"image":return(0,i.jsx)(Se,{as:"block",field:e.field,files:e.files,label:e.label,view:e.as});case"progress":return e.value===void 0||e.max===void 0?(0,i.jsxs)("span",{className:"graview-spec-progress",children:[(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,i.jsx)("span",{className:"graview-spec-value",children:e.text})]}):(0,i.jsxs)("span",{className:"graview-spec-progress",children:[(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,i.jsx)("span",{className:"graview-spec-track",role:"progressbar","aria-label":e.label,"aria-valuemin":0,"aria-valuemax":e.max,"aria-valuenow":Math.max(0,Math.min(e.value,e.max)),"aria-valuetext":e.text,children:(0,i.jsx)("span",{className:"graview-spec-fill",style:{width:`${Math.round(Math.max(0,Math.min(e.value,e.max))/e.max*100)}%`}})}),(0,i.jsx)("span",{className:"graview-spec-value",children:e.text})]});case"group":return(0,i.jsx)("span",{className:"graview-spec-group","data-direction":e.direction,children:(0,i.jsx)(De,{blocks:e.blocks})});case"when":return e.shown?(0,i.jsx)(De,{blocks:e.blocks}):null;case"divider":return(0,i.jsx)("hr",{className:"graview-spec-divider"});case"figure":return(0,i.jsx)(cn,{});case"headline":{let s=`h${Math.min(6,e.level+t)}`,d=(0,i.jsx)(s,{className:"graview-spec-headline","data-level":e.level,"data-long":e.text.length>sn?"":void 0,children:e.text});return a!==null&&e.level===1?(0,i.jsxs)(i.Fragment,{children:[d,a]}):d}case"number":return(0,i.jsxs)("span",{className:"graview-spec-number",...e.emphasis?{"data-emphasis":e.emphasis}:{},children:[(0,i.jsx)("span",{className:"graview-spec-number-value",children:e.text}),e.label?(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}):null]});case"list":return(0,i.jsx)(mn,{list:e})}}function cn(){let e=(0,f.useContext)(Oe)?.figure;return e?(0,i.jsx)("span",{className:"graview-spec-figure","aria-hidden":"true",children:e()}):null}function De({blocks:e}){let n=[];for(let t=0;t<e.length;t++){let a=t;for(;e[a]?.t==="badge"&&e[a+1]?.t==="badge";)a++;if(a===t){n.push((0,i.jsx)(Tt,{block:e[t]},t));continue}n.push((0,i.jsx)("span",{className:"graview-spec-badges",children:e.slice(t,a+1).map((o,s)=>(0,i.jsx)(Tt,{block:o},s))},t)),t=a}return n}function He({blocks:e,ctx:n,view:t}){let a=(0,f.useContext)(ln)?.[t];return(0,i.jsx)(Oe.Provider,{value:{figure:n.figure,slots:a,node:n.node},children:(0,i.jsx)(De,{blocks:e})})}function Gt({blocks:e,ctx:n,view:t}){return(0,i.jsx)(He,{blocks:j(e,n),ctx:n,view:t})}var Te=3,Ot=(0,f.createContext)(0),Ht=(0,f.createContext)(null),gn=(0,f.createContext)(0),Be=(0,f.createContext)(null),un=(0,f.createContext)(null);function pn({node:e,as:n,depth:t,said:a=null}){let{store:o,views:s}=V(),d=$(o.schema.tryDefinition(e.kind),e),u=s.lookup(e.kind,{cardinality:"one",fidelity:n==="card"?"summary":"glyph"});return n==="row"&&t<=Te&&(!u||me(u))?(0,i.jsxs)("li",{className:"graview-spec-item","data-graview-listed":e.id,"data-as":n,children:[(0,i.jsx)(Ge,{node:e,label:d}),(0,i.jsx)("div",{className:"graview-spec graview-spec-row","data-graview-spec":"row","data-graview-kind":e.kind,"aria-hidden":"true",children:(0,i.jsx)("strong",{className:"graview-spec-title",children:d})})]}):(0,i.jsxs)("li",{className:"graview-spec-item","data-graview-listed":e.id,"data-as":n,children:[(0,i.jsx)(Ge,{node:e,label:d}),t<=Te&&u?(0,i.jsx)(Qe,{mode:"scene",children:(0,i.jsx)(Ot.Provider,{value:t,children:(0,i.jsx)(Bt.Provider,{value:a,children:(0,i.jsx)(we.Provider,{value:d,children:(0,i.jsx)(u,{node:e,cardinality:"one",fidelity:n==="card"?"summary":"glyph",mode:"scene",selected:!1})})})})}):(0,i.jsx)("span",{className:"graview-spec-item-name","aria-hidden":"true",children:d})]})}function Ge({node:e,label:n,describedBy:t}){let a=(0,f.useContext)(Ht),o=(0,f.useRef)(null);return Nt(o),a?(0,i.jsx)("a",{ref:o,className:"graview-spec-item-link",href:a.href(e),"aria-label":n,...t?{"aria-describedby":t}:{},onClick:s=>{s.metaKey||s.ctrlKey||s.shiftKey||s.button!==0||(s.preventDefault(),s.stopPropagation(),a.go(e))}}):(0,i.jsx)("button",{ref:o,type:"button",className:"graview-spec-item-link","data-graview-pick":e.id,"aria-label":n,...t?{"aria-describedby":t}:{}})}function mn({list:e}){let n=(0,f.useContext)(Ot)+1,{store:t}=V(),a=(0,f.useContext)(Ht),[o,s]=(0,f.useState)(e.members.length);if(e.failed)return(0,i.jsx)("p",{className:"graview-spec-text",children:"\u2014"});if(e.members.length===0)return e.empty?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-empty",children:e.empty}):null;let d=(v,x=null)=>n>Te?(0,i.jsx)("ul",{className:"graview-spec-list","data-as":"names",children:v.map(C=>(0,i.jsxs)("li",{className:"graview-spec-item","data-graview-listed":C.id,"data-as":"name",children:[(0,i.jsx)(Ge,{node:C,label:$(t.schema.tryDefinition(C.kind),C)}),(0,i.jsx)("span",{className:"graview-spec-item-name","aria-hidden":"true",children:$(t.schema.tryDefinition(C.kind),C)})]},C.id))}):(0,i.jsx)("ul",{className:"graview-spec-list","data-as":e.as,children:v.map(C=>(0,i.jsx)(pn,{node:C,as:e.as,depth:n,said:x},C.id))}),u=e.rest??[],m=Math.min(o,e.members.length+u.length),g=m>e.members.length?[...e.members,...u].slice(0,m):e.members,w=e.members.length+u.length-m,r=Math.max(1,e.members.length),c=w>0?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-more",children:(0,i.jsx)("button",{type:"button",className:"graview-spec-show-more","data-graview-show-more":w,onClick:()=>s(m+r),children:`Show ${Math.min(r,w)} more`})}):null,y=e.total??e.members.length+e.more,k=e.more-u.length,h=c??(a?.more&&y>g.length?a.more({members:g,total:y}):k>0?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-more",children:`and ${k} more`}):null);if(!e.groups)return(0,i.jsxs)("div",{className:"graview-spec-listing",children:[d(g),h]});let S=`h${e.headingLevel}`,b=m,N=m>e.members.length&&e.everyGroup?e.everyGroup.flatMap(v=>{if(b<=0)return[];let x=v.members.slice(0,b);return b-=x.length,[{...v,members:x}]}):e.groups;return(0,i.jsxs)("div",{className:"graview-spec-listing",children:[N.map(v=>(0,i.jsxs)("section",{className:"graview-spec-list-group","data-graview-group":v.value??"",children:[v.heading?(0,i.jsxs)(S,{className:"graview-spec-list-heading",children:[v.heading," ",(0,i.jsx)("span",{className:"graview-spec-list-count",children:(e.everyGroup?.find(x=>x.value===v.value)??v).members.length})]}):null,d(v.members,v.value!==null?{values:[v.value,...v.heading?[v.heading]:[]]}:null)]},v.value??"")),h]})}function ca({blocks:e,heading:n=2,firstHeading:t,slot:a,view:o=a}){let{store:s,brand:d}=V();pe();let u=oe(s,null,null,{heading:n,firstHeading:t,money:d}),m=(0,f.useContext)(Be),w=(0,f.useContext)(un)?.lede===!0&&a==="place"&&e[0]?.t==="headline"?e.slice(1):e,r=w.some(c=>c.t==="headline");return(0,i.jsxs)("div",{className:`graview-spec graview-spec-${a}`,"data-graview-spec":a,children:[m!==null&&!r?m:null,(0,i.jsx)(Be.Provider,{value:r?m:null,children:(0,i.jsx)(Gt,{blocks:w,ctx:u,view:o})})]})}function We(e,n="card"){let{store:t,brand:a}=V(),o=t.schema;return{...oe(t,null,e,{slot:n,money:a}),figure:()=>(0,i.jsx)(ie,{kind:e.kind,schema:o,...a?{brand:a}:{},size:22})}}function hn({blocks:e,node:n,selected:t,flagged:a}){let o=We(n),[s,...d]=e,u=s?.t==="title";return(0,i.jsx)(J,{...u?{title:j([s],o)[0].text}:{},selected:t,tone:a?"warning":"muted",fit:!0,children:(0,i.jsx)("div",{className:"graview-spec graview-spec-card","data-graview-spec":"card","data-graview-kind":n.kind,children:(0,i.jsx)(Gt,{blocks:u?d:e,ctx:o,view:`${n.kind}.card`})})})}function fn({blocks:e,props:n}){let t=n.node,a=We(t,"page"),o=Mt(),s=j(e,a),d=ye(e,s),u=d.title!==void 0&&(!o||d.title===$(a.schema?.tryDefinition(t.kind),t)),m=(0,i.jsx)("div",{className:"graview-spec graview-spec-page","data-graview-spec":"page","data-graview-kind":t.kind,children:(0,i.jsx)(He,{blocks:u?s.slice(1):s,ctx:a,view:`${t.kind}.page`})});return o?m:(0,i.jsx)(se.Provider,{value:{nodeId:t.id,...d.title!==void 0?{title:d.title}:{},body:m,fields:d.fields,records:d.records},children:(0,i.jsx)(Dt,{...n})})}function ga(e,n,t){return typeof e=="function"?e.says?.(n,t):void 0}function wn({blocks:e,node:n,selected:t}){let{store:a}=V(),o=$(a.schema.tryDefinition(n.kind),n),s=We(n,"row"),d=j(e,s),u=(0,f.useContext)(we);return(0,i.jsx)("div",{title:o,style:{minWidth:0,maxWidth:"100%"},children:(0,i.jsxs)("div",{className:"graview-spec graview-spec-row","data-graview-spec":"row","data-graview-kind":n.kind,...e.some(ct)?{"data-graview-tall":""}:{},...t?{"data-selected":""}:{},children:[dt(d,o)?null:(0,i.jsx)("strong",{className:"graview-spec-title","data-graview-row-name":"",...u!==null&&Me(u,o)?{"aria-hidden":!0}:{},children:o}),(0,i.jsx)(He,{blocks:d,ctx:s,view:`${n.kind}.row`})]})})}function ua(e,n,t){if(!t)return e;let a=new Set(n.kinds);for(let[o,s]of Object.entries(t)){if(!a.has(o)||!s)continue;let d=o;if(s.card){let u=re(s.card),m=g=>g.node?(0,i.jsx)(hn,{blocks:u,node:g.node,selected:g.selected,flagged:g.flagged?.includes(g.node.id)??!1}):null;e.register(d,{cardinality:"one",fidelity:"summary"},m)}if(s.row){let u=re(s.row),m=g=>g.node?(0,i.jsx)(wn,{blocks:u,node:g.node,selected:g.selected}):null;m.says=(g,w)=>ye(u,j(u,oe({graph:w,schema:n},null,g,{slot:"row"}))),e.register(d,{cardinality:"one",fidelity:"glyph"},m)}if(s.page){let u=re(s.page),m=g=>g.node?(0,i.jsx)(fn,{blocks:u,props:g}):null;m.says=(g,w)=>ye(u,j(u,oe({graph:w,schema:n},null,g))),e.register(d,{cardinality:"one",fidelity:"full"},m)}}return e}export{Nt as a,Un as b,Bt as c,Ht as d,gn as e,Be as f,un as g,Ge as h,ca as i,ga as j,ua as k,Lt as l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk.547FQPYG.js";import"./chunk.XVN3CQKH.js";import"./chunk.7ML2BWSP.js";import"./chunk.BCE6LIDR.js";import"./chunk.MBLFZF5R.js";import"./chunk.5NZDFT6R.js";import"./chunk.7INWDFNG.js";import"./chunk.FPGU43SC.js";import"./chunk.V6FUYRZI.js";import"./chunk.5BPRGXIW.js";import"./chunk.BZEJM2PY.js";import"./chunk.CMLNBJZG.js";import"./chunk.RQX4CQJN.js";import"./chunk.LUIRQ5UF.js";import"./chunk.N33WUCAN.js";import"./chunk.DIFR37EZ.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{b as actOnSeveral,a as actsForSeveral};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as C,Ra as H,T as F,Ta as A}from"./chunk.
|
|
1
|
+
import{G as C,Ra as H,T as F,Ta as A}from"./chunk.DBMZ3AQB.js";import"./chunk.SDO3U72B.js";import"./chunk.DIFR37EZ.js";import"./chunk.FQLNBIQ5.js";import{b as x}from"./chunk.AJZBJBMO.js";var t=x(C(),1),f=x(F(),1),q={faces:'[data-testid="app-faces"]',problems:'[data-testid="standing"], [data-testid="standing-link"]',activity:'[data-testid="activity-button"]',ask:'[data-testid="app-find"], [data-testid="app-find-open"]',find:'[data-testid="app-find"], [data-testid="app-find-open"]',profile:'[data-testid="profile-button"]',home:'[data-testid="app-home"]'};function D(e){if(!e.isConnected||e.closest("[hidden], [inert], [aria-hidden='true']"))return!1;if(typeof e.checkVisibility!="function")return!0;if(!e.checkVisibility({visibilityProperty:!0}))return!1;let a=e.getBoundingClientRect();return a.width>1&&a.height>1}function E(e,a){if(!e||a==="ask"&&!e.querySelector("[data-graview-quick-ask]"))return null;for(let d of e.querySelectorAll(q[a]))if(D(d))return d;return null}function W(e){let a=(u,h,c)=>e.querySelector(u)?.getAttribute(h)?.trim()||c,d=a('[data-testid="app-face-scene"]',"title","Scene"),n=a('[data-testid="app-face-pages"]',"title","Pages");return[{anchor:"faces",title:`${d} or ${n}`,words:`One app, two ways to see it: ${d} draws every record as one picture, ${n} as lists and pages to read and change.`},{anchor:"problems",title:"Whether all is in order",words:"The dot is green while every rule holds. When one is broken it counts what is wrong, and pressing it shows each one and where."},{anchor:"activity",title:"Activity",words:"What has happened here and who did it, each change with its way back."},{anchor:"ask",title:"Ask",words:"Press \u2318K (Ctrl+K) to ask about what you have selected, or right-click it and choose Ask about this\u2026. The answer stands beside it, and a change it proposes waits for you to accept it."}]}var R=300,O=1200,$=15e3;function _({root:e,steps:a,onEnd:d}){let[n,u]=(0,t.useState)(null),h=(0,t.useRef)(null),c=(0,t.useRef)(!1),p=(0,t.useRef)(d);p.current=d,(0,t.useEffect)(()=>{let r=Date.now(),o=Date.now(),s=null,i,v=new MutationObserver(()=>o=Date.now());v.observe(document.body,{childList:!0,subtree:!0});let k=()=>{let L=e(),S=Date.now();if(L?.querySelector('[data-testid="app-bar"]')){if(s??=S,S-o>=R||S-s>=O){let T=[...W(L),...a].filter(P=>E(L,P.anchor)!==null);if(T.length===0){c.current=!0,p.current(null);return}h.current=document.activeElement,u({list:T,at:0});return}}else if(S-r>=$){c.current=!0,p.current(null);return}i=setTimeout(k,100)};return i=setTimeout(k,100),()=>{clearTimeout(i),v.disconnect()}},[]);let y=(0,t.useCallback)(()=>{let r=h.current;(r instanceof HTMLElement&&r!==document.body&&r.isConnected?r:e()?.querySelector('[data-testid="app-home"]'))?.focus({preventScroll:!0})},[e]),m=(0,t.useCallback)((r,o)=>{if(c.current)return;c.current=!0;let s=document.querySelector("[data-testid='first-look']"),i=document.activeElement,v=i===null||i===document.body||s!==null&&s.contains(i);u(null),p.current(r),!(!o&&!v)&&(y(),requestAnimationFrame(()=>{let k=document.activeElement;(k===null||k===document.body)&&y()}))},[y]),b=(0,t.useCallback)((r,o)=>{let s=e();for(let i=o;i<r.length;i++)if(E(s,r[i].anchor))return i;return-1},[e]),g=(0,t.useCallback)(()=>{if(!n)return;let r=b(n.list,n.at+1);r<0?m("finished",!0):u({list:n.list,at:r})},[n,b,m]);if((0,t.useEffect)(()=>{if(!n)return;let r=e();if(!r)return;let o=0,s=()=>{cancelAnimationFrame(o),o=requestAnimationFrame(()=>{E(e(),n.list[n.at].anchor)||g()})},i=new MutationObserver(s);return i.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden","class","data-switch-drawn"]}),()=>{cancelAnimationFrame(o),i.disconnect()}},[n,e,g]),!n)return null;let w=n.list[n.at],l=b(n.list,n.at+1)<0;return(0,f.jsx)(I,{root:e,step:w,position:n.at+1,total:n.list.length,last:l,onNext:g,onEnd:m},n.at)}var N={...H,width:"min(320px, calc(100vw - 24px))",maxHeight:"min(70vh, 420px)",overflow:"auto",padding:"12px 14px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)",fontSize:"0.875rem",lineHeight:1.45,overflowWrap:"anywhere"},M={minHeight:32,padding:"0 12px",borderRadius:8,font:"inherit",fontWeight:600,cursor:"pointer"};function I({root:e,step:a,position:d,total:n,last:u,onNext:h,onEnd:c}){let p=(0,t.useRef)(null),y=(0,t.useRef)(null),m=(0,t.useId)().replace(/:/g,""),b=(0,t.useMemo)(()=>({get current(){return E(e(),a.anchor)}}),[e,a.anchor]),[g]=(0,t.useState)(()=>{let l=b.current?.getBoundingClientRect(),r=typeof document>"u"?0:document.documentElement.clientWidth||innerWidth;return l&&l.left+l.width/2<r/2?"start":"end"});A(p,!0,b,{align:g}),(0,t.useLayoutEffect)(()=>{y.current?.focus({preventScroll:!0})},[]);let w=(0,t.useRef)(c);return w.current=c,(0,t.useEffect)(()=>{let l=o=>{o.target instanceof Node&&p.current?.contains(o.target)||w.current("dismissed",!1)},r=o=>{if(o.key!=="Escape"||o.defaultPrevented)return;let s=o.target;s instanceof Node&&p.current?.contains(s)||s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||[...document.querySelectorAll("[data-graview-overlay]:not([hidden])")].some(i=>i!==p.current)||w.current("dismissed",!0)};return document.addEventListener("pointerdown",l,!0),document.addEventListener("keydown",r),()=>{document.removeEventListener("pointerdown",l,!0),document.removeEventListener("keydown",r)}},[]),(0,f.jsxs)("div",{ref:p,popover:"manual",role:"dialog","aria-modal":"false","aria-labelledby":`${m}-title`,"aria-describedby":`${m}-words`,tabIndex:-1,"data-testid":"first-look","data-first-look-anchor":a.anchor,"data-graview-overlay":"",onKeyDown:l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),c("dismissed",!0))},style:N,children:[(0,f.jsxs)("p",{style:{margin:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},"data-testid":"first-look-count",children:[d," of ",n]}),(0,f.jsx)("p",{id:`${m}-title`,style:{margin:"2px 0 4px",fontWeight:600,fontSize:"0.9375rem"},"data-testid":"first-look-title",children:a.title}),(0,f.jsx)("p",{id:`${m}-words`,style:{margin:0},"data-testid":"first-look-words",children:a.words}),(0,f.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-end",gap:8,marginTop:12},children:[u?null:(0,f.jsx)("button",{type:"button","data-testid":"first-look-skip",onClick:()=>c("dismissed",!0),style:{...M,fontWeight:500,border:"1px solid transparent",background:"none",color:"var(--graview-ink-muted)"},children:"Skip"}),(0,f.jsx)("button",{ref:y,type:"button","data-testid":u?"first-look-done":"first-look-next",onClick:()=>u?c("finished",!0):h(),style:{...M,border:"1px solid var(--graview-accent)",background:"var(--graview-accent)",color:"var(--graview-accent-ink)"},children:u?"Done":"Next"})]})]})}export{_ as FirstLookHints,E as firstLookAnchor};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as z,i as D,j as H}from"./chunk.
|
|
1
|
+
import{h as z,i as D,j as H}from"./chunk.YQXA4WAM.js";import"./chunk.UWQ3I5OW.js";import{a as P,b as A,c as p,d as W}from"./chunk.UGFDSE37.js";import"./chunk.FLMNWVSY.js";import"./chunk.JETT6ELP.js";import"./chunk.DSLGMCB6.js";import"./chunk.IX63LTRQ.js";import"./chunk.I636CZE4.js";import"./chunk.TVURUMU4.js";import"./chunk.UV3U4FRT.js";import"./chunk.EZ4TZUMM.js";import"./chunk.47T3KUAA.js";import"./chunk.NZDWXX6H.js";import"./chunk.C5EFUODO.js";import"./chunk.UGOKORIF.js";import"./chunk.VDS3IOTK.js";import"./chunk.YS5U3DUX.js";import"./chunk.SAJLIA5M.js";import"./chunk.LWRXCO2Z.js";import"./chunk.I2NI7CT7.js";import"./chunk.LHIT3EZD.js";import{a as C,b as O}from"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.7INWDFNG.js";import"./chunk.FPGU43SC.js";import"./chunk.V6FUYRZI.js";import"./chunk.5BPRGXIW.js";import"./chunk.BZEJM2PY.js";import"./chunk.CMLNBJZG.js";import"./chunk.GZHZLJBF.js";import"./chunk.QPL3OXW3.js";import"./chunk.OJGHDWI6.js";import"./chunk.FRERJWZJ.js";import"./chunk.RQX4CQJN.js";import"./chunk.LUIRQ5UF.js";import"./chunk.N33WUCAN.js";import"./chunk.JQFIZRAZ.js";import"./chunk.LKJ6FD6Y.js";import{G as B,Sa as k,T as L}from"./chunk.DBMZ3AQB.js";import"./chunk.SDO3U72B.js";import{Vc as R}from"./chunk.DIFR37EZ.js";import"./chunk.FQLNBIQ5.js";import{b as E}from"./chunk.AJZBJBMO.js";var r=E(B(),1);var s=E(L(),1);function M(c){let e=document.activeElement;if(e!==null&&e!==document.body&&e!==document.documentElement&&e.isConnected)return;let n=c??document,o=n.querySelector("main")??n.querySelector("[data-graview-page]")??null,t=n.querySelector("[data-graview-page-title]")??o?.querySelector("h1, h2")??o;t instanceof HTMLElement&&(t.hasAttribute("tabindex")||t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0}))}var I=1500;function N(c,e,n){let{store:o,principal:t}=c,l=z(o),g=(0,r.useMemo)(()=>P(o,t),[o,t,l]),w=(0,r.useRef)(n),[b,d]=(0,r.useState)(),[y,u]=(0,r.useState)("");(0,r.useEffect)(()=>{let a=A(o,t,w.current);w.current=o.batches().length,a&&(d({batch:a.batch,at:e,when:Date.now()}),u(""))},[o,t,l]),(0,r.useEffect)(()=>{d(a=>!a||a.at===e?a:Date.now()-a.when<I?{...a,at:e}:void 0)},[e]);let[x,i]=(0,r.useState)(null),v=(0,r.useCallback)(()=>{d(void 0),i(null)},[]),f=(0,r.useCallback)(()=>{i(null);try{let a=W(o,t);a&&u(`Took back \u201C${a.intent}\u201D`)}catch(a){i(a instanceof Error?a.message:String(a))}},[o,t]),S=g&&b?.batch===g.batch&&b.at===e?g:void 0;return{change:g,offered:S,close:v,takeBack:f,refused:x,said:y}}function ee({context:c,docked:e,at:n,since:o,compact:t=!1,className:l,size:g}){let{change:w,offered:b,close:d,takeBack:y,refused:u,said:x}=N(c,n,o),i=e?b:w,v=(0,r.useRef)(null),f=e&&(i!==void 0||u!==null);j(v,f),(0,r.useEffect)(()=>{if(!f)return;let m,h=()=>m=setTimeout(()=>v.current?.matches(":hover, :focus-within")?h():d(),1e4);return h(),()=>clearTimeout(m)},[f,i?.batch,u,d]);let S=x||(e&&i?p(i):""),a=e?{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:R("toast"),width:"max-content",height:"auto",bottom:"calc(16px + env(safe-area-inset-bottom, 0px))",left:16,justifyItems:"start",color:"var(--graview-ink)",...f?{}:{display:"none"}}:{},T=i?(0,s.jsxs)("button",{type:"button","data-testid":"page-undo",title:`${p(i)} \u2014 \u2318Z or Ctrl+Z`,"aria-keyshortcuts":"Meta+Z Control+Z",onClick:m=>{let h=m.currentTarget.closest("[data-graview-face]");y(),requestAnimationFrame(()=>M(h))},...e?{style:U}:{className:H("graview-undo",l),...D(g),...t?{"data-compact":"","aria-label":p(i)}:{}},children:[(0,s.jsx)("span",{"aria-hidden":"true",children:"\u21B6"}),e?(0,s.jsx)("span",{style:K,children:p(i)}):(0,s.jsx)("span",{className:"graview-undo-words",children:t?"Undo":p(i)})]}):null;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{role:"status","aria-live":"polite",style:V,children:S}),(0,s.jsxs)("div",{ref:v,...e?{popover:"manual","data-graview-foot":"","data-graview-offstage":""}:{},"data-testid":e?"face-undo-dock":"page-undo-place",...e?{style:{...F,...a}}:{className:"graview-undo-place"},children:[e?null:(0,s.jsx)("style",{children:q}),e&&i?(0,s.jsxs)("div",{"data-testid":"page-undo-notice",style:Z,children:[T,(0,s.jsx)("button",{type:"button","data-testid":"page-undo-dismiss","aria-label":`Dismiss: ${p(i)}`,title:"Dismiss",onClick:m=>{let h=m.currentTarget.closest("[data-graview-face]");d(),requestAnimationFrame(()=>M(h))},style:$,children:"\xD7"})]}):T,u?(0,s.jsx)("span",{"data-testid":"page-undo-refused",role:"alert",className:"graview-undo-refused",...e?{style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-warn)",borderRadius:6,background:"var(--graview-float)",padding:"4px 8px"}}:{},children:u}):null]})]})}function j(c,e){(0,r.useLayoutEffect)(()=>{let n=c.current;if(!n||!e)return;if(typeof n.showPopover=="function"&&!k(n))try{n.showPopover()}catch{}let o=()=>n.parentElement?.closest("[data-embed-content]")??null,t=()=>{O(n,o()),dispatchEvent(new Event(C))};t(),addEventListener("resize",t),addEventListener("scroll",t,!0);let l=typeof ResizeObserver=="function"?new ResizeObserver(t):null;return l?.observe(n),()=>{if(l?.disconnect(),removeEventListener("resize",t),removeEventListener("scroll",t,!0),n.isConnected&&k(n))try{n.hidePopover()}catch{}dispatchEvent(new Event(C))}},[c,e])}var q=`:where(.graview-undo-place){display:grid;justify-items:end;gap:4px;max-width:100%;min-width:0}
|
|
2
2
|
:where(.graview-undo){box-sizing:border-box;display:inline-flex;align-items:center;gap:6px;min-height:var(--graview-control-height,36px);max-width:min(100%,var(--graview-undo-widest,18rem));min-width:0;padding:0 14px;border-radius:999px;border:1px solid var(--graview-edge);background:var(--graview-float);color:var(--graview-ink);font:inherit;font-size:.875rem;cursor:pointer}
|
|
3
3
|
:where(.graview-undo[data-size=sm]){--graview-control-height:30px}
|
|
4
4
|
:where(.graview-undo[data-compact]){padding:0 10px}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{F as g,G as T,Ga as C,T as v,ca as S}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{F as g,G as T,Ga as C,T as v,ca as S}from"./chunk.DBMZ3AQB.js";import{a as m}from"./chunk.SDO3U72B.js";import"./chunk.DIFR37EZ.js";import"./chunk.FQLNBIQ5.js";import{b as c}from"./chunk.AJZBJBMO.js";var n=c(T(),1),r=c(v(),1),s=null,u=null,f=new Set,a=()=>{for(let e of f)e()},y=e=>(f.add(e),()=>void f.delete(e)),E=300,d=()=>{u!==null&&clearTimeout(u),u=null};function q(e,t){d(),x.prefetch(),!(s?.element===t&&s.target.on===e.on)&&(s={target:e,element:t},a())}function M(e=!1){if(d(),s!==null){if(e){s=null,a();return}u=setTimeout(()=>{u=null,s=null,a()},E)}}var R=()=>d(),P=()=>s,b="graview:hover-chips",h;function A(e){if(h!==void 0)return h;try{return(e??localStorage).getItem(b)!=="off"}catch{return!0}}function I(e,t){h=e;try{(t??localStorage).setItem(b,e?"on":"off")}catch{}e||(s=null),a()}function w(){let e=S(),t=g(e?.ai),o=e?.memory,l=(0,n.useSyncExternalStore)(y,()=>A(o),()=>!1),i=(0,n.useCallback)(H=>I(H,o),[o]);return{offered:t,on:t&&l,set:i}}function z({legend:e,style:t,choice:o}){let l=w();return l.offered?(0,r.jsxs)("fieldset",{"data-testid":"setting-hover-chips",style:{border:0,margin:0,padding:0,display:"grid",gap:5,...t},children:[(0,r.jsx)("legend",{style:{...e,padding:0},children:"AI suggestions on hover"}),(0,r.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:"A quiet suggestion beside a record the pointer rests on, when the AI is sure of one."}),(0,r.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[!0,!1].map(i=>(0,r.jsx)("button",{type:"button","aria-pressed":l.on===i,"data-testid":`setting-hover-chips-${i?"on":"off"}`,onClick:()=>l.set(i),style:o(l.on===i),children:i?"On":"Off"},String(i)))})]}):null}var x=C(m(()=>(__graviewPreload(import.meta.url,["./chunk.N2DM42SG.js","./chunk.BJUUSIQY.js","./chunk.BCE6LIDR.js","./chunk.MBLFZF5R.js","./chunk.RALAID6N.js","./chunk.XOZU4OFA.js","./chunk.5NZDFT6R.js","./chunk.JBSW7ZNH.js","./chunk.FPGU43SC.js","./chunk.RQX4CQJN.js","./chunk.LUIRQ5UF.js","./chunk.N33WUCAN.js","./chunk.JQFIZRAZ.js","./chunk.LKJ6FD6Y.js","./chunk.DBMZ3AQB.js","./chunk.SDO3U72B.js","./chunk.DIFR37EZ.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.IRQOJATD.js")))),k=x.part((e,t)=>{let o=e.HoverChip;return(0,r.jsx)(o,{...t})},{quiet:!0}),p=null,O=()=>p;function L(){let{on:e}=w(),t=(0,n.useSyncExternalStore)(y,P,()=>null),[o]=(0,n.useState)(()=>Symbol("hover-chip")),l=(0,n.useSyncExternalStore)(y,O,()=>null);return(0,n.useEffect)(()=>{if(e)return p===null&&(p=o,a()),()=>{p===o&&(p=null,s=null,d(),a())}},[e,o,l]),!e||t===null||l!==o||!t.element.isConnected?null:(0,r.jsx)(n.Suspense,{fallback:null,children:(0,r.jsx)(k,{rest:t,hold:R,leave:M})})}export{L as HoverChipDoor,z as HoverChipsSwitch,R as holdRest,A as hoverChipsWanted,M as leaveRest,q as restOn,I as setHoverChipsWanted,w as useHoverChipsSetting};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as _}from"./chunk.
|
|
1
|
+
import{b as _}from"./chunk.LHIT3EZD.js";import"./chunk.JQFIZRAZ.js";import"./chunk.LKJ6FD6Y.js";import{G as se,T as U,ba as H,ea as Y}from"./chunk.DBMZ3AQB.js";import"./chunk.SDO3U72B.js";import{Zd as $,rb as z}from"./chunk.DIFR37EZ.js";import"./chunk.FQLNBIQ5.js";import{b as D}from"./chunk.AJZBJBMO.js";var u=D(se(),1);function L(e,t,s=!1){if(e<t.at||e===t.at&&s)return e;let i=t.at+t.removed.length;return e>=i?e+t.inserted.length-t.removed.length:s?t.at:t.at+t.inserted.length}var X=e=>e>=55296&&e<=56319,G=e=>e>=56320&&e<=57343;function V(e,t,s){let i=Math.min(e.length,t.length),n=0,l=Math.max(0,Math.min(i,t.length-s));for(;n<l&&e.charCodeAt(e.length-1-n)===t.charCodeAt(t.length-1-n);)n++;let r=0;for(;r<i-n&&e.charCodeAt(r)===t.charCodeAt(r);)r++;return r>0&&X(e.charCodeAt(r-1))&&r--,n>0&&G(e.charCodeAt(e.length-n))&&n--,{at:r,removed:e.slice(r,e.length-n),inserted:t.slice(r,t.length-n)}}function M(e,t){let s=Math.min(e.length,t.length),i=0;for(;i<s&&e.charCodeAt(i)===t.charCodeAt(i);)i++;i>0&&X(e.charCodeAt(i-1))&&i--;let n=0;for(;n<s-i&&e.charCodeAt(e.length-1-n)===t.charCodeAt(t.length-1-n);)n++;return n>0&&G(e.charCodeAt(e.length-n))&&n--,{at:i,removed:e.slice(i,e.length-n),inserted:t.slice(i,t.length-n)}}function q(e,t){let s=c=>c.at+c.removed.length;if(s(e)<t.at)return e;if(e.at>s(t))return{...e,at:e.at+t.inserted.length-t.removed.length};let i=Math.min(e.at,t.at),n=s(e)-s(t),l=e.removed.slice(0,t.at-i)+t.inserted+(n>0?e.removed.slice(e.removed.length-n):""),r=t.at<=e.at?t.inserted+e.inserted:e.inserted+t.inserted,d=M(l,r);return{...d,at:i+d.at}}function I(e,t){let s=L(e.start,t,!0),i=e.end===e.start?s:L(e.end,t);return{start:s,end:Math.max(s,i)}}function ce(e,t){let{kind:s,id:i,session:n}=e.author,l=`${s}:${i??""}:`;return t.startsWith(l)&&(!n||t.slice(l.length)===n)}function Z(e,t,s,i){let n=e.anchor,l=e.head;for(let d of s)if(!(d.seq<e.rev||ce(d,t)))for(let c of d.primitives)c.op!=="splice-text"||c.id!==e.node||c.field!==e.field||(n=L(n,c),l=L(l,c));let r=d=>Math.max(0,Math.min(i,d));return{start:r(n),end:r(l)}}var O=(e,t,s)=>e.ops.length>0&&e.ops.every(i=>{let n=i.mutation?.args;return i.mutation?.name===z&&n?.node===t&&n.field===s}),le=(e,t,s,i)=>t.ops.length>0&&t.ops.every(n=>n.undoes!==void 0)&&e.batches().some(n=>t.ops.some(l=>l.undoes===n.id||l.undoes===n.ops[0]?.id)&&O(n,s,i)),J=(e,t)=>e.author.kind==="human"&&(t?.id===void 0||e.author.id===void 0||e.author.id===t.id);function Q(e,t,s,i){let n=e.batches();for(let l=n.length-1;l>=0;l--){let r=n[l];if(!(!J(r,t)||r.undone||!O(r,s,i))&&e.canUndo(r.id).ok)return r.id}}function j(e,t,s,i){let n=e.batches();for(let l=n.length-1;l>=0;l--){let r=n[l];if(J(r,t)){if(O(r,s,i))return;if(le(e,r,s,i))return r.undone?void 0:r.id}}}var p=D(U(),1);function de(e){let{store:t}=H(),{live:s,nodeId:i,field:n}=e,[l,r]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let d=!0;return s.typing(i,n).then(c=>d&&r(c)),()=>{d=!1}},[i,n]),l&&!t.collaborative(i,n)?(0,p.jsx)(p.Fragment,{children:e.writtenWhole}):(0,p.jsx)(ue,{...e,typing:l})}function ue({nodeId:e,field:t,label:s,markdown:i,live:n,onDone:l,typing:r}){let{store:d,principal:c}=H(),m=Y(e),f=te(m?.[t]),[x,oe]=(0,u.useState)(!1),y=(0,u.useRef)(null),R=(0,u.useRef)(f),E=(0,u.useRef)(!1),B=(0,u.useRef)(n);B.current=n;let N=()=>te(d.graph.getNode(e)?.[t]);(0,u.useEffect)(()=>y.current?.focus(),[x,r]);let b=(0,u.useRef)(void 0),C=()=>{b.current===void 0&&(b.current=setTimeout(()=>{b.current=void 0;let o=y.current;if(!o||o.ownerDocument.activeElement!==o)return;let a=o.selectionDirection==="backward";B.current.sayCaret({node:e,field:t,anchor:a?o.selectionEnd:o.selectionStart,head:a?o.selectionStart:o.selectionEnd,rev:d.log.length})},fe))};(0,u.useEffect)(()=>()=>{clearTimeout(b.current),B.current.sayCaret(null)},[]);let W=o=>{let a=y.current;if(a){if(a.value!==o){let h=I({start:a.selectionStart,end:a.selectionEnd},M(a.value,o)),g=a.selectionDirection??"none";a.value=o,a.setSelectionRange(h.start,h.end,g)}R.current=o}},K=()=>{let o=y.current;if(!o||!r||E.current)return;let a=R.current,h=N(),g=V(a,o.value,o.selectionEnd);if(g.removed===""&&g.inserted==="")return W(h);let v=a===h?g:q(g,M(a,h));try{r.splice(v.at,v.removed.length,v.inserted)}catch{}let w=N();if(o.value!==w){o.value=w;let S=Math.min(w.length,v.at+v.inserted.length);o.setSelectionRange(S,S)}R.current=w,C()};(0,u.useLayoutEffect)(()=>{E.current||W(f)},[f]);let ie=async o=>{if(!r)return;r.flush();for(let h=0;r.waiting()>0&&h<100;h++)await new Promise(g=>setTimeout(g,30));let a=o?j(d,c,e,t):Q(d,c,e,t);if(a)try{o?d.redo(a,{author:c}):d.undo(a,{author:c})}catch{}},T=o=>{r?.flush(),n.sayCaret(null),l(o)},k=(0,u.useRef)(void 0);(0,u.useEffect)(()=>()=>k.current?.(),[]);let ae=o=>{k.current?.();let a=o.ownerDocument,h=y.current?.closest("[data-graview-live]"),g=A=>{let P=A.target;if(P instanceof Node&&h?.contains(P))return S();P instanceof Element&&P.closest(ee)||(S(),T(!0))},v=()=>{let A=a.activeElement;A!==null&&A!==a.body||o.isConnected&&he(o)||(S(),y.current?.focus({preventScroll:!0}))},w=new MutationObserver(v);w.observe(a.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["open","hidden"]}),a.addEventListener("focusin",g),a.addEventListener("toggle",v,!0);let S=()=>{k.current=void 0,w.disconnect(),a.removeEventListener("focusin",g),a.removeEventListener("toggle",v,!0)};k.current=S},F=[...n.who.values()].filter(o=>o.caret?.node===e&&o.caret.field===t);return(0,p.jsxs)("div",{style:{display:"grid",gap:8,minWidth:0},"data-graview-live":t,children:[x?(0,p.jsx)("div",{"data-graview-preview":t,"aria-label":`${s}, as it will read`,role:"region",style:me,children:(0,p.jsx)(_,{text:f,markdown:!0})}):(0,p.jsxs)("div",{style:{position:"relative",minWidth:0},children:[(0,p.jsx)("textarea",{ref:y,"aria-label":s,"data-graview-field":t,defaultValue:f,readOnly:!r,rows:3,onInput:K,onCompositionStart:()=>{E.current=!0},onCompositionEnd:()=>{E.current=!1,K()},onSelect:C,onFocus:C,onPointerDown:()=>r?.flush(),onKeyDown:o=>{let a=o.key;a==="Escape"?(o.preventDefault(),T(!1)):(o.metaKey||o.ctrlKey)&&!o.altKey&&a.toLowerCase()==="z"?(o.preventDefault(),ie(o.shiftKey)):(o.metaKey||o.ctrlKey)&&a==="Enter"?(o.preventDefault(),T(!1)):(a==="Enter"||ge.has(a))&&r?.flush()},onKeyUp:C,onBlur:o=>{r?.flush(),n.sayCaret(null);let a=o.relatedTarget;if(a instanceof Node&&o.currentTarget.closest("[data-graview-live]")?.contains(a))return;let h=a instanceof Element?a.closest(ee):null;if(h)return ae(h);T(!0)},style:ve}),F.length>0?(0,p.jsx)(pe,{text:f,others:F,area:y,log:d.log.all()}):null]}),(0,p.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,p.jsx)("button",{type:"button",onClick:()=>T(!1),style:ne,children:"Done"}),i?(0,p.jsx)("button",{type:"button","aria-pressed":x,onClick:()=>oe(!x),style:ne,children:x?"Write":"Preview"}):null,(0,p.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"Saved as you type \xB7 Ctrl or \u2318 Z takes back your typing"})]})]})}function pe({text:e,others:t,area:s,log:i}){let n=(0,u.useRef)(null);(0,u.useLayoutEffect)(()=>{let c=s.current,m=n.current;if(!c||!m)return;let f=()=>{m.scrollTop=c.scrollTop};return f(),c.addEventListener("scroll",f),()=>c.removeEventListener("scroll",f)});let l=t.map(c=>({one:c,at:Z(c.caret,c.participant,i,e.length).end})).sort((c,m)=>c.at-m.at),r=[],d=0;for(let{one:c,at:m}of l){r.push(e.slice(d,m)),d=m;let f=$(c)||"Somebody";r.push((0,p.jsx)("span",{"data-graview-caret":c.participant,title:`${f} is typing here`,style:{borderLeft:`2px solid hsl(${Math.round(c.hue)} 55% 52%)`,marginLeft:-1,marginRight:-1,pointerEvents:"auto"}},c.participant))}return r.push(`${e.slice(d)}\u200B`),(0,p.jsx)("div",{ref:n,"aria-hidden":"true",style:ye,children:r})}var ee='[data-graview-overlay], dialog, [role="dialog"], [role="alertdialog"], [popover]',he=e=>{if(e.hasAttribute("hidden")||e instanceof HTMLDialogElement&&!e.open)return!1;if(e.hasAttribute("popover"))try{return e.matches(":popover-open")}catch{}return!0},fe=120,te=e=>typeof e=="string"?e:"",ge=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"]),me={minHeight:"7.5em",padding:"8px 10px",border:"1px dashed var(--graview-edge-bright)",borderRadius:6,lineHeight:1.6,minWidth:0},ne={font:"inherit",fontSize:"0.8125rem",minHeight:28,padding:"2px 12px"},re={font:"inherit",lineHeight:1.5,width:"100%",boxSizing:"border-box",minHeight:"7.5em",padding:"8px 10px",borderRadius:6},ve={...re,resize:"vertical",fieldSizing:"content",color:"var(--graview-ink)",background:"var(--graview-panel, transparent)",border:"1px solid var(--graview-edge-bright)"},ye={...re,position:"absolute",inset:0,height:"100%",border:"1px solid transparent",color:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word",overflow:"hidden",pointerEvents:"none"};export{de as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as a}from"./chunk.
|
|
1
|
+
import{e as a}from"./chunk.47T3KUAA.js";import{l as i}from"./chunk.DBMZ3AQB.js";import{Fd as o}from"./chunk.DIFR37EZ.js";function p(t){let r=t.within??{};return o({...r.sort?{sort:r.sort}:{},...r.filter?{filter:r.filter}:{},...r.group?{group:r.group}:{},...r.q?{q:r.q}:{},...r.archived?{archived:r.archived}:{}})}function c(t,r){let m=a(r),e=t;for(let n of["sort","filter","group","q","archived"])e=i(e,n,m[n]??null);return e}export{p as a,c as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ee,b as re,c as R}from"./chunk.
|
|
1
|
+
import{a as ee,b as re,c as R}from"./chunk.5IEFTFKQ.js";import{a as O,b as B}from"./chunk.4UQBMFJZ.js";import{a as Y,e as Z}from"./chunk.QMYHXMRV.js";import{e as z,f as J,g as _,h as Q,i as U,j as X}from"./chunk.Z5UVYOGC.js";import"./chunk.VSGTNYM2.js";import{G as q,Ia as j,Ja as M,M as H,O as T,T as G,ca as b,ja as x,ma as V,na as D,pa as C,ra as I}from"./chunk.DBMZ3AQB.js";import"./chunk.SDO3U72B.js";import"./chunk.DIFR37EZ.js";import"./chunk.FQLNBIQ5.js";import{b as v}from"./chunk.AJZBJBMO.js";var i=v(q(),1);var o=v(G(),1),ne=e=>({...e.node?{node:{id:e.node.id}}:{},...e.nodes?{nodes:e.nodes.map(n=>({id:n.id}))}:{},...e.label!==void 0?{label:e.label}:{},fidelity:e.fidelity,cardinality:e.cardinality,mode:e.mode,selected:e.selected,...e.implicated?{implicated:e.implicated}:{},...e.flagged?{flagged:e.flagged}:{}});function E(e){let n=T(),r=n?.past?.seq,s=n?.host?.viewAt,t=(0,i.useMemo)(()=>r===void 0||!s||e.draft?void 0:s(e.manifest.name,r),[s,r,e]);return(0,i.useMemo)(()=>t===null?null:t===void 0?e:{...e,worker:t},[t,e])}function N({definition:e,store:n,principal:r,input:s,goTo:t,places:a,scheme:d,brand:l,onFailure:m,drawsItsOwn:u,tick:p}){let w=(0,i.useRef)(null),f=(0,i.useRef)(null),y=H(),k=(0,i.useContext)(M),c=(0,i.useRef)({input:s,goTo:t,places:a,onFailure:m,brand:l,hostFiles:y,told:k});c.current={input:s,goTo:t,places:a,onFailure:m,brand:l,hostFiles:y,told:k},(0,i.useEffect)(()=>{let P=w.current;if(!P)return;let A=e.file??(c.current.hostFiles?.src?g=>c.current.hostFiles?.src?.(g)??g:void 0);typeof e.worker=="function"&&R(e.worker).catch(()=>{});let $=B(O,({mountWorkerView:g})=>{f.current=g(P,{manifest:e.manifest,worker:e.worker,store:n,principal:r,input:()=>c.current.input?.()??{},goTo:()=>c.current.goTo,places:()=>c.current.places?.()??[],brand:()=>c.current.brand,onFailure:(W,K)=>c.current.onFailure(W,K),...u?{fallback:!1}:{},...e.limits?{limits:e.limits}:{},...e.author?{author:e.author}:{},...e.onProblem?{onProblem:e.onProblem}:{},...e.asset?{asset:e.asset}:{},...A?{file:A}:{},...e.images?{images:e.images}:{},...e.links?{links:e.links}:{},files:()=>c.current.hostFiles,onContentHeight:W=>c.current.told?.(W)})});return()=>{$(),f.current?.dispose(),f.current=null}},[e,n,r]),(0,i.useEffect)(()=>f.current?.update(),[d,l,p]);let h=(0,o.jsx)("div",{ref:w,"data-worker-view-place":e.manifest.name,style:{minWidth:0}});if(!e.draft)return h;let F=e.manifest.title??e.manifest.name;return(0,o.jsxs)("div",{role:"group","aria-label":`Draft: ${F}`,"data-graview-draft-view":e.manifest.name,style:{display:"grid",gap:8,alignContent:"start",minWidth:0},children:[(0,o.jsxs)("p",{"data-testid":"draft-view-line",style:te,children:[(0,o.jsxs)("span",{children:["Draft \u2014 ",(0,o.jsx)("span",{style:{color:"var(--graview-ink)",fontWeight:600},children:F})]}),(0,o.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,o.jsx)("span",{children:"Not kept"})]}),h]})}var te={margin:0,display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 8px",fontSize:"0.875rem",color:"var(--graview-ink-muted)",borderBottom:"1px solid var(--graview-edge)",paddingBottom:8};function L({view:e,props:n,fellBack:r}){return(0,o.jsx)("div",{"data-worker-view-fallback":"",...r?{"data-worker-view-fell-back":r.name,"data-worker-view-failed":r.reason}:{},style:{display:"contents"},children:(0,o.jsx)(e,{...n})})}function oe({name:e,reason:n,children:r}){return(0,o.jsx)("div",{"data-worker-view-fell-back":e,"data-worker-view-failed":n,style:{display:"contents"},children:r})}function S(e,n={}){let r=n.fallback,s=e.manifest.replaces==="page";function t(a){let d=b(),l=x(),m=(0,i.useContext)(j),[u,p]=(0,i.useState)(null),w=(0,i.useRef)(a);w.current=a;let f=E(e);if(!d)return null;if(f===null)return r&&!(m&&V(r)&&!s)?(0,o.jsx)(L,{view:r,props:a}):null;if(u&&r)return m&&V(r)&&!s?null:(0,o.jsx)(L,{view:r,props:a,fellBack:{name:e.manifest.name,reason:u}});let y=n.beside&&!(m&&V(n.beside))?n.beside:void 0,k=(0,o.jsx)(N,{definition:f,store:d.store,principal:d.principal,input:()=>ne(w.current),goTo:l,places:()=>d.views.places(),scheme:d.scheme,brand:d.brand,tick:a,drawsItsOwn:r!==void 0,onFailure:(c,h)=>{p(c),e.onFailure?.(c,h)}});return y?(0,o.jsxs)("div",{"data-worker-view-beside":e.manifest.name,style:{display:"grid",gap:12,minWidth:0},children:[k,(0,o.jsx)(y,{...a})]}):k}return t.displayName=`WorkerView(${e.manifest.name})`,t}function ae(e,n){let{manifest:r}=n;if(r.attach==="home"){if(!e.home)throw new Error(`The worker view "${r.name}" is the home's body: draw it with workerHome, on the home.`);let u=e.homes?.(),p=n.draft?void 0:u?u.filter(f=>f.name===void 0).at(-1)?.view:e.homeView?.(),w=S(n,p?{fallback:p}:{});return e.home(r.bleed===!0?C(w):w,n.draft?void 0:{name:r.name}),e}let s={cardinality:r.cardinality,fidelity:"full"},t=e.lookup(r.attach,s)??e.resolve(r.attach,s)?.view,a=r.cardinality==="one",d=n.draft===!0,l=S(n,{...t&&!d?{fallback:t}:{},...a&&r.replaces!=="page"&&t?{beside:t}:{}});r.replaces==="page"&&D(l);let m=t?.says;return a&&r.replaces!=="page"&&typeof m=="function"&&(l.says=m),r.bleed===!0&&C(l),l.flows=r.flows!==!1,r.heading==="own"&&(l.ownHeading=!0),I(l,r.scene?.maxHeight!==void 0?{maxHeight:r.scene.maxHeight}:{}),e.register(r.attach,s,l,r.title?{title:r.title,...d?{}:{name:r.name},lens:"view",...r.reads?.kinds?.length?{reads:r.reads.kinds}:{}}:d?void 0:{name:r.name}),e}function ie(e,n={}){let r=n.fallback;function s({context:t}){let a=b(),d=x(),[l,m]=(0,i.useState)(null),u=E(e);return l&&r?(0,o.jsx)(oe,{name:e.manifest.name,reason:l,children:(0,o.jsx)(r,{context:t})}):u===null&&r?(0,o.jsx)(r,{context:t}):u===null?null:(0,o.jsx)(N,{definition:u,store:t.store,principal:t.principal??a?.principal??{kind:"human"},goTo:d,...a?{places:()=>a.views.places(),scheme:a.scheme,brand:a.brand}:{},drawsItsOwn:r!==void 0,onFailure:(p,w)=>{m(p),e.onFailure?.(p,w)}})}return s.displayName=`WorkerHome(${e.manifest.name})`,s}export{J as checkManifest,ee as checkViewSource,Z as judgeCodeAct,z as manifestActs,U as readsComputed,ae as registerWorkerView,Y as sightIsTotal,_ as unreadEdges,Q as unreadEdgesSentence,re as viewScript,ie as workerHome,S as workerView,X as workerViewProps};
|
|
@@ -1,6 +1,6 @@
|
|
|
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{G as C,Ga as K,T as k}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{G as C,Ga as K,T as k}from"./chunk.DBMZ3AQB.js";import{a as H}from"./chunk.SDO3U72B.js";import{b}from"./chunk.AJZBJBMO.js";var n=b(C(),1),N=450,_=10,O=t=>t instanceof HTMLInputElement?t.dataset.graviewChooseBox??void 0:void 0,q={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:-1/0,End:1/0},S=t=>t instanceof Element?t.closest("[data-graview-choose]"):null,G=t=>t instanceof HTMLElement&&(t.isContentEditable||t instanceof HTMLInputElement&&t.type!=="checkbox"||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement);function Y(t){let[i,d]=(0,n.useState)(()=>new Set),l=(0,n.useRef)(null),x=(0,n.useRef)(null),[E,P]=(0,n.useState)(null),R=E!==null&&t.includes(E)?E:t[0],L=(0,n.useMemo)(()=>t.filter(e=>i.has(e)),[t,i]),M=(0,n.useMemo)(()=>new Set(t),[t]);(0,n.useEffect)(()=>{[...i].some(e=>!M.has(e))&&d(e=>new Set([...e].filter(o=>M.has(o))))},[M,i]);let u=(0,n.useCallback)((e,o=!1)=>{let a=l.current;d(s=>{let r=new Set(s),f=a===null?-1:t.indexOf(a),y=t.indexOf(e);if(o&&f>=0&&y>=0){let T=s.has(a);for(let p of t.slice(Math.min(f,y),Math.max(f,y)+1))T?r.add(p):r.delete(p)}else r.has(e)?r.delete(e):r.add(e);return r}),l.current=e},[t]),v=(0,n.useCallback)(e=>d(new Set(e)),[]),A=(0,n.useCallback)(()=>{l.current=null,d(new Set)},[]),c=(0,n.useRef)(null),g=(0,n.useRef)(!1),m=L.length>0,h=()=>{c.current&&clearTimeout(c.current.timer),c.current=null};(0,n.useEffect)(()=>h,[]);let B={ref:x,onKeyDown:e=>{if(G(e.target))return;let o=O(e.target);if(e.key==="Tab"&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&o!==void 0&&m){let s=document.querySelector('[data-testid="several-bar"]'),r=s?.querySelector("[data-mutation]:not([disabled])")??s?.querySelector("button:not([disabled])");if(r){e.preventDefault(),e.stopPropagation(),r.focus();return}}let a=q[e.key];if(o!==void 0&&a!==void 0&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let s=t.indexOf(o),r=t[Math.max(0,Math.min(t.length-1,s+(Number.isFinite(a)?a:a>0?t.length:-t.length)))];if(e.preventDefault(),e.stopPropagation(),r===void 0||r===o)return;if(e.shiftKey){let f=l.current!==null&&t.includes(l.current)?l.current:o,[y,T]=[t.indexOf(f),t.indexOf(r)].sort((p,F)=>p-F);d(p=>new Set([...p,...t.slice(y,T+1)])),l.current=f}P(r),x.current?.querySelector(`[data-graview-choose-box="${CSS.escape(r)}"]`)?.focus();return}if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="a"){e.preventDefault(),e.stopPropagation(),v(t);return}if(e.key===" "&&!e.metaKey&&!e.ctrlKey){let s=S(e.target),r=e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement&&e.target.type==="checkbox";if(!s||r)return;e.preventDefault(),u(s.dataset.graviewChoose,e.shiftKey)}},onFocus:e=>{let o=O(e.target);o!==void 0&&P(o)},onPointerDown:e=>{if(g.current=!1,e.pointerType==="mouse"||e.button>0)return;let o=S(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox")return;let a=o.dataset.graviewChoose;h(),c.current={id:a,x:e.clientX,y:e.clientY,timer:setTimeout(()=>{c.current=null,g.current=!0,u(a)},N)}},onPointerMove:e=>{let o=c.current;o&&Math.hypot(e.clientX-o.x,e.clientY-o.y)>_&&h()},onPointerUp:h,onPointerCancel:h,onClickCapture:e=>{let o=S(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox"&&e.target.hasAttribute("data-graview-choose-box"))return;if(g.current){g.current=!1,e.preventDefault(),e.stopPropagation();return}let s=o.dataset.graviewChoose;if(e.shiftKey&&(m||l.current!==null)){e.preventDefault(),e.stopPropagation(),u(s,!0);return}m&&matchMedia?.("(pointer: coarse)").matches&&(e.preventDefault(),e.stopPropagation(),u(s))},onContextMenu:e=>{(g.current||c.current)&&(e.preventDefault(),e.stopPropagation())},...m?{"data-graview-choosing":""}:{}},j=(0,n.useCallback)(e=>i.has(e),[i]);return{chosen:L,has:j,toggle:u,choose:v,clear:A,listProps:B,boxProps:(e,o)=>({type:"checkbox",className:"graview-choose-box","data-graview-choose-box":e,"aria-label":`Choose ${o}`,tabIndex:e===R?0:-1,checked:i.has(e),onChange:()=>{},onClick:a=>{a.stopPropagation(),u(e,a.shiftKey)}}),list:x}}var $=`
|
|
2
2
|
.graview-choose-box{width:24px;height:24px;margin:0;accent-color:var(--graview-accent);cursor:pointer;opacity:0}
|
|
3
3
|
[data-graview-choose]:hover .graview-choose-box,[data-graview-choose]:focus-within .graview-choose-box,.graview-choose-box:focus-visible,.graview-choose-box:checked,[data-graview-choosing] .graview-choose-box{opacity:1}
|
|
4
4
|
[data-graview-choose]{-webkit-touch-callout:none}
|
|
5
5
|
[data-graview-choosing] [data-graview-choose]{-webkit-user-select:none;user-select:none}
|
|
6
|
-
`;var D=b(C(),1),w=b(k(),1),I=K(H(()=>(__graviewPreload(import.meta.url,["./chunk.
|
|
6
|
+
`;var D=b(C(),1),w=b(k(),1),I=K(H(()=>(__graviewPreload(import.meta.url,["./chunk.547FQPYG.js","./chunk.XVN3CQKH.js","./chunk.DJ4A76SX.js","./chunk.VDS3IOTK.js","./chunk.I2NI7CT7.js","./chunk.7ML2BWSP.js","./chunk.BCE6LIDR.js","./chunk.MBLFZF5R.js","./chunk.5NZDFT6R.js","./chunk.MB7LKKUD.js","./chunk.7INWDFNG.js","./chunk.FPGU43SC.js","./chunk.V6FUYRZI.js","./chunk.5BPRGXIW.js","./chunk.BZEJM2PY.js","./chunk.CMLNBJZG.js","./chunk.RQX4CQJN.js","./chunk.LUIRQ5UF.js","./chunk.N33WUCAN.js","./chunk.JQFIZRAZ.js","./chunk.LKJ6FD6Y.js","./chunk.DBMZ3AQB.js","./chunk.SDO3U72B.js","./chunk.DIFR37EZ.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.Q6OZLBNL.js")))),U=I.part((t,i)=>(0,w.jsx)(t.SeveralBar,{...i}),{what:"The selection bar"});function Q(t){return t.chosen.length===0?null:(0,w.jsx)(D.Suspense,{fallback:null,children:(0,w.jsx)(U,{...t})})}var W=()=>I.prefetch();export{Y as a,$ as b,Q as c,W as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O,b}from"./chunk.
|
|
1
|
+
import{a as O,b}from"./chunk.53U6E5LD.js";import"./chunk.PQMMISCQ.js";import"./chunk.5BPRGXIW.js";import"./chunk.BZEJM2PY.js";import"./chunk.CMLNBJZG.js";import"./chunk.JQFIZRAZ.js";import"./chunk.LKJ6FD6Y.js";import{G as z,T as M,ba as S}from"./chunk.DBMZ3AQB.js";import"./chunk.SDO3U72B.js";import{ed as A}from"./chunk.DIFR37EZ.js";import"./chunk.FQLNBIQ5.js";import{b as v}from"./chunk.AJZBJBMO.js";var o=v(z(),1);var t=v(M(),1);function G(i){for(let d of i)for(let[r,s]of Object.entries(d))if(s===!1)return`${r} == true`;return""}var w={margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function $({ask:i,close:d}){let{store:r,principal:s,subscriptions:h,app:f}=S(),c=(0,o.useRef)(null),p=(0,o.useId)(),[n,u]=(0,o.useState)(0),[l,y]=(0,o.useState)(!0),[m,P]=(0,o.useState)(()=>{let e=i.choices.find(g=>g.on==="reaches");if(!e)return"";let a=e.record!==void 0?r.graph.getNode(e.record):void 0;return G(a?[a]:r.graph.nodesOfKind(e.kind).slice(0,5))}),[C,x]=(0,o.useState)(null),[W,k]=(0,o.useState)(!1);(0,o.useEffect)(()=>{let e=c.current;e&&!e.open&&e.showModal()},[]);let T=()=>{let e=i.returnTo;d(),requestAnimationFrame(()=>{e?.isConnected?e.focus():document.querySelector("[data-graview-page-title], main h1, [data-testid='activity-button']")?.focus()})},N=e=>e.on==="reaches"?{...e,condition:m}:e,E=e=>b(r,{when:N(e),alsoMine:!l}),L=async()=>{let e=N(i.choices[n]),a=O(r,e);if(a){x(a);return}k(!0);try{await h.add({who:A(s),app:f?.name??"app",when:e,...l?{}:{alsoMine:!0}}),T()}catch(g){k(!1),x(g instanceof Error?g.message:String(g))}};return(0,t.jsx)("dialog",{ref:c,"aria-labelledby":p,"data-testid":"notify-sheet",onClose:T,onClick:e=>{e.target===e.currentTarget&&e.currentTarget.close()},style:{width:"min(92vw, 420px)",padding:0,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)"},children:(0,t.jsxs)("form",{method:"dialog",onSubmit:e=>{e.preventDefault(),L()},style:{display:"grid",gap:12,padding:18},children:[(0,t.jsx)("h2",{id:p,style:{margin:0,fontSize:"1.0625rem"},children:"Notify me"}),(0,t.jsxs)("fieldset",{style:{margin:0,padding:0,border:0,display:"grid",gap:6},children:[(0,t.jsx)("legend",{style:{...w,marginBottom:6},children:"Tell me"}),i.choices.map((e,a)=>(0,t.jsxs)("label",{style:{display:"flex",gap:8,alignItems:"baseline",cursor:"pointer"},children:[(0,t.jsx)("input",{type:"radio",name:`${p}-when`,checked:n===a,onChange:()=>u(a),"data-notify-choice":e.on}),(0,t.jsx)("span",{children:e.on==="reaches"?`When ${e.record!==void 0?"it":"one"} reaches a condition`:E(e)})]},a))]}),i.choices[n]?.on==="reaches"?(0,t.jsxs)("label",{style:{display:"grid",gap:4},children:[(0,t.jsx)("span",{style:w,children:"The condition, in the app's own words (done == true, amount > 100)"}),(0,t.jsx)("input",{value:m,onChange:e=>P(e.target.value),"data-testid":"notify-condition",autoComplete:"off",spellCheck:!1})]}):null,(0,t.jsxs)("label",{style:{display:"flex",gap:8,alignItems:"center"},children:[(0,t.jsx)("input",{type:"checkbox",checked:l,onChange:e=>y(e.target.checked),"data-testid":"notify-others-only"}),"Only when someone else does it"]}),(0,t.jsxs)("p",{style:w,"data-testid":"notify-said",children:[E(i.choices[n]),"."]}),C?(0,t.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-danger, var(--graview-ink))"},children:C}):null,(0,t.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[(0,t.jsx)("button",{type:"button",onClick:()=>c.current?.close(),children:"Cancel"}),(0,t.jsx)("button",{type:"submit",autoFocus:!0,disabled:W,"data-testid":"notify-keep",style:{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"},children:"Notify me"})]})]})})}function j({style:i}){let{store:d,principal:r,subscriptions:s,app:h}=S(),f=(r.onBehalfOf??r).id,[c,p]=(0,o.useState)([]);return(0,o.useEffect)(()=>{if(f===void 0)return;let n=!0,u=()=>void Promise.resolve(s.list(f)).then(y=>n&&p(y.filter(m=>m.app===(h?.name??"app"))),()=>n&&p([]));u();let l=s.onChange?.(u);return()=>{n=!1,l?.()}},[s,f,h]),c.length===0?null:(0,t.jsxs)("section",{"aria-label":"What you are told of","data-testid":"notified",style:{display:"grid",gap:6,...i},children:[(0,t.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"You are told"}),(0,t.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:c.map(n=>(0,t.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"baseline",justifyContent:"space-between"},"data-subscription":n.id,children:[(0,t.jsx)("span",{style:{fontSize:"0.8125rem"},children:b(d,n)}),(0,t.jsx)("button",{type:"button","data-testid":"notify-stop","aria-label":`Stop: ${b(d,n)}`,onClick:u=>{let l=u.currentTarget.closest("li"),y=(l?.nextElementSibling??l?.previousElementSibling)?.querySelector("button");Promise.resolve(s.remove(n.id)).then(()=>(y??document.querySelector("[data-testid='activity-button']"))?.focus())},style:{padding:"1px 8px",fontSize:"0.8125rem"},children:"Stop"})]},n.id))})]})}export{j as NotifiedList,$ as NotifySheet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h}from"./chunk.
|
|
1
|
+
import{a as h}from"./chunk.N33WUCAN.js";import{Aa as b,D as g,H as k,J as w,Ob as x,xa as u}from"./chunk.DIFR37EZ.js";var s=i=>i?._zod?.def,O=Symbol.for("@graview/core:collaborative"),v=/^\^\\d\{4\}-\\d\{2\}-\\d\{2\}\$$/;function S(i){let n=s(i),p=!0,a;for(let e=0;n&&e<4;e++){if(n.type==="optional"||n.type==="nullable")p=!1;else if(n.type==="default")p=!1,a=n.defaultValue;else break;n=s(n.innerType)}if(!n)return{why:"it is not a zod field"};let l=g(i),r={...p?{required:!0}:{},...a!==void 0?{default:a}:{},...l?{description:l}:{}},f=(n.checks??[]).map(e=>s(e)),c=u(i);if(c)return{spec:{type:c,...r}};if(b(i))return{spec:{type:"app-link",...r}};let d;for(let e=s(i),t=0;e&&d===void 0&&t<4;e=s(e.innerType),t++)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(n.type){case"string":{let e=n.format;return e==="email"?{spec:{type:"email",...r}}:e==="url"?{spec:{type:"url",...r}}:e==="date"?{spec:{type:"date",...r}}:e==="datetime"||f.some(t=>t?.fn===w)?{spec:{type:"datetime",...r}}:f.some(t=>t?.format==="regex"&&(v.test(String(t?.pattern?.source??""))||t?.pattern?.source===k.source))?{spec:{type:"date",...r}}:{spec:{type:"string",...r,...m("string")}}}case"number":{let e={};for(let t of f){let o=t?.value;typeof o=="number"&&(t?.check==="greater_than"&&t.inclusive?e.min=Math.max(e.min??o,o):t?.check==="less_than"&&t.inclusive?e.max=Math.min(e.max??o,o):t?.check==="multiple_of"&&(e.step=o))}return{spec:{type:f.some(t=>t?.format==="safeint"||t?.format==="int")?"integer":"number",...e,...r}}}case"boolean":return{spec:{type:"boolean",...r}};case"enum":{let e=Object.keys(n.entries??{});return e.length>0?{spec:{type:"enum",options:e,...r}}:{why:"it is an enum with no options"}}case"array":{let e=s(n.element),t=u(n.element)??(e?.type==="number"?"number":e?.type==="string"?"string":void 0);return t?{spec:{type:"list",of:t,...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(n.type)}, which a document has no field type for`}}}function T(i){let n=S(i);return"spec"in n?n.spec:void 0}export{T as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{G as w,Na as c,aa as f,ba as h,da as g}from"./chunk.
|
|
1
|
+
import{G as w,Na as c,aa as f,ba as h,da as g}from"./chunk.DBMZ3AQB.js";import{b as m}from"./chunk.AJZBJBMO.js";var d=m(w(),1);function j(){let e=c();return(0,d.useMemo)(()=>[...new Set(e.flatMap(n=>n.nodeIds))],[e])}function x(){let e=I(),n=f();return(0,d.useMemo)(()=>{if(!n)return e;let t=n.matched;return t.length===0&&e.length===0?[k]:[...new Set([...e,...t])]},[n,e])}function I(){let{store:e,selection:n}=h(),t=g(),r=c();return(0,d.useMemo)(()=>{if(n.length===0)return v;let u=n.join(`
|
|
2
2
|
`),s=y.get(e);if(s&&s.violations===r&&s.key===u)return s.reached;let a=new Set(n),i=new Set(a);for(let o of e.graph.allEdges())a.has(o.from)&&i.add(o.to),a.has(o.to)&&i.add(o.from);for(let o of r)if(o.subjectId!==void 0&&a.has(o.subjectId))for(let p of o.nodeIds)i.add(p);let l=[...i];return y.set(e,{violations:r,key:u,reached:l}),l},[e,n,t,r])}var v=[],y=new WeakMap,k="search:nothing";export{j as a,x as b,I as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as y,b as h}from"./chunk.
|
|
1
|
+
import{a as y,b as h}from"./chunk.53U6E5LD.js";import"./chunk.PQMMISCQ.js";import"./chunk.5BPRGXIW.js";import"./chunk.BZEJM2PY.js";import"./chunk.CMLNBJZG.js";import{ed as b}from"./chunk.DIFR37EZ.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var k=(d,i)=>({id:i.id,said:h(d,i),when:i.when,...i.alsoMine?{alsoMine:!0}:{}});async function A(d,i,t){let a=b(t.principal);if(a.id===void 0)return{ok:!1,error:"This seat acts for nobody the app knows by id, so there is nobody to tell. Nothing was kept."};let r=t.store.seenBy(a),p=async()=>(await t.subscriptions.list(a.id)).filter(n=>n.app===t.app);if(d==="list_subscriptions")return{ok:!0,data:{subscriptions:(await p()).map(n=>k(r,n))}};if(d==="unsubscribe"){let n=String(i.id??"");return(await p()).some(g=>g.id===n)?(await t.subscriptions.remove(n),{ok:!0,data:{removed:n}}):{ok:!1,error:`No subscription "${n}" of yours. list_subscriptions says which there are.`}}let o=String(i.on??""),c=n=>typeof i[n]=="string"&&i[n].trim()!==""?i[n].trim():void 0,e=c("record");if(e!==void 0&&!r.graph.getNode(e)){let n=t.store.resolveRef({name:"record",kinds:["*"]},e,a);if(!n.ok)return{ok:!1,error:`${n.message} Nothing was kept.`};e=n.id}let s=c("kind")??(e!==void 0&&o!=="act"?r.graph.getNode(e)?.kind:void 0),f=c("act"),m=c("condition"),u=o==="act"?{on:o,...f!==void 0?{act:f}:{},...e!==void 0?{record:e}:{}}:o==="created"&&s!==void 0?{on:o,kind:s}:o==="changed"?{on:o,...s!==void 0&&e===void 0?{kind:s}:{},...e!==void 0?{record:e}:{}}:o==="reaches"&&s!==void 0?{on:o,kind:s,condition:m??"",...e!==void 0?{record:e}:{}}:void 0;if(!u)return{ok:!1,error:'Say what to be told of: on is "act", "created", "changed" or "reaches", with a kind (or a record) for all but act. Nothing was kept.'};let l=y({schema:r.schema,allMutations:()=>t.store.allMutations(),graph:r.graph},u);if(l)return{ok:!1,error:`${l} Nothing was kept.`};let S=await t.subscriptions.add({who:a,app:t.app,when:u,...i.alsoMine===!0?{alsoMine:!0}:{}});return{ok:!0,data:{subscription:k(r,S)}}}export{A as runSubscriptionTool};
|