graview 0.1.23 → 0.1.25

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.
Files changed (85) hide show
  1. package/dist/preview/{chunk.Q7WQ5UIE.js → chunk.2AJMM7JG.js} +1 -1
  2. package/dist/preview/chunk.2WFEFZAW.js +1 -0
  3. package/dist/preview/chunk.2YVXTTC2.js +1 -0
  4. package/dist/preview/{chunk.6CLHFNDM.js → chunk.6DU4XN2F.js} +14 -14
  5. package/dist/preview/chunk.6OBXKKB5.js +20 -0
  6. package/dist/preview/chunk.6UL2JUEH.js +9 -0
  7. package/dist/preview/chunk.6WFN4C46.js +107 -0
  8. package/dist/preview/chunk.7BAUPTMY.js +1 -0
  9. package/dist/preview/chunk.A4SJ7EEY.js +1 -0
  10. package/dist/preview/chunk.ACKTGTOT.js +1 -0
  11. package/dist/preview/{chunk.BQV62QEL.js → chunk.B57EIGTS.js} +1 -1
  12. package/dist/preview/{chunk.ZFUQA3KT.js → chunk.BJ2Y5F66.js} +1 -1
  13. package/dist/preview/{chunk.L5G5DTFX.js → chunk.BYUQOV3O.js} +1 -1
  14. package/dist/preview/chunk.C5N4RTPF.js +1 -0
  15. package/dist/preview/chunk.CFL2B2Z5.js +1 -0
  16. package/dist/preview/{chunk.FLJP3BGP.js → chunk.DEZEXD24.js} +1 -1
  17. package/dist/preview/{chunk.6C7SJJQO.js → chunk.DJ72CUS7.js} +1 -1
  18. package/dist/preview/{chunk.LZQZP2PD.js → chunk.DSZ3I557.js} +1 -1
  19. package/dist/preview/chunk.EA4BZKPG.js +1 -0
  20. package/dist/preview/chunk.EKZWX6NG.js +1 -0
  21. package/dist/preview/{chunk.EQOU4POV.js → chunk.F26676IW.js} +1 -1
  22. package/dist/preview/chunk.F2KDFGHR.js +1 -0
  23. package/dist/preview/chunk.FWV4XAZA.js +1 -0
  24. package/dist/preview/chunk.G3BOZHKR.js +1 -0
  25. package/dist/preview/chunk.H4LHHT56.js +8 -0
  26. package/dist/preview/{chunk.VVZ2Z7OS.js → chunk.HQX5FGYT.js} +1 -1
  27. package/dist/preview/{chunk.VNC6H6IM.js → chunk.I5ELK6JF.js} +1 -1
  28. package/dist/preview/{chunk.UNRYIETM.js → chunk.I6T3FDQS.js} +1 -1
  29. package/dist/preview/chunk.IB6PGEU7.js +1 -0
  30. package/dist/preview/{chunk.LGUV2J6Q.js → chunk.JCZH55RX.js} +1 -1
  31. package/dist/preview/{chunk.ZQZ557VR.js → chunk.JEMQBV6K.js} +1 -1
  32. package/dist/preview/{chunk.7YCQZJGB.js → chunk.JIXW4WIO.js} +1 -1
  33. package/dist/preview/chunk.JW3E4SAC.js +1 -0
  34. package/dist/preview/{chunk.JE4VH767.js → chunk.KUTTVYOB.js} +1 -1
  35. package/dist/preview/{chunk.HCK6IHGP.js → chunk.LHFEOEYY.js} +1 -1
  36. package/dist/preview/{chunk.WGNF4E67.js → chunk.MJ67MK4R.js} +1 -1
  37. package/dist/preview/{chunk.ZKUXPS44.js → chunk.ORJ3T4IW.js} +1 -1
  38. package/dist/preview/{chunk.3MLQ3Q5X.js → chunk.PY42PBMB.js} +1 -1
  39. package/dist/preview/{chunk.CJQL7AHT.js → chunk.QOYC424P.js} +2 -2
  40. package/dist/preview/{chunk.M4XNUM2A.js → chunk.R6F3YMRK.js} +1 -1
  41. package/dist/preview/chunk.RAE4M3KQ.js +8 -0
  42. package/dist/preview/chunk.RUFAVEXB.js +1 -0
  43. package/dist/preview/chunk.RVEMN5WU.js +1 -0
  44. package/dist/preview/{chunk.3HEJZPJM.js → chunk.S24R4MRK.js} +3 -3
  45. package/dist/preview/{chunk.ELEHYYCN.js → chunk.S56LSUHV.js} +1 -1
  46. package/dist/preview/{chunk.SCLIBKLS.js → chunk.SSOTDXRS.js} +1 -1
  47. package/dist/preview/{chunk.AZG6V3PF.js → chunk.T6KID3WO.js} +1 -1
  48. package/dist/preview/chunk.TAOT74FR.js +1 -0
  49. package/dist/preview/chunk.TTODVIXW.js +1 -0
  50. package/dist/preview/{chunk.YAONM74M.js → chunk.U6BWYBPM.js} +1 -1
  51. package/dist/preview/{chunk.FLDFRFDH.js → chunk.UOYH2DFX.js} +2 -2
  52. package/dist/preview/{chunk.R5K7NK4U.js → chunk.US4KIJSW.js} +1 -1
  53. package/dist/preview/{chunk.SQD7ZPEJ.js → chunk.WX5CJ7PI.js} +1 -1
  54. package/dist/preview/chunk.WXO3XUNW.js +1 -0
  55. package/dist/preview/{chunk.ENMNLR73.js → chunk.YZZGD5OY.js} +1 -1
  56. package/dist/preview/{chunk.XYZ7KAMZ.js → chunk.ZJVIH6IF.js} +1 -1
  57. package/dist/preview/{chunk.ACZGK7LQ.js → chunk.ZRVDIVYY.js} +1 -1
  58. package/dist/preview/chunk.ZV7ZFH2S.js +1 -0
  59. package/dist/preview/page.js +2 -2
  60. package/package.json +6 -6
  61. package/dist/preview/chunk.2F7OKRDK.js +0 -9
  62. package/dist/preview/chunk.4CDEIDKB.js +0 -1
  63. package/dist/preview/chunk.4JSMCNF7.js +0 -1
  64. package/dist/preview/chunk.4UQLZ7VW.js +0 -1
  65. package/dist/preview/chunk.5MAMCKVU.js +0 -1
  66. package/dist/preview/chunk.75WDSWXL.js +0 -20
  67. package/dist/preview/chunk.7YC34AIK.js +0 -1
  68. package/dist/preview/chunk.AZYJTNSM.js +0 -107
  69. package/dist/preview/chunk.DAKED3WK.js +0 -1
  70. package/dist/preview/chunk.DJ26NOOW.js +0 -1
  71. package/dist/preview/chunk.DN4D4HGX.js +0 -1
  72. package/dist/preview/chunk.DO4P2UK4.js +0 -1
  73. package/dist/preview/chunk.K7UJG5II.js +0 -1
  74. package/dist/preview/chunk.KFLY4MAT.js +0 -1
  75. package/dist/preview/chunk.KWYU5NPM.js +0 -1
  76. package/dist/preview/chunk.LSLFKW4M.js +0 -1
  77. package/dist/preview/chunk.NOXC454O.js +0 -1
  78. package/dist/preview/chunk.OR6ZWN76.js +0 -1
  79. package/dist/preview/chunk.PC6FAJF5.js +0 -1
  80. package/dist/preview/chunk.THBP5EES.js +0 -1
  81. package/dist/preview/chunk.VRXWNUDR.js +0 -1
  82. package/dist/preview/chunk.WTF3CP76.js +0 -1
  83. package/dist/preview/chunk.XEJS2VS5.js +0 -8
  84. package/dist/preview/chunk.Y235YZSZ.js +0 -8
  85. package/dist/preview/chunk.YU64JSAL.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as Be,b as Oe,c as qt,d as _t,f as We}from"./chunk.NOXC454O.js";import{h as Pt,i as Dt,j as Wt,k as Ft}from"./chunk.XEJS2VS5.js";import{a as Bt,b as Ot}from"./chunk.4UQLZ7VW.js";import"./chunk.DN4D4HGX.js";import"./chunk.DJ26NOOW.js";import"./chunk.SQD7ZPEJ.js";import{d as Kt}from"./chunk.LSLFKW4M.js";import{a as na}from"./chunk.IKT7JQUW.js";import{b as Lt}from"./chunk.AZG6V3PF.js";import{b as Et,i as Ht}from"./chunk.6CLHFNDM.js";import{b as Mt}from"./chunk.WGNF4E67.js";import"./chunk.R5K7NK4U.js";import{a as It}from"./chunk.L5G5DTFX.js";import{a as Rt,b as Q}from"./chunk.VRXWNUDR.js";import"./chunk.BQV62QEL.js";import{l as Nt}from"./chunk.DAKED3WK.js";import"./chunk.WWRWXFYR.js";import"./chunk.ZFUQA3KT.js";import"./chunk.DO4P2UK4.js";import"./chunk.6KJSFIO7.js";import"./chunk.FLJP3BGP.js";import"./chunk.ENMNLR73.js";import"./chunk.LZQZP2PD.js";import"./chunk.ACZGK7LQ.js";import"./chunk.AHDOKM4O.js";import"./chunk.LGUV2J6Q.js";import{Aa as ze,B as yt,E as kt,F as St,G as $t,K as he,W as zt,a as wt,ba as Ct,ca as T,ea as At,i as ht,j as ye,m as we,n as mt,o as ft,p as ke,pa as De,q as bt,qa as Tt,r as Se,ra as de,s as Ne,ua as $e,v as Pe,xa as Ee,y as xt}from"./chunk.4JSMCNF7.js";import{$ as gt,N as lt,P as xe,Q as dt,S as Me,T as Le,Va as ct,aa as pt,ab as ut,hb as vt,sb as W,ub as F}from"./chunk.Y235YZSZ.js";import{a as ae,b as E}from"./chunk.MRK6QJV5.js";import{b as w}from"./chunk.AJZBJBMO.js";var Ce=t=>`${t.saturation}% ${t.lightness}%`,Ut=t=>`${Ce(t)} / ${t.alpha}`;function la(t){let a=vt(t);return`
1
+ import{a as Be,b as Oe,c as qt,d as _t,f as We}from"./chunk.G3BOZHKR.js";import{h as Pt,i as Dt,j as Wt,k as Ft}from"./chunk.H4LHHT56.js";import{a as Bt,b as Ot}from"./chunk.EKZWX6NG.js";import"./chunk.7BAUPTMY.js";import"./chunk.TTODVIXW.js";import"./chunk.WX5CJ7PI.js";import{d as Kt}from"./chunk.C5N4RTPF.js";import{a as na}from"./chunk.IKT7JQUW.js";import{b as Lt}from"./chunk.T6KID3WO.js";import{b as Et,i as Ht}from"./chunk.6DU4XN2F.js";import{b as Mt}from"./chunk.MJ67MK4R.js";import"./chunk.US4KIJSW.js";import{a as It}from"./chunk.BYUQOV3O.js";import{a as Rt,b as Q}from"./chunk.F2KDFGHR.js";import"./chunk.B57EIGTS.js";import{l as Nt}from"./chunk.2YVXTTC2.js";import"./chunk.WWRWXFYR.js";import"./chunk.BJ2Y5F66.js";import"./chunk.A4SJ7EEY.js";import"./chunk.6KJSFIO7.js";import"./chunk.DEZEXD24.js";import"./chunk.YZZGD5OY.js";import"./chunk.DSZ3I557.js";import"./chunk.ZRVDIVYY.js";import"./chunk.AHDOKM4O.js";import"./chunk.JCZH55RX.js";import{B as yt,Ba as ze,E as kt,F as St,G as $t,K as he,W as zt,a as wt,ba as Ct,ca as T,ea as At,i as ht,j as ye,m as we,n as mt,o as ft,p as ke,pa as De,q as bt,qa as Tt,r as Se,ra as de,s as Ne,ua as $e,v as Pe,xa as Ee,y as xt}from"./chunk.2WFEFZAW.js";import{O as lt,Q as xe,R as dt,T as Me,Ta as gt,U as Le,Wa as pt,Xa as ct,fb as ut,mb as vt,xb as W,zb as F}from"./chunk.RAE4M3KQ.js";import{a as ae,b as E}from"./chunk.MRK6QJV5.js";import{b as w}from"./chunk.AJZBJBMO.js";var Ce=t=>`${t.saturation}% ${t.lightness}%`,Ut=t=>`${Ce(t)} / ${t.alpha}`;function la(t){let a=vt(t);return`
2
2
 
3
3
 
4
4
  .graview-altitude-control {
@@ -1035,6 +1035,6 @@ import{a as Be,b as Oe,c as qt,d as _t,f as We}from"./chunk.NOXC454O.js";import{
1035
1035
  }
1036
1036
  [data-graview-connector][data-graview-activity] {
1037
1037
  animation: graview-relation 1200ms cubic-bezier(0.22, 1, 0.36, 1);
1038
- }`}function Fe(t="dark",a={}){let p=la(t);return a.scope===void 0?p:Et(p,a.scope)}var K=w(ae(),1);var ge=w(E(),1);function Ke(){let{store:t}=T(),a=At(),p=(0,K.useMemo)(()=>t.graph.allEdges().length>0,[t,a]),[s,i]=(0,K.useState)(!1),v=(0,K.useId)(),b=(0,K.useRef)(null),m=(0,K.useRef)(null);return(0,K.useEffect)(()=>{if(!s)return;let x=S=>{let L=S.target;L&&(m.current?.contains(L)||b.current?.contains(L))||i(!1)};return document.addEventListener("pointerdown",x,!0),()=>document.removeEventListener("pointerdown",x,!0)},[s]),p?(0,ge.jsxs)("div",{style:{display:"contents"},onKeyDown:x=>{x.key!=="Escape"||!s||(x.preventDefault(),x.stopPropagation(),i(!1),b.current?.focus({preventScroll:!0}))},children:[(0,ge.jsx)("button",{ref:b,type:"button","data-testid":"lines-key","aria-expanded":s,"aria-controls":v,title:"What the lines mean",onClick:()=>i(x=>!x),style:{position:"absolute",top:60,right:14,zIndex:F("overview"),height:30,padding:"0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.8125rem",color:s?"var(--graview-accent)":"var(--graview-ink-muted)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Key"}),s?(0,ge.jsx)("div",{ref:m,id:v,"data-testid":"lines-key-pane","data-graview-offstage":"",style:{position:"absolute",top:98,right:14,zIndex:F("rail"),width:_t,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:(0,ge.jsx)(qt,{inside:!0})}):null]}):null}var h=w(ae(),1);var l=w(E(),1),da="A";function qe({placement:t="float"}={}){let{store:a,menuAt:p,setMenuAt:s,view:i,registerActsDoor:v}=T();(0,h.useEffect)(()=>{if(t==="menu")return v({key:da,open:e=>{let o=e.getBoundingClientRect(),r=e.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??e.closest("[data-graview-view]")?.getAttribute("data-graview-view")??void 0;s({x:Math.round(o.left+Math.min(16,o.width/2)),y:Math.round(Math.min(o.bottom,o.top+36)),...r?{on:r}:{}})}}),()=>v(null)},[t,v,s]);let b=(0,h.useRef)(null),m=(0,h.useRef)(null),x=(0,h.useRef)(null),S=e=>{let o=e.closest("[data-graview-asking]")?.getAttribute("data-graview-asking"),r=e.getAttribute("data-pin-for"),U=o??e.getAttribute("data-affordance")??(r===null?null:`pin:${r}`);m.current=U===null?null:{key:U,element:e}};(0,h.useEffect)(()=>{let e=b.current,o=m.current;if(o===null||document.activeElement!==document.body||o.element.isConnected)return;let r=o.key;if(!e){m.current=null,x.current?.focus();return}((r.startsWith("pin:")?e.querySelector(`[data-pin-for="${CSS.escape(r.slice(4))}"]`):null)??e.querySelector(`[data-affordance="${CSS.escape(r)}"]:not([disabled])`)??e).focus()});let[L,z]=(0,h.useState)(null);(0,h.useLayoutEffect)(()=>{let e=b.current?.offsetParent??b.current?.parentElement;if(e instanceof HTMLElement&&(x.current=e),!e)return;let o=e.getBoundingClientRect();z(r=>r&&r.left===o.left&&r.top===o.top&&r.width===o.width&&r.height===o.height?r:{left:o.left,top:o.top,width:o.width,height:o.height})});let{selection:c,set:C,clear:O}=De(),[$,J]=(0,h.useState)(()=>Bt()),Z=p?.on??c[c.length-1],G=(0,h.useMemo)(()=>({pins:$,...Z===void 0?{}:{focus:Z}}),[$,Z]),ne=(0,h.useMemo)(()=>new Set(a.allMutations().filter(e=>e.pinned).map(e=>e.name)),[a]),{affordances:f,withheld:P,observations:oe}=Wt(G),N=oe.some(e=>e.id.startsWith("schema:waits:")),{apply:Y,preview:D}=Ft(),[_,j]=(0,h.useState)(null),[Te,ie]=(0,h.useState)(!1),[fe,pe]=(0,h.useState)(!1),[n,d]=(0,h.useState)(""),[g,A]=(0,h.useState)(null),M=(0,h.useRef)([]),ee=(e,o)=>{try{return D(e,o),Y(e,o),A(null),s(null),M.current=[],!0}catch(r){return A(pt(a.schema,a.allMutations(),r)),M.current=r instanceof gt?r.issues.map(U=>String(U.path[0]??"")).filter(Boolean):[],!1}},B=[...new Set(c.flatMap(e=>{let o=a.graph.getNode(e);return o?[o.kind]:[]}))],V=B.length>0?B:[...new Set(c.flatMap(e=>yt(e)))],k=c.length===1?ht(c[0]):null,ce=k?{from:a.graph.getNode(k.from),to:a.graph.getNode(k.to)}:null,Je=k?(()=>{let e=a.schema.tryDefinition(a.graph.getNode(k.from)?.kind??"")?.edges?.[k.kind],o=a.graph.getNode(k.to);return e?.inverse&&o?`From ${Q(a,o.id)}: ${e.inverse}`:null})():null;(0,h.useEffect)(()=>{j(null),ie(!1),pe(!1),A(null),d("")},[c]);let y=p!==null,aa=t==="menu"&&!y,ue=(0,h.useRef)(p);ue.current=p;let Ze=Ee("acts",{open:y&&t==="menu",onOpenChange:e=>{e||s(null)},at:()=>ue.current?{x:ue.current.x,y:ue.current.y}:null,returnTo:()=>{let e=ue.current?.on;return e?document.querySelector(`[data-graview-view="${CSS.escape(e)}"]`):null},align:"start"}),et=(L?.width??Number.POSITIVE_INFINITY)<564;if((0,h.useLayoutEffect)(()=>{let e=b.current?.offsetParent;if(!e||!et||y)return;let o=b.current?.getBoundingClientRect().height??0,r=`${Math.round(o)+20}px`;if(e.style.paddingBottom===r)return;let U=e.style.paddingBottom;return e.style.paddingBottom=r,()=>{e.style.paddingBottom=U}}),c.length===0&&!y)return null;let tt=!(c.length===1&&c[0]===i.focusId),at=Math.max(1,Math.min(9,f.length)),se=[...f.filter(e=>e.provider==="invariant"&&!e.destructive),...f.filter(e=>e.pinned&&e.provider!=="invariant"&&!e.destructive),...f.filter(e=>!e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...f.filter(e=>e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...f.filter(e=>e.destructive)],rt=se.length>at&&!y,it=n.trim().toLowerCase(),te=rt&&it.length>0?se.filter(e=>`${e.label} ${e.why}`.toLowerCase().includes(it)):null,Re=te??(Te||y?se:se.slice(0,at)),nt=te?0:se.length-Re.length,be=[];for(let e of Re){let o=!y&&e.provider==="invariant",r=!y&&!o&&e.pinned!==void 0&&!e.destructive,U=!y&&!o&&!r&&e.ties===!0&&!e.destructive,st=o?e.why:r?"pinned":U?"its ties":null,ia=o?"violation":r||U?"ties":null,He=be[be.length-1];He&&He.heading===st?He.items.push(e):be.push({heading:st,tone:ia,items:[e]})}let Ie=f.find(e=>e.id===_),ve=c.length===1?Q(a,c[0]):null,ot=e=>{if(!ve)return e;let o=e.startsWith(`"${ve}"`)?e.slice(ve.length+2):e.startsWith(ve)?e.slice(ve.length):null;if(o===null)return e;let r=o.trimStart();return r.length===0?e:r[0].toUpperCase()+r.slice(1)},ra=new Set(y?[]:Re.filter(e=>e.provider==="invariant").map(e=>e.why)),le=oe.filter(e=>!ra.has(e.text)).map(e=>({...e,text:ot(e.text)}));return aa?null:(0,l.jsxs)("section",{...y?Ze.pane:{},ref:e=>{b.current=e,y&&Ze.pane.ref(e)},"aria-label":"Inspector","data-graview-offstage":"","data-testid":y?"context-menu":"inspector-strip",tabIndex:-1,onFocus:e=>S(e.target),onBlur:e=>{e.relatedTarget!==null&&(m.current=null)},onMouseDown:e=>e.stopPropagation(),style:{...y?$e:{position:"absolute",zIndex:F("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)",...y?{width:300,maxHeight:"min(52cqh, 420px)",overflow:"auto"}:et?{left:10,right:10,width:"auto",bottom:10,maxHeight:"min(42cqh, 300px)",overflow:"auto"}:{left:14,top:i.overview?"min(296px, 38cqh)":44,width:236,maxHeight:i.overview?"calc(100cqh - min(296px, 38cqh) - 20px)":"calc(68cqh - 94px)",overflow:"auto"}},children:[(0,l.jsx)("h2",{style:{...ze,margin:0},children:"Inspector"}),(0,l.jsxs)("div",{style:{display:tt||!y?"flex":"none",alignItems:"baseline",flexWrap:"wrap",gap:"2px 8px",minWidth:0,paddingRight:y?0:24},children:[tt?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("strong",{style:{fontSize:"0.9375rem",whiteSpace:"nowrap"},children:c.length===1?Q(a,c[0]):`${c.length} selected`}),B.length>0||k?(0,l.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:k?"relation":B.join(" \xB7 ")}):null,c.length===1&&!k?(0,l.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:i.expanded.includes(c[0])?"\xB7 double-click closes":"\xB7 double-click opens"}):null]}):null,(0,l.jsx)("span",{style:{flex:"1 1 auto"}})]}),y?null:(0,l.jsx)("button",{type:"button",onClick:()=>{s(null),O()},"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"}),k&&ce?(0,l.jsxs)("div",{style:{display:"grid",gap:6},children:[Je?(0,l.jsx)("p",{"data-testid":"edge-said",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:Je}):null,(0,l.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[["from",ce.from],["to",ce.to]].map(([e,o],r)=>(0,l.jsxs)(h.Fragment,{children:[r===1?(0,l.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-ink-faint)"},children:"\u2192"}):null,o?(0,l.jsx)("button",{type:"button","data-testid":`edge-${e}`,onClick:()=>C([o.id]),title:`Select ${Q(a,o.id)}`,style:{fontSize:"0.8125rem",padding:"3px 9px",borderRadius:6},children:Q(a,o.id)}):(0,l.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"gone"})]},e))})]}):null,le.length>0?(0,l.jsx)("div",{"data-testid":"observations",title:le.map(e=>e.text).join(`
1039
- `),style:{display:"grid",gap:3},children:le.slice(0,2).map(e=>(0,l.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[e.text,e===le[1]&&le.length>2?(0,l.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" +",le.length-2]}):null]},e.id))}):null,g?(0,l.jsx)("p",{"data-testid":"refused",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-warn)"},children:g}):null,rt?(0,l.jsx)("input",{"data-testid":"action-filter",value:n,onChange:e=>d(e.target.value),placeholder:`Filter ${se.length} actions\u2026`,"aria-label":"Filter actions",onKeyDown:e=>{if(e.key==="Escape"){e.stopPropagation(),n.length>0?d(""):e.currentTarget.blur();return}if(e.key==="Enter"&&te?.length===1){let o=te[0];if(o.destructive)return;o.open.length>0?j(o.id):ee(o)&&d("")}},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,te!==null&&te.length===0?(0,l.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",n.trim(),"\u201D."]}):null,f.length===0&&!N?(0,l.jsx)("p",{"data-testid":"no-affordances",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:P.length>0?`Nothing you may do with ${k?"this relation":V.length===1?Me(Le(a.schema.tryDefinition(V[0]),V[0])):"this mix of kinds"} \u2014 ${P.length} action${P.length===1?"":"s"} withheld.`:k?`Nothing can be done with this line yet \u2014 nothing this app declares makes or breaks \u201C${dt(a.schema,a.graph.getNode(k.from)?.kind??"",k.kind,"out")}\u201D.`:`Nothing can be done with ${V.length===1?Me(Le(a.schema.tryDefinition(V[0]),V[0])):"this mix of kinds"} yet \u2014 nothing this app declares acts on ${V.length===1?"it":"them"}.`}):(0,l.jsxs)("ol",{"data-testid":"affordances",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[be.map((e,o)=>(0,l.jsxs)(h.Fragment,{children:[e.heading?(0,l.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:o>0?6:0},children:[e.tone==="violation"?"\u26A0 ":"",e.tone==="violation"?ot(e.heading):e.heading]}):o>0?(0,l.jsx)("li",{"aria-hidden":"true",style:{borderTop:"1px solid var(--graview-edge)",margin:"6px 0 3px"}}):null,e.items.map(r=>(0,l.jsxs)("li",{style:{display:"flex",gap:2,alignItems:"stretch"},children:[(0,l.jsxs)("button",{type:"button","data-affordance":r.id,"data-rank":r.rank,"data-graview-destructive":r.destructive||void 0,"aria-pressed":_===r.id,title:r.why,style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:_===r.id?"var(--graview-accent)":y?"transparent":"var(--graview-edge)",background:y?"none":"var(--graview-panel)",boxShadow:"none",...r.destructive?{color:"var(--graview-warn)"}:{},..._===r.id?{color:"var(--graview-accent)"}:{}},onClick:()=>{if(r.open.length>0){j(_===r.id?null:r.id);return}ee(r)},children:[r.label,r.open.length>0?(0,l.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:" \u2026"}):null,te?.length===1&&te[0]?.id===r.id&&!r.destructive?(0,l.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}):null]}),(0,l.jsx)("button",{type:"button","data-testid":"pin-toggle","data-pin-for":r.mutation,"aria-pressed":r.pinned!==void 0,"aria-label":r.pinned!==void 0?`Unpin ${r.label}`:`Pin ${r.label}`,title:r.pinned==="declared"?"Pinned by the app \u2014 unpin it for yourself":r.pinned==="user"?"Unpin":"Pin to the top",onClick:()=>J(Ot($,r.mutation,ne.has(r.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:r.pinned==="user"?"var(--graview-accent)":r.pinned==="declared"?"var(--graview-ink-muted)":"var(--graview-ink-faint)"},children:r.pinned!==void 0?"\u2605":"\u2606"})]},r.id))]},`${e.heading??"plain"}-${o}`)),nt>0?(0,l.jsx)("li",{children:(0,l.jsxs)("button",{type:"button",onClick:()=>ie(!0),title:`Show all ${f.length} actions`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",nt," more"]})}):null]}),P.length>0?(0,l.jsxs)("ul",{"data-testid":"withheld",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[P.slice(0,y||fe?P.length:3).map(e=>(0,l.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,l.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,l.jsx)("s",{children:e.label})}),(0,l.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)),!y&&!fe&&P.length>3?(0,l.jsx)("li",{children:(0,l.jsxs)("button",{type:"button","data-testid":"withheld-more",onClick:()=>pe(!0),title:`Show all ${P.length} actions this seat may not take`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",P.length-3," more withheld"]})}):null]}):null,Ie?(0,l.jsx)(Rt,{affordance:Ie,onApply:e=>{if(ee(Ie,e))j(null);else return M.current},onCancel:()=>j(null)}):null]})}var ga=w(ae(),1);var X=w(E(),1);function _e(){let{view:t,go:a}=de(),{store:p,views:s,hiddenKinds:i}=T(),v=t.overview??!1,b=s.places().map(z=>z.kind).filter(z=>!i.has(z)),m=Lt(t,p.schema.kinds,b),x=()=>{a(ye(we(t,!1),m))},S=(()=>{if(!m)return null;let z=kt(m)[0],c=t.within?.view,C=(c?s.places().find(O=>O.as===c):void 0)??(z?s.places().find(O=>O.kind===z):void 0);return C?C.title:z?xe(p.schema,z):p.graph.getNode(m)?.label??null})(),L=v?S?`Down to ${S}`:"Down":"Up";return(0,X.jsxs)("button",{type:"button","data-testid":"overview",className:"graview-altitude-control","aria-pressed":v,"aria-label":L,title:v?`${L} \u2014 back down into the view`:"Up \u2014 the whole thing, from above",onClick:()=>v?x():a(we(t,!0)),style:{position:"absolute",top:14,right:14,zIndex:F("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,X.jsxs)("svg",{className:"graview-altitude-mark",width:"16",height:"16",viewBox:"0 0 12 12","aria-hidden":"true",children:[(0,X.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,X.jsx)("circle",{className:"graview-altitude-mark-apex",cx:"6",cy:"4",r:"1.5",fill:"currentColor"}),(0,X.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"left",cx:"1.6",cy:"7.4",r:"1.2",fill:"currentColor"}),(0,X.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"right",cx:"10.4",cy:"7.4",r:"1.2",fill:"currentColor"})]}),(0,X.jsx)("span",{className:"graview-altitude-label",children:L})]})}var Ue=w(E(),1);function Ge(){let{administered:t}=T(),{view:a,go:p}=de(),s=t.filter(i=>i.canShow);return s.length===0?null:(0,Ue.jsx)("div",{role:"group","aria-label":"Administered","data-testid":"administered",style:{display:"flex",gap:6},children:s.map(i=>(0,Ue.jsx)("button",{type:"button","aria-pressed":i.shown,"data-testid":`show-${i.name}`,title:i.shown?`Hide the ${i.name}'s own districts again`:i.description??`Show the ${i.name}'s own districts beside the domain`,onClick:()=>p(mt(a,i.name,!i.shown)),style:{padding:"3px 11px",borderRadius:999,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:i.shown?"var(--graview-accent)":"var(--graview-edge)",color:i.shown?"var(--graview-accent)":"var(--graview-ink-muted)",background:i.shown?"var(--graview-panel)":"transparent"},children:i.shown?`Hide the ${i.name}`:`Show the ${i.name}`},i.name))})}var R=w(ae(),1);var u=w(E(),1),pa=t=>t.about==="rule"?"rule:":t.about==="act"?"act:":t.kind;function Vt({compact:t=!1}){let{store:a,view:p,setView:s,principal:i,setMenuAt:v,brand:b,seatTalk:m}=T(),x=zt(m),S=Ct(),L=Tt(),z=Nt().marks.flag,c=(0,R.useRef)(null),C=(0,R.useId)(),[O,$]=(0,R.useState)(!1),[J,Z]=(0,R.useState)(null),[G,ne]=(0,R.useState)(null),f=p.q??"";(0,R.useEffect)(()=>{let n=d=>{if(d.defaultPrevented)return;let g=d.key.toLowerCase()==="k"&&(d.metaKey||d.ctrlKey)&&!d.altKey&&!d.shiftKey,A=d.key==="/"&&!d.metaKey&&!d.ctrlKey&&!d.altKey;if(!g&&!A)return;let M=c.current;if(!M)return;let ee=M.closest("[data-graview-embed]"),B=d.target,V=B===document.body||B===document.documentElement||B===window;if(ee&&!(g&&V||B instanceof Node&&ee.contains(B)))return;let k=document.activeElement,ce=k instanceof HTMLInputElement||k instanceof HTMLTextAreaElement||k instanceof HTMLSelectElement||k instanceof HTMLElement&&k.isContentEditable;A&&ce||(d.preventDefault(),M.getClientRects().length===0&&M.closest("[data-graview-app-bar]")?.querySelector('[data-testid="app-find-open"]')?.click(),M.focus({preventScroll:!0}),M.select(),$(!0))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[]);let P=(0,R.useMemo)(()=>G&&f.trim()?ct(a,G,S?.words??f,{principal:i,limit:4}):[],[a,f,S,G,i]),oe=(0,R.useMemo)(()=>{let n=new Map;for(let[d,g]of(S?.hits??[]).entries()){if(g.about==="act")continue;let A=pa(g),M=n.get(A)??[];if(M.push({id:`${C}-${d}`,hit:g}),n.set(A,M),g.about==="node"&&g.id===G)for(let[ee,B]of P.entries())M.push({id:`${C}-${d}-act-${ee}`,hit:B})}return[...n.entries()]},[S,P,G,C]),N=x.drawn>0&&f.trim()?{id:`${C}-ask`,ask:f.trim()}:null,Y=(0,R.useMemo)(()=>[...oe.flatMap(([,n])=>n),...N?[N]:[]],[oe,N?.ask]),D=Y.find(n=>n.id===J)??Y[0];(0,R.useEffect)(()=>{Z(null),ne(null)},[f]);let _=n=>{if(n){if(Z(n.id),"ask"in n){ne(null);return}n.hit.about==="node"?ne(n.hit.id):n.hit.about!=="act"&&ne(null)}},j=n=>{if(!n)return;if("ask"in n){m.ask(n.ask),s(g=>ke(g)),$(!1);return}let d=n.hit;switch(d.about){case"node":s(g=>Se(ye(we(g,!1),d.id),[d.id]));break;case"kind":s(g=>St(g,xt(d.kind),{ownPicture:!0,...g.q?{carry:g.q}:{}}));break;case"place":s(g=>$t(g,d.kind,d.as));break;case"rule":{let g=L.filter(A=>A.invariant===d.name).flatMap(A=>A.nodeIds);s(A=>Se(A,[...new Set(g)]));break}case"act":{s(A=>Se(A,[d.subject]));let g=c.current?.getBoundingClientRect();v({x:g?.left??0,y:(g?.bottom??0)+6,on:d.subject});break}}$(!1),c.current?.blur()},Te=S?va(S.byKind,S.hits,a.schema):"",ie=O&&f.trim().length>0,fe=(0,R.useCallback)(()=>{let n=c.current?.closest("[data-graview-app-bar]")?.getBoundingClientRect();if(n)return{x:n.right,y:n.bottom-wa};let d=c.current?.getBoundingClientRect();return d?{x:d.right,y:d.bottom}:null},[]),pe=Ee("find",{open:ie,onOpenChange:n=>{n||$(!1)},...t?{at:fe}:{}});return(0,u.jsxs)("div",{style:{position:"relative",minWidth:0,flex:"1 1 auto"},"data-testid":"find",children:[(0,u.jsx)("input",{ref:n=>{c.current=n,pe.trigger.ref(n)},"data-graview-popover-trigger":"find",type:"search",role:"combobox","aria-label":"Find anything","aria-expanded":ie,"aria-controls":C,"aria-autocomplete":"list",...ie&&D?{"aria-activedescendant":D.id}:{},"data-testid":"find-box",placeholder:"Find\u2026","aria-keyshortcuts":"/ Meta+K Control+K",value:f,onChange:n=>{let d=n.target.value;$(!0),s(g=>ft(g,d.length>0?d:null))},onFocus:()=>$(!0),onBlur:()=>$(!1),onKeyDown:n=>{let d=J!==null&&D?Y.indexOf(D):-1;n.key==="ArrowDown"?(n.preventDefault(),$(!0),_(Y[Math.min(Y.length-1,d+1)])):n.key==="ArrowUp"?(n.preventDefault(),_(Y[Math.max(0,d-1)])):n.key==="Enter"?(n.preventDefault(),j(D)):n.key==="Escape"&&(n.preventDefault(),f?s(g=>ke(g)):c.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 ${f?"var(--graview-accent)":"var(--graview-edge)"}`,borderRadius:8}}),(0,u.jsx)("span",{role:"status","aria-live":"polite",style:ze,"data-testid":"find-count",children:f.trim()?Te:""}),(0,u.jsxs)("div",{...pe.pane,id:C,role:"listbox","aria-label":f?`What \u201C${f}\u201D finds`:"What the words find","data-testid":"find-strip",hidden:!ie,onMouseDown:n=>n.preventDefault(),style:t?{...Yt,...ha}:Yt,children:[Y.every(n=>"ask"in n)?(0,u.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",S?.words||f,"\u201D."]}):oe.map(([n,d])=>(0,u.jsxs)("div",{role:"group","aria-label":Gt(n,a.schema),children:[(0,u.jsxs)("div",{role:"presentation",style:ma,children:[n!=="rule:"?(0,u.jsx)(ua,{kind:n,accents:b?.accents}):null,Gt(n,a.schema)]}),d.map(g=>(0,u.jsx)("div",{id:g.id,role:"option","aria-selected":g===D,"data-testid":"find-hit","data-about":g.hit.about,onMouseEnter:()=>_(g),onClick:()=>j(g),style:{...jt,...g.hit.about==="act"?{paddingLeft:30}:{},background:g===D?"var(--graview-panel-muted)":"transparent"},children:(0,u.jsx)(ca,{hit:g.hit,flag:z})},g.id))]},n)),N?(0,u.jsx)("div",{id:N.id,role:"option","aria-selected":N===D||D?.id===N.id,"data-testid":"find-ask",onMouseEnter:()=>_(N),onClick:()=>j(N),style:{...jt,borderTop:"1px solid var(--graview-edge)",marginTop:4,background:D?.id===N.id?"var(--graview-panel-muted)":"transparent"},children:(0,u.jsxs)("span",{children:["Ask: ",(0,u.jsxs)("span",{style:{fontWeight:600},children:["\u2018",N.ask,"\u2019"]})]})}):null,S&&S.searched.past===!1&&S.searched.kinds.some(n=>a.schema.tryDefinition(n)?.lifecycle)?(0,u.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 ca({hit:t,flag:a}){switch(t.about){case"node":return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("span",{style:{fontWeight:600,overflowWrap:"anywhere"},children:[t.flagged?(0,u.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[a," "]}):null,t.label,t.apart?(0,u.jsxs)("span",{style:me,children:[" \xB7 ",t.apart]}):null,t.current?null:(0,u.jsx)("span",{style:me,children:" \xB7 past"})]}),t.why.field!=="label"?(0,u.jsxs)("span",{style:me,children:[t.why.reading.toLowerCase(),": ",t.why.fragment]}):null]});case"kind":return(0,u.jsxs)("span",{children:[t.label,(0,u.jsxs)("span",{style:me,children:[" \xB7 ",t.count," match"]})]});case"place":return(0,u.jsxs)("span",{children:["Go to ",t.title]});case"rule":return(0,u.jsxs)("span",{children:["The rule \u201C",t.label,"\u201D"]});case"act":return(0,u.jsxs)("span",{style:t.destructive?{color:"var(--graview-warn)"}:void 0,children:[t.title,(0,u.jsxs)("span",{style:me,children:[" \xB7 ",t.why.field==="title"?"act":`on ${t.why.fragment}`]})]})}}function ua({kind:t,accents:a}){let p=Math.round(ut(t,a));return(0,u.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:2,flex:"0 0 auto",background:`hsl(${p} 55% 52%)`}})}function Gt(t,a){return t==="rule:"?"Rules":t==="act:"?"Acts":a.tryDefinition(t)?.plural??`${t}s`}function va(t,a,p){let s=Object.entries(t).map(([v,b])=>lt(p,v,b)),i=a.filter(v=>v.about==="kind"||v.about==="place"||v.about==="rule").length;return i>0&&s.push(`${i} ${i===1?"place or rule":"places and rules"}`),s.length===0?"Nothing found":`${s.join(", ")} found`}var Yt={...$e,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"},wa=6,ha={width:"var(--graview-bar-width, 100vw)",maxHeight:"55vh",borderRadius:0,borderLeft:"none",borderRight:"none"},ma={display:"flex",alignItems:"center",gap:6,padding:"8px 12px 2px",fontSize:"0.6875rem",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},jt={display:"grid",gap:1,minHeight:32,padding:"5px 12px",alignContent:"center",cursor:"pointer",fontSize:"0.875rem",lineHeight:1.35,color:"var(--graview-ink)"},me={color:"var(--graview-ink-muted)",fontSize:"0.8125rem",fontWeight:400};var Ae=w(ae(),1),Ye=w(na(),1);var Xt=w(E(),1);function Qt(){let{following:t,follow:a}=T();return t?(0,Xt.jsxs)("button",{type:"button","data-testid":"following-who",onClick:()=>a(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 ",t.name]}):null}var Jt=w(ae(),1);var I=w(E(),1);function Zt({home:t,homeLabel:a,children:p,onPicture:s=!1}){let{view:i,focus:v,show:b,go:m}=de(),{store:x}=T(),{movedByHand:S}=T(),L=S&&(i.pan!==void 0||Object.keys(i.pins).length>0),z=i.focusId&&i.focusId!==t?x.graph.getNode(i.focusId):void 0,c=J=>xe(x.schema,J),C={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"},O=a!==void 0&&z!==void 0,$=[];return z&&!s&&$.push({key:"focused",node:(0,I.jsxs)("button",{type:"button","data-testid":"focused",onClick:()=>m(Ne({...i,focusId:t},!1)),title:Q(x,z.id),style:{...C,maxWidth:"min(14rem, 15vw)"},children:[(0,I.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:Q(x,z.id)}),(0,I.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),i.past&&$.push({key:"past",node:(0,I.jsxs)("button",{type:"button","data-testid":"past",onClick:()=>m(bt(i,!1)),title:"Back to now \u2014 retired things leave the picture again",style:C,children:["the past",(0,I.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),i.zoom&&$.push({key:"zoomed",node:(0,I.jsxs)("button",{type:"button","data-testid":"zoomed",onClick:()=>m(Ne(i,!1)),title:"Zoom back out",style:C,children:["zoomed in",(0,I.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),L&&$.push({key:"moved",node:(0,I.jsxs)("button",{type:"button","data-testid":"moved",onClick:()=>m(Pe(i)),title:"Put the camera and everything you dragged back where the layout wanted them",style:C,children:["moved",(0,I.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),i.relation&&$.push({key:"raised",node:(0,I.jsxs)("button",{type:"button","data-testid":"raised",onClick:()=>b(null),title:`Stop showing ${c(i.relation)}`,style:C,children:[c(i.relation),(0,I.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),s&&!O&&$.length===0&&p===void 0?null:(0,I.jsxs)("nav",{"aria-label":"View","data-testid":"trail",style:{display:"flex",alignItems:"center",gap:8,fontSize:"0.875rem",minWidth:0,...s?{pointerEvents:"auto",padding:"4px 6px",borderRadius:8,background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",overflow:"hidden"}:{}},children:[O?(0,I.jsx)("button",{type:"button",onClick:()=>v(t),style:{border:"none",background:"none",padding:"3px 0",minHeight:24,whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:a}):null,$.map(({key:J,node:Z},G)=>(0,I.jsxs)(Jt.Fragment,{children:[O||G>0?(0,I.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:"\u203A"}):null,Z]},J)),p]})}var q=w(E(),1);function je(){let[t,a]=(0,Ae.useState)([]),p=(0,Ae.useCallback)(s=>{a(i=>{let v=s.phase!=="running"&&i[0]?.name===s.name&&i[0]?.at===s.at;return[s,...v?i.slice(1):i].slice(0,12)})},[]);return[t,p]}function Ve({find:t,calls:a,seat:p,remembers:s=!1}){return t?(0,q.jsxs)(q.Fragment,{children:[(0,Ye.createPortal)((0,q.jsx)(Vt,{compact:t.compact}),t.slot),t.own?(0,Ye.createPortal)((0,q.jsx)(It,{calls:a,remembers:s,...p!==void 0?{seat:p}:{}}),t.own):null]}):null}function Qe({home:t=null}){return(0,q.jsxs)("div",{"data-graview-scene-trail":"",style:{position:"absolute",top:14,left:14,maxWidth:"calc(100% - 150px)",zIndex:F("overview"),display:"flex",alignItems:"center",gap:6,minWidth:0,pointerEvents:"none"},children:[(0,q.jsx)(Zt,{home:t,onPicture:!0}),(0,q.jsx)("span",{style:{pointerEvents:"auto"},children:(0,q.jsx)(Qt,{})})]})}var re=w(ae(),1);var ea=w(E(),1),fa=wt(()=>import("./chunk.YSYT3ASK.js"));function Xe(){let{store:t,principal:a}=T(),p=(0,re.useContext)(Mt),s=(0,re.useRef)(null),i=(0,re.useRef)(!1);return(0,re.useEffect)(()=>()=>void(i.current=!0),[]),(0,re.useEffect)(()=>{let v=t.batches().length,b=fa().then(m=>m.sceneWay(t,a,p,v,s.current),()=>{});return()=>void b.then(m=>m?.(i.current))},[t,a,p]),(0,ea.jsx)("span",{ref:s,hidden:!0})}var ta=w(ae(),1);var H=w(E(),1);function Ir({address:t=!1,auto:a,seat:p,scheme:s,scope:i}){let v=(0,ta.useMemo)(()=>`${We({scope:`.${i}`})}
1038
+ }`}function Fe(t="dark",a={}){let p=la(t);return a.scope===void 0?p:Et(p,a.scope)}var K=w(ae(),1);var ge=w(E(),1);function Ke(){let{store:t}=T(),a=At(),p=(0,K.useMemo)(()=>t.graph.allEdges().length>0,[t,a]),[s,i]=(0,K.useState)(!1),v=(0,K.useId)(),b=(0,K.useRef)(null),m=(0,K.useRef)(null);return(0,K.useEffect)(()=>{if(!s)return;let x=S=>{let L=S.target;L&&(m.current?.contains(L)||b.current?.contains(L))||i(!1)};return document.addEventListener("pointerdown",x,!0),()=>document.removeEventListener("pointerdown",x,!0)},[s]),p?(0,ge.jsxs)("div",{style:{display:"contents"},onKeyDown:x=>{x.key!=="Escape"||!s||(x.preventDefault(),x.stopPropagation(),i(!1),b.current?.focus({preventScroll:!0}))},children:[(0,ge.jsx)("button",{ref:b,type:"button","data-testid":"lines-key","aria-expanded":s,"aria-controls":v,title:"What the lines mean",onClick:()=>i(x=>!x),style:{position:"absolute",top:60,right:14,zIndex:F("overview"),height:30,padding:"0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.8125rem",color:s?"var(--graview-accent)":"var(--graview-ink-muted)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Key"}),s?(0,ge.jsx)("div",{ref:m,id:v,"data-testid":"lines-key-pane","data-graview-offstage":"",style:{position:"absolute",top:98,right:14,zIndex:F("rail"),width:_t,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:(0,ge.jsx)(qt,{inside:!0})}):null]}):null}var h=w(ae(),1);var l=w(E(),1),da="A";function qe({placement:t="float"}={}){let{store:a,menuAt:p,setMenuAt:s,view:i,registerActsDoor:v}=T();(0,h.useEffect)(()=>{if(t==="menu")return v({key:da,open:e=>{let o=e.getBoundingClientRect(),r=e.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??e.closest("[data-graview-view]")?.getAttribute("data-graview-view")??void 0;s({x:Math.round(o.left+Math.min(16,o.width/2)),y:Math.round(Math.min(o.bottom,o.top+36)),...r?{on:r}:{}})}}),()=>v(null)},[t,v,s]);let b=(0,h.useRef)(null),m=(0,h.useRef)(null),x=(0,h.useRef)(null),S=e=>{let o=e.closest("[data-graview-asking]")?.getAttribute("data-graview-asking"),r=e.getAttribute("data-pin-for"),U=o??e.getAttribute("data-affordance")??(r===null?null:`pin:${r}`);m.current=U===null?null:{key:U,element:e}};(0,h.useEffect)(()=>{let e=b.current,o=m.current;if(o===null||document.activeElement!==document.body||o.element.isConnected)return;let r=o.key;if(!e){m.current=null,x.current?.focus();return}((r.startsWith("pin:")?e.querySelector(`[data-pin-for="${CSS.escape(r.slice(4))}"]`):null)??e.querySelector(`[data-affordance="${CSS.escape(r)}"]:not([disabled])`)??e).focus()});let[L,z]=(0,h.useState)(null);(0,h.useLayoutEffect)(()=>{let e=b.current?.offsetParent??b.current?.parentElement;if(e instanceof HTMLElement&&(x.current=e),!e)return;let o=e.getBoundingClientRect();z(r=>r&&r.left===o.left&&r.top===o.top&&r.width===o.width&&r.height===o.height?r:{left:o.left,top:o.top,width:o.width,height:o.height})});let{selection:c,set:C,clear:O}=De(),[$,J]=(0,h.useState)(()=>Bt()),Z=p?.on??c[c.length-1],G=(0,h.useMemo)(()=>({pins:$,...Z===void 0?{}:{focus:Z}}),[$,Z]),ne=(0,h.useMemo)(()=>new Set(a.allMutations().filter(e=>e.pinned).map(e=>e.name)),[a]),{affordances:f,withheld:P,observations:oe}=Wt(G),N=oe.some(e=>e.id.startsWith("schema:waits:")),{apply:Y,preview:D}=Ft(),[_,j]=(0,h.useState)(null),[Te,ie]=(0,h.useState)(!1),[fe,pe]=(0,h.useState)(!1),[n,d]=(0,h.useState)(""),[g,A]=(0,h.useState)(null),M=(0,h.useRef)([]),ee=(e,o)=>{try{return D(e,o),Y(e,o),A(null),s(null),M.current=[],!0}catch(r){return A(ct(a.schema,a.allMutations(),r)),M.current=r instanceof pt?r.issues.map(U=>String(U.path[0]??"")).filter(Boolean):[],!1}},B=[...new Set(c.flatMap(e=>{let o=a.graph.getNode(e);return o?[o.kind]:[]}))],V=B.length>0?B:[...new Set(c.flatMap(e=>yt(e)))],k=c.length===1?ht(c[0]):null,ce=k?{from:a.graph.getNode(k.from),to:a.graph.getNode(k.to)}:null,Je=k?(()=>{let e=a.schema.tryDefinition(a.graph.getNode(k.from)?.kind??"")?.edges?.[k.kind],o=a.graph.getNode(k.to);return e?.inverse&&o?`From ${Q(a,o.id)}: ${e.inverse}`:null})():null;(0,h.useEffect)(()=>{j(null),ie(!1),pe(!1),A(null),d("")},[c]);let y=p!==null,aa=t==="menu"&&!y,ue=(0,h.useRef)(p);ue.current=p;let Ze=Ee("acts",{open:y&&t==="menu",onOpenChange:e=>{e||s(null)},at:()=>ue.current?{x:ue.current.x,y:ue.current.y}:null,returnTo:()=>{let e=ue.current?.on;return e?document.querySelector(`[data-graview-view="${CSS.escape(e)}"]`):null},align:"start"}),et=(L?.width??Number.POSITIVE_INFINITY)<564;if((0,h.useLayoutEffect)(()=>{let e=b.current?.offsetParent;if(!e||!et||y)return;let o=b.current?.getBoundingClientRect().height??0,r=`${Math.round(o)+20}px`;if(e.style.paddingBottom===r)return;let U=e.style.paddingBottom;return e.style.paddingBottom=r,()=>{e.style.paddingBottom=U}}),c.length===0&&!y)return null;let tt=!(c.length===1&&c[0]===i.focusId),at=Math.max(1,Math.min(9,f.length)),se=[...f.filter(e=>e.provider==="invariant"&&!e.destructive),...f.filter(e=>e.pinned&&e.provider!=="invariant"&&!e.destructive),...f.filter(e=>!e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...f.filter(e=>e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...f.filter(e=>e.destructive)],rt=se.length>at&&!y,it=n.trim().toLowerCase(),te=rt&&it.length>0?se.filter(e=>`${e.label} ${e.why}`.toLowerCase().includes(it)):null,Re=te??(Te||y?se:se.slice(0,at)),nt=te?0:se.length-Re.length,be=[];for(let e of Re){let o=!y&&e.provider==="invariant",r=!y&&!o&&e.pinned!==void 0&&!e.destructive,U=!y&&!o&&!r&&e.ties===!0&&!e.destructive,st=o?e.why:r?"pinned":U?"its ties":null,ia=o?"violation":r||U?"ties":null,He=be[be.length-1];He&&He.heading===st?He.items.push(e):be.push({heading:st,tone:ia,items:[e]})}let Ie=f.find(e=>e.id===_),ve=c.length===1?Q(a,c[0]):null,ot=e=>{if(!ve)return e;let o=e.startsWith(`"${ve}"`)?e.slice(ve.length+2):e.startsWith(ve)?e.slice(ve.length):null;if(o===null)return e;let r=o.trimStart();return r.length===0?e:r[0].toUpperCase()+r.slice(1)},ra=new Set(y?[]:Re.filter(e=>e.provider==="invariant").map(e=>e.why)),le=oe.filter(e=>!ra.has(e.text)).map(e=>({...e,text:ot(e.text)}));return aa?null:(0,l.jsxs)("section",{...y?Ze.pane:{},ref:e=>{b.current=e,y&&Ze.pane.ref(e)},"aria-label":"Inspector","data-graview-offstage":"","data-testid":y?"context-menu":"inspector-strip",tabIndex:-1,onFocus:e=>S(e.target),onBlur:e=>{e.relatedTarget!==null&&(m.current=null)},onMouseDown:e=>e.stopPropagation(),style:{...y?$e:{position:"absolute",zIndex:F("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)",...y?{width:300,maxHeight:"min(52cqh, 420px)",overflow:"auto"}:et?{left:10,right:10,width:"auto",bottom:10,maxHeight:"min(42cqh, 300px)",overflow:"auto"}:{left:14,top:i.overview?"min(296px, 38cqh)":44,width:236,maxHeight:i.overview?"calc(100cqh - min(296px, 38cqh) - 20px)":"calc(68cqh - 94px)",overflow:"auto"}},children:[(0,l.jsx)("h2",{style:{...ze,margin:0},children:"Inspector"}),(0,l.jsxs)("div",{style:{display:tt||!y?"flex":"none",alignItems:"baseline",flexWrap:"wrap",gap:"2px 8px",minWidth:0,paddingRight:y?0:24},children:[tt?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("strong",{style:{fontSize:"0.9375rem",whiteSpace:"nowrap"},children:c.length===1?Q(a,c[0]):`${c.length} selected`}),B.length>0||k?(0,l.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:k?"relation":B.join(" \xB7 ")}):null,c.length===1&&!k?(0,l.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:i.expanded.includes(c[0])?"\xB7 double-click closes":"\xB7 double-click opens"}):null]}):null,(0,l.jsx)("span",{style:{flex:"1 1 auto"}})]}),y?null:(0,l.jsx)("button",{type:"button",onClick:()=>{s(null),O()},"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"}),k&&ce?(0,l.jsxs)("div",{style:{display:"grid",gap:6},children:[Je?(0,l.jsx)("p",{"data-testid":"edge-said",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:Je}):null,(0,l.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[["from",ce.from],["to",ce.to]].map(([e,o],r)=>(0,l.jsxs)(h.Fragment,{children:[r===1?(0,l.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-ink-faint)"},children:"\u2192"}):null,o?(0,l.jsx)("button",{type:"button","data-testid":`edge-${e}`,onClick:()=>C([o.id]),title:`Select ${Q(a,o.id)}`,style:{fontSize:"0.8125rem",padding:"3px 9px",borderRadius:6},children:Q(a,o.id)}):(0,l.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"gone"})]},e))})]}):null,le.length>0?(0,l.jsx)("div",{"data-testid":"observations",title:le.map(e=>e.text).join(`
1039
+ `),style:{display:"grid",gap:3},children:le.slice(0,2).map(e=>(0,l.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[e.text,e===le[1]&&le.length>2?(0,l.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" +",le.length-2]}):null]},e.id))}):null,g?(0,l.jsx)("p",{"data-testid":"refused",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-warn)"},children:g}):null,rt?(0,l.jsx)("input",{"data-testid":"action-filter",value:n,onChange:e=>d(e.target.value),placeholder:`Filter ${se.length} actions\u2026`,"aria-label":"Filter actions",onKeyDown:e=>{if(e.key==="Escape"){e.stopPropagation(),n.length>0?d(""):e.currentTarget.blur();return}if(e.key==="Enter"&&te?.length===1){let o=te[0];if(o.destructive)return;o.open.length>0?j(o.id):ee(o)&&d("")}},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,te!==null&&te.length===0?(0,l.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",n.trim(),"\u201D."]}):null,f.length===0&&!N?(0,l.jsx)("p",{"data-testid":"no-affordances",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:P.length>0?`Nothing you may do with ${k?"this relation":V.length===1?Me(Le(a.schema.tryDefinition(V[0]),V[0])):"this mix of kinds"} \u2014 ${P.length} action${P.length===1?"":"s"} withheld.`:k?`Nothing can be done with this line yet \u2014 nothing this app declares makes or breaks \u201C${dt(a.schema,a.graph.getNode(k.from)?.kind??"",k.kind,"out")}\u201D.`:`Nothing can be done with ${V.length===1?Me(Le(a.schema.tryDefinition(V[0]),V[0])):"this mix of kinds"} yet \u2014 nothing this app declares acts on ${V.length===1?"it":"them"}.`}):(0,l.jsxs)("ol",{"data-testid":"affordances",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[be.map((e,o)=>(0,l.jsxs)(h.Fragment,{children:[e.heading?(0,l.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:o>0?6:0},children:[e.tone==="violation"?"\u26A0 ":"",e.tone==="violation"?ot(e.heading):e.heading]}):o>0?(0,l.jsx)("li",{"aria-hidden":"true",style:{borderTop:"1px solid var(--graview-edge)",margin:"6px 0 3px"}}):null,e.items.map(r=>(0,l.jsxs)("li",{style:{display:"flex",gap:2,alignItems:"stretch"},children:[(0,l.jsxs)("button",{type:"button","data-affordance":r.id,"data-rank":r.rank,"data-graview-destructive":r.destructive||void 0,"aria-pressed":_===r.id,title:r.why,style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:_===r.id?"var(--graview-accent)":y?"transparent":"var(--graview-edge)",background:y?"none":"var(--graview-panel)",boxShadow:"none",...r.destructive?{color:"var(--graview-warn)"}:{},..._===r.id?{color:"var(--graview-accent)"}:{}},onClick:()=>{if(r.open.length>0){j(_===r.id?null:r.id);return}ee(r)},children:[r.label,r.open.length>0?(0,l.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:" \u2026"}):null,te?.length===1&&te[0]?.id===r.id&&!r.destructive?(0,l.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}):null]}),(0,l.jsx)("button",{type:"button","data-testid":"pin-toggle","data-pin-for":r.mutation,"aria-pressed":r.pinned!==void 0,"aria-label":r.pinned!==void 0?`Unpin ${r.label}`:`Pin ${r.label}`,title:r.pinned==="declared"?"Pinned by the app \u2014 unpin it for yourself":r.pinned==="user"?"Unpin":"Pin to the top",onClick:()=>J(Ot($,r.mutation,ne.has(r.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:r.pinned==="user"?"var(--graview-accent)":r.pinned==="declared"?"var(--graview-ink-muted)":"var(--graview-ink-faint)"},children:r.pinned!==void 0?"\u2605":"\u2606"})]},r.id))]},`${e.heading??"plain"}-${o}`)),nt>0?(0,l.jsx)("li",{children:(0,l.jsxs)("button",{type:"button",onClick:()=>ie(!0),title:`Show all ${f.length} actions`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",nt," more"]})}):null]}),P.length>0?(0,l.jsxs)("ul",{"data-testid":"withheld",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[P.slice(0,y||fe?P.length:3).map(e=>(0,l.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,l.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,l.jsx)("s",{children:e.label})}),(0,l.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)),!y&&!fe&&P.length>3?(0,l.jsx)("li",{children:(0,l.jsxs)("button",{type:"button","data-testid":"withheld-more",onClick:()=>pe(!0),title:`Show all ${P.length} actions this seat may not take`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",P.length-3," more withheld"]})}):null]}):null,Ie?(0,l.jsx)(Rt,{affordance:Ie,onApply:e=>{if(ee(Ie,e))j(null);else return M.current},onCancel:()=>j(null)}):null]})}var ga=w(ae(),1);var X=w(E(),1);function _e(){let{view:t,go:a}=de(),{store:p,views:s,hiddenKinds:i}=T(),v=t.overview??!1,b=s.places().map(z=>z.kind).filter(z=>!i.has(z)),m=Lt(t,p.schema.kinds,b),x=()=>{a(ye(we(t,!1),m))},S=(()=>{if(!m)return null;let z=kt(m)[0],c=t.within?.view,C=(c?s.places().find(O=>O.as===c):void 0)??(z?s.places().find(O=>O.kind===z):void 0);return C?C.title:z?xe(p.schema,z):p.graph.getNode(m)?.label??null})(),L=v?S?`Down to ${S}`:"Down":"Up";return(0,X.jsxs)("button",{type:"button","data-testid":"overview",className:"graview-altitude-control","aria-pressed":v,"aria-label":L,title:v?`${L} \u2014 back down into the view`:"Up \u2014 the whole thing, from above",onClick:()=>v?x():a(we(t,!0)),style:{position:"absolute",top:14,right:14,zIndex:F("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,X.jsxs)("svg",{className:"graview-altitude-mark",width:"16",height:"16",viewBox:"0 0 12 12","aria-hidden":"true",children:[(0,X.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,X.jsx)("circle",{className:"graview-altitude-mark-apex",cx:"6",cy:"4",r:"1.5",fill:"currentColor"}),(0,X.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"left",cx:"1.6",cy:"7.4",r:"1.2",fill:"currentColor"}),(0,X.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"right",cx:"10.4",cy:"7.4",r:"1.2",fill:"currentColor"})]}),(0,X.jsx)("span",{className:"graview-altitude-label",children:L})]})}var Ue=w(E(),1);function Ge(){let{administered:t}=T(),{view:a,go:p}=de(),s=t.filter(i=>i.canShow);return s.length===0?null:(0,Ue.jsx)("div",{role:"group","aria-label":"Administered","data-testid":"administered",style:{display:"flex",gap:6},children:s.map(i=>(0,Ue.jsx)("button",{type:"button","aria-pressed":i.shown,"data-testid":`show-${i.name}`,title:i.shown?`Hide the ${i.name}'s own districts again`:i.description??`Show the ${i.name}'s own districts beside the domain`,onClick:()=>p(mt(a,i.name,!i.shown)),style:{padding:"3px 11px",borderRadius:999,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:i.shown?"var(--graview-accent)":"var(--graview-edge)",color:i.shown?"var(--graview-accent)":"var(--graview-ink-muted)",background:i.shown?"var(--graview-panel)":"transparent"},children:i.shown?`Hide the ${i.name}`:`Show the ${i.name}`},i.name))})}var R=w(ae(),1);var u=w(E(),1),pa=t=>t.about==="rule"?"rule:":t.about==="act"?"act:":t.kind;function Vt({compact:t=!1}){let{store:a,view:p,setView:s,principal:i,setMenuAt:v,brand:b,seatTalk:m}=T(),x=zt(m),S=Ct(),L=Tt(),z=Nt().marks.flag,c=(0,R.useRef)(null),C=(0,R.useId)(),[O,$]=(0,R.useState)(!1),[J,Z]=(0,R.useState)(null),[G,ne]=(0,R.useState)(null),f=p.q??"";(0,R.useEffect)(()=>{let n=d=>{if(d.defaultPrevented)return;let g=d.key.toLowerCase()==="k"&&(d.metaKey||d.ctrlKey)&&!d.altKey&&!d.shiftKey,A=d.key==="/"&&!d.metaKey&&!d.ctrlKey&&!d.altKey;if(!g&&!A)return;let M=c.current;if(!M)return;let ee=M.closest("[data-graview-embed]"),B=d.target,V=B===document.body||B===document.documentElement||B===window;if(ee&&!(g&&V||B instanceof Node&&ee.contains(B)))return;let k=document.activeElement,ce=k instanceof HTMLInputElement||k instanceof HTMLTextAreaElement||k instanceof HTMLSelectElement||k instanceof HTMLElement&&k.isContentEditable;A&&ce||(d.preventDefault(),M.getClientRects().length===0&&M.closest("[data-graview-app-bar]")?.querySelector('[data-testid="app-find-open"]')?.click(),M.focus({preventScroll:!0}),M.select(),$(!0))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[]);let P=(0,R.useMemo)(()=>G&&f.trim()?gt(a,G,S?.words??f,{principal:i,limit:4}):[],[a,f,S,G,i]),oe=(0,R.useMemo)(()=>{let n=new Map;for(let[d,g]of(S?.hits??[]).entries()){if(g.about==="act")continue;let A=pa(g),M=n.get(A)??[];if(M.push({id:`${C}-${d}`,hit:g}),n.set(A,M),g.about==="node"&&g.id===G)for(let[ee,B]of P.entries())M.push({id:`${C}-${d}-act-${ee}`,hit:B})}return[...n.entries()]},[S,P,G,C]),N=x.drawn>0&&f.trim()?{id:`${C}-ask`,ask:f.trim()}:null,Y=(0,R.useMemo)(()=>[...oe.flatMap(([,n])=>n),...N?[N]:[]],[oe,N?.ask]),D=Y.find(n=>n.id===J)??Y[0];(0,R.useEffect)(()=>{Z(null),ne(null)},[f]);let _=n=>{if(n){if(Z(n.id),"ask"in n){ne(null);return}n.hit.about==="node"?ne(n.hit.id):n.hit.about!=="act"&&ne(null)}},j=n=>{if(!n)return;if("ask"in n){m.ask(n.ask),s(g=>ke(g)),$(!1);return}let d=n.hit;switch(d.about){case"node":s(g=>Se(ye(we(g,!1),d.id),[d.id]));break;case"kind":s(g=>St(g,xt(d.kind),{ownPicture:!0,...g.q?{carry:g.q}:{}}));break;case"place":s(g=>$t(g,d.kind,d.as));break;case"rule":{let g=L.filter(A=>A.invariant===d.name).flatMap(A=>A.nodeIds);s(A=>Se(A,[...new Set(g)]));break}case"act":{s(A=>Se(A,[d.subject]));let g=c.current?.getBoundingClientRect();v({x:g?.left??0,y:(g?.bottom??0)+6,on:d.subject});break}}$(!1),c.current?.blur()},Te=S?va(S.byKind,S.hits,a.schema):"",ie=O&&f.trim().length>0,fe=(0,R.useCallback)(()=>{let n=c.current?.closest("[data-graview-app-bar]")?.getBoundingClientRect();if(n)return{x:n.right,y:n.bottom-wa};let d=c.current?.getBoundingClientRect();return d?{x:d.right,y:d.bottom}:null},[]),pe=Ee("find",{open:ie,onOpenChange:n=>{n||$(!1)},...t?{at:fe}:{}});return(0,u.jsxs)("div",{style:{position:"relative",minWidth:0,flex:"1 1 auto"},"data-testid":"find",children:[(0,u.jsx)("input",{ref:n=>{c.current=n,pe.trigger.ref(n)},"data-graview-popover-trigger":"find",type:"search",role:"combobox","aria-label":"Find anything","aria-expanded":ie,"aria-controls":C,"aria-autocomplete":"list",...ie&&D?{"aria-activedescendant":D.id}:{},"data-testid":"find-box",placeholder:"Find\u2026","aria-keyshortcuts":"/ Meta+K Control+K",value:f,onChange:n=>{let d=n.target.value;$(!0),s(g=>ft(g,d.length>0?d:null))},onFocus:()=>$(!0),onBlur:()=>$(!1),onKeyDown:n=>{let d=J!==null&&D?Y.indexOf(D):-1;n.key==="ArrowDown"?(n.preventDefault(),$(!0),_(Y[Math.min(Y.length-1,d+1)])):n.key==="ArrowUp"?(n.preventDefault(),_(Y[Math.max(0,d-1)])):n.key==="Enter"?(n.preventDefault(),j(D)):n.key==="Escape"&&(n.preventDefault(),f?s(g=>ke(g)):c.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 ${f?"var(--graview-accent)":"var(--graview-edge)"}`,borderRadius:8}}),(0,u.jsx)("span",{role:"status","aria-live":"polite",style:ze,"data-testid":"find-count",children:f.trim()?Te:""}),(0,u.jsxs)("div",{...pe.pane,id:C,role:"listbox","aria-label":f?`What \u201C${f}\u201D finds`:"What the words find","data-testid":"find-strip",hidden:!ie,onMouseDown:n=>n.preventDefault(),style:t?{...Yt,...ha}:Yt,children:[Y.every(n=>"ask"in n)?(0,u.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",S?.words||f,"\u201D."]}):oe.map(([n,d])=>(0,u.jsxs)("div",{role:"group","aria-label":Gt(n,a.schema),children:[(0,u.jsxs)("div",{role:"presentation",style:ma,children:[n!=="rule:"?(0,u.jsx)(ua,{kind:n,accents:b?.accents}):null,Gt(n,a.schema)]}),d.map(g=>(0,u.jsx)("div",{id:g.id,role:"option","aria-selected":g===D,"data-testid":"find-hit","data-about":g.hit.about,onMouseEnter:()=>_(g),onClick:()=>j(g),style:{...jt,...g.hit.about==="act"?{paddingLeft:30}:{},background:g===D?"var(--graview-panel-muted)":"transparent"},children:(0,u.jsx)(ca,{hit:g.hit,flag:z})},g.id))]},n)),N?(0,u.jsx)("div",{id:N.id,role:"option","aria-selected":N===D||D?.id===N.id,"data-testid":"find-ask",onMouseEnter:()=>_(N),onClick:()=>j(N),style:{...jt,borderTop:"1px solid var(--graview-edge)",marginTop:4,background:D?.id===N.id?"var(--graview-panel-muted)":"transparent"},children:(0,u.jsxs)("span",{children:["Ask: ",(0,u.jsxs)("span",{style:{fontWeight:600},children:["\u2018",N.ask,"\u2019"]})]})}):null,S&&S.searched.past===!1&&S.searched.kinds.some(n=>a.schema.tryDefinition(n)?.lifecycle)?(0,u.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 ca({hit:t,flag:a}){switch(t.about){case"node":return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("span",{style:{fontWeight:600,overflowWrap:"anywhere"},children:[t.flagged?(0,u.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[a," "]}):null,t.label,t.apart?(0,u.jsxs)("span",{style:me,children:[" \xB7 ",t.apart]}):null,t.current?null:(0,u.jsx)("span",{style:me,children:" \xB7 past"})]}),t.why.field!=="label"?(0,u.jsxs)("span",{style:me,children:[t.why.reading.toLowerCase(),": ",t.why.fragment]}):null]});case"kind":return(0,u.jsxs)("span",{children:[t.label,(0,u.jsxs)("span",{style:me,children:[" \xB7 ",t.count," match"]})]});case"place":return(0,u.jsxs)("span",{children:["Go to ",t.title]});case"rule":return(0,u.jsxs)("span",{children:["The rule \u201C",t.label,"\u201D"]});case"act":return(0,u.jsxs)("span",{style:t.destructive?{color:"var(--graview-warn)"}:void 0,children:[t.title,(0,u.jsxs)("span",{style:me,children:[" \xB7 ",t.why.field==="title"?"act":`on ${t.why.fragment}`]})]})}}function ua({kind:t,accents:a}){let p=Math.round(ut(t,a));return(0,u.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:2,flex:"0 0 auto",background:`hsl(${p} 55% 52%)`}})}function Gt(t,a){return t==="rule:"?"Rules":t==="act:"?"Acts":a.tryDefinition(t)?.plural??`${t}s`}function va(t,a,p){let s=Object.entries(t).map(([v,b])=>lt(p,v,b)),i=a.filter(v=>v.about==="kind"||v.about==="place"||v.about==="rule").length;return i>0&&s.push(`${i} ${i===1?"place or rule":"places and rules"}`),s.length===0?"Nothing found":`${s.join(", ")} found`}var Yt={...$e,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"},wa=6,ha={width:"var(--graview-bar-width, 100vw)",maxHeight:"55vh",borderRadius:0,borderLeft:"none",borderRight:"none"},ma={display:"flex",alignItems:"center",gap:6,padding:"8px 12px 2px",fontSize:"0.6875rem",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},jt={display:"grid",gap:1,minHeight:32,padding:"5px 12px",alignContent:"center",cursor:"pointer",fontSize:"0.875rem",lineHeight:1.35,color:"var(--graview-ink)"},me={color:"var(--graview-ink-muted)",fontSize:"0.8125rem",fontWeight:400};var Ae=w(ae(),1),Ye=w(na(),1);var Xt=w(E(),1);function Qt(){let{following:t,follow:a}=T();return t?(0,Xt.jsxs)("button",{type:"button","data-testid":"following-who",onClick:()=>a(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 ",t.name]}):null}var Jt=w(ae(),1);var I=w(E(),1);function Zt({home:t,homeLabel:a,children:p,onPicture:s=!1}){let{view:i,focus:v,show:b,go:m}=de(),{store:x}=T(),{movedByHand:S}=T(),L=S&&(i.pan!==void 0||Object.keys(i.pins).length>0),z=i.focusId&&i.focusId!==t?x.graph.getNode(i.focusId):void 0,c=J=>xe(x.schema,J),C={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"},O=a!==void 0&&z!==void 0,$=[];return z&&!s&&$.push({key:"focused",node:(0,I.jsxs)("button",{type:"button","data-testid":"focused",onClick:()=>m(Ne({...i,focusId:t},!1)),title:Q(x,z.id),style:{...C,maxWidth:"min(14rem, 15vw)"},children:[(0,I.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:Q(x,z.id)}),(0,I.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),i.past&&$.push({key:"past",node:(0,I.jsxs)("button",{type:"button","data-testid":"past",onClick:()=>m(bt(i,!1)),title:"Back to now \u2014 retired things leave the picture again",style:C,children:["the past",(0,I.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),i.zoom&&$.push({key:"zoomed",node:(0,I.jsxs)("button",{type:"button","data-testid":"zoomed",onClick:()=>m(Ne(i,!1)),title:"Zoom back out",style:C,children:["zoomed in",(0,I.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),L&&$.push({key:"moved",node:(0,I.jsxs)("button",{type:"button","data-testid":"moved",onClick:()=>m(Pe(i)),title:"Put the camera and everything you dragged back where the layout wanted them",style:C,children:["moved",(0,I.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),i.relation&&$.push({key:"raised",node:(0,I.jsxs)("button",{type:"button","data-testid":"raised",onClick:()=>b(null),title:`Stop showing ${c(i.relation)}`,style:C,children:[c(i.relation),(0,I.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),s&&!O&&$.length===0&&p===void 0?null:(0,I.jsxs)("nav",{"aria-label":"View","data-testid":"trail",style:{display:"flex",alignItems:"center",gap:8,fontSize:"0.875rem",minWidth:0,...s?{pointerEvents:"auto",padding:"4px 6px",borderRadius:8,background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",overflow:"hidden"}:{}},children:[O?(0,I.jsx)("button",{type:"button",onClick:()=>v(t),style:{border:"none",background:"none",padding:"3px 0",minHeight:24,whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:a}):null,$.map(({key:J,node:Z},G)=>(0,I.jsxs)(Jt.Fragment,{children:[O||G>0?(0,I.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:"\u203A"}):null,Z]},J)),p]})}var q=w(E(),1);function je(){let[t,a]=(0,Ae.useState)([]),p=(0,Ae.useCallback)(s=>{a(i=>{let v=s.phase!=="running"&&i[0]?.name===s.name&&i[0]?.at===s.at;return[s,...v?i.slice(1):i].slice(0,12)})},[]);return[t,p]}function Ve({find:t,calls:a,seat:p,remembers:s=!1}){return t?(0,q.jsxs)(q.Fragment,{children:[(0,Ye.createPortal)((0,q.jsx)(Vt,{compact:t.compact}),t.slot),t.own?(0,Ye.createPortal)((0,q.jsx)(It,{calls:a,remembers:s,...p!==void 0?{seat:p}:{}}),t.own):null]}):null}function Qe({home:t=null}){return(0,q.jsxs)("div",{"data-graview-scene-trail":"",style:{position:"absolute",top:14,left:14,maxWidth:"calc(100% - 150px)",zIndex:F("overview"),display:"flex",alignItems:"center",gap:6,minWidth:0,pointerEvents:"none"},children:[(0,q.jsx)(Zt,{home:t,onPicture:!0}),(0,q.jsx)("span",{style:{pointerEvents:"auto"},children:(0,q.jsx)(Qt,{})})]})}var re=w(ae(),1);var ea=w(E(),1),fa=wt(()=>import("./chunk.YSYT3ASK.js"));function Xe(){let{store:t,principal:a}=T(),p=(0,re.useContext)(Mt),s=(0,re.useRef)(null),i=(0,re.useRef)(!1);return(0,re.useEffect)(()=>()=>void(i.current=!0),[]),(0,re.useEffect)(()=>{let v=t.batches().length,b=fa().then(m=>m.sceneWay(t,a,p,v,s.current),()=>{});return()=>void b.then(m=>m?.(i.current))},[t,a,p]),(0,ea.jsx)("span",{ref:s,hidden:!0})}var ta=w(ae(),1);var H=w(E(),1);function Ir({address:t=!1,auto:a,seat:p,scheme:s,scope:i}){let v=(0,ta.useMemo)(()=>`${We({scope:`.${i}`})}
1040
1040
  ${Fe(s,{scope:`.${i}`})}`,[s,i]),b=Ht(),[m,x]=je();return(0,H.jsxs)("div",{"data-embed-content":"",style:{position:"relative",flex:a?`0 0 ${Kt}px`:"1 1 auto",minHeight:0,containerType:"size"},children:[(0,H.jsx)("style",{children:v}),t?(0,H.jsx)(Dt,{}):null,(0,H.jsx)(Pt,{renderer:"dom"}),(0,H.jsx)(Qe,{}),(0,H.jsx)(_e,{}),(0,H.jsx)(Ke,{}),(0,H.jsx)(Oe,{}),(0,H.jsx)(Be,{...p?{start:p}:{},onCall:x}),(0,H.jsx)(qe,{placement:"menu"}),(0,H.jsx)(Ve,{find:b,calls:m}),(0,H.jsx)(Xe,{})]})}function Hr(){return(0,H.jsx)(Ge,{})}export{Ir as SceneFace,Hr as SceneKeeping};
@@ -1 +1 @@
1
- import{b as m}from"./chunk.AZYJTNSM.js";import"./chunk.VVZ2Z7OS.js";import"./chunk.EQOU4POV.js";import"./chunk.ONDILMIX.js";import{f as g}from"./chunk.NOXC454O.js";import"./chunk.4UQLZ7VW.js";import"./chunk.DN4D4HGX.js";import"./chunk.DJ26NOOW.js";import"./chunk.SQD7ZPEJ.js";import"./chunk.IKT7JQUW.js";import"./chunk.6CLHFNDM.js";import"./chunk.R5K7NK4U.js";import"./chunk.HCK6IHGP.js";import"./chunk.YAONM74M.js";import"./chunk.CJQL7AHT.js";import"./chunk.BQV62QEL.js";import"./chunk.DAKED3WK.js";import"./chunk.WWRWXFYR.js";import"./chunk.ZFUQA3KT.js";import"./chunk.DO4P2UK4.js";import"./chunk.6KJSFIO7.js";import"./chunk.FLJP3BGP.js";import"./chunk.ENMNLR73.js";import"./chunk.LZQZP2PD.js";import"./chunk.SCLIBKLS.js";import"./chunk.ACZGK7LQ.js";import"./chunk.AHDOKM4O.js";import"./chunk.3MLQ3Q5X.js";import"./chunk.LGUV2J6Q.js";import"./chunk.4JSMCNF7.js";import{va as n}from"./chunk.Y235YZSZ.js";import{a as b,b as l}from"./chunk.MRK6QJV5.js";import{b as t}from"./chunk.AJZBJBMO.js";var y=t(b(),1),a=t(l(),1);function P({store:h,auto:c,brand:r,views:f,presence:i,steering:o,overview:s,scope:d,titleLevel:v=2,props:e}){let u=(0,y.useMemo)(()=>g({scope:`.${d}`}),[d]);return(0,a.jsxs)("div",{"data-embed-content":"",style:c?{flex:"0 0 auto",background:"var(--graview-ground)"}:{flex:"1 1 auto",minHeight:0,overflow:"auto",background:"var(--graview-ground)"},children:[(0,a.jsx)("style",{children:u}),(0,a.jsx)("div",{"data-embed-measure":"",style:{display:"flow-root"},children:(0,a.jsx)(m,{context:{store:h,embedded:!0,...e.bar!==!1?{barAbove:!0}:{},...s?{overview:s}:{},titleLevel:v,views:f,settings:e.app.settings??[],...i?{presence:i}:{},...r?{brand:r}:{},...e.principal?{principal:e.principal}:{},...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}},...e.pages?{registry:e.pages}:{},...o?{steering:o}:{},...e.routing==="address"?n(e.basePath)===""?{}:{basename:n(e.basePath)}:{initialPath:e.path??"/"},...e.path!==void 0?{path:e.path}:{},...e.onNavigate?{onNavigate:e.onNavigate}:{}})})]})}export{P as PagesContent};
1
+ import{b as m}from"./chunk.6WFN4C46.js";import"./chunk.HQX5FGYT.js";import"./chunk.F26676IW.js";import"./chunk.ONDILMIX.js";import{f as g}from"./chunk.G3BOZHKR.js";import"./chunk.EKZWX6NG.js";import"./chunk.7BAUPTMY.js";import"./chunk.TTODVIXW.js";import"./chunk.WX5CJ7PI.js";import"./chunk.IKT7JQUW.js";import"./chunk.6DU4XN2F.js";import"./chunk.US4KIJSW.js";import"./chunk.LHFEOEYY.js";import"./chunk.U6BWYBPM.js";import"./chunk.QOYC424P.js";import"./chunk.B57EIGTS.js";import"./chunk.2YVXTTC2.js";import"./chunk.WWRWXFYR.js";import"./chunk.BJ2Y5F66.js";import"./chunk.A4SJ7EEY.js";import"./chunk.6KJSFIO7.js";import"./chunk.DEZEXD24.js";import"./chunk.YZZGD5OY.js";import"./chunk.DSZ3I557.js";import"./chunk.SSOTDXRS.js";import"./chunk.ZRVDIVYY.js";import"./chunk.AHDOKM4O.js";import"./chunk.PY42PBMB.js";import"./chunk.JCZH55RX.js";import"./chunk.2WFEFZAW.js";import{na as n}from"./chunk.RAE4M3KQ.js";import{a as b,b as l}from"./chunk.MRK6QJV5.js";import{b as t}from"./chunk.AJZBJBMO.js";var y=t(b(),1),a=t(l(),1);function P({store:h,auto:c,brand:r,views:f,presence:i,steering:o,overview:s,scope:d,titleLevel:v=2,props:e}){let u=(0,y.useMemo)(()=>g({scope:`.${d}`}),[d]);return(0,a.jsxs)("div",{"data-embed-content":"",style:c?{flex:"0 0 auto",background:"var(--graview-ground)"}:{flex:"1 1 auto",minHeight:0,overflow:"auto",background:"var(--graview-ground)"},children:[(0,a.jsx)("style",{children:u}),(0,a.jsx)("div",{"data-embed-measure":"",style:{display:"flow-root"},children:(0,a.jsx)(m,{context:{store:h,embedded:!0,...e.bar!==!1?{barAbove:!0}:{},...s?{overview:s}:{},titleLevel:v,views:f,settings:e.app.settings??[],...i?{presence:i}:{},...r?{brand:r}:{},...e.principal?{principal:e.principal}:{},...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}},...e.pages?{registry:e.pages}:{},...o?{steering:o}:{},...e.routing==="address"?n(e.basePath)===""?{}:{basename:n(e.basePath)}:{initialPath:e.path??"/"},...e.path!==void 0?{path:e.path}:{},...e.onNavigate?{onNavigate:e.onNavigate}:{}})})]})}export{P as PagesContent};
@@ -1 +1 @@
1
- import{a as p}from"./chunk.AHDOKM4O.js";import{ab as u}from"./chunk.Y235YZSZ.js";import{b as c}from"./chunk.MRK6QJV5.js";import{b as h}from"./chunk.AJZBJBMO.js";var s={person:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><circle cx="11.6" cy="5.4" r="2.5"/><path d="M7.9 12.4c0-2.1 1.7-3.8 3.7-3.8s3.7 1.7 3.7 3.8v3.2H7.9z"/><path d="M8 12.6 6.4 17.2"/><path d="M15.2 12.6 16.8 17.2"/><path d="M9.8 15.6v5"/><path d="M13.4 15.6v5"/></svg>',plot:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.6 9.4 12 4.6l9.4 4.8-9.4 4.8z"/><path d="M2.6 9.4v4.4l9.4 4.8 9.4-4.8V9.4"/><path d="M12 14.2v4.4"/><path d="M7 11.9v3"/><path d="M17 11.9v3"/></svg>',box:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.4 7.9 12 3.6l8.6 4.3-8.6 4.3z"/><path d="M3.4 7.9v8.2L12 20.4l8.6-4.3V7.9"/><path d="M12 12.2v8.2"/></svg>',task:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M4.4 6.6 12 2.9l7.6 3.7v9.5L12 19.8 4.4 16.1z"/><path d="M12 12.4v7.4"/><path d="M4.4 6.6 12 10.3l7.6-3.7"/><path d="M8 9.6l2.4 2.4L16 8.4"/></svg>',shift:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.2 8.2 12 4l8.8 4.2-8.8 4.2z"/><path d="M3.2 8.2v7.2L12 19.6l8.8-4.2V8.2"/><path d="M12 12.4v7.2"/><path d="M6.6 10.8v3.4"/><path d="M9.3 12v3.4"/></svg>',list:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 10.4 12 6l9.2 4.4-9.2 4.4z"/><path d="M2.8 10.4v3.2L12 18l9.2-4.4v-3.2"/><path d="M6.6 8.6 15.8 13"/><path d="M9.4 7.2 18.6 11.6"/></svg>',vehicle:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 14.2 5 9.4l8.6-1.6 5.4 3-1 3.6z"/><path d="M2.8 14.2v2.2h2.4"/><path d="M18 16.4h1.9l.1-2.2"/><circle cx="7.6" cy="16.6" r="1.9"/><circle cx="16.1" cy="16.6" r="1.9"/><path d="M8.6 8.2 9.8 12l7.2-1"/></svg>',rule:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M5.4 19.4V6.6l12 12.8z"/><path d="M5.4 6.6 7.6 5.5l12 12.8-2.2 1.1"/><path d="M5.4 19.4 7.6 18.3h12"/><path d="M5.4 10.1h1.7"/><path d="M5.4 13.3h1.7"/><path d="M5.4 16.5h1.7"/></svg>',note:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M6.2 6.2 14.8 10.5v9L6.2 15.2z"/><path d="M12.4 9.3 14.8 10.5l-.6 2.3"/><path d="M8.2 10.6 12.8 12.9"/><path d="M8.2 13.2 11.4 14.8"/></svg>'},v=Object.keys(s);function i(e){if(e)return s[e]??(e.trimStart().startsWith("<svg")?e:void 0)}var a=h(c(),1);function B({kind:e,schema:o,brand:n,size:r=16,title:t}){let f=o?.tryDefinition?.(e)?.figure,d=i(n?.figures?.[e]??f),l=Math.round(u(e,n?.accents)),g=p(d);return d?(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"figure",dangerouslySetInnerHTML:g,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:r,height:r,flex:"0 0 auto",color:`hsl(${l} 55% 52%)`,"--graview-figure-size":`${r}px`}}):(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"dot",style:{display:"inline-block",width:Math.round(r*.8),height:Math.round(r*.5),flex:"0 0 auto",background:`hsl(${l} 55% 52%)`,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)"}})}function A(e,o,n){return i(n?.figures?.[e]??o?.tryDefinition?.(e)?.figure)!==void 0}export{B as a,A as b};
1
+ import{a as p}from"./chunk.AHDOKM4O.js";import{fb as u}from"./chunk.RAE4M3KQ.js";import{b as c}from"./chunk.MRK6QJV5.js";import{b as h}from"./chunk.AJZBJBMO.js";var s={person:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><circle cx="11.6" cy="5.4" r="2.5"/><path d="M7.9 12.4c0-2.1 1.7-3.8 3.7-3.8s3.7 1.7 3.7 3.8v3.2H7.9z"/><path d="M8 12.6 6.4 17.2"/><path d="M15.2 12.6 16.8 17.2"/><path d="M9.8 15.6v5"/><path d="M13.4 15.6v5"/></svg>',plot:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.6 9.4 12 4.6l9.4 4.8-9.4 4.8z"/><path d="M2.6 9.4v4.4l9.4 4.8 9.4-4.8V9.4"/><path d="M12 14.2v4.4"/><path d="M7 11.9v3"/><path d="M17 11.9v3"/></svg>',box:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.4 7.9 12 3.6l8.6 4.3-8.6 4.3z"/><path d="M3.4 7.9v8.2L12 20.4l8.6-4.3V7.9"/><path d="M12 12.2v8.2"/></svg>',task:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M4.4 6.6 12 2.9l7.6 3.7v9.5L12 19.8 4.4 16.1z"/><path d="M12 12.4v7.4"/><path d="M4.4 6.6 12 10.3l7.6-3.7"/><path d="M8 9.6l2.4 2.4L16 8.4"/></svg>',shift:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.2 8.2 12 4l8.8 4.2-8.8 4.2z"/><path d="M3.2 8.2v7.2L12 19.6l8.8-4.2V8.2"/><path d="M12 12.4v7.2"/><path d="M6.6 10.8v3.4"/><path d="M9.3 12v3.4"/></svg>',list:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 10.4 12 6l9.2 4.4-9.2 4.4z"/><path d="M2.8 10.4v3.2L12 18l9.2-4.4v-3.2"/><path d="M6.6 8.6 15.8 13"/><path d="M9.4 7.2 18.6 11.6"/></svg>',vehicle:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 14.2 5 9.4l8.6-1.6 5.4 3-1 3.6z"/><path d="M2.8 14.2v2.2h2.4"/><path d="M18 16.4h1.9l.1-2.2"/><circle cx="7.6" cy="16.6" r="1.9"/><circle cx="16.1" cy="16.6" r="1.9"/><path d="M8.6 8.2 9.8 12l7.2-1"/></svg>',rule:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M5.4 19.4V6.6l12 12.8z"/><path d="M5.4 6.6 7.6 5.5l12 12.8-2.2 1.1"/><path d="M5.4 19.4 7.6 18.3h12"/><path d="M5.4 10.1h1.7"/><path d="M5.4 13.3h1.7"/><path d="M5.4 16.5h1.7"/></svg>',note:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M6.2 6.2 14.8 10.5v9L6.2 15.2z"/><path d="M12.4 9.3 14.8 10.5l-.6 2.3"/><path d="M8.2 10.6 12.8 12.9"/><path d="M8.2 13.2 11.4 14.8"/></svg>'},v=Object.keys(s);function i(e){if(e)return s[e]??(e.trimStart().startsWith("<svg")?e:void 0)}var a=h(c(),1);function B({kind:e,schema:o,brand:n,size:r=16,title:t}){let f=o?.tryDefinition?.(e)?.figure,d=i(n?.figures?.[e]??f),l=Math.round(u(e,n?.accents)),g=p(d);return d?(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"figure",dangerouslySetInnerHTML:g,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:r,height:r,flex:"0 0 auto",color:`hsl(${l} 55% 52%)`,"--graview-figure-size":`${r}px`}}):(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"dot",style:{display:"inline-block",width:Math.round(r*.8),height:Math.round(r*.5),flex:"0 0 auto",background:`hsl(${l} 55% 52%)`,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)"}})}function A(e,o,n){return i(n?.figures?.[e]??o?.tryDefinition?.(e)?.figure)!==void 0}export{B as a,A as b};
@@ -1 +1 @@
1
- import{e as l}from"./chunk.6CLHFNDM.js";import{C as f,G as E,a as P,b as h,ca as O,f as V,ia as v,l as B,la as L,m as A,ra as R,ya as _,z as x}from"./chunk.4JSMCNF7.js";import{Lb as g}from"./chunk.Y235YZSZ.js";import{a as C,b as T}from"./chunk.MRK6QJV5.js";import{b as S}from"./chunk.AJZBJBMO.js";var k=S(C(),1);var H="The whole thing",y=e=>`scene:${e.kind}:${e.as}`;function D(e){let{view:t}=e,i=new Set,n=e.places.filter(r=>e.hidden.has(r.kind)||i.has(y(r))?!1:(i.add(y(r)),!0)),a=(r,p)=>{if(r===l)return B(A(p,!0),"view",null);let w=n.find(N=>y(N)===r);return w?E(p,w.kind,w.as):null},o=[{key:l,label:H,path:`${g}${V(a(l,h))}`,group:"home"},...n.map(r=>({key:y(r),label:r.title,path:`${g}${V(a(y(r),h))}`,group:"pictures",kind:r.kind}))],s=t.within?.view,d=r=>t.focusId===f(r.kind)&&(s===void 0?n.filter(p=>p.kind===r.kind).at(-1)===r:s===r.as),c=n.find(r=>d(r)&&(s!==void 0||!t.overview));return{places:o,current:c?y(c):l,to:a}}function I(){let{views:e,hiddenKinds:t}=O(),{view:i,go:n}=R(),a=e.places(),o=(0,k.useMemo)(()=>D({places:a,hidden:t,view:i}),[a,t,i]),s=(0,k.useMemo)(()=>({go:d=>{let c=o.to(d.key,i);c&&n(c)}}),[o,i,n]);return{places:o.places,current:o.current,reach:s}}function W(e,t,i=[]){if(e.focusId)return e.focusId;let a=(e.selection??[]).map(x).find(o=>o!==null)??i.find(o=>t.includes(o))??t[0]??null;return a===null?null:f(a)}var m=S(T(),1),u=_(P(()=>import("./chunk.PC6FAJF5.js")));function G(){return u.load().then(()=>{})}var K=[{cardinality:"one",fidelity:"full",slot:"page"},{cardinality:"one",fidelity:"summary",slot:"card"},{cardinality:"one",fidelity:"glyph",slot:"row"},{cardinality:"many",fidelity:"full"},{cardinality:"many",fidelity:"summary"},{cardinality:"many",fidelity:"glyph"}];function M({schema:e,specs:t,kind:i,view:n}){let a=u.current.frameworkViews(e,t).lookup(i,{cardinality:n.cardinality,fidelity:n.fidelity});return a?(0,m.jsx)(a,{...n}):null}var b=u.part((e,t)=>(0,m.jsx)(M,{...t}),{what:"This view"});function F(e,t,i){for(let n of t.kinds){let a=i?.[n];for(let o of K){let s=c=>(0,m.jsx)(b,{schema:t,specs:i,kind:n,view:c}),d=o.slot!==void 0&&a?.[o.slot]!==void 0;d&&(s.says=(c,r)=>u.current?.frameworkViews(t,i).lookup(n,{cardinality:o.cardinality,fidelity:o.fidelity})?.says?.(c,r)),e.register(n,{cardinality:o.cardinality,fidelity:o.fidelity},d?s:v(s))}}return e}function $(e,t){return F(L(e),e,t)}export{I as a,W as b,G as c,$ as d};
1
+ import{e as l}from"./chunk.6DU4XN2F.js";import{C as f,G as E,a as P,b as h,ca as O,f as V,ia as v,l as B,la as L,m as A,ra as H,ya as R,z as x}from"./chunk.2WFEFZAW.js";import{Qb as g}from"./chunk.RAE4M3KQ.js";import{a as C,b as T}from"./chunk.MRK6QJV5.js";import{b as S}from"./chunk.AJZBJBMO.js";var k=S(C(),1);var _="The whole thing",y=e=>`scene:${e.kind}:${e.as}`;function D(e){let{view:t}=e,i=new Set,n=e.places.filter(r=>e.hidden.has(r.kind)||i.has(y(r))?!1:(i.add(y(r)),!0)),a=(r,p)=>{if(r===l)return B(A(p,!0),"view",null);let w=n.find(N=>y(N)===r);return w?E(p,w.kind,w.as):null},o=[{key:l,label:_,path:`${g}${V(a(l,h))}`,group:"home"},...n.map(r=>({key:y(r),label:r.title,path:`${g}${V(a(y(r),h))}`,group:"pictures",kind:r.kind}))],s=t.within?.view,d=r=>t.focusId===f(r.kind)&&(s===void 0?n.filter(p=>p.kind===r.kind).at(-1)===r:s===r.as),c=n.find(r=>d(r)&&(s!==void 0||!t.overview));return{places:o,current:c?y(c):l,to:a}}function I(){let{views:e,hiddenKinds:t}=O(),{view:i,go:n}=H(),a=e.places(),o=(0,k.useMemo)(()=>D({places:a,hidden:t,view:i}),[a,t,i]),s=(0,k.useMemo)(()=>({go:d=>{let c=o.to(d.key,i);c&&n(c)}}),[o,i,n]);return{places:o.places,current:o.current,reach:s}}function W(e,t,i=[]){if(e.focusId)return e.focusId;let a=(e.selection??[]).map(x).find(o=>o!==null)??i.find(o=>t.includes(o))??t[0]??null;return a===null?null:f(a)}var m=S(T(),1),u=R(P(()=>import("./chunk.FWV4XAZA.js")));function G(){return u.load().then(()=>{})}var K=[{cardinality:"one",fidelity:"full",slot:"page"},{cardinality:"one",fidelity:"summary",slot:"card"},{cardinality:"one",fidelity:"glyph",slot:"row"},{cardinality:"many",fidelity:"full"},{cardinality:"many",fidelity:"summary"},{cardinality:"many",fidelity:"glyph"}];function M({schema:e,specs:t,kind:i,view:n}){let a=u.current.frameworkViews(e,t).lookup(i,{cardinality:n.cardinality,fidelity:n.fidelity});return a?(0,m.jsx)(a,{...n}):null}var b=u.part((e,t)=>(0,m.jsx)(M,{...t}),{what:"This view"});function F(e,t,i){for(let n of t.kinds){let a=i?.[n];for(let o of K){let s=c=>(0,m.jsx)(b,{schema:t,specs:i,kind:n,view:c}),d=o.slot!==void 0&&a?.[o.slot]!==void 0;d&&(s.says=(c,r)=>u.current?.frameworkViews(t,i).lookup(n,{cardinality:o.cardinality,fidelity:o.fidelity})?.says?.(c,r)),e.register(n,{cardinality:o.cardinality,fidelity:o.fidelity},d?s:v(s))}}return e}function $(e,t){return F(L(e),e,t)}export{I as a,W as b,G as c,$ as d};
@@ -0,0 +1 @@
1
+ import{a as Q}from"./chunk.G4JJXA63.js";import{d as te,e as ne,f as ie,g as oe}from"./chunk.CFL2B2Z5.js";import{j as J,k as ee}from"./chunk.H4LHHT56.js";import{a as X}from"./chunk.EKZWX6NG.js";import"./chunk.7BAUPTMY.js";import"./chunk.TTODVIXW.js";import"./chunk.WX5CJ7PI.js";import"./chunk.MJ67MK4R.js";import"./chunk.US4KIJSW.js";import{a as q,d as B}from"./chunk.LHFEOEYY.js";import{a as G}from"./chunk.F2KDFGHR.js";import"./chunk.2YVXTTC2.js";import"./chunk.WWRWXFYR.js";import"./chunk.BJ2Y5F66.js";import"./chunk.A4SJ7EEY.js";import"./chunk.6KJSFIO7.js";import"./chunk.DEZEXD24.js";import"./chunk.YZZGD5OY.js";import"./chunk.DSZ3I557.js";import"./chunk.SSOTDXRS.js";import"./chunk.ZRVDIVYY.js";import"./chunk.AHDOKM4O.js";import"./chunk.JCZH55RX.js";import{Ba as Z,W as U,ca as C,j as F,m as _,qa as V,r as Y}from"./chunk.2WFEFZAW.js";import{J as j,O as P,P as T,T as N,U as W,Xa as z}from"./chunk.RAE4M3KQ.js";import{a as he,b as K}from"./chunk.MRK6QJV5.js";import{b as O}from"./chunk.AJZBJBMO.js";var M=3;function re(e,n){return n.id?e.graph.getNode(n.id):void 0}function ae(e){return e?/^(?:kind|aggregate):([^:]+)$/.exec(e)?.[1]:void 0}function le(e,n){if(n)return e.find(t=>t.nodeIds.includes(n)||t.subjectId===n)}var ye=e=>{let n=e.trim();if(!n)return n;let t=n.charAt(0).toUpperCase()+n.slice(1);return/[.!?…]$/.test(t)?t:`${t}.`};function de({store:e,subject:n,violations:t,place:i}){let r=re(e,n),o=le(t,r?.id??null);if(o)return ye(o.message);if(r){let l=r.kind;return`${j(e.schema.tryDefinition(l),r)}, ${N(W(e.schema.tryDefinition(l),l))}.`}let c=i?.kind??ae(n.id);if(c){let l=e.graph.nodesOfKind(c).length,g=i?.title??n.name,u=T(e.schema,c),f=P(e.schema,c,l);return g.toLowerCase()===u.toLowerCase()?`${l===1?"There is":"There are"} ${f} here.`:`${g}: ${f}.`}let a=e.schema.kinds.map(l=>({kind:l,count:e.graph.nodesOfKind(l).length})).filter(l=>l.count>0).sort((l,g)=>g.count-l.count).slice(0,3);if(a.length===0)return"Nothing here yet.";let s=a.map(l=>P(e.schema,l.kind,l.count));return`The whole thing: ${s.length===1?s[0]:`${s.slice(0,-1).join(", ")} and ${s[s.length-1]}`}.`}function ce(e){let{store:n,subject:t,violations:i}=e,r=re(n,t),o=[];r&&le(i,r.id)?o.push({ask:`What's wrong with ${t.name}?`,why:"problem"}):i.length>0&&o.push({ask:"What needs attention?",why:"problem"});let c=r?r.kind:e.place?.kind??ae(t.id),a=ve(e,c);if(a)o.push(a);else{let l=ke(e,c);l&&o.push(l)}let s=be(e,c);return s&&o.push(s),o.length<M&&(r?o.push({ask:`Tell me about ${t.name}`,why:"about"}):o.push({ask:"What is here?",why:"here"})),o.slice(0,M)}function ue(e,n){return e.schema.tryDefinition(n)?.fields?.shape??{}}function me(e){let n=e;for(let t=0;t<4&&n;t++){let i=n;if(Array.isArray(i.options)&&i.options.every(r=>typeof r=="string"))return i.options;n=typeof i.unwrap=="function"?i.unwrap():i._def?.innerType}}var se=/^\d{4}-\d{2}-\d{2}/,Se=["due","deadline","date","when"];function ve(e,n){let{store:t}=e,i=e.today;if(!i||!se.test(i))return;let r=new Date(`${i.slice(0,10)}T00:00:00Z`);r.setUTCDate(r.getUTCDate()+6);let o=r.toISOString().slice(0,10),c=[...new Set([...n?[n]:[],...t.schema.kinds])];for(let a of c){let s=Se.find(u=>u in ue(t,a));if(!s||!t.graph.nodesOfKind(a).some(u=>{let f=u[s],S=u.done;return typeof f=="string"&&se.test(f)&&f.slice(0,10)>=i.slice(0,10)&&f.slice(0,10)<=o&&S!==!0}))continue;let g=T(t.schema,a);return{ask:`${Q(g)} due this week`,why:"due"}}}function ke(e,n){let t=e.place?.title,i=(e.places??[]).find(r=>r.kind!==null&&r.picture===!0&&r.title!==t&&r.kind!==n);return i?{ask:`Go to ${i.title}`,why:"go"}:void 0}function be(e,n){let{store:t}=e,i=[...t.schema.kinds].sort((o,c)=>t.graph.nodesOfKind(c).length-t.graph.nodesOfKind(o).length),r=[...new Set([...n?[n]:[],...i])];for(let o of r){if(t.graph.nodesOfKind(o).length<2)continue;let c=ue(t,o),a=Object.keys(c).find(g=>(me(c[g])?.length??0)>=2);if(!a)continue;let s=T(t.schema,o).toLowerCase(),l=a.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").toLowerCase();return{ask:`Show ${s} as a board by ${l}`,why:"draw"}}}function pe(e,{store:n,subject:t}){let i=a=>t.id!==null&&(a.nodeIds.includes(t.id)||Object.values(a.args).includes(t.id)),r=e.filter(a=>a.provider==="invariant"&&i(a)),o=e.filter(a=>a.pinned==="user"&&!r.includes(a));return[...r,...o].sort((a,s)=>Number(a.destructive??!1)-Number(s.destructive??!1)).slice(0,M).map(a=>({affordance:a,label:Ae(a,{store:n,subject:t})}))}var we=e=>/^[a-z0-9]+(?:[-_][a-z0-9]+)+$|^[a-z]+[A-Z][A-Za-z0-9]*$/.test(e);function Ae(e,{store:n,subject:t}){let i=e.label,r=we(i)||i===e.mutation;if(r){let s=i.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").toLowerCase();i=s.charAt(0).toUpperCase()+s.slice(1)}let o=t.id?n.graph.getNode(t.id):void 0,c=o!==void 0&&e.nodeIds.length<=1&&(e.nodeIds[0]??o.id)===o.id;if(c&&/\bit\b/.test(i))return i.replace(/\bit\b/,t.name);let a=n.allMutations().find(s=>s.name===e.mutation);if(e.open.length===0&&a?.describe&&(r||c))try{let s=a.describe(e.args,n.graph);if(s.trim())return s.trim()}catch{}return i}var y=O(he(),1);var p=O(K(),1);function ze({phone:e,side:n,name:t,onClose:i,respond:r,onCall:o,onPick:c,onMove:a,place:s,onDraft:l}){let{seatTalk:g}=C(),u=U(g),f=xe(c),S=[...u.turns].reverse().find(h=>h.role==="seat"),m=e&&u.draft!==null,b=(0,y.useRef)(null),w=(0,y.useRef)(!0);return(0,y.useLayoutEffect)(()=>{let h=b.current;if(!h)return;let A=m?[...h.querySelectorAll("ol > li")].pop():void 0;if(A){let v=A.getBoundingClientRect().top-h.getBoundingClientRect().top+h.scrollTop;h.style.maxHeight=`min(${Math.ceil(h.scrollHeight-v)}px, ${ge})`}let k=w.current?fe.get(g):void 0;w.current=!1,h.scrollTop=k&&k.turns===u.turns.length&&!u.busy?k.top:h.scrollHeight},[u.turns.length,u.busy,m]),(0,p.jsxs)("div",{"data-testid":"seat-panel",...m?{"data-graview-seat-yields":""}:{},style:{display:"grid",gridTemplateRows:"auto minmax(0, 1fr)",gap:4,minHeight:0},children:[(0,p.jsxs)("div",{"data-testid":"seat-top",...e?{onPointerDown:h=>Ce(h,i)}:{},style:{display:"flex",alignItems:"center",justifyContent:e?"center":"flex-end",gap:2,position:"relative",minHeight:28,...e?{touchAction:"none"}:{}},children:[e?(0,p.jsx)("button",{type:"button","data-testid":"seat-grab","aria-label":`Close Ask ${t}`,title:"Close",onClick:i,style:{...E,width:64},children:(0,p.jsx)("span",{"aria-hidden":"true",style:{display:"block",width:36,height:4,margin:"0 auto",borderRadius:2,background:"var(--graview-edge-strong, var(--graview-ink-faint))"}})}):(0,p.jsx)("button",{type:"button","data-testid":"seat-side","aria-label":n==="left"?"Move to the right":"Move to the left",title:n==="left"?"Move to the right":"Move to the left",onClick:()=>g.setSide(n==="left"?"right":"left"),style:E,children:(0,p.jsx)("span",{"aria-hidden":"true",children:"\u21C4"})}),(0,p.jsx)("button",{type:"button","data-testid":"seat-close","aria-label":`Close Ask ${t}`,title:"Close",onClick:i,style:e?{...E,position:"absolute",top:0,right:0}:E,children:(0,p.jsx)("span",{"aria-hidden":"true",children:"\u2715"})})]}),(0,p.jsx)("div",{ref:b,"data-testid":"seat-body",onScroll:h=>void fe.set(g,{top:h.currentTarget.scrollTop,turns:u.turns.length}),style:{minHeight:0,maxHeight:m?ge:e?"calc(70cqh - 96px)":"min(520px, calc(100cqh - 112px))",overflowY:"auto",overflowX:"hidden",padding:"0 4px"},children:(0,p.jsx)(ne,{shared:!0,composer:!1,testId:"seat",onPick:f,...a?{onMove:a}:{},...s?{place:s}:{},...l?{onDraft:l}:{},empty:(0,p.jsx)(Te,{...s?{here:s}:{}}),...r?{respond:r}:{},...o?{onCall:o}:{}})}),(0,p.jsx)("p",{"aria-live":"polite","data-testid":"seat-said",style:Z,children:u.busy?"":S?.text??""})]})}function xe(e){let{setView:n}=C();return(0,y.useCallback)(t=>e?e(t):n(i=>Y(F(_(i,!1),t),[t])),[e,n])}function Te({here:e}){let{store:n,views:t,view:i,seatTalk:r}=C(),o=te({hover:!1}),c=q(n,V()),a=(0,y.useMemo)(()=>c.map(d=>d.line?{...d,message:B(d)}:d),[c]),s=o.id?n.graph.getNode(o.id):void 0,l=e??i.within?.view,g=o.because==="place"&&o.id===null?t.places().find(d=>d.title===o.name):l?t.places().find(d=>d.as===l):void 0,u=n.today(),f={store:n,subject:{id:o.id,name:o.name},violations:a,place:g?{title:g.title,kind:g.kind}:null,places:t.places().map(d=>({title:d.title,kind:d.kind,picture:!0})),...u?{today:u}:{}},S=de(f),m=ce(f),b=(0,y.useMemo)(()=>({pins:X(),...s?{focus:s.id,about:[s.id]}:{}}),[s?.id]),{affordances:w}=J(b),h=s?pe(w,{store:n,subject:{id:o.id,name:o.name}}):[],{apply:A,preview:k}=ee(),[v,$]=(0,y.useState)(null),[D,R]=(0,y.useState)(null),H=(d,x)=>{try{return k(d,x),A(d,x),R(null),!0}catch(I){return R(z(n.schema,n.allMutations(),I)),!1}};return(0,p.jsxs)("div",{"data-testid":"seat-here",style:{display:"grid",gap:10,padding:"2px 2px 6px"},children:[(0,p.jsx)("p",{"data-testid":"seat-where",style:{margin:0,fontSize:"0.9375rem",lineHeight:1.45,color:"var(--graview-ink)"},children:S}),h.length>0?(0,p.jsx)("ul",{"aria-label":"What you can do",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:6},children:h.map(({affordance:d,label:x})=>(0,p.jsx)("li",{children:(0,p.jsx)("button",{type:"button","data-testid":"seat-act","data-affordance":d.id,"aria-pressed":v?.id===d.id,title:d.why,onClick:()=>d.open.length>0?$(I=>I?.id===d.id?null:d):void H(d),style:{...ie,minHeight:30,textAlign:"start",...d.destructive?{color:"var(--graview-warn)"}:{}},children:x})},d.id))}):null,v?(0,p.jsx)(G,{affordance:v,onApply:d=>{H(v,d)&&$(null)},onCancel:()=>$(null)}):null,D?(0,p.jsx)("p",{"data-testid":"seat-refused",style:{margin:0,fontSize:"0.8125rem",color:"var(--graview-warn)"},children:D}):null,m.length>0?(0,p.jsx)("ul",{"aria-label":"Things to ask",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:2,justifyItems:"start"},children:m.map(d=>(0,p.jsx)("li",{children:(0,p.jsx)("button",{type:"button","data-testid":"seat-suggestion","data-graview-why":d.why,onClick:()=>r.ask(d.ask),style:oe,children:d.ask})},d.ask))}):null]})}var ge="min(5.5em, 22cqh)",fe=new WeakMap,L={far:64,flick:.5,least:16,tap:6};function Ce(e,n){if(e.button!==0)return;let t=e.currentTarget,i=t.closest('[data-testid="seat"]');if(!i)return;let r=e.pointerId,o=e.clientY,c={y:o,at:e.timeStamp},a=0,s=0;try{t.setPointerCapture(r)}catch{}let l=u=>{if(u.pointerId!==r)return;s=Math.max(0,u.clientY-o);let f=u.timeStamp-c.at;f>0&&(a=(u.clientY-c.y)/f),c={y:u.clientY,at:u.timeStamp},i.style.transition="none",i.style.transform=s>0?`translateY(${s}px)`:""},g=u=>{if(u.pointerId!==r)return;t.removeEventListener("pointermove",l),t.removeEventListener("pointerup",g),t.removeEventListener("pointercancel",g);let f=u.type==="pointerup"&&(s>=L.far||s>=L.least&&a>=L.flick);if(i.style.transition=f?"":"transform 160ms ease-out",i.style.transform="",s>L.tap){let S=m=>{m.preventDefault(),m.stopPropagation()};t.addEventListener("click",S,{capture:!0,once:!0}),setTimeout(()=>t.removeEventListener("click",S,{capture:!0}),0)}f&&n()};t.addEventListener("pointermove",l),t.addEventListener("pointerup",g),t.addEventListener("pointercancel",g)}var E={display:"inline-grid",placeItems:"center",width:28,height:28,padding:0,font:"inherit",fontSize:"0.875rem",lineHeight:1,color:"var(--graview-ink-muted)",background:"transparent",border:"1px solid transparent",borderRadius:6,boxShadow:"none",cursor:"pointer"};export{ze as SeatPanel,xe as useSeatGo};
@@ -0,0 +1 @@
1
+ import{e as ke}from"./chunk.BJ2Y5F66.js";import{Eb as ye,Ga as B,J as I,L as M,M as U,O as ae,P as de,R as J,S as ce,Sa as he,T as W,U as z,X as le,Za as ge,_a as me,g as se,ma as ue,ra as fe,sa as j,ta as pe,ua as P}from"./chunk.RAE4M3KQ.js";function we(e){return se(e,{io:"input",unrepresentable:"any",override:We})}var Je={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string"};function We(e){let t=e.zodSchema._zod?.def;if(!t||t.type!=="string"||typeof t.format!="string"||t.format==="regex")return;let n=e.jsonSchema,l=(t.checks??[]).map(i=>i._zod?.def).filter(i=>i?.format==="regex"&&i.pattern instanceof RegExp).map(i=>i.pattern.source);delete n.pattern;let u=n.allOf;Array.isArray(u)&&u.every(i=>typeof i=="object"&&i!==null&&Object.keys(i).length===1&&"pattern"in i)&&delete n.allOf,n.format=Je[t.format]??t.format,l.length===1?n.pattern=l[0]:l.length>1&&(n.allOf=l.map(i=>({pattern:i})))}function V(e){let t=j(e.input),n=we(e.input),l=n.properties??{};if(ge(e)){let u=e.creates.join(" | ");l.id={type:"string",minLength:1,description:`Optional: the id for the ${u} this makes. Refused if the graph already has it; left out, one is minted from the label.`},n.properties=l}me(e)&&(n.additionalProperties=!1);for(let u of t){let i=l[u.name];if(!i)continue;let v=u.kinds.includes("*")?"any node kind":u.kinds.join(" | ");i.description=[i.description,`Id of a node (${v}).`].filter(Boolean).join(" ")}return{name:e.name,...e.title===void 0?{}:{title:e.title},description:e.description??e.title??e.name,inputSchema:n,nodeRefs:t}}function be(e){let t=new Set;for(let n=e;n;n=n.onBehalfOf)n.id!==void 0&&t.add(`${n.kind}:${n.id}`);return t}function K(e,t){let n=be(t),l=p=>{if(p.kind==="rule")return!1;let c=be(p);if(c.size===0)return!1;for(let g of c)if(n.has(g))return!1;return!0},u,i=()=>{if(u)return u;u=new Map;for(let p of e.log.live()){if(p.undoes!==void 0)continue;let c=l(p.author)?p.author:void 0;for(let g of p.primitives){g.op==="remove-node"&&u.delete(g.node.id);let a=g.op==="add-node"?g.node.id:g.op==="patch-node"?g.id:void 0;if(a===void 0)continue;let d=g.op==="add-node"?Object.keys(g.node):Object.keys(g.after),h=u.get(a);(g.op==="add-node"||!h)&&u.set(a,h=new Map);for(let y of d)y==="id"||y==="kind"||(c?h.set(y,c):h.delete(y))}}return u},v=e.schema,S=new Map,o=(p,c)=>{let g=`${p}\0${c}`,a=S.get(g);if(a===void 0){let d=v.tryDefinition(p)?.fields?.shape;a=d!==void 0&&c in d&&pe(d[c]).type==="text",S.set(g,a)}return a},f=p=>e.graph.getNode(p)?.kind;return{prose:o,say:p=>le(p,{graph:e.graph,schema:v}),fieldBy(p,c){let g=f(p);if(!(g===void 0||!o(g,c)))return i().get(p)?.get(c)},recordBy(p){let c=f(p),g=i().get(p);if(c===void 0||!g)return;let a;for(let[d,h]of g)o(c,d)&&(a=h);return a}}}var E=(e,t,n)=>({untrusted:!0,authoredBy:n.say(t),text:e});function Z(e,t){let n;for(let[l,u]of Object.entries(e)){if(typeof u!="string"||l==="id"||l==="kind")continue;let i=t.fieldBy(e.id,l);i&&(n??={...e},n[l]=E(u,i,t))}return n??e}function Se(e,t,n){let l=u=>{if(Array.isArray(u))return u.map(l);if(u!==null&&typeof u=="object"&&"id"in u&&"label"in u){let i=u,v=n.recordBy(i.id);return v?{...i,label:E(i.label,v,n)}:i}if(typeof u=="string"){let i=n.recordBy(e);return i?E(u,i,n):u}return u};return Object.fromEntries(Object.entries(t).map(([u,i])=>[u,l(i)]))}function ve(e,t){return{...e,nodes:e.nodes.map(n=>Z(n,t))}}function Ae(e,t){return{...e,hits:e.hits.map(n=>{if(n.about!=="node")return n;let l=t.recordBy(n.id);if(!l)return n;let u=t.prose(n.kind,n.why.field)?t.fieldBy(n.id,n.why.field):l;return{...n,label:E(n.label,l,t),...n.apart!==void 0?{apart:E(n.apart,l,t)}:{},why:u?{...n.why,fragment:E(n.why.fragment,u,t)}:n.why}})}}function Oe(){return{name:"insight",derive({store:e,nodes:t,kindSelection:n}){let l=[],u=i=>I(e.schema.tryDefinition(i.kind),i);for(let i of t){if([...e.schema.edgeKinds].reduce((S,o)=>S+e.graph.out(i.id,o).length+e.graph.in(i.id,o).length,0)===0){l.push({id:`insight:island:${i.id}`,text:`${u(i)} is connected to nothing yet`,nodeIds:[i.id]});continue}for(let S of e.schema.edgeKinds){let o=e.graph.in(i.id,S).length;if(o<3)continue;let f=[...e.graph.allEdges()].filter(c=>c.kind===S),p=f.length;p>=4&&o/p>.6&&l.push({id:`insight:load:${i.id}:${S}`,text:`${u(i)} ${ze(e,f,S,o)}`,nodeIds:[i.id]})}}for(let i of n){if(e.graph.nodesOfKind(i).length>0)continue;let v=e.schema.definitions.filter(S=>S.kind!==i).filter(S=>Object.values(S.edges).some(o=>o.to!=="*"&&o.to.includes(i))).map(S=>S.plural??`${S.kind}s`);v.length>0&&l.push({id:`insight:gap:${i}`,text:`Nothing here yet, though ${v.join(" and ")} expect to connect to these`,nodeIds:[]})}return{observations:l}}}}function ze(e,t,n,l){let u=new Set(t.map(f=>e.graph.getNode(f.from)?.kind).filter(f=>f!==void 0)),i=u.size===1?[...u][0]:void 0,v=t.length,S=J(e.schema,i??[...u][0]??"",n,"in"),o=f=>i?ae(e.schema,i,f):String(f);return l===v?`${S}: all ${o(l)}`:`${S}: ${l} of the ${o(v)}`}function Re(e){let t=new Map;if(e.length===0)return t;let n=e.slice(-512),l=new Set;for(let i of n)i.undoes&&l.add(i.undoes);let u=e[e.length-1].seq;for(let i of n){if(!i.mutation||l.has(i.id))continue;let v=Math.pow(.5,(u-i.seq)/64);t.set(i.mutation.name,(t.get(i.mutation.name)??0)+v)}return t}function $e(e){return 8*(e/(e+1))}var Be=100;function xe(){return{name:"invariant",derive({store:e,selection:t,nodes:n,violations:l}){let u=f=>I(e.schema.tryDefinition(f.kind),f),i=new Set(t),v=l.filter(f=>f.nodeIds.some(p=>i.has(p))||f.subjectId!==void 0&&i.has(f.subjectId)),S=[],o=[];v.forEach((f,p)=>{o.push({id:`violation:${f.invariant}:${p}`,text:f.message,nodeIds:f.nodeIds}),f.repairs.forEach((c,g)=>{S.push({id:`invariant:${f.invariant}:${p}:${g}`,label:c.label,provider:"invariant",mutation:c.mutation,args:c.args??{},open:(c.missing??[]).map(a=>{let d=e.allMutations().find(r=>r.name===c.mutation);if(!d)return{name:a};let h=j(d.input).find(r=>r.name===a),y=h?h.kinds.includes("*")?e.graph.allNodes().map(r=>r.id):h.kinds.flatMap(r=>e.graph.nodesOfKind(r).map(s=>s.id)):void 0;return{name:a,shape:P(d.input,a),...h?{kinds:h.kinds}:{},...y?{candidates:y}:{}}}),score:Be-g-(c.missing?.length??0),why:f.message,nodeIds:f.nodeIds,...f.subjectId===void 0?{}:{subjectId:f.subjectId}})})});for(let f of n){let p=e.allInvariants().filter(c=>{if(c.scope==="graph")return!1;let g=c.scope;return g.kind!==f.kind?!1:g.match?g.match(f):!0});p.length!==0&&(v.some(c=>c.subjectId===f.id||c.nodeIds.includes(f.id))||o.push({id:`holds:${f.id}`,text:`${u(f)} holds \u2014 nothing currently breaks ${p.length===1?"it":`any of its ${p.length} rules`}`,nodeIds:[f.id]}))}return{affordances:S,observations:o}}}}var X=40;function je(){return{name:"schema",derive({store:e,selection:t,nodes:n,kindSelection:l,edgeSelection:u}){let i=[];if(n.length===0&&u.length>0){for(let o of u){let f=e.graph.getNode(o.from),p=e.graph.getNode(o.to);if(!(!f||!p))for(let c of e.allMutations()){let g=(c.connects??[]).includes(o.kind),a=(c.severs??[]).includes(o.kind);if(!g&&!a)continue;let d={},h=[],y=j(c.input);for(let s of y){let w=s.kinds.includes("*")||s.kinds.includes(f.kind),b=s.kinds.includes("*")||s.kinds.includes(p.kind),A=w&&!y.some(k=>k!==s&&(k.kinds.includes(f.kind)||k.kinds.includes("*")));w&&!b?d[s.name]=o.from:b&&!w?d[s.name]=o.to:w&&b&&A?d[s.name]=o.from:h.push({name:s.name,kinds:s.kinds,candidates:[o.from,o.to],shape:P(c.input,s.name)})}for(let s of F(c.input,""))s in d||h.some(w=>w.name===s)||h.push({name:s,shape:P(c.input,s)});h.every(s=>s.optional===!0?!0:s.kinds!==void 0?(s.candidates?.length??0)>0:(s.candidates?.length??0)>0||s.shape!==void 0&&s.shape.type!=="unknown")&&(g&&!a&&h.length===0||i.push({id:`schema:edge:${c.name}:${o.kind}:${o.from}:${o.to}`,label:M(c),provider:"schema",mutation:c.name,args:d,open:h,...c.destructive?{destructive:!0}:{},score:(a?62:58)-h.length,why:`this line is "${J(e.schema,e.graph.getNode(o.from)?.kind??"",o.kind,"out")}"`,nodeIds:[o.from,o.to]}))}}return{affordances:i}}if(n.length===0&&l.length>0){let o=new Set(l),f=[];for(let p of e.allMutations()){if(!(p.creates??[]).some(a=>o.has(a)))continue;let c=[];for(let a of j(p.input)){let d=a.kinds.includes("*")?e.graph.allNodes().map(h=>h.id):a.kinds.flatMap(h=>e.graph.nodesOfKind(h).map(y=>y.id));c.push({name:a.name,kinds:a.kinds,candidates:d,shape:P(p.input,a.name),...a.optional?{optional:!0}:{}})}for(let a of F(p.input,""))c.some(d=>d.name===a)||c.push({name:a,shape:P(p.input,a)});if(!c.every(a=>a.optional===!0?!0:a.kinds!==void 0?(a.candidates?.length??0)>0:(a.candidates?.length??0)>0||a.shape!==void 0&&a.shape.type!=="unknown")){let a=c.filter(d=>d.optional!==!0&&d.kinds!==void 0&&!d.kinds.includes("*")&&(d.candidates?.length??0)===0);if(a.length>0){let d=[...new Set(a.flatMap(h=>h.kinds??[]))].map(h=>W(z(e.schema.tryDefinition(h),h)));f.push({id:`schema:waits:${p.name}`,text:`"${p.title??p.name}" cannot begin until there is ${d.length===1?d[0]:`${d.slice(0,-1).join(", ")} and ${d[d.length-1]}`}.`,nodeIds:[]})}continue}i.push({id:`schema:add:${p.name}`,label:M(p),provider:"schema",mutation:p.name,args:{},open:c,score:X-c.length,why:`this makes ${(p.creates??[]).filter(a=>o.has(a)).map(a=>W(z(e.schema.tryDefinition(a),a))).join(", ")}`,nodeIds:[]})}return{affordances:i,observations:f}}if(n.length===0)return{};let v=new Set(n.map(o=>o.kind)),S=(o,f,p)=>{let c=[];for(let g of e.graph.allEdges()){if(!f.includes(g.kind))continue;let a=g.from===o?g.to:g.to===o?g.from:null;if(!a)continue;let d=e.graph.getNode(a);d&&(!p.includes("*")&&!p.includes(d.kind)||c.includes(a)||c.push(a))}return c};for(let o of e.allMutations()){let f=o.subject;if(!f||!(f.kinds==="*"?!0:[...v].every(r=>f.kinds.includes(r))))continue;let c=n.length===1?n[0].id:null,g=o.severs??[],a=o.connects??[];if(c&&g.length>0&&a.length===0&&S(c,g,["*"]).length===0)continue;let d=[];for(let r of j(o.input)){if(r.name===f.arg)continue;let s=r.kinds.includes("*")?e.graph.allNodes().map(w=>w.id):r.kinds.flatMap(w=>e.graph.nodesOfKind(w).map(b=>b.id));if(c&&a.length>0){let w=new Set(S(c,a,r.kinds));s=s.filter(b=>!w.has(b))}else c&&g.length>0&&(s=S(c,g,r.kinds));d.push({name:r.name,kinds:r.kinds,candidates:s.filter(w=>!t.includes(w)),shape:P(o.input,r.name),...r.optional?{optional:!0}:{}})}for(let r of F(o.input,f.arg))d.some(s=>s.name===r)||d.push({name:r,shape:P(o.input,r)});if(d.length===0&&c){let r=Ke(o.input,f.arg);if(r.length>0&&!Fe(e,o.name,{[f.arg]:c}))for(let s of r){let w=j(o.input).find(b=>b.name===s);d.push({name:s,optional:!0,...w?{kinds:w.kinds}:{},shape:P(o.input,s)})}}if(!d.every(r=>r.optional===!0?!0:r.kinds!==void 0?(r.candidates?.length??0)>0:(r.candidates?.length??0)>0||r.shape!==void 0&&r.shape.type!=="unknown"))continue;let y=n.map(r=>({[f.arg]:r.id}));d.length===0&&!y.some(r=>e.wouldChange({name:o.name,args:r}))||i.push({id:`schema:${o.name}`,label:n.length>1?`${M(o)} (${n.length})`:M(o),provider:"schema",mutation:o.name,args:y[0]??{},open:d,...o.destructive?{destructive:!0}:{},...g.length>0||a.length>0?{ties:!0}:{},...n.length>1?{batch:y}:{},score:X-d.length,why:n.length>1?`all ${n.length} selected nodes are ${[...v].map(r=>de(e.schema,r).toLowerCase()).join(" or ")}`:`this is ${W(z(e.schema.tryDefinition(n[0].kind),n[0].kind))}`,nodeIds:n.map(r=>r.id)})}if(n.length===1){let o=n[0];for(let f of e.allMutations()){let p=f.subject,c=f.severs??[],g=f.connects??[];if(!p||c.length===0&&g.length===0)continue;let a=p.kinds==="*"?"*":p.kinds;if(a==="*"||a.includes(o.kind))continue;let d=j(f.input),h=d.find(k=>k.name!==p.arg&&(k.kinds.includes("*")||k.kinds.includes(o.kind)));if(!h)continue;let y=a,r=y.includes("*")?e.graph.allNodes().map(k=>k.id):y.flatMap(k=>e.graph.nodesOfKind(k).map($=>$.id)),s=new Set(S(o.id,g.length>0?g:c,y)),w=g.length>0?r.filter(k=>!s.has(k)):r.filter(k=>s.has(k));if(w.length===0)continue;let b=[{name:p.arg,kinds:y,candidates:w,shape:P(f.input,p.arg)}];for(let k of d){if(k.name===h.name||k.name===p.arg)continue;let $=k.kinds.includes("*")?e.graph.allNodes().map(x=>x.id):k.kinds.flatMap(x=>e.graph.nodesOfKind(x).map(R=>R.id));b.push({name:k.name,kinds:k.kinds,candidates:$,shape:P(f.input,k.name),...k.optional?{optional:!0}:{}})}for(let k of F(f.input,h.name))k===p.arg||b.some($=>$.name===k)||b.push({name:k,shape:P(f.input,k)});b.every(k=>k.optional===!0?!0:k.kinds!==void 0?(k.candidates?.length??0)>0:(k.candidates?.length??0)>0||k.shape!==void 0&&k.shape.type!=="unknown")&&i.push({id:`schema:tie:${f.name}:${o.id}`,label:f.fromTheOtherEnd??M(f),provider:"schema",mutation:f.name,args:{[h.name]:o.id},open:b,ties:!0,...f.destructive?{destructive:!0}:{},score:X-b.length+2,why:`${c.length>0?"this one is on":"this one could join"} ${b[0].candidates.length===1?"it":"one of these"}`,nodeIds:[o.id]})}}return{affordances:i}}}}function Ke(e,t){let n=e.shape;return n?Object.entries(n).filter(([l,u])=>l!==t&&u.safeParse(void 0).success).map(([l])=>l):[]}function Fe(e,t,n){try{return e.preview({name:t,args:n}),!0}catch{return!1}}function F(e,t){let n=e.shape;return n?Object.entries(n).filter(([l,u])=>l!==t&&!u.safeParse(void 0).success).map(([l])=>l):[]}var Ge=70,qe=80,Ue=new Set(["id","kind"]);function Pe(){return{name:"structure",derive({store:e,nodes:t}){let n=o=>I(e.schema.tryDefinition(o.kind),o);if(t.length<2)return{};let l=[],u=[],i=t.map(o=>o.id);for(let o of e.schema.edgeKinds){let f=Ve(t.map(c=>new Set([...e.graph.out(c.id,o).map(g=>g.id),...e.graph.in(c.id,o).map(g=>g.id)])));for(let c of f){let g=e.graph.getNode(c);g&&l.push({id:`shared:${o}:${c}`,text:`all ${t.length} share "${n(g)}" (${U(o).toLowerCase()})`,nodeIds:[...i,c]})}let p=new Map;for(let c of t)for(let g of[...e.graph.out(c.id,o),...e.graph.in(c.id,o)])p.set(g.id,(p.get(g.id)??0)+1);for(let[c,g]of p){if(g!==t.length-1||t.length<3)continue;let a=e.graph.getNode(c);if(!a)continue;let d=t.find(h=>![...e.graph.out(h.id,o),...e.graph.in(h.id,o)].some(y=>y.id===c));if(d){l.push({id:`near-shared:${o}:${c}`,text:`all but "${n(d)}" share "${n(a)}" (${U(o).toLowerCase()})`,nodeIds:[...i,c]});for(let h of e.allMutations()){let y=h.subject;if(!y||y.kinds!=="*"&&!y.kinds.includes(d.kind))continue;let r=Ze(h.input,a.kind);r&&u.push({id:`structure:join:${h.name}:${d.id}:${c}`,label:`${M(h)}: bring "${n(d)}" in line with the others`,provider:"structure",mutation:h.name,args:{[y.arg]:d.id,[r]:c},open:[],score:Ge,why:`every other selected node is connected to "${n(a)}"`,nodeIds:[d.id,c]})}}}}let v=new Set;for(let o of t)for(let f of Object.keys(o))Ue.has(f)||v.add(f);let S=o=>e.schema.definitions.find(f=>f.kind===o);for(let o of[...v].sort()){let f=S(t[0].kind),p=ce(f,o).toLowerCase(),c=f?.display?.format?.[o],g=A=>{if(!c)return A;try{return String(c(JSON.parse(A)))}catch{return A}},a=t.map(A=>A[o]),d=new Map;if(a.forEach((A,k)=>{let $=JSON.stringify(A??null),x=d.get($);x?x.push(t[k]):d.set($,[t[k]])}),d.size===1){let A=[...d.keys()][0];if(A==="null")continue;l.push({id:`agree:${o}`,text:`all ${t.length} share the ${p} ${g(A)}`,nodeIds:i});continue}if(t.length<3||d.size!==2)continue;let h=[...d.entries()].sort((A,k)=>k[1].length-A[1].length),[y,r]=h[0],[,s]=h[1];if(s.length!==1||y==="null")continue;let w=s[0],b=JSON.parse(y);l.push({id:`odd-one-out:${o}`,text:`${r.length} share the ${p} ${g(y)}; "${n(w)}" does not`,nodeIds:i});for(let A of e.allMutations()){let k=A.subject;if(!k||k.kinds!=="*"&&!k.kinds.includes(w.kind))continue;let $=Ne(A.input);if(!$||!(o in $))continue;let x={[k.arg]:w.id,[o]:b},R=!0;for(let[T,G]of Object.entries($)){if(T in x||G.safeParse(void 0).success)continue;let C=w[T];if(C===void 0){R=!1;break}x[T]=C}R&&u.push({id:`structure:align:${A.name}:${o}:${w.id}`,label:`Align the ${p} of "${n(w)}" with the other ${r.length}`,provider:"structure",mutation:A.name,args:x,open:[],score:qe,why:`${r.length} of ${t.length} share the ${p} ${g(y)}`,nodeIds:i})}}return{affordances:u,observations:l}}}}function Ve(e){if(e.length===0)return[];let[t,...n]=e;return[...t].filter(l=>n.every(u=>u.has(l))).sort()}function Ne(e){return e.shape??null}function Ze(e,t){let n=Ne(e);if(!n)return null;for(let[l]of Object.entries(n)){let u=fe(n[l]);if(u&&(u.includes("*")||u.includes(t)))return l}return null}function Xe(){return[xe(),Pe(),je(),Oe()]}function Te(e,t,n={}){let l=Me(),u=n.providers??Xe(),i=t.map(m=>e.graph.getNode(m)).filter(m=>m!==void 0),v={store:e,selection:t,nodes:i,kindSelection:n.kindSelection??[],edgeSelection:n.edgeSelection??[],violations:e.violations(n.context),context:n.context??{}},S=[],o=[];for(let m of u){let O=m.derive(v);S.push(...O.affordances??[]),o.push(...O.observations??[])}let f=new Set(e.allMutations().filter(m=>m.pinned).map(m=>m.name)),p=new Set(n.pins?.pinned??[]),c=new Set(n.pins?.unpinned??[]),g=m=>p.has(m.mutation)?"user":f.has(m.mutation)&&!c.has(m.mutation)?"declared":void 0,a=m=>{let O=g(m);return O?{...m,pinned:O}:m},d=new Map;for(let[m,O]of Re(e.log.all()))d.set(m,$e(O));let h=m=>m.pinned==="user"?0:m.pinned==="declared"?1:2,y=m=>m.score+(d.get(m.mutation)??0),r=new Map(e.allMutations().map(m=>[m.name,m])),s=new Map,w=m=>{let O=r.get(m.mutation);if(!O)return[];let N=s.get(m.mutation);N||(N=j(O.input).map(q=>q.name),s.set(m.mutation,N));let H=[];for(let q of m.batch??[m.args])for(let ie of N){let re=q[ie]??m.args[ie];typeof re=="string"&&H.push(re)}return H},b=n.focus,A=4,k=m=>m.open.length>0?1:0,$=m=>{if(b===void 0)return A;let O=w(m);return O.length>0?O.includes(b)?x(m,0):A:m.nodeIds.includes(b)||m.subjectId===b?x(m,1):A},x=(m,O)=>m.provider==="invariant"?O:2+k(m),R=Ye(S).map(a),T=new Map(R.map((m,O)=>[m,O])),G=R.sort((m,O)=>{let N=Number(m.destructive??!1)-Number(O.destructive??!1);if(N!==0)return N;let H=$(m)-$(O);return H!==0?H:$(m)<2?T.get(m)-T.get(O):+(O.provider==="invariant")-+(m.provider==="invariant")||h(m)-h(O)||y(O)-y(m)||m.id.localeCompare(O.id)}),C=n.principal??{kind:"human"},L=[],te=[];for(let m of G){let O=e.permits({name:m.mutation,args:{...m.args,...m.batch?.[0]??{}}},C);if(O.ok)L.push(m);else{let N=nn(e,m,C);if(N==="done")continue;N?L.push(N):te.push({...m,refusal:O.refusal})}}let oe=L.map((m,O)=>({...m,rank:O})),Le=te.map((m,O)=>({...m,rank:L.length+O}));return{affordances:n.limit===void 0?oe:oe.slice(0,n.limit),withheld:Le,observations:Qe(o),ms:Me()-l}}function Ye(e){let t=new Map;for(let n of e){let l=[n.mutation,JSON.stringify(n.args),JSON.stringify(n.batch??null)].join("|"),u=t.get(l);(!u||n.score>u.score)&&t.set(l,n)}return[...t.values()]}function Qe(e){let t=new Map;for(let n of e)t.set(n.text,n);return[...t.values()]}function Me(){return typeof performance<"u"?performance.now():Date.now()}function en(e,t,n={},l={}){let u=(t.batch??[t.args]).map(v=>({name:t.mutation,args:{...t.args,...v,...n}})),i=e.allMutations().find(v=>v.name===t.mutation);return e.applyAll(u,{...i?.describe?{}:{intent:t.label},...l.author?{author:l.author}:{}})}function Kn(e,t,n={}){return e.preview({name:t.mutation,args:{...t.args,...n}})}function nn(e,t,n){let l=e.allMutations().find(o=>o.name===t.mutation)?.subject;if(!l||t.args[l.arg]!==void 0)return;let u=t.open.find(o=>o.name===l.arg);if(!u?.candidates)return;let i=o=>e.permits({name:t.mutation,args:{...t.args,...t.batch?.[0]??{},[l.arg]:o}},n).ok,v=u.candidates.filter(i),S=n.id===void 0?void 0:e.graph.getNode(n.id);return v.length===0?S!==void 0&&(l.kinds==="*"||l.kinds.includes(S.kind))&&i(S.id)?"done":void 0:v.length===1&&v[0]===n.id?{...t,args:{...t.args,[l.arg]:n.id},open:t.open.filter(o=>o!==u)}:{...t,open:t.open.map(o=>o===u?{...o,candidates:v}:o)}}var De,tn=()=>De??=import("./chunk.JW3E4SAC.js").catch(e=>{throw De=void 0,e}),on=()=>import("./chunk.RVEMN5WU.js").catch(()=>{}),rn=async()=>{(await on())?.judgeWithLines()},_e,sn=()=>_e??=import("./chunk.R6F3YMRK.js").catch(e=>{throw _e=void 0,e}),D=e=>({title:e,readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}),Y=[{name:"search_graph",title:"Find by name",description:"Find things by name: records whose name or readable fields carry the words, and the kinds, places and rules the words name \u2014 each with why it matched. Reach for this before get_graph when you know what something is called. Words match the start of words, case and accents aside; key:value tokens narrow as a list's filter does (done:false, is:any for past records, kind:<kind>). Pass subject (a node id) to get the acts you may run on it as hits too.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Words, with optional key:value conditions."},limit:{type:"number",description:"Most hits to return; 20 when unsaid."},subject:{type:"string",description:"A node id whose acts to include."}},required:["query"],additionalProperties:!1},mutating:!1,annotations:D("Find by name")},{name:"get_graph",title:"Read the whole graph",description:"Read the whole graph: every node with its fields, and every edge. Start here when you need the shape of the domain rather than one thing in it.",inputSchema:{type:"object",properties:{},additionalProperties:!1},mutating:!1,annotations:D("Read the whole graph")},{name:"get_node",title:"Read one node",description:"Read one node, its edges, and the violations that implicate it, with its computed values: read-only fields worked out from what you can see, which no act sets. Use this to check a thing before you change it.",inputSchema:{type:"object",properties:{id:{type:"string",description:"A node's id, or its name."}},required:["id"],additionalProperties:!1},mutating:!1,annotations:D("Read one node")},{name:"get_violations",title:"List the problems",description:"List every invariant violation the graph currently has, with the repairs that would resolve each one. Read this before proposing work: a rule that is already broken is more urgent than anything you could add.",inputSchema:{type:"object",properties:{context:{type:"object",description:"Evaluation context, e.g. { weekStart }."}},additionalProperties:!1},mutating:!1,annotations:D("List the problems")},{name:"get_affordances",title:"Ask what can be done",description:"Ask what can legally be done with a selection, ranked. Prefer these over composing a mutation by hand: they are derived from the schema, the invariants and the shape of the graph, so they cannot name an action that does not exist.",inputSchema:{type:"object",properties:{selection:{type:"array",items:{type:"string"},description:"Node ids."},context:{type:"object"}},required:["selection"],additionalProperties:!1},mutating:!1,annotations:D("Ask what can be done")},{name:"describe_place",title:"Say what a place shows",description:`Say what one place of the app shows you, as a person in your seat would see it: its headings, its figures as drawn, its lists with each record's title and what its card or row says, the headings a list is grouped under, what an empty list says, and any block that could not be worked out. Pass a place's slug ("home", a lens's address like "the-offers", a kind's like "offers") or a record's id, and width 390 for a phone. Use it after a change to check what somebody now sees, instead of guessing.`,inputSchema:{type:"object",properties:{place:{type:"string",description:`"home", a place's slug, or a record's id.`},width:{type:"number",description:"The screen's width in CSS pixels; 390 is a phone, 1440 when unsaid."}},required:["place"],additionalProperties:!1},mutating:!1,annotations:D("Say what a place shows")},{name:"preview_mutation",title:"Try an act without applying it",description:"Try a mutation without applying it: get back the diff it would produce and any invariant it would break. Do this when you are unsure, rather than applying and undoing.",inputSchema:{type:"object",properties:{mutation:{type:"string"},args:{type:"object"}},required:["mutation","args"],additionalProperties:!1},mutating:!1,annotations:D("Try an act without applying it")},{name:"undo_batch",title:"Undo a batch",description:"Undo one batch of operations. Fails, naming the blocking operation, when a later operation read what it wrote.",inputSchema:{type:"object",properties:{batch:{type:"string"},include:{type:"array",items:{type:"string"}}},required:["batch"],additionalProperties:!1},mutating:!0,annotations:{title:"Undo a batch",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1}}],Q={type:"object",description:"A lens, as draft_view returns one.",properties:{title:{type:"string"},lens:{type:"string"},on:{type:"string"},bindings:{type:"object"},options:{type:"object"}},required:["title","lens","on"]},ee={name:"draft_view",title:"Draw a view",description:'Draw a view of the data from words ("a board of tasks by status", "who covers what") as a lens the app could keep; or check a lens you wrote (lens); or change the one on screen (current, with ask: "only this month"). Returns the lens and its add-lens edit, or one sentence saying why not. Writes nothing.',inputSchema:{type:"object",properties:{ask:{type:"string",description:"What to see, in words."},lens:Q,current:Q},additionalProperties:!1},mutating:!1,annotations:D("Draw a view")},Ee={name:"keep_lens",title:"Keep a view as a lens",description:"Keep a lens draft_view drew as one of the app's places: checked again, then written as the add-lens edit. Returns the remove-lens edit that takes it back.",inputSchema:{...Q,additionalProperties:!1},mutating:!0,annotations:{title:"Keep a view as a lens",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}};function an(e,t){return e===void 0?[]:e==="keep"&&!t?[ee,Ee]:[ee]}var dn="An argument that names a record takes its id or its name.",Ce=[...Y.map(e=>e.name),ee.name,Ee.name],He=64;function _(e){let{line:t,...n}=e;return n}function Ie(e){return{...e,...e.introduces?{introduces:e.introduces.map(_)}:{},...e.resolves?{resolves:e.resolves.map(_)}:{},...e.violationsAfter?{violationsAfter:e.violationsAfter.map(_)}:{}}}function cn(e){let t=e.normalize("NFKD").replace(/\p{M}/gu,"").replace(/[^A-Za-z0-9_-]/g,"_");return t.length===0&&(t="act"),/^[A-Za-z_]/.test(t)||(t=`act_${t}`),t.slice(0,He)}function ln(e){let t=new Set(Ce),n=new Map;for(let l of e){let u=cn(l),i=u;for(let v=2;t.has(i);v+=1)i=`${u.slice(0,He-`_${v}`.length)}_${v}`;t.add(i),n.set(l,i)}return n}function un(e,t){let n=V(e),l=M(e),u=n.nodeRefs.length>0?`${n.description}${/[.!?]$/.test(n.description)?"":"."} ${dn}`:n.description;return{name:t,title:l,description:u,inputSchema:n.inputSchema,mutating:!0,annotations:{title:l,readOnlyHint:!1,destructiveHint:e.destructive===!0||(e.severs?.length??0)>0,idempotentHint:e.idempotent===!0,openWorldHint:!1},act:e.name}}function ne(e){if(e===null||typeof e!="object")return JSON.stringify(e)??"null";if(Array.isArray(e))return`[${e.map(ne).join(",")}]`;let t=e;return`{${Object.keys(t).filter(n=>t[n]!==void 0).sort().map(n=>`${JSON.stringify(n)}:${ne(t[n])}`).join(",")}}`}function fn(e){return`sha256:${ye(ne(e))}`}function pn(e,t,n,l){let u=ln(e.map(S=>S.name)),i=an(l,n);return{definitions:n?[...Y.filter(S=>!S.mutating),...i]:[...Y,...i,...e.filter(S=>t.has(S.name)).map(S=>un(S,u.get(S.name)))],names:u}}function tt(e,t={}){let n=t.author??{kind:"agent"},l=e.allMutations(),u=new Set(e.permittedMutations(n).map(a=>a.name)),{definitions:i,names:v}=pn(l,u,t.readOnly===!0,t.drafts?t.drafts.keep?"keep":"draw":void 0),S=fn(i),o=a=>{if(!Ce.includes(a)){for(let[d,h]of v)if(h===a)return d;return v.has(a)?a:void 0}},f=(a,d)=>{let h=l.find(s=>s.name===a);if(!h)return{args:d,resolved:[]};let y={...d},r=[];for(let s of j(h.input)){let w=y[s.name];if(typeof w!="string"||w.trim()==="")continue;let b=e.resolveRef(s,w,n);if(!b.ok){let A=b.reason==="none"?` Nothing was changed. Use search_graph to look it up, then pass its id as ${s.name}.`:" Nothing was changed.";return{ok:!1,error:`${b.message}${A}`,argument:s.name,candidates:b.candidates}}b.by!=="id"&&(y[s.name]=b.id,r.push({argument:s.name,given:w,id:b.id,label:b.label}))}return{args:y,resolved:r}},p=async(a,d)=>{try{await rn();let h=i.find(r=>r.name===a)??i.find(r=>r.act===a);if(!h){let r=o(a);if(r){let s=e.permits({name:r,args:d},n);if(!s.ok)return{ok:!1,error:s.refusal.message,reason:"forbidden"}}return{ok:!1,error:`Unknown tool "${a}". Available: ${i.map(s=>s.name).join(", ")}`}}if(h.mutating&&t.readOnly)return{ok:!1,error:`"${a}" changes the graph, and this seat is read-only.`,reason:"forbidden"};if(h.act!==void 0){let r=f(h.act,d);if("ok"in r)return r;let s=B(e,n,e.apply({name:h.act,args:r.args},{...t.author?{author:t.author}:{},...hn(t.via)}));return{ok:!0,data:{batch:s.batch,intent:s.intent,introduces:s.introduces.map(_),resolves:s.resolves.map(_),...r.resolved.length>0?{resolved:r.resolved}:{}},diff:s.diff}}let y=e.seenBy(n);switch(h.name){case"search_graph":{let r=typeof t.places=="function"?t.places():t.places,s=typeof d.subject=="string"?d.subject:void 0,w=he(y,String(d.query??""),{principal:n,limit:typeof d.limit=="number"?d.limit:20,...r?{places:r}:{},...s?{subject:s,from:[s]}:{}});return{ok:!0,data:Ae(w,K(y,n)),reads:w.hits.flatMap(b=>b.about==="node"?[b.id]:[])}}case"get_graph":{let r=y.graph.snapshot();return{ok:!0,data:ve(r,K(y,n)),reads:r.nodes.map(s=>s.id)}}case"get_node":{let r=String(d.id??""),s=r,w;if(!y.graph.getNode(r)){let R=r.trim()===""?void 0:e.resolveRef({name:"id",kinds:["*"]},r,n);if(R?.ok)s=R.id,w={argument:"id",given:r,id:s,label:R.label};else return R?.reason==="ambiguous"?{ok:!1,error:R.message,argument:"id",candidates:R.candidates}:{ok:!1,error:`No node "${r}".`}}let b=y.graph.getNode(s),A=y.graph.outEdges(s),k=y.graph.inEdges(s),$=K(y,n),x=ke(y.schema,y.graph,b);return{ok:!0,data:{node:Z(b,$),...Object.keys(x.values).length>0?{computed:Se(s,x.values,$)}:{},...Object.keys(x.refused).length>0?{uncomputed:x.refused}:{},out:A,in:k,violations:y.violations().filter(R=>R.nodeIds.includes(s)).map(_),...w?{resolved:[w]}:{}},reads:[s,...A.map(R=>R.to),...k.map(R=>R.from)]}}case"describe_place":{let r=t.app??{name:"",schema:e.schema},s=typeof d.width=="number"&&Number.isFinite(d.width)&&d.width>0?d.width:1440,{describePlace:w}=await tn(),b=w(e,n,String(d.place??""),{app:r,width:s});if(!b.ok)return{ok:!1,error:`${b.error} The places are: ${b.places.join(", ")}.`};let A=new Set,k=$=>{for(let x of $)for(let R of x.groups??[])for(let T of R.items)A.add(T.id),k(T.parts)};return k(b.description.parts),{ok:!0,data:b.description,reads:[...A]}}case"draft_view":case"keep_lens":{let r=t.app??{name:"",schema:e.schema};return(await sn()).runDraftTool(h.name,d,{app:r,principal:n,...t.drafts?{drafts:t.drafts}:{}})}case"get_violations":{let r=y.violations(d.context);return{ok:!0,data:r.map(_),reads:[...new Set(r.flatMap(s=>s.nodeIds))]}}case"get_affordances":{let r=d.selection??[];return{ok:!0,data:Te(y,r,{...typeof t.derive=="function"?t.derive():t.derive,...t.author?{principal:t.author}:{},...d.context?{context:d.context}:{}}),reads:r.filter(w=>y.graph.has(w))}}case"preview_mutation":{let r=String(d.mutation),s=o(r)??r,w=f(s,d.args??{});if("ok"in w)return w;let b=e.missingFor({name:s,args:w.args},n);if(b)return{ok:!1,error:b.message,reason:"missing"};let A=B(e,n,e.preview({name:s,args:w.args},void 0,{author:n})),k=Ie(A);return{ok:!0,data:w.resolved.length>0?{...k,resolved:w.resolved}:k}}case"undo_batch":{let r=String(d.batch),s=d.include??[],w=y.canUndo([r,...s]);if(!w.ok)return{ok:!1,error:w.message};let b=B(e,n,e.undo([r,...s],{...t.author?{author:t.author}:{}}));return{ok:!0,data:Ie(b),diff:b.diff}}default:return{ok:!1,error:`Unknown tool "${a}".`}}}catch(h){let{reason:y,wouldNeed:r}=ue(h);return{ok:!1,error:h instanceof Error?h.message:String(h),reason:y,...r?{wouldNeed:r}:{}}}},c=new Set,g=a=>{for(let d of c)d(a)};return{definitions:i,hash:S,...t.author?{author:t.author}:{},onDiff(a){return e.subscribe(a)},onCall(a){return c.add(a),()=>c.delete(a)},async call(a,d){let h=(i.find(s=>s.name===a)??i.find(s=>s.act===a))?.mutating??!1,y={name:a,args:d,mutating:h,at:new Date().toISOString()};return g({...y,phase:"running"}),(s=>(g(s.ok?{...y,phase:"ok",...!h&&s.reads?{reads:s.reads}:{}}:{...y,phase:"failed",error:s.error}),s))(await p(a,d))}}}function hn(e){let t=typeof e=="function"?e():e;return t?{via:t}:{}}export{Te as a,en as b,Kn as c,tt as d};
@@ -1,4 +1,4 @@
1
- import{a as k,b as K}from"./chunk.LGUV2J6Q.js";import{Aa as U,a as z,ua as j,xa as W,ya as _}from"./chunk.4JSMCNF7.js";import{Ca as F,D as M,I as G,M as E}from"./chunk.Y235YZSZ.js";import{a as X,b as B}from"./chunk.MRK6QJV5.js";import{b as L}from"./chunk.AJZBJBMO.js";var S=L(X(),1);var r=L(B(),1),ee=520;function re(e,n,u,a){let o=u.filters.find(d=>d.key===a.key);if(!o)return`${a.key}: ${a.value}`;if(o.about==="is")return a.value.charAt(0).toUpperCase()+a.value.slice(1);if(o.about==="edge"){if(a.value==="*")return`${o.label}: anything`;if(a.value==="none")return`${o.label}: nothing`;let d=n.getNode(a.value);return`${o.label}: ${d?G(e.tryDefinition(d.kind),d):a.value}`}if(o.type==="date"){let[d,g]=a.value.split(":");return`${o.label} ${d} ${g?M(g):""}`.trim()}if(o.type==="boolean")return`${o.label}: ${a.value==="true"?"yes":"no"}`;if(o.type==="number"){let d=a.value.lastIndexOf(":"),g=a.value.slice(0,Math.max(0,d));if(g==="at-most"||g==="at-least")return`${o.label}: ${g==="at-most"?"at most":"at least"} ${E(e.tryDefinition(u.kind),o.key,Number(a.value.slice(d+1)))}`}return o.type==="text"?`${o.label}: ${a.value}`:`${o.label}: ${E(e.tryDefinition(u.kind),o.key,a.value)}`}var I=e=>/^[A-Z][a-z]/.test(e)?e.charAt(0).toLowerCase()+e.slice(1):e;function ne(e){return e?.type==="date"?{asc:"Earliest first",desc:"Latest first"}:e?.type==="number"?{asc:"Lowest first",desc:"Highest first"}:e?.type==="boolean"?{asc:"No first",desc:"Yes first"}:e?.type==="choice"?{asc:"In their order",desc:"In reverse order"}:{asc:"A to Z",desc:"Z to A"}}var $=_(z(()=>import("./chunk.JE4VH767.js"))),x=$.part((e,n)=>(0,r.jsx)(e.ArrangeLists,{...n}),{what:"This list",quiet:!0}),fe=()=>$.load(),O=new Map;function ye(e){let{schema:n,graph:u,kind:a,arrangement:o,onChange:d}=e,g=F(n,a),s=e.testId??"arrange",c=k(e.allow,"sort")&&g.sorts.length>1,f=k(e.allow,"group")&&g.groups.length>0,m=k(e.allow,"filter")&&g.filters.length>0,R=e.query!==!1&&e.allow!==!1,v=te(e.noun,e.kept);if(!c&&!f&&!m&&!R&&!v)return null;let D=t=>JSON.stringify(K(t)),N=`${s}|${a}`,p={current:O.get(N)??{words:new Set,latest:null,at:0}};O.set(N,p.current),p.current.latest&&Date.now()-p.current.at>1500&&!p.current.words.has(D(o))&&(p.current={words:new Set,latest:null,at:0},O.set(N,p.current));let i=p.current.latest??o,h=t=>{let l={...p.current.latest??o,...t};for(let w of Object.keys(l))l[w]===void 0&&delete l[w];p.current.latest=l,p.current.at=Date.now(),p.current.words.add(D(l)),d(l)},y=i.filter??[],P=t=>{let l=y.filter((w,Q)=>Q!==t);h({filter:l.length>0?l:void 0})},T=t=>y.some(l=>l.key===t.key&&l.value===t.value),Y=t=>T(t)?P(y.findIndex(l=>l.key===t.key&&l.value===t.value)):h({filter:[...y,t]}),C=i.sort?g.sorts.find(t=>t.key===i.sort.by):void 0,q=i.group?g.groups.find(t=>t.key===i.group.by):void 0,Z=ne(C),b={schema:n,graph:u,offers:g,arrangement:i,set:h,toggle:Y,has:T,testId:s},V=i.sort?(0,r.jsxs)(r.Fragment,{children:["Sorted by ",I(C?.label??i.sort.by),(0,r.jsx)("span",{"aria-hidden":"true",children:i.sort.direction==="desc"?" \u2193":" \u2191"})]}):"Sort",J=i.group?.bucket&&q?.buckets?`, a ${i.group.bucket} each`:"",H=i.group?`Grouped by ${I(q?.label??i.group.by)}${J}`:"Group";return(0,r.jsxs)("div",{"data-testid":`${s}-bar`,role:"group","aria-label":"Arrange",className:"graview-arrange",style:e.style,onPointerEnter:$.prefetch,onFocus:$.prefetch,children:[(0,r.jsx)("style",{children:ie}),(0,r.jsxs)("div",{className:"graview-arrange-line",children:[v?(0,r.jsxs)("span",{className:"graview-arrange-count","data-testid":`${s}-count`,children:[v.kept?(0,r.jsx)("span",{"data-testid":`${s}-kept`,children:v.kept}):null,v.words]}):null,c?(0,r.jsx)("span",{className:"graview-arrange-part graview-arrange-one",children:(0,r.jsx)(A,{testId:`${s}-sort`,value:i.sort?.by??"",set:i.sort!==void 0,label:"Sort",name:i.sort?`Sorted by ${I(C?.label??i.sort.by)}, ${Z[i.sort.direction].toLowerCase()}`:"Sort",list:t=>(0,r.jsx)(x,{which:"sort",done:t,...b}),children:V})}):null,f?(0,r.jsx)("span",{className:"graview-arrange-part graview-arrange-one",children:(0,r.jsx)(A,{testId:`${s}-group`,value:i.group?.by??"",set:i.group!==void 0,label:"Group",name:H,list:t=>(0,r.jsx)(x,{which:"group",done:t,...b}),children:H})}):null,m?(0,r.jsx)("span",{className:"graview-arrange-part graview-arrange-one",children:(0,r.jsx)(A,{testId:`${s}-add`,value:"",set:!1,label:"Filter",name:y.length>0?`Filter \u2014 ${y.length} on`:"Filter",list:t=>(0,r.jsx)(x,{which:"filter",done:t,...b}),children:"Filter"})}):null,c||f||m?(0,r.jsx)("span",{className:"graview-arrange-part graview-arrange-all",children:(0,r.jsx)(A,{testId:`${s}-all`,value:"",set:!1,label:"Arrange",name:"Arrange: sort, group and filter",list:t=>(0,r.jsx)(x,{which:"all",done:t,parts:{sort:c,group:f,filter:m},...b}),children:"Arrange"})}):null,y.map((t,l)=>{let w=re(n,u,g,t);return(0,r.jsxs)("span",{className:"graview-arrange-token","data-testid":`${s}-condition`,children:[w,(0,r.jsx)("button",{type:"button","aria-label":`Remove: ${w}`,title:"Remove",onClick:()=>P(l),children:"\xD7"})]},`${t.key}:${t.value}`)}),R?(0,r.jsxs)("label",{className:"graview-arrange-words-at",children:[(0,r.jsx)("span",{style:U,children:"Find"}),(0,r.jsx)("input",{type:"search",className:"graview-arrange-words","data-testid":`${s}-query`,value:i.query??"",placeholder:"Find\u2026",onChange:t=>h({query:t.target.value.length>0?t.target.value:void 0})})]}):null]})]})}function te(e,n){if(!n)return null;let u=n.shown!==n.of;if(!e)return u?{words:"",kept:`${n.shown} of ${n.of}`}:null;let a=n.of===1?e.one:e.many;return u?{words:` ${a}`,kept:`${n.shown} of ${n.of}`}:{words:`${n.of} ${a}`}}function A({testId:e,value:n,set:u,label:a,name:o,list:d,children:g}){let s=W("arrange",{align:"start"}),c=(0,S.useRef)(null);return(0,S.useEffect)(()=>{s.open&&c.current?.querySelector('[aria-pressed="true"]')?.focus({preventScroll:!0})},[s.open]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{type:"button",className:"graview-arrange-open","data-testid":e,"data-set":u?"":void 0,value:n,"aria-label":o,...s.trigger,onClick:s.toggle,children:[g,(0,r.jsx)(oe,{})]}),s.open?(0,r.jsx)("div",{...s.pane,ref:f=>{s.pane.ref(f),c.current=f},role:"group","aria-label":a,"data-testid":"arrange-list","data-arrange":e,className:"graview-arrange-list",style:j,onKeyDown:ae,children:d(()=>s.setOpen(!1))}):null]})}function ae(e){if(!["ArrowDown","ArrowUp","Home","End"].includes(e.key))return;let n=[...e.currentTarget.querySelectorAll("button:not([disabled]), input")];if(n.length===0)return;let u=n.indexOf(document.activeElement);if(document.activeElement instanceof HTMLInputElement&&(e.key==="ArrowUp"||e.key==="ArrowDown"))return;e.preventDefault();let a=e.key==="Home"?0:e.key==="End"?n.length-1:e.key==="ArrowDown"?(u+1)%n.length:(u-1+n.length)%n.length;n[a].focus()}function oe(){return(0,r.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 10 10","aria-hidden":"true",focusable:"false",style:{flex:"0 0 auto",opacity:.7},children:(0,r.jsx)("path",{d:"M2 3.5 L5 6.5 L8 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}var ie=`
1
+ import{a as k,b as K}from"./chunk.JCZH55RX.js";import{Ba as U,a as z,ua as j,xa as W,ya as _}from"./chunk.2WFEFZAW.js";import{E as M,J as G,N as E,za as F}from"./chunk.RAE4M3KQ.js";import{a as X,b as B}from"./chunk.MRK6QJV5.js";import{b as L}from"./chunk.AJZBJBMO.js";var S=L(X(),1);var r=L(B(),1),ee=520;function re(e,n,u,a){let o=u.filters.find(d=>d.key===a.key);if(!o)return`${a.key}: ${a.value}`;if(o.about==="is")return a.value.charAt(0).toUpperCase()+a.value.slice(1);if(o.about==="edge"){if(a.value==="*")return`${o.label}: anything`;if(a.value==="none")return`${o.label}: nothing`;let d=n.getNode(a.value);return`${o.label}: ${d?G(e.tryDefinition(d.kind),d):a.value}`}if(o.type==="date"){let[d,g]=a.value.split(":");return`${o.label} ${d} ${g?M(g):""}`.trim()}if(o.type==="boolean")return`${o.label}: ${a.value==="true"?"yes":"no"}`;if(o.type==="number"){let d=a.value.lastIndexOf(":"),g=a.value.slice(0,Math.max(0,d));if(g==="at-most"||g==="at-least")return`${o.label}: ${g==="at-most"?"at most":"at least"} ${E(e.tryDefinition(u.kind),o.key,Number(a.value.slice(d+1)))}`}return o.type==="text"?`${o.label}: ${a.value}`:`${o.label}: ${E(e.tryDefinition(u.kind),o.key,a.value)}`}var I=e=>/^[A-Z][a-z]/.test(e)?e.charAt(0).toLowerCase()+e.slice(1):e;function ne(e){return e?.type==="date"?{asc:"Earliest first",desc:"Latest first"}:e?.type==="number"?{asc:"Lowest first",desc:"Highest first"}:e?.type==="boolean"?{asc:"No first",desc:"Yes first"}:e?.type==="choice"?{asc:"In their order",desc:"In reverse order"}:{asc:"A to Z",desc:"Z to A"}}var $=_(z(()=>import("./chunk.KUTTVYOB.js"))),x=$.part((e,n)=>(0,r.jsx)(e.ArrangeLists,{...n}),{what:"This list",quiet:!0}),fe=()=>$.load(),O=new Map;function ye(e){let{schema:n,graph:u,kind:a,arrangement:o,onChange:d}=e,g=F(n,a),s=e.testId??"arrange",c=k(e.allow,"sort")&&g.sorts.length>1,f=k(e.allow,"group")&&g.groups.length>0,m=k(e.allow,"filter")&&g.filters.length>0,R=e.query!==!1&&e.allow!==!1,v=te(e.noun,e.kept);if(!c&&!f&&!m&&!R&&!v)return null;let D=t=>JSON.stringify(K(t)),N=`${s}|${a}`,p={current:O.get(N)??{words:new Set,latest:null,at:0}};O.set(N,p.current),p.current.latest&&Date.now()-p.current.at>1500&&!p.current.words.has(D(o))&&(p.current={words:new Set,latest:null,at:0},O.set(N,p.current));let i=p.current.latest??o,h=t=>{let l={...p.current.latest??o,...t};for(let w of Object.keys(l))l[w]===void 0&&delete l[w];p.current.latest=l,p.current.at=Date.now(),p.current.words.add(D(l)),d(l)},y=i.filter??[],P=t=>{let l=y.filter((w,Q)=>Q!==t);h({filter:l.length>0?l:void 0})},T=t=>y.some(l=>l.key===t.key&&l.value===t.value),Y=t=>T(t)?P(y.findIndex(l=>l.key===t.key&&l.value===t.value)):h({filter:[...y,t]}),C=i.sort?g.sorts.find(t=>t.key===i.sort.by):void 0,q=i.group?g.groups.find(t=>t.key===i.group.by):void 0,Z=ne(C),b={schema:n,graph:u,offers:g,arrangement:i,set:h,toggle:Y,has:T,testId:s},V=i.sort?(0,r.jsxs)(r.Fragment,{children:["Sorted by ",I(C?.label??i.sort.by),(0,r.jsx)("span",{"aria-hidden":"true",children:i.sort.direction==="desc"?" \u2193":" \u2191"})]}):"Sort",J=i.group?.bucket&&q?.buckets?`, a ${i.group.bucket} each`:"",H=i.group?`Grouped by ${I(q?.label??i.group.by)}${J}`:"Group";return(0,r.jsxs)("div",{"data-testid":`${s}-bar`,role:"group","aria-label":"Arrange",className:"graview-arrange",style:e.style,onPointerEnter:$.prefetch,onFocus:$.prefetch,children:[(0,r.jsx)("style",{children:ie}),(0,r.jsxs)("div",{className:"graview-arrange-line",children:[v?(0,r.jsxs)("span",{className:"graview-arrange-count","data-testid":`${s}-count`,children:[v.kept?(0,r.jsx)("span",{"data-testid":`${s}-kept`,children:v.kept}):null,v.words]}):null,c?(0,r.jsx)("span",{className:"graview-arrange-part graview-arrange-one",children:(0,r.jsx)(A,{testId:`${s}-sort`,value:i.sort?.by??"",set:i.sort!==void 0,label:"Sort",name:i.sort?`Sorted by ${I(C?.label??i.sort.by)}, ${Z[i.sort.direction].toLowerCase()}`:"Sort",list:t=>(0,r.jsx)(x,{which:"sort",done:t,...b}),children:V})}):null,f?(0,r.jsx)("span",{className:"graview-arrange-part graview-arrange-one",children:(0,r.jsx)(A,{testId:`${s}-group`,value:i.group?.by??"",set:i.group!==void 0,label:"Group",name:H,list:t=>(0,r.jsx)(x,{which:"group",done:t,...b}),children:H})}):null,m?(0,r.jsx)("span",{className:"graview-arrange-part graview-arrange-one",children:(0,r.jsx)(A,{testId:`${s}-add`,value:"",set:!1,label:"Filter",name:y.length>0?`Filter \u2014 ${y.length} on`:"Filter",list:t=>(0,r.jsx)(x,{which:"filter",done:t,...b}),children:"Filter"})}):null,c||f||m?(0,r.jsx)("span",{className:"graview-arrange-part graview-arrange-all",children:(0,r.jsx)(A,{testId:`${s}-all`,value:"",set:!1,label:"Arrange",name:"Arrange: sort, group and filter",list:t=>(0,r.jsx)(x,{which:"all",done:t,parts:{sort:c,group:f,filter:m},...b}),children:"Arrange"})}):null,y.map((t,l)=>{let w=re(n,u,g,t);return(0,r.jsxs)("span",{className:"graview-arrange-token","data-testid":`${s}-condition`,children:[w,(0,r.jsx)("button",{type:"button","aria-label":`Remove: ${w}`,title:"Remove",onClick:()=>P(l),children:"\xD7"})]},`${t.key}:${t.value}`)}),R?(0,r.jsxs)("label",{className:"graview-arrange-words-at",children:[(0,r.jsx)("span",{style:U,children:"Find"}),(0,r.jsx)("input",{type:"search",className:"graview-arrange-words","data-testid":`${s}-query`,value:i.query??"",placeholder:"Find\u2026",onChange:t=>h({query:t.target.value.length>0?t.target.value:void 0})})]}):null]})]})}function te(e,n){if(!n)return null;let u=n.shown!==n.of;if(!e)return u?{words:"",kept:`${n.shown} of ${n.of}`}:null;let a=n.of===1?e.one:e.many;return u?{words:` ${a}`,kept:`${n.shown} of ${n.of}`}:{words:`${n.of} ${a}`}}function A({testId:e,value:n,set:u,label:a,name:o,list:d,children:g}){let s=W("arrange",{align:"start"}),c=(0,S.useRef)(null);return(0,S.useEffect)(()=>{s.open&&c.current?.querySelector('[aria-pressed="true"]')?.focus({preventScroll:!0})},[s.open]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{type:"button",className:"graview-arrange-open","data-testid":e,"data-set":u?"":void 0,value:n,"aria-label":o,...s.trigger,onClick:s.toggle,children:[g,(0,r.jsx)(oe,{})]}),s.open?(0,r.jsx)("div",{...s.pane,ref:f=>{s.pane.ref(f),c.current=f},role:"group","aria-label":a,"data-testid":"arrange-list","data-arrange":e,className:"graview-arrange-list",style:j,onKeyDown:ae,children:d(()=>s.setOpen(!1))}):null]})}function ae(e){if(!["ArrowDown","ArrowUp","Home","End"].includes(e.key))return;let n=[...e.currentTarget.querySelectorAll("button:not([disabled]), input")];if(n.length===0)return;let u=n.indexOf(document.activeElement);if(document.activeElement instanceof HTMLInputElement&&(e.key==="ArrowUp"||e.key==="ArrowDown"))return;e.preventDefault();let a=e.key==="Home"?0:e.key==="End"?n.length-1:e.key==="ArrowDown"?(u+1)%n.length:(u-1+n.length)%n.length;n[a].focus()}function oe(){return(0,r.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 10 10","aria-hidden":"true",focusable:"false",style:{flex:"0 0 auto",opacity:.7},children:(0,r.jsx)("path",{d:"M2 3.5 L5 6.5 L8 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}var ie=`
2
2
  .graview-arrange{container-type:inline-size;box-sizing:border-box;width:100%;min-width:0;max-width:100%}
3
3
  .graview-arrange-line{display:flex;flex-wrap:wrap;align-items:center;gap:2px 6px;min-width:0;font-size:.875rem;line-height:1.35;color:var(--graview-ink-muted)}
4
4
  .graview-arrange-count{margin-right:2px;color:var(--graview-ink-muted)}