graview 0.1.35 → 0.1.37
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.5FZQI2US.js → chunk.24E4R4ZH.js} +1 -1
- package/dist/preview/{chunk.OEDCAHII.js → chunk.2JF254FO.js} +1 -1
- package/dist/preview/chunk.2TDB4D6Y.js +1 -0
- package/dist/preview/{chunk.5MCC54VM.js → chunk.3IVVXVG7.js} +1 -1
- package/dist/preview/{chunk.TWWFWHK3.js → chunk.3KJQXYCA.js} +1 -1
- package/dist/preview/chunk.3V2M3S4U.js +1 -0
- package/dist/preview/{chunk.IX6RNGAT.js → chunk.4NCXMVPY.js} +1 -1
- package/dist/preview/chunk.57XTDW57.js +1 -0
- package/dist/preview/chunk.5CLFTXP3.js +1 -0
- package/dist/preview/chunk.5EXYDBAL.js +88 -0
- package/dist/preview/chunk.5JPRRV47.js +1 -0
- package/dist/preview/{chunk.DLT3EE4D.js → chunk.67PVRVAC.js} +1 -1
- package/dist/preview/{chunk.OZ5KJLA2.js → chunk.6DYZBDWT.js} +1 -1
- package/dist/preview/chunk.6SK2K72G.js +1 -0
- package/dist/preview/{chunk.RTB4MMF6.js → chunk.74DXEKUV.js} +1 -1
- package/dist/preview/chunk.76QUEWYD.js +1 -0
- package/dist/preview/{chunk.KWCML3BF.js → chunk.7MMNMZLF.js} +1 -1
- package/dist/preview/chunk.7OLVQ2FZ.js +1 -0
- package/dist/preview/{chunk.BGW7XTMH.js → chunk.7UQOXYJX.js} +1 -1
- package/dist/preview/{chunk.ZHXX22AT.js → chunk.AHC4EXLW.js} +2 -2
- package/dist/preview/{chunk.DUUARGPE.js → chunk.AWRS6TUN.js} +1 -1
- package/dist/preview/{chunk.EAM4NAQH.js → chunk.AZ333RB3.js} +1 -1
- package/dist/preview/{chunk.PJ2DF6C7.js → chunk.BA3REPV5.js} +1 -1
- package/dist/preview/{chunk.LRRVBM4F.js → chunk.BRBY5WJT.js} +2 -2
- package/dist/preview/{chunk.VMGWYCXU.js → chunk.BXWO6ILK.js} +1 -1
- package/dist/preview/chunk.CGQLE7JW.js +1 -0
- package/dist/preview/chunk.CV4CBHFT.js +1 -0
- package/dist/preview/chunk.CYPTJNES.js +1 -0
- package/dist/preview/{chunk.TIBZZ2WY.js → chunk.D2ILIAND.js} +1 -1
- package/dist/preview/chunk.DLCFCMKX.js +1 -0
- package/dist/preview/chunk.DMUUYZ37.js +1 -0
- package/dist/preview/chunk.DNNL7F3P.js +25 -0
- package/dist/preview/chunk.EHT4HBH5.js +35 -0
- package/dist/preview/chunk.EKUAI5YL.js +1 -0
- package/dist/preview/chunk.ELY2RMGE.js +19 -0
- package/dist/preview/{chunk.5VB7DJTL.js → chunk.ENEOGGFM.js} +1 -1
- package/dist/preview/chunk.ENJKCSNX.js +1 -0
- package/dist/preview/chunk.FEPYKPZE.js +1 -0
- package/dist/preview/{chunk.KYH4QIVI.js → chunk.FFW6XWHB.js} +1 -1
- package/dist/preview/{chunk.QU356VB2.js → chunk.FGYCYLUS.js} +1 -1
- package/dist/preview/{chunk.FX6GH57T.js → chunk.G7S7GLDK.js} +1 -1
- package/dist/preview/chunk.GMZAQGH7.js +1 -0
- package/dist/preview/chunk.GXPBRYSR.js +1 -0
- package/dist/preview/{chunk.5B7NWF7C.js → chunk.H4LFJPDV.js} +1 -1
- package/dist/preview/chunk.HBBVVALN.js +5 -0
- package/dist/preview/{chunk.GO4QBFED.js → chunk.HCK4Y6C5.js} +1 -1
- package/dist/preview/chunk.HSRGYZOR.js +1 -0
- package/dist/preview/chunk.HYAKRLPT.js +4 -0
- package/dist/preview/chunk.IHBIRAC4.js +2 -0
- package/dist/preview/chunk.IWK5QL6P.js +1 -0
- package/dist/preview/{chunk.WQBDTLPZ.js → chunk.J2CR4RRH.js} +1 -1
- package/dist/preview/chunk.J2HQEUYA.js +1 -0
- package/dist/preview/{chunk.GMOTRAKJ.js → chunk.JBRXGPPM.js} +1 -1
- package/dist/preview/chunk.JDRM6XXD.js +2 -0
- package/dist/preview/chunk.JFLUVZNW.js +1 -0
- package/dist/preview/chunk.KAWP4RNR.js +1 -0
- package/dist/preview/{chunk.577PGFUT.js → chunk.LJE5J3JK.js} +1 -1
- package/dist/preview/chunk.LPJY6V5D.js +1 -0
- package/dist/preview/chunk.LVLAS5GL.js +1 -0
- package/dist/preview/{chunk.CHJZ7LST.js → chunk.LVNAB2BW.js} +1 -1
- package/dist/preview/{chunk.747GGBPR.js → chunk.LYJXX6BU.js} +1 -1
- package/dist/preview/{chunk.2OBIO5Y6.js → chunk.MJLUAGEV.js} +1 -1
- package/dist/preview/chunk.MKPJKZAP.js +1 -0
- package/dist/preview/chunk.MMBMVHIG.js +1 -0
- package/dist/preview/chunk.NNNVB6RV.js +1 -0
- package/dist/preview/chunk.NOZEHLWG.js +2 -0
- package/dist/preview/{chunk.MVN6H65Q.js → chunk.NV6IZJKA.js} +1 -1
- package/dist/preview/{chunk.2QQAOJET.js → chunk.NWHFFOXW.js} +1 -1
- package/dist/preview/chunk.NZJZIYDK.js +1 -0
- package/dist/preview/chunk.O6KNGFWH.js +1 -0
- package/dist/preview/chunk.PMK73A53.js +1 -0
- package/dist/preview/chunk.PQPZZ7ZW.js +117 -0
- package/dist/preview/{chunk.XSYBNUXF.js → chunk.QJYALCIW.js} +1 -1
- package/dist/preview/chunk.QMZUKAPJ.js +1 -0
- package/dist/preview/{chunk.A3F7MFDR.js → chunk.QNGFBJWP.js} +1 -1
- package/dist/preview/{chunk.D4WQEBWV.js → chunk.QOXTBRKE.js} +1 -1
- package/dist/preview/{chunk.Y5Z4ZDTO.js → chunk.QXARGANF.js} +6 -6
- package/dist/preview/{chunk.PPUAPAWR.js → chunk.QYWBQ5NX.js} +1 -1
- package/dist/preview/{chunk.EQWOQOFJ.js → chunk.RPOYSIVQ.js} +1 -1
- package/dist/preview/{chunk.SECORXDP.js → chunk.SNKOPWAD.js} +1 -1
- package/dist/preview/{chunk.HPD5ZDZH.js → chunk.SZMWJHU2.js} +1 -1
- package/dist/preview/{chunk.3H4NVUWV.js → chunk.TN4GY6LW.js} +1 -1
- package/dist/preview/{chunk.DNDHDDM6.js → chunk.TRLVFHFT.js} +2 -2
- package/dist/preview/chunk.TSI4O3GH.js +1 -0
- package/dist/preview/chunk.TX5QIZEP.js +1 -0
- package/dist/preview/{chunk.JAPYJ53U.js → chunk.TXS4I326.js} +1 -1
- package/dist/preview/chunk.U4URQDC5.js +1 -0
- package/dist/preview/chunk.UCVZG7S4.js +1 -0
- package/dist/preview/{chunk.LAF6GTBN.js → chunk.UPBUF7KR.js} +1 -1
- package/dist/preview/{chunk.UHQD3NTK.js → chunk.UR5TT4JH.js} +1 -1
- package/dist/preview/{chunk.PKKA6JWA.js → chunk.UV2TSAB4.js} +1 -1
- package/dist/preview/{chunk.FSAHO3LV.js → chunk.UVLPVHID.js} +1 -1
- package/dist/preview/chunk.VUKHDZNI.js +1 -0
- package/dist/preview/{chunk.G2ZPQUXM.js → chunk.VW6WGFL6.js} +1 -1
- package/dist/preview/chunk.VX7MGVP5.js +1 -0
- package/dist/preview/{chunk.SD33BD7A.js → chunk.WLV2QYTS.js} +1 -1
- package/dist/preview/{chunk.3QXHII5W.js → chunk.WNKRXL3O.js} +1 -1
- package/dist/preview/chunk.WNMLA4YW.js +1 -0
- package/dist/preview/{chunk.FVPOSGNG.js → chunk.WVEKYJSI.js} +2 -2
- package/dist/preview/{chunk.FBY5IUGU.js → chunk.X2OLXTRL.js} +1 -1
- package/dist/preview/{chunk.LWSTEZIP.js → chunk.XS3SAH6U.js} +1 -1
- package/dist/preview/chunk.XWJ2MRQF.js +1 -0
- package/dist/preview/{chunk.6J7DR7XQ.js → chunk.Y44TR4WG.js} +1 -1
- package/dist/preview/{chunk.CDMV6L5I.js → chunk.YAXOIJVH.js} +1 -1
- package/dist/preview/chunk.YFW5BF6J.js +1 -0
- package/dist/preview/chunk.YNJOLOFG.js +1 -0
- package/dist/preview/{chunk.AINNENYD.js → chunk.YW2BZ2LH.js} +2 -2
- package/dist/preview/chunk.YX354FRV.js +1 -0
- package/dist/preview/{chunk.DQ5HAB3N.js → chunk.ZB7GV3IT.js} +1 -1
- package/dist/preview/{chunk.3P4IIXIT.js → chunk.ZOT4V66Q.js} +1 -1
- package/dist/preview/chunk.ZYPCE2LZ.js +1 -0
- package/dist/preview/index.html +42 -42
- package/dist/preview/page.js +5 -5
- package/package.json +6 -6
- package/dist/preview/chunk.2YGQVI6T.js +0 -1
- package/dist/preview/chunk.3C4RJIJU.js +0 -1
- package/dist/preview/chunk.4J75WRDG.js +0 -1
- package/dist/preview/chunk.4K5QCJFH.js +0 -2
- package/dist/preview/chunk.4NZBMZC7.js +0 -117
- package/dist/preview/chunk.52QAIGCD.js +0 -1
- package/dist/preview/chunk.5EAQDBBE.js +0 -1
- package/dist/preview/chunk.656N5BHG.js +0 -1
- package/dist/preview/chunk.6K2HASOH.js +0 -1
- package/dist/preview/chunk.6P7P2AW7.js +0 -1
- package/dist/preview/chunk.AEHPDVLQ.js +0 -1
- package/dist/preview/chunk.APNN6BKF.js +0 -1
- package/dist/preview/chunk.B2KITMSD.js +0 -1
- package/dist/preview/chunk.BL6VDLAW.js +0 -1
- package/dist/preview/chunk.DMNXYMLC.js +0 -1
- package/dist/preview/chunk.DPP7ITTU.js +0 -1
- package/dist/preview/chunk.DTR5I4BI.js +0 -1
- package/dist/preview/chunk.FHXXYWL3.js +0 -1
- package/dist/preview/chunk.FIVLFXFB.js +0 -35
- package/dist/preview/chunk.FUQVNXLB.js +0 -1
- package/dist/preview/chunk.GCGITEON.js +0 -1
- package/dist/preview/chunk.GCVO6N26.js +0 -1
- package/dist/preview/chunk.GF7LA4QG.js +0 -1
- package/dist/preview/chunk.H243UV3Z.js +0 -19
- package/dist/preview/chunk.IHFNLKXV.js +0 -1
- package/dist/preview/chunk.JLMLKDVX.js +0 -88
- package/dist/preview/chunk.JMQ6YLQX.js +0 -1
- package/dist/preview/chunk.LIIC25G6.js +0 -1
- package/dist/preview/chunk.M5HADQPP.js +0 -1
- package/dist/preview/chunk.O36ZDLWC.js +0 -1
- package/dist/preview/chunk.PQPTYNW2.js +0 -1
- package/dist/preview/chunk.PW7YH6JV.js +0 -2
- package/dist/preview/chunk.Q7TP4RFE.js +0 -1
- package/dist/preview/chunk.QRMWFEEH.js +0 -1
- package/dist/preview/chunk.QVKKXMNK.js +0 -1
- package/dist/preview/chunk.QVUL2FSI.js +0 -1
- package/dist/preview/chunk.RHYA742Q.js +0 -1
- package/dist/preview/chunk.RIW7SQH4.js +0 -2
- package/dist/preview/chunk.SBBNIYVB.js +0 -1
- package/dist/preview/chunk.TPX6AVJL.js +0 -1
- package/dist/preview/chunk.U2PYW5MS.js +0 -1
- package/dist/preview/chunk.U5EJSTST.js +0 -4
- package/dist/preview/chunk.UWIYKGYK.js +0 -25
- package/dist/preview/chunk.VWHMYPLL.js +0 -1
- package/dist/preview/chunk.VZHV25JE.js +0 -1
- package/dist/preview/chunk.X7W27IRI.js +0 -5
- package/dist/preview/chunk.YT2CYCVT.js +0 -1
- package/dist/preview/chunk.Z7ZCR4LN.js +0 -1
- package/dist/preview/chunk.ZE4CTZQ3.js +0 -1
- package/dist/preview/chunk.ZFWV4JAJ.js +0 -1
- package/dist/preview/chunk.ZKXK22AH.js +0 -1
- package/dist/preview/chunk.ZQNLC33L.js +0 -1
- package/dist/preview/chunk.ZSW74NVJ.js +0 -1
- package/dist/preview/chunk.ZZTDQKM2.js +0 -1
|
@@ -1,4 +0,0 @@
|
|
|
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,f as Ht,g as mn}from"./chunk.XSYBNUXF.js";import{h as Fr}from"./chunk.5EAQDBBE.js";import{e as Hr,p as Nn,q as Dr}from"./chunk.YT2CYCVT.js";import{a as Pe,b as So,c as Zt,d as jr,e as Mo}from"./chunk.DUUARGPE.js";import{b as yn}from"./chunk.FUQVNXLB.js";import{a as $r}from"./chunk.LAF6GTBN.js";import{a as Cr,b as Nr,c as Br}from"./chunk.QVKKXMNK.js";import{b as Rr,d as Er}from"./chunk.UT6642FC.js";import{a as Or,b as xo,c as bo,f as wo,g as vo,h as ko,i as Ar,j as Xt,k as qt,o as Bt,p as Qt,q as Tr,r as Pr}from"./chunk.QRMWFEEH.js";import{a as Lr,b as Ir}from"./chunk.MVN6H65Q.js";import{A as Sr,f as fr,g as Kt,h as mr,i as yr,j as gr,k as pr,m as Cn,n as hn,o as fn,p as Ut,q as po,v as xr,w as br,x as wr,y as vr,z as kr}from"./chunk.OJGHDWI6.js";import{c as Mr}from"./chunk.FSAHO3LV.js";import{B as at,C as co,D as cn,F as Te,J as gt,Q as Le,R as uo,V as ho,W as Pn,X as Pt,Y as pe,_ as Ct,a as zt,b as oo,c as ro,d as io,e as lr,f as cr,fa as _t,g as In,ha as hr,i as It,k as mt,l as ao,m as Tn,n as dn,oa as fo,pa as mo,q as so,qa as Nt,s as we,sa as yo,t as Oe,u as ur,v as ln,w as Ae,wa as go,x as Tt,xa as un,y as yt,z as lo}from"./chunk.UWIYKGYK.js";import{$ as Lt,Lb as sn,Qc as ar,Tc as sr,W as rr,X as Ln,Yc as dr,Z as rn,_ as Gt,aa as an,dc as Be,ea as ir}from"./chunk.X7W27IRI.js";import{b as se}from"./chunk.AJZBJBMO.js";var Wr={width:1200,height:760,focusSize:{width:1200,height:420},relationSize:{width:240,height:140},contextSize:{width:300,height:104},gap:16,unit:16};var Vr=(e,t)=>e?`${e.edgeKind}|${e.direction}`:`raised|${t}`,Dt=(e,t,n)=>`${co}${e}|${t}|${n}`;function Bn(e,t){let n=e.map(()=>0),r=e.map((i,l)=>({size:i,index:l})).sort((i,l)=>i.size-l.size||i.index-l.index),o=Math.max(t,e.length),a=e.length;for(let{size:i,index:l}of r){let c=Math.max(1,Math.floor(o/a));n[l]=Math.min(i,c),o-=n[l],a-=1}return n}function Eo(e){return Vr(e.via,e.node.kind)}function $n(e,t){let n=[],r=0;return e.forEach((o,a)=>{if(o<=0)return;if(n.length>0&&o<=r){for(let l=0;l<o;l++)n[n.length-1].push(a);r-=o;return}let i=o;for(;i>0;){let l=Math.min(t,i);n.push(Array.from({length:l},()=>a)),i-=l,r=t-l}}),n}function Oo(e,t,n){let r=Bn(e,t*n);for(;$n(r,t).length>n;){let o=-1;if(r.forEach((a,i)=>{a>1&&(o<0||a>r[o])&&(o=i)}),o<0)break;r[o]=r[o]-1}return r}function ga(e,t,n){let r=o=>[t.chosen?.has(o.id)?0:1,t.hits?.has(o.id)?0:1,t.flagged?.has(o.id)?0:1,-(t.touched?.get(o.id)??0),-n.neighbors(o.id).length];return e.map((o,a)=>({node:o,index:a,key:r(o)})).sort((o,a)=>{for(let i=0;i<o.key.length;i++)if(o.key[i]!==a.key[i])return o.key[i]-a.key[i];return o.index-a.index}).map(o=>o.node)}var pa=5,xa=(e,t)=>{for(let n=0;n<e.length;n++)if(e[n]!==t[n])return e[n]<t[n];return!1};function Yr(e,t,n){if(e.length===0||t<2)return;let r=e[0].kind,o={schema:n.schema,graph:n.graph,...n.today?{today:n.today}:{}},a=[];for(let l of Hr(n.schema,r).groups)if(l.key!==n.exclude)if(l.buckets)for(let c of["decade","year","month"])a.push({by:l.key,bucket:c});else a.push({by:l.key});let i;return a.forEach((l,c)=>{let s=Fr(e,{group:l},o).groups;if(s.length<2||s.length>t)return;let h=s.filter(w=>w.key!=="").reduce((w,f)=>w+f.nodes.length,0)/e.length;if(h<.5||s.some(w=>w.nodes.length>e.length*.75))return;let g=[-Math.round(h*100),Math.abs(s.length-pa),c];(!i||xa(g,i.score))&&(i={grouping:{by:l.by,...l.bucket?{bucket:l.bucket}:{},groups:s},score:g})}),i?.grouping}function Ao(e,t){let n=f=>({id:f.node.id,kind:f.node.kind,node:f.node,...f.via?{via:f.via}:{}});if(e.length<=t.budget)return e.map(n);let r={...t.relevance,chosen:new Set([...t.relevance?.chosen??[],...t.selection??[]])},o=new Map;for(let f of e){let x=Vr(f.via,f.node.kind),v=o.get(x);v?v.push(f):o.set(x,[f])}let a=[...o.entries()].map(([f,x])=>({key:f,run:x,via:x[0].via,kinds:[...new Set(x.map(v=>v.node.kind))],members:[],whole:!1,extra:0})),i=Bn(a.map(f=>f.run.length),t.budget);a.forEach((f,x)=>f.whole=f.run.length<=i[x]);let l=a.filter(f=>!f.whole),c=a.filter(f=>f.whole).reduce((f,x)=>f+x.run.length,0),d=Math.max(l.length,t.budget-c);for(let f of l){f.members=ga(f.run.map(v=>v.node),r,t.graph);let x=d-(l.length-1);f.kinds.length>1&&f.kinds.length<=x?f.byKind=!0:f.kinds.length===1&&(f.grouping=Yr(f.members,x,{schema:t.schema,graph:t.graph,...f.via?{exclude:f.via.edgeKind}:{},...t.today?{today:t.today}:{}}))}let s=f=>f.byKind?f.kinds.length:f.grouping?f.grouping.groups.length:1;for(;l.reduce((f,x)=>f+s(x),0)>d;){let f=[...l].filter(x=>s(x)>1).sort((x,v)=>s(v)-s(x))[0];if(!f)break;f.grouping=void 0,f.byKind=!1}d-=l.reduce((f,x)=>f+s(x),0);let u=f=>f.byKind?f.kinds.some(x=>t.expanded.has(Dt(x,f.key,"kind"))):f.grouping?.groups.some(x=>t.expanded.has(Dt(f.kinds[0],f.key,Ro(f.grouping,x.key)))),h=l.filter(f=>!f.grouping&&!f.byKind?!0:u(f)),g=Bn(h.map(f=>f.members.length),Math.max(0,d));h.forEach((f,x)=>f.extra=d>0?g[x]:0);let w=[];for(let f of a){let{key:x,via:v}=f;if(f.whole){w.push(...f.run.map(n));continue}let y=p=>({id:p.id,kind:p.kind,node:p,...v?{via:v}:{}}),E=new Map(f.run.map((p,S)=>[p.node.id,S])),I=(p,S,L)=>{let O=[...p.slice(0,S)].sort((G,V)=>E.get(G.id)-E.get(V.id));w.push(...O.map(y));let H=p.slice(S);if(H.length===0)return;let T=H[0].kind;w.push({id:Dt(T,x,L?`more:${L}`:"more"),kind:T,...v?{via:v}:{},aggregate:{kind:T,memberIds:H.map(G=>G.id),label:S>0?`${H.length} more ${t.plural(T).toLowerCase()}`:`${H.length} ${t.plural(T).toLowerCase()}`,opens:{in:"picture",focus:Ae(T),within:L?{filter:L}:{}}}})},W=v&&t.focusId?`${v.edgeKind}:${t.focusId}`:void 0;if(f.byKind){let p=f.kinds.find(S=>t.expanded.has(Dt(S,x,"kind")));for(let S of f.kinds){let L=f.members.filter(O=>O.kind===S);if(S===p){let O=f.extra+1;L.length<=O?w.push(...L.map(y)):I(L,O-1,W);continue}w.push({id:Dt(S,x,"kind"),kind:S,...v?{via:v}:{},aggregate:{kind:S,memberIds:L.map(O=>O.id),label:t.plural(S),opens:{in:"place"}}})}continue}let F=f.grouping;if(!F){I(f.members,f.extra,W);continue}let ee=f.kinds[0],z=F.groups.find(p=>t.expanded.has(Dt(ee,x,Ro(F,p.key))));for(let p of F.groups){if(p===z){let S=f.members.filter(O=>p.nodes.includes(O)),L=f.extra+1;if(S.length<=L)w.push(...S.map(y));else{let O=p.key!==""&&!p.key.includes(",")&&!F.bucket,H=[W,O?`${F.by}:${p.key}`:void 0].filter(Boolean).join(",")||void 0;I(S,L-1,H)}continue}w.push({id:Dt(ee,x,Ro(F,p.key)),kind:ee,...v?{via:v}:{},aggregate:{kind:ee,memberIds:f.members.filter(S=>p.nodes.includes(S)).map(S=>S.id),label:p.label.charAt(0).toUpperCase()+p.label.slice(1),opens:{in:"place"}}})}}return w}var Ro=(e,t)=>`${e.by}${e.bucket?`:${e.bucket}`:""}=${t||"none"}`;function zr(e,t,n,r,o=1){let a=l=>String(l).length*7.4,i=e.length*8.6+6+a(t)+14+(n>0?22+a(n):0);return{width:Math.max(i,r?184:0)*o,height:(r?38:22)*o,short:{width:i*o,height:22*o}}}function Ft(e,t,n=6){return e.x<t.x+t.width+n&&t.x<e.x+e.width+n&&e.y<t.y+t.height+n&&t.y<e.y+e.height+n}var Lo=(e,t,n,r)=>{let o=Math.max(e.x,Math.min(t.x,e.x+e.width)),a=Math.max(e.y,Math.min(t.y,e.y+e.height));return Math.abs(o-t.x)/n+Math.abs(a-t.y)/r<.92},gn=4,Gr=.45;function Io(e,t,n,r={},o={}){let a={};for(let b of e)a[b.kind]=b.count;let i={x:(r.left??0)+8,y:(r.top??0)+8,width:n.width-(r.left??0)-(r.right??0)-16,height:n.height-(r.top??0)-(r.bottom??0)-16},l=o.avoid??[],c=o.tilt??.5,d=b=>b.nameplate??{width:120,height:34,short:{width:90,height:20}},s=b=>e.map(R=>{let A=b.get(R.kind);return{card:R,plot:A,center:Zt(A.col+A.side/2,A.row+A.side/2,1,c)}}),u=(b,R)=>{let A=1/0,M=-1/0,N=1/0,P=-1/0;for(let{card:B,plot:te,center:K}of b){let j=K.x*R,J=K.y*R,X=te.side*R/2,fe=B.opened>0?d(B).width:d(B).short.width;A=Math.min(A,j-Math.max(X+(B.count>12?30:0),fe/2)),M=Math.max(M,j+Math.max(X,fe/2)),N=Math.min(N,J-X*c-R*Gr),P=Math.max(P,J+X*c+gn+d(B).short.height)}return{minX:A,maxX:M,minY:N,maxY:P}},h=b=>{let R=4,A=160;for(let M=0;M<24;M++){let N=(R+A)/2,P=u(b,N);P.maxX-P.minX<=i.width&&P.maxY-P.minY<=i.height?R=N:A=N}return R},g=b=>{let R={...o.order?{order:o.order}:{},counts:a,...o.plots?{plots:o.plots}:{},pitch:b},A=So(t,R),M=So(t,{...R,upright:!0}),N=h(s(A)),P=h(s(M)),B=n.height>n.width&&P>=N?M:A;return{map:B,fitted:B===M?P:N}},w=[],f=new Map,x=0,v=(b,R={x:0,y:0})=>{let A=u(w,b),M=i.x+i.width/2-(A.minX+A.maxX)/2+R.x,N=i.y+i.height/2-(A.minY+A.maxY)/2+R.y;return{originX:M,originY:N,cell:b}},y=b=>{let{originX:R,originY:A,cell:M}=b,N=w.map(({center:te})=>te.y),P=Math.max(...N),B=Math.min(...N);return w.map(({card:te,plot:K,center:j})=>{let J=R+j.x*M,X=A+j.y*M,fe=K.side*M/2,ie=fe*c,ve=P===B?.5:(j.y-B)/(P-B);return{card:te,plot:K,x:J,y:X,halfW:fe,halfH:ie,depth:1-ve*.65}})},E=(b,R=!0)=>{let A=[];return[...b].sort((N,P)=>(P.card.weight??P.card.count)-(N.card.weight??N.card.count)||e.indexOf(N.card)-e.indexOf(P.card)).filter(N=>[d(N.card),d(N.card).short].some(P=>{let B=F(N,P),te=(!R||B.x>=0&&B.y>=0&&B.x+B.width<=n.width&&B.y+B.height<=n.height)&&!A.some(K=>Ft(B,K,4))&&!b.some(K=>K!==N&&Lo(B,K,K.halfW,K.halfH))&&!l.some(K=>Ft(B,K,0));return te&&A.push(B),te})).length},I=b=>b.card.marquee?{x:b.x-b.card.marquee.width/2,y:b.y+b.halfH+gn+d(b.card).height,width:b.card.marquee.width,height:b.card.marquee.height}:null,W=(b,R,A)=>A.some(M=>{if(M===R)return!1;let N=I(M);return N!==null&&Ft(b,N,4)}),F=(b,R,A="under")=>A==="aside"?{x:b.x+b.halfW+gn,y:b.y-R.height/2,width:R.width,height:R.height}:A==="above"?{x:b.x-R.width/2,y:b.y-b.halfH-gn-Gr*S.cell-R.height,width:R.width,height:R.height}:{x:b.x-R.width/2,y:b.y+b.halfH+gn,width:R.width,height:R.height},ee=b=>b.some(R=>l.some(A=>Lo(A,R,R.halfW,R.halfH)||Ft(A,F(R,d(R.card).short),0))),z=b=>b.every(R=>{let A=F(R,d(R.card).short);return R.x-R.halfW>=0&&R.x+R.halfW<=n.width&&R.y-R.halfH>=0&&A.x>=0&&A.x+A.width<=n.width&&A.y+A.height<=n.height}),p={pitch:Pe,said:-1};for(let b of[Pe,Pe+1,Pe+2,Pe+3,Pe+5,Pe+7]){({map:f,fitted:x}=g(b)),w=s(f);let R=E(y(v(x)));if(R>p.said&&(p={pitch:b,said:R}),R===e.length)break}(p.pitch!==Pe+7||p.said!==e.length)&&({map:f,fitted:x}=g(p.pitch),w=s(f));let S=v(x);if(l.length>0&&ee(y(S))){let b;for(let R=1;R>=.3&&!b;R-=.05){let A=x*R,M=Math.max(...l.map(P=>P.width))/2+A,N=Math.max(...l.map(P=>P.height))/2+A/2;for(let P of[0,.5,.75,1,1.25]){for(let[B,te]of[[1,0],[-1,0],[0,1],[0,-1],[1,1],[-1,1],[1,-1],[-1,-1]]){let K=v(A,{x:B*M*P,y:te*N*P}),j=y(K);if(!ee(j)&&z(j)){b=K;break}if(P===0)break}if(b)break}}b&&(S=b)}let L=(b,R)=>{let A={x:n.width/2,y:n.height/2};return{cell:b.cell*R,originX:A.x+(b.originX-A.x)*R,originY:A.y+(b.originY-A.y)*R}},O=1;if(E(y(S))<e.length){let b={said:E(y(S),!1),area:1/0,pitch:-1,by:1},R={map:f,shape:w,fitted:x,where:S};for(let M of[Pe,Pe+1,Pe+2,Pe+3,Pe+5,Pe+7]){({map:f,fitted:x}=g(M)),w=s(f);let N=v(x);for(let P=1;P<=3.001;P+=.1){let B=E(y(L(N,P)),!1),te=u(w,x*P),K=(te.maxX-te.minX)*(te.maxY-te.minY);if((B>b.said||B===b.said&&K<b.area)&&(b={said:B,area:K,pitch:M,by:P}),B===e.length)break}}b.pitch<0?{map:f,shape:w,fitted:x,where:S}=R:({map:f,fitted:x}=g(b.pitch),w=s(f),O=b.by,S=L(v(x),O));let A=y(S).filter(M=>o.keep?.includes(M.card.kind));if(A.length>0){let M=A.flatMap(j=>[{x:j.x-j.halfW,y:j.y-j.halfH,width:j.halfW*2,height:j.halfH*2},F(j,d(j.card))]),N=Math.min(...M.map(j=>j.x)),P=Math.max(...M.map(j=>j.x+j.width)),B=Math.min(...M.map(j=>j.y)),te=Math.max(...M.map(j=>j.y+j.height)),K=(j,J,X)=>J-j>X-16?X/2-(j+J)/2:j<8?8-j:J>X-8?X-8-J:0;S={...S,originX:S.originX+K(N,P,n.width),originY:S.originY+K(B,te,n.height)}}}let H=o.zoom&&o.zoom!==1?o.zoom:1;H!==1&&(S=L(S,H));let T=y(S),G=[],V=new Map,Y=new Map,k=[...T].sort((b,R)=>(R.card.weight??R.card.count)-(b.card.weight??b.card.count)||e.indexOf(b.card)-e.indexOf(R.card));for(let b of k){let R=[["full",d(b.card),"under"],["short",d(b.card).short,"under"]],A="none",M=b===k[0],N=(B,te)=>R.filter(([K])=>K.startsWith(te)).map(([K,j,J])=>[K,j,J,B]),P=M?[...N(!1,"full"),...N(!1,"short"),...N(!0,"full"),...N(!0,"short")]:R.map(([B,te,K])=>[B,te,K,!1]);for(let[B,te,K,j]of P){let J=F(b,te,K);if((H!==1||O!==1||J.x>=0&&J.y>=0&&J.x+J.width<=n.width&&J.y+J.height<=n.height)&&!G.some(ie=>Ft(J,ie,4))&&(j||!T.some(ie=>ie!==b&&Lo(J,ie,ie.halfW,ie.halfH)))&&!W(J,b,T)&&!l.some(ie=>Ft(J,ie,0))){A=B,G.push(J),Y.set(b.card.id,J);break}}V.set(b.card.id,A)}let $=T.map(b=>({id:b.card.id,x:b.x-b.halfW,y:b.y-b.halfH,width:b.halfW*2,height:b.halfH*2+(b.card.opened>0?Math.max(b.card.openedMin??0,b.card.opened):0),depth:b.depth,plot:b.plot,nameplate:V.get(b.card.id)??"none"})),q=u(w,S.cell),_={cell:S.cell,originX:S.originX,originY:S.originY,pan:o.pan??{x:0,y:0},extent:{x:S.originX+q.minX,y:S.originY+q.minY,width:q.maxX-q.minX,height:q.maxY-q.minY},openedShare:1,...c!==.5?{tilt:c}:{},...Y.size>0?{nameplates:T.flatMap(b=>{let R=Y.get(b.card.id);return R?[{id:b.card.id,x:R.x-(b.x-b.halfW),y:R.y-(b.y-b.halfH),width:R.width,height:R.height}]:[]})}:{},...T.some(b=>b.card.marquee)?{showings:T.flatMap(b=>{let R=I(b);return R?[{id:b.card.id,x:R.x-(b.x-b.halfW),y:R.y-(b.y-b.halfH),width:R.width,height:R.height}]:[]})}:{}};return{placed:$,frame:_,map:f}}function pt(e){let{width:t,height:n}=e.visible??e,r={x:t*.45,y:n*.45};if(!e.city)return r;let{extent:o}=e.city,a=24;return{x:Math.max(r.x,o.x+o.width-t+a,-o.x+a),y:Math.max(r.y,o.y+o.height-n+a,-o.y+a)}}var Hn=48;function To(e){if(!e.city)return[];let{width:t,height:n}=e.visible??e,r=[];for(let o of e.nodes){if(!o.id.startsWith("kind:")||Math.round(o.plane)!==2)continue;let a=o.x+o.width/2,i=o.y+o.height/2,l=a<0?"left":a>t?"right":i<0?"top":i>n?"bottom":null;if(!l)continue;let c=l==="left"||l==="right",d=c?Math.max(0,Math.min(n,i)):Math.max(0,Math.min(t,a)),s=(g,w)=>g<w/4?w/4-g:g>w*3/4?w*3/4-g:0,u=(g,w)=>g<Hn?Hn-g:g>w-Hn?w-Hn-g:0,h=c?{x:s(a,t),y:u(i,n)}:{x:u(a,t),y:s(i,n)};r.push({id:o.id,kind:o.id.slice(5),side:l,along:d,by:h})}return r}function Po(e,t,n,r,o){return{x:e.x+(n.x-e.x-t.x-r.x)*(1-o),y:e.y+(n.y-e.y-t.y-r.y)*(1-o)}}var ba={rankOf:()=>{},parentOf:()=>{}};function _r(e,t){if(t.size===0)return ba;let n=e.kinds,r=new Map,o=(d,s)=>{d!==s&&((r.get(d)??r.set(d,new Set).get(d)).add(s),(r.get(s)??r.set(s,new Set).get(s)).add(d))};for(let d of n){let s=e.tryDefinition(d);if(s)for(let u of Object.values(s.edges??{})){let h=u.to==="*"?n:u.to;for(let g of h)o(d,g)}}let a=new Map,i=new Map,l=[...t].filter(d=>n.includes(d));for(let d of l)a.set(d,0);let c=0;for(;l.length>0;){c+=1;let d=[];for(let s of[...l].sort((u,h)=>n.indexOf(u)-n.indexOf(h)))for(let u of[...r.get(s)??[]].sort((h,g)=>n.indexOf(h)-n.indexOf(g)))a.has(u)||(a.set(u,c),c===2&&i.set(u,s),d.push(u));l=d}return{rankOf:d=>{let s=a.get(d);if(s!==0)return s===1?"primary":"secondary"},parentOf:d=>i.get(d)}}function Kr(e,t,n,r,o={}){if(n){let a=new Map;for(let i of e.allEdges()){if(r&&i.kind!==r)continue;let l=i.from===n.id?i.to:i.to===n.id?i.from:null;if(l===null||l===n.id)continue;let c=e.getNode(l);if(!c||a.has(l))continue;let d=i.from===n.id?"out":"in",s=d==="out"?n.kind:c.kind,u=wa(t,s,i.kind,d);a.set(l,{node:c,via:{edgeKind:i.kind,direction:d,...u?{description:u}:{}}})}if(a.size>0){let i=l=>`${l.via.edgeKind}|${l.via.description??""}`;return[...a.values()].sort((l,c)=>(i(l)<i(c)?-1:i(l)>i(c)?1:0)||at(l.node,c.node))}}if(n){let a=o[n.id]??[],i=new Set,l=[];for(let c of a){if(c===n.id||i.has(c))continue;let d=e.getNode(c);d&&(r&&r!=="judges"&&d.kind!==r||(i.add(c),l.push({node:d,via:{edgeKind:"judges",direction:"out",description:"what it finds wrong"}})))}if(l.length>0)return l.sort((c,d)=>at(c.node,d.node))}return r?e.allNodes().filter(a=>a.kind===r).sort(at).map(a=>({node:a})):[]}function wa(e,t,n,r){let a=e.tryDefinition(t)?.edges?.[n];return r==="out"?a?.description:a?.inverse}function Ur(e,t,n){let r=new Map,o=[...t.values()].sort((d,s)=>d.plane-s.plane);for(let d of o)for(let s of d.aggregate?.memberIds??[])!t.has(s)&&!r.has(s)&&r.set(s,d.id);let a=d=>t.get(d)??t.get(r.get(d)??""),i=new Map,l=new Map,c=new Map;for(let d of e.allEdges()){let s=a(d.from),u=a(d.to);if(!s||!u||s.id===u.id&&!(n.overview&&s.aggregate&&s.plane===2))continue;let h=`${d.kind}:${s.id}:${u.id}`,g=i.get(h);if(g){let w=`${d.from}
|
|
2
|
-
${d.to}`,f=l.get(h);if(f.has(w))continue;if(f.add(w),c.get(h).push({from:d.from,to:d.to}),g.single){let{single:x,...v}=g;i.set(h,v)}continue}l.set(h,new Set([`${d.from}
|
|
3
|
-
${d.to}`])),c.set(h,[{from:d.from,to:d.to}]),i.set(h,{id:h,kind:d.kind,from:s.id,to:u.id,edges:[{from:d.from,to:d.to}],single:{from:d.from,to:d.to},...s.id===u.id?{loop:!0}:{},x1:s.x+s.width/2,y1:s.y+s.height/2,x2:u.x+u.width/2,y2:u.y+u.height/2})}return[...i.values()].map(d=>({...d,edges:c.get(d.id)})).sort(at)}var qr=.85,Xr=60,Co=160;function va(e,t,n,r,o,a=qr){let i=e*t.width+Math.max(0,e-1)*n,l=Math.max(n,(r-i)/2);return Array.from({length:e},(c,d)=>({x:l+d*(t.width+n),y:o,depth:a}))}function ka(e,t,n,r,o){let a=e*t.width+Math.max(0,e-1)*n,i=Math.max(n,(r-a)/2);return Array.from({length:e},(l,c)=>({x:i+c*(t.width+n),y:o}))}function Dn(e,t,n,r={}){let o={...Wr,...r},a=Math.max(8,o.unit??16)/16,i=o.inset?.left??0,l=n.overview?Math.max(0,o.dock?.right??0):0,c=n.overview?Math.max(0,o.dock?.bottom??0):0,d=o.width-l-i-(o.inset?.right??0),s=[],u=new Map,h=m=>n.past===!0||rr(t.tryDefinition(m.kind),m,o.today),g=new Set(r.hiddenKinds??[]),w=m=>!g.has(m.kind),f=n.focusId?yt(n.focusId).filter(m=>t.tryDefinition(m)!==void 0).filter(m=>!g.has(m)):[];n.focusId&&yt(n.focusId).length>0&&f.length===0&&(n={...n,focusId:null});let x=n.focusId?e.getNode(n.focusId):void 0;x&&!w(x)&&(n={...n,focusId:null},f=[]);let v=f.length>0?[...e.allNodes()].filter(m=>f.includes(m.kind)).sort(at):[],y=v.filter(w).filter(h),E=v.length-y.length,I=n.focusId&&f.length===0?e.getNode(n.focusId):void 0,W=n.zoom===!0&&!n.overview&&n.focusId!==null,F=Math.max(56,o.height*.062),ee=Math.min(o.height*.895,o.height-F),z=W?I!==void 0?{focusY:o.height*.03,focusH:o.height*.58,relationY:o.height*.645,relationH:o.height*.2,contextY:ee,contextH:F}:{focusY:o.height*.03,focusH:o.height*.71,relationY:o.height*.765,relationH:o.height*.1,contextY:ee,contextH:F}:I===void 0?{focusY:o.height*.045,focusH:o.height*.62,relationY:o.height*.68,relationH:o.height*.2,contextY:o.height*.918,contextH:o.height*.082}:(()=>{let m=o.height,D=m*.04,U=Math.max(m*.42,Math.min(m*.56,300)),ne=D+U+m*.06;return{focusY:D,focusH:U,relationY:ne,relationH:Math.max(m*.12,m*.878-m*.068-ne),contextY:m*.878,contextH:m*.092}})(),p=Math.min(o.headroom??0,z.focusY+z.focusH*.2),S=p>z.focusY?{...z,focusY:p,focusH:z.focusH-(p-z.focusY)}:z,L=m=>Math.min(o.gap*m,Math.round(d*.1)),O=W?Math.min(880,d-L(5)):Math.min(700,d-L(6)),H=W?d-L(5):Math.min(o.focusSize.width,d-L(6)),T=(m,D,U)=>({width:m===0?D:Math.min(D,(d-o.gap*(m+1))/m),height:U}),G=(m,D,U)=>{let ne=T(m,D,U),be=Math.min(D,Co*a,d-o.gap*2);return ne.width>=be?ne:{width:be,height:U}},V=m=>Math.max(1,Math.floor((d-o.gap)/(Math.min(m,Co*a,d-o.gap*2)+o.gap))),Y=new Set(n.expanded),k=n.overview?[]:Kr(e,t,I,n.relation,o.judged).filter(m=>w(m.node)).filter(m=>h(m.node)),$=n.overview?0:Math.max(0,Xr*a-S.contextH),q=k.length>0?S.focusH:S.contextY-S.focusY-o.gap*2-$,_=H,b=o.height,R=Math.min(d*.5/_,o.height*.48/b),A=_*R,M=b*R,N=new Set(r.plainGroups??[]),P=n.overview&&!I&&f.length>0&&n.focusId!==null,B=P&&f.length>0&&f.every(m=>N.has(m));if(P)for(let m of f)B&&r.besideTheMap!==!0?Y.add(we(m)):Y.delete(we(m));let te=P&&!B&&f.length===1?f[0]:void 0,K=te!==void 0&&(r.screens?.[te]?.length??0)>0,j,J=n.overview===!0&&I!==void 0&&r.besideTheMap===!0;n.overview&&(I||f.length>0)&&n.focusId&&!B&&!K&&!(P&&r.besideTheMap===!0)&&!J?(j={x:i+(d-A)/2,y:o.height*.53-M/2,width:A,height:M},on({id:n.focusId,kind:I?I.kind:f[0],plane:0,x:j.x,y:j.y,width:A,height:M,natural:{width:_,height:b},...I?{}:{aggregate:{kind:f.join("+"),memberIds:y.map(m=>m.id),label:r.plurals?.[n.focusId]??f.map(m=>Lt(t,m)).join(" and "),...E>0?{retired:E}:{}}}})):n.overview||(I?on({id:I.id,kind:I.kind,plane:0,x:i+(d-O)/2,y:S.focusY,width:O,height:q}):f.length>0&&n.focusId&&on({id:n.focusId,kind:f[0],plane:0,x:i+(d-H)/2,y:S.focusY,width:H,height:q,aggregate:{kind:f.join("+"),memberIds:y.map(m=>m.id),label:r.plurals?.[n.focusId]??f.map(m=>Lt(t,m)).join(" and "),...E>0?{retired:E}:{}}}));let X=26,fe=52,ie=22,ve=Math.round(o.relationSize.width*.75),ke=Math.max(1,Math.floor((d-o.gap)/(ve+o.gap))),$e=o.unit/16,ae=Math.max(2,Math.floor((S.relationH+o.gap)/(X*$e+o.gap))),Se=k.length>ke*ae,ot={schema:t,graph:e,focusId:I?.id,expanded:Y,...o.relevance?{relevance:o.relevance}:{},...n.selection?{selection:n.selection}:{},plural:m=>Lt(t,m),...o.today?{today:o.today}:{}},oe=Se?Math.max(o.gap,ie*$e):o.gap,Ge,Ze;if(!Se)Ge=k.map(m=>({id:m.node.id,kind:m.node.kind,node:m.node,...m.via?{via:m.via}:{}})),Ze=Array.from({length:Math.max(1,Math.ceil(Ge.length/ke))},(m,D)=>Array.from({length:Math.min(ke,Ge.length-D*ke)},(U,ne)=>D*ke+ne));else{let m=Math.max(1,Math.floor((S.relationH+oe)/(fe*$e+oe))),D=new Map;for(let me of k){let Ee=Eo(me),At=D.get(Ee);At?At.push(me):D.set(Ee,[me])}let U=Oo([...D.values()].map(me=>me.length),ke,m),ne=[...D.values()].map((me,Ee)=>Ao(me,{...ot,budget:U[Ee]}));Ge=ne.flat();let be=ne.map((me,Ee)=>ne.slice(0,Ee).reduce((At,no)=>At+no.length,0)),Ue=ne.map(()=>0);Ze=$n(ne.map(me=>me.length),ke).map(me=>me.map(Ee=>be[Ee]+Ue[Ee]++))}let kt=Ze.length,Je=kt===1?S.relationH:(S.relationH-oe*(kt-1))/kt,Ce=T(Math.max(...Ze.map(m=>m.length),1),Ge.length<=2?Math.round(o.relationSize.width*1.35):o.relationSize.width,Je),lt=[];Ze.forEach((m,D)=>{let U=ka(m.length,Ce,o.gap,d,S.relationY+D*(Je+oe));m.forEach((ne,be)=>lt[ne]={...U[be],x:U[be].x+i})}),Ge.forEach((m,D)=>{let U=lt[D];on({id:m.id,kind:m.kind,plane:1,x:U.x,y:U.y,width:Ce.width,height:Ce.height,...m.via?{via:m.via}:{},...m.aggregate?{aggregate:m.aggregate}:{},...Se&&!m.aggregate?{compact:!0}:{}})});let rt=new Set(u.keys());for(let m of y)rt.add(m.id);let je=new Map;for(let m of e.allNodes()){let D=je.get(m.kind);D?D.push(m):je.set(m.kind,[m])}let Ne=new Set(f.length>0?f:I?[I.kind]:[]),We=[];for(let m of t.kinds){if(g.has(m))continue;let D=je.get(m)??[],U=D.filter(h);We.push({id:we(m),kind:m,members:U.sort(at),retired:D.length-U.length,...Ne.has(m)?{focused:!0}:{}})}for(let m of We)m.kind===n.relation&&(m.raised=!0);We.sort(at);let ze=_r(t,Ne),_e=!n.overview&&t.kinds.some(m=>ze.rankOf(m)==="primary"),Ve=[];for(let m of We)if(!n.overview&&Y.has(m.id)&&m.members.length>0)for(let D of m.members)Ve.push({id:D.id,kind:D.kind});else{let D=_e?ze.rankOf(m.kind):void 0,U=D==="secondary"?ze.parentOf(m.kind):void 0;Ve.push({id:m.id,kind:m.kind,...m.raised?{raised:!0}:{},...m.focused?{focused:!0}:{},...n.overview&&Y.has(m.id)?{opened:!0}:{},...D?{rank:D}:{},...U&&!Y.has(we(U))?{nestedUnder:we(U)}:{},aggregate:{kind:m.kind,memberIds:m.members.map(ne=>ne.id),label:r.plurals?.[m.kind]??Lt(t,m.kind),...m.retired>0?{retired:m.retired}:{}}})}let ct=2;if(Ve.length<=V((W?240:o.contextSize.width)*a))for(let m of Ve)delete m.nestedUnder;let ut=new Map;for(let m of Ve){if(m.nestedUnder===void 0)continue;let D=ut.get(m.nestedUnder)??0;D>=ct?delete m.nestedUnder:ut.set(m.nestedUnder,D+1)}let et=Ve.filter(m=>m.nestedUnder!==void 0),re=Ve.filter(m=>m.nestedUnder===void 0),Me=V((W?240:o.contextSize.width)*a),it=!n.overview&&re.length>Me,Mt=Math.max(0,Me-1),ht=m=>m.focused?0:m.raised?1:2,ft=new Set([...re].map((m,D)=>({item:m,at:D})).sort((m,D)=>ht(m.item)-ht(D.item)||m.at-D.at).slice(0,Mt).map(({item:m})=>m.id)),Ie=new Set(it?re.filter(m=>!ft.has(m.id)).map(m=>m.id):[]),nn=et.filter(m=>!Ie.has(m.nestedUnder)),Rn=et.filter(m=>Ie.has(m.nestedUnder)),Rt=it?[...re.filter(m=>ft.has(m.id)),{id:ur,kind:"",beyond:[...re.filter(m=>Ie.has(m.id)),...Rn].map(m=>m.kind)}]:re,Ke=n.overview?{width:Math.min(220,d/6.5),height:Math.min(92,o.height*.125)}:G(Rt.length,(W?240:o.contextSize.width)*a,S.contextH),C=o.relevance?.flagged,he=(m,D)=>{let U=Mo(t,m);if(!U)return{};let ne=U.values.map(()=>0),be=0;for(let Ue of D){let me=U.values.indexOf(e.getNode(Ue)?.[U.field]);me<0?be++:ne[me]++}return{states:{field:U.field,values:[...U.values.map((Ue,me)=>({value:Ue,tier:U.tiers[me],count:ne[me]})),...be>0?[{value:null,tier:"waiting",count:be}]:[]]}}},ce=n.overview?Io(Rt.map(m=>{let D=m.aggregate?.memberIds??[],U=C?D.filter(ne=>C.has(ne)).length:0;return{id:m.id,kind:m.kind,count:D.length,opened:Y.has(m.id)?qt(Xt(D.length))*a:0,openedMin:Y.has(m.id)?qt(Math.min(ko,Xt(D.length)))*a:0,nameplate:zr(m.aggregate?.label??Lt(t,m.kind),D.length,U,Mo(t,m.kind)!==void 0,a),weight:U*1e3+D.length,...f.includes(m.kind)&&(r.screens?.[m.kind]?.length??0)>0?{marquee:{width:bo+12,height:wo(r.screens[m.kind].map(ne=>ne.title),bo,r.nameWidth)+8}}:{}}}),t,{width:o.width-l,height:o.height-c},o.chrome?{...o.inset,right:Math.min(o.inset?.right??0,8)}:o.inset??{},{...o.cityOrder?{order:o.cityOrder}:{},...o.plots?{plots:o.plots}:{},...r.cityZoom&&r.cityZoom!==1?{zoom:r.cityZoom}:{},keep:[...n.selection??[],...n.focusId?[n.focusId]:[]].flatMap(m=>m.startsWith("kind:")?[m.slice(5)]:m.startsWith("aggregate:")&&!m.includes("|")?[m.slice(10)]:J&&m===I?.id?[I.kind]:[]),...r.tilt!==void 0?{tilt:r.tilt}:{},pan:{x:n.pan?.x??0,y:n.pan?.y??0},...j||o.chrome?.length?{avoid:[...j?[j]:[],...o.chrome??[]]}:{}}):null,Re=new Map(ce?.placed.map(m=>[m.id,m.plot])??[]),tt=new Map(ce?.placed.map(m=>[m.id,m.nameplate])??[]),Et=ce?ce.placed.map(({x:m,y:D,depth:U,width:ne,height:be})=>({x:m,y:D,depth:U,width:ne,height:be})):va(Rt.length,Ke,o.gap,d,S.contextY,W?.97:qr).map(m=>({...m,x:m.x+i})),En=.74,Ot=.8,Zn=52*a,Jn=86*a,Yt=(m,D)=>Math.min(1,m+(1-m)*D),eo=new Map;Rt.forEach((m,D)=>{let U=Et[D],ne=U.width??Ke.width,be=U.height??Ke.height,Ue=m.rank==="secondary"?En:1,me=ce?ne:Math.max(Math.min(ne,Co*a),ne*Ue),Ee=ce?be:Math.max(Xr*a,be*Ue);eo.set(m.id,{x:U.x+(ne-me)/2,y:U.y+(be-Ee),depth:m.rank==="secondary"?Yt(U.depth,.5):U.depth,width:me,height:Ee})});let On=[],An=Et[Et.length-1],to=new Map;for(let m of nn)to.set(m.nestedUnder,(to.get(m.nestedUnder)??0)+1);let or=new Map;for(let m of nn){let D=eo.get(m.nestedUnder);if(D){let U=to.get(m.nestedUnder)??1,ne=or.get(m.nestedUnder)??0;or.set(m.nestedUnder,ne+1);let be=.98,Ue=Ke.width*Ot,me=Math.max(Jn,Math.min(Ue,D.width/(be*(U-1)+1))),Ee=Math.max(Zn,Ke.height*Ot*(me/Ue)),At=me*be,no=(U-1)*At+me;On.push({...m,x:D.x+(D.width-no)/2+ne*At,y:Math.max(0,D.y-Ee+Math.min(Ee*.5,16)),width:me,height:Ee,depth:Yt(D.depth,.8)})}else if(An){let U=Ke.width*Ot,ne=Ke.height*Ot;On.push({...m,x:An.x,y:An.y,width:U,height:ne,depth:Yt(An.depth??1,.8)})}}for(let m of Rt)On.push({...m,...eo.get(m.id)});return On.forEach(m=>{on({id:m.id,kind:m.kind,plane:2,x:m.x,y:m.y,width:m.width,height:m.height,...m.aggregate?{aggregate:m.aggregate}:{},...m.raised?{raised:!0}:{},...m.focused?{focused:!0}:{},...m.opened?{opened:!0}:{},...m.opened?{openedRows:Math.max(1,Math.floor((Math.max(qt(Math.min(ko,Xt(m.aggregate?.memberIds.length??0))),qt(Xt(m.aggregate?.memberIds.length??0))*(ce?.frame.openedShare??1))-Ar)/vo))}:{},...m.rank?{rank:m.rank}:{},...m.nestedUnder?{nestedUnder:m.nestedUnder}:{},...m.beyond?{beyond:m.beyond}:{},...Re.has(m.id)?{plot:Re.get(m.id)}:{},...tt.has(m.id)?{nameplate:tt.get(m.id)}:{},...ce&&m.aggregate?he(m.kind,m.aggregate.memberIds):{},depth:m.depth})}),{nodes:s,connectors:Ur(e,u,n),width:o.width,height:o.height,...ce?{city:ce.frame}:{},...l>0||c>0?{visible:{width:o.width-l,height:o.height-c}}:{}};function on(m){let D=n.overview&&Oe(m.id)!==null?void 0:n.pins[m.id],U=D?{...m,x:D.x,y:D.y,pinned:!0}:{...m,pinned:!1},ne=n.pan?{...U,x:U.x+n.pan.x,y:U.y+n.pan.y}:U;s.push(ne),u.set(ne.id,ne)}}function No(e,t,n){let r=e.nodes.find(l=>l.id===t);if(!r||r.screenOf!==void 0)return null;let o={...r,x:n.x,y:n.y,pinned:!0},a=o.x+o.width/2,i=o.y+o.height/2;return{...e,nodes:e.nodes.map(l=>l.id===t?o:l),connectors:e.connectors.map(l=>l.from===t?{...l,x1:a,y1:i}:l.to===t?{...l,x2:a,y2:i}:l)}}function Bo(e,t){return t.x===0&&t.y===0?e:{...e,nodes:e.nodes.map(n=>({...n,x:n.x+t.x,y:n.y+t.y})),connectors:e.connectors.map(n=>({...n,x1:n.x1+t.x,y1:n.y1+t.y,x2:n.x2+t.x,y2:n.y2+t.y})),...e.city?{city:{...e.city,pan:{x:t.x,y:t.y}}}:{}}}var xe=(e,t,n)=>e+(t-e)*n;function Qr(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}var Zr=new WeakMap;function Sa(e){let t=Zr.get(e);if(t)return t;let n=new Map,r=new Map;for(let o of e.nodes){n.set(o.id,o);for(let a of o.aggregate?.memberIds??[]){let i=r.get(a);i?i.push(o):r.set(a,[o])}}return t={byId:n,groupsOf:r},Zr.set(e,t),t}var Jr=new WeakMap;function ei(e,t){let n=Jr.get(t);if(n||Jr.set(t,n=new WeakMap),n.has(e))return n.get(e);let r=Ma(e,t);return n.set(e,r),r}function Ma(e,t){let{byId:n,groupsOf:r}=Sa(t);if(e.screenOf!==void 0){let i=n.get(we(e.screenOf));if(i)return{...e,x:i.x,y:i.y,width:i.width,height:i.height}}if(Tt(e.id)||Oe(e.id)!==null){let i=(e.aggregate?.memberIds??[]).map(s=>n.get(s)).filter(s=>s!==void 0);if(i.length===0)return null;let l=i.map(Qr),c=l.reduce((s,u)=>s+u.x,0)/l.length,d=l.reduce((s,u)=>s+u.y,0)/l.length;return{...e,x:c-e.width/2,y:d-e.height/2}}let o=r.get(e.id)?.find(i=>i.id===we(e.kind)||i.id===Ae(e.kind));if(!o)return null;let a=Qr(o);return{...e,x:a.x-e.width/2,y:a.y-e.height/2}}function jt(e,t,n){let r=Math.max(0,Math.min(1,n)),o=new Map(e.nodes.map(s=>[s.id,s])),a=new Map(t.nodes.map(s=>[s.id,s])),i=[];for(let[s,u]of o){let h=a.get(s);if(h){i.push($o(u,h,r,1));continue}let g=ei(u,t)??u;i.push($o(u,g,r,1-r))}for(let[s,u]of a){if(o.has(s))continue;let h=ei(u,e)??u;i.push($o(h,u,r,r))}let l=new Map(e.connectors.map(s=>[s.id,s])),c=new Map(t.connectors.map(s=>[s.id,s])),d=[];for(let[s,u]of l){let h=c.get(s);d.push(h?{...Ra(u,h,r),opacity:1}:{...u,opacity:1-r})}for(let[s,u]of c)l.has(s)||d.push({...u,opacity:r});return{nodes:i.filter(s=>s.opacity>0).sort((s,u)=>s.id<u.id?-1:s.id>u.id?1:0),connectors:d.filter(s=>s.opacity>0).sort((s,u)=>s.id<u.id?-1:s.id>u.id?1:0),width:xe(e.width,t.width,r),height:xe(e.height,t.height,r),t:r,...ti(e.city,t.city,r)?{city:ti(e.city,t.city,r)}:{}}}function ti(e,t,n){return e?t?{cell:xe(e.cell,t.cell,n),...e.tilt!==void 0||t.tilt!==void 0?{tilt:xe(e.tilt??.5,t.tilt??.5,n)}:{},originX:xe(e.originX,t.originX,n),originY:xe(e.originY,t.originY,n),pan:{x:xe(e.pan.x,t.pan.x,n),y:xe(e.pan.y,t.pan.y,n)},extent:{x:xe(e.extent.x,t.extent.x,n),y:xe(e.extent.y,t.extent.y,n),width:xe(e.extent.width,t.extent.width,n),height:xe(e.extent.height,t.extent.height,n)}}:e:t}function $o(e,t,n,r){return{id:t.id,kind:t.kind,plane:xe(e.plane,t.plane,n),x:xe(e.x,t.x,n),y:xe(e.y,t.y,n),width:xe(e.width,t.width,n),height:xe(e.height,t.height,n),pinned:t.pinned,opacity:r,...t.aggregate?{aggregate:t.aggregate}:{},...t.via?{via:t.via}:{},...t.raised?{raised:!0}:{},...t.focused?{focused:!0}:{},...t.opened?{opened:!0}:{},...t.openedRows!==void 0?{openedRows:t.openedRows}:{},...t.compact?{compact:!0}:{},...t.rank?{rank:t.rank}:{},...t.nestedUnder?{nestedUnder:t.nestedUnder}:{},...t.beyond?{beyond:t.beyond}:{},...t.plot?{plot:t.plot}:{},...t.nameplate?{nameplate:t.nameplate}:{},...t.states?{states:t.states}:{},...t.screenOf?{screenOf:t.screenOf}:{},...t.depth===void 0?{}:{depth:xe(e.depth??1,t.depth,n)},...t.natural?{natural:t.natural}:{}}}function Ra(e,t,n){return{...t,x1:xe(e.x1,t.x1,n),y1:xe(e.y1,t.y1,n),x2:xe(e.x2,t.x2,n),y2:xe(e.y2,t.y2,n)}}function Fn(e){let t=Math.max(0,Math.min(1,e));return t<.5?4*t*t*t:1-(-2*t+2)**3/2}function Ea(e,t){let n=[];for(let o=0;o<e.length;o+=1){let a=e[o],i=e[(o+1)%e.length];if(a.y===i.y)continue;let l=Math.min(a.y,i.y),c=Math.max(a.y,i.y);t<l||t>=c||n.push(a.x+(t-a.y)/(i.y-a.y)*(i.x-a.x))}n.sort((o,a)=>o-a);let r={x0:0,x1:0};for(let o=0;o+1<n.length;o+=2){let a={x0:n[o],x1:n[o+1]};a.x1-a.x0>r.x1-r.x0&&(r=a)}return r}function Oa(e){let t=1/0,n=-1/0;for(let r of e)r.y<t&&(t=r.y),r.y>n&&(n=r.y);return{top:t,bottom:n}}function Aa(e){let t=0;for(let n=0;n<e.length;n+=1){let r=e[n],o=e[(n+1)%e.length];t+=r.x*o.y-o.x*r.y}return Math.abs(t)/2}function La(e){let t=0,n=0,r=0;for(let o=0;o<e.length;o+=1){let a=e[o],i=e[(o+1)%e.length],l=a.x*i.y-i.x*a.y;t+=l,n+=(a.x+i.x)*l,r+=(a.y+i.y)*l}if(Math.abs(t)<1e-9){let o=e.reduce((a,i)=>({x:a.x+i.x,y:a.y+i.y}),{x:0,y:0});return{x:o.x/e.length,y:o.y/e.length}}return{x:n/(3*t),y:r/(3*t)}}function Ia(e,t){let{room:n,height:r,size:o,floor:a,measure:i=xo,lines:l=2}=t,c=(f,x)=>f.every(v=>i(v,x)<=n)&&f.length*x*1.15<=r;if(c([e],o))return{lines:[e],fontSize:o,whole:!0};let d=e.split(/\s+/);if(l>1&&d.length>1){let f=1,x=1/0,v=0;for(let E=0;E<d.length-1;E+=1){v+=d[E].length+1;let I=Math.abs(v-e.length/2);I<x&&(x=I,f=E+1)}let y=[d.slice(0,f).join(" "),d.slice(f).join(" ")];if(c(y,o))return{lines:y,fontSize:o,whole:!0};for(let E=o;E>=a;E-=o*.06)if(c(y,E))return{lines:y,fontSize:E,whole:!0}}for(let f=o;f>=a;f-=o*.06)if(c([e],f))return{lines:[e],fontSize:f,whole:!0};let s=i(e,a)/Math.max(1,e.length),u=Math.floor(n/s)-1;if(u<4||a*1.15>r)return null;let h=e.slice(0,u),g=h.lastIndexOf(" ");return{lines:[`${g>3?h.slice(0,g):h}\u2026`],fontSize:a,whole:!1}}var Ta=(e,t)=>e.x0<t.x1&&t.x0<e.x1&&e.y0<t.y1&&t.y0<e.y1;var Q=se(Te(),1);var xt=se(Te(),1);function ni(e){let[t,n]=(0,xt.useState)(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(e).matches);return(0,xt.useEffect)(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;let r=window.matchMedia(e),o=()=>n(r.matches);return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[e]),t}function Pa(){let e=()=>typeof document>"u"?null:document.documentElement.getAttribute("data-graview-motion"),[t,n]=(0,xt.useState)(e);return(0,xt.useEffect)(()=>{if(typeof document>"u"||typeof MutationObserver>"u")return;let r=new MutationObserver(()=>n(e()));return r.observe(document.documentElement,{attributes:!0,attributeFilter:["data-graview-motion"]}),n(e()),()=>r.disconnect()},[]),t}function oi(e){let t=ni("(prefers-reduced-motion: reduce)"),n=ni("(prefers-reduced-transparency: reduce)"),r=Pa();return kr({off:!e,reducedMotion:r==="reduce"||r!=="full"&&t,reducedTransparency:n})}var Ca=xr*1.5,Na=30;function ri(e,t){let[n,r]=(0,xt.useState)(!1),o=e&&!n;return(0,xt.useEffect)(()=>{if(!o||!t||typeof requestAnimationFrame>"u")return;let a=[],i=0,l=0,c=d=>{if(i>0&&a.push(d-i),i=d,a.length>=Na){if(!Sr(a,Ca)){r(!0);return}a.length=0}l=requestAnimationFrame(c)};return l=requestAnimationFrame(c),()=>cancelAnimationFrame(l)},[o,t]),o}var He=se(Te(),1);var Ba=520;function $a(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function ii(e,t={}){let n=t.duration??Ba,r=(t.enabled??!0)&&!$a(),o=(0,He.useRef)(e),[a,i]=(0,He.useState)(()=>jt(e,e,1)),l=(0,He.useRef)(a),c=(0,He.useRef)(null),d=(0,He.useRef)(null);return(0,He.useEffect)(()=>{if(!r||typeof requestAnimationFrame>"u"){o.current=e;let x=jt(e,e,1);if(l.current=x,i(x),typeof requestAnimationFrame>"u")return;let v=requestAnimationFrame(()=>{let y=jt(e,e,1);l.current=y,i(y)});return()=>cancelAnimationFrame(v)}let s=performance.now(),h=d.current!==null&&l.current.t<1&&s-d.current<n?d.current:s;d.current=h;let g=Fn(Math.min(1,(s-h)/n)),w=o.current,f=x=>{let v=Math.min(1,(x-h)/n),y=g>=1?1:(Fn(v)-g)/(1-g),E=jt(w,e,Math.max(0,y));l.current=E,i(E),v<1?c.current=requestAnimationFrame(f):(d.current=null,o.current=e,c.current=requestAnimationFrame(()=>{let I=jt(e,e,1);l.current=I,i(I),c.current=null}))};return c.current=requestAnimationFrame(f),()=>{c.current!==null&&cancelAnimationFrame(c.current);let x=l.current;o.current={...e,...x.city?{city:x.city}:{},nodes:x.nodes.map(v=>({...v,plane:Math.round(v.plane)})),connectors:x.connectors}}},[e,n,r]),a}function ai(e=1100){let{store:t}=pe(),[n,r]=(0,He.useState)(()=>new Set);return(0,He.useEffect)(()=>{let o=null,a=t.subscribe(i=>{r(new Set(i.touched)),o&&clearTimeout(o),o=setTimeout(()=>r(new Set),e)});return()=>{a(),o&&clearTimeout(o)}},[t,e]),n}var Ha={marks:new Map,acts:[]};function si(e=4e3){let{store:t}=pe(),[n,r]=(0,He.useState)(Ha);return(0,He.useEffect)(()=>{let o=null,a=t.subscribe((i,l)=>{r(c=>{let d=new Map(c.marks),s=[...c.acts];for(let u of l){if(u.undoes!==void 0){let w=s.find(x=>x.batch===u.undoes||x.wrote.length>0),f=s.filter(x=>u.writes.some(v=>x.wrote.includes(v)));for(let x of f.length>0?f:w?[w]:[]){for(let v of x.wrote)d.delete(v);s=s.filter(v=>v.batch!==x.batch)}continue}if(u.author.kind!=="agent")continue;let h=u.author.id??"the seat";for(let w of u.writes)d.set(w,h);s.find(w=>w.batch===u.batch)?s=s.map(w=>w.batch===u.batch?{...w,wrote:[...new Set([...w.wrote,...u.writes])]}:w):s=[{batch:u.batch,who:h,intent:u.batchIntent??u.intent,at:u.at,wrote:[...u.writes]},...s].slice(0,12)}return d.size===c.marks.size&&s===c.acts&&d.size===0?c:{marks:d,acts:s}}),o&&clearTimeout(o),o=setTimeout(()=>r(c=>c.marks.size===0?c:{...c,marks:new Map}),e)});return()=>{a(),o&&clearTimeout(o)}},[t,e]),n}var Wt=se(Le(),1),Xe=16;function di({marks:e,questions:t=[],whereIs:n,stageRef:r,width:o,height:a}){if(e.size===0&&t.length===0)return null;let i=r.current,l=i?.getBoundingClientRect()??null,c=[];for(let[s,u]of e){let h=null;if(i&&l&&typeof CSS<"u"){let x=i.querySelector(`[data-graview-pick="${CSS.escape(s)}"]`)?.getBoundingClientRect();x&&x.width>0&&x.height>0&&(h={x:x.left-l.left,y:x.top-l.top,width:x.width,height:x.height})}if(h??=n(s),!h)continue;let g=Math.min(Math.max(h.x+h.width-Xe/2,Xe/2),o-Xe/2),w=Math.min(Math.max(h.y-Xe/4,Xe/2),a-Xe/2);c.push({id:s,who:u,x:g,y:w})}let d=[];for(let s of t){let u=n(s.id);u&&d.push({...s,x:Math.min(Math.max(u.x+u.width/2,Xe),o-Xe),y:Math.min(Math.max(u.y-Xe/2,Xe),a-Xe)})}return c.length===0&&d.length===0?null:(0,Wt.jsxs)("div",{className:"graview-seat-marks","data-testid":"seat-marks","data-graview-seat-marks":c.length,children:[c.map(({id:s,who:u,x:h,y:g})=>(0,Wt.jsx)("span",{className:"graview-seat-mark","data-testid":"seat-mark","data-graview-seat-mark":s,"data-graview-seat-who":u,title:`${u} just changed this`,"aria-hidden":"true",style:{left:h,top:g,"--graview-hue":sn(u)},children:"\u25C6"},s)),d.map(s=>(0,Wt.jsxs)("span",{className:"graview-seat-asking","data-testid":"seat-question","data-graview-seat-asking":s.id,title:s.asks,style:{left:s.x,top:s.y},children:[(0,Wt.jsx)("span",{"aria-hidden":"true",children:"?"}),(0,Wt.jsx)("span",{className:"graview-seat-asking-said",children:s.asks})]},`asking:${s.id}`))]})}var Z=se(Le(),1);function Da({hue:e,mode:t}){let n=t==="docked";return(0,Z.jsxs)("svg",{viewBox:"0 0 32 38","aria-hidden":"true",children:[(0,Z.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round",strokeLinecap:"round",children:[(0,Z.jsx)("line",{x1:"16",y1:"3.5",x2:"16",y2:"7"}),(0,Z.jsx)("circle",{cx:"16",cy:"2.6",r:"1.5",fill:"none"}),(0,Z.jsx)("path",{d:"M8 16 V12.5 C8 8.5 11.5 7 16 7 C20.5 7 24 8.5 24 12.5 V16 Z",fill:"currentColor",fillOpacity:"0.1"}),t==="refused"?(0,Z.jsx)("line",{x1:"11",y1:"12.5",x2:"21",y2:"12.5",strokeWidth:"2"}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)("rect",{x:"10.2",y:"10.2",width:"11.6",height:"4.6",rx:"2.3",fill:"currentColor",fillOpacity:"0.14",strokeWidth:"1"}),(0,Z.jsx)("circle",{cx:"13.4",cy:"12.5",r:"1.25",fill:"currentColor",stroke:"none",opacity:n?.45:1}),(0,Z.jsx)("circle",{cx:"18.6",cy:"12.5",r:"1.25",fill:"currentColor",stroke:"none",opacity:n?.45:1}),t==="reading"?(0,Z.jsx)("line",{x1:"10.2",y1:"12.5",x2:"21.8",y2:"12.5",strokeWidth:"0.8",opacity:"0.7"}):null]}),(0,Z.jsx)("line",{x1:"16",y1:"16",x2:"16",y2:"18.5"}),(0,Z.jsx)("polygon",{points:"16,18.5 24,22.5 16,26.5 8,22.5",fill:"currentColor",fillOpacity:"0.22"}),(0,Z.jsx)("polygon",{points:"8,22.5 16,26.5 16,33.5 8,29.5",fill:"currentColor",fillOpacity:"0.08"}),(0,Z.jsx)("polygon",{points:"24,22.5 16,26.5 16,33.5 24,29.5",fill:"currentColor",fillOpacity:"0.3"}),t==="writing"?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)("polyline",{points:"24,24 28.5,20.5"}),(0,Z.jsx)("line",{x1:"27.5",y1:"19",x2:"30",y2:"21.5",strokeWidth:"1.8"})]}):(0,Z.jsx)("line",{x1:"24",y1:"24",x2:"26.5",y2:"29"}),(0,Z.jsx)("line",{x1:"8",y1:"24",x2:"5.5",y2:"29"}),(0,Z.jsx)("path",{d:"M9.5 33.5 v2.2 h4"}),(0,Z.jsx)("path",{d:"M22.5 33.5 v2.2 h-4"})]}),(0,Z.jsx)("title",{children:`robot, ${t}`})]})}function Fa({hue:e}){return(0,Z.jsxs)("svg",{viewBox:"0 0 22 24","aria-hidden":"true",style:{color:`hsl(${Math.round(e)} 50% 48%)`},children:[(0,Z.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round",strokeLinecap:"round",children:[(0,Z.jsx)("circle",{cx:"11",cy:"6",r:"4.2"}),(0,Z.jsx)("path",{d:"M3 23 C3 15.5 6 13 11 13 C16 13 19 15.5 19 23"})]}),(0,Z.jsx)("title",{children:"somebody"})]})}function li({width:e,whereIs:t}){let{who:n,following:r,follow:o}=pe(),a=Tr([...n.values()],t,e);return a.length===0?null:(0,Z.jsx)("div",{className:"graview-occupants","data-testid":"occupants","data-graview-occupants":a.length,children:a.map((i,l)=>{if(i.kind==="over")return(0,Z.jsx)("div",{className:"graview-presence-over","data-testid":"presence-over","data-graview-over-by":i.presence.participant,style:{left:i.box.x-3,top:i.box.y-3,width:i.box.width+6,height:i.box.height+6,"--graview-hue":i.presence.hue}},`over:${i.presence.participant}`);if(i.kind==="count")return(0,Z.jsxs)("span",{className:"graview-figure-count","data-testid":"presence-count","data-graview-at":i.at,style:{left:i.point.x,top:i.point.y},title:`${i.n} more here`,children:["+",i.n]},`count:${i.at}:${l}`);let c=i.presence.hue,d=dr(i.presence)||"somebody";if(i.kind==="edge")return(0,Z.jsxs)("button",{type:"button",className:"graview-figure-edge","data-testid":"presence-edge","data-graview-person":i.presence.participant,style:{right:`calc(${Math.max(8,e-i.point.x)}px + var(--graview-dock, 0px))`,top:i.point.y},onClick:()=>o(i.presence.participant),"aria-label":`${d} is somewhere else \u2014 press to go where they are`,children:["\u2192 ",d]},`edge:${i.presence.participant}`);if(i.kind==="robot")return(0,Z.jsxs)("div",{className:"graview-figure","data-graview-figure":`theirs:${i.presence.participant}`,"data-graview-theirs":"","data-graview-mode":i.mode,"data-graview-at":i.presence.robot?.at??"",style:{transform:`translate(${i.point.x.toFixed(1)}px, ${i.point.y.toFixed(1)}px)`,"--graview-hue":c},children:[(0,Z.jsx)("span",{className:"graview-figure-body",role:"img","aria-label":`${d}'s agent \u2014 ${i.mode}`,style:{cursor:"default"},children:(0,Z.jsx)(Da,{hue:c,mode:i.mode})}),(0,Z.jsxs)("span",{className:"graview-figure-name",children:[d,"'s agent"]})]},`robot:${i.presence.participant}`);let s=r?.participant===i.presence.participant;return(0,Z.jsxs)("div",{className:"graview-figure","data-graview-figure":i.presence.participant,"data-graview-person":"","data-graview-at":i.at,"data-graview-audience":i.audience?"":void 0,"data-graview-followed":s?"":void 0,style:{transform:`translate(${i.point.x.toFixed(1)}px, ${i.point.y.toFixed(1)}px)`,"--graview-hue":c},children:[(0,Z.jsx)("button",{type:"button",className:"graview-figure-body","aria-label":`${d} is here${s?". Press to stop following":". Press to go where they go"}`,"aria-pressed":s,onClick:u=>{u.stopPropagation(),o(s?null:i.presence.participant)},onPointerDown:u=>u.stopPropagation(),children:(0,Z.jsx)(Fa,{hue:c})}),(0,Z.jsx)("span",{className:"graview-figure-name",children:d})]},`person:${i.presence.participant}`)})})}var Wn=se(Te(),1),bn=se(Le(),1),ci={left:"\u2190",right:"\u2192",top:"\u2191",bottom:"\u2193"},Ho=36,xn=56;function ui({result:e,schema:t,chrome:n=[],onGo:r}){let o=To(e);if(o.length===0)return null;let a=s=>(s??[]).flatMap(u=>{let h=e.nodes.find(g=>g.id===u.id);return h?[{left:h.x+u.x,top:h.y+u.y,right:h.x+u.x+u.width,bottom:h.y+u.y+u.height}]:[]}),i=a(e.city?.showings),l=a(e.city?.nameplates),c=[...i,...l,...n.map(s=>({left:s.x,top:s.y,right:s.x+s.width,bottom:s.y+s.height}))],d=[];for(let s of["left","right","top","bottom"]){let u=e.visible??e,h=s==="left"||s==="right"?u.height:u.width,g=s==="left"||s==="right",w=s==="bottom"?Va:s==="top"?xn:Ya+xn/2,f=-1/0,x=[],v=o.filter(y=>y.side===s).sort((y,E)=>y.along-E.along);for(let y of v){let E=an(t,y.kind),I=ja(E),W=g?jn:I/2,F=h-w-(g?0:W),ee=Math.max(xn,y.along,f+W+Wa);if(ee>F)continue;let{at:z,inset:p}=Ga([...c,...x],s,ee,I,u,h);if(z>F+.5)continue;f=z+W,x.push(hi(s,z,I,u,p));let S=s==="left"?{left:p,top:z,transform:"translateY(-50%)"}:s==="right"?{right:`calc(${p}px + var(--graview-dock, 0px))`,top:z,transform:"translateY(-50%)"}:s==="top"?{top:p,left:z,transform:"translateX(-50%)"}:{bottom:`calc(${p}px + var(--graview-scene-foot, var(--graview-sheet, 0px)))`,left:z,transform:"translateX(-50%)"};d.push((0,bn.jsx)("button",{type:"button",className:"graview-edge-sign","data-graview-past-edge":y.id,"aria-label":`${E}, past the ${s} edge \u2014 bring it into view`,title:`${E} is past the ${s} edge`,tabIndex:-1,onPointerDown:L=>L.stopPropagation(),onClick:L=>{L.stopPropagation(),r(y.by)},style:{...za,...S},children:s==="right"||s==="bottom"?`${E} ${ci[s]}`:`${ci[s]} ${E}`},y.id))}}return(0,bn.jsx)(bn.Fragment,{children:d})}var ja=e=>(e.length+2)*7.4+22,jn=Ho/2,pn=6,Wa=6,Va=236,Ya=56;function hi(e,t,n,r,o=pn){return e==="left"||e==="right"?{left:e==="left"?o:r.width-o-n,right:e==="left"?o+n:r.width-o,top:t-jn,bottom:t+jn}:{left:t-n/2,right:t+n/2,top:e==="top"?o:r.height-o-Ho,bottom:e==="top"?o+Ho:r.height-o}}function Ga(e,t,n,r,o,a){let i=t==="left"||t==="right",l=f=>hi(t,f,r,o),c=f=>e.find(x=>{let v=l(f);return v.left<x.right&&x.left<v.right&&v.top<x.bottom&&x.top<v.bottom}),d=c(n);if(!d)return{at:n,inset:pn};let s=i?jn:r/2,u=f=>{let x=n;for(let v=0;v<12;v++){let y=c(x);if(!y)return x;if(x=f>0?(i?y.bottom:y.right)+s+4:(i?y.top:y.left)-s-4,x>a-xn||x<xn)return null}return null},h=u(1);if(h!==null)return{at:h,inset:pn};let g=u(-1);if(g!==null)return{at:g,inset:pn};let w=t==="left"?d.right:t==="right"?o.width-d.left:t==="top"?d.bottom:o.height-d.top;return{at:n,inset:Math.max(pn,w+4)}}var za={position:"absolute",zIndex:Be.lines,minHeight:28,maxWidth:"40%",padding:"3px 10px",font:"inherit",fontSize:"0.75rem",letterSpacing:"0.04em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--graview-ink)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:6,boxShadow:"0 2px 8px rgb(0 0 0 / 0.12)",cursor:"pointer"};function fi(e){let[t,n]=(0,Wn.useState)(null);return(0,Wn.useLayoutEffect)(()=>{let r=e.current,o=null;for(let l=r?.parentElement??null,c=0;l&&!o&&c<4;l=l.parentElement,c++)o=l.querySelector(":scope > [data-graview-scene-trail]");if(!r||!o)return;let a=()=>{let l=r.getBoundingClientRect(),c=o.getBoundingClientRect(),d=c.width>0&&c.height>0?{x:c.left-l.left,y:c.top-l.top,width:c.width,height:c.height}:null;n(s=>s===d||s&&d&&s.x===d.x&&s.y===d.y&&s.width===d.width&&s.height===d.height?s:d)};if(a(),typeof ResizeObserver>"u")return;let i=new ResizeObserver(a);return i.observe(o),()=>i.disconnect()},[e]),t}var bt=se(Te(),1),_a=180;function mi({view:e,result:t,frame:n,panned:r,closer:o,screenId:a,setCamera:i}){let l=(0,bt.useRef)(new Map),c=Math.round((t.nodes.find(u=>u.id===a)?.height??0)/16),d=(0,bt.useRef)(e.overview??!1),s=(0,bt.useRef)(null);if((0,bt.useEffect)(()=>{if(!e.overview||!a||!t.city){if(d.current&&!e.overview)return;i(F=>F.x===0&&F.y===0?F:{x:0,y:0});return}let u=t.nodes.find(F=>F.id===a);if(!u)return;let h=o>1&&u.screenOf?t.nodes.find(F=>F.id===we(u.screenOf)):void 0,g=h?{x:Math.min(u.x,h.x),y:Math.min(u.y,h.y),width:Math.max(u.x+u.width,h.x+h.width)-Math.min(u.x,h.x),height:Math.max(u.y+u.height,h.y+h.height)-Math.min(u.y,h.y)}:u;if(g.x>=0&&g.y>=0&&g.x+g.width<=t.width&&g.y+g.height<=t.height&&!h)return;let f=24,x=(F,ee,z)=>F<f?f-F:F+ee>z-f?z-f-(F+ee):0,v=pt(t),y=e.pan??{x:0,y:0},E=h?r.x+(t.width/2-(g.x+g.width/2)):r.x+x(g.x,g.width,t.width),I=t.height/2-(g.y+g.height/2),W=h?r.y+(u.y+I<f?f-u.y:I):r.y+x(g.y,g.height,t.height);i({x:(h?E:Math.max(-v.x,Math.min(v.x,E)))-y.x,y:(h?W:Math.max(-v.y,Math.min(v.y,W)))-y.y})},[a,e.overview,o,e.within?.view,c]),n.city){let u=new Map;for(let h of n.nodes){if(!h.plot||Math.round(h.plane)!==2)continue;let g=Zt(h.plot.col+h.plot.side/2,h.plot.row+h.plot.side/2,n.city.cell,n.city.tilt);u.set(h.id,{x:n.city.originX+r.x+g.x,y:n.city.originY+r.y+g.y})}l.current=u}return(0,bt.useEffect)(()=>{let u=e.overview??!1,h=d.current&&!u;if(d.current=u,u&&s.current&&(clearTimeout(s.current),s.current=null),!h)return;let g=e.focusId?yt(e.focusId)[0]:void 0,w=g?l.current.get(we(g)):void 0,f=t.nodes.find(x=>x.id===e.focusId);if(!w||!f){i({x:0,y:0});return}i({x:w.x-(f.x+f.width/2),y:w.y-(f.y+f.height/2)}),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{s.current=null,i({x:0,y:0})},_a)},[e.overview]),(0,bt.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]),{gliding:()=>s.current!==null}}var Yn=se(Te(),1),Vn="[data-graview-view]";function Ka(e,t){let n=null;for(let r=e?.closest(Vn)??null;r&&t.contains(r);r=r.parentElement?.closest(Vn)??null)n=r;return n}function yi(e,t){let n=e.getBoundingClientRect();return{left:n.left,top:n.top,right:n.right-t.right,bottom:n.bottom-t.bottom,box:n}}function gi(e,t,n){let r=(0,Yn.useRef)({dock:t,reveal:n});r.current={dock:t,reveal:n},(0,Yn.useEffect)(()=>{let o=e.current;if(!o)return;let a=c=>{let{dock:d}=r.current;if(c.key!=="Tab"||c.defaultPrevented||d.right<=0&&d.bottom<=0)return;let s=yi(o,d),u=[];for(let h of o.querySelectorAll(Vn)){if(h.parentElement?.closest(Vn)||h.inert||h.contains(document.activeElement))continue;let g=h.getBoundingClientRect(),w=Math.max(g.left,s.box.left),f=Math.min(g.right,s.box.right),x=Math.max(g.top,s.box.top),v=Math.min(g.bottom,s.box.bottom);f<=w||v<=x||!(d.right>0&&w>=s.right-1||d.bottom>0&&x>=s.bottom-1)||(h.inert=!0,u.push(h))}u.length!==0&&setTimeout(()=>{for(let h of u)h.inert=!1},0)},i=c=>{let d=c.target,s=Ka(d,o);if(!s)return;let u=!0;try{u=d?.matches(":focus-visible")??!0}catch{}requestAnimationFrame(()=>{for(let h=s.parentElement;h;h=h===o?null:h.parentElement)h.scrollTop!==0&&(h.scrollTop=0),h.scrollLeft!==0&&(h.scrollLeft=0);u&&s.isConnected&&l(s)})},l=c=>{let d=yi(o,r.current.dock),s=c.getBoundingClientRect(),u=12,h=(f,x,v,y)=>y-v>x-f-2*u||v<f+u?f+u-v:y>x-u?x-u-y:0,g=h(d.left,d.right,s.left,s.right),w=h(d.top,d.bottom,s.top,s.bottom);(Math.abs(g)>=1||Math.abs(w)>=1)&&r.current.reveal(Math.round(g),Math.round(w))};return document.addEventListener("keydown",a,!0),o.addEventListener("focusin",i),()=>{document.removeEventListener("keydown",a,!0),o.removeEventListener("focusin",i)}},[e])}var de=se(Te(),1);function pi(){let e=(0,de.useRef)(null),[t,n]=(0,de.useState)({right:0,bottom:0});return(0,de.useLayoutEffect)(()=>{let r=e.current;if(!r)return;let o=()=>{let i=r.getBoundingClientRect(),l={right:Math.round(i.width),bottom:Math.round(i.height)};n(c=>c.right===l.right&&c.bottom===l.bottom?c:l)};if(o(),typeof ResizeObserver>"u")return;let a=new ResizeObserver(o);return a.observe(r),()=>a.disconnect()},[]),{probe:e,dock:t}}function xi(){let[e,t]=(0,de.useState)(null),n=(0,de.useRef)(null),r=(0,de.useRef)(0),o=(0,de.useCallback)(i=>{n.current=i,r.current===0&&(r.current=requestAnimationFrame(()=>{r.current=0,t(n.current)}))},[]),a=(0,de.useCallback)(()=>{r.current!==0&&cancelAnimationFrame(r.current),r.current=0;let i=n.current;return n.current=null,i&&t(null),i},[]);return{held:e,place:o,release:a}}function bi({stage:e,pan:t,setView:n,settled:r}){let o=(0,de.useRef)({x:0,y:0}),a=(0,de.useRef)(0),i=(0,de.useRef)(!1),l=(0,de.useRef)(r);l.current=r;let c=(0,de.useCallback)(()=>[...e.current?.querySelectorAll("[data-graview-world]")??[]],[e]),d=(0,de.useCallback)(()=>{a.current===0&&(a.current=requestAnimationFrame(()=>{a.current=0;let{x:w,y:f}=o.current,x=w===0&&f===0?"":`translate3d(${w}px, ${f}px, 0)`;for(let v of c())v.style.transform=x}))},[c]),s=(0,de.useCallback)(()=>{i.current=!1;for(let w of c())w.style.transform="";l.current()},[c]),u=(0,de.useCallback)((w,f)=>{o.current={x:w.x-f.x,y:w.y-f.y},d()},[d]),h=(0,de.useCallback)(()=>{let{x:w,y:f}=o.current;return w===0&&f===0?!1:(o.current={x:0,y:0},i.current=!0,n(x=>{let v=x.pan??{x:0,y:0};return Ht(x,{x:v.x+w,y:v.y+f})}),window.setTimeout(()=>{i.current&&s()},300),!0)},[n,s]);(0,de.useLayoutEffect)(()=>{i.current&&s()},[t,s]);let g=(0,de.useCallback)(()=>o.current,[]);return{shiftTo:u,settle:h,settling:i,offset:g}}var Ua=4;function wi({view:e,panned:t,limit:n,panWithin:r,moveByTransform:o,setView:a,setDragging:i,noteMoved:l,shift:c,district:d}){let s=(0,de.useRef)(!1),u=(0,de.useRef)(null),h=v=>{let y=e.pan??{x:0,y:0};u.current={kind:"pan",fromX:v.clientX,fromY:v.clientY,baseX:y.x,baseY:y.y,moved:!1}};return{onGroundDown:v=>{v.button===0&&(v.target.closest("[data-graview-view]")||h(v))},onCardDown:(v,y)=>{if(y.button===0){if(v.screenOf!==void 0&&!y.target.closest("[data-graview-grip]")){h(y);return}if(e.overview&&Oe(v.id)!==null){h(y);return}u.current={kind:"card",id:v.id,fromX:y.clientX,fromY:y.clientY,baseX:v.x-t.x,baseY:v.y-t.y,moved:!1}}},onDragMove:v=>{let y=u.current;if(!y)return;let E=v.clientX-y.fromX,I=v.clientY-y.fromY;if(!y.moved){if(Math.hypot(E,I)<Ua)return;y.moved=!0,i(!0),v.currentTarget.setPointerCapture(v.pointerId)}if(y.kind==="pan"){let W=r(n(),{x:y.baseX+E,y:y.baseY+I});o?c.shiftTo(W,e.pan??{x:0,y:0}):a(F=>Ht(F,W))}else y.id&&d.place({id:y.id,x:y.baseX+E,y:y.baseY+I})},onDragUp:()=>{c.settle();let v=d.release();v&&a(y=>mn(y,v.id,{x:v.x,y:v.y})),u.current?.moved&&(s.current=!0,setTimeout(()=>s.current=!1,0),l()),u.current=null,!c.settling.current&&i(!1)},swallow:s}}function vi({stage:e,view:t,setView:n}){let r=(0,de.useRef)({view:t,charge:0,coolUntil:0,lastScale:1});r.current.view=t;let o=(0,de.useRef)(()=>{}),a=(0,de.useRef)(()=>{});return(0,de.useEffect)(()=>{let i=e.current;if(!i)return;let l=(u,h)=>{let g=r.current;if(h<g.coolUntil)return;let w=g.view.overview??!1;u!==w&&(g.coolUntil=h+600,g.charge=0,n(dn(g.view,u)))},c=u=>{let h=r.current,g=h.view.overview??!1;if(u.ctrlKey){if(u.preventDefault(),!g){if(h.charge+=u.deltaY,Math.abs(h.charge)<60)return;h.charge>0?l(!0,performance.now()):h.charge=0;return}o.current(Math.exp(-u.deltaY*.004),u.clientX,u.clientY);return}!g||u.target?.closest("[data-graview-view], .graview-scroll, [data-graview-overlay], .graview-zoom")||(u.preventDefault(),a.current(-u.deltaX,-u.deltaY))},d=u=>{u.preventDefault(),r.current.lastScale=1},s=u=>{u.preventDefault();let h=r.current,g=u.scale??1;if(!(h.view.overview??!1)){g<.72&&l(!0,performance.now());return}let w=g/(h.lastScale||1);h.lastScale=g;let f=u;o.current(w,f.clientX,f.clientY)};return i.addEventListener("wheel",c,{passive:!1}),i.addEventListener("gesturestart",d),i.addEventListener("gesturechange",s),()=>{i.removeEventListener("wheel",c),i.removeEventListener("gesturestart",d),i.removeEventListener("gesturechange",s)}},[n,e]),{zoomAbout:o,panBy:a}}var ki={directed:"You",autonomous:"An agent","co-edited":"You and an agent",rule:"A rule"};function Do(e,t){let n=new Set(e.map(o=>o.id)),r=new Set;for(let o of t){if(n.has(o)){r.add(o);continue}let a=e.find(i=>i.aggregate?.memberIds.includes(o));a&&r.add(a.id)}return r}function Fo(e){return e.emphasized?e.stressed?.95:.08:e.anyChosen?e.mine?.9:.12:e.touches?Math.max(.34,.9-.09*Math.max(0,(e.siblings??1)-1)):.12}function jo(e){return e.edgeChosen?.9:e.lit?.78:e.own*(e.anyLit?e.kit.dim:e.kit.rest)}function nt(e,t){if(!e)return null;let n=Math.max(0,Math.min(2,Math.floor(e.plane))),r=Math.max(0,Math.min(2,Math.ceil(e.plane))),{scale:o}=n===r?Kt(n,t):mr(Kt(n,t),Kt(r,t),e.plane-n);return{x:e.x,y:e.y,width:e.width*o,height:e.height*o}}function Jt(e,t){if(typeof getComputedStyle>"u"||getComputedStyle(e).visibility==="hidden")return null;let n=-1/0,r=-1/0,o=1/0,a=1/0,i=e.getBoundingClientRect();n=Math.max(n,i.left),r=Math.max(r,i.top),o=Math.min(o,i.right),a=Math.min(a,i.bottom);let l=e.parentElement;for(;l&&l!==t;){let d=getComputedStyle(l);if(d.overflowX!=="visible"||d.overflowY!=="visible"){let s=l.getBoundingClientRect();d.overflowX!=="visible"&&(n=Math.max(n,s.left),o=Math.min(o,s.right)),d.overflowY!=="visible"&&(r=Math.max(r,s.top),a=Math.min(a,s.bottom))}l=l.parentElement}if(o-n<=2||a-r<=2)return null;let c=t.getBoundingClientRect();return{x:n-c.left,y:r-c.top,width:o-n,height:a-r}}function De(e,t,n,r=!1){if(!e||typeof document>"u")return null;let o=e.querySelector(`[data-graview-view="${CSS.escape(t)}"]`);if(!o)return null;let a=(n?o.querySelector(".graview-kind-block"):null)??o.querySelector('[data-graview-primitive="panel"], .graview-kind-face, .graview-kind-card')??(r?null:o.querySelector(':scope > [data-graview-primitive="chip"]'))??o;return Jt(a,e)}function Gn(e,t,n,r,o){let a=d=>e.nodes.find(s=>s.id===d);if(o.startsWith("screen:")){let d=e.nodes.find(s=>s.id===we(o.slice(7)));return d?De(t,d.id,!0)??nt(d,n):null}let i=a(o),l=Oe(o);if(!i&&l!==null&&(i=a(Ae(l))),!i&&Tt(o)){let[d]=yt(o);d&&(i=a(we(d)))}if(!i){let d=r.places().find(s=>s.as===o);d&&(i=a(Ae(d.kind))??a(we(d.kind)))}if(i||(i=[...e.nodes].filter(d=>d.aggregate?.memberIds.includes(o)).sort((d,s)=>d.plane-s.plane)[0]),!i)return null;let c=e.city!==void 0;return De(t,i.id,c&&i.aggregate!==void 0&&Math.round(i.plane)===2)??nt(i,n)}var st=se(Te(),1);var le=se(Le(),1);function Mi({kinds:e}){let{store:t}=pe(),{view:n,go:r}=mo(),o=(0,st.useRef)(null),a=go("districts",{align:"start"}),i=a.open,l=h=>an(t.schema,h),c=h=>t.graph.allNodes().filter(g=>g.kind===h).length,d=h=>!n.overview&&n.focusId===Ae(h),s=e.filter(h=>!d(h)),u=h=>{a.setOpen(!1);let g=o.current?.querySelector(".graview-beyond-more")??null;d(h)||r(mt(n,Ae(h))),g?.focus({preventScroll:!0});let w=`[data-graview-view="${Ae(h)}"][tabindex], [data-graview-view="${we(h)}"][tabindex]`,f=40,x=()=>{let v=document.querySelector(w);v?v.focus({preventScroll:!0}):--f>0&&requestAnimationFrame(x)};requestAnimationFrame(x)};return(0,le.jsxs)("div",{ref:o,className:"graview-beyond","data-graview-beyond":e.length,"data-graview-beyond-open":i?"":void 0,children:[(0,le.jsxs)("button",{type:"button",className:"graview-beyond-more","data-testid":"beyond-more",...a.trigger,"aria-haspopup":"menu",title:`${s.length} more district${s.length===1?"":"s"} \u2014 press to see them`,onPointerDown:h=>h.stopPropagation(),onClick:h=>{h.stopPropagation(),a.toggle()},children:[(0,le.jsxs)("span",{className:"graview-beyond-count",children:["+",s.length]}),(0,le.jsx)("span",{className:"graview-beyond-word",children:"more"}),(0,le.jsx)("span",{className:"graview-beyond-chevron","aria-hidden":"true",children:i?"\u25BE":"\u25B4"})]}),i?(0,le.jsx)("ul",{...a.pane,className:"graview-beyond-list",role:"menu","aria-label":"The other districts","data-testid":"beyond-list",style:yo,onPointerDown:h=>h.stopPropagation(),children:e.map(h=>(0,le.jsx)("li",{role:"none",children:(0,le.jsxs)("button",{type:"button",role:"menuitem","data-graview-pick":we(h),"aria-current":d(h)?"location":void 0,title:d(h)?`${l(h)} \u2014 where you are`:`Go to ${l(h)}`,onPointerDown:g=>g.stopPropagation(),onClick:g=>{g.stopPropagation(),u(h)},children:[(0,le.jsx)("span",{className:"graview-beyond-name",children:l(h)}),(0,le.jsx)("span",{className:"graview-beyond-tally",children:d(h)?"here":c(h)})]})},h))}):null]})}function Xa(e,t){if(e===t)return!0;let n=Object.keys(e);return n.length!==Object.keys(t).length?!1:n.every(r=>r==="x"||r==="y"||Vo(e[r],t[r]))}function Vo(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null||Array.isArray(e)!==Array.isArray(t)||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==Array.prototype)return!1;if(Array.isArray(e)){let o=t;if(e.length!==o.length)return!1;for(let a=0;a<e.length;a++)if(!Vo(e[a],o[a]))return!1;return!0}let r=Object.keys(e);return r.length!==Object.keys(t).length?!1:r.every(o=>Vo(e[o],t[o]))}var Ri=(0,st.memo)(Ei,(e,t)=>e.mode===t.mode&&e.selected===t.selected&&e.fidelity===t.fidelity&&Xa(e.node,t.node));function Ei({node:e,mode:t,selected:n,fidelity:r}){let{store:o,views:a,view:i}=pe(),l=Ct(),c=Ir(),d=Lr(),s=e.aggregate||Tt(e.id)||Oe(e.id)!==null?"many":"one",u={cardinality:s,fidelity:r??fr[Qa(e.plane)].fidelity},h=s==="many"&&e.id===i.focusId?i.within?.view:void 0,g=a.resolve(e.kind,u,h),w=g?.view,f=a.resolve(e.kind,{cardinality:"many",fidelity:"full"})?.view,x=f!==void 0&&f.generic!==!0,v=e.aggregate?.memberIds,y=(0,st.useMemo)(()=>(v??[]).map(W=>o.graph.getNode(W)).filter(W=>W!==void 0),[v,o,l]),E={...e.aggregate?{nodes:y,label:g?.title??e.aggregate.label}:{node:o.graph.getNode(e.id)},fidelity:u.fidelity,cardinality:u.cardinality,mode:t,selected:n,implicated:c,flagged:d,...e.raised?{raised:!0}:{},...e.focused?{focused:!0}:{},...e.opened?{opened:!0}:{},...e.openedRows!==void 0?{openedRows:e.openedRows}:{},...e.plot?{plot:e.plot}:{},...e.nameplate?{nameplate:e.nameplate}:{},...e.states?{states:e.states}:{},...e.aggregate?.retired?{retired:e.aggregate.retired}:{},...e.rank?{rank:e.rank}:{},...e.nestedUnder?{nestedUnder:e.nestedUnder}:{},...x?{hasOwnView:!0}:{}};if(!w)return(0,le.jsx)(Za,{node:e,props:E});let I=[e.id,g?.title??"",u.fidelity,u.cardinality,t,n,e.raised??!1,e.focused??!1,e.opened??!1,e.openedRows??"",e.rank??"",e.nestedUnder??"",e.plot?`${e.plot.col},${e.plot.row},${e.plot.side}`:"",e.nameplate??"",e.states?e.states.values.map(W=>W.count).join(","):"",e.aggregate?Wo(e.aggregate.memberIds):"",e.aggregate?.retired??"",c?Wo(c):"",d?Wo(d):"",x].join("|");return(0,le.jsx)(uo,{mode:t,children:(0,le.jsx)(Pr,{kind:E.label??e.kind,...g?.title?{view:g.title}:{},children:(0,le.jsx)(qa,{signature:I,graph:l,draw:()=>(0,le.jsx)(w,{...E})})},`${e.id}|${g?.title??""}`)})}var qa=(0,st.memo)(function({draw:t}){return(0,le.jsx)(le.Fragment,{children:t()})},(e,t)=>e.signature===t.signature&&e.graph===t.graph);function Qa(e){return Math.max(0,Math.min(2,Math.round(e)))}function Za({node:e,props:t}){return(0,le.jsxs)("div",{style:{padding:8,font:"13px/1.4 system-ui",overflow:"hidden"},children:[(0,le.jsx)("strong",{children:t.label??e.kind}),t.nodes?(0,le.jsxs)("div",{children:[t.nodes.length," items"]}):(0,le.jsx)("div",{children:e.id})]})}var Oi=(0,st.memo)(function({node:t}){let{store:n}=pe(),r=Pt(),o=t.aggregate,a=o.opens,i=o.memberIds.length,l=Gt(n.schema,o.kind,i),c=o.memberIds.slice(0,3).map(h=>{let g=n.graph.getNode(h),w=g?n.schema.tryDefinition(g.kind):void 0;return g?w?.label?w.label(g):String(g.label??h):h}),d=o.memberIds,s=(0,st.useMemo)(()=>{let h=r?Pn(r):null;return h?d.filter(g=>h.has(g)).length:0},[r,d]),u=a.in==="picture";return(0,le.jsxs)("div",{className:"graview-band-group","data-graview-band":a.in,"data-graview-band-count":i,"data-graview-emphasis":r?s>0?"lit":"dimmed":void 0,title:u?`${o.label} \u2014 press twice to see them all, arranged`:`${o.label}: ${l} \u2014 press twice to open`,children:[(0,le.jsxs)("span",{className:"graview-band-group-head",children:[(0,le.jsx)("span",{className:"graview-band-group-name",children:o.label}),(0,le.jsx)("span",{className:"graview-band-group-open","aria-hidden":"true",children:u?"\u2197":"\u25BE"})]}),(0,le.jsxs)("span",{className:"graview-band-group-names",children:[u?null:(0,le.jsxs)("span",{className:"graview-band-group-count",children:[l,s>0?` \xB7 ${s} match`:""," \xB7 "]}),c.join(" \xB7 "),i>c.length?" \u2026":""]})]})}),Si=new WeakMap;function Wo(e){let t=Si.get(e);if(t!==void 0)return t;let n=2166136261;for(let o of e){for(let a=0;a<o.length;a++)n=Math.imul(n^o.charCodeAt(a),16777619);n=Math.imul(n^44,16777619)}let r=`${e.length}:${(n>>>0).toString(36)}`;return Si.set(e,r),r}var wt=se(Te(),1);function Yo(e,t,n){let r=e.aggregate?[...e.aggregate.memberIds]:[e.id];return n?r.every(a=>t.includes(a))?t.filter(a=>!r.includes(a)):[...t,...r.filter(a=>!t.includes(a))]:r}function Ai(){let[e,t]=(0,wt.useState)(16);return(0,wt.useEffect)(()=>{if(typeof window>"u")return;let n=document.documentElement,r=()=>{let a=parseFloat(getComputedStyle(n).fontSize);Number.isFinite(a)&&t(i=>Math.abs(i-a)<.5?i:a)};r();let o=new MutationObserver(r);return o.observe(n,{attributes:!0,attributeFilter:["style"]}),window.addEventListener("resize",r),()=>{o.disconnect(),window.removeEventListener("resize",r)}},[]),e}function Li(e){let[t,n]=(0,wt.useState)(null);return(0,wt.useLayoutEffect)(()=>{let r=e.current?.getBoundingClientRect();!r||r.width===0||r.height===0||n(o=>o??{width:Math.round(r.width),height:Math.round(r.height)})},[e]),(0,wt.useEffect)(()=>{let r=e.current;if(!r||typeof ResizeObserver>"u")return;let o=l=>{!l||l.width===0||l.height===0||n(c=>{let d={width:Math.round(l.width),height:Math.round(l.height)};return c&&c.width===d.width&&c.height===d.height?c:d})},a=new ResizeObserver(l=>o(l[0]?.contentRect)),i=()=>o(r.getBoundingClientRect());return a.observe(r),addEventListener("resize",i),()=>{a.disconnect(),removeEventListener("resize",i)}},[e]),t}function Go(e,t){if(t==="dark")return`0 ${(10*e).toFixed(1)}px ${(34*e).toFixed(1)}px rgba(0,0,0,${(e+.12).toFixed(2)})`;let n=`0 ${(1+2*e).toFixed(1)}px ${(2+5*e).toFixed(1)}px rgba(20,30,32,${(.03+.06*e).toFixed(3)})`,r=`0 ${(6+26*e).toFixed(1)}px ${(18+60*e).toFixed(1)}px -${(10+10*e).toFixed(1)}px rgba(20,30,32,${(.1+.3*e).toFixed(3)})`;return`${n}, ${r}`}function Ii(e){return`matrix3d(${e.join(",")})`}var ye=se(Te(),1);var zo=(e,t)=>t.some(n=>e.x>n.x&&e.x<n.x+n.width&&e.y>n.y&&e.y<n.y+n.height);function _o(e,t){let n=[],r=[];for(let a=0;a<e.length-1;a++){let i=e[a],l=e[a+1],c=!zo(i,t);c&&r.length===0&&r.push(i);for(let d=1;d<=48;d++){let s=d/48,u={x:i.x+(l.x-i.x)*s,y:i.y+(l.y-i.y)*s},h=!zo(u,t);if(h===c)continue;let g=(d-1)/48,w=s;for(let v=0;v<10;v++){let y=(g+w)/2,E={x:i.x+(l.x-i.x)*y,y:i.y+(l.y-i.y)*y};!zo(E,t)===c?g=y:w=y}let f=(g+w)/2,x={x:i.x+(l.x-i.x)*f,y:i.y+(l.y-i.y)*f};h?r=[x]:(r.push(x),r.length>=2&&n.push(r),r=[]),c=h}c&&r.push(l)}return r.length>=2&&n.push(r),n}function wn(e,t){let n=Math.abs(t.x-e.x);if(Math.abs(t.y-e.y)>n){if(n<2)return[e,t];let a=(e.y+t.y)/2;return[e,{x:e.x,y:a},{x:t.x,y:a},t]}let o=(e.x+t.x)/2;return Math.abs(t.x-e.x)<2?[e,t]:[e,{x:o,y:e.y},{x:o,y:t.y},t]}var Ye=e=>Math.round(e*100)/100,vt=e=>e.map(t=>t.map((n,r)=>`${r===0?"M":"L"} ${Ye(n.x)} ${Ye(n.y)}`).join(" ")).join(" ");function Ko(e,t){if(e.length<3)return vt([e]);let n=[`M ${Ye(e[0].x)} ${Ye(e[0].y)}`];for(let o=1;o<e.length-1;o++){let a=e[o-1],i=e[o],l=e[o+1],c=Math.hypot(i.x-a.x,i.y-a.y),d=Math.hypot(l.x-i.x,l.y-i.y),s=Math.min(t,c/2,d/2),u={x:i.x+(a.x-i.x)/(c||1)*s,y:i.y+(a.y-i.y)/(c||1)*s},h={x:i.x+(l.x-i.x)/(d||1)*s,y:i.y+(l.y-i.y)/(d||1)*s};n.push(`L ${Ye(u.x)} ${Ye(u.y)} Q ${Ye(i.x)} ${Ye(i.y)} ${Ye(h.x)} ${Ye(h.y)}`)}let r=e[e.length-1];return n.push(`L ${Ye(r.x)} ${Ye(r.y)}`),n.join(" ")}function Ti(e,t){return t==="orthogonal"?vt([e]):Ko(e,10)}function Pi(e,t,n){if(e==="orthogonal"){let l=wn(t.p0,t.p1),c=l.slice(1).map((u,h)=>Math.hypot(u.x-l[h].x,u.y-l[h].y)),d=c.reduce((u,h)=>u+h,0)||1,s=n*d;for(let u=0;u<c.length;u++){let h=c[u];if(s<=h||u===c.length-1){let g=h===0?0:Math.min(1,s/h),w=l[u],f=l[u+1];return{x:w.x+(f.x-w.x)*g,y:w.y+(f.y-w.y)*g}}s-=h}return t.p1}let r=e==="straight"?{x:(t.p0.x+t.p1.x)/2,y:(t.p0.y+t.p1.y)/2}:t.c,o=(1-n)*(1-n),a=2*(1-n)*n,i=n*n;return{x:o*t.p0.x+a*r.x+i*t.p1.x,y:o*t.p0.y+a*r.y+i*t.p1.y}}function zn(e,t){return e!=="straight"?t:{...t,c:{x:(t.p0.x+t.p1.x)/2,y:(t.p0.y+t.p1.y)/2}}}function Ci(e,t){let n=t.x-e.x,r=t.y-e.y,o=(n/2+r)/2,a=(r-n/2)/2;if(Math.abs(o)<1||Math.abs(a)<1)return[e,t];let i={x:e.x+2*o,y:e.y+o};return[e,i,t]}function Ni(e){let t=[...e].sort((r,o)=>r.y-o.y||r.x-o.x),n=[];for(let r of t){let o=n.find(a=>r.y<a.bottom+3&&r.y+r.height>a.top-3);o?(o.boxes.push(r),o.top=Math.min(o.top,r.y),o.bottom=Math.max(o.bottom,r.y+r.height)):n.push({top:r.y,bottom:r.y+r.height,boxes:[r]})}for(let r of n)r.boxes.sort((o,a)=>o.x-a.x);return n.sort((r,o)=>r.top-o.top)}var vn=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Xo=(e,t)=>e.findIndex(n=>n.boxes.some(r=>vn(r,t)));function Bi(e,t,n){return t<0?e[0].top-12*2:n>=e.length?e[e.length-1].bottom+12*2:(e[t].bottom+e[n].top)/2}function Qo(e,t){let n=[{from:-1/0,to:1/0}];for(let a of e){let i=[],l=-1/0;for(let d of a.boxes)i.push({from:l,to:d.x-12}),l=Math.max(l,d.x+d.width+12);i.push({from:l,to:1/0});let c=[];for(let d of n)for(let s of i){let u=Math.max(d.from,s.from),h=Math.min(d.to,s.to);h-u>=0&&c.push({from:u,to:h})}n=c}let r=t,o=1/0;for(let a of n){let i=Math.min(Math.max(t,a.from),a.to),l=a.from===-1/0||a.to===1/0,c=Math.abs(i-t)+(l?60:0);c<o&&(o=c,r=i)}return r}var qe=e=>({x:e.x,y:-(e.y+e.height),width:e.width,height:e.height}),_n=e=>e.map(t=>({x:t.x,y:-t.y}));function qo(e){let t=(r,o)=>Math.abs(r-o)<.5,n=e.filter((r,o)=>o===0||!(t(r.x,e[o-1].x)&&t(r.y,e[o-1].y)));return n.filter((r,o)=>{let a=n[o-1],i=n[o+1];return!a||!i||!(t(a.x,r.x)&&t(r.x,i.x)||t(a.y,r.y)&&t(r.y,i.y))})}function Zo(e,t,n){let r=e.boxes.filter(d=>!vn(d,t)&&d.y+d.height<=t.y+1&&d.x<t.x+t.width&&d.x+d.width>t.x),o=[{from:t.x+6,to:t.x+t.width-6}];for(let d of r)o=o.flatMap(s=>[{from:s.from,to:Math.min(s.to,d.x-12/2)},{from:Math.max(s.from,d.x+d.width+12/2),to:s.to}]).filter(s=>s.to>=s.from);let a=null;for(let d of o){let s=Math.min(Math.max(n,d.from),d.to);(a===null||Math.abs(s-n)<Math.abs(a-n))&&(a=s)}if(a!==null)return{x:a,tail:[{x:a,y:t.y}]};let i=n<t.x+t.width/2,l=Qo([e],i?t.x-12:t.x+t.width+12),c=t.y+t.height/2;return{x:l,tail:[{x:l,y:c},{x:l<t.x?t.x:t.x+t.width,y:c}]}}function Uo(e,t,n){let r=Zo({top:-e.bottom,bottom:-e.top,boxes:e.boxes.map(qe)},qe(t),n);return{x:r.x,head:_n(r.tail).reverse()}}function $i(e,t,n,r){let o=t;for(;o>r&&!e[o-1].boxes.some(a=>n>a.x-12/2&&n<a.x+a.width+12/2);)o--;return o}var Hi=(e,t)=>(e%3-1)*Math.max(0,Math.min(4,t/2-3));function Di(e,t,n,r,o,a,i,l){let c=f=>f<0?e[0].top-n:e[f+1].top-e[f].bottom,d=f=>(f<0?(n+e[0].top)/2:Bi(e,f,f+1))+Hi(l,c(f)),s=Zo(e[a],o,i),u=$i(e,a,s.x,t+1),h=d(t);if(u===t+1)return qo([...r.head,{x:r.x,y:h},{x:s.x,y:h},...s.tail]);let g=Qo(e.slice(t+1,u),s.x),w=d(u-1);return qo([...r.head,{x:r.x,y:h},{x:g,y:h},{x:g,y:w},{x:s.x,y:w},...s.tail])}function en(e,t,n,r=0){let o=Ni(n.some(s=>vn(s,e))&&n.some(s=>vn(s,t))?n:[...n,e,t]),a=Xo(o,e),i=Xo(o,t),l=e.x+e.width/2,c=t.x+t.width/2;if(a===i){if(!(a<o.length-1||o.length===1))return _n(en(qe(e),qe(t),n.map(qe),r));let u=Bi(o,a,a+1)+Hi(r,a<o.length-1?o[a+1].top-o[a].bottom:2*12),h=Uo(o[a],e,c),g=Uo(o[a],t,l);return qo([...h.head,{x:h.x,y:u},{x:g.x,y:u},...[...g.head].reverse()])}if(i<a)return _n(en(qe(e),qe(t),n.map(qe),r));let d=Uo(o[a],e,c);return Di(o,a,o[a].bottom,d,t,i,l,r)}function Jo(e,t,n,r=0){if(t.y+t.height<=e.y){let g=Jo(qe(e),qe(t),n.map(qe),r);return g?_n(g):null}let o=e.y+e.height;if(t.y<o)return null;let a=Ni([...n.filter(g=>g.y>=o&&!vn(g,t)),t]),i=Xo(a,t),l=t.x+t.width/2,c=Zo(a[i],t,l),d=$i(a,i,c.x,0),s=d===0?c.x:Qo(a.slice(0,d),c.x),u=Math.min(12,e.width/2),h=Math.min(Math.max(s,e.x+u),e.x+e.width-u);return Di(a,-1,o,{x:h,head:[{x:h,y:o}]},t,i,l,r)}function Fi(e,t=16){let n=new Map;for(let o of e){let a=o.a<o.b?`${o.a}\0${o.b}`:`${o.b}\0${o.a}`,i=n.get(a);i?i.push(o.key):n.set(a,[o.key])}let r=new Map;for(let o of n.values())o.forEach((a,i)=>r.set(a,(i-(o.length-1)/2)*t));return r}var Fe=se(Le(),1);function Un(e,t){let n=Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x),r=Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y);if(n>0&&r>0)return null;let o=n>.5*Math.min(e.width,t.width),a=!o&&r>.5*Math.min(e.height,t.height);if(o){let w={x:e.x+e.width,y:e.y+e.height/2},f={x:t.x+t.width,y:t.y+t.height/2};return{from:w,to:f,control:{x:Math.max(w.x,f.x)+18,y:(w.y+f.y)/2},mode:"stacked"}}if(a){let w={x:e.x+e.width/2,y:e.y},f={x:t.x+t.width/2,y:t.y};return{from:w,to:f,control:{x:(w.x+f.x)/2,y:Math.min(w.y,f.y)-18},mode:"abreast"}}let i={x:t.x+t.width/2,y:t.y+t.height/2},l={x:e.x+e.width/2,y:e.y+e.height/2},c=Kn(e,i),d=Kn(t,l),s=Math.hypot(d.x-c.x,d.y-c.y);if(s<8)return null;let u=Math.min(36,s*.12),h=-(d.y-c.y)/s,g=(d.x-c.x)/s;return{from:c,to:d,control:{x:(c.x+d.x)/2+h*u,y:(c.y+d.y)/2+g*u},mode:"direct"}}function Kn(e,t){let n=e.x+e.width/2,r=e.y+e.height/2,o=t.x-n,a=t.y-r;if(o===0&&a===0)return{x:n,y:r};let i=o===0?1/0:e.width/2/Math.abs(o),l=a===0?1/0:e.height/2/Math.abs(a),c=Math.min(i,l),d=Math.max(0,c*.98);return{x:n+o*d,y:r+a*d}}function Ja(e,t,n){let r=t.get(e.from),o=t.get(e.to);if(!r||!o)return!1;if(n)return!0;let a=Math.round(r.plane)===1||Math.round(o.plane)===1,i=l=>!!l.aggregate&&Math.round(l.plane)===2;return a&&!i(r)&&!i(o)}var es=()=>({clips:new Map,members:new Map,marks:new Map});function Wi(e,t){let n=t.marks.get(e);if(n)return n;n=new Map;for(let r of e.querySelectorAll("[data-graview-pick], [data-graview-slot]"))for(let o of new Set([r.getAttribute("data-graview-pick"),r.getAttribute("data-graview-slot")])){if(o===null)continue;let a=n.get(o);a?a.push(r):n.set(o,[r])}return t.marks.set(e,n),n}function ts(e,t){let n=t.clips.get(e);if(n===void 0){let r=getComputedStyle(e);n=r.overflow!=="visible"||r.overflowX!=="visible"||r.overflowY!=="visible"?e.getBoundingClientRect():null,t.clips.set(e,n)}return n}function ns(e,t,n){let r=e.parentElement;for(;r!==null;){let o=ts(r,n);if(o&&!(t.right>o.left+1&&t.left<o.right-1&&t.bottom>o.top+1&&t.top<o.bottom-1))return!1;if(r.hasAttribute("data-graview-view"))break;r=r.parentElement}return!0}function kn(e,t,n,r){if(!e||!t||typeof document>"u")return[];let o=r.members.get(t);o||r.members.set(t,o=new Map);let a=o.get(n);if(a)return a;let i=e.getBoundingClientRect(),l=[];for(let c of Wi(t,r).get(n)??[]){if(c.closest("[data-graview-offstage]"))continue;let d=c.getBoundingClientRect();d.width<=2||d.height<=2||ns(c,d,r)&&l.push({x:d.left-i.left,y:d.top-i.top,width:d.width,height:d.height})}return l.sort((c,d)=>c.width*c.height-d.width*d.height),o.set(n,l),l}function Xn(e,t,n,r,o){let a=new Map(e.map(y=>[y.id,y])),i=es(),l=new Map,c=y=>{if(!n||typeof document>"u")return null;let E=l.get(y);return E===void 0&&(E=n.querySelector(`[data-graview-view="${CSS.escape(y)}"]`),l.set(y,E)),E},d=new Map;for(let y of e){let E=De(n,y.id,r)??nt(y,o);E&&d.set(y.id,E)}let s=new Map;if(n&&typeof document<"u"){let y=n.getBoundingClientRect();for(let E of n.querySelectorAll("[data-graview-pick], [data-graview-slot]")){if(E.closest("[data-graview-offstage]"))continue;let I=E.getAttribute("data-graview-pick")??E.getAttribute("data-graview-slot");if(I===null)continue;let W=E.getBoundingClientRect();if(W.width<=2||W.height<=2||W.width>y.width*.6&&W.height>y.height*.6)continue;let F=s.get(I),ee={x:W.left-y.left,y:W.top-y.top,width:W.width,height:W.height};F?F.push(ee):s.set(I,[ee])}}let u=(y,E)=>{let I=[];for(let[W,F]of d)W!==y&&W!==E&&I.push(F);for(let[W,F]of s)W!==y&&W!==E&&I.push(...F);return I},h=y=>Math.round(a.get(y)?.plane??-1)===1,g=[];for(let y of e){let E=d.get(y.id);E&&Math.round(y.plane)===1&&g.push(E)}if(!r&&n&&typeof document<"u"){let y=n.getBoundingClientRect();for(let E of n.querySelectorAll("[data-graview-relation] > span")){let I=E.getBoundingClientRect();I.width>0&&I.height>0&&g.push({x:I.left-y.left,y:I.top-y.top,width:I.width,height:I.height})}}let w=(y,E)=>!r&&h(y)&&h(E)?g:void 0,f=r?void 0:e.find(y=>Math.round(y.plane)===0&&!y.aggregate),x=(y,E,I,W)=>{if(!f)return{};let F=y.to===f.id&&I===f.id;if(!F&&!(y.from===f.id&&E===f.id))return{};let ee=F?y.from:y.to,z=d.get(f.id),p=d.get(ee);if(ee===f.id||!h(ee)||!z||!p)return{};let S=c(f.id),L=T=>S!==null&&Wi(S,i).get(T)?.some(G=>!G.closest("[data-graview-offstage]"))===!0,O=W.map(T=>T.from===f.id?T.to:T.from),H=O.length>0&&O.every(L);return{band:g,tie:{card:z,chip:p,cardIsTo:F,toward:ee,holds:a.get(ee)?.aggregate?.memberIds??[ee]},...H?{said:O}:{}}},v=[];for(let y of t){if(!Ja(y,a,r))continue;let E=d.get(y.from),I=d.get(y.to);if(!E||!I)continue;let W=u(y.from,y.to),F=y.edges,ee=r&&F.some(S=>S.from!==y.from&&kn(n,c(y.from),S.from,i).length>0||S.to!==y.to&&kn(n,c(y.to),S.to,i).length>0),z=w(y.from,y.to);if(r&&!ee||y.loop||F.length===0){v.push({key:y.id,connector:y,edges:F,fromBox:E,toBox:I,fromAnchor:y.from,toAnchor:y.to,obstacles:W,hosts:[],...z?{band:z}:{},...x(y,y.from,y.to,F)});continue}let p=new Map;for(let S of F){let L=S.from===y.from?[]:kn(n,c(y.from),S.from,i),O=S.to===y.to?[]:kn(n,c(y.to),S.to,i),H=[y.from,y.to].find(A=>Math.round(a.get(A)?.plane??-1)===0);if(!r&&H!==void 0&&(H===y.from?S.from!==y.from:S.to!==y.to)&&kn(n,c(H),H===y.from?S.to:S.from,i).length>0)continue;let T=H!==void 0?a.get(H):void 0;if(!r&&T?.aggregate&&n&&(H===y.from?S.from!==y.from&&L.length===0:S.to!==y.to&&O.length===0))continue;let G=L.length>0?S.from:y.from,V=O.length>0?S.to:y.to,Y=`${y.id}|${G}|${V}`,k=p.get(Y);if(k){k.edges.push(S);continue}let $=L.length>0?L:[E],q=O.length>0?O:[I],_=$[0],b=q[0],R=1/0;for(let A of $)for(let M of q){let N=Math.hypot(A.x+A.width/2-(M.x+M.width/2),A.y+A.height/2-(M.y+M.height/2));N<R&&(R=N,_=A,b=M)}p.set(Y,{edges:[S],fromBox:_,toBox:b,fromAnchor:G,toAnchor:V})}for(let[S,L]of p)v.push({key:S,connector:y,obstacles:W,hosts:[...L.fromAnchor!==y.from?[E]:[],...L.toAnchor!==y.to?[I]:[]],...z?{band:z}:{},...L,...x(y,L.fromAnchor,L.toAnchor,L.edges)})}return v}function Vi(e,t,n){let r=new Map(t.map(i=>[i.id,i])),o=new Map;for(let i of n){let l=r.get(i.id);l&&(l.x!==i.x||l.y!==i.y)&&o.set(i.id,{x:i.x-l.x,y:i.y-l.y})}if(o.size===0)return[...e];let a=(i,l)=>{let c=o.get(l);return c?{...i,x:i.x+c.x,y:i.y+c.y}:i};return e.map(i=>{let{from:l,to:c}=i.connector;if(!o.has(l)&&!o.has(c))return i;let d=a(i.fromBox,l),s=a(i.toBox,c),u=i.tie&&{...i.tie,card:a(i.tie.card,i.tie.cardIsTo?c:l),chip:a(i.tie.chip,i.tie.toward)},h=g=>g===i.fromBox?d:g===i.toBox?s:i.tie&&g===i.tie.chip?u.chip:g;return{...i,fromBox:d,toBox:s,...u?{tie:u}:{},...i.band?{band:i.band.map(h)}:{}}})}function er(e,t){let n=(1-t)*(1-t),r=2*(1-t)*t,o=t*t;return{x:n*e.p0.x+r*e.c.x+o*e.p1.x,y:n*e.p0.y+r*e.c.y+o*e.p1.y}}function ji(e,t,n){let r=(1-t)*(1-n),o=(1-t)*n+t*(1-n),a=t*n;return{p0:er(e,t),c:{x:r*e.p0.x+o*e.c.x+a*e.p1.x,y:r*e.p0.y+o*e.c.y+a*e.p1.y},p1:er(e,n)}}function Sn(e,t){let n=d=>t.some(s=>d.x>s.x&&d.x<s.x+s.width&&d.y>s.y&&d.y<s.y+s.height),r=d=>!n(er(e,d)),a=(d,s,u)=>{for(let h=0;h<10;h++){let g=(d+s)/2;r(g)===u?d=g:s=g}return(d+s)/2},i=[],l=null,c=r(0);c&&(l=0);for(let d=1;d<=64;d++){let s=d/64,u=r(s);if(u===c)continue;let h=a((d-1)/64,s,c);u?l=h:l!==null&&(h-l>.001&&i.push(ji(e,l,h)),l=null),c=u}return l!==null&&1-l>.001&&i.push(ji(e,l,1)),i}function Yi({strands:e,result:t,scheme:n,overview:r,selection:o,emphasis:a,stageRef:i,liveOf:l,onPickEdge:c,provisional:d,pointed:s=null}){let u=Bt(),h=new Set(t.nodes.filter(p=>p.plot!==void 0&&Math.round(p.plane)===2).map(p=>p.id)),g=p=>r&&t.city!==void 0&&h.has(p.from)&&h.has(p.to),w=Do(t.nodes,o),f=p=>w.size===0||w.has(p.from)||w.has(p.to),x=new Set(o.filter(p=>It(p)===null)),v=r?t.nodes.find(p=>Math.round(p.plane)===0):void 0,y=v?De(i.current,v.id,!1)??nt(v,n):null;if(e.length===0)return null;let E=p=>p.edges.some(S=>x.has(S.from)||x.has(S.to)),I=x.size>0&&e.some(E),W=new Map;for(let p of e)W.set(p.connector.id,(W.get(p.connector.id)??0)+1);let F=Fi(e.map(p=>({key:p.key,a:p.fromAnchor,b:p.toAnchor}))),ee=new Set,z=e.map((p,S)=>{let{connector:L,fromBox:O,toBox:H}=p,T={x:O.x+O.width/2,y:O.y+O.height/2},G={x:H.x+H.width/2,y:H.y+H.height/2},V=r?Kn(O,G):T,Y=r?Kn(H,T):G,k=L.loop===!0,{connector:$,style:q}=Qt(u,L.kind);if(!$.visible)return null;let _=k?Math.max(22,Math.min(O.width,O.height)*.3):0,b=k?{x:T.x+O.width*.22,y:T.y-O.height/2-_+7}:V,R=(V.x+Y.x)/2,A=(V.y+Y.y)/2,M=Math.hypot(Y.x-V.x,Y.y-V.y),N=Math.min(r?40:90,M*(r?.09:.16)),P=0,B=0;if(M>0){P=-(Y.y-V.y)/M,B=(Y.x-V.x)/M;let re=R-t.width/2,Me=A-t.height/2;if(y&&!k){let it=y.x+y.width/2,Mt=y.y+y.height/2;re=R-it,Me=A-Mt;let ht=Math.abs(P*(it-V.x)+B*(Mt-V.y)),ft=Math.hypot(y.width/2,y.height/2)*.85+24,Ie=((it-V.x)*(Y.x-V.x)+(Mt-V.y)*(Y.y-V.y))/(M*M);ht<ft&&Ie>.1&&Ie<.9&&(N=Math.min(180,Math.max(N,(ft-ht)*2)))}P*re+B*Me<0&&(P=-P,B=-B)}N+=2*(F.get(p.key)??0);let te=zn($.route,{p0:V,c:{x:R+P*N,y:A+B*N},p1:Y}),K=g(L),j=$.route==="orthogonal"||K,J=(re,Me)=>K?Ci(re,Me):wn(re,Me),X=!k&&p.tie?Jo(p.tie.card,p.tie.chip,p.band??[],S):null,fe=X?p.tie.cardIsTo?X.reverse():X:!k&&p.band?en(O,H,p.band,S):null,ie=k||j||fe?[]:Sn(te,[O,H,...p.obstacles]),ve=fe?[fe]:!k&&j?_o(J(V,Y),[O,H,...p.obstacles]):[];if(!k&&ie.length===0&&ve.length===0)return null;let ke=ve[ve.length-1],$e=j||fe?ve[0]?.[0]:ie[0]?.p0,ae=j||fe?ke?.[ke.length-1]:ie[ie.length-1]?.p1,Se=re=>re.map(Me=>`M ${Me.p0.x} ${Me.p0.y} Q ${Me.c.x} ${Me.c.y} ${Me.p1.x} ${Me.p1.y}`).join(" "),ot=`M ${b.x-_} ${b.y} A ${_} ${_} 0 1 1 ${b.x+_} ${b.y} A ${_} ${_} 0 0 1 ${b.x-_} ${b.y}`,oe=k?ot:fe?Ti(fe,$.route):j?vt(ve):Se(ie),Ge=re=>({x:re.x-8,y:re.y-8,width:re.width+16,height:re.height+16}),Ze=[O,H,...p.hosts,...p.obstacles].map(Ge),kt=k?ot:fe?vt(ve):j?vt(_o(J(V,Y),Ze)):Se(Sn(te,Ze)),Je=p.edges.length===1?p.edges[0]:null,Ce=Je?$t(L.kind,Je.from,Je.to):null,lt=Ce!==null&&o.includes(Ce),rt=Ce!==null?d?.get(Ce):void 0,je=p.edges.some(re=>x.has(re.from)||x.has(re.to)),Ne=p.tie?.toward??"",We=p.tie!==void 0&&(s!==null&&(Ne===s||p.tie.holds.includes(s)||p.said?.includes(s)===!0)||x.has(Ne))&&!ee.has(Ne);We&&ee.add(Ne);let ze=!r&&x.size>0&&je||We,_e=a!==null&&L.kind===a||lt,Ve=l?.(L)!==void 0;if(r&&!Ve||!r&&!Ve&&x.size>0&&!je&&!_e&&!We||p.said!==void 0&&!We&&!p.said.some(re=>x.has(re))&&!_e)return null;let ct=r?Fo({emphasized:a!==null,stressed:_e,anyChosen:I,mine:je,touches:f(L),siblings:W.get(L.id)??1}):jo({edgeChosen:lt,lit:ze,anyLit:I||a!==null,own:q.opacity,kit:u.emphasis}),St=ze&&$e&&ae?p.tie?p.tie.cardIsTo?$e:ae:p.edges.some(re=>x.has(re.from))?ae:$e:null,ut=(0,Fe.jsxs)("g",{children:[(0,Fe.jsx)("path",{"data-graview-connector":L.kind,"data-graview-edges":p.edges.length,"data-graview-from":p.fromAnchor,"data-graview-to":p.toAnchor,"data-graview-lit":ze||void 0,"data-graview-activity":l?.(L)?.manner,"data-graview-provisional":rt!==void 0||void 0,opacity:ct*(L.opacity??1)*(rt!==void 0?fn:1),d:oe,fill:"none",stroke:Ut(q),strokeWidth:(ze?Math.max(1.6,po(q,r)):po(q,r))+(_e?.6:0),strokeDasharray:rt!==void 0?hn:Cn[q.pattern],strokeLinecap:"round"}),St?(0,Fe.jsx)("circle",{cx:St.x,cy:St.y,r:2.6,fill:Ut(q),opacity:ct}):null,k&&r?(0,Fe.jsx)("text",{x:b.x,y:b.y-_-5,textAnchor:"middle",opacity:ct,style:{font:"9px var(--graview-font-body, system-ui)",letterSpacing:"0.09em",textTransform:"uppercase",fill:"var(--graview-ink-faint)"},children:rn(L.kind).toLowerCase()}):null]},p.key),et=null;return Ce&&c&&!k&&ct>=.2&&(et=(0,Fe.jsx)("path",{"data-graview-edge":Ce,className:"graview-edge-hit",d:kt,fill:"none",pathLength:1,strokeDasharray:"0.86",strokeDashoffset:-.07,stroke:"transparent",strokeWidth:14,style:{pointerEvents:"stroke",cursor:"pointer"},onClick:re=>{re.stopPropagation(),c(Ce,{x:re.clientX,y:re.clientY})},onContextMenu:re=>{re.preventDefault(),re.stopPropagation(),c(Ce,{x:re.clientX,y:re.clientY})},children:rt!==void 0?(0,Fe.jsx)("title",{children:rt}):null},`hit:${p.key}`)),{key:p.key,line:ut,hit:et}});return(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)("svg",{"aria-hidden":"true","data-graview-world":"",width:t.width,height:t.height,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:Be.ties},children:z.map(p=>p?.line)}),z.some(p=>p?.hit)?(0,Fe.jsx)("svg",{"data-graview-world":"",width:t.width,height:t.height,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:Be.tieLabels},children:z.map(p=>p?.hit)}):null]})}var os=e=>e.length*8.4+16;function Gi(e,t){let n=new Map;for(let a of e){let i=n.get(a.key);i?i.push(a):n.set(a.key,[a])}let r=[...n.values()].map(a=>{let i=Math.min(...a.map(c=>c.top)),l=a.filter(c=>c.top-i<=12);return{key:a[0].key,text:a[0].text,left:Math.min(...l.map(c=>c.left)),right:Math.max(...l.map(c=>c.right)),top:i}});r.sort((a,i)=>a.top-i.top||a.left-i.left);let o=r.map(a=>{let i=Math.max(a.right-a.left,Math.min(300,os(a.text))),l=(a.left+a.right)/2;return{left:l-i/2,right:l+i/2}});return r.map((a,i)=>{let l=r.map((v,y)=>({other:v,at:y})).filter(({other:v})=>v!==a&&Math.abs(v.top-a.top)<=12),c=l.filter(({other:v})=>v.right<=a.left).map(({other:v,at:y})=>o[y].right+8<=(v.right+a.left)/2?o[y].right+8:(v.right+a.left+8)/2),d=l.filter(({other:v})=>v.left>=a.right).map(({other:v,at:y})=>o[y].left-8>=(a.right+v.left)/2?o[y].left-8:(a.right+v.left-8)/2),s=Math.max(t.left,...c),u=Math.min(t.right,...d),h=a.right-a.left,g=o[i].right-o[i].left,w=Math.max(h,Math.min(g,u-s)),f=(a.left+a.right)/2,x=h>=w?a.left:Math.max(s,Math.min(f-w/2,u-w));return{key:a.key,text:a.text,left:x,width:w,top:a.top}})}function qn(e){return e<640?{left:8,right:56}:{left:8,right:Math.round(Math.min(128,e*.107))}}function rs(e){return Math.min(260,16+e.length*6.6)}var Mn=(e,t)=>Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));function _i(e,t,n){let r=new Map;for(let i of e){let l=r.get(i.said);l?l.push(i):r.set(i.said,[i])}let o=[],a=[];for(let[i,l]of r){let c=l[0],d=rs(i),{end:s,far:u}=c,h=x=>Math.max(0,Math.min(n.width-d,x)),g=[{x:h(s.x-d/2),y:u.y-22-6,width:d,height:22},{x:h(s.x-d/2),y:u.y+u.height+6,width:d,height:22},{x:u.x+u.width+6,y:s.y-22/2,width:d,height:22},{x:u.x-d-6,y:s.y-22/2,width:d,height:22}],w=g[0],f=1/0;for(let x of g){let y=x.x<0||x.y<0||x.x+x.width>n.width||x.y+x.height>n.height?1e9:0;for(let E of t)y+=Mn(x,E.title)*100+Mn(x,E.box);for(let E of o)y+=Mn(x,E)*100;if(y<f&&(f=y,w=x),y===0)break}o.push(w),a.push({said:i,keys:l.map(x=>x.key),...w})}return a}var zi=(e,t,n=2)=>t.x>=e.x-n&&t.x<=e.x+e.width+n&&t.y>=e.y-n&&t.y<=e.y+e.height+n;function tr(e,t){let n=new Set;for(let r of e)(t.edgeId&&r.edgeId===t.edgeId||t.point&&(zi(r.fromBox,t.point)||zi(r.toBox,t.point))||t.ids?.some(o=>r.ids.includes(o))||t.box&&(Mn(t.box,r.fromBox)>0||Mn(t.box,r.toBox)>0))&&n.add(r.key);return n}var ge=se(Le(),1);function Ui(e){let t=Er(e);return t.length>0?new Map(t.map(n=>[$t(n.edge.kind,n.edge.from,n.edge.to),Rr(n)])):void 0}function Xi({frame:e,width:t,height:n,scheme:r,overview:o,selection:a,emphasis:i,stageRef:l,store:c,graphNodes:d,onPickEdge:s,liveOf:u,holding:h=!1,provisional:g,focusId:w=null,beside:f=!1}){let[x,v]=(0,ye.useState)(0),[y,E]=(0,ye.useState)(null),I=e.t<1,W=(0,ye.useRef)(""),F=(0,ye.useRef)([]),ee=()=>[...l.current?.querySelectorAll("[data-graview-relation] > span")??[]].map(T=>{let G=T.getBoundingClientRect();return`${Math.round(G.left)},${Math.round(G.top)},${Math.round(G.width)}`}).join(" ");(0,ye.useLayoutEffect)(()=>{I||h||(W.current=ee(),F.current=e.nodes,E(Xn(e.nodes,e.connectors,l.current,o,r)))},[e,I,h,a,o,d,r,x,l]),(0,ye.useEffect)(()=>{if(I||h||o||typeof requestAnimationFrame>"u")return;let T=requestAnimationFrame(()=>{ee()!==W.current&&v(G=>G+1)});return()=>cancelAnimationFrame(T)},[y]);let z=e.nodes.map(T=>T.id).join(`
|
|
4
|
-
`);(0,ye.useLayoutEffect)(()=>{let T=l.current;if(T===null||typeof window>"u")return;let G=0,V=()=>{G===0&&(G=requestAnimationFrame(()=>{G=0,v(k=>k+1)}))};T.addEventListener("scroll",V,{capture:!0,passive:!0}),window.addEventListener("resize",V,{passive:!0});let Y=typeof ResizeObserver>"u"?null:new ResizeObserver(V);if(Y){Y.observe(T);for(let k of T.querySelectorAll("[data-graview-view]"))Y.observe(k)}return()=>{G!==0&&cancelAnimationFrame(G),T.removeEventListener("scroll",V,{capture:!0}),window.removeEventListener("resize",V),Y?.disconnect()}},[l,z]);let[p,S]=(0,ye.useState)(null),L=(y??[]).some(T=>T.tie!==void 0);if((0,ye.useEffect)(()=>{let T=l.current;if(!L||T===null)return;let G=Y=>{let k=Y.target?.closest?.("[data-graview-pick], [data-graview-view]");S(k?.getAttribute("data-graview-pick")??k?.getAttribute("data-graview-view")??null)},V=()=>S(null);return T.addEventListener("pointerover",G),T.addEventListener("focusin",G),T.addEventListener("pointerleave",V),T.addEventListener("focusout",V),()=>{T.removeEventListener("pointerover",G),T.removeEventListener("focusin",G),T.removeEventListener("pointerleave",V),T.removeEventListener("focusout",V)}},[L,l]),I)return null;let O=(y&&h?Vi(y,F.current,e.nodes):y)??Xn(e.nodes,e.connectors,null,o,r),H=new Set;for(let T of O){if(T.edges.length!==1)continue;let G=T.edges[0];H.add(`${T.connector.kind}|${G.from}|${G.to}`)}return(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsx)(Yi,{strands:O,result:e,scheme:r,overview:o,selection:a,emphasis:i,stageRef:l,onPickEdge:s,liveOf:u,pointed:p,...g?{provisional:g}:{}}),o&&yn(a,{overview:o,focusId:w,beside:f},T=>c.graph.getNode(T)?.kind).records.length>0?(0,ge.jsx)(ye.Suspense,{fallback:null,children:(0,ge.jsx)(as,{frame:e,width:t,height:n,stageRef:l,tick:x,store:c,graphVersion:d,selection:a,view:{overview:o,focusId:w,beside:f},rulers:g?{...Ki,unsureOf:(T,G,V)=>g.get($t(T,G,V))}:Ki})}):null,o?null:(0,ge.jsx)(ds,{...g?{provisional:g}:{},stageRef:l,nodes:e.nodes,scheme:r,selection:a,store:c,graphNodes:d,overview:o,width:t,height:n,onPickEdge:s,alreadyDrawn:H,tick:x})]})}var Ki={visibleRect:Jt,clipQuadratic:Sn,unsureDash:hn,unsureOpacity:fn},is=un(zt(()=>(__graviewPreload(import.meta.url,["./chunk.FUQVNXLB.js","./chunk.Z7ZCR4LN.js","./chunk.RIW7SQH4.js","./chunk.FSAHO3LV.js","./chunk.UWIYKGYK.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.3P4IIXIT.js")))),as=is.part((e,t)=>(0,ge.jsx)(e.RecordLinks,{...t}),{what:"The links",quiet:!0}),ss=44;function ds({stageRef:e,nodes:t,scheme:n,selection:r,store:o,graphNodes:a,overview:i,width:l,height:c,onPickEdge:d,alreadyDrawn:s,tick:u,provisional:h}){let g=Bt(),w=(0,ye.useMemo)(()=>{if(r.length===0||r.length>4)return[];let p=new Set(r),S=[];for(let O of r){let H=It(O);H&&S.push({kind:H.kind,self:H.from,other:H.to})}for(let O of o.graph.allEdges()){let H=p.has(O.from)?O.from:p.has(O.to)?O.to:null;if(!H)continue;let T=H===O.from?O.to:O.from;p.has(T)||S.push({kind:O.kind,self:H,other:T})}if(S.length<=14)return S;let L=new Set(t.map(O=>O.id));return S.map((O,H)=>({tie:O,index:H,real:L.has(O.other)?0:1})).sort((O,H)=>O.real-H.real||O.index-H.index).slice(0,14).map(({tie:O})=>O)},[o,r,a,t]),f=()=>{if(w.length===0||typeof document>"u")return[];let p=e.current?.getBoundingClientRect();if(!p)return[];let S=[...e.current?.querySelectorAll("[data-graview-joins]")??[]].find(k=>{if(k.closest("[data-graview-offstage]"))return!1;try{let $=JSON.parse(k.getAttribute("data-graview-joins")??"[]");return $.length===r.length&&$.every(q=>r.includes(q))}catch{return!1}});if(S){let k=Jt(S,e.current);if(!k)return[];let $=[];for(let q of r){let _=t.find(M=>M.id===q);if(!_)continue;let b=De(e.current,_.id,i)??nt(_,n),R=b?Un(k,b):null;if(!b||!R)continue;let A=[...o.graph.allEdges()].find(M=>M.from===q&&r.includes(M.to)||M.to===q&&r.includes(M.from));$.push({key:`join:${q}`,self:q,other:"",others:1,kind:A?.kind??"",endX:R.to.x,endY:R.to.y,...R,fromBox:k,toBox:b,proxy:!1,edgeId:A?$t(A.kind,A.from,A.to):null})}return $}let L=(k,$)=>{let q=e.current?.querySelectorAll(`[data-graview-pick="${CSS.escape(k)}"], [data-graview-slot="${CSS.escape(k)}"]`),_=[];for(let b of q??[]){if(b.closest("[data-graview-offstage]")||$(b)||b.closest("[data-graview-mark]"))continue;let R=Jt(b,e.current);R&&_.push(R)}return _.sort((b,R)=>b.width*b.height-R.width*R.height)},O=k=>t.find($=>$.id===k)??t.find($=>$.aggregate?.memberIds.includes(k)),H=k=>`[data-graview-pick="${CSS.escape(k)}"], [data-graview-slot="${CSS.escape(k)}"]`,T=(k,$)=>{let q=e.current;if(!q)return!1;for(let _ of q.querySelectorAll("[data-graview-view]")){let b=_.querySelector(H(k));if(b===null||b.closest("[data-graview-offstage]"))continue;let R=_.querySelector(H($));if(R!==null&&!R.closest("[data-graview-offstage]"))return!0}return!1},G=[];if(!i&&e.current){for(let k of t){if(Math.round(k.plane)!==1)continue;let $=De(e.current,k.id,!1);$&&G.push($)}for(let k of e.current.querySelectorAll("[data-graview-relation] > span")){let $=k.getBoundingClientRect();$.width>0&&$.height>0&&G.push({x:$.left-p.left,y:$.top-p.top,width:$.width,height:$.height})}}let V=new Map,Y=[];for(let k of w){if(T(k.self,k.other))continue;let $=O(k.self),q=$?e.current?.querySelector(`[data-graview-view="${CSS.escape($.id)}"]`):null,_=!i&&$?.id===k.self&&Math.round($.plane)===1?De(e.current,$.id,!1):null,b=_?[_]:L(k.self,()=>!1);if(!(b.length>0)&&$){let ae=De(e.current,$.id,!1)??nt($,n);ae&&b.push(ae)}let A=t.find(ae=>ae.id===k.other),M=[],N=!1;if(A){let ae=De(e.current,A.id,i)??nt(A,n);ae&&M.push(ae)}else if(M.push(...L(k.other,ae=>q?q.contains(ae):!1)),M.length===0){let ae=O(k.other);if(ae&&(!$||ae.id!==$.id)){let Se=De(e.current,ae.id,i)??nt(ae,n);Se&&(M.push(Se),N=!0)}}if(b.length===0||M.length===0||N&&i)continue;let P=b[0],B=M[0],te=1/0;for(let ae of b)for(let Se of M){let ot=Math.hypot(ae.x+ae.width/2-(Se.x+Se.width/2),ae.y+ae.height/2-(Se.y+Se.height/2));ot<te&&(te=ot,P=ae,B=Se)}if(s?.has(`${k.kind}|${k.self}|${k.other}`)||s?.has(`${k.kind}|${k.other}|${k.self}`))continue;let K=`${k.kind}:${Math.round(P.x)},${Math.round(P.y)}:${Math.round(B.x)},${Math.round(B.y)}`,j=V.get(K);if(j){j.others+=1;continue}let J=Un(P,B);if(!J)continue;let{from:X,control:fe}=J,ie=_&&P===_?en(P,B,G,Y.length):void 0,ve=ie?ie[ie.length-1]:J.to,ke=[...o.graph.allEdges()].find(ae=>ae.kind===k.kind&&(ae.from===k.self&&ae.to===k.other||ae.from===k.other&&ae.to===k.self)),$e={key:`${k.kind}:${k.self}:${k.other}`,self:k.self,other:k.other,others:1,kind:k.kind,endX:ve.x,endY:ve.y,from:X,to:ve,control:fe,fromBox:P,toBox:B,...ie?{points:ie}:{},proxy:N,edgeId:ke?$t(ke.kind,ke.from,ke.to):null};V.set(K,$e),Y.push($e)}for(let k of Y){let $=[...o.graph.allEdges()].find(A=>A.kind===k.kind&&(A.from===k.self&&A.to===k.other||A.from===k.other&&A.to===k.self)),q=o.graph.getNode(k.self),_=o.graph.getNode(k.other);if(!$||!q||!_)continue;let b=$.from===k.self?"out":"in",R=Mr(o.schema,b==="out"?q.kind:_.kind,k.kind,b);k.said=k.proxy?`${R}: ${Gt(o.schema,_.kind,k.others)}`:`${R}: ${Ln(o.schema.tryDefinition(_.kind),_)}`}return Y},[x,v]=(0,ye.useState)([]),[y,E]=(0,ye.useState)([]);(0,ye.useLayoutEffect)(()=>{let p=f();v(p),E(p.some(S=>S.said)?I(p):[])},[w,t,i,n,l,c,s,u,e]);let I=p=>{let S=e.current;if(!S)return[];let L=[];for(let O of S.querySelectorAll("[data-graview-view]")){let H=[...O.children].find(G=>!G.classList.contains("graview-kind-tag")),T=H?Jt(H,S):null;T&&L.push({box:T,title:{...T,height:Math.min(T.height,ss)}})}return _i(p.flatMap(O=>O.said?[{key:O.key,said:O.said,end:{x:O.endX,y:O.endY},far:O.toBox}]:[]),L,{width:l,height:c})},[W,F]=(0,ye.useState)(()=>new Set),ee=(0,ye.useRef)([]);ee.current=x.map(p=>({key:p.key,fromBox:p.fromBox,toBox:p.toBox,ids:[p.self,p.other],edgeId:p.edgeId}));let z=y.length>0;return(0,ye.useEffect)(()=>{let p=e.current;if(!p||!z)return;let S=k=>F($=>$.size===k.size&&[...k].every(q=>$.has(q))?$:k),L=0,O=null,H=()=>{if(L=0,!O)return;let k=p.getBoundingClientRect(),$=O.target instanceof Element?O.target:null;S(tr(ee.current,{point:{x:O.clientX-k.left,y:O.clientY-k.top},edgeId:$?.closest("[data-graview-edge]")?.getAttribute("data-graview-edge")??null}))},T=k=>{O=k,L||(L=requestAnimationFrame(H))},G=()=>{O=null,S(new Set)},V=k=>{let $=k.target instanceof Element?k.target:null;if(!$)return;let q=p.getBoundingClientRect(),_=$.getBoundingClientRect(),b=$.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??$.closest("[data-graview-view]")?.getAttribute("data-graview-view");S(tr(ee.current,{...b?{ids:[b]}:{},box:{x:_.left-q.left,y:_.top-q.top,width:_.width,height:_.height}}))},Y=k=>{k.relatedTarget instanceof Node&&p.contains(k.relatedTarget)||S(new Set)};return p.addEventListener("pointermove",T,{passive:!0}),p.addEventListener("pointerleave",G),p.addEventListener("focusin",V),p.addEventListener("focusout",Y),()=>{L&&cancelAnimationFrame(L),p.removeEventListener("pointermove",T),p.removeEventListener("pointerleave",G),p.removeEventListener("focusin",V),p.removeEventListener("focusout",Y)}},[e,z]),x.length===0?null:(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsx)("svg",{"aria-hidden":x.some(p=>p.edgeId)?void 0:!0,"data-graview-ties":x.length,"data-graview-world":"",width:l,height:c,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:Be.lines},children:x.map(p=>{let{connector:S,style:L}=Qt(g,p.kind);if(!S.visible)return null;let O=p.edgeId?h?.get(p.edgeId):void 0,H={p0:p.from,c:p.control,p1:p.to},T=p.points?Ko(p.points,10):S.route==="orthogonal"?vt([wn(p.from,p.to)]):(({p0:V,c:Y,p1:k})=>`M ${V.x} ${V.y} Q ${Y.x} ${Y.y} ${k.x} ${k.y}`)(zn(S.route,H)),G=null;if(p.edgeId&&d&&!p.proxy){let V=(k,$)=>$.x>=k.x&&$.x<=k.x+k.width&&$.y>=k.y&&$.y<=k.y+k.height,Y=p.points?[...p.points]:[];for(let k=0;k<=(p.points?-1:40);k++){let $=Pi(S.route,H,k/40);V(p.fromBox,$)||V(p.toBox,$)||Y.push($)}Y.length>=2&&(G=(0,ge.jsx)("path",{"data-graview-edge":p.edgeId,className:"graview-edge-hit",d:`M ${Y[0].x} ${Y[0].y} ${Y.slice(1).map(k=>`L ${k.x} ${k.y}`).join(" ")}`,fill:"none",pathLength:1,strokeDasharray:"0.86",strokeDashoffset:-.07,stroke:"transparent",strokeWidth:14,style:{pointerEvents:"stroke",cursor:"pointer"},onClick:k=>{k.stopPropagation(),d(p.edgeId,{x:k.clientX,y:k.clientY})},onContextMenu:k=>{k.preventDefault(),k.stopPropagation(),d(p.edgeId,{x:k.clientX,y:k.clientY})},children:O!==void 0?(0,ge.jsx)("title",{children:O}):null}))}return(0,ge.jsxs)("g",{opacity:(p.proxy?.32:.72)*(O!==void 0?fn:1),children:[(0,ge.jsx)("path",{"data-graview-tie":p.kind,"data-graview-tie-proxy":p.proxy||void 0,"data-graview-provisional":O!==void 0||void 0,d:T,fill:"none",stroke:Ut(L),strokeWidth:p.proxy?1.1:1.6,strokeDasharray:O!==void 0?hn:Cn[L.pattern],strokeLinecap:"round"}),(0,ge.jsx)("circle",{cx:p.endX,cy:p.endY,r:p.proxy?2:2.6,fill:Ut(L)}),G]},p.key)})}),(0,ge.jsx)("div",{"aria-hidden":"true","data-graview-world":"",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:Be.tieLabels},children:y.map(p=>{let S=x.find(L=>L.key===p.keys[0]);return(0,ge.jsx)("span",{className:"graview-record-link-said","data-graview-link-said":S?.kind,"data-graview-lands":S?.proxy?"district":"record","data-graview-said-for":p.keys.length,"data-graview-tie-said":p.keys.some(L=>W.has(L))?"shown":"waiting",style:{position:"absolute",left:p.x,top:p.y,transform:`translateX(min(0px, calc(${Math.round(l-p.x-8)}px - 100%)))`},children:p.said},p.said)})})]})}function qi({nodes:e,scheme:t,width:n,stageRef:r,moving:o=!1,holding:a=!1}){let i=Bt(),[l,c]=(0,ye.useState)([]);(0,ye.useLayoutEffect)(()=>{o||a||c(d())},[e,o,a,t,n,r]);function d(){let s=[];for(let h of e){if(!h.via||Math.round(h.plane)!==1)continue;let g=De(r.current,h.id,!1,!0),{scale:w}=Kt(1,t);s.push({key:`${h.via.edgeKind}|${h.via.direction}`,text:h.via.description??`${h.via.direction==="in"?"\u2190":"\u2192"} ${rn(h.via.edgeKind).toLowerCase()}`,left:g?.x??h.x,right:g?g.x+g.width:h.x+h.width*w,top:g?.y??h.y})}let u=qn(n);return Gi(s,{left:u.left,right:n-u.right})}return l.length===0||!i.captions.visible||o?null:(0,ge.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:Be.lines},children:l.map(s=>{let{left:u,width:h}=s;return(0,ge.jsx)("div",{"data-graview-relation":s.key,title:s.text,style:{position:"absolute",left:u,width:h,textAlign:"center",top:Math.max(0,s.top-19),fontSize:"0.75rem",letterSpacing:"0.09em",textTransform:"uppercase",color:"var(--graview-ink-faint)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:(0,ge.jsx)("span",{style:{background:"var(--graview-ground)",padding:"1px 7px",borderRadius:4},children:s.text})},s.key)})})}var Vt=se(Te(),1);var cs=new Set;function Zi(e,t,n,r,o,a,i=0,l=0){let{store:c,views:d,hiddenKinds:s}=pe(),u=Pt(),h=(0,Vt.useContext)(_t),g=fo(),w=(0,Vt.useMemo)(()=>{let v={};for(let y of g){if(y.subjectId===void 0)continue;let E=v[y.subjectId]??=[];for(let I of y.nodeIds)I!==y.subjectId&&!E.includes(I)&&E.push(I)}return v},[g]),f=(0,Vt.useMemo)(()=>({flagged:new Set(g.flatMap(v=>v.nodeIds)),touched:Nn(c.log.all())}),[g,c,a]),x=(0,Vt.useMemo)(()=>({hits:u?Pn(u):cs,...f}),[u,f]);return(0,Vt.useMemo)(()=>({...e,cityZoom:r,...h?{besideTheMap:!0}:{},...s.size>0?{hiddenKinds:[...s].sort()}:{},...Object.keys(w).length>0?{judged:w}:{},relevance:x,inset:{...qn((t?.width??1200)-o.right),top:8,bottom:0},chrome:[{x:(t?.width??1200)-o.right-176,y:0,width:176,height:100},us(t,o)],...o.right>0||o.bottom>0?{dock:o}:{},...i>0?{headroom:i}:{},unit:n,plainGroups:c.schema.kinds.filter(v=>hr(d.lookup(v,{cardinality:"many",fidelity:"full"}))),cityOrder:sr($r({name:"scene",schema:c.schema,mutations:c.allMutations().filter(v=>!v.derived)}).order.map(v=>v.kind),d.arrangement?.()?.order),screens:d.places().reduce((v,y)=>((v[y.kind]??=[]).push({as:y.as,title:y.title,...y.across?{across:y.across}:{}}),v),{}),...t?{width:t.width,height:Math.max(0,t.height-Math.max(64,l))}:{}}),[e,t,n,c,d,s,w,x,r,h,o.right,o.bottom,i,l])}var Qi=224;function us(e,t){let n=e?.width??1200,r=e?.height??800,o=58;return{x:n-t.right-Qi,y:r-t.bottom-o,width:Qi,height:o}}var dt=se(Te(),1);var Ji=se(Te(),1);function Qn(e){let t=e?.closest?.("[data-graview-pick]")?.getAttribute("data-graview-joins");if(!t)return null;try{let n=JSON.parse(t);return Array.isArray(n)&&n.length>0&&n.every(r=>typeof r=="string")?n:null}catch{return null}}function ea(e){(0,Ji.useEffect)(()=>{let t=e.current;if(!t)return;let n=()=>{for(let a of t.querySelectorAll("[data-graview-pick]"))a.getAttribute("tabindex")===null&&a.setAttribute("tabindex","0"),a.getAttribute("role")===null&&fs(a)&&a.setAttribute("role","button")};if(n(),typeof MutationObserver>"u")return;let r=0,o=new MutationObserver(()=>{r===0&&(r=typeof requestAnimationFrame>"u"?0:requestAnimationFrame(()=>{r=0,n()}),r===0&&n())});return o.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-graview-pick"]}),()=>{o.disconnect(),r!==0&&cancelAnimationFrame(r)}},[e])}var hs=new Set(["div","span","p","figure","img","td","output","b","i","em","strong","small","canvas","g","polygon","circle","rect","path","ellipse","polyline","line","use"]);function fs(e){return hs.has(e.localName.toLowerCase())}var tn=se(Le(),1);function ta({node:e,useDom:t,blur:n,touched:r,frontY:o,centerY:a,screen:i,onDrawnHeight:l,crowded:c,activity:d,scheme:s,canvasWidth:u,canvasHeight:h,selected:g,onSelect:w,onPick:f,onTravel:x,onMenu:v,selection:y,onJackIn:E,onDragStart:I,onDragMove:W,onDragEnd:F,swallowClick:ee,children:z}){let{brand:p,store:S,actsDoor:L}=pe(),O=e.beyond?`${e.beyond.length} more district${e.beyond.length===1?"":"s"}`:e.aggregate?.opens?.in==="place"?`${e.aggregate.label}, ${Gt(S.schema,e.aggregate.kind,e.aggregate.memberIds.length)}`:e.aggregate?e.aggregate.label:(()=>{let M=S.graph.getNode(e.id);return M?Ln(S.schema.tryDefinition(e.kind),M):e.id})(),[H,T]=(0,dt.useState)(null),G=Math.round(e.plane)===0&&!e.aggregate;(0,dt.useLayoutEffect)(()=>{if(!G)return;let M=q.current;if(!M)return;let N=()=>{let B=[...M.children].find(X=>X.dataset.graviewKindtag===void 0);if(!B)return;let te=M.getBoundingClientRect(),K=B.getBoundingClientRect(),j=M.offsetWidth>0?te.width/M.offsetWidth:1,J={top:Math.round((K.top-te.top)/j)-9,right:Math.round((te.right-K.right)/j)+14};T(X=>X&&X.top===J.top&&X.right===J.right?X:J)};if(typeof ResizeObserver>"u"){N();return}let P=new ResizeObserver(N);P.observe(M);for(let B of M.children)P.observe(B);return()=>P.disconnect()},[G,e.id]);let V=gr({plane:e.plane,...e.depth!==void 0?{depth:e.depth}:{},onPlot:o!==void 0},s),Y=V.style,k=yr(Y,e.x,e.y,u,h),$=n?V.blur:0,q=(0,dt.useRef)(null);ea(q);let _=e.natural,b=_?Math.min(e.width/_.width,e.height/_.height):1,R=(0,dt.useRef)(null);(0,dt.useEffect)(()=>{if(!i||!l)return;let M=R.current;if(!M||typeof ResizeObserver>"u")return;let N=()=>{let j=0,J=0;for(let X of M.children)if(!(!(X instanceof HTMLElement)||X.classList.contains("graview-screen-fullscreen"))){j=Math.max(j,X.offsetTop+X.offsetHeight);for(let fe of[X,...X.querySelectorAll("*")]){let ie=getComputedStyle(fe).overflowY;(ie==="auto"||ie==="scroll")&&(J+=fe.scrollHeight-fe.clientHeight)}}l(j+J)},P=0,B=()=>{P||(P=requestAnimationFrame(()=>{P=0,N()}))};N();let te=new ResizeObserver(B);te.observe(M);for(let j of M.children)te.observe(j);let K=new MutationObserver(B);return K.observe(M,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),()=>{P&&cancelAnimationFrame(P),te.disconnect(),K.disconnect(),l(void 0)}},[i,l,e.id]);let A=t?{transform:Ii(k),transformOrigin:"0 0",filter:$>0?`blur(${$}px)`:void 0,opacity:pr(Y)*(e.opacity??1),"--graview-lift-low":Go(Y.shadow,s),...o!==void 0?{"--graview-front-y":`${o.toFixed(1)}px`}:{},...a!==void 0?{"--graview-center-y":`${a.toFixed(1)}px`}:{}}:{"--graview-lift-low":Go(Y.shadow,s)};return(0,tn.jsxs)("div",{ref:q,"data-graview-view":e.id,...t?{}:{drawable:""},"data-graview-plane":Math.round(e.plane),"data-graview-selected":g||void 0,"data-graview-touched":r||void 0,"data-graview-plot":o!==void 0?"":void 0,"data-graview-screen":i?"":void 0,"data-graview-record-focus":Math.round(e.plane)===0&&!e.aggregate&&!_&&!i?"":void 0,"data-graview-nested":e.nestedUnder??void 0,"data-graview-crowded":c||void 0,"data-graview-pinned":e.pinned||void 0,"data-graview-activity":d?d.manner:void 0,"data-graview-wrote":d?.wrote||void 0,"data-graview-read":d&&!d.wrote?!0:void 0,"data-graview-broke":d?.broke||void 0,title:d?`${ki[d.manner]} ${d.wrote?"changed this":"read this"}: ${d.intent}`:e.aggregate&&Math.round(e.plane)!==0?`Open ${e.aggregate.label}`:void 0,role:"group","aria-label":O,"aria-keyshortcuts":L&&!e.beyond?L.key:void 0,tabIndex:0,onPointerDown:I,onPointerMove:W,onPointerUp:F,onPointerCancel:F,onClick:M=>{if(ee.current)return;let N=M.target?.closest("input, textarea, select, button, a[href], [contenteditable='true']");if(N&&!N.hasAttribute("data-graview-pick"))return;let P=M.metaKey||M.shiftKey,B=gt(M.target);if(B&&B!==e.id){M.stopPropagation(),f(B,P,Qn(M.target)??void 0);return}w(P)},onKeyDown:M=>{if(L&&!e.beyond&&M.key.toLowerCase()===L.key.toLowerCase()&&!M.metaKey&&!M.ctrlKey&&!M.altKey&&!M.target?.closest("input, textarea, select, [contenteditable='true']")){M.preventDefault(),M.stopPropagation();let K=gt(M.target)??e.id;y.includes(K)||f(K,!1),L.open(M.target instanceof HTMLElement?M.target:M.currentTarget);return}if(M.key!=="Enter"&&M.key!==" "||M.target?.closest("input, textarea, select, button, [contenteditable='true']"))return;let P=gt(M.target);if(M.preventDefault(),M.stopPropagation(),!P||P===e.id){y.length===1&&y[0]===e.id&&!M.metaKey&&!M.shiftKey?E():w(M.metaKey||M.shiftKey);return}let B=Qn(M.target);(B?y.length===B.length&&B.every(K=>y.includes(K)):y.length===1&&y[0]===P)&&!M.metaKey&&!M.shiftKey?x(P):f(P,M.metaKey||M.shiftKey,B??void 0)},onContextMenu:M=>{let N=gt(M.target);M.preventDefault(),M.stopPropagation();let P=N&&N!==e.id?N:e.id;f(P,!1,(P===N?Qn(M.target):null)??void 0),v({x:M.clientX,y:M.clientY,on:P})},onDoubleClick:M=>{let N=gt(M.target);if(N&&N!==e.id){M.stopPropagation(),x(N);return}E()},style:{position:"absolute",...t?{}:{pointerEvents:"none"},zIndex:e.opened?Be.opened:Be.card-Math.round(e.plane),left:t?0:Math.round(e.x),top:t?0:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height),boxSizing:"border-box",display:"flex",flexDirection:"column",justifyContent:"center",...A},children:[_?(0,tn.jsx)("div",{ref:R,"data-graview-natural":`${Math.round(_.width)}x${Math.round(_.height)}`,style:{position:"absolute",left:"50%",top:"50%",width:_.width,height:_.height,transform:`translate(-50%, -50%) scale(${b})`,transformOrigin:"50% 50%",display:"flex",flexDirection:"column"},children:z}):z,Math.round(e.plane)===0&&!e.aggregate?(0,tn.jsxs)("span",{"data-graview-kindtag":"",className:"graview-kind-tag","aria-hidden":"true",style:{...H??{},"--graview-hue":Math.round(sn(e.kind,p?.accents))},children:[(0,tn.jsx)("span",{style:{width:9,height:6,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",flex:"0 0 auto",background:`hsl(${Math.round(sn(e.kind,p?.accents))} 55% var(--graview-tint-lightness) / 0.9)`}}),ir(S.schema.tryDefinition(e.kind),e.kind)]}):null]})}var ue=se(Le(),1);ho({search:Dr,touchWeights:Nn});var ms=e=>e?{activity:e}:{},ys=e=>`${Math.round(e.x)} ${Math.round(e.y)}`,na=e=>e.stopPropagation(),aa=.6,sa=3,gs=80,oa=e=>Math.round(e.plane)===1&&(e.compact===!0||e.width<175||e.height<gs);function ps(e){let[t,n]=(0,Q.useState)(1),r=(0,Q.useRef)(1);return(0,Q.useEffect)(()=>{e||(r.current=1,n(1))},[e]),[t,r,n]}function xs(e){let[t,n]=(0,Q.useState)({x:0,y:0}),r=(0,Q.useMemo)(()=>({x:(e.pan?.x??0)+t.x,y:(e.pan?.y??0)+t.y}),[e.pan,t]),o=(0,Q.useMemo)(()=>t.x===0&&t.y===0?e:Ht(e,r),[e,t,r]),a=(0,Q.useRef)(t);a.current=t;let i=(0,Q.useCallback)((l,c)=>{let d=a.current,s=(u,h,g)=>Math.max(Math.min(-u,h),Math.min(Math.max(u,h),g+h))-h;return{x:s(l.x,d.x,c.x),y:s(l.y,d.y,c.y)}},[]);return[r,o,i,a,n]}function bs(e,t,n,r,o,a){let i=n!==null&&!t.overview,l=i?null:n,c=(0,Q.useMemo)(()=>{let h=t.pan?{...t,pan:void 0}:t;return l?mn(h,l.id,{x:l.x,y:l.y}):h},[t,l]),d=(0,Q.useMemo)(()=>Dn(e.graph,e.schema,c,r),[e,c,r,o]),s=(0,Q.useMemo)(()=>n&&i?No(d,n.id,{x:n.x,y:n.y})??Dn(e.graph,e.schema,mn(c,n.id,{x:n.x,y:n.y}),r):d,[d,n,i,e,c,r]);return[(0,Q.useMemo)(()=>Bo(s,a??{x:0,y:0}),[s,a]),i]}function ws(){let[e,t]=(0,Q.useState)(!1),[n,r]=(0,Q.useState)(!1),o=(0,Q.useRef)(null),a=(0,Q.useRef)(()=>!1),i=(0,Q.useCallback)(()=>{r(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{o.current=null,!a.current()&&r(!1)},160)},[]);return[e,n,t,i,a,()=>{t(!1),r(!1)}]}function vs(e){let t=(0,Q.useRef)(!1),n=e!==null&&!t.current;return(0,Q.useEffect)(()=>{e!==null&&(t.current=!0)},[e]),n}function ks({registerScene:e,scheme:t,views:n},r,o){let a=(0,Q.useRef)(r);a.current=r,(0,Q.useEffect)(()=>(e({whereIs:i=>Gn(a.current,o.current,t,n,i)}),()=>e(null)),[e,t,n])}function Ss(e,t){(0,Q.useEffect)(()=>{let n;return e.onActive(r=>{let o=t.current;if(!o)return;let a=l=>{let c=o.getBoundingClientRect();e.set({x:l.clientX-c.left,y:l.clientY-c.top})},i=()=>e.set(null);r?(o.addEventListener("pointermove",a),o.addEventListener("pointerleave",i),n=()=>{o.removeEventListener("pointermove",a),o.removeEventListener("pointerleave",i)}):(n?.(),n=void 0)})},[e])}function Ms(e,t,n,r,o,a,i,l){(0,Q.useEffect)(()=>{let c=t.current;if(!c||!e)return;let d=new Set;for(let u of n.nodes)(r.has(u.id)||u.aggregate?.memberIds.some(h=>r.has(h)))&&d.add(u.id);let s=e({canvas:c,layout:n,dirty:d,hostOf:u=>(c.parentElement??c).querySelector(`[data-graview-view="${CSS.escape(u)}"]`),drawOnDom:o,blur:a,scheme:i,fallBack:l});return()=>{s?.()}},[e,n,r,o,a,i,l])}var Rs=zt(()=>(__graviewPreload(import.meta.url,["./chunk.OJGHDWI6.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.GMOTRAKJ.js")));function Es(e,t){let[n]=(0,Q.useState)(()=>{let s=br();return t?e==="dom"||e==="auto"&&s==="dom"?"dom":"gpu":vr(e,{operator:s,present:wr()})}),[r,o]=(0,Q.useState)(!1),a=(0,Q.useCallback)(()=>o(!0),[]),[i,l]=(0,Q.useState)(null),c=n==="gpu"&&!t&&!r&&i===null;return(0,Q.useEffect)(()=>{if(!c)return;let s=!0;return Rs().then(u=>{s&&l(()=>u.attachGpu())},()=>{s&&o(!0)}),()=>{s=!1}},[c]),{attach:(n==="gpu"&&!r?t??i:null)??null,fallBack:a}}function Os(){let[e,t]=(0,Q.useState)(()=>new Set),n=(0,Q.useCallback)(r=>{t(o=>o.size===r.size&&[...r].every(a=>o.has(a))?o:new Set(r))},[]);return[e,n]}function As(){let e=Or();return t=>{let n=t?e.get(t.id):void 0,r=t?.aggregate?.memberIds??[];if(!n&&r.length===0)return;let o=n,a=n?.wrote??!1,i=n?.read??!1,l=n?.broke??!1;for(let c of r){let d=e.get(c);d&&(a||=d.wrote,i||=d.read,l||=d.broke,(!o||d.at>o.at||d.at===o.at&&d.wrote&&!o.wrote)&&(o=d))}return o?{...o,wrote:a,read:i,broke:l}:void 0}}var ra=(e,t)=>e.includes(t)?e.filter(n=>n!==t):[...e,t];function Ls(){let{views:e,view:t,setView:n,setSelection:r}=pe(),o=Pt(),a=(0,Q.useContext)(_t),i=l=>{if(Oe(l.id)===null&&!l.aggregate)return!1;let c=e.resolve(l.kind,{cardinality:"many",fidelity:"full"})?.view;return c!==void 0&&c.generic!==!0};return l=>({onSelect:c=>{if(cn(l.id)){r(s=>c?ra(s,l.id):[l.id]);return}let d=l.aggregate?ln(l.id):[];if(t.overview){r(s=>c?[...new Set([...s,l.id])]:[l.id]);return}if(d.length===1&&!c&&Math.round(l.plane)!==0){let s=d[0];n(u=>ao(u,u.relation===s?null:s));return}r(s=>Yo(l,s,c))},onPick:(c,d,s)=>r(u=>s?d?[...new Set([...u,...s])]:[...s]:d?ra(u,c):[c]),onTravel:c=>{n(d=>({...mt(d,c),relation:null})),r([c])},onJackIn:()=>{let c=l.aggregate?.opens;if(c){c.in==="place"?n(u=>so(u,l.id)):n(u=>Object.entries(c.within).reduce((h,[g,w])=>Tn(h,g,w),mt(dn(u,!1),c.focus))),r([]);return}let d=Oe(l.id),s=d!==null&&(o?.byKind[d]??0)>0;if(a&&d!==null&&t.overview&&!i(l)&&!(s&&t.q)){n(u=>Tn({...mt(u,`aggregate:${d}`),relation:null},"view",null)),r([]);return}n(u=>lo(u,l.id,{ownPicture:i(l),...s&&u.q?{carry:u.q}:{}})),r(l.aggregate?[]:[l.id])}})}var Is=un(zt(()=>(__graviewPreload(import.meta.url,["./chunk.XDYAG276.js","./chunk.HJCQ6I3S.js","./chunk.DUUARGPE.js","./chunk.FUQVNXLB.js","./chunk.Z7ZCR4LN.js","./chunk.RIW7SQH4.js","./chunk.FSAHO3LV.js","./chunk.UWIYKGYK.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.G2ZPQUXM.js")))),Ts=Is.part((e,t)=>(0,ue.jsx)(e.Ribbons,{...t}),{what:"The relations",quiet:!0}),ia="graview:map-from-above";function Ps(){let[e,t]=(0,Q.useState)(()=>{try{return globalThis.localStorage?.getItem(ia)==="1"}catch{return!1}}),n=(0,Q.useCallback)(r=>{t(r);try{globalThis.localStorage?.setItem(ia,r?"1":"0")}catch{}},[]);return[e,n]}var Cs=un(zt(()=>(__graviewPreload(import.meta.url,["./chunk.XDYAG276.js","./chunk.DUUARGPE.js","./chunk.MVN6H65Q.js","./chunk.UWIYKGYK.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.EQWOQOFJ.js")))),Ns=Cs.part((e,t)=>(0,ue.jsx)(e.Plots,{...t}),{quiet:!0});function Bs({zoom:e,zoomBy:t,above:n,setAbove:r}){let o=(a,i,l,c)=>(0,ue.jsx)("button",{type:"button",className:"graview-zoom-button","data-testid":`zoom-${a}`,"aria-label":`Zoom ${a}`,title:`Zoom ${a} \u2014 or pinch, or ctrl+wheel`,disabled:c,onClick:()=>t(l),children:i});return(0,ue.jsxs)("div",{className:"graview-zoom","data-graview-foot":"",role:"group","aria-label":"Zoom",onPointerDown:na,onClick:na,children:[o("out","\u2212",1/1.25,e<=aa+1e-6),(0,ue.jsxs)("span",{className:"graview-zoom-level","data-testid":"zoom-level","aria-live":"polite",children:[Math.round(e*100),"%"]}),o("in","+",1.25,e>=sa-1e-6),(0,ue.jsx)("button",{type:"button",className:"graview-zoom-button graview-zoom-above","data-testid":"from-above","aria-pressed":n,title:n?"See the city at an angle again":"See the city from straight above",onClick:()=>r(!n),children:"From above"})]})}function $s({options:e,renderer:t="auto",attachRenderer:n,blur:r=!0,className:o,style:a,animate:i=!0,children:l}){let c=pe(),{store:d,scheme:s,views:u,view:h,setView:g,selection:w,setSelection:f,setMenuAt:x,emphasis:v,brand:y,noteMoved:E,robots:I,motion:W}=c,F=(0,Q.useContext)(_t),ee=(0,Q.useRef)(null),z=(0,Q.useRef)(null),p=Li(z),S=Ai(),{zoomAbout:L,panBy:O}=vi({stage:z,view:h,setView:g}),H=Ct(),T=1,[G,V,Y]=ps(h.overview),[k,$]=Ps(),q=(0,Q.useMemo)(()=>k?{...e,tilt:jr}:e,[e,k]),{probe:_,dock:b}=pi(),R=!h.overview&&(h.zoom||h.past||h.relation)?Math.ceil(14+34*S/16+6):0,A=Zi(q,p,S,T*G,b,H,R,h.overview?0:b.bottom),M=fi(z),[N,P,B,te,K]=xs(h),j=(0,Q.useMemo)(()=>new Set(Object.keys(h.pins).filter(C=>Oe(C)===null)),[h.pins]),J=xi(),[X,fe]=bs(d,h,J.held,A,H,P.pan),[ie,ve,ke,$e,ae,Se]=ws(),ot=vs(p),oe=ii(X,{enabled:i&&!ie&&!ve&&p!==null&&!ot});(0,Q.useEffect)(()=>W.set(ie||ve||oe.t<1),[W,ie,ve,oe]);let Ge=ai(),Ze=si(),kt=mi({view:h,result:X,frame:oe,panned:N,closer:T,screenId:null,setCamera:K});ks(c,oe,z),Ss(c.pointer,z);let[Je,Ce]=Os(),{attach:lt,fallBack:rt}=Es(t,n),je=oi(r);Ms(lt,ee,oe,Ge,Ce,je,s,rt);let Ne=lt===null,We=ri(je&&Ne,ie||ve||oe.t<1),ze=As(),_e=bi({stage:z,pan:h.pan,setView:g,settled:Se});ae.current=_e.settle;let{onGroundDown:Ve,onCardDown:ct,onDragMove:St,onDragUp:ut,swallow:et}=wi({view:h,panned:N,limit:()=>pt(X),panWithin:B,moveByTransform:!0,setView:g,setDragging:ke,noteMoved:E,shift:_e,district:J});L.current=(C,he,ce)=>{if(!h.overview)return;ae.current();let Re=V.current,tt=Math.max(aa,Math.min(sa,Re*C));if(Math.abs(tt-Re)<1e-4)return;V.current=tt,$e(),Y(tt);let Et=z.current?.getBoundingClientRect(),En=X.visible??X,Ot={x:En.width/2,y:En.height/2},Zn=Et&&he!==void 0&&ce!==void 0?{x:he-Et.left,y:ce-Et.top}:Ot,Jn=tt/Re;g(Yt=>Ht(Yt,Po(Yt.pan??{x:0,y:0},te.current,Zn,Ot,Jn))),E()};let re=(C,he,ce=pt(X))=>g(Re=>Ht(Re,B(ce,{x:(Re.pan?.x??0)+C,y:(Re.pan?.y??0)+he})));gi(z,b,(C,he)=>re(C,he)),O.current=(C,he)=>{$e();let ce=pt(X),Re=h.pan??{x:0,y:0},tt=_e.offset();_e.shiftTo(B(ce,{x:Re.x+tt.x+C,y:Re.y+tt.y+he}),Re),E()};let Me=Ls(),it=Bt(),Mt=(0,Q.useCallback)(C=>Qt(it,C).connector.visible,[it]),ht=C=>ze(oe.nodes.find(he=>he.id===C)),ft=(C,he,ce,Re)=>C.originY+N.y+Zt(ce.col+ce.side/Re,ce.row+ce.side/Re,C.cell,C.tilt).y-he.y,Ie={width:X.width,height:X.height},nn={position:"relative",zIndex:Be.stage,...Ie},Rn=C=>Gn(oe,z.current,s,u,C),Rt=C=>Ne||Je.has(C),Ke=oe.nodes.filter(C=>C.screenOf===void 0).map(C=>(0,ue.jsx)(ta,{node:C,crowded:oa(C),useDom:Rt(C.id),blur:We||!Ne&&je,...C.plot&&oe.city&&Math.round(C.plane)===2?{frontY:ft(oe.city,C,C.plot,1),centerY:ft(oe.city,C,C.plot,2)}:{},touched:Ge.has(C.id),...ms(ze(C)),scheme:s,canvasWidth:X.width,canvasHeight:X.height,selected:w.includes(C.id),...Me(C),onMenu:x,selection:w,onDragStart:he=>ct(C,he),onDragMove:St,onDragEnd:ut,swallowClick:et,children:C.beyond?(0,ue.jsx)(Mi,{kinds:C.beyond}):C.aggregate?.opens?(0,ue.jsx)(Oi,{node:C}):(0,ue.jsx)(Ri,{node:C,mode:"scene",selected:w.includes(C.id),...oa(C)?{fidelity:"glyph"}:{}})},C.id));return(0,ue.jsxs)("div",{ref:z,className:`graview-ground${o?` ${o}`:""}`,"data-graview-altitude":h.overview?"":void 0,"data-graview-reach":oe.city?ys(pt(X)):void 0,"data-graview-settled":oe.t>=1&&!kt.gliding()?"":void 0,"data-graview-box":p?`${p.width}x${p.height}`:void 0,"data-graview-renderer":Ne?"dom":"gpu","data-graview-blur":(Ne?We:je)?"":void 0,onPointerDown:Ve,onPointerMove:St,onPointerUp:ut,onPointerCancel:ut,onClick:C=>{et.current||C.target.closest("[data-graview-view], button, aside, section[aria-label], [data-graview-offstage], a, input, select")||(f([]),x(null))},style:{position:"relative",width:"100%",height:"100%",cursor:ie?"grabbing":"grab",touchAction:"none","--graview-altitude":h.overview?1:0,...oe.city?{"--graview-lattice-cell":`${oe.city.cell.toFixed(2)}px`,"--graview-lattice-tilt":(oe.city.tilt??.5).toFixed(3),"--graview-lattice-x":`${(oe.city.originX+oe.city.pan.x).toFixed(1)}px`,"--graview-lattice-y":`${(oe.city.originY+oe.city.pan.y).toFixed(1)}px`}:{},...ie?{userSelect:"none"}:{},overflow:"hidden",...a},children:[h.overview&&oe.city?(0,ue.jsx)(Q.Suspense,{fallback:null,children:(0,ue.jsx)(Ts,{frame:oe,...Ie,pan:oe.city.pan,store:d,graphVersion:H,selection:w,view:{overview:h.overview,focusId:h.focusId,beside:F},emphasis:v,hiddenKinds:c.hiddenKinds,drawn:Mt})}):null,(0,ue.jsx)("div",{ref:_,"aria-hidden":"true",style:{position:"absolute",top:0,right:0,width:"var(--graview-dock, 0px)",height:"var(--graview-sheet, 0px)",visibility:"hidden",pointerEvents:"none"}}),oe.city?(0,ue.jsx)(Q.Suspense,{fallback:null,children:(0,ue.jsx)(Ns,{frame:oe,...Ie,pan:oe.city?oe.city.pan:N,brand:y,pinned:j,close:T*G>1.2,swallowed:et,...h.overview?{chosen:yn(w,{overview:h.overview,focusId:h.focusId,beside:F},C=>d.graph.getNode(C)?.kind).records}:{},onFocus:C=>{let he=Oe(C);he!==null&&g(ce=>mt(ce,Ae(he)))}})}):null,Ne?(0,ue.jsx)("div",{"data-graview-stage":"dom","data-graview-world":"",style:{...nn,overflow:"hidden"},children:Ke}):(0,ue.jsxs)("div",{"data-graview-world":"",style:nn,children:[(0,ue.jsx)("div",{"data-graview-stage":"dom","data-graview-under-canvas":"",style:{position:"absolute",left:0,top:0,...Ie,overflow:"hidden"},children:Ke.filter(C=>Je.has(String(C.key)))}),(0,ue.jsx)("canvas",{ref:ee,"data-graview-stage":"gpu",content:"drawable",layoutsubtree:"",...Ie,style:{display:"block",position:"relative",...Ie},children:Ke.filter(C=>!Je.has(String(C.key)))})]}),h.overview&&!ie?(0,ue.jsx)(ui,{result:X,schema:d.schema,chrome:M?[...A.chrome??[],M]:A.chrome??[],onGo:C=>{re(C.x,C.y),E()}}):null,h.overview?(0,ue.jsx)(Bs,{zoom:G,zoomBy:C=>L.current(C),above:k,setAbove:$}):null,(0,ue.jsx)(Xi,{frame:oe,focusId:h.focusId,beside:F,holding:fe,...Ie,scheme:s,overview:!!h.overview,selection:w,emphasis:v,stageRef:z,store:d,graphNodes:H,...(C=>C?{provisional:C}:{})(Ui(d)),onPickEdge:(C,he)=>{et.current||(f([C]),x(he?{...he,on:C}:null))},liveOf:C=>{let he=ht(C.from),ce=ht(C.to);return he?.wrote&&ce?.wrote?he.at>ce.at?he:ce:void 0}}),(0,ue.jsx)(li,{width:X.width,whereIs:Rn}),(0,ue.jsx)(di,{marks:Ze.marks,questions:[...I.values()].filter(C=>C.mode==="asking"&&C.at!==null&&C.say).map(C=>({id:C.at,who:C.who,asks:C.say})),whereIs:Rn,stageRef:z,...Ie}),(0,ue.jsx)(qi,{nodes:oe.nodes,moving:oe.t<1,holding:fe,scheme:s,width:X.width,stageRef:z}),l]})}var Qe=se(Te(),1);function Hs(){return ua(),null}var ca=()=>window.location.pathname.endsWith(ar),da=()=>(ca()?lr:io)(window.location.hash),Ds=e=>(ca()?cr:ro)(e);function ua(){let{view:e,setView:t,views:n,principal:r}=pe(),o=JSON.stringify(r),a=(0,Qe.useCallback)(s=>{let u=s.within?.view;if(u===void 0||s.focusId)return s;let h=n.places().find(g=>g.as===u);return h?{...s,focusId:Ae(h.kind)}:s},[n]),i=(0,Qe.useRef)(!1);(0,Qe.useEffect)(()=>{if(typeof window>"u")return;let s=a(da());!In(s,oo)&&!In(s,e)&&(i.current=!0,t(s))},[]),(0,Qe.useEffect)(()=>{if(typeof window>"u")return;let s=()=>t(a(da()));return window.addEventListener("popstate",s),window.addEventListener("hashchange",s),()=>{window.removeEventListener("popstate",s),window.removeEventListener("hashchange",s)}},[t,a]);let l=(0,Qe.useRef)(!1),c=(0,Qe.useRef)(null),d=(0,Qe.useRef)(o);(0,Qe.useEffect)(()=>{if(typeof window>"u")return;if(i.current){i.current=!1;return}let s=d.current!==o;d.current=o;let u=Ds(e),h=u||`${window.location.pathname}${window.location.search}`;if((window.location.hash||(window.location.href.includes("#")?"#":""))===u){l.current=!0,c.current=e;return}if(!l.current){l.current=!0,c.current=e,window.history.replaceState({graview:Nt.at},"",h);return}if(s||ha(c.current,e)){window.history.replaceState({graview:Nt.at},"",h),c.current=e;return}c.current=e,window.history.pushState({graview:++Nt.at},"",h),Nt.depth=Nt.at,Nt.tell()},[e,o])}function ha(e,t){return e?e.focusId===t.focusId&&e.relation===t.relation&&(e.overview??!1)===(t.overview??!1)&&(e.zoom??!1)===(t.zoom??!1)&&(e.past??!1)===(t.past??!1)&&e.expanded.join(",")===t.expanded.join(",")&&(e.shown??[]).join(",")===(t.shown??[]).join(",")&&Fs(e.within,t.within):!1}function Fs(e,t){let n=r=>Object.entries(r??{}).sort(([o],[a])=>o.localeCompare(a)).map(([o,a])=>`${o}=${a}`).join("&");return n(la(e))===n(la(t))}function la(e){if(!e||!("q"in e))return e;let{q:t,...n}=e;return n}var nr=se(Te(),1);var fa=new WeakMap,js=64,ma=new WeakMap,Ws=0,Vs=e=>{if(e===void 0)return 0;let t=ma.get(e);return t===void 0&&ma.set(e,t=Ws+=1),t};function ya(e,t,n,r={}){let o=()=>{let d=[...new Set(t.flatMap(u=>ln(u)))],s=t.map(u=>It(u)).filter(u=>u!==null);return Cr(e,t,{...n.principal?{principal:n.principal}:{},kindSelection:d,edgeSelection:s,...n.providers?{providers:n.providers}:{},...n.pins?{pins:n.pins}:{},...n.focus!==void 0?{focus:n.focus}:{},...r})};if(Object.keys(r).length>0)return o();let a=fa.get(e);if(!a){let d={kept:new Map,at:e.log.length};fa.set(e,a=d),e.subscribe(()=>d.kept.clear())}a.at!==e.log.length&&(a.kept.clear(),a.at=e.log.length);let i=JSON.stringify([t,n.principal??null,Vs(n.providers),n.pins??null,n.focus??null]),l=a.kept.get(i);if(l)return l;let c=o();return a.kept.set(i,c),a.kept.size>js&&a.kept.delete(a.kept.keys().next().value),c}function Ys(e,t,n={}){return ya(e,t,n)}function Gs(e={}){let{store:t,selection:n,principal:r,providers:o}=pe(),{about:a,principal:i=r,providers:l=o,pins:c,focus:d,...s}=e,u=a??n,h=Ct();return(0,nr.useMemo)(()=>ya(t,u,{principal:i,providers:l,pins:c,focus:d},s),[t,u,e,h,i,l])}function zs(){let{store:e,principal:t}=pe();return(0,nr.useMemo)(()=>({preview:(n,r)=>Br(e,n,r??{}),apply:(n,r)=>Nr(e,n,r??{},{author:t})}),[e,t])}export{Ea as a,Oa as b,Aa as c,La as d,Ia as e,Ta as f,$s as g,Hs as h,Ys as i,Gs as j,zs as k};
|
|
@@ -1,25 +0,0 @@
|
|
|
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{Aa as Pn,Gc as _n,I as kn,La as Rn,Lb as Tn,Uc as Vn,Zc as De,_c as lt,fc as Mn,qc as On,sc as In,ua as An,vc as Cn,ya as st}from"./chunk.X7W27IRI.js";import{a as He,b as D}from"./chunk.AJZBJBMO.js";var to=He(v=>{"use strict";var mt=Symbol.for("react.transitional.element"),mr=Symbol.for("react.portal"),gr=Symbol.for("react.fragment"),hr=Symbol.for("react.strict_mode"),Sr=Symbol.for("react.profiler"),wr=Symbol.for("react.consumer"),vr=Symbol.for("react.context"),br=Symbol.for("react.forward_ref"),xr=Symbol.for("react.suspense"),Er=Symbol.for("react.memo"),Yn=Symbol.for("react.lazy"),kr=Symbol.for("react.activity"),$n=Symbol.iterator;function Ar(e){return e===null||typeof e!="object"?null:(e=$n&&e[$n]||e["@@iterator"],typeof e=="function"?e:null)}var Xn={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Jn=Object.assign,Zn={};function ye(e,t,n){this.props=e,this.context=t,this.refs=Zn,this.updater=n||Xn}ye.prototype.isReactComponent={};ye.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ye.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Qn(){}Qn.prototype=ye.prototype;function gt(e,t,n){this.props=e,this.context=t,this.refs=Zn,this.updater=n||Xn}var ht=gt.prototype=new Qn;ht.constructor=gt;Jn(ht,ye.prototype);ht.isPureReactComponent=!0;var qn=Array.isArray;function yt(){}var O={H:null,A:null,T:null,S:null},eo=Object.prototype.hasOwnProperty;function St(e,t,n){var o=n.ref;return{$$typeof:mt,type:e,key:t,ref:o!==void 0?o:null,props:n}}function Pr(e,t){return St(e.type,t,e.props)}function wt(e){return typeof e=="object"&&e!==null&&e.$$typeof===mt}function Rr(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var zn=/\/+/g;function pt(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Rr(""+e.key):t.toString(36)}function Tr(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(yt,yt):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function pe(e,t,n,o,r){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case mt:case mr:a=!0;break;case Yn:return a=e._init,pe(a(e._payload),t,n,o,r)}}if(a)return r=r(e),a=o===""?"."+pt(e,0):o,qn(r)?(n="",a!=null&&(n=a.replace(zn,"$&/")+"/"),pe(r,t,n,"",function(u){return u})):r!=null&&(wt(r)&&(r=Pr(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(zn,"$&/")+"/")+a)),t.push(r)),1;a=0;var d=o===""?".":o+":";if(qn(e))for(var s=0;s<e.length;s++)o=e[s],i=d+pt(o,s),a+=pe(o,t,n,i,r);else if(s=Ar(e),typeof s=="function")for(e=s.call(e),s=0;!(o=e.next()).done;)o=o.value,i=d+pt(o,s++),a+=pe(o,t,n,i,r);else if(i==="object"){if(typeof e.then=="function")return pe(Tr(e),t,n,o,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return a}function $e(e,t,n){if(e==null)return e;var o=[],r=0;return pe(e,o,"","",function(i){return t.call(n,i,r++)}),o}function Mr(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Un=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Or={map:$e,forEach:function(e,t,n){$e(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return $e(e,function(){t++}),t},toArray:function(e){return $e(e,function(t){return t})||[]},only:function(e){if(!wt(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};v.Activity=kr;v.Children=Or;v.Component=ye;v.Fragment=gr;v.Profiler=Sr;v.PureComponent=gt;v.StrictMode=hr;v.Suspense=xr;v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O;v.__COMPILER_RUNTIME={__proto__:null,c:function(e){return O.H.useMemoCache(e)}};v.cache=function(e){return function(){return e.apply(null,arguments)}};v.cacheSignal=function(){return null};v.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var o=Jn({},e.props),r=e.key;if(t!=null)for(i in t.key!==void 0&&(r=""+t.key),t)!eo.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(o[i]=t[i]);var i=arguments.length-2;if(i===1)o.children=n;else if(1<i){for(var a=Array(i),d=0;d<i;d++)a[d]=arguments[d+2];o.children=a}return St(e.type,r,o)};v.createContext=function(e){return e={$$typeof:vr,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:wr,_context:e},e};v.createElement=function(e,t,n){var o,r={},i=null;if(t!=null)for(o in t.key!==void 0&&(i=""+t.key),t)eo.call(t,o)&&o!=="key"&&o!=="__self"&&o!=="__source"&&(r[o]=t[o]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var d=Array(a),s=0;s<a;s++)d[s]=arguments[s+2];r.children=d}if(e&&e.defaultProps)for(o in a=e.defaultProps,a)r[o]===void 0&&(r[o]=a[o]);return St(e,i,r)};v.createRef=function(){return{current:null}};v.forwardRef=function(e){return{$$typeof:br,render:e}};v.isValidElement=wt;v.lazy=function(e){return{$$typeof:Yn,_payload:{_status:-1,_result:e},_init:Mr}};v.memo=function(e,t){return{$$typeof:Er,type:e,compare:t===void 0?null:t}};v.startTransition=function(e){var t=O.T,n={};O.T=n;try{var o=e(),r=O.S;r!==null&&r(n,o),typeof o=="object"&&o!==null&&typeof o.then=="function"&&o.then(yt,Un)}catch(i){Un(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),O.T=t}};v.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()};v.use=function(e){return O.H.use(e)};v.useActionState=function(e,t,n){return O.H.useActionState(e,t,n)};v.useCallback=function(e,t){return O.H.useCallback(e,t)};v.useContext=function(e){return O.H.useContext(e)};v.useDebugValue=function(){};v.useDeferredValue=function(e,t){return O.H.useDeferredValue(e,t)};v.useEffect=function(e,t){return O.H.useEffect(e,t)};v.useEffectEvent=function(e){return O.H.useEffectEvent(e)};v.useId=function(){return O.H.useId()};v.useImperativeHandle=function(e,t,n){return O.H.useImperativeHandle(e,t,n)};v.useInsertionEffect=function(e,t){return O.H.useInsertionEffect(e,t)};v.useLayoutEffect=function(e,t){return O.H.useLayoutEffect(e,t)};v.useMemo=function(e,t){return O.H.useMemo(e,t)};v.useOptimistic=function(e,t){return O.H.useOptimistic(e,t)};v.useReducer=function(e,t,n){return O.H.useReducer(e,t,n)};v.useRef=function(e){return O.H.useRef(e)};v.useState=function(e){return O.H.useState(e)};v.useSyncExternalStore=function(e,t,n){return O.H.useSyncExternalStore(e,t,n)};v.useTransition=function(){return O.H.useTransition()};v.version="19.2.8"});var W=He((ra,no)=>{"use strict";no.exports=to()});var fo=He(Ue=>{"use strict";var Wr=Symbol.for("react.transitional.element"),Fr=Symbol.for("react.fragment");function co(e,t,n){var o=null;if(n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:Wr,type:e,key:o,ref:t!==void 0?t:null,props:n}}Ue.Fragment=Fr;Ue.jsx=co;Ue.jsxs=co});var Ie=He((fa,po)=>{"use strict";po.exports=fo()});function Hn(e){let t,n=!1,o,r,i=0;return()=>{if(n)return Promise.resolve(t);if(o)return o;let a=i>0&&r!==void 0?dr(r):e();i+=1;let d=a.then(s=>(t=s,n=!0,o=void 0,s),s=>{throw o=void 0,r??=ur(s),s});return o=d,d}}var Ln=0;function dr(e){return Ln+=1,import(`${e}${e.includes("?")?"&":"?"}retry=${Ln}`)}function ur(e,t=import.meta.url){let n=e instanceof Error?e.message:typeof e=="string"?e:"",o=/^(?:Failed to fetch|error loading) dynamically imported module: ([a-z]+:\/\/[^\s"'<>]+)/.exec(n)?.[1]?.replace(/[.,;:)\]]+$/,""),r=i=>i.split("/",3).join("/");return o&&r(o)===r(t)?o:void 0}var ue={focusId:null,relation:null,expanded:[],pins:{}},Ne=e=>{let t=Number(e);return Number.isFinite(t)?t:null};function ee(e){let t=new URLSearchParams;e.focusId&&t.set("focus",e.focusId),e.relation&&t.set("relation",e.relation),e.overview&&t.set("overview","1"),e.zoom&&t.set("zoom","1"),e.past&&t.set("past","1"),e.shown&&e.shown.length>0&&t.set("show",[...e.shown].sort().join(",")),e.selection!==void 0&&e.selection.length>0&&t.set("sel",[...e.selection].sort().join(",")),e.expanded.length>0&&t.set("expand",[...e.expanded].sort().join(","));for(let o of Object.keys(e.pins).sort()){let r=e.pins[o];t.set(`pin.${o}`,`${je(r.x)},${je(r.y)}`)}e.pan&&(e.pan.x!==0||e.pan.y!==0)&&t.set("pan",`${je(e.pan.x)},${je(e.pan.y)}`);for(let o of Object.keys(e.within??{}).sort()){let r=e.within[o];r.length>0&&t.set(`in.${o}`,r)}e.q&&e.q.trim().length>0&&t.set("q",e.q);let n=t.toString();return n?`#${n}`:"#"}function cr(e){return e&&e.startsWith("agg:")?`aggregate:${e.slice(4)}`:e}function Ge(e){let t=e.includes("#")?e.slice(e.indexOf("#")+1):e,n=new URLSearchParams(t),o=Object.create(null);for(let[h,p]of n){if(!h.startsWith("pin."))continue;let[g,b]=p.split(","),k=g===void 0?null:Ne(g),m=b===void 0?null:Ne(b);k===null||m===null||(o[h.slice(4)]={x:k,y:m})}let r=Object.create(null);for(let[h,p]of n)!h.startsWith("in.")||p.length===0||(r[h.slice(3)]=p);let i=n.get("view");i&&i.length>0&&r.view===void 0&&(r.view=i);let a=n.get("pan")?.split(",")??[],d=a[0]===void 0?null:Ne(a[0]),s=a[1]===void 0?null:Ne(a[1]),u=(n.get("sel")??"").split(",").filter(h=>h.length>0).sort(),f=n.get("overview")==="1";return{...u.length>0?{selection:u}:{},...f?{overview:!0}:{},...n.get("zoom")==="1"?{zoom:!0}:{},...n.get("past")==="1"?{past:!0}:{},...n.get("show")?{shown:[...new Set(n.get("show").split(",").filter(Boolean))].sort()}:{},...d!==null&&s!==null?{pan:{x:d,y:s}}:{},...Object.keys(r).length>0?{within:r}:{},...n.get("q")?.trim()?{q:n.get("q")}:{},focusId:cr(n.get("focus")),relation:n.get("relation"),expanded:(n.get("expand")??"").split(",").filter(h=>h.length>0&&(f||!h.startsWith("kind:"))).sort(),pins:o}}function Wi(e){let t=Ge(e);return ee(t)==="#"?{...t,overview:!0}:t}function Fi(e){let t=ee(e);return t==="#overview=1"?"":t}function je(e){return Math.round(e*100)/100}function Nn(e,t){return ee(e)===ee(t)}var Dn="edge:";function jn(e){if(!e.startsWith(Dn))return null;let t=e.slice(Dn.length).split(":");if(t.length!==3)return null;let[n,o,r]=t;if(!n||!o||!r)return null;try{return{kind:decodeURIComponent(n),from:decodeURIComponent(o),to:decodeURIComponent(r)}}catch{return null}}function dt(e){let{pan:t,...n}=e;return{...n,pins:{}}}function q(e,t){if(t===e.focusId)return{...e,focusId:t};let n=dt(e);return{...n.within?.q!==void 0?ae(n,"q",null):n,focusId:t}}function Gn(e,t){return{...e,relation:t}}function ae(e,t,n){let o={...e.within??{}};if(n===null?delete o[t]:o[t]=n,Object.keys(o).length===0){let{within:r,...i}=e;return i}return{...e,within:o}}function ce(e,t){if(t!==e.overview&&(e=dt(e)),!t){let n=e.expanded.filter(o=>!o.startsWith("kind:"));return{...e,overview:!1,expanded:n}}return{...e,overview:t}}function We(e,t){if(t.length===0){let{selection:n,...o}=e;return o}return{...e,selection:[...t]}}function Me(e,t){if(t!==(e.zoom===!0)&&(e=dt(e)),!t){let{zoom:n,...o}=e;return o}return{...e,zoom:!0}}function Fe(e,t){let n=new Set(e.expanded);return n.has(t)?n.delete(t):n.add(t),{...e,expanded:[...n].sort()}}var Be="aggregate:",Ke="kind:";function ut(e){return`${Ke}${e}`}function fe(e){return e.startsWith(Ke)?e.slice(Ke.length):null}var $i="kinds:beyond";function fr(e){let t=fe(e);return t?[t]:se(e)}function te(...e){return`${Be}${[...e].sort().join("+")}`}function Wn(e){return e.startsWith(Be)}function se(e){return!Wn(e)||e.includes("|")?[]:e.slice(Be.length).split("+").filter(Boolean)}function Fn(e,t,n={}){let o=fe(t);if(o!==null&&e.overview&&n.ownPicture!==!0)return Fe(e,t);let r=o!==null?te(o):t;if(e.zoom&&e.focusId===r&&!(o!==null&&n.carry))return Me(e,!1);if(o!==null&&n.carry){let i=ce({...q(e,r),relation:null},!1);return ae(Me(i,!0),"q",n.carry)}return Me({...q(e,r),relation:null},!0)}function pr(e,t,n){return ae(ce(q(e,te(t)),!1),"view",n)}function qi(e,t){return e.id<t.id?-1:e.id>t.id?1:0}var Kn="aggregate:";function ct(e){return e.startsWith(Kn)&&e.includes("|")}var Bn=e=>e?.off===!0,yr=e=>e!==void 0&&!Bn(e)&&(e.fast!==void 0||e.thinking!==void 0||e.answer!==void 0||e.decide!==void 0||e.complete!==void 0||e.turn!==void 0),ft={};var oo=D(W(),1),Ir={turns:[],outcomes:new Map,busy:!1,pending:null,draft:null,draftNote:null},ro=e=>`graview:seat:${e}`;function Cr(e){if(!e)return{};try{let t=sessionStorage.getItem(e);if(!t)return{};let n=JSON.parse(t);return{...Array.isArray(n.turns)?{turns:n.turns}:{},...Array.isArray(n.outcomes)?{outcomes:new Map(n.outcomes)}:{},...n.draft?.drawn?{draft:n.draft}:{}}}catch{return{}}}function _r(e,t){if(e)try{sessionStorage.setItem(e,JSON.stringify({turns:t.turns.slice(-40),outcomes:[...t.outcomes],draft:t.draft}))}catch{}}function vt(e){let t=e===null?null:ro(e),n={...Ir,...Cr(t)},o=new Set,r=(i,a=!0)=>{n=i,a&&_r(t,n);for(let d of[...o])d()};return{get:()=>n,subscribe(i){return o.add(i),()=>void o.delete(i)},setTurns:i=>r({...n,turns:i(n.turns)}),settle:(i,a)=>r({...n,outcomes:new Map(n.outcomes).set(i,a)}),setBusy:i=>r({...n,busy:i},!1),ask:i=>r({...n,pending:i.trim()||null}),takePending(){let i=n.pending;return i!==null&&r({...n,pending:null},!1),i},setDraft:(i,a=null)=>r({...n,draft:i,draftNote:a})}}function Vr(e){return(0,oo.useSyncExternalStore)(e.subscribe,e.get,e.get)}var ao=D(W(),1),Lr={entries:[],ghost:null,loaded:!1};function io(e,t){let n=new Map(e.map(o=>[o.id,o]));for(let o of t)n.set(o.id,{...n.get(o.id),...o});return[...n.values()].sort((o,r)=>o.at<r.at?1:o.at>r.at?-1:0)}function bt(e){let t=Lr,n=new Set,o=r=>{t=r;for(let i of[...n])i()};return{get:()=>t,subscribe:r=>(n.add(r),()=>n.delete(r)),record:r=>{o({...t,entries:io(t.entries,[r])}),Promise.resolve(e()?.keep?.(r)).catch(i=>{console.warn("The host did not keep an AI interaction:",i)})},setGhost:r=>o({...t,ghost:r}),load:()=>{if(t.loaded)return;o({...t,loaded:!0});let r=e()?.load;r&&Promise.resolve(r()).then(i=>o({...t,entries:io(t.entries,i)})).catch(i=>{console.warn("The host's AI interactions could not be read:",i)})}}}function Hr(e){return(0,ao.useSyncExternalStore)(e.subscribe,e.get,e.get)}function so(e){return e?.closest?.("[data-graview-pick]")?.getAttribute("data-graview-pick")??null}var qe=D(W(),1),ze=(0,qe.createContext)(void 0),Dr=()=>(0,qe.useContext)(ze);var A=D(W(),1),Oe=(0,A.createContext)(null);function uo(){return(0,A.useContext)(Oe)}function Nr(e,t){let n=uo(),o=(0,A.useMemo)(()=>n?n.live.seenBy(t):e,[n,e,t]),r=(0,A.useRef)(0),i=(0,A.useCallback)(a=>o.subscribe(()=>{r.current+=1,a()}),[o]);return(0,A.useSyncExternalStore)(i,()=>r.current,()=>0),o}var jr=Hn(()=>(__graviewPreload(import.meta.url,["./chunk.TI4OSTQV.js","./chunk.AJZBJBMO.js"]),import("./chunk.WQBDTLPZ.js"))),lo,Gr=400;function xt(e,t,n){let o=(0,A.useContext)(Oe),r=o!==null&&o.owns(e,t),[i,a]=(0,A.useState)(null),[d,s]=(0,A.useState)(lo);(0,A.useEffect)(()=>{if(d||r||i===null)return;let E=!0;return jr().then(R=>{lo=R,E&&s(R)},()=>{}),()=>{E=!1}},[d,r,i]);let[u,f]=(0,A.useState)(0),h=(0,A.useMemo)(()=>r||i===null||i>=e.log.length||!d?void 0:d.askDeclaration(n,i),[r,e,i,n,d,u]),p=h&&"waiting"in h?h.waiting:void 0,[g,b]=(0,A.useState)(void 0);(0,A.useEffect)(()=>{if(!p)return;let E=!0,R=setTimeout(()=>E&&b(p),Gr);return p.then(()=>E&&f(_=>_+1)),()=>{E=!1,clearTimeout(R)}},[p]);let k=p!==void 0&&g!==p,m=(0,A.useMemo)(()=>{if(r||i===null||i>=e.log.length||!d||k)return null;try{let E=d.pastAt(e,i,n);return{seq:i,at:E.past?.at,store:E}}catch{return null}},[r,e,i,n,d,k,u]),w=(0,A.useRef)(null),y=k?w.current:m;(0,A.useEffect)(()=>{w.current=y},[y]);let x=(0,A.useCallback)(E=>a(E===null?null:E>=e.log.length?Number.POSITIVE_INFINITY:E),[e]),P=(0,A.useCallback)((E,R)=>[e,y?.store].some(_=>_!==void 0&&(_===E||_.seenBy(R)===E)),[e,y]),G=i!==null,I=(0,A.useMemo)(()=>({past:y,open:G,show:x,live:e,host:n,owns:P}),[y,G,x,e,n,P]);return r?o:I}var yo=e=>`graview:setting:${e}`;function mo(){return localStorage}function go(e,t){try{let n=(t??mo()).getItem(yo(e.name));if(n!==null&&e.options.some(o=>o.value===n))return n}catch{}return e.initial}function ho(e,t,n){try{(n??mo()).setItem(yo(e.name),t)}catch{}}function So(e,t){if(typeof document>"u")return;let n=document.documentElement;if(e.honored==="root-font-size"){n.style.fontSize=t===e.initial?"":t;return}let o=`graview${e.name.replace(/-([a-z0-9])/g,(r,i)=>i.toUpperCase()).replace(/^[a-z]/,r=>r.toUpperCase())}`;t===e.initial?delete n.dataset[o]:n.dataset[o]=t}var L=D(W(),1);function Et(e){return De(e)}var Kr=12,Br=4;function $r(e,t,n){let o=Et(t);return e.get(o)??{participant:o,who:t.id??t.kind,at:null,mode:"docked",since:n,trail:[]}}var Ye=(e,t)=>t===null||e[e.length-1]===t?e:[...e,t].slice(-Kr);function wo(e,t){let n=e.filter(r=>r.length>0);if(n.length===0)return null;if(n.length<=Br)return n[0];let o=new Set(n.map(r=>t(r)).filter(r=>r!==void 0));return o.size===1?ut([...o][0]):n[0]}function kt(e,t,n){let o=new Map(e);if(t.type==="rest"){for(let[a,d]of e)d.mode!=="asking"&&d.mode!=="docked"&&t.at-d.since>=t.holdMs&&o.set(a,{...d,mode:"docked",at:null,trail:[],say:void 0,confidence:void 0});return o}if(t.author.kind!=="agent")return o;let r=$r(e,t.author,t.at),i=a=>o.set(r.participant,{...r,...a,since:t.at});switch(t.type){case"read":{let a=wo(t.ids,n);return i({at:a,mode:"reading",trail:Ye(r.trail,a)}),o}case"about-to-write":case"write":{let a=wo(t.ids,n);return i({at:a,mode:"writing",trail:Ye(r.trail,a),say:void 0,confidence:void 0}),o}case"refused":return i({at:t.where,mode:"refused",say:t.say,confidence:void 0,trail:Ye(r.trail,t.where)}),o;case"asking":return i({at:t.where??r.at,mode:"asking",say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},trail:Ye(r.trail,t.where)}),o;case"said":return i({say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},...t.caption?{caption:t.caption}:{}}),o;case"over":return i({over:t.over}),o;case"home":return i({at:null,mode:"docked",trail:[],say:void 0,confidence:void 0,over:null}),o;default:return o}}var vo="graview:session";function bo(e){let t=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);try{let n=e??sessionStorage,o=n.getItem(vo);if(o)return o;let r=t();return n.setItem(vo,r),r}catch{return t()}}var At={name:"share-where",title:"Where you are",description:"Whether the others here see which stop you are on.",honored:"root-attribute",options:[{value:"shared",label:"Shown"},{value:"private",label:"Hidden"}],initial:"shared"},Pt={name:"share-over",title:"What you point at",description:"Whether the others see the thing under your pointer, outlined in your color.",honored:"root-attribute",options:[{value:"private",label:"Kept to yourself"},{value:"shared",label:"Outlined for others"}],initial:"private"},xo=[At,Pt],zr=800;function Eo(e){let{channel:t,store:n,view:o,principal:r,session:i,robots:a,seatWho:d,settingValues:s,setView:u,ttlMs:f=1e4,people:h,seats:p}=e,[g,b]=(0,L.useState)(()=>new Map),[k,m]=(0,L.useState)(null),[w,y]=(0,L.useState)(null),[x,P]=(0,L.useState)(null),G=typeof r.id=="string"&&r.id.length>0,I=G&&(s[At.name]??At.initial)==="shared",E=I&&(s[Pt.name]??Pt.initial)==="shared",R=Et({kind:r.kind,...r.id?{id:r.id}:{},session:i}),_=G?Rn(r,{graph:n.graph,schema:n.schema,...p?{seats:p}:{},...h?{people:h}:{}}):"",C=d?a.get(`agent:${d}:${i}`):void 0,N=(0,L.useMemo)(()=>!t||!I?null:{participant:R,kind:r.kind,name:_,...r.onBehalfOf?.id?{onBehalfOf:r.onBehalfOf.id,...r.onBehalfOf.name?{onBehalfOfName:r.onBehalfOf.name}:{}}:{},hue:Tn(r.id??"nobody"),stop:x??ee(o),...E?{over:k}:{},...C?{robot:{at:C.at,mode:C.mode}}:{},at:new Date().toISOString()},[t,I,E,R,_,r.id,r.kind,r.onBehalfOf?.id,r.onBehalfOf?.name,o,x,k,C?.at,C?.mode]);(0,L.useEffect)(()=>{if(!t||!N)return;t.here(N);let V=setInterval(()=>t.here({...N,at:new Date().toISOString()}),zr);return()=>clearInterval(V)},[t,N]),(0,L.useEffect)(()=>t?t.onWho(K=>b(lt(new Map,K,Date.now(),f))):void 0,[t,f]);let ve=g.size>0;(0,L.useEffect)(()=>{if(!ve)return;let V=setInterval(()=>{b(K=>{let B=lt(K,[],Date.now(),f);return B.size===K.size?K:B})},Math.max(250,Math.min(1e3,f/4)));return()=>clearInterval(V)},[ve,f]),(0,L.useEffect)(()=>{if(!t||typeof window>"u")return;let V=()=>t.leave();return window.addEventListener("pagehide",V),()=>window.removeEventListener("pagehide",V)},[t]),(0,L.useEffect)(()=>{if(!E||typeof document>"u")return;let V=null,K=B=>{let J=so(B.target);J!==V&&(V=J,m(J))};return document.addEventListener("pointermove",K,{passive:!0}),()=>document.removeEventListener("pointermove",K)},[E]);let oe=(0,L.useRef)(null),z=w?g.get(w)??null:null,be=(0,L.useCallback)(V=>{oe.current=null,y(V)},[]);return(0,L.useEffect)(()=>{if(w){if(!z){y(null);return}z.stop!==oe.current?.stop&&(oe.current={stop:z.stop,at:Date.now()},u(Ge(z.stop)))}},[w,z,u]),(0,L.useEffect)(()=>{let V=oe.current;!w||V===null||Date.now()-V.at<400||Nn(o,Ge(V.stop))||y(null)},[o,w]),(0,L.useEffect)(()=>{if(!w||typeof document>"u")return;let V=K=>{K.key==="Escape"&&y(null)};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[w]),(0,L.useMemo)(()=>({who:g,sharing:N?{participant:R,name:_}:null,following:z,follow:be,sayWhere:P}),[g,N,R,_,z,be])}var Y=D(W(),1);function ko(e){return De(e.author)}function Ur(e,t){return e.length>1?"co-edited":t==="rule"?"rule":t==="agent"?"autonomous":"directed"}function Ao(e,t,n,o,r){let i=new Map;for(let[s,u]of e)o-u.at<r&&i.set(s,u);let a=new Set(n.flatMap(s=>s.nodeIds)),d=(s,u,f)=>{let h=i.get(s),p=h?.participants.includes(ko(u))?h.participants:[...h?.participants??[],ko(u)];i.set(s,{at:o,manner:Ur(p,u.author.kind),intent:u.intent,wrote:(h?.wrote??!1)||(f.wrote??!1),read:(h?.read??!1)||(f.read??!1),broke:(h?.broke??!1)||a.has(s),participants:p})};for(let s of t){for(let u of s.writes)d(u,s,{wrote:!0});for(let u of s.reads)s.writes.includes(u)||d(u,s,{read:!0})}for(let s of n)for(let u of s.nodeIds){let f=i.get(u);i.set(u,{at:o,manner:f?.manner??"rule",intent:f?.intent??s.message,wrote:f?.wrote??!1,read:f?.read??!1,broke:!0,participants:f?.participants??["rule::"]})}return i}var Yr=2600;function Po(e,t=Yr){let[n,o]=(0,Y.useState)(()=>new Map),r=(0,Y.useRef)(n);r.current=n;let i=(0,Y.useRef)(null),a=(0,Y.useCallback)(s=>{r.current=s,o(s),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{r.current=new Map,o(new Map)},t)},[t]);(0,Y.useEffect)(()=>{let s=e.violations(),u=e.subscribe((f,h)=>{let p=e.violations(),g=Cn(e.allInvariants(),s,p).introduces;s=p,a(Ao(r.current,h,g.map(b=>({nodeIds:b.nodeIds,message:b.message})),Date.now(),t))});return()=>{u(),i.current&&clearTimeout(i.current)}},[e,t,a]);let d=(0,Y.useCallback)(s=>{s.reads.length!==0&&a(Ao(r.current,[Xr(s)],[],Date.now(),t))},[t,a]);return{activity:n,noteAttention:d}}function Xr(e){return{id:`attention:${e.intent}`,seq:-1,batch:"attention",author:e.author,intent:e.intent,mutation:null,primitives:[],inverse:[],reads:e.reads,writes:[],at:new Date().toISOString()}}var l=D(W(),1);function Ro(){let e=null,t=new Set,n=new Set,o=r=>{for(let i of n)i(r)};return{subscribe(r){return t.add(r),t.size===1&&o(!0),()=>{t.delete(r),t.size===0&&(e=null,o(!1))}},snapshot:()=>e,set(r){if(!(e===r||e&&r&&e.x===r.x&&e.y===r.y)){e=r;for(let i of t)i()}},get listeners(){return t.size},onActive(r){return n.add(r),()=>void n.delete(r)}}}var Xe=D(W(),1),Jr=e=>e.definitions.some(t=>An(t).size>0);function To(e,t,n){let[o,r]=(0,Xe.useState)(void 0),i=(n.roles??[]).join("\0");return(0,Xe.useEffect)(()=>{if(!t||!Jr(e.schema)){r(void 0);return}let a=!0,d=!1,s=e.graph,u=()=>{d||(d=!0,queueMicrotask(()=>{d=!1,a&&e.reread()}))},f=Pn(t,{kind:n.kind,...n.id===void 0?{}:{id:n.id},...n.roles?{roles:n.roles}:{}},u);return st(s,f.read),r(f),e.reread(),()=>{a=!1,st(s,void 0)}},[e,t,n.kind,n.id,i]),o}function Mo(){let e=!1,t=new Set;return{moving:()=>e,set(n){if(n!==e){e=n;for(let o of t)o()}},subscribe(n){return t.add(n),()=>t.delete(n)}}}var le=D(Ie(),1),Ce=(0,l.createContext)(null),_o=(0,l.createContext)("scene");function Zr({mode:e,children:t}){return(0,le.jsx)(_o.Provider,{value:e,children:t})}function Qr(){return(0,l.useContext)(_o)}var Vo={kind:"human"},ei=[],ti=[],ni=[],Rt=[];function Lo(e,t){let n=(0,l.useId)();(0,l.useEffect)(()=>{if(!globalThis.__graviewWatch)return;let o=t??Vo,r=()=>In(e,o,n);r();let i,a=e.subscribe(()=>{clearTimeout(i),i=setTimeout(r,250)});return()=>{clearTimeout(i),a(),globalThis.__graviewWatch?.unseen?.({words:[],from:n,gone:!0})}},[e,t,n])}var oi={off:!0};function ri({store:e,views:t,initialView:n,scheme:o="dark",initialSelection:r,principal:i,seats:a=ei,onSeat:d,people:s=ti,memory:u,presenceTtlMs:f,app:h,settings:p=h?.settings??ni,presence:g,brand:b,locale:k,onKeepLens:m,providers:w,ai:y,files:x,resolveApp:P,history:G,linkedRecords:I,menuSections:E,subscriptions:R,signIn:_,view:C,onViewChange:N,children:ve}){let oe=(0,l.useContext)(Ce),z=E??oe?.menuSections,be=_??oe?.signIn,[V,K]=(0,l.useState)(null),B=V??i??a[0]?.principal??Vo,J=xt(e,B,G),Ft=J.past&&J.live===e?J.past.store:e,H=(0,l.useMemo)(()=>Ft.seenBy(B),[Ft,B]);Lo(e,B);let[re]=(0,l.useState)(()=>bo(u)),[Kt,Jo]=(0,l.useState)(!1),Bt=(0,l.useCallback)(()=>Jo(!0),[]),ie=(0,l.useMemo)(()=>g?[...p,...xo]:p,[p,g]),[tt]=(0,l.useState)(()=>n??It(t,e.schema)),[Zo,$t]=(0,l.useState)(()=>We(tt??ue,r??tt?.selection??[])),xe=(0,l.useRef)(tt??ue).current,[qt,Qo]=(0,l.useState)(null),[zt,er]=(0,l.useState)(null),Z=(0,l.useContext)(Ce),[Ut]=(0,l.useState)(()=>Z?.seatTalk??vt(b?.name??e.schema.kinds.join(","))),nt=y??Z?.ai??ft,Ve=(0,l.useMemo)(()=>nt.off?oi:nt,[nt]),Yt=(0,l.useRef)(Ve.interactions);Yt.current=Ve.interactions;let[Xt]=(0,l.useState)(()=>Z?.aiDesk??bt(()=>Yt.current)),[tr]=(0,l.useState)(()=>Z?.subscriptions??On()),Jt=R??Z?.subscriptions??tr,ot=m??Z?.onKeepLens,rt=h??Z?.app,Le=k??Z?.locale,nr=b?.locale??rt?.brand?.locale;kn({reader:Le,app:nr});let Zt=(0,l.useRef)(null),Qt=(0,l.useCallback)(c=>{Zt.current=c},[]),en=(0,l.useCallback)(c=>Zt.current?.whereIs(c)??null,[]),[tn]=(0,l.useState)(()=>Ro()),[nn]=(0,l.useState)(()=>Mo()),[it,or]=(0,l.useState)(null),[Ee,on]=(0,l.useState)(()=>new Map),ke=(0,l.useRef)(Ee);ke.current=Ee;let Ae=(0,l.useRef)(null),at=(0,l.useCallback)(c=>H.graph.getNode(c)?.kind,[H]),Q=(0,l.useCallback)(c=>{let S=kt(ke.current,c,at);ke.current=S,on(S),Ae.current&&clearTimeout(Ae.current),[...S.values()].some(M=>M.mode!=="docked"&&M.mode!=="asking")&&(Ae.current=setTimeout(()=>{let M=kt(ke.current,{type:"rest",at:Date.now(),holdMs:Ot},at);ke.current=M,on(M)},Ot+20))},[at]),rn=(0,l.useCallback)(c=>Q({...c,at:c.at??Date.now()}),[Q]),an=(0,l.useCallback)(c=>{or(c),c&&Q({type:"home",author:{kind:"agent",id:c,session:re},at:Date.now()})},[Q,re]);(0,l.useEffect)(()=>H.subscribe((c,S)=>{for(let T of S)T.author.kind==="agent"&&Q({type:"write",author:T.author,ids:T.writes,at:Date.now()})}),[H,Q]),(0,l.useEffect)(()=>()=>{Ae.current&&clearTimeout(Ae.current)},[]);let U=(0,l.useMemo)(()=>({...B,session:re}),[B,re]),sn=To(H,I,U),ln=(0,l.useCallback)(c=>{K(c),d?.(c)},[d]),[Pe,rr]=(0,l.useState)(()=>Object.fromEntries(ie.map(c=>[c.name,go(c,u)])));(0,l.useEffect)(()=>{for(let c of ie)So(c,Pe[c.name]??c.initial)},[ie,Pe]);let dn=(0,l.useCallback)((c,S)=>{let T=ie.find(M=>M.name===c);!T||!T.options.some(M=>M.value===S)||(ho(T,S,u),rr(M=>({...M,[c]:S})))},[ie,u]),[un,ir]=(0,l.useState)(null),{activity:cn,noteAttention:fn}=Po(H),pn=(0,l.useCallback)(c=>{fn(c),Q({type:"read",author:c.author,ids:c.reads,at:Date.now()})},[fn,Q]),de=(0,l.useCallback)(c=>{if(fe(c)!==null||se(c).length>0||ct(c))return!0;let S=jn(c);return S?H.graph.allEdges().some(T=>T.kind===S.kind&&T.from===S.from&&T.to===S.to):H.graph.getNode(c)!==void 0},[H]),yn=(0,l.useCallback)(c=>{let S=c.selection??Rt,T=S.filter(de),M=T.length===S.length?c:We(c,T);return M.focusId!==null&&!de(M.focusId)&&(M=q(M,null)),M},[de]),Re=(0,l.useCallback)(c=>{let S=yn(c),T=Co(H,U,S.shown);if(S.focusId!==null&&T.size>0){let M=se(S.focusId),En=H.graph.getNode(S.focusId);(M.length>0?M.every(lr=>T.has(lr)):En?T.has(En.kind):!1)&&(S={...S,focusId:null})}if(!S.overview&&S.focusId===null){let M=xe.focusId!==null&&!de(xe.focusId)?It(t,e.schema)??{...ue,overview:!0}:xe;M.focusId!==null&&de(M.focusId)?S={...S,focusId:M.focusId}:M.overview===!0&&(S={...S,overview:!0})}return S},[yn,de,H,xe,U,t,e.schema]),$=Re(C??Zo),mn=(0,l.useMemo)(()=>Co(H,U,$.shown),[H,U,$.shown]),gn=(0,l.useMemo)(()=>[...H.modules.administered.entries()].map(([c,S])=>{let T=H.mayAdminister(c,U);return{name:c,...S.description?{description:S.description}:{},kinds:S.kinds??[],canShow:T,shown:T&&($.shown??[]).includes(c)}}),[H,U,$.shown]),Te=(0,l.useCallback)(c=>{let S=T=>Re(typeof c=="function"?c(T):c);if(C!==void 0){N?.(S(C));return}N&&N(S($)),$t(T=>S(T))},[$,N,C,Re]);(0,l.useEffect)(()=>{C===void 0&&$t(c=>{let S=Re(c);return S===c?c:S})},[$,C,Re]);let hn=$.selection??Rt,Sn=(0,l.useCallback)(c=>{Te(S=>We(S,typeof c=="function"?c(S.selection??Rt):c))},[Te]),{who:wn,following:vn,follow:bn,sayWhere:ar,sharing:xn}=Eo({channel:g,store:H,view:$,principal:U,session:re,robots:Ee,seatWho:it,settingValues:Pe,setView:Te,seats:a,people:s,...f!==void 0?{ttlMs:f}:{}}),sr=(0,l.useMemo)(()=>({store:H,scheme:o,views:t,view:$,setView:Te,homeView:xe,selection:hn,setSelection:Sn,menuAt:qt,setMenuAt:Qo,whereIs:en,pointer:tn,motion:nn,registerScene:Qt,robots:Ee,noteSeat:rn,seatWho:it,registerSeatWho:an,actsDoor:zt,registerActsDoor:er,seatTalk:Ut,aiDesk:Xt,...u?{memory:u}:{},who:wn,following:vn,follow:bn,sayWhere:ar,sharing:xn,session:re,ai:Ve,resolveApp:P,linkedRecords:I,menuSections:z,subscriptions:Jt,signIn:be,linkedReads:sn,movedByHand:Kt,noteMoved:Bt,emphasis:un,setEmphasis:ir,activity:cn,noteAttention:pn,principal:U,seats:a,people:s,takeSeat:ln,settings:ie,settingValues:Pe,chooseSetting:dn,hiddenKinds:mn,administered:gn,...w?{providers:w}:{},...b?{brand:b}:{},...ot?{onKeepLens:ot}:{},app:rt,...Le?{locale:Le}:{}}),[H,o,t,$,Te,hn,Sn,qt,en,tn,nn,Qt,Ee,rn,it,an,zt,Ut,Xt,u,wn,vn,bn,xn,re,Ve,P,I,z,Jt,be,sn,Kt,Bt,un,cn,pn,U,a,s,ln,ie,Pe,dn,mn,gn,w,b,ot,rt,Le]);return(0,le.jsx)(Ce.Provider,{value:sr,children:(0,le.jsx)(Oe.Provider,{value:J,children:(0,le.jsx)(di,{children:x?(0,le.jsx)(ze.Provider,{value:x,children:ve}):ve})})})}var Ho=(0,l.createContext)(null),Tt,Mt=new Set,ii=e=>(Mt.add(e),()=>void Mt.delete(e)),Oo=()=>Tt;function ai(e){if(!Tt){Tt=e;for(let t of[...Mt])t()}}var si=300;function li(e){let t=0;return async(n,o)=>{let r=++t;return await new Promise(i=>setTimeout(i,si)),r===t?e(n,o):[]}}function di({children:e}){let{store:t,view:n,views:o,principal:r,hiddenKinds:i,selection:a,ai:d}=ne(),s=Je(),u=n.q,f=n.focusId,h=!!(u&&u.trim().length>0),p=(0,l.useSyncExternalStore)(ii,Oo,Oo),g=(0,l.useMemo)(()=>h&&p?{flagged:new Set(t.violations().flatMap(x=>x.nodeIds)),touched:p.touchWeights(t.log.all())}:null,[t,s,h,p]),b=f?t.graph.getNode(f)?.kind??fe(f)??(se(f).length===1?se(f)[0]:void 0):void 0,k=(0,l.useMemo)(()=>d.near&&li(d.near),[d.near]),m=(0,l.useMemo)(()=>!u||!g||!p?null:p.search(t,u,{...b?{inKind:b}:{},principal:r,places:o.places(),kinds:t.schema.kinds.filter(x=>!i.has(x)),from:[...a,...f&&t.graph.has(f)?[f]:[]],flagged:g.flagged,touched:g.touched,limit:200,rank:k}),[t,u,r,o,i,a,f,b,g,k]),[w,y]=(0,l.useState)();return(0,l.useEffect)(()=>void m?.later?.then(x=>y([m,x])),[m]),(0,le.jsx)(Ho.Provider,{value:w?.[0]===m?w[1]:m,children:e})}var Io=new WeakMap;function Fa(e){let t=Io.get(e);return t||Io.set(e,t=new Set(e.matched)),t}function ui(){return(0,l.useContext)(Ho)}function ne(){let e=(0,l.useContext)(Ce);if(!e)throw new Error("useGraview must be used inside a <GraviewProvider>.");return e}function Ct(){return(0,l.useContext)(Ce)??null}function Je(){let{store:e}=ne(),t=(0,l.useRef)(null),n=(0,l.useRef)(null),o=(0,l.useCallback)(()=>(n.current!==e&&(n.current=e,t.current=null),t.current??=e.graph.allNodes(),t.current),[e]),r=(0,l.useCallback)(i=>e.subscribe(()=>{t.current=null,i()}),[e]);return(0,l.useSyncExternalStore)(r,o,o)}function ci(e){let{store:t}=ne(),n=(0,l.useCallback)(r=>t.subscribe(r),[t]),o=(0,l.useCallback)(()=>e===null?void 0:t.graph.getNode(e),[t,e]);return(0,l.useSyncExternalStore)(n,o,o)}function Co(e,t,n){let o=new Set(e.modules.disabledKinds);for(let r of e.kindsKeptFrom(t))o.add(r);for(let[r,i]of e.modules.administered)if(!(e.mayAdminister(r,t)&&(n??[]).includes(r)))for(let a of i.kinds??[])o.add(a);return o}var Ot=2600;var Do=new WeakSet,fi=e=>Do.has(e),pi=e=>void Do.add(e);function It(e,t){let n=Vn(e.arrangement?.()?.first,t,e.places());if(!(!n||n.to==="home"))return n.to==="place"?{...ue,focusId:te(n.place.kind),within:{view:n.place.as}}:{...ue,focusId:te(n.kind)}}var No=D(W(),1),yi=(0,No.createContext)(!1);var Ze=Symbol.for("graview.default-view");function jo(e){return Object.defineProperty(e,Ze,{value:!0,enumerable:!1}),e}function Go(e){return typeof e=="function"&&e[Ze]===!0}var _t=Symbol.for("graview.replaces-page");function Wo(e){return typeof e=="function"&&e[_t]===!0}function gi(e){return _n(e)}function hi(e,t){if(t===e)return e;for(let r of t.registrations())e.register(r.kind,r,r.view,r);let n=t.arrangement?.();n&&e.arrange?.(n);let o=t.homeView?.();return o&&e.home?.(o),e}var ge=D(W(),1);function Si(){let{selection:e,setSelection:t}=ne();return(0,ge.useMemo)(()=>({selection:e,set:n=>t(n),clear:()=>t([]),toggle:n=>t(o=>o.includes(n)?o.filter(r=>r!==n):[...o,n]),isSelected:n=>e.includes(n)}),[e,t])}function wi(){let{store:e}=ne(),t=Je();return(0,ge.useMemo)(()=>vi(e),[e,t])}var Fo=new WeakMap;function vi(e){let t=Fo.get(e);if(!t){let n={violations:null};e.subscribe(()=>{n.violations=null}),Fo.set(e,n),t=n}return t.violations??=e.violations(),t.violations}function bi(){let{view:e,setView:t}=ne();return(0,ge.useMemo)(()=>({view:e,url:ee(e),focus:n=>t(o=>q(o,n)),show:n=>t(o=>Gn(o,n)),toggle:n=>t(o=>Fe(o,n)),go:n=>t(n)}),[e,t])}var me={at:0,depth:0,listeners:new Set,tell(){for(let e of this.listeners)e()}};typeof window<"u"&&window.addEventListener("popstate",e=>{let t=e.state;me.at=typeof t?.graview=="number"?t.graview:0,me.at>me.depth&&(me.depth=me.at),me.tell()});var j=D(W(),1),Lt={profile:{trigger:"profile-button",pane:"profile",opens:"press",focus:"into",drawn:["shell","embed"]},problems:{trigger:"standing",pane:"problems",opens:"press",focus:"into",drawn:["shell","embed"]},places:{trigger:"app-places-open",pane:"app-places",opens:"press",focus:"into",drawn:["embed"]},here:{trigger:"here-open",pane:"here-list",opens:"press",focus:"into",drawn:["shell","embed","pages"]},suggested:{trigger:"suggested-button",pane:"suggested",opens:"press",focus:"into",drawn:["shell","embed","pages"]},activity:{trigger:"activity-button",pane:"activity",opens:"press",focus:"into",drawn:["shell","embed","pages"]},find:{trigger:"find-box",pane:"find-strip",opens:"typing",focus:"stays",drawn:["shell"]},districts:{trigger:"beyond-more",pane:"beyond-list",opens:"press",focus:"into",drawn:["shell","embed"]},acts:{trigger:null,pane:"context-menu",opens:"context-menu",focus:"into",drawn:["shell","embed","pages"]},arrange:{trigger:"arrange-add",pane:"arrange-list",opens:"press",focus:"into",drawn:["pages"]},"studio-ask":{trigger:"studio-agent",pane:"studio-agent-panel",opens:"press",focus:"into",drawn:["studio"]}},xi={position:"fixed",inset:"auto",margin:0,zIndex:Mn("popover"),boxSizing:"border-box"},Qe=6,he=8,Ei=e=>typeof e.showPopover=="function";function et(e){try{return e.matches(":popover-open")}catch{return!1}}function ki(e){if(typeof e=="function"){let o=e();return o?{left:o.x,right:o.x,top:o.y,bottom:o.y}:null}let t=e.current;if(!t||!t.isConnected)return null;let n=t.getBoundingClientRect();return{left:n.left,right:n.right,top:n.top,bottom:n.bottom}}function Ht(e,t,n={}){let o=ki(t);if(!o)return;let r={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},i=e.dataset.graviewDesignedHeight??=e.style.maxHeight;e.style.maxHeight=i;let a=e.getBoundingClientRect(),d=r.height-o.bottom-Qe-he,s=o.top-Qe-he,u=a.height<=d||d>=s,f=Math.max(96,Math.floor(u?d:s)),h=Math.min(a.height,f);a.height>f&&(e.style.maxHeight=i?`min(${i}, ${f}px)`:`${f}px`);let p=a.width,g=n.align==="start"?o.left:o.right-p,b=typeof t=="function"?null:t.current?.closest("[data-graview-embed]")?.getBoundingClientRect();b&&p<=b.right-b.left&&(g<b.left?g=o.left+p<=b.right?o.left:b.left:g+p>b.right&&(g=o.right-p>=b.left?o.right-p:b.right-p));let k=p>=r.width-2*he?Math.max(0,(r.width-p)/2):Math.max(he,Math.min(g,r.width-he-p)),m=u?o.bottom+Qe:Math.max(he,o.top-Qe-h);e.style.left=`${Math.round(k)}px`,e.style.top=`${Math.round(m)}px`}function Ko(e,t,n,o={}){let r=o.align??"end";(0,j.useLayoutEffect)(()=>{let i=e.current;if(!t||!i)return;if(Ei(i)&&!et(i))try{i.showPopover(),Pi()}catch{}let a=0,d=u=>{u?.target instanceof Node&&i.contains(u.target)||(cancelAnimationFrame(a),a=requestAnimationFrame(()=>Ht(i,n,{align:r})))};Ht(i,n,{align:r}),addEventListener("resize",d),addEventListener("scroll",d,!0);let s=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>d());return s?.observe(i),()=>{if(cancelAnimationFrame(a),removeEventListener("resize",d),removeEventListener("scroll",d,!0),s?.disconnect(),i.isConnected&&et(i))try{i.hidePopover()}catch{}}},[t,e,r])}var Dt=new Set;function Ai(e){return Dt.add(e),()=>Dt.delete(e)}function Pi(){for(let e of Dt)if(!(!e.isConnected||!et(e)))try{e.hidePopover(),e.showPopover()}catch{}}var Se=null,Ri='button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])';function Ti(e){for(let t of e.querySelectorAll(Ri))if(t.closest("[hidden]")===null&&getComputedStyle(t).visibility!=="hidden")return t;return e}var Vt=()=>{let e=document.activeElement;return e===null||e===document.body};function Mi(e,t={}){let{at:n,returnTo:o,onOpenChange:r}=t,i=t.popover!==!1,[a,d]=(0,j.useState)(!1),s=t.open??a,u=(0,j.useRef)(null),f=(0,j.useRef)(null),h=(0,j.useCallback)(y=>{u.current=y},[]),p=(0,j.useCallback)(y=>{f.current=y},[]),g=`graview-popover-${(0,j.useId)().replace(/:/g,"")}`,b=(0,j.useRef)({onOpenChange:r,returnTo:o,controlled:t.open!==void 0});b.current={onOpenChange:r,returnTo:o,controlled:t.open!==void 0};let k=(0,j.useCallback)(y=>{b.current.controlled||d(y),b.current.onOpenChange?.(y)},[]),m=(0,j.useCallback)(()=>{(document.querySelector(`[aria-controls="${g}"]`)??u.current??b.current.returnTo?.()??null)?.focus({preventScroll:!0})},[g]),w=(0,j.useCallback)(y=>{let x=f.current,P=typeof document>"u"?null:document.activeElement,G=P===null||P===document.body||x!==null&&x.contains(P);k(!1),!(!y||!G)&&(m(),requestAnimationFrame(()=>{Vt()&&m()}))},[k,m]);return Ko(f,i&&s,n??u,t.align?{align:t.align}:{}),(0,j.useEffect)(()=>{if(!i||!s)return;let y={name:e,close:()=>w(!1)};if(Se&&Se.close!==y.close&&Se.close(),Se=y,Lt[e].focus==="into"){let R=f.current;R&&!R.contains(document.activeElement)&&Ti(R).focus({preventScroll:!0})}let x=R=>{R.key==="Escape"&&w(!0)},P=R=>{let _=R.target;if(!(_ instanceof Node))return;let C=f.current;if(C?.contains(_)||u.current?.contains(_))return;let N=_ instanceof Element?_.closest('[role="dialog"], [role="alertdialog"]'):null;N&&!(C&&N.contains(C))||(w(!1),Lt[e].focus==="into"&&requestAnimationFrame(()=>{(Vt()||C!==null&&C.contains(document.activeElement))&&m()}))},G=null,I=null,E=R=>{let _=R.target;if(!(_ instanceof Element))return;let C=f.current,N=_.closest('[role="dialog"], [role="alertdialog"]');!N||C&&(C.contains(N)||N.contains(C))||(G=N,w(!1))};return document.addEventListener("keydown",x),document.addEventListener("pointerdown",P,!0),document.addEventListener("focusin",E),()=>{document.removeEventListener("keydown",x),document.removeEventListener("pointerdown",P,!0),document.removeEventListener("focusin",E);let R=G;R&&typeof MutationObserver<"u"&&(I?.disconnect(),I=new MutationObserver(()=>{R.isConnected||(I?.disconnect(),requestAnimationFrame(()=>{(Vt()||document.activeElement.closest("[hidden]")!==null)&&m()}))}),I.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>I?.disconnect(),10*6e4)),Se?.close===y.close&&(Se=null)}},[i,s,e,w,m]),{open:s,setOpen:y=>y?k(!0):w(!0),toggle:()=>s?w(!0):k(!0),trigger:{ref:h,"aria-expanded":s,"aria-controls":g,"data-graview-popover-trigger":e},pane:{ref:p,id:g,popover:"manual",tabIndex:-1,"data-graview-popover":e,"data-graview-overlay":""}}}var F=D(W(),1),X=D(Ie(),1),Nt=new Set,Bo=!1;function jt(){for(let e of[...Nt])e()}function Oi(){Bo||typeof window>"u"||(Bo=!0,window.addEventListener("online",jt))}function Ii(e){let t,n=!1,o=!1,r,i=0,a=new Set,d=()=>{i+=1;for(let p of[...a])p()},s=p=>(a.add(p),()=>void a.delete(p)),u=()=>i,f=()=>void h().catch(()=>{});function h(){if(n)return Promise.resolve(t);if(r)return r;let p=e().then(g=>(t=g,n=!0,o=!1,r=void 0,Nt.delete(f),d(),g),g=>{throw r=void 0,o=!0,Nt.add(f),Oi(),d(),g});return p.catch(()=>{}),r=p,p}return{load:h,prefetch:f,get current(){return t},get failed(){return o},part(p,g={}){let b=g.what??"This part";function k(y){(0,F.useSyncExternalStore)(s,u,u);let x=(0,F.useRef)(null),P=(0,F.useRef)(null),G=(0,F.useRef)(!1);return(0,F.useEffect)(()=>{o&&r===void 0&&f()},[]),n&&typeof document<"u"&&x.current!==null&&document.activeElement===x.current&&(G.current=!0),(0,F.useLayoutEffect)(()=>{if(!(!n||!G.current)){G.current=!1;for(let I=P.current?.nextElementSibling??null;I!==null;I=I.nextElementSibling){let E=I.matches($o)?I:I.querySelector($o);if(E instanceof HTMLElement){E.focus();return}}}}),n?(0,X.jsxs)(X.Fragment,{children:[G.current?(0,X.jsx)("span",{ref:P,hidden:!0}):null,p(t,y)]}):g.quiet?null:(0,X.jsx)(Ci,{what:b,button:x,...g.as?{as:g.as}:{}})}let m=(0,F.lazy)(()=>h().then(()=>({default:k}),()=>({default:k})));function w(y){let[x]=(0,F.useState)(()=>n||o);return(0,F.createElement)(x?k:m,y)}return w}}}var $o="button,a[href],input,select,textarea,[tabindex]:not([tabindex='-1'])";function Ci({what:e,button:t,as:n="p"}){let r=typeof navigator<"u"&&navigator.onLine===!1?`${e} will load when you're back online.`:`${e} didn't load.`;return(0,X.jsxs)(n,{"data-testid":"lazy-part-missing",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:[(0,X.jsx)("span",{role:"status",children:r})," ",(0,X.jsx)("button",{ref:t,type:"button","data-testid":"lazy-part-retry",onClick:jt,style:{font:"inherit",fontWeight:600,color:"var(--graview-ink)",background:"none",border:"1px solid var(--graview-edge)",borderRadius:6,padding:"2px 10px"},children:"Try again"})]})}var we=D(W(),1);var qo=(0,we.createContext)(null);function _i(){let e=(0,we.useContext)(qo),t=Ct(),n=(o,r,i)=>t?.setView(a=>ae(ae(ce(q(a,te(o)),!1),"view",r),"filter",i?.filter??null));return(0,we.useMemo)(()=>e??{record:o=>{t&&(t.setView(r=>q(ce(r,!1),o)),t.setSelection([o]))},place:(o,r)=>{let i=t?.views.places().find(a=>a.as===o);i&&n(i.kind,i.as,r)},list:(o,r)=>n(o,null,r)},[e,t])}var zo=D(W(),1),Vi=(0,zo.createContext)(!1);var Uo=D(W(),1),Li=(0,Uo.createContext)(null);var Yo=D(W(),1),Gt='button:not([disabled]), a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])',Wt=e=>e instanceof HTMLElement&&(e.matches(Gt)||e.hasAttribute("tabindex")),_e=e=>typeof e.checkVisibility=="function"?e.checkVisibility():e.getClientRects().length>0;function Hi(e,t){let n=s=>s.replace(/["\\]/g,"\\$&"),o=t.getAttribute("data-testid"),r=t.getAttribute("data-graview-pick"),i=t.getAttribute("aria-label"),a=o?`[data-testid="${n(o)}"]`:r?`[data-graview-pick="${n(r)}"]`:i?`${t.tagName.toLowerCase()}[aria-label="${n(i)}"]`:null;if(!a)return null;let d=e.querySelector(a);return d&&Wt(d)&&_e(d)?d:null}var Di=e=>e.isConnected&&Wt(e)&&!e.matches(":disabled")&&e instanceof HTMLElement&&_e(e);function Xo(e,t){let n=t?Hi(e,t):null;if(n)return n;let o=e.querySelector("[data-graview-view][tabindex]");if(o&&_e(o))return o;for(let r of e.querySelectorAll(Gt))if(_e(r))return r;return Wt(e)&&_e(e)?e:null}function Ni(e){(0,Yo.useEffect)(()=>{let t=e.current;if(!t||typeof MutationObserver>"u")return;let n=[],o=m=>{let w=m.target;if(w instanceof Element){n=[];for(let y=w;y&&y!==t.parentElement;y=y.parentElement)n.push(y)}},r=!1,i=!1,a=t.ownerDocument,d=()=>!i&&a.defaultView!==null,s=(m,w)=>void setTimeout(()=>d()&&w(),m),u=m=>void requestAnimationFrame(()=>d()&&m()),f=m=>{if(r=!1,i)return;let w=a.activeElement;if(!(!(w===null||w===a.body||w===a.documentElement)||n.length===0)){if(Di(n[0])){m&&n[0]instanceof HTMLElement&&n[0].focus({preventScroll:!0});return}for(let x of n.slice(1)){if(!x.isConnected)continue;let P=Xo(x,n[0]);if(P){P.focus({preventScroll:!0}),n=[];return}}}},h=(m,w=Date.now()+2500)=>{s(100,()=>{f(m);let y=a.activeElement;(y===null||y===a.body||y===a.documentElement)&&n.length>0&&Date.now()<w&&h(m,w)})},p=()=>{r||n.length===0||(r=!0,s(60,()=>u(()=>{f(!1),h(!1)})))},g=m=>{if(!(m instanceof KeyboardEvent&&!["Enter"," ","Escape"].includes(m.key))){if(!(m instanceof KeyboardEvent)){let w=m.target instanceof Element?m.target.closest(Gt):null,y=a.activeElement,x=y===null||y===a.body||y===a.documentElement;if(w&&x&&t.contains(w)){n=[];for(let P=w;P&&P!==t.parentElement;P=P.parentElement)n.push(P);s(150,()=>u(()=>{f(!1),h(!1)}));return}}!(m instanceof KeyboardEvent)&&!(m.target instanceof Node&&n[0]?.contains(m.target))||s(150,()=>u(()=>{f(!0),h(!0)}))}},b=new MutationObserver(()=>{n.length>0&&!n[0].isConnected&&p()}),k=m=>{m.relatedTarget===null&&p()};return t.addEventListener("focusin",o),t.addEventListener("focusout",k),t.addEventListener("click",g),t.addEventListener("keydown",g),b.observe(t,{childList:!0,subtree:!0}),()=>{i=!0,t.removeEventListener("focusin",o),t.removeEventListener("focusout",k),t.removeEventListener("click",g),t.removeEventListener("keydown",g),b.disconnect()}},[e])}export{Hn as a,ue as b,ee as c,Ge as d,Wi as e,Fi as f,Nn as g,Dn as h,jn as i,dt as j,q as k,Gn as l,ae as m,ce as n,We as o,Me as p,Fe as q,Be as r,ut as s,fe as t,$i as u,fr as v,te as w,Wn as x,se as y,Fn as z,pr as A,qi as B,Kn as C,ct as D,yr as E,W as F,vt as G,Vr as H,Hr as I,so as J,ze as K,Dr as L,Oe as M,uo as N,Nr as O,xt as P,Ie as Q,Zr as R,Qr as S,Lo as T,ri as U,ai as V,Fa as W,ui as X,ne as Y,Ct as Z,Je as _,ci as $,fi as aa,pi as ba,It as ca,qo as da,_i as ea,yi as fa,jo as ga,Go as ha,Wo as ia,gi as ja,hi as ka,Vi as la,Li as ma,Si as na,wi as oa,bi as pa,me as qa,Ni as ra,xi as sa,et as ta,Ko as ua,Ai as va,Mi as wa,Ii as xa};
|
|
2
|
-
/*! Bundled license information:
|
|
3
|
-
|
|
4
|
-
react/cjs/react.production.js:
|
|
5
|
-
(**
|
|
6
|
-
* @license React
|
|
7
|
-
* react.production.js
|
|
8
|
-
*
|
|
9
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the MIT license found in the
|
|
12
|
-
* LICENSE file in the root directory of this source tree.
|
|
13
|
-
*)
|
|
14
|
-
|
|
15
|
-
react/cjs/react-jsx-runtime.production.js:
|
|
16
|
-
(**
|
|
17
|
-
* @license React
|
|
18
|
-
* react-jsx-runtime.production.js
|
|
19
|
-
*
|
|
20
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
21
|
-
*
|
|
22
|
-
* This source code is licensed under the MIT license found in the
|
|
23
|
-
* LICENSE file in the root directory of this source tree.
|
|
24
|
-
*)
|
|
25
|
-
*/
|
|
@@ -1 +0,0 @@
|
|
|
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 q,g as Z,h as ee}from"./chunk.DLT3EE4D.js";import{a as Q,b as X}from"./chunk.3C4RJIJU.js";import{b}from"./chunk.DPP7ITTU.js";import{d as D}from"./chunk.GF7LA4QG.js";import{a as K}from"./chunk.UT6642FC.js";import{h as A}from"./chunk.Z7ZCR4LN.js";import{m as J}from"./chunk.Y5Z4ZDTO.js";import{F,I as P,N as L,O as T,Q as U,Y as m,a as $,ea as G,sa as V,wa as Y,xa as _}from"./chunk.UWIYKGYK.js";import{La as z,X as B,Z as E,fb as R}from"./chunk.X7W27IRI.js";import{b as W}from"./chunk.AJZBJBMO.js";var u=W(F(),1);var te=W(F(),1);function ne(){let{ai:i,aiDesk:n}=m(),{entries:a}=P(n),r=i.off===!0;return(0,te.useEffect)(()=>{r||n.load()},[n,r]),r?[]:a}var e=W(U(),1),ae=_($(()=>(__graviewPreload(import.meta.url,["./chunk.RTB4MMF6.js","./chunk.6J7DR7XQ.js","./chunk.Y5Z4ZDTO.js","./chunk.UWIYKGYK.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.4J75WRDG.js")))),pe=ae.part((i,n)=>(0,e.jsx)(i.InteractionRow,{...n}),{quiet:!0,as:"li"}),ge=ae.part((i,n)=>(0,e.jsx)(i.ActivityFilter,{...n}),{quiet:!0,as:"div"}),ie=(i,n)=>({intent:n.intent,author:n.author.kind,...n.author.id?{authorId:n.author.id}:{},by:n.author,...n.ops[0]?.via?{via:n.ops[0].via}:{},...n.lineage?{basis:K(n.lineage)}:{},touched:[...new Set(n.ops.filter(a=>!R(a)).flatMap(a=>a.writes))],...he(i,n.ops.filter(a=>!R(a))),batch:n.id,at:n.at,...n.lineage?.interaction?{interaction:n.lineage.interaction}:{},seq:n.ops.at(-1).seq+1,...n.ops.every(R)?{withheld:!0}:{}});function ue(i=4){let{store:n,principal:a}=m(),r=T(n,a),d=r.log.length;return(0,u.useMemo)(()=>Q(r.batches(),s=>r.log.get(s)).reverse().slice(0,i).map(s=>{if("batch"in s)return ie(r,s.batch);let o=[...s.digest.batches].reverse().map(l=>ie(r,l));return{intent:X(s.digest,new Date().toISOString().slice(0,10)),author:s.digest.author.kind,...s.digest.author.id?{authorId:s.digest.author.id}:{},by:s.digest.author,touched:[...new Set(o.flatMap(l=>l.touched))],batch:"",...o[0]?.at?{at:o[0].at}:{},seq:o[0]?.seq??0,digest:o}}),[r,d,i])}function he(i,n){let a={};for(let r of n)for(let d of r.primitives)d.op==="remove-node"&&d.node&&(a[d.node.id]=B(i.schema.tryDefinition(d.node.kind),d.node));return Object.keys(a).length>0?{removed:a}:{}}function ce({change:i}){let{store:n,principal:a,seats:r,people:d}=m();return(0,e.jsxs)("strong",{style:{fontWeight:600},children:[i.author==="human"&&i.by?.onBehalfOf===void 0&&(i.authorId===void 0||a.id===void 0||i.authorId===a.id)?"you":z(i.by??{kind:i.author,id:i.authorId},{graph:n.graph,schema:n.schema,seats:r,people:d}),A(i.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",A(i.via)]}):null]})}function ye({change:i,goes:n}){let{store:a}=m(),[r,d]=(0,u.useState)(!1),s=i.digest??[];return(0,e.jsxs)("li",{"data-testid":"activity-digest",style:{display:"grid",gap:5,lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsx)(ce,{change:i})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:i.intent})]}),(0,e.jsx)("button",{type:"button","data-testid":"digest-toggle","aria-expanded":r,onClick:()=>d(o=>!o),style:{marginLeft:"auto",flex:"0 0 auto",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem"},children:r?"Hide":"Show each"})]}),r?(0,e.jsx)("ol",{"data-testid":"digest-changes",style:{margin:0,padding:"0 0 0 10px",listStyle:"none",display:"grid",gap:6,borderLeft:"1px solid var(--graview-edge)"},children:s.map(o=>(0,e.jsxs)("li",{"data-testid":"digest-change",style:{display:"grid",gap:3},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:o.intent}),o.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",o.basis]}):null]}),o.withheld?null:(0,e.jsx)(M,{batch:o.batch})]}),o.touched.length>0?(0,e.jsx)("div",{"data-touched":o.touched.join(" "),style:{display:"flex",flexWrap:"wrap",gap:4},children:o.touched.slice(0,4).map(l=>(0,e.jsx)(O,{id:l,label:a.graph.has(l)?b(a,l):o.removed?.[l]??b(a,l),go:n(l)},l))}):null]},o.batch))}):null]})}function M({batch:i}){let{store:n,principal:a,noteSeat:r}=m(),d=T(n,a),s=L()?.open??!1,o=d.log.length,[l,v]=(0,u.useState)(null),c=(0,u.useMemo)(()=>d.canUndo(i),[d,i,o]);if(s||!c.ok&&c.ops.length===0)return null;let w=!c.ok,k=w?c.includeBatches:[];return(0,e.jsxs)("span",{style:{marginLeft:"auto",flex:"0 0 auto",display:"grid",justifyItems:"end",gap:2},children:[(0,e.jsx)("button",{type:"button","data-testid":"undo-turn",title:w?`${c.message} \u2014 undo those too`:"Take this back, keeping everything since",onClick:()=>{v(null);try{let f=d.log.all().find(x=>x.batch===i&&x.author.kind==="agent");d.undo(w?[i,...k]:i,{author:a}),f&&r({type:"home",author:f.author})}catch(f){v(f instanceof Error?f.message:String(f))}},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem",...w?{borderColor:"var(--graview-warn)",color:"var(--graview-warn)"}:{}},children:w?`undo +${k.length}`:"undo"}),l?(0,e.jsx)("span",{"data-testid":"undo-refused",role:"alert",style:{fontSize:"0.75rem",lineHeight:1.4,color:"var(--graview-warn)",maxWidth:260,textAlign:"right"},children:l}):null]})}function fe({seq:i,intent:n}){let a=L();if(!a)return null;let r=a.past?.seq===i;return(0,e.jsx)("button",{type:"button","data-testid":"show-past","aria-label":`Show the app as it was after \u201C${n}\u201D`,title:"Show the app as it was here","aria-pressed":r,onPointerEnter:q,onFocus:q,onClick:()=>a.show(i),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minHeight:24,minWidth:24,padding:"1px 6px",fontSize:"0.75rem",flex:"0 0 auto"},children:(0,e.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,e.jsx)("path",{d:"M2.5 8 a5.5 5.5 0 1 0 1.6-3.9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,e.jsx)("path",{d:"M2 2.5 V5.5 H5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,e.jsx)("path",{d:"M8 5 V8 L10 9.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}function me(){let i=()=>{let n=new URL(window.location.href);return n.searchParams.set("fresh","1"),n.toString()};return(0,e.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:n=>{n.preventDefault(),window.location.assign(i())},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",textDecoration:"underline",textDecorationColor:"var(--graview-edge-bright)",textUnderlineOffset:3},children:"Start fresh"})}function O({id:i,label:n,go:a}){return a?(0,e.jsx)("button",{type:"button","data-testid":"activity-record","data-record":i,title:`Go to ${n}`,onClick:()=>a(i),style:{all:"unset",display:"inline-flex",cursor:"pointer",borderRadius:7},className:"graview-activity-record",children:(0,e.jsx)(D,{label:n})}):(0,e.jsx)(D,{label:n})}function Oe({calls:i,seat:n,remembers:a=!1}){let r=ue(),{store:d,principal:s,seats:o,people:l}=m(),v=ne(),[c,w]=(0,u.useState)("all"),[k,f]=(0,u.useState)(!1),x=t=>t!==void 0&&(t.id===s.id||t.onBehalfOf?.id===s.id)&&s.id!==void 0,re=new Set(v.map(t=>t.id)),oe=r.filter(t=>!(t.interaction!==void 0&&re.has(t.interaction))&&(!k||x(t.by))),se=v.filter(t=>!k||x(t.by)).slice(0,4),I=[...c==="ai"?[]:oe.map(t=>({at:t.at??"",change:t})),...c==="changes"?[]:se.map(t=>({at:t.at,entry:t}))].sort((t,h)=>t.at<h.at?1:t.at>h.at?-1:0),y=T(d,s),H=i.some(t=>t.phase==="running"),de=Z(),S=Y("activity"),N=S.open,le=G(),j=L(),C=t=>y.graph.has(t)?h=>{S.setOpen(!1),j?.past&&j.show(null),le.record(h)}:null;return n===void 0&&i.length===0&&r.length===0&&v.length===0&&!a&&de===0?null:(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"activity-button",...S.trigger,onClick:S.toggle,title:H?"An agent is working":"What has happened",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:H?"var(--graview-accent)":"var(--graview-ink-muted)"},children:[H?(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,background:"var(--graview-accent)"}}):null,r.length>0?r.length:"",(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("circle",{cx:"8",cy:"8",r:"5.75",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),(0,e.jsx)("path",{d:"M8 4.75 V8 L10.25 9.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,e.jsx)("span",{className:"graview-activity-word",children:" Activity"})]}),!N&&n!==void 0?(0,e.jsx)("div",{hidden:!0,"data-testid":"agent-seat-seated",children:n}):null,N?(0,e.jsxs)("section",{...S.pane,"aria-label":"Activity","data-testid":"activity","data-graview-offstage":"",style:{...V,width:300,maxHeight:"min(52cqh, 460px)",overflow:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...J,margin:0},children:"Activity"}),n!==void 0?(0,e.jsxs)("div",{"data-testid":"agent-seat-row",style:{display:"grid",gap:5,paddingBottom:i.length>0||I.length>0?9:0,...i.length>0||I.length>0?{borderBottom:"1px solid var(--graview-edge)"}:{}},children:[(0,e.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"The agent's seat"}),n]}):null,i.length>0?(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:7},children:i.slice(0,6).map((t,h)=>(0,e.jsxs)("li",{style:{display:"grid",gap:2,fontSize:"0.8125rem",lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,flex:"0 0 auto",background:t.phase==="running"?"var(--graview-accent)":t.phase==="failed"?"var(--graview-warn)":"var(--graview-edge-bright)"}}),(0,e.jsxs)("span",{style:{color:"var(--graview-ink)"},children:[t.mutating?"changed":"read"," \xB7"," ",y.allMutations().find(p=>p.name===t.name)?.title??E(t.name)]})]}),!t.mutating&&t.reads&&t.reads.length>0?(0,e.jsxs)("div",{"data-testid":"activity-reads",style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:[[...new Set(t.reads)].slice(0,3).map(p=>(0,e.jsx)(O,{id:p,label:b(y,p),go:C(p)},p)),new Set(t.reads).size>3?(0,e.jsxs)("span",{style:{color:"var(--graview-ink-muted)"},children:["+",new Set(t.reads).size-3]}):null]}):Object.values(t.args).some(p=>typeof p=="string")?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:Object.entries(t.args).filter(p=>typeof p[1]=="string").slice(0,3).map(([p,g])=>(0,e.jsx)(O,{id:g,label:b(y,g),go:C(g)},p))}):null,t.error?(0,e.jsx)("div",{style:{paddingLeft:12,color:"var(--graview-warn)"},children:t.error}):null]},`${t.at}:${h}`))}):null,v.length>0?(0,e.jsx)(u.Suspense,{fallback:null,children:(0,e.jsx)(ge,{shows:c,onShows:w,mine:k,onMine:f})}):null,I.length>0?(0,e.jsx)("ol",{"data-testid":"diff-log",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6,fontSize:"0.8125rem"},children:I.map(({change:t,entry:h},p)=>h!==void 0?(0,e.jsx)(u.Suspense,{fallback:null,children:(0,e.jsx)(pe,{entry:h,undo:g=>(0,e.jsx)(M,{batch:g})})},`ai:${h.id}`):t.digest?(0,e.jsx)(ye,{change:t,goes:C},`digest:${t.digest[0]?.batch??p}`):t.withheld?(0,e.jsx)("li",{"data-testid":"withheld-change",style:{display:"grid",gap:3,lineHeight:1.45},children:(0,e.jsx)("span",{"data-touched":"",style:{color:"var(--graview-ink-muted)",fontStyle:"italic"},children:t.intent})},`change:${p}`):(0,e.jsxs)("li",{"data-batch":t.batch,style:{display:"grid",gap:3,lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsxs)("strong",{style:{fontWeight:600},children:[t.author==="human"&&t.by?.onBehalfOf===void 0&&(t.authorId===void 0||s.id===void 0||t.authorId===s.id)?"you":z(t.by??{kind:t.author,id:t.authorId},{graph:y.graph,schema:y.schema,seats:o,people:l}),A(t.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",A(t.via)]}):null]})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:t.intent}),t.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",t.basis]}):null]}),t.batch?(0,e.jsx)(fe,{seq:t.seq,intent:t.intent}):null,t.batch?(0,e.jsx)(M,{batch:t.batch}):null]}),(0,e.jsx)("div",{"data-touched":t.touched.join(" "),style:{display:"flex",flexWrap:"wrap",gap:4},children:t.touched.slice(0,4).map(g=>(0,e.jsx)(O,{id:g,label:y.graph.has(g)?b(y,g):t.removed?.[g]??b(y,g),go:C(g)},g))})]},`change:${p}`))}):null,(0,e.jsx)(ee,{style:{paddingTop:8,borderTop:"1px solid var(--graview-edge)"}}),a?(0,e.jsxs)("div",{"data-testid":"remembered",style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:10,paddingTop:8,borderTop:"1px solid var(--graview-edge)",fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:[(0,e.jsx)("span",{children:"Remembered in this browser"}),(0,e.jsx)(me,{})]}):null]}):null]})}export{M as a,Oe as b};
|