graview 0.1.63 → 0.1.65
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.2P34ML3O.js +111 -0
- package/dist/preview/{chunk.A2R53GWF.js → chunk.2PK335JQ.js} +1 -1
- package/dist/preview/{chunk.NIAM7OTV.js → chunk.2QQ37RCZ.js} +1 -1
- package/dist/preview/{chunk.FGDGTES4.js → chunk.2TZSLREX.js} +2 -2
- package/dist/preview/chunk.2UW5CRHF.js +1 -0
- package/dist/preview/{chunk.H7AH3IW4.js → chunk.2YMO7ZVX.js} +1 -1
- package/dist/preview/chunk.33ULA3CG.js +1 -0
- package/dist/preview/{chunk.HMMK7LCL.js → chunk.35E75QJ7.js} +1 -1
- package/dist/preview/chunk.3CJLAJXP.js +25 -0
- package/dist/preview/chunk.3IJSB5ET.js +1 -0
- package/dist/preview/{chunk.OM2NIQWA.js → chunk.3IZEZPJB.js} +1 -1
- package/dist/preview/chunk.3KO35VN4.js +1 -0
- package/dist/preview/{chunk.Q2EGESEZ.js → chunk.3KUYB5ZT.js} +1 -1
- package/dist/preview/chunk.3RFAUIGT.js +1 -0
- package/dist/preview/{chunk.Q4GJIJAU.js → chunk.3WP66LB5.js} +1 -1
- package/dist/preview/{chunk.2RASWDMQ.js → chunk.44ZHHPPJ.js} +2 -2
- package/dist/preview/chunk.4GJ7F4SP.js +35 -0
- package/dist/preview/{chunk.4MEQUUG4.js → chunk.4IJTPV5X.js} +1 -1
- package/dist/preview/{chunk.DWK3GXRR.js → chunk.4JFBLVXJ.js} +1 -1
- package/dist/preview/{chunk.XUXZW7DU.js → chunk.4O3C2LJF.js} +1 -1
- package/dist/preview/chunk.4PCVQEVI.js +1 -0
- package/dist/preview/{chunk.WBS7ND2C.js → chunk.5FQSYMAE.js} +1 -1
- package/dist/preview/chunk.5M34BJIQ.js +1 -0
- package/dist/preview/chunk.5NCLZ4NZ.js +1 -0
- package/dist/preview/{chunk.36OE6RKG.js → chunk.5THLLSS4.js} +1 -1
- package/dist/preview/chunk.5YNLFOBJ.js +5 -0
- package/dist/preview/{chunk.DZSZUX34.js → chunk.64FCAUAJ.js} +1 -1
- package/dist/preview/chunk.6RZHKQP3.js +1 -0
- package/dist/preview/chunk.6YDC6IDA.js +1 -0
- package/dist/preview/{chunk.BN7C5ZYX.js → chunk.74B6KQF4.js} +1 -1
- package/dist/preview/chunk.77XQEDT5.js +1 -0
- package/dist/preview/chunk.7E4CSXBT.js +1 -0
- package/dist/preview/chunk.7HPQI5SY.js +1 -0
- package/dist/preview/{chunk.Y4ZM75WL.js → chunk.7IGD2K4M.js} +1 -1
- package/dist/preview/{chunk.2F4AZZQR.js → chunk.7Q43N5JS.js} +1 -1
- package/dist/preview/{chunk.KB5BCW23.js → chunk.7VQ3C7F4.js} +1 -1
- package/dist/preview/{chunk.MT5DXJKN.js → chunk.A4VA3DU5.js} +1 -1
- package/dist/preview/{chunk.6Z2GHQQH.js → chunk.AB4RZSYW.js} +31 -23
- package/dist/preview/chunk.ABSY3UZF.js +1 -0
- package/dist/preview/chunk.ARHAD5IS.js +1 -0
- package/dist/preview/chunk.BOC2EOGB.js +9 -0
- package/dist/preview/chunk.BR6TINGU.js +1 -0
- package/dist/preview/{chunk.B5PJCYBU.js → chunk.BU5PVRX7.js} +1 -1
- package/dist/preview/{chunk.PDMX3GTL.js → chunk.BUQKRXI6.js} +1 -1
- package/dist/preview/{chunk.RUFYORIJ.js → chunk.C437FVD7.js} +1 -1
- package/dist/preview/chunk.CD6YWH6T.js +3 -0
- package/dist/preview/chunk.CDEAAWPS.js +1 -0
- package/dist/preview/{chunk.XUO67YMT.js → chunk.CGQ6KXVK.js} +1 -1
- package/dist/preview/{chunk.WYPCLZL7.js → chunk.CPYBJNHP.js} +1 -1
- package/dist/preview/{chunk.FXCQJPN4.js → chunk.CS72MISN.js} +2 -2
- package/dist/preview/chunk.CXJJB3MK.js +1 -0
- package/dist/preview/{chunk.CAXILB7K.js → chunk.CXLQPE4J.js} +1 -1
- package/dist/preview/{chunk.REUMBCSV.js → chunk.DA4RSHLW.js} +1 -1
- package/dist/preview/{chunk.YXAKHXYB.js → chunk.DICM56FT.js} +1 -1
- package/dist/preview/{chunk.ZSGDVNVN.js → chunk.DJMSXXP4.js} +1 -1
- package/dist/preview/{chunk.ZY7US4Y7.js → chunk.DJPNVXBQ.js} +1 -1
- package/dist/preview/chunk.DJVHKBEI.js +1 -0
- package/dist/preview/chunk.E5WJSTOV.js +1 -0
- package/dist/preview/{chunk.KPQLM4TM.js → chunk.F2TWV4TX.js} +1 -1
- package/dist/preview/chunk.F5VEHAP2.js +1 -0
- package/dist/preview/{chunk.GHN62OMG.js → chunk.FDWRH5P2.js} +1 -1
- package/dist/preview/chunk.FEGSYSA7.js +1 -0
- package/dist/preview/{chunk.T3JIZNE7.js → chunk.FHHVW2WB.js} +1 -1
- package/dist/preview/chunk.FOSY7MZF.js +2 -0
- package/dist/preview/{chunk.ZZAI57VI.js → chunk.FXG5AJF6.js} +1 -1
- package/dist/preview/{chunk.K7TK3KRB.js → chunk.G3Q5IMM3.js} +1 -1
- package/dist/preview/{chunk.KXFNRJ46.js → chunk.GPCKOYSF.js} +1 -1
- package/dist/preview/{chunk.YOUB3J3Y.js → chunk.HJS3LTSR.js} +1 -1
- package/dist/preview/chunk.HJUXC5GM.js +1 -0
- package/dist/preview/chunk.HNMSYQRA.js +1 -0
- package/dist/preview/chunk.HWLRKOI3.js +1 -0
- package/dist/preview/{chunk.BQM3YAMR.js → chunk.IFBGYFS4.js} +1 -1
- package/dist/preview/chunk.IHUMKFYH.js +10 -0
- package/dist/preview/{chunk.AW26EETU.js → chunk.IJ3YDBWI.js} +1 -1
- package/dist/preview/{chunk.SMHP2CQH.js → chunk.IMKD6QQG.js} +1 -1
- package/dist/preview/{chunk.75GENXGP.js → chunk.INTJD5WG.js} +1 -1
- package/dist/preview/chunk.IQ54QTA5.js +1 -0
- package/dist/preview/{chunk.MIE3ODQ2.js → chunk.IQC3GOXO.js} +1 -1
- package/dist/preview/{chunk.2PJ6STKA.js → chunk.IR4OW67N.js} +1 -1
- package/dist/preview/{chunk.72YXFJKC.js → chunk.ISN2QTVL.js} +1 -1
- package/dist/preview/{chunk.Q4MI53KK.js → chunk.J24YPQ5I.js} +5 -5
- package/dist/preview/chunk.J545NAMY.js +1 -0
- package/dist/preview/{chunk.57YDGGJK.js → chunk.J6KNEI5R.js} +1 -1
- package/dist/preview/chunk.K3JARAWU.js +1 -0
- package/dist/preview/{chunk.MY5HJW2Z.js → chunk.KHAVEYT7.js} +1 -1
- package/dist/preview/{chunk.STDJ6XG5.js → chunk.KIQXTQDU.js} +1 -1
- package/dist/preview/chunk.KROR65KD.js +2 -0
- package/dist/preview/chunk.KV7GZBJ6.js +50 -0
- package/dist/preview/{chunk.CGK2PY76.js → chunk.L6FGKJ5H.js} +1 -1
- package/dist/preview/chunk.L7NJLZWV.js +1 -0
- package/dist/preview/{chunk.HOFATBGD.js → chunk.LGRQDILY.js} +1 -1
- package/dist/preview/{chunk.IEDCFSN5.js → chunk.LKK5YF2H.js} +1 -1
- package/dist/preview/chunk.LON75VHP.js +1 -0
- package/dist/preview/chunk.LQWVJQ5X.js +18 -0
- package/dist/preview/{chunk.PDS4HT46.js → chunk.LVD3V77M.js} +1 -1
- package/dist/preview/{chunk.JIEDJEHK.js → chunk.LY5CY7GE.js} +1 -1
- package/dist/preview/{chunk.OXWOUE3W.js → chunk.M5W2RHC6.js} +1 -1
- package/dist/preview/chunk.M6BTLH24.js +1 -0
- package/dist/preview/chunk.MAGKI4PD.js +1 -0
- package/dist/preview/chunk.MD36ZSM5.js +74 -0
- package/dist/preview/chunk.MFZJVHWP.js +1 -0
- package/dist/preview/{chunk.VCTAFSZ5.js → chunk.MH46V556.js} +1 -1
- package/dist/preview/chunk.MHTA4HYB.js +19 -0
- package/dist/preview/{chunk.QSPLKCTX.js → chunk.N2FNHRI2.js} +1 -1
- package/dist/preview/chunk.N2YM247R.js +1 -0
- package/dist/preview/chunk.N35SJWAM.js +1 -0
- package/dist/preview/chunk.NBVPWLRY.js +3 -0
- package/dist/preview/{chunk.NEPQBMFT.js → chunk.NKYYDFIX.js} +1 -1
- package/dist/preview/chunk.NSO6RUKW.js +1 -0
- package/dist/preview/{chunk.OIMGD7FR.js → chunk.O2W5JTWA.js} +1 -1
- package/dist/preview/chunk.OHMHPTEW.js +1 -0
- package/dist/preview/{chunk.XBYJCGPU.js → chunk.P6TZGR3A.js} +1 -1
- package/dist/preview/{chunk.KQPKYWDM.js → chunk.PTQPS2FJ.js} +1 -1
- package/dist/preview/chunk.PV2I4UPH.js +1 -0
- package/dist/preview/chunk.QFQSSZN7.js +1 -0
- package/dist/preview/{chunk.OTSBF367.js → chunk.QO5RXOCS.js} +2 -2
- package/dist/preview/{chunk.VZDHRY3U.js → chunk.QSDBF7VL.js} +1 -1
- package/dist/preview/{chunk.V4HVFLFQ.js → chunk.R2TSTDS3.js} +1 -1
- package/dist/preview/{chunk.34DRUCH2.js → chunk.RFVOXX3P.js} +1 -1
- package/dist/preview/chunk.RSS6OHXG.js +1 -0
- package/dist/preview/{chunk.XYGNS637.js → chunk.S2DOVJRL.js} +1 -1
- package/dist/preview/chunk.S3EEY7T3.js +1 -0
- package/dist/preview/chunk.SBCAYTMT.js +1 -0
- package/dist/preview/chunk.SMTGRCMG.js +3 -0
- package/dist/preview/{chunk.NTC2H5ZX.js → chunk.SOMRYDDH.js} +1 -1
- package/dist/preview/{chunk.4EXC26LI.js → chunk.SPCAMQJE.js} +1 -1
- package/dist/preview/{chunk.SGPXYDSG.js → chunk.T3KNLP7C.js} +1 -1
- package/dist/preview/chunk.TBY5IR7C.js +1 -0
- package/dist/preview/chunk.TCZIZ2PU.js +1 -0
- package/dist/preview/{chunk.PWAP2GJS.js → chunk.TUCSUZNO.js} +1 -1
- package/dist/preview/{chunk.DIFIHNR3.js → chunk.TY74U3EI.js} +1 -1
- package/dist/preview/chunk.U74PTRHJ.js +1 -0
- package/dist/preview/chunk.UAORKZLO.js +1 -0
- package/dist/preview/chunk.UDVTPI2W.js +1 -0
- package/dist/preview/{chunk.OMRQTLI5.js → chunk.UETLP5KC.js} +1 -1
- package/dist/preview/chunk.UHI3X2YD.js +1 -0
- package/dist/preview/chunk.UL62ELNR.js +1 -0
- package/dist/preview/chunk.VRYSZYAD.js +1 -0
- package/dist/preview/{chunk.CI4RZL4Z.js → chunk.VUZFLDOX.js} +1 -1
- package/dist/preview/chunk.X2NGFOAF.js +1 -0
- package/dist/preview/chunk.XE762VL2.js +2 -0
- package/dist/preview/{chunk.QS32TO4N.js → chunk.XSWR5LI4.js} +1 -1
- package/dist/preview/{chunk.JVDPRQ7J.js → chunk.XTTESA7X.js} +1 -1
- package/dist/preview/chunk.Y2RZ5B4U.js +1 -0
- package/dist/preview/chunk.Y7QDQ3WF.js +1 -0
- package/dist/preview/{chunk.O3YIWIVQ.js → chunk.YKMBXMZE.js} +1 -1
- package/dist/preview/chunk.Z34KASY7.js +1 -0
- package/dist/preview/{chunk.XCWZFLIB.js → chunk.ZDUTEM3Z.js} +1 -1
- package/dist/preview/{chunk.EJ4MSVX2.js → chunk.ZJFXM3LE.js} +1 -1
- package/dist/preview/chunk.ZMGKWMID.js +1 -0
- package/dist/preview/{chunk.AHPYNDVA.js → chunk.ZMWAZACO.js} +1 -1
- package/dist/preview/chunk.ZT5YQSSP.js +21 -0
- package/dist/preview/{chunk.B46UZHGW.js → chunk.ZTN7BS5O.js} +1 -1
- package/dist/preview/{chunk.HRNNRA2I.js → chunk.ZYNC73DJ.js} +1 -1
- package/dist/preview/chunk.ZZM75ZTN.js +4 -0
- package/dist/preview/index.html +56 -56
- package/dist/preview/page.js +2 -2
- package/dist/preview/splash.js +3 -3
- package/package.json +6 -6
- package/dist/preview/chunk.24HNOLUS.js +0 -3
- package/dist/preview/chunk.25CQCCLN.js +0 -1
- package/dist/preview/chunk.26H33GJC.js +0 -50
- package/dist/preview/chunk.2KIWGQXC.js +0 -2
- package/dist/preview/chunk.33XNYHI6.js +0 -1
- package/dist/preview/chunk.37FLKAVZ.js +0 -1
- package/dist/preview/chunk.3JCHJLH6.js +0 -1
- package/dist/preview/chunk.3OQ6S6H4.js +0 -1
- package/dist/preview/chunk.47QEWSSE.js +0 -1
- package/dist/preview/chunk.4DAKQXDG.js +0 -1
- package/dist/preview/chunk.4TH3CGAZ.js +0 -1
- package/dist/preview/chunk.5GC4VAHU.js +0 -1
- package/dist/preview/chunk.5QXQ7PBI.js +0 -35
- package/dist/preview/chunk.6CSHRMJC.js +0 -1
- package/dist/preview/chunk.6HKWAHPT.js +0 -1
- package/dist/preview/chunk.6XHPBJ5F.js +0 -1
- package/dist/preview/chunk.6YK5E7ZQ.js +0 -4
- package/dist/preview/chunk.735AFUP5.js +0 -1
- package/dist/preview/chunk.ATDIDPKZ.js +0 -1
- package/dist/preview/chunk.AWUO3M5D.js +0 -1
- package/dist/preview/chunk.BF3EZCG3.js +0 -1
- package/dist/preview/chunk.BKQICGFW.js +0 -1
- package/dist/preview/chunk.C65EHQ7V.js +0 -1
- package/dist/preview/chunk.CCQMDZHO.js +0 -1
- package/dist/preview/chunk.CYTTZOYL.js +0 -25
- package/dist/preview/chunk.D5LOTCBU.js +0 -3
- package/dist/preview/chunk.DBFJVVWF.js +0 -1
- package/dist/preview/chunk.DDFRFSVN.js +0 -1
- package/dist/preview/chunk.E3XJMO7Q.js +0 -1
- package/dist/preview/chunk.EJ2WE764.js +0 -18
- package/dist/preview/chunk.ERPILTRY.js +0 -1
- package/dist/preview/chunk.FFXBDOKA.js +0 -1
- package/dist/preview/chunk.FNVGNISQ.js +0 -3
- package/dist/preview/chunk.G2JAYG2Z.js +0 -1
- package/dist/preview/chunk.H5SN46VK.js +0 -1
- package/dist/preview/chunk.HSMJHCR3.js +0 -1
- package/dist/preview/chunk.JNIDS66Z.js +0 -1
- package/dist/preview/chunk.JO3BBRSR.js +0 -1
- package/dist/preview/chunk.KL5H7KEV.js +0 -1
- package/dist/preview/chunk.KZUMXT5J.js +0 -74
- package/dist/preview/chunk.MAHNJO6U.js +0 -1
- package/dist/preview/chunk.MBB5A6BT.js +0 -1
- package/dist/preview/chunk.MENLUNM5.js +0 -1
- package/dist/preview/chunk.N3T2O6EW.js +0 -9
- package/dist/preview/chunk.NWWJNNEK.js +0 -2
- package/dist/preview/chunk.O67JXUVG.js +0 -1
- package/dist/preview/chunk.QAMW5QDT.js +0 -19
- package/dist/preview/chunk.R4HDKNT3.js +0 -88
- package/dist/preview/chunk.SJUXFPTI.js +0 -1
- package/dist/preview/chunk.SME4HD5I.js +0 -1
- package/dist/preview/chunk.SSAETRHR.js +0 -5
- package/dist/preview/chunk.T535ZLRM.js +0 -1
- package/dist/preview/chunk.UAVK54Z6.js +0 -1
- package/dist/preview/chunk.V6IL7CIZ.js +0 -1
- package/dist/preview/chunk.WNS5LEO5.js +0 -1
- package/dist/preview/chunk.WUVXIUA7.js +0 -1
- package/dist/preview/chunk.XCEZCOX4.js +0 -1
- package/dist/preview/chunk.XIW4SZHD.js +0 -1
- package/dist/preview/chunk.YZBJUAS6.js +0 -1
- package/dist/preview/chunk.Z2ZQJ3DD.js +0 -1
- package/dist/preview/chunk.ZELWW7UA.js +0 -21
- package/dist/preview/chunk.ZLTHWCKL.js +0 -2
- package/dist/preview/chunk.ZP7JEVVU.js +0 -1
- package/dist/preview/chunk.ZRH5X3MR.js +0 -1
- package/dist/preview/chunk.ZVG4FXJK.js +0 -1
- /package/dist/preview/{chunk.GZHZLJBF.js → chunk.MIE4TJRW.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as L,Bb as q,Bc as Q,Cb as H,Cc as ee,Db as J,Dc as M,Eb as U,Ec as I,Fc as N,Kc as P,L as K,Nc as w,R as _,U as G,Y as $,nb as z,ob as h,ra as F,vc as V,xb as Y,yc as X,zc as Z}from"./chunk.
|
|
1
|
+
import{$ as L,Bb as q,Bc as Q,Cb as H,Cc as ee,Db as J,Dc as M,Eb as U,Ec as I,Fc as N,Kc as P,L as K,Nc as w,R as _,U as G,Y as $,nb as z,ob as h,ra as F,vc as V,xb as Y,yc as X,zc as Z}from"./chunk.J24YPQ5I.js";import{j as f}from"./chunk.FQLNBIQ5.js";var te=e=>Y(e).id??e.session;function D(e,o={}){let i=V(e),n=new Map,t=o.advisory===!0;for(let s of e){if(s.vote===void 0||s.withheld||i.has(s.id)||s.vote.advisory===!0!==t)continue;let r=t?s.vote.voter:te(s.author);if(r===void 0)continue;let a=n.get(s.vote.suggestion);a||n.set(s.vote.suggestion,a=new Map),s.vote.vote===null?a.delete(r):a.set(r,s.vote.vote)}return n}function ne(e){let o=0,i=0;for(let n of e?.values()??[])n==="for"?o++:i++;return{for:o,against:i}}function le(e,o,i){let n=M(o)?I(o):void 0,t=o&&(n===void 0?te(o):void 0),s=n!==void 0?i?.get(n):t!==void 0?e?.get(t):void 0,r=ne(i);return{...ne(e),...s!==void 0?{mine:s}:{},...r.for+r.against>0?{advisory:r}:{}}}var j=(e,o)=>e.expiresAt!==void 0&&Date.parse(e.expiresAt)<=Date.parse(o),ue=(e,o,i)=>(e??[]).some(n=>n.suggestion===o&&(n.until===void 0||Date.parse(n.until)>Date.parse(i)));function oe(e,o=()=>!0,i={}){let n=V(e),t=ce(e),s=i.now??new Date().toISOString(),r,a;return e.filter(d=>d.suggests&&!d.withheld&&!n.has(d.id)&&t.get(d.id)!=="all"&&!j(d,s)&&!ue(i.dismissed,d.id,s)).flatMap(({id:d,batch:l,suggests:u,suggestsSaid:g,intent:c,batchIntent:A,author:T,lineage:S,at:p,expiresAt:de})=>{let C=t.get(d),O=ge(u,g,c).filter(m=>!C?.has(m.at));if(O.length===0)return[];let B=O.map(m=>m.call),W=new Set;return JSON.stringify(B.map(m=>m.args),(m,k)=>(typeof k=="string"&&o(k)&&W.add(k),k)),[{id:d,batch:l,calls:B,intent:C?O.map(m=>m.intent).join("; "):c,...A!==void 0?{headline:A}:{},items:O,author:T,...S?{lineage:S}:{},at:p,expiresAt:de,about:[...W],tally:le((r??=D(e)).get(d),i.voter,(a??=D(e,{advisory:!0})).get(d))}]})}function ge(e,o,i){let n=o&&o.length===e.length?o:void 0;return e.map((t,s)=>({at:s,call:t,intent:n?.[s]??(e.length===1?i:t.name)}))}function ce(e){let o=new Map;for(let n of e){let t=n.lineage?.suggestion;if(t===void 0)continue;let s=n.lineage.items,r=o.get(t);if(r!=="all")if(s===void 0)o.set(t,"all");else{let a=r??new Set;for(let d of s)a.add(d);o.set(t,a)}}let i=new Map(e.filter(n=>n.suggests&&o.has(n.id)).map(n=>[n.id,n.suggests.length]));for(let[n,t]of o)t!=="all"&&i.has(n)&&t.size>=i.get(n)&&o.set(n,"all");return o}function ie(e,o){return e.ops.length>0&&e.ops.every(i=>i.suggests!==void 0||i.undoes!==void 0&&o(i.undoes)?.suggests!==void 0)}var E=e=>[...e].length;function pe(e){let o,i=0,n=0;for(let t of e.ops){let s=t.mutation?.name===U&&t.withheld!==!0&&t.undoes===void 0?t.mutation.args:void 0;if(typeof s?.node!="string"||typeof s.field!="string"||o&&(o.node!==s.node||o.field!==s.field))return;o={node:s.node,field:s.field};for(let r of t.primitives)r.op==="splice-text"?(i+=E(r.inserted),n+=E(r.removed)):r.op==="patch-node"&&typeof r.after[s.field]=="string"&&(i+=E(r.after[s.field]))}return o&&{...o,inserted:i,removed:n}}function fe(e,o,i){let n=i.getNode(e.node)?.kind,t=[...e.inserted>0||e.removed===0?[`+${e.inserted}`]:[],...e.removed>0?[`\u2212${e.removed}`]:[]];return`Wrote in ${F(n?o.tryDefinition(n):void 0,e.field)} (${t.join(" ")})`}var x=e=>JSON.stringify([e.kind,e.id??"",e.name??""]),ye=e=>e.ops.find(o=>o.lineage?.run!==void 0)?.lineage?.run;function me(e,o=()=>{}){let i=[];for(let n of e){if(ie(n,o))continue;if(!P(n.author)){let u=pe(n),g=i.at(-1),c=u&&g&&"batch"in g&&x(g.batch.author)===x(n.author)&&g.typed?.node===u.node&&g.typed.field===u.field?g.typed:void 0;c?i[i.length-1]={batch:n,typed:{...c,batches:[...c.batches,n],inserted:c.inserted+u.inserted,removed:c.removed+u.removed}}:i.push(u?{batch:n,typed:{batches:[n],...u}}:{batch:n});continue}let t=ye(n),s=x(n.author),r=t!==void 0?i.findIndex(u=>"digest"in u&&u.digest.run===t&&x(u.digest.author)===s):i.length-1,a=i[r],d=a!==void 0&&"digest"in a&&x(a.digest.author)===s&&a.digest.run===t?a.digest:void 0,l=[...d?.batches??[],n];d&&i.splice(r,1),i.push({digest:{author:n.author,batches:l,things:he(l),at:n.at,...t!==void 0?{run:t}:{}}})}return i}var he=e=>e.reduce((o,i)=>o+(i.undone?0:i.ops.length),0),Se=e=>{let o=Date.parse(e);if(Number.isNaN(o))return!1;let{minutes:i}=G(o,_());return i<6*60||i>=21*60};function ve(e,o=$(new Date().toISOString())??K()){let i=$(e.at)??e.at.slice(0,10),t=e.run!==void 0&&i===o&&[e.at,...(e.batches??[]).map(r=>r.at)].every(Se)?"overnight":i===o?"today":`on ${L(i)}`,s=e.things===1?"one thing":`${e.things} things`;return e.author?.id?.startsWith("workflow:")&&e.author.name?`${e.author.name}: ${s} ${t}`:`Tidied ${s} ${t}`}var y=e=>e,v=(e,o)=>o===void 0?{}:{[e]:o};function Ge(e,o,i){let n=f(e)?.store??e,t=y(n),s=Z(i.lineage);if(s===void 0)throw new h("A suggestion says what it is based on: { basis, confidence? }");let r=i.author??t.by;if(i.expiresAt!==void 0&&Number.isNaN(Date.parse(i.expiresAt)))throw new h(`A suggestion expires at a time: "${i.expiresAt}" is not one (an ISO time, like 2026-10-23T06:00:00Z).`);let a=t.actMeanings(),d=w(o,a),l=R(n).find(p=>w(p.calls,a)===d);if(l)return n.log.get(l.id);t.refuseDeclined(o,r);let u=t.rehearsal();u.suggesting=!0;let g=u.applying(o,{author:r,lineage:s,...v("via",i.via)});if(g.ops.length===0)return;let c=[...new Set(g.ops.flatMap(p=>p.described??[]))],A=g.ops.filter(p=>p.mutation!==null&&p.author===r),T=o.length>1&&A.length===o.length?A.map(p=>p.intent):void 0,S={id:t.nextId(),seq:n.log.length,batch:t.mintBatch("batch"),author:r,intent:g.ops.map(p=>p.intent).join("; "),...v("batchIntent",i.intent),mutation:null,primitives:[],reads:[],writes:[],...c.length>0?{described:c}:{},at:t.now(),...v("via",i.via),lineage:s,suggests:o,...v("suggestsSaid",T),...v("expiresAt",i.expiresAt)};return n.log.append(S),n.notify(z,[S]),S}function R(e,o,i={}){let n=f(e),t=n?.store??e,s=o??n?.principal,r=(s!==void 0?t.seenBy(s):t).log.all();return oe(r,a=>t.graph.has(a),{now:y(t).now(),dismissed:i.dismissed,voter:s})}function se(e,o,i){let n=f(e),t=n?.store??e,s=i??n?.principal??y(t).by;return o.calls.every(r=>t.permits(r,s).ok)}function re(e,o,i,n={}){let t=f(e)?.store??e,s=n.author??y(t).by;b(t,o,s);let r=t.applyAll([{name:ee,args:{suggestion:o,vote:i}}],{...n,author:s});return i===null?r:{...r,voted:i}}function b(e,o,i){let n=R(e,i).find(s=>s.id===o),t=n?void 0:e.log.get(o);if(t?.suggests&&j(t,y(e).now()))throw new h(`That suggestion expired on ${t.expiresAt.slice(0,10)}.`);if(!n)throw new h("That suggestion is no longer waiting: it was accepted or declined, or it is not one you can see.");return n}function Le(e,o,i={}){let n=f(e)?.store??e,{items:t,...s}=i,r=s.author??y(n).by,a=b(n,o,r),d=t===void 0?a.items:a.items.filter(c=>t.includes(c.at));if(t!==void 0&&(t.length===0||d.length!==new Set(t).size))throw new h("Name the changes to accept by their place among those still waiting in the suggestion.");let l={...a,calls:d.map(c=>c.call)};if(!se(n,l,r))return re(n,o,"for",{...s,author:r});let u=n.log.get(o)?.suggests?.length??d.length,g=d.length<u?{items:d.map(c=>c.at)}:{};return n.applyAll(l.calls,{...s,author:r,lineage:{...a.lineage,suggestion:o,...g}})}function Fe(e,o,i={}){let n=f(e)?.store??e,t=i.author??y(n).by,s=b(n,o,t);if(!se(n,s,t))return re(n,o,"against",{...i,author:t});let r=ae(s)&&i.intent===void 0?{intent:`Declined ${xe(we(s))} proposal: ${s.intent}`}:{};return n.undo(s.batch,{...i,...r,author:t})}function ze(e,o,i={}){let n=f(e)?.store??e,t=i.author??y(n).by,s=b(n,o,t);if(s.author.kind!==t.kind||s.author.id!==t.id)throw new h("Only who made a suggestion withdraws it: a person declines it (declineSuggestion).");return n.undo(s.batch,{...i,author:t})}var Ae={kind:"system",id:"tidying",name:"Graview, tidying",automated:!0};N.op=(e,o,i,n,t,s)=>{let r=e,{suggestion:a,vote:d}=i.args,l=b(r,a,t),u=M(t)?I(t):void 0,g=d==="for"?`For: ${l.intent}`:d==="against"?`Against: ${l.intent}`:`Withdraws a vote on: ${l.intent}`;return{id:o.id,seq:r.log.length,batch:n,author:t,intent:g,mutation:i,primitives:[],reads:[],writes:[],...l.about.length>0?{described:l.about}:{},at:o.at,...s.via!==void 0?{via:s.via}:{},vote:{suggestion:a,vote:d,...u!==void 0?{advisory:!0,voter:u}:{}}}};N.accepting=(e,o)=>{let i=e,n=i.tidying?.autoAcceptAt;if(n===void 0||o.vote?.vote!=="for")return;let t=o.vote.suggestion,s=R(i).find(l=>l.id===t);if(!s)return;let a=[...D(i.log.all()).get(t)??[]].filter(([,l])=>l==="for").map(([l])=>l);if(a.length<n)return;let d=P(s.author)?s.author:Ae;return{calls:s.calls,author:d,lineage:{...s.lineage,suggestion:t,voters:a.slice(0,X)}}};var ae=e=>e.lineage?.proposedBy!==void 0,we=e=>e.author.name??e.author.id??"Somebody",xe=e=>/s$/i.test(e)?`${e}'`:`${e}'s`;function Ye(e,o,i,n){let t=f(e)?.store??e,s=y(t).actMeanings(),r=w(i,s),a=R(t,o).find(l=>ae(l)&&w(l.calls,s)===r);if(a)return t.log.get(a.id);let d={calls:i.map(({name:l,args:u})=>({name:l,args:u})),...v("intent",n)};return t.applyAll([{name:Q,args:d}],{author:o}).ops.find(l=>l.suggests!==void 0)}function qe(e,o,i){if(!e||!e.grants.some(t=>t.propose!==void 0))return[];let n=new Set(q(e,o,i));return i.filter(t=>!n.has(t)&&H(t).some(s=>J(e,o,t.name,s)))}export{fe as a,me as b,ve as c,Ge as d,R as e,se as f,re as g,Le as h,Fe as i,ze as j,ae as k,Ye as l,qe as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as fe,b as Ne,d as Ze,e as He,f as he,g as F,h as ke,j as We}from"./chunk.INTJD5WG.js";import{h as Je,i as Xe,j as Qe}from"./chunk.SPCAMQJE.js";import{a as ae,b as ce,c as J,d as Ye,e as Q,g as se,h as en}from"./chunk.ZMWAZACO.js";import{c as Be,h as k,i as Ue,j as ze,t as ye}from"./chunk.CD6YWH6T.js";import{A as re,Ha as Ie,Ic as qe,Jc as Ve,Oa as Ke,Pa as oe,Qa as me,b as Z,c as U,e as ue,f as Me,g as P,h as O,hc as Pe,ic as ge,jc as Le,k as L,kc as Ge,l as X,lc as Ce,m as _,n as _e,o as H,p as I,r as $,s as te,t as R,u as j,v as G,w as T,x as n,y as N,z as Y}from"./chunk.J24YPQ5I.js";var be=e=>Object.entries(e).map(([s,i])=>[s,Object.keys(oe(i?.edges))]),$e=(e,s)=>Le(e,be(s));function nn(e){return[...Object.keys(e.acts??{}),...Object.keys(e.kinds).flatMap(s=>Pe(s)),...Ge(be(e.kinds))]}var V=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function tn(e){if(!V(e)||!V(e.kinds))return e;let s;try{let f=Object.fromEntries(Object.entries(e.kinds).map(([g,l])=>[g,V(l)&&V(l.edges)?{edges:l.edges}:{}]));s=nn({acts:V(e.acts)?e.acts:{},kinds:f})}catch{return e}let i=new Set(s),t=!1,o=f=>{if(typeof f!="string"||i.has(f))return f;let g=qe(f,s);return g===void 0?f:(t=!0,g)},a=V(e.policy)&&Array.isArray(e.policy.grants)?{...e.policy,grants:e.policy.grants.map(f=>V(f)&&Array.isArray(f.mutations)?{...f,mutations:f.mutations.map(o)}:f)}:void 0,u=V(e.rules)?Object.fromEntries(Object.entries(e.rules).map(([f,g])=>[f,V(g)&&Array.isArray(g.repairs)?{...g,repairs:g.repairs.map(l=>V(l)?{...l,act:o(l.act)}:l)}:g])):void 0;return t?{...e,...a?{policy:a}:{},...u?{rules:u}:{}}:e}function we(e,s){let i=Ve(e,nn(s));return i&&i!==e?`did you mean "${i}"?`:void 0}var Oe="graview-document",je=1,xe=256*1024,ee=64*1024,vn=["plain","editorial","shader","ascii"];var Se=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ve=/^[a-z][A-Za-z0-9]*$/,On=/^[a-z0-9\u00df-\u00ff'-]+( [a-z0-9\u00df-\u00ff'-]+){0,2}$/,on=12,sn=60,jn=new Set(["id","kind"]),xn=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,An=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"];function En(){let e=h=>h in Object.prototype,s=Y(h=>!e(h),"every object already has this name \u2014 choose another"),i=(h,D)=>[...h===void 0?[]:[Me(h)],...D===void 0?[]:[ue(D)]],t=(h,D)=>O().check(...i(h,D)),o=(h,D,ne)=>I(h).check(...i(D,ne)),a=h=>O().check(P(Se,`${h} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),u=O().check(P(xn,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),s),f=O().check(P(ve,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),Y(h=>!jn.has(h),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),s),g=t(1,500),l=O().check(ue(40),P(On,'an alias is up to three lower-case words, like "supplier"')),r=t(1,2e3),p=t(1,300),y=$({type:G(An),required:n(_()),description:n(g),label:n(t(1,60)),aliases:n(o(l,1,on)),options:n(o(t(1,80),1,100)),multiple:n(_()),optionLabels:n(j(t(1,80),t(1,80))),of:n(G(["string","number","date","image","video","file"])),default:n(H()),unit:n(t(void 0,12)),format:n(G(["money","percent","duration","markdown"])),places:n(T(0)),min:n(L()),max:n(L()),step:n(L()),renamedFrom:n(O().check(P(ve))),repeats:n(_()),collaborative:n(_())}).check(re((h,D)=>{h.type==="enum"&&!h.options&&D.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),h.type!=="enum"&&h.options&&D.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]}),h.type!=="enum"&&h.multiple!==void 0&&D.addIssue({code:"custom",message:'"multiple" belongs only on an enum field: a choice that takes several of its options',path:["multiple"]});for(let ne of Object.keys(h.optionLabels??{}))h.options?.includes(ne)||D.addIssue({code:"custom",message:`"${ne}" is labeled, and is none of the field's options`,path:["optionLabels",ne]});h.type!=="list"&&h.of&&D.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),h.places!==void 0&&!(h.format==="money"||!h.format&&/^[A-Z]{3}$/.test(h.unit??""))&&D.addIssue({code:"custom",message:'"places" belongs only on money: a number field with "format": "money"',path:["places"]}),h.repeats&&h.type!=="date"&&h.type!=="datetime"&&D.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),m=O().check(P(new RegExp(`${Se.source}|${Ie.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),d=$({to:R([o(m,1),T("*")]),cardinality:n(G(["one","many"])),description:n(g),inverse:n(t(1,80)),appendOnly:n(_()),renamedFrom:n(O()),tidying:n(T("never"))}),c=R([r,$({expr:r,label:n(t(1,60)),description:n(g),format:n(G(["money","percent","duration"])),unit:n(t(1,12)),places:n(T(0)),hidden:n(_())})]),w=R([O(),L(),_(),_e(),I(H()),$({expr:r})]),b=$({noun:n(t(1,40)),plural:n(t(1,40)),aliases:n(o(l,1,on)),description:n(g),fields:j(f,y).check(Y(h=>Object.keys(h).length>0,"a kind has at least one field")),label:n(p),describe:n(p),lifecycle:n($({field:f,retired:o(R([O(),L(),_()]),1)})),figure:n(t(void 0,2e4)),glance:n(o(f,1,20)),page:n($({fields:n(o(f,1,40)),groups:n(o($({title:t(1,60),fields:o(f,1,40)}),1,12))})),edges:n(j(u,d)),computed:n(j(O(),c).check(Y(h=>Object.keys(h).length<=sn,`a kind works out at most ${sn} computed fields`))),fieldRoles:n(j(O(),O())),renamedFrom:n(O().check(P(Se))),people:n(_()),archives:n(T(!1)),tidying:n(G(["never","no-links"])),derives:n($({from:a("kind"),via:u,set:j(f,w)}))}),S=O().check(P(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),x=R([$({create:a("kind"),as:n(O().check(P(ve))),set:n(j(f,w))}),$({set:j(f,w),target:n(S)}),$({connect:u,from:S,to:S}),$({sever:u,from:S,to:S}),$({remove:S})]),E=$({title:n(t(1,80)),description:n(g),fromTheOtherEnd:n(t(1,80)),on:n(R([a("kind"),o(a("kind"),1)])),creates:n(a("kind")),sets:n(j(f,w)),writes:n(o(f,1)),connects:n(u),severs:n(u),setsOther:n(j(f,w)),setsLinked:n(j(u,j(f,w))),replaces:n(R([T(!0),o(u,1,10)])),removes:n(T(!0)),args:n(j(f,y)),effects:n(o(x,1,20)),allowedWhen:n(r),refusal:n(p),destructive:n(_())}),v=$({act:a("act"),label:n(t(1,80)),args:n(j(O(),w))}),B=$({every:a("kind"),through:u,via:n(u)}),C=$({title:n(t(1,120)),description:n(g),over:R([T("graph"),a("kind")]),when:n(r),require:n(r),covers:n(B),says:n(p),repairs:n(o(v,void 0,10))}).check(re((h,D)=>{!h.require&&!h.covers&&D.addIssue({code:"custom",message:'a rule says what must hold in "require", or what each record must be linked to in "covers"',path:["require"]}),h.require&&h.covers&&D.addIssue({code:"custom",message:'a rule is judged by "require" or by "covers", not both',path:["covers"]}),h.covers&&h.over==="graph"&&D.addIssue({code:"custom",message:'a coverage rule is over a kind, whose records it follows through their links; name the kind in "over"',path:["over"]})})),z=$({roles:R([o(a("role"),1),T("*")]),mutations:R([o(a("act")),T("*")]),kinds:n(R([I(a("kind")),T("*")])),describe:n(g),self:n(_()),ownEnd:n(_()),propose:n(R([o(a("act"),1),T("*")]))}).check(re((h,D)=>{Array.isArray(h.mutations)&&h.mutations.length===0&&h.propose===void 0&&D.addIssue({code:"custom",message:'a grant names at least one act in "mutations", or the acts it lets these roles propose in "propose"',path:["mutations"]})})),A=n(o(f,1)),M=$({roles:R([o(a("role"),1),T("*")]),kinds:o(a("kind"),1),own:n(_()),via:n(u),fields:A,hide:A}),ie=$({grants:I(z),sees:n(I(M))}),W=$({accent:n(O().check(P(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),ground:n(R([O().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"')),$({light:n(O().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"'))),dark:n(O().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#101826"')))})])),name:n(t(1,60)),currency:n(O().check(P(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:n(t(2,35)),timeZone:n(t(1,64)),logo:n(R([t(1,ee),$({src:t(1,ee),alt:n(t(1,120))}),$({light:t(1,ee),dark:n(t(1,ee)),alt:n(t(1,120)),darkFallback:n(T("invert"))})])),favicon:n(R([t(1,ee),$({emoji:O()})])),typography:n($({display:n(t(1,200)),body:n(t(1,200)),mono:n(t(1,200))})),shape:n($({radius:n(L().check(U(0),Z(32))),density:n(L().check(U(.75),Z(1.5)))})),accents:n(j(O(),L().check(U(0),Z(360)))),scheme:n(G(["light","dark","auto"])),subtitle:n(T(!1)),splash:n($({style:G(vn),image:n(t(1,ee)),title:n(t(1,80)),kicker:n(t(1,80)),shader:n(t(1,40)),scheme:n(G(["light","dark","device"]))})),views:n($({css:n(t(1)),motion:n(G(["none","fade"]))}))}),q=j(O(),H()),Fe=R([t(1,120),$({by:t(1,120),direction:n(G(["asc","desc"]))})]),De=L().check(X(),U(1),Z(9999)),hn=te({create:n(_()),options:n(te({sort:n(Fe),columnSort:n(Fe),search:n(o(t(1,120),void 0,40)),filters:n(o(t(1,120),void 0,40)),horizon:n(R([L().check(X(),U(1),Z(200)),te({years:L().check(X(),U(1),Z(200)),title:t(1,80),from:n(De),to:n(De)})]))}))}),kn=$({card:n(I(H())),row:n(I(H())),page:n(I(H()))}),bn=()=>{let h=n(G(["asc","desc"]));return R([t(1,120),$({by:t(1,120),direction:h,then:n(R([t(1,120),$({by:t(1,120),direction:h})]))})])},$n=()=>R([t(1,120),$({by:t(1,120),order:n(o(t(1,80),void 0,40)),closed:n(o(t(1,80),void 0,40))})]),Te=te({order:n(I(O())),hide:n(I(O())),first:n(O()),primary:n(o(t(1,80),void 0,40)),scene:n(t(1,40)),pages:n(t(1,40)),lists:n(j(O(),$({filters:n(o(t(1,120),void 0,40)),sort:n(bn()),group:n($n()),export:n(_())})))}),wn=$({act:a("act"),title:n(t(1,80)),intro:n(g),fields:n(o(f,1,40)),say:n(g),submit:n(t(1,80)),role:n(a("role"))}),Sn=$({$schema:n(O()),format:T(Oe),formatVersion:T(je),name:t(1,80),description:n(g),version:n(L().check(X(),U(1))),kinds:j(a("kind"),b).check(Y(h=>Object.keys(h).length>0,"a document declares at least one kind"),Y(h=>Object.keys(h).length<=40,"a document declares at most 40 kinds")),computed:n(j(O(),c)),acts:n(j(a("act"),E)),rules:n(j(a("rule"),C)),roles:n(I(a("role"))),policy:n(ie),modules:n(q),lenses:n(I(hn)),pages:n(Te),views:n(j(O(),R([kn,I(H())]))),brand:n(W),settings:n(I(q)),migrations:n(I(q)),connections:n(j(a("connection"),q)),purpose:n(q),workflows:n(j(a("workflow"),q)),forms:n(j(a("form"),wn)),publishing:n($({mode:G(["live","on-publish"]),working:o(a("role"),void 0,40),publishers:n(o(a("role"),1,40))})),tidying:n($({autoAcceptAt:n(L().check(X(),U(1),Z(1e4)))}))});return{FieldSpec:y,EdgeSpec:d,ComputedSpec:c,KindSpec:b,ValueSpec:w,EffectSpec:x,ActSpec:E,RepairSpec:v,CoverSpec:B,RuleSpec:C,GrantSpec:z,SightSpec:M,PolicySpec:ie,BrandSpec:W,PagesSpec:Te,DocumentSpec:Sn}}var Rn,K=()=>Rn??=En(),Xn=N(()=>K().FieldSpec),Qn=N(()=>K().EdgeSpec),et=N(()=>K().ComputedSpec),nt=N(()=>K().KindSpec),tt=N(()=>K().ValueSpec),ot=N(()=>K().EffectSpec),st=N(()=>K().ActSpec),it=N(()=>K().RepairSpec),rt=N(()=>K().CoverSpec),at=N(()=>K().RuleSpec),ct=N(()=>K().GrantSpec),lt=N(()=>K().SightSpec),dt=N(()=>K().PolicySpec),pt=N(()=>K().BrandSpec),ft=N(()=>K().PagesSpec),rn=N(()=>K().DocumentSpec);var Fn={};function an(e,s=Fn,i=je){let{document:t,respelled:o}=Ne(e),a=o.length>0?{respelled:o}:{};if(!t||typeof t!="object"||Array.isArray(t))return{document:t};let u=t;if(u.format!==Oe||typeof u.formatVersion!="number"||u.formatVersion>=i)return{document:t,...a};let f=u.formatVersion,g=structuredClone(u);for(let l=f;l<i;l++){let r=s[l];if(!r)throw new Error(`there is no upgrade from format ${l} to ${l+1}`);g={...r(g),formatVersion:l+1}}return{document:g,from:f,...a}}function Ae(e,s,i){let t=Object.keys(e).filter(f=>e[f].edges?.[s]!==void 0);if(t.length===0)return;let o=t.map(f=>e[f].edges[s].to),a=o.some(f=>f==="*")?"*":[...new Set(o.flatMap(f=>f))];if(i.length===0||i.some(f=>t.includes(f)))return{reversed:!1,kinds:a};let u=t.filter(f=>{let g=e[f].edges[s].to;return g==="*"||i.every(l=>g.includes(l))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:a}}var dn=(e,s)=>{let i=e?.fields[s];return i!==void 0&&(i.type==="duration"||(i.type==="number"||i.type==="integer")&&i.format==="duration")};function cn(e,s,i,t){if(t==="out"){let o=e[s]?.edges?.[i]?.to;return o===void 0?[]:o==="*"?Object.keys(e):o}return Object.entries(e).filter(([,o])=>{let a=o.edges?.[i]?.to;return a!==void 0&&(a==="*"||a.includes(s))}).map(([o])=>o)}function Ee(e,s,i){if(i.t==="ident")return e[s]?.edges?.[i.name]?cn(e,s,i.name,"out"):void 0;if(i.t==="where")return Ee(e,s,i.set);if(i.t==="call"&&(i.fn==="out"||i.fn==="in")&&i.args[0]?.t==="lit"&&typeof i.args[0].value=="string")return cn(e,s,i.args[0].value,i.fn)}var ln=(e,s,i)=>{let t=s.filter(o=>e[o]?.fields[i]!==void 0);return t.length>0&&t.every(o=>dn(e[o],i))};function pn(e,s,i){let t=e.kinds,o=t[s],a=new Map(i),u=new Map,f=(l,r)=>{if(r>8)return!1;switch(l.t){case"ident":return dn(o,l.name)||g(l.name,r+1);case"member":{let p=Ee(t,s,l.object);return p!==void 0&&ln(t,p,l.name)}case"call":{if(l.fn!=="sum"&&l.fn!=="min"&&l.fn!=="max")return!1;let[p,y]=l.args,m=p&&Ee(t,s,p);return m!==void 0&&y?.t==="ident"&&ln(t,m,y.name)}case"binary":return(l.op==="+"||l.op==="-")&&f(l.left,r)&&f(l.right,r);case"unary":return l.op==="-"&&f(l.operand,r);default:return!1}},g=(l,r)=>{if(o?.computed?.[l]===void 0)return!1;if(u.has(l))return u.get(l);u.set(l,!1);let p=a.get(l),y=p!==void 0&&f(p,r);return u.set(l,y),y};return i.map(([l])=>l).filter(l=>g(l,0))}var Dn="several choices";var Tn={title:["string","text"],rich_text:["string","text"],number:["number","integer"],select:["enum","string"],status:["enum","string"],multi_select:["list",Dn],date:["date","datetime"],checkbox:["boolean"],url:["url","string"],email:["email","string"],phone_number:["phone","string"],people:["string","text","list"]};var fn=new Set(Object.values(Tn).flat());function un(e,s){let i=new Map;if(!e||typeof e!="object")return new Map;let t=Object.values(e).flatMap(o=>o&&typeof o=="object"&&o.system==="notion"&&Array.isArray(o.sources)?o.sources.filter(a=>a&&typeof a=="object").map(a=>({system:"notion",kind:a.kind,properties:a.properties})):[o]);for(let o of t){if(!o||typeof o!="object"||typeof o.kind!="string")continue;let a=s[o.kind]?.fields;if(!a)continue;let u=[];o.system==="google-calendar"&&o.fields&&typeof o.fields=="object"?u=Object.values(o.fields).filter(g=>typeof g=="string"):o.system==="notion"&&(u=o.properties&&typeof o.properties=="object"?Object.keys(o.properties):Object.keys(a).filter(g=>fn.has(a[g].type)));let f=i.get(o.kind)??new Set;for(let g of u)Object.hasOwn(a,g)&&f.add(g);i.set(o.kind,f)}return new Map([...i].filter(([,o])=>o.size>0).map(([o,a])=>[o,Object.keys(s[o].fields).filter(u=>a.has(u))]))}function mn(e,s,i=`kinds.${e}.page`){let t=s.page;if(!t)return[];let o=[],a=[...Object.keys(s.fields),...Object.keys(s.computed??{})],u=new Set,f=(l,r)=>{a.includes(l)?u.has(l)&&o.push(k("page-field-twice",r,`"${l}" is on ${e}'s page twice; name each field once`)):o.push(k("page-field",r,`${e}'s page is to show "${l}", and ${e} has no field or computed field called that`,`use one of: ${a.join(", ")}`)),u.add(l)};(t.fields??[]).forEach((l,r)=>f(l,`${i}.fields.${r}`));let g=new Set;return(t.groups??[]).forEach((l,r)=>{let p=l.title.trim().toLowerCase();g.has(p)&&o.push(k("page-group-twice",`${i}.groups.${r}.title`,`${e}'s page has two groups called "${l.title}"; give each its own title`)),g.add(p),l.fields.forEach((y,m)=>f(y,`${i}.groups.${r}.fields.${m}`))}),o}function gn(e,s=[]){return Ce({declared:Object.keys(e.fields),paged:[...e.page?.fields??[],...(e.page?.groups??[]).flatMap(i=>i.fields)],must:i=>!!e.fields[i].required&&e.fields[i].default===void 0,naming:s})}var Nn=new Set(["subject","now","today","me"]);function Mn(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>xe)return{findings:[k("too-large","",`a document may be at most ${xe/1024} KB`)]};if(typeof e=="string")try{e=JSON.parse(e)}catch(t){return{findings:[k("not-json","",`this is not JSON: ${t.message}`)]}}try{e=an(e).document}catch(t){return{findings:[k("format","formatVersion",t.message)]}}e=tn(e);let s=rn.safeParse(e);if(!s.success)return{findings:s.error.issues.map(t=>{let o=t.path.map(String).join(".");if(t.code==="unrecognized_keys")return k("unknown-key",o,`${t.keys.map(a=>`"${a}"`).join(", ")} ${t.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(t.code==="invalid_union"&&/\.effects\.\d+$/.test(o))return k("effect-shape",o,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(t.code==="invalid_key"){let a=t.issues?.[0]?.message;return k("shape",o,`the name "${String(t.path.at(-1))}" is not allowed here${a?`: ${a}`:""}`)}return k("shape",o,t.message)})};let i=s.data;return{document:i,findings:_n(i)}}var pe=e=>[e??[]].flat();function zn(e){let s=new Map;for(let[i,t]of Object.entries(e.kinds))for(let[o,a]of Object.entries(oe(t.edges))){let u=s.get(o);s.set(o,{name:o,from:[...u?.from??[],i],to:a.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...a.to])],cardinality:a.cardinality??"many"})}return s}function Ht(e){let s=new Map;for(let[t,o]of Object.entries(e.kinds)){let a=se(o),u=me(o.edges);s.set(t,{fields:new Set([...Object.keys(o.fields),...u.keys()]),edges:new Map(Object.entries(oe(o.edges)).map(([f,g])=>[f,g.cardinality??"many"])),...a?{computed:a}:{},...u.size>0?{linked:u}:{}})}let i=se(e);return i&&s.set(Be,{computed:i}),s}function yn(e,s){let i=[],t=pe(e.on),o=(a,u)=>{let f=Ae(s.kinds,a,t)?.reversed===!0,[g,l]=f?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:a,from:g,to:l}:{sever:a,from:g,to:l}};if(e.creates){let a=s.kinds[e.creates],u={};for(let f of Object.keys(a?.fields??{}))u[f]=`$${f}`;for(let f of e.effects??[])"set"in f&&!("create"in f)&&F(f.target)==="new"&&Object.assign(u,f.set);i.push({create:e.creates,as:"new",set:u})}if(e.sets&&i.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&i.push({set:Object.fromEntries(e.writes.map(a=>[a,`$${a}`]))}),e.connects&&(e.replaces&&i.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),i.push(o(e.connects,"connect"))),e.severs&&i.push(o(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&i.push({set:e.setsOther,target:"$to"}),e.setsLinked&&t.length>0)for(let[a,u]of Object.entries(e.setsLinked))i.push({set:u,through:a});return e.removes&&i.push({remove:"$subject"}),e.effects&&i.push(...e.effects.filter(a=>!(e.creates&&"set"in a&&!("create"in a)&&F(a.target)==="new"))),i}function le(e,s,i){try{let t=J(e),o=ae(t);for(let a of o.unknownFunctions)i.push(k("unknown-function",s,`"${a}" is not a function the rule language knows`,"see the rule language in the graview-invariant skill"));return t}catch(t){if(t instanceof ce){i.push(k("expression",s,t.sentence+` (at character ${t.at+1})`));return}throw t}}function Re(e,s,i){try{return Q(e)}catch(t){if(t instanceof Ye||t instanceof ce){i.push(k("template",s,(t instanceof ce,t.sentence)));return}throw t}}function _n(e){let s=[],i=new Set(Object.keys(e.kinds)),t=zn(e),o=e.acts??{},a=new Set(e.roles??[]),u=(l,r)=>me(e.kinds[l]?.edges).has(r),f=l=>Object.keys(e.kinds).some(r=>u(r,l));for(let[l,r]of Object.entries(e.kinds)){let p=`kinds.${l}`;for(let[m,d]of Object.entries(r.edges??{})){if(!Ke(d)&&d.to!=="*")for(let c of d.to)i.has(c)||s.push(k("edge-target",`${p}.edges.${m}.to`,`"${c}" is not a kind this document declares`));r.fields[m]&&s.push(k("edge-field-clash",`${p}.edges.${m}`,`"${m}" is both a field and a relation of ${l}`,"rename one of them"))}r.lifecycle&&!r.fields[r.lifecycle.field]&&s.push(k("lifecycle-field",`${p}.lifecycle.field`,`${l} has no field "${r.lifecycle.field}"`));let y=m=>r.computed!==void 0&&Object.hasOwn(r.computed,m);for(let m of r.glance??[])!r.fields[m]&&!y(m)&&s.push(k("glance-field",`${p}.glance`,`a glance at ${l} is to say "${m}", and ${l} has no field or computed field called that`,`use one of: ${[...Object.keys(r.fields),...Object.keys(r.computed??{})].join(", ")}`));s.push(...mn(l,r));for(let m of["label","describe"]){let d=r[m];if(!d)continue;let c=Re(d,`${p}.${m}`,s);for(let w of c??[])if(w.expr){for(let b of ae(w.expr).names)if(!r.fields[b]){if(y(b)){en(r,b)||s.push(k("template-field",`${p}.${m}`,`${l}'s ${b} is worked out from beyond the record, and a ${m} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${l}'s own fields`));continue}s.push(k("template-field",`${p}.${m}`,`${l} has no field "${b}" for its ${m} to show`,m==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[m,d]of Object.entries(r.derives?.set??{}))fe(d)&&"expr"in d&&le(String(d.expr),`${p}.derives.set.${m}`,s);for(let[m,d]of Object.entries(r.fields)){if(d.default!==void 0&&d.type==="enum"){let b=(d.multiple?Array.isArray(d.default)?d.default:[d.default]:[d.default]).find(S=>!d.options?.includes(String(S)));(b!==void 0||!d.multiple&&Array.isArray(d.default))&&s.push(k("default-option",`${p}.fields.${m}.default`,`"${String(b??d.default)}" is not one of ${m}'s options`))}let c=`${m}Repeat`;d.repeats&&(r.fields[c]||r.edges?.[c]||r.computed?.[c])&&s.push(k("repeat-clash",`${p}.fields.${m}.repeats`,`${l} already has "${c}", where how ${m} repeats is kept`))}}for(let[l,r]of Object.entries(o)){let p=`acts.${l}`;for(let c of pe(r.on))i.has(c)||s.push(k("act-kind",`${p}.on`,`"${c}" is not a kind this document declares`));let y=pe(r.on),m=yn(r,e);if(r.creates&&r.on===void 0&&r.writes&&i.has(r.creates)){for(let c of r.writes)if(!e.kinds[r.creates].fields[c])if(e.kinds[r.creates].computed?.[c]!==void 0)s.push(k("computed-written",`${p}.writes`,`${r.creates}'s ${c} is worked out, not written: no act can set it`,"write the stored fields it is worked out from"));else{if(u(r.creates,c))continue;s.push(k("act-field",`${p}.writes`,`${r.creates} has no field "${c}"`))}}m.length===0&&s.push(k("act-empty",p,`"${l}" does nothing`,"give it effects or a shorthand such as sets or creates"));let d=new Map;m.forEach((c,w)=>{let b=m.length-(r.effects?.length??0),S=r.effects&&w>=b?`${p}.effects.${w-b}`:p;if("create"in c){if(!i.has(c.create))s.push(k("act-kind",`${S}.create`,`"${c.create}" is not a kind this document declares`));else for(let v of Object.keys(c.set??{}))e.kinds[c.create].fields[v]||(e.kinds[c.create].computed?.[v]!==void 0?s.push(k("computed-written",`${S}.set.${v}`,`${c.create}'s ${v} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):s.push(k("act-field",`${S}.set.${v}`,`${c.create} has no field "${v}"`)));c.as&&d.set(c.as,c.create)}else if("connect"in c||"sever"in c){let v="connect"in c?c.connect:c.sever;!t.has(v)&&!f(v)&&s.push(k("act-edge",`${S}.${"connect"in c?"connect":"sever"}`,`"${v}" is not a relation any kind declares`)),F(c.from)==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${l}" acts on "$subject" but does not say which kinds it is "on"`))}else if(!("through"in c))if("set"in c){let v=F(c.target??"$subject"),B=v==="subject"?y:d.has(v??"")?[d.get(v)]:[];v==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${l}" changes "$subject" but does not say which kinds it is "on"`));for(let C of Object.keys(c.set))for(let z of B)if(!(!i.has(z)||e.kinds[z].fields[C]))if(e.kinds[z].computed?.[C]!==void 0)s.push(k("computed-written",`${S}.set.${C}`,`${z}'s ${C} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(z,C))continue;s.push(k("act-field",`${S}.set.${C}`,`${z} has no field "${C}"`))}}else"remove"in c&&F(c.remove)==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${l}" removes "$subject" but does not say which kinds it is "on"`));let x="set"in c&&c.set?Object.values(c.set):[],E="through"in c?`${p}.setsLinked.${c.through}`:`${S}.set`;x.forEach(v=>{v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v&&le(v.expr,E,s)})}),r.allowedWhen&&le(r.allowedWhen,`${p}.allowedWhen`,s),r.refusal&&Re(r.refusal,`${p}.refusal`,s)}for(let[l,r]of Object.entries(e.rules??{})){let p=`rules.${l}`;r.over!=="graph"&&!i.has(r.over)&&s.push(k("rule-kind",`${p}.over`,`"${r.over}" is not a kind this document declares`));let y=r.over==="graph"?void 0:e.kinds[r.over];if(r.covers&&y){let m=ye(r.over,r.covers,d=>t.get(d),d=>i.has(d));if("problem"in m){let{key:d,message:c,fix:w}=m.problem;d==="every"?s.push(k("rule-kind",`${p}.covers.every`,c,w)):s.push(k("rule-covers-relation",`${p}.covers.${d}`,c,w))}}for(let m of["when","require"]){let d=r[m];if(!d)continue;let c=le(d,`${p}.${m}`,s);if(!c)continue;let w=ae(c);for(let b of w.names)if(r.over==="graph")s.push(k("rule-name",`${p}.${m}`,`"${b}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(y&&!y.fields[b]&&!y.edges?.[b]&&y.computed?.[b]===void 0){let S=Object.keys(y.edges??{}).find(x=>x.includes("-")&&x.split("-").includes(b));s.push(k("rule-name",`${p}.${m}`,`${r.over} has no field or relation called "${b}"`,S?`"${S}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${S.replace(/-([a-z0-9])/g,(x,E)=>E.toUpperCase())}"`:void 0))}for(let b of w.edges)!t.has(b)&&!f(b)&&s.push(k("rule-edge",`${p}.${m}`,`"${b}" is not a relation any kind declares`));for(let b of w.sweeps)i.has(b)?r.over!=="graph"&&s.push(Ue("rule-cost",`${p}.${m}`,`this rule looks at every ${b} for every ${r.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):s.push(k("rule-kind",`${p}.${m}`,`"${b}" is not a kind this document declares`))}r.says&&Re(r.says,`${p}.says`,s),(r.repairs??[]).forEach((m,d)=>{!o[m.act]&&!ge(m.act)&&!$e(m.act,e.kinds)&&s.push(k("repair-act",`${p}.repairs.${d}.act`,`"${m.act}" is not an act this document declares`,we(m.act,e)))})}let g=e.policy;return g&&(g.grants.forEach((l,r)=>{if(l.roles!=="*"&&a.size>0)for(let p of l.roles)a.has(p)||s.push(k("grant-role",`policy.grants.${r}.roles`,`"${p}" is not one of the document's roles`));for(let p of["mutations","propose"]){let y=l[p];if(y!==void 0&&y!=="*")for(let m of y)!o[m]&&!ge(m)&&!$e(m,e.kinds)&&s.push(k("grant-act",`policy.grants.${r}.${p}`,`"${m}" is not an act this document declares`,we(m,e)))}}),(g.sees??[]).forEach((l,r)=>{for(let p of l.kinds)i.has(p)||s.push(k("sight-kind",`policy.sees.${r}.kinds`,`"${p}" is not a kind this document declares`));if(l.roles!=="*"&&a.size>0)for(let p of l.roles)a.has(p)||s.push(k("sight-role",`policy.sees.${r}.roles`,`"${p}" is not one of the document's roles`))})),s.push(...Qe(e)),s}function In(e){return e.label?[...e.label.matchAll(/\{\s*([A-Za-z_][A-Za-z0-9_]*)/g)].map(s=>s[1]):[ke(e)??[]].flat()}function Kn(e,s,i,t){let o=new Map,a=pe(e.on),u=new Map,f=new Map;(a.length>0||s.some(d=>"remove"in d&&F(d.remove)==="subject"||"from"in d&&(F(d.from)==="subject"||F(d.to)==="subject")||"set"in d&&!("create"in d)&&!("through"in d)&&F(d.target??"$subject")==="subject"||"through"in d))&&o.set(he,{ref:a.length>0?a:"*",required:!0});let l=e.args??{},r=e.writes?.length===1,p=(d,c)=>c&&d.type===c.type&&d.min===void 0&&d.max===void 0&&d.step===void 0?{...d,...c.min===void 0?{}:{min:c.min},...c.max===void 0?{}:{max:c.max},...c.step===void 0?{}:{step:c.step}}:d,y=(d,c)=>c&&d.type===c.type&&d.format===void 0&&d.unit===void 0?{...p(d,c),...c.format?{format:c.format}:{},...c.unit?{unit:c.unit}:{}}:p(d,c),m=(d,c,w)=>{if(d===he||Nn.has(d)||u.has(d)||o.has(d))return;let b=l[d]?y(l[d],w):void 0;o.set(d,b?{field:b,optional:!b.required,required:!!b.required}:c())};for(let d of s)if("create"in d){let c=i.kinds[d.create],w=c?gn(c,In(c)):[],b=S=>w.includes(S)?w.indexOf(S):w.length;for(let[S,x]of Object.entries(d.set??{}).sort(([E],[v])=>b(E)-b(v))){let E=F(x),v=c?.fields[S];if(E&&v){let B=!!v.required&&v.default===void 0;m(E,()=>({field:v,optional:!B,required:B}),v)}}d.as&&u.set(d.as,d.create)}else if("connect"in d||"sever"in d){let c=t.get("connect"in d?d.connect:d.sever);for(let[w,b]of[["from",d.from],["to",d.to]]){let S=F(b);if(!S)continue;let x=w==="to"?c?.to??"*":c?.from??"*";x!=="*"&&!f.has(S)&&f.set(S,x),m(S,()=>({ref:x,required:!0}))}}else if("through"in d){let c=Ae(i.kinds,d.through,a),w=c&&c.kinds!=="*"?c.kinds[0]:void 0;for(let[b,S]of Object.entries(d.set)){let x=F(S);if(!x||x==="to")continue;let E=w?i.kinds[w]?.fields[b]:void 0;m(x,()=>E?{field:E,optional:!0,required:!1}:{any:!0,required:!1},E)}}else if("set"in d){let c=F(d.target??"$subject"),w=c==="subject"?a[0]:u.get(c??"")??f.get(c??"")?.[0];c&&c!=="subject"&&!u.has(c)&&m(c,()=>({ref:"*",required:!0}));for(let[b,S]of Object.entries(d.set)){let x=F(S);if(!x)continue;let E=w?i.kinds[w]?.fields[b]:void 0;m(x,()=>E?{field:E,optional:!r,required:r}:{any:!0,required:!1},E)}}else if("remove"in d){let c=F(d.remove);c&&m(c,()=>({ref:"*",required:!0}))}for(let[d,c]of Object.entries(l))o.has(d)||o.set(d,{field:c,optional:!c.required,required:!!c.required});return o}function Wt(e,s={}){let i=Mn(e);if(!i.document||ze(i.findings))return{ok:!1,findings:i.findings};let t=i.document,o=[...i.findings];s.previous&&o.push(...Gn(t,s.previous));let a=Ln(t,o);return ze(a.findings)?{ok:!1,findings:a.findings}:We(a,s)}function de(e,s,i){return e.map(t=>{if(t.format||t.expr?.t!=="ident")return t;let o=t.expr.name,a=i?.[o],u=s?.[o]??(typeof a=="object"?a:void 0),f=u?.format;return f==="money"||f==="percent"?{...t,format:f,...f==="money"&&u?.places===0?{formatArgs:["0"]}:{}}:t})}function Pn(e,s,i){let t=i.kinds[e]?.edges?.[s.via]!==void 0?"to":"from",o=i.kinds[s.from],a=[],u={};for(let[f,g]of Object.entries(s.set))if(fe(g)&&"expr"in g){let l=J(g.expr);a.push([f,{expr:l}]),l.t==="ident"&&o?.fields[l.name]&&(u[f]=l.name)}else a.push([f,{value:typeof g=="string"&&g.startsWith("$$")?g.slice(1):g}]);return{from:s.from,via:s.via,sourceEnd:t,set:a,back:u}}function Ln(e,s){let i=zn(e),t={},o=un(e.connections,e.kinds);for(let[r,p]of Object.entries(e.kinds)){let y=ke(p),m=p.label??(y?`{${y}}`:void 0),d=se(p),c=d?pn(e,r,[...d]):[];t[r]={...m?{label:de(Q(m),p.fields,p.computed)}:{},...p.describe?{describe:de(Q(p.describe),p.fields,p.computed)}:{},...d?{computed:[...d]}:{},...c.length>0?{durations:c}:{},...o.has(r)?{keptInStep:o.get(r)}:{},...p.derives?{derives:Pn(r,p.derives,e)}:{}}}let a={};for(let[r,p]of Object.entries(e.acts??{})){let y=yn(p,e),m=Kn(p,y,e,i),d=p.destructive??y.some(z=>"remove"in z||"sever"in z||"replace"in z),c=[...new Set(y.flatMap(z=>"create"in z?[z.create]:[]))],w=[...new Set(y.flatMap(z=>"connect"in z?[z.connect]:[]))],b=[...new Set(y.flatMap(z=>"sever"in z?[z.sever]:"replace"in z?z.replace:[]))],S=[...new Set(y.flatMap(z=>"set"in z&&!("create"in z)&&!("through"in z)&&F(z.target??"$subject")==="subject"?Object.keys(z.set):[]))],x=new Map;for(let z of y){if(!("connect"in z)&&!("sever"in z))continue;let A=i.get("connect"in z?z.connect:z.sever);for(let[M,ie]of[["from",z.from],["to",z.to]]){let W=F(ie),q=M==="to"?A?.to:A?.from;W&&W!=="subject"&&q&&q!=="*"&&x.set(W,[...new Set([...x.get(W)??[],...q])])}}let E={};for(let z of y){if(!("set"in z)||"create"in z||"through"in z)continue;let A=F(z.target??"$subject");for(let M of A&&A!=="subject"&&x.get(A)||[])E[M]=[...new Set([...E[M]??[],...Object.keys(z.set)])]}let v={};for(let z of y)if(!(!("set"in z)||"create"in z||"through"in z||F(z.target??"$subject")!=="subject"))for(let[A,M]of Object.entries(z.set??{}))typeof M=="string"&&F(M)===void 0||typeof M=="number"||typeof M=="boolean"?v[A]=typeof M=="string"&&M.startsWith("$$")?M.slice(1):M:delete v[A];let B=c.length===0&&y.every(z=>!("set"in z)||!z.set||Object.values(z.set).every(A=>!(A&&typeof A=="object"&&!Array.isArray(A)&&"expr"in A))),C=new Map;for(let z of y)if(!(!("set"in z)||!z.set))for(let A of Object.values(z.set))A&&typeof A=="object"&&!Array.isArray(A)&&"expr"in A&&C.set(A.expr,J(A.expr));a[r]={title:p.title??r.replace(/-/g," "),effects:y,args:[...m],...p.allowedWhen?{guard:J(p.allowedWhen)}:{},...p.refusal?{refusal:de(Q(p.refusal),e.kinds[[p.on??[]].flat()[0]??""]?.fields)}:{},exprs:[...C],destructive:d,idempotent:B,creates:c,connects:w,severs:b,writes:S,writesOther:E,sets:v}}let u={};for(let[r,p]of Object.entries(e.rules??{})){let y=p.covers&&p.over!=="graph"?ye(p.over,p.covers,m=>i.get(m),m=>m in e.kinds):void 0;u[r]={title:p.title??r.replace(/-/g," "),...p.require?{require:J(p.require)}:{},...y&&"plan"in y?{covers:y.plan}:{},...p.when?{when:J(p.when)}:{},...p.says?{says:de(Q(p.says),e.kinds[p.over]?.fields)}:{}}}let f=Ze(e,s),g=Je(e),l=Xe(e);return{format:He,document:e,findings:s,kinds:t,...e.computed?{facts:[...se(e)??[]]}:{},edges:[...i].map(([r,{from:p,to:y,cardinality:m}])=>[r,{from:p,to:y,cardinality:m}]),acts:a,rules:u,brand:f,...Object.keys(g).length>0?{viewSpecs:g}:{},...l?{home:l}:{}}}function Yt(e,s,i){let t=/^defineNode\("([^"]+)"\)/.exec(s)?.[1],o=t?i.kinds[t]:void 0;if(!t||!o)return e;let a=Object.keys(o.fields).filter(u=>u!=="label").slice(0,3);return{...e,path:`kinds.${t}.glance`,fix:`Say which: "glance": [${a.map(u=>`"${u}"`).join(", ")}] on kinds.${t} \u2014 the facts a person compares one by, at a glance.`}}function Gn(e,s){let i=[],t=new Set(Object.values(s.kinds).flatMap(o=>Object.keys(o.edges??{})));for(let[o,a]of Object.entries(e.kinds)){let u=a.renamedFrom;u&&!s.kinds[u]&&i.push(k("renamed-from-nothing",`kinds.${o}.renamedFrom`,`${o} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let f=s.kinds[u??o];for(let[g,l]of Object.entries(a.fields)){let r=l.renamedFrom;r&&!f?.fields[r]&&i.push(k("renamed-from-nothing",`kinds.${o}.fields.${g}.renamedFrom`,`${g} says it was ${r}, and the previous ${u??o} has no field called ${r}`,"name the field it was, or drop renamedFrom"))}for(let[g,l]of Object.entries(a.edges??{})){let r=l.renamedFrom;r&&!t.has(r)&&i.push(k("renamed-from-nothing",`kinds.${o}.edges.${g}.renamedFrom`,`${g} says it was ${r}, and the previous version has no relation called ${r}`,"name the relation it was, or drop renamedFrom"))}}return i}export{Mn as a,Ht as b,yn as c,Wt as d,Yt as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as te}from"./chunk.KROR65KD.js";import"./chunk.BJUUSIQY.js";import"./chunk.64FCAUAJ.js";import"./chunk.S3EEY7T3.js";import"./chunk.MD36ZSM5.js";import"./chunk.L6FGKJ5H.js";import{G as ne,V as $}from"./chunk.3CJLAJXP.js";import"./chunk.SDO3U72B.js";import{db as Z,la as Q,oa as X,sd as ee,wd as N}from"./chunk.J24YPQ5I.js";import"./chunk.FQLNBIQ5.js";import{b as P}from"./chunk.AJZBJBMO.js";var D=new WeakMap,Te=5e3;function I(n){let e=D.get(n);if(e&&Date.now()-e.at<Te)return e.list;let t={at:Date.now(),list:Promise.resolve([])};return t.list=Promise.resolve().then(()=>n.list()).catch(()=>[]).then(o=>t.value=[...o,...(t.value??[]).filter(i=>!o.some(l=>l.id===i.id))]),e?.value&&(t.value=e.value),D.set(n,t),t.list}var oe=n=>D.get(n)?.value;function re(n,e){let t=D.get(n);if(!t)return;let o=i=>[...i.filter(l=>l.id!==e.id),e];t.value&&(t.value=o(t.value)),D.set(n,{at:t.at,list:t.list.then(o),...t.value?{value:t.value}:{}})}function A(n,e){let t=N(n,e);return o=>n.graph.getNode(o)!==void 0&&t(o)}var F=["previewed","accepted","declined","undone","abandoned"],we=["graph","light","full"],x={words:300,should:300,name:80,records:200,people:20,stages:8,examples:5},ve=365,xe=5e3,Se=new RegExp("[\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2066-\\u2069]","g");function ie(n,e){if(typeof n!="string")return;let t=n.replace(Se," ").replace(/\s+/g," ").trim();return t.length===0?void 0:t.slice(0,e).trimEnd()}function h(n){return typeof n=="string"&&n.length>0&&n.length<=x.name&&/^[\p{L}\p{N}_][\p{L}\p{N}_.:/-]*$/u.test(n)?n:void 0}var z=(n,e)=>Array.isArray(n)?[...new Set(n.flatMap(t=>h(t)??[]))].slice(0,e):[];function ae(n){let e=typeof n.id=="string"?n.id.slice(0,x.name):void 0;return{kind:n.kind,...e!==void 0?{id:e}:{},...n.onBehalfOf?{onBehalfOf:ae(n.onBehalfOf)}:{}}}var le=n=>n?.kind==="visitor"||n?.onBehalfOf?.kind==="visitor",be=()=>`tl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,ke=new Set(["record","field","selection","list","lens","place","act"]);function Oe(n){let e=n,t=o=>typeof o=="number"&&Number.isFinite(o)&&o>=0?Math.min(1e4,Math.round(o)):0;switch(e?.type){case"act":{let o=h(e.act);return o?{type:"act",act:o,records:t(e.records)}:void 0}case"plan":return{type:"plan",edits:t(e.edits)};case"answer":return{type:"answer"};case"refusal":return{type:"refusal"};case"view":{let o=typeof e.section=="string"?e.section.replace(/\s+/g," ").trim().slice(0,x.name):"";return o?{type:"view",section:o}:void 0}default:return}}function se(n,e,t={}){if(!n||typeof n!="object"||!e||le(e))return;let o=n,i=ie(o.words,x.words),l=Oe(o.decided),a=o.target;if(!i||!l||!a||!ke.has(String(a.on)))return;let c={on:a.on,...h(a.kind)?{kind:h(a.kind)}:{},...h(a.id)?{id:h(a.id)}:{},...h(a.place)?{place:h(a.place)}:{}},s=o.reading,d=s&&(s.which==="itself"||s.which==="held")&&h(s.kind)?{which:s.which,kind:h(s.kind),records:z(s.records,x.records)}:void 0,p=z(o.people,x.people),f=Array.isArray(o.stages)?o.stages.flatMap(he=>{let E=he,V=h(E?.stage),L=E?.ms;return V&&typeof L=="number"&&Number.isFinite(L)&&L>=0?[{stage:V,ms:Math.round(L),...h(E.model)?{model:h(E.model)}:{}}]:[]}).slice(0,x.stages):[],w=F.includes(o.outcome)?o.outcome:"previewed",y=we.includes(o.slot)?o.slot:void 0,b=o.rating==="up"||o.rating==="down"?o.rating:void 0,k=b==="down"?ie(o.should,x.should):void 0,O=typeof o.ms=="number"&&Number.isFinite(o.ms)&&o.ms>=0?Math.round(o.ms):void 0,r=t.id??h(o.id)??be(),g=h(o.conversation)??r,m=h(o.follows),Y=h(o.interaction),J=z(o.examples,x.examples);return{id:r,at:t.at??new Date().toISOString(),by:ae(e),words:i,target:c,...d?{reading:d}:{},...p.length>0?{people:p}:{},decided:l,...y?{slot:y}:{},...f.length>0?{stages:f}:{},...O!==void 0?{ms:O}:{},outcome:w,...b?{rating:b}:{},...k?{should:k}:{},conversation:g,...m?{follows:m}:{},...Y?{interaction:Y}:{},...J.length>0?{examples:J}:{}}}function Pe(n,e){let t=e.outcome===void 0||e.outcome==="previewed"||n.outcome==="accepted"&&e.outcome!=="undone"||n.outcome==="undone"||(n.outcome==="declined"||n.outcome==="abandoned")&&e.outcome==="abandoned"?n.outcome:e.outcome,o=e.rating===void 0?n.rating:e.rating??void 0,i=o!=="down"?void 0:e.should===void 0?n.should:e.should??void 0,{rating:l,should:a,...c}=n;return{...c,outcome:t,...o?{rating:o}:{},...i?{should:i}:{},...e.examples?{examples:e.examples}:{},...e.pinned!==void 0?{pinned:e.pinned}:{},...e.excluded!==void 0?{excluded:e.excluded}:{}}}function Ae(n,e={}){let t=(e.now??Date.now())-(e.retentionDays??ve)*864e5,o=new Map;for(let a of n){let c=Date.parse(a.at);Number.isFinite(c)&&c>=t&&!le(a.by)&&o.set(a.id,a)}let i=[...o.values()],l=e.most??xe;return i.length>l?i.slice(i.length-l):i}function H(n,e,t={}){return"add"in e?Ae([...n,e.add],t):"remove"in e?n.filter(o=>o.id!==e.remove):n.map(o=>o.id===e.change?Pe(o,e.with):o)}var R=n=>n.onBehalfOf?R(n.onBehalfOf):n.id!==void 0?`${n.kind}:${n.id}`:`${n.kind}:?`,Re=n=>[...new Set([...n.target.id?[n.target.id]:[],...n.reading?.records??[],...n.people??[]])];function C(n,e){return n.filter(t=>Re(t).every(e))}var B=n=>!n.excluded&&n.rating!=="down"&&n.outcome!=="undone"&&(n.outcome==="accepted"||n.rating==="up"),U=n=>{let e=n.reading?.kind??n.target.kind??"";return n.decided.type==="act"?`act:${n.decided.act}:${e}:${n.reading?.which??""}`:n.decided.type==="plan"?`plan:${e}`:void 0};function Ce(n,e={}){let t=Math.max(1,e.minPeople??2),o=e.reader?R(e.reader):void 0,i=new Map;for(let l of n){let a=U(l);!a||!B(l)||R(l.by)===o||i.set(a,(i.get(a)??new Set).add(R(l.by)))}return new Set([...i].filter(([,l])=>l.size>=t).map(([l])=>l))}function ce(n,e){return n.filter(t=>(e.rating===void 0||(e.rating==="none"?t.rating===void 0:t.rating===e.rating))&&(e.outcome===void 0||t.outcome===e.outcome)&&(e.kind===void 0||(t.reading?.kind??t.target.kind)===e.kind))}var De=n=>n.filter(e=>B(e)&&U(e)!==void 0);function ue(n){let e=De(n).length;return e===0?"Nothing told here teaches suggestions yet: a telling that is accepted or rated \u{1F44D} will.":`Suggestions come from ${e} rated ${e===1?"telling":"tellings"} in this app.`}function pe(n,e=t=>t){switch(n.decided.type){case"act":return`${e(n.decided.act)}, over ${n.decided.records} ${n.decided.records===1?"record":"records"}`;case"plan":return`A plan of ${n.decided.edits} ${n.decided.edits===1?"change":"changes"} to the app`;case"answer":return"An open answer";case"refusal":return"Nothing it could do";case"view":return`A revision of \u201C${n.decided.section}\u201D`}}var G={previewed:"Previewed",accepted:"Accepted",declined:"Declined",undone:"Undone",abandoned:"Closed with nothing done"},Ee=new Set("a an and are as at be by can do does for from has have how i in is it its me my of on or our please the their them these they this those to was we what when where which who why will with you your all each every".split(" "));function de(n){return[...new Set(n.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").split(/[^\p{L}\p{N}]+/u).filter(e=>e.length>1&&!Ee.has(e)).map(e=>e.length>3&&e.endsWith("s")&&!e.endsWith("ss")?e.slice(0,-1):e))]}function M(n,e,t={}){let o=de(e.words);if(o.length===0)return[];let i=t.reader?R(t.reader):void 0,l=Ce(n,{...t.reader?{reader:t.reader}:{},...t.minPeople!==void 0?{minPeople:t.minPeople}:{}}),a=n.flatMap(d=>{let p=U(d);if(!p||!B(d)||t.rated&&d.rating!=="up")return[];if(!(i!==void 0&&R(d.by)===i)&&!l.has(p))return[];let w=de(d.words),y=o.filter(g=>w.some(m=>m===g||g.length>=3&&m.startsWith(g))).length;if(y===0)return[];let b=y/new Set([...o,...w]).size,k=e.kind!==void 0&&(d.target.kind===e.kind||d.reading?.kind===e.kind)?.25:e.kind!==void 0?-.25:0,O=e.act!==void 0&&d.decided.type==="act"&&d.decided.act===e.act?.15:0,r=Math.max(0,Math.min(1,b*.6+.25+k+O+(d.pinned?.1:0)));return r>=(t.floor??.35)?[{telling:d,score:r,lesson:p}]:[]});a.sort((d,p)=>p.score-d.score||Number(p.telling.pinned??!1)-Number(d.telling.pinned??!1)||(d.telling.at<p.telling.at?1:-1));let c=new Set,s=[];for(let d of a)if(!c.has(d.lesson)&&(c.add(d.lesson),s.push({telling:d.telling,score:d.score}),s.length>=(t.most??2)))break;return s}function ge(n){return n.map(({telling:e})=>({said:e.words,did:e.decided.type==="act"?`act ${e.decided.act} over ${e.reading?.which==="itself"?"the record itself":"each record it holds"}`:e.decided.type==="plan"?"a plan that changes the app":e.decided.type==="view"?"a revision of a view's section":e.decided.type,...e.reading?{reading:e.reading.which}:{}}))}var S=P(ne(),1),T=P($(),1);function ye(n,e){if(e.on==="list"||e.on==="lens")return e.kind;let t=te(e)[0];return t?n.graph.getNode(t)?.kind:void 0}function Le(n,e,t,o,i){let l=n?oe(n):void 0;if(!l)return{examples:[],ids:[]};let a=ye(e,i),c=M(C(l,A(e,t)),{words:o,...a?{kind:a}:{}},{reader:t,rated:!0,most:3});return{examples:ge(c),ids:c.map(s=>s.telling.id)}}function Ne(n){let e=new Set((n.stages??[]).map(t=>t.stage));return e.has("thinking")?"full":e.has("light")?"light":e.has("fast")?"graph":(n.usage??[]).some(t=>t.tier==="thinking")?"full":void 0}function $e(n,e){if(n.interaction.outcome==="failed"||e&&"refused"in e)return{type:"refusal"};if(e&&"question"in e)return e.proposal?{type:"plan",edits:e.parts.length}:{type:"refusal"};let t=n.ghost?.proposals??[];return t.length>0?{type:"act",act:t[0].call.name,records:new Set(t.map(i=>i.record??i.id)).size}:{type:"answer"}}function Ie(n,e){let t=new Set;for(let o of e.ghost?.proposals??[])for(let i of Object.values(o.call.args))typeof i=="string"&&i!==o.record&&n.graph.getNode(i)&&t.add(i);return[...t]}function Me(n,e){let{target:t,result:o}=e,i=ye(n,t),l=t.on==="record"||t.on==="field"?t.id:void 0,a=t.on==="lens"||t.on==="place"?t.place:void 0,c=o.reading?{which:o.reading.which,kind:o.reading.kind,records:o.reading.records}:void 0,s=Ie(n,o),d=Ne(o.interaction),p=$e(o,e.plan);return{words:e.words,target:{on:t.on,...i?{kind:i}:{},...l?{id:l}:{},...a?{place:a}:{}},...c?{reading:c}:{},...s.length>0?{people:s}:{},decided:p,...d?{slot:d}:{},...o.interaction.stages?{stages:o.interaction.stages}:{},ms:e.ms,outcome:"previewed",...e.conversation?{conversation:e.conversation}:{},...e.follows?{follows:e.follows}:{},interaction:o.interaction.id,...e.examples&&e.examples.length>0?{examples:e.examples}:{}}}function _e(n,e,t){if(!n)return;let o=se(e,t);if(o)return re(n,o),Promise.resolve().then(()=>n.add(o)).catch(()=>{}),o}function _(n,e,t){n&&Promise.resolve().then(()=>n.change(e,t)).catch(()=>{})}var We={accepted:"accepted",partly:"accepted",drawn:"accepted",dismissed:"declined"};function ze(n,e,t){let o,i=()=>{let s=n.get().entries.find(p=>p.id===t.interaction);if(!s)return;let d=s.undone?"undone":We[s.outcome];!d||d===o||(o=d,_(e,t.id,{outcome:d}),d==="undone"&&c())},l=n.subscribe(i),a=setTimeout(()=>c(),30*6e4),c=()=>{l(),clearTimeout(a)};return c}function Fe({told:n,telling:e}){let[t,o]=(0,S.useState)(e.rating),[i,l]=(0,S.useState)(""),[a,c]=(0,S.useState)(!1),s=(0,S.useId)();(0,S.useEffect)(()=>{o(e.rating),l(""),c(!1)},[e.id,e.rating]);let d=f=>{let w=t===f?void 0:f;o(w),c(!1),_(n,e.id,{rating:w??null})},p=()=>{let f=i.trim();!f||t!=="down"||(_(n,e.id,{should:f}),c(!0))};return(0,T.jsxs)("div",{"data-testid":"quick-ask-rating","data-rating":t??"",style:{display:"grid",gap:6},children:[(0,T.jsxs)("div",{role:"group","aria-label":"Was this right?",style:{display:"flex",gap:4,justifyContent:"flex-end"},children:[(0,T.jsx)("button",{type:"button","data-testid":"quick-ask-right","aria-label":"This was right",title:"This was right","aria-pressed":t==="up",onClick:()=>d("up"),style:t==="up"?fe:K,children:(0,T.jsx)("span",{"aria-hidden":"true",children:"\u{1F44D}"})}),(0,T.jsx)("button",{type:"button","data-testid":"quick-ask-wrong","aria-label":"This was wrong",title:"This was wrong","aria-pressed":t==="down",onClick:()=>d("down"),style:t==="down"?fe:K,children:(0,T.jsx)("span",{"aria-hidden":"true",children:"\u{1F44E}"})})]}),t==="down"?(0,T.jsxs)("div",{style:{display:"grid",gap:2},children:[(0,T.jsxs)("label",{htmlFor:s,style:{fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:["What should it have done? ",(0,T.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:"(optional)"})]}),(0,T.jsx)("input",{id:s,type:"text","data-testid":"quick-ask-should",value:i,maxLength:300,autoComplete:"off",enterKeyHint:"done",onChange:f=>{l(f.target.value),c(!1)},onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),p())},onBlur:p,style:He}),a?(0,T.jsx)("span",{role:"status","data-testid":"quick-ask-should-kept",style:{fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:"Kept, to learn from."}):null]}):null]})}var K={display:"inline-grid",placeItems:"center",width:30,height:28,padding:0,font:"inherit",fontSize:"0.875rem",lineHeight:1,background:"transparent",border:"1px solid transparent",borderRadius:6,boxShadow:"none",cursor:"pointer",opacity:.7},fe={...K,opacity:1,borderColor:"var(--graview-accent)",background:"var(--graview-panel)"},He={boxSizing:"border-box",width:"100%",height:32,padding:"0 8px",font:"inherit",fontSize:"max(1rem,16px)",color:"var(--graview-ink)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:8};var j=n=>n.charAt(0).toUpperCase()+n.slice(1);function me(n,e){if(!e)return;let t=n.graph.getNode(e);if(t)return t.kind;let o=/^(?:kind|aggregate):(.+)$/.exec(e)?.[1];return o&&n.schema.tryDefinition(o)?o:void 0}function Be(n,e,t){let o=n.schema;if(e.decided.type==="plan")return j(e.words);if(e.decided.type!=="act")return;let i=e.decided.act,l=n.allMutations().find(y=>y.name===i);if(!l)return;let a=l.title??l.name,c=y=>/\b(?:it|this|them)\b/i.test(a)?a.replace(/\b(?:it|this|them)\b/i,y):`${a} ${y}`,s=t?n.graph.getNode(t):void 0,d=s?Q(o.tryDefinition(s.kind),s):void 0,p=e.reading?.kind??e.target.kind;if(!p||!o.tryDefinition(p))return;if(e.reading?.which==="itself"||!e.reading&&s?.kind===p)return s&&s.kind===p&&d?j(c(d)):void 0;let f=s?new Set([...n.graph.in(s.id),...n.graph.out(s.id)].filter(y=>y.kind===p).map(y=>y.id)).size:me(n,t)===p?n.graph.allNodes().filter(y=>y.kind===p).length:0;if(f===0)return;let w=f===1?(o.tryDefinition(p)?.noun??p).toLowerCase():X(o,p).toLowerCase();return j(c(`the ${f} ${w}${d?` in ${d}`:""}`))}async function Ue(n,e,t){return C(await I(n),A(e,t))}function Ge(n,e,t,o,i,l=4){if(o.trim()==="")return[];let a=me(e,i);return M(n,{words:o,...a?{kind:a}:{}},{reader:t,most:l}).flatMap(({telling:c})=>{let s=Be(e,c,i);return s?[{key:`told:${c.id}`,telling:c,label:s}]:[]})}var v=P(ne(),1),u=P($(),1);function Ke({told:n,store:e,principal:t,onClose:o}){let[i,l]=(0,v.useState)(null),[a,c]=(0,v.useState)({}),s=(0,v.useRef)(null);(0,v.useEffect)(()=>{let r=!0;return Promise.resolve().then(()=>n.list()).then(g=>r&&l(g),()=>r&&l([])),s.current?.focus({preventScroll:!0}),()=>{r=!1}},[n]);let d=(0,v.useMemo)(()=>i?C(i,N(e,t)):[],[i,e,t]),p=(0,v.useMemo)(()=>[...ce(d,a)].sort((r,g)=>r.at<g.at?1:-1),[d,a]),f=(0,v.useMemo)(()=>[...new Set(d.flatMap(r=>r.reading?.kind??r.target.kind??[]))].sort(),[d]),w=r=>e.allMutations().find(g=>g.name===r)?.title??r,y=r=>e.schema.tryDefinition(r)?.plural??r,b=r=>{try{return Z(r.by,{graph:e.graph,schema:e.schema})}catch{return r.by.id??r.by.kind}},k=(r,g)=>{l(m=>m&&H(m,{change:r,with:g})),Promise.resolve().then(()=>n.change(r,g)).catch(()=>{})},O=r=>{l(g=>g&&H(g,{remove:r})),Promise.resolve().then(()=>n.remove(r)).catch(()=>{})};return(0,u.jsxs)("section",{ref:s,tabIndex:-1,"data-testid":"told-panel","data-graview-overlay":"","aria-label":"What Graview has been told",onKeyDown:r=>{r.key==="Escape"&&(r.stopPropagation(),o())},style:je,children:[(0,u.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[(0,u.jsx)("h2",{style:{margin:0,fontSize:"1rem",fontWeight:600,flex:"1 1 auto"},children:"What Graview has been told"}),(0,u.jsx)("button",{type:"button","data-testid":"told-close",onClick:o,style:W,children:"Close"})]}),(0,u.jsx)("p",{"data-testid":"told-teaching",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:i===null?"Reading what was told\u2026":ue(d)}),(0,u.jsxs)("div",{role:"group","aria-label":"Show only",style:{display:"flex",flexWrap:"wrap",gap:8,fontSize:"0.8125rem"},children:[(0,u.jsxs)("label",{style:q,children:["Rating",(0,u.jsxs)("select",{"data-testid":"told-filter-rating",value:a.rating??"",onChange:r=>c(({rating:g,...m})=>r.target.value?{...m,rating:r.target.value}:m),children:[(0,u.jsx)("option",{value:"",children:"Any"}),(0,u.jsx)("option",{value:"up",children:"\u{1F44D} Right"}),(0,u.jsx)("option",{value:"down",children:"\u{1F44E} Wrong"}),(0,u.jsx)("option",{value:"none",children:"Not rated"})]})]}),(0,u.jsxs)("label",{style:q,children:["Outcome",(0,u.jsxs)("select",{"data-testid":"told-filter-outcome",value:a.outcome??"",onChange:r=>c(({outcome:g,...m})=>r.target.value?{...m,outcome:r.target.value}:m),children:[(0,u.jsx)("option",{value:"",children:"Any"}),F.map(r=>(0,u.jsx)("option",{value:r,children:G[r]},r))]})]}),(0,u.jsxs)("label",{style:q,children:["Kind",(0,u.jsxs)("select",{"data-testid":"told-filter-kind",value:a.kind??"",onChange:r=>c(({kind:g,...m})=>r.target.value?{...m,kind:r.target.value}:m),children:[(0,u.jsx)("option",{value:"",children:"Any"}),f.map(r=>(0,u.jsx)("option",{value:r,children:y(r)},r))]})]})]}),i!==null&&p.length===0?(0,u.jsx)("p",{"data-testid":"told-none",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:d.length===0?"Nothing has been told here yet.":"Nothing told here fits these."}):null,(0,u.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8,overflowY:"auto"},children:p.map(r=>(0,u.jsxs)("li",{"data-testid":"told-entry","data-telling":r.id,"data-outcome":r.outcome,"data-rating":r.rating??"","data-excluded":r.excluded?"":void 0,"data-pinned":r.pinned?"":void 0,style:qe,children:[(0,u.jsxs)("p",{style:{margin:0,fontWeight:550,overflowWrap:"anywhere"},children:["\u201C",r.words,"\u201D"]}),(0,u.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem"},children:[pe(r,w)," \xB7 ",G[r.outcome],r.rating?` \xB7 ${r.rating==="up"?"\u{1F44D} right":"\u{1F44E} wrong"}`:"",r.pinned?" \xB7 a good example":"",r.excluded?" \xB7 excluded from suggestions":""]}),r.should?(0,u.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",fontStyle:"italic"},children:["Should have: ",r.should]}):null,(0,u.jsxs)("p",{style:{margin:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:[b(r)," \xB7 ",(0,u.jsx)("time",{dateTime:r.at,children:new Date(r.at).toLocaleString()}),r.ms!==void 0?` \xB7 ${r.ms<1e3?`${r.ms} ms`:`${(r.ms/1e3).toFixed(1)} s`}`:""]}),(0,u.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:[(0,u.jsx)("button",{type:"button","data-testid":"told-pin","aria-pressed":r.pinned===!0,onClick:()=>k(r.id,{pinned:!r.pinned}),style:W,children:r.pinned?"Not a good example":"A good example"}),(0,u.jsx)("button",{type:"button","data-testid":"told-exclude","aria-pressed":r.excluded===!0,onClick:()=>k(r.id,{excluded:!r.excluded}),style:W,children:r.excluded?"Suggest it again":"Exclude from suggestions"}),(0,u.jsx)("button",{type:"button","data-testid":"told-delete",onClick:()=>O(r.id),style:W,children:"Delete"})]})]},r.id))})]})}var je={position:"absolute",insetBlock:"60px 12px",insetInlineEnd:12,width:"min(440px, calc(100% - 24px))",boxSizing:"border-box",display:"flex",flexDirection:"column",gap:10,padding:14,borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",zIndex:ee("popover"),overflow:"hidden"},qe={display:"grid",gap:4,padding:10,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)"},W={padding:"2px 10px",minHeight:28,font:"inherit",fontSize:"0.8125rem",borderRadius:8},q={display:"inline-flex",alignItems:"center",gap:4};export{Fe as RateTelling,Ke as ToldPanel,_ as changeTelling,Le as examplesHere,_e as keepTelling,Ue as readToldHere,A as seenOnThisPage,Me as tellingDraftOf,I as toldListed,Ge as toldSuggestionsFrom,ze as watchTelling};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as p}from"./chunk.CS72MISN.js";import"./chunk.G4JJXA63.js";import{a}from"./chunk.TBY5IR7C.js";import"./chunk.XSWR5LI4.js";import"./chunk.BIDL7GQD.js";import"./chunk.XTTESA7X.js";import"./chunk.MH46V556.js";import"./chunk.XOZU4OFA.js";import"./chunk.5M34BJIQ.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.UHI3X2YD.js";import"./chunk.INTJD5WG.js";import"./chunk.2QQ37RCZ.js";import"./chunk.WVUJXDXZ.js";import"./chunk.S2DOVJRL.js";import"./chunk.64FCAUAJ.js";import"./chunk.DA4RSHLW.js";import"./chunk.FOSY7MZF.js";import"./chunk.NBVPWLRY.js";import"./chunk.S3EEY7T3.js";import"./chunk.SPCAMQJE.js";import"./chunk.TUCSUZNO.js";import"./chunk.ZMWAZACO.js";import"./chunk.CD6YWH6T.js";import"./chunk.J24YPQ5I.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{j as draftAnswer,i as draftFromLens,c as draftSight,m as draftView,b as isDraftFailure,d as judgeLens,e as lensEditOf,g as lensFromSpec,a as mayChangeDeclaration,k as recipeDraft,h as recipeOfLens,n as refineDraft,p as runDraftTool,f as takeBackEditOf,l as templateDraft,o as withReaderLenses};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as t}from"./chunk.SDO3U72B.js";var d=t(()=>(__graviewPreload(import.meta.url,["./chunk.
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as t}from"./chunk.SDO3U72B.js";var d=t(()=>(__graviewPreload(import.meta.url,["./chunk.35E75QJ7.js","./chunk.BBLIT7S7.js","./chunk.NJSK3UO2.js","./chunk.5FQSYMAE.js","./chunk.SOMRYDDH.js","./chunk.3L37FY3G.js","./chunk.CGQ6KXVK.js","./chunk.3WP66LB5.js","./chunk.A4VA3DU5.js","./chunk.B3WVCSW5.js","./chunk.XTTESA7X.js","./chunk.SDO3U72B.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZT5YQSSP.js")));function v(i,r){let e=!1,n=()=>{window.removeEventListener("online",n),e||o()},o=()=>void i().then(m=>{e||r(m)},()=>{e||window.addEventListener("online",n)});return o(),()=>{e=!0,window.removeEventListener("online",n)}}export{d as a,v as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk.MIE4TJRW.js";import{o as P}from"./chunk.CXJJB3MK.js";import"./chunk.OJGHDWI6.js";import"./chunk.74B6KQF4.js";import"./chunk.DA4RSHLW.js";import"./chunk.FOSY7MZF.js";import"./chunk.NBVPWLRY.js";import"./chunk.S3EEY7T3.js";import"./chunk.MD36ZSM5.js";import"./chunk.L6FGKJ5H.js";import{G as A,V as S,ea as b}from"./chunk.3CJLAJXP.js";import"./chunk.SDO3U72B.js";import{Ia as w,rd as x,va as L}from"./chunk.J24YPQ5I.js";import"./chunk.FQLNBIQ5.js";import{b as R}from"./chunk.AJZBJBMO.js";var u=R(A(),1);var n=R(S(),1),C={kind:"human"},p={color:"var(--graview-ink-muted)"};function I(e){if(e){if(/^https?:\/\//i.test(e))try{return new URL(e).href}catch{return}return L(e)?e:void 0}}function z(e){let o=b(),t=o?.linkedReads,[i,a]=(0,u.useState)(()=>t?t.answered(e)??"asking":null);return(0,u.useEffect)(()=>{if(!t){a(o?.linkedRecords?"asking":null);return}let d=t.answered(e);if(a(d===void 0?"asking":d),d!==void 0)return;let s=!0;return t.ask(e).then(l=>s&&a(l)),()=>{s=!1}},[t,o?.linkedRecords,e.address,e.kind,e.id]),i}function V({reference:e,as:o}){let t=b(),i=z(e),a={position:"relative",zIndex:x.raised,overflowWrap:"anywhere",minWidth:0,maxWidth:"100%"};if(i==="asking")return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"asking","aria-busy":"true",style:{...p,...a},children:"Linked record"});if(i&&"denied"in i)return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"denied",style:{...p,fontStyle:"italic",...a},children:"linked record (no access)"});if(!i)return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"missing",style:{...p,fontStyle:"italic",...a},children:"linked record (not found)"});let d=I(i.href),s=t?.linkedRecords,l=t?.principal??C,g=s?.open?c=>{c.metaKey||c.ctrlKey||(c.preventDefault(),s.open(e,l))}:void 0,k=(0,n.jsx)("a",{"data-graview-linked-title":"",...d?{href:d}:{role:"link",tabIndex:0},...g?{onClick:g,onKeyDown:c=>!d&&(c.key==="Enter"||c.key===" ")?g(c):void 0}:{},style:{fontWeight:600,color:"inherit",textUnderlineOffset:3,cursor:d||g?"pointer":"default"},children:i.label});return o==="chip"?(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"found",title:i.describe,style:{display:"inline-flex",alignItems:"center",minHeight:24,...a},children:k}):(0,n.jsx)(D,{record:i,title:k,base:a})}function D({record:e,title:o,base:t}){return(0,n.jsxs)("span",{"data-graview-linked":"","data-graview-linked-state":"found",style:{display:"grid",gap:2,padding:"8px 10px",border:"1px solid var(--graview-line)",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-surface)",...t},children:[(0,n.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"2px 8px"},children:[o,e.app?(0,n.jsxs)("span",{"data-graview-linked-app":"",style:{...p,fontSize:"0.75rem"},children:["in ",e.app]}):null]}),e.describe?(0,n.jsx)("span",{"data-graview-linked-describe":"",style:{...p,fontSize:"0.8125rem"},children:e.describe}):null,e.card&&e.card.length>0?(0,n.jsx)("span",{"data-graview-linked-card":"",style:{display:"flex",flexWrap:"wrap",gap:"2px 12px",fontSize:"0.8125rem"},children:e.card.map(i=>(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{style:p,children:i.label})," ",i.text]},i.label))}):null]})}function H({relation:e,refs:o,as:t="record",nodeId:i,field:a,style:d}){let s=(0,n.jsx)("span",{"data-graview-linked-list":"",style:{display:"grid",gap:6,minWidth:0,...d},children:o.map(l=>(0,n.jsx)(V,{reference:l,as:t},w(l)))});return i&&a?(0,n.jsx)(K,{nodeId:i,field:a,relation:e,refs:o,drawn:s}):s}function K({nodeId:e,field:o,relation:t,refs:i,drawn:a}){let{fields:d,commit:s}=P(e),l=d.find(f=>f.field===o),[g,k]=(0,u.useState)(!1);if(!l)return a;let c=t.cardinality==="one"?i[0]?w(i[0]):void 0:i.map(w);return(0,n.jsxs)("span",{style:{display:"grid",gap:6,minWidth:0},children:[a,g?(0,n.jsx)(N,{relation:t,value:c,label:"Link another record",onChange:f=>{s(l,f),k(!1)},onCancel:()=>k(!1)}):(0,n.jsx)("button",{type:"button","data-graview-linked-change":"",onClick:()=>k(!0),style:{justifySelf:"start",font:"inherit",fontSize:"0.8125rem",background:"none",border:0,padding:"4px 0",color:"var(--graview-accent)",cursor:"pointer",minHeight:24},children:"Change"})]})}function N({relation:e,value:o,onChange:t,onCancel:i,label:a}){let d=b(),s=d?.linkedRecords,l=d?.principal??C,g=(0,u.useId)(),[k,c]=(0,u.useState)(""),[f,m]=(0,u.useState)("asking");(0,u.useEffect)(()=>{if(!s)return;let r=!0;m("asking");let y=setTimeout(()=>{Promise.resolve().then(()=>s.find({address:e.address,kinds:e.kinds,query:k,limit:20},l)).then(h=>r&&m(Array.isArray(h)?h:"denied"),()=>r&&m([]))},150);return()=>{r=!1,clearTimeout(y)}},[s,e.address,e.kinds.join(","),k,l.kind,l.id]);let v=new Set([o].flat().filter(r=>typeof r=="string")),W=r=>{let y=w(r);if(e.cardinality==="one")return t(y);t(v.has(y)?[...v].filter(h=>h!==y):[...v,y])};return s?(0,n.jsxs)("span",{"data-graview-linked-picker":"",style:{display:"grid",gap:6,minWidth:0},children:[(0,n.jsx)("label",{htmlFor:g,style:{...p,fontSize:"0.8125rem"},children:a}),(0,n.jsx)("input",{id:g,type:"search",value:k,placeholder:`Find one in ${e.address}`,onChange:r=>c(r.target.value),style:{font:"inherit",minHeight:32,padding:"4px 8px",border:"1px solid var(--graview-line)",borderRadius:6,background:"var(--graview-surface)",color:"inherit",minWidth:0}}),f==="asking"?(0,n.jsx)("span",{"aria-busy":"true",style:p,children:"Looking\u2026"}):f==="denied"?(0,n.jsx)("span",{"data-graview-linked-state":"denied",style:{...p,fontStyle:"italic"},children:"linked record (no access)"}):f.length===0?(0,n.jsx)("span",{style:p,children:"Nothing there matches."}):(0,n.jsx)("ul",{role:"list",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:4},children:f.map(r=>{let y=v.has(w(r));return(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button","data-graview-linked-candidate":w(r),"aria-pressed":y,onClick:()=>W(r),style:{display:"grid",gap:2,width:"100%",textAlign:"start",font:"inherit",padding:"6px 8px",minHeight:32,border:"1px solid var(--graview-line)",borderRadius:6,background:y?"var(--graview-accent-soft, var(--graview-surface))":"var(--graview-surface)",color:"inherit",cursor:"pointer"},children:[(0,n.jsx)("span",{style:{fontWeight:600},children:r.label}),r.describe?(0,n.jsx)("span",{style:{...p,fontSize:"0.8125rem"},children:r.describe}):null]})},w(r))})}),i?(0,n.jsx)("button",{type:"button",onClick:i,style:{justifySelf:"start",font:"inherit",fontSize:"0.8125rem",background:"none",border:0,padding:"4px 0",color:"var(--graview-ink-muted)",cursor:"pointer",minHeight:24},children:"Keep it as it is"}):null]}):(0,n.jsxs)("span",{"data-graview-linked-picker":"","data-graview-linked-state":"no-host",style:p,children:["This page cannot read ",e.address,", so nothing there can be linked here."]})}var T=e=>(0,n.jsx)(H,{...e}),U=e=>(0,n.jsx)(N,{...e});export{N as LinkedPicker,H as LinkedRecordView,U as drawLinkedPicker,T as drawLinkedRecord};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Pe,b as Lt}from"./chunk.KHRS2SKB.js";import"./chunk.T6PU3NKP.js";import"./chunk.LON75VHP.js";import"./chunk.7VQ3C7F4.js";import{j as At,k as Rt,l as Ht}from"./chunk.ZZM75ZTN.js";import"./chunk.ISN2QTVL.js";import"./chunk.2PK335JQ.js";import"./chunk.3KUYB5ZT.js";import"./chunk.IMKD6QQG.js";import"./chunk.HJCQ6I3S.js";import"./chunk.ZJFXM3LE.js";import"./chunk.PTQPS2FJ.js";import"./chunk.UETLP5KC.js";import{a as Et,b as P}from"./chunk.IQC3GOXO.js";import{a as Ie,b as Mt}from"./chunk.NKYYDFIX.js";import"./chunk.6RZHKQP3.js";import"./chunk.L7NJLZWV.js";import"./chunk.TBY5IR7C.js";import"./chunk.XSWR5LI4.js";import"./chunk.BIDL7GQD.js";import"./chunk.XTTESA7X.js";import"./chunk.J6KNEI5R.js";import{b as St,c as xt}from"./chunk.2YMO7ZVX.js";import"./chunk.MH46V556.js";import"./chunk.XOZU4OFA.js";import"./chunk.5M34BJIQ.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.UHI3X2YD.js";import"./chunk.INTJD5WG.js";import"./chunk.YFVJUHAK.js";import"./chunk.2QQ37RCZ.js";import{v as Tt}from"./chunk.CXJJB3MK.js";import"./chunk.OJGHDWI6.js";import"./chunk.74B6KQF4.js";import"./chunk.S2DOVJRL.js";import"./chunk.64FCAUAJ.js";import"./chunk.DA4RSHLW.js";import{l as kt}from"./chunk.FOSY7MZF.js";import{b as vt}from"./chunk.NBVPWLRY.js";import"./chunk.S3EEY7T3.js";import"./chunk.SPCAMQJE.js";import"./chunk.TUCSUZNO.js";import"./chunk.ZMWAZACO.js";import"./chunk.CD6YWH6T.js";import{a as Le,c as $e,e as Ce,f as wt,m as bt}from"./chunk.MD36ZSM5.js";import"./chunk.L6FGKJ5H.js";import{G as Re,Oa as He,Ta as ft,V as mt,Xa as yt,da as se,h as gt,u as ht}from"./chunk.3CJLAJXP.js";import"./chunk.SDO3U72B.js";import{Mc as ut,Ob as dt,Oc as ct,sa as Ae,sd as pt,ta as ae}from"./chunk.J24YPQ5I.js";import"./chunk.FQLNBIQ5.js";import{b as Q}from"./chunk.AJZBJBMO.js";var a=Q(Re(),1);function $t(l){return l.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").split(/[^\p{L}\p{N}]+/u).filter(Boolean)}function Ct(l,r){let o=$t(r);if(o.length===0)return!0;let s=$t(l);return o.every(f=>s.some(b=>b.startsWith(f)))}var q=Q(Re(),1),on=250,ze=.2,rn=l=>l===void 0||l.off?void 0:l.fast??(l.decide?{model:l.name??"decide",decide:l.decide}:void 0);function It(l,r,o){let[s,f]=(0,q.useState)(null),b=(0,q.useRef)(o);b.current=o;let S=o.map(y=>`${y.key}\0${y.label}`).join(""),h=rn(l);return(0,q.useEffect)(()=>{let y=r.trim();if(!h||y===""||b.current.length===0)return;let p=!0,w=new Map(b.current.map((v,g)=>[`r${g+1}`,v])),x=setTimeout(()=>{h.decide({typed:y},{row:{type:"choice",instructions:`Which of these menu rows does somebody typing \u201C${y}\u201D mean?`,criteria:{...Object.fromEntries([...w].map(([v,g])=>[v,g.label])),none:"None of these rows"}}}).then(v=>{l?.meter?.({tier:"fast",model:h.model,inputTokens:v.usage.inputTokens,outputTokens:v.usage.outputTokens,interaction:"menu"});let g=v.answers.row;if(!p||g?.type!=="choice")return;let T=new Map;for(let[ce,pe]of Object.entries(g.probabilities)){let Y=w.get(ce);Y&&T.set(Y.key,pe)}if(g.choice==="none")return f({words:y,chances:new Map});let M=w.get(g.choice);M&&!T.has(M.key)&&T.set(M.key,g.confidence),f({words:y,chances:T})}).catch(()=>{})},on);return()=>{p=!1,clearTimeout(x)}},[r,S,h===void 0]),s!==null&&s.words===r.trim()?s.chances:null}var L=Q(Re(),1),zt=2,Pt,ln=()=>Pt??=(__graviewPreload(import.meta.url,["./chunk.KROR65KD.js","./chunk.BJUUSIQY.js","./chunk.64FCAUAJ.js","./chunk.S3EEY7T3.js","./chunk.MD36ZSM5.js","./chunk.L6FGKJ5H.js","./chunk.3CJLAJXP.js","./chunk.SDO3U72B.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.UL62ELNR.js")).catch(l=>(Pt=void 0,Promise.reject(l)));function Dt(l,r,o,s,f,b,S=4){let h=l&&!l.off?l.told:void 0,y=s.trim()!=="",[p,w]=(0,L.useState)(null);(0,L.useEffect)(()=>w(null),[b]);let[x,v]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{if(!h||b===null||b===void 0)return;let g=globalThis;if(!g.requestIdleCallback)return;let T=g.requestIdleCallback(()=>v(!0),{timeout:3e3});return()=>g.cancelIdleCallback?.(T)},[h,b]),(0,L.useEffect)(()=>{if(!h||p||!(y||x))return;let g=!0;return ln().then(async T=>{let M=await T.readToldHere(h,r,o);g&&w({tellings:M,module:T})}).catch(()=>{}),()=>{g=!1}},[h,y,x,p,r,o]),(0,L.useMemo)(()=>p&&y?p.module.toldSuggestionsFrom(p.tellings,r,o,s,f,S):[],[p,y,s,r,o,f,S])}var i=Q(mt(),1);function Rn(l,r,o){let s=r.on??r.about[r.about.length-1];At(l,r.about,{...o,pins:Pe(),...s===void 0?{}:{focus:s}})}function Hn({placement:l="float",chosen:r=!0}={}){let{menuAt:o}=se();return l==="menu"&&o===null?r?(0,i.jsx)(an,{}):null:(0,i.jsx)(sn,{placement:l})}function an(){let{store:l,setMenuAt:r,view:o}=se(),{selection:s}=He(),f=(0,a.useRef)(null),[b,S]=(0,a.useState)(null),[h,y]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let w=f.current?.offsetParent??f.current?.parentElement;if(!w)return;let x=w.getBoundingClientRect(),v=Math.round(x.width);v!==b&&S(v);let g=[...w.querySelectorAll('[data-testid="lines-key"][data-graview-up-row], [data-testid="overview"]')].map(M=>M.getBoundingClientRect()).filter(M=>M.width>0&&M.top-x.top<40),T=g.length>0?Math.round(x.right-Math.min(...g.map(M=>M.left))+8):null;T!==h&&y(T)});let p=s.length===1&&!o.overview?l.graph.getNode(s[0]):void 0;return!p||b===null||b>=Ot?(0,i.jsx)("span",{ref:f,hidden:!0}):(0,i.jsx)("button",{type:"button",ref:f,"data-testid":"chosen-acts","aria-label":`What can be done with ${P(l,p.id)}`,"aria-haspopup":"menu",onClick:w=>{let x=w.currentTarget.getBoundingClientRect();r({x:Math.round(x.right),y:Math.round(x.bottom+4),on:p.id})},style:{position:"absolute",...h!==null?{right:h,top:14,minHeight:38}:{right:"calc(14px + var(--graview-dock, 0px))",top:98},zIndex:"var(--graview-layer-overview, 10)",...h===null?{minHeight:30}:{},padding:"0 12px",borderRadius:8,fontSize:"0.8125rem",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Acts\u2026"})}var Ot=564;function sn({placement:l}){let{store:r,menuAt:o,setMenuAt:s,view:f,signIn:b,aiDesk:S,ai:h,principal:y}=se(),p=(0,a.useRef)(null),w=(0,a.useRef)(null),x=(0,a.useRef)(null),v=(0,a.useRef)(null);o?.returnTo&&(v.current=o.returnTo);let g=e=>{let t=e.closest("[data-graview-asking]")?.getAttribute("data-graview-asking"),n=e.getAttribute("data-pin-for"),u=t??e.getAttribute("data-affordance")??(n===null?null:`pin:${n}`)??e.getAttribute("data-menu-item");w.current=u===null?null:{key:u,element:e}};(0,a.useEffect)(()=>{let e=p.current,t=w.current;if(t===null||document.activeElement!==document.body||t.element.isConnected)return;let n=t.key;if(!e){w.current=null;let H=v.current;v.current=null,(H?.isConnected?H:x.current)?.focus();return}((n.startsWith("pin:")?e.querySelector(`[data-pin-for="${CSS.escape(n.slice(4))}"]`):null)??e.querySelector(`[data-affordance="${CSS.escape(n)}"]:not([disabled])`)??e).focus()});let[T,M]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let e=p.current?.offsetParent??p.current?.parentElement;if(e instanceof HTMLElement&&(x.current=e),!e)return;let t=e.getBoundingClientRect();M(n=>n&&n.left===t.left&&n.top===t.top&&n.width===t.width&&n.height===t.height?n:{left:t.left,top:t.top,width:t.width,height:t.height})});let{selection:ce,set:pe,clear:Y}=He(),c=o?.about??ce,[ge,Wt]=(0,a.useState)(()=>Pe()),he=o?.on??c[c.length-1],me=o?.about,Ft=(0,a.useMemo)(()=>({pins:ge,...he===void 0?{}:{focus:he},...me?{about:me}:{}}),[ge,he,me]),Kt=(0,a.useMemo)(()=>new Set(r.allMutations().filter(e=>e.pinned).map(e=>e.name)),[r]),{affordances:k,withheld:Ne,observations:Oe}=Rt(Ft),B=ct(Ne,b),$=B?un:Ne,_t=o===null?null:{face:o.face??"scene",on:o.on,about:c,field:o.field,place:o.place,href:o.href,act:o.act,column:o.column,...o.section?{section:o.section}:{},element:o.returnTo},j=Tt(_t),We=Oe.some(e=>e.id.startsWith("schema:waits:")),{apply:qt,preview:Bt}=Ht(),[U,N]=(0,a.useState)(null),[fe,jt]=(0,a.useState)(null),[Ut,Fe]=(0,a.useState)(!1),[Ke,_e]=(0,a.useState)(!1),[V,J]=(0,a.useState)(""),Gt=Mt({letters:o===null}),[R,X]=(0,a.useState)(""),qe=(0,a.useRef)(null);(0,a.useEffect)(()=>X(""),[o]);let Z=wt(S),ee=Dt(Z?h:void 0,r,y,o===null?"":R,o?.on,o),Qt=(0,a.useMemo)(()=>o===null?[]:[...j.start.flatMap(e=>(e.items??[]).map(t=>({key:`item:${t.id}`,label:t.label}))),...k.map(e=>({key:`act:${e.id}`,label:e.label})),...j.end.flatMap(e=>(e.items??[]).map(t=>({key:`item:${t.id}`,label:t.label}))),...ee.map(e=>({key:e.key,label:e.label}))],[o,j,k,ee]),Be=It(h,o===null?"":R,Qt),[te,je]=(0,a.useState)(!1),ye=(0,a.useRef)({words:"",rank:null});te||(ye.current={words:R.trim(),rank:Be});let C=te?ye.current.words===R.trim()?ye.current.rank:null:Be,[Ue,we]=(0,a.useState)(null),be=(0,a.useRef)([]),ne=(e,t)=>{try{return Bt(e,t),qt(e,t),we(null),s(null),be.current=[],!0}catch(n){return we(kt(r.schema,r.allMutations(),n)),be.current=n instanceof dt?n.issues.map(u=>String(u.path[0]??"")).filter(Boolean):[],!1}},ie=[...new Set(c.flatMap(e=>{let t=r.graph.getNode(e);return t?[t.kind]:[]}))],z=ie.length>0?ie:[...new Set(c.flatMap(e=>ht(e)))],m=c.length===1?gt(c[0]):null,ve=m?{from:r.graph.getNode(m.from),to:r.graph.getNode(m.to)}:null,Ge=m?xt(r,m):void 0,Qe=Ge?.provisional?Ge:void 0,Ye=m?(()=>{let e=r.schema.tryDefinition(r.graph.getNode(m.from)?.kind??"")?.edges?.[m.kind],t=r.graph.getNode(m.to);return e?.inverse&&t?`From ${P(r,t.id)}: ${e.inverse}`:null})():null;(0,a.useEffect)(()=>{N(null),Fe(!1),_e(!1),we(null),J("")},[c,o?.about]);let Ve=(0,a.useRef)(null);(0,a.useEffect)(()=>{let e=o?.begin;if(!e||Ve.current===o)return;let t=k.find(u=>u.mutation===e.act);if(!t)return;Ve.current=o;let n={...e.given};jt({id:t.id,given:n}),t.open.every(u=>u.name in n)?ne({...t,args:{...t.args,...n},open:[]}):N(t.id)},[o,k]);let d=o!==null,Yt=l==="menu"&&!d,O=(0,a.useRef)(o);O.current=o;let Je=yt("acts",{open:d&&l==="menu",onOpenChange:e=>{e||s(null)},at:()=>O.current?{x:O.current.x,y:O.current.y}:null,returnTo:()=>{let e=O.current?.returnTo;if(e?.isConnected)return e;let t=O.current?.on;return t?document.querySelector(`[data-graview-view="${CSS.escape(t)}"]`):null},align:"start"}),Xe=(T?.width??Number.POSITIVE_INFINITY)<Ot;if((0,a.useLayoutEffect)(()=>{let e=p.current?.offsetParent;if(!e||!Xe||d)return;let t=p.current?.getBoundingClientRect().height??0,n=`${Math.round(t)+20}px`;if(e.style.paddingBottom===n)return;let u=e.style.paddingBottom;return e.style.paddingBottom=n,()=>{e.style.paddingBottom=u}}),c.length===0&&!d)return null;let Ze=o?.title!==void 0||c.length>0&&!(c.length===1&&c[0]===f.focusId),et=Math.max(1,Math.min(9,k.length)),W=[...k.filter(e=>e.provider==="invariant"&&!e.destructive),...k.filter(e=>e.pinned&&e.provider!=="invariant"&&!e.destructive),...k.filter(e=>!e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...k.filter(e=>e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...k.filter(e=>e.destructive)],tt=W.length>et&&!d,nt=V.trim().toLowerCase(),I=tt&&nt.length>0?W.filter(e=>`${e.label} ${e.why}`.toLowerCase().includes(nt)):null,E=d?R.trim():"",ke=(e,t)=>E===""||Ct(t,E)||(C?.get(e)??0)>=ze,D=(I??(Ut||d?W:W.slice(0,et))).filter(e=>ke(`act:${e.id}`,e.label)),it=I||E?0:W.length-D.length,oe=E?$.filter(e=>ke(`act:${e.id}`,e.label)):$,ot=e=>E===""?e:e.flatMap(t=>{let n=(t.items??[]).filter(u=>ke(`item:${u.id}`,u.label));return n.length>0?[{id:t.id,...t.heading?{heading:t.heading}:{},items:n}]:[]}),Se=ot(j.start),xe=ot(j.end),Vt=o?.title??(c.length===1?P(r,c[0]):c.length>1?`${c.length} selected`:"this"),Te=d&&E!==""&&Z,Me=d&&E!==""?(C===null?ee:[...ee].sort((e,t)=>(C.get(t.key)??0)-(C.get(e.key)??0))).slice(0,zt):[],Jt=[...Se.flatMap(e=>(e.items??[]).map(t=>`item:${t.id}`)),...D.filter(e=>!e.destructive).map(e=>`act:${e.id}`),...xe.flatMap(e=>(e.items??[]).map(t=>`item:${t.id}`)),...Me.map(e=>e.key)],Xt=C===null?void 0:[...Jt].sort((e,t)=>(C.get(t)??0)-(C.get(e)??0)).find(e=>(C.get(e)??0)>=ze),A=E===""?null:Xt??Se.flatMap(e=>(e.items??[]).map(t=>`item:${t.id}`))[0]??D.filter(e=>!e.destructive).map(e=>`act:${e.id}`)[0]??xe.flatMap(e=>(e.items??[]).map(t=>`item:${t.id}`))[0]??(Te?"ask":null),Zt=()=>{if(!o)return;let e=E,t=o.returnTo??null,n=Le(p.current);s(null),Ce(S,{pointed:{on:o.on,about:c,field:o.field,place:o.place},asked:e,returnTo:t,...n?{from:n}:{}})},en=e=>{if(!o)return;let t=o.returnTo??null,n=Le(p.current);s(null),Ce(S,{pointed:{on:o.on,about:c,field:o.field,place:o.place},asked:e.label,suggested:e.telling.id,returnTo:t,...n?{from:n}:{}})},rt=()=>[...p.current?.querySelectorAll("[data-affordance]:not([disabled]), [data-menu-item]")??[]].filter(e=>e.closest("[data-graview-asking], [hidden]")===null),lt=()=>p.current?.querySelector("[data-menu-lit]")??null,tn=e=>{let t=e.target,n=qe.current;if(!n||t===n||e.metaKey||e.ctrlKey||e.altKey||t.closest("[data-graview-asking]")||dn(t))return;let u=e.key.length===1&&e.key!==" ";if(u||e.key==="Backspace"&&R!==""){e.preventDefault(),e.stopPropagation(),u&&R===""&&S&&$e(S),X(H=>u?H+e.key:H.slice(0,-1)),n.focus({preventScroll:!0});return}e.key==="ArrowUp"&&rt()[0]===t&&(e.preventDefault(),e.stopPropagation(),n.focus({preventScroll:!0}))},re=[];for(let e of D){let t=!d&&e.provider==="invariant",n=!d&&!t&&e.pinned!==void 0&&!e.destructive,u=!d&&!t&&!n&&e.ties===!0&&!e.destructive,H=t?e.why:n?"pinned":u?"its ties":null,le=t?"violation":n||u?"ties":null,_=re[re.length-1];_&&_.heading===H?_.items.push(e):re.push({heading:H,tone:le,items:[e]})}let F=k.find(e=>e.id===U),Ee=F&&fe?.id===F.id?{...F,args:{...F.args,...fe.given},open:F.open.filter(e=>!(e.name in fe.given))}:F,G=c.length===1?P(r,c[0]):null,at=e=>{if(!G)return e;let t=e.startsWith(`"${G}"`)?e.slice(G.length+2):e.startsWith(G)?e.slice(G.length):null;if(t===null)return e;let n=t.trimStart();return n.length===0?e:n[0].toUpperCase()+n.slice(1)},nn=new Set(d?[]:D.filter(e=>e.provider==="invariant").map(e=>e.why)),K=Oe.filter(e=>!nn.has(e.text)).map(e=>({...e,text:at(e.text)}));return Yt?null:(0,i.jsxs)("section",{...d?Je.pane:{},ref:e=>{p.current=e,d&&Je.pane.ref(e)},"aria-label":"Inspector","data-graview-offstage":"","data-testid":d?"context-menu":"inspector-strip",tabIndex:-1,onFocus:e=>g(e.target),onBlur:e=>{e.relatedTarget!==null&&(w.current=null)},onMouseDown:e=>e.stopPropagation(),onKeyDownCapture:d?e=>tn(e):void 0,onPointerMove:d?e=>{let t=e.target.closest?.("[data-menu-item], [data-affordance]")!=null;t!==te&&je(t)}:void 0,onPointerLeave:d&&te?()=>je(!1):void 0,style:{...d?ft:{position:"absolute",zIndex:pt("rail")},boxSizing:"border-box",display:"flex",flexDirection:"column",gap:7,padding:"9px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",...d?{width:300,maxHeight:"min(52cqh, 420px)",overflow:"auto"}:Xe?{left:10,right:10,width:"auto",bottom:10,maxHeight:"min(42cqh, 300px)",overflow:"auto"}:{left:14,top:f.overview?"min(296px, 38cqh)":44,width:236,maxHeight:f.overview?"calc(100cqh - min(296px, 38cqh) - 20px)":"calc(68cqh - 94px)",overflow:"auto"}},children:[(0,i.jsx)("h2",{style:{...bt,margin:0},children:"Inspector"}),(0,i.jsxs)("div",{style:{display:Ze||!d?"flex":"none",alignItems:"baseline",flexWrap:"wrap",gap:"2px 8px",minWidth:0,paddingRight:d?0:24},children:[Ze?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("strong",{style:{fontSize:"0.9375rem",whiteSpace:"nowrap"},children:o?.title??(c.length===1?P(r,c[0]):`${c.length} selected`)}),ie.length>0||m?(0,i.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:m?"relation":ie.map(e=>ae(r.schema.tryDefinition(e),e)).join(" \xB7 ")}):null,c.length===1&&!m&&o?.face!=="pages"?(0,i.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:f.expanded.includes(c[0])?"\xB7 double-click closes":"\xB7 double-click opens"}):null]}):null,(0,i.jsx)("span",{style:{flex:"1 1 auto"}})]}),d?null:(0,i.jsx)("button",{type:"button",onClick:()=>{s(null),Y()},"aria-label":"Clear selection",title:"Clear selection",style:{position:"absolute",top:6,right:6,flex:"0 0 auto",width:24,height:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.875rem",lineHeight:1,borderRadius:7},children:"\xD7"}),m&&ve?(0,i.jsxs)("div",{style:{display:"grid",gap:6},children:[Ye?(0,i.jsx)("p",{"data-testid":"edge-said",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:Ye}):null,Qe?(0,i.jsx)("p",{"data-testid":"edge-provisional",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:St(Qe)}):null,(0,i.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[["from",ve.from],["to",ve.to]].map(([e,t],n)=>(0,i.jsxs)(a.Fragment,{children:[n===1?(0,i.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-ink-faint)"},children:"\u2192"}):null,t?(0,i.jsx)("button",{type:"button","data-testid":`edge-${e}`,onClick:()=>pe([t.id]),title:`Select ${P(r,t.id)}`,style:{fontSize:"0.8125rem",padding:"3px 9px",borderRadius:6},children:P(r,t.id)}):(0,i.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"gone"})]},e))})]}):null,!m&&c.length===1&&ut(r,c[0])?(0,i.jsx)("p",{"data-testid":"left-alone",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:"Left alone: nothing automated changes it."}):null,K.length>0?(0,i.jsx)("div",{"data-testid":"observations",title:K.map(e=>e.text).join(`
|
|
2
|
+
`),style:{display:"grid",gap:3},children:K.slice(0,2).map(e=>(0,i.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[e.text,e===K[1]&&K.length>2?(0,i.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" +",K.length-2]}):null]},e.id))}):null,d?(0,i.jsx)("input",{ref:qe,type:"text","data-testid":"menu-type","data-graview-not-first":"",value:R,onChange:e=>{R===""&&e.target.value!==""&&S&&$e(S),X(e.target.value)},onKeyDown:e=>{if(e.key==="Enter"){e.preventDefault();let t=lt();t?.focus({preventScroll:!0}),t?.click()}else e.key==="ArrowDown"?(e.preventDefault(),(lt()??rt()[0])?.focus()):e.key==="Escape"&&R!==""&&(e.preventDefault(),e.stopPropagation(),X(""))},placeholder:Z?"Type to filter, or tell Graview\u2026":"Type to filter\u2026","aria-label":Z?`Filter what can be done here, or tell Graview what to do about ${Vt}`:"Filter what can be done here",autoComplete:"off",autoCorrect:"off",spellCheck:!1,enterKeyHint:"go",style:{boxSizing:"border-box",width:"100%",font:"inherit",fontSize:"max(1rem, 16px)",padding:"5px 9px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):null,d?Se.map(e=>(0,i.jsx)(Nt,{section:e,lit:A,close:()=>s(null)},e.id)):null,Ue?(0,i.jsx)("p",{"data-testid":"refused",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-warn)"},children:Ue}):null,tt?(0,i.jsx)("input",{"data-testid":"action-filter",value:V,onChange:e=>J(e.target.value),placeholder:`Filter ${W.length} actions\u2026`,"aria-label":"Filter actions",onKeyDown:e=>{if(e.key==="Escape"){e.stopPropagation(),V.length>0?J(""):e.currentTarget.blur();return}if(e.key==="Enter"&&I?.length===1){let t=I[0];if(t.destructive)return;t.open.length>0?N(t.id):ne(t)&&J("")}},style:{font:"inherit",fontSize:"0.875rem",padding:"5px 9px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):null,I!==null&&I.length===0?(0,i.jsxs)("p",{"data-testid":"no-matches",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:["Nothing offered here matches \u201C",V.trim(),"\u201D."]}):null,E!==""&&D.length===0||B&&k.length===0||k.length===0&&!We&&c.length===0?null:k.length===0&&!We?(0,i.jsx)("p",{"data-testid":"no-affordances",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:$.length>0?`Nothing you may do with ${m?"this relation":z.length===1?Ae(ae(r.schema.tryDefinition(z[0]),z[0])):"this mix of kinds"} \u2014 ${$.length} action${$.length===1?"":"s"} withheld.`:m?`Nothing can be done with this line yet \u2014 nothing this app declares makes or breaks \u201C${vt(r.schema,r.graph.getNode(m.from)?.kind??"",m.kind,"out")}\u201D.`:`Nothing can be done with ${z.length===1?Ae(ae(r.schema.tryDefinition(z[0]),z[0])):"this mix of kinds"} yet \u2014 nothing this app declares acts on ${z.length===1?"it":"them"}.`}):(0,i.jsxs)("ol",{...Gt,"data-testid":"affordances",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[re.map((e,t)=>(0,i.jsxs)(a.Fragment,{children:[e.heading?(0,i.jsxs)("li",{"data-graview-heading":e.tone,style:{fontSize:"0.75rem",lineHeight:1.4,color:e.tone==="violation"?"var(--graview-warn)":"var(--graview-ink-faint)",...e.tone!=="violation"?{letterSpacing:"0.12em",textTransform:"uppercase",fontSize:"0.75rem"}:{},padding:"2px 2px 1px",marginTop:t>0?6:0},children:[e.tone==="violation"?"\u26A0 ":"",e.tone==="violation"?at(e.heading):e.heading]}):t>0?(0,i.jsx)("li",{"aria-hidden":"true",style:{borderTop:"1px solid var(--graview-edge)",margin:"6px 0 3px"}}):null,e.items.map(n=>(0,i.jsxs)("li",{style:{display:"flex",gap:2,alignItems:"stretch"},onKeyDown:u=>{if(u.metaKey||u.ctrlKey||u.altKey)return;let H=u.currentTarget.querySelector("[data-affordance]"),le=u.currentTarget.querySelector("[data-pin-for]"),_=u.target===le,st=u.key==="ArrowRight"&&!_?le:_&&["ArrowLeft","ArrowUp","ArrowDown"].includes(u.key)?H:null;st&&(u.preventDefault(),u.stopPropagation(),st.focus())},children:[(0,i.jsxs)("button",{type:"button",[Ie]:"","data-affordance":n.id,"data-rank":n.rank,"data-graview-destructive":n.destructive||void 0,"data-menu-lit":A===`act:${n.id}`||void 0,"aria-pressed":U===n.id,title:n.why,style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:U===n.id?"var(--graview-accent)":d?"transparent":"var(--graview-edge)",background:d?"none":"var(--graview-panel)",boxShadow:"none",...n.destructive?{color:"var(--graview-warn)"}:{},...U===n.id?{color:"var(--graview-accent)"}:{},...A===`act:${n.id}`?de:{}},onClick:()=>{if(n.open.length>0){N(U===n.id?null:n.id);return}ne(n)},children:[n.label,n.open.length>0?(0,i.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:" \u2026"}):null,A===`act:${n.id}`?ue:null,I?.length===1&&I[0]?.id===n.id&&!n.destructive?(0,i.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}):null]}),(0,i.jsx)("button",{type:"button","data-testid":"pin-toggle",tabIndex:-1,"data-pin-for":n.mutation,"aria-pressed":n.pinned!==void 0,"aria-label":n.pinned!==void 0?`Unpin ${n.label}`:`Pin ${n.label}`,title:n.pinned==="declared"?"Pinned by the app \u2014 unpin it for yourself":n.pinned==="user"?"Unpin":"Pin to the top",onClick:()=>Wt(Lt(ge,n.mutation,Kt.has(n.mutation))),style:{flex:"0 0 auto",width:24,minHeight:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.75rem",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7,color:n.pinned==="user"?"var(--graview-accent)":n.pinned==="declared"?"var(--graview-ink-muted)":"var(--graview-ink-faint)"},children:n.pinned!==void 0?"\u2605":"\u2606"})]},n.id))]},`${e.heading??"plain"}-${t}`)),it>0?(0,i.jsx)("li",{children:(0,i.jsxs)("button",{type:"button",[Ie]:"",onClick:()=>Fe(!0),title:`Show all ${k.length} actions`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",it," more"]})}):null]}),B?(0,i.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>{s(null),B.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left"},children:B.label}):null,oe.length>0?(0,i.jsxs)("ul",{"data-testid":"withheld",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[oe.slice(0,d||Ke?oe.length:3).map(e=>(0,i.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,i.jsx)("button",{type:"button",disabled:!0,"data-affordance":e.id,"data-rank":e.rank,"data-withheld":e.refusal.wouldNeed.join(",")||"nobody",style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8,borderStyle:"dashed",width:"100%",textAlign:"left",background:"none"},children:(0,i.jsx)("s",{children:e.label})}),(0,i.jsx)("span",{"data-testid":"withheld-why",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-ink-muted)",padding:"0 10px"},children:e.refusal.message})]},e.id)),!d&&!Ke&&$.length>3?(0,i.jsx)("li",{children:(0,i.jsxs)("button",{type:"button","data-testid":"withheld-more",onClick:()=>_e(!0),title:`Show all ${$.length} actions this seat may not take`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",$.length-3," more withheld"]})}):null]}):null,d?xe.map(e=>(0,i.jsx)(Nt,{section:e,lit:A,close:()=>s(null)},e.id)):null,Me.length>0?(0,i.jsx)("div",{"data-menu-section":"told",role:"group","aria-label":"Suggested",style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5},children:Me.map(e=>(0,i.jsxs)("button",{type:"button","data-menu-item":e.key,"data-told-suggestion":e.telling.id,"data-menu-lit":A===e.key||void 0,onClick:()=>en(e),style:{...De,...A===e.key?de:{}},children:[e.label,A===e.key?ue:null]},e.key))}):null,Te?(0,i.jsx)("div",{"data-menu-section":"ask",style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5},children:(0,i.jsxs)("button",{type:"button","data-menu-item":"ask-typed","data-menu-lit":A==="ask"||void 0,onClick:Zt,style:{...De,...A==="ask"?de:{}},children:["Tell Graview ",(0,i.jsxs)("span",{style:{fontWeight:600},children:["\u201C",E,"\u201D"]}),A==="ask"?ue:null]})}):null,d&&E!==""&&!Te&&A===null&&D.length===0&&oe.length===0?(0,i.jsxs)("p",{"data-testid":"menu-no-match",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:["Nothing here matches \u201C",E,"\u201D."]}):null,Ee?(0,i.jsx)(Et,{affordance:Ee,onApply:e=>{if(ne(Ee,e))N(null);else return be.current},onCancel:()=>N(null)}):null]})}function dn(l){return l.isContentEditable||l instanceof HTMLTextAreaElement||l instanceof HTMLSelectElement?!0:l instanceof HTMLInputElement&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(l.type)}var De={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},de={background:"var(--graview-panel-muted)"},ue=(0,i.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}),un=[];function Nt({section:l,lit:r=null,close:o}){return(0,i.jsxs)("div",{"data-menu-section":l.id,...l.heading?{role:"group","aria-label":l.heading}:{},style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5},children:[l.heading?(0,i.jsx)("p",{"aria-hidden":"true",style:{margin:0,padding:"2px 2px 1px",fontSize:"0.75rem",lineHeight:1.4,letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:l.heading}):null,l.items&&l.items.length>0?(0,i.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:l.items.map(s=>(0,i.jsx)("li",{children:(0,i.jsxs)("button",{type:"button","data-menu-item":s.id,"data-menu-lit":r===`item:${s.id}`||void 0,onClick:()=>{o(),s.run()},style:{...De,...r===`item:${s.id}`?de:{}},children:[s.label,s.hint?(0,i.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",s.hint]}):null,r===`item:${s.id}`?ue:null]})},s.id))}):null,l.render?.(o)]})}export{Hn as InspectorPane,Rn as prepareActs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ec as w,rc as S}from"./chunk.
|
|
1
|
+
import{ec as w,rc as S}from"./chunk.J24YPQ5I.js";function v(s){return[...s.mutations??[],...S(s.schema,s.mutations??[])]}function B(s){let i=[...s.schema.kinds],a=v(s),d=new Map,c=new Map;for(let e of a){c.set(e.name,e.creates??[]);let n=w(e.input).filter(t=>!t.optional&&!t.kinds.includes("*")).flatMap(t=>t.kinds);d.set(e.name,[...new Set(n)])}let g=new Map;for(let e of i)g.set(e,[]);for(let e of a)for(let n of c.get(e.name)??[])g.get(n)?.push(e.name);let p=new Map,l=new Set;for(let e=0;;e+=1){let n=[];for(let t of a)if((d.get(t.name)??[]).every(o=>l.has(o)))for(let o of c.get(t.name)??[])l.has(o)||n.push(o);if(n.length===0)break;for(let t of n)l.add(t),p.set(t,e)}let h=e=>{let n=g.get(e)??[];if(n.length===0)return[];let t=n.map(r=>d.get(r)??[]).sort((r,o)=>r.length-o.length)[0];return[...new Set(t)].filter(r=>r!==e)},y=new Map,u=e=>{let n=y.get(e);if(n)return n;let t=new Set;y.set(e,t);for(let r of h(e)){t.add(r);for(let o of u(r))t.add(o)}return t.delete(e),t},f=new Map(i.map(e=>[e,0]));for(let e of i)for(let n of u(e))f.set(n,(f.get(n)??0)+1);let m=i.map(e=>({kind:e,madeBy:[...g.get(e)??[]].sort(),needs:[...h(e)].sort(),depth:p.get(e)??null})).sort((e,n)=>(e.depth??Number.MAX_SAFE_INTEGER)-(n.depth??Number.MAX_SAFE_INTEGER)||(f.get(n.kind)??0)-(f.get(e.kind)??0)||e.kind.localeCompare(n.kind)),k=m.filter(e=>e.depth===0).map(e=>e.kind),A=[...new Set(a.filter(e=>(d.get(e.name)??[]).length===0).filter(e=>(c.get(e.name)??[]).length>0).map(e=>e.name))].sort(),M=m.filter(e=>e.depth===null).map(e=>({kind:e.kind,why:e.madeBy.length===0?"no act declares that it creates this kind":`every act that makes it needs ${e.needs.map(n=>`"${n}"`).join(", ")}, which nothing can make first`}));return{order:m,roots:k,doors:A,unreachable:M}}export{B as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Rd as w,Sd as v,Ud as $,Vd as c,Xd as k,Yd as x,ee as f,ie as b,je as S,ke as P,le as A,oe as L,pa as u,pe as N}from"./chunk.J24YPQ5I.js";function T(s){if(!(s.attach==="home"||s.cardinality==="one"||!s.title))return{kind:s.attach,title:s.title,as:$(s.title),name:s.name,lens:"view",...s.hidden?{hidden:!0}:{}}}function G(s,r=[]){let a=[];for(let n of f(s).drawn)for(let i of n.kinds)a.push({kind:i,title:n.title,as:n.as,...n.across?{across:n.across}:{},...n.kinds.length>1?{over:n.kinds}:{},...n.hidden?{hidden:!0}:{}});for(let n of[...s.views?.places?.()??[],...r.flatMap(i=>T(i)??[])])a.some(i=>i.kind===n.kind&&i.as===n.as)||a.push(n);return a}function J(s,r={}){return V(s.schema,G(s,r.views),{...s.pages?{pages:s.pages}:{},lenses:f(s).drawn,home:(s.home?.length??0)>0})}function V(s,r,a={}){let{pages:n}=a,i=s.kinds,d=r.filter(e=>i.includes(e.kind)),o=N(n?.first,s,d),O=new Set(n?.hide??[]),p=L(i,n?.order,d),m=p.flatMap(e=>e.view?[]:[e.kind]),E=p.flatMap(e=>e.view?[e.view]:[]),h=[{slug:b,title:"Home",kind:null,cardinality:"many",address:"/",stop:"#",...o?.to==="home"||o===void 0&&a.home?{first:!0}:{}},{slug:S,title:A(n),kind:null,cardinality:"many",address:P,stop:"#"}],H=v([...d].sort((e,t)=>m.indexOf(e.kind)-m.indexOf(t.kind))),g=e=>{let t=a.lenses?.find(l=>l.as===e.as&&l.kinds.includes(e.kind)),y=x(e,d);return{slug:e.as,title:e.title,kind:e.kind,...e.over?{over:e.over.filter(l=>i.includes(l))}:{},cardinality:"many",address:k(e.as,y?c(s,e.kind).slice(1):void 0),stop:y?`#focus=aggregate:${e.kind}&in.view=${encodeURIComponent(e.as)}`:`#view=${encodeURIComponent(e.as)}`,...t?{lens:t.lens}:{},...e.name!==void 0?{view:e.name}:{},...e.hidden?{hidden:!0}:{},...o?.to==="place"&&o.place.as===e.as&&(o.place.kind===e.kind||e.over?.includes(o.place.kind))?{first:!0}:{}}};for(let e of H)E.some(t=>w(t,e))||h.push(g(e));for(let e of p){if(e.view){h.push(g(e.view));continue}let t=e.kind;h.push({slug:c(s,t).slice(1),title:u(s,t),kind:t,cardinality:"many",address:c(s,t),stop:`#focus=aggregate:${t}`,...O.has(t)?{hidden:!0}:{},...o?.to==="kind"&&o.kind===t?{first:!0}:{}})}return h}export{J as a,V as b};
|
|
@@ -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{c as ae,d as se,f as oe,i as re,j as le,k as de,m as ce,n as ue,o as pe,p as ge,q as fe}from"./chunk.FEGSYSA7.js";import{b as Z,c as ee,d as te,e as ne}from"./chunk.KROR65KD.js";import{a as ie}from"./chunk.J6KNEI5R.js";import{a as Y}from"./chunk.HJS3LTSR.js";import{a as X,e as O}from"./chunk.MD36ZSM5.js";import{E as K,G as Ie,J as Q,R as V,V as _,da as j}from"./chunk.3CJLAJXP.js";import{sd as J}from"./chunk.J24YPQ5I.js";import{b as N}from"./chunk.AJZBJBMO.js";var c=N(Ie(),1);var o=N(_(),1);function he(e,a,t){let i=a.on==="selection"?a.ids:a.on==="record"||a.on==="field"?[a.id]:[],l=i.length>0?ie(e.store,i,{principal:e.principal,...i.length===1?{focus:i[0]}:{}}).affordances.map(s=>({mutation:s.mutation,label:s.label,args:s.args,open:s.open,why:s.why,...s.destructive?{destructive:!0}:{}})):void 0;return{store:e.store,target:a,principal:e.principal,interaction:se(),places:e.places,selection:e.selection,...l?{acts:l}:{},...e.place?{place:e.place}:{},...t?{said:t}:{},...e.app.purpose?{purpose:e.app.purpose}:{}}}async function be(e,a,t){let i=await (__graviewPreload(import.meta.url,["./chunk.CS72MISN.js","./chunk.G4JJXA63.js","./chunk.TBY5IR7C.js","./chunk.XSWR5LI4.js","./chunk.BIDL7GQD.js","./chunk.XTTESA7X.js","./chunk.MH46V556.js","./chunk.XOZU4OFA.js","./chunk.5M34BJIQ.js","./chunk.Q5WEOX3Q.js","./chunk.UHI3X2YD.js","./chunk.INTJD5WG.js","./chunk.2QQ37RCZ.js","./chunk.WVUJXDXZ.js","./chunk.S2DOVJRL.js","./chunk.64FCAUAJ.js","./chunk.DA4RSHLW.js","./chunk.FOSY7MZF.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.SPCAMQJE.js","./chunk.TUCSUZNO.js","./chunk.ZMWAZACO.js","./chunk.CD6YWH6T.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.VRYSZYAD.js")),l=i.recipeDraft(a.recipe,{app:e.app,sight:i.draftSight(e.app,e.principal)});if(i.isDraftFailure(l))return l.failed;t?.(),e.seatTalk.setDraft(l,null),e.goTo.draft?.(),ke()}function ke(e=180){if(typeof document>"u")return;let a=document.querySelector('[data-testid="draft-keep"]'),t=document.activeElement,i=!t||t===document.body||t.closest?.("[inert]")!==null;if(a){i&&a.focus();return}e>0&&requestAnimationFrame(()=>ke(e-1))}async function T(e,a,t,i,l){let s=he(e,t,i),d=a==="suggest"?await oe(e.ai,s):a==="fill"?await re(e.ai,s):a==="record"?await le(e.ai,s):await de(e.ai,s);if(d.interaction.outcome==="failed")return a!=="suggest"&&e.desk.record(d.interaction),d;let u=g=>{let p={...d.interaction,outcome:"failed",failed:g};return e.desk.record(p),{...d,interaction:p}};if(a==="fill"||a==="record"){if(!d.ghost||d.ghost.proposals.length===0)return u("Nothing here could be filled in.");l?.(),e.desk.setGhost({ghost:d.ghost}),e.desk.record(d.interaction)}if(a==="panel"&&d.panel){let g=await be(e,d.panel,l);if(g)return u(g);e.desk.record(d.interaction)}return d}var W=new WeakMap,Te=64,me=new WeakMap;function Ee(e){let a=me.get(e);if(!a){let t=a={n:0};me.set(e,t),e.subscribe(()=>void(t.n+=1))}return a.n}var Se=(e,a)=>{let t=ee(a);return t.length>0?t.map(i=>e.graph.getNode(i)):[Ee(e)]},we=(e,a,t)=>JSON.stringify({target:a,seat:e.principal,by:t}),Ae=(e,a,t)=>{let i=Se(e.store,a);return t.schema===e.store.schema&&t.ai===e.ai&&i.length===t.depends.length&&i.every((l,s)=>l===t.depends[s])};function Me(e,a,t="menu"){let i=W.get(e.store)?.get(we(e,a,t));return i?.result!==void 0&&Ae(e,a,i)?i.result:void 0}function Ce(e,a,t){let i=W.get(e.store);i||W.set(e.store,i=new Map);let l=we(e,a,t?.by??"menu"),s=i.get(l);if(s&&Ae(e,a,s))return s.result?Promise.resolve(s.result):s.asked;let d=t?t.ask():T(e,"suggest",a),u={schema:e.store.schema,ai:e.ai,depends:Se(e.store,a),asked:d};i.delete(l),i.set(l,u),i.size>Te&&i.delete(i.keys().next().value);let g=i;return d.then(p=>{p.interaction.outcome!=="failed"?u.result=p:g.get(l)===u&&g.delete(l)}),d}async function Oe(e,a,t,i,l={}){let s=a.interaction,d=ue(t);if(d){let u=s.usage?.at(-1)?.model,g=s.offered.find(h=>h.id===t.id)?.confidence,p=ce(e.store,{interaction:s.id,target:s.target,basis:`${s.ask.said}: ${t.label}`,...u?{model:u}:{},proposals:[{...d,...g!==void 0?{confidence:g}:{}}]},e.principal);if(p.proposals.length===0){let h="That can't be done now.";return e.desk.record({...s,outcome:"failed",failed:h}),h}l.onCard?e.desk.setGhost({ghost:p,onCard:!0}):(i?.(),e.desk.setGhost({ghost:p})),e.desk.record(s);return}if(t.type==="panel"){let u=t.label,g={title:u,recipe:{...t.panel,title:u}},p=await be(e,g,i);return e.desk.record(p?{...s,outcome:"failed",failed:p}:{...s,outcome:"drawn",accepted:[t.id],panel:g}),p}i?.(),t.type==="place"?e.goTo.place(t.place):t.type==="record"&&e.goTo.record(t.record),e.desk.record({...s,outcome:"accepted",accepted:[t.id]})}async function qe(e,a){if(a.ask.kind==="ask")return O(e.desk,{target:a.target,asked:a.ask.said}),null;let t=a.ask.kind==="panel"||a.ask.kind==="record"?a.ask.kind:"fill";return T(e,t,a.target,a.ask.said)}var k={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},ye=(0,o.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"aria-hidden":"true",style:{...k,visibility:"hidden"},children:"\xA0"}),P={margin:0,padding:"4px 10px",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function ze({target:e,close:a}){let t=Y(),i=(0,c.useMemo)(()=>Z(e,n=>t.store.graph.has(n)),[e,t.store]),l=(0,c.useMemo)(()=>{let n=he(t,i);return te(t.store,i,{principal:t.principal,places:t.places,...n.acts?{acts:n.acts}:{}})},[t,i]),s=l.candidates.some(n=>n.type==="fill"),d=l.candidates.some(n=>n.type==="panel"),u=(0,c.useMemo)(()=>d?ne(t.store,i,{principal:t.principal,places:t.places,most:1}):[],[d,t,i]),g=(0,c.useMemo)(()=>new Set(t.store.allMutations().filter(n=>(n.creates??[]).length>0).map(n=>n.name)),[t.store]),p=ae(t.ai)!==void 0&&l.candidates.some(n=>n.type==="act"&&n.asks.length>0&&g.has(n.mutation)),h=K(t.ai),S=Me(t,i),f=JSON.stringify(i),[m,I]=(0,c.useState)(!1),[A,R]=(0,c.useState)(null),[H,E]=(0,c.useState)(h&&S===void 0);(0,c.useEffect)(()=>{if(S!==void 0||!(h||m))return;let n=!0;return E(!0),Ce(t,i).then(y=>{n&&(R(y),E(!1))}),()=>{n=!1}},[f,m]);let r=S??A,w=(r?.offers??[]).filter(n=>!(n.type==="place"&&u.some(y=>y.place===n.place))).slice(0,Math.max(0,3-u.length)),b=r?.interaction.outcome==="failed"?r.interaction.failed??"The AI could not suggest anything here.":null,D=(0,c.useRef)(!1),F=(0,c.useRef)(null);(0,c.useLayoutEffect)(()=>{r===null||!D.current||(D.current=!1,F.current?.querySelector("button")?.focus())},[r]);let L=(0,c.useRef)(!0);(0,c.useEffect)(()=>()=>{L.current=!1},[]);let[U,G]=(0,c.useState)(!1),[B,$]=(0,c.useState)(null),M=n=>{if(U)return;G(!0),$(null);let y=!1;n(()=>{y=!0,a()}).then(x=>{L.current&&(G(!1),x?$(x):y||a())},x=>{L.current&&(G(!1),$(x instanceof Error?x.message:String(x)))})},q=n=>n.interaction.outcome==="failed"?n.interaction.failed??"The AI could not do that here.":void 0,C=H&&!m?(0,o.jsx)("p",{role:"status","data-testid":"inline-ai-thinking",style:P,children:"Thinking\u2026"}):U?(0,o.jsx)("p",{role:"status","data-testid":"inline-ai-asking",style:P,children:"Asking\u2026"}):B?(0,o.jsx)("p",{role:"alert","data-testid":"inline-ai-failed",style:{...P,color:"var(--graview-warn)"},children:B}):b?(0,o.jsx)("p",{role:"status",style:P,children:b}):null,z=(0,c.useRef)(0);z.current=Math.max(z.current,h&&S===void 0?Math.max(1,3-u.length):0,w.length+(C?1:0));let xe=Math.max(0,z.current-w.length-(C?1:0));return(0,o.jsxs)("div",{ref:F,"data-testid":"inline-ai",style:{display:"grid",gap:2},children:[(0,o.jsxs)("ul",{"data-testid":"inline-ai-room",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[C?(0,o.jsxs)("li",{style:{position:"relative"},children:[ye,(0,o.jsx)("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center"},children:C})]}):null,w.map(n=>(0,o.jsx)("li",{children:(0,o.jsxs)("button",{type:"button","data-menu-item":`ai-offer:${n.id}`,"data-ai-offer":n.id,"data-ai-offer-type":n.type,title:n.label,onClick:()=>M(y=>Oe(t,r,n,y)),style:{...k,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[n.label,(0,o.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",n.type==="panel"?"a panel":n.type==="place"?"go there":n.type==="record"?"open it":"suggested"]})]})},n.id)),Array.from({length:xe},(n,y)=>(0,o.jsx)("li",{"data-inline-ai-room":"",children:ye},`room-${y}`))]}),(0,o.jsxs)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[!h&&r===null?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-suggest","aria-disabled":m||void 0,onClick:n=>{m||(D.current=document.activeElement===n.currentTarget,I(!0))},style:k,children:m?"Thinking\u2026":"Suggest\u2026"})}):null,s?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-fill",onClick:()=>M(async n=>q(await T(t,"fill",i,"Fill in",n))),style:k,children:"Fill in with AI"})}):null,p?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-record",onClick:()=>M(async n=>q(await T(t,"record",i,"Add one",n))),style:k,children:"Add one with AI"})}):null,u.map(n=>(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":`ai-open:${n.place}`,"data-ai-existing":n.fit,onClick:()=>{a(),t.goTo.place(n.place),n.fit==="partial"&&O(t.desk,{target:{on:"lens",place:n.place,...n.kind?{kind:n.kind}:{}}})},style:k,children:n.fit==="full"?`Open ${n.title}`:`Open and adjust ${n.title}`})},n.place)),d?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-panel",onClick:()=>M(async n=>q(await T(t,"panel",i,"Draw a panel",n))),style:k,children:u.length>0?"Draw a new view":"Draw a panel"})}):null,(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-ask",onClick:()=>{let n=document.activeElement,y=X(n instanceof Element?n.closest('[data-testid="context-menu"]'):null);a(),O(t.desk,{target:i,returnTo:n instanceof HTMLElement&&n!==document.body?n:null,...y?{from:y}:{}})},style:k,children:"Tell Graview\u2026"})})]})]})}var v={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 10px",fontSize:"0.8125rem",borderRadius:8};function Ne({placement:e="picture"}){let{store:a,principal:t,aiDesk:i}=j(),l=V(a,t),{ghost:s,entries:d}=Q(i),[u,g]=(0,c.useState)(new Set);(0,c.useEffect)(()=>g(new Set),[s?.ghost.interaction]);let p=(0,c.useRef)(null),h=(0,c.useRef)(null),S=s?.batch;if((0,c.useEffect)(()=>{S!==void 0&&h.current?.focus()},[S]),!s)return null;let{ghost:f}=s,m=d.find(r=>r.id===f.interaction),I=()=>{let r=f.target.on==="record"||f.target.on==="field"?f.target.id:void 0,w=p.current?.closest("[data-graview-face], main")?.parentElement??document,b=(r?w.querySelector(`[data-graview-view="${CSS.escape(r)}"][tabindex]`):null)??document.querySelector("[data-graview-page-title]")??p.current?.closest("main")??document.querySelector("main");b&&!b.hasAttribute("tabindex")&&b.setAttribute("tabindex","-1"),b?.focus({preventScroll:!0}),i.setGhost(null)},A=f.proposals.filter(r=>!u.has(r.id)).map(r=>r.id),R=()=>{let r=pe(l,f,{author:t,ids:A});if(!r.ok){i.setGhost({...s,refused:r.refused});return}m&&i.record(ge(m,r.accepted,r.batch)),i.setGhost({ghost:f,batch:r.batch,took:r.accepted.length,...s.onCard?{onCard:!0}:{}})},H=()=>{m&&s.batch===void 0&&i.record(fe(m)),I()},E=()=>{if(s.batch!==void 0)try{l.undo(s.batch,{author:t}),m&&i.record({...m,undone:!0}),I()}catch(r){i.setGhost({...s,refused:r instanceof Error?r.message:String(r)})}};return(0,o.jsxs)("section",{ref:p,"data-testid":"ai-ghost","data-interaction":f.interaction,"aria-label":"Proposed by AI",style:{...e==="card"?{position:"static"}:{position:e==="page"?"fixed":"absolute",insetInline:"max(12px, calc(50% - 220px))",bottom:"calc(var(--graview-foot-room, 0px) + 72px)",zIndex:J("toast"),boxShadow:"var(--graview-lift-high)"},display:"grid",gap:8,padding:12,borderRadius:12,border:"1px dashed var(--graview-accent)",background:"var(--graview-float)",fontSize:"0.875rem"},children:[(0,o.jsx)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:s.batch!==void 0?`Done: ${s.took===1?"one change":`${s.took} changes`}, as one.`:`Proposed by AI \xB7 ${f.basis}`}),s.batch===void 0?(0,o.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:f.proposals.map(r=>(0,o.jsx)("li",{"data-ghost-proposal":r.id,children:(0,o.jsxs)("label",{style:{display:"flex",alignItems:"baseline",gap:8,cursor:"pointer"},children:[(0,o.jsx)("input",{type:"checkbox",checked:!u.has(r.id),onChange:w=>{let b=new Set(u);w.target.checked?b.delete(r.id):b.add(r.id),g(b)}}),(0,o.jsx)("span",{style:{fontStyle:"italic",color:"var(--graview-ink)"},children:r.said}),r.confidence!==void 0?(0,o.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[Math.round(r.confidence*100),"% sure"]}):null]})},r.id))}):null,s.refused?(0,o.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-warn)"},children:s.refused}):null,(0,o.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.batch===void 0?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{type:"button","data-testid":"ghost-accept",disabled:A.length===0,onClick:R,style:v,children:A.length===f.proposals.length?"Accept":`Accept ${A.length} of ${f.proposals.length}`}),(0,o.jsx)("button",{type:"button","data-testid":"ghost-dismiss",onClick:H,style:v,children:"Dismiss"})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{type:"button",ref:h,"data-testid":"ghost-undo",onClick:E,style:v,children:"Undo"}),(0,o.jsx)("button",{type:"button","data-testid":"ghost-close",onClick:I,style:v,children:"Close"})]})})]})}export{he as a,be as b,T as c,Me as d,Ce as e,Oe as f,qe as g,ze as h,Ne as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk.AJZBJBMO.js";var f=new Set(["section","article","nav","aside","header","footer","main","form","region","search"]),c=/^h([1-6])$/,l=e=>(e??"").replace(/\s+/g," ").trim(),s=e=>(e.getAttribute("data-graview-as")??e.localName).toLowerCase(),a=e=>{let o=c.exec(s(e));return o?Number(o[1]):e.getAttribute("role")==="heading"?Number(e.getAttribute("aria-level")??2):void 0};function d(e){let o=l(e.getAttribute("data-section"));if(o)return o;let r=l(e.getAttribute("aria-label"));if(r)return r;let t=e.getRootNode(),n=(e.getAttribute("aria-labelledby")??"").split(/\s+/).filter(Boolean).map(i=>l(t.getElementById?.(i)?.textContent??t.querySelector?.(`#${CSS.escape(i)}`)?.textContent)).filter(Boolean).join(" ");if(n)return n;for(let i of e.querySelectorAll("*"))if(a(i)!==void 0)return l(i.textContent);return""}var b=e=>e.hasAttribute("data-section")||f.has(s(e))||e.getAttribute("role")==="region";function g(e){let o=a(e)??6,r=[e];for(let t=e.nextElementSibling;t;t=t.nextElementSibling){let n=a(t);if(n!==void 0&&n<=o)break;r.push(t)}return r}function m(e){if(!e)return;let o=e.getRootNode();if(typeof ShadowRoot>"u"||!(o instanceof ShadowRoot))return;let r=o.host.getAttribute("data-worker-view");if(r){for(let t=e;t;t=t.parentElement){if(!b(t))continue;let n=d(t);if(n)return{name:n,view:r,elements:[t]}}for(let t=e;t;t=t.parentElement)for(let n=t;n;n=n.previousElementSibling){if(a(n)===void 0)continue;let i=g(n);if(!i.includes(t))break;let u=l(n.textContent);if(u)return{name:u,view:r,elements:i};break}}}export{m as sectionUnder};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as U,b as V,d as b,e as B,f as C,g as W}from"./chunk.
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as U,b as V,d as b,e as B,f as C,g as W}from"./chunk.35E75QJ7.js";import{a as p,b as T,c as S,e as _}from"./chunk.BBLIT7S7.js";import{b as z}from"./chunk.VUZFLDOX.js";import{a as J,b as h,e as A}from"./chunk.A4VA3DU5.js";import{a as R}from"./chunk.SDO3U72B.js";import"./chunk.J24YPQ5I.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var Q=R(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.K2HDEL7I.js")));function te(d,e){let f=d.ownerDocument,u=f.defaultView,t=f.createElement("iframe");t.setAttribute("sandbox",T),t.setAttribute("referrerpolicy","no-referrer"),t.setAttribute("allow",""),t.setAttribute("title",e.title??e.view),t.setAttribute("data-guest-view",e.view),t.setAttribute("aria-busy","true"),t.style.border="0",t.style.width="100%",t.style.display="block",t.src=e.url;let a={applied:0,refused:0,dropped:0},P=h(e.limits),i,y,o={applied:0,refused:0,dropped:0},v=()=>{if(!i)return;let r=i.stats;a.applied+=r.applied-o.applied,a.refused+=r.refused-o.refused,a.dropped+=r.dropped-o.dropped,o={...r}},O=W(u,()=>l(),"data"),g=()=>C(()=>e.theme?.()??b(d),e.brand,O),L="",l=()=>{i&&(L=JSON.stringify(g()),i.push())},k=B(f,()=>{i&&JSON.stringify(g())!==L&&l()}),n,w=!1,D=e.pictures?z(Q,({createGuestPictures:r})=>{n=r(u,{as:"data",view:`"${e.title??e.view}"`,pictures:e.pictures,...e.limits?{limits:e.limits}:{},...e.file?{file:e.file}:{},moved:()=>{i?.push(),G&&E()}}),w&&x()}):()=>{},G=!1,c,N=()=>{!G||n?.waiting()||(clearTimeout(c),t.removeAttribute("data-guest-view-failed"),t.removeAttribute("aria-busy"),t.setAttribute("data-guest-view-drawn",""))},E=()=>{clearTimeout(c),c=setTimeout(N,250)},F=setTimeout(()=>{i||(t.removeAttribute("aria-busy"),t.setAttribute("data-guest-view-failed","silent"))},e.limits?.readyMs??8e3),H=()=>{v(),i?.dispose(),y?.close(),i=void 0,y=void 0,o={applied:0,refused:0,dropped:0}},M=r=>{if(!(r.source===null||r.source!==t.contentWindow)){if(r.origin!==S||!P.message()){a.dropped+=1;return}if(!_(r.data)||r.data.protocol!==1){a.dropped+=1;return}if(e.pictures&&!n){w=!0;return}x()}},x=()=>{w=!1,H();let r=U(),m=new MessageChannel;y=m.port1;let I=A({store:e.store,principal:e.principal,view:e.view,nonce:r,send:s=>m.port1.postMessage(s),...e.input?{input:e.input}:{},...e.reads?{reads:e.reads}:{},...n?{hand:n.hand}:{},theme:g,...e.places?{places:()=>[...new Set(e.places().map(s=>s.as))],placesShown:e.places}:{},...e.onNavigatePlace?{onNavigatePlace:e.onNavigatePlace}:{},...e.onNavigate?{onNavigate:e.onNavigate}:{},...e.onArrive?{onArrive:e.onArrive}:e.goTo?{onArrive:s=>V(e.goTo(),s)}:{},...e.onLost?{onLost:e.onLost}:{},onSize:s=>{e.onSize?e.onSize(s):t.style.height=`${s}px`,N()},...e.limits?{limits:e.limits}:{},limiter:P});i=I,m.port1.onmessage=s=>{I.receive(s.data),v()};let j={graview:"host-hello",protocol:1,nonce:r,view:e.view};t.contentWindow.postMessage(j,"*",[m.port2]),l(),G=!0,E()};return u.addEventListener("message",M),d.appendChild(t),d.removeAttribute("aria-busy"),{iframe:t,update:l,get stats(){return v(),a},dispose(){H(),clearTimeout(F),clearTimeout(c),k(),O.dispose(),D(),n?.dispose(),u.removeEventListener("message",M),t.remove()}}}export{p as GUEST_PROTOCOL,T as GUEST_SANDBOX,S as OPAQUE_ORIGIN,A as createGuestHost,h as createGuestLimiter,te as mountGuestView,J as readAcross,b as readTheme};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as re,b as P,c as oe}from"./chunk.BUQKRXI6.js";import{A as J,C as Q,E as X,G as Y,K as ee,M as ne,P as te,i as W,j as q,l as z,r as j,u as Z,v as _,z as U}from"./chunk.MD36ZSM5.js";import{a as M}from"./chunk.L6FGKJ5H.js";import{G as ie,La as K,Sa as G,V as T,da as I,fa as D,ya as $}from"./chunk.3CJLAJXP.js";import{_c as V,cd as N}from"./chunk.J24YPQ5I.js";import{b as F}from"./chunk.AJZBJBMO.js";var o=F(ie(),1);var y=F(T(),1),ge=e=>typeof e=="object"?e:{};function be({rootRef:e,firstLook:t,app:n}){let r=(0,o.useCallback)(()=>e.current,[e]);return t?(0,y.jsx)(te,{firstLook:t,root:r,app:n}):null}function we(e,t,n){let{app:r}=e,a=(0,o.useMemo)(()=>{let s=ee(t(r.schema,r.viewSpecs),r),d=n?de(s,n):s,i=e.views?e.views(r.schema,d):s,c=i===d?s:$(s,i);return ne(c,r.schema,X(e.brand??r.brand,r.schema)),n?n.register(c):c},[e.views,r.schema,r.viewSpecs,r.lenses,r.pages,r.home,n]);return K(a,e.keptViews)}function de(e,t){let n={...e,register(r,a,s,d){return d?.name!==t.name&&e.register(r,a,s,d),n},...e.home?{home:(r,a)=>(t.home||e.home(r,a),n)}:{}};return n}var k=e=>e?e.getBoundingClientRect().height:0;function Se(e,t,n){let r=(0,o.useRef)(n);r.current=n;let a=n!==void 0;(0,o.useLayoutEffect)(()=>{let s=e.current;if(!s||!a)return;let d=()=>{let u=[...s.children],g=u.find(b=>b.hasAttribute("data-graview-app-bar")),p=u.find(b=>b.hasAttribute("data-embed-content")),h=p?.querySelector("[data-embed-measure]")??null,l=u.find(b=>b.hasAttribute("data-graview-place-line"));return{strip:g,line:l,content:p,measure:h}},i=-1,c=()=>{let{strip:u,line:g,content:p,measure:h}=d(),l=Math.ceil(k(u)+k(g)+k(h||p));l!==i&&(i=l,r.current?.(l))};if(c(),typeof ResizeObserver>"u")return;let m=new ResizeObserver(c),S=()=>{m.disconnect();let{strip:u,line:g,content:p,measure:h}=d();for(let l of[s,u,g,p,h])l&&m.observe(l)};S();let v=new MutationObserver(()=>{S(),c()});return v.observe(s,{childList:!0}),()=>{m.disconnect(),v.disconnect()}},[e,t,a])}var ve=480,ce=0;function Re(e){let{app:t,seed:n,scheme:r="auto",brand:a=t.brand,fonts:s=!0,height:d="100%",label:i}=e,c=(0,o.useRef)(null);G(c);let m=d==="viewport"?"100dvh":d,S=z(typeof m=="string"&&/vh\b/.test(m)),v=(0,o.useMemo)(()=>`graview-embed-${++ce}`,[]),u=(0,o.useMemo)(()=>e.store??e.remote?.store??P(t,n),[e.store,e.remote,t,n]),g=e.presence??e.remote?.presence,p=e.hostContext?.theme,h=oe(r==="auto"&&p===void 0,a?.scheme),l=r==="auto"?p??h:r,b=(0,o.useMemo)(()=>M(l,a,{scope:`.${v}`}),[l,a,v]);W(e.favicon?N(e.assetsAt,V(a)):void 0),q(e.favicon?a:void 0),(0,o.useEffect)(()=>{if(!s||typeof document>"u")return;let R=re(a);if(!R||document.querySelector(`link[href="${R}"]`))return;let f=document.createElement("link");f.rel="stylesheet",f.href=R,document.head.appendChild(f)},[a,s]);let x=(0,o.useRef)(void 0);(0,o.useLayoutEffect)(()=>{let R=c.current,f=x.current;if(x.current=i,!R||!i)return;let se=w=>{let E=w.getAttribute("aria-label")??"",A=f&&f!==i?E.startsWith(`${f} \xB7 `)?E.slice(f.length+3):E===f?"":E:E;A===i&&(w.getAttribute("role")==="region"||w.tagName==="SECTION"&&!w.hasAttribute("role"))&&w.setAttribute("role","group");let O=A.startsWith(`${i} \xB7 `)||A===i?A:A?`${i} \xB7 ${A}`:i;O!==E&&w.setAttribute("aria-label",O)},B=()=>R.querySelectorAll("aside, nav, main, header, footer, section[aria-label]:not([role]), [role=region], [role=complementary], [role=navigation], [role=search]").forEach(w=>{w.hasAttribute("data-graview-named-by-lens")||se(w)});B();let L=new MutationObserver(B);return L.observe(R,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-label"]}),()=>L.disconnect()},[i]);let C=S?`${m}`.replace(/([\d.]+)[sdl]?vh\b/g,(R,f)=>`${+f*S/100}px`):m;return{rootRef:c,scope:v,css:b,scheme:l,store:u,presence:g,brand:a,auto:d==="auto",height:C}}function Ee({rootRef:e,board:t,onReport:n,where:r}){let a=(0,o.useCallback)(()=>e.current?.querySelector("[data-embed-content]")??e.current,[e]),s=(0,o.useRef)(r);s.current=r;let d=(0,o.useMemo)(()=>n?{tell:n,where:()=>s.current()}:void 0,[n]);return(0,y.jsx)(j,{board:t,anchor:a,report:d})}function Ae(e){let t=e.split(/[?#]/)[0].split("/").filter(Boolean).map(n=>{try{return decodeURIComponent(n)}catch{return n}});return t.length===0?{place:"home"}:t[0]==="places"?{place:t[1]??"places"}:{place:t[0],...t[1]!==void 0?{record:t[1]}:{}}}function xe(e,t,n){return{brand:n,locale:e.locale,timeZone:e.timeZone,principal:e.principal,seats:e.seats,presence:t,typing:e.remote?.typing,people:e.people,memory:e.memory,presenceTtlMs:e.presenceTtlMs,onKeepLens:e.onKeepLens,onProposeChange:e.onProposeChange,composeChange:e.composeChange,ai:e.ai,files:e.files,assetsAt:e.assetsAt,resolveApp:e.resolveApp,history:e.history,linkedRecords:e.linkedRecords,subscriptions:e.subscriptions,dismissals:e.dismissals,whileAway:e.whileAway,workflowRuns:e.workflowRuns,keptViews:e.keptViews,onExport:e.onExport,signIn:e.signIn,menuSections:e.menuSections,app:e.app}}function ke({name:e,heading:t,faces:n,at:r,without:a,home:s,reach:d,standing:i,hostActions:c,barActions:m,keeping:S,onFind:v,switch:u,named:g=!0}){let{brand:p,store:h,principal:l,views:b}=I();D();let x=a?.has("places")?[]:Z({store:h,principal:l,views:b}),C=Q();return(0,y.jsx)(U,{brand:p,name:e,named:g,description:p?.subtitle,heading:t,faces:n,home:s,places:x,current:r===null?null:_(x,r),reach:d,onFind:v,...u?{switch:u}:{},...n||r===null?{scenePlaces:C}:{},...m?{actions:m}:{},tools:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Y,{clean:i}),(0,y.jsx)(J,{...c?{hostActions:c}:{},...S?{keeping:S}:{}})]})})}var Ce=e=>e===!1?2:Math.min(e+1,6);function Fe(e){let[t,n]=(0,o.useState)(e),r=(0,o.useRef)(void 0),a=(0,o.useRef)(void 0),s=(0,o.useMemo)(()=>({go:r,at:n,pending:a}),[]),d=(0,o.useCallback)(i=>{if(r.current){r.current(i);return}a.current=i,n(i)},[]);return{at:t,setAt:n,steering:s,steer:d}}function le(e){let t=typeof e=="object"&&e!==null?e.name:void 0;return{name:typeof t=="string"&&t.length>0?t:typeof e=="object"?"Error":typeof e}}var H=()=>typeof performance<"u"?performance.now():Date.now();function Pe(e,t){let n=(0,o.useRef)({onError:e,face:t});return n.current={onError:e,face:t},(0,o.useCallback)((r,a)=>n.current.onError?.(le(r),{module:a.module,face:n.current.face}),[])}function He(e,t){let n=(0,o.useRef)(null);n.current===null&&(n.current=H());let r=(0,o.useRef)({onReady:e,face:t});r.current={onReady:e,face:t};let a=(0,o.useRef)(!1);return(0,o.useCallback)(s=>{a.current||(a.current=!0,r.current.onReady?.({ms:Math.max(0,H()-(n.current??H())),face:s}))},[])}var ae=class extends o.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(t,n){console.error(`[graview] ${this.props.module} threw while rendering`,t,n.componentStack),this.props.report(t,{module:this.props.module})}render(){return this.state.failed?(0,y.jsxs)("div",{role:"alert","data-graview-face-error":this.props.module,...this.props.content?{"data-embed-content":""}:{},style:this.props.content?{flex:"1 1 auto",display:"grid",alignContent:"center",justifyItems:"center",gap:8,padding:24,background:"var(--graview-ground)",color:"var(--graview-ink)",fontSize:"0.9375rem"}:{display:"inline-flex",alignItems:"center",gap:6,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:[(0,y.jsx)("span",{children:this.props.content?"This part of the app could not draw.":"Could not draw."}),(0,y.jsx)("button",{type:"button",onClick:()=>this.setState({failed:!1}),style:{padding:"3px 11px",fontSize:"0.8125rem"},children:"Try again"})]}):this.props.children}};export{ge as a,be as b,we as c,Se as d,ve as e,Re as f,Ee as g,Ae as h,xe as i,ke as j,Ce as k,Fe as l,Pe as m,He as n,ae as o};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as a}from"./chunk.
|
|
1
|
+
import{t as a}from"./chunk.CXJJB3MK.js";import{G as f,V as s,da as l}from"./chunk.3CJLAJXP.js";import{b as i}from"./chunk.AJZBJBMO.js";var d=i(f(),1),p=i(s(),1),c=new Set;function B(e){return c.add(e),()=>void c.delete(e)}function S(){let{store:e,principal:o}=l();return(0,d.useMemo)(()=>n=>{let t=n.on===void 0?void 0:e.graph.getNode(n.on);if(!t)return null;let u=[...c].filter(r=>r.store===e&&r.kind===t.kind);return(n.element?u.find(r=>r.root()?.contains(n.element)??!1):u[0])?.section(t.id,o)??null},[e,o])}function v({children:e}){let o=S(),n=(0,d.useMemo)(()=>[o],[o]);return(0,p.jsx)(a,{sections:n,children:e})}export{B as a,S as b,v as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as u}from"./chunk.NBVPWLRY.js";import{na as l}from"./chunk.J24YPQ5I.js";function a(e,n){let s=new Map;for(let o of e){let t=n(o.from),i=n(o.to);if(t===void 0||i===void 0)continue;let d=`${o.kind}|${t}|${i}`,r=s.get(d);r||s.set(d,r={edge:o.kind,from:t,to:i,links:0,froms:new Set,tos:new Set}),r.links+=1,r.froms.add(o.from),r.tos.add(o.to)}return[...s.entries()].sort(([o],[t])=>o<t?-1:o>t?1:0).map(([o,t])=>({key:o,edge:t.edge,from:t.from,to:t.to,links:t.links,fromCount:t.froms.size,toCount:t.tos.size}))}function m(e,n,s){let o=[],t=[];for(let d of e){let r=f(d);if(r!==null){o.includes(r)||o.push(r);continue}s(d)!==void 0&&t.push(d)}let i=n.overview&&n.focusId!==null?f(n.focusId):null;return n.beside&&n.overview&&i===null&&n.focusId!==null&&t.length===0&&o.length===0&&s(n.focusId)!==void 0&&t.push(n.focusId),{districts:o,records:t,lens:i}}function f(e){return e.startsWith("kind:")?e.slice(5)||null:e.startsWith("aggregate:")&&!e.includes("|")&&e.slice(10)||null}function y(e,n){let s=u(e,n.from,n.edge,"out"),o=n.from===n.to?" of their own":"";return`${l(e,n.from,n.fromCount)} \u2192 ${l(e,n.to,n.toCount)}${o}, ${s}`}export{a,m as b,f as c,y as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as U,b as Y,c as G,d as D}from"./chunk.LKK5YF2H.js";import"./chunk.MD36ZSM5.js";import"./chunk.L6FGKJ5H.js";import{G as ae,Q as L,R as F,V,ea as _}from"./chunk.3CJLAJXP.js";import"./chunk.SDO3U72B.js";import{W as H,cb as K,db as B,sd as M}from"./chunk.J24YPQ5I.js";import"./chunk.FQLNBIQ5.js";import{b as R}from"./chunk.AJZBJBMO.js";function O(n,t){let r=K(n);return r==="agent"?"agent":r!=="human"&&r!=="visitor"?"app":n.onBehalfOf!==void 0?"person":n.id===void 0||t?.id===void 0||n.id===t.id?"you":"person"}var re=n=>n.ops.filter(t=>t.withheld!==!0);function X(n,t={}){let r=[];for(let e of n.batches()){let s=e.ops[0],d=e.ops.at(-1),l=re(e).length===0,h=l?void 0:Y(e.ops),c=r.at(-1);if(h&&c?.typed&&c.author&&U(c.author,e.author)&&c.typed.node===h.node&&c.typed.field===h.field){let S=G(c.typed,h);r[r.length-1]={...c,seq:d.seq+1,at:d.at,batch:e.id,batches:[...c.batches??[],e.id],typed:S,said:D(S,n.schema,n.graph,!1)};continue}r.push({seq:d.seq+1,from:s.seq,at:d.at,batch:e.id,maker:l?"person":O(e.author,t.me),author:l?void 0:e.author,said:h?D(h,n.schema,n.graph,!1):e.intent,declaration:!1,withheld:l,...h?{batches:[e.id],typed:h}:{}})}let i=[...n.log.epochs().filter(e=>e.change!==void 0).map(e=>({seq:e.seq,sentence:e.change,...e.at?{at:e.at}:{}})),...t.declarations??[]];for(let e of i){if(e.seq<n.log.horizon||e.seq>n.log.length)continue;let s=r.findIndex(d=>d.seq===e.seq);if(s>=0&&!r[s].withheld){r[s]={...r[s],declaration:!0,said:e.sentence};continue}r.push({seq:e.seq,from:e.seq,at:e.at,batch:void 0,maker:e.author?O(e.author,t.me):"app",author:e.author,said:e.sentence,declaration:!0,withheld:!1})}return r.sort((e,s)=>e.seq-s.seq||+(e.batch!==void 0)-+(s.batch!==void 0))}function J(n,t){let r=n.log.all(),i=new Map(r.map(e=>[e.id,e.seq]));return n.batches().filter(e=>!e.undone&&e.ops[0].seq>=t).filter(e=>!e.ops.every(s=>s.sentOut!==void 0)).filter(e=>!e.ops.every(s=>s.undoes!==void 0&&(i.get(s.undoes)??-1)>=t)).map(e=>e.id)}function Q(n,t){return n.withheld?"Someone":n.maker==="you"?"you":n.author?B(n.author,t):"the app"}var p=R(ae(),1);var o=R(V(),1),oe={kind:"human"},ie=[1,2,4,8],se=900,E={you:"You",person:"A person",agent:"An agent",app:"The app"},Z={you:"var(--graview-accent)",person:"var(--graview-ink-muted)",agent:"var(--graview-activity, var(--graview-good))",app:"var(--graview-edge-bright)"};function de(n,t,r){return[...new Set([...r,t,...n.map(i=>i.seq)])].sort((i,e)=>i-e)}function le(n,t){let r=n.withheld===!0;return{seq:n.seq+1,from:n.seq,at:n.at,batch:n.batch,maker:r?"person":O(n.author,t),author:r?void 0:n.author,said:n.batchIntent??n.intent,declaration:!1,withheld:r}}function ce(n,t){let r=0;for(let i=0;i<n.length;i++)n[i]<=t&&(r=i);return r}function pe(n,t,r){let i=J(n,t);if(i.length===0)return null;let e=n.canUndo(i);if(!e.ok)return null;let s=new Set(n.permittedMutations(r).map(d=>d.name));return e.ops.every(d=>d.mutation!==null&&s.has(d.mutation.name))?i:null}function we({face:n}){let t=L(),r=_(),i=r?.principal??oe,e=F(t.live,i),s=e.log.length,d=(0,p.useMemo)(()=>X(e,{me:i,...t.host?.declarations?{declarations:t.host.declarations}:{}}),[e,i,t.host,s]),l=e.log.horizon,h=l>0&&t.host?.archived!==void 0,c=t.kept,S=(0,p.useMemo)(()=>h?c?.stops??Array.from({length:l},(a,g)=>g):[],[h,c,l]),m=(0,p.useMemo)(()=>de(d,l,S),[d,l,S]),f=t.archive,y=f?.seq??t.past?.seq??s,x=t.host?.kept&&(f?.behindKept||c!==void 0&&(y<=c.through||c.from>0&&y<=c.from))?t.host.kept:void 0,w=ce(m,y),b=m.length-1,j=y<l&&t.past?.seq===y?t.past.store.log.all().at(-1):void 0,q=j?le(j,i):y<l?void 0:[...d].reverse().find(a=>a.seq<=y&&a.seq>(m[w-1]??-1))??[...d].reverse().find(a=>a.seq<=y),[k,A]=(0,p.useState)(!1),[T,ee]=(0,p.useState)(1),[C,W]=(0,p.useState)(null);(0,p.useEffect)(()=>{if(!k)return;if(w>=b){A(!1);return}let a=setTimeout(()=>t.show(m[w+1]),se/T);return()=>clearTimeout(a)},[k,w,b,T,m,t]);let z=(0,p.useMemo)(()=>t.past&&!f&&y>=l?pe(e,y,i):null,[t.past,f,e,y,l,i,s]),N=a=>Q(a,{graph:e.graph,schema:e.schema,...r?.seats?{seats:r.seats}:{},...r?.people?{people:r.people}:{}}),v=t.past?t.past.at?H(t.past.at,r?.locale):"the start":null,$=f?f.refused?"The archive could not be read":f.behindKept?"Nothing this far back is kept":"Reading the older changes from the archive\u2026":q?`${N(q)==="you"?"You":N(q)}: ${q.said}`:"Nothing had happened yet",I=(0,p.useRef)(null);(0,p.useLayoutEffect)(()=>{let a=I.current,g=a?.parentElement;if(n!=="scene"||!a||!g)return;let u=()=>g.style.setProperty("--graview-sheet",`${Math.ceil(a.getBoundingClientRect().height)+24}px`);u();let P=typeof ResizeObserver>"u"?null:new ResizeObserver(u);return P?.observe(a),()=>{P?.disconnect(),g.style.removeProperty("--graview-sheet")}},[n]);let te=n==="scene"?{position:"absolute",left:"50%",bottom:12,transform:"translateX(-50%)",width:"min(720px, calc(100% - 32px))",zIndex:M("rail")}:{position:"sticky",top:0,zIndex:M("rail"),margin:"0 auto 12px",maxWidth:960,width:"100%"};return(0,o.jsxs)("section",{ref:I,"aria-label":"Timeline","data-testid":"timeline","data-graview-past":t.past?String(t.past.seq):"now","data-graview-offstage":"",style:{...te,boxSizing:"border-box",display:"grid",gap:8,padding:"10px 12px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontSize:"0.8125rem"},children:[(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px"},children:[(0,o.jsx)("strong",{"data-testid":"as-of",role:"status",style:{fontWeight:600},children:f?"Archived changes":v?`As of ${v}`:"Now"}),(0,o.jsx)("span",{"data-testid":"timeline-caption",style:{color:"var(--graview-ink-muted)",minWidth:0,overflowWrap:"anywhere"},children:$}),v?(0,o.jsx)("span",{style:{color:"var(--graview-ink-faint)"},"data-testid":"past-read-only",children:"Nothing changes while you look back."}):null]}),(0,o.jsxs)("div",{style:{position:"relative",height:22},"aria-hidden":"true",children:[h?(0,o.jsx)("span",{"data-testid":"timeline-archived",title:"Changes read from the archive as you scrub back",style:{position:"absolute",left:0,bottom:0,height:6,width:`${b===0?0:m.indexOf(l)/b*100}%`,borderRadius:2,background:"var(--graview-edge)"}}):null,m.slice(1).map((a,g)=>{let u=[...d].reverse().find(ne=>ne.seq===a);if(!u)return null;let P=b===0?0:(g+1)/b*100;return(0,o.jsx)("span",{"data-graview-tick":a,"data-maker":u.maker,...u.declaration?{"data-declaration":""}:{},title:`${E[u.maker]}: ${u.said}`,style:{position:"absolute",left:`calc(${P}% - 1px)`,bottom:0,width:u.declaration?4:2,height:u.declaration?22:12,borderRadius:2,background:u.declaration?"var(--graview-ink)":Z[u.maker],opacity:a<=y?1:.45}},`${a}:${u.batch??"declaration"}`)})]}),(0,o.jsx)("input",{type:"range","data-testid":"scrubber","aria-label":"Moment",min:0,max:b,step:1,value:w,"aria-valuetext":v?`As of ${v}. ${$}`:`Now. ${$}`,onChange:a=>{A(!1),t.show(m[Number(a.currentTarget.value)]??s)},style:{width:"100%",margin:0,accentColor:"var(--graview-accent)"}}),(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,o.jsx)("button",{type:"button","data-testid":"play","aria-pressed":k,onClick:()=>{!k&&w>=b&&t.show(m[0]),A(!k)},style:{minHeight:28,minWidth:64},children:k?"Pause":"Play"}),(0,o.jsxs)("label",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--graview-ink-muted)"},children:["Speed",(0,o.jsx)("select",{"data-testid":"speed",value:T,onChange:a=>ee(Number(a.currentTarget.value)),style:{minHeight:28},children:ie.map(a=>(0,o.jsxs)("option",{value:a,children:[a,"\xD7"]},a))})]}),(0,o.jsx)("span",{"aria-hidden":"true",style:{display:"inline-flex",gap:10,color:"var(--graview-ink-faint)",flexWrap:"wrap"},children:Object.keys(E).filter(a=>d.some(g=>g.maker===a)).map(a=>(0,o.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[(0,o.jsx)("span",{style:{width:8,height:8,borderRadius:2,background:Z[a]}}),E[a]]},a))}),(0,o.jsxs)("span",{style:{marginLeft:"auto",display:"inline-flex",gap:8},children:[z?(0,o.jsx)("button",{type:"button","data-testid":"restore-here",title:"Take back every change since, as one change you can undo",onClick:()=>{W(null);try{e.undo([...z],{author:i,intent:v?`Restore to ${v}`:"Restore"}),t.show(null)}catch(a){W(a instanceof Error?a.message:String(a))}},style:{minHeight:28},children:"Restore to here"}):null,(0,o.jsx)("button",{type:"button","data-testid":"back-to-now",onClick:()=>t.show(null),style:{minHeight:28},children:"Back to now"})]})]}),C?(0,o.jsx)("span",{role:"alert","data-testid":"restore-refused",style:{color:"var(--graview-warn)"},children:C}):null,f?.refused?(0,o.jsx)("span",{role:"alert","data-testid":"archive-refused",style:{color:"var(--graview-warn)"},children:f.refused}):null,x?(0,o.jsxs)("span",{"data-testid":"timeline-kept",style:{color:"var(--graview-ink-faint)"},children:[x.sentence,x.action?(0,o.jsxs)(o.Fragment,{children:[" ",(0,o.jsx)("a",{"data-testid":"timeline-kept-action",href:x.action.href,style:{color:"var(--graview-ink-muted)"},children:x.action.label})]}):null]}):null,l>0&&!h?(0,o.jsx)("span",{"data-testid":"timeline-horizon",style:{color:"var(--graview-ink-faint)"},children:"The changes before the timeline's start were archived."}):null]})}export{we as Timeline};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as F,l as b}from"./chunk.
|
|
1
|
+
import{g as F,l as b}from"./chunk.CD6YWH6T.js";function L(t,o){return o===1&&["every","some","sum","min","max","sort"].includes(t.fn)}function M(t){let o=new Set,e=new Set,r=[],s=[],a=new Set(F),i=(l,f)=>{switch(l.t){case"lit":return;case"ident":f||o.add(l.name);return;case"list":l.items.forEach(c=>i(c,f));return;case"member":i(l.object,f);return;case"unary":i(l.operand,f);return;case"binary":i(l.left,f),i(l.right,f);return;case"where":i(l.set,f),i(l.filter,!0);return;case"call":{e.add(l.fn);let c=(l.fn==="out"||l.fn==="in")&&l.args.length===2?l.args[1]:l.args[0],g=c?.t==="lit"&&typeof c.value=="string"?c.value:void 0;l.fn==="all"&&g&&r.push(g),(l.fn==="out"||l.fn==="in")&&g&&s.push(g),l.args.forEach((v,k)=>i(v,f||L(l,k)));return}}};return i(t,!1),{names:o,functions:e,unknownFunctions:[...e].filter(l=>!a.has(l)),sweeps:r,edges:s}}var p=class extends Error{constructor(e,r,s){super(`${e} (at character ${r+1} of "${s}")`);this.sentence=e;this.at=r;this.source=s}},D=["||","&&","==","!=","<=",">=","<",">","!","|","&","+","-","*","/","%","(",")","[","]",",","."],j={and:"&&",or:"||",not:"!"},T=2e3;function H(t){let o=[],e=0;for(;e<t.length;){let r=t[e];if(r===" "||r===" "||r===`
|
|
2
2
|
`||r==="\r"){e++;continue}if(r>="0"&&r<="9"){let a=e;for(;e<t.length&&/[0-9.]/.test(t[e]);)e++;let i=t.slice(a,e),l=Number(i);if(!Number.isFinite(l)||i.split(".").length>2)throw new p(`"${i}" is not a number`,a,t);o.push({k:"num",v:l,at:a});continue}if(r==="'"||r==='"'){let a=e++,i="";for(;e<t.length&&t[e]!==r;)t[e]==="\\"&&e+1<t.length&&e++,i+=t[e++];if(e>=t.length)throw new p("a quoted word is never closed",a,t);e++,o.push({k:"str",v:i,at:a});continue}if(/[A-Za-z_]/.test(r)){let a=e;for(;e<t.length&&/[A-Za-z0-9_]/.test(t[e]);)e++;let i=t.slice(a,e),l=Object.hasOwn(j,i)?j[i]:void 0;o.push(l?{k:"op",v:l,at:a}:{k:"id",v:i,at:a});continue}let s=D.find(a=>t.startsWith(a,e));if(!s)throw new p(`"${r}" is not part of the rule language`,e,t);o.push({k:"op",v:s,at:e}),e+=s.length}return o.push({k:"end",at:t.length}),o}function w(t){if(t.length>T)throw new p(`an expression may be at most ${T} characters`,0,t.slice(0,40));let o=H(t),e=0,r=()=>o[e],s=n=>{let d=r();return d.k==="op"&&d.v===n},a=n=>{let d=r();return d.k==="id"&&d.v===n},i=(n,d)=>{if(!s(n))throw new p(`expected ${d}`,r().at,t);e++},l=0,f=(n,d)=>{if(++l>64)throw new p("the expression nests too deeply",n,t);try{return d()}finally{l--}},c=(n,d)=>()=>{let m=d();for(;;){let y=r(),S=y.k==="op"?n.find(q=>q===y.v):y.k==="id"&&y.v==="in"&&n.includes("in")?"in":void 0;if(!S)return m;e++,m={t:"binary",op:S,left:m,right:d(),at:y.at}}},g=()=>{let n=r();if(n.k==="num")return e++,{t:"lit",value:n.v,at:n.at};if(n.k==="str")return e++,{t:"lit",value:n.v,at:n.at};if(n.k==="id"){if(e++,n.v==="true"||n.v==="false")return{t:"lit",value:n.v==="true",at:n.at};if(n.v==="null")return{t:"lit",value:null,at:n.at};if(s("(")){e++;let d=[];if(!s(")"))for(;;){if(d.push(h()),s(",")){e++;continue}break}return i(")",`")" to close ${n.v}(\u2026)`),{t:"call",fn:n.v,args:d,at:n.at}}return{t:"ident",name:n.v,at:n.at}}if(n.k==="op"&&n.v==="("){e++;let d=f(n.at,h);return i(")",'a ")"'),d}if(n.k==="op"&&n.v==="["){e++;let d=[];if(!s("]"))for(;;){if(d.push(h()),s(",")){e++;continue}break}return i("]",'a "]" to close the list'),{t:"list",items:d,at:n.at}}throw n.k==="end"?new p("the expression ends too soon",n.at,t):new p(`"${n.k==="op"?n.v:""}" cannot start a value here`,n.at,t)},v=()=>{let n=g();for(;;){if(s(".")){let d=r();e++;let m=r();if(m.k!=="id")throw new p('expected a field name after "."',m.at,t);e++,n={t:"member",object:n,name:m.v,at:d.at};continue}if(a("where")){let d=r().at;e++,n={t:"where",set:n,filter:f(d,h),at:d};continue}return n}},k=()=>{let n=r();return n.k==="op"&&(n.v==="!"||n.v==="-")?(e++,{t:"unary",op:n.v,operand:f(n.at,k),at:n.at}):v()},P=c(["*","/","%"],k),z=c(["+","-"],P),N=c(["&"],z),R=c(["|"],N),_=()=>{let n=R(),d=r(),m=d.k==="op"&&["==","!=","<","<=",">",">="].includes(d.v)?d.v:d.k==="id"&&d.v==="in"?"in":void 0;return m?(e++,{t:"binary",op:m,left:n,right:R(),at:d.at}):n},O=()=>{let n=r();return n.k==="op"&&n.v==="!"?(e++,{t:"unary",op:"!",operand:f(n.at,O),at:n.at}):_()},B=c(["&&"],O),I=c(["||"],B);function h(){return I()}let K=h();if(r().k!=="end")throw new p("there is more after the end of the expression",r().at,t);return K}function E(t){let o,e=-1,r=0;for(let s=0;s<t.length;s++){let a=t[s];if(o){a==="\\"?s++:a===o&&(o=void 0);continue}a==="'"||a==='"'?o=a:a==="("||a==="["?r++:a===")"||a==="]"?r--:a==="|"&&r===0&&(t[s+1]==="|"?s++:e=s)}if(e>0&&t.slice(e+1).trim()===x){let s=E(t.slice(0,e));if(s>=0)return s}return e}var x="capital",$=/\s*(?:'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)")\s*(,|$)/y;function U(t){let o=E(t);if(o>=0){if(t.slice(o+1).trim()!==x)throw new u('only "capital" may follow another formatter, like {n | words | capital}');let e=t.slice(0,o);if(e.trim()===x)throw new u('"capital" is said once');return{...C(e),capital:!0}}return t.trim()===x?{args:[],capital:!0}:C(t)}function C(t){let o=t.indexOf(":"),e=(o>=0?t.slice(0,o):t).trim();if(!b.includes(e))throw new u(`"${e}" is not a formatter; use one of ${[...b,x].join(", ")}`);let r=[];if(o>=0&&e==="excerpt"){let s=t.slice(o+1).trim();if(!/^\d+$/.test(s)||Number(s)<20||Number(s)>1e3)throw new u("excerpt is told at most how many characters, 20 to 1000: {summary | excerpt: 80}");r.push(s)}else if(o>=0&&e==="money"){if(t.slice(o+1).trim()!=="0")throw new u("money is told 0 for whole units, rounded \u2014 {total | money: 0} \u2014 or nothing, for cents only where a sum has them");r.push("0")}else if(o>=0){let s=t.slice(o+1),a=0;for(;a<s.length;){$.lastIndex=a;let i=$.exec(s);if(!i)throw new u(`"${e}" is told quoted words, like ${e}: 'offer'`);if(r.push((i[1]??i[2]??"").replace(/\\(.)/g,"$1")),a=$.lastIndex,i[3]==="")break}}if(e==="plural"&&(r.length<1||r.length>2))throw new u("plural is told its noun, like {count | plural: 'offer'}, and its plural where English does not make it: plural: 'person', 'people'");if(e!=="plural"&&e!=="excerpt"&&e!=="money"&&r.length>0)throw new u(`"${e}" takes nothing after it`);return{format:e,args:r}}var u=class extends Error{constructor(e){super(e);this.sentence=e}};function Y(t){let o=[],e=0;for(;e<t.length;){let r=t.indexOf("{",e);if(r<0){o.push({text:t.slice(e)});break}r>e&&o.push({text:t.slice(e,r)});let s=t.indexOf("}",r);if(s<0)throw new u(`a "{" at character ${r+1} is never closed`);let a=t.slice(r+1,s),i=E(a),l=(i>=0?a.slice(0,i):a).trim(),f=i>=0?U(a.slice(i+1)):void 0,c=E(l);if(c>=0&&b.includes(l.slice(c+1).split(":")[0].trim()))throw new u('only "capital" may follow another formatter, like {n | words | capital}');o.push({expr:w(l),source:l,...f?.format?{format:f.format}:{},...f&&f.args.length>0?{formatArgs:f.args}:{},...f?.capital?{capital:!0}:{}}),e=s+1}return o}function A(t){let o=new Map;for(let[e,r]of Object.entries(t?.computed??{}))o.set(e,typeof r=="string"?{expr:r}:r);return o}function re(t){let o=A(t);if(o.size===0)return;let e=new Map;for(let[r,s]of o)try{e.set(r,w(s.expr))}catch(a){if(!(a instanceof p))throw a}return e}function Z(t,o,e=new Set){let r=A(t).get(o);if(!r||e.has(o))return!1;let s;try{s=w(r.expr)}catch{return!1}let a=M(s);if(a.edges.length>0||a.sweeps.length>0||[...a.functions].some(c=>c==="out"||c==="in"||c==="all"))return!1;let i=t.fields,l=c=>i instanceof Set?i.has(c):Object.hasOwn(i,c),f=new Set([...e,o]);return[...a.names].every(c=>l(c)||Z(t,c,f))}export{M as a,p as b,w as c,u as d,Y as e,A as f,re as g,Z as h};
|