graview 0.1.27 → 0.1.29

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 (167) hide show
  1. package/dist/preview/chunk.2643W7FT.js +1 -0
  2. package/dist/preview/chunk.2CLPRG3I.js +1 -0
  3. package/dist/preview/chunk.2IZFIORK.js +1 -0
  4. package/dist/preview/chunk.2NCTM5K2.js +2 -0
  5. package/dist/preview/{chunk.5BN2ARQ2.js → chunk.3G5MQFZK.js} +1 -1
  6. package/dist/preview/chunk.3JM2TNDD.js +2 -0
  7. package/dist/preview/chunk.44FVJOK4.js +28 -0
  8. package/dist/preview/chunk.4GGAPOMK.js +2 -0
  9. package/dist/preview/chunk.5AT4O4BN.js +1 -0
  10. package/dist/preview/chunk.5JXUAMKI.js +1 -0
  11. package/dist/preview/chunk.5R66YTET.js +2 -0
  12. package/dist/preview/chunk.64P76WK4.js +1 -0
  13. package/dist/preview/chunk.7D77HEIJ.js +1 -0
  14. package/dist/preview/chunk.7DNFXJH3.js +1 -0
  15. package/dist/preview/{chunk.HPD3DSTP.js → chunk.7PRFYYVM.js} +1 -1
  16. package/dist/preview/chunk.AE5GKL4C.js +1 -0
  17. package/dist/preview/chunk.ARR75WBP.js +35 -0
  18. package/dist/preview/chunk.AVUS5LMG.js +3 -0
  19. package/dist/preview/chunk.BKPGDEES.js +1 -0
  20. package/dist/preview/chunk.BZ5OJYHU.js +1 -0
  21. package/dist/preview/chunk.CK7QWLMX.js +1 -0
  22. package/dist/preview/chunk.COTG2IG5.js +1 -0
  23. package/dist/preview/chunk.D4GOVA25.js +1 -0
  24. package/dist/preview/chunk.DAA6XWLF.js +1 -0
  25. package/dist/preview/chunk.DKTCRFMS.js +1 -0
  26. package/dist/preview/chunk.DLGTFXGM.js +1 -0
  27. package/dist/preview/chunk.DN7SN6ZR.js +1 -0
  28. package/dist/preview/chunk.G4WQGTZR.js +3 -0
  29. package/dist/preview/chunk.GDA3G4U2.js +6 -0
  30. package/dist/preview/chunk.GS4T26WW.js +328 -0
  31. package/dist/preview/chunk.GZH6PTXN.js +1 -0
  32. package/dist/preview/chunk.HFKMHLJ3.js +1 -0
  33. package/dist/preview/chunk.HGAMNIST.js +1 -0
  34. package/dist/preview/chunk.HJCQ6I3S.js +1 -0
  35. package/dist/preview/chunk.HKBKH7EK.js +1 -0
  36. package/dist/preview/chunk.HLLWKSZB.js +5 -0
  37. package/dist/preview/chunk.HONUT6OG.js +1 -0
  38. package/dist/preview/chunk.HRWLR7T4.js +1 -0
  39. package/dist/preview/chunk.HV6I74DF.js +1 -0
  40. package/dist/preview/chunk.IPBXAAQV.js +17 -0
  41. package/dist/preview/chunk.IWYUFYDJ.js +1 -0
  42. package/dist/preview/chunk.IZW7DBK4.js +1 -0
  43. package/dist/preview/chunk.J46KDTEZ.js +10 -0
  44. package/dist/preview/chunk.JNGUSAWX.js +70 -0
  45. package/dist/preview/chunk.JU2ZVKMT.js +2 -0
  46. package/dist/preview/chunk.K4ZUVH2G.js +1 -0
  47. package/dist/preview/chunk.KC6UZHBM.js +1 -0
  48. package/dist/preview/chunk.KLITC55P.js +1 -0
  49. package/dist/preview/chunk.KZ2376BD.js +19 -0
  50. package/dist/preview/chunk.LYJAVUST.js +1 -0
  51. package/dist/preview/chunk.MB7LKKUD.js +1 -0
  52. package/dist/preview/chunk.MOUGB4H6.js +1 -0
  53. package/dist/preview/chunk.MYFWM572.js +1 -0
  54. package/dist/preview/chunk.N4FBDA2W.js +1 -0
  55. package/dist/preview/chunk.O42YET3W.js +1 -0
  56. package/dist/preview/chunk.O4QPITBD.js +9 -0
  57. package/dist/preview/{chunk.IXVSJJQH.js → chunk.OGXE2RHC.js} +4 -4
  58. package/dist/preview/chunk.OHE5AMHH.js +0 -0
  59. package/dist/preview/chunk.ONGVH3ZM.js +1076 -0
  60. package/dist/preview/chunk.OQDETV4X.js +1 -0
  61. package/dist/preview/chunk.OWBEV6FR.js +1 -0
  62. package/dist/preview/chunk.OWE6OJ4P.js +1 -0
  63. package/dist/preview/chunk.OYJSFO3A.js +1 -0
  64. package/dist/preview/chunk.P62SKNJS.js +27 -0
  65. package/dist/preview/chunk.PA5HYAEO.js +1 -0
  66. package/dist/preview/{chunk.OA5BVKJH.js → chunk.PMEDLEZY.js} +2 -2
  67. package/dist/preview/chunk.PTXQHHKF.js +1 -0
  68. package/dist/preview/chunk.Q5WEOX3Q.js +1 -0
  69. package/dist/preview/chunk.QNHECGMH.js +1 -0
  70. package/dist/preview/chunk.QSDT2RLY.js +1 -0
  71. package/dist/preview/chunk.R2D373VG.js +1 -0
  72. package/dist/preview/chunk.RB4RTBRZ.js +1 -0
  73. package/dist/preview/chunk.RCLJ4H52.js +116 -0
  74. package/dist/preview/chunk.RKRSRKF3.js +1 -0
  75. package/dist/preview/chunk.RWGLKDWH.js +1 -0
  76. package/dist/preview/chunk.SIL4KD3K.js +1 -0
  77. package/dist/preview/chunk.SS76EIMI.js +1 -0
  78. package/dist/preview/{chunk.IKT7JQUW.js → chunk.T4LY5QXO.js} +1 -1
  79. package/dist/preview/chunk.UIIVEQAT.js +1 -0
  80. package/dist/preview/chunk.UT6642FC.js +1 -0
  81. package/dist/preview/chunk.UTHHX2TJ.js +1 -0
  82. package/dist/preview/chunk.UWNYT7PF.js +1 -0
  83. package/dist/preview/chunk.V6TK4LHW.js +6 -0
  84. package/dist/preview/chunk.VNBO2RXD.js +1 -0
  85. package/dist/preview/chunk.VPPUTA74.js +1 -0
  86. package/dist/preview/chunk.WKXNBHTL.js +4 -0
  87. package/dist/preview/chunk.WLRTPFAC.js +1 -0
  88. package/dist/preview/chunk.X53HI436.js +1 -0
  89. package/dist/preview/chunk.XAXJHEMD.js +1 -0
  90. package/dist/preview/chunk.XDYAG276.js +1 -0
  91. package/dist/preview/chunk.XDZSTIS6.js +88 -0
  92. package/dist/preview/chunk.XXHNV24G.js +1 -0
  93. package/dist/preview/chunk.YCA7P5MK.js +1 -0
  94. package/dist/preview/chunk.YRQZZH5V.js +1 -0
  95. package/dist/preview/chunk.YUWRZWGX.js +1 -0
  96. package/dist/preview/chunk.Z2RGLFLS.js +1 -0
  97. package/dist/preview/chunk.Z56B2JR2.js +25 -0
  98. package/dist/preview/chunk.Z5V23DQN.js +3 -0
  99. package/dist/preview/chunk.ZBXOX3W3.js +1 -0
  100. package/dist/preview/chunk.ZEGSQCSD.js +1 -0
  101. package/dist/preview/chunk.ZEVVWWNA.js +44 -0
  102. package/dist/preview/chunk.ZS4DJ76C.js +1 -0
  103. package/dist/preview/chunk.ZSKP6UQS.js +3 -0
  104. package/dist/preview/page.js +6 -6
  105. package/package.json +6 -6
  106. package/dist/preview/chunk.4HGBVU5B.js +0 -1
  107. package/dist/preview/chunk.4JXWQO6Y.js +0 -1
  108. package/dist/preview/chunk.4R7LDCDO.js +0 -1
  109. package/dist/preview/chunk.4W24TPMR.js +0 -1
  110. package/dist/preview/chunk.6LJ66MB7.js +0 -1
  111. package/dist/preview/chunk.6R4EI47C.js +0 -1
  112. package/dist/preview/chunk.7CO6VP6F.js +0 -1
  113. package/dist/preview/chunk.7QTBDACG.js +0 -1
  114. package/dist/preview/chunk.7SVIRYBB.js +0 -1
  115. package/dist/preview/chunk.7THQFY52.js +0 -1
  116. package/dist/preview/chunk.AHDOKM4O.js +0 -1
  117. package/dist/preview/chunk.AS35X6KA.js +0 -1
  118. package/dist/preview/chunk.ATLUMYAJ.js +0 -23
  119. package/dist/preview/chunk.CW7BMVBG.js +0 -321
  120. package/dist/preview/chunk.DG2UE7PJ.js +0 -1
  121. package/dist/preview/chunk.DG2WKNMX.js +0 -1
  122. package/dist/preview/chunk.DQ5OWYLQ.js +0 -1
  123. package/dist/preview/chunk.DY2FFBWF.js +0 -1
  124. package/dist/preview/chunk.E3SZ7T75.js +0 -1
  125. package/dist/preview/chunk.EVTZE2OZ.js +0 -1
  126. package/dist/preview/chunk.FS5K4AVA.js +0 -8
  127. package/dist/preview/chunk.FTBKJ5RZ.js +0 -16
  128. package/dist/preview/chunk.GHMICJIB.js +0 -1
  129. package/dist/preview/chunk.HO6JR7VY.js +0 -1
  130. package/dist/preview/chunk.I5KD54S6.js +0 -1
  131. package/dist/preview/chunk.IZDKEFPJ.js +0 -1
  132. package/dist/preview/chunk.J36GTQTV.js +0 -1
  133. package/dist/preview/chunk.KAKX5TZN.js +0 -3
  134. package/dist/preview/chunk.LHAAZQNQ.js +0 -19
  135. package/dist/preview/chunk.LQZ2VQWN.js +0 -107
  136. package/dist/preview/chunk.MHJJEGQO.js +0 -1
  137. package/dist/preview/chunk.MNPNW4BQ.js +0 -1
  138. package/dist/preview/chunk.MRK6QJV5.js +0 -25
  139. package/dist/preview/chunk.NKIFVPS3.js +0 -1
  140. package/dist/preview/chunk.NQNQPPPM.js +0 -1
  141. package/dist/preview/chunk.OHGJ5BZ4.js +0 -2
  142. package/dist/preview/chunk.OYULDOQP.js +0 -1
  143. package/dist/preview/chunk.PHY3AH3L.js +0 -1
  144. package/dist/preview/chunk.Q7544RCB.js +0 -1
  145. package/dist/preview/chunk.QZWN46V6.js +0 -1
  146. package/dist/preview/chunk.RUC4HFVC.js +0 -1
  147. package/dist/preview/chunk.S5JWZIVE.js +0 -1
  148. package/dist/preview/chunk.SHDYLMZE.js +0 -2
  149. package/dist/preview/chunk.T2EZ5MTH.js +0 -1
  150. package/dist/preview/chunk.TMPV4HLQ.js +0 -1
  151. package/dist/preview/chunk.TX2GOL65.js +0 -29
  152. package/dist/preview/chunk.U5ZUXGWM.js +0 -1040
  153. package/dist/preview/chunk.UMMN5Z6V.js +0 -1
  154. package/dist/preview/chunk.UPGDSOBY.js +0 -1
  155. package/dist/preview/chunk.V57P4LIZ.js +0 -1
  156. package/dist/preview/chunk.VD6FJ6KJ.js +0 -2
  157. package/dist/preview/chunk.VFICMX5G.js +0 -61
  158. package/dist/preview/chunk.VMD4PDYJ.js +0 -1
  159. package/dist/preview/chunk.VMEX2KZ4.js +0 -8
  160. package/dist/preview/chunk.XDHBV5K5.js +0 -1
  161. package/dist/preview/chunk.YO7UFBJP.js +0 -1
  162. package/dist/preview/chunk.YSYT3ASK.js +0 -1
  163. package/dist/preview/chunk.YV2RTNPU.js +0 -6
  164. package/dist/preview/chunk.ZD5HGRPR.js +0 -1
  165. package/dist/preview/chunk.ZKM4P7US.js +0 -1
  166. package/dist/preview/chunk.ZMMMKTAG.js +0 -1
  167. package/dist/preview/chunk.ZNIJONZN.js +0 -1
