graview 0.1.62 → 0.1.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/preview/{chunk.THVC2BEC.js → chunk.24HNOLUS.js} +1 -1
- package/dist/preview/chunk.25CQCCLN.js +1 -0
- package/dist/preview/{chunk.YP2QSPXU.js → chunk.26H33GJC.js} +1 -1
- package/dist/preview/{chunk.DPEIT3TW.js → chunk.2F4AZZQR.js} +1 -1
- package/dist/preview/chunk.2KIWGQXC.js +2 -0
- package/dist/preview/{chunk.UQQKDBIH.js → chunk.2PJ6STKA.js} +1 -1
- package/dist/preview/{chunk.ELTV44HU.js → chunk.2RASWDMQ.js} +2 -2
- package/dist/preview/chunk.33XNYHI6.js +1 -0
- package/dist/preview/{chunk.TIALD6SC.js → chunk.34DRUCH2.js} +1 -1
- package/dist/preview/{chunk.MDEX6ZVE.js → chunk.36OE6RKG.js} +1 -1
- package/dist/preview/{chunk.A3OL2BI2.js → chunk.37FLKAVZ.js} +1 -1
- package/dist/preview/chunk.3JCHJLH6.js +1 -0
- package/dist/preview/chunk.3OQ6S6H4.js +1 -0
- package/dist/preview/chunk.47QEWSSE.js +1 -0
- package/dist/preview/{chunk.7M4HNKDR.js → chunk.4DAKQXDG.js} +1 -1
- package/dist/preview/{chunk.QIPASE42.js → chunk.4EXC26LI.js} +1 -1
- package/dist/preview/{chunk.VJBBVLGZ.js → chunk.4MEQUUG4.js} +1 -1
- package/dist/preview/{chunk.Y2YYH3JN.js → chunk.4TH3CGAZ.js} +1 -1
- package/dist/preview/{chunk.PZQNR4KZ.js → chunk.57YDGGJK.js} +1 -1
- package/dist/preview/{chunk.O75HWF3F.js → chunk.5GC4VAHU.js} +1 -1
- package/dist/preview/{chunk.WEOVK2T4.js → chunk.5QXQ7PBI.js} +1 -1
- package/dist/preview/chunk.6CSHRMJC.js +1 -0
- package/dist/preview/chunk.6HKWAHPT.js +1 -0
- package/dist/preview/{chunk.TM4EPUNO.js → chunk.6XHPBJ5F.js} +1 -1
- package/dist/preview/chunk.6YK5E7ZQ.js +4 -0
- package/dist/preview/{chunk.LGRLVJGS.js → chunk.6Z2GHQQH.js} +3 -3
- package/dist/preview/chunk.72YXFJKC.js +2 -0
- package/dist/preview/{chunk.T3UQ7ZQK.js → chunk.735AFUP5.js} +1 -1
- package/dist/preview/chunk.75GENXGP.js +1 -0
- package/dist/preview/{chunk.KMV6PJFL.js → chunk.A2R53GWF.js} +1 -1
- package/dist/preview/{chunk.OWT3VVOT.js → chunk.AHPYNDVA.js} +2 -2
- package/dist/preview/chunk.ATDIDPKZ.js +1 -0
- package/dist/preview/{chunk.F7YXLYLX.js → chunk.AW26EETU.js} +1 -1
- package/dist/preview/{chunk.I77ZGIFE.js → chunk.AWUO3M5D.js} +1 -1
- package/dist/preview/{chunk.AQRB7LDA.js → chunk.B46UZHGW.js} +1 -1
- package/dist/preview/{chunk.A3ZC2JBO.js → chunk.B5PJCYBU.js} +1 -1
- package/dist/preview/{chunk.VACKSKGJ.js → chunk.BF3EZCG3.js} +1 -1
- package/dist/preview/chunk.BKQICGFW.js +1 -0
- package/dist/preview/{chunk.DDUCIUVW.js → chunk.BN7C5ZYX.js} +1 -1
- package/dist/preview/chunk.BQM3YAMR.js +35 -0
- package/dist/preview/chunk.C65EHQ7V.js +1 -0
- package/dist/preview/{chunk.B23WZQXQ.js → chunk.CAXILB7K.js} +1 -1
- package/dist/preview/{chunk.UVA7AALY.js → chunk.CCQMDZHO.js} +1 -1
- package/dist/preview/{chunk.G4ULQK64.js → chunk.CGK2PY76.js} +1 -1
- package/dist/preview/{chunk.DEAP3H2L.js → chunk.CI4RZL4Z.js} +1 -1
- package/dist/preview/chunk.CYTTZOYL.js +25 -0
- package/dist/preview/chunk.D5LOTCBU.js +3 -0
- package/dist/preview/chunk.DBFJVVWF.js +1 -0
- package/dist/preview/{chunk.7XLS6XTY.js → chunk.DDFRFSVN.js} +1 -1
- package/dist/preview/{chunk.GX4G4BX3.js → chunk.DIFIHNR3.js} +1 -1
- package/dist/preview/{chunk.VN23AGIY.js → chunk.DWK3GXRR.js} +1 -1
- package/dist/preview/{chunk.ZN3PUM2I.js → chunk.DZSZUX34.js} +1 -1
- package/dist/preview/chunk.E3XJMO7Q.js +1 -0
- package/dist/preview/chunk.EJ2WE764.js +18 -0
- package/dist/preview/{chunk.22BZU7ME.js → chunk.EJ4MSVX2.js} +1 -1
- package/dist/preview/chunk.ERPILTRY.js +1 -0
- package/dist/preview/{chunk.DC35FJAB.js → chunk.FFXBDOKA.js} +1 -1
- package/dist/preview/{chunk.UXMPFPFH.js → chunk.FGDGTES4.js} +2 -2
- package/dist/preview/chunk.FNVGNISQ.js +3 -0
- package/dist/preview/{chunk.ROZTJ6IY.js → chunk.FXCQJPN4.js} +1 -1
- package/dist/preview/chunk.G2JAYG2Z.js +1 -0
- package/dist/preview/{chunk.UFDJXQQQ.js → chunk.GHN62OMG.js} +6 -6
- package/dist/preview/{chunk.5ODHHH35.js → chunk.H5SN46VK.js} +1 -1
- package/dist/preview/{chunk.W4BKYSZX.js → chunk.H7AH3IW4.js} +1 -1
- package/dist/preview/{chunk.6JO5HQDR.js → chunk.HMMK7LCL.js} +1 -1
- package/dist/preview/{chunk.SVPKUWZU.js → chunk.HOFATBGD.js} +1 -1
- package/dist/preview/{chunk.JT3MFPRD.js → chunk.HRNNRA2I.js} +1 -1
- package/dist/preview/{chunk.7KVUUEZA.js → chunk.HSMJHCR3.js} +1 -1
- package/dist/preview/{chunk.RPDH32XV.js → chunk.IEDCFSN5.js} +1 -1
- package/dist/preview/{chunk.PCDUV3WP.js → chunk.JIEDJEHK.js} +1 -1
- package/dist/preview/chunk.JNIDS66Z.js +1 -0
- package/dist/preview/{chunk.DDO3GLEJ.js → chunk.JO3BBRSR.js} +1 -1
- package/dist/preview/{chunk.H5S7OL2U.js → chunk.JVDPRQ7J.js} +1 -1
- package/dist/preview/{chunk.SEHRPTNA.js → chunk.K7TK3KRB.js} +1 -1
- package/dist/preview/{chunk.ELOFPE25.js → chunk.KB5BCW23.js} +1 -1
- package/dist/preview/{chunk.6AKW7TXM.js → chunk.KL5H7KEV.js} +1 -1
- package/dist/preview/{chunk.ILIIBSGA.js → chunk.KPQLM4TM.js} +1 -1
- package/dist/preview/{chunk.2N4Z5K5S.js → chunk.KQPKYWDM.js} +1 -1
- package/dist/preview/{chunk.QHY5NVYH.js → chunk.KXFNRJ46.js} +1 -1
- package/dist/preview/chunk.KZUMXT5J.js +74 -0
- package/dist/preview/chunk.MAHNJO6U.js +1 -0
- package/dist/preview/{chunk.AJSUHPBE.js → chunk.MBB5A6BT.js} +1 -1
- package/dist/preview/chunk.MENLUNM5.js +1 -0
- package/dist/preview/{chunk.PLTH2LW5.js → chunk.MIE3ODQ2.js} +1 -1
- package/dist/preview/{chunk.QDWSU47A.js → chunk.MT5DXJKN.js} +1 -1
- package/dist/preview/{chunk.AFNSAQEQ.js → chunk.MY5HJW2Z.js} +1 -1
- package/dist/preview/{chunk.5HGD6OWL.js → chunk.N3T2O6EW.js} +2 -2
- package/dist/preview/{chunk.66P5IDTH.js → chunk.NEPQBMFT.js} +1 -1
- package/dist/preview/{chunk.NOGGSLVG.js → chunk.NIAM7OTV.js} +1 -1
- package/dist/preview/{chunk.BZMQDEIY.js → chunk.NTC2H5ZX.js} +1 -1
- package/dist/preview/chunk.NWWJNNEK.js +2 -0
- package/dist/preview/{chunk.5J3O2FVG.js → chunk.O3YIWIVQ.js} +1 -1
- package/dist/preview/chunk.O67JXUVG.js +1 -0
- package/dist/preview/{chunk.4HEFUOLV.js → chunk.OIMGD7FR.js} +1 -1
- package/dist/preview/{chunk.DD2NKFDX.js → chunk.OM2NIQWA.js} +1 -1
- package/dist/preview/chunk.OMRQTLI5.js +1 -0
- package/dist/preview/{chunk.O2BHPYA4.js → chunk.OTSBF367.js} +2 -2
- package/dist/preview/{chunk.Y4FZKUOK.js → chunk.OXWOUE3W.js} +1 -1
- package/dist/preview/{chunk.2B6P4GPS.js → chunk.PDMX3GTL.js} +1 -1
- package/dist/preview/{chunk.75GVFX7L.js → chunk.PDS4HT46.js} +1 -1
- package/dist/preview/{chunk.EVBCEEQ4.js → chunk.PWAP2GJS.js} +1 -1
- package/dist/preview/chunk.Q2EGESEZ.js +1 -0
- package/dist/preview/{chunk.L3WTKQQL.js → chunk.Q4GJIJAU.js} +1 -1
- package/dist/preview/chunk.Q4MI53KK.js +5 -0
- package/dist/preview/{chunk.SWMDFXUX.js → chunk.QAMW5QDT.js} +1 -1
- package/dist/preview/{chunk.M4AYA2PL.js → chunk.QS32TO4N.js} +1 -1
- package/dist/preview/{chunk.BLUKSGI4.js → chunk.QSPLKCTX.js} +1 -1
- package/dist/preview/{chunk.WPXPVD33.js → chunk.R4HDKNT3.js} +1 -1
- package/dist/preview/chunk.REUMBCSV.js +1 -0
- package/dist/preview/{chunk.MAKODQO3.js → chunk.RUFYORIJ.js} +1 -1
- package/dist/preview/{chunk.5YAOKOGV.js → chunk.SGPXYDSG.js} +1 -1
- package/dist/preview/chunk.SJUXFPTI.js +1 -0
- package/dist/preview/{chunk.OUDATENL.js → chunk.SME4HD5I.js} +1 -1
- package/dist/preview/{chunk.2GEJNG2U.js → chunk.SMHP2CQH.js} +1 -1
- package/dist/preview/chunk.SSAETRHR.js +5 -0
- package/dist/preview/{chunk.MYNMBOLD.js → chunk.STDJ6XG5.js} +1 -1
- package/dist/preview/{chunk.IQ3PRWGO.js → chunk.T3JIZNE7.js} +2 -2
- package/dist/preview/chunk.T535ZLRM.js +1 -0
- package/dist/preview/{chunk.QGU5QTR6.js → chunk.UAVK54Z6.js} +1 -1
- package/dist/preview/{chunk.RD2X25XB.js → chunk.V4HVFLFQ.js} +1 -1
- package/dist/preview/chunk.V6IL7CIZ.js +1 -0
- package/dist/preview/{chunk.T6WHGKWR.js → chunk.VCTAFSZ5.js} +1 -1
- package/dist/preview/{chunk.OWOOKLIU.js → chunk.VZDHRY3U.js} +1 -1
- package/dist/preview/{chunk.X6KYRBL6.js → chunk.WBS7ND2C.js} +1 -1
- package/dist/preview/chunk.WNS5LEO5.js +1 -0
- package/dist/preview/chunk.WUVXIUA7.js +1 -0
- package/dist/preview/{chunk.Z2TDZSMN.js → chunk.WYPCLZL7.js} +1 -1
- package/dist/preview/{chunk.IQMD7DG3.js → chunk.XBYJCGPU.js} +1 -1
- package/dist/preview/{chunk.CHHYIMB7.js → chunk.XCEZCOX4.js} +1 -1
- package/dist/preview/{chunk.CY3ELWCM.js → chunk.XCWZFLIB.js} +1 -1
- package/dist/preview/chunk.XIW4SZHD.js +1 -0
- package/dist/preview/{chunk.FULEUL34.js → chunk.XUO67YMT.js} +1 -1
- package/dist/preview/{chunk.RYRQ66JN.js → chunk.XUXZW7DU.js} +1 -1
- package/dist/preview/chunk.XYGNS637.js +1 -0
- package/dist/preview/{chunk.H7N7WN4U.js → chunk.Y4ZM75WL.js} +1 -1
- package/dist/preview/{chunk.5STU3KYG.js → chunk.YOUB3J3Y.js} +1 -1
- package/dist/preview/{chunk.3FON2Y72.js → chunk.YXAKHXYB.js} +1 -1
- package/dist/preview/chunk.YZBJUAS6.js +1 -0
- package/dist/preview/{chunk.7V56P2A7.js → chunk.Z2ZQJ3DD.js} +1 -1
- package/dist/preview/{chunk.OFWNMTGB.js → chunk.ZELWW7UA.js} +2 -2
- package/dist/preview/{chunk.N6EJXXQK.js → chunk.ZLTHWCKL.js} +2 -2
- package/dist/preview/chunk.ZP7JEVVU.js +1 -0
- package/dist/preview/{chunk.NUWDMH47.js → chunk.ZRH5X3MR.js} +1 -1
- package/dist/preview/{chunk.DNVWSWL2.js → chunk.ZSGDVNVN.js} +1 -1
- package/dist/preview/chunk.ZVG4FXJK.js +1 -0
- package/dist/preview/chunk.ZY7US4Y7.js +6 -0
- package/dist/preview/{chunk.4TX6VCBT.js → chunk.ZZAI57VI.js} +1 -1
- package/dist/preview/index.html +53 -52
- package/dist/preview/page.js +2 -2
- package/dist/preview/splash.js +7 -6
- package/package.json +6 -6
- package/dist/preview/chunk.2AT3GRXM.js +0 -1
- package/dist/preview/chunk.4HRYB7HF.js +0 -1
- package/dist/preview/chunk.5MZYCELA.js +0 -6
- package/dist/preview/chunk.7OBIBPYH.js +0 -1
- package/dist/preview/chunk.7YOAW7ED.js +0 -1
- package/dist/preview/chunk.ACTXR2MI.js +0 -3
- package/dist/preview/chunk.AI34V6WV.js +0 -74
- package/dist/preview/chunk.CAKFNKN5.js +0 -1
- package/dist/preview/chunk.CGALLZ54.js +0 -1
- package/dist/preview/chunk.DHJ3FQTR.js +0 -1
- package/dist/preview/chunk.DZZL5IDD.js +0 -5
- package/dist/preview/chunk.H24OC6OE.js +0 -1
- package/dist/preview/chunk.H73ZPYUX.js +0 -1
- package/dist/preview/chunk.HANJZ6FA.js +0 -1
- package/dist/preview/chunk.HIMQ65QT.js +0 -1
- package/dist/preview/chunk.IQPILSV3.js +0 -18
- package/dist/preview/chunk.IYBEXENQ.js +0 -1
- package/dist/preview/chunk.J7Q2WAF4.js +0 -28
- package/dist/preview/chunk.JYFZCJ4N.js +0 -2
- package/dist/preview/chunk.KDXU5DT3.js +0 -1
- package/dist/preview/chunk.KL7E4YHJ.js +0 -1
- package/dist/preview/chunk.LAYQ5PFS.js +0 -1
- package/dist/preview/chunk.LTZUF5VG.js +0 -1
- package/dist/preview/chunk.M7RESZB6.js +0 -25
- package/dist/preview/chunk.MGALQLRW.js +0 -1
- package/dist/preview/chunk.NAD7ZXYP.js +0 -1
- package/dist/preview/chunk.NHTGAP3G.js +0 -3
- package/dist/preview/chunk.NUYA4BWI.js +0 -1
- package/dist/preview/chunk.OKZT2QBM.js +0 -2
- package/dist/preview/chunk.OUPURRDE.js +0 -1
- package/dist/preview/chunk.PD2DECOP.js +0 -1
- package/dist/preview/chunk.PKWQKFPE.js +0 -2
- package/dist/preview/chunk.RMR24LFJ.js +0 -4
- package/dist/preview/chunk.RRKI24WY.js +0 -1
- package/dist/preview/chunk.SGCW2XRC.js +0 -1
- package/dist/preview/chunk.SS7234R6.js +0 -1
- package/dist/preview/chunk.TKUNRFDE.js +0 -1
- package/dist/preview/chunk.U6ZRJKVM.js +0 -1
- package/dist/preview/chunk.UKQUUPKE.js +0 -1
- package/dist/preview/chunk.VC3V7HLL.js +0 -1
- package/dist/preview/chunk.VIH5AX7S.js +0 -5
- package/dist/preview/chunk.WKI5INH7.js +0 -1
- package/dist/preview/chunk.Y4S7CDRB.js +0 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Dt,f as yt,g as Sn}from"./chunk.A2R53GWF.js";import{h as yi}from"./chunk.Q2EGESEZ.js";import{e as pi,q as Xn,r as mi}from"./chunk.SMHP2CQH.js";import{b as Mn}from"./chunk.EJ4MSVX2.js";import{a as He,b as Vr,c as en,d as gi,e as Gr}from"./chunk.KQPKYWDM.js";import{a as fi}from"./chunk.QS32TO4N.js";import{a as ci,b as ui,c as hi}from"./chunk.57YDGGJK.js";import{b as ni,d as ri}from"./chunk.H7AH3IW4.js";import{c as Bo}from"./chunk.75GENXGP.js";import{a as oi,b as Dr,c as $r,f as Fr,g as Wr,h as jr,i as ii,j as Qt,k as Zt,p as Bt,q as Jt,r as di,s as li}from"./chunk.WUVXIUA7.js";import{A as ei,f as Yo,g as Xt,h as zo,i as _o,j as Ko,k as Uo,m as Un,n as vn,o as kn,p as qt,q as Br,v as Xo,w as qo,x as Qo,y as Zo,z as Jo}from"./chunk.OJGHDWI6.js";import{a as ai,b as si}from"./chunk.BN7C5ZYX.js";import{c as ti}from"./chunk.D5LOTCBU.js";import{$ as Kn,A as mt,B as Pr,C as xn,G as Ee,Ia as bn,K as kt,Na as Cr,Oa as Ir,Pa as Ht,Ra as Nr,T as Me,V as _n,Va as Hr,W as Lr,_ as Tr,a as Sr,aa as It,b as Mr,ba as ge,c as Er,d as Do,da as Nt,e as $o,f as Yn,h as Tt,ia as Wo,j as bt,ja as jo,k as Rr,l as zn,m as gn,ma as Ut,oa as Vo,p as Or,r as Se,s as Pe,t as Fo,u as wn,ua as Go,v as Le,w as Ct,x as vt,y as Ar}from"./chunk.CYTTZOYL.js";import{a as Kt}from"./chunk.SDO3U72B.js";import{Pc as yn,Sd as kr,Ud as Co,ga as Vn,ie as Io,ka as Lo,la as zt,le as No,na as _t,oa as Lt,od as $e,pa as Gn,se as Ho,ta as To}from"./chunk.Q4MI53KK.js";import{b as oe}from"./chunk.AJZBJBMO.js";var qn=oe(Ee(),1);var wi=oe(Me(),1);function Qn(e){let t=(0,qn.useRef)(e);t.current=e;let n=(0,qn.useRef)(null),o=(0,qn.useRef)(new Map),r=n.current;if(r&&(r.outer===e||ps(r.outer,e)))return r.outer=e,r.inner;let s=yt(e.view,null),i=(c,d,a)=>{let u=o.current.get(c);return u&&u.made===d?u.call:(o.current.set(c,{made:d,call:a}),a)},l=Object.fromEntries(Object.entries(e).map(([c,d])=>[c,c==="view"?s:c==="setView"?i(c,d,fs(t)):typeof d=="function"?i(c,d,(...a)=>t.current[c](...a)):d]));return n.current={outer:e,inner:l},l}function fs(e){return t=>e.current.setView(typeof t=="function"?t:n=>t.pan===void 0&&n.pan?{...t,pan:n.pan}:t)}function ps(e,t){let n=new Set([...Object.keys(e),...Object.keys(t)]);for(let o of n){if(o==="view"||o==="movedByHand")continue;let r=e[o],s=t[o];if(r!==s&&!(typeof r=="function"&&typeof s=="function"))return!1}return Yr(e.view,t.view)}function Yr(e,t){if(e===t)return!0;let n=new Set([...Object.keys(e),...Object.keys(t)]);for(let o of n)if(o!=="pan"&&e[o]!==t[o])return!1;return!0}function ms({children:e}){let t=Qn(ge());return(0,wi.jsx)(_n.Provider,{value:t,children:e})}var xi={width:1200,height:760,focusSize:{width:1200,height:420},relationSize:{width:240,height:140},contextSize:{width:300,height:104},gap:16,unit:16};var bi=(e,t)=>e?`${e.edgeKind}|${e.direction}`:`raised|${t}`,$t=(e,t,n)=>`${Pr}${e}|${t}|${n}`;function Zn(e,t){let n=e.map(()=>0),o=e.map((i,l)=>({size:i,index:l})).sort((i,l)=>i.size-l.size||i.index-l.index),r=Math.max(t,e.length),s=e.length;for(let{size:i,index:l}of o){let c=Math.max(1,Math.floor(r/s));n[l]=Math.min(i,c),r-=n[l],s-=1}return n}function _r(e){return bi(e.via,e.node.kind)}function tn(e,t,n=[]){let o=[],r=0;return e.forEach((s,i)=>{if(s<=0)return;let l=Math.min(t,Math.max(1,n[i]??1)),c=Math.max(s,l);if(o.length>0&&s<=t&&c<=r){o[o.length-1].push({run:i,cards:s,slots:c}),r-=c;return}let d=s,a=!0;for(;d>0;){let u=Math.min(t,d),h=a?Math.max(u,l):u;o.push([{run:i,cards:u,slots:h}]),d-=u,r=t-h,a=!1}}),o}function Kr(e,t,n,o=[]){let r=Zn(e,t*n);for(;tn(r,t,o).length>n;){let s=-1;if(r.forEach((i,l)=>{i>1&&(s<0||i>r[s])&&(s=l)}),s<0)break;r[s]=r[s]-1}return r}function ys(e,t,n){let o=r=>[t.chosen?.has(r.id)?0:1,t.hits?.has(r.id)?0:1,t.flagged?.has(r.id)?0:1,-(t.touched?.get(r.id)??0),-n.neighbors(r.id).length];return e.map((r,s)=>({node:r,index:s,key:o(r)})).sort((r,s)=>{for(let i=0;i<r.key.length;i++)if(r.key[i]!==s.key[i])return r.key[i]-s.key[i];return r.index-s.index}).map(r=>r.node)}var gs=5,ws=(e,t)=>{for(let n=0;n<e.length;n++)if(e[n]!==t[n])return e[n]<t[n];return!1};function vi(e,t,n){if(e.length===0||t<2)return;let o=e[0].kind,r={schema:n.schema,graph:n.graph,...n.today?{today:n.today}:{}},s=[];for(let l of pi(n.schema,o).groups)if(l.key!==n.exclude)if(l.buckets)for(let c of["decade","year","month"])s.push({by:l.key,bucket:c});else s.push({by:l.key});let i;return s.forEach((l,c)=>{let a=yi(e,{group:l},r).groups;if(a.length<2||a.length>t)return;let h=a.filter(b=>b.key!=="").reduce((b,p)=>b+p.nodes.length,0)/e.length;if(h<.5||a.some(b=>b.nodes.length>e.length*.75))return;let f=[-Math.round(h*100),Math.abs(a.length-gs),c];(!i||ws(f,i.score))&&(i={grouping:{by:l.by,...l.bucket?{bucket:l.bucket}:{},groups:a},score:f})}),i?.grouping}function Ur(e,t){let n=p=>({id:p.node.id,kind:p.node.kind,node:p.node,...p.via?{via:p.via}:{}});if(e.length<=t.budget)return e.map(n);let o={...t.relevance,chosen:new Set([...t.relevance?.chosen??[],...t.selection??[]])},r=new Map;for(let p of e){let y=bi(p.via,p.node.kind),x=r.get(y);x?x.push(p):r.set(y,[p])}let s=[...r.entries()].map(([p,y])=>({key:p,run:y,via:y[0].via,kinds:[...new Set(y.map(x=>x.node.kind))],members:[],whole:!1,extra:0})),i=Zn(s.map(p=>p.run.length),t.budget);s.forEach((p,y)=>p.whole=p.run.length<=i[y]);let l=s.filter(p=>!p.whole),c=s.filter(p=>p.whole).reduce((p,y)=>p+y.run.length,0),d=Math.max(l.length,t.budget-c);for(let p of l){p.members=ys(p.run.map(x=>x.node),o,t.graph);let y=d-(l.length-1);p.kinds.length>1&&p.kinds.length<=y?p.byKind=!0:p.kinds.length===1&&(p.grouping=vi(p.members,y,{schema:t.schema,graph:t.graph,...p.via?{exclude:p.via.edgeKind}:{},...t.today?{today:t.today}:{}}))}let a=p=>p.byKind?p.kinds.length:p.grouping?p.grouping.groups.length:1;for(;l.reduce((p,y)=>p+a(y),0)>d;){let p=[...l].filter(y=>a(y)>1).sort((y,x)=>a(x)-a(y))[0];if(!p)break;p.grouping=void 0,p.byKind=!1}d-=l.reduce((p,y)=>p+a(y),0);let u=p=>p.byKind?p.kinds.some(y=>t.expanded.has($t(y,p.key,"kind"))):p.grouping?.groups.some(y=>t.expanded.has($t(p.kinds[0],p.key,zr(p.grouping,y.key)))),h=l.filter(p=>!p.grouping&&!p.byKind?!0:u(p)),f=Zn(h.map(p=>p.members.length),Math.max(0,d));h.forEach((p,y)=>p.extra=d>0?f[y]:0);let b=[];for(let p of s){let{key:y,via:x}=p;if(p.whole){b.push(...p.run.map(n));continue}let v=g=>({id:g.id,kind:g.kind,node:g,...x?{via:x}:{}}),w=new Map(p.run.map((g,S)=>[g.node.id,S])),R=(g,S,L)=>{let A=[...g.slice(0,S)].sort((ee,T)=>w.get(ee.id)-w.get(T.id));b.push(...A.map(v));let F=g.slice(S);if(F.length===0)return;let X=F[0].kind;b.push({id:$t(X,y,L?`more:${L}`:"more"),kind:X,...x?{via:x}:{},aggregate:{kind:X,memberIds:F.map(ee=>ee.id),label:S>0?`${F.length} more ${t.plural(X).toLowerCase()}`:`${F.length} ${t.plural(X).toLowerCase()}`,opens:{in:"picture",focus:Le(X),within:L?{filter:L}:{}}}})},V=x&&t.focusId?`${x.edgeKind}:${t.focusId}`:void 0;if(p.byKind){let g=p.kinds.find(S=>t.expanded.has($t(S,y,"kind")));for(let S of p.kinds){let L=p.members.filter(A=>A.kind===S);if(S===g){let A=p.extra+1;L.length<=A?b.push(...L.map(v)):R(L,A-1,V);continue}b.push({id:$t(S,y,"kind"),kind:S,...x?{via:x}:{},aggregate:{kind:S,memberIds:L.map(A=>A.id),label:t.plural(S),opens:{in:"place"}}})}continue}let B=p.grouping;if(!B){R(p.members,p.extra,V);continue}let U=p.kinds[0],z=B.groups.find(g=>t.expanded.has($t(U,y,zr(B,g.key))));for(let g of B.groups){if(g===z){let S=p.members.filter(A=>g.nodes.includes(A)),L=p.extra+1;if(S.length<=L)b.push(...S.map(v));else{let A=g.key!==""&&!g.key.includes(",")&&!B.bucket,F=[V,A?`${B.by}:${g.key}`:void 0].filter(Boolean).join(",")||void 0;R(S,L-1,F)}continue}b.push({id:$t(U,y,zr(B,g.key)),kind:U,...x?{via:x}:{},aggregate:{kind:U,memberIds:p.members.filter(S=>g.nodes.includes(S)).map(S=>S.id),label:g.label.charAt(0).toUpperCase()+g.label.slice(1),opens:{in:"place"}}})}}return b}var zr=(e,t)=>`${e.by}${e.bucket?`:${e.bucket}`:""}=${t||"none"}`;var Jn=300,ki=12,nn=8,Xr=19;var er=(e,t=1)=>(e.length*8.4+16)*t;function En(e){return e.description??`${e.direction==="in"?"\u2190":"\u2192"} ${Vn(e.edgeKind).toLowerCase()}`}function qr(e,t,n=1){let o=l=>er(l,n),r=new Map;for(let l of e){let c=r.get(l.key);c?c.push(l):r.set(l.key,[l])}let s=[...r.values()].map(l=>{let c=Math.min(...l.map(a=>a.top)),d=l.filter(a=>a.top-c<=ki);return{key:l[0].key,text:l[0].text,left:Math.min(...d.map(a=>a.left)),right:Math.max(...d.map(a=>a.right)),top:c}});s.sort((l,c)=>l.top-c.top||l.left-c.left);let i=s.map(l=>{let c=Math.max(l.right-l.left,Math.min(Jn,o(l.text))),d=(l.left+l.right)/2;return{left:d-c/2,right:d+c/2}});return s.map((l,c)=>{let d=s.map((w,R)=>({other:w,at:R})).filter(({other:w})=>w!==l&&Math.abs(w.top-l.top)<=ki),a=d.filter(({other:w})=>w.right<=l.left).map(({other:w,at:R})=>i[R].right+nn<=(w.right+l.left)/2?i[R].right+nn:(w.right+l.left+nn)/2),u=d.filter(({other:w})=>w.left>=l.right).map(({other:w,at:R})=>i[R].left-nn>=(l.right+w.left)/2?i[R].left-nn:(l.right+w.left-nn)/2),h=Math.max(t.left,...a),f=Math.min(t.right,...u),b=l.right-l.left,p=i[c].right-i[c].left,y=Math.max(b,Math.min(p,f-h)),x=(l.left+l.right)/2,v=b>=y?l.left:Math.max(h,Math.min(x-y/2,f-y));return{key:l.key,text:l.text,left:v,width:y,top:l.top}})}function Mi(e,t,n,o,r=1){let s=l=>String(l).length*7.4,i=e.length*8.6+6+s(t)+14+(n>0?22+s(n):0);return{width:Math.max(i,o?184:0)*r,height:(o?38:22)*r,short:{width:i*r,height:22*r}}}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 Qr=(e,t,n,o)=>{let r=Math.max(e.x,Math.min(t.x,e.x+e.width)),s=Math.max(e.y,Math.min(t.y,e.y+e.height));return Math.abs(r-t.x)/n+Math.abs(s-t.y)/o<.92},Rn=4,Si=.45;function Zr(e,t,n,o={},r={}){let s={};for(let M of e)s[M.kind]=M.count;let i={x:(o.left??0)+8,y:(o.top??0)+8,width:n.width-(o.left??0)-(o.right??0)-16,height:n.height-(o.top??0)-(o.bottom??0)-16},l=r.avoid??[],c=r.tilt??.5,d=M=>M.nameplate??{width:120,height:34,short:{width:90,height:20}},a=M=>e.map(E=>{let k=M.get(E.kind);return{card:E,plot:k,center:en(k.col+k.side/2,k.row+k.side/2,1,c)}}),u=(M,E)=>{let k=1/0,D=-1/0,P=1/0,$=-1/0;for(let{card:G,plot:J,center:Y}of M){let re=Y.x*E,Z=Y.y*E,j=J.side*E/2,pe=G.opened>0?d(G).width:d(G).short.width;k=Math.min(k,re-Math.max(j+(G.count>12?30:0),pe/2)),D=Math.max(D,re+Math.max(j,pe/2)),P=Math.min(P,Z-j*c-E*Si),$=Math.max($,Z+j*c+Rn+d(G).short.height)}return{minX:k,maxX:D,minY:P,maxY:$}},h=M=>{let E=4,k=160;for(let D=0;D<24;D++){let P=(E+k)/2,$=u(M,P);$.maxX-$.minX<=i.width&&$.maxY-$.minY<=i.height?E=P:k=P}return E},f=M=>{let E={...r.order?{order:r.order}:{},counts:s,...r.plots?{plots:r.plots}:{},pitch:M},k=Vr(t,E),D=Vr(t,{...E,upright:!0}),P=h(a(k)),$=h(a(D)),G=n.height>n.width&&$>=P?D:k;return{map:G,fitted:G===D?$:P}},b=[],p=new Map,y=0,x=(M,E={x:0,y:0})=>{let k=u(b,M),D=i.x+i.width/2-(k.minX+k.maxX)/2+E.x,P=i.y+i.height/2-(k.minY+k.maxY)/2+E.y;return{originX:D,originY:P,cell:M}},v=M=>{let{originX:E,originY:k,cell:D}=M,P=b.map(({center:J})=>J.y),$=Math.max(...P),G=Math.min(...P);return b.map(({card:J,plot:Y,center:re})=>{let Z=E+re.x*D,j=k+re.y*D,pe=Y.side*D/2,le=pe*c,ve=$===G?.5:(re.y-G)/($-G);return{card:J,plot:Y,x:Z,y:j,halfW:pe,halfH:le,depth:1-ve*.65}})},w=(M,E=!0)=>{let k=[];return[...M].sort((P,$)=>($.card.weight??$.card.count)-(P.card.weight??P.card.count)||e.indexOf(P.card)-e.indexOf($.card)).filter(P=>[d(P.card),d(P.card).short].some($=>{let G=B(P,$),J=(!E||G.x>=0&&G.y>=0&&G.x+G.width<=n.width&&G.y+G.height<=n.height)&&!k.some(Y=>Ft(G,Y,4))&&!M.some(Y=>Y!==P&&Qr(G,Y,Y.halfW,Y.halfH))&&!l.some(Y=>Ft(G,Y,0));return J&&k.push(G),J})).length},R=M=>M.card.marquee?{x:M.x-M.card.marquee.width/2,y:M.y+M.halfH+Rn+d(M.card).height,width:M.card.marquee.width,height:M.card.marquee.height}:null,V=(M,E,k)=>k.some(D=>{if(D===E)return!1;let P=R(D);return P!==null&&Ft(M,P,4)}),B=(M,E,k="under")=>k==="aside"?{x:M.x+M.halfW+Rn,y:M.y-E.height/2,width:E.width,height:E.height}:k==="above"?{x:M.x-E.width/2,y:M.y-M.halfH-Rn-Si*S.cell-E.height,width:E.width,height:E.height}:{x:M.x-E.width/2,y:M.y+M.halfH+Rn,width:E.width,height:E.height},U=M=>M.some(E=>l.some(k=>Qr(k,E,E.halfW,E.halfH)||Ft(k,B(E,d(E.card).short),0))),z=M=>M.every(E=>{let k=B(E,d(E.card).short);return E.x-E.halfW>=0&&E.x+E.halfW<=n.width&&E.y-E.halfH>=0&&k.x>=0&&k.x+k.width<=n.width&&k.y+k.height<=n.height}),g={pitch:He,said:-1};for(let M of[He,He+1,He+2,He+3,He+5,He+7]){({map:p,fitted:y}=f(M)),b=a(p);let E=w(v(x(y)));if(E>g.said&&(g={pitch:M,said:E}),E===e.length)break}(g.pitch!==He+7||g.said!==e.length)&&({map:p,fitted:y}=f(g.pitch),b=a(p));let S=x(y);if(l.length>0&&U(v(S))){let M;for(let E=1;E>=.3&&!M;E-=.05){let k=y*E,D=Math.max(...l.map($=>$.width))/2+k,P=Math.max(...l.map($=>$.height))/2+k/2;for(let $ of[0,.5,.75,1,1.25]){for(let[G,J]of[[1,0],[-1,0],[0,1],[0,-1],[1,1],[-1,1],[1,-1],[-1,-1]]){let Y=x(k,{x:G*D*$,y:J*P*$}),re=v(Y);if(!U(re)&&z(re)){M=Y;break}if($===0)break}if(M)break}}M&&(S=M)}let L=(M,E)=>{let k={x:n.width/2,y:n.height/2};return{cell:M.cell*E,originX:k.x+(M.originX-k.x)*E,originY:k.y+(M.originY-k.y)*E}},A=1,F;if(w(v(S))<e.length){let M={said:w(v(S),!1),area:1/0,pitch:-1,by:1},E={map:p,shape:b,fitted:y,where:S};for(let $ of[He,He+1,He+2,He+3,He+5,He+7]){({map:p,fitted:y}=f($)),b=a(p);let G=x(y);for(let J=1;J<=3.001;J+=.1){let Y=w(v(L(G,J)),!1),re=u(b,y*J),Z=(re.maxX-re.minX)*(re.maxY-re.minY);if((Y>M.said||Y===M.said&&Z<M.area)&&(M={said:Y,area:Z,pitch:$,by:J}),Y===e.length)break}}M.pitch<0?{map:p,shape:b,fitted:y,where:S}=E:({map:p,fitted:y}=f(M.pitch),b=a(p),A=M.by,S=L(x(y),A));let k=r.stood&&Math.abs(r.stood.cell-S.cell)<.01?r.stood:null;k&&(S={...S,originX:S.originX+k.x,originY:S.originY+k.y});let D={x:S.originX-(k?.x??0),y:S.originY-(k?.y??0)},P=v(S).filter($=>r.keep?.includes($.card.kind));if(P.length>0){let $=P.flatMap(j=>[{x:j.x-j.halfW,y:j.y-j.halfH,width:j.halfW*2,height:j.halfH*2},B(j,d(j.card))]),G=Math.min(...$.map(j=>j.x)),J=Math.max(...$.map(j=>j.x+j.width)),Y=Math.min(...$.map(j=>j.y)),re=Math.max(...$.map(j=>j.y+j.height)),Z=(j,pe,le)=>pe-j>le-16?le/2-(j+pe)/2:j<8?8-j:pe>le-8?le-8-pe:0;S={...S,originX:S.originX+Z(G,J,n.width),originY:S.originY+Z(Y,re,n.height)}}F={x:S.originX-D.x,y:S.originY-D.y,cell:S.cell}}let X=r.zoom&&r.zoom!==1?r.zoom:1;X!==1&&(S=L(S,X));let ee=v(S),T=[],N=new Map,I=new Map,q=[...ee].sort((M,E)=>(E.card.weight??E.card.count)-(M.card.weight??M.card.count)||e.indexOf(M.card)-e.indexOf(E.card));for(let M of q){let E=[["full",d(M.card),"under"],["short",d(M.card).short,"under"]],k="none",D=M===q[0],P=(G,J)=>E.filter(([Y])=>Y.startsWith(J)).map(([Y,re,Z])=>[Y,re,Z,G]),$=D?[...P(!1,"full"),...P(!1,"short"),...P(!0,"full"),...P(!0,"short")]:E.map(([G,J,Y])=>[G,J,Y,!1]);for(let[G,J,Y,re]of $){let Z=B(M,J,Y);if((X!==1||A!==1||Z.x>=0&&Z.y>=0&&Z.x+Z.width<=n.width&&Z.y+Z.height<=n.height)&&!T.some(le=>Ft(Z,le,4))&&(re||!ee.some(le=>le!==M&&Qr(Z,le,le.halfW,le.halfH)))&&!V(Z,M,ee)&&!l.some(le=>Ft(Z,le,0))){k=G,T.push(Z),I.set(M.card.id,Z);break}}N.set(M.card.id,k)}let O=ee.map(M=>({id:M.card.id,x:M.x-M.halfW,y:M.y-M.halfH,width:M.halfW*2,height:M.halfH*2+(M.card.opened>0?Math.max(M.card.openedMin??0,M.card.opened):0),depth:M.depth,plot:M.plot,nameplate:N.get(M.card.id)??"none"})),H=u(b,S.cell),Q={cell:S.cell,originX:S.originX,originY:S.originY,pan:r.pan??{x:0,y:0},extent:{x:S.originX+H.minX,y:S.originY+H.minY,width:H.maxX-H.minX,height:H.maxY-H.minY},openedShare:1,...c!==.5?{tilt:c}:{},...F&&(F.x!==0||F.y!==0)?{stood:F}:{},...I.size>0?{nameplates:ee.flatMap(M=>{let E=I.get(M.card.id);return E?[{id:M.card.id,x:E.x-(M.x-M.halfW),y:E.y-(M.y-M.halfH),width:E.width,height:E.height}]:[]})}:{},...ee.some(M=>M.card.marquee)?{showings:ee.flatMap(M=>{let E=R(M);return E?[{id:M.card.id,x:E.x-(M.x-M.halfW),y:E.y-(M.y-M.halfH),width:E.width,height:E.height}]:[]})}:{}};return{placed:O,frame:Q,map:p}}function St(e){let{width:t,height:n}=e.visible??e,o={x:t*.45,y:n*.45};if(!e.city)return o;let{extent:r}=e.city,s=24;return{x:Math.max(o.x,r.x+r.width-t+s,-r.x+s),y:Math.max(o.y,r.y+r.height-n+s,-r.y+s)}}var tr=48;function Jr(e){if(!e.city)return[];let{width:t,height:n}=e.visible??e,o=[];for(let r of e.nodes){if(!r.id.startsWith("kind:")||Math.round(r.plane)!==2)continue;let s=r.x+r.width/2,i=r.y+r.height/2,l=s<0?"left":s>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,s)),a=(f,b)=>f<b/4?b/4-f:f>b*3/4?b*3/4-f:0,u=(f,b)=>f<tr?tr-f:f>b-tr?b-tr-f:0,h=c?{x:a(s,t),y:u(i,n)}:{x:u(s,t),y:a(i,n)};o.push({id:r.id,kind:r.id.slice(5),side:l,along:d,by:h})}return o}function eo(e,t,n,o,r){return{x:e.x+(n.x-e.x-t.x-o.x)*(1-r),y:e.y+(n.y-e.y-t.y-o.y)*(1-r)}}var xs={rankOf:()=>{},parentOf:()=>{}};function Ei(e,t){if(t.size===0)return xs;let n=e.kinds,o=new Map,r=(d,a)=>{d!==a&&((o.get(d)??o.set(d,new Set).get(d)).add(a),(o.get(a)??o.set(a,new Set).get(a)).add(d))};for(let d of n){let a=e.tryDefinition(d);if(a)for(let u of Object.values(a.edges??{})){let h=u.to==="*"?n:u.to;for(let f of h)r(d,f)}}let s=new Map,i=new Map,l=[...t].filter(d=>n.includes(d));for(let d of l)s.set(d,0);let c=0;for(;l.length>0;){c+=1;let d=[];for(let a of[...l].sort((u,h)=>n.indexOf(u)-n.indexOf(h)))for(let u of[...o.get(a)??[]].sort((h,f)=>n.indexOf(h)-n.indexOf(f)))s.has(u)||(s.set(u,c),c===2&&i.set(u,a),d.push(u));l=d}return{rankOf:d=>{let a=s.get(d);if(a!==0)return a===1?"primary":"secondary"},parentOf:d=>i.get(d)}}function Ri(e,t,n,o,r={}){if(n){let s=new Map;for(let i of e.allEdges()){if(o&&i.kind!==o)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||s.has(l))continue;let d=i.from===n.id?"out":"in",a=d==="out"?n.kind:c.kind,u=bs(t,a,i.kind,d);s.set(l,{node:c,via:{edgeKind:i.kind,direction:d,...u?{description:u}:{}}})}if(s.size>0){let i=l=>`${l.via.edgeKind}|${l.via.description??""}`;return[...s.values()].sort((l,c)=>(i(l)<i(c)?-1:i(l)>i(c)?1:0)||mt(l.node,c.node))}}if(n){let s=r[n.id]??[],i=new Set,l=[];for(let c of s){if(c===n.id||i.has(c))continue;let d=e.getNode(c);d&&(o&&o!=="judges"&&d.kind!==o||(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)=>mt(c.node,d.node))}return o?e.allNodes().filter(s=>s.kind===o).sort(mt).map(s=>({node:s})):[]}function bs(e,t,n,o){let s=e.tryDefinition(t)?.edges?.[n];return o==="out"?s?.description:s?.inverse}function Oi(e,t,n){let o=new Map,r=[...t.values()].sort((d,a)=>d.plane-a.plane);for(let d of r)for(let a of d.aggregate?.memberIds??[])!t.has(a)&&!o.has(a)&&o.set(a,d.id);let s=d=>t.get(d)??t.get(o.get(d)??""),i=new Map,l=new Map,c=new Map;for(let d of e.allEdges()){let a=s(d.from),u=s(d.to);if(!a||!u||a.id===u.id&&!(n.overview&&a.aggregate&&a.plane===2))continue;let h=`${d.kind}:${a.id}:${u.id}`,f=i.get(h);if(f){let b=`${d.from}
|
|
2
|
+
${d.to}`,p=l.get(h);if(p.has(b))continue;if(p.add(b),c.get(h).push({from:d.from,to:d.to}),f.single){let{single:y,...x}=f;i.set(h,x)}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:a.id,to:u.id,edges:[{from:d.from,to:d.to}],single:{from:d.from,to:d.to},...a.id===u.id?{loop:!0}:{},x1:a.x+a.width/2,y1:a.y+a.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(mt)}var Pi=.85,Ai=60,to=160;function vs(e,t,n,o,r,s=Pi){let i=e*t.width+Math.max(0,e-1)*n,l=Math.max(n,(o-i)/2);return Array.from({length:e},(c,d)=>({x:l+d*(t.width+n),y:r,depth:s}))}function nr(e,t,n,o={}){let r={...xi,...o},s=Math.max(8,r.unit??16)/16,i=r.inset?.left??0,l=n.overview?Math.max(0,r.dock?.right??0):0,c=n.overview?Math.max(0,r.dock?.bottom??0):0,d=r.width-l-i-(r.inset?.right??0),a=[],u=new Map,h=m=>n.past===!0||Lo(t.tryDefinition(m.kind),m,r.today),f=new Set(o.hiddenKinds??[]),b=m=>!f.has(m.kind),p=n.focusId?vt(n.focusId).filter(m=>t.tryDefinition(m)!==void 0).filter(m=>!f.has(m)):[];n.focusId&&vt(n.focusId).length>0&&p.length===0&&(n={...n,focusId:null});let y=n.focusId?e.getNode(n.focusId):void 0;y&&!b(y)&&(n={...n,focusId:null},p=[]);let x=p.length>0?[...e.allNodes()].filter(m=>p.includes(m.kind)).sort(mt):[],v=x.filter(b).filter(h),w=x.length-v.length,R=n.focusId&&p.length===0?e.getNode(n.focusId):void 0,V=n.zoom===!0&&!n.overview&&n.focusId!==null,B=Math.max(56,r.height*.062),U=Math.min(r.height*.895,r.height-B),z=V?R!==void 0?{focusY:r.height*.03,focusH:r.height*.58,relationY:r.height*.645,relationH:r.height*.2,contextY:U,contextH:B}:{focusY:r.height*.03,focusH:r.height*.71,relationY:r.height*.765,relationH:r.height*.1,contextY:U,contextH:B}:R===void 0?{focusY:r.height*.045,focusH:r.height*.62,relationY:r.height*.68,relationH:r.height*.2,contextY:r.height*.918,contextH:r.height*.082}:(()=>{let m=r.height,W=m*.04,_=Math.max(m*.42,Math.min(m*.56,300)),ie=W+_+m*.06;return{focusY:W,focusH:_,relationY:ie,relationH:Math.max(m*.12,m*.878-m*.068-ie),contextY:m*.878,contextH:m*.092}})(),g=Math.min(r.headroom??0,z.focusY+z.focusH*.2),S=g>z.focusY?{...z,focusY:g,focusH:z.focusH-(g-z.focusY)}:z,L=m=>Math.min(r.gap*m,Math.round(d*.1)),A=V?Math.min(880,d-L(5)):Math.min(700,d-L(6)),F=V?d-L(5):Math.min(r.focusSize.width,d-L(6)),X=(m,W,_)=>({width:m===0?W:Math.min(W,(d-r.gap*(m+1))/m),height:_}),ee=(m,W,_)=>{let ie=X(m,W,_),ke=Math.min(W,to*s,d-r.gap*2);return ie.width>=ke?ie:{width:ke,height:_}},T=m=>Math.max(1,Math.floor((d-r.gap)/(Math.min(m,to*s,d-r.gap*2)+r.gap))),N=new Set(n.expanded),I=n.overview?[]:Ri(e,t,R,n.relation,r.judged).filter(m=>b(m.node)).filter(m=>h(m.node)),q=n.overview?0:Math.max(0,Ai*s-S.contextH),O=I.length>0?S.focusH:S.contextY-S.focusY-r.gap*2-q,H=F,Q=r.height,M=Math.min(d*.5/H,r.height*.48/Q),E=H*M,k=Q*M,D=new Set(o.plainGroups??[]),P=n.overview&&!R&&p.length>0&&n.focusId!==null,$=P&&p.length>0&&p.every(m=>D.has(m));if(P)for(let m of p)$&&o.besideTheMap!==!0?N.add(Se(m)):N.delete(Se(m));let G=P&&!$&&p.length===1?p[0]:void 0,J=G!==void 0&&(o.screens?.[G]?.length??0)>0,Y,re=n.overview===!0&&R!==void 0&&o.besideTheMap===!0;n.overview&&(R||p.length>0)&&n.focusId&&!$&&!J&&!(P&&o.besideTheMap===!0)&&!re?(Y={x:i+(d-E)/2,y:r.height*.53-k/2,width:E,height:k},mn({id:n.focusId,kind:R?R.kind:p[0],plane:0,x:Y.x,y:Y.y,width:E,height:k,natural:{width:H,height:Q},...R?{}:{aggregate:{kind:p.join("+"),memberIds:v.map(m=>m.id),label:o.plurals?.[n.focusId]??p.map(m=>Lt(t,m)).join(" and "),...w>0?{retired:w}:{}}}})):n.overview||(R?mn({id:R.id,kind:R.kind,plane:0,x:i+(d-A)/2,y:S.focusY,width:A,height:O}):p.length>0&&n.focusId&&mn({id:n.focusId,kind:p[0],plane:0,x:i+(d-F)/2,y:S.focusY,width:F,height:O,aggregate:{kind:p.join("+"),memberIds:v.map(m=>m.id),label:o.plurals?.[n.focusId]??p.map(m=>Lt(t,m)).join(" and "),...w>0?{retired:w}:{}}}));let Z=26,j=52,pe=22,le=Math.round(r.relationSize.width*.75),ve=Math.max(1,Math.floor((d-r.gap)/(le+r.gap))),Ae=r.unit/16,Te=new Map;for(let m of I){let W=_r(m),_=Te.get(W);_?_.push(m):Te.set(W,[m])}let Ce=[...Te.values()],ae=Ce.length>1,Ie=Math.max(r.gap,pe*Ae),Be=ae?Ie:r.gap,lt=Math.max(2,Math.floor((S.relationH+Be)/(Z*Ae+Be))),dn=Math.min(r.relationSize.width,(d-r.gap*(ve+1))/ve)+r.gap,te=Ce.map(m=>{let W=m[0].via;return!ae||!W?1:Math.ceil((Math.min(Jn*Ae,er(En(W),Ae))+r.gap)/dn)}),Ne=Ce.map(m=>m.length),Ot=tn(Ne,ve,te),Je=I.length>ve*lt||Ot.length>lt,ct={schema:t,graph:e,focusId:R?.id,expanded:N,...r.relevance?{relevance:r.relevance}:{},...n.selection?{selection:n.selection}:{},plural:m=>Lt(t,m),...r.today?{today:r.today}:{}},et=Je||ae?Ie:r.gap,Ue,je;if(!Je)Ue=Ce.flat().map(m=>({id:m.node.id,kind:m.node.kind,node:m.node,...m.via?{via:m.via}:{}})),je=Ot;else{let m=Math.max(1,Math.floor((S.relationH+et)/(j*Ae+et))),_=tn(Ne.map(()=>1),ve,te).length<=m?te:[],ie=Kr(Ne,ve,m,_),ke=Ce.map((ye,Oe)=>Ur(ye,{...ct,budget:ie[Oe]}));Ue=ke.flat(),je=tn(ke.map(ye=>ye.length),ve,_)}let Ve=je.length,Xe=Ve===1?S.relationH:(S.relationH-et*(Ve-1))/Ve,qe=X(Math.max(...je.map(m=>m.reduce((W,_)=>W+_.slots,0)),1),Ue.length<=2?Math.round(r.relationSize.width*1.35):r.relationSize.width,Xe),ut=[];{let m=qe.width+r.gap,W=[],_=0,ie=new Map;for(let ye of je.flat())ie.set(ye.run,(ie.get(ye.run)??0)+ye.cards);for(let ye=0;ye<Ce.length;ye++)W[ye]=_,_+=ie.get(ye)??0;let ke=Ce.map(()=>0);je.forEach((ye,Oe)=>{let pt=ye.reduce((xt,br)=>xt+br.slots,0),Wn=pt*qe.width+Math.max(0,pt-1)*r.gap,jn=i+Math.max(r.gap,(d-Wn)/2),cs=S.relationY+Oe*(Xe+et);for(let xt of ye){let br=xt.slots*m-r.gap,us=xt.cards*m-r.gap,hs=jn+(br-us)/2;for(let vr=0;vr<xt.cards;vr++)ut[W[xt.run]+ke[xt.run]++]={x:hs+vr*m,y:cs};jn+=xt.slots*m}})}Ue.forEach((m,W)=>{let _=ut[W];mn({id:m.id,kind:m.kind,plane:1,x:_.x,y:_.y,width:qe.width,height:qe.height,...m.via?{via:m.via}:{},...m.aggregate?{aggregate:m.aggregate}:{},...Je&&!m.aggregate?{compact:!0}:{}})});let ln=new Set(u.keys());for(let m of v)ln.add(m.id);let wt=new Map;for(let m of e.allNodes()){let W=wt.get(m.kind);W?W.push(m):wt.set(m.kind,[m])}let se=new Set(p.length>0?p:R?[R.kind]:[]),be=[];for(let m of t.kinds){if(f.has(m))continue;let W=wt.get(m)??[],_=W.filter(h);be.push({id:Se(m),kind:m,members:_.sort(mt),retired:W.length-_.length,...se.has(m)?{focused:!0}:{}})}for(let m of be)m.kind===n.relation&&(m.raised=!0);be.sort(mt);let Ge=Ei(t,se),tt=!n.overview&&t.kinds.some(m=>Ge.rankOf(m)==="primary"),Ye=[];for(let m of be)if(!n.overview&&N.has(m.id)&&m.members.length>0)for(let W of m.members)Ye.push({id:W.id,kind:W.kind});else{let W=tt?Ge.rankOf(m.kind):void 0,_=W==="secondary"?Ge.parentOf(m.kind):void 0;Ye.push({id:m.id,kind:m.kind,...m.raised?{raised:!0}:{},...m.focused?{focused:!0}:{},...n.overview&&N.has(m.id)?{opened:!0}:{},...W?{rank:W}:{},..._&&!N.has(Se(_))?{nestedUnder:Se(_)}:{},aggregate:{kind:m.kind,memberIds:m.members.map(ie=>ie.id),label:o.plurals?.[m.kind]??Lt(t,m.kind),...m.retired>0?{retired:m.retired}:{}}})}let Vt=2;if(Ye.length<=T((V?240:r.contextSize.width)*s))for(let m of Ye)delete m.nestedUnder;let Nn=new Map;for(let m of Ye){if(m.nestedUnder===void 0)continue;let W=Nn.get(m.nestedUnder)??0;W>=Vt?delete m.nestedUnder:Nn.set(m.nestedUnder,W+1)}let cn=Ye.filter(m=>m.nestedUnder!==void 0),ht=Ye.filter(m=>m.nestedUnder===void 0),Qe=T((V?240:r.contextSize.width)*s),un=!n.overview&&ht.length>Qe,Hn=Math.max(0,Qe-1),Bn=m=>m.focused?0:m.raised?1:2,Dn=new Set([...ht].map((m,W)=>({item:m,at:W})).sort((m,W)=>Bn(m.item)-Bn(W.item)||m.at-W.at).slice(0,Hn).map(({item:m})=>m.id)),At=new Set(un?ht.filter(m=>!Dn.has(m.id)).map(m=>m.id):[]),Yt=cn.filter(m=>!At.has(m.nestedUnder)),C=cn.filter(m=>At.has(m.nestedUnder)),ue=un?[...ht.filter(m=>Dn.has(m.id)),{id:Fo,kind:"",beyond:[...ht.filter(m=>At.has(m.id)),...C].map(m=>m.kind)}]:ht,me=n.overview?{width:Math.min(220,d/6.5),height:Math.min(92,r.height*.125)}:ee(ue.length,(V?240:r.contextSize.width)*s,S.contextH),Re=r.relevance?.flagged,ft=(m,W)=>{let _=Gr(t,m);if(!_)return{};let ie=_.values.map(()=>0),ke=0;for(let ye of W){let Oe=_.values.indexOf(e.getNode(ye)?.[_.field]);Oe<0?ke++:ie[Oe]++}return{states:{field:_.field,values:[..._.values.map((ye,Oe)=>({value:ye,tier:_.tiers[Oe],count:ie[Oe]})),...ke>0?[{value:null,tier:"waiting",count:ke}]:[]]}}},De=n.overview?Zr(ue.map(m=>{let W=m.aggregate?.memberIds??[],_=Re?W.filter(ie=>Re.has(ie)).length:0;return{id:m.id,kind:m.kind,count:W.length,opened:N.has(m.id)?Zt(Qt(W.length))*s:0,openedMin:N.has(m.id)?Zt(Math.min(jr,Qt(W.length)))*s:0,nameplate:Mi(m.aggregate?.label??Lt(t,m.kind),W.length,_,Gr(t,m.kind)!==void 0,s),weight:_*1e3+W.length,...p.includes(m.kind)&&(o.screens?.[m.kind]?.length??0)>0?{marquee:{width:$r+12,height:Fr(o.screens[m.kind].map(ie=>ie.title),$r,o.nameWidth)+8}}:{}}}),t,{width:r.width-l,height:r.height-c},r.chrome?{...r.inset,right:Math.min(r.inset?.right??0,8)}:r.inset??{},{...r.cityOrder?{order:r.cityOrder}:{},...r.plots?{plots:r.plots}:{},...o.cityZoom&&o.cityZoom!==1?{zoom:o.cityZoom}:{},...o.cityStood?{stood:o.cityStood}:{},keep:[...n.selection??[],...n.focusId?[n.focusId]:[]].flatMap(m=>m.startsWith("kind:")?[m.slice(5)]:m.startsWith("aggregate:")&&!m.includes("|")?[m.slice(10)]:re&&m===R?.id?[R.kind]:[]),...o.tilt!==void 0?{tilt:o.tilt}:{},pan:{x:n.pan?.x??0,y:n.pan?.y??0},...Y||r.chrome?.length?{avoid:[...Y?[Y]:[],...r.chrome??[]]}:{}}):null,hn=new Map(De?.placed.map(m=>[m.id,m.plot])??[]),fn=new Map(De?.placed.map(m=>[m.id,m.nameplate])??[]),pn=De?De.placed.map(({x:m,y:W,depth:_,width:ie,height:ke})=>({x:m,y:W,depth:_,width:ie,height:ke})):vs(ue.length,me,r.gap,d,S.contextY,V?.97:Pi).map(m=>({...m,x:m.x+i})),yr=.74,Pt=.8,ds=52*s,ls=86*s,gr=(m,W)=>Math.min(1,m+(1-m)*W),wr=new Map;ue.forEach((m,W)=>{let _=pn[W],ie=_.width??me.width,ke=_.height??me.height,ye=m.rank==="secondary"?yr:1,Oe=De?ie:Math.max(Math.min(ie,to*s),ie*ye),pt=De?ke:Math.max(Ai*s,ke*ye);wr.set(m.id,{x:_.x+(ie-Oe)/2,y:_.y+(ke-pt),depth:m.rank==="secondary"?gr(_.depth,.5):_.depth,width:Oe,height:pt})});let $n=[],Fn=pn[pn.length-1],xr=new Map;for(let m of Yt)xr.set(m.nestedUnder,(xr.get(m.nestedUnder)??0)+1);let Po=new Map;for(let m of Yt){let W=wr.get(m.nestedUnder);if(W){let _=xr.get(m.nestedUnder)??1,ie=Po.get(m.nestedUnder)??0;Po.set(m.nestedUnder,ie+1);let ke=.98,ye=me.width*Pt,Oe=Math.max(ls,Math.min(ye,W.width/(ke*(_-1)+1))),pt=Math.max(ds,me.height*Pt*(Oe/ye)),Wn=Oe*ke,jn=(_-1)*Wn+Oe;$n.push({...m,x:W.x+(W.width-jn)/2+ie*Wn,y:Math.max(0,W.y-pt+Math.min(pt*.5,16)),width:Oe,height:pt,depth:gr(W.depth,.8)})}else if(Fn){let _=me.width*Pt,ie=me.height*Pt;$n.push({...m,x:Fn.x,y:Fn.y,width:_,height:ie,depth:gr(Fn.depth??1,.8)})}}for(let m of ue)$n.push({...m,...wr.get(m.id)});return $n.forEach(m=>{mn({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(Zt(Math.min(jr,Qt(m.aggregate?.memberIds.length??0))),Zt(Qt(m.aggregate?.memberIds.length??0))*(De?.frame.openedShare??1))-ii)/Wr))}:{},...m.rank?{rank:m.rank}:{},...m.nestedUnder?{nestedUnder:m.nestedUnder}:{},...m.beyond?{beyond:m.beyond}:{},...hn.has(m.id)?{plot:hn.get(m.id)}:{},...fn.has(m.id)?{nameplate:fn.get(m.id)}:{},...De&&m.aggregate?ft(m.kind,m.aggregate.memberIds):{},depth:m.depth})}),{nodes:a,connectors:Oi(e,u,n),width:r.width,height:r.height,...De?{city:De.frame}:{},...n.pan&&(n.pan.x!==0||n.pan.y!==0)?{pan:{x:n.pan.x,y:n.pan.y}}:{},...l>0||c>0?{visible:{width:r.width-l,height:r.height-c}}:{}};function mn(m){let W=n.overview&&Pe(m.id)!==null?void 0:n.pins[m.id],_=W?{...m,x:W.x,y:W.y,pinned:!0}:{...m,pinned:!1},ie=n.pan?{..._,x:_.x+n.pan.x,y:_.y+n.pan.y}:_;a.push(ie),u.set(ie.id,ie)}}function no(e,t,n){let o=e.nodes.find(l=>l.id===t);if(!o||o.screenOf!==void 0)return null;let r={...o,x:n.x,y:n.y,pinned:!0},s=r.x+r.width/2,i=r.y+r.height/2;return{...e,nodes:e.nodes.map(l=>l.id===t?r:l),connectors:e.connectors.map(l=>l.from===t?{...l,x1:s,y1:i}:l.to===t?{...l,x2:s,y2:i}:l)}}function ro(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}}}:{},pan:{x:t.x,y:t.y}}}var we=(e,t,n)=>e+(t-e)*n;function Li(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}var Ti=new WeakMap;function ks(e){let t=Ti.get(e);if(t)return t;let n=new Map,o=new Map;for(let r of e.nodes){n.set(r.id,r);for(let s of r.aggregate?.memberIds??[]){let i=o.get(s);i?i.push(r):o.set(s,[r])}}return t={byId:n,groupsOf:o},Ti.set(e,t),t}var Ci=new WeakMap;function Ii(e,t){let n=Ci.get(t);if(n||Ci.set(t,n=new WeakMap),n.has(e))return n.get(e);let o=Ss(e,t);return n.set(e,o),o}function Ss(e,t){let{byId:n,groupsOf:o}=ks(t);if(e.screenOf!==void 0){let i=n.get(Se(e.screenOf));if(i)return{...e,x:i.x,y:i.y,width:i.width,height:i.height}}if(Ct(e.id)||Pe(e.id)!==null){let i=(e.aggregate?.memberIds??[]).map(a=>n.get(a)).filter(a=>a!==void 0);if(i.length===0)return null;let l=i.map(Li),c=l.reduce((a,u)=>a+u.x,0)/l.length,d=l.reduce((a,u)=>a+u.y,0)/l.length;return{...e,x:c-e.width/2,y:d-e.height/2}}let r=o.get(e.id)?.find(i=>i.id===Se(e.kind)||i.id===Le(e.kind));if(!r)return null;let s=Li(r);return{...e,x:s.x-e.width/2,y:s.y-e.height/2}}function it(e,t,n){let o=Math.max(0,Math.min(1,n)),r=new Map(e.nodes.map(a=>[a.id,a])),s=new Map(t.nodes.map(a=>[a.id,a])),i=[];for(let[a,u]of r){let h=s.get(a);if(h){i.push(oo(u,h,o,1));continue}let f=Ii(u,t)??u;i.push(oo(u,f,o,1-o))}for(let[a,u]of s){if(r.has(a))continue;let h=Ii(u,e)??u;i.push(oo(h,u,o,o))}let l=new Map(e.connectors.map(a=>[a.id,a])),c=new Map(t.connectors.map(a=>[a.id,a])),d=[];for(let[a,u]of l){let h=c.get(a);d.push(h?{...Ms(u,h,o),opacity:1}:{...u,opacity:1-o})}for(let[a,u]of c)l.has(a)||d.push({...u,opacity:o});return{nodes:i.filter(a=>a.opacity>0).sort((a,u)=>a.id<u.id?-1:a.id>u.id?1:0),connectors:d.filter(a=>a.opacity>0).sort((a,u)=>a.id<u.id?-1:a.id>u.id?1:0),width:we(e.width,t.width,o),height:we(e.height,t.height,o),t:o,...Ni(e.city,t.city,o)?{city:Ni(e.city,t.city,o)}:{},...e.pan||t.pan?{pan:{x:we(e.pan?.x??0,t.pan?.x??0,o),y:we(e.pan?.y??0,t.pan?.y??0,o)}}:{}}}function Ni(e,t,n){return e?t?{cell:we(e.cell,t.cell,n),...e.tilt!==void 0||t.tilt!==void 0?{tilt:we(e.tilt??.5,t.tilt??.5,n)}:{},originX:we(e.originX,t.originX,n),originY:we(e.originY,t.originY,n),pan:{x:we(e.pan.x,t.pan.x,n),y:we(e.pan.y,t.pan.y,n)},extent:{x:we(e.extent.x,t.extent.x,n),y:we(e.extent.y,t.extent.y,n),width:we(e.extent.width,t.extent.width,n),height:we(e.extent.height,t.extent.height,n)}}:e:t}function oo(e,t,n,o){return{id:t.id,kind:t.kind,plane:we(e.plane,t.plane,n),x:we(e.x,t.x,n),y:we(e.y,t.y,n),width:we(e.width,t.width,n),height:we(e.height,t.height,n),pinned:t.pinned,opacity:o,...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:we(e.depth??1,t.depth,n)},...t.natural?{natural:t.natural}:{}}}function Ms(e,t,n){return{...t,x1:we(e.x1,t.x1,n),y1:we(e.y1,t.y1,n),x2:we(e.x2,t.x2,n),y2:we(e.y2,t.y2,n)}}function rr(e){let t=Math.max(0,Math.min(1,e));return t<.5?4*t*t*t:1-(-2*t+2)**3/2}function Es(e,t){let n=[];for(let r=0;r<e.length;r+=1){let s=e[r],i=e[(r+1)%e.length];if(s.y===i.y)continue;let l=Math.min(s.y,i.y),c=Math.max(s.y,i.y);t<l||t>=c||n.push(s.x+(t-s.y)/(i.y-s.y)*(i.x-s.x))}n.sort((r,s)=>r-s);let o={x0:0,x1:0};for(let r=0;r+1<n.length;r+=2){let s={x0:n[r],x1:n[r+1]};s.x1-s.x0>o.x1-o.x0&&(o=s)}return o}function Rs(e){let t=1/0,n=-1/0;for(let o of e)o.y<t&&(t=o.y),o.y>n&&(n=o.y);return{top:t,bottom:n}}function Os(e){let t=0;for(let n=0;n<e.length;n+=1){let o=e[n],r=e[(n+1)%e.length];t+=o.x*r.y-r.x*o.y}return Math.abs(t)/2}function As(e){let t=0,n=0,o=0;for(let r=0;r<e.length;r+=1){let s=e[r],i=e[(r+1)%e.length],l=s.x*i.y-i.x*s.y;t+=l,n+=(s.x+i.x)*l,o+=(s.y+i.y)*l}if(Math.abs(t)<1e-9){let r=e.reduce((s,i)=>({x:s.x+i.x,y:s.y+i.y}),{x:0,y:0});return{x:r.x/e.length,y:r.y/e.length}}return{x:n/(3*t),y:o/(3*t)}}function Ps(e,t){let{room:n,height:o,size:r,floor:s,measure:i=Dr,lines:l=2}=t,c=(p,y)=>p.every(x=>i(x,y)<=n)&&p.length*y*1.15<=o;if(c([e],r))return{lines:[e],fontSize:r,whole:!0};let d=e.split(/\s+/);if(l>1&&d.length>1){let p=1,y=1/0,x=0;for(let w=0;w<d.length-1;w+=1){x+=d[w].length+1;let R=Math.abs(x-e.length/2);R<y&&(y=R,p=w+1)}let v=[d.slice(0,p).join(" "),d.slice(p).join(" ")];if(c(v,r))return{lines:v,fontSize:r,whole:!0};for(let w=r;w>=s;w-=r*.06)if(c(v,w))return{lines:v,fontSize:w,whole:!0}}for(let p=r;p>=s;p-=r*.06)if(c([e],p))return{lines:[e],fontSize:p,whole:!0};let a=i(e,s)/Math.max(1,e.length),u=Math.floor(n/a)-1;if(u<4||s*1.15>o)return null;let h=e.slice(0,u),f=h.lastIndexOf(" ");return{lines:[`${f>3?h.slice(0,f):h}\u2026`],fontSize:s,whole:!1}}var Ls=(e,t)=>e.x0<t.x1&&t.x0<e.x1&&e.y0<t.y1&&t.y0<e.y1;var K=oe(Ee(),1);var io=oe(Ee(),1),Ts=500,Cs=10;function Hi(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA"||e.tagName==="SELECT"?!0:e.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(e.type):!1}function Is(e){let t=typeof getSelection=="function"?getSelection():null;return t!==null&&!t.isCollapsed&&t.containsNode(e,!0)}function Ns(e){return e.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??e.closest("[data-graview-view]")?.getAttribute("data-graview-view")??void 0}function Bi({swallow:e,setMenuAt:t,setSelection:n}){let o=(0,io.useRef)(0),r=(0,io.useRef)(null),s=()=>{r.current&&clearTimeout(r.current.timer),r.current=null},i=(l,c,d)=>{let a=Ns(l);a&&n([a]),t(a?{x:c,y:d,on:a}:{x:c,y:d})};return{onContextMenu:l=>{let c=l.target;l.shiftKey||Hi(c)||Is(c)||(l.preventDefault(),!c.closest("[data-graview-popover], [data-graview-offstage]")&&(Date.now()-o.current<700||i(c,l.clientX,l.clientY)))},onPointerDown:l=>{if(s(),l.pointerType==="mouse"||!l.isPrimary)return;let c=l.target;if(Hi(c)||c.closest("[data-graview-popover], [data-graview-offstage], button, a, input, select, textarea"))return;let{clientX:d,clientY:a}=l;r.current={x:d,y:a,timer:setTimeout(()=>{r.current=null,o.current=Date.now(),e.current=!0,setTimeout(()=>e.current=!1,700),i(c,d,a)},Ts)}},onPointerMove:l=>{let c=r.current;c&&Math.hypot(l.clientX-c.x,l.clientY-c.y)>Cs&&s()},onPointerUp:s}}var Mt=oe(Ee(),1);function Di(e){let[t,n]=(0,Mt.useState)(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(e).matches);return(0,Mt.useEffect)(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia(e),r=()=>n(o.matches);return r(),o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[e]),t}function Hs(){let e=()=>typeof document>"u"?null:document.documentElement.getAttribute("data-graview-motion"),[t,n]=(0,Mt.useState)(e);return(0,Mt.useEffect)(()=>{if(typeof document>"u"||typeof MutationObserver>"u")return;let o=new MutationObserver(()=>n(e()));return o.observe(document.documentElement,{attributes:!0,attributeFilter:["data-graview-motion"]}),n(e()),()=>o.disconnect()},[]),t}function $i(e){let t=Di("(prefers-reduced-motion: reduce)"),n=Di("(prefers-reduced-transparency: reduce)"),o=Hs();return Jo({off:!e,reducedMotion:o==="reduce"||o!=="full"&&t,reducedTransparency:n})}var Bs=Xo*1.5,Ds=30;function Fi(e,t){let[n,o]=(0,Mt.useState)(!1),r=e&&!n;return(0,Mt.useEffect)(()=>{if(!r||!t||typeof requestAnimationFrame>"u")return;let s=[],i=0,l=0,c=d=>{if(i>0&&s.push(d-i),i=d,s.length>=Ds){if(!ei(s,Bs)){o(!0);return}s.length=0}l=requestAnimationFrame(c)};return l=requestAnimationFrame(c),()=>cancelAnimationFrame(l)},[r,t]),r}var Fe=oe(Ee(),1);var $s=520;function Fs(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Wi(e,t={}){let n=t.duration??$s,o=(t.enabled??!0)&&!Fs(),r=t.settle??!0,s=(0,Fe.useRef)(e),[,i]=(0,Fe.useState)(()=>it(e,e,1)),l=(0,Fe.useRef)(null);l.current??=it(e,e,1);let c=(0,Fe.useRef)(null),d=(0,Fe.useRef)(null);!o&&d.current!==e&&(d.current=e,l.current=it(e,e,1)),o&&(d.current=null);let a=(0,Fe.useRef)(null);return(0,Fe.useEffect)(()=>{if(!o||typeof requestAnimationFrame>"u"){if(s.current=e,d.current!==e){let v=it(e,e,1);l.current=v,i(v)}if(typeof requestAnimationFrame>"u"||!r)return;let x=requestAnimationFrame(()=>{let v=it(e,e,1);l.current=v,i(v)});return()=>cancelAnimationFrame(x)}if(s.current===e&&l.current.t>=1){if(!r)return;let x=requestAnimationFrame(()=>{let v=it(e,e,1);l.current=v,i(v)});return()=>cancelAnimationFrame(x)}let u=performance.now(),f=a.current!==null&&l.current.t<1&&u-a.current<n?a.current:u;a.current=f;let b=rr(Math.min(1,(u-f)/n)),p=s.current,y=x=>{let v=Math.min(1,(x-f)/n),w=b>=1?1:(rr(v)-b)/(1-b),R=it(p,e,Math.max(0,w));l.current=R,i(R),v<1?c.current=requestAnimationFrame(y):(a.current=null,s.current=e,c.current=requestAnimationFrame(()=>{let V=it(e,e,1);l.current=V,i(V),c.current=null}))};return c.current=requestAnimationFrame(y),()=>{c.current!==null&&cancelAnimationFrame(c.current);let x=l.current;s.current={...e,...x.city?{city:x.city}:{},pan:x.pan??{x:0,y:0},nodes:x.nodes.map(v=>({...v,plane:Math.round(v.plane)})),connectors:x.connectors}}},[e,n,o,r]),l.current}function ji(e=1100){let{store:t}=ge(),[n,o]=(0,Fe.useState)(()=>new Set);return(0,Fe.useEffect)(()=>{let r=null,s=t.subscribe(i=>{o(new Set(i.touched)),r&&clearTimeout(r),r=setTimeout(()=>o(new Set),e)});return()=>{s(),r&&clearTimeout(r)}},[t,e]),n}var Ws={marks:new Map,acts:[]};function Vi(e=4e3){let{store:t}=ge(),[n,o]=(0,Fe.useState)(Ws);return(0,Fe.useEffect)(()=>{let r=null,s=t.subscribe((i,l)=>{o(c=>{let d=new Map(c.marks),a=[...c.acts];for(let u of l){if(u.undoes!==void 0){let b=a.find(y=>y.batch===u.undoes||y.wrote.length>0),p=a.filter(y=>u.writes.some(x=>y.wrote.includes(x)));for(let y of p.length>0?p:b?[b]:[]){for(let x of y.wrote)d.delete(x);a=a.filter(x=>x.batch!==y.batch)}continue}if(u.author.kind!=="agent")continue;let h=u.author.id??"the seat";for(let b of u.writes)d.set(b,h);a.find(b=>b.batch===u.batch)?a=a.map(b=>b.batch===u.batch?{...b,wrote:[...new Set([...b.wrote,...u.writes])]}:b):a=[{batch:u.batch,who:h,intent:u.batchIntent??u.intent,at:u.at,wrote:[...u.writes]},...a].slice(0,12)}return d.size===c.marks.size&&a===c.acts&&d.size===0?c:{marks:d,acts:a}}),r&&clearTimeout(r),r=setTimeout(()=>o(c=>c.marks.size===0?c:{...c,marks:new Map}),e)});return()=>{s(),r&&clearTimeout(r)}},[t,e]),n}var Wt=oe(Me(),1),nt=16;function Gi({marks:e,questions:t=[],whereIs:n,stageRef:o,width:r,height:s}){if(e.size===0&&t.length===0)return null;let i=o.current,l=i?.getBoundingClientRect()??null,c=[];for(let[a,u]of e){let h=null;if(i&&l&&typeof CSS<"u"){let y=i.querySelector(`[data-graview-pick="${CSS.escape(a)}"]`)?.getBoundingClientRect();y&&y.width>0&&y.height>0&&(h={x:y.left-l.left,y:y.top-l.top,width:y.width,height:y.height})}if(h??=n(a),!h)continue;let f=Math.min(Math.max(h.x+h.width-nt/2,nt/2),r-nt/2),b=Math.min(Math.max(h.y-nt/4,nt/2),s-nt/2);c.push({id:a,who:u,x:f,y:b})}let d=[];for(let a of t){let u=n(a.id);u&&d.push({...a,x:Math.min(Math.max(u.x+u.width/2,nt),r-nt),y:Math.min(Math.max(u.y-nt/2,nt),s-nt)})}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:a,who:u,x:h,y:f})=>(0,Wt.jsx)("span",{className:"graview-seat-mark","data-testid":"seat-mark","data-graview-seat-mark":a,"data-graview-seat-who":u,title:`${u} just changed this`,"aria-hidden":"true",style:{left:h,top:f,"--graview-hue":yn(u)},children:"\u25C6"},a)),d.map(a=>(0,Wt.jsxs)("span",{className:"graview-seat-asking","data-testid":"seat-question","data-graview-seat-asking":a.id,title:a.asks,style:{left:a.x,top:a.y},children:[(0,Wt.jsx)("span",{"aria-hidden":"true",children:"?"}),(0,Wt.jsx)("span",{className:"graview-seat-asking-said",children:a.asks})]},`asking:${a.id}`))]})}var ne=oe(Me(),1);function js({hue:e,mode:t}){let n=t==="docked";return(0,ne.jsxs)("svg",{viewBox:"0 0 32 38","aria-hidden":"true",children:[(0,ne.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round",strokeLinecap:"round",children:[(0,ne.jsx)("line",{x1:"16",y1:"3.5",x2:"16",y2:"7"}),(0,ne.jsx)("circle",{cx:"16",cy:"2.6",r:"1.5",fill:"none"}),(0,ne.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,ne.jsx)("line",{x1:"11",y1:"12.5",x2:"21",y2:"12.5",strokeWidth:"2"}):(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.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,ne.jsx)("circle",{cx:"13.4",cy:"12.5",r:"1.25",fill:"currentColor",stroke:"none",opacity:n?.45:1}),(0,ne.jsx)("circle",{cx:"18.6",cy:"12.5",r:"1.25",fill:"currentColor",stroke:"none",opacity:n?.45:1}),t==="reading"?(0,ne.jsx)("line",{x1:"10.2",y1:"12.5",x2:"21.8",y2:"12.5",strokeWidth:"0.8",opacity:"0.7"}):null]}),(0,ne.jsx)("line",{x1:"16",y1:"16",x2:"16",y2:"18.5"}),(0,ne.jsx)("polygon",{points:"16,18.5 24,22.5 16,26.5 8,22.5",fill:"currentColor",fillOpacity:"0.22"}),(0,ne.jsx)("polygon",{points:"8,22.5 16,26.5 16,33.5 8,29.5",fill:"currentColor",fillOpacity:"0.08"}),(0,ne.jsx)("polygon",{points:"24,22.5 16,26.5 16,33.5 24,29.5",fill:"currentColor",fillOpacity:"0.3"}),t==="writing"?(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)("polyline",{points:"24,24 28.5,20.5"}),(0,ne.jsx)("line",{x1:"27.5",y1:"19",x2:"30",y2:"21.5",strokeWidth:"1.8"})]}):(0,ne.jsx)("line",{x1:"24",y1:"24",x2:"26.5",y2:"29"}),(0,ne.jsx)("line",{x1:"8",y1:"24",x2:"5.5",y2:"29"}),(0,ne.jsx)("path",{d:"M9.5 33.5 v2.2 h4"}),(0,ne.jsx)("path",{d:"M22.5 33.5 v2.2 h-4"})]}),(0,ne.jsx)("title",{children:`robot, ${t}`})]})}function Vs({hue:e}){return(0,ne.jsxs)("svg",{viewBox:"0 0 22 24","aria-hidden":"true",style:{color:`hsl(${Math.round(e)} 50% 48%)`},children:[(0,ne.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round",strokeLinecap:"round",children:[(0,ne.jsx)("circle",{cx:"11",cy:"6",r:"4.2"}),(0,ne.jsx)("path",{d:"M3 23 C3 15.5 6 13 11 13 C16 13 19 15.5 19 23"})]}),(0,ne.jsx)("title",{children:"somebody"})]})}function Yi({width:e,whereIs:t}){let{who:n,following:o,follow:r}=ge(),s=di([...n.values()],t,e);return s.length===0?null:(0,ne.jsx)("div",{className:"graview-occupants","data-testid":"occupants","data-graview-occupants":s.length,children:s.map((i,l)=>{if(i.kind==="over")return(0,ne.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,ne.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=Ho(i.presence)||"somebody";if(i.kind==="edge")return(0,ne.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:()=>r(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,ne.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,ne.jsx)("span",{className:"graview-figure-body",role:"img","aria-label":`${d}'s agent \u2014 ${i.mode}`,style:{cursor:"default"},children:(0,ne.jsx)(js,{hue:c,mode:i.mode})}),(0,ne.jsxs)("span",{className:"graview-figure-name",children:[d,"'s agent"]})]},`robot:${i.presence.participant}`);let a=o?.participant===i.presence.participant;return(0,ne.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":a?"":void 0,style:{transform:`translate(${i.point.x.toFixed(1)}px, ${i.point.y.toFixed(1)}px)`,"--graview-hue":c},children:[(0,ne.jsx)("button",{type:"button",className:"graview-figure-body","aria-label":`${d} is here${a?". Press to stop following":". Press to go where they go"}`,"aria-pressed":a,onClick:u=>{u.stopPropagation(),r(a?null:i.presence.participant)},onPointerDown:u=>u.stopPropagation(),children:(0,ne.jsx)(Vs,{hue:c})}),(0,ne.jsx)("span",{className:"graview-figure-name",children:d})]},`person:${i.presence.participant}`)})})}var ir=oe(Ee(),1),Pn=oe(Me(),1),zi={left:"\u2190",right:"\u2192",top:"\u2191",bottom:"\u2193"},ao=36,An=56;function _i({result:e,schema:t,chrome:n=[],onGo:o}){let r=Jr(e);if(r.length===0)return null;let s=a=>(a??[]).flatMap(u=>{let h=e.nodes.find(f=>f.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=s(e.city?.showings),l=s(e.city?.nameplates),c=[...i,...l,...n.map(a=>({left:a.x,top:a.y,right:a.x+a.width,bottom:a.y+a.height}))],d=[];for(let a of["left","right","top","bottom"]){let u=e.visible??e,h=a==="left"||a==="right"?u.height:u.width,f=a==="left"||a==="right",b=a==="bottom"?zs:a==="top"?An:_s+An/2,p=-1/0,y=[],x=r.filter(v=>v.side===a).sort((v,w)=>v.along-w.along);for(let v of x){let w=Gn(t,v.kind),R=Gs(w),V=f?or:R/2,B=h-b-(f?0:V),U=Math.max(An,v.along,p+V+Ys);if(U>B)continue;let{at:z,inset:g}=Ks([...c,...y],a,U,R,u,h);if(z>B+.5)continue;p=z+V,y.push(Ki(a,z,R,u,g));let S=a==="left"?{left:g,top:z,transform:"translateY(-50%)"}:a==="right"?{right:`calc(${g}px + var(--graview-dock, 0px))`,top:z,transform:"translateY(-50%)"}:a==="top"?{top:g,left:z,transform:"translateX(-50%)"}:{bottom:`calc(${g}px + var(--graview-scene-foot, var(--graview-sheet, 0px)))`,left:z,transform:"translateX(-50%)"};d.push((0,Pn.jsx)("button",{type:"button",className:"graview-edge-sign","data-graview-past-edge":v.id,"aria-label":`${w}, past the ${a} edge \u2014 bring it into view`,title:`${w} is past the ${a} edge`,tabIndex:-1,onPointerDown:L=>L.stopPropagation(),onClick:L=>{L.stopPropagation(),o(v.by)},style:{...Us,...S},children:a==="right"||a==="bottom"?`${w} ${zi[a]}`:`${zi[a]} ${w}`},v.id))}}return(0,Pn.jsx)(Pn.Fragment,{children:d})}var Gs=e=>(e.length+2)*7.4+22,or=ao/2,On=6,Ys=6,zs=236,_s=56;function Ki(e,t,n,o,r=On){return e==="left"||e==="right"?{left:e==="left"?r:o.width-r-n,right:e==="left"?r+n:o.width-r,top:t-or,bottom:t+or}:{left:t-n/2,right:t+n/2,top:e==="top"?r:o.height-r-ao,bottom:e==="top"?r+ao:o.height-r}}function Ks(e,t,n,o,r,s){let i=t==="left"||t==="right",l=p=>Ki(t,p,o,r),c=p=>e.find(y=>{let x=l(p);return x.left<y.right&&y.left<x.right&&x.top<y.bottom&&y.top<x.bottom}),d=c(n);if(!d)return{at:n,inset:On};let a=i?or:o/2,u=p=>{let y=n;for(let x=0;x<12;x++){let v=c(y);if(!v)return y;if(y=p>0?(i?v.bottom:v.right)+a+4:(i?v.top:v.left)-a-4,y>s-An||y<An)return null}return null},h=u(1);if(h!==null)return{at:h,inset:On};let f=u(-1);if(f!==null)return{at:f,inset:On};let b=t==="left"?d.right:t==="right"?r.width-d.left:t==="top"?d.bottom:r.height-d.top;return{at:n,inset:Math.max(On,b+4)}}var Us={position:"absolute",zIndex:$e.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 Ui(e){let[t,n]=(0,ir.useState)(null);return(0,ir.useLayoutEffect)(()=>{let o=e.current,r=null;for(let l=o?.parentElement??null,c=0;l&&!r&&c<4;l=l.parentElement,c++)r=l.querySelector(":scope > [data-graview-scene-trail]");if(!o||!r)return;let s=()=>{let l=o.getBoundingClientRect(),c=r.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(a=>a===d||a&&d&&a.x===d.x&&a.y===d.y&&a.width===d.width&&a.height===d.height?a:d)};if(s(),typeof ResizeObserver>"u")return;let i=new ResizeObserver(s);return i.observe(r),()=>i.disconnect()},[e]),t}var Et=oe(Ee(),1),Xs=180;function Xi({view:e,result:t,frame:n,panned:o,closer:r,screenId:s,setCamera:i}){let l=(0,Et.useRef)(new Map),c=Math.round((t.nodes.find(u=>u.id===s)?.height??0)/16),d=(0,Et.useRef)(e.overview??!1),a=(0,Et.useRef)(null);if((0,Et.useEffect)(()=>{if(!e.overview||!s||!t.city){if(d.current&&!e.overview)return;i(B=>B.x===0&&B.y===0?B:{x:0,y:0});return}let u=t.nodes.find(B=>B.id===s);if(!u)return;let h=r>1&&u.screenOf?t.nodes.find(B=>B.id===Se(u.screenOf)):void 0,f=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(f.x>=0&&f.y>=0&&f.x+f.width<=t.width&&f.y+f.height<=t.height&&!h)return;let p=24,y=(B,U,z)=>B<p?p-B:B+U>z-p?z-p-(B+U):0,x=St(t),v=e.pan??{x:0,y:0},w=h?o.x+(t.width/2-(f.x+f.width/2)):o.x+y(f.x,f.width,t.width),R=t.height/2-(f.y+f.height/2),V=h?o.y+(u.y+R<p?p-u.y:R):o.y+y(f.y,f.height,t.height);i({x:(h?w:Math.max(-x.x,Math.min(x.x,w)))-v.x,y:(h?V:Math.max(-x.y,Math.min(x.y,V)))-v.y})},[s,e.overview,r,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 f=en(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+o.x+f.x,y:n.city.originY+o.y+f.y})}l.current=u}return(0,Et.useEffect)(()=>{let u=e.overview??!1,h=d.current&&!u;if(d.current=u,u&&a.current&&(clearTimeout(a.current),a.current=null),!h)return;let f=e.focusId?vt(e.focusId)[0]:void 0,b=f?l.current.get(Se(f)):void 0,p=t.nodes.find(y=>y.id===e.focusId);if(!b||!p){i({x:0,y:0});return}i({x:b.x-(p.x+p.width/2),y:b.y-(p.y+p.height/2)}),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,i({x:0,y:0})},Xs)},[e.overview]),(0,Et.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),{gliding:()=>a.current!==null}}var sr=oe(Ee(),1),ar="[data-graview-view]";function qs(e,t){let n=null;for(let o=e?.closest(ar)??null;o&&t.contains(o);o=o.parentElement?.closest(ar)??null)n=o;return n}function qi(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 Qi(e,t,n){let o=(0,sr.useRef)({dock:t,reveal:n});o.current={dock:t,reveal:n},(0,sr.useEffect)(()=>{let r=e.current;if(!r)return;let s=c=>{let{dock:d}=o.current;if(c.key!=="Tab"||c.defaultPrevented||d.right<=0&&d.bottom<=0)return;let a=qi(r,d),u=[];for(let h of r.querySelectorAll(ar)){if(h.parentElement?.closest(ar)||h.inert||h.contains(document.activeElement))continue;let f=h.getBoundingClientRect(),b=Math.max(f.left,a.box.left),p=Math.min(f.right,a.box.right),y=Math.max(f.top,a.box.top),x=Math.min(f.bottom,a.box.bottom);p<=b||x<=y||!(d.right>0&&b>=a.right-1||d.bottom>0&&y>=a.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,a=qs(d,r);if(!a)return;let u=!0;try{u=d?.matches(":focus-visible")??!0}catch{}requestAnimationFrame(()=>{for(let h=a.parentElement;h;h=h===r?null:h.parentElement)h.scrollTop!==0&&(h.scrollTop=0),h.scrollLeft!==0&&(h.scrollLeft=0);u&&a.isConnected&&l(a)})},l=c=>{let d=qi(r,o.current.dock),a=c.getBoundingClientRect(),u=12,h=(p,y,x,v)=>v-x>y-p-2*u||x<p+u?p+u-x:v>y-u?y-u-v:0,f=h(d.left,d.right,a.left,a.right),b=h(d.top,d.bottom,a.top,a.bottom);(Math.abs(f)>=1||Math.abs(b)>=1)&&o.current.reveal(Math.round(f),Math.round(b))};return document.addEventListener("keydown",s,!0),r.addEventListener("focusin",i),()=>{document.removeEventListener("keydown",s,!0),r.removeEventListener("focusin",i)}},[e])}var he=oe(Ee(),1);function Ji(){let e=(0,he.useRef)(null),[t,n]=(0,he.useState)({right:0,bottom:0});return(0,he.useLayoutEffect)(()=>{let o=e.current;if(!o)return;let r=()=>{let i=o.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(r(),typeof ResizeObserver>"u")return;let s=new ResizeObserver(r);return s.observe(o),()=>s.disconnect()},[]),{probe:e,dock:t}}function ea(){let[e,t]=(0,he.useState)(null),n=(0,he.useRef)(null),o=(0,he.useRef)(0),r=(0,he.useCallback)(i=>{n.current=i,o.current===0&&(o.current=requestAnimationFrame(()=>{o.current=0,t(n.current)}))},[]),s=(0,he.useCallback)(()=>{o.current!==0&&cancelAnimationFrame(o.current),o.current=0;let i=n.current;return n.current=null,i&&t(null),i},[]);return{held:e,place:r,release:s}}function ta({stage:e,pan:t,setView:n,settled:o}){let r=(0,he.useRef)({x:0,y:0}),s=(0,he.useRef)(0),i=(0,he.useRef)(!1),l=(0,he.useRef)(o);l.current=o;let c=(0,he.useCallback)(()=>[...e.current?.querySelectorAll("[data-graview-world]")??[]],[e]),d=(0,he.useCallback)(({x:p,y})=>{let x=p===0&&y===0?"":`translate3d(${p}px, ${y}px, 0)`;for(let v of c())v.style.transform=x;Zi(e.current,p,y)},[c,e]),a=(0,he.useCallback)(()=>{s.current===0&&(s.current=requestAnimationFrame(()=>{s.current=0,d(r.current)}))},[d]),u=(0,he.useCallback)(()=>{i.current=!1;for(let p of c())p.style.transform="";Zi(e.current,0,0),l.current()},[c,e]),h=(0,he.useCallback)((p,y)=>{r.current={x:p.x-y.x,y:p.y-y.y},a()},[a]),f=(0,he.useCallback)(()=>{let{x:p,y}=r.current;return p===0&&y===0?!1:(s.current!==0&&cancelAnimationFrame(s.current),s.current=0,d({x:p,y}),r.current={x:0,y:0},i.current=!0,n(x=>{let v=x.pan??{x:0,y:0};return yt(x,{x:v.x+p,y:v.y+y})}),window.setTimeout(()=>{i.current&&u()},300),!0)},[n,u,d]);(0,he.useLayoutEffect)(()=>{i.current&&u()},[t,u]);let b=(0,he.useCallback)(()=>r.current,[]);return{shiftTo:h,settle:f,settling:i,offset:b}}function Zi(e,t,n){for(let o of e?.querySelectorAll(":scope > .graview-lattice, :scope > .graview-measure")??[]){if(t===0&&n===0){o.style.removeProperty("--graview-hand-x"),o.style.removeProperty("--graview-hand-y");continue}o.style.setProperty("--graview-hand-x",`${t}px`),o.style.setProperty("--graview-hand-y",`${n}px`)}}var Qs=4;function na({view:e,panned:t,limit:n,panWithin:o,moveByTransform:r,setView:s,setDragging:i,noteMoved:l,shift:c,district:d}){let a=(0,he.useRef)(!1),u=(0,he.useRef)(null),h=x=>{let v=e.pan??{x:0,y:0};u.current={kind:"pan",fromX:x.clientX,fromY:x.clientY,baseX:v.x,baseY:v.y,moved:!1}};return{onGroundDown:x=>{x.button===0&&(x.target.closest("[data-graview-view]")||h(x))},onCardDown:(x,v)=>{if(v.button===0){if(x.screenOf!==void 0&&!v.target.closest("[data-graview-grip]")){h(v);return}if(e.overview&&Pe(x.id)!==null){h(v);return}u.current={kind:"card",id:x.id,fromX:v.clientX,fromY:v.clientY,baseX:x.x-t.x,baseY:x.y-t.y,moved:!1}}},onDragMove:x=>{let v=u.current;if(!v)return;let w=x.clientX-v.fromX,R=x.clientY-v.fromY;if(!v.moved){if(Math.hypot(w,R)<Qs)return;v.moved=!0,i(!0),x.currentTarget.setPointerCapture(x.pointerId)}if(v.kind==="pan"){let V=o(n(),{x:v.baseX+w,y:v.baseY+R});r?c.shiftTo(V,e.pan??{x:0,y:0}):s(B=>yt(B,V))}else v.id&&d.place({id:v.id,x:v.baseX+w,y:v.baseY+R})},onDragUp:()=>{c.settle();let x=d.release();x&&s(v=>Sn(v,x.id,{x:x.x,y:x.y})),u.current?.moved&&(a.current=!0,setTimeout(()=>a.current=!1,0),l()),u.current=null,!c.settling.current&&i(!1)},swallow:a}}function ra({stage:e,view:t,setView:n}){let o=(0,he.useRef)({view:t,charge:0,coolUntil:0,lastScale:1});o.current.view=t;let r=(0,he.useRef)(()=>{}),s=(0,he.useRef)(()=>{});return(0,he.useEffect)(()=>{let i=e.current;if(!i)return;let l=(u,h)=>{let f=o.current;if(h<f.coolUntil)return;let b=f.view.overview??!1;u!==b&&(f.coolUntil=h+600,f.charge=0,n(gn(f.view,u)))},c=u=>{let h=o.current,f=h.view.overview??!1;if(u.ctrlKey){if(u.preventDefault(),!f){if(h.charge+=u.deltaY,Math.abs(h.charge)<60)return;h.charge>0?l(!0,performance.now()):h.charge=0;return}r.current(Math.exp(-u.deltaY*.004),u.clientX,u.clientY);return}!f||u.target?.closest("[data-graview-view], .graview-scroll, [data-graview-overlay], .graview-zoom")||(u.preventDefault(),s.current(-u.deltaX,-u.deltaY))},d=u=>{u.preventDefault(),o.current.lastScale=1},a=u=>{u.preventDefault();let h=o.current,f=u.scale??1;if(!(h.view.overview??!1)){f<.72&&l(!0,performance.now());return}let b=f/(h.lastScale||1);h.lastScale=f;let p=u;r.current(b,p.clientX,p.clientY)};return i.addEventListener("wheel",c,{passive:!1}),i.addEventListener("gesturestart",d),i.addEventListener("gesturechange",a),()=>{i.removeEventListener("wheel",c),i.removeEventListener("gesturestart",d),i.removeEventListener("gesturechange",a)}},[n,e]),{zoomAbout:r,panBy:s}}var oa={directed:"You",autonomous:"An agent","co-edited":"You and an agent",rule:"A rule"};function so(e,t){let n=new Set(e.map(r=>r.id)),o=new Set;for(let r of t){if(n.has(r)){o.add(r);continue}let s=e.find(i=>i.aggregate?.memberIds.includes(r));s&&o.add(s.id)}return o}function lo(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 co(e){return e.edgeChosen?.9:e.lit?.78:e.own*(e.anyLit?e.kit.dim:e.kit.rest)}function at(e,t){if(!e)return null;let n=Math.max(0,Math.min(2,Math.floor(e.plane))),o=Math.max(0,Math.min(2,Math.ceil(e.plane))),{scale:r}=n===o?Xt(n,t):zo(Xt(n,t),Xt(o,t),e.plane-n);return{x:e.x,y:e.y,width:e.width*r,height:e.height*r}}function rn(e,t){if(typeof getComputedStyle>"u"||getComputedStyle(e).visibility==="hidden")return null;let n=-1/0,o=-1/0,r=1/0,s=1/0,i=e.getBoundingClientRect();n=Math.max(n,i.left),o=Math.max(o,i.top),r=Math.min(r,i.right),s=Math.min(s,i.bottom);let l=e.parentElement;for(;l&&l!==t;){let d=getComputedStyle(l);if(d.overflowX!=="visible"||d.overflowY!=="visible"){let a=l.getBoundingClientRect();d.overflowX!=="visible"&&(n=Math.max(n,a.left),r=Math.min(r,a.right)),d.overflowY!=="visible"&&(o=Math.max(o,a.top),s=Math.min(s,a.bottom))}l=l.parentElement}if(r-n<=2||s-o<=2)return null;let c=t.getBoundingClientRect();return{x:n-c.left,y:o-c.top,width:r-n,height:s-o}}function We(e,t,n,o=!1){if(!e||typeof document>"u")return null;let r=e.querySelector(`[data-graview-view="${CSS.escape(t)}"]`);return r?rn(uo(r,n,o),e):null}function uo(e,t=!1,n=!1){return(t?e.querySelector(".graview-kind-block"):null)??e.querySelector('[data-graview-primitive="panel"], .graview-kind-face, .graview-kind-card')??(n?null:e.querySelector(':scope > [data-graview-primitive="chip"]'))??e}function dr(e,t,n,o,r){let s=d=>e.nodes.find(a=>a.id===d);if(r.startsWith("screen:")){let d=e.nodes.find(a=>a.id===Se(r.slice(7)));return d?We(t,d.id,!0)??at(d,n):null}let i=s(r),l=Pe(r);if(!i&&l!==null&&(i=s(Le(l))),!i&&Ct(r)){let[d]=vt(r);d&&(i=s(Se(d)))}if(!i){let d=o.places().find(a=>a.as===r);d&&(i=s(Le(d.kind))??s(Se(d.kind)))}if(i||(i=[...e.nodes].filter(d=>d.aggregate?.memberIds.includes(r)).sort((d,a)=>d.plane-a.plane)[0]),!i)return null;let c=e.city!==void 0;return We(t,i.id,c&&i.aggregate!==void 0&&Math.round(i.plane)===2)??at(i,n)}var st=oe(Ee(),1);var _e=oe(Ee(),1);var ze=oe(Me(),1);function da({title:e,name:t,path:n,maxHeight:o,children:r}){let s=(0,_e.useContext)(jo),[i,l]=(0,_e.useState)(void 0),[c,d]=(0,_e.useState)(void 0),[a,u]=(0,_e.useState)(void 0),[h,f]=(0,_e.useState)(!1),[b,p]=(0,_e.useState)(!1),y=(0,_e.useRef)(null),x=(0,_e.useRef)(null);(0,_e.useLayoutEffect)(()=>{let S=y.current,L=x.current;if(!S||!L||typeof ResizeObserver>"u")return;let A=()=>{u(S.clientHeight),d(L.offsetHeight||void 0)};A();let F=new ResizeObserver(A);return F.observe(S),F.observe(L),()=>F.disconnect()},[]);let v=Math.max(i??0,c??0)||void 0,w=!h&&v!==void 0&&a!==void 0&&v>a+1,R=s&&n?n:void 0,V=R&&s?.href?s.href(R):void 0,B=S=>S.stopPropagation(),U=S=>{B(S),!(V&&(S.metaKey||S.ctrlKey||S.shiftKey||S.button!==0))&&(S.preventDefault(),R&&s?.open(R))},z=V?{href:V}:{role:"link",tabIndex:0},g={onPointerDown:B,onDoubleClick:B,onKeyDown:S=>{S.key!=="Enter"&&S.key!==" "||(B(S),S.key==="Enter"&&S.currentTarget.tagName==="A"&&!S.currentTarget.hasAttribute("href")&&(S.preventDefault(),S.currentTarget.click()))}};return(0,ze.jsxs)("section",{"data-graview-preview":t,"aria-label":e,...h?{"data-graview-expanded":"","data-graview-overlay":""}:{},onKeyDown:h?S=>{S.key==="Escape"&&(S.stopPropagation(),f(!1))}:void 0,style:{...Zs,...h?Js:{}},children:[(0,ze.jsxs)("div",{style:ed,children:[(0,ze.jsx)("strong",{style:td,children:e}),R?(0,ze.jsx)("a",{"data-graview-preview-open":"",...z,"aria-label":`Open ${e}`,style:ia,...g,onClick:U,children:"Open"}):w||h?(0,ze.jsx)("button",{type:"button","data-graview-preview-expand":"","aria-expanded":h,"aria-label":`${h?"Collapse":"Expand"} ${e}`,style:{...ia,...aa},...g,onClick:S=>{B(S),f(L=>!L)},children:h?"Collapse":"Expand"}):null]}),(0,ze.jsxs)("div",{ref:y,"data-graview-preview-body":"",...i!==void 0?{"data-graview-content-height":i}:{},...w?{"data-graview-more":""}:{},onFocus:()=>p(!0),onBlur:()=>p(!1),style:{...nd,...o!==void 0&&!h?{maxHeight:o}:{},...b?{overflowClipMargin:4}:{}},children:[(0,ze.jsx)("div",{ref:x,"data-graview-preview-drawn":"",style:rd,children:(0,ze.jsx)(Wo.Provider,{value:l,children:r})}),w?(0,ze.jsx)("div",{"aria-hidden":"true","data-graview-preview-fade":"",style:od}):null,w?R?(0,ze.jsx)("a",{"data-graview-preview-more":"",...z,"aria-label":`More of ${e}`,style:sa,...g,onClick:U,children:"More"}):(0,ze.jsx)("button",{type:"button","data-graview-preview-more":"","aria-label":`More of ${e}`,style:{...sa,...aa},...g,onClick:S=>{B(S),f(!0)},children:"More"}):null]})]})}var Zs={display:"flex",flexDirection:"column",gap:"var(--graview-gap, 7px)",width:"100%",maxHeight:"100%",minHeight:0,padding:"var(--graview-pad, 15px)",boxSizing:"border-box",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge, #e4e0d8)",boxShadow:"var(--graview-lift-low)",background:"var(--graview-panel, #ffffff)",color:"var(--graview-ink, #1a1a1a)",overflow:"hidden"},Js={maxHeight:"none",position:"absolute",top:0,left:0,right:0,width:"auto"},ed={display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:8,minWidth:0,flex:"0 0 auto"},td={fontFamily:"var(--graview-font-display, inherit)",fontSize:"0.9375rem",lineHeight:1.25,fontWeight:560,letterSpacing:"0.005em",minWidth:0,overflowWrap:"anywhere"},ia={marginLeft:"auto",fontSize:"0.8125rem",fontWeight:560,color:"var(--graview-accent, #2f6f5e)",textDecoration:"none",textUnderlineOffset:"0.2em"},aa={font:"inherit",fontSize:"0.8125rem",fontWeight:560,background:"none",border:0,padding:0,cursor:"pointer"},nd={position:"relative",flex:"0 1 auto",minHeight:0,overflowX:"visible",overflowY:"clip",minWidth:0},rd={display:"flow-root",minWidth:0},od={position:"absolute",left:0,right:0,bottom:0,height:64,pointerEvents:"none",background:"linear-gradient(to bottom, transparent, var(--graview-panel, #ffffff) 66%)"},sa={position:"absolute",right:0,bottom:0,lineHeight:1.5,fontSize:"0.8125rem",fontWeight:560,color:"var(--graview-accent, #2f6f5e)",textDecoration:"none",textUnderlineOffset:"0.2em"};var ce=oe(Me(),1),ca=(0,st.memo)(function({kinds:t}){let{store:n}=ge(),{view:o,go:r}=Ir(),s=(0,st.useRef)(null),i=Hr("districts",{align:"start"}),l=i.open,c=f=>Gn(n.schema,f),d=f=>n.graph.allNodes().filter(b=>b.kind===f).length,a=f=>!o.overview&&o.focusId===Le(f),u=t.filter(f=>!a(f)),h=f=>{i.setOpen(!1);let b=s.current?.querySelector(".graview-beyond-more")??null;a(f)||r(bt(o,Le(f))),b?.focus({preventScroll:!0});let p=`[data-graview-view="${Le(f)}"][tabindex], [data-graview-view="${Se(f)}"][tabindex]`,y=40,x=()=>{let v=document.querySelector(p);v?v.focus({preventScroll:!0}):--y>0&&requestAnimationFrame(x)};requestAnimationFrame(x)};return(0,ce.jsxs)("div",{ref:s,className:"graview-beyond","data-graview-beyond":t.length,"data-graview-beyond-open":l?"":void 0,children:[(0,ce.jsxs)("button",{type:"button",className:"graview-beyond-more","data-testid":"beyond-more",...i.trigger,"aria-haspopup":"menu",title:`${u.length} more district${u.length===1?"":"s"} \u2014 press to see them`,onPointerDown:f=>f.stopPropagation(),onClick:f=>{f.stopPropagation(),i.toggle()},children:[(0,ce.jsxs)("span",{className:"graview-beyond-count",children:["+",u.length]}),(0,ce.jsx)("span",{className:"graview-beyond-word",children:"more"}),(0,ce.jsx)("span",{className:"graview-beyond-chevron","aria-hidden":"true",children:l?"\u25BE":"\u25B4"})]}),l?(0,ce.jsx)("ul",{...i.pane,className:"graview-beyond-list",role:"menu","aria-label":"The other districts","data-testid":"beyond-list",style:Nr,onPointerDown:f=>f.stopPropagation(),children:t.map(f=>(0,ce.jsx)("li",{role:"none",children:(0,ce.jsxs)("button",{type:"button",role:"menuitem","data-graview-pick":Se(f),"aria-current":a(f)?"location":void 0,title:a(f)?`${c(f)} \u2014 where you are`:`Go to ${c(f)}`,onPointerDown:b=>b.stopPropagation(),onClick:b=>{b.stopPropagation(),h(f)},children:[(0,ce.jsx)("span",{className:"graview-beyond-name",children:c(f)}),(0,ce.jsx)("span",{className:"graview-beyond-tally",children:a(f)?"here":d(f)})]})},f))}):null]})},(e,t)=>e.kinds.length===t.kinds.length&&e.kinds.every((n,o)=>n===t.kinds[o]));function ua(e,t){if(e===t)return!0;let n=Object.keys(e);return n.length!==Object.keys(t).length?!1:n.every(o=>o==="x"||o==="y"||fo(e[o],t[o]))}function fo(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 r=t;if(e.length!==r.length)return!1;for(let s=0;s<e.length;s++)if(!fo(e[s],r[s]))return!1;return!0}let o=Object.keys(e);return o.length!==Object.keys(t).length?!1:o.every(r=>fo(e[r],t[r]))}var ha=(0,st.memo)(fa,(e,t)=>e.mode===t.mode&&e.selected===t.selected&&e.fidelity===t.fidelity&&ua(e.node,t.node));function fa({node:e,mode:t,selected:n,fidelity:o}){let{store:r,views:s,view:i}=ge(),l=Nt(),c=si(),d=ai(),a=e.aggregate||Ct(e.id)||Pe(e.id)!==null?"many":"one",u={cardinality:a,fidelity:o??Yo[ad(e.plane)].fidelity},h=a==="many"&&e.id===i.focusId?i.within?.view:void 0,f=s.resolve(e.kind,u,h),b=f?.view,p=s.resolve(e.kind,{cardinality:"many",fidelity:"full"})?.view,y=p!==void 0&&p.generic!==!0,x=e.aggregate?.memberIds,v=(0,st.useMemo)(()=>(x??[]).map(z=>r.graph.getNode(z)).filter(z=>z!==void 0),[x,r,l]),w={...e.aggregate?{nodes:v,label:f?.title??e.aggregate.label}:{node:r.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}:{},...y?{hasOwnView:!0}:{}};if(!b)return(0,ce.jsx)(sd,{node:e,props:w});let R=Go(b),V=!e.aggregate&&w.node?w.node:void 0,B=R?V?{title:zt(r.schema.tryDefinition(V.kind),V),name:V.id,path:Co(r.schema,V.kind,V.id)}:{title:w.label??e.kind,name:f?.title?kr(f.title):"",path:f?.title?`/places/${kr(f.title)}`:void 0}:void 0,U=[e.id,f?.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(z=>z.count).join(","):"",e.aggregate?ho(e.aggregate.memberIds):"",e.aggregate?.retired??"",c?ho(c):"",d?ho(d):"",y].join("|");return(0,ce.jsx)(Lr,{mode:t,children:(0,ce.jsx)(li,{kind:w.label??e.kind,...f?.title?{view:f.title}:{},children:(0,ce.jsx)(id,{signature:U,graph:l,draw:()=>R&&B?(0,ce.jsx)(da,{...B,maxHeight:R.maxHeight,children:(0,ce.jsx)(b,{...w})}):(0,ce.jsx)(b,{...w})})},`${e.id}|${f?.title??""}`)})}var id=(0,st.memo)(function({draw:t}){return(0,ce.jsx)(ce.Fragment,{children:t()})},(e,t)=>e.signature===t.signature&&e.graph===t.graph);function ad(e){return Math.max(0,Math.min(2,Math.round(e)))}function sd({node:e,props:t}){return(0,ce.jsxs)("div",{style:{padding:8,font:"13px/1.4 system-ui",overflow:"hidden"},children:[(0,ce.jsx)("strong",{children:t.label??e.kind}),t.nodes?(0,ce.jsxs)("div",{children:[t.nodes.length," items"]}):(0,ce.jsx)("div",{children:e.id})]})}var pa=(0,st.memo)(function({node:t}){let{store:n}=ge(),o=It(),r=t.aggregate,s=r.opens,i=r.memberIds.length,l=_t(n.schema,r.kind,i),c=r.memberIds.slice(0,3).map(h=>{let f=n.graph.getNode(h),b=f?n.schema.tryDefinition(f.kind):void 0;return f?b?.label?b.label(f):String(f.label??h):h}),d=r.memberIds,a=(0,st.useMemo)(()=>{let h=o?Kn(o):null;return h?d.filter(f=>h.has(f)).length:0},[o,d]),u=s.in==="picture";return(0,ce.jsxs)("div",{className:"graview-band-group","data-graview-band":s.in,"data-graview-band-count":i,"data-graview-emphasis":o?a>0?"lit":"dimmed":void 0,title:u?`${r.label} \u2014 press twice to see them all, arranged`:`${r.label}: ${l} \u2014 press twice to open`,children:[(0,ce.jsxs)("span",{className:"graview-band-group-head",children:[(0,ce.jsx)("span",{className:"graview-band-group-name",children:r.label}),(0,ce.jsx)("span",{className:"graview-band-group-open","aria-hidden":"true",children:u?"\u2197":"\u25BE"})]}),(0,ce.jsxs)("span",{className:"graview-band-group-names",children:[u?null:(0,ce.jsxs)("span",{className:"graview-band-group-count",children:[l,a>0?` \xB7 ${a} match`:""," \xB7 "]}),c.join(" \xB7 "),i>c.length?" \u2026":""]})]})},(e,t)=>ua(e.node,t.node)),la=new WeakMap;function ho(e){let t=la.get(e);if(t!==void 0)return t;let n=2166136261;for(let r of e){for(let s=0;s<r.length;s++)n=Math.imul(n^r.charCodeAt(s),16777619);n=Math.imul(n^44,16777619)}let o=`${e.length}:${(n>>>0).toString(36)}`;return la.set(e,o),o}var dt=oe(Ee(),1);function po(e,t,n){let o=e.aggregate?[...e.aggregate.memberIds]:[e.id];return n?o.every(s=>t.includes(s))?t.filter(s=>!o.includes(s)):[...t,...o.filter(s=>!t.includes(s))]:o}function ma(){let[e,t]=(0,dt.useState)(16);return(0,dt.useEffect)(()=>{if(typeof window>"u")return;let n=document.documentElement,o=()=>{let s=parseFloat(getComputedStyle(n).fontSize);Number.isFinite(s)&&t(i=>Math.abs(i-s)<.5?i:s)};o();let r=new MutationObserver(o);return r.observe(n,{attributes:!0,attributeFilter:["style"]}),window.addEventListener("resize",o),()=>{r.disconnect(),window.removeEventListener("resize",o)}},[]),e}function ya(e){let[t,n]=(0,dt.useState)(null);return(0,dt.useLayoutEffect)(()=>{let o=e.current?.getBoundingClientRect();!o||o.width===0||o.height===0||n(r=>r??{width:Math.round(o.width),height:Math.round(o.height)})},[e]),(0,dt.useEffect)(()=>{let o=e.current;if(!o||typeof ResizeObserver>"u")return;let r=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})},s=new ResizeObserver(l=>r(l[0]?.contentRect)),i=()=>r(o.getBoundingClientRect());return s.observe(o),addEventListener("resize",i),()=>{s.disconnect(),removeEventListener("resize",i)}},[e]),t}var dd=120;function ga(e){let t=(0,dt.useRef)(null);if(e===null)return t.current?.size??null;let n=t.current,o=typeof innerHeight=="number"?innerHeight:0;if(n&&n.size.width===e.width&&n.size.height===e.height)return n.size;let r=n?e.height-n.size.height:0,s=typeof navigator<"u"&&(navigator.maxTouchPoints>0||typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches);return n&&s&&e.width===n.size.width&&r>0&&r<=dd&&Math.abs(o-n.screen-r)<=1?n.size:(t.current={size:e,screen:o},e)}function mo(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)})`,o=`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}, ${o}`}function wa(e){return`matrix3d(${e.join(",")})`}var fe=oe(Ee(),1);var yo=(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 go(e,t){let n=[],o=[];for(let s=0;s<e.length-1;s++){let i=e[s],l=e[s+1],c=!yo(i,t);c&&o.length===0&&o.push(i);for(let d=1;d<=48;d++){let a=d/48,u={x:i.x+(l.x-i.x)*a,y:i.y+(l.y-i.y)*a},h=!yo(u,t);if(h===c)continue;let f=(d-1)/48,b=a;for(let x=0;x<10;x++){let v=(f+b)/2,w={x:i.x+(l.x-i.x)*v,y:i.y+(l.y-i.y)*v};!yo(w,t)===c?f=v:b=v}let p=(f+b)/2,y={x:i.x+(l.x-i.x)*p,y:i.y+(l.y-i.y)*p};h?o=[y]:(o.push(y),o.length>=2&&n.push(o),o=[]),c=h}c&&o.push(l)}return o.length>=2&&n.push(o),n}function Ln(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 s=(e.y+t.y)/2;return[e,{x:e.x,y:s},{x:t.x,y:s},t]}let r=(e.x+t.x)/2;return Math.abs(t.x-e.x)<2?[e,t]:[e,{x:r,y:e.y},{x:r,y:t.y},t]}var Ze=e=>Math.round(e*100)/100,Rt=e=>e.map(t=>t.map((n,o)=>`${o===0?"M":"L"} ${Ze(n.x)} ${Ze(n.y)}`).join(" ")).join(" ");function wo(e,t){if(e.length<3)return Rt([e]);let n=[`M ${Ze(e[0].x)} ${Ze(e[0].y)}`];for(let r=1;r<e.length-1;r++){let s=e[r-1],i=e[r],l=e[r+1],c=Math.hypot(i.x-s.x,i.y-s.y),d=Math.hypot(l.x-i.x,l.y-i.y),a=Math.min(t,c/2,d/2),u={x:i.x+(s.x-i.x)/(c||1)*a,y:i.y+(s.y-i.y)/(c||1)*a},h={x:i.x+(l.x-i.x)/(d||1)*a,y:i.y+(l.y-i.y)/(d||1)*a};n.push(`L ${Ze(u.x)} ${Ze(u.y)} Q ${Ze(i.x)} ${Ze(i.y)} ${Ze(h.x)} ${Ze(h.y)}`)}let o=e[e.length-1];return n.push(`L ${Ze(o.x)} ${Ze(o.y)}`),n.join(" ")}function xa(e,t){return t==="orthogonal"?Rt([e]):wo(e,10)}function ba(e,t,n){if(e==="orthogonal"){let l=Ln(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,a=n*d;for(let u=0;u<c.length;u++){let h=c[u];if(a<=h||u===c.length-1){let f=h===0?0:Math.min(1,a/h),b=l[u],p=l[u+1];return{x:b.x+(p.x-b.x)*f,y:b.y+(p.y-b.y)*f}}a-=h}return t.p1}let o=e==="straight"?{x:(t.p0.x+t.p1.x)/2,y:(t.p0.y+t.p1.y)/2}:t.c,r=(1-n)*(1-n),s=2*(1-n)*n,i=n*n;return{x:r*t.p0.x+s*o.x+i*t.p1.x,y:r*t.p0.y+s*o.y+i*t.p1.y}}function lr(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 va(e,t){let n=t.x-e.x,o=t.y-e.y,r=(n/2+o)/2,s=(o-n/2)/2;if(Math.abs(r)<1||Math.abs(s)<1)return[e,t];let i={x:e.x+2*r,y:e.y+r};return[e,i,t]}function ka(e){let t=[...e].sort((o,r)=>o.y-r.y||o.x-r.x),n=[];for(let o of t){let r=n.find(s=>o.y<s.bottom+3&&o.y+o.height>s.top-3);r?(r.boxes.push(o),r.top=Math.min(r.top,o.y),r.bottom=Math.max(r.bottom,o.y+o.height)):n.push({top:o.y,bottom:o.y+o.height,boxes:[o]})}for(let o of n)o.boxes.sort((r,s)=>r.x-s.x);return n.sort((o,r)=>o.top-r.top)}var Tn=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,bo=(e,t)=>e.findIndex(n=>n.boxes.some(o=>Tn(o,t)));function Sa(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 ko(e,t){let n=[{from:-1/0,to:1/0}];for(let s of e){let i=[],l=-1/0;for(let d of s.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 a of i){let u=Math.max(d.from,a.from),h=Math.min(d.to,a.to);h-u>=0&&c.push({from:u,to:h})}n=c}let o=t,r=1/0;for(let s of n){let i=Math.min(Math.max(t,s.from),s.to),l=s.from===-1/0||s.to===1/0,c=Math.abs(i-t)+(l?60:0);c<r&&(r=c,o=i)}return o}var rt=e=>({x:e.x,y:-(e.y+e.height),width:e.width,height:e.height}),cr=e=>e.map(t=>({x:t.x,y:-t.y}));function vo(e){let t=(o,r)=>Math.abs(o-r)<.5,n=e.filter((o,r)=>r===0||!(t(o.x,e[r-1].x)&&t(o.y,e[r-1].y)));return n.filter((o,r)=>{let s=n[r-1],i=n[r+1];return!s||!i||!(t(s.x,o.x)&&t(o.x,i.x)||t(s.y,o.y)&&t(o.y,i.y))})}function So(e,t,n){let o=e.boxes.filter(d=>!Tn(d,t)&&d.y+d.height<=t.y+1&&d.x<t.x+t.width&&d.x+d.width>t.x),r=[{from:t.x+6,to:t.x+t.width-6}];for(let d of o)r=r.flatMap(a=>[{from:a.from,to:Math.min(a.to,d.x-12/2)},{from:Math.max(a.from,d.x+d.width+12/2),to:a.to}]).filter(a=>a.to>=a.from);let s=null;for(let d of r){let a=Math.min(Math.max(n,d.from),d.to);(s===null||Math.abs(a-n)<Math.abs(s-n))&&(s=a)}if(s!==null)return{x:s,tail:[{x:s,y:t.y}]};let i=n<t.x+t.width/2,l=ko([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 xo(e,t,n){let o=So({top:-e.bottom,bottom:-e.top,boxes:e.boxes.map(rt)},rt(t),n);return{x:o.x,head:cr(o.tail).reverse()}}function Ma(e,t,n,o){let r=t;for(;r>o&&!e[r-1].boxes.some(s=>n>s.x-12/2&&n<s.x+s.width+12/2);)r--;return r}var Ea=(e,t)=>(e%3-1)*Math.max(0,Math.min(4,t/2-3));function Ra(e,t,n,o,r,s,i,l){let c=p=>p<0?e[0].top-n:e[p+1].top-e[p].bottom,d=p=>(p<0?(n+e[0].top)/2:Sa(e,p,p+1))+Ea(l,c(p)),a=So(e[s],r,i),u=Ma(e,s,a.x,t+1),h=d(t);if(u===t+1)return vo([...o.head,{x:o.x,y:h},{x:a.x,y:h},...a.tail]);let f=ko(e.slice(t+1,u),a.x),b=d(u-1);return vo([...o.head,{x:o.x,y:h},{x:f,y:h},{x:f,y:b},{x:a.x,y:b},...a.tail])}function on(e,t,n,o=0){let r=ka(n.some(a=>Tn(a,e))&&n.some(a=>Tn(a,t))?n:[...n,e,t]),s=bo(r,e),i=bo(r,t),l=e.x+e.width/2,c=t.x+t.width/2;if(s===i){if(!(s<r.length-1||r.length===1))return cr(on(rt(e),rt(t),n.map(rt),o));let u=Sa(r,s,s+1)+Ea(o,s<r.length-1?r[s+1].top-r[s].bottom:2*12),h=xo(r[s],e,c),f=xo(r[s],t,l);return vo([...h.head,{x:h.x,y:u},{x:f.x,y:u},...[...f.head].reverse()])}if(i<s)return cr(on(rt(e),rt(t),n.map(rt),o));let d=xo(r[s],e,c);return Ra(r,s,r[s].bottom,d,t,i,l,o)}function Mo(e,t,n,o=0){if(t.y+t.height<=e.y){let f=Mo(rt(e),rt(t),n.map(rt),o);return f?cr(f):null}let r=e.y+e.height;if(t.y<r)return null;let s=ka([...n.filter(f=>f.y>=r&&!Tn(f,t)),t]),i=bo(s,t),l=t.x+t.width/2,c=So(s[i],t,l),d=Ma(s,i,c.x,0),a=d===0?c.x:ko(s.slice(0,d),c.x),u=Math.min(12,e.width/2),h=Math.min(Math.max(a,e.x+u),e.x+e.width-u);return Ra(s,-1,r,{x:h,head:[{x:h,y:r}]},t,i,l,o)}function Oa(e,t=16){let n=new Map;for(let r of e){let s=r.a<r.b?`${r.a}\0${r.b}`:`${r.b}\0${r.a}`,i=n.get(s);i?i.push(r.key):n.set(s,[r.key])}let o=new Map;for(let r of n.values())r.forEach((s,i)=>o.set(s,(i-(r.length-1)/2)*t));return o}var Ke=oe(Me(),1);function Ro(e,t,n,o){let r=[];for(let s of e.querySelectorAll("[data-graview-relation] > span")){let i=s.getBoundingClientRect();if(i.width<=0||i.height<=0)continue;let l=i.top-t.top,c=s.parentElement?.getAttribute("data-graview-relation"),d=1/0;for(let a of n){if(Math.round(a.plane)!==1||!a.via||`${a.via.edgeKind}|${a.via.direction}`!==c)continue;let u=o(a.id);u&&u.y>=l+i.height-1&&(d=Math.min(d,u.y))}r.push({x:i.left-t.left,y:l,width:i.width,height:d-l<=i.height*4?d-l:i.height})}return r}function hr(e,t){let n=Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x),o=Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y);if(n>0&&o>0)return null;let r=n>.5*Math.min(e.width,t.width),s=!r&&o>.5*Math.min(e.height,t.height);if(r){let b={x:e.x+e.width,y:e.y+e.height/2},p={x:t.x+t.width,y:t.y+t.height/2};return{from:b,to:p,control:{x:Math.max(b.x,p.x)+18,y:(b.y+p.y)/2},mode:"stacked"}}if(s){let b={x:e.x+e.width/2,y:e.y},p={x:t.x+t.width/2,y:t.y};return{from:b,to:p,control:{x:(b.x+p.x)/2,y:Math.min(b.y,p.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=ur(e,i),d=ur(t,l),a=Math.hypot(d.x-c.x,d.y-c.y);if(a<8)return null;let u=Math.min(36,a*.12),h=-(d.y-c.y)/a,f=(d.x-c.x)/a;return{from:c,to:d,control:{x:(c.x+d.x)/2+h*u,y:(c.y+d.y)/2+f*u},mode:"direct"}}function ur(e,t){let n=e.x+e.width/2,o=e.y+e.height/2,r=t.x-n,s=t.y-o;if(r===0&&s===0)return{x:n,y:o};let i=r===0?1/0:e.width/2/Math.abs(r),l=s===0?1/0:e.height/2/Math.abs(s),c=Math.min(i,l),d=Math.max(0,c*.98);return{x:n+r*d,y:o+s*d}}function ld(e,t,n){let o=t.get(e.from),r=t.get(e.to);if(!o||!r)return!1;if(n)return!0;let s=Math.round(o.plane)===1||Math.round(r.plane)===1,i=l=>!!l.aggregate&&Math.round(l.plane)===2;return s&&!i(o)&&!i(r)}var Pa=e=>({clips:new Map,members:new Map,marks:new Map,...e?{owed:e}:{}});function La(e,t){let n=Pa();for(let[o,r]of t){let s=e.querySelector(`[data-graview-view="${CSS.escape(o)}"]`);if(s!==null){for(let i of r)if(an(e,s,i,n).length>0)return!0}}return!1}function Ta(e,t){let n=t.marks.get(e);if(n)return n;n=new Map;for(let o of e.querySelectorAll("[data-graview-pick], [data-graview-slot]"))for(let r of new Set([o.getAttribute("data-graview-pick"),o.getAttribute("data-graview-slot")])){if(r===null)continue;let s=n.get(r);s?s.push(o):n.set(r,[o])}return t.marks.set(e,n),n}function cd(e,t){let n=t.clips.get(e);if(n===void 0){let o=getComputedStyle(e);n=o.overflow!=="visible"||o.overflowX!=="visible"||o.overflowY!=="visible"?e.getBoundingClientRect():null,t.clips.set(e,n)}return n}function ud(e,t,n){let o=e.parentElement;for(;o!==null;){let r=cd(o,n);if(r&&!(t.right>r.left+1&&t.left<r.right-1&&t.bottom>r.top+1&&t.top<r.bottom-1))return!1;if(o.hasAttribute("data-graview-view"))break;o=o.parentElement}return!0}function an(e,t,n,o){if(!e||!t||typeof document>"u")return[];let r=o.members.get(t);r||o.members.set(t,r=new Map);let s=r.get(n);if(s)return s;let i=e.getBoundingClientRect(),l=[];for(let d of Ta(t,o).get(n)??[]){if(d.closest("[data-graview-offstage]"))continue;let a=d.getBoundingClientRect();a.width<=2||a.height<=2||ud(d,a,o)&&l.push({x:a.left-i.left,y:a.top-i.top,width:a.width,height:a.height})}l.sort((d,a)=>d.width*d.height-a.width*a.height),r.set(n,l);let c=t.getAttribute("data-graview-view");return l.length===0&&o.owed&&c!==null&&o.owed.set(c,(o.owed.get(c)??new Set).add(n)),l}function fr(e,t,n,o,r,s){let i=new Map(e.map(w=>[w.id,w])),l=Pa(s),c=new Map,d=w=>{if(!n||typeof document>"u")return null;let R=c.get(w);return R===void 0&&(R=n.querySelector(`[data-graview-view="${CSS.escape(w)}"]`),c.set(w,R)),R},a=new Map;for(let w of e){let R=We(n,w.id,o)??at(w,r);R&&a.set(w.id,R)}let u=new Map;if(n&&typeof document<"u"){let w=n.getBoundingClientRect();for(let R of n.querySelectorAll("[data-graview-pick], [data-graview-slot]")){if(R.closest("[data-graview-offstage]"))continue;let V=R.getAttribute("data-graview-pick")??R.getAttribute("data-graview-slot");if(V===null)continue;let B=R.getBoundingClientRect();if(B.width<=2||B.height<=2||B.width>w.width*.6&&B.height>w.height*.6)continue;let U=u.get(V),z={x:B.left-w.left,y:B.top-w.top,width:B.width,height:B.height};U?U.push(z):u.set(V,[z])}}let h=(w,R)=>{let V=[];for(let[B,U]of a)B!==w&&B!==R&&V.push(U);for(let[B,U]of u)B!==w&&B!==R&&V.push(...U);return V},f=w=>Math.round(i.get(w)?.plane??-1)===1,b=[];for(let w of e){let R=a.get(w.id);R&&Math.round(w.plane)===1&&b.push(R)}if(!o&&n&&typeof document<"u"){let w=n.getBoundingClientRect();b.push(...Ro(n,w,e,R=>a.get(R)))}let p=(w,R)=>!o&&f(w)&&f(R)?b:void 0,y=o?void 0:e.find(w=>Math.round(w.plane)===0&&!w.aggregate),x=(w,R,V,B)=>{if(!y)return{};let U=w.to===y.id&&V===y.id;if(!U&&!(w.from===y.id&&R===y.id))return{};let z=U?w.from:w.to,g=a.get(y.id),S=a.get(z);if(z===y.id||!f(z)||!g||!S)return{};let L=d(y.id),A=ee=>L!==null&&Ta(L,l).get(ee)?.some(T=>!T.closest("[data-graview-offstage]"))===!0,F=B.map(ee=>ee.from===y.id?ee.to:ee.from),X=F.length>0&&F.every(A);return{band:b,tie:{card:g,chip:S,cardIsTo:U,toward:z,holds:i.get(z)?.aggregate?.memberIds??[z]},...X?{said:F}:{}}},v=[];for(let w of t){if(!ld(w,i,o))continue;let R=a.get(w.from),V=a.get(w.to);if(!R||!V)continue;let B=h(w.from,w.to),U=w.edges,z=o&&U.some(L=>L.from!==w.from&&an(n,d(w.from),L.from,l).length>0||L.to!==w.to&&an(n,d(w.to),L.to,l).length>0),g=p(w.from,w.to);if(o&&!z||w.loop||U.length===0){v.push({key:w.id,connector:w,edges:U,fromBox:R,toBox:V,fromAnchor:w.from,toAnchor:w.to,obstacles:B,hosts:[],...g?{band:g}:{},...x(w,w.from,w.to,U)});continue}let S=new Map;for(let L of U){let A=L.from===w.from?[]:an(n,d(w.from),L.from,l),F=L.to===w.to?[]:an(n,d(w.to),L.to,l),X=[w.from,w.to].find(k=>Math.round(i.get(k)?.plane??-1)===0);if(!o&&X!==void 0&&(X===w.from?L.from!==w.from:L.to!==w.to)&&an(n,d(X),X===w.from?L.to:L.from,l).length>0)continue;let ee=X!==void 0?i.get(X):void 0;if(!o&&ee?.aggregate&&n&&(X===w.from?L.from!==w.from&&A.length===0:L.to!==w.to&&F.length===0))continue;let T=A.length>0?L.from:w.from,N=F.length>0?L.to:w.to,I=`${w.id}|${T}|${N}`,q=S.get(I);if(q){q.edges.push(L);continue}let O=A.length>0?A:[R],H=F.length>0?F:[V],Q=O[0],M=H[0],E=1/0;for(let k of O)for(let D of H){let P=Math.hypot(k.x+k.width/2-(D.x+D.width/2),k.y+k.height/2-(D.y+D.height/2));P<E&&(E=P,Q=k,M=D)}S.set(I,{edges:[L],fromBox:Q,toBox:M,fromAnchor:T,toAnchor:N})}for(let[L,A]of S)v.push({key:L,connector:w,obstacles:B,hosts:[...A.fromAnchor!==w.from?[R]:[],...A.toAnchor!==w.to?[V]:[]],...g?{band:g}:{},...A,...x(w,A.fromAnchor,A.toAnchor,A.edges)})}return v}function Ca(e,t,n){let o=new Map(t.map(i=>[i.id,i])),r=new Map;for(let i of n){let l=o.get(i.id);l&&(l.x!==i.x||l.y!==i.y)&&r.set(i.id,{x:i.x-l.x,y:i.y-l.y})}if(r.size===0)return[...e];let s=(i,l)=>{let c=r.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(!r.has(l)&&!r.has(c))return i;let d=s(i.fromBox,l),a=s(i.toBox,c),u=i.tie&&{...i.tie,card:s(i.tie.card,i.tie.cardIsTo?c:l),chip:s(i.tie.chip,i.tie.toward)},h=f=>f===i.fromBox?d:f===i.toBox?a:i.tie&&f===i.tie.chip?u.chip:f;return{...i,fromBox:d,toBox:a,...u?{tie:u}:{},...i.band?{band:i.band.map(h)}:{}}})}function Eo(e,t){let n=(1-t)*(1-t),o=2*(1-t)*t,r=t*t;return{x:n*e.p0.x+o*e.c.x+r*e.p1.x,y:n*e.p0.y+o*e.c.y+r*e.p1.y}}function Aa(e,t,n){let o=(1-t)*(1-n),r=(1-t)*n+t*(1-n),s=t*n;return{p0:Eo(e,t),c:{x:o*e.p0.x+r*e.c.x+s*e.p1.x,y:o*e.p0.y+r*e.c.y+s*e.p1.y},p1:Eo(e,n)}}function Cn(e,t){let n=d=>t.some(a=>d.x>a.x&&d.x<a.x+a.width&&d.y>a.y&&d.y<a.y+a.height),o=d=>!n(Eo(e,d)),s=(d,a,u)=>{for(let h=0;h<10;h++){let f=(d+a)/2;o(f)===u?d=f:a=f}return(d+a)/2},i=[],l=null,c=o(0);c&&(l=0);for(let d=1;d<=64;d++){let a=d/64,u=o(a);if(u===c)continue;let h=s((d-1)/64,a,c);u?l=h:l!==null&&(h-l>.001&&i.push(Aa(e,l,h)),l=null),c=u}return l!==null&&1-l>.001&&i.push(Aa(e,l,1)),i}function Ia({strands:e,result:t,scheme:n,overview:o,selection:r,emphasis:s,stageRef:i,liveOf:l,onPickEdge:c,provisional:d,pointed:a=null}){let u=Bt(),h=new Set(t.nodes.filter(g=>g.plot!==void 0&&Math.round(g.plane)===2).map(g=>g.id)),f=g=>o&&t.city!==void 0&&h.has(g.from)&&h.has(g.to),b=so(t.nodes,r),p=g=>b.size===0||b.has(g.from)||b.has(g.to),y=new Set(r.filter(g=>Tt(g)===null)),x=o?t.nodes.find(g=>Math.round(g.plane)===0):void 0,v=x?We(i.current,x.id,!1)??at(x,n):null;if(e.length===0)return null;let w=g=>g.edges.some(S=>y.has(S.from)||y.has(S.to)),R=y.size>0&&e.some(w),V=new Map;for(let g of e)V.set(g.connector.id,(V.get(g.connector.id)??0)+1);let B=Oa(e.map(g=>({key:g.key,a:g.fromAnchor,b:g.toAnchor}))),U=new Set,z=e.map((g,S)=>{let{connector:L,fromBox:A,toBox:F}=g,X={x:A.x+A.width/2,y:A.y+A.height/2},ee={x:F.x+F.width/2,y:F.y+F.height/2},T=o?ur(A,ee):X,N=o?ur(F,X):ee,I=L.loop===!0,{connector:q,style:O}=Jt(u,L.kind);if(!q.visible)return null;let H=I?Math.max(22,Math.min(A.width,A.height)*.3):0,Q=I?{x:X.x+A.width*.22,y:X.y-A.height/2-H+7}:T,M=(T.x+N.x)/2,E=(T.y+N.y)/2,k=Math.hypot(N.x-T.x,N.y-T.y),D=Math.min(o?40:90,k*(o?.09:.16)),P=0,$=0;if(k>0){P=-(N.y-T.y)/k,$=(N.x-T.x)/k;let se=M-t.width/2,be=E-t.height/2;if(v&&!I){let Ge=v.x+v.width/2,tt=v.y+v.height/2;se=M-Ge,be=E-tt;let Ye=Math.abs(P*(Ge-T.x)+$*(tt-T.y)),Vt=Math.hypot(v.width/2,v.height/2)*.85+24,Gt=((Ge-T.x)*(N.x-T.x)+(tt-T.y)*(N.y-T.y))/(k*k);Ye<Vt&&Gt>.1&&Gt<.9&&(D=Math.min(180,Math.max(D,(Vt-Ye)*2)))}P*se+$*be<0&&(P=-P,$=-$)}D+=2*(B.get(g.key)??0);let G=lr(q.route,{p0:T,c:{x:M+P*D,y:E+$*D},p1:N}),J=f(L),Y=q.route==="orthogonal"||J,re=(se,be)=>J?va(se,be):Ln(se,be),Z=!I&&g.tie?Mo(g.tie.card,g.tie.chip,g.band??[],S):null,j=Z?g.tie.cardIsTo?Z.reverse():Z:!I&&g.band?on(A,F,g.band,S):null,pe=I||Y||j?[]:Cn(G,[A,F,...g.obstacles]),le=j?[j]:!I&&Y?go(re(T,N),[A,F,...g.obstacles]):[];if(!I&&pe.length===0&&le.length===0)return null;let ve=le[le.length-1],Ae=Y||j?le[0]?.[0]:pe[0]?.p0,Te=Y||j?ve?.[ve.length-1]:pe[pe.length-1]?.p1,Ce=se=>se.map(be=>`M ${be.p0.x} ${be.p0.y} Q ${be.c.x} ${be.c.y} ${be.p1.x} ${be.p1.y}`).join(" "),ae=`M ${Q.x-H} ${Q.y} A ${H} ${H} 0 1 1 ${Q.x+H} ${Q.y} A ${H} ${H} 0 0 1 ${Q.x-H} ${Q.y}`,Ie=I?ae:j?xa(j,q.route):Y?Rt(le):Ce(pe),Be=se=>({x:se.x-8,y:se.y-8,width:se.width+16,height:se.height+16}),lt=[A,F,...g.hosts,...g.obstacles].map(Be),dn=I?ae:j?Rt(le):Y?Rt(go(re(T,N),lt)):Ce(Cn(G,lt)),te=g.edges.length===1?g.edges[0]:null,Ne=te?Dt(L.kind,te.from,te.to):null,Ot=Ne!==null&&r.includes(Ne),Je=Ne!==null?d?.get(Ne):void 0,ct=g.edges.some(se=>y.has(se.from)||y.has(se.to)),et=g.tie?.toward??"",Ue=g.tie!==void 0&&(a!==null&&(et===a||g.tie.holds.includes(a)||g.said?.includes(a)===!0)||y.has(et))&&!U.has(et);Ue&&U.add(et);let je=!o&&y.size>0&&ct||Ue,Ve=s!==null&&L.kind===s||Ot,Xe=l?.(L)!==void 0;if(o&&!Xe||!o&&!Xe&&y.size>0&&!ct&&!Ve&&!Ue||g.said!==void 0&&!Ue&&!g.said.some(se=>y.has(se))&&!Ve)return null;let qe=o?lo({emphasized:s!==null,stressed:Ve,anyChosen:R,mine:ct,touches:p(L),siblings:V.get(L.id)??1}):co({edgeChosen:Ot,lit:je,anyLit:R||s!==null,own:O.opacity,kit:u.emphasis}),ut=je&&Ae&&Te?g.tie?g.tie.cardIsTo?Ae:Te:g.edges.some(se=>y.has(se.from))?Te:Ae:null,ln=(0,Ke.jsxs)("g",{children:[(0,Ke.jsx)("path",{"data-graview-connector":L.kind,"data-graview-edges":g.edges.length,"data-graview-from":g.fromAnchor,"data-graview-to":g.toAnchor,"data-graview-lit":je||void 0,"data-graview-activity":l?.(L)?.manner,"data-graview-provisional":Je!==void 0||void 0,opacity:qe*(L.opacity??1)*(Je!==void 0?kn:1),d:Ie,fill:"none",stroke:qt(O),strokeWidth:(je?Math.max(1.6,Br(O,o)):Br(O,o))+(Ve?.6:0),strokeDasharray:Je!==void 0?vn:Un[O.pattern],strokeLinecap:"round"}),ut?(0,Ke.jsx)("circle",{cx:ut.x,cy:ut.y,r:2.6,fill:qt(O),opacity:qe}):null,I&&o?(0,Ke.jsx)("text",{x:Q.x,y:Q.y-H-5,textAnchor:"middle",opacity:qe,style:{font:"9px var(--graview-font-body, system-ui)",letterSpacing:"0.09em",textTransform:"uppercase",fill:"var(--graview-ink-faint)"},children:Vn(L.kind).toLowerCase()}):null]},g.key),wt=null;return Ne&&c&&!I&&qe>=.2&&(wt=(0,Ke.jsx)("path",{"data-graview-edge":Ne,className:"graview-edge-hit",d:dn,fill:"none",pathLength:1,strokeDasharray:"0.86",strokeDashoffset:-.07,stroke:"transparent",strokeWidth:14,style:{pointerEvents:"stroke",cursor:"pointer"},onClick:se=>{se.stopPropagation(),c(Ne,{x:se.clientX,y:se.clientY})},onContextMenu:se=>{se.preventDefault(),se.stopPropagation(),c(Ne,{x:se.clientX,y:se.clientY})},children:Je!==void 0?(0,Ke.jsx)("title",{children:Je}):null},`hit:${g.key}`)),{key:g.key,line:ln,hit:wt}});return(0,Ke.jsxs)(Ke.Fragment,{children:[(0,Ke.jsx)("svg",{"aria-hidden":"true","data-graview-world":"",width:t.width,height:t.height,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:$e.ties},children:z.map(g=>g?.line)}),z.some(g=>g?.hit)?(0,Ke.jsx)("svg",{"data-graview-world":"",width:t.width,height:t.height,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:$e.tieLabels},children:z.map(g=>g?.hit)}):null]})}function Na(e,t,n){if(t.size===0||typeof MutationObserver>"u")return()=>{};let o=0,r=()=>{o=0,La(e,t)&&n()},s=()=>{o===0&&(o=requestAnimationFrame(r))},i=({target:c})=>{for(let d=c instanceof Element?c:c.parentElement;d&&d!==e;d=d.parentElement)if(t.has(d.getAttribute("data-graview-view")??""))return!0;return!1},l=new MutationObserver(c=>{c.some(i)&&s()});return l.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-graview-pick","data-graview-slot","data-graview-offstage"]}),s(),()=>{l.disconnect(),cancelAnimationFrame(o)}}function pr(e){return e<640?{left:8,right:56}:{left:8,right:Math.round(Math.min(128,e*.107))}}function hd(e){return Math.min(260,16+e.length*6.6)}var In=(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 Ba(e,t,n){let o=new Map;for(let i of e){let l=o.get(i.said);l?l.push(i):o.set(i.said,[i])}let r=[],s=[];for(let[i,l]of o){let c=l[0],d=hd(i),{end:a,far:u}=c,h=y=>Math.max(0,Math.min(n.width-d,y)),f=[{x:h(a.x-d/2),y:u.y-22-6,width:d,height:22},{x:h(a.x-d/2),y:u.y+u.height+6,width:d,height:22},{x:u.x+u.width+6,y:a.y-22/2,width:d,height:22},{x:u.x-d-6,y:a.y-22/2,width:d,height:22}],b=f[0],p=1/0;for(let y of f){let v=y.x<0||y.y<0||y.x+y.width>n.width||y.y+y.height>n.height?1e9:0;for(let w of t)v+=In(y,w.title)*100+In(y,w.box);for(let w of r)v+=In(y,w)*100;if(v<p&&(p=v,b=y),v===0)break}r.push(b),s.push({said:i,keys:l.map(y=>y.key),...b})}return s}var Ha=(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 Oo(e,t){let n=new Set;for(let o of e)(t.edgeId&&o.edgeId===t.edgeId||t.point&&(Ha(o.fromBox,t.point)||Ha(o.toBox,t.point))||t.ids?.some(r=>o.ids.includes(r))||t.box&&(In(t.box,o.fromBox)>0||In(t.box,o.toBox)>0))&&n.add(o.key);return n}var xe=oe(Me(),1);function Fa(e){let t=ri(e);return t.length>0?new Map(t.map(n=>[Dt(n.edge.kind,n.edge.from,n.edge.to),ni(n)])):void 0}function Wa({frame:e,width:t,height:n,scheme:o,overview:r,selection:s,emphasis:i,stageRef:l,store:c,graphNodes:d,onPickEdge:a,liveOf:u,holding:h=!1,provisional:f,focusId:b=null,beside:p=!1}){let[y,x]=(0,fe.useState)(0),[v,w]=(0,fe.useState)(null),R=e.t<1,V=(0,fe.useRef)(""),B=(0,fe.useRef)([]),U=(0,fe.useRef)(new Map),z=()=>[...l.current?.querySelectorAll("[data-graview-relation] > span")??[]].map(T=>{let N=T.getBoundingClientRect();return`${Math.round(N.left)},${Math.round(N.top)},${Math.round(N.width)}`}).join(" ");(0,fe.useLayoutEffect)(()=>{if(R||h)return;V.current=z(),B.current=e.nodes;let T=new Map;w(fr(e.nodes,e.connectors,l.current,r,o,T)),U.current=T},[e,R,h,s,r,d,o,y,l]),(0,fe.useEffect)(()=>{let T=l.current;if(!(R||h||T===null))return Na(T,U.current,()=>x(N=>N+1))},[v,R,h,l]),(0,fe.useEffect)(()=>{if(R||h||r||typeof requestAnimationFrame>"u")return;let T=requestAnimationFrame(()=>{z()!==V.current&&x(N=>N+1)});return()=>cancelAnimationFrame(T)},[v]);let g=e.nodes.map(T=>T.id).join(`
|
|
4
|
+
`);(0,fe.useLayoutEffect)(()=>{let T=l.current;if(T===null||typeof window>"u")return;let N=0,I=()=>{N===0&&(N=requestAnimationFrame(()=>{N=0,x(O=>O+1)}))};T.addEventListener("scroll",I,{capture:!0,passive:!0}),window.addEventListener("resize",I,{passive:!0});let q=typeof ResizeObserver>"u"?null:new ResizeObserver(I);if(q){q.observe(T);for(let O of T.querySelectorAll("[data-graview-view]"))q.observe(O)}return()=>{N!==0&&cancelAnimationFrame(N),T.removeEventListener("scroll",I,{capture:!0}),window.removeEventListener("resize",I),q?.disconnect()}},[l,g]);let S=(0,fe.useRef)(new WeakMap);(0,fe.useEffect)(()=>{let T=l.current;if(R||h||T===null||typeof ResizeObserver>"u")return;let N=0,I=new ResizeObserver(q=>{let O=!1;for(let{target:H,contentRect:Q}of q){let M=`${Math.round(Q.width)}x${Math.round(Q.height)}`;S.current.has(H)&&S.current.get(H)!==M&&(O=!0),S.current.set(H,M)}O&&N===0&&(N=requestAnimationFrame(()=>{N=0,x(H=>H+1)}))});for(let q of T.querySelectorAll("[data-graview-view]")){let O=uo(q);O!==q&&I.observe(O)}return()=>{N!==0&&cancelAnimationFrame(N),I.disconnect()}},[v,R,h,l]);let[L,A]=(0,fe.useState)(null),F=(v??[]).some(T=>T.tie!==void 0);if((0,fe.useEffect)(()=>{let T=l.current;if(!F||T===null)return;let N=q=>{let O=q.target?.closest?.("[data-graview-pick], [data-graview-view]");A(O?.getAttribute("data-graview-pick")??O?.getAttribute("data-graview-view")??null)},I=()=>A(null);return T.addEventListener("pointerover",N),T.addEventListener("focusin",N),T.addEventListener("pointerleave",I),T.addEventListener("focusout",I),()=>{T.removeEventListener("pointerover",N),T.removeEventListener("focusin",N),T.removeEventListener("pointerleave",I),T.removeEventListener("focusout",I)}},[F,l]),R)return null;let X=(v&&h?Ca(v,B.current,e.nodes):v)??fr(e.nodes,e.connectors,null,r,o),ee=new Set;for(let T of X){if(T.edges.length===1){let N=T.edges[0];ee.add(`${T.connector.kind}|${N.from}|${N.to}`);continue}for(let N of T.edges)(T.connector.from===N.from||T.connector.to===N.to)&&ee.add(`${T.connector.kind}|${N.from}|${N.to}`)}return(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)(Ia,{strands:X,result:e,scheme:o,overview:r,selection:s,emphasis:i,stageRef:l,onPickEdge:a,liveOf:u,pointed:L,...f?{provisional:f}:{}}),r&&Mn(s,{overview:r,focusId:b,beside:p},T=>c.graph.getNode(T)?.kind).records.length>0?(0,xe.jsx)(fe.Suspense,{fallback:null,children:(0,xe.jsx)(pd,{frame:e,width:t,height:n,stageRef:l,tick:y,store:c,graphVersion:d,selection:s,view:{overview:r,focusId:b,beside:p},rulers:f?{...Da,unsureOf:(T,N,I)=>f.get(Dt(T,N,I))}:Da})}):null,r?null:(0,xe.jsx)(yd,{...f?{provisional:f}:{},stageRef:l,nodes:e.nodes,scheme:o,selection:s,store:c,graphNodes:d,overview:r,width:t,height:n,onPickEdge:a,alreadyDrawn:ee,tick:y})]})}var Da={visibleRect:rn,clipQuadratic:Cn,unsureDash:vn,unsureOpacity:kn},fd=bn(Kt(()=>(__graviewPreload(import.meta.url,["./chunk.EJ4MSVX2.js","./chunk.REUMBCSV.js","./chunk.2KIWGQXC.js","./chunk.D5LOTCBU.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.STDJ6XG5.js")))),pd=fd.part((e,t)=>(0,xe.jsx)(e.RecordLinks,{...t}),{what:"The links",quiet:!0}),md=44;function yd({stageRef:e,nodes:t,scheme:n,selection:o,store:r,graphNodes:s,overview:i,width:l,height:c,onPickEdge:d,alreadyDrawn:a,tick:u,provisional:h}){let f=Bt(),b=(0,fe.useMemo)(()=>{if(o.length===0||o.length>4)return[];let g=new Set(o),S=[];for(let A of o){let F=Tt(A);F&&S.push({kind:F.kind,self:F.from,other:F.to})}for(let A of r.graph.allEdges()){let F=g.has(A.from)?A.from:g.has(A.to)?A.to:null;if(!F)continue;let X=F===A.from?A.to:A.from;g.has(X)||S.push({kind:A.kind,self:F,other:X})}if(S.length<=14)return S;let L=new Set(t.map(A=>A.id));return S.map((A,F)=>({tie:A,index:F,real:L.has(A.other)?0:1})).sort((A,F)=>A.real-F.real||A.index-F.index).slice(0,14).map(({tie:A})=>A)},[r,o,s,t]),p=()=>{if(b.length===0||typeof document>"u")return[];let g=e.current?.getBoundingClientRect();if(!g)return[];let S=[...e.current?.querySelectorAll("[data-graview-joins]")??[]].find(O=>{if(O.closest("[data-graview-offstage]"))return!1;try{let H=JSON.parse(O.getAttribute("data-graview-joins")??"[]");return H.length===o.length&&H.every(Q=>o.includes(Q))}catch{return!1}});if(S){let O=rn(S,e.current);if(!O)return[];let H=[];for(let Q of o){let M=t.find(P=>P.id===Q);if(!M)continue;let E=We(e.current,M.id,i)??at(M,n),k=E?hr(O,E):null;if(!E||!k)continue;let D=[...r.graph.allEdges()].find(P=>P.from===Q&&o.includes(P.to)||P.to===Q&&o.includes(P.from));H.push({key:`join:${Q}`,self:Q,other:"",others:1,kind:D?.kind??"",endX:k.to.x,endY:k.to.y,...k,fromBox:O,toBox:E,proxy:!1,edgeId:D?Dt(D.kind,D.from,D.to):null})}return H}let L=(O,H)=>{let Q=e.current?.querySelectorAll(`[data-graview-pick="${CSS.escape(O)}"], [data-graview-slot="${CSS.escape(O)}"]`),M=[];for(let E of Q??[]){if(E.closest("[data-graview-offstage]")||H(E)||E.closest("[data-graview-mark]"))continue;let k=rn(E,e.current);k&&M.push(k)}return M.sort((E,k)=>E.width*E.height-k.width*k.height)},A=O=>t.find(H=>H.id===O)??t.find(H=>H.aggregate?.memberIds.includes(O)),F=O=>`[data-graview-pick="${CSS.escape(O)}"], [data-graview-slot="${CSS.escape(O)}"]`,X=(O,H)=>{let Q=e.current;if(!Q)return!1;for(let M of Q.querySelectorAll("[data-graview-view]")){let E=M.querySelector(F(O));if(E===null||E.closest("[data-graview-offstage]"))continue;let k=M.querySelector(F(H));if(k!==null&&!k.closest("[data-graview-offstage]"))return!0}return!1},ee=[];if(!i&&e.current){for(let H of t){if(Math.round(H.plane)!==1)continue;let Q=We(e.current,H.id,!1);Q&&ee.push(Q)}let O=e.current;ee.push(...Ro(O,g,t,H=>We(O,H,!1)))}let T=new Map,N=[];for(let O of b){if(X(O.self,O.other))continue;let H=A(O.self),Q=H?e.current?.querySelector(`[data-graview-view="${CSS.escape(H.id)}"]`):null,M=!i&&H?.id===O.self&&Math.round(H.plane)===1?We(e.current,H.id,!1):null,E=M?[M]:L(O.self,()=>!1);if(!(E.length>0)&&H){let ae=We(e.current,H.id,!1)??at(H,n);ae&&E.push(ae)}let D=t.find(ae=>ae.id===O.other),P=[],$=!1;if(D){let ae=We(e.current,D.id,i)??at(D,n);ae&&P.push(ae)}else if(P.push(...L(O.other,ae=>Q?Q.contains(ae):!1)),P.length===0){let ae=A(O.other);if(ae&&(!H||ae.id!==H.id)){let Ie=We(e.current,ae.id,i)??at(ae,n);Ie&&(P.push(Ie),$=!0)}}if(E.length===0||P.length===0||$&&i)continue;let G=E[0],J=P[0],Y=1/0;for(let ae of E)for(let Ie of P){let Be=Math.hypot(ae.x+ae.width/2-(Ie.x+Ie.width/2),ae.y+ae.height/2-(Ie.y+Ie.height/2));Be<Y&&(Y=Be,G=ae,J=Ie)}if(a?.has(`${O.kind}|${O.self}|${O.other}`)||a?.has(`${O.kind}|${O.other}|${O.self}`))continue;let re=`${O.kind}:${Math.round(G.x)},${Math.round(G.y)}:${Math.round(J.x)},${Math.round(J.y)}`,Z=T.get(re);if(Z){Z.others+=1;continue}let j=hr(G,J);if(!j)continue;let{from:pe,control:le}=j,ve=M&&G===M?on(G,J,ee,N.length):void 0,Ae=ve?ve[ve.length-1]:j.to,Te=[...r.graph.allEdges()].find(ae=>ae.kind===O.kind&&(ae.from===O.self&&ae.to===O.other||ae.from===O.other&&ae.to===O.self)),Ce={key:`${O.kind}:${O.self}:${O.other}`,self:O.self,other:O.other,others:1,kind:O.kind,endX:Ae.x,endY:Ae.y,from:pe,to:Ae,control:le,fromBox:G,toBox:J,...ve?{points:ve}:{},proxy:$,edgeId:Te?Dt(Te.kind,Te.from,Te.to):null};T.set(re,Ce),N.push(Ce)}let I=i?void 0:t.find(O=>Math.round(O.plane)===0&&!O.aggregate),q=O=>{let H=t.find(Q=>Q.id===O.other)??t.find(Q=>Q.aggregate?.memberIds.includes(O.other));return H!==void 0&&Math.round(H.plane)===1&&H.via?.edgeKind===O.kind};for(let O of N){if(I&&(O.self!==I.id||q(O)))continue;let H=[...r.graph.allEdges()].find(P=>P.kind===O.kind&&(P.from===O.self&&P.to===O.other||P.from===O.other&&P.to===O.self)),Q=r.graph.getNode(O.self),M=r.graph.getNode(O.other);if(!H||!Q||!M)continue;let E=H.from===O.self?"out":"in",k=ti(r.schema,E==="out"?Q.kind:M.kind,O.kind,E),D=O.proxy?(E==="out"?r.graph.out(O.self,O.kind):r.graph.in(O.self,O.kind)).filter(P=>P.kind===M.kind).length:1;O.said=O.proxy?`${k}: ${_t(r.schema,M.kind,Math.max(D,O.others))}`:`${k}: ${zt(r.schema.tryDefinition(M.kind),M)}`}return N},[y,x]=(0,fe.useState)([]),[v,w]=(0,fe.useState)([]);(0,fe.useLayoutEffect)(()=>{let g=p();x(g),w(g.some(S=>S.said)?R(g):[])},[b,t,i,n,l,c,a,u,e]);let R=g=>{let S=e.current;if(!S)return[];let L=[];for(let A of S.querySelectorAll("[data-graview-view]")){let F=[...A.children].find(ee=>!ee.classList.contains("graview-kind-tag")),X=F?rn(F,S):null;X&&L.push({box:X,title:{...X,height:Math.min(X.height,md)}})}return Ba(g.flatMap(A=>A.said?[{key:A.key,said:A.said,end:{x:A.endX,y:A.endY},far:A.toBox}]:[]),L,{width:l,height:c})},[V,B]=(0,fe.useState)(()=>new Set),U=(0,fe.useRef)([]);U.current=y.map(g=>({key:g.key,fromBox:g.fromBox,toBox:g.toBox,ids:[g.self,g.other],edgeId:g.edgeId}));let z=v.length>0;return(0,fe.useEffect)(()=>{let g=e.current;if(!g||!z)return;let S=I=>B(q=>q.size===I.size&&[...I].every(O=>q.has(O))?q:I),L=0,A=null,F=()=>{if(L=0,!A)return;let I=g.getBoundingClientRect(),q=A.target instanceof Element?A.target:null;S(Oo(U.current,{point:{x:A.clientX-I.left,y:A.clientY-I.top},edgeId:q?.closest("[data-graview-edge]")?.getAttribute("data-graview-edge")??null}))},X=I=>{A=I,L||(L=requestAnimationFrame(F))},ee=()=>{A=null,S(new Set)},T=I=>{let q=I.target instanceof Element?I.target:null;if(!q)return;let O=g.getBoundingClientRect(),H=q.getBoundingClientRect(),Q=q.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??q.closest("[data-graview-view]")?.getAttribute("data-graview-view");S(Oo(U.current,{...Q?{ids:[Q]}:{},box:{x:H.left-O.left,y:H.top-O.top,width:H.width,height:H.height}}))},N=I=>{I.relatedTarget instanceof Node&&g.contains(I.relatedTarget)||S(new Set)};return g.addEventListener("pointermove",X,{passive:!0}),g.addEventListener("pointerleave",ee),g.addEventListener("focusin",T),g.addEventListener("focusout",N),()=>{L&&cancelAnimationFrame(L),g.removeEventListener("pointermove",X),g.removeEventListener("pointerleave",ee),g.removeEventListener("focusin",T),g.removeEventListener("focusout",N)}},[e,z]),y.length===0?null:(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)("svg",{"aria-hidden":y.some(g=>g.edgeId)?void 0:!0,"data-graview-ties":y.length,"data-graview-world":"",width:l,height:c,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:$e.lines},children:y.map(g=>{let{connector:S,style:L}=Jt(f,g.kind);if(!S.visible)return null;let A=g.edgeId?h?.get(g.edgeId):void 0,F={p0:g.from,c:g.control,p1:g.to},X=g.points?wo(g.points,10):S.route==="orthogonal"?Rt([Ln(g.from,g.to)]):(({p0:T,c:N,p1:I})=>`M ${T.x} ${T.y} Q ${N.x} ${N.y} ${I.x} ${I.y}`)(lr(S.route,F)),ee=null;if(g.edgeId&&d&&!g.proxy){let T=(I,q)=>q.x>=I.x&&q.x<=I.x+I.width&&q.y>=I.y&&q.y<=I.y+I.height,N=g.points?[...g.points]:[];for(let I=0;I<=(g.points?-1:40);I++){let q=ba(S.route,F,I/40);T(g.fromBox,q)||T(g.toBox,q)||N.push(q)}N.length>=2&&(ee=(0,xe.jsx)("path",{"data-graview-edge":g.edgeId,className:"graview-edge-hit",d:`M ${N[0].x} ${N[0].y} ${N.slice(1).map(I=>`L ${I.x} ${I.y}`).join(" ")}`,fill:"none",pathLength:1,strokeDasharray:"0.86",strokeDashoffset:-.07,stroke:"transparent",strokeWidth:14,style:{pointerEvents:"stroke",cursor:"pointer"},onClick:I=>{I.stopPropagation(),d(g.edgeId,{x:I.clientX,y:I.clientY})},onContextMenu:I=>{I.preventDefault(),I.stopPropagation(),d(g.edgeId,{x:I.clientX,y:I.clientY})},children:A!==void 0?(0,xe.jsx)("title",{children:A}):null}))}return(0,xe.jsxs)("g",{opacity:(g.proxy?.32:.72)*(A!==void 0?kn:1),children:[(0,xe.jsx)("path",{"data-graview-tie":g.kind,"data-graview-tie-proxy":g.proxy||void 0,"data-graview-provisional":A!==void 0||void 0,d:X,fill:"none",stroke:qt(L),strokeWidth:g.proxy?1.1:1.6,strokeDasharray:A!==void 0?vn:Un[L.pattern],strokeLinecap:"round"}),(0,xe.jsx)("circle",{cx:g.endX,cy:g.endY,r:g.proxy?2:2.6,fill:qt(L)}),ee]},g.key)})}),(0,xe.jsx)("div",{"aria-hidden":"true","data-graview-world":"",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:$e.tieLabels},children:v.map(g=>{let S=y.find(L=>L.key===g.keys[0]);return(0,xe.jsx)("span",{className:"graview-record-link-said","data-graview-link-said":S?.kind,"data-graview-lands":S?.proxy?"district":"record","data-graview-said-for":g.keys.length,"data-graview-tie-said":g.keys.some(L=>V.has(L))?"shown":"waiting",style:{position:"absolute",left:g.x,top:g.y,transform:`translateX(min(0px, calc(${Math.round(l-g.x-8)}px - 100%)))`},children:g.said},g.said)})})]})}function $a(){return typeof document>"u"?1:parseFloat(getComputedStyle(document.documentElement).fontSize)/16||1}function ja({nodes:e,scheme:t,width:n,stageRef:o,moving:r=!1,holding:s=!1}){let i=Bt(),[l,c]=(0,fe.useState)([]);(0,fe.useLayoutEffect)(()=>{r||s||c(d())},[e,r,s,t,n,o]);function d(){let u=[],h=[];for(let y of e){if(!y.via||Math.round(y.plane)!==1)continue;let x=We(o.current,y.id,!1,!0),{scale:v}=Xt(1,t);u.push({key:`${y.via.edgeKind}|${y.via.direction}`,text:En(y.via),left:x?.x??y.x,right:x?x.x+x.width:y.x+y.width*v,top:x?.y??y.y}),h.push(Math.round(y.y))}let f=new Map;u.forEach((y,x)=>f.set(h[x],Math.min(f.get(h[x])??1/0,y.top)));let b=u.map((y,x)=>({...y,top:f.get(h[x])??y.top})),p=pr(n);return qr(b,{left:p.left,right:n-p.right},$a())}if(l.length===0||!i.captions.visible||r)return null;let a=Xr*$a();return(0,xe.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:$e.lines},children:l.map(u=>{let{left:h,width:f}=u;return(0,xe.jsx)("div",{"data-graview-relation":u.key,title:u.text,style:{position:"absolute",left:h,width:f,textAlign:"center",top:Math.max(0,u.top-a),fontSize:"0.75rem",letterSpacing:"0.09em",textTransform:"uppercase",color:"var(--graview-ink-faint)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:(0,xe.jsx)("span",{style:{background:"var(--graview-ground)",padding:"1px 7px",borderRadius:4},children:u.text})},u.key)})})}var jt=oe(Ee(),1);var wd=new Set;function Ga(e,t,n,o,r,s,i=0,l=0){let{store:c,views:d,hiddenKinds:a}=ge(),u=It(),h=(0,jt.useContext)(Ut),f=Cr(),b=(0,jt.useMemo)(()=>{let x={};for(let v of f){if(v.subjectId===void 0)continue;let w=x[v.subjectId]??=[];for(let R of v.nodeIds)R!==v.subjectId&&!w.includes(R)&&w.push(R)}return x},[f]),p=(0,jt.useMemo)(()=>({flagged:new Set(f.flatMap(x=>x.nodeIds)),touched:Xn(c.log.all())}),[f,c,s]),y=(0,jt.useMemo)(()=>({hits:u?Kn(u):wd,...p}),[u,p]);return(0,jt.useMemo)(()=>({...e,cityZoom:o,...h?{besideTheMap:!0}:{},...a.size>0?{hiddenKinds:[...a].sort()}:{},...Object.keys(b).length>0?{judged:b}:{},relevance:y,inset:{...pr((t?.width??1200)-r.right),top:8,bottom:0},chrome:[{x:(t?.width??1200)-r.right-176,y:0,width:176,height:100},xd(t,r)],...r.right>0||r.bottom>0?{dock:r}:{},...i>0?{headroom:i}:{},unit:n,plainGroups:c.schema.kinds.filter(x=>Vo(d.lookup(x,{cardinality:"many",fidelity:"full"}))),cityOrder:No(fi({name:"scene",schema:c.schema,mutations:c.allMutations().filter(x=>!x.derived)}).order.map(x=>x.kind),d.arrangement?.()?.order),screens:d.places().reduce((x,v)=>((x[v.kind]??=[]).push({as:v.as,title:v.title,...v.across?{across:v.across}:{}}),x),{}),...t?{width:t.width,height:Math.max(0,t.height-Math.max(64,l))}:{}}),[e,t,n,c,d,a,b,y,o,h,r.right,r.bottom,i,l])}var Va=224;function xd(e,t){let n=e?.width??1200,o=e?.height??800,r=58;return{x:n-t.right-Va,y:o-t.bottom-r,width:Va,height:r}}var gt=oe(Ee(),1);var Ya=oe(Ee(),1);function mr(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(o=>typeof o=="string")?n:null}catch{return null}}function za(e){(0,Ya.useEffect)(()=>{let t=e.current;if(!t)return;let n=()=>{for(let s of t.querySelectorAll("[data-graview-pick]"))s.getAttribute("tabindex")===null&&s.setAttribute("tabindex","0"),s.getAttribute("role")===null&&vd(s)&&s.setAttribute("role","button")};if(n(),typeof MutationObserver>"u")return;let o=0,r=new MutationObserver(()=>{o===0&&(o=typeof requestAnimationFrame>"u"?0:requestAnimationFrame(()=>{o=0,n()}),o===0&&n())});return r.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-graview-pick"]}),()=>{r.disconnect(),o!==0&&cancelAnimationFrame(o)}},[e])}var bd=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 vd(e){return bd.has(e.localName.toLowerCase())}var sn=oe(Me(),1);function _a({node:e,useDom:t,blur:n,touched:o,frontY:r,centerY:s,screen:i,onDrawnHeight:l,crowded:c,activity:d,scheme:a,canvasWidth:u,canvasHeight:h,selected:f,onSelect:b,onPick:p,onTravel:y,onMenu:x,selection:v,onJackIn:w,onDragStart:R,onDragMove:V,onDragEnd:B,swallowClick:U,children:z}){let{brand:g,store:S,actsDoor:L}=ge(),A=e.beyond?`${e.beyond.length} more district${e.beyond.length===1?"":"s"}`:e.aggregate?.opens?.in==="place"?`${e.aggregate.label}, ${_t(S.schema,e.aggregate.kind,e.aggregate.memberIds.length)}`:e.aggregate?e.aggregate.label:(()=>{let k=S.graph.getNode(e.id);return k?zt(S.schema.tryDefinition(e.kind),k):e.id})(),[F,X]=(0,gt.useState)(null),ee=Math.round(e.plane)===0&&!e.aggregate;(0,gt.useLayoutEffect)(()=>{if(!ee)return;let k=O.current;if(!k)return;let D=()=>{let $=[...k.children].find(Z=>Z.dataset.graviewKindtag===void 0);if(!$)return;let G=k.getBoundingClientRect(),J=$.getBoundingClientRect(),Y=k.offsetWidth>0?G.width/k.offsetWidth:1,re={top:Math.round((J.top-G.top)/Y)-9,right:Math.round((G.right-J.right)/Y)+14};X(Z=>Z&&Z.top===re.top&&Z.right===re.right?Z:re)};if(typeof ResizeObserver>"u"){D();return}let P=new ResizeObserver(D);P.observe(k);for(let $ of k.children)P.observe($);return()=>P.disconnect()},[ee,e.id]);let T=Ko({plane:e.plane,...e.depth!==void 0?{depth:e.depth}:{},onPlot:r!==void 0},a),N=T.style,I=_o(N,e.x,e.y,u,h),q=n?T.blur:0,O=(0,gt.useRef)(null);za(O);let H=e.natural,Q=H?Math.min(e.width/H.width,e.height/H.height):1,M=(0,gt.useRef)(null);(0,gt.useEffect)(()=>{if(!i||!l)return;let k=M.current;if(!k||typeof ResizeObserver>"u")return;let D=()=>{let Y=0,re=0;for(let Z of k.children)if(!(!(Z instanceof HTMLElement)||Z.classList.contains("graview-screen-fullscreen"))){Y=Math.max(Y,Z.offsetTop+Z.offsetHeight);for(let j of[Z,...Z.querySelectorAll("*")]){let pe=getComputedStyle(j).overflowY;(pe==="auto"||pe==="scroll")&&(re+=j.scrollHeight-j.clientHeight)}}l(Y+re)},P=0,$=()=>{P||(P=requestAnimationFrame(()=>{P=0,D()}))};D();let G=new ResizeObserver($);G.observe(k);for(let Y of k.children)G.observe(Y);let J=new MutationObserver($);return J.observe(k,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),()=>{P&&cancelAnimationFrame(P),G.disconnect(),J.disconnect(),l(void 0)}},[i,l,e.id]);let E=t?{transform:wa(I),transformOrigin:"0 0",filter:q>0?`blur(${q}px)`:void 0,opacity:Uo(N)*(e.opacity??1),"--graview-lift-low":mo(N.shadow,a),...r!==void 0?{"--graview-front-y":`${r.toFixed(1)}px`}:{},...s!==void 0?{"--graview-center-y":`${s.toFixed(1)}px`}:{}}:{"--graview-lift-low":mo(N.shadow,a)};return(0,sn.jsxs)("div",{ref:O,"data-graview-view":e.id,...t?{}:{drawable:""},"data-graview-plane":Math.round(e.plane),"data-graview-selected":f||void 0,"data-graview-touched":o||void 0,"data-graview-plot":r!==void 0?"":void 0,"data-graview-screen":i?"":void 0,"data-graview-record-focus":Math.round(e.plane)===0&&!e.aggregate&&!H&&!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?`${oa[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":A,"aria-keyshortcuts":L&&!e.beyond?L.key:void 0,tabIndex:0,onPointerDown:R,onPointerMove:V,onPointerUp:B,onPointerCancel:B,onClick:k=>{if(U.current)return;let D=k.target?.closest("input, textarea, select, button, a[href], [contenteditable='true']");if(D&&!D.hasAttribute("data-graview-pick"))return;let P=k.metaKey||k.shiftKey,$=kt(k.target);if($&&$!==e.id){k.stopPropagation(),p($,P,mr(k.target)??void 0);return}b(P)},onKeyDown:k=>{if(L&&!e.beyond&&k.key.toLowerCase()===L.key.toLowerCase()&&!k.metaKey&&!k.ctrlKey&&!k.altKey&&!k.target?.closest("input, textarea, select, [contenteditable='true']")){k.preventDefault(),k.stopPropagation();let J=kt(k.target)??e.id;v.includes(J)||p(J,!1),L.open(k.target instanceof HTMLElement?k.target:k.currentTarget);return}if(k.key!=="Enter"&&k.key!==" "||k.target?.closest("input, textarea, select, button, [contenteditable='true']"))return;let P=kt(k.target);if(k.preventDefault(),k.stopPropagation(),!P||P===e.id){v.length===1&&v[0]===e.id&&!k.metaKey&&!k.shiftKey?w():b(k.metaKey||k.shiftKey);return}let $=mr(k.target);($?v.length===$.length&&$.every(J=>v.includes(J)):v.length===1&&v[0]===P)&&!k.metaKey&&!k.shiftKey?y(P):p(P,k.metaKey||k.shiftKey,$??void 0)},onContextMenu:k=>{let D=kt(k.target);k.preventDefault(),k.stopPropagation();let P=D&&D!==e.id?D:e.id;p(P,!1,(P===D?mr(k.target):null)??void 0),x({x:k.clientX,y:k.clientY,on:P})},onDoubleClick:k=>{let D=kt(k.target);if(D&&D!==e.id){k.stopPropagation(),y(D);return}w()},style:{position:"absolute",...t?{}:{pointerEvents:"none"},zIndex:e.opened?$e.opened:$e.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",...E},children:[H?(0,sn.jsx)("div",{ref:M,"data-graview-natural":`${Math.round(H.width)}x${Math.round(H.height)}`,style:{position:"absolute",left:"50%",top:"50%",width:H.width,height:H.height,transform:`translate(-50%, -50%) scale(${Q})`,transformOrigin:"50% 50%",display:"flex",flexDirection:"column"},children:z}):z,Math.round(e.plane)===0&&!e.aggregate?(0,sn.jsxs)("span",{"data-graview-kindtag":"",className:"graview-kind-tag","aria-hidden":"true",style:{...F??{},"--graview-hue":Math.round(yn(e.kind,g?.accents))},children:[(0,sn.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(yn(e.kind,g?.accents))} 55% var(--graview-tint-lightness) / 0.9)`}}),To(S.schema.tryDefinition(e.kind),e.kind)]}):null]})}var de=oe(Me(),1);Tr({search:mi,touchWeights:Xn});var kd=e=>e?{activity:e}:{},Sd=e=>`${Math.round(e.x)} ${Math.round(e.y)}`,Ka=e=>e.stopPropagation(),Qa=.6,Za=3,Md=80,Ua=e=>Math.round(e.plane)===1&&(e.compact===!0||e.width<175||e.height<Md);function Ed(e){let[t,n]=(0,K.useState)(1),o=(0,K.useRef)(1);return(0,K.useEffect)(()=>{e||(o.current=1,n(1))},[e]),[t,o,n]}function Rd(e){let[t,n]=(0,K.useState)({x:0,y:0}),o=(0,K.useMemo)(()=>({x:(e.pan?.x??0)+t.x,y:(e.pan?.y??0)+t.y}),[e.pan,t]),r=(0,K.useMemo)(()=>t.x===0&&t.y===0?e:yt(e,o),[e,t,o]),s=(0,K.useRef)(t);s.current=t;let i=(0,K.useCallback)((l,c)=>{let d=s.current,a=(u,h,f)=>Math.max(Math.min(-u,h),Math.min(Math.max(u,h),f+h))-h;return{x:a(l.x,d.x,c.x),y:a(l.y,d.y,c.y)}},[]);return[o,r,i,s,n]}function Od(e,t,n,o,r,s){let i=n!==null&&!t.overview,l=i?null:n,c=(0,K.useRef)(t);Yr(c.current,t)||(c.current=t);let d=c.current,a=(0,K.useMemo)(()=>{let p=d.pan?{...d,pan:void 0}:d;return l?Sn(p,l.id,{x:l.x,y:l.y}):p},[d,l]),u=(0,K.useRef)(void 0),h=(0,K.useMemo)(()=>{let p=u.current?.stood,y=nr(e.graph,e.schema,a,p?{...o,cityStood:p}:o);return u.current=y.city,y},[e,a,o,r]),f=(0,K.useMemo)(()=>n&&i?no(h,n.id,{x:n.x,y:n.y})??nr(e.graph,e.schema,Sn(a,n.id,{x:n.x,y:n.y}),o):h,[h,n,i,e,a,o]);return[(0,K.useMemo)(()=>ro(f,s??{x:0,y:0}),[f,s]),i]}function Ad(e,t){let n=(0,K.useRef)(!1),o=(0,K.useRef)(!1),r=(0,K.useRef)(null),s=(0,K.useRef)(!1),i=(0,K.useCallback)(()=>{Pd(e.current,{dragging:n.current,steering:o.current}),t.set(n.current||o.current||s.current)},[e,t]),l=(0,K.useCallback)(u=>{n.current!==u&&(n.current=u,i())},[i]),c=(0,K.useRef)(()=>!1),d=(0,K.useCallback)(()=>{o.current||(o.current=!0,i()),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=null,!c.current()&&(o.current=!1,i())},160)},[i]),a=(0,K.useCallback)(()=>{n.current=!1,o.current=!1,i()},[i]);return{dragging:n,steering:o,tweening:s,setDragging:l,steer:d,settleLive:c,settled:a}}function Pd(e,{dragging:t,steering:n}){e&&(t||n?e.setAttribute("data-graview-hand",t?"drag":"wheel"):e.removeAttribute("data-graview-hand"),e.style.cursor=t?"grabbing":"grab",e.style.userSelect=t?"none":"")}function Ld(e){let t=(0,K.useRef)(!1),n=e!==null&&!t.current;return(0,K.useEffect)(()=>{e!==null&&(t.current=!0)},[e]),n}function Td({registerScene:e,scheme:t,views:n},o,r){let s=(0,K.useRef)(o);s.current=o,(0,K.useEffect)(()=>(e({whereIs:i=>dr(s.current,r.current,t,n,i)}),()=>e(null)),[e,t,n])}function Cd(e,t){(0,K.useEffect)(()=>{let n;return e.onActive(o=>{let r=t.current;if(!r)return;let s=c=>{let d=r.getBoundingClientRect();e.set({x:c.clientX-d.left,y:c.clientY-d.top})},i=c=>{c.buttons===0&&s(c)},l=()=>e.set(null);o?(r.addEventListener("pointermove",i),r.addEventListener("pointerup",s),r.addEventListener("pointerleave",l),n=()=>{r.removeEventListener("pointermove",i),r.removeEventListener("pointerup",s),r.removeEventListener("pointerleave",l)}):(n?.(),n=void 0)})},[e])}function Id(e,t,n,o,r,s,i,l){(0,K.useEffect)(()=>{let c=t.current;if(!c||!e)return;let d=new Set;for(let u of n.nodes)(o.has(u.id)||u.aggregate?.memberIds.some(h=>o.has(h)))&&d.add(u.id);let a=e({canvas:c,layout:n,dirty:d,hostOf:u=>(c.parentElement??c).querySelector(`[data-graview-view="${CSS.escape(u)}"]`),drawOnDom:r,blur:s,scheme:i,fallBack:l});return()=>{a?.()}},[e,n,o,r,s,i,l])}var Nd=Kt(()=>(__graviewPreload(import.meta.url,["./chunk.OJGHDWI6.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZSGDVNVN.js")));function Hd(e,t){let[n]=(0,K.useState)(()=>{let a=qo();return t?e==="dom"||e==="auto"&&a==="dom"?"dom":"gpu":Zo(e,{operator:a,present:Qo()})}),[o,r]=(0,K.useState)(!1),s=(0,K.useCallback)(()=>r(!0),[]),[i,l]=(0,K.useState)(null),c=n==="gpu"&&!t&&!o&&i===null;return(0,K.useEffect)(()=>{if(!c)return;let a=!0;return Nd().then(u=>{a&&l(()=>u.attachGpu())},()=>{a&&r(!0)}),()=>{a=!1}},[c]),{attach:(n==="gpu"&&!o?t??i:null)??null,fallBack:s}}function Bd(){let[e,t]=(0,K.useState)(()=>new Set),n=(0,K.useCallback)(o=>{t(r=>r.size===o.size&&[...o].every(s=>r.has(s))?r:new Set(o))},[]);return[e,n]}function Dd(){let e=oi();return t=>{let n=t?e.get(t.id):void 0,o=t?.aggregate?.memberIds??[];if(!n&&o.length===0)return;let r=n,s=n?.wrote??!1,i=n?.read??!1,l=n?.broke??!1;for(let c of o){let d=e.get(c);d&&(s||=d.wrote,i||=d.read,l||=d.broke,(!r||d.at>r.at||d.at===r.at&&d.wrote&&!r.wrote)&&(r=d))}return r?{...r,wrote:s,read:i,broke:l}:void 0}}var Xa=(e,t)=>e.includes(t)?e.filter(n=>n!==t):[...e,t];function $d(){let{views:e,view:t,setView:n,setSelection:o}=ge(),r=It(),s=(0,K.useContext)(Ut),i=l=>{if(Pe(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(xn(l.id)){o(a=>c?Xa(a,l.id):[l.id]);return}let d=l.aggregate?wn(l.id):[];if(t.overview){o(a=>c?[...new Set([...a,l.id])]:[l.id]);return}if(d.length===1&&!c&&Math.round(l.plane)!==0){let a=d[0];n(u=>Rr(u,u.relation===a?null:a));return}o(a=>po(l,a,c))},onPick:(c,d,a)=>o(u=>a?d?[...new Set([...u,...a])]:[...a]:d?Xa(u,c):[c]),onTravel:c=>{n(d=>({...bt(d,c),relation:null})),o([c])},onJackIn:()=>{let c=l.aggregate?.opens;if(c){c.in==="place"?n(u=>Or(u,l.id)):n(u=>Object.entries(c.within).reduce((h,[f,b])=>zn(h,f,b),bt(gn(u,!1),c.focus))),o([]);return}let d=Pe(l.id),a=d!==null&&(r?.byKind[d]??0)>0;if(s&&d!==null&&t.overview&&!i(l)&&!(a&&t.q)){n(u=>zn({...bt(u,`aggregate:${d}`),relation:null},"view",null)),o([]);return}n(u=>Ar(u,l.id,{ownPicture:i(l),...a&&u.q?{carry:u.q}:{}})),o(l.aggregate?[]:[l.id])}})}var Fd=bn(Kt(()=>(__graviewPreload(import.meta.url,["./chunk.HJCQ6I3S.js","./chunk.EJ4MSVX2.js","./chunk.XIW4SZHD.js","./chunk.KQPKYWDM.js","./chunk.REUMBCSV.js","./chunk.2KIWGQXC.js","./chunk.D5LOTCBU.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.XCEZCOX4.js")))),Wd=Fd.part((e,t)=>(0,de.jsx)(e.Ribbons,{...t}),{what:"The relations",quiet:!0}),qa="graview:map-from-above";function jd(){let[e,t]=(0,K.useState)(()=>{try{return globalThis.localStorage?.getItem(qa)==="1"}catch{return!1}}),n=(0,K.useCallback)(o=>{t(o);try{globalThis.localStorage?.setItem(qa,o?"1":"0")}catch{}},[]);return[e,n]}var Ja=bn(Kt(()=>(__graviewPreload(import.meta.url,["./chunk.XIW4SZHD.js","./chunk.KQPKYWDM.js","./chunk.BN7C5ZYX.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.BQM3YAMR.js")))),Vd=Ja.part((e,t)=>(0,de.jsx)(e.Plots,{...t}),{quiet:!0}),Gd=Ja.part((e,t)=>(0,de.jsx)(e.WorkflowsLayer,{...t}),{quiet:!0});function Yd({zoom:e,zoomBy:t,above:n,setAbove:o}){let r=(s,i,l,c)=>(0,de.jsx)("button",{type:"button",className:"graview-zoom-button","data-testid":`zoom-${s}`,"aria-label":`Zoom ${s}`,title:`Zoom ${s} \u2014 or pinch, or ctrl+wheel`,disabled:c,onClick:()=>t(l),children:i});return(0,de.jsxs)("div",{className:"graview-zoom","data-graview-foot":"",role:"group","aria-label":"Zoom",onPointerDown:Ka,onClick:Ka,children:[r("out","\u2212",1/1.25,e<=Qa+1e-6),(0,de.jsxs)("span",{className:"graview-zoom-level","data-testid":"zoom-level","aria-live":"polite",children:[Math.round(e*100),"%"]}),r("in","+",1.25,e>=Za-1e-6),(0,de.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:()=>o(!n),children:"From above"})]})}function zd({options:e,renderer:t="auto",attachRenderer:n,blur:o=!0,className:r,style:s,animate:i=!0,children:l}){let c=ge(),d=c.app?c.app.workflows??Bo(c.app)?.workflows:void 0,{store:a,scheme:u,views:h,view:f,setView:b,selection:p,setSelection:y,setMenuAt:x,emphasis:v,brand:w,noteMoved:R,robots:V,motion:B}=c,U=(0,K.useContext)(Ut),z=(0,K.useRef)(null),g=(0,K.useRef)(null),S=ga(ya(g)),L=ma(),{zoomAbout:A,panBy:F}=ra({stage:g,view:f,setView:b}),X=Nt(),ee=1,[T,N,I]=Ed(f.overview),[q,O]=jd(),H=(0,K.useMemo)(()=>q?{...e,tilt:gi}:e,[e,q]),{probe:Q,dock:M}=Ji(),E=!f.overview&&(f.zoom||f.past||f.relation)?Math.ceil(14+34*L/16+6):0,k=Ga(H,S,L,ee*T,M,X,E,f.overview?0:M.bottom),D=Ui(g),[P,$,G,J,Y]=Rd(f),re=(0,K.useMemo)(()=>new Set(Object.keys(f.pins).filter(C=>Pe(C)===null)),[f.pins]),Z=ea(),[j,pe]=Od(a,f,Z.held,k,X,$.pan),le=Ad(g,B),{setDragging:ve,steer:Ae,settleLive:Te,settled:Ce}=le,ae=le.dragging.current||le.steering.current,Ie=Ld(S),Be=ta({stage:g,pan:f.pan,setView:b,settled:Ce}),lt=(0,K.useRef)(!1);Be.settling.current||(lt.current=!1);let dn=Be.settling.current&&!lt.current,te=Wi(j,{enabled:i&&!ae&&S!==null&&!Ie,settle:!dn});le.tweening.current=te.t<1,(0,K.useEffect)(()=>B.set(le.dragging.current||le.steering.current||te.t<1),[B,te]);let Ne=ji(),Ot=Vi(),Je=Xi({view:f,result:j,frame:te,panned:P,closer:ee,screenId:null,setCamera:Y});Td(c,te,g),Cd(c.pointer,g);let[ct,et]=Bd(),{attach:Ue,fallBack:je}=Hd(t,n),Ve=$i(o);Id(Ue,z,te,Ne,et,Ve,u,je);let Xe=Ue===null,qe=Fi(Ve&&Xe,te.t<1),ut=Dd();Te.current=Be.settle;let{onGroundDown:ln,onCardDown:wt,onDragMove:se,onDragUp:be,swallow:Ge}=na({view:f,panned:P,limit:()=>St(j),panWithin:G,moveByTransform:!0,setView:b,setDragging:ve,noteMoved:R,shift:Be,district:Z}),tt=Bi({swallow:Ge,setMenuAt:x,setSelection:y});A.current=(C,ue,me)=>{if(!f.overview)return;Te.current();let Re=N.current,ft=Math.max(Qa,Math.min(Za,Re*C));if(Math.abs(ft-Re)<1e-4)return;N.current=ft,lt.current=!0,Ae(),I(ft);let De=g.current?.getBoundingClientRect(),hn=j.visible??j,fn={x:hn.width/2,y:hn.height/2},pn=De&&ue!==void 0&&me!==void 0?{x:ue-De.left,y:me-De.top}:fn,yr=ft/Re;b(Pt=>yt(Pt,eo(Pt.pan??{x:0,y:0},J.current,pn,fn,yr))),R()};let Ye=(C,ue,me=St(j))=>b(Re=>yt(Re,G(me,{x:(Re.pan?.x??0)+C,y:(Re.pan?.y??0)+ue})));Qi(g,M,(C,ue)=>Ye(C,ue)),F.current=(C,ue)=>{Ae();let me=St(j),Re=f.pan??{x:0,y:0},ft=Be.offset();Be.shiftTo(G(me,{x:Re.x+ft.x+C,y:Re.y+ft.y+ue}),Re),R()};let Vt=$d(),Gt=Bt(),Nn=(0,K.useCallback)(C=>Jt(Gt,C).connector.visible,[Gt]),cn=C=>ut(te.nodes.find(ue=>ue.id===C)),ht=(C,ue,me,Re)=>C.originY+P.y+en(me.col+me.side/Re,me.row+me.side/Re,C.cell,C.tilt).y-ue.y,Qe={width:j.width,height:j.height},un={position:"relative",zIndex:$e.stage,...Qe},Hn=C=>dr(te,g.current,u,h,C),Bn=C=>Xe||ct.has(C),Dn=Qn(c),At=C=>(0,de.jsx)(_n.Provider,{value:Dn,children:C}),Yt=te.nodes.filter(C=>C.screenOf===void 0).map(C=>(0,de.jsx)(_a,{node:C,crowded:Ua(C),useDom:Bn(C.id),blur:qe||!Xe&&Ve,...C.plot&&te.city&&Math.round(C.plane)===2?{frontY:ht(te.city,C,C.plot,1),centerY:ht(te.city,C,C.plot,2)}:{},touched:Ne.has(C.id),...kd(ut(C)),scheme:u,canvasWidth:j.width,canvasHeight:j.height,selected:p.includes(C.id),...Vt(C),onMenu:x,selection:p,onDragStart:ue=>wt(C,ue),onDragMove:se,onDragEnd:be,swallowClick:Ge,children:C.beyond?(0,de.jsx)(ca,{kinds:C.beyond}):C.aggregate?.opens?(0,de.jsx)(pa,{node:C}):(0,de.jsx)(ha,{node:C,mode:"scene",selected:p.includes(C.id),...Ua(C)?{fidelity:"glyph"}:{}})},C.id));return(0,de.jsxs)("div",{ref:g,className:`graview-ground${r?` ${r}`:""}`,"data-graview-altitude":f.overview?"":void 0,"data-graview-reach":te.city?Sd(St(j)):void 0,"data-graview-settled":te.t>=1&&!Je.gliding()?"":void 0,"data-graview-box":S?`${S.width}x${S.height}`:void 0,"data-graview-renderer":Xe?"dom":"gpu","data-graview-blur":(Xe?qe:Ve)?"":void 0,onPointerDown:C=>{tt.onPointerDown(C),ln(C)},onPointerMove:C=>{tt.onPointerMove(C),se(C)},onPointerUp:()=>{tt.onPointerUp(),be()},onPointerCancel:()=>{tt.onPointerUp(),be()},onContextMenu:tt.onContextMenu,onClick:C=>{Ge.current||C.target.closest("[data-graview-view], button, aside, section[aria-label], [data-graview-offstage], a, input, select")||(y([]),x(null))},style:{position:"relative",width:"100%",height:"100%",cursor:"grab",touchAction:"none","--graview-altitude":f.overview?1:0,...te.city?{"--graview-lattice-cell":`${te.city.cell.toFixed(2)}px`,"--graview-lattice-tilt":(te.city.tilt??.5).toFixed(3),"--graview-lattice-x":`${(te.city.originX+te.city.pan.x).toFixed(1)}px`,"--graview-lattice-y":`${(te.city.originY+te.city.pan.y).toFixed(1)}px`}:{},overflow:"hidden",...s},children:[(0,de.jsx)("div",{className:"graview-measure","aria-hidden":"true",style:{"--graview-world-x":`${(te.pan?.x??0).toFixed(1)}px`,"--graview-world-y":`${(te.pan?.y??0).toFixed(1)}px`}}),f.overview&&te.city?(0,de.jsx)(K.Suspense,{fallback:null,children:(0,de.jsx)(Wd,{frame:te,...Qe,pan:te.city.pan,store:a,graphVersion:X,selection:p,view:{overview:f.overview,focusId:f.focusId,beside:U},emphasis:v,hiddenKinds:c.hiddenKinds,drawn:Nn})}):null,(0,de.jsx)("div",{ref:Q,"aria-hidden":"true",style:{position:"absolute",top:0,right:0,width:"var(--graview-dock, 0px)",height:"var(--graview-sheet, 0px)",visibility:"hidden",pointerEvents:"none"}}),te.city?(0,de.jsx)(K.Suspense,{fallback:null,children:(0,de.jsx)(Vd,{frame:te,...Qe,pan:te.city?te.city.pan:P,brand:w,pinned:re,close:ee*T>1.2,swallowed:Ge,...f.overview?{chosen:Mn(p,{overview:f.overview,focusId:f.focusId,beside:U},C=>a.graph.getNode(C)?.kind).records}:{},onFocus:C=>{let ue=Pe(C);ue!==null&&b(me=>bt(me,Le(ue)))}})}):null,f.overview&&te.city&&d?(0,de.jsx)(K.Suspense,{fallback:null,children:(0,de.jsx)(Gd,{frame:te,...Qe,pan:te.city.pan,app:c.app,workflows:d,acts:a.allMutations(),runs:c.workflowRuns,graphVersion:X,hiddenKinds:c.hiddenKinds})}):null,Xe?(0,de.jsx)("div",{"data-graview-stage":"dom","data-graview-world":"",style:{...un,overflow:"hidden"},children:At(Yt)}):(0,de.jsxs)("div",{"data-graview-world":"",style:un,children:[(0,de.jsx)("div",{"data-graview-stage":"dom","data-graview-under-canvas":"",style:{position:"absolute",left:0,top:0,...Qe,overflow:"hidden"},children:At(Yt.filter(C=>ct.has(String(C.key))))}),(0,de.jsx)("canvas",{ref:z,"data-graview-stage":"gpu",content:"drawable",layoutsubtree:"",...Qe,style:{display:"block",position:"relative",...Qe},children:At(Yt.filter(C=>!ct.has(String(C.key))))})]}),f.overview?(0,de.jsx)(_i,{result:j,schema:a.schema,chrome:D?[...k.chrome??[],D]:k.chrome??[],onGo:C=>{Ye(C.x,C.y),R()}}):null,f.overview?(0,de.jsx)(Yd,{zoom:T,zoomBy:C=>A.current(C),above:q,setAbove:O}):null,(0,de.jsx)(Wa,{frame:te,focusId:f.focusId,beside:U,holding:pe,...Qe,scheme:u,overview:!!f.overview,selection:p,emphasis:v,stageRef:g,store:a,graphNodes:X,...(C=>C?{provisional:C}:{})(Fa(a)),onPickEdge:(C,ue)=>{Ge.current||(y([C]),x(ue?{...ue,on:C}:null))},liveOf:C=>{let ue=cn(C.from),me=cn(C.to);return ue?.wrote&&me?.wrote?ue.at>me.at?ue:me:void 0}}),(0,de.jsx)(Yi,{width:j.width,whereIs:Hn}),(0,de.jsx)(Gi,{marks:Ot.marks,questions:[...V.values()].filter(C=>C.mode==="asking"&&C.at!==null&&C.say).map(C=>({id:C.at,who:C.who,asks:C.say})),whereIs:Hn,stageRef:g,...Qe}),(0,de.jsx)(ja,{nodes:te.nodes,moving:te.t<1,holding:pe,scheme:u,width:j.width,stageRef:g}),l,(0,de.jsx)("div",{className:"graview-lattice","aria-hidden":"true"})]})}var ot=oe(Ee(),1);function _d(){return rs(),null}var ns=()=>window.location.pathname.endsWith(Io),es=()=>(ns()?Do:Er)(window.location.hash),Kd=e=>(ns()?$o:Mr)(e);function rs(){let{view:e,setView:t,views:n,principal:o}=ge(),r=JSON.stringify(o),s=(0,ot.useCallback)(a=>{let u=a.within?.view;if(u===void 0||a.focusId)return a;let h=n.places().find(f=>f.as===u);return h?{...a,focusId:Le(h.kind)}:a},[n]),i=(0,ot.useRef)(!1);(0,ot.useEffect)(()=>{if(typeof window>"u")return;let a=s(es());!Yn(a,Sr)&&!Yn(a,e)&&(i.current=!0,t(a))},[]),(0,ot.useEffect)(()=>{if(typeof window>"u")return;let a=()=>t(s(es()));return window.addEventListener("popstate",a),window.addEventListener("hashchange",a),()=>{window.removeEventListener("popstate",a),window.removeEventListener("hashchange",a)}},[t,s]);let l=(0,ot.useRef)(!1),c=(0,ot.useRef)(null),d=(0,ot.useRef)(r);(0,ot.useEffect)(()=>{if(typeof window>"u")return;if(i.current){i.current=!1;return}let a=d.current!==r;d.current=r;let u=Kd(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:Ht.at},"",h);return}if(a||os(c.current,e)){window.history.replaceState({graview:Ht.at},"",h),c.current=e;return}c.current=e,window.history.pushState({graview:++Ht.at},"",h),Ht.depth=Ht.at,Ht.tell()},[e,r])}function os(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(",")&&Ud(e.within,t.within):!1}function Ud(e,t){let n=o=>Object.entries(o??{}).sort(([r],[s])=>r.localeCompare(s)).map(([r,s])=>`${r}=${s}`).join("&");return n(ts(e))===n(ts(t))}function ts(e){if(!e||!("q"in e))return e;let{q:t,...n}=e;return n}var Ao=oe(Ee(),1);var is=new WeakMap,Xd=64,as=new WeakMap,qd=0,Qd=e=>{if(e===void 0)return 0;let t=as.get(e);return t===void 0&&as.set(e,t=qd+=1),t};function ss(e,t,n,o={}){let r=()=>{let d=[...new Set(t.flatMap(u=>wn(u)))],a=t.map(u=>Tt(u)).filter(u=>u!==null);return ci(e,t,{...n.principal?{principal:n.principal}:{},kindSelection:d,edgeSelection:a,...n.providers?{providers:n.providers}:{},...n.pins?{pins:n.pins}:{},...n.focus!==void 0?{focus:n.focus}:{},...o})};if(Object.keys(o).length>0)return r();let s=is.get(e);if(!s){let d={kept:new Map,at:e.log.length};is.set(e,s=d),e.subscribe(()=>d.kept.clear())}s.at!==e.log.length&&(s.kept.clear(),s.at=e.log.length);let i=JSON.stringify([t,n.principal??null,Qd(n.providers),n.pins??null,n.focus??null]),l=s.kept.get(i);if(l)return l;let c=r();return s.kept.set(i,c),s.kept.size>Xd&&s.kept.delete(s.kept.keys().next().value),c}function Zd(e,t,n={}){return ss(e,t,n)}function Jd(e={}){let{store:t,selection:n,principal:o,providers:r}=ge(),{about:s,principal:i=o,providers:l=r,pins:c,focus:d,...a}=e,u=s??n,h=Nt();return(0,Ao.useMemo)(()=>ss(t,u,{principal:i,providers:l,pins:c,focus:d},a),[t,u,e,h,i,l])}function el(){let{store:e,principal:t}=ge();return(0,Ao.useMemo)(()=>({preview:(n,o)=>hi(e,n,o??{},{pressed:t?{author:t}:{}}),apply:(n,o)=>ui(e,n,o??{},{author:t})}),[e,t])}export{Es as a,Rs as b,Os as c,As as d,Ps as e,Ls as f,ms as g,zd as h,_d as i,Zd as j,Jd as k,el as l};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Qe,b as Xe,c as Je,d as at,e as tt,h as Ze,i as ea,k as aa,l as ta,m as rt}from"./chunk.
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Qe,b as Xe,c as Je,d as at,e as tt,h as Ze,i as ea,k as aa,l as ta,m as rt}from"./chunk.YZBJUAS6.js";import{c as je}from"./chunk.XCWZFLIB.js";import{g as Qa,h as Ja,i as Za}from"./chunk.6YK5E7ZQ.js";import"./chunk.VZDHRY3U.js";import{b as Ua,c as Va,d as Ye,e as Ya}from"./chunk.A2R53GWF.js";import"./chunk.Q2EGESEZ.js";import{m as Re,q as qa,r as _a,s as Ga}from"./chunk.SMHP2CQH.js";import{a as Xa}from"./chunk.HJCQ6I3S.js";import{b as ja}from"./chunk.EJ4MSVX2.js";import"./chunk.KQPKYWDM.js";import{b as Wa}from"./chunk.OXWOUE3W.js";import{b as _e,d as Ue,e as Ve}from"./chunk.34DRUCH2.js";import"./chunk.KXFNRJ46.js";import"./chunk.OMRQTLI5.js";import{b as Ge}from"./chunk.MIE3ODQ2.js";import"./chunk.NEPQBMFT.js";import"./chunk.MBB5A6BT.js";import"./chunk.ERPILTRY.js";import"./chunk.BIDL7GQD.js";import"./chunk.QS32TO4N.js";import"./chunk.JVDPRQ7J.js";import"./chunk.57YDGGJK.js";import"./chunk.H7AH3IW4.js";import"./chunk.U5P23GO7.js";import{e as et}from"./chunk.Z2ZQJ3DD.js";import"./chunk.PDMX3GTL.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.MAHNJO6U.js";import"./chunk.75GENXGP.js";import"./chunk.NIAM7OTV.js";import"./chunk.4EXC26LI.js";import"./chunk.PWAP2GJS.js";import"./chunk.AHPYNDVA.js";import"./chunk.FNVGNISQ.js";import"./chunk.GZHZLJBF.js";import{c as Ha,d as Oa,e as we,p as Da}from"./chunk.WUVXIUA7.js";import"./chunk.OJGHDWI6.js";import"./chunk.BN7C5ZYX.js";import"./chunk.REUMBCSV.js";import"./chunk.2KIWGQXC.js";import"./chunk.D5LOTCBU.js";import{G as Fa,c as Na,d as Ia,j as qe,n as Ba,u as Ka}from"./chunk.KZUMXT5J.js";import{b as Ea,c as $t}from"./chunk.CGK2PY76.js";import{G,Ia as Ee,Na as Ma,Oa as U,Ra as La,T as $,Va as Pa,_ as Ra,aa as Ta,ba as T,da as Ce,i as Ke,j as $e,m as ee,ma as za,n as Ae,o as Fe,r as ve,x as Aa,y as ue,z as Ca}from"./chunk.CYTTZOYL.js";import{a as ie}from"./chunk.SDO3U72B.js";import{Pc as $a,Z as re,na as ka,oa as Se,od as H,pa as _,qd as D,ta as Sa}from"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as m}from"./chunk.AJZBJBMO.js";function At(e){return`
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
.graview-altitude-control {
|
|
@@ -1128,6 +1128,6 @@ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=gl
|
|
|
1128
1128
|
}
|
|
1129
1129
|
[data-graview-connector][data-graview-activity] {
|
|
1130
1130
|
animation: graview-relation 1200ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
1131
|
-
}`}function ra(e="dark",o={}){let d=At(e);return o.scope===void 0?d:Ea(d,o.scope)}var O=m(G(),1);var V=m($(),1),Ct=Ee(ie(()=>(__graviewPreload(import.meta.url,["./chunk.AI34V6WV.js","./chunk.G4ULQK64.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.IQMD7DG3.js")))).part(e=>(0,V.jsx)(e.MapKey,{}),{quiet:!0});function ia(){let{store:e}=T(),{view:o}=U(),d=Ce(),s=(0,O.useMemo)(()=>e.graph.allEdges().length>0,[e,d]),[n,w]=(0,O.useState)(!1),v=(0,O.useId)(),g=(0,O.useRef)(null),x=(0,O.useRef)(null);return(0,O.useEffect)(()=>{if(!n)return;let h=c=>{let C=c.target;C&&(x.current?.contains(C)||g.current?.contains(C))||w(!1)};return document.addEventListener("pointerdown",h,!0),()=>document.removeEventListener("pointerdown",h,!0)},[n]),s?(0,V.jsxs)("div",{style:{display:"contents"},onKeyDown:h=>{h.key!=="Escape"||!n||(h.preventDefault(),h.stopPropagation(),w(!1),g.current?.focus({preventScroll:!0}))},children:[(0,V.jsx)("button",{ref:g,type:"button","data-testid":"lines-key","aria-expanded":n,"aria-controls":v,title:"What the lines mean",onClick:()=>w(h=>!h),style:{position:"absolute",top:60,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("overview"),height:30,padding:"0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.8125rem",color:n?"var(--graview-accent)":"var(--graview-ink-muted)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Key"}),n?(0,V.jsxs)("div",{ref:x,id:v,"data-testid":"lines-key-pane","data-graview-offstage":"",style:{position:"absolute",top:98,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("rail"),width:tt,maxHeight:"calc(100cqh - 120px)",overflowY:"auto",boxSizing:"border-box",padding:"8px 8px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[o.overview?(0,V.jsx)(Ct,{}):null,(0,V.jsx)(at,{inside:!0,widthOf:Xa})]}):null]}):null}var ze=m(G(),1),Te=m($(),1);function it(e){return e.lens!==null?{what:"lens",kind:e.lens}:e.records.length===1&&e.districts.length===0?{what:"record",id:e.records[0]}:e.districts.length===1&&e.records.length===0?{what:"district",kind:e.districts[0]}:null}var Et=Ee(ie(()=>(__graviewPreload(import.meta.url,["./chunk.RMR24LFJ.js","./chunk.RD2X25XB.js","./chunk.KMV6PJFL.js","./chunk.NAD7ZXYP.js","./chunk.2GEJNG2U.js","./chunk.HJCQ6I3S.js","./chunk.22BZU7ME.js","./chunk.2N4Z5K5S.js","./chunk.AJSUHPBE.js","./chunk.LAYQ5PFS.js","./chunk.KDXU5DT3.js","./chunk.O2BHPYA4.js","./chunk.M4AYA2PL.js","./chunk.H5S7OL2U.js","./chunk.PZQNR4KZ.js","./chunk.W4BKYSZX.js","./chunk.NOGGSLVG.js","./chunk.WVUJXDXZ.js","./chunk.SGCW2XRC.js","./chunk.ZN3PUM2I.js","./chunk.QIPASE42.js","./chunk.EVBCEEQ4.js","./chunk.OWT3VVOT.js","./chunk.NHTGAP3G.js","./chunk.GZHZLJBF.js","./chunk.UKQUUPKE.js","./chunk.OJGHDWI6.js","./chunk.DDUCIUVW.js","./chunk.NUYA4BWI.js","./chunk.OKZT2QBM.js","./chunk.ACTXR2MI.js","./chunk.AI34V6WV.js","./chunk.G4ULQK64.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.THVC2BEC.js")))),Rt=Et.part((e,o)=>(0,Te.jsx)(e.MapPanelFor,{showing:o.showing}),{what:"This panel",quiet:!0});function na(){let{store:e,view:o,selection:d,hiddenKinds:s,seatTalk:n}=T();Ce();let w=(0,ze.useSyncExternalStore)(n.subscribe,()=>n.get().draft!==null,()=>!1);if(!o.overview||w)return null;let v=it(ja(d,{...o,beside:!0},g=>e.graph.getNode(g)?.kind));return!v||v.what!=="record"&&(s.has(v.kind)||!e.schema.kinds.includes(v.kind))?null:(0,Te.jsx)(ze.Suspense,{fallback:null,children:(0,Te.jsx)(Rt,{showing:v})})}var Tt=m(G(),1);var W=m($(),1);function oa(){let{view:e,go:o}=U(),{store:d,views:s,hiddenKinds:n}=T(),w=e.overview??!1,v=s.places().map(E=>E.kind).filter(E=>!n.has(E)),g=Fa(e,d.schema.kinds,v),x=()=>{o($e(ee(e,!1),g))},h=(()=>{if(!g)return null;let E=Aa(g)[0],b=e.within?.view,R=(b?s.places().find(N=>N.as===b):void 0)??(E?s.places().filter(N=>N.kind===E).at(-1):void 0);return R?R.title:E?_(d.schema,E):d.graph.getNode(g)?.label??null})(),c=w?"Close the map":"Up",C=w&&h?`Close the map, down to ${h}`:c;return(0,W.jsxs)("button",{type:"button","data-testid":"overview",className:"graview-altitude-control","aria-pressed":w,"aria-label":C,title:w?C:"Up \u2014 the whole thing, from above",onClick:()=>w?x():o(ee(e,!0)),style:{position:"absolute",top:14,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("overview"),display:"inline-flex",alignItems:"center",justifyContent:"center",gap:7,height:38,padding:"0 13px 0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.875rem",whiteSpace:"nowrap",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)","--graview-altitude":w?1:0,...w?{color:"var(--graview-accent)"}:{}},children:[(0,W.jsxs)("svg",{className:"graview-altitude-mark",width:"16",height:"16",viewBox:"0 0 12 12","aria-hidden":"true",children:[(0,W.jsx)("ellipse",{className:"graview-altitude-mark-ring",cx:"6",cy:"6.6",rx:"5",ry:"2.6",fill:"none",stroke:"currentColor",strokeWidth:"0.9"}),(0,W.jsx)("circle",{className:"graview-altitude-mark-apex",cx:"6",cy:"4",r:"1.5",fill:"currentColor"}),(0,W.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"left",cx:"1.6",cy:"7.4",r:"1.2",fill:"currentColor"}),(0,W.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"right",cx:"10.4",cy:"7.4",r:"1.2",fill:"currentColor"})]}),(0,W.jsx)("span",{className:"graview-altitude-label",children:c})]})}var sa=m($(),1);function da(){let{administered:e}=T(),{view:o,go:d}=U(),s=e.filter(n=>n.canShow);return s.length===0?null:(0,sa.jsx)("div",{role:"group","aria-label":"Administered","data-testid":"administered",style:{display:"flex",gap:6},children:s.map(n=>(0,sa.jsx)("button",{type:"button","aria-pressed":n.shown,"data-testid":`show-${n.name}`,title:n.shown?`Hide the ${n.name}'s own districts again`:n.description??`Show the ${n.name}'s own districts beside the domain`,onClick:()=>d(Ua(o,n.name,!n.shown)),style:{padding:"3px 11px",borderRadius:999,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:n.shown?"var(--graview-accent)":"var(--graview-edge)",color:n.shown?"var(--graview-accent)":"var(--graview-ink-muted)",background:n.shown?"var(--graview-panel)":"transparent"},children:n.shown?`Hide the ${n.name}`:`Show the ${n.name}`},n.name))})}var u=m(G(),1);var t=m($(),1);Ra({search:_a,touchWeights:qa});var ne=e=>e!==void 0&&"act"in e,Me=e=>e!==void 0&&"hit"in e&&e.hit.about==="node"?e:void 0,zt=e=>e.about==="rule"?"rule:":e.about==="act"?"act:":e.kind;function Mt(e){let o=()=>typeof window>"u"||window.innerWidth>=Ft,[d,s]=(0,u.useState)(o);return(0,u.useEffect)(()=>{let n=()=>s(o());return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),d&&!e}function dt({compact:e=!1}){let{store:o,view:d,setView:s,principal:n,setMenuAt:w,brand:v,aiDesk:g,selection:x}=T(),h=Ia(g),c=Ta(),C=Ma(),E=Da().marks.flag,b=Mt(e),R=(0,u.useRef)(null),N=(0,u.useRef)(null),z=(0,u.useRef)(null),B=(0,u.useId)(),[Le,I]=(0,u.useState)(!1),[K,se]=(0,u.useState)(null),[ft,he]=(0,u.useState)(null),[Pe,be]=(0,u.useState)([]),M=d.q??"";(0,u.useEffect)(()=>{let a=r=>{if(r.defaultPrevented)return;let i=r.key.toLowerCase()==="k"&&(r.metaKey||r.ctrlKey)&&!r.altKey&&!r.shiftKey,l=r.key==="/"&&!r.metaKey&&!r.ctrlKey&&!r.altKey;if(!i&&!l)return;let p=R.current;if(!p)return;let f=p.closest("[data-graview-embed]"),S=r.target,J=S===document.body||S===document.documentElement||S===window;if(f&&!(i&&J||S instanceof Node&&f.contains(S)))return;let Z=document.activeElement,ge=Z instanceof HTMLInputElement||Z instanceof HTMLTextAreaElement||Z instanceof HTMLSelectElement||Z instanceof HTMLElement&&Z.isContentEditable;l&&ge||(r.preventDefault(),p.getClientRects().length===0&&p.closest("[data-graview-app-bar]")?.querySelector('[data-testid="app-find-open"]')?.click(),p.focus({preventScroll:!0}),p.select(),I(!0))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]);let Ne=(0,u.useMemo)(()=>{let a=new Map;for(let[i,l]of(c?.hits??[]).entries()){if(l.about==="act")continue;let p=zt(l),f=a.get(p)??[];f.push({id:`${B}-${i}`,hit:l}),a.set(p,f)}let r=[...a.values()].filter(i=>i.some(l=>l.hit.about==="node")).length>1;return[...a.entries()].map(([i,l])=>{let p=0,f=l.filter(ge=>ge.hit.about!=="node"||!r||++p<=Wt),S=f.filter(ge=>ge.hit.about==="node").length,J=i.endsWith(":")?l.length:c?.byKind[i]??S,Z=!i.endsWith(":")&&S>0&&J>S?{id:`${B}-all-${i}`,all:i,count:J}:null;return{key:i,rows:f,count:J,more:Z}})},[c,B]),ae=h&&M.trim()?{id:`${B}-ask`,ask:M.trim()}:null,k=(0,u.useMemo)(()=>[...Ne.flatMap(a=>a.more?[...a.rows,a.more]:a.rows),...ae?[ae]:[]],[Ne,ae?.ask]),wa=(c?.hits??[]).filter(a=>a.about==="node").length,xe=c?.words??M,Ie=(0,u.useMemo)(()=>Re(xe).split(" ").filter(Boolean),[xe]),F=(0,u.useCallback)(a=>a.hit.about==="node"?Ga(o,a.hit.id,xe,{principal:n,limit:Bt}).map((r,i)=>({id:`${a.id}-act-${i}`,act:r,of:a.id})):[],[o,xe,n]),He=k.find(a=>a.id===K),q=k.find(a=>a.id===ft)??He??k[0],de=(0,u.useMemo)(()=>b&&Me(q)?F(q):[],[b,q?.id,F]),ye=(0,u.useMemo)(()=>b?new Map:new Map(Pe.flatMap(a=>{let r=Me(k.find(i=>i.id===a));return r?[[a,F(r)]]:[]})),[b,Pe,k,F]),ht=(0,u.useMemo)(()=>b?new Set:new Set(k.flatMap(a=>Me(a)&&F(a).length>0?[a.id]:[])),[b,k,F]),Oe=(0,u.useMemo)(()=>b?de:[...ye.values()].flat(),[b,de,ye]),L=He??Oe.find(a=>a.id===K)??k[0];(0,u.useEffect)(()=>{se(null),he(null),be([])},[M]);let le=(0,u.useRef)(null);(0,u.useEffect)(()=>{let a=le.current;if(!a)return;le.current=null;let r=0,i=()=>{let l=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`),p=document.activeElement;if(!(!p||p===document.body||p===document.documentElement||p===R.current||p===z.current||p===l))return;let S=[...l?.querySelectorAll('[role="group"][aria-label="Arrange"] :is(button, input)')??[]].find(J=>J.checkVisibility?.()??!0);if(S)return S.focus({preventScroll:!0});l&&l.tabIndex>=0&&p!==l&&l.focus({preventScroll:!0}),++r<240?requestAnimationFrame(i):document.activeElement===z.current&&z.current?.blur()};requestAnimationFrame(i)},[d]);let De=(a,r)=>{let i=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`);if(i&&i.tabIndex>=0)return i.focus({preventScroll:!0});let l=z.current;if(!l)return R.current?.blur();l.setAttribute("aria-label",r),l.focus({preventScroll:!0})},ma=(0,u.useRef)({x:Number.NaN,y:Number.NaN,moved:!1});(0,u.useEffect)(()=>{let a=r=>{let i=ma.current;i.moved=r.clientX!==i.x||r.clientY!==i.y,i.x=r.clientX,i.y=r.clientY};return window.addEventListener("mousemove",a,{capture:!0,passive:!0}),()=>window.removeEventListener("mousemove",a,{capture:!0})},[]);let ce=(0,u.useRef)(void 0);(0,u.useEffect)(()=>()=>clearTimeout(ce.current),[]);let te=a=>{a&&(clearTimeout(ce.current),se(a.id),ne(a)||he(a.id))},fa=a=>{if(!ma.current.moved)return;let r=a.target.closest?.('[role="option"]')?.id;if(!r||r===K)return;let i=k.find(l=>l.id===r)??Oe.find(l=>l.id===r);i&&(se(i.id),!ne(i)&&(clearTimeout(ce.current),ce.current=setTimeout(()=>he(i.id),Kt)))},bt=()=>{clearTimeout(ce.current),q&&!ne(L)&&se(q.id)},xt=a=>be(r=>r.includes(a.id)?r.filter(i=>i!==a.id):[...r,a.id]),ha=a=>{let r=N.current,i=r?.querySelector('[role="option"]')?.getBoundingClientRect().height??0,l=r?.clientHeight??0;return Math.min(a,i>0&&l>0?Math.max(1,Math.floor(l/i)-1):Ot)};(0,u.useEffect)(()=>{K&&document.getElementById(K)?.scrollIntoView?.({block:"nearest"})},[K]);let We=a=>{if(!a)return;if("ask"in a){Na(g,{pointed:{...x[0]!==void 0?{on:x[0]}:{},about:x},asked:a.ask}),s(i=>Ye(i)),I(!1);return}if("all"in a)return s(i=>ue(ee(i,!1),ve(a.all),{ownPicture:!0,...i.q?{carry:i.q}:{}})),le.current=a.all,I(!1),De(a.all,`Opening ${_(o.schema,a.all)} matching \u201C${M.trim()}\u201D\u2026`);if(ne(a)){let i=a.act.subject;s(p=>Ae(p,[i]));let l=R.current?.getBoundingClientRect();w({x:l?.left??0,y:(l?.bottom??0)+6,on:i}),I(!1),R.current?.blur();return}let r=a.hit;switch(r.about){case"node":s(i=>Ae($e(ee(i,!1),r.id),[r.id]));break;case"kind":return s(i=>ue(ee(i,!1),ve(r.kind),{ownPicture:!0})),le.current=r.kind,I(!1),De(r.kind,`Opening ${r.label}\u2026`);case"place":return s(i=>Ca(i,r.kind,r.as)),le.current=r.kind,I(!1),De(r.kind,`Opening ${r.title}\u2026`);case"rule":{let i=C.filter(l=>l.invariant===r.name).flatMap(l=>l.nodeIds);s(l=>Ae(l,[...new Set(i)]));break}case"act":break}I(!1),R.current?.blur()},yt=c?Ht(c.byKind,c.hits,o.schema):"",pe=Le&&M.trim().length>0,kt=(0,u.useCallback)(()=>{let a=R.current?.closest("[data-graview-app-bar]")?.getBoundingClientRect();if(a)return{x:a.right,y:a.bottom-Ut};let r=R.current?.getBoundingClientRect();return r?{x:r.right,y:r.bottom}:null},[]),ba=Pa("find",{open:pe,onOpenChange:a=>{a||I(!1)},...e?{at:kt}:{}}),ke=k.every(a=>"ask"in a),xa=a=>ne(a)?Oe.filter(r=>r.of===a.of):[],St=a=>{let r=ne(L)&&K!==null,i=r?k.find(p=>p.id===L.of):K!==null?He:void 0,l=i?k.indexOf(i):-1;if(a.key==="ArrowDown"){if(a.preventDefault(),I(!0),r){let p=xa(L),f=p.indexOf(L)+1;if(f<p.length)return te(p[f]);if(b)return}te(k[Math.min(k.length-1,l+1)])}else if(a.key==="ArrowUp"){if(a.preventDefault(),r){let p=xa(L),f=p.indexOf(L)-1;return te(f>=0?p[f]:i)}te(k[Math.max(0,l-1)])}else if((a.key==="PageDown"||a.key==="PageUp")&&k.length>0){a.preventDefault(),I(!0);let p=a.key==="PageDown"?ha(k.length):-ha(k.length);te(k[Math.min(k.length-1,Math.max(0,(l<0?-1:l)+p))])}else if(a.key==="ArrowRight"&&!r&&Me(L)){let p=L,f=b?p.id===q?.id?de:F(p):ye.get(p.id)??F(p);if(f.length===0)return;a.preventDefault(),!b&&!Pe.includes(p.id)&&be(S=>[...S,p.id]),he(p.id),se(f[0].id)}else if(a.key==="ArrowLeft"&&r){a.preventDefault();let p=L.of;b||be(f=>f.filter(S=>S!==p)),te(k.find(f=>f.id===p))}else a.key==="Enter"?(a.preventDefault(),We(L)):a.key==="Escape"&&(a.preventDefault(),M?s(p=>Ye(p)):R.current?.blur())},Be=(a,r,i={},l={})=>{let p=a.id===L?.id;return(0,t.jsx)("div",{id:a.id,role:"option","aria-selected":p,onClick:()=>We(a),style:{...Zt,...p?er:null,...i},...l,children:r},a.id)},ya=(a,r)=>{let i=a.id===L?.id;return(0,t.jsx)("div",{id:a.id,role:"option","aria-selected":i,"data-testid":"find-act","data-about":"act",onClick:()=>We(a),style:{...r?ir:ct,...i?nr:null,...a.act.destructive?{color:"var(--graview-warn)"}:null},children:a.act.title},a.id)};return(0,t.jsxs)("div",{style:{position:"relative",minWidth:0,flex:"1 1 auto"},"data-testid":"find",children:[(0,t.jsx)("input",{ref:a=>{R.current=a,ba.trigger.ref(a)},"data-graview-popover-trigger":"find",type:"search",role:"combobox","aria-label":"Find anything","aria-expanded":pe,"aria-controls":B,"aria-autocomplete":"list",...pe&&L?{"aria-activedescendant":L.id}:{},"data-testid":"find-box",placeholder:"Find\u2026","aria-keyshortcuts":"/ Meta+K Control+K",value:M,onChange:a=>{let r=a.target.value;I(!0),s(i=>Va(i,r.length>0?r:null))},onFocus:()=>I(!0),onBlur:()=>I(!1),onKeyDown:St,style:{width:"100%",boxSizing:"border-box",minWidth:0,height:30,padding:"0 var(--graview-bar-find-end, 10px) 0 10px",font:"inherit",fontSize:"0.875rem",color:"var(--graview-ink)",background:"var(--graview-panel)",border:`1px solid ${M?"var(--graview-accent)":"var(--graview-edge)"}`,borderRadius:8}}),(0,t.jsx)("span",{role:"status","aria-live":"polite",style:qe,"data-testid":"find-count",children:M.trim()?yt:""}),(0,t.jsx)("span",{ref:z,tabIndex:-1,role:"status",style:qe,"data-testid":"find-landing"}),(0,t.jsxs)("div",{...ba.pane,id:B,role:"listbox","aria-label":M?`What \u201C${M}\u201D finds`:"What the words find","data-testid":"find-strip","data-graview-find":b?"panel":"narrow",hidden:!pe,onMouseDown:a=>a.preventDefault(),style:{..._t,...e?Vt:b&&!ke?Gt:null,...pe?{display:"flex"}:null},children:[(0,t.jsxs)("div",{style:{...Yt,gridTemplateColumns:b&&!ke?`minmax(0, 1fr) ${qt}`:"minmax(0, 1fr)"},children:[(0,t.jsxs)("div",{ref:N,role:"presentation","data-testid":"find-list",onMouseMove:fa,style:jt,children:[ke?(0,t.jsxs)("p",{role:"presentation",style:{margin:0,padding:"10px 12px",color:"var(--graview-ink-muted)",fontSize:"0.875rem"},"data-testid":"find-nothing",children:["Nothing here is called \u201C",c?.words||M,"\u201D."]}):Ne.map(a=>(0,t.jsxs)("div",{role:"group","aria-label":ot(a.key,o.schema),children:[(0,t.jsxs)("div",{role:"presentation",style:la,children:[a.key!=="rule:"&&a.key!=="act:"?(0,t.jsx)(lt,{kind:a.key,accents:v?.accents}):null,(0,t.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ot(a.key,o.schema)}),(0,t.jsx)("span",{"aria-hidden":"true",style:Jt,"data-testid":"find-group-count",children:re(a.count)})]}),a.rows.map(r=>{let i=r.hit,l=i.about==="node"?i:null,p=!b&&l!==null&&ht.has(r.id),f=ye.get(r.id);return(0,t.jsxs)(u.Fragment,{children:[Be(r,(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Pt,{hit:i,flag:E,words:l?.near&&l.why.matched?[...Ie,Re(l.why.matched)]:Ie}),p?(0,t.jsx)("span",{"aria-hidden":"true","data-testid":"find-acts-open","data-open":f?"":void 0,title:f?"Put its actions away":"Actions",onClick:S=>{S.stopPropagation(),xt(r)},style:{...sr,...f?dr:null},children:(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"3.5",cy:"8",r:"1.4",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"1.4",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"12.5",cy:"8",r:"1.4",fill:"currentColor"})]})}):null]}),p?{paddingRight:48}:{},{"data-testid":"find-hit","data-about":i.about,...l?.near?{"data-near":""}:{},title:It(i)}),f?(0,t.jsx)("div",{role:"group","aria-label":`What can be done about ${l?.label??"it"}`,style:or,children:f.map(S=>ya(S,!0))}):null]},r.id)}),a.more?Be(a.more,(0,t.jsxs)("span",{style:Q,children:["All ",re(a.more.count)," ",Se(o.schema,a.more.all).toLowerCase()," matching \u201C",M.trim(),"\u201D"]}),ar,{"data-testid":"find-all","data-about":"all"}):null]},a.key)),ae?Be(ae,(0,t.jsxs)("span",{style:Q,children:["Ask: ",(0,t.jsxs)("span",{style:{fontWeight:600},children:["\u2018",ae.ask,"\u2019"]})]}),{borderTop:"1px solid var(--graview-edge)",marginTop:4},{"data-testid":"find-ask"}):null,wa>Dt?(0,t.jsxs)("p",{role:"presentation",style:st,"data-testid":"find-more-words",children:[re(wa)," found: another word of the name narrows them."]}):null,c&&c.searched.past===!1&&c.searched.kinds.some(a=>o.schema.tryDefinition(a)?.lifecycle)?(0,t.jsx)("p",{role:"presentation",style:st,children:"Current ones; add is:any for the past."}):null]}),b&&!ke&&q?(0,t.jsxs)("div",{role:"group","aria-label":"The one lit","data-testid":"find-panel",onMouseEnter:bt,onMouseMove:fa,style:Qt,children:[(0,t.jsx)(Lt,{row:q,schema:o.schema,accents:v?.accents,marking:Ie,q:M.trim(),flag:E}),de.length>0?(0,t.jsxs)("div",{role:"group","aria-label":"Actions",style:{display:"grid",gap:4},children:[(0,t.jsx)("div",{role:"presentation",style:{...la,padding:"10px 0 4px"},children:"Actions"}),de.map(a=>ya(a,!1))]}):null]}):null]}),e?null:(0,t.jsxs)("div",{"aria-hidden":"true",style:lr,"data-testid":"find-keys",children:[(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"\u2191"}),(0,t.jsx)("kbd",{style:fe,children:"\u2193"})," move"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"\u21B5"})," open"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"\u2192"})," actions"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"esc"})," close"]})]})]})]})}function Lt({row:e,schema:o,accents:d,marking:s,q:n,flag:w}){let v=null,g="",x,h=null;if("ask"in e)g="Ask",x=`\u2018${e.ask}\u2019`,h=(0,t.jsx)("p",{style:Y,children:"Asks it of what is selected; the answer comes on a card beside it."});else if("all"in e)v=e.all,g=_(o,e.all),x=`All ${re(e.count)} matching \u201C${n}\u201D`,h=(0,t.jsxs)("p",{style:Y,children:["Opens the ",Se(o,e.all).toLowerCase(),", narrowed by these words."]});else{let c=e.hit;switch(c.about){case"node":{v=c.kind,g=nt(Sa(o.tryDefinition(c.kind),c.kind)),x=(0,t.jsxs)(t.Fragment,{children:[c.flagged?(0,t.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[w," "]}):null,(0,t.jsx)(j,{text:c.label,words:s})]});let C=[c.apart,c.current?null:"past",c.archived?"set aside":null].filter(Boolean).join(" \xB7 ");h=(0,t.jsxs)(t.Fragment,{children:[C?(0,t.jsx)("p",{style:Y,children:nt(C)}):null,c.near?(0,t.jsxs)("p",{style:Y,children:["Near \u201C",c.why.asked,"\u201D",c.why.field!=="label"?` \u2014 ${c.why.reading.toLowerCase()}: ${c.why.fragment}`:""]}):c.why.field!=="label"?(0,t.jsxs)("p",{style:Y,children:[(0,t.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:c.why.reading}),(0,t.jsx)("br",{}),(0,t.jsx)(j,{text:c.why.fragment,words:s})]}):null]});break}case"kind":v=c.kind,g="Kind",x=c.label,h=(0,t.jsxs)("p",{style:Y,children:["Goes into the ",c.label.toLowerCase(),", all of them",c.count>0?`; ${re(c.count)} match these words`:"","."]});break;case"place":v=c.kind,g="Place",x=c.title,h=(0,t.jsxs)("p",{style:Y,children:["A picture of the ",Se(o,c.kind).toLowerCase(),"."]});break;case"rule":g="Rule",x=c.label,h=(0,t.jsx)("p",{style:Y,children:"Selects what it flags."});break;case"act":g="Act",x=c.title;break}}return(0,t.jsxs)("div",{role:"presentation","data-testid":"find-said",style:{display:"grid",gap:6},children:[(0,t.jsxs)("div",{style:{...la,padding:0},children:[v?(0,t.jsx)(lt,{kind:v,accents:d}):null,g]}),(0,t.jsx)("div",{style:Xt,children:x}),h]})}function Pt({hit:e,flag:o,words:d}){switch(e.about){case"node":return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{style:tr,children:[e.flagged?(0,t.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[o," "]}):null,(0,t.jsx)(j,{text:e.label,words:d}),e.apart?(0,t.jsxs)("span",{style:me,children:[" \xB7 ",e.apart]}):null,e.current?null:(0,t.jsx)("span",{style:me,children:" \xB7 past"})]}),e.near?(0,t.jsxs)("span",{style:{...Q,...me},"data-testid":"find-near",children:["Near \u201C",e.why.asked,"\u201D",e.why.field!=="label"?` \u2014 ${e.why.reading.toLowerCase()}: `:"",e.why.field!=="label"?(0,t.jsx)(j,{text:e.why.fragment,words:d}):null]}):e.why.field!=="label"?(0,t.jsxs)("span",{style:{...Q,...me},children:[e.why.reading.toLowerCase(),": ",(0,t.jsx)(j,{text:e.why.fragment,words:d})]}):null]});case"kind":return(0,t.jsxs)("span",{style:Q,children:[(0,t.jsx)(j,{text:e.label,words:d}),(0,t.jsxs)("span",{style:me,children:[" \xB7 ",e.count," match"]})]});case"place":return(0,t.jsxs)("span",{style:Q,children:["Go to ",(0,t.jsx)(j,{text:e.title,words:d})]});case"rule":return(0,t.jsxs)("span",{style:Q,children:["The rule \u201C",(0,t.jsx)(j,{text:e.label,words:d}),"\u201D"]});case"act":return(0,t.jsx)("span",{style:Q,children:e.title})}}function Nt(e,o){if(o.length===0)return[{text:e}];let d=[],s=0;for(let n of e.matchAll(/[\p{L}\p{N}]+/gu)){let w=n[0],v=Re(w).replace(/ /g,""),g=o.filter(c=>v.startsWith(c)).sort((c,C)=>C.length-c.length)[0];if(!g)continue;let x=v.length===w.length?g.length:w.length,h=n.index??0;h>s&&d.push({text:e.slice(s,h)}),d.push({text:w.slice(0,x),marked:!0}),s=h+x}return s<e.length&&d.push({text:e.slice(s)}),d}function j({text:e,words:o}){return(0,t.jsx)(t.Fragment,{children:Nt(e,o).map((d,s)=>d.marked?(0,t.jsx)("mark",{style:rr,children:d.text},s):(0,t.jsx)(u.Fragment,{children:d.text},s))})}function It(e){if(e.about!=="node")return"";let o=e.near?`Near \u201C${e.why.asked}\u201D`:e.why.field!=="label"?`${e.why.reading}: ${e.why.fragment}`:"";return o?`${e.label}
|
|
1132
|
-
${o}`:e.label}var nt=e=>e&&e[0].toUpperCase()+e.slice(1);function lt({kind:e,accents:o}){let d=Math.round($a(e,o));return(0,t.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:2,flex:"0 0 auto",background:`hsl(${d} 55% 52%)`}})}function ot(e,o){return e==="rule:"?"Rules":e==="act:"?"Acts":_(o,e)}function Ht(e,o,d){let s=Object.entries(e).map(([v,g])=>ka(d,v,g)),n=o.filter(v=>v.about==="kind"||v.about==="place"||v.about==="rule").length;n>0&&s.push(`${n} ${n===1?"place or rule":"places and rules"}`);let w=o.filter(v=>v.about==="node"&&v.near).length;return s.length===0?"Nothing found":`${s.join(", ")} found${w>0?`, ${w} of them near`:""}`}var Ot=10,Dt=12,Wt=5,Bt=6,Kt=140,Ft=760,qt="15.5rem",_t={...La,flexDirection:"column",width:"min(26rem, calc(100vw - 24px))",maxHeight:"min(64vh, 30rem)",overflow:"hidden",boxSizing:"border-box",background:"linear-gradient(var(--graview-panel), var(--graview-panel)) var(--graview-ground, var(--graview-panel))",borderTop:"1px solid var(--graview-edge)",borderRight:"1px solid var(--graview-edge)",borderBottom:"1px solid var(--graview-edge)",borderLeft:"1px solid var(--graview-edge)",borderRadius:10,boxShadow:"0 10px 28px rgb(0 0 0 / 0.18)",padding:0},Gt={width:"min(42rem, calc(100vw - 24px))"},Ut=6,Vt={width:"var(--graview-bar-width, 100vw)",maxHeight:"55vh",borderRadius:0,borderLeft:"none",borderRight:"none"},Yt={display:"grid",gridTemplateRows:"minmax(0, 1fr)",flex:"1 1 auto",minHeight:0},jt={overflowY:"auto",overflowX:"hidden",minHeight:0,padding:"4px 0",overscrollBehavior:"contain"},Qt={overflowY:"auto",minHeight:0,padding:"12px 14px",borderLeft:"1px solid var(--graview-edge)",background:"var(--graview-panel-muted)",display:"flex",flexDirection:"column",gap:4},Xt={fontWeight:600,fontSize:"0.9375rem",lineHeight:1.35,color:"var(--graview-ink)",overflowWrap:"anywhere"},Y={margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)",overflowWrap:"anywhere"},la={display:"flex",alignItems:"center",gap:6,padding:"10px 12px 4px",fontSize:"0.6875rem",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},Jt={marginLeft:"auto",fontWeight:400,letterSpacing:0,fontVariantNumeric:"tabular-nums",color:"var(--graview-ink-faint)"},Zt={position:"relative",display:"grid",gap:1,minHeight:34,padding:"5px 12px",alignContent:"center",cursor:"pointer",fontSize:"0.875rem",lineHeight:1.35,color:"var(--graview-ink)",minWidth:0},er={background:"color-mix(in srgb, var(--graview-accent) 12%, var(--graview-panel))",boxShadow:"inset 3px 0 0 var(--graview-accent)"},ar={color:"var(--graview-accent)",fontSize:"0.8125rem",minHeight:30},Q={display:"block",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},tr={display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,minWidth:0,overflow:"hidden",overflowWrap:"anywhere",fontWeight:600},me={color:"var(--graview-ink-muted)",fontSize:"0.8125rem",fontWeight:400},rr={background:"color-mix(in srgb, var(--graview-accent) 24%, transparent)",color:"inherit",borderRadius:2,padding:0,boxShadow:"0 1px 0 color-mix(in srgb, var(--graview-accent) 70%, transparent)"},ct={display:"flex",alignItems:"center",minHeight:32,padding:"4px 10px",boxSizing:"border-box",borderWidth:1,borderStyle:"solid",borderColor:"var(--graview-edge)",borderRadius:6,background:"var(--graview-panel)",color:"var(--graview-ink)",fontSize:"0.8125rem",lineHeight:1.3,cursor:"pointer",overflowWrap:"anywhere"},ir={...ct,minHeight:32,margin:"0 12px 4px 24px"},nr={borderColor:"var(--graview-accent)",boxShadow:"inset 0 0 0 1px var(--graview-accent)",background:"color-mix(in srgb, var(--graview-accent) 12%, var(--graview-panel))"},or={display:"grid",padding:"2px 0 6px"},sr={position:"absolute",top:"50%",right:6,transform:"translateY(-50%)",width:36,height:32,display:"grid",placeItems:"center",borderRadius:6,color:"var(--graview-ink-muted)",borderWidth:1,borderStyle:"solid",borderColor:"transparent"},dr={color:"var(--graview-accent)",borderColor:"var(--graview-edge)",background:"var(--graview-panel)"},st={margin:0,padding:"6px 12px 4px",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},lr={display:"flex",flexWrap:"wrap",gap:"4px 14px",padding:"7px 12px",borderTop:"1px solid var(--graview-edge)",color:"var(--graview-ink-faint)",fontSize:"0.75rem",flex:"0 0 auto"},fe={display:"inline-block",minWidth:16,padding:"0 4px",marginRight:3,border:"1px solid var(--graview-edge)",borderRadius:4,font:"inherit",fontSize:"0.6875rem",lineHeight:"16px",textAlign:"center",color:"var(--graview-ink-muted)",background:"var(--graview-panel)"};var oe=m(G(),1);var ca=m($t(),1);var gt=m($(),1);function pt(){let{following:e,follow:o}=T();return e?(0,gt.jsxs)("button",{type:"button","data-testid":"following-who",onClick:()=>o(null),title:"Press, or Escape, to stop following",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,padding:"2px 9px",borderRadius:999,border:"1px solid var(--graview-accent)",background:"transparent",color:"var(--graview-accent)",fontSize:"0.875rem",whiteSpace:"nowrap"},children:["following ",e.name]}):null}var vt=m(G(),1);var A=m($(),1);function ut({home:e,homeLabel:o,children:d,onPicture:s=!1}){let{view:n,focus:w,show:v,go:g}=U(),{store:x}=T(),{movedByHand:h}=T(),c=h&&(n.pan!==void 0||Object.keys(n.pins).length>0),C=n.focusId&&n.focusId!==e?x.graph.getNode(n.focusId):void 0,E=z=>_(x.schema,z),b={display:"inline-flex",alignItems:"center",gap:6,minHeight:26,padding:"2px 6px",fontSize:"0.8125rem",borderRadius:6,border:"1px solid transparent",boxShadow:"none",background:"transparent",color:"var(--graview-ink-muted)",whiteSpace:"nowrap"},R=o!==void 0&&C!==void 0,N=[];if(C&&!s&&N.push({key:"focused",node:(0,A.jsxs)("button",{type:"button","data-testid":"focused",onClick:()=>g(Fe({...n,focusId:e},!1)),title:Ge(x,C.id),style:{...b,maxWidth:"min(14rem, 15vw)"},children:[(0,A.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:Ge(x,C.id)}),(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),n.past&&N.push({key:"past",node:(0,A.jsxs)("button",{type:"button","data-testid":"past",onClick:()=>g(Ya(n,!1)),title:"Back to now \u2014 retired things leave the picture again",style:b,children:["the past",(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),n.zoom&&N.push({key:"zoomed",node:(0,A.jsxs)("button",{type:"button","data-testid":"zoomed",onClick:()=>g(Fe(n,!1)),title:"Zoom back out",style:b,children:["zoomed in",(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),c&&N.push({key:"moved",node:(0,A.jsx)("button",{type:"button","data-testid":"moved",onClick:()=>g(Ke(n)),title:"Put the camera and everything you dragged back where the layout wanted them",style:b,children:"Reset view"})}),n.relation){let z=n.relation;N.push({key:"raised",node:(0,A.jsxs)("span",{style:{display:"inline-flex",alignItems:"center"},children:[(0,A.jsxs)("button",{type:"button","data-testid":"raised-into",onClick:()=>g(ue(n,ve(z),{ownPicture:!0})),title:`Go into the ${E(z).toLowerCase()}`,"aria-label":`Go into the ${E(z).toLowerCase()}`,style:{...b,color:"var(--graview-ink)"},children:[E(z),(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\u2198"})]}),(0,A.jsx)("button",{type:"button","data-testid":"raised",onClick:()=>v(null),title:`Stop showing ${E(z).toLowerCase()}`,"aria-label":`Stop showing ${E(z).toLowerCase()}`,style:{...b,minWidth:26,justifyContent:"center"},children:(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})})]})})}return s&&!R&&N.length===0&&d===void 0?null:(0,A.jsxs)("nav",{"aria-label":"View","data-testid":"trail",style:{display:"flex",alignItems:"center",gap:8,fontSize:"0.875rem",minWidth:0,...s?{pointerEvents:"auto",padding:"4px 6px",borderRadius:8,background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",overflow:"hidden"}:{}},children:[R?(0,A.jsx)("button",{type:"button",onClick:()=>w(e),style:{border:"none",background:"none",padding:"3px 0",minHeight:24,whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:o}):null,N.map(({key:z,node:B},Le)=>(0,A.jsxs)(vt.Fragment,{children:[R||Le>0?(0,A.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:"\u203A"}):null,B]},z)),d]})}var P=m($(),1);function pa(){let[e,o]=(0,oe.useState)([]),d=(0,oe.useCallback)(s=>{o(n=>{let w=s.phase!=="running"&&n[0]?.name===s.name&&n[0]?.at===s.at;return[s,...w?n.slice(1):n].slice(0,12)})},[]);return[e,d]}function ga({find:e,calls:o,seat:d,remembers:s=!1}){return e?(0,P.jsxs)(P.Fragment,{children:[(0,ca.createPortal)((0,P.jsx)(dt,{compact:e.compact}),e.slot),e.own?(0,ca.createPortal)((0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(oe.Suspense,{fallback:null,children:(0,P.jsx)(rt,{})}),(0,P.jsx)(Wa,{calls:o,remembers:s,...d!==void 0?{seat:d}:{}})]}),e.own):null]}):null}function va({home:e=null}){return(0,P.jsxs)("div",{"data-graview-scene-trail":"",style:{position:"absolute",top:14,left:14,maxWidth:"calc(100% - 150px - var(--graview-dock, 0px))",zIndex:D("overview"),display:"flex",alignItems:"center",gap:6,minWidth:0,pointerEvents:"none"},children:[(0,P.jsx)(ut,{home:e,onPicture:!0}),(0,P.jsx)("span",{style:{pointerEvents:"auto"},children:(0,P.jsx)(pt,{})})]})}var X=m(G(),1);var wt=m($(),1),cr=ie(()=>(__graviewPreload(import.meta.url,["./chunk.Q355UPFG.js","./chunk.AI34V6WV.js","./chunk.G4ULQK64.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.F7YXLYLX.js")));function ua(){let{store:e,principal:o}=T(),d=(0,X.useContext)(Ba),s=(0,X.useRef)(null),n=(0,X.useRef)(!1);return(0,X.useEffect)(()=>()=>void(n.current=!0),[]),(0,X.useEffect)(()=>{let w=e.batches().length,v=cr().then(g=>g.sceneWay(e,o,d,w,s.current),()=>{});return()=>void v.then(g=>g?.(n.current))},[e,o,d]),(0,wt.jsx)("span",{ref:s,hidden:!0})}var mt=m(G(),1);var y=m($(),1);function qi({address:e=!1,auto:o,quickAsk:d=!0,scheme:s,scope:n}){let w=(0,mt.useMemo)(()=>`${ta({scope:`.${n}`})}
|
|
1131
|
+
}`}function ra(e="dark",o={}){let d=At(e);return o.scope===void 0?d:Ea(d,o.scope)}var O=m(G(),1);var V=m($(),1),Ct=Ee(ie(()=>(__graviewPreload(import.meta.url,["./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.XBYJCGPU.js")))).part(e=>(0,V.jsx)(e.MapKey,{}),{quiet:!0});function ia(){let{store:e}=T(),{view:o}=U(),d=Ce(),s=(0,O.useMemo)(()=>e.graph.allEdges().length>0,[e,d]),[n,w]=(0,O.useState)(!1),v=(0,O.useId)(),g=(0,O.useRef)(null),x=(0,O.useRef)(null);return(0,O.useEffect)(()=>{if(!n)return;let h=c=>{let C=c.target;C&&(x.current?.contains(C)||g.current?.contains(C))||w(!1)};return document.addEventListener("pointerdown",h,!0),()=>document.removeEventListener("pointerdown",h,!0)},[n]),s?(0,V.jsxs)("div",{style:{display:"contents"},onKeyDown:h=>{h.key!=="Escape"||!n||(h.preventDefault(),h.stopPropagation(),w(!1),g.current?.focus({preventScroll:!0}))},children:[(0,V.jsx)("button",{ref:g,type:"button","data-testid":"lines-key","aria-expanded":n,"aria-controls":v,title:"What the lines mean",onClick:()=>w(h=>!h),style:{position:"absolute",top:60,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("overview"),height:30,padding:"0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.8125rem",color:n?"var(--graview-accent)":"var(--graview-ink-muted)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Key"}),n?(0,V.jsxs)("div",{ref:x,id:v,"data-testid":"lines-key-pane","data-graview-offstage":"",style:{position:"absolute",top:98,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("rail"),width:tt,maxHeight:"calc(100cqh - 120px)",overflowY:"auto",boxSizing:"border-box",padding:"8px 8px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[o.overview?(0,V.jsx)(Ct,{}):null,(0,V.jsx)(at,{inside:!0,widthOf:Xa})]}):null]}):null}var ze=m(G(),1),Te=m($(),1);function it(e){return e.lens!==null?{what:"lens",kind:e.lens}:e.records.length===1&&e.districts.length===0?{what:"record",id:e.records[0]}:e.districts.length===1&&e.records.length===0?{what:"district",kind:e.districts[0]}:null}var Et=Ee(ie(()=>(__graviewPreload(import.meta.url,["./chunk.6YK5E7ZQ.js","./chunk.V4HVFLFQ.js","./chunk.A2R53GWF.js","./chunk.Q2EGESEZ.js","./chunk.SMHP2CQH.js","./chunk.HJCQ6I3S.js","./chunk.EJ4MSVX2.js","./chunk.KQPKYWDM.js","./chunk.MBB5A6BT.js","./chunk.T535ZLRM.js","./chunk.ERPILTRY.js","./chunk.OTSBF367.js","./chunk.BIDL7GQD.js","./chunk.QS32TO4N.js","./chunk.JVDPRQ7J.js","./chunk.57YDGGJK.js","./chunk.H7AH3IW4.js","./chunk.Q5WEOX3Q.js","./chunk.MAHNJO6U.js","./chunk.75GENXGP.js","./chunk.NIAM7OTV.js","./chunk.WVUJXDXZ.js","./chunk.XYGNS637.js","./chunk.DZSZUX34.js","./chunk.4EXC26LI.js","./chunk.PWAP2GJS.js","./chunk.AHPYNDVA.js","./chunk.FNVGNISQ.js","./chunk.GZHZLJBF.js","./chunk.WUVXIUA7.js","./chunk.OJGHDWI6.js","./chunk.BN7C5ZYX.js","./chunk.REUMBCSV.js","./chunk.2KIWGQXC.js","./chunk.D5LOTCBU.js","./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.24HNOLUS.js")))),Rt=Et.part((e,o)=>(0,Te.jsx)(e.MapPanelFor,{showing:o.showing}),{what:"This panel",quiet:!0});function na(){let{store:e,view:o,selection:d,hiddenKinds:s,seatTalk:n}=T();Ce();let w=(0,ze.useSyncExternalStore)(n.subscribe,()=>n.get().draft!==null,()=>!1);if(!o.overview||w)return null;let v=it(ja(d,{...o,beside:!0},g=>e.graph.getNode(g)?.kind));return!v||v.what!=="record"&&(s.has(v.kind)||!e.schema.kinds.includes(v.kind))?null:(0,Te.jsx)(ze.Suspense,{fallback:null,children:(0,Te.jsx)(Rt,{showing:v})})}var Tt=m(G(),1);var W=m($(),1);function oa(){let{view:e,go:o}=U(),{store:d,views:s,hiddenKinds:n}=T(),w=e.overview??!1,v=s.places().map(E=>E.kind).filter(E=>!n.has(E)),g=Fa(e,d.schema.kinds,v),x=()=>{o($e(ee(e,!1),g))},h=(()=>{if(!g)return null;let E=Aa(g)[0],b=e.within?.view,R=(b?s.places().find(N=>N.as===b):void 0)??(E?s.places().filter(N=>N.kind===E).at(-1):void 0);return R?R.title:E?_(d.schema,E):d.graph.getNode(g)?.label??null})(),c=w?"Close the map":"Up",C=w&&h?`Close the map, down to ${h}`:c;return(0,W.jsxs)("button",{type:"button","data-testid":"overview",className:"graview-altitude-control","aria-pressed":w,"aria-label":C,title:w?C:"Up \u2014 the whole thing, from above",onClick:()=>w?x():o(ee(e,!0)),style:{position:"absolute",top:14,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("overview"),display:"inline-flex",alignItems:"center",justifyContent:"center",gap:7,height:38,padding:"0 13px 0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.875rem",whiteSpace:"nowrap",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)","--graview-altitude":w?1:0,...w?{color:"var(--graview-accent)"}:{}},children:[(0,W.jsxs)("svg",{className:"graview-altitude-mark",width:"16",height:"16",viewBox:"0 0 12 12","aria-hidden":"true",children:[(0,W.jsx)("ellipse",{className:"graview-altitude-mark-ring",cx:"6",cy:"6.6",rx:"5",ry:"2.6",fill:"none",stroke:"currentColor",strokeWidth:"0.9"}),(0,W.jsx)("circle",{className:"graview-altitude-mark-apex",cx:"6",cy:"4",r:"1.5",fill:"currentColor"}),(0,W.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"left",cx:"1.6",cy:"7.4",r:"1.2",fill:"currentColor"}),(0,W.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"right",cx:"10.4",cy:"7.4",r:"1.2",fill:"currentColor"})]}),(0,W.jsx)("span",{className:"graview-altitude-label",children:c})]})}var sa=m($(),1);function da(){let{administered:e}=T(),{view:o,go:d}=U(),s=e.filter(n=>n.canShow);return s.length===0?null:(0,sa.jsx)("div",{role:"group","aria-label":"Administered","data-testid":"administered",style:{display:"flex",gap:6},children:s.map(n=>(0,sa.jsx)("button",{type:"button","aria-pressed":n.shown,"data-testid":`show-${n.name}`,title:n.shown?`Hide the ${n.name}'s own districts again`:n.description??`Show the ${n.name}'s own districts beside the domain`,onClick:()=>d(Ua(o,n.name,!n.shown)),style:{padding:"3px 11px",borderRadius:999,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:n.shown?"var(--graview-accent)":"var(--graview-edge)",color:n.shown?"var(--graview-accent)":"var(--graview-ink-muted)",background:n.shown?"var(--graview-panel)":"transparent"},children:n.shown?`Hide the ${n.name}`:`Show the ${n.name}`},n.name))})}var u=m(G(),1);var t=m($(),1);Ra({search:_a,touchWeights:qa});var ne=e=>e!==void 0&&"act"in e,Me=e=>e!==void 0&&"hit"in e&&e.hit.about==="node"?e:void 0,zt=e=>e.about==="rule"?"rule:":e.about==="act"?"act:":e.kind;function Mt(e){let o=()=>typeof window>"u"||window.innerWidth>=Ft,[d,s]=(0,u.useState)(o);return(0,u.useEffect)(()=>{let n=()=>s(o());return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),d&&!e}function dt({compact:e=!1}){let{store:o,view:d,setView:s,principal:n,setMenuAt:w,brand:v,aiDesk:g,selection:x}=T(),h=Ia(g),c=Ta(),C=Ma(),E=Da().marks.flag,b=Mt(e),R=(0,u.useRef)(null),N=(0,u.useRef)(null),z=(0,u.useRef)(null),B=(0,u.useId)(),[Le,I]=(0,u.useState)(!1),[K,se]=(0,u.useState)(null),[ft,he]=(0,u.useState)(null),[Pe,be]=(0,u.useState)([]),M=d.q??"";(0,u.useEffect)(()=>{let a=r=>{if(r.defaultPrevented)return;let i=r.key.toLowerCase()==="k"&&(r.metaKey||r.ctrlKey)&&!r.altKey&&!r.shiftKey,l=r.key==="/"&&!r.metaKey&&!r.ctrlKey&&!r.altKey;if(!i&&!l)return;let p=R.current;if(!p)return;let f=p.closest("[data-graview-embed]"),S=r.target,J=S===document.body||S===document.documentElement||S===window;if(f&&!(i&&J||S instanceof Node&&f.contains(S)))return;let Z=document.activeElement,ge=Z instanceof HTMLInputElement||Z instanceof HTMLTextAreaElement||Z instanceof HTMLSelectElement||Z instanceof HTMLElement&&Z.isContentEditable;l&&ge||(r.preventDefault(),p.getClientRects().length===0&&p.closest("[data-graview-app-bar]")?.querySelector('[data-testid="app-find-open"]')?.click(),p.focus({preventScroll:!0}),p.select(),I(!0))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]);let Ne=(0,u.useMemo)(()=>{let a=new Map;for(let[i,l]of(c?.hits??[]).entries()){if(l.about==="act")continue;let p=zt(l),f=a.get(p)??[];f.push({id:`${B}-${i}`,hit:l}),a.set(p,f)}let r=[...a.values()].filter(i=>i.some(l=>l.hit.about==="node")).length>1;return[...a.entries()].map(([i,l])=>{let p=0,f=l.filter(ge=>ge.hit.about!=="node"||!r||++p<=Wt),S=f.filter(ge=>ge.hit.about==="node").length,J=i.endsWith(":")?l.length:c?.byKind[i]??S,Z=!i.endsWith(":")&&S>0&&J>S?{id:`${B}-all-${i}`,all:i,count:J}:null;return{key:i,rows:f,count:J,more:Z}})},[c,B]),ae=h&&M.trim()?{id:`${B}-ask`,ask:M.trim()}:null,k=(0,u.useMemo)(()=>[...Ne.flatMap(a=>a.more?[...a.rows,a.more]:a.rows),...ae?[ae]:[]],[Ne,ae?.ask]),wa=(c?.hits??[]).filter(a=>a.about==="node").length,xe=c?.words??M,Ie=(0,u.useMemo)(()=>Re(xe).split(" ").filter(Boolean),[xe]),F=(0,u.useCallback)(a=>a.hit.about==="node"?Ga(o,a.hit.id,xe,{principal:n,limit:Bt}).map((r,i)=>({id:`${a.id}-act-${i}`,act:r,of:a.id})):[],[o,xe,n]),He=k.find(a=>a.id===K),q=k.find(a=>a.id===ft)??He??k[0],de=(0,u.useMemo)(()=>b&&Me(q)?F(q):[],[b,q?.id,F]),ye=(0,u.useMemo)(()=>b?new Map:new Map(Pe.flatMap(a=>{let r=Me(k.find(i=>i.id===a));return r?[[a,F(r)]]:[]})),[b,Pe,k,F]),ht=(0,u.useMemo)(()=>b?new Set:new Set(k.flatMap(a=>Me(a)&&F(a).length>0?[a.id]:[])),[b,k,F]),Oe=(0,u.useMemo)(()=>b?de:[...ye.values()].flat(),[b,de,ye]),L=He??Oe.find(a=>a.id===K)??k[0];(0,u.useEffect)(()=>{se(null),he(null),be([])},[M]);let le=(0,u.useRef)(null);(0,u.useEffect)(()=>{let a=le.current;if(!a)return;le.current=null;let r=0,i=()=>{let l=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`),p=document.activeElement;if(!(!p||p===document.body||p===document.documentElement||p===R.current||p===z.current||p===l))return;let S=[...l?.querySelectorAll('[role="group"][aria-label="Arrange"] :is(button, input)')??[]].find(J=>J.checkVisibility?.()??!0);if(S)return S.focus({preventScroll:!0});l&&l.tabIndex>=0&&p!==l&&l.focus({preventScroll:!0}),++r<240?requestAnimationFrame(i):document.activeElement===z.current&&z.current?.blur()};requestAnimationFrame(i)},[d]);let De=(a,r)=>{let i=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`);if(i&&i.tabIndex>=0)return i.focus({preventScroll:!0});let l=z.current;if(!l)return R.current?.blur();l.setAttribute("aria-label",r),l.focus({preventScroll:!0})},ma=(0,u.useRef)({x:Number.NaN,y:Number.NaN,moved:!1});(0,u.useEffect)(()=>{let a=r=>{let i=ma.current;i.moved=r.clientX!==i.x||r.clientY!==i.y,i.x=r.clientX,i.y=r.clientY};return window.addEventListener("mousemove",a,{capture:!0,passive:!0}),()=>window.removeEventListener("mousemove",a,{capture:!0})},[]);let ce=(0,u.useRef)(void 0);(0,u.useEffect)(()=>()=>clearTimeout(ce.current),[]);let te=a=>{a&&(clearTimeout(ce.current),se(a.id),ne(a)||he(a.id))},fa=a=>{if(!ma.current.moved)return;let r=a.target.closest?.('[role="option"]')?.id;if(!r||r===K)return;let i=k.find(l=>l.id===r)??Oe.find(l=>l.id===r);i&&(se(i.id),!ne(i)&&(clearTimeout(ce.current),ce.current=setTimeout(()=>he(i.id),Kt)))},bt=()=>{clearTimeout(ce.current),q&&!ne(L)&&se(q.id)},xt=a=>be(r=>r.includes(a.id)?r.filter(i=>i!==a.id):[...r,a.id]),ha=a=>{let r=N.current,i=r?.querySelector('[role="option"]')?.getBoundingClientRect().height??0,l=r?.clientHeight??0;return Math.min(a,i>0&&l>0?Math.max(1,Math.floor(l/i)-1):Ot)};(0,u.useEffect)(()=>{K&&document.getElementById(K)?.scrollIntoView?.({block:"nearest"})},[K]);let We=a=>{if(!a)return;if("ask"in a){Na(g,{pointed:{...x[0]!==void 0?{on:x[0]}:{},about:x},asked:a.ask}),s(i=>Ye(i)),I(!1);return}if("all"in a)return s(i=>ue(ee(i,!1),ve(a.all),{ownPicture:!0,...i.q?{carry:i.q}:{}})),le.current=a.all,I(!1),De(a.all,`Opening ${_(o.schema,a.all)} matching \u201C${M.trim()}\u201D\u2026`);if(ne(a)){let i=a.act.subject;s(p=>Ae(p,[i]));let l=R.current?.getBoundingClientRect();w({x:l?.left??0,y:(l?.bottom??0)+6,on:i}),I(!1),R.current?.blur();return}let r=a.hit;switch(r.about){case"node":s(i=>Ae($e(ee(i,!1),r.id),[r.id]));break;case"kind":return s(i=>ue(ee(i,!1),ve(r.kind),{ownPicture:!0})),le.current=r.kind,I(!1),De(r.kind,`Opening ${r.label}\u2026`);case"place":return s(i=>Ca(i,r.kind,r.as)),le.current=r.kind,I(!1),De(r.kind,`Opening ${r.title}\u2026`);case"rule":{let i=C.filter(l=>l.invariant===r.name).flatMap(l=>l.nodeIds);s(l=>Ae(l,[...new Set(i)]));break}case"act":break}I(!1),R.current?.blur()},yt=c?Ht(c.byKind,c.hits,o.schema):"",pe=Le&&M.trim().length>0,kt=(0,u.useCallback)(()=>{let a=R.current?.closest("[data-graview-app-bar]")?.getBoundingClientRect();if(a)return{x:a.right,y:a.bottom-Ut};let r=R.current?.getBoundingClientRect();return r?{x:r.right,y:r.bottom}:null},[]),ba=Pa("find",{open:pe,onOpenChange:a=>{a||I(!1)},...e?{at:kt}:{}}),ke=k.every(a=>"ask"in a),xa=a=>ne(a)?Oe.filter(r=>r.of===a.of):[],St=a=>{let r=ne(L)&&K!==null,i=r?k.find(p=>p.id===L.of):K!==null?He:void 0,l=i?k.indexOf(i):-1;if(a.key==="ArrowDown"){if(a.preventDefault(),I(!0),r){let p=xa(L),f=p.indexOf(L)+1;if(f<p.length)return te(p[f]);if(b)return}te(k[Math.min(k.length-1,l+1)])}else if(a.key==="ArrowUp"){if(a.preventDefault(),r){let p=xa(L),f=p.indexOf(L)-1;return te(f>=0?p[f]:i)}te(k[Math.max(0,l-1)])}else if((a.key==="PageDown"||a.key==="PageUp")&&k.length>0){a.preventDefault(),I(!0);let p=a.key==="PageDown"?ha(k.length):-ha(k.length);te(k[Math.min(k.length-1,Math.max(0,(l<0?-1:l)+p))])}else if(a.key==="ArrowRight"&&!r&&Me(L)){let p=L,f=b?p.id===q?.id?de:F(p):ye.get(p.id)??F(p);if(f.length===0)return;a.preventDefault(),!b&&!Pe.includes(p.id)&&be(S=>[...S,p.id]),he(p.id),se(f[0].id)}else if(a.key==="ArrowLeft"&&r){a.preventDefault();let p=L.of;b||be(f=>f.filter(S=>S!==p)),te(k.find(f=>f.id===p))}else a.key==="Enter"?(a.preventDefault(),We(L)):a.key==="Escape"&&(a.preventDefault(),M?s(p=>Ye(p)):R.current?.blur())},Be=(a,r,i={},l={})=>{let p=a.id===L?.id;return(0,t.jsx)("div",{id:a.id,role:"option","aria-selected":p,onClick:()=>We(a),style:{...Zt,...p?er:null,...i},...l,children:r},a.id)},ya=(a,r)=>{let i=a.id===L?.id;return(0,t.jsx)("div",{id:a.id,role:"option","aria-selected":i,"data-testid":"find-act","data-about":"act",onClick:()=>We(a),style:{...r?ir:ct,...i?nr:null,...a.act.destructive?{color:"var(--graview-warn)"}:null},children:a.act.title},a.id)};return(0,t.jsxs)("div",{style:{position:"relative",minWidth:0,flex:"1 1 auto"},"data-testid":"find",children:[(0,t.jsx)("input",{ref:a=>{R.current=a,ba.trigger.ref(a)},"data-graview-popover-trigger":"find",type:"search",role:"combobox","aria-label":"Find anything","aria-expanded":pe,"aria-controls":B,"aria-autocomplete":"list",...pe&&L?{"aria-activedescendant":L.id}:{},"data-testid":"find-box",placeholder:"Find\u2026","aria-keyshortcuts":"/ Meta+K Control+K",value:M,onChange:a=>{let r=a.target.value;I(!0),s(i=>Va(i,r.length>0?r:null))},onFocus:()=>I(!0),onBlur:()=>I(!1),onKeyDown:St,style:{width:"100%",boxSizing:"border-box",minWidth:0,height:30,padding:"0 var(--graview-bar-find-end, 10px) 0 10px",font:"inherit",fontSize:"0.875rem",color:"var(--graview-ink)",background:"var(--graview-panel)",border:`1px solid ${M?"var(--graview-accent)":"var(--graview-edge)"}`,borderRadius:8}}),(0,t.jsx)("span",{role:"status","aria-live":"polite",style:qe,"data-testid":"find-count",children:M.trim()?yt:""}),(0,t.jsx)("span",{ref:z,tabIndex:-1,role:"status",style:qe,"data-testid":"find-landing"}),(0,t.jsxs)("div",{...ba.pane,id:B,role:"listbox","aria-label":M?`What \u201C${M}\u201D finds`:"What the words find","data-testid":"find-strip","data-graview-find":b?"panel":"narrow",hidden:!pe,onMouseDown:a=>a.preventDefault(),style:{..._t,...e?Vt:b&&!ke?Gt:null,...pe?{display:"flex"}:null},children:[(0,t.jsxs)("div",{style:{...Yt,gridTemplateColumns:b&&!ke?`minmax(0, 1fr) ${qt}`:"minmax(0, 1fr)"},children:[(0,t.jsxs)("div",{ref:N,role:"presentation","data-testid":"find-list",onMouseMove:fa,style:jt,children:[ke?(0,t.jsxs)("p",{role:"presentation",style:{margin:0,padding:"10px 12px",color:"var(--graview-ink-muted)",fontSize:"0.875rem"},"data-testid":"find-nothing",children:["Nothing here is called \u201C",c?.words||M,"\u201D."]}):Ne.map(a=>(0,t.jsxs)("div",{role:"group","aria-label":ot(a.key,o.schema),children:[(0,t.jsxs)("div",{role:"presentation",style:la,children:[a.key!=="rule:"&&a.key!=="act:"?(0,t.jsx)(lt,{kind:a.key,accents:v?.accents}):null,(0,t.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ot(a.key,o.schema)}),(0,t.jsx)("span",{"aria-hidden":"true",style:Jt,"data-testid":"find-group-count",children:re(a.count)})]}),a.rows.map(r=>{let i=r.hit,l=i.about==="node"?i:null,p=!b&&l!==null&&ht.has(r.id),f=ye.get(r.id);return(0,t.jsxs)(u.Fragment,{children:[Be(r,(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Pt,{hit:i,flag:E,words:l?.near&&l.why.matched?[...Ie,Re(l.why.matched)]:Ie}),p?(0,t.jsx)("span",{"aria-hidden":"true","data-testid":"find-acts-open","data-open":f?"":void 0,title:f?"Put its actions away":"Actions",onClick:S=>{S.stopPropagation(),xt(r)},style:{...sr,...f?dr:null},children:(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"3.5",cy:"8",r:"1.4",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"1.4",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"12.5",cy:"8",r:"1.4",fill:"currentColor"})]})}):null]}),p?{paddingRight:48}:{},{"data-testid":"find-hit","data-about":i.about,...l?.near?{"data-near":""}:{},title:It(i)}),f?(0,t.jsx)("div",{role:"group","aria-label":`What can be done about ${l?.label??"it"}`,style:or,children:f.map(S=>ya(S,!0))}):null]},r.id)}),a.more?Be(a.more,(0,t.jsxs)("span",{style:Q,children:["All ",re(a.more.count)," ",Se(o.schema,a.more.all).toLowerCase()," matching \u201C",M.trim(),"\u201D"]}),ar,{"data-testid":"find-all","data-about":"all"}):null]},a.key)),ae?Be(ae,(0,t.jsxs)("span",{style:Q,children:["Ask: ",(0,t.jsxs)("span",{style:{fontWeight:600},children:["\u2018",ae.ask,"\u2019"]})]}),{borderTop:"1px solid var(--graview-edge)",marginTop:4},{"data-testid":"find-ask"}):null,wa>Dt?(0,t.jsxs)("p",{role:"presentation",style:st,"data-testid":"find-more-words",children:[re(wa)," found: another word of the name narrows them."]}):null,c&&c.searched.past===!1&&c.searched.kinds.some(a=>o.schema.tryDefinition(a)?.lifecycle)?(0,t.jsx)("p",{role:"presentation",style:st,children:"Current ones; add is:any for the past."}):null]}),b&&!ke&&q?(0,t.jsxs)("div",{role:"group","aria-label":"The one lit","data-testid":"find-panel",onMouseEnter:bt,onMouseMove:fa,style:Qt,children:[(0,t.jsx)(Lt,{row:q,schema:o.schema,accents:v?.accents,marking:Ie,q:M.trim(),flag:E}),de.length>0?(0,t.jsxs)("div",{role:"group","aria-label":"Actions",style:{display:"grid",gap:4},children:[(0,t.jsx)("div",{role:"presentation",style:{...la,padding:"10px 0 4px"},children:"Actions"}),de.map(a=>ya(a,!1))]}):null]}):null]}),e?null:(0,t.jsxs)("div",{"aria-hidden":"true",style:lr,"data-testid":"find-keys",children:[(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"\u2191"}),(0,t.jsx)("kbd",{style:fe,children:"\u2193"})," move"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"\u21B5"})," open"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"\u2192"})," actions"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"esc"})," close"]})]})]})]})}function Lt({row:e,schema:o,accents:d,marking:s,q:n,flag:w}){let v=null,g="",x,h=null;if("ask"in e)g="Ask",x=`\u2018${e.ask}\u2019`,h=(0,t.jsx)("p",{style:Y,children:"Asks it of what is selected; the answer comes on a card beside it."});else if("all"in e)v=e.all,g=_(o,e.all),x=`All ${re(e.count)} matching \u201C${n}\u201D`,h=(0,t.jsxs)("p",{style:Y,children:["Opens the ",Se(o,e.all).toLowerCase(),", narrowed by these words."]});else{let c=e.hit;switch(c.about){case"node":{v=c.kind,g=nt(Sa(o.tryDefinition(c.kind),c.kind)),x=(0,t.jsxs)(t.Fragment,{children:[c.flagged?(0,t.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[w," "]}):null,(0,t.jsx)(j,{text:c.label,words:s})]});let C=[c.apart,c.current?null:"past",c.archived?"set aside":null].filter(Boolean).join(" \xB7 ");h=(0,t.jsxs)(t.Fragment,{children:[C?(0,t.jsx)("p",{style:Y,children:nt(C)}):null,c.near?(0,t.jsxs)("p",{style:Y,children:["Near \u201C",c.why.asked,"\u201D",c.why.field!=="label"?` \u2014 ${c.why.reading.toLowerCase()}: ${c.why.fragment}`:""]}):c.why.field!=="label"?(0,t.jsxs)("p",{style:Y,children:[(0,t.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:c.why.reading}),(0,t.jsx)("br",{}),(0,t.jsx)(j,{text:c.why.fragment,words:s})]}):null]});break}case"kind":v=c.kind,g="Kind",x=c.label,h=(0,t.jsxs)("p",{style:Y,children:["Goes into the ",c.label.toLowerCase(),", all of them",c.count>0?`; ${re(c.count)} match these words`:"","."]});break;case"place":v=c.kind,g="Place",x=c.title,h=(0,t.jsxs)("p",{style:Y,children:["A picture of the ",Se(o,c.kind).toLowerCase(),"."]});break;case"rule":g="Rule",x=c.label,h=(0,t.jsx)("p",{style:Y,children:"Selects what it flags."});break;case"act":g="Act",x=c.title;break}}return(0,t.jsxs)("div",{role:"presentation","data-testid":"find-said",style:{display:"grid",gap:6},children:[(0,t.jsxs)("div",{style:{...la,padding:0},children:[v?(0,t.jsx)(lt,{kind:v,accents:d}):null,g]}),(0,t.jsx)("div",{style:Xt,children:x}),h]})}function Pt({hit:e,flag:o,words:d}){switch(e.about){case"node":return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{style:tr,children:[e.flagged?(0,t.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[o," "]}):null,(0,t.jsx)(j,{text:e.label,words:d}),e.apart?(0,t.jsxs)("span",{style:me,children:[" \xB7 ",e.apart]}):null,e.current?null:(0,t.jsx)("span",{style:me,children:" \xB7 past"})]}),e.near?(0,t.jsxs)("span",{style:{...Q,...me},"data-testid":"find-near",children:["Near \u201C",e.why.asked,"\u201D",e.why.field!=="label"?` \u2014 ${e.why.reading.toLowerCase()}: `:"",e.why.field!=="label"?(0,t.jsx)(j,{text:e.why.fragment,words:d}):null]}):e.why.field!=="label"?(0,t.jsxs)("span",{style:{...Q,...me},children:[e.why.reading.toLowerCase(),": ",(0,t.jsx)(j,{text:e.why.fragment,words:d})]}):null]});case"kind":return(0,t.jsxs)("span",{style:Q,children:[(0,t.jsx)(j,{text:e.label,words:d}),(0,t.jsxs)("span",{style:me,children:[" \xB7 ",e.count," match"]})]});case"place":return(0,t.jsxs)("span",{style:Q,children:["Go to ",(0,t.jsx)(j,{text:e.title,words:d})]});case"rule":return(0,t.jsxs)("span",{style:Q,children:["The rule \u201C",(0,t.jsx)(j,{text:e.label,words:d}),"\u201D"]});case"act":return(0,t.jsx)("span",{style:Q,children:e.title})}}function Nt(e,o){if(o.length===0)return[{text:e}];let d=[],s=0;for(let n of e.matchAll(/[\p{L}\p{N}]+/gu)){let w=n[0],v=Re(w).replace(/ /g,""),g=o.filter(c=>v.startsWith(c)).sort((c,C)=>C.length-c.length)[0];if(!g)continue;let x=v.length===w.length?g.length:w.length,h=n.index??0;h>s&&d.push({text:e.slice(s,h)}),d.push({text:w.slice(0,x),marked:!0}),s=h+x}return s<e.length&&d.push({text:e.slice(s)}),d}function j({text:e,words:o}){return(0,t.jsx)(t.Fragment,{children:Nt(e,o).map((d,s)=>d.marked?(0,t.jsx)("mark",{style:rr,children:d.text},s):(0,t.jsx)(u.Fragment,{children:d.text},s))})}function It(e){if(e.about!=="node")return"";let o=e.near?`Near \u201C${e.why.asked}\u201D`:e.why.field!=="label"?`${e.why.reading}: ${e.why.fragment}`:"";return o?`${e.label}
|
|
1132
|
+
${o}`:e.label}var nt=e=>e&&e[0].toUpperCase()+e.slice(1);function lt({kind:e,accents:o}){let d=Math.round($a(e,o));return(0,t.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:2,flex:"0 0 auto",background:`hsl(${d} 55% 52%)`}})}function ot(e,o){return e==="rule:"?"Rules":e==="act:"?"Acts":_(o,e)}function Ht(e,o,d){let s=Object.entries(e).map(([v,g])=>ka(d,v,g)),n=o.filter(v=>v.about==="kind"||v.about==="place"||v.about==="rule").length;n>0&&s.push(`${n} ${n===1?"place or rule":"places and rules"}`);let w=o.filter(v=>v.about==="node"&&v.near).length;return s.length===0?"Nothing found":`${s.join(", ")} found${w>0?`, ${w} of them near`:""}`}var Ot=10,Dt=12,Wt=5,Bt=6,Kt=140,Ft=760,qt="15.5rem",_t={...La,flexDirection:"column",width:"min(26rem, calc(100vw - 24px))",maxHeight:"min(64vh, 30rem)",overflow:"hidden",boxSizing:"border-box",background:"linear-gradient(var(--graview-panel), var(--graview-panel)) var(--graview-ground, var(--graview-panel))",borderTop:"1px solid var(--graview-edge)",borderRight:"1px solid var(--graview-edge)",borderBottom:"1px solid var(--graview-edge)",borderLeft:"1px solid var(--graview-edge)",borderRadius:10,boxShadow:"0 10px 28px rgb(0 0 0 / 0.18)",padding:0},Gt={width:"min(42rem, calc(100vw - 24px))"},Ut=6,Vt={width:"var(--graview-bar-width, 100vw)",maxHeight:"55vh",borderRadius:0,borderLeft:"none",borderRight:"none"},Yt={display:"grid",gridTemplateRows:"minmax(0, 1fr)",flex:"1 1 auto",minHeight:0},jt={overflowY:"auto",overflowX:"hidden",minHeight:0,padding:"4px 0",overscrollBehavior:"contain"},Qt={overflowY:"auto",minHeight:0,padding:"12px 14px",borderLeft:"1px solid var(--graview-edge)",background:"var(--graview-panel-muted)",display:"flex",flexDirection:"column",gap:4},Xt={fontWeight:600,fontSize:"0.9375rem",lineHeight:1.35,color:"var(--graview-ink)",overflowWrap:"anywhere"},Y={margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)",overflowWrap:"anywhere"},la={display:"flex",alignItems:"center",gap:6,padding:"10px 12px 4px",fontSize:"0.6875rem",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},Jt={marginLeft:"auto",fontWeight:400,letterSpacing:0,fontVariantNumeric:"tabular-nums",color:"var(--graview-ink-faint)"},Zt={position:"relative",display:"grid",gap:1,minHeight:34,padding:"5px 12px",alignContent:"center",cursor:"pointer",fontSize:"0.875rem",lineHeight:1.35,color:"var(--graview-ink)",minWidth:0},er={background:"color-mix(in srgb, var(--graview-accent) 12%, var(--graview-panel))",boxShadow:"inset 3px 0 0 var(--graview-accent)"},ar={color:"var(--graview-accent)",fontSize:"0.8125rem",minHeight:30},Q={display:"block",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},tr={display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,minWidth:0,overflow:"hidden",overflowWrap:"anywhere",fontWeight:600},me={color:"var(--graview-ink-muted)",fontSize:"0.8125rem",fontWeight:400},rr={background:"color-mix(in srgb, var(--graview-accent) 24%, transparent)",color:"inherit",borderRadius:2,padding:0,boxShadow:"0 1px 0 color-mix(in srgb, var(--graview-accent) 70%, transparent)"},ct={display:"flex",alignItems:"center",minHeight:32,padding:"4px 10px",boxSizing:"border-box",borderWidth:1,borderStyle:"solid",borderColor:"var(--graview-edge)",borderRadius:6,background:"var(--graview-panel)",color:"var(--graview-ink)",fontSize:"0.8125rem",lineHeight:1.3,cursor:"pointer",overflowWrap:"anywhere"},ir={...ct,minHeight:32,margin:"0 12px 4px 24px"},nr={borderColor:"var(--graview-accent)",boxShadow:"inset 0 0 0 1px var(--graview-accent)",background:"color-mix(in srgb, var(--graview-accent) 12%, var(--graview-panel))"},or={display:"grid",padding:"2px 0 6px"},sr={position:"absolute",top:"50%",right:6,transform:"translateY(-50%)",width:36,height:32,display:"grid",placeItems:"center",borderRadius:6,color:"var(--graview-ink-muted)",borderWidth:1,borderStyle:"solid",borderColor:"transparent"},dr={color:"var(--graview-accent)",borderColor:"var(--graview-edge)",background:"var(--graview-panel)"},st={margin:0,padding:"6px 12px 4px",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},lr={display:"flex",flexWrap:"wrap",gap:"4px 14px",padding:"7px 12px",borderTop:"1px solid var(--graview-edge)",color:"var(--graview-ink-faint)",fontSize:"0.75rem",flex:"0 0 auto"},fe={display:"inline-block",minWidth:16,padding:"0 4px",marginRight:3,border:"1px solid var(--graview-edge)",borderRadius:4,font:"inherit",fontSize:"0.6875rem",lineHeight:"16px",textAlign:"center",color:"var(--graview-ink-muted)",background:"var(--graview-panel)"};var oe=m(G(),1);var ca=m($t(),1);var gt=m($(),1);function pt(){let{following:e,follow:o}=T();return e?(0,gt.jsxs)("button",{type:"button","data-testid":"following-who",onClick:()=>o(null),title:"Press, or Escape, to stop following",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,padding:"2px 9px",borderRadius:999,border:"1px solid var(--graview-accent)",background:"transparent",color:"var(--graview-accent)",fontSize:"0.875rem",whiteSpace:"nowrap"},children:["following ",e.name]}):null}var vt=m(G(),1);var A=m($(),1);function ut({home:e,homeLabel:o,children:d,onPicture:s=!1}){let{view:n,focus:w,show:v,go:g}=U(),{store:x}=T(),{movedByHand:h}=T(),c=h&&(n.pan!==void 0||Object.keys(n.pins).length>0),C=n.focusId&&n.focusId!==e?x.graph.getNode(n.focusId):void 0,E=z=>_(x.schema,z),b={display:"inline-flex",alignItems:"center",gap:6,minHeight:26,padding:"2px 6px",fontSize:"0.8125rem",borderRadius:6,border:"1px solid transparent",boxShadow:"none",background:"transparent",color:"var(--graview-ink-muted)",whiteSpace:"nowrap"},R=o!==void 0&&C!==void 0,N=[];if(C&&!s&&N.push({key:"focused",node:(0,A.jsxs)("button",{type:"button","data-testid":"focused",onClick:()=>g(Fe({...n,focusId:e},!1)),title:Ge(x,C.id),style:{...b,maxWidth:"min(14rem, 15vw)"},children:[(0,A.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:Ge(x,C.id)}),(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),n.past&&N.push({key:"past",node:(0,A.jsxs)("button",{type:"button","data-testid":"past",onClick:()=>g(Ya(n,!1)),title:"Back to now \u2014 retired things leave the picture again",style:b,children:["the past",(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),n.zoom&&N.push({key:"zoomed",node:(0,A.jsxs)("button",{type:"button","data-testid":"zoomed",onClick:()=>g(Fe(n,!1)),title:"Zoom back out",style:b,children:["zoomed in",(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),c&&N.push({key:"moved",node:(0,A.jsx)("button",{type:"button","data-testid":"moved",onClick:()=>g(Ke(n)),title:"Put the camera and everything you dragged back where the layout wanted them",style:b,children:"Reset view"})}),n.relation){let z=n.relation;N.push({key:"raised",node:(0,A.jsxs)("span",{style:{display:"inline-flex",alignItems:"center"},children:[(0,A.jsxs)("button",{type:"button","data-testid":"raised-into",onClick:()=>g(ue(n,ve(z),{ownPicture:!0})),title:`Go into the ${E(z).toLowerCase()}`,"aria-label":`Go into the ${E(z).toLowerCase()}`,style:{...b,color:"var(--graview-ink)"},children:[E(z),(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\u2198"})]}),(0,A.jsx)("button",{type:"button","data-testid":"raised",onClick:()=>v(null),title:`Stop showing ${E(z).toLowerCase()}`,"aria-label":`Stop showing ${E(z).toLowerCase()}`,style:{...b,minWidth:26,justifyContent:"center"},children:(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})})]})})}return s&&!R&&N.length===0&&d===void 0?null:(0,A.jsxs)("nav",{"aria-label":"View","data-testid":"trail",style:{display:"flex",alignItems:"center",gap:8,fontSize:"0.875rem",minWidth:0,...s?{pointerEvents:"auto",padding:"4px 6px",borderRadius:8,background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",overflow:"hidden"}:{}},children:[R?(0,A.jsx)("button",{type:"button",onClick:()=>w(e),style:{border:"none",background:"none",padding:"3px 0",minHeight:24,whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:o}):null,N.map(({key:z,node:B},Le)=>(0,A.jsxs)(vt.Fragment,{children:[R||Le>0?(0,A.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:"\u203A"}):null,B]},z)),d]})}var P=m($(),1);function pa(){let[e,o]=(0,oe.useState)([]),d=(0,oe.useCallback)(s=>{o(n=>{let w=s.phase!=="running"&&n[0]?.name===s.name&&n[0]?.at===s.at;return[s,...w?n.slice(1):n].slice(0,12)})},[]);return[e,d]}function ga({find:e,calls:o,seat:d,remembers:s=!1}){return e?(0,P.jsxs)(P.Fragment,{children:[(0,ca.createPortal)((0,P.jsx)(dt,{compact:e.compact}),e.slot),e.own?(0,ca.createPortal)((0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(oe.Suspense,{fallback:null,children:(0,P.jsx)(rt,{})}),(0,P.jsx)(Wa,{calls:o,remembers:s,...d!==void 0?{seat:d}:{}})]}),e.own):null]}):null}function va({home:e=null}){return(0,P.jsxs)("div",{"data-graview-scene-trail":"",style:{position:"absolute",top:14,left:14,maxWidth:"calc(100% - 150px - var(--graview-dock, 0px))",zIndex:D("overview"),display:"flex",alignItems:"center",gap:6,minWidth:0,pointerEvents:"none"},children:[(0,P.jsx)(ut,{home:e,onPicture:!0}),(0,P.jsx)("span",{style:{pointerEvents:"auto"},children:(0,P.jsx)(pt,{})})]})}var X=m(G(),1);var wt=m($(),1),cr=ie(()=>(__graviewPreload(import.meta.url,["./chunk.Q355UPFG.js","./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.AW26EETU.js")));function ua(){let{store:e,principal:o}=T(),d=(0,X.useContext)(Ba),s=(0,X.useRef)(null),n=(0,X.useRef)(!1);return(0,X.useEffect)(()=>()=>void(n.current=!0),[]),(0,X.useEffect)(()=>{let w=e.batches().length,v=cr().then(g=>g.sceneWay(e,o,d,w,s.current),()=>{});return()=>void v.then(g=>g?.(n.current))},[e,o,d]),(0,wt.jsx)("span",{ref:s,hidden:!0})}var mt=m(G(),1);var y=m($(),1);function qi({address:e=!1,auto:o,quickAsk:d=!0,scheme:s,scope:n}){let w=(0,mt.useMemo)(()=>`${ta({scope:`.${n}`})}
|
|
1133
1133
|
${ra(s,{scope:`.${n}`})}`,[s,n]),v=Ka(),[g]=pa();return(0,y.jsx)(za.Provider,{value:!0,children:(0,y.jsxs)("div",{"data-embed-content":"",style:{position:"relative",flex:o?`0 0 ${et}px`:"1 1 auto",minHeight:0,containerType:"size"},children:[(0,y.jsx)("style",{children:w}),e?(0,y.jsx)(Za,{}):null,(0,y.jsx)(Ja,{}),(0,y.jsx)(va,{}),(0,y.jsx)(oa,{}),(0,y.jsx)(ia,{}),(0,y.jsxs)(Qa,{children:[(0,y.jsx)(Xe,{}),(0,y.jsx)(Je,{face:"scene",on:d}),(0,y.jsx)(na,{}),(0,y.jsx)(Ue,{children:(0,y.jsx)(je,{children:(0,y.jsx)(Ze,{children:(0,y.jsx)(aa,{children:(0,y.jsx)(Qe,{placement:"menu"})})})})}),(0,y.jsx)(Ve,{}),(0,y.jsx)(ea,{}),(0,y.jsx)(ga,{find:v,calls:g}),(0,y.jsx)(ua,{}),(0,y.jsx)(_e,{face:"scene"})]})]})})}function _i(){return(0,y.jsx)(da,{})}export{qi as SceneFace,_i as SceneKeeping};
|