graview 0.1.33 → 0.1.35

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 (144) hide show
  1. package/dist/preview/{chunk.CWHRDBOF.js → chunk.2OBIO5Y6.js} +1 -1
  2. package/dist/preview/{chunk.K5ME5GCG.js → chunk.2QQAOJET.js} +1 -1
  3. package/dist/preview/{chunk.4HZ7QTXZ.js → chunk.2YGQVI6T.js} +1 -1
  4. package/dist/preview/{chunk.COQKECUH.js → chunk.3C4RJIJU.js} +1 -1
  5. package/dist/preview/{chunk.TAQ764IQ.js → chunk.3H4NVUWV.js} +1 -1
  6. package/dist/preview/{chunk.UATVTXZY.js → chunk.3P4IIXIT.js} +1 -1
  7. package/dist/preview/chunk.3QXHII5W.js +1 -0
  8. package/dist/preview/chunk.4J75WRDG.js +1 -0
  9. package/dist/preview/{chunk.MAF7C3VM.js → chunk.4K5QCJFH.js} +1 -1
  10. package/dist/preview/chunk.4NZBMZC7.js +117 -0
  11. package/dist/preview/{chunk.ULRW47RP.js → chunk.52QAIGCD.js} +1 -1
  12. package/dist/preview/{chunk.D75KC3LL.js → chunk.577PGFUT.js} +1 -1
  13. package/dist/preview/{chunk.RCKTBOY2.js → chunk.5B7NWF7C.js} +1 -1
  14. package/dist/preview/{chunk.EBGAYL32.js → chunk.5EAQDBBE.js} +1 -1
  15. package/dist/preview/{chunk.XBJYQNVE.js → chunk.5FZQI2US.js} +1 -1
  16. package/dist/preview/chunk.5MCC54VM.js +1 -0
  17. package/dist/preview/{chunk.QVVJRSRM.js → chunk.5VB7DJTL.js} +1 -1
  18. package/dist/preview/chunk.656N5BHG.js +1 -0
  19. package/dist/preview/{chunk.5UL7YDUD.js → chunk.6J7DR7XQ.js} +1 -1
  20. package/dist/preview/{chunk.EF3XNU4O.js → chunk.6K2HASOH.js} +1 -1
  21. package/dist/preview/chunk.6P7P2AW7.js +1 -0
  22. package/dist/preview/chunk.747GGBPR.js +2 -0
  23. package/dist/preview/{chunk.T5VG5A6V.js → chunk.A3F7MFDR.js} +1 -1
  24. package/dist/preview/chunk.AEHPDVLQ.js +1 -0
  25. package/dist/preview/chunk.AINNENYD.js +6 -0
  26. package/dist/preview/{chunk.4HNG4UXT.js → chunk.APNN6BKF.js} +1 -1
  27. package/dist/preview/{chunk.AR3DCDHU.js → chunk.B2KITMSD.js} +1 -1
  28. package/dist/preview/{chunk.5T5XGILP.js → chunk.BGW7XTMH.js} +1 -1
  29. package/dist/preview/chunk.BL6VDLAW.js +1 -0
  30. package/dist/preview/{chunk.XNJEFUF7.js → chunk.CDMV6L5I.js} +1 -1
  31. package/dist/preview/chunk.CHJZ7LST.js +27 -0
  32. package/dist/preview/{chunk.H7EPE74C.js → chunk.D4WQEBWV.js} +1 -1
  33. package/dist/preview/chunk.DLT3EE4D.js +1 -0
  34. package/dist/preview/{chunk.GV2CQVKV.js → chunk.DMNXYMLC.js} +1 -1
  35. package/dist/preview/{chunk.IWQCOGHW.js → chunk.DNDHDDM6.js} +2 -2
  36. package/dist/preview/{chunk.EJPI3ST6.js → chunk.DPP7ITTU.js} +1 -1
  37. package/dist/preview/{chunk.LXBOVRFI.js → chunk.DQ5HAB3N.js} +1 -1
  38. package/dist/preview/chunk.DTR5I4BI.js +1 -0
  39. package/dist/preview/{chunk.MWGGV7DE.js → chunk.DUUARGPE.js} +1 -1
  40. package/dist/preview/{chunk.3TVXGJTU.js → chunk.EAM4NAQH.js} +1 -1
  41. package/dist/preview/{chunk.DYSPCGXX.js → chunk.EQWOQOFJ.js} +1 -1
  42. package/dist/preview/{chunk.FWTIUYXH.js → chunk.FBY5IUGU.js} +1 -1
  43. package/dist/preview/chunk.FHXXYWL3.js +1 -0
  44. package/dist/preview/{chunk.HLTRQU4Y.js → chunk.FIVLFXFB.js} +1 -1
  45. package/dist/preview/{chunk.UGFJKSHU.js → chunk.FSAHO3LV.js} +1 -1
  46. package/dist/preview/{chunk.JQU5GEU3.js → chunk.FUQVNXLB.js} +1 -1
  47. package/dist/preview/{chunk.TMVCTBAD.js → chunk.FVPOSGNG.js} +5 -5
  48. package/dist/preview/{chunk.4MERAWS2.js → chunk.FX6GH57T.js} +1 -1
  49. package/dist/preview/{chunk.CDP2XL66.js → chunk.G2ZPQUXM.js} +1 -1
  50. package/dist/preview/{chunk.CX3KL2C5.js → chunk.GCGITEON.js} +1 -1
  51. package/dist/preview/{chunk.3HXN4BOY.js → chunk.GCVO6N26.js} +1 -1
  52. package/dist/preview/{chunk.3K6YSVHC.js → chunk.GF7LA4QG.js} +1 -1
  53. package/dist/preview/{chunk.CN3UEF5N.js → chunk.GMOTRAKJ.js} +1 -1
  54. package/dist/preview/{chunk.UNL2HIF2.js → chunk.GO4QBFED.js} +1 -1
  55. package/dist/preview/{chunk.UHUGOTUU.js → chunk.H243UV3Z.js} +1 -1
  56. package/dist/preview/{chunk.G5NZVPJU.js → chunk.HPD5ZDZH.js} +1 -1
  57. package/dist/preview/{chunk.3TY5NFLY.js → chunk.IHFNLKXV.js} +1 -1
  58. package/dist/preview/{chunk.RIJUCHP4.js → chunk.IX6RNGAT.js} +1 -1
  59. package/dist/preview/{chunk.PIP6Z563.js → chunk.JAPYJ53U.js} +1 -1
  60. package/dist/preview/{chunk.5H4VXLZF.js → chunk.JLMLKDVX.js} +1 -1
  61. package/dist/preview/chunk.JMQ6YLQX.js +1 -0
  62. package/dist/preview/{chunk.J25KOSNW.js → chunk.KWCML3BF.js} +1 -1
  63. package/dist/preview/{chunk.ASCLIM2P.js → chunk.KYH4QIVI.js} +1 -1
  64. package/dist/preview/{chunk.HAIG6NVX.js → chunk.LAF6GTBN.js} +1 -1
  65. package/dist/preview/{chunk.E2YEOMPH.js → chunk.LIIC25G6.js} +1 -1
  66. package/dist/preview/{chunk.GYICGZMG.js → chunk.LRRVBM4F.js} +2 -2
  67. package/dist/preview/{chunk.I6FPNX43.js → chunk.LWSTEZIP.js} +1 -1
  68. package/dist/preview/chunk.M5HADQPP.js +1 -0
  69. package/dist/preview/{chunk.6UGEYZAC.js → chunk.MVN6H65Q.js} +1 -1
  70. package/dist/preview/chunk.O36ZDLWC.js +1 -0
  71. package/dist/preview/{chunk.GO4XBWJO.js → chunk.OEDCAHII.js} +1 -1
  72. package/dist/preview/{chunk.3NDH3EDN.js → chunk.OZ5KJLA2.js} +1 -1
  73. package/dist/preview/{chunk.QYZNAUIR.js → chunk.PJ2DF6C7.js} +1 -1
  74. package/dist/preview/{chunk.47STJVRV.js → chunk.PKKA6JWA.js} +1 -1
  75. package/dist/preview/{chunk.PBSMLINK.js → chunk.PPUAPAWR.js} +1 -1
  76. package/dist/preview/chunk.PQPTYNW2.js +1 -0
  77. package/dist/preview/{chunk.SYAEBGDC.js → chunk.PW7YH6JV.js} +1 -1
  78. package/dist/preview/{chunk.OC6IWRQ3.js → chunk.Q7TP4RFE.js} +1 -1
  79. package/dist/preview/chunk.QRMWFEEH.js +1 -0
  80. package/dist/preview/{chunk.UZGRRDHD.js → chunk.QU356VB2.js} +1 -1
  81. package/dist/preview/chunk.QVKKXMNK.js +1 -0
  82. package/dist/preview/{chunk.3AGY4QVS.js → chunk.QVUL2FSI.js} +1 -1
  83. package/dist/preview/chunk.RHYA742Q.js +1 -0
  84. package/dist/preview/{chunk.6YCBYL2Y.js → chunk.RIW7SQH4.js} +1 -1
  85. package/dist/preview/{chunk.NTF7FVB2.js → chunk.RTB4MMF6.js} +1 -1
  86. package/dist/preview/{chunk.NRAYZY3X.js → chunk.SBBNIYVB.js} +1 -1
  87. package/dist/preview/{chunk.7GKUVQVF.js → chunk.SD33BD7A.js} +1 -1
  88. package/dist/preview/{chunk.2NIOHEMX.js → chunk.SECORXDP.js} +1 -1
  89. package/dist/preview/{chunk.AOSMJKLH.js → chunk.TIBZZ2WY.js} +1 -1
  90. package/dist/preview/chunk.TPX6AVJL.js +1 -0
  91. package/dist/preview/{chunk.VG3O4LWB.js → chunk.TWWFWHK3.js} +1 -1
  92. package/dist/preview/chunk.U2PYW5MS.js +1 -0
  93. package/dist/preview/{chunk.BNV77BQZ.js → chunk.U5EJSTST.js} +3 -3
  94. package/dist/preview/{chunk.EKPRNDUV.js → chunk.UHQD3NTK.js} +1 -1
  95. package/dist/preview/chunk.UWIYKGYK.js +25 -0
  96. package/dist/preview/{chunk.UBFNZMUX.js → chunk.VMGWYCXU.js} +1 -1
  97. package/dist/preview/{chunk.JDUJDAGA.js → chunk.VWHMYPLL.js} +1 -1
  98. package/dist/preview/{chunk.R6K6GF5R.js → chunk.VZHV25JE.js} +1 -1
  99. package/dist/preview/chunk.WQBDTLPZ.js +1 -0
  100. package/dist/preview/{chunk.MNP4JI33.js → chunk.X7W27IRI.js} +4 -4
  101. package/dist/preview/{chunk.YIR7PPF3.js → chunk.XSYBNUXF.js} +1 -1
  102. package/dist/preview/{chunk.JOOQUWLT.js → chunk.Y5Z4ZDTO.js} +2 -2
  103. package/dist/preview/chunk.YT2CYCVT.js +1 -0
  104. package/dist/preview/{chunk.B2GLDIAS.js → chunk.Z7ZCR4LN.js} +1 -1
  105. package/dist/preview/{chunk.CAVBSL27.js → chunk.ZE4CTZQ3.js} +1 -1
  106. package/dist/preview/chunk.ZFWV4JAJ.js +1 -0
  107. package/dist/preview/chunk.ZHXX22AT.js +3 -0
  108. package/dist/preview/chunk.ZKXK22AH.js +1 -0
  109. package/dist/preview/chunk.ZQNLC33L.js +1 -0
  110. package/dist/preview/{chunk.OKRNJXTV.js → chunk.ZSW74NVJ.js} +1 -1
  111. package/dist/preview/{chunk.7T7NZZTC.js → chunk.ZZTDQKM2.js} +1 -1
  112. package/dist/preview/index.html +42 -42
  113. package/dist/preview/page.js +2 -2
  114. package/package.json +6 -6
  115. package/dist/preview/chunk.26LLZN3C.js +0 -1
  116. package/dist/preview/chunk.2WPZXIRP.js +0 -2
  117. package/dist/preview/chunk.4HRAQNJO.js +0 -27
  118. package/dist/preview/chunk.52W7WYME.js +0 -1
  119. package/dist/preview/chunk.63GXY2ME.js +0 -1
  120. package/dist/preview/chunk.67TPUXAY.js +0 -1
  121. package/dist/preview/chunk.6QWV5MVH.js +0 -25
  122. package/dist/preview/chunk.AKFKM4SW.js +0 -3
  123. package/dist/preview/chunk.BHXGM3PV.js +0 -1
  124. package/dist/preview/chunk.BQ3JHEHV.js +0 -1
  125. package/dist/preview/chunk.CIPS2OGR.js +0 -1
  126. package/dist/preview/chunk.DAZ2VSRD.js +0 -1
  127. package/dist/preview/chunk.ERIT3R6N.js +0 -1
  128. package/dist/preview/chunk.EYTBDMTW.js +0 -1
  129. package/dist/preview/chunk.GBRRGTIH.js +0 -1
  130. package/dist/preview/chunk.H7BST3XO.js +0 -1
  131. package/dist/preview/chunk.IDVAR5HM.js +0 -1
  132. package/dist/preview/chunk.KSES5U5B.js +0 -1
  133. package/dist/preview/chunk.LR3VDXPI.js +0 -1
  134. package/dist/preview/chunk.N6OX4NEQ.js +0 -1
  135. package/dist/preview/chunk.PHKSMUIA.js +0 -1
  136. package/dist/preview/chunk.SHPXD6FC.js +0 -1
  137. package/dist/preview/chunk.SHTJZ6UX.js +0 -1
  138. package/dist/preview/chunk.UVR2Z5ZC.js +0 -1
  139. package/dist/preview/chunk.WAZ7OGBD.js +0 -1
  140. package/dist/preview/chunk.XANVHJQ4.js +0 -1
  141. package/dist/preview/chunk.XKABS745.js +0 -1
  142. package/dist/preview/chunk.XMC7YDWT.js +0 -1
  143. package/dist/preview/chunk.Y2SFUALD.js +0 -117
  144. package/dist/preview/chunk.Y6ZNFQK3.js +0 -6