@@ -1,19 +0,0 @@
1
- import{a as k,b as K}from"./chunk.QZWN46V6.js";import{a as z,d as U}from"./chunk.6LJ66MB7.js";import{va as j,ya as W,za as _}from"./chunk.OYULDOQP.js";import{F as M,Ga as F,P as G,T as E}from"./chunk.VMEX2KZ4.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.FTBKJ5RZ.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
- .graview-arrange{container-type:inline-size;box-sizing:border-box;width:100%;min-width:0;max-width:100%}
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
- .graview-arrange-count{margin-right:2px;color:var(--graview-ink-muted)}
5
- .graview-arrange-part{display:inline-flex;align-items:center;min-width:0}
6
- .graview-arrange-count~.graview-arrange-part::before{content:"\xB7";margin-right:6px;color:var(--graview-ink-muted)}
7
- .graview-arrange-open{display:inline-flex;align-items:center;gap:5px;min-height:28px;min-width:0;max-width:100%;margin:0;padding:0 6px;border:1px solid transparent;border-radius:7px;background:none;box-shadow:none;font:inherit;letter-spacing:normal;text-transform:none;text-align:left;color:var(--graview-ink-muted);cursor:pointer}
8
- .graview-arrange-open[data-set]{color:var(--graview-ink)}
9
- .graview-arrange-open:hover,.graview-arrange-open[aria-expanded=true]{border-color:var(--graview-edge);color:var(--graview-ink)}
10
- .graview-arrange :focus-visible,.graview-arrange-list :focus-visible{outline:2px solid var(--graview-accent);outline-offset:1px}
11
- .graview-arrange-all{display:none}
12
- @container (max-width: ${ee-1}px){.graview-arrange-one{display:none}.graview-arrange-all{display:inline-flex}}
13
- .graview-arrange-token{display:inline-flex;align-items:center;gap:0;min-width:0;padding-left:6px;color:var(--graview-ink);overflow-wrap:anywhere}
14
- .graview-arrange-token button{display:inline-flex;align-items:center;justify-content:center;min-width:24px;min-height:24px;margin:0;padding:0;border:0;border-radius:6px;background:none;font:inherit;line-height:1;color:var(--graview-ink-muted);cursor:pointer}
15
- .graview-arrange-token button:hover{color:var(--graview-ink);background:color-mix(in srgb,var(--graview-ink) 7%,transparent)}
16
- .graview-arrange-words-at{display:inline-flex;min-width:0;max-width:100%}
17
- .graview-arrange-words{box-sizing:border-box;width:min(100%,12rem);min-height:28px;margin:0;padding:0 8px;border:1px solid transparent;border-radius:7px;background:transparent;font:inherit;color:var(--graview-ink)}
18
- .graview-arrange-words:hover,.graview-arrange-words:focus{border-color:var(--graview-edge)}
19
- `;function we(e){let n=[];return e.query&&n.push(`\u201C${e.query}\u201D`),e.filter?.length&&n.push(`${e.filter.length} condition${e.filter.length===1?"":"s"}`),e.group&&n.push(`by ${e.group.by}`),e.sort&&n.push(`sorted by ${e.sort.by}`),n.length>0?n.join(" \xB7 "):null}export{ee as a,re as b,I as c,ne as d,fe as e,ye as f,we as g};
@@ -1,107 +0,0 @@
1
- import{A as he,B as ke,C as ta,D as At,E as pe,F as na,G as aa,H as L,I as De,J as Lt,K as ra,L as Tt,M as it,N as ia,O as U,P as J,Q as Mt,a as G,b as ye,c as q,d as Qn,e as Pe,f as Ne,g as D,h as ne,i as Y,j as k,k as _,l as F,m as X,n as tt,o as ee,p as Xn,q as nt,r as at,s as I,t as Ce,u as Zn,v as rt,w as le,x as ea,y as de,z as Rt}from"./chunk.TX2GOL65.js";import{b as et,d as V}from"./chunk.T2EZ5MTH.js";import{a as _n,d as Yn,e as Jn}from"./chunk.ONDILMIX.js";import{a as Un,e as jn}from"./chunk.AS35X6KA.js";import{a as Ct}from"./chunk.I5KD54S6.js";import{a as Ze,b as qn}from"./chunk.NQNQPPPM.js";import{a as Pt,b as In,d as Hn,f as zn,g as Bn,h as Gn,k as Xe}from"./chunk.KAKX5TZN.js";import{a as Na}from"./chunk.IKT7JQUW.js";import{h as $n,i as En}from"./chunk.CW7BMVBG.js";import{e as Wn,i as Vn}from"./chunk.IZDKEFPJ.js";import{o as bt}from"./chunk.XDHBV5K5.js";import{c as Fn,d as On,j as We}from"./chunk.UMMN5Z6V.js";import{a as Qe,b as Ln,c as Tn,e as St,f as Mn}from"./chunk.7QTBDACG.js";import{e as xe}from"./chunk.4W24TPMR.js";import{f as Kn}from"./chunk.LHAAZQNQ.js";import{b as Nn,c as xt,d as Dn}from"./chunk.QZWN46V6.js";import{a as wn,c as An}from"./chunk.6LJ66MB7.js";import{$ as bn,B as He,V as kn,X as Sn,aa as xn,ea as se,ia as Pn,ka as Ee,la as Cn,ua as Rn,x as vn}from"./chunk.OYULDOQP.js";import{$ as an,$a as Ye,$b as hn,Fa as ln,Ga as dn,Gb as fn,Ia as pn,N as $e,O as _e,P as re,Q as Zt,S as ie,U as en,W as tn,Wa as cn,Wb as kt,Xa as gn,Xb as yn,Z as nn,Za as un,_ as be,aa as rn,ab as mn,cb as Je,ka as vt,la as on,qa as sn}from"./chunk.VMEX2KZ4.js";import{a as ve,b as B}from"./chunk.MRK6QJV5.js";import{b as $}from"./chunk.AJZBJBMO.js";function oa(t,e,n={}){let r=t.graph.getNode(e);if(!r)return;let i=t.schema.tryDefinition(r.kind),a=s=>re(t.schema.tryDefinition(s.kind),s),d=new Map;for(let s of t.graph.allEdges()){let l=s.from===e?"out":s.to===e?"in":null;if(!l)continue;let o=l==="out"?s.to:s.from,c=t.graph.getNode(o);if(!c)continue;let u=(l==="out"?i:t.schema.tryDefinition(c.kind))?.edges?.[s.kind],g=l==="in"?u?.inverse??u?.description:u?.description,m=`${s.kind}|${l}|${g??""}`;(d.get(m)??(()=>{let E={edgeKind:s.kind,direction:l,...g?{description:g}:{},targets:[]};return d.set(m,E),E})()).targets.push({id:c.id,kind:c.kind,label:a(c)})}return{id:e,kind:r.kind,label:a(r),fields:an(We(t.schema,t.graph,r),i),violations:vt(t.violations(n.context),[e]),actions:Ct(t,[e],{focus:e,...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}}),links:[...d.values()].map(s=>{let l=_e(s.targets.flatMap(o=>{let c=t.graph.getNode(o.id);return c?[c]:[]}),o=>t.schema.tryDefinition(o));return{...s,targets:[...s.targets].map(o=>l.has(o.id)?{...o,apart:l.get(o.id)}:o).sort((o,c)=>o.label.localeCompare(c.label))}})}}function Re(t,e,n={}){return{kind:e,members:t.graph.nodesOfKind(e),actions:Ct(t,[],{kindSelection:[e],...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}})}}function sa(t,e){let n=(a,d)=>`${a}|${JSON.stringify(d)}`,r=new Map;for(let a of[...t.affordances,...t.withheld]){if(a.provider!=="invariant")continue;let d=n(a.mutation,a.args);r.has(d)||r.set(d,a.rank??Number.MAX_SAFE_INTEGER)}let i=Number.MAX_SAFE_INTEGER;return[...e].map((a,d)=>({repair:a,declared:d})).sort((a,d)=>(r.get(n(a.repair.mutation,a.repair.args??{}))??i)-(r.get(n(d.repair.mutation,d.repair.args??{}))??i)||a.declared-d.declared).map(a=>a.repair)}function Ae(t){let e=t.schema.kinds.map(i=>({kind:i,plural:tn(t.schema,i),count:t.graph.nodesOfKind(i).length})),n=new Map;for(let i of t.graph.allEdges()){let a=t.graph.getNode(i.from),d=t.graph.getNode(i.to);if(!a||!d)continue;let s=`${i.kind}|${a.kind}|${d.kind}`;n.set(s,(n.get(s)??0)+1)}let r=[];for(let{kind:i}of e){let a=t.schema.tryDefinition(i)?.edges??{};for(let[d,s]of Object.entries(a)){let l=s.to==="*"||s.to===void 0?(()=>{let o=[...n.keys()].filter(c=>c.startsWith(`${d}|${i}|`)).map(c=>c.split("|")[2]);return o.length>0?o:["*"]})():s.to;for(let o of l)r.push({edgeKind:d,from:i,to:o,...s.description?{description:s.description}:{},...s.inverse?{inverse:s.inverse}:{},count:n.get(`${d}|${i}|${o}`)??0})}}return{kinds:e,relations:r}}var Te=$(ve(),1);var Ft=$(ve(),1),S=$(B(),1),Da=`
2
- form:where([data-graview-part="form"]) {
3
- /* A grid item of the section above it and a grid container for the
4
- fields below: both halves are allowed to be narrower than what is in
5
- them, or a big enough text size pushes the page sideways. See the note
6
- on \`column\` in pages.tsx. */
7
- display: grid;
8
- grid-template-columns: minmax(0, 1fr);
9
- min-width: 0;
10
- gap: 12px;
11
- }
12
- label:where([data-graview-part="field"]) {
13
- display: grid;
14
- /* A track the width it was given: see the note on \`column\` in pages.tsx. */
15
- grid-template-columns: minmax(0, 1fr);
16
- min-width: 0;
17
- gap: 4px;
18
- }
19
- label:where([data-graview-part="field"][data-graview-field="boolean"]) {
20
- grid-auto-flow: column;
21
- justify-content: start;
22
- align-items: center;
23
- }
24
- span:where([data-graview-part="label"]),
25
- legend:where([data-graview-part="label"]),
26
- p:where([data-graview-part="unasked"]) {
27
- font-size: 0.8125rem;
28
- color: var(--graview-ink-muted);
29
- }
30
- p:where([data-graview-part="unasked"]) { margin: 0; }
31
- input:where([data-graview-part="control"]:not([type="checkbox"])),
32
- select:where([data-graview-part="control"]) {
33
- font: inherit;
34
- /* A TARGET IN EVERY ENGINE, not only in the one it was measured in.
35
- Padding and line height alone came to 24 in Chromium and to 22 in
36
- WebKit, which has its own intrinsic metrics for a \`select\` and rounds
37
- nothing up for anybody. So every picker on the routed face was under
38
- the WCAG 2.2 minimum in the browser iOS ships, and the check that says
39
- so (\`verify-pages\`' \`bigEnoughToHit\`) only ever ran there through
40
- \`pnpm engines\`. */
41
- min-height: 24px;
42
- /* NEVER WIDER THAN ITS FIELD. A select is as wide as its longest option,
43
- and a picker over 320 vehicles ("2027 Mercedes-Benz GLE AMG 53 4MATIC+
44
- Coupe") was 618 pixels on a 390 phone, and the whole page scrolled
45
- sideways. It shrinks to its track and cuts the option inside its box. */
46
- min-width: 0;
47
- max-width: 100%;
48
- text-overflow: ellipsis;
49
- box-sizing: border-box;
50
- padding: 7px 10px;
51
- border-radius: 8px;
52
- border: 1px solid var(--graview-edge);
53
- background: var(--graview-panel);
54
- color: var(--graview-ink);
55
- }
56
- /* A PICKER THAT STILL LOOKS LIKE ONE.
57
- WebKit ignores an author's padding and minimum height on a \`select\`
58
- while the native appearance is on \u2014 so every picker on the routed face
59
- came out 22 pixels tall in the browser iOS ships, under the 24 WCAG 2.2
60
- asks for, while the same element measured 35 in Chromium. Turning the
61
- appearance off is what makes the box the size it was asked to be, and it
62
- takes the platform's chevron with it; the chevron is put back, in the ink
63
- the scheme is already using. */
64
- span:where([data-graview-part="picker"]) {
65
- position: relative;
66
- display: grid;
67
- min-width: 0;
68
- }
69
- span:where([data-graview-part="picker"]) > select:where([data-graview-part="control"]) {
70
- appearance: none;
71
- padding-right: 28px;
72
- }
73
- span:where([data-graview-part="chevron"]) {
74
- position: absolute;
75
- right: 10px;
76
- top: 50%;
77
- transform: translateY(-50%);
78
- font-size: 0.75rem;
79
- line-height: 1;
80
- color: var(--graview-ink-muted);
81
- pointer-events: none;
82
- }
83
- fieldset:where([data-graview-part="group"]) {
84
- display: grid;
85
- gap: 10px;
86
- border: 1px solid var(--graview-edge);
87
- border-radius: 10px;
88
- padding: 12px;
89
- }
90
- fieldset:where([data-graview-part="group"][data-graview-field="list"]) { gap: 8px; }
91
- div:where([data-graview-part="item"]) {
92
- display: flex;
93
- gap: 8px;
94
- align-items: end;
95
- }
96
- button:where([data-graview-part="add"]),
97
- button:where([data-graview-part="submit"]) { justify-self: start; }
98
- p:where([data-graview-part="refused"]) {
99
- margin: 0;
100
- color: var(--graview-warn);
101
- font-size: 0.875rem;
102
- }
103
- `;function la({children:t}){return(0,S.jsxs)("span",{"data-graview-part":"picker",children:[t,(0,S.jsx)("span",{"aria-hidden":"true","data-graview-part":"chevron",children:"\u25BE"})]})}var Ia=t=>({label:ie(t),option:e=>e});function ot({store:t,spec:e,value:n,onChange:r,prefilled:i,open:a,words:d=Ia}){if(e.name in i&&e.control!=="group"&&e.control!=="variant")return null;let s=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(o=>ie(be(t.schema.tryDefinition(o),o))).join(" or "):d(e.name).label,l=s+(e.optional||e.control==="boolean"?"":" *");switch(e.control){case"text":case"date":return e.control==="text"&&e.long?(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":"text",children:[(0,S.jsx)("span",{"data-graview-part":"label",children:l}),(0,S.jsx)("textarea",{name:e.name,required:!e.optional,rows:6,value:typeof n=="string"?n:"",onChange:o=>r(o.target.value),"data-graview-part":"control",style:{fieldSizing:"content",minHeight:"7.5em",resize:"vertical",font:"inherit",lineHeight:1.5}})]}):(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,S.jsx)("span",{"data-graview-part":"label",children:l}),(0,S.jsx)("input",{type:e.control==="date"?e.time?"datetime-local":"date":"text",name:e.name,required:!e.optional,value:typeof n=="string"?n:"",onChange:o=>r(o.target.value),"data-graview-part":"control"})]});case"number":return(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,S.jsx)("span",{"data-graview-part":"label",children:l}),(0,S.jsx)("input",{type:"number",name:e.name,required:!e.optional,...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max},...e.step===void 0?{}:{step:e.step},value:typeof n=="number"?n:"",onChange:o=>r(o.target.value===""?void 0:Number(o.target.value)),"data-graview-part":"control"})]});case"boolean":return(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":"boolean",children:[(0,S.jsx)("input",{type:"checkbox",name:e.name,checked:n===!0,onChange:o=>r(o.target.checked),"data-graview-part":"control"}),(0,S.jsx)("span",{"data-graview-part":"label",children:l})]});case"choice":return(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,S.jsx)("span",{"data-graview-part":"label",children:l}),(0,S.jsx)(la,{children:(0,S.jsxs)("select",{name:e.name,required:!e.optional,value:typeof n=="string"?n:"",onChange:o=>r(o.target.value||void 0),"data-graview-part":"control",children:[(0,S.jsx)("option",{value:"",children:"\u2014"}),(e.options??[]).map(o=>(0,S.jsx)("option",{value:o,children:d(e.name).option(o)},o))]})})]});case"node":{let o=a.find(m=>m.name===e.name)?.candidates,c=new Set(Object.values(i).filter(m=>typeof m=="string")),f=(e.kinds.includes("*")?[...t.graph.allNodes()]:e.kinds.flatMap(m=>t.graph.nodesOfKind(m))).filter(m=>!c.has(m.id)),u=o?o.map(m=>t.graph.getNode(m)).filter(m=>m!==void 0):f,g=_e(u,m=>t.schema.tryDefinition(m));return(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,S.jsx)("span",{"data-graview-part":"label",children:l}),(0,S.jsx)(la,{children:(0,S.jsxs)("select",{name:e.name,required:!e.optional,value:typeof n=="string"?n:"",onChange:m=>r(m.target.value||void 0),"data-graview-part":"control",children:[(0,S.jsx)("option",{value:"",children:"\u2014"}),u.map(m=>{let x=g.get(m.id);return(0,S.jsxs)("option",{value:m.id,children:[re(t.schema.tryDefinition(m.kind),m),x?` \xB7 ${x}`:""]},m.id)})]})})]})}case"group":{let o=n??{};return(0,S.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.control,children:[(0,S.jsx)("legend",{"data-graview-part":"label",children:l}),e.fields.map(c=>(0,S.jsx)(ot,{store:t,spec:c,value:o[c.name],onChange:f=>r({...o,[c.name]:f}),prefilled:i,open:a,words:d},c.name))]})}case"variant":{let o=n??{},c=typeof o[e.tag]=="string"?o[e.tag]:"",f=e.options.find(u=>u.value===c);return(0,S.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.control,children:[(0,S.jsx)("legend",{"data-graview-part":"label",children:l}),(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":"choice",children:[(0,S.jsx)("span",{"data-graview-part":"label",children:ie(e.tag)}),(0,S.jsxs)("select",{value:c,onChange:u=>r({[e.tag]:u.target.value}),"data-graview-part":"control",children:[(0,S.jsx)("option",{value:"",children:"\u2014"}),e.options.map(u=>(0,S.jsx)("option",{value:u.value,children:ie(u.value)},u.value))]})]}),f?.fields.map(u=>(0,S.jsx)(ot,{store:t,spec:u,value:o[u.name],onChange:g=>r({...o,[u.name]:g}),prefilled:i,open:a,words:d},u.name))]})}case"file":case"list":{let o=e.control==="file"?e:e.item.control==="file"?e.item:void 0;if(o||e.control==="file")return(0,S.jsx)(xe,{as:"control",title:l,value:n,onChange:r,several:o!==e,image:o?.image===!0,label:s});let c=Array.isArray(n)?n:[];return(0,S.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":"list",children:[(0,S.jsx)("legend",{"data-graview-part":"label",children:l}),c.map((f,u)=>(0,S.jsxs)("div",{"data-graview-part":"item",children:[(0,S.jsx)("div",{style:{flex:1},children:(0,S.jsx)(ot,{store:t,spec:{...e.item,optional:!1},value:f,onChange:g=>r(c.map((m,x)=>x===u?g:m)),prefilled:i,open:a,words:d})}),(0,S.jsx)("button",{type:"button","data-graview-part":"remove",onClick:()=>r(c.filter((g,m)=>m!==u)),children:"remove"})]},u)),(0,S.jsx)("button",{type:"button","data-graview-part":"add",onClick:()=>r([...c,void 0]),children:"add another"})]})}case"opaque":return(0,S.jsxs)("p",{"data-graview-part":"unasked",children:["\u201C",ie(e.name),"\u201D needs a structured answer this form cannot ask for yet."]})}}function fe({store:t,mutation:e,prefilled:n={},open:r=[],onDone:i,principal:a,initial:d,label:s,only:l}){let[o,c]=(0,Ft.useState)(()=>({...d})),[f,u]=(0,Ft.useState)(null),g=Ze(e.input).filter(x=>l===void 0||l.includes(x.name)),m=x=>mn(t.schema,e,x);return(0,S.jsxs)("form",{"data-testid":`form-${e.name}`,onSubmit:x=>{x.preventDefault();try{t.apply({name:e.name,args:{...qn(g,o),...n}},a?{author:a}:{}),u(null),c({}),i?.()}catch(E){u(Je(t.schema,t.allMutations(),E))}},"data-graview-part":"form",children:[(0,S.jsx)("style",{children:Da}),g.map(x=>(0,S.jsx)(ot,{store:t,spec:x,value:o[x.name],onChange:E=>c(C=>({...C,[x.name]:E})),prefilled:n,open:r,words:m},x.name)),f?(0,S.jsx)("p",{"data-testid":"refused","data-graview-part":"refused",role:"alert",children:f}):null,(0,S.jsx)("button",{type:"submit","data-graview-part":"submit",children:s??e.title??e.name})]})}var b=$(B(),1);function ce(t){let e=t.views;if(!e)return[];let n=new Set(Ce(t.store,t.principal));return e.places().filter(r=>n.has(r.kind))}var Le=t=>`place:${t.kind}:${t.as}`;function ge(t,e){let n=(t.views?.places()??[]).some(r=>r.as===e.as&&r.kind!==e.kind);return Qn(e.as,n?G(t.store.schema,e.kind):void 0)}function ze(t,e){let n=t.schema.tryDefinition(e);return t.graph.nodesOfKind(e).filter(r=>$e(n,r))}function Ot(t,e,n){let r=(a,d)=>en(t.schema,d,a),i=r(ze(t,e).length,e);return n?`${i} across ${r(ze(t,n).length,n)}`:i}function $t({context:t,place:e,chosen:n}){let{store:r,views:i,invariantContext:a}=t,s=i?.resolve(e.kind,{cardinality:"many",fidelity:"full"},e.as)?.view;if(!s)return null;let l=ze(r,e.kind),o=[...new Set(r.violations(a).flatMap(c=>c.nodeIds))];return(0,b.jsx)(bt,{kind:e.kind,view:e.title,children:(0,b.jsx)(s,{nodes:l,label:e.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...n&&n.length>0?{implicated:n}:{},...o.length>0?{flagged:o}:{}})})}function Ka({store:t,views:e,as:n,invariantContext:r}){V(t);let i={store:t,views:e,...r?{invariantContext:r}:{}},a=e.places().find(d=>d.as===n);return a?(0,b.jsx)($t,{context:i,place:a}):null}function Ha({context:t,kind:e}){let{store:n,views:r,invariantContext:i}=t,a=ze(n,e),d=n.schema.tryDefinition(e),s=I(n,e),o=r?.resolve(e,{cardinality:"many",fidelity:"full"})?.view,c=[...new Set(n.violations(i).flatMap(m=>m.nodeIds))];if(o&&!Ee(o))return(0,b.jsx)(bt,{kind:e,children:(0,b.jsx)(o,{nodes:a,label:s,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...c.length>0?{flagged:c}:{}})});let f=r?.resolve(e,{cardinality:"one",fidelity:"summary"})?.view,u=8,g=a.slice(0,u);return(0,b.jsxs)("div",{"data-testid":"kind-sheet",style:f?{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gridAutoRows:"max-content",alignContent:"center",gap:12,padding:24}:{display:"flex",flexWrap:"wrap",alignContent:"center",justifyContent:"center",gap:10,padding:24},children:[g.map(m=>f?(0,b.jsx)(f,{node:m,fidelity:"summary",cardinality:"one",mode:"fullscreen",selected:!1,...c.includes(m.id)?{flagged:[m.id]}:{}},m.id):(0,b.jsx)("span",{style:{fontSize:"1.0625rem",padding:"8px 14px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:re(d,m)},m.id)),a.length>u?(0,b.jsxs)("span",{style:{...k,alignSelf:"center",padding:"0 6px"},children:["+",a.length-u," more ",s.toLowerCase()]}):null]})}function Et(t){let{store:e}=t,n=Zn(t),r=[...ce(t)].sort((a,d)=>n.indexOf(a.kind)-n.indexOf(d.kind)),i=new Set(r.map(a=>a.kind));return[...r.map(a=>({key:Le(a),kind:a.kind,title:a.title,to:ge(t,a),place:a})),...rt(t).filter(a=>!i.has(a)).map(a=>({key:`kind:${a}`,kind:a,title:I(e,a),to:`/${G(e.schema,a)}`}))]}var da=.72,za=540,pa=16/10;function Ba(t){let e=(0,Te.useRef)(null),[n,r]=(0,Te.useState)(t);return(0,Te.useLayoutEffect)(()=>{let i=e.current;if(!i||typeof ResizeObserver>"u")return;let a=()=>{let s=i.getBoundingClientRect().width;s>0&&r(l=>Math.abs(l-s)<.5?l:s)};a();let d=new ResizeObserver(a);return d.observe(i),()=>d.disconnect()},[]),{ref:e,width:n}}function Wt({context:t,entry:e}){let{store:n,brand:r,principal:i}=t,{ref:a,width:d}=Ba(za),s=d/da,l=ze(n,e.kind),o=n.schema.tryDefinition(e.kind),c=l.length===0?Re(n,e.kind,{...i?{principal:i}:{},...t.invariantContext?{context:t.invariantContext}:{}}).actions.affordances[0]:void 0,f=e.place!==void 0;return(0,b.jsxs)(L,{to:e.to,"data-testid":f?"place-card":"kind-card",className:"graview-gallery-card",style:{...X,display:"grid",gap:10,alignContent:"start",minWidth:0},children:[(0,b.jsxs)("span",{ref:a,"data-testid":f?"place-picture":"kind-picture","aria-hidden":"true",inert:!0,style:{display:"block",position:"relative",width:"100%",aspectRatio:`${pa}`,overflow:"hidden",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",pointerEvents:"none"},children:[(0,b.jsx)("span",{style:{position:"absolute",left:0,top:0,width:s,height:s/pa,display:"grid",gridTemplateRows:"minmax(0, 1fr)",transform:`scale(${da})`,transformOrigin:"0 0"},children:e.place?(0,b.jsx)($t,{context:t,place:e.place}):(0,b.jsx)(Ha,{context:t,kind:e.kind})}),l.length===0?(0,b.jsx)("span",{"data-testid":"picture-empty",style:{position:"absolute",inset:0,display:"grid",placeContent:"center",justifyItems:"center",gap:2,padding:20,textAlign:"center"},children:(0,b.jsxs)("span",{style:{display:"grid",gap:2,padding:"10px 16px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:[(0,b.jsxs)("span",{style:{fontFamily:Pe,fontWeight:600,fontSize:"1.0625rem"},children:["No ",I(n,e.kind).toLowerCase()," yet"]}),c?(0,b.jsxs)("span",{style:k,children:["Begin with \u201C",c.label,"\u201D"]}):null]})}):null]}),(0,b.jsxs)("span",{style:{display:"grid",gap:2,minWidth:0},children:[(0,b.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[f?null:(0,b.jsx)(ee,{kind:e.kind,brand:r,schema:n.schema,size:8}),(0,b.jsx)("span",{style:{fontFamily:Pe,fontSize:"1.25rem",fontWeight:600,lineHeight:1.3,overflowWrap:"anywhere"},children:e.title})]}),(0,b.jsxs)("span",{style:k,children:[e.place?Ot(n,e.place.kind,e.place.across):Ot(n,e.kind),!f&&o?.description?` \xB7 ${o.description}`:null]})]})]})}var ca={display:"grid",gap:"32px 28px",gridTemplateColumns:"repeat(auto-fill, minmax(min(420px, 100%), 1fr))"},Ga=`
104
- .graview-gallery-card > span:first-child { transition: border-color 160ms ease, box-shadow 160ms ease; }
105
- .graview-gallery-card:hover > span:first-child,
106
- .graview-gallery-card:focus-visible > span:first-child { border-color: var(--graview-edge-bright); box-shadow: 0 1px 0 var(--graview-edge), 0 10px 30px -18px var(--graview-ink); }
107
- `;function Nt({context:t}){V(t.store);let e=Et(t);return e.length===0?null:(0,b.jsxs)("section",{style:ca,"data-testid":"gallery",children:[(0,b.jsx)("style",{children:Ga}),e.map(n=>(0,b.jsx)(Wt,{context:t,entry:n},n.key))]})}function Dt({context:t}){let{store:e}=t;V(e);let n=ce(t),r=Et(t);return(0,b.jsxs)(U,{context:t,style:Ne,children:[(0,b.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,b.jsx)("p",{style:ne,children:n.length===0?"None of its own yet":`${n.length} ${n.length===1?"picture":"pictures"}`}),(0,b.jsx)(J,{context:t,children:"Pictures"}),(0,b.jsx)("p",{style:Y,children:n.length===0?"Nothing here has a picture of its own yet, so each kind is drawn as the scene draws it. Title a group view and it appears here by name.":"The ways this installation looks at what it holds \u2014 each one the same picture the scene shows, here as a page."})]}),r.length>0?(0,b.jsx)("div",{style:ca,"data-testid":"places",children:r.map(i=>(0,b.jsx)(Wt,{context:t,entry:i},i.key))}):null]})}function It({context:t}){let{store:e,principal:n}=t;V(e);let r=ke(),i=he(),[a]=De(),d=decodeURIComponent(r.as??""),[s,l]=(0,Te.useState)(null),o=a.get("of"),f=ce(t).find(x=>x.as===d&&(!o||G(e.schema,x.kind)===o));if(!f)return(0,b.jsxs)(U,{context:t,children:[(0,b.jsx)(J,{context:t,children:"No picture is called that."}),(0,b.jsx)("p",{style:Y,children:(0,b.jsx)(L,{to:"/places",style:F,children:"The pictures there are \u2192"})})]});let u=I(e,f.kind),m=Re(e,f.kind,{...n?{principal:n}:{},...t.invariantContext?{context:t.invariantContext}:{}}).actions.affordances.map(x=>({affordance:x,mutation:e.allMutations().find(E=>E.name===x.mutation)})).filter(x=>x.mutation!==void 0);return(0,b.jsxs)(U,{context:t,style:Ne,children:[(0,b.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,b.jsx)(J,{context:t,children:f.title}),(0,b.jsxs)("p",{style:Y,"data-testid":"place-lede",children:[Ot(e,f.kind,f.across),"."]}),(0,b.jsx)("p",{style:{...k,margin:0},children:(0,b.jsxs)(L,{to:`/${G(e.schema,f.kind)}`,style:{...F,...k},"data-testid":"place-as-list",children:["All ",u.toLowerCase()," as a list \u2192"]})})]}),(0,b.jsx)("div",{"data-testid":"place-lens",style:{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",maxWidth:"100%",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)"},onClick:x=>{let E=x.target?.closest("[data-graview-pick]"),C=E?.getAttribute("data-graview-pick"),K=E?.getAttribute("data-graview-joins");if(K)try{let Q=JSON.parse(K);if(Array.isArray(Q)&&Q.every(we=>typeof we=="string")){x.preventDefault(),l({at:Le(f),ids:Q});return}}catch{}if(!C)return;let ue=e.graph.getNode(C);ue&&(x.preventDefault(),i(q(e.schema,ue.kind,C)))},children:(0,b.jsx)($t,{context:t,place:f,...s?.at===Le(f)?{chosen:s.ids}:{}})}),(0,b.jsx)("div",{style:{maxWidth:760,display:"grid",gap:40},children:m.map(({affordance:x,mutation:E})=>(0,b.jsxs)("section",{style:{..._,display:"grid",gap:14},children:[(0,b.jsx)("h2",{style:D,children:E.title??E.name}),E.description?(0,b.jsx)("p",{style:{...k,margin:0,maxWidth:"58ch"},children:E.description}):null,(0,b.jsx)(fe,{store:e,mutation:E,prefilled:x.args,open:x.open,label:x.label,...n?{principal:n}:{}})]},x.id))})]})}var W=$(ve(),1);var Me=$(ve(),1);function ga(t,e,n){let r=Math.max(0,t.left),i=Math.min(e.width,t.right),a=Math.max(0,t.top),d=Math.min(e.height,t.bottom);return{shown:d-a>=n.height+2*16&&i-r>=n.width+2*16,left:Math.round(r),top:Math.round(a),width:Math.round(Math.max(0,i-r)),height:Math.round(Math.max(0,d-a))}}function ua(t,e,n){let r=t.style;r.left=`${e.left}px`,r.top=`${e.top}px`,r.right="auto",r.bottom="auto",r.visibility=n?"":"hidden";let i=t.getBoundingClientRect();i.width!==0&&(r.left=`${Math.round(2*e.left-i.left)}px`,r.top=`${Math.round(2*e.top-i.top)}px`)}var Se=$(B(),1);function ma({context:t}){let e=he(),n=se(),{pathname:r}=de(),[,i,a]=r.split("/"),d=i==="places"&&a?decodeURIComponent(a):void 0,s=(0,Me.useRef)(null);return Va(s,n!==null),n?(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(Ua,{context:t}),(0,Se.jsx)("div",{ref:s,"data-testid":"page-seat",style:{position:"fixed",left:0,top:0,width:"100vw",height:"100dvh",pointerEvents:"none",zIndex:fn("rail"),containerType:"size"},children:(0,Se.jsx)(Un,{onPick:l=>{let o=t.store.graph.getNode(l);o&&e(q(t.store.schema,o.kind,l))},onMove:l=>{if(n.seatTalk.get().draft&&n.seatTalk.setDraft(null),l.to==="place"&&(l.face==="scene"||l.slug==="overview")){t.overview?t.overview("#"):t.embedded||window.location.assign(t.sceneHref??"/");return}e(l.address)},...d?{place:d}:{},onDraft:()=>{r!=="/~draft"&&e("/~draft")}})})]}):null}var qa={width:160,height:40};function Va(t,e){let{pathname:n}=de(),r=An(e);(0,Me.useLayoutEffect)(()=>{let i=t.current;if(!i)return;let a=i.parentElement?.closest("[data-embed-content]")??null,d=()=>a??document.querySelector("main")??null,s=()=>{let f=d(),u={width:document.documentElement.clientWidth||innerWidth,height:r??innerHeight},g=f?.getBoundingClientRect()??{left:0,top:0,right:u.width,bottom:u.height},m=ga(a?g:{left:g.left,right:g.right,top:g.top,bottom:Math.max(g.bottom,u.height)},u,qa);i.style.width=`${m.width}px`,i.style.height=`${m.height}px`,ua(i,m,m.shown)};s(),addEventListener("resize",s),addEventListener("scroll",s,!0);let l=0,o=typeof ResizeObserver=="function"?new ResizeObserver(()=>{cancelAnimationFrame(l),l=requestAnimationFrame(s)}):null,c=d();return c&&o?.observe(c),()=>{cancelAnimationFrame(l),o?.disconnect(),removeEventListener("resize",s),removeEventListener("scroll",s,!0)}},[t,e,n,r])}function Ua({context:t}){let{store:e}=t,n=se(),{pathname:r}=de(),i=(0,Me.useRef)(n?.setSelection);return i.current=n?.setSelection,(0,Me.useEffect)(()=>{let a=i.current;if(!a)return;let[,d,s]=r.split("/"),l=(()=>{if(d==="places"){let c=t.views?.places().find(f=>f.as===decodeURIComponent(s??""));return c?[He(c.kind)]:[]}let o=d?ye(e.schema,d):void 0;return o&&s?[decodeURIComponent(s)]:o?[vn(o)]:[]})();a(o=>o.length===l.length&&o.every((c,f)=>c===l[f])?o:l)},[r]),null}var te=$(ve(),1);var ya=$(Na(),1);var Z=$(B(),1);var ja=(0,te.lazy)(wn(()=>import("./chunk.YO7UFBJP.js").then(t=>({default:t.TakeBack}))));function _a({context:t,docked:e,at:n}){let{store:r}=t,i=V(r),[a]=(0,te.useState)(()=>r.batches().length),d=(0,te.useRef)(!1);return d.current||=i>0||!e&&a>0,d.current?(0,Z.jsx)(te.Suspense,{fallback:null,children:(0,Z.jsx)(ja,{context:t,docked:e,at:n,since:a})}):null}function Ya(t,e,n){let{store:r,principal:i,embedded:a}=t;(0,te.useEffect)(()=>{if(!n)return;let d=s=>{if(!Jn(s))return;let l=s.target,o=l instanceof Node&&e.current?.contains(l),c=l===document.body||l===document.documentElement||l===document;if(!(!o&&!(c&&!a))&&_n(r,i)){s.preventDefault();try{Yn(r,i)}catch{}}};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[r,i,a,e,n])}function ha({context:t,registry:e,root:n,children:r}){let i=(0,te.useMemo)(ra,[]),a=e?.without()??new Set;return Ya(t,n,!a.has("undo")),(0,Z.jsxs)(Lt.Provider,{value:i,children:[(0,Z.jsx)(Ja,{context:t,placed:i,without:a}),r]})}function Ja({context:t,placed:e,without:n}){let[r,i]=(0,te.useState)(!1);(0,te.useLayoutEffect)(()=>i(!0),[]);let a=Tt(e,"find"),d=Tt(e,"undo"),s=de(),l=En();if(!r)return null;let o=s.pathname.split("/").filter(Boolean),f=(o.length===1?ye(t.store.schema,o[0]):void 0)!==void 0;return(0,Z.jsxs)(Z.Fragment,{children:[!a&&!n.has("find")&&l?(0,ya.createPortal)((0,Z.jsx)(fa,{context:t,narrowsLists:f}),l.slot):null,!a&&!n.has("find")&&!l?(0,Z.jsx)("div",{"data-testid":"face-find-bar",style:{display:"flex",alignItems:"center",padding:"8px 16px",borderBottom:"1px solid var(--graview-edge)",background:"var(--graview-bar)",minWidth:0},children:(0,Z.jsx)(fa,{context:t,narrowsLists:f})}):null,!d&&!n.has("undo")?(0,Z.jsx)(_a,{context:t,docked:!0,at:s.pathname+s.search}):null,l?.own&&!n.has("undo")?(0,Z.jsx)(ea,{context:t,own:l.own}):null]})}function fa({context:t,narrowsLists:e}){return(0,Z.jsx)(Lt.Provider,{value:null,children:(0,Z.jsx)(Mt,{context:t,narrowsLists:e})})}var T=$(B(),1);function wa(t,e){return e==="*"?{label:"anything",path:null}:{label:I(t,e),path:`/${G(t.schema,e)}`}}function Qa({context:t,relation:e}){let{store:n}=t,r=wa(n,e.from),i=wa(n,e.to),a=d=>d.path?(0,T.jsx)(L,{to:d.path,style:{...X,fontWeight:550},children:d.label}):(0,T.jsx)("span",{children:d.label});return(0,T.jsxs)("li",{"data-testid":"relation","data-relation":e.edgeKind,style:{display:"grid",gridTemplateColumns:"30px minmax(0, 1fr) auto",gap:12,alignItems:"baseline"},children:[(0,T.jsx)(jn,{edgeKind:e.edgeKind,...t.brand?.kit?{kit:t.brand.kit}:{}}),(0,T.jsxs)("span",{style:{display:"grid",gap:1},children:[(0,T.jsxs)("span",{children:[a(r)," ",(0,T.jsxs)("span",{style:k,"data-graview-speaks-ids":"",children:[ie(e.edgeKind)," \u2192"]})," ",a(i)]}),e.description||e.inverse?(0,T.jsxs)("span",{style:{...k,fontSize:"0.9375rem"},children:[e.description?le(e.description):null,e.description&&e.inverse?" \xB7 ":null,e.inverse?`from the other end, ${e.inverse}`:null]}):null]}),i.path?(0,T.jsx)(L,{to:`${i.path}?with=${encodeURIComponent(e.edgeKind)}`,style:{...F,...k,fontVariantNumeric:"tabular-nums",display:"inline-block",minWidth:24,minHeight:24,textAlign:"center"},title:`The ${i.label.toLowerCase()} that have this`,children:e.count}):(0,T.jsx)("span",{style:{...k,fontVariantNumeric:"tabular-nums"},children:e.count})]})}function va({context:t,heading:e=!0}){let{store:n}=t,r=new Set(Ce(n,t.principal)),i=Ae(n).relations.filter(a=>r.has(a.from)&&(a.to==="*"||r.has(a.to)));return i.length===0?null:(0,T.jsxs)("section",{style:{..._,display:"grid",gap:12},"data-testid":"kind-map",children:[e?(0,T.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,T.jsx)("h2",{style:D,children:(0,T.jsx)(L,{to:"/map",style:X,children:"Connections"})}),(0,T.jsx)("span",{style:k,children:i.length===1?"1 relation":`${i.length} relations`})]}):null,(0,T.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:i.map(a=>(0,T.jsx)(Qa,{context:t,relation:a},`${a.edgeKind}|${a.from}|${a.to}`))})]})}function Kt({context:t}){let{store:e}=t;V(e);let n=new Set(Ce(e,t.principal)),r=Ae(e),i=r.relations.filter(a=>n.has(a.from));return(0,T.jsxs)(U,{context:t,children:[(0,T.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,T.jsx)("p",{style:ne,children:i.length===0?"No relations":`${i.length} ${i.length===1?"relation":"relations"}`}),(0,T.jsx)(J,{context:t,children:"Connections"}),(0,T.jsx)("p",{style:Y,children:i.length===0?"Nothing here is declared to relate to anything else yet.":"The kinds this installation holds, and the relations declared between them \u2014 each in the declaration's own words, with how many of it there are."})]}),(0,T.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},"data-testid":"map-kinds",children:r.kinds.filter(a=>n.has(a.kind)).map(a=>(0,T.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,T.jsx)(ee,{kind:a.kind,brand:t.brand,schema:e.schema,size:7}),(0,T.jsx)(L,{to:`/${G(e.schema,a.kind)}`,style:F,children:a.plural}),(0,T.jsx)("span",{style:k,children:a.count})]},a.kind))}),(0,T.jsx)(va,{context:t,heading:!1})]})}function ka({context:t}){let n=[...se()?.robots.values()??[]].filter(i=>i.mode==="asking"&&i.say);if(n.length===0)return null;let{store:r}=t;return(0,T.jsxs)("section",{style:{..._,display:"grid",gap:10},"data-testid":"seat-questions",children:[(0,T.jsx)("h2",{style:D,children:n.length===1?"The seat asked something":`The seat asked ${n.length} things`}),(0,T.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8},children:n.map(i=>{let a=i.at?r.graph.getNode(i.at):void 0;return(0,T.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,T.jsx)("span",{children:i.say}),a?(0,T.jsxs)(L,{to:q(r.schema,a.kind,a.id),style:{...F,...k},children:[re(r.schema.tryDefinition(a.kind),a)," \u2192"]}):null]},i.participant)})})]})}var O=$(B(),1);function Ht({context:t}){let{principal:e}=t,{store:n,brand:r,invariantContext:i}=t;V(n);let a=n.violations(i),d=`${a.length===1?"A rule is broken":"Rules are broken"} \u2014 see what, and what would fix it`,s=[...n.log.all()].slice(-5).reverse(),o=rt(t).map(C=>({kind:C,members:n.graph.nodesOfKind(C).filter(K=>$e(n.schema.tryDefinition(C),K))})),c=o.filter(C=>C.members.length>0),f=o.map(C=>({entry:C,creator:n.allMutations().find(K=>(K.creates??[]).includes(C.kind)&&n.permits({name:K.name,args:{}},t.principal).ok)})).find(C=>C.creator!==void 0),u=c.length===0?"Nothing here yet.":`${c.map(C=>`${C.members.length} ${C.members.length===1?C.kind:I(n,C.kind).toLowerCase()}`).join(", ").replace(/, ([^,]*)$/," and $1")}.`,g=t.views?.homeView?.(),m=n.schema.kinds.some(C=>n.graph.nodesOfKind(C).length>0);if(g&&m){let C=r?.subtitle?(0,O.jsx)("p",{style:{...k,margin:0},"data-testid":"app-subtitle",children:r.subtitle}):null,K=g[Symbol.for("graview.home-blocks")]===!0;return(0,O.jsx)(U,{context:t,style:Ne,children:(0,O.jsxs)("div",{style:{display:"grid",gap:12},"data-testid":"home-view",children:[K?null:C,a.length>0?(0,O.jsx)(L,{to:"/problems",style:{...F,color:"var(--graview-warn)"},children:d}):null,(0,O.jsx)(Gn.Provider,{value:K?C:null,children:(0,O.jsx)(g,{cardinality:"many",fidelity:"full",mode:"fullscreen",selected:!1})})]})})}let x=new Set(Ce(n,t.principal)),E=Ae(n).relations.filter(C=>x.has(C.from)&&(C.to==="*"||x.has(C.to)));return(0,O.jsxs)(U,{context:t,style:Ne,children:[(0,O.jsxs)("header",{style:{display:"grid",gap:12},children:[r?.subtitle?(0,O.jsx)("p",{style:{...k,margin:0},"data-testid":"app-subtitle",children:r.subtitle}):null,(0,O.jsx)(J,{context:t,"data-testid":"standing",children:u}),(0,O.jsxs)("p",{style:{...Y,display:"grid",gap:4},"data-testid":"standing-card",children:[c.length===0&&f?(0,O.jsxs)("span",{children:["Begin with \u201C",f.creator?.title??f.creator?.name,"\u201D, under"," ",(0,O.jsx)(L,{to:`/${G(n.schema,f.entry.kind)}`,style:F,children:I(n,f.entry.kind)}),"."]}):null,a.length===0?(0,O.jsx)("span",{children:"All rules hold."}):(0,O.jsx)(L,{to:"/problems",style:{...F,color:"var(--graview-warn)"},children:d})]})]}),(0,O.jsx)(Nt,{context:t}),(0,O.jsxs)("section",{style:{..._,display:"grid",gap:14},"data-testid":"kinds",children:[(0,O.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,O.jsx)("h2",{style:D,children:"What is here"}),E.length>0?(0,O.jsxs)(L,{to:"/map",style:{...F,...k,marginLeft:"auto"},"data-testid":"map-link",children:["Connections \xB7 ",E.length===1?"1 relation":`${E.length} relations`," \u2192"]}):null]}),(0,O.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"8px 10px"},children:o.map(({kind:C,members:K})=>(0,O.jsx)("li",{style:{maxWidth:"100%"},children:(0,O.jsxs)(L,{to:`/${G(n.schema,C)}`,style:{...X,flexWrap:"wrap",gap:8,padding:"6px 14px 6px 10px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)"},children:[(0,O.jsx)(ee,{kind:C,brand:r,schema:n.schema,size:7}),(0,O.jsx)("span",{style:{fontWeight:550,overflowWrap:"anywhere"},children:I(n,C)}),(0,O.jsx)("span",{style:{...k,fontVariantNumeric:"tabular-nums"},children:K.length===0?"none yet":K.length})]})},C))})]}),s.length>0?(0,O.jsxs)("section",{style:{..._,display:"grid",gap:10},children:[(0,O.jsx)("h2",{style:D,children:"Recently"}),(0,O.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:s.map(C=>(0,O.jsxs)("li",{style:k,children:[(0,O.jsx)("span",{style:{color:"var(--graview-ink)"},children:C.intent})," \u2014 ",nt(C,e,{graph:n.graph,schema:n.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}})]},C.id))})]}):null]})}var Fe=$(ve(),1);var R=$(B(),1);function zt({context:t}){let{store:e,brand:n,principal:r,invariantContext:i}=t;V(e);let[a]=De(),d=a.get("q")??"",s=typeof i?.today=="string"?i.today:void 0,l=un(e,d,{...r?{principal:r}:{},places:ce(t),flagged:new Set(e.violations(i).flatMap(g=>g.nodeIds)),...s?{today:s}:{},limit:200}),o=l.hits.filter(g=>g.about==="node"),c=l.hits.filter(g=>g.about==="kind"||g.about==="place"||g.about==="rule"),f=[...new Set(o.map(g=>g.kind))],u=d.trim();return(0,R.jsxs)(U,{context:t,children:[(0,R.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,R.jsx)("p",{style:ne,children:"Search"}),(0,R.jsx)(J,{context:t,"data-testid":"search-heading",children:u.length===0?"Find anything by its name":l.hits.length===0?(0,R.jsxs)(R.Fragment,{children:["Nothing here is called \u201C",u,"\u201D."]}):(0,R.jsxs)(R.Fragment,{children:[Xa(e,l.byKind)," for \u201C",u,"\u201D"]})}),u.length>0?(0,R.jsxs)("p",{style:{...k,margin:0},"data-testid":"search-searched",children:[Ye(e.schema,l.searched),l.conditions.filter(g=>g.key!=="is"&&g.admittedBy.length<l.searched.kinds.length).map(g=>(0,R.jsxs)("span",{children:[" ",g.key,":",g.value," narrows"," ",g.admittedBy.length===0?"nothing here":g.admittedBy.map(m=>I(e,m).toLowerCase()).join(" and "),"."]},`${g.key}:${g.value}`))]}):(0,R.jsxs)("p",{style:Y,children:["Type in the box above. Words find the start of words in names and in what each record says;"," ",(0,R.jsx)("code",{children:"done:false"})," and the like narrow as a list does, and ",(0,R.jsx)("code",{children:"is:any"})," includes what is past."]})]}),c.length>0?(0,R.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},"data-testid":"search-named",children:c.map(g=>(0,R.jsx)("li",{"data-testid":"search-hit","data-about":g.about,children:g.about==="kind"?(0,R.jsxs)(L,{to:`/${G(e.schema,g.kind)}`,style:F,children:[g.label,g.count>0?(0,R.jsxs)("span",{style:k,children:[" \xB7 ",g.count," match"]}):null]}):g.about==="place"?(0,R.jsxs)(L,{to:ge(t,g),style:F,children:["Go to ",g.title]}):g.about==="rule"?(0,R.jsxs)(L,{to:"/problems",style:F,children:["The rule \u201C",g.label,"\u201D"]}):null},`${g.about}:${g.about==="rule"?g.name:g.about==="place"?g.as:g.kind}`))}):null,f.map(g=>(0,R.jsxs)("section",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:0,minWidth:0},"data-testid":"search-group","data-kind":g,children:[(0,R.jsxs)("h2",{style:{...D,fontSize:"1.0625rem",marginBottom:4,display:"flex",alignItems:"center",gap:8},children:[(0,R.jsx)(ee,{kind:g,brand:n,schema:e.schema,size:8}),(0,R.jsx)(L,{to:`/${G(e.schema,g)}?${new URLSearchParams({q:u}).toString()}`,style:F,"data-testid":"search-kind-link",children:I(e,g)}),(0,R.jsx)("span",{style:k,children:l.byKind[g]})]}),(0,R.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:0},children:o.filter(m=>m.kind===g).map(m=>(0,R.jsxs)("li",{"data-testid":"search-hit","data-about":"node",style:{display:"grid",gap:2,padding:"12px 0",minWidth:0,borderTop:"1px solid var(--graview-edge)"},children:[(0,R.jsxs)(L,{to:q(e.schema,g,m.id),style:{...X,fontFamily:Pe,fontSize:"1.1875rem",fontWeight:600,lineHeight:1.3,overflowWrap:"anywhere"},children:[m.flagged?(0,R.jsx)("span",{style:{color:"var(--graview-warn)"},children:"\u26A0 "}):null,m.label,m.apart?(0,R.jsxs)("span",{style:k,children:[" \xB7 ",m.apart]}):null,m.current?null:(0,R.jsx)("span",{style:k,children:" \xB7 past"})]}),(0,R.jsx)(st,{why:m.why})]},m.id))})]},g)),u.length>0?(0,R.jsx)(Za,{asked:u}):null,u.length>0&&l.hits.length===0?(0,R.jsx)(ba,{store:e,kinds:l.searched.kinds,words:l.words,...r?{principal:r}:{},...i?{invariantContext:i}:{}}):null]})}function st({why:t}){return t.field==="label"?null:(0,R.jsxs)("span",{style:k,"data-testid":"search-why",children:[t.reading,": ",t.fragment]})}function Xa(t,e){let n=Object.entries(e).map(([r,i])=>`${i} ${i===1?be(t.schema.tryDefinition(r),r):I(t,r).toLowerCase()}`);return n.length===0?"Found":n.length===1?le(n[0]):le(`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`)}function Sa(t,e,n={}){let r=[];for(let i of e){let a=Re(t,i,{...n.principal?{principal:n.principal}:{},...n.invariantContext?{context:n.invariantContext}:{}});for(let d of lt(t,i,a.actions.affordances))r.some(s=>s.mutation.name===d.mutation.name)||r.push(d)}return r}function lt(t,e,n){let r=t.schema.tryDefinition(e)?.fieldRoles?.label,i=[];for(let a of n){let d=t.allMutations().find(o=>o.name===a.mutation);if(!d||!d.creates?.includes(e)||i.some(o=>o.mutation.name===d.name))continue;let s=Ze(d.input).map(o=>o.name),l=s.includes("label")?"label":r&&s.includes(r)?r:void 0;!l||a.args[l]!==void 0||i.push({kind:e,affordance:a,mutation:d,arg:l})}return i}function ba({store:t,kinds:e,words:n,principal:r,invariantContext:i}){let a=Sa(t,e,{...r?{principal:r}:{},...i?{invariantContext:i}:{}});return a.length===0||n.trim().length===0?null:(0,R.jsx)("div",{style:{display:"grid",gap:24},"data-testid":"search-to-create",children:a.map(({kind:d,affordance:s,mutation:l,arg:o})=>(0,R.jsxs)("section",{style:{..._,display:"grid",gap:14},children:[(0,R.jsxs)("h2",{style:D,children:[le(nn(be(t.schema.tryDefinition(d),d)))," called \u201C",n,"\u201D"]}),(0,R.jsx)(fe,{store:t,mutation:l,prefilled:s.args,open:s.open,initial:{[o]:n},...r?{principal:r}:{}})]},`${s.id}|${n}`))})}function Za({asked:t}){let e=se();return e?(0,R.jsx)(er,{asked:t,talk:e.seatTalk}):null}function er({asked:t,talk:e}){let{drawn:n}=kn(e);return n===0?null:(0,R.jsx)("p",{style:{margin:0},children:(0,R.jsxs)("button",{type:"button","data-testid":"search-ask",onClick:()=>e.ask(t),style:{...F,font:"inherit",padding:0,border:0,background:"transparent",cursor:"pointer",textAlign:"start"},children:["Ask: \u2018",t,"\u2019"]})})}var h=$(B(),1),xa=8,Pa=40;function Bt({context:t}){let e=ke(),n=ye(t.store.schema,e.slug??"");return n?(0,h.jsx)(Ca,{context:t,kind:n}):(0,h.jsx)(U,{context:t,children:(0,h.jsx)(J,{context:t,children:"No such kind of thing here."})})}function Ca({context:t,kind:e,opening:n,row:r,layout:i="list",description:a,bare:d}){let{store:s,brand:l,invariantContext:o}=t;V(s);let[c,f]=De(),u=s.schema.tryDefinition(e),g=s.graph.nodesOfKind(e),m=Ae(s).relations.filter(p=>p.from===e||p.to===e),x=new Set(s.violations(o).flatMap(p=>p.nodeIds)),E=dn(s.schema,e),C=m.map(p=>p.edgeKind),K=ar(c,E,C),ue=["sort","filter","group","q","by","with","past",...C].some(p=>c.has(p)),Q=g.length>=Pa,we=u?.fieldRoles?.when,N=ue?K.arrangement:xt(n??nr(Q,we),E).arrangement,ae=cn(N.query??""),Oe=[...N.filter??[],...ae.conditions].some(p=>p.key==="is"&&(p.value==="past"||p.value==="any"))||ln(u,[...N.filter??[],...ae.conditions]),y=Oe||!u?.lifecycle?N:{...N,filter:[...N.filter??[],{key:"is",value:"current"}]},A=Dn(g,y,{schema:s.schema,graph:s.graph,flagged:x,...typeof o?.today=="string"?{today:o.today}:{}}),j=A.nodes,z=u?.lifecycle&&!Oe?g.filter(p=>$e(u,p)):g,Vt=g.length-z.length,Ut=N.group?.by??null,La=p=>{let P=new URLSearchParams(c);for(let oe of["sort","filter","group","q","by","with","past",...m.map(je=>je.edgeKind)])P.delete(oe);let H=Nn(p);for(let oe of["sort","filter","group","q"])H[oe]&&P.set(oe,H[oe]);![...P.keys()].some(oe=>["sort","filter","group","q"].includes(oe))&&(n||Q||we)&&P.set("sort",""),f(P)},{principal:jt}=t,gt=Re(s,e,{...jt?{principal:jt}:{},...t.invariantContext?{context:t.invariantContext}:{}}),Ie=gt.actions.affordances.map(p=>({affordance:p,mutation:s.allMutations().find(P=>P.name===p.mutation)})).filter(p=>p.mutation!==void 0),_t=gt.actions.withheld,Yt=ae.words&&j.length===0?Object.fromEntries(lt(s,e,gt.actions.affordances).map(p=>[p.mutation.name,p.arg])):{},ut=I(s,e),Ge=t.views?.lookup(e,{cardinality:"one",fidelity:"glyph"}),Jt=Ge!==void 0&&!Ee(Ge)?Ge:void 0,mt=p=>{let P=re(u,p);if(r){let Ke=u?.computed?We(s.schema,s.graph,p):p;return(0,h.jsx)("li",{"data-testid":"record-row",style:{minWidth:0},children:r(p,{label:P,href:q(s.schema,e,p.id),flagged:x.has(p.id),glance:at(Ke,u,P)})},p.id)}if(Jt){let Ke=Xe(Ge,p,s.graph),$a=u?.computed?We(s.schema,s.graph,p):p,Ea=Object.fromEntries(Object.entries($a).filter(([Wa])=>!Ke?.fields.has(Wa))),Xt=Ke?at(Ea,u,Ke.title??P):"";return(0,h.jsxs)("li",{"data-testid":"record-row",style:{position:"relative",display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:16,rowGap:2,padding:"10px 0",borderTop:"1px solid var(--graview-edge)"},children:[(0,h.jsx)("div",{style:{flex:"1 1 14rem",minWidth:0},children:(0,h.jsx)(Jt,{node:p,cardinality:"one",fidelity:"glyph",mode:"fullscreen",selected:!1,...x.has(p.id)?{flagged:[p.id]}:{}})}),Xt?(0,h.jsx)("span",{style:{...k,flex:"0 1 auto",minWidth:0,overflowWrap:"anywhere"},"data-testid":"record-glance",children:Xt}):null,(0,h.jsx)(L,{to:q(s.schema,e,p.id),"aria-label":x.has(p.id)?`${P} \u2014 implicated in a problem`:P,style:{position:"absolute",inset:0,borderRadius:6}})]},p.id)}let H=u?.computed?We(s.schema,s.graph,p):p,oe=at(H,u,P),je=ae.words?gn(u,p,ae.words):void 0,wt=Q?void 0:On(p,u);return(0,h.jsxs)("li",{style:Q?{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:16,rowGap:0,padding:"5px 0",borderTop:"1px solid var(--graview-edge)",overflowWrap:"anywhere"}:{display:"grid",gridTemplateColumns:wt?"auto minmax(0, 1fr)":"minmax(0, 1fr)",columnGap:14,gap:2,padding:"14px 0",borderTop:"1px solid var(--graview-edge)",overflowWrap:"anywhere"},children:[wt?(0,h.jsx)(xe,{as:"thumb",file:wt,style:{gridRow:"span 3"}}):null,(0,h.jsxs)(L,{to:q(s.schema,e,p.id),style:Q?{...X,flex:"1 1 14rem",minWidth:0,fontSize:"1rem",fontWeight:600,lineHeight:1.35}:{...X,fontFamily:Pe,fontSize:"1.25rem",fontWeight:600,lineHeight:1.3},children:[x.has(p.id)?(0,h.jsx)("span",{style:{color:"var(--graview-warn)"},children:"\u26A0 "}):null,P]}),oe?(0,h.jsx)("span",{style:Q?{...k,flex:"0 1 auto",minWidth:0,fontSize:"0.875rem"}:k,children:oe}):null,je?(0,h.jsx)(st,{why:je}):null]},p.id)},ft=ce(t).filter(p=>p.kind===e),Ta=(N.filter??[]).some(p=>p.key!=="is"||p.value!=="any"),Ma=!!(N.sort||N.group||N.query||Ta),Fa=z.length>=xa||ue&&Ma,me=N.sort?E.sorts.find(p=>p.key===N.sort.by):void 0,yt=me?.type==="date"||me!==void 0&&me.key===we,Qt=Q&&!A.grouped&&me&&(me.about==="label"||me.type==="text"||yt)?p=>{let P=me.about==="label"?re(u,p):p[me.key];if(typeof P!="string"||P.length===0)return yt?"No date":"#";if(yt)return P.slice(0,4);let H=P.trim().charAt(0).toLocaleUpperCase();return/\p{L}/u.test(H)?H:"#"}:void 0,qe=Qt?j.reduce((p,P)=>{let H=Qt(P);return p.at(-1)?.key===H?p.at(-1).nodes.push(P):p.push({key:H,nodes:[P]}),p},[]):void 0,ht=i==="grid"?{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 15rem), 1fr))",gap:12}:{margin:0,padding:0,listStyle:"none",display:"grid",gap:r&&i==="list"?6:0},Ve=p=>`list-at-${p.replace(/[^\p{L}\p{N}]/gu,"_")}`,Ue=m.map(p=>{let P=p.from===e?p.to:p.from,H=p.from===e?p.description:p.inverse??p.description;return{relation:p,far:P,words:H}}),Oa=new Set(Ue.map(p=>(p.words??"").toLowerCase()).filter((p,P,H)=>p&&H.indexOf(p)!==P));return(0,h.jsxs)(d?tr:U,{context:t,children:[(0,h.jsxs)("div",{style:{display:"grid",gap:12},children:[(0,h.jsxs)("header",{style:{display:"grid",gap:4},children:[(0,h.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[(0,h.jsx)(ee,{kind:e,brand:l,schema:s.schema,size:8}),(0,h.jsx)(J,{context:t,children:ut})]}),a??u?.description?(0,h.jsx)("p",{style:{...Y,fontSize:"1.0625rem",lineHeight:1.4},children:a??u?.description}):null,Ue.length>0||ft.length>0?(0,h.jsxs)("p",{style:{...k,margin:0,display:"flex",flexWrap:"wrap",columnGap:18,rowGap:2},"data-testid":"kind-related",children:[Ue.length>0?(0,h.jsxs)("span",{"data-testid":"kind-relations",children:["Related:"," ",Ue.map(({relation:p,far:P,words:H},oe)=>(0,h.jsxs)("span",{"data-relation":p.edgeKind,children:[oe>0?" \xB7 ":null,P==="*"?le(H??ie(p.edgeKind)):(0,h.jsx)(L,{to:`/${G(s.schema,P)}`,style:F,title:I(s,P),children:H&&Oa.has(H.toLowerCase())?`${le(H)}: ${I(s,P).toLowerCase()}`:le(H??I(s,P))})]},`${p.edgeKind}|${p.from}|${p.to}`))]}):null,ft.length>0?(0,h.jsxs)("span",{"data-testid":"kind-pictures",children:["Also as:"," ",ft.map((p,P)=>(0,h.jsxs)("span",{children:[P>0?" \xB7 ":null,(0,h.jsx)(L,{to:ge(t,p),style:F,children:p.title})]},Le(p)))]}):null]}):null]}),K.dropped.length>0?(0,h.jsxs)("p",{style:{...k,margin:0},"data-testid":"list-dropped",children:["This link asked for ",K.dropped.join(", "),", which ",ut.toLowerCase()," cannot be arranged by; the rest is shown."]}):null,z.length>0?(0,h.jsx)(Kn,{schema:s.schema,graph:s.graph,kind:e,arrangement:N,onChange:La,kept:{shown:j.length,of:z.length},noun:{one:be(u,e),many:ut.toLowerCase()},...Fa?{}:{allow:!1},query:t.framed===!0&&t.barAbove!==!0}):null,j.length===0&&ae.words?(0,h.jsxs)("p",{style:{...Y,fontSize:"1.0625rem"},"data-testid":"none-yet",children:["Nothing here is called \u201C",ae.words,"\u201D."," ",(0,h.jsx)("span",{style:k,"data-testid":"list-searched",children:Ye(s.schema,{kinds:[e],past:Oe})})," ",(0,h.jsx)(L,{to:"?",style:F,children:"Show every one"})]}):j.length===0?(0,h.jsxs)("p",{style:{...Y,fontSize:"1.0625rem"},"data-testid":"none-yet",children:[N.filter?.length||N.query?"None of them.":"None yet",!N.filter?.length&&!N.query&&Ie.length>0?` \u2014 the first one starts below, with \u201C${Ie[0]?.mutation.title??Ie[0]?.mutation.name}\u201D.`:!N.filter?.length&&!N.query?".":"",N.filter?.length||N.query?(0,h.jsxs)(h.Fragment,{children:[" ",(0,h.jsx)(L,{to:"?",style:F,children:"Show every one"})]}):null]}):A.grouped&&Ut?(0,h.jsx)("div",{style:{display:"grid",gap:18},"data-testid":"records","data-grouped":Ut,children:A.groups.map(p=>(0,h.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group",children:[(0,h.jsxs)("h2",{style:{...D,fontSize:"1.0625rem",marginBottom:4},children:[p.label," ",(0,h.jsx)("span",{style:k,children:p.nodes.length})]}),(0,h.jsx)("ul",{style:ht,"data-graview-rows":"",children:p.nodes.map(mt)})]},p.key||"-"))}):qe&&qe.length>1?(0,h.jsxs)("div",{style:{display:"grid",gap:14},"data-testid":"records","data-sectioned":me?.type==="date"?"year":"letter",children:[(0,h.jsx)("nav",{"aria-label":"Jump to","data-testid":"list-index",style:{...k,display:"flex",flexWrap:"wrap",gap:me?.type==="date"?"0 10px":"0 4px",fontSize:"0.8125rem",lineHeight:1.3},children:qe.map(p=>(0,h.jsx)("a",{href:`#${Ve(p.key)}`,onClick:P=>{P.preventDefault(),document.getElementById(Ve(p.key))?.scrollIntoView({block:"start"})},style:{...F,flex:"0 0 auto",minWidth:24,justifyContent:"center",textDecoration:"none"},children:p.key},p.key))}),qe.map(p=>(0,h.jsxs)("section",{"data-testid":"list-section","aria-labelledby":Ve(p.key),style:{display:"grid",gap:0},children:[(0,h.jsx)("h2",{id:Ve(p.key),style:{...D,fontSize:"0.9375rem",color:"var(--graview-ink-muted)",marginBottom:2,scrollMarginTop:64},children:p.key}),(0,h.jsx)("ul",{style:ht,"data-graview-rows":"",children:p.nodes.map(mt)})]},p.key))]}):(0,h.jsx)("ul",{style:ht,"data-testid":"records","data-graview-rows":"",children:j.map(mt)}),Vt>0?(0,h.jsxs)(L,{to:rr(c,"filter","is:any"),style:{...F,...k,justifySelf:"start"},"data-testid":"past-link",children:["+",Vt," past"]}):null,Ie.length>0?(0,h.jsx)("div",{style:{display:"grid",gap:6},"data-testid":"beginnings",children:Ie.map(({affordance:p,mutation:P})=>{let H=!!(Yt[P.name]&&j.length===0);return(0,h.jsx)(ir,{name:P.name,title:P.title??P.name,description:P.description,open:j.length===0,children:(0,h.jsx)(fe,{store:s,mutation:P,prefilled:p.args,open:p.open,...H?{initial:{[Yt[P.name]]:ae.words}}:{},...t.principal?{principal:t.principal}:{}},H?`${P.name}|${ae.words}`:P.name)},p.id)})}):null]}),_t.length>0?(0,h.jsx)("ul",{style:{..._,margin:0,padding:0,listStyle:"none",display:"grid",gap:4},"data-testid":"withheld",children:_t.map(p=>(0,h.jsxs)("li",{style:k,children:[(0,h.jsx)("s",{children:p.label})," \u2014 ",p.refusal.message]},p.id))}):null]})}function tr({children:t}){return(0,h.jsx)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40,minWidth:0},children:t})}var nr=(t,e)=>e?{sort:{by:e,direction:"desc"}}:t?{sort:{by:"label",direction:"asc"}}:{};function ar(t,e,n){let r=pn({...t.get("sort")?{sort:t.get("sort")}:{},...t.get("filter")?{filter:t.get("filter")}:{},...t.get("group")?{group:t.get("group")}:{},...t.get("q")?{q:t.get("q")}:{}}),i=[...r.filter??[]],a=t.get("by"),d=r.group??(a?{by:a}:void 0);for(let l of n){let o=t.get(l);o&&i.push({key:l,value:o})}let s=t.get("with");return s&&i.push({key:s,value:"*"}),t.get("past")==="1"&&!i.some(l=>l.key==="is")&&i.push({key:"is",value:"any"}),xt({...r.sort?{sort:r.sort}:{},...r.query?{query:r.query}:{},...i.length>0?{filter:i}:{},...d?{group:d}:{}},e)}function rr(t,e,n){let r=new URLSearchParams(t);return r.set(e,n),r.delete("past"),`?${r.toString()}`}function ir({name:t,title:e,description:n,open:r,children:i}){let[a,d]=(0,Fe.useState)(r),s=(0,Fe.useRef)(null),l=(0,Fe.useRef)(null),o=`begin-${(0,Fe.useId)().replace(/:/g,"")}`;return(0,h.jsxs)("div",{"data-testid":`act-${t}`,style:{display:"grid",gap:10},children:[(0,h.jsxs)("button",{ref:s,type:"button","data-testid":`act-open-${t}`,"aria-expanded":a,"aria-controls":o,onClick:()=>{d(!a),a||requestAnimationFrame(()=>l.current?.querySelector("input, select, textarea, button")?.focus())},style:{...X,justifySelf:"start",minHeight:32,padding:"0 2px",border:0,background:"none",font:"inherit",fontSize:"0.9375rem",fontWeight:600,color:"var(--graview-ink)",cursor:"pointer"},children:[(0,h.jsx)("span",{"aria-hidden":"true",style:{marginRight:6},children:a?"\u2212":"+"}),e]}),(0,h.jsxs)("div",{ref:l,id:o,hidden:!a,onKeyDown:c=>{c.key==="Escape"&&(c.preventDefault(),d(!1),s.current?.focus())},style:a?{display:"grid",gap:12,padding:"4px 0 12px"}:void 0,children:[n?(0,h.jsx)("p",{style:{...k,margin:0,maxWidth:"58ch"},children:n}):null,i]})]})}var ct=$(ve(),1);var Be=$(ve(),1);var M=$(B(),1);function Gt({context:t}){let{store:e,brand:n,invariantContext:r,principal:i}=t;V(e);let a=e.violations(r),d=e.allInvariants(),s=Qe(e,a),l=Ln(e.schema,d);return(0,M.jsxs)(U,{context:t,children:[(0,M.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,M.jsx)(J,{context:t,children:a.length===0?"All rules hold":"What is broken"}),(0,M.jsx)("p",{style:Y,"data-testid":"problems-count",children:a.length===0?"Every declared rule is satisfied by what is here.":on(a)})]}),(0,M.jsx)(ka,{context:t}),s.map((o,c)=>{let f=o.nodeIds[0],u=f?e.graph.getNode(f):void 0;return(0,M.jsxs)("section",{style:{display:"grid",gap:10,padding:"16px 18px",borderLeft:"3px solid var(--graview-warn)",background:"var(--graview-panel-warning)",borderRadius:"0 var(--graview-radius, 12px) var(--graview-radius, 12px) 0"},children:[o.line?null:(0,M.jsx)(dt,{violation:o,schema:e.schema,...n?{brand:n}:{}}),u?(0,M.jsxs)("p",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[(0,M.jsx)(ee,{kind:u.kind,brand:n,schema:e.schema,size:7}),(0,M.jsx)(L,{to:q(e.schema,u.kind,u.id),style:F,children:re(e.schema.tryDefinition(u.kind),u)})]}):null,o.line?(0,M.jsx)(dt,{violation:o,schema:e.schema,...n?{brand:n}:{}}):null,(0,M.jsx)(pt,{store:e,repairs:o.repairs,...i?{principal:i}:{}})]},c)}),d.length>0?(0,M.jsxs)("section",{style:{..._,display:"grid",gap:12},"data-testid":"rules",children:[(0,M.jsx)("h2",{style:D,children:"The rules"}),(0,M.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:d.map(o=>{let c=a.filter(g=>g.invariant===o.name).length,f=l.get(o.name),u=o.label??o.name;return(0,M.jsxs)("li",{"data-graview-rule":o.name,style:{display:"grid",gap:2},children:[(0,M.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:12,rowGap:2},children:[f?(0,M.jsx)(St,{line:f,schema:e.schema,...n?{brand:n}:{},style:{flex:"1 1 18rem"}}):(0,M.jsx)("span",{style:{flex:"1 1 18rem",fontWeight:550},children:u}),(0,M.jsx)("span",{style:{...k,fontSize:"0.875rem",color:c>0?"var(--graview-warn)":"var(--graview-ink-faint)"},children:c===0?"holds":`broken in ${c} ${c===1?"place":"places"}`})]}),f&&u.trim().length>0?(0,M.jsx)("span",{style:{...k,fontSize:"0.875rem"},children:u}):null]},o.name)})})]}):null]})}function dt({violation:t,schema:e,brand:n}){if(!t.line)return(0,M.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},children:t.message});let r=Mn(t);return(0,M.jsxs)("div",{style:{display:"grid",gap:2},"data-testid":"problem-line",title:Tn(t),children:[(0,M.jsx)(St,{line:t.line,schema:e,...n?{brand:n}:{},lead:"none",style:{color:"var(--graview-warn)",fontSize:"1.0625rem"}}),r?(0,M.jsx)("span",{style:{...k,fontSize:"0.875rem"},children:r}):null]})}function pt({store:t,repairs:e,principal:n}){let[r,i]=(0,Be.useState)(null),[a,d]=(0,Be.useState)(null),s=(0,Be.useRef)([]);if(e.length===0)return null;let l=r===null?null:e[r],o=l&&(l.missing??[]).length>0?t.allMutations().find(c=>c.name===l.mutation):void 0;return(0,M.jsxs)("div",{style:{display:"grid",gap:10},"data-testid":"repairs",children:[(0,M.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:e.map((c,f)=>{let u=(c.missing??[]).length>0,g=t.permits({name:c.mutation,args:{...c.args}},n);return g.ok?(0,M.jsx)("button",{ref:m=>{s.current[f]=m},type:"button","data-graview-repair":c.mutation,"data-graview-asks":u||void 0,"aria-expanded":u?r===f:void 0,onClick:()=>{if(d(null),u){i(r===f?null:f);return}i(null);try{t.apply({name:c.mutation,args:{...c.args}},n?{author:n}:{})}catch(m){d(Je(t.schema,t.allMutations(),m))}},style:tt,children:u?`${c.label} \u2026`:c.label},f):(0,M.jsxs)("p",{"data-testid":"withheld","data-withheld":g.refusal.wouldNeed.join(",")||"nobody",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:[(0,M.jsx)("s",{children:c.label})," \u2014 ",g.refusal.message]},f)})}),o&&l?(0,M.jsx)(fe,{store:t,mutation:o,prefilled:{...l.args},only:l.missing??[],label:l.label,onDone:()=>{let c=r;i(null),requestAnimationFrame(()=>{let f=c===null?null:s.current[c];if(f?.isConnected){f.focus();return}let u=document.querySelector("[data-graview-page-title]")??document.querySelector("main h1, main h2");u&&(u.hasAttribute("tabindex")||(u.tabIndex=-1),u.focus())})},...n?{principal:n}:{}}):null,l&&!o&&(l.missing??[]).length>0?(0,M.jsxs)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:"0.875rem"},children:["\u201C",l.label,"\u201D names ",l.mutation,", which this app does not declare."]}):null,a?(0,M.jsx)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:"0.875rem"},children:a}):null]})}var w=$(B(),1),or=[];function qt({context:t}){let{store:e,brand:n,principal:r,invariantContext:i}=t;V(e);let a=se()!==null,d=ke(),s=decodeURIComponent(d.id??""),l=oa(e,s,{...r?{principal:r}:{},...i?{context:i}:{}}),o=Qe(e,l?.violations??or),[c,f]=(0,ct.useState)(null),u=(0,ct.useRef)(null);if(!l)return(0,w.jsx)(U,{context:t,children:(0,w.jsx)(J,{context:t,children:"Nothing lives at this address."})});let g=e.graph.getNode(s),m=e.schema.tryDefinition(l.kind),x=m?.describe&&g?Zt(m,g):null,E=[...e.log.all()].filter(y=>!sn(y)&&(y.writes.includes(s)||y.reads.includes(s))).slice(-8).reverse(),C=l.actions.affordances.filter(y=>y.provider!=="invariant"),K=t.views?.lookup(l.kind,{cardinality:"one",fidelity:"full"}),ue=K!==void 0&&!Ee(K)?K:void 0,Q=ue&&g?Xe(K,g,e.graph):void 0,we=Q?l.fields.filter(y=>!Q.fields.has(y.key)):l.fields,N=Q?l.links.flatMap(y=>{let A=y.targets.filter(j=>!Q.records.has(j.id));return A.length>0?[{...y,targets:A}]:[]}):l.links,ae=ue!==void 0&&Cn(K),Oe=a&&Fn(m).length>0;return(0,w.jsxs)(U,{context:t,children:[(0,w.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,w.jsxs)("p",{style:{...ne,display:"flex",alignItems:"center",gap:8},children:[(0,w.jsx)(ee,{kind:l.kind,brand:n,schema:e.schema,size:8}),(0,w.jsx)(L,{to:`/${G(e.schema,l.kind)}`,style:X,children:I(e,l.kind)})]}),(0,w.jsx)(J,{context:t,children:a&&g?.label===l.label?(0,w.jsx)(Pt,{nodeId:s,field:"label",value:l.label}):l.label}),x&&x!==l.label?(0,w.jsx)("p",{style:Y,children:x}):null,(0,w.jsx)(et,{context:t,stop:`#focus=${encodeURIComponent(s)}`,style:{...F,...k},"data-testid":"spatial-link"}),ce(t).some(y=>y.kind===l.kind||y.across===l.kind)?(0,w.jsxs)("p",{style:{...k,margin:0},"data-testid":"seen-in",children:["Seen in:"," ",ce(t).filter(y=>y.kind===l.kind||y.across===l.kind).map((y,A)=>(0,w.jsxs)("span",{children:[A>0?" \xB7 ":null,(0,w.jsx)(L,{to:ge(t,y),style:F,children:y.title})," ",(0,w.jsx)(et,{context:t,stop:`#view=${encodeURIComponent(y.as)}`,style:{...F,...k,display:"inline-block",minWidth:24,textAlign:"center"},title:`${y.title}, in the scene`,children:"\u2197"})]},Le(y)))]}):null]}),ue&&g?(0,w.jsx)("section",{"data-testid":"record-view",style:{display:"grid",minWidth:0},children:(0,w.jsx)(Hn,{children:(0,w.jsx)(ue,{node:g,cardinality:"one",fidelity:"full",mode:"fullscreen",selected:!1,...l.violations.length>0?{flagged:[s]}:{}})})}):null,l.violations.length>0?(0,w.jsx)("section",{"data-testid":"record-violations",style:{display:"grid",gap:12,padding:"16px 18px",borderLeft:"3px solid var(--graview-warn)",background:"var(--graview-panel-warning)",borderRadius:"0 var(--graview-radius, 12px) var(--graview-radius, 12px) 0"},children:o.map((y,A)=>(0,w.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,w.jsx)(dt,{violation:y,schema:e.schema,...n?{brand:n}:{}}),(0,w.jsx)(pt,{store:e,repairs:sa(l.actions,y.repairs),...r?{principal:r}:{}})]},A))}):null,!ae&&(we.length>0||Oe)?(0,w.jsxs)("section",{style:{..._,display:"grid",gap:14},"data-testid":"record-fields",children:[(0,w.jsx)("h2",{style:D,children:"The facts"}),rn(m,we).map((y,A)=>{let j=(0,w.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"14px 24px"},children:y.fields.map(z=>z.files?(0,w.jsx)(xe,{as:"field",read:!a,nodeId:s,field:z.key,label:z.label,files:z.files,labelStyle:{...ne,fontSize:"0.75rem"},style:{gap:4}},z.key):z.long?(0,w.jsx)(In,{nodeId:s,field:z.key,label:z.label,value:z.value,style:{gridColumn:"1 / -1",gap:4},labelStyle:{...ne,fontSize:"0.75rem"},valueStyle:{fontSize:"1.0625rem",lineHeight:1.6}},z.key):(0,w.jsxs)("div",{style:{display:"grid",gap:2,minWidth:0,alignContent:"start"},children:[(0,w.jsx)("dt",{style:{...ne,fontSize:"0.75rem"},children:z.label}),(0,w.jsx)("dd",{style:{margin:0,fontSize:"1.125rem",overflowWrap:"anywhere",minWidth:0},children:a?(0,w.jsx)(Pt,{nodeId:s,field:z.key,value:z.value,stored:z.stored}):z.value})]},z.key))});return y.title?(0,w.jsxs)("section",{style:{display:"grid",gap:10,minWidth:0},children:[(0,w.jsx)("h3",{"data-graview-field-group":y.title,style:{...D,fontSize:"1.0625rem"},children:y.title}),j]},A):(0,w.jsx)("div",{children:j},A)}),Oe?(0,w.jsx)(xe,{as:"unfilled",nodeId:s,skip:[...Q?.fields??[]],labelStyle:{...ne,fontSize:"0.75rem"},style:{gap:4}}):null]}):null,(ae?[]:N).map(y=>(0,w.jsxs)("section",{style:{..._,display:"grid",gap:10},children:[(0,w.jsx)("p",{style:ne,children:Xn(e,y)}),y.description?(0,w.jsx)("h2",{style:D,children:le(y.description)}):(0,w.jsxs)("h2",{style:D,"aria-label":ie(y.edgeKind),children:[y.direction==="in"?"\u2190 ":"\u2192 ",ie(y.edgeKind)]}),(0,w.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},children:y.targets.map(A=>(0,w.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,w.jsx)(ee,{kind:A.kind,brand:n,schema:e.schema,size:7}),(0,w.jsxs)(L,{to:q(e.schema,A.kind,A.id),style:{...F,fontSize:"1.125rem"},children:[A.label,A.apart?(0,w.jsxs)("span",{style:k,children:[" \xB7 ",A.apart]}):null]})]},A.id))}),(y.direction==="out"&&e.schema.edge(y.edgeKind)?.cardinality==="one"?[]:[...new Set(y.targets.map(A=>A.kind))]).map(A=>(0,w.jsxs)(L,{to:`/${G(e.schema,A)}?${encodeURIComponent(y.edgeKind)}=${encodeURIComponent(s)}`,style:{...F,...k},"data-testid":"related-all",children:["Sort and filter ",y.description??`these ${I(e,A).toLowerCase()}`,y.targets.some(j=>j.kind!==A)?` (${I(e,A).toLowerCase()})`:""," \u2192"]},A))]},`${y.edgeKind}|${y.direction}|${y.description??""}`)),!ae&&(C.length>0||l.actions.withheld.length>0)?(0,w.jsxs)("section",{style:{..._,display:"grid",gap:14},"data-testid":"record-actions",children:[(0,w.jsx)("h2",{style:D,ref:u,tabIndex:-1,children:"What can be done"}),(0,w.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:C.map(y=>{let A=c===y.id;return(0,w.jsx)("button",{type:"button","data-affordance":y.id,"data-rank":y.rank,"aria-expanded":A,onClick:()=>f(A?null:y.id),style:{...tt,...A?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},children:y.label},y.id)})}),C.map(y=>{if(c!==y.id)return null;let A=e.allMutations().find(j=>j.name===y.mutation);return A?(0,w.jsxs)("div",{style:{display:"grid",gap:10,padding:18,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,w.jsx)("h3",{style:{...D,fontSize:"1.1875rem"},children:y.label}),A.description?(0,w.jsx)("p",{style:{...k,margin:0},children:A.description}):null,(0,w.jsx)(fe,{store:e,mutation:A,prefilled:y.args,open:y.open,label:y.label,onDone:()=>{f(null);let j=y.id;requestAnimationFrame(()=>{(u.current?.parentElement?.querySelector(`[data-affordance="${j.replace(/["\\]/g,"\\$&")}"]`)??u.current)?.focus()})},...r?{principal:r}:{}})]},y.id):null}),l.actions.withheld.length>0?(0,w.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:l.actions.withheld.map(y=>(0,w.jsxs)("li",{style:k,children:[(0,w.jsx)("s",{children:y.label})," \u2014 ",y.refusal.message]},y.id))}):null]}):null,E.length>0?(0,w.jsxs)("section",{style:{..._,display:"grid",gap:10},"data-testid":"record-history",children:[(0,w.jsx)("h2",{style:D,children:"What has happened"}),(0,w.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:E.map(y=>(0,w.jsxs)("li",{style:k,children:[(0,w.jsx)("span",{style:{color:"var(--graview-ink)"},children:y.intent})," \u2014 ",nt(y,r,{graph:e.graph,schema:e.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}})]},y.id))})]}):null]})}var v=$(B(),1),sr=(0,W.lazy)(()=>import("./chunk.V57P4LIZ.js").then(t=>({default:t.DraftPage})));function lr({context:t,children:e}){let n=he(),r=t.store.schema,i=(0,W.useMemo)(()=>({href:a=>q(r,a.kind,a.id),go:a=>n(q(r,a.kind,a.id))}),[r,n]);return(0,v.jsx)(zn.Provider,{value:i,children:(0,v.jsx)(Bn.Provider,{value:(t.titleLevel??(t.framed&&!t.barAbove?1:2))-1,children:e})})}function dr({steering:t}){let e=de(),n=he(),r=`${e.pathname}${e.search}`;return(0,W.useLayoutEffect)(()=>t.at(r),[r,t]),(0,W.useLayoutEffect)(()=>{let i=d=>{d!==r&&n(d)};t.go.current=i;let a=t.pending?.current;return a!==void 0&&(t.pending.current=void 0,i(a)),()=>{t.go.current===i&&(t.go.current=void 0)}},[r,n,t]),null}function pr({context:t,to:e}){let{pathname:n}=de(),r=se(),i=(e??r)?.sayWhere,a=cr(t,n);return(0,W.useEffect)(()=>(i?.(a),()=>i?.(null)),[i,a]),null}function cr(t,e){let[n="",r,i]=e.split("/").filter(Boolean).map(d=>{try{return decodeURIComponent(d)}catch{return d}});if(i!==void 0)return"#";if(n==="places"&&r!==void 0){if(r===kt)return"#overview=1";let d=t.views?.places().find(s=>s.as===r);return d?`#focus=${encodeURIComponent(He(d.kind))}&view=${encodeURIComponent(d.as)}`:"#"}let a=ye(t.store.schema,n);return a?`#focus=${encodeURIComponent(r??He(a))}`:"#"}function gr({onNavigate:t,path:e}){let n=de(),r=Rt(),i=he(),a=`${n.pathname}${n.search}`,d=(0,W.useRef)(t);d.current=t;let s=(0,W.useRef)(null);(0,W.useEffect)(()=>{let o=s.current;s.current=a,o!==null&&(a===o&&r!=="PUSH"||d.current?.(a,r==="POP"?"pop":r==="REPLACE"?"replace":"push"))},[n.key]);let l=(0,W.useRef)(e);return(0,W.useEffect)(()=>{e===void 0||e===l.current||(l.current=e,e!==a&&i(e))},[e]),null}function Ra({context:t,registry:e,page:n}){let r=ke(),i=ye(t.store.schema,r.slug??""),a=n==="list"?Bt:qt,s=(i?e?.lookup(i,n):void 0)??a;return(0,v.jsx)(s,{context:t})}function ur({context:t,registry:e,children:n}){let r=(0,W.useRef)(null);return Rn(r),(0,v.jsx)("div",{ref:r,"data-graview-face":"pages",style:{display:"contents"},children:(0,v.jsx)(ha,{context:t,registry:e,root:r,children:n})})}function mr(){let{pathname:t}=de(),e=Rt(),n=(0,W.useRef)(null);(0,W.useLayoutEffect)(()=>{if(e!=="POP"){for(let a=n.current?.parentElement;a;a=a.parentElement){let{overflowY:d}=getComputedStyle(a);if((d==="auto"||d==="scroll")&&a.scrollHeight>a.clientHeight){a.scrollTop=0;return}}window.scrollTo(0,0)}},[t]);let r=(0,W.useRef)(t),i=(0,W.useRef)(!1);return(0,W.useEffect)(()=>{if(!i.current&&t===r.current)return;i.current=!0;let a=document.activeElement;if(a!==null&&a!==document.body&&a!==document.documentElement)return;let d=n.current?.closest("main")??document.querySelector("main"),l=n.current?.closest("[data-graview-face]")?.querySelector("[data-graview-page-title]")??d?.querySelector("h1, h2")??null??d??null;l&&(l.hasAttribute("tabindex")||l.setAttribute("tabindex","-1"),l.focus({preventScroll:!0}))},[t]),(0,v.jsx)("span",{ref:n,hidden:!0,"data-graview-scroll-reset":""})}function fr({context:t,children:e}){let n=he(),r=(0,W.useMemo)(()=>({record:i=>{let a=t.store.graph.getNode(i);a&&n(q(t.store.schema,a.kind,i))},place:i=>{let a=t.views?.places().find(d=>d.as===i);a&&n(ge(t,a))}}),[t,n]);return(0,v.jsx)(Pn.Provider,{value:r,children:e})}function yr({context:t,Home:e}){let i=de().key==="default"?hn(t.views?.arrangement?.()?.first,t.store.schema,t.views?.places()??[]):void 0,a=i?.to==="place"?ge(t,i.place):i?.to==="kind"?`/${G(t.store.schema,i.kind)}`:void 0;return a?(0,v.jsx)(At,{to:a,replace:!0}):(0,v.jsx)(e,{context:t})}function Aa({context:t,registry:e}){let n=e?.lookupSurface("shell"),r=n!==void 0,i=r&&(e?.without().has("bar")??!1),a=r&&!i&&!t.embedded?{...t,barAbove:!0}:t,d=m=>n===void 0?(0,v.jsx)(it,{context:t,children:m}):i?(0,v.jsx)(n,{context:t,children:m}):(0,v.jsx)(it,{context:t,children:(0,v.jsx)(n,{context:a,children:m})}),s=e?.lookupSurface("home")??Ht,l=e?.lookupSurface("problems")??Gt,o=r?{...a,framed:!0}:t,[c,f]=(0,W.useState)(null),u=(0,W.useMemo)(()=>({onFind:f,find:!(e?.without().has("find")??!1),places:!(e?.without().has("places")??!1)}),[e]),g=(0,v.jsx)(ur,{context:t,registry:e,children:(0,v.jsx)(fr,{context:t,children:d((0,v.jsx)(v.Fragment,{children:(0,v.jsxs)(lr,{context:o,children:[(0,v.jsx)(mr,{}),(0,v.jsxs)(na,{children:[(e?.routes()??[]).map(({path:m,component:x})=>(0,v.jsx)(pe,{path:m,element:(0,v.jsx)(x,{context:o})},m)),(0,v.jsx)(pe,{path:"/",element:(0,v.jsx)(yr,{context:o,Home:s})}),(0,v.jsx)(pe,{path:"/problems",element:(0,v.jsx)(l,{context:o})}),(0,v.jsx)(pe,{path:"/~draft",element:(0,v.jsx)(W.Suspense,{fallback:null,children:(0,v.jsx)(sr,{context:o})})}),(0,v.jsx)(pe,{path:"/search",element:(0,v.jsx)(zt,{context:o})}),(0,v.jsx)(pe,{path:"/map",element:(0,v.jsx)(Kt,{context:o})}),(0,v.jsx)(pe,{path:"/places",element:(0,v.jsx)(Dt,{context:o})}),ce(o).some(m=>m.as===kt)?null:(0,v.jsx)(pe,{path:yn,element:(0,v.jsx)(At,{to:"/",replace:!0})}),(0,v.jsx)(pe,{path:"/places/:as",element:(0,v.jsx)(It,{context:o})}),(0,v.jsx)(pe,{path:"/:slug",element:(0,v.jsx)(Ra,{context:o,registry:e,page:"list"})}),(0,v.jsx)(pe,{path:"/:slug/:id",element:(0,v.jsx)(Ra,{context:o,registry:e,page:"record"})})]})]})}))})});return t.embedded||!r||i?g:(0,v.jsx)(ia.Provider,{value:u,children:(0,v.jsx)($n.Provider,{value:c,children:g})})}function hr({context:t,registry:e,basename:n,initialPath:r,onNavigate:i,path:a,steering:d}){(0,W.useState)(()=>t.views?Vn(t.views,t.store.schema,Wn(t.brand,t.store.schema)):void 0);let s=se(),l=t.store.seenBy(t.principal??{kind:"human"}),o=l===t.store?t:{...t,store:l};bn(t.store,t.principal);let c=(0,v.jsxs)(v.Fragment,{children:[i||a!==void 0?(0,v.jsx)(gr,{onNavigate:i,path:a}):null,d?(0,v.jsx)(dr,{steering:d}):null,o.presence||s?(0,v.jsx)(pr,{context:o,to:s}):null,(0,v.jsx)(Aa,{context:o,...e?{registry:e}:{}})]}),f=o.views?(0,v.jsxs)(xn,{store:o.store,views:o.views,...o.principal?{principal:o.principal}:{},...o.brand?{brand:o.brand}:{},...o.settings?{settings:o.settings}:{},...o.presence&&!s?{presence:o.presence}:{},...o.people?{people:o.people}:{},...o.onKeepLens?{onKeepLens:o.onKeepLens}:{},...o.ai?{ai:o.ai}:{},...o.app?{app:o.app}:{},children:[c,(0,v.jsx)(ma,{context:o})]}):c,u=o.files?(0,v.jsx)(Sn.Provider,{value:o.files,children:f}):f;if(r!==void 0){let g=n===void 0?r:`${n.replace(/\/$/,"")}${r}`;return(0,v.jsx)(ta,{initialEntries:[g],...n===void 0?{}:{basename:n},children:u})}return(0,v.jsx)(aa,{...n===void 0?{}:{basename:n},children:u})}export{Ka as a,hr as b};
@@ -1 +0,0 @@
1
- import{b as _e,c as ae,d as We,e as ne,g as he,h as He,m as Je,o as te}from"./chunk.OHGJ5BZ4.js";import{A as Me,Ab as Ze,D as me,E as Pe,L as ge,M as Te,S as Ne,Z as Fe,a as Oe,b as Re,c as xe,d as ee,da as Ce,db as Le,ea as Ve,f as pe,h as B,ha as ye,i as Ae,ia as Ie,j as je,k as se,l as Se,m as Ee,o as ze,p as De,pb as qe,q as fe,ra as Z,v as Ge,wa as Ke,x as ue,y as $e,zb as Be}from"./chunk.VMEX2KZ4.js";function un(n,l){let e=n.brand??{},o=e.accent?Ze(e.accent):void 0;o&&!o.ok&&l.push(He("brand","brand.accent",`that accent cannot make a readable brand, so the app keeps Graview's colors: ${o.why}`,"pick a color further from orange-red, or a darker one"));let g=typeof e.logo=="string"?{src:e.logo}:e.logo,c=e.name??n.name,O=e.typography?Object.fromEntries(Object.entries(e.typography).filter(([,A])=>typeof A=="string"&&!/url\(|@import|[;{}<>\\]/i.test(A)).map(([A,N])=>[A,Be(N)])):void 0;return{name:c,schemes:o?.ok?o.schemes:qe,...e.currency?{currency:e.currency}:{},...e.locale?{locale:e.locale}:{},...g?{logo:g.src,logoAlt:g.alt??c}:{},...e.favicon?{favicon:e.favicon}:{},...n.description?{subtitle:n.description}:{},...O?{typography:O}:{},...e.shape?{shape:e.shape}:{},...e.accents?{accents:e.accents}:{},...e.scheme?{scheme:e.scheme}:{}}}function Ue(n){let{currency:l,locale:e}=n.brand??{};return{...l?{currency:l}:{},...e?{locale:e}:{}}}var tn=new WeakMap;function Ye(n,l){tn.set(n,l)}var rn=[{where:"settings[]",was:"honoured",now:"honored",since:"0.1.16"},{where:"pages",was:"overview",now:"scene",since:"0.1.17"}],T=n=>typeof n=="object"&&n!==null&&!Array.isArray(n);function Qe(n,l=rn){if(!T(n))return{document:n,respelled:[]};let e=[],o=n;for(let g of l)o=we(o,g.where.split("."),g,"",e);return{document:o,respelled:e}}function we(n,l,e,o,g){if(l.length===0){if(!T(n)||!Object.hasOwn(n,e.was))return n;g.push(`${o}${e.was}`);let{[e.was]:V,...$}=n;return Object.hasOwn(n,e.now)?$:{...$,[e.now]:V}}if(!T(n))return n;let[c,...O]=l,A=c.endsWith("[]"),N=A?c.slice(0,-2):c,z=n[N],D=z;if(!A)D=we(z,O,e,`${o}${N}.`,g);else if(Array.isArray(z)){let V=z.map(($,W)=>we($,O,e,`${o}${N}.${W}.`,g));D=V.some(($,W)=>$!==z[W])?V:z}return D===z?n:{...n,[N]:D}}var Xe="graview-compiled@1",_="id",de=n=>typeof n=="string"&&/^\$[A-Za-z][A-Za-z0-9]*$/.test(n)?n.slice(1):void 0;function on(n){let l=Object.entries(n.fields);return l.find(([,e])=>e.required&&(e.type==="string"||e.type==="text"))?.[0]??l.find(([,e])=>e.type==="string")?.[0]}function en(n,l){let e;switch(n.type){case"string":e=B().check(ee(500));break;case"text":e=B().check(ee(2e4));break;case"number":case"integer":{let o=[...n.type==="integer"?[Se()]:[],...n.min===void 0?[]:[Re(n.min)],...n.max===void 0?[]:[Oe(n.max)],...n.step===void 0?[]:[xe(n.step)]];e=o.length>0?se().check(...o):se();break}case"boolean":e=Ee();break;case"date":e=B().check(pe(me,"a date like 2026-10-02"));break;case"datetime":e=B().check($e(o=>!Number.isNaN(Date.parse(o)),"a date and time like 2026-10-02T14:30:00Z"));break;case"enum":e=Ge(n.options);break;case"list":e=De(n.of==="number"?se():n.of==="date"?B().check(pe(me)):n.of==="image"||n.of==="file"?ge(n.of):B().check(ee(500))).check(ee(200));break;case"image":case"file":e=ge(n.type);break;case"url":e=je();break;case"email":e=Ae();break}return n.description&&(e=e.check(Me(n.description))),l?ue(e):e}var re=n=>{throw new Z(`there is no record "${n}"`,"invalid")},sn=n=>"field"in n?en(n.field,n.optional):"ref"in n?Ke(n.ref):ue(ze()),an=new WeakMap;var ke=(n,l)=>T(l)&&Object.keys(n??{}).length===Object.keys(l).length&&Object.keys(n??{}).every(e=>Object.hasOwn(l,e));function zn(n,l={}){let e=T(n)?n.format:void 0;if(e!==Xe)return{ok:!1,findings:[he("compiled-format","format",e===void 0?"this is not a compiled Graview app":`this compiled app is ${JSON.stringify(e)}, and this build reads ${Xe}`,"compile the document instead")]};let o=n,g=Qe(o.document).document,c=g===o.document?o:{...o,document:g},O=T(g)&&typeof g.name=="string"&&T(g.kinds)&&ke(g.kinds,c.kinds)&&ke(g.acts,c.acts)&&ke(g.rules,c.rules)&&Array.isArray(c.edges)&&Array.isArray(c.findings),A={ok:!1,findings:[he("compiled-shape","","this compiled app's parts do not match its document","compile the document instead")]};if(!O)return A;try{return dn(c,l)}catch{return A}}function dn(n,l={}){let{document:e}=n,o=l.today??Pe,g=new Map(n.edges.map(([u,t])=>[u,t])),c=new Map;for(let[u,t]of Object.entries(e.kinds)){let R=n.kinds[u]?.computed;c.set(u,{fields:new Set(Object.keys(t.fields)),edges:new Map(Object.entries(t.edges??{}).map(([b,E])=>[b,E.cardinality??"many"])),...R?{computed:new Map(R)}:{}})}n.facts&&c.set(_e,{computed:new Map(n.facts)});let O=Ue(e),A=new Map,N=Object.entries(e.kinds).map(([u,t])=>{let R={};for(let[i,h]of Object.entries(t.fields))R[i]=en(h,!h.required);let{label:b,describe:E}=n.kinds[u]??{},F=Object.entries(t.computed??{}).map(([i,h])=>[i,typeof h=="string"?{expr:h}:h]),M=Object.fromEntries([...Object.entries(t.fields).filter(([,i])=>i.label).map(([i,h])=>[i,h.label]),...F.filter(([,i])=>i.label).map(([i,h])=>[i,h.label])]),I=Object.keys(M).length>0,C=Object.fromEntries(Object.entries(t.fields).filter(([,i])=>i.default!==void 0).map(([i,h])=>[i,h.default]));A.set(u,C);let j=Object.fromEntries(Object.entries(t.edges??{}).map(([i,{renamedFrom:h,...H}])=>[i,H])),p=i=>t[i]?{[i]:t[i]}:{};return Te(u,{fields:fe(R),edges:j,...p("plural"),...p("noun"),...p("description"),...b?{label:i=>te(b,{node:i,kinds:c,today:o(),money:O})||i.id}:{},...E?{describe:i=>te(E,{node:i,kinds:c,today:o(),money:O})}:{},...p("lifecycle"),...p("figure"),...p("fieldRoles"),...p("people"),...t.computed&&Object.keys(t.computed).length>0?{computed:t.computed}:{},...I||t.glance||t.page?{display:{...I?{labels:M}:{},...t.glance?{glance:[...t.glance]}:{},...t.page?{page:t.page}:{}}}:{},...Object.keys(C).length>0?{defaults:C}:{}})}),z=Ce(N,e.computed);function D(u){return z.tryDefinition(u.kind)?.label?.(u)??u.id}let V=u=>({id:"",kind:u,...A.get(u)}),$=[];for(let[u,t]of Object.entries(e.acts??{})){let R=n.acts[u],{title:b,effects:E,guard:F,refusal:M,destructive:I,idempotent:C,creates:j,connects:p,severs:i,writes:h,writesOther:H,sets:v}=R,J=new Map(R.args),K={};for(let[a,x]of J)K[a]=sn(x);let U=[t.on??[]].flat(),oe=new Map(R.exprs),G=E.find(a=>"create"in a),L=(a,x,y,w=null)=>{if(T(a)&&"expr"in a)return ne(oe.get(a.expr),{graph:y,subject:w,kinds:c,bindings:x,today:o()});let m=de(a);return m===void 0?typeof a=="string"&&a.startsWith("$$")?a.slice(1):a:m==="now"?new Date().toISOString():m==="today"?o():x[m]},nn=(a,x)=>{if(!G)return"";let y=e.kinds[G.create].fields,w=V(G.create),m=[];for(let[k,X]of Object.entries(G.set??{})){try{w[k]=L(X,a,x)??w[k]}catch{}let Y=de(X);Y&&a[Y]!==void 0&&m.push(k)}let P=D(w).trim(),q=m.filter(k=>w[k]!==!1&&y[k].type!=="text"&&D({...w,[k]:void 0}).trim()===P).map(k=>w[k]===!0?y[k].label??Ne(k):Je(w[k],y[k].format,o(),[],O));return P&&q.length>0?`${P} (${q.join(", ")})`:P};$.push(Le(u,{input:fe(K),title:b,...t.description?{description:t.description}:{},...t.fromTheOtherEnd?{fromTheOtherEnd:t.fromTheOtherEnd}:{},...J.has(_)?{subject:{kinds:U.length>0?U:"*",arg:_}}:{},...I?{destructive:!0}:{},...C?{idempotent:!0}:{},...j.length>0?{creates:j}:{},...p.length>0?{connects:p}:{},...i.length>0?{severs:i}:{},writes:h,...Object.keys(H).length>0?{writesOther:H}:{},...Object.keys(v).length>0?{sets:v}:{},describe:(a,x)=>{let y=typeof a[_]=="string"?x.getNode(a[_]):void 0,w=y?D(y):nn(a,x);return w?`${b}: ${w}`:b},apply(a,x){let y=a.graph,w=typeof x[_]=="string"?x[_]:void 0,m=w?y.getNode(w):void 0;if(w&&!m&&re(w),m&&U.length>0&&!U.includes(m.kind))throw new Z(`"${b}" acts on ${U.join(" or ")}, not on ${Fe(m.kind)}`,"invalid");let P={};for(let[r,s]of Object.entries(x))s!==void 0&&(P[r]=s);if(F&&m){let r;try{r=ne(F,{graph:y,subject:m,kinds:c,bindings:P,today:o()})}catch(s){throw s instanceof ae?new Z(`"${b}" could not be judged: ${s.sentence}`):s}if(r!==!0)throw new Z(M?te(M,{node:m,kinds:c,graph:y,bindings:P,today:o(),money:O}):`"${b}" is not allowed for ${D(m)} right now`)}let q=new Map,k=r=>y.has(r)||[...q.values()].includes(r),X=new Set,Y=r=>{let s=Ve(r);X.has(s)||(X.add(s),a.removeEdge(r))},Q=(r,s)=>{let d=de(r);if(d==="subject")return w;if(d==="me"){let f=a.me;if(f&&e.kinds[y.getNode(f)?.kind]?.people)return f;throw new Z(`"${b}" is done as you, and you have no record here`)}if(q.has(d))return q.get(d);try{return L(r,P,y,s??m??null)}catch(f){throw f instanceof ae?new Z(`"${b}" could not work out a value: ${f.sentence}`):f}};for(let r of E)if("create"in r){let s=e.kinds[r.create],d=V(r.create);for(let[le,ie]of Object.entries(r.set??{})){let ve=Q(ie,void 0);ve!==void 0&&(d[le]=ve)}let f=on(s),S=a.freshId(String((f&&d[f])??r.create),r.create);a.addNode({...d,id:S}),r.as&&q.set(r.as,S)}else if("connect"in r||"sever"in r){let s="connect"in r?r.connect:r.sever,d=String(Q(r.from,void 0)??""),f=String(Q(r.to,void 0)??"");if(k(d)||re(d),k(f)||re(f),"connect"in r){if(g.get(s)?.cardinality==="one")for(let S of y.out(d,s))S.id!==f&&Y({kind:s,from:d,to:S.id});y.out(d,s).some(S=>S.id===f)||a.addEdge({kind:s,from:d,to:f})}else Y({kind:s,from:d,to:f})}else if("set"in r){let s=String(Q(r.target??"$subject",void 0)??""),d=y.getNode(s);!d&&!k(s)&&re(s);let f={};for(let[S,le]of Object.entries(r.set)){let ie=Q(le,d);ie!==void 0&&(f[S]=ie)}Object.keys(f).length>0&&a.patchNode(s,f)}else if("remove"in r){let s=String(Q(r.remove,void 0)??"");y.has(s)||re(s),a.removeNode(s)}else if("replace"in r&&m){let s=x.to;for(let d of r.replace){let f=g.get(d)?.from.includes(m.kind)??!0;for(let S of f?y.out(m.id,d):y.in(m.id,d))d===r.keep&&S.id===s||Y(f?{kind:d,from:m.id,to:S.id}:{kind:d,from:S.id,to:m.id})}}}}))}let W=[];for(let[u,t]of Object.entries(e.rules??{})){let{title:R,require:b,when:E,says:F}=n.rules[u],M=t.repairs??[],I=(j,p)=>{let i={graph:j,subject:p,kinds:c,today:o()},h;try{if(E&&ne(E,i)!==!0)return[];h=ne(b,i)===!0}catch(v){throw v instanceof We?new Ie(v.sentence):v instanceof ae?new Error(v.sentence):v}if(h)return[];let H=M.flatMap(v=>{let J=e.acts?.[v.act],K={};p&&(J?.on||/^(edit|remove)-/.test(v.act))&&(K[_]=p.id);for(let[G,L]of Object.entries(v.args??{}))K[G]=de(L)==="subject"?p?.id:L;let oe=(J?n.acts[v.act].args:[]).filter(([G,L])=>L.required&&K[G]===void 0).map(([G])=>G);return[{mutation:v.act,label:v.label??J?.title??v.act.replace(/-/g," "),args:K,...oe.length>0?{missing:oe}:{}}]});return[{invariant:u,...p?{subjectId:p.id}:{},label:R,message:F?te(F,{node:p,kinds:c,graph:j,today:o(),money:O}):p?`${D(p)}: ${R}`:R,nodeIds:p?[p.id]:[],repairs:H}]},C={label:R,shape:{over:t.over,require:b,when:E,says:F,declared:e.kinds,money:O,kinds:c,today:o},judgment:{require:t.require,...t.when?{when:t.when}:{},...t.says?{says:t.says}:{}},...t.description?{description:t.description}:{},...M.length>0?{repairs:M.map(j=>j.act)}:{}};W.push(t.over==="graph"?ye(u,{scope:"graph",...C,evaluate:({graph:j})=>I(j,null)}):ye(u,{scope:{kind:t.over},...C,evaluate:({graph:j,subject:p})=>I(j,p)}))}let be=e.policy&&{...e.policy,...e.roles?{roles:e.roles}:{}},ce={name:e.name,schema:z,mutations:$,invariants:W,...be?{policy:be}:{},...n.brand?{brand:n.brand}:{},...e.modules?{modules:e.modules}:{},...e.lenses?{lenses:e.lenses}:{},...e.pages?{pages:e.pages}:{},...e.settings?{settings:e.settings}:{},...n.viewSpecs?{viewSpecs:n.viewSpecs}:{},...n.home?{home:n.home}:{},version:e.version??1};return Ye(ce,e),an.set(ce,n),{ok:!0,app:ce,document:e,findings:n.findings,sights:e.policy?.sees,kinds:c}}export{Qe as a,un as b,Xe as c,_ as d,de as e,on as f,zn as g,dn as h};
@@ -1 +0,0 @@
1
- import{a as G}from"./chunk.I5KD54S6.js";import{Aa as W,Lb as V,Na as j,R as B,Za as F,ba as C,eb as U,fb as q,g as z,sa as L,ya as x}from"./chunk.VMEX2KZ4.js";function K(e){return z(e,{io:"input",unrepresentable:"any",override:ae})}var re={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string"};function ae(e){let n=e.zodSchema._zod?.def;if(!n||n.type!=="string"||typeof n.format!="string"||n.format==="regex")return;let t=e.jsonSchema,f=(n.checks??[]).map(s=>s._zod?.def).filter(s=>s?.format==="regex"&&s.pattern instanceof RegExp).map(s=>s.pattern.source);delete t.pattern;let l=t.allOf;Array.isArray(l)&&l.every(s=>typeof s=="object"&&s!==null&&Object.keys(s).length===1&&"pattern"in s)&&delete t.allOf,t.format=re[n.format]??n.format,f.length===1?t.pattern=f[0]:f.length>1&&(t.allOf=f.map(s=>({pattern:s})))}function _(e){let n=x(e.input),t=K(e.input),f=t.properties??{};if(U(e)){let l=e.creates.join(" | ");f.id={type:"string",minLength:1,description:`Optional: the id for the ${l} this makes. Refused if the graph already has it; left out, one is minted from the label.`},t.properties=f}q(e)&&(t.additionalProperties=!1);for(let l of n){let s=f[l.name];if(!s)continue;let k=l.kinds.includes("*")?"any node kind":l.kinds.join(" | ");s.description=[s.description,`Id of a node (${k}).`].filter(Boolean).join(" ")}return{name:e.name,...e.title===void 0?{}:{title:e.title},description:e.description??e.title??e.name,inputSchema:t,nodeRefs:n}}function Z(e){let n=new Set;for(let t=e;t;t=t.onBehalfOf)t.id!==void 0&&n.add(`${t.kind}:${t.id}`);return n}function O(e,n){let t=Z(n),f=y=>{if(y.kind==="rule")return!1;let m=Z(y);if(m.size===0)return!1;for(let h of m)if(t.has(h))return!1;return!0},l,s=()=>{if(l)return l;l=new Map;for(let y of e.log.live()){if(y.undoes!==void 0)continue;let m=f(y.author)?y.author:void 0;for(let h of y.primitives){h.op==="remove-node"&&l.delete(h.node.id);let i=h.op==="add-node"?h.node.id:h.op==="patch-node"?h.id:void 0;if(i===void 0)continue;let r=h.op==="add-node"?Object.keys(h.node):Object.keys(h.after),c=l.get(i);(h.op==="add-node"||!c)&&l.set(i,c=new Map);for(let p of r)p==="id"||p==="kind"||(m?c.set(p,m):c.delete(p))}}return l},k=e.schema,g=new Map,v=(y,m)=>{let h=`${y}\0${m}`,i=g.get(h);if(i===void 0){let r=k.tryDefinition(y)?.fields?.shape;i=r!==void 0&&m in r&&W(r[m]).type==="text",g.set(h,i)}return i},b=y=>e.graph.getNode(y)?.kind;return{prose:v,say:y=>C(y,{graph:e.graph,schema:k}),fieldBy(y,m){let h=b(y);if(!(h===void 0||!v(h,m)))return s().get(y)?.get(m)},recordBy(y){let m=b(y),h=s().get(y);if(m===void 0||!h)return;let i;for(let[r,c]of h)v(m,r)&&(i=c);return i}}}var D=(e,n,t)=>({untrusted:!0,authoredBy:t.say(n),text:e});function I(e,n){return{...e,hits:e.hits.map(t=>{if(t.about!=="node")return t;let f=n.recordBy(t.id);if(!f)return t;let l=n.prose(t.kind,t.why.field)?n.fieldBy(t.id,t.why.field):f;return{...t,label:D(t.label,f,n),...t.apart!==void 0?{apart:D(t.apart,f,n)}:{},why:l?{...t.why,fragment:D(t.why.fragment,l,n)}:t.why}})}}var J=e=>{let n;return()=>n??=e().catch(t=>{throw n=void 0,t})},se=J(()=>import("./chunk.ZKM4P7US.js")),de=()=>import("./chunk.VMD4PDYJ.js").catch(()=>{}),le=async()=>{(await de())?.judgeWithLines()},R=J(()=>import("./chunk.E3SZ7T75.js")),ce=J(()=>import("./chunk.YV2RTNPU.js")),S=e=>({title:e,readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}),M={type:"number",description:"Where the page starts; 0 when unsaid."},P=[{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; at most 20."},subject:{type:"string",description:"A node id whose acts to include."}},required:["query"],additionalProperties:!1},mutating:!1,annotations:S("Find by name")},{name:"get_graph",title:"Read the graph",description:"Read the graph, 25 nodes a page: their fields, the edges out of them, and how many more. Start here when you need the shape of the domain rather than one thing in it.",inputSchema:{type:"object",properties:{offset:M},additionalProperties:!1},mutating:!1,annotations:S("Read the graph")},{name:"get_node",title:"Read one node",description:"Read one node: its fields, its links (id, kind and label, 20 each way a page), the violations that implicate it, and 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."},offset:M},required:["id"],additionalProperties:!1},mutating:!1,annotations:S("Read one node")},{name:"get_violations",title:"List the problems",description:"List the invariant violations the graph currently has, 20 a page, 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:{offset:M,context:{type:"object",description:"Evaluation context, e.g. { weekStart }."}},additionalProperties:!1},mutating:!1,annotations:S("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:S("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:S("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:S("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}}],N={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"]},$={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:N,current:N},additionalProperties:!1},mutating:!1,annotations:S("Draw a view")},Y={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:{...N,additionalProperties:!1},mutating:!0,annotations:{title:"Keep a view as a lens",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}};function ue(e,n){return e===void 0?[]:e==="keep"&&!n?[$,Y]:[$]}var fe="An argument that names a record takes its id or its name.",Q=[...P.map(e=>e.name),$.name,Y.name],ee=64;function T(e){let{line:n,...t}=e;return t}function X(e){return{...e,...e.introduces?{introduces:e.introduces.map(T)}:{},...e.resolves?{resolves:e.resolves.map(T)}:{},...e.violationsAfter?{violationsAfter:e.violationsAfter.map(T)}:{}}}function pe(e){let n=e.normalize("NFKD").replace(/\p{M}/gu,"").replace(/[^A-Za-z0-9_-]/g,"_");return n.length===0&&(n="act"),/^[A-Za-z_]/.test(n)||(n=`act_${n}`),n.slice(0,ee)}function he(e){let n=new Set(Q),t=new Map;for(let f of e){let l=pe(f),s=l;for(let k=2;n.has(s);k+=1)s=`${l.slice(0,ee-`_${k}`.length)}_${k}`;n.add(s),t.set(f,s)}return t}function ye(e,n){let t=_(e),f=B(e),l=t.nodeRefs.length>0?`${t.description}${/[.!?]$/.test(t.description)?"":"."} ${fe}`:t.description;return{name:n,title:f,description:l,inputSchema:t.inputSchema,mutating:!0,annotations:{title:f,readOnlyHint:!1,destructiveHint:e.destructive===!0||(e.severs?.length??0)>0,idempotentHint:e.idempotent===!0,openWorldHint:!1},act:e.name}}function H(e){if(e===null||typeof e!="object")return JSON.stringify(e)??"null";if(Array.isArray(e))return`[${e.map(H).join(",")}]`;let n=e;return`{${Object.keys(n).filter(t=>n[t]!==void 0).sort().map(t=>`${JSON.stringify(t)}:${H(n[t])}`).join(",")}}`}function me(e){return`sha256:${V(H(e))}`}function ge(e,n,t,f){let l=he(e.map(g=>g.name)),s=ue(f,t);return{definitions:t?[...P.filter(g=>!g.mutating),...s]:[...P,...s,...e.filter(g=>n.has(g.name)).map(g=>ye(g,l.get(g.name)))],names:l}}function Fe(e,n={}){let t=n.author??{kind:"agent"},f=e.allMutations(),l=new Set(e.permittedMutations(t).map(i=>i.name)),{definitions:s,names:k}=ge(f,l,n.readOnly===!0,n.drafts?n.drafts.keep?"keep":"draw":void 0),g=me(s),v=i=>{if(!Q.includes(i)){for(let[r,c]of k)if(c===i)return r;return k.has(i)?i:void 0}},b=(i,r)=>{let c=f.find(a=>a.name===i);if(!c)return{args:r,resolved:[]};let p={...r},o=[];for(let a of x(c.input)){let d=p[a.name];if(typeof d!="string"||d.trim()==="")continue;let u=e.resolveRef(a,d,t);if(!u.ok){let w=u.reason==="none"?` Nothing was changed. Use search_graph to look it up, then pass its id as ${a.name}.`:" Nothing was changed.";return{ok:!1,error:`${u.message}${w}`,argument:a.name,candidates:u.candidates}}u.by!=="id"&&(p[a.name]=u.id,o.push({argument:a.name,given:d,id:u.id,label:u.label}))}return{args:p,resolved:o}},y=async(i,r)=>{try{await le();let c=s.find(o=>o.name===i)??s.find(o=>o.act===i);if(!c){let o=v(i);if(o){let a=e.permits({name:o,args:r},t);if(!a.ok)return{ok:!1,error:a.refusal.message,reason:"forbidden"}}return{ok:!1,error:`Unknown tool "${i}". Available: ${s.map(a=>a.name).join(", ")}`}}if(c.mutating&&n.readOnly)return{ok:!1,error:`"${i}" changes the graph, and this seat is read-only.`,reason:"forbidden"};if(c.act!==void 0){let o=b(c.act,r);if("ok"in o)return o;let a=j(e,t,e.apply({name:c.act,args:o.args},{...n.author?{author:n.author}:{},...we(n.via)}));return{ok:!0,data:{batch:a.batch,intent:a.intent,introduces:a.introduces.map(T),resolves:a.resolves.map(T),...o.resolved.length>0?{resolved:o.resolved}:{}},diff:a.diff}}let p=e.seenBy(t);switch(c.name){case"search_graph":{let o=typeof n.places=="function"?n.places():n.places,a=typeof r.subject=="string"?r.subject:void 0,d=F(p,String(r.query??""),{principal:t,limit:typeof r.limit=="number"&&r.limit>0?Math.min(r.limit,20):20,...o?{places:o}:{},...a?{subject:a,from:[a]}:{}});return{ok:!0,data:(await R()).searchRead(d,I(d,O(p,t))),reads:d.hits.flatMap(u=>u.about==="node"?[u.id]:[])}}case"get_graph":return{ok:!0,...(await R()).graphRead(p,O(p,t),r)};case"get_node":{let o=String(r.id??""),a=o,d;if(!p.graph.getNode(o)){let w=o.trim()===""?void 0:e.resolveRef({name:"id",kinds:["*"]},o,t);if(w?.ok)a=w.id,d={argument:"id",given:o,id:a,label:w.label};else return w?.reason==="ambiguous"?{ok:!1,error:w.message,argument:"id",candidates:w.candidates}:{ok:!1,error:`No node "${o}".`}}let u=(await R()).nodeRead(p,O(p,t),a,r);return{ok:!0,data:d?{...u.data,resolved:[d]}:u.data,reads:u.reads}}case"describe_place":{let o=n.app??{name:"",schema:e.schema},a=typeof r.width=="number"&&Number.isFinite(r.width)&&r.width>0?r.width:1440,{describePlace:d}=await se(),u=d(e,t,String(r.place??""),{app:o,width:a});if(!u.ok)return{ok:!1,error:`${u.error} The places are: ${u.places.join(", ")}.`};let w=new Set,A=ne=>{for(let te of ne)for(let oe of te.groups??[])for(let E of oe.items)w.add(E.id),A(E.parts)};return A(u.description.parts),{ok:!0,data:u.description,reads:[...w]}}case"draft_view":case"keep_lens":{let o=n.app??{name:"",schema:e.schema};return(await ce()).runDraftTool(c.name,r,{app:o,principal:t,...n.drafts?{drafts:n.drafts}:{}})}case"get_violations":{let o=p.violations(r.context);return{ok:!0,...(await R()).violationsRead(o,r)}}case"get_affordances":{let o=r.selection??[];return{ok:!0,data:G(p,o,{...typeof n.derive=="function"?n.derive():n.derive,...n.author?{principal:n.author}:{},...r.context?{context:r.context}:{}}),reads:o.filter(d=>p.graph.has(d))}}case"preview_mutation":{let o=String(r.mutation),a=v(o)??o,d=b(a,r.args??{});if("ok"in d)return d;let u=e.missingFor({name:a,args:d.args},t);if(u)return{ok:!1,error:u.message,reason:"missing"};let w=j(e,t,e.preview({name:a,args:d.args},void 0,{author:t})),A=X(w);return{ok:!0,data:d.resolved.length>0?{...A,resolved:d.resolved}:A}}case"undo_batch":{let o=String(r.batch),a=r.include??[],d=p.canUndo([o,...a]);if(!d.ok)return{ok:!1,error:d.message};let u=j(e,t,e.undo([o,...a],{...n.author?{author:n.author}:{}}));return{ok:!0,data:X(u),diff:u.diff}}default:return{ok:!1,error:`Unknown tool "${i}".`}}}catch(c){let{reason:p,wouldNeed:o}=L(c);return{ok:!1,error:c instanceof Error?c.message:String(c),reason:p,...o?{wouldNeed:o}:{}}}},m=new Set,h=i=>{for(let r of m)r(i)};return{definitions:s,hash:g,...n.author?{author:n.author}:{},onDiff(i){return e.subscribe(i)},onCall(i){return m.add(i),()=>m.delete(i)},async call(i,r){let c=(s.find(d=>d.name===i)??s.find(d=>d.act===i))?.mutating??!1,p={name:i,args:r,mutating:c,at:new Date().toISOString()};h({...p,phase:"running"});let o=d=>(h(d.ok?{...p,phase:"ok",...!c&&d.reads?{reads:d.reads}:{}}:{...p,phase:"failed",error:d.error}),d),a=await y(i,r);return o(a.ok&&!c?{...a,data:(await R()).withinReadChars(i,a.data)}:a)}}}function we(e){let n=typeof e=="function"?e():e;return n?{via:n}:{}}export{H as a,Fe as b};
@@ -1,25 +0,0 @@
1
- import{a as _}from"./chunk.AJZBJBMO.js";var Y=_(u=>{"use strict";var R=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),G=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),Q=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),X=Symbol.for("react.activity"),S=Symbol.iterator;function Z(t){return t===null||typeof t!="object"?null:(t=S&&t[S]||t["@@iterator"],typeof t=="function"?t:null)}var O={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},H=Object.assign,g={};function E(t,e,n){this.props=t,this.context=e,this.refs=g,this.updater=n||O}E.prototype.isReactComponent={};E.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};E.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function N(){}N.prototype=E.prototype;function m(t,e,n){this.props=t,this.context=e,this.refs=g,this.updater=n||O}var C=m.prototype=new N;C.constructor=m;H(C,E.prototype);C.isPureReactComponent=!0;var j=Array.isArray;function T(){}var i={H:null,A:null,T:null,S:null},$=Object.prototype.hasOwnProperty;function d(t,e,n){var r=n.ref;return{$$typeof:R,type:t,key:e,ref:r!==void 0?r:null,props:n}}function J(t,e){return d(t.type,e,t.props)}function A(t){return typeof t=="object"&&t!==null&&t.$$typeof===R}function V(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var w=/\/+/g;function v(t,e){return typeof t=="object"&&t!==null&&t.key!=null?V(""+t.key):e.toString(36)}function K(t){switch(t.status){case"fulfilled":return t.value;case"rejected":throw t.reason;default:switch(typeof t.status=="string"?t.then(T,T):(t.status="pending",t.then(function(e){t.status==="pending"&&(t.status="fulfilled",t.value=e)},function(e){t.status==="pending"&&(t.status="rejected",t.reason=e)})),t.status){case"fulfilled":return t.value;case"rejected":throw t.reason}}throw t}function l(t,e,n,r,o){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var f=!1;if(t===null)f=!0;else switch(s){case"bigint":case"string":case"number":f=!0;break;case"object":switch(t.$$typeof){case R:case U:f=!0;break;case h:return f=t._init,l(f(t._payload),e,n,r,o)}}if(f)return o=o(t),f=r===""?"."+v(t,0):r,j(o)?(n="",f!=null&&(n=f.replace(w,"$&/")+"/"),l(o,e,n,"",function(L){return L})):o!=null&&(A(o)&&(o=J(o,n+(o.key==null||t&&t.key===o.key?"":(""+o.key).replace(w,"$&/")+"/")+f)),e.push(o)),1;f=0;var p=r===""?".":r+":";if(j(t))for(var c=0;c<t.length;c++)r=t[c],s=p+v(r,c),f+=l(r,e,n,s,o);else if(c=Z(t),typeof c=="function")for(t=c.call(t),c=0;!(r=t.next()).done;)r=r.value,s=p+v(r,c++),f+=l(r,e,n,s,o);else if(s==="object"){if(typeof t.then=="function")return l(K(t),e,n,r,o);throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.")}return f}function a(t,e,n){if(t==null)return t;var r=[],o=0;return l(t,r,"","",function(s){return e.call(n,s,o++)}),r}function F(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var P=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},tt={map:a,forEach:function(t,e,n){a(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return a(t,function(){e++}),e},toArray:function(t){return a(t,function(e){return e})||[]},only:function(t){if(!A(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};u.Activity=X;u.Children=tt;u.Component=E;u.Fragment=D;u.Profiler=b;u.PureComponent=m;u.StrictMode=q;u.Suspense=W;u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i;u.__COMPILER_RUNTIME={__proto__:null,c:function(t){return i.H.useMemoCache(t)}};u.cache=function(t){return function(){return t.apply(null,arguments)}};u.cacheSignal=function(){return null};u.cloneElement=function(t,e,n){if(t==null)throw Error("The argument must be a React element, but you passed "+t+".");var r=H({},t.props),o=t.key;if(e!=null)for(s in e.key!==void 0&&(o=""+e.key),e)!$.call(e,s)||s==="key"||s==="__self"||s==="__source"||s==="ref"&&e.ref===void 0||(r[s]=e[s]);var s=arguments.length-2;if(s===1)r.children=n;else if(1<s){for(var f=Array(s),p=0;p<s;p++)f[p]=arguments[p+2];r.children=f}return d(t.type,o,r)};u.createContext=function(t){return t={$$typeof:G,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null},t.Provider=t,t.Consumer={$$typeof:z,_context:t},t};u.createElement=function(t,e,n){var r,o={},s=null;if(e!=null)for(r in e.key!==void 0&&(s=""+e.key),e)$.call(e,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(o[r]=e[r]);var f=arguments.length-2;if(f===1)o.children=n;else if(1<f){for(var p=Array(f),c=0;c<f;c++)p[c]=arguments[c+2];o.children=p}if(t&&t.defaultProps)for(r in f=t.defaultProps,f)o[r]===void 0&&(o[r]=f[r]);return d(t,s,o)};u.createRef=function(){return{current:null}};u.forwardRef=function(t){return{$$typeof:B,render:t}};u.isValidElement=A;u.lazy=function(t){return{$$typeof:h,_payload:{_status:-1,_result:t},_init:F}};u.memo=function(t,e){return{$$typeof:Q,type:t,compare:e===void 0?null:e}};u.startTransition=function(t){var e=i.T,n={};i.T=n;try{var r=t(),o=i.S;o!==null&&o(n,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(T,P)}catch(s){P(s)}finally{e!==null&&n.types!==null&&(e.types=n.types),i.T=e}};u.unstable_useCacheRefresh=function(){return i.H.useCacheRefresh()};u.use=function(t){return i.H.use(t)};u.useActionState=function(t,e,n){return i.H.useActionState(t,e,n)};u.useCallback=function(t,e){return i.H.useCallback(t,e)};u.useContext=function(t){return i.H.useContext(t)};u.useDebugValue=function(){};u.useDeferredValue=function(t,e){return i.H.useDeferredValue(t,e)};u.useEffect=function(t,e){return i.H.useEffect(t,e)};u.useEffectEvent=function(t){return i.H.useEffectEvent(t)};u.useId=function(){return i.H.useId()};u.useImperativeHandle=function(t,e,n){return i.H.useImperativeHandle(t,e,n)};u.useInsertionEffect=function(t,e){return i.H.useInsertionEffect(t,e)};u.useLayoutEffect=function(t,e){return i.H.useLayoutEffect(t,e)};u.useMemo=function(t,e){return i.H.useMemo(t,e)};u.useOptimistic=function(t,e){return i.H.useOptimistic(t,e)};u.useReducer=function(t,e,n){return i.H.useReducer(t,e,n)};u.useRef=function(t){return i.H.useRef(t)};u.useState=function(t){return i.H.useState(t)};u.useSyncExternalStore=function(t,e,n){return i.H.useSyncExternalStore(t,e,n)};u.useTransition=function(){return i.H.useTransition()};u.version="19.2.8"});var et=_((st,k)=>{"use strict";k.exports=Y()});var x=_(y=>{"use strict";var nt=Symbol.for("react.transitional.element"),rt=Symbol.for("react.fragment");function M(t,e,n){var r=null;if(n!==void 0&&(r=""+n),e.key!==void 0&&(r=""+e.key),"key"in e){n={};for(var o in e)o!=="key"&&(n[o]=e[o])}else n=e;return e=n.ref,{$$typeof:nt,type:t,key:r,ref:e!==void 0?e:null,props:n}}y.Fragment=rt;y.jsx=M;y.jsxs=M});var ut=_((it,I)=>{"use strict";I.exports=x()});export{et as a,ut as b};
2
- /*! Bundled license information:
3
-
4
- react/cjs/react.production.js:
5
- (**
6
- * @license React
7
- * react.production.js
8
- *
9
- * Copyright (c) Meta Platforms, Inc. and affiliates.
10
- *
11
- * This source code is licensed under the MIT license found in the
12
- * LICENSE file in the root directory of this source tree.
13
- *)
14
-
15
- react/cjs/react-jsx-runtime.production.js:
16
- (**
17
- * @license React
18
- * react-jsx-runtime.production.js
19
- *
20
- * Copyright (c) Meta Platforms, Inc. and affiliates.
21
- *
22
- * This source code is licensed under the MIT license found in the
23
- * LICENSE file in the root directory of this source tree.
24
- *)
25
- */
@@ -1 +0,0 @@
1
- import{a as U}from"./chunk.7SVIRYBB.js";import{c as J}from"./chunk.ZMMMKTAG.js";import{a as T,c as K,f as W,g as D,k as _,l as j,m as X}from"./chunk.CW7BMVBG.js";import{e as Q,g as Y,i as Z}from"./chunk.IZDKEFPJ.js";import{c as z}from"./chunk.6LJ66MB7.js";import{da as G,fa as I,na as V,ua as q}from"./chunk.OYULDOQP.js";import{Ob as N,nb as L,xb as M,yb as O}from"./chunk.VMEX2KZ4.js";import{a as ae,b as $}from"./chunk.MRK6QJV5.js";import{b as F}from"./chunk.AJZBJBMO.js";var o=F(ae(),1);function se(e){let t=[e?.typography?.body,e?.typography?.display,e?.typography?.mono],n=[];for(let a of t){let r=a?.split(",")[0]?.trim().replace(/^["']|["']$/g,"");!r||O(r)||r.toLowerCase()!==L.toLowerCase()&&(n.includes(r)||n.push(r))}return n}function ee(e){let t=se(e);return t.length===0?null:`https://fonts.googleapis.com/css2?${t.map(a=>`family=${encodeURIComponent(a).replace(/%20/g,"+")}:wght@400;500;600;700`).join("&")}&display=swap`}var u=F($(),1);function ge(e,t){let{app:n}=e;return(0,o.useMemo)(()=>{let a=Y(t(n.schema,n.viewSpecs),n),r=e.views?V(a,e.views(n.schema,a)):a;return Z(r,n.schema,Q(e.brand??n.brand,n.schema)),r},[e.views,n.schema,n.viewSpecs,n.lenses,n.pages,n.home])}function ie(e,t){return new N({schema:e.schema,mutations:e.mutations??[],invariants:e.invariants??[],...t?{snapshot:t}:{},...e.policy?{policy:e.policy}:{},...e.intelligence?{intelligence:e.intelligence}:{}})}function ne(e){if(typeof document>"u")return e==="dark"?"dark":"light";let t=document.documentElement.dataset.theme;return t==="dark"||t==="light"?t:e==="dark"||e==="light"?e:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ce(e,t){let[n,a]=(0,o.useState)(()=>ne(t));return(0,o.useEffect)(()=>{if(!e||typeof document>"u")return;let r=()=>a(ne(t));r();let i=new MutationObserver(r);i.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});let d=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):null;return d?.addEventListener?.("change",r),()=>{i.disconnect(),d?.removeEventListener?.("change",r)}},[e,t]),n}var A=e=>e?e.getBoundingClientRect().height:0;function be(e,t,n){let a=(0,o.useRef)(n);a.current=n;let r=n!==void 0;(0,o.useLayoutEffect)(()=>{let i=e.current;if(!i||!r)return;let d=()=>{let l=[...i.children],b=l.find(v=>v.hasAttribute("data-graview-app-bar")),p=l.find(v=>v.hasAttribute("data-embed-content")),h=p?.querySelector("[data-embed-measure]")??null,c=l.find(v=>v.hasAttribute("data-graview-place-line"));return{strip:b,line:c,content:p,measure:h}},s=-1,f=()=>{let{strip:l,line:b,content:p,measure:h}=d(),c=Math.ceil(A(l)+A(b)+A(h||p));c!==s&&(s=c,a.current?.(c))};if(f(),typeof ResizeObserver>"u")return;let m=new ResizeObserver(f),E=()=>{m.disconnect();let{strip:l,line:b,content:p,measure:h}=d();for(let c of[i,l,b,p,h])c&&m.observe(c)};E();let g=new MutationObserver(()=>{E(),f()});return g.observe(i,{childList:!0}),()=>{m.disconnect(),g.disconnect()}},[e,t,r])}var ve=480,de=0;function Se(e){let{app:t,seed:n,scheme:a="auto",brand:r=t.brand,fonts:i=!0,height:d="100%",label:s}=e,f=(0,o.useRef)(null);q(f);let m=d==="viewport"?"100dvh":d,E=z(typeof m=="string"&&/vh\b/.test(m)),g=(0,o.useMemo)(()=>`graview-embed-${++de}`,[]),l=(0,o.useMemo)(()=>e.store??e.remote?.store??ie(t,n),[e.store,e.remote,t,n]),b=e.presence??e.remote?.presence,p=e.hostContext?.theme,h=ce(a==="auto"&&p===void 0,r?.scheme),c=a==="auto"?p??h:a,v=(0,o.useMemo)(()=>T(c,r,{scope:`.${g}`}),[c,r,g]);K(e.favicon?M(r):void 0),(0,o.useEffect)(()=>{if(!i||typeof document>"u")return;let w=ee(r);if(!w||document.querySelector(`link[href="${w}"]`))return;let y=document.createElement("link");y.rel="stylesheet",y.href=w,document.head.appendChild(y)},[r,i]);let C=(0,o.useRef)(void 0);(0,o.useLayoutEffect)(()=>{let w=f.current,y=C.current;if(C.current=s,!w||!s)return;let oe=S=>{let x=S.getAttribute("aria-label")??"",R=y&&y!==s?x.startsWith(`${y} \xB7 `)?x.slice(y.length+3):x===y?"":x:x;R===s&&(S.getAttribute("role")==="region"||S.tagName==="SECTION"&&!S.hasAttribute("role"))&&S.setAttribute("role","group");let H=R.startsWith(`${s} \xB7 `)||R===s?R:R?`${s} \xB7 ${R}`:s;H!==x&&S.setAttribute("aria-label",H)},B=()=>w.querySelectorAll("aside, nav, main, header, footer, section[aria-label]:not([role]), [role=region], [role=complementary], [role=navigation], [role=search]").forEach(S=>{S.hasAttribute("data-graview-named-by-lens")||oe(S)});B();let P=new MutationObserver(B);return P.observe(w,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-label"]}),()=>P.disconnect()},[s]);let re=E?`${m}`.replace(/([\d.]+)[sdl]?vh\b/g,(w,y)=>`${+y*E/100}px`):m;return{rootRef:f,scope:g,css:v,scheme:c,store:l,presence:b,brand:r,auto:d==="auto",height:re}}function we({rootRef:e,board:t}){let n=(0,o.useCallback)(()=>e.current?.querySelector("[data-embed-content]")??e.current,[e]);return(0,u.jsx)(J,{board:t,anchor:n})}function Ee(e,t,n){return{brand:n,principal:e.principal,seats:e.seats,presence:t,people:e.people,memory:e.memory,presenceTtlMs:e.presenceTtlMs,onKeepLens:e.onKeepLens,ai:e.ai,files:e.files,app:e.app}}function xe({name:e,heading:t,faces:n,at:a,without:r,home:i,reach:d,standing:s,hostActions:f,keeping:m,onFind:E,switch:g}){let{brand:l,store:b,principal:p,views:h}=G();I();let c=r?.has("places")?[]:W({store:b,principal:p,views:h}),v=U();return(0,u.jsx)(_,{brand:l,name:e,description:l?.subtitle,heading:t,faces:n,home:i,places:c,current:a===null?null:D(c,a),reach:d,onFind:E,...g?{switch:g}:{},...n?{scenePlaces:v}:{},tools:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(X,{clean:s}),(0,u.jsx)(j,{...f?{hostActions:f}:{},...m?{keeping:m}:{}})]})})}var Re=e=>e===!1?2:Math.min(e+1,6);function Ae(e){let[t,n]=(0,o.useState)(e),a=(0,o.useRef)(void 0),r=(0,o.useRef)(void 0),i=(0,o.useMemo)(()=>({go:a,at:n,pending:r}),[]),d=(0,o.useCallback)(s=>{if(a.current){a.current(s);return}r.current=s,n(s)},[]);return{at:t,setAt:n,steering:i,steer:d}}function le(e){let t=typeof e=="object"&&e!==null?e.name:void 0;return{name:typeof t=="string"&&t.length>0?t:typeof e=="object"?"Error":typeof e}}var k=()=>typeof performance<"u"?performance.now():Date.now();function Fe(e,t){let n=(0,o.useRef)({onError:e,face:t});return n.current={onError:e,face:t},(0,o.useCallback)((a,r)=>n.current.onError?.(le(a),{module:r.module,face:n.current.face}),[])}function ke(e,t){let n=(0,o.useRef)(null);n.current===null&&(n.current=k());let a=(0,o.useRef)({onReady:e,face:t});a.current={onReady:e,face:t};let r=(0,o.useRef)(!1);return(0,o.useCallback)(i=>{r.current||(r.current=!0,a.current.onReady?.({ms:Math.max(0,k()-(n.current??k())),face:i}))},[])}var te=class extends o.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(t,n){console.error(`[graview] ${this.props.module} threw while rendering`,t,n.componentStack),this.props.report(t,{module:this.props.module})}render(){return this.state.failed?(0,u.jsxs)("div",{role:"alert","data-graview-face-error":this.props.module,...this.props.content?{"data-embed-content":""}:{},style:this.props.content?{flex:"1 1 auto",display:"grid",alignContent:"center",justifyItems:"center",gap:8,padding:24,background:"var(--graview-ground)",color:"var(--graview-ink)",fontSize:"0.9375rem"}:{display:"inline-flex",alignItems:"center",gap:6,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:[(0,u.jsx)("span",{children:this.props.content?"This part of the app could not draw.":"Could not draw."}),(0,u.jsx)("button",{type:"button",onClick:()=>this.setState({failed:!1}),style:{padding:"3px 11px",fontSize:"0.8125rem"},children:"Try again"})]}):this.props.children}};export{ge as a,ie as b,be as c,ve as d,Se as e,we as f,Ee as g,xe as h,Re as i,Ae as j,Fe as k,ke as l,te as m};
@@ -1 +0,0 @@
1
- import{Aa as w,B as s,K as k,xa as x,za as p}from"./chunk.VMEX2KZ4.js";var j=e=>e.safeParse?.(void 0).success??!1,O=e=>p(e).shape,m=e=>{let r=p(e);if(s(r)?.type!=="literal")return;let o=s(r)?.values;return o&&o.length===1&&typeof o[0]=="string"?o[0]:void 0};function u(e,r){let o=j(r),n=p(r),i=s(n)?.type,g=x(r);if(g)return{control:"node",name:e,optional:o,kinds:g};if(i==="boolean")return{control:"boolean",name:e,optional:o};let b=k(n);if(b)return{control:"file",name:e,optional:o,...b==="image"?{image:!0}:{}};if(i==="object"){let a=n.shape??{};return{control:"group",name:e,optional:o,fields:Object.entries(a).map(([d,c])=>u(d,c))}}if(i==="union"){let a=s(n)?.options??[],d=a.map(l=>O(l));if(d.every(l=>l!==void 0)){let l=Object.keys(d[0]??{}).find(F=>d.every(f=>m(f?.[F])!==void 0));if(l)return{control:"variant",name:e,optional:o,tag:l,options:a.map((F,f)=>({value:m(d[f]?.[l])??"",fields:Object.entries(d[f]??{}).filter(([y])=>y!==l).map(([y,v])=>u(y,v))}))}}let c=a.map(l=>m(l));return c.every(l=>l!==void 0)?{control:"choice",name:e,optional:o,options:c}:{control:"opaque",name:e,optional:o}}if(i==="array"){let a=s(n)?.element;return a!==void 0?{control:"list",name:e,optional:o,item:u(e,a)}:{control:"opaque",name:e,optional:o}}let t=w(r);return t.type==="text"?{control:"text",name:e,optional:o,...t.long?{long:!0}:{}}:t.type==="date"?{control:"date",name:e,optional:o,...t.time?{time:!0}:{}}:t.type==="number"?{control:"number",name:e,optional:o,...t.min===void 0?{}:{min:t.min},...t.max===void 0?{}:{max:t.max},...t.step===void 0?{}:{step:t.step}}:t.type==="choice"?{control:"choice",name:e,optional:o,options:t.options}:{control:"opaque",name:e,optional:o}}function R(e){let r=e.shape;return r?Object.entries(r).map(([o,n])=>u(o,n)):[]}function h(e,r){let o={...r};for(let n of e){let i=r[n.name];i===void 0&&!n.optional&&(n.control==="list"||n.control==="boolean")&&(o[n.name]=n.control==="list"?[]:!1),n.control==="group"&&i!==void 0&&typeof i=="object"&&i!==null&&(o[n.name]=h(n.fields,i))}return o}export{R as a,h as b};
@@ -1,2 +0,0 @@
1
- import{D as U,E as F,F as D,Z as _}from"./chunk.VMEX2KZ4.js";var B=1e4,g=class{constructor(i){this.nodes=i}},J="",c=class extends Error{constructor(f,l){super(f);this.sentence=f;this.at=l}},C=class extends c{},V=t=>t!==null&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof g)&&typeof t.id=="string",P=t=>{let i=new Set;return new g(t.filter(f=>!i.has(f.id)&&i.add(f.id)))},p=t=>t===null?"nothing":t instanceof g?"a set of records":Array.isArray(t)?"a list":V(t)?"a record":typeof t=="string"?"a word":typeof t;function W(t,i){let f=i.budget??B,l=(n,s)=>{if(f-=n,f<0)throw new C("this rule looks at too much of the graph to judge in one go",s)},b=i.today??F(),A=i.now??new Date().toISOString(),w=new Map,T=new Set,G=i.bindings,I=(n,s,e,o)=>{let u=`${n?.id}\0${s}`;if(w.has(u))return w.get(u);if(T.has(u))throw new c(`"${s}"${n?` of ${_(n.kind)}`:""} depends on itself`,o);T.add(u);let r=G;G=void 0;try{let a=h(e,n);return w.set(u,a),a}finally{G=r,T.delete(u)}},M=(n,s,e)=>{l(1,e);let o=i.kinds.get(n.kind),u=o?.computed?.get(s);if(u)return I(n,s,u,e);let r=Object.hasOwn(n,s);if(o?.fields.has(s)||r){let d=r?n[s]:void 0;return d===void 0?null:d}let a=o?.edges.get(s);if(a){let d=i.graph.out(n.id,s);return l(d.length,e),a==="one"?d[0]??null:new g(d)}if(s==="id")return n.id;throw new c(`${_(n.kind)} has no field or relation called "${s}"`,e)},x=(n,s,e)=>{if(n instanceof g)return n;if(n===null)return new g([]);if(V(n))return new g([n]);throw new c(`${e}(\u2026) needs a set of records, and was given ${p(n)}`,s)},k=(n,s,e)=>{if(n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean")return String(n);throw new c(`${e}(\u2026) needs a word, and was given ${p(n)}`,s)},O=(n,s,e)=>{let o=k(n,s,e);if(o===null)return null;let u=Date.parse(o.length===10?`${o}T00:00:00Z`:o);if(Number.isNaN(u))throw new c(`${e}(\u2026) needs a date, and "${o}" is not one`,s);return u},E=(n,s)=>V(n)&&V(s)?n.id===s.id:V(n)&&typeof s=="string"?n.id===s:typeof n=="string"&&V(s)?n===s.id:Array.isArray(n)&&Array.isArray(s)?n.length===s.length&&n.every((e,o)=>E(e,s[o])):n===s,N=(n,s,e)=>{if(n===null)return!1;if(typeof n=="boolean")return n;throw new c(`${e} must be true or false, and was ${p(n)}`,s)},R=(n,s)=>h(s,n);function h(n,s){switch(l(1,n.at),n.t){case"lit":return n.value;case"list":return n.items.map(e=>h(e,s));case"ident":{let e=G&&Object.hasOwn(G,n.name)?G[n.name]:void 0;if(e!==void 0)return e;if(s)return M(s,n.name,n.at);throw new c(`"${n.name}" means nothing in a rule over the whole graph`,n.at)}case"member":{let e=h(n.object,s);if(e===null)return null;if(V(e))return M(e,n.name,n.at);throw new c(`".${n.name}" needs a record before it, and was given ${p(e)}`,n.at)}case"unary":{let e=h(n.operand,s);if(n.op==="!")return!N(e,n.at,"what follows not");if(e===null)return null;if(typeof e!="number")throw new c(`"-" needs a number, and was given ${p(e)}`,n.at);return-e}case"where":{let e=x(h(n.set,s),n.at,"where");return l(e.nodes.length,n.at),new g(e.nodes.filter(o=>N(R(o,n.filter),n.at,"a where condition")))}case"binary":return H(n,s);case"call":return Y(n,s)}}function H(n,s){if(n.op==="&&")return N(h(n.left,s),n.at,"each side of and")&&N(h(n.right,s),n.at,"each side of and");if(n.op==="||")return N(h(n.left,s),n.at,"each side of or")||N(h(n.right,s),n.at,"each side of or");let e=h(n.left,s),o=h(n.right,s);if(n.op==="&"||n.op==="|"||n.op==="-"&&(e instanceof g||o instanceof g)){let u=x(e,n.at,n.op).nodes,r=x(o,n.at,n.op).nodes;l(u.length+r.length,n.at);let a=new Set(r.map(d=>d.id));return P(n.op==="|"?[...u,...r]:u.filter(d=>a.has(d.id)===(n.op==="&")))}switch(n.op){case"==":return E(e,o);case"!=":return!E(e,o);case"in":{if(o===null)return!1;if(o instanceof g)return o.nodes.some(u=>E(e,u));if(Array.isArray(o))return o.some(u=>E(e,u));if(typeof o=="string"&&typeof e=="string")return o.includes(e);throw new c(`"in" needs a list or a set on its right, and was given ${p(o)}`,n.at)}case"<":case"<=":case">":case">=":{if(e===null||o===null)return!1;if(!(typeof e=="number"&&typeof o=="number"||typeof e=="string"&&typeof o=="string"))throw new c(`cannot compare ${p(e)} with ${p(o)}`,n.at);return n.op==="<"?e<o:n.op==="<="?e<=o:n.op===">"?e>o:e>=o}default:{if(e===null||o===null)return null;if(n.op==="+"&&(typeof e=="string"||typeof o=="string")){let u=`${k(e,n.at,"+")}${k(o,n.at,"+")}`;if(u.length>1e4)throw new c("that makes a word too long",n.at);return u}if(typeof e!="number"||typeof o!="number")throw new c(`"${n.op}" needs numbers, and was given ${p(e)} and ${p(o)}`,n.at);return(n.op==="/"||n.op==="%")&&o===0?null:n.op==="+"?e+o:n.op==="-"?e-o:n.op==="*"?e*o:n.op==="/"?e/o:e%o}}}function Y(n,s){let e=(r,a=r)=>{if(n.args.length<r||n.args.length>a)throw new c(`${n.fn}(\u2026) takes ${r===a?r:`${r} to ${a}`} argument${a===1?"":"s"}`,n.at)},o=r=>h(n.args[r],s),u=r=>{let a=o(r);if(typeof a!="string")throw new c(`${n.fn}(\u2026) needs a quoted name, like ${n.fn}('name')`,n.at);return a};switch(n.fn){case"out":case"in":{e(1,2);let r=($,m)=>n.fn==="out"?i.graph.out($,m):i.graph.in($,m);if(n.args.length===2){let $=x(o(0),n.at,n.fn).nodes,m=u(1);return P($.flatMap(y=>{let S=r(y.id,m);return l(S.length+1,n.at),S}))}let a=u(0);if(!s)throw new c(`${n.fn}('${a}') needs a record to start from`,n.at);let d=r(s.id,a);return l(d.length,n.at),new g(d)}case"all":{e(1);let r=i.graph.nodesOfKind(u(0));return l(r.length,n.at),new g(r)}case"count":return e(1),x(o(0),n.at,"count").nodes.length;case"exists":return e(1),x(o(0),n.at,"exists").nodes.length>0;case"every":case"some":{e(2);let r=x(o(0),n.at,n.fn);l(r.nodes.length,n.at);let a=d=>N(R(d,n.args[1]),n.at,`the condition in ${n.fn}(\u2026)`);return n.fn==="every"?r.nodes.every(a):r.nodes.some(a)}case"sum":case"min":case"max":{e(2);let r=x(o(0),n.at,n.fn);l(r.nodes.length,n.at);let a=n.args[1],d=a.t==="lit"&&typeof a.value=="string"?a.value:void 0,$=a.t==="ident"?`'${a.name}'`:d!==void 0?`'${d}'`:"\u2026",m=r.nodes.map(y=>a.t==="ident"?M(y,a.name,n.at):d!==void 0?M(y,d,n.at):R(y,a)).filter(y=>{if(y===null)return!1;if(typeof y!="number")throw new c(`${n.fn}(\u2026, ${$}) needs a number for each member, and found ${p(y)}`,n.at);return!0});return n.fn==="sum"?m.reduce((y,S)=>y+S,0):m.length===0?null:n.fn==="min"?Math.min(...m):Math.max(...m)}case"fact":{e(1);let r=u(0),a=i.kinds.get(J)?.computed?.get(r);if(!a)throw new c(`no fact is called "${r}"`,n.at);return I(null,r,a,n.at)}case"first":return e(1),x(o(0),n.at,"first").nodes[0]??null;case"sort":{e(2,3);let r=x(o(0),n.at,"sort"),a=n.args.length===3?o(2):"asc";if(a!=="asc"&&a!=="desc")throw new c("sort(\u2026) goes 'asc' or 'desc'",n.at);let d=r.nodes.length;l(d+d*Math.ceil(Math.log2(d+1)),n.at);let $=r.nodes.map((y,S)=>({node:y,i:S,key:R(y,n.args[1])})),m=a==="desc"?-1:1;return $.sort((y,S)=>L(y.key,S.key,m,n.at)||y.i-S.i),new g($.map(y=>y.node))}case"either":{if(n.args.length<1)throw new c("either(\u2026) takes at least one argument",n.at);for(let r=0;r<n.args.length;r++){let a=o(r);if(a!==null&&!(a instanceof g&&a.nodes.length===0))return a}return null}case"present":{e(1);let r=o(0);return r===null||r===""?!1:Array.isArray(r)?r.length>0:r instanceof g?r.nodes.length>0:!0}case"len":{e(1);let r=o(0);if(r===null)return 0;if(typeof r=="string"||Array.isArray(r))return r.length;if(r instanceof g)return r.nodes.length;throw new c(`len(\u2026) needs a word or a list, and was given ${p(r)}`,n.at)}case"contains":case"startsWith":{e(2);let r=o(0),a=o(1);if(r===null||a===null)return!1;if(n.fn==="contains"&&Array.isArray(r))return r.some(m=>E(m,a));let d=k(r,n.at,n.fn),$=k(a,n.at,n.fn);return n.fn==="contains"?d.toLowerCase().includes($.toLowerCase()):d.startsWith($)}case"lower":{e(1);let r=k(o(0),n.at,"lower");return r===null?null:r.toLowerCase()}case"today":return e(0),b;case"now":return e(0),A;case"date":{e(1);let r=O(o(0),n.at,"date");return r===null?null:new Date(r).toISOString().slice(0,10)}case"days":case"hours":{e(2);let r=O(o(0),n.at,n.fn),a=O(o(1),n.at,n.fn);if(r===null||a===null)return null;let d=(a-r)/(n.fn==="days"?864e5:36e5);return n.fn==="days"?Math.round(d):d}case"if":return e(3),N(o(0),n.at,"the condition in if(\u2026)")?o(1):o(2);default:throw new c(`"${n.fn}" is not a function the rule language knows`,n.at)}}function L(n,s,e,o){if(n===null||s===null)return n===s?0:n===null?1:-1;if(Array.isArray(n)&&Array.isArray(s)){for(let r=0;r<Math.max(n.length,s.length);r++){let a=L(n[r]??null,s[r]??null,e,o);if(a!==0)return a}return 0}let u=r=>typeof r=="number"||typeof r=="string"||typeof r=="boolean"?typeof r:p(r);if(u(n)!==u(s)||typeof n=="object"||typeof s=="object")throw new c(`sort(\u2026) cannot put ${p(n)} and ${p(s)} in order`,o);return typeof n=="string"?e*(n<s?-1:n>s?1:0):e*(Number(n)-Number(s))}return h(t,i.subject)}var rn=["out","in","all","count","exists","every","some","sum","min","max","present","len","contains","startsWith","lower","today","now","date","days","hours","if","first","sort","either","fact"];var sn=(t,i,f,l)=>({severity:"error",code:t,path:i,message:f,...l?{fix:l}:{}}),an=(t,i,f,l)=>({severity:"warning",code:t,path:i,message:f,...l?{fix:l}:{}}),ln=t=>t.some(i=>i.severity==="error");function un(t){return t.map(i=>`${i.severity==="error"?"\u2717":i.severity==="warning"?"!":"\xB7"} ${i.path||"(document)"}: ${i.message}${i.fix?` \u2014 ${i.fix}`:""}`).join(`
2
- `)}var gn=["money","percent","date","relative","upper","lower","count","words","and","plural"],Q={getNode:()=>{},allNodes:()=>[],allEdges:()=>[],nodesOfKind:()=>[],edgesOfKind:()=>[],out:()=>[],in:()=>[],neighbors:()=>[],has:()=>!1};function yn(t,i,f,l=[],b){return K(t,i,f,l,b)}function X(t,i={}){let f=Number.isInteger(t),l={maximumFractionDigits:f?0:2,minimumFractionDigits:f?0:2};try{return new Intl.NumberFormat(i.locale??"en-US",i.currency?{style:"currency",currency:i.currency,...l}:l).format(t)}catch{return t.toLocaleString("en-US",l)}}var q=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],Z=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];function v(t){return!Number.isInteger(t)||t<0||t>99?t.toLocaleString("en-US",{maximumFractionDigits:2}):t<20?q[t]:t%10===0?Z[t/10]:`${Z[Math.floor(t/10)]}-${q[t%10]}`}function z(t){return t.length<=1?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function nn(t){return/[^aeiou]y$/i.test(t)?`${t.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/i.test(t)?`${t}es`:`${t}s`}var j=t=>String(t.name??t.title??t.label??t.id);function K(t,i,f,l=[],b){if(i==="plural"){let A=t instanceof g?t.nodes.length:Array.isArray(t)?t.length:typeof t=="number"?t:null;return A===null||l[0]===void 0?"\u2014":A===1?l[0]:l[1]??nn(l[0])}if(t===null)return"\u2014";if(t instanceof g)return i==="count"?String(t.nodes.length):i==="and"?z(t.nodes.map(j)):t.nodes.map(j).join(", ");if(Array.isArray(t)){if(i==="count")return String(t.length);let A=t.map(w=>K(w,void 0,f,[],b));return i==="and"?z(A):A.join(", ")}if(typeof t=="object")return j(t);switch(i){case"words":return typeof t=="number"?v(t):String(t);case"money":return typeof t=="number"?X(t,b):String(t);case"percent":return typeof t=="number"?`${Math.round(t*100)}%`:String(t);case"upper":return String(t).toUpperCase();case"lower":return String(t).toLowerCase();case"date":return D(String(t).slice(0,10));case"relative":{let A=Date.parse(String(t).length===10?`${t}T00:00:00Z`:String(t));if(Number.isNaN(A))return String(t);let w=Math.round((A-Date.parse(`${f}T00:00:00Z`))/864e5);return w===0?"today":w===1?"tomorrow":w===-1?"yesterday":w>0?`in ${w} days`:`${-w} days ago`}default:return typeof t=="string"&&U.test(t)?D(t):String(t)}}function pn(t,i){let f=i.today??F();return t.map(l=>{if(l.text!==void 0)return l.text;try{let b=W(l.expr,{graph:i.graph??Q,subject:i.node,kinds:i.kinds,today:f,budget:i.budget??500,...i.bindings?{bindings:i.bindings}:{}});return K(b,l.format,f,l.formatArgs,i.money)}catch(b){if(b instanceof c)return"\u2014";throw b}}).join("")}export{g as a,J as b,c,C as d,W as e,rn as f,sn as g,an as h,ln as i,un as j,gn as k,Q as l,yn as m,X as n,pn as o};