graview 0.1.26 → 0.1.27

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 (80) hide show
  1. package/dist/preview/{chunk.OBQ4DIFO.js → chunk.4JXWQO6Y.js} +1 -1
  2. package/dist/preview/{chunk.564EIRAT.js → chunk.4R7LDCDO.js} +1 -1
  3. package/dist/preview/{chunk.XNYBOKLW.js → chunk.4W24TPMR.js} +1 -1
  4. package/dist/preview/{chunk.PKFL2AR4.js → chunk.5BN2ARQ2.js} +1 -1
  5. package/dist/preview/{chunk.2GFB5FOK.js → chunk.7CO6VP6F.js} +1 -1
  6. package/dist/preview/{chunk.KXWRS6LY.js → chunk.7QTBDACG.js} +1 -1
  7. package/dist/preview/{chunk.BK2MJOUN.js → chunk.7SVIRYBB.js} +1 -1
  8. package/dist/preview/chunk.7THQFY52.js +1 -0
  9. package/dist/preview/{chunk.YXQCEXZX.js → chunk.AS35X6KA.js} +1 -1
  10. package/dist/preview/{chunk.4INXWGIT.js → chunk.ATLUMYAJ.js} +1 -1
  11. package/dist/preview/{chunk.NQP3DWME.js → chunk.CW7BMVBG.js} +1 -1
  12. package/dist/preview/{chunk.VW7U4CT5.js → chunk.DG2UE7PJ.js} +1 -1
  13. package/dist/preview/{chunk.YOMW4MKD.js → chunk.DG2WKNMX.js} +1 -1
  14. package/dist/preview/{chunk.XD4Q4FI2.js → chunk.DQ5OWYLQ.js} +1 -1
  15. package/dist/preview/{chunk.UEEXBS2U.js → chunk.DY2FFBWF.js} +1 -1
  16. package/dist/preview/chunk.E3SZ7T75.js +1 -0
  17. package/dist/preview/{chunk.NIEQZOHX.js → chunk.EVTZE2OZ.js} +1 -1
  18. package/dist/preview/{chunk.QFJRXAU3.js → chunk.FS5K4AVA.js} +2 -2
  19. package/dist/preview/{chunk.5CXMUC6R.js → chunk.FTBKJ5RZ.js} +1 -1
  20. package/dist/preview/{chunk.LLUZMOBZ.js → chunk.GHMICJIB.js} +1 -1
  21. package/dist/preview/chunk.HO6JR7VY.js +1 -0
  22. package/dist/preview/{chunk.DRIWJRQW.js → chunk.HPD3DSTP.js} +1 -1
  23. package/dist/preview/chunk.I5KD54S6.js +1 -0
  24. package/dist/preview/chunk.IXVSJJQH.js +20 -0
  25. package/dist/preview/{chunk.ZOWWWRYA.js → chunk.IZDKEFPJ.js} +1 -1
  26. package/dist/preview/chunk.J36GTQTV.js +1 -0
  27. package/dist/preview/{chunk.I5U42VDK.js → chunk.KAKX5TZN.js} +2 -2
  28. package/dist/preview/{chunk.UUMXYMOX.js → chunk.LHAAZQNQ.js} +1 -1
  29. package/dist/preview/{chunk.HFFEOCYY.js → chunk.LQZ2VQWN.js} +2 -2
  30. package/dist/preview/chunk.MHJJEGQO.js +1 -0
  31. package/dist/preview/chunk.MNPNW4BQ.js +1 -0
  32. package/dist/preview/{chunk.XXNC2AFL.js → chunk.NKIFVPS3.js} +1 -1
  33. package/dist/preview/{chunk.XOC5BRPU.js → chunk.NQNQPPPM.js} +1 -1
  34. package/dist/preview/{chunk.OBGG4SYF.js → chunk.OA5BVKJH.js} +1 -1
  35. package/dist/preview/chunk.OHGJ5BZ4.js +2 -0
  36. package/dist/preview/{chunk.SVL6I37U.js → chunk.OYULDOQP.js} +1 -1
  37. package/dist/preview/{chunk.D3XF643V.js → chunk.PHY3AH3L.js} +1 -1
  38. package/dist/preview/{chunk.ECG7RM6L.js → chunk.Q7544RCB.js} +1 -1
  39. package/dist/preview/{chunk.NLFLFIDS.js → chunk.QZWN46V6.js} +1 -1
  40. package/dist/preview/chunk.RUC4HFVC.js +1 -0
  41. package/dist/preview/chunk.S5JWZIVE.js +1 -0
  42. package/dist/preview/chunk.SHDYLMZE.js +2 -0
  43. package/dist/preview/{chunk.ECRZZ3U4.js → chunk.T2EZ5MTH.js} +1 -1
  44. package/dist/preview/chunk.TMPV4HLQ.js +1 -0
  45. package/dist/preview/{chunk.LHIYFAN5.js → chunk.TX2GOL65.js} +1 -1
  46. package/dist/preview/{chunk.AAVCTGAE.js → chunk.U5ZUXGWM.js} +1 -1
  47. package/dist/preview/chunk.UMMN5Z6V.js +1 -0
  48. package/dist/preview/chunk.UPGDSOBY.js +1 -0
  49. package/dist/preview/{chunk.MLQQR57X.js → chunk.V57P4LIZ.js} +1 -1
  50. package/dist/preview/{chunk.KSEKVHJJ.js → chunk.VD6FJ6KJ.js} +1 -1
  51. package/dist/preview/{chunk.4MAYBFPU.js → chunk.VFICMX5G.js} +1 -1
  52. package/dist/preview/chunk.VMD4PDYJ.js +1 -0
  53. package/dist/preview/chunk.VMEX2KZ4.js +8 -0
  54. package/dist/preview/{chunk.LEVR7WLB.js → chunk.XDHBV5K5.js} +1 -1
  55. package/dist/preview/{chunk.AKWBAWQF.js → chunk.YO7UFBJP.js} +1 -1
  56. package/dist/preview/{chunk.24X6LFD3.js → chunk.YV2RTNPU.js} +1 -1
  57. package/dist/preview/chunk.ZD5HGRPR.js +1 -0
  58. package/dist/preview/chunk.ZKM4P7US.js +1 -0
  59. package/dist/preview/{chunk.3RT463XY.js → chunk.ZMMMKTAG.js} +1 -1
  60. package/dist/preview/{chunk.CL7GGNEK.js → chunk.ZNIJONZN.js} +1 -1
  61. package/dist/preview/page.js +2 -2
  62. package/package.json +6 -6
  63. package/dist/preview/chunk.4YY54TMR.js +0 -1
  64. package/dist/preview/chunk.6GJF3F7L.js +0 -2
  65. package/dist/preview/chunk.6MZBFEXW.js +0 -1
  66. package/dist/preview/chunk.7OOKA2DK.js +0 -1
  67. package/dist/preview/chunk.7ZJPJARU.js +0 -1
  68. package/dist/preview/chunk.IQLDOIWD.js +0 -1
  69. package/dist/preview/chunk.JIWB6VGT.js +0 -2
  70. package/dist/preview/chunk.LCFCU3I3.js +0 -1
  71. package/dist/preview/chunk.LUUT2ZWF.js +0 -20
  72. package/dist/preview/chunk.P7YN4Z3K.js +0 -8
  73. package/dist/preview/chunk.PQ2IIC27.js +0 -1
  74. package/dist/preview/chunk.REODVRPZ.js +0 -1
  75. package/dist/preview/chunk.RH6VRP76.js +0 -1
  76. package/dist/preview/chunk.TAW67PZU.js +0 -1
  77. package/dist/preview/chunk.TUYKH4FG.js +0 -1
  78. package/dist/preview/chunk.WWWZZAHE.js +0 -1
  79. package/dist/preview/chunk.YIZ3DJO3.js +0 -1
  80. package/dist/preview/chunk.ZLPA5BAW.js +0 -1
@@ -1 +1 @@
1
- import{b as h}from"./chunk.4INXWGIT.js";import"./chunk.6GJF3F7L.js";import"./chunk.I5U42VDK.js";import"./chunk.4MAYBFPU.js";import{a as x,b as S,c as D,g as f}from"./chunk.WWWZZAHE.js";import"./chunk.QFJRXAU3.js";import"./chunk.UEEXBS2U.js";import"./chunk.6MZBFEXW.js";import"./chunk.ZLPA5BAW.js";import"./chunk.NIEQZOHX.js";import"./chunk.XOC5BRPU.js";import"./chunk.3RT463XY.js";import"./chunk.ZOWWWRYA.js";import{o as k}from"./chunk.LEVR7WLB.js";import"./chunk.WVUJXDXZ.js";import"./chunk.TAW67PZU.js";import"./chunk.YOMW4MKD.js";import"./chunk.DRIWJRQW.js";import"./chunk.KSEKVHJJ.js";import"./chunk.JIWB6VGT.js";import"./chunk.7ZJPJARU.js";import"./chunk.PKFL2AR4.js";import"./chunk.XNYBOKLW.js";import"./chunk.AHDOKM4O.js";import"./chunk.6R4EI47C.js";import"./chunk.UUMXYMOX.js";import"./chunk.D3XF643V.js";import"./chunk.NLFLFIDS.js";import"./chunk.6LJ66MB7.js";import{V as v,da as w,fa as b}from"./chunk.SVL6I37U.js";import{Fb as u,M as g}from"./chunk.P7YN4Z3K.js";import{a as V,b as y}from"./chunk.MRK6QJV5.js";import{b as p}from"./chunk.AJZBJBMO.js";var i=p(V(),1);var e=p(y(),1);function O({page:a=!1,go:C,onPick:m,onDiscard:G}){let{store:o,seatTalk:s}=w(),d=v(s),K=D(),c=C??K,{keep:N}=x(c),[T,l]=(0,i.useState)(!1);b();let t=d.draft;if((0,i.useEffect)(()=>l(!1),[t]),(0,i.useEffect)(()=>{a||S(!1)},[a]),!t)return null;let L=h(t.drawn),B=o.schema.tryDefinition(t.kind),I=o.graph.nodesOfKind(t.kind).filter(n=>g(B,n)),P=()=>{s.setDraft(null),G?.()};return(0,e.jsxs)("section",{"data-testid":"draft-frame","aria-label":`Draft: ${t.title}`,style:a?{display:"grid",gap:12,minWidth:0}:{position:"absolute",inset:0,zIndex:u("rail"),display:"grid",gridTemplateRows:"auto auto minmax(0, 1fr)",background:"var(--graview-ground, var(--graview-panel))",minHeight:0},children:[(0,e.jsxs)("p",{"data-testid":"draft-line",style:{...z,...a?{}:{padding:"10px 16px"}},children:[a?(0,e.jsx)("span",{children:"Draft"}):(0,e.jsxs)("span",{children:["Draft \u2014 ",(0,e.jsx)("span",{"data-testid":"draft-title",style:{color:"var(--graview-ink)",fontWeight:600},children:t.title})]}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-keep",disabled:T,title:`Keep \u201C${t.title}\u201D as a lens: a place of its own`,onClick:()=>{l(!0),N(t).finally(()=>l(!1))},style:f,children:"Keep as a lens"}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-discard",onClick:P,style:f,children:"Discard"})]}),d.draftNote?(0,e.jsx)("p",{"data-testid":"draft-note",role:"status",style:{margin:0,padding:a?0:"0 16px 8px",fontSize:"0.8125rem",color:"var(--graview-warn)"},children:d.draftNote}):(0,e.jsx)("span",{}),(0,e.jsx)("div",{"data-testid":"draft-lens","data-graview-draft":t.lens.name,style:a?{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",scrollbarGutter:"stable",border:"1px solid var(--graview-edge)",borderRadius:12,background:"var(--graview-panel)"}:{minHeight:0,overflow:"auto",scrollbarGutter:"stable",display:"grid",gridTemplateRows:"minmax(0, 1fr)"},onClick:n=>{let r=n.target?.closest("[data-graview-pick]")?.getAttribute("data-graview-pick");if(!r||!o.graph.getNode(r))return;n.preventDefault();let R=o.graph.getNode(r);m?(s.setDraft(null),m(r)):c({to:"record",id:r,kind:R.kind,label:r,address:"",said:""})},children:(0,e.jsx)(k,{kind:t.kind,view:t.title,children:(0,e.jsx)(L,{nodes:I,label:t.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1})})})]})}var z={margin:0,display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 8px",fontSize:"0.875rem",color:"var(--graview-ink-muted)",borderBottom:"1px solid var(--graview-edge)",paddingBottom:8};export{O as DraftFrame};
1
+ import{a as x,b as S,c as D,g as f}from"./chunk.7THQFY52.js";import{b as h}from"./chunk.ATLUMYAJ.js";import"./chunk.FS5K4AVA.js";import"./chunk.SHDYLMZE.js";import"./chunk.DY2FFBWF.js";import"./chunk.MNPNW4BQ.js";import"./chunk.I5KD54S6.js";import"./chunk.EVTZE2OZ.js";import"./chunk.NQNQPPPM.js";import"./chunk.KAKX5TZN.js";import"./chunk.VFICMX5G.js";import"./chunk.ZMMMKTAG.js";import"./chunk.IZDKEFPJ.js";import{o as k}from"./chunk.XDHBV5K5.js";import"./chunk.WVUJXDXZ.js";import"./chunk.UMMN5Z6V.js";import"./chunk.DG2WKNMX.js";import"./chunk.HPD3DSTP.js";import"./chunk.VD6FJ6KJ.js";import"./chunk.OHGJ5BZ4.js";import"./chunk.TMPV4HLQ.js";import"./chunk.5BN2ARQ2.js";import"./chunk.4W24TPMR.js";import"./chunk.AHDOKM4O.js";import"./chunk.6R4EI47C.js";import"./chunk.LHAAZQNQ.js";import"./chunk.PHY3AH3L.js";import"./chunk.QZWN46V6.js";import"./chunk.6LJ66MB7.js";import{V as v,da as w,fa as b}from"./chunk.OYULDOQP.js";import{Gb as u,N as g}from"./chunk.VMEX2KZ4.js";import{a as V,b as y}from"./chunk.MRK6QJV5.js";import{b as p}from"./chunk.AJZBJBMO.js";var i=p(V(),1);var e=p(y(),1);function O({page:a=!1,go:C,onPick:m,onDiscard:G}){let{store:o,seatTalk:s}=w(),d=v(s),K=D(),c=C??K,{keep:N}=x(c),[T,l]=(0,i.useState)(!1);b();let t=d.draft;if((0,i.useEffect)(()=>l(!1),[t]),(0,i.useEffect)(()=>{a||S(!1)},[a]),!t)return null;let L=h(t.drawn),B=o.schema.tryDefinition(t.kind),I=o.graph.nodesOfKind(t.kind).filter(n=>g(B,n)),P=()=>{s.setDraft(null),G?.()};return(0,e.jsxs)("section",{"data-testid":"draft-frame","aria-label":`Draft: ${t.title}`,style:a?{display:"grid",gap:12,minWidth:0}:{position:"absolute",inset:0,zIndex:u("rail"),display:"grid",gridTemplateRows:"auto auto minmax(0, 1fr)",background:"var(--graview-ground, var(--graview-panel))",minHeight:0},children:[(0,e.jsxs)("p",{"data-testid":"draft-line",style:{...z,...a?{}:{padding:"10px 16px"}},children:[a?(0,e.jsx)("span",{children:"Draft"}):(0,e.jsxs)("span",{children:["Draft \u2014 ",(0,e.jsx)("span",{"data-testid":"draft-title",style:{color:"var(--graview-ink)",fontWeight:600},children:t.title})]}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-keep",disabled:T,title:`Keep \u201C${t.title}\u201D as a lens: a place of its own`,onClick:()=>{l(!0),N(t).finally(()=>l(!1))},style:f,children:"Keep as a lens"}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-discard",onClick:P,style:f,children:"Discard"})]}),d.draftNote?(0,e.jsx)("p",{"data-testid":"draft-note",role:"status",style:{margin:0,padding:a?0:"0 16px 8px",fontSize:"0.8125rem",color:"var(--graview-warn)"},children:d.draftNote}):(0,e.jsx)("span",{}),(0,e.jsx)("div",{"data-testid":"draft-lens","data-graview-draft":t.lens.name,style:a?{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",scrollbarGutter:"stable",border:"1px solid var(--graview-edge)",borderRadius:12,background:"var(--graview-panel)"}:{minHeight:0,overflow:"auto",scrollbarGutter:"stable",display:"grid",gridTemplateRows:"minmax(0, 1fr)"},onClick:n=>{let r=n.target?.closest("[data-graview-pick]")?.getAttribute("data-graview-pick");if(!r||!o.graph.getNode(r))return;n.preventDefault();let R=o.graph.getNode(r);m?(s.setDraft(null),m(r)):c({to:"record",id:r,kind:R.kind,label:r,address:"",said:""})},children:(0,e.jsx)(k,{kind:t.kind,view:t.title,children:(0,e.jsx)(L,{nodes:I,label:t.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1})})})]})}var z={margin:0,display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 8px",fontSize:"0.875rem",color:"var(--graview-ink-muted)",borderBottom:"1px solid var(--graview-edge)",paddingBottom:8};export{O as DraftFrame};
@@ -1 +1 @@
1
- import{b as m}from"./chunk.7ZJPJARU.js";import{b as f}from"./chunk.XNYBOKLW.js";import{d as T}from"./chunk.6LJ66MB7.js";import{da as c,fa as b,va as L,ya as R}from"./chunk.SVL6I37U.js";import{R as A,aa as I,ba as k,pa as x}from"./chunk.P7YN4Z3K.js";import{a as W,b as C}from"./chunk.MRK6QJV5.js";import{b as w}from"./chunk.AJZBJBMO.js";var u=w(W(),1);var e=w(C(),1);function z(i=4){let{store:n}=c(),p=b();return(0,u.useMemo)(()=>[...n.batches()].reverse().slice(0,i).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}:{},touched:[...new Set(a.ops.filter(o=>!x(o)).flatMap(o=>o.writes))],batch:a.id,...a.ops.every(x)?{withheld:!0}:{}})),[n,p,i])}function H({batch:i}){let{store:n,principal:p,noteSeat:a}=c(),o=b(),[h,y]=(0,u.useState)(null),l=(0,u.useMemo)(()=>n.canUndo(i),[n,i,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=n.log.all().find(t=>t.batch===i&&t.author.kind==="agent");n.undo(s?[i,...g]:i,{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 O(){let i=()=>{let n=new URL(window.location.href);return n.searchParams.set("fresh","1"),n.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:n=>{n.preventDefault(),window.location.assign(i())},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 N({calls:i,seat:n,remembers:p=!1}){let a=z(),{store:o,principal:h,seats:y,people:l}=c(),s=i.some(t=>t.phase==="running"),g=R("activity"),d=g.open;return n===void 0&&i.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&&n!==void 0?(0,e.jsx)("div",{hidden:!0,"data-testid":"agent-seat-seated",children:n}):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"}),n!==void 0?(0,e.jsxs)("div",{"data-testid":"agent-seat-row",style:{display:"grid",gap:5,paddingBottom:i.length>0||a.length>0?9:0,...i.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"}),n]}):null,i.length>0?(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:7},children:i.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)(f,{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)(f,{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}),k(t.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",k(t.via)]}):null]})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:t.intent})]}),t.batch?(0,e.jsx)(H,{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)(f,{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)(O,{})]}):null]}):null]})}export{N as a};
1
+ import{b as m}from"./chunk.TMPV4HLQ.js";import{b as f}from"./chunk.4W24TPMR.js";import{d as T}from"./chunk.6LJ66MB7.js";import{da as c,fa as b,va as L,ya as R}from"./chunk.OYULDOQP.js";import{S as A,ba as I,ca as k,qa as x}from"./chunk.VMEX2KZ4.js";import{a as W,b as C}from"./chunk.MRK6QJV5.js";import{b as w}from"./chunk.AJZBJBMO.js";var u=w(W(),1);var e=w(C(),1);function z(i=4){let{store:n}=c(),p=b();return(0,u.useMemo)(()=>[...n.batches()].reverse().slice(0,i).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}:{},touched:[...new Set(a.ops.filter(o=>!x(o)).flatMap(o=>o.writes))],batch:a.id,...a.ops.every(x)?{withheld:!0}:{}})),[n,p,i])}function H({batch:i}){let{store:n,principal:p,noteSeat:a}=c(),o=b(),[h,y]=(0,u.useState)(null),l=(0,u.useMemo)(()=>n.canUndo(i),[n,i,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=n.log.all().find(t=>t.batch===i&&t.author.kind==="agent");n.undo(s?[i,...g]:i,{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 O(){let i=()=>{let n=new URL(window.location.href);return n.searchParams.set("fresh","1"),n.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:n=>{n.preventDefault(),window.location.assign(i())},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 N({calls:i,seat:n,remembers:p=!1}){let a=z(),{store:o,principal:h,seats:y,people:l}=c(),s=i.some(t=>t.phase==="running"),g=R("activity"),d=g.open;return n===void 0&&i.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&&n!==void 0?(0,e.jsx)("div",{hidden:!0,"data-testid":"agent-seat-seated",children:n}):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"}),n!==void 0?(0,e.jsxs)("div",{"data-testid":"agent-seat-row",style:{display:"grid",gap:5,paddingBottom:i.length>0||a.length>0?9:0,...i.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"}),n]}):null,i.length>0?(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:7},children:i.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)(f,{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)(f,{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}),k(t.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",k(t.via)]}):null]})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:t.intent})]}),t.batch?(0,e.jsx)(H,{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)(f,{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)(O,{})]}):null]}):null]})}export{N as a};
@@ -1 +1 @@
1
- import{a as f,d as y}from"./chunk.6LJ66MB7.js";import{_ as m,za as h}from"./chunk.SVL6I37U.js";import{a as k,b as u}from"./chunk.MRK6QJV5.js";import{b as g}from"./chunk.AJZBJBMO.js";var p=g(k(),1);var n=g(u(),1);var w={default:{background:"var(--graview-panel, #ffffff)",color:"var(--graview-ink, #1a1a1a)"},muted:{background:"var(--graview-panel-muted, #f7f5f1)",color:"var(--graview-ink, #1a1a1a)"},warning:{background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)"}},R={color:"var(--graview-ink-muted, #55514a)"},N={color:"var(--graview-ink-faint, #625d55)"};function z(e){let[i,t]=(0,p.useState)(!1);return(0,p.useEffect)(()=>{let a=e.current;if(!a||typeof ResizeObserver>"u")return;let o=()=>t(a.scrollHeight>a.clientHeight+1||a.scrollWidth>a.clientWidth+1);o();let d=new ResizeObserver(o);d.observe(a);for(let l of a.children)d.observe(l);return()=>d.disconnect()}),i}function C({level:e,style:i,children:t}){if(e===void 0)return(0,n.jsx)("strong",{style:i,children:t});let a=`h${e}`;return(0,n.jsx)(a,{style:{margin:0,...i},children:t})}function T({title:e,subtitle:i,meta:t,selected:a,tone:o="default",children:d,style:l,fit:s=!1,variant:b,heading:S}){let c=(0,p.useRef)(null),v=z(c),P=m(),r=(b??(P==="fullscreen"?"page":"card"))==="page";return(0,n.jsxs)("div",{"data-graview-primitive":"panel","data-graview-variant":r?"page":"card","data-selected":a||void 0,style:{display:"flex",flexDirection:"column",gap:r?12:"var(--graview-gap, 7px)",height:r||s?"auto":"100%",maxHeight:r?"none":"100%",padding:r?0:"var(--graview-pad, 15px)",boxSizing:"border-box",borderRadius:r?0:"var(--graview-radius, 12px)",border:r?"none":`1px solid ${a?"var(--graview-accent, #2f6f5e)":"var(--graview-edge, #e4e0d8)"}`,boxShadow:r?"none":a?"0 0 0 1px var(--graview-accent-dim), var(--graview-lift-low)":"var(--graview-lift-low)",overflow:r?"visible":"hidden",...w[o],...r?{background:"transparent"}:{},"--graview-panel-bg":w[o].background,...l},children:[o==="warning"?(0,n.jsx)("span",{"data-graview-broken":"",style:y,children:"Implicated in a problem."}):null,e===void 0?null:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:8,minWidth:0},children:[o==="warning"?(0,n.jsx)("span",{"aria-hidden":"true",title:"Implicated in a problem",style:{color:"var(--graview-warn)",flex:"0 0 auto"},children:"\u26A0"}):null,(0,n.jsx)(C,{level:S,style:{fontFamily:"var(--graview-font-display, inherit)",fontSize:r?"1.5625rem":"0.9375rem",lineHeight:r?1.15:1.25,fontWeight:r?600:560,letterSpacing:r?"-0.012em":"0.005em",minWidth:0,overflowWrap:"anywhere"},children:e}),t===void 0?null:(0,n.jsx)("span",{style:{marginLeft:"auto",fontSize:"0.75rem",letterSpacing:"0.08em",textTransform:"uppercase",minWidth:0,overflowWrap:"anywhere",...N},children:t})]}),i===void 0?null:(0,n.jsx)("div",{style:{fontSize:r?"0.90625rem":"0.8125rem",lineHeight:1.5,...R},children:i}),(0,n.jsx)("div",{ref:c,className:r?void 0:"graview-scroll",...v&&!r?{tabIndex:0,role:"region",...typeof e=="string"?{"aria-label":e}:{}}:{},style:{display:"flex",flexDirection:"column",gap:r?22:"var(--graview-gap, 7px)",flex:"1 1 auto",...r?{overflow:"visible"}:{}},"data-graview-overflowing":v&&!r?"":void 0,children:d})]})}function x({label:e,hue:i,selected:t,title:a,pickId:o,emphasis:d}){let l=typeof e=="string"?e:void 0,s=i===void 0?void 0:Math.round(i);return(0,n.jsxs)("span",{"data-graview-primitive":"chip","data-selected":t||void 0,"data-graview-pick":o,"data-graview-emphasis":d,title:a??l,style:{cursor:o?"pointer":void 0,display:"inline-flex",alignItems:"center",alignSelf:"flex-start",minHeight:24,boxSizing:"border-box",padding:"3px 9px",borderRadius:6,fontSize:"0.8125rem",lineHeight:1.5,whiteSpace:"nowrap",maxWidth:"min(28ch, 100%)",overflow:"hidden",letterSpacing:"0.01em",border:`1px solid ${t?"var(--graview-accent)":s===void 0?"var(--graview-edge)":`hsl(${s} 55% var(--graview-tint-lightness) / 0.45)`}`,background:s===void 0?"var(--graview-panel-muted)":`hsl(${s} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * 0.65))`,color:"var(--graview-ink, #1a1a1a)",boxShadow:t?"0 0 14px -4px var(--graview-accent)":void 0},children:[s===void 0?null:(0,n.jsx)("span",{"aria-hidden":"true",style:{width:9,height:6,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",flex:"0 0 auto",marginRight:6,background:`hsl(${s} 55% var(--graview-tint-lightness) / 0.9)`}}),(0,n.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]})}function H({items:e,max:i=8,selectedIds:t=[],pick:a=!1}){let o=e.slice(0,i),d=e.length-o.length;return(0,n.jsxs)("div",{"data-graview-primitive":"roster",style:{display:"flex",flexWrap:"wrap",gap:6,alignContent:"flex-start"},children:[o.map(l=>(0,n.jsx)(x,{label:l.label,...l.hue===void 0?{}:{hue:l.hue},...a?{pickId:l.id}:{},...l.emphasis===void 0?{}:{emphasis:l.emphasis},selected:t.includes(l.id)},l.id)),d>0?(0,n.jsx)(x,{label:`+${d} more`}):null]})}function L({label:e,count:i,items:t,onExpand:a,flagged:o}){return(0,n.jsx)(T,{title:e,meta:o?`\u26A0 ${i}`:i,tone:o?"warning":"muted",style:a?{cursor:"zoom-in"}:void 0,children:t&&t.length>0?(0,n.jsx)(H,{items:t,max:6,pick:!0}):null})}var W=h(f(()=>import("./chunk.ECG7RM6L.js"))),O=W.part((e,i)=>e.drawFiles(i),{quiet:!0});export{T as a,x as b,H as c,L as d,O as e};
1
+ import{a as f,d as y}from"./chunk.6LJ66MB7.js";import{_ as m,za as h}from"./chunk.OYULDOQP.js";import{a as k,b as u}from"./chunk.MRK6QJV5.js";import{b as g}from"./chunk.AJZBJBMO.js";var p=g(k(),1);var n=g(u(),1);var w={default:{background:"var(--graview-panel, #ffffff)",color:"var(--graview-ink, #1a1a1a)"},muted:{background:"var(--graview-panel-muted, #f7f5f1)",color:"var(--graview-ink, #1a1a1a)"},warning:{background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)"}},R={color:"var(--graview-ink-muted, #55514a)"},N={color:"var(--graview-ink-faint, #625d55)"};function z(e){let[i,t]=(0,p.useState)(!1);return(0,p.useEffect)(()=>{let a=e.current;if(!a||typeof ResizeObserver>"u")return;let o=()=>t(a.scrollHeight>a.clientHeight+1||a.scrollWidth>a.clientWidth+1);o();let d=new ResizeObserver(o);d.observe(a);for(let l of a.children)d.observe(l);return()=>d.disconnect()}),i}function C({level:e,style:i,children:t}){if(e===void 0)return(0,n.jsx)("strong",{style:i,children:t});let a=`h${e}`;return(0,n.jsx)(a,{style:{margin:0,...i},children:t})}function T({title:e,subtitle:i,meta:t,selected:a,tone:o="default",children:d,style:l,fit:s=!1,variant:b,heading:S}){let c=(0,p.useRef)(null),v=z(c),P=m(),r=(b??(P==="fullscreen"?"page":"card"))==="page";return(0,n.jsxs)("div",{"data-graview-primitive":"panel","data-graview-variant":r?"page":"card","data-selected":a||void 0,style:{display:"flex",flexDirection:"column",gap:r?12:"var(--graview-gap, 7px)",height:r||s?"auto":"100%",maxHeight:r?"none":"100%",padding:r?0:"var(--graview-pad, 15px)",boxSizing:"border-box",borderRadius:r?0:"var(--graview-radius, 12px)",border:r?"none":`1px solid ${a?"var(--graview-accent, #2f6f5e)":"var(--graview-edge, #e4e0d8)"}`,boxShadow:r?"none":a?"0 0 0 1px var(--graview-accent-dim), var(--graview-lift-low)":"var(--graview-lift-low)",overflow:r?"visible":"hidden",...w[o],...r?{background:"transparent"}:{},"--graview-panel-bg":w[o].background,...l},children:[o==="warning"?(0,n.jsx)("span",{"data-graview-broken":"",style:y,children:"Implicated in a problem."}):null,e===void 0?null:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:8,minWidth:0},children:[o==="warning"?(0,n.jsx)("span",{"aria-hidden":"true",title:"Implicated in a problem",style:{color:"var(--graview-warn)",flex:"0 0 auto"},children:"\u26A0"}):null,(0,n.jsx)(C,{level:S,style:{fontFamily:"var(--graview-font-display, inherit)",fontSize:r?"1.5625rem":"0.9375rem",lineHeight:r?1.15:1.25,fontWeight:r?600:560,letterSpacing:r?"-0.012em":"0.005em",minWidth:0,overflowWrap:"anywhere"},children:e}),t===void 0?null:(0,n.jsx)("span",{style:{marginLeft:"auto",fontSize:"0.75rem",letterSpacing:"0.08em",textTransform:"uppercase",minWidth:0,overflowWrap:"anywhere",...N},children:t})]}),i===void 0?null:(0,n.jsx)("div",{style:{fontSize:r?"0.90625rem":"0.8125rem",lineHeight:1.5,...R},children:i}),(0,n.jsx)("div",{ref:c,className:r?void 0:"graview-scroll",...v&&!r?{tabIndex:0,role:"region",...typeof e=="string"?{"aria-label":e}:{}}:{},style:{display:"flex",flexDirection:"column",gap:r?22:"var(--graview-gap, 7px)",flex:"1 1 auto",...r?{overflow:"visible"}:{}},"data-graview-overflowing":v&&!r?"":void 0,children:d})]})}function x({label:e,hue:i,selected:t,title:a,pickId:o,emphasis:d}){let l=typeof e=="string"?e:void 0,s=i===void 0?void 0:Math.round(i);return(0,n.jsxs)("span",{"data-graview-primitive":"chip","data-selected":t||void 0,"data-graview-pick":o,"data-graview-emphasis":d,title:a??l,style:{cursor:o?"pointer":void 0,display:"inline-flex",alignItems:"center",alignSelf:"flex-start",minHeight:24,boxSizing:"border-box",padding:"3px 9px",borderRadius:6,fontSize:"0.8125rem",lineHeight:1.5,whiteSpace:"nowrap",maxWidth:"min(28ch, 100%)",overflow:"hidden",letterSpacing:"0.01em",border:`1px solid ${t?"var(--graview-accent)":s===void 0?"var(--graview-edge)":`hsl(${s} 55% var(--graview-tint-lightness) / 0.45)`}`,background:s===void 0?"var(--graview-panel-muted)":`hsl(${s} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * 0.65))`,color:"var(--graview-ink, #1a1a1a)",boxShadow:t?"0 0 14px -4px var(--graview-accent)":void 0},children:[s===void 0?null:(0,n.jsx)("span",{"aria-hidden":"true",style:{width:9,height:6,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",flex:"0 0 auto",marginRight:6,background:`hsl(${s} 55% var(--graview-tint-lightness) / 0.9)`}}),(0,n.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]})}function H({items:e,max:i=8,selectedIds:t=[],pick:a=!1}){let o=e.slice(0,i),d=e.length-o.length;return(0,n.jsxs)("div",{"data-graview-primitive":"roster",style:{display:"flex",flexWrap:"wrap",gap:6,alignContent:"flex-start"},children:[o.map(l=>(0,n.jsx)(x,{label:l.label,...l.hue===void 0?{}:{hue:l.hue},...a?{pickId:l.id}:{},...l.emphasis===void 0?{}:{emphasis:l.emphasis},selected:t.includes(l.id)},l.id)),d>0?(0,n.jsx)(x,{label:`+${d} more`}):null]})}function L({label:e,count:i,items:t,onExpand:a,flagged:o}){return(0,n.jsx)(T,{title:e,meta:o?`\u26A0 ${i}`:i,tone:o?"warning":"muted",style:a?{cursor:"zoom-in"}:void 0,children:t&&t.length>0?(0,n.jsx)(H,{items:t,max:6,pick:!0}):null})}var W=h(f(()=>import("./chunk.Q7544RCB.js"))),O=W.part((e,i)=>e.drawFiles(i),{quiet:!0});export{T as a,x as b,H as c,L as d,O as e};
@@ -1 +1 @@
1
- import{a as p}from"./chunk.AHDOKM4O.js";import{lb as u}from"./chunk.P7YN4Z3K.js";import{b as c}from"./chunk.MRK6QJV5.js";import{b as h}from"./chunk.AJZBJBMO.js";var s={person:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><circle cx="11.6" cy="5.4" r="2.5"/><path d="M7.9 12.4c0-2.1 1.7-3.8 3.7-3.8s3.7 1.7 3.7 3.8v3.2H7.9z"/><path d="M8 12.6 6.4 17.2"/><path d="M15.2 12.6 16.8 17.2"/><path d="M9.8 15.6v5"/><path d="M13.4 15.6v5"/></svg>',plot:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.6 9.4 12 4.6l9.4 4.8-9.4 4.8z"/><path d="M2.6 9.4v4.4l9.4 4.8 9.4-4.8V9.4"/><path d="M12 14.2v4.4"/><path d="M7 11.9v3"/><path d="M17 11.9v3"/></svg>',box:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.4 7.9 12 3.6l8.6 4.3-8.6 4.3z"/><path d="M3.4 7.9v8.2L12 20.4l8.6-4.3V7.9"/><path d="M12 12.2v8.2"/></svg>',task:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M4.4 6.6 12 2.9l7.6 3.7v9.5L12 19.8 4.4 16.1z"/><path d="M12 12.4v7.4"/><path d="M4.4 6.6 12 10.3l7.6-3.7"/><path d="M8 9.6l2.4 2.4L16 8.4"/></svg>',shift:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.2 8.2 12 4l8.8 4.2-8.8 4.2z"/><path d="M3.2 8.2v7.2L12 19.6l8.8-4.2V8.2"/><path d="M12 12.4v7.2"/><path d="M6.6 10.8v3.4"/><path d="M9.3 12v3.4"/></svg>',list:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 10.4 12 6l9.2 4.4-9.2 4.4z"/><path d="M2.8 10.4v3.2L12 18l9.2-4.4v-3.2"/><path d="M6.6 8.6 15.8 13"/><path d="M9.4 7.2 18.6 11.6"/></svg>',vehicle:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 14.2 5 9.4l8.6-1.6 5.4 3-1 3.6z"/><path d="M2.8 14.2v2.2h2.4"/><path d="M18 16.4h1.9l.1-2.2"/><circle cx="7.6" cy="16.6" r="1.9"/><circle cx="16.1" cy="16.6" r="1.9"/><path d="M8.6 8.2 9.8 12l7.2-1"/></svg>',rule:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M5.4 19.4V6.6l12 12.8z"/><path d="M5.4 6.6 7.6 5.5l12 12.8-2.2 1.1"/><path d="M5.4 19.4 7.6 18.3h12"/><path d="M5.4 10.1h1.7"/><path d="M5.4 13.3h1.7"/><path d="M5.4 16.5h1.7"/></svg>',note:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M6.2 6.2 14.8 10.5v9L6.2 15.2z"/><path d="M12.4 9.3 14.8 10.5l-.6 2.3"/><path d="M8.2 10.6 12.8 12.9"/><path d="M8.2 13.2 11.4 14.8"/></svg>'},v=Object.keys(s);function i(e){if(e)return s[e]??(e.trimStart().startsWith("<svg")?e:void 0)}var a=h(c(),1);function B({kind:e,schema:o,brand:n,size:r=16,title:t}){let f=o?.tryDefinition?.(e)?.figure,d=i(n?.figures?.[e]??f),l=Math.round(u(e,n?.accents)),g=p(d);return d?(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"figure",dangerouslySetInnerHTML:g,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:r,height:r,flex:"0 0 auto",color:`hsl(${l} 55% 52%)`,"--graview-figure-size":`${r}px`}}):(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"dot",style:{display:"inline-block",width:Math.round(r*.8),height:Math.round(r*.5),flex:"0 0 auto",background:`hsl(${l} 55% 52%)`,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)"}})}function A(e,o,n){return i(n?.figures?.[e]??o?.tryDefinition?.(e)?.figure)!==void 0}export{B as a,A as b};
1
+ import{a as p}from"./chunk.AHDOKM4O.js";import{mb as u}from"./chunk.VMEX2KZ4.js";import{b as c}from"./chunk.MRK6QJV5.js";import{b as h}from"./chunk.AJZBJBMO.js";var s={person:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><circle cx="11.6" cy="5.4" r="2.5"/><path d="M7.9 12.4c0-2.1 1.7-3.8 3.7-3.8s3.7 1.7 3.7 3.8v3.2H7.9z"/><path d="M8 12.6 6.4 17.2"/><path d="M15.2 12.6 16.8 17.2"/><path d="M9.8 15.6v5"/><path d="M13.4 15.6v5"/></svg>',plot:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.6 9.4 12 4.6l9.4 4.8-9.4 4.8z"/><path d="M2.6 9.4v4.4l9.4 4.8 9.4-4.8V9.4"/><path d="M12 14.2v4.4"/><path d="M7 11.9v3"/><path d="M17 11.9v3"/></svg>',box:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.4 7.9 12 3.6l8.6 4.3-8.6 4.3z"/><path d="M3.4 7.9v8.2L12 20.4l8.6-4.3V7.9"/><path d="M12 12.2v8.2"/></svg>',task:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M4.4 6.6 12 2.9l7.6 3.7v9.5L12 19.8 4.4 16.1z"/><path d="M12 12.4v7.4"/><path d="M4.4 6.6 12 10.3l7.6-3.7"/><path d="M8 9.6l2.4 2.4L16 8.4"/></svg>',shift:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.2 8.2 12 4l8.8 4.2-8.8 4.2z"/><path d="M3.2 8.2v7.2L12 19.6l8.8-4.2V8.2"/><path d="M12 12.4v7.2"/><path d="M6.6 10.8v3.4"/><path d="M9.3 12v3.4"/></svg>',list:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 10.4 12 6l9.2 4.4-9.2 4.4z"/><path d="M2.8 10.4v3.2L12 18l9.2-4.4v-3.2"/><path d="M6.6 8.6 15.8 13"/><path d="M9.4 7.2 18.6 11.6"/></svg>',vehicle:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 14.2 5 9.4l8.6-1.6 5.4 3-1 3.6z"/><path d="M2.8 14.2v2.2h2.4"/><path d="M18 16.4h1.9l.1-2.2"/><circle cx="7.6" cy="16.6" r="1.9"/><circle cx="16.1" cy="16.6" r="1.9"/><path d="M8.6 8.2 9.8 12l7.2-1"/></svg>',rule:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M5.4 19.4V6.6l12 12.8z"/><path d="M5.4 6.6 7.6 5.5l12 12.8-2.2 1.1"/><path d="M5.4 19.4 7.6 18.3h12"/><path d="M5.4 10.1h1.7"/><path d="M5.4 13.3h1.7"/><path d="M5.4 16.5h1.7"/></svg>',note:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M6.2 6.2 14.8 10.5v9L6.2 15.2z"/><path d="M12.4 9.3 14.8 10.5l-.6 2.3"/><path d="M8.2 10.6 12.8 12.9"/><path d="M8.2 13.2 11.4 14.8"/></svg>'},v=Object.keys(s);function i(e){if(e)return s[e]??(e.trimStart().startsWith("<svg")?e:void 0)}var a=h(c(),1);function B({kind:e,schema:o,brand:n,size:r=16,title:t}){let f=o?.tryDefinition?.(e)?.figure,d=i(n?.figures?.[e]??f),l=Math.round(u(e,n?.accents)),g=p(d);return d?(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"figure",dangerouslySetInnerHTML:g,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:r,height:r,flex:"0 0 auto",color:`hsl(${l} 55% 52%)`,"--graview-figure-size":`${r}px`}}):(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"dot",style:{display:"inline-block",width:Math.round(r*.8),height:Math.round(r*.5),flex:"0 0 auto",background:`hsl(${l} 55% 52%)`,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)"}})}function A(e,o,n){return i(n?.figures?.[e]??o?.tryDefinition?.(e)?.figure)!==void 0}export{B as a,A as b};
@@ -1 +1 @@
1
- import{b as W}from"./chunk.BK2MJOUN.js";import{B as R,a as A,b as T,c as v,d as f,e as x,i as I,l as b,sa as k}from"./chunk.SVL6I37U.js";import{Wb as s,ta as y,ua as r}from"./chunk.P7YN4Z3K.js";import{a as H}from"./chunk.MRK6QJV5.js";import{b as B}from"./chunk.AJZBJBMO.js";var u=B(H(),1),L=e=>typeof e=="object"&&e!==null&&"idx"in e;function E(e){let n=r(window.location.pathname,e);return n===null?null:n!==s&&n!=="/"?"pages":n===s||window.location.href.includes("#")?f(window.location.hash).overview?"graview":"scene":L(window.history.state)?"pages":null}function J(e){let n=e.face??(e.stop&&v(e.stop).overview?"graview":"scene");return e.routing!=="address"||typeof window>"u"?n:E(e.basePath)??n}function K(e){return e.routing!=="address"||typeof window>"u"?!1:r(window.location.pathname,e.basePath)==="/"&&E(e.basePath)===null}function Q(e){if(typeof window>"u")return;let n=r(window.location.pathname,e);return n===s||n==="/"&&window.location.href.includes("#")?T(f(window.location.hash)):void 0}function X({basePath:e,pagesWere:n,shown:t,onFace:i,toggle:l,kinds:U,places:w,opens:$}){let{view:F,go:p}=k(),g=(0,u.useRef)({shown:t,view:F,onFace:i});g.current={shown:t,view:F,onFace:i};let S=(0,u.useRef)(n??"/"),M=()=>{S.current=`${r(window.location.pathname,e)??"/"}${window.location.search}`};return l.current=(o,c,a)=>{let{shown:d,view:N,onFace:V}=g.current;if(o==="pages"&&d!=="pages")window.history.pushState(null,"",y(c??S.current,{basePath:e}));else if(o!=="pages"&&d==="pages"){M();let m=a===void 0?N:j(v(a),w),h=Y(m)?q($):m,O=h!==m&&h.overview?"graview":o,P=_(O,h,U);p(P),window.history.pushState(null,"",`${y(s,{basePath:e})}${x(P)}`),V?.(O);return}V?.(o)},(0,u.useEffect)(()=>{let o=()=>{if(r(window.location.pathname,e)===null)return;let c=E(e)??"pages",{shown:a,onFace:d}=g.current;if(c==="pages"){a!=="pages"&&d?.("pages");return}a==="pages"&&(p(j(f(window.location.hash),w)),d?.(c))};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[e,p,w]),null}function j(e,n){let t=e.within?.view,i=t!==void 0&&!e.focusId?n.find(l=>l.as===t):void 0;return i?{...e,focusId:R(i.kind)}:e}function _(e,n,t){return e==="graview"?b(n,!0):n.overview?I(b(n,!1),W(n,t)):n}function Y(e){return e.focusId===null&&e.overview!==!0}function q(e){return e??{...A,overview:!0}}export{J as a,K as b,Q as c,X as d,j as e,_ as f,Y as g,q as h};
1
+ import{b as W}from"./chunk.7SVIRYBB.js";import{B as R,a as A,b as T,c as v,d as f,e as x,i as I,l as b,sa as k}from"./chunk.OYULDOQP.js";import{Xb as s,ua as y,va as r}from"./chunk.VMEX2KZ4.js";import{a as H}from"./chunk.MRK6QJV5.js";import{b as B}from"./chunk.AJZBJBMO.js";var u=B(H(),1),L=e=>typeof e=="object"&&e!==null&&"idx"in e;function E(e){let n=r(window.location.pathname,e);return n===null?null:n!==s&&n!=="/"?"pages":n===s||window.location.href.includes("#")?f(window.location.hash).overview?"graview":"scene":L(window.history.state)?"pages":null}function J(e){let n=e.face??(e.stop&&v(e.stop).overview?"graview":"scene");return e.routing!=="address"||typeof window>"u"?n:E(e.basePath)??n}function K(e){return e.routing!=="address"||typeof window>"u"?!1:r(window.location.pathname,e.basePath)==="/"&&E(e.basePath)===null}function Q(e){if(typeof window>"u")return;let n=r(window.location.pathname,e);return n===s||n==="/"&&window.location.href.includes("#")?T(f(window.location.hash)):void 0}function X({basePath:e,pagesWere:n,shown:t,onFace:i,toggle:l,kinds:U,places:w,opens:$}){let{view:F,go:p}=k(),g=(0,u.useRef)({shown:t,view:F,onFace:i});g.current={shown:t,view:F,onFace:i};let S=(0,u.useRef)(n??"/"),M=()=>{S.current=`${r(window.location.pathname,e)??"/"}${window.location.search}`};return l.current=(o,c,a)=>{let{shown:d,view:N,onFace:V}=g.current;if(o==="pages"&&d!=="pages")window.history.pushState(null,"",y(c??S.current,{basePath:e}));else if(o!=="pages"&&d==="pages"){M();let m=a===void 0?N:j(v(a),w),h=Y(m)?q($):m,O=h!==m&&h.overview?"graview":o,P=_(O,h,U);p(P),window.history.pushState(null,"",`${y(s,{basePath:e})}${x(P)}`),V?.(O);return}V?.(o)},(0,u.useEffect)(()=>{let o=()=>{if(r(window.location.pathname,e)===null)return;let c=E(e)??"pages",{shown:a,onFace:d}=g.current;if(c==="pages"){a!=="pages"&&d?.("pages");return}a==="pages"&&(p(j(f(window.location.hash),w)),d?.(c))};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[e,p,w]),null}function j(e,n){let t=e.within?.view,i=t!==void 0&&!e.focusId?n.find(l=>l.as===t):void 0;return i?{...e,focusId:R(i.kind)}:e}function _(e,n,t){return e==="graview"?b(n,!0):n.overview?I(b(n,!1),W(n,t)):n}function Y(e){return e.focusId===null&&e.overview!==!0}function q(e){return e??{...A,overview:!0}}export{J as a,K as b,Q as c,X as d,j as e,_ as f,Y as g,q as h};
@@ -1 +1 @@
1
- import{a as y}from"./chunk.PKFL2AR4.js";import{a as f,d as g}from"./chunk.6LJ66MB7.js";import{za as m}from"./chunk.SVL6I37U.js";import{Z as p}from"./chunk.P7YN4Z3K.js";import{a as R,b as c}from"./chunk.MRK6QJV5.js";import{b as u}from"./chunk.AJZBJBMO.js";var s=u(R(),1);var r=u(c(),1),S,h=()=>S??=m(f(()=>import("./chunk.LCFCU3I3.js")));function L(e){let[n,t]=(0,s.useState)(()=>h().current);return(0,s.useEffect)(()=>{if(!e||n)return;let i=!0;return h().load().then(a=>i&&t(a),()=>{}),()=>{i=!1}},[e,n]),n}function D(e,n){let t=L(n.length>0);return(0,s.useMemo)(()=>t?t.withLines(e,n):n,[t,e,n])}function I(e,n){let t=L(n.some(i=>i.shape));return(0,s.useMemo)(()=>{let i=new Map;if(!t)return i;for(let a of n){let l=t.ruleLine(a,e);l&&i.set(a.name,l)}return i},[t,e,n])}function M(e){let n=e.line;if(!(!n||e.message.endsWith(` \u2014 ${n.text}`)||e.message===b(e)))return e.message}function b(e){let n=e.line;return n?n.record!==void 0?`${n.record} \u2014 ${n.text}`:n.text:e.message}var P={name:{},op:{color:"var(--graview-ink-muted)",fontWeight:500},value:{fontWeight:600,fontVariantNumeric:"tabular-nums"},word:{color:"var(--graview-ink-muted)"},open:{color:"var(--graview-ink-faint)"},close:{color:"var(--graview-ink-faint)"}};function w({parts:e}){return(0,r.jsx)(r.Fragment,{children:e.map((n,t)=>(0,r.jsxs)("span",{children:[n.space?" ":"",(0,r.jsx)("span",{"data-graview-rule-part":n.as,style:P[n.as],children:n.text})]},t))})}function x(e,n){let t=p(e?.tryDefinition(n),n);return t.charAt(0).toUpperCase()+t.slice(1)}function C({line:e,schema:n,brand:t,lead:i=e.record===void 0?"kind":"record",stacked:a=!1,style:l}){let d=e.kind,o=i==="kind"?d?x(n,d):void 0:i==="record"?e.record:void 0,k=i==="kind"&&o?`${o}: ${e.said}`:i==="record"&&o?`${o} \u2014 ${e.said}`:e.said;return(0,r.jsxs)("span",{"data-graview-rule-line":"",style:{overflowWrap:"anywhere",...l},children:[(0,r.jsx)("span",{style:g,children:k}),(0,r.jsxs)("span",{"aria-hidden":"true",children:[i!=="none"&&d?(0,r.jsx)("span",{style:{display:"inline-flex",verticalAlign:"-0.1em",marginRight:"0.4em"},children:(0,r.jsx)(y,{kind:d,...n?{schema:n}:{},...t?{brand:t}:{},size:13})}):null,o?(0,r.jsxs)("span",{"data-graview-rule-head":"",style:{fontWeight:600,marginRight:i==="record"||a?0:"0.6em"},children:[o,i==="record"&&!a?(0,r.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontWeight:400},children:" \u2014 "}):null]}):null,a&&o?(0,r.jsx)("br",{}):null,(0,r.jsx)(w,{parts:e.parts}),e.when&&e.when.length>0?(0,r.jsxs)("span",{"data-graview-rule-when":"",style:{color:"var(--graview-ink-faint)"},children:[", when ",(0,r.jsx)(w,{parts:e.when})]}):null]})]})}function z(e){return e.line?e.label&&e.label.trim().length>0?e.label:void 0:e.label&&e.label!==e.message?e.label:void 0}export{D as a,I as b,M as c,b as d,C as e,z as f};
1
+ import{a as y}from"./chunk.5BN2ARQ2.js";import{a as f,d as g}from"./chunk.6LJ66MB7.js";import{za as m}from"./chunk.OYULDOQP.js";import{_ as p}from"./chunk.VMEX2KZ4.js";import{a as R,b as c}from"./chunk.MRK6QJV5.js";import{b as u}from"./chunk.AJZBJBMO.js";var s=u(R(),1);var r=u(c(),1),S,h=()=>S??=m(f(()=>import("./chunk.VMD4PDYJ.js")));function L(e){let[n,t]=(0,s.useState)(()=>h().current);return(0,s.useEffect)(()=>{if(!e||n)return;let i=!0;return h().load().then(a=>i&&t(a),()=>{}),()=>{i=!1}},[e,n]),n}function D(e,n){let t=L(n.length>0);return(0,s.useMemo)(()=>t?t.withLines(e,n):n,[t,e,n])}function I(e,n){let t=L(n.some(i=>i.shape));return(0,s.useMemo)(()=>{let i=new Map;if(!t)return i;for(let a of n){let l=t.ruleLine(a,e);l&&i.set(a.name,l)}return i},[t,e,n])}function M(e){let n=e.line;if(!(!n||e.message.endsWith(` \u2014 ${n.text}`)||e.message===b(e)))return e.message}function b(e){let n=e.line;return n?n.record!==void 0?`${n.record} \u2014 ${n.text}`:n.text:e.message}var P={name:{},op:{color:"var(--graview-ink-muted)",fontWeight:500},value:{fontWeight:600,fontVariantNumeric:"tabular-nums"},word:{color:"var(--graview-ink-muted)"},open:{color:"var(--graview-ink-faint)"},close:{color:"var(--graview-ink-faint)"}};function w({parts:e}){return(0,r.jsx)(r.Fragment,{children:e.map((n,t)=>(0,r.jsxs)("span",{children:[n.space?" ":"",(0,r.jsx)("span",{"data-graview-rule-part":n.as,style:P[n.as],children:n.text})]},t))})}function x(e,n){let t=p(e?.tryDefinition(n),n);return t.charAt(0).toUpperCase()+t.slice(1)}function C({line:e,schema:n,brand:t,lead:i=e.record===void 0?"kind":"record",stacked:a=!1,style:l}){let d=e.kind,o=i==="kind"?d?x(n,d):void 0:i==="record"?e.record:void 0,k=i==="kind"&&o?`${o}: ${e.said}`:i==="record"&&o?`${o} \u2014 ${e.said}`:e.said;return(0,r.jsxs)("span",{"data-graview-rule-line":"",style:{overflowWrap:"anywhere",...l},children:[(0,r.jsx)("span",{style:g,children:k}),(0,r.jsxs)("span",{"aria-hidden":"true",children:[i!=="none"&&d?(0,r.jsx)("span",{style:{display:"inline-flex",verticalAlign:"-0.1em",marginRight:"0.4em"},children:(0,r.jsx)(y,{kind:d,...n?{schema:n}:{},...t?{brand:t}:{},size:13})}):null,o?(0,r.jsxs)("span",{"data-graview-rule-head":"",style:{fontWeight:600,marginRight:i==="record"||a?0:"0.6em"},children:[o,i==="record"&&!a?(0,r.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontWeight:400},children:" \u2014 "}):null]}):null,a&&o?(0,r.jsx)("br",{}):null,(0,r.jsx)(w,{parts:e.parts}),e.when&&e.when.length>0?(0,r.jsxs)("span",{"data-graview-rule-when":"",style:{color:"var(--graview-ink-faint)"},children:[", when ",(0,r.jsx)(w,{parts:e.when})]}):null]})]})}function z(e){return e.line?e.label&&e.label.trim().length>0?e.label:void 0:e.label&&e.label!==e.message?e.label:void 0}export{D as a,I as b,M as c,b as d,C as e,z as f};
@@ -1 +1 @@
1
- import{e as l}from"./chunk.NQP3DWME.js";import{a as P}from"./chunk.6LJ66MB7.js";import{B as f,F as E,a as h,da as O,e as V,ja as v,k as B,l as A,ma as L,sa as H,y as x,za as R}from"./chunk.SVL6I37U.js";import{Wb as g}from"./chunk.P7YN4Z3K.js";import{a as C,b as T}from"./chunk.MRK6QJV5.js";import{b as S}from"./chunk.AJZBJBMO.js";var k=S(C(),1);var _="The whole thing",y=e=>`scene:${e.kind}:${e.as}`;function D(e){let{view:t}=e,i=new Set,n=e.places.filter(r=>e.hidden.has(r.kind)||i.has(y(r))?!1:(i.add(y(r)),!0)),a=(r,p)=>{if(r===l)return B(A(p,!0),"view",null);let w=n.find(N=>y(N)===r);return w?E(p,w.kind,w.as):null},o=[{key:l,label:_,path:`${g}${V(a(l,h))}`,group:"home"},...n.map(r=>({key:y(r),label:r.title,path:`${g}${V(a(y(r),h))}`,group:"pictures",kind:r.kind}))],s=t.within?.view,d=r=>t.focusId===f(r.kind)&&(s===void 0?n.filter(p=>p.kind===r.kind).at(-1)===r:s===r.as),c=n.find(r=>d(r)&&(s!==void 0||!t.overview));return{places:o,current:c?y(c):l,to:a}}function I(){let{views:e,hiddenKinds:t}=O(),{view:i,go:n}=H(),a=e.places(),o=(0,k.useMemo)(()=>D({places:a,hidden:t,view:i}),[a,t,i]),s=(0,k.useMemo)(()=>({go:d=>{let c=o.to(d.key,i);c&&n(c)}}),[o,i,n]);return{places:o.places,current:o.current,reach:s}}function W(e,t,i=[]){if(e.focusId)return e.focusId;let a=(e.selection??[]).map(x).find(o=>o!==null)??i.find(o=>t.includes(o))??t[0]??null;return a===null?null:f(a)}var m=S(T(),1),u=R(P(()=>import("./chunk.TUYKH4FG.js")));function G(){return u.load().then(()=>{})}var K=[{cardinality:"one",fidelity:"full",slot:"page"},{cardinality:"one",fidelity:"summary",slot:"card"},{cardinality:"one",fidelity:"glyph",slot:"row"},{cardinality:"many",fidelity:"full"},{cardinality:"many",fidelity:"summary"},{cardinality:"many",fidelity:"glyph"}];function M({schema:e,specs:t,kind:i,view:n}){let a=u.current.frameworkViews(e,t).lookup(i,{cardinality:n.cardinality,fidelity:n.fidelity});return a?(0,m.jsx)(a,{...n}):null}var b=u.part((e,t)=>(0,m.jsx)(M,{...t}),{what:"This view"});function F(e,t,i){for(let n of t.kinds){let a=i?.[n];for(let o of K){let s=c=>(0,m.jsx)(b,{schema:t,specs:i,kind:n,view:c}),d=o.slot!==void 0&&a?.[o.slot]!==void 0;d&&(s.says=(c,r)=>u.current?.frameworkViews(t,i).lookup(n,{cardinality:o.cardinality,fidelity:o.fidelity})?.says?.(c,r)),e.register(n,{cardinality:o.cardinality,fidelity:o.fidelity},d?s:v(s))}}return e}function $(e,t){return F(L(e),e,t)}export{I as a,W as b,G as c,$ as d};
1
+ import{e as l}from"./chunk.CW7BMVBG.js";import{a as P}from"./chunk.6LJ66MB7.js";import{B as f,F as E,a as h,da as O,e as V,ja as v,k as B,l as A,ma as L,sa as H,y as x,za as R}from"./chunk.OYULDOQP.js";import{Xb as g}from"./chunk.VMEX2KZ4.js";import{a as C,b as T}from"./chunk.MRK6QJV5.js";import{b as S}from"./chunk.AJZBJBMO.js";var k=S(C(),1);var _="The whole thing",y=e=>`scene:${e.kind}:${e.as}`;function D(e){let{view:t}=e,i=new Set,n=e.places.filter(r=>e.hidden.has(r.kind)||i.has(y(r))?!1:(i.add(y(r)),!0)),a=(r,p)=>{if(r===l)return B(A(p,!0),"view",null);let w=n.find(N=>y(N)===r);return w?E(p,w.kind,w.as):null},o=[{key:l,label:_,path:`${g}${V(a(l,h))}`,group:"home"},...n.map(r=>({key:y(r),label:r.title,path:`${g}${V(a(y(r),h))}`,group:"pictures",kind:r.kind}))],s=t.within?.view,d=r=>t.focusId===f(r.kind)&&(s===void 0?n.filter(p=>p.kind===r.kind).at(-1)===r:s===r.as),c=n.find(r=>d(r)&&(s!==void 0||!t.overview));return{places:o,current:c?y(c):l,to:a}}function I(){let{views:e,hiddenKinds:t}=O(),{view:i,go:n}=H(),a=e.places(),o=(0,k.useMemo)(()=>D({places:a,hidden:t,view:i}),[a,t,i]),s=(0,k.useMemo)(()=>({go:d=>{let c=o.to(d.key,i);c&&n(c)}}),[o,i,n]);return{places:o.places,current:o.current,reach:s}}function W(e,t,i=[]){if(e.focusId)return e.focusId;let a=(e.selection??[]).map(x).find(o=>o!==null)??i.find(o=>t.includes(o))??t[0]??null;return a===null?null:f(a)}var m=S(T(),1),u=R(P(()=>import("./chunk.J36GTQTV.js")));function G(){return u.load().then(()=>{})}var K=[{cardinality:"one",fidelity:"full",slot:"page"},{cardinality:"one",fidelity:"summary",slot:"card"},{cardinality:"one",fidelity:"glyph",slot:"row"},{cardinality:"many",fidelity:"full"},{cardinality:"many",fidelity:"summary"},{cardinality:"many",fidelity:"glyph"}];function M({schema:e,specs:t,kind:i,view:n}){let a=u.current.frameworkViews(e,t).lookup(i,{cardinality:n.cardinality,fidelity:n.fidelity});return a?(0,m.jsx)(a,{...n}):null}var b=u.part((e,t)=>(0,m.jsx)(M,{...t}),{what:"This view"});function F(e,t,i){for(let n of t.kinds){let a=i?.[n];for(let o of K){let s=c=>(0,m.jsx)(b,{schema:t,specs:i,kind:n,view:c}),d=o.slot!==void 0&&a?.[o.slot]!==void 0;d&&(s.says=(c,r)=>u.current?.frameworkViews(t,i).lookup(n,{cardinality:o.cardinality,fidelity:o.fidelity})?.says?.(c,r)),e.register(n,{cardinality:o.cardinality,fidelity:o.fidelity},d?s:v(s))}}return e}function $(e,t){return F(L(e),e,t)}export{I as a,W as b,G as c,$ as d};
@@ -0,0 +1 @@
1
+ import{a as je,j as Ve,l as Fe,m as Ie}from"./chunk.FS5K4AVA.js";import{b as Be}from"./chunk.MNPNW4BQ.js";import{b as Ge,e as W,f as ve}from"./chunk.EVTZE2OZ.js";import{b as qe}from"./chunk.ZMMMKTAG.js";import{d as ge,e as We,f as ye,h as _e}from"./chunk.IZDKEFPJ.js";import{b as De}from"./chunk.XDHBV5K5.js";import{a as ze}from"./chunk.TMPV4HLQ.js";import{B as Ee,D as Ne,F as He,S as Ke,T as Oe,V as oe,c as Le,da as q,i as I,k as j,l as _,q as G,qa as re,r as Re,x as Pe,y as Me}from"./chunk.OYULDOQP.js";import{P as $e,Pa as ne,Qa as me,Sa as Te,Ta as Ce,V as Ae,W as te}from"./chunk.VMEX2KZ4.js";import{a as U,b as ae}from"./chunk.MRK6QJV5.js";import{b as O}from"./chunk.AJZBJBMO.js";var Je=O(U(),1);function Qe(e,t){try{t.length===0?localStorage.removeItem(ge(e)):localStorage.setItem(ge(e),JSON.stringify(t))}catch{}}function ct(e,t){Qe(e,[...ye(e).filter(r=>r.title!==t.title),t])}function pt(e,t){Qe(e,ye(e).filter(r=>r.title!==t))}function ut(e,t){for(let r of e.places().filter(a=>a.title===t))e.forget?.(r.kind,r.as)}var ft=e=>e===!0?{written:!0}:typeof e=="object"&&e!==null?{written:e.kept===!0,...e.said?{said:e.said}:{}}:{written:!1},Ue=e=>({title:e.title,lens:e.lens,on:e.on,...e.bindings?{bindings:e.bindings}:{},...e.options?{options:e.options}:{}});function mt(e,t){let r=a=>t.some(c=>c.title===a||c.as===ne(a));if(!r(e))return e;for(let a=2;;a++)if(!r(`${e} ${a}`))return`${e} ${a}`}function Ye(e){let{store:t,views:r,brand:a,seatTalk:c,onKeepLens:l}=q(),S=(0,Je.useContext)(qe),x=We(a,t.schema),M=async p=>{let{edit:u}=p;if(p.written&&l)try{await l({op:"remove-lens",title:u.title,on:u.on})}catch{}pt(x,u.title),ut(r,u.title),S?.dismiss(`kept:${u.title}`),c.setTurns(g=>[...g.map(h=>h.kept&&h.kept.edit.title===u.title&&!h.kept.taken?{...h,kept:{...h.kept,taken:!0}}:h),{role:"seat",text:`Took \u201C${u.title}\u201D back out of the places.`}]);let s=te(t.schema,u.on);e({to:"kind",kind:u.on,title:s,address:me(t.schema,u.on),said:`Went to ${s}.`})};return{keep:async p=>{let u=mt(p.edit.title,r.places()),s={...p.edit,title:u},g=!1,h;if(l)try{({written:g,said:h}=ft(await l(s)))}catch{g=!1}g||ct(x,Ue(s)),_e(r,t.schema,[Ue(s)]);let d=r.places(),f=d.find(w=>w.title===u),A=h??(g?`Kept \u201C${u}\u201D as a lens: it is in the places now.`:l?`Kept \u201C${u}\u201D as your own lens. Ask the owner to keep it for everyone.`:`Kept \u201C${u}\u201D as your own lens.`),T={edit:s,written:g};c.setDraft(null),c.setTurns(w=>[...w,{role:"seat",text:A,kept:T}]),c.get().open||S?.notify({kind:"toast",id:`kept:${u}`,sentence:A,timeout:1e4,action:{label:"Take back",onSelect:()=>void M(T)}}),f&&e({to:"picture",kind:f.kind,as:f.as,title:u,address:Te(f.as,Ce(f,d)?me(t.schema,f.kind).slice(1):void 0),said:`Went to ${u}.`})},takeBack:M}}var Ze=O(U(),1);function gt(e,t){switch(t.to){case"place":return{view:Le("#")};case"picture":return{view:G(He(j(e,"filter",null),t.kind,t.as),[])};case"kind":{let r=Re(_({...I(e,Ee(t.kind)),relation:null},!1),!0);return{view:G(j(j(r,"view",null),"filter",t.filter??null),[])}}case"record":return{view:G(I(_(j(j(e,"view",null),"filter",null),!1),t.id),[t.id])};case"problems":return{pane:"problems"}}}function yt(e){let t=typeof document>"u"?null:document.querySelector('[data-testid="standing"]');t&&t.getAttribute("aria-expanded")==="true"!==e&&t.click()}function Xe(){let{setView:e,seatTalk:t}=q();return(0,Ze.useCallback)(r=>{t.get().draft&&t.setDraft(null),yt(r.to==="problems"),r.to!=="problems"&&e(a=>{let c=gt(a,r);return"view"in c?c.view:a})},[e,t])}var se=O(U(),1),vt=220;function ht(e,t){if(!e||!t||typeof document>"u")return null;let r=e.getBoundingClientRect(),a=document.elementFromPoint(r.left+t.x,r.top+t.y),c=a?.closest("[data-graview-pick]")?.getAttribute("data-graview-pick");return c||(a?.closest("[data-graview-view]")?.getAttribute("data-graview-view")??null)}function et({hover:e=!0}={}){let{store:t,view:r,views:a,pointer:c}=q(),{selection:l}=re(),[S,x]=(0,se.useState)(null);(0,se.useEffect)(()=>{if(!e)return;let s=null,g=!1,h=()=>typeof document<"u"&&document.querySelector("[data-graview-reach]")!==null?document.querySelector("[data-graview-settled]")===null:!1,d=()=>{if(s&&clearTimeout(s),g)return;let w=c.snapshot();if(!w){x(R=>R===null?R:null);return}s=setTimeout(()=>{if(g||h()){d();return}let R=typeof document>"u"?null:document.querySelector("[data-graview-stage]"),b=ht(R,w);x(P=>P===b?P:b)},vt)},f=()=>{g=!0,s&&clearTimeout(s)},A=()=>{g=!1,d()},T=c.subscribe(d);return document.addEventListener("pointerdown",f,!0),document.addEventListener("pointerup",A,!0),document.addEventListener("pointercancel",A,!0),d(),()=>{T(),document.removeEventListener("pointerdown",f,!0),document.removeEventListener("pointerup",A,!0),document.removeEventListener("pointercancel",A,!0),s&&clearTimeout(s)}},[c,e]);let M=s=>{let g=t.graph.getNode(s);if(g)return $e(t.schema.tryDefinition(g.kind),g);let h=je(s,t.schema);if(h)return h;let d=Me(s);if(d)return te(t.schema,d);let f=Ne(s);if(f.length>0){let A=f.map(w=>Ae(t.schema,w)),T=A.length===1?A[0]:`${A.slice(0,-1).join(", ")} and ${A.at(-1)}`;return T.charAt(0).toUpperCase()+T.slice(1)}return null},E=l[l.length-1];if(E!==void 0){let s=M(E);if(s)return{id:E,name:l.length>1?`${s} and ${l.length-1} more`:s,because:"selection"}}if(S!=null){let s=M(S);if(s)return{id:S,name:s,because:"hover"}}let p=r.within?.view,u=p?a.places().find(s=>s.as===p||ne(s.title)===p):void 0;if(u)return{id:null,name:u.title,because:"place"};if(r.focusId){let s=M(r.focusId);if(s)return{id:r.focusId,name:s,because:"place"}}return{id:null,name:"the whole thing",because:"place"}}var L=O(U(),1);var D=O(U(),1),$=O(ae(),1),B=(e,t)=>`${e}:${t}`;function tt({answer:e,said:t,onReply:r,talk:a}){let[c]=(0,D.useState)(()=>Oe(null)),l=a??c,{turns:S,outcomes:x,busy:M}=oe(l),E=(0,D.useCallback)((u,s)=>l.settle(u,s),[l]);return{turns:S,outcomes:x,busy:M,send:async u=>{let s=u.trim();if(!s||l.get().busy)return;l.setBusy(!0);let g=l.get();l.setTurns(f=>[...f,{role:"person",text:s}]);let h=g.turns.map((f,A)=>{let T=(f.proposals??[]).map((w,R)=>{let b=g.outcomes.get(B(A,R));return b?.state==="refused"?`${t(w)} \u2014 refused: ${b.error}`:b?`${b.said} \u2014 ${b.state==="applied"?"applied":"set aside"}`:t(w)});return{role:f.role,text:T.length>0?`${f.text} [Offered beneath this answer: ${T.join("; ")}]`:f.text}}),d;try{d=await e(s,{history:h})}catch(f){d={say:`That couldn't be answered: ${f instanceof Error?f.message:String(f)}`,proposals:[]}}l.setTurns(f=>[...f,{role:"seat",text:d.say,proposals:d.proposals,...d.questions?{questions:d.questions}:{},...d.picks?.length?{picks:d.picks}:{},...d.moves?.length?{moves:d.moves}:{},...d.offer?{offer:d.offer}:{},...d.unsure?{unsure:!0}:{},...d.via?{via:d.via}:{}}]),r?.(d),l.setBusy(!1)},settle:E}}var wt=e=>{let t=/^([\s\S]*?)\s*(\((?:[^()]|\([^()]*\))*\))\s*$/.exec(e);return t&&t[1]?{said:t[1],aside:t[2]}:{said:e}};function nt({turns:e,outcomes:t,busy:r,testId:a,empty:c,minHeight:l=64,maxHeight:S="min(46cqh, 400px)",renderProposal:x,renderAfter:M,renderSaid:E,ready:p=()=>!0,onApplyAll:u,applyAllLabel:s="Apply all"}){let g=(0,D.useRef)(null);return(0,D.useEffect)(()=>{g.current?.scrollTo?.({top:g.current.scrollHeight})},[e]),e.length===0&&c===null&&!r?null:(0,$.jsxs)("ol",{ref:g,style:{margin:0,padding:10,listStyle:"none",display:"grid",gap:8,alignContent:"start",maxHeight:S,minHeight:l,overflowY:"auto"},children:[e.length===0?c===null?null:(0,$.jsx)("li",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)",lineHeight:1.5},children:c}):null,e.map((h,d)=>{let f=h.proposals??[],A=f.filter((w,R)=>{let b=B(d,R),P=t.get(b);return P?.state!=="applied"&&P?.state!=="declined"&&p(w,b)}),T=wt(h.text);return(0,$.jsxs)("li",{style:{display:"grid",gap:6,justifyItems:h.role==="person"?"end":"start"},children:[h.role==="person"?(0,$.jsx)("p",{style:{margin:0,maxWidth:"85%",padding:"6px 10px",borderRadius:"12px 12px 4px 12px",fontSize:"0.875rem",lineHeight:1.45,background:"var(--graview-panel-muted)",color:"var(--graview-ink)"},children:h.text}):(0,$.jsxs)("p",{style:{margin:0,fontSize:"0.875rem",lineHeight:1.5,color:"var(--graview-ink)"},children:[E?E(h,T.said):T.said,h.via?(0,$.jsx)("span",{"data-testid":`${a}-answered-with-ai`,style:{marginLeft:6,fontSize:"0.6875rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:Ke}):null,T.aside?(0,$.jsx)("span",{style:{display:"block",marginTop:2,fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:T.aside}):null]}),M?.(h,d),f.map((w,R)=>{let b=B(d,R),P=t.get(b);return P?.state==="applied"||P?.state==="declined"?(0,$.jsx)(ie,{outcome:P,testId:a},b):(0,$.jsxs)("span",{style:{display:"grid",gap:4,justifySelf:"stretch",justifyItems:"start"},children:[x(w,{key:b,turn:d,at:R}),P?(0,$.jsx)(ie,{outcome:P,testId:a}):null]},b)}),u&&A.length>=2?(0,$.jsxs)("button",{type:"button","data-testid":`${a}-apply-all`,onClick:()=>u(d,f),title:"Take these in order; anything still missing is asked for",style:{fontSize:"0.8125rem",justifySelf:"start",fontWeight:600},children:[s," ",A.length]}):null]},d)}),r?(0,$.jsx)("li",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"thinking\u2026"}):null]})}function ie({outcome:e,testId:t}){if(e.state==="refused")return(0,$.jsxs)("span",{"data-testid":`${t}-refused`,style:{fontSize:"0.8125rem",color:"var(--graview-warn)"},children:["Refused: ",e.error]});let r=e.state==="applied";return(0,$.jsxs)("span",{"data-testid":`${t}-${e.state}`,style:{fontSize:"0.8125rem",color:r?"var(--graview-ink-muted)":"var(--graview-ink-faint)"},children:[r?(0,$.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-accent)"},children:"\u2713 "}):null,r?e.said:(0,$.jsx)("s",{children:e.said})]})}function ot({busy:e,placeholder:t,ariaLabel:r,testId:a,onSend:c}){let[l,S]=(0,D.useState)("");return(0,$.jsxs)("form",{onSubmit:x=>{x.preventDefault(),!(e||l.trim().length===0)&&(c(l),S(""))},style:{display:"flex",gap:6,padding:8,borderTop:"1px solid var(--graview-edge)"},children:[(0,$.jsx)("input",{value:l,onChange:x=>S(x.target.value),placeholder:t,"aria-label":r,"data-testid":`${a}-draft`,style:{flex:1,minWidth:0,font:"inherit",fontSize:"0.875rem",padding:"6px 9px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}),(0,$.jsx)("button",{type:"submit","data-testid":`${a}-send`,disabled:e||l.trim().length===0,style:{fontSize:"0.875rem"},children:"Send"})]})}var v=O(ae(),1),bt=/\b(?:board|kanban|timeline|calendar|gantt|who covers|covers what|coverage|floor plan|layout|draw|chart|(?:list|table) of|as an? (?:list|table|board|calendar|timeline|grid))\b/i,kt=/\b(?:group(?:ed)? by|split by|sort(?:ed)? by|order(?:ed)? by|only|call it|name it|as an? (?:board|kanban|calendar|timeline|list|table|cards|rows|grid|plan|layout)|show all|all of them|clear the filter|no filter)\b/i,St=e=>e.charAt(0).toLowerCase()+e.slice(1),xt=e=>e.to==="record"?e.label:e.to==="problems"?"problems":e.title;function $t(e,t,r){let a=[],c=e;for(let l of t){let S=xt(l),x=S?c.toLowerCase().indexOf(S.toLowerCase()):-1;x<0||(a.push(c.slice(0,x),r(l,c.slice(x,x+S.length))),c=c.slice(x+S.length))}return a.length===0?e:[...a,c]}function Qt({respond:e,onCall:t,onPick:r,testId:a="chat",empty:c,shared:l=!1,composer:S=!0,onMove:x,place:M,onDraft:E}){let{store:p,views:u,view:s,principal:g,setView:h,seatWho:d,noteSeat:f,session:A,ai:T,seatTalk:w,brand:R,app:b}=q(),P=Xe(),le=x??P,{takeBack:rt}=Ye(le),{selection:de}=re(),he=et(),we=d??"chat",z=(0,L.useMemo)(()=>({kind:"agent",id:we,session:A}),[we,A]),ce=(0,L.useRef)(void 0),V=(0,L.useMemo)(()=>Be(p,{author:{...z,...g.roles?{roles:g.roles}:{}},derive:()=>({pins:Ve()}),places:()=>u.places(),via:()=>ce.current,...b?{app:b}:{}}),[p,g,z,u,b]),st=(0,L.useMemo)(()=>e??Ie(T),[e,T]);(0,L.useEffect)(()=>t?V.onCall(t):void 0,[V,t]),De(V);let be=(0,L.useMemo)(()=>({name:R?.name??"app",schema:p.schema,...p.policy?{policy:p.policy}:{}}),[p,R]),it=async n=>{let i=w.get().draft,o=i!==null&&kt.test(n);if(!o&&!bt.test(n))return;let m=await import("./chunk.YV2RTNPU.js"),k=e?void 0:Fe(T),y={app:be,sight:m.draftSight(be,Y),...k?{complete:k}:{},...i?{lastGood:i}:{}},C=o&&i?await m.refineDraft(i,n,y):await m.draftView(n,y);if(m.isDraftFailure(C)){let K=C.lastGood??i;return K?(w.setDraft(K,C.failed),E?.(),{say:`${C.failed} The last view stays.`,proposals:[],grounded:!0}):{say:C.failed,proposals:[],grounded:!0}}return w.setDraft(C,null),E?.(),{say:`Here is ${St(C.said)} Ask to change it, or keep it as a lens.`,proposals:[],grounded:!0}},N=tt({...l?{talk:w}:{},said:n=>W(p,n),answer:async(n,i)=>{let o=await it(n);if(o)return o;let{placesFromViews:m}=await import("./chunk.GHMICJIB.js"),k=M??s.within?.view,y=u.arrangement?.(),C=p.today();return st(p,n,{...i,selection:he.id?[he.id]:de,principal:{...z,...g.roles?{roles:g.roles}:{}},places:m(p.schema,u.places(),y?{pages:y}:{}),...k?{place:k}:{},...C?{today:C}:{},...b?{app:b}:{}})},onReply:n=>{let i=n.moves?.[0];i&&le(i);let o=n.questions?.[0];f(o?{type:"asking",author:z,where:o.nodeId??null,say:`${o.nodeLabel?`${o.nodeLabel}: `:""}${o.asks}`,confidence:o.confidence}:{type:"said",author:z,say:n.say});let m=n.proposals.find(k=>!ue(k));if(m){let k=p.permits({name:m.mutation,args:{...m.args}},Y);k.ok||f({type:"refused",author:z,where:Se(m.mutation),say:k.refusal.message})}}}),{outcomes:Q,settle:pe}=N,ke=oe(w);(0,L.useEffect)(()=>{if(!l||ke.pending===null||N.busy)return;let n=w.takePending();n&&N.send(n)},[l,ke.pending,N.busy]);let Y={...z,...g.roles?{roles:g.roles}:{}},ue=n=>p.permits({name:n.mutation,args:{...n.args}},Y).ok,Se=n=>{let i=p.allMutations().find(o=>o.name===n)?.subject?.kinds;return Array.isArray(i)&&i[0]?Pe(i[0]):null},[H,Z]=(0,L.useState)(null),X=async(n,i)=>{let o=Ge(p,n),m=W(p,o),k=V.definitions.find(C=>C.act===o.mutation)?.name??o.mutation;ce.current=N.turns[Number(i.split(":")[0])]?.via;let y=await V.call(k,{...o.args}).finally(()=>{ce.current=void 0});return y.ok?(pe(i,{state:"applied",said:m}),!0):(pe(i,{state:"refused",error:y.error}),f({type:"refused",author:z,where:Se(o.mutation),say:y.error}),!1)},lt=async(n,i)=>{for(let[o,m]of i.entries()){let k=B(n,o);if(Q.get(k)?.state==="applied"||!ue(m))continue;let y=ve(p,m);if(y.length>0){Z({proposal:m,open:y,key:k});return}if(!await X(m,k))return}},ee=(0,L.useRef)(null),fe=(0,L.useRef)(null);(0,L.useLayoutEffect)(()=>{let n=fe.current;if(!n||n.isConnected||document.activeElement!==document.body)return;fe.current=null,(ee.current?.querySelector(`[data-testid="${a}-apply"]:not([disabled])`)??ee.current?.querySelector(`[data-testid="${a}-draft"]`)??ee.current?.closest("[data-testid='seat']")?.querySelector("[data-testid='seat-field']"))?.focus()});let dt=(n,i,o,m)=>{let k=p.permits({name:o.mutation,args:{...o.args}},Y);if(!k.ok)return(0,v.jsxs)("span",{"data-testid":`${a}-withheld`,style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:[(0,v.jsx)("s",{children:W(p,o)})," \u2014 ",k.refusal.message]});let y=ve(p,o),C=(N.turns[n]?.proposals??[]).slice(0,i).filter((xe,F)=>Q.get(B(n,F))?.state!=="applied").find(xe=>y.some(F=>F.kinds&&typeof o.args[F.name]=="string"&&xe.args.label===o.args[F.name])),K=W(p,o);return(0,v.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 10px"},children:[(0,v.jsxs)("span",{style:{fontSize:"0.875rem",color:"var(--graview-ink)"},title:o.why,children:[K,y.length>0&&!C?" \u2026":""]}),(0,v.jsxs)("span",{style:{display:"inline-flex",gap:6},children:[(0,v.jsx)("button",{type:"button","data-testid":`${a}-apply`,"data-graview-asks":y.length>0?y.length:void 0,disabled:C!==void 0,"aria-label":`Do it: ${K}`,onClick:()=>y.length>0?Z({proposal:o,open:y,key:m}):void X(o,m),title:C?`After \u201C${W(p,C)}\u201D`:y.length>0?`${K} \u2014 it asks for ${y.length===1?"one more thing":`${y.length} more things`}`:K,style:J,children:"Do it"}),(0,v.jsx)("button",{type:"button","data-testid":`${a}-decline`,"aria-label":`Not now: ${K}`,onClick:()=>pe(m,{state:"declined",said:K}),style:{...J,color:"var(--graview-ink-muted)"},children:"Not now"})]})]})};return(0,v.jsxs)("div",{"data-testid":`${a}-panel`,ref:ee,onFocus:n=>{fe.current=n.target},style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",alignContent:"start",gap:8,minWidth:0,minHeight:0},children:[N.turns.length===0?c??null:null,(0,v.jsx)(nt,{turns:N.turns,outcomes:Q,busy:N.busy,testId:a,minHeight:0,maxHeight:"none",empty:c!==void 0?null:(0,v.jsxs)(v.Fragment,{children:["Ask what's wrong, ask about anything by name, or say a change in its own words.",de.length>0?" \u201CThis\u201D means what you have selected.":""]}),renderProposal:(n,{key:i,turn:o,at:m})=>dt(o,m,n,i),ready:n=>ue(n),onApplyAll:(n,i)=>void lt(n,i),applyAllLabel:"Do all",renderSaid:(n,i)=>n.moves?.length?$t(i,n.moves,(o,m)=>(0,v.jsx)("button",{type:"button","data-testid":`${a}-went`,title:`Go to ${m}`,onClick:()=>le(o),style:{...at,fontSize:"inherit"},children:m},`${o.address}:${m}`)):i,renderAfter:(n,i)=>[...n.offer?[(0,v.jsx)("button",{type:"button","data-testid":`${a}-offer`,onClick:()=>w.ask(`a list of ${n.offer.draft}`),style:{...J,justifySelf:"start"},children:n.offer.label},`${i}:offer`)]:[],...n.kept&&!n.kept.taken?[(0,v.jsx)("button",{type:"button","data-testid":`${a}-take-back`,onClick:()=>void rt(n.kept),style:{...J,justifySelf:"start"},children:"Take back"},`${i}:take-back`)]:[],...n.picks?.length?[(0,v.jsx)("p",{"data-testid":`${a}-picks`,style:{margin:0,display:"flex",flexWrap:"wrap",gap:"2px 12px"},children:n.picks.map(o=>(0,v.jsx)("button",{type:"button","data-testid":`${a}-pick`,"data-chat-pick":o.id,title:o.why.field==="label"?`Go to ${o.label}`:`${o.why.reading}: ${o.why.fragment}`,onClick:()=>r?r(o.id):h(m=>G(I(_(m,!1),o.id),[o.id])),style:at,children:o.label},o.id))},`${i}:picks`)]:[],...(n.questions??[]).map(o=>{let m=`${i}:q:${o.id}`,k=Q.get(m);return(0,v.jsxs)("div",{"data-testid":`${a}-question`,"data-chat-question-node":o.nodeId,style:{display:"grid",gap:4,justifySelf:"start"},children:[(0,v.jsxs)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:[o.nodeLabel?(0,v.jsxs)("strong",{children:[o.nodeLabel,": "]}):null,o.asks,o.because==="split"?" (it could be either)":" (it was not sure)"]}),(0,v.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:o.options.map(y=>(0,v.jsxs)("button",{type:"button","data-testid":`${a}-option`,disabled:!y.call,title:y.call?y.call.why??"Take this answer":"Nothing to do for this answer",onClick:()=>y.call?void X(y.call,m):void 0,style:J,children:[y.value," ",Math.round(y.probability*100),"%"]},y.value))}),k?(0,v.jsx)(ie,{outcome:k,testId:a}):null]},o.id)})]}),H?(0,v.jsx)("div",{"data-testid":`${a}-asking`,children:(0,v.jsx)(ze,{affordance:{id:`chat:${H.proposal.mutation}`,mutation:H.proposal.mutation,label:W(p,H.proposal),provider:"llm",why:H.proposal.why??"Suggested in the conversation.",nodeIds:[],args:H.proposal.args,open:H.open,score:0},onApply:n=>{let i={...H.proposal,args:{...H.proposal.args,...n}};Z(null),X(i,H.key)},onCancel:()=>Z(null)})}):null,S?(0,v.jsx)(ot,{busy:N.busy,placeholder:de.length>0?"Ask about this\u2026":"Ask, or say a change\u2026",ariaLabel:"Ask",testId:a,onSend:n=>l?w.ask(n):void N.send(n)}):null]})}var J={font:"inherit",fontSize:"0.8125rem",minHeight:26,padding:"0 9px",borderRadius:6,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",boxShadow:"none",color:"var(--graview-ink)",cursor:"pointer"},at={font:"inherit",fontSize:"0.875rem",minHeight:24,padding:0,border:0,borderRadius:2,background:"transparent",boxShadow:"none",color:"var(--graview-accent)",textDecoration:"underline",textUnderlineOffset:3,textAlign:"start",cursor:"pointer"};export{Ye as a,yt as b,Xe as c,et as d,Qt as e,J as f,at as g};
@@ -1 +1 @@
1
- import{a as V}from"./chunk.4MAYBFPU.js";import{b as K}from"./chunk.NQP3DWME.js";import{a as ie}from"./chunk.ZOWWWRYA.js";import{l as se,m as G}from"./chunk.LEVR7WLB.js";import{f as _,g as N,h as B}from"./chunk.6R4EI47C.js";import{a as O,d as ae}from"./chunk.6LJ66MB7.js";import{V as ee,da as M,ea as te,fa as ne,qa as oe,sa as re,za as F}from"./chunk.SVL6I37U.js";import{Ab as Z,Fb as z,V as J,W as Q}from"./chunk.P7YN4Z3K.js";import{a as $,b as T}from"./chunk.MRK6QJV5.js";import{b as k}from"./chunk.AJZBJBMO.js";var i=k($(),1);var x=k(T(),1),le=336,w=16,ue=640,I=F(O(()=>import("./chunk.YIZ3DJO3.js"))),fe=I.part((t,n)=>{let s=t.SeatPanel;return(0,x.jsx)(s,{...n})},{what:"The conversation"});function xe({respond:t,onCall:n,onPick:s,start:y="field",onMove:l,place:S,onDraft:v}){let{brand:r,seatTalk:d}=M(),f=ee(d),g=r?.name?.trim()||"this app",h=(0,i.useRef)(null),o=(0,i.useRef)(null),[a,c]=(0,i.useState)(""),[m,P]=(0,i.useState)(!1),C=(0,i.useRef)(null),b=y==="hidden",p=f.open&&!b;(0,i.useEffect)(()=>b?void 0:d.drawn(),[d,b]),(0,i.useLayoutEffect)(()=>{let e=h.current?.parentElement;if(!e)return;let E=()=>P(e.getBoundingClientRect().width<ue);if(E(),typeof ResizeObserver>"u")return;let D=new ResizeObserver(E);return D.observe(e),()=>D.disconnect()},[b]),(0,i.useEffect)(()=>{typeof window<"u"&&window.dispatchEvent(new Event(ie))},[p,f.side,m]),(0,i.useEffect)(()=>{let e=h.current;if(b||p||!e||typeof window>"u")return;let E=(e.closest("[data-graview-embed]")??document.documentElement).style,D=()=>{let Y=e.getBoundingClientRect(),X=e.offsetParent?.getBoundingClientRect(),ce=X?X.bottom-Y.top:Y.height+w;E.setProperty("--graview-foot-room",`${Math.max(0,Math.round(ce+w))}px`)};D();let U=typeof ResizeObserver>"u"?null:new ResizeObserver(D);return U?.observe(e),()=>{U?.disconnect(),E.removeProperty("--graview-foot-room")}},[b,p,m,f.side]),(0,i.useEffect)(()=>{!p||f.pending===null||(j(),o.current?.focus({preventScroll:!0}))},[p,f.pending]);let j=()=>{let e=typeof document>"u"?null:document.activeElement;e instanceof HTMLElement&&e!==document.body&&!h.current?.contains(e)&&(C.current=e)},H=()=>{j(),I.prefetch(),d.setOpen(!0)},q=()=>{d.setOpen(!1);let e=C.current;C.current=null,e?.isConnected&&!(m&&e instanceof HTMLInputElement)&&e.focus({preventScroll:!0}),document.activeElement!==e&&(m?h:o).current?.focus({preventScroll:!0})};if(b)return null;let R=!m&&f.side==="right",pe=m?p?{left:0,right:0,bottom:0,padding:"8px 12px calc(12px + env(safe-area-inset-bottom, 0px))",borderRadius:"12px 12px 0 0",...de}:{left:w,right:w,bottom:`calc(${w}px + env(safe-area-inset-bottom, 0px))`}:p?{[R?"right":"left"]:w/2-1,bottom:w/2-1,width:le+w+2,padding:w/2,borderRadius:12,...de}:{[R?"right":"left"]:w,bottom:w,width:le};return(0,x.jsxs)("section",{ref:h,role:"region","aria-label":`Ask ${g}`,tabIndex:-1,"data-testid":"seat","data-graview-seat":p?"open":"closed","data-graview-seat-side":R?"right":"left","data-graview-seat-shape":m?"phone":"desk","data-graview-foot":"","data-graview-offstage":"",onMouseDown:e=>e.stopPropagation(),onKeyDown:e=>{e.key!=="Escape"||!p||(e.preventDefault(),e.stopPropagation(),q())},style:{position:"absolute",zIndex:z("rail"),boxSizing:"border-box",display:"flex",flexDirection:"column",gap:8,pointerEvents:"auto",outline:"none",...pe},children:[(0,x.jsxs)("h2",{style:{...ae,margin:0},children:["Ask ",g]}),p?(0,x.jsx)(i.Suspense,{fallback:null,children:(0,x.jsx)(fe,{phone:m,side:R?"right":"left",name:g,onClose:q,...t?{respond:t}:{},...n?{onCall:n}:{},...s?{onPick:s}:{},...l?{onMove:l}:{},...S?{place:S}:{},...v?{onDraft:v}:{}})}):null,(0,x.jsx)("form",{onSubmit:e=>{e.preventDefault();let E=a.trim();p||H(),!(!E||f.busy)&&(d.ask(E),c(""))},style:{display:"flex",margin:0},children:(0,x.jsx)("input",{ref:o,"data-testid":"seat-field",type:"text",enterKeyHint:"send",autoComplete:"off",value:a,placeholder:`Ask ${g}\u2026`,"aria-label":`Ask ${g}`,onPointerEnter:()=>I.prefetch(),onFocus:()=>I.prefetch(),onClick:()=>{p||H()},onChange:e=>{c(e.target.value),p||H()},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 de={background:"var(--graview-float)",border:"1px solid var(--graview-edge)",boxShadow:"var(--graview-lift-high)"};var W=k($(),1),L=k(T(),1),me=F(O(()=>import("./chunk.OBQ4DIFO.js"))),ge=me.part((t,n)=>{let s=t.DraftFrame;return(0,L.jsx)(s,{...n})},{what:"The view"});function Te(t){let{seatTalk:n}=M();return(0,W.useSyncExternalStore)(n.subscribe,()=>n.get().draft!==null,()=>!1)?(0,L.jsx)(W.Suspense,{fallback:null,children:(0,L.jsx)(ge,{...t})}):null}function Re(t={}){return t.scope===void 0?V:K(V,t.scope)}var A=k($(),1),u=k(T(),1);function We({inside:t=!1}={}){let{store:n,view:s,emphasis:y,setEmphasis:l}=M(),S=se(),{selection:v,set:r}=oe(),{show:d}=re(),f=ne(),g=(0,A.useMemo)(()=>{let o=new Map;for(let a of n.graph.allEdges()){let c=o.get(a.kind)??{count:0,ends:new Set};c.count+=1;for(let m of[a.from,a.to]){let P=n.graph.getNode(m);P&&c.ends.add(`kind:${P.kind}`)}o.set(a.kind,c)}return[...o.entries()].sort(([a],[c])=>a.localeCompare(c)).map(([a,c])=>({kind:a,count:c.count,ends:[...c.ends]}))},[n,f]);if((0,A.useEffect)(()=>()=>l(null),[l]),!s.overview&&!t||g.length===0)return null;let h=new Set;for(let o of v){if(o.startsWith("kind:")){h.add(o);continue}let a=n.graph.getNode(o);a&&h.add(`kind:${a.kind}`)}return(0,u.jsxs)("section",{"aria-label":"What the lines mean",role:t?"group":void 0,"data-testid":"relation-key",style:t?{display:"grid",gap:1}:{position:"absolute",left:16,top:14,zIndex:z("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:he,animation:"graview-settle 380ms 280ms ease backwards"},children:[t?null:(0,u.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:"var(--graview-ink-faint)",paddingBottom:2},children:g.length===1?"1 relation":`${g.length} relations`}),g.map(({kind:o,count:a,ends:c})=>{let{connector:m,style:P}=G(S,o),C=ye(n.schema,o),b=y!==null?y===o:h.size===0||c.some(p=>h.has(p));return(0,u.jsxs)("button",{type:"button",title:n.schema.edge(o)?.description===void 0?`${a} of these`:C.words,onMouseEnter:()=>l(o),onMouseLeave:()=>l(null),onFocus:()=>l(o),onBlur:()=>l(null),onClick:()=>{r(c),d(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:b?1:.4},children:[(0,u.jsx)("svg",{width:"30",height:"8","aria-hidden":"true",style:{display:"block",opacity:m.visible?1:.35},children:(0,u.jsx)("path",{d:"M 1 4 L 29 4",fill:"none",stroke:N(P),strokeWidth:B(P,!0),strokeDasharray:_[P.pattern],strokeLinecap:"round"})}),(0,u.jsxs)("span",{style:{display:"grid",minWidth:0},"data-graview-relation-words":o,children:[(0,u.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink)"},children:C.words}),(0,u.jsx)("span",{style:{fontSize:"0.6875rem",color:"var(--graview-ink-faint)"},children:C.ends})]}),m.visible?null:(0,u.jsx)("span",{"data-graview-quiet":o,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontStyle:"italic"},children:"not drawn"}),(0,u.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontVariantNumeric:"tabular-nums"},children:a})]},o)})]})}var he="min(280px, calc(100% - 28px))";function ye(t,n,s){let y=t.edge(n)?.from??[],l=new Map;for(let r of s!==void 0&&y.includes(s)?[s]:y.length>0?y:[""]){let d=Q(t,r,n,"out");l.set(d,[...l.get(d)??[],r])}let S=r=>r==="*"?"anything":J(t,r),v=[...l].map(([r,d])=>{let f=d.flatMap(h=>t.tryDefinition(h)?.edges[n]?.to??[]),g=d[0]&&f.length>0?`${d.map(S).join(", ")} \u2192 ${(f.includes("*")?["*"]:[...new Set(f)]).map(S).join(", ")}`:"";return[r.charAt(0).toUpperCase()+r.slice(1),g]});return{words:v.map(([r])=>r).join(" \xB7 "),ends:v.flatMap(([,r])=>r?[r]:[]).join(" \xB7 ")}}function He({edgeKind:t,kit:n,width:s=30}){let y=te(),l=(0,A.useMemo)(()=>Z(n??y?.brand?.kit),[n,y?.brand?.kit]),{connector:S,style:v}=G(l,t);return(0,u.jsx)("svg",{width:s,height:"8","aria-hidden":"true","data-testid":"relation-mark","data-graview-relation":t,style:{display:"inline-block",verticalAlign:"middle",opacity:S.visible?1:.35},children:(0,u.jsx)("path",{d:`M 1 4 L ${s-1} 4`,fill:"none",stroke:N(v),strokeWidth:B(v,!0),strokeDasharray:_[v.pattern],strokeLinecap:"round"})})}export{xe as a,Te as b,We as c,he as d,He as e,Re as f};
1
+ import{a as V}from"./chunk.VFICMX5G.js";import{b as K}from"./chunk.CW7BMVBG.js";import{a as ie}from"./chunk.IZDKEFPJ.js";import{l as se,m as G}from"./chunk.XDHBV5K5.js";import{f as _,g as N,h as B}from"./chunk.6R4EI47C.js";import{a as O,d as ae}from"./chunk.6LJ66MB7.js";import{V as ee,da as M,ea as te,fa as ne,qa as oe,sa as re,za as F}from"./chunk.OYULDOQP.js";import{Bb as Z,Gb as z,W as J,X as Q}from"./chunk.VMEX2KZ4.js";import{a as $,b as T}from"./chunk.MRK6QJV5.js";import{b as k}from"./chunk.AJZBJBMO.js";var i=k($(),1);var x=k(T(),1),le=336,w=16,ue=640,I=F(O(()=>import("./chunk.UPGDSOBY.js"))),fe=I.part((t,n)=>{let s=t.SeatPanel;return(0,x.jsx)(s,{...n})},{what:"The conversation"});function xe({respond:t,onCall:n,onPick:s,start:y="field",onMove:l,place:S,onDraft:v}){let{brand:r,seatTalk:d}=M(),f=ee(d),g=r?.name?.trim()||"this app",h=(0,i.useRef)(null),o=(0,i.useRef)(null),[a,c]=(0,i.useState)(""),[m,P]=(0,i.useState)(!1),C=(0,i.useRef)(null),b=y==="hidden",p=f.open&&!b;(0,i.useEffect)(()=>b?void 0:d.drawn(),[d,b]),(0,i.useLayoutEffect)(()=>{let e=h.current?.parentElement;if(!e)return;let E=()=>P(e.getBoundingClientRect().width<ue);if(E(),typeof ResizeObserver>"u")return;let D=new ResizeObserver(E);return D.observe(e),()=>D.disconnect()},[b]),(0,i.useEffect)(()=>{typeof window<"u"&&window.dispatchEvent(new Event(ie))},[p,f.side,m]),(0,i.useEffect)(()=>{let e=h.current;if(b||p||!e||typeof window>"u")return;let E=(e.closest("[data-graview-embed]")??document.documentElement).style,D=()=>{let Y=e.getBoundingClientRect(),X=e.offsetParent?.getBoundingClientRect(),ce=X?X.bottom-Y.top:Y.height+w;E.setProperty("--graview-foot-room",`${Math.max(0,Math.round(ce+w))}px`)};D();let U=typeof ResizeObserver>"u"?null:new ResizeObserver(D);return U?.observe(e),()=>{U?.disconnect(),E.removeProperty("--graview-foot-room")}},[b,p,m,f.side]),(0,i.useEffect)(()=>{!p||f.pending===null||(j(),o.current?.focus({preventScroll:!0}))},[p,f.pending]);let j=()=>{let e=typeof document>"u"?null:document.activeElement;e instanceof HTMLElement&&e!==document.body&&!h.current?.contains(e)&&(C.current=e)},H=()=>{j(),I.prefetch(),d.setOpen(!0)},q=()=>{d.setOpen(!1);let e=C.current;C.current=null,e?.isConnected&&!(m&&e instanceof HTMLInputElement)&&e.focus({preventScroll:!0}),document.activeElement!==e&&(m?h:o).current?.focus({preventScroll:!0})};if(b)return null;let R=!m&&f.side==="right",pe=m?p?{left:0,right:0,bottom:0,padding:"8px 12px calc(12px + env(safe-area-inset-bottom, 0px))",borderRadius:"12px 12px 0 0",...de}:{left:w,right:w,bottom:`calc(${w}px + env(safe-area-inset-bottom, 0px))`}:p?{[R?"right":"left"]:w/2-1,bottom:w/2-1,width:le+w+2,padding:w/2,borderRadius:12,...de}:{[R?"right":"left"]:w,bottom:w,width:le};return(0,x.jsxs)("section",{ref:h,role:"region","aria-label":`Ask ${g}`,tabIndex:-1,"data-testid":"seat","data-graview-seat":p?"open":"closed","data-graview-seat-side":R?"right":"left","data-graview-seat-shape":m?"phone":"desk","data-graview-foot":"","data-graview-offstage":"",onMouseDown:e=>e.stopPropagation(),onKeyDown:e=>{e.key!=="Escape"||!p||(e.preventDefault(),e.stopPropagation(),q())},style:{position:"absolute",zIndex:z("rail"),boxSizing:"border-box",display:"flex",flexDirection:"column",gap:8,pointerEvents:"auto",outline:"none",...pe},children:[(0,x.jsxs)("h2",{style:{...ae,margin:0},children:["Ask ",g]}),p?(0,x.jsx)(i.Suspense,{fallback:null,children:(0,x.jsx)(fe,{phone:m,side:R?"right":"left",name:g,onClose:q,...t?{respond:t}:{},...n?{onCall:n}:{},...s?{onPick:s}:{},...l?{onMove:l}:{},...S?{place:S}:{},...v?{onDraft:v}:{}})}):null,(0,x.jsx)("form",{onSubmit:e=>{e.preventDefault();let E=a.trim();p||H(),!(!E||f.busy)&&(d.ask(E),c(""))},style:{display:"flex",margin:0},children:(0,x.jsx)("input",{ref:o,"data-testid":"seat-field",type:"text",enterKeyHint:"send",autoComplete:"off",value:a,placeholder:`Ask ${g}\u2026`,"aria-label":`Ask ${g}`,onPointerEnter:()=>I.prefetch(),onFocus:()=>I.prefetch(),onClick:()=>{p||H()},onChange:e=>{c(e.target.value),p||H()},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 de={background:"var(--graview-float)",border:"1px solid var(--graview-edge)",boxShadow:"var(--graview-lift-high)"};var W=k($(),1),L=k(T(),1),me=F(O(()=>import("./chunk.4JXWQO6Y.js"))),ge=me.part((t,n)=>{let s=t.DraftFrame;return(0,L.jsx)(s,{...n})},{what:"The view"});function Te(t){let{seatTalk:n}=M();return(0,W.useSyncExternalStore)(n.subscribe,()=>n.get().draft!==null,()=>!1)?(0,L.jsx)(W.Suspense,{fallback:null,children:(0,L.jsx)(ge,{...t})}):null}function Re(t={}){return t.scope===void 0?V:K(V,t.scope)}var A=k($(),1),u=k(T(),1);function We({inside:t=!1}={}){let{store:n,view:s,emphasis:y,setEmphasis:l}=M(),S=se(),{selection:v,set:r}=oe(),{show:d}=re(),f=ne(),g=(0,A.useMemo)(()=>{let o=new Map;for(let a of n.graph.allEdges()){let c=o.get(a.kind)??{count:0,ends:new Set};c.count+=1;for(let m of[a.from,a.to]){let P=n.graph.getNode(m);P&&c.ends.add(`kind:${P.kind}`)}o.set(a.kind,c)}return[...o.entries()].sort(([a],[c])=>a.localeCompare(c)).map(([a,c])=>({kind:a,count:c.count,ends:[...c.ends]}))},[n,f]);if((0,A.useEffect)(()=>()=>l(null),[l]),!s.overview&&!t||g.length===0)return null;let h=new Set;for(let o of v){if(o.startsWith("kind:")){h.add(o);continue}let a=n.graph.getNode(o);a&&h.add(`kind:${a.kind}`)}return(0,u.jsxs)("section",{"aria-label":"What the lines mean",role:t?"group":void 0,"data-testid":"relation-key",style:t?{display:"grid",gap:1}:{position:"absolute",left:16,top:14,zIndex:z("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:he,animation:"graview-settle 380ms 280ms ease backwards"},children:[t?null:(0,u.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:"var(--graview-ink-faint)",paddingBottom:2},children:g.length===1?"1 relation":`${g.length} relations`}),g.map(({kind:o,count:a,ends:c})=>{let{connector:m,style:P}=G(S,o),C=ye(n.schema,o),b=y!==null?y===o:h.size===0||c.some(p=>h.has(p));return(0,u.jsxs)("button",{type:"button",title:n.schema.edge(o)?.description===void 0?`${a} of these`:C.words,onMouseEnter:()=>l(o),onMouseLeave:()=>l(null),onFocus:()=>l(o),onBlur:()=>l(null),onClick:()=>{r(c),d(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:b?1:.4},children:[(0,u.jsx)("svg",{width:"30",height:"8","aria-hidden":"true",style:{display:"block",opacity:m.visible?1:.35},children:(0,u.jsx)("path",{d:"M 1 4 L 29 4",fill:"none",stroke:N(P),strokeWidth:B(P,!0),strokeDasharray:_[P.pattern],strokeLinecap:"round"})}),(0,u.jsxs)("span",{style:{display:"grid",minWidth:0},"data-graview-relation-words":o,children:[(0,u.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink)"},children:C.words}),(0,u.jsx)("span",{style:{fontSize:"0.6875rem",color:"var(--graview-ink-faint)"},children:C.ends})]}),m.visible?null:(0,u.jsx)("span",{"data-graview-quiet":o,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontStyle:"italic"},children:"not drawn"}),(0,u.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontVariantNumeric:"tabular-nums"},children:a})]},o)})]})}var he="min(280px, calc(100% - 28px))";function ye(t,n,s){let y=t.edge(n)?.from??[],l=new Map;for(let r of s!==void 0&&y.includes(s)?[s]:y.length>0?y:[""]){let d=Q(t,r,n,"out");l.set(d,[...l.get(d)??[],r])}let S=r=>r==="*"?"anything":J(t,r),v=[...l].map(([r,d])=>{let f=d.flatMap(h=>t.tryDefinition(h)?.edges[n]?.to??[]),g=d[0]&&f.length>0?`${d.map(S).join(", ")} \u2192 ${(f.includes("*")?["*"]:[...new Set(f)]).map(S).join(", ")}`:"";return[r.charAt(0).toUpperCase()+r.slice(1),g]});return{words:v.map(([r])=>r).join(" \xB7 "),ends:v.flatMap(([,r])=>r?[r]:[]).join(" \xB7 ")}}function He({edgeKind:t,kit:n,width:s=30}){let y=te(),l=(0,A.useMemo)(()=>Z(n??y?.brand?.kit),[n,y?.brand?.kit]),{connector:S,style:v}=G(l,t);return(0,u.jsx)("svg",{width:s,height:"8","aria-hidden":"true","data-testid":"relation-mark","data-graview-relation":t,style:{display:"inline-block",verticalAlign:"middle",opacity:S.visible?1:.35},children:(0,u.jsx)("path",{d:`M 1 4 L ${s-1} 4`,fill:"none",stroke:N(v),strokeWidth:B(v,!0),strokeDasharray:_[v.pattern],strokeLinecap:"round"})})}export{xe as a,Te as b,We as c,he as d,He as e,Re as f};
@@ -1,4 +1,4 @@
1
- import{a as ft,b as Rn,c as ht}from"./chunk.6GJF3F7L.js";import{e as st,i as dt,j as ct}from"./chunk.I5U42VDK.js";import{b as $n,c as gt,d as On,e as ut,f as mt,g as pt}from"./chunk.QFJRXAU3.js";import{c as tt,d as Cn}from"./chunk.LEVR7WLB.js";import{e as nt}from"./chunk.TAW67PZU.js";import{a as Z,b as ue,c as Ae}from"./chunk.XNYBOKLW.js";import{f as lt}from"./chunk.UUMXYMOX.js";import{a as it,b as ot}from"./chunk.D3XF643V.js";import{c as rt,d as at}from"./chunk.NLFLFIDS.js";import{b as Be}from"./chunk.6LJ66MB7.js";import{Z as Xn,da as Q,fa as Zn,k as _e,ra as et,sa as Ue}from"./chunk.SVL6I37U.js";import{Eb as Re,Fa as Jn,Hb as kn,M as Ne,O as pe,T as De,U as en,V as Kn,X as xn,Y as Yn,Z as nn,ib as Qn,lb as ie,oa as Sn}from"./chunk.P7YN4Z3K.js";import{a as ze,b as J}from"./chunk.MRK6QJV5.js";import{b as G}from"./chunk.AJZBJBMO.js";var An=G(J(),1);function Ee(e,t,n){let r=e.nodes?.length??0;if(e.total===void 0||e.total<=r)return n;let a=e.nodes?.[0]?.kind,o=a?en(t,a).toLowerCase():"more";return(0,An.jsxs)("div",{style:{display:"grid",gridTemplateRows:"minmax(0, 1fr) auto",height:"100%",minHeight:0},children:[n,(0,An.jsxs)("p",{"data-testid":"lens-more",style:{margin:"4px 0 0",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["+",e.total-r," more ",o]})]})}var yt=G(J(),1),rr=(e,t)=>{if(e===!1||t===!1)return!1;let n=e===void 0||e===!0?{}:e,r=t===void 0||t===!0?{}:t;return{sort:n.sort!==!1&&r.sort!==!1,filter:n.filter!==!1&&r.filter!==!1,group:n.group!==!1&&r.group!==!1}},ar=["sort","filter","group","q"];function Ve(e,t={}){let{store:n}=Q(),{view:r,go:a}=Ue(),o=e.nodes??[],g=t.subject??(t.only?o.filter(t.only):o),y=t.subject?[]:t.only?o.filter(i=>!t.only(i)):[],c=t.kind??g[0]?.kind,v=rr(t.allow,t.lensAllows),p=ar.some(i=>r.within?.[i]!==void 0)?it(r):t.arrangedBy??{},d=c?Jn(n.schema,String(c)):void 0,m=d?rt(p,d).arrangement:{},s=at(g,v===!1?{}:m,{schema:n.schema,graph:n.graph,flagged:new Set(e.flagged??[])}),w=c&&v!==!1&&e.fidelity==="full"&&e.budget===void 0&&g.length>1?(0,yt.jsx)(lt,{schema:n.schema,graph:n.graph,kind:String(c),arrangement:m,allow:v,query:t.query!==!1,onChange:i=>a(ot(r,i)),kept:{shown:s.nodes.length,of:g.length}}):null;return{nodes:[...y,...s.nodes],arranged:s,arrangement:m,bar:w}}function Ke(e,t,n){let r=new Set((n??[]).map(o=>o.kind)),a=new Set((n??[]).map(o=>o.id));return e.allNodes().filter(o=>r.has(o.kind)?a.has(o.id):Ne(t.tryDefinition(o.kind),o))}var Me=G(ze(),1);var T=G(J(),1),ir=["slots","x","y","fill"],tn=class extends Error{constructor(n,r){super(`${n}
1
+ import{b as $n,c as gt,d as On,e as ut,f as mt,g as pt}from"./chunk.FS5K4AVA.js";import{a as ft,b as Rn,c as ht}from"./chunk.SHDYLMZE.js";import{e as st,i as dt,j as ct}from"./chunk.KAKX5TZN.js";import{c as tt,d as Cn}from"./chunk.XDHBV5K5.js";import{e as nt}from"./chunk.UMMN5Z6V.js";import{a as Z,b as ue,c as Ae}from"./chunk.4W24TPMR.js";import{f as lt}from"./chunk.LHAAZQNQ.js";import{a as it,b as ot}from"./chunk.PHY3AH3L.js";import{c as rt,d as at}from"./chunk.QZWN46V6.js";import{b as Be}from"./chunk.6LJ66MB7.js";import{Z as Xn,da as Q,fa as Zn,k as _e,ra as et,sa as Ue}from"./chunk.OYULDOQP.js";import{Fb as Re,Ga as Jn,Ib as kn,N as Ne,P as pe,U as De,V as en,W as Kn,Y as xn,Z as Yn,_ as nn,jb as Qn,mb as ie,pa as Sn}from"./chunk.VMEX2KZ4.js";import{a as ze,b as J}from"./chunk.MRK6QJV5.js";import{b as G}from"./chunk.AJZBJBMO.js";var An=G(J(),1);function Ee(e,t,n){let r=e.nodes?.length??0;if(e.total===void 0||e.total<=r)return n;let a=e.nodes?.[0]?.kind,o=a?en(t,a).toLowerCase():"more";return(0,An.jsxs)("div",{style:{display:"grid",gridTemplateRows:"minmax(0, 1fr) auto",height:"100%",minHeight:0},children:[n,(0,An.jsxs)("p",{"data-testid":"lens-more",style:{margin:"4px 0 0",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["+",e.total-r," more ",o]})]})}var yt=G(J(),1),rr=(e,t)=>{if(e===!1||t===!1)return!1;let n=e===void 0||e===!0?{}:e,r=t===void 0||t===!0?{}:t;return{sort:n.sort!==!1&&r.sort!==!1,filter:n.filter!==!1&&r.filter!==!1,group:n.group!==!1&&r.group!==!1}},ar=["sort","filter","group","q"];function Ve(e,t={}){let{store:n}=Q(),{view:r,go:a}=Ue(),o=e.nodes??[],g=t.subject??(t.only?o.filter(t.only):o),y=t.subject?[]:t.only?o.filter(i=>!t.only(i)):[],c=t.kind??g[0]?.kind,v=rr(t.allow,t.lensAllows),p=ar.some(i=>r.within?.[i]!==void 0)?it(r):t.arrangedBy??{},d=c?Jn(n.schema,String(c)):void 0,m=d?rt(p,d).arrangement:{},s=at(g,v===!1?{}:m,{schema:n.schema,graph:n.graph,flagged:new Set(e.flagged??[])}),w=c&&v!==!1&&e.fidelity==="full"&&e.budget===void 0&&g.length>1?(0,yt.jsx)(lt,{schema:n.schema,graph:n.graph,kind:String(c),arrangement:m,allow:v,query:t.query!==!1,onChange:i=>a(ot(r,i)),kept:{shown:s.nodes.length,of:g.length}}):null;return{nodes:[...y,...s.nodes],arranged:s,arrangement:m,bar:w}}function Ke(e,t,n){let r=new Set((n??[]).map(o=>o.kind)),a=new Set((n??[]).map(o=>o.id));return e.allNodes().filter(o=>r.has(o.kind)?a.has(o.id):Ne(t.tryDefinition(o.kind),o))}var Me=G(ze(),1);var T=G(J(),1),ir=["slots","x","y","fill"],tn=class extends Error{constructor(n,r){super(`${n}
2
2
  ${r}`);this.hint=r;this.name="BoardBindingError"}},wt=e=>Math.max(0,Math.min(1,e));function En(e,t,n,r){let a=s=>s,o=s=>r?pe(r.tryDefinition(s.kind),s):String(a(s).label??s.id);if(r&&r.tryDefinition(n.slots)===void 0)throw new tn(`No kind is declared for "${n.slots}".`,'Check the lens bindings: { slots: "<kind>", x: "<field>", y: "<field>", fill: "<edge kind>" }');let g=e.filter(s=>s.kind===n.slots);if(!r&&g.length===0)throw new tn(`Nothing to arrange: no "${n.slots}" nodes.`,'Check the lens bindings: { slots: "<kind>", x: "<field>", y: "<field>", fill: "<edge kind>" }');let y=t.filter(s=>s.kind===n.fill),c=new Map(e.map(s=>[s.id,s])),v=new Map(e.map((s,w)=>[s.id,w])),l=g.map(s=>{let w=a(s),i=n.fillFrom==="occupant",x=y.filter(S=>(i?S.to:S.from)===s.id).map(S=>c.get(i?S.from:S.to)).filter(S=>S!==void 0).sort((S,$)=>(v.get(S.id)??0)-(v.get($.id)??0)).map(S=>({id:S.id,label:o(S)}));return{id:s.id,code:String(w[n.slotCode??""]??"").trim()||o(s),label:o(s),x:wt(Number(w[n.x]??.5)),y:wt(Number(w[n.y]??.5)),occupants:x}}).sort((s,w)=>s.y-w.y||s.x-w.x),p=new Set(l.flatMap(s=>s.occupants.map(w=>w.id))),d=new Set([...p].map(s=>c.get(s)?.kind).filter(s=>s!==void 0)),m=e.filter(s=>d.has(s.kind)&&!p.has(s.id)).map(s=>({id:s.id,label:o(s)})).sort((s,w)=>s.label<w.label?-1:s.label>w.label?1:0);return{slots:l,empty:l.filter(s=>s.occupants.length===0).map(s=>s.id),spare:m}}function or({nodes:e,occupants:t,label:n,fidelity:r,mode:a,options:o,schema:g,implicated:y=[],flagged:c=[]}){let{store:v}=Q(),l=Ke(v.graph,v.schema,e),p=t?[...l.filter(h=>h.kind===o.slots),...t.map(h=>v.graph.getNode(h)).filter(h=>h!==void 0)]:l,d=En(p,v.graph.allEdges(),o,g),m=new Set(y),s=new Set(c),w=et(),i=new Map;for(let h of w)for(let I of h.nodeIds)i.set(I,[...i.get(I)??[],h.message]);let x=h=>h?i.get(h)??[]:[];if(r==="glyph")return(0,T.jsx)(ue,{label:`${n??"Board"} \xB7 ${d.slots.length-d.empty.length}/${d.slots.length}`,hue:ie("board")});if(r==="summary"){let h=d.slots.filter(I=>d.empty.includes(I.id));return(0,T.jsx)(Z,{title:n??"Board",meta:`${d.slots.length-d.empty.length}/${d.slots.length}`,tone:h.length>0?"warning":"muted",fit:!0,children:h.length>0?(0,T.jsx)(Ae,{pick:!0,max:5,items:h.map(I=>({id:I.id,label:I.code}))}):(0,T.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"Every slot filled."})})}let S=o.aspect??.68,$=(0,Me.useRef)(null),[M,R]=(0,Me.useState)(!1),[u,k]=(0,Me.useState)(null),f=160,[P,B]=(0,Me.useState)(!1);(0,Me.useEffect)(()=>{let h=$.current;if(!h||typeof ResizeObserver>"u")return;let I=new ResizeObserver(D=>{let q=D[0]?.contentRect;if(!q)return;let b=q.height<f;B(b),R(!b&&S<1&&q.width/q.height>1.3),k(b?null:q.height)});return I.observe(h),()=>I.disconnect()},[S]);let W=(h,I)=>M?{x:1-I,y:h}:{x:h,y:I},H=(()=>{let h=new Map,I=(D,q,b)=>{let C=h.get(b)??{ids:[],codes:[]};C.ids.includes(D)||(C.ids.push(D),C.codes.includes(q)||C.codes.push(q)),h.set(b,C)};for(let D of d.slots){for(let q of x(D.id))I(D.id,D.code,q);for(let q of D.occupants)for(let b of x(q.id))I(q.id,q.label,b)}return[...h.entries()].map(([D,q])=>({id:q.ids[0],code:q.codes.join(", "),text:D}))})(),j=a==="fullscreen",_=H.length===0?null:(0,T.jsxs)("ul",{"data-graview-primitive":"board-key",style:{margin:"2px 0 0",padding:0,listStyle:"none",display:"grid",gap:3,flex:"0 0 auto"},children:[H.slice(0,j?6:2).map(h=>(0,T.jsxs)("li",{"data-graview-pick":h.id,"data-graview-emphasis":m.size===0?"plain":m.has(h.id)?"lit":"dimmed",title:h.text,style:{display:j?"grid":"flex",gap:j?1:7,alignItems:j?"start":"baseline",fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)",minHeight:24,width:"fit-content",maxWidth:"100%",padding:j?"2px 0":"3px 6px",marginLeft:j?0:-6,borderRadius:7,cursor:"pointer"},children:[(0,T.jsxs)("span",{style:{flex:"0 0 auto",fontWeight:600,color:"var(--graview-warn)",letterSpacing:"0.02em"},children:["\u26A0 ",h.code]}),(0,T.jsx)("span",{style:{minWidth:0,...j?{}:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},children:h.text})]},h.id)),H.length>(j?6:2)?(0,T.jsxs)("li",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:["+",H.length-(j?6:2)," more"]}):null]}),se=o.arrange==="shelf",me=d.slots.every(h=>h.code.length<=3&&!/\s/.test(h.code)),le=(h,I)=>{let D=h.occupants.length===0,q=m.size>0&&!m.has(h.id)&&!h.occupants.some(F=>m.has(F.id)),b=s.has(h.id),C=h.occupants.some(F=>s.has(F.id)),N=b,Y=[...x(h.id),...h.occupants.flatMap(F=>x(F.id))],ce=h.occupants.length===1?h.occupants[0]:null,ye=o.pickTarget==="slot"?h.id:ce?ce.id:h.id,re=F=>ce?{}:{"data-graview-pick":F.id,"data-graview-emphasis":m.size===0?"plain":q?"dimmed":"lit"},we=F=>s.has(F.id)?"var(--graview-warn)":"var(--graview-ink-muted)",Fe=o.emptyLabel??"empty";return(0,T.jsxs)("div",{"data-graview-pick":ye,"data-graview-slot":h.id,"data-graview-mark":me?"disc":"token","data-graview-flagged":b&&C?"both":b?"slot":C?"occupant":void 0,"data-graview-emphasis":m.size===0?"plain":q?"dimmed":"lit",title:[D?`${h.label} \u2014 nobody in it`:`${h.occupants.map(F=>F.label).join(", ")} at ${h.label}`,...Y].join(`
3
3
  `),style:{...I,display:"grid",justifyItems:me?"center":"start",gap:3,opacity:q?.5:1,transition:"opacity 160ms ease"},children:[me?(0,T.jsxs)("span",{style:{position:"relative",width:34,height:34,borderRadius:999,display:"grid",placeItems:"center",fontSize:"0.75rem",letterSpacing:"0.02em",border:D?"1.5px dashed var(--graview-warn)":`1px solid ${N?"var(--graview-warn)":"var(--graview-edge-bright)"}`,background:D?"transparent":N?"var(--graview-panel-warning)":"var(--graview-panel)",color:D||N?"var(--graview-warn)":"var(--graview-ink)",boxShadow:D?void 0:"var(--graview-lift-low)"},children:[h.code,b&&!D?(0,T.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",top:-3,right:-3,fontSize:"0.6875rem",lineHeight:1,color:"var(--graview-warn)"},children:"\u26A0"}):null]}):(0,T.jsxs)("span",{style:{display:"grid",gap:1,minWidth:0,maxWidth:180,padding:"5px 10px 6px",borderRadius:8,border:D?"1.5px dashed var(--graview-warn)":`1px solid ${N?"var(--graview-warn)":"var(--graview-edge-bright)"}`,background:D?"transparent":N?"var(--graview-panel-warning)":"var(--graview-panel)",boxShadow:D?void 0:"var(--graview-lift-low)"},children:[(0,T.jsxs)("span",{style:{fontSize:"0.8125rem",fontWeight:550,lineHeight:1.25,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:D||N?"var(--graview-warn)":"var(--graview-ink)"},children:[h.code,b&&!D?" \u26A0":null]}),D?(0,T.jsx)("span",{style:{fontSize:"0.75rem",lineHeight:1.3,color:"var(--graview-warn)"},children:Fe}):(0,T.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:"0 8px",fontSize:"0.75rem",lineHeight:1.3},children:h.occupants.map(F=>(0,T.jsxs)("span",{...re(F),style:{whiteSpace:"nowrap",color:we(F)},children:[F.label,s.has(F.id)?" \u26A0":""]},F.id))})]}),me?D?(0,T.jsx)("span",{style:{fontSize:"0.75rem",whiteSpace:"nowrap",color:"var(--graview-warn)"},children:Fe}):h.occupants.map(F=>(0,T.jsxs)("span",{...re(F),style:{fontSize:"0.75rem",whiteSpace:"nowrap",color:we(F)},children:[F.label,s.has(F.id)?" \u26A0":""]},F.id)):null]},h.id)},O=o.zones??[],L=O.map((h,I)=>({label:h.label,slots:d.slots.filter(D=>D.y>=h.from&&(D.y<h.to||I===O.length-1&&D.y<=h.to))})),A=new Set(L.flatMap(h=>h.slots.map(I=>I.id))),te=d.slots.filter(h=>!A.has(h.id));(te.length>0||L.length===0)&&L.push({label:"",slots:te});let he={boxSizing:"border-box",borderRadius:12,border:"1px solid var(--graview-edge)",background:"linear-gradient(var(--graview-panel-muted), var(--graview-panel-muted)), var(--graview-panel)",overflow:"hidden"};return(0,T.jsxs)(Z,{title:n??"Board",meta:d.slots.length===0?void 0:d.empty.length===0?`all ${d.slots.length} filled`:`${d.empty.length} unfilled`,...j?{style:{flex:"1 1 auto",minHeight:0,height:"100%"}}:{},children:[(0,T.jsxs)("div",{ref:$,style:{display:"flex",gap:28,alignItems:"stretch",justifyContent:"center",flex:"1 1 auto",minHeight:0},children:[j&&_?(0,T.jsxs)("div",{style:{width:260,flex:"0 0 auto",alignSelf:"center",display:"grid",gap:8},children:[(0,T.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"What is marked"}),_]}):null,se?(0,T.jsx)("div",{"data-graview-primitive":"board","data-graview-arrange":"shelf",style:{...he,overflow:"auto",flex:"1 1 auto",minWidth:0,alignSelf:"stretch",display:"grid",alignContent:"start"},children:L.map((h,I)=>(0,T.jsxs)("section",{"data-graview-zone":h.label||void 0,style:{display:"grid",gap:8,padding:"10px 14px 14px",...I>0?{borderTop:"1px dashed var(--graview-edge)"}:{}},children:[h.label?(0,T.jsx)("span",{style:{fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:h.label}):null,h.slots.length>0?(0,T.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"10px 12px",alignItems:"flex-start"},children:h.slots.map(D=>le(D,{}))}):(0,T.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"nothing here"})]},h.label||`band-${I}`))}):(0,T.jsxs)("div",{style:{display:"flex",gap:5,alignItems:"stretch",minWidth:0,...P?{flex:"1 1 auto",alignSelf:"flex-start"}:{}},children:[!M&&O.length>0?(0,T.jsx)("div",{"aria-hidden":"true",style:{position:"relative",width:15,flex:"0 0 auto",alignSelf:"stretch"},children:O.map(h=>(0,T.jsx)("span",{title:h.label,style:{position:"absolute",top:`${h.from*100}%`,height:`${(h.to-h.from)*100}%`,right:0,writingMode:"vertical-rl",transform:"rotate(180deg)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--graview-ink-faint)"},children:h.label},h.label))}):null,(0,T.jsxs)("div",{"data-graview-primitive":"board","data-graview-arrange":"exact",style:{...he,position:"relative",aspectRatio:`${M?1/S:S}`,...P?{width:"100%",height:"auto",flex:"1 1 auto",minWidth:0,alignSelf:"flex-start"}:{height:"100%",flex:"0 1 auto",...u!==null?{width:Math.round(u*(M?1/S:S))}:{}},maxWidth:"100%"},children:[O.map(h=>(0,T.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",...M?{top:0,bottom:0,left:`${(1-h.to)*100}%`,width:`${(h.to-h.from)*100}%`,borderLeft:"1px dashed var(--graview-edge)"}:{left:0,right:0,top:`${h.from*100}%`,height:`${(h.to-h.from)*100}%`,borderBottom:"1px dashed var(--graview-edge)"}}},h.label)),M?O.map(h=>(0,T.jsx)("span",{"aria-hidden":"true",title:h.label,style:{position:"absolute",bottom:3,left:`${(1-h.to)*100}%`,width:`${(h.to-h.from)*100}%`,textAlign:"center",fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--graview-ink-faint)"},children:h.label},`label-${h.label}`)):null,d.slots.map(h=>le(h,{position:"absolute",left:`${W(h.x,h.y).x*100}%`,top:`${W(h.x,h.y).y*100}%`,transform:"translate(-50%, -50%)",width:"max-content",maxWidth:"100%"}))]})]}),d.spare.length>0?(0,T.jsxs)("div",{style:{display:"grid",gap:6,alignContent:"start",minWidth:0},children:[(0,T.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"Not in"}),(0,T.jsx)(Ae,{pick:!0,max:10,items:d.spare.map(h=>({...h,emphasis:m.size===0?"plain":m.has(h.id)?"lit":"dimmed"}))})]}):null]}),j?null:_]})}function vt(e){function t(n){let{store:r}=Q(),a=En(Ke(r.graph,r.schema,n.nodes),r.graph.allEdges(),e,r.schema),g=[...a.slots.flatMap(l=>l.occupants.map(p=>p.id)),...a.spare.map(l=>l.id)].map(l=>r.graph.getNode(l)).filter(l=>l!==void 0),{arranged:y,bar:c}=Ve(n,{...e.arranging!==void 0?{allow:e.arranging}:{},lensAllows:{group:!1},...e.arrangedBy?{arrangedBy:e.arrangedBy}:{},subject:g}),v=(0,T.jsx)(or,{schema:r.schema,...n,options:e,...e.arranging===!1?{}:{occupants:y.nodes.map(l=>l.id)}});return Ee(n,r.schema,c?(0,T.jsxs)("div",{style:{display:"grid",gap:6,height:"100%",minHeight:0,gridTemplateRows:"auto 1fr"},children:[c,v]}):v)}return{name:"board",requiredRoles:[...ir],options:e,View:t,build(n,r,a){return En(n,r,e,a)}}}var un=G(ze(),1);function Mn(e){if(typeof e!="string")return null;let t=/^(\d{4}-\d{2}-\d{2})/.exec(e);return t?t[1]:null}function an(e){if(typeof e!="string")return null;let t=/^\d{4}-\d{2}-\d{2}[T ](\d{2}):(\d{2})/.exec(e);return t?Number(t[1])*60+Number(t[2]):null}var rn=e=>Date.UTC(Number(e.slice(0,4)),Number(e.slice(5,7))-1,Number(e.slice(8,10))),on=e=>new Date(e).toISOString().slice(0,10);function Se(e,t){return on(rn(e)+t*864e5)}function Le(e,t){let n=Number(e.slice(0,4)),r=Number(e.slice(5,7))-1+t,a=Number(e.slice(8,10)),o=new Date(Date.UTC(n,r+1,0)).getUTCDate();return on(Date.UTC(n,r,Math.min(a,o)))}var ln=e=>new Date(rn(e)).getUTCDay();function We(e,t=1){let n=(ln(e)-t+7)%7;return Se(e,-n)}var Pn=e=>`${e.slice(0,7)}-01`;function oe(e,t){return Math.round((rn(t)-rn(e))/864e5)}function Ie(e,t){return Array.from({length:t},(n,r)=>Se(e,r))}var Ye=["January","February","March","April","May","June","July","August","September","October","November","December"],Tn=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ke=e=>`${Tn[ln(e)]} ${Number(e.slice(8,10))} ${Ye[Number(e.slice(5,7))-1].slice(0,3)}`,Ln=e=>`${String(Math.floor(e/60)).padStart(2,"0")}:${String(e%60).padStart(2,"0")}`;function He(e,t){let n=t?.fieldRoles?.when;return e&&!e.start&&n?{...e,start:n}:e}function bt(e,t){return t===void 0?!1:typeof t=="string"?e[t]===!0:t.is.includes(e[t.field])}var sn=["start"],lr=["day","week","month","quarter","year","agenda"];function dn(e){return e.horizon?["day","week","month","quarter","year","years","agenda"]:lr}function xt(e,t){return e==="years"?t?.title??"Years":`The ${e}`}function St(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var Nn=class extends Error{constructor(n,r){super(`The calendar lens has no binding for ${r.map(a=>`"${a}"`).join(", ")} on "${n}". Bind them in the lens declaration: bindings: { ${n}: { start: "<field>" } }.`);this.kind=n;this.missing=r;this.name="CalendarBindingError"}};function Dn(e,t,n){let r=He(t[e.kind],n?.tryDefinition(e.kind));if(!r)return null;let a=e,o=n?.tryDefinition(e.kind)?.fields.shape,g=sn.filter(p=>{let d=r[p];return d?o?!(d in o):!(d in a):!0});if(g.length>0)throw new Nn(e.kind,g);let y=Mn(a[r.start]);if(y===null)return null;let c=(r.end?Mn(a[r.end]):null)??y,v=an(a[r.start]),l=r.label?a[r.label]:void 0;return{id:e.id,kind:e.kind,label:typeof l=="string"&&l.length>0?l:pe(n?.tryDefinition(e.kind),e),from:y,to:oe(y,c)<0?y:c,at:r.allDay&&a[r.allDay]===!0?null:v,allDay:r.allDay&&a[r.allDay]===!0||v===null,done:bt(a,r.done)}}function cn(e,t){return e.filter(n=>oe(n.from,t)>=0&&oe(t,n.to)>=0).sort((n,r)=>n.allDay!==r.allDay?n.allDay?-1:1:n.at!==r.at?(n.at??0)-(r.at??0):n.label.localeCompare(r.label))}function kt(e,t,n){let r=Qn(e.schema,e.allMutations()).get(t)?.get(n)??[],a=new Map(e.allMutations().map(g=>[g.name,g]));for(let g of r){let y=a.get(g),c=y?.subject;if(!y||!c)continue;let v=y.input?.shape??{};if(n in v)return{name:y.name,arg:c.arg}}let o=e.allMutations().find(g=>g.derived?.act==="edit"&&g.derived.kind===t);return o?.subject?{name:o.name,arg:o.subject.arg}:null}var Ct=(e,t)=>({from:Pn(e),to:$t(e),label:`${Ye[Number(e.slice(5,7))-1].slice(0,3)}${t?` ${e.slice(2,4)}`:""}`});function $t(e){return on(Date.UTC(Number(e.slice(0,4)),Number(e.slice(5,7)),0))}function sr(e){let t=Math.floor((Number(e.slice(5,7))-1)/3);return`${e.slice(0,4)}-${String(t*3+1).padStart(2,"0")}-01`}function Ot(e,t,n={}){let r=n.weekStartsOn??1,a=(c,v)=>({from:c,to:c,label:String(Number(c.slice(8,10))),...v?{outside:!0}:{}});if(e==="day")return{title:ke(t),grain:"day",columns:1,cells:[a(t)]};if(e==="week"){let c=We(t,r);return{title:`${ke(c)} \u2013 ${ke(Se(c,6))}`,grain:"day",columns:7,cells:Ie(c,7).map(v=>a(v))}}if(e==="agenda")return{title:`From ${ke(t)}`,grain:"day",columns:1,cells:Ie(t,42).map(c=>a(c))};if(e==="quarter"){let c=sr(t),v=$t(Le(c,2)),l=[];for(let p=We(c,r);oe(p,v)>=0;p=Se(p,7))l.push({from:p,to:Se(p,6),label:`${Number(p.slice(8,10))} ${Ye[Number(p.slice(5,7))-1].slice(0,3)}`,...oe(p,c)>0&&oe(Se(p,6),c)>0?{outside:!0}:{}});return{title:`Q${Math.floor((Number(t.slice(5,7))-1)/3)+1} ${t.slice(0,4)}`,grain:"week",columns:4,cells:l}}if(e==="year"){let c=t.slice(0,4);return{title:c,grain:"month",columns:4,cells:Array.from({length:12},(v,l)=>Ct(`${c}-${String(l+1).padStart(2,"0")}-01`,!1))}}if(e==="years"){let c=Math.max(1,n.horizon?.years??1),v=Number(t.slice(0,4)),l=Array.from({length:c},(p,d)=>String(v+d));return c>dr?{title:`${n.horizon?.title??"Years"} \xB7 ${l[0]}\u2013${l[l.length-1]}`,grain:"year",columns:5,years:l,cells:l.map(p=>({from:`${p}-01-01`,to:`${p}-12-31`,label:p}))}:{title:`${n.horizon?.title??"Years"} \xB7 ${l[0]}\u2013${l[l.length-1]}`,grain:"month",columns:4,years:l,cells:l.flatMap(p=>Array.from({length:12},(d,m)=>Ct(`${p}-${String(m+1).padStart(2,"0")}-01`,!0)))}}let o=Pn(t),g=We(o,r),y=t.slice(0,7);return{title:`${Ye[Number(t.slice(5,7))-1]} ${t.slice(0,4)}`,grain:"day",columns:7,cells:Ie(g,42).map(c=>a(c,c.slice(0,7)!==y))}}function Rt(e,t,n){return e.filter(r=>oe(r.from,n)>=0&&oe(t,r.to)>=0).sort((r,a)=>r.allDay!==a.allDay?r.allDay?-1:1:r.from!==a.from?r.from.localeCompare(a.from):r.at!==a.at?(r.at??0)-(a.at??0):r.label.localeCompare(a.label))}var dr=10;function At(e){return e==="year"?"year":e==="month"?"month":e==="week"?"week":"day"}var Et=G(ze(),1);var ee=G(J(),1);function zn({label:e,glyph:t,onPress:n}){return(0,ee.jsx)("button",{type:"button","aria-label":e,title:e,onClick:n,style:Ge,children:t})}var Ge={minHeight:24,minWidth:24,padding:"2px 9px",borderRadius:6,fontSize:"0.8125rem",borderWidth:1,borderStyle:"solid",borderColor:"transparent",color:"var(--graview-ink-muted)",background:"transparent"},Mt={day:12,week:4,month:3,year:5};function Pt({span:e,weekStartsOn:t,entries:n,today:r,perCell:a,emphasisOf:o,broken:g,hue:y,onOpen:c,onMove:v}){let l=(0,Et.useRef)(null),p=Be(l),d=p===null?e.columns:Math.max(1,Math.floor(p/44)),m=d<e.columns,s=m?d:e.columns,w=!m&&e.grain==="day"&&e.columns===7?Ie(We(e.cells[0]?.from??r,t),7):e.grain==="day"&&e.columns===1?e.cells.map(i=>i.from):null;return m&&e.grain==="day"&&e.columns>1?(0,ee.jsx)("div",{ref:l,"data-calendar-shape":"agenda",style:{display:"grid",minHeight:0,flex:1},children:(0,ee.jsx)(gn,{days:e.cells.map(i=>i.from),entries:n,today:r,emphasisOf:o,broken:g,hue:y,onMove:(i,x)=>v(i,{from:x,to:x,label:x},"day")})}):(0,ee.jsxs)("div",{ref:l,"data-calendar-shape":m?"wrapped":"grid",style:{display:"grid",gap:4,gridTemplateRows:w?"auto 1fr":"1fr",minHeight:0,flex:1},children:[w?(0,ee.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${s}, minmax(0, 1fr))`,gap:4},children:w.map(i=>(0,ee.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:"var(--graview-ink-muted)",textAlign:"center"},children:e.columns===7?Tn[ln(i)]:ke(i)},i))}):null,(0,ee.jsx)("div",{tabIndex:0,"aria-label":`The days of ${e.title}`,style:{display:"grid",gridTemplateColumns:`repeat(${s}, minmax(0, 1fr))`,gridAutoRows:"max-content",gap:4,minHeight:0,overflow:"auto"},children:e.cells.map((i,x)=>{let S=Rt(n,i.from,i.to),$=S.slice(0,a),M=S.slice(a),R=M.filter(k=>g.has(k.id)).length,u=oe(i.from,r)>=0&&oe(r,i.to)>=0;return(0,ee.jsxs)("div",{"data-calendar-day":e.grain==="day"?i.from:void 0,"data-calendar-cell":i.from,"data-calendar-grain":e.grain,"data-calendar-count":S.length,"data-calendar-outside":i.outside||void 0,onDragOver:k=>{k.dataTransfer.types.includes("text/graview-node")&&(k.preventDefault(),k.dataTransfer.dropEffect="move")},onDrop:k=>{let f=k.dataTransfer.getData("text/graview-node");f&&(k.preventDefault(),k.stopPropagation(),v(f,i,e.grain))},style:{minHeight:62,display:"flex",flexDirection:"column",gap:2,padding:4,borderRadius:7,border:"1px solid var(--graview-edge)",background:u?"var(--graview-panel)":"transparent",opacity:i.outside?.45:1},children:[(0,ee.jsxs)("span",{style:{display:"flex",alignItems:"baseline",gap:4},children:[(0,ee.jsx)("span",{style:{fontSize:"0.75rem",fontVariantNumeric:"tabular-nums",color:u?"var(--graview-accent)":"var(--graview-ink-faint)"},children:i.label}),e.grain!=="day"&&S.length>0?(0,ee.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",marginLeft:"auto"},children:S.length}):null]}),$.map(k=>(0,ee.jsx)(Tt,{entry:k,cell:i,rowStart:x%s===0,emphasis:o(k.id),flagged:g.has(k.id),hue:y(k)},`${k.id}:${i.from}`)),M.length>0?(0,ee.jsxs)("button",{type:"button","data-testid":`calendar-more-${i.from}`,onClick:()=>c(i),title:`Open ${i.label}`,style:{minHeight:24,padding:"1px 5px",fontSize:"0.75rem",borderRadius:5,border:"1px dashed var(--graview-edge)",background:"transparent",color:R>0?"var(--graview-warn)":"var(--graview-ink-muted)",textAlign:"left"},children:["+",M.length," more",R>0?` \xB7 ${R} flagged`:""]}):null]},i.from)})})]})}function gn({days:e,entries:t,today:n,emphasisOf:r,broken:a,hue:o,onMove:g}){let y=e.map(c=>({day:c,here:cn(t,c)})).filter(({here:c})=>c.length>0);return y.length===0?(0,ee.jsx)("p",{"data-testid":"calendar-empty",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:"Nothing is scheduled in the next six weeks."}):(0,ee.jsx)("ol",{tabIndex:0,"aria-label":"What is scheduled",style:{margin:0,padding:0,listStyle:"none",display:"grid",alignContent:"start",gap:10,overflow:"auto",minHeight:0},children:y.map(({day:c,here:v})=>(0,ee.jsxs)("li",{"data-calendar-day":c,onDragOver:l=>{l.dataTransfer.types.includes("text/graview-node")&&(l.preventDefault(),l.dataTransfer.dropEffect="move")},onDrop:l=>{let p=l.dataTransfer.getData("text/graview-node");p&&(l.preventDefault(),l.stopPropagation(),g(p,c))},style:{display:"grid",gap:4},children:[(0,ee.jsxs)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:c===n?"var(--graview-accent)":"var(--graview-ink-muted)"},children:[ke(c),c===n?" \xB7 today":""]}),v.map(l=>(0,ee.jsx)(Tt,{entry:l,cell:{from:c,to:c,label:c},emphasis:r(l.id),flagged:a.has(l.id),hue:o(l)},`${l.id}:${c}`))]},c))})}function Tt({entry:e,cell:t,emphasis:n,flagged:r,hue:a,rowStart:o=!1}){let g=oe(t.from,e.from)>=0,y=oe(e.to,t.to)>=0,c=!(g&&y),v=e.at!==null&&g&&e.from===t.from?`${Ln(e.at)} ${e.label}`:e.label;return(0,ee.jsx)("span",{"data-graview-pick":e.id,"data-calendar-entry":e.id,draggable:!0,onDragStart:l=>{l.dataTransfer.setData("text/graview-node",e.id),l.dataTransfer.effectAllowed="move"},"data-graview-emphasis":n,"data-calendar-part":c?g?"opens":y?"closes":"through":void 0,"data-calendar-in":t.from,title:c?`${e.label} \xB7 ${e.from} \u2013 ${e.to}`:`${e.label}${e.at===null?" \xB7 all day":` \xB7 ${Ln(e.at)}`}`,style:{display:"block",minHeight:24,boxSizing:"border-box",padding:"3px 6px",fontSize:"0.75rem",lineHeight:1.35,borderRadius:c?g?"5px 0 0 5px":y?"0 5px 5px 0":0:5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:e.done?"line-through":"none",opacity:n==="dimmed"?.35:e.done?.6:1,background:`color-mix(in oklab, hsl(${Math.round(a)} 70% 55%) ${n==="lit"?38:20}%, transparent)`,color:"var(--graview-ink)",...n==="lit"?{outline:"1px solid var(--graview-accent)"}:{},...r?{borderLeft:"3px solid var(--graview-warn)",paddingLeft:4}:{}},children:g||o?v:" "})}var U=G(J(),1);function Lt(e){let t=n=>function(a){let{store:o}=Q(),{view:g}=Ue(),y=n?{...e,range:n}:e,c=g.within?.range??y.range??"month",v=Object.keys(e.bindings),{nodes:l,arranged:p,arrangement:d,bar:m}=Ve(a,{...e.arranging!==void 0?{allow:e.arranging}:{},lensAllows:{sort:!1,group:c==="agenda"},...e.arrangedBy?{arrangedBy:e.arrangedBy}:{},...v[0]?{kind:(a.nodes??[]).find(S=>v.includes(String(S.kind)))?.kind??v[0]}:{}}),s=c==="agenda"&&p.grouped&&d.group?p.groups.map(S=>({label:S.label,ids:new Set(S.nodes.map($=>$.id))})):void 0,w=new Set((a.nodes??[]).map(S=>String(S.kind))),i=v.filter(S=>!w.has(S)&&o.schema.tryDefinition(S)!==void 0).flatMap(S=>{let $=o.schema.tryDefinition(S);return o.graph.nodesOfKind(S).filter(M=>g.past===!0||Ne($,M))}),x=i.length===0?l:[...l,...a.budget!==void 0?i.slice(0,a.budget):i];return Ee(a,o.schema,(0,U.jsx)(cr,{schema:o.schema,...a,nodes:x,options:{...y,today:y.today??o.today()??St()},...m?{bar:m}:{},...s?{groups:s}:{}}))};return{name:"calendar",requiredRoles:[...sn],bindings:e.bindings,options:e,View:t(),at:n=>t(n),ranges:()=>dn(e).map(n=>({range:n,title:xt(n,e.horizon)})),place:(n,r)=>n.map(a=>Dn(a,e.bindings,r)).filter(a=>a!==null)}}function cr({nodes:e,label:t,fidelity:n,mode:r,options:a,schema:o,selectedIds:g=[],implicated:y=[],flagged:c=[],bar:v,groups:l}){let{view:p,go:d}=Ue(),{store:m,principal:s}=Q(),w=p.within?.at??a.today,i=p.within?.range??a.range??"month",x=a.weekStartsOn??1,S=new Set([...y,...g]),$=O=>S.size===0?"plain":S.has(O)?"lit":"dimmed",M=new Set(c),R=(e??[]).map(O=>Dn(O,a.bindings,o)).filter(O=>O!==null),u=a.hueOf??(O=>ie(O.kind));if(n==="glyph")return(0,U.jsx)(ue,{label:`${t??"Calendar"} \xB7 ${R.length}`,hue:ie("calendar")});if(n==="summary"){let O=cn(R,a.today);return(0,U.jsx)(Z,{title:t??"Calendar",meta:`${R.length} dated`,tone:"muted",children:(0,U.jsx)(Ae,{max:6,items:O.length>0?O.map(L=>({id:L.id,label:L.label,hue:u(L)})):R.filter(L=>oe(a.today,L.from)>=0).sort((L,A)=>L.from.localeCompare(A.from)).slice(0,6).map(L=>({id:L.id,label:`${L.from.slice(5)} ${L.label}`,hue:u(L)}))})})}let k=r==="fullscreen",f=Ot(i,w,{weekStartsOn:x,...a.horizon?{horizon:a.horizon}:{}}),[P,B]=(0,un.useState)(null),W=(O,L,A)=>{let te=m.graph.getNode(O);if(!te)return;let he=He(a.bindings[te.kind],m.schema.tryDefinition(te.kind));if(!he)return;let h=kt(m,te.kind,he.start);if(!h){B({text:`Nothing declared writes the ${xn(m.schema.definitions.find(Y=>Y.kind===te.kind),he.start).toLowerCase()}, so this cannot be moved from here.`,tone:"refused"});return}let I=L.from,D=te[he.start],b=an(D)===null?I:`${I}${String(D).slice(10)}`,C={name:h.name,args:{[h.arg]:O,[he.start]:b}},N=m.permits(C,s);if(!N.ok){B({text:N.refusal.message,tone:"refused"});return}try{m.apply(C,{author:s}),B(A==="day"?null:{text:`Moved to ${ke(I)} \u2014 a ${A} is coarser than the ${xn(m.schema.definitions.find(Y=>Y.kind===te.kind),he.start).toLowerCase()} holds, so it takes the first day of the cell. Undo puts it back.`,tone:"rounded"})}catch(Y){B({text:Y instanceof Error?Y.message:String(Y),tone:"refused"})}},H=O=>{let L=i==="years"?Le(w,O*12*Math.max(1,a.horizon?.years??1)):i==="year"?Le(w,O*12):i==="quarter"?Le(w,O*3):i==="month"?Le(w,O):i==="week"?Se(w,O*7):Se(w,O);d(_e(p,"at",L))},j=(O,L)=>{let A=_e(p,"range",O);L!==void 0&&(A=_e(A,"at",L)),d(A)},_=(0,un.useRef)(null),se=Be(_),me=se!==null&&se<420,le=O=>O==="years"?a.horizon?.title??"years":O.charAt(0).toUpperCase()+O.slice(1);return(0,U.jsx)(Z,{title:t??"Calendar",meta:f.title,style:{gap:10,...k?{flex:"1 1 auto",minHeight:0,height:"100%"}:{}},children:(0,U.jsxs)("div",{ref:_,"data-testid":"calendar","data-calendar-range":i,"data-calendar-at":w,style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,gap:8},children:[(0,U.jsxs)("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6},children:[(0,U.jsxs)("nav",{"aria-label":"When",style:{display:"flex",gap:4},children:[(0,U.jsx)(zn,{label:"Previous",glyph:"\u2039",onPress:()=>H(-1)}),(0,U.jsx)("button",{type:"button","data-testid":"calendar-today",onClick:()=>d(_e(p,"at",a.today)),style:Ge,children:"Today"}),(0,U.jsx)(zn,{label:"Next",glyph:"\u203A",onPress:()=>H(1)})]}),me?(0,U.jsx)("select",{"aria-label":"Range","data-testid":"calendar-ranges",value:i,onChange:O=>j(O.target.value),style:{...Ge,borderRadius:999,borderColor:"var(--graview-edge)",background:void 0,backgroundColor:"transparent",marginLeft:"auto",maxWidth:"50%",paddingRight:24,appearance:"none",WebkitAppearance:"none",backgroundImage:"linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%)",backgroundPosition:"calc(100% - 13px) 55%, calc(100% - 9px) 55%",backgroundSize:"4px 4px, 4px 4px",backgroundRepeat:"no-repeat"},children:dn(a).map(O=>(0,U.jsx)("option",{value:O,children:le(O)},O))}):(0,U.jsx)("div",{role:"group","aria-label":"Range","data-testid":"calendar-ranges",style:{display:"flex",flexWrap:"wrap",gap:4,marginLeft:"auto"},children:dn(a).map(O=>(0,U.jsx)("button",{type:"button","aria-pressed":O===i,"data-testid":`calendar-range-${O}`,onClick:()=>j(O),style:{...Ge,borderRadius:999,borderColor:"var(--graview-edge)",...O==="years"?{}:{textTransform:"capitalize"},...O===i?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)",background:"var(--graview-panel)"}:{}},children:O==="years"?a.horizon?.title??"years":O},O))})]}),P?(0,U.jsx)("p",{"data-testid":P.tone==="refused"?"calendar-refused":"calendar-rounded",role:"status",style:{margin:0,fontSize:"0.8125rem",color:P.tone==="refused"?"var(--graview-warn)":"var(--graview-ink-muted)"},children:P.text}):null,f.years?(0,U.jsx)("nav",{"aria-label":"Years","data-testid":"calendar-years",style:{display:"flex",flexWrap:"wrap",gap:4},children:f.years.map(O=>(0,U.jsx)("button",{type:"button","data-testid":`calendar-year-${O}`,onClick:()=>j("year",`${O}-01-01`),style:Ge,children:O},O))}):null,v,i==="agenda"&&l?(0,U.jsx)("div",{"data-testid":"calendar-groups",style:{display:"grid",gap:10,minHeight:0,overflow:"auto"},children:l.map(O=>(0,U.jsxs)("section",{"data-testid":"calendar-group",style:{display:"grid",gap:4},children:[(0,U.jsxs)("h3",{style:{margin:0,fontSize:"0.8125rem",letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},children:[O.label," ",(0,U.jsx)("span",{style:{fontWeight:400},children:O.ids.size})]}),(0,U.jsx)(gn,{days:f.cells.map(L=>L.from),entries:R.filter(L=>O.ids.has(L.id)),today:a.today,emphasisOf:$,broken:M,hue:u,onMove:(L,A)=>W(L,{from:A,to:A,label:A},"day")})]},O.label))}):i==="agenda"?(0,U.jsx)(gn,{days:f.cells.map(O=>O.from),entries:R,today:a.today,emphasisOf:$,broken:M,hue:u,onMove:(O,L)=>W(O,{from:L,to:L,label:L},"day")}):(0,U.jsx)(Pt,{span:f,weekStartsOn:x,entries:R,today:a.today,perCell:a.perCell??Mt[f.grain],emphasisOf:$,broken:M,hue:u,onOpen:O=>j(At(f.grain),O.from),onMove:W})]})})}var fe=G(ze(),1);var V=G(J(),1),gr=`
4
4
  .graview-columns { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
@@ -1,4 +1,4 @@
1
- import{a as Ne}from"./chunk.AHDOKM4O.js";import{a as Me}from"./chunk.6LJ66MB7.js";import{da as Ce,ea as Le,qa as He,ra as Ae,va as L,ya as H,za as Re}from"./chunk.SVL6I37U.js";import{Ab as ye,Cb as xe,Fb as ke,Gb as $e,O as se,Pa as U,Sb as Se,Tb as Pe,Ub as Be,V as de,Vb as Te,Zb as Ee,aa as ce,ka as pe,lb as ge,nb as ue,ob as ve,pb as Z,qb as we,rb as fe,tb as me,ub as he,vb as be}from"./chunk.P7YN4Z3K.js";import{a as G,b as E}from"./chunk.MRK6QJV5.js";import{b as $}from"./chunk.AJZBJBMO.js";var w=$(G(),1);var Oe=$(G(),1);var K=$(E(),1);function ze({brand:e,size:a=22}){let t=e?.logo,r=t!==void 0&&me(t)&&he(t)===null?t:void 0,l=Ne(r);if(!t||!be(t))return null;let n=e?.logoAlt??e?.name??"",o=n!==""&&n!==e?.name,c={display:"inline-flex",flex:"0 0 auto",height:a,color:"var(--graview-accent)"};return r?(0,K.jsx)("span",{className:"graview-logo","data-testid":"app-mark",style:c,...o?{role:"img","aria-label":n}:{"aria-hidden":!0},dangerouslySetInnerHTML:l}):(0,K.jsx)("img",{className:"graview-logo","data-testid":"app-mark",src:t,alt:o?n:"",style:{...c,width:"auto"}})}function ja(e){(0,Oe.useEffect)(()=>{if(!e||typeof document>"u")return;let a=[...document.querySelectorAll('link[rel~="icon"]')],t=a.map(l=>l.getAttribute("href")),r;a.length===0&&(r=document.createElement("link"),r.rel="icon",r.setAttribute("data-graview-favicon",""),document.head.appendChild(r),a.push(r));for(let l of a)l.href=e;return()=>{r&&r.remove(),a.forEach((l,n)=>{l!==r&&t[n]!==null&&t[n]!==void 0&&l.setAttribute("href",t[n])})}},[e])}var B=Re(Me(()=>import("./chunk.OBGG4SYF.js")));var i=$(E(),1),da=B.part((e,a)=>(0,i.jsx)(e.Here,{...a}),{quiet:!0}),ca="home",pa="/",ga="scene:whole";function er(e){let{store:a,principal:t,views:r}=e,l=a.kindsKeptFrom(t),n=a.schema.kinds.filter(s=>!a.modules.disabledKinds.has(s)&&!l.has(s)),o=r?.arrangement?.(),c=r?.places()??[],p=Be(o,a.schema,c),d=Pe(a.schema,o,[...a.modules.administered.values()].flatMap(s=>s.kinds??[])),u=(s,m)=>(!a.graph.size.nodes||a.graph.count(s)>0)&&(p?m?p.places.has(`${s}|${m}`):p.kinds.has(s):!d.has(s)),g=[{key:ca,label:"Home",path:pa,group:"home",primary:!0}];for(let s of Ee(n,o?.order))g.push({key:`kind:${s}`,label:de(a.schema,s),path:U(a.schema,s),group:"lists",kind:s,primary:u(s)});for(let s of c){if(!n.includes(s.kind)||s.as===Te)continue;let m=c.some(P=>P.as===s.as&&P.kind!==s.kind),b=`/places/${encodeURIComponent(s.as)}${m?`?of=${U(a.schema,s.kind).slice(1)}`:""}`;g.some(P=>P.path===b)||g.push({key:`place:${s.kind}:${s.as}`,label:s.title,path:b,group:"pictures",kind:s.kind,primary:u(s.kind,s.as)})}return n.some(s=>Object.keys(a.schema.tryDefinition(s)?.edges??{}).length>0)&&g.push({key:"connections",label:"Connections",path:"/map",group:"pictures",primary:!1}),g}function ar(e,a){let[t="/",r=""]=a.split("?"),l=e.find(o=>o.path===(r?`${t}?${r}`:t))??e.find(o=>o.path===t);if(l)return l.key;let n=`/${t.split("/").filter(Boolean)[0]??""}`;return e.find(o=>o.group==="lists"&&o.path===n)?.key??null}var ua=(0,w.createContext)(null),rr=()=>(0,w.useContext)(ua),N=30,va=48,_=640,Ie=4,We=2;function wa(e){let{widths:a,current:t,room:r,more:l,gap:n=Ie,primary:o,most:c=Se}=e;if(a.length===0||!(r>0)||!(l>0)||a.some(g=>!(g>0)))return null;let p=(g,f)=>g.reduce((s,m)=>s+a[m],0)+n*Math.max(0,g.length-1)+(f?n+l:0),d=(g,f)=>t<0||!g.includes(t)||g.slice(0,f).includes(t)?g.slice(0,f):[...g.filter(s=>s!==t).slice(0,f-1),t].sort((s,m)=>s-m),u=d(a.map((g,f)=>f).filter(g=>o?.[g]!==!1||g===t),c);if(p(u,u.length<a.length)<=r)return u.length>=We?u:null;for(let g=u.length-1;g>=We;g--){let f=d(u,g);if(p(f,!0)<=r)return f}return null}var fa=`
1
+ import{a as Ne}from"./chunk.AHDOKM4O.js";import{a as Me}from"./chunk.6LJ66MB7.js";import{da as Ce,ea as Le,qa as He,ra as Ae,va as L,ya as H,za as Re}from"./chunk.OYULDOQP.js";import{Bb as ye,Db as xe,Gb as ke,Hb as $e,P as se,Qa as U,Tb as Se,Ub as Pe,Vb as Be,W as de,Wb as Te,_b as Ee,ba as ce,la as pe,mb as ge,ob as ue,pb as ve,qb as Z,rb as we,sb as fe,ub as me,vb as he,wb as be}from"./chunk.VMEX2KZ4.js";import{a as G,b as E}from"./chunk.MRK6QJV5.js";import{b as $}from"./chunk.AJZBJBMO.js";var w=$(G(),1);var Oe=$(G(),1);var K=$(E(),1);function ze({brand:e,size:a=22}){let t=e?.logo,r=t!==void 0&&me(t)&&he(t)===null?t:void 0,l=Ne(r);if(!t||!be(t))return null;let n=e?.logoAlt??e?.name??"",o=n!==""&&n!==e?.name,c={display:"inline-flex",flex:"0 0 auto",height:a,color:"var(--graview-accent)"};return r?(0,K.jsx)("span",{className:"graview-logo","data-testid":"app-mark",style:c,...o?{role:"img","aria-label":n}:{"aria-hidden":!0},dangerouslySetInnerHTML:l}):(0,K.jsx)("img",{className:"graview-logo","data-testid":"app-mark",src:t,alt:o?n:"",style:{...c,width:"auto"}})}function ja(e){(0,Oe.useEffect)(()=>{if(!e||typeof document>"u")return;let a=[...document.querySelectorAll('link[rel~="icon"]')],t=a.map(l=>l.getAttribute("href")),r;a.length===0&&(r=document.createElement("link"),r.rel="icon",r.setAttribute("data-graview-favicon",""),document.head.appendChild(r),a.push(r));for(let l of a)l.href=e;return()=>{r&&r.remove(),a.forEach((l,n)=>{l!==r&&t[n]!==null&&t[n]!==void 0&&l.setAttribute("href",t[n])})}},[e])}var B=Re(Me(()=>import("./chunk.OA5BVKJH.js")));var i=$(E(),1),da=B.part((e,a)=>(0,i.jsx)(e.Here,{...a}),{quiet:!0}),ca="home",pa="/",ga="scene:whole";function er(e){let{store:a,principal:t,views:r}=e,l=a.kindsKeptFrom(t),n=a.schema.kinds.filter(s=>!a.modules.disabledKinds.has(s)&&!l.has(s)),o=r?.arrangement?.(),c=r?.places()??[],p=Be(o,a.schema,c),d=Pe(a.schema,o,[...a.modules.administered.values()].flatMap(s=>s.kinds??[])),u=(s,m)=>(!a.graph.size.nodes||a.graph.count(s)>0)&&(p?m?p.places.has(`${s}|${m}`):p.kinds.has(s):!d.has(s)),g=[{key:ca,label:"Home",path:pa,group:"home",primary:!0}];for(let s of Ee(n,o?.order))g.push({key:`kind:${s}`,label:de(a.schema,s),path:U(a.schema,s),group:"lists",kind:s,primary:u(s)});for(let s of c){if(!n.includes(s.kind)||s.as===Te)continue;let m=c.some(P=>P.as===s.as&&P.kind!==s.kind),b=`/places/${encodeURIComponent(s.as)}${m?`?of=${U(a.schema,s.kind).slice(1)}`:""}`;g.some(P=>P.path===b)||g.push({key:`place:${s.kind}:${s.as}`,label:s.title,path:b,group:"pictures",kind:s.kind,primary:u(s.kind,s.as)})}return n.some(s=>Object.keys(a.schema.tryDefinition(s)?.edges??{}).length>0)&&g.push({key:"connections",label:"Connections",path:"/map",group:"pictures",primary:!1}),g}function ar(e,a){let[t="/",r=""]=a.split("?"),l=e.find(o=>o.path===(r?`${t}?${r}`:t))??e.find(o=>o.path===t);if(l)return l.key;let n=`/${t.split("/").filter(Boolean)[0]??""}`;return e.find(o=>o.group==="lists"&&o.path===n)?.key??null}var ua=(0,w.createContext)(null),rr=()=>(0,w.useContext)(ua),N=30,va=48,_=640,Ie=4,We=2;function wa(e){let{widths:a,current:t,room:r,more:l,gap:n=Ie,primary:o,most:c=Se}=e;if(a.length===0||!(r>0)||!(l>0)||a.some(g=>!(g>0)))return null;let p=(g,f)=>g.reduce((s,m)=>s+a[m],0)+n*Math.max(0,g.length-1)+(f?n+l:0),d=(g,f)=>t<0||!g.includes(t)||g.slice(0,f).includes(t)?g.slice(0,f):[...g.filter(s=>s!==t).slice(0,f-1),t].sort((s,m)=>s-m),u=d(a.map((g,f)=>f).filter(g=>o?.[g]!==!1||g===t),c);if(p(u,u.length<a.length)<=r)return u.length>=We?u:null;for(let g=u.length-1;g>=We;g--){let f=d(u,g);if(p(f,!0)<=r)return f}return null}var fa=`
2
2
  .graview-bar{display:block;margin:0;padding:0;container:graview-bar/inline-size;flex:0 0 auto;position:relative;background:var(--graview-bar);border-bottom:1px solid var(--graview-edge);color:var(--graview-ink);font-family:var(--graview-font-body,system-ui)}
3
3
  .graview-bar-row{display:flex;flex-wrap:nowrap;align-items:center;gap:16px;height:${va-1}px;margin:0;padding:0 16px}
4
4
  .graview-bar-home,.graview-bar-face,.graview-bar-place,.graview-bar-item,.graview-bar-at{display:inline-flex;align-items:center;box-sizing:border-box;min-width:0;margin:0;border:0;background:none;box-shadow:none;font:inherit;letter-spacing:normal;text-transform:none;text-decoration:none;color:var(--graview-ink);cursor:pointer;text-align:left}
@@ -1 +1 @@
1
- import{a as I,c as x}from"./chunk.2GFB5FOK.js";import"./chunk.BK2MJOUN.js";import"./chunk.NQP3DWME.js";import"./chunk.3RT463XY.js";import"./chunk.ZOWWWRYA.js";import"./chunk.AHDOKM4O.js";import"./chunk.6LJ66MB7.js";import{B as G,b,c as A,i as v,w,y as O}from"./chunk.SVL6I37U.js";import{Pa as S,Wb as W,ta as k,ua as E}from"./chunk.P7YN4Z3K.js";import"./chunk.MRK6QJV5.js";import"./chunk.AJZBJBMO.js";var F=(e,i)=>S(e,i).slice(1);function j(e,i){let l=e.split("/").filter(Boolean);return l.length===i.length&&l.every((s,h)=>s.startsWith(":")||s==="*"||s===i[h])}var $=["problems","search","map","places"];function R(e,i,l,s,h=[]){let{schema:r}=i,o=r.kinds,f=t=>{if(t.startsWith(w))return(t.slice(w.length).split("|")[0]??"").split("+").every(V=>o.includes(V));let y=O(t);return y!==null?o.includes(y):t.startsWith("edge:")||l.graph.getNode(t)!==void 0},[p="/",u]=e.path.split("?"),n=p.split("/").filter(Boolean),m=u?`?${u}`:"",d=n.length>0&&!$.includes(n[0])?o.find(t=>F(r,t)===n[0]):void 0,c=e.path;if(n[0]==="places"&&n.length===2)`/places/${n[1]}`!==W&&!s.some(t=>t.as===decodeURIComponent(n[1]))&&(c="/");else if(d){let t=n[1]===void 0?void 0:decodeURIComponent(n[1]);c=`/${F(r,d)}${t!==void 0&&l.graph.getNode(t)?.kind===d?`/${n[1]}`:""}${m}`}else n.length>0&&n.length<=2&&!$.includes(n[0])&&!h.some(t=>j(t.path,n))&&(c="/");let g=A(e.stop),P=g.within?.view,U=P!==void 0&&!s.some(t=>t.as===P),a=g;if(U){let{view:t,...y}=g.within??{};a={...a,within:y}}if(g.focusId&&!f(g.focusId)){let t=e.kind&&o.includes(e.kind)?G(e.kind):null;a={...v(a,t),zoom:!1}}return a={...a,relation:a.relation&&(o.includes(a.relation)||r.edgeKinds.includes(a.relation))?a.relation:null,expanded:a.expanded.filter(f),pins:Object.fromEntries(Object.entries(a.pins).filter(([t])=>f(t))),...a.selection?{selection:a.selection.filter(f)}:{}},{face:e.face,path:c,stop:b(a),...e.kind?{kind:e.kind}:{}}}function B(e,i,l){let s=e.at,h=e.pages?.routes()??[];if(e.routing!=="address"||typeof window>"u")return R(s,e.app,i,l,h);let{pathname:r,search:o,hash:f}=window.location,p=E(r,e.basePath),u=I({routing:"address",...e.basePath===void 0?{}:{basePath:e.basePath},face:s.face}),n=u==="pages",m={...s,face:u,...p===null?{}:n?{path:p+o}:{stop:x(e.basePath)??s.stop}},d=R(m,e.app,i,l,h),c=n?d.path===m.path?null:k(d.path,e.basePath===void 0?{}:{basePath:e.basePath}):d.stop===b(A(m.stop))?null:r+o+d.stop;return p!==null&&c!==null&&c!==r+o+f&&window.history.replaceState(window.history.state,"",c),d}export{R as settle,B as settleAt};
1
+ import{a as I,c as x}from"./chunk.7CO6VP6F.js";import"./chunk.7SVIRYBB.js";import"./chunk.ZMMMKTAG.js";import"./chunk.CW7BMVBG.js";import"./chunk.IZDKEFPJ.js";import"./chunk.AHDOKM4O.js";import"./chunk.6LJ66MB7.js";import{B as G,b,c as A,i as v,w,y as O}from"./chunk.OYULDOQP.js";import{Qa as S,Xb as W,ua as k,va as E}from"./chunk.VMEX2KZ4.js";import"./chunk.MRK6QJV5.js";import"./chunk.AJZBJBMO.js";var F=(e,i)=>S(e,i).slice(1);function j(e,i){let l=e.split("/").filter(Boolean);return l.length===i.length&&l.every((s,h)=>s.startsWith(":")||s==="*"||s===i[h])}var $=["problems","search","map","places"];function R(e,i,l,s,h=[]){let{schema:r}=i,o=r.kinds,f=t=>{if(t.startsWith(w))return(t.slice(w.length).split("|")[0]??"").split("+").every(V=>o.includes(V));let y=O(t);return y!==null?o.includes(y):t.startsWith("edge:")||l.graph.getNode(t)!==void 0},[p="/",u]=e.path.split("?"),n=p.split("/").filter(Boolean),m=u?`?${u}`:"",d=n.length>0&&!$.includes(n[0])?o.find(t=>F(r,t)===n[0]):void 0,c=e.path;if(n[0]==="places"&&n.length===2)`/places/${n[1]}`!==W&&!s.some(t=>t.as===decodeURIComponent(n[1]))&&(c="/");else if(d){let t=n[1]===void 0?void 0:decodeURIComponent(n[1]);c=`/${F(r,d)}${t!==void 0&&l.graph.getNode(t)?.kind===d?`/${n[1]}`:""}${m}`}else n.length>0&&n.length<=2&&!$.includes(n[0])&&!h.some(t=>j(t.path,n))&&(c="/");let g=A(e.stop),P=g.within?.view,U=P!==void 0&&!s.some(t=>t.as===P),a=g;if(U){let{view:t,...y}=g.within??{};a={...a,within:y}}if(g.focusId&&!f(g.focusId)){let t=e.kind&&o.includes(e.kind)?G(e.kind):null;a={...v(a,t),zoom:!1}}return a={...a,relation:a.relation&&(o.includes(a.relation)||r.edgeKinds.includes(a.relation))?a.relation:null,expanded:a.expanded.filter(f),pins:Object.fromEntries(Object.entries(a.pins).filter(([t])=>f(t))),...a.selection?{selection:a.selection.filter(f)}:{}},{face:e.face,path:c,stop:b(a),...e.kind?{kind:e.kind}:{}}}function B(e,i,l){let s=e.at,h=e.pages?.routes()??[];if(e.routing!=="address"||typeof window>"u")return R(s,e.app,i,l,h);let{pathname:r,search:o,hash:f}=window.location,p=E(r,e.basePath),u=I({routing:"address",...e.basePath===void 0?{}:{basePath:e.basePath},face:s.face}),n=u==="pages",m={...s,face:u,...p===null?{}:n?{path:p+o}:{stop:x(e.basePath)??s.stop}},d=R(m,e.app,i,l,h),c=n?d.path===m.path?null:k(d.path,e.basePath===void 0?{}:{basePath:e.basePath}):d.stop===b(A(m.stop))?null:r+o+d.stop;return p!==null&&c!==null&&c!==r+o+f&&window.history.replaceState(window.history.state,"",c),d}export{R as settle,B as settleAt};
@@ -1 +1 @@
1
- import{a as x,b as k,c as b,d as E,e as V}from"./chunk.KSEKVHJJ.js";import{g as d}from"./chunk.JIWB6VGT.js";var S=["card","row","page"],O=["good","warn","bad","neutral","accent"],M=["money","percent","date","relative","count"],R=4,w=40,A=["number","money","percent"],N=["card","row"],F=100,$={title:[],headline:[],list:["sort","limit","group","empty","as"],text:["tone"],badge:["tone"],field:["as","currency","label"],image:["as","label"],progress:["label"],group:["direction"],when:["show"],divider:[],figure:["as","currency","label"]},W=Object.keys($),T=`{"title": "{name}"}, {"headline": "{count(all('offer'))} offers"}, {"figure": expr, "as"?: "number"|"money"|"percent", "currency"?, "label"?}, {"list": expr, "sort"?, "limit"?, "group"?, "empty"?, "as"?: "card"|"row"}, {"text": "\u2026", "tone"?}, {"badge": "{status}", "tone"?}, {"field": "quote", "as"?, "currency"?, "label"?}, {"image": "photos", "as"?: "thumb"|"gallery"}, {"progress": {"value": expr, "max": expr}, "label"?}, {"group": [blocks], "direction"?: "row"|"column"}, {"when": expr, "show": [blocks]}, {"divider": true}, {"figure": true}`,D=n=>/^(image|file)$/.test(n?.of??n?.type??"");function tn(n){return Object.fromEntries(Object.entries(n.views??{}).filter(([,e])=>!Array.isArray(e)))}function sn(n){let e=n.views?.home;return Array.isArray(e)?e:void 0}var G={field:()=>!1,relation:()=>!1,figure:!1},z=n=>n.kind??"the home",h=(n,e)=>n!==void 0&&Object.hasOwn(n,e),y=n=>typeof n=="object"&&n!==null&&!Array.isArray(n);function I(n,e,s){let o=x(n);for(let a of o.unknownFunctions)s.findings.push(d("unknown-function",e,`"${a}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let a of o.names){if(s.kind===null){s.findings.push(d("view-name",e,`"${a}" names nothing here: these blocks are about no one record`,"reach records with all('<kind>'), like count(all('offer')) or first(all('party') where role == 'client').name"));continue}a==="id"||s.spec.field(a)||s.spec.relation(a)||s.findings.push(d("view-name",e,`${s.kind} has no field or relation called "${a}"`))}for(let a of o.edges)s.edges.has(a)||s.findings.push(d("view-edge",e,`"${a}" is not a relation any kind declares`));for(let a of o.sweeps)s.kinds.has(a)||s.findings.push(d("view-kind",e,`"${a}" is not a kind this document declares`))}function m(n,e,s){if(typeof n!="string"||n.length===0||n.length>2e3){s.findings.push(d("view-expression",e,`an expression is a line of the rule language, like "status == 'booked'"`));return}try{I(b(n),e,s)}catch(o){if(!(o instanceof k))throw o;s.findings.push(d("expression",e,`${o.sentence} (at character ${o.at+1})`))}}function j(n,e,s){if(typeof n!="string"||n.length===0||n.length>300){s.findings.push(d("view-template",e,'a template is words with {field} in braces, like "{name}" or "{quote|money}", at most 300 characters'));return}let o;try{o=V(n)}catch(a){if(a instanceof E||a instanceof k){s.findings.push(d("template",e,a.sentence));return}throw a}for(let a of o)a.expr&&I(a.expr,e,s)}function C(n,e,s){if(typeof n=="string"){O.includes(n)||s.findings.push(d("view-tone",e,`"${n}" is not a tone`,`use one of ${O.join(", ")}, or {"expr": "if(status == 'booked', 'good', 'neutral')"}`));return}if(y(n)&&Object.keys(n).length===1&&"expr"in n){m(n.expr,`${e}.expr`,s);return}s.findings.push(d("view-tone",e,'a tone is a word or {"expr": \u2026}',`one of ${O.join(", ")}`))}function v(n,e,s,o){if(!Array.isArray(n)){o.findings.push(d("view-shape",e,"a view is a list of blocks"));return}if(s>R){o.findings.push(d("view-depth",e,`blocks nest at most ${R} deep`,"flatten a group or a condition"));return}n.forEach((a,l)=>H(a,`${e}.${l}`,s,o))}function H(n,e,s,o){if(o.count++,!y(n)){o.findings.push(d("view-block",e,"a block is an object naming what it shows",`one of ${T}`));return}let a=Object.keys(n),l=a.filter(t=>W.includes(t)&&!(t==="group"&&a.includes("list")));if(l.length===0){o.findings.push(d("view-block",e,`${a.length>0?a.map(t=>`"${t}"`).join(", "):"an empty object"} is not a block Graview knows`,`one of ${T}`));return}if(l.length>1){o.findings.push(d("view-block",e,`a block is one thing, and this says ${l.map(t=>`"${t}"`).join(" and ")}`,"split it into two blocks"));return}let r=l[0];for(let t of a)t!==r&&t!="key"&&!$[r].includes(t)&&o.findings.push(d("unknown-key",`${e}.${t}`,`"${t}" is not part of a ${r} block`,$[r].length>0?`a ${r} block may also say ${$[r].map(f=>`"${f}"`).join(", ")}`:`a ${r} block says nothing else`));let i=n[r];switch(r){case"title":case"headline":case"text":case"badge":j(i,`${e}.${r}`,o),"tone"in n&&C(n.tone,`${e}.tone`,o);return;case"image":case"field":{let t=r==="image";if(typeof i!="string"||!(t?o.spec.files?.(i):o.spec.field(i))){let u=typeof i=="string"&&o.spec.relation(i);o.findings.push(d(`view-${r}`,`${e}.${r}`,`${o.kind} has no ${t?"image or file ":""}field ${typeof i=="string"?`"${i}"`:"by that name"}`,u?`"${i}" is a relation; show it with {"text": "{${i}.name}"}`:void 0))}let f=t?["thumb","gallery"]:M;"as"in n&&!f.includes(n.as)&&o.findings.push(d("view-format",`${e}.as`,`"${String(n.as)}" is not a way to show ${t?"pictures":"a field"}`,`use one of ${f.join(", ")}`)),t||L(n,e,o,"field"),"label"in n&&Y(n.label,`${e}.label`,o);return}case"progress":{!y(i)||Object.keys(i).some(t=>t!=="value"&&t!=="max")||!("value"in i)||!("max"in i)?o.findings.push(d("view-progress",`${e}.progress`,'progress is {"value": expression, "max": expression}')):(m(i.value,`${e}.progress.value`,o),m(i.max,`${e}.progress.max`,o)),"label"in n&&j(n.label,`${e}.label`,o);return}case"group":"direction"in n&&n.direction!=="row"&&n.direction!=="column"&&o.findings.push(d("view-direction",`${e}.direction`,`a group runs "row" or "column", not "${String(n.direction)}"`)),v(i,`${e}.group`,s+1,o);return;case"when":m(i,`${e}.when`,o),"show"in n?v(n.show,`${e}.show`,s+1,o):o.findings.push(d("view-when",e,'a condition says what it shows: {"when": expr, "show": [blocks]}'));return;case"figure":if(typeof i=="string")return P(n,e,o);for(let t of["as","currency","label"])t in n&&o.findings.push(d("unknown-key",`${e}.${t}`,`"${t}" belongs to a figure that works a number out; {"figure": true} is the kind's picture`,`write {"figure": "count(all('offer'))", "as": "number"}`));i!==!0?o.findings.push(d("view-block",`${e}.figure`,`a figure is a number worked out, {"figure": "sum(all('offer'), net)", "as": "money"}, or the kind's picture, {"figure": true}`)):o.spec.figure||o.findings.push(d("view-figure",`${e}.figure`,`${z(o)} has no figure to show`,o.kind===null?`work a number out: {"figure": "count(all('offer'))"}`:'give the kind a "figure", or leave this block out'));return;case"list":return X(n,e,o);case"divider":i!==!0&&o.findings.push(d("view-block",`${e}.${r}`,`write {"${r}": true}`));return}}function P(n,e,s){m(n.figure,`${e}.figure`,s),"as"in n&&!A.includes(n.as)&&s.findings.push(d("view-format",`${e}.as`,`"${String(n.as)}" is not a way to say a figure`,`use one of ${A.join(", ")}`)),L(n,e,s,"figure"),"label"in n&&j(n.label,`${e}.label`,s)}function L(n,e,s,o){"currency"in n&&(typeof n.currency!="string"||!/^[A-Z]{3}$/.test(n.currency)?s.findings.push(d("view-currency",`${e}.currency`,'a currency is its three-letter code, like "USD" or "EUR"')):n.as!=="money"&&s.findings.push(d("view-currency",`${e}.currency`,`a currency belongs on a ${o} shown as money`,'add "as": "money"')))}function U(n,e){let s=[...e.kinds],o=(l,r)=>{let i=new Set;for(let t of l){let f=e.vocabulary.namesOf(t)?.targets?.(r);if(f==="*")return s;for(let u of f??[])i.add(u)}return i.size>0?[...i]:void 0},a=l=>{switch(l.t){case"ident":return e.kind!==null&&e.spec.relation(l.name)?o([e.kind],l.name):void 0;case"member":{let r=a(l.object);return r?o(r,l.name):void 0}case"where":return a(l.set);case"call":{let r=l.args[0],i=r?.t==="lit"&&typeof r.value=="string"?r.value:void 0;if(l.fn==="all")return i!==void 0&&e.kinds.has(i)?[i]:void 0;let t=l.args.length===2&&l.args[1]?.t==="lit"&&typeof l.args[1].value=="string"?l.args[1].value:void 0;if(l.fn==="out"&&t!==void 0){let f=a(r);return f?o(f,t):void 0}if(l.fn==="out")return i!==void 0&&e.kind!==null?o([e.kind],i):void 0;if(l.fn==="in"){let f=t??i,u=t!==void 0?a(r):e.kind!==null?[e.kind]:void 0,c=f!==void 0?e.vocabulary.sources(f).filter(g=>{let p=e.vocabulary.namesOf(g)?.targets?.(f);return!u||p==="*"||u.some(K=>p?.includes(K))}):[];return c.length>0?c:void 0}if((l.fn==="sort"||l.fn==="first")&&r)return a(r);if(l.fn==="either"){let f=l.args.map(a);return f.every(u=>u!==void 0)?[...new Set(f.flatMap(u=>u??[]))]:void 0}return}default:return}};return a(n)}function _(n,e,s,o){let a;try{a=b(n)}catch(r){if(!(r instanceof k))throw r;o.findings.push(d("expression",e,`${r.sentence} (at character ${r.at+1})`));return}let l=x(a);for(let r of l.unknownFunctions)o.findings.push(d("unknown-function",e,`"${r}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let r of l.edges)o.edges.has(r)||o.findings.push(d("view-edge",e,`"${r}" is not a relation any kind declares`));if(s)for(let r of l.names)r==="id"||s.some(i=>o.vocabulary.namesOf(i)?.field(r)||o.vocabulary.namesOf(i)?.relation(r))||o.findings.push(d("view-name",e,`${s.join(" and ")} ${s.length===1?"has":"have"} no field or relation called "${r}"`))}function X(n,e,s){let o=n.list;m(o,`${e}.list`,s);let a;if(typeof o=="string")try{a=U(b(o),s)}catch{a=void 0}let l=i=>{if(!a)return[...s.kinds].map(f=>s.vocabulary.namesOf(f)?.choices?.(i)).find(f=>f!==void 0);let t=a.map(f=>s.vocabulary.namesOf(f)?.choices?.(i));return t.every(f=>f!==void 0)?[...new Set(t.flatMap(f=>f??[]))]:void 0},r=a?a.join(" and "):"any kind";if("sort"in n){let i=n.sort;if(typeof i=="string")_(i,`${e}.sort`,a,s);else if(y(i)&&typeof i.by=="string"&&Object.keys(i).every(t=>t==="by"||t==="direction")){let t=i.direction;t!==void 0&&t!=="asc"&&t!=="desc"&&t!=="choices"?s.findings.push(d("list-sort",`${e}.sort.direction`,`a list is sorted "asc", "desc" or "choices", not "${String(t)}"`,'"choices" puts a choice field in the order its choices are declared')):t==="choices"?l(i.by)===void 0&&s.findings.push(d("list-sort",`${e}.sort.by`,`"${i.by}" is not a choice field of ${r}, so it has no declared order`,'sort by a choice field, or say "asc" or "desc"')):_(i.by,`${e}.sort.by`,a,s)}else s.findings.push(d("list-sort",`${e}.sort`,'a sort is a key, like "net", or {"by": key, "direction": "asc" | "desc" | "choices"}'))}if("limit"in n){let i=n.limit;(typeof i!="number"||!Number.isInteger(i)||i<1||i>F)&&s.findings.push(d("list-limit",`${e}.limit`,`a limit is a whole number from 1 to ${F}`))}if("group"in n){let i=n.group,t=typeof i=="string"?i:y(i)&&typeof i.by=="string"?i.by:void 0;if(!(typeof i=="string"||y(i)&&Object.keys(i).every(u=>u==="by"||u==="headings"))||t===void 0)s.findings.push(d("list-group",`${e}.group`,'a group is a choice field, like "type", or {"by": "type", "headings": {"pain": "What hurts"}}'));else{let u=l(t);if(u===void 0&&s.findings.push(d("list-group",`${e}.group`,`"${t}" is not a choice field of ${r}, so it has no choices to group by`,"group by a field whose type is enum")),y(i)&&"headings"in i){let c=i.headings;if(!y(c)||Object.values(c).some(g=>typeof g!="string"||g.length===0||g.length>80))s.findings.push(d("list-group",`${e}.group.headings`,'headings are words per choice, like {"pain": "What hurts"}, at most 80 characters each'));else if(u)for(let g of Object.keys(c))u.includes(g)||s.findings.push(d("list-group",`${e}.group.headings.${g}`,`"${g}" is not one of ${t}'s choices`,`use ${u.join(", ")}`))}}}"empty"in n&&(typeof n.empty!="string"||n.empty.length===0||n.empty.length>200)&&s.findings.push(d("list-empty",`${e}.empty`,"what an empty list says is a sentence, at most 200 characters")),"as"in n&&!N.includes(n.as)&&s.findings.push(d("list-as",`${e}.as`,`a list draws each record as its "card" or its "row", not "${String(n.as)}"`))}function Y(n,e,s){(typeof n!="string"||n.length===0||n.length>60)&&s.findings.push(d("view-label",e,"a label is a few words, at most 60 characters"))}function B(n,e,s,o,a,l,r){let i={kind:null,spec:G,kinds:o,edges:a,vocabulary:s,findings:l,count:0};Array.isArray(n)&&n.length===0&&l.push(d("view-shape",e,`${r} has no blocks`,'give it one: {"headline": "\u2026"}')),v(n,e,1,i),i.count>w&&l.push(d("view-size",e,`${r} has ${i.count} blocks; a view has at most ${w}`,"show less"))}function q(n,e,s,o,a){Array.isArray(n)&&n.forEach((l,r)=>{if(!y(l)||l.name!=="blocks"||!y(l.options)||!("blocks"in l.options))return;let i=[];B(l.options.blocks,`lenses.${r}.options.blocks`,e,s,o,i,`the lens "${String(l.title??r)}"`);for(let t of i)a.push({...t,severity:"warning"})})}function Z(n,e,s,o,a,l,r){let i=[];if(n===void 0)return i;if(!y(n))return i.push(d("view-shape",e,'views are an object of kinds, each with a "card", a "row" or a "page"')),i;for(let[t,f]of Object.entries(n)){if(t==="home"&&Array.isArray(f)){B(f,`${e}.home`,r,o,a,i,"the home");continue}let u=s(t);if(!u){i.push(d("view-kind",`${e}.${t}`,`"${t}" is not a kind this ${l} declares`));continue}if(!y(f)){i.push(d("view-shape",`${e}.${t}`,`a kind's views are {"card": [blocks], "row": [blocks], "page": [blocks]}`));continue}for(let c of Object.keys(f))S.includes(c)||i.push(d("view-slot",`${e}.${t}.${c}`,`"${c}" is not a place a view is drawn`,`use ${S.map(g=>`"${g}"`).join(", ")}`));for(let c of S){let g=f[c];if(g===void 0)continue;let p={kind:t,spec:u,kinds:o,edges:a,vocabulary:r,findings:i,count:0};v(g,`${e}.${t}.${c}`,1,p),p.count>w&&i.push(d("view-size",`${e}.${t}.${c}`,`this ${c} has ${p.count} blocks; a view has at most ${w}`,"show less, or move detail to the page"))}}return i}function rn(n){let e=new Set(Object.keys(n.kinds)),s=new Set(Object.values(n.kinds).flatMap(r=>Object.keys(r.edges??{}))),o=r=>{let i=h(n.kinds,r)?n.kinds[r]:void 0;return i?{field:t=>h(i.fields,t)||h(i.computed,t),relation:t=>h(i.edges,t),figure:i.figure!==void 0,files:t=>h(i.fields,t)&&D(i.fields[t]),choices:t=>h(i.fields,t)&&i.fields[t].type==="enum"?i.fields[t].options:void 0,targets:t=>h(i.edges,t)?i.edges[t].to:void 0}:void 0},a={namesOf:o,sources:r=>Object.keys(n.kinds).filter(i=>h(n.kinds[i].edges,r))},l=Z(n.views,"views",o,e,s,"document",a);return q(n.lenses,a,e,s,l),l}export{O as a,M as b,A as c,F as d,tn as e,sn as f,rn as g};
1
+ import{a as x,b as k,c as b,d as E,e as V}from"./chunk.VD6FJ6KJ.js";import{g as d}from"./chunk.OHGJ5BZ4.js";var S=["card","row","page"],O=["good","warn","bad","neutral","accent"],M=["money","percent","date","relative","count"],R=4,w=40,A=["number","money","percent"],N=["card","row"],F=100,$={title:[],headline:[],list:["sort","limit","group","empty","as"],text:["tone"],badge:["tone"],field:["as","currency","label"],image:["as","label"],progress:["label"],group:["direction"],when:["show"],divider:[],figure:["as","currency","label"]},W=Object.keys($),T=`{"title": "{name}"}, {"headline": "{count(all('offer'))} offers"}, {"figure": expr, "as"?: "number"|"money"|"percent", "currency"?, "label"?}, {"list": expr, "sort"?, "limit"?, "group"?, "empty"?, "as"?: "card"|"row"}, {"text": "\u2026", "tone"?}, {"badge": "{status}", "tone"?}, {"field": "quote", "as"?, "currency"?, "label"?}, {"image": "photos", "as"?: "thumb"|"gallery"}, {"progress": {"value": expr, "max": expr}, "label"?}, {"group": [blocks], "direction"?: "row"|"column"}, {"when": expr, "show": [blocks]}, {"divider": true}, {"figure": true}`,D=n=>/^(image|file)$/.test(n?.of??n?.type??"");function tn(n){return Object.fromEntries(Object.entries(n.views??{}).filter(([,e])=>!Array.isArray(e)))}function sn(n){let e=n.views?.home;return Array.isArray(e)?e:void 0}var G={field:()=>!1,relation:()=>!1,figure:!1},z=n=>n.kind??"the home",h=(n,e)=>n!==void 0&&Object.hasOwn(n,e),y=n=>typeof n=="object"&&n!==null&&!Array.isArray(n);function I(n,e,s){let o=x(n);for(let a of o.unknownFunctions)s.findings.push(d("unknown-function",e,`"${a}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let a of o.names){if(s.kind===null){s.findings.push(d("view-name",e,`"${a}" names nothing here: these blocks are about no one record`,"reach records with all('<kind>'), like count(all('offer')) or first(all('party') where role == 'client').name"));continue}a==="id"||s.spec.field(a)||s.spec.relation(a)||s.findings.push(d("view-name",e,`${s.kind} has no field or relation called "${a}"`))}for(let a of o.edges)s.edges.has(a)||s.findings.push(d("view-edge",e,`"${a}" is not a relation any kind declares`));for(let a of o.sweeps)s.kinds.has(a)||s.findings.push(d("view-kind",e,`"${a}" is not a kind this document declares`))}function m(n,e,s){if(typeof n!="string"||n.length===0||n.length>2e3){s.findings.push(d("view-expression",e,`an expression is a line of the rule language, like "status == 'booked'"`));return}try{I(b(n),e,s)}catch(o){if(!(o instanceof k))throw o;s.findings.push(d("expression",e,`${o.sentence} (at character ${o.at+1})`))}}function j(n,e,s){if(typeof n!="string"||n.length===0||n.length>300){s.findings.push(d("view-template",e,'a template is words with {field} in braces, like "{name}" or "{quote|money}", at most 300 characters'));return}let o;try{o=V(n)}catch(a){if(a instanceof E||a instanceof k){s.findings.push(d("template",e,a.sentence));return}throw a}for(let a of o)a.expr&&I(a.expr,e,s)}function C(n,e,s){if(typeof n=="string"){O.includes(n)||s.findings.push(d("view-tone",e,`"${n}" is not a tone`,`use one of ${O.join(", ")}, or {"expr": "if(status == 'booked', 'good', 'neutral')"}`));return}if(y(n)&&Object.keys(n).length===1&&"expr"in n){m(n.expr,`${e}.expr`,s);return}s.findings.push(d("view-tone",e,'a tone is a word or {"expr": \u2026}',`one of ${O.join(", ")}`))}function v(n,e,s,o){if(!Array.isArray(n)){o.findings.push(d("view-shape",e,"a view is a list of blocks"));return}if(s>R){o.findings.push(d("view-depth",e,`blocks nest at most ${R} deep`,"flatten a group or a condition"));return}n.forEach((a,l)=>H(a,`${e}.${l}`,s,o))}function H(n,e,s,o){if(o.count++,!y(n)){o.findings.push(d("view-block",e,"a block is an object naming what it shows",`one of ${T}`));return}let a=Object.keys(n),l=a.filter(t=>W.includes(t)&&!(t==="group"&&a.includes("list")));if(l.length===0){o.findings.push(d("view-block",e,`${a.length>0?a.map(t=>`"${t}"`).join(", "):"an empty object"} is not a block Graview knows`,`one of ${T}`));return}if(l.length>1){o.findings.push(d("view-block",e,`a block is one thing, and this says ${l.map(t=>`"${t}"`).join(" and ")}`,"split it into two blocks"));return}let r=l[0];for(let t of a)t!==r&&t!="key"&&!$[r].includes(t)&&o.findings.push(d("unknown-key",`${e}.${t}`,`"${t}" is not part of a ${r} block`,$[r].length>0?`a ${r} block may also say ${$[r].map(f=>`"${f}"`).join(", ")}`:`a ${r} block says nothing else`));let i=n[r];switch(r){case"title":case"headline":case"text":case"badge":j(i,`${e}.${r}`,o),"tone"in n&&C(n.tone,`${e}.tone`,o);return;case"image":case"field":{let t=r==="image";if(typeof i!="string"||!(t?o.spec.files?.(i):o.spec.field(i))){let u=typeof i=="string"&&o.spec.relation(i);o.findings.push(d(`view-${r}`,`${e}.${r}`,`${o.kind} has no ${t?"image or file ":""}field ${typeof i=="string"?`"${i}"`:"by that name"}`,u?`"${i}" is a relation; show it with {"text": "{${i}.name}"}`:void 0))}let f=t?["thumb","gallery"]:M;"as"in n&&!f.includes(n.as)&&o.findings.push(d("view-format",`${e}.as`,`"${String(n.as)}" is not a way to show ${t?"pictures":"a field"}`,`use one of ${f.join(", ")}`)),t||L(n,e,o,"field"),"label"in n&&Y(n.label,`${e}.label`,o);return}case"progress":{!y(i)||Object.keys(i).some(t=>t!=="value"&&t!=="max")||!("value"in i)||!("max"in i)?o.findings.push(d("view-progress",`${e}.progress`,'progress is {"value": expression, "max": expression}')):(m(i.value,`${e}.progress.value`,o),m(i.max,`${e}.progress.max`,o)),"label"in n&&j(n.label,`${e}.label`,o);return}case"group":"direction"in n&&n.direction!=="row"&&n.direction!=="column"&&o.findings.push(d("view-direction",`${e}.direction`,`a group runs "row" or "column", not "${String(n.direction)}"`)),v(i,`${e}.group`,s+1,o);return;case"when":m(i,`${e}.when`,o),"show"in n?v(n.show,`${e}.show`,s+1,o):o.findings.push(d("view-when",e,'a condition says what it shows: {"when": expr, "show": [blocks]}'));return;case"figure":if(typeof i=="string")return P(n,e,o);for(let t of["as","currency","label"])t in n&&o.findings.push(d("unknown-key",`${e}.${t}`,`"${t}" belongs to a figure that works a number out; {"figure": true} is the kind's picture`,`write {"figure": "count(all('offer'))", "as": "number"}`));i!==!0?o.findings.push(d("view-block",`${e}.figure`,`a figure is a number worked out, {"figure": "sum(all('offer'), net)", "as": "money"}, or the kind's picture, {"figure": true}`)):o.spec.figure||o.findings.push(d("view-figure",`${e}.figure`,`${z(o)} has no figure to show`,o.kind===null?`work a number out: {"figure": "count(all('offer'))"}`:'give the kind a "figure", or leave this block out'));return;case"list":return X(n,e,o);case"divider":i!==!0&&o.findings.push(d("view-block",`${e}.${r}`,`write {"${r}": true}`));return}}function P(n,e,s){m(n.figure,`${e}.figure`,s),"as"in n&&!A.includes(n.as)&&s.findings.push(d("view-format",`${e}.as`,`"${String(n.as)}" is not a way to say a figure`,`use one of ${A.join(", ")}`)),L(n,e,s,"figure"),"label"in n&&j(n.label,`${e}.label`,s)}function L(n,e,s,o){"currency"in n&&(typeof n.currency!="string"||!/^[A-Z]{3}$/.test(n.currency)?s.findings.push(d("view-currency",`${e}.currency`,'a currency is its three-letter code, like "USD" or "EUR"')):n.as!=="money"&&s.findings.push(d("view-currency",`${e}.currency`,`a currency belongs on a ${o} shown as money`,'add "as": "money"')))}function U(n,e){let s=[...e.kinds],o=(l,r)=>{let i=new Set;for(let t of l){let f=e.vocabulary.namesOf(t)?.targets?.(r);if(f==="*")return s;for(let u of f??[])i.add(u)}return i.size>0?[...i]:void 0},a=l=>{switch(l.t){case"ident":return e.kind!==null&&e.spec.relation(l.name)?o([e.kind],l.name):void 0;case"member":{let r=a(l.object);return r?o(r,l.name):void 0}case"where":return a(l.set);case"call":{let r=l.args[0],i=r?.t==="lit"&&typeof r.value=="string"?r.value:void 0;if(l.fn==="all")return i!==void 0&&e.kinds.has(i)?[i]:void 0;let t=l.args.length===2&&l.args[1]?.t==="lit"&&typeof l.args[1].value=="string"?l.args[1].value:void 0;if(l.fn==="out"&&t!==void 0){let f=a(r);return f?o(f,t):void 0}if(l.fn==="out")return i!==void 0&&e.kind!==null?o([e.kind],i):void 0;if(l.fn==="in"){let f=t??i,u=t!==void 0?a(r):e.kind!==null?[e.kind]:void 0,c=f!==void 0?e.vocabulary.sources(f).filter(g=>{let p=e.vocabulary.namesOf(g)?.targets?.(f);return!u||p==="*"||u.some(K=>p?.includes(K))}):[];return c.length>0?c:void 0}if((l.fn==="sort"||l.fn==="first")&&r)return a(r);if(l.fn==="either"){let f=l.args.map(a);return f.every(u=>u!==void 0)?[...new Set(f.flatMap(u=>u??[]))]:void 0}return}default:return}};return a(n)}function _(n,e,s,o){let a;try{a=b(n)}catch(r){if(!(r instanceof k))throw r;o.findings.push(d("expression",e,`${r.sentence} (at character ${r.at+1})`));return}let l=x(a);for(let r of l.unknownFunctions)o.findings.push(d("unknown-function",e,`"${r}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let r of l.edges)o.edges.has(r)||o.findings.push(d("view-edge",e,`"${r}" is not a relation any kind declares`));if(s)for(let r of l.names)r==="id"||s.some(i=>o.vocabulary.namesOf(i)?.field(r)||o.vocabulary.namesOf(i)?.relation(r))||o.findings.push(d("view-name",e,`${s.join(" and ")} ${s.length===1?"has":"have"} no field or relation called "${r}"`))}function X(n,e,s){let o=n.list;m(o,`${e}.list`,s);let a;if(typeof o=="string")try{a=U(b(o),s)}catch{a=void 0}let l=i=>{if(!a)return[...s.kinds].map(f=>s.vocabulary.namesOf(f)?.choices?.(i)).find(f=>f!==void 0);let t=a.map(f=>s.vocabulary.namesOf(f)?.choices?.(i));return t.every(f=>f!==void 0)?[...new Set(t.flatMap(f=>f??[]))]:void 0},r=a?a.join(" and "):"any kind";if("sort"in n){let i=n.sort;if(typeof i=="string")_(i,`${e}.sort`,a,s);else if(y(i)&&typeof i.by=="string"&&Object.keys(i).every(t=>t==="by"||t==="direction")){let t=i.direction;t!==void 0&&t!=="asc"&&t!=="desc"&&t!=="choices"?s.findings.push(d("list-sort",`${e}.sort.direction`,`a list is sorted "asc", "desc" or "choices", not "${String(t)}"`,'"choices" puts a choice field in the order its choices are declared')):t==="choices"?l(i.by)===void 0&&s.findings.push(d("list-sort",`${e}.sort.by`,`"${i.by}" is not a choice field of ${r}, so it has no declared order`,'sort by a choice field, or say "asc" or "desc"')):_(i.by,`${e}.sort.by`,a,s)}else s.findings.push(d("list-sort",`${e}.sort`,'a sort is a key, like "net", or {"by": key, "direction": "asc" | "desc" | "choices"}'))}if("limit"in n){let i=n.limit;(typeof i!="number"||!Number.isInteger(i)||i<1||i>F)&&s.findings.push(d("list-limit",`${e}.limit`,`a limit is a whole number from 1 to ${F}`))}if("group"in n){let i=n.group,t=typeof i=="string"?i:y(i)&&typeof i.by=="string"?i.by:void 0;if(!(typeof i=="string"||y(i)&&Object.keys(i).every(u=>u==="by"||u==="headings"))||t===void 0)s.findings.push(d("list-group",`${e}.group`,'a group is a choice field, like "type", or {"by": "type", "headings": {"pain": "What hurts"}}'));else{let u=l(t);if(u===void 0&&s.findings.push(d("list-group",`${e}.group`,`"${t}" is not a choice field of ${r}, so it has no choices to group by`,"group by a field whose type is enum")),y(i)&&"headings"in i){let c=i.headings;if(!y(c)||Object.values(c).some(g=>typeof g!="string"||g.length===0||g.length>80))s.findings.push(d("list-group",`${e}.group.headings`,'headings are words per choice, like {"pain": "What hurts"}, at most 80 characters each'));else if(u)for(let g of Object.keys(c))u.includes(g)||s.findings.push(d("list-group",`${e}.group.headings.${g}`,`"${g}" is not one of ${t}'s choices`,`use ${u.join(", ")}`))}}}"empty"in n&&(typeof n.empty!="string"||n.empty.length===0||n.empty.length>200)&&s.findings.push(d("list-empty",`${e}.empty`,"what an empty list says is a sentence, at most 200 characters")),"as"in n&&!N.includes(n.as)&&s.findings.push(d("list-as",`${e}.as`,`a list draws each record as its "card" or its "row", not "${String(n.as)}"`))}function Y(n,e,s){(typeof n!="string"||n.length===0||n.length>60)&&s.findings.push(d("view-label",e,"a label is a few words, at most 60 characters"))}function B(n,e,s,o,a,l,r){let i={kind:null,spec:G,kinds:o,edges:a,vocabulary:s,findings:l,count:0};Array.isArray(n)&&n.length===0&&l.push(d("view-shape",e,`${r} has no blocks`,'give it one: {"headline": "\u2026"}')),v(n,e,1,i),i.count>w&&l.push(d("view-size",e,`${r} has ${i.count} blocks; a view has at most ${w}`,"show less"))}function q(n,e,s,o,a){Array.isArray(n)&&n.forEach((l,r)=>{if(!y(l)||l.name!=="blocks"||!y(l.options)||!("blocks"in l.options))return;let i=[];B(l.options.blocks,`lenses.${r}.options.blocks`,e,s,o,i,`the lens "${String(l.title??r)}"`);for(let t of i)a.push({...t,severity:"warning"})})}function Z(n,e,s,o,a,l,r){let i=[];if(n===void 0)return i;if(!y(n))return i.push(d("view-shape",e,'views are an object of kinds, each with a "card", a "row" or a "page"')),i;for(let[t,f]of Object.entries(n)){if(t==="home"&&Array.isArray(f)){B(f,`${e}.home`,r,o,a,i,"the home");continue}let u=s(t);if(!u){i.push(d("view-kind",`${e}.${t}`,`"${t}" is not a kind this ${l} declares`));continue}if(!y(f)){i.push(d("view-shape",`${e}.${t}`,`a kind's views are {"card": [blocks], "row": [blocks], "page": [blocks]}`));continue}for(let c of Object.keys(f))S.includes(c)||i.push(d("view-slot",`${e}.${t}.${c}`,`"${c}" is not a place a view is drawn`,`use ${S.map(g=>`"${g}"`).join(", ")}`));for(let c of S){let g=f[c];if(g===void 0)continue;let p={kind:t,spec:u,kinds:o,edges:a,vocabulary:r,findings:i,count:0};v(g,`${e}.${t}.${c}`,1,p),p.count>w&&i.push(d("view-size",`${e}.${t}.${c}`,`this ${c} has ${p.count} blocks; a view has at most ${w}`,"show less, or move detail to the page"))}}return i}function rn(n){let e=new Set(Object.keys(n.kinds)),s=new Set(Object.values(n.kinds).flatMap(r=>Object.keys(r.edges??{}))),o=r=>{let i=h(n.kinds,r)?n.kinds[r]:void 0;return i?{field:t=>h(i.fields,t)||h(i.computed,t),relation:t=>h(i.edges,t),figure:i.figure!==void 0,files:t=>h(i.fields,t)&&D(i.fields[t]),choices:t=>h(i.fields,t)&&i.fields[t].type==="enum"?i.fields[t].options:void 0,targets:t=>h(i.edges,t)?i.edges[t].to:void 0}:void 0},a={namesOf:o,sources:r=>Object.keys(n.kinds).filter(i=>h(n.kinds[i].edges,r))},l=Z(n.views,"views",o,e,s,"document",a);return q(n.lenses,a,e,s,l),l}export{O as a,M as b,A as c,F as d,tn as e,sn as f,rn as g};
@@ -1 +1 @@
1
- import{a as c,b as d,c as e,d as f,e as g,f as h,g as i}from"./chunk.UUMXYMOX.js";import{a,b}from"./chunk.D3XF643V.js";import"./chunk.NLFLFIDS.js";import"./chunk.6LJ66MB7.js";import"./chunk.SVL6I37U.js";import"./chunk.P7YN4Z3K.js";import"./chunk.MRK6QJV5.js";import"./chunk.AJZBJBMO.js";export{c as ARRANGE_NARROW,h as ArrangeBar,i as arrangementCaption,a as arrangementOf,f as directionWords,e as inSentence,g as preloadArrangeLists,d as sayCondition,b as withArrangement};
1
+ import{a as c,b as d,c as e,d as f,e as g,f as h,g as i}from"./chunk.LHAAZQNQ.js";import{a,b}from"./chunk.PHY3AH3L.js";import"./chunk.QZWN46V6.js";import"./chunk.6LJ66MB7.js";import"./chunk.OYULDOQP.js";import"./chunk.VMEX2KZ4.js";import"./chunk.MRK6QJV5.js";import"./chunk.AJZBJBMO.js";export{c as ARRANGE_NARROW,h as ArrangeBar,i as arrangementCaption,a as arrangementOf,f as directionWords,e as inSentence,g as preloadArrangeLists,d as sayCondition,b as withArrangement};