@@ -1,117 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{A as Ur,B as ke,C as bn,D as Ie,E as qe,F as jr,G as Sn,H as Pe,I as zr,J as _r,K as I,L as it,M as xn,N as Yr,O as Pn,P as Wt,Q as Qr,R as ie,S as le,T as An,a as Q,b as Re,c as te,d as Kr,e as vn,f as kn,g as rt,h as ne,i as he,j as se,k as A,l as re,m as B,n as ve,o as Ft,p as Le,q as me,r as Br,s as ut,t as It,u as ee,v as Ke,w as Gr,x as Dt,y as xe,z as Vr}from"./chunk.3NDH3EDN.js";import{b as qr,c as Ot,e as ae}from"./chunk.63GXY2ME.js";import{a as Dr,d as Wr,e as Hr}from"./chunk.UGFDSE37.js";import{a as Er,c as $r,f as Or,g as Fr,i as Ir}from"./chunk.67TPUXAY.js";import{a as xr,b as Pr,c as Ar,d as wn}from"./chunk.Y6ZNFQK3.js";import{a as Cr,b as Rr,d as Et,e as Lr,f as Tr,i as $t}from"./chunk.NRAYZY3X.js";import{a as Nt,b as hn,c as kr,e as br}from"./chunk.3HXN4BOY.js";import{m as Sr}from"./chunk.UHUGOTUU.js";import{a as sr,b as lr,c as dr,e as vr,f as yn,h as Mt}from"./chunk.EBGAYL32.js";import{d as ur,e as gr,f as mr,g as fr,n as yr,o as hr,q as wr,s as Tt}from"./chunk.DAZ2VSRD.js";import{a as mn}from"./chunk.XANVHJQ4.js";import{a as Lt,b as ar,c as rr,d as ir,e as or}from"./chunk.CAVBSL27.js";import{a as At,b as $a,c as Oa,d as Ct,e as Fa}from"./chunk.J25KOSNW.js";import{b as ja,c as tr,e as nr,f as gn}from"./chunk.LR3VDXPI.js";import{a as Ve,b as Qa,c as Xa,d as Ja,e as Za,f as er}from"./chunk.SHTJZ6UX.js";import{a as pn,b as Va,c as Ua}from"./chunk.UT6642FC.js";import{b as za,c as _a,i as pt}from"./chunk.ULRW47RP.js";import{r as un,s as Ya}from"./chunk.XMC7YDWT.js";import{f as Ha,g as at,i as Ka,j as qa,k as cn,q as Ba,r as Ga}from"./chunk.B2GLDIAS.js";import{b as Rt,c as Ia,d as Da,e as Wa}from"./chunk.6YCBYL2Y.js";import{C as fn,K as Mr,N as Nr,e as Na,f as Ea,j as Ei,q as cr,r as pr}from"./chunk.JOOQUWLT.js";import{F as Ee,K as ka,M as ba,P as Sa,Q as Y,T as xa,U as Pa,Y as Aa,Z as ye,a as wa,aa as Ca,ba as Ra,da as La,ha as nt,ia as Ta,ra as Ma,s as va,w as Ne}from"./chunk.6QWV5MVH.js";import{Dc as ma,Ec as fa,Gb as pa,Gc as Pt,I as aa,Jb as ua,Ma as la,N as ct,Oa as da,Oc as dn,Pc as ya,Tc as ha,W as et,X as ge,Ya as sn,Z as we,Za as ca,_ as St,aa as tt,ca as ra,da as ia,dc as ga,ea as He,fb as xt,la as oa,ma as sa,yc as ln}from"./chunk.MNP4JI33.js";import{b as H}from"./chunk.AJZBJBMO.js";function Xr(t,e,n={}){let a=t.graph.getNode(e);if(!a)return;let i=t.schema.tryDefinition(a.kind),r=l=>ge(t.schema.tryDefinition(l.kind),l),o=new Map;for(let l of t.graph.allEdges()){let d=l.from===e?"out":l.to===e?"in":null;if(!d)continue;let c=d==="out"?l.to:l.from,p=t.graph.getNode(c);if(!p)continue;let f=(d==="out"?i:t.schema.tryDefinition(p.kind))?.edges?.[l.kind],u=d==="in"?f?.inverse??f?.description:f?.description,k=`${l.kind}|${d}|${u??""}`;(o.get(k)??(()=>{let v={edgeKind:l.kind,direction:d,...u?{description:u}:{},targets:[]};return o.set(k,v),v})()).targets.push({id:p.id,kind:p.kind,label:r(p)})}return{id:e,kind:a.kind,label:r(a),fields:Da(pt(t.schema,t.graph,a),i),violations:sn(t.violations(n.context),[e]),actions:mn(t,[e],{focus:e,...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}}),links:[...o.values()].map(l=>{let d=Rt(l.targets.flatMap(c=>{let p=t.graph.getNode(c.id);return p?[p]:[]}),c=>t.schema.tryDefinition(c));return{...l,targets:[...l.targets].map(c=>d.has(c.id)?{...c,apart:d.get(c.id)}:c).sort((c,p)=>c.label.localeCompare(p.label))}})}}function Ue(t,e,n={}){return{kind:e,members:t.graph.nodesOfKind(e),actions:mn(t,[],{kindSelection:[e],...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}})}}function Jr(t,e){let n=(r,o)=>`${r}|${JSON.stringify(o)}`,a=new Map;for(let r of[...t.affordances,...t.withheld]){if(r.provider!=="invariant")continue;let o=n(r.mutation,r.args);a.has(o)||a.set(o,r.rank??Number.MAX_SAFE_INTEGER)}let i=Number.MAX_SAFE_INTEGER;return[...e].map((r,o)=>({repair:r,declared:o})).sort((r,o)=>(a.get(n(r.repair.mutation,r.repair.args??{}))??i)-(a.get(n(o.repair.mutation,o.repair.args??{}))??i)||r.declared-o.declared).map(r=>r.repair)}function je(t){let e=t.schema.kinds.map(i=>({kind:i,plural:tt(t.schema,i),count:t.graph.nodesOfKind(i).length})),n=new Map;for(let i of t.graph.allEdges()){let r=t.graph.getNode(i.from),o=t.graph.getNode(i.to);if(!r||!o)continue;let l=`${i.kind}|${r.kind}|${o.kind}`;n.set(l,(n.get(l)??0)+1)}let a=[];for(let{kind:i}of e){let r=t.schema.tryDefinition(i)?.edges??{};for(let[o,l]of Object.entries(r)){let d=l.to==="*"||l.to===void 0?(()=>{let c=[...n.keys()].filter(p=>p.startsWith(`${o}|${i}|`)).map(p=>p.split("|")[2]);return c.length>0?c:["*"]})():l.to;for(let c of d)a.push({edgeKind:o,from:i,to:c,...l.description?{description:l.description}:{},...l.inverse?{inverse:l.inverse}:{},count:n.get(`${o}|${i}|${c}`)??0})}}return{kinds:e,relations:a}}var De=H(Ee(),1);var ze=H(Ee(),1),S=H(Y(),1),$i=`
2
- form:where([data-graview-part="form"]) {
3
- /* A grid item of the section above it and a grid container for the
4
- fields below: both halves are allowed to be narrower than what is in
5
- them, or a big enough text size pushes the page sideways. See the note
6
- on \`column\` in pages.tsx. */
7
- display: grid;
8
- grid-template-columns: minmax(0, 1fr);
9
- min-width: 0;
10
- gap: 12px;
11
- }
12
- label:where([data-graview-part="field"]),
13
- div:where([data-graview-part="field"][data-graview-field="date"]) {
14
- display: grid;
15
- /* A track the width it was given: see the note on \`column\` in pages.tsx. */
16
- grid-template-columns: minmax(0, 1fr);
17
- min-width: 0;
18
- gap: 4px;
19
- }
20
- label:where([data-graview-part="field"][data-graview-field="boolean"]) {
21
- grid-auto-flow: column;
22
- justify-content: start;
23
- align-items: center;
24
- }
25
- span:where([data-graview-part="label"]),
26
- legend:where([data-graview-part="label"]),
27
- p:where([data-graview-part="unasked"]) {
28
- font-size: 0.8125rem;
29
- color: var(--graview-ink-muted);
30
- }
31
- p:where([data-graview-part="unasked"]) { margin: 0; }
32
- input:where([data-graview-part="control"]:not([type="checkbox"])),
33
- select:where([data-graview-part="control"]) {
34
- font: inherit;
35
- /* A TARGET IN EVERY ENGINE, not only in the one it was measured in.
36
- Padding and line height alone came to 24 in Chromium and to 22 in
37
- WebKit, which has its own intrinsic metrics for a \`select\` and rounds
38
- nothing up for anybody. So every picker on the routed face was under
39
- the WCAG 2.2 minimum in the browser iOS ships, and the check that says
40
- so (\`verify-pages\`' \`bigEnoughToHit\`) only ever ran there through
41
- \`pnpm engines\`. */
42
- min-height: 24px;
43
- /* NEVER WIDER THAN ITS FIELD. A select is as wide as its longest option,
44
- and a picker over 320 vehicles ("2027 Mercedes-Benz GLE AMG 53 4MATIC+
45
- Coupe") was 618 pixels on a 390 phone, and the whole page scrolled
46
- sideways. It shrinks to its track and cuts the option inside its box. */
47
- min-width: 0;
48
- max-width: 100%;
49
- text-overflow: ellipsis;
50
- box-sizing: border-box;
51
- padding: 7px 10px;
52
- border-radius: 8px;
53
- border: 1px solid var(--graview-edge);
54
- background: var(--graview-panel);
55
- color: var(--graview-ink);
56
- }
57
- /* A PICKER THAT STILL LOOKS LIKE ONE.
58
- WebKit ignores an author's padding and minimum height on a \`select\`
59
- while the native appearance is on \u2014 so every picker on the routed face
60
- came out 22 pixels tall in the browser iOS ships, under the 24 WCAG 2.2
61
- asks for, while the same element measured 35 in Chromium. Turning the
62
- appearance off is what makes the box the size it was asked to be, and it
63
- takes the platform's chevron with it; the chevron is put back, in the ink
64
- the scheme is already using. */
65
- span:where([data-graview-part="picker"]) {
66
- position: relative;
67
- display: grid;
68
- min-width: 0;
69
- }
70
- span:where([data-graview-part="picker"]) > select:where([data-graview-part="control"]) {
71
- appearance: none;
72
- padding-right: 28px;
73
- }
74
- span:where([data-graview-part="chevron"]) {
75
- position: absolute;
76
- right: 10px;
77
- top: 50%;
78
- transform: translateY(-50%);
79
- font-size: 0.75rem;
80
- line-height: 1;
81
- color: var(--graview-ink-muted);
82
- pointer-events: none;
83
- }
84
- fieldset:where([data-graview-part="group"]) {
85
- display: grid;
86
- gap: 10px;
87
- border: 1px solid var(--graview-edge);
88
- border-radius: 10px;
89
- padding: 12px;
90
- }
91
- fieldset:where([data-graview-part="group"][data-graview-field="list"]) { gap: 8px; }
92
- div:where([data-graview-part="item"]) {
93
- display: flex;
94
- gap: 8px;
95
- align-items: end;
96
- }
97
- button:where([data-graview-part="add"]),
98
- button:where([data-graview-part="submit"]) { justify-self: start; }
99
- p:where([data-graview-part="refused"]) {
100
- margin: 0;
101
- color: var(--graview-warn);
102
- font-size: 0.875rem;
103
- }
104
- `;function Oi({title:t,name:e,optional:n,amount:a,value:i,onChange:r}){let o=Ka(a),[l,d]=(0,ze.useState)(()=>typeof i=="number"?qa(i,a):""),c=l.trim()!==""&&cn(l,a)===void 0;return(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":"number","data-graview-amount":a.format??"unit",children:[(0,S.jsx)("span",{"data-graview-part":"label",children:t}),(0,S.jsxs)("span",{"data-graview-part":"amount",style:{display:"flex",alignItems:"center",gap:6},children:[o.prefix?(0,S.jsx)("span",{"data-graview-part":"amount-symbol","aria-hidden":"true",children:o.prefix}):null,(0,S.jsx)("input",{type:"text",inputMode:"decimal",name:e,required:!n,placeholder:o.placeholder,title:o.hint,"aria-invalid":c||void 0,value:l,onChange:p=>{d(p.target.value),r(cn(p.target.value,a))},"data-graview-part":"control",style:{flex:1,minWidth:0}}),o.suffix?(0,S.jsx)("span",{"data-graview-part":"amount-symbol","aria-hidden":"true",children:o.suffix}):null]}),c?(0,S.jsxs)("span",{"data-graview-part":"hint",role:"status",children:["Not an amount ",o.hint,": write it like ",o.prefix??"",o.placeholder,o.suffix?` ${o.suffix}`:""]}):null]})}function Zr({children:t}){return(0,S.jsxs)("span",{"data-graview-part":"picker",children:[t,(0,S.jsx)("span",{"aria-hidden":"true","data-graview-part":"chevron",children:"\u25BE"})]})}var Fi=t=>({label:we(t),option:e=>e}),Ii={phone:"+1 555 123 4567",place:"An address or a place's name",duration:"1h 30m, 90 or 1:30"};function Ht({store:t,spec:e,value:n,onChange:a,prefilled:i,open:r,words:o=Fi,values:l}){if(e.name in i&&e.control!=="group"&&e.control!=="variant")return null;let d=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(g=>we(He(t.schema.tryDefinition(g),g))).join(" or "):o(e.name).label,c=!(e.optional||e.control==="boolean"),p=c?(0,S.jsxs)(S.Fragment,{children:[d,(0,S.jsx)("span",{"aria-hidden":"true",children:" *"})]}):d;switch(e.control){case"text":case"date":return e.control==="text"&&e.long?(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":"text",children:[(0,S.jsxs)("span",{"data-graview-part":"label",children:[p,e.markdown?(0,S.jsx)("span",{style:{fontWeight:"normal",color:"var(--graview-ink-faint)"},children:" \xB7 Markdown"}):null]}),(0,S.jsx)("textarea",{name:e.name,required:!e.optional,rows:6,value:typeof n=="string"?n:"",onChange:g=>a(g.target.value),"data-graview-part":"control",style:{fieldSizing:"content",minHeight:"7.5em",resize:"vertical",font:"inherit",lineHeight:1.5}})]}):e.control==="date"?(0,S.jsxs)("div",{"data-graview-part":"field","data-graview-field":"date",children:[(0,S.jsx)("span",{"data-graview-part":"label",children:p}),(0,S.jsx)(er,{name:e.name,label:o(e.name).label,required:!e.optional,value:typeof n=="string"&&n!==""?n:void 0,time:e.time===!0,instant:e.instant===!0,onChange:a})]}):(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control==="text"&&e.holds?e.holds:e.control,children:[(0,S.jsx)("span",{"data-graview-part":"label",children:p}),(0,S.jsx)("input",{type:e.control==="text"&&e.holds==="phone"?"tel":"text",name:e.name,required:!e.optional,...e.control==="text"&&e.app?{placeholder:"@owner/app or https://\u2026"}:{},...e.control==="text"&&e.holds?{placeholder:Ii[e.holds]}:{},...e.control==="text"&&e.holds==="phone"?{autoComplete:"tel"}:{},value:typeof n=="string"?n:typeof n=="number"?String(n):"",onChange:g=>a(g.target.value),"data-graview-part":"control"})]});case"number":return e.amount?(0,S.jsx)(Oi,{title:p,name:e.name,optional:e.optional,amount:e.amount,value:n,onChange:a}):(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,S.jsx)("span",{"data-graview-part":"label",children:p}),(0,S.jsx)("input",{type:"number",name:e.name,required:!e.optional,...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max},...e.step===void 0?{}:{step:e.step},value:typeof n=="number"?n:"",onChange:g=>a(g.target.value===""?void 0:Number(g.target.value)),"data-graview-part":"control"})]});case"boolean":return(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":"boolean",children:[(0,S.jsx)("input",{type:"checkbox",name:e.name,checked:n===!0,onChange:g=>a(g.target.checked),"data-graview-part":"control"}),(0,S.jsx)("span",{"data-graview-part":"label",children:p})]});case"choice":return(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,S.jsx)("span",{"data-graview-part":"label",children:p}),(0,S.jsx)(Zr,{children:(0,S.jsxs)("select",{name:e.name,required:!e.optional,value:typeof n=="string"?n:"",onChange:g=>a(g.target.value||void 0),"data-graview-part":"control",children:[(0,S.jsx)("option",{value:"",children:"\u2014"}),(e.options??[]).map(g=>(0,S.jsx)("option",{value:g,children:o(e.name).option(g)},g))]})})]});case"node":{let g=r.find(v=>v.name===e.name)?.candidates,f=new Set(Object.values(i).filter(v=>typeof v=="string")),u=(e.kinds.includes("*")?[...t.graph.allNodes()]:e.kinds.flatMap(v=>t.graph.nodesOfKind(v))).filter(v=>!f.has(v.id)),k=g?g.map(v=>t.graph.getNode(v)).filter(v=>v!==void 0):u,q=Rt(k,v=>t.schema.tryDefinition(v));return(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,S.jsx)("span",{"data-graview-part":"label",children:p}),(0,S.jsx)(Zr,{children:(0,S.jsxs)("select",{name:e.name,required:!e.optional,value:typeof n=="string"?n:"",onChange:v=>a(v.target.value||void 0),"data-graview-part":"control",children:[(0,S.jsx)("option",{value:"",children:"\u2014"}),k.map(v=>{let C=q.get(v.id);return(0,S.jsxs)("option",{value:v.id,children:[ge(t.schema.tryDefinition(v.kind),v),C?` \xB7 ${C}`:""]},v.id)})]})})]})}case"group":{let g=n??{};return(0,S.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.control,children:[(0,S.jsx)("legend",{"data-graview-part":"label",children:p}),e.fields.map(f=>(0,S.jsx)(Ht,{store:t,spec:f,value:g[f.name],onChange:u=>a({...g,[f.name]:u}),prefilled:i,open:r,words:o},f.name))]})}case"variant":{let g=n??{},f=typeof g[e.tag]=="string"?g[e.tag]:"",u=e.options.find(k=>k.value===f);return(0,S.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.control,children:[(0,S.jsx)("legend",{"data-graview-part":"label",children:p}),(0,S.jsxs)("label",{"data-graview-part":"field","data-graview-field":"choice",children:[(0,S.jsx)("span",{"data-graview-part":"label",children:we(e.tag)}),(0,S.jsxs)("select",{value:f,onChange:k=>a({[e.tag]:k.target.value}),"data-graview-part":"control",children:[(0,S.jsx)("option",{value:"",children:"\u2014"}),e.options.map(k=>(0,S.jsx)("option",{value:k.value,children:we(k.value)},k.value))]})]}),u?.fields.map(k=>(0,S.jsx)(Ht,{store:t,spec:k,value:g[k.name],onChange:q=>a({...g,[k.name]:q}),prefilled:i,open:r,words:o},k.name))]})}case"file":case"list":{let g=e.control==="file"?e:e.item.control==="file"?e.item:void 0;if(g||e.control==="file")return(0,S.jsx)(Ve,{as:"control",title:c?`${d} *`:d,value:n,onChange:a,several:g!==e,image:g?.image===!0,label:d});let f=Array.isArray(n)?n:[];return(0,S.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":"list",children:[(0,S.jsx)("legend",{"data-graview-part":"label",children:p}),f.map((u,k)=>(0,S.jsxs)("div",{"data-graview-part":"item",children:[(0,S.jsx)("div",{style:{flex:1},children:(0,S.jsx)(Ht,{store:t,spec:{...e.item,optional:!1},value:u,onChange:q=>a(f.map((v,C)=>C===k?q:v)),prefilled:i,open:r,words:o})}),(0,S.jsx)("button",{type:"button","data-graview-part":"remove",onClick:()=>a(f.filter((q,v)=>v!==k)),children:"remove"})]},k)),(0,S.jsx)("button",{type:"button","data-graview-part":"add",onClick:()=>a([...f,void 0]),children:"add another"})]})}case"linked":return(0,S.jsx)("div",{"data-graview-part":"field","data-graview-field":"linked",children:(0,S.jsx)(Xa,{relation:e.relation,value:n,onChange:a,label:d})});case"repeat":return(0,S.jsx)(Ja,{value:n,onChange:a,start:e.of?l?.[e.of]:void 0,label:`${e.of?o(e.of).label:d} repeats`,name:e.name});case"opaque":return(0,S.jsxs)("p",{"data-graview-part":"unasked",children:["\u201C",we(e.name),"\u201D needs a structured answer this form cannot ask for yet."]})}}function $e({store:t,mutation:e,prefilled:n={},open:a=[],onDone:i,principal:r,initial:o,label:l,only:d}){let c=()=>rr(e,t.graph,n),[p,g]=(0,ze.useState)(c),[f,u]=(0,ze.useState)(()=>({...p,...o})),[k,q]=(0,ze.useState)(null),v=r??t.seenFor,C=e.subject&&n[e.subject.arg],G=v?or(t,v,e,typeof C=="string"?C:void 0):void 0,L=Lt(e.input).filter(D=>(d===void 0||d.includes(D.name))&&!G?.has(D.name)),U=D=>Ha(t.schema,e,D),X=Ga(L.filter(D=>D.control==="date").map(D=>D.name)),de=(0,ze.useRef)(void 0),ce=(D,J)=>u(b=>{let P={...b,[D.name]:J};if(X&&D.name===X.start&&D.control==="date"){let M=_=>typeof _=="string"&&_!==""?_:void 0,N=M(b[X.start])??de.current;if(M(J)){de.current=M(J);let _=Ba(N,M(J),M(b[X.end]),{time:D.time===!0,instant:D.instant===!0});_!==void 0&&(P[X.end]=_)}}return P});return(0,S.jsxs)("form",{"data-testid":`form-${e.name}`,onSubmit:D=>{D.preventDefault();try{t.apply({name:e.name,args:{...ir(ar(L,f),p),...n}},r?{author:r}:{}),q(null);let J=c();g(J),u({...J}),i?.()}catch(J){q(at(t.schema,t.allMutations(),J))}},"data-graview-part":"form",children:[(0,S.jsx)("style",{children:$i}),L.map(D=>(0,S.jsx)(Ht,{store:t,spec:D,value:f[D.name],values:f,onChange:J=>ce(D,J),prefilled:n,open:a,words:U},D.name)),k?(0,S.jsx)("p",{"data-testid":"refused","data-graview-part":"refused",role:"alert",children:k}):null,(0,S.jsx)("button",{type:"submit","data-graview-part":"submit",children:l??e.title??e.name})]})}var R=H(Y(),1);function Ae(t){let e=t.views;if(!e)return[];let n=new Set(Ke(t.store,t.principal));return e.places().filter(a=>n.has(a.kind))}function Kt(t,e){if(!e.over)return[e.kind];let n=new Set(Ke(t.store,t.principal));return e.over.filter(a=>a===e.kind||n.has(a))}var _e=t=>`place:${t.kind}:${t.as}`;function be(t,e){return Kr(e.as,ma(e,t.views?.places()??[])?Q(t.store.schema,e.kind):void 0)}function gt(t,e){let n=t.schema.tryDefinition(e);return t.graph.nodesOfKind(e).filter(a=>et(n,a))}function Cn(t,e,n){let a=(r,o)=>St(t.schema,o,r),i=(typeof e=="string"?[e]:e).map(r=>a(gt(t,r).length,r)).join(" and ");return n?`${i} across ${a(gt(t,n).length,n)}`:i}function Rn({context:t,place:e,chosen:n,filter:a}){let{store:i,views:r,invariantContext:o}=t,d=r?.resolve(e.kind,{cardinality:"many",fidelity:"full"},e.as)?.view,c=[...new Set(i.violations(o).flatMap(f=>f.nodeIds))],p=Kt(t,e).flatMap(f=>gt(i,f));if(!d)return null;let g=Di(i,p,a,c);return(0,R.jsx)(un,{kind:e.kind,view:e.title,children:(0,R.jsx)(d,{nodes:g,label:e.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...n&&n.length>0?{implicated:n}:{},...c.length>0?{flagged:c}:{}})})}function Di(t,e,n,a){let i=n?Pt({filter:n}).filter??[]:[];return i.length===0?e:Mt(e,{filter:i},{schema:t.schema,graph:t.graph,flagged:new Set(a)}).nodes}function Wi({store:t,views:e,as:n,invariantContext:a}){ae(t);let i={store:t,views:e,...a?{invariantContext:a}:{}},r=e.places().find(o=>o.as===n);return r?(0,R.jsx)(Rn,{context:i,place:r}):null}function Hi({context:t,kind:e}){let{store:n,views:a,invariantContext:i}=t,r=gt(n,e),o=n.schema.tryDefinition(e),l=ee(n,e),c=a?.resolve(e,{cardinality:"many",fidelity:"full"})?.view,p=[...new Set(n.violations(i).flatMap(k=>k.nodeIds))];if(c&&!nt(c))return(0,R.jsx)(un,{kind:e,children:(0,R.jsx)(c,{nodes:r,label:l,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...p.length>0?{flagged:p}:{}})});let g=a?.resolve(e,{cardinality:"one",fidelity:"summary"})?.view,f=8,u=r.slice(0,f);return(0,R.jsxs)("div",{"data-testid":"kind-sheet",style:g?{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gridAutoRows:"max-content",alignContent:"center",gap:12,padding:24}:{display:"flex",flexWrap:"wrap",alignContent:"center",justifyContent:"center",gap:10,padding:24},children:[u.map(k=>g?(0,R.jsx)(g,{node:k,fidelity:"summary",cardinality:"one",mode:"fullscreen",selected:!1,...p.includes(k.id)?{flagged:[k.id]}:{}},k.id):(0,R.jsx)("span",{style:{padding:"8px 14px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:ge(o,k)},k.id)),r.length>f?(0,R.jsxs)("span",{style:{...A,alignSelf:"center",padding:"0 6px"},children:["+",r.length-f," more ",l.toLowerCase()]}):null]})}function Ln(t){let{store:e}=t,n=Gr(t),a=Ae(t),i=ln([...a].sort((o,l)=>n.indexOf(o.kind)-n.indexOf(l.kind))).filter(o=>!o.hidden),r=new Set(i.flatMap(o=>o.over??[o.kind]));return[...i.map(o=>({key:_e(o),kind:o.kind,title:fa(o,a,e.schema),to:be(t,o),place:o})),...Dt(t).filter(o=>!r.has(o)).map(o=>({key:`kind:${o}`,kind:o,title:ee(e,o),to:`/${Q(e.schema,o)}`}))]}var ei=.72,Ki=540,ti=16/10;function qi(t){let e=(0,De.useRef)(null),[n,a]=(0,De.useState)(t);return(0,De.useLayoutEffect)(()=>{let i=e.current;if(!i||typeof ResizeObserver>"u")return;let r=()=>{let l=i.getBoundingClientRect().width;l>0&&a(d=>Math.abs(d-l)<.5?d:l)};r();let o=new ResizeObserver(r);return o.observe(i),()=>o.disconnect()},[]),{ref:e,width:n}}function Bi(t){for(let e=t.parentElement;e;e=e.parentElement)if(/(auto|scroll)/.test(getComputedStyle(e).overflowY))return e;return null}function Gi(t){let[e,n]=(0,De.useState)(()=>typeof IntersectionObserver>"u");return(0,De.useLayoutEffect)(()=>{let a=t.current;if(e||!a)return;let i=new IntersectionObserver(r=>{r.some(o=>o.isIntersecting)&&(i.disconnect(),n(!0))},{root:Bi(a),rootMargin:"50% 0px"});return i.observe(a),()=>i.disconnect()},[e,t]),e}function Tn({context:t,entry:e}){let{store:n,brand:a,principal:i}=t,{ref:r,width:o}=qi(Ki),l=Gi(r),d=o/ei,c=gt(n,e.kind),p=n.schema.tryDefinition(e.kind),g=c.length===0?Ue(n,e.kind,{...i?{principal:i}:{},...t.invariantContext?{context:t.invariantContext}:{}}).actions.affordances[0]:void 0,f=e.place!==void 0;return(0,R.jsxs)(I,{to:e.to,"data-testid":f?"place-card":"kind-card",className:"graview-gallery-card",style:{...ve,display:"grid",gap:10,alignContent:"start",minWidth:0},children:[(0,R.jsxs)("span",{ref:r,"data-testid":f?"place-picture":"kind-picture","aria-hidden":"true",inert:!0,style:{display:"block",position:"relative",width:"100%",aspectRatio:`${ti}`,overflow:"hidden",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",pointerEvents:"none"},children:[(0,R.jsx)("span",{style:{position:"absolute",left:0,top:0,width:d,height:d/ti,display:"grid",gridTemplateRows:"minmax(0, 1fr)",transform:`scale(${ei})`,transformOrigin:"0 0"},children:l?(0,R.jsx)(Et.Provider,{value:null,children:e.place?(0,R.jsx)(Rn,{context:t,place:e.place}):(0,R.jsx)(Hi,{context:t,kind:e.kind})}):null}),c.length===0?(0,R.jsx)("span",{"data-testid":"picture-empty",style:{position:"absolute",inset:0,display:"grid",placeContent:"center",justifyItems:"center",gap:2,padding:20,textAlign:"center"},children:(0,R.jsxs)("span",{style:{display:"grid",gap:2,padding:"10px 16px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:[(0,R.jsxs)("span",{style:{fontFamily:kn,fontWeight:"var(--graview-weight-display)"},children:["No ",ee(n,e.kind).toLowerCase()," yet"]}),g?(0,R.jsxs)("span",{style:A,children:["Begin with \u201C",g.label,"\u201D"]}):null]})}):null]}),(0,R.jsxs)("span",{style:{display:"grid",gap:2,minWidth:0},children:[(0,R.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[f?null:(0,R.jsx)(me,{kind:e.kind,brand:a,schema:n.schema,size:8}),(0,R.jsx)("span",{style:{fontFamily:kn,fontSize:"var(--graview-text-heading)",fontWeight:"var(--graview-weight-display)",lineHeight:1.3,overflowWrap:"anywhere",textWrap:"balance"},children:e.title})]}),(0,R.jsxs)("span",{style:A,children:[e.place?Cn(n,Kt(t,e.place),e.place.across):Cn(n,e.kind),!f&&p?.description?` \xB7 ${p.description}`:null]})]})]})}var ni={display:"grid",gap:"32px 28px",gridTemplateColumns:"repeat(auto-fill, minmax(min(420px, 100%), 1fr))"},Vi=`
105
- .graview-gallery-card > span:first-child { transition: border-color 160ms ease, box-shadow 160ms ease; }
106
- .graview-gallery-card:hover > span:first-child,
107
- .graview-gallery-card:focus-visible > span:first-child { border-color: var(--graview-edge-bright); box-shadow: 0 1px 0 var(--graview-edge), 0 10px 30px -18px var(--graview-ink); }
108
- `;function Mn({context:t}){ae(t.store);let e=Ln(t);return e.length===0?null:(0,R.jsxs)("section",{style:ni,"data-testid":"gallery",children:[(0,R.jsx)("style",{children:Vi}),e.map(n=>(0,R.jsx)(Tn,{context:t,entry:n},n.key))]})}function Nn({context:t}){let{store:e}=t;ae(e);let n=ln(Ae(t)).filter(i=>!i.hidden),a=Ln(t);return(0,R.jsxs)(ie,{context:t,style:rt,children:[(0,R.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,R.jsx)("p",{style:he,children:n.length===0?"None of its own yet":`${n.length} ${n.length===1?"picture":"pictures"}`}),(0,R.jsx)(le,{context:t,children:"Pictures"}),(0,R.jsx)("p",{style:se,children:n.length===0?"Nothing here has a picture of its own yet, so each kind is drawn as the scene draws it. Title a group view and it appears here by name.":"The ways this installation looks at what it holds \u2014 each one the same picture the scene shows, here as a page."})]}),a.length>0?(0,R.jsx)("div",{style:ni,"data-testid":"places",children:a.map(i=>(0,R.jsx)(Tn,{context:t,entry:i},i.key))}):null]})}function En({context:t}){let{store:e,principal:n}=t;ae(e);let a=qe(),i=Ie(),[r]=it(),o=decodeURIComponent(a.as??""),[l,d]=(0,De.useState)(null),c=r.get("of"),p=r.get("filter"),f=Ae(t).find(L=>L.as===o&&(!c||Q(e.schema,L.kind)===c));if(!f)return(0,R.jsxs)(ie,{context:t,children:[(0,R.jsx)(le,{context:t,children:"No picture is called that."}),(0,R.jsx)("p",{style:se,children:(0,R.jsxs)(I,{to:"/places",style:B,children:["The pictures there are ",(0,R.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]})})]});let u=ee(e,f.kind),k=t.views?.resolve(f.kind,{cardinality:"many",fidelity:"full"},f.as)?.view,q=k?.flows===!0,v=k?.creates!==!1,C=Ue(e,f.kind,{...n?{principal:n}:{},...t.invariantContext?{context:t.invariantContext}:{}}),G=v?C.actions.affordances.map(L=>({affordance:L,mutation:e.allMutations().find(U=>U.name===L.mutation)})).filter(L=>L.mutation!==void 0):[];return(0,R.jsxs)(ie,{context:t,style:rt,children:[(0,R.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,R.jsx)(le,{context:t,children:f.title}),(0,R.jsxs)("p",{style:se,"data-testid":"place-lede",children:[Cn(e,Kt(t,f),f.across),"."]}),p&&!q?(0,R.jsxs)("p",{style:{...A,margin:0},"data-testid":"place-narrowed",children:[`Only those where ${p.split(",").map(L=>L.replace(":"," is ")).join(" and ")}. `,(0,R.jsx)(I,{to:`?${(()=>{let L=new URLSearchParams(r);return L.delete("filter"),L.toString()})()}`,style:{...B,...A},children:"Show all"})]}):null,(0,R.jsx)("p",{style:{...A,margin:0,display:"flex",flexWrap:"wrap",gap:"4px 16px"},children:Kt(t,f).map((L,U)=>(0,R.jsxs)(I,{to:`/${Q(e.schema,L)}`,style:{...B,...A},...U===0?{"data-testid":"place-as-list"}:{},children:["All ",(L===f.kind?u:ee(e,L)).toLowerCase()," as a list ",(0,R.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]},L))})]}),(0,R.jsx)("div",{"data-testid":"place-lens","data-flows":q?"":void 0,style:q?{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",maxWidth:"100%"}:{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",maxWidth:"100%",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)"},onClick:L=>{let U=L.target?.closest("[data-graview-pick]"),X=U?.getAttribute("data-graview-pick"),de=U?.getAttribute("data-graview-joins");if(de)try{let D=JSON.parse(de);if(Array.isArray(D)&&D.every(J=>typeof J=="string")){L.preventDefault(),d({at:_e(f),ids:D});return}}catch{}if(!X)return;let ce=e.graph.getNode(X);ce&&(L.preventDefault(),i(te(e.schema,ce.kind,X)))},children:(0,R.jsx)(Rn,{context:t,place:f,filter:p,...l?.at===_e(f)?{chosen:l.ids}:{}})}),G.length>0?(0,R.jsx)("div",{style:{maxWidth:760,display:"grid",gap:40},"data-testid":"place-creators",children:G.map(({affordance:L,mutation:U})=>(0,R.jsxs)("section",{style:{...re,display:"grid",gap:14},children:[(0,R.jsx)("h2",{style:ne,children:U.title??U.name}),U.description?(0,R.jsx)("p",{style:{...A,margin:0,maxWidth:"58ch"},children:U.description}):null,(0,R.jsx)($e,{store:e,mutation:U,prefilled:L.args,open:L.open,label:L.label,...n?{principal:n}:{}})]},L.id))}):null]})}function ot(t){return t.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-|-$/g,"")}function mt(t,e={}){let[n="/",a=""]=t.split("#")[0].split("?"),i=new URLSearchParams(a);e.filter&&i.set("filter",e.filter);let r=i.toString(),o=e.section?ot(e.section):"";return`${n}${r?`?${r}`:""}${o?`#${o}`:""}`}function Ui(t,e=document){let n=ot(t);if(!n)return null;let a=[e,...[...e.querySelectorAll("[data-worker-view]")].flatMap(i=>i.shadowRoot?[i.shadowRoot]:[])];for(let i of a)for(let r of i.querySelectorAll("[id], [data-section]")){let o=r.getAttribute("data-section")??r.id;if(o===t||ot(o)===n)return r}for(let i of a)for(let r of i.querySelectorAll("h1, h2, h3, h4, h5, h6, [role=heading]"))if(ot(r.textContent??"")===n)return r;return null}function ai(t,e={}){if(typeof document>"u"||typeof requestAnimationFrame>"u")return()=>{};let n=e.frames??120,a=0,i=()=>{let r=Ui(t,e.root??document);if(r){r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),r.scrollIntoView?.({block:"start"}),r.focus({preventScroll:!0});return}n-=1,n>0&&(a=requestAnimationFrame(i))};return a=requestAnimationFrame(()=>{a=requestAnimationFrame(i)}),()=>cancelAnimationFrame(a)}var z=H(Ee(),1);var qt=H(Ee(),1);var Ye=H(Y(),1);function ri({context:t}){return ye()?(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(ji,{context:t}),(0,Ye.jsx)($r,{face:"pages",on:t.quickAsk??!0})]}):null}function ji({context:t}){let{store:e}=t,n=ye(),{pathname:a}=ke(),i=(0,qt.useRef)(n?.setSelection);return i.current=n?.setSelection,(0,qt.useEffect)(()=>{let r=i.current;if(!r)return;let[,o,l]=a.split("/"),d=(()=>{if(o==="places"){let p=t.views?.places().find(g=>g.as===decodeURIComponent(l??""));return p?[Ne(p.kind)]:[]}let c=o?Re(e.schema,o):void 0;return c&&l?[decodeURIComponent(l)]:c?[va(c)]:[]})();r(c=>c.length===d.length&&c.every((p,g)=>p===d[g])?c:d)},[a]),null}var fe=H(Ee(),1);var oi=H(Ei(),1);var ue=H(Y(),1);var zi=(0,fe.lazy)(wa(()=>(__graviewPreload(import.meta.url,["./chunk.63GXY2ME.js","./chunk.UGFDSE37.js","./chunk.67TPUXAY.js","./chunk.Y6ZNFQK3.js","./chunk.NRAYZY3X.js","./chunk.RIJUCHP4.js","./chunk.TAQ764IQ.js","./chunk.YIR7PPF3.js","./chunk.3HXN4BOY.js","./chunk.GYICGZMG.js","./chunk.UHUGOTUU.js","./chunk.47STJVRV.js","./chunk.EBGAYL32.js","./chunk.DAZ2VSRD.js","./chunk.J25KOSNW.js","./chunk.LR3VDXPI.js","./chunk.CWHRDBOF.js","./chunk.3K6YSVHC.js","./chunk.SHTJZ6UX.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.ULRW47RP.js","./chunk.PBSMLINK.js","./chunk.3TY5NFLY.js","./chunk.D75KC3LL.js","./chunk.FWTIUYXH.js","./chunk.MAF7C3VM.js","./chunk.GZHZLJBF.js","./chunk.XMC7YDWT.js","./chunk.6UGEYZAC.js","./chunk.OJGHDWI6.js","./chunk.B2GLDIAS.js","./chunk.6YCBYL2Y.js","./chunk.UGFJKSHU.js","./chunk.JOOQUWLT.js","./chunk.6QWV5MVH.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.XBJYQNVE.js")).then(t=>({default:t.TakeBack}))));function _i({context:t,docked:e,at:n}){let{store:a}=t,i=ae(a),[r]=(0,fe.useState)(()=>a.batches().length),o=(0,fe.useRef)(!1);return o.current||=i>0||!e&&r>0,o.current?(0,ue.jsx)(fe.Suspense,{fallback:null,children:(0,ue.jsx)(zi,{context:t,docked:e,at:n,since:r})}):null}function Yi(t,e,n){let{store:a,principal:i,embedded:r}=t;(0,fe.useEffect)(()=>{if(!n)return;let o=l=>{if(!Hr(l))return;let d=l.target,c=d instanceof Node&&e.current?.contains(d),p=d===document.body||d===document.documentElement||d===document;if(!(!c&&!(p&&!r))&&Dr(a,i)){l.preventDefault();try{Wr(a,i)}catch{}}};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[a,i,r,e,n])}function si({context:t,registry:e,root:n,children:a}){let i=(0,fe.useMemo)(Yr,[]),r=e?.without()??new Set;return Yi(t,n,!r.has("undo")),(0,ue.jsxs)(xn.Provider,{value:i,children:[(0,ue.jsx)(Qi,{context:t,placed:i,without:r}),a]})}function Qi({context:t,placed:e,without:n}){let[a,i]=(0,fe.useState)(!1);(0,fe.useLayoutEffect)(()=>i(!0),[]);let r=Pn(e,"find"),o=Pn(e,"undo"),l=ke(),d=pr();if(!a)return null;let c=l.pathname.split("/").filter(Boolean),g=(c.length===1?Re(t.store.schema,c[0]):void 0)!==void 0;return(0,ue.jsxs)(ue.Fragment,{children:[!r&&!n.has("find")&&d?(0,oi.createPortal)((0,ue.jsx)(ii,{context:t,narrowsLists:g}),d.slot):null,!r&&!n.has("find")&&!d?(0,ue.jsx)("div",{"data-testid":"face-find-bar",style:{display:"flex",alignItems:"center",padding:"8px 16px",borderBottom:"1px solid var(--graview-edge)",background:"var(--graview-bar)",minWidth:0},children:(0,ue.jsx)(ii,{context:t,narrowsLists:g})}):null,!o&&!n.has("undo")?(0,ue.jsx)(_i,{context:t,docked:!0,at:l.pathname+l.search}):null,d?.own&&!n.has("undo")?(0,ue.jsx)(Vr,{context:t,own:d.own}):null]})}function ii({context:t,narrowsLists:e}){return(0,ue.jsx)(xn.Provider,{value:null,children:(0,ue.jsx)(An,{context:t,narrowsLists:e})})}var oe=H(Ee(),1);var Se=H(Y(),1),Xi=500,Ji=10;function $n(t){return t instanceof HTMLElement?t.isContentEditable||t.tagName==="TEXTAREA"||t.tagName==="SELECT"?!0:t.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(t.type):!1}function Zi(t){let e=typeof getSelection=="function"?getSelection():null;return e!==null&&!e.isCollapsed&&e.containsNode(t,!0)}function eo(t){let e=t.closest('a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])');if(e)return e;let n=document.activeElement;return n instanceof HTMLElement&&n!==document.body?n:null}function li({context:t,root:e,children:n}){return ye()===null?(0,Se.jsx)(Se.Fragment,{children:n}):(0,Se.jsx)(to,{context:t,root:e,children:n})}function to({context:t,root:e,children:n}){let{setMenuAt:a}=Aa(),{store:i}=t,r=i.schema,o=Ie(),{pathname:l,search:d}=ke(),c=Ur("/").replace(/\/$/,""),p=(0,oe.useCallback)((b,P)=>t.views?.places().find(M=>M.as===b&&(P===null||M.kind===P)),[t.views]),g=(0,oe.useCallback)((b,P)=>{let[M="",N,_]=b.split("/").filter(Boolean).map(j=>{try{return decodeURIComponent(j)}catch{return j}});if(_!==void 0)return null;if(M==="places"&&N!==void 0){let j=p(N,new URLSearchParams(P).get("of"));return j?{face:"pages",place:j.as,about:[Ne(j.kind)],title:j.title}:null}let E=Re(r,M);return E?N===void 0?{face:"pages",about:[Ne(E)],title:tt(r,E)}:i.graph.getNode(N)?{face:"pages",on:N,about:[N]}:null:null},[r,i,p]),f=(0,oe.useCallback)(b=>{let P=b.href;try{let M=new URL(P,location.href);if(M.origin===location.origin&&(c===""||M.pathname===c||M.pathname.startsWith(`${c}/`))){let N=g(M.pathname.slice(c.length),M.search);if(N)return{...N,href:P}}}catch{}return{face:"pages",about:[],href:P}},[c,g]),u=(0,oe.useCallback)(()=>g(l,d)??{face:"pages",about:[]},[g,l,d]),k=(0,oe.useCallback)(b=>{let P=u(),M=b.closest("[data-graview-field]")?.getAttribute("data-graview-field");if(M&&P.on!==void 0&&b.closest("[data-graview-pick], a[href]")===null)return{...P,field:M};let N=b.closest("[data-graview-act]")?.getAttribute("data-graview-act");if(N)return{...P,act:N};let _=b.closest("[data-graview-pick]")?.getAttribute("data-graview-pick");if(_&&i.graph.getNode(_))return{face:"pages",on:_,about:[_],href:`${c}${te(r,i.graph.getNode(_).kind,_)}`};let E=b.closest("a[href]");if(E)return f(E);let j=b.closest("[data-graview-record]")?.getAttribute("data-graview-record");return j&&i.graph.getNode(j)?{face:"pages",on:j,about:[j]}:P},[u,f,i,r,c]),q=(0,oe.useCallback)((b,P,M)=>{let N=k(b);a({...N,x:Math.round(P),y:Math.round(M),returnTo:eo(b)})},[k,a]),v=(0,oe.useCallback)(b=>{let P=b.getBoundingClientRect();q(b,P.left+Math.min(16,P.width/2),Math.min(P.bottom,P.top+36))},[q]),C=(0,oe.useRef)(0),G=(0,oe.useRef)(null),L=(0,oe.useRef)(!1),U=()=>{G.current&&clearTimeout(G.current.timer),G.current=null};(0,oe.useEffect)(()=>U,[]),(0,oe.useEffect)(()=>{let b=P=>{if(P.defaultPrevented||!(P.key==="ContextMenu"||P.key==="F10"&&P.shiftKey))return;let M=e.current,N=P.target instanceof Element?P.target:null,_=N===null||N===document.body||N===document.documentElement,E=M!==null&&N!==null&&M.contains(N);if(!E&&!(_&&document.querySelector("[data-graview-face='pages']")===M)||$n(N)||N?.closest("[data-graview-popover]"))return;P.preventDefault(),C.current=Date.now();let j=E&&N instanceof HTMLElement?N:M?.querySelector("[data-graview-page-title], main h1, main")??null;j&&v(j)};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,v]);let X=(0,oe.useMemo)(()=>b=>{if(b.face!=="pages")return null;let P=[],M=b.on===void 0?void 0:i.graph.getNode(b.on),N=b.place===void 0?void 0:t.views?.places().find(T=>T.as===b.place),_=M?void 0:b.about.length===1&&b.about[0].startsWith("aggregate:")&&!N?no(b.about[0]):void 0,E=M?te(r,M.kind,M.id):N?be(t,N):_?`/${Q(r,_)}`:void 0,j=E!==void 0&&l===E.split("?")[0];E!==void 0&&!j&&P.push({id:"open",label:"Open",run:()=>o(E)});let Oe=E!==void 0?`${c}${E}`:b.href;Oe!==void 0&&P.push({id:"open-in-a-new-tab",label:"Open in a new tab",run:()=>void window.open(Oe,"_blank","noopener")});let m=M?`#focus=${encodeURIComponent(M.id)}`:N?`#focus=${encodeURIComponent(Ne(N.kind))}&view=${encodeURIComponent(N.as)}`:_?`#focus=${encodeURIComponent(Ne(_))}`:void 0;if(m!==void 0&&(t.overview||!t.embedded)){let T=t.overview;P.push({id:"in-the-scene",label:"Show in the scene",run:()=>T?T(m):location.assign(`${t.sceneHref??"/"}${m}`)})}return M===void 0&&b.href===void 0&&P.push({id:"find",label:"Find\u2026",run:()=>{let T=e.current?.querySelector('[data-testid="nav-find"]')??document.querySelector('[data-testid="nav-find"]');T&&T.offsetParent!==null?T.focus():o("/search")}}),P.length>0?{id:"pages",items:P}:null},[i,r,t,l,c,o,e]),de=(0,oe.useMemo)(()=>b=>{if(b.face!=="pages"||b.field===void 0||b.on===void 0)return null;let P=i.graph.getNode(b.on),M=b.element?.closest("[data-graview-field]")??e.current?.querySelector(`[data-graview-field="${CSS.escape(b.field)}"]`);return!P||!(M instanceof HTMLElement)||!M.hasAttribute("data-graview-editable")?null:{id:"field",at:"start",items:[{id:"change-field",label:`Change \u201C${ra(r.tryDefinition(P.kind),b.field)}\u201D`,run:()=>M.click()}]}},[i,r,e]),ce=Fr(),D=tr(),J=(0,oe.useMemo)(()=>[de,X,...D?[D]:[],...ce?[ce]:[]],[de,X,D,ce]);return(0,Se.jsxs)(Ya,{sections:J,children:[(0,Se.jsx)("div",{"data-graview-menu-ground":"",style:{display:"contents"},onContextMenu:b=>{let P=b.target;b.shiftKey||$n(P)||Zi(P)||(b.preventDefault(),!P.closest("[data-graview-popover]")&&(Date.now()-C.current<700||(b.clientX===0&&b.clientY===0&&P instanceof HTMLElement?v(P):q(P,b.clientX,b.clientY))))},onPointerDown:b=>{if(L.current=!1,b.pointerType==="mouse"||!b.isPrimary)return;let P=b.target;if($n(P)||P.closest("[data-graview-choose], [data-graview-popover]"))return;U();let{clientX:M,clientY:N}=b;G.current={x:M,y:N,timer:setTimeout(()=>{G.current=null,L.current=!0,C.current=Date.now(),q(P,M,N)},Xi)}},onPointerMove:b=>{let P=G.current;P&&Math.hypot(b.clientX-P.x,b.clientY-P.y)>Ji&&U()},onPointerUp:U,onPointerCancel:U,onClickCapture:b=>{L.current&&(L.current=!1,b.preventDefault(),b.stopPropagation())},children:n}),(0,Se.jsx)(ao,{openAt:v}),(0,Se.jsx)(Ir,{placement:"page"}),(0,Se.jsx)(nr,{})]})}function no(t){let e=t.slice(10).split("+");return e.length===1&&e[0]?e[0]:void 0}function ao({openAt:t}){return(0,Se.jsx)("span",{"data-graview-menu-home":"",tabIndex:-1,onFocus:e=>{if(e.target!==e.currentTarget)return;let n=e.currentTarget.closest("[data-graview-face]"),a=n?.querySelector("[data-graview-page-title]")??n?.querySelector("main h1, main")??null;a&&(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus({preventScroll:!0}))},style:{position:"absolute",width:0,height:0,overflow:"hidden"},children:(0,Se.jsx)(Er,{placement:"menu",openActs:t})})}var K=H(Y(),1);function di(t,e){return e==="*"?{label:"anything",path:null}:{label:ee(t,e),path:`/${Q(t.schema,e)}`}}function ro({context:t,relation:e}){let{store:n}=t,a=di(n,e.from),i=di(n,e.to),r=o=>o.path?(0,K.jsx)(I,{to:o.path,style:{...ve,fontWeight:550},children:o.label}):(0,K.jsx)("span",{children:o.label});return(0,K.jsxs)("li",{"data-testid":"relation","data-relation":e.edgeKind,style:{display:"grid",gridTemplateColumns:"30px minmax(0, 1fr) auto",gap:12,alignItems:"baseline"},children:[(0,K.jsx)(Or,{edgeKind:e.edgeKind,...t.brand?.kit?{kit:t.brand.kit}:{}}),(0,K.jsxs)("span",{style:{display:"grid",gap:1},children:[(0,K.jsxs)("span",{children:[r(a)," ",(0,K.jsxs)("span",{style:A,"data-graview-speaks-ids":"",children:[we(e.edgeKind)," \u2192"]})," ",r(i)]}),e.description||e.inverse?(0,K.jsxs)("span",{style:A,children:[e.description?xe(e.description):null,e.description&&e.inverse?" \xB7 ":null,e.inverse?`from the other end, ${e.inverse}`:null]}):null]}),i.path?(0,K.jsx)(I,{to:`${i.path}?with=${encodeURIComponent(e.edgeKind)}`,style:{...B,...A,fontVariantNumeric:"tabular-nums",display:"inline-block",minWidth:24,minHeight:24,textAlign:"center"},title:`The ${i.label.toLowerCase()} that have this`,children:e.count}):(0,K.jsx)("span",{style:{...A,fontVariantNumeric:"tabular-nums"},children:e.count})]})}function ci({context:t,heading:e=!0}){let{store:n}=t,a=new Set(Ke(n,t.principal)),i=je(n).relations.filter(r=>a.has(r.from)&&(r.to==="*"||a.has(r.to)));return i.length===0?null:(0,K.jsxs)("section",{style:{...re,display:"grid",gap:12},"data-testid":"kind-map",children:[e?(0,K.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,K.jsx)("h2",{style:ne,children:(0,K.jsx)(I,{to:"/map",style:ve,children:"Connections"})}),(0,K.jsx)("span",{style:A,children:i.length===1?"1 relation":`${i.length} relations`})]}):null,(0,K.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:i.map(r=>(0,K.jsx)(ro,{context:t,relation:r},`${r.edgeKind}|${r.from}|${r.to}`))})]})}function On({context:t}){let{store:e}=t;ae(e);let n=new Set(Ke(e,t.principal)),a=je(e),i=a.relations.filter(r=>n.has(r.from));return(0,K.jsxs)(ie,{context:t,children:[(0,K.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,K.jsx)("p",{style:he,children:i.length===0?"No relations":`${i.length} ${i.length===1?"relation":"relations"}`}),(0,K.jsx)(le,{context:t,children:"Connections"}),(0,K.jsx)("p",{style:se,children:i.length===0?"Nothing here is declared to relate to anything else yet.":"The kinds this installation holds, and the relations declared between them \u2014 each in the declaration's own words, with how many of it there are."})]}),(0,K.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},"data-testid":"map-kinds",children:a.kinds.filter(r=>n.has(r.kind)).map(r=>(0,K.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,K.jsx)(me,{kind:r.kind,brand:t.brand,schema:e.schema,size:7}),(0,K.jsx)(I,{to:`/${Q(e.schema,r.kind)}`,style:B,children:r.plural}),(0,K.jsx)("span",{style:A,children:r.count})]},r.kind))}),(0,K.jsx)(ci,{context:t,heading:!1})]})}function pi({context:t}){let n=[...ye()?.robots.values()??[]].filter(i=>i.mode==="asking"&&i.say);if(n.length===0)return null;let{store:a}=t;return(0,K.jsxs)("section",{style:{...re,display:"grid",gap:10},"data-testid":"seat-questions",children:[(0,K.jsx)("h2",{style:ne,children:n.length===1?"The seat asked something":`The seat asked ${n.length} things`}),(0,K.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8},children:n.map(i=>{let r=i.at?a.graph.getNode(i.at):void 0;return(0,K.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,K.jsx)("span",{children:i.say}),r?(0,K.jsxs)(I,{to:te(a.schema,r.kind,r.id),style:{...B,...A},children:[ge(a.schema.tryDefinition(r.kind),r)," \u2192"]}):null]},i.participant)})})]})}var V=H(Y(),1);function Fn({context:t}){let{principal:e}=t,{store:n,brand:a,invariantContext:i}=t;ae(n);let r=n.violations(i),o=`${r.length===1?"A rule is broken":"Rules are broken"} \u2014 see what, and what would fix it`,l=[...n.log.all()].slice(-5).reverse(),c=Dt(t).map(C=>({kind:C,members:n.graph.nodesOfKind(C).filter(G=>et(n.schema.tryDefinition(C),G))})),p=c.filter(C=>C.members.length>0),g=c.map(C=>({entry:C,creator:n.allMutations().find(G=>(G.creates??[]).includes(C.kind)&&n.permits({name:G.name,args:{}},t.principal).ok)})).find(C=>C.creator!==void 0),f=p.length===0?"Nothing here yet.":`${p.map(C=>St(n.schema,C.kind,C.members.length)).join(", ").replace(/, ([^,]*)$/," and $1")}.`,u=t.views?.homeView?.(),k=n.schema.kinds.some(C=>n.graph.nodesOfKind(C).length>0);if(u&&k){let C=a?.subtitle?(0,V.jsx)("p",{style:{...A,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,G=u[Symbol.for("graview.home-blocks")]===!0;return(0,V.jsx)(ie,{context:t,style:rt,children:(0,V.jsxs)("div",{style:{display:"grid",gap:12},"data-testid":"home-view",children:[G?null:C,r.length>0?(0,V.jsx)(I,{to:"/problems",style:{...B,color:"var(--graview-warn)"},children:o}):null,(0,V.jsx)(Tr.Provider,{value:G?C:null,children:(0,V.jsx)(u,{cardinality:"many",fidelity:"full",mode:"fullscreen",selected:!1})})]})})}let q=new Set(Ke(n,t.principal)),v=je(n).relations.filter(C=>q.has(C.from)&&(C.to==="*"||q.has(C.to)));return(0,V.jsxs)(ie,{context:t,style:rt,children:[(0,V.jsxs)("header",{style:{display:"grid",gap:12},children:[a?.subtitle?(0,V.jsx)("p",{style:{...A,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,(0,V.jsx)(le,{context:t,"data-testid":"standing",children:f}),(0,V.jsxs)("p",{style:{...se,display:"grid",gap:4},"data-testid":"standing-card",children:[p.length===0&&g?(0,V.jsxs)("span",{children:["Begin with \u201C",g.creator?.title??g.creator?.name,"\u201D, under"," ",(0,V.jsx)(I,{to:`/${Q(n.schema,g.entry.kind)}`,style:B,children:ee(n,g.entry.kind)}),"."]}):null,r.length===0?(0,V.jsx)("span",{children:"All rules hold."}):(0,V.jsx)(I,{to:"/problems",style:{...B,color:"var(--graview-warn)"},children:o})]})]}),(0,V.jsx)(Mn,{context:t}),(0,V.jsxs)("section",{style:{...re,display:"grid",gap:14},"data-testid":"kinds",children:[(0,V.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,V.jsx)("h2",{style:ne,children:"What is here"}),v.length>0?(0,V.jsxs)(I,{to:"/map",style:{...B,...A,marginLeft:"auto"},"data-testid":"map-link",children:["Connections \xB7 ",v.length===1?"1 relation":`${v.length} relations`," ",(0,V.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]}):null]}),(0,V.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"8px 10px"},children:c.map(({kind:C,members:G})=>(0,V.jsx)("li",{style:{maxWidth:"100%"},children:(0,V.jsxs)(I,{to:`/${Q(n.schema,C)}`,style:{...ve,flexWrap:"wrap",gap:8,padding:"6px 14px 6px 10px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)"},children:[(0,V.jsx)(me,{kind:C,brand:a,schema:n.schema,size:7}),(0,V.jsx)("span",{style:{fontWeight:550,overflowWrap:"anywhere"},children:ee(n,C)}),(0,V.jsx)("span",{style:{...A,fontVariantNumeric:"tabular-nums"},children:G.length===0?"none yet":ct(G.length)})]})},C))})]}),l.length>0?(0,V.jsxs)("section",{style:{...re,display:"grid",gap:10},children:[(0,V.jsx)("h2",{style:ne,children:"Recently"}),(0,V.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:l.map(C=>(0,V.jsxs)("li",{style:A,children:[(0,V.jsx)("span",{style:{color:"var(--graview-ink)"},children:C.intent})," \u2014 ",ut(C,e,{graph:n.graph,schema:n.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}})]},C.id))})]}):null]})}var Te=H(Ee(),1);var $=H(Y(),1);function In({context:t}){let{store:e,brand:n,principal:a,invariantContext:i}=t;ae(e);let[r]=it(),o=r.get("q")??"",l=typeof i?.today=="string"?i.today:void 0,d=wr(e,o,{...a?{principal:a}:{},places:Ae(t),flagged:new Set(e.violations(i).flatMap(u=>u.nodeIds)),...l?{today:l}:{},limit:200}),c=d.hits.filter(u=>u.about==="node"),p=d.hits.filter(u=>u.about==="kind"||u.about==="place"||u.about==="rule"),g=[...new Set(c.map(u=>u.kind))],f=o.trim();return(0,$.jsxs)(ie,{context:t,children:[(0,$.jsx)("style",{children:Ft}),(0,$.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,$.jsx)("p",{style:he,children:"Search"}),(0,$.jsx)(le,{context:t,"data-testid":"search-heading",children:f.length===0?"Find anything by its name":d.hits.length===0?(0,$.jsxs)($.Fragment,{children:["Nothing here is called \u201C",f,"\u201D."]}):(0,$.jsxs)($.Fragment,{children:[io(e,d.byKind)," for \u201C",f,"\u201D"]})}),f.length>0?(0,$.jsxs)("p",{style:{...A,margin:0},"data-testid":"search-searched",children:[Tt(e.schema,d.searched),d.conditions.filter(u=>u.key!=="is"&&u.admittedBy.length<d.searched.kinds.length).map(u=>(0,$.jsxs)("span",{children:[" ",u.key,":",u.value," narrows"," ",u.admittedBy.length===0?"nothing here":u.admittedBy.map(k=>ee(e,k).toLowerCase()).join(" and "),"."]},`${u.key}:${u.value}`))]}):(0,$.jsxs)("p",{style:se,children:["Type in the box above. Words find the start of words in names and in what each record says;"," ",(0,$.jsx)("code",{children:"done:false"})," and the like narrow as a list does, and ",(0,$.jsx)("code",{children:"is:any"})," includes what is past."]})]}),p.length>0?(0,$.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},"data-testid":"search-named",children:p.map(u=>(0,$.jsx)("li",{"data-testid":"search-hit","data-about":u.about,children:u.about==="kind"?(0,$.jsxs)(I,{to:`/${Q(e.schema,u.kind)}`,style:B,children:[u.label,u.count>0?(0,$.jsxs)("span",{style:A,children:[" \xB7 ",u.count," match"]}):null]}):u.about==="place"?(0,$.jsxs)(I,{to:be(t,u),style:B,children:["Go to ",u.title]}):u.about==="rule"?(0,$.jsxs)(I,{to:"/problems",style:B,children:["The rule \u201C",u.label,"\u201D"]}):null},`${u.about}:${u.about==="rule"?u.name:u.about==="place"?u.as:u.kind}`))}):null,g.map(u=>(0,$.jsxs)("section",{className:"graview-list",style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",minWidth:0},"data-testid":"search-group","data-kind":u,children:[(0,$.jsxs)("h2",{className:"graview-group-head",style:{alignItems:"center"},children:[(0,$.jsx)(me,{kind:u,brand:n,schema:e.schema,size:8}),(0,$.jsx)(I,{to:`/${Q(e.schema,u)}?${new URLSearchParams({q:f}).toString()}`,style:B,"data-testid":"search-kind-link",children:ee(e,u)}),(0,$.jsx)("span",{children:d.byKind[u]})]}),(0,$.jsx)("ul",{className:"graview-rows",children:c.filter(k=>k.kind===u).map(k=>(0,$.jsxs)("li",{"data-testid":"search-hit","data-about":"node",className:"graview-row",children:[(0,$.jsxs)(I,{to:te(e.schema,u,k.id),className:"graview-row-title",...k.label.length>60?{title:k.label}:{},children:[k.flagged?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,k.label]}),k.apart||!k.current?(0,$.jsx)("span",{className:"graview-row-glance",children:[k.apart,k.current?"":"past"].filter(Boolean).join(" \xB7 ")}):null,(0,$.jsx)(Bt,{why:k.why})]},k.id))})]},u)),f.length>0?(0,$.jsx)(oo,{asked:f}):null,f.length>0&&d.hits.length===0?(0,$.jsx)(gi,{store:e,kinds:d.searched.kinds,words:d.words,...a?{principal:a}:{},...i?{invariantContext:i}:{}}):null]})}function Bt({why:t}){return t.strength==="near"?(0,$.jsxs)("span",{style:A,"data-testid":"search-why","data-near":"",children:["Near \u201C",t.asked,"\u201D",t.field==="label"?"":` \u2014 ${t.reading}: ${t.fragment}`]}):t.field==="label"?null:(0,$.jsxs)("span",{style:A,"data-testid":"search-why",children:[t.reading,": ",t.fragment]})}function io(t,e){let n=Object.entries(e).map(([a,i])=>`${i} ${i===1?He(t.schema.tryDefinition(a),a):ee(t,a).toLowerCase()}`);return n.length===0?"Found":n.length===1?xe(n[0]):xe(`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`)}function ui(t,e,n={}){let a=[];for(let i of e){let r=Ue(t,i,{...n.principal?{principal:n.principal}:{},...n.invariantContext?{context:n.invariantContext}:{}});for(let o of Gt(t,i,r.actions.affordances))a.some(l=>l.mutation.name===o.mutation.name)||a.push(o)}return a}function Gt(t,e,n){let a=t.schema.tryDefinition(e)?.fieldRoles?.label,i=[];for(let r of n){let o=t.allMutations().find(c=>c.name===r.mutation);if(!o||!o.creates?.includes(e)||i.some(c=>c.mutation.name===o.name))continue;let l=Lt(o.input).map(c=>c.name),d=l.includes("label")?"label":a&&l.includes(a)?a:void 0;!d||r.args[d]!==void 0||i.push({kind:e,affordance:r,mutation:o,arg:d})}return i}function gi({store:t,kinds:e,words:n,principal:a,invariantContext:i}){let r=ui(t,e,{...a?{principal:a}:{},...i?{invariantContext:i}:{}});return r.length===0||n.trim().length===0?null:(0,$.jsx)("div",{style:{display:"grid",gap:24},"data-testid":"search-to-create",children:r.map(({kind:o,affordance:l,mutation:d,arg:c})=>(0,$.jsxs)("section",{style:{...re,display:"grid",gap:14},children:[(0,$.jsxs)("h2",{style:ne,children:[xe(ia(He(t.schema.tryDefinition(o),o)))," called \u201C",n,"\u201D"]}),(0,$.jsx)($e,{store:t,mutation:d,prefilled:l.args,open:l.open,initial:{[c]:n},...a?{principal:a}:{}})]},`${l.id}|${n}`))})}function oo({asked:t}){let e=ye();return e?(0,$.jsx)(so,{asked:t,desk:e.aiDesk}):null}function so({asked:t,desk:e}){return Ea(e)?(0,$.jsx)("p",{style:{margin:0},children:(0,$.jsxs)("button",{type:"button","data-testid":"search-ask",onClick:a=>Na(e,{pointed:{about:[]},asked:t,returnTo:a.currentTarget}),style:{...B,font:"inherit",padding:0,border:0,background:"transparent",cursor:"pointer",textAlign:"start"},children:["Ask: \u2018",t,"\u2019"]})}):null}var w=H(Y(),1),fi=8,yi=40;function lo(t,e){let n=e?.fields?.shape??{},a=Object.keys(n).find(i=>sa(n[i])&&oa(t[i]));return a===void 0?void 0:t[a]}function Dn({context:t}){let e=qe(),n=Re(t.store.schema,e.slug??"");return n?(0,w.jsx)(hi,{context:t,kind:n}):(0,w.jsx)(ie,{context:t,children:(0,w.jsx)(le,{context:t,children:"No such kind of thing here."})})}function hi({context:t,kind:e,opening:n,row:a,layout:i="list",description:r,bare:o}){let{store:l,brand:d,invariantContext:c}=t;ae(l);let[p,g]=it(),f=`list-${(0,Te.useId)().replace(/:/g,"")}`,u=l.schema.tryDefinition(e),k=da(p.get("archived")),q=l.graph.nodesOfKind(e,{archived:k}),v=je(l).relations.filter(s=>s.from===e||s.to===e),C=new Set(l.violations(c).flatMap(s=>s.nodeIds)),G=fr(l.schema,mr(l.schema,gr(l.schema,e))),L=v.map(s=>s.edgeKind),U=fo(p,G,L),X=["sort","filter","group","q","by","with","past","archived",...L].some(s=>p.has(s)),de=q.length>=yi,ce=u?.fieldRoles?.when,D=t.views?.arrangement?.()?.lists?.[e],J=lr(D),b=sr(D?.group),P=mo(de,ce),M=n??(J?{...P,...J}:P),N=X?U.arrangement:yn(M,G).arrangement,_=J?.sort,E=N.sort&&_?.then&&N.sort.by===_.by&&N.sort.direction===_.direction?{...N,sort:_}:N,j=yr(E.query??""),Oe=[...E.filter??[],...j.conditions].some(s=>s.key==="is"&&(s.value==="past"||s.value==="any"))||ur(u,[...E.filter??[],...j.conditions]),m=Oe||!u?.lifecycle?E:{...E,filter:[...E.filter??[],{key:"is",value:"current"}]},T=new Map,Z=Mt(q,m,{schema:l.schema,graph:l.graph,flagged:C,...typeof c?.today=="string"?{today:c.today}:{},read:(s,h)=>{let O=T.get(s.id);return O||T.set(s.id,O=pt(l.schema,l.graph,s)),O[h]}}),F=b&&E.group?.by===b.by&&!E.group.bucket?G.groups.find(s=>s.key===b.by):void 0,qn=b&&F&&(F.type==="choice"||F.type==="boolean")?dr(Z.groups,b,{type:F.type,...F.options?{options:F.options}:{}}):Z.groups.map(s=>({...s,closed:!1})),Bn=new Set((p.get("open")??"").split(",").filter(Boolean)),bi=!!E.query||(E.filter??[]).some(s=>s.key===b?.by),Gn=s=>F?.type==="boolean"?s==="1"?"true":"false":s,Vn=s=>s.closed&&!bi&&!Bn.has(Gn(s.key)),Si=s=>{let h=new URLSearchParams(p),O=new Set(Bn);O.has(s)?O.delete(s):O.add(s),O.size>0?h.set("open",[...O].join(",")):h.delete("open"),g(h,{replace:!0})},Fe=Z.nodes,st=u?.lifecycle&&!Oe?q.filter(s=>et(u,s)):q,Un=q.length-st.length,jt=E.group?.by??null,xi=s=>{let h=new URLSearchParams(p);for(let pe of["sort","filter","group","q","by","with","past","archived",...v.map(kt=>kt.edgeKind)])h.delete(pe);let O=vr(s);for(let pe of["sort","filter","group","q","archived"])O[pe]&&h.set(pe,O[pe]);![...h.keys()].some(pe=>["sort","filter","group","q"].includes(pe))&&(n||J||de||ce)&&h.set("sort",""),g(h)},{principal:Xe}=t,zt=Ue(l,e,{...Xe?{principal:Xe}:{},...t.invariantContext?{context:t.invariantContext}:{}}),We=zt.actions.affordances.map(s=>({affordance:s,mutation:l.allMutations().find(h=>h.name===s.mutation)})).filter(s=>s.mutation!==void 0),jn=zt.actions.withheld,_t=()=>new Set(Fe.length===0?We.map(({mutation:s})=>s.name):[]),[Yt,zn]=(0,Te.useState)(()=>({kind:e,open:_t()}));Yt.kind!==e&&zn({kind:e,open:_t()});let _n=s=>(Yt.kind===e?Yt.open:_t()).has(s),Yn=(s,h)=>zn(O=>{let pe=new Set(O.open);return h?pe.add(s):pe.delete(s),{kind:O.kind,open:pe}}),Qn=`begin-${(0,Te.useId)().replace(/:/g,"")}`,Xn=j.words&&Fe.length===0?Object.fromEntries(Gt(l,e,zt.actions.affordances).map(s=>[s.mutation.name,s.arg])):{},Je=ee(l,e),yt=t.views?.lookup(e,{cardinality:"one",fidelity:"glyph"}),Qt=yt!==void 0&&!nt(yt)?yt:void 0,Xt=(E.group?.bucket??"day")==="day"?E.group?.by:void 0,Jt=(E.filter??[]).map(s=>s.key),Pi=Jt.filter(s=>Jt.indexOf(s)===Jt.lastIndexOf(s)&&/choice|boolean/.test(G.filters.find(h=>h.key===s)?.type??"")),Zt=s=>{let h={...u?.computed?pt(l.schema,l.graph,s):s};Xt&&!String(h[Xt]).includes("T")&&delete h[Xt];for(let O of Pi)delete h[O];return h},ht=s=>{let h=ge(u,s);if(a)return(0,w.jsxs)("li",{"data-testid":"record-row","data-graview-record":s.id,style:{minWidth:0},...rn(s.id),children:[an(s,h),a(s,{label:h,href:te(l.schema,e,s.id),flagged:C.has(s.id),glance:It(Zt(s),u,h)})]},s.id);if(Qt){let on=$t(yt,s,l.graph),Mi=Object.fromEntries(Object.entries(Zt(s)).filter(([Ni])=>!on?.fields.has(Ni))),na=on?It(Mi,u,on.title??h):"";return(0,w.jsxs)("li",{"data-testid":"record-row","data-graview-record":s.id,style:{position:"relative",display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:16,rowGap:2,paddingBlock:10,borderTop:"1px solid var(--graview-edge)"},...rn(s.id),children:[an(s,h),(0,w.jsx)("div",{style:{flex:"1 1 14rem",minWidth:0},children:(0,w.jsx)(Qt,{node:s,cardinality:"one",fidelity:"glyph",mode:"fullscreen",selected:!1,...C.has(s.id)?{flagged:[s.id]}:{}})}),na?(0,w.jsx)("span",{style:{...A,flex:"0 1 auto",minWidth:0,overflowWrap:"anywhere"},"data-testid":"record-glance",children:na}):null,(0,w.jsx)(wo,{to:te(l.schema,e,s.id),label:C.has(s.id)?`${h} \u2014 implicated in a problem`:h})]},s.id)}let O=It(Zt(s),u,h),pe=j.words?hr(u,s,j.words):void 0,kt=de?void 0:_a(s,u),bt=lo(s,u),ta=(0,w.jsxs)(I,{to:te(l.schema,e,s.id),className:"graview-row-title",...h.length>60?{title:h}:{},children:[C.has(s.id)?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,h]});return(0,w.jsxs)("li",{className:"graview-row","data-graview-record":s.id,...rn(s.id),children:[an(s,h),kt?(0,w.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:14,minWidth:0},children:[(0,w.jsx)(Ve,{as:"thumb",file:kt}),ta]}):ta,O||bt?(0,w.jsxs)("span",{className:"graview-row-glance",children:[O,O&&bt?" \xB7 ":null,bt?(0,w.jsx)(Nt,{address:bt}):null]}):null,pe?(0,w.jsx)(Bt,{why:pe}):null]},s.id)},en=Ae(t).filter(s=>s.kind===e),Jn=D?.filters,Ai=(E.filter??[]).some(s=>s.key!=="is"||s.value!=="any"),Ci=!!(E.sort||E.group||E.query||Ai),Ri=st.length>=fi||X&&Ci,Me=E.sort?G.sorts.find(s=>s.key===E.sort.by):void 0,tn=Me?.type==="date"||Me!==void 0&&Me.key===ce,Zn=de&&!Z.grouped&&Me&&(Me.about==="label"||Me.type==="text"||tn)?s=>{let h=Me.about==="label"?ge(u,s):s[Me.key];if(typeof h!="string"||h.length===0)return tn?"No date":"#";if(tn)return h.slice(0,4);let O=h.trim().charAt(0).toLocaleUpperCase();return/\p{L}/u.test(O)?O:"#"}:void 0,Ge=Zn?Fe.reduce((s,h)=>{let O=Zn(h);return s.at(-1)?.key===O?s.at(-1).nodes.push(h):s.push({key:O,nodes:[h]}),s},[]):void 0,ea=Z.grouped&&jt?qn.flatMap(s=>Vn(s)?[]:s.nodes):Ge&&Ge.length>1?Ge.flatMap(s=>s.nodes):Fe,nn=(0,Te.useMemo)(()=>ea.map(s=>s.id),[ea.map(s=>s.id).join(`
109
- `)]),Ce=xr(nn),lt=(Xe?l.permittedMutations(Xe):l.permittedMutations()).some(s=>{let h=s.subject?.kinds;return h!==void 0&&(h==="*"||h.includes(e))}),an=(s,h)=>lt?(0,w.jsx)("span",{className:"graview-choose-at",children:(0,w.jsx)("input",{...Ce.boxProps(s.id,h),onPointerEnter:wn,onFocus:wn})}):null,rn=s=>lt?{"data-graview-choose":s}:{},Li=(0,Te.useCallback)(s=>{Ce.choose(s),requestAnimationFrame(()=>{let h=Ce.list.current;((s[0]===void 0?null:h?.querySelector(`[data-graview-choose-box="${CSS.escape(s[0])}"]`))??h)?.focus({preventScroll:!0})})},[Ce]),Ze=i==="grid"?{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 15rem), 1fr))",alignItems:"start",gap:12}:a||Qt?{margin:0,padding:0,listStyle:"none",display:"grid",gap:a&&i==="list"?6:0}:void 0,wt=Ze?void 0:"graview-rows",dt=s=>`list-at-${s.replace(/[^\p{L}\p{N}]/gu,"_")}`,vt=v.map(s=>{let h=s.from===e?s.to:s.from,O=s.from===e?s.description:s.inverse??s.description;return{relation:s,far:h,words:O}}),Ti=new Set(vt.map(s=>(s.words??"").toLowerCase()).filter((s,h,O)=>s&&O.indexOf(s)!==h));return(0,w.jsxs)(o?go:ie,{context:t,children:[(0,w.jsxs)("div",{style:{display:"grid",gap:12},children:[(0,w.jsxs)("header",{style:{display:"grid",gap:4},children:[(0,w.jsxs)("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",columnGap:10,rowGap:4,minWidth:0},children:[(0,w.jsx)(me,{kind:e,brand:d,schema:l.schema,size:8}),(0,w.jsx)(le,{context:t,children:Je}),We.length>0?(0,w.jsx)("span",{style:{marginLeft:"auto",display:"flex",flexWrap:"wrap",columnGap:14},"data-testid":"beginnings-open",children:We.map(({affordance:s,mutation:h})=>(0,w.jsx)(yo,{name:h.name,title:h.title??h.name,panel:`${Qn}-${h.name}`,open:_n(h.name),onOpen:O=>Yn(h.name,O)},s.id))}):null]}),r??u?.description?(0,w.jsx)("p",{style:se,children:r??u?.description}):null,vt.length>0||en.length>0?(0,w.jsxs)("p",{style:{...A,margin:0,display:"flex",flexWrap:"wrap",columnGap:18,rowGap:2},"data-testid":"kind-related",children:[vt.length>0?(0,w.jsxs)("span",{"data-testid":"kind-relations",children:["Related:"," ",vt.map(({relation:s,far:h,words:O},pe)=>(0,w.jsxs)("span",{"data-relation":s.edgeKind,children:[pe>0?(0,w.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,h==="*"?xe(O??we(s.edgeKind)):(0,w.jsx)(I,{to:`/${Q(l.schema,h)}`,style:B,title:ee(l,h),children:O&&Ti.has(O.toLowerCase())?`${xe(O)}: ${ee(l,h).toLowerCase()}`:xe(O??ee(l,h))})]},`${s.edgeKind}|${s.from}|${s.to}`))]}):null,en.length>0?(0,w.jsxs)("span",{"data-testid":"kind-pictures",children:["Also as:"," ",en.map((s,h)=>(0,w.jsxs)("span",{children:[h>0?(0,w.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,w.jsx)(I,{to:be(t,s),style:B,children:s.title})]},_e(s)))]}):null]}):null]}),We.length>0?(0,w.jsx)("div",{style:{display:"contents"},"data-testid":"beginnings",children:We.map(({affordance:s,mutation:h})=>{let O=!!(Xn[h.name]&&Fe.length===0);return(0,w.jsx)(ho,{name:h.name,id:`${Qn}-${h.name}`,description:h.description,open:_n(h.name),onClose:()=>Yn(h.name,!1),children:(0,w.jsx)($e,{store:l,mutation:h,prefilled:s.args,open:s.open,...O?{initial:{[Xn[h.name]]:j.words}}:{},...t.principal?{principal:t.principal}:{}},O?`${h.name}|${j.words}`:h.name)},s.id)})}):null,U.dropped.length>0?(0,w.jsxs)("p",{style:{...A,margin:0},"data-testid":"list-dropped",children:["This link asked for ",U.dropped.join(", "),", which ",Je.toLowerCase()," cannot be arranged by; the rest is shown."]}):null,st.length>0?(0,w.jsx)(Sr,{schema:l.schema,graph:l.graph,kind:e,arrangement:E,onChange:xi,kept:{shown:Fe.length,of:st.length},noun:{one:He(u,e),many:Je.toLowerCase()},...Ri?{}:{allow:!1},...Jn?{filters:Jn}:{},offers:G,chips:{nodes:st,flagged:C,...typeof c?.today=="string"?{today:c.today}:{}},query:t.framed===!0&&t.barAbove!==!0}):null,(0,w.jsx)("style",{children:Ft}),lt?(0,w.jsx)("style",{children:Pr+uo}):null,(0,w.jsx)("div",{className:"graview-list",...lt?{...Ce.listProps,ref:Ce.list,tabIndex:-1,"data-graview-choosable":"","aria-label":Ce.chosen.length>0?`${Je}, ${Ce.chosen.length} chosen`:Je,role:"group"}:{},children:Fe.length===0&&j.words?(0,w.jsxs)("p",{style:se,"data-testid":"none-yet",children:["Nothing here is called \u201C",j.words,"\u201D."," ",(0,w.jsx)("span",{style:A,"data-testid":"list-searched",children:Tt(l.schema,{kinds:[e],past:Oe})})," ",(0,w.jsx)(I,{to:"?",style:B,children:"Show every one"})]}):Fe.length===0?(0,w.jsxs)("p",{style:se,"data-testid":"none-yet",children:[E.filter?.length||E.query?"None of them.":"None yet",!E.filter?.length&&!E.query&&We.length>0?` \u2014 the first one starts above, with \u201C${We[0]?.mutation.title??We[0]?.mutation.name}\u201D.`:!E.filter?.length&&!E.query?".":"",E.filter?.length||E.query?(0,w.jsxs)(w.Fragment,{children:[" ",(0,w.jsx)(I,{to:"?",style:B,children:"Show every one"})]}):null]}):Z.grouped&&jt?(0,w.jsx)("div",{style:{display:"grid",gap:"1rem"},"data-testid":"records","data-grouped":jt,children:qn.map(s=>{if(!s.closed)return(0,w.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group",children:[(0,w.jsxs)("h2",{className:"graview-group-head",children:[s.label," ",(0,w.jsx)("span",{children:s.nodes.length})]}),(0,w.jsx)("ul",{style:Ze,className:wt,"data-graview-rows":"",children:s.nodes.map(ht)})]},s.key||"-");let h=Vn(s),O=`${f}-${dt(s.key||"none")}`;return(0,w.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group","data-closed":h?"shut":"open",children:[(0,w.jsx)("h2",{className:"graview-group-head",children:(0,w.jsxs)("button",{type:"button",className:"graview-group-toggle","aria-expanded":!h,"aria-controls":O,"data-testid":"list-group-toggle",onClick:()=>Si(Gn(s.key)),children:[(0,w.jsx)("span",{"aria-hidden":"true",children:h?"\u25B8":"\u25BE"}),s.label," ",(0,w.jsxs)("span",{children:["\xB7 ",s.nodes.length]}),(0,w.jsxs)("span",{style:co,children:[" ",s.nodes.length===1?He(u,e):Je.toLowerCase()]})]})}),(0,w.jsx)("ul",{id:O,style:h?{...Ze,display:"none"}:Ze,className:wt,"data-graview-rows":"",hidden:h,children:h?null:s.nodes.map(ht)})]},s.key||"-")})}):Ge&&Ge.length>1?(0,w.jsxs)("div",{style:{display:"grid",gap:14},"data-testid":"records","data-sectioned":Me?.type==="date"?"year":"letter",children:[(0,w.jsx)("nav",{"aria-label":"Jump to","data-testid":"list-index",style:{...A,display:"flex",flexWrap:"wrap",gap:Me?.type==="date"?"0 10px":"0 4px",lineHeight:1.3},children:Ge.map(s=>(0,w.jsx)("a",{href:`#${dt(s.key)}`,onClick:h=>{h.preventDefault(),document.getElementById(dt(s.key))?.scrollIntoView({block:"start"})},style:{...ve,minWidth:24,justifyContent:"center"},children:s.key},s.key))}),Ge.map(s=>(0,w.jsxs)("section",{"data-testid":"list-section","aria-labelledby":dt(s.key),style:{display:"grid",gap:0},children:[(0,w.jsx)("h2",{id:dt(s.key),className:"graview-group-head",children:s.key}),(0,w.jsx)("ul",{style:Ze,className:wt,"data-graview-rows":"",children:s.nodes.map(ht)})]},s.key))]}):(0,w.jsx)("ul",{style:Ze,className:wt,"data-testid":"records","data-graview-rows":"",children:Fe.map(ht)})}),lt?(0,w.jsx)(Ar,{store:l,chosen:Ce.chosen,...Xe?{principal:Xe}:{},...c?{context:c}:{},anchor:po,of:nn.length,onChooseAll:()=>Ce.choose(nn),onClear:Ce.clear,onActed:Li}):null,Un>0?(0,w.jsxs)(I,{to:mi(p,"filter","is:any"),style:{...B,...A,justifySelf:"start"},"data-testid":"past-link",children:["+",Un," past"]}):null,k===!1&&l.graph.count(e,{archived:!0})>0?(0,w.jsxs)(I,{to:mi(p,"archived","true"),style:{...B,...A,justifySelf:"start"},"data-testid":"archived-link",children:["+",l.graph.count(e,{archived:!0})," archived"]}):null]}),jn.length>0?(0,w.jsx)("ul",{style:{...re,margin:0,padding:0,listStyle:"none",display:"grid",gap:4},"data-testid":"withheld",children:jn.map(s=>(0,w.jsxs)("li",{style:A,children:[(0,w.jsx)("s",{children:s.label})," \u2014 ",s.refusal.message]},s.id))}):null]})}var co={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},po=()=>document.querySelector("[data-graview-choosable]")?.closest("[data-embed-content]")??null,uo=`
110
- .graview-list[data-graview-choosable]{outline:none}
111
- .graview-list [data-graview-choose]{position:relative;padding-left:34px}
112
- .graview-choose-at{position:absolute;left:2px;top:0;bottom:0;z-index:${ga.raised};display:flex;align-items:center}
113
- @media (pointer: coarse){
114
- .graview-list:not([data-graview-choosing]) [data-graview-choose]{padding-left:0}
115
- .graview-list:not([data-graview-choosing]) .graview-choose-at{display:none}
116
- }
117
- `;function go({children:t}){return(0,w.jsx)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40,minWidth:0},children:t})}var mo=(t,e)=>e?{sort:{by:e,direction:"desc"}}:t?{sort:{by:"label",direction:"asc"}}:{};function fo(t,e,n){let a=Pt({...t.get("sort")?{sort:t.get("sort")}:{},...t.get("filter")?{filter:t.get("filter")}:{},...t.get("group")?{group:t.get("group")}:{},...t.get("q")?{q:t.get("q")}:{},...t.get("archived")?{archived:t.get("archived")}:{}}),i=[...a.filter??[]],r=t.get("by"),o=a.group??(r?{by:r}:void 0);for(let d of n){let c=t.get(d);c&&i.push({key:d,value:c})}let l=t.get("with");return l&&i.push({key:l,value:"*"}),t.get("past")==="1"&&!i.some(d=>d.key==="is")&&i.push({key:"is",value:"any"}),yn({...a.sort?{sort:a.sort}:{},...a.query?{query:a.query}:{},...i.length>0?{filter:i}:{},...o?{group:o}:{},...a.archived!==void 0?{archived:a.archived}:{}},e)}function mi(t,e,n){let a=new URLSearchParams(t);return a.set(e,n),a.delete("past"),`?${a.toString()}`}function yo({name:t,title:e,panel:n,open:a,onOpen:i}){return(0,w.jsxs)("button",{type:"button","data-testid":`act-open-${t}`,"data-graview-act":t,"aria-expanded":a,"aria-controls":n,onClick:()=>{i(!a),a||requestAnimationFrame(()=>document.getElementById(n)?.querySelector("input, select, textarea, button")?.focus())},style:{...ve,minHeight:28,margin:"-4px 0",padding:"0 2px",border:0,background:"none",font:"inherit",fontWeight:600,color:"var(--graview-ink)",cursor:"pointer"},children:[(0,w.jsx)("span",{"aria-hidden":"true",style:{marginRight:6},children:a?"\u2212":"+"}),e]})}function ho({name:t,id:e,description:n,open:a,onClose:i,children:r}){return(0,w.jsxs)("div",{"data-testid":`act-${t}`,id:e,hidden:!a,onKeyDown:o=>{o.key==="Escape"&&(o.preventDefault(),i(),document.querySelector(`[aria-controls="${e}"]`)?.focus())},style:a?{display:"grid",gap:12,padding:"4px 0 12px"}:void 0,children:[n?(0,w.jsx)("p",{style:{...A,margin:0,maxWidth:"58ch"},children:n}):null,r]})}function wo({to:t,label:e}){let n=(0,Te.useRef)(null);return Cr(n),(0,w.jsx)(I,{ref:n,to:t,"aria-label":e,style:{position:"absolute",inset:0,borderRadius:6}})}var Qe=H(Ee(),1);var ft=H(Ee(),1);var W=H(Y(),1);function Wn({context:t}){let{store:e,brand:n,invariantContext:a,principal:i}=t;ae(e);let r=e.violations(a),o=e.allInvariants(),l=At(e,r),d=$a(e.schema,o);return(0,W.jsxs)(ie,{context:t,children:[(0,W.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,W.jsx)(le,{context:t,children:r.length===0?"All rules hold":"What is broken"}),(0,W.jsx)("p",{style:se,"data-testid":"problems-count",children:r.length===0?"Every declared rule is satisfied by what is here.":ca(r)})]}),(0,W.jsx)(pi,{context:t}),l.map((c,p)=>{let g=c.nodeIds[0],f=g?e.graph.getNode(g):void 0;return(0,W.jsxs)("section",{style:{display:"grid",gap:10,padding:"16px 18px",borderLeft:"3px solid var(--graview-warn)",background:"var(--graview-panel-warning)",borderRadius:"0 var(--graview-radius, 12px) var(--graview-radius, 12px) 0"},children:[c.line?null:(0,W.jsx)(Vt,{violation:c,schema:e.schema,...n?{brand:n}:{}}),f?(0,W.jsxs)("p",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[(0,W.jsx)(me,{kind:f.kind,brand:n,schema:e.schema,size:7}),(0,W.jsx)(I,{to:te(e.schema,f.kind,f.id),style:B,children:ge(e.schema.tryDefinition(f.kind),f)})]}):null,c.line?(0,W.jsx)(Vt,{violation:c,schema:e.schema,...n?{brand:n}:{}}):null,(0,W.jsx)(Ut,{store:e,repairs:c.repairs,...i?{principal:i}:{}})]},p)}),o.length>0?(0,W.jsxs)("section",{style:{...re,display:"grid",gap:12},"data-testid":"rules",children:[(0,W.jsx)("h2",{style:ne,children:"The rules"}),(0,W.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:o.map(c=>{let p=r.filter(u=>u.invariant===c.name).length,g=d.get(c.name),f=c.label??c.name;return(0,W.jsxs)("li",{"data-graview-rule":c.name,style:{display:"grid",gap:2},children:[(0,W.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:12,rowGap:2},children:[g?(0,W.jsx)(Ct,{line:g,schema:e.schema,...n?{brand:n}:{},style:{flex:"1 1 18rem"}}):(0,W.jsx)("span",{style:{flex:"1 1 18rem",fontWeight:550},children:f}),(0,W.jsx)("span",{style:{...A,color:p>0?"var(--graview-warn)":"var(--graview-ink-faint)"},children:p===0?"holds":`broken in ${p} ${p===1?"place":"places"}`})]}),g&&f.trim().length>0?(0,W.jsx)("span",{style:A,children:f}):null]},c.name)})})]}):null]})}function Vt({violation:t,schema:e,brand:n}){if(!t.line)return(0,W.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},children:t.message});let a=Fa(t),i=Oa(t);return i?(0,W.jsxs)("div",{style:{display:"grid",gap:4},"data-testid":"problem-line",children:[(0,W.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},"data-testid":"problem-says",children:i}),a?(0,W.jsx)("span",{style:A,children:a}):null,(0,W.jsxs)("details",{"data-testid":"problem-judged",style:A,children:[(0,W.jsx)("summary",{style:{cursor:"pointer",width:"fit-content",minHeight:24},children:"How it is judged"}),(0,W.jsx)(Ct,{line:t.line,schema:e,...n?{brand:n}:{},lead:"none"})]})]}):(0,W.jsxs)("div",{style:{display:"grid",gap:2},"data-testid":"problem-line",children:[(0,W.jsx)(Ct,{line:t.line,schema:e,...n?{brand:n}:{},lead:"none",style:{color:"var(--graview-warn)"}}),a?(0,W.jsx)("span",{style:A,children:a}):null]})}function Ut({store:t,repairs:e,principal:n}){let[a,i]=(0,ft.useState)(null),[r,o]=(0,ft.useState)(null),l=(0,ft.useRef)([]);if(e.length===0)return null;let d=a===null?null:e[a],c=d&&(d.missing??[]).length>0?t.allMutations().find(p=>p.name===d.mutation):void 0;return(0,W.jsxs)("div",{style:{display:"grid",gap:10},"data-testid":"repairs",children:[(0,W.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:e.map((p,g)=>{let f=(p.missing??[]).length>0,u=t.permits({name:p.mutation,args:{...p.args}},n);return u.ok?(0,W.jsx)("button",{ref:k=>{l.current[g]=k},type:"button","data-graview-repair":p.mutation,"data-graview-asks":f||void 0,"aria-expanded":f?a===g:void 0,onClick:()=>{if(o(null),f){i(a===g?null:g);return}i(null);try{t.apply({name:p.mutation,args:{...p.args}},n?{author:n}:{})}catch(k){o(at(t.schema,t.allMutations(),k))}},style:Le,children:f?`${p.label} \u2026`:p.label},g):(0,W.jsxs)("p",{"data-testid":"withheld","data-withheld":u.refusal.wouldNeed.join(",")||"nobody",style:{...A,margin:0},children:[(0,W.jsx)("s",{children:p.label})," \u2014 ",u.refusal.message]},g)})}),c&&d?(0,W.jsx)($e,{store:t,mutation:c,prefilled:{...d.args},only:d.missing??[],label:d.label,onDone:()=>{let p=a;i(null),requestAnimationFrame(()=>{let g=p===null?null:l.current[p];if(g?.isConnected){g.focus();return}let f=document.querySelector("[data-graview-page-title]")??document.querySelector("main h1, main h2");f&&(f.hasAttribute("tabindex")||(f.tabIndex=-1),f.focus())})},...n?{principal:n}:{}}):null,d&&!c&&(d.missing??[]).length>0?(0,W.jsxs)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:vn},children:["\u201C",d.label,"\u201D names ",d.mutation,", which this app does not declare."]}):null,r?(0,W.jsx)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:vn},children:r}):null]})}var Hn=H(Ee(),1);var Be=H(Y(),1);function wi({store:t,link:e,principal:n}){let[a,i]=(0,Hn.useState)(!1),[r,o]=(0,Hn.useState)(null),l=Va(e);return(0,Be.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[(0,Be.jsx)("button",{type:"button","data-graview-provisional":"",title:l,"aria-label":`Unsure link: ${l}`,"aria-expanded":a,onClick:()=>i(!a),style:{border:"1px dashed var(--graview-ink-muted)",borderRadius:999,background:"transparent",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"0.75rem",lineHeight:1,padding:"2px 6px",cursor:"pointer"},children:"unsure"}),a?(0,Be.jsxs)("span",{style:{...A,display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,Be.jsx)("span",{children:l}),(0,Be.jsx)("button",{type:"button",style:{...Le,padding:"4px 10px"},onClick:()=>{try{t.apply({name:pa,args:{kind:e.edge.kind,from:e.edge.from,to:e.edge.to}},n?{author:n}:{}),i(!1)}catch(d){o(at(t.schema,t.allMutations(),d))}},children:"Keep this link"}),r?(0,Be.jsx)("span",{role:"alert",children:r}):null]}):null]})}var y=H(Y(),1),vo=[];function Kn({context:t}){let{store:e,brand:n,principal:a,invariantContext:i}=t;ae(e);let r=ye()!==null,o=qe(),l=decodeURIComponent(o.id??""),d=Xr(e,l,{...a?{principal:a}:{},...i?{context:i}:{}}),c=At(e,d?.violations??vo),[p,g]=(0,Qe.useState)(null),[f,u]=(0,Qe.useState)(!1),[k,q]=(0,Qe.useState)(null),v=(0,Qe.useRef)(null),C=(0,Qe.useRef)(null),G=m=>{(v.current?.parentElement?.querySelector(`[data-affordance="${m.replace(/["\\]/g,"\\$&")}"]`)??v.current)?.focus()};if(!d)return(0,y.jsx)(ie,{context:t,children:(0,y.jsx)(le,{context:t,children:"Nothing lives at this address."})});let L=e.graph.getNode(l),U=e.schema.tryDefinition(d.kind),X=U?.describe&&L?Ia(U,L):null,de=[...e.log.all()].filter(m=>!xt(m)&&(m.writes.includes(l)||m.reads.includes(l))).slice(-8).reverse(),ce=e.log.all().find(m=>!xt(m)&&m.undoes===void 0&&m.primitives.some(T=>T.op==="add-node"&&T.node.id===l)),D=d.actions.affordances.filter(m=>m.provider!=="invariant"),J=D.filter(m=>m.destructive||m.setsAside),b=f||J.length<2?D:D.filter(m=>!J.includes(m)),P=t.views?.lookup(d.kind,{cardinality:"one",fidelity:"full"}),M=P!==void 0&&!nt(P)?P:void 0,N=M&&L?$t(P,L,e.graph):void 0,_=N?d.fields.filter(m=>!N.fields.has(m.key)):d.fields,E=N?d.links.flatMap(m=>{let T=m.targets.filter(Z=>!N.records.has(Z.id));return T.length>0?[{...m,targets:T}]:[]}):d.links,j=M!==void 0&&Ta(P),Oe=r&&za(U).length>0;return(0,y.jsxs)(ie,{context:t,children:[(0,y.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,y.jsxs)("p",{style:{...he,display:"flex",alignItems:"center",gap:8},children:[(0,y.jsx)(me,{kind:d.kind,brand:n,schema:e.schema,size:8}),(0,y.jsx)(I,{to:`/${Q(e.schema,d.kind)}`,style:ve,children:ee(e,d.kind)})]}),(0,y.jsx)(le,{context:t,children:r&&L?.label===d.label?(0,y.jsx)(hn,{nodeId:l,field:"label",value:d.label,said:d.label}):d.label}),X&&X!==d.label?(0,y.jsx)("p",{style:se,children:X}):null,ce?.lineage?(0,y.jsxs)("p",{style:{...A,margin:0},"data-testid":"record-lineage",children:["Made by ",ut(ce,a,{graph:e.graph,schema:e.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}}),", ",pn(ce.lineage)]}):null,(0,y.jsx)(Ot,{context:t,stop:`#focus=${encodeURIComponent(l)}`,style:{...B,...A},"data-testid":"spatial-link"}),r&&L?(0,y.jsx)(gn,{choices:[{on:"changed",record:l},{on:"act",record:l},{on:"reaches",kind:d.kind,condition:"",record:l}],label:"Notify me when this changes",testId:"record-notify",style:{...Le,...A,justifySelf:"start"}}):null,Ae(t).some(m=>m.kind===d.kind||m.across===d.kind)?(0,y.jsxs)("p",{style:{...A,margin:0},"data-testid":"seen-in",children:["Seen in:"," ",Ae(t).filter(m=>m.kind===d.kind||m.across===d.kind).map((m,T)=>(0,y.jsxs)("span",{children:[T>0?(0,y.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,y.jsx)(I,{to:be(t,m),style:B,children:m.title})," ",(0,y.jsx)(Ot,{context:t,stop:`#view=${encodeURIComponent(m.as)}`,style:{...B,...A,display:"inline-block",minWidth:24,textAlign:"center"},title:`${m.title}, in the scene`,label:`${m.title}, in the scene`,children:(0,y.jsx)("span",{"aria-hidden":"true",children:"\u2197"})})]},_e(m)))]}):null]}),L&&la(L)?(0,y.jsx)(bo,{context:t,id:l,kind:d.kind}):null,L&&ua(e,l)?(0,y.jsx)(ko,{context:t,id:l,kind:d.kind}):null,M&&L?(0,y.jsx)("section",{"data-testid":"record-view",style:{display:"grid",minWidth:0},children:(0,y.jsx)(Rr,{children:(0,y.jsx)(M,{node:L,cardinality:"one",fidelity:"full",mode:"fullscreen",selected:!1,...d.violations.length>0?{flagged:[l]}:{}})})}):null,d.violations.length>0?(0,y.jsx)("section",{"data-testid":"record-violations",style:{display:"grid",gap:12,padding:"16px 18px",borderLeft:"3px solid var(--graview-warn)",background:"var(--graview-panel-warning)",borderRadius:"0 var(--graview-radius, 12px) var(--graview-radius, 12px) 0"},children:c.map((m,T)=>(0,y.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,y.jsx)(Vt,{violation:m,schema:e.schema,...n?{brand:n}:{}}),(0,y.jsx)(Ut,{store:e,repairs:Jr(d.actions,m.repairs),...a?{principal:a}:{}})]},T))}):null,!j&&(_.length>0||Oe)?(0,y.jsxs)("section",{style:{...re,display:"grid",gap:14},"data-testid":"record-fields",children:[(0,y.jsx)("h2",{style:ne,children:"The facts"}),Wa(U,_).map((m,T)=>{let Z=(0,y.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"14px 24px"},children:m.fields.map(F=>F.files?(0,y.jsx)(Ve,{as:"field",read:!r,nodeId:l,field:F.key,label:F.label,files:F.files,labelStyle:he,style:{gap:4}},F.key):F.long?(0,y.jsx)(br,{nodeId:l,field:F.key,label:F.label,value:F.value,markdown:F.markdown,style:{gridColumn:"1 / -1",gap:4},labelStyle:he,valueStyle:{lineHeight:1.6}},F.key):(0,y.jsxs)("div",{style:{display:"grid",gap:2,minWidth:0,alignContent:"start"},children:[(0,y.jsx)("dt",{style:he,children:F.label}),(0,y.jsx)("dd",{style:{margin:0,overflowWrap:"anywhere",minWidth:0},children:F.linked?(0,y.jsx)(Qa,{relation:F.linked.relation,refs:F.linked.refs,...r?{nodeId:l,field:F.key}:{}}):F.app?(0,y.jsx)(Nt,{address:F.app,as:"record",...r?{nodeId:l,field:F.key}:{}}):F.href?(0,y.jsx)(kr,{href:F.href,field:F.key,value:F.value,stored:F.stored,...r?{nodeId:l}:{}}):r?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(hn,{nodeId:l,field:F.key,value:F.value,stored:F.stored}),F.repeats?(0,y.jsx)(Za,{nodeId:l,field:F.key,start:L?.[F.key],value:L?.[`${F.key}Repeat`],label:`${F.label} repeats`}):null]}):F.value})]},F.key))});return m.title?(0,y.jsxs)("section",{style:{display:"grid",gap:10,minWidth:0},children:[(0,y.jsx)("h3",{"data-graview-field-group":m.title,style:{...ne,fontSize:"inherit"},children:m.title}),Z]},T):(0,y.jsx)("div",{children:Z},T)}),Oe?(0,y.jsx)(Ve,{as:"unfilled",nodeId:l,skip:[...N?.fields??[]],labelStyle:he,style:{gap:4}}):null]}):null,(j?[]:E).map(m=>(0,y.jsxs)("section",{style:{...re,display:"grid",gap:10},children:[(0,y.jsx)("p",{style:he,children:Br(e,m)}),m.description?(0,y.jsx)("h2",{style:ne,children:xe(m.description)}):(0,y.jsxs)("h2",{style:ne,"aria-label":we(m.edgeKind),children:[m.direction==="in"?"\u2190 ":"\u2192 ",we(m.edgeKind)]}),(0,y.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},children:m.targets.map(T=>{let Z=Ua(e,m.direction==="in"?{kind:m.edgeKind,from:T.id,to:l}:{kind:m.edgeKind,from:l,to:T.id});return(0,y.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,y.jsx)(me,{kind:T.kind,brand:n,schema:e.schema,size:7}),(0,y.jsxs)(I,{to:te(e.schema,T.kind,T.id),style:B,children:[T.label,T.apart?(0,y.jsxs)("span",{style:A,children:[" \xB7 ",T.apart]}):null]}),Z?.provisional?(0,y.jsx)(wi,{store:e,link:Z,...a?{principal:a}:{}}):null]},T.id)})}),(m.direction==="out"&&e.schema.edge(m.edgeKind)?.cardinality==="one"?[]:[...new Set(m.targets.map(T=>T.kind))]).map(T=>(0,y.jsxs)(I,{to:`/${Q(e.schema,T)}?${encodeURIComponent(m.edgeKind)}=${encodeURIComponent(l)}`,style:{...B,...A},"data-testid":"related-all",children:["Sort and filter ",m.description??`these ${ee(e,T).toLowerCase()}`,m.targets.some(Z=>Z.kind!==T)?` (${ee(e,T).toLowerCase()})`:""," ",(0,y.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]},T))]},`${m.edgeKind}|${m.direction}|${m.description??""}`)),!j&&(D.length>0||d.actions.withheld.length>0)?(0,y.jsxs)("section",{style:{...re,display:"grid",gap:14},"data-testid":"record-actions",children:[(0,y.jsx)("h2",{style:ne,ref:v,tabIndex:-1,children:"What can be done"}),(0,y.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[b.map(m=>{let T=p===m.id;return(0,y.jsx)("button",{type:"button","data-affordance":m.id,"data-rank":m.rank,"data-graview-act":m.mutation,autoFocus:f&&m===J[0],"aria-expanded":T,onClick:()=>{g(T?null:m.id),T||requestAnimationFrame(()=>C.current?.querySelector("input:not([type=hidden]), select, textarea, button")?.focus())},style:{...Le,...T?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},children:m.label},m.id)}),b.length<D.length?(0,y.jsxs)("button",{type:"button","aria-expanded":!1,onClick:()=>u(!0),style:{...Le,...A},"data-testid":"record-actions-more",children:["Show ",D.length-b.length," more"]}):null]}),D.map(m=>{if(p!==m.id)return null;let T=e.allMutations().find(Z=>Z.name===m.mutation);return T?(0,y.jsxs)("div",{ref:C,onKeyDown:Z=>{if(Z.key!=="Escape"||Z.defaultPrevented)return;Z.preventDefault(),g(null);let F=m.id;requestAnimationFrame(()=>G(F))},style:{display:"grid",gap:10,padding:18,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,y.jsx)("h3",{style:ne,children:m.label}),T.description?(0,y.jsx)("p",{style:{...A,margin:0},children:T.description}):null,(0,y.jsx)($e,{store:e,mutation:T,prefilled:m.args,open:m.open,label:m.label,onDone:()=>{g(null),q(m.mutation);let Z=m.id;requestAnimationFrame(()=>G(Z))},...a?{principal:a}:{}})]},m.id):null}),r&&k!==null&&p===null?(0,y.jsx)(gn,{choices:[{on:"act",act:k,record:l},{on:"act",act:k}],label:"Notify me when someone else does this",testId:"notify-after-act",style:{...Le,...A,justifySelf:"start"}}):null,d.actions.withheld.length>0?(0,y.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:d.actions.withheld.map(m=>(0,y.jsxs)("li",{style:A,children:[(0,y.jsx)("s",{children:m.label})," \u2014 ",m.refusal.message]},m.id))}):null]}):null,r?(0,y.jsx)(qr,{id:l,style:re,headingStyle:ne}):null,de.length>0?(0,y.jsxs)("section",{style:{...re,display:"grid",gap:10},"data-testid":"record-history",children:[(0,y.jsx)("h2",{style:ne,children:"What has happened"}),(0,y.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:de.map(m=>(0,y.jsxs)("li",{style:A,children:[(0,y.jsx)("span",{style:{color:"var(--graview-ink)"},children:m.intent}),m.lineage?(0,y.jsxs)("span",{"data-graview-lineage":"",children:[" \xB7 ",pn(m.lineage)]}):null," \u2014 ",ut(m,a,{graph:e.graph,schema:e.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}})]},m.id))})]}):null]})}function ko({context:t,id:e,kind:n}){let{store:a,principal:i}=t,r={name:`allow-tidying-${n}`,args:{id:e}},o=a.allMutations().some(l=>l.name===r.name)&&a.permits(r,i).ok;return(0,y.jsxs)("section",{"data-testid":"record-left-alone",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,padding:"12px 16px",border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,y.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,y.jsx)("strong",{children:"Left alone."})," Nothing automated changes it; tidying passes it by."]}),o?(0,y.jsx)("button",{type:"button",style:Le,"data-testid":"allow-tidying",onClick:()=>a.apply(r,i?{author:i}:{}),children:"Allow tidying again"}):null]})}function bo({context:t,id:e,kind:n}){let{store:a,principal:i}=t,r={name:`unarchive-${n}`,args:{id:e}},o=a.allMutations().some(c=>c.name===r.name)&&a.permits(r,i).ok,l=[...a.log.all()].reverse().find(c=>!xt(c)&&c.mergedInto!==void 0&&c.writes.includes(e)),d=l?.mergedInto!==void 0?a.graph.getNode(l.mergedInto):void 0;return(0,y.jsxs)("section",{"data-testid":"record-archived",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,padding:"12px 16px",border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,y.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,y.jsx)("strong",{children:"Archived."})," Kept with its ties and history, and out of lists, counts and rules.",d?(0,y.jsxs)(y.Fragment,{children:[" ","Merged into ",(0,y.jsx)(I,{to:te(a.schema,d.kind,d.id),style:B,children:ge(a.schema.tryDefinition(d.kind),d)}),"."]}):null]}),o?(0,y.jsx)("button",{type:"button",style:Le,"data-testid":"bring-it-back",onClick:()=>a.apply(r,i?{author:i}:{}),children:"Bring it back"}):null]})}var x=H(Y(),1),So=(0,z.lazy)(()=>(__graviewPreload(import.meta.url,["./chunk.3NDH3EDN.js","./chunk.63GXY2ME.js","./chunk.UGFDSE37.js","./chunk.67TPUXAY.js","./chunk.Y6ZNFQK3.js","./chunk.NRAYZY3X.js","./chunk.RIJUCHP4.js","./chunk.TAQ764IQ.js","./chunk.YIR7PPF3.js","./chunk.3HXN4BOY.js","./chunk.GYICGZMG.js","./chunk.UHUGOTUU.js","./chunk.47STJVRV.js","./chunk.EBGAYL32.js","./chunk.DAZ2VSRD.js","./chunk.J25KOSNW.js","./chunk.LR3VDXPI.js","./chunk.CWHRDBOF.js","./chunk.3K6YSVHC.js","./chunk.SHTJZ6UX.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.ULRW47RP.js","./chunk.PBSMLINK.js","./chunk.3TY5NFLY.js","./chunk.D75KC3LL.js","./chunk.FWTIUYXH.js","./chunk.MAF7C3VM.js","./chunk.GZHZLJBF.js","./chunk.XMC7YDWT.js","./chunk.6UGEYZAC.js","./chunk.OJGHDWI6.js","./chunk.B2GLDIAS.js","./chunk.6YCBYL2Y.js","./chunk.UGFJKSHU.js","./chunk.JOOQUWLT.js","./chunk.6QWV5MVH.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.BHXGM3PV.js")).then(t=>({default:t.DraftPage}))),xo={kind:"human"};function Po({list:t,store:e}){let n=new Set(t.members.map(o=>o.kind)),a=t.total-t.members.length,i=n.size===1?[...n][0]:void 0;if(!i)return(0,x.jsx)("p",{className:"graview-spec-text graview-spec-more",children:`and ${a} more`});let r=tt(e.schema,i).toLowerCase();return(0,x.jsx)("p",{className:"graview-spec-text graview-spec-more",children:(0,x.jsx)(I,{to:`/${Q(e.schema,i)}`,className:"graview-spec-link graview-spec-see-all","data-testid":"see-all",children:t.total===e.graph.nodesOfKind(i).length?`See all ${ct(t.total)} ${r}`:`${ct(a)} more \xB7 all ${r}`})})}function Ao({context:t,children:e}){let n=Ie(),a=t.store.schema,i=(0,z.useMemo)(()=>({href:r=>te(a,r.kind,r.id),go:r=>n(te(a,r.kind,r.id)),more:r=>(0,x.jsx)(Po,{list:r,store:t.store})}),[a,n,t.store]);return(0,x.jsx)(Et.Provider,{value:i,children:(0,x.jsx)(Lr.Provider,{value:(t.titleLevel??(t.framed&&!t.barAbove?1:2))-1,children:e})})}function Co({steering:t}){let e=ke(),n=Ie(),a=`${e.pathname}${e.search}`;return(0,z.useLayoutEffect)(()=>t.at(a),[a,t]),(0,z.useLayoutEffect)(()=>{let i=o=>{o!==a&&n(o)};t.go.current=i;let r=t.pending?.current;return r!==void 0&&(t.pending.current=void 0,i(r)),()=>{t.go.current===i&&(t.go.current=void 0)}},[a,n,t]),null}function Ro({context:t,to:e}){let{pathname:n}=ke(),a=ye(),i=(e??a)?.sayWhere,r=Lo(t,n);return(0,z.useEffect)(()=>(i?.(r),()=>i?.(null)),[i,r]),null}function Lo(t,e){let[n="",a,i]=e.split("/").filter(Boolean).map(o=>{try{return decodeURIComponent(o)}catch{return o}});if(i!==void 0)return"#";if(n==="places"&&a!==void 0){if(a===dn)return"#overview=1";let o=t.views?.places().find(l=>l.as===a);return o?`#focus=${encodeURIComponent(Ne(o.kind))}&view=${encodeURIComponent(o.as)}`:"#"}let r=Re(t.store.schema,n);return r?`#focus=${encodeURIComponent(a??Ne(r))}`:"#"}function To({onNavigate:t,path:e}){let n=ke(),a=bn(),i=Ie(),r=n.hash&&!n.hash.includes("=")?n.hash:"",o=`${n.pathname}${n.search}${r}`,l=(0,z.useRef)(t);l.current=t;let d=(0,z.useRef)(null);(0,z.useEffect)(()=>{let p=d.current;d.current=o,p!==null&&(o===p&&a!=="PUSH"||l.current?.(o,a==="POP"?"pop":a==="REPLACE"?"replace":"push"))},[n.key]);let c=(0,z.useRef)(e);return(0,z.useEffect)(()=>{e===void 0||e===c.current||(c.current=e,e!==o&&i(e))},[e]),null}function vi({context:t,registry:e,page:n}){let a=qe(),i=Re(t.store.schema,a.slug??""),r=n==="list"?Dn:Kn,l=(i?e?.lookup(i,n):void 0)??r;return(0,x.jsx)(l,{context:t})}function Mo({context:t,registry:e,children:n}){let a=(0,z.useRef)(null);return Ma(a),(0,x.jsx)("div",{ref:a,"data-graview-face":"pages",style:{display:"contents"},children:(0,x.jsx)(si,{context:t,registry:e,root:a,children:(0,x.jsx)(li,{context:t,root:a,children:n})})})}function No(t){return t instanceof HTMLElement?t.isContentEditable||t.tagName==="TEXTAREA"||t.tagName==="SELECT"?!0:t.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(t.type):!1}function Eo(){let{pathname:t}=ke(),e=bn(),n=(0,z.useRef)(null);(0,z.useLayoutEffect)(()=>{if(e!=="POP"){for(let r=n.current?.parentElement;r;r=r.parentElement){let{overflowY:o}=getComputedStyle(r);if((o==="auto"||o==="scroll")&&r.scrollHeight>r.clientHeight){r.scrollTop=0;return}}window.scrollTo(0,0)}},[t]);let a=(0,z.useRef)(t),i=(0,z.useRef)(!1);return(0,z.useEffect)(()=>{if(!i.current&&t===a.current)return;i.current=!0;let r=document.activeElement;if(No(r))return;let o=n.current?.closest("main")??document.querySelector("main"),d=n.current?.closest("[data-graview-face]")?.querySelector("[data-graview-page-title]")??o?.querySelector("h1, h2")??null??o??null;d&&(d.hasAttribute("tabindex")||d.setAttribute("tabindex","-1"),d.focus({preventScroll:!0}))},[t]),(0,x.jsx)("span",{ref:n,hidden:!0,"data-graview-scroll-reset":""})}function $o({context:t,children:e}){let n=Ie(),a=(0,z.useMemo)(()=>({record:(i,r)=>{let o=t.store.graph.getNode(i);o&&n(mt(te(t.store.schema,o.kind,i),{section:r?.section}))},place:(i,r)=>{let o=t.views?.places().find(l=>l.as===i);o&&n(mt(be(t,o),r))},list:(i,r)=>{t.store.schema.tryDefinition(i)&&n(mt(`/${Q(t.store.schema,i)}`,r))},draft:()=>n("/~draft")}),[t,n]);return(0,x.jsx)(La.Provider,{value:a,children:e})}function Oo(){let{pathname:t,search:e,hash:n}=ke();return(0,z.useEffect)(()=>{let a=decodeURIComponent(n.replace(/^#/,""));if(!(!a||a.includes("=")))return ai(a)},[t,e,n]),null}function Fo({context:t,Home:e}){let n=ke(),a=t.views,i=n.key==="default"&&!(a&&Ca(a));(0,z.useEffect)(()=>{a&&Ra(a)},[a]);let r=i?ha(t.views?.arrangement?.()?.first,t.store.schema,t.views?.places()??[]):void 0,o=r?.to==="place"?be(t,r.place):r?.to==="kind"?`/${Q(t.store.schema,r.kind)}`:void 0;return o?(0,x.jsx)(Sn,{to:o,replace:!0}):(0,x.jsx)(e,{context:t})}function ki({context:t,registry:e}){let n=e?.lookupSurface("shell"),a=n!==void 0,i=a&&(e?.without().has("bar")??!1),r=a&&!i&&!t.embedded?{...t,barAbove:!0}:t,o=k=>n===void 0?(0,x.jsx)(Wt,{context:t,children:k}):i?(0,x.jsx)(n,{context:t,children:k}):(0,x.jsx)(Wt,{context:t,children:(0,x.jsx)(n,{context:r,children:k})}),l=e?.lookupSurface("home")??Fn,d=e?.lookupSurface("problems")??Wn,c=a?{...r,framed:!0}:t,[p,g]=(0,z.useState)(null),f=(0,z.useMemo)(()=>({onFind:g,find:!(e?.without().has("find")??!1),places:!(e?.without().has("places")??!1)}),[e]),u=(0,x.jsx)(Mo,{context:t,registry:e,children:(0,x.jsx)($o,{context:t,children:o((0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(ja,{face:"pages"}),(0,x.jsxs)(Ao,{context:c,children:[(0,x.jsx)(Eo,{}),(0,x.jsx)(Oo,{}),(0,x.jsxs)(zr,{children:[(e?.routes()??[]).map(({path:k,component:q})=>(0,x.jsx)(Pe,{path:k,element:(0,x.jsx)(q,{context:c})},k)),(0,x.jsx)(Pe,{path:"/",element:(0,x.jsx)(Fo,{context:c,Home:l})}),(0,x.jsx)(Pe,{path:"/problems",element:(0,x.jsx)(d,{context:c})}),(0,x.jsx)(Pe,{path:"/~draft",element:(0,x.jsx)(z.Suspense,{fallback:null,children:(0,x.jsx)(So,{context:c})})}),(0,x.jsx)(Pe,{path:"/search",element:(0,x.jsx)(In,{context:c})}),(0,x.jsx)(Pe,{path:"/map",element:(0,x.jsx)(On,{context:c})}),(0,x.jsx)(Pe,{path:"/places",element:(0,x.jsx)(Nn,{context:c})}),Ae(c).some(k=>k.as===dn)?null:(0,x.jsx)(Pe,{path:ya,element:(0,x.jsx)(Sn,{to:"/",replace:!0})}),(0,x.jsx)(Pe,{path:"/places/:as",element:(0,x.jsx)(En,{context:c})}),(0,x.jsx)(Pe,{path:"/:slug",element:(0,x.jsx)(vi,{context:c,registry:e,page:"list"})}),(0,x.jsx)(Pe,{path:"/:slug/:id",element:(0,x.jsx)(vi,{context:c,registry:e,page:"record"})})]})]})]}))})});return t.embedded||!a||i?u:(0,x.jsx)(Qr.Provider,{value:f,children:(0,x.jsx)(cr.Provider,{value:p,children:u})})}var Io=()=>typeof document>"u"?null:document.body;function Do({context:t,registry:e,basename:n,initialPath:a,onNavigate:i,path:r,steering:o,firstLook:l}){let[d,c]=(0,z.useState)(void 0),p=d!==void 0&&d.from===t.principal?{...t,principal:d.seat}:t;(0,z.useState)(()=>p.views?Mr(p.views,p.store.schema,fn(p.brand,p.store.schema)):void 0);let g=ye();aa({reader:p.locale??g?.locale,app:p.brand?.locale??p.app?.brand?.locale});let f=p.principal??xo,u=Sa(p.store,f,p.history),q=(u.past&&u.live===p.store?u.past.store:p.store).seenBy(f),v=q===p.store?p:{...p,store:q};xa(p.store,p.principal);let C=(0,x.jsxs)(x.Fragment,{children:[i||r!==void 0?(0,x.jsx)(To,{onNavigate:i,path:r}):null,o?(0,x.jsx)(Co,{steering:o}):null,v.presence||g?(0,x.jsx)(Ro,{context:v,to:g}):null,(0,x.jsx)(ki,{context:v,...e?{registry:e}:{}}),l?(0,x.jsx)(Nr,{firstLook:l,root:Io,app:fn(p.brand,p.store.schema)}):null]}),G=v.views?(0,x.jsxs)(Pa,{store:v.store,views:v.views,...v.principal?{principal:v.principal}:{},...v.brand?{brand:v.brand}:{},...v.locale?{locale:v.locale}:{},...v.settings?{settings:v.settings}:{},...v.presence&&!g?{presence:v.presence}:{},...v.people?{people:v.people}:{},...v.seats?{seats:v.seats}:{},onSeat:X=>g?g.takeSeat(X):c({from:t.principal,seat:X}),...v.onKeepLens?{onKeepLens:v.onKeepLens}:{},...v.ai?{ai:v.ai}:{},...v.subscriptions?{subscriptions:v.subscriptions}:{},resolveApp:v.resolveApp??g?.resolveApp,linkedRecords:v.linkedRecords??g?.linkedRecords,...v.app?{app:v.app}:{},...v.menuSections?{menuSections:v.menuSections}:{},children:[C,(0,x.jsx)(ri,{context:v})]}):C,L=(0,x.jsx)(ba.Provider,{value:u,children:G}),U=v.files?(0,x.jsx)(ka.Provider,{value:v.files,children:L}):L;if(a!==void 0){let X=n===void 0?a:`${n.replace(/\/$/,"")}${a}`;return(0,x.jsx)(jr,{initialEntries:[X],...n===void 0?{}:{basename:n},children:U})}return(0,x.jsx)(_r,{...n===void 0?{}:{basename:n},children:U})}export{Wi as a,Do as b};
@@ -1,6 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{F as H,Q as k,a as C,xa as K}from"./chunk.6QWV5MVH.js";import{b as m}from"./chunk.AJZBJBMO.js";var n=m(H(),1),N=450,_=10,O=t=>t instanceof HTMLInputElement?t.dataset.graviewChooseBox??void 0:void 0,G={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:-1/0,End:1/0},T=t=>t instanceof Element?t.closest("[data-graview-choose]"):null,U=t=>t instanceof HTMLElement&&(t.isContentEditable||t instanceof HTMLInputElement&&t.type!=="checkbox"||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement);function $(t){let[i,g]=(0,n.useState)(()=>new Set),l=(0,n.useRef)(null),b=(0,n.useRef)(null),[x,P]=(0,n.useState)(null),R=x!==null&&t.includes(x)?x:t[0],S=(0,n.useMemo)(()=>t.filter(e=>i.has(e)),[t,i]),E=(0,n.useMemo)(()=>new Set(t),[t]);(0,n.useEffect)(()=>{[...i].some(e=>!E.has(e))&&g(e=>new Set([...e].filter(o=>E.has(o))))},[E,i]);let u=(0,n.useCallback)((e,o=!1)=>{let r=l.current;g(s=>{let a=new Set(s),f=r===null?-1:t.indexOf(r),y=t.indexOf(e);if(o&&f>=0&&y>=0){let v=s.has(r);for(let p of t.slice(Math.min(f,y),Math.max(f,y)+1))v?a.add(p):a.delete(p)}else a.has(e)?a.delete(e):a.add(e);return a}),l.current=e},[t]),L=(0,n.useCallback)(e=>g(new Set(e)),[]),A=(0,n.useCallback)(()=>{l.current=null,g(new Set)},[]),c=(0,n.useRef)(null),h=(0,n.useRef)(!1),M=S.length>0,d=()=>{c.current&&clearTimeout(c.current.timer),c.current=null};(0,n.useEffect)(()=>d,[]);let B={ref:b,onKeyDown:e=>{if(U(e.target))return;let o=O(e.target),r=G[e.key];if(o!==void 0&&r!==void 0&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let s=t.indexOf(o),a=t[Math.max(0,Math.min(t.length-1,s+(Number.isFinite(r)?r:r>0?t.length:-t.length)))];if(e.preventDefault(),e.stopPropagation(),a===void 0||a===o)return;if(e.shiftKey){let f=l.current!==null&&t.includes(l.current)?l.current:o,[y,v]=[t.indexOf(f),t.indexOf(a)].sort((p,F)=>p-F);g(p=>new Set([...p,...t.slice(y,v+1)])),l.current=f}P(a),b.current?.querySelector(`[data-graview-choose-box="${CSS.escape(a)}"]`)?.focus();return}if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="a"){e.preventDefault(),e.stopPropagation(),L(t);return}if(e.key===" "&&!e.metaKey&&!e.ctrlKey){let s=T(e.target),a=e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement&&e.target.type==="checkbox";if(!s||a)return;e.preventDefault(),u(s.dataset.graviewChoose,e.shiftKey)}},onFocus:e=>{let o=O(e.target);o!==void 0&&P(o)},onPointerDown:e=>{if(h.current=!1,e.pointerType==="mouse"||e.button>0)return;let o=T(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox")return;let r=o.dataset.graviewChoose;d(),c.current={id:r,x:e.clientX,y:e.clientY,timer:setTimeout(()=>{c.current=null,h.current=!0,u(r)},N)}},onPointerMove:e=>{let o=c.current;o&&Math.hypot(e.clientX-o.x,e.clientY-o.y)>_&&d()},onPointerUp:d,onPointerCancel:d,onClickCapture:e=>{let o=T(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox"&&e.target.hasAttribute("data-graview-choose-box"))return;if(h.current){h.current=!1,e.preventDefault(),e.stopPropagation();return}let s=o.dataset.graviewChoose;if(e.shiftKey&&(M||l.current!==null)){e.preventDefault(),e.stopPropagation(),u(s,!0);return}M&&matchMedia?.("(pointer: coarse)").matches&&(e.preventDefault(),e.stopPropagation(),u(s))},onContextMenu:e=>{(h.current||c.current)&&(e.preventDefault(),e.stopPropagation())},...M?{"data-graview-choosing":""}:{}},j=(0,n.useCallback)(e=>i.has(e),[i]);return{chosen:S,has:j,toggle:u,choose:L,clear:A,listProps:B,boxProps:(e,o)=>({type:"checkbox",className:"graview-choose-box","data-graview-choose-box":e,"aria-label":`Choose ${o}`,tabIndex:e===R?0:-1,checked:i.has(e),onChange:()=>{},onClick:r=>{r.stopPropagation(),u(e,r.shiftKey)}}),list:b}}var q=`
2
- .graview-choose-box{width:24px;height:24px;margin:0;accent-color:var(--graview-accent);cursor:pointer;opacity:0}
3
- [data-graview-choose]:hover .graview-choose-box,[data-graview-choose]:focus-within .graview-choose-box,.graview-choose-box:focus-visible,.graview-choose-box:checked,[data-graview-choosing] .graview-choose-box{opacity:1}
4
- [data-graview-choose]{-webkit-touch-callout:none}
5
- [data-graview-choosing] [data-graview-choose]{-webkit-user-select:none;user-select:none}
6
- `;var I=m(H(),1),w=m(k(),1),D=K(C(()=>(__graviewPreload(import.meta.url,["./chunk.3AGY4QVS.js","./chunk.SYAEBGDC.js","./chunk.UZGRRDHD.js","./chunk.XANVHJQ4.js","./chunk.EJPI3ST6.js","./chunk.SHTJZ6UX.js","./chunk.UT6642FC.js","./chunk.MB7LKKUD.js","./chunk.ULRW47RP.js","./chunk.PBSMLINK.js","./chunk.3TY5NFLY.js","./chunk.D75KC3LL.js","./chunk.FWTIUYXH.js","./chunk.MAF7C3VM.js","./chunk.B2GLDIAS.js","./chunk.6YCBYL2Y.js","./chunk.UGFJKSHU.js","./chunk.JOOQUWLT.js","./chunk.6QWV5MVH.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.ASCLIM2P.js")))),X=D.part((t,i)=>(0,w.jsx)(t.SeveralBar,{...i}),{what:"The selection bar"});function Q(t){return t.chosen.length===0?null:(0,w.jsx)(I.Suspense,{fallback:null,children:(0,w.jsx)(X,{...t})})}var W=()=>D.prefetch();export{$ as a,q as b,Q as c,W as d};