graview 0.1.35 → 0.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/preview/{chunk.3C4RJIJU.js → chunk.272ZJXQP.js} +1 -1
- package/dist/preview/{chunk.H243UV3Z.js → chunk.27TLAVRR.js} +1 -1
- package/dist/preview/{chunk.GF7LA4QG.js → chunk.2A2DLMT3.js} +1 -1
- package/dist/preview/{chunk.FBY5IUGU.js → chunk.2B4WVCVV.js} +1 -1
- package/dist/preview/{chunk.ZE4CTZQ3.js → chunk.3PT55HXT.js} +1 -1
- package/dist/preview/{chunk.DPP7ITTU.js → chunk.3SM2CHKF.js} +1 -1
- package/dist/preview/{chunk.VWHMYPLL.js → chunk.3ZIOAPI5.js} +1 -1
- package/dist/preview/{chunk.5B7NWF7C.js → chunk.42WJ6VJZ.js} +1 -1
- package/dist/preview/{chunk.RIW7SQH4.js → chunk.4B73P2WA.js} +1 -1
- package/dist/preview/{chunk.JMQ6YLQX.js → chunk.4GXXD4NG.js} +1 -1
- package/dist/preview/chunk.4Q56V7GS.js +1 -0
- package/dist/preview/{chunk.SBBNIYVB.js → chunk.4STIUIT6.js} +1 -1
- package/dist/preview/chunk.53IKY7UP.js +1 -0
- package/dist/preview/chunk.56BPXB6E.js +1 -0
- package/dist/preview/{chunk.LRRVBM4F.js → chunk.5PU3RWYY.js} +2 -2
- package/dist/preview/chunk.64MJ5FRL.js +1 -0
- package/dist/preview/{chunk.UWIYKGYK.js → chunk.6II4BONS.js} +1 -1
- package/dist/preview/{chunk.VMGWYCXU.js → chunk.6KMXLUOS.js} +1 -1
- package/dist/preview/{chunk.AINNENYD.js → chunk.6QDFBCV4.js} +2 -2
- package/dist/preview/{chunk.IHFNLKXV.js → chunk.6W7J76TK.js} +1 -1
- package/dist/preview/{chunk.5VB7DJTL.js → chunk.6ZZZBDEG.js} +1 -1
- package/dist/preview/{chunk.CHJZ7LST.js → chunk.7CO7S6QM.js} +1 -1
- package/dist/preview/chunk.7G3B5QPH.js +1 -0
- package/dist/preview/chunk.7TBSVQSH.js +1 -0
- package/dist/preview/{chunk.QVKKXMNK.js → chunk.7YQYWOZR.js} +1 -1
- package/dist/preview/{chunk.4K5QCJFH.js → chunk.AAZFVCSP.js} +1 -1
- package/dist/preview/{chunk.ZSW74NVJ.js → chunk.ACEYGWMO.js} +1 -1
- package/dist/preview/{chunk.TIBZZ2WY.js → chunk.ACXA55GW.js} +1 -1
- package/dist/preview/{chunk.Y5Z4ZDTO.js → chunk.BZ5VLPKB.js} +2 -2
- package/dist/preview/chunk.CE3NOADH.js +1 -0
- package/dist/preview/chunk.CNJENUPC.js +1 -0
- package/dist/preview/{chunk.DMNXYMLC.js → chunk.CRPT3ZT3.js} +1 -1
- package/dist/preview/{chunk.2OBIO5Y6.js → chunk.CUCNT7MG.js} +1 -1
- package/dist/preview/{chunk.6J7DR7XQ.js → chunk.D6RDTUX3.js} +1 -1
- package/dist/preview/{chunk.UHQD3NTK.js → chunk.DANDYIB5.js} +1 -1
- package/dist/preview/{chunk.OEDCAHII.js → chunk.DSP62QYK.js} +1 -1
- package/dist/preview/chunk.E77K6KBX.js +1 -0
- package/dist/preview/{chunk.HPD5ZDZH.js → chunk.EBLKEQ7O.js} +1 -1
- package/dist/preview/{chunk.EQWOQOFJ.js → chunk.EDSPYKR4.js} +1 -1
- package/dist/preview/chunk.EQIGKXIG.js +1 -0
- package/dist/preview/{chunk.ZHXX22AT.js → chunk.ER5ILWKY.js} +2 -2
- package/dist/preview/{chunk.KYH4QIVI.js → chunk.ET76FISZ.js} +1 -1
- package/dist/preview/{chunk.X7W27IRI.js → chunk.F5BCCGFK.js} +5 -5
- package/dist/preview/{chunk.OZ5KJLA2.js → chunk.FERBNBDE.js} +1 -1
- package/dist/preview/{chunk.FUQVNXLB.js → chunk.FQKH67BP.js} +1 -1
- package/dist/preview/{chunk.577PGFUT.js → chunk.FUR4IHWG.js} +1 -1
- package/dist/preview/chunk.FWBQVPMI.js +1 -0
- package/dist/preview/{chunk.3QXHII5W.js → chunk.GOCUBIRW.js} +1 -1
- package/dist/preview/{chunk.A3F7MFDR.js → chunk.GUDKPK42.js} +1 -1
- package/dist/preview/{chunk.QVUL2FSI.js → chunk.GXLAZGYT.js} +1 -1
- package/dist/preview/{chunk.Z7ZCR4LN.js → chunk.GZLYTPE7.js} +1 -1
- package/dist/preview/{chunk.EAM4NAQH.js → chunk.H4T56OXM.js} +1 -1
- package/dist/preview/{chunk.SECORXDP.js → chunk.HPX3F7XX.js} +1 -1
- package/dist/preview/{chunk.PJ2DF6C7.js → chunk.HZPTBPJY.js} +1 -1
- package/dist/preview/{chunk.PW7YH6JV.js → chunk.IB32NOV5.js} +1 -1
- package/dist/preview/{chunk.FSAHO3LV.js → chunk.IMRCAU4T.js} +1 -1
- package/dist/preview/{chunk.FX6GH57T.js → chunk.ITXIFDQ7.js} +1 -1
- package/dist/preview/{chunk.LWSTEZIP.js → chunk.J3TEJBI5.js} +1 -1
- package/dist/preview/{chunk.B2KITMSD.js → chunk.JLXQ6ZLI.js} +1 -1
- package/dist/preview/{chunk.ZZTDQKM2.js → chunk.JZMA2AV7.js} +1 -1
- package/dist/preview/{chunk.FIVLFXFB.js → chunk.K5NJTE3F.js} +1 -1
- package/dist/preview/{chunk.3P4IIXIT.js → chunk.KBJG5SI2.js} +1 -1
- package/dist/preview/{chunk.3H4NVUWV.js → chunk.KU6NIMQX.js} +1 -1
- package/dist/preview/{chunk.LAF6GTBN.js → chunk.LA7535VO.js} +1 -1
- package/dist/preview/{chunk.D4WQEBWV.js → chunk.LMVCWYYG.js} +1 -1
- package/dist/preview/{chunk.2YGQVI6T.js → chunk.LNNFNJKN.js} +1 -1
- package/dist/preview/{chunk.BL6VDLAW.js → chunk.M4FQ7SSM.js} +1 -1
- package/dist/preview/{chunk.BGW7XTMH.js → chunk.MXJS67W4.js} +1 -1
- package/dist/preview/{chunk.LIIC25G6.js → chunk.NJ62C2GU.js} +1 -1
- package/dist/preview/{chunk.VZHV25JE.js → chunk.NNCTJSD3.js} +1 -1
- package/dist/preview/{chunk.GO4QBFED.js → chunk.NWYOLGQ3.js} +1 -1
- package/dist/preview/{chunk.DNDHDDM6.js → chunk.O3OALXCI.js} +2 -2
- package/dist/preview/{chunk.JLMLKDVX.js → chunk.O6ROFVFD.js} +1 -1
- package/dist/preview/{chunk.KSXB4LDF.js → chunk.OF34OZ4V.js} +1 -1
- package/dist/preview/{chunk.GCVO6N26.js → chunk.OFJH7LDC.js} +1 -1
- package/dist/preview/{chunk.Q7TP4RFE.js → chunk.OH5BBE2B.js} +1 -1
- package/dist/preview/{chunk.PKKA6JWA.js → chunk.OREMUXB5.js} +1 -1
- package/dist/preview/{chunk.CDMV6L5I.js → chunk.OXZRGP53.js} +1 -1
- package/dist/preview/chunk.OZR5NI4J.js +1 -0
- package/dist/preview/{chunk.PPUAPAWR.js → chunk.P75TPZWT.js} +1 -1
- package/dist/preview/{chunk.QRMWFEEH.js → chunk.PWOVXARZ.js} +1 -1
- package/dist/preview/chunk.Q63RPNUS.js +1 -0
- package/dist/preview/{chunk.KWCML3BF.js → chunk.QDHUDLJB.js} +1 -1
- package/dist/preview/{chunk.4NZBMZC7.js → chunk.QEALNWWL.js} +3 -3
- package/dist/preview/{chunk.APNN6BKF.js → chunk.QLMUGC7R.js} +1 -1
- package/dist/preview/{chunk.DQ5HAB3N.js → chunk.QTITRX5Q.js} +1 -1
- package/dist/preview/{chunk.GMOTRAKJ.js → chunk.R45BF6JV.js} +1 -1
- package/dist/preview/{chunk.U5EJSTST.js → chunk.R7LRJS6B.js} +2 -2
- package/dist/preview/{chunk.2QQAOJET.js → chunk.RKHEZ6KZ.js} +1 -1
- package/dist/preview/{chunk.G2ZPQUXM.js → chunk.S6GJGTJE.js} +1 -1
- package/dist/preview/{chunk.MVN6H65Q.js → chunk.SG23JC6D.js} +1 -1
- package/dist/preview/chunk.SSRP5SBR.js +1 -0
- package/dist/preview/{chunk.FVPOSGNG.js → chunk.T2CN7UTZ.js} +2 -2
- package/dist/preview/{chunk.5FZQI2US.js → chunk.T47DLH5Z.js} +1 -1
- package/dist/preview/{chunk.RTB4MMF6.js → chunk.TGEF6TMM.js} +1 -1
- package/dist/preview/{chunk.JAPYJ53U.js → chunk.UJR3Y7MP.js} +1 -1
- package/dist/preview/{chunk.52QAIGCD.js → chunk.VHWUGSFW.js} +1 -1
- package/dist/preview/{chunk.6K2HASOH.js → chunk.W42P7NOL.js} +1 -1
- package/dist/preview/{chunk.SD33BD7A.js → chunk.WGI5G6NM.js} +1 -1
- package/dist/preview/{chunk.IX6RNGAT.js → chunk.WHTQHU3M.js} +1 -1
- package/dist/preview/{chunk.TWWFWHK3.js → chunk.WJ2TWU2I.js} +1 -1
- package/dist/preview/{chunk.GCGITEON.js → chunk.XBTZXWJX.js} +1 -1
- package/dist/preview/{chunk.747GGBPR.js → chunk.XRCGADKC.js} +1 -1
- package/dist/preview/{chunk.XSYBNUXF.js → chunk.Y3IJDWNS.js} +1 -1
- package/dist/preview/{chunk.5MCC54VM.js → chunk.YNE5QR7Q.js} +1 -1
- package/dist/preview/{chunk.5EAQDBBE.js → chunk.ZDNJK2SX.js} +1 -1
- package/dist/preview/{chunk.QU356VB2.js → chunk.ZEW2OOZ5.js} +1 -1
- package/dist/preview/chunk.ZNS3LYJU.js +1 -0
- package/dist/preview/{chunk.YT2CYCVT.js → chunk.ZSSOTIFL.js} +1 -1
- package/dist/preview/{chunk.DLT3EE4D.js → chunk.ZVMIHXVK.js} +1 -1
- package/dist/preview/{chunk.DUUARGPE.js → chunk.ZWZ5SEXT.js} +1 -1
- package/dist/preview/index.html +42 -42
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.4J75WRDG.js +0 -1
- package/dist/preview/chunk.656N5BHG.js +0 -1
- package/dist/preview/chunk.6P7P2AW7.js +0 -1
- package/dist/preview/chunk.AEHPDVLQ.js +0 -1
- package/dist/preview/chunk.DTR5I4BI.js +0 -1
- package/dist/preview/chunk.FHXXYWL3.js +0 -1
- package/dist/preview/chunk.M5HADQPP.js +0 -1
- package/dist/preview/chunk.O36ZDLWC.js +0 -1
- package/dist/preview/chunk.PQPTYNW2.js +0 -1
- package/dist/preview/chunk.RHYA742Q.js +0 -1
- package/dist/preview/chunk.TPX6AVJL.js +0 -1
- package/dist/preview/chunk.U2PYW5MS.js +0 -1
- package/dist/preview/chunk.ZFWV4JAJ.js +0 -1
- package/dist/preview/chunk.ZKXK22AH.js +0 -1
- package/dist/preview/chunk.ZQNLC33L.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk.XDYAG276.js";import{a as xe}from"./chunk.HJCQ6I3S.js";import{c as he}from"./chunk.DUUARGPE.js";import{a as je,b as Ee,c as Ie,d as Re}from"./chunk.FUQVNXLB.js";import"./chunk.Z7ZCR4LN.js";import"./chunk.RIW7SQH4.js";import"./chunk.FSAHO3LV.js";import{F as Ke,Q as Pe}from"./chunk.UWIYKGYK.js";import"./chunk.X7W27IRI.js";import{b as pe}from"./chunk.AJZBJBMO.js";var P=pe(Ke(),1);var E=.5,fe=1,ye=.76,Le=3,We=3,Ae=.6;function Oe(c){let{ribbons:m,plots:u,cell:i}=c,a=c.tilt??.5,g=c.labels??[],b=[...u.values()],k=new Map;if(b.length===0||i<=0)return k;let L=Math.min(...b.map(n=>n.col))-3,A=Math.min(...b.map(n=>n.row))-3,G=Math.max(...b.map(n=>n.col+n.side))+3,ce=Math.max(...b.map(n=>n.row+n.side))+3,h=Math.round((G-L)/E)+1,p=Math.round((ce-A)/E)+1,N=n=>L+n*E,B=n=>A+n*E,I=4,_=!0,C=(n,e)=>{if(!_)return!1;let t=he(n,e,i,a);return g.some(s=>t.x>s.x-I&&t.x<s.x+s.width+I&&t.y>s.y-I&&t.y<s.y+s.height+I)},H=(n,e)=>b.some(t=>n>t.col-ye&&n<t.col+t.side+ye&&e>t.row-ye&&e<t.row+t.side+ye),F=new Uint8Array(h*p),J=new Uint8Array(h*p);for(let n=0;n<h;n++)for(let e=0;e<p;e++){let t=N(n),s=B(e);J[e*h+n]=H(t,s)?0:1,F[e*h+n]=J[e*h+n]&&!C(t,s)?1:0}let Q=F,se=new Float32Array(h*p);for(let n=0;n<h;n++)for(let e=0;e<p;e++){let t=N(n),s=B(e);se[e*h+n]=Math.min(...b.map(o=>Math.max(0,o.col-t,t-(o.col+o.side),o.row-s,s-(o.row+o.side))))}let Z=(n,e,t,s)=>{let o=N(n)+t*E/2,l=B(e)+s*E/2;return!H(o,l)&&!C(o,l)},ue=n=>{let e=[],t=(o,l)=>{let w=[],d=Math.min(1,l/3);for(let y=Math.ceil((o+d)/E-1e-9)*E;y<=o+l-d+1e-9;y+=E)w.push(y);return w},s=(o,l,w,d)=>{let y=Math.round((o-L)/E),r=Math.round((l-A)/E);y>=0&&r>=0&&y<h&&r<p&&Q[r*h+y]&&e.push({i:y,j:r,out:w,curb:d})};for(let o of t(n.row,n.side))s(n.col-fe,o,1,{col:n.col,row:o}),s(n.col+n.side+fe,o,0,{col:n.col+n.side,row:o});for(let o of t(n.col,n.side))s(o,n.row-fe,3,{col:o,row:n.row}),s(o,n.row+n.side+fe,2,{col:o,row:n.row+n.side});return e},ee=new Map,V=(n,e,t,s)=>n<t||n===t&&e<s?`${n},${e}-${t},${s}`:`${t},${s}-${n},${e}`,de=[[1,0],[-1,0],[0,1],[0,-1]],X=new Map;for(let n of m){let e=u.get(n.from),t=u.get(n.to);if(!e||!t||e===t)continue;let s=-1,o=[],l=new Map,w=new Int32Array(0),d=1/0,y=[];for(let f of[!0,!1]){s=-1,d=1/0,_=f,Q=f?F:J,o=ue(e);let W=ue(t);if(o.length===0||W.length===0){y.push({reached:-1,starts:o,goal:l,back:w,best:d});continue}l=new Map(W.map(j=>[j.j*h+j.i,j]));let ne=(j,R)=>{let re=N(j),ae=B(R);return(Math.max(0,t.col-re,re-(t.col+t.side))+Math.max(0,t.row-ae,ae-(t.row+t.side)))*Ae},oe=h*p*4,ie=new Float64Array(oe).fill(1/0);w=new Int32Array(oe).fill(-1);let le=new ke;for(let j of o){let R=(j.j*h+j.i)*4+j.out;ie[R]=0,le.push(R,ne(j.i,j.j))}let Ce=[1,0,3,2];for(;le.size>0&&!(le.peekKey()>=d);){let R=le.pop(),re=Math.floor(R/4),ae=R%4,ge=re%h,we=Math.floor(re/h),ve=l.get(re);if(ve){let q=ie[R]+(ae===Ce[ve.out]?0:Le);q<d&&(d=q,s=R);continue}for(let q=0;q<4;q++){let[Me,$e]=de[q],U=ge+Me,z=we+$e;if(U<0||z<0||U>=h||z>=p||!Q[z*h+U]||!Z(ge,we,Me,$e))continue;let Te=E*(ee.has(V(ge,we,U,z))?Ae:1)*(1+Math.max(0,se[z*h+U]-We))+(q===ae?0:Le),me=(z*h+U)*4+q,be=ie[R]+Te;be<ie[me]&&(ie[me]=be,w[me]=R,le.push(me,be+ne(U,z)))}}y.push({reached:s,starts:o,goal:l,back:w,best:d})}_=!0,Q=F;let[r,v]=y,M=r&&r.reached!==-1&&(!v||v.reached===-1||r.best<=1.3*v.best+2)?r:v;if(!M||M.reached===-1)continue;({reached:s,starts:o,goal:l,back:w}=M);let x=[];for(let f=s;f!==-1;f=w[f]){let W=Math.floor(f/4),ne=x[x.length-1],oe={i:W%h,j:Math.floor(W/h)};(!ne||ne.i!==oe.i||ne.j!==oe.j)&&x.push(oe)}x.reverse();for(let f=1;f<x.length;f++){let W=V(x[f-1].i,x[f-1].j,x[f].i,x[f].j);ee.set(W,[...ee.get(W)??[],n.key])}let D=o.find(f=>f.i===x[0].i&&f.j===x[0].j),$=l.get(x[x.length-1].j*h+x[x.length-1].i);X.set(n.key,{cells:x,start:D.curb,end:$.curb})}let O=new Map(m.map(n=>[n.key,n.width])),T=new Map(m.map((n,e)=>[n.key,e])),te=i*a/Math.sqrt(1+a*a),Y=(n,e)=>n==="col"?`r${e.row.toFixed(2)}`:`c${e.col.toFixed(2)}`,K=new Map;for(let[n,e]of X)for(let t=1;t<e.cells.length;t++){let s=e.cells[t-1],o=e.cells[t],l=Y(s.i!==o.i?"col":"row",{col:N(s.i),row:B(s.j)});K.set(l,(K.get(l)??new Set).add(n))}for(let[n,e]of X){let t=[e.start,...e.cells.map(r=>({col:N(r.i),row:B(r.j)})),e.end],s=r=>r>=2&&r<=e.cells.length?V(e.cells[r-2].i,e.cells[r-2].j,e.cells[r-1].i,e.cells[r-1].j):null,o=[];for(let r=1;r<t.length;r++){let v=Math.abs(t[r].col-t[r-1].col)>1e-9?"col":"row",M=o[o.length-1];M&&M.axis===v?M.to=r:o.push({from:r-1,to:r,axis:v})}if(o.length===0)continue;let l=o.map(r=>{if(!Array.from({length:r.to-r.from},($,f)=>s(r.from+1+f)).some($=>$!==null))return 0;let v=K.get(Y(r.axis,t[r.from]))??new Set;if(!v.has(n))return 0;let M=[...v].sort(($,f)=>(T.get($)??0)-(T.get(f)??0)),D=-(M.reduce(($,f)=>$+(O.get(f)??2)+2,0)-2)/2;for(let $ of M){if($===n)return(D+(O.get($)??2)/2)/te;D+=(O.get($)??2)+2}return 0}),w=r=>{let v=o[r],M=t[v.from];return v.axis==="col"?{row:M.row+l[r]}:{col:M.col+l[r]}},d=(r,v,M)=>({col:r.col??v.col??M.col,row:r.row??v.row??M.row}),y=[d(w(0),{},t[0])];for(let r=0;r+1<o.length;r++)y.push(d(w(r),w(r+1),t[o[r].to]));y.push(d(w(o.length-1),{},t[t.length-1])),k.set(n,y.map(r=>he(r.col,r.row,i,a)))}return k}var ke=class{items=[];keys=[];get size(){return this.items.length}peekKey(){return this.keys[0]??1/0}push(m,u){this.items.push(m),this.keys.push(u);let i=this.items.length-1;for(;i>0;){let a=i-1>>1;if(this.keys[a]<=this.keys[i])break;this.swap(i,a),i=a}}pop(){let m=this.items[0],u=this.items.pop(),i=this.keys.pop();if(this.items.length>0){this.items[0]=u,this.keys[0]=i;let a=0;for(;;){let g=2*a+1,b=g+1,k=a;if(g<this.items.length&&this.keys[g]<this.keys[k]&&(k=g),b<this.items.length&&this.keys[b]<this.keys[k]&&(k=b),k===a)break;this.swap(a,k),a=k}}return m}swap(m,u){[this.items[m],this.items[u]]=[this.items[u],this.items[m]],[this.keys[m],this.keys[u]]=[this.keys[u],this.keys[m]]}};function Se(c,m){let u=c.col+c.side,i=u+.25+.22*Math.max(0,m),a=c.row+c.side*Math.max(.1,.3-.06*m),g=c.row+c.side*Math.min(.9,.7+.06*m);return[{col:u,row:a},{col:i,row:a},{col:i,row:g},{col:u,row:g}]}function Be(c,m){return c.map(u=>he(u.col,u.row,m.cell,m.tilt))}function Fe(c){return c.map((m,u)=>`${u===0?"M":"L"} ${m.x.toFixed(1)} ${m.y.toFixed(1)}`).join(" ")}function Ne(c){if(c.length===0)return{x:0,y:0};let m=0;for(let i=1;i<c.length;i++)m+=Math.hypot(c[i].x-c[i-1].x,c[i].y-c[i-1].y);let u=m/2;for(let i=1;i<c.length;i++){let a=c[i-1],g=c[i],b=Math.hypot(g.x-a.x,g.y-a.y);if(b>=u&&b>0)return{x:a.x+(g.x-a.x)*u/b,y:a.y+(g.y-a.y)*u/b};u-=b}return c[c.length-1]}var S=pe(Pe(),1);function Ue({frame:c,width:m,height:u,pan:i,store:a,graphVersion:g,selection:b,view:k,emphasis:L,hiddenKinds:A,drawn:G}){let[ce,h]=(0,P.useState)(null),p=c.city,N=e=>a.graph.getNode(e)?.kind,B=(0,P.useMemo)(()=>je(a.graph.allEdges(),e=>a.graph.getNode(e)?.kind),[a,g]),I=new Map;for(let e of c.nodes){let t=e.id.startsWith("kind:")?Ie(e.id):null;t!==null&&e.plot&&Math.round(e.plane)===2&&I.set(t,e.plot)}let _=[...I].map(([e,t])=>`${e}:${t.col},${t.row},${t.side}`).join(";"),C=p?.cell??0,H=B.filter(e=>I.has(e.from)&&I.has(e.to)&&!A.has(e.from)&&!A.has(e.to)&&G(e.edge)),F=p?.tilt??.5,[J,Q]=(0,P.useState)([]),se=J.map(e=>`${Math.round(e.x)},${Math.round(e.y)},${Math.round(e.width)},${Math.round(e.height)}`).join(";"),[Z,ue]=(0,P.useState)(null),ee=c.t>=1;(0,P.useLayoutEffect)(()=>{let e=Z?.parentElement;if(!e||!p||!ee)return;let t=e.getBoundingClientRect(),s=p.originX+i.x,o=p.originY+i.y,l=[...e.querySelectorAll('[data-graview-view^="kind:"] .graview-kind-face')].flatMap(d=>{let y=d.getBoundingClientRect();return y.width>0&&y.height>0?[{x:y.left-t.left-s,y:y.top-t.top-o,width:y.width,height:y.height}]:[]});l.map(d=>`${Math.round(d.x)},${Math.round(d.y)},${Math.round(d.width)},${Math.round(d.height)}`).join(";")!==se&&Q(l)},[Z,ee,_,C,F]);let V=(0,P.useMemo)(()=>{if(C===0)return[];let e=new Map,t=Math.max(0,...H.map(o=>o.links)),s=Oe({ribbons:H.map(o=>({key:o.key,from:o.from,to:o.to,width:xe(o.links,t)})),plots:I,cell:C,tilt:F,labels:J});return H.flatMap(o=>{let l;if(o.from===o.to){let w=e.get(o.from)??0;e.set(o.from,w+1),l=Be(Se(I.get(o.from),w),{cell:C,tilt:F})}else l=s.get(o.key);return!l||l.length<2?[]:[{ribbon:o,points:l,d:Fe(l),middle:Ne(l),width:xe(o.links,t)}]})},[C,F,_,B,G,A,se]),de=(0,P.useRef)([]),X=(0,P.useRef)({x:0,y:0});if(X.current=p?{x:p.originX+i.x,y:p.originY+i.y}:{x:0,y:0},(0,P.useEffect)(()=>{let e=Z?.parentElement;if(!e||typeof window>"u")return;let t=0,s=null,o=()=>{t=0;let d=s;if(!d)return;let y=d.target;if(d.pointerType==="touch"||d.buttons!==0||y?.closest("[data-graview-view], button, a, input, select, textarea, [data-graview-overlay], [data-graview-offstage]")){h(null);return}let r=e.getBoundingClientRect(),v=d.clientX-r.left-X.current.x,M=d.clientY-r.top-X.current.y,x=null,D=1/0;for(let $ of de.current){let f=qe($.points,v,M);f<=$.reach&&f<D&&(D=f,x=$.key)}h(x)},l=d=>{s=d,t===0&&(t=requestAnimationFrame(o))},w=()=>h(null);return e.addEventListener("pointermove",l,{passive:!0}),e.addEventListener("pointerleave",w),()=>{t!==0&&cancelAnimationFrame(t),e.removeEventListener("pointermove",l),e.removeEventListener("pointerleave",w)}},[Z]),!p||!k.overview||V.length===0)return null;let O=Ee(b,k,N);if(O.records.length>0||O.lens!==null)return null;let T=O.districts.length>0?V.filter(({ribbon:e})=>O.districts.includes(e.from)||O.districts.includes(e.to)):V;if(T.length===0)return null;let te=L??null,Y=T.find(({ribbon:e})=>e.key===ce);de.current=T.map(({ribbon:e,points:t,width:s})=>({key:e.key,points:t,reach:s/2+6}));let K={x:p.originX+i.x,y:p.originY+i.y},n=`translate(${K.x.toFixed(1)} ${K.y.toFixed(1)})`;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("svg",{ref:ue,className:"graview-ribbons","aria-hidden":"true","data-graview-world":"","data-graview-ribbons":T.length,width:m,height:u,style:{position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible"},children:(0,S.jsx)("g",{transform:n,children:T.map(({ribbon:e,d:t,width:s})=>{let o=ce===e.key||te!==null&&te===e.edge||O.districts.length>0,l=te!==null&&te!==e.edge;return(0,S.jsx)("g",{className:"graview-ribbon","data-graview-ribbon":e.edge,"data-graview-from":`kind:${e.from}`,"data-graview-to":`kind:${e.to}`,"data-graview-links":e.links,"data-graview-lit":o&&!l?"":void 0,"data-graview-receded":l?"":void 0,children:(0,S.jsx)("path",{className:"graview-ribbon-band",d:t,style:{strokeWidth:s}})},e.key)})})}),Y?(0,S.jsx)("div",{className:"graview-ribbon-said","data-graview-world":"","data-testid":"ribbon-said",role:"status",style:{position:"absolute",left:K.x+Y.middle.x,top:K.y+Y.middle.y,pointerEvents:"none"},children:Re(a.schema,Y.ribbon)}):null]})}function qe(c,m,u){let i=1/0;for(let a=1;a<c.length;a++){let g=c[a-1],b=c[a],k=b.x-g.x,L=b.y-g.y,A=k*k+L*L,G=A===0?0:Math.max(0,Math.min(1,((m-g.x)*k+(u-g.y)*L)/A));i=Math.min(i,Math.hypot(m-(g.x+G*k),u-(g.y+G*L)))}return i}export{Ue as Ribbons,qe as distanceTo};
|
|
1
|
+
import"./chunk.XDYAG276.js";import{a as xe}from"./chunk.HJCQ6I3S.js";import{c as he}from"./chunk.ZWZ5SEXT.js";import{a as je,b as Ee,c as Ie,d as Re}from"./chunk.FQKH67BP.js";import"./chunk.GZLYTPE7.js";import"./chunk.4B73P2WA.js";import"./chunk.IMRCAU4T.js";import{F as Ke,Q as Pe}from"./chunk.6II4BONS.js";import"./chunk.F5BCCGFK.js";import{b as pe}from"./chunk.AJZBJBMO.js";var P=pe(Ke(),1);var E=.5,fe=1,ye=.76,Le=3,We=3,Ae=.6;function Oe(c){let{ribbons:m,plots:u,cell:i}=c,a=c.tilt??.5,g=c.labels??[],b=[...u.values()],k=new Map;if(b.length===0||i<=0)return k;let L=Math.min(...b.map(n=>n.col))-3,A=Math.min(...b.map(n=>n.row))-3,G=Math.max(...b.map(n=>n.col+n.side))+3,ce=Math.max(...b.map(n=>n.row+n.side))+3,h=Math.round((G-L)/E)+1,p=Math.round((ce-A)/E)+1,N=n=>L+n*E,B=n=>A+n*E,I=4,_=!0,C=(n,e)=>{if(!_)return!1;let t=he(n,e,i,a);return g.some(s=>t.x>s.x-I&&t.x<s.x+s.width+I&&t.y>s.y-I&&t.y<s.y+s.height+I)},H=(n,e)=>b.some(t=>n>t.col-ye&&n<t.col+t.side+ye&&e>t.row-ye&&e<t.row+t.side+ye),F=new Uint8Array(h*p),J=new Uint8Array(h*p);for(let n=0;n<h;n++)for(let e=0;e<p;e++){let t=N(n),s=B(e);J[e*h+n]=H(t,s)?0:1,F[e*h+n]=J[e*h+n]&&!C(t,s)?1:0}let Q=F,se=new Float32Array(h*p);for(let n=0;n<h;n++)for(let e=0;e<p;e++){let t=N(n),s=B(e);se[e*h+n]=Math.min(...b.map(o=>Math.max(0,o.col-t,t-(o.col+o.side),o.row-s,s-(o.row+o.side))))}let Z=(n,e,t,s)=>{let o=N(n)+t*E/2,l=B(e)+s*E/2;return!H(o,l)&&!C(o,l)},ue=n=>{let e=[],t=(o,l)=>{let w=[],d=Math.min(1,l/3);for(let y=Math.ceil((o+d)/E-1e-9)*E;y<=o+l-d+1e-9;y+=E)w.push(y);return w},s=(o,l,w,d)=>{let y=Math.round((o-L)/E),r=Math.round((l-A)/E);y>=0&&r>=0&&y<h&&r<p&&Q[r*h+y]&&e.push({i:y,j:r,out:w,curb:d})};for(let o of t(n.row,n.side))s(n.col-fe,o,1,{col:n.col,row:o}),s(n.col+n.side+fe,o,0,{col:n.col+n.side,row:o});for(let o of t(n.col,n.side))s(o,n.row-fe,3,{col:o,row:n.row}),s(o,n.row+n.side+fe,2,{col:o,row:n.row+n.side});return e},ee=new Map,V=(n,e,t,s)=>n<t||n===t&&e<s?`${n},${e}-${t},${s}`:`${t},${s}-${n},${e}`,de=[[1,0],[-1,0],[0,1],[0,-1]],X=new Map;for(let n of m){let e=u.get(n.from),t=u.get(n.to);if(!e||!t||e===t)continue;let s=-1,o=[],l=new Map,w=new Int32Array(0),d=1/0,y=[];for(let f of[!0,!1]){s=-1,d=1/0,_=f,Q=f?F:J,o=ue(e);let W=ue(t);if(o.length===0||W.length===0){y.push({reached:-1,starts:o,goal:l,back:w,best:d});continue}l=new Map(W.map(j=>[j.j*h+j.i,j]));let ne=(j,R)=>{let re=N(j),ae=B(R);return(Math.max(0,t.col-re,re-(t.col+t.side))+Math.max(0,t.row-ae,ae-(t.row+t.side)))*Ae},oe=h*p*4,ie=new Float64Array(oe).fill(1/0);w=new Int32Array(oe).fill(-1);let le=new ke;for(let j of o){let R=(j.j*h+j.i)*4+j.out;ie[R]=0,le.push(R,ne(j.i,j.j))}let Ce=[1,0,3,2];for(;le.size>0&&!(le.peekKey()>=d);){let R=le.pop(),re=Math.floor(R/4),ae=R%4,ge=re%h,we=Math.floor(re/h),ve=l.get(re);if(ve){let q=ie[R]+(ae===Ce[ve.out]?0:Le);q<d&&(d=q,s=R);continue}for(let q=0;q<4;q++){let[Me,$e]=de[q],U=ge+Me,z=we+$e;if(U<0||z<0||U>=h||z>=p||!Q[z*h+U]||!Z(ge,we,Me,$e))continue;let Te=E*(ee.has(V(ge,we,U,z))?Ae:1)*(1+Math.max(0,se[z*h+U]-We))+(q===ae?0:Le),me=(z*h+U)*4+q,be=ie[R]+Te;be<ie[me]&&(ie[me]=be,w[me]=R,le.push(me,be+ne(U,z)))}}y.push({reached:s,starts:o,goal:l,back:w,best:d})}_=!0,Q=F;let[r,v]=y,M=r&&r.reached!==-1&&(!v||v.reached===-1||r.best<=1.3*v.best+2)?r:v;if(!M||M.reached===-1)continue;({reached:s,starts:o,goal:l,back:w}=M);let x=[];for(let f=s;f!==-1;f=w[f]){let W=Math.floor(f/4),ne=x[x.length-1],oe={i:W%h,j:Math.floor(W/h)};(!ne||ne.i!==oe.i||ne.j!==oe.j)&&x.push(oe)}x.reverse();for(let f=1;f<x.length;f++){let W=V(x[f-1].i,x[f-1].j,x[f].i,x[f].j);ee.set(W,[...ee.get(W)??[],n.key])}let D=o.find(f=>f.i===x[0].i&&f.j===x[0].j),$=l.get(x[x.length-1].j*h+x[x.length-1].i);X.set(n.key,{cells:x,start:D.curb,end:$.curb})}let O=new Map(m.map(n=>[n.key,n.width])),T=new Map(m.map((n,e)=>[n.key,e])),te=i*a/Math.sqrt(1+a*a),Y=(n,e)=>n==="col"?`r${e.row.toFixed(2)}`:`c${e.col.toFixed(2)}`,K=new Map;for(let[n,e]of X)for(let t=1;t<e.cells.length;t++){let s=e.cells[t-1],o=e.cells[t],l=Y(s.i!==o.i?"col":"row",{col:N(s.i),row:B(s.j)});K.set(l,(K.get(l)??new Set).add(n))}for(let[n,e]of X){let t=[e.start,...e.cells.map(r=>({col:N(r.i),row:B(r.j)})),e.end],s=r=>r>=2&&r<=e.cells.length?V(e.cells[r-2].i,e.cells[r-2].j,e.cells[r-1].i,e.cells[r-1].j):null,o=[];for(let r=1;r<t.length;r++){let v=Math.abs(t[r].col-t[r-1].col)>1e-9?"col":"row",M=o[o.length-1];M&&M.axis===v?M.to=r:o.push({from:r-1,to:r,axis:v})}if(o.length===0)continue;let l=o.map(r=>{if(!Array.from({length:r.to-r.from},($,f)=>s(r.from+1+f)).some($=>$!==null))return 0;let v=K.get(Y(r.axis,t[r.from]))??new Set;if(!v.has(n))return 0;let M=[...v].sort(($,f)=>(T.get($)??0)-(T.get(f)??0)),D=-(M.reduce(($,f)=>$+(O.get(f)??2)+2,0)-2)/2;for(let $ of M){if($===n)return(D+(O.get($)??2)/2)/te;D+=(O.get($)??2)+2}return 0}),w=r=>{let v=o[r],M=t[v.from];return v.axis==="col"?{row:M.row+l[r]}:{col:M.col+l[r]}},d=(r,v,M)=>({col:r.col??v.col??M.col,row:r.row??v.row??M.row}),y=[d(w(0),{},t[0])];for(let r=0;r+1<o.length;r++)y.push(d(w(r),w(r+1),t[o[r].to]));y.push(d(w(o.length-1),{},t[t.length-1])),k.set(n,y.map(r=>he(r.col,r.row,i,a)))}return k}var ke=class{items=[];keys=[];get size(){return this.items.length}peekKey(){return this.keys[0]??1/0}push(m,u){this.items.push(m),this.keys.push(u);let i=this.items.length-1;for(;i>0;){let a=i-1>>1;if(this.keys[a]<=this.keys[i])break;this.swap(i,a),i=a}}pop(){let m=this.items[0],u=this.items.pop(),i=this.keys.pop();if(this.items.length>0){this.items[0]=u,this.keys[0]=i;let a=0;for(;;){let g=2*a+1,b=g+1,k=a;if(g<this.items.length&&this.keys[g]<this.keys[k]&&(k=g),b<this.items.length&&this.keys[b]<this.keys[k]&&(k=b),k===a)break;this.swap(a,k),a=k}}return m}swap(m,u){[this.items[m],this.items[u]]=[this.items[u],this.items[m]],[this.keys[m],this.keys[u]]=[this.keys[u],this.keys[m]]}};function Se(c,m){let u=c.col+c.side,i=u+.25+.22*Math.max(0,m),a=c.row+c.side*Math.max(.1,.3-.06*m),g=c.row+c.side*Math.min(.9,.7+.06*m);return[{col:u,row:a},{col:i,row:a},{col:i,row:g},{col:u,row:g}]}function Be(c,m){return c.map(u=>he(u.col,u.row,m.cell,m.tilt))}function Fe(c){return c.map((m,u)=>`${u===0?"M":"L"} ${m.x.toFixed(1)} ${m.y.toFixed(1)}`).join(" ")}function Ne(c){if(c.length===0)return{x:0,y:0};let m=0;for(let i=1;i<c.length;i++)m+=Math.hypot(c[i].x-c[i-1].x,c[i].y-c[i-1].y);let u=m/2;for(let i=1;i<c.length;i++){let a=c[i-1],g=c[i],b=Math.hypot(g.x-a.x,g.y-a.y);if(b>=u&&b>0)return{x:a.x+(g.x-a.x)*u/b,y:a.y+(g.y-a.y)*u/b};u-=b}return c[c.length-1]}var S=pe(Pe(),1);function Ue({frame:c,width:m,height:u,pan:i,store:a,graphVersion:g,selection:b,view:k,emphasis:L,hiddenKinds:A,drawn:G}){let[ce,h]=(0,P.useState)(null),p=c.city,N=e=>a.graph.getNode(e)?.kind,B=(0,P.useMemo)(()=>je(a.graph.allEdges(),e=>a.graph.getNode(e)?.kind),[a,g]),I=new Map;for(let e of c.nodes){let t=e.id.startsWith("kind:")?Ie(e.id):null;t!==null&&e.plot&&Math.round(e.plane)===2&&I.set(t,e.plot)}let _=[...I].map(([e,t])=>`${e}:${t.col},${t.row},${t.side}`).join(";"),C=p?.cell??0,H=B.filter(e=>I.has(e.from)&&I.has(e.to)&&!A.has(e.from)&&!A.has(e.to)&&G(e.edge)),F=p?.tilt??.5,[J,Q]=(0,P.useState)([]),se=J.map(e=>`${Math.round(e.x)},${Math.round(e.y)},${Math.round(e.width)},${Math.round(e.height)}`).join(";"),[Z,ue]=(0,P.useState)(null),ee=c.t>=1;(0,P.useLayoutEffect)(()=>{let e=Z?.parentElement;if(!e||!p||!ee)return;let t=e.getBoundingClientRect(),s=p.originX+i.x,o=p.originY+i.y,l=[...e.querySelectorAll('[data-graview-view^="kind:"] .graview-kind-face')].flatMap(d=>{let y=d.getBoundingClientRect();return y.width>0&&y.height>0?[{x:y.left-t.left-s,y:y.top-t.top-o,width:y.width,height:y.height}]:[]});l.map(d=>`${Math.round(d.x)},${Math.round(d.y)},${Math.round(d.width)},${Math.round(d.height)}`).join(";")!==se&&Q(l)},[Z,ee,_,C,F]);let V=(0,P.useMemo)(()=>{if(C===0)return[];let e=new Map,t=Math.max(0,...H.map(o=>o.links)),s=Oe({ribbons:H.map(o=>({key:o.key,from:o.from,to:o.to,width:xe(o.links,t)})),plots:I,cell:C,tilt:F,labels:J});return H.flatMap(o=>{let l;if(o.from===o.to){let w=e.get(o.from)??0;e.set(o.from,w+1),l=Be(Se(I.get(o.from),w),{cell:C,tilt:F})}else l=s.get(o.key);return!l||l.length<2?[]:[{ribbon:o,points:l,d:Fe(l),middle:Ne(l),width:xe(o.links,t)}]})},[C,F,_,B,G,A,se]),de=(0,P.useRef)([]),X=(0,P.useRef)({x:0,y:0});if(X.current=p?{x:p.originX+i.x,y:p.originY+i.y}:{x:0,y:0},(0,P.useEffect)(()=>{let e=Z?.parentElement;if(!e||typeof window>"u")return;let t=0,s=null,o=()=>{t=0;let d=s;if(!d)return;let y=d.target;if(d.pointerType==="touch"||d.buttons!==0||y?.closest("[data-graview-view], button, a, input, select, textarea, [data-graview-overlay], [data-graview-offstage]")){h(null);return}let r=e.getBoundingClientRect(),v=d.clientX-r.left-X.current.x,M=d.clientY-r.top-X.current.y,x=null,D=1/0;for(let $ of de.current){let f=qe($.points,v,M);f<=$.reach&&f<D&&(D=f,x=$.key)}h(x)},l=d=>{s=d,t===0&&(t=requestAnimationFrame(o))},w=()=>h(null);return e.addEventListener("pointermove",l,{passive:!0}),e.addEventListener("pointerleave",w),()=>{t!==0&&cancelAnimationFrame(t),e.removeEventListener("pointermove",l),e.removeEventListener("pointerleave",w)}},[Z]),!p||!k.overview||V.length===0)return null;let O=Ee(b,k,N);if(O.records.length>0||O.lens!==null)return null;let T=O.districts.length>0?V.filter(({ribbon:e})=>O.districts.includes(e.from)||O.districts.includes(e.to)):V;if(T.length===0)return null;let te=L??null,Y=T.find(({ribbon:e})=>e.key===ce);de.current=T.map(({ribbon:e,points:t,width:s})=>({key:e.key,points:t,reach:s/2+6}));let K={x:p.originX+i.x,y:p.originY+i.y},n=`translate(${K.x.toFixed(1)} ${K.y.toFixed(1)})`;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("svg",{ref:ue,className:"graview-ribbons","aria-hidden":"true","data-graview-world":"","data-graview-ribbons":T.length,width:m,height:u,style:{position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible"},children:(0,S.jsx)("g",{transform:n,children:T.map(({ribbon:e,d:t,width:s})=>{let o=ce===e.key||te!==null&&te===e.edge||O.districts.length>0,l=te!==null&&te!==e.edge;return(0,S.jsx)("g",{className:"graview-ribbon","data-graview-ribbon":e.edge,"data-graview-from":`kind:${e.from}`,"data-graview-to":`kind:${e.to}`,"data-graview-links":e.links,"data-graview-lit":o&&!l?"":void 0,"data-graview-receded":l?"":void 0,children:(0,S.jsx)("path",{className:"graview-ribbon-band",d:t,style:{strokeWidth:s}})},e.key)})})}),Y?(0,S.jsx)("div",{className:"graview-ribbon-said","data-graview-world":"","data-testid":"ribbon-said",role:"status",style:{position:"absolute",left:K.x+Y.middle.x,top:K.y+Y.middle.y,pointerEvents:"none"},children:Re(a.schema,Y.ribbon)}):null]})}function qe(c,m,u){let i=1/0;for(let a=1;a<c.length;a++){let g=c[a-1],b=c[a],k=b.x-g.x,L=b.y-g.y,A=k*k+L*L,G=A===0?0:Math.max(0,Math.min(1,((m-g.x)*k+(u-g.y)*L)/A));i=Math.min(i,Math.hypot(m-(g.x+G*k),u-(g.y+G*L)))}return i}export{Ue as Ribbons,qe as distanceTo};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as h,X as d,Y as a,_ as c,oa as u}from"./chunk.
|
|
1
|
+
import{F as h,X as d,Y as a,_ as c,oa as u}from"./chunk.6II4BONS.js";import{b as l}from"./chunk.AJZBJBMO.js";var i=l(h(),1);function w(){let e=u();return(0,i.useMemo)(()=>[...new Set(e.flatMap(o=>o.nodeIds))],[e])}function S(){let e=g(),o=d();return(0,i.useMemo)(()=>{if(!o)return e;let n=o.matched;return n.length===0&&e.length===0?[m]:[...new Set([...e,...n])]},[o,e])}function g(){let{store:e,selection:o}=a(),n=c();return(0,i.useMemo)(()=>{if(o.length===0)return[];let r=new Set(o),s=new Set(r);for(let t of e.graph.allEdges())r.has(t.from)&&s.add(t.to),r.has(t.to)&&s.add(t.from);for(let t of e.violations())if(t.subjectId!==void 0&&r.has(t.subjectId))for(let f of t.nodeIds)s.add(f);return[...s]},[e,o,n])}var m="search:nothing";export{w as a,S as b,g as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as n}from"./chunk.4STIUIT6.js";import"./chunk.WHTQHU3M.js";import"./chunk.KU6NIMQX.js";import"./chunk.Y3IJDWNS.js";import"./chunk.OFJH7LDC.js";import"./chunk.5PU3RWYY.js";import"./chunk.OREMUXB5.js";import"./chunk.ZDNJK2SX.js";import"./chunk.ZSSOTIFL.js";import"./chunk.CUCNT7MG.js";import"./chunk.2A2DLMT3.js";import"./chunk.E77K6KBX.js";import"./chunk.WVUJXDXZ.js";import{d as p}from"./chunk.VHWUGSFW.js";import"./chunk.P75TPZWT.js";import"./chunk.6W7J76TK.js";import"./chunk.FUR4IHWG.js";import"./chunk.2B4WVCVV.js";import"./chunk.AAZFVCSP.js";import"./chunk.GZHZLJBF.js";import"./chunk.PWOVXARZ.js";import"./chunk.SG23JC6D.js";import"./chunk.OJGHDWI6.js";import"./chunk.GZLYTPE7.js";import"./chunk.4B73P2WA.js";import"./chunk.IMRCAU4T.js";import"./chunk.BZ5VLPKB.js";import{Q as m}from"./chunk.6II4BONS.js";import"./chunk.F5BCCGFK.js";import{b as t}from"./chunk.AJZBJBMO.js";var i=t(m(),1),a=new WeakMap;function s(o){let e=a.get(o);if(!e){let r=p(o);e=c=>c.mode==="fullscreen"?(0,i.jsx)(n,{blocks:r,slot:"home",heading:2,firstHeading:1}):(0,i.jsx)(n,{blocks:r,slot:"home",heading:3,firstHeading:2}),a.set(o,e)}return e}export{s as homeView};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as ke,b as Se,c as $e,d as ka,e as Sa,h as ze,i as Ee,j as Ce,k as $a}from"./chunk.
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as ke,b as Se,c as $e,d as ka,e as Sa,h as ze,i as Ee,j as Ce,k as $a}from"./chunk.GOCUBIRW.js";import{g as xa,h as ba}from"./chunk.R7LRJS6B.js";import"./chunk.KU6NIMQX.js";import{b as wa,c as ua,d as ye,e as ma}from"./chunk.Y3IJDWNS.js";import"./chunk.ZDNJK2SX.js";import{p as ga,q as ca,r as va}from"./chunk.ZSSOTIFL.js";import{a as ha}from"./chunk.HJCQ6I3S.js";import"./chunk.ZWZ5SEXT.js";import{b as fa}from"./chunk.FQKH67BP.js";import"./chunk.LA7535VO.js";import"./chunk.ZEW2OOZ5.js";import"./chunk.7YQYWOZR.js";import{b as da}from"./chunk.3ZIOAPI5.js";import{b as fe,d as xe,e as be}from"./chunk.ZVMIHXVK.js";import"./chunk.272ZJXQP.js";import{b as he}from"./chunk.3SM2CHKF.js";import"./chunk.2A2DLMT3.js";import"./chunk.E77K6KBX.js";import"./chunk.UT6642FC.js";import{e as ya}from"./chunk.JLXQ6ZLI.js";import"./chunk.TI4OSTQV.js";import"./chunk.EBLKEQ7O.js";import"./chunk.GZHZLJBF.js";import{c as ia,d as na,e as Z,o as oa}from"./chunk.PWOVXARZ.js";import"./chunk.SG23JC6D.js";import"./chunk.OJGHDWI6.js";import"./chunk.GZLYTPE7.js";import"./chunk.4B73P2WA.js";import"./chunk.IMRCAU4T.js";import{H as pa,b as je,e as aa,f as ra,j as Oa,m as ta,r as sa,y as la}from"./chunk.BZ5VLPKB.js";import{A as Qe,F as O,Q as f,V as Ye,X as Ve,Y as S,_ as le,a as Q,fa as Xe,j as ue,k as ne,n as j,o as oe,oa as Je,p as me,pa as K,s as de,sa as Ze,wa as ea,xa as pe,y as Ue,z as se}from"./chunk.6II4BONS.js";import{Mb as _e,N as Fe,_ as Ge,aa as ie,ec as H,gc as D}from"./chunk.F5BCCGFK.js";import{b as p}from"./chunk.AJZBJBMO.js";function Ka(e){return`
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
.graview-altitude-control {
|
|
@@ -1123,5 +1123,5 @@ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=gl
|
|
|
1123
1123
|
}
|
|
1124
1124
|
[data-graview-connector][data-graview-activity] {
|
|
1125
1125
|
animation: graview-relation 1200ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
1126
|
-
}`}function Ae(e="dark",n={}){let s=Ka(e);return n.scope===void 0?s:je(s,n.scope)}var P=p(O(),1);var W=p(f(),1),Wa=pe(Q(()=>(__graviewPreload(import.meta.url,["./chunk.Y5Z4ZDTO.js","./chunk.UWIYKGYK.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.PJ2DF6C7.js")))).part(e=>(0,W.jsx)(e.MapKey,{}),{quiet:!0});function Te(){let{store:e}=S(),{view:n}=K(),s=le(),o=(0,P.useMemo)(()=>e.graph.allEdges().length>0,[e,s]),[r,v]=(0,P.useState)(!1),g=(0,P.useId)(),c=(0,P.useRef)(null),M=(0,P.useRef)(null);return(0,P.useEffect)(()=>{if(!r)return;let z=x=>{let I=x.target;I&&(M.current?.contains(I)||c.current?.contains(I))||v(!1)};return document.addEventListener("pointerdown",z,!0),()=>document.removeEventListener("pointerdown",z,!0)},[r]),o?(0,W.jsxs)("div",{style:{display:"contents"},onKeyDown:z=>{z.key!=="Escape"||!r||(z.preventDefault(),z.stopPropagation(),v(!1),c.current?.focus({preventScroll:!0}))},children:[(0,W.jsx)("button",{ref:c,type:"button","data-testid":"lines-key","aria-expanded":r,"aria-controls":g,title:"What the lines mean",onClick:()=>v(z=>!z),style:{position:"absolute",top:60,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("overview"),height:30,padding:"0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.8125rem",color:r?"var(--graview-accent)":"var(--graview-ink-muted)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Key"}),r?(0,W.jsxs)("div",{ref:M,id:g,"data-testid":"lines-key-pane","data-graview-offstage":"",style:{position:"absolute",top:98,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("rail"),width:Sa,maxHeight:"calc(100cqh - 120px)",overflowY:"auto",boxSizing:"border-box",padding:"8px 8px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[n.overview?(0,W.jsx)(Wa,{}):null,(0,W.jsx)(ka,{inside:!0,widthOf:ha})]}):null]}):null}var ce=p(O(),1),ge=p(f(),1);function za(e){return e.lens!==null?{what:"lens",kind:e.lens}:e.records.length===1&&e.districts.length===0?{what:"record",id:e.records[0]}:e.districts.length===1&&e.records.length===0?{what:"district",kind:e.districts[0]}:null}var qa=pe(Q(()=>(__graviewPreload(import.meta.url,["./chunk.U5EJSTST.js","./chunk.IX6RNGAT.js","./chunk.XSYBNUXF.js","./chunk.GCVO6N26.js","./chunk.LRRVBM4F.js","./chunk.5EAQDBBE.js","./chunk.YT2CYCVT.js","./chunk.HJCQ6I3S.js","./chunk.DUUARGPE.js","./chunk.FUQVNXLB.js","./chunk.LAF6GTBN.js","./chunk.QU356VB2.js","./chunk.QVKKXMNK.js","./chunk.GF7LA4QG.js","./chunk.AEHPDVLQ.js","./chunk.UT6642FC.js","./chunk.HPD5ZDZH.js","./chunk.WVUJXDXZ.js","./chunk.52QAIGCD.js","./chunk.PPUAPAWR.js","./chunk.IHFNLKXV.js","./chunk.577PGFUT.js","./chunk.FBY5IUGU.js","./chunk.4K5QCJFH.js","./chunk.GZHZLJBF.js","./chunk.QRMWFEEH.js","./chunk.MVN6H65Q.js","./chunk.OJGHDWI6.js","./chunk.Z7ZCR4LN.js","./chunk.RIW7SQH4.js","./chunk.FSAHO3LV.js","./chunk.Y5Z4ZDTO.js","./chunk.UWIYKGYK.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.CDMV6L5I.js")))),Fa=qa.part((e,n)=>(0,ge.jsx)(e.MapPanelFor,{showing:n.showing}),{what:"This panel",quiet:!0});function Me(){let{store:e,view:n,selection:s,hiddenKinds:o,seatTalk:r}=S();le();let v=(0,ce.useSyncExternalStore)(r.subscribe,()=>r.get().draft!==null,()=>!1);if(!n.overview||v)return null;let g=za(fa(s,{...n,beside:!0},c=>e.graph.getNode(c)?.kind));return!g||g.what!=="record"&&(o.has(g.kind)||!e.schema.kinds.includes(g.kind))?null:(0,ge.jsx)(ce.Suspense,{fallback:null,children:(0,ge.jsx)(Fa,{showing:g})})}var Ga=p(O(),1);var B=p(f(),1);function Ie(){let{view:e,go:n}=K(),{store:s,views:o,hiddenKinds:r}=S(),v=e.overview??!1,g=o.places().map($=>$.kind).filter($=>!r.has($)),c=pa(e,s.schema.kinds,g),M=()=>{n(ne(j(e,!1),c))},z=(()=>{if(!c)return null;let $=Ue(c)[0],y=e.within?.view,C=(y?o.places().find(R=>R.as===y):void 0)??($?o.places().filter(R=>R.kind===$).at(-1):void 0);return C?C.title:$?ie(s.schema,$):s.graph.getNode(c)?.label??null})(),x=v?"Close the map":"Up",I=v&&z?`Close the map, down to ${z}`:x;return(0,B.jsxs)("button",{type:"button","data-testid":"overview",className:"graview-altitude-control","aria-pressed":v,"aria-label":I,title:v?I:"Up \u2014 the whole thing, from above",onClick:()=>v?M():n(j(e,!0)),style:{position:"absolute",top:14,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("overview"),display:"inline-flex",alignItems:"center",justifyContent:"center",gap:7,height:38,padding:"0 13px 0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.875rem",whiteSpace:"nowrap",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)","--graview-altitude":v?1:0,...v?{color:"var(--graview-accent)"}:{}},children:[(0,B.jsxs)("svg",{className:"graview-altitude-mark",width:"16",height:"16",viewBox:"0 0 12 12","aria-hidden":"true",children:[(0,B.jsx)("ellipse",{className:"graview-altitude-mark-ring",cx:"6",cy:"6.6",rx:"5",ry:"2.6",fill:"none",stroke:"currentColor",strokeWidth:"0.9"}),(0,B.jsx)("circle",{className:"graview-altitude-mark-apex",cx:"6",cy:"4",r:"1.5",fill:"currentColor"}),(0,B.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"left",cx:"1.6",cy:"7.4",r:"1.2",fill:"currentColor"}),(0,B.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"right",cx:"10.4",cy:"7.4",r:"1.2",fill:"currentColor"})]}),(0,B.jsx)("span",{className:"graview-altitude-label",children:x})]})}var Re=p(f(),1);function Le(){let{administered:e}=S(),{view:n,go:s}=K(),o=e.filter(r=>r.canShow);return o.length===0?null:(0,Re.jsx)("div",{role:"group","aria-label":"Administered","data-testid":"administered",style:{display:"flex",gap:6},children:o.map(r=>(0,Re.jsx)("button",{type:"button","aria-pressed":r.shown,"data-testid":`show-${r.name}`,title:r.shown?`Hide the ${r.name}'s own districts again`:r.description??`Show the ${r.name}'s own districts beside the domain`,onClick:()=>s(wa(n,r.name,!r.shown)),style:{padding:"3px 11px",borderRadius:999,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:r.shown?"var(--graview-accent)":"var(--graview-edge)",color:r.shown?"var(--graview-accent)":"var(--graview-ink-muted)",background:r.shown?"var(--graview-panel)":"transparent"},children:r.shown?`Hide the ${r.name}`:`Show the ${r.name}`},r.name))})}var h=p(O(),1);var l=p(f(),1);Ye({search:ca,touchWeights:ga});var _a=e=>e.about==="rule"?"rule:":e.about==="act"?"act:":e.kind;function Ta({compact:e=!1}){let{store:n,view:s,setView:o,principal:r,setMenuAt:v,brand:g,aiDesk:c,selection:M}=S(),z=ra(c),x=Ve(),I=Je(),$=oa().marks.flag,y=(0,h.useRef)(null),C=(0,h.useId)(),[R,m]=(0,h.useState)(!1),[F,ee]=(0,h.useState)(null),[X,ae]=(0,h.useState)(null),A=s.q??"";(0,h.useEffect)(()=>{let a=t=>{if(t.defaultPrevented)return;let i=t.key.toLowerCase()==="k"&&(t.metaKey||t.ctrlKey)&&!t.altKey&&!t.shiftKey,w=t.key==="/"&&!t.metaKey&&!t.ctrlKey&&!t.altKey;if(!i&&!w)return;let d=y.current;if(!d)return;let _=d.closest("[data-graview-embed]"),L=t.target,J=L===document.body||L===document.documentElement||L===window;if(_&&!(i&&J||L instanceof Node&&_.contains(L)))return;let U=document.activeElement,Ba=U instanceof HTMLInputElement||U instanceof HTMLTextAreaElement||U instanceof HTMLSelectElement||U instanceof HTMLElement&&U.isContentEditable;w&&Ba||(t.preventDefault(),d.getClientRects().length===0&&d.closest("[data-graview-app-bar]")?.querySelector('[data-testid="app-find-open"]')?.click(),d.focus({preventScroll:!0}),d.select(),m(!0))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]);let Oe=(0,h.useMemo)(()=>X&&A.trim()?va(n,X,x?.words??A,{principal:r,limit:4}):[],[n,A,x,X,r]),ve=(0,h.useMemo)(()=>{let a=new Map;for(let[t,i]of(x?.hits??[]).entries()){if(i.about==="act")continue;let w=_a(i),d=a.get(w)??[];if(d.push({id:`${C}-${t}`,hit:i}),a.set(w,d),i.about==="node"&&i.id===X)for(let[_,L]of Oe.entries())d.push({id:`${C}-${t}-act-${_}`,hit:L})}return[...a.entries()]},[x,Oe,X,C]),N=z&&A.trim()?{id:`${C}-ask`,ask:A.trim()}:null,k=(0,h.useMemo)(()=>[...ve.flatMap(([,a])=>a),...N?[N]:[]],[ve,N?.ask]),T=k.find(a=>a.id===F)??k[0],Ke=(x?.hits??[]).filter(a=>a.about==="node").length;(0,h.useEffect)(()=>{ee(null),ae(null)},[A]);let re=(0,h.useRef)(null);(0,h.useEffect)(()=>{let a=re.current;if(!a)return;re.current=null;let t=0,i=()=>{let w=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`),d=document.activeElement;if(!(!d||d===document.body||d===document.documentElement||d===y.current||d===w))return;let L=w?.querySelector('[role="group"][aria-label="Arrange"] :is(button, input)');if(L)return L.focus({preventScroll:!0});w&&w.tabIndex>=0&&d!==w&&t>30&&w.focus({preventScroll:!0}),++t<240&&requestAnimationFrame(i)};requestAnimationFrame(i)},[s]);let G=a=>{if(a){if(ee(a.id),"ask"in a){ae(null);return}a.hit.about==="node"?ae(a.hit.id):a.hit.about!=="act"&&ae(null)}},We=a=>{let t=document.getElementById(C),i=t?.querySelector('[role="option"]')?.getBoundingClientRect().height??0,w=t?.clientHeight??0;return Math.min(a,i>0&&w>0?Math.max(1,Math.floor(w/i)-1):Ya)};(0,h.useEffect)(()=>{F&&document.getElementById(F)?.scrollIntoView?.({block:"nearest"})},[F]);let we=a=>{if(!a)return;if("ask"in a){aa(c,{pointed:{...M[0]!==void 0?{on:M[0]}:{},about:M},asked:a.ask}),o(i=>ye(i)),m(!1);return}let t=a.hit;switch(t.about){case"node":o(i=>oe(ne(j(i,!1),t.id),[t.id]));break;case"kind":o(i=>se(j(i,!1),de(t.kind),{ownPicture:!0})),re.current=t.kind;break;case"place":o(i=>Qe(i,t.kind,t.as)),re.current=t.kind;break;case"rule":{let i=I.filter(w=>w.invariant===t.name).flatMap(w=>w.nodeIds);o(w=>oe(w,[...new Set(i)]));break}case"act":{o(w=>oe(w,[t.subject]));let i=y.current?.getBoundingClientRect();v({x:i?.left??0,y:(i?.bottom??0)+6,on:t.subject});break}}m(!1),y.current?.blur()},Pa=x?ja(x.byKind,x.hits,n.schema):"",te=R&&A.trim().length>0,Da=(0,h.useCallback)(()=>{let a=y.current?.closest("[data-graview-app-bar]")?.getBoundingClientRect();if(a)return{x:a.right,y:a.bottom-Xa};let t=y.current?.getBoundingClientRect();return t?{x:t.right,y:t.bottom}:null},[]),qe=ea("find",{open:te,onOpenChange:a=>{a||m(!1)},...e?{at:Da}:{}});return(0,l.jsxs)("div",{style:{position:"relative",minWidth:0,flex:"1 1 auto"},"data-testid":"find",children:[(0,l.jsx)("input",{ref:a=>{y.current=a,qe.trigger.ref(a)},"data-graview-popover-trigger":"find",type:"search",role:"combobox","aria-label":"Find anything","aria-expanded":te,"aria-controls":C,"aria-autocomplete":"list",...te&&T?{"aria-activedescendant":T.id}:{},"data-testid":"find-box",placeholder:"Find\u2026","aria-keyshortcuts":"/ Meta+K Control+K",value:A,onChange:a=>{let t=a.target.value;m(!0),o(i=>ua(i,t.length>0?t:null))},onFocus:()=>m(!0),onBlur:()=>m(!1),onKeyDown:a=>{let t=F!==null&&T?k.indexOf(T):-1,i=d=>d!==void 0&&!("ask"in d)&&d.hit.about==="act",w=t>=0&&T!==void 0&&!("ask"in T)&&T.hit.about==="node";if(a.key==="ArrowDown"){a.preventDefault(),m(!0);let d=t+1;if(w)for(;d<k.length-1&&i(k[d]);)d+=1;G(k[Math.min(k.length-1,d)])}else if(a.key==="ArrowUp")a.preventDefault(),G(k[Math.max(0,t-1)]);else if((a.key==="PageDown"||a.key==="PageUp")&&k.length>0){a.preventDefault(),m(!0);let d=k.flatMap((J,U)=>i(J)?[]:[U]),_=Math.max(0,d.findIndex(J=>J>=Math.max(t,0))),L=a.key==="PageDown"?We(k.length):-We(k.length);G(k[d[Math.min(d.length-1,Math.max(0,(t<0?-1:_)+L))]])}else if(a.key==="ArrowRight"&&w&&i(k[t+1]))a.preventDefault(),G(k[t+1]);else if(a.key==="ArrowLeft"&&i(T)){a.preventDefault();let d=t-1;for(;d>0&&i(k[d]);)d-=1;G(k[d])}else a.key==="Enter"?(a.preventDefault(),we(T)):a.key==="Escape"&&(a.preventDefault(),A?o(d=>ye(d)):y.current?.blur())},style:{width:"100%",boxSizing:"border-box",minWidth:0,height:30,padding:"0 var(--graview-bar-find-end, 10px) 0 10px",font:"inherit",fontSize:"0.875rem",color:"var(--graview-ink)",background:"var(--graview-panel)",border:`1px solid ${A?"var(--graview-accent)":"var(--graview-edge)"}`,borderRadius:8}}),(0,l.jsx)("span",{role:"status","aria-live":"polite",style:ta,"data-testid":"find-count",children:A.trim()?Pa:""}),(0,l.jsxs)("div",{...qe.pane,id:C,role:"listbox","aria-label":A?`What \u201C${A}\u201D finds`:"What the words find","data-testid":"find-strip",hidden:!te,onMouseDown:a=>a.preventDefault(),style:e?{...Ca,...Ja}:Ca,children:[k.every(a=>"ask"in a)?(0,l.jsxs)("p",{role:"presentation",style:{margin:0,padding:"10px 12px",color:"var(--graview-ink-muted)",fontSize:"0.875rem"},"data-testid":"find-nothing",children:["Nothing here is called \u201C",x?.words||A,"\u201D."]}):ve.map(([a,t])=>(0,l.jsxs)("div",{role:"group","aria-label":Ea(a,n.schema),children:[(0,l.jsxs)("div",{role:"presentation",style:Za,children:[a!=="rule:"?(0,l.jsx)(Qa,{kind:a,accents:g?.accents}):null,Ea(a,n.schema)]}),t.map(i=>(0,l.jsx)("div",{id:i.id,role:"option","aria-selected":i===T,"data-testid":"find-hit","data-about":i.hit.about,...i.hit.about==="node"&&i.hit.near?{"data-near":""}:{},onMouseEnter:()=>G(i),onClick:()=>we(i),style:{...Aa,...i.hit.about==="act"?{paddingLeft:30}:{},background:i===T?"var(--graview-panel-muted)":"transparent"},children:(0,l.jsx)(Ua,{hit:i.hit,flag:$})},i.id))]},a)),N?(0,l.jsx)("div",{id:N.id,role:"option","aria-selected":N===T||T?.id===N.id,"data-testid":"find-ask",onMouseEnter:()=>G(N),onClick:()=>we(N),style:{...Aa,borderTop:"1px solid var(--graview-edge)",marginTop:4,background:T?.id===N.id?"var(--graview-panel-muted)":"transparent"},children:(0,l.jsxs)("span",{children:["Ask: ",(0,l.jsxs)("span",{style:{fontWeight:600},children:["\u2018",N.ask,"\u2019"]})]})}):null,Ke>Va?(0,l.jsxs)("p",{role:"presentation",style:{margin:0,padding:"6px 12px 2px",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},"data-testid":"find-more-words",children:[Fe(Ke)," found: another word of the name narrows them."]}):null,x&&x.searched.past===!1&&x.searched.kinds.some(a=>n.schema.tryDefinition(a)?.lifecycle)?(0,l.jsx)("p",{role:"presentation",style:{margin:0,padding:"6px 12px 8px",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"Current ones; add is:any for the past."}):null]})]})}function Ua({hit:e,flag:n}){switch(e.about){case"node":return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("span",{style:{fontWeight:600,overflowWrap:"anywhere"},children:[e.flagged?(0,l.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[n," "]}):null,e.label,e.apart?(0,l.jsxs)("span",{style:Y,children:[" \xB7 ",e.apart]}):null,e.current?null:(0,l.jsx)("span",{style:Y,children:" \xB7 past"})]}),e.near?(0,l.jsxs)("span",{style:Y,"data-testid":"find-near",children:["Near \u201C",e.why.asked,"\u201D",e.why.field!=="label"?` \u2014 ${e.why.reading.toLowerCase()}: ${e.why.fragment}`:""]}):e.why.field!=="label"?(0,l.jsxs)("span",{style:Y,children:[e.why.reading.toLowerCase(),": ",e.why.fragment]}):null]});case"kind":return(0,l.jsxs)("span",{children:[e.label,(0,l.jsxs)("span",{style:Y,children:[" \xB7 ",e.count," match"]})]});case"place":return(0,l.jsxs)("span",{children:["Go to ",e.title]});case"rule":return(0,l.jsxs)("span",{children:["The rule \u201C",e.label,"\u201D"]});case"act":return(0,l.jsxs)("span",{style:e.destructive?{color:"var(--graview-warn)"}:void 0,children:[e.title,(0,l.jsxs)("span",{style:Y,children:[" \xB7 ",e.why.field==="title"?"act":`on ${e.why.fragment}`]})]})}}function Qa({kind:e,accents:n}){let s=Math.round(_e(e,n));return(0,l.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:2,flex:"0 0 auto",background:`hsl(${s} 55% 52%)`}})}function Ea(e,n){return e==="rule:"?"Rules":e==="act:"?"Acts":n.tryDefinition(e)?.plural??`${e}s`}function ja(e,n,s){let o=Object.entries(e).map(([g,c])=>Ge(s,g,c)),r=n.filter(g=>g.about==="kind"||g.about==="place"||g.about==="rule").length;r>0&&o.push(`${r} ${r===1?"place or rule":"places and rules"}`);let v=n.filter(g=>g.about==="node"&&g.near).length;return o.length===0?"Nothing found":`${o.join(", ")} found${v>0?`, ${v} of them near`:""}`}var Ya=10,Va=12,Ca={...Ze,width:"min(26rem, calc(100vw - 24px))",maxHeight:"min(60vh, 28rem)",overflowY:"auto",boxSizing:"border-box",background:"var(--graview-panel)",borderTop:"1px solid var(--graview-edge)",borderRight:"1px solid var(--graview-edge)",borderBottom:"1px solid var(--graview-edge)",borderLeft:"1px solid var(--graview-edge)",borderRadius:10,boxShadow:"0 10px 28px rgb(0 0 0 / 0.18)",padding:"4px 0"},Xa=6,Ja={width:"var(--graview-bar-width, 100vw)",maxHeight:"55vh",borderRadius:0,borderLeft:"none",borderRight:"none"},Za={display:"flex",alignItems:"center",gap:6,padding:"8px 12px 2px",fontSize:"0.6875rem",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},Aa={display:"grid",gap:1,minHeight:32,padding:"5px 12px",alignContent:"center",cursor:"pointer",fontSize:"0.875rem",lineHeight:1.35,color:"var(--graview-ink)"},Y={color:"var(--graview-ink-muted)",fontSize:"0.8125rem",fontWeight:400};var V=p(O(),1);var Ne=p(Oa(),1);var Ia=p(f(),1);function Ma(){let{following:e,follow:n}=S();return e?(0,Ia.jsxs)("button",{type:"button","data-testid":"following-who",onClick:()=>n(null),title:"Press, or Escape, to stop following",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,padding:"2px 9px",borderRadius:999,border:"1px solid var(--graview-accent)",background:"transparent",color:"var(--graview-accent)",fontSize:"0.875rem",whiteSpace:"nowrap"},children:["following ",e.name]}):null}var Ra=p(O(),1);var b=p(f(),1);function La({home:e,homeLabel:n,children:s,onPicture:o=!1}){let{view:r,focus:v,show:g,go:c}=K(),{store:M}=S(),{movedByHand:z}=S(),x=z&&(r.pan!==void 0||Object.keys(r.pins).length>0),I=r.focusId&&r.focusId!==e?M.graph.getNode(r.focusId):void 0,$=m=>ie(M.schema,m),y={display:"inline-flex",alignItems:"center",gap:6,minHeight:26,padding:"2px 6px",fontSize:"0.8125rem",borderRadius:6,border:"1px solid transparent",boxShadow:"none",background:"transparent",color:"var(--graview-ink-muted)",whiteSpace:"nowrap"},C=n!==void 0&&I!==void 0,R=[];if(I&&!o&&R.push({key:"focused",node:(0,b.jsxs)("button",{type:"button","data-testid":"focused",onClick:()=>c(me({...r,focusId:e},!1)),title:he(M,I.id),style:{...y,maxWidth:"min(14rem, 15vw)"},children:[(0,b.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:he(M,I.id)}),(0,b.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),r.past&&R.push({key:"past",node:(0,b.jsxs)("button",{type:"button","data-testid":"past",onClick:()=>c(ma(r,!1)),title:"Back to now \u2014 retired things leave the picture again",style:y,children:["the past",(0,b.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),r.zoom&&R.push({key:"zoomed",node:(0,b.jsxs)("button",{type:"button","data-testid":"zoomed",onClick:()=>c(me(r,!1)),title:"Zoom back out",style:y,children:["zoomed in",(0,b.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),x&&R.push({key:"moved",node:(0,b.jsx)("button",{type:"button","data-testid":"moved",onClick:()=>c(ue(r)),title:"Put the camera and everything you dragged back where the layout wanted them",style:y,children:"Reset view"})}),r.relation){let m=r.relation;R.push({key:"raised",node:(0,b.jsxs)("span",{style:{display:"inline-flex",alignItems:"center"},children:[(0,b.jsxs)("button",{type:"button","data-testid":"raised-into",onClick:()=>c(se(r,de(m),{ownPicture:!0})),title:`Go into the ${$(m).toLowerCase()}`,"aria-label":`Go into the ${$(m).toLowerCase()}`,style:{...y,color:"var(--graview-ink)"},children:[$(m),(0,b.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\u2198"})]}),(0,b.jsx)("button",{type:"button","data-testid":"raised",onClick:()=>g(null),title:`Stop showing ${$(m).toLowerCase()}`,"aria-label":`Stop showing ${$(m).toLowerCase()}`,style:{...y,minWidth:26,justifyContent:"center"},children:(0,b.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})})]})})}return o&&!C&&R.length===0&&s===void 0?null:(0,b.jsxs)("nav",{"aria-label":"View","data-testid":"trail",style:{display:"flex",alignItems:"center",gap:8,fontSize:"0.875rem",minWidth:0,...o?{pointerEvents:"auto",padding:"4px 6px",borderRadius:8,background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",overflow:"hidden"}:{}},children:[C?(0,b.jsx)("button",{type:"button",onClick:()=>v(e),style:{border:"none",background:"none",padding:"3px 0",minHeight:24,whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:n}):null,R.map(({key:m,node:F},ee)=>(0,b.jsxs)(Ra.Fragment,{children:[C||ee>0?(0,b.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:"\u203A"}):null,F]},m)),s]})}var E=p(f(),1);function He(){let[e,n]=(0,V.useState)([]),s=(0,V.useCallback)(o=>{n(r=>{let v=o.phase!=="running"&&r[0]?.name===o.name&&r[0]?.at===o.at;return[o,...v?r.slice(1):r].slice(0,12)})},[]);return[e,s]}function Pe({find:e,calls:n,seat:s,remembers:o=!1}){return e?(0,E.jsxs)(E.Fragment,{children:[(0,Ne.createPortal)((0,E.jsx)(Ta,{compact:e.compact}),e.slot),e.own?(0,Ne.createPortal)((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(V.Suspense,{fallback:null,children:(0,E.jsx)($a,{})}),(0,E.jsx)(da,{calls:n,remembers:o,...s!==void 0?{seat:s}:{}})]}),e.own):null]}):null}function De({home:e=null}){return(0,E.jsxs)("div",{"data-graview-scene-trail":"",style:{position:"absolute",top:14,left:14,maxWidth:"calc(100% - 150px - var(--graview-dock, 0px))",zIndex:D("overview"),display:"flex",alignItems:"center",gap:6,minWidth:0,pointerEvents:"none"},children:[(0,E.jsx)(La,{home:e,onPicture:!0}),(0,E.jsx)("span",{style:{pointerEvents:"auto"},children:(0,E.jsx)(Ma,{})})]})}var q=p(O(),1);var Na=p(f(),1),er=Q(()=>(__graviewPreload(import.meta.url,["./chunk.UGFDSE37.js","./chunk.Y5Z4ZDTO.js","./chunk.UWIYKGYK.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.TWWFWHK3.js")));function Be(){let{store:e,principal:n}=S(),s=(0,q.useContext)(la),o=(0,q.useRef)(null),r=(0,q.useRef)(!1);return(0,q.useEffect)(()=>()=>void(r.current=!0),[]),(0,q.useEffect)(()=>{let v=e.batches().length,g=er().then(c=>c.sceneWay(e,n,s,v,o.current),()=>{});return()=>void g.then(c=>c?.(r.current))},[e,n,s]),(0,Na.jsx)("span",{ref:o,hidden:!0})}var Ha=p(O(),1);var u=p(f(),1);function At({address:e=!1,auto:n,quickAsk:s=!0,scheme:o,scope:r}){let v=(0,Ha.useMemo)(()=>`${Ce({scope:`.${r}`})}
|
|
1126
|
+
}`}function Ae(e="dark",n={}){let s=Ka(e);return n.scope===void 0?s:je(s,n.scope)}var P=p(O(),1);var W=p(f(),1),Wa=pe(Q(()=>(__graviewPreload(import.meta.url,["./chunk.BZ5VLPKB.js","./chunk.6II4BONS.js","./chunk.F5BCCGFK.js","./chunk.AJZBJBMO.js"]),import("./chunk.HZPTBPJY.js")))).part(e=>(0,W.jsx)(e.MapKey,{}),{quiet:!0});function Te(){let{store:e}=S(),{view:n}=K(),s=le(),o=(0,P.useMemo)(()=>e.graph.allEdges().length>0,[e,s]),[r,v]=(0,P.useState)(!1),g=(0,P.useId)(),c=(0,P.useRef)(null),M=(0,P.useRef)(null);return(0,P.useEffect)(()=>{if(!r)return;let z=x=>{let I=x.target;I&&(M.current?.contains(I)||c.current?.contains(I))||v(!1)};return document.addEventListener("pointerdown",z,!0),()=>document.removeEventListener("pointerdown",z,!0)},[r]),o?(0,W.jsxs)("div",{style:{display:"contents"},onKeyDown:z=>{z.key!=="Escape"||!r||(z.preventDefault(),z.stopPropagation(),v(!1),c.current?.focus({preventScroll:!0}))},children:[(0,W.jsx)("button",{ref:c,type:"button","data-testid":"lines-key","aria-expanded":r,"aria-controls":g,title:"What the lines mean",onClick:()=>v(z=>!z),style:{position:"absolute",top:60,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("overview"),height:30,padding:"0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.8125rem",color:r?"var(--graview-accent)":"var(--graview-ink-muted)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Key"}),r?(0,W.jsxs)("div",{ref:M,id:g,"data-testid":"lines-key-pane","data-graview-offstage":"",style:{position:"absolute",top:98,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("rail"),width:Sa,maxHeight:"calc(100cqh - 120px)",overflowY:"auto",boxSizing:"border-box",padding:"8px 8px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[n.overview?(0,W.jsx)(Wa,{}):null,(0,W.jsx)(ka,{inside:!0,widthOf:ha})]}):null]}):null}var ce=p(O(),1),ge=p(f(),1);function za(e){return e.lens!==null?{what:"lens",kind:e.lens}:e.records.length===1&&e.districts.length===0?{what:"record",id:e.records[0]}:e.districts.length===1&&e.records.length===0?{what:"district",kind:e.districts[0]}:null}var qa=pe(Q(()=>(__graviewPreload(import.meta.url,["./chunk.R7LRJS6B.js","./chunk.WHTQHU3M.js","./chunk.Y3IJDWNS.js","./chunk.OFJH7LDC.js","./chunk.5PU3RWYY.js","./chunk.ZDNJK2SX.js","./chunk.ZSSOTIFL.js","./chunk.HJCQ6I3S.js","./chunk.ZWZ5SEXT.js","./chunk.FQKH67BP.js","./chunk.LA7535VO.js","./chunk.ZEW2OOZ5.js","./chunk.7YQYWOZR.js","./chunk.2A2DLMT3.js","./chunk.E77K6KBX.js","./chunk.UT6642FC.js","./chunk.EBLKEQ7O.js","./chunk.WVUJXDXZ.js","./chunk.VHWUGSFW.js","./chunk.P75TPZWT.js","./chunk.6W7J76TK.js","./chunk.FUR4IHWG.js","./chunk.2B4WVCVV.js","./chunk.AAZFVCSP.js","./chunk.GZHZLJBF.js","./chunk.PWOVXARZ.js","./chunk.SG23JC6D.js","./chunk.OJGHDWI6.js","./chunk.GZLYTPE7.js","./chunk.4B73P2WA.js","./chunk.IMRCAU4T.js","./chunk.BZ5VLPKB.js","./chunk.6II4BONS.js","./chunk.F5BCCGFK.js","./chunk.AJZBJBMO.js"]),import("./chunk.OXZRGP53.js")))),Fa=qa.part((e,n)=>(0,ge.jsx)(e.MapPanelFor,{showing:n.showing}),{what:"This panel",quiet:!0});function Me(){let{store:e,view:n,selection:s,hiddenKinds:o,seatTalk:r}=S();le();let v=(0,ce.useSyncExternalStore)(r.subscribe,()=>r.get().draft!==null,()=>!1);if(!n.overview||v)return null;let g=za(fa(s,{...n,beside:!0},c=>e.graph.getNode(c)?.kind));return!g||g.what!=="record"&&(o.has(g.kind)||!e.schema.kinds.includes(g.kind))?null:(0,ge.jsx)(ce.Suspense,{fallback:null,children:(0,ge.jsx)(Fa,{showing:g})})}var Ga=p(O(),1);var B=p(f(),1);function Ie(){let{view:e,go:n}=K(),{store:s,views:o,hiddenKinds:r}=S(),v=e.overview??!1,g=o.places().map($=>$.kind).filter($=>!r.has($)),c=pa(e,s.schema.kinds,g),M=()=>{n(ne(j(e,!1),c))},z=(()=>{if(!c)return null;let $=Ue(c)[0],y=e.within?.view,C=(y?o.places().find(R=>R.as===y):void 0)??($?o.places().filter(R=>R.kind===$).at(-1):void 0);return C?C.title:$?ie(s.schema,$):s.graph.getNode(c)?.label??null})(),x=v?"Close the map":"Up",I=v&&z?`Close the map, down to ${z}`:x;return(0,B.jsxs)("button",{type:"button","data-testid":"overview",className:"graview-altitude-control","aria-pressed":v,"aria-label":I,title:v?I:"Up \u2014 the whole thing, from above",onClick:()=>v?M():n(j(e,!0)),style:{position:"absolute",top:14,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("overview"),display:"inline-flex",alignItems:"center",justifyContent:"center",gap:7,height:38,padding:"0 13px 0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.875rem",whiteSpace:"nowrap",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)","--graview-altitude":v?1:0,...v?{color:"var(--graview-accent)"}:{}},children:[(0,B.jsxs)("svg",{className:"graview-altitude-mark",width:"16",height:"16",viewBox:"0 0 12 12","aria-hidden":"true",children:[(0,B.jsx)("ellipse",{className:"graview-altitude-mark-ring",cx:"6",cy:"6.6",rx:"5",ry:"2.6",fill:"none",stroke:"currentColor",strokeWidth:"0.9"}),(0,B.jsx)("circle",{className:"graview-altitude-mark-apex",cx:"6",cy:"4",r:"1.5",fill:"currentColor"}),(0,B.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"left",cx:"1.6",cy:"7.4",r:"1.2",fill:"currentColor"}),(0,B.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"right",cx:"10.4",cy:"7.4",r:"1.2",fill:"currentColor"})]}),(0,B.jsx)("span",{className:"graview-altitude-label",children:x})]})}var Re=p(f(),1);function Le(){let{administered:e}=S(),{view:n,go:s}=K(),o=e.filter(r=>r.canShow);return o.length===0?null:(0,Re.jsx)("div",{role:"group","aria-label":"Administered","data-testid":"administered",style:{display:"flex",gap:6},children:o.map(r=>(0,Re.jsx)("button",{type:"button","aria-pressed":r.shown,"data-testid":`show-${r.name}`,title:r.shown?`Hide the ${r.name}'s own districts again`:r.description??`Show the ${r.name}'s own districts beside the domain`,onClick:()=>s(wa(n,r.name,!r.shown)),style:{padding:"3px 11px",borderRadius:999,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:r.shown?"var(--graview-accent)":"var(--graview-edge)",color:r.shown?"var(--graview-accent)":"var(--graview-ink-muted)",background:r.shown?"var(--graview-panel)":"transparent"},children:r.shown?`Hide the ${r.name}`:`Show the ${r.name}`},r.name))})}var h=p(O(),1);var l=p(f(),1);Ye({search:ca,touchWeights:ga});var _a=e=>e.about==="rule"?"rule:":e.about==="act"?"act:":e.kind;function Ta({compact:e=!1}){let{store:n,view:s,setView:o,principal:r,setMenuAt:v,brand:g,aiDesk:c,selection:M}=S(),z=ra(c),x=Ve(),I=Je(),$=oa().marks.flag,y=(0,h.useRef)(null),C=(0,h.useId)(),[R,m]=(0,h.useState)(!1),[F,ee]=(0,h.useState)(null),[X,ae]=(0,h.useState)(null),A=s.q??"";(0,h.useEffect)(()=>{let a=t=>{if(t.defaultPrevented)return;let i=t.key.toLowerCase()==="k"&&(t.metaKey||t.ctrlKey)&&!t.altKey&&!t.shiftKey,w=t.key==="/"&&!t.metaKey&&!t.ctrlKey&&!t.altKey;if(!i&&!w)return;let d=y.current;if(!d)return;let _=d.closest("[data-graview-embed]"),L=t.target,J=L===document.body||L===document.documentElement||L===window;if(_&&!(i&&J||L instanceof Node&&_.contains(L)))return;let U=document.activeElement,Ba=U instanceof HTMLInputElement||U instanceof HTMLTextAreaElement||U instanceof HTMLSelectElement||U instanceof HTMLElement&&U.isContentEditable;w&&Ba||(t.preventDefault(),d.getClientRects().length===0&&d.closest("[data-graview-app-bar]")?.querySelector('[data-testid="app-find-open"]')?.click(),d.focus({preventScroll:!0}),d.select(),m(!0))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]);let Oe=(0,h.useMemo)(()=>X&&A.trim()?va(n,X,x?.words??A,{principal:r,limit:4}):[],[n,A,x,X,r]),ve=(0,h.useMemo)(()=>{let a=new Map;for(let[t,i]of(x?.hits??[]).entries()){if(i.about==="act")continue;let w=_a(i),d=a.get(w)??[];if(d.push({id:`${C}-${t}`,hit:i}),a.set(w,d),i.about==="node"&&i.id===X)for(let[_,L]of Oe.entries())d.push({id:`${C}-${t}-act-${_}`,hit:L})}return[...a.entries()]},[x,Oe,X,C]),N=z&&A.trim()?{id:`${C}-ask`,ask:A.trim()}:null,k=(0,h.useMemo)(()=>[...ve.flatMap(([,a])=>a),...N?[N]:[]],[ve,N?.ask]),T=k.find(a=>a.id===F)??k[0],Ke=(x?.hits??[]).filter(a=>a.about==="node").length;(0,h.useEffect)(()=>{ee(null),ae(null)},[A]);let re=(0,h.useRef)(null);(0,h.useEffect)(()=>{let a=re.current;if(!a)return;re.current=null;let t=0,i=()=>{let w=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`),d=document.activeElement;if(!(!d||d===document.body||d===document.documentElement||d===y.current||d===w))return;let L=w?.querySelector('[role="group"][aria-label="Arrange"] :is(button, input)');if(L)return L.focus({preventScroll:!0});w&&w.tabIndex>=0&&d!==w&&t>30&&w.focus({preventScroll:!0}),++t<240&&requestAnimationFrame(i)};requestAnimationFrame(i)},[s]);let G=a=>{if(a){if(ee(a.id),"ask"in a){ae(null);return}a.hit.about==="node"?ae(a.hit.id):a.hit.about!=="act"&&ae(null)}},We=a=>{let t=document.getElementById(C),i=t?.querySelector('[role="option"]')?.getBoundingClientRect().height??0,w=t?.clientHeight??0;return Math.min(a,i>0&&w>0?Math.max(1,Math.floor(w/i)-1):Ya)};(0,h.useEffect)(()=>{F&&document.getElementById(F)?.scrollIntoView?.({block:"nearest"})},[F]);let we=a=>{if(!a)return;if("ask"in a){aa(c,{pointed:{...M[0]!==void 0?{on:M[0]}:{},about:M},asked:a.ask}),o(i=>ye(i)),m(!1);return}let t=a.hit;switch(t.about){case"node":o(i=>oe(ne(j(i,!1),t.id),[t.id]));break;case"kind":o(i=>se(j(i,!1),de(t.kind),{ownPicture:!0})),re.current=t.kind;break;case"place":o(i=>Qe(i,t.kind,t.as)),re.current=t.kind;break;case"rule":{let i=I.filter(w=>w.invariant===t.name).flatMap(w=>w.nodeIds);o(w=>oe(w,[...new Set(i)]));break}case"act":{o(w=>oe(w,[t.subject]));let i=y.current?.getBoundingClientRect();v({x:i?.left??0,y:(i?.bottom??0)+6,on:t.subject});break}}m(!1),y.current?.blur()},Pa=x?ja(x.byKind,x.hits,n.schema):"",te=R&&A.trim().length>0,Da=(0,h.useCallback)(()=>{let a=y.current?.closest("[data-graview-app-bar]")?.getBoundingClientRect();if(a)return{x:a.right,y:a.bottom-Xa};let t=y.current?.getBoundingClientRect();return t?{x:t.right,y:t.bottom}:null},[]),qe=ea("find",{open:te,onOpenChange:a=>{a||m(!1)},...e?{at:Da}:{}});return(0,l.jsxs)("div",{style:{position:"relative",minWidth:0,flex:"1 1 auto"},"data-testid":"find",children:[(0,l.jsx)("input",{ref:a=>{y.current=a,qe.trigger.ref(a)},"data-graview-popover-trigger":"find",type:"search",role:"combobox","aria-label":"Find anything","aria-expanded":te,"aria-controls":C,"aria-autocomplete":"list",...te&&T?{"aria-activedescendant":T.id}:{},"data-testid":"find-box",placeholder:"Find\u2026","aria-keyshortcuts":"/ Meta+K Control+K",value:A,onChange:a=>{let t=a.target.value;m(!0),o(i=>ua(i,t.length>0?t:null))},onFocus:()=>m(!0),onBlur:()=>m(!1),onKeyDown:a=>{let t=F!==null&&T?k.indexOf(T):-1,i=d=>d!==void 0&&!("ask"in d)&&d.hit.about==="act",w=t>=0&&T!==void 0&&!("ask"in T)&&T.hit.about==="node";if(a.key==="ArrowDown"){a.preventDefault(),m(!0);let d=t+1;if(w)for(;d<k.length-1&&i(k[d]);)d+=1;G(k[Math.min(k.length-1,d)])}else if(a.key==="ArrowUp")a.preventDefault(),G(k[Math.max(0,t-1)]);else if((a.key==="PageDown"||a.key==="PageUp")&&k.length>0){a.preventDefault(),m(!0);let d=k.flatMap((J,U)=>i(J)?[]:[U]),_=Math.max(0,d.findIndex(J=>J>=Math.max(t,0))),L=a.key==="PageDown"?We(k.length):-We(k.length);G(k[d[Math.min(d.length-1,Math.max(0,(t<0?-1:_)+L))]])}else if(a.key==="ArrowRight"&&w&&i(k[t+1]))a.preventDefault(),G(k[t+1]);else if(a.key==="ArrowLeft"&&i(T)){a.preventDefault();let d=t-1;for(;d>0&&i(k[d]);)d-=1;G(k[d])}else a.key==="Enter"?(a.preventDefault(),we(T)):a.key==="Escape"&&(a.preventDefault(),A?o(d=>ye(d)):y.current?.blur())},style:{width:"100%",boxSizing:"border-box",minWidth:0,height:30,padding:"0 var(--graview-bar-find-end, 10px) 0 10px",font:"inherit",fontSize:"0.875rem",color:"var(--graview-ink)",background:"var(--graview-panel)",border:`1px solid ${A?"var(--graview-accent)":"var(--graview-edge)"}`,borderRadius:8}}),(0,l.jsx)("span",{role:"status","aria-live":"polite",style:ta,"data-testid":"find-count",children:A.trim()?Pa:""}),(0,l.jsxs)("div",{...qe.pane,id:C,role:"listbox","aria-label":A?`What \u201C${A}\u201D finds`:"What the words find","data-testid":"find-strip",hidden:!te,onMouseDown:a=>a.preventDefault(),style:e?{...Ca,...Ja}:Ca,children:[k.every(a=>"ask"in a)?(0,l.jsxs)("p",{role:"presentation",style:{margin:0,padding:"10px 12px",color:"var(--graview-ink-muted)",fontSize:"0.875rem"},"data-testid":"find-nothing",children:["Nothing here is called \u201C",x?.words||A,"\u201D."]}):ve.map(([a,t])=>(0,l.jsxs)("div",{role:"group","aria-label":Ea(a,n.schema),children:[(0,l.jsxs)("div",{role:"presentation",style:Za,children:[a!=="rule:"?(0,l.jsx)(Qa,{kind:a,accents:g?.accents}):null,Ea(a,n.schema)]}),t.map(i=>(0,l.jsx)("div",{id:i.id,role:"option","aria-selected":i===T,"data-testid":"find-hit","data-about":i.hit.about,...i.hit.about==="node"&&i.hit.near?{"data-near":""}:{},onMouseEnter:()=>G(i),onClick:()=>we(i),style:{...Aa,...i.hit.about==="act"?{paddingLeft:30}:{},background:i===T?"var(--graview-panel-muted)":"transparent"},children:(0,l.jsx)(Ua,{hit:i.hit,flag:$})},i.id))]},a)),N?(0,l.jsx)("div",{id:N.id,role:"option","aria-selected":N===T||T?.id===N.id,"data-testid":"find-ask",onMouseEnter:()=>G(N),onClick:()=>we(N),style:{...Aa,borderTop:"1px solid var(--graview-edge)",marginTop:4,background:T?.id===N.id?"var(--graview-panel-muted)":"transparent"},children:(0,l.jsxs)("span",{children:["Ask: ",(0,l.jsxs)("span",{style:{fontWeight:600},children:["\u2018",N.ask,"\u2019"]})]})}):null,Ke>Va?(0,l.jsxs)("p",{role:"presentation",style:{margin:0,padding:"6px 12px 2px",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},"data-testid":"find-more-words",children:[Fe(Ke)," found: another word of the name narrows them."]}):null,x&&x.searched.past===!1&&x.searched.kinds.some(a=>n.schema.tryDefinition(a)?.lifecycle)?(0,l.jsx)("p",{role:"presentation",style:{margin:0,padding:"6px 12px 8px",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"Current ones; add is:any for the past."}):null]})]})}function Ua({hit:e,flag:n}){switch(e.about){case"node":return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("span",{style:{fontWeight:600,overflowWrap:"anywhere"},children:[e.flagged?(0,l.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[n," "]}):null,e.label,e.apart?(0,l.jsxs)("span",{style:Y,children:[" \xB7 ",e.apart]}):null,e.current?null:(0,l.jsx)("span",{style:Y,children:" \xB7 past"})]}),e.near?(0,l.jsxs)("span",{style:Y,"data-testid":"find-near",children:["Near \u201C",e.why.asked,"\u201D",e.why.field!=="label"?` \u2014 ${e.why.reading.toLowerCase()}: ${e.why.fragment}`:""]}):e.why.field!=="label"?(0,l.jsxs)("span",{style:Y,children:[e.why.reading.toLowerCase(),": ",e.why.fragment]}):null]});case"kind":return(0,l.jsxs)("span",{children:[e.label,(0,l.jsxs)("span",{style:Y,children:[" \xB7 ",e.count," match"]})]});case"place":return(0,l.jsxs)("span",{children:["Go to ",e.title]});case"rule":return(0,l.jsxs)("span",{children:["The rule \u201C",e.label,"\u201D"]});case"act":return(0,l.jsxs)("span",{style:e.destructive?{color:"var(--graview-warn)"}:void 0,children:[e.title,(0,l.jsxs)("span",{style:Y,children:[" \xB7 ",e.why.field==="title"?"act":`on ${e.why.fragment}`]})]})}}function Qa({kind:e,accents:n}){let s=Math.round(_e(e,n));return(0,l.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:2,flex:"0 0 auto",background:`hsl(${s} 55% 52%)`}})}function Ea(e,n){return e==="rule:"?"Rules":e==="act:"?"Acts":n.tryDefinition(e)?.plural??`${e}s`}function ja(e,n,s){let o=Object.entries(e).map(([g,c])=>Ge(s,g,c)),r=n.filter(g=>g.about==="kind"||g.about==="place"||g.about==="rule").length;r>0&&o.push(`${r} ${r===1?"place or rule":"places and rules"}`);let v=n.filter(g=>g.about==="node"&&g.near).length;return o.length===0?"Nothing found":`${o.join(", ")} found${v>0?`, ${v} of them near`:""}`}var Ya=10,Va=12,Ca={...Ze,width:"min(26rem, calc(100vw - 24px))",maxHeight:"min(60vh, 28rem)",overflowY:"auto",boxSizing:"border-box",background:"var(--graview-panel)",borderTop:"1px solid var(--graview-edge)",borderRight:"1px solid var(--graview-edge)",borderBottom:"1px solid var(--graview-edge)",borderLeft:"1px solid var(--graview-edge)",borderRadius:10,boxShadow:"0 10px 28px rgb(0 0 0 / 0.18)",padding:"4px 0"},Xa=6,Ja={width:"var(--graview-bar-width, 100vw)",maxHeight:"55vh",borderRadius:0,borderLeft:"none",borderRight:"none"},Za={display:"flex",alignItems:"center",gap:6,padding:"8px 12px 2px",fontSize:"0.6875rem",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},Aa={display:"grid",gap:1,minHeight:32,padding:"5px 12px",alignContent:"center",cursor:"pointer",fontSize:"0.875rem",lineHeight:1.35,color:"var(--graview-ink)"},Y={color:"var(--graview-ink-muted)",fontSize:"0.8125rem",fontWeight:400};var V=p(O(),1);var Ne=p(Oa(),1);var Ia=p(f(),1);function Ma(){let{following:e,follow:n}=S();return e?(0,Ia.jsxs)("button",{type:"button","data-testid":"following-who",onClick:()=>n(null),title:"Press, or Escape, to stop following",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,padding:"2px 9px",borderRadius:999,border:"1px solid var(--graview-accent)",background:"transparent",color:"var(--graview-accent)",fontSize:"0.875rem",whiteSpace:"nowrap"},children:["following ",e.name]}):null}var Ra=p(O(),1);var b=p(f(),1);function La({home:e,homeLabel:n,children:s,onPicture:o=!1}){let{view:r,focus:v,show:g,go:c}=K(),{store:M}=S(),{movedByHand:z}=S(),x=z&&(r.pan!==void 0||Object.keys(r.pins).length>0),I=r.focusId&&r.focusId!==e?M.graph.getNode(r.focusId):void 0,$=m=>ie(M.schema,m),y={display:"inline-flex",alignItems:"center",gap:6,minHeight:26,padding:"2px 6px",fontSize:"0.8125rem",borderRadius:6,border:"1px solid transparent",boxShadow:"none",background:"transparent",color:"var(--graview-ink-muted)",whiteSpace:"nowrap"},C=n!==void 0&&I!==void 0,R=[];if(I&&!o&&R.push({key:"focused",node:(0,b.jsxs)("button",{type:"button","data-testid":"focused",onClick:()=>c(me({...r,focusId:e},!1)),title:he(M,I.id),style:{...y,maxWidth:"min(14rem, 15vw)"},children:[(0,b.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:he(M,I.id)}),(0,b.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),r.past&&R.push({key:"past",node:(0,b.jsxs)("button",{type:"button","data-testid":"past",onClick:()=>c(ma(r,!1)),title:"Back to now \u2014 retired things leave the picture again",style:y,children:["the past",(0,b.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),r.zoom&&R.push({key:"zoomed",node:(0,b.jsxs)("button",{type:"button","data-testid":"zoomed",onClick:()=>c(me(r,!1)),title:"Zoom back out",style:y,children:["zoomed in",(0,b.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),x&&R.push({key:"moved",node:(0,b.jsx)("button",{type:"button","data-testid":"moved",onClick:()=>c(ue(r)),title:"Put the camera and everything you dragged back where the layout wanted them",style:y,children:"Reset view"})}),r.relation){let m=r.relation;R.push({key:"raised",node:(0,b.jsxs)("span",{style:{display:"inline-flex",alignItems:"center"},children:[(0,b.jsxs)("button",{type:"button","data-testid":"raised-into",onClick:()=>c(se(r,de(m),{ownPicture:!0})),title:`Go into the ${$(m).toLowerCase()}`,"aria-label":`Go into the ${$(m).toLowerCase()}`,style:{...y,color:"var(--graview-ink)"},children:[$(m),(0,b.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\u2198"})]}),(0,b.jsx)("button",{type:"button","data-testid":"raised",onClick:()=>g(null),title:`Stop showing ${$(m).toLowerCase()}`,"aria-label":`Stop showing ${$(m).toLowerCase()}`,style:{...y,minWidth:26,justifyContent:"center"},children:(0,b.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})})]})})}return o&&!C&&R.length===0&&s===void 0?null:(0,b.jsxs)("nav",{"aria-label":"View","data-testid":"trail",style:{display:"flex",alignItems:"center",gap:8,fontSize:"0.875rem",minWidth:0,...o?{pointerEvents:"auto",padding:"4px 6px",borderRadius:8,background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",overflow:"hidden"}:{}},children:[C?(0,b.jsx)("button",{type:"button",onClick:()=>v(e),style:{border:"none",background:"none",padding:"3px 0",minHeight:24,whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:n}):null,R.map(({key:m,node:F},ee)=>(0,b.jsxs)(Ra.Fragment,{children:[C||ee>0?(0,b.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:"\u203A"}):null,F]},m)),s]})}var E=p(f(),1);function He(){let[e,n]=(0,V.useState)([]),s=(0,V.useCallback)(o=>{n(r=>{let v=o.phase!=="running"&&r[0]?.name===o.name&&r[0]?.at===o.at;return[o,...v?r.slice(1):r].slice(0,12)})},[]);return[e,s]}function Pe({find:e,calls:n,seat:s,remembers:o=!1}){return e?(0,E.jsxs)(E.Fragment,{children:[(0,Ne.createPortal)((0,E.jsx)(Ta,{compact:e.compact}),e.slot),e.own?(0,Ne.createPortal)((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(V.Suspense,{fallback:null,children:(0,E.jsx)($a,{})}),(0,E.jsx)(da,{calls:n,remembers:o,...s!==void 0?{seat:s}:{}})]}),e.own):null]}):null}function De({home:e=null}){return(0,E.jsxs)("div",{"data-graview-scene-trail":"",style:{position:"absolute",top:14,left:14,maxWidth:"calc(100% - 150px - var(--graview-dock, 0px))",zIndex:D("overview"),display:"flex",alignItems:"center",gap:6,minWidth:0,pointerEvents:"none"},children:[(0,E.jsx)(La,{home:e,onPicture:!0}),(0,E.jsx)("span",{style:{pointerEvents:"auto"},children:(0,E.jsx)(Ma,{})})]})}var q=p(O(),1);var Na=p(f(),1),er=Q(()=>(__graviewPreload(import.meta.url,["./chunk.UGFDSE37.js","./chunk.BZ5VLPKB.js","./chunk.6II4BONS.js","./chunk.F5BCCGFK.js","./chunk.AJZBJBMO.js"]),import("./chunk.WJ2TWU2I.js")));function Be(){let{store:e,principal:n}=S(),s=(0,q.useContext)(la),o=(0,q.useRef)(null),r=(0,q.useRef)(!1);return(0,q.useEffect)(()=>()=>void(r.current=!0),[]),(0,q.useEffect)(()=>{let v=e.batches().length,g=er().then(c=>c.sceneWay(e,n,s,v,o.current),()=>{});return()=>void g.then(c=>c?.(r.current))},[e,n,s]),(0,Na.jsx)("span",{ref:o,hidden:!0})}var Ha=p(O(),1);var u=p(f(),1);function At({address:e=!1,auto:n,quickAsk:s=!0,scheme:o,scope:r}){let v=(0,Ha.useMemo)(()=>`${Ce({scope:`.${r}`})}
|
|
1127
1127
|
${Ae(o,{scope:`.${r}`})}`,[o,r]),g=sa(),[c]=He();return(0,u.jsx)(Xe.Provider,{value:!0,children:(0,u.jsxs)("div",{"data-embed-content":"",style:{position:"relative",flex:n?`0 0 ${ya}px`:"1 1 auto",minHeight:0,containerType:"size"},children:[(0,u.jsx)("style",{children:v}),e?(0,u.jsx)(ba,{}):null,(0,u.jsx)(xa,{}),(0,u.jsx)(De,{}),(0,u.jsx)(Ie,{}),(0,u.jsx)(Te,{}),(0,u.jsx)(Se,{}),(0,u.jsx)($e,{face:"scene",on:s}),(0,u.jsx)(Me,{}),(0,u.jsx)(xe,{children:(0,u.jsx)(ze,{children:(0,u.jsx)(ke,{placement:"menu"})})}),(0,u.jsx)(be,{}),(0,u.jsx)(Ee,{}),(0,u.jsx)(Pe,{find:g,calls:c}),(0,u.jsx)(Be,{}),(0,u.jsx)(fe,{face:"scene"})]})})}function Tt(){return(0,u.jsx)(Le,{})}export{At as SceneFace,Tt as SceneKeeping};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as L}from"./chunk.
|
|
1
|
+
import{e as L}from"./chunk.YNE5QR7Q.js";import{a as R,b as O,c as v,d as P}from"./chunk.UGFDSE37.js";import"./chunk.GOCUBIRW.js";import"./chunk.6QDFBCV4.js";import"./chunk.4STIUIT6.js";import"./chunk.WHTQHU3M.js";import"./chunk.KU6NIMQX.js";import"./chunk.Y3IJDWNS.js";import"./chunk.OFJH7LDC.js";import"./chunk.5PU3RWYY.js";import"./chunk.27TLAVRR.js";import"./chunk.OREMUXB5.js";import"./chunk.ZDNJK2SX.js";import"./chunk.ZSSOTIFL.js";import"./chunk.QDHUDLJB.js";import"./chunk.ZVMIHXVK.js";import"./chunk.CUCNT7MG.js";import"./chunk.2A2DLMT3.js";import"./chunk.E77K6KBX.js";import{a as E,b as T}from"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.VHWUGSFW.js";import"./chunk.P75TPZWT.js";import"./chunk.6W7J76TK.js";import"./chunk.FUR4IHWG.js";import"./chunk.2B4WVCVV.js";import"./chunk.AAZFVCSP.js";import"./chunk.GZHZLJBF.js";import"./chunk.PWOVXARZ.js";import"./chunk.SG23JC6D.js";import"./chunk.OJGHDWI6.js";import"./chunk.GZLYTPE7.js";import"./chunk.4B73P2WA.js";import"./chunk.IMRCAU4T.js";import"./chunk.BZ5VLPKB.js";import{F as D,Q as C,ta as x}from"./chunk.6II4BONS.js";import{gc as k}from"./chunk.F5BCCGFK.js";import{b as S}from"./chunk.AJZBJBMO.js";var o=S(D(),1);var i=S(C(),1);function W(c){let e=document.activeElement;if(e!==null&&e!==document.body&&e!==document.documentElement&&e.isConnected)return;let r=c??document,a=r.querySelector("main")??r.querySelector("[data-graview-page]")??null,n=r.querySelector("[data-graview-page-title]")??a?.querySelector("h1, h2")??a;n instanceof HTMLElement&&(n.hasAttribute("tabindex")||n.setAttribute("tabindex","-1"),n.focus({preventScroll:!0}))}var H=1500;function z(c,e,r){let{store:a,principal:n}=c,u=L(a),l=(0,o.useMemo)(()=>R(a,n),[a,n,u]),b=(0,o.useRef)(r),[p,m]=(0,o.useState)(),[s,f]=(0,o.useState)("");(0,o.useEffect)(()=>{let t=O(a,n,b.current);b.current=a.batches().length,t&&(m({batch:t.batch,at:e,when:Date.now()}),f(""))},[a,n,u]),(0,o.useEffect)(()=>{m(t=>!t||t.at===e?t:Date.now()-t.when<H?{...t,at:e}:void 0)},[e]);let[g,h]=(0,o.useState)(null),y=(0,o.useCallback)(()=>{m(void 0),h(null)},[]),w=(0,o.useCallback)(()=>{h(null);try{let t=P(a,n);t&&f(`Took back \u201C${t.intent}\u201D`)}catch(t){h(t instanceof Error?t.message:String(t))}},[a,n]),d=l&&p?.batch===l.batch&&p.at===e?l:void 0;return{change:l,offered:d,close:y,takeBack:w,refused:g,said:s}}function Y({context:c,docked:e,at:r,since:a}){let{change:n,offered:u,close:l,takeBack:b,refused:p,said:m}=z(c,r,a),s=e?u:n,f=(0,o.useRef)(null),g=e&&(s!==void 0||p!==null);B(f,g),(0,o.useEffect)(()=>{if(!g)return;let d,t=()=>d=setTimeout(()=>f.current?.matches(":hover, :focus-within")?t():l(),1e4);return t(),()=>clearTimeout(d)},[g,s?.batch,p,l]);let h=m||(e&&s?v(s):""),y=e?{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:k("toast"),width:"max-content",height:"auto",bottom:"calc(16px + env(safe-area-inset-bottom, 0px))",left:16,justifyItems:"start",color:"var(--graview-ink)",...g?{}:{display:"none"}}:{},w=s?(0,i.jsxs)("button",{type:"button","data-testid":"page-undo",title:`${v(s)} \u2014 \u2318Z or Ctrl+Z`,"aria-keyshortcuts":"Meta+Z Control+Z",onClick:d=>{let t=d.currentTarget.closest("[data-graview-face]");b(),requestAnimationFrame(()=>W(t))},style:e?I:A,children:[(0,i.jsx)("span",{"aria-hidden":"true",children:"\u21B6"}),(0,i.jsx)("span",{style:e?j:F,children:v(s)})]}):null;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{role:"status","aria-live":"polite",style:N,children:h}),(0,i.jsxs)("div",{ref:f,...e?{popover:"manual","data-graview-foot":"","data-graview-offstage":""}:{},"data-testid":e?"face-undo-dock":"page-undo-place",style:{display:"grid",justifyItems:"end",gap:4,maxWidth:"100%",minWidth:0,...y},children:[e&&s?(0,i.jsxs)("div",{"data-testid":"page-undo-notice",style:_,children:[w,(0,i.jsx)("button",{type:"button","data-testid":"page-undo-dismiss","aria-label":`Dismiss: ${v(s)}`,title:"Dismiss",onClick:d=>{let t=d.currentTarget.closest("[data-graview-face]");l(),requestAnimationFrame(()=>W(t))},style:q,children:"\xD7"})]}):w,p?(0,i.jsx)("span",{"data-testid":"page-undo-refused",role:"alert",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-warn)",background:e?"var(--graview-float)":void 0,padding:e?"4px 8px":void 0,borderRadius:6},children:p}):null]})]})}function B(c,e){(0,o.useLayoutEffect)(()=>{let r=c.current;if(!r||!e)return;if(typeof r.showPopover=="function"&&!x(r))try{r.showPopover()}catch{}let a=()=>r.parentElement?.closest("[data-embed-content]")??null,n=()=>{T(r,a()),dispatchEvent(new Event(E))};n(),addEventListener("resize",n),addEventListener("scroll",n,!0);let u=typeof ResizeObserver=="function"?new ResizeObserver(n):null;return u?.observe(r),()=>{if(u?.disconnect(),removeEventListener("resize",n),removeEventListener("scroll",n,!0),r.isConnected&&x(r))try{r.hidePopover()}catch{}dispatchEvent(new Event(E))}},[c,e])}var A={display:"inline-flex",alignItems:"center",gap:6,minHeight:36,maxWidth:"100%",minWidth:0,padding:"0 14px",borderRadius:999,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",font:"inherit",fontSize:"0.875rem",cursor:"pointer"},I={...A,textAlign:"start",lineHeight:1.4,padding:"8px 4px 8px 14px",border:"none",background:"none",color:"inherit"},_={display:"flex",alignItems:"center",gap:2,maxWidth:"100%",minWidth:0,paddingRight:6,borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},q={flex:"0 0 auto",minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"1rem",cursor:"pointer"},F={minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},j={minWidth:0,overflow:"hidden",overflowWrap:"anywhere",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:4},N={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};export{Y as TakeBack};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as y}from"./chunk.
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as y}from"./chunk.D6RDTUX3.js";import{E as v,F as I,Q as h,Y as w}from"./chunk.6II4BONS.js";import{Ma as g}from"./chunk.F5BCCGFK.js";import{b as d}from"./chunk.AJZBJBMO.js";var k=d(I(),1);var t=d(h(),1),r={display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem"};function E({shows:e,onShows:i,mine:a,onMine:l}){let o={all:"All",changes:"Changes",ai:"AI"};return(0,t.jsxs)("div",{"data-testid":"activity-filter",role:"group","aria-label":"Show",style:{display:"flex",flexWrap:"wrap",gap:4,alignItems:"center"},children:[["all","changes","ai"].map(s=>(0,t.jsx)("button",{type:"button","data-shows":s,"aria-pressed":e===s,onClick:()=>i(s),style:{...r,...e===s?{borderColor:"var(--graview-accent)",color:"var(--graview-ink)"}:{}},children:o[s]},s)),(0,t.jsx)("button",{type:"button","data-testid":"activity-mine","aria-pressed":a,onClick:()=>l(!a),style:{...r,marginLeft:"auto",...a?{borderColor:"var(--graview-accent)",color:"var(--graview-ink)"}:{}},children:"Just mine"})]})}var x=e=>e.ask.kind==="suggest"?"suggest":e.ask.kind==="fill"?"fill in":e.ask.kind==="record"?"add one":e.ask.kind==="panel"?"draw a panel":`answer \u201C${e.ask.said}\u201D`;function $(e){let i=e.offered.filter(a=>e.accepted?.includes(a.id)).map(a=>a.label);switch(e.outcome){case"accepted":return i.length>0?`Took ${i.join(", ")}`:"Taken";case"partly":return`Took ${i.length} of ${e.offered.length}: ${i.join(", ")}`;case"dismissed":return"Dismissed";case"drawn":return e.panel?`Drew \u201C${e.panel.title}\u201D`:"Drew a panel";case"failed":return e.failed??"Failed";default:return"Offered, not yet taken"}}function C(e){let i=[...new Set((e.usage??[]).map(o=>o.model))];if(i.length===0)return null;let a=(e.usage??[]).flatMap(o=>o.costUsd===void 0?[]:[o.costUsd]),l=a.length>0?a.reduce((o,s)=>o+s,0):void 0;return`${i.join(", ")}${l!==void 0?` \xB7 $${l<.01?l.toPrecision(2):l.toFixed(2)}`:""}`}function F({entry:e,undo:i}){let{store:a,principal:l,seats:o,people:s,ai:b}=w(),c=y(),[p,u]=(0,k.useState)(!1),A=e.by.kind==="human"&&e.by.onBehalfOf===void 0&&(e.by.id===void 0||l.id===void 0||e.by.id===l.id)?"you":g(e.by,{graph:a.graph,schema:a.schema,seats:o,people:s}),f=C(e),S=v(b),m=n=>{u(!0),(__graviewPreload(import.meta.url,["./chunk.ER5ILWKY.js","./chunk.7YQYWOZR.js","./chunk.ACEYGWMO.js","./chunk.3PT55HXT.js","./chunk.D6RDTUX3.js","./chunk.UT6642FC.js","./chunk.TI4OSTQV.js","./chunk.P75TPZWT.js","./chunk.GZLYTPE7.js","./chunk.4B73P2WA.js","./chunk.IMRCAU4T.js","./chunk.BZ5VLPKB.js","./chunk.6II4BONS.js","./chunk.F5BCCGFK.js","./chunk.AJZBJBMO.js"]),import("./chunk.CE3NOADH.js")).then(n).finally(()=>u(!1))};return(0,t.jsxs)("li",{"data-testid":"activity-interaction","data-interaction":e.id,"data-outcome":e.outcome,style:{display:"grid",gap:3,lineHeight:1.45},children:[(0,t.jsx)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:(0,t.jsxs)("span",{style:{minWidth:0},children:[(0,t.jsx)("strong",{style:{fontWeight:600},children:A})," ",(0,t.jsxs)("span",{style:{color:"var(--graview-ink-muted)"},children:["asked AI to ",x(e)]}),(0,t.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",e.targetLabel]})]})}),e.offered.length>0&&e.outcome!=="accepted"&&e.outcome!=="partly"?(0,t.jsxs)("div",{"data-testid":"interaction-offered",style:{color:"var(--graview-ink-muted)"},children:["Offered ",e.offered.map(n=>n.label).join(", ")]}):null,(0,t.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6,flexWrap:"wrap"},children:[(0,t.jsx)("span",{"data-testid":"interaction-outcome",style:{color:e.outcome==="failed"?"var(--graview-warn)":"var(--graview-ink)"},children:$(e)}),(e.batches??[]).map(n=>(0,t.jsx)("span",{"data-interaction-batch":n,style:{marginLeft:"auto"},children:i(n)},n))]}),f?(0,t.jsx)("div",{"data-testid":"interaction-model",style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:f}):null,S?(0,t.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[e.panel?(0,t.jsx)("button",{type:"button","data-testid":"interaction-reopen",disabled:p,onClick:()=>m(n=>n.drawPanel(c,e.panel)),style:r,children:"Show the panel"}):null,(0,t.jsx)("button",{type:"button","data-testid":"interaction-again",disabled:p,onClick:()=>m(n=>n.askAgain(c,e)),style:r,children:"Ask again"})]}):null]})}export{E as a,F as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk.
|
|
1
|
+
import"./chunk.GZLYTPE7.js";import"./chunk.4B73P2WA.js";import{b as m}from"./chunk.IMRCAU4T.js";import"./chunk.BZ5VLPKB.js";import{Q as p}from"./chunk.6II4BONS.js";import{N as l}from"./chunk.F5BCCGFK.js";import{b as f}from"./chunk.AJZBJBMO.js";var a=f(p(),1);function N({states:e,definition:v}){let s=e.values.reduce((t,n)=>t+n.count,0),u=t=>t===null?"with none":m(v,e.field,t).toLowerCase(),c=e.values.filter(t=>t.count>0).map(t=>`${l(t.count)} ${u(t.value)}`).join(", ");return s===0?null:(0,a.jsx)("div",{className:"graview-district-states",role:"img","aria-label":c,title:c,children:e.values.map((t,n)=>{if(t.count===0)return null;let y=e.values.filter(r=>r.count>0).length,w=t.count/s*(168-(y-1)),o=l(t.count),i=`${o} ${u(t.value)}`,d=r=>r.length*6.2+8<=w;return(0,a.jsx)("span",{"data-graview-tier":t.tier,style:{flexGrow:t.count},title:i,children:d(i)?i:d(o)?o:""},n)})})}export{N as StatesBar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as M}from"./chunk.PPUAPAWR.js";import{a as te,b as oe,c as ae,d as ie,e as C,f as L,g as de}from"./chunk.IHFNLKXV.js";import{a as se}from"./chunk.577PGFUT.js";import{c as j,e as re}from"./chunk.FBY5IUGU.js";import{a as O,b as Z,c as q,d as Q,f as T,m as ee,n as b,o as ne,p as E}from"./chunk.4K5QCJFH.js";import{b as B,d as le,e as ue,g as ye,h as fe,i as pe}from"./chunk.FSAHO3LV.js";import{B as P,H as W,L as H,N as v,T as $,X as K,ca as x,ea as X,ha as G,ia as A,ja as F,qb as J,ra as z,rb as Y,sb as N}from"./chunk.X7W27IRI.js";var V=e=>e.caption?.trim()||e.name;function je(e){let n=e?.fields?.shape??{};return Object.keys(n).filter(o=>{let r=P(n[o]);for(;r?.innerType;)r=P(r.innerType);return F(n[o])!==void 0||r?.type==="array"&&F(r.element)!==void 0})}function ze(e,n){for(let o of je(n)){let r=A(e[o]).find(G);if(r)return r}}var R=e=>{try{return e()}catch{return null}},we=e=>typeof e=="string"&&te.includes(e);function Ge(e){if(e!==void 0)return we(e)?e:e&&typeof e=="object"&&typeof e.expr=="string"?{expr:R(()=>j(e.expr))}:"neutral"}var Te=4;function Ee(e){let n=typeof e.list=="string"?R(()=>j(e.list)):null,o=e.sort,r=typeof o=="string"?o:o&&typeof o=="object"&&typeof o.by=="string"?o.by:void 0,t=o&&typeof o=="object"?o.direction:void 0,a=n,d;if(n&&r!==void 0)if(t==="choices")d=r;else{let f=R(()=>j(r));a=f?{t:"call",fn:"sort",args:[n,f,{t:"lit",value:t==="desc"?"desc":"asc",at:0}],at:0}:null}let l=typeof e.limit=="number"&&Number.isInteger(e.limit)&&e.limit>=1?Math.min(e.limit,C):void 0,i=e.group,s=typeof i=="string"?i:i&&typeof i=="object"&&typeof i.by=="string"?i.by:void 0,y=i&&typeof i=="object"&&i.headings&&typeof i.headings=="object"?i.headings:{};return{t:"list",source:a,...d?{choiceOrder:d}:{},...l?{limit:l}:{},...s?{group:{by:s,headings:Object.fromEntries(Object.entries(y).filter(f=>typeof f[1]=="string"))}}:{},...typeof e.empty=="string"?{empty:e.empty}:{},as:e.as==="card"?"card":"row"}}function me(e,n=1,o=""){if(!Array.isArray(e)||n>Te)return[];let r={};return e.flatMap(t=>{if(!t||typeof t!="object"||Array.isArray(t))return[];let a=t,d=p=>typeof p=="string"?R(()=>re(p)):null,l=p=>typeof p=="string"?R(()=>j(p)):null,i=Ge(a.tone),s=typeof a.label=="string"?a.label:void 0,y=p=>Object.hasOwn(a,p),f=typeof a.currency=="string"&&/^[A-Z]{3}$/.test(a.currency)?a.currency:void 0,u=y("list")?"list":y("headline")?"headline":typeof a.figure=="string"?"number":Be.find(y);if(!u)return[];let m=r[u]=(r[u]??0)+1,c=a.key,S=typeof c=="string"&&c?c:`${o}${u}.${m}`;return[{...(()=>{switch(u){case"list":return Ee(a);case"number":{let p=ae.includes(a.as)?a.as:void 0,U=ie.includes(a.emphasis)?a.emphasis:void 0;return{t:u,value:l(a.figure),...p?{as:p}:{},...f?{currency:f}:{},...s?{label:d(s)}:{},...U?{emphasis:U}:{}}}case"headline":case"title":return{t:u,parts:d(a[u])};case"text":case"badge":return{t:u,parts:d(a[u]),...i?{tone:i}:{}};case"field":{let p=oe.includes(a.as)?a.as:void 0;return{t:u,field:String(a.field),...p?{as:p}:{},...f?{currency:f}:{},...s?{label:s}:{}}}case"image":return{t:u,field:String(a.image),as:a.as==="gallery"?"gallery":"thumb",...s?{label:s}:{}};case"progress":{let p=a.progress??{};return{t:u,value:l(p.value),max:l(p.max),...s?{label:d(s)}:{}}}case"group":return{t:u,blocks:me(a.group,n+1,`${S}.`),direction:a.direction==="row"?"row":"column"};case"when":return{t:u,when:l(a.when),show:me(a.show,n+1,`${S}.`)};default:return{t:u}}})(),key:S}]})}var Be=["title","text","badge","field","image","progress","group","when","divider","figure"],g="\u2014",Pe=500;function w(e,n){if(!e)return{ok:!1,problem:"an expression that does not parse"};try{return{ok:!0,value:T(e,{graph:n.graph??ee,subject:n.node,kinds:n.kinds,today:n.today,budget:n.budget??Pe})}}catch(o){return{ok:!1,problem:o instanceof Error?o.message:String(o)}}}var ve=(e,n,o)=>!e.format&&e.expr?.t==="ident"&&typeof o=="string"&&n.fields[e.expr.name]?.format==="markdown";function k(e,n,o){if(!e)return{text:g,problem:"a template that does not parse"};let r,t;return{text:e.map(d=>{if(d.text!==void 0)return d.text;let l=w(d.expr??null,n);if(!l.ok)return r??=`{${d.source??""}}: ${l.problem}`,g;if(ve(d,n,l.value))return n.glance?le(l.value,{markdown:!0}):o&&e.length===1?(t=!0,l.value):ue(l.value);let i=!d.format&&d.expr?.t==="ident"&&typeof l.value=="number"?ke(n,d.expr.name):void 0;return ne(d,i?N(l.value,i):b(l.value,d.format,n.today,d.formatArgs,n.money,E(n.schema)))}).join(""),...r?{problem:r}:{},...t?{markdown:t}:{}}}function ce(e,n){if(e===void 0)return;if(typeof e=="string")return e;let o=w(e.expr,n);return o.ok&&we(o.value)?o.value:"neutral"}function xe(e){if(typeof e=="string")try{let n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"?n.href:void 0}catch{return}}var Se=(e,n)=>{let o=e.fields[n]?.type;return o==="phone"||o==="place"||o==="duration"?o:ye(e.definition,n)},ke=(e,n)=>J(e.definition?.fields?.shape?.[n]);function Fe(e,n,o,r,t){if(n==null||n==="")return g;if(typeof n=="boolean")return n?"yes":"no";if(r)return b(n,r,o.today,[],t?{...o.money,currency:t}:o.money);let a=o.fields[e];if(o.definition?.display?.format?.[e])return B(o.definition,e,n);let d=fe(Se(o,e),n,o.money?.locale);if(d!==void 0)return d;if(a?.type==="date")return b(n,"date",o.today,[],o.money);if(a?.type==="datetime"&&typeof n=="string")return H(n,o.money?.locale);if(a?.type==="enum"&&typeof n=="string")return B(o.definition,e,n);let l=typeof n=="number"?ke(o,e):void 0;if(l)return N(n,l);if(typeof n=="number")return v(n,o.money?.locale,{});let i=A(n);return i[0]?i.map(V).join(", "):Array.isArray(n)?n.map(s=>String(s)).join(", "):typeof n=="object"?g:String(n)}function Ne(e,n,o,r,t){return typeof e!="number"?String(e):n==="money"?Y(e,o?{...t,currency:o}:t):n==="percent"?b(e,n,r,[],t):v(e,t?.locale)}var h=(e,n)=>n?{...e,problem:n}:e;function ge(e){return e.firstHeading===void 0?e:{...e,firstHeading:void 0}}function Ce(e,n,o){switch(e.t){case"title":{let r=k(e.parts,n);return h({t:"title",text:r.text},r.problem)}case"text":{let r=k(e.parts,n,!0),t=ce(e.tone,n);return h({t:"text",text:r.text,...t?{tone:t}:{},...r.markdown?{markdown:r.markdown}:{}},r.problem)}case"badge":{let r=k(e.parts,n);return h({t:"badge",text:r.text,tone:ce(e.tone,n)??"neutral"},r.problem)}case"field":{let r=e.label??x(n.definition,e.field);if(!n.node)return{t:"field",field:e.field,label:r,text:g,problem:`"${e.field}" names a field, and these blocks are about no one record`};let t=e.as===void 0?n.kinds.get(n.node.kind)?.linked?.get(e.field):void 0;if(t){let f=z(Object.hasOwn(n.node,e.field)?n.node[e.field]:void 0,t);return{t:"field",field:e.field,label:r,text:f.length>0?"linked record":g,...f.length>0?{linked:{relation:t,refs:f}}:{}}}let a=n.kinds.get(n.node.kind)?.computed?.has(e.field),d,l;if(a){let f=w({t:"ident",name:e.field,at:0},n);f.ok?d=f.value!==null&&typeof f.value=="object"?b(f.value,void 0,n.today,[],n.money,E(n.schema)):f.value:l=f.problem}else d=Object.hasOwn(n.node,e.field)?n.node[e.field]:void 0;let i=e.as!==void 0?void 0:n.fields[e.field]?.type==="url"?xe(d):pe(Se(n,e.field),d),s=R(()=>Fe(e.field,d,n,e.as,e.currency))??g,y=n.fields[e.field]?.type==="app-link"&&e.as===void 0&&typeof d=="string"?d:void 0;return h({t:"field",field:e.field,label:r,text:s,...i?{href:i}:{},...y?{app:y}:{}},l)}case"image":{let r=A(n.node&&Object.hasOwn(n.node,e.field)?n.node[e.field]:null),t=e.as==="gallery"?r:r.filter(G).slice(0,1);return{t:"image",field:e.field,label:e.label??x(n.definition,e.field),as:e.as,files:t,text:t.map(V).join(", ")||g}}case"progress":{let r=w(e.value,n),t=w(e.max,n),a=e.label?k(e.label,n):{text:"Progress"},d=a.text,l=r.ok?t.ok?a.problem:t.problem:r.problem;return r.ok&&t.ok&&typeof r.value=="number"&&typeof t.value=="number"&&Number.isFinite(r.value)&&Number.isFinite(t.value)&&t.value>0?h({t:"progress",label:d,value:r.value,max:t.value,text:`${b(r.value,void 0,n.today)} of ${b(t.value,void 0,n.today)}`},l):h({t:"progress",label:d,text:g},l)}case"group":return{t:"group",direction:e.direction,blocks:he(e.blocks,ge(n))};case"when":{let r=w(e.when,n),t=r.ok&&r.value===!0;return h({t:"when",shown:t,blocks:t?he(e.show,ge(n)):[]},r.ok?void 0:r.problem)}case"divider":return{t:"divider"};case"figure":return{t:"figure"};case"headline":{let r=k(e.parts,n),t=Math.min(6,Math.max(1,(o?n.firstHeading:void 0)??n.heading??3));return h({t:"headline",level:t,text:r.text},r.problem)}case"number":{let r=w(e.value,n),t=!r.ok||r.value===null||typeof r.value=="object"?g:Ne(r.value,e.as,e.currency,n.today,n.money),a=e.label?k(e.label,n):void 0;return h({t:"number",text:t,...a?{label:a.text}:{},...e.emphasis?{emphasis:e.emphasis}:{}},r.ok?a?.problem:r.problem)}case"list":return Me(e,n)}}function he(e,n){let o=e.findIndex(r=>r.t==="headline");return e.map((r,t)=>({...Ce(r,n,t===o),key:r.key}))}var Le=new Set(["every","some","sum","min","max","sort"]);function cn(e,n){let o=new Set,r=new Set,t=i=>{if(i)switch(i.t){case"ident":o.add(i.name);return;case"list":i.items.forEach(t);return;case"member":return t(i.object);case"unary":return t(i.operand);case"binary":return t(i.left),t(i.right);case"where":return t(i.set);case"call":i.args.forEach((s,y)=>{y===1&&Le.has(i.fn)||t(s)});return;default:return}},a=i=>{for(let s of i??[])t(s.expr)},d=(i,s)=>{i.forEach((y,f)=>{let u=s[f];if(u)switch(y.t){case"field":case"image":o.add(y.field);return;case"title":case"text":case"badge":case"headline":a(y.parts);return;case"number":t(y.value),a(y.label);return;case"progress":t(y.value),t(y.max);return;case"group":u.t==="group"&&d(y.blocks,u.blocks);return;case"when":u.t==="when"&&u.shown&&d(y.show,u.blocks);return;case"list":if(u.t==="list")for(let m of u.members)r.add(m.id);return;default:return}})};d(e,n);let l=n[0];return{fields:o,records:r,...e[0]?.t==="title"&&l?.t==="title"?{title:l.text}:{}}}function Me(e,n){let o=Math.min(6,(n.heading??3)+1),r=w(e.source,n);if(!r.ok)return{t:"list",as:e.as,failed:!0,members:[],headingLevel:o,more:0,problem:r.problem};let t=r.value,a=t instanceof O?t.nodes:t!==null&&typeof t=="object"&&!Array.isArray(t)?[t]:[];e.choiceOrder&&n.schema&&(a=Ve(a,e.choiceOrder,n.schema));let d=a.length,l=a.slice(0,e.limit??C),i=l.slice(0,L),s=l.slice(L),y=(e.limit===void 0?d:l.length)-i.length,f=c=>e.group&&n.schema&&c.length>0?_e(c,e.group,n.schema,n.graph):void 0,u=f(i),m=s.length>0?f(l):void 0;return{t:"list",as:e.as,failed:!1,members:i,...s.length>0?{rest:s}:{},...u?{groups:u}:{},...m?{everyGroup:m}:{},headingLevel:o,...i.length===0&&e.empty?{empty:e.empty}:{},more:y,total:d}}function _(e,n,o){let r=e.tryDefinition(n)?.fields?.shape,t=r&&Object.hasOwn(r,o)?M(r[o]):void 0;return t?.type==="enum"?t.options??[]:[]}var I=(e,n)=>Object.hasOwn(e,n)?e[n]:void 0;function Ve(e,n,o){let r=t=>{let a=_(o,t.kind,n).indexOf(String(I(t,n)));return a<0?Number.MAX_SAFE_INTEGER:a};return e.map((t,a)=>({node:t,i:a,rank:r(t)})).sort((t,a)=>t.rank-a.rank||t.i-a.i).map(t=>t.node)}function _e(e,n,o,r){let t=e.some(i=>_(o,i.kind,n.by).length>0)?void 0:de(n.by);if(t&&r)return Ie(e,t,n.headings,o,r);let a=[];for(let i of e)for(let s of _(o,i.kind,n.by))a.includes(s)||a.push(s);let d=[];for(let i of a){let s=e.filter(f=>I(f,n.by)===i);if(s.length===0)continue;let y=o.tryDefinition(s[0].kind);d.push({value:i,heading:n.headings[i]??$(B(y,n.by,i)),members:s})}let l=e.filter(i=>!a.includes(String(I(i,n.by))));return l.length>0&&d.push({value:null,members:l}),d}function Ie(e,n,o,r,t){let a=u=>n.way??(Object.hasOwn(r.tryDefinition(u.kind)?.edges??{},n.edge)?"out":"in"),d=new Map,l=[],i=E(r),s;for(let u of e){let m=a(u)==="out"?t.out(u.id,n.edge):t.in(u.id,n.edge);m.length===0&&l.push(u);for(let c of m){s??=c.kind;let S=d.get(c.id)??{node:c,members:[]};S.members.push(u),d.set(c.id,S)}}let y=[...d.values()].map(({node:u,members:m})=>({value:u.id,heading:o[u.id]??i(u),members:m})).sort((u,m)=>u.heading.localeCompare(m.heading,void 0,{numeric:!0}));!s&&e[0]&&a(e[0])==="out"&&(s=(r.tryDefinition(e[0].kind)?.edges??{})[n.edge]?.to?.[0]);let f=s&&s!=="*"?X(r.tryDefinition(s),s):void 0;return l.length>0&&y.push({value:null,...f?{heading:`No ${f}`}:{},members:l}),y}function be(e){return e.t==="list"||e.t==="headline"||e.t==="number"||e.t==="image"&&e.as==="gallery"?!0:e.t==="group"?e.blocks.some(be):e.t==="when"?e.show.some(be):!1}function Re(e,n){let o=e.tryDefinition(n)?.fields?.shape??{},r={};for(let[t,a]of Object.entries(o)){let d=M(a);d&&(r[t]=d)}return r}var Ae=new WeakMap;function D(e){let n=Ae.get(e);return n||Ae.set(e,n=se(e)),n}function De(e,n,o,r={}){let t=D(e),a={},d={},l=i=>{if(i instanceof O)return i.nodes.map(s=>l(s));if(Array.isArray(i))return i.map(s=>l(s));if(i!==null&&typeof i=="object"){let s=i;return{id:s.id,kind:s.kind,label:K(e.tryDefinition(s.kind),s)}}return i};for(let[i,s]of t.get(o?o.kind:q)?.computed??[])try{let y=[],f=T(s,{graph:n,subject:o,kinds:t,...r.today?{today:r.today}:{},...r.budget?{budget:r.budget}:{},...r.linked?{linked:r.linked}:{},onUnread:u=>y.push(u)});y.length>0&&(f===null||f instanceof O&&f.nodes.length===0)?d[i]=Z(y[0]):a[i]=l(f)}catch(y){if(!(y instanceof Q))throw y;d[i]=y.sentence}return{values:a,refused:d}}function Sn(e,n,o){let{values:r}=De(e,n,o);if(Object.keys(r).length===0)return o;let t=a=>Array.isArray(a)?a.map(t):a!==null&&typeof a=="object"?a.label:a;return{...o,...Object.fromEntries(Object.entries(r).map(([a,d])=>[a,t(d)]))}}var Ue=500,We=2e4,Oe=new WeakMap;function He(e,n){let o=Oe.get(e);o||Oe.set(e,o=new Map);let r=o.get(n);return r||o.set(n,r=Re(e,n)),r}function jn(e,n,o,r={}){if(n&&typeof e.seenBy!="function")throw new TypeError("blockContextFor: a seat is read from a store (its `seenBy`); a bare { graph, schema } is read as it is handed, with no principal");let t=n?e.seenBy(n):e,a=n&&o?t.graph.getNode(o.id)??null:o,d=t.schema,l=a&&d.tryDefinition(a.kind),i=!a||(r.slot??"page")==="page",{money:s,firstHeading:y}=r;return{node:a,graph:t.graph,schema:d,kinds:D(d),fields:a?He(d,a.kind):{},definition:l||void 0,today:r.today??t.today?.()??W(),money:s,heading:r.heading??(i?2:3),firstHeading:y,budget:r.budget??(i?We:Ue),...i?{}:{glance:!0}}}export{V as a,je as b,ze as c,me as d,he as e,cn as f,be as g,De as h,Sn as i,jn as j};
|
|
1
|
+
import{a as M}from"./chunk.P75TPZWT.js";import{a as te,b as oe,c as ae,d as ie,e as C,f as L,g as de}from"./chunk.6W7J76TK.js";import{a as se}from"./chunk.FUR4IHWG.js";import{c as j,e as re}from"./chunk.2B4WVCVV.js";import{a as O,b as Z,c as q,d as Q,f as T,m as ee,n as b,o as ne,p as E}from"./chunk.AAZFVCSP.js";import{b as B,d as le,e as ue,g as ye,h as fe,i as pe}from"./chunk.IMRCAU4T.js";import{B as P,H as W,L as H,N as v,T as $,X as K,ca as x,ea as X,ia as G,ja as A,ka as F,rb as J,sa as z,sb as Y,tb as N}from"./chunk.F5BCCGFK.js";var V=e=>e.caption?.trim()||e.name;function je(e){let n=e?.fields?.shape??{};return Object.keys(n).filter(o=>{let r=P(n[o]);for(;r?.innerType;)r=P(r.innerType);return F(n[o])!==void 0||r?.type==="array"&&F(r.element)!==void 0})}function ze(e,n){for(let o of je(n)){let r=A(e[o]).find(G);if(r)return r}}var R=e=>{try{return e()}catch{return null}},we=e=>typeof e=="string"&&te.includes(e);function Ge(e){if(e!==void 0)return we(e)?e:e&&typeof e=="object"&&typeof e.expr=="string"?{expr:R(()=>j(e.expr))}:"neutral"}var Te=4;function Ee(e){let n=typeof e.list=="string"?R(()=>j(e.list)):null,o=e.sort,r=typeof o=="string"?o:o&&typeof o=="object"&&typeof o.by=="string"?o.by:void 0,t=o&&typeof o=="object"?o.direction:void 0,a=n,d;if(n&&r!==void 0)if(t==="choices")d=r;else{let f=R(()=>j(r));a=f?{t:"call",fn:"sort",args:[n,f,{t:"lit",value:t==="desc"?"desc":"asc",at:0}],at:0}:null}let l=typeof e.limit=="number"&&Number.isInteger(e.limit)&&e.limit>=1?Math.min(e.limit,C):void 0,i=e.group,s=typeof i=="string"?i:i&&typeof i=="object"&&typeof i.by=="string"?i.by:void 0,y=i&&typeof i=="object"&&i.headings&&typeof i.headings=="object"?i.headings:{};return{t:"list",source:a,...d?{choiceOrder:d}:{},...l?{limit:l}:{},...s?{group:{by:s,headings:Object.fromEntries(Object.entries(y).filter(f=>typeof f[1]=="string"))}}:{},...typeof e.empty=="string"?{empty:e.empty}:{},as:e.as==="card"?"card":"row"}}function me(e,n=1,o=""){if(!Array.isArray(e)||n>Te)return[];let r={};return e.flatMap(t=>{if(!t||typeof t!="object"||Array.isArray(t))return[];let a=t,d=p=>typeof p=="string"?R(()=>re(p)):null,l=p=>typeof p=="string"?R(()=>j(p)):null,i=Ge(a.tone),s=typeof a.label=="string"?a.label:void 0,y=p=>Object.hasOwn(a,p),f=typeof a.currency=="string"&&/^[A-Z]{3}$/.test(a.currency)?a.currency:void 0,u=y("list")?"list":y("headline")?"headline":typeof a.figure=="string"?"number":Be.find(y);if(!u)return[];let m=r[u]=(r[u]??0)+1,c=a.key,S=typeof c=="string"&&c?c:`${o}${u}.${m}`;return[{...(()=>{switch(u){case"list":return Ee(a);case"number":{let p=ae.includes(a.as)?a.as:void 0,U=ie.includes(a.emphasis)?a.emphasis:void 0;return{t:u,value:l(a.figure),...p?{as:p}:{},...f?{currency:f}:{},...s?{label:d(s)}:{},...U?{emphasis:U}:{}}}case"headline":case"title":return{t:u,parts:d(a[u])};case"text":case"badge":return{t:u,parts:d(a[u]),...i?{tone:i}:{}};case"field":{let p=oe.includes(a.as)?a.as:void 0;return{t:u,field:String(a.field),...p?{as:p}:{},...f?{currency:f}:{},...s?{label:s}:{}}}case"image":return{t:u,field:String(a.image),as:a.as==="gallery"?"gallery":"thumb",...s?{label:s}:{}};case"progress":{let p=a.progress??{};return{t:u,value:l(p.value),max:l(p.max),...s?{label:d(s)}:{}}}case"group":return{t:u,blocks:me(a.group,n+1,`${S}.`),direction:a.direction==="row"?"row":"column"};case"when":return{t:u,when:l(a.when),show:me(a.show,n+1,`${S}.`)};default:return{t:u}}})(),key:S}]})}var Be=["title","text","badge","field","image","progress","group","when","divider","figure"],g="\u2014",Pe=500;function w(e,n){if(!e)return{ok:!1,problem:"an expression that does not parse"};try{return{ok:!0,value:T(e,{graph:n.graph??ee,subject:n.node,kinds:n.kinds,today:n.today,budget:n.budget??Pe})}}catch(o){return{ok:!1,problem:o instanceof Error?o.message:String(o)}}}var ve=(e,n,o)=>!e.format&&e.expr?.t==="ident"&&typeof o=="string"&&n.fields[e.expr.name]?.format==="markdown";function k(e,n,o){if(!e)return{text:g,problem:"a template that does not parse"};let r,t;return{text:e.map(d=>{if(d.text!==void 0)return d.text;let l=w(d.expr??null,n);if(!l.ok)return r??=`{${d.source??""}}: ${l.problem}`,g;if(ve(d,n,l.value))return n.glance?le(l.value,{markdown:!0}):o&&e.length===1?(t=!0,l.value):ue(l.value);let i=!d.format&&d.expr?.t==="ident"&&typeof l.value=="number"?ke(n,d.expr.name):void 0;return ne(d,i?N(l.value,i):b(l.value,d.format,n.today,d.formatArgs,n.money,E(n.schema)))}).join(""),...r?{problem:r}:{},...t?{markdown:t}:{}}}function ce(e,n){if(e===void 0)return;if(typeof e=="string")return e;let o=w(e.expr,n);return o.ok&&we(o.value)?o.value:"neutral"}function xe(e){if(typeof e=="string")try{let n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"?n.href:void 0}catch{return}}var Se=(e,n)=>{let o=e.fields[n]?.type;return o==="phone"||o==="place"||o==="duration"?o:ye(e.definition,n)},ke=(e,n)=>J(e.definition?.fields?.shape?.[n]);function Fe(e,n,o,r,t){if(n==null||n==="")return g;if(typeof n=="boolean")return n?"yes":"no";if(r)return b(n,r,o.today,[],t?{...o.money,currency:t}:o.money);let a=o.fields[e];if(o.definition?.display?.format?.[e])return B(o.definition,e,n);let d=fe(Se(o,e),n,o.money?.locale);if(d!==void 0)return d;if(a?.type==="date")return b(n,"date",o.today,[],o.money);if(a?.type==="datetime"&&typeof n=="string")return H(n,o.money?.locale);if(a?.type==="enum"&&typeof n=="string")return B(o.definition,e,n);let l=typeof n=="number"?ke(o,e):void 0;if(l)return N(n,l);if(typeof n=="number")return v(n,o.money?.locale,{});let i=A(n);return i[0]?i.map(V).join(", "):Array.isArray(n)?n.map(s=>String(s)).join(", "):typeof n=="object"?g:String(n)}function Ne(e,n,o,r,t){return typeof e!="number"?String(e):n==="money"?Y(e,o?{...t,currency:o}:t):n==="percent"?b(e,n,r,[],t):v(e,t?.locale)}var h=(e,n)=>n?{...e,problem:n}:e;function ge(e){return e.firstHeading===void 0?e:{...e,firstHeading:void 0}}function Ce(e,n,o){switch(e.t){case"title":{let r=k(e.parts,n);return h({t:"title",text:r.text},r.problem)}case"text":{let r=k(e.parts,n,!0),t=ce(e.tone,n);return h({t:"text",text:r.text,...t?{tone:t}:{},...r.markdown?{markdown:r.markdown}:{}},r.problem)}case"badge":{let r=k(e.parts,n);return h({t:"badge",text:r.text,tone:ce(e.tone,n)??"neutral"},r.problem)}case"field":{let r=e.label??x(n.definition,e.field);if(!n.node)return{t:"field",field:e.field,label:r,text:g,problem:`"${e.field}" names a field, and these blocks are about no one record`};let t=e.as===void 0?n.kinds.get(n.node.kind)?.linked?.get(e.field):void 0;if(t){let f=z(Object.hasOwn(n.node,e.field)?n.node[e.field]:void 0,t);return{t:"field",field:e.field,label:r,text:f.length>0?"linked record":g,...f.length>0?{linked:{relation:t,refs:f}}:{}}}let a=n.kinds.get(n.node.kind)?.computed?.has(e.field),d,l;if(a){let f=w({t:"ident",name:e.field,at:0},n);f.ok?d=f.value!==null&&typeof f.value=="object"?b(f.value,void 0,n.today,[],n.money,E(n.schema)):f.value:l=f.problem}else d=Object.hasOwn(n.node,e.field)?n.node[e.field]:void 0;let i=e.as!==void 0?void 0:n.fields[e.field]?.type==="url"?xe(d):pe(Se(n,e.field),d),s=R(()=>Fe(e.field,d,n,e.as,e.currency))??g,y=n.fields[e.field]?.type==="app-link"&&e.as===void 0&&typeof d=="string"?d:void 0;return h({t:"field",field:e.field,label:r,text:s,...i?{href:i}:{},...y?{app:y}:{}},l)}case"image":{let r=A(n.node&&Object.hasOwn(n.node,e.field)?n.node[e.field]:null),t=e.as==="gallery"?r:r.filter(G).slice(0,1);return{t:"image",field:e.field,label:e.label??x(n.definition,e.field),as:e.as,files:t,text:t.map(V).join(", ")||g}}case"progress":{let r=w(e.value,n),t=w(e.max,n),a=e.label?k(e.label,n):{text:"Progress"},d=a.text,l=r.ok?t.ok?a.problem:t.problem:r.problem;return r.ok&&t.ok&&typeof r.value=="number"&&typeof t.value=="number"&&Number.isFinite(r.value)&&Number.isFinite(t.value)&&t.value>0?h({t:"progress",label:d,value:r.value,max:t.value,text:`${b(r.value,void 0,n.today)} of ${b(t.value,void 0,n.today)}`},l):h({t:"progress",label:d,text:g},l)}case"group":return{t:"group",direction:e.direction,blocks:he(e.blocks,ge(n))};case"when":{let r=w(e.when,n),t=r.ok&&r.value===!0;return h({t:"when",shown:t,blocks:t?he(e.show,ge(n)):[]},r.ok?void 0:r.problem)}case"divider":return{t:"divider"};case"figure":return{t:"figure"};case"headline":{let r=k(e.parts,n),t=Math.min(6,Math.max(1,(o?n.firstHeading:void 0)??n.heading??3));return h({t:"headline",level:t,text:r.text},r.problem)}case"number":{let r=w(e.value,n),t=!r.ok||r.value===null||typeof r.value=="object"?g:Ne(r.value,e.as,e.currency,n.today,n.money),a=e.label?k(e.label,n):void 0;return h({t:"number",text:t,...a?{label:a.text}:{},...e.emphasis?{emphasis:e.emphasis}:{}},r.ok?a?.problem:r.problem)}case"list":return Me(e,n)}}function he(e,n){let o=e.findIndex(r=>r.t==="headline");return e.map((r,t)=>({...Ce(r,n,t===o),key:r.key}))}var Le=new Set(["every","some","sum","min","max","sort"]);function cn(e,n){let o=new Set,r=new Set,t=i=>{if(i)switch(i.t){case"ident":o.add(i.name);return;case"list":i.items.forEach(t);return;case"member":return t(i.object);case"unary":return t(i.operand);case"binary":return t(i.left),t(i.right);case"where":return t(i.set);case"call":i.args.forEach((s,y)=>{y===1&&Le.has(i.fn)||t(s)});return;default:return}},a=i=>{for(let s of i??[])t(s.expr)},d=(i,s)=>{i.forEach((y,f)=>{let u=s[f];if(u)switch(y.t){case"field":case"image":o.add(y.field);return;case"title":case"text":case"badge":case"headline":a(y.parts);return;case"number":t(y.value),a(y.label);return;case"progress":t(y.value),t(y.max);return;case"group":u.t==="group"&&d(y.blocks,u.blocks);return;case"when":u.t==="when"&&u.shown&&d(y.show,u.blocks);return;case"list":if(u.t==="list")for(let m of u.members)r.add(m.id);return;default:return}})};d(e,n);let l=n[0];return{fields:o,records:r,...e[0]?.t==="title"&&l?.t==="title"?{title:l.text}:{}}}function Me(e,n){let o=Math.min(6,(n.heading??3)+1),r=w(e.source,n);if(!r.ok)return{t:"list",as:e.as,failed:!0,members:[],headingLevel:o,more:0,problem:r.problem};let t=r.value,a=t instanceof O?t.nodes:t!==null&&typeof t=="object"&&!Array.isArray(t)?[t]:[];e.choiceOrder&&n.schema&&(a=Ve(a,e.choiceOrder,n.schema));let d=a.length,l=a.slice(0,e.limit??C),i=l.slice(0,L),s=l.slice(L),y=(e.limit===void 0?d:l.length)-i.length,f=c=>e.group&&n.schema&&c.length>0?_e(c,e.group,n.schema,n.graph):void 0,u=f(i),m=s.length>0?f(l):void 0;return{t:"list",as:e.as,failed:!1,members:i,...s.length>0?{rest:s}:{},...u?{groups:u}:{},...m?{everyGroup:m}:{},headingLevel:o,...i.length===0&&e.empty?{empty:e.empty}:{},more:y,total:d}}function _(e,n,o){let r=e.tryDefinition(n)?.fields?.shape,t=r&&Object.hasOwn(r,o)?M(r[o]):void 0;return t?.type==="enum"?t.options??[]:[]}var I=(e,n)=>Object.hasOwn(e,n)?e[n]:void 0;function Ve(e,n,o){let r=t=>{let a=_(o,t.kind,n).indexOf(String(I(t,n)));return a<0?Number.MAX_SAFE_INTEGER:a};return e.map((t,a)=>({node:t,i:a,rank:r(t)})).sort((t,a)=>t.rank-a.rank||t.i-a.i).map(t=>t.node)}function _e(e,n,o,r){let t=e.some(i=>_(o,i.kind,n.by).length>0)?void 0:de(n.by);if(t&&r)return Ie(e,t,n.headings,o,r);let a=[];for(let i of e)for(let s of _(o,i.kind,n.by))a.includes(s)||a.push(s);let d=[];for(let i of a){let s=e.filter(f=>I(f,n.by)===i);if(s.length===0)continue;let y=o.tryDefinition(s[0].kind);d.push({value:i,heading:n.headings[i]??$(B(y,n.by,i)),members:s})}let l=e.filter(i=>!a.includes(String(I(i,n.by))));return l.length>0&&d.push({value:null,members:l}),d}function Ie(e,n,o,r,t){let a=u=>n.way??(Object.hasOwn(r.tryDefinition(u.kind)?.edges??{},n.edge)?"out":"in"),d=new Map,l=[],i=E(r),s;for(let u of e){let m=a(u)==="out"?t.out(u.id,n.edge):t.in(u.id,n.edge);m.length===0&&l.push(u);for(let c of m){s??=c.kind;let S=d.get(c.id)??{node:c,members:[]};S.members.push(u),d.set(c.id,S)}}let y=[...d.values()].map(({node:u,members:m})=>({value:u.id,heading:o[u.id]??i(u),members:m})).sort((u,m)=>u.heading.localeCompare(m.heading,void 0,{numeric:!0}));!s&&e[0]&&a(e[0])==="out"&&(s=(r.tryDefinition(e[0].kind)?.edges??{})[n.edge]?.to?.[0]);let f=s&&s!=="*"?X(r.tryDefinition(s),s):void 0;return l.length>0&&y.push({value:null,...f?{heading:`No ${f}`}:{},members:l}),y}function be(e){return e.t==="list"||e.t==="headline"||e.t==="number"||e.t==="image"&&e.as==="gallery"?!0:e.t==="group"?e.blocks.some(be):e.t==="when"?e.show.some(be):!1}function Re(e,n){let o=e.tryDefinition(n)?.fields?.shape??{},r={};for(let[t,a]of Object.entries(o)){let d=M(a);d&&(r[t]=d)}return r}var Ae=new WeakMap;function D(e){let n=Ae.get(e);return n||Ae.set(e,n=se(e)),n}function De(e,n,o,r={}){let t=D(e),a={},d={},l=i=>{if(i instanceof O)return i.nodes.map(s=>l(s));if(Array.isArray(i))return i.map(s=>l(s));if(i!==null&&typeof i=="object"){let s=i;return{id:s.id,kind:s.kind,label:K(e.tryDefinition(s.kind),s)}}return i};for(let[i,s]of t.get(o?o.kind:q)?.computed??[])try{let y=[],f=T(s,{graph:n,subject:o,kinds:t,...r.today?{today:r.today}:{},...r.budget?{budget:r.budget}:{},...r.linked?{linked:r.linked}:{},onUnread:u=>y.push(u)});y.length>0&&(f===null||f instanceof O&&f.nodes.length===0)?d[i]=Z(y[0]):a[i]=l(f)}catch(y){if(!(y instanceof Q))throw y;d[i]=y.sentence}return{values:a,refused:d}}function Sn(e,n,o){let{values:r}=De(e,n,o);if(Object.keys(r).length===0)return o;let t=a=>Array.isArray(a)?a.map(t):a!==null&&typeof a=="object"?a.label:a;return{...o,...Object.fromEntries(Object.entries(r).map(([a,d])=>[a,t(d)]))}}var Ue=500,We=2e4,Oe=new WeakMap;function He(e,n){let o=Oe.get(e);o||Oe.set(e,o=new Map);let r=o.get(n);return r||o.set(n,r=Re(e,n)),r}function jn(e,n,o,r={}){if(n&&typeof e.seenBy!="function")throw new TypeError("blockContextFor: a seat is read from a store (its `seenBy`); a bare { graph, schema } is read as it is handed, with no principal");let t=n?e.seenBy(n):e,a=n&&o?t.graph.getNode(o.id)??null:o,d=t.schema,l=a&&d.tryDefinition(a.kind),i=!a||(r.slot??"page")==="page",{money:s,firstHeading:y}=r;return{node:a,graph:t.graph,schema:d,kinds:D(d),fields:a?He(d,a.kind):{},definition:l||void 0,today:r.today??t.today?.()??W(),money:s,heading:r.heading??(i?2:3),firstHeading:y,budget:r.budget??(i?We:Ue),...i?{}:{glance:!0}}}export{V as a,je as b,ze as c,me as d,he as e,cn as f,be as g,De as h,Sn as i,jn as j};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk.WVUJXDXZ.js";import{h as x}from"./chunk.
|
|
1
|
+
import"./chunk.WVUJXDXZ.js";import{h as x}from"./chunk.VHWUGSFW.js";import"./chunk.P75TPZWT.js";import"./chunk.6W7J76TK.js";import"./chunk.FUR4IHWG.js";import"./chunk.2B4WVCVV.js";import"./chunk.AAZFVCSP.js";import"./chunk.IMRCAU4T.js";import{Na as f,Pa as N,X as S}from"./chunk.F5BCCGFK.js";import"./chunk.AJZBJBMO.js";var k=(n,r,t)=>({untrusted:!0,authoredBy:t.say(r),text:n});function O(n,r){let t;for(let[a,e]of Object.entries(n)){if(typeof e!="string"||a==="id"||a==="kind")continue;let o=r.fieldBy(n.id,a);o&&(t??={...n},t[a]=k(e,o,r))}return t??n}function L(n,r,t){let a=e=>{if(Array.isArray(e))return e.map(a);if(e!==null&&typeof e=="object"&&"id"in e&&"label"in e){let o=e,i=t.recordBy(o.id);return i?{...o,label:k(o.label,i,t)}:o}if(typeof e=="string"){let o=t.recordBy(n);return o?k(e,o,t):e}return e};return Object.fromEntries(Object.entries(r).map(([e,o])=>[e,a(o)]))}function $(n,r){return n.map(t=>{let a=r.recordBy(t.id);return a?{...t,label:k(t.label,a,r)}:t})}function D(n,r){return{...n,nodes:n.nodes.map(t=>O(t,r))}}var E=n=>(JSON.stringify(n)??"null").length,R=n=>typeof n=="number"&&Number.isFinite(n)&&n>0?Math.floor(n):0;function w(n,r,t,a,e,o=""){let i=n-r-t;return i>0?`and ${i} more ${e}: call ${a} with ${o}offset ${r+t} for the next page.`:void 0}var j=({line:n,...r})=>r;function T(n){let r;for(let[t,a]of Object.entries(n))typeof a!="string"||a.length<=600||(r??={...n},r[t]=`${a.slice(0,600)}\u2026 (cut at ${600} of ${a.length} characters)`);return r??n}function B(n,r,t,a){let e=Math.min(t,Math.max(0,n.length-r)),o=n.slice(r,r+e),i=a(o);for(;e>1&&E(i)>8e3;)e=Math.max(1,Math.floor(e*.75)),o=n.slice(r,r+e),i=a(o);return{page:o,answer:i}}function C(n,r){let t=JSON.stringify(r)??"null";if(t.length<=8e3)return r;let a=`This answer was ${t.length} characters, more than the ${8e3} one read answers, so it is cut. Ask ${n} for less, or use search_graph and get_node to read one thing.`;for(let e=8e3-a.length-40;;){let o={cut:a,partial:t.slice(0,e)},i=E(o)-8e3;if(i<=0)return o;e=Math.max(0,e-i-8)}}function I(n,r){let{matched:t,later:a,...e}=r,o=n.hits.filter(i=>i.about==="node").length;return n.total>o?{...e,more:`and ${n.total-o} more records match: narrow the words, or add kind:<kind>.`}:e}function P(n,r,t){let a=N(t.archived),e={nodes:n.graph.allNodes({archived:a}),edges:n.graph.allEdges({archived:"all"})},o=R(t.offset),i=e.nodes.length,{page:h,answer:u}=B(e.nodes,o,25,d=>{let g=new Set(d.map(s=>s.id)),l=new Set(d.map(s=>s.id)),c=w(i,o,d.length,"get_graph","nodes"),p=s=>l.has(s)||(a==="all"?n.graph.has(s):n.graph.has(s)&&f(n.graph.getNode(s))===a);return{...D({nodes:d.map(T),edges:e.edges.filter(s=>g.has(s.from)&&p(s.to))},r),total:i,...c?{more:c}:{}}});return{data:u,reads:h.map(d=>d.id)}}function U(n,r,t,a){let e=n.graph.getNode(t),o=R(a.offset),i=n.graph.outEdges(t),h=n.graph.inEdges(t),u=i.slice(o,o+20),d=h.slice(o,o+20),g=(s,A)=>{let m=n.graph.getNode(A);return{kind:s,id:A,label:m?S(n.schema.tryDefinition(m.kind),m):A,...f(m)?{archived:!0}:{}}},l=x(n.schema,n.graph,e),c=n.violations().filter(s=>s.nodeIds.includes(t)),p=[w(i.length,o,u.length,"get_node","links out",`id "${t}" and `),w(h.length,o,d.length,"get_node","links in",`id "${t}" and `),c.length>20?`and ${c.length-20} more problems: get_violations lists them.`:void 0].filter(Boolean);return{data:{node:O(T(e),r),...f(e)?{archived:!0}:{},...Object.keys(l.values).length>0?{computed:L(t,l.values,r)}:{},...Object.keys(l.refused).length>0?{uncomputed:l.refused}:{},out:$(u.map(s=>g(s.kind,s.to)),r),in:$(d.map(s=>g(s.kind,s.from)),r),violations:c.slice(0,20).map(j),...p.length>0?{more:p.join(" ")}:{}},reads:[t,...u.map(s=>s.to),...d.map(s=>s.from)]}}function F(n,r){let t=R(r.offset),{page:a,answer:e}=B(n,t,20,o=>{let i=w(n.length,t,o.length,"get_violations","problems");return{violations:o.map(j),total:n.length,...i?{more:i}:{}}});return{data:e,reads:[...new Set(a.flatMap(o=>o.nodeIds))]}}export{P as graphRead,U as nodeRead,I as searchRead,F as violationsRead,C as withinReadChars};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as k,d as x,e as H}from"./chunk.
|
|
1
|
+
import{c as k,d as x,e as H}from"./chunk.272ZJXQP.js";import{b as A}from"./chunk.3SM2CHKF.js";import{d as E}from"./chunk.2A2DLMT3.js";import"./chunk.E77K6KBX.js";import{a as b}from"./chunk.UT6642FC.js";import"./chunk.TI4OSTQV.js";import"./chunk.GZLYTPE7.js";import"./chunk.4B73P2WA.js";import"./chunk.IMRCAU4T.js";import{m as S}from"./chunk.BZ5VLPKB.js";import{F as L,Q as h,Y as p,_ as f,sa as v,wa as w}from"./chunk.6II4BONS.js";import{Ma as m}from"./chunk.F5BCCGFK.js";import{b as g}from"./chunk.AJZBJBMO.js";var l=g(L(),1);var e=g(h(),1);function I(){let{store:t,principal:r}=p(),a=f(),i=(0,l.useMemo)(()=>k(t,r),[t,r,a]),n=w("suggested");return i.length===0?null:(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"suggested-button",...n.trigger,onClick:n.toggle,title:"What tidying suggests, waiting for you",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:[i.length,(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("path",{d:"M3 4.5 H13 M3 8 H10 M3 11.5 H8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12.25",cy:"11.5",r:"1.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]}),(0,e.jsx)("span",{className:"graview-activity-word",children:" Suggested"})]}),n.open?(0,e.jsxs)("section",{...n.pane,"aria-label":"Suggested","data-testid":"suggested","data-graview-offstage":"",style:{...v,width:320,maxHeight:"min(52cqh, 460px)",overflow:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...S,margin:0},children:"Suggested"}),(0,e.jsx)("p",{style:{margin:0,fontSize:"0.75rem",lineHeight:1.45,color:"var(--graview-ink-faint)"},children:"Not made yet: each waits for you."}),(0,e.jsx)("ol",{"data-testid":"suggestions",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10,fontSize:"0.8125rem"},children:i.map(s=>(0,e.jsx)(O,{suggestion:s,...i.length===1?{settled:()=>{n.setOpen(!1),document.querySelector('[data-testid="activity-button"]')?.focus()}}:{}},s.id))})]}):null]})}function O({suggestion:t,settled:r}){let{store:a,principal:i,seats:n,people:s}=p(),[c,u]=(0,l.useState)(null),T=m(t.author,{graph:a.graph,schema:a.schema,seats:n,people:s}),y=o=>{u(null);try{o==="accept"?x(a,t.id,{author:i}):H(a,t.id,{author:i}),r?.()}catch(d){u(d instanceof Error?d.message:String(d))}};return(0,e.jsxs)("li",{"data-testid":"suggestion","data-suggestion":t.id,style:{display:"grid",gap:5,lineHeight:1.45},children:[(0,e.jsxs)("span",{children:[(0,e.jsx)("strong",{style:{fontWeight:600},children:T})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:"suggests"})," ",t.intent]}),t.lineage?(0,e.jsx)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:b(t.lineage)}):null,t.about.length>0?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:t.about.slice(0,4).map(o=>(0,e.jsx)(E,{label:A(a,o),pickId:o},o))}):null,(0,e.jsxs)("div",{style:{display:"flex",gap:6},children:[(0,e.jsx)("button",{type:"button","data-testid":"suggestion-accept",onClick:()=>y("accept"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Accept"}),(0,e.jsx)("button",{type:"button","data-testid":"suggestion-decline",onClick:()=>y("decline"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Decline"})]}),c?(0,e.jsx)("span",{"data-testid":"suggestion-refused",role:"alert",style:{fontSize:"0.75rem",color:"var(--graview-warn)"},children:c}):null]})}export{I as SuggestedTray};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Q as w,k as c,m as h,n as b,na as y,pa as k,s as f}from"./chunk.
|
|
1
|
+
import{Q as w,k as c,m as h,n as b,na as y,pa as k,s as f}from"./chunk.6II4BONS.js";import{N as i}from"./chunk.F5BCCGFK.js";import{b as g}from"./chunk.AJZBJBMO.js";var s=null,a=new Set,v=e=>{s={kind:e,n:(s?.n??0)+1};for(let t of a)t()},A=()=>s,C=e=>(a.add(e),()=>a.delete(e)),V=()=>{s=null};var d=g(w(),1);function T(e,t){if(e.length===0||t.length===0)return[];let o=new Set(t.map(n=>n.id));return e.filter(n=>n.nodeIds.some(l=>o.has(l)))}var x=(e,t)=>`${i(e)} ${e===1?"problem":"problems"} in ${t}`;function q({kind:e,plural:t,problems:o,flag:n,listed:l=!1}){let{view:p,go:P}=k(),{set:$}=y();if(o.length===0)return null;let u=x(o.length,t),m=o.length===1?"it":"them";return(0,d.jsx)("button",{type:"button",className:"graview-district-problems","data-testid":`district-problems-${e}`,"data-graview-problems":o.length,"aria-expanded":l,"aria-label":u,title:`${u} \u2014 ${o[0].message}${o.length>1?` (and ${i(o.length-1)} more)`:""}. Press to see ${m} and how to fix ${m}.`,onClick:r=>{r.stopPropagation(),p.overview||P(h(c(b(p,!0),null),"view",null)),$([f(e)]),v(e)},onDoubleClick:r=>r.stopPropagation(),onPointerDown:r=>r.stopPropagation(),children:(0,d.jsx)("span",{"aria-hidden":"true",children:`${n} ${i(o.length)}`})})}export{A as a,C as b,V as c,T as d,x as e,q as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r,b as m,d as k,e as h}from"./chunk.UGFDSE37.js";import"./chunk.
|
|
1
|
+
import{a as r,b as m,d as k,e as h}from"./chunk.UGFDSE37.js";import"./chunk.BZ5VLPKB.js";import"./chunk.6II4BONS.js";import"./chunk.F5BCCGFK.js";import"./chunk.AJZBJBMO.js";var o="way-back",b='[data-testid="notices-toasts"]';function g(t){let a=document.activeElement;a!==null&&a!==document.body&&!a.closest(b)||(t??document).querySelector('[data-graview-app-bar] [data-testid="app-home"]')?.focus({preventScroll:!0})}function w(t,a,i,d,y){if(t.past)return i?.dismiss(o),()=>{};let c=y?.closest("[data-graview-embed]"),s,f=e=>{if(e!==void 0&&r(t,a)?.batch!==e)return!1;try{let n=k(t,a);return n&&i?.notify({kind:"toast",id:o,sentence:`Took back \u201C${n.intent}\u201D`}),n!==void 0}catch(n){return i?.notify({kind:"toast",id:o,tone:"warn",sentence:n instanceof Error?n.message:String(n)}),!0}},u=()=>{let e=m(t,a,d);if(d=t.batches().length,e){let n=s=e.batch;i?.notify({kind:"toast",id:o,sentence:e.intent,timeout:1e4,action:{label:"Take back",onSelect:()=>(g(c),f(n))}})}else s&&r(t,a)?.batch!==s&&(s=void 0,i?.dismiss(o))},l=e=>{h(e)&&(!c||c.contains(e.target))&&f()&&e.preventDefault()};u();let p=t.subscribe(u);return document.addEventListener("keydown",l),(e=!1)=>{p(),document.removeEventListener("keydown",l),e&&s&&i?.dismiss(o)}}export{w as sceneWay};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as R}from"./chunk.
|
|
1
|
+
import{b as R}from"./chunk.OFJH7LDC.js";import"./chunk.5PU3RWYY.js";import"./chunk.E77K6KBX.js";import"./chunk.WVUJXDXZ.js";import"./chunk.VHWUGSFW.js";import"./chunk.P75TPZWT.js";import"./chunk.6W7J76TK.js";import"./chunk.FUR4IHWG.js";import"./chunk.2B4WVCVV.js";import"./chunk.AAZFVCSP.js";import"./chunk.GZHZLJBF.js";import{n as x}from"./chunk.PWOVXARZ.js";import"./chunk.SG23JC6D.js";import"./chunk.OJGHDWI6.js";import"./chunk.GZLYTPE7.js";import"./chunk.4B73P2WA.js";import"./chunk.IMRCAU4T.js";import"./chunk.BZ5VLPKB.js";import{F as k,Q as v,Z as g}from"./chunk.6II4BONS.js";import{ca as m,fc as A,ga as c}from"./chunk.F5BCCGFK.js";import{b as u}from"./chunk.AJZBJBMO.js";var f=u(k(),1);var S=u(k(),1),L=(0,S.createContext)(void 0);var i=u(v(),1),W=new WeakMap,y=new WeakMap,P=(e,n)=>`${n.kind}\0${n.id??""}\0${e}`;function C(e,n,r){let o=P(n,r),p=W.get(e);p||W.set(e,p=new Map);let t=p.get(o);return t||(t=Promise.resolve().then(()=>e(n,r)).then(a=>b(a)?a:null,()=>null).then(a=>{let s=y.get(e);return s||y.set(e,s=new Map),s.set(o,a),a}),p.set(o,t)),t}function b(e){if(e===null)return!0;if(typeof e!="object"||e===void 0)return!1;if(e.denied===!0)return!0;let n=e;return typeof n.name=="string"&&n.name.trim()!==""&&typeof n.href=="string"}function h(e){if(/^https?:\/\//i.test(e))try{return new URL(e).href}catch{return}}var N=e=>h(e)??(c(e)?e:void 0),E=e=>h(e)??(e.startsWith("/")&&c(e)?e:void 0),I={kind:"human"},w={color:"var(--graview-ink-muted)"};function M({icon:e}){if(!e)return null;let n=E(e);if(n)return(0,i.jsx)("img",{src:n,alt:"",width:20,height:20,"data-graview-app-icon":"",style:{width:20,height:20,borderRadius:5,objectFit:"cover",flex:"0 0 auto"}});let r=[...e.trim()].slice(0,2).join("");return r?(0,i.jsx)("span",{"aria-hidden":"true","data-graview-app-icon":"",style:{flex:"0 0 auto",lineHeight:"20px"},children:r}):null}function V(e){let n=g(),r=(0,f.useContext)(L)??n?.resolveApp,o=n?.principal??I,p=()=>r?y.get(r)?.get(P(e,o))??"asking":null,[t,a]=(0,f.useState)(p);return(0,f.useEffect)(()=>{let s=p();if(a(s),s!=="asking"||!r)return;let l=!0;return C(r,e,o).then(d=>l&&a(d)),()=>{l=!1}},[r,e,o.kind,o.id]),t}function D({address:e,as:n="chip",nodeId:r,field:o,style:p}){let t=V(e),a={position:"relative",zIndex:A.raised,overflowWrap:"anywhere",minWidth:0,maxWidth:"100%",...p},s;if(t==="asking")s=(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"asking","aria-busy":"true",style:{...w,...a},children:"Linked app"});else if(t&&"denied"in t)s=(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"denied",style:{...w,fontStyle:"italic",...a},children:"linked app (no access)"});else if(t){let l=N(t.href),d=n==="record"?t.headline?.trim():void 0;s=(0,i.jsxs)(l?"a":"span",{"data-graview-app-link":"","data-graview-app-state":"found",...l?{href:l}:{},...!d&&t.headline?{title:t.headline}:{},style:{display:"inline-flex",alignItems:d?"flex-start":"center",minHeight:24,gap:8,color:"inherit",textUnderlineOffset:3,...a},children:[(0,i.jsx)(M,{icon:t.icon}),(0,i.jsxs)("span",{style:{display:"grid",minWidth:0},children:[(0,i.jsx)("span",{"data-graview-app-name":"",style:{fontWeight:600},children:t.name}),d?(0,i.jsx)("span",{"data-graview-app-headline":"",style:{...w,fontSize:"0.8125em",fontWeight:400},children:d}):null]})]})}else{let l=h(e);s=l?(0,i.jsx)("a",{"data-graview-app-link":"","data-graview-app-state":"plain",href:l,rel:"noopener noreferrer",target:"_blank",style:{color:"var(--graview-accent)",display:"inline-flex",alignItems:"center",minHeight:24,...a},children:e}):(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"plain",style:a,children:e})}return r&&o?(0,i.jsx)(H,{nodeId:r,field:o,address:e,drawn:s}):s}function H({nodeId:e,field:n,address:r,drawn:o}){let p=x(e).fields.some(s=>s.field===n),t=g()?.store;if(!p)return o;let a=m(t?t.schema.tryDefinition(String(t.graph.getNode(e)?.kind)):void 0,n).toLowerCase();return(0,i.jsxs)("span",{style:{display:"inline-flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px",maxWidth:"100%",minWidth:0},children:[o,(0,i.jsx)("span",{style:{fontSize:"0.8125rem"},children:(0,i.jsx)(R,{nodeId:e,field:n,value:"Change",stored:r,said:`Change the ${a}`})})]})}var _=e=>(0,i.jsx)(D,{...e});export{D as AppLink,_ as drawAppLink};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as J,b as We}from"./chunk.5A4AOFOA.js";import"./chunk.KSXB4LDF.js";import"./chunk.VZHV25JE.js";import"./chunk.QVUL2FSI.js";import{i as $e,j as Re,k as Le}from"./chunk.U5EJSTST.js";import"./chunk.PW7YH6JV.js";import"./chunk.XSYBNUXF.js";import"./chunk.5EAQDBBE.js";import"./chunk.YT2CYCVT.js";import"./chunk.HJCQ6I3S.js";import"./chunk.DUUARGPE.js";import"./chunk.FUQVNXLB.js";import"./chunk.LAF6GTBN.js";import"./chunk.QU356VB2.js";import"./chunk.QVKKXMNK.js";import"./chunk.ZSW74NVJ.js";import"./chunk.ZE4CTZQ3.js";import"./chunk.3C4RJIJU.js";import{a as Pe,b as k}from"./chunk.DPP7ITTU.js";import"./chunk.GF7LA4QG.js";import"./chunk.AEHPDVLQ.js";import{b as ze,c as Ee}from"./chunk.UT6642FC.js";import"./chunk.TI4OSTQV.js";import"./chunk.HPD5ZDZH.js";import"./chunk.52QAIGCD.js";import"./chunk.PPUAPAWR.js";import"./chunk.IHFNLKXV.js";import"./chunk.577PGFUT.js";import"./chunk.FBY5IUGU.js";import"./chunk.4K5QCJFH.js";import{u as Ie}from"./chunk.QRMWFEEH.js";import"./chunk.MVN6H65Q.js";import"./chunk.OJGHDWI6.js";import{g as Ce}from"./chunk.Z7ZCR4LN.js";import"./chunk.RIW7SQH4.js";import{c as Me}from"./chunk.FSAHO3LV.js";import{m as He}from"./chunk.Y5Z4ZDTO.js";import{F as tt,Q as Se,Y as N,i as xe,na as Q,sa as Ae,v as ke,wa as Te}from"./chunk.UWIYKGYK.js";import{Jb as ye,Kb as we,da as K,ea as W,fc as be,kb as ve}from"./chunk.X7W27IRI.js";import{b as G}from"./chunk.AJZBJBMO.js";var o=G(tt(),1);var t=G(Se(),1);function mt(d,r,a){let p=r.on??r.about[r.about.length-1];$e(d,r.about,{...a,pins:J(),...p===void 0?{}:{focus:p}})}function ft({placement:d="float",chosen:r=!0}={}){let{menuAt:a}=N();return d==="menu"&&a===null?r?(0,t.jsx)(nt,{}):null:(0,t.jsx)(it,{placement:d})}function nt(){let{store:d,setMenuAt:r,view:a}=N(),{selection:p}=Q(),h=(0,o.useRef)(null),[H,v]=(0,o.useState)(null);(0,o.useLayoutEffect)(()=>{let b=h.current?.offsetParent??h.current?.parentElement;if(!b)return;let m=Math.round(b.getBoundingClientRect().width);m!==H&&v(m)});let y=p.length===1&&!a.overview?d.graph.getNode(p[0]):void 0;return!y||H===null||H>=De?(0,t.jsx)("span",{ref:h,hidden:!0}):(0,t.jsx)("button",{type:"button",ref:h,"data-testid":"chosen-acts","aria-label":`What can be done with ${k(d,y.id)}`,"aria-haspopup":"menu",onClick:b=>{let m=b.currentTarget.getBoundingClientRect();r({x:Math.round(m.right),y:Math.round(m.bottom+4),on:y.id})},style:{position:"absolute",right:"calc(14px + var(--graview-dock, 0px))",top:98,zIndex:"var(--graview-layer-overview, 10)",minHeight:30,padding:"0 12px",borderRadius:8,fontSize:"0.8125rem",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Acts\u2026"})}var De=564;function it({placement:d}){let{store:r,menuAt:a,setMenuAt:p,view:h,signIn:H}=N(),v=(0,o.useRef)(null),y=(0,o.useRef)(null),b=(0,o.useRef)(null),m=(0,o.useRef)(null);a?.returnTo&&(m.current=a.returnTo);let Oe=e=>{let i=e.closest("[data-graview-asking]")?.getAttribute("data-graview-asking"),n=e.getAttribute("data-pin-for"),g=i??e.getAttribute("data-affordance")??(n===null?null:`pin:${n}`)??e.getAttribute("data-menu-item");y.current=g===null?null:{key:g,element:e}};(0,o.useEffect)(()=>{let e=v.current,i=y.current;if(i===null||document.activeElement!==document.body||i.element.isConnected)return;let n=i.key;if(!e){y.current=null;let I=m.current;m.current=null,(I?.isConnected?I:b.current)?.focus();return}((n.startsWith("pin:")?e.querySelector(`[data-pin-for="${CSS.escape(n.slice(4))}"]`):null)??e.querySelector(`[data-affordance="${CSS.escape(n)}"]:not([disabled])`)??e).focus()});let[Fe,qe]=(0,o.useState)(null);(0,o.useLayoutEffect)(()=>{let e=v.current?.offsetParent??v.current?.parentElement;if(e instanceof HTMLElement&&(b.current=e),!e)return;let i=e.getBoundingClientRect();qe(n=>n&&n.left===i.left&&n.top===i.top&&n.width===i.width&&n.height===i.height?n:{left:i.left,top:i.top,width:i.width,height:i.height})});let{selection:Be,set:je,clear:_e}=Q(),s=a?.about??Be,[D,Ue]=(0,o.useState)(()=>J()),O=a?.on??s[s.length-1],F=a?.about,Ve=(0,o.useMemo)(()=>({pins:D,...O===void 0?{}:{focus:O},...F?{about:F}:{}}),[D,O,F]),Ye=(0,o.useMemo)(()=>new Set(r.allMutations().filter(e=>e.pinned).map(e=>e.name)),[r]),{affordances:c,withheld:X,observations:Z}=Re(Ve),M=we(X,H),f=M?rt:X,Ge=a===null?null:{face:a.face??"scene",on:a.on,about:s,field:a.field,place:a.place,href:a.href,act:a.act,element:a.returnTo},ee=Ie(Ge),te=Z.some(e=>e.id.startsWith("schema:waits:")),{apply:Ke,preview:Qe}=Le(),[C,z]=(0,o.useState)(null),[Je,ne]=(0,o.useState)(!1),[ie,re]=(0,o.useState)(!1),[P,$]=(0,o.useState)(""),[ae,q]=(0,o.useState)(null),B=(0,o.useRef)([]),j=(e,i)=>{try{return Qe(e,i),Ke(e,i),q(null),p(null),B.current=[],!0}catch(n){return q(Ce(r.schema,r.allMutations(),n)),B.current=n instanceof ve?n.issues.map(g=>String(g.path[0]??"")).filter(Boolean):[],!1}},R=[...new Set(s.flatMap(e=>{let i=r.graph.getNode(e);return i?[i.kind]:[]}))],x=R.length>0?R:[...new Set(s.flatMap(e=>ke(e)))],u=s.length===1?xe(s[0]):null,_=u?{from:r.graph.getNode(u.from),to:r.graph.getNode(u.to)}:null,oe=u?Ee(r,u):void 0,le=oe?.provisional?oe:void 0,se=u?(()=>{let e=r.schema.tryDefinition(r.graph.getNode(u.from)?.kind??"")?.edges?.[u.kind],i=r.graph.getNode(u.to);return e?.inverse&&i?`From ${k(r,i.id)}: ${e.inverse}`:null})():null;(0,o.useEffect)(()=>{z(null),ne(!1),re(!1),q(null),$("")},[s,a?.about]);let l=a!==null,Xe=d==="menu"&&!l,S=(0,o.useRef)(a);S.current=a;let de=Te("acts",{open:l&&d==="menu",onOpenChange:e=>{e||p(null)},at:()=>S.current?{x:S.current.x,y:S.current.y}:null,returnTo:()=>{let e=S.current?.returnTo;if(e?.isConnected)return e;let i=S.current?.on;return i?document.querySelector(`[data-graview-view="${CSS.escape(i)}"]`):null},align:"start"}),ue=(Fe?.width??Number.POSITIVE_INFINITY)<De;if((0,o.useLayoutEffect)(()=>{let e=v.current?.offsetParent;if(!e||!ue||l)return;let i=v.current?.getBoundingClientRect().height??0,n=`${Math.round(i)+20}px`;if(e.style.paddingBottom===n)return;let g=e.style.paddingBottom;return e.style.paddingBottom=n,()=>{e.style.paddingBottom=g}}),s.length===0&&!l)return null;let pe=a?.title!==void 0||s.length>0&&!(s.length===1&&s[0]===h.focusId),ce=Math.max(1,Math.min(9,c.length)),A=[...c.filter(e=>e.provider==="invariant"&&!e.destructive),...c.filter(e=>e.pinned&&e.provider!=="invariant"&&!e.destructive),...c.filter(e=>!e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...c.filter(e=>e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...c.filter(e=>e.destructive)],ge=A.length>ce&&!l,he=P.trim().toLowerCase(),w=ge&&he.length>0?A.filter(e=>`${e.label} ${e.why}`.toLowerCase().includes(he)):null,U=w??(Je||l?A:A.slice(0,ce)),me=w?0:A.length-U.length,L=[];for(let e of U){let i=!l&&e.provider==="invariant",n=!l&&!i&&e.pinned!==void 0&&!e.destructive,g=!l&&!i&&!n&&e.ties===!0&&!e.destructive,I=i?e.why:n?"pinned":g?"its ties":null,et=i?"violation":n||g?"ties":null,Y=L[L.length-1];Y&&Y.heading===I?Y.items.push(e):L.push({heading:I,tone:et,items:[e]})}let V=c.find(e=>e.id===C),E=s.length===1?k(r,s[0]):null,fe=e=>{if(!E)return e;let i=e.startsWith(`"${E}"`)?e.slice(E.length+2):e.startsWith(E)?e.slice(E.length):null;if(i===null)return e;let n=i.trimStart();return n.length===0?e:n[0].toUpperCase()+n.slice(1)},Ze=new Set(l?[]:U.filter(e=>e.provider==="invariant").map(e=>e.why)),T=Z.filter(e=>!Ze.has(e.text)).map(e=>({...e,text:fe(e.text)}));return Xe?null:(0,t.jsxs)("section",{...l?de.pane:{},ref:e=>{v.current=e,l&&de.pane.ref(e)},"aria-label":"Inspector","data-graview-offstage":"","data-testid":l?"context-menu":"inspector-strip",tabIndex:-1,onFocus:e=>Oe(e.target),onBlur:e=>{e.relatedTarget!==null&&(y.current=null)},onMouseDown:e=>e.stopPropagation(),style:{...l?Ae:{position:"absolute",zIndex:be("rail")},boxSizing:"border-box",display:"flex",flexDirection:"column",gap:7,padding:"9px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",...l?{width:300,maxHeight:"min(52cqh, 420px)",overflow:"auto"}:ue?{left:10,right:10,width:"auto",bottom:10,maxHeight:"min(42cqh, 300px)",overflow:"auto"}:{left:14,top:h.overview?"min(296px, 38cqh)":44,width:236,maxHeight:h.overview?"calc(100cqh - min(296px, 38cqh) - 20px)":"calc(68cqh - 94px)",overflow:"auto"}},children:[(0,t.jsx)("h2",{style:{...He,margin:0},children:"Inspector"}),(0,t.jsxs)("div",{style:{display:pe||!l?"flex":"none",alignItems:"baseline",flexWrap:"wrap",gap:"2px 8px",minWidth:0,paddingRight:l?0:24},children:[pe?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("strong",{style:{fontSize:"0.9375rem",whiteSpace:"nowrap"},children:a?.title??(s.length===1?k(r,s[0]):`${s.length} selected`)}),R.length>0||u?(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:u?"relation":R.map(e=>W(r.schema.tryDefinition(e),e)).join(" \xB7 ")}):null,s.length===1&&!u&&a?.face!=="pages"?(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:h.expanded.includes(s[0])?"\xB7 double-click closes":"\xB7 double-click opens"}):null]}):null,(0,t.jsx)("span",{style:{flex:"1 1 auto"}})]}),l?null:(0,t.jsx)("button",{type:"button",onClick:()=>{p(null),_e()},"aria-label":"Clear selection",title:"Clear selection",style:{position:"absolute",top:6,right:6,flex:"0 0 auto",width:24,height:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.875rem",lineHeight:1,borderRadius:7},children:"\xD7"}),u&&_?(0,t.jsxs)("div",{style:{display:"grid",gap:6},children:[se?(0,t.jsx)("p",{"data-testid":"edge-said",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:se}):null,le?(0,t.jsx)("p",{"data-testid":"edge-provisional",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:ze(le)}):null,(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[["from",_.from],["to",_.to]].map(([e,i],n)=>(0,t.jsxs)(o.Fragment,{children:[n===1?(0,t.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-ink-faint)"},children:"\u2192"}):null,i?(0,t.jsx)("button",{type:"button","data-testid":`edge-${e}`,onClick:()=>je([i.id]),title:`Select ${k(r,i.id)}`,style:{fontSize:"0.8125rem",padding:"3px 9px",borderRadius:6},children:k(r,i.id)}):(0,t.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"gone"})]},e))})]}):null,!u&&s.length===1&&ye(r,s[0])?(0,t.jsx)("p",{"data-testid":"left-alone",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:"Left alone: nothing automated changes it."}):null,T.length>0?(0,t.jsx)("div",{"data-testid":"observations",title:T.map(e=>e.text).join(`
|
|
1
|
+
import{a as J,b as We}from"./chunk.5A4AOFOA.js";import"./chunk.OF34OZ4V.js";import"./chunk.NNCTJSD3.js";import"./chunk.GXLAZGYT.js";import{i as $e,j as Re,k as Le}from"./chunk.R7LRJS6B.js";import"./chunk.IB32NOV5.js";import"./chunk.Y3IJDWNS.js";import"./chunk.ZDNJK2SX.js";import"./chunk.ZSSOTIFL.js";import"./chunk.HJCQ6I3S.js";import"./chunk.ZWZ5SEXT.js";import"./chunk.FQKH67BP.js";import"./chunk.LA7535VO.js";import"./chunk.ZEW2OOZ5.js";import"./chunk.7YQYWOZR.js";import"./chunk.ACEYGWMO.js";import"./chunk.3PT55HXT.js";import"./chunk.272ZJXQP.js";import{a as Pe,b as k}from"./chunk.3SM2CHKF.js";import"./chunk.2A2DLMT3.js";import"./chunk.E77K6KBX.js";import{b as ze,c as Ee}from"./chunk.UT6642FC.js";import"./chunk.TI4OSTQV.js";import"./chunk.EBLKEQ7O.js";import"./chunk.VHWUGSFW.js";import"./chunk.P75TPZWT.js";import"./chunk.6W7J76TK.js";import"./chunk.FUR4IHWG.js";import"./chunk.2B4WVCVV.js";import"./chunk.AAZFVCSP.js";import{u as Ie}from"./chunk.PWOVXARZ.js";import"./chunk.SG23JC6D.js";import"./chunk.OJGHDWI6.js";import{g as Ce}from"./chunk.GZLYTPE7.js";import"./chunk.4B73P2WA.js";import{c as Me}from"./chunk.IMRCAU4T.js";import{m as He}from"./chunk.BZ5VLPKB.js";import{F as tt,Q as Se,Y as N,i as xe,na as Q,sa as Ae,v as ke,wa as Te}from"./chunk.6II4BONS.js";import{Kb as ye,Lb as we,da as K,ea as W,gc as be,lb as ve}from"./chunk.F5BCCGFK.js";import{b as G}from"./chunk.AJZBJBMO.js";var o=G(tt(),1);var t=G(Se(),1);function mt(d,r,a){let p=r.on??r.about[r.about.length-1];$e(d,r.about,{...a,pins:J(),...p===void 0?{}:{focus:p}})}function ft({placement:d="float",chosen:r=!0}={}){let{menuAt:a}=N();return d==="menu"&&a===null?r?(0,t.jsx)(nt,{}):null:(0,t.jsx)(it,{placement:d})}function nt(){let{store:d,setMenuAt:r,view:a}=N(),{selection:p}=Q(),h=(0,o.useRef)(null),[H,v]=(0,o.useState)(null);(0,o.useLayoutEffect)(()=>{let b=h.current?.offsetParent??h.current?.parentElement;if(!b)return;let m=Math.round(b.getBoundingClientRect().width);m!==H&&v(m)});let y=p.length===1&&!a.overview?d.graph.getNode(p[0]):void 0;return!y||H===null||H>=De?(0,t.jsx)("span",{ref:h,hidden:!0}):(0,t.jsx)("button",{type:"button",ref:h,"data-testid":"chosen-acts","aria-label":`What can be done with ${k(d,y.id)}`,"aria-haspopup":"menu",onClick:b=>{let m=b.currentTarget.getBoundingClientRect();r({x:Math.round(m.right),y:Math.round(m.bottom+4),on:y.id})},style:{position:"absolute",right:"calc(14px + var(--graview-dock, 0px))",top:98,zIndex:"var(--graview-layer-overview, 10)",minHeight:30,padding:"0 12px",borderRadius:8,fontSize:"0.8125rem",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Acts\u2026"})}var De=564;function it({placement:d}){let{store:r,menuAt:a,setMenuAt:p,view:h,signIn:H}=N(),v=(0,o.useRef)(null),y=(0,o.useRef)(null),b=(0,o.useRef)(null),m=(0,o.useRef)(null);a?.returnTo&&(m.current=a.returnTo);let Oe=e=>{let i=e.closest("[data-graview-asking]")?.getAttribute("data-graview-asking"),n=e.getAttribute("data-pin-for"),g=i??e.getAttribute("data-affordance")??(n===null?null:`pin:${n}`)??e.getAttribute("data-menu-item");y.current=g===null?null:{key:g,element:e}};(0,o.useEffect)(()=>{let e=v.current,i=y.current;if(i===null||document.activeElement!==document.body||i.element.isConnected)return;let n=i.key;if(!e){y.current=null;let I=m.current;m.current=null,(I?.isConnected?I:b.current)?.focus();return}((n.startsWith("pin:")?e.querySelector(`[data-pin-for="${CSS.escape(n.slice(4))}"]`):null)??e.querySelector(`[data-affordance="${CSS.escape(n)}"]:not([disabled])`)??e).focus()});let[Fe,qe]=(0,o.useState)(null);(0,o.useLayoutEffect)(()=>{let e=v.current?.offsetParent??v.current?.parentElement;if(e instanceof HTMLElement&&(b.current=e),!e)return;let i=e.getBoundingClientRect();qe(n=>n&&n.left===i.left&&n.top===i.top&&n.width===i.width&&n.height===i.height?n:{left:i.left,top:i.top,width:i.width,height:i.height})});let{selection:Be,set:je,clear:_e}=Q(),s=a?.about??Be,[D,Ue]=(0,o.useState)(()=>J()),O=a?.on??s[s.length-1],F=a?.about,Ve=(0,o.useMemo)(()=>({pins:D,...O===void 0?{}:{focus:O},...F?{about:F}:{}}),[D,O,F]),Ye=(0,o.useMemo)(()=>new Set(r.allMutations().filter(e=>e.pinned).map(e=>e.name)),[r]),{affordances:c,withheld:X,observations:Z}=Re(Ve),M=we(X,H),f=M?rt:X,Ge=a===null?null:{face:a.face??"scene",on:a.on,about:s,field:a.field,place:a.place,href:a.href,act:a.act,element:a.returnTo},ee=Ie(Ge),te=Z.some(e=>e.id.startsWith("schema:waits:")),{apply:Ke,preview:Qe}=Le(),[C,z]=(0,o.useState)(null),[Je,ne]=(0,o.useState)(!1),[ie,re]=(0,o.useState)(!1),[P,$]=(0,o.useState)(""),[ae,q]=(0,o.useState)(null),B=(0,o.useRef)([]),j=(e,i)=>{try{return Qe(e,i),Ke(e,i),q(null),p(null),B.current=[],!0}catch(n){return q(Ce(r.schema,r.allMutations(),n)),B.current=n instanceof ve?n.issues.map(g=>String(g.path[0]??"")).filter(Boolean):[],!1}},R=[...new Set(s.flatMap(e=>{let i=r.graph.getNode(e);return i?[i.kind]:[]}))],x=R.length>0?R:[...new Set(s.flatMap(e=>ke(e)))],u=s.length===1?xe(s[0]):null,_=u?{from:r.graph.getNode(u.from),to:r.graph.getNode(u.to)}:null,oe=u?Ee(r,u):void 0,le=oe?.provisional?oe:void 0,se=u?(()=>{let e=r.schema.tryDefinition(r.graph.getNode(u.from)?.kind??"")?.edges?.[u.kind],i=r.graph.getNode(u.to);return e?.inverse&&i?`From ${k(r,i.id)}: ${e.inverse}`:null})():null;(0,o.useEffect)(()=>{z(null),ne(!1),re(!1),q(null),$("")},[s,a?.about]);let l=a!==null,Xe=d==="menu"&&!l,S=(0,o.useRef)(a);S.current=a;let de=Te("acts",{open:l&&d==="menu",onOpenChange:e=>{e||p(null)},at:()=>S.current?{x:S.current.x,y:S.current.y}:null,returnTo:()=>{let e=S.current?.returnTo;if(e?.isConnected)return e;let i=S.current?.on;return i?document.querySelector(`[data-graview-view="${CSS.escape(i)}"]`):null},align:"start"}),ue=(Fe?.width??Number.POSITIVE_INFINITY)<De;if((0,o.useLayoutEffect)(()=>{let e=v.current?.offsetParent;if(!e||!ue||l)return;let i=v.current?.getBoundingClientRect().height??0,n=`${Math.round(i)+20}px`;if(e.style.paddingBottom===n)return;let g=e.style.paddingBottom;return e.style.paddingBottom=n,()=>{e.style.paddingBottom=g}}),s.length===0&&!l)return null;let pe=a?.title!==void 0||s.length>0&&!(s.length===1&&s[0]===h.focusId),ce=Math.max(1,Math.min(9,c.length)),A=[...c.filter(e=>e.provider==="invariant"&&!e.destructive),...c.filter(e=>e.pinned&&e.provider!=="invariant"&&!e.destructive),...c.filter(e=>!e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...c.filter(e=>e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...c.filter(e=>e.destructive)],ge=A.length>ce&&!l,he=P.trim().toLowerCase(),w=ge&&he.length>0?A.filter(e=>`${e.label} ${e.why}`.toLowerCase().includes(he)):null,U=w??(Je||l?A:A.slice(0,ce)),me=w?0:A.length-U.length,L=[];for(let e of U){let i=!l&&e.provider==="invariant",n=!l&&!i&&e.pinned!==void 0&&!e.destructive,g=!l&&!i&&!n&&e.ties===!0&&!e.destructive,I=i?e.why:n?"pinned":g?"its ties":null,et=i?"violation":n||g?"ties":null,Y=L[L.length-1];Y&&Y.heading===I?Y.items.push(e):L.push({heading:I,tone:et,items:[e]})}let V=c.find(e=>e.id===C),E=s.length===1?k(r,s[0]):null,fe=e=>{if(!E)return e;let i=e.startsWith(`"${E}"`)?e.slice(E.length+2):e.startsWith(E)?e.slice(E.length):null;if(i===null)return e;let n=i.trimStart();return n.length===0?e:n[0].toUpperCase()+n.slice(1)},Ze=new Set(l?[]:U.filter(e=>e.provider==="invariant").map(e=>e.why)),T=Z.filter(e=>!Ze.has(e.text)).map(e=>({...e,text:fe(e.text)}));return Xe?null:(0,t.jsxs)("section",{...l?de.pane:{},ref:e=>{v.current=e,l&&de.pane.ref(e)},"aria-label":"Inspector","data-graview-offstage":"","data-testid":l?"context-menu":"inspector-strip",tabIndex:-1,onFocus:e=>Oe(e.target),onBlur:e=>{e.relatedTarget!==null&&(y.current=null)},onMouseDown:e=>e.stopPropagation(),style:{...l?Ae:{position:"absolute",zIndex:be("rail")},boxSizing:"border-box",display:"flex",flexDirection:"column",gap:7,padding:"9px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",...l?{width:300,maxHeight:"min(52cqh, 420px)",overflow:"auto"}:ue?{left:10,right:10,width:"auto",bottom:10,maxHeight:"min(42cqh, 300px)",overflow:"auto"}:{left:14,top:h.overview?"min(296px, 38cqh)":44,width:236,maxHeight:h.overview?"calc(100cqh - min(296px, 38cqh) - 20px)":"calc(68cqh - 94px)",overflow:"auto"}},children:[(0,t.jsx)("h2",{style:{...He,margin:0},children:"Inspector"}),(0,t.jsxs)("div",{style:{display:pe||!l?"flex":"none",alignItems:"baseline",flexWrap:"wrap",gap:"2px 8px",minWidth:0,paddingRight:l?0:24},children:[pe?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("strong",{style:{fontSize:"0.9375rem",whiteSpace:"nowrap"},children:a?.title??(s.length===1?k(r,s[0]):`${s.length} selected`)}),R.length>0||u?(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:u?"relation":R.map(e=>W(r.schema.tryDefinition(e),e)).join(" \xB7 ")}):null,s.length===1&&!u&&a?.face!=="pages"?(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:h.expanded.includes(s[0])?"\xB7 double-click closes":"\xB7 double-click opens"}):null]}):null,(0,t.jsx)("span",{style:{flex:"1 1 auto"}})]}),l?null:(0,t.jsx)("button",{type:"button",onClick:()=>{p(null),_e()},"aria-label":"Clear selection",title:"Clear selection",style:{position:"absolute",top:6,right:6,flex:"0 0 auto",width:24,height:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.875rem",lineHeight:1,borderRadius:7},children:"\xD7"}),u&&_?(0,t.jsxs)("div",{style:{display:"grid",gap:6},children:[se?(0,t.jsx)("p",{"data-testid":"edge-said",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:se}):null,le?(0,t.jsx)("p",{"data-testid":"edge-provisional",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:ze(le)}):null,(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[["from",_.from],["to",_.to]].map(([e,i],n)=>(0,t.jsxs)(o.Fragment,{children:[n===1?(0,t.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-ink-faint)"},children:"\u2192"}):null,i?(0,t.jsx)("button",{type:"button","data-testid":`edge-${e}`,onClick:()=>je([i.id]),title:`Select ${k(r,i.id)}`,style:{fontSize:"0.8125rem",padding:"3px 9px",borderRadius:6},children:k(r,i.id)}):(0,t.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"gone"})]},e))})]}):null,!u&&s.length===1&&ye(r,s[0])?(0,t.jsx)("p",{"data-testid":"left-alone",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:"Left alone: nothing automated changes it."}):null,T.length>0?(0,t.jsx)("div",{"data-testid":"observations",title:T.map(e=>e.text).join(`
|
|
2
2
|
`),style:{display:"grid",gap:3},children:T.slice(0,2).map(e=>(0,t.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[e.text,e===T[1]&&T.length>2?(0,t.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" +",T.length-2]}):null]},e.id))}):null,l?ee.start.map(e=>(0,t.jsx)(Ne,{section:e,close:()=>p(null)},e.id)):null,ae?(0,t.jsx)("p",{"data-testid":"refused",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-warn)"},children:ae}):null,ge?(0,t.jsx)("input",{"data-testid":"action-filter",value:P,onChange:e=>$(e.target.value),placeholder:`Filter ${A.length} actions\u2026`,"aria-label":"Filter actions",onKeyDown:e=>{if(e.key==="Escape"){e.stopPropagation(),P.length>0?$(""):e.currentTarget.blur();return}if(e.key==="Enter"&&w?.length===1){let i=w[0];if(i.destructive)return;i.open.length>0?z(i.id):j(i)&&$("")}},style:{font:"inherit",fontSize:"0.875rem",padding:"5px 9px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):null,w!==null&&w.length===0?(0,t.jsxs)("p",{"data-testid":"no-matches",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:["Nothing offered here matches \u201C",P.trim(),"\u201D."]}):null,M&&c.length===0||c.length===0&&!te&&s.length===0?null:c.length===0&&!te?(0,t.jsx)("p",{"data-testid":"no-affordances",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:f.length>0?`Nothing you may do with ${u?"this relation":x.length===1?K(W(r.schema.tryDefinition(x[0]),x[0])):"this mix of kinds"} \u2014 ${f.length} action${f.length===1?"":"s"} withheld.`:u?`Nothing can be done with this line yet \u2014 nothing this app declares makes or breaks \u201C${Me(r.schema,r.graph.getNode(u.from)?.kind??"",u.kind,"out")}\u201D.`:`Nothing can be done with ${x.length===1?K(W(r.schema.tryDefinition(x[0]),x[0])):"this mix of kinds"} yet \u2014 nothing this app declares acts on ${x.length===1?"it":"them"}.`}):(0,t.jsxs)("ol",{"data-testid":"affordances",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[L.map((e,i)=>(0,t.jsxs)(o.Fragment,{children:[e.heading?(0,t.jsxs)("li",{"data-graview-heading":e.tone,style:{fontSize:"0.75rem",lineHeight:1.4,color:e.tone==="violation"?"var(--graview-warn)":"var(--graview-ink-faint)",...e.tone!=="violation"?{letterSpacing:"0.12em",textTransform:"uppercase",fontSize:"0.75rem"}:{},padding:"2px 2px 1px",marginTop:i>0?6:0},children:[e.tone==="violation"?"\u26A0 ":"",e.tone==="violation"?fe(e.heading):e.heading]}):i>0?(0,t.jsx)("li",{"aria-hidden":"true",style:{borderTop:"1px solid var(--graview-edge)",margin:"6px 0 3px"}}):null,e.items.map(n=>(0,t.jsxs)("li",{style:{display:"flex",gap:2,alignItems:"stretch"},children:[(0,t.jsxs)("button",{type:"button","data-affordance":n.id,"data-rank":n.rank,"data-graview-destructive":n.destructive||void 0,"aria-pressed":C===n.id,title:n.why,style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:C===n.id?"var(--graview-accent)":l?"transparent":"var(--graview-edge)",background:l?"none":"var(--graview-panel)",boxShadow:"none",...n.destructive?{color:"var(--graview-warn)"}:{},...C===n.id?{color:"var(--graview-accent)"}:{}},onClick:()=>{if(n.open.length>0){z(C===n.id?null:n.id);return}j(n)},children:[n.label,n.open.length>0?(0,t.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:" \u2026"}):null,w?.length===1&&w[0]?.id===n.id&&!n.destructive?(0,t.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}):null]}),(0,t.jsx)("button",{type:"button","data-testid":"pin-toggle","data-pin-for":n.mutation,"aria-pressed":n.pinned!==void 0,"aria-label":n.pinned!==void 0?`Unpin ${n.label}`:`Pin ${n.label}`,title:n.pinned==="declared"?"Pinned by the app \u2014 unpin it for yourself":n.pinned==="user"?"Unpin":"Pin to the top",onClick:()=>Ue(We(D,n.mutation,Ye.has(n.mutation))),style:{flex:"0 0 auto",width:24,minHeight:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.75rem",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7,color:n.pinned==="user"?"var(--graview-accent)":n.pinned==="declared"?"var(--graview-ink-muted)":"var(--graview-ink-faint)"},children:n.pinned!==void 0?"\u2605":"\u2606"})]},n.id))]},`${e.heading??"plain"}-${i}`)),me>0?(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button",onClick:()=>ne(!0),title:`Show all ${c.length} actions`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",me," more"]})}):null]}),M?(0,t.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>{p(null),M.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left"},children:M.label}):null,f.length>0?(0,t.jsxs)("ul",{"data-testid":"withheld",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[f.slice(0,l||ie?f.length:3).map(e=>(0,t.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,t.jsx)("button",{type:"button",disabled:!0,"data-affordance":e.id,"data-rank":e.rank,"data-withheld":e.refusal.wouldNeed.join(",")||"nobody",style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8,borderStyle:"dashed",width:"100%",textAlign:"left",background:"none"},children:(0,t.jsx)("s",{children:e.label})}),(0,t.jsx)("span",{"data-testid":"withheld-why",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-ink-muted)",padding:"0 10px"},children:e.refusal.message})]},e.id)),!l&&!ie&&f.length>3?(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button","data-testid":"withheld-more",onClick:()=>re(!0),title:`Show all ${f.length} actions this seat may not take`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",f.length-3," more withheld"]})}):null]}):null,l?ee.end.map(e=>(0,t.jsx)(Ne,{section:e,close:()=>p(null)},e.id)):null,V?(0,t.jsx)(Pe,{affordance:V,onApply:e=>{if(j(V,e))z(null);else return B.current},onCancel:()=>z(null)}):null]})}var rt=[];function Ne({section:d,close:r}){return(0,t.jsxs)("div",{"data-menu-section":d.id,...d.heading?{role:"group","aria-label":d.heading}:{},style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5},children:[d.heading?(0,t.jsx)("p",{"aria-hidden":"true",style:{margin:0,padding:"2px 2px 1px",fontSize:"0.75rem",lineHeight:1.4,letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:d.heading}):null,d.items&&d.items.length>0?(0,t.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:d.items.map(a=>(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button","data-menu-item":a.id,onClick:()=>{r(),a.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},children:[a.label,a.hint?(0,t.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",a.hint]}):null]})},a.id))}):null,d.render?.(r)]})}export{ft as InspectorPane,mt as prepareActs};
|