graview 0.1.29 → 0.1.30

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 (173) hide show
  1. package/dist/preview/{chunk.X53HI436.js → chunk.26CZTUY4.js} +1 -1
  2. package/dist/preview/chunk.2CIBWZJG.js +1 -0
  3. package/dist/preview/chunk.2EXGG6BB.js +1 -0
  4. package/dist/preview/chunk.2NBYNZRD.js +1 -0
  5. package/dist/preview/chunk.2XAONC66.js +1 -0
  6. package/dist/preview/chunk.34ZMMURV.js +27 -0
  7. package/dist/preview/{chunk.44FVJOK4.js → chunk.3ADPAGPY.js} +1 -1
  8. package/dist/preview/chunk.3JGGBLRB.js +1 -0
  9. package/dist/preview/chunk.3JNMSOFG.js +1 -0
  10. package/dist/preview/chunk.3R4W2P5X.js +1 -0
  11. package/dist/preview/chunk.3SKKIHU3.js +4 -0
  12. package/dist/preview/{chunk.OGXE2RHC.js → chunk.3URFMWXZ.js} +2 -2
  13. package/dist/preview/chunk.3VL5WECB.js +1 -0
  14. package/dist/preview/chunk.42YX6NOY.js +2 -0
  15. package/dist/preview/{chunk.XAXJHEMD.js → chunk.4ALKPNXM.js} +1 -1
  16. package/dist/preview/chunk.4HP7UWA2.js +1 -0
  17. package/dist/preview/{chunk.ZBXOX3W3.js → chunk.4SJUTBDV.js} +1 -1
  18. package/dist/preview/chunk.5U5J3ISK.js +1 -0
  19. package/dist/preview/{chunk.YCA7P5MK.js → chunk.6T2Q6NLO.js} +1 -1
  20. package/dist/preview/chunk.6V2RG5JG.js +5 -0
  21. package/dist/preview/chunk.6XMEU2Q2.js +1 -0
  22. package/dist/preview/chunk.7BWT5L2L.js +1 -0
  23. package/dist/preview/chunk.AK3IHFCF.js +1 -0
  24. package/dist/preview/chunk.BPWNWE7N.js +1 -0
  25. package/dist/preview/{chunk.YRQZZH5V.js → chunk.C5CYZNSJ.js} +1 -1
  26. package/dist/preview/chunk.CM6LOIQE.js +88 -0
  27. package/dist/preview/{chunk.IPBXAAQV.js → chunk.D3IECJ2S.js} +1 -1
  28. package/dist/preview/chunk.DT7LHWU2.js +1 -0
  29. package/dist/preview/chunk.DZRTOURR.js +1 -0
  30. package/dist/preview/{chunk.JNGUSAWX.js → chunk.ERXSYPYL.js} +17 -3
  31. package/dist/preview/chunk.FDELO7NY.js +116 -0
  32. package/dist/preview/chunk.FGVKJWNS.js +6 -0
  33. package/dist/preview/{chunk.7D77HEIJ.js → chunk.FWCOJDOD.js} +1 -1
  34. package/dist/preview/chunk.GFF2FB2J.js +25 -0
  35. package/dist/preview/chunk.GLBHQFJ2.js +1 -0
  36. package/dist/preview/{chunk.ZSKP6UQS.js → chunk.HHI65WFZ.js} +1 -1
  37. package/dist/preview/chunk.HHPGWJDO.js +2 -0
  38. package/dist/preview/chunk.HSCTWAUV.js +1 -0
  39. package/dist/preview/chunk.INZUEWC5.js +1 -0
  40. package/dist/preview/{chunk.QNHECGMH.js → chunk.J2ITFGN3.js} +1 -1
  41. package/dist/preview/chunk.JH6MU6TX.js +2 -0
  42. package/dist/preview/chunk.JISMMIMX.js +1 -0
  43. package/dist/preview/chunk.JN7DIFR3.js +1 -0
  44. package/dist/preview/chunk.JPHNKWTY.js +1 -0
  45. package/dist/preview/chunk.JTNWD2CN.js +1 -0
  46. package/dist/preview/chunk.K75FUIZI.js +1 -0
  47. package/dist/preview/chunk.K776HO42.js +2 -0
  48. package/dist/preview/chunk.KN3ULTGF.js +1 -0
  49. package/dist/preview/chunk.KOB6N3SL.js +1 -0
  50. package/dist/preview/chunk.KQT7WAQE.js +1 -0
  51. package/dist/preview/chunk.L4DECHXR.js +327 -0
  52. package/dist/preview/{chunk.J46KDTEZ.js → chunk.L6OMEYL6.js} +1 -1
  53. package/dist/preview/chunk.LQ7V6KEE.js +1 -0
  54. package/dist/preview/{chunk.AVUS5LMG.js → chunk.MD74YVRN.js} +2 -2
  55. package/dist/preview/chunk.MGNP4LAM.js +1 -0
  56. package/dist/preview/chunk.NCTOBUCT.js +1 -0
  57. package/dist/preview/chunk.NDADLJE6.js +1 -0
  58. package/dist/preview/{chunk.64P76WK4.js → chunk.NO52VON3.js} +1 -1
  59. package/dist/preview/{chunk.5AT4O4BN.js → chunk.O2LK2AO7.js} +1 -1
  60. package/dist/preview/chunk.OAF7TUMI.js +1 -0
  61. package/dist/preview/{chunk.WLRTPFAC.js → chunk.OQ4KFN6W.js} +1 -1
  62. package/dist/preview/chunk.OXQMNIRO.js +1 -0
  63. package/dist/preview/chunk.OZNW5W4Z.js +1 -0
  64. package/dist/preview/{chunk.HV6I74DF.js → chunk.PAVR5TK5.js} +1 -1
  65. package/dist/preview/chunk.PKK6FRZR.js +2 -0
  66. package/dist/preview/chunk.QIAKO27D.js +1 -0
  67. package/dist/preview/{chunk.CK7QWLMX.js → chunk.QNGWEV47.js} +1 -1
  68. package/dist/preview/{chunk.3G5MQFZK.js → chunk.QTA4ROAK.js} +1 -1
  69. package/dist/preview/chunk.QTMWHE5O.js +1 -0
  70. package/dist/preview/chunk.R26DREVU.js +1 -0
  71. package/dist/preview/chunk.RI3PYG5T.js +19 -0
  72. package/dist/preview/{chunk.ONGVH3ZM.js → chunk.RIEHYQLK.js} +44 -19
  73. package/dist/preview/chunk.RRVIXV7W.js +1 -0
  74. package/dist/preview/{chunk.BZ5OJYHU.js → chunk.RYT5U3QM.js} +1 -1
  75. package/dist/preview/chunk.SE5SKFQH.js +1 -0
  76. package/dist/preview/chunk.SHPXD6FC.js +1 -0
  77. package/dist/preview/chunk.SOBC3CTN.js +47 -0
  78. package/dist/preview/chunk.SOD3PBJM.js +1 -0
  79. package/dist/preview/{chunk.QSDT2RLY.js → chunk.T3VPD7JQ.js} +1 -1
  80. package/dist/preview/chunk.TI4OSTQV.js +1 -0
  81. package/dist/preview/chunk.UDSEJKCY.js +1 -0
  82. package/dist/preview/chunk.UGFDSE37.js +1 -0
  83. package/dist/preview/{chunk.IZW7DBK4.js → chunk.UWGWXFWZ.js} +1 -1
  84. package/dist/preview/{chunk.T4LY5QXO.js → chunk.UZWWDAGM.js} +1 -1
  85. package/dist/preview/chunk.V5ZYUVMH.js +1 -0
  86. package/dist/preview/chunk.V7BDAGDE.js +35 -0
  87. package/dist/preview/chunk.VG56IUIQ.js +9 -0
  88. package/dist/preview/chunk.VOAZBHCG.js +1 -0
  89. package/dist/preview/{chunk.O4QPITBD.js → chunk.VS7K3SCD.js} +1 -1
  90. package/dist/preview/{chunk.Z5V23DQN.js → chunk.VSZQXB4Q.js} +2 -2
  91. package/dist/preview/chunk.W3S6UXNA.js +1 -0
  92. package/dist/preview/chunk.WAFDCOOG.js +3 -0
  93. package/dist/preview/chunk.WYTIOLPP.js +1 -0
  94. package/dist/preview/chunk.X37L5TN5.js +1 -0
  95. package/dist/preview/{chunk.GZH6PTXN.js → chunk.XRJBLH4N.js} +1 -1
  96. package/dist/preview/{chunk.D4GOVA25.js → chunk.XS7YFNDU.js} +1 -1
  97. package/dist/preview/{chunk.V6TK4LHW.js → chunk.XSTXV6FP.js} +4 -4
  98. package/dist/preview/chunk.Y4UXEL6Y.js +1 -0
  99. package/dist/preview/chunk.YJUB4OD7.js +1 -0
  100. package/dist/preview/chunk.YLQB3KBA.js +1 -0
  101. package/dist/preview/{chunk.XXHNV24G.js → chunk.YNQDVGZM.js} +1 -1
  102. package/dist/preview/chunk.YV2LJFGS.js +1 -0
  103. package/dist/preview/chunk.Z2YUYZT4.js +1 -0
  104. package/dist/preview/chunk.ZYKAS4BT.js +1 -0
  105. package/dist/preview/page.js +6 -6
  106. package/package.json +6 -6
  107. package/dist/preview/chunk.2643W7FT.js +0 -1
  108. package/dist/preview/chunk.2CLPRG3I.js +0 -1
  109. package/dist/preview/chunk.2IZFIORK.js +0 -1
  110. package/dist/preview/chunk.2NCTM5K2.js +0 -2
  111. package/dist/preview/chunk.3JM2TNDD.js +0 -2
  112. package/dist/preview/chunk.4GGAPOMK.js +0 -2
  113. package/dist/preview/chunk.5JXUAMKI.js +0 -1
  114. package/dist/preview/chunk.5R66YTET.js +0 -2
  115. package/dist/preview/chunk.7DNFXJH3.js +0 -1
  116. package/dist/preview/chunk.7PRFYYVM.js +0 -1
  117. package/dist/preview/chunk.AE5GKL4C.js +0 -1
  118. package/dist/preview/chunk.ARR75WBP.js +0 -35
  119. package/dist/preview/chunk.BKPGDEES.js +0 -1
  120. package/dist/preview/chunk.COTG2IG5.js +0 -1
  121. package/dist/preview/chunk.DAA6XWLF.js +0 -1
  122. package/dist/preview/chunk.DKTCRFMS.js +0 -1
  123. package/dist/preview/chunk.DLGTFXGM.js +0 -1
  124. package/dist/preview/chunk.DN7SN6ZR.js +0 -1
  125. package/dist/preview/chunk.G4WQGTZR.js +0 -3
  126. package/dist/preview/chunk.GDA3G4U2.js +0 -6
  127. package/dist/preview/chunk.GS4T26WW.js +0 -328
  128. package/dist/preview/chunk.HFKMHLJ3.js +0 -1
  129. package/dist/preview/chunk.HGAMNIST.js +0 -1
  130. package/dist/preview/chunk.HKBKH7EK.js +0 -1
  131. package/dist/preview/chunk.HLLWKSZB.js +0 -5
  132. package/dist/preview/chunk.HONUT6OG.js +0 -1
  133. package/dist/preview/chunk.HRWLR7T4.js +0 -1
  134. package/dist/preview/chunk.IWYUFYDJ.js +0 -1
  135. package/dist/preview/chunk.JU2ZVKMT.js +0 -2
  136. package/dist/preview/chunk.K4ZUVH2G.js +0 -1
  137. package/dist/preview/chunk.KC6UZHBM.js +0 -1
  138. package/dist/preview/chunk.KLITC55P.js +0 -1
  139. package/dist/preview/chunk.KZ2376BD.js +0 -19
  140. package/dist/preview/chunk.LYJAVUST.js +0 -1
  141. package/dist/preview/chunk.MOUGB4H6.js +0 -1
  142. package/dist/preview/chunk.MYFWM572.js +0 -1
  143. package/dist/preview/chunk.N4FBDA2W.js +0 -1
  144. package/dist/preview/chunk.O42YET3W.js +0 -1
  145. package/dist/preview/chunk.ONDILMIX.js +0 -1
  146. package/dist/preview/chunk.OWBEV6FR.js +0 -1
  147. package/dist/preview/chunk.OWE6OJ4P.js +0 -1
  148. package/dist/preview/chunk.OYJSFO3A.js +0 -1
  149. package/dist/preview/chunk.P62SKNJS.js +0 -27
  150. package/dist/preview/chunk.PA5HYAEO.js +0 -1
  151. package/dist/preview/chunk.PMEDLEZY.js +0 -9
  152. package/dist/preview/chunk.PTXQHHKF.js +0 -1
  153. package/dist/preview/chunk.R2D373VG.js +0 -1
  154. package/dist/preview/chunk.RB4RTBRZ.js +0 -1
  155. package/dist/preview/chunk.RCLJ4H52.js +0 -116
  156. package/dist/preview/chunk.RKRSRKF3.js +0 -1
  157. package/dist/preview/chunk.RWGLKDWH.js +0 -1
  158. package/dist/preview/chunk.SIL4KD3K.js +0 -1
  159. package/dist/preview/chunk.SS76EIMI.js +0 -1
  160. package/dist/preview/chunk.UIIVEQAT.js +0 -1
  161. package/dist/preview/chunk.UTHHX2TJ.js +0 -1
  162. package/dist/preview/chunk.UWNYT7PF.js +0 -1
  163. package/dist/preview/chunk.VNBO2RXD.js +0 -1
  164. package/dist/preview/chunk.VPPUTA74.js +0 -1
  165. package/dist/preview/chunk.WKXNBHTL.js +0 -4
  166. package/dist/preview/chunk.XDZSTIS6.js +0 -88
  167. package/dist/preview/chunk.YUWRZWGX.js +0 -1
  168. package/dist/preview/chunk.Z2RGLFLS.js +0 -1
  169. package/dist/preview/chunk.Z56B2JR2.js +0 -25
  170. package/dist/preview/chunk.ZEGSQCSD.js +0 -1
  171. package/dist/preview/chunk.ZEVVWWNA.js +0 -44
  172. package/dist/preview/chunk.ZS4DJ76C.js +0 -1
  173. /package/dist/preview/{chunk.OHE5AMHH.js → chunk.EYZ7MHBZ.js} +0 -0
@@ -1 +0,0 @@
1
- import{a as ne,b as ie,c as oe,d as re}from"./chunk.64P76WK4.js";import{a as te}from"./chunk.WLRTPFAC.js";import"./chunk.XXHNV24G.js";import"./chunk.RWGLKDWH.js";import"./chunk.GZH6PTXN.js";import"./chunk.XAXJHEMD.js";import{j as X,k as J}from"./chunk.WKXNBHTL.js";import"./chunk.OWE6OJ4P.js";import"./chunk.3JM2TNDD.js";import"./chunk.QNHECGMH.js";import"./chunk.RKRSRKF3.js";import"./chunk.KC6UZHBM.js";import"./chunk.HJCQ6I3S.js";import"./chunk.ZBXOX3W3.js";import"./chunk.5AT4O4BN.js";import{a as ee}from"./chunk.G4JJXA63.js";import"./chunk.YRQZZH5V.js";import"./chunk.HONUT6OG.js";import"./chunk.X53HI436.js";import"./chunk.COTG2IG5.js";import"./chunk.YCA7P5MK.js";import{a as q,d as B}from"./chunk.N4FBDA2W.js";import{a as Q}from"./chunk.VPPUTA74.js";import"./chunk.UT6642FC.js";import"./chunk.3G5MQFZK.js";import"./chunk.2CLPRG3I.js";import"./chunk.OHE5AMHH.js";import"./chunk.OYJSFO3A.js";import"./chunk.HV6I74DF.js";import"./chunk.DAA6XWLF.js";import"./chunk.7DNFXJH3.js";import"./chunk.7PRFYYVM.js";import"./chunk.2NCTM5K2.js";import"./chunk.JU2ZVKMT.js";import"./chunk.HGAMNIST.js";import"./chunk.OQDETV4X.js";import{g as G}from"./chunk.ZS4DJ76C.js";import"./chunk.5R66YTET.js";import"./chunk.G4WQGTZR.js";import"./chunk.HFKMHLJ3.js";import{h as Z}from"./chunk.GS4T26WW.js";import{F as ye,I as U,M as K,U as C,ha as V,j as F,m as _,n as Y}from"./chunk.Z56B2JR2.js";import{W as j,Z as P,Zb as z,_ as T,ba as N,ca as W}from"./chunk.HLLWKSZB.js";import{b as O}from"./chunk.AJZBJBMO.js";var M=3;function ae(e,n){return n.id?e.graph.getNode(n.id):void 0}function le(e){return e?/^(?:kind|aggregate):([^:]+)$/.exec(e)?.[1]:void 0}function de(e,n){if(n)return e.find(t=>t.nodeIds.includes(n)||t.subjectId===n)}var me=e=>{let n=e.trim();if(!n)return n;let t=n.charAt(0).toUpperCase()+n.slice(1);return/[.!?…]$/.test(t)?t:`${t}.`};function ce({store:e,subject:n,violations:t,place:i}){let s=ae(e,n),o=de(t,s?.id??null);if(o)return me(o.message);if(s){let l=s.kind;return`${j(e.schema.tryDefinition(l),s)}, ${N(W(e.schema.tryDefinition(l),l))}.`}let c=i?.kind??le(n.id);if(c){let l=e.graph.nodesOfKind(c).length,g=i?.title??n.name,u=T(e.schema,c),f=P(e.schema,c,l);return g.toLowerCase()===u.toLowerCase()?`${l===1?"There is":"There are"} ${f} here.`:`${g}: ${f}.`}let a=e.schema.kinds.map(l=>({kind:l,count:e.graph.nodesOfKind(l).length})).filter(l=>l.count>0).sort((l,g)=>g.count-l.count).slice(0,3);if(a.length===0)return"Nothing here yet.";let r=a.map(l=>P(e.schema,l.kind,l.count));return`The whole thing: ${r.length===1?r[0]:`${r.slice(0,-1).join(", ")} and ${r[r.length-1]}`}.`}function ue(e){let{store:n,subject:t,violations:i}=e,s=ae(n,t),o=[];s&&de(i,s.id)?o.push({ask:`What's wrong with ${t.name}?`,why:"problem"}):i.length>0&&o.push({ask:"What needs attention?",why:"problem"});let c=s?s.kind:e.place?.kind??le(t.id),a=ke(e,c);if(a)o.push(a);else{let l=be(e,c);l&&o.push(l)}let r=we(e,c);return r&&o.push(r),o.length<M&&(s?o.push({ask:`Tell me about ${t.name}`,why:"about"}):o.push({ask:"What is here?",why:"here"})),o.slice(0,M)}function pe(e,n){return e.schema.tryDefinition(n)?.fields?.shape??{}}function Se(e){let n=e;for(let t=0;t<4&&n;t++){let i=n;if(Array.isArray(i.options)&&i.options.every(s=>typeof s=="string"))return i.options;n=typeof i.unwrap=="function"?i.unwrap():i._def?.innerType}}var se=/^\d{4}-\d{2}-\d{2}/,ve=["due","deadline","date","when"];function ke(e,n){let{store:t}=e,i=e.today;if(!i||!se.test(i))return;let s=new Date(`${i.slice(0,10)}T00:00:00Z`);s.setUTCDate(s.getUTCDate()+6);let o=s.toISOString().slice(0,10),c=[...new Set([...n?[n]:[],...t.schema.kinds])];for(let a of c){let r=ve.find(u=>u in pe(t,a));if(!r||!t.graph.nodesOfKind(a).some(u=>{let f=u[r],S=u.done;return typeof f=="string"&&se.test(f)&&f.slice(0,10)>=i.slice(0,10)&&f.slice(0,10)<=o&&S!==!0}))continue;let g=T(t.schema,a);return{ask:`${ee(g)} due this week`,why:"due"}}}function be(e,n){let t=e.place?.title,i=(e.places??[]).find(s=>s.kind!==null&&s.picture===!0&&s.title!==t&&s.kind!==n);return i?{ask:`Go to ${i.title}`,why:"go"}:void 0}function we(e,n){let{store:t}=e,i=[...t.schema.kinds].sort((o,c)=>t.graph.nodesOfKind(c).length-t.graph.nodesOfKind(o).length),s=[...new Set([...n?[n]:[],...i])];for(let o of s){if(t.graph.nodesOfKind(o).length<2)continue;let c=pe(t,o),a=Object.keys(c).find(g=>(Se(c[g])?.length??0)>=2);if(!a)continue;let r=T(t.schema,o).toLowerCase(),l=a.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").toLowerCase();return{ask:`Show ${r} as a board by ${l}`,why:"draw"}}}function ge(e,{store:n,subject:t}){let i=a=>t.id!==null&&(a.nodeIds.includes(t.id)||Object.values(a.args).includes(t.id)),s=e.filter(a=>a.provider==="invariant"&&i(a)),o=e.filter(a=>a.pinned==="user"&&!s.includes(a));return[...s,...o].sort((a,r)=>Number(a.destructive??!1)-Number(r.destructive??!1)).slice(0,M).map(a=>({affordance:a,label:xe(a,{store:n,subject:t})}))}var Ae=e=>/^[a-z0-9]+(?:[-_][a-z0-9]+)+$|^[a-z]+[A-Z][A-Za-z0-9]*$/.test(e);function xe(e,{store:n,subject:t}){let i=e.label,s=Ae(i)||i===e.mutation;if(s){let r=i.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").toLowerCase();i=r.charAt(0).toUpperCase()+r.slice(1)}let o=t.id?n.graph.getNode(t.id):void 0,c=o!==void 0&&e.nodeIds.length<=1&&(e.nodeIds[0]??o.id)===o.id;if(c&&/\bit\b/.test(i))return i.replace(/\bit\b/,t.name);let a=n.allMutations().find(r=>r.name===e.mutation);if(e.open.length===0&&a?.describe&&(s||c))try{let r=a.describe(e.args,n.graph);if(r.trim())return r.trim()}catch{}return i}var y=O(ye(),1);var p=O(K(),1);function Ye({phone:e,side:n,name:t,onClose:i,respond:s,onCall:o,onPick:c,onMove:a,place:r,onDraft:l}){let{seatTalk:g}=C(),u=U(g),f=Te(c),S=[...u.turns].reverse().find(h=>h.role==="seat"),m=e&&u.draft!==null,b=(0,y.useRef)(null),w=(0,y.useRef)(!0);return(0,y.useLayoutEffect)(()=>{let h=b.current;if(!h)return;let A=m?[...h.querySelectorAll("ol > li")].pop():void 0;if(A){let v=A.getBoundingClientRect().top-h.getBoundingClientRect().top+h.scrollTop;h.style.maxHeight=`min(${Math.ceil(h.scrollHeight-v)}px, ${fe})`}let k=w.current?he.get(g):void 0;w.current=!1,h.scrollTop=k&&k.turns===u.turns.length&&!u.busy?k.top:h.scrollHeight},[u.turns.length,u.busy,m]),(0,p.jsxs)("div",{"data-testid":"seat-panel",...m?{"data-graview-seat-yields":""}:{},style:{display:"grid",gridTemplateRows:"auto minmax(0, 1fr)",gap:4,minHeight:0},children:[(0,p.jsxs)("div",{"data-testid":"seat-top",...e?{onPointerDown:h=>Le(h,i)}:{},style:{display:"flex",alignItems:"center",justifyContent:e?"center":"flex-end",gap:2,position:"relative",minHeight:28,...e?{touchAction:"none"}:{}},children:[e?(0,p.jsx)("button",{type:"button","data-testid":"seat-grab","aria-label":`Close Ask ${t}`,title:"Close",onClick:i,style:{...E,width:64},children:(0,p.jsx)("span",{"aria-hidden":"true",style:{display:"block",width:36,height:4,margin:"0 auto",borderRadius:2,background:"var(--graview-edge-strong, var(--graview-ink-faint))"}})}):(0,p.jsx)("button",{type:"button","data-testid":"seat-side","aria-label":n==="left"?"Move to the right":"Move to the left",title:n==="left"?"Move to the right":"Move to the left",onClick:()=>g.setSide(n==="left"?"right":"left"),style:E,children:(0,p.jsx)("span",{"aria-hidden":"true",children:"\u21C4"})}),(0,p.jsx)("button",{type:"button","data-testid":"seat-close","aria-label":`Close Ask ${t}`,title:"Close",onClick:i,style:e?{...E,position:"absolute",top:0,right:0}:E,children:(0,p.jsx)("span",{"aria-hidden":"true",children:"\u2715"})})]}),(0,p.jsx)("div",{ref:b,"data-testid":"seat-body",onScroll:h=>void he.set(g,{top:h.currentTarget.scrollTop,turns:u.turns.length}),style:{minHeight:0,maxHeight:m?fe:e?"calc(70cqh - 96px)":"min(520px, calc(100cqh - 112px))",overflowY:"auto",overflowX:"hidden",padding:"0 4px"},children:(0,p.jsx)(ie,{shared:!0,composer:!1,testId:"seat",onPick:f,...a?{onMove:a}:{},...r?{place:r}:{},...l?{onDraft:l}:{},empty:(0,p.jsx)(Ce,{...r?{here:r}:{}}),...s?{respond:s}:{},...o?{onCall:o}:{}})}),(0,p.jsx)("p",{"aria-live":"polite","data-testid":"seat-said",style:Z,children:u.busy?"":S?.text??""})]})}function Te(e){let{setView:n}=C();return(0,y.useCallback)(t=>e?e(t):n(i=>Y(F(_(i,!1),t),[t])),[e,n])}function Ce({here:e}){let{store:n,views:t,view:i,seatTalk:s}=C(),o=ne({hover:!1}),c=q(n,V()),a=(0,y.useMemo)(()=>c.map(d=>d.line?{...d,message:B(d)}:d),[c]),r=o.id?n.graph.getNode(o.id):void 0,l=e??i.within?.view,g=o.because==="place"&&o.id===null?t.places().find(d=>d.title===o.name):l?t.places().find(d=>d.as===l):void 0,u=n.today(),f={store:n,subject:{id:o.id,name:o.name},violations:a,place:g?{title:g.title,kind:g.kind}:null,places:z(t.places()).map(d=>({title:d.title,kind:d.kind,picture:!0})),...u?{today:u}:{}},S=ce(f),m=ue(f),b=(0,y.useMemo)(()=>({pins:te(),...r?{focus:r.id,about:[r.id]}:{}}),[r?.id]),{affordances:w}=X(b),h=r?ge(w,{store:n,subject:{id:o.id,name:o.name}}):[],{apply:A,preview:k}=J(),[v,$]=(0,y.useState)(null),[D,R]=(0,y.useState)(null),H=(d,x)=>{try{return k(d,x),A(d,x),R(null),!0}catch(I){return R(G(n.schema,n.allMutations(),I)),!1}};return(0,p.jsxs)("div",{"data-testid":"seat-here",style:{display:"grid",gap:10,padding:"2px 2px 6px"},children:[(0,p.jsx)("p",{"data-testid":"seat-where",style:{margin:0,fontSize:"0.9375rem",lineHeight:1.45,color:"var(--graview-ink)"},children:S}),h.length>0?(0,p.jsx)("ul",{"aria-label":"What you can do",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:6},children:h.map(({affordance:d,label:x})=>(0,p.jsx)("li",{children:(0,p.jsx)("button",{type:"button","data-testid":"seat-act","data-affordance":d.id,"aria-pressed":v?.id===d.id,title:d.why,onClick:()=>d.open.length>0?$(I=>I?.id===d.id?null:d):void H(d),style:{...oe,minHeight:30,textAlign:"start",...d.destructive?{color:"var(--graview-warn)"}:{}},children:x})},d.id))}):null,v?(0,p.jsx)(Q,{affordance:v,onApply:d=>{H(v,d)&&$(null)},onCancel:()=>$(null)}):null,D?(0,p.jsx)("p",{"data-testid":"seat-refused",style:{margin:0,fontSize:"0.8125rem",color:"var(--graview-warn)"},children:D}):null,m.length>0?(0,p.jsx)("ul",{"aria-label":"Things to ask",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:2,justifyItems:"start"},children:m.map(d=>(0,p.jsx)("li",{children:(0,p.jsx)("button",{type:"button","data-testid":"seat-suggestion","data-graview-why":d.why,onClick:()=>s.ask(d.ask),style:re,children:d.ask})},d.ask))}):null]})}var fe="min(5.5em, 22cqh)",he=new WeakMap,L={far:64,flick:.5,least:16,tap:6};function Le(e,n){if(e.button!==0)return;let t=e.currentTarget,i=t.closest('[data-testid="seat"]');if(!i)return;let s=e.pointerId,o=e.clientY,c={y:o,at:e.timeStamp},a=0,r=0;try{t.setPointerCapture(s)}catch{}let l=u=>{if(u.pointerId!==s)return;r=Math.max(0,u.clientY-o);let f=u.timeStamp-c.at;f>0&&(a=(u.clientY-c.y)/f),c={y:u.clientY,at:u.timeStamp},i.style.transition="none",i.style.transform=r>0?`translateY(${r}px)`:""},g=u=>{if(u.pointerId!==s)return;t.removeEventListener("pointermove",l),t.removeEventListener("pointerup",g),t.removeEventListener("pointercancel",g);let f=u.type==="pointerup"&&(r>=L.far||r>=L.least&&a>=L.flick);if(i.style.transition=f?"":"transform 160ms ease-out",i.style.transform="",r>L.tap){let S=m=>{m.preventDefault(),m.stopPropagation()};t.addEventListener("click",S,{capture:!0,once:!0}),setTimeout(()=>t.removeEventListener("click",S,{capture:!0}),0)}f&&n()};t.addEventListener("pointermove",l),t.addEventListener("pointerup",g),t.addEventListener("pointercancel",g)}var E={display:"inline-grid",placeItems:"center",width:28,height:28,padding:0,font:"inherit",fontSize:"0.875rem",lineHeight:1,color:"var(--graview-ink-muted)",background:"transparent",border:"1px solid transparent",borderRadius:6,boxShadow:"none",cursor:"pointer"};export{Ye as SeatPanel,Te as useSeatGo};
@@ -1 +0,0 @@
1
- import{a as n}from"./chunk.RCLJ4H52.js";import"./chunk.ZEVVWWNA.js";import"./chunk.MOUGB4H6.js";import"./chunk.ONDILMIX.js";import{f as s}from"./chunk.UIIVEQAT.js";import"./chunk.GDA3G4U2.js";import"./chunk.OWE6OJ4P.js";import"./chunk.BKPGDEES.js";import"./chunk.JNGUSAWX.js";import"./chunk.CK7QWLMX.js";import"./chunk.QNHECGMH.js";import"./chunk.KZ2376BD.js";import"./chunk.IZW7DBK4.js";import"./chunk.RKRSRKF3.js";import"./chunk.KC6UZHBM.js";import"./chunk.HONUT6OG.js";import"./chunk.T4LY5QXO.js";import"./chunk.N4FBDA2W.js";import"./chunk.UT6642FC.js";import"./chunk.3G5MQFZK.js";import"./chunk.2CLPRG3I.js";import"./chunk.MB7LKKUD.js";import"./chunk.O42YET3W.js";import"./chunk.Z5V23DQN.js";import"./chunk.OHE5AMHH.js";import"./chunk.OYJSFO3A.js";import"./chunk.HV6I74DF.js";import"./chunk.WVUJXDXZ.js";import"./chunk.DAA6XWLF.js";import"./chunk.7DNFXJH3.js";import"./chunk.7PRFYYVM.js";import"./chunk.2NCTM5K2.js";import"./chunk.JU2ZVKMT.js";import"./chunk.HGAMNIST.js";import"./chunk.OQDETV4X.js";import"./chunk.ZS4DJ76C.js";import"./chunk.5R66YTET.js";import"./chunk.G4WQGTZR.js";import"./chunk.HFKMHLJ3.js";import"./chunk.GS4T26WW.js";import{F as y,M as i}from"./chunk.Z56B2JR2.js";import"./chunk.HLLWKSZB.js";import{b as r}from"./chunk.AJZBJBMO.js";var c=r(y(),1),e=r(i(),1);function v({store:d,views:t,as:a,scope:o}){let l=(0,c.useMemo)(()=>s({scope:`.${o}`}),[o]);return(0,e.jsxs)("div",{"data-testid":"embed-picture","data-embed-content":"",tabIndex:0,"aria-label":t.places().find(m=>m.as===a)?.title??"The picture",style:{flex:"1 1 auto",minHeight:0,display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",background:"var(--graview-ground)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)"},children:[(0,e.jsx)("style",{children:l}),(0,e.jsx)(n,{store:d,views:t,as:a})]})}export{v as PictureFace};
@@ -1 +0,0 @@
1
- import{a,b,c,d,e,f,g,h,i}from"./chunk.3JM2TNDD.js";import"./chunk.COTG2IG5.js";import"./chunk.DAA6XWLF.js";import"./chunk.7DNFXJH3.js";import"./chunk.7PRFYYVM.js";import"./chunk.2NCTM5K2.js";import"./chunk.JU2ZVKMT.js";import"./chunk.5R66YTET.js";import"./chunk.G4WQGTZR.js";import"./chunk.HFKMHLJ3.js";import"./chunk.HLLWKSZB.js";import"./chunk.AJZBJBMO.js";export{f as columnActs,c as columnMoves,b as columnOf,d as columnReach,e as columnSteps,h as describePlace,i as placeText,g as resolveFor,a as statusColumns};
@@ -1,116 +0,0 @@
1
- import{A as ge,B as nn,C as Pe,D as Te,E as Ua,F as an,G as ue,H as _a,I as Ya,J as T,K as Ve,L as rn,M as Ja,N as on,O as St,P as Qa,Q as j,R as Y,S as sn,a as G,b as xe,c as q,d as qa,e as en,f as tn,g as qe,h as z,i as re,j as _,k as x,l as U,m as F,n as se,o as wt,p as Re,q as ee,r as Va,s as Je,t as kt,u as B,v as Le,w as za,x as bt,y as ce,z as ja}from"./chunk.ZEVVWWNA.js";import{b as vt,d as V}from"./chunk.MOUGB4H6.js";import{a as Ha,d as Ba,e as Ga}from"./chunk.ONDILMIX.js";import{a as Da,e as Ka}from"./chunk.UIIVEQAT.js";import{a as Oa,b as Na,c as $a,d as Zt}from"./chunk.GDA3G4U2.js";import{a as Xt}from"./chunk.OWE6OJ4P.js";import{a as Fa,c as yt,d as Ea,e as Ia,h as ht}from"./chunk.BKPGDEES.js";import{m as La}from"./chunk.KZ2376BD.js";import{b as Sa,c as Jt,e as xa}from"./chunk.RKRSRKF3.js";import{d as ya,e as ha,f as va,m as wa,n as ka,p as ba,r as ut}from"./chunk.KC6UZHBM.js";import{a as ft,b as Ta,c as Ma}from"./chunk.HONUT6OG.js";import{a as Mr}from"./chunk.T4LY5QXO.js";import{a as pt,b as ea,c as ta,e as jt,f as na}from"./chunk.N4FBDA2W.js";import{a as _t,b as da,c as pa}from"./chunk.UT6642FC.js";import{a as mt,b as Pa,c as Ca,d as Qt,e as Aa,g as Ra}from"./chunk.O42YET3W.js";import{s as Yt}from"./chunk.OYJSFO3A.js";import{c as ca,d as ga,j as gt}from"./chunk.DAA6XWLF.js";import{a as Fe}from"./chunk.HGAMNIST.js";import{f as oa,g as Ge,i as sa,j as la,k as Ut}from"./chunk.ZS4DJ76C.js";import{b as ct,c as aa,d as ra,e as ia}from"./chunk.5R66YTET.js";import{D as Wa,a as Vn,g as Zn,l as ua,m as ma,v as fa}from"./chunk.GS4T26WW.js";import{F as Se,I as jn,K as Un,M as H,P as _n,Q as Yn,V as pe,Z as Jn,aa as Be,ba as Qn,ka as Xn,r as zn,v as Ye}from"./chunk.Z56B2JR2.js";import{$ as lt,Aa as Fn,Gb as Wn,H as Tn,Hb as Dn,Ia as qt,Ja as En,M as _e,Ra as dt,V as He,W as Z,Y as oe,Z as st,Zb as Vt,ba as Mn,ca as $e,cc as Kn,dc as Hn,fc as Bn,ja as On,ka as Nn,nb as In,nc as zt,oc as Gn,sc as qn,ya as $n}from"./chunk.HLLWKSZB.js";import{b as $}from"./chunk.AJZBJBMO.js";function Xa(t,e,n={}){let a=t.graph.getNode(e);if(!a)return;let i=t.schema.tryDefinition(a.kind),r=o=>Z(t.schema.tryDefinition(o.kind),o),l=new Map;for(let o of t.graph.allEdges()){let d=o.from===e?"out":o.to===e?"in":null;if(!d)continue;let s=d==="out"?o.to:o.from,c=t.graph.getNode(s);if(!c)continue;let f=(d==="out"?i:t.schema.tryDefinition(c.kind))?.edges?.[o.kind],g=d==="in"?f?.inverse??f?.description:f?.description,w=`${o.kind}|${d}|${g??""}`;(l.get(w)??(()=>{let A={edgeKind:o.kind,direction:d,...g?{description:g}:{},targets:[]};return l.set(w,A),A})()).targets.push({id:c.id,kind:c.kind,label:r(c)})}return{id:e,kind:a.kind,label:r(a),fields:ra(gt(t.schema,t.graph,a),i),violations:qt(t.violations(n.context),[e]),actions:Xt(t,[e],{focus:e,...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}}),links:[...l.values()].map(o=>{let d=ct(o.targets.flatMap(s=>{let c=t.graph.getNode(s.id);return c?[c]:[]}),s=>t.schema.tryDefinition(s));return{...o,targets:[...o.targets].map(s=>d.has(s.id)?{...s,apart:d.get(s.id)}:s).sort((s,c)=>s.label.localeCompare(c.label))}})}}function Ee(t,e,n={}){return{kind:e,members:t.graph.nodesOfKind(e),actions:Xt(t,[],{kindSelection:[e],...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}})}}function Za(t,e){let n=(r,l)=>`${r}|${JSON.stringify(l)}`,a=new Map;for(let r of[...t.affordances,...t.withheld]){if(r.provider!=="invariant")continue;let l=n(r.mutation,r.args);a.has(l)||a.set(l,r.rank??Number.MAX_SAFE_INTEGER)}let i=Number.MAX_SAFE_INTEGER;return[...e].map((r,l)=>({repair:r,declared:l})).sort((r,l)=>(a.get(n(r.repair.mutation,r.repair.args??{}))??i)-(a.get(n(l.repair.mutation,l.repair.args??{}))??i)||r.declared-l.declared).map(r=>r.repair)}function Ie(t){let e=t.schema.kinds.map(i=>({kind:i,plural:lt(t.schema,i),count:t.graph.nodesOfKind(i).length})),n=new Map;for(let i of t.graph.allEdges()){let r=t.graph.getNode(i.from),l=t.graph.getNode(i.to);if(!r||!l)continue;let o=`${i.kind}|${r.kind}|${l.kind}`;n.set(o,(n.get(o)??0)+1)}let a=[];for(let{kind:i}of e){let r=t.schema.tryDefinition(i)?.edges??{};for(let[l,o]of Object.entries(r)){let d=o.to==="*"||o.to===void 0?(()=>{let s=[...n.keys()].filter(c=>c.startsWith(`${l}|${i}|`)).map(c=>c.split("|")[2]);return s.length>0?s:["*"]})():o.to;for(let s of d)a.push({edgeKind:l,from:i,to:s,...o.description?{description:o.description}:{},...o.inverse?{inverse:o.inverse}:{},count:n.get(`${l}|${i}|${s}`)??0})}}return{kinds:e,relations:a}}var De=$(Se(),1);var Pt=$(Se(),1),k=$(H(),1),Or=`
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 Nr({title:t,name:e,optional:n,amount:a,value:i,onChange:r}){let l=sa(a),[o,d]=(0,Pt.useState)(()=>typeof i=="number"?la(i,a):""),s=o.trim()!==""&&Ut(o,a)===void 0;return(0,k.jsxs)("label",{"data-graview-part":"field","data-graview-field":"number","data-graview-amount":a.format??"unit",children:[(0,k.jsx)("span",{"data-graview-part":"label",children:t}),(0,k.jsxs)("span",{"data-graview-part":"amount",style:{display:"flex",alignItems:"center",gap:6},children:[l.prefix?(0,k.jsx)("span",{"data-graview-part":"amount-symbol","aria-hidden":"true",children:l.prefix}):null,(0,k.jsx)("input",{type:"text",inputMode:"decimal",name:e,required:!n,placeholder:l.placeholder,title:l.hint,"aria-invalid":s||void 0,value:o,onChange:c=>{d(c.target.value),r(Ut(c.target.value,a))},"data-graview-part":"control",style:{flex:1,minWidth:0}}),l.suffix?(0,k.jsx)("span",{"data-graview-part":"amount-symbol","aria-hidden":"true",children:l.suffix}):null]}),s?(0,k.jsxs)("span",{"data-graview-part":"hint",role:"status",children:["Not an amount ",l.hint,": write it like ",l.prefix??"",l.placeholder,l.suffix?` ${l.suffix}`:""]}):null]})}function er({children:t}){return(0,k.jsxs)("span",{"data-graview-part":"picker",children:[t,(0,k.jsx)("span",{"aria-hidden":"true","data-graview-part":"chevron",children:"\u25BE"})]})}var $r=t=>({label:oe(t),option:e=>e}),Fr={phone:"+1 555 123 4567",place:"An address or a place's name",duration:"1h 30m, 90 or 1:30"};function xt({store:t,spec:e,value:n,onChange:a,prefilled:i,open:r,words:l=$r,values:o}){if(e.name in i&&e.control!=="group"&&e.control!=="variant")return null;let d=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(c=>oe($e(t.schema.tryDefinition(c),c))).join(" or "):l(e.name).label,s=d+(e.optional||e.control==="boolean"?"":" *");switch(e.control){case"text":case"date":return e.control==="text"&&e.long?(0,k.jsxs)("label",{"data-graview-part":"field","data-graview-field":"text",children:[(0,k.jsxs)("span",{"data-graview-part":"label",children:[s,e.markdown?(0,k.jsx)("span",{style:{fontWeight:"normal",color:"var(--graview-ink-faint)"},children:" \xB7 Markdown"}):null]}),(0,k.jsx)("textarea",{name:e.name,required:!e.optional,rows:6,value:typeof n=="string"?n:"",onChange:c=>a(c.target.value),"data-graview-part":"control",style:{fieldSizing:"content",minHeight:"7.5em",resize:"vertical",font:"inherit",lineHeight:1.5}})]}):(0,k.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control==="text"&&e.holds?e.holds:e.control,children:[(0,k.jsx)("span",{"data-graview-part":"label",children:s}),(0,k.jsx)("input",{type:e.control==="date"?e.time?"datetime-local":"date":e.control==="text"&&e.holds==="phone"?"tel":"text",name:e.name,required:!e.optional,...e.control==="text"&&e.app?{placeholder:"@owner/app or https://\u2026"}:{},...e.control==="text"&&e.holds?{placeholder:Fr[e.holds]}:{},...e.control==="text"&&e.holds==="phone"?{autoComplete:"tel"}:{},value:typeof n=="string"?n:typeof n=="number"?String(n):"",onChange:c=>a(c.target.value),"data-graview-part":"control"})]});case"number":return e.amount?(0,k.jsx)(Nr,{title:s,name:e.name,optional:e.optional,amount:e.amount,value:n,onChange:a}):(0,k.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,k.jsx)("span",{"data-graview-part":"label",children:s}),(0,k.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:c=>a(c.target.value===""?void 0:Number(c.target.value)),"data-graview-part":"control"})]});case"boolean":return(0,k.jsxs)("label",{"data-graview-part":"field","data-graview-field":"boolean",children:[(0,k.jsx)("input",{type:"checkbox",name:e.name,checked:n===!0,onChange:c=>a(c.target.checked),"data-graview-part":"control"}),(0,k.jsx)("span",{"data-graview-part":"label",children:s})]});case"choice":return(0,k.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,k.jsx)("span",{"data-graview-part":"label",children:s}),(0,k.jsx)(er,{children:(0,k.jsxs)("select",{name:e.name,required:!e.optional,value:typeof n=="string"?n:"",onChange:c=>a(c.target.value||void 0),"data-graview-part":"control",children:[(0,k.jsx)("option",{value:"",children:"\u2014"}),(e.options??[]).map(c=>(0,k.jsx)("option",{value:c,children:l(e.name).option(c)},c))]})})]});case"node":{let c=r.find(C=>C.name===e.name)?.candidates,m=new Set(Object.values(i).filter(C=>typeof C=="string")),f=(e.kinds.includes("*")?[...t.graph.allNodes()]:e.kinds.flatMap(C=>t.graph.nodesOfKind(C))).filter(C=>!m.has(C.id)),g=c?c.map(C=>t.graph.getNode(C)).filter(C=>C!==void 0):f,w=ct(g,C=>t.schema.tryDefinition(C));return(0,k.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,k.jsx)("span",{"data-graview-part":"label",children:s}),(0,k.jsx)(er,{children:(0,k.jsxs)("select",{name:e.name,required:!e.optional,value:typeof n=="string"?n:"",onChange:C=>a(C.target.value||void 0),"data-graview-part":"control",children:[(0,k.jsx)("option",{value:"",children:"\u2014"}),g.map(C=>{let A=w.get(C.id);return(0,k.jsxs)("option",{value:C.id,children:[Z(t.schema.tryDefinition(C.kind),C),A?` \xB7 ${A}`:""]},C.id)})]})})]})}case"group":{let c=n??{};return(0,k.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.control,children:[(0,k.jsx)("legend",{"data-graview-part":"label",children:s}),e.fields.map(m=>(0,k.jsx)(xt,{store:t,spec:m,value:c[m.name],onChange:f=>a({...c,[m.name]:f}),prefilled:i,open:r,words:l},m.name))]})}case"variant":{let c=n??{},m=typeof c[e.tag]=="string"?c[e.tag]:"",f=e.options.find(g=>g.value===m);return(0,k.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.control,children:[(0,k.jsx)("legend",{"data-graview-part":"label",children:s}),(0,k.jsxs)("label",{"data-graview-part":"field","data-graview-field":"choice",children:[(0,k.jsx)("span",{"data-graview-part":"label",children:oe(e.tag)}),(0,k.jsxs)("select",{value:m,onChange:g=>a({[e.tag]:g.target.value}),"data-graview-part":"control",children:[(0,k.jsx)("option",{value:"",children:"\u2014"}),e.options.map(g=>(0,k.jsx)("option",{value:g.value,children:oe(g.value)},g.value))]})]}),f?.fields.map(g=>(0,k.jsx)(xt,{store:t,spec:g,value:c[g.name],onChange:w=>a({...c,[g.name]:w}),prefilled:i,open:r,words:l},g.name))]})}case"file":case"list":{let c=e.control==="file"?e:e.item.control==="file"?e.item:void 0;if(c||e.control==="file")return(0,k.jsx)(Fe,{as:"control",title:s,value:n,onChange:a,several:c!==e,image:c?.image===!0,label:d});let m=Array.isArray(n)?n:[];return(0,k.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":"list",children:[(0,k.jsx)("legend",{"data-graview-part":"label",children:s}),m.map((f,g)=>(0,k.jsxs)("div",{"data-graview-part":"item",children:[(0,k.jsx)("div",{style:{flex:1},children:(0,k.jsx)(xt,{store:t,spec:{...e.item,optional:!1},value:f,onChange:w=>a(m.map((C,A)=>A===g?w:C)),prefilled:i,open:r,words:l})}),(0,k.jsx)("button",{type:"button","data-graview-part":"remove",onClick:()=>a(m.filter((w,C)=>C!==g)),children:"remove"})]},g)),(0,k.jsx)("button",{type:"button","data-graview-part":"add",onClick:()=>a([...m,void 0]),children:"add another"})]})}case"repeat":return(0,k.jsx)(Pa,{value:n,onChange:a,start:e.of?o?.[e.of]:void 0,label:`${e.of?l(e.of).label:d} repeats`,name:e.name});case"opaque":return(0,k.jsxs)("p",{"data-graview-part":"unasked",children:["\u201C",oe(e.name),"\u201D needs a structured answer this form cannot ask for yet."]})}}function we({store:t,mutation:e,prefilled:n={},open:a=[],onDone:i,principal:r,initial:l,label:o,only:d}){let[s,c]=(0,Pt.useState)(()=>({...l})),[m,f]=(0,Pt.useState)(null),g=r??t.seenFor,w=e.subject&&n[e.subject.arg],C=g?Ma(t,g,e,typeof w=="string"?w:void 0):void 0,A=ft(e.input).filter(I=>(d===void 0||d.includes(I.name))&&!C?.has(I.name)),S=I=>oa(t.schema,e,I);return(0,k.jsxs)("form",{"data-testid":`form-${e.name}`,onSubmit:I=>{I.preventDefault();try{t.apply({name:e.name,args:{...Ta(A,s),...n}},r?{author:r}:{}),f(null),c({}),i?.()}catch(ne){f(Ge(t.schema,t.allMutations(),ne))}},"data-graview-part":"form",children:[(0,k.jsx)("style",{children:Or}),A.map(I=>(0,k.jsx)(xt,{store:t,spec:I,value:s[I.name],values:s,onChange:ne=>c(Q=>({...Q,[I.name]:ne})),prefilled:n,open:a,words:S},I.name)),m?(0,k.jsx)("p",{"data-testid":"refused","data-graview-part":"refused",role:"alert",children:m}):null,(0,k.jsx)("button",{type:"submit","data-graview-part":"submit",children:o??e.title??e.name})]})}var P=$(H(),1);function me(t){let e=t.views;if(!e)return[];let n=new Set(Le(t.store,t.principal));return e.places().filter(a=>n.has(a.kind))}function Ct(t,e){if(!e.over)return[e.kind];let n=new Set(Le(t.store,t.principal));return e.over.filter(a=>a===e.kind||n.has(a))}var We=t=>`place:${t.kind}:${t.as}`;function ye(t,e){return qa(e.as,Kn(e,t.views?.places()??[])?G(t.store.schema,e.kind):void 0)}function Qe(t,e){let n=t.schema.tryDefinition(e);return t.graph.nodesOfKind(e).filter(a=>He(n,a))}function ln(t,e,n){let a=(r,l)=>st(t.schema,l,r),i=(typeof e=="string"?[e]:e).map(r=>a(Qe(t,r).length,r)).join(" and ");return n?`${i} across ${a(Qe(t,n).length,n)}`:i}function dn({context:t,place:e,chosen:n}){let{store:a,views:i,invariantContext:r}=t,o=i?.resolve(e.kind,{cardinality:"many",fidelity:"full"},e.as)?.view;if(!o)return null;let d=Ct(t,e).flatMap(c=>Qe(a,c)),s=[...new Set(a.violations(r).flatMap(c=>c.nodeIds))];return(0,P.jsx)(Yt,{kind:e.kind,view:e.title,children:(0,P.jsx)(o,{nodes:d,label:e.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...n&&n.length>0?{implicated:n}:{},...s.length>0?{flagged:s}:{}})})}function Er({store:t,views:e,as:n,invariantContext:a}){V(t);let i={store:t,views:e,...a?{invariantContext:a}:{}},r=e.places().find(l=>l.as===n);return r?(0,P.jsx)(dn,{context:i,place:r}):null}function Ir({context:t,kind:e}){let{store:n,views:a,invariantContext:i}=t,r=Qe(n,e),l=n.schema.tryDefinition(e),o=B(n,e),s=a?.resolve(e,{cardinality:"many",fidelity:"full"})?.view,c=[...new Set(n.violations(i).flatMap(w=>w.nodeIds))];if(s&&!Be(s))return(0,P.jsx)(Yt,{kind:e,children:(0,P.jsx)(s,{nodes:r,label:o,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...c.length>0?{flagged:c}:{}})});let m=a?.resolve(e,{cardinality:"one",fidelity:"summary"})?.view,f=8,g=r.slice(0,f);return(0,P.jsxs)("div",{"data-testid":"kind-sheet",style:m?{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(w=>m?(0,P.jsx)(m,{node:w,fidelity:"summary",cardinality:"one",mode:"fullscreen",selected:!1,...c.includes(w.id)?{flagged:[w.id]}:{}},w.id):(0,P.jsx)("span",{style:{padding:"8px 14px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:Z(l,w)},w.id)),r.length>f?(0,P.jsxs)("span",{style:{...x,alignSelf:"center",padding:"0 6px"},children:["+",r.length-f," more ",o.toLowerCase()]}):null]})}function pn(t){let{store:e}=t,n=za(t),a=me(t),i=Vt([...a].sort((l,o)=>n.indexOf(l.kind)-n.indexOf(o.kind))),r=new Set(i.flatMap(l=>l.over??[l.kind]));return[...i.map(l=>({key:We(l),kind:l.kind,title:Hn(l,a,e.schema),to:ye(t,l),place:l})),...bt(t).filter(l=>!r.has(l)).map(l=>({key:`kind:${l}`,kind:l,title:B(e,l),to:`/${G(e.schema,l)}`}))]}var tr=.72,Wr=540,nr=16/10;function Dr(t){let e=(0,De.useRef)(null),[n,a]=(0,De.useState)(t);return(0,De.useLayoutEffect)(()=>{let i=e.current;if(!i||typeof ResizeObserver>"u")return;let r=()=>{let o=i.getBoundingClientRect().width;o>0&&a(d=>Math.abs(d-o)<.5?d:o)};r();let l=new ResizeObserver(r);return l.observe(i),()=>l.disconnect()},[]),{ref:e,width:n}}function cn({context:t,entry:e}){let{store:n,brand:a,principal:i}=t,{ref:r,width:l}=Dr(Wr),o=l/tr,d=Qe(n,e.kind),s=n.schema.tryDefinition(e.kind),c=d.length===0?Ee(n,e.kind,{...i?{principal:i}:{},...t.invariantContext?{context:t.invariantContext}:{}}).actions.affordances[0]:void 0,m=e.place!==void 0;return(0,P.jsxs)(T,{to:e.to,"data-testid":m?"place-card":"kind-card",className:"graview-gallery-card",style:{...se,display:"grid",gap:10,alignContent:"start",minWidth:0},children:[(0,P.jsxs)("span",{ref:r,"data-testid":m?"place-picture":"kind-picture","aria-hidden":"true",inert:!0,style:{display:"block",position:"relative",width:"100%",aspectRatio:`${nr}`,overflow:"hidden",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",pointerEvents:"none"},children:[(0,P.jsx)("span",{style:{position:"absolute",left:0,top:0,width:o,height:o/nr,display:"grid",gridTemplateRows:"minmax(0, 1fr)",transform:`scale(${tr})`,transformOrigin:"0 0"},children:(0,P.jsx)(yt.Provider,{value:null,children:e.place?(0,P.jsx)(dn,{context:t,place:e.place}):(0,P.jsx)(Ir,{context:t,kind:e.kind})})}),d.length===0?(0,P.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,P.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,P.jsxs)("span",{style:{fontFamily:tn,fontWeight:"var(--graview-weight-display)"},children:["No ",B(n,e.kind).toLowerCase()," yet"]}),c?(0,P.jsxs)("span",{style:x,children:["Begin with \u201C",c.label,"\u201D"]}):null]})}):null]}),(0,P.jsxs)("span",{style:{display:"grid",gap:2,minWidth:0},children:[(0,P.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[m?null:(0,P.jsx)(ee,{kind:e.kind,brand:a,schema:n.schema,size:8}),(0,P.jsx)("span",{style:{fontFamily:tn,fontSize:"var(--graview-text-heading)",fontWeight:"var(--graview-weight-display)",lineHeight:1.3,overflowWrap:"anywhere",textWrap:"balance"},children:e.title})]}),(0,P.jsxs)("span",{style:x,children:[e.place?ln(n,Ct(t,e.place),e.place.across):ln(n,e.kind),!m&&s?.description?` \xB7 ${s.description}`:null]})]})]})}var ar={display:"grid",gap:"32px 28px",gridTemplateColumns:"repeat(auto-fill, minmax(min(420px, 100%), 1fr))"},Kr=`
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 gn({context:t}){V(t.store);let e=pn(t);return e.length===0?null:(0,P.jsxs)("section",{style:ar,"data-testid":"gallery",children:[(0,P.jsx)("style",{children:Kr}),e.map(n=>(0,P.jsx)(cn,{context:t,entry:n},n.key))]})}function un({context:t}){let{store:e}=t;V(e);let n=Vt(me(t)),a=pn(t);return(0,P.jsxs)(j,{context:t,style:qe,children:[(0,P.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,P.jsx)("p",{style:re,children:n.length===0?"None of its own yet":`${n.length} ${n.length===1?"picture":"pictures"}`}),(0,P.jsx)(Y,{context:t,children:"Pictures"}),(0,P.jsx)("p",{style:_,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."})]}),a.length>0?(0,P.jsx)("div",{style:ar,"data-testid":"places",children:a.map(i=>(0,P.jsx)(cn,{context:t,entry:i},i.key))}):null]})}function mn({context:t}){let{store:e,principal:n}=t;V(e);let a=Te(),i=Pe(),[r]=Ve(),l=decodeURIComponent(a.as??""),[o,d]=(0,De.useState)(null),s=r.get("of"),m=me(t).find(A=>A.as===l&&(!s||G(e.schema,A.kind)===s));if(!m)return(0,P.jsxs)(j,{context:t,children:[(0,P.jsx)(Y,{context:t,children:"No picture is called that."}),(0,P.jsx)("p",{style:_,children:(0,P.jsx)(T,{to:"/places",style:F,children:"The pictures there are \u2192"})})]});let f=B(e,m.kind),g=t.views?.resolve(m.kind,{cardinality:"many",fidelity:"full"},m.as)?.view?.flows===!0,C=Ee(e,m.kind,{...n?{principal:n}:{},...t.invariantContext?{context:t.invariantContext}:{}}).actions.affordances.map(A=>({affordance:A,mutation:e.allMutations().find(S=>S.name===A.mutation)})).filter(A=>A.mutation!==void 0);return(0,P.jsxs)(j,{context:t,style:qe,children:[(0,P.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,P.jsx)(Y,{context:t,children:m.title}),(0,P.jsxs)("p",{style:_,"data-testid":"place-lede",children:[ln(e,Ct(t,m),m.across),"."]}),(0,P.jsx)("p",{style:{...x,margin:0,display:"flex",flexWrap:"wrap",gap:"4px 16px"},children:Ct(t,m).map((A,S)=>(0,P.jsxs)(T,{to:`/${G(e.schema,A)}`,style:{...F,...x},...S===0?{"data-testid":"place-as-list"}:{},children:["All ",(A===m.kind?f:B(e,A)).toLowerCase()," as a list \u2192"]},A))})]}),(0,P.jsx)("div",{"data-testid":"place-lens","data-flows":g?"":void 0,style:g?{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",maxWidth:"100%"}:{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:A=>{let S=A.target?.closest("[data-graview-pick]"),I=S?.getAttribute("data-graview-pick"),ne=S?.getAttribute("data-graview-joins");if(ne)try{let le=JSON.parse(ne);if(Array.isArray(le)&&le.every(ke=>typeof ke=="string")){A.preventDefault(),d({at:We(m),ids:le});return}}catch{}if(!I)return;let Q=e.graph.getNode(I);Q&&(A.preventDefault(),i(q(e.schema,Q.kind,I)))},children:(0,P.jsx)(dn,{context:t,place:m,...o?.at===We(m)?{chosen:o.ids}:{}})}),(0,P.jsx)("div",{style:{maxWidth:760,display:"grid",gap:40},children:C.map(({affordance:A,mutation:S})=>(0,P.jsxs)("section",{style:{...U,display:"grid",gap:14},children:[(0,P.jsx)("h2",{style:z,children:S.title??S.name}),S.description?(0,P.jsx)("p",{style:{...x,margin:0,maxWidth:"58ch"},children:S.description}):null,(0,P.jsx)(we,{store:e,mutation:S,prefilled:A.args,open:A.open,label:A.label,...n?{principal:n}:{}})]},A.id))})]})}var K=$(Se(),1);var Ke=$(Se(),1);function rr(t,e,n){let a=Math.max(0,t.left),i=Math.min(e.width,t.right),r=Math.max(0,t.top),l=Math.min(e.height,t.bottom);return{shown:l-r>=n.height+2*16&&i-a>=n.width+2*16,left:Math.round(a),top:Math.round(r),width:Math.round(Math.max(0,i-a)),height:Math.round(Math.max(0,l-r))}}function ir(t,e,n){let a=t.style;a.left=`${e.left}px`,a.top=`${e.top}px`,a.right="auto",a.bottom="auto",a.visibility=n?"":"hidden";let i=t.getBoundingClientRect();i.width!==0&&(a.left=`${Math.round(2*e.left-i.left)}px`,a.top=`${Math.round(2*e.top-i.top)}px`)}var Me=$(H(),1);function or({context:t}){let e=Pe(),n=pe(),{pathname:a}=ge(),[,i,r]=a.split("/"),l=i==="places"&&r?decodeURIComponent(r):void 0,o=(0,Ke.useRef)(null);return Br(o,n!==null),n?(0,Me.jsxs)(Me.Fragment,{children:[(0,Me.jsx)(Gr,{context:t}),(0,Me.jsx)("div",{ref:o,"data-testid":"page-seat",style:{position:"fixed",left:0,top:0,width:"100vw",height:"100dvh",pointerEvents:"none",zIndex:Dn("rail"),containerType:"size"},children:(0,Me.jsx)(Da,{onPick:d=>{let s=t.store.graph.getNode(d);s&&e(q(t.store.schema,s.kind,d))},onMove:d=>{if(n.seatTalk.get().draft&&n.seatTalk.setDraft(null),d.to==="place"&&(d.face==="scene"||d.slug==="overview")){t.overview?t.overview("#"):t.embedded||window.location.assign(t.sceneHref??"/");return}e(d.address)},...l?{place:l}:{},onDraft:()=>{a!=="/~draft"&&e("/~draft")}})})]}):null}var Hr={width:160,height:40};function Br(t,e){let{pathname:n}=ge(),a=Zn(e);(0,Ke.useLayoutEffect)(()=>{let i=t.current;if(!i)return;let r=i.parentElement?.closest("[data-embed-content]")??null,l=()=>r??document.querySelector("main")??null,o=()=>{let m=l(),f={width:document.documentElement.clientWidth||innerWidth,height:a??innerHeight},g=m?.getBoundingClientRect()??{left:0,top:0,right:f.width,bottom:f.height},w=rr(r?g:{left:g.left,right:g.right,top:g.top,bottom:Math.max(g.bottom,f.height)},f,Hr);i.style.width=`${w.width}px`,i.style.height=`${w.height}px`,ir(i,w,w.shown)};o(),addEventListener("resize",o),addEventListener("scroll",o,!0);let d=0,s=typeof ResizeObserver=="function"?new ResizeObserver(()=>{cancelAnimationFrame(d),d=requestAnimationFrame(o)}):null,c=l();return c&&s?.observe(c),()=>{cancelAnimationFrame(d),s?.disconnect(),removeEventListener("resize",o),removeEventListener("scroll",o,!0)}},[t,e,n,a])}function Gr({context:t}){let{store:e}=t,n=pe(),{pathname:a}=ge(),i=(0,Ke.useRef)(n?.setSelection);return i.current=n?.setSelection,(0,Ke.useEffect)(()=>{let r=i.current;if(!r)return;let[,l,o]=a.split("/"),d=(()=>{if(l==="places"){let c=t.views?.places().find(m=>m.as===decodeURIComponent(o??""));return c?[Ye(c.kind)]:[]}let s=l?xe(e.schema,l):void 0;return s&&o?[decodeURIComponent(o)]:s?[zn(s)]:[]})();r(s=>s.length===d.length&&s.every((c,m)=>c===d[m])?s:d)},[a]),null}var te=$(Se(),1);var lr=$(Mr(),1);var J=$(H(),1);var qr=(0,te.lazy)(Vn(()=>import("./chunk.BZ5OJYHU.js").then(t=>({default:t.TakeBack}))));function Vr({context:t,docked:e,at:n}){let{store:a}=t,i=V(a),[r]=(0,te.useState)(()=>a.batches().length),l=(0,te.useRef)(!1);return l.current||=i>0||!e&&r>0,l.current?(0,J.jsx)(te.Suspense,{fallback:null,children:(0,J.jsx)(qr,{context:t,docked:e,at:n,since:r})}):null}function zr(t,e,n){let{store:a,principal:i,embedded:r}=t;(0,te.useEffect)(()=>{if(!n)return;let l=o=>{if(!Ga(o))return;let d=o.target,s=d instanceof Node&&e.current?.contains(d),c=d===document.body||d===document.documentElement||d===document;if(!(!s&&!(c&&!r))&&Ha(a,i)){o.preventDefault();try{Ba(a,i)}catch{}}};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[a,i,r,e,n])}function dr({context:t,registry:e,root:n,children:a}){let i=(0,te.useMemo)(Ja,[]),r=e?.without()??new Set;return zr(t,n,!r.has("undo")),(0,J.jsxs)(rn.Provider,{value:i,children:[(0,J.jsx)(jr,{context:t,placed:i,without:r}),a]})}function jr({context:t,placed:e,without:n}){let[a,i]=(0,te.useState)(!1);(0,te.useLayoutEffect)(()=>i(!0),[]);let r=on(e,"find"),l=on(e,"undo"),o=ge(),d=ma();if(!a)return null;let s=o.pathname.split("/").filter(Boolean),m=(s.length===1?xe(t.store.schema,s[0]):void 0)!==void 0;return(0,J.jsxs)(J.Fragment,{children:[!r&&!n.has("find")&&d?(0,lr.createPortal)((0,J.jsx)(sr,{context:t,narrowsLists:m}),d.slot):null,!r&&!n.has("find")&&!d?(0,J.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,J.jsx)(sr,{context:t,narrowsLists:m})}):null,!l&&!n.has("undo")?(0,J.jsx)(Vr,{context:t,docked:!0,at:o.pathname+o.search}):null,d?.own&&!n.has("undo")?(0,J.jsx)(ja,{context:t,own:d.own}):null]})}function sr({context:t,narrowsLists:e}){return(0,J.jsx)(rn.Provider,{value:null,children:(0,J.jsx)(sn,{context:t,narrowsLists:e})})}var O=$(H(),1);function pr(t,e){return e==="*"?{label:"anything",path:null}:{label:B(t,e),path:`/${G(t.schema,e)}`}}function Ur({context:t,relation:e}){let{store:n}=t,a=pr(n,e.from),i=pr(n,e.to),r=l=>l.path?(0,O.jsx)(T,{to:l.path,style:{...se,fontWeight:550},children:l.label}):(0,O.jsx)("span",{children:l.label});return(0,O.jsxs)("li",{"data-testid":"relation","data-relation":e.edgeKind,style:{display:"grid",gridTemplateColumns:"30px minmax(0, 1fr) auto",gap:12,alignItems:"baseline"},children:[(0,O.jsx)(Ka,{edgeKind:e.edgeKind,...t.brand?.kit?{kit:t.brand.kit}:{}}),(0,O.jsxs)("span",{style:{display:"grid",gap:1},children:[(0,O.jsxs)("span",{children:[r(a)," ",(0,O.jsxs)("span",{style:x,"data-graview-speaks-ids":"",children:[oe(e.edgeKind)," \u2192"]})," ",r(i)]}),e.description||e.inverse?(0,O.jsxs)("span",{style:x,children:[e.description?ce(e.description):null,e.description&&e.inverse?" \xB7 ":null,e.inverse?`from the other end, ${e.inverse}`:null]}):null]}),i.path?(0,O.jsx)(T,{to:`${i.path}?with=${encodeURIComponent(e.edgeKind)}`,style:{...F,...x,fontVariantNumeric:"tabular-nums",display:"inline-block",minWidth:24,minHeight:24,textAlign:"center"},title:`The ${i.label.toLowerCase()} that have this`,children:e.count}):(0,O.jsx)("span",{style:{...x,fontVariantNumeric:"tabular-nums"},children:e.count})]})}function cr({context:t,heading:e=!0}){let{store:n}=t,a=new Set(Le(n,t.principal)),i=Ie(n).relations.filter(r=>a.has(r.from)&&(r.to==="*"||a.has(r.to)));return i.length===0?null:(0,O.jsxs)("section",{style:{...U,display:"grid",gap:12},"data-testid":"kind-map",children:[e?(0,O.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,O.jsx)("h2",{style:z,children:(0,O.jsx)(T,{to:"/map",style:se,children:"Connections"})}),(0,O.jsx)("span",{style:x,children:i.length===1?"1 relation":`${i.length} relations`})]}):null,(0,O.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:i.map(r=>(0,O.jsx)(Ur,{context:t,relation:r},`${r.edgeKind}|${r.from}|${r.to}`))})]})}function fn({context:t}){let{store:e}=t;V(e);let n=new Set(Le(e,t.principal)),a=Ie(e),i=a.relations.filter(r=>n.has(r.from));return(0,O.jsxs)(j,{context:t,children:[(0,O.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,O.jsx)("p",{style:re,children:i.length===0?"No relations":`${i.length} ${i.length===1?"relation":"relations"}`}),(0,O.jsx)(Y,{context:t,children:"Connections"}),(0,O.jsx)("p",{style:_,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,O.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},"data-testid":"map-kinds",children:a.kinds.filter(r=>n.has(r.kind)).map(r=>(0,O.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,O.jsx)(ee,{kind:r.kind,brand:t.brand,schema:e.schema,size:7}),(0,O.jsx)(T,{to:`/${G(e.schema,r.kind)}`,style:F,children:r.plural}),(0,O.jsx)("span",{style:x,children:r.count})]},r.kind))}),(0,O.jsx)(cr,{context:t,heading:!1})]})}function gr({context:t}){let n=[...pe()?.robots.values()??[]].filter(i=>i.mode==="asking"&&i.say);if(n.length===0)return null;let{store:a}=t;return(0,O.jsxs)("section",{style:{...U,display:"grid",gap:10},"data-testid":"seat-questions",children:[(0,O.jsx)("h2",{style:z,children:n.length===1?"The seat asked something":`The seat asked ${n.length} things`}),(0,O.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8},children:n.map(i=>{let r=i.at?a.graph.getNode(i.at):void 0;return(0,O.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,O.jsx)("span",{children:i.say}),r?(0,O.jsxs)(T,{to:q(a.schema,r.kind,r.id),style:{...F,...x},children:[Z(a.schema.tryDefinition(r.kind),r)," \u2192"]}):null]},i.participant)})})]})}var E=$(H(),1);function yn({context:t}){let{principal:e}=t,{store:n,brand:a,invariantContext:i}=t;V(n);let r=n.violations(i),l=`${r.length===1?"A rule is broken":"Rules are broken"} \u2014 see what, and what would fix it`,o=[...n.log.all()].slice(-5).reverse(),s=bt(t).map(S=>({kind:S,members:n.graph.nodesOfKind(S).filter(I=>He(n.schema.tryDefinition(S),I))})),c=s.filter(S=>S.members.length>0),m=s.map(S=>({entry:S,creator:n.allMutations().find(I=>(I.creates??[]).includes(S.kind)&&n.permits({name:I.name,args:{}},t.principal).ok)})).find(S=>S.creator!==void 0),f=c.length===0?"Nothing here yet.":`${c.map(S=>st(n.schema,S.kind,S.members.length)).join(", ").replace(/, ([^,]*)$/," and $1")}.`,g=t.views?.homeView?.(),w=n.schema.kinds.some(S=>n.graph.nodesOfKind(S).length>0);if(g&&w){let S=a?.subtitle?(0,E.jsx)("p",{style:{...x,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,I=g[Symbol.for("graview.home-blocks")]===!0;return(0,E.jsx)(j,{context:t,style:qe,children:(0,E.jsxs)("div",{style:{display:"grid",gap:12},"data-testid":"home-view",children:[I?null:S,r.length>0?(0,E.jsx)(T,{to:"/problems",style:{...F,color:"var(--graview-warn)"},children:l}):null,(0,E.jsx)(Ia.Provider,{value:I?S:null,children:(0,E.jsx)(g,{cardinality:"many",fidelity:"full",mode:"fullscreen",selected:!1})})]})})}let C=new Set(Le(n,t.principal)),A=Ie(n).relations.filter(S=>C.has(S.from)&&(S.to==="*"||C.has(S.to)));return(0,E.jsxs)(j,{context:t,style:qe,children:[(0,E.jsxs)("header",{style:{display:"grid",gap:12},children:[a?.subtitle?(0,E.jsx)("p",{style:{...x,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,(0,E.jsx)(Y,{context:t,"data-testid":"standing",children:f}),(0,E.jsxs)("p",{style:{..._,display:"grid",gap:4},"data-testid":"standing-card",children:[c.length===0&&m?(0,E.jsxs)("span",{children:["Begin with \u201C",m.creator?.title??m.creator?.name,"\u201D, under"," ",(0,E.jsx)(T,{to:`/${G(n.schema,m.entry.kind)}`,style:F,children:B(n,m.entry.kind)}),"."]}):null,r.length===0?(0,E.jsx)("span",{children:"All rules hold."}):(0,E.jsx)(T,{to:"/problems",style:{...F,color:"var(--graview-warn)"},children:l})]})]}),(0,E.jsx)(gn,{context:t}),(0,E.jsxs)("section",{style:{...U,display:"grid",gap:14},"data-testid":"kinds",children:[(0,E.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,E.jsx)("h2",{style:z,children:"What is here"}),A.length>0?(0,E.jsxs)(T,{to:"/map",style:{...F,...x,marginLeft:"auto"},"data-testid":"map-link",children:["Connections \xB7 ",A.length===1?"1 relation":`${A.length} relations`," \u2192"]}):null]}),(0,E.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"8px 10px"},children:s.map(({kind:S,members:I})=>(0,E.jsx)("li",{style:{maxWidth:"100%"},children:(0,E.jsxs)(T,{to:`/${G(n.schema,S)}`,style:{...se,flexWrap:"wrap",gap:8,padding:"6px 14px 6px 10px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)"},children:[(0,E.jsx)(ee,{kind:S,brand:a,schema:n.schema,size:7}),(0,E.jsx)("span",{style:{fontWeight:550,overflowWrap:"anywhere"},children:B(n,S)}),(0,E.jsx)("span",{style:{...x,fontVariantNumeric:"tabular-nums"},children:I.length===0?"none yet":_e(I.length)})]})},S))})]}),o.length>0?(0,E.jsxs)("section",{style:{...U,display:"grid",gap:10},children:[(0,E.jsx)("h2",{style:z,children:"Recently"}),(0,E.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:o.map(S=>(0,E.jsxs)("li",{style:x,children:[(0,E.jsx)("span",{style:{color:"var(--graview-ink)"},children:S.intent})," \u2014 ",Je(S,e,{graph:n.graph,schema:n.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}})]},S.id))})]}):null]})}var he=$(Se(),1);var R=$(H(),1);function hn({context:t}){let{store:e,brand:n,principal:a,invariantContext:i}=t;V(e);let[r]=Ve(),l=r.get("q")??"",o=typeof i?.today=="string"?i.today:void 0,d=ba(e,l,{...a?{principal:a}:{},places:me(t),flagged:new Set(e.violations(i).flatMap(g=>g.nodeIds)),...o?{today:o}:{},limit:200}),s=d.hits.filter(g=>g.about==="node"),c=d.hits.filter(g=>g.about==="kind"||g.about==="place"||g.about==="rule"),m=[...new Set(s.map(g=>g.kind))],f=l.trim();return(0,R.jsxs)(j,{context:t,children:[(0,R.jsx)("style",{children:wt}),(0,R.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,R.jsx)("p",{style:re,children:"Search"}),(0,R.jsx)(Y,{context:t,"data-testid":"search-heading",children:f.length===0?"Find anything by its name":d.hits.length===0?(0,R.jsxs)(R.Fragment,{children:["Nothing here is called \u201C",f,"\u201D."]}):(0,R.jsxs)(R.Fragment,{children:[_r(e,d.byKind)," for \u201C",f,"\u201D"]})}),f.length>0?(0,R.jsxs)("p",{style:{...x,margin:0},"data-testid":"search-searched",children:[ut(e.schema,d.searched),d.conditions.filter(g=>g.key!=="is"&&g.admittedBy.length<d.searched.kinds.length).map(g=>(0,R.jsxs)("span",{children:[" ",g.key,":",g.value," narrows"," ",g.admittedBy.length===0?"nothing here":g.admittedBy.map(w=>B(e,w).toLowerCase()).join(" and "),"."]},`${g.key}:${g.value}`))]}):(0,R.jsxs)("p",{style:_,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)(T,{to:`/${G(e.schema,g.kind)}`,style:F,children:[g.label,g.count>0?(0,R.jsxs)("span",{style:x,children:[" \xB7 ",g.count," match"]}):null]}):g.about==="place"?(0,R.jsxs)(T,{to:ye(t,g),style:F,children:["Go to ",g.title]}):g.about==="rule"?(0,R.jsxs)(T,{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,m.map(g=>(0,R.jsxs)("section",{className:"graview-list",style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",minWidth:0},"data-testid":"search-group","data-kind":g,children:[(0,R.jsxs)("h2",{className:"graview-group-head",style:{alignItems:"center"},children:[(0,R.jsx)(ee,{kind:g,brand:n,schema:e.schema,size:8}),(0,R.jsx)(T,{to:`/${G(e.schema,g)}?${new URLSearchParams({q:f}).toString()}`,style:F,"data-testid":"search-kind-link",children:B(e,g)}),(0,R.jsx)("span",{children:d.byKind[g]})]}),(0,R.jsx)("ul",{className:"graview-rows",children:s.filter(w=>w.kind===g).map(w=>(0,R.jsxs)("li",{"data-testid":"search-hit","data-about":"node",className:"graview-row",children:[(0,R.jsxs)(T,{to:q(e.schema,g,w.id),className:"graview-row-title",...w.label.length>60?{title:w.label}:{},children:[w.flagged?(0,R.jsx)("span",{style:{color:"var(--graview-warn)"},children:"\u26A0 "}):null,w.label]}),w.apart||!w.current?(0,R.jsx)("span",{className:"graview-row-glance",children:[w.apart,w.current?"":"past"].filter(Boolean).join(" \xB7 ")}):null,(0,R.jsx)(At,{why:w.why})]},w.id))})]},g)),f.length>0?(0,R.jsx)(Yr,{asked:f}):null,f.length>0&&d.hits.length===0?(0,R.jsx)(mr,{store:e,kinds:d.searched.kinds,words:d.words,...a?{principal:a}:{},...i?{invariantContext:i}:{}}):null]})}function At({why:t}){return t.strength==="near"?(0,R.jsxs)("span",{style:x,"data-testid":"search-why","data-near":"",children:["Near \u201C",t.asked,"\u201D",t.field==="label"?"":` \u2014 ${t.reading}: ${t.fragment}`]}):t.field==="label"?null:(0,R.jsxs)("span",{style:x,"data-testid":"search-why",children:[t.reading,": ",t.fragment]})}function _r(t,e){let n=Object.entries(e).map(([a,i])=>`${i} ${i===1?$e(t.schema.tryDefinition(a),a):B(t,a).toLowerCase()}`);return n.length===0?"Found":n.length===1?ce(n[0]):ce(`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`)}function ur(t,e,n={}){let a=[];for(let i of e){let r=Ee(t,i,{...n.principal?{principal:n.principal}:{},...n.invariantContext?{context:n.invariantContext}:{}});for(let l of Rt(t,i,r.actions.affordances))a.some(o=>o.mutation.name===l.mutation.name)||a.push(l)}return a}function Rt(t,e,n){let a=t.schema.tryDefinition(e)?.fieldRoles?.label,i=[];for(let r of n){let l=t.allMutations().find(s=>s.name===r.mutation);if(!l||!l.creates?.includes(e)||i.some(s=>s.mutation.name===l.name))continue;let o=ft(l.input).map(s=>s.name),d=o.includes("label")?"label":a&&o.includes(a)?a:void 0;!d||r.args[d]!==void 0||i.push({kind:e,affordance:r,mutation:l,arg:d})}return i}function mr({store:t,kinds:e,words:n,principal:a,invariantContext:i}){let r=ur(t,e,{...a?{principal:a}:{},...i?{invariantContext:i}:{}});return r.length===0||n.trim().length===0?null:(0,R.jsx)("div",{style:{display:"grid",gap:24},"data-testid":"search-to-create",children:r.map(({kind:l,affordance:o,mutation:d,arg:s})=>(0,R.jsxs)("section",{style:{...U,display:"grid",gap:14},children:[(0,R.jsxs)("h2",{style:z,children:[ce(Mn($e(t.schema.tryDefinition(l),l)))," called \u201C",n,"\u201D"]}),(0,R.jsx)(we,{store:t,mutation:d,prefilled:o.args,open:o.open,initial:{[s]:n},...a?{principal:a}:{}})]},`${o.id}|${n}`))})}function Yr({asked:t}){let e=pe();return e?(0,R.jsx)(Jr,{asked:t,talk:e.seatTalk}):null}function Jr({asked:t,talk:e}){let{drawn:n}=jn(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=$(H(),1),yr=8,hr=40;function Qr(t,e){let n=e?.fields?.shape??{},a=Object.keys(n).find(i=>Nn(n[i])&&On(t[i]));return a===void 0?void 0:t[a]}function vn({context:t}){let e=Te(),n=xe(t.store.schema,e.slug??"");return n?(0,h.jsx)(vr,{context:t,kind:n}):(0,h.jsx)(j,{context:t,children:(0,h.jsx)(Y,{context:t,children:"No such kind of thing here."})})}function vr({context:t,kind:e,opening:n,row:a,layout:i="list",description:r,bare:l}){let{store:o,brand:d,invariantContext:s}=t;V(o);let[c,m]=Ve(),f=o.schema.tryDefinition(e),g=Fn(c.get("archived")),w=o.graph.nodesOfKind(e,{archived:g}),C=Ie(o).relations.filter(p=>p.from===e||p.to===e),A=new Set(o.violations(s).flatMap(p=>p.nodeIds)),S=va(o.schema,ha(o.schema,e)),I=C.map(p=>p.edgeKind),ne=ni(c,S,I),Q=["sort","filter","group","q","by","with","past","archived",...I].some(p=>c.has(p)),le=w.length>=hr,ke=f?.fieldRoles?.when,W=Q?ne.arrangement:Jt(n??ti(le,ke),S).arrangement,ae=wa(W.query??""),be=[...W.filter??[],...ae.conditions].some(p=>p.key==="is"&&(p.value==="past"||p.value==="any"))||ya(f,[...W.filter??[],...ae.conditions]),et=be||!f?.lifecycle?W:{...W,filter:[...W.filter??[],{key:"is",value:"current"}]},Ce=xa(w,et,{schema:o.schema,graph:o.graph,flagged:A,...typeof s?.today=="string"?{today:s.today}:{}}),ie=Ce.nodes,Ae=f?.lifecycle&&!be?w.filter(p=>He(f,p)):w,u=w.length-Ae.length,L=W.group?.by??null,X=p=>{let v=new URLSearchParams(c);for(let de of["sort","filter","group","q","by","with","past","archived",...C.map(it=>it.edgeKind)])v.delete(de);let D=Sa(p);for(let de of["sort","filter","group","q","archived"])D[de]&&v.set(de,D[de]);![...v.keys()].some(de=>["sort","filter","group","q"].includes(de))&&(n||le||ke)&&v.set("sort",""),m(v)},{principal:M}=t,Mt=Ee(o,e,{...M?{principal:M}:{},...t.invariantContext?{context:t.invariantContext}:{}}),ze=Mt.actions.affordances.map(p=>({affordance:p,mutation:o.allMutations().find(v=>v.name===p.mutation)})).filter(p=>p.mutation!==void 0),Sn=Mt.actions.withheld,xn=ae.words&&ie.length===0?Object.fromEntries(Rt(o,e,Mt.actions.affordances).map(p=>[p.mutation.name,p.arg])):{},je=B(o,e),tt=t.views?.lookup(e,{cardinality:"one",fidelity:"glyph"}),Ot=tt!==void 0&&!Be(tt)?tt:void 0,Nt=(W.group?.bucket??"day")==="day"?W.group?.by:void 0,$t=(W.filter??[]).map(p=>p.key),Sr=$t.filter(p=>$t.indexOf(p)===$t.lastIndexOf(p)&&/choice|boolean/.test(S.filters.find(v=>v.key===p)?.type??"")),Ft=p=>{let v={...f?.computed?gt(o.schema,o.graph,p):p};Nt&&!String(v[Nt]).includes("T")&&delete v[Nt];for(let D of Sr)delete v[D];return v},Et=p=>{let v=Z(f,p);if(a)return(0,h.jsxs)("li",{"data-testid":"record-row",style:{minWidth:0},...Ht(p.id),children:[Kt(p,v),a(p,{label:v,href:q(o.schema,e,p.id),flagged:A.has(p.id),glance:kt(Ft(p),f,v)})]},p.id);if(Ot){let Gt=ht(tt,p,o.graph),Lr=Object.fromEntries(Object.entries(Ft(p)).filter(([Tr])=>!Gt?.fields.has(Tr))),Ln=Gt?kt(Lr,f,Gt.title??v):"";return(0,h.jsxs)("li",{"data-testid":"record-row",style:{position:"relative",display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:16,rowGap:2,paddingBlock:10,borderTop:"1px solid var(--graview-edge)"},...Ht(p.id),children:[Kt(p,v),(0,h.jsx)("div",{style:{flex:"1 1 14rem",minWidth:0},children:(0,h.jsx)(Ot,{node:p,cardinality:"one",fidelity:"glyph",mode:"fullscreen",selected:!1,...A.has(p.id)?{flagged:[p.id]}:{}})}),Ln?(0,h.jsx)("span",{style:{...x,flex:"0 1 auto",minWidth:0,overflowWrap:"anywhere"},"data-testid":"record-glance",children:Ln}):null,(0,h.jsx)(T,{to:q(o.schema,e,p.id),"aria-label":A.has(p.id)?`${v} \u2014 implicated in a problem`:v,style:{position:"absolute",inset:0,borderRadius:6}})]},p.id)}let D=kt(Ft(p),f,v),de=ae.words?ka(f,p,ae.words):void 0,it=le?void 0:ga(p,f),ot=Qr(p,f),Rn=(0,h.jsxs)(T,{to:q(o.schema,e,p.id),className:"graview-row-title",...v.length>60?{title:v}:{},children:[A.has(p.id)?(0,h.jsx)("span",{style:{color:"var(--graview-warn)"},children:"\u26A0 "}):null,v]});return(0,h.jsxs)("li",{className:"graview-row",...Ht(p.id),children:[Kt(p,v),it?(0,h.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:14,minWidth:0},children:[(0,h.jsx)(Fe,{as:"thumb",file:it}),Rn]}):Rn,D||ot?(0,h.jsxs)("span",{className:"graview-row-glance",children:[D,D&&ot?" \xB7 ":null,ot?(0,h.jsx)(mt,{address:ot}):null]}):null,de?(0,h.jsx)(At,{why:de}):null]},p.id)},It=me(t).filter(p=>p.kind===e),Pn=t.views?.arrangement?.()?.lists?.[e]?.filters,xr=(W.filter??[]).some(p=>p.key!=="is"||p.value!=="any"),Pr=!!(W.sort||W.group||W.query||xr),Cr=Ae.length>=yr||Q&&Pr,ve=W.sort?S.sorts.find(p=>p.key===W.sort.by):void 0,Wt=ve?.type==="date"||ve!==void 0&&ve.key===ke,Cn=le&&!Ce.grouped&&ve&&(ve.about==="label"||ve.type==="text"||Wt)?p=>{let v=ve.about==="label"?Z(f,p):p[ve.key];if(typeof v!="string"||v.length===0)return Wt?"No date":"#";if(Wt)return v.slice(0,4);let D=v.trim().charAt(0).toLocaleUpperCase();return/\p{L}/u.test(D)?D:"#"}:void 0,Ne=Cn?ie.reduce((p,v)=>{let D=Cn(v);return p.at(-1)?.key===D?p.at(-1).nodes.push(v):p.push({key:D,nodes:[v]}),p},[]):void 0,An=Ce.grouped&&L?Ce.groups.flatMap(p=>p.nodes):Ne&&Ne.length>1?Ne.flatMap(p=>p.nodes):ie,Dt=(0,he.useMemo)(()=>An.map(p=>p.id),[An.map(p=>p.id).join(`
108
- `)]),fe=Oa(Dt),Ue=(M?o.permittedMutations(M):o.permittedMutations()).some(p=>{let v=p.subject?.kinds;return v!==void 0&&(v==="*"||v.includes(e))}),Kt=(p,v)=>Ue?(0,h.jsx)("span",{className:"graview-choose-at",children:(0,h.jsx)("input",{...fe.boxProps(p.id,v),onPointerEnter:Zt,onFocus:Zt})}):null,Ht=p=>Ue?{"data-graview-choose":p}:{},Ar=(0,he.useCallback)(p=>{fe.choose(p),requestAnimationFrame(()=>{let v=fe.list.current;((p[0]===void 0?null:v?.querySelector(`[data-graview-choose-box="${CSS.escape(p[0])}"]`))??v)?.focus({preventScroll:!0})})},[fe]),nt=i==="grid"?{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 15rem), 1fr))",alignItems:"start",gap:12}:a||Ot?{margin:0,padding:0,listStyle:"none",display:"grid",gap:a&&i==="list"?6:0}:void 0,Bt=nt?void 0:"graview-rows",at=p=>`list-at-${p.replace(/[^\p{L}\p{N}]/gu,"_")}`,rt=C.map(p=>{let v=p.from===e?p.to:p.from,D=p.from===e?p.description:p.inverse??p.description;return{relation:p,far:v,words:D}}),Rr=new Set(rt.map(p=>(p.words??"").toLowerCase()).filter((p,v,D)=>p&&D.indexOf(p)!==v));return(0,h.jsxs)(l?ei:j,{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:d,schema:o.schema,size:8}),(0,h.jsx)(Y,{context:t,children:je})]}),r??f?.description?(0,h.jsx)("p",{style:_,children:r??f?.description}):null,rt.length>0||It.length>0?(0,h.jsxs)("p",{style:{...x,margin:0,display:"flex",flexWrap:"wrap",columnGap:18,rowGap:2},"data-testid":"kind-related",children:[rt.length>0?(0,h.jsxs)("span",{"data-testid":"kind-relations",children:["Related:"," ",rt.map(({relation:p,far:v,words:D},de)=>(0,h.jsxs)("span",{"data-relation":p.edgeKind,children:[de>0?" \xB7 ":null,v==="*"?ce(D??oe(p.edgeKind)):(0,h.jsx)(T,{to:`/${G(o.schema,v)}`,style:F,title:B(o,v),children:D&&Rr.has(D.toLowerCase())?`${ce(D)}: ${B(o,v).toLowerCase()}`:ce(D??B(o,v))})]},`${p.edgeKind}|${p.from}|${p.to}`))]}):null,It.length>0?(0,h.jsxs)("span",{"data-testid":"kind-pictures",children:["Also as:"," ",It.map((p,v)=>(0,h.jsxs)("span",{children:[v>0?" \xB7 ":null,(0,h.jsx)(T,{to:ye(t,p),style:F,children:p.title})]},We(p)))]}):null]}):null]}),ne.dropped.length>0?(0,h.jsxs)("p",{style:{...x,margin:0},"data-testid":"list-dropped",children:["This link asked for ",ne.dropped.join(", "),", which ",je.toLowerCase()," cannot be arranged by; the rest is shown."]}):null,Ae.length>0?(0,h.jsx)(La,{schema:o.schema,graph:o.graph,kind:e,arrangement:W,onChange:X,kept:{shown:ie.length,of:Ae.length},noun:{one:$e(f,e),many:je.toLowerCase()},...Cr?{}:{allow:!1},...Pn?{filters:Pn}:{},offers:S,chips:{nodes:Ae,flagged:A,...typeof s?.today=="string"?{today:s.today}:{}},query:t.framed===!0&&t.barAbove!==!0}):null,(0,h.jsx)("style",{children:wt}),Ue?(0,h.jsx)("style",{children:Na+Zr}):null,(0,h.jsx)("div",{className:"graview-list",...Ue?{...fe.listProps,ref:fe.list,tabIndex:-1,"data-graview-choosable":"","aria-label":fe.chosen.length>0?`${je}, ${fe.chosen.length} chosen`:je,role:"group"}:{},children:ie.length===0&&ae.words?(0,h.jsxs)("p",{style:_,"data-testid":"none-yet",children:["Nothing here is called \u201C",ae.words,"\u201D."," ",(0,h.jsx)("span",{style:x,"data-testid":"list-searched",children:ut(o.schema,{kinds:[e],past:be})})," ",(0,h.jsx)(T,{to:"?",style:F,children:"Show every one"})]}):ie.length===0?(0,h.jsxs)("p",{style:_,"data-testid":"none-yet",children:[W.filter?.length||W.query?"None of them.":"None yet",!W.filter?.length&&!W.query&&ze.length>0?` \u2014 the first one starts below, with \u201C${ze[0]?.mutation.title??ze[0]?.mutation.name}\u201D.`:!W.filter?.length&&!W.query?".":"",W.filter?.length||W.query?(0,h.jsxs)(h.Fragment,{children:[" ",(0,h.jsx)(T,{to:"?",style:F,children:"Show every one"})]}):null]}):Ce.grouped&&L?(0,h.jsx)("div",{style:{display:"grid",gap:"1rem"},"data-testid":"records","data-grouped":L,children:Ce.groups.map(p=>(0,h.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group",children:[(0,h.jsxs)("h2",{className:"graview-group-head",children:[p.label," ",(0,h.jsx)("span",{children:p.nodes.length})]}),(0,h.jsx)("ul",{style:nt,className:Bt,"data-graview-rows":"",children:p.nodes.map(Et)})]},p.key||"-"))}):Ne&&Ne.length>1?(0,h.jsxs)("div",{style:{display:"grid",gap:14},"data-testid":"records","data-sectioned":ve?.type==="date"?"year":"letter",children:[(0,h.jsx)("nav",{"aria-label":"Jump to","data-testid":"list-index",style:{...x,display:"flex",flexWrap:"wrap",gap:ve?.type==="date"?"0 10px":"0 4px",lineHeight:1.3},children:Ne.map(p=>(0,h.jsx)("a",{href:`#${at(p.key)}`,onClick:v=>{v.preventDefault(),document.getElementById(at(p.key))?.scrollIntoView({block:"start"})},style:{...se,minWidth:24,justifyContent:"center"},children:p.key},p.key))}),Ne.map(p=>(0,h.jsxs)("section",{"data-testid":"list-section","aria-labelledby":at(p.key),style:{display:"grid",gap:0},children:[(0,h.jsx)("h2",{id:at(p.key),className:"graview-group-head",children:p.key}),(0,h.jsx)("ul",{style:nt,className:Bt,"data-graview-rows":"",children:p.nodes.map(Et)})]},p.key))]}):(0,h.jsx)("ul",{style:nt,className:Bt,"data-testid":"records","data-graview-rows":"",children:ie.map(Et)})}),Ue?(0,h.jsx)($a,{store:o,chosen:fe.chosen,...M?{principal:M}:{},...s?{context:s}:{},anchor:Xr,of:Dt.length,onChooseAll:()=>fe.choose(Dt),onClear:fe.clear,onActed:Ar}):null,u>0?(0,h.jsxs)(T,{to:fr(c,"filter","is:any"),style:{...F,...x,justifySelf:"start"},"data-testid":"past-link",children:["+",u," past"]}):null,g===!1&&o.graph.count(e,{archived:!0})>0?(0,h.jsxs)(T,{to:fr(c,"archived","true"),style:{...F,...x,justifySelf:"start"},"data-testid":"archived-link",children:["+",o.graph.count(e,{archived:!0})," archived"]}):null,ze.length>0?(0,h.jsx)("div",{style:{display:"grid",gap:6},"data-testid":"beginnings",children:ze.map(({affordance:p,mutation:v})=>{let D=!!(xn[v.name]&&ie.length===0);return(0,h.jsx)(ai,{name:v.name,title:v.title??v.name,description:v.description,open:ie.length===0,children:(0,h.jsx)(we,{store:o,mutation:v,prefilled:p.args,open:p.open,...D?{initial:{[xn[v.name]]:ae.words}}:{},...t.principal?{principal:t.principal}:{}},D?`${v.name}|${ae.words}`:v.name)},p.id)})}):null]}),Sn.length>0?(0,h.jsx)("ul",{style:{...U,margin:0,padding:0,listStyle:"none",display:"grid",gap:4},"data-testid":"withheld",children:Sn.map(p=>(0,h.jsxs)("li",{style:x,children:[(0,h.jsx)("s",{children:p.label})," \u2014 ",p.refusal.message]},p.id))}):null]})}var Xr=()=>document.querySelector("[data-graview-choosable]")?.closest("[data-embed-content]")??null,Zr=`
109
- .graview-list[data-graview-choosable]{outline:none}
110
- .graview-list [data-graview-choose]{position:relative;padding-left:34px}
111
- .graview-choose-at{position:absolute;left:2px;top:0;bottom:0;z-index:${Wn.raised};display:flex;align-items:center}
112
- @media (pointer: coarse){
113
- .graview-list:not([data-graview-choosing]) [data-graview-choose]{padding-left:0}
114
- .graview-list:not([data-graview-choosing]) .graview-choose-at{display:none}
115
- }
116
- `;function ei({children:t}){return(0,h.jsx)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40,minWidth:0},children:t})}var ti=(t,e)=>e?{sort:{by:e,direction:"desc"}}:t?{sort:{by:"label",direction:"asc"}}:{};function ni(t,e,n){let a=Bn({...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")}:{},...t.get("archived")?{archived:t.get("archived")}:{}}),i=[...a.filter??[]],r=t.get("by"),l=a.group??(r?{by:r}:void 0);for(let d of n){let s=t.get(d);s&&i.push({key:d,value:s})}let o=t.get("with");return o&&i.push({key:o,value:"*"}),t.get("past")==="1"&&!i.some(d=>d.key==="is")&&i.push({key:"is",value:"any"}),Jt({...a.sort?{sort:a.sort}:{},...a.query?{query:a.query}:{},...i.length>0?{filter:i}:{},...l?{group:l}:{},...a.archived!==void 0?{archived:a.archived}:{}},e)}function fr(t,e,n){let a=new URLSearchParams(t);return a.set(e,n),a.delete("past"),`?${a.toString()}`}function ai({name:t,title:e,description:n,open:a,children:i}){let[r,l]=(0,he.useState)(a),o=(0,he.useRef)(null),d=(0,he.useRef)(null),s=`begin-${(0,he.useId)().replace(/:/g,"")}`;return(0,h.jsxs)("div",{"data-testid":`act-${t}`,style:{display:"grid",gap:10},children:[(0,h.jsxs)("button",{ref:o,type:"button","data-testid":`act-open-${t}`,"aria-expanded":r,"aria-controls":s,onClick:()=>{l(!r),r||requestAnimationFrame(()=>d.current?.querySelector("input, select, textarea, button")?.focus())},style:{...se,justifySelf:"start",minHeight:32,padding:"0 2px",border:0,background:"none",font:"inherit",fontWeight:600,color:"var(--graview-ink)",cursor:"pointer"},children:[(0,h.jsx)("span",{"aria-hidden":"true",style:{marginRight:6},children:r?"\u2212":"+"}),e]}),(0,h.jsxs)("div",{ref:d,id:s,hidden:!r,onKeyDown:c=>{c.key==="Escape"&&(c.preventDefault(),l(!1),o.current?.focus())},style:r?{display:"grid",gap:12,padding:"4px 0 12px"}:void 0,children:[n?(0,h.jsx)("p",{style:{...x,margin:0,maxWidth:"58ch"},children:n}):null,i]})]})}var Ze=$(Se(),1);var Xe=$(Se(),1);var N=$(H(),1);function wn({context:t}){let{store:e,brand:n,invariantContext:a,principal:i}=t;V(e);let r=e.violations(a),l=e.allInvariants(),o=pt(e,r),d=ea(e.schema,l);return(0,N.jsxs)(j,{context:t,children:[(0,N.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,N.jsx)(Y,{context:t,children:r.length===0?"All rules hold":"What is broken"}),(0,N.jsx)("p",{style:_,"data-testid":"problems-count",children:r.length===0?"Every declared rule is satisfied by what is here.":En(r)})]}),(0,N.jsx)(gr,{context:t}),o.map((s,c)=>{let m=s.nodeIds[0],f=m?e.graph.getNode(m):void 0;return(0,N.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:[s.line?null:(0,N.jsx)(Lt,{violation:s,schema:e.schema,...n?{brand:n}:{}}),f?(0,N.jsxs)("p",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[(0,N.jsx)(ee,{kind:f.kind,brand:n,schema:e.schema,size:7}),(0,N.jsx)(T,{to:q(e.schema,f.kind,f.id),style:F,children:Z(e.schema.tryDefinition(f.kind),f)})]}):null,s.line?(0,N.jsx)(Lt,{violation:s,schema:e.schema,...n?{brand:n}:{}}):null,(0,N.jsx)(Tt,{store:e,repairs:s.repairs,...i?{principal:i}:{}})]},c)}),l.length>0?(0,N.jsxs)("section",{style:{...U,display:"grid",gap:12},"data-testid":"rules",children:[(0,N.jsx)("h2",{style:z,children:"The rules"}),(0,N.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:l.map(s=>{let c=r.filter(g=>g.invariant===s.name).length,m=d.get(s.name),f=s.label??s.name;return(0,N.jsxs)("li",{"data-graview-rule":s.name,style:{display:"grid",gap:2},children:[(0,N.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:12,rowGap:2},children:[m?(0,N.jsx)(jt,{line:m,schema:e.schema,...n?{brand:n}:{},style:{flex:"1 1 18rem"}}):(0,N.jsx)("span",{style:{flex:"1 1 18rem",fontWeight:550},children:f}),(0,N.jsx)("span",{style:{...x,color:c>0?"var(--graview-warn)":"var(--graview-ink-faint)"},children:c===0?"holds":`broken in ${c} ${c===1?"place":"places"}`})]}),m&&f.trim().length>0?(0,N.jsx)("span",{style:x,children:f}):null]},s.name)})})]}):null]})}function Lt({violation:t,schema:e,brand:n}){if(!t.line)return(0,N.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},children:t.message});let a=na(t);return(0,N.jsxs)("div",{style:{display:"grid",gap:2},"data-testid":"problem-line",title:ta(t),children:[(0,N.jsx)(jt,{line:t.line,schema:e,...n?{brand:n}:{},lead:"none",style:{color:"var(--graview-warn)"}}),a?(0,N.jsx)("span",{style:x,children:a}):null]})}function Tt({store:t,repairs:e,principal:n}){let[a,i]=(0,Xe.useState)(null),[r,l]=(0,Xe.useState)(null),o=(0,Xe.useRef)([]);if(e.length===0)return null;let d=a===null?null:e[a],s=d&&(d.missing??[]).length>0?t.allMutations().find(c=>c.name===d.mutation):void 0;return(0,N.jsxs)("div",{style:{display:"grid",gap:10},"data-testid":"repairs",children:[(0,N.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:e.map((c,m)=>{let f=(c.missing??[]).length>0,g=t.permits({name:c.mutation,args:{...c.args}},n);return g.ok?(0,N.jsx)("button",{ref:w=>{o.current[m]=w},type:"button","data-graview-repair":c.mutation,"data-graview-asks":f||void 0,"aria-expanded":f?a===m:void 0,onClick:()=>{if(l(null),f){i(a===m?null:m);return}i(null);try{t.apply({name:c.mutation,args:{...c.args}},n?{author:n}:{})}catch(w){l(Ge(t.schema,t.allMutations(),w))}},style:Re,children:f?`${c.label} \u2026`:c.label},m):(0,N.jsxs)("p",{"data-testid":"withheld","data-withheld":g.refusal.wouldNeed.join(",")||"nobody",style:{...x,margin:0},children:[(0,N.jsx)("s",{children:c.label})," \u2014 ",g.refusal.message]},m)})}),s&&d?(0,N.jsx)(we,{store:t,mutation:s,prefilled:{...d.args},only:d.missing??[],label:d.label,onDone:()=>{let c=a;i(null),requestAnimationFrame(()=>{let m=c===null?null:o.current[c];if(m?.isConnected){m.focus();return}let f=document.querySelector("[data-graview-page-title]")??document.querySelector("main h1, main h2");f&&(f.hasAttribute("tabindex")||(f.tabIndex=-1),f.focus())})},...n?{principal:n}:{}}):null,d&&!s&&(d.missing??[]).length>0?(0,N.jsxs)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:en},children:["\u201C",d.label,"\u201D names ",d.mutation,", which this app does not declare."]}):null,r?(0,N.jsx)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:en},children:r}):null]})}var kn=$(Se(),1);var Oe=$(H(),1);function wr({store:t,link:e,principal:n}){let[a,i]=(0,kn.useState)(!1),[r,l]=(0,kn.useState)(null),o=da(e);return(0,Oe.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[(0,Oe.jsx)("button",{type:"button","data-graview-provisional":"",title:o,"aria-label":`Unsure link: ${o}`,"aria-expanded":a,onClick:()=>i(!a),style:{border:"1px dashed var(--graview-ink-muted)",borderRadius:999,background:"transparent",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"0.75rem",lineHeight:1,padding:"2px 6px",cursor:"pointer"},children:"unsure"}),a?(0,Oe.jsxs)("span",{style:{...x,display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,Oe.jsx)("span",{children:o}),(0,Oe.jsx)("button",{type:"button",style:{...Re,padding:"4px 10px"},onClick:()=>{try{t.apply({name:In,args:{kind:e.edge.kind,from:e.edge.from,to:e.edge.to}},n?{author:n}:{}),i(!1)}catch(d){l(Ge(t.schema,t.allMutations(),d))}},children:"Keep this link"}),r?(0,Oe.jsx)("span",{role:"alert",children:r}):null]}):null]})}var y=$(H(),1),ri=[];function bn({context:t}){let{store:e,brand:n,principal:a,invariantContext:i}=t;V(e);let r=pe()!==null,l=Te(),o=decodeURIComponent(l.id??""),d=Xa(e,o,{...a?{principal:a}:{},...i?{context:i}:{}}),s=pt(e,d?.violations??ri),[c,m]=(0,Ze.useState)(null),[f,g]=(0,Ze.useState)(!1),w=(0,Ze.useRef)(null);if(!d)return(0,y.jsx)(j,{context:t,children:(0,y.jsx)(Y,{context:t,children:"Nothing lives at this address."})});let C=e.graph.getNode(o),A=e.schema.tryDefinition(d.kind),S=A?.describe&&C?aa(A,C):null,I=[...e.log.all()].filter(u=>!dt(u)&&(u.writes.includes(o)||u.reads.includes(o))).slice(-8).reverse(),ne=e.log.all().find(u=>!dt(u)&&u.undoes===void 0&&u.primitives.some(L=>L.op==="add-node"&&L.node.id===o)),Q=d.actions.affordances.filter(u=>u.provider!=="invariant"),le=Q.filter(u=>u.destructive||u.setsAside),ke=f||le.length<2?Q:Q.filter(u=>!le.includes(u)),W=t.views?.lookup(d.kind,{cardinality:"one",fidelity:"full"}),ae=W!==void 0&&!Be(W)?W:void 0,be=ae&&C?ht(W,C,e.graph):void 0,et=be?d.fields.filter(u=>!be.fields.has(u.key)):d.fields,Ce=be?d.links.flatMap(u=>{let L=u.targets.filter(X=>!be.records.has(X.id));return L.length>0?[{...u,targets:L}]:[]}):d.links,ie=ae!==void 0&&Qn(W),Ae=r&&ca(A).length>0;return(0,y.jsxs)(j,{context:t,children:[(0,y.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,y.jsxs)("p",{style:{...re,display:"flex",alignItems:"center",gap:8},children:[(0,y.jsx)(ee,{kind:d.kind,brand:n,schema:e.schema,size:8}),(0,y.jsx)(T,{to:`/${G(e.schema,d.kind)}`,style:se,children:B(e,d.kind)})]}),(0,y.jsx)(Y,{context:t,children:r&&C?.label===d.label?(0,y.jsx)(Qt,{nodeId:o,field:"label",value:d.label}):d.label}),S&&S!==d.label?(0,y.jsx)("p",{style:_,children:S}):null,ne?.lineage?(0,y.jsxs)("p",{style:{...x,margin:0},"data-testid":"record-lineage",children:["Made by ",Je(ne,a,{graph:e.graph,schema:e.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}}),", ",_t(ne.lineage)]}):null,(0,y.jsx)(vt,{context:t,stop:`#focus=${encodeURIComponent(o)}`,style:{...F,...x},"data-testid":"spatial-link"}),me(t).some(u=>u.kind===d.kind||u.across===d.kind)?(0,y.jsxs)("p",{style:{...x,margin:0},"data-testid":"seen-in",children:["Seen in:"," ",me(t).filter(u=>u.kind===d.kind||u.across===d.kind).map((u,L)=>(0,y.jsxs)("span",{children:[L>0?" \xB7 ":null,(0,y.jsx)(T,{to:ye(t,u),style:F,children:u.title})," ",(0,y.jsx)(vt,{context:t,stop:`#view=${encodeURIComponent(u.as)}`,style:{...F,...x,display:"inline-block",minWidth:24,textAlign:"center"},title:`${u.title}, in the scene`,children:"\u2197"})]},We(u)))]}):null]}),C&&$n(C)?(0,y.jsx)(ii,{context:t,id:o,kind:d.kind}):null,ae&&C?(0,y.jsx)("section",{"data-testid":"record-view",style:{display:"grid",minWidth:0},children:(0,y.jsx)(Fa,{children:(0,y.jsx)(ae,{node:C,cardinality:"one",fidelity:"full",mode:"fullscreen",selected:!1,...d.violations.length>0?{flagged:[o]}:{}})})}):null,d.violations.length>0?(0,y.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:s.map((u,L)=>(0,y.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,y.jsx)(Lt,{violation:u,schema:e.schema,...n?{brand:n}:{}}),(0,y.jsx)(Tt,{store:e,repairs:Za(d.actions,u.repairs),...a?{principal:a}:{}})]},L))}):null,!ie&&(et.length>0||Ae)?(0,y.jsxs)("section",{style:{...U,display:"grid",gap:14},"data-testid":"record-fields",children:[(0,y.jsx)("h2",{style:z,children:"The facts"}),ia(A,et).map((u,L)=>{let X=(0,y.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"14px 24px"},children:u.fields.map(M=>M.files?(0,y.jsx)(Fe,{as:"field",read:!r,nodeId:o,field:M.key,label:M.label,files:M.files,labelStyle:re,style:{gap:4}},M.key):M.long?(0,y.jsx)(Ra,{nodeId:o,field:M.key,label:M.label,value:M.value,markdown:M.markdown,style:{gridColumn:"1 / -1",gap:4},labelStyle:re,valueStyle:{lineHeight:1.6}},M.key):(0,y.jsxs)("div",{style:{display:"grid",gap:2,minWidth:0,alignContent:"start"},children:[(0,y.jsx)("dt",{style:re,children:M.label}),(0,y.jsx)("dd",{style:{margin:0,overflowWrap:"anywhere",minWidth:0},children:M.app?(0,y.jsx)(mt,{address:M.app,as:"record",...r?{nodeId:o,field:M.key}:{}}):M.href?(0,y.jsx)(Aa,{href:M.href,field:M.key,value:M.value,stored:M.stored,...r?{nodeId:o}:{}}):r?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Qt,{nodeId:o,field:M.key,value:M.value,stored:M.stored}),M.repeats?(0,y.jsx)(Ca,{nodeId:o,field:M.key,start:C?.[M.key],value:C?.[`${M.key}Repeat`],label:`${M.label} repeats`}):null]}):M.value})]},M.key))});return u.title?(0,y.jsxs)("section",{style:{display:"grid",gap:10,minWidth:0},children:[(0,y.jsx)("h3",{"data-graview-field-group":u.title,style:{...z,fontSize:"inherit"},children:u.title}),X]},L):(0,y.jsx)("div",{children:X},L)}),Ae?(0,y.jsx)(Fe,{as:"unfilled",nodeId:o,skip:[...be?.fields??[]],labelStyle:re,style:{gap:4}}):null]}):null,(ie?[]:Ce).map(u=>(0,y.jsxs)("section",{style:{...U,display:"grid",gap:10},children:[(0,y.jsx)("p",{style:re,children:Va(e,u)}),u.description?(0,y.jsx)("h2",{style:z,children:ce(u.description)}):(0,y.jsxs)("h2",{style:z,"aria-label":oe(u.edgeKind),children:[u.direction==="in"?"\u2190 ":"\u2192 ",oe(u.edgeKind)]}),(0,y.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},children:u.targets.map(L=>{let X=pa(e,u.direction==="in"?{kind:u.edgeKind,from:L.id,to:o}:{kind:u.edgeKind,from:o,to:L.id});return(0,y.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,y.jsx)(ee,{kind:L.kind,brand:n,schema:e.schema,size:7}),(0,y.jsxs)(T,{to:q(e.schema,L.kind,L.id),style:F,children:[L.label,L.apart?(0,y.jsxs)("span",{style:x,children:[" \xB7 ",L.apart]}):null]}),X?.provisional?(0,y.jsx)(wr,{store:e,link:X,...a?{principal:a}:{}}):null]},L.id)})}),(u.direction==="out"&&e.schema.edge(u.edgeKind)?.cardinality==="one"?[]:[...new Set(u.targets.map(L=>L.kind))]).map(L=>(0,y.jsxs)(T,{to:`/${G(e.schema,L)}?${encodeURIComponent(u.edgeKind)}=${encodeURIComponent(o)}`,style:{...F,...x},"data-testid":"related-all",children:["Sort and filter ",u.description??`these ${B(e,L).toLowerCase()}`,u.targets.some(X=>X.kind!==L)?` (${B(e,L).toLowerCase()})`:""," \u2192"]},L))]},`${u.edgeKind}|${u.direction}|${u.description??""}`)),!ie&&(Q.length>0||d.actions.withheld.length>0)?(0,y.jsxs)("section",{style:{...U,display:"grid",gap:14},"data-testid":"record-actions",children:[(0,y.jsx)("h2",{style:z,ref:w,tabIndex:-1,children:"What can be done"}),(0,y.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[ke.map(u=>{let L=c===u.id;return(0,y.jsx)("button",{type:"button","data-affordance":u.id,"data-rank":u.rank,autoFocus:f&&u===le[0],"aria-expanded":L,onClick:()=>m(L?null:u.id),style:{...Re,...L?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},children:u.label},u.id)}),ke.length<Q.length?(0,y.jsxs)("button",{type:"button","aria-expanded":!1,onClick:()=>g(!0),style:{...Re,...x},"data-testid":"record-actions-more",children:["Show ",Q.length-ke.length," more"]}):null]}),Q.map(u=>{if(c!==u.id)return null;let L=e.allMutations().find(X=>X.name===u.mutation);return L?(0,y.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,y.jsx)("h3",{style:z,children:u.label}),L.description?(0,y.jsx)("p",{style:{...x,margin:0},children:L.description}):null,(0,y.jsx)(we,{store:e,mutation:L,prefilled:u.args,open:u.open,label:u.label,onDone:()=>{m(null);let X=u.id;requestAnimationFrame(()=>{(w.current?.parentElement?.querySelector(`[data-affordance="${X.replace(/["\\]/g,"\\$&")}"]`)??w.current)?.focus()})},...a?{principal:a}:{}})]},u.id):null}),d.actions.withheld.length>0?(0,y.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:d.actions.withheld.map(u=>(0,y.jsxs)("li",{style:x,children:[(0,y.jsx)("s",{children:u.label})," \u2014 ",u.refusal.message]},u.id))}):null]}):null,I.length>0?(0,y.jsxs)("section",{style:{...U,display:"grid",gap:10},"data-testid":"record-history",children:[(0,y.jsx)("h2",{style:z,children:"What has happened"}),(0,y.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:I.map(u=>(0,y.jsxs)("li",{style:x,children:[(0,y.jsx)("span",{style:{color:"var(--graview-ink)"},children:u.intent}),u.lineage?(0,y.jsxs)("span",{"data-graview-lineage":"",children:[" \xB7 ",_t(u.lineage)]}):null," \u2014 ",Je(u,a,{graph:e.graph,schema:e.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}})]},u.id))})]}):null]})}function ii({context:t,id:e,kind:n}){let{store:a,principal:i}=t,r={name:`unarchive-${n}`,args:{id:e}},l=a.allMutations().some(s=>s.name===r.name)&&a.permits(r,i).ok,o=[...a.log.all()].reverse().find(s=>!dt(s)&&s.mergedInto!==void 0&&s.writes.includes(e)),d=o?.mergedInto!==void 0?a.graph.getNode(o.mergedInto):void 0;return(0,y.jsxs)("section",{"data-testid":"record-archived",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,padding:"12px 16px",border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,y.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,y.jsx)("strong",{children:"Archived."})," Kept with its ties and history, and out of lists, counts and rules.",d?(0,y.jsxs)(y.Fragment,{children:[" ","Merged into ",(0,y.jsx)(T,{to:q(a.schema,d.kind,d.id),style:F,children:Z(a.schema.tryDefinition(d.kind),d)}),"."]}):null]}),l?(0,y.jsx)("button",{type:"button",style:Re,"data-testid":"bring-it-back",onClick:()=>a.apply(r,i?{author:i}:{}),children:"Bring it back"}):null]})}var b=$(H(),1),oi=(0,K.lazy)(()=>import("./chunk.UWNYT7PF.js").then(t=>({default:t.DraftPage})));function si({list:t,store:e}){let n=new Set(t.members.map(l=>l.kind)),a=t.total-t.members.length,i=n.size===1?[...n][0]:void 0;if(!i)return(0,b.jsx)("p",{className:"graview-spec-text graview-spec-more",children:`and ${a} more`});let r=lt(e.schema,i).toLowerCase();return(0,b.jsx)("p",{className:"graview-spec-text graview-spec-more",children:(0,b.jsx)(T,{to:`/${G(e.schema,i)}`,className:"graview-spec-link graview-spec-see-all","data-testid":"see-all",children:t.total===e.graph.nodesOfKind(i).length?`See all ${_e(t.total)} ${r}`:`${_e(a)} more \xB7 all ${r}`})})}function li({context:t,children:e}){let n=Pe(),a=t.store.schema,i=(0,K.useMemo)(()=>({href:r=>q(a,r.kind,r.id),go:r=>n(q(a,r.kind,r.id)),more:r=>(0,b.jsx)(si,{list:r,store:t.store})}),[a,n,t.store]);return(0,b.jsx)(yt.Provider,{value:i,children:(0,b.jsx)(Ea.Provider,{value:(t.titleLevel??(t.framed&&!t.barAbove?1:2))-1,children:e})})}function di({steering:t}){let e=ge(),n=Pe(),a=`${e.pathname}${e.search}`;return(0,K.useLayoutEffect)(()=>t.at(a),[a,t]),(0,K.useLayoutEffect)(()=>{let i=l=>{l!==a&&n(l)};t.go.current=i;let r=t.pending?.current;return r!==void 0&&(t.pending.current=void 0,i(r)),()=>{t.go.current===i&&(t.go.current=void 0)}},[a,n,t]),null}function pi({context:t,to:e}){let{pathname:n}=ge(),a=pe(),i=(e??a)?.sayWhere,r=ci(t,n);return(0,K.useEffect)(()=>(i?.(r),()=>i?.(null)),[i,r]),null}function ci(t,e){let[n="",a,i]=e.split("/").filter(Boolean).map(l=>{try{return decodeURIComponent(l)}catch{return l}});if(i!==void 0)return"#";if(n==="places"&&a!==void 0){if(a===zt)return"#overview=1";let l=t.views?.places().find(o=>o.as===a);return l?`#focus=${encodeURIComponent(Ye(l.kind))}&view=${encodeURIComponent(l.as)}`:"#"}let r=xe(t.store.schema,n);return r?`#focus=${encodeURIComponent(a??Ye(r))}`:"#"}function gi({onNavigate:t,path:e}){let n=ge(),a=nn(),i=Pe(),r=`${n.pathname}${n.search}`,l=(0,K.useRef)(t);l.current=t;let o=(0,K.useRef)(null);(0,K.useEffect)(()=>{let s=o.current;o.current=r,s!==null&&(r===s&&a!=="PUSH"||l.current?.(r,a==="POP"?"pop":a==="REPLACE"?"replace":"push"))},[n.key]);let d=(0,K.useRef)(e);return(0,K.useEffect)(()=>{e===void 0||e===d.current||(d.current=e,e!==r&&i(e))},[e]),null}function kr({context:t,registry:e,page:n}){let a=Te(),i=xe(t.store.schema,a.slug??""),r=n==="list"?vn:bn,o=(i?e?.lookup(i,n):void 0)??r;return(0,b.jsx)(o,{context:t})}function ui({context:t,registry:e,children:n}){let a=(0,K.useRef)(null);return Xn(a),(0,b.jsx)("div",{ref:a,"data-graview-face":"pages",style:{display:"contents"},children:(0,b.jsx)(dr,{context:t,registry:e,root:a,children:n})})}function mi(){let{pathname:t}=ge(),e=nn(),n=(0,K.useRef)(null);(0,K.useLayoutEffect)(()=>{if(e!=="POP"){for(let r=n.current?.parentElement;r;r=r.parentElement){let{overflowY:l}=getComputedStyle(r);if((l==="auto"||l==="scroll")&&r.scrollHeight>r.clientHeight){r.scrollTop=0;return}}window.scrollTo(0,0)}},[t]);let a=(0,K.useRef)(t),i=(0,K.useRef)(!1);return(0,K.useEffect)(()=>{if(!i.current&&t===a.current)return;i.current=!0;let r=document.activeElement;if(r!==null&&r!==document.body&&r!==document.documentElement)return;let l=n.current?.closest("main")??document.querySelector("main"),d=n.current?.closest("[data-graview-face]")?.querySelector("[data-graview-page-title]")??l?.querySelector("h1, h2")??null??l??null;d&&(d.hasAttribute("tabindex")||d.setAttribute("tabindex","-1"),d.focus({preventScroll:!0}))},[t]),(0,b.jsx)("span",{ref:n,hidden:!0,"data-graview-scroll-reset":""})}function fi({context:t,children:e}){let n=Pe(),a=(0,K.useMemo)(()=>({record:i=>{let r=t.store.graph.getNode(i);r&&n(q(t.store.schema,r.kind,i))},place:i=>{let r=t.views?.places().find(l=>l.as===i);r&&n(ye(t,r))}}),[t,n]);return(0,b.jsx)(Jn.Provider,{value:a,children:e})}function yi({context:t,Home:e}){let i=ge().key==="default"?qn(t.views?.arrangement?.()?.first,t.store.schema,t.views?.places()??[]):void 0,r=i?.to==="place"?ye(t,i.place):i?.to==="kind"?`/${G(t.store.schema,i.kind)}`:void 0;return r?(0,b.jsx)(an,{to:r,replace:!0}):(0,b.jsx)(e,{context:t})}function br({context:t,registry:e}){let n=e?.lookupSurface("shell"),a=n!==void 0,i=a&&(e?.without().has("bar")??!1),r=a&&!i&&!t.embedded?{...t,barAbove:!0}:t,l=w=>n===void 0?(0,b.jsx)(St,{context:t,children:w}):i?(0,b.jsx)(n,{context:t,children:w}):(0,b.jsx)(St,{context:t,children:(0,b.jsx)(n,{context:r,children:w})}),o=e?.lookupSurface("home")??yn,d=e?.lookupSurface("problems")??wn,s=a?{...r,framed:!0}:t,[c,m]=(0,K.useState)(null),f=(0,K.useMemo)(()=>({onFind:m,find:!(e?.without().has("find")??!1),places:!(e?.without().has("places")??!1)}),[e]),g=(0,b.jsx)(ui,{context:t,registry:e,children:(0,b.jsx)(fi,{context:t,children:l((0,b.jsx)(b.Fragment,{children:(0,b.jsxs)(li,{context:s,children:[(0,b.jsx)(mi,{}),(0,b.jsxs)(_a,{children:[(e?.routes()??[]).map(({path:w,component:C})=>(0,b.jsx)(ue,{path:w,element:(0,b.jsx)(C,{context:s})},w)),(0,b.jsx)(ue,{path:"/",element:(0,b.jsx)(yi,{context:s,Home:o})}),(0,b.jsx)(ue,{path:"/problems",element:(0,b.jsx)(d,{context:s})}),(0,b.jsx)(ue,{path:"/~draft",element:(0,b.jsx)(K.Suspense,{fallback:null,children:(0,b.jsx)(oi,{context:s})})}),(0,b.jsx)(ue,{path:"/search",element:(0,b.jsx)(hn,{context:s})}),(0,b.jsx)(ue,{path:"/map",element:(0,b.jsx)(fn,{context:s})}),(0,b.jsx)(ue,{path:"/places",element:(0,b.jsx)(un,{context:s})}),me(s).some(w=>w.as===zt)?null:(0,b.jsx)(ue,{path:Gn,element:(0,b.jsx)(an,{to:"/",replace:!0})}),(0,b.jsx)(ue,{path:"/places/:as",element:(0,b.jsx)(mn,{context:s})}),(0,b.jsx)(ue,{path:"/:slug",element:(0,b.jsx)(kr,{context:s,registry:e,page:"list"})}),(0,b.jsx)(ue,{path:"/:slug/:id",element:(0,b.jsx)(kr,{context:s,registry:e,page:"record"})})]})]})}))})});return t.embedded||!a||i?g:(0,b.jsx)(Qa.Provider,{value:f,children:(0,b.jsx)(ua.Provider,{value:c,children:g})})}function hi({context:t,registry:e,basename:n,initialPath:a,onNavigate:i,path:r,steering:l}){(0,K.useState)(()=>t.views?Wa(t.views,t.store.schema,fa(t.brand,t.store.schema)):void 0);let o=pe();Tn({reader:t.locale??o?.locale,app:t.brand?.locale??t.app?.brand?.locale});let d=t.store.seenBy(t.principal??{kind:"human"}),s=d===t.store?t:{...t,store:d};_n(t.store,t.principal);let c=(0,b.jsxs)(b.Fragment,{children:[i||r!==void 0?(0,b.jsx)(gi,{onNavigate:i,path:r}):null,l?(0,b.jsx)(di,{steering:l}):null,s.presence||o?(0,b.jsx)(pi,{context:s,to:o}):null,(0,b.jsx)(br,{context:s,...e?{registry:e}:{}})]}),m=s.views?(0,b.jsxs)(Yn,{store:s.store,views:s.views,...s.principal?{principal:s.principal}:{},...s.brand?{brand:s.brand}:{},...s.locale?{locale:s.locale}:{},...s.settings?{settings:s.settings}:{},...s.presence&&!o?{presence:s.presence}:{},...s.people?{people:s.people}:{},...s.onKeepLens?{onKeepLens:s.onKeepLens}:{},...s.ai?{ai:s.ai}:{},resolveApp:s.resolveApp??o?.resolveApp,...s.app?{app:s.app}:{},children:[c,(0,b.jsx)(or,{context:s})]}):c,f=s.files?(0,b.jsx)(Un.Provider,{value:s.files,children:m}):m;if(a!==void 0){let g=n===void 0?a:`${n.replace(/\/$/,"")}${a}`;return(0,b.jsx)(Ua,{initialEntries:[g],...n===void 0?{}:{basename:n},children:f})}return(0,b.jsx)(Ya,{...n===void 0?{}:{basename:n},children:f})}export{Er as a,hi as b};
@@ -1 +0,0 @@
1
- import{a as U,b as L,c as G,e as x,g as H,h as M,i as A,j as b,k,m as V,n as Y}from"./chunk.KC6UZHBM.js";import{b as E}from"./chunk.5R66YTET.js";import{G as O,J as q,P as W,W as j,Y as R,va as T,za as B}from"./chunk.HLLWKSZB.js";function J(e,r){return e===void 0||e===!0?!0:e===!1?!1:e[r]!==!1}function K(e){let r={};return e.query&&e.query.trim().length>0&&(r.q=e.query),e.archived!==void 0&&e.archived!==!1&&(r.archived=String(e.archived)),e.sort&&(r.sort=e.sort.direction==="desc"?`${e.sort.by}:desc`:e.sort.by),e.filter?.length&&(r.filter=e.filter.map(t=>`${t.key}:${t.value}`).join(",")),e.group&&(r.group=e.group.bucket?`${e.group.by}:${e.group.bucket}`:e.group.by),r}function X(e,r){let t=[],i={};if(e.query&&(i.query=e.query),e.archived!==void 0&&e.archived!==!1&&(i.archived=e.archived),e.sort&&(r.sorts.some(d=>d.key===e.sort.by)?i.sort=e.sort:t.push(`sort ${e.sort.by}`)),e.filter){let d=e.filter.filter(p=>r.filters.find(l=>l.key===p.key)?!0:(t.push(`filter ${p.key}`),!1));d.length>0&&(i.filter=d)}return e.group&&(r.groups.some(d=>d.key===e.group.by)?i.group=e.group:t.push(`group ${e.group.by}`)),{arrangement:i,dropped:t}}function v(e,r){return j(e.schema.tryDefinition(r.kind),A(r))}var Z=(e,r)=>e==null?r==null?0:1:r==null?-1:typeof e=="number"&&typeof r=="number"?e-r:typeof e=="boolean"&&typeof r=="boolean"?e===r?0:e?1:-1:String(e).localeCompare(String(r),void 0,{numeric:!0,sensitivity:"base"});function ee(e,r,t){if(t==="label")return v(e,r);let i=e.schema.tryDefinition(r.kind);return i&&t in(i.fields.shape??{})?T(M(r),t,e.today??O()):b(e.graph,r.id,t).map(p=>v(e,p)).sort()[0]}var re=/^(\d{4})-(\d{2})-(\d{2})/;function z(e,r){let t=re.exec(e);if(!t)return;let[,i,d,p]=t;if(r==="day")return`${i}-${d}-${p}`;if(r==="month")return`${i}-${d}-01`;if(r==="year")return`${i}-01-01`;if(r==="decade")return`${String(Number(i)-Number(i)%10).padStart(4,"0")}-01-01`;let u=new Date(Date.UTC(Number(i),Number(d)-1,Number(p))),l=(u.getUTCDay()+6)%7;return u.setUTCDate(u.getUTCDate()-l),u.toISOString().slice(0,10)}function ne(e,r){return r==="month"?W(e):r==="week"?`Week of ${q(e)}`:r==="year"?e.slice(0,4):r==="decade"?`The ${e.slice(0,4)}s`:q(e)}function te(e,r,t){return I(e,t)(r)}function I(e,r){let{words:t,conditions:i}=V(r);if(t.length===0&&i.length===0)return()=>!0;let d=new Map,p=u=>{let l=d.get(u);return l||(l=new Set(x(e.schema,u).filters.map(g=>g.key)),d.set(u,l)),l};return u=>{let l=p(u.kind),g=i.filter(f=>l.has(f.key));return g.every(f=>k(e,u,f))?t.length>0?Y(e.schema.tryDefinition(u.kind),A(u),t)!==void 0:g.length>0:!1}}function oe(e,r,t){let i=r.query?.trim(),d=r.archived===void 0?e:e.filter(n=>B(n,r.archived)),p=i?d.filter(I(t,i)):d,u=r.filter?.length?p.filter(n=>r.filter.every(s=>k(t,n,s))):[...p],l=r.sort,g=l?u.map((n,s)=>({node:n,index:s,value:ee(t,n,l.by)})).sort((n,s)=>{let o=Z(n.value,s.value),a=l.direction==="desc"&&o!==0&&n.value!==void 0&&s.value!==void 0?-o:o;return a!==0?a:n.index-s.index}).map(n=>n.node):u,f=r.group;if(!f)return{nodes:g,groups:[{key:"",label:"",nodes:g}],grouped:!1};let N=new Map,c=(n,s,o)=>{let a=N.get(n)??{label:s,nodes:[]};a.nodes.push(o),N.set(n,a)},C=g[0],h=C?t.schema.tryDefinition(C.kind):void 0,$=h?.fields.shape??{},P=h?U(h,f.by):R(f.by),m=f.by in $,y=m?L($[f.by]):void 0,Q=G(t.schema,C?.kind??"").find(n=>n.key===f.by)?.label,S=m?`No ${P.toLowerCase()}`:`Without ${(Q??R(f.by)).toLowerCase()}`,F=m?new Map:E([...new Map(g.flatMap(n=>b(t.graph,n.id,f.by)).map(n=>[n.id,n])).values()].map(A),n=>t.schema.tryDefinition(n));for(let n of g){if(m){let o=T(M(n),f.by,t.today??O());if(o==null||o==="")c("",S,n);else if(y==="date"){let a=f.bucket??"day",D=z(String(o),a);D?c(D,ne(D,a),n):c("",S,n)}else if(y==="boolean")c(o?"1":"0",o?"Yes":"No",n);else{let a=h?.display?.format?.[f.by];c(String(o),a?a(o):String(o),n)}continue}let s=b(t.graph,n.id,f.by).map(o=>({id:o.id,label:F.has(o.id)?`${v(t,o)} \xB7 ${F.get(o.id)}`:v(t,o)})).sort((o,a)=>o.label.localeCompare(a.label));s.length===0?c("",S,n):c(s.map(o=>o.id).join(","),s.map(o=>o.label).join(", "),n)}let w=y==="choice"?H($[f.by]):void 0,_=[...N.entries()].sort(([n,s],[o,a])=>n===""?1:o===""?-1:w?w.indexOf(n)-w.indexOf(o):y==="boolean"?o.localeCompare(n):y==="date"?n.localeCompare(o):s.label.localeCompare(a.label)).map(([n,s])=>({key:n,label:s.label,nodes:s.nodes}));return{nodes:g,groups:_,grouped:!0}}export{J as a,K as b,X as c,te as d,oe as e};
@@ -1 +0,0 @@
1
- import{a as ge}from"./chunk.OWE6OJ4P.js";import{p as ye}from"./chunk.KC6UZHBM.js";import{d as V}from"./chunk.HONUT6OG.js";import{a as z}from"./chunk.YCA7P5MK.js";import{a as pe,b as W,d as he}from"./chunk.ZS4DJ76C.js";import{a as oe,f as me}from"./chunk.G4WQGTZR.js";import{Aa as se,Tb as fe,Va as de,X as L,Ya as ce,Za as le,a as ee,ab as ue,eb as j,ka as ne,ma as te,na as re,qa as ie,wa as ae}from"./chunk.HLLWKSZB.js";var J=(t,n,e)=>{(t[n]===void 0||e>t[n])&&(t[n]=e)},N=(t,n,e)=>{(t[n]===void 0||e<t[n])&&(t[n]=e)},B=(t,n)=>{t.format=n,n.includes("int")&&(t.isInt=!0)},we=(t,n)=>{t.mime=t.mime?t.mime.filter(e=>n.includes(e)):[...n]},Se=(t,n)=>{t.multipleOf??=[],t.multipleOf.includes(n)||t.multipleOf.push(n)},be=(t,n)=>(t.patterns??=new Set).add(n),Ie={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function P(t){let n={},{def:e,bag:i}=t._zod,r=t._zod.traits.has("$ZodCheck")?[t,...e.checks??[]]:e.checks??[];for(let o of r){let a=o._zod.def;switch(a.check){case"greater_than":J(n,a.inclusive?"minimum":"exclusiveMinimum",a.value);break;case"less_than":N(n,a.inclusive?"maximum":"exclusiveMaximum",a.value);break;case"multiple_of":Se(n,a.value);break;case"number_format":{B(n,a.format);let s=Ie[a.format];s&&(J(n,"minimum",s[0]),N(n,"maximum",s[1]));break}case"bigint_format":B(n,a.format);break;case"min_length":case"min_size":J(n,"minimum",a.minimum);break;case"max_length":case"max_size":N(n,"maximum",a.maximum);break;case"length_equals":J(n,"minimum",a.length),N(n,"maximum",a.length);break;case"size_equals":J(n,"minimum",a.size),N(n,"maximum",a.size);break;case"string_format":B(n,a.format),a.pattern&&be(n,a.pattern),(a.format==="base64"||a.format==="base64url")&&(n.contentEncoding=a.format),(a.local||a.precision===-1)&&(n.laxFormat=!0);break;case"mime_type":we(n,a.mime);break}}i.minimum!==void 0&&J(n,"minimum",i.minimum),i.exclusiveMinimum!==void 0&&J(n,"exclusiveMinimum",i.exclusiveMinimum),i.maximum!==void 0&&N(n,"maximum",i.maximum),i.exclusiveMaximum!==void 0&&N(n,"exclusiveMaximum",i.exclusiveMaximum),i.multipleOf!==void 0&&Se(n,i.multipleOf),i.format!==void 0&&(n.format??=i.format,i.format.includes("int")&&(n.isInt=!0)),i.mime&&we(n,i.mime);for(let o of i.patterns??[])be(n,o);return n}var je={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""};function $(t){let n=t._zod.def;return n.type==="pipe"&&n.in._zod.traits.has("$ZodTransform")?$(n.out):n.type==="catch"?$(n.innerType):t._zod.optin}var He=new Set(["promise","optional","nonoptional","nullable","readonly","default","prefault","catch"]);function A(t,n=new Set){if(n.has(t))return!1;n.add(t);let e=t._zod.def,i=e.type;return i==="transform"?!0:i==="array"?A(e.element,n):i==="set"?A(e.valueType,n):i==="lazy"?A(e.getter(),n):He.has(i)?A(e.innerType,n):i==="intersection"?A(e.left,n)||A(e.right,n):i==="record"||i==="map"?A(e.keyType,n)||A(e.valueType,n):i==="pipe"?t._zod.traits.has("$ZodCodec")||A(e.in,n)||A(e.out,n):i==="object"?Object.values(e.shape).some(r=>A(r,n)):i==="union"?e.options.some(r=>A(r,n)):i==="tuple"?e.items.some(r=>A(r,n))||(e.rest?A(e.rest,n):!1):!1}function Fe(t){let n=Object.values(t).filter(e=>typeof e=="number");return Object.entries(t).filter(([e])=>n.indexOf(+e)===-1).map(([,e])=>e)}function Ae(t){let n=t.anyOf;if(!Array.isArray(n)||n.length===0||t.type!==void 0)return;let e=[];for(let i of n){if(!i||typeof i!="object")return;Ae(i);let r=Object.keys(i);if(r.length!==1||r[0]!=="type")return;for(let o of[i.type].flat()){if(typeof o!="string")return;e.includes(o)||e.push(o)}}delete t.anyOf,t.type=e.length===1?e[0]:e}var Oe=new Set(["type","properties","required","additionalProperties"]),ke=t=>{let n=t.additionalProperties;return n&&typeof n=="object"&&Object.keys(n).length?n:null},ve=(t,n)=>JSON.stringify(t)===JSON.stringify(n);function C(t){for(let r of t){if(typeof r!="object"||r.type!=="object")return null;for(let o in r)if(!Oe.has(o))return null}let n={},e=new Set;for(let r of t){for(let o in r.properties){if(Object.prototype.hasOwnProperty.call(n,o))continue;let a=[];for(let s of t){let d=s.properties?.[o]??ke(s);d&&!a.some(S=>ve(S,d))&&a.push(d)}n[o]=a.length===1?a[0]:C(a)??{allOf:a}}for(let o of r.required??[])e.add(o)}let i={type:"object",properties:n};if(e.size&&(i.required=[...e]),t.every(r=>r.additionalProperties===!1))i.additionalProperties=!1;else{let r=[];for(let o of t){let a=ke(o);a&&!r.some(s=>ve(s,a))&&r.push(a)}r.length===1?i.additionalProperties=r[0]:r.length>1&&(i.additionalProperties={allOf:r})}return i}function qe(t){let n=t.allOf;if(!Array.isArray(n)||n.length<2)return;for(let r of Oe)if(r in t)return;let e=n.filter(r=>Array.isArray(r.oneOf)||Array.isArray(r.anyOf)),i;if(!e.length)i=C(n);else{let r=e[0],o=Array.isArray(r.oneOf)?"oneOf":"anyOf";if(Object.keys(r).length!==1)return;let a=n.filter(d=>d!==r),s=r[o].map(d=>C([...a,d]));if(s.some(d=>!d))return;i={[o]:s}}i&&(delete t.allOf,Object.assign(t,i))}function xe(t){let n=t;for(let c of["anyOf","oneOf"]){let l=n[c];if(!Array.isArray(l))continue;let g=l.map(xe);g.some((w,u)=>w!==l[u])&&(n={...n,[c]:g})}let e=[n.type].flat(),i=!e.includes("string")&&e.some(c=>c==="number"||c==="integer"),r=n.enum??(n.const!==void 0?[n.const]:void 0);if(!i&&!r?.some(c=>typeof c=="number"))return n;let{minimum:o,maximum:a,exclusiveMinimum:s,exclusiveMaximum:d,multipleOf:S,format:h,id:b,...p}=n;return p.enum?p.enum=p.enum.map(c=>typeof c=="number"?String(c):c):typeof p.const=="number"&&(p.const=String(p.const)),i&&(p.type="string",r||(p.pattern=e.includes("number")?"^-?\\d+(?:\\.\\d+)?$":"^-?\\d+$")),p}var H=class{constructor(n,e){this.override=n;this.refs=e}done=new Map;path=[];cyclic=new Map;write(n,e=!1){let i=this.refs.get(n);if(i!==void 0&&!e)return{$ref:i};if(this.path.includes(n))return this.cyclic.has(n)||this.cyclic.set(n,""),{};let r=this.done.get(n);if(r)return r;this.path.push(n);try{let o=this.written(n);return this.done.set(n,o),o}finally{this.path.pop()}}written(n){let e={},i,r=n._zod.toJSONSchema?.();r?Object.assign(e,r):i=this.process(n,e);let o=ee.get(n);if(o)for(let s of Object.keys(o))e[s]=o[s];A(n)&&(delete e.examples,delete e.default),"_prefault"in e&&(e.default??=e._prefault,delete e._prefault);let a=e;if(i){let s=this.write(i);a={...e};for(let d of Object.keys(s))d in e||(a[d]=s[d])}return this.override({zodSchema:n,jsonSchema:a}),Ae(a),n._zod.def.type==="intersection"&&qe(a),a}process(n,e){let i=n._zod.def;switch(i.type){case"string":{e.type="string";let{minimum:r,maximum:o,format:a,patterns:s,contentEncoding:d,laxFormat:S}=P(n);if(typeof r=="number"&&(e.minLength=r),typeof o=="number"&&(e.maxLength=o),a&&(e.format=je[a]??a,(e.format===""||a==="time"||S)&&delete e.format),d&&(e.contentEncoding=d),s&&s.size>0){let h=[...s];h.length===1?e.pattern=h[0].source:e.allOf=h.map(b=>({pattern:b.source}))}return}case"number":{let{minimum:r,maximum:o,multipleOf:a,exclusiveMinimum:s,exclusiveMaximum:d,isInt:S}=P(n);if(e.type=S?"integer":"number",typeof s=="number"&&s>=(r??Number.NEGATIVE_INFINITY)?e.exclusiveMinimum=s:typeof r=="number"&&(e.minimum=r),typeof d=="number"&&d<=(o??Number.POSITIVE_INFINITY)?e.exclusiveMaximum=d:typeof o=="number"&&(e.maximum=o),a){let[h,...b]=new Set(a.filter(p=>Number.isFinite(p)&&p!==0).map(Math.abs));h!==void 0&&(e.multipleOf=h),b.length&&(e.allOf=[...e.allOf??[],...b.map(p=>({multipleOf:p}))])}return}case"boolean":case"success":e.type="boolean";return;case"null":e.type="null";return;case"never":e.not={};return;case"enum":{let r=Fe(i.entries);r.length===0?e.not={}:(r.every(o=>typeof o=="number")&&(e.type="number"),r.every(o=>typeof o=="string")&&(e.type="string"),e.enum=r);return}case"literal":{let r=i.values.filter(o=>o!==void 0).map(o=>typeof o=="bigint"?Number(o):o);if(i.values.length===0)e.not={};else if(r.length===1)e.type=r[0]===null?"null":typeof r[0],e.const=r[0];else if(r.length>1){for(let o of["number","string","boolean"])r.every(a=>typeof a===o)&&(e.type=o);r.every(o=>o===null)&&(e.type="null"),e.enum=r}return}case"template_literal":e.type="string",e.pattern=n._zod.pattern.source;return;case"file":{e.type="string",e.format="binary",e.contentEncoding="binary";let{minimum:r,maximum:o,mime:a}=P(n);r!==void 0&&(e.minLength=r),o!==void 0&&(e.maxLength=o),a&&(a.length===0?e.not={}:a.length===1?e.contentMediaType=a[0]:e.anyOf=a.map(s=>({contentMediaType:s})));return}case"array":{let{minimum:r,maximum:o}=P(n);typeof r=="number"&&(e.minItems=r),typeof o=="number"&&(e.maxItems=o),e.type="array",e.items=this.write(i.element);return}case"object":{let r=i.shape;e.type="object";let o={};e.properties=o;for(let s in r)Object.defineProperty(o,s,{value:this.write(r[s]),writable:!0,enumerable:!0,configurable:!0});let a=Object.keys(r).filter(s=>$(r[s])===void 0);a.length>0&&(e.required=a),i.catchall?._zod.def.type==="never"?e.additionalProperties=!1:i.catchall&&(e.additionalProperties=this.write(i.catchall));return}case"union":e[i.inclusive===!1?"oneOf":"anyOf"]=i.options.map(r=>this.write(r));return;case"intersection":{let r=s=>"allOf"in s&&Object.keys(s).length===1,o=this.write(i.left),a=this.write(i.right);e.allOf=[...r(o)?o.allOf:[o],...r(a)?a.allOf:[a]];return}case"tuple":{let r=i.items;e.type="array",e.prefixItems=r.map(d=>this.write(d)),i.rest?e.items=this.write(i.rest):e.items=!1;let o=r.length;for(;o>0&&$(r[o-1])!==void 0;)o-=1;o>0&&(e.minItems=o),i.rest||(e.maxItems=r.length);let{minimum:a,maximum:s}=P(n);typeof a=="number"&&(e.minItems=a),typeof s=="number"&&(e.maxItems=s);return}case"record":{let r=i.keyType;e.type="object";let o=P(r).patterns;if(i.mode==="loose"&&o&&o.size>0){let s=this.write(i.valueType),d={};for(let S of o)d[S.source]=s;e.patternProperties=d}else e.propertyNames=xe(this.write(r)),e.additionalProperties=this.write(i.valueType);let a=r._zod.values;if(a&&!i.partial&&$(i.valueType)===void 0){let s=[...a].filter(d=>typeof d=="string"||typeof d=="number");s.length>0&&(e.required=s.map(String))}return}case"nullable":e.anyOf=[this.write(i.innerType),{type:"null"}];return;case"default":case"prefault":{let r=i.defaultValue,o,a=!1,s=JSON.stringify(r,(d,S)=>typeof S=="bigint"?(a=!0,null):S);return!a&&s!==void 0&&(o=JSON.parse(s)),a||(e[i.type==="default"?"default":"_prefault"]=o),i.innerType}case"catch":{try{e.default=i.catchValue(void 0)}catch{}return i.innerType}case"readonly":return e.readOnly=!0,i.innerType;case"pipe":return i.in._zod.traits.has("$ZodTransform")?i.out:i.in;case"lazy":return n._zod.innerType;case"optional":case"nonoptional":case"promise":return i.innerType;default:return}}};function Re(t,n=()=>{}){let e=t,i=new H(n,new Map),r=i.write(e,!0);if(i.cyclic.size>0){let o=new Map,a=0,s=[];for(let S of i.cyclic.keys())if(S===e)o.set(S,"#");else{let h=`__schema${a++}`;o.set(S,`#/$defs/${h}`),s.push([S,h])}i=new H(n,o),r=i.write(e,!0);let d={};for(let[S,h]of s)d[h]=i.write(S,!0);s.length>0&&(r={...r,$defs:d})}return JSON.parse(JSON.stringify({$schema:"https://json-schema.org/draft/2020-12/schema",...r}))}function _e(t){return Re(t,Ve)}var Le={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string"},We={phone:"A phone number as it is written, like +1 555 123 4567 or 020 7946 0958 ext. 12.",place:"An address or a place's name, as a person would search a map for it.",duration:"A length of time in whole minutes: 90 is 1 h 30 min."};function Ve(t){if(ne(t.zodSchema)&&(t.jsonSchema["x-graview-app-link"]=!0),ie(t.zodSchema)&&(t.jsonSchema["x-graview-repeat"]=!0,!t.jsonSchema.type&&!t.jsonSchema.anyOf&&!t.jsonSchema.oneOf&&Object.assign(t.jsonSchema,Be())),oe(t.zodSchema)){t.jsonSchema.contentMediaType="text/markdown";let s=t.jsonSchema.description;typeof s=="string"&&s.endsWith("Written in Markdown.")||(t.jsonSchema.description=`${typeof s=="string"&&s?`${s.replace(/\.?$/,".")} `:""}Written in Markdown.`)}let n=me(t.zodSchema);if(n){let s=t.jsonSchema;s["x-graview-type"]=n,n==="duration"&&(s["x-graview-unit"]="minutes"),s.description??=We[n]}let e=ue(t.zodSchema,!1);if(e){let s=pe(e);t.jsonSchema["x-graview-format"]=s.format??"unit",s.currency&&(t.jsonSchema["x-graview-currency"]=s.currency),s.unit&&s.format!=="money"&&(t.jsonSchema["x-graview-unit"]=s.unit);let d=t.jsonSchema.description;t.jsonSchema.description=typeof d=="string"&&d.length>0?`${d} ${W(s)}`:W(s)}let i=t.zodSchema._zod?.def;if(!i||i.type!=="string"||typeof i.format!="string"||i.format==="regex")return;let r=t.jsonSchema,o=(i.checks??[]).map(s=>s._zod?.def).filter(s=>s?.format==="regex"&&s.pattern instanceof RegExp).map(s=>s.pattern.source);delete r.pattern;let a=r.allOf;Array.isArray(a)&&a.every(s=>typeof s=="object"&&s!==null&&Object.keys(s).length===1&&"pattern"in s)&&delete r.allOf,r.format=Le[i.format]??i.format,o.length===1?r.pattern=o[0]:o.length>1&&(r.allOf=o.map(s=>({pattern:s})))}function U(t){let n=j(t.input),e=_e(t.input),i=e.properties??{};if(ce(t)){let r=t.creates.join(" | ");i.id={type:"string",minLength:1,description:`Optional: the id for the ${r} this makes. Refused if the graph already has it; left out, one is minted from the label.`},e.properties=i}le(t)&&(e.additionalProperties=!1);for(let r of n){let o=i[r.name];if(!o)continue;let a=r.kinds.includes("*")?"any node kind":r.kinds.join(" | ");o.description=[o.description,`Id of a node (${a}).`].filter(Boolean).join(" ")}return{name:t.name,...t.title===void 0?{}:{title:t.title},description:t.description??t.title??t.name,inputSchema:e,nodeRefs:n}}function Be(){let t={type:"string",pattern:"^\\d{4}-\\d{2}-\\d{2}$"},n=(e,i)=>({type:"integer",minimum:e,maximum:i});return{type:"object",description:'How the date beside it repeats; the date is the first occurrence. "on" is weekdays for "week", days of the month (-1 the last) for "month".',properties:{every:{type:"string",enum:[...re]},interval:n(1,99),on:{type:"array",minItems:1,maxItems:31,items:{anyOf:[{type:"string",enum:[...te]},n(-1,31)]}},until:t,count:n(1,1e3),except:{type:"array",maxItems:500,items:t},continues:{type:"string",maxLength:200}},required:["every"],additionalProperties:!1}}function Te(t){let n=new Set;for(let e=t;e;e=e.onBehalfOf)e.id!==void 0&&n.add(`${e.kind}:${e.id}`);return n}function F(t,n){let e=Te(n),i=h=>{if(h.kind==="rule")return!1;let b=Te(h);if(b.size===0)return!1;for(let p of b)if(e.has(p))return!1;return!0},r,o=()=>{if(r)return r;r=new Map;for(let h of t.log.live()){if(h.undoes!==void 0)continue;let b=i(h.author)?h.author:void 0;for(let p of h.primitives){p.op==="remove-node"&&r.delete(p.node.id);let c=p.op==="add-node"?p.node.id:p.op==="patch-node"?p.id:void 0;if(c===void 0)continue;let l=p.op==="add-node"?Object.keys(p.node):Object.keys(p.after),g=r.get(c);(p.op==="add-node"||!g)&&r.set(c,g=new Map);for(let w of l)w==="id"||w==="kind"||(b?g.set(w,b):g.delete(w))}}return r},a=t.schema,s=new Map,d=(h,b)=>{let p=`${h}\0${b}`,c=s.get(p);if(c===void 0){let l=a.tryDefinition(h)?.fields?.shape;c=l!==void 0&&b in l&&he(l[b]).type==="text",s.set(p,c)}return c},S=h=>t.graph.getNode(h)?.kind;return{prose:d,say:h=>ae(h,{graph:t.graph,schema:a}),fieldBy(h,b){let p=S(h);if(!(p===void 0||!d(p,b)))return o().get(h)?.get(b)},recordBy(h){let b=S(h),p=o().get(h);if(b===void 0||!p)return;let c;for(let[l,g]of p)d(b,l)&&(c=g);return c}}}var G=(t,n,e)=>({untrusted:!0,authoredBy:e.say(n),text:t}),Ce="the host's ranker";function Me(t,n){return{...t,hits:t.hits.map(e=>{if(e.about!=="node")return e;e.why.by==="meaning"&&e.why.matched!==void 0&&(e={...e,why:{...e.why,matched:{untrusted:!0,authoredBy:Ce,text:e.why.matched}}});let i=n.recordBy(e.id);if(!i)return e;let r=n.prose(e.kind,e.why.field)?n.fieldBy(e.id,e.why.field):i;return{...e,label:G(e.label,i,n),...e.apart!==void 0?{apart:G(e.apart,i,n)}:{},why:r?{...e.why,fragment:G(e.why.fragment,r,n)}:e.why}})}}var q=t=>{let n;return()=>n??=t().catch(e=>{throw n=void 0,e})},Ge=q(()=>import("./chunk.RB4RTBRZ.js")),Ke=()=>import("./chunk.DN7SN6ZR.js").catch(()=>{}),Ze=async()=>{(await Ke())?.judgeWithLines()},I=q(()=>import("./chunk.HRWLR7T4.js")),Ye=q(()=>import("./chunk.ZEGSQCSD.js")),Xe=q(()=>import("./chunk.SIL4KD3K.js")),_=t=>({title:t,readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}),Je={description:'Which records: false (the default) the live ones, true only the archived ones, "all" both. An archived record is set aside, not gone: unarchive-<kind> brings it back.',anyOf:[{type:"boolean"},{type:"string",enum:["all"]}]},K={type:"number",description:"Where the page starts; 0 when unsaid."},Z=[{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. When few records match exactly, records with a near word follow \u2014 a typo, another form of the word, a meaning \u2014 each with near: true and why.matched, the record's own word that answered.",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."},archived:Je},required:["query"],additionalProperties:!1},mutating:!1,annotations:_("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:K,archived:Je},additionalProperties:!1},mutating:!1,annotations:_("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:K},required:["id"],additionalProperties:!1},mutating:!1,annotations:_("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:K,context:{type:"object",description:"Evaluation context, e.g. { weekStart }."}},additionalProperties:!1},mutating:!1,annotations:_("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:_("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:_("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:_("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}}],Pe={name:"act_on_several",title:"Do one act to several records",description:`Run one act on several records at once, as one change with one undo. act is the act (its tool name or its declared name), records the records it runs on (ids or names; each goes in the act's subject), args what every call shares ("Set stage to Declined" is args { stage: "declined" }). Each record is judged on its own: one this seat may not change is named with why, and the rest still apply. Returns the batch (undo_batch takes it all back), the records changed, those already so, and those refused.`,inputSchema:{type:"object",properties:{act:{type:"string",description:"The act to run on each record."},records:{type:"array",items:{type:"string"},minItems:1,maxItems:200,description:"Ids or names of the records."},args:{type:"object",description:"Arguments every call shares, besides the record."}},required:["act","records"],additionalProperties:!1},mutating:!0,annotations:{title:"Do one act to several records",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1}},Y={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"]},X={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:Y,current:Y},additionalProperties:!1},mutating:!1,annotations:_("Draw a view")},Ee={name:"keep_lens",title:"Keep a view as a lens",description:"Keep a lens draft_view drew as one of the app's places: checked again, then written as the add-lens edit. Returns the remove-lens edit that takes it back.",inputSchema:{...Y,additionalProperties:!1},mutating:!0,annotations:{title:"Keep a view as a lens",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}};function Qe(t,n){return t===void 0?[]:t==="keep"&&!n?[X,Ee]:[X]}var en="An argument that names a record takes its id or its name.",ze=[...Z.map(t=>t.name),Pe.name,X.name,Ee.name],$e=64;function D(t){let{line:n,...e}=t;return e}function Ne(t){return{...t,...t.introduces?{introduces:t.introduces.map(D)}:{},...t.resolves?{resolves:t.resolves.map(D)}:{},...t.violationsAfter?{violationsAfter:t.violationsAfter.map(D)}:{}}}function nn(t){let n=t.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,$e)}function tn(t){let n=new Set(ze),e=new Map;for(let i of t){let r=nn(i),o=r;for(let a=2;n.has(o);a+=1)o=`${r.slice(0,$e-`_${a}`.length)}_${a}`;n.add(o),e.set(i,o)}return e}function rn(t,n){if(n.size===0)return t;let e=Object.fromEntries(Object.entries(t.properties??{}).filter(([r])=>!n.has(r))),i=(t.required??[]).filter(r=>!n.has(r));return{...t,properties:e,...t.required?{required:i}:{}}}function on(t,n,e){let i=U(t),r=L(t),o=i.nodeRefs.length>0?`${i.description}${/[.!?]$/.test(i.description)?"":"."} ${en}`:i.description;return{name:n,title:r,description:o,inputSchema:rn(i.inputSchema,e),mutating:!0,annotations:{title:r,readOnlyHint:!1,destructiveHint:t.destructive===!0||(t.severs?.length??0)>0,idempotentHint:t.idempotent===!0,openWorldHint:!1},act:t.name}}function Q(t){if(t===null||typeof t!="object")return JSON.stringify(t)??"null";if(Array.isArray(t))return`[${t.map(Q).join(",")}]`;let n=t;return`{${Object.keys(n).filter(e=>n[e]!==void 0).sort().map(e=>`${JSON.stringify(e)}:${Q(n[e])}`).join(",")}}`}function an(t){return`sha256:${fe(Q(t))}`}function sn(t,n,e,i,r){let o=tn(t.map(d=>d.name)),a=Qe(i,e);return{definitions:e?[...Z.filter(d=>!d.mutating),...a]:[...Z,Pe,...a,...t.filter(d=>n.has(d.name)).map(d=>on(d,o.get(d.name),r(d)))],names:o}}function Fn(t,n={}){let e=n.author??{kind:"agent"},i=t.allMutations(),r=new Set(t.permittedMutations(e).map(c=>c.name)),{definitions:o,names:a}=sn(i,r,n.readOnly===!0,n.drafts?n.drafts.keep?"keep":"draw":void 0,c=>V(t.schema,t.policy,e,c)),s=an(o),d=c=>{if(!ze.includes(c)){for(let[l,g]of a)if(g===c)return l;return a.has(c)?c:void 0}},S=(c,l)=>{let g=i.find(f=>f.name===c);if(!g)return{args:l,resolved:[]};let w={...l},u=[];for(let f of j(g.input)){let m=w[f.name];if(typeof m!="string"||m.trim()==="")continue;let y=t.resolveRef(f,m,e);if(!y.ok){let k=y.reason==="none"?` Nothing was changed. Use search_graph to look it up, then pass its id as ${f.name}.`:" Nothing was changed.";return{ok:!1,error:`${y.message}${k}`,argument:f.name,candidates:y.candidates}}y.by!=="id"&&(w[f.name]=y.id,u.push({argument:f.name,given:m,id:y.id,label:y.label}))}return{args:w,resolved:u}},h=async(c,l)=>{try{await Ze();let g=o.find(u=>u.name===c)??o.find(u=>u.act===c);if(!g){let u=d(c);if(u){let f=t.permits({name:u,args:l},e);if(!f.ok)return{ok:!1,error:f.refusal.message,reason:"forbidden"}}return{ok:!1,error:`Unknown tool "${c}". Available: ${o.map(f=>f.name).join(", ")}`}}if(g.mutating&&n.readOnly)return{ok:!1,error:`"${c}" changes the graph, and this seat is read-only.`,reason:"forbidden"};if(g.act!==void 0){let u=S(g.act,l);if("ok"in u)return u;let f=z(t,e,t.apply({name:g.act,args:u.args},{...n.author?{author:n.author}:{},...De(n.via)}));return{ok:!0,data:{batch:f.batch,intent:f.intent,introduces:f.introduces.map(D),resolves:f.resolves.map(D),...u.resolved.length>0?{resolved:u.resolved}:{}},diff:f.diff}}let w=t.seenBy(e);switch(g.name){case"search_graph":{let u=typeof n.places=="function"?n.places():n.places,f=typeof l.subject=="string"?l.subject:void 0,m=ye(w,String(l.query??""),{principal:e,rank:n.near,archived:se(l.archived),limit:typeof l.limit=="number"&&l.limit>0?Math.min(l.limit,20):20,...u?{places:u}:{},...f?{subject:f,from:[f]}:{}}),y=m.later?await m.later:m;return{ok:!0,data:(await I()).searchRead(y,Me(y,F(w,e))),reads:y.hits.flatMap(k=>k.about==="node"?[k.id]:[])}}case"get_graph":return{ok:!0,...(await I()).graphRead(w,F(w,e),l)};case"get_node":{let u=String(l.id??""),f=u,m;if(!w.graph.getNode(u)){let k=u.trim()===""?void 0:t.resolveRef({name:"id",kinds:["*"]},u,e);if(k?.ok)f=k.id,m={argument:"id",given:u,id:f,label:k.label};else return k?.reason==="ambiguous"?{ok:!1,error:k.message,argument:"id",candidates:k.candidates}:{ok:!1,error:`No node "${u}".`}}let y=(await I()).nodeRead(w,F(w,e),f,l);return{ok:!0,data:m?{...y.data,resolved:[m]}:y.data,reads:y.reads}}case"describe_place":{let u=n.app??{name:"",schema:t.schema},f=typeof l.width=="number"&&Number.isFinite(l.width)&&l.width>0?l.width:1440,{describePlace:m}=await Ge(),y=m(t,e,String(l.place??""),{app:u,width:f});if(!y.ok)return{ok:!1,error:`${y.error} The places are: ${y.places.join(", ")}.`};let k=new Set,x=E=>{for(let T of E)for(let O of T.groups??[])for(let R of O.items)k.add(R.id),x(R.parts)};return x(y.description.parts),{ok:!0,data:y.description,reads:[...k]}}case"draft_view":case"keep_lens":{let u=n.app??{name:"",schema:t.schema};return(await Ye()).runDraftTool(g.name,l,{app:u,principal:e,...n.drafts?{drafts:n.drafts}:{}})}case"get_violations":{let u=w.violations(l.context);return{ok:!0,...(await I()).violationsRead(u,l)}}case"get_affordances":{let u=l.selection??[];return{ok:!0,data:ge(w,u,{...typeof n.derive=="function"?n.derive():n.derive,...n.author?{principal:n.author}:{},...l.context?{context:l.context}:{}}),reads:u.filter(m=>w.graph.has(m))}}case"preview_mutation":{let u=String(l.mutation),f=d(u)??u,m=S(f,l.args??{});if("ok"in m)return m;let y=t.missingFor({name:f,args:m.args},e);if(y)return{ok:!1,error:y.message,reason:"missing"};let k=z(t,e,t.preview({name:f,args:m.args},void 0,{author:e})),x=Ne(k);return{ok:!0,data:m.resolved.length>0?{...x,resolved:m.resolved}:x}}case"act_on_several":{let u=String(l.act??""),f=d(u)??u,m=i.find(v=>v.name===f);if(!m||!r.has(f)){let v=m?t.permits({name:f,args:{}},e):void 0;return v&&!v.ok?{ok:!1,error:v.refusal.message,reason:"forbidden"}:{ok:!1,error:`There is no act "${u}" this seat may run. Nothing was changed.`,reason:"invalid"}}let y=m.subject;if(!y)return{ok:!1,error:`"${L(m)}" does not act on a record, so it cannot be run on several. Nothing was changed.`,reason:"invalid"};let k=Array.isArray(l.records)?l.records.filter(v=>typeof v=="string"&&v.trim()!==""):[];if(k.length===0)return{ok:!1,error:"Name at least one record. Nothing was changed.",reason:"invalid"};let x=[],E=[];for(let v of k.slice(0,200)){let M=t.resolveRef({name:y.arg,kinds:y.kinds},v,e);if(!M.ok)return{ok:!1,error:`${M.message} Nothing was changed.`,argument:"records",candidates:M.candidates};x.push(M.id),M.by!=="id"&&E.push({argument:"records",given:v,id:M.id,label:M.label})}let T=S(f,{...l.args??{}});if("ok"in T)return T;let O=(await Xe()).actOnSeveral(t,{mutation:f,subject:y.arg,args:T.args},x,{author:e,...De(n.via)}),R=O.result?z(t,e,O.result):void 0;return{ok:!0,data:{...O.batch?{batch:O.batch,intent:O.intent}:{},applied:O.applied,unchanged:O.unchanged,refused:O.refused.map(v=>({record:v.id,label:v.label,error:v.message,reason:v.reason})),...O.allOrNothing?{keptNone:!0}:{},...R?{introduces:R.introduces.map(D),resolves:R.resolves.map(D)}:{},...E.length>0||T.resolved.length>0?{resolved:[...E,...T.resolved]}:{}},...R?{diff:R.diff}:{}}}case"undo_batch":{let u=String(l.batch),f=l.include??[],m=w.canUndo([u,...f]);if(!m.ok)return{ok:!1,error:m.message};let y=z(t,e,t.undo([u,...f],{...n.author?{author:n.author}:{}}));return{ok:!0,data:Ne(y),diff:y.diff}}default:return{ok:!1,error:`Unknown tool "${c}".`}}}catch(g){let{reason:w,wouldNeed:u}=de(g);return{ok:!1,error:g instanceof Error?g.message:String(g),reason:w,...u?{wouldNeed:u}:{}}}},b=new Set,p=c=>{for(let l of b)l(c)};return{definitions:o,hash:s,...n.author?{author:n.author}:{},onDiff(c){return t.subscribe(c)},onCall(c){return b.add(c),()=>b.delete(c)},async call(c,l){let g=(o.find(m=>m.name===c)??o.find(m=>m.act===c))?.mutating??!1,w={name:c,args:l,mutating:g,at:new Date().toISOString()};p({...w,phase:"running"});let u=m=>(p(m.ok?{...w,phase:"ok",...!g&&m.reads?{reads:m.reads}:{}}:{...w,phase:"failed",error:m.error}),m),f=await h(c,l);return u(f.ok&&!g?{...f,data:(await I()).withinReadChars(c,f.data)}:f)}}}function De(t){let n=typeof t=="function"?t():t;return n?{via:n}:{}}export{Q as a,Fn as b};
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk.GZH6PTXN.js";import"./chunk.OWE6OJ4P.js";import"./chunk.3JM2TNDD.js";import"./chunk.COTG2IG5.js";import"./chunk.UT6642FC.js";import"./chunk.DAA6XWLF.js";import"./chunk.7DNFXJH3.js";import"./chunk.7PRFYYVM.js";import"./chunk.2NCTM5K2.js";import"./chunk.JU2ZVKMT.js";import"./chunk.ZS4DJ76C.js";import"./chunk.5R66YTET.js";import"./chunk.G4WQGTZR.js";import"./chunk.HFKMHLJ3.js";import"./chunk.HLLWKSZB.js";import"./chunk.AJZBJBMO.js";export{b as actOnSeveral,a as actsForSeveral};
@@ -1 +0,0 @@
1
- import"./chunk.ZS4DJ76C.js";import"./chunk.5R66YTET.js";import{b as m}from"./chunk.G4WQGTZR.js";import"./chunk.HFKMHLJ3.js";import"./chunk.GS4T26WW.js";import{M as p}from"./chunk.Z56B2JR2.js";import{M as l}from"./chunk.HLLWKSZB.js";import{b as f}from"./chunk.AJZBJBMO.js";var a=f(p(),1);function N({states:e,definition:v}){let s=e.values.reduce((t,n)=>t+n.count,0),u=t=>t===null?"with none":m(v,e.field,t).toLowerCase(),c=e.values.filter(t=>t.count>0).map(t=>`${l(t.count)} ${u(t.value)}`).join(", ");return s===0?null:(0,a.jsx)("div",{className:"graview-district-states",role:"img","aria-label":c,title:c,children:e.values.map((t,n)=>{if(t.count===0)return null;let y=e.values.filter(r=>r.count>0).length,w=t.count/s*(168-(y-1)),o=l(t.count),i=`${o} ${u(t.value)}`,d=r=>r.length*6.2+8<=w;return(0,a.jsx)("span",{"data-graview-tier":t.tier,style:{flexGrow:t.count},title:i,children:d(i)?i:d(o)?o:""},n)})})}export{N as StatesBar};
@@ -1 +0,0 @@
1
- import{a as j}from"./chunk.JNGUSAWX.js";import{a as de}from"./chunk.MB7LKKUD.js";import{p as le,q as V}from"./chunk.OYJSFO3A.js";import{f as _,g as re,h as ae,i as B,j as G}from"./chunk.OQDETV4X.js";import{c as se}from"./chunk.G4WQGTZR.js";import{a as W,c as Z,h as ie}from"./chunk.GS4T26WW.js";import{F as N,I as K,M,U as T,V as ee,W as te,ga as ne,ia as oe,pa as z}from"./chunk.Z56B2JR2.js";import{$ as J,Cb as Q,Hb as R}from"./chunk.HLLWKSZB.js";import{b}from"./chunk.AJZBJBMO.js";var d=b(N(),1);var S=b(M(),1),pe=336,h=16,me=640,F=z(W(()=>import("./chunk.PTXQHHKF.js"))),ge=F.part((n,r)=>{let o=n.SeatPanel;return(0,S.jsx)(o,{...r})},{what:"The conversation"});function Ce({respond:n,onCall:r,onPick:o,start:v="field",onMove:y,place:c,onDraft:w}){let{brand:s,seatTalk:p}=T(),f=K(p),k=s?.name?.trim()||"this app",m=(0,d.useRef)(null),A=(0,d.useRef)(null),[E,i]=(0,d.useState)(""),[a,g]=(0,d.useState)(!1),x=(0,d.useRef)(null),u=v==="hidden",l=f.open&&!u;(0,d.useEffect)(()=>u?void 0:p.drawn(),[p,u]),(0,d.useLayoutEffect)(()=>{let t=m.current?.parentElement;if(!t)return;let P=()=>g(t.getBoundingClientRect().width<me);if(P(),typeof ResizeObserver>"u")return;let L=new ResizeObserver(P);return L.observe(t),()=>L.disconnect()},[u]),(0,d.useEffect)(()=>{typeof window<"u"&&window.dispatchEvent(new Event(de))},[l,f.side,a]),(0,d.useEffect)(()=>{let t=m.current;if(u||l||!t||typeof window>"u")return;let P=(t.closest("[data-graview-embed]")??document.documentElement).style,L=()=>{let q=t.getBoundingClientRect(),X=t.offsetParent?.getBoundingClientRect(),fe=X?X.bottom-q.top:q.height+h;P.setProperty("--graview-foot-room",`${Math.max(0,Math.round(fe+h))}px`)};L();let Y=typeof ResizeObserver>"u"?null:new ResizeObserver(L);return Y?.observe(t),()=>{Y?.disconnect(),P.removeProperty("--graview-foot-room")}},[u,l,a,f.side]),(0,d.useEffect)(()=>{!l||f.pending===null||(I(),A.current?.focus({preventScroll:!0}))},[l,f.pending]);let I=()=>{let t=typeof document>"u"?null:document.activeElement;t instanceof HTMLElement&&t!==document.body&&!m.current?.contains(t)&&(x.current=t)},D=()=>{I(),F.prefetch(),p.setOpen(!0)},U=()=>{p.setOpen(!1);let t=x.current;x.current=null,t?.isConnected&&!(a&&t instanceof HTMLInputElement)&&t.focus({preventScroll:!0}),document.activeElement!==t&&(a?m:A).current?.focus({preventScroll:!0})};if(u)return null;let C=!a&&f.side==="right",ue=a?l?{left:0,right:0,bottom:0,padding:"8px 12px calc(12px + env(safe-area-inset-bottom, 0px))",borderRadius:"12px 12px 0 0",...ce}:{left:h,right:h,bottom:`calc(${h}px + env(safe-area-inset-bottom, 0px))`}:l?{[C?"right":"left"]:C?`calc(${h/2-1}px + var(--graview-dock, 0px))`:h/2-1,bottom:h/2-1,width:pe+h+2,padding:h/2,borderRadius:12,...ce}:{[C?"right":"left"]:C?`calc(${h}px + var(--graview-dock, 0px))`:h,bottom:h,width:pe};return(0,S.jsxs)("section",{ref:m,role:"region","aria-label":`Ask ${k}`,tabIndex:-1,"data-testid":"seat","data-graview-seat":l?"open":"closed","data-graview-seat-side":C?"right":"left","data-graview-seat-shape":a?"phone":"desk","data-graview-foot":"","data-graview-offstage":"",onMouseDown:t=>t.stopPropagation(),onKeyDown:t=>{t.key!=="Escape"||!l||(t.preventDefault(),t.stopPropagation(),U())},style:{position:"absolute",zIndex:R("rail"),boxSizing:"border-box",display:"flex",flexDirection:"column",gap:8,pointerEvents:"auto",outline:"none",...ue},children:[(0,S.jsxs)("h2",{style:{...ie,margin:0},children:["Ask ",k]}),l?(0,S.jsx)(d.Suspense,{fallback:null,children:(0,S.jsx)(ge,{phone:a,side:C?"right":"left",name:k,onClose:U,...n?{respond:n}:{},...r?{onCall:r}:{},...o?{onPick:o}:{},...y?{onMove:y}:{},...c?{place:c}:{},...w?{onDraft:w}:{}})}):null,(0,S.jsx)("form",{onSubmit:t=>{t.preventDefault();let P=E.trim();l||D(),!(!P||f.busy)&&(p.ask(P),i(""))},style:{display:"flex",margin:0},children:(0,S.jsx)("input",{ref:A,"data-testid":"seat-field",type:"text",enterKeyHint:"send",autoComplete:"off",value:E,placeholder:`Ask ${k}\u2026`,"aria-label":`Ask ${k}`,onPointerEnter:()=>F.prefetch(),onFocus:()=>F.prefetch(),onClick:()=>{l||D()},onChange:t=>{i(t.target.value),l||D()},style:{flex:"1 1 auto",minWidth:0,boxSizing:"border-box",height:38,padding:"0 12px",font:"inherit",fontSize:"max(1rem,16px)",color:"var(--graview-ink)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:8}})})]})}var ce={background:"var(--graview-float)",border:"1px solid var(--graview-edge)",boxShadow:"var(--graview-lift-high)"};var $=b(N(),1),H=b(M(),1),he=z(W(()=>import("./chunk.PA5HYAEO.js"))),ve=he.part((n,r)=>{let o=n.DraftFrame;return(0,H.jsx)(o,{...r})},{what:"The view"});function De(n){let{seatTalk:r}=T();return(0,$.useSyncExternalStore)(r.subscribe,()=>r.get().draft!==null,()=>!1)?(0,H.jsx)($.Suspense,{fallback:null,children:(0,H.jsx)(ve,{...n})}):null}function Re(n={}){return n.scope===void 0?j:Z(j,n.scope)}var O=b(N(),1),e=b(M(),1);function _e({inside:n=!1,widthOf:r}={}){let{store:o,view:v,emphasis:y,setEmphasis:c}=T(),w=le(),{selection:s,set:p}=ne(),{show:f}=oe(),k=te(),m=(0,O.useMemo)(()=>{let i=new Map;for(let a of o.graph.allEdges()){let g=i.get(a.kind)??{count:0,ends:new Set};g.count+=1;for(let x of[a.from,a.to]){let u=o.graph.getNode(x);u&&g.ends.add(`kind:${u.kind}`)}i.set(a.kind,g)}return[...i.entries()].sort(([a],[g])=>a.localeCompare(g)).map(([a,g])=>({kind:a,count:g.count,ends:[...g.ends]}))},[o,k]),A=Math.max(0,...m.map(i=>i.count));if((0,O.useEffect)(()=>()=>c(null),[c]),!v.overview&&!n||m.length===0)return null;let E=new Set;for(let i of s){if(i.startsWith("kind:")){E.add(i);continue}let a=o.graph.getNode(i);a&&E.add(`kind:${a.kind}`)}return(0,e.jsxs)("section",{"aria-label":"What the lines mean",role:n?"group":void 0,"data-testid":"relation-key",style:n?{display:"grid",gap:1}:{position:"absolute",left:16,top:14,zIndex:R("rail"),display:"grid",gap:1,padding:"8px 10px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",maxWidth:ye,animation:"graview-settle 380ms 280ms ease backwards"},children:[n?null:(0,e.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:"var(--graview-ink-faint)",paddingBottom:2},children:m.length===1?"1 relation":`${m.length} relations`}),r?(0,e.jsx)(ke,{aloft:v.overview===!0}):null,m.map(({kind:i,count:a,ends:g})=>{let{connector:x,style:u}=V(w,i),l=we(o.schema,i),I=y!==null?y===i:E.size===0||g.some(D=>E.has(D));return(0,e.jsxs)("button",{type:"button",title:o.schema.edge(i)?.description===void 0?`${a} of these`:l.words,onMouseEnter:()=>c(i),onMouseLeave:()=>c(null),onFocus:()=>c(i),onBlur:()=>c(null),onClick:()=>{p(g),f(null)},style:{all:"unset",outline:"revert-layer",cursor:"pointer",display:"grid",gridTemplateColumns:"30px 1fr auto",alignItems:"center",gap:8,minHeight:23,padding:"2px 4px",borderRadius:6,opacity:I?1:.4},children:[(0,e.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",style:{display:"block",opacity:x.visible?1:.35},children:v.overview&&r?(0,e.jsx)("path",{d:"M 1 5 L 29 5",fill:"none",className:"graview-key-ribbon",stroke:"var(--graview-ink)",strokeOpacity:.35,strokeWidth:r(a,A)}):(0,e.jsx)("path",{d:"M 1 5 L 29 5",fill:"none",stroke:B(u),strokeWidth:G(u,!0),strokeDasharray:_[u.pattern],strokeLinecap:"round"})}),(0,e.jsxs)("span",{style:{display:"grid",minWidth:0},"data-graview-relation-words":i,children:[(0,e.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink)"},children:l.words}),(0,e.jsx)("span",{style:{fontSize:"0.6875rem",color:"var(--graview-ink-faint)"},children:l.ends})]}),x.visible?null:(0,e.jsx)("span",{"data-graview-quiet":i,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontStyle:"italic"},children:"not drawn"}),(0,e.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontVariantNumeric:"tabular-nums"},children:a})]},i)})]})}var ye="min(280px, calc(100% - 28px))";function we(n,r,o){let v=n.edge(r)?.from??[],y=new Map;for(let s of o!==void 0&&v.includes(o)?[o]:v.length>0?v:[""]){let p=se(n,s,r,"out");y.set(p,[...y.get(p)??[],s])}let c=s=>s==="*"?"anything":J(n,s),w=[...y].map(([s,p])=>{let f=p.flatMap(m=>n.tryDefinition(m)?.edges[r]?.to??[]),k=p[0]&&f.length>0?`${p.map(c).join(", ")} \u2192 ${(f.includes("*")?["*"]:[...new Set(f)]).map(c).join(", ")}`:"";return[s.charAt(0).toUpperCase()+s.slice(1),k]});return{words:w.map(([s])=>s).join(" \xB7 "),ends:w.flatMap(([,s])=>s?[s]:[]).join(" \xB7 ")}}function Be({edgeKind:n,kit:r,width:o=30}){let v=ee(),y=(0,O.useMemo)(()=>Q(r??v?.brand?.kit),[r,v?.brand?.kit]),{connector:c,style:w}=V(y,n);return(0,e.jsx)("svg",{width:o,height:"8","aria-hidden":"true","data-testid":"relation-mark","data-graview-relation":n,style:{display:"inline-block",verticalAlign:"middle",opacity:c.visible?1:.35},children:(0,e.jsx)("path",{d:`M 1 4 L ${o-1} 4`,fill:"none",stroke:B(w),strokeWidth:G(w,!0),strokeDasharray:_[w.pattern],strokeLinecap:"round"})})}function ke({aloft:n}){let r={display:"grid",gridTemplateColumns:"30px 1fr",alignItems:"center",gap:8,minHeight:23,padding:"2px 4px"},o={fontSize:"0.75rem",color:"var(--graview-ink-muted)"};return(0,e.jsxs)("div",{role:"group","aria-label":"The lines","data-testid":"line-manners",style:{display:"grid",gap:1,paddingBottom:6,marginBottom:4,borderBottom:"1px solid var(--graview-edge)"},children:[n?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{style:r,"data-graview-manner":"ribbon",children:[(0,e.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-ink)",strokeOpacity:.35,strokeWidth:6})}),(0,e.jsx)("span",{style:o,children:"A relation between two districts, as wide as the links along it \u2014 point at one for its words"})]}),(0,e.jsxs)("div",{style:r,"data-graview-manner":"record",children:[(0,e.jsxs)("svg",{width:"30",height:"10","aria-hidden":"true",children:[(0,e.jsx)("path",{d:"M 1 5 L 25 5",stroke:"var(--graview-accent)",strokeWidth:1.8,strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:26,cy:5,r:3,fill:"var(--graview-accent)"})]}),(0,e.jsx)("span",{style:o,children:"A chosen record's link to another record, labeled with the relation"})]}),(0,e.jsxs)("div",{style:r,"data-graview-manner":"district",children:[(0,e.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-accent)",strokeWidth:1.8,strokeDasharray:"5 4"})}),(0,e.jsx)("span",{style:o,children:"A chosen record's links into a district, with how many"})]})]}):null,(0,e.jsxs)("div",{style:r,"data-graview-manner":"unsure",children:[(0,e.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-accent)",strokeOpacity:ae,strokeWidth:1.8,strokeDasharray:re,strokeLinecap:"round"})}),(0,e.jsx)("span",{style:o,children:"Unsure: a link its maker was less than sure of, until a person keeps it \u2014 point at its words for what it was based on"})]})]})}export{Ce as a,De as b,_e as c,ye as d,Be as e,Re as f};
@@ -1 +0,0 @@
1
- import{b as Xe,c as le,d as en,e as te,g as we,h as nn,m as tn,n as re}from"./chunk.JU2ZVKMT.js";import{$a as We,A as Pe,Ab as Ue,B as ce,Ba as Be,Bb as Qe,Ca as Ze,D as ye,F as Fe,Fa as he,G as Ne,Ga as _e,U as Ce,Ua as _,Xa as He,Y as Ve,b as Re,ba as Ie,c as Ae,cb as Je,d as je,e as ee,g as ae,h as I,i as Se,ia as ge,j as Ee,k as se,l as ze,la as Ke,m as De,o as Ge,oa as Le,p as $e,q as ue,ra as qe,rb as Ye,v as Me,x as de,y as Te}from"./chunk.HLLWKSZB.js";function On(e,s){let n=e.brand??{},t=n.accent?Qe(n.accent):void 0;t&&!t.ok&&s.push(nn("brand","brand.accent",`that accent cannot make a readable brand, so the app keeps Graview's colors: ${t.why}`,"pick a color further from orange-red, or a darker one"));let p=typeof n.logo=="string"?{src:n.logo}:n.logo,d=n.name??e.name,b=n.typography?Object.fromEntries(Object.entries(n.typography).filter(([,S])=>typeof S=="string"&&!/url\(|@import|[;{}<>\\]/i.test(S)).map(([S,N])=>[S,Ue(N)])):void 0;return{name:d,schemes:t?.ok?t.schemes:Ye,...n.currency?{currency:n.currency}:{},...n.locale?{locale:n.locale}:{},...p?{logo:p.src,logoAlt:p.alt??d}:{},...n.favicon?{favicon:n.favicon}:{},...e.description?{subtitle:e.description}:{},...b?{typography:b}:{},...n.shape?{shape:n.shape}:{},...n.accents?{accents:n.accents}:{},...n.scheme?{scheme:n.scheme}:{}}}function rn(e){let{currency:s,locale:n}=e.brand??{};return{...s?{currency:s}:{},...n?{locale:n}:{}}}var pn=Symbol.for("@graview/core:typed-field"),on=(e,s)=>(/^(phone|place|duration)$/.test(s)&&(ce(e)[pn]=s),e),an=/^(?=(?:\D*\d){3})\+?[\d ()./-]+(?: *(?:ext\.?|x|#) *\d+)?$/i;var fn=new WeakMap;function sn(e,s){fn.set(e,s)}var mn=[{where:"settings[]",was:"honoured",now:"honored",since:"0.1.16"},{where:"pages",was:"overview",now:"scene",since:"0.1.17"}],F=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function dn(e,s=mn){if(!F(e))return{document:e,respelled:[]};let n=[],t=e;for(let p of s)t=ke(t,p.where.split("."),p,"",n);return{document:t,respelled:n}}function ke(e,s,n,t,p){if(s.length===0){if(!F(e)||!Object.hasOwn(e,n.was))return e;p.push(`${t}${n.was}`);let{[n.was]:K,...T}=e;return Object.hasOwn(e,n.now)?T:{...T,[n.now]:K}}if(!F(e))return e;let[d,...b]=s,S=d.endsWith("[]"),N=S?d.slice(0,-2):d,D=e[N],G=D;if(!S)G=ke(D,b,n,`${t}${N}.`,p);else if(Array.isArray(D)){let K=D.map((T,W)=>ke(T,b,n,`${t}${N}.${W}.`,p));G=K.some((T,W)=>T!==D[W])?K:D}return G===D?e:{...e,[N]:G}}var cn="graview-compiled@1",H="id",pe=e=>typeof e=="string"&&/^\$[A-Za-z][A-Za-z0-9]*$/.test(e)?e.slice(1):void 0;function un(e){let s=Object.entries(e.fields);return s.find(([,n])=>n.required&&(n.type==="string"||n.type==="text"))?.[0]??s.find(([,n])=>n.type==="string")?.[0]}function ln(e,s,n){let t;switch(e.type){case"string":case"place":t=I().check(ee(500));break;case"phone":t=I().check(ee(40),ae(an,"a phone number"));break;case"text":t=I().check(ee(2e4)),e.format&&(ce(t)[Symbol.for("@graview/core:markdown")]=1);break;case"number":case"integer":case"duration":{let d=e.min??(e.type==="duration"?0:void 0),b=[...e.type==="number"?[]:[ze()],...d===void 0?[]:[Ae(d)],...e.max===void 0?[]:[Re(e.max)],...e.step===void 0?[]:[je(e.step)]];t=b.length>0?se().check(...b):se();break}case"boolean":t=De();break;case"date":t=I().check(ae(ye,"a date like 2026-10-02"));break;case"datetime":t=I().check(Te(Fe,"a date and time like 2026-10-02T14:30:00Z"));break;case"enum":t=Me(e.options);break;case"list":t=$e(e.of==="number"?se():e.of==="date"?I().check(ae(ye)):e.of==="image"||e.of==="file"?ge(e.of):I().check(ee(500))).check(ee(200));break;case"image":case"file":t=ge(e.type);break;case"app-link":t=Ke();break;case"url":t=Ee();break;case"email":t=Se();break}let p=e.type==="number"||e.type==="integer";return on(t,p&&e.format==="duration"?"duration":e.type),e.description&&(t=t.check(Pe(e.description))),p&&(e.format==="money"||e.format==="percent"||!e.format&&e.unit)&&We(t,{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{}}),s?de(t):t}var oe=e=>{throw new _(`there is no record "${e}"`,"invalid")},yn=(e,s)=>"field"in e?ln(e.field,e.optional,s):"ref"in e?Je(e.ref):de(Ge()),gn=new WeakMap;var be=(e,s)=>F(s)&&Object.keys(e??{}).length===Object.keys(s).length&&Object.keys(e??{}).every(n=>Object.hasOwn(s,n));function Bn(e,s={}){let n=F(e)?e.format:void 0;if(n!==cn)return{ok:!1,findings:[we("compiled-format","format",n===void 0?"this is not a compiled Graview app":`this compiled app is ${JSON.stringify(n)}, and this build reads ${cn}`,"compile the document instead")]};let t=e,p=dn(t.document).document,d=p===t.document?t:{...t,document:p},b=F(p)&&typeof p.name=="string"&&F(p.kinds)&&be(p.kinds,d.kinds)&&be(p.acts,d.acts)&&be(p.rules,d.rules)&&Array.isArray(d.edges)&&Array.isArray(d.findings),S={ok:!1,findings:[we("compiled-shape","","this compiled app's parts do not match its document","compile the document instead")]};if(!b)return S;try{return hn(d,s)}catch{return S}}function hn(e,s={}){let{document:n}=e,t=s.today??Ne,p=new Map(e.edges.map(([m,r])=>[m,r])),d=new Map;for(let[m,r]of Object.entries(n.kinds)){let x=e.kinds[m]?.computed;d.set(m,{fields:new Set(Object.keys(r.fields)),edges:new Map(Object.entries(r.edges??{}).map(([v,z])=>[v,z.cardinality??"many"])),...x?{computed:new Map(x)}:{}})}e.facts&&d.set(Xe,{computed:new Map(e.facts)});let b=rn(n),S=new Map,N=Object.entries(n.kinds).map(([m,r])=>{let x={};for(let[i,y]of Object.entries(r.fields))x[i]=ln(y,!y.required,b),y.repeats&&(x[Le(i)]=de(qe()));let{label:v,describe:z,durations:C}=e.kinds[m]??{},$=Object.entries(r.computed??{}).map(([i,y])=>[i,typeof y=="string"?{expr:y}:y]),L=Object.fromEntries([...Object.entries(r.fields).filter(([,i])=>i.label).map(([i,y])=>[i,y.label]),...$.filter(([,i])=>i.label).map(([i,y])=>[i,y.label])]),q=Object.keys(L).length>0,R=Object.fromEntries(Object.entries(r.fields).filter(([,i])=>i.default!==void 0).map(([i,y])=>[i,y.default]));S.set(m,R);let w=Object.fromEntries(Object.entries(r.edges??{}).map(([i,{renamedFrom:y,...J}])=>[i,J])),A=i=>r[i]?{[i]:r[i]}:{};return Ce(m,{fields:ue(x),edges:w,...A("plural"),...A("noun"),...A("description"),...v?{label:i=>re(v,{node:i,kinds:d,today:t(),money:b})||i.id}:{},...z?{describe:i=>re(z,{node:i,kinds:d,today:t(),money:b})}:{},...A("lifecycle"),...A("figure"),...A("fieldRoles"),...A("people"),archives:r.archives,...$.length>0?{computed:Object.fromEntries($.map(([i,y])=>[i,C?.includes(i)?{...y,as:"duration"}:r.computed[i]]))}:{},...q||r.glance||r.page?{display:{...q?{labels:L}:{},...r.glance?{glance:[...r.glance]}:{},...r.page?{page:r.page}:{}}}:{},...Object.keys(R).length>0?{defaults:R}:{}})}),D=Be(N,n.computed);function G(m){return D.tryDefinition(m.kind)?.label?.(m)??m.id}let K=m=>({id:"",kind:m,...S.get(m)}),T=[];for(let[m,r]of Object.entries(n.acts??{})){let x=e.acts[m],{title:v,effects:z,guard:C,refusal:$,destructive:L,idempotent:q,creates:R,connects:w,severs:A,writes:i,writesOther:y,sets:J}=x,O=new Map(x.args),Y={};for(let[c,j]of O)Y[c]=yn(j,b);let M=[r.on??[]].flat(),Oe=new Map(x.exprs),B=z.find(c=>"create"in c),V=(c,j,g,h=null)=>{if(F(c)&&"expr"in c)return te(Oe.get(c.expr),{graph:g,subject:h,kinds:d,bindings:j,today:t()});let u=pe(c);return u===void 0?typeof c=="string"&&c.startsWith("$$")?c.slice(1):c:u==="now"?new Date().toISOString():u==="today"?t():j[u]},U=(c,j)=>{if(!B)return"";let g=n.kinds[B.create].fields,h=K(B.create),u=[];for(let[k,ne]of Object.entries(B.set??{})){try{h[k]=V(ne,c,j)??h[k]}catch{}let Q=pe(ne);Q&&c[Q]!==void 0&&u.push(k)}let P=G(h).trim(),Z=u.filter(k=>h[k]!==!1&&g[k].type!=="text"&&!(/[^]{41}/.test(h[k])||/ .*[.!?]$/.test(h[k])&&!/[ .][A-Z]\w{0,3}\.$/.test(h[k]))&&G({...h,[k]:void 0}).trim()===P).map(k=>h[k]===!0?g[k].label??Ve(k):tn(h[k],g[k].format,t(),[],b));return P&&Z.length>0?`${P} (${Z.join(", ")})`:P};T.push(He(m,{input:ue(Y),title:v,...r.description?{description:r.description}:{},...r.fromTheOtherEnd?{fromTheOtherEnd:r.fromTheOtherEnd}:{},...O.has(H)?{subject:{kinds:M.length>0?M:"*",arg:H}}:{},...L?{destructive:!0}:{},...q?{idempotent:!0}:{},...R.length>0?{creates:R}:{},...w.length>0?{connects:w}:{},...A.length>0?{severs:A}:{},writes:i,...Object.keys(y).length>0?{writesOther:y}:{},...Object.keys(J).length>0?{sets:J}:{},describe:(c,j)=>{let g=typeof c[H]=="string"?j.getNode(c[H]):void 0,h=g?G(g):U(c,j);return h?`${v}: ${h}`:v},apply(c,j){let g=c.graph,h=typeof j[H]=="string"?j[H]:void 0,u=h?g.getNode(h):void 0;if(h&&!u&&oe(h),u&&M.length>0&&!M.includes(u.kind))throw new _(`"${v}" acts on ${M.join(" or ")}, not on ${Ie(u.kind)}`,"invalid");let P={};for(let[o,a]of Object.entries(j))a!==void 0&&(P[o]=a);if(C&&u){let o;try{o=te(C,{graph:g,subject:u,kinds:d,bindings:P,today:t()})}catch(a){throw a instanceof le?new _(`"${v}" could not be judged: ${a.sentence}`):a}if(o!==!0)throw new _($?re($,{node:u,kinds:d,graph:g,bindings:P,today:t(),money:b}):`"${v}" is not allowed for ${G(u)} right now`)}let Z=new Map,k=o=>g.has(o)||[...Z.values()].includes(o),ne=new Set,Q=o=>{let a=Ze(o);ne.has(a)||(ne.add(a),c.removeEdge(o))},X=(o,a)=>{let l=pe(o);if(l==="subject")return h;if(l==="me"){let f=c.me;if(f&&n.kinds[g.getNode(f)?.kind]?.people)return f;throw new _(`"${v}" is done as you, and you have no record here`)}if(Z.has(l))return Z.get(l);try{return V(o,P,g,a??u??null)}catch(f){throw f instanceof le?new _(`"${v}" could not work out a value: ${f.sentence}`):f}};for(let o of z)if("create"in o){let a=n.kinds[o.create],l=K(o.create);for(let[me,ie]of Object.entries(o.set??{})){let xe=X(ie,void 0);xe!==void 0&&(l[me]=xe)}let f=un(a),E=c.freshId(String((f&&l[f])??o.create),o.create);c.addNode({...l,id:E}),o.as&&Z.set(o.as,E)}else if("connect"in o||"sever"in o){let a="connect"in o?o.connect:o.sever,l=String(X(o.from,void 0)??""),f=String(X(o.to,void 0)??"");if(k(l)||oe(l),k(f)||oe(f),"connect"in o){if(p.get(a)?.cardinality==="one")for(let E of g.out(l,a))E.id!==f&&Q({kind:a,from:l,to:E.id});g.out(l,a).some(E=>E.id===f)||c.addEdge({kind:a,from:l,to:f})}else Q({kind:a,from:l,to:f})}else if("set"in o){let a=String(X(o.target??"$subject",void 0)??""),l=g.getNode(a);!l&&!k(a)&&oe(a);let f={};for(let[E,me]of Object.entries(o.set)){let ie=X(me,l);ie!==void 0&&(f[E]=ie)}Object.keys(f).length>0&&c.patchNode(a,f)}else if("remove"in o){let a=String(X(o.remove,void 0)??"");g.has(a)||oe(a),c.removeNode(a)}else if("replace"in o&&u){let a=j.to;for(let l of o.replace){let f=p.get(l)?.from.includes(u.kind)??!0;for(let E of f?g.out(u.id,l):g.in(u.id,l))l===o.keep&&E.id===a||Q(f?{kind:l,from:u.id,to:E.id}:{kind:l,from:E.id,to:u.id})}}}}))}let W=[];for(let[m,r]of Object.entries(n.rules??{})){let{title:x,require:v,when:z,says:C}=e.rules[m],$=r.repairs??[],L=(R,w,A=t())=>{let i={graph:R,subject:w,kinds:d,today:A},y;try{if(z&&te(z,i)!==!0)return[];y=te(v,i)===!0}catch(O){throw O instanceof en?new _e(O.sentence):O instanceof le?new Error(O.sentence):O}if(y)return[];let J=$.flatMap(O=>{let Y=n.acts?.[O.act],M={};w&&(Y?.on||/^(edit|remove|archive|unarchive|merge|skip|detach|split)-/.test(O.act))&&(M[H]=w.id);for(let[V,U]of Object.entries(O.args??{}))M[V]=pe(U)==="subject"?w?.id:U;let B=(Y?e.acts[O.act].args:[]).filter(([V,U])=>U.required&&M[V]===void 0).map(([V])=>V);return[{mutation:O.act,label:O.label??Y?.title??O.act.replace(/-/g," "),args:M,...B.length>0?{missing:B}:{}}]});return[{invariant:m,...w?{subjectId:w.id}:{},label:x,message:C?re(C,{node:w,kinds:d,graph:R,today:A,money:b}):w?`${G(w)}: ${x}`:x,nodeIds:w?[w.id]:[],repairs:J}]},q={label:x,shape:{over:r.over,require:v,when:z,says:C,declared:n.kinds,money:b,kinds:d,today:t},judgment:{require:r.require,...r.when?{when:r.when}:{},...r.says?{says:r.says}:{}},...r.description?{description:r.description}:{},...$.length>0?{repairs:$.map(R=>R.act)}:{}};W.push(r.over==="graph"?he(m,{scope:"graph",...q,evaluate:({graph:R,today:w})=>L(R,null,w)}):he(m,{scope:{kind:r.over},...q,evaluate:({graph:R,subject:w,today:A})=>L(R,w,A)}))}let ve=n.policy&&{...n.policy,...n.roles?{roles:n.roles}:{}},fe={name:n.name,schema:D,mutations:T,invariants:W,...ve?{policy:ve}:{},...e.brand?{brand:e.brand}:{},...n.modules?{modules:n.modules}:{},...n.lenses?{lenses:n.lenses}:{},...n.pages?{pages:n.pages}:{},...n.settings?{settings:n.settings}:{},...e.viewSpecs?{viewSpecs:e.viewSpecs}:{},...e.home?{home:e.home}:{},version:n.version??1};return sn(fe,n),gn.set(fe,e),{ok:!0,app:fe,document:n,findings:e.findings,sights:n.policy?.sees,kinds:d}}export{dn as a,On as b,cn as c,H as d,pe as e,un as f,Bn as g,hn as h};
@@ -1 +0,0 @@
1
- import{C as l,J as p,Q as k,R as y,c}from"./chunk.ZEVVWWNA.js";import"./chunk.MOUGB4H6.js";import"./chunk.ONDILMIX.js";import{b as m}from"./chunk.UIIVEQAT.js";import"./chunk.GDA3G4U2.js";import"./chunk.BKPGDEES.js";import"./chunk.JNGUSAWX.js";import"./chunk.CK7QWLMX.js";import"./chunk.QNHECGMH.js";import"./chunk.KZ2376BD.js";import"./chunk.IZW7DBK4.js";import"./chunk.RKRSRKF3.js";import"./chunk.KC6UZHBM.js";import"./chunk.T4LY5QXO.js";import"./chunk.N4FBDA2W.js";import"./chunk.3G5MQFZK.js";import"./chunk.2CLPRG3I.js";import"./chunk.MB7LKKUD.js";import"./chunk.O42YET3W.js";import"./chunk.Z5V23DQN.js";import"./chunk.OHE5AMHH.js";import"./chunk.OYJSFO3A.js";import"./chunk.HV6I74DF.js";import"./chunk.WVUJXDXZ.js";import"./chunk.DAA6XWLF.js";import"./chunk.7DNFXJH3.js";import"./chunk.7PRFYYVM.js";import"./chunk.2NCTM5K2.js";import"./chunk.JU2ZVKMT.js";import"./chunk.HGAMNIST.js";import"./chunk.OQDETV4X.js";import"./chunk.ZS4DJ76C.js";import"./chunk.5R66YTET.js";import"./chunk.G4WQGTZR.js";import"./chunk.HFKMHLJ3.js";import"./chunk.GS4T26WW.js";import{F as S,G as s,I as d,M as f,V as g}from"./chunk.Z56B2JR2.js";import"./chunk.HLLWKSZB.js";import{b as n}from"./chunk.AJZBJBMO.js";var u=n(S(),1);var t=n(f(),1);function D({context:a}){let r=l(),h=g(),[w]=(0,u.useState)(()=>s(null)),o=d(h?.seatTalk??w),P=()=>{(window.history.state?.idx??0)>0?r(-1):r("/")};return(0,t.jsxs)(k,{context:a,"data-testid":"draft-page",children:[(0,t.jsx)(y,{context:a,...o.draft?{"data-testid":"draft-title"}:{},children:o.draft?o.draft.title:"Nothing drawn"}),o.draft?(0,t.jsx)(m,{page:!0,go:e=>r(e.address),onPick:e=>{let i=a.store.graph.getNode(e);i&&r(c(a.store.schema,i.kind,e))},onDiscard:P}):(0,t.jsxs)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:["Ask for a way of seeing \u2014 \u201Ca board of tasks by status\u201D \u2014 and it is drawn here."," ",(0,t.jsx)(p,{to:"/",style:{color:"var(--graview-accent)"},children:"Home \u2192"})]})]})}export{D as DraftPage};
@@ -1 +0,0 @@
1
- import{b as m}from"./chunk.VPPUTA74.js";import{a as W}from"./chunk.UT6642FC.js";import{c}from"./chunk.2CLPRG3I.js";import{h as x}from"./chunk.ZS4DJ76C.js";import{h as T}from"./chunk.GS4T26WW.js";import{F as z,M as C,U as f,W as b,la as L,oa as R}from"./chunk.Z56B2JR2.js";import{Ra as k,Y as A,wa as I}from"./chunk.HLLWKSZB.js";import{b as w}from"./chunk.AJZBJBMO.js";var u=w(z(),1);var e=w(C(),1);function H(n=4){let{store:i}=f(),p=b();return(0,u.useMemo)(()=>[...i.batches()].reverse().slice(0,n).map(a=>({intent:a.intent,author:a.author.kind,...a.author.id?{authorId:a.author.id}:{},by:a.author,...a.ops[0]?.via?{via:a.ops[0].via}:{},...a.lineage?{basis:W(a.lineage)}:{},touched:[...new Set(a.ops.filter(o=>!k(o)).flatMap(o=>o.writes))],batch:a.id,...a.ops.every(k)?{withheld:!0}:{}})),[i,p,n])}function O({batch:n}){let{store:i,principal:p,noteSeat:a}=f(),o=b(),[h,y]=(0,u.useState)(null),l=(0,u.useMemo)(()=>i.canUndo(n),[i,n,o]);if(!l.ok&&l.ops.length===0)return null;let s=!l.ok,g=s?l.includeBatches:[];return(0,e.jsxs)("span",{style:{marginLeft:"auto",flex:"0 0 auto",display:"grid",justifyItems:"end",gap:2},children:[(0,e.jsx)("button",{type:"button","data-testid":"undo-turn",title:s?`${l.message} \u2014 undo those too`:"Take this back, keeping everything since",onClick:()=>{y(null);try{let d=i.log.all().find(t=>t.batch===n&&t.author.kind==="agent");i.undo(s?[n,...g]:n,{author:p}),d&&a({type:"home",author:d.author})}catch(d){y(d instanceof Error?d.message:String(d))}},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem",...s?{borderColor:"var(--graview-warn)",color:"var(--graview-warn)"}:{}},children:s?`undo +${g.length}`:"undo"}),h?(0,e.jsx)("span",{"data-testid":"undo-refused",role:"alert",style:{fontSize:"0.75rem",lineHeight:1.4,color:"var(--graview-warn)",maxWidth:260,textAlign:"right"},children:h}):null]})}function E(){let n=()=>{let i=new URL(window.location.href);return i.searchParams.set("fresh","1"),i.toString()};return(0,e.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:i=>{i.preventDefault(),window.location.assign(n())},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",textDecoration:"underline",textDecorationColor:"var(--graview-edge-bright)",textUnderlineOffset:3},children:"Start fresh"})}function F({calls:n,seat:i,remembers:p=!1}){let a=H(),{store:o,principal:h,seats:y,people:l}=f(),s=n.some(t=>t.phase==="running"),g=R("activity"),d=g.open;return i===void 0&&n.length===0&&a.length===0&&!p?null:(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"activity-button",...g.trigger,onClick:g.toggle,title:s?"An agent is working":"What has happened",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:s?"var(--graview-accent)":"var(--graview-ink-muted)"},children:[s?(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,background:"var(--graview-accent)"}}):null,a.length>0?a.length:"",(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("circle",{cx:"8",cy:"8",r:"5.75",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),(0,e.jsx)("path",{d:"M8 4.75 V8 L10.25 9.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,e.jsx)("span",{className:"graview-activity-word",children:" Activity"})]}),!d&&i!==void 0?(0,e.jsx)("div",{hidden:!0,"data-testid":"agent-seat-seated",children:i}):null,d?(0,e.jsxs)("section",{...g.pane,"aria-label":"Activity","data-testid":"activity","data-graview-offstage":"",style:{...L,width:300,maxHeight:"min(52cqh, 460px)",overflow:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...T,margin:0},children:"Activity"}),i!==void 0?(0,e.jsxs)("div",{"data-testid":"agent-seat-row",style:{display:"grid",gap:5,paddingBottom:n.length>0||a.length>0?9:0,...n.length>0||a.length>0?{borderBottom:"1px solid var(--graview-edge)"}:{}},children:[(0,e.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"The agent's seat"}),i]}):null,n.length>0?(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:7},children:n.slice(0,6).map((t,v)=>(0,e.jsxs)("li",{style:{display:"grid",gap:2,fontSize:"0.8125rem",lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,flex:"0 0 auto",background:t.phase==="running"?"var(--graview-accent)":t.phase==="failed"?"var(--graview-warn)":"var(--graview-edge-bright)"}}),(0,e.jsxs)("span",{style:{color:"var(--graview-ink)"},children:[t.mutating?"changed":"read"," \xB7"," ",o.allMutations().find(r=>r.name===t.name)?.title??A(t.name)]})]}),!t.mutating&&t.reads&&t.reads.length>0?(0,e.jsxs)("div",{"data-testid":"activity-reads",style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:[[...new Set(t.reads)].slice(0,3).map(r=>(0,e.jsx)(c,{label:m(o,r),pickId:r},r)),new Set(t.reads).size>3?(0,e.jsxs)("span",{style:{color:"var(--graview-ink-muted)"},children:["+",new Set(t.reads).size-3]}):null]}):Object.values(t.args).some(r=>typeof r=="string")?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:Object.entries(t.args).filter(r=>typeof r[1]=="string").slice(0,3).map(([r,S])=>(0,e.jsx)(c,{label:m(o,S),pickId:S},r))}):null,t.error?(0,e.jsx)("div",{style:{paddingLeft:12,color:"var(--graview-warn)"},children:t.error}):null]},`${t.at}:${v}`))}):null,a.length>0?(0,e.jsx)("ol",{"data-testid":"diff-log",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6,fontSize:"0.8125rem"},children:a.map((t,v)=>t.withheld?(0,e.jsx)("li",{"data-testid":"withheld-change",style:{display:"grid",gap:3,lineHeight:1.45},children:(0,e.jsx)("span",{"data-touched":"",style:{color:"var(--graview-ink-muted)",fontStyle:"italic"},children:t.intent})},`change:${v}`):(0,e.jsxs)("li",{style:{display:"grid",gap:3,lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsxs)("strong",{style:{fontWeight:600},children:[t.author==="human"&&t.by?.onBehalfOf===void 0&&(t.authorId===void 0||h.id===void 0||t.authorId===h.id)?"you":I(t.by??{kind:t.author,id:t.authorId},{graph:o.graph,schema:o.schema,seats:y,people:l}),x(t.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",x(t.via)]}):null]})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:t.intent}),t.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",t.basis]}):null]}),t.batch?(0,e.jsx)(O,{batch:t.batch}):null]}),(0,e.jsx)("div",{"data-touched":t.touched.join(" "),style:{display:"flex",flexWrap:"wrap",gap:4},children:t.touched.slice(0,4).map(r=>(0,e.jsx)(c,{label:m(o,r),pickId:r},r))})]},`change:${v}`))}):null,p?(0,e.jsxs)("div",{"data-testid":"remembered",style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:10,paddingTop:8,borderTop:"1px solid var(--graview-edge)",fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:[(0,e.jsx)("span",{children:"Remembered in this browser"}),(0,e.jsx)(E,{})]}):null]}):null]})}export{F as a};