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
@@ -0,0 +1,117 @@
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 zr,B as Se,C as Pn,D as Fe,E as qe,F as _r,G as An,H as Ce,I as Yr,J as Qr,K as F,L as ot,M as Cn,N as Xr,O as Rn,P as Ht,Q as Jr,R as ie,S as le,T as Ln,a as J,b as Te,c as te,d as Br,e as Sn,f as xn,g as it,h as ne,i as we,j as se,k as A,l as re,m as q,n as ke,o as Ft,p as be,q as ye,r as Vr,s as gt,t as Dt,u as ee,v as Ke,w as Ur,x as Wt,y as Ae,z as jr}from"./chunk.OZ5KJLA2.js";import{b as Gr,c as It,e as ae}from"./chunk.5MCC54VM.js";import{a as Hr,d as Kr,e as qr}from"./chunk.UGFDSE37.js";import{a as Or,c as Ir,f as Fr,g as Dr,i as Wr}from"./chunk.3QXHII5W.js";import{a as Ar,b as Cr,c as Rr,d as bn}from"./chunk.AINNENYD.js";import{a as Lr,b as Tr,d as $t,e as Mr,f as Nr,i as Ot}from"./chunk.SBBNIYVB.js";import{a as Et,b as kn,c as Sr,e as xr}from"./chunk.GCVO6N26.js";import{m as Pr}from"./chunk.H243UV3Z.js";import{a as dr,b as cr,c as pr,e as br,f as vn,h as Nt}from"./chunk.5EAQDBBE.js";import{d as mr,e as fr,f as yr,g as hr,n as wr,o as vr,q as kr,s as Mt}from"./chunk.YT2CYCVT.js";import{a as hn}from"./chunk.QVKKXMNK.js";import{a as Tt,b as ir,c as or,d as sr,e as lr}from"./chunk.ZE4CTZQ3.js";import{a as Ct,b as Ia,c as Fa,d as Rt,e as Da}from"./chunk.KWCML3BF.js";import{b as _a,c as ar,e as rr,f as yn}from"./chunk.DLT3EE4D.js";import{a as Ve,b as Ja,c as Za,d as er,e as tr,f as nr}from"./chunk.AEHPDVLQ.js";import{a as mn,b as ja,c as za}from"./chunk.UT6642FC.js";import{b as Ya,c as Qa,i as ut}from"./chunk.52QAIGCD.js";import{r as fn,s as Xa}from"./chunk.QRMWFEEH.js";import{f as qa,g as rt,i as Ba,j as Ga,k as gn,q as Va,r as Ua}from"./chunk.Z7ZCR4LN.js";import{b as Lt,c as Wa,d as Ha,e as Ka}from"./chunk.RIW7SQH4.js";import{C as wn,K as Er,N as $r,e as $a,f as Oa,j as Di,q as ur,r as gr}from"./chunk.Y5Z4ZDTO.js";import{F as $e,K as Sa,M as xa,P as Pa,Q as Y,T as Aa,U as Ca,Y as Ra,Z as ue,a as ka,aa as La,ba as Ta,da as Ma,ha as at,ia as Na,ra as Ea,s as ba,w as Ee}from"./chunk.UWIYKGYK.js";import{Ec as ya,Fc as ha,Gb as ua,Hc as At,I as ra,Jb as ga,Kb as ma,Ma as da,N as pt,Oa as ca,Pc as un,Qc as wa,Uc as va,W as tt,X as fe,Ya as cn,Z as ve,Za as pa,_ as xt,aa as nt,ca as ia,da as oa,ea as He,ec as fa,fb as Pt,la as sa,ma as la,zc as pn}from"./chunk.X7W27IRI.js";import{b as H}from"./chunk.AJZBJBMO.js";function Zr(t,e,n={}){let a=t.graph.getNode(e);if(!a)return;let i=t.schema.tryDefinition(a.kind),r=l=>fe(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 m=(d==="out"?i:t.schema.tryDefinition(p.kind))?.edges?.[l.kind],u=d==="in"?m?.inverse??m?.description:m?.description,k=`${l.kind}|${d}|${u??""}`;(o.get(k)??(()=>{let w={edgeKind:l.kind,direction:d,...u?{description:u}:{},targets:[]};return o.set(k,w),w})()).targets.push({id:p.id,kind:p.kind,label:r(p)})}return{id:e,kind:a.kind,label:r(a),fields:Ha(ut(t.schema,t.graph,a),i),violations:cn(t.violations(n.context),[e]),actions:hn(t,[e],{focus:e,...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}}),links:[...o.values()].map(l=>{let d=Lt(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:hn(t,[],{kindSelection:[e],...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}})}}function ei(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:nt(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($e(),1);var ze=H($e(),1),S=H(Y(),1),Wi=`
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 Hi({title:t,name:e,optional:n,amount:a,value:i,onChange:r}){let o=Ba(a),[l,d]=(0,ze.useState)(()=>typeof i=="number"?Ga(i,a):""),c=l.trim()!==""&&gn(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(gn(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 ti({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 Ki=t=>({label:ve(t),option:e=>e}),qi={phone:"+1 555 123 4567",place:"An address or a place's name",duration:"1h 30m, 90 or 1:30"};function Kt({store:t,spec:e,value:n,onChange:a,prefilled:i,open:r,words:o=Ki,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=>ve(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)(nr,{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:qi[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)(Hi,{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)(ti,{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(w=>w.name===e.name)?.candidates,m=new Set(Object.values(i).filter(w=>typeof w=="string")),u=(e.kinds.includes("*")?[...t.graph.allNodes()]:e.kinds.flatMap(w=>t.graph.nodesOfKind(w))).filter(w=>!m.has(w.id)),k=g?g.map(w=>t.graph.getNode(w)).filter(w=>w!==void 0):u,V=Lt(k,w=>t.schema.tryDefinition(w));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)(ti,{children:(0,S.jsxs)("select",{name:e.name,required:!e.optional,value:typeof n=="string"?n:"",onChange:w=>a(w.target.value||void 0),"data-graview-part":"control",children:[(0,S.jsx)("option",{value:"",children:"\u2014"}),k.map(w=>{let C=V.get(w.id);return(0,S.jsxs)("option",{value:w.id,children:[fe(t.schema.tryDefinition(w.kind),w),C?` \xB7 ${C}`:""]},w.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(m=>(0,S.jsx)(Kt,{store:t,spec:m,value:g[m.name],onChange:u=>a({...g,[m.name]:u}),prefilled:i,open:r,words:o},m.name))]})}case"variant":{let g=n??{},m=typeof g[e.tag]=="string"?g[e.tag]:"",u=e.options.find(k=>k.value===m);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:ve(e.tag)}),(0,S.jsxs)("select",{value:m,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:ve(k.value)},k.value))]})]}),u?.fields.map(k=>(0,S.jsx)(Kt,{store:t,spec:k,value:g[k.name],onChange:V=>a({...g,[k.name]:V}),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 m=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}),m.map((u,k)=>(0,S.jsxs)("div",{"data-graview-part":"item",children:[(0,S.jsx)("div",{style:{flex:1},children:(0,S.jsx)(Kt,{store:t,spec:{...e.item,optional:!1},value:u,onChange:V=>a(m.map((w,C)=>C===k?V:w)),prefilled:i,open:r,words:o})}),(0,S.jsx)("button",{type:"button","data-graview-part":"remove",onClick:()=>a(m.filter((V,w)=>w!==k)),children:"remove"})]},k)),(0,S.jsx)("button",{type:"button","data-graview-part":"add",onClick:()=>a([...m,void 0]),children:"add another"})]})}case"linked":return(0,S.jsx)("div",{"data-graview-part":"field","data-graview-field":"linked",children:(0,S.jsx)(Za,{relation:e.relation,value:n,onChange:a,label:d})});case"repeat":return(0,S.jsx)(er,{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",ve(e.name),"\u201D needs a structured answer this form cannot ask for yet."]})}}function Oe({store:t,mutation:e,prefilled:n={},open:a=[],onDone:i,principal:r,initial:o,label:l,only:d}){let c=()=>or(e,t.graph,n),[p,g]=(0,ze.useState)(c),[m,u]=(0,ze.useState)(()=>({...p,...o})),[k,V]=(0,ze.useState)(null),w=r??t.seenFor,C=e.subject&&n[e.subject.arg],U=w?lr(t,w,e,typeof C=="string"?C:void 0):void 0,R=Tt(e.input).filter(D=>(d===void 0||d.includes(D.name))&&!U?.has(D.name)),j=D=>qa(t.schema,e,D),Q=Ua(R.filter(D=>D.control==="date").map(D=>D.name)),de=(0,ze.useRef)(void 0),me=(D,X)=>u(ce=>{let b={...ce,[D.name]:X};if(Q&&D.name===Q.start&&D.control==="date"){let x=M=>typeof M=="string"&&M!==""?M:void 0,L=x(ce[Q.start])??de.current;if(x(X)){de.current=x(X);let M=Va(L,x(X),x(ce[Q.end]),{time:D.time===!0,instant:D.instant===!0});M!==void 0&&(b[Q.end]=M)}}return b});return(0,S.jsxs)("form",{"data-testid":`form-${e.name}`,onSubmit:D=>{D.preventDefault();try{t.apply({name:e.name,args:{...sr(ir(R,m),p),...n}},r?{author:r}:{}),V(null);let X=c();g(X),u({...X}),i?.()}catch(X){V(rt(t.schema,t.allMutations(),X))}},"data-graview-part":"form",children:[(0,S.jsx)("style",{children:Wi}),R.map(D=>(0,S.jsx)(Kt,{store:t,spec:D,value:m[D.name],values:m,onChange:X=>me(D,X),prefilled:n,open:a,words:j},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 T=H(Y(),1);function Re(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 qt(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 xe(t,e){return Br(e.as,ya(e,t.views?.places()??[])?J(t.store.schema,e.kind):void 0)}function mt(t,e){let n=t.schema.tryDefinition(e);return t.graph.nodesOfKind(e).filter(a=>tt(n,a))}function Tn(t,e,n){let a=(r,o)=>xt(t.schema,o,r),i=(typeof e=="string"?[e]:e).map(r=>a(mt(t,r).length,r)).join(" and ");return n?`${i} across ${a(mt(t,n).length,n)}`:i}function Mn({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(m=>m.nodeIds))],p=qt(t,e).flatMap(m=>mt(i,m));if(!d)return null;let g=Bi(i,p,a,c);return(0,T.jsx)(fn,{kind:e.kind,view:e.title,children:(0,T.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 Bi(t,e,n,a){let i=n?At({filter:n}).filter??[]:[];return i.length===0?e:Nt(e,{filter:i},{schema:t.schema,graph:t.graph,flagged:new Set(a)}).nodes}function Gi({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,T.jsx)(Mn,{context:i,place:r}):null}function Vi({context:t,kind:e}){let{store:n,views:a,invariantContext:i}=t,r=mt(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&&!at(c))return(0,T.jsx)(fn,{kind:e,children:(0,T.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,m=8,u=r.slice(0,m);return(0,T.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,T.jsx)(g,{node:k,fidelity:"summary",cardinality:"one",mode:"fullscreen",selected:!1,...p.includes(k.id)?{flagged:[k.id]}:{}},k.id):(0,T.jsx)("span",{style:{padding:"8px 14px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:fe(o,k)},k.id)),r.length>m?(0,T.jsxs)("span",{style:{...A,alignSelf:"center",padding:"0 6px"},children:["+",r.length-m," more ",l.toLowerCase()]}):null]})}function Nn(t){let{store:e}=t,n=Ur(t),a=Re(t),i=pn([...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:ha(o,a,e.schema),to:xe(t,o),place:o})),...Wt(t).filter(o=>!r.has(o)).map(o=>({key:`kind:${o}`,kind:o,title:ee(e,o),to:`/${J(e.schema,o)}`}))]}var ni=.72,Ui=540,ai=16/10;function ji(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 zi(t){for(let e=t.parentElement;e;e=e.parentElement)if(/(auto|scroll)/.test(getComputedStyle(e).overflowY))return e;return null}function _i(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:zi(a),rootMargin:"50% 0px"});return i.observe(a),()=>i.disconnect()},[e,t]),e}function En({context:t,entry:e}){let{store:n,brand:a,principal:i}=t,{ref:r,width:o}=ji(Ui),l=_i(r),d=o/ni,c=mt(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,m=e.place!==void 0;return(0,T.jsxs)(F,{to:e.to,"data-testid":m?"place-card":"kind-card",className:"graview-gallery-card",style:{...ke,display:"grid",gap:10,alignContent:"start",minWidth:0},children:[(0,T.jsxs)("span",{ref:r,"data-testid":m?"place-picture":"kind-picture","aria-hidden":"true",inert:!0,style:{display:"block",position:"relative",width:"100%",aspectRatio:`${ai}`,overflow:"hidden",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",pointerEvents:"none"},children:[(0,T.jsx)("span",{style:{position:"absolute",left:0,top:0,width:d,height:d/ai,display:"grid",gridTemplateRows:"minmax(0, 1fr)",transform:`scale(${ni})`,transformOrigin:"0 0"},children:l?(0,T.jsx)($t.Provider,{value:null,children:e.place?(0,T.jsx)(Mn,{context:t,place:e.place}):(0,T.jsx)(Vi,{context:t,kind:e.kind})}):null}),c.length===0?(0,T.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,T.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,T.jsxs)("span",{style:{fontFamily:xn,fontWeight:"var(--graview-weight-display)"},children:["No ",ee(n,e.kind).toLowerCase()," yet"]}),g?(0,T.jsxs)("span",{style:A,children:["Begin with \u201C",g.label,"\u201D"]}):null]})}):null]}),(0,T.jsxs)("span",{style:{display:"grid",gap:2,minWidth:0},children:[(0,T.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[m?null:(0,T.jsx)(ye,{kind:e.kind,brand:a,schema:n.schema,size:8}),(0,T.jsx)("span",{style:{fontFamily:xn,fontSize:"var(--graview-text-heading)",fontWeight:"var(--graview-weight-display)",lineHeight:1.3,overflowWrap:"anywhere",textWrap:"balance"},children:e.title})]}),(0,T.jsxs)("span",{style:A,children:[e.place?Tn(n,qt(t,e.place),e.place.across):Tn(n,e.kind),!m&&p?.description?` \xB7 ${p.description}`:null]})]})]})}var ri={display:"grid",gap:"32px 28px",gridTemplateColumns:"repeat(auto-fill, minmax(min(420px, 100%), 1fr))"},Yi=`
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 $n({context:t}){ae(t.store);let e=Nn(t);return e.length===0?null:(0,T.jsxs)("section",{style:ri,"data-testid":"gallery",children:[(0,T.jsx)("style",{children:Yi}),e.map(n=>(0,T.jsx)(En,{context:t,entry:n},n.key))]})}function On({context:t}){let{store:e}=t;ae(e);let n=pn(Re(t)).filter(i=>!i.hidden),a=Nn(t);return(0,T.jsxs)(ie,{context:t,style:it,children:[(0,T.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,T.jsx)("p",{style:we,children:n.length===0?"None of its own yet":`${n.length} ${n.length===1?"picture":"pictures"}`}),(0,T.jsx)(le,{context:t,children:"Pictures"}),(0,T.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,T.jsx)("div",{style:ri,"data-testid":"places",children:a.map(i=>(0,T.jsx)(En,{context:t,entry:i},i.key))}):null]})}function In({context:t}){let{store:e,principal:n}=t;ae(e);let a=qe(),i=Fe(),[r]=ot(),o=decodeURIComponent(a.as??""),[l,d]=(0,De.useState)(null),c=r.get("of"),p=r.get("filter"),m=Re(t).find(R=>R.as===o&&(!c||J(e.schema,R.kind)===c));if(!m)return(0,T.jsxs)(ie,{context:t,children:[(0,T.jsx)(le,{context:t,children:"No picture is called that."}),(0,T.jsx)("p",{style:se,children:(0,T.jsxs)(F,{to:"/places",style:q,children:["The pictures there are ",(0,T.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]})})]});let u=ee(e,m.kind),k=t.views?.resolve(m.kind,{cardinality:"many",fidelity:"full"},m.as)?.view,V=k?.flows===!0,w=k?.creates!==!1,C=Ue(e,m.kind,{...n?{principal:n}:{},...t.invariantContext?{context:t.invariantContext}:{}}),U=w?C.actions.affordances.map(R=>({affordance:R,mutation:e.allMutations().find(j=>j.name===R.mutation)})).filter(R=>R.mutation!==void 0):[];return(0,T.jsxs)(ie,{context:t,style:it,children:[(0,T.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,T.jsx)(le,{context:t,children:m.title}),(0,T.jsxs)("p",{style:se,"data-testid":"place-lede",children:[Tn(e,qt(t,m),m.across),"."]}),p&&!V?(0,T.jsxs)("p",{style:{...A,margin:0},"data-testid":"place-narrowed",children:[`Only those where ${p.split(",").map(R=>R.replace(":"," is ")).join(" and ")}. `,(0,T.jsx)(F,{to:`?${(()=>{let R=new URLSearchParams(r);return R.delete("filter"),R.toString()})()}`,style:{...q,...A},children:"Show all"})]}):null,(0,T.jsx)("p",{style:{...A,margin:0,display:"flex",flexWrap:"wrap",gap:"4px 16px"},children:qt(t,m).map((R,j)=>(0,T.jsxs)(F,{to:`/${J(e.schema,R)}`,style:{...q,...A},...j===0?{"data-testid":"place-as-list"}:{},children:["All ",(R===m.kind?u:ee(e,R)).toLowerCase()," as a list ",(0,T.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]},R))})]}),(0,T.jsx)("div",{"data-testid":"place-lens","data-flows":V?"":void 0,style:V?{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:R=>{let j=R.target?.closest("[data-graview-pick]"),Q=j?.getAttribute("data-graview-pick"),de=j?.getAttribute("data-graview-joins");if(de)try{let D=JSON.parse(de);if(Array.isArray(D)&&D.every(X=>typeof X=="string")){R.preventDefault(),d({at:_e(m),ids:D});return}}catch{}if(!Q)return;let me=e.graph.getNode(Q);me&&(R.preventDefault(),i(te(e.schema,me.kind,Q)))},children:(0,T.jsx)(Mn,{context:t,place:m,filter:p,...l?.at===_e(m)?{chosen:l.ids}:{}})}),U.length>0?(0,T.jsx)("div",{style:{maxWidth:760,display:"grid",gap:40},"data-testid":"place-creators",children:U.map(({affordance:R,mutation:j})=>(0,T.jsxs)("section",{style:{...re,display:"grid",gap:14},children:[(0,T.jsx)("h2",{style:ne,children:j.title??j.name}),j.description?(0,T.jsx)("p",{style:{...A,margin:0,maxWidth:"58ch"},children:j.description}):null,(0,T.jsx)(Oe,{store:e,mutation:j,prefilled:R.args,open:R.open,label:R.label,...n?{principal:n}:{}})]},R.id))}):null]})}function st(t){return t.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-|-$/g,"")}function ft(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?st(e.section):"";return`${n}${r?`?${r}`:""}${o?`#${o}`:""}`}function Qi(t,e=document){let n=st(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||st(o)===n)return r}for(let i of a)for(let r of i.querySelectorAll("h1, h2, h3, h4, h5, h6, [role=heading]"))if(st(r.textContent??"")===n)return r;return null}function ii(t,e={}){if(typeof document>"u"||typeof requestAnimationFrame>"u")return()=>{};let n=e.frames??120,a=0,i=()=>{let r=Qi(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($e(),1);var Bt=H($e(),1);var Ye=H(Y(),1);function oi({context:t}){return ue()?(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(Xi,{context:t}),(0,Ye.jsx)(Ir,{face:"pages",on:t.quickAsk??!0})]}):null}function Xi({context:t}){let{store:e}=t,n=ue(),{pathname:a}=Se(),i=(0,Bt.useRef)(n?.setSelection);return i.current=n?.setSelection,(0,Bt.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?[Ee(p.kind)]:[]}let c=o?Te(e.schema,o):void 0;return c&&l?[decodeURIComponent(l)]:c?[ba(c)]:[]})();r(c=>c.length===d.length&&c.every((p,g)=>p===d[g])?c:d)},[a]),null}var he=H($e(),1);var li=H(Di(),1);var ge=H(Y(),1);var Ji=(0,he.lazy)(ka(()=>(__graviewPreload(import.meta.url,["./chunk.5MCC54VM.js","./chunk.UGFDSE37.js","./chunk.3QXHII5W.js","./chunk.AINNENYD.js","./chunk.SBBNIYVB.js","./chunk.IX6RNGAT.js","./chunk.3H4NVUWV.js","./chunk.XSYBNUXF.js","./chunk.GCVO6N26.js","./chunk.LRRVBM4F.js","./chunk.H243UV3Z.js","./chunk.PKKA6JWA.js","./chunk.5EAQDBBE.js","./chunk.YT2CYCVT.js","./chunk.KWCML3BF.js","./chunk.DLT3EE4D.js","./chunk.2OBIO5Y6.js","./chunk.GF7LA4QG.js","./chunk.AEHPDVLQ.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.52QAIGCD.js","./chunk.PPUAPAWR.js","./chunk.IHFNLKXV.js","./chunk.577PGFUT.js","./chunk.FBY5IUGU.js","./chunk.4K5QCJFH.js","./chunk.GZHZLJBF.js","./chunk.QRMWFEEH.js","./chunk.MVN6H65Q.js","./chunk.OJGHDWI6.js","./chunk.Z7ZCR4LN.js","./chunk.RIW7SQH4.js","./chunk.FSAHO3LV.js","./chunk.Y5Z4ZDTO.js","./chunk.UWIYKGYK.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.5FZQI2US.js")).then(t=>({default:t.TakeBack}))));function Zi({context:t,docked:e,at:n}){let{store:a}=t,i=ae(a),[r]=(0,he.useState)(()=>a.batches().length),o=(0,he.useRef)(!1);return o.current||=i>0||!e&&r>0,o.current?(0,ge.jsx)(he.Suspense,{fallback:null,children:(0,ge.jsx)(Ji,{context:t,docked:e,at:n,since:r})}):null}function eo(t,e,n){let{store:a,principal:i,embedded:r}=t;(0,he.useEffect)(()=>{if(!n)return;let o=l=>{if(!qr(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))&&Hr(a,i)){l.preventDefault();try{Kr(a,i)}catch{}}};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[a,i,r,e,n])}function di({context:t,registry:e,root:n,children:a}){let i=(0,he.useMemo)(Xr,[]),r=e?.without()??new Set;return eo(t,n,!r.has("undo")),(0,ge.jsxs)(Cn.Provider,{value:i,children:[(0,ge.jsx)(to,{context:t,placed:i,without:r}),a]})}function to({context:t,placed:e,without:n}){let[a,i]=(0,he.useState)(!1);(0,he.useLayoutEffect)(()=>i(!0),[]);let r=Rn(e,"find"),o=Rn(e,"undo"),l=Se(),d=gr();if(!a)return null;let c=l.pathname.split("/").filter(Boolean),g=(c.length===1?Te(t.store.schema,c[0]):void 0)!==void 0;return(0,ge.jsxs)(ge.Fragment,{children:[!r&&!n.has("find")&&d?(0,li.createPortal)((0,ge.jsx)(si,{context:t,narrowsLists:g}),d.slot):null,!r&&!n.has("find")&&!d?(0,ge.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,ge.jsx)(si,{context:t,narrowsLists:g})}):null,!o&&!n.has("undo")?(0,ge.jsx)(Zi,{context:t,docked:!0,at:l.pathname+l.search}):null,d?.own&&!n.has("undo")?(0,ge.jsx)(jr,{context:t,own:d.own}):null]})}function si({context:t,narrowsLists:e}){return(0,ge.jsx)(Cn.Provider,{value:null,children:(0,ge.jsx)(Ln,{context:t,narrowsLists:e})})}var oe=H($e(),1);var Pe=H(Y(),1),no=500,ao=10;function Gt(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 ro(t){let e=typeof getSelection=="function"?getSelection():null;return e!==null&&!e.isCollapsed&&e.containsNode(t,!0)}function ci(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 pi({context:t,root:e,children:n}){return ue()===null?(0,Pe.jsx)(Pe.Fragment,{children:n}):(0,Pe.jsx)(io,{context:t,root:e,children:n})}function io({context:t,root:e,children:n}){let{setMenuAt:a}=Ra(),{store:i}=t,r=i.schema,o=Fe(),{pathname:l,search:d}=Se(),c=zr("/").replace(/\/$/,""),p=(0,oe.useCallback)((b,x)=>t.views?.places().find(L=>L.as===b&&(x===null||L.kind===x)),[t.views]),g=(0,oe.useCallback)((b,x)=>{let[L="",M,E]=b.split("/").filter(Boolean).map(Z=>{try{return decodeURIComponent(Z)}catch{return Z}});if(E!==void 0)return null;if(L==="places"&&M!==void 0){let Z=p(M,new URLSearchParams(x).get("of"));return Z?{face:"pages",place:Z.as,about:[Ee(Z.kind)],title:Z.title}:null}let _=Te(r,L);return _?M===void 0?{face:"pages",about:[Ee(_)],title:nt(r,_)}:i.graph.getNode(M)?{face:"pages",on:M,about:[M]}:null:null},[r,i,p]),m=(0,oe.useCallback)(b=>{let x=b.href;try{let L=new URL(x,location.href);if(L.origin===location.origin&&(c===""||L.pathname===c||L.pathname.startsWith(`${c}/`))){let M=g(L.pathname.slice(c.length),L.search);if(M)return{...M,href:x}}}catch{}return{face:"pages",about:[],href:x}},[c,g]),u=(0,oe.useCallback)(()=>g(l,d)??{face:"pages",about:[]},[g,l,d]),k=(0,oe.useCallback)(b=>{let x=u(),L=b.closest("[data-graview-field]")?.getAttribute("data-graview-field");if(L&&x.on!==void 0&&b.closest("[data-graview-pick], a[href]")===null)return{...x,field:L};let M=b.closest("[data-graview-act]")?.getAttribute("data-graview-act");if(M)return{...x,act:M};let E=b.closest("[data-graview-pick]")?.getAttribute("data-graview-pick");if(E&&i.graph.getNode(E))return{face:"pages",on:E,about:[E],href:`${c}${te(r,i.graph.getNode(E).kind,E)}`};let _=b.closest("a[href]");if(_)return m(_);let Z=b.closest("[data-graview-record]")?.getAttribute("data-graview-record");return Z&&i.graph.getNode(Z)?{face:"pages",on:Z,about:[Z]}:x},[u,m,i,r,c]),V=(0,oe.useCallback)(b=>{let x=e.current;if(x===null||!x.contains(b)||Gt(b)||b.closest("[data-graview-popover]"))return null;let L=k(b);return{face:"pages",on:L.on,about:L.about??[],field:L.field,place:L.place,href:L.href,act:L.act,element:ci(b)}},[k,e]),w=(0,oe.useCallback)((b,x,L)=>{let M=k(b);a({...M,x:Math.round(x),y:Math.round(L),returnTo:ci(b)})},[k,a]),C=(0,oe.useCallback)(b=>{let x=b.getBoundingClientRect();w(b,x.left+Math.min(16,x.width/2),Math.min(x.bottom,x.top+36))},[w]),U=(0,oe.useRef)(0),R=(0,oe.useRef)(null),j=(0,oe.useRef)(!1),Q=()=>{R.current&&clearTimeout(R.current.timer),R.current=null};(0,oe.useEffect)(()=>Q,[]),(0,oe.useEffect)(()=>{let b=x=>{if(x.defaultPrevented||!(x.key==="ContextMenu"||x.key==="F10"&&x.shiftKey))return;let L=e.current,M=x.target instanceof Element?x.target:null,E=M===null||M===document.body||M===document.documentElement,_=L!==null&&M!==null&&L.contains(M);if(!_&&!(E&&document.querySelector("[data-graview-face='pages']")===L)||Gt(M)||M?.closest("[data-graview-popover]"))return;x.preventDefault(),U.current=Date.now();let Z=_&&M instanceof HTMLElement?M:L?.querySelector("[data-graview-page-title], main h1, main")??null;Z&&C(Z)};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,C]);let de=(0,oe.useMemo)(()=>b=>{if(b.face!=="pages")return null;let x=[],L=b.on===void 0?void 0:i.graph.getNode(b.on),M=b.place===void 0?void 0:t.views?.places().find(G=>G.as===b.place),E=L?void 0:b.about.length===1&&b.about[0].startsWith("aggregate:")&&!M?oo(b.about[0]):void 0,_=L?te(r,L.kind,L.id):M?xe(t,M):E?`/${J(r,E)}`:void 0,Z=_!==void 0&&l===_.split("?")[0];_!==void 0&&!Z&&x.push({id:"open",label:"Open",run:()=>o(_)});let f=_!==void 0?`${c}${_}`:b.href;f!==void 0&&x.push({id:"open-in-a-new-tab",label:"Open in a new tab",run:()=>void window.open(f,"_blank","noopener")});let N=L?`#focus=${encodeURIComponent(L.id)}`:M?`#focus=${encodeURIComponent(Ee(M.kind))}&view=${encodeURIComponent(M.as)}`:E?`#focus=${encodeURIComponent(Ee(E))}`:void 0;if(N!==void 0&&(t.overview||!t.embedded)){let G=t.overview;x.push({id:"in-the-scene",label:"Show in the scene",run:()=>G?G(N):location.assign(`${t.sceneHref??"/"}${N}`)})}return L===void 0&&b.href===void 0&&x.push({id:"find",label:"Find\u2026",run:()=>{let G=e.current?.querySelector('[data-testid="nav-find"]')??document.querySelector('[data-testid="nav-find"]');G&&G.offsetParent!==null?G.focus():o("/search")}}),x.length>0?{id:"pages",items:x}:null},[i,r,t,l,c,o,e]),me=(0,oe.useMemo)(()=>b=>{if(b.face!=="pages"||b.field===void 0||b.on===void 0)return null;let x=i.graph.getNode(b.on),L=b.element?.closest("[data-graview-field]")??e.current?.querySelector(`[data-graview-field="${CSS.escape(b.field)}"]`);return!x||!(L instanceof HTMLElement)||!L.hasAttribute("data-graview-editable")?null:{id:"field",at:"start",items:[{id:"change-field",label:`Change \u201C${ia(r.tryDefinition(x.kind),b.field)}\u201D`,run:()=>L.click()}]}},[i,r,e]),D=Dr(),X=ar(),ce=(0,oe.useMemo)(()=>[me,de,...X?[X]:[],...D?[D]:[]],[me,de,X,D]);return(0,Pe.jsxs)(Xa,{sections:ce,children:[(0,Pe.jsx)("div",{"data-graview-menu-ground":"",style:{display:"contents"},onContextMenu:b=>{let x=b.target;b.shiftKey||Gt(x)||ro(x)||(b.preventDefault(),!x.closest("[data-graview-popover]")&&(Date.now()-U.current<700||(b.clientX===0&&b.clientY===0&&x instanceof HTMLElement?C(x):w(x,b.clientX,b.clientY))))},onPointerDown:b=>{if(j.current=!1,b.pointerType==="mouse"||!b.isPrimary)return;let x=b.target;if(Gt(x)||x.closest("[data-graview-choose], [data-graview-popover]"))return;Q();let{clientX:L,clientY:M}=b;R.current={x:L,y:M,timer:setTimeout(()=>{R.current=null,j.current=!0,U.current=Date.now(),w(x,L,M)},no)}},onPointerMove:b=>{let x=R.current;x&&Math.hypot(b.clientX-x.x,b.clientY-x.y)>ao&&Q()},onPointerUp:Q,onPointerCancel:Q,onClickCapture:b=>{j.current&&(j.current=!1,b.preventDefault(),b.stopPropagation())},children:n}),(0,Pe.jsx)(so,{openAt:C,readyAt:V}),(0,Pe.jsx)(Wr,{placement:"page"}),(0,Pe.jsx)(rr,{})]})}function oo(t){let e=t.slice(10).split("+");return e.length===1&&e[0]?e[0]:void 0}function so({openAt:t,readyAt:e}){return(0,Pe.jsx)("span",{"data-graview-menu-home":"",tabIndex:-1,onFocus:n=>{if(n.target!==n.currentTarget)return;let a=n.currentTarget.closest("[data-graview-face]"),i=a?.querySelector("[data-graview-page-title]")??a?.querySelector("main h1, main")??null;i&&(i.hasAttribute("tabindex")||i.setAttribute("tabindex","-1"),i.focus({preventScroll:!0}))},style:{position:"absolute",width:0,height:0,overflow:"hidden"},children:(0,Pe.jsx)(Or,{placement:"menu",openActs:t,aimAt:e})})}var K=H(Y(),1);function ui(t,e){return e==="*"?{label:"anything",path:null}:{label:ee(t,e),path:`/${J(t.schema,e)}`}}function lo({context:t,relation:e}){let{store:n}=t,a=ui(n,e.from),i=ui(n,e.to),r=o=>o.path?(0,K.jsx)(F,{to:o.path,style:{...ke,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)(Fr,{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:[ve(e.edgeKind)," \u2192"]})," ",r(i)]}),e.description||e.inverse?(0,K.jsxs)("span",{style:A,children:[e.description?Ae(e.description):null,e.description&&e.inverse?" \xB7 ":null,e.inverse?`from the other end, ${e.inverse}`:null]}):null]}),i.path?(0,K.jsx)(F,{to:`${i.path}?with=${encodeURIComponent(e.edgeKind)}`,style:{...q,...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 gi({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)(F,{to:"/map",style:ke,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)(lo,{context:t,relation:r},`${r.edgeKind}|${r.from}|${r.to}`))})]})}function Fn({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:we,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)(ye,{kind:r.kind,brand:t.brand,schema:e.schema,size:7}),(0,K.jsx)(F,{to:`/${J(e.schema,r.kind)}`,style:q,children:r.plural}),(0,K.jsx)("span",{style:A,children:r.count})]},r.kind))}),(0,K.jsx)(gi,{context:t,heading:!1})]})}function mi({context:t}){let n=[...ue()?.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)(F,{to:te(a.schema,r.kind,r.id),style:{...q,...A},children:[fe(a.schema.tryDefinition(r.kind),r)," \u2192"]}):null]},i.participant)})})]})}var B=H(Y(),1);function Dn({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=Wt(t).map(C=>({kind:C,members:n.graph.nodesOfKind(C).filter(U=>tt(n.schema.tryDefinition(C),U))})),p=c.filter(C=>C.members.length>0),g=c.map(C=>({entry:C,creator:n.allMutations().find(U=>(U.creates??[]).includes(C.kind)&&n.permits({name:U.name,args:{}},t.principal).ok)})).find(C=>C.creator!==void 0),m=p.length===0?"Nothing here yet.":`${p.map(C=>xt(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,B.jsx)("p",{style:{...A,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,U=u[Symbol.for("graview.home-blocks")]===!0;return(0,B.jsx)(ie,{context:t,style:it,children:(0,B.jsxs)("div",{style:{display:"grid",gap:12},"data-testid":"home-view",children:[U?null:C,r.length>0?(0,B.jsx)(F,{to:"/problems",style:{...q,color:"var(--graview-warn)"},children:o}):null,(0,B.jsx)(Nr.Provider,{value:U?C:null,children:(0,B.jsx)(u,{cardinality:"many",fidelity:"full",mode:"fullscreen",selected:!1})})]})})}let V=new Set(Ke(n,t.principal)),w=je(n).relations.filter(C=>V.has(C.from)&&(C.to==="*"||V.has(C.to)));return(0,B.jsxs)(ie,{context:t,style:it,children:[(0,B.jsxs)("header",{style:{display:"grid",gap:12},children:[a?.subtitle?(0,B.jsx)("p",{style:{...A,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,(0,B.jsx)(le,{context:t,"data-testid":"standing",children:m}),(0,B.jsxs)("p",{style:{...se,display:"grid",gap:4},"data-testid":"standing-card",children:[p.length===0&&g?(0,B.jsxs)("span",{children:["Begin with \u201C",g.creator?.title??g.creator?.name,"\u201D, under"," ",(0,B.jsx)(F,{to:`/${J(n.schema,g.entry.kind)}`,style:q,children:ee(n,g.entry.kind)}),"."]}):null,r.length===0?(0,B.jsx)("span",{children:"All rules hold."}):(0,B.jsx)(F,{to:"/problems",style:{...q,color:"var(--graview-warn)"},children:o})]})]}),(0,B.jsx)($n,{context:t}),(0,B.jsxs)("section",{style:{...re,display:"grid",gap:14},"data-testid":"kinds",children:[(0,B.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,B.jsx)("h2",{style:ne,children:"What is here"}),w.length>0?(0,B.jsxs)(F,{to:"/map",style:{...q,...A,marginLeft:"auto"},"data-testid":"map-link",children:["Connections \xB7 ",w.length===1?"1 relation":`${w.length} relations`," ",(0,B.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]}):null]}),(0,B.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"8px 10px"},children:c.map(({kind:C,members:U})=>(0,B.jsx)("li",{style:{maxWidth:"100%"},children:(0,B.jsxs)(F,{to:`/${J(n.schema,C)}`,style:{...ke,flexWrap:"wrap",gap:8,padding:"6px 14px 6px 10px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)"},children:[(0,B.jsx)(ye,{kind:C,brand:a,schema:n.schema,size:7}),(0,B.jsx)("span",{style:{fontWeight:550,overflowWrap:"anywhere"},children:ee(n,C)}),(0,B.jsx)("span",{style:{...A,fontVariantNumeric:"tabular-nums"},children:U.length===0?"none yet":pt(U.length)})]})},C))})]}),l.length>0?(0,B.jsxs)("section",{style:{...re,display:"grid",gap:10},children:[(0,B.jsx)("h2",{style:ne,children:"Recently"}),(0,B.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:l.map(C=>(0,B.jsxs)("li",{style:A,children:[(0,B.jsx)("span",{style:{color:"var(--graview-ink)"},children:C.intent})," \u2014 ",gt(C,e,{graph:n.graph,schema:n.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}})]},C.id))})]}):null]})}var Me=H($e(),1);var Qe=H(Y(),1);function Vt({context:t,withheld:e,style:n,testId:a}){let i=ue(),r=ma(e,t.signIn??i?.signIn);return r?(0,Qe.jsx)("p",{style:{...n,margin:0},children:(0,Qe.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>r.run(),style:be,children:r.label})}):e.length===0?null:(0,Qe.jsx)("ul",{style:{...n,margin:0,padding:0,listStyle:"none",display:"grid",gap:4},...a?{"data-testid":a}:{},children:e.map(o=>(0,Qe.jsxs)("li",{style:A,children:[(0,Qe.jsx)("s",{children:o.label})," \u2014 ",o.refusal.message]},o.id))})}var $=H(Y(),1);function Wn({context:t}){let{store:e,brand:n,principal:a,invariantContext:i}=t;ae(e);let[r]=ot(),o=r.get("q")??"",l=typeof i?.today=="string"?i.today:void 0,d=kr(e,o,{...a?{principal:a}:{},places:Re(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))],m=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:we,children:"Search"}),(0,$.jsx)(le,{context:t,"data-testid":"search-heading",children:m.length===0?"Find anything by its name":d.hits.length===0?(0,$.jsxs)($.Fragment,{children:["Nothing here is called \u201C",m,"\u201D."]}):(0,$.jsxs)($.Fragment,{children:[co(e,d.byKind)," for \u201C",m,"\u201D"]})}),m.length>0?(0,$.jsxs)("p",{style:{...A,margin:0},"data-testid":"search-searched",children:[Mt(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)(F,{to:`/${J(e.schema,u.kind)}`,style:q,children:[u.label,u.count>0?(0,$.jsxs)("span",{style:A,children:[" \xB7 ",u.count," match"]}):null]}):u.about==="place"?(0,$.jsxs)(F,{to:xe(t,u),style:q,children:["Go to ",u.title]}):u.about==="rule"?(0,$.jsxs)(F,{to:"/problems",style:q,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)(ye,{kind:u,brand:n,schema:e.schema,size:8}),(0,$.jsx)(F,{to:`/${J(e.schema,u)}?${new URLSearchParams({q:m}).toString()}`,style:q,"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)(F,{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)(Ut,{why:k.why})]},k.id))})]},u)),m.length>0?(0,$.jsx)(po,{asked:m}):null,m.length>0&&d.hits.length===0?(0,$.jsx)(yi,{store:e,kinds:d.searched.kinds,words:d.words,...a?{principal:a}:{},...i?{invariantContext:i}:{}}):null]})}function Ut({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 co(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?Ae(n[0]):Ae(`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`)}function fi(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 jt(t,i,r.actions.affordances))a.some(l=>l.mutation.name===o.mutation.name)||a.push(o)}return a}function jt(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=Tt(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 yi({store:t,kinds:e,words:n,principal:a,invariantContext:i}){let r=fi(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:[Ae(oa(He(t.schema.tryDefinition(o),o)))," called \u201C",n,"\u201D"]}),(0,$.jsx)(Oe,{store:t,mutation:d,prefilled:l.args,open:l.open,initial:{[c]:n},...a?{principal:a}:{}})]},`${l.id}|${n}`))})}function po({asked:t}){let e=ue();return e?(0,$.jsx)(uo,{asked:t,desk:e.aiDesk}):null}function uo({asked:t,desk:e}){return Oa(e)?(0,$.jsx)("p",{style:{margin:0},children:(0,$.jsxs)("button",{type:"button","data-testid":"search-ask",onClick:a=>$a(e,{pointed:{about:[]},asked:t,returnTo:a.currentTarget}),style:{...q,font:"inherit",padding:0,border:0,background:"transparent",cursor:"pointer",textAlign:"start"},children:["Ask: \u2018",t,"\u2019"]})}):null}var v=H(Y(),1),wi=8,vi=40;function go(t,e){let n=e?.fields?.shape??{},a=Object.keys(n).find(i=>la(n[i])&&sa(t[i]));return a===void 0?void 0:t[a]}function Hn({context:t}){let e=qe(),n=Te(t.store.schema,e.slug??"");return n?(0,v.jsx)(ki,{context:t,kind:n}):(0,v.jsx)(ie,{context:t,children:(0,v.jsx)(le,{context:t,children:"No such kind of thing here."})})}function ki({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]=ot(),m=`list-${(0,Me.useId)().replace(/:/g,"")}`,u=l.schema.tryDefinition(e),k=ca(p.get("archived")),V=l.graph.nodesOfKind(e,{archived:k}),w=je(l).relations.filter(s=>s.from===e||s.to===e),C=new Set(l.violations(c).flatMap(s=>s.nodeIds)),U=hr(l.schema,yr(l.schema,fr(l.schema,e))),R=w.map(s=>s.edgeKind),j=vo(p,U,R),Q=["sort","filter","group","q","by","with","past","archived",...R].some(s=>p.has(s)),de=V.length>=vi,me=u?.fieldRoles?.when,D=t.views?.arrangement?.()?.lists?.[e],X=cr(D),ce=dr(D?.group),b=wo(de,me),x=n??(X?{...b,...X}:b),L=Q?j.arrangement:vn(x,U).arrangement,M=X?.sort,E=L.sort&&M?.then&&L.sort.by===M.by&&L.sort.direction===M.direction?{...L,sort:M}:L,_=wr(E.query??""),Z=[...E.filter??[],..._.conditions].some(s=>s.key==="is"&&(s.value==="past"||s.value==="any"))||mr(u,[...E.filter??[],..._.conditions]),f=Z||!u?.lifecycle?E:{...E,filter:[...E.filter??[],{key:"is",value:"current"}]},N=new Map,G=Nt(V,f,{schema:l.schema,graph:l.graph,flagged:C,...typeof c?.today=="string"?{today:c.today}:{},read:(s,y)=>{let O=N.get(s.id);return O||N.set(s.id,O=ut(l.schema,l.graph,s)),O[y]}}),I=ce&&E.group?.by===ce.by&&!E.group.bucket?U.groups.find(s=>s.key===ce.by):void 0,Gn=ce&&I&&(I.type==="choice"||I.type==="boolean")?pr(G.groups,ce,{type:I.type,...I.options?{options:I.options}:{}}):G.groups.map(s=>({...s,closed:!1})),Vn=new Set((p.get("open")??"").split(",").filter(Boolean)),Ai=!!E.query||(E.filter??[]).some(s=>s.key===ce?.by),Un=s=>I?.type==="boolean"?s==="1"?"true":"false":s,jn=s=>s.closed&&!Ai&&!Vn.has(Un(s.key)),Ci=s=>{let y=new URLSearchParams(p),O=new Set(Vn);O.has(s)?O.delete(s):O.add(s),O.size>0?y.set("open",[...O].join(",")):y.delete("open"),g(y,{replace:!0})},Ie=G.nodes,lt=u?.lifecycle&&!Z?V.filter(s=>tt(u,s)):V,zn=V.length-lt.length,Yt=E.group?.by??null,Ri=s=>{let y=new URLSearchParams(p);for(let pe of["sort","filter","group","q","by","with","past","archived",...w.map(bt=>bt.edgeKind)])y.delete(pe);let O=br(s);for(let pe of["sort","filter","group","q","archived"])O[pe]&&y.set(pe,O[pe]);![...y.keys()].some(pe=>["sort","filter","group","q"].includes(pe))&&(n||X||de||me)&&y.set("sort",""),g(y)},{principal:Je}=t,Qt=Ue(l,e,{...Je?{principal:Je}:{},...t.invariantContext?{context:t.invariantContext}:{}}),We=Qt.actions.affordances.map(s=>({affordance:s,mutation:l.allMutations().find(y=>y.name===s.mutation)})).filter(s=>s.mutation!==void 0),Li=Qt.actions.withheld,Xt=()=>new Set(Ie.length===0?We.map(({mutation:s})=>s.name):[]),[Jt,_n]=(0,Me.useState)(()=>({kind:e,open:Xt()}));Jt.kind!==e&&_n({kind:e,open:Xt()});let Yn=s=>(Jt.kind===e?Jt.open:Xt()).has(s),Qn=(s,y)=>_n(O=>{let pe=new Set(O.open);return y?pe.add(s):pe.delete(s),{kind:O.kind,open:pe}}),Xn=`begin-${(0,Me.useId)().replace(/:/g,"")}`,Jn=_.words&&Ie.length===0?Object.fromEntries(jt(l,e,Qt.actions.affordances).map(s=>[s.mutation.name,s.arg])):{},Ze=ee(l,e),ht=t.views?.lookup(e,{cardinality:"one",fidelity:"glyph"}),Zt=ht!==void 0&&!at(ht)?ht:void 0,en=(E.group?.bucket??"day")==="day"?E.group?.by:void 0,tn=(E.filter??[]).map(s=>s.key),Ti=tn.filter(s=>tn.indexOf(s)===tn.lastIndexOf(s)&&/choice|boolean/.test(U.filters.find(y=>y.key===s)?.type??"")),nn=s=>{let y={...u?.computed?ut(l.schema,l.graph,s):s};en&&!String(y[en]).includes("T")&&delete y[en];for(let O of Ti)delete y[O];return y},wt=s=>{let y=fe(u,s);if(a)return(0,v.jsxs)("li",{"data-testid":"record-row","data-graview-record":s.id,style:{minWidth:0},...ln(s.id),children:[sn(s,y),a(s,{label:y,href:te(l.schema,e,s.id),flagged:C.has(s.id),glance:Dt(nn(s),u,y)})]},s.id);if(Zt){let dn=Ot(ht,s,l.graph),Ii=Object.fromEntries(Object.entries(nn(s)).filter(([Fi])=>!dn?.fields.has(Fi))),aa=dn?Dt(Ii,u,dn.title??y):"";return(0,v.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)"},...ln(s.id),children:[sn(s,y),(0,v.jsx)("div",{style:{flex:"1 1 14rem",minWidth:0},children:(0,v.jsx)(Zt,{node:s,cardinality:"one",fidelity:"glyph",mode:"fullscreen",selected:!1,...C.has(s.id)?{flagged:[s.id]}:{}})}),aa?(0,v.jsx)("span",{style:{...A,flex:"0 1 auto",minWidth:0,overflowWrap:"anywhere"},"data-testid":"record-glance",children:aa}):null,(0,v.jsx)(So,{to:te(l.schema,e,s.id),label:C.has(s.id)?`${y} \u2014 implicated in a problem`:y})]},s.id)}let O=Dt(nn(s),u,y),pe=_.words?vr(u,s,_.words):void 0,bt=de?void 0:Qa(s,u),St=go(s,u),na=(0,v.jsxs)(F,{to:te(l.schema,e,s.id),className:"graview-row-title",...y.length>60?{title:y}:{},children:[C.has(s.id)?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,y]});return(0,v.jsxs)("li",{className:"graview-row","data-graview-record":s.id,...ln(s.id),children:[sn(s,y),bt?(0,v.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:14,minWidth:0},children:[(0,v.jsx)(Ve,{as:"thumb",file:bt}),na]}):na,O||St?(0,v.jsxs)("span",{className:"graview-row-glance",children:[O,O&&St?" \xB7 ":null,St?(0,v.jsx)(Et,{address:St}):null]}):null,pe?(0,v.jsx)(Ut,{why:pe}):null]},s.id)},an=Re(t).filter(s=>s.kind===e),Zn=D?.filters,Mi=(E.filter??[]).some(s=>s.key!=="is"||s.value!=="any"),Ni=!!(E.sort||E.group||E.query||Mi),Ei=lt.length>=wi||Q&&Ni,Ne=E.sort?U.sorts.find(s=>s.key===E.sort.by):void 0,rn=Ne?.type==="date"||Ne!==void 0&&Ne.key===me,ea=de&&!G.grouped&&Ne&&(Ne.about==="label"||Ne.type==="text"||rn)?s=>{let y=Ne.about==="label"?fe(u,s):s[Ne.key];if(typeof y!="string"||y.length===0)return rn?"No date":"#";if(rn)return y.slice(0,4);let O=y.trim().charAt(0).toLocaleUpperCase();return/\p{L}/u.test(O)?O:"#"}:void 0,Ge=ea?Ie.reduce((s,y)=>{let O=ea(y);return s.at(-1)?.key===O?s.at(-1).nodes.push(y):s.push({key:O,nodes:[y]}),s},[]):void 0,ta=G.grouped&&Yt?Gn.flatMap(s=>jn(s)?[]:s.nodes):Ge&&Ge.length>1?Ge.flatMap(s=>s.nodes):Ie,on=(0,Me.useMemo)(()=>ta.map(s=>s.id),[ta.map(s=>s.id).join(`
109
+ `)]),Le=Ar(on),dt=(Je?l.permittedMutations(Je):l.permittedMutations()).some(s=>{let y=s.subject?.kinds;return y!==void 0&&(y==="*"||y.includes(e))}),sn=(s,y)=>dt?(0,v.jsx)("span",{className:"graview-choose-at",children:(0,v.jsx)("input",{...Le.boxProps(s.id,y),onPointerEnter:bn,onFocus:bn})}):null,ln=s=>dt?{"data-graview-choose":s}:{},$i=(0,Me.useCallback)(s=>{Le.choose(s),requestAnimationFrame(()=>{let y=Le.list.current;((s[0]===void 0?null:y?.querySelector(`[data-graview-choose-box="${CSS.escape(s[0])}"]`))??y)?.focus({preventScroll:!0})})},[Le]),et=i==="grid"?{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 15rem), 1fr))",alignItems:"start",gap:12}:a||Zt?{margin:0,padding:0,listStyle:"none",display:"grid",gap:a&&i==="list"?6:0}:void 0,vt=et?void 0:"graview-rows",ct=s=>`list-at-${s.replace(/[^\p{L}\p{N}]/gu,"_")}`,kt=w.map(s=>{let y=s.from===e?s.to:s.from,O=s.from===e?s.description:s.inverse??s.description;return{relation:s,far:y,words:O}}),Oi=new Set(kt.map(s=>(s.words??"").toLowerCase()).filter((s,y,O)=>s&&O.indexOf(s)!==y));return(0,v.jsxs)(o?ho:ie,{context:t,children:[(0,v.jsxs)("div",{style:{display:"grid",gap:12},children:[(0,v.jsxs)("header",{style:{display:"grid",gap:4},children:[(0,v.jsxs)("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",columnGap:10,rowGap:4,minWidth:0},children:[(0,v.jsx)(ye,{kind:e,brand:d,schema:l.schema,size:8}),(0,v.jsx)(le,{context:t,children:Ze}),We.length>0?(0,v.jsx)("span",{style:{marginLeft:"auto",display:"flex",flexWrap:"wrap",columnGap:14},"data-testid":"beginnings-open",children:We.map(({affordance:s,mutation:y})=>(0,v.jsx)(ko,{name:y.name,title:y.title??y.name,panel:`${Xn}-${y.name}`,open:Yn(y.name),onOpen:O=>Qn(y.name,O)},s.id))}):null]}),r??u?.description?(0,v.jsx)("p",{style:se,children:r??u?.description}):null,kt.length>0||an.length>0?(0,v.jsxs)("p",{style:{...A,margin:0,display:"flex",flexWrap:"wrap",columnGap:18,rowGap:2},"data-testid":"kind-related",children:[kt.length>0?(0,v.jsxs)("span",{"data-testid":"kind-relations",children:["Related:"," ",kt.map(({relation:s,far:y,words:O},pe)=>(0,v.jsxs)("span",{"data-relation":s.edgeKind,children:[pe>0?(0,v.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,y==="*"?Ae(O??ve(s.edgeKind)):(0,v.jsx)(F,{to:`/${J(l.schema,y)}`,style:q,title:ee(l,y),children:O&&Oi.has(O.toLowerCase())?`${Ae(O)}: ${ee(l,y).toLowerCase()}`:Ae(O??ee(l,y))})]},`${s.edgeKind}|${s.from}|${s.to}`))]}):null,an.length>0?(0,v.jsxs)("span",{"data-testid":"kind-pictures",children:["Also as:"," ",an.map((s,y)=>(0,v.jsxs)("span",{children:[y>0?(0,v.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,v.jsx)(F,{to:xe(t,s),style:q,children:s.title})]},_e(s)))]}):null]}):null]}),We.length>0?(0,v.jsx)("div",{style:{display:"contents"},"data-testid":"beginnings",children:We.map(({affordance:s,mutation:y})=>{let O=!!(Jn[y.name]&&Ie.length===0);return(0,v.jsx)(bo,{name:y.name,id:`${Xn}-${y.name}`,description:y.description,open:Yn(y.name),onClose:()=>Qn(y.name,!1),children:(0,v.jsx)(Oe,{store:l,mutation:y,prefilled:s.args,open:s.open,...O?{initial:{[Jn[y.name]]:_.words}}:{},...t.principal?{principal:t.principal}:{}},O?`${y.name}|${_.words}`:y.name)},s.id)})}):null,j.dropped.length>0?(0,v.jsxs)("p",{style:{...A,margin:0},"data-testid":"list-dropped",children:["This link asked for ",j.dropped.join(", "),", which ",Ze.toLowerCase()," cannot be arranged by; the rest is shown."]}):null,lt.length>0?(0,v.jsx)(Pr,{schema:l.schema,graph:l.graph,kind:e,arrangement:E,onChange:Ri,kept:{shown:Ie.length,of:lt.length},noun:{one:He(u,e),many:Ze.toLowerCase()},...Ei?{}:{allow:!1},...Zn?{filters:Zn}:{},offers:U,chips:{nodes:lt,flagged:C,...typeof c?.today=="string"?{today:c.today}:{}},query:t.framed===!0&&t.barAbove!==!0}):null,(0,v.jsx)("style",{children:Ft}),dt?(0,v.jsx)("style",{children:Cr+yo}):null,(0,v.jsx)("div",{className:"graview-list",...dt?{...Le.listProps,ref:Le.list,tabIndex:-1,"data-graview-choosable":"","aria-label":Le.chosen.length>0?`${Ze}, ${Le.chosen.length} chosen`:Ze,role:"group"}:{},children:Ie.length===0&&_.words?(0,v.jsxs)("p",{style:se,"data-testid":"none-yet",children:["Nothing here is called \u201C",_.words,"\u201D."," ",(0,v.jsx)("span",{style:A,"data-testid":"list-searched",children:Mt(l.schema,{kinds:[e],past:Z})})," ",(0,v.jsx)(F,{to:"?",style:q,children:"Show every one"})]}):Ie.length===0?(0,v.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,v.jsxs)(v.Fragment,{children:[" ",(0,v.jsx)(F,{to:"?",style:q,children:"Show every one"})]}):null]}):G.grouped&&Yt?(0,v.jsx)("div",{style:{display:"grid",gap:"1rem"},"data-testid":"records","data-grouped":Yt,children:Gn.map(s=>{if(!s.closed)return(0,v.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group",children:[(0,v.jsxs)("h2",{className:"graview-group-head",children:[s.label," ",(0,v.jsx)("span",{children:s.nodes.length})]}),(0,v.jsx)("ul",{style:et,className:vt,"data-graview-rows":"",children:s.nodes.map(wt)})]},s.key||"-");let y=jn(s),O=`${m}-${ct(s.key||"none")}`;return(0,v.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group","data-closed":y?"shut":"open",children:[(0,v.jsx)("h2",{className:"graview-group-head",children:(0,v.jsxs)("button",{type:"button",className:"graview-group-toggle","aria-expanded":!y,"aria-controls":O,"data-testid":"list-group-toggle",onClick:()=>Ci(Un(s.key)),children:[(0,v.jsx)("span",{"aria-hidden":"true",children:y?"\u25B8":"\u25BE"}),s.label," ",(0,v.jsxs)("span",{children:["\xB7 ",s.nodes.length]}),(0,v.jsxs)("span",{style:mo,children:[" ",s.nodes.length===1?He(u,e):Ze.toLowerCase()]})]})}),(0,v.jsx)("ul",{id:O,style:y?{...et,display:"none"}:et,className:vt,"data-graview-rows":"",hidden:y,children:y?null:s.nodes.map(wt)})]},s.key||"-")})}):Ge&&Ge.length>1?(0,v.jsxs)("div",{style:{display:"grid",gap:14},"data-testid":"records","data-sectioned":Ne?.type==="date"?"year":"letter",children:[(0,v.jsx)("nav",{"aria-label":"Jump to","data-testid":"list-index",style:{...A,display:"flex",flexWrap:"wrap",gap:Ne?.type==="date"?"0 10px":"0 4px",lineHeight:1.3},children:Ge.map(s=>(0,v.jsx)("a",{href:`#${ct(s.key)}`,onClick:y=>{y.preventDefault(),document.getElementById(ct(s.key))?.scrollIntoView({block:"start"})},style:{...ke,minWidth:24,justifyContent:"center"},children:s.key},s.key))}),Ge.map(s=>(0,v.jsxs)("section",{"data-testid":"list-section","aria-labelledby":ct(s.key),style:{display:"grid",gap:0},children:[(0,v.jsx)("h2",{id:ct(s.key),className:"graview-group-head",children:s.key}),(0,v.jsx)("ul",{style:et,className:vt,"data-graview-rows":"",children:s.nodes.map(wt)})]},s.key))]}):(0,v.jsx)("ul",{style:et,className:vt,"data-testid":"records","data-graview-rows":"",children:Ie.map(wt)})}),dt?(0,v.jsx)(Rr,{store:l,chosen:Le.chosen,...Je?{principal:Je}:{},...c?{context:c}:{},anchor:fo,of:on.length,onChooseAll:()=>Le.choose(on),onClear:Le.clear,onActed:$i}):null,zn>0?(0,v.jsxs)(F,{to:hi(p,"filter","is:any"),style:{...q,...A,justifySelf:"start"},"data-testid":"past-link",children:["+",zn," past"]}):null,k===!1&&l.graph.count(e,{archived:!0})>0?(0,v.jsxs)(F,{to:hi(p,"archived","true"),style:{...q,...A,justifySelf:"start"},"data-testid":"archived-link",children:["+",l.graph.count(e,{archived:!0})," archived"]}):null]}),(0,v.jsx)(Vt,{context:t,withheld:Li,style:re,testId:"withheld"})]})}var mo={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},fo=()=>document.querySelector("[data-graview-choosable]")?.closest("[data-embed-content]")??null,yo=`
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:${fa.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 ho({children:t}){return(0,v.jsx)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40,minWidth:0},children:t})}var wo=(t,e)=>e?{sort:{by:e,direction:"desc"}}:t?{sort:{by:"label",direction:"asc"}}:{};function vo(t,e,n){let a=At({...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"}),vn({...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 hi(t,e,n){let a=new URLSearchParams(t);return a.set(e,n),a.delete("past"),`?${a.toString()}`}function ko({name:t,title:e,panel:n,open:a,onOpen:i}){return(0,v.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:{...ke,minHeight:28,margin:"-4px 0",padding:"0 2px",border:0,background:"none",font:"inherit",fontWeight:600,color:"var(--graview-ink)",cursor:"pointer"},children:[(0,v.jsx)("span",{"aria-hidden":"true",style:{marginRight:6},children:a?"\u2212":"+"}),e]})}function bo({name:t,id:e,description:n,open:a,onClose:i,children:r}){return(0,v.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,v.jsx)("p",{style:{...A,margin:0,maxWidth:"58ch"},children:n}):null,r]})}function So({to:t,label:e}){let n=(0,Me.useRef)(null);return Lr(n),(0,v.jsx)(F,{ref:n,to:t,"aria-label":e,style:{position:"absolute",inset:0,borderRadius:6}})}var Xe=H($e(),1);var yt=H($e(),1);var W=H(Y(),1);function Kn({context:t}){let{store:e,brand:n,invariantContext:a,principal:i}=t;ae(e);let r=e.violations(a),o=e.allInvariants(),l=Ct(e,r),d=Ia(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.":pa(r)})]}),(0,W.jsx)(mi,{context:t}),l.map((c,p)=>{let g=c.nodeIds[0],m=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)(zt,{violation:c,schema:e.schema,...n?{brand:n}:{}}),m?(0,W.jsxs)("p",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[(0,W.jsx)(ye,{kind:m.kind,brand:n,schema:e.schema,size:7}),(0,W.jsx)(F,{to:te(e.schema,m.kind,m.id),style:q,children:fe(e.schema.tryDefinition(m.kind),m)})]}):null,c.line?(0,W.jsx)(zt,{violation:c,schema:e.schema,...n?{brand:n}:{}}):null,(0,W.jsx)(_t,{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),m=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)(Rt,{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:m}),(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&&m.trim().length>0?(0,W.jsx)("span",{style:A,children:m}):null]},c.name)})})]}):null]})}function zt({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=Da(t),i=Fa(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)(Rt,{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)(Rt,{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 _t({store:t,repairs:e,principal:n}){let[a,i]=(0,yt.useState)(null),[r,o]=(0,yt.useState)(null),l=(0,yt.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 m=(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":m||void 0,"aria-expanded":m?a===g:void 0,onClick:()=>{if(o(null),m){i(a===g?null:g);return}i(null);try{t.apply({name:p.mutation,args:{...p.args}},n?{author:n}:{})}catch(k){o(rt(t.schema,t.allMutations(),k))}},style:be,children:m?`${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)(Oe,{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 m=document.querySelector("[data-graview-page-title]")??document.querySelector("main h1, main h2");m&&(m.hasAttribute("tabindex")||(m.tabIndex=-1),m.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:Sn},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:Sn},children:r}):null]})}var qn=H($e(),1);var Be=H(Y(),1);function bi({store:t,link:e,principal:n}){let[a,i]=(0,qn.useState)(!1),[r,o]=(0,qn.useState)(null),l=ja(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:{...be,padding:"4px 10px"},onClick:()=>{try{t.apply({name:ua,args:{kind:e.edge.kind,from:e.edge.from,to:e.edge.to}},n?{author:n}:{}),i(!1)}catch(d){o(rt(t.schema,t.allMutations(),d))}},children:"Keep this link"}),r?(0,Be.jsx)("span",{role:"alert",children:r}):null]}):null]})}var h=H(Y(),1),xo=[];function Bn({context:t}){let{store:e,brand:n,principal:a,invariantContext:i}=t;ae(e);let r=ue()!==null,o=qe(),l=decodeURIComponent(o.id??""),d=Zr(e,l,{...a?{principal:a}:{},...i?{context:i}:{}}),c=Ct(e,d?.violations??xo),[p,g]=(0,Xe.useState)(null),[m,u]=(0,Xe.useState)(!1),[k,V]=(0,Xe.useState)(null),w=(0,Xe.useRef)(null),C=(0,Xe.useRef)(null),U=f=>{(w.current?.parentElement?.querySelector(`[data-affordance="${f.replace(/["\\]/g,"\\$&")}"]`)??w.current)?.focus()};if(!d)return(0,h.jsx)(ie,{context:t,children:(0,h.jsx)(le,{context:t,children:"Nothing lives at this address."})});let R=e.graph.getNode(l),j=e.schema.tryDefinition(d.kind),Q=j?.describe&&R?Wa(j,R):null,de=[...e.log.all()].filter(f=>!Pt(f)&&(f.writes.includes(l)||f.reads.includes(l))).slice(-8).reverse(),me=e.log.all().find(f=>!Pt(f)&&f.undoes===void 0&&f.primitives.some(N=>N.op==="add-node"&&N.node.id===l)),D=d.actions.affordances.filter(f=>f.provider!=="invariant"),X=D.filter(f=>f.destructive||f.setsAside),ce=m||X.length<2?D:D.filter(f=>!X.includes(f)),b=t.views?.lookup(d.kind,{cardinality:"one",fidelity:"full"}),x=b!==void 0&&!at(b)?b:void 0,L=x&&R?Ot(b,R,e.graph):void 0,M=L?d.fields.filter(f=>!L.fields.has(f.key)):d.fields,E=L?d.links.flatMap(f=>{let N=f.targets.filter(G=>!L.records.has(G.id));return N.length>0?[{...f,targets:N}]:[]}):d.links,_=x!==void 0&&Na(b),Z=r&&Ya(j).length>0;return(0,h.jsxs)(ie,{context:t,children:[(0,h.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,h.jsxs)("p",{style:{...we,display:"flex",alignItems:"center",gap:8},children:[(0,h.jsx)(ye,{kind:d.kind,brand:n,schema:e.schema,size:8}),(0,h.jsx)(F,{to:`/${J(e.schema,d.kind)}`,style:ke,children:ee(e,d.kind)})]}),(0,h.jsx)(le,{context:t,children:r&&R?.label===d.label?(0,h.jsx)(kn,{nodeId:l,field:"label",value:d.label,said:d.label}):d.label}),Q&&Q!==d.label?(0,h.jsx)("p",{style:se,children:Q}):null,me?.lineage?(0,h.jsxs)("p",{style:{...A,margin:0},"data-testid":"record-lineage",children:["Made by ",gt(me,a,{graph:e.graph,schema:e.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}}),", ",mn(me.lineage)]}):null,(0,h.jsx)(It,{context:t,stop:`#focus=${encodeURIComponent(l)}`,style:{...q,...A},"data-testid":"spatial-link"}),r&&R?(0,h.jsx)(yn,{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:{...be,...A,justifySelf:"start"}}):null,Re(t).some(f=>f.kind===d.kind||f.across===d.kind)?(0,h.jsxs)("p",{style:{...A,margin:0},"data-testid":"seen-in",children:["Seen in:"," ",Re(t).filter(f=>f.kind===d.kind||f.across===d.kind).map((f,N)=>(0,h.jsxs)("span",{children:[N>0?(0,h.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,h.jsx)(F,{to:xe(t,f),style:q,children:f.title})," ",(0,h.jsx)(It,{context:t,stop:`#view=${encodeURIComponent(f.as)}`,style:{...q,...A,display:"inline-block",minWidth:24,textAlign:"center"},title:`${f.title}, in the scene`,label:`${f.title}, in the scene`,children:(0,h.jsx)("span",{"aria-hidden":"true",children:"\u2197"})})]},_e(f)))]}):null]}),R&&da(R)?(0,h.jsx)(Ao,{context:t,id:l,kind:d.kind}):null,R&&ga(e,l)?(0,h.jsx)(Po,{context:t,id:l,kind:d.kind}):null,x&&R?(0,h.jsx)("section",{"data-testid":"record-view",style:{display:"grid",minWidth:0},children:(0,h.jsx)(Tr,{children:(0,h.jsx)(x,{node:R,cardinality:"one",fidelity:"full",mode:"fullscreen",selected:!1,...d.violations.length>0?{flagged:[l]}:{}})})}):null,d.violations.length>0?(0,h.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((f,N)=>(0,h.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,h.jsx)(zt,{violation:f,schema:e.schema,...n?{brand:n}:{}}),(0,h.jsx)(_t,{store:e,repairs:ei(d.actions,f.repairs),...a?{principal:a}:{}})]},N))}):null,!_&&(M.length>0||Z)?(0,h.jsxs)("section",{style:{...re,display:"grid",gap:14},"data-testid":"record-fields",children:[(0,h.jsx)("h2",{style:ne,children:"The facts"}),Ka(j,M).map((f,N)=>{let G=(0,h.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"14px 24px"},children:f.fields.map(I=>I.files?(0,h.jsx)(Ve,{as:"field",read:!r,nodeId:l,field:I.key,label:I.label,files:I.files,labelStyle:we,style:{gap:4}},I.key):I.long?(0,h.jsx)(xr,{nodeId:l,field:I.key,label:I.label,value:I.value,markdown:I.markdown,style:{gridColumn:"1 / -1",gap:4},labelStyle:we,valueStyle:{lineHeight:1.6}},I.key):(0,h.jsxs)("div",{style:{display:"grid",gap:2,minWidth:0,alignContent:"start"},children:[(0,h.jsx)("dt",{style:we,children:I.label}),(0,h.jsx)("dd",{style:{margin:0,overflowWrap:"anywhere",minWidth:0},children:I.linked?(0,h.jsx)(Ja,{relation:I.linked.relation,refs:I.linked.refs,...r?{nodeId:l,field:I.key}:{}}):I.app?(0,h.jsx)(Et,{address:I.app,as:"record",...r?{nodeId:l,field:I.key}:{}}):I.href?(0,h.jsx)(Sr,{href:I.href,field:I.key,value:I.value,stored:I.stored,...r?{nodeId:l}:{}}):r?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(kn,{nodeId:l,field:I.key,value:I.value,stored:I.stored}),I.repeats?(0,h.jsx)(tr,{nodeId:l,field:I.key,start:R?.[I.key],value:R?.[`${I.key}Repeat`],label:`${I.label} repeats`}):null]}):I.value})]},I.key))});return f.title?(0,h.jsxs)("section",{style:{display:"grid",gap:10,minWidth:0},children:[(0,h.jsx)("h3",{"data-graview-field-group":f.title,style:{...ne,fontSize:"inherit"},children:f.title}),G]},N):(0,h.jsx)("div",{children:G},N)}),Z?(0,h.jsx)(Ve,{as:"unfilled",nodeId:l,skip:[...L?.fields??[]],labelStyle:we,style:{gap:4}}):null]}):null,(_?[]:E).map(f=>(0,h.jsxs)("section",{style:{...re,display:"grid",gap:10},children:[(0,h.jsx)("p",{style:we,children:Vr(e,f)}),f.description?(0,h.jsx)("h2",{style:ne,children:Ae(f.description)}):(0,h.jsxs)("h2",{style:ne,"aria-label":ve(f.edgeKind),children:[f.direction==="in"?"\u2190 ":"\u2192 ",ve(f.edgeKind)]}),(0,h.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},children:f.targets.map(N=>{let G=za(e,f.direction==="in"?{kind:f.edgeKind,from:N.id,to:l}:{kind:f.edgeKind,from:l,to:N.id});return(0,h.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,h.jsx)(ye,{kind:N.kind,brand:n,schema:e.schema,size:7}),(0,h.jsxs)(F,{to:te(e.schema,N.kind,N.id),style:q,children:[N.label,N.apart?(0,h.jsxs)("span",{style:A,children:[" \xB7 ",N.apart]}):null]}),G?.provisional?(0,h.jsx)(bi,{store:e,link:G,...a?{principal:a}:{}}):null]},N.id)})}),(f.direction==="out"&&e.schema.edge(f.edgeKind)?.cardinality==="one"?[]:[...new Set(f.targets.map(N=>N.kind))]).map(N=>(0,h.jsxs)(F,{to:`/${J(e.schema,N)}?${encodeURIComponent(f.edgeKind)}=${encodeURIComponent(l)}`,style:{...q,...A},"data-testid":"related-all",children:["Sort and filter ",f.description??`these ${ee(e,N).toLowerCase()}`,f.targets.some(G=>G.kind!==N)?` (${ee(e,N).toLowerCase()})`:""," ",(0,h.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]},N))]},`${f.edgeKind}|${f.direction}|${f.description??""}`)),!_&&(D.length>0||d.actions.withheld.length>0)?(0,h.jsxs)("section",{style:{...re,display:"grid",gap:14},"data-testid":"record-actions",children:[(0,h.jsx)("h2",{style:ne,ref:w,tabIndex:-1,children:"What can be done"}),(0,h.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[ce.map(f=>{let N=p===f.id;return(0,h.jsx)("button",{type:"button","data-affordance":f.id,"data-rank":f.rank,"data-graview-act":f.mutation,autoFocus:m&&f===X[0],"aria-expanded":N,onClick:()=>{g(N?null:f.id),N||requestAnimationFrame(()=>C.current?.querySelector("input:not([type=hidden]), select, textarea, button")?.focus())},style:{...be,...N?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},children:f.label},f.id)}),ce.length<D.length?(0,h.jsxs)("button",{type:"button","aria-expanded":!1,onClick:()=>u(!0),style:{...be,...A},"data-testid":"record-actions-more",children:["Show ",D.length-ce.length," more"]}):null]}),D.map(f=>{if(p!==f.id)return null;let N=e.allMutations().find(G=>G.name===f.mutation);return N?(0,h.jsxs)("div",{ref:C,onKeyDown:G=>{if(G.key!=="Escape"||G.defaultPrevented)return;G.preventDefault(),g(null);let I=f.id;requestAnimationFrame(()=>U(I))},style:{display:"grid",gap:10,padding:18,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,h.jsx)("h3",{style:ne,children:f.label}),N.description?(0,h.jsx)("p",{style:{...A,margin:0},children:N.description}):null,(0,h.jsx)(Oe,{store:e,mutation:N,prefilled:f.args,open:f.open,label:f.label,onDone:()=>{g(null),V(f.mutation);let G=f.id;requestAnimationFrame(()=>U(G))},...a?{principal:a}:{}})]},f.id):null}),r&&k!==null&&p===null?(0,h.jsx)(yn,{choices:[{on:"act",act:k,record:l},{on:"act",act:k}],label:"Notify me when someone else does this",testId:"notify-after-act",style:{...be,...A,justifySelf:"start"}}):null,(0,h.jsx)(Vt,{context:t,withheld:d.actions.withheld})]}):null,r?(0,h.jsx)(Gr,{id:l,style:re,headingStyle:ne}):null,de.length>0?(0,h.jsxs)("section",{style:{...re,display:"grid",gap:10},"data-testid":"record-history",children:[(0,h.jsx)("h2",{style:ne,children:"What has happened"}),(0,h.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:de.map(f=>(0,h.jsxs)("li",{style:A,children:[(0,h.jsx)("span",{style:{color:"var(--graview-ink)"},children:f.intent}),f.lineage?(0,h.jsxs)("span",{"data-graview-lineage":"",children:[" \xB7 ",mn(f.lineage)]}):null," \u2014 ",gt(f,a,{graph:e.graph,schema:e.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}})]},f.id))})]}):null]})}function Po({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,h.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,h.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,h.jsx)("strong",{children:"Left alone."})," Nothing automated changes it; tidying passes it by."]}),o?(0,h.jsx)("button",{type:"button",style:be,"data-testid":"allow-tidying",onClick:()=>a.apply(r,i?{author:i}:{}),children:"Allow tidying again"}):null]})}function Ao({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=>!Pt(c)&&c.mergedInto!==void 0&&c.writes.includes(e)),d=l?.mergedInto!==void 0?a.graph.getNode(l.mergedInto):void 0;return(0,h.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,h.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,h.jsx)("strong",{children:"Archived."})," Kept with its ties and history, and out of lists, counts and rules.",d?(0,h.jsxs)(h.Fragment,{children:[" ","Merged into ",(0,h.jsx)(F,{to:te(a.schema,d.kind,d.id),style:q,children:fe(a.schema.tryDefinition(d.kind),d)}),"."]}):null]}),o?(0,h.jsx)("button",{type:"button",style:be,"data-testid":"bring-it-back",onClick:()=>a.apply(r,i?{author:i}:{}),children:"Bring it back"}):null]})}var P=H(Y(),1),Co=(0,z.lazy)(()=>(__graviewPreload(import.meta.url,["./chunk.OZ5KJLA2.js","./chunk.5MCC54VM.js","./chunk.UGFDSE37.js","./chunk.3QXHII5W.js","./chunk.AINNENYD.js","./chunk.SBBNIYVB.js","./chunk.IX6RNGAT.js","./chunk.3H4NVUWV.js","./chunk.XSYBNUXF.js","./chunk.GCVO6N26.js","./chunk.LRRVBM4F.js","./chunk.H243UV3Z.js","./chunk.PKKA6JWA.js","./chunk.5EAQDBBE.js","./chunk.YT2CYCVT.js","./chunk.KWCML3BF.js","./chunk.DLT3EE4D.js","./chunk.2OBIO5Y6.js","./chunk.GF7LA4QG.js","./chunk.AEHPDVLQ.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.52QAIGCD.js","./chunk.PPUAPAWR.js","./chunk.IHFNLKXV.js","./chunk.577PGFUT.js","./chunk.FBY5IUGU.js","./chunk.4K5QCJFH.js","./chunk.GZHZLJBF.js","./chunk.QRMWFEEH.js","./chunk.MVN6H65Q.js","./chunk.OJGHDWI6.js","./chunk.Z7ZCR4LN.js","./chunk.RIW7SQH4.js","./chunk.FSAHO3LV.js","./chunk.Y5Z4ZDTO.js","./chunk.UWIYKGYK.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.FHXXYWL3.js")).then(t=>({default:t.DraftPage}))),Ro={kind:"human"};function Lo({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,P.jsx)("p",{className:"graview-spec-text graview-spec-more",children:`and ${a} more`});let r=nt(e.schema,i).toLowerCase();return(0,P.jsx)("p",{className:"graview-spec-text graview-spec-more",children:(0,P.jsx)(F,{to:`/${J(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 ${pt(t.total)} ${r}`:`${pt(a)} more \xB7 all ${r}`})})}function To({context:t,children:e}){let n=Fe(),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,P.jsx)(Lo,{list:r,store:t.store})}),[a,n,t.store]);return(0,P.jsx)($t.Provider,{value:i,children:(0,P.jsx)(Mr.Provider,{value:(t.titleLevel??(t.framed&&!t.barAbove?1:2))-1,children:e})})}function Mo({steering:t}){let e=Se(),n=Fe(),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 No({context:t,to:e}){let{pathname:n}=Se(),a=ue(),i=(e??a)?.sayWhere,r=Eo(t,n);return(0,z.useEffect)(()=>(i?.(r),()=>i?.(null)),[i,r]),null}function Eo(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===un)return"#overview=1";let o=t.views?.places().find(l=>l.as===a);return o?`#focus=${encodeURIComponent(Ee(o.kind))}&view=${encodeURIComponent(o.as)}`:"#"}let r=Te(t.store.schema,n);return r?`#focus=${encodeURIComponent(a??Ee(r))}`:"#"}function $o({onNavigate:t,path:e}){let n=Se(),a=Pn(),i=Fe(),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 Si({context:t,registry:e,page:n}){let a=qe(),i=Te(t.store.schema,a.slug??""),r=n==="list"?Hn:Bn,l=(i?e?.lookup(i,n):void 0)??r;return(0,P.jsx)(l,{context:t})}function Oo({context:t,registry:e,children:n}){let a=(0,z.useRef)(null);return Ea(a),(0,P.jsx)("div",{ref:a,"data-graview-face":"pages",style:{display:"contents"},children:(0,P.jsx)(di,{context:t,registry:e,root:a,children:(0,P.jsx)(pi,{context:t,root:a,children:n})})})}function Io(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 Fo(){let{pathname:t}=Se(),e=Pn(),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(Io(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,P.jsx)("span",{ref:n,hidden:!0,"data-graview-scroll-reset":""})}function xi({context:t,children:e}){let n=Fe(),a=(0,z.useMemo)(()=>({record:(i,r)=>{let o=t.store.graph.getNode(i);o&&n(ft(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(ft(xe(t,o),r))},list:(i,r)=>{t.store.schema.tryDefinition(i)&&n(ft(`/${J(t.store.schema,i)}`,r))},draft:()=>n("/~draft")}),[t,n]);return(0,P.jsx)(Ma.Provider,{value:a,children:e})}function Do(){let{pathname:t,search:e,hash:n}=Se();return(0,z.useEffect)(()=>{let a=decodeURIComponent(n.replace(/^#/,""));if(!(!a||a.includes("=")))return ii(a)},[t,e,n]),null}function Wo({context:t,Home:e}){let n=Se(),a=t.views,i=n.key==="default"&&!(a&&La(a));(0,z.useEffect)(()=>{a&&Ta(a)},[a]);let r=i?va(t.views?.arrangement?.()?.first,t.store.schema,t.views?.places()??[]):void 0,o=r?.to==="place"?xe(t,r.place):r?.to==="kind"?`/${J(t.store.schema,r.kind)}`:void 0;return o?(0,P.jsx)(An,{to:o,replace:!0}):(0,P.jsx)(e,{context:t})}function Pi({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,P.jsx)(Ht,{context:t,children:k}):i?(0,P.jsx)(n,{context:t,children:k}):(0,P.jsx)(Ht,{context:t,children:(0,P.jsx)(n,{context:r,children:k})}),l=e?.lookupSurface("home")??Dn,d=e?.lookupSurface("problems")??Kn,c=a?{...r,framed:!0}:t,[p,g]=(0,z.useState)(null),m=(0,z.useMemo)(()=>({onFind:g,find:!(e?.without().has("find")??!1),places:!(e?.without().has("places")??!1)}),[e]),u=(0,P.jsx)(xi,{context:t,children:(0,P.jsx)(Oo,{context:t,registry:e,children:o((0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(_a,{face:"pages"}),(0,P.jsxs)(To,{context:c,children:[(0,P.jsx)(Fo,{}),(0,P.jsx)(Do,{}),(0,P.jsxs)(Yr,{children:[(e?.routes()??[]).map(({path:k,component:V})=>(0,P.jsx)(Ce,{path:k,element:(0,P.jsx)(V,{context:c})},k)),(0,P.jsx)(Ce,{path:"/",element:(0,P.jsx)(Wo,{context:c,Home:l})}),(0,P.jsx)(Ce,{path:"/problems",element:(0,P.jsx)(d,{context:c})}),(0,P.jsx)(Ce,{path:"/~draft",element:(0,P.jsx)(z.Suspense,{fallback:null,children:(0,P.jsx)(Co,{context:c})})}),(0,P.jsx)(Ce,{path:"/search",element:(0,P.jsx)(Wn,{context:c})}),(0,P.jsx)(Ce,{path:"/map",element:(0,P.jsx)(Fn,{context:c})}),(0,P.jsx)(Ce,{path:"/places",element:(0,P.jsx)(On,{context:c})}),Re(c).some(k=>k.as===un)?null:(0,P.jsx)(Ce,{path:wa,element:(0,P.jsx)(An,{to:"/",replace:!0})}),(0,P.jsx)(Ce,{path:"/places/:as",element:(0,P.jsx)(In,{context:c})}),(0,P.jsx)(Ce,{path:"/:slug",element:(0,P.jsx)(Si,{context:c,registry:e,page:"list"})}),(0,P.jsx)(Ce,{path:"/:slug/:id",element:(0,P.jsx)(Si,{context:c,registry:e,page:"record"})})]})]})]}))})});return t.embedded||!a||i?u:(0,P.jsx)(Jr.Provider,{value:m,children:(0,P.jsx)(ur.Provider,{value:p,children:u})})}var Ho=()=>typeof document>"u"?null:document.body;function Ko({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?Er(p.views,p.store.schema,wn(p.brand,p.store.schema)):void 0);let g=ue();ra({reader:p.locale??g?.locale,app:p.brand?.locale??p.app?.brand?.locale});let m=p.principal??Ro,u=Pa(p.store,m,p.history),V=(u.past&&u.live===p.store?u.past.store:p.store).seenBy(m),w=V===p.store?p:{...p,store:V};Aa(p.store,p.principal);let C=(0,P.jsxs)(P.Fragment,{children:[i||r!==void 0?(0,P.jsx)($o,{onNavigate:i,path:r}):null,o?(0,P.jsx)(Mo,{steering:o}):null,w.presence||g?(0,P.jsx)(No,{context:w,to:g}):null,(0,P.jsx)(Pi,{context:w,...e?{registry:e}:{}}),l?(0,P.jsx)($r,{firstLook:l,root:Ho,app:wn(p.brand,p.store.schema)}):null]}),U=w.views?(0,P.jsxs)(Ca,{store:w.store,views:w.views,...w.principal?{principal:w.principal}:{},...w.brand?{brand:w.brand}:{},...w.locale?{locale:w.locale}:{},...w.settings?{settings:w.settings}:{},...w.presence&&!g?{presence:w.presence}:{},...w.people?{people:w.people}:{},...w.seats?{seats:w.seats}:{},onSeat:Q=>g?g.takeSeat(Q):c({from:t.principal,seat:Q}),...w.onKeepLens?{onKeepLens:w.onKeepLens}:{},...w.ai?{ai:w.ai}:{},...w.subscriptions?{subscriptions:w.subscriptions}:{},...w.signIn?{signIn:w.signIn}:{},resolveApp:w.resolveApp??g?.resolveApp,linkedRecords:w.linkedRecords??g?.linkedRecords,...w.app?{app:w.app}:{},...w.menuSections?{menuSections:w.menuSections}:{},children:[C,(0,P.jsx)(xi,{context:w,children:(0,P.jsx)(oi,{context:w})})]}):C,R=(0,P.jsx)(xa.Provider,{value:u,children:U}),j=w.files?(0,P.jsx)(Sa.Provider,{value:w.files,children:R}):R;if(a!==void 0){let Q=n===void 0?a:`${n.replace(/\/$/,"")}${a}`;return(0,P.jsx)(_r,{initialEntries:[Q],...n===void 0?{}:{basename:n},children:j})}return(0,P.jsx)(Qr,{...n===void 0?{}:{basename:n},children:j})}export{Gi as a,Ko as b};
@@ -1 +1 @@
1
- import{a as M}from"./chunk.PBSMLINK.js";import{a as te,b as oe,c as ae,d as ie,e as C,f as L,g as de}from"./chunk.3TY5NFLY.js";import{a as se}from"./chunk.D75KC3LL.js";import{c as j,e as re}from"./chunk.FWTIUYXH.js";import{a as O,b as Z,c as q,d as Q,f as T,m as ee,n as b,o as ne,p as E}from"./chunk.MAF7C3VM.js";import{b as B,d as le,e as ue,g as ye,h as fe,i as pe}from"./chunk.UGFJKSHU.js";import{B as P,H as W,L as H,N as v,T as $,X as K,ca as x,ea as X,ha as G,ia as A,ja as F,qb as J,ra as z,rb as Y,sb as N}from"./chunk.MNP4JI33.js";var V=e=>e.caption?.trim()||e.name;function je(e){let n=e?.fields?.shape??{};return Object.keys(n).filter(o=>{let r=P(n[o]);for(;r?.innerType;)r=P(r.innerType);return F(n[o])!==void 0||r?.type==="array"&&F(r.element)!==void 0})}function ze(e,n){for(let o of je(n)){let r=A(e[o]).find(G);if(r)return r}}var R=e=>{try{return e()}catch{return null}},we=e=>typeof e=="string"&&te.includes(e);function Ge(e){if(e!==void 0)return we(e)?e:e&&typeof e=="object"&&typeof e.expr=="string"?{expr:R(()=>j(e.expr))}:"neutral"}var Te=4;function Ee(e){let n=typeof e.list=="string"?R(()=>j(e.list)):null,o=e.sort,r=typeof o=="string"?o:o&&typeof o=="object"&&typeof o.by=="string"?o.by:void 0,t=o&&typeof o=="object"?o.direction:void 0,a=n,d;if(n&&r!==void 0)if(t==="choices")d=r;else{let f=R(()=>j(r));a=f?{t:"call",fn:"sort",args:[n,f,{t:"lit",value:t==="desc"?"desc":"asc",at:0}],at:0}:null}let l=typeof e.limit=="number"&&Number.isInteger(e.limit)&&e.limit>=1?Math.min(e.limit,C):void 0,i=e.group,s=typeof i=="string"?i:i&&typeof i=="object"&&typeof i.by=="string"?i.by:void 0,y=i&&typeof i=="object"&&i.headings&&typeof i.headings=="object"?i.headings:{};return{t:"list",source:a,...d?{choiceOrder:d}:{},...l?{limit:l}:{},...s?{group:{by:s,headings:Object.fromEntries(Object.entries(y).filter(f=>typeof f[1]=="string"))}}:{},...typeof e.empty=="string"?{empty:e.empty}:{},as:e.as==="card"?"card":"row"}}function me(e,n=1,o=""){if(!Array.isArray(e)||n>Te)return[];let r={};return e.flatMap(t=>{if(!t||typeof t!="object"||Array.isArray(t))return[];let a=t,d=p=>typeof p=="string"?R(()=>re(p)):null,l=p=>typeof p=="string"?R(()=>j(p)):null,i=Ge(a.tone),s=typeof a.label=="string"?a.label:void 0,y=p=>Object.hasOwn(a,p),f=typeof a.currency=="string"&&/^[A-Z]{3}$/.test(a.currency)?a.currency:void 0,u=y("list")?"list":y("headline")?"headline":typeof a.figure=="string"?"number":Be.find(y);if(!u)return[];let m=r[u]=(r[u]??0)+1,c=a.key,S=typeof c=="string"&&c?c:`${o}${u}.${m}`;return[{...(()=>{switch(u){case"list":return Ee(a);case"number":{let p=ae.includes(a.as)?a.as:void 0,U=ie.includes(a.emphasis)?a.emphasis:void 0;return{t:u,value:l(a.figure),...p?{as:p}:{},...f?{currency:f}:{},...s?{label:d(s)}:{},...U?{emphasis:U}:{}}}case"headline":case"title":return{t:u,parts:d(a[u])};case"text":case"badge":return{t:u,parts:d(a[u]),...i?{tone:i}:{}};case"field":{let p=oe.includes(a.as)?a.as:void 0;return{t:u,field:String(a.field),...p?{as:p}:{},...f?{currency:f}:{},...s?{label:s}:{}}}case"image":return{t:u,field:String(a.image),as:a.as==="gallery"?"gallery":"thumb",...s?{label:s}:{}};case"progress":{let p=a.progress??{};return{t:u,value:l(p.value),max:l(p.max),...s?{label:d(s)}:{}}}case"group":return{t:u,blocks:me(a.group,n+1,`${S}.`),direction:a.direction==="row"?"row":"column"};case"when":return{t:u,when:l(a.when),show:me(a.show,n+1,`${S}.`)};default:return{t:u}}})(),key:S}]})}var Be=["title","text","badge","field","image","progress","group","when","divider","figure"],g="\u2014",Pe=500;function w(e,n){if(!e)return{ok:!1,problem:"an expression that does not parse"};try{return{ok:!0,value:T(e,{graph:n.graph??ee,subject:n.node,kinds:n.kinds,today:n.today,budget:n.budget??Pe})}}catch(o){return{ok:!1,problem:o instanceof Error?o.message:String(o)}}}var ve=(e,n,o)=>!e.format&&e.expr?.t==="ident"&&typeof o=="string"&&n.fields[e.expr.name]?.format==="markdown";function k(e,n,o){if(!e)return{text:g,problem:"a template that does not parse"};let r,t;return{text:e.map(d=>{if(d.text!==void 0)return d.text;let l=w(d.expr??null,n);if(!l.ok)return r??=`{${d.source??""}}: ${l.problem}`,g;if(ve(d,n,l.value))return n.glance?le(l.value,{markdown:!0}):o&&e.length===1?(t=!0,l.value):ue(l.value);let i=!d.format&&d.expr?.t==="ident"&&typeof l.value=="number"?ke(n,d.expr.name):void 0;return ne(d,i?N(l.value,i):b(l.value,d.format,n.today,d.formatArgs,n.money,E(n.schema)))}).join(""),...r?{problem:r}:{},...t?{markdown:t}:{}}}function ce(e,n){if(e===void 0)return;if(typeof e=="string")return e;let o=w(e.expr,n);return o.ok&&we(o.value)?o.value:"neutral"}function xe(e){if(typeof e=="string")try{let n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"?n.href:void 0}catch{return}}var Se=(e,n)=>{let o=e.fields[n]?.type;return o==="phone"||o==="place"||o==="duration"?o:ye(e.definition,n)},ke=(e,n)=>J(e.definition?.fields?.shape?.[n]);function Fe(e,n,o,r,t){if(n==null||n==="")return g;if(typeof n=="boolean")return n?"yes":"no";if(r)return b(n,r,o.today,[],t?{...o.money,currency:t}:o.money);let a=o.fields[e];if(o.definition?.display?.format?.[e])return B(o.definition,e,n);let d=fe(Se(o,e),n,o.money?.locale);if(d!==void 0)return d;if(a?.type==="date")return b(n,"date",o.today,[],o.money);if(a?.type==="datetime"&&typeof n=="string")return H(n,o.money?.locale);if(a?.type==="enum"&&typeof n=="string")return B(o.definition,e,n);let l=typeof n=="number"?ke(o,e):void 0;if(l)return N(n,l);if(typeof n=="number")return v(n,o.money?.locale,{});let i=A(n);return i[0]?i.map(V).join(", "):Array.isArray(n)?n.map(s=>String(s)).join(", "):typeof n=="object"?g:String(n)}function Ne(e,n,o,r,t){return typeof e!="number"?String(e):n==="money"?Y(e,o?{...t,currency:o}:t):n==="percent"?b(e,n,r,[],t):v(e,t?.locale)}var h=(e,n)=>n?{...e,problem:n}:e;function ge(e){return e.firstHeading===void 0?e:{...e,firstHeading:void 0}}function Ce(e,n,o){switch(e.t){case"title":{let r=k(e.parts,n);return h({t:"title",text:r.text},r.problem)}case"text":{let r=k(e.parts,n,!0),t=ce(e.tone,n);return h({t:"text",text:r.text,...t?{tone:t}:{},...r.markdown?{markdown:r.markdown}:{}},r.problem)}case"badge":{let r=k(e.parts,n);return h({t:"badge",text:r.text,tone:ce(e.tone,n)??"neutral"},r.problem)}case"field":{let r=e.label??x(n.definition,e.field);if(!n.node)return{t:"field",field:e.field,label:r,text:g,problem:`"${e.field}" names a field, and these blocks are about no one record`};let t=e.as===void 0?n.kinds.get(n.node.kind)?.linked?.get(e.field):void 0;if(t){let f=z(Object.hasOwn(n.node,e.field)?n.node[e.field]:void 0,t);return{t:"field",field:e.field,label:r,text:f.length>0?"linked record":g,...f.length>0?{linked:{relation:t,refs:f}}:{}}}let a=n.kinds.get(n.node.kind)?.computed?.has(e.field),d,l;if(a){let f=w({t:"ident",name:e.field,at:0},n);f.ok?d=f.value!==null&&typeof f.value=="object"?b(f.value,void 0,n.today,[],n.money,E(n.schema)):f.value:l=f.problem}else d=Object.hasOwn(n.node,e.field)?n.node[e.field]:void 0;let i=e.as!==void 0?void 0:n.fields[e.field]?.type==="url"?xe(d):pe(Se(n,e.field),d),s=R(()=>Fe(e.field,d,n,e.as,e.currency))??g,y=n.fields[e.field]?.type==="app-link"&&e.as===void 0&&typeof d=="string"?d:void 0;return h({t:"field",field:e.field,label:r,text:s,...i?{href:i}:{},...y?{app:y}:{}},l)}case"image":{let r=A(n.node&&Object.hasOwn(n.node,e.field)?n.node[e.field]:null),t=e.as==="gallery"?r:r.filter(G).slice(0,1);return{t:"image",field:e.field,label:e.label??x(n.definition,e.field),as:e.as,files:t,text:t.map(V).join(", ")||g}}case"progress":{let r=w(e.value,n),t=w(e.max,n),a=e.label?k(e.label,n):{text:"Progress"},d=a.text,l=r.ok?t.ok?a.problem:t.problem:r.problem;return r.ok&&t.ok&&typeof r.value=="number"&&typeof t.value=="number"&&Number.isFinite(r.value)&&Number.isFinite(t.value)&&t.value>0?h({t:"progress",label:d,value:r.value,max:t.value,text:`${b(r.value,void 0,n.today)} of ${b(t.value,void 0,n.today)}`},l):h({t:"progress",label:d,text:g},l)}case"group":return{t:"group",direction:e.direction,blocks:he(e.blocks,ge(n))};case"when":{let r=w(e.when,n),t=r.ok&&r.value===!0;return h({t:"when",shown:t,blocks:t?he(e.show,ge(n)):[]},r.ok?void 0:r.problem)}case"divider":return{t:"divider"};case"figure":return{t:"figure"};case"headline":{let r=k(e.parts,n),t=Math.min(6,Math.max(1,(o?n.firstHeading:void 0)??n.heading??3));return h({t:"headline",level:t,text:r.text},r.problem)}case"number":{let r=w(e.value,n),t=!r.ok||r.value===null||typeof r.value=="object"?g:Ne(r.value,e.as,e.currency,n.today,n.money),a=e.label?k(e.label,n):void 0;return h({t:"number",text:t,...a?{label:a.text}:{},...e.emphasis?{emphasis:e.emphasis}:{}},r.ok?a?.problem:r.problem)}case"list":return Me(e,n)}}function he(e,n){let o=e.findIndex(r=>r.t==="headline");return e.map((r,t)=>({...Ce(r,n,t===o),key:r.key}))}var Le=new Set(["every","some","sum","min","max","sort"]);function cn(e,n){let o=new Set,r=new Set,t=i=>{if(i)switch(i.t){case"ident":o.add(i.name);return;case"list":i.items.forEach(t);return;case"member":return t(i.object);case"unary":return t(i.operand);case"binary":return t(i.left),t(i.right);case"where":return t(i.set);case"call":i.args.forEach((s,y)=>{y===1&&Le.has(i.fn)||t(s)});return;default:return}},a=i=>{for(let s of i??[])t(s.expr)},d=(i,s)=>{i.forEach((y,f)=>{let u=s[f];if(u)switch(y.t){case"field":case"image":o.add(y.field);return;case"title":case"text":case"badge":case"headline":a(y.parts);return;case"number":t(y.value),a(y.label);return;case"progress":t(y.value),t(y.max);return;case"group":u.t==="group"&&d(y.blocks,u.blocks);return;case"when":u.t==="when"&&u.shown&&d(y.show,u.blocks);return;case"list":if(u.t==="list")for(let m of u.members)r.add(m.id);return;default:return}})};d(e,n);let l=n[0];return{fields:o,records:r,...e[0]?.t==="title"&&l?.t==="title"?{title:l.text}:{}}}function Me(e,n){let o=Math.min(6,(n.heading??3)+1),r=w(e.source,n);if(!r.ok)return{t:"list",as:e.as,failed:!0,members:[],headingLevel:o,more:0,problem:r.problem};let t=r.value,a=t instanceof O?t.nodes:t!==null&&typeof t=="object"&&!Array.isArray(t)?[t]:[];e.choiceOrder&&n.schema&&(a=Ve(a,e.choiceOrder,n.schema));let d=a.length,l=a.slice(0,e.limit??C),i=l.slice(0,L),s=l.slice(L),y=(e.limit===void 0?d:l.length)-i.length,f=c=>e.group&&n.schema&&c.length>0?_e(c,e.group,n.schema,n.graph):void 0,u=f(i),m=s.length>0?f(l):void 0;return{t:"list",as:e.as,failed:!1,members:i,...s.length>0?{rest:s}:{},...u?{groups:u}:{},...m?{everyGroup:m}:{},headingLevel:o,...i.length===0&&e.empty?{empty:e.empty}:{},more:y,total:d}}function _(e,n,o){let r=e.tryDefinition(n)?.fields?.shape,t=r&&Object.hasOwn(r,o)?M(r[o]):void 0;return t?.type==="enum"?t.options??[]:[]}var I=(e,n)=>Object.hasOwn(e,n)?e[n]:void 0;function Ve(e,n,o){let r=t=>{let a=_(o,t.kind,n).indexOf(String(I(t,n)));return a<0?Number.MAX_SAFE_INTEGER:a};return e.map((t,a)=>({node:t,i:a,rank:r(t)})).sort((t,a)=>t.rank-a.rank||t.i-a.i).map(t=>t.node)}function _e(e,n,o,r){let t=e.some(i=>_(o,i.kind,n.by).length>0)?void 0:de(n.by);if(t&&r)return Ie(e,t,n.headings,o,r);let a=[];for(let i of e)for(let s of _(o,i.kind,n.by))a.includes(s)||a.push(s);let d=[];for(let i of a){let s=e.filter(f=>I(f,n.by)===i);if(s.length===0)continue;let y=o.tryDefinition(s[0].kind);d.push({value:i,heading:n.headings[i]??$(B(y,n.by,i)),members:s})}let l=e.filter(i=>!a.includes(String(I(i,n.by))));return l.length>0&&d.push({value:null,members:l}),d}function Ie(e,n,o,r,t){let a=u=>n.way??(Object.hasOwn(r.tryDefinition(u.kind)?.edges??{},n.edge)?"out":"in"),d=new Map,l=[],i=E(r),s;for(let u of e){let m=a(u)==="out"?t.out(u.id,n.edge):t.in(u.id,n.edge);m.length===0&&l.push(u);for(let c of m){s??=c.kind;let S=d.get(c.id)??{node:c,members:[]};S.members.push(u),d.set(c.id,S)}}let y=[...d.values()].map(({node:u,members:m})=>({value:u.id,heading:o[u.id]??i(u),members:m})).sort((u,m)=>u.heading.localeCompare(m.heading,void 0,{numeric:!0}));!s&&e[0]&&a(e[0])==="out"&&(s=(r.tryDefinition(e[0].kind)?.edges??{})[n.edge]?.to?.[0]);let f=s&&s!=="*"?X(r.tryDefinition(s),s):void 0;return l.length>0&&y.push({value:null,...f?{heading:`No ${f}`}:{},members:l}),y}function be(e){return e.t==="list"||e.t==="headline"||e.t==="number"||e.t==="image"&&e.as==="gallery"?!0:e.t==="group"?e.blocks.some(be):e.t==="when"?e.show.some(be):!1}function Re(e,n){let o=e.tryDefinition(n)?.fields?.shape??{},r={};for(let[t,a]of Object.entries(o)){let d=M(a);d&&(r[t]=d)}return r}var Ae=new WeakMap;function D(e){let n=Ae.get(e);return n||Ae.set(e,n=se(e)),n}function De(e,n,o,r={}){let t=D(e),a={},d={},l=i=>{if(i instanceof O)return i.nodes.map(s=>l(s));if(Array.isArray(i))return i.map(s=>l(s));if(i!==null&&typeof i=="object"){let s=i;return{id:s.id,kind:s.kind,label:K(e.tryDefinition(s.kind),s)}}return i};for(let[i,s]of t.get(o?o.kind:q)?.computed??[])try{let y=[],f=T(s,{graph:n,subject:o,kinds:t,...r.today?{today:r.today}:{},...r.budget?{budget:r.budget}:{},...r.linked?{linked:r.linked}:{},onUnread:u=>y.push(u)});y.length>0&&(f===null||f instanceof O&&f.nodes.length===0)?d[i]=Z(y[0]):a[i]=l(f)}catch(y){if(!(y instanceof Q))throw y;d[i]=y.sentence}return{values:a,refused:d}}function Sn(e,n,o){let{values:r}=De(e,n,o);if(Object.keys(r).length===0)return o;let t=a=>Array.isArray(a)?a.map(t):a!==null&&typeof a=="object"?a.label:a;return{...o,...Object.fromEntries(Object.entries(r).map(([a,d])=>[a,t(d)]))}}var Ue=500,We=2e4,Oe=new WeakMap;function He(e,n){let o=Oe.get(e);o||Oe.set(e,o=new Map);let r=o.get(n);return r||o.set(n,r=Re(e,n)),r}function jn(e,n,o,r={}){if(n&&typeof e.seenBy!="function")throw new TypeError("blockContextFor: a seat is read from a store (its `seenBy`); a bare { graph, schema } is read as it is handed, with no principal");let t=n?e.seenBy(n):e,a=n&&o?t.graph.getNode(o.id)??null:o,d=t.schema,l=a&&d.tryDefinition(a.kind),i=!a||(r.slot??"page")==="page",{money:s,firstHeading:y}=r;return{node:a,graph:t.graph,schema:d,kinds:D(d),fields:a?He(d,a.kind):{},definition:l||void 0,today:r.today??t.today?.()??W(),money:s,heading:r.heading??(i?2:3),firstHeading:y,budget:r.budget??(i?We:Ue),...i?{}:{glance:!0}}}export{V as a,je as b,ze as c,me as d,he as e,cn as f,be as g,De as h,Sn as i,jn as j};
1
+ import{a as M}from"./chunk.PPUAPAWR.js";import{a as te,b as oe,c as ae,d as ie,e as C,f as L,g as de}from"./chunk.IHFNLKXV.js";import{a as se}from"./chunk.577PGFUT.js";import{c as j,e as re}from"./chunk.FBY5IUGU.js";import{a as O,b as Z,c as q,d as Q,f as T,m as ee,n as b,o as ne,p as E}from"./chunk.4K5QCJFH.js";import{b as B,d as le,e as ue,g as ye,h as fe,i as pe}from"./chunk.FSAHO3LV.js";import{B as P,H as W,L as H,N as v,T as $,X as K,ca as x,ea as X,ha as G,ia as A,ja as F,qb as J,ra as z,rb as Y,sb as N}from"./chunk.X7W27IRI.js";var V=e=>e.caption?.trim()||e.name;function je(e){let n=e?.fields?.shape??{};return Object.keys(n).filter(o=>{let r=P(n[o]);for(;r?.innerType;)r=P(r.innerType);return F(n[o])!==void 0||r?.type==="array"&&F(r.element)!==void 0})}function ze(e,n){for(let o of je(n)){let r=A(e[o]).find(G);if(r)return r}}var R=e=>{try{return e()}catch{return null}},we=e=>typeof e=="string"&&te.includes(e);function Ge(e){if(e!==void 0)return we(e)?e:e&&typeof e=="object"&&typeof e.expr=="string"?{expr:R(()=>j(e.expr))}:"neutral"}var Te=4;function Ee(e){let n=typeof e.list=="string"?R(()=>j(e.list)):null,o=e.sort,r=typeof o=="string"?o:o&&typeof o=="object"&&typeof o.by=="string"?o.by:void 0,t=o&&typeof o=="object"?o.direction:void 0,a=n,d;if(n&&r!==void 0)if(t==="choices")d=r;else{let f=R(()=>j(r));a=f?{t:"call",fn:"sort",args:[n,f,{t:"lit",value:t==="desc"?"desc":"asc",at:0}],at:0}:null}let l=typeof e.limit=="number"&&Number.isInteger(e.limit)&&e.limit>=1?Math.min(e.limit,C):void 0,i=e.group,s=typeof i=="string"?i:i&&typeof i=="object"&&typeof i.by=="string"?i.by:void 0,y=i&&typeof i=="object"&&i.headings&&typeof i.headings=="object"?i.headings:{};return{t:"list",source:a,...d?{choiceOrder:d}:{},...l?{limit:l}:{},...s?{group:{by:s,headings:Object.fromEntries(Object.entries(y).filter(f=>typeof f[1]=="string"))}}:{},...typeof e.empty=="string"?{empty:e.empty}:{},as:e.as==="card"?"card":"row"}}function me(e,n=1,o=""){if(!Array.isArray(e)||n>Te)return[];let r={};return e.flatMap(t=>{if(!t||typeof t!="object"||Array.isArray(t))return[];let a=t,d=p=>typeof p=="string"?R(()=>re(p)):null,l=p=>typeof p=="string"?R(()=>j(p)):null,i=Ge(a.tone),s=typeof a.label=="string"?a.label:void 0,y=p=>Object.hasOwn(a,p),f=typeof a.currency=="string"&&/^[A-Z]{3}$/.test(a.currency)?a.currency:void 0,u=y("list")?"list":y("headline")?"headline":typeof a.figure=="string"?"number":Be.find(y);if(!u)return[];let m=r[u]=(r[u]??0)+1,c=a.key,S=typeof c=="string"&&c?c:`${o}${u}.${m}`;return[{...(()=>{switch(u){case"list":return Ee(a);case"number":{let p=ae.includes(a.as)?a.as:void 0,U=ie.includes(a.emphasis)?a.emphasis:void 0;return{t:u,value:l(a.figure),...p?{as:p}:{},...f?{currency:f}:{},...s?{label:d(s)}:{},...U?{emphasis:U}:{}}}case"headline":case"title":return{t:u,parts:d(a[u])};case"text":case"badge":return{t:u,parts:d(a[u]),...i?{tone:i}:{}};case"field":{let p=oe.includes(a.as)?a.as:void 0;return{t:u,field:String(a.field),...p?{as:p}:{},...f?{currency:f}:{},...s?{label:s}:{}}}case"image":return{t:u,field:String(a.image),as:a.as==="gallery"?"gallery":"thumb",...s?{label:s}:{}};case"progress":{let p=a.progress??{};return{t:u,value:l(p.value),max:l(p.max),...s?{label:d(s)}:{}}}case"group":return{t:u,blocks:me(a.group,n+1,`${S}.`),direction:a.direction==="row"?"row":"column"};case"when":return{t:u,when:l(a.when),show:me(a.show,n+1,`${S}.`)};default:return{t:u}}})(),key:S}]})}var Be=["title","text","badge","field","image","progress","group","when","divider","figure"],g="\u2014",Pe=500;function w(e,n){if(!e)return{ok:!1,problem:"an expression that does not parse"};try{return{ok:!0,value:T(e,{graph:n.graph??ee,subject:n.node,kinds:n.kinds,today:n.today,budget:n.budget??Pe})}}catch(o){return{ok:!1,problem:o instanceof Error?o.message:String(o)}}}var ve=(e,n,o)=>!e.format&&e.expr?.t==="ident"&&typeof o=="string"&&n.fields[e.expr.name]?.format==="markdown";function k(e,n,o){if(!e)return{text:g,problem:"a template that does not parse"};let r,t;return{text:e.map(d=>{if(d.text!==void 0)return d.text;let l=w(d.expr??null,n);if(!l.ok)return r??=`{${d.source??""}}: ${l.problem}`,g;if(ve(d,n,l.value))return n.glance?le(l.value,{markdown:!0}):o&&e.length===1?(t=!0,l.value):ue(l.value);let i=!d.format&&d.expr?.t==="ident"&&typeof l.value=="number"?ke(n,d.expr.name):void 0;return ne(d,i?N(l.value,i):b(l.value,d.format,n.today,d.formatArgs,n.money,E(n.schema)))}).join(""),...r?{problem:r}:{},...t?{markdown:t}:{}}}function ce(e,n){if(e===void 0)return;if(typeof e=="string")return e;let o=w(e.expr,n);return o.ok&&we(o.value)?o.value:"neutral"}function xe(e){if(typeof e=="string")try{let n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"?n.href:void 0}catch{return}}var Se=(e,n)=>{let o=e.fields[n]?.type;return o==="phone"||o==="place"||o==="duration"?o:ye(e.definition,n)},ke=(e,n)=>J(e.definition?.fields?.shape?.[n]);function Fe(e,n,o,r,t){if(n==null||n==="")return g;if(typeof n=="boolean")return n?"yes":"no";if(r)return b(n,r,o.today,[],t?{...o.money,currency:t}:o.money);let a=o.fields[e];if(o.definition?.display?.format?.[e])return B(o.definition,e,n);let d=fe(Se(o,e),n,o.money?.locale);if(d!==void 0)return d;if(a?.type==="date")return b(n,"date",o.today,[],o.money);if(a?.type==="datetime"&&typeof n=="string")return H(n,o.money?.locale);if(a?.type==="enum"&&typeof n=="string")return B(o.definition,e,n);let l=typeof n=="number"?ke(o,e):void 0;if(l)return N(n,l);if(typeof n=="number")return v(n,o.money?.locale,{});let i=A(n);return i[0]?i.map(V).join(", "):Array.isArray(n)?n.map(s=>String(s)).join(", "):typeof n=="object"?g:String(n)}function Ne(e,n,o,r,t){return typeof e!="number"?String(e):n==="money"?Y(e,o?{...t,currency:o}:t):n==="percent"?b(e,n,r,[],t):v(e,t?.locale)}var h=(e,n)=>n?{...e,problem:n}:e;function ge(e){return e.firstHeading===void 0?e:{...e,firstHeading:void 0}}function Ce(e,n,o){switch(e.t){case"title":{let r=k(e.parts,n);return h({t:"title",text:r.text},r.problem)}case"text":{let r=k(e.parts,n,!0),t=ce(e.tone,n);return h({t:"text",text:r.text,...t?{tone:t}:{},...r.markdown?{markdown:r.markdown}:{}},r.problem)}case"badge":{let r=k(e.parts,n);return h({t:"badge",text:r.text,tone:ce(e.tone,n)??"neutral"},r.problem)}case"field":{let r=e.label??x(n.definition,e.field);if(!n.node)return{t:"field",field:e.field,label:r,text:g,problem:`"${e.field}" names a field, and these blocks are about no one record`};let t=e.as===void 0?n.kinds.get(n.node.kind)?.linked?.get(e.field):void 0;if(t){let f=z(Object.hasOwn(n.node,e.field)?n.node[e.field]:void 0,t);return{t:"field",field:e.field,label:r,text:f.length>0?"linked record":g,...f.length>0?{linked:{relation:t,refs:f}}:{}}}let a=n.kinds.get(n.node.kind)?.computed?.has(e.field),d,l;if(a){let f=w({t:"ident",name:e.field,at:0},n);f.ok?d=f.value!==null&&typeof f.value=="object"?b(f.value,void 0,n.today,[],n.money,E(n.schema)):f.value:l=f.problem}else d=Object.hasOwn(n.node,e.field)?n.node[e.field]:void 0;let i=e.as!==void 0?void 0:n.fields[e.field]?.type==="url"?xe(d):pe(Se(n,e.field),d),s=R(()=>Fe(e.field,d,n,e.as,e.currency))??g,y=n.fields[e.field]?.type==="app-link"&&e.as===void 0&&typeof d=="string"?d:void 0;return h({t:"field",field:e.field,label:r,text:s,...i?{href:i}:{},...y?{app:y}:{}},l)}case"image":{let r=A(n.node&&Object.hasOwn(n.node,e.field)?n.node[e.field]:null),t=e.as==="gallery"?r:r.filter(G).slice(0,1);return{t:"image",field:e.field,label:e.label??x(n.definition,e.field),as:e.as,files:t,text:t.map(V).join(", ")||g}}case"progress":{let r=w(e.value,n),t=w(e.max,n),a=e.label?k(e.label,n):{text:"Progress"},d=a.text,l=r.ok?t.ok?a.problem:t.problem:r.problem;return r.ok&&t.ok&&typeof r.value=="number"&&typeof t.value=="number"&&Number.isFinite(r.value)&&Number.isFinite(t.value)&&t.value>0?h({t:"progress",label:d,value:r.value,max:t.value,text:`${b(r.value,void 0,n.today)} of ${b(t.value,void 0,n.today)}`},l):h({t:"progress",label:d,text:g},l)}case"group":return{t:"group",direction:e.direction,blocks:he(e.blocks,ge(n))};case"when":{let r=w(e.when,n),t=r.ok&&r.value===!0;return h({t:"when",shown:t,blocks:t?he(e.show,ge(n)):[]},r.ok?void 0:r.problem)}case"divider":return{t:"divider"};case"figure":return{t:"figure"};case"headline":{let r=k(e.parts,n),t=Math.min(6,Math.max(1,(o?n.firstHeading:void 0)??n.heading??3));return h({t:"headline",level:t,text:r.text},r.problem)}case"number":{let r=w(e.value,n),t=!r.ok||r.value===null||typeof r.value=="object"?g:Ne(r.value,e.as,e.currency,n.today,n.money),a=e.label?k(e.label,n):void 0;return h({t:"number",text:t,...a?{label:a.text}:{},...e.emphasis?{emphasis:e.emphasis}:{}},r.ok?a?.problem:r.problem)}case"list":return Me(e,n)}}function he(e,n){let o=e.findIndex(r=>r.t==="headline");return e.map((r,t)=>({...Ce(r,n,t===o),key:r.key}))}var Le=new Set(["every","some","sum","min","max","sort"]);function cn(e,n){let o=new Set,r=new Set,t=i=>{if(i)switch(i.t){case"ident":o.add(i.name);return;case"list":i.items.forEach(t);return;case"member":return t(i.object);case"unary":return t(i.operand);case"binary":return t(i.left),t(i.right);case"where":return t(i.set);case"call":i.args.forEach((s,y)=>{y===1&&Le.has(i.fn)||t(s)});return;default:return}},a=i=>{for(let s of i??[])t(s.expr)},d=(i,s)=>{i.forEach((y,f)=>{let u=s[f];if(u)switch(y.t){case"field":case"image":o.add(y.field);return;case"title":case"text":case"badge":case"headline":a(y.parts);return;case"number":t(y.value),a(y.label);return;case"progress":t(y.value),t(y.max);return;case"group":u.t==="group"&&d(y.blocks,u.blocks);return;case"when":u.t==="when"&&u.shown&&d(y.show,u.blocks);return;case"list":if(u.t==="list")for(let m of u.members)r.add(m.id);return;default:return}})};d(e,n);let l=n[0];return{fields:o,records:r,...e[0]?.t==="title"&&l?.t==="title"?{title:l.text}:{}}}function Me(e,n){let o=Math.min(6,(n.heading??3)+1),r=w(e.source,n);if(!r.ok)return{t:"list",as:e.as,failed:!0,members:[],headingLevel:o,more:0,problem:r.problem};let t=r.value,a=t instanceof O?t.nodes:t!==null&&typeof t=="object"&&!Array.isArray(t)?[t]:[];e.choiceOrder&&n.schema&&(a=Ve(a,e.choiceOrder,n.schema));let d=a.length,l=a.slice(0,e.limit??C),i=l.slice(0,L),s=l.slice(L),y=(e.limit===void 0?d:l.length)-i.length,f=c=>e.group&&n.schema&&c.length>0?_e(c,e.group,n.schema,n.graph):void 0,u=f(i),m=s.length>0?f(l):void 0;return{t:"list",as:e.as,failed:!1,members:i,...s.length>0?{rest:s}:{},...u?{groups:u}:{},...m?{everyGroup:m}:{},headingLevel:o,...i.length===0&&e.empty?{empty:e.empty}:{},more:y,total:d}}function _(e,n,o){let r=e.tryDefinition(n)?.fields?.shape,t=r&&Object.hasOwn(r,o)?M(r[o]):void 0;return t?.type==="enum"?t.options??[]:[]}var I=(e,n)=>Object.hasOwn(e,n)?e[n]:void 0;function Ve(e,n,o){let r=t=>{let a=_(o,t.kind,n).indexOf(String(I(t,n)));return a<0?Number.MAX_SAFE_INTEGER:a};return e.map((t,a)=>({node:t,i:a,rank:r(t)})).sort((t,a)=>t.rank-a.rank||t.i-a.i).map(t=>t.node)}function _e(e,n,o,r){let t=e.some(i=>_(o,i.kind,n.by).length>0)?void 0:de(n.by);if(t&&r)return Ie(e,t,n.headings,o,r);let a=[];for(let i of e)for(let s of _(o,i.kind,n.by))a.includes(s)||a.push(s);let d=[];for(let i of a){let s=e.filter(f=>I(f,n.by)===i);if(s.length===0)continue;let y=o.tryDefinition(s[0].kind);d.push({value:i,heading:n.headings[i]??$(B(y,n.by,i)),members:s})}let l=e.filter(i=>!a.includes(String(I(i,n.by))));return l.length>0&&d.push({value:null,members:l}),d}function Ie(e,n,o,r,t){let a=u=>n.way??(Object.hasOwn(r.tryDefinition(u.kind)?.edges??{},n.edge)?"out":"in"),d=new Map,l=[],i=E(r),s;for(let u of e){let m=a(u)==="out"?t.out(u.id,n.edge):t.in(u.id,n.edge);m.length===0&&l.push(u);for(let c of m){s??=c.kind;let S=d.get(c.id)??{node:c,members:[]};S.members.push(u),d.set(c.id,S)}}let y=[...d.values()].map(({node:u,members:m})=>({value:u.id,heading:o[u.id]??i(u),members:m})).sort((u,m)=>u.heading.localeCompare(m.heading,void 0,{numeric:!0}));!s&&e[0]&&a(e[0])==="out"&&(s=(r.tryDefinition(e[0].kind)?.edges??{})[n.edge]?.to?.[0]);let f=s&&s!=="*"?X(r.tryDefinition(s),s):void 0;return l.length>0&&y.push({value:null,...f?{heading:`No ${f}`}:{},members:l}),y}function be(e){return e.t==="list"||e.t==="headline"||e.t==="number"||e.t==="image"&&e.as==="gallery"?!0:e.t==="group"?e.blocks.some(be):e.t==="when"?e.show.some(be):!1}function Re(e,n){let o=e.tryDefinition(n)?.fields?.shape??{},r={};for(let[t,a]of Object.entries(o)){let d=M(a);d&&(r[t]=d)}return r}var Ae=new WeakMap;function D(e){let n=Ae.get(e);return n||Ae.set(e,n=se(e)),n}function De(e,n,o,r={}){let t=D(e),a={},d={},l=i=>{if(i instanceof O)return i.nodes.map(s=>l(s));if(Array.isArray(i))return i.map(s=>l(s));if(i!==null&&typeof i=="object"){let s=i;return{id:s.id,kind:s.kind,label:K(e.tryDefinition(s.kind),s)}}return i};for(let[i,s]of t.get(o?o.kind:q)?.computed??[])try{let y=[],f=T(s,{graph:n,subject:o,kinds:t,...r.today?{today:r.today}:{},...r.budget?{budget:r.budget}:{},...r.linked?{linked:r.linked}:{},onUnread:u=>y.push(u)});y.length>0&&(f===null||f instanceof O&&f.nodes.length===0)?d[i]=Z(y[0]):a[i]=l(f)}catch(y){if(!(y instanceof Q))throw y;d[i]=y.sentence}return{values:a,refused:d}}function Sn(e,n,o){let{values:r}=De(e,n,o);if(Object.keys(r).length===0)return o;let t=a=>Array.isArray(a)?a.map(t):a!==null&&typeof a=="object"?a.label:a;return{...o,...Object.fromEntries(Object.entries(r).map(([a,d])=>[a,t(d)]))}}var Ue=500,We=2e4,Oe=new WeakMap;function He(e,n){let o=Oe.get(e);o||Oe.set(e,o=new Map);let r=o.get(n);return r||o.set(n,r=Re(e,n)),r}function jn(e,n,o,r={}){if(n&&typeof e.seenBy!="function")throw new TypeError("blockContextFor: a seat is read from a store (its `seenBy`); a bare { graph, schema } is read as it is handed, with no principal");let t=n?e.seenBy(n):e,a=n&&o?t.graph.getNode(o.id)??null:o,d=t.schema,l=a&&d.tryDefinition(a.kind),i=!a||(r.slot??"page")==="page",{money:s,firstHeading:y}=r;return{node:a,graph:t.graph,schema:d,kinds:D(d),fields:a?He(d,a.kind):{},definition:l||void 0,today:r.today??t.today?.()??W(),money:s,heading:r.heading??(i?2:3),firstHeading:y,budget:r.budget??(i?We:Ue),...i?{}:{glance:!0}}}export{V as a,je as b,ze as c,me as d,he as e,cn as f,be as g,De as h,Sn as i,jn as j};
@@ -1 +1 @@
1
- import{g as a}from"./chunk.FWTIUYXH.js";import{c as p}from"./chunk.MAF7C3VM.js";import{ua as d}from"./chunk.MNP4JI33.js";function v(n){let r=new Map;for(let i of n.kinds){let e=n.tryDefinition(i),o=a(e),s=d(e);r.set(i,{fields:new Set(Object.keys(e?.fields?.shape??{})),edges:new Map(Object.entries(e?.edges??{}).map(([l,h])=>[l,h.cardinality??"many"])),...o?{computed:o}:{},...s.size>0?{linked:s}:{}})}let t=a(n);return t&&r.set(p,{computed:t}),r}export{v as a};
1
+ import{g as a}from"./chunk.FBY5IUGU.js";import{c as p}from"./chunk.4K5QCJFH.js";import{ua as d}from"./chunk.X7W27IRI.js";function v(n){let r=new Map;for(let i of n.kinds){let e=n.tryDefinition(i),o=a(e),s=d(e);r.set(i,{fields:new Set(Object.keys(e?.fields?.shape??{})),edges:new Map(Object.entries(e?.edges??{}).map(([l,h])=>[l,h.cardinality??"many"])),...o?{computed:o}:{},...s.size>0?{linked:s}:{}})}let t=a(n);return t&&r.set(p,{computed:t}),r}export{v as a};
@@ -1 +1 @@
1
- import{a as I,c as x}from"./chunk.7T7NZZTC.js";import"./chunk.JOOQUWLT.js";import{c as b,d as A,k as v,r as w,t as O,w as G}from"./chunk.6QWV5MVH.js";import{Ac as k,Pc as E,Vc as S,Wc as W}from"./chunk.MNP4JI33.js";import"./chunk.AJZBJBMO.js";var F=(e,i)=>k(e,i).slice(1);function j(e,i){let l=e.split("/").filter(Boolean);return l.length===i.length&&l.every((s,h)=>s.startsWith(":")||s==="*"||s===i[h])}var $=["problems","search","map","places"];function R(e,i,l,s,h=[]){let{schema:r}=i,o=r.kinds,f=t=>{if(t.startsWith(w))return(t.slice(w.length).split("|")[0]??"").split("+").every(V=>o.includes(V));let y=O(t);return y!==null?o.includes(y):t.startsWith("edge:")||l.graph.getNode(t)!==void 0},[p="/",u]=e.path.split("?"),n=p.split("/").filter(Boolean),m=u?`?${u}`:"",d=n.length>0&&!$.includes(n[0])?o.find(t=>F(r,t)===n[0]):void 0,c=e.path;if(n[0]==="places"&&n.length===2)`/places/${n[1]}`!==E&&!s.some(t=>t.as===decodeURIComponent(n[1]))&&(c="/");else if(d){let t=n[1]===void 0?void 0:decodeURIComponent(n[1]);c=`/${F(r,d)}${t!==void 0&&l.graph.getNode(t)?.kind===d?`/${n[1]}`:""}${m}`}else n.length>0&&n.length<=2&&!$.includes(n[0])&&!h.some(t=>j(t.path,n))&&(c="/");let g=A(e.stop),P=g.within?.view,U=P!==void 0&&!s.some(t=>t.as===P),a=g;if(U){let{view:t,...y}=g.within??{};a={...a,within:y}}if(g.focusId&&!f(g.focusId)){let t=e.kind&&o.includes(e.kind)?G(e.kind):null;a={...v(a,t),zoom:!1}}return a={...a,relation:a.relation&&(o.includes(a.relation)||r.edgeKinds.includes(a.relation))?a.relation:null,expanded:a.expanded.filter(f),pins:Object.fromEntries(Object.entries(a.pins).filter(([t])=>f(t))),...a.selection?{selection:a.selection.filter(f)}:{}},{face:e.face,path:c,stop:b(a),...e.kind?{kind:e.kind}:{}}}function B(e,i,l){let s=e.at,h=e.pages?.routes()??[];if(e.routing!=="address"||typeof window>"u")return R(s,e.app,i,l,h);let{pathname:r,search:o,hash:f}=window.location,p=W(r,e.basePath),u=I({routing:"address",...e.basePath===void 0?{}:{basePath:e.basePath},face:s.face}),n=u==="pages",m={...s,face:u,...p===null?{}:n?{path:p+o}:{stop:x(e.basePath)??s.stop}},d=R(m,e.app,i,l,h),c=n?d.path===m.path?null:S(d.path,e.basePath===void 0?{}:{basePath:e.basePath}):d.stop===b(A(m.stop))?null:r+o+d.stop;return p!==null&&c!==null&&c!==r+o+f&&window.history.replaceState(window.history.state,"",c),d}export{R as settle,B as settleAt};
1
+ import{a as I,c as x}from"./chunk.ZZTDQKM2.js";import"./chunk.Y5Z4ZDTO.js";import{c as b,d as A,k as v,r as w,t as O,w as G}from"./chunk.UWIYKGYK.js";import{Bc as k,Qc as E,Wc as S,Xc as W}from"./chunk.X7W27IRI.js";import"./chunk.AJZBJBMO.js";var F=(e,i)=>k(e,i).slice(1);function j(e,i){let l=e.split("/").filter(Boolean);return l.length===i.length&&l.every((s,h)=>s.startsWith(":")||s==="*"||s===i[h])}var $=["problems","search","map","places"];function R(e,i,l,s,h=[]){let{schema:r}=i,o=r.kinds,f=t=>{if(t.startsWith(w))return(t.slice(w.length).split("|")[0]??"").split("+").every(V=>o.includes(V));let y=O(t);return y!==null?o.includes(y):t.startsWith("edge:")||l.graph.getNode(t)!==void 0},[p="/",u]=e.path.split("?"),n=p.split("/").filter(Boolean),m=u?`?${u}`:"",d=n.length>0&&!$.includes(n[0])?o.find(t=>F(r,t)===n[0]):void 0,c=e.path;if(n[0]==="places"&&n.length===2)`/places/${n[1]}`!==E&&!s.some(t=>t.as===decodeURIComponent(n[1]))&&(c="/");else if(d){let t=n[1]===void 0?void 0:decodeURIComponent(n[1]);c=`/${F(r,d)}${t!==void 0&&l.graph.getNode(t)?.kind===d?`/${n[1]}`:""}${m}`}else n.length>0&&n.length<=2&&!$.includes(n[0])&&!h.some(t=>j(t.path,n))&&(c="/");let g=A(e.stop),P=g.within?.view,U=P!==void 0&&!s.some(t=>t.as===P),a=g;if(U){let{view:t,...y}=g.within??{};a={...a,within:y}}if(g.focusId&&!f(g.focusId)){let t=e.kind&&o.includes(e.kind)?G(e.kind):null;a={...v(a,t),zoom:!1}}return a={...a,relation:a.relation&&(o.includes(a.relation)||r.edgeKinds.includes(a.relation))?a.relation:null,expanded:a.expanded.filter(f),pins:Object.fromEntries(Object.entries(a.pins).filter(([t])=>f(t))),...a.selection?{selection:a.selection.filter(f)}:{}},{face:e.face,path:c,stop:b(a),...e.kind?{kind:e.kind}:{}}}function B(e,i,l){let s=e.at,h=e.pages?.routes()??[];if(e.routing!=="address"||typeof window>"u")return R(s,e.app,i,l,h);let{pathname:r,search:o,hash:f}=window.location,p=W(r,e.basePath),u=I({routing:"address",...e.basePath===void 0?{}:{basePath:e.basePath},face:s.face}),n=u==="pages",m={...s,face:u,...p===null?{}:n?{path:p+o}:{stop:x(e.basePath)??s.stop}},d=R(m,e.app,i,l,h),c=n?d.path===m.path?null:S(d.path,e.basePath===void 0?{}:{basePath:e.basePath}):d.stop===b(A(m.stop))?null:r+o+d.stop;return p!==null&&c!==null&&c!==r+o+f&&window.history.replaceState(window.history.state,"",c),d}export{R as settle,B as settleAt};
@@ -1 +1 @@
1
- import{a as H,b as I,c as j,e as R,h as V,i as D,j as A,k,l as x,n as Y,o as Z}from"./chunk.DAZ2VSRD.js";import{b as U}from"./chunk.6YCBYL2Y.js";import{H as C,K as G,Ka as T,Na as B,Q as M,X as W,Z as F}from"./chunk.MNP4JI33.js";function re(e,r){return e===void 0||e===!0?!0:e===!1?!1:e[r]!==!1}function te(e){let r={};return e.query&&e.query.trim().length>0&&(r.q=e.query),e.archived!==void 0&&e.archived!==!1&&(r.archived=String(e.archived)),e.sort&&(r.sort=e.sort.direction==="desc"?`${e.sort.by}:desc`:e.sort.by),e.filter?.length&&(r.filter=e.filter.map(n=>`${n.key}:${n.value}`).join(",")),e.group&&(r.group=e.group.bucket?`${e.group.by}:${e.group.bucket}`:e.group.by),r}function ne(e,r){let n=[],s={};if(e.query&&(s.query=e.query),e.archived!==void 0&&e.archived!==!1&&(s.archived=e.archived),e.sort&&(r.sorts.some(u=>u.key===e.sort.by)?s.sort=e.sort:n.push(`sort ${e.sort.by}`)),e.filter){let u=e.filter.filter(c=>r.filters.find(l=>l.key===c.key)?!0:(n.push(`filter ${c.key}`),!1));u.length>0&&(s.filter=u)}return e.group&&(r.groups.some(u=>u.key===e.group.by)?s.group=e.group:n.push(`group ${e.group.by}`)),{arrangement:s,dropped:n}}function S(e,r){return W(e.schema.tryDefinition(r.kind),A(r))}var oe=(e,r)=>e==null?r==null?0:1:r==null?-1:typeof e=="number"&&typeof r=="number"?e-r:typeof e=="boolean"&&typeof r=="boolean"?e===r?0:e?1:-1:String(e).localeCompare(String(r),void 0,{numeric:!0,sensitivity:"base"});function ie(e,r,n){if(n==="label")return S(e,r);let s=e.schema.tryDefinition(r.kind);return s&&n in(s.fields.shape??{})?T(D(r),n,e.today??C()):s?.computed?.[n]!==void 0?e.read?.(r,n):k(e.graph,r.id,n).map(c=>S(e,c)).sort()[0]}var se=/^(\d{4})-(\d{2})-(\d{2})/;function _(e,r){let n=se.exec(e);if(!n)return;let[,s,u,c]=n;if(r==="day")return`${s}-${u}-${c}`;if(r==="month")return`${s}-${u}-01`;if(r==="year")return`${s}-01-01`;if(r==="decade")return`${String(Number(s)-Number(s)%10).padStart(4,"0")}-01-01`;let a=new Date(Date.UTC(Number(s),Number(u)-1,Number(c))),l=(a.getUTCDay()+6)%7;return a.setUTCDate(a.getUTCDate()-l),a.toISOString().slice(0,10)}function de(e,r){return r==="month"?M(e):r==="week"?`Week of ${G(e)}`:r==="year"?e.slice(0,4):r==="decade"?`The ${e.slice(0,4)}s`:G(e)}function ue(e,r,n){return z(e,n)(r)}function z(e,r){let{words:n,conditions:s}=Y(r);if(n.length===0&&s.length===0)return()=>!0;let u=new Map,c=a=>{let l=u.get(a);return l||(l=new Set(R(e.schema,a).filters.map(d=>d.key)),u.set(a,l)),l};return a=>{let l=c(a.kind),d=s.filter(i=>l.has(i.key));return d.every(i=>x(e,a,i))?n.length>0?Z(e.schema.tryDefinition(a.kind),A(a),n)!==void 0:d.length>0:!1}}function ae(e,r,n){let s=r.query?.trim(),u=r.archived===void 0?e:e.filter(t=>B(t,r.archived)),c=s?u.filter(z(n,s)):u,a=r.filter?.length?c.filter(t=>r.filter.every(f=>x(n,t,f))):[...c],l=[];for(let t=r.sort;t&&l.length<4;t=t.then)l.push(t);let d=l.length>0?a.map((t,f)=>({node:t,index:f,values:l.map(o=>ie(n,t,o.by))})).sort((t,f)=>{for(let[o,p]of l.entries()){let[h,K]=[t.values[o],f.values[o]],v=oe(h,K),E=p.direction==="desc"&&v!==0&&h!==void 0&&K!==void 0?-v:v;if(E!==0)return E}return t.index-f.index}).map(t=>t.node):a,i=r.group;if(!i)return{nodes:d,groups:[{key:"",label:"",nodes:d}],grouped:!1};let y=new Map,g=(t,f,o)=>{let p=y.get(t)??{label:f,nodes:[]};p.nodes.push(o),y.set(t,p)},N=d[0],m=N?n.schema.tryDefinition(N.kind):void 0,O=m?.fields.shape??{},J=m?H(m,i.by):F(i.by),$=i.by in O,b=$?I(O[i.by]):void 0,X=j(n.schema,N?.kind??"").find(t=>t.key===i.by)?.label,L=$?`No ${J.toLowerCase()}`:`Without ${(X??F(i.by)).toLowerCase()}`,q=$?new Map:U([...new Map(d.flatMap(t=>k(n.graph,t.id,i.by)).map(t=>[t.id,t])).values()].map(A),t=>n.schema.tryDefinition(t));for(let t of d){if($){let o=T(D(t),i.by,n.today??C());if(o==null||o==="")g("",L,t);else if(b==="date"){let p=i.bucket??"day",h=_(String(o),p);h?g(h,de(h,p),t):g("",L,t)}else if(b==="boolean")g(o?"1":"0",o?"Yes":"No",t);else{let p=m?.display?.format?.[i.by];g(String(o),p?p(o):String(o),t)}continue}let f=k(n.graph,t.id,i.by).map(o=>({id:o.id,label:q.has(o.id)?`${S(n,o)} \xB7 ${q.get(o.id)}`:S(n,o)})).sort((o,p)=>o.label.localeCompare(p.label));f.length===0?g("",L,t):g(f.map(o=>o.id).join(","),f.map(o=>o.label).join(", "),t)}let w=b==="choice"?V(O[i.by]):void 0,ee=[...y.entries()].sort(([t,f],[o,p])=>t===""?1:o===""?-1:w?w.indexOf(t)-w.indexOf(o):b==="boolean"?o.localeCompare(t):b==="date"?t.localeCompare(o):f.label.localeCompare(p.label)).map(([t,f])=>({key:t,label:f.label,nodes:f.nodes}));return{nodes:d,groups:ee,grouped:!0}}function P(e){if(e===void 0)return;if(typeof e=="string")return{by:e,direction:"asc"};let r=e.then===void 0?void 0:typeof e.then=="string"?{by:e.then,direction:"asc"}:{by:e.then.by,direction:e.then.direction??"asc"};return{by:e.by,direction:e.direction??"asc",...r?{then:r}:{}}}function Q(e){if(e!==void 0)return typeof e=="string"?{by:e}:e}function le(e){let r=P(e?.sort),n=Q(e?.group);if(!(!r&&!n))return{...r?{sort:r}:{},...n?{group:{by:n.by}}:{}}}var fe=(e,r)=>r?e==="1"?"true":"false":e;function ce(e,r,n){let s=n.type==="boolean",u=s?["true","false"]:n.options??[],c=[...new Set([...(r.order??[]).filter(d=>u.includes(d)),...u])],a=r.closed??[],l=d=>{if(d.key==="")return[1,0];let i=fe(d.key,s);if(a.includes(i))return[2,a.indexOf(i)];let y=c.indexOf(i);return[0,y<0?c.length:y]};return e.map((d,i)=>({group:d,at:i,rank:l(d)})).sort((d,i)=>d.rank[0]-i.rank[0]||d.rank[1]-i.rank[1]||d.at-i.at).map(({group:d,rank:i})=>({...d,closed:i[0]===2}))}export{Q as a,le as b,ce as c,re as d,te as e,ne as f,ue as g,ae as h};
1
+ import{a as H,b as I,c as j,e as R,h as V,i as D,j as A,k,l as x,n as Y,o as Z}from"./chunk.YT2CYCVT.js";import{b as U}from"./chunk.RIW7SQH4.js";import{H as C,K as G,Ka as T,Na as B,Q as M,X as W,Z as F}from"./chunk.X7W27IRI.js";function re(e,r){return e===void 0||e===!0?!0:e===!1?!1:e[r]!==!1}function te(e){let r={};return e.query&&e.query.trim().length>0&&(r.q=e.query),e.archived!==void 0&&e.archived!==!1&&(r.archived=String(e.archived)),e.sort&&(r.sort=e.sort.direction==="desc"?`${e.sort.by}:desc`:e.sort.by),e.filter?.length&&(r.filter=e.filter.map(n=>`${n.key}:${n.value}`).join(",")),e.group&&(r.group=e.group.bucket?`${e.group.by}:${e.group.bucket}`:e.group.by),r}function ne(e,r){let n=[],s={};if(e.query&&(s.query=e.query),e.archived!==void 0&&e.archived!==!1&&(s.archived=e.archived),e.sort&&(r.sorts.some(u=>u.key===e.sort.by)?s.sort=e.sort:n.push(`sort ${e.sort.by}`)),e.filter){let u=e.filter.filter(c=>r.filters.find(l=>l.key===c.key)?!0:(n.push(`filter ${c.key}`),!1));u.length>0&&(s.filter=u)}return e.group&&(r.groups.some(u=>u.key===e.group.by)?s.group=e.group:n.push(`group ${e.group.by}`)),{arrangement:s,dropped:n}}function S(e,r){return W(e.schema.tryDefinition(r.kind),A(r))}var oe=(e,r)=>e==null?r==null?0:1:r==null?-1:typeof e=="number"&&typeof r=="number"?e-r:typeof e=="boolean"&&typeof r=="boolean"?e===r?0:e?1:-1:String(e).localeCompare(String(r),void 0,{numeric:!0,sensitivity:"base"});function ie(e,r,n){if(n==="label")return S(e,r);let s=e.schema.tryDefinition(r.kind);return s&&n in(s.fields.shape??{})?T(D(r),n,e.today??C()):s?.computed?.[n]!==void 0?e.read?.(r,n):k(e.graph,r.id,n).map(c=>S(e,c)).sort()[0]}var se=/^(\d{4})-(\d{2})-(\d{2})/;function _(e,r){let n=se.exec(e);if(!n)return;let[,s,u,c]=n;if(r==="day")return`${s}-${u}-${c}`;if(r==="month")return`${s}-${u}-01`;if(r==="year")return`${s}-01-01`;if(r==="decade")return`${String(Number(s)-Number(s)%10).padStart(4,"0")}-01-01`;let a=new Date(Date.UTC(Number(s),Number(u)-1,Number(c))),l=(a.getUTCDay()+6)%7;return a.setUTCDate(a.getUTCDate()-l),a.toISOString().slice(0,10)}function de(e,r){return r==="month"?M(e):r==="week"?`Week of ${G(e)}`:r==="year"?e.slice(0,4):r==="decade"?`The ${e.slice(0,4)}s`:G(e)}function ue(e,r,n){return z(e,n)(r)}function z(e,r){let{words:n,conditions:s}=Y(r);if(n.length===0&&s.length===0)return()=>!0;let u=new Map,c=a=>{let l=u.get(a);return l||(l=new Set(R(e.schema,a).filters.map(d=>d.key)),u.set(a,l)),l};return a=>{let l=c(a.kind),d=s.filter(i=>l.has(i.key));return d.every(i=>x(e,a,i))?n.length>0?Z(e.schema.tryDefinition(a.kind),A(a),n)!==void 0:d.length>0:!1}}function ae(e,r,n){let s=r.query?.trim(),u=r.archived===void 0?e:e.filter(t=>B(t,r.archived)),c=s?u.filter(z(n,s)):u,a=r.filter?.length?c.filter(t=>r.filter.every(f=>x(n,t,f))):[...c],l=[];for(let t=r.sort;t&&l.length<4;t=t.then)l.push(t);let d=l.length>0?a.map((t,f)=>({node:t,index:f,values:l.map(o=>ie(n,t,o.by))})).sort((t,f)=>{for(let[o,p]of l.entries()){let[h,K]=[t.values[o],f.values[o]],v=oe(h,K),E=p.direction==="desc"&&v!==0&&h!==void 0&&K!==void 0?-v:v;if(E!==0)return E}return t.index-f.index}).map(t=>t.node):a,i=r.group;if(!i)return{nodes:d,groups:[{key:"",label:"",nodes:d}],grouped:!1};let y=new Map,g=(t,f,o)=>{let p=y.get(t)??{label:f,nodes:[]};p.nodes.push(o),y.set(t,p)},N=d[0],m=N?n.schema.tryDefinition(N.kind):void 0,O=m?.fields.shape??{},J=m?H(m,i.by):F(i.by),$=i.by in O,b=$?I(O[i.by]):void 0,X=j(n.schema,N?.kind??"").find(t=>t.key===i.by)?.label,L=$?`No ${J.toLowerCase()}`:`Without ${(X??F(i.by)).toLowerCase()}`,q=$?new Map:U([...new Map(d.flatMap(t=>k(n.graph,t.id,i.by)).map(t=>[t.id,t])).values()].map(A),t=>n.schema.tryDefinition(t));for(let t of d){if($){let o=T(D(t),i.by,n.today??C());if(o==null||o==="")g("",L,t);else if(b==="date"){let p=i.bucket??"day",h=_(String(o),p);h?g(h,de(h,p),t):g("",L,t)}else if(b==="boolean")g(o?"1":"0",o?"Yes":"No",t);else{let p=m?.display?.format?.[i.by];g(String(o),p?p(o):String(o),t)}continue}let f=k(n.graph,t.id,i.by).map(o=>({id:o.id,label:q.has(o.id)?`${S(n,o)} \xB7 ${q.get(o.id)}`:S(n,o)})).sort((o,p)=>o.label.localeCompare(p.label));f.length===0?g("",L,t):g(f.map(o=>o.id).join(","),f.map(o=>o.label).join(", "),t)}let w=b==="choice"?V(O[i.by]):void 0,ee=[...y.entries()].sort(([t,f],[o,p])=>t===""?1:o===""?-1:w?w.indexOf(t)-w.indexOf(o):b==="boolean"?o.localeCompare(t):b==="date"?t.localeCompare(o):f.label.localeCompare(p.label)).map(([t,f])=>({key:t,label:f.label,nodes:f.nodes}));return{nodes:d,groups:ee,grouped:!0}}function P(e){if(e===void 0)return;if(typeof e=="string")return{by:e,direction:"asc"};let r=e.then===void 0?void 0:typeof e.then=="string"?{by:e.then,direction:"asc"}:{by:e.then.by,direction:e.then.direction??"asc"};return{by:e.by,direction:e.direction??"asc",...r?{then:r}:{}}}function Q(e){if(e!==void 0)return typeof e=="string"?{by:e}:e}function le(e){let r=P(e?.sort),n=Q(e?.group);if(!(!r&&!n))return{...r?{sort:r}:{},...n?{group:{by:n.by}}:{}}}var fe=(e,r)=>r?e==="1"?"true":"false":e;function ce(e,r,n){let s=n.type==="boolean",u=s?["true","false"]:n.options??[],c=[...new Set([...(r.order??[]).filter(d=>u.includes(d)),...u])],a=r.closed??[],l=d=>{if(d.key==="")return[1,0];let i=fe(d.key,s);if(a.includes(i))return[2,a.indexOf(i)];let y=c.indexOf(i);return[0,y<0?c.length:y]};return e.map((d,i)=>({group:d,at:i,rank:l(d)})).sort((d,i)=>d.rank[0]-i.rank[0]||d.rank[1]-i.rank[1]||d.at-i.at).map(({group:d,rank:i})=>({...d,closed:i[0]===2}))}export{Q as a,le as b,ce as c,re as d,te as e,ne as f,ue as g,ae as h};
@@ -1 +1 @@
1
- import{e as L}from"./chunk.63GXY2ME.js";import{a as R,b as O,c as v,d as P}from"./chunk.UGFDSE37.js";import"./chunk.67TPUXAY.js";import"./chunk.Y6ZNFQK3.js";import"./chunk.NRAYZY3X.js";import"./chunk.RIJUCHP4.js";import"./chunk.TAQ764IQ.js";import"./chunk.YIR7PPF3.js";import"./chunk.3HXN4BOY.js";import"./chunk.GYICGZMG.js";import"./chunk.UHUGOTUU.js";import"./chunk.47STJVRV.js";import"./chunk.EBGAYL32.js";import"./chunk.DAZ2VSRD.js";import"./chunk.J25KOSNW.js";import"./chunk.LR3VDXPI.js";import"./chunk.CWHRDBOF.js";import"./chunk.3K6YSVHC.js";import"./chunk.SHTJZ6UX.js";import{a as E,b as T}from"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.ULRW47RP.js";import"./chunk.PBSMLINK.js";import"./chunk.3TY5NFLY.js";import"./chunk.D75KC3LL.js";import"./chunk.FWTIUYXH.js";import"./chunk.MAF7C3VM.js";import"./chunk.GZHZLJBF.js";import"./chunk.XMC7YDWT.js";import"./chunk.6UGEYZAC.js";import"./chunk.OJGHDWI6.js";import"./chunk.B2GLDIAS.js";import"./chunk.6YCBYL2Y.js";import"./chunk.UGFJKSHU.js";import"./chunk.JOOQUWLT.js";import{F as D,Q as C,ta as x}from"./chunk.6QWV5MVH.js";import{ec as k}from"./chunk.MNP4JI33.js";import{b as S}from"./chunk.AJZBJBMO.js";var o=S(D(),1);var i=S(C(),1);function W(c){let e=document.activeElement;if(e!==null&&e!==document.body&&e!==document.documentElement&&e.isConnected)return;let r=c??document,a=r.querySelector("main")??r.querySelector("[data-graview-page]")??null,n=r.querySelector("[data-graview-page-title]")??a?.querySelector("h1, h2")??a;n instanceof HTMLElement&&(n.hasAttribute("tabindex")||n.setAttribute("tabindex","-1"),n.focus({preventScroll:!0}))}var H=1500;function z(c,e,r){let{store:a,principal:n}=c,u=L(a),l=(0,o.useMemo)(()=>R(a,n),[a,n,u]),b=(0,o.useRef)(r),[p,m]=(0,o.useState)(),[s,f]=(0,o.useState)("");(0,o.useEffect)(()=>{let t=O(a,n,b.current);b.current=a.batches().length,t&&(m({batch:t.batch,at:e,when:Date.now()}),f(""))},[a,n,u]),(0,o.useEffect)(()=>{m(t=>!t||t.at===e?t:Date.now()-t.when<H?{...t,at:e}:void 0)},[e]);let[g,h]=(0,o.useState)(null),y=(0,o.useCallback)(()=>{m(void 0),h(null)},[]),w=(0,o.useCallback)(()=>{h(null);try{let t=P(a,n);t&&f(`Took back \u201C${t.intent}\u201D`)}catch(t){h(t instanceof Error?t.message:String(t))}},[a,n]),d=l&&p?.batch===l.batch&&p.at===e?l:void 0;return{change:l,offered:d,close:y,takeBack:w,refused:g,said:s}}function Y({context:c,docked:e,at:r,since:a}){let{change:n,offered:u,close:l,takeBack:b,refused:p,said:m}=z(c,r,a),s=e?u:n,f=(0,o.useRef)(null),g=e&&(s!==void 0||p!==null);B(f,g),(0,o.useEffect)(()=>{if(!g)return;let d,t=()=>d=setTimeout(()=>f.current?.matches(":hover, :focus-within")?t():l(),1e4);return t(),()=>clearTimeout(d)},[g,s?.batch,p,l]);let h=m||(e&&s?v(s):""),y=e?{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:k("toast"),width:"max-content",height:"auto",bottom:"calc(16px + env(safe-area-inset-bottom, 0px))",left:16,justifyItems:"start",color:"var(--graview-ink)",...g?{}:{display:"none"}}:{},w=s?(0,i.jsxs)("button",{type:"button","data-testid":"page-undo",title:`${v(s)} \u2014 \u2318Z or Ctrl+Z`,"aria-keyshortcuts":"Meta+Z Control+Z",onClick:d=>{let t=d.currentTarget.closest("[data-graview-face]");b(),requestAnimationFrame(()=>W(t))},style:e?I:A,children:[(0,i.jsx)("span",{"aria-hidden":"true",children:"\u21B6"}),(0,i.jsx)("span",{style:e?j:F,children:v(s)})]}):null;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{role:"status","aria-live":"polite",style:N,children:h}),(0,i.jsxs)("div",{ref:f,...e?{popover:"manual","data-graview-foot":"","data-graview-offstage":""}:{},"data-testid":e?"face-undo-dock":"page-undo-place",style:{display:"grid",justifyItems:"end",gap:4,maxWidth:"100%",minWidth:0,...y},children:[e&&s?(0,i.jsxs)("div",{"data-testid":"page-undo-notice",style:_,children:[w,(0,i.jsx)("button",{type:"button","data-testid":"page-undo-dismiss","aria-label":`Dismiss: ${v(s)}`,title:"Dismiss",onClick:d=>{let t=d.currentTarget.closest("[data-graview-face]");l(),requestAnimationFrame(()=>W(t))},style:q,children:"\xD7"})]}):w,p?(0,i.jsx)("span",{"data-testid":"page-undo-refused",role:"alert",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-warn)",background:e?"var(--graview-float)":void 0,padding:e?"4px 8px":void 0,borderRadius:6},children:p}):null]})]})}function B(c,e){(0,o.useLayoutEffect)(()=>{let r=c.current;if(!r||!e)return;if(typeof r.showPopover=="function"&&!x(r))try{r.showPopover()}catch{}let a=()=>r.parentElement?.closest("[data-embed-content]")??null,n=()=>{T(r,a()),dispatchEvent(new Event(E))};n(),addEventListener("resize",n),addEventListener("scroll",n,!0);let u=typeof ResizeObserver=="function"?new ResizeObserver(n):null;return u?.observe(r),()=>{if(u?.disconnect(),removeEventListener("resize",n),removeEventListener("scroll",n,!0),r.isConnected&&x(r))try{r.hidePopover()}catch{}dispatchEvent(new Event(E))}},[c,e])}var A={display:"inline-flex",alignItems:"center",gap:6,minHeight:36,maxWidth:"100%",minWidth:0,padding:"0 14px",borderRadius:999,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",font:"inherit",fontSize:"0.875rem",cursor:"pointer"},I={...A,textAlign:"start",lineHeight:1.4,padding:"8px 4px 8px 14px",border:"none",background:"none",color:"inherit"},_={display:"flex",alignItems:"center",gap:2,maxWidth:"100%",minWidth:0,paddingRight:6,borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},q={flex:"0 0 auto",minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"1rem",cursor:"pointer"},F={minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},j={minWidth:0,overflow:"hidden",overflowWrap:"anywhere",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:4},N={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};export{Y as TakeBack};
1
+ import{e as L}from"./chunk.5MCC54VM.js";import{a as R,b as O,c as v,d as P}from"./chunk.UGFDSE37.js";import"./chunk.3QXHII5W.js";import"./chunk.AINNENYD.js";import"./chunk.SBBNIYVB.js";import"./chunk.IX6RNGAT.js";import"./chunk.3H4NVUWV.js";import"./chunk.XSYBNUXF.js";import"./chunk.GCVO6N26.js";import"./chunk.LRRVBM4F.js";import"./chunk.H243UV3Z.js";import"./chunk.PKKA6JWA.js";import"./chunk.5EAQDBBE.js";import"./chunk.YT2CYCVT.js";import"./chunk.KWCML3BF.js";import"./chunk.DLT3EE4D.js";import"./chunk.2OBIO5Y6.js";import"./chunk.GF7LA4QG.js";import"./chunk.AEHPDVLQ.js";import{a as E,b as T}from"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.52QAIGCD.js";import"./chunk.PPUAPAWR.js";import"./chunk.IHFNLKXV.js";import"./chunk.577PGFUT.js";import"./chunk.FBY5IUGU.js";import"./chunk.4K5QCJFH.js";import"./chunk.GZHZLJBF.js";import"./chunk.QRMWFEEH.js";import"./chunk.MVN6H65Q.js";import"./chunk.OJGHDWI6.js";import"./chunk.Z7ZCR4LN.js";import"./chunk.RIW7SQH4.js";import"./chunk.FSAHO3LV.js";import"./chunk.Y5Z4ZDTO.js";import{F as D,Q as C,ta as x}from"./chunk.UWIYKGYK.js";import{fc as k}from"./chunk.X7W27IRI.js";import{b as S}from"./chunk.AJZBJBMO.js";var o=S(D(),1);var i=S(C(),1);function W(c){let e=document.activeElement;if(e!==null&&e!==document.body&&e!==document.documentElement&&e.isConnected)return;let r=c??document,a=r.querySelector("main")??r.querySelector("[data-graview-page]")??null,n=r.querySelector("[data-graview-page-title]")??a?.querySelector("h1, h2")??a;n instanceof HTMLElement&&(n.hasAttribute("tabindex")||n.setAttribute("tabindex","-1"),n.focus({preventScroll:!0}))}var H=1500;function z(c,e,r){let{store:a,principal:n}=c,u=L(a),l=(0,o.useMemo)(()=>R(a,n),[a,n,u]),b=(0,o.useRef)(r),[p,m]=(0,o.useState)(),[s,f]=(0,o.useState)("");(0,o.useEffect)(()=>{let t=O(a,n,b.current);b.current=a.batches().length,t&&(m({batch:t.batch,at:e,when:Date.now()}),f(""))},[a,n,u]),(0,o.useEffect)(()=>{m(t=>!t||t.at===e?t:Date.now()-t.when<H?{...t,at:e}:void 0)},[e]);let[g,h]=(0,o.useState)(null),y=(0,o.useCallback)(()=>{m(void 0),h(null)},[]),w=(0,o.useCallback)(()=>{h(null);try{let t=P(a,n);t&&f(`Took back \u201C${t.intent}\u201D`)}catch(t){h(t instanceof Error?t.message:String(t))}},[a,n]),d=l&&p?.batch===l.batch&&p.at===e?l:void 0;return{change:l,offered:d,close:y,takeBack:w,refused:g,said:s}}function Y({context:c,docked:e,at:r,since:a}){let{change:n,offered:u,close:l,takeBack:b,refused:p,said:m}=z(c,r,a),s=e?u:n,f=(0,o.useRef)(null),g=e&&(s!==void 0||p!==null);B(f,g),(0,o.useEffect)(()=>{if(!g)return;let d,t=()=>d=setTimeout(()=>f.current?.matches(":hover, :focus-within")?t():l(),1e4);return t(),()=>clearTimeout(d)},[g,s?.batch,p,l]);let h=m||(e&&s?v(s):""),y=e?{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:k("toast"),width:"max-content",height:"auto",bottom:"calc(16px + env(safe-area-inset-bottom, 0px))",left:16,justifyItems:"start",color:"var(--graview-ink)",...g?{}:{display:"none"}}:{},w=s?(0,i.jsxs)("button",{type:"button","data-testid":"page-undo",title:`${v(s)} \u2014 \u2318Z or Ctrl+Z`,"aria-keyshortcuts":"Meta+Z Control+Z",onClick:d=>{let t=d.currentTarget.closest("[data-graview-face]");b(),requestAnimationFrame(()=>W(t))},style:e?I:A,children:[(0,i.jsx)("span",{"aria-hidden":"true",children:"\u21B6"}),(0,i.jsx)("span",{style:e?j:F,children:v(s)})]}):null;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{role:"status","aria-live":"polite",style:N,children:h}),(0,i.jsxs)("div",{ref:f,...e?{popover:"manual","data-graview-foot":"","data-graview-offstage":""}:{},"data-testid":e?"face-undo-dock":"page-undo-place",style:{display:"grid",justifyItems:"end",gap:4,maxWidth:"100%",minWidth:0,...y},children:[e&&s?(0,i.jsxs)("div",{"data-testid":"page-undo-notice",style:_,children:[w,(0,i.jsx)("button",{type:"button","data-testid":"page-undo-dismiss","aria-label":`Dismiss: ${v(s)}`,title:"Dismiss",onClick:d=>{let t=d.currentTarget.closest("[data-graview-face]");l(),requestAnimationFrame(()=>W(t))},style:q,children:"\xD7"})]}):w,p?(0,i.jsx)("span",{"data-testid":"page-undo-refused",role:"alert",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-warn)",background:e?"var(--graview-float)":void 0,padding:e?"4px 8px":void 0,borderRadius:6},children:p}):null]})]})}function B(c,e){(0,o.useLayoutEffect)(()=>{let r=c.current;if(!r||!e)return;if(typeof r.showPopover=="function"&&!x(r))try{r.showPopover()}catch{}let a=()=>r.parentElement?.closest("[data-embed-content]")??null,n=()=>{T(r,a()),dispatchEvent(new Event(E))};n(),addEventListener("resize",n),addEventListener("scroll",n,!0);let u=typeof ResizeObserver=="function"?new ResizeObserver(n):null;return u?.observe(r),()=>{if(u?.disconnect(),removeEventListener("resize",n),removeEventListener("scroll",n,!0),r.isConnected&&x(r))try{r.hidePopover()}catch{}dispatchEvent(new Event(E))}},[c,e])}var A={display:"inline-flex",alignItems:"center",gap:6,minHeight:36,maxWidth:"100%",minWidth:0,padding:"0 14px",borderRadius:999,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",font:"inherit",fontSize:"0.875rem",cursor:"pointer"},I={...A,textAlign:"start",lineHeight:1.4,padding:"8px 4px 8px 14px",border:"none",background:"none",color:"inherit"},_={display:"flex",alignItems:"center",gap:2,maxWidth:"100%",minWidth:0,paddingRight:6,borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},q={flex:"0 0 auto",minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"1rem",cursor:"pointer"},F={minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},j={minWidth:0,overflow:"hidden",overflowWrap:"anywhere",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:4},N={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};export{Y as TakeBack};
@@ -0,0 +1 @@
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{n as v}from"./chunk.Y5Z4ZDTO.js";import{F as P,I as w,Q as p,Y as R,a as A,xa as b}from"./chunk.UWIYKGYK.js";import{Rc as h}from"./chunk.X7W27IRI.js";import{b as a}from"./chunk.AJZBJBMO.js";var L=a(p(),1),B=v.part(e=>(0,L.jsx)(e.ActivityRail,{calls:[]}),{quiet:!0});var l=a(P(),1),S=a(p(),1),C=b(A(()=>(__graviewPreload(import.meta.url,["./chunk.RTB4MMF6.js","./chunk.6J7DR7XQ.js","./chunk.VWHMYPLL.js","./chunk.DLT3EE4D.js","./chunk.3C4RJIJU.js","./chunk.DPP7ITTU.js","./chunk.GF7LA4QG.js","./chunk.AEHPDVLQ.js","./chunk.UT6642FC.js","./chunk.TI4OSTQV.js","./chunk.GZHZLJBF.js","./chunk.QRMWFEEH.js","./chunk.MVN6H65Q.js","./chunk.OJGHDWI6.js","./chunk.Z7ZCR4LN.js","./chunk.RIW7SQH4.js","./chunk.FSAHO3LV.js","./chunk.Y5Z4ZDTO.js","./chunk.UWIYKGYK.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.TIBZZ2WY.js")))),F=C.part((e,r)=>{let t=e.RecordInteractions;return(0,S.jsx)(t,{...r})},{quiet:!0});function I(e,r,t){let o=e.target;return(o.on==="record"||o.on==="field"?o.id===r:o.on==="selection"?o.ids.includes(r):o.on==="act"?o.id===r:!1)||e.offered.some(n=>n.id===`record:${r}`||n.id.startsWith(`fill:${r}:`))||(e.batches??[]).some(n=>t(n).includes(r))}function T({id:e,style:r,headingStyle:t,className:o}){let{ai:d,aiDesk:n,store:f}=R(),{entries:y}=w(n),s=d.off===!0;(0,l.useEffect)(()=>{s||n.load()},[n,s]);let g=f.log.length,m=(0,l.useMemo)(()=>{let x=u=>f.log.all().flatMap(k=>k.batch===u?k.writes:[]);return y.filter(u=>I(u,e,x))},[y,e,f,g]);return s||m.length===0?null:(0,S.jsx)(l.Suspense,{fallback:null,children:(0,S.jsx)(F,{entries:m,...r?{style:r}:{},...t?{headingStyle:t}:{},...o?{className:o}:{}})})}var c=a(P(),1),i=a(p(),1);function ro({context:e,stop:r,title:t,label:o,style:d,className:n,children:f,...y}){let s=h(e.views?.arrangement?.()),g=f??(0,i.jsxs)(i.Fragment,{children:["In ",s==="Scene"?"the scene":s.replace(/^The /,"the ")," ",(0,i.jsx)("span",{"aria-hidden":"true",children:"\u2197"})]}),m=o?{"aria-label":o}:{};if(e.overview){let x=e.overview;return(0,i.jsx)("a",{href:r,...y,...m,...t?{title:t}:{},style:d,...n?{className:n}:{},onClick:u=>{u.preventDefault(),x(r)},children:g})}return e.embedded?null:(0,i.jsx)("a",{href:`${e.sceneHref??"/"}${r}`,...y,...m,...t?{title:t}:{},style:d,...n?{className:n}:{},children:g})}function oo(){return(0,i.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:e=>{e.preventDefault();let r=new URL(window.location.href);r.searchParams.set("fresh","1"),window.location.assign(r.toString())},style:{color:"inherit",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24},children:"Start fresh"})}function to(e){let r=(0,c.useRef)(0),t=(0,c.useCallback)(o=>e.subscribe(()=>{r.current+=1,o()}),[e]);return(0,c.useSyncExternalStore)(t,()=>r.current,()=>0)}export{B as a,T as b,ro as c,oo as d,to as e};
@@ -1 +1 @@
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{l as k,n as M,o as I,p as B,s as P}from"./chunk.B2GLDIAS.js";import"./chunk.6YCBYL2Y.js";import"./chunk.UGFJKSHU.js";import"./chunk.JOOQUWLT.js";import{F as te,Q as W,a as L,xa as q}from"./chunk.6QWV5MVH.js";import"./chunk.MNP4JI33.js";import{b as h}from"./chunk.AJZBJBMO.js";var r=h(te(),1);var A=h(W(),1),U=q(L(()=>(__graviewPreload(import.meta.url,["./chunk.JOOQUWLT.js","./chunk.6QWV5MVH.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.T5VG5A6V.js")))),v={Part:U.part((n,t)=>(0,A.jsx)(n.WhenMonth,{...t}),{quiet:!0}),prefetch:()=>U.prefetch()};var o=h(W(),1),z="try \u201Ctomorrow 3pm\u201D, \u201CFri 10:30\u201D or \u201C17 Oct\u201D";function K(n,t,d,p=!1){let S=Date.UTC(+n.day.slice(0,4),+n.day.slice(5,7)-1,+n.day.slice(8,10),0,t?n.minutes??0:0),g={weekday:p?"long":"short",year:"numeric",month:p?"long":"short",day:"numeric",...t?{hour:"numeric",minute:"2-digit"}:{},timeZone:"UTC"},m;try{m=new Intl.DateTimeFormat(d??"en-US",g)}catch{m=new Intl.DateTimeFormat("en-US",g)}return m.format(S).replace(/ /g," ")}function ce({value:n,time:t,instant:d=!1,label:p,name:S,required:g,autoFocus:m,autoSelect:H,locale:s,onChange:j,onLeave:_,onCancel:V,inputRef:w,boxStyle:Z}){let x=(0,r.useId)(),u=(0,r.useRef)(null),D=(0,r.useRef)(null),b=e=>{let a=M(e);return a?K(a,t,s):e??""},[T,C]=(0,r.useState)(()=>b(n)),[F,y]=(0,r.useState)(!1),[G,E]=(0,r.useState)(n),[J,Q]=(0,r.useState)(n);n!==J&&(Q(n),n!==G&&(E(n),C(b(n)))),(0,r.useEffect)(()=>{H&&(u.current?.focus(),u.current?.select())},[H]);let i=t&&d?B(s):void 0,N=T===b(n),l=M(n),c=N?l:P(T,{today:k().day,time:t,...l?{base:l}:{},...s?{locale:s}:{}}),X=N?n:c?I(c,{time:t,instant:d}):void 0,$=T.trim()==="",f=!$&&c===void 0;(0,r.useEffect)(()=>{u.current?.setCustomValidity(f?`Not a date this reads \u2014 ${z}`:"")},[f]);let O=e=>{E(e),j(e)},Y=e=>{C(e);let a=e.trim()===""?void 0:P(e,{today:k().day,time:t,...l?{base:l}:{},...s?{locale:s}:{}});O(a?I(a,{time:t,instant:d}):void 0)},ee=e=>{let a=t?{day:e,minutes:c?.minutes??l?.minutes??540}:{day:e},R=I(a,{time:t,instant:d});C(b(R)),O(R),y(!1),requestAnimationFrame(()=>{u.current?.focus(),u.current?.select()})},ne=$?`Type a date, or pick one \u2014 ${z}`:f?`Not a date this reads \u2014 ${z}`:c?`${K(c,t,s,!0)}${i?` ${i.short}`:""}`:"";return(0,o.jsxs)("span",{"data-graview-when":t?d?"instant":"moment":"day",style:{display:"inline-flex",flex:"1 1 14rem",flexWrap:"wrap",alignItems:"center",gap:"4px 6px",maxWidth:"100%",minWidth:0},onBlur:e=>{let a=e.relatedTarget;a&&e.currentTarget.contains(a)||!a&&typeof document<"u"&&!document.hasFocus()||(y(!1),_?.(X))},children:[(0,o.jsx)("input",{ref:e=>{u.current=e,typeof w=="function"?w(e):w&&(w.current=e)},type:"text",name:S,required:g,autoFocus:m,"aria-label":p,"aria-describedby":`${x}-said`,"aria-invalid":f||void 0,autoComplete:"off",spellCheck:!1,enterKeyHint:"done",placeholder:t?"tomorrow 3pm":"17 Oct",value:T,"data-graview-part":"control",onChange:e=>Y(e.target.value),onKeyDown:e=>{e.key==="Escape"?(e.preventDefault(),V?.()):e.key==="ArrowDown"&&e.altKey&&(e.preventDefault(),y(!0))},style:{flex:"1 1 12ch",minWidth:"10ch",maxWidth:"100%",boxSizing:"border-box",font:"inherit",...Z}}),(0,o.jsx)("button",{ref:D,type:"button","aria-label":`Pick a date for ${p}`,"aria-expanded":F,"aria-controls":`${x}-month`,"data-graview-part":"when-pick",onClick:()=>y(e=>!e),onPointerEnter:()=>v.prefetch(),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:32,minHeight:32,padding:0,borderRadius:6},children:(0,o.jsxs)("svg",{"aria-hidden":"true",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:[(0,o.jsx)("rect",{x:"2",y:"3",width:"12",height:"11",rx:"1.5"}),(0,o.jsx)("path",{d:"M2 6.5h12M5.5 1.5v3M10.5 1.5v3"})]})}),(0,o.jsxs)("span",{id:`${x}-said`,"aria-live":"polite","data-graview-part":"when-said",...i?{"data-graview-zone":i.zone,title:`Times are in ${i.zone.replace(/_/g," ")} (${i.short})`}:{},style:{flexBasis:"100%",fontSize:"0.75rem",color:f?"var(--graview-bad)":"var(--graview-ink-faint)"},children:[ne,i&&!f&&!$?(0,o.jsx)("span",{"data-graview-part":"when-zone",children:` \xB7 ${(i.zone.split("/").at(-1)??i.zone).replace(/_/g," ")} time`}):null]}),F?(0,o.jsx)(r.Suspense,{fallback:null,children:(0,o.jsx)(v.Part,{id:`${x}-month`,label:p,selected:c?.day??l?.day,today:k().day,locale:s,onPick:ee,onClose:()=>{y(!1),D.current?.focus()}})}):null]})}export{ce as WhenInput,K as wallAsRead};
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{l as k,n as M,o as I,p as B,s as P}from"./chunk.Z7ZCR4LN.js";import"./chunk.RIW7SQH4.js";import"./chunk.FSAHO3LV.js";import"./chunk.Y5Z4ZDTO.js";import{F as te,Q as W,a as L,xa as q}from"./chunk.UWIYKGYK.js";import"./chunk.X7W27IRI.js";import{b as h}from"./chunk.AJZBJBMO.js";var r=h(te(),1);var A=h(W(),1),U=q(L(()=>(__graviewPreload(import.meta.url,["./chunk.Y5Z4ZDTO.js","./chunk.UWIYKGYK.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.A3F7MFDR.js")))),v={Part:U.part((n,t)=>(0,A.jsx)(n.WhenMonth,{...t}),{quiet:!0}),prefetch:()=>U.prefetch()};var o=h(W(),1),z="try \u201Ctomorrow 3pm\u201D, \u201CFri 10:30\u201D or \u201C17 Oct\u201D";function K(n,t,d,p=!1){let S=Date.UTC(+n.day.slice(0,4),+n.day.slice(5,7)-1,+n.day.slice(8,10),0,t?n.minutes??0:0),g={weekday:p?"long":"short",year:"numeric",month:p?"long":"short",day:"numeric",...t?{hour:"numeric",minute:"2-digit"}:{},timeZone:"UTC"},m;try{m=new Intl.DateTimeFormat(d??"en-US",g)}catch{m=new Intl.DateTimeFormat("en-US",g)}return m.format(S).replace(/ /g," ")}function ce({value:n,time:t,instant:d=!1,label:p,name:S,required:g,autoFocus:m,autoSelect:H,locale:s,onChange:j,onLeave:_,onCancel:V,inputRef:w,boxStyle:Z}){let x=(0,r.useId)(),u=(0,r.useRef)(null),D=(0,r.useRef)(null),b=e=>{let a=M(e);return a?K(a,t,s):e??""},[T,C]=(0,r.useState)(()=>b(n)),[F,y]=(0,r.useState)(!1),[G,E]=(0,r.useState)(n),[J,Q]=(0,r.useState)(n);n!==J&&(Q(n),n!==G&&(E(n),C(b(n)))),(0,r.useEffect)(()=>{H&&(u.current?.focus(),u.current?.select())},[H]);let i=t&&d?B(s):void 0,N=T===b(n),l=M(n),c=N?l:P(T,{today:k().day,time:t,...l?{base:l}:{},...s?{locale:s}:{}}),X=N?n:c?I(c,{time:t,instant:d}):void 0,$=T.trim()==="",f=!$&&c===void 0;(0,r.useEffect)(()=>{u.current?.setCustomValidity(f?`Not a date this reads \u2014 ${z}`:"")},[f]);let O=e=>{E(e),j(e)},Y=e=>{C(e);let a=e.trim()===""?void 0:P(e,{today:k().day,time:t,...l?{base:l}:{},...s?{locale:s}:{}});O(a?I(a,{time:t,instant:d}):void 0)},ee=e=>{let a=t?{day:e,minutes:c?.minutes??l?.minutes??540}:{day:e},R=I(a,{time:t,instant:d});C(b(R)),O(R),y(!1),requestAnimationFrame(()=>{u.current?.focus(),u.current?.select()})},ne=$?`Type a date, or pick one \u2014 ${z}`:f?`Not a date this reads \u2014 ${z}`:c?`${K(c,t,s,!0)}${i?` ${i.short}`:""}`:"";return(0,o.jsxs)("span",{"data-graview-when":t?d?"instant":"moment":"day",style:{display:"inline-flex",flex:"1 1 14rem",flexWrap:"wrap",alignItems:"center",gap:"4px 6px",maxWidth:"100%",minWidth:0},onBlur:e=>{let a=e.relatedTarget;a&&e.currentTarget.contains(a)||!a&&typeof document<"u"&&!document.hasFocus()||(y(!1),_?.(X))},children:[(0,o.jsx)("input",{ref:e=>{u.current=e,typeof w=="function"?w(e):w&&(w.current=e)},type:"text",name:S,required:g,autoFocus:m,"aria-label":p,"aria-describedby":`${x}-said`,"aria-invalid":f||void 0,autoComplete:"off",spellCheck:!1,enterKeyHint:"done",placeholder:t?"tomorrow 3pm":"17 Oct",value:T,"data-graview-part":"control",onChange:e=>Y(e.target.value),onKeyDown:e=>{e.key==="Escape"?(e.preventDefault(),V?.()):e.key==="ArrowDown"&&e.altKey&&(e.preventDefault(),y(!0))},style:{flex:"1 1 12ch",minWidth:"10ch",maxWidth:"100%",boxSizing:"border-box",font:"inherit",...Z}}),(0,o.jsx)("button",{ref:D,type:"button","aria-label":`Pick a date for ${p}`,"aria-expanded":F,"aria-controls":`${x}-month`,"data-graview-part":"when-pick",onClick:()=>y(e=>!e),onPointerEnter:()=>v.prefetch(),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:32,minHeight:32,padding:0,borderRadius:6},children:(0,o.jsxs)("svg",{"aria-hidden":"true",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:[(0,o.jsx)("rect",{x:"2",y:"3",width:"12",height:"11",rx:"1.5"}),(0,o.jsx)("path",{d:"M2 6.5h12M5.5 1.5v3M10.5 1.5v3"})]})}),(0,o.jsxs)("span",{id:`${x}-said`,"aria-live":"polite","data-graview-part":"when-said",...i?{"data-graview-zone":i.zone,title:`Times are in ${i.zone.replace(/_/g," ")} (${i.short})`}:{},style:{flexBasis:"100%",fontSize:"0.75rem",color:f?"var(--graview-bad)":"var(--graview-ink-faint)"},children:[ne,i&&!f&&!$?(0,o.jsx)("span",{"data-graview-part":"when-zone",children:` \xB7 ${(i.zone.split("/").at(-1)??i.zone).replace(/_/g," ")} time`}):null]}),F?(0,o.jsx)(r.Suspense,{fallback:null,children:(0,o.jsx)(v.Part,{id:`${x}-month`,label:p,selected:c?.day??l?.day,today:k().day,locale:s,onPick:ee,onClose:()=>{y(!1),D.current?.focus()}})}):null]})}export{ce as WhenInput,K as wallAsRead};