graview 0.1.65 → 0.1.66
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.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/preview/{chunk.6RZHKQP3.js → chunk.2KFZHUAC.js} +1 -1
- package/dist/preview/chunk.2MHNPBHC.js +1 -0
- package/dist/preview/{chunk.2PK335JQ.js → chunk.2VR7YEJ6.js} +1 -1
- package/dist/preview/chunk.32SHA3EY.js +1 -0
- package/dist/preview/chunk.3L4JMM3P.js +1 -0
- package/dist/preview/chunk.3PBTN7RO.js +1 -0
- package/dist/preview/chunk.45JP6VGJ.js +5 -0
- package/dist/preview/{chunk.INTJD5WG.js → chunk.4AC2QM7T.js} +1 -1
- package/dist/preview/chunk.4FCFNAA4.js +1 -0
- package/dist/preview/chunk.4FDVINRJ.js +1 -0
- package/dist/preview/chunk.4JULYKGD.js +1 -0
- package/dist/preview/chunk.4U4D7WOI.js +1 -0
- package/dist/preview/chunk.4WGYUYWU.js +2 -0
- package/dist/preview/chunk.5B5SRTUK.js +1 -0
- package/dist/preview/chunk.5BX66FBP.js +1 -0
- package/dist/preview/chunk.5CXIEYHY.js +2 -0
- package/dist/preview/chunk.5EMIWORS.js +1 -0
- package/dist/preview/{chunk.KIQXTQDU.js → chunk.5FNFRVTL.js} +1 -1
- package/dist/preview/chunk.5LJVOLKR.js +1 -0
- package/dist/preview/{chunk.GPCKOYSF.js → chunk.6EHHMWPP.js} +1 -1
- package/dist/preview/chunk.6EVMXBNB.js +1 -0
- package/dist/preview/chunk.6FQW6FNL.js +1 -0
- package/dist/preview/chunk.6HY6ZGEE.js +5 -0
- package/dist/preview/{chunk.DICM56FT.js → chunk.6LXIEM6B.js} +1 -1
- package/dist/preview/chunk.6MQ5NT7S.js +1 -0
- package/dist/preview/chunk.6P6NGZ6D.js +1 -0
- package/dist/preview/{chunk.F2TWV4TX.js → chunk.6TLXFMX2.js} +1 -1
- package/dist/preview/chunk.72XP2ARZ.js +1 -0
- package/dist/preview/{chunk.QSDBF7VL.js → chunk.72ZCLEQC.js} +1 -1
- package/dist/preview/{chunk.LY5CY7GE.js → chunk.7BIPZTJB.js} +1 -1
- package/dist/preview/chunk.7VADSNPZ.js +1 -0
- package/dist/preview/{chunk.IR4OW67N.js → chunk.7VP6Y6D2.js} +1 -1
- package/dist/preview/{chunk.C437FVD7.js → chunk.7ZKBYXUM.js} +1 -1
- package/dist/preview/chunk.AK7NGFEX.js +6 -0
- package/dist/preview/{chunk.FHHVW2WB.js → chunk.ANS2IEEV.js} +1 -1
- package/dist/preview/{chunk.LKK5YF2H.js → chunk.B6JRTW3A.js} +1 -1
- package/dist/preview/chunk.BCQWAFGD.js +1 -0
- package/dist/preview/{chunk.SOMRYDDH.js → chunk.BFAFCVL4.js} +1 -1
- package/dist/preview/chunk.BGAC3B7X.js +1 -0
- package/dist/preview/chunk.BMENTGDC.js +21 -0
- package/dist/preview/chunk.BOCVLC7X.js +1 -0
- package/dist/preview/{chunk.IMKD6QQG.js → chunk.BUVTUAB5.js} +1 -1
- package/dist/preview/chunk.BXBEGMPO.js +22 -0
- package/dist/preview/{chunk.ZYNC73DJ.js → chunk.BZ7QWHAE.js} +1 -1
- package/dist/preview/{chunk.AB4RZSYW.js → chunk.C2C3AXGI.js} +16 -16
- package/dist/preview/chunk.CBXS23YH.js +23 -0
- package/dist/preview/chunk.CEQQIW7Z.js +1 -0
- package/dist/preview/chunk.CEVGND3Y.js +6 -0
- package/dist/preview/{chunk.ZDUTEM3Z.js → chunk.CTASTRQN.js} +1 -1
- package/dist/preview/chunk.CU2WCYMK.js +1 -0
- package/dist/preview/{chunk.SPCAMQJE.js → chunk.CVPMSPCH.js} +1 -1
- package/dist/preview/chunk.DEHIR4EG.js +1 -0
- package/dist/preview/chunk.DPJNGFEZ.js +4 -0
- package/dist/preview/chunk.DQFHIJFN.js +1 -0
- package/dist/preview/chunk.DSYP43NN.js +1 -0
- package/dist/preview/chunk.DTCAUPLC.js +1 -0
- package/dist/preview/{chunk.7Q43N5JS.js → chunk.DZFM6GSY.js} +1 -1
- package/dist/preview/chunk.E3UL4MCD.js +35 -0
- package/dist/preview/chunk.E4VRRWFP.js +1 -0
- package/dist/preview/{chunk.6YDC6IDA.js → chunk.E7EWNWAN.js} +1 -1
- package/dist/preview/chunk.EG7OOJH5.js +1 -0
- package/dist/preview/{chunk.J6KNEI5R.js → chunk.EMFOMSMI.js} +1 -1
- package/dist/preview/{chunk.5THLLSS4.js → chunk.EQ4OODGO.js} +1 -1
- package/dist/preview/{chunk.P6TZGR3A.js → chunk.ES63XSIM.js} +1 -1
- package/dist/preview/chunk.EUAO4QNV.js +1 -0
- package/dist/preview/{chunk.O2W5JTWA.js → chunk.EXYCN4WI.js} +1 -1
- package/dist/preview/chunk.F4VB6Q2W.js +1 -0
- package/dist/preview/chunk.F7672TKJ.js +1 -0
- package/dist/preview/chunk.FA42HCPW.js +1 -0
- package/dist/preview/{chunk.L6FGKJ5H.js → chunk.FBILPNGH.js} +1 -1
- package/dist/preview/chunk.FBJAQPZ6.js +1 -0
- package/dist/preview/{chunk.FDWRH5P2.js → chunk.FDZE5LTJ.js} +2 -2
- package/dist/preview/{chunk.FOSY7MZF.js → chunk.FFOD5B4B.js} +1 -1
- package/dist/preview/{chunk.XSWR5LI4.js → chunk.FIFUMX5X.js} +1 -1
- package/dist/preview/{chunk.RFVOXX3P.js → chunk.FK722SHI.js} +1 -1
- package/dist/preview/chunk.FV72U33M.js +1 -0
- package/dist/preview/chunk.FXT5CN32.js +19 -0
- package/dist/preview/chunk.GAFMWOME.js +1 -0
- package/dist/preview/{chunk.PTQPS2FJ.js → chunk.GEFXU4VO.js} +1 -1
- package/dist/preview/chunk.GG47EIKO.js +1 -0
- package/dist/preview/{chunk.5M34BJIQ.js → chunk.GME63ZHI.js} +1 -1
- package/dist/preview/{chunk.IJ3YDBWI.js → chunk.GNEOSHQ6.js} +1 -1
- package/dist/preview/{chunk.N2FNHRI2.js → chunk.HOCD7KIR.js} +1 -1
- package/dist/preview/chunk.HSSIMVVM.js +1 -0
- package/dist/preview/{chunk.S2DOVJRL.js → chunk.I2737CPF.js} +1 -1
- package/dist/preview/chunk.I4Z7HVRT.js +1 -0
- package/dist/preview/{chunk.F5VEHAP2.js → chunk.IAEHUSQQ.js} +1 -1
- package/dist/preview/{chunk.7E4CSXBT.js → chunk.IGK7EZCX.js} +1 -1
- package/dist/preview/chunk.INHS3KTK.js +1 -0
- package/dist/preview/{chunk.LGRQDILY.js → chunk.IWYMKGZZ.js} +1 -1
- package/dist/preview/{chunk.3RFAUIGT.js → chunk.J2MM6BUW.js} +1 -1
- package/dist/preview/{chunk.7IGD2K4M.js → chunk.J7W2OFHY.js} +1 -1
- package/dist/preview/chunk.JMXXA4YG.js +1 -0
- package/dist/preview/chunk.JMYUQNXN.js +6 -0
- package/dist/preview/chunk.JO2X52D4.js +1 -0
- package/dist/preview/{chunk.2QQ37RCZ.js → chunk.JXNVNFV4.js} +1 -1
- package/dist/preview/chunk.K6DFXDPZ.js +1 -0
- package/dist/preview/{chunk.NSO6RUKW.js → chunk.KACSYPEV.js} +1 -1
- package/dist/preview/{chunk.ZMWAZACO.js → chunk.KBPJ7X7W.js} +1 -1
- package/dist/preview/chunk.KF27ME27.js +1 -0
- package/dist/preview/{chunk.35E75QJ7.js → chunk.KSIEO5W7.js} +1 -1
- package/dist/preview/chunk.L25DCT5S.js +1 -0
- package/dist/preview/{chunk.3KUYB5ZT.js → chunk.LETAQTLJ.js} +1 -1
- package/dist/preview/{chunk.44ZHHPPJ.js → chunk.LGRVEHXT.js} +2 -2
- package/dist/preview/chunk.LINSO5PN.js +1 -0
- package/dist/preview/{chunk.LVD3V77M.js → chunk.LLIURXFP.js} +1 -1
- package/dist/preview/{chunk.3IZEZPJB.js → chunk.LSN2IPAI.js} +1 -1
- package/dist/preview/chunk.M2JCFNHJ.js +1 -0
- package/dist/preview/{chunk.B3WVCSW5.js → chunk.M5FP4Y4Q.js} +1 -1
- package/dist/preview/{chunk.CPYBJNHP.js → chunk.M6ZN2KUO.js} +1 -1
- package/dist/preview/chunk.MODLZJD4.js +25 -0
- package/dist/preview/chunk.MWGZKZD6.js +1 -0
- package/dist/preview/{chunk.64FCAUAJ.js → chunk.NJRLJEJY.js} +1 -1
- package/dist/preview/chunk.NYLKG25K.js +4 -0
- package/dist/preview/{chunk.CD6YWH6T.js → chunk.OEIWIZCP.js} +1 -1
- package/dist/preview/{chunk.ZJFXM3LE.js → chunk.OJY7VJ7D.js} +1 -1
- package/dist/preview/chunk.OMT4QUZY.js +23 -0
- package/dist/preview/{chunk.R2TSTDS3.js → chunk.ONYBW45K.js} +1 -1
- package/dist/preview/chunk.OO2OP76C.js +1 -0
- package/dist/preview/{chunk.G3Q5IMM3.js → chunk.OOSIKCOS.js} +1 -1
- package/dist/preview/{chunk.7VQ3C7F4.js → chunk.OPTYYIGC.js} +1 -1
- package/dist/preview/{chunk.TUCSUZNO.js → chunk.OTV5XTBB.js} +1 -1
- package/dist/preview/{chunk.74B6KQF4.js → chunk.OWFS2YDQ.js} +1 -1
- package/dist/preview/{chunk.CXDGE5ZS.js → chunk.OWO3OV62.js} +1 -1
- package/dist/preview/{chunk.BUQKRXI6.js → chunk.PAGEGBUD.js} +1 -1
- package/dist/preview/{chunk.CGQ6KXVK.js → chunk.PDDIQ6PK.js} +1 -1
- package/dist/preview/{chunk.T3KNLP7C.js → chunk.PFQBCHQA.js} +1 -1
- package/dist/preview/{chunk.MH46V556.js → chunk.PPSYUOH7.js} +1 -1
- package/dist/preview/{chunk.HJS3LTSR.js → chunk.PSQYDCVM.js} +1 -1
- package/dist/preview/chunk.QDVGHI7R.js +1 -0
- package/dist/preview/chunk.QFHWG4LN.js +1 -0
- package/dist/preview/chunk.QGIM2WAY.js +1 -0
- package/dist/preview/chunk.QHMHUL6B.js +3 -0
- package/dist/preview/chunk.QOS5T46W.js +1 -0
- package/dist/preview/{chunk.KHAVEYT7.js → chunk.QPF4KSAW.js} +1 -1
- package/dist/preview/chunk.QQAZQDRW.js +1 -0
- package/dist/preview/chunk.QU52E5RG.js +3 -0
- package/dist/preview/{chunk.CS72MISN.js → chunk.QWNSHISU.js} +1 -1
- package/dist/preview/chunk.RSMCTI2N.js +1 -0
- package/dist/preview/chunk.RWIN3POV.js +1 -0
- package/dist/preview/chunk.SSF47GUY.js +1 -0
- package/dist/preview/chunk.T6DPWW2K.js +3 -0
- package/dist/preview/chunk.TA36WBHK.js +1 -0
- package/dist/preview/chunk.TGEL6EUA.js +1 -0
- package/dist/preview/chunk.TTGKX7LT.js +1 -0
- package/dist/preview/chunk.TXHYGFIZ.js +1 -0
- package/dist/preview/chunk.U3ED7W2U.js +1 -0
- package/dist/preview/chunk.U3HERHAI.js +88 -0
- package/dist/preview/chunk.U6QXLNHF.js +15 -0
- package/dist/preview/{chunk.FXG5AJF6.js → chunk.U6TEW6YD.js} +1 -1
- package/dist/preview/chunk.UJPX3BUV.js +1 -0
- package/dist/preview/chunk.V5I4GZEY.js +1 -0
- package/dist/preview/{chunk.XTTESA7X.js → chunk.V7W5AQKL.js} +1 -1
- package/dist/preview/{chunk.IFBGYFS4.js → chunk.VGHO3VCB.js} +1 -1
- package/dist/preview/{chunk.2TZSLREX.js → chunk.VKZIEZ5C.js} +2 -2
- package/dist/preview/chunk.VT2YGDK2.js +1 -0
- package/dist/preview/{chunk.ZTN7BS5O.js → chunk.W4YDPHCQ.js} +1 -1
- package/dist/preview/{chunk.NKYYDFIX.js → chunk.W53YNBSM.js} +1 -1
- package/dist/preview/chunk.WAB3L3ZI.js +1 -0
- package/dist/preview/chunk.WSDJPXJD.js +1 -0
- package/dist/preview/chunk.WSO7JOW5.js +1 -0
- package/dist/preview/{chunk.BU5PVRX7.js → chunk.WVLEGCRI.js} +1 -1
- package/dist/preview/chunk.XK65Y2KX.js +1 -0
- package/dist/preview/chunk.XMQG2PSM.js +50 -0
- package/dist/preview/{chunk.QO5RXOCS.js → chunk.XOE4KNP2.js} +2 -2
- package/dist/preview/chunk.YIPXZUTT.js +2 -0
- package/dist/preview/chunk.YNEHJWJV.js +2 -0
- package/dist/preview/{chunk.S3EEY7T3.js → chunk.YXEO3Y65.js} +1 -1
- package/dist/preview/chunk.Z274CL7J.js +1 -0
- package/dist/preview/{chunk.NBVPWLRY.js → chunk.Z7Y3R3YR.js} +1 -1
- package/dist/preview/{chunk.DJMSXXP4.js → chunk.ZBVYD4OX.js} +1 -1
- package/dist/preview/{chunk.4O3C2LJF.js → chunk.ZD7T234N.js} +1 -1
- package/dist/preview/{chunk.TY74U3EI.js → chunk.ZQR2SN65.js} +1 -1
- package/dist/preview/chunk.ZR2TP3BF.js +111 -0
- package/dist/preview/chunk.ZRBGYXAO.js +6 -0
- package/dist/preview/index.html +56 -54
- package/dist/preview/page.js +2 -2
- package/dist/preview/splash.js +17 -14
- package/package.json +6 -6
- package/dist/preview/chunk.2P34ML3O.js +0 -111
- package/dist/preview/chunk.2UW5CRHF.js +0 -1
- package/dist/preview/chunk.2YMO7ZVX.js +0 -1
- package/dist/preview/chunk.33ULA3CG.js +0 -1
- package/dist/preview/chunk.3CJLAJXP.js +0 -25
- package/dist/preview/chunk.3IJSB5ET.js +0 -1
- package/dist/preview/chunk.3KO35VN4.js +0 -1
- package/dist/preview/chunk.3L37FY3G.js +0 -4
- package/dist/preview/chunk.3WP66LB5.js +0 -1
- package/dist/preview/chunk.4GJ7F4SP.js +0 -35
- package/dist/preview/chunk.4IJTPV5X.js +0 -1
- package/dist/preview/chunk.4JFBLVXJ.js +0 -1
- package/dist/preview/chunk.4PCVQEVI.js +0 -1
- package/dist/preview/chunk.5FQSYMAE.js +0 -1
- package/dist/preview/chunk.5NCLZ4NZ.js +0 -1
- package/dist/preview/chunk.5YNLFOBJ.js +0 -5
- package/dist/preview/chunk.77XQEDT5.js +0 -1
- package/dist/preview/chunk.7HPQI5SY.js +0 -1
- package/dist/preview/chunk.A4VA3DU5.js +0 -1
- package/dist/preview/chunk.ABSY3UZF.js +0 -1
- package/dist/preview/chunk.ARHAD5IS.js +0 -1
- package/dist/preview/chunk.BOC2EOGB.js +0 -9
- package/dist/preview/chunk.BR6TINGU.js +0 -1
- package/dist/preview/chunk.CDEAAWPS.js +0 -1
- package/dist/preview/chunk.CXJJB3MK.js +0 -1
- package/dist/preview/chunk.CXLQPE4J.js +0 -1
- package/dist/preview/chunk.DA4RSHLW.js +0 -1
- package/dist/preview/chunk.DJPNVXBQ.js +0 -6
- package/dist/preview/chunk.DJVHKBEI.js +0 -1
- package/dist/preview/chunk.DVSTLVIH.js +0 -15
- package/dist/preview/chunk.E5WJSTOV.js +0 -1
- package/dist/preview/chunk.FEGSYSA7.js +0 -1
- package/dist/preview/chunk.HJUXC5GM.js +0 -1
- package/dist/preview/chunk.HNMSYQRA.js +0 -1
- package/dist/preview/chunk.HWLRKOI3.js +0 -1
- package/dist/preview/chunk.IHUMKFYH.js +0 -10
- package/dist/preview/chunk.IQ54QTA5.js +0 -1
- package/dist/preview/chunk.IQC3GOXO.js +0 -1
- package/dist/preview/chunk.ISN2QTVL.js +0 -2
- package/dist/preview/chunk.J24YPQ5I.js +0 -5
- package/dist/preview/chunk.J545NAMY.js +0 -1
- package/dist/preview/chunk.K2HDEL7I.js +0 -1
- package/dist/preview/chunk.K3JARAWU.js +0 -1
- package/dist/preview/chunk.KROR65KD.js +0 -2
- package/dist/preview/chunk.KV7GZBJ6.js +0 -50
- package/dist/preview/chunk.L7NJLZWV.js +0 -1
- package/dist/preview/chunk.LON75VHP.js +0 -1
- package/dist/preview/chunk.LQWVJQ5X.js +0 -18
- package/dist/preview/chunk.M5W2RHC6.js +0 -1
- package/dist/preview/chunk.M6BTLH24.js +0 -1
- package/dist/preview/chunk.MAGKI4PD.js +0 -1
- package/dist/preview/chunk.MD36ZSM5.js +0 -74
- package/dist/preview/chunk.MFZJVHWP.js +0 -1
- package/dist/preview/chunk.MHTA4HYB.js +0 -19
- package/dist/preview/chunk.N2YM247R.js +0 -1
- package/dist/preview/chunk.N35SJWAM.js +0 -1
- package/dist/preview/chunk.NJSK3UO2.js +0 -6
- package/dist/preview/chunk.OHMHPTEW.js +0 -1
- package/dist/preview/chunk.PV2I4UPH.js +0 -1
- package/dist/preview/chunk.QFQSSZN7.js +0 -1
- package/dist/preview/chunk.RSS6OHXG.js +0 -1
- package/dist/preview/chunk.SBCAYTMT.js +0 -1
- package/dist/preview/chunk.SMTGRCMG.js +0 -3
- package/dist/preview/chunk.TCZIZ2PU.js +0 -1
- package/dist/preview/chunk.U74PTRHJ.js +0 -1
- package/dist/preview/chunk.UAORKZLO.js +0 -1
- package/dist/preview/chunk.UDVTPI2W.js +0 -1
- package/dist/preview/chunk.UETLP5KC.js +0 -1
- package/dist/preview/chunk.UHI3X2YD.js +0 -1
- package/dist/preview/chunk.UL62ELNR.js +0 -1
- package/dist/preview/chunk.VRYSZYAD.js +0 -1
- package/dist/preview/chunk.VUZFLDOX.js +0 -1
- package/dist/preview/chunk.X2NGFOAF.js +0 -1
- package/dist/preview/chunk.XE762VL2.js +0 -2
- package/dist/preview/chunk.Y2RZ5B4U.js +0 -1
- package/dist/preview/chunk.YKMBXMZE.js +0 -1
- package/dist/preview/chunk.Z34KASY7.js +0 -1
- package/dist/preview/chunk.ZMGKWMID.js +0 -1
- package/dist/preview/chunk.ZT5YQSSP.js +0 -21
- package/dist/preview/chunk.ZZM75ZTN.js +0 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk.MIE4TJRW.js";import{o as D}from"./chunk.5LJVOLKR.js";import"./chunk.OJGHDWI6.js";import"./chunk.OWFS2YDQ.js";import"./chunk.WSDJPXJD.js";import"./chunk.F4VB6Q2W.js";import{a as $}from"./chunk.FFOD5B4B.js";import"./chunk.Z7Y3R3YR.js";import"./chunk.YXEO3Y65.js";import"./chunk.U3HERHAI.js";import"./chunk.FBILPNGH.js";import{G as P,W as C}from"./chunk.MODLZJD4.js";import"./chunk.SDO3U72B.js";import{$a as c,Va as w,Xa as R,ba as S}from"./chunk.6HY6ZGEE.js";import"./chunk.FQLNBIQ5.js";import{b as k}from"./chunk.AJZBJBMO.js";var m=k(P(),1);var e=k(C(),1),W=[["","Does not repeat"],["day","Daily"],["week","Weekly"],["month","Monthly"],["year","Yearly"]],E=r=>`${r}${r%100>=11&&r%100<=13?"th":["th","st","nd","rd"][r%10]??"th"}`,v={display:"flex",flexWrap:"wrap",gap:"6px 12px",alignItems:"center"};function N({value:r,onChange:d,start:p,label:s,name:l="repeat"}){let f=(0,m.useId)(),a=c(r)?r:void 0,i=typeof p=="string"&&/^\d{4}-\d{2}-\d{2}/.test(p)?p:void 0,u=i?w[new Date(`${i.slice(0,10)}T00:00:00Z`).getUTCDay()]:void 0,o=t=>{let n={...a??{every:"week"},...t};for(let b of Object.keys(n))n[b]===void 0&&delete n[b];d(n)},y=a?.every??"week",g=a?.on??(u?[u]:[]);return(0,e.jsxs)("fieldset",{"data-graview-part":"field","data-graview-field":"repeat","data-graview-repeat":l,style:{display:"grid",gap:8,border:"1px solid var(--graview-edge)",borderRadius:8,padding:"8px 12px",margin:0,minWidth:0},children:[(0,e.jsx)("legend",{"data-graview-part":"label",style:{padding:"0 4px"},children:s}),(0,e.jsxs)("div",{style:v,children:[(0,e.jsx)("label",{htmlFor:`${f}-every`,children:"Repeats"}),(0,e.jsx)("select",{id:`${f}-every`,name:`${l}.every`,value:a?.every??"",onChange:t=>{let n=t.target.value;d(n===""?void 0:{...a?.interval?{interval:a.interval}:{},...a?.until?{until:a.until}:{},every:n})},"data-graview-part":"control",children:W.map(([t,n])=>(0,e.jsx)("option",{value:t,children:n},t))}),a?(0,e.jsxs)("label",{style:v,children:["every",(0,e.jsx)("input",{type:"number",min:1,max:99,name:`${l}.interval`,"aria-label":`Every how many ${y}s`,value:a.interval??1,onChange:t=>o({interval:Number(t.target.value)>1?Math.min(99,Math.round(Number(t.target.value))):void 0}),style:{width:"4.5em"},"data-graview-part":"control"}),y,(a.interval??1)>1?"s":""]}):null]}),a?.every==="week"?(0,e.jsxs)("div",{role:"group","aria-label":"On",style:v,children:[(0,e.jsx)("span",{"aria-hidden":"true",children:"On"}),w.map((t,n)=>(0,e.jsxs)("label",{style:{display:"inline-flex",gap:4,alignItems:"center",minHeight:24},children:[(0,e.jsx)("input",{type:"checkbox",name:`${l}.on`,value:t,checked:g.includes(t),onChange:b=>{let h=w.filter(x=>x===t?b.target.checked:g.includes(x));o({on:h.length===0||h.length===1&&h[0]===u?void 0:h})}}),S(n,"short")]},t))]}):null,a?.every==="month"?(0,e.jsxs)("label",{style:v,children:["On",(0,e.jsxs)("select",{name:`${l}.on`,value:a.on?.[0]===-1?"last":"",onChange:t=>o({on:t.target.value==="last"?[-1]:void 0}),"data-graview-part":"control",children:[(0,e.jsx)("option",{value:"",children:i?`the ${E(Number(i.slice(8,10)))}`:"the same day"}),(0,e.jsx)("option",{value:"last",children:"the last day"})]})]}):null,a?(0,e.jsxs)("label",{style:v,children:["Until",(0,e.jsx)("input",{type:"date",name:`${l}.until`,value:a.until??"",onChange:t=>o({until:t.target.value||void 0}),"data-graview-part":"control"})]}):null,(0,e.jsx)("p",{"aria-live":"polite","data-graview-repeat-said":"",style:{margin:0,color:"var(--graview-ink-dim)",fontSize:"0.8125rem"},children:a?$(i??"",a):"Does not repeat"})]})}function K({nodeId:r,field:d,start:p,value:s,label:l}){let{fields:f,commit:a}=D(r),i=f.find(t=>t.field===R(d)&&t.takesValue&&t.open.length===0),[u,o]=(0,m.useState)(!1),[y,g]=(0,m.useState)(c(s)?s:void 0);return i?u?(0,e.jsxs)("form",{onSubmit:t=>{t.preventDefault(),o(!1),a(i,y??null)},style:{display:"grid",gap:6,marginTop:6},children:[(0,e.jsx)(N,{value:y,onChange:g,start:p,label:l,name:R(d)}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,e.jsx)("button",{type:"submit","data-graview-repeat-keep":d,children:"Keep"}),(0,e.jsx)("button",{type:"button",onClick:()=>o(!1),children:"Cancel"})]})]}):(0,e.jsx)("button",{type:"button","data-graview-repeat-open":d,onClick:()=>(g(c(s)?s:void 0),o(!0)),style:{marginInlineStart:8,fontSize:"0.75rem",padding:"1px 8px",borderRadius:999,minHeight:24},children:c(s)?"Change how it repeats":"Repeat\u2026"}):null}export{K as RepeatEditor,N as RepeatPicker};
|
|
@@ -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 Yt,f as ct,g as In}from"./chunk.2VR7YEJ6.js";import{h as Oi}from"./chunk.LETAQTLJ.js";import{e as Ei,q as ar,r as Ri}from"./chunk.BUVTUAB5.js";import{b as Nn}from"./chunk.OJY7VJ7D.js";import{a as Fe,b as Qr,c as cn,d as Ai,e as Zr}from"./chunk.GEFXU4VO.js";import{a as Mi}from"./chunk.FIFUMX5X.js";import{a as vi,b as ki,c as Si}from"./chunk.EMFOMSMI.js";import{b as li,d as ci}from"./chunk.QOS5T46W.js";import{c as Go}from"./chunk.4AC2QM7T.js";import{A as bi,C as xi,a as hi,b as _r,c as Kr,f as Ur,g as Xr,h as qr,i as fi,j as sn,k as dn,p as zt,q as ln,r as gi,s as yi,z as wi}from"./chunk.5LJVOLKR.js";import{A as di,f as Zo,g as on,h as Jo,i as ei,j as ti,k as ni,m as ir,n as Cn,o as Tn,p as an,q as Yr,v as ri,w as oi,x as ii,y as ai,z as si}from"./chunk.OJGHDWI6.js";import{a as mi,b as pi}from"./chunk.OWFS2YDQ.js";import{b as ui}from"./chunk.Z7Y3R3YR.js";import{A as wt,B as $r,C as Pn,G as Pe,K as Ot,L as Ko,La as Ln,Qa as jr,Ra as Vr,Sa as Gt,Ua as Gr,W as Oe,Y as rr,Ya as zr,Z as Fr,a as Tr,b as Ir,ba as Wr,c as Nr,ca as or,d as zo,da as jt,e as Yo,ea as xe,f as tr,ga as Vt,h as Ft,j as Et,k as Hr,l as nr,la as Uo,m as On,ma as Xo,p as Br,pa as rn,r as Re,ra as qo,s as He,t as _o,u as An,v as Be,w as Wt,x as Rt,xa as Qo,y as Dr}from"./chunk.MODLZJD4.js";import{a as nn}from"./chunk.SDO3U72B.js";import{Rc as Rn,Yd as Cr,_d as Wo,ga as Zn,ka as $o,la as en,na as tn,oa as $t,oe as jo,pa as Jn,rd as We,re as Vo,ua as Fo,ye as er}from"./chunk.6HY6ZGEE.js";import{b as ae}from"./chunk.AJZBJBMO.js";var sr=ae(Pe(),1);var Pi=ae(Oe(),1);function dr(e){let t=(0,sr.useRef)(e);t.current=e;let n=(0,sr.useRef)(null),o=(0,sr.useRef)(new Map),r=n.current;if(r&&(r.outer===e||Os(r.outer,e)))return r.outer=e,r.inner;let i=ct(e.view,null),s=(c,l,a)=>{let u=o.current.get(c);return u&&u.made===l?u.call:(o.current.set(c,{made:l,call:a}),a)},d=Object.fromEntries(Object.entries(e).map(([c,l])=>[c,c==="view"?i:c==="setView"?s(c,l,Rs(t)):typeof l=="function"?s(c,l,(...a)=>t.current[c](...a)):l]));return n.current={outer:e,inner:d},d}function Rs(e){return t=>e.current.setView(typeof t=="function"?t:n=>t.pan===void 0&&n.pan?{...t,pan:n.pan}:t)}function Os(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],i=t[o];if(r!==i&&!(typeof r=="function"&&typeof i=="function"))return!1}return Jr(e.view,t.view)}function Jr(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 As({children:e}){let t=dr(xe());return(0,Pi.jsx)(rr.Provider,{value:t,children:e})}var Li={width:1200,height:760,focusSize:{width:1200,height:420},relationSize:{width:240,height:140},contextSize:{width:300,height:104},gap:16,unit:16};var Ci=(e,t)=>e?`${e.edgeKind}|${e.direction}`:`raised|${t}`,_t=(e,t,n)=>`${$r}${e}|${t}|${n}`;function lr(e,t){let n=e.map(()=>0),o=e.map((s,d)=>({size:s,index:d})).sort((s,d)=>s.size-d.size||s.index-d.index),r=Math.max(t,e.length),i=e.length;for(let{size:s,index:d}of o){let c=Math.max(1,Math.floor(r/i));n[d]=Math.min(s,c),r-=n[d],i-=1}return n}function to(e){return Ci(e.via,e.node.kind)}function un(e,t,n=[]){let o=[],r=0;return e.forEach((i,s)=>{if(i<=0)return;let d=Math.min(t,Math.max(1,n[s]??1)),c=Math.max(i,d);if(o.length>0&&i<=t&&c<=r){o[o.length-1].push({run:s,cards:i,slots:c}),r-=c;return}let l=i,a=!0;for(;l>0;){let u=Math.min(t,l),m=a?Math.max(u,d):u;o.push([{run:s,cards:u,slots:m}]),l-=u,r=t-m,a=!1}}),o}function no(e,t,n,o=[]){let r=lr(e,t*n);for(;un(r,t,o).length>n;){let i=-1;if(r.forEach((s,d)=>{s>1&&(i<0||s>r[i])&&(i=d)}),i<0)break;r[i]=r[i]-1}return r}function Ps(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,i)=>({node:r,index:i,key:o(r)})).sort((r,i)=>{for(let s=0;s<r.key.length;s++)if(r.key[s]!==i.key[s])return r.key[s]-i.key[s];return r.index-i.index}).map(r=>r.node)}var Ls=5,Cs=(e,t)=>{for(let n=0;n<e.length;n++)if(e[n]!==t[n])return e[n]<t[n];return!1};function Ti(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}:{}},i=[];for(let d of Ei(n.schema,o).groups)if(d.key!==n.exclude)if(d.buckets)for(let c of["decade","year","month"])i.push({by:d.key,bucket:c});else i.push({by:d.key});let s;return i.forEach((d,c)=>{let a=Oi(e,{group:d},r).groups;if(a.length<2||a.length>t)return;let m=a.filter(b=>b.key!=="").reduce((b,h)=>b+h.nodes.length,0)/e.length;if(m<.5||a.some(b=>b.nodes.length>e.length*.75))return;let f=[-Math.round(m*100),Math.abs(a.length-Ls),c];(!s||Cs(f,s.score))&&(s={grouping:{by:d.by,...d.bucket?{bucket:d.bucket}:{},groups:a},score:f})}),s?.grouping}function ro(e,t){let n=h=>({id:h.node.id,kind:h.node.kind,node:h.node,...h.via?{via:h.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 h of e){let y=Ci(h.via,h.node.kind),E=r.get(y);E?E.push(h):r.set(y,[h])}let i=[...r.entries()].map(([h,y])=>({key:h,run:y,via:y[0].via,kinds:[...new Set(y.map(E=>E.node.kind))],members:[],whole:!1,extra:0})),s=lr(i.map(h=>h.run.length),t.budget);i.forEach((h,y)=>h.whole=h.run.length<=s[y]);let d=i.filter(h=>!h.whole),c=i.filter(h=>h.whole).reduce((h,y)=>h+y.run.length,0),l=Math.max(d.length,t.budget-c);for(let h of d){h.members=Ps(h.run.map(E=>E.node),o,t.graph);let y=l-(d.length-1);h.kinds.length>1&&h.kinds.length<=y?h.byKind=!0:h.kinds.length===1&&(h.grouping=Ti(h.members,y,{schema:t.schema,graph:t.graph,...h.via?{exclude:h.via.edgeKind}:{},...t.today?{today:t.today}:{}}))}let a=h=>h.byKind?h.kinds.length:h.grouping?h.grouping.groups.length:1;for(;d.reduce((h,y)=>h+a(y),0)>l;){let h=[...d].filter(y=>a(y)>1).sort((y,E)=>a(E)-a(y))[0];if(!h)break;h.grouping=void 0,h.byKind=!1}l-=d.reduce((h,y)=>h+a(y),0);let u=h=>h.byKind?h.kinds.some(y=>t.expanded.has(_t(y,h.key,"kind"))):h.grouping?.groups.some(y=>t.expanded.has(_t(h.kinds[0],h.key,eo(h.grouping,y.key)))),m=d.filter(h=>!h.grouping&&!h.byKind?!0:u(h)),f=lr(m.map(h=>h.members.length),Math.max(0,l));m.forEach((h,y)=>h.extra=l>0?f[y]:0);let b=[];for(let h of i){let{key:y,via:E}=h;if(h.whole){b.push(...h.run.map(n));continue}let S=g=>({id:g.id,kind:g.kind,node:g,...E?{via:E}:{}}),w=new Map(h.run.map((g,M)=>[g.node.id,M])),x=(g,M,L)=>{let C=[...g.slice(0,M)].sort((ie,I)=>w.get(ie.id)-w.get(I.id));b.push(...C.map(S));let V=g.slice(M);if(V.length===0)return;let q=V[0].kind;b.push({id:_t(q,y,L?`more:${L}`:"more"),kind:q,...E?{via:E}:{},aggregate:{kind:q,memberIds:V.map(ie=>ie.id),label:M>0?`${V.length} more ${t.plural(q).toLowerCase()}`:`${V.length} ${t.plural(q).toLowerCase()}`,opens:{in:"picture",focus:Be(q),within:L?{filter:L}:{}}}})},A=E&&t.focusId?`${E.edgeKind}:${t.focusId}`:void 0;if(h.byKind){let g=h.kinds.find(M=>t.expanded.has(_t(M,y,"kind")));for(let M of h.kinds){let L=h.members.filter(C=>C.kind===M);if(M===g){let C=h.extra+1;L.length<=C?b.push(...L.map(S)):x(L,C-1,A);continue}b.push({id:_t(M,y,"kind"),kind:M,...E?{via:E}:{},aggregate:{kind:M,memberIds:L.map(C=>C.id),label:t.plural(M),opens:{in:"place"}}})}continue}let O=h.grouping;if(!O){x(h.members,h.extra,A);continue}let T=h.kinds[0],$=O.groups.find(g=>t.expanded.has(_t(T,y,eo(O,g.key))));for(let g of O.groups){if(g===$){let M=h.members.filter(C=>g.nodes.includes(C)),L=h.extra+1;if(M.length<=L)b.push(...M.map(S));else{let C=g.key!==""&&!g.key.includes(",")&&!O.bucket,V=[A,C?`${O.by}:${g.key}`:void 0].filter(Boolean).join(",")||void 0;x(M,L-1,V)}continue}b.push({id:_t(T,y,eo(O,g.key)),kind:T,...E?{via:E}:{},aggregate:{kind:T,memberIds:h.members.filter(M=>g.nodes.includes(M)).map(M=>M.id),label:g.label.charAt(0).toUpperCase()+g.label.slice(1),opens:{in:"place"}}})}}return b}var eo=(e,t)=>`${e.by}${e.bucket?`:${e.bucket}`:""}=${t||"none"}`;var cr=300,Ii=12,hn=8,oo=19;var ur=(e,t=1)=>(e.length*8.4+16)*t;function Hn(e){return e.description??`${e.direction==="in"?"\u2190":"\u2192"} ${Zn(e.edgeKind).toLowerCase()}`}function io(e,t,n=1){let o=d=>ur(d,n),r=new Map;for(let d of e){let c=r.get(d.key);c?c.push(d):r.set(d.key,[d])}let i=[...r.values()].map(d=>{let c=Math.min(...d.map(a=>a.top)),l=d.filter(a=>a.top-c<=Ii);return{key:d[0].key,text:d[0].text,left:Math.min(...l.map(a=>a.left)),right:Math.max(...l.map(a=>a.right)),top:c}});i.sort((d,c)=>d.top-c.top||d.left-c.left);let s=i.map(d=>{let c=Math.max(d.right-d.left,Math.min(cr,o(d.text))),l=(d.left+d.right)/2;return{left:l-c/2,right:l+c/2}});return i.map((d,c)=>{let l=i.map((w,x)=>({other:w,at:x})).filter(({other:w})=>w!==d&&Math.abs(w.top-d.top)<=Ii),a=l.filter(({other:w})=>w.right<=d.left).map(({other:w,at:x})=>s[x].right+hn<=(w.right+d.left)/2?s[x].right+hn:(w.right+d.left+hn)/2),u=l.filter(({other:w})=>w.left>=d.right).map(({other:w,at:x})=>s[x].left-hn>=(d.right+w.left)/2?s[x].left-hn:(d.right+w.left-hn)/2),m=Math.max(t.left,...a),f=Math.min(t.right,...u),b=d.right-d.left,h=s[c].right-s[c].left,y=Math.max(b,Math.min(h,f-m)),E=(d.left+d.right)/2,S=b>=y?d.left:Math.max(m,Math.min(E-y/2,f-y));return{key:d.key,text:d.text,left:S,width:y,top:d.top}})}function Hi(e,t,n,o,r=1){let i=d=>String(d).length*7.4,s=e.length*8.6+6+i(t)+14+(n>0?22+i(n):0);return{width:Math.max(s,o?184:0)*r,height:(o?38:22)*r,short:{width:s*r,height:22*r}}}function Kt(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 ao=(e,t,n,o)=>{let r=Math.max(e.x,Math.min(t.x,e.x+e.width)),i=Math.max(e.y,Math.min(t.y,e.y+e.height));return Math.abs(r-t.x)/n+Math.abs(i-t.y)/o<.92},Bn=4,Ni=.45;function so(e,t,n,o={},r={}){let i={};for(let v of e)i[v.kind]=v.count;let s={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},d=r.avoid??[],c=r.tilt??.5,l=v=>v.nameplate??{width:120,height:34,short:{width:90,height:20}},a=v=>e.map(R=>{let k=v.get(R.kind);return{card:R,plot:k,center:cn(k.col+k.side/2,k.row+k.side/2,1,c)}}),u=(v,R)=>{let k=1/0,H=-1/0,F=1/0,W=-1/0;for(let{card:Y,plot:_,center:Z}of v){let oe=Z.x*R,K=Z.y*R,pe=_.side*R/2,ye=Y.opened>0?l(Y).width:l(Y).short.width;k=Math.min(k,oe-Math.max(pe+(Y.count>12?30:0),ye/2)),H=Math.max(H,oe+Math.max(pe,ye/2)),F=Math.min(F,K-pe*c-R*Ni),W=Math.max(W,K+pe*c+Bn+l(Y).short.height)}return{minX:k,maxX:H,minY:F,maxY:W}},m=v=>{let R=4,k=160;for(let H=0;H<24;H++){let F=(R+k)/2,W=u(v,F);W.maxX-W.minX<=s.width&&W.maxY-W.minY<=s.height?R=F:k=F}return R},f=v=>{let R={...r.order?{order:r.order}:{},counts:i,...r.plots?{plots:r.plots}:{},pitch:v},k=Qr(t,R),H=Qr(t,{...R,upright:!0}),F=m(a(k)),W=m(a(H)),Y=n.height>n.width&&W>=F?H:k;return{map:Y,fitted:Y===H?W:F}},b=[],h=new Map,y=0,E=(v,R={x:0,y:0})=>{let k=u(b,v),H=s.x+s.width/2-(k.minX+k.maxX)/2+R.x,F=s.y+s.height/2-(k.minY+k.maxY)/2+R.y;return{originX:H,originY:F,cell:v}},S=v=>{let{originX:R,originY:k,cell:H}=v,F=b.map(({center:_})=>_.y),W=Math.max(...F),Y=Math.min(...F);return b.map(({card:_,plot:Z,center:oe})=>{let K=R+oe.x*H,pe=k+oe.y*H,ye=Z.side*H/2,ue=ye*c,Me=W===Y?.5:(oe.y-Y)/(W-Y);return{card:_,plot:Z,x:K,y:pe,halfW:ye,halfH:ue,depth:1-Me*.65}})},w=(v,R=!0)=>{let k=[];return[...v].sort((F,W)=>(W.card.weight??W.card.count)-(F.card.weight??F.card.count)||e.indexOf(F.card)-e.indexOf(W.card)).filter(F=>[l(F.card),l(F.card).short].some(W=>{let Y=O(F,W),_=(!R||Y.x>=0&&Y.y>=0&&Y.x+Y.width<=n.width&&Y.y+Y.height<=n.height)&&!k.some(Z=>Kt(Y,Z,4))&&!v.some(Z=>Z!==F&&ao(Y,Z,Z.halfW,Z.halfH))&&!d.some(Z=>Kt(Y,Z,0));return _&&k.push(Y),_})).length},x=v=>v.card.marquee?{x:v.x-v.card.marquee.width/2,y:v.y+v.halfH+Bn+l(v.card).height,width:v.card.marquee.width,height:v.card.marquee.height}:null,A=(v,R,k)=>k.some(H=>{if(H===R)return!1;let F=x(H);return F!==null&&Kt(v,F,4)}),O=(v,R,k="under")=>k==="aside"?{x:v.x+v.halfW+Bn,y:v.y-R.height/2,width:R.width,height:R.height}:k==="above"?{x:v.x-R.width/2,y:v.y-v.halfH-Bn-Ni*M.cell-R.height,width:R.width,height:R.height}:{x:v.x-R.width/2,y:v.y+v.halfH+Bn,width:R.width,height:R.height},T=v=>v.some(R=>d.some(k=>ao(k,R,R.halfW,R.halfH)||Kt(k,O(R,l(R.card).short),0))),$=v=>v.every(R=>{let k=O(R,l(R.card).short);return R.x-R.halfW>=0&&R.x+R.halfW<=n.width&&R.y-R.halfH>=0&&k.x>=0&&k.x+k.width<=n.width&&k.y+k.height<=n.height}),g={pitch:Fe,said:-1};for(let v of[Fe,Fe+1,Fe+2,Fe+3,Fe+5,Fe+7]){({map:h,fitted:y}=f(v)),b=a(h);let R=w(S(E(y)));if(R>g.said&&(g={pitch:v,said:R}),R===e.length)break}(g.pitch!==Fe+7||g.said!==e.length)&&({map:h,fitted:y}=f(g.pitch),b=a(h));let M=E(y);if(d.length>0&&T(S(M))){let v;for(let R=1;R>=.3&&!v;R-=.05){let k=y*R,H=Math.max(...d.map(W=>W.width))/2+k,F=Math.max(...d.map(W=>W.height))/2+k/2;for(let W of[0,.5,.75,1,1.25]){for(let[Y,_]of[[1,0],[-1,0],[0,1],[0,-1],[1,1],[-1,1],[1,-1],[-1,-1]]){let Z=E(k,{x:Y*H*W,y:_*F*W}),oe=S(Z);if(!T(oe)&&$(oe)){v=Z;break}if(W===0)break}if(v)break}}v&&(M=v)}let L=(v,R,k={x:n.width/2,y:n.height/2})=>({cell:v.cell*R,originX:k.x+(v.originX-k.x)*R,originY:k.y+(v.originY-k.y)*R}),C=v=>{let R=v,k=r.stood&&Math.abs(r.stood.cell-R.cell)<.01?r.stood:null;k&&(R={...R,originX:R.originX+k.x,originY:R.originY+k.y});let H={x:R.originX-(k?.x??0),y:R.originY-(k?.y??0)},F=S(R).filter(W=>r.keep?.includes(W.card.kind));if(F.length>0){let W=r.seen??n,Y=F.flatMap(te=>[{x:te.x-te.halfW,y:te.y-te.halfH,width:te.halfW*2,height:te.halfH*2},O(te,l(te.card))]),_=r.seen?F.flatMap(te=>x(te)??[]):[],Z=te=>Math.max(...te.map(J=>J.y+J.height))-Math.min(...te.map(J=>J.y)),oe=_.length>0&&Z([...Y,..._])<=W.height-16?[...Y,..._]:Y,K=Math.min(...oe.map(te=>te.x)),pe=Math.max(...oe.map(te=>te.x+te.width)),ye=Math.min(...oe.map(te=>te.y)),ue=Math.max(...oe.map(te=>te.y+te.height)),Me=(te,J,se)=>J-te>se-16?se/2-(te+J)/2:te<8?8-te:J>se-8?se-8-J:0;(!r.seen||ue-ye<=W.height-16)&&(R={...R,originX:R.originX+Me(K,pe,W.width),originY:R.originY+Me(ye,ue,W.height)})}return{where:R,stood:{x:R.originX-H.x,y:R.originY-H.y,cell:R.cell}}},V=1,q;if(w(S(M))<e.length){let v={said:w(S(M),!1),area:1/0,pitch:-1,by:1},R={map:h,shape:b,fitted:y,where:M};for(let k of[Fe,Fe+1,Fe+2,Fe+3,Fe+5,Fe+7]){({map:h,fitted:y}=f(k)),b=a(h);let H=E(y);for(let F=1;F<=3.001;F+=.1){let W=w(S(L(H,F)),!1),Y=u(b,y*F),_=(Y.maxX-Y.minX)*(Y.maxY-Y.minY);if((W>v.said||W===v.said&&_<v.area)&&(v={said:W,area:_,pitch:k,by:F}),W===e.length)break}}v.pitch<0?{map:h,shape:b,fitted:y,where:M}=R:({map:h,fitted:y}=f(v.pitch),b=a(h),V=v.by,M=L(E(y),V)),{where:M,stood:q}=C(M)}else r.seen&&r.seen.height<n.height&&({where:M,stood:q}=C(M));let ie=r.zoom&&r.zoom!==1?r.zoom:1;ie!==1&&(M=L(M,ie,r.seen?{x:r.seen.width/2,y:r.seen.height/2}:void 0));let I=S(M),D=[],N=new Map,Q=new Map,P=[...I].sort((v,R)=>(R.card.weight??R.card.count)-(v.card.weight??v.card.count)||e.indexOf(v.card)-e.indexOf(R.card));for(let v of P){let R=[["full",l(v.card),"under"],["short",l(v.card).short,"under"]],k="none",H=v===P[0],F=(Y,_)=>R.filter(([Z])=>Z.startsWith(_)).map(([Z,oe,K])=>[Z,oe,K,Y]),W=H?[...F(!1,"full"),...F(!1,"short"),...F(!0,"full"),...F(!0,"short")]:R.map(([Y,_,Z])=>[Y,_,Z,!1]);for(let[Y,_,Z,oe]of W){let K=O(v,_,Z);if((ie!==1||V!==1||K.x>=0&&K.y>=0&&K.x+K.width<=n.width&&K.y+K.height<=n.height)&&!D.some(ue=>Kt(K,ue,4))&&(oe||!I.some(ue=>ue!==v&&ao(K,ue,ue.halfW,ue.halfH)))&&!A(K,v,I)&&!d.some(ue=>Kt(K,ue,0))){k=Y,D.push(K),Q.set(v.card.id,K);break}}N.set(v.card.id,k)}let j=I.map(v=>({id:v.card.id,x:v.x-v.halfW,y:v.y-v.halfH,width:v.halfW*2,height:v.halfH*2+(v.card.opened>0?Math.max(v.card.openedMin??0,v.card.opened):0),depth:v.depth,plot:v.plot,nameplate:N.get(v.card.id)??"none"})),z=u(b,M.cell),re={cell:M.cell,originX:M.originX,originY:M.originY,pan:r.pan??{x:0,y:0},extent:{x:M.originX+z.minX,y:M.originY+z.minY,width:z.maxX-z.minX,height:z.maxY-z.minY},openedShare:1,...c!==.5?{tilt:c}:{},...q&&(q.x!==0||q.y!==0)?{stood:q}:{},...Q.size>0?{nameplates:I.flatMap(v=>{let R=Q.get(v.card.id);return R?[{id:v.card.id,x:R.x-(v.x-v.halfW),y:R.y-(v.y-v.halfH),width:R.width,height:R.height}]:[]})}:{},...I.some(v=>v.card.marquee)?{showings:I.flatMap(v=>{let R=x(v);return R?[{id:v.card.id,x:R.x-(v.x-v.halfW),y:R.y-(v.y-v.halfH),width:R.width,height:R.height}]:[]})}:{}};return{placed:j,frame:re,map:h}}function At(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,i=24;return{x:Math.max(o.x,r.x+r.width-t+i,-r.x+i),y:Math.max(o.y,r.y+r.height-n+i,-r.y+i)}}var hr=48;function lo(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 i=r.x+r.width/2,s=r.y+r.height/2,d=i<0?"left":i>t?"right":s<0?"top":s>n?"bottom":null;if(!d)continue;let c=d==="left"||d==="right",l=c?Math.max(0,Math.min(n,s)):Math.max(0,Math.min(t,i)),a=(f,b)=>f<b/4?b/4-f:f>b*3/4?b*3/4-f:0,u=(f,b)=>f<hr?hr-f:f>b-hr?b-hr-f:0,m=c?{x:a(i,t),y:u(s,n)}:{x:u(i,t),y:a(s,n)};o.push({id:r.id,kind:r.id.slice(5),side:d,along:l,by:m})}return o}function fr(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 Ts={rankOf:()=>{},parentOf:()=>{}};function Bi(e,t){if(t.size===0)return Ts;let n=e.kinds,o=new Map,r=(l,a)=>{l!==a&&((o.get(l)??o.set(l,new Set).get(l)).add(a),(o.get(a)??o.set(a,new Set).get(a)).add(l))};for(let l of n){let a=e.tryDefinition(l);if(a)for(let u of Object.values(a.edges??{})){let m=u.to==="*"?n:u.to;for(let f of m)r(l,f)}}let i=new Map,s=new Map,d=[...t].filter(l=>n.includes(l));for(let l of d)i.set(l,0);let c=0;for(;d.length>0;){c+=1;let l=[];for(let a of[...d].sort((u,m)=>n.indexOf(u)-n.indexOf(m)))for(let u of[...o.get(a)??[]].sort((m,f)=>n.indexOf(m)-n.indexOf(f)))i.has(u)||(i.set(u,c),c===2&&s.set(u,a),l.push(u));d=l}return{rankOf:l=>{let a=i.get(l);if(a!==0)return a===1?"primary":"secondary"},parentOf:l=>s.get(l)}}function Di(e,t,n,o,r={}){if(n){let i=new Map;for(let s of e.allEdges()){if(o&&s.kind!==o)continue;let d=s.from===n.id?s.to:s.to===n.id?s.from:null;if(d===null||d===n.id)continue;let c=e.getNode(d);if(!c||i.has(d))continue;let l=s.from===n.id?"out":"in",a=l==="out"?n.kind:c.kind,u=Is(t,a,s.kind,l);i.set(d,{node:c,via:{edgeKind:s.kind,direction:l,...u?{description:u}:{}}})}if(i.size>0){let s=d=>`${d.via.edgeKind}|${d.via.description??""}`;return[...i.values()].sort((d,c)=>(s(d)<s(c)?-1:s(d)>s(c)?1:0)||wt(d.node,c.node))}}if(n){let i=r[n.id]??[],s=new Set,d=[];for(let c of i){if(c===n.id||s.has(c))continue;let l=e.getNode(c);l&&(o&&o!=="judges"&&l.kind!==o||(s.add(c),d.push({node:l,via:{edgeKind:"judges",direction:"out",description:"what it finds wrong"}})))}if(d.length>0)return d.sort((c,l)=>wt(c.node,l.node))}return o?e.allNodes().filter(i=>i.kind===o).sort(wt).map(i=>({node:i})):[]}function Is(e,t,n,o){let i=e.tryDefinition(t)?.edges?.[n];return o==="out"?i?.description:i?.inverse}function $i(e,t,n){let o=new Map,r=[...t.values()].sort((l,a)=>l.plane-a.plane);for(let l of r)for(let a of l.aggregate?.memberIds??[])!t.has(a)&&!o.has(a)&&o.set(a,l.id);let i=l=>t.get(l)??t.get(o.get(l)??""),s=new Map,d=new Map,c=new Map;for(let l of e.allEdges()){let a=i(l.from),u=i(l.to);if(!a||!u||a.id===u.id&&!(n.overview&&a.aggregate&&a.plane===2))continue;let m=`${l.kind}:${a.id}:${u.id}`,f=s.get(m);if(f){let b=`${l.from}
|
|
2
|
+
${l.to}`,h=d.get(m);if(h.has(b))continue;if(h.add(b),c.get(m).push({from:l.from,to:l.to}),f.single){let{single:y,...E}=f;s.set(m,E)}continue}d.set(m,new Set([`${l.from}
|
|
3
|
+
${l.to}`])),c.set(m,[{from:l.from,to:l.to}]),s.set(m,{id:m,kind:l.kind,from:a.id,to:u.id,edges:[{from:l.from,to:l.to}],single:{from:l.from,to:l.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[...s.values()].map(l=>({...l,edges:c.get(l.id)})).sort(wt)}var Wi=.85,Fi=60,co=160;function Ns(e,t,n,o,r,i=Wi){let s=e*t.width+Math.max(0,e-1)*n,d=Math.max(n,(o-s)/2);return Array.from({length:e},(c,l)=>({x:d+l*(t.width+n),y:r,depth:i}))}function mr(e,t,n,o={}){let r={...Li,...o},i=Math.max(8,r.unit??16)/16,s=r.inset?.left??0,d=n.overview?Math.max(0,r.dock?.right??0):0,c=n.overview?Math.max(0,r.dock?.bottom??0):0,l=r.width-d-s-(r.inset?.right??0),a=[],u=new Map,m=p=>n.past===!0||$o(t.tryDefinition(p.kind),p,r.today),f=new Set(o.hiddenKinds??[]),b=p=>!f.has(p.kind),h=n.focusId?Rt(n.focusId).filter(p=>t.tryDefinition(p)!==void 0).filter(p=>!f.has(p)):[];n.focusId&&Rt(n.focusId).length>0&&h.length===0&&(n={...n,focusId:null});let y=n.focusId?e.getNode(n.focusId):void 0;y&&!b(y)&&(n={...n,focusId:null},h=[]);let E=h.length>0?[...e.allNodes()].filter(p=>h.includes(p.kind)).sort(wt):[],S=E.filter(b).filter(m),w=E.length-S.length,x=n.focusId&&h.length===0?e.getNode(n.focusId):void 0,A=n.zoom===!0&&!n.overview&&n.focusId!==null,O=Math.max(56,r.height*.062),T=Math.min(r.height*.895,r.height-O),$=A?x!==void 0?{focusY:r.height*.03,focusH:r.height*.58,relationY:r.height*.645,relationH:r.height*.2,contextY:T,contextH:O}:{focusY:r.height*.03,focusH:r.height*.71,relationY:r.height*.765,relationH:r.height*.1,contextY:T,contextH:O}:x===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 p=r.height,G=p*.04,X=Math.max(p*.42,Math.min(p*.56,300)),ce=G+X+p*.06;return{focusY:G,focusH:X,relationY:ce,relationH:Math.max(p*.12,p*.878-p*.068-ce),contextY:p*.878,contextH:p*.092}})(),g=Math.min(r.headroom??0,$.focusY+$.focusH*.2),M=g>$.focusY?{...$,focusY:g,focusH:$.focusH-(g-$.focusY)}:$,L=p=>Math.min(r.gap*p,Math.round(l*.1)),C=A?Math.min(880,l-L(5)):Math.min(700,l-L(6)),V=A?l-L(5):Math.min(r.focusSize.width,l-L(6)),q=(p,G,X)=>({width:p===0?G:Math.min(G,(l-r.gap*(p+1))/p),height:X}),ie=(p,G,X)=>{let ce=q(p,G,X),Ee=Math.min(G,co*i,l-r.gap*2);return ce.width>=Ee?ce:{width:Ee,height:X}},I=p=>Math.max(1,Math.floor((l-r.gap)/(Math.min(p,co*i,l-r.gap*2)+r.gap))),D=new Set(n.expanded),N=n.overview?[]:Di(e,t,x,n.relation,r.judged).filter(p=>b(p.node)).filter(p=>m(p.node)),Q=n.overview?0:Math.max(0,Fi*i-M.contextH),P=N.length>0?M.focusH:M.contextY-M.focusY-r.gap*2-Q,j=V,z=r.height,re=Math.min(l*.5/j,r.height*.48/z),v=j*re,R=z*re,k=new Set(o.plainGroups??[]),H=n.overview&&!x&&h.length>0&&n.focusId!==null,F=H&&h.length>0&&h.every(p=>k.has(p));if(H)for(let p of h)F&&o.besideTheMap!==!0?D.add(Re(p)):D.delete(Re(p));let W=H&&!F&&h.length===1?h[0]:void 0,Y=W!==void 0&&(o.screens?.[W]?.length??0)>0,_,Z=n.overview===!0&&x!==void 0&&o.besideTheMap===!0;n.overview&&(x||h.length>0)&&n.focusId&&!F&&!Y&&!(H&&o.besideTheMap===!0)&&!Z?(_={x:s+(l-v)/2,y:r.height*.53-R/2,width:v,height:R},St({id:n.focusId,kind:x?x.kind:h[0],plane:0,x:_.x,y:_.y,width:v,height:R,natural:{width:j,height:z},...x?{}:{aggregate:{kind:h.join("+"),memberIds:S.map(p=>p.id),label:o.plurals?.[n.focusId]??h.map(p=>$t(t,p)).join(" and "),...w>0?{retired:w}:{}}}})):n.overview||(x?St({id:x.id,kind:x.kind,plane:0,x:s+(l-C)/2,y:M.focusY,width:C,height:P}):h.length>0&&n.focusId&&St({id:n.focusId,kind:h[0],plane:0,x:s+(l-V)/2,y:M.focusY,width:V,height:P,aggregate:{kind:h.join("+"),memberIds:S.map(p=>p.id),label:o.plurals?.[n.focusId]??h.map(p=>$t(t,p)).join(" and "),...w>0?{retired:w}:{}}}));let oe=26,K=52,pe=22,ye=Math.round(r.relationSize.width*.75),ue=Math.max(1,Math.floor((l-r.gap)/(ye+r.gap))),Me=r.unit/16,De=new Map;for(let p of N){let G=to(p),X=De.get(G);X?X.push(p):De.set(G,[p])}let te=[...De.values()],J=te.length>1,se=Math.max(r.gap,pe*Me),at=J?se:r.gap,Ke=Math.max(2,Math.floor((M.relationH+at)/(oe*Me+at))),wn=Math.min(r.relationSize.width,(l-r.gap*(ue+1))/ue)+r.gap,Ze=te.map(p=>{let G=p[0].via;return!J||!G?1:Math.ceil((Math.min(cr*Me,ur(Hn(G),Me))+r.gap)/wn)}),Te=te.map(p=>p.length),Tt=un(Te,ue,Ze),Je=N.length>ue*Ke||Tt.length>Ke,It={schema:t,graph:e,focusId:x?.id,expanded:D,...r.relevance?{relevance:r.relevance}:{},...n.selection?{selection:n.selection}:{},plural:p=>$t(t,p),...r.today?{today:r.today}:{}},Ue=Je||J?se:r.gap,Le,Ie;if(!Je)Le=te.flat().map(p=>({id:p.node.id,kind:p.node.kind,node:p.node,...p.via?{via:p.via}:{}})),Ie=Tt;else{let p=Math.max(1,Math.floor((M.relationH+Ue)/(K*Me+Ue))),X=un(Te.map(()=>1),ue,Ze).length<=p?Ze:[],ce=no(Te,ue,p,X),Ee=te.map((we,Ce)=>ro(we,{...It,budget:ce[Ce]}));Le=Ee.flat(),Ie=un(Ee.map(we=>we.length),ue,X)}let st=Ie.length,ne=st===1?M.relationH:(M.relationH-Ue*(st-1))/st,et=q(Math.max(...Ie.map(p=>p.reduce((G,X)=>G+X.slots,0)),1),Le.length<=2?Math.round(r.relationSize.width*1.35):r.relationSize.width,ne),pt=[];{let p=et.width+r.gap,G=[],X=0,ce=new Map;for(let we of Ie.flat())ce.set(we.run,(ce.get(we.run)??0)+we.cards);for(let we=0;we<te.length;we++)G[we]=X,X+=ce.get(we)??0;let Ee=te.map(()=>0);Ie.forEach((we,Ce)=>{let yt=we.reduce((Mt,Pr)=>Mt+Pr.slots,0),qn=yt*et.width+Math.max(0,yt-1)*r.gap,Qn=s+Math.max(r.gap,(l-qn)/2),Ss=M.relationY+Ce*(ne+Ue);for(let Mt of we){let Pr=Mt.slots*p-r.gap,Ms=Mt.cards*p-r.gap,Es=Qn+(Pr-Ms)/2;for(let Lr=0;Lr<Mt.cards;Lr++)pt[G[Mt.run]+Ee[Mt.run]++]={x:Es+Lr*p,y:Ss};Qn+=Mt.slots*p}})}Le.forEach((p,G)=>{let X=pt[G];St({id:p.id,kind:p.kind,plane:1,x:X.x,y:X.y,width:et.width,height:et.height,...p.via?{via:p.via}:{},...p.aggregate?{aggregate:p.aggregate}:{},...Je&&!p.aggregate?{compact:!0}:{}})});let bn=new Set(u.keys());for(let p of S)bn.add(p.id);let xt=new Map;for(let p of e.allNodes()){let G=xt.get(p.kind);G?G.push(p):xt.set(p.kind,[p])}let le=new Set(h.length>0?h:x?[x.kind]:[]),Ae=[];for(let p of t.kinds){if(f.has(p))continue;let G=xt.get(p)??[],X=G.filter(m);Ae.push({id:Re(p),kind:p,members:X.sort(wt),retired:G.length-X.length,...le.has(p)?{focused:!0}:{}})}for(let p of Ae)p.kind===n.relation&&(p.raised=!0);Ae.sort(wt);let dt=Bi(t,le),Nt=!n.overview&&t.kinds.some(p=>dt.rankOf(p)==="primary"),$e=[];for(let p of Ae)if(!n.overview&&D.has(p.id)&&p.members.length>0)for(let G of p.members)$e.push({id:G.id,kind:G.kind});else{let G=Nt?dt.rankOf(p.kind):void 0,X=G==="secondary"?dt.parentOf(p.kind):void 0;$e.push({id:p.id,kind:p.kind,...p.raised?{raised:!0}:{},...p.focused?{focused:!0}:{},...n.overview&&D.has(p.id)?{opened:!0}:{},...G?{rank:G}:{},...X&&!D.has(Re(X))?{nestedUnder:Re(X)}:{},aggregate:{kind:p.kind,memberIds:p.members.map(ce=>ce.id),label:o.plurals?.[p.kind]??$t(t,p.kind),...p.retired>0?{retired:p.retired}:{}}})}let tt=2;if($e.length<=I((A?240:r.contextSize.width)*i))for(let p of $e)delete p.nestedUnder;let xn=new Map;for(let p of $e){if(p.nestedUnder===void 0)continue;let G=xn.get(p.nestedUnder)??0;G>=tt?delete p.nestedUnder:xn.set(p.nestedUnder,G+1)}let zn=$e.filter(p=>p.nestedUnder!==void 0),vt=$e.filter(p=>p.nestedUnder===void 0),vn=I((A?240:r.contextSize.width)*i),kn=!n.overview&&vt.length>vn,Yn=Math.max(0,vn-1),gt=p=>p.focused?0:p.raised?1:2,kt=new Set([...vt].map((p,G)=>({item:p,at:G})).sort((p,G)=>gt(p.item)-gt(G.item)||p.at-G.at).slice(0,Yn).map(({item:p})=>p.id)),Qt=new Set(kn?vt.filter(p=>!kt.has(p.id)).map(p=>p.id):[]),_n=zn.filter(p=>!Qt.has(p.nestedUnder)),Kn=zn.filter(p=>Qt.has(p.nestedUnder)),Ht=kn?[...vt.filter(p=>kt.has(p.id)),{id:_o,kind:"",beyond:[...vt.filter(p=>Qt.has(p.id)),...Kn].map(p=>p.kind)}]:vt,lt=n.overview?{width:Math.min(220,l/6.5),height:Math.min(92,r.height*.125)}:ie(Ht.length,(A?240:r.contextSize.width)*i,M.contextH),Sn=r.relevance?.flagged,nt=(p,G)=>{let X=Zr(t,p);if(!X)return{};let ce=X.values.map(()=>0),Ee=0;for(let we of G){let Ce=X.values.indexOf(e.getNode(we)?.[X.field]);Ce<0?Ee++:ce[Ce]++}return{states:{field:X.field,values:[...X.values.map((we,Ce)=>({value:we,tier:X.tiers[Ce],count:ce[Ce]})),...Ee>0?[{value:null,tier:"waiting",count:Ee}]:[]]}}},Mn=[...n.selection??[],...n.focusId?[n.focusId]:[]].flatMap(p=>p.startsWith("kind:")?[p.slice(5)]:p.startsWith("aggregate:")&&!p.includes("|")?[p.slice(10)]:Z&&p===x?.id?[x.kind]:[]),Zt=c>0&&d===0&&Mn.length>0,Xe=n.overview?so(Ht.map(p=>{let G=p.aggregate?.memberIds??[],X=Sn?G.filter(ce=>Sn.has(ce)).length:0;return{id:p.id,kind:p.kind,count:G.length,opened:D.has(p.id)?dn(sn(G.length))*i:0,openedMin:D.has(p.id)?dn(Math.min(qr,sn(G.length)))*i:0,nameplate:Hi(p.aggregate?.label??$t(t,p.kind),G.length,X,Zr(t,p.kind)!==void 0,i),weight:X*1e3+G.length,...h.includes(p.kind)&&(o.screens?.[p.kind]?.length??0)>0?{marquee:{width:Kr+12,height:Ur(o.screens[p.kind].map(ce=>ce.title),Kr,o.nameWidth)+8}}:{}}}),t,{width:r.width-d,height:Zt?r.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:Mn,...Zt?{seen:{width:r.width-d,height:r.height-c}}:{},...o.tilt!==void 0?{tilt:o.tilt}:{},pan:{x:n.pan?.x??0,y:n.pan?.y??0},..._||r.chrome?.length?{avoid:[..._?[_]:[],...(r.chrome??[]).filter(p=>!(Zt&&p.onSheet))]}:{}}):null,Un=new Map(Xe?.placed.map(p=>[p.id,p.plot])??[]),Jt=new Map(Xe?.placed.map(p=>[p.id,p.nameplate])??[]),Bt=Xe?Xe.placed.map(({x:p,y:G,depth:X,width:ce,height:Ee})=>({x:p,y:G,depth:X,width:ce,height:Ee})):Ns(Ht.length,lt,r.gap,l,M.contextY,A?.97:Wi).map(p=>({...p,x:p.x+s})),B=.74,he=.8,be=52*i,Se=86*i,Ne=(p,G)=>Math.min(1,p+(1-p)*G),Ge=new Map;Ht.forEach((p,G)=>{let X=Bt[G],ce=X.width??lt.width,Ee=X.height??lt.height,we=p.rank==="secondary"?B:1,Ce=Xe?ce:Math.max(Math.min(ce,co*i),ce*we),yt=Xe?Ee:Math.max(Fi*i,Ee*we);Ge.set(p.id,{x:X.x+(ce-Ce)/2,y:X.y+(Ee-yt),depth:p.rank==="secondary"?Ne(X.depth,.5):X.depth,width:Ce,height:yt})});let qe=[],Dt=Bt[Bt.length-1],En=new Map;for(let p of _n)En.set(p.nestedUnder,(En.get(p.nestedUnder)??0)+1);let Xn=new Map;for(let p of _n){let G=Ge.get(p.nestedUnder);if(G){let X=En.get(p.nestedUnder)??1,ce=Xn.get(p.nestedUnder)??0;Xn.set(p.nestedUnder,ce+1);let Ee=.98,we=lt.width*he,Ce=Math.max(Se,Math.min(we,G.width/(Ee*(X-1)+1))),yt=Math.max(be,lt.height*he*(Ce/we)),qn=Ce*Ee,Qn=(X-1)*qn+Ce;qe.push({...p,x:G.x+(G.width-Qn)/2+ce*qn,y:Math.max(0,G.y-yt+Math.min(yt*.5,16)),width:Ce,height:yt,depth:Ne(G.depth,.8)})}else if(Dt){let X=lt.width*he,ce=lt.height*he;qe.push({...p,x:Dt.x,y:Dt.y,width:X,height:ce,depth:Ne(Dt.depth??1,.8)})}}for(let p of Ht)qe.push({...p,...Ge.get(p.id)});return qe.forEach(p=>{St({id:p.id,kind:p.kind,plane:2,x:p.x,y:p.y,width:p.width,height:p.height,...p.aggregate?{aggregate:p.aggregate}:{},...p.raised?{raised:!0}:{},...p.focused?{focused:!0}:{},...p.opened?{opened:!0}:{},...p.opened?{openedRows:Math.max(1,Math.floor((Math.max(dn(Math.min(qr,sn(p.aggregate?.memberIds.length??0))),dn(sn(p.aggregate?.memberIds.length??0))*(Xe?.frame.openedShare??1))-fi)/Xr))}:{},...p.rank?{rank:p.rank}:{},...p.nestedUnder?{nestedUnder:p.nestedUnder}:{},...p.beyond?{beyond:p.beyond}:{},...Un.has(p.id)?{plot:Un.get(p.id)}:{},...Jt.has(p.id)?{nameplate:Jt.get(p.id)}:{},...Xe&&p.aggregate?nt(p.kind,p.aggregate.memberIds):{},depth:p.depth})}),{nodes:a,connectors:$i(e,u,n),width:r.width,height:r.height,...Xe?{city:Xe.frame}:{},...n.pan&&(n.pan.x!==0||n.pan.y!==0)?{pan:{x:n.pan.x,y:n.pan.y}}:{},...d>0||c>0?{visible:{width:r.width-d,height:r.height-c}}:{}};function St(p){let G=n.overview&&He(p.id)!==null?void 0:n.pins[p.id],X=G?{...p,x:G.x,y:G.y,pinned:!0}:{...p,pinned:!1},ce=n.pan?{...X,x:X.x+n.pan.x,y:X.y+n.pan.y}:X;a.push(ce),u.set(ce.id,ce)}}function uo(e,t,n){let o=e.nodes.find(d=>d.id===t);if(!o||o.screenOf!==void 0)return null;let r={...o,x:n.x,y:n.y,pinned:!0},i=r.x+r.width/2,s=r.y+r.height/2;return{...e,nodes:e.nodes.map(d=>d.id===t?r:d),connectors:e.connectors.map(d=>d.from===t?{...d,x1:i,y1:s}:d.to===t?{...d,x2:i,y2:s}:d)}}function ho(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 ve=(e,t,n)=>e+(t-e)*n;function ji(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}var Vi=new WeakMap;function Hs(e){let t=Vi.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 i of r.aggregate?.memberIds??[]){let s=o.get(i);s?s.push(r):o.set(i,[r])}}return t={byId:n,groupsOf:o},Vi.set(e,t),t}var Gi=new WeakMap;function zi(e,t){let n=Gi.get(t);if(n||Gi.set(t,n=new WeakMap),n.has(e))return n.get(e);let o=Bs(e,t);return n.set(e,o),o}function Bs(e,t){let{byId:n,groupsOf:o}=Hs(t);if(e.screenOf!==void 0){let s=n.get(Re(e.screenOf));if(s)return{...e,x:s.x,y:s.y,width:s.width,height:s.height}}if(Wt(e.id)||He(e.id)!==null){let s=(e.aggregate?.memberIds??[]).map(a=>n.get(a)).filter(a=>a!==void 0);if(s.length===0)return null;let d=s.map(ji),c=d.reduce((a,u)=>a+u.x,0)/d.length,l=d.reduce((a,u)=>a+u.y,0)/d.length;return{...e,x:c-e.width/2,y:l-e.height/2}}let r=o.get(e.id)?.find(s=>s.id===Re(e.kind)||s.id===Be(e.kind));if(!r)return null;let i=ji(r);return{...e,x:i.x-e.width/2,y:i.y-e.height/2}}function ut(e,t,n){let o=Math.max(0,Math.min(1,n)),r=new Map(e.nodes.map(a=>[a.id,a])),i=new Map(t.nodes.map(a=>[a.id,a])),s=[];for(let[a,u]of r){let m=i.get(a);if(m){s.push(fo(u,m,o,1));continue}let f=zi(u,t)??u;s.push(fo(u,f,o,1-o))}for(let[a,u]of i){if(r.has(a))continue;let m=zi(u,e)??u;s.push(fo(m,u,o,o))}let d=new Map(e.connectors.map(a=>[a.id,a])),c=new Map(t.connectors.map(a=>[a.id,a])),l=[];for(let[a,u]of d){let m=c.get(a);l.push(m?{...Ds(u,m,o),opacity:1}:{...u,opacity:1-o})}for(let[a,u]of c)d.has(a)||l.push({...u,opacity:o});return{nodes:s.filter(a=>a.opacity>0).sort((a,u)=>a.id<u.id?-1:a.id>u.id?1:0),connectors:l.filter(a=>a.opacity>0).sort((a,u)=>a.id<u.id?-1:a.id>u.id?1:0),width:ve(e.width,t.width,o),height:ve(e.height,t.height,o),t:o,...Yi(e.city,t.city,o)?{city:Yi(e.city,t.city,o)}:{},...e.pan||t.pan?{pan:{x:ve(e.pan?.x??0,t.pan?.x??0,o),y:ve(e.pan?.y??0,t.pan?.y??0,o)}}:{}}}function Yi(e,t,n){return e?t?{cell:ve(e.cell,t.cell,n),...e.tilt!==void 0||t.tilt!==void 0?{tilt:ve(e.tilt??.5,t.tilt??.5,n)}:{},originX:ve(e.originX,t.originX,n),originY:ve(e.originY,t.originY,n),pan:{x:ve(e.pan.x,t.pan.x,n),y:ve(e.pan.y,t.pan.y,n)},extent:{x:ve(e.extent.x,t.extent.x,n),y:ve(e.extent.y,t.extent.y,n),width:ve(e.extent.width,t.extent.width,n),height:ve(e.extent.height,t.extent.height,n)}}:e:t}function fo(e,t,n,o){return{id:t.id,kind:t.kind,plane:ve(e.plane,t.plane,n),x:ve(e.x,t.x,n),y:ve(e.y,t.y,n),width:ve(e.width,t.width,n),height:ve(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:ve(e.depth??1,t.depth,n)},...t.natural?{natural:t.natural}:{}}}function Ds(e,t,n){return{...t,x1:ve(e.x1,t.x1,n),y1:ve(e.y1,t.y1,n),x2:ve(e.x2,t.x2,n),y2:ve(e.y2,t.y2,n)}}function pr(e){let t=Math.max(0,Math.min(1,e));return t<.5?4*t*t*t:1-(-2*t+2)**3/2}function $s(e,t){let n=[];for(let r=0;r<e.length;r+=1){let i=e[r],s=e[(r+1)%e.length];if(i.y===s.y)continue;let d=Math.min(i.y,s.y),c=Math.max(i.y,s.y);t<d||t>=c||n.push(i.x+(t-i.y)/(s.y-i.y)*(s.x-i.x))}n.sort((r,i)=>r-i);let o={x0:0,x1:0};for(let r=0;r+1<n.length;r+=2){let i={x0:n[r],x1:n[r+1]};i.x1-i.x0>o.x1-o.x0&&(o=i)}return o}function Fs(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 Ws(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 js(e){let t=0,n=0,o=0;for(let r=0;r<e.length;r+=1){let i=e[r],s=e[(r+1)%e.length],d=i.x*s.y-s.x*i.y;t+=d,n+=(i.x+s.x)*d,o+=(i.y+s.y)*d}if(Math.abs(t)<1e-9){let r=e.reduce((i,s)=>({x:i.x+s.x,y:i.y+s.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 Vs(e,t){let{room:n,height:o,size:r,floor:i,measure:s=_r,lines:d=2}=t,c=(h,y)=>h.every(E=>s(E,y)<=n)&&h.length*y*1.15<=o;if(c([e],r))return{lines:[e],fontSize:r,whole:!0};let l=e.split(/\s+/);if(d>1&&l.length>1){let h=1,y=1/0,E=0;for(let w=0;w<l.length-1;w+=1){E+=l[w].length+1;let x=Math.abs(E-e.length/2);x<y&&(y=x,h=w+1)}let S=[l.slice(0,h).join(" "),l.slice(h).join(" ")];if(c(S,r))return{lines:S,fontSize:r,whole:!0};for(let w=r;w>=i;w-=r*.06)if(c(S,w))return{lines:S,fontSize:w,whole:!0}}for(let h=r;h>=i;h-=r*.06)if(c([e],h))return{lines:[e],fontSize:h,whole:!0};let a=s(e,i)/Math.max(1,e.length),u=Math.floor(n/a)-1;if(u<4||i*1.15>o)return null;let m=e.slice(0,u),f=m.lastIndexOf(" ");return{lines:[`${f>3?m.slice(0,f):m}\u2026`],fontSize:i,whole:!1}}var Gs=(e,t)=>e.x0<t.x1&&t.x0<e.x1&&e.y0<t.y1&&t.y0<e.y1;var U=ae(Pe(),1);var mo=ae(Pe(),1),zs=500,Ys=10;function _i(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 _s(e){let t=typeof getSelection=="function"?getSelection():null;return t!==null&&!t.isCollapsed&&t.containsNode(e,!0)}function Ks(e){return e.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??e.closest("[data-graview-view]")?.getAttribute("data-graview-view")??void 0}function Ki({swallow:e,setMenuAt:t,setSelection:n}){let o=(0,mo.useRef)(0),r=(0,mo.useRef)(null),i=()=>{r.current&&clearTimeout(r.current.timer),r.current=null},s=(d,c,l)=>{let a=Ks(d);a&&n([a]),t(a?{x:c,y:l,on:a}:{x:c,y:l})};return{onContextMenu:d=>{let c=d.target;d.shiftKey||d.altKey||_i(c)||_s(c)||(d.preventDefault(),!c.closest("[data-graview-popover], [data-graview-offstage]")&&(Date.now()-o.current<700||s(c,d.clientX,d.clientY)))},onPointerDown:d=>{if(i(),d.pointerType==="mouse"||!d.isPrimary)return;let c=d.target;if(_i(c)||c.closest("[data-graview-popover], [data-graview-offstage], button, a, input, select, textarea"))return;let{clientX:l,clientY:a}=d;r.current={x:l,y:a,timer:setTimeout(()=>{r.current=null,o.current=Date.now(),e.current=!0,setTimeout(()=>e.current=!1,700),s(c,l,a)},zs)}},onPointerMove:d=>{let c=r.current;c&&Math.hypot(d.clientX-c.x,d.clientY-c.y)>Ys&&i()},onPointerUp:i}}var Pt=ae(Pe(),1);function Ui(e){let[t,n]=(0,Pt.useState)(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(e).matches);return(0,Pt.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 Us(){let e=()=>typeof document>"u"?null:document.documentElement.getAttribute("data-graview-motion"),[t,n]=(0,Pt.useState)(e);return(0,Pt.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 Xi(e){let t=Ui("(prefers-reduced-motion: reduce)"),n=Ui("(prefers-reduced-transparency: reduce)"),o=Us();return si({off:!e,reducedMotion:o==="reduce"||o!=="full"&&t,reducedTransparency:n})}var Xs=ri*1.5,qs=30;function qi(e,t){let[n,o]=(0,Pt.useState)(!1),r=e&&!n;return(0,Pt.useEffect)(()=>{if(!r||!t||typeof requestAnimationFrame>"u")return;let i=[],s=0,d=0,c=l=>{if(s>0&&i.push(l-s),s=l,i.length>=qs){if(!di(i,Xs)){o(!0);return}i.length=0}d=requestAnimationFrame(c)};return d=requestAnimationFrame(c),()=>cancelAnimationFrame(d)},[r,t]),r}var je=ae(Pe(),1);var Qs=520;function Zs(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Qi(e,t={}){let n=t.duration??Qs,o=(t.enabled??!0)&&!Zs(),r=t.settle??!0,i=(0,je.useRef)(e),[,s]=(0,je.useState)(()=>ut(e,e,1)),d=(0,je.useRef)(null);d.current??=ut(e,e,1);let c=(0,je.useRef)(null),l=(0,je.useRef)(null);!o&&l.current!==e&&(l.current=e,d.current=ut(e,e,1)),o&&(l.current=null);let a=(0,je.useRef)(null);return(0,je.useEffect)(()=>{if(!o||typeof requestAnimationFrame>"u"){if(i.current=e,l.current!==e){let S=ut(e,e,1);d.current=S,s(S)}if(typeof requestAnimationFrame>"u"||!r)return;let E=requestAnimationFrame(()=>{let S=ut(e,e,1);d.current=S,s(S)});return()=>cancelAnimationFrame(E)}if(i.current===e&&d.current.t>=1){if(!r)return;let E=requestAnimationFrame(()=>{let S=ut(e,e,1);d.current=S,s(S)});return()=>cancelAnimationFrame(E)}let u=performance.now(),f=a.current!==null&&d.current.t<1&&u-a.current<n?a.current:u;a.current=f;let b=pr(Math.min(1,(u-f)/n)),h=i.current,y=E=>{let S=Math.min(1,(E-f)/n),w=b>=1?1:(pr(S)-b)/(1-b),x=ut(h,e,Math.max(0,w));d.current=x,s(x),S<1?c.current=requestAnimationFrame(y):(a.current=null,i.current=e,c.current=requestAnimationFrame(()=>{let A=ut(e,e,1);d.current=A,s(A),c.current=null}))};return c.current=requestAnimationFrame(y),()=>{c.current!==null&&cancelAnimationFrame(c.current);let E=d.current;i.current={...e,...E.city?{city:E.city}:{},pan:E.pan??{x:0,y:0},nodes:E.nodes.map(S=>({...S,plane:Math.round(S.plane)})),connectors:E.connectors}}},[e,n,o,r]),d.current}function Zi(e=1100){let{store:t}=xe(),[n,o]=(0,je.useState)(()=>new Set);return(0,je.useEffect)(()=>{let r=null,i=t.subscribe(s=>{o(new Set(s.touched)),r&&clearTimeout(r),r=setTimeout(()=>o(new Set),e)});return()=>{i(),r&&clearTimeout(r)}},[t,e]),n}var Js={marks:new Map,acts:[]};function Ji(e=4e3){let{store:t}=xe(),[n,o]=(0,je.useState)(Js);return(0,je.useEffect)(()=>{let r=null,i=t.subscribe((s,d)=>{o(c=>{let l=new Map(c.marks),a=[...c.acts];for(let u of d){if(u.undoes!==void 0){let b=a.find(y=>y.batch===u.undoes||y.wrote.length>0),h=a.filter(y=>u.writes.some(E=>y.wrote.includes(E)));for(let y of h.length>0?h:b?[b]:[]){for(let E of y.wrote)l.delete(E);a=a.filter(E=>E.batch!==y.batch)}continue}if(u.author.kind!=="agent")continue;let m=u.author.id??"the seat";for(let b of u.writes)l.set(b,m);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:m,intent:u.batchIntent??u.intent,at:u.at,wrote:[...u.writes]},...a].slice(0,12)}return l.size===c.marks.size&&a===c.acts&&l.size===0?c:{marks:l,acts:a}}),r&&clearTimeout(r),r=setTimeout(()=>o(c=>c.marks.size===0?c:{...c,marks:new Map}),e)});return()=>{i(),r&&clearTimeout(r)}},[t,e]),n}var Ut=ae(Oe(),1),rt=16;function ea({marks:e,questions:t=[],whereIs:n,stageRef:o,width:r,height:i}){if(e.size===0&&t.length===0)return null;let s=o.current,d=s?.getBoundingClientRect()??null,c=[];for(let[a,u]of e){let m=null;if(s&&d&&typeof CSS<"u"){let y=s.querySelector(`[data-graview-pick="${CSS.escape(a)}"]`)?.getBoundingClientRect();y&&y.width>0&&y.height>0&&(m={x:y.left-d.left,y:y.top-d.top,width:y.width,height:y.height})}if(m??=n(a),!m)continue;let f=Math.min(Math.max(m.x+m.width-rt/2,rt/2),r-rt/2),b=Math.min(Math.max(m.y-rt/4,rt/2),i-rt/2);c.push({id:a,who:u,x:f,y:b})}let l=[];for(let a of t){let u=n(a.id);u&&l.push({...a,x:Math.min(Math.max(u.x+u.width/2,rt),r-rt),y:Math.min(Math.max(u.y-rt/2,rt),i-rt)})}return c.length===0&&l.length===0?null:(0,Ut.jsxs)("div",{className:"graview-seat-marks","data-testid":"seat-marks","data-graview-seat-marks":c.length,children:[c.map(({id:a,who:u,x:m,y:f})=>(0,Ut.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:m,top:f,"--graview-hue":Rn(u)},children:"\u25C6"},a)),l.map(a=>(0,Ut.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,Ut.jsx)("span",{"aria-hidden":"true",children:"?"}),(0,Ut.jsx)("span",{className:"graview-seat-asking-said",children:a.asks})]},`asking:${a.id}`))]})}var ee=ae(Oe(),1);function ed({hue:e,mode:t}){let n=t==="docked";return(0,ee.jsxs)("svg",{viewBox:"0 0 32 38","aria-hidden":"true",children:[(0,ee.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round",strokeLinecap:"round",children:[(0,ee.jsx)("line",{x1:"16",y1:"3.5",x2:"16",y2:"7"}),(0,ee.jsx)("circle",{cx:"16",cy:"2.6",r:"1.5",fill:"none"}),(0,ee.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,ee.jsx)("line",{x1:"11",y1:"12.5",x2:"21",y2:"12.5",strokeWidth:"2"}):(0,ee.jsxs)(ee.Fragment,{children:[(0,ee.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,ee.jsx)("circle",{cx:"13.4",cy:"12.5",r:"1.25",fill:"currentColor",stroke:"none",opacity:n?.45:1}),(0,ee.jsx)("circle",{cx:"18.6",cy:"12.5",r:"1.25",fill:"currentColor",stroke:"none",opacity:n?.45:1}),t==="reading"?(0,ee.jsx)("line",{x1:"10.2",y1:"12.5",x2:"21.8",y2:"12.5",strokeWidth:"0.8",opacity:"0.7"}):null]}),(0,ee.jsx)("line",{x1:"16",y1:"16",x2:"16",y2:"18.5"}),(0,ee.jsx)("polygon",{points:"16,18.5 24,22.5 16,26.5 8,22.5",fill:"currentColor",fillOpacity:"0.22"}),(0,ee.jsx)("polygon",{points:"8,22.5 16,26.5 16,33.5 8,29.5",fill:"currentColor",fillOpacity:"0.08"}),(0,ee.jsx)("polygon",{points:"24,22.5 16,26.5 16,33.5 24,29.5",fill:"currentColor",fillOpacity:"0.3"}),t==="writing"?(0,ee.jsxs)(ee.Fragment,{children:[(0,ee.jsx)("polyline",{points:"24,24 28.5,20.5"}),(0,ee.jsx)("line",{x1:"27.5",y1:"19",x2:"30",y2:"21.5",strokeWidth:"1.8"})]}):(0,ee.jsx)("line",{x1:"24",y1:"24",x2:"26.5",y2:"29"}),(0,ee.jsx)("line",{x1:"8",y1:"24",x2:"5.5",y2:"29"}),(0,ee.jsx)("path",{d:"M9.5 33.5 v2.2 h4"}),(0,ee.jsx)("path",{d:"M22.5 33.5 v2.2 h-4"})]}),(0,ee.jsx)("title",{children:`robot, ${t}`})]})}function td({hue:e}){return(0,ee.jsxs)("svg",{viewBox:"0 0 22 24","aria-hidden":"true",style:{color:`hsl(${Math.round(e)} 50% 48%)`},children:[(0,ee.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round",strokeLinecap:"round",children:[(0,ee.jsx)("circle",{cx:"11",cy:"6",r:"4.2"}),(0,ee.jsx)("path",{d:"M3 23 C3 15.5 6 13 11 13 C16 13 19 15.5 19 23"})]}),(0,ee.jsx)("title",{children:"somebody"})]})}function ta({width:e,whereIs:t}){let{who:n,following:o,follow:r}=xe(),i=gi([...n.values()],t,e);if(i.length===0)return null;let s=h=>{let y=er(h.presence)||"somebody";return h.presence.kind==="agent"?y:`${y}'s agent`},d=new Map;for(let h of i){if(h.kind!=="robot")continue;let y=`${Math.round(h.point.x)}:${Math.round(h.point.y)}`;d.set(y,[...d.get(y)??[],s(h)])}let c=19,l=h=>h.length*9+4,a=[],u=new Map,m=new Set;for(let h of i){if(h.kind!=="robot"&&h.kind!=="person")continue;let y=`${Math.round(h.point.x)}:${Math.round(h.point.y)}`;if(h.kind==="robot"&&m.has(y))continue;h.kind==="robot"&&m.add(y);let E=h.kind==="robot"?[...new Set(d.get(y)??[])].join(" \xB7 "):er(h.presence)||"somebody",S=l(E)/2,w=0;for(;a.some(x=>x.row===w&&Math.abs(x.y-h.point.y)<c&&x.left<h.point.x+S&&x.right>h.point.x-S);)w++;a.push({left:h.point.x-S,right:h.point.x+S,y:h.point.y,row:w}),u.set(`${h.kind}:${h.presence.participant}`,w)}let f=h=>{let y=u.get(h)??0;return y>0?{top:2+y*c}:void 0},b=new Set;return(0,ee.jsx)("div",{className:"graview-occupants","data-testid":"occupants","data-graview-occupants":i.length,children:i.map((h,y)=>{if(h.kind==="over")return(0,ee.jsx)("div",{className:"graview-presence-over","data-testid":"presence-over","data-graview-over-by":h.presence.participant,style:{left:h.box.x-3,top:h.box.y-3,width:h.box.width+6,height:h.box.height+6,"--graview-hue":h.presence.hue}},`over:${h.presence.participant}`);if(h.kind==="count")return(0,ee.jsxs)("span",{className:"graview-figure-count","data-testid":"presence-count","data-graview-at":h.at,style:{left:h.point.x,top:h.point.y},title:`${h.n} more here`,children:["+",h.n]},`count:${h.at}:${y}`);let E=h.presence.hue,S=er(h.presence)||"somebody";if(h.kind==="edge")return(0,ee.jsxs)("button",{type:"button",className:"graview-figure-edge","data-testid":"presence-edge","data-graview-person":h.presence.participant,style:{right:`calc(${Math.max(8,e-h.point.x)}px + var(--graview-dock, 0px))`,top:h.point.y},onClick:()=>r(h.presence.participant),"aria-label":`${S} is somewhere else \u2014 press to go where they are`,children:["\u2192 ",S]},`edge:${h.presence.participant}`);if(h.kind==="robot"){let x=`${Math.round(h.point.x)}:${Math.round(h.point.y)}`;if(b.has(x))return null;b.add(x);let A=[...new Set(d.get(x)??[s(h)])].join(" \xB7 ");return(0,ee.jsxs)("div",{className:"graview-figure","data-graview-figure":`theirs:${h.presence.participant}`,"data-graview-theirs":"","data-graview-mode":h.mode,"data-graview-at":h.presence.robot?.at??"",style:{transform:`translate(${h.point.x.toFixed(1)}px, ${h.point.y.toFixed(1)}px)`,"--graview-hue":E},children:[(0,ee.jsx)("span",{className:"graview-figure-body",role:"img","aria-label":`${A} \u2014 ${h.mode}`,style:{cursor:"default"},children:(0,ee.jsx)(ed,{hue:E,mode:h.mode})}),(0,ee.jsx)("span",{className:"graview-figure-name","data-graview-label":"",style:f(`robot:${h.presence.participant}`),children:A})]},`robot:${h.presence.participant}`)}let w=o?.participant===h.presence.participant;return(0,ee.jsxs)("div",{className:"graview-figure","data-graview-figure":h.presence.participant,"data-graview-person":"","data-graview-at":h.at,"data-graview-audience":h.audience?"":void 0,"data-graview-followed":w?"":void 0,style:{transform:`translate(${h.point.x.toFixed(1)}px, ${h.point.y.toFixed(1)}px)`,"--graview-hue":E},children:[(0,ee.jsx)("button",{type:"button",className:"graview-figure-body","aria-label":`${S} is here${w?". Press to stop following":". Press to go where they go"}`,"aria-pressed":w,onClick:x=>{x.stopPropagation(),r(w?null:h.presence.participant)},onPointerDown:x=>x.stopPropagation(),children:(0,ee.jsx)(td,{hue:E})}),(0,ee.jsx)("span",{className:"graview-figure-name",style:f(`person:${h.presence.participant}`),children:S})]},`person:${h.presence.participant}`)})})}var fn=ae(Pe(),1),Fn=ae(Oe(),1),na={left:"\u2190",right:"\u2192",top:"\u2191",bottom:"\u2193"},po=36,nd=140,$n=56;function ra({result:e,schema:t,chrome:n=[],onGo:o}){let r=lo(e);if(r.length===0||(e.visible??e).height<nd)return null;let i=a=>(a??[]).flatMap(u=>{let m=e.nodes.find(f=>f.id===u.id);return m?[{left:m.x+u.x,top:m.y+u.y,right:m.x+u.x+u.width,bottom:m.y+u.y+u.height}]:[]}),s=i(e.city?.showings),d=i(e.city?.nameplates),c=[...s,...d,...n.map(a=>({left:a.x,top:a.y,right:a.x+a.width,bottom:a.y+a.height}))],l=[];for(let a of["left","right","top","bottom"]){let u=e.visible??e,m=a==="left"||a==="right"?u.height:u.width,f=a==="left"||a==="right",b=a==="bottom"?id:a==="top"?$n:ad+$n/2,h=-1/0,y=[],E=r.filter(S=>S.side===a).sort((S,w)=>S.along-w.along);for(let S of E){let w=Jn(t,S.kind),x=rd(w),A=f?gr:x/2,O=m-b-(f?0:A),T=Math.max($n,S.along,h+A+od);if(T>O)continue;let{at:$,inset:g}=sd([...c,...y],a,T,x,u,m);if($>O+.5)continue;h=$+A,y.push(oa(a,$,x,u,g));let M=a==="left"?{left:g,top:$,transform:"translateY(-50%)"}:a==="right"?{right:`calc(${g}px + var(--graview-dock, 0px))`,top:$,transform:"translateY(-50%)"}:a==="top"?{top:g,left:$,transform:"translateX(-50%)"}:{bottom:`calc(${g}px + var(--graview-scene-foot, var(--graview-sheet, 0px)))`,left:$,transform:"translateX(-50%)"};l.push((0,Fn.jsx)("button",{type:"button",className:"graview-edge-sign","data-graview-past-edge":S.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(S.by)},style:{...dd,...M},children:a==="right"||a==="bottom"?`${w} ${na[a]}`:`${na[a]} ${w}`},S.id))}}return(0,Fn.jsx)(Fn.Fragment,{children:l})}var rd=e=>(e.length+2)*7.4+22,gr=po/2,Dn=6,od=6,id=236,ad=56;function oa(e,t,n,o,r=Dn){return e==="left"||e==="right"?{left:e==="left"?r:o.width-r-n,right:e==="left"?r+n:o.width-r,top:t-gr,bottom:t+gr}:{left:t-n/2,right:t+n/2,top:e==="top"?r:o.height-r-po,bottom:e==="top"?r+po:o.height-r}}function sd(e,t,n,o,r,i){let s=t==="left"||t==="right",d=h=>oa(t,h,o,r),c=h=>e.find(y=>{let E=d(h);return E.left<y.right&&y.left<E.right&&E.top<y.bottom&&y.top<E.bottom}),l=c(n);if(!l)return{at:n,inset:Dn};let a=s?gr:o/2,u=h=>{let y=n;for(let E=0;E<12;E++){let S=c(y);if(!S)return y;if(y=h>0?(s?S.bottom:S.right)+a+4:(s?S.top:S.left)-a-4,y>i-$n||y<$n)return null}return null},m=u(1);if(m!==null)return{at:m,inset:Dn};let f=u(-1);if(f!==null)return{at:f,inset:Dn};let b=t==="left"?l.right:t==="right"?r.width-l.left:t==="top"?l.bottom:r.height-l.top;return{at:n,inset:Math.max(Dn,b+4)}}var dd={position:"absolute",zIndex:We.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 ia(e){let[t,n]=(0,fn.useState)(null);return(0,fn.useLayoutEffect)(()=>{let o=e.current,r=null;for(let d=o?.parentElement??null,c=0;d&&!r&&c<4;d=d.parentElement,c++)r=d.querySelector(":scope > [data-graview-scene-trail]");if(!o||!r)return;let i=()=>{let d=o.getBoundingClientRect(),c=r.getBoundingClientRect(),l=c.width>0&&c.height>0?{x:c.left-d.left,y:c.top-d.top,width:c.width,height:c.height}:null;n(a=>a===l||a&&l&&a.x===l.x&&a.y===l.y&&a.width===l.width&&a.height===l.height?a:l)};if(i(),typeof ResizeObserver>"u")return;let s=new ResizeObserver(i);return s.observe(r),()=>s.disconnect()},[e]),t}function aa(e,t,n){let[o,r]=(0,fn.useState)([]);return(0,fn.useLayoutEffect)(()=>{let i=e.current;if(!i||!t)return;let s=[...i.querySelectorAll(".graview-drive-in")].flatMap(d=>{let c=d.closest("[data-graview-view]"),l=d.getBoundingClientRect();if(!c||l.width===0||l.height===0)return[];let a=c.getBoundingClientRect();return[{id:c.getAttribute("data-graview-view"),x:Math.round(l.left-a.left),y:Math.round(l.top-a.top),width:Math.round(l.width),height:Math.round(l.height)}]});r(d=>d.length===s.length&&d.every((c,l)=>c.id===s[l].id&&c.x===s[l].x&&c.y===s[l].y&&c.width===s[l].width&&c.height===s[l].height)?d:s)},[e,t,n]),o}function sa(e,t){return e.flatMap(n=>{let o=t.find(r=>r.id===n.id);return o?[{x:o.x+n.x,y:o.y+n.y,width:n.width,height:n.height}]:[]})}var Lt=ae(Pe(),1),ld=180;function da({view:e,result:t,frame:n,panned:o,closer:r,screenId:i,setCamera:s}){let d=(0,Lt.useRef)(new Map),c=Math.round((t.nodes.find(u=>u.id===i)?.height??0)/16),l=(0,Lt.useRef)(e.overview??!1),a=(0,Lt.useRef)(null);if((0,Lt.useEffect)(()=>{if(!e.overview||!i||!t.city){if(l.current&&!e.overview)return;s(O=>O.x===0&&O.y===0?O:{x:0,y:0});return}let u=t.nodes.find(O=>O.id===i);if(!u)return;let m=r>1&&u.screenOf?t.nodes.find(O=>O.id===Re(u.screenOf)):void 0,f=m?{x:Math.min(u.x,m.x),y:Math.min(u.y,m.y),width:Math.max(u.x+u.width,m.x+m.width)-Math.min(u.x,m.x),height:Math.max(u.y+u.height,m.y+m.height)-Math.min(u.y,m.y)}:u;if(f.x>=0&&f.y>=0&&f.x+f.width<=t.width&&f.y+f.height<=t.height&&!m)return;let h=24,y=(O,T,$)=>O<h?h-O:O+T>$-h?$-h-(O+T):0,E=At(t),S=e.pan??{x:0,y:0},w=m?o.x+(t.width/2-(f.x+f.width/2)):o.x+y(f.x,f.width,t.width),x=t.height/2-(f.y+f.height/2),A=m?o.y+(u.y+x<h?h-u.y:x):o.y+y(f.y,f.height,t.height);s({x:(m?w:Math.max(-E.x,Math.min(E.x,w)))-S.x,y:(m?A:Math.max(-E.y,Math.min(E.y,A)))-S.y})},[i,e.overview,r,e.within?.view,c]),n.city){let u=new Map;for(let m of n.nodes){if(!m.plot||Math.round(m.plane)!==2)continue;let f=cn(m.plot.col+m.plot.side/2,m.plot.row+m.plot.side/2,n.city.cell,n.city.tilt);u.set(m.id,{x:n.city.originX+o.x+f.x,y:n.city.originY+o.y+f.y})}d.current=u}return(0,Lt.useEffect)(()=>{let u=e.overview??!1,m=l.current&&!u;if(l.current=u,u&&a.current&&(clearTimeout(a.current),a.current=null),!m)return;let f=e.focusId?Rt(e.focusId)[0]:void 0,b=f?d.current.get(Re(f)):void 0,h=t.nodes.find(y=>y.id===e.focusId);if(!b||!h){s({x:0,y:0});return}s({x:b.x-(h.x+h.width/2),y:b.y-(h.y+h.height/2)}),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,s({x:0,y:0})},ld)},[e.overview]),(0,Lt.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),{gliding:()=>a.current!==null}}var wr=ae(Pe(),1),yr="[data-graview-view]";function cd(e,t){let n=null;for(let o=e?.closest(yr)??null;o&&t.contains(o);o=o.parentElement?.closest(yr)??null)n=o;return n}function la(e,t,n=!1){let o=e.getBoundingClientRect(),r=o.bottom-t.bottom;if(n&&t.bottom>0){let i=e.querySelector(".graview-zoom")?.getBoundingClientRect();i&&i.height>0&&i.top<r&&i.bottom>r-i.height-24&&(r=Math.min(r,i.top))}return{left:o.left,top:o.top,right:o.right-t.right,bottom:r,box:o}}function ca(e,t,n){let o=(0,wr.useRef)({dock:t,reveal:n});o.current={dock:t,reveal:n},(0,wr.useEffect)(()=>{let r=e.current;if(!r)return;let i=l=>{let{dock:a}=o.current;if(l.key!=="Tab"||l.defaultPrevented||a.right<=0&&a.bottom<=0)return;let u=la(r,a),m=[];for(let f of r.querySelectorAll(yr)){if(f.parentElement?.closest(yr)||f.inert||f.contains(document.activeElement))continue;let b=f.getBoundingClientRect(),h=Math.max(b.left,u.box.left),y=Math.min(b.right,u.box.right),E=Math.max(b.top,u.box.top),S=Math.min(b.bottom,u.box.bottom);y<=h||S<=E||!(a.right>0&&h>=u.right-1||a.bottom>0&&E>=u.bottom-1)||(f.inert=!0,m.push(f))}m.length!==0&&setTimeout(()=>{for(let f of m)f.inert=!1},0)},s=l=>{let a=l.target,u=cd(a,r);if(!u)return;let m=!0;try{m=a?.matches(":focus-visible")??!0}catch{}requestAnimationFrame(()=>{for(let f=u.parentElement;f;f=f===r?null:f.parentElement)f.scrollTop!==0&&(f.scrollTop=0),f.scrollLeft!==0&&(f.scrollLeft=0);m&&u.isConnected&&d(()=>u.isConnected&&u.contains(document.activeElement)&&c(u))})},d=(l,a=120)=>{let u=r.closest(".graview-ground")??r.querySelector(".graview-ground");!u||u.hasAttribute("data-graview-settled")||a<=0?l():requestAnimationFrame(()=>d(l,a-1))},c=l=>{let a=la(r,o.current.dock,!0),u=l.getBoundingClientRect(),m=l.querySelector(".graview-drive-in")?.getBoundingClientRect(),f=m&&m.width>0&&m.height>0?m:null,b=12,h=f?{left:Math.min(u.left,f.left),right:Math.max(u.right,f.right),top:Math.min(u.top,f.top),bottom:Math.max(u.bottom,f.bottom)}:u,y=h.bottom-h.top<=a.bottom-a.top-2*b?h:u,E=(x,A,O,T)=>T-O>A-x-2*b||O<x+b?x+b-O:T>A-b?A-b-T:0,S=E(a.left,a.right,y.left,y.right),w=E(a.top,a.bottom,y.top,y.bottom);(Math.abs(S)>=1||Math.abs(w)>=1)&&o.current.reveal(Math.round(S),Math.round(w))};return document.addEventListener("keydown",i,!0),r.addEventListener("focusin",s),()=>{document.removeEventListener("keydown",i,!0),r.removeEventListener("focusin",s)}},[e])}var de=ae(Pe(),1);function ha(){let e=(0,de.useRef)(null),[t,n]=(0,de.useState)({right:0,bottom:0});return(0,de.useLayoutEffect)(()=>{let o=e.current;if(!o)return;let r=()=>{let s=o.getBoundingClientRect(),d={right:Math.round(s.width),bottom:Math.round(s.height)};n(c=>c.right===d.right&&c.bottom===d.bottom?c:d)};if(r(),typeof ResizeObserver>"u")return;let i=new ResizeObserver(r);return i.observe(o),()=>i.disconnect()},[]),{probe:e,dock:t}}function fa(){let[e,t]=(0,de.useState)(null),n=(0,de.useRef)(null),o=(0,de.useRef)(0),r=(0,de.useCallback)(s=>{n.current=s,o.current===0&&(o.current=requestAnimationFrame(()=>{o.current=0,t(n.current)}))},[]),i=(0,de.useCallback)(()=>{o.current!==0&&cancelAnimationFrame(o.current),o.current=0;let s=n.current;return n.current=null,s&&t(null),s},[]);return{held:e,place:r,release:i}}function ma({stage:e,pan:t,zoom:n,setView:o,settled:r,zoomTo:i}){let s=(0,de.useRef)({x:0,y:0,s:1}),d=(0,de.useRef)(0),c=(0,de.useRef)(!1),l=(0,de.useRef)(r);l.current=r;let a=(0,de.useCallback)(()=>[...e.current?.querySelectorAll("[data-graview-world]")??[]],[e]),u=(0,de.useCallback)(({x:w,y:x,s:A})=>{let O=A!==1?`translate3d(${w}px, ${x}px, 0) scale(${A})`:w===0&&x===0?"":`translate3d(${w}px, ${x}px, 0)`;for(let T of a())T.style.transform=O,T.style.transformOrigin=A!==1?"0 0":"";ua(e.current,w,x,A)},[a,e]),m=(0,de.useCallback)(()=>{d.current===0&&(d.current=requestAnimationFrame(()=>{d.current=0,u(s.current)}))},[u]),f=(0,de.useCallback)(()=>{c.current=!1;for(let w of a())w.style.transform="",w.style.transformOrigin="";ua(e.current,0,0,1),l.current()},[a,e]),b=(0,de.useCallback)((w,x)=>{s.current={x:w.x-x.x,y:w.y-x.y,s:s.current.s},m()},[m]),h=(0,de.useCallback)((w,x,A,O,T,$)=>{let{x:g,y:M,s:L}=s.current,C=Math.max(T,Math.min($,L*w)),V=C/L;s.current={x:g*V+x.x*(1-V)+A,y:M*V+x.y*(1-V)+O,s:C},m()},[m]),y=(0,de.useCallback)(()=>{let{x:w,y:x,s:A}=s.current;return w===0&&x===0&&A===1?!1:(d.current!==0&&cancelAnimationFrame(d.current),d.current=0,u({x:w,y:x,s:A}),s.current={x:0,y:0,s:1},c.current=!0,Math.abs(A-1)>1e-4?i.current(A,{x:w/(1-A),y:x/(1-A)}):o(O=>{let T=O.pan??{x:0,y:0};return ct(O,{x:T.x+w,y:T.y+x})}),window.setTimeout(()=>{c.current&&f()},300),!0)},[o,f,u,i]);(0,de.useLayoutEffect)(()=>{c.current&&f()},[t,n,f]);let E=(0,de.useCallback)(()=>{d.current!==0&&cancelAnimationFrame(d.current),d.current=0,s.current={x:0,y:0,s:1},f()},[f]),S=(0,de.useCallback)(()=>s.current,[]);return{shiftTo:b,zoomBy:h,settle:y,drop:E,settling:c,offset:S}}function ua(e,t,n,o){for(let r of e?.querySelectorAll(":scope > .graview-lattice, :scope > .graview-measure")??[]){let i=o!==1&&r.classList.contains("graview-lattice")&&e?ud(e):null;i?r.style.setProperty("--graview-lattice-cell",`${(i.cell*o).toFixed(2)}px`):r.style.removeProperty("--graview-lattice-cell");let s=i?i.x*(o-1)+t:t,d=i?i.y*(o-1)+n:n;if(s===0&&d===0){r.style.removeProperty("--graview-hand-x"),r.style.removeProperty("--graview-hand-y");continue}r.style.setProperty("--graview-hand-x",`${s}px`),r.style.setProperty("--graview-hand-y",`${d}px`)}}function ud(e){let t=parseFloat(e.style.getPropertyValue("--graview-lattice-cell"));return Number.isFinite(t)?{cell:t,x:parseFloat(e.style.getPropertyValue("--graview-lattice-x"))||0,y:parseFloat(e.style.getPropertyValue("--graview-lattice-y"))||0}:null}var hd=4;function fd(e,t){for(let n=e;n&&n!==t;n=n.parentElement){let o=getComputedStyle(n);if(/(auto|scroll)/.test(o.overflowY)&&n.scrollHeight>n.clientHeight+1||/(auto|scroll)/.test(o.overflowX)&&n.scrollWidth>n.clientWidth+1)return!0}return!1}function pa({view:e,panned:t,limit:n,panWithin:o,moveByTransform:r,setView:i,setDragging:s,noteMoved:d,shift:c,district:l,pinching:a}){let u=(0,de.useRef)(!1),m=(0,de.useRef)(null),f=x=>{let A=e.pan??{x:0,y:0};m.current={kind:"pan",fromX:x.clientX,fromY:x.clientY,baseX:A.x,baseY:A.y,moved:!1}},b=x=>{x.button!==0||a.current||x.target.closest("[data-graview-view]")||f(x)},h=(x,A)=>{if(!(A.button!==0||a.current)&&!(A.pointerType!=="mouse"&&fd(A.target,A.currentTarget))){if(x.screenOf!==void 0&&!A.target.closest("[data-graview-grip]")){f(A);return}if(e.overview&&He(x.id)!==null){f(A);return}m.current={kind:"card",id:x.id,fromX:A.clientX,fromY:A.clientY,baseX:x.x-t.x,baseY:x.y-t.y,moved:!1}}},y=x=>{let A=m.current;m.current=null,l.release(),x?c.settle():c.drop(),A&&(u.current=!0,setTimeout(()=>u.current=!1,0)),c.settling.current||s(!1)};return{onGroundDown:b,onCardDown:h,onDragMove:x=>{let A=m.current;if(!A)return;if(a.current){y(!0);return}let O=x.clientX-A.fromX,T=x.clientY-A.fromY;if(!A.moved){if(Math.hypot(O,T)<hd)return;A.moved=!0,s(!0);try{x.currentTarget.setPointerCapture(x.pointerId)}catch{}}if(A.kind==="pan"){let $=o(n(),{x:A.baseX+O,y:A.baseY+T});r?c.shiftTo($,e.pan??{x:0,y:0}):i(g=>ct(g,$))}else A.id&&l.place({id:A.id,x:A.baseX+O,y:A.baseY+T})},onDragUp:()=>{c.settle();let x=l.release();x&&i(A=>In(A,x.id,{x:x.x,y:x.y})),m.current?.moved&&(u.current=!0,setTimeout(()=>u.current=!1,0),d()),m.current=null,!c.settling.current&&s(!1)},onDragCancel:()=>{m.current&&y(!1)},swallow:u}}function ga({stage:e,view:t,setView:n}){let o=(0,de.useRef)({view:t,charge:0,coolUntil:0,lastScale:1});o.current.view=t;let r=(0,de.useRef)(()=>{}),i=(0,de.useRef)(()=>{}),s=(0,de.useRef)(()=>{}),d=(0,de.useRef)(()=>{}),c=(0,de.useRef)(!1),l=(0,de.useRef)({fingers:new Map,pinch:null,owed:null,owing:0});return(0,de.useEffect)(()=>{let a=e.current;if(!a)return;let u=(O,T)=>{let $=o.current;if(T<$.coolUntil)return;let g=$.view.overview??!1;O!==g&&($.coolUntil=T+600,$.charge=0,n(On($.view,O)))},m=O=>{let T=o.current,$=T.view.overview??!1;if(O.ctrlKey){if(O.preventDefault(),!$){if(T.charge+=O.deltaY,Math.abs(T.charge)<60)return;T.charge>0?u(!0,performance.now()):T.charge=0;return}s.current(Math.exp(-O.deltaY*.004),O.clientX,O.clientY,0,0);return}!$||O.target?.closest("[data-graview-view], .graview-scroll, [data-graview-overlay], .graview-zoom")||(O.preventDefault(),i.current(-O.deltaX,-O.deltaY))},f=l.current,b=f.fingers,h=()=>{f.owing=0;let O=f.owed;f.owed=null,O&&s.current(O.factor,O.x,O.y,O.dx,O.dy)},y=()=>{let[O,T]=[...b.values()];return{apart:Math.max(1,Math.hypot(O.x-T.x,O.y-T.y)),mid:{x:(O.x+T.x)/2,y:(O.y+T.y)/2}}},E=O=>{if(O.pointerType!=="touch"||(O.isPrimary&&(b.clear(),f.pinch=null,c.current=!1),b.set(O.pointerId,{x:O.clientX,y:O.clientY}),b.size!==2))return;let{apart:T,mid:$}=y();f.pinch={from:T,last:T,mid:$},c.current=!0},S=O=>{if(!b.has(O.pointerId))return;b.set(O.pointerId,{x:O.clientX,y:O.clientY});let T=f.pinch;if(!T||b.size!==2)return;let{apart:$,mid:g}=y();if(!(o.current.view.overview??!1))$/T.from<.72&&u(!0,performance.now());else{let L=f.owed??={factor:1,x:T.mid.x,y:T.mid.y,dx:0,dy:0};L.factor*=$/T.last,L.dx+=g.x-T.mid.x,L.dy+=g.y-T.mid.y,f.owing===0&&(f.owing=requestAnimationFrame(h))}T.last=$,T.mid=g},w=O=>{b.delete(O.pointerId)&&(b.size<2&&(f.pinch=null),!(b.size>0)&&(f.owing!==0&&cancelAnimationFrame(f.owing),h(),c.current=!1,d.current()))},x=O=>{O.preventDefault(),o.current.lastScale=1},A=O=>{if(O.preventDefault(),c.current||b.size>1)return;let T=o.current,$=O.scale??1;if(!(T.view.overview??!1)){$<.72&&u(!0,performance.now());return}let g=$/(T.lastScale||1);T.lastScale=$;let M=O;r.current(g,M.clientX,M.clientY)};return a.addEventListener("wheel",m,{passive:!1}),a.addEventListener("gesturestart",x),a.addEventListener("gesturechange",A),a.addEventListener("pointerdown",E),a.addEventListener("pointermove",S),a.addEventListener("pointerup",w),a.addEventListener("pointercancel",w),()=>{f.owing!==0&&(cancelAnimationFrame(f.owing),h()),a.removeEventListener("pointerdown",E),a.removeEventListener("pointermove",S),a.removeEventListener("pointerup",w),a.removeEventListener("pointercancel",w),a.removeEventListener("wheel",m),a.removeEventListener("gesturestart",x),a.removeEventListener("gesturechange",A)}},[n,e]),{zoomAbout:r,panBy:i,pinchBy:s,pinchDone:d,pinching:c}}var wa=ae(Pe(),1),md=650,pd=400,go="[data-graview-view]",ba="button, a, input, select, textarea, [role='button'], aside, section[aria-label], [data-graview-popover], [data-graview-offstage], [data-graview-overlay]";function gd(e,t){if(!(e instanceof Element)||e.closest("[data-graview-pick]"))return!1;let n=e.closest(ba);return n!==null&&n!==t&&t.contains(n)}function ya(e){return e instanceof Element?e.closest(go):null}function yd(e,t,n){let o=null;for(let{id:r,box:i}of e.cards){if(t<i.left||t>i.right||n<i.top||n>i.bottom)continue;let s=i.width*i.height;(!o||s<o.area)&&(o={id:r,area:s})}return o?.id??null}function xa(e,t){(0,wa.useEffect)(()=>{let n=e.current;if(!n)return;let o=null,r=null,i=-1/0,s=!1,d=m=>{let f=o;if(o=null,r=null,!m.isPrimary||m.button!==0||!f||m.timeStamp-f.at>md)return;let b=ya(m.target)?.getAttribute("data-graview-view")??null,h=yd(f,m.clientX,m.clientY);!(m.pointerType==="touch"&&f.on!==null&&h===f.on&&m.timeStamp-f.at<=pd)&&(h===b||gd(m.target,n)||h===null)||(m.stopPropagation(),r={to:h,double:h!==null&&h===f.on})},c=(m,f,b,h)=>{s=!0;try{m.dispatchEvent(new MouseEvent(f,{bubbles:!0,cancelable:!0,clientX:b.clientX,clientY:b.clientY,detail:h?2:1}))}finally{s=!1}},l=m=>{if(s)return;if(r){let{to:h,double:y}=r;r=null,i=m.timeStamp+500,m.stopPropagation(),m.preventDefault();let E=h===null?null:[...n.querySelectorAll(go)].find(S=>S.getAttribute("data-graview-view")===h);h===null?c(n,"click",m,!1):E&&c(E,y?"dblclick":"click",m,y);return}if(t.current)return;let f=m.target instanceof Element?m.target.closest(ba):null;if(f&&f!==n&&n.contains(f)&&!m.target.closest("[data-graview-pick]"))return;let b=ya(m.target)?.getAttribute("data-graview-view")??null;o={at:m.timeStamp,on:b,cards:[...n.querySelectorAll(go)].map(h=>({id:h.getAttribute("data-graview-view"),box:h.getBoundingClientRect()}))}},a=m=>{s||m.timeStamp>i||(m.stopPropagation(),m.preventDefault(),i=-1/0)},u=m=>{r&&m.stopPropagation()};return n.addEventListener("pointerdown",d,!0),n.addEventListener("pointerup",u,!0),n.addEventListener("click",l,!0),n.addEventListener("dblclick",a,!0),()=>{n.removeEventListener("pointerdown",d,!0),n.removeEventListener("pointerup",u,!0),n.removeEventListener("click",l,!0),n.removeEventListener("dblclick",a,!0)}},[e,t])}var va={directed:"You",autonomous:"An agent","co-edited":"You and an agent",rule:"A rule"};function yo(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 i=e.find(s=>s.aggregate?.memberIds.includes(r));i&&o.add(i.id)}return o}function wo(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 bo(e){return e.edgeChosen?.9:e.lit?.78:e.own*(e.anyLit?e.kit.dim:e.kit.rest)}function ht(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?on(n,t):Jo(on(n,t),on(o,t),e.plane-n);return{x:e.x,y:e.y,width:e.width*r,height:e.height*r}}function mn(e,t){if(typeof getComputedStyle>"u"||getComputedStyle(e).visibility==="hidden")return null;let n=-1/0,o=-1/0,r=1/0,i=1/0,s=e.getBoundingClientRect();n=Math.max(n,s.left),o=Math.max(o,s.top),r=Math.min(r,s.right),i=Math.min(i,s.bottom);let d=e.parentElement;for(;d&&d!==t;){let l=getComputedStyle(d);if(l.overflowX!=="visible"||l.overflowY!=="visible"){let a=d.getBoundingClientRect();l.overflowX!=="visible"&&(n=Math.max(n,a.left),r=Math.min(r,a.right)),l.overflowY!=="visible"&&(o=Math.max(o,a.top),i=Math.min(i,a.bottom))}d=d.parentElement}if(r-n<=2||i-o<=2)return null;let c=t.getBoundingClientRect();return{x:n-c.left,y:o-c.top,width:r-n,height:i-o}}function Ve(e,t,n,o=!1){if(!e||typeof document>"u")return null;let r=e.querySelector(`[data-graview-view="${CSS.escape(t)}"]`);return r?mn(xo(r,n,o),e):null}function xo(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 br(e,t,n,o,r){let i=l=>e.nodes.find(a=>a.id===l);if(r.startsWith("screen:")){let l=e.nodes.find(a=>a.id===Re(r.slice(7)));return l?Ve(t,l.id,!0)??ht(l,n):null}let s=i(r),d=He(r);if(!s&&d!==null&&(s=i(Be(d))),!s&&Wt(r)){let[l]=Rt(r);l&&(s=i(Re(l)))}if(!s){let l=o.places().find(a=>a.as===r);l&&(s=i(Be(l.kind))??i(Re(l.kind)))}if(s||(s=[...e.nodes].filter(l=>l.aggregate?.memberIds.includes(r)).sort((l,a)=>l.plane-a.plane)[0]),!s)return null;let c=e.city!==void 0;return Ve(t,s.id,c&&s.aggregate!==void 0&&Math.round(s.plane)===2)??ht(s,n)}var ft=ae(Pe(),1);var Ye=ae(Pe(),1);var ze=ae(Oe(),1);function Ea({title:e,name:t,path:n,maxHeight:o,children:r}){let i=(0,Ye.useContext)(Xo),[s,d]=(0,Ye.useState)(void 0),[c,l]=(0,Ye.useState)(void 0),[a,u]=(0,Ye.useState)(void 0),[m,f]=(0,Ye.useState)(!1),[b,h]=(0,Ye.useState)(!1),y=(0,Ye.useRef)(null),E=(0,Ye.useRef)(null);(0,Ye.useLayoutEffect)(()=>{let M=y.current,L=E.current;if(!M||!L||typeof ResizeObserver>"u")return;let C=()=>{u(M.clientHeight),l(L.offsetHeight||void 0)};C();let V=new ResizeObserver(C);return V.observe(M),V.observe(L),()=>V.disconnect()},[]);let S=Math.max(s??0,c??0)||void 0,w=!m&&S!==void 0&&a!==void 0&&S>a+1,x=i&&n?n:void 0,A=x&&i?.href?i.href(x):void 0,O=M=>M.stopPropagation(),T=M=>{O(M),!(A&&(M.metaKey||M.ctrlKey||M.shiftKey||M.button!==0))&&(M.preventDefault(),x&&i?.open(x))},$=A?{href:A}:{role:"link",tabIndex:0},g={onPointerDown:O,onDoubleClick:O,onKeyDown:M=>{M.key!=="Enter"&&M.key!==" "||(O(M),M.key==="Enter"&&M.currentTarget.tagName==="A"&&!M.currentTarget.hasAttribute("href")&&(M.preventDefault(),M.currentTarget.click()))}};return(0,ze.jsxs)("section",{"data-graview-preview":t,"aria-label":e,...m?{"data-graview-expanded":"","data-graview-overlay":""}:{},onKeyDown:m?M=>{M.key==="Escape"&&(M.stopPropagation(),f(!1))}:void 0,style:{...wd,...m?bd:{}},children:[(0,ze.jsxs)("div",{style:xd,children:[(0,ze.jsx)("strong",{style:vd,children:e}),x?(0,ze.jsx)("a",{"data-graview-preview-open":"",...$,"aria-label":`Open ${e}`,style:ka,...g,onClick:T,children:"Open"}):w||m?(0,ze.jsx)("button",{type:"button","data-graview-preview-expand":"","aria-expanded":m,"aria-label":`${m?"Collapse":"Expand"} ${e}`,style:{...ka,...Sa},...g,onClick:M=>{O(M),f(L=>!L)},children:m?"Collapse":"Expand"}):null]}),(0,ze.jsxs)("div",{ref:y,"data-graview-preview-body":"",...s!==void 0?{"data-graview-content-height":s}:{},...w?{"data-graview-more":""}:{},onFocus:()=>h(!0),onBlur:()=>h(!1),style:{...kd,...o!==void 0&&!m?{maxHeight:o}:{},...b?{overflowClipMargin:4}:{}},children:[(0,ze.jsx)("div",{ref:E,"data-graview-preview-drawn":"",style:Sd,children:(0,ze.jsx)(Uo.Provider,{value:d,children:r})}),w?(0,ze.jsx)("div",{"aria-hidden":"true","data-graview-preview-fade":"",style:Md}):null,w?x?(0,ze.jsx)("a",{"data-graview-preview-more":"",...$,"aria-label":`More of ${e}`,style:Ma,...g,onClick:T,children:"More"}):(0,ze.jsx)("button",{type:"button","data-graview-preview-more":"","aria-label":`More of ${e}`,style:{...Ma,...Sa},...g,onClick:M=>{O(M),f(!0)},children:"More"}):null]})]})}var wd={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"},bd={maxHeight:"none",position:"absolute",top:0,left:0,right:0,width:"auto"},xd={display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:8,minWidth:0,flex:"0 0 auto"},vd={fontFamily:"var(--graview-font-display, inherit)",fontSize:"0.9375rem",lineHeight:1.25,fontWeight:560,letterSpacing:"0.005em",minWidth:0,overflowWrap:"anywhere"},ka={marginLeft:"auto",fontSize:"0.8125rem",fontWeight:560,color:"var(--graview-accent, #2f6f5e)",textDecoration:"none",textUnderlineOffset:"0.2em"},Sa={font:"inherit",fontSize:"0.8125rem",fontWeight:560,background:"none",border:0,padding:0,cursor:"pointer"},kd={position:"relative",flex:"0 1 auto",minHeight:0,overflowX:"visible",overflowY:"clip",minWidth:0},Sd={display:"flow-root",minWidth:0},Md={position:"absolute",left:0,right:0,bottom:0,height:64,pointerEvents:"none",background:"linear-gradient(to bottom, transparent, var(--graview-panel, #ffffff) 66%)"},Ma={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 me=ae(Oe(),1),Oa=(0,ft.memo)(function({kinds:t}){let{store:n}=xe(),{view:o,go:r}=Vr(),i=(0,ft.useRef)(null),s=zr("districts",{align:"start"}),d=s.open,c=f=>Jn(n.schema,f),l=f=>n.graph.allNodes().filter(b=>b.kind===f).length,a=f=>!o.overview&&o.focusId===Be(f),u=t.filter(f=>!a(f)),m=f=>{s.setOpen(!1);let b=i.current?.querySelector(".graview-beyond-more")??null;a(f)||r(Et(o,Be(f))),b?.focus({preventScroll:!0});let h=`[data-graview-view="${Be(f)}"][tabindex], [data-graview-view="${Re(f)}"][tabindex]`,y=40,E=()=>{let S=document.querySelector(h);S?S.focus({preventScroll:!0}):--y>0&&requestAnimationFrame(E)};requestAnimationFrame(E)};return(0,me.jsxs)("div",{ref:i,className:"graview-beyond","data-graview-beyond":t.length,"data-graview-beyond-open":d?"":void 0,children:[(0,me.jsxs)("button",{type:"button",className:"graview-beyond-more","data-testid":"beyond-more",...s.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(),s.toggle()},children:[(0,me.jsx)("span",{className:"graview-beyond-count",children:u.length})," ",(0,me.jsxs)("span",{className:"graview-beyond-word",children:["more district",u.length===1?"":"s"]}),(0,me.jsx)("span",{className:"graview-beyond-chevron","aria-hidden":"true",children:d?"\u25BE":"\u25B4"})]}),d?(0,me.jsx)("ul",{...s.pane,className:"graview-beyond-list",role:"menu","aria-label":"The other districts","data-testid":"beyond-list",style:Gr,onPointerDown:f=>f.stopPropagation(),children:t.map(f=>(0,me.jsx)("li",{role:"none",children:(0,me.jsxs)("button",{type:"button",role:"menuitem","data-graview-pick":Re(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(),m(f)},children:[(0,me.jsx)("span",{className:"graview-beyond-name",children:c(f)}),(0,me.jsx)("span",{className:"graview-beyond-tally",children:a(f)?"here":l(f)})]})},f))}):null]})},(e,t)=>e.kinds.length===t.kinds.length&&e.kinds.every((n,o)=>n===t.kinds[o]));function Aa(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"||ko(e[o],t[o]))}function ko(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 i=0;i<e.length;i++)if(!ko(e[i],r[i]))return!1;return!0}let o=Object.keys(e);return o.length!==Object.keys(t).length?!1:o.every(r=>ko(e[r],t[r]))}var Pa=(0,ft.memo)(La,(e,t)=>e.mode===t.mode&&e.selected===t.selected&&e.fidelity===t.fidelity&&Aa(e.node,t.node));function La({node:e,mode:t,selected:n,fidelity:o}){let{store:r,views:i,view:s}=xe(),d=Vt(),c=pi(),l=mi(),a=e.aggregate||Wt(e.id)||He(e.id)!==null?"many":"one",u={cardinality:a,fidelity:o??Zo[Rd(e.plane)].fidelity},m=a==="many"&&e.id===s.focusId?s.within?.view:void 0,f=i.resolve(e.kind,u,m),b=f?.view,h=i.resolve(e.kind,{cardinality:"many",fidelity:"full"})?.view,y=h!==void 0&&h.generic!==!0,E=e.aggregate?.memberIds,S=(0,ft.useMemo)(()=>(E??[]).map($=>r.graph.getNode($)).filter($=>$!==void 0),[E,r,d]),w={...e.aggregate?{nodes:S,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:l,...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,me.jsx)(Od,{node:e,props:w});let x=Qo(b),A=!e.aggregate&&w.node?w.node:void 0,O=x?A?{title:en(r.schema.tryDefinition(A.kind),A),name:A.id,path:Wo(r.schema,A.kind,A.id)}:{title:w.label??e.kind,name:f?.title?Cr(f.title):"",path:f?.title?`/places/${Cr(f.title)}`:void 0}:void 0,T=[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($=>$.count).join(","):"",e.aggregate?vo(e.aggregate.memberIds):"",e.aggregate?.retired??"",c?vo(c):"",l?vo(l):"",y].join("|");return(0,me.jsx)(Fr,{mode:t,children:(0,me.jsx)(yi,{kind:w.label??e.kind,...f?.title?{view:f.title}:{},children:(0,me.jsx)(Ed,{signature:T,graph:d,draw:()=>x&&O?(0,me.jsx)(Ea,{...O,maxHeight:x.maxHeight,children:(0,me.jsx)(b,{...w})}):(0,me.jsx)(b,{...w})})},`${e.id}|${f?.title??""}`)})}var Ed=(0,ft.memo)(function({draw:t}){return(0,me.jsx)(me.Fragment,{children:t()})},(e,t)=>e.signature===t.signature&&e.graph===t.graph);function Rd(e){return Math.max(0,Math.min(2,Math.round(e)))}function Od({node:e,props:t}){return(0,me.jsxs)("div",{style:{padding:8,font:"13px/1.4 system-ui",overflow:"hidden"},children:[(0,me.jsx)("strong",{children:t.label??e.kind}),t.nodes?(0,me.jsxs)("div",{children:[t.nodes.length," items"]}):(0,me.jsx)("div",{children:e.id})]})}var Ca=(0,ft.memo)(function({node:t}){let{store:n}=xe(),o=jt(),r=t.aggregate,i=r.opens,s=r.memberIds.length,d=tn(n.schema,r.kind,s),c=r.memberIds.slice(0,3).map(m=>{let f=n.graph.getNode(m),b=f?n.schema.tryDefinition(f.kind):void 0;return f?b?.label?b.label(f):String(f.label??m):m}),l=r.memberIds,a=(0,ft.useMemo)(()=>{let m=o?or(o):null;return m?l.filter(f=>m.has(f)).length:0},[o,l]),u=i.in==="picture";return(0,me.jsxs)("div",{className:"graview-band-group","data-graview-band":i.in,"data-graview-band-count":s,"data-graview-emphasis":o?a>0?"lit":"dimmed":void 0,title:u?`${r.label} \u2014 press twice to see them all, arranged`:`${r.label}: ${d} \u2014 press twice to open`,children:[(0,me.jsxs)("span",{className:"graview-band-group-head",children:[(0,me.jsx)("span",{className:"graview-band-group-name",children:r.label}),(0,me.jsx)("span",{className:"graview-band-group-open","aria-hidden":"true",children:u?"\u2197":"\u25BE"})]}),(0,me.jsxs)("span",{className:"graview-band-group-names",children:[u?null:(0,me.jsxs)("span",{className:"graview-band-group-count",children:[d,a>0?` \xB7 ${a} match`:""," \xB7 "]}),c.join(" \xB7 "),s>c.length?" \u2026":""]})]})},(e,t)=>Aa(e.node,t.node)),Ra=new WeakMap;function vo(e){let t=Ra.get(e);if(t!==void 0)return t;let n=2166136261;for(let r of e){for(let i=0;i<r.length;i++)n=Math.imul(n^r.charCodeAt(i),16777619);n=Math.imul(n^44,16777619)}let o=`${e.length}:${(n>>>0).toString(36)}`;return Ra.set(e,o),o}var mt=ae(Pe(),1);function So(e,t,n){let o=e.aggregate?[...e.aggregate.memberIds]:[e.id];return n?o.every(i=>t.includes(i))?t.filter(i=>!o.includes(i)):[...t,...o.filter(i=>!t.includes(i))]:o}function Ta(){let[e,t]=(0,mt.useState)(16);return(0,mt.useEffect)(()=>{if(typeof window>"u")return;let n=document.documentElement,o=()=>{let i=parseFloat(getComputedStyle(n).fontSize);Number.isFinite(i)&&t(s=>Math.abs(s-i)<.5?s:i)};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 Ia(e){let[t,n]=(0,mt.useState)(null);return(0,mt.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,mt.useEffect)(()=>{let o=e.current;if(!o||typeof ResizeObserver>"u")return;let r=d=>{!d||d.width===0||d.height===0||n(c=>{let l={width:Math.round(d.width),height:Math.round(d.height)};return c&&c.width===l.width&&c.height===l.height?c:l})},i=new ResizeObserver(d=>r(d[0]?.contentRect)),s=()=>r(o.getBoundingClientRect());return i.observe(o),addEventListener("resize",s),()=>{i.disconnect(),removeEventListener("resize",s)}},[e]),t}var Ad=120;function Na(e){let t=(0,mt.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,i=typeof navigator<"u"&&(navigator.maxTouchPoints>0||typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches);return n&&i&&e.width===n.size.width&&r>0&&r<=Ad&&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 Ha(e){return`matrix3d(${e.join(",")})`}var ge=ae(Pe(),1);var Eo=(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 Ro(e,t){let n=[],o=[];for(let i=0;i<e.length-1;i++){let s=e[i],d=e[i+1],c=!Eo(s,t);c&&o.length===0&&o.push(s);for(let l=1;l<=48;l++){let a=l/48,u={x:s.x+(d.x-s.x)*a,y:s.y+(d.y-s.y)*a},m=!Eo(u,t);if(m===c)continue;let f=(l-1)/48,b=a;for(let E=0;E<10;E++){let S=(f+b)/2,w={x:s.x+(d.x-s.x)*S,y:s.y+(d.y-s.y)*S};!Eo(w,t)===c?f=S:b=S}let h=(f+b)/2,y={x:s.x+(d.x-s.x)*h,y:s.y+(d.y-s.y)*h};m?o=[y]:(o.push(y),o.length>=2&&n.push(o),o=[]),c=m}c&&o.push(d)}return o.length>=2&&n.push(o),n}function Wn(e,t){let n=Math.abs(t.x-e.x);if(Math.abs(t.y-e.y)>n){if(n<2)return[e,t];let i=(e.y+t.y)/2;return[e,{x:e.x,y:i},{x:t.x,y:i},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 Qe=e=>Math.round(e*100)/100,Ct=e=>e.map(t=>t.map((n,o)=>`${o===0?"M":"L"} ${Qe(n.x)} ${Qe(n.y)}`).join(" ")).join(" ");function Oo(e,t){if(e.length<3)return Ct([e]);let n=[`M ${Qe(e[0].x)} ${Qe(e[0].y)}`];for(let r=1;r<e.length-1;r++){let i=e[r-1],s=e[r],d=e[r+1],c=Math.hypot(s.x-i.x,s.y-i.y),l=Math.hypot(d.x-s.x,d.y-s.y),a=Math.min(t,c/2,l/2),u={x:s.x+(i.x-s.x)/(c||1)*a,y:s.y+(i.y-s.y)/(c||1)*a},m={x:s.x+(d.x-s.x)/(l||1)*a,y:s.y+(d.y-s.y)/(l||1)*a};n.push(`L ${Qe(u.x)} ${Qe(u.y)} Q ${Qe(s.x)} ${Qe(s.y)} ${Qe(m.x)} ${Qe(m.y)}`)}let o=e[e.length-1];return n.push(`L ${Qe(o.x)} ${Qe(o.y)}`),n.join(" ")}function Ba(e,t){return t==="orthogonal"?Ct([e]):Oo(e,10)}function Da(e,t,n){if(e==="orthogonal"){let d=Wn(t.p0,t.p1),c=d.slice(1).map((u,m)=>Math.hypot(u.x-d[m].x,u.y-d[m].y)),l=c.reduce((u,m)=>u+m,0)||1,a=n*l;for(let u=0;u<c.length;u++){let m=c[u];if(a<=m||u===c.length-1){let f=m===0?0:Math.min(1,a/m),b=d[u],h=d[u+1];return{x:b.x+(h.x-b.x)*f,y:b.y+(h.y-b.y)*f}}a-=m}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),i=2*(1-n)*n,s=n*n;return{x:r*t.p0.x+i*o.x+s*t.p1.x,y:r*t.p0.y+i*o.y+s*t.p1.y}}function xr(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 $a(e,t){let n=t.x-e.x,o=t.y-e.y,r=(n/2+o)/2,i=(o-n/2)/2;if(Math.abs(r)<1||Math.abs(i)<1)return[e,t];let s={x:e.x+2*r,y:e.y+r};return[e,s,t]}function Fa(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(i=>o.y<i.bottom+3&&o.y+o.height>i.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,i)=>r.x-i.x);return n.sort((o,r)=>o.top-r.top)}var jn=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Po=(e,t)=>e.findIndex(n=>n.boxes.some(o=>jn(o,t)));function Wa(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 Co(e,t){let n=[{from:-1/0,to:1/0}];for(let i of e){let s=[],d=-1/0;for(let l of i.boxes)s.push({from:d,to:l.x-12}),d=Math.max(d,l.x+l.width+12);s.push({from:d,to:1/0});let c=[];for(let l of n)for(let a of s){let u=Math.max(l.from,a.from),m=Math.min(l.to,a.to);m-u>=0&&c.push({from:u,to:m})}n=c}let o=t,r=1/0;for(let i of n){let s=Math.min(Math.max(t,i.from),i.to),d=i.from===-1/0||i.to===1/0,c=Math.abs(s-t)+(d?60:0);c<r&&(r=c,o=s)}return o}var ot=e=>({x:e.x,y:-(e.y+e.height),width:e.width,height:e.height}),vr=e=>e.map(t=>({x:t.x,y:-t.y}));function Lo(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 i=n[r-1],s=n[r+1];return!i||!s||!(t(i.x,o.x)&&t(o.x,s.x)||t(i.y,o.y)&&t(o.y,s.y))})}function To(e,t,n){let o=e.boxes.filter(l=>!jn(l,t)&&l.y+l.height<=t.y+1&&l.x<t.x+t.width&&l.x+l.width>t.x),r=[{from:t.x+6,to:t.x+t.width-6}];for(let l of o)r=r.flatMap(a=>[{from:a.from,to:Math.min(a.to,l.x-12/2)},{from:Math.max(a.from,l.x+l.width+12/2),to:a.to}]).filter(a=>a.to>=a.from);let i=null;for(let l of r){let a=Math.min(Math.max(n,l.from),l.to);(i===null||Math.abs(a-n)<Math.abs(i-n))&&(i=a)}if(i!==null)return{x:i,tail:[{x:i,y:t.y}]};let s=n<t.x+t.width/2,d=Co([e],s?t.x-12:t.x+t.width+12),c=t.y+t.height/2;return{x:d,tail:[{x:d,y:c},{x:d<t.x?t.x:t.x+t.width,y:c}]}}function Ao(e,t,n){let o=To({top:-e.bottom,bottom:-e.top,boxes:e.boxes.map(ot)},ot(t),n);return{x:o.x,head:vr(o.tail).reverse()}}function ja(e,t,n,o){let r=t;for(;r>o&&!e[r-1].boxes.some(i=>n>i.x-12/2&&n<i.x+i.width+12/2);)r--;return r}var Va=(e,t)=>(e%3-1)*Math.max(0,Math.min(4,t/2-3));function Ga(e,t,n,o,r,i,s,d){let c=h=>h<0?e[0].top-n:e[h+1].top-e[h].bottom,l=h=>(h<0?(n+e[0].top)/2:Wa(e,h,h+1))+Va(d,c(h)),a=To(e[i],r,s),u=ja(e,i,a.x,t+1),m=l(t);if(u===t+1)return Lo([...o.head,{x:o.x,y:m},{x:a.x,y:m},...a.tail]);let f=Co(e.slice(t+1,u),a.x),b=l(u-1);return Lo([...o.head,{x:o.x,y:m},{x:f,y:m},{x:f,y:b},{x:a.x,y:b},...a.tail])}function pn(e,t,n,o=0){let r=Fa(n.some(a=>jn(a,e))&&n.some(a=>jn(a,t))?n:[...n,e,t]),i=Po(r,e),s=Po(r,t),d=e.x+e.width/2,c=t.x+t.width/2;if(i===s){if(!(i<r.length-1||r.length===1))return vr(pn(ot(e),ot(t),n.map(ot),o));let u=Wa(r,i,i+1)+Va(o,i<r.length-1?r[i+1].top-r[i].bottom:2*12),m=Ao(r[i],e,c),f=Ao(r[i],t,d);return Lo([...m.head,{x:m.x,y:u},{x:f.x,y:u},...[...f.head].reverse()])}if(s<i)return vr(pn(ot(e),ot(t),n.map(ot),o));let l=Ao(r[i],e,c);return Ga(r,i,r[i].bottom,l,t,s,d,o)}function Io(e,t,n,o=0){if(t.y+t.height<=e.y){let f=Io(ot(e),ot(t),n.map(ot),o);return f?vr(f):null}let r=e.y+e.height;if(t.y<r)return null;let i=Fa([...n.filter(f=>f.y>=r&&!jn(f,t)),t]),s=Po(i,t),d=t.x+t.width/2,c=To(i[s],t,d),l=ja(i,s,c.x,0),a=l===0?c.x:Co(i.slice(0,l),c.x),u=Math.min(12,e.width/2),m=Math.min(Math.max(a,e.x+u),e.x+e.width-u);return Ga(i,-1,r,{x:m,head:[{x:m,y:r}]},t,s,d,o)}function za(e,t=16){let n=new Map;for(let r of e){let i=r.a<r.b?`${r.a}\0${r.b}`:`${r.b}\0${r.a}`,s=n.get(i);s?s.push(r.key):n.set(i,[r.key])}let o=new Map;for(let r of n.values())r.forEach((i,s)=>o.set(i,(s-(r.length-1)/2)*t));return o}var _e=ae(Oe(),1);function Ho(e,t,n,o){let r=[];for(let i of e.querySelectorAll("[data-graview-relation] > span")){let s=i.getBoundingClientRect();if(s.width<=0||s.height<=0)continue;let d=s.top-t.top,c=i.parentElement?.getAttribute("data-graview-relation"),l=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>=d+s.height-1&&(l=Math.min(l,u.y))}r.push({x:s.left-t.left,y:d,width:s.width,height:l-d<=s.height*4?l-d:s.height})}return r}function Sr(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),i=!r&&o>.5*Math.min(e.height,t.height);if(r){let b={x:e.x+e.width,y:e.y+e.height/2},h={x:t.x+t.width,y:t.y+t.height/2};return{from:b,to:h,control:{x:Math.max(b.x,h.x)+18,y:(b.y+h.y)/2},mode:"stacked"}}if(i){let b={x:e.x+e.width/2,y:e.y},h={x:t.x+t.width/2,y:t.y};return{from:b,to:h,control:{x:(b.x+h.x)/2,y:Math.min(b.y,h.y)-18},mode:"abreast"}}let s={x:t.x+t.width/2,y:t.y+t.height/2},d={x:e.x+e.width/2,y:e.y+e.height/2},c=kr(e,s),l=kr(t,d),a=Math.hypot(l.x-c.x,l.y-c.y);if(a<8)return null;let u=Math.min(36,a*.12),m=-(l.y-c.y)/a,f=(l.x-c.x)/a;return{from:c,to:l,control:{x:(c.x+l.x)/2+m*u,y:(c.y+l.y)/2+f*u},mode:"direct"}}function kr(e,t){let n=e.x+e.width/2,o=e.y+e.height/2,r=t.x-n,i=t.y-o;if(r===0&&i===0)return{x:n,y:o};let s=r===0?1/0:e.width/2/Math.abs(r),d=i===0?1/0:e.height/2/Math.abs(i),c=Math.min(s,d),l=Math.max(0,c*.98);return{x:n+r*l,y:o+i*l}}function Pd(e,t,n){let o=t.get(e.from),r=t.get(e.to);if(!o||!r)return!1;if(n)return!0;let i=Math.round(o.plane)===1||Math.round(r.plane)===1,s=d=>!!d.aggregate&&Math.round(d.plane)===2;return i&&!s(o)&&!s(r)}var _a=e=>({clips:new Map,members:new Map,marks:new Map,...e?{owed:e}:{}});function Ka(e,t){let n=_a();for(let[o,r]of t){let i=e.querySelector(`[data-graview-view="${CSS.escape(o)}"]`);if(i!==null){for(let s of r)if(gn(e,i,s,n).length>0)return!0}}return!1}function Ua(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 i=n.get(r);i?i.push(o):n.set(r,[o])}return t.marks.set(e,n),n}function Ld(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 Cd(e,t,n){let o=e.parentElement;for(;o!==null;){let r=Ld(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 gn(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 i=r.get(n);if(i)return i;let s=e.getBoundingClientRect(),d=[];for(let l of Ua(t,o).get(n)??[]){if(l.closest("[data-graview-offstage]"))continue;let a=l.getBoundingClientRect();a.width<=2||a.height<=2||Cd(l,a,o)&&d.push({x:a.left-s.left,y:a.top-s.top,width:a.width,height:a.height})}d.sort((l,a)=>l.width*l.height-a.width*a.height),r.set(n,d);let c=t.getAttribute("data-graview-view");return d.length===0&&o.owed&&c!==null&&o.owed.set(c,(o.owed.get(c)??new Set).add(n)),d}function Mr(e,t,n,o,r,i){let s=new Map(e.map(w=>[w.id,w])),d=_a(i),c=new Map,l=w=>{if(!n||typeof document>"u")return null;let x=c.get(w);return x===void 0&&(x=n.querySelector(`[data-graview-view="${CSS.escape(w)}"]`),c.set(w,x)),x},a=new Map;for(let w of e){let x=Ve(n,w.id,o)??ht(w,r);x&&a.set(w.id,x)}let u=new Map;if(n&&typeof document<"u"){let w=n.getBoundingClientRect();for(let x of n.querySelectorAll("[data-graview-pick], [data-graview-slot]")){if(x.closest("[data-graview-offstage]"))continue;let A=x.getAttribute("data-graview-pick")??x.getAttribute("data-graview-slot");if(A===null)continue;let O=x.getBoundingClientRect();if(O.width<=2||O.height<=2||O.width>w.width*.6&&O.height>w.height*.6)continue;let T=u.get(A),$={x:O.left-w.left,y:O.top-w.top,width:O.width,height:O.height};T?T.push($):u.set(A,[$])}}let m=(w,x)=>{let A=[];for(let[O,T]of a)O!==w&&O!==x&&A.push(T);for(let[O,T]of u)O!==w&&O!==x&&A.push(...T);return A},f=w=>Math.round(s.get(w)?.plane??-1)===1,b=[];for(let w of e){let x=a.get(w.id);x&&Math.round(w.plane)===1&&b.push(x)}if(!o&&n&&typeof document<"u"){let w=n.getBoundingClientRect();b.push(...Ho(n,w,e,x=>a.get(x)))}let h=(w,x)=>!o&&f(w)&&f(x)?b:void 0,y=o?void 0:e.find(w=>Math.round(w.plane)===0&&!w.aggregate),E=(w,x,A,O)=>{if(!y)return{};let T=w.to===y.id&&A===y.id;if(!T&&!(w.from===y.id&&x===y.id))return{};let $=T?w.from:w.to,g=a.get(y.id),M=a.get($);if($===y.id||!f($)||!g||!M)return{};let L=l(y.id),C=ie=>L!==null&&Ua(L,d).get(ie)?.some(I=>!I.closest("[data-graview-offstage]"))===!0,V=O.map(ie=>ie.from===y.id?ie.to:ie.from),q=V.length>0&&V.every(C);return{band:b,tie:{card:g,chip:M,cardIsTo:T,toward:$,holds:s.get($)?.aggregate?.memberIds??[$]},...q?{said:V}:{}}},S=[];for(let w of t){if(!Pd(w,s,o))continue;let x=a.get(w.from),A=a.get(w.to);if(!x||!A)continue;let O=m(w.from,w.to),T=w.edges,$=o&&T.some(L=>L.from!==w.from&&gn(n,l(w.from),L.from,d).length>0||L.to!==w.to&&gn(n,l(w.to),L.to,d).length>0),g=h(w.from,w.to);if(o&&!$||w.loop||T.length===0){S.push({key:w.id,connector:w,edges:T,fromBox:x,toBox:A,fromAnchor:w.from,toAnchor:w.to,obstacles:O,hosts:[],...g?{band:g}:{},...E(w,w.from,w.to,T)});continue}let M=new Map;for(let L of T){let C=L.from===w.from?[]:gn(n,l(w.from),L.from,d),V=L.to===w.to?[]:gn(n,l(w.to),L.to,d),q=[w.from,w.to].find(R=>Math.round(s.get(R)?.plane??-1)===0);if(!o&&q!==void 0&&(q===w.from?L.from!==w.from:L.to!==w.to)&&gn(n,l(q),q===w.from?L.to:L.from,d).length>0)continue;let ie=q!==void 0?s.get(q):void 0;if(!o&&ie?.aggregate&&n&&(q===w.from?L.from!==w.from&&C.length===0:L.to!==w.to&&V.length===0))continue;let I=C.length>0?L.from:w.from,D=V.length>0?L.to:w.to,N=`${w.id}|${I}|${D}`,Q=M.get(N);if(Q){Q.edges.push(L);continue}let P=C.length>0?C:[x],j=V.length>0?V:[A],z=P[0],re=j[0],v=1/0;for(let R of P)for(let k of j){let H=Math.hypot(R.x+R.width/2-(k.x+k.width/2),R.y+R.height/2-(k.y+k.height/2));H<v&&(v=H,z=R,re=k)}M.set(N,{edges:[L],fromBox:z,toBox:re,fromAnchor:I,toAnchor:D})}for(let[L,C]of M)S.push({key:L,connector:w,obstacles:O,hosts:[...C.fromAnchor!==w.from?[x]:[],...C.toAnchor!==w.to?[A]:[]],...g?{band:g}:{},...C,...E(w,C.fromAnchor,C.toAnchor,C.edges)})}return S}function Xa(e,t,n){let o=new Map(t.map(s=>[s.id,s])),r=new Map;for(let s of n){let d=o.get(s.id);d&&(d.x!==s.x||d.y!==s.y)&&r.set(s.id,{x:s.x-d.x,y:s.y-d.y})}if(r.size===0)return[...e];let i=(s,d)=>{let c=r.get(d);return c?{...s,x:s.x+c.x,y:s.y+c.y}:s};return e.map(s=>{let{from:d,to:c}=s.connector;if(!r.has(d)&&!r.has(c))return s;let l=i(s.fromBox,d),a=i(s.toBox,c),u=s.tie&&{...s.tie,card:i(s.tie.card,s.tie.cardIsTo?c:d),chip:i(s.tie.chip,s.tie.toward)},m=f=>f===s.fromBox?l:f===s.toBox?a:s.tie&&f===s.tie.chip?u.chip:f;return{...s,fromBox:l,toBox:a,...u?{tie:u}:{},...s.band?{band:s.band.map(m)}:{}}})}function No(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 Ya(e,t,n){let o=(1-t)*(1-n),r=(1-t)*n+t*(1-n),i=t*n;return{p0:No(e,t),c:{x:o*e.p0.x+r*e.c.x+i*e.p1.x,y:o*e.p0.y+r*e.c.y+i*e.p1.y},p1:No(e,n)}}function Vn(e,t){let n=l=>t.some(a=>l.x>a.x&&l.x<a.x+a.width&&l.y>a.y&&l.y<a.y+a.height),o=l=>!n(No(e,l)),i=(l,a,u)=>{for(let m=0;m<10;m++){let f=(l+a)/2;o(f)===u?l=f:a=f}return(l+a)/2},s=[],d=null,c=o(0);c&&(d=0);for(let l=1;l<=64;l++){let a=l/64,u=o(a);if(u===c)continue;let m=i((l-1)/64,a,c);u?d=m:d!==null&&(m-d>.001&&s.push(Ya(e,d,m)),d=null),c=u}return d!==null&&1-d>.001&&s.push(Ya(e,d,1)),s}function qa({strands:e,result:t,scheme:n,overview:o,selection:r,emphasis:i,stageRef:s,liveOf:d,onPickEdge:c,provisional:l,pointed:a=null}){let u=zt(),m=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&&m.has(g.from)&&m.has(g.to),b=yo(t.nodes,r),h=g=>b.size===0||b.has(g.from)||b.has(g.to),y=new Set(r.filter(g=>Ft(g)===null)),E=o?t.nodes.find(g=>Math.round(g.plane)===0):void 0,S=E?Ve(s.current,E.id,!1)??ht(E,n):null;if(e.length===0)return null;let w=g=>g.edges.some(M=>y.has(M.from)||y.has(M.to)),x=y.size>0&&e.some(w),A=new Map;for(let g of e)A.set(g.connector.id,(A.get(g.connector.id)??0)+1);let O=za(e.map(g=>({key:g.key,a:g.fromAnchor,b:g.toAnchor}))),T=new Set,$=e.map((g,M)=>{let{connector:L,fromBox:C,toBox:V}=g,q={x:C.x+C.width/2,y:C.y+C.height/2},ie={x:V.x+V.width/2,y:V.y+V.height/2},I=o?kr(C,ie):q,D=o?kr(V,q):ie,N=L.loop===!0,{connector:Q,style:P}=ln(u,L.kind);if(!Q.visible)return null;let j=N?Math.max(22,Math.min(C.width,C.height)*.3):0,z=N?{x:q.x+C.width*.22,y:q.y-C.height/2-j+7}:I,re=(I.x+D.x)/2,v=(I.y+D.y)/2,R=Math.hypot(D.x-I.x,D.y-I.y),k=Math.min(o?40:90,R*(o?.09:.16)),H=0,F=0;if(R>0){H=-(D.y-I.y)/R,F=(D.x-I.x)/R;let le=re-t.width/2,Ae=v-t.height/2;if(S&&!N){let dt=S.x+S.width/2,Nt=S.y+S.height/2;le=re-dt,Ae=v-Nt;let $e=Math.abs(H*(dt-I.x)+F*(Nt-I.y)),tt=Math.hypot(S.width/2,S.height/2)*.85+24,qt=((dt-I.x)*(D.x-I.x)+(Nt-I.y)*(D.y-I.y))/(R*R);$e<tt&&qt>.1&&qt<.9&&(k=Math.min(180,Math.max(k,(tt-$e)*2)))}H*le+F*Ae<0&&(H=-H,F=-F)}k+=2*(O.get(g.key)??0);let W=xr(Q.route,{p0:I,c:{x:re+H*k,y:v+F*k},p1:D}),Y=f(L),_=Q.route==="orthogonal"||Y,Z=(le,Ae)=>Y?$a(le,Ae):Wn(le,Ae),oe=!N&&g.tie?Io(g.tie.card,g.tie.chip,g.band??[],M):null,K=oe?g.tie.cardIsTo?oe.reverse():oe:!N&&g.band?pn(C,V,g.band,M):null,pe=N||_||K?[]:Vn(W,[C,V,...g.obstacles]),ye=K?[K]:!N&&_?Ro(Z(I,D),[C,V,...g.obstacles]):[];if(!N&&pe.length===0&&ye.length===0)return null;let ue=ye[ye.length-1],Me=_||K?ye[0]?.[0]:pe[0]?.p0,De=_||K?ue?.[ue.length-1]:pe[pe.length-1]?.p1,te=le=>le.map(Ae=>`M ${Ae.p0.x} ${Ae.p0.y} Q ${Ae.c.x} ${Ae.c.y} ${Ae.p1.x} ${Ae.p1.y}`).join(" "),J=`M ${z.x-j} ${z.y} A ${j} ${j} 0 1 1 ${z.x+j} ${z.y} A ${j} ${j} 0 0 1 ${z.x-j} ${z.y}`,se=N?J:K?Ba(K,Q.route):_?Ct(ye):te(pe),at=le=>({x:le.x-8,y:le.y-8,width:le.width+16,height:le.height+16}),Ke=[C,V,...g.hosts,...g.obstacles].map(at),wn=N?J:K?Ct(ye):_?Ct(Ro(Z(I,D),Ke)):te(Vn(W,Ke)),Ze=g.edges.length===1?g.edges[0]:null,Te=Ze?Yt(L.kind,Ze.from,Ze.to):null,Tt=Te!==null&&r.includes(Te),Je=Te!==null?l?.get(Te):void 0,It=g.edges.some(le=>y.has(le.from)||y.has(le.to)),Ue=g.tie?.toward??"",Le=g.tie!==void 0&&(a!==null&&(Ue===a||g.tie.holds.includes(a)||g.said?.includes(a)===!0)||y.has(Ue))&&!T.has(Ue);Le&&T.add(Ue);let Ie=!o&&y.size>0&&It||Le,st=i!==null&&L.kind===i||Tt,ne=d?.(L)!==void 0;if(o&&!ne||!o&&!ne&&y.size>0&&!It&&!st&&!Le||g.said!==void 0&&!Le&&!g.said.some(le=>y.has(le))&&!st)return null;let et=o?wo({emphasized:i!==null,stressed:st,anyChosen:x,mine:It,touches:h(L),siblings:A.get(L.id)??1}):bo({edgeChosen:Tt,lit:Ie,anyLit:x||i!==null,own:P.opacity,kit:u.emphasis}),pt=Ie&&Me&&De?g.tie?g.tie.cardIsTo?Me:De:g.edges.some(le=>y.has(le.from))?De:Me:null,bn=(0,_e.jsxs)("g",{children:[(0,_e.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":Ie||void 0,"data-graview-activity":d?.(L)?.manner,"data-graview-provisional":Je!==void 0||void 0,opacity:et*(L.opacity??1)*(Je!==void 0?Tn:1),d:se,fill:"none",stroke:an(P),strokeWidth:(Ie?Math.max(1.6,Yr(P,o)):Yr(P,o))+(st?.6:0),strokeDasharray:Je!==void 0?Cn:ir[P.pattern],strokeLinecap:"round"}),pt?(0,_e.jsx)("circle",{cx:pt.x,cy:pt.y,r:2.6,fill:an(P),opacity:et}):null,N&&o?(0,_e.jsx)("text",{x:z.x,y:z.y-j-5,textAnchor:"middle",opacity:et,style:{font:"9px var(--graview-font-body, system-ui)",letterSpacing:"0.09em",textTransform:"uppercase",fill:"var(--graview-ink-faint)"},children:Zn(L.kind).toLowerCase()}):null]},g.key),xt=null;return Te&&c&&!N&&et>=.2&&(xt=(0,_e.jsx)("path",{"data-graview-edge":Te,className:"graview-edge-hit",d:wn,fill:"none",pathLength:1,strokeDasharray:"0.86",strokeDashoffset:-.07,stroke:"transparent",strokeWidth:14,style:{pointerEvents:"stroke",cursor:"pointer"},onClick:le=>{le.stopPropagation(),c(Te,{x:le.clientX,y:le.clientY})},onContextMenu:le=>{le.altKey||(le.preventDefault(),le.stopPropagation(),c(Te,{x:le.clientX,y:le.clientY}))},children:Je!==void 0?(0,_e.jsx)("title",{children:Je}):null},`hit:${g.key}`)),{key:g.key,line:bn,hit:xt}});return(0,_e.jsxs)(_e.Fragment,{children:[(0,_e.jsx)("svg",{"aria-hidden":"true","data-graview-world":"",width:t.width,height:t.height,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:We.ties},children:$.map(g=>g?.line)}),$.some(g=>g?.hit)?(0,_e.jsx)("svg",{"data-graview-world":"",width:t.width,height:t.height,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:We.tieLabels},children:$.map(g=>g?.hit)}):null]})}function Qa(e,t,n){if(t.size===0||typeof MutationObserver>"u")return()=>{};let o=0,r=()=>{o=0,Ka(e,t)&&n()},i=()=>{o===0&&(o=requestAnimationFrame(r))},s=({target:c})=>{for(let l=c instanceof Element?c:c.parentElement;l&&l!==e;l=l.parentElement)if(t.has(l.getAttribute("data-graview-view")??""))return!0;return!1},d=new MutationObserver(c=>{c.some(s)&&i()});return d.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-graview-pick","data-graview-slot","data-graview-offstage"]}),i(),()=>{d.disconnect(),cancelAnimationFrame(o)}}function Er(e){return e<640?{left:8,right:56}:{left:8,right:Math.round(Math.min(128,e*.107))}}function Td(e){return Math.min(260,16+e.length*6.6)}var Gn=(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 Ja(e,t,n){let o=new Map;for(let s of e){let d=o.get(s.said);d?d.push(s):o.set(s.said,[s])}let r=[],i=[];for(let[s,d]of o){let c=d[0],l=Td(s),{end:a,far:u}=c,m=y=>Math.max(0,Math.min(n.width-l,y)),f=[{x:m(a.x-l/2),y:u.y-22-6,width:l,height:22},{x:m(a.x-l/2),y:u.y+u.height+6,width:l,height:22},{x:u.x+u.width+6,y:a.y-22/2,width:l,height:22},{x:u.x-l-6,y:a.y-22/2,width:l,height:22}],b=f[0],h=1/0;for(let y of f){let S=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)S+=Gn(y,w.title)*100+Gn(y,w.box);for(let w of r)S+=Gn(y,w)*100;if(S<h&&(h=S,b=y),S===0)break}r.push(b),i.push({said:s,keys:d.map(y=>y.key),...b})}return i}var Za=(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 Bo(e,t){let n=new Set;for(let o of e)(t.edgeId&&o.edgeId===t.edgeId||t.point&&(Za(o.fromBox,t.point)||Za(o.toBox,t.point))||t.ids?.some(r=>o.ids.includes(r))||t.box&&(Gn(t.box,o.fromBox)>0||Gn(t.box,o.toBox)>0))&&n.add(o.key);return n}var ke=ae(Oe(),1);function ns(e){let t=ci(e);return t.length>0?new Map(t.map(n=>[Yt(n.edge.kind,n.edge.from,n.edge.to),li(n)])):void 0}function rs({frame:e,width:t,height:n,scheme:o,overview:r,selection:i,emphasis:s,stageRef:d,store:c,graphNodes:l,onPickEdge:a,liveOf:u,holding:m=!1,provisional:f,focusId:b=null,beside:h=!1}){let[y,E]=(0,ge.useState)(0),[S,w]=(0,ge.useState)(null),x=e.t<1,A=(0,ge.useRef)(""),O=(0,ge.useRef)([]),T=(0,ge.useRef)(new Map),$=()=>[...d.current?.querySelectorAll("[data-graview-relation] > span")??[]].map(I=>{let D=I.getBoundingClientRect();return`${Math.round(D.left)},${Math.round(D.top)},${Math.round(D.width)}`}).join(" ");(0,ge.useLayoutEffect)(()=>{if(x||m)return;A.current=$(),O.current=e.nodes;let I=new Map;w(Mr(e.nodes,e.connectors,d.current,r,o,I)),T.current=I},[e,x,m,i,r,l,o,y,d]),(0,ge.useEffect)(()=>{let I=d.current;if(!(x||m||I===null))return Qa(I,T.current,()=>E(D=>D+1))},[S,x,m,d]),(0,ge.useEffect)(()=>{if(x||m||r||typeof requestAnimationFrame>"u")return;let I=requestAnimationFrame(()=>{$()!==A.current&&E(D=>D+1)});return()=>cancelAnimationFrame(I)},[S]);let g=e.nodes.map(I=>I.id).join(`
|
|
4
|
+
`);(0,ge.useLayoutEffect)(()=>{let I=d.current;if(I===null||typeof window>"u")return;let D=0,N=()=>{D===0&&(D=requestAnimationFrame(()=>{D=0,E(P=>P+1)}))};I.addEventListener("scroll",N,{capture:!0,passive:!0}),window.addEventListener("resize",N,{passive:!0});let Q=typeof ResizeObserver>"u"?null:new ResizeObserver(N);if(Q){Q.observe(I);for(let P of I.querySelectorAll("[data-graview-view]"))Q.observe(P)}return()=>{D!==0&&cancelAnimationFrame(D),I.removeEventListener("scroll",N,{capture:!0}),window.removeEventListener("resize",N),Q?.disconnect()}},[d,g]);let M=(0,ge.useRef)(new WeakMap);(0,ge.useEffect)(()=>{let I=d.current;if(x||m||I===null||typeof ResizeObserver>"u")return;let D=0,N=new ResizeObserver(Q=>{let P=!1;for(let{target:j,contentRect:z}of Q){let re=`${Math.round(z.width)}x${Math.round(z.height)}`;M.current.has(j)&&M.current.get(j)!==re&&(P=!0),M.current.set(j,re)}P&&D===0&&(D=requestAnimationFrame(()=>{D=0,E(j=>j+1)}))});for(let Q of I.querySelectorAll("[data-graview-view]")){let P=xo(Q);P!==Q&&N.observe(P)}return()=>{D!==0&&cancelAnimationFrame(D),N.disconnect()}},[S,x,m,d]);let[L,C]=(0,ge.useState)(null),V=(S??[]).some(I=>I.tie!==void 0);if((0,ge.useEffect)(()=>{let I=d.current;if(!V||I===null)return;let D=Q=>{let P=Q.target?.closest?.("[data-graview-pick], [data-graview-view]");C(P?.getAttribute("data-graview-pick")??P?.getAttribute("data-graview-view")??null)},N=()=>C(null);return I.addEventListener("pointerover",D),I.addEventListener("focusin",D),I.addEventListener("pointerleave",N),I.addEventListener("focusout",N),()=>{I.removeEventListener("pointerover",D),I.removeEventListener("focusin",D),I.removeEventListener("pointerleave",N),I.removeEventListener("focusout",N)}},[V,d]),x)return null;let q=(S&&m?Xa(S,O.current,e.nodes):S)??Mr(e.nodes,e.connectors,null,r,o),ie=new Set;for(let I of q){if(I.edges.length===1){let D=I.edges[0];ie.add(`${I.connector.kind}|${D.from}|${D.to}`);continue}for(let D of I.edges)(I.connector.from===D.from||I.connector.to===D.to)&&ie.add(`${I.connector.kind}|${D.from}|${D.to}`)}return(0,ke.jsxs)(ke.Fragment,{children:[(0,ke.jsx)(qa,{strands:q,result:e,scheme:o,overview:r,selection:i,emphasis:s,stageRef:d,onPickEdge:a,liveOf:u,pointed:L,...f?{provisional:f}:{}}),r&&Nn(i,{overview:r,focusId:b,beside:h},I=>c.graph.getNode(I)?.kind).records.length>0?(0,ke.jsx)(ge.Suspense,{fallback:null,children:(0,ke.jsx)(Nd,{frame:e,width:t,height:n,stageRef:d,tick:y,store:c,graphVersion:l,selection:i,view:{overview:r,focusId:b,beside:h},rulers:f?{...es,unsureOf:(I,D,N)=>f.get(Yt(I,D,N))}:es})}):null,r?null:(0,ke.jsx)(Bd,{...f?{provisional:f}:{},stageRef:d,nodes:e.nodes,scheme:o,selection:i,store:c,graphNodes:l,overview:r,width:t,height:n,onPickEdge:a,alreadyDrawn:ie,tick:y})]})}var es={visibleRect:mn,clipQuadratic:Vn,unsureDash:Cn,unsureOpacity:Tn},Id=Ln(nn(()=>(__graviewPreload(import.meta.url,["./chunk.OJY7VJ7D.js","./chunk.WSDJPXJD.js","./chunk.F4VB6Q2W.js","./chunk.FFOD5B4B.js","./chunk.Z7Y3R3YR.js","./chunk.YXEO3Y65.js","./chunk.MODLZJD4.js","./chunk.SDO3U72B.js","./chunk.6HY6ZGEE.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.5FNFRVTL.js")))),Nd=Id.part((e,t)=>(0,ke.jsx)(e.RecordLinks,{...t}),{what:"The links",quiet:!0}),Hd=44;function Bd({stageRef:e,nodes:t,scheme:n,selection:o,store:r,graphNodes:i,overview:s,width:d,height:c,onPickEdge:l,alreadyDrawn:a,tick:u,provisional:m}){let f=zt(),b=(0,ge.useMemo)(()=>{if(o.length===0||o.length>4)return[];let g=new Set(o),M=[];for(let C of o){let V=Ft(C);V&&M.push({kind:V.kind,self:V.from,other:V.to})}for(let C of r.graph.allEdges()){let V=g.has(C.from)?C.from:g.has(C.to)?C.to:null;if(!V)continue;let q=V===C.from?C.to:C.from;g.has(q)||M.push({kind:C.kind,self:V,other:q})}if(M.length<=14)return M;let L=new Set(t.map(C=>C.id));return M.map((C,V)=>({tie:C,index:V,real:L.has(C.other)?0:1})).sort((C,V)=>C.real-V.real||C.index-V.index).slice(0,14).map(({tie:C})=>C)},[r,o,i,t]),h=()=>{if(b.length===0||typeof document>"u")return[];let g=e.current?.getBoundingClientRect();if(!g)return[];let M=[...e.current?.querySelectorAll("[data-graview-joins]")??[]].find(P=>{if(P.closest("[data-graview-offstage]"))return!1;try{let j=JSON.parse(P.getAttribute("data-graview-joins")??"[]");return j.length===o.length&&j.every(z=>o.includes(z))}catch{return!1}});if(M){let P=mn(M,e.current);if(!P)return[];let j=[];for(let z of o){let re=t.find(H=>H.id===z);if(!re)continue;let v=Ve(e.current,re.id,s)??ht(re,n),R=v?Sr(P,v):null;if(!v||!R)continue;let k=[...r.graph.allEdges()].find(H=>H.from===z&&o.includes(H.to)||H.to===z&&o.includes(H.from));j.push({key:`join:${z}`,self:z,other:"",others:1,kind:k?.kind??"",endX:R.to.x,endY:R.to.y,...R,fromBox:P,toBox:v,proxy:!1,edgeId:k?Yt(k.kind,k.from,k.to):null})}return j}let L=(P,j)=>{let z=e.current?.querySelectorAll(`[data-graview-pick="${CSS.escape(P)}"], [data-graview-slot="${CSS.escape(P)}"]`),re=[];for(let v of z??[]){if(v.closest("[data-graview-offstage]")||j(v)||v.closest("[data-graview-mark]"))continue;let R=mn(v,e.current);R&&re.push(R)}return re.sort((v,R)=>v.width*v.height-R.width*R.height)},C=P=>t.find(j=>j.id===P)??t.find(j=>j.aggregate?.memberIds.includes(P)),V=P=>`[data-graview-pick="${CSS.escape(P)}"], [data-graview-slot="${CSS.escape(P)}"]`,q=(P,j)=>{let z=e.current;if(!z)return!1;for(let re of z.querySelectorAll("[data-graview-view]")){let v=re.querySelector(V(P));if(v===null||v.closest("[data-graview-offstage]"))continue;let R=re.querySelector(V(j));if(R!==null&&!R.closest("[data-graview-offstage]"))return!0}return!1},ie=[];if(!s&&e.current){for(let j of t){if(Math.round(j.plane)!==1)continue;let z=Ve(e.current,j.id,!1);z&&ie.push(z)}let P=e.current;ie.push(...Ho(P,g,t,j=>Ve(P,j,!1)))}let I=new Map,D=[];for(let P of b){if(q(P.self,P.other))continue;let j=C(P.self),z=j?e.current?.querySelector(`[data-graview-view="${CSS.escape(j.id)}"]`):null,re=!s&&j?.id===P.self&&Math.round(j.plane)===1?Ve(e.current,j.id,!1):null,v=re?[re]:L(P.self,()=>!1);if(!(v.length>0)&&j){let J=Ve(e.current,j.id,!1)??ht(j,n);J&&v.push(J)}let k=t.find(J=>J.id===P.other),H=[],F=!1;if(k){let J=Ve(e.current,k.id,s)??ht(k,n);J&&H.push(J)}else if(H.push(...L(P.other,J=>z?z.contains(J):!1)),H.length===0){let J=C(P.other);if(J&&(!j||J.id!==j.id)){let se=Ve(e.current,J.id,s)??ht(J,n);se&&(H.push(se),F=!0)}}if(v.length===0||H.length===0||F&&s)continue;let W=v[0],Y=H[0],_=1/0;for(let J of v)for(let se of H){let at=Math.hypot(J.x+J.width/2-(se.x+se.width/2),J.y+J.height/2-(se.y+se.height/2));at<_&&(_=at,W=J,Y=se)}if(a?.has(`${P.kind}|${P.self}|${P.other}`)||a?.has(`${P.kind}|${P.other}|${P.self}`))continue;let Z=`${P.kind}:${Math.round(W.x)},${Math.round(W.y)}:${Math.round(Y.x)},${Math.round(Y.y)}`,oe=I.get(Z);if(oe){oe.others+=1;continue}let K=Sr(W,Y);if(!K)continue;let{from:pe,control:ye}=K,ue=re&&W===re?pn(W,Y,ie,D.length):void 0,Me=ue?ue[ue.length-1]:K.to,De=[...r.graph.allEdges()].find(J=>J.kind===P.kind&&(J.from===P.self&&J.to===P.other||J.from===P.other&&J.to===P.self)),te={key:`${P.kind}:${P.self}:${P.other}`,self:P.self,other:P.other,others:1,kind:P.kind,endX:Me.x,endY:Me.y,from:pe,to:Me,control:ye,fromBox:W,toBox:Y,...ue?{points:ue}:{},proxy:F,edgeId:De?Yt(De.kind,De.from,De.to):null};I.set(Z,te),D.push(te)}let N=s?void 0:t.find(P=>Math.round(P.plane)===0&&!P.aggregate),Q=P=>{let j=t.find(z=>z.id===P.other)??t.find(z=>z.aggregate?.memberIds.includes(P.other));return j!==void 0&&Math.round(j.plane)===1&&j.via?.edgeKind===P.kind};for(let P of D){if(N&&(P.self!==N.id||Q(P)))continue;let j=[...r.graph.allEdges()].find(H=>H.kind===P.kind&&(H.from===P.self&&H.to===P.other||H.from===P.other&&H.to===P.self)),z=r.graph.getNode(P.self),re=r.graph.getNode(P.other);if(!j||!z||!re)continue;let v=j.from===P.self?"out":"in",R=ui(r.schema,v==="out"?z.kind:re.kind,P.kind,v),k=P.proxy?(v==="out"?r.graph.out(P.self,P.kind):r.graph.in(P.self,P.kind)).filter(H=>H.kind===re.kind).length:1;P.said=P.proxy?`${R}: ${tn(r.schema,re.kind,Math.max(k,P.others))}`:`${R}: ${en(r.schema.tryDefinition(re.kind),re)}`}return D},[y,E]=(0,ge.useState)([]),[S,w]=(0,ge.useState)([]);(0,ge.useLayoutEffect)(()=>{let g=h();E(g),w(g.some(M=>M.said)?x(g):[])},[b,t,s,n,d,c,a,u,e]);let x=g=>{let M=e.current;if(!M)return[];let L=[];for(let C of M.querySelectorAll("[data-graview-view]")){let V=[...C.children].find(ie=>!ie.classList.contains("graview-kind-tag")),q=V?mn(V,M):null;q&&L.push({box:q,title:{...q,height:Math.min(q.height,Hd)}})}return Ja(g.flatMap(C=>C.said?[{key:C.key,said:C.said,end:{x:C.endX,y:C.endY},far:C.toBox}]:[]),L,{width:d,height:c})},[A,O]=(0,ge.useState)(()=>new Set),T=(0,ge.useRef)([]);T.current=y.map(g=>({key:g.key,fromBox:g.fromBox,toBox:g.toBox,ids:[g.self,g.other],edgeId:g.edgeId}));let $=S.length>0;return(0,ge.useEffect)(()=>{let g=e.current;if(!g||!$)return;let M=N=>O(Q=>Q.size===N.size&&[...N].every(P=>Q.has(P))?Q:N),L=0,C=null,V=()=>{if(L=0,!C)return;let N=g.getBoundingClientRect(),Q=C.target instanceof Element?C.target:null;M(Bo(T.current,{point:{x:C.clientX-N.left,y:C.clientY-N.top},edgeId:Q?.closest("[data-graview-edge]")?.getAttribute("data-graview-edge")??null}))},q=N=>{C=N,L||(L=requestAnimationFrame(V))},ie=()=>{C=null,M(new Set)},I=N=>{let Q=N.target instanceof Element?N.target:null;if(!Q)return;let P=g.getBoundingClientRect(),j=Q.getBoundingClientRect(),z=Q.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??Q.closest("[data-graview-view]")?.getAttribute("data-graview-view");M(Bo(T.current,{...z?{ids:[z]}:{},box:{x:j.left-P.left,y:j.top-P.top,width:j.width,height:j.height}}))},D=N=>{N.relatedTarget instanceof Node&&g.contains(N.relatedTarget)||M(new Set)};return g.addEventListener("pointermove",q,{passive:!0}),g.addEventListener("pointerleave",ie),g.addEventListener("focusin",I),g.addEventListener("focusout",D),()=>{L&&cancelAnimationFrame(L),g.removeEventListener("pointermove",q),g.removeEventListener("pointerleave",ie),g.removeEventListener("focusin",I),g.removeEventListener("focusout",D)}},[e,$]),y.length===0?null:(0,ke.jsxs)(ke.Fragment,{children:[(0,ke.jsx)("svg",{"aria-hidden":y.some(g=>g.edgeId)?void 0:!0,"data-graview-ties":y.length,"data-graview-world":"",width:d,height:c,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:We.lines},children:y.map(g=>{let{connector:M,style:L}=ln(f,g.kind);if(!M.visible)return null;let C=g.edgeId?m?.get(g.edgeId):void 0,V={p0:g.from,c:g.control,p1:g.to},q=g.points?Oo(g.points,10):M.route==="orthogonal"?Ct([Wn(g.from,g.to)]):(({p0:I,c:D,p1:N})=>`M ${I.x} ${I.y} Q ${D.x} ${D.y} ${N.x} ${N.y}`)(xr(M.route,V)),ie=null;if(g.edgeId&&l&&!g.proxy){let I=(N,Q)=>Q.x>=N.x&&Q.x<=N.x+N.width&&Q.y>=N.y&&Q.y<=N.y+N.height,D=g.points?[...g.points]:[];for(let N=0;N<=(g.points?-1:40);N++){let Q=Da(M.route,V,N/40);I(g.fromBox,Q)||I(g.toBox,Q)||D.push(Q)}D.length>=2&&(ie=(0,ke.jsx)("path",{"data-graview-edge":g.edgeId,className:"graview-edge-hit",d:`M ${D[0].x} ${D[0].y} ${D.slice(1).map(N=>`L ${N.x} ${N.y}`).join(" ")}`,fill:"none",pathLength:1,strokeDasharray:"0.86",strokeDashoffset:-.07,stroke:"transparent",strokeWidth:14,style:{pointerEvents:"stroke",cursor:"pointer"},onClick:N=>{N.stopPropagation(),l(g.edgeId,{x:N.clientX,y:N.clientY})},onContextMenu:N=>{N.altKey||(N.preventDefault(),N.stopPropagation(),l(g.edgeId,{x:N.clientX,y:N.clientY}))},children:C!==void 0?(0,ke.jsx)("title",{children:C}):null}))}return(0,ke.jsxs)("g",{opacity:(g.proxy?.32:.72)*(C!==void 0?Tn:1),children:[(0,ke.jsx)("path",{"data-graview-tie":g.kind,"data-graview-tie-proxy":g.proxy||void 0,"data-graview-provisional":C!==void 0||void 0,d:q,fill:"none",stroke:an(L),strokeWidth:g.proxy?1.1:1.6,strokeDasharray:C!==void 0?Cn:ir[L.pattern],strokeLinecap:"round"}),(0,ke.jsx)("circle",{cx:g.endX,cy:g.endY,r:g.proxy?2:2.6,fill:an(L)}),ie]},g.key)})}),(0,ke.jsx)("div",{"aria-hidden":"true","data-graview-world":"",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:We.tieLabels},children:S.map(g=>{let M=y.find(L=>L.key===g.keys[0]);return(0,ke.jsx)("span",{className:"graview-record-link-said","data-graview-link-said":M?.kind,"data-graview-lands":M?.proxy?"district":"record","data-graview-said-for":g.keys.length,"data-graview-tie-said":g.keys.some(L=>A.has(L))?"shown":"waiting",style:{position:"absolute",left:g.x,top:g.y,transform:`translateX(min(0px, calc(${Math.round(d-g.x-8)}px - 100%)))`},children:g.said},g.said)})})]})}function ts(){return typeof document>"u"?1:parseFloat(getComputedStyle(document.documentElement).fontSize)/16||1}function os({nodes:e,scheme:t,width:n,stageRef:o,moving:r=!1,holding:i=!1}){let s=zt(),[d,c]=(0,ge.useState)([]);(0,ge.useLayoutEffect)(()=>{r||i||c(l())},[e,r,i,t,n,o]);function l(){let u=[],m=[];for(let y of e){if(!y.via||Math.round(y.plane)!==1)continue;let E=Ve(o.current,y.id,!1,!0),{scale:S}=on(1,t);u.push({key:`${y.via.edgeKind}|${y.via.direction}`,text:Hn(y.via),left:E?.x??y.x,right:E?E.x+E.width:y.x+y.width*S,top:E?.y??y.y}),m.push(Math.round(y.y))}let f=new Map;u.forEach((y,E)=>f.set(m[E],Math.min(f.get(m[E])??1/0,y.top)));let b=u.map((y,E)=>({...y,top:f.get(m[E])??y.top})),h=Er(n);return io(b,{left:h.left,right:n-h.right},ts())}if(d.length===0||!s.captions.visible||r)return null;let a=oo*ts();return(0,ke.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:We.lines},children:d.map(u=>{let{left:m,width:f}=u;return(0,ke.jsx)("div",{"data-graview-relation":u.key,title:u.text,style:{position:"absolute",left:m,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,ke.jsx)("span",{style:{background:"var(--graview-ground)",padding:"1px 7px",borderRadius:4},children:u.text})},u.key)})})}var Xt=ae(Pe(),1);var $d=new Set;function as(e,t,n,o,r,i,s=0,d=0){let{store:c,views:l,hiddenKinds:a}=xe(),u=jt(),m=(0,Xt.useContext)(rn),f=jr(),b=(0,Xt.useMemo)(()=>{let S={};for(let w of f){if(w.subjectId===void 0)continue;let x=S[w.subjectId]??=[];for(let A of w.nodeIds)A!==w.subjectId&&!x.includes(A)&&x.push(A)}return S},[f]),h=(0,Xt.useMemo)(()=>({flagged:new Set(f.flatMap(S=>S.nodeIds)),touched:ar(c.log.all())}),[f,c,i]),y=(0,Xt.useMemo)(()=>({hits:u?or(u):$d,...h}),[u,h]),E=(t?.width??1200)-r.right<640;return(0,Xt.useMemo)(()=>({...e,cityZoom:o,...m?{besideTheMap:!0}:{},...a.size>0?{hiddenKinds:[...a].sort()}:{},...Object.keys(b).length>0?{judged:b}:{},relevance:y,inset:E?{left:8,right:8,top:8,bottom:0}:{...Er((t?.width??1200)-r.right),top:8,bottom:0},chrome:[{x:(t?.width??1200)-r.right-176,y:0,width:176,height:100},{...Wd(t,r),...r.bottom>0?{onSheet:!0}:{}}],...r.right>0||r.bottom>0?{dock:r}:{},...E||s>0?{headroom:E?Math.max(s,Fd):s}:{},unit:n,plainGroups:c.schema.kinds.filter(S=>qo(l.lookup(S,{cardinality:"many",fidelity:"full"}))),cityOrder:Vo(Mi({name:"scene",schema:c.schema,mutations:c.allMutations().filter(S=>!S.derived)}).order.map(S=>S.kind),l.arrangement?.()?.order),screens:l.places().reduce((S,w)=>((S[w.kind]??=[]).push({as:w.as,title:w.title,...w.across?{across:w.across}:{}}),S),{}),...t?{width:t.width,height:Math.max(0,t.height-Math.max(64,d))}:{}}),[e,t,n,c,l,a,b,y,o,m,r.right,r.bottom,s,d,E])}var Fd=60,is=224;function Wd(e,t){let n=e?.width??1200,o=e?.height??800,r=58;return{x:n-t.right-is,y:o-t.bottom-r,width:is,height:r}}var bt=ae(Pe(),1);var ss=ae(Pe(),1);function Rr(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 ds(e){(0,ss.useEffect)(()=>{let t=e.current;if(!t)return;let n=()=>{for(let i of t.querySelectorAll("[data-graview-pick]"))i.getAttribute("tabindex")===null&&i.setAttribute("tabindex","0"),i.getAttribute("role")===null&&Vd(i)&&i.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 jd=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 jd.has(e.localName.toLowerCase())}var yn=ae(Oe(),1);function ls({node:e,useDom:t,blur:n,touched:o,frontY:r,centerY:i,screen:s,onDrawnHeight:d,crowded:c,activity:l,scheme:a,canvasWidth:u,canvasHeight:m,selected:f,onSelect:b,onPick:h,onTravel:y,onMenu:E,selection:S,onJackIn:w,onDragStart:x,onDragMove:A,onDragEnd:O,onDragCancel:T,swallowClick:$,children:g}){let{brand:M,store:L,actsDoor:C}=xe(),V=e.beyond?`${e.beyond.length} more district${e.beyond.length===1?"":"s"}`:e.aggregate?.opens?.in==="place"?`${e.aggregate.label}, ${tn(L.schema,e.aggregate.kind,e.aggregate.memberIds.length)}`:e.aggregate?e.aggregate.label:(()=>{let k=L.graph.getNode(e.id);return k?en(L.schema.tryDefinition(e.kind),k):e.id})(),[q,ie]=(0,bt.useState)(null),I=Math.round(e.plane)===0&&!e.aggregate;(0,bt.useLayoutEffect)(()=>{if(!I)return;let k=j.current;if(!k)return;let H=()=>{let W=[...k.children].find(K=>K.dataset.graviewKindtag===void 0);if(!W)return;let Y=k.getBoundingClientRect(),_=W.getBoundingClientRect(),Z=k.offsetWidth>0?Y.width/k.offsetWidth:1,oe={top:Math.round((_.top-Y.top)/Z)-9,right:Math.round((Y.right-_.right)/Z)+14};ie(K=>K&&K.top===oe.top&&K.right===oe.right?K:oe)};if(typeof ResizeObserver>"u"){H();return}let F=new ResizeObserver(H);F.observe(k);for(let W of k.children)F.observe(W);return()=>F.disconnect()},[I,e.id]);let D=ti({plane:e.plane,...e.depth!==void 0?{depth:e.depth}:{},onPlot:r!==void 0},a),N=D.style,Q=ei(N,e.x,e.y,u,m),P=n?D.blur:0,j=(0,bt.useRef)(null);ds(j);let z=e.natural,re=z?Math.min(e.width/z.width,e.height/z.height):1,v=(0,bt.useRef)(null);(0,bt.useEffect)(()=>{if(!s||!d)return;let k=v.current;if(!k||typeof ResizeObserver>"u")return;let H=()=>{let Z=0,oe=0;for(let K of k.children)if(!(!(K instanceof HTMLElement)||K.classList.contains("graview-screen-fullscreen"))){Z=Math.max(Z,K.offsetTop+K.offsetHeight);for(let pe of[K,...K.querySelectorAll("*")]){let ye=getComputedStyle(pe).overflowY;(ye==="auto"||ye==="scroll")&&(oe+=pe.scrollHeight-pe.clientHeight)}}d(Z+oe)},F=0,W=()=>{F||(F=requestAnimationFrame(()=>{F=0,H()}))};H();let Y=new ResizeObserver(W);Y.observe(k);for(let Z of k.children)Y.observe(Z);let _=new MutationObserver(W);return _.observe(k,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),()=>{F&&cancelAnimationFrame(F),Y.disconnect(),_.disconnect(),d(void 0)}},[s,d,e.id]);let R=t?{transform:Ha(Q),transformOrigin:"0 0",filter:P>0?`blur(${P}px)`:void 0,opacity:ni(N)*(e.opacity??1),"--graview-lift-low":Mo(N.shadow,a),...r!==void 0?{"--graview-front-y":`${r.toFixed(1)}px`}:{},...i!==void 0?{"--graview-center-y":`${i.toFixed(1)}px`}:{}}:{"--graview-lift-low":Mo(N.shadow,a)};return(0,yn.jsxs)("div",{ref:j,"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":s?"":void 0,"data-graview-record-focus":Math.round(e.plane)===0&&!e.aggregate&&!z&&!s?"":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":l?l.manner:void 0,"data-graview-wrote":l?.wrote||void 0,"data-graview-read":l&&!l.wrote?!0:void 0,"data-graview-broke":l?.broke||void 0,title:l?`${va[l.manner]} ${l.wrote?"changed this":"read this"}: ${l.intent}`:e.aggregate&&Math.round(e.plane)!==0?`Open ${e.aggregate.label}`:void 0,role:"group","aria-label":V,"aria-keyshortcuts":C&&!e.beyond?C.key:void 0,tabIndex:0,onPointerDown:x,onPointerMove:A,onPointerUp:O,onPointerCancel:T??O,onClick:k=>{if($.current)return;let H=k.target?.closest("input, textarea, select, button, a[href], [contenteditable='true']");if(H&&!H.hasAttribute("data-graview-pick"))return;let F=k.metaKey||k.shiftKey,W=Ot(k.target);if(W&&W!==e.id){k.stopPropagation(),h(W,F,Rr(k.target)??void 0);return}b(F)},onKeyDown:k=>{if(C&&!e.beyond&&k.key.toLowerCase()===C.key.toLowerCase()&&!k.metaKey&&!k.ctrlKey&&!k.altKey&&!k.target?.closest("input, textarea, select, [contenteditable='true']")){k.preventDefault(),k.stopPropagation();let _=Ot(k.target)??e.id;S.includes(_)||h(_,!1),C.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 F=Ot(k.target);if(k.preventDefault(),k.stopPropagation(),!F||F===e.id){S.length===1&&S[0]===e.id&&!k.metaKey&&!k.shiftKey?w():b(k.metaKey||k.shiftKey);return}let W=Rr(k.target);(W?S.length===W.length&&W.every(_=>S.includes(_)):S.length===1&&S[0]===F)&&!k.metaKey&&!k.shiftKey?y(F):h(F,k.metaKey||k.shiftKey,W??void 0)},onContextMenu:k=>{if(k.altKey)return;let H=Ot(k.target);k.preventDefault(),k.stopPropagation();let F=H&&H!==e.id||!e.aggregate?null:Ko(k.target,k.currentTarget,(K,pe)=>L.graph.neighbors(K).some(ye=>ye.id===pe),e.id),W=H&&H!==e.id?H:F??e.id;h(W,!1,(W===H?Rr(k.target):null)??void 0);let Y=k.nativeEvent.composedPath?.()[0],{clientX:_,clientY:Z}=k,oe=()=>{let K=bi(Y);E({x:_,y:Z,on:W,...K?{section:K,title:K.name}:{}})};xi(Y)?wi().then(oe,oe):oe()},onDoubleClick:k=>{let H=Ot(k.target);if(H&&H!==e.id){k.stopPropagation(),y(H);return}w()},style:{position:"absolute",...t?{}:{pointerEvents:"none"},zIndex:e.opened?We.opened:We.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",...R},children:[z?(0,yn.jsx)("div",{ref:v,"data-graview-natural":`${Math.round(z.width)}x${Math.round(z.height)}`,style:{position:"absolute",left:"50%",top:"50%",width:z.width,height:z.height,transform:`translate(-50%, -50%) scale(${re})`,transformOrigin:"50% 50%",display:"flex",flexDirection:"column"},children:g}):g,Math.round(e.plane)===0&&!e.aggregate?(0,yn.jsxs)("span",{"data-graview-kindtag":"",className:"graview-kind-tag","aria-hidden":"true",style:{...q??{},"--graview-hue":Math.round(Rn(e.kind,M?.accents))},children:[(0,yn.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(Rn(e.kind,M?.accents))} 55% var(--graview-tint-lightness) / 0.9)`}}),Fo(L.schema.tryDefinition(e.kind),e.kind)]}):null]})}var fe=ae(Oe(),1);Wr({search:Ri,touchWeights:ar});var Gd=e=>e?{activity:e}:{},zd=e=>`${Math.round(e.x)} ${Math.round(e.y)}`,cs=e=>e.stopPropagation(),Or=.6,Ar=3,Yd=80,us=e=>Math.round(e.plane)===1&&(e.compact===!0||e.width<175||e.height<Yd);function _d(e){let[t,n]=(0,U.useState)(1),o=(0,U.useRef)(1);return(0,U.useEffect)(()=>{e||(o.current=1,n(1))},[e]),[t,o,n]}function Kd(e){let[t,n]=(0,U.useState)({x:0,y:0}),o=(0,U.useMemo)(()=>({x:(e.pan?.x??0)+t.x,y:(e.pan?.y??0)+t.y}),[e.pan,t]),r=(0,U.useMemo)(()=>t.x===0&&t.y===0?e:ct(e,o),[e,t,o]),i=(0,U.useRef)(t);i.current=t;let s=(0,U.useCallback)((d,c)=>{let l=i.current,a=(u,m,f)=>Math.max(Math.min(-u,m),Math.min(Math.max(u,m),f+m))-m;return{x:a(d.x,l.x,c.x),y:a(d.y,l.y,c.y)}},[]);return[o,r,s,i,n]}function Ud(e,t,n,o,r,i){let s=n!==null&&!t.overview,d=s?null:n,c=(0,U.useRef)(t);Jr(c.current,t)||(c.current=t);let l=c.current,a=(0,U.useMemo)(()=>{let h=l.pan?{...l,pan:void 0}:l;return d?In(h,d.id,{x:d.x,y:d.y}):h},[l,d]),u=(0,U.useRef)(void 0),m=(0,U.useMemo)(()=>{let h=u.current?.stood,y=mr(e.graph,e.schema,a,h?{...o,cityStood:h}:o);return u.current=y.city,y},[e,a,o,r]),f=(0,U.useMemo)(()=>n&&s?uo(m,n.id,{x:n.x,y:n.y})??mr(e.graph,e.schema,In(a,n.id,{x:n.x,y:n.y}),o):m,[m,n,s,e,a,o]);return[(0,U.useMemo)(()=>ho(f,i??{x:0,y:0}),[f,i]),s]}function Xd(e,t){let n=(0,U.useRef)(!1),o=(0,U.useRef)(!1),r=(0,U.useRef)(null),i=(0,U.useRef)(!1),s=(0,U.useCallback)(()=>{qd(e.current,{dragging:n.current,steering:o.current}),t.set(n.current||o.current||i.current)},[e,t]),d=(0,U.useCallback)(u=>{n.current!==u&&(n.current=u,s())},[s]),c=(0,U.useRef)(()=>!1),l=(0,U.useCallback)(()=>{o.current||(o.current=!0,s()),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=null,!c.current()&&(o.current=!1,s())},160)},[s]),a=(0,U.useCallback)(()=>{n.current=!1,o.current=!1,s()},[s]);return{dragging:n,steering:o,tweening:i,setDragging:d,steer:l,settleLive:c,settled:a}}function qd(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 Qd(e){let t=(0,U.useRef)(!1),n=e!==null&&!t.current;return(0,U.useEffect)(()=>{e!==null&&(t.current=!0)},[e]),n}function Zd({registerScene:e,scheme:t,views:n},o,r){let i=(0,U.useRef)(o);i.current=o,(0,U.useEffect)(()=>(e({whereIs:s=>br(i.current,r.current,t,n,s)}),()=>e(null)),[e,t,n])}function Jd(e,t){(0,U.useEffect)(()=>{let n;return e.onActive(o=>{let r=t.current;if(!r)return;let i=c=>{let l=r.getBoundingClientRect();e.set({x:c.clientX-l.left,y:c.clientY-l.top})},s=c=>{c.buttons===0&&i(c)},d=()=>e.set(null);o?(r.addEventListener("pointermove",s),r.addEventListener("pointerup",i),r.addEventListener("pointerleave",d),n=()=>{r.removeEventListener("pointermove",s),r.removeEventListener("pointerup",i),r.removeEventListener("pointerleave",d)}):(n?.(),n=void 0)})},[e])}function el(e,t,n,o,r,i,s,d){(0,U.useEffect)(()=>{let c=t.current;if(!c||!e)return;let l=new Set;for(let u of n.nodes)(o.has(u.id)||u.aggregate?.memberIds.some(m=>o.has(m)))&&l.add(u.id);let a=e({canvas:c,layout:n,dirty:l,hostOf:u=>(c.parentElement??c).querySelector(`[data-graview-view="${CSS.escape(u)}"]`),drawOnDom:r,blur:i,scheme:s,fallBack:d});return()=>{a?.()}},[e,n,o,r,i,s,d])}var tl=nn(()=>(__graviewPreload(import.meta.url,["./chunk.OJGHDWI6.js","./chunk.6HY6ZGEE.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZBVYD4OX.js")));function nl(e,t){let[n]=(0,U.useState)(()=>{let a=oi();return t?e==="dom"||e==="auto"&&a==="dom"?"dom":"gpu":ai(e,{operator:a,present:ii()})}),[o,r]=(0,U.useState)(!1),i=(0,U.useCallback)(()=>r(!0),[]),[s,d]=(0,U.useState)(null),c=n==="gpu"&&!t&&!o&&s===null;return(0,U.useEffect)(()=>{if(!c)return;let a=!0;return tl().then(u=>{a&&d(()=>u.attachGpu())},()=>{a&&r(!0)}),()=>{a=!1}},[c]),{attach:(n==="gpu"&&!o?t??s:null)??null,fallBack:i}}function rl(){let[e,t]=(0,U.useState)(()=>new Set),n=(0,U.useCallback)(o=>{t(r=>r.size===o.size&&[...o].every(i=>r.has(i))?r:new Set(o))},[]);return[e,n]}function ol(){let e=hi();return t=>{let n=t?e.get(t.id):void 0,o=t?.aggregate?.memberIds??[];if(!n&&o.length===0)return;let r=n,i=n?.wrote??!1,s=n?.read??!1,d=n?.broke??!1;for(let c of o){let l=e.get(c);l&&(i||=l.wrote,s||=l.read,d||=l.broke,(!r||l.at>r.at||l.at===r.at&&l.wrote&&!r.wrote)&&(r=l))}return r?{...r,wrote:i,read:s,broke:d}:void 0}}var hs=(e,t)=>e.includes(t)?e.filter(n=>n!==t):[...e,t];function il(){let{views:e,view:t,setView:n,setSelection:o}=xe(),r=jt(),i=(0,U.useContext)(rn),s=d=>{if(He(d.id)===null&&!d.aggregate)return!1;let c=e.resolve(d.kind,{cardinality:"many",fidelity:"full"})?.view;return c!==void 0&&c.generic!==!0};return d=>({onSelect:c=>{if(Pn(d.id)){o(a=>c?hs(a,d.id):[d.id]);return}let l=d.aggregate?An(d.id):[];if(t.overview){o(a=>c?[...new Set([...a,d.id])]:[d.id]);return}if(l.length===1&&!c&&Math.round(d.plane)!==0){let a=l[0];n(u=>Hr(u,u.relation===a?null:a));return}o(a=>So(d,a,c))},onPick:(c,l,a)=>o(u=>a?l?[...new Set([...u,...a])]:[...a]:l?hs(u,c):[c]),onTravel:c=>{n(l=>({...Et(l,c),relation:null})),o([c])},onJackIn:()=>{let c=d.aggregate?.opens;if(c){c.in==="place"?n(u=>Br(u,d.id)):n(u=>Object.entries(c.within).reduce((m,[f,b])=>nr(m,f,b),Et(On(u,!1),c.focus))),o([]);return}let l=He(d.id),a=l!==null&&(r?.byKind[l]??0)>0;if(i&&l!==null&&t.overview&&!s(d)&&!(a&&t.q)){n(u=>nr({...Et(u,`aggregate:${l}`),relation:null},"view",null)),o([]);return}n(u=>Dr(u,d.id,{ownPicture:s(d),...a&&u.q?{carry:u.q}:{}})),o(d.aggregate?[]:[d.id])}})}var al=Ln(nn(()=>(__graviewPreload(import.meta.url,["./chunk.HJCQ6I3S.js","./chunk.OJY7VJ7D.js","./chunk.KACSYPEV.js","./chunk.GEFXU4VO.js","./chunk.WSDJPXJD.js","./chunk.F4VB6Q2W.js","./chunk.FFOD5B4B.js","./chunk.Z7Y3R3YR.js","./chunk.YXEO3Y65.js","./chunk.MODLZJD4.js","./chunk.SDO3U72B.js","./chunk.6HY6ZGEE.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.5B5SRTUK.js")))),sl=al.part((e,t)=>(0,fe.jsx)(e.Ribbons,{...t}),{what:"The relations",quiet:!0}),fs="graview:map-from-above";function dl(){let[e,t]=(0,U.useState)(()=>{try{return globalThis.localStorage?.getItem(fs)==="1"}catch{return!1}}),n=(0,U.useCallback)(o=>{t(o);try{globalThis.localStorage?.setItem(fs,o?"1":"0")}catch{}},[]);return[e,n]}var ms=Ln(nn(()=>(__graviewPreload(import.meta.url,["./chunk.KACSYPEV.js","./chunk.GEFXU4VO.js","./chunk.OWFS2YDQ.js","./chunk.MODLZJD4.js","./chunk.SDO3U72B.js","./chunk.6HY6ZGEE.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.VGHO3VCB.js")))),ll=ms.part((e,t)=>(0,fe.jsx)(e.Plots,{...t}),{quiet:!0}),cl=ms.part((e,t)=>(0,fe.jsx)(e.WorkflowsLayer,{...t}),{quiet:!0});function ul({zoom:e,zoomBy:t,above:n,setAbove:o}){let r=(i,s,d,c)=>(0,fe.jsx)("button",{type:"button",className:"graview-zoom-button","data-testid":`zoom-${i}`,"aria-label":`Zoom ${i}`,title:`Zoom ${i} \u2014 or pinch, or ctrl+wheel`,disabled:c,onClick:()=>t(d),children:s});return(0,fe.jsxs)("div",{className:"graview-zoom","data-graview-foot":"",role:"group","aria-label":"Zoom",onPointerDown:cs,onClick:cs,children:[r("out","\u2212",1/1.25,e<=Or+1e-6),(0,fe.jsxs)("span",{className:"graview-zoom-level","data-testid":"zoom-level","aria-live":"polite",children:[Math.round(e*100),"%"]}),r("in","+",1.25,e>=Ar-1e-6),(0,fe.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 hl({options:e,renderer:t="auto",attachRenderer:n,blur:o=!0,className:r,style:i,animate:s=!0,children:d}){let c=xe(),l=c.app?c.app.workflows??Go(c.app)?.workflows:void 0,{store:a,scheme:u,views:m,view:f,setView:b,selection:h,setSelection:y,setMenuAt:E,emphasis:S,brand:w,noteMoved:x,robots:A,motion:O}=c,T=(0,U.useContext)(rn),$=(0,U.useRef)(null),g=(0,U.useRef)(null),M=Ia(g),L=Na(M),C=Ta(),{zoomAbout:V,panBy:q,pinchBy:ie,pinchDone:I,pinching:D}=ga({stage:g,view:f,setView:b}),N=Vt(),Q=1,[P,j,z]=_d(f.overview),[re,v]=dl(),R=(0,U.useMemo)(()=>re?{...e,tilt:Ai}:e,[e,re]),{probe:k,dock:H}=ha(),F=!f.overview&&(f.zoom||f.past||f.relation)?Math.ceil(14+34*C/16+6):0,W=M&&L?M.height-L.height:0,Y=(0,U.useRef)(H);W<=0&&(Y.current=H);let _=W>0?Y.current:H,Z=!!f.overview&&_.bottom>0&&_.right===0&&(h.length>0||f.focusId!==void 0),oe=as(R,L,C,Q*P,_,N,F,f.overview?0:_.bottom),K=ia(g),[pe,ye,ue,Me,De]=Kd(f),te=(0,U.useMemo)(()=>new Set(Object.keys(f.pins).filter(B=>He(B)===null)),[f.pins]),J=fa(),[se,at]=Ud(a,f,J.held,oe,N,ye.pan),Ke=Xd(g,O),{setDragging:wn,steer:Ze,settleLive:Te,settled:Tt}=Ke,Je=Ke.dragging.current||Ke.steering.current,It=Qd(L),Ue=(0,U.useRef)(()=>{}),Le=ma({stage:g,pan:f.pan,zoom:P,setView:b,settled:Tt,zoomTo:Ue}),Ie=(0,U.useRef)(!1);Le.settling.current||(Ie.current=!1);let st=Le.settling.current&&!Ie.current,ne=Qi(se,{enabled:s&&!Je&&L!==null&&!It,settle:!st});Ke.tweening.current=ne.t<1;let et=aa(g,ne.t>=1,se);(0,U.useEffect)(()=>O.set(Ke.dragging.current||Ke.steering.current||ne.t<1),[O,ne]);let pt=Zi(),bn=Ji(),xt=da({view:f,result:se,frame:ne,panned:pe,closer:Q,screenId:null,setCamera:De});Zd(c,ne,g),Jd(c.pointer,g);let[le,Ae]=rl(),{attach:dt,fallBack:Nt}=nl(t,n),$e=Xi(o);el(dt,$,ne,pt,Ae,$e,u,Nt);let tt=dt===null,qt=qi($e&&tt,ne.t<1),xn=ol();Te.current=Le.settle;let{onGroundDown:zn,onCardDown:vt,onDragMove:vn,onDragUp:kn,onDragCancel:Yn,swallow:gt}=pa({view:f,panned:pe,limit:()=>At(se),panWithin:ue,moveByTransform:!0,setView:b,setDragging:wn,noteMoved:x,shift:Le,district:J,pinching:D}),kt=Ki({swallow:gt,setMenuAt:E,setSelection:y});xa(g,gt),V.current=(B,he,be)=>{if(!f.overview)return;Te.current();let Se=j.current,Ne=Math.max(Or,Math.min(Ar,Se*B));if(Math.abs(Ne-Se)<1e-4)return;j.current=Ne,Ie.current=!0,Ze(),z(Ne);let Ge=g.current?.getBoundingClientRect(),qe=se.visible??se,Dt={x:qe.width/2,y:qe.height/2},En=Ge&&he!==void 0&&be!==void 0?{x:he-Ge.left,y:be-Ge.top}:Dt,Xn=Ne/Se;b(St=>ct(St,fr(St.pan??{x:0,y:0},Me.current,En,Dt,Xn))),x()},ie.current=(B,he,be,Se,Ne)=>{if(!f.overview)return;Ze();let Ge=g.current?.getBoundingClientRect(),qe=Ge?{x:he-Ge.left,y:be-Ge.top}:{x:0,y:0};Le.zoomBy(B,qe,Se,Ne,Or/j.current,Ar/j.current),x()},I.current=()=>{Te.current()},Ue.current=(B,he)=>{let be=j.current,Se=Math.max(Or,Math.min(Ar,be*B));j.current=Se,Ie.current=!0,z(Se);let Ne=se.visible??se,Ge={x:Ne.width/2,y:Ne.height/2};b(qe=>ct(qe,fr(qe.pan??{x:0,y:0},Me.current,he,Ge,Se/be)))};let Qt=(B,he,be=At(se))=>b(Se=>ct(Se,ue(be,{x:(Se.pan?.x??0)+B,y:(Se.pan?.y??0)+he})));ca(g,H,(B,he)=>Qt(B,he)),q.current=(B,he)=>{Ze();let be=At(se),Se=f.pan??{x:0,y:0},Ne=Le.offset();Le.shiftTo(ue(be,{x:Se.x+Ne.x+B,y:Se.y+Ne.y+he}),Se),x()};let _n=il(),Kn=zt(),Ht=(0,U.useCallback)(B=>ln(Kn,B).connector.visible,[Kn]),lt=B=>xn(ne.nodes.find(he=>he.id===B)),Sn=(B,he,be,Se)=>B.originY+pe.y+cn(be.col+be.side/Se,be.row+be.side/Se,B.cell,B.tilt).y-he.y,nt={width:se.width,height:se.height},Mn={position:"relative",zIndex:We.stage,...nt},Zt=B=>br(ne,g.current,u,m,B),Xe=B=>tt||le.has(B),Un=dr(c),Jt=B=>(0,fe.jsx)(rr.Provider,{value:Un,children:B}),Bt=ne.nodes.filter(B=>B.screenOf===void 0).map(B=>(0,fe.jsx)(ls,{node:B,crowded:us(B),useDom:Xe(B.id),blur:qt||!tt&&$e,...B.plot&&ne.city&&Math.round(B.plane)===2?{frontY:Sn(ne.city,B,B.plot,1),centerY:Sn(ne.city,B,B.plot,2)}:{},touched:pt.has(B.id),...Gd(xn(B)),scheme:u,canvasWidth:se.width,canvasHeight:se.height,selected:h.includes(B.id),..._n(B),onMenu:E,selection:h,onDragStart:he=>vt(B,he),onDragMove:vn,onDragEnd:kn,onDragCancel:Yn,swallowClick:gt,children:B.beyond?(0,fe.jsx)(Oa,{kinds:B.beyond}):B.aggregate?.opens?(0,fe.jsx)(Ca,{node:B}):(0,fe.jsx)(Pa,{node:B,mode:"scene",selected:h.includes(B.id),...us(B)?{fidelity:"glyph"}:{}})},B.id));return(0,fe.jsxs)("div",{ref:g,className:`graview-ground${r?` ${r}`:""}`,"data-graview-altitude":f.overview?"":void 0,"data-graview-reach":ne.city?zd(At(se)):void 0,"data-graview-settled":ne.t>=1&&!xt.gliding()?"":void 0,"data-graview-box":L?`${L.width}x${L.height}`:void 0,"data-graview-renderer":tt?"dom":"gpu","data-graview-blur":(tt?qt:$e)?"":void 0,onPointerDown:B=>{kt.onPointerDown(B),zn(B)},onPointerMove:B=>{kt.onPointerMove(B),vn(B)},onPointerUp:()=>{kt.onPointerUp(),kn()},onPointerCancel:()=>{kt.onPointerUp(),Yn()},onContextMenu:kt.onContextMenu,onClick:B=>{gt.current||B.target.closest("[data-graview-view], button, aside, section[aria-label], [data-graview-offstage], a, input, select")||(y([]),E(null))},style:{position:"relative",width:"100%",height:"100%",cursor:"grab",touchAction:"none",overscrollBehavior:"contain","--graview-altitude":f.overview?1:0,...ne.city?{"--graview-lattice-cell":`${ne.city.cell.toFixed(2)}px`,"--graview-lattice-tilt":(ne.city.tilt??.5).toFixed(3),"--graview-lattice-x":`${(ne.city.originX+ne.city.pan.x).toFixed(1)}px`,"--graview-lattice-y":`${(ne.city.originY+ne.city.pan.y).toFixed(1)}px`}:{},overflow:"hidden",...i},children:[(0,fe.jsx)("div",{className:"graview-measure","aria-hidden":"true",style:{"--graview-world-x":`${(ne.pan?.x??0).toFixed(1)}px`,"--graview-world-y":`${(ne.pan?.y??0).toFixed(1)}px`}}),f.overview&&ne.city?(0,fe.jsx)(U.Suspense,{fallback:null,children:(0,fe.jsx)(sl,{frame:ne,...nt,pan:ne.city.pan,store:a,graphVersion:N,selection:h,view:{overview:f.overview,focusId:f.focusId,beside:T},emphasis:S,hiddenKinds:c.hiddenKinds,drawn:Ht})}):null,(0,fe.jsx)("div",{ref:k,"aria-hidden":"true",style:{position:"absolute",top:0,right:0,width:"var(--graview-dock, 0px)",height:"var(--graview-sheet, 0px)",visibility:"hidden",pointerEvents:"none"}}),ne.city?(0,fe.jsx)(U.Suspense,{fallback:null,children:(0,fe.jsx)(ll,{frame:ne,...nt,pan:ne.city?ne.city.pan:pe,brand:w,pinned:te,close:Q*P>1.2,swallowed:gt,...f.overview?{chosen:Nn(h,{overview:f.overview,focusId:f.focusId,beside:T},B=>a.graph.getNode(B)?.kind).records}:{},onFocus:B=>{let he=He(B);he!==null&&b(be=>Et(be,Be(he)))}})}):null,f.overview&&ne.city&&l?(0,fe.jsx)(U.Suspense,{fallback:null,children:(0,fe.jsx)(cl,{frame:ne,...nt,pan:ne.city.pan,app:c.app,workflows:l,acts:a.allMutations(),runs:c.workflowRuns,graphVersion:N,hiddenKinds:c.hiddenKinds})}):null,tt?(0,fe.jsx)("div",{"data-graview-stage":"dom","data-graview-world":"",style:{...Mn,overflow:"hidden"},children:Jt(Bt)}):(0,fe.jsxs)("div",{"data-graview-world":"",style:Mn,children:[(0,fe.jsx)("div",{"data-graview-stage":"dom","data-graview-under-canvas":"",style:{position:"absolute",left:0,top:0,...nt,overflow:"hidden"},children:Jt(Bt.filter(B=>le.has(String(B.key))))}),(0,fe.jsx)("canvas",{ref:$,"data-graview-stage":"gpu",content:"drawable",layoutsubtree:"",...nt,style:{display:"block",position:"relative",...nt},children:Jt(Bt.filter(B=>!le.has(String(B.key))))})]}),f.overview?(0,fe.jsx)(ra,{result:se,schema:a.schema,chrome:[...oe.chrome??[],...K?[K]:[],...sa(et,se.nodes)],onGo:B=>{Qt(B.x,B.y),x()}}):null,f.overview&&!Z?(0,fe.jsx)(ul,{zoom:P,zoomBy:B=>V.current(B),above:re,setAbove:v}):null,(0,fe.jsx)(rs,{frame:ne,focusId:f.focusId,beside:T,holding:at,...nt,scheme:u,overview:!!f.overview,selection:h,emphasis:S,stageRef:g,store:a,graphNodes:N,...(B=>B?{provisional:B}:{})(ns(a)),onPickEdge:(B,he)=>{gt.current||(y([B]),E(he?{...he,on:B}:null))},liveOf:B=>{let he=lt(B.from),be=lt(B.to);return he?.wrote&&be?.wrote?he.at>be.at?he:be:void 0}}),(0,fe.jsx)(ta,{width:se.width,whereIs:Zt}),(0,fe.jsx)(ea,{marks:bn.marks,questions:[...A.values()].filter(B=>B.mode==="asking"&&B.at!==null&&B.say).map(B=>({id:B.at,who:B.who,asks:B.say})),whereIs:Zt,stageRef:g,...nt}),(0,fe.jsx)(os,{nodes:ne.nodes,moving:ne.t<1,holding:at,scheme:u,width:se.width,stageRef:g}),d,(0,fe.jsx)("div",{className:"graview-lattice","aria-hidden":"true"})]})}var it=ae(Pe(),1);function fl(){return ws(),null}var ys=()=>window.location.pathname.endsWith(jo),ps=()=>(ys()?zo:Nr)(window.location.hash),ml=e=>(ys()?Yo:Ir)(e);function ws(){let{view:e,setView:t,views:n,principal:o}=xe(),r=JSON.stringify(o),i=(0,it.useCallback)(a=>{let u=a.within?.view;if(u===void 0||a.focusId)return a;let m=n.places().find(f=>f.as===u);return m?{...a,focusId:Be(m.kind)}:a},[n]),s=(0,it.useRef)(!1);(0,it.useEffect)(()=>{if(typeof window>"u")return;let a=i(ps());!tr(a,Tr)&&!tr(a,e)&&(s.current=!0,t(a))},[]),(0,it.useEffect)(()=>{if(typeof window>"u")return;let a=()=>t(i(ps()));return window.addEventListener("popstate",a),window.addEventListener("hashchange",a),()=>{window.removeEventListener("popstate",a),window.removeEventListener("hashchange",a)}},[t,i]);let d=(0,it.useRef)(!1),c=(0,it.useRef)(null),l=(0,it.useRef)(r);(0,it.useEffect)(()=>{if(typeof window>"u")return;if(s.current){s.current=!1;return}let a=l.current!==r;l.current=r;let u=ml(e),m=u||`${window.location.pathname}${window.location.search}`;if((window.location.hash||(window.location.href.includes("#")?"#":""))===u){d.current=!0,c.current=e;return}if(!d.current){d.current=!0,c.current=e,window.history.replaceState({graview:Gt.at},"",m);return}if(a||bs(c.current,e)){window.history.replaceState({graview:Gt.at},"",m),c.current=e;return}c.current=e,window.history.pushState({graview:++Gt.at},"",m),Gt.depth=Gt.at,Gt.tell()},[e,r])}function bs(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(",")&&pl(e.within,t.within):!1}function pl(e,t){let n=o=>Object.entries(o??{}).sort(([r],[i])=>r.localeCompare(i)).map(([r,i])=>`${r}=${i}`).join("&");return n(gs(e))===n(gs(t))}function gs(e){if(!e||!("q"in e))return e;let{q:t,...n}=e;return n}var Do=ae(Pe(),1);var xs=new WeakMap,gl=64,vs=new WeakMap,yl=0,wl=e=>{if(e===void 0)return 0;let t=vs.get(e);return t===void 0&&vs.set(e,t=yl+=1),t};function ks(e,t,n,o={}){let r=()=>{let l=[...new Set(t.flatMap(u=>An(u)))],a=t.map(u=>Ft(u)).filter(u=>u!==null);return vi(e,t,{...n.principal?{principal:n.principal}:{},kindSelection:l,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 i=xs.get(e);if(!i){let l={kept:new Map,at:e.log.length};xs.set(e,i=l),e.subscribe(()=>l.kept.clear())}i.at!==e.log.length&&(i.kept.clear(),i.at=e.log.length);let s=JSON.stringify([t,n.principal??null,wl(n.providers),n.pins??null,n.focus??null]),d=i.kept.get(s);if(d)return d;let c=r();return i.kept.set(s,c),i.kept.size>gl&&i.kept.delete(i.kept.keys().next().value),c}function bl(e,t,n={}){return ks(e,t,n)}function xl(e={}){let{store:t,selection:n,principal:o,providers:r}=xe(),{about:i,principal:s=o,providers:d=r,pins:c,focus:l,...a}=e,u=i??n,m=Vt();return(0,Do.useMemo)(()=>ks(t,u,{principal:s,providers:d,pins:c,focus:l},a),[t,u,e,m,s,d])}function vl(){let{store:e,principal:t}=xe();return(0,Do.useMemo)(()=>({preview:(n,o)=>Si(e,n,o??{},{pressed:t?{author:t}:{}}),apply:(n,o)=>ki(e,n,o??{},{author:t})}),[e,t])}export{$s as a,Fs as b,Ws as c,js as d,Vs as e,Gs as f,As as g,hl as h,fl as i,bl as j,xl as k,vl as l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as D,c as L}from"./chunk.BFAFCVL4.js";import{a as R,g as T,h as W,i as I,j as K}from"./chunk.M5FP4Y4Q.js";import{Zd as N,ne as j}from"./chunk.6HY6ZGEE.js";var J=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),G=e=>e?._zod?.def;function S(e){let t=G(e);for(;t&&(t.type==="optional"||t.type==="default"||t.type==="nullable"||t.type==="prefault");)t=G(t.innerType);return t}function q(e){if(e?.type==="boolean")return["true","false"];if(e?.type==="array"&&(e=S(e.element)),e?.type==="enum")return(e.entries?Object.values(e.entries):e.values??[]).filter(t=>typeof t=="string")}var A=e=>e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[-_]/g," ").replace(/^./,t=>t.toUpperCase());function _(e,t,s){let d=e.tryDefinition(t);if(!d)return[];let c=new Set(d.display?.hide??[]),a=[];for(let[l,o]of Object.entries(d.fields.shape??{})){if(l==="id"||l==="kind"||l==="label"||c.has(l))continue;let i=S(o);if(i?.type==="array"||i?.type==="object"||i?.type==="record")continue;let f=q(i);a.push({key:l,label:A(l),...f?{options:f}:{}})}let g=new Map;for(let[l,o]of Object.entries(d.edges??{}))g.set(l,o.to==="*"?[]:[...o.to]);for(let l of e.definitions)if(l.kind!==t)for(let[o,i]of Object.entries(l.edges??{}))!g.has(o)&&(i.to==="*"||i.to.includes(t))&&g.set(o,[l.kind]);let u=[];for(let[l,o]of g){a.push({key:l,label:A(l)});let i=s&&o.length===1&&o[0]!==t?e.tryDefinition(o[0]):void 0;for(let[f,p]of Object.entries(i?.fields.shape??{})){let y=S(p);y?.type==="enum"&&!i?.display?.hide?.includes(f)&&u.push({key:`${l}.${f}`,label:`${A(l)} \xB7 ${A(f)}`,options:q(y)})}}return a.push(...u),a.push({key:"is",label:"Is",options:d.lifecycle?["current","past","any","flagged","clear"]:["flagged","clear"]}),a}var C=e=>e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function F(e,t,s,d={}){if(s==null)return{ok:!0};if(!J(s))return{ok:!1,says:'A filter is an object of a field and the value it keeps, like { where: { stage: "building" } }.'};let c=Object.entries(s);if(c.length===0)return{ok:!0};let a=[];for(let o of t)for(let i of _(e,o,d.through===!0))a.some(f=>f.key===i.key)||a.push(i);let g=t[0]?e.tryDefinition(t[0]):void 0,u=g?g.plural??`${A(g.kind)}s`:"These",l=[];for(let[o,i]of c){let f=a.find(y=>y.key===o);if(!f)return{ok:!1,says:`${u.replace(/^./,y=>y.toUpperCase())} have no field "${o}" to filter by${a.length>0?`; they filter by ${C(a.map(y=>y.key))}`:""}.`};if(typeof i!="string"&&typeof i!="number"&&typeof i!="boolean")return{ok:!1,says:`The filter on "${o}" is ${Array.isArray(i)?"a list":i===null?"null":`a ${typeof i}`}; it keeps one value: a word, a number, or true or false.`};let p=String(i);if(p.trim().length===0)return{ok:!1,says:`The filter on "${o}" keeps nothing; give it a value, or leave "${o}" out.`};if(p.includes(","))return{ok:!1,says:`The filter on "${o}" holds a comma, which an address reads as a second filter; keep one value.`};if(f.options&&f.options.length>0&&!f.options.includes(p))return{ok:!1,says:`${f.label} has no choice "${p}"; its choices are ${C(f.options.map(y=>`"${y}"`))}.`};l.push(`${o}:${p}`)}return{ok:!0,filter:l.join(",")}}var U=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");function V(e,t){let s=e.find(a=>a.as===t);if(s)return s;let d=t.trim().toLowerCase(),c=U(t);return e.find(a=>a.title!==void 0&&a.title.trim().toLowerCase()===d)??(c?e.find(a=>a.as===c||a.title!==void 0&&U(a.title)===c):void 0)}function ee(e){let t=[];for(let s of e){if(typeof s!="object"||s===null)continue;let{as:d,slug:c,title:a,kind:g}=s,u=typeof d=="string"&&d.length>0?d:typeof c=="string"&&c.length>0?c:void 0;!u||t.some(l=>l.as===u)||t.push({as:u,title:typeof a=="string"?a:u,kind:typeof g=="string"?g:""})}return t}var M=e=>` Its places: ${e.map(t=>typeof t=="string"?`"${t}"`:t.title&&t.title!==t.as?`"${t.as}" (${t.title})`:`"${t.as}"`).join(", ")||"none"}.`,ne=" This run was not handed the views the host keeps, so a titled view's place is not among these: if it names one, the link goes there.",m=e=>`"${e.length>80?`${e.slice(0,79)}\u2026`:e}"`,O=(e,t)=>`${"place"in e?`The place ${m(e.place)}`:`${m(e.record)} is no record this viewer may see and`} is no place of this app: it goes nowhere.${M(t)}`;function E(e){let t={};for(let s of e.split(",")){let d=s.indexOf(":");d>0&&(t[s.slice(0,d).trim()]=s.slice(d+1).trim())}return t}function le(e,t=new Set){return e.kinds.filter(s=>!t.has(s)).map(s=>({slug:N(e,s).slice(1),kind:s}))}function de(e,t,s={}){let d=[],c;for(let g of t){if(typeof g!="object"||g===null)continue;let{as:u,slug:l,title:o,kind:i,over:f,hidden:p,name:y}=g,h=typeof u=="string"&&u.length>0?u:typeof l=="string"&&l.length>0?l:void 0;if(h){if(typeof i!="string"||i.length===0){h===j&&typeof o=="string"&&o.length>0&&(c=o);continue}d.push({kind:i,title:typeof o=="string"&&o.length>0?o:h,as:h,...Array.isArray(f)&&f.every(n=>typeof n=="string")?{over:f}:{},...p===!0?{hidden:!0}:{},...typeof y=="string"?{name:y}:{}})}}let a=s.pages??(c!==void 0?{scene:c}:void 0);return L(e,d,{...a?{pages:a}:{},...s.kept?{kept:s.kept}:{}})}var H=(e,t)=>e.find(s=>s.is==="list"&&(s.as===t||s.kind===t));function Z(e,t){let s=t.places.filter((r,k,w)=>r.is!=="list"&&w.findIndex(b=>b.as===r.as)===k),d=[...new Set(t.places.map(r=>r.as))],c=[...new Set([...t.places.filter(r=>r.is==="list").map(r=>r.as),...t.lists.map(r=>r.slug).filter(r=>!d.includes(r))])],a;if(e.section!==void 0&&e.section!==null){if(typeof e.section!="string"||D(e.section).length===0||e.section.length>120)return{ok:!1,says:`The section ${typeof e.section=="string"?m(e.section):"asked for"} names nothing on a page: a section is a heading's words or an element's id, like "shipping-soon". It goes nowhere.`};a=e.section}let g=a!==void 0?{section:a}:{};if("record"in e&&t.sees(e.record))return e.where!==void 0&&e.where!==null?{ok:!1,says:`${m(e.record)} is one record, and a filter narrows a list or a place: it goes nowhere. Go to { place, where } for a list narrowed.`}:{ok:!0,arrival:{record:e.record,...g}};let u="place"in e?e.place:e.record,l=V(t.places,u),o=l?.is==="list"?void 0:l,i=o?void 0:l?.is==="list"?l:H(t.places,u),f=o||i?void 0:t.lists.find(r=>r.slug===u||r.kind===u),p=i?i.kind??void 0:f?.kind;if(!o&&p===void 0)return{ok:!1,says:`${O(e,s)}${B(c)}`};let y=o?o.kind?[o.kind]:[]:[p],h;if(e.where!==void 0&&e.where!==null){if(!t.schema||y.length===0)return{ok:!1,says:`The place ${m(u)} cannot be narrowed here: it goes nowhere.`};let r=F(t.schema,y,e.where,{through:p!==void 0});if(!r.ok)return{ok:!1,says:`The filter on ${m(u)} goes nowhere: ${r.says}`};h=r.filter}let n=h?{filter:h}:{};return{ok:!0,arrival:o?{place:o.as,...n,...g}:{list:p,...n,...g}}}var B=e=>e.length===0?"":` Its lists: ${e.slice(0,8).map(t=>`"${t}"`).join(", ")}${e.length>8?` and ${e.length-8} more`:""}.`,z="http://www.w3.org/1999/xhtml",Q="http://www.w3.org/2000/svg",X=e=>{let t=e;return t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||e.type==="click"&&typeof t.button=="number"&&t.button!==0};function fe(e){let t=new WeakSet,s=new WeakSet,d=new WeakMap,c=new WeakMap,a=n=>Z(n,{sees:e.sees,places:e.places(),lists:e.lists?.()??[],...e.schema?{schema:e.schema}:{}}),g=n=>{let r=a(n);return r.ok?e.onNavigate?.(r.arrival):e.onLost?.(r.says),r.ok},u=n=>{let r=n.getAttribute("data-record"),k=n.getAttribute("data-place"),w=n.getAttribute("data-filter"),b=n.getAttribute("data-section"),v={...w?{where:E(w)}:{},...b?{section:b}:{}};if(r)return{record:r,...v};if(k)return{place:k,...v}},l=n=>{if(!e.hrefOf)return;let r=u(n),k=r?a(r):void 0;return k?.ok?e.hrefOf(k.arrival):void 0},o=n=>n.hasAttribute("tabindex")?!1:(n.setAttribute("tabindex","0"),t.add(n),!0),i=n=>{t.delete(n)&&n.removeAttribute("tabindex")},f=n=>{s.delete(n)&&n.getAttribute("role")==="link"&&n.removeAttribute("role")},p=n=>{let r=d.get(n);r&&(d.delete(n),n.getAttribute("href")===r.href&&n.removeAttribute("href"),r.target!==null&&!n.hasAttribute("target")&&n.setAttribute("target",r.target))},y=n=>{let r=c.get(n);r&&(c.delete(n),i(r))},h={link(n){if(!W(n,[...n.querySelectorAll("input, select, textarea")].some(R))){if(!n.hasAttribute("data-graview-link"))return;n.removeAttribute("data-graview-link"),f(n),i(n),p(n),y(n);return}n.hasAttribute("data-graview-link")||n.setAttribute("data-graview-link","");let k=n.localName==="a"&&(n.namespaceURI===z||n.namespaceURI===Q),w=n.getAttribute("href"),b=d.get(n),v=w!==null&&b?.href!==w,$=k&&!v?l(n):void 0;if($!==void 0){w!==$&&n.setAttribute("href",$),d.set(n,{href:$,target:b?b.target:n.getAttribute("target")}),n.removeAttribute("target"),f(n),i(n);return}if(v?d.delete(n):p(n),I(n,n.querySelectorAll("a"))){f(n),i(n),y(n);return}if(!n.hasAttribute("role")&&(k||T(n))&&(n.setAttribute("role","link"),s.add(n)),n.localName==="tr"&&n.namespaceURI===z){i(n);let x=[...n.children].find(P=>P.localName==="td"||P.localName==="th");c.get(n)!==x&&y(n),x&&!c.has(n)&&o(x)&&c.set(n,x);return}n.localName!=="button"&&o(n)},refresh(n){for(let r of n.querySelectorAll("[data-record], [data-place], [data-graview-link]"))h.link(r)},pressed(n,r,k){if(n.type!=="click"&&!(n.type==="keydown"&&n.key==="Enter"))return!1;let w=K(r,k,b=>b.hasAttribute("data-graview-link"));return w?(n.stopPropagation(),d.has(w)&&X(n)||(n.preventDefault(),h.follow(w)),!0):!1},follow(n){let r=u(n);r&&g(r)},go:g};return h}export{V as a,ee as b,M as c,ne as d,m as e,O as f,E as g,le as h,de as i,Z as j,fe as k};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as A,Ua as H,W as F,Wa as M}from"./chunk.MODLZJD4.js";import"./chunk.SDO3U72B.js";import"./chunk.6HY6ZGEE.js";import"./chunk.FQLNBIQ5.js";import{b as x}from"./chunk.AJZBJBMO.js";var t=x(A(),1),f=x(F(),1),q={faces:'[data-testid="app-menu-open"][data-scene]',problems:'[data-testid="standing"], [data-testid="standing-link"]',activity:'[data-testid="inbox-button"]',ask:'[data-testid="app-find"], [data-testid="app-find-open"]',find:'[data-testid="app-find"], [data-testid="app-find-open"]',profile:'[data-testid="profile-button"]',home:'[data-testid="app-home"]'};function D(e){if(!e.isConnected||e.closest("[hidden], [inert], [aria-hidden='true']"))return!1;if(typeof e.checkVisibility!="function")return!0;if(!e.checkVisibility({visibilityProperty:!0}))return!1;let a=e.getBoundingClientRect();return a.width>1&&a.height>1}function E(e,a){if(!e||a==="ask"&&!e.querySelector("[data-graview-quick-ask]"))return null;for(let c of e.querySelectorAll(q[a]))if(D(c))return c;return null}function W(e){let a=(u,h,d)=>e.querySelector(u)?.getAttribute(h)?.trim()||d,c=a('[data-testid="app-menu-open"]',"data-scene","Scene"),n=a('[data-testid="app-menu-open"]',"data-pages","Pages");return[{anchor:"faces",title:`${c} or ${n}`,words:`One app, two ways to see it, in the app menu: ${c} draws every record as one picture, ${n} as lists and pages to read and change.`},{anchor:"problems",title:"Whether all is in order",words:"The dot is green while every rule holds. When one is broken it counts what is wrong, and pressing it shows each one and where."},{anchor:"activity",title:"Inbox",words:"What waits for you, what has happened here and who did it \u2014 each change with its way back \u2014 and what you asked."},{anchor:"ask",title:"Tell Graview",words:"Press \u2318K (Ctrl+K) to tell Graview what to do about what you have selected, or right-click it and type. The answer stands beside it, and a change it proposes waits for you to accept it."}]}var R=300,O=1200,$=15e3;function _({root:e,steps:a,onEnd:c}){let[n,u]=(0,t.useState)(null),h=(0,t.useRef)(null),d=(0,t.useRef)(!1),p=(0,t.useRef)(c);p.current=c,(0,t.useEffect)(()=>{let r=Date.now(),o=Date.now(),s=null,i,k=new MutationObserver(()=>o=Date.now());k.observe(document.body,{childList:!0,subtree:!0});let v=()=>{let L=e(),S=Date.now();if(L?.querySelector('[data-testid="app-bar"]')){if(s??=S,S-o>=R||S-s>=O){let T=[...W(L),...a].filter(C=>E(L,C.anchor)!==null);if(T.length===0){d.current=!0,p.current(null);return}h.current=document.activeElement,u({list:T,at:0});return}}else if(S-r>=$){d.current=!0,p.current(null);return}i=setTimeout(v,100)};return i=setTimeout(v,100),()=>{clearTimeout(i),k.disconnect()}},[]);let y=(0,t.useCallback)(()=>{let r=h.current;(r instanceof HTMLElement&&r!==document.body&&r.isConnected?r:e()?.querySelector('[data-testid="app-home"]'))?.focus({preventScroll:!0})},[e]),m=(0,t.useCallback)((r,o)=>{if(d.current)return;d.current=!0;let s=document.querySelector("[data-testid='first-look']"),i=document.activeElement,k=i===null||i===document.body||s!==null&&s.contains(i);u(null),p.current(r),!(!o&&!k)&&(y(),requestAnimationFrame(()=>{let v=document.activeElement;(v===null||v===document.body)&&y()}))},[y]),w=(0,t.useCallback)((r,o)=>{let s=e();for(let i=o;i<r.length;i++)if(E(s,r[i].anchor))return i;return-1},[e]),b=(0,t.useCallback)(()=>{if(!n)return;let r=w(n.list,n.at+1);r<0?m("finished",!0):u({list:n.list,at:r})},[n,w,m]);if((0,t.useEffect)(()=>{if(!n)return;let r=e();if(!r)return;let o=0,s=()=>{cancelAnimationFrame(o),o=requestAnimationFrame(()=>{E(e(),n.list[n.at].anchor)||b()})},i=new MutationObserver(s);return i.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden","class"]}),()=>{cancelAnimationFrame(o),i.disconnect()}},[n,e,b]),!n)return null;let g=n.list[n.at],l=w(n.list,n.at+1)<0;return(0,f.jsx)(N,{root:e,step:g,position:n.at+1,total:n.list.length,last:l,onNext:b,onEnd:m},n.at)}var I={...H,width:"min(320px, calc(100vw - 24px))",maxHeight:"min(70vh, 420px)",overflow:"auto",padding:"12px 14px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)",fontSize:"0.875rem",lineHeight:1.45,overflowWrap:"anywhere"},P={minHeight:32,padding:"0 12px",borderRadius:8,font:"inherit",fontWeight:600,cursor:"pointer"};function N({root:e,step:a,position:c,total:n,last:u,onNext:h,onEnd:d}){let p=(0,t.useRef)(null),y=(0,t.useRef)(null),m=(0,t.useId)().replace(/:/g,""),w=(0,t.useMemo)(()=>({get current(){return E(e(),a.anchor)}}),[e,a.anchor]),[b]=(0,t.useState)(()=>{let l=w.current?.getBoundingClientRect(),r=typeof document>"u"?0:document.documentElement.clientWidth||innerWidth;return l&&l.left+l.width/2<r/2?"start":"end"});M(p,!0,w,{align:b}),(0,t.useLayoutEffect)(()=>{y.current?.focus({preventScroll:!0})},[]);let g=(0,t.useRef)(d);return g.current=d,(0,t.useEffect)(()=>{let l=o=>{o.target instanceof Node&&p.current?.contains(o.target)||g.current("dismissed",!1)},r=o=>{if(o.key!=="Escape"||o.defaultPrevented)return;let s=o.target;s instanceof Node&&p.current?.contains(s)||s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||[...document.querySelectorAll("[data-graview-overlay]:not([hidden])")].some(i=>i!==p.current)||g.current("dismissed",!0)};return document.addEventListener("pointerdown",l,!0),document.addEventListener("keydown",r),()=>{document.removeEventListener("pointerdown",l,!0),document.removeEventListener("keydown",r)}},[]),(0,f.jsxs)("div",{ref:p,popover:"manual",role:"dialog","aria-modal":"false","aria-labelledby":`${m}-title`,"aria-describedby":`${m}-words`,tabIndex:-1,"data-testid":"first-look","data-first-look-anchor":a.anchor,"data-graview-overlay":"",onKeyDown:l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),d("dismissed",!0))},style:I,children:[(0,f.jsxs)("p",{style:{margin:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},"data-testid":"first-look-count",children:[c," of ",n]}),(0,f.jsx)("p",{id:`${m}-title`,style:{margin:"2px 0 4px",fontWeight:600,fontSize:"0.9375rem"},"data-testid":"first-look-title",children:a.title}),(0,f.jsx)("p",{id:`${m}-words`,style:{margin:0},"data-testid":"first-look-words",children:a.words}),(0,f.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-end",gap:8,marginTop:12},children:[u?null:(0,f.jsx)("button",{type:"button","data-testid":"first-look-skip",onClick:()=>d("dismissed",!0),style:{...P,fontWeight:500,border:"1px solid transparent",background:"none",color:"var(--graview-ink-muted)"},children:"Skip"}),(0,f.jsx)("button",{ref:y,type:"button","data-testid":u?"first-look-done":"first-look-next",onClick:()=>u?d("finished",!0):h(),style:{...P,border:"1px solid var(--graview-accent)",background:"var(--graview-accent)",color:"var(--graview-accent-ink)"},children:u?"Done":"Next"})]})]})}export{_ as FirstLookHints,E as firstLookAnchor};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as T,c as m,d as k}from"./chunk.PDDIQ6PK.js";import{b as v,d as w,e as P,f as M,g as N}from"./chunk.M5FP4Y4Q.js";var j=new Set(["input","select","textarea"]),g=r=>r.namespaceURI==="http://www.w3.org/1999/xhtml"&&j.has(r.localName),R=r=>r.localName==="select"||r.type==="checkbox"||r.type==="radio",S=r=>r.type==="checkbox"||r.type==="radio"?!r.checked:r.localName!=="select"&&r.value==="";function y(r){return r.type==="checkbox"||r.type==="radio"?`checked:${r.checked}`:r.localName==="select"&&r.multiple?`selected:${[...r.selectedOptions].map(t=>t.value).join("\0")}`:`value:${r.value}`}function D(r=t=>t.isTrusted){let t=new WeakMap,s=new WeakSet,o=new WeakMap,i={heard(e,n){if(!(!g(n)||!r(e))&&(e.type==="input"||e.type==="change"&&R(n))&&((R(n)||S(n))&&s.delete(n),S(n)&&o.delete(n),t.set(n,y(n)),n.type==="radio"&&n.name)){let u=n.getRootNode();for(let c of u.querySelectorAll?.('input[type="radio"]')??[])c.name===n.name&&t.set(c,y(c))}},filled(e){t.delete(e),o.delete(e),g(e)&&!S(e)?s.add(e):s.delete(e)},press(e,n,u){if(!r(e))return;let c=n.closest("[data-act]");if(!c||!w(c))return;let l=e.type==="keydown"?e.key:void 0;if(!(e.type!=="click"&&!((l==="Enter"||l===" ")&&n===c&&!v(c))))return i.collect(c,u)},collect(e,n){if(!e.hasAttribute("data-act")||!n.contains(e))return;let u=e.closest("[data-record]"),c=e.closest("fieldset, [role='group']")??n,l=[];for(let a of c.querySelectorAll("input[name], select[name], textarea[name]")){let d=a,f=!s.has(d)&&t.get(d)===y(d);if(d.type==="radio"){if(!d.checked)continue;l.push({name:d.name,value:d.value,typed:f,empty:!1,chosen:!0});continue}if(d.localName==="select"){l.push({name:d.name,value:d.value,typed:f,empty:d.value===""&&!f,chosen:!0});continue}if(d.type==="checkbox"){l.push({name:d.name,value:d.checked,typed:f,empty:!d.checked&&!s.has(d)&&!f});continue}let O=(d.type==="number"||d.type==="range")&&d.value!==""&&Number.isFinite(d.valueAsNumber)?d.valueAsNumber:d.value,x=f?o.get(d):void 0;l.push({name:d.name,value:O,typed:f,empty:d.value===""&&!f,...x?{from:x}:{}})}return{as:e.getAttribute("data-act")??"",...u&&n.contains(u)?{record:u.getAttribute("data-record")}:{},fields:l}},prefilled(e,n){s.delete(e),o.set(e,n),t.set(e,y(e))}};return i}var b=new WeakMap,L=(r,t)=>{t.tab&&r.removeAttribute("tabindex"),t.role&&r.getAttribute("role")==="button"&&r.removeAttribute("role"),r.removeAttribute("data-graview-press"),b.delete(r)};function V(r){for(let t of r.querySelectorAll("[data-act], [data-graview-press], [role], [aria-pressed], [aria-expanded]")){let s=b.get(t),o=w(t)&&!v(t)&&!g(t),i=!o&&P(t,s?.role?null:t.getAttribute("role"));if(s&&(s.bound!==o||!(o||i))&&L(t,s),(o||i)&&!b.has(t)){let e=!M(t),n=o&&N(t);e&&t.setAttribute("tabindex","0"),n&&t.setAttribute("role","button"),t.setAttribute("data-graview-press",""),b.set(t,{tab:e,role:n,bound:o})}}}var h=new WeakSet;function z(r){for(let t of r.querySelectorAll("svg")){let s=t.hasAttribute("role")||t.hasAttribute("aria-label")||t.hasAttribute("aria-labelledby")||[...t.children].some(e=>e.localName==="title"),o=t.hasAttribute("tabindex")||t.hasAttribute("data-graview-link")||t.hasAttribute("data-graview-press")||t.querySelector("[tabindex], [data-graview-link], [data-graview-press], a")!==null,i=!s&&!o;i&&!h.has(t)&&!t.hasAttribute("aria-hidden")?(t.setAttribute("aria-hidden","true"),h.add(t)):!i&&h.has(t)&&(t.removeAttribute("aria-hidden"),h.delete(t))}}var I=1e3;function H(r){let t=r.getAttribute("data-debounce")?.trim(),s=t?Number(t):Number.NaN;return Number.isFinite(s)?Math.min(1e4,Math.max(250,Math.round(s))):I}function B(r){let t=r.trusted??(e=>e.isTrusted),s=r.timers??{set:(e,n)=>setTimeout(e,n),clear:e=>clearTimeout(e)},o=new Map,i=(e,n)=>{let u=o.get(e);u&&s.clear(u.handle),o.delete(e);let c=r.reader.collect(e,n);c&&r.save(c,e)};return{heard(e,n,u){if(!g(n)||!t(e)||!n.hasAttribute("data-act"))return;let c=n.getAttribute("data-save");if(e.type==="input"&&c==="input"){let l=o.get(n);l&&s.clear(l.handle),o.set(n,{root:u,handle:s.set(()=>i(n,u),H(n))})}else e.type==="change"&&(c==="change"||c==="input"&&o.has(n))&&i(n,u)},flush(){for(let[e,{root:n}]of[...o])i(e,n)},get waiting(){return o.size}}}var q=new Set(["text","search","email","url","tel","number"]);function C(r,t,s,o){for(let i of r.querySelectorAll("input[data-prefill], textarea[data-prefill]")){let e=i;if(s.has(e))continue;let n=e.getAttribute("data-prefill")??"";if(n===""||e.getAttribute("name")!==n||e.localName==="input"&&!q.has(e.type))continue;if(e.value!==""){s.add(e);continue}let c=[...(e.closest("fieldset, [role='group']")??r).querySelectorAll("[data-act]")],l=e.closest("[data-record]"),a=new Set(c.map(p=>p.closest("[data-record]")?.getAttribute("data-record")).filter(p=>typeof p=="string")),d=l&&r.contains(l)?l.getAttribute("data-record"):a.size===1?[...a][0]:void 0;if(!d)continue;let f=o({record:d,field:n,acts:c.map(p=>p.getAttribute("data-act")??"")});if(f!==void 0){if(e.value=f,s.add(e),e.value!==f){e.value="";continue}t.prefilled(e,{record:d,field:n,value:f})}}}function J(r,t,s,o){let i=k(t,o.as);if(!i)return m("undeclared",`This view may not ask for \u201C${o.as}\u201D: its manifest does not name it.`);let e=r.allMutations().find(a=>a.name===i.act);if(!e)return m("unknown-act","There is no act by that name here.");let n={};if(o.record!==void 0){let a=i.record??e.subject?.arg;if(!a)return m("unbound",`\u201C${o.as}\u201D is not done to a record.`);if(!s.has(o.record))return m("unbound","That press is bound to a record this view was not shown.");n[a]=o.record}for(let[a,d]of Object.entries(i.constants??{})){if(a in n)return m("malformed",`\u201C${a}\u201D is both the bound record and a constant.`);n[a]=d}let u=e.input?.shape??{},c=new Set(Object.keys(u)),l=new Set;for(let a of o.fields){if(!c.has(a.name)||a.name in n)continue;if(l.has(a.name))return m("malformed",`Two fields here are called \u201C${a.name}\u201D.`);l.add(a.name);let d=u[a.name];if(!a.chosen&&a.value===""&&!E(d,"")){a.typed&&a.from&&E(d,null)&&(n[a.name]=null);continue}if(a.typed&&a.chosen){let f=T(u[a.name])?.find(p=>String(p)===String(a.value));if(f!==void 0)n[a.name]=f;else if(typeof a.value=="string"&&s.has(a.value))n[a.name]=a.value;else return m("untyped",`\u201C${a.name}\u201D was a choice among the view's own words, not one this app declares, so it was not sent.`)}else{if(a.typed&&a.from&&!(o.record===a.from.record&&a.name===a.from.field&&A(r,i,a.from.record,a.from.field)))return m("untyped",`\u201C${a.name}\u201D was filled in from a record for an act that writes it back there, not for this one, so it was not sent.`);if(a.typed&&a.from&&String(a.value)===a.from.value)n[a.name]=r.graph.getNode(a.from.record)?.[a.name]??a.value;else if(a.typed)n[a.name]=a.value;else if(!a.empty)if(F(r,d,a.value,o.record!==void 0&&A(r,i,o.record,a.name)?o.record:void 0,a.name))n[a.name]=a.value;else return m("untyped",`\u201C${a.name}\u201D was filled in by the view, not typed by you, so it was not sent.`)}}return{ok:!0,name:i.act,args:n}}function E(r,t){let s=r?.safeParse;return typeof s=="function"?s.call(r,t).success:!1}function $(r){let t=r;for(let s=0;s<8&&t?._zod?.def;s+=1){let o=t._zod.def;if(o.type==="default"||o.type==="prefault"){let i=o.defaultValue;return{value:typeof i=="function"?i():i}}if(!("innerType"in o))return;t=o.innerType}}function F(r,t,s,o,i){if(!E(t,s))return!1;if(s===0||s===!1||s==="0")return!0;let e=$(t);if(e&&Object.is(e.value,s))return!0;if(o===void 0)return!1;let n=r.graph.getNode(o)?.[i];return n!=null&&String(n)===String(s)}function A(r,t,s,o){let i=r.allMutations().find(c=>c.name===t.act),e=i?.subject;if(!i||!e||(t.record??e.arg)!==e.arg||o===e.arg||Object.hasOwn(t.constants??{},o)||!Object.hasOwn(i.input.shape??{},o)||Object.keys(i.writesOther??{}).length>0)return!1;let n=r.graph.getNode(s)?.kind,u=n===void 0?void 0:r.schema.tryDefinition(n);return!u||e.kinds!=="*"&&!e.kinds.includes(n)||!Object.hasOwn(u.fields.shape??{},o)?!1:i.writes?.includes(o)??!1}function K(r,t,s,o,i){if(!o.has(i.record))return;let e=r.seenBy(t).graph.getNode(i.record);if(!e||!i.acts.some(c=>{let l=k(s,c);if(!l||!A(r,l,i.record,i.field))return!1;let a=r.allMutations().find(d=>d.name===l.act).subject;return r.permits({name:l.act,args:{[a.arg]:i.record}},t).ok}))return;let u=e[i.field];return typeof u=="string"?u:typeof u=="number"&&Number.isFinite(u)?String(u):void 0}export{D as a,V as b,z as c,I as d,H as e,B as f,C as g,J as h,E as i,A as j,K as k};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as v,b as w,c as x}from"./chunk.MB7LKKUD.js";import"./chunk.
|
|
1
|
+
import{a as v,b as w,c as x}from"./chunk.MB7LKKUD.js";import"./chunk.U3HERHAI.js";import"./chunk.FBILPNGH.js";import{G as R,Va as g,W as y,Xa as h}from"./chunk.MODLZJD4.js";import"./chunk.SDO3U72B.js";import{lb as b,td as m}from"./chunk.6HY6ZGEE.js";import"./chunk.FQLNBIQ5.js";import{b as p}from"./chunk.AJZBJBMO.js";var c=p(R(),1);var r=p(y(),1);function W({notices:e,anchor:n,board:a,report:i}){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(k,{notices:e.filter(s=>s.kind==="banner"),at:"top",anchor:n,board:a,report:i}),(0,r.jsx)(k,{notices:e.filter(s=>s.kind==="toast"),at:"foot",anchor:n,board:a,report:i})]})}var E={info:"var(--graview-accent)",good:"var(--graview-good)",warn:"var(--graview-warn)",bad:"var(--graview-bad)"},C={info:"i",good:"\u2713",warn:"!",bad:"!"};function k({notices:e,at:n,anchor:a,board:i,report:s}){let l=(0,c.useRef)(null),t=e.length>0;return(0,c.useLayoutEffect)(()=>{let o=l.current;if(!t||!o)return;if(typeof o.showPopover=="function"&&!g(o))try{o.showPopover()}catch{}let d=()=>(n==="top"?x:w)(o,a());d(),n==="foot"&&i.hold?.(()=>o.matches(":hover")||o.contains(document.activeElement));let N=h(o);addEventListener("resize",d),addEventListener("scroll",d,!0),n==="foot"&&addEventListener(v,d);let u=typeof ResizeObserver=="function"?new ResizeObserver(d):null;return u?.observe(o),()=>{if(N(),u?.disconnect(),removeEventListener("resize",d),removeEventListener("scroll",d,!0),removeEventListener(v,d),o.isConnected&&g(o))try{o.hidePopover()}catch{}}},[t,n,a,i]),t?(0,r.jsx)("div",{ref:l,popover:"manual",role:"region","aria-label":n==="top"?"Notices":"Messages","data-testid":n==="top"?"notices-banners":"notices-toasts","data-graview-offstage":"",style:{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:m("toast"),width:"max-content",height:"auto",maxWidth:"min(560px, calc(100vw - 32px))",display:"grid",gap:8,color:"var(--graview-ink)"},children:e.map(o=>(0,r.jsx)(O,{notice:o,board:i,report:s},o.id))}):null}var T=e=>e.split(/\s+/).filter(Boolean).map(n=>n.replace(/^Meta\+/,"\u2318").replace(/^Control\+/,"Ctrl+").replace(/^Alt\+/,"Alt+")).join(" or "),H=e=>/^.*?[.!?](?=\s|$)/.exec(e.trim())?.[0]??e.trim(),L=e=>e.from==="framework"&&(e.tone==="bad"||e.tone==="warn");function O({notice:e,board:n,report:a}){let i=e.tone??"info",s=[...e.action?[e.action]:[],...e.actions??[]],l=()=>n.dismiss(e.id);return(0,r.jsxs)("div",{"data-testid":"notice","data-kind":e.kind,"data-tone":i,style:{boxSizing:"border-box",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px 12px",padding:e.kind==="banner"?"8px 10px 8px 12px":"10px 12px 10px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,r.jsx)("span",{"aria-hidden":"true","data-testid":"notice-chip",style:{width:20,height:20,borderRadius:"var(--graview-radius-sm, 6px)",flex:"0 0 auto",display:"inline-grid",placeItems:"center",fontSize:"0.75rem",fontWeight:700,lineHeight:1,color:"var(--graview-ink)",background:`color-mix(in srgb, ${E[i]} 22%, transparent)`},children:C[i]}),(0,r.jsx)("span",{"data-testid":"notice-sentence",style:{flex:"1 1 16rem",minWidth:0},children:e.sentence}),s.length>0?(0,r.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.map((t,o)=>t.href!==void 0?(0,r.jsx)("a",{href:t.href,...t.target?{target:t.target,rel:"noopener"}:{},"data-testid":"notice-action",onClick:()=>{t.onSelect?.(),l()},style:{...f,...o===0?S:{}},children:t.label},t.label):(0,r.jsx)("button",{type:"button","data-testid":"notice-action",...t.keys?{"aria-keyshortcuts":t.keys,title:`${t.label} \u2014 ${T(t.keys)}`}:{},onClick:()=>{l(),t.onSelect?.()},style:{...f,...o===0?S:{}},children:t.label},t.label))}):null,a&&L(e)?(0,r.jsx)("button",{type:"button","data-testid":"notice-report","aria-label":`Report this: ${H(e.sentence)}`,onClick:()=>a.tell({message:e.sentence,...e.code?{code:e.code}:{},...a.where(),version:b}),style:f,children:"Report this"}):null,(0,r.jsx)("button",{type:"button","data-testid":"notice-dismiss","aria-label":`Dismiss: ${e.sentence}`,title:"Dismiss",onClick:l,style:z,children:"\xD7"})]})}var f={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 12px",borderRadius:9,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",font:"inherit",fontWeight:500,textDecoration:"none",cursor:"pointer"},S={background:"var(--graview-accent)",borderColor:"var(--graview-accent)",color:"var(--graview-accent-ink)"},z={minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",fontSize:"1rem",cursor:"pointer"};export{W as NoticeStacks,H as firstSentenceOf,L as reportable};
|