graview 0.1.59 → 0.1.60

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 (166) hide show
  1. package/README.md +4 -2
  2. package/dist/preview/chunk.2K4TT2BV.js +1 -0
  3. package/dist/preview/{chunk.J4HTSXUA.js → chunk.2USDHXB4.js} +1 -1
  4. package/dist/preview/{chunk.LHJWII6C.js → chunk.37TVS7CA.js} +1 -1
  5. package/dist/preview/chunk.3IZ3ABII.js +1 -0
  6. package/dist/preview/{chunk.E22DDEQI.js → chunk.3MOJF7BA.js} +1 -1
  7. package/dist/preview/{chunk.2XTCDFWU.js → chunk.3UOKUF5Z.js} +1 -1
  8. package/dist/preview/{chunk.MOAUE3N2.js → chunk.3V4WP7RY.js} +3 -3
  9. package/dist/preview/{chunk.IZ2ZTNEV.js → chunk.3XGA65Y3.js} +1 -1
  10. package/dist/preview/{chunk.TCPTVTFU.js → chunk.3ZT5WQYL.js} +1 -1
  11. package/dist/preview/{chunk.DWHPZBPZ.js → chunk.4LR64TPU.js} +1 -1
  12. package/dist/preview/{chunk.VNJKGSGZ.js → chunk.4MP72LPR.js} +1 -1
  13. package/dist/preview/{chunk.IPPZEGBX.js → chunk.4TCKEG6I.js} +1 -1
  14. package/dist/preview/{chunk.EZ3CRUBU.js → chunk.5DD62IOW.js} +2 -2
  15. package/dist/preview/{chunk.DGM3Y2FB.js → chunk.5YOLUDVO.js} +1 -1
  16. package/dist/preview/{chunk.VFRURRNI.js → chunk.67U6M7OV.js} +1 -1
  17. package/dist/preview/{chunk.2NJDT47T.js → chunk.6C2MHWSX.js} +1 -1
  18. package/dist/preview/{chunk.CYUMQPMH.js → chunk.6HF6POIX.js} +1 -1
  19. package/dist/preview/{chunk.KOGUYWHG.js → chunk.6WHAWOO7.js} +1 -1
  20. package/dist/preview/{chunk.N4LOI3YA.js → chunk.6ZQAR5ZA.js} +1 -1
  21. package/dist/preview/{chunk.2QESVWUW.js → chunk.7MHCGVGM.js} +1 -1
  22. package/dist/preview/{chunk.VNBEAF62.js → chunk.7N32AVIJ.js} +1 -1
  23. package/dist/preview/{chunk.CIB65YO6.js → chunk.7OPM55I2.js} +1 -1
  24. package/dist/preview/chunk.7TFLRR7D.js +1 -0
  25. package/dist/preview/{chunk.Q6LLURRM.js → chunk.7VKSXGTX.js} +1 -1
  26. package/dist/preview/{chunk.CLR6KAA3.js → chunk.A3ZXDG6V.js} +1 -1
  27. package/dist/preview/{chunk.2FOIJ5ID.js → chunk.A5PDXNY6.js} +1 -1
  28. package/dist/preview/{chunk.6O3YPUW3.js → chunk.AVBTPSQF.js} +1 -1
  29. package/dist/preview/{chunk.ZT3NEAFI.js → chunk.BF6S5UE4.js} +1 -1
  30. package/dist/preview/chunk.BLPYNNR4.js +1 -0
  31. package/dist/preview/{chunk.BDBLGGFJ.js → chunk.BQIHNT7C.js} +1 -1
  32. package/dist/preview/{chunk.B5HLA45D.js → chunk.BRT27WON.js} +1 -1
  33. package/dist/preview/{chunk.DO45KXLM.js → chunk.BXDM3UMN.js} +1 -1
  34. package/dist/preview/chunk.BYKD5RLA.js +1 -0
  35. package/dist/preview/chunk.C7OLSEWK.js +1 -0
  36. package/dist/preview/{chunk.WGTBQHHE.js → chunk.CC5BJH5A.js} +1 -1
  37. package/dist/preview/{chunk.HF5SNUTK.js → chunk.CFKZXLXS.js} +1 -1
  38. package/dist/preview/chunk.CMN6BBAD.js +1 -0
  39. package/dist/preview/{chunk.Z4CJJ4QP.js → chunk.CQT3W2SF.js} +1 -1
  40. package/dist/preview/{chunk.NOLGJFA4.js → chunk.D7YSL3NK.js} +2 -2
  41. package/dist/preview/{chunk.G2TCFWYX.js → chunk.DCHQHKSA.js} +1 -1
  42. package/dist/preview/{chunk.UFTAGUTU.js → chunk.EL5ICOOM.js} +1 -1
  43. package/dist/preview/{chunk.OVSZXILB.js → chunk.ENL2JJ47.js} +1 -1
  44. package/dist/preview/chunk.EQXB7LKI.js +1 -0
  45. package/dist/preview/{chunk.KE6ZRUMP.js → chunk.ERFT54HT.js} +1 -1
  46. package/dist/preview/{chunk.P6CHNBRR.js → chunk.F6V7RWDK.js} +1 -1
  47. package/dist/preview/{chunk.GDUM2UOM.js → chunk.FBJARKDT.js} +1 -1
  48. package/dist/preview/{chunk.QL555VQ2.js → chunk.FC6AF6CC.js} +1 -1
  49. package/dist/preview/{chunk.HVUUJQRE.js → chunk.FFTYMBBT.js} +1 -1
  50. package/dist/preview/chunk.FLUK3UXF.js +1 -0
  51. package/dist/preview/{chunk.UM5H2VVR.js → chunk.FRYBMS3W.js} +1 -1
  52. package/dist/preview/chunk.G3R4BTI7.js +1 -0
  53. package/dist/preview/{chunk.GQHFLOTZ.js → chunk.G4YJPKRG.js} +2 -2
  54. package/dist/preview/{chunk.MHILFBK6.js → chunk.GLWSVSQL.js} +1 -1
  55. package/dist/preview/{chunk.WTUB7W2D.js → chunk.GNBIVVL3.js} +1 -1
  56. package/dist/preview/{chunk.SU6WKQ73.js → chunk.GTKJJYQH.js} +1 -1
  57. package/dist/preview/{chunk.VS25R6R2.js → chunk.H45Q3O4F.js} +1 -1
  58. package/dist/preview/{chunk.6N7LNTB6.js → chunk.HDP3PS7N.js} +1 -1
  59. package/dist/preview/{chunk.QLTHHWBA.js → chunk.HDUO2USQ.js} +1 -1
  60. package/dist/preview/{chunk.2MFXP3FB.js → chunk.HUJ6YTWE.js} +1 -1
  61. package/dist/preview/{chunk.2FP4KEEG.js → chunk.I4XQBQRC.js} +1 -1
  62. package/dist/preview/chunk.IBOKXVWN.js +1 -0
  63. package/dist/preview/{chunk.4T5QIZKB.js → chunk.IGJZ4UH3.js} +2 -2
  64. package/dist/preview/{chunk.4QWTSI7V.js → chunk.IGVASEZU.js} +1 -1
  65. package/dist/preview/{chunk.CZH27V2R.js → chunk.IHBUBZQT.js} +1 -1
  66. package/dist/preview/chunk.IOK4GVJC.js +1 -0
  67. package/dist/preview/{chunk.ZUKYMU6C.js → chunk.JEYQBH33.js} +1 -1
  68. package/dist/preview/{chunk.S6VON4LU.js → chunk.JJGCTGWA.js} +1 -1
  69. package/dist/preview/{chunk.LKE2FBXL.js → chunk.JPONLMU7.js} +1 -1
  70. package/dist/preview/{chunk.Q3Y5EV5A.js → chunk.KBVTLNS5.js} +3 -3
  71. package/dist/preview/{chunk.YMRVKG6W.js → chunk.KDRLUBVF.js} +1 -1
  72. package/dist/preview/{chunk.YGZCESXY.js → chunk.KGW75Z5L.js} +1 -1
  73. package/dist/preview/{chunk.R4YDAJRL.js → chunk.KI37ZEV3.js} +1 -1
  74. package/dist/preview/chunk.L6AWE76F.js +1 -0
  75. package/dist/preview/{chunk.NIFQDN6R.js → chunk.LGEA5257.js} +1 -1
  76. package/dist/preview/{chunk.KKQXGN5U.js → chunk.LLYRFVIN.js} +1 -1
  77. package/dist/preview/{chunk.WEGPDJTB.js → chunk.LQVAABPS.js} +1 -1
  78. package/dist/preview/{chunk.4OMOP77U.js → chunk.LSY256J4.js} +1 -1
  79. package/dist/preview/{chunk.OLW44AP5.js → chunk.LZIBQ3VX.js} +1 -1
  80. package/dist/preview/{chunk.W2VOD6SD.js → chunk.M4UD4ARP.js} +1 -1
  81. package/dist/preview/chunk.MDJWK5W2.js +1 -0
  82. package/dist/preview/{chunk.QT6UV7HN.js → chunk.MJVYWLQQ.js} +1 -1
  83. package/dist/preview/{chunk.NSGQXCH6.js → chunk.MSWWWLEA.js} +1 -1
  84. package/dist/preview/{chunk.XOTES3PI.js → chunk.MVWC3VR3.js} +2 -2
  85. package/dist/preview/{chunk.V6EEDYYW.js → chunk.NC7FXY2H.js} +1 -1
  86. package/dist/preview/{chunk.MRYN42EQ.js → chunk.NGTRL5U4.js} +1 -1
  87. package/dist/preview/{chunk.ZLMI2NHC.js → chunk.NHUQ2N6J.js} +1 -1
  88. package/dist/preview/{chunk.LDYOQCY7.js → chunk.OLFJH4RK.js} +1 -1
  89. package/dist/preview/{chunk.3UTRR5YM.js → chunk.P6RORYOT.js} +1 -1
  90. package/dist/preview/{chunk.T227XQIO.js → chunk.PFSYXD6Q.js} +1 -1
  91. package/dist/preview/chunk.PHJ6WPWH.js +1 -0
  92. package/dist/preview/{chunk.HKINU7VO.js → chunk.PI44XMY2.js} +1 -1
  93. package/dist/preview/{chunk.P3CUCDHO.js → chunk.PNW5K7BW.js} +1 -1
  94. package/dist/preview/{chunk.6VNKGTLF.js → chunk.QBLKTFF4.js} +1 -1
  95. package/dist/preview/{chunk.ATVPAYS6.js → chunk.QDSEVPF3.js} +1 -1
  96. package/dist/preview/chunk.QFUMFQJU.js +1 -0
  97. package/dist/preview/{chunk.JPNBQFJ3.js → chunk.QHDCTAD7.js} +1 -1
  98. package/dist/preview/{chunk.P52UTBNO.js → chunk.QI4SLPQ4.js} +2 -2
  99. package/dist/preview/{chunk.ATSKKTUO.js → chunk.RQOX5YDW.js} +1 -1
  100. package/dist/preview/{chunk.VDGMFX5C.js → chunk.RXYNW5QB.js} +1 -1
  101. package/dist/preview/{chunk.ROHSF4WM.js → chunk.SB2PZKN5.js} +1 -1
  102. package/dist/preview/{chunk.3XIIJHQ6.js → chunk.SRVQJZRT.js} +1 -1
  103. package/dist/preview/{chunk.BPC4XQFZ.js → chunk.T7LQD67N.js} +2 -2
  104. package/dist/preview/{chunk.D3AISGQH.js → chunk.TAT2IQUR.js} +1 -1
  105. package/dist/preview/{chunk.E2REVMAG.js → chunk.TFWIG6LL.js} +1 -1
  106. package/dist/preview/{chunk.U5PX2ECA.js → chunk.TKVLNBRD.js} +1 -1
  107. package/dist/preview/{chunk.KSVJHSRH.js → chunk.TLJOZSDD.js} +1 -1
  108. package/dist/preview/{chunk.VGHZQEHS.js → chunk.TLWT67ON.js} +1 -1
  109. package/dist/preview/{chunk.AXXYJCSW.js → chunk.TY4GQJKC.js} +1 -1
  110. package/dist/preview/{chunk.SZG6HJWH.js → chunk.UITT6JWW.js} +1 -1
  111. package/dist/preview/{chunk.UHUBQ4EX.js → chunk.UJTE7UAP.js} +1 -1
  112. package/dist/preview/{chunk.GR2B7SKI.js → chunk.ULL6ZIJJ.js} +1 -1
  113. package/dist/preview/{chunk.HJOVOA52.js → chunk.UQWTZJBV.js} +1 -1
  114. package/dist/preview/{chunk.7JOG6XFC.js → chunk.URWAFZHF.js} +1 -1
  115. package/dist/preview/{chunk.BFN6B4C4.js → chunk.VADQ7ZGA.js} +1 -1
  116. package/dist/preview/chunk.VDMDPZ6U.js +1 -0
  117. package/dist/preview/{chunk.ZFH4SCCF.js → chunk.VFOON3Z3.js} +1 -1
  118. package/dist/preview/{chunk.QXMQUIQZ.js → chunk.VMV464JK.js} +1 -1
  119. package/dist/preview/{chunk.CUJX3IVA.js → chunk.VNDKKTED.js} +1 -1
  120. package/dist/preview/chunk.VSCIXAHN.js +5 -0
  121. package/dist/preview/{chunk.IIESMHXY.js → chunk.VUBNBTJP.js} +2 -2
  122. package/dist/preview/{chunk.MZJ3KTEU.js → chunk.VWJGQDCE.js} +1 -1
  123. package/dist/preview/{chunk.UITZ74YJ.js → chunk.VZJWJ5XM.js} +1 -1
  124. package/dist/preview/{chunk.RKZ4J3H2.js → chunk.W3W54DSX.js} +1 -1
  125. package/dist/preview/{chunk.6IUEGPCZ.js → chunk.WC3DENU4.js} +2 -2
  126. package/dist/preview/chunk.WQ6RCEUQ.js +1 -0
  127. package/dist/preview/{chunk.QC4YXFF7.js → chunk.WXUFATY5.js} +1 -1
  128. package/dist/preview/{chunk.QHU3KUZZ.js → chunk.X6A4VSSD.js} +1 -1
  129. package/dist/preview/{chunk.U7G56KXT.js → chunk.XGASJAV2.js} +1 -1
  130. package/dist/preview/{chunk.M3JIIF32.js → chunk.XR6YR6RV.js} +1 -1
  131. package/dist/preview/chunk.XZPKBHJT.js +1 -0
  132. package/dist/preview/{chunk.S7ZLGODY.js → chunk.Y5C4RXG7.js} +1 -1
  133. package/dist/preview/{chunk.L3K25NCS.js → chunk.Y7G3OGDE.js} +1 -1
  134. package/dist/preview/{chunk.E4SYOBGB.js → chunk.YEBGI6ED.js} +1 -1
  135. package/dist/preview/{chunk.G7HIAUEA.js → chunk.YFSBVZTG.js} +1 -1
  136. package/dist/preview/chunk.YFVJUHAK.js +1 -0
  137. package/dist/preview/{chunk.7XSDXX5Z.js → chunk.YH63KQ2G.js} +1 -1
  138. package/dist/preview/{chunk.F6P3WSMW.js → chunk.YZ7FUKAL.js} +1 -1
  139. package/dist/preview/{chunk.7AMBLGVB.js → chunk.Z2ERZ4S6.js} +1 -1
  140. package/dist/preview/{chunk.X2G4ZRB2.js → chunk.ZP5RT2EK.js} +1 -1
  141. package/dist/preview/{chunk.PS5SEND3.js → chunk.ZXOT3IXJ.js} +1 -1
  142. package/dist/preview/{chunk.EGJUFZD5.js → chunk.ZYM2SSGW.js} +1 -1
  143. package/dist/preview/index.html +50 -50
  144. package/dist/preview/page.js +2 -2
  145. package/package.json +6 -6
  146. package/dist/preview/chunk.3XLOFZRM.js +0 -1
  147. package/dist/preview/chunk.6BLNFVB4.js +0 -1
  148. package/dist/preview/chunk.6E36I2GC.js +0 -1
  149. package/dist/preview/chunk.CJUIJ6TL.js +0 -1
  150. package/dist/preview/chunk.FJTVY6AE.js +0 -1
  151. package/dist/preview/chunk.KHZA5F7A.js +0 -1
  152. package/dist/preview/chunk.LDLTQNJ2.js +0 -1
  153. package/dist/preview/chunk.MMWLLWFS.js +0 -1
  154. package/dist/preview/chunk.PCVPH5KM.js +0 -1
  155. package/dist/preview/chunk.QDZAITMN.js +0 -1
  156. package/dist/preview/chunk.U37WZMUO.js +0 -1
  157. package/dist/preview/chunk.U5JFW2YM.js +0 -1
  158. package/dist/preview/chunk.V5MOMBZG.js +0 -1
  159. package/dist/preview/chunk.VUSJ7HPC.js +0 -1
  160. package/dist/preview/chunk.VXRECLX6.js +0 -1
  161. package/dist/preview/chunk.W66VMALY.js +0 -1
  162. package/dist/preview/chunk.WGVIJDV5.js +0 -1
  163. package/dist/preview/chunk.X3MMJ3QC.js +0 -5
  164. package/dist/preview/chunk.X5YRNNHU.js +0 -1
  165. package/dist/preview/chunk.YMC2T2HN.js +0 -1
  166. package/dist/preview/chunk.YN6BXZHO.js +0 -1
@@ -1,2 +1,2 @@
1
- import{a as Ge}from"./chunk.VFRURRNI.js";import{c as Me,d as Oe,f as Be}from"./chunk.MHILFBK6.js";import{e as Pe,f as Ce,k as Re,l as re,n as Fe}from"./chunk.Q6LLURRM.js";import{f as Se}from"./chunk.HKINU7VO.js";import{d as _,e as je,k as ne}from"./chunk.SZG6HJWH.js";import{b as De,e as Ae}from"./chunk.2FOIJ5ID.js";import{$b as te,Bc as he,C as Q,Cd as $e,Dc as ye,Fc as we,Jb as fe,K as de,Md as ke,Oc as U,Pc as be,Ud as xe,ac as ge,ba as ue,da as Z,fa as H,ga as T,ha as me,ia as ee,ja as pe,ld as ve,ma as q,oa as z}from"./chunk.X3MMJ3QC.js";function ze(r,e,t){let o=r.tryDefinition(e)?.fields.shape,n=Q(o?.[t]),a=!1,s=!1;for(;n&&(n.type==="optional"||n.type==="default"||n.type==="nullable"||n.type==="prefault");)(n.type==="optional"||n.type==="nullable")&&(a=!0),(n.type==="default"||n.type==="prefault")&&(s=!0),n=Q(n.innerType);if(n?.type!=="enum")return;let p=(n.entries?Object.values(n.entries):n.values??[]).filter(m=>typeof m=="string");return p.length>0?{values:p,empty:a&&!s}:void 0}function E(r,e,t){let o=ze(r,e,t);if(!o)return[];let n=r.tryDefinition(e),a=o.values.map(s=>({value:s,label:De(n,t,s)}));return o.empty&&a.push({value:null,label:`No ${q(n,t).toLowerCase()}`}),a}function X(r,e,t){let o=r[e];return typeof o=="string"&&t.some(n=>n.value===o)?o:null}function se(r,e,t,o,n=E(r.schema,t.kind,o)){return Ie(r,e,t,o,n).flatMap(a=>a.move?[a.move]:[])}function Ie(r,e,t,o,n=E(r.schema,t.kind,o)){let a=Ne(r.schema,r.allMutations(),t.kind,o,n),s=X(t,o,n),p=z(r.schema.tryDefinition(t.kind),t.kind),m=[];for(let{value:A,label:C,by:R,acts:F}of a){if(A===s)continue;let x,I,N;for(let c of F){let w=R==="step"?{[c.subject.arg]:t.id}:{[c.subject.arg]:t.id,[o]:A},S={name:c.name,args:w};if(!c.input.safeParse(w).success){N??=`${c.title??c.name} asks for more than the ${p} itself.`;continue}let k=r.permits(S,e);if(!k.ok){I??=k.refusal?.message??`You may not ${c.title??c.name}.`;continue}try{fe(r.graph,c,w)}catch(f){I??=f instanceof Error?f.message:String(f);continue}x={to:A,call:S,title:c.title??c.name};break}m.push(x?{to:A,label:C,move:x}:{to:A,label:C,why:I??N??`Nothing in this app moves a ${p} to ${C}.`})}return m}function Ne(r,e,t,o,n=E(r,t,o)){let a=Ve(r,e,t,o),s=Ke(r,e,t,o);return n.flatMap(p=>{if(p.value===null)return[];let m=a.filter(A=>A.sets?.[o]===p.value);return[{value:p.value,label:p.label,by:m.length>0?"step":s.length>0?"value":"none",acts:m.length>0?m:s}]})}function Ve(r,e,t,o){return e.filter(n=>n.subject!==void 0&&n.derived===void 0&&typeof n.sets?.[o]=="string"&&te(r,n).includes(t))}function Ke(r,e,t,o){let n=r.tryDefinition(t);return n?e.filter(a=>{if(!a.subject||!te(r,a).includes(t)||!ge(a,n).includes(o))return!1;let s=a.input.shape;return s!==void 0&&o in s}).sort((a,s)=>+(a.derived!==void 0)-+(s.derived!==void 0)):[]}var oe=(r,e)=>e&&r[e]!==void 0?String(r[e]):"";function Xe(r,e,t){let o=c=>r.tryDefinition(c)?e.nodesOfKind(c).filter(w=>H(r.tryDefinition(c),w)):[],n=o(t.rows),a=o(t.columns),s=new Set(n.map(c=>c.id)),p=new Set(a.map(c=>c.id)),m=e.allEdges(),A=[],C=t.link;if(typeof C=="string"){let c=f=>r.tryDefinition(f)?.edges?.[C]?.to,w=(c(t.columns)??[]).some(f=>f===t.rows||f==="*"),S=(c(t.rows)??[]).some(f=>f===t.columns||f==="*"),k=w||!S;for(let f of m){if(f.kind!==C)continue;let j=k?f.to:f.from,i=k?f.from:f.to;s.has(j)&&p.has(i)&&A.push({rowId:j,columnId:i,via:[]})}}else{let c=new Map(C.path.map(S=>[S,new Map]));for(let S of m){let k=c.get(S.kind);if(!k)continue;let f=k.get(S.from);f?f.push(S.to):k.set(S.from,[S.to]);let j=k.get(S.to);j?j.push(S.from):k.set(S.to,[S.from])}let w=new Set;for(let S of a){let k=[{id:S.id,via:[]}];for(let f of C.path){let j=[],i=new Set;for(let $ of k)for(let b of c.get(f).get($.id)??[])i.has(`${$.id}|${b}`)||(i.add(`${$.id}|${b}`),j.push({id:b,via:[...$.via,$.id]}));k=j}for(let f of k){let j=`${f.id}|${S.id}`;!s.has(f.id)||w.has(j)||(w.add(j),A.push({rowId:f.id,columnId:S.id,via:f.via.slice(1)}))}}}let R=t.groupOrder??[],F=c=>R.indexOf(c)===-1?R.length:R.indexOf(c),x=(c,w)=>w==="label"?T(r.tryDefinition(c.kind),c):c[w],I=U(n,t.sort,x).map(c=>{let w=c;return{node:c,label:T(r.tryDefinition(c.kind),c),group:oe(w,t.rowGroup),ref:oe(w,t.rowRef)}}).sort((c,w)=>F(c.group)-F(w.group)||(t.sort!==void 0?0:c.ref<w.ref?-1:c.ref>w.ref?1:0)),N=U(a,t.columnSort,x).map(c=>({node:c,label:T(r.tryDefinition(c.kind),c),group:oe(c,t.columnGroup)})).sort((c,w)=>c.group<w.group?-1:c.group>w.group?1:t.columnSort!==void 0?0:c.node.id<w.node.id?-1:c.node.id>w.node.id?1:0);return{rows:I,columns:N,cells:A}}function We(r,e,t){let{rows:o,columns:n,cells:a}=Xe(r,e,t),s=(i,$)=>ee(r,i,$),p=i=>ee(r,i,1).replace(/^1 /,""),m=i=>({id:i.id,kind:i.kind,title:T(r.tryDefinition(i.kind),i),parts:[]}),A=i=>{let $=e.getNode(i);if(!$)return null;let b=r.tryDefinition($.kind),P=T(b,$),V=_($,b,{limit:3,said:[P],glance:!0}).map(K=>K.alone.startsWith(K.label)?`${K.label.toLowerCase()}${K.alone.slice(K.label.length)}`:K.alone);return[P,...V].join(", ")},C=typeof t.link=="string"?[]:t.link.path.slice(0,-1).flatMap((i,$,b)=>{let P=ve(r,t.columns,b.slice(0,$+1));return P.ok?[...P.reached]:[]}),R=be(r,t,{rows:o.length,columns:n.length,cells:a.length});if(R)return[{t:"text",text:`${s(t.rows,o.length)} against ${s(t.columns,n.length)}.`},{t:"text",text:R}];let F=[{t:"text",text:`${s(t.rows,o.length)} against ${s(t.columns,n.length)}${C.length>0?`, through ${[...new Set(C)].map(i=>s(i,2).replace(/^2 /,"")).join(" and ")}`:""}${n.length>0?`: ${n.map(i=>i.label).join(", ")}`:""}.`}],x=new Map(n.map(i=>[i.node.id,i.label])),I=new Map(n.map((i,$)=>[i.node.id,$])),N=new Map,c=new Map;for(let i of a){let $=N.get(i.rowId);$?$.push(i):N.set(i.rowId,[i]);let b=c.get(i.columnId);b?b.add(i.rowId):c.set(i.columnId,new Set([i.rowId]))}for(let i of o){let b=[...N.get(i.node.id)??[]].sort((P,V)=>I.get(P.columnId)-I.get(V.columnId)).map(P=>{let V=P.via.map(A).filter(K=>K!==null);return`${x.get(P.columnId)}${V.length>0?` (${V.join("; ")})`:""}`});F.push({t:"field",label:i.label,text:b.length>0?b.join(", "):"none"})}F.push({t:"list",as:"name",columns:1,groups:n.map(i=>{let $=c.get(i.node.id)??new Set,b=o.filter(P=>$.has(P.node.id)).map(P=>m(P.node));return{heading:`${i.label} (${b.length})`,items:b}})});let w=new Set(a.map(i=>i.rowId)),S=new Set(a.map(i=>i.columnId)),k=o.filter(i=>!w.has(i.node.id)),f=n.filter(i=>!S.has(i.node.id)),j=t.rows===t.columns;return k.length>0&&F.push({t:"text",text:`${j?`${k.length} with none across`:`${s(t.rows,k.length)} with no ${p(t.columns)}`}: ${k.map(i=>i.label).join(", ")}.`}),f.length>0&&F.push({t:"text",text:`${j?`${f.length} with none down`:`${s(t.columns,f.length)} on no ${p(t.rows)}`}: ${f.map(i=>i.label).join(", ")}.`}),F}function ie(r,e,t,o={}){let{app:n,blocks:a=t?n?.viewSpecs?.[t.kind]?.[o.slot??"page"]:n?.home}=o;if(!a?.length)return[];let s=o.firstHeading??(t||o.blocks?void 0:1),p=Fe(r,e,t,{...o,money:o.money??n?.brand,firstHeading:s});return t&&!p.node?[]:Ce(typeof a[0]?.t=="string"?a:Pe(a),p)}function Y(r,e,t){let o=!(e.optional||e.control==="boolean"),n=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(s=>Z(z(r.tryDefinition(s),s))).join(" or "):t(e.name).label,a={name:e.name,label:n,required:o};switch(e.control){case"text":return{...a,input:e.holds==="duration"?"length of time":e.holds??(e.markdown?"Markdown text":e.long?"long text":e.app?"app address":"text")};case"date":return{...a,input:e.time||e.instant?"date and time":"date"};case"number":return{...a,input:e.amount?"amount":"number",...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max}};case"choice":return{...a,input:"choice",choices:(e.options??[]).map(s=>t(e.name).option(s))};case"boolean":return{...a,input:"yes or no"};case"node":return{...a,input:"record",kinds:e.kinds};case"linked":return{...a,input:"record in another app"};case"file":return{...a,input:e.image?"picture":e.video?"video":"file"};case"repeat":return{...a,input:"how it repeats"};case"list":return{...a,input:`list of ${Y(r,e.item,t).input}`};case"group":return{...a,input:"group",fields:e.fields.map(s=>Y(r,s,t))};case"variant":return{...a,input:"one of",choices:e.options.map(s=>Z(s.value))};default:return{...a,input:"answer"}}}function Te(r,e,t){let o=Oe(r,e,t),n=r.schema,a=Me(n,t).filter(p=>p.name!==t.subject?.arg&&!o.has(p.name)),s=me(t);return{act:t.name,title:s,submit:s,fields:a.map(p=>Y(n,p,m=>ne(n,t,m)))}}function He(r,e){return{act:e.act.name,title:e.title,submit:e.submit,visitor:e.name,fields:e.fields.map(t=>Y(r,t,o=>ne(r,e.act,o)))}}function Ee(r,e,t){return r.permittedMutations(e).filter(o=>!o.derived&&!o.subject&&(o.creates??[]).includes(t))}function Le(r,e=""){let t=[`${e}Form "${r.title}" (${r.visitor?`the visitor form ${r.visitor}, running `:""}act ${r.act}), button "${r.submit}":`],o=(n,a)=>{for(let s of n){let p=s.choices?`${s.input}: ${s.choices.join(", ")}`:s.kinds?`${s.input} (${s.kinds.join(" or ")})`:s.input,m=s.min!==void 0||s.max!==void 0?`, ${s.min??"\u2026"} to ${s.max??"\u2026"}`:"";t.push(`${a}- ${s.label}${s.required?" *":""} (${s.name}) \u2014 ${p}${m}`),s.fields&&o(s.fields,`${a} `)}};return o(r.fields,`${e} `),r.fields.length===0&&t.push(`${e} (asks nothing)`),t}function Ue(r,e){let t=r.viewSpecs??{};return e.filter(o=>o.cardinality==="one"&&o.replaces==="page"&&(t[o.attach]?.page?.length??0)>0).map(o=>{let n=L(r.schema,o.attach,1);return{at:`views.${o.attach}.page`,says:`The view "${o.name}" replaces ${Ye(n)}'s page, so its page slot is never drawn: leave out replaces to draw the slot under the view, or draw what the slot says in the view.`}})}var Ye=r=>`${/^[aeiou]/i.test(r)?"an":"a"} ${r}`,Je=240,Ze=10,Qe=1160,et=40,_e=640,tt=3,nt=r=>Math.max(1,Math.floor((Math.min(r,Qe)-et+Ze)/(Je+Ze)));function rt(r,e,t,o){let{app:n}=o,a=o.width??1440,s=o.today??r.today()??de(n.brand?.timeZone),p=r.seenBy(e),m=p.schema,A=p.graph,C=Ge(n,o.views?{views:o.views}:{}),R=typeof t=="string"?t.trim():t.slug,F=typeof t=="string"?C.find(l=>l.slug===R||l.title===R||l.address===R):C.find(l=>l.slug===t.slug&&l.kind===t.kind)??t,x=!F&&typeof t=="string"?A.getNode(R):void 0,I=!F&&!x?/^\/?forms\/(.+)$/.exec(R)?.[1]:void 0,N=I!==void 0?Be(n,I):void 0;if(N)return{ok:!0,description:st(m,N,a)};if(!F&&!x)return{ok:!1,error:`"${R}" is not a place this app has, nor a record this seat can see.`,places:[...C.map(l=>l.slug),...Object.keys(n.forms??{}).map(l=>`forms/${l}`)]};let c=[],w=n.viewSpecs??{},S=nt(a),k=(l,h)=>ie(p,null,l,{app:n,today:s,...h}),f=(l,h,M)=>{let d=m.tryDefinition(l.kind),g=T(d,l);if(h==="name")return{id:l.id,kind:l.kind,title:g,parts:[]};if(w[l.kind]?.[h]){let G=k(l,{slot:h}),[B,...O]=G,y=B?.t==="title"||h==="row"&&B?.t==="headline";return{id:l.id,kind:l.kind,title:y?B.text:g,parts:j(y?O:G,M,`views.${l.kind}.${h}`,` (${l.id})`,y?1:0)}}if(h==="row")return{id:l.id,kind:l.kind,title:g,parts:[]};let u=d?.computed?re(m,A,l):l,W=_(u,d,{limit:3,said:[g],glance:!0,locale:n.brand?.locale,timeZone:n.brand?.timeZone});return{id:l.id,kind:l.kind,title:g,parts:W.map(G=>({t:"text",text:G.alone}))}};function j(l,h,M,d="",g=0){let v=[];return l.forEach((u,W)=>{let G=`${M}.${W+g}`;switch("problem"in u&&u.problem&&c.push({at:`${G}${d}`,says:u.problem}),u.t){case"title":v.push({t:"heading",level:3,text:u.text});return;case"text":v.push({t:"text",text:u.markdown?Ae(u.text):u.runs?it(u.runs):u.text,...u.tone?{tone:u.tone}:{}});return;case"badge":v.push({t:"badge",text:u.text});return;case"field":case"image":v.push({t:"field",label:u.label,text:u.text});return;case"progress":v.push({t:"progress",label:u.label,text:u.text});return;case"group":v.push(...j(u.blocks,h,`${G}.group`,d));return;case"when":v.push(...j(u.blocks,h,`${G}.show`,d));return;case"divider":case"figure":return;case"headline":v.push({t:"heading",level:u.level,text:u.text});return;case"number":v.push({t:"figure",text:u.text,...u.label?{label:u.label}:{}});return;case"list":{if(u.failed){v.push({t:"text",text:"\u2014"});return}if(u.members.length===0){u.empty&&v.push({t:"list",as:u.as,columns:1,groups:[],empty:u.empty});return}let B=h+1,O=B>tt?"name":u.as,y=(u.groups??[{value:null,members:u.members}]).map(D=>({..."heading"in D&&D.heading?{heading:D.heading,count:(u.everyGroup?.find(J=>J.value===D.value)??D).members.length}:{},items:D.members.map(J=>f(J,O,B))}));v.push({t:"list",as:O,columns:O==="card"?S:1,groups:y,...u.more>0?{more:u.more}:{}});return}}}),v}let i=[],$,b,P,V=[];if(x){b="record";let l=m.tryDefinition(x.kind),h=T(l,x);P={slug:x.id,title:h,kind:x.kind,address:$e(m,x.kind,x.id)};let M=w[x.kind]?.page,d=o.views?.find(g=>g.attach===x.kind&&g.cardinality==="one");if(d&&i.push({t:"view",name:d.name,...d.title?{title:d.title}:{},...d.replaces==="page"?{replaces:!0}:{},...d.parts?{parts:d.parts}:{}}),d?.replaces==="page")b=`view:${d.name}`,c.push(...Ue(n,[d]));else{M&&i.push(...j(k(x,{slot:"page"}),1,`views.${x.kind}.page`));let g=l?.computed?re(m,A,x):x;for(let v of je(l,_(g,l,{said:[h],locale:n.brand?.locale,timeZone:n.brand?.timeZone}))){v.title&&i.push({t:"heading",level:2,text:v.title});for(let u of v.fields)i.push({t:"field",label:u.label,text:u.value,...u.long?{long:!0}:{},...u.markdown?{markdown:!0}:{}})}}}else{let l=F;P={slug:l.slug,title:l.title,kind:l.kind,address:l.address};let h=l.lens?ke(n).drawn.find(d=>d.as===l.slug&&(l.kind===null||d.kinds.includes(l.kind))):void 0,M=l.kind!==null&&l.view===void 0&&!h?o.views?.find(d=>d.attach===l.kind&&d.cardinality==="many"&&d.replaces==="page"&&!d.hidden):void 0;if(l.kind!==null&&h?.create!==!1&&l.view===void 0&&!M&&(V=Ee(r,e,l.kind).map(d=>Te(r,e,d))),l.view!==void 0&&!h){let d=o.views?.find(g=>g.name===l.view);b=`view:${l.view}`,i.push({t:"view",name:l.view,title:d?.title??l.title,...typeof d?.flows=="boolean"?{flows:d.flows}:{},...d?.parts?{parts:d.parts}:{}})}else if(l.kind===null){let d=n.brand,g=d?.name??n.name,v=we(d)?.light,u=v&&ye(v)?v:void 0;if($={name:g,...d?.subtitle&&d.subtitleDrawn!==!1?{subtitle:d.subtitle}:{},...u?{logo:{alt:d?.logoAlt??g,...he(u)?{drawn:"inline SVG"}:{drawn:"image",src:u}}}:{}},n.home)b="blocks",i=j(k(null,{}),0,"views.home");else{b="derived";let W=r.kindsKeptFrom(e),G=new Set([...n.pages?.hide??[],...W,...r.modules.disabledKinds]),B=xe(m.kinds,n.pages?.order).filter(O=>!G.has(O));i.push({t:"heading",level:1,text:n.name??"Home"});for(let O of B){let y=A.nodesOfKind(O).filter(D=>H(m.tryDefinition(O),D)).length;y>0&&i.push({t:"text",text:`${y} ${L(m,O,y)}`})}}}else if(h?.lens==="blocks")b="lens:blocks",i=j(k(null,{blocks:h.options.blocks??[]}),0,`lenses.${h.index}.options.blocks`);else if(h?.lens==="columns"){b="lens:columns";let d=h.options.bindings??{};for(let g of Object.keys(d)){let v=d[g]?.column;if(!v)continue;let u=E(m,g,v),W=U(A.nodesOfKind(g).filter(y=>H(m.tryDefinition(g),y)),h.options.sort,(y,D)=>D==="label"?T(m.tryDefinition(y.kind),y):y[D]);Object.keys(d).length>1&&i.push({t:"heading",level:2,text:L(m,g,2).replace(/^./,y=>y.toUpperCase())}),i.push({t:"text",text:`${W.length} ${L(m,g,W.length)} in columns by ${q(m.tryDefinition(g),v).toLowerCase()}.`});let G=u.map(y=>({column:y,items:W.filter(D=>X(D,v,u)===y.value).map(D=>f(D,"card",1))})).filter(({column:y,items:D})=>y.value!==null||D.length>0).map(({column:y,items:D})=>({heading:`${y.label} (${D.length})`,items:D}));i.push({t:"list",as:"card",columns:1,groups:G});let B=new Map;for(let y of W)for(let D of se(r,e,y,v,u))B.set(D.to,(B.get(D.to)??new Set).add(`"${D.title}"`));let O=u.filter(y=>y.value!==null&&B.has(y.value)).map(y=>`to ${y.label} by ${[...B.get(y.value)].join(" or ")}`);i.push({t:"text",text:O.length>0?`Moves: ${O.join("; ")}.`:"Moves: none for this seat."})}}else if(h?.lens==="coverage")b="lens:coverage",i=We(m,A,h.options);else if(h){b=`lens:${h.lens}`;let d=h.kinds.flatMap(g=>A.nodesOfKind(g).filter(v=>H(m.tryDefinition(g),v)));i.push({t:"text",text:`A ${h.lens} of ${d.length} ${h.kinds.map(g=>L(m,g,d.length)).join(" and ")}.`}),i.push({t:"list",as:"name",columns:1,groups:[{items:d.map(g=>f(g,"name",1))}]})}else if(M)b=`view:${M.name}`,i.push({t:"heading",level:1,text:l.title}),i.push({t:"view",name:M.name,...M.title?{title:M.title}:{},replaces:!0,...M.parts?{parts:M.parts}:{}});else{b="derived";let d=A.nodesOfKind(l.kind).filter(g=>H(m.tryDefinition(l.kind),g));i.push({t:"heading",level:1,text:l.title}),d.length===0?i.push({t:"list",as:"row",columns:1,groups:[],empty:`No ${L(m,l.kind,0)} yet.`}):i.push({t:"list",as:"row",columns:1,groups:[{items:d.map(g=>f(g,"row",1))}]})}}let K=e.kind==="system"?"the system":(e.roles??[]).length>0?(e.roles??[]).join(", "):e.kind,qe=a<_e?"phone":"wide",le=P.kind===null?ot(m,A):[],ce={...$?{masthead:$}:{},...le.length>0?{facts:le}:{},place:P,seat:K,width:a,variant:qe,drawnBy:b,parts:i,...V.length>0?{forms:V}:{},problems:c};return{ok:!0,description:{...ce,text:ae(ce)}}}function st(r,e,t){let o=[{t:"heading",level:1,text:e.title},...e.intro?[{t:"text",text:e.intro}]:[]],n={place:{slug:`forms/${e.name}`,title:e.title,kind:null,address:`/forms/${e.name}`},seat:`a visitor (${e.role})`,width:t,variant:t<_e?"phone":"wide",drawnBy:"form",parts:o,forms:[He(r,e)],problems:[]};return{...n,text:ae(n)}}function ot(r,e){let t=Re(r,e,null),o=n=>Array.isArray(n)?n.map(o).join(", "):n===null?"nothing":typeof n=="boolean"?n?"yes":"no":typeof n=="object"?n.label:String(n);return[...Se(r)].map(([n,a])=>{let s=a.label??Z(n);return Object.hasOwn(t.values,n)?{name:n,label:s,value:o(t.values[n])}:{name:n,label:s,refused:t.refused[n]??"it could not be worked out"}})}function L(r,e,t){let o=r.tryDefinition(e);if(t===1)return o?.noun??e;let n=pe(r,e);return ue(n)}function ae(r){let e=[`${r.place.title} (${r.place.address}) \u2014 as ${r.seat}, ${r.width} wide (${r.variant}).`],t=r.masthead;t&&e.push(`Masthead: ${t.logo?`the logo ("${t.logo.alt}", ${t.logo.drawn==="image"?t.logo.src:"inline SVG"}), `:""}${t.name}${t.subtitle?` \u2014 ${t.subtitle}`:""}`);let o=(n,a)=>{for(let s of n)switch(s.t){case"heading":e.push(`${a}${"#".repeat(s.level)} ${s.text}`);break;case"text":e.push(`${a}${s.text}`);break;case"badge":e.push(`${a}[${s.text}]`);break;case"field":case"progress":e.push(`${a}${s.label}: ${s.text}`);break;case"figure":e.push(`${a}${s.text}${s.label?` \u2014 ${s.label}`:""}`);break;case"list":if(s.groups.length===0){s.empty&&e.push(`${a}(${s.empty})`);break}for(let p of s.groups){p.heading&&e.push(`${a}${p.heading}${p.count!==void 0?` (${p.count})`:""}:`);for(let m of p.items)e.push(`${a}${p.heading?" ":""}- ${m.title}`),o(m.parts,`${a}${p.heading?" ":" "}`)}s.as==="card"&&s.columns>1&&e.push(`${a}(cards, ${s.columns} across)`),s.more&&e.push(`${a}and ${s.more} more`);break;case"view":e.push(`${a}[the view "${s.title??s.name}"${s.replaces?", in place of the page":""}${s.flows===!0?", flowing with the page":s.flows===!1?", in a frame of its own":""}]`),s.parts&&o(s.parts,`${a} `);break}};o(r.parts,"");for(let n of r.forms??[])e.push(...Le(n));if(r.facts){e.push("Facts of the whole graph (what fact('<name>') reads):");for(let n of r.facts)e.push(`- ${n.label} (${n.name}): ${n.value??`not worked out \u2014 ${n.refused}`}`)}if(r.problems.length>0){e.push("Problems:");for(let n of r.problems)e.push(`- ${n.at}: ${n.says}`)}return e.join(`
1
+ import{a as Ge}from"./chunk.67U6M7OV.js";import{c as Me,d as Oe,f as Be}from"./chunk.GLWSVSQL.js";import{e as Pe,f as Ce,k as Re,l as re,n as Fe}from"./chunk.7VKSXGTX.js";import{f as Se}from"./chunk.PI44XMY2.js";import{d as _,e as je,k as ne}from"./chunk.UITT6JWW.js";import{b as De,e as Ae}from"./chunk.A5PDXNY6.js";import{C as Q,Ed as $e,Hc as he,Jc as ye,K as de,Lc as we,Ob as fe,Od as ke,Uc as U,Vc as be,Wd as xe,ba as ue,da as Z,fa as H,fc as te,ga as T,gc as ge,ha as me,ia as ee,ja as pe,ma as q,nd as ve,oa as z}from"./chunk.VSCIXAHN.js";function ze(r,e,t){let o=r.tryDefinition(e)?.fields.shape,n=Q(o?.[t]),a=!1,s=!1;for(;n&&(n.type==="optional"||n.type==="default"||n.type==="nullable"||n.type==="prefault");)(n.type==="optional"||n.type==="nullable")&&(a=!0),(n.type==="default"||n.type==="prefault")&&(s=!0),n=Q(n.innerType);if(n?.type!=="enum")return;let p=(n.entries?Object.values(n.entries):n.values??[]).filter(m=>typeof m=="string");return p.length>0?{values:p,empty:a&&!s}:void 0}function E(r,e,t){let o=ze(r,e,t);if(!o)return[];let n=r.tryDefinition(e),a=o.values.map(s=>({value:s,label:De(n,t,s)}));return o.empty&&a.push({value:null,label:`No ${q(n,t).toLowerCase()}`}),a}function X(r,e,t){let o=r[e];return typeof o=="string"&&t.some(n=>n.value===o)?o:null}function se(r,e,t,o,n=E(r.schema,t.kind,o)){return Ie(r,e,t,o,n).flatMap(a=>a.move?[a.move]:[])}function Ie(r,e,t,o,n=E(r.schema,t.kind,o)){let a=Ne(r.schema,r.allMutations(),t.kind,o,n),s=X(t,o,n),p=z(r.schema.tryDefinition(t.kind),t.kind),m=[];for(let{value:A,label:C,by:R,acts:F}of a){if(A===s)continue;let x,I,N;for(let c of F){let w=R==="step"?{[c.subject.arg]:t.id}:{[c.subject.arg]:t.id,[o]:A},S={name:c.name,args:w};if(!c.input.safeParse(w).success){N??=`${c.title??c.name} asks for more than the ${p} itself.`;continue}let k=r.permits(S,e);if(!k.ok){I??=k.refusal?.message??`You may not ${c.title??c.name}.`;continue}try{fe(r.graph,c,w)}catch(f){I??=f instanceof Error?f.message:String(f);continue}x={to:A,call:S,title:c.title??c.name};break}m.push(x?{to:A,label:C,move:x}:{to:A,label:C,why:I??N??`Nothing in this app moves a ${p} to ${C}.`})}return m}function Ne(r,e,t,o,n=E(r,t,o)){let a=Ve(r,e,t,o),s=Ke(r,e,t,o);return n.flatMap(p=>{if(p.value===null)return[];let m=a.filter(A=>A.sets?.[o]===p.value);return[{value:p.value,label:p.label,by:m.length>0?"step":s.length>0?"value":"none",acts:m.length>0?m:s}]})}function Ve(r,e,t,o){return e.filter(n=>n.subject!==void 0&&n.derived===void 0&&typeof n.sets?.[o]=="string"&&te(r,n).includes(t))}function Ke(r,e,t,o){let n=r.tryDefinition(t);return n?e.filter(a=>{if(!a.subject||!te(r,a).includes(t)||!ge(a,n).includes(o))return!1;let s=a.input.shape;return s!==void 0&&o in s}).sort((a,s)=>+(a.derived!==void 0)-+(s.derived!==void 0)):[]}var oe=(r,e)=>e&&r[e]!==void 0?String(r[e]):"";function Xe(r,e,t){let o=c=>r.tryDefinition(c)?e.nodesOfKind(c).filter(w=>H(r.tryDefinition(c),w)):[],n=o(t.rows),a=o(t.columns),s=new Set(n.map(c=>c.id)),p=new Set(a.map(c=>c.id)),m=e.allEdges(),A=[],C=t.link;if(typeof C=="string"){let c=f=>r.tryDefinition(f)?.edges?.[C]?.to,w=(c(t.columns)??[]).some(f=>f===t.rows||f==="*"),S=(c(t.rows)??[]).some(f=>f===t.columns||f==="*"),k=w||!S;for(let f of m){if(f.kind!==C)continue;let j=k?f.to:f.from,i=k?f.from:f.to;s.has(j)&&p.has(i)&&A.push({rowId:j,columnId:i,via:[]})}}else{let c=new Map(C.path.map(S=>[S,new Map]));for(let S of m){let k=c.get(S.kind);if(!k)continue;let f=k.get(S.from);f?f.push(S.to):k.set(S.from,[S.to]);let j=k.get(S.to);j?j.push(S.from):k.set(S.to,[S.from])}let w=new Set;for(let S of a){let k=[{id:S.id,via:[]}];for(let f of C.path){let j=[],i=new Set;for(let $ of k)for(let b of c.get(f).get($.id)??[])i.has(`${$.id}|${b}`)||(i.add(`${$.id}|${b}`),j.push({id:b,via:[...$.via,$.id]}));k=j}for(let f of k){let j=`${f.id}|${S.id}`;!s.has(f.id)||w.has(j)||(w.add(j),A.push({rowId:f.id,columnId:S.id,via:f.via.slice(1)}))}}}let R=t.groupOrder??[],F=c=>R.indexOf(c)===-1?R.length:R.indexOf(c),x=(c,w)=>w==="label"?T(r.tryDefinition(c.kind),c):c[w],I=U(n,t.sort,x).map(c=>{let w=c;return{node:c,label:T(r.tryDefinition(c.kind),c),group:oe(w,t.rowGroup),ref:oe(w,t.rowRef)}}).sort((c,w)=>F(c.group)-F(w.group)||(t.sort!==void 0?0:c.ref<w.ref?-1:c.ref>w.ref?1:0)),N=U(a,t.columnSort,x).map(c=>({node:c,label:T(r.tryDefinition(c.kind),c),group:oe(c,t.columnGroup)})).sort((c,w)=>c.group<w.group?-1:c.group>w.group?1:t.columnSort!==void 0?0:c.node.id<w.node.id?-1:c.node.id>w.node.id?1:0);return{rows:I,columns:N,cells:A}}function We(r,e,t){let{rows:o,columns:n,cells:a}=Xe(r,e,t),s=(i,$)=>ee(r,i,$),p=i=>ee(r,i,1).replace(/^1 /,""),m=i=>({id:i.id,kind:i.kind,title:T(r.tryDefinition(i.kind),i),parts:[]}),A=i=>{let $=e.getNode(i);if(!$)return null;let b=r.tryDefinition($.kind),P=T(b,$),V=_($,b,{limit:3,said:[P],glance:!0}).map(K=>K.alone.startsWith(K.label)?`${K.label.toLowerCase()}${K.alone.slice(K.label.length)}`:K.alone);return[P,...V].join(", ")},C=typeof t.link=="string"?[]:t.link.path.slice(0,-1).flatMap((i,$,b)=>{let P=ve(r,t.columns,b.slice(0,$+1));return P.ok?[...P.reached]:[]}),R=be(r,t,{rows:o.length,columns:n.length,cells:a.length});if(R)return[{t:"text",text:`${s(t.rows,o.length)} against ${s(t.columns,n.length)}.`},{t:"text",text:R}];let F=[{t:"text",text:`${s(t.rows,o.length)} against ${s(t.columns,n.length)}${C.length>0?`, through ${[...new Set(C)].map(i=>s(i,2).replace(/^2 /,"")).join(" and ")}`:""}${n.length>0?`: ${n.map(i=>i.label).join(", ")}`:""}.`}],x=new Map(n.map(i=>[i.node.id,i.label])),I=new Map(n.map((i,$)=>[i.node.id,$])),N=new Map,c=new Map;for(let i of a){let $=N.get(i.rowId);$?$.push(i):N.set(i.rowId,[i]);let b=c.get(i.columnId);b?b.add(i.rowId):c.set(i.columnId,new Set([i.rowId]))}for(let i of o){let b=[...N.get(i.node.id)??[]].sort((P,V)=>I.get(P.columnId)-I.get(V.columnId)).map(P=>{let V=P.via.map(A).filter(K=>K!==null);return`${x.get(P.columnId)}${V.length>0?` (${V.join("; ")})`:""}`});F.push({t:"field",label:i.label,text:b.length>0?b.join(", "):"none"})}F.push({t:"list",as:"name",columns:1,groups:n.map(i=>{let $=c.get(i.node.id)??new Set,b=o.filter(P=>$.has(P.node.id)).map(P=>m(P.node));return{heading:`${i.label} (${b.length})`,items:b}})});let w=new Set(a.map(i=>i.rowId)),S=new Set(a.map(i=>i.columnId)),k=o.filter(i=>!w.has(i.node.id)),f=n.filter(i=>!S.has(i.node.id)),j=t.rows===t.columns;return k.length>0&&F.push({t:"text",text:`${j?`${k.length} with none across`:`${s(t.rows,k.length)} with no ${p(t.columns)}`}: ${k.map(i=>i.label).join(", ")}.`}),f.length>0&&F.push({t:"text",text:`${j?`${f.length} with none down`:`${s(t.columns,f.length)} on no ${p(t.rows)}`}: ${f.map(i=>i.label).join(", ")}.`}),F}function ie(r,e,t,o={}){let{app:n,blocks:a=t?n?.viewSpecs?.[t.kind]?.[o.slot??"page"]:n?.home}=o;if(!a?.length)return[];let s=o.firstHeading??(t||o.blocks?void 0:1),p=Fe(r,e,t,{...o,money:o.money??n?.brand,firstHeading:s});return t&&!p.node?[]:Ce(typeof a[0]?.t=="string"?a:Pe(a),p)}function Y(r,e,t){let o=!(e.optional||e.control==="boolean"),n=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(s=>Z(z(r.tryDefinition(s),s))).join(" or "):t(e.name).label,a={name:e.name,label:n,required:o};switch(e.control){case"text":return{...a,input:e.holds==="duration"?"length of time":e.holds??(e.markdown?"Markdown text":e.long?"long text":e.app?"app address":"text")};case"date":return{...a,input:e.time||e.instant?"date and time":"date"};case"number":return{...a,input:e.amount?"amount":"number",...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max}};case"choice":return{...a,input:"choice",choices:(e.options??[]).map(s=>t(e.name).option(s))};case"boolean":return{...a,input:"yes or no"};case"node":return{...a,input:"record",kinds:e.kinds};case"linked":return{...a,input:"record in another app"};case"file":return{...a,input:e.image?"picture":e.video?"video":"file"};case"repeat":return{...a,input:"how it repeats"};case"list":return{...a,input:`list of ${Y(r,e.item,t).input}`};case"group":return{...a,input:"group",fields:e.fields.map(s=>Y(r,s,t))};case"variant":return{...a,input:"one of",choices:e.options.map(s=>Z(s.value))};default:return{...a,input:"answer"}}}function Te(r,e,t){let o=Oe(r,e,t),n=r.schema,a=Me(n,t).filter(p=>p.name!==t.subject?.arg&&!o.has(p.name)),s=me(t);return{act:t.name,title:s,submit:s,fields:a.map(p=>Y(n,p,m=>ne(n,t,m)))}}function He(r,e){return{act:e.act.name,title:e.title,submit:e.submit,visitor:e.name,fields:e.fields.map(t=>Y(r,t,o=>ne(r,e.act,o)))}}function Ee(r,e,t){return r.permittedMutations(e).filter(o=>!o.derived&&!o.subject&&(o.creates??[]).includes(t))}function Le(r,e=""){let t=[`${e}Form "${r.title}" (${r.visitor?`the visitor form ${r.visitor}, running `:""}act ${r.act}), button "${r.submit}":`],o=(n,a)=>{for(let s of n){let p=s.choices?`${s.input}: ${s.choices.join(", ")}`:s.kinds?`${s.input} (${s.kinds.join(" or ")})`:s.input,m=s.min!==void 0||s.max!==void 0?`, ${s.min??"\u2026"} to ${s.max??"\u2026"}`:"";t.push(`${a}- ${s.label}${s.required?" *":""} (${s.name}) \u2014 ${p}${m}`),s.fields&&o(s.fields,`${a} `)}};return o(r.fields,`${e} `),r.fields.length===0&&t.push(`${e} (asks nothing)`),t}function Ue(r,e){let t=r.viewSpecs??{};return e.filter(o=>o.cardinality==="one"&&o.replaces==="page"&&(t[o.attach]?.page?.length??0)>0).map(o=>{let n=L(r.schema,o.attach,1);return{at:`views.${o.attach}.page`,says:`The view "${o.name}" replaces ${Ye(n)}'s page, so its page slot is never drawn: leave out replaces to draw the slot under the view, or draw what the slot says in the view.`}})}var Ye=r=>`${/^[aeiou]/i.test(r)?"an":"a"} ${r}`,Je=240,Ze=10,Qe=1160,et=40,_e=640,tt=3,nt=r=>Math.max(1,Math.floor((Math.min(r,Qe)-et+Ze)/(Je+Ze)));function rt(r,e,t,o){let{app:n}=o,a=o.width??1440,s=o.today??r.today()??de(n.brand?.timeZone),p=r.seenBy(e),m=p.schema,A=p.graph,C=Ge(n,o.views?{views:o.views}:{}),R=typeof t=="string"?t.trim():t.slug,F=typeof t=="string"?C.find(l=>l.slug===R||l.title===R||l.address===R):C.find(l=>l.slug===t.slug&&l.kind===t.kind)??t,x=!F&&typeof t=="string"?A.getNode(R):void 0,I=!F&&!x?/^\/?forms\/(.+)$/.exec(R)?.[1]:void 0,N=I!==void 0?Be(n,I):void 0;if(N)return{ok:!0,description:st(m,N,a)};if(!F&&!x)return{ok:!1,error:`"${R}" is not a place this app has, nor a record this seat can see.`,places:[...C.map(l=>l.slug),...Object.keys(n.forms??{}).map(l=>`forms/${l}`)]};let c=[],w=n.viewSpecs??{},S=nt(a),k=(l,h)=>ie(p,null,l,{app:n,today:s,...h}),f=(l,h,M)=>{let d=m.tryDefinition(l.kind),g=T(d,l);if(h==="name")return{id:l.id,kind:l.kind,title:g,parts:[]};if(w[l.kind]?.[h]){let G=k(l,{slot:h}),[B,...O]=G,y=B?.t==="title"||h==="row"&&B?.t==="headline";return{id:l.id,kind:l.kind,title:y?B.text:g,parts:j(y?O:G,M,`views.${l.kind}.${h}`,` (${l.id})`,y?1:0)}}if(h==="row")return{id:l.id,kind:l.kind,title:g,parts:[]};let u=d?.computed?re(m,A,l):l,W=_(u,d,{limit:3,said:[g],glance:!0,locale:n.brand?.locale,timeZone:n.brand?.timeZone});return{id:l.id,kind:l.kind,title:g,parts:W.map(G=>({t:"text",text:G.alone}))}};function j(l,h,M,d="",g=0){let v=[];return l.forEach((u,W)=>{let G=`${M}.${W+g}`;switch("problem"in u&&u.problem&&c.push({at:`${G}${d}`,says:u.problem}),u.t){case"title":v.push({t:"heading",level:3,text:u.text});return;case"text":v.push({t:"text",text:u.markdown?Ae(u.text):u.runs?it(u.runs):u.text,...u.tone?{tone:u.tone}:{}});return;case"badge":v.push({t:"badge",text:u.text});return;case"field":case"image":v.push({t:"field",label:u.label,text:u.text});return;case"progress":v.push({t:"progress",label:u.label,text:u.text});return;case"group":v.push(...j(u.blocks,h,`${G}.group`,d));return;case"when":v.push(...j(u.blocks,h,`${G}.show`,d));return;case"divider":case"figure":return;case"headline":v.push({t:"heading",level:u.level,text:u.text});return;case"number":v.push({t:"figure",text:u.text,...u.label?{label:u.label}:{}});return;case"list":{if(u.failed){v.push({t:"text",text:"\u2014"});return}if(u.members.length===0){u.empty&&v.push({t:"list",as:u.as,columns:1,groups:[],empty:u.empty});return}let B=h+1,O=B>tt?"name":u.as,y=(u.groups??[{value:null,members:u.members}]).map(D=>({..."heading"in D&&D.heading?{heading:D.heading,count:(u.everyGroup?.find(J=>J.value===D.value)??D).members.length}:{},items:D.members.map(J=>f(J,O,B))}));v.push({t:"list",as:O,columns:O==="card"?S:1,groups:y,...u.more>0?{more:u.more}:{}});return}}}),v}let i=[],$,b,P,V=[];if(x){b="record";let l=m.tryDefinition(x.kind),h=T(l,x);P={slug:x.id,title:h,kind:x.kind,address:$e(m,x.kind,x.id)};let M=w[x.kind]?.page,d=o.views?.find(g=>g.attach===x.kind&&g.cardinality==="one");if(d&&i.push({t:"view",name:d.name,...d.title?{title:d.title}:{},...d.replaces==="page"?{replaces:!0}:{},...d.parts?{parts:d.parts}:{}}),d?.replaces==="page")b=`view:${d.name}`,c.push(...Ue(n,[d]));else{M&&i.push(...j(k(x,{slot:"page"}),1,`views.${x.kind}.page`));let g=l?.computed?re(m,A,x):x;for(let v of je(l,_(g,l,{said:[h],locale:n.brand?.locale,timeZone:n.brand?.timeZone}))){v.title&&i.push({t:"heading",level:2,text:v.title});for(let u of v.fields)i.push({t:"field",label:u.label,text:u.value,...u.long?{long:!0}:{},...u.markdown?{markdown:!0}:{}})}}}else{let l=F;P={slug:l.slug,title:l.title,kind:l.kind,address:l.address};let h=l.lens?ke(n).drawn.find(d=>d.as===l.slug&&(l.kind===null||d.kinds.includes(l.kind))):void 0,M=l.kind!==null&&l.view===void 0&&!h?o.views?.find(d=>d.attach===l.kind&&d.cardinality==="many"&&d.replaces==="page"&&!d.hidden):void 0;if(l.kind!==null&&h?.create!==!1&&l.view===void 0&&!M&&(V=Ee(r,e,l.kind).map(d=>Te(r,e,d))),l.view!==void 0&&!h){let d=o.views?.find(g=>g.name===l.view);b=`view:${l.view}`,i.push({t:"view",name:l.view,title:d?.title??l.title,...typeof d?.flows=="boolean"?{flows:d.flows}:{},...d?.parts?{parts:d.parts}:{}})}else if(l.kind===null){let d=n.brand,g=d?.name??n.name,v=we(d)?.light,u=v&&ye(v)?v:void 0;if($={name:g,...d?.subtitle&&d.subtitleDrawn!==!1?{subtitle:d.subtitle}:{},...u?{logo:{alt:d?.logoAlt??g,...he(u)?{drawn:"inline SVG"}:{drawn:"image",src:u}}}:{}},n.home)b="blocks",i=j(k(null,{}),0,"views.home");else{b="derived";let W=r.kindsKeptFrom(e),G=new Set([...n.pages?.hide??[],...W,...r.modules.disabledKinds]),B=xe(m.kinds,n.pages?.order).filter(O=>!G.has(O));i.push({t:"heading",level:1,text:n.name??"Home"});for(let O of B){let y=A.nodesOfKind(O).filter(D=>H(m.tryDefinition(O),D)).length;y>0&&i.push({t:"text",text:`${y} ${L(m,O,y)}`})}}}else if(h?.lens==="blocks")b="lens:blocks",i=j(k(null,{blocks:h.options.blocks??[]}),0,`lenses.${h.index}.options.blocks`);else if(h?.lens==="columns"){b="lens:columns";let d=h.options.bindings??{};for(let g of Object.keys(d)){let v=d[g]?.column;if(!v)continue;let u=E(m,g,v),W=U(A.nodesOfKind(g).filter(y=>H(m.tryDefinition(g),y)),h.options.sort,(y,D)=>D==="label"?T(m.tryDefinition(y.kind),y):y[D]);Object.keys(d).length>1&&i.push({t:"heading",level:2,text:L(m,g,2).replace(/^./,y=>y.toUpperCase())}),i.push({t:"text",text:`${W.length} ${L(m,g,W.length)} in columns by ${q(m.tryDefinition(g),v).toLowerCase()}.`});let G=u.map(y=>({column:y,items:W.filter(D=>X(D,v,u)===y.value).map(D=>f(D,"card",1))})).filter(({column:y,items:D})=>y.value!==null||D.length>0).map(({column:y,items:D})=>({heading:`${y.label} (${D.length})`,items:D}));i.push({t:"list",as:"card",columns:1,groups:G});let B=new Map;for(let y of W)for(let D of se(r,e,y,v,u))B.set(D.to,(B.get(D.to)??new Set).add(`"${D.title}"`));let O=u.filter(y=>y.value!==null&&B.has(y.value)).map(y=>`to ${y.label} by ${[...B.get(y.value)].join(" or ")}`);i.push({t:"text",text:O.length>0?`Moves: ${O.join("; ")}.`:"Moves: none for this seat."})}}else if(h?.lens==="coverage")b="lens:coverage",i=We(m,A,h.options);else if(h){b=`lens:${h.lens}`;let d=h.kinds.flatMap(g=>A.nodesOfKind(g).filter(v=>H(m.tryDefinition(g),v)));i.push({t:"text",text:`A ${h.lens} of ${d.length} ${h.kinds.map(g=>L(m,g,d.length)).join(" and ")}.`}),i.push({t:"list",as:"name",columns:1,groups:[{items:d.map(g=>f(g,"name",1))}]})}else if(M)b=`view:${M.name}`,i.push({t:"heading",level:1,text:l.title}),i.push({t:"view",name:M.name,...M.title?{title:M.title}:{},replaces:!0,...M.parts?{parts:M.parts}:{}});else{b="derived";let d=A.nodesOfKind(l.kind).filter(g=>H(m.tryDefinition(l.kind),g));i.push({t:"heading",level:1,text:l.title}),d.length===0?i.push({t:"list",as:"row",columns:1,groups:[],empty:`No ${L(m,l.kind,0)} yet.`}):i.push({t:"list",as:"row",columns:1,groups:[{items:d.map(g=>f(g,"row",1))}]})}}let K=e.kind==="system"?"the system":(e.roles??[]).length>0?(e.roles??[]).join(", "):e.kind,qe=a<_e?"phone":"wide",le=P.kind===null?ot(m,A):[],ce={...$?{masthead:$}:{},...le.length>0?{facts:le}:{},place:P,seat:K,width:a,variant:qe,drawnBy:b,parts:i,...V.length>0?{forms:V}:{},problems:c};return{ok:!0,description:{...ce,text:ae(ce)}}}function st(r,e,t){let o=[{t:"heading",level:1,text:e.title},...e.intro?[{t:"text",text:e.intro}]:[]],n={place:{slug:`forms/${e.name}`,title:e.title,kind:null,address:`/forms/${e.name}`},seat:`a visitor (${e.role})`,width:t,variant:t<_e?"phone":"wide",drawnBy:"form",parts:o,forms:[He(r,e)],problems:[]};return{...n,text:ae(n)}}function ot(r,e){let t=Re(r,e,null),o=n=>Array.isArray(n)?n.map(o).join(", "):n===null?"nothing":typeof n=="boolean"?n?"yes":"no":typeof n=="object"?n.label:String(n);return[...Se(r)].map(([n,a])=>{let s=a.label??Z(n);return Object.hasOwn(t.values,n)?{name:n,label:s,value:o(t.values[n])}:{name:n,label:s,refused:t.refused[n]??"it could not be worked out"}})}function L(r,e,t){let o=r.tryDefinition(e);if(t===1)return o?.noun??e;let n=pe(r,e);return ue(n)}function ae(r){let e=[`${r.place.title} (${r.place.address}) \u2014 as ${r.seat}, ${r.width} wide (${r.variant}).`],t=r.masthead;t&&e.push(`Masthead: ${t.logo?`the logo ("${t.logo.alt}", ${t.logo.drawn==="image"?t.logo.src:"inline SVG"}), `:""}${t.name}${t.subtitle?` \u2014 ${t.subtitle}`:""}`);let o=(n,a)=>{for(let s of n)switch(s.t){case"heading":e.push(`${a}${"#".repeat(s.level)} ${s.text}`);break;case"text":e.push(`${a}${s.text}`);break;case"badge":e.push(`${a}[${s.text}]`);break;case"field":case"progress":e.push(`${a}${s.label}: ${s.text}`);break;case"figure":e.push(`${a}${s.text}${s.label?` \u2014 ${s.label}`:""}`);break;case"list":if(s.groups.length===0){s.empty&&e.push(`${a}(${s.empty})`);break}for(let p of s.groups){p.heading&&e.push(`${a}${p.heading}${p.count!==void 0?` (${p.count})`:""}:`);for(let m of p.items)e.push(`${a}${p.heading?" ":""}- ${m.title}`),o(m.parts,`${a}${p.heading?" ":" "}`)}s.as==="card"&&s.columns>1&&e.push(`${a}(cards, ${s.columns} across)`),s.more&&e.push(`${a}and ${s.more} more`);break;case"view":e.push(`${a}[the view "${s.title??s.name}"${s.replaces?", in place of the page":""}${s.flows===!0?", flowing with the page":s.flows===!1?", in a frame of its own":""}]`),s.parts&&o(s.parts,`${a} `);break}};o(r.parts,"");for(let n of r.forms??[])e.push(...Le(n));if(r.facts){e.push("Facts of the whole graph (what fact('<name>') reads):");for(let n of r.facts)e.push(`- ${n.label} (${n.name}): ${n.value??`not worked out \u2014 ${n.refused}`}`)}if(r.problems.length>0){e.push("Problems:");for(let n of r.problems)e.push(`- ${n.at}: ${n.says}`)}return e.join(`
2
2
  `)}function it(r){return r.map((e,t)=>(t===0?"":e.field===void 0&&r[t-1].field===void 0?" \xB7 ":" ")+e.text).join("")}export{E as a,X as b,se as c,Ie as d,Ne as e,Ve as f,Ke as g,ie as h,Ue as i,rt as j,ae as k};
@@ -0,0 +1 @@
1
+ import{l as O}from"./chunk.OJGHDWI6.js";import{j as C}from"./chunk.UITT6JWW.js";import{G as b,La as K,T as M,ba as w,c as W,ca as I,da as H,x as G}from"./chunk.4MP72LPR.js";import{C as D,Gb as N,Pb as _,Xb as L,Xc as V,Yc as B,gc as j,rb as F}from"./chunk.VSCIXAHN.js";import{b as m}from"./chunk.AJZBJBMO.js";function U(n,e){let t=n.graph.getNode(e);if(!t)return[];let i=t.kind,a=n.schema.tryDefinition(i);if(!a)return[];let c=n.seenFor,u=c?N.keptFrom?.(n,c)?.(t):void 0,o=new Map;for(let r of n.allMutations()){let s=r.subject;if(!s||!(s.kinds==="*"||s.kinds.includes(i)))continue;let l=r.input.shape??{};for(let d of j(r,a)){if(u?.(d)||!_(r,n.schema,n.graph,e,d,c&&F(c).id))continue;let x=d in l,k=[];for(let h of Object.keys(l)){if(h===s.arg||h===d||ee(l[h]))continue;let v=L(r.input).find(S=>S.name===h);k.push({name:h,...v?{kinds:v.kinds}:{},...v?{candidates:v.kinds.includes("*")?n.graph.allNodes().map(S=>S.id):v.kinds.flatMap(S=>n.graph.nodesOfKind(S).map(Z=>Z.id))}:{},shape:C(r.input,h)})}let X={field:d,mutation:r.name,title:r.title??r.name,shape:x?C(r.input,d):{type:"unknown"},takesValue:x,alternatives:[],open:k,clearable:x&&(r.clearable?.includes(d)??!1),call:h=>({name:r.name,args:x?{[s.arg]:e,[d]:h}:{[s.arg]:e}})};o.set(d,[...o.get(d)??[],X])}}return[...o.values()].map(r=>{let s=[...r.filter(d=>d.takesValue),...r.filter(d=>!d.takesValue)],[f,...l]=s;return{...f,alternatives:l}})}function ee(n){let e=D(n)?.type;return e==="optional"||e==="default"||e==="nullable"}var R=m(b(),1);function Se(n){let{store:e,principal:t}=w(),i=H(),a=(0,R.useMemo)(()=>n===null?[]:U(e,n),[e,n,i]),c=(0,R.useCallback)((u,o,r={})=>{let s=u.call(o);e.apply({name:s.name,args:{...s.args,...r}},{author:t})},[e,t]);return{fields:a,commit:c}}var $=m(b(),1);function Xe(){let{brand:n}=w(),e=n?.kit;return(0,$.useMemo)(()=>V(e),[e])}function Ze(n,e){let t=B(n,e),i={...t.color!==void 0?{color:t.color}:{},...t.pattern!==void 0?{pattern:t.pattern}:{},...t.width!==void 0?{width:t.width}:{},...t.cap!==void 0?{cap:t.cap}:{},...t.opacity!==void 0?{opacity:t.opacity}:{}};return{connector:t,style:O(e,{[e]:i})}}var q=m(b(),1);var g=m(M(),1);function ne(n){let e=n?.hint;return typeof e=="string"&&e.length>0?e:void 0}function te(n){if(n instanceof Error&&n.message)return n.message;let e=String(n);return e==="[object Object]"?"The view threw without a message.":e}var z=class extends q.Component{static contextType=K;state={};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[graview] the ${this.props.view??"view"} of ${this.props.kind} threw while rendering`,e,t.componentStack),this.context?.(e,{module:"@graview/react"})}render(){let{error:e}=this.state;if(!e)return this.props.children;let t=ne(e);return(0,g.jsxs)("div",{role:"alert","data-graview-view-error":this.props.kind,style:{display:"flex",flexDirection:"column",gap:"0.375rem",padding:"var(--graview-pad, 12px)",height:"100%",overflow:"auto",boxSizing:"border-box",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)",font:"var(--graview-font-body, 13px/1.45 system-ui)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,g.jsx)("strong",{style:{color:"var(--graview-warn, #b4462a)"},children:this.props.view?`${this.props.view} could not draw`:"This view could not draw"}),(0,g.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:this.props.kind}),(0,g.jsx)("span",{children:te(e)}),t?(0,g.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:t}):null]})}};var y=m(b(),1);var Q=m(M(),1),A=(0,y.createContext)([]);function on({sections:n,children:e}){let t=(0,y.useContext)(A),i=(0,y.useMemo)(()=>[...t,...n.filter(a=>!t.includes(a))],[t,n]);return(0,Q.jsx)(A.Provider,{value:i,children:e})}function Y(){let n=(0,y.useContext)(A),e=I()?.menuSections;return(0,y.useMemo)(()=>e?[...n,...e.filter(t=>!n.includes(t))]:n,[n,e])}function an(){let n=Y();return(0,y.useCallback)(e=>{for(let t of n)try{t(e)?.prepare?.()}catch{}},[n])}function sn(n){let e=Y();if(n===null||e.length===0)return{start:[],end:[]};let t=e.flatMap(i=>{try{let a=i(n);return a&&((a.items?.length??0)>0||a.render)?[a]:[]}catch{return[]}});return{start:t.filter(i=>i.at==="start"),end:t.filter(i=>i.at!=="start")}}var re=m(b(),1);function un(){return w().activity}var P=(n,e)=>n.length*e*.58;var oe=156,ie=2,E=oe-18,ae=7.1,se=16;function ce(n,e){let t=0,i=E;for(let a of n.split(" ")){let c=e(a),u=i+e(" ")+c;if(u<=E)i=u;else{let o=Math.ceil(c/E)||1;t+=o,i=c-(o-1)*E}}return t}var de=16.25,J=27,ue=(n,e)=>{let t=Math.ceil(n.length*ae/E);return e?Math.max(J,Math.ceil(Math.max(t,ce(n,e))*de)+6):Math.max(J,t*se+6)};function fn(n,e,t){return n.length===0?0:10+n.reduce((i,a)=>i+ue(a,t),0)+(n.length-1)*ie}var le=27,pe=8,mn=4,fe=64,yn=n=>Math.max(1,Math.min(pe,n)),hn=n=>n*le+fe;var p=m(b(),1);function wn(n,{units:e,target:t=0,legibleAt:i=260}){let[a,c]=(0,p.useState)(e);(0,p.useEffect)(()=>{let o=n.current;if(o===null||typeof ResizeObserver>"u")return;let r=new ResizeObserver(([s])=>{let f=s?.contentRect.width??0;f>0&&c(f)});return r.observe(o),()=>r.disconnect()},[n]);let u=a/e;return{scale:u,width:a,touchable:u*t>=24,legible:a>=i}}function vn(n="--graview-font-body",e="sans-serif"){let t=(0,p.useRef)(void 0),i=(0,p.useMemo)(()=>{if(typeof getComputedStyle!="function"||typeof document>"u")return e;let a=getComputedStyle(document.documentElement).getPropertyValue(n).trim();return a.length>0?a:e},[n,e]);return(0,p.useMemo)(()=>{t.current===void 0&&(t.current=typeof document>"u"?null:document.createElement("canvas").getContext("2d")??null);let a=t.current;return a===null?P:(c,u)=>{a.font=`${u}px ${i}`;let o=a.measureText(c).width;return o>0?o:P(c,u)}},[i])}var Sn=(0,p.createContext)(void 0);var T=3;function me(n){let e=W(n),t=e.focusId;if(!t)return null;if(e.within?.view){let[a]=G(t);if(a)return{at:`screen:${a}`,audience:!0}}return{at:t,audience:!1}}var ye=102,he=32;function Mn(n,e,t){let i=[],a=new Map,c=new Map,u=0;for(let o of n){let r=me(o.stop),s=r?e(r.at):null;if(!r||!s){o.name&&i.push({kind:"edge",presence:o,point:{x:t-8,y:ye+u++*he}});continue}if(!o.name){let k=c.get(r.at);c.set(r.at,{n:(k?.n??0)+1,box:s});continue}let f=a.get(r.at)??[];if(f.push(o),a.set(r.at,f),f.length>T)continue;let l=s,d=f.length-1,x=r.audience?{x:l.x+l.width*.5+(d-1)*26,y:l.y+Math.min(l.height,24)}:{x:l.x+l.width*.5-26-d*26,y:l.y+l.height-4};i.push({kind:"person",presence:o,point:x,at:r.at,index:d,of:f.length,audience:r.audience})}for(let[o,r]of a){if(r.length<=T)continue;let s=e(o);s&&i.push({kind:"count",at:o,point:{x:s.x+s.width*.5+2*26+18,y:s.y+s.height-4},n:r.length-T})}for(let[o,{n:r,box:s}]of c)i.push({kind:"count",at:o,point:{x:s.x+s.width*.5+40,y:s.y+s.height-4},n:r});for(let o of n)if(o.name){if(o.robot?.at&&o.robot.mode!=="docked"){let r=e(o.robot.at);r&&i.push({kind:"robot",presence:o,point:{x:r.x+r.width/2+22,y:r.y+r.height-4},mode:o.robot.mode})}if(o.over){let r=e(o.over);r&&i.push({kind:"over",presence:o,box:r})}}return i}export{un as a,P as b,oe as c,ie as d,J as e,fn as f,le as g,mn as h,fe as i,yn as j,hn as k,wn as l,vn as m,Se as n,Xe as o,Ze as p,Mn as q,z as r,on as s,an as t,sn as u};
@@ -1,4 +1,4 @@
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 jt,b as qt,c as Ft,d as Gn}from"./chunk.XOTES3PI.js";import{a as Gt}from"./chunk.WGTBQHHE.js";import{a as Hn,b as Dt,c as Vn,d as zt,e as Bt,f as It}from"./chunk.P52UTBNO.js";import{c as _t,g as Kt,h as Ut,i as Yt}from"./chunk.HF5SNUTK.js";import{e as Lt}from"./chunk.UM5H2VVR.js";import{m as Nt}from"./chunk.WEGPDJTB.js";import{a as Pt,b as Tt}from"./chunk.MRYN42EQ.js";import{f as Et,h as Mt}from"./chunk.E22DDEQI.js";import{e as At}from"./chunk.OLW44AP5.js";import{a as Wt,b as tn,c as Ht,d as Vt}from"./chunk.CZH27V2R.js";import{b as Ct,c as pe,d as ke,e as ze}from"./chunk.IZ2ZTNEV.js";import{e as $t,l as Ot}from"./chunk.Q6LLURRM.js";import{l as Rt,m as Wn}from"./chunk.KHZA5F7A.js";import{f as Bn,g as In}from"./chunk.NSGQXCH6.js";import{d as kt}from"./chunk.SZG6HJWH.js";import{h as Fe,j as St}from"./chunk.6IUEGPCZ.js";import{G as Ee,Na as xt,Oa as nn,T as te,W as wt,ba as oe,ca as vt,da as bt,l as en}from"./chunk.VNJKGSGZ.js";import{$ as Xe,Jd as yt,Oc as Ze,Pc as ht,Ra as ut,Va as gt,Vc as Te,W as cn,Wa as mt,X as st,Xa as pt,Y as lt,Z as Tn,_ as dt,bc as ft,fa as Ve,ga as xe,ia as qe,ja as un,ka as gn,ld as zn,ma as Nn,na as ct,oa as mn,ub as Dn,uc as be}from"./chunk.X3MMJ3QC.js";import{b as F}from"./chunk.AJZBJBMO.js";var Kr=F(Ee(),1);var jn=F(te(),1);function Be(e,t,n){let r=e.nodes?.length??0;if(e.total===void 0||e.total<=r)return n;let a=e.nodes?.[0]?.kind,i=a?un(t,a).toLowerCase():"more";return(0,jn.jsxs)("div",{style:{display:"grid",gridTemplateRows:"minmax(0, 1fr) auto",height:"100%",minHeight:0},children:[n,(0,jn.jsxs)("p",{"data-testid":"lens-more",style:{margin:"4px 0 0",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["+",e.total-r," more ",i]})]})}var tr=F(Ee(),1);var rn=F(Ee(),1);var Qt=e=>`place:${e}`;function Jt(e,t){(0,rn.useEffect)(()=>{if(e===void 0)return;let n=globalThis[Symbol.for("graview.shown-lists")]??=new Map;return n.set(e,()=>t),()=>void n.delete(e)})}var Xt=e=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.6YGRRXJB.js")).then(t=>t.saveShownList(e.read()));function Zt(e,t,n){let r={off:e,about:t,read:n,menu:(a,i,s)=>[...e?[]:[{id:"export-csv",label:"Export CSV",run:()=>void Xt(r)}],...a&&i?[{id:e?"export-on":"export-off",label:e?"Turn on export":"Turn off export",run:()=>void (__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.6YGRRXJB.js")).then(m=>m.switchExport(r,i,e,s))}]:[]]};return r}function er({said:e}){return(0,rn.createElement)("button",{type:"button",className:"graview-arrange-open","data-testid":"arrange-export","aria-label":"Export CSV",title:"Export CSV",onClick:()=>void Xt(e)},(0,rn.createElement)("span",{"aria-hidden":"true"},"\u2193"),"CSV")}var nr=F(Ee(),1),pn=(0,nr.createContext)(null);var qn=F(te(),1),Yr=(e,t)=>{if(e===!1||t===!1)return!1;let n=e===void 0||e===!0?{}:e,r=t===void 0||t===!0?{}:t;return{sort:n.sort!==!1&&r.sort!==!1,filter:n.filter!==!1&&r.filter!==!1,group:n.group!==!1&&r.group!==!1}},Qr=["sort","filter","group","q","archived"];function Ne(e,t={}){let{store:n,onExport:r}=oe(),a=(0,tr.useContext)(pn),{view:i,go:s}=nn(),c=Qr.some(M=>i.within?.[M]!==void 0)?Pt(i):t.arrangedBy??{},b=e.nodes??[],d=t.kind??b[0]?.kind??e.node?.kind,y=c.archived!==void 0&&c.archived!==!1&&d!==void 0&&!t.subject?n.graph.nodesOfKind(d,{archived:c.archived}):b,p=t.subject??(t.only?y.filter(t.only):y),o=t.subject?[]:t.only?y.filter(M=>!t.only(M)):[],l=t.kind??p[0]?.kind,k=Yr(t.allow,t.lensAllows),u=l?At(n.schema,String(l)):void 0,x=u?Et(c,u).arrangement:{},R=Mt(p,k===!1?{}:x,{schema:n.schema,graph:n.graph,flagged:new Set(e.flagged??[]),...t.search?{searchIn:t.search}:{}}),L=e.retired!==void 0&&e.retired>0&&(b[0]?.kind??l)===l?e.retired:0,T=e.fidelity==="full"&&e.budget===void 0,w=l!==void 0&&T&&t.exportable!==!1,O=Zt(a?.export===!1,{lens:a?.title??"",...a?.on!==void 0?{on:a.on}:{}},()=>({title:a?.title??gn(n.schema,String(l)),schema:n.schema,graph:n.graph,kind:String(l),groups:R.groups,grouped:R.grouped,onExport:r,words:{labelOf:xe,readableFields:kt,withComputed:Ot}}));Jt(a&&w?Qt(a.as):void 0,O);let g=l&&k!==!1&&T&&(p.length>1||L>0)?(0,qn.jsx)(Nt,{schema:n.schema,graph:n.graph,kind:String(l),arrangement:x,allow:k,query:t.query!==!1,...t.filters?{filters:t.filters,chips:{nodes:p,flagged:new Set(e.flagged??[])}}:{},onChange:M=>s(Tt(i,M)),kept:{shown:R.nodes.length,of:p.length},...L>0?{past:{count:L,widen:()=>s(Lt(i,!0))}}:{},...w&&!O.off?{end:(0,qn.jsx)(er,{said:O})}:{}}):null;return{nodes:[...o,...R.nodes],arranged:R,arrangement:x,bar:g}}function _e(e,t,n){let r=new Set((n??[]).map(i=>i.kind)),a=new Set((n??[]).map(i=>i.id));return e.allNodes().filter(i=>r.has(i.kind)?a.has(i.id):Ve(t.tryDefinition(i.kind),i))}var Ie=F(Ee(),1);var j=F(te(),1),Jr=["slots","x","y","fill"],fn=class extends Error{constructor(n,r){super(`${n}
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 jt,b as qt,c as Ft,d as Gn}from"./chunk.MVWC3VR3.js";import{a as Gt}from"./chunk.CC5BJH5A.js";import{a as Hn,b as Dt,c as Vn,d as zt,e as Bt,f as It}from"./chunk.QI4SLPQ4.js";import{c as _t,g as Kt,h as Ut,i as Yt}from"./chunk.CFKZXLXS.js";import{e as Lt}from"./chunk.FRYBMS3W.js";import{m as Nt}from"./chunk.LQVAABPS.js";import{a as Pt,b as Tt}from"./chunk.NGTRL5U4.js";import{f as Et,h as Mt}from"./chunk.3MOJF7BA.js";import{e as At}from"./chunk.LZIBQ3VX.js";import{a as Wt,b as tn,c as Ht,d as Vt}from"./chunk.IHBUBZQT.js";import{b as Ct,c as pe,d as ke,e as ze}from"./chunk.3XGA65Y3.js";import{e as $t,l as Ot}from"./chunk.7VKSXGTX.js";import{l as Rt,m as Wn}from"./chunk.IOK4GVJC.js";import{f as Bn,g as In}from"./chunk.MSWWWLEA.js";import{d as kt}from"./chunk.UITT6JWW.js";import{h as Fe,j as St}from"./chunk.WC3DENU4.js";import{G as Ee,Na as xt,Oa as nn,T as te,W as wt,ba as oe,ca as vt,da as bt,l as en}from"./chunk.4MP72LPR.js";import{$ as Xe,$c as Te,Ac as be,Ld as yt,Ra as ut,Uc as Ze,Va as gt,Vc as ht,W as cn,Wa as mt,X as st,Xa as pt,Y as lt,Z as Tn,_ as dt,fa as Ve,ga as xe,hc as ft,ia as qe,ja as un,ka as gn,ma as Nn,na as ct,nd as zn,oa as mn,ub as Dn}from"./chunk.VSCIXAHN.js";import{b as F}from"./chunk.AJZBJBMO.js";var Kr=F(Ee(),1);var jn=F(te(),1);function Be(e,t,n){let r=e.nodes?.length??0;if(e.total===void 0||e.total<=r)return n;let a=e.nodes?.[0]?.kind,i=a?un(t,a).toLowerCase():"more";return(0,jn.jsxs)("div",{style:{display:"grid",gridTemplateRows:"minmax(0, 1fr) auto",height:"100%",minHeight:0},children:[n,(0,jn.jsxs)("p",{"data-testid":"lens-more",style:{margin:"4px 0 0",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["+",e.total-r," more ",i]})]})}var tr=F(Ee(),1);var rn=F(Ee(),1);var Qt=e=>`place:${e}`;function Jt(e,t){(0,rn.useEffect)(()=>{if(e===void 0)return;let n=globalThis[Symbol.for("graview.shown-lists")]??=new Map;return n.set(e,()=>t),()=>void n.delete(e)})}var Xt=e=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.6YGRRXJB.js")).then(t=>t.saveShownList(e.read()));function Zt(e,t,n){let r={off:e,about:t,read:n,menu:(a,i,s)=>[...e?[]:[{id:"export-csv",label:"Export CSV",run:()=>void Xt(r)}],...a&&i?[{id:e?"export-on":"export-off",label:e?"Turn on export":"Turn off export",run:()=>void (__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.6YGRRXJB.js")).then(m=>m.switchExport(r,i,e,s))}]:[]]};return r}function er({said:e}){return(0,rn.createElement)("button",{type:"button",className:"graview-arrange-open","data-testid":"arrange-export","aria-label":"Export CSV",title:"Export CSV",onClick:()=>void Xt(e)},(0,rn.createElement)("span",{"aria-hidden":"true"},"\u2193"),"CSV")}var nr=F(Ee(),1),pn=(0,nr.createContext)(null);var qn=F(te(),1),Yr=(e,t)=>{if(e===!1||t===!1)return!1;let n=e===void 0||e===!0?{}:e,r=t===void 0||t===!0?{}:t;return{sort:n.sort!==!1&&r.sort!==!1,filter:n.filter!==!1&&r.filter!==!1,group:n.group!==!1&&r.group!==!1}},Qr=["sort","filter","group","q","archived"];function Ne(e,t={}){let{store:n,onExport:r}=oe(),a=(0,tr.useContext)(pn),{view:i,go:s}=nn(),c=Qr.some(M=>i.within?.[M]!==void 0)?Pt(i):t.arrangedBy??{},b=e.nodes??[],d=t.kind??b[0]?.kind??e.node?.kind,y=c.archived!==void 0&&c.archived!==!1&&d!==void 0&&!t.subject?n.graph.nodesOfKind(d,{archived:c.archived}):b,p=t.subject??(t.only?y.filter(t.only):y),o=t.subject?[]:t.only?y.filter(M=>!t.only(M)):[],l=t.kind??p[0]?.kind,k=Yr(t.allow,t.lensAllows),u=l?At(n.schema,String(l)):void 0,x=u?Et(c,u).arrangement:{},R=Mt(p,k===!1?{}:x,{schema:n.schema,graph:n.graph,flagged:new Set(e.flagged??[]),...t.search?{searchIn:t.search}:{}}),L=e.retired!==void 0&&e.retired>0&&(b[0]?.kind??l)===l?e.retired:0,T=e.fidelity==="full"&&e.budget===void 0,w=l!==void 0&&T&&t.exportable!==!1,O=Zt(a?.export===!1,{lens:a?.title??"",...a?.on!==void 0?{on:a.on}:{}},()=>({title:a?.title??gn(n.schema,String(l)),schema:n.schema,graph:n.graph,kind:String(l),groups:R.groups,grouped:R.grouped,onExport:r,words:{labelOf:xe,readableFields:kt,withComputed:Ot}}));Jt(a&&w?Qt(a.as):void 0,O);let g=l&&k!==!1&&T&&(p.length>1||L>0)?(0,qn.jsx)(Nt,{schema:n.schema,graph:n.graph,kind:String(l),arrangement:x,allow:k,query:t.query!==!1,...t.filters?{filters:t.filters,chips:{nodes:p,flagged:new Set(e.flagged??[])}}:{},onChange:M=>s(Tt(i,M)),kept:{shown:R.nodes.length,of:p.length},...L>0?{past:{count:L,widen:()=>s(Lt(i,!0))}}:{},...w&&!O.off?{end:(0,qn.jsx)(er,{said:O})}:{}}):null;return{nodes:[...o,...R.nodes],arranged:R,arrangement:x,bar:g}}function _e(e,t,n){let r=new Set((n??[]).map(i=>i.kind)),a=new Set((n??[]).map(i=>i.id));return e.allNodes().filter(i=>r.has(i.kind)?a.has(i.id):Ve(t.tryDefinition(i.kind),i))}var Ie=F(Ee(),1);var j=F(te(),1),Jr=["slots","x","y","fill"],fn=class extends Error{constructor(n,r){super(`${n}
2
2
  ${r}`);this.hint=r;this.name="BoardBindingError"}},rr=e=>Math.max(0,Math.min(1,e));function Fn(e,t,n,r){let a=l=>l,i=l=>r?xe(r.tryDefinition(l.kind),l):String(a(l).label??l.id);if(r&&r.tryDefinition(n.slots)===void 0)throw new fn(`No kind is declared for "${n.slots}".`,'Check the lens bindings: { slots: "<kind>", x: "<field>", y: "<field>", fill: "<edge kind>" }');let s=e.filter(l=>l.kind===n.slots);if(!r&&s.length===0)throw new fn(`Nothing to arrange: no "${n.slots}" nodes.`,'Check the lens bindings: { slots: "<kind>", x: "<field>", y: "<field>", fill: "<edge kind>" }');let m=t.filter(l=>l.kind===n.fill),c=new Map(e.map(l=>[l.id,l])),b=new Map(e.map((l,k)=>[l.id,k])),d=s.map(l=>{let k=a(l),u=n.fillFrom==="occupant",x=m.filter(R=>(u?R.to:R.from)===l.id).map(R=>c.get(u?R.from:R.to)).filter(R=>R!==void 0).sort((R,L)=>(b.get(R.id)??0)-(b.get(L.id)??0)).map(R=>({id:R.id,label:i(R)}));return{id:l.id,code:String(k[n.slotCode??""]??"").trim()||i(l),label:i(l),x:rr(Number(k[n.x]??.5)),y:rr(Number(k[n.y]??.5)),occupants:x}}).sort((l,k)=>l.y-k.y||l.x-k.x),y=new Set(d.flatMap(l=>l.occupants.map(k=>k.id))),p=new Set([...y].map(l=>c.get(l)?.kind).filter(l=>l!==void 0)),o=e.filter(l=>p.has(l.kind)&&!y.has(l.id)).map(l=>({id:l.id,label:i(l)})).sort((l,k)=>l.label<k.label?-1:l.label>k.label?1:0);return{slots:d,empty:d.filter(l=>l.occupants.length===0).map(l=>l.id),spare:o}}function Xr({nodes:e,occupants:t,label:n,fidelity:r,mode:a,options:i,schema:s,implicated:m=[],flagged:c=[]}){let{store:b}=oe(),d=_e(b.graph,b.schema,e),y=t?[...d.filter(f=>f.kind===i.slots),...t.map(f=>b.graph.getNode(f)).filter(f=>f!==void 0)]:d,p=Fn(y,b.graph.allEdges(),i,s),o=new Set(m),l=new Set(c),k=xt(),u=new Map;for(let f of k)for(let v of f.nodeIds)u.set(v,[...u.get(v)??[],f.message]);let x=f=>f?u.get(f)??[]:[];if(r==="glyph")return(0,j.jsx)(ke,{label:`${n??"Board"} \xB7 ${p.slots.length-p.empty.length}/${p.slots.length}`,hue:be("board")});if(r==="summary"){let f=p.slots.filter(v=>p.empty.includes(v.id));return(0,j.jsx)(pe,{title:n??"Board",meta:`${p.slots.length-p.empty.length}/${p.slots.length}`,tone:f.length>0?"warning":"muted",fit:!0,children:f.length>0?(0,j.jsx)(ze,{pick:!0,max:5,items:f.map(v=>({id:v.id,label:v.code}))}):(0,j.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"Every slot filled."})})}let R=i.aspect??.68,L=(0,Ie.useRef)(null),[T,w]=(0,Ie.useState)(!1),[O,g]=(0,Ie.useState)(null),M=160,[N,G]=(0,Ie.useState)(!1);(0,Ie.useEffect)(()=>{let f=L.current;if(!f||typeof ResizeObserver>"u")return;let v=new ResizeObserver(S=>{let A=S[0]?.contentRect;if(!A)return;let h=A.height<M;G(h),w(!h&&R<1&&A.width/A.height>1.3),g(h?null:A.height)});return v.observe(f),()=>v.disconnect()},[R]);let C=(f,v)=>T?{x:1-v,y:f}:{x:f,y:v},q=(()=>{let f=new Map,v=(S,A,h)=>{let $=f.get(h)??{ids:[],codes:[]};$.ids.includes(S)||($.ids.push(S),$.codes.includes(A)||$.codes.push(A)),f.set(h,$)};for(let S of p.slots){for(let A of x(S.id))v(S.id,S.code,A);for(let A of S.occupants)for(let h of x(A.id))v(A.id,A.label,h)}return[...f.entries()].map(([S,A])=>({id:A.ids[0],code:A.codes.join(", "),text:S}))})(),W=a==="fullscreen",ce=q.length===0?null:(0,j.jsxs)("ul",{"data-graview-primitive":"board-key",style:{margin:"2px 0 0",padding:0,listStyle:"none",display:"grid",gap:3,flex:"0 0 auto"},children:[q.slice(0,W?6:2).map(f=>(0,j.jsxs)("li",{"data-graview-pick":f.id,"data-graview-emphasis":o.size===0?"plain":o.has(f.id)?"lit":"dimmed",title:f.text,style:{display:W?"grid":"flex",gap:W?1:7,alignItems:W?"start":"baseline",fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)",minHeight:24,width:"fit-content",maxWidth:"100%",padding:W?"2px 0":"3px 6px",marginLeft:W?0:-6,borderRadius:7,cursor:"pointer"},children:[(0,j.jsxs)("span",{style:{flex:"0 0 auto",fontWeight:600,color:"var(--graview-warn)",letterSpacing:"0.02em"},children:["\u26A0 ",f.code]}),(0,j.jsx)("span",{style:{minWidth:0,...W?{}:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},children:f.text})]},f.id)),q.length>(W?6:2)?(0,j.jsxs)("li",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:["+",q.length-(W?6:2)," more"]}):null]}),ae=i.arrange==="shelf",ne=p.slots.every(f=>f.code.length<=3&&!/\s/.test(f.code)),D=(f,v)=>{let S=f.occupants.length===0,A=o.size>0&&!o.has(f.id)&&!f.occupants.some(J=>o.has(J.id)),h=l.has(f.id),$=f.occupants.some(J=>l.has(J.id)),P=h,Z=[...x(f.id),...f.occupants.flatMap(J=>x(J.id))],H=f.occupants.length===1?f.occupants[0]:null,U=i.pickTarget==="slot"?f.id:H?H.id:f.id,Y=J=>H?{}:{"data-graview-pick":J.id,"data-graview-emphasis":o.size===0?"plain":A?"dimmed":"lit"},le=J=>l.has(J.id)?"var(--graview-warn)":"var(--graview-ink-muted)",ge=i.emptyLabel??"empty";return(0,j.jsxs)("div",{"data-graview-pick":U,"data-graview-slot":f.id,"data-graview-mark":ne?"disc":"token","data-graview-flagged":h&&$?"both":h?"slot":$?"occupant":void 0,"data-graview-emphasis":o.size===0?"plain":A?"dimmed":"lit",title:[S?`${f.label} \u2014 nobody in it`:`${f.occupants.map(J=>J.label).join(", ")} at ${f.label}`,...Z].join(`
3
3
  `),style:{...v,display:"grid",justifyItems:ne?"center":"start",gap:3,opacity:A?.5:1,transition:"opacity 160ms ease"},children:[ne?(0,j.jsxs)("span",{style:{position:"relative",width:34,height:34,borderRadius:999,display:"grid",placeItems:"center",fontSize:"0.75rem",letterSpacing:"0.02em",border:S?"1.5px dashed var(--graview-warn)":`1px solid ${P?"var(--graview-warn)":"var(--graview-edge-bright)"}`,background:S?"transparent":P?"var(--graview-panel-warning)":"var(--graview-panel)",color:S||P?"var(--graview-warn)":"var(--graview-ink)",boxShadow:S?void 0:"var(--graview-lift-low)"},children:[f.code,h&&!S?(0,j.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",top:-3,right:-3,fontSize:"0.6875rem",lineHeight:1,color:"var(--graview-warn)"},children:"\u26A0"}):null]}):(0,j.jsxs)("span",{style:{display:"grid",gap:1,minWidth:0,maxWidth:180,padding:"5px 10px 6px",borderRadius:8,border:S?"1.5px dashed var(--graview-warn)":`1px solid ${P?"var(--graview-warn)":"var(--graview-edge-bright)"}`,background:S?"transparent":P?"var(--graview-panel-warning)":"var(--graview-panel)",boxShadow:S?void 0:"var(--graview-lift-low)"},children:[(0,j.jsxs)("span",{style:{fontSize:"0.8125rem",fontWeight:550,lineHeight:1.25,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:S||P?"var(--graview-warn)":"var(--graview-ink)"},children:[f.code,h&&!S?" \u26A0":null]}),S?(0,j.jsx)("span",{style:{fontSize:"0.75rem",lineHeight:1.3,color:"var(--graview-warn)"},children:ge}):(0,j.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:"0 8px",fontSize:"0.75rem",lineHeight:1.3},children:f.occupants.map(J=>(0,j.jsxs)("span",{...Y(J),style:{whiteSpace:"nowrap",color:le(J)},children:[J.label,l.has(J.id)?" \u26A0":""]},J.id))})]}),ne?S?(0,j.jsx)("span",{style:{fontSize:"0.75rem",whiteSpace:"nowrap",color:"var(--graview-warn)"},children:ge}):f.occupants.map(J=>(0,j.jsxs)("span",{...Y(J),style:{fontSize:"0.75rem",whiteSpace:"nowrap",color:le(J)},children:[J.label,l.has(J.id)?" \u26A0":""]},J.id)):null]},f.id)},Q=i.zones??[],ue=Q.map((f,v)=>({label:f.label,slots:p.slots.filter(S=>S.y>=f.from&&(S.y<f.to||v===Q.length-1&&S.y<=f.to))})),I=new Set(ue.flatMap(f=>f.slots.map(v=>v.id))),E=p.slots.filter(f=>!I.has(f.id));(E.length>0||ue.length===0)&&ue.push({label:"",slots:E});let K={boxSizing:"border-box",borderRadius:12,border:"1px solid var(--graview-edge)",background:"linear-gradient(var(--graview-panel-muted), var(--graview-panel-muted)), var(--graview-panel)",overflow:"hidden"};return(0,j.jsxs)(pe,{title:n??"Board",meta:p.slots.length===0?void 0:p.empty.length===0?`all ${p.slots.length} filled`:`${p.empty.length} unfilled`,...W?{style:{flex:"1 1 auto",minHeight:0,height:"100%"}}:{},children:[(0,j.jsxs)("div",{ref:L,style:{display:"flex",gap:28,alignItems:"stretch",justifyContent:"center",flex:"1 1 auto",minHeight:0},children:[W&&ce?(0,j.jsxs)("div",{style:{width:260,flex:"0 0 auto",alignSelf:"center",display:"grid",gap:8},children:[(0,j.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"What is marked"}),ce]}):null,ae?(0,j.jsx)("div",{"data-graview-primitive":"board","data-graview-arrange":"shelf",style:{...K,overflow:"auto",flex:"1 1 auto",minWidth:0,alignSelf:"stretch",display:"grid",alignContent:"start"},children:ue.map((f,v)=>(0,j.jsxs)("section",{"data-graview-zone":f.label||void 0,style:{display:"grid",gap:8,padding:"10px 14px 14px",...v>0?{borderTop:"1px dashed var(--graview-edge)"}:{}},children:[f.label?(0,j.jsx)("span",{style:{fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:f.label}):null,f.slots.length>0?(0,j.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"10px 12px",alignItems:"flex-start"},children:f.slots.map(S=>D(S,{}))}):(0,j.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"nothing here"})]},f.label||`band-${v}`))}):(0,j.jsxs)("div",{style:{display:"flex",gap:5,alignItems:"stretch",minWidth:0,...N?{flex:"1 1 auto",alignSelf:"flex-start"}:{}},children:[!T&&Q.length>0?(0,j.jsx)("div",{"aria-hidden":"true",style:{position:"relative",width:15,flex:"0 0 auto",alignSelf:"stretch"},children:Q.map(f=>(0,j.jsx)("span",{title:f.label,style:{position:"absolute",top:`${f.from*100}%`,height:`${(f.to-f.from)*100}%`,right:0,writingMode:"vertical-rl",transform:"rotate(180deg)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--graview-ink-faint)"},children:f.label},f.label))}):null,(0,j.jsxs)("div",{"data-graview-primitive":"board","data-graview-arrange":"exact",style:{...K,position:"relative",aspectRatio:`${T?1/R:R}`,...N?{width:"100%",height:"auto",flex:"1 1 auto",minWidth:0,alignSelf:"flex-start"}:{height:"100%",flex:"0 1 auto",...O!==null?{width:Math.round(O*(T?1/R:R))}:{}},maxWidth:"100%"},children:[Q.map(f=>(0,j.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",...T?{top:0,bottom:0,left:`${(1-f.to)*100}%`,width:`${(f.to-f.from)*100}%`,borderLeft:"1px dashed var(--graview-edge)"}:{left:0,right:0,top:`${f.from*100}%`,height:`${(f.to-f.from)*100}%`,borderBottom:"1px dashed var(--graview-edge)"}}},f.label)),T?Q.map(f=>(0,j.jsx)("span",{"aria-hidden":"true",title:f.label,style:{position:"absolute",bottom:3,left:`${(1-f.to)*100}%`,width:`${(f.to-f.from)*100}%`,textAlign:"center",fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--graview-ink-faint)"},children:f.label},`label-${f.label}`)):null,p.slots.map(f=>D(f,{position:"absolute",left:`${C(f.x,f.y).x*100}%`,top:`${C(f.x,f.y).y*100}%`,transform:"translate(-50%, -50%)",width:"max-content",maxWidth:"100%"}))]})]}),p.spare.length>0?(0,j.jsxs)("div",{style:{display:"grid",gap:6,alignContent:"start",minWidth:0},children:[(0,j.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"Not in"}),(0,j.jsx)(ze,{pick:!0,max:10,items:p.spare.map(f=>({...f,emphasis:o.size===0?"plain":o.has(f.id)?"lit":"dimmed"}))})]}):null]}),W?null:ce]})}function ar(e){function t(n){let{store:r}=oe(),a=Fn(_e(r.graph,r.schema,n.nodes),r.graph.allEdges(),e,r.schema),s=[...a.slots.flatMap(d=>d.occupants.map(y=>y.id)),...a.spare.map(d=>d.id)].map(d=>r.graph.getNode(d)).filter(d=>d!==void 0),{arranged:m,bar:c}=Ne(n,{...e.arranging!==void 0?{allow:e.arranging}:{},lensAllows:{group:!1},...e.arrangedBy?{arrangedBy:e.arrangedBy}:{},subject:s}),b=(0,j.jsx)(Xr,{schema:r.schema,...n,options:e,...e.arranging===!1?{}:{occupants:m.nodes.map(d=>d.id)}});return Be(n,r.schema,c?(0,j.jsxs)("div",{style:{display:"grid",gap:6,height:"100%",minHeight:0,gridTemplateRows:"auto 1fr"},children:[c,b]}):b)}return{name:"board",requiredRoles:[...Jr],options:e,View:t,build(n,r,a){return Fn(n,r,e,a)}}}var Cn=F(Ee(),1);var ir=864e5;function _n(e){if(typeof e!="string")return null;if(Bn(e))return In(e)?.day??null;let t=/^(\d{4}-\d{2}-\d{2})/.exec(e);return t?t[1]:null}function yn(e){if(typeof e!="string")return null;if(Bn(e))return In(e)?.minutes??null;let t=/^\d{4}-\d{2}-\d{2}[T ](\d{2}):(\d{2})/.exec(e);return t?Number(t[1])*60+Number(t[2]):null}var hn=e=>Date.UTC(Number(e.slice(0,4)),Number(e.slice(5,7))-1,Number(e.slice(8,10))),wn=e=>new Date(e).toISOString().slice(0,10);function Re(e,t){return wn(hn(e)+t*ir)}function Ge(e,t){let n=Number(e.slice(0,4)),r=Number(e.slice(5,7))-1+t,a=Number(e.slice(8,10)),i=new Date(Date.UTC(n,r+1,0)).getUTCDate();return wn(Date.UTC(n,r,Math.min(a,i)))}var Kn=e=>new Date(hn(e)).getUTCDay();function Ke(e,t=1){let n=(Kn(e)-t+7)%7;return Re(e,-n)}var Un=e=>`${e.slice(0,7)}-01`;function we(e,t){return Math.round((hn(t)-hn(e))/ir)}function Ue(e,t){return Array.from({length:t},(n,r)=>Re(e,r))}var or=e=>dt(e,"short"),De=e=>st(e,{weekday:"short"}),Yn=e=>Xe(e);function je(e,t){let n=t?.fieldRoles?.when;return e&&!e.start&&n?{...e,start:n}:e}function sr(e,t){return t===void 0?!1:typeof t=="string"?e[t]===!0:t.is.includes(e[t.field])}var vn=["start"],Zr=["day","week","month","quarter","year","agenda"];function bn(e){return e.horizon?["day","week","month","quarter","year","years","agenda"]:Zr}function lr(e,t){return e==="years"?t?.title??"Years":`The ${e}`}function dr(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var Qn=class extends Error{constructor(n,r){super(`The calendar lens has no binding for ${r.map(a=>`"${a}"`).join(", ")} on "${n}". Bind them in the lens declaration: bindings: { ${n}: { start: "<field>" } }.`);this.kind=n;this.missing=r;this.name="CalendarBindingError"}};function xn(e,t,n){let r=je(t[e.kind],n?.tryDefinition(e.kind));if(!r)return null;let a=e,i=n?.tryDefinition(e.kind)?.fields.shape,s=vn.filter(y=>{let p=r[y];return p?i?!(p in i):!(p in a):!0});if(s.length>0)throw new Qn(e.kind,s);let m=_n(a[r.start]);if(m===null)return null;let c=(r.end?_n(a[r.end]):null)??m,b=yn(a[r.start]),d=r.label?a[r.label]:void 0;return{id:e.id,kind:e.kind,label:typeof d=="string"&&d.length>0?d:xe(n?.tryDefinition(e.kind),e),from:m,to:we(m,c)<0?m:c,at:r.allDay&&a[r.allDay]===!0?null:b,allDay:r.allDay&&a[r.allDay]===!0||b===null,done:sr(a,r.done)}}function cr(e,t,n,r){let a=xn(e,t,n);if(!a)return[];let i=je(t[e.kind],n?.tryDefinition(e.kind)).start,s=e,m=s[i],c=s[ut(i)];if(typeof m!="string"||!gt(c))return[a];let b=we(a.from,a.to);return("next"in r?[pt(m,c,r.next)]:mt(m,c,{from:Re(r.from,-b),to:r.to,limit:400})).map(y=>({...a,from:y.slice(0,10),to:Re(y.slice(0,10),b),repeats:!0}))}function Sn(e,t){return e.filter(n=>we(n.from,t)>=0&&we(t,n.to)>=0).sort((n,r)=>n.allDay!==r.allDay?n.allDay?-1:1:n.at!==r.at?(n.at??0)-(r.at??0):n.label.localeCompare(r.label))}function ur(e,t,n){let r=ft(e.schema,e.allMutations()).get(t)?.get(n)??[],a=new Map(e.allMutations().map(s=>[s.name,s]));for(let s of r){let m=a.get(s),c=m?.subject;if(!m||!c)continue;let b=m.input?.shape??{};if(n in b)return{name:m.name,arg:c.arg}}let i=e.allMutations().find(s=>s.derived?.act==="edit"&&s.derived.kind===t);return i?.subject?{name:i.name,arg:i.subject.arg}:null}var gr=(e,t)=>({from:Un(e),to:mr(e),label:Tn(e,{short:!0,year:t})});function mr(e){return wn(Date.UTC(Number(e.slice(0,4)),Number(e.slice(5,7)),0))}function ea(e){let t=Math.floor((Number(e.slice(5,7))-1)/3);return`${e.slice(0,4)}-${String(t*3+1).padStart(2,"0")}-01`}function pr(e,t,n={}){let r=n.weekStartsOn??1,a=(c,b)=>({from:c,to:c,label:String(Number(c.slice(8,10))),...b?{outside:!0}:{}});if(e==="day")return{title:De(t),grain:"day",columns:1,cells:[a(t)]};if(e==="week"){let c=Ke(t,r);return{title:`${De(c)} \u2013 ${De(Re(c,6))}`,grain:"day",columns:7,cells:Ue(c,7).map(b=>a(b))}}if(e==="agenda")return{title:`From ${De(t)}`,grain:"day",columns:1,cells:Ue(t,42).map(c=>a(c))};if(e==="quarter"){let c=ea(t),b=mr(Ge(c,2)),d=[];for(let y=Ke(c,r);we(y,b)>=0;y=Re(y,7))d.push({from:y,to:Re(y,6),label:lt(y),...we(y,c)>0&&we(Re(y,6),c)>0?{outside:!0}:{}});return{title:`Q${Math.floor((Number(t.slice(5,7))-1)/3)+1} ${t.slice(0,4)}`,grain:"week",columns:4,cells:d}}if(e==="year"){let c=t.slice(0,4);return{title:c,grain:"month",columns:4,cells:Array.from({length:12},(b,d)=>gr(`${c}-${String(d+1).padStart(2,"0")}-01`,!1))}}if(e==="years"){let c=Number(t.slice(0,4)),b=c+Math.max(1,n.horizon?.years??1)-1,d=n.horizon?.from!==void 0||n.horizon?.to!==void 0,y=d?n.horizon?.from??c:Math.min(c,n.fit?.first??c),o=(d?Math.max(y,n.horizon?.to??y+Math.max(1,n.horizon?.years??1)-1):Math.max(b,n.fit?.last??b))-y+1,l=Array.from({length:o},(k,u)=>String(y+u));return o>na?{title:`${n.horizon?.title??"Years"} \xB7 ${l[0]}\u2013${l[l.length-1]}`,grain:"year",columns:5,years:l,cells:l.map(k=>({from:`${k}-01-01`,to:`${k}-12-31`,label:k}))}:{title:`${n.horizon?.title??"Years"} \xB7 ${l[0]}\u2013${l[l.length-1]}`,grain:"month",columns:4,years:l,cells:l.flatMap(k=>Array.from({length:12},(u,x)=>gr(`${k}-${String(x+1).padStart(2,"0")}-01`,!0)))}}let i=Un(t),s=Ke(i,r),m=t.slice(0,7);return{title:Tn(t),grain:"day",columns:7,cells:Ue(s,42).map(c=>a(c,c.slice(0,7)!==m))}}function fr(e,t,n){return e.filter(r=>we(r.from,n)>=0&&we(t,r.to)>=0).sort((r,a)=>r.allDay!==a.allDay?r.allDay?-1:1:r.from!==a.from?r.from.localeCompare(a.from):r.at!==a.at?(r.at??0)-(a.at??0):r.label.localeCompare(a.label))}var na=10;function hr(e){return e==="year"?"year":e==="month"?"month":e==="week"?"week":"day"}var yr=F(Ee(),1);var ie=F(te(),1);function Jn({label:e,glyph:t,onPress:n}){return(0,ie.jsx)("button",{type:"button","aria-label":e,title:e,onClick:n,style:Ye,children:t})}var Ye={minHeight:24,minWidth:24,padding:"2px 9px",borderRadius:6,fontSize:"0.8125rem",borderWidth:1,borderStyle:"solid",borderColor:"transparent",color:"var(--graview-ink-muted)",background:"transparent"},wr={day:12,week:4,month:3,year:5};function vr({span:e,weekStartsOn:t,entries:n,today:r,perCell:a,emphasisOf:i,broken:s,hue:m,onOpen:c,onMove:b}){let d=(0,yr.useRef)(null),y=Fe(d),p=y===null?e.columns:Math.max(1,Math.floor(y/44)),o=p<e.columns,l=o?p:e.columns,k=!o&&e.grain==="day"&&e.columns===7?Ue(Ke(e.cells[0]?.from??r,t),7):e.grain==="day"&&e.columns===1?e.cells.map(u=>u.from):null;return o&&e.grain==="day"&&e.columns>1?(0,ie.jsx)("div",{ref:d,"data-calendar-shape":"agenda",style:{display:"grid",minHeight:0,flex:1},children:(0,ie.jsx)(kn,{days:e.cells.map(u=>u.from),entries:n,today:r,emphasisOf:i,broken:s,hue:m,onMove:(u,x)=>b(u,{from:x,to:x,label:x},"day")})}):(0,ie.jsxs)("div",{ref:d,"data-calendar-shape":o?"wrapped":"grid",style:{display:"grid",gap:4,gridTemplateRows:k?"auto 1fr":"1fr",minHeight:0,flex:1},children:[k?(0,ie.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${l}, minmax(0, 1fr))`,gap:4},children:k.map(u=>(0,ie.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:"var(--graview-ink-muted)",textAlign:"center"},children:e.columns===7?or(Kn(u)):De(u)},u))}):null,(0,ie.jsx)("div",{tabIndex:0,"aria-label":`The days of ${e.title}`,style:{display:"grid",gridTemplateColumns:`repeat(${l}, minmax(0, 1fr))`,gridAutoRows:"max-content",gap:4,minHeight:0,overflow:"auto"},children:e.cells.map((u,x)=>{let R=fr(n,u.from,u.to),L=R.slice(0,a),T=R.slice(a),w=T.filter(g=>s.has(g.id)).length,O=we(u.from,r)>=0&&we(r,u.to)>=0;return(0,ie.jsxs)("div",{"data-calendar-day":e.grain==="day"?u.from:void 0,"data-calendar-cell":u.from,"data-calendar-grain":e.grain,"data-calendar-count":R.length,"data-calendar-outside":u.outside||void 0,onDragOver:g=>{g.dataTransfer.types.includes("text/graview-node")&&(g.preventDefault(),g.dataTransfer.dropEffect="move")},onDrop:g=>{let M=g.dataTransfer.getData("text/graview-node");M&&(g.preventDefault(),g.stopPropagation(),b(M,u,e.grain))},style:{minHeight:62,display:"flex",flexDirection:"column",gap:2,padding:4,borderRadius:7,border:"1px solid var(--graview-edge)",background:O?"var(--graview-panel)":u.outside?"var(--graview-panel-muted)":"transparent"},children:[(0,ie.jsxs)("span",{style:{display:"flex",alignItems:"baseline",gap:4},children:[(0,ie.jsx)("span",{style:{fontSize:"0.75rem",fontVariantNumeric:"tabular-nums",color:O?"var(--graview-accent)":"var(--graview-ink-faint)"},children:u.label}),e.grain!=="day"&&R.length>0?(0,ie.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",marginLeft:"auto"},children:R.length}):null]}),L.map(g=>(0,ie.jsx)(br,{entry:g,cell:u,rowStart:x%l===0,emphasis:i(g.id),flagged:s.has(g.id),hue:m(g)},`${g.id}:${g.from}:${u.from}`)),T.length>0?(0,ie.jsxs)("button",{type:"button","data-testid":`calendar-more-${u.from}`,onClick:()=>c(u),title:`Open ${u.label}`,style:{minHeight:24,padding:"1px 5px",fontSize:"0.75rem",borderRadius:5,border:"1px dashed var(--graview-edge)",background:"transparent",color:w>0?"var(--graview-warn)":"var(--graview-ink-muted)",textAlign:"left"},children:["+",T.length," more",w>0?` \xB7 ${w} flagged`:""]}):null]},u.from)})})]})}function kn({days:e,entries:t,today:n,emphasisOf:r,broken:a,hue:i,onMove:s}){let m=e.map(c=>({day:c,here:Sn(t,c)})).filter(({here:c})=>c.length>0);return m.length===0?(0,ie.jsx)("p",{"data-testid":"calendar-empty",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:"Nothing is scheduled in the next six weeks."}):(0,ie.jsx)("ol",{tabIndex:0,"aria-label":"What is scheduled",style:{margin:0,padding:0,listStyle:"none",display:"grid",alignContent:"start",gap:10,overflow:"auto",minHeight:0},children:m.map(({day:c,here:b})=>(0,ie.jsxs)("li",{"data-calendar-day":c,onDragOver:d=>{d.dataTransfer.types.includes("text/graview-node")&&(d.preventDefault(),d.dataTransfer.dropEffect="move")},onDrop:d=>{let y=d.dataTransfer.getData("text/graview-node");y&&(d.preventDefault(),d.stopPropagation(),s(y,c))},style:{display:"grid",gap:4},children:[(0,ie.jsxs)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:c===n?"var(--graview-accent)":"var(--graview-ink-muted)"},children:[De(c),c===n?" \xB7 today":""]}),b.map(d=>(0,ie.jsx)(br,{entry:d,cell:{from:c,to:c,label:c},emphasis:r(d.id),flagged:a.has(d.id),hue:i(d)},`${d.id}:${d.from}:${c}`))]},c))})}function br({entry:e,cell:t,emphasis:n,flagged:r,hue:a,rowStart:i=!1}){let s=we(t.from,e.from)>=0,m=we(e.to,t.to)>=0,c=!(s&&m),b=e.at!==null&&s&&e.from===t.from?`${Yn(e.at)} ${e.label}`:e.label;return(0,ie.jsx)("span",{"data-graview-pick":e.id,"data-calendar-entry":e.id,"data-calendar-repeat":e.repeats?e.from:void 0,draggable:!e.repeats,onDragStart:d=>{d.dataTransfer.setData("text/graview-node",e.id),d.dataTransfer.effectAllowed="move"},"data-graview-emphasis":n,"data-calendar-part":c?s?"opens":m?"closes":"through":void 0,"data-calendar-in":t.from,title:c?`${e.label} \xB7 ${e.from} \u2013 ${e.to}`:`${e.label}${e.at===null?" \xB7 all day":` \xB7 ${Yn(e.at)}`}${e.repeats?" \xB7 repeats":""}`,style:{display:"block",minHeight:24,boxSizing:"border-box",padding:"3px 6px",fontSize:"0.75rem",lineHeight:1.35,borderRadius:c?s?"5px 0 0 5px":m?"0 5px 5px 0":0:5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:e.done?"line-through":"none",opacity:n==="dimmed"?.35:e.done?.6:1,background:`color-mix(in oklab, hsl(${Math.round(a)} 70% 55%) ${n==="lit"?38:20}%, transparent)`,color:"var(--graview-ink)",...n==="lit"?{outline:"1px solid var(--graview-accent)"}:{},...r?{borderLeft:"3px solid var(--graview-warn)",paddingLeft:4}:{}},children:s||i?e.repeats?(0,ie.jsxs)(ie.Fragment,{children:[(0,ie.jsx)("span",{"aria-hidden":"true",children:"\u21BB "}),b]}):b:" "})}var ee=F(te(),1);function ta(e){let t=1/0,n=-1/0;for(let r of e)r&&(t=Math.min(t,Number(r.from.slice(0,4))),n=Math.max(n,Number(r.to.slice(0,4))));return Number.isFinite(t)&&Number.isFinite(n)?{first:t,last:n}:void 0}function xr(e){let t=n=>function(a){let{store:i}=oe(),{view:s}=nn(),m=n?{...e,range:n}:e,c=s.within?.range??m.range??"month",b=Object.keys(e.bindings),{nodes:d,arranged:y,arrangement:p,bar:o}=Ne(a,{...e.arranging!==void 0?{allow:e.arranging}:{},lensAllows:{sort:!1,group:c==="agenda"},...e.arrangedBy?{arrangedBy:e.arrangedBy}:{},...e.search?{search:e.search}:{},...e.filters?{filters:e.filters}:{},...b[0]?{kind:(a.nodes??[]).find(R=>b.includes(String(R.kind)))?.kind??b[0]}:{}}),l=c==="agenda"&&y.grouped&&p.group?y.groups.map(R=>({label:R.label,ids:new Set(R.nodes.map(L=>L.id))})):void 0,k=new Set((a.nodes??[]).map(R=>String(R.kind))),u=b.filter(R=>!k.has(R)&&i.schema.tryDefinition(R)!==void 0).flatMap(R=>{let L=i.schema.tryDefinition(R);return i.graph.nodesOfKind(R).filter(T=>s.past===!0||Ve(L,T))}),x=u.length===0?d:[...d,...a.budget!==void 0?u.slice(0,a.budget):u];return Be(a,i.schema,(0,ee.jsx)(ra,{schema:i.schema,...a,nodes:x,options:{...m,today:m.today??i.today()??dr()},...o?{bar:o}:{},...l?{groups:l}:{}}))};return{name:"calendar",requiredRoles:[...vn],bindings:e.bindings,options:e,View:t(),at:n=>t(n),ranges:()=>bn(e).map(n=>({range:n,title:lr(n,e.horizon)})),place:(n,r)=>n.map(a=>xn(a,e.bindings,r)).filter(a=>a!==null)}}function ra({nodes:e,label:t,fidelity:n,mode:r,options:a,schema:i,selectedIds:s=[],implicated:m=[],flagged:c=[],bar:b,groups:d}){let{view:y,go:p}=nn(),{store:o,principal:l}=oe(),k=y.within?.at??a.today,u=y.within?.range??a.range??"month",x=a.weekStartsOn??1,R=new Set([...m,...s]),L=E=>R.size===0?"plain":R.has(E)?"lit":"dimmed",T=new Set(c),w=u==="years"&&y.within?.at===void 0?ta((e??[]).map(E=>xn(E,a.bindings,i))):void 0,O=pr(u,k,{weekStartsOn:x,...a.horizon?{horizon:a.horizon}:{},...w?{fit:w}:{}}),M=n==="glyph"||n==="summary"?{next:a.today}:{from:O.cells[0]?.from??k,to:O.cells[O.cells.length-1]?.to??k},N=(e??[]).flatMap(E=>cr(E,a.bindings,i,M)),G=a.hueOf??(E=>be(E.kind));if(n==="glyph")return(0,ee.jsx)(ke,{label:`${t??"Calendar"} \xB7 ${N.length}`,hue:be("calendar")});if(n==="summary"){let E=Sn(N,a.today);return(0,ee.jsx)(pe,{title:t??"Calendar",meta:`${N.length} dated`,tone:"muted",children:(0,ee.jsx)(ze,{max:6,items:E.length>0?E.map(K=>({id:K.id,label:K.label,hue:G(K)})):N.filter(K=>we(a.today,K.from)>=0).sort((K,f)=>K.from.localeCompare(f.from)).slice(0,6).map(K=>({id:K.id,label:`${K.from.slice(5)} ${K.label}`,hue:G(K)}))})})}let C=r==="fullscreen",[q,W]=(0,Cn.useState)(null),ce=(E,K,f)=>{let v=o.graph.getNode(E);if(!v)return;let S=je(a.bindings[v.kind],o.schema.tryDefinition(v.kind));if(!S)return;let A=ur(o,v.kind,S.start);if(!A){W({text:`Nothing declared writes the ${Nn(o.schema.definitions.find(Y=>Y.kind===v.kind),S.start).toLowerCase()}, so this cannot be moved from here.`,tone:"refused"});return}let h=K.from,$=v[S.start],Z=yn($)===null?h:`${h}${String($).slice(10)}`,H={name:A.name,args:{[A.arg]:E,[S.start]:Z}},U=o.permits(H,l);if(!U.ok){W({text:U.refusal.message,tone:"refused"});return}try{o.apply(H,{author:l}),W(f==="day"?null:{text:`Moved to ${De(h)} \u2014 a ${f} is coarser than the ${Nn(o.schema.definitions.find(Y=>Y.kind===v.kind),S.start).toLowerCase()} holds, so it takes the first day of the cell. Undo puts it back.`,tone:"rounded"})}catch(Y){W({text:Y instanceof Error?Y.message:String(Y),tone:"refused"})}},ae=E=>{let K=u==="years"?Ge(`${O.years?.[0]??k.slice(0,4)}${k.slice(4)}`,E*12*Math.max(1,O.years?.length??a.horizon?.years??1)):u==="year"?Ge(k,E*12):u==="quarter"?Ge(k,E*3):u==="month"?Ge(k,E):u==="week"?Re(k,E*7):Re(k,E);p(en(y,"at",K))},ne=(E,K)=>{let f=en(y,"range",E);K!==void 0&&(f=en(f,"at",K)),p(f)},D=(0,Cn.useRef)(null),Q=Fe(D),ue=Q!==null&&Q<420,I=E=>E==="years"?a.horizon?.title??"years":E.charAt(0).toUpperCase()+E.slice(1);return(0,ee.jsx)(pe,{title:t??"Calendar",meta:O.title,style:{gap:10,...C?{flex:"1 1 auto",minHeight:0,height:"100%"}:{}},children:(0,ee.jsxs)("div",{ref:D,"data-testid":"calendar","data-calendar-range":u,"data-calendar-at":k,style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,gap:8},children:[(0,ee.jsxs)("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6},children:[(0,ee.jsxs)("nav",{"aria-label":"When",style:{display:"flex",gap:4},children:[(0,ee.jsx)(Jn,{label:"Previous",glyph:"\u2039",onPress:()=>ae(-1)}),(0,ee.jsx)("button",{type:"button","data-testid":"calendar-today",onClick:()=>p(en(y,"at",a.today)),style:Ye,children:"Today"}),(0,ee.jsx)(Jn,{label:"Next",glyph:"\u203A",onPress:()=>ae(1)})]}),ue?(0,ee.jsx)("select",{"aria-label":"Range","data-testid":"calendar-ranges",value:u,onChange:E=>ne(E.target.value),style:{...Ye,borderRadius:999,borderColor:"var(--graview-edge)",background:void 0,backgroundColor:"transparent",marginLeft:"auto",maxWidth:"50%",paddingRight:24,appearance:"none",WebkitAppearance:"none",backgroundImage:"linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%)",backgroundPosition:"calc(100% - 13px) 55%, calc(100% - 9px) 55%",backgroundSize:"4px 4px, 4px 4px",backgroundRepeat:"no-repeat"},children:bn(a).map(E=>(0,ee.jsx)("option",{value:E,children:I(E)},E))}):(0,ee.jsx)("div",{role:"group","aria-label":"Range","data-testid":"calendar-ranges",style:{display:"flex",flexWrap:"wrap",gap:4,marginLeft:"auto"},children:bn(a).map(E=>(0,ee.jsx)("button",{type:"button","aria-pressed":E===u,"data-testid":`calendar-range-${E}`,onClick:()=>ne(E),style:{...Ye,borderRadius:999,borderColor:"var(--graview-edge)",...E==="years"?{}:{textTransform:"capitalize"},...E===u?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)",background:"var(--graview-panel)"}:{}},children:E==="years"?a.horizon?.title??"years":E},E))})]}),q?(0,ee.jsx)("p",{"data-testid":q.tone==="refused"?"calendar-refused":"calendar-rounded",role:"status",style:{margin:0,fontSize:"0.8125rem",color:q.tone==="refused"?"var(--graview-warn)":"var(--graview-ink-muted)"},children:q.text}):null,O.years?(0,ee.jsx)("nav",{"aria-label":"Years","data-testid":"calendar-years",style:{display:"flex",flexWrap:"wrap",gap:4},children:O.years.map(E=>(0,ee.jsx)("button",{type:"button","data-testid":`calendar-year-${E}`,onClick:()=>ne("year",`${E}-01-01`),style:Ye,children:E},E))}):null,b,u==="agenda"&&d?(0,ee.jsx)("div",{"data-testid":"calendar-groups",style:{display:"grid",gap:10,minHeight:0,overflow:"auto"},children:d.map(E=>(0,ee.jsxs)("section",{"data-testid":"calendar-group",style:{display:"grid",gap:4},children:[(0,ee.jsxs)("h3",{style:{margin:0,fontSize:"0.8125rem",letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},children:[E.label," ",(0,ee.jsx)("span",{style:{fontWeight:400},children:E.ids.size})]}),(0,ee.jsx)(kn,{days:O.cells.map(K=>K.from),entries:N.filter(K=>E.ids.has(K.id)),today:a.today,emphasisOf:L,broken:T,hue:G,onMove:(K,f)=>ce(K,{from:f,to:f,label:f},"day")})]},E.label))}):u==="agenda"?(0,ee.jsx)(kn,{days:O.cells.map(E=>E.from),entries:N,today:a.today,emphasisOf:L,broken:T,hue:G,onMove:(E,K)=>ce(E,{from:K,to:K,label:K},"day")}):(0,ee.jsx)(vr,{span:O,weekStartsOn:x,entries:N,today:a.today,perCell:a.perCell??wr[O.grain],emphasisOf:L,broken:T,hue:G,onOpen:E=>ne(hr(O.grain),E.from),onMove:ce})]})})}var re=F(Ee(),1);var Qe=F(Ee(),1),Ae=F(te(),1),$n={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"};function Sr({choices:e,close:t}){let[n,r]=(0,Qe.useState)(!1),a=(0,Qe.useRef)(null);return(0,Qe.useLayoutEffect)(()=>{n&&a.current?.querySelector("button:not([disabled])")?.focus()},[n]),(0,Ae.jsxs)("div",{children:[(0,Ae.jsxs)("button",{type:"button","data-menu-item":"move-to","aria-expanded":n,onClick:()=>r(i=>!i),style:$n,children:["Move to ",(0,Ae.jsx)("span",{"aria-hidden":"true",children:"\u203A"})]}),n?(0,Ae.jsx)("ul",{ref:a,"aria-label":"Move to","data-testid":"move-to",style:{margin:"2px 0 0 12px",padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:e.map(i=>i.run?(0,Ae.jsx)("li",{children:(0,Ae.jsx)("button",{type:"button","data-move-to":i.to,onClick:()=>{t(),i.run()},style:$n,children:i.label})},i.to):(0,Ae.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,Ae.jsx)("button",{type:"button",disabled:!0,"data-move-to":i.to,"data-withheld":"",style:{...$n,borderStyle:"dashed"},children:(0,Ae.jsx)("s",{children:i.label})}),(0,Ae.jsx)("span",{"data-testid":"move-to-why",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-ink-muted)",padding:"0 10px"},children:i.why})]},i.to))}):null]})}function kr({choose:e,close:t}){return(0,Ae.jsx)("button",{type:"button","data-menu-item":"choose-several",onClick:()=>{t(),e()},style:$n,children:"Choose several"})}var z=F(te(),1),aa=`
4
4
  .graview-columns { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
@@ -1 +1 @@
1
- import{a as ee,b as H,c as ne}from"./chunk.M3JIIF32.js";import{B as J,F as Q,H as X,K as Y,g as K,i as G,m as q,p as z,q as W,u as j,v as Z,x as _,z as U}from"./chunk.6IUEGPCZ.js";import{a as O}from"./chunk.CUJX3IVA.js";import{G as ae,Ha as D,Qa as $,T as M,ba as T,da as N,ua as I}from"./chunk.VNJKGSGZ.js";import{Ec as C}from"./chunk.X3MMJ3QC.js";import{b as k}from"./chunk.AJZBJBMO.js";var o=k(ae(),1);var y=k(M(),1),fe=e=>typeof e=="object"?e:{};function he({rootRef:e,firstLook:r,app:n}){let t=(0,o.useCallback)(()=>e.current,[e]);return r?(0,y.jsx)(Y,{firstLook:r,root:t,app:n}):null}function ge(e,r,n){let{app:t}=e,a=(0,o.useMemo)(()=>{let i=Q(r(t.schema,t.viewSpecs),t),d=n?ie(i,n):i,s=e.views?e.views(t.schema,d):i,c=s===d?i:I(i,s);return X(c,t.schema,U(e.brand??t.brand,t.schema)),n?n.register(c):c},[e.views,t.schema,t.viewSpecs,t.lenses,t.pages,t.home,n]);return D(a,e.keptViews)}function ie(e,r){let n={...e,register(t,a,i,d){return d?.name!==r.name&&e.register(t,a,i,d),n},...e.home?{home:(t,a)=>(r.home||e.home(t,a),n)}:{}};return n}var F=e=>e?e.getBoundingClientRect().height:0;function be(e,r,n){let t=(0,o.useRef)(n);t.current=n;let a=n!==void 0;(0,o.useLayoutEffect)(()=>{let i=e.current;if(!i||!a)return;let d=()=>{let m=[...i.children],h=m.find(b=>b.hasAttribute("data-graview-app-bar")),p=m.find(b=>b.hasAttribute("data-embed-content")),g=p?.querySelector("[data-embed-measure]")??null,l=m.find(b=>b.hasAttribute("data-graview-place-line"));return{strip:h,line:l,content:p,measure:g}},s=-1,c=()=>{let{strip:m,line:h,content:p,measure:g}=d(),l=Math.ceil(F(m)+F(h)+F(g||p));l!==s&&(s=l,t.current?.(l))};if(c(),typeof ResizeObserver>"u")return;let u=new ResizeObserver(c),E=()=>{u.disconnect();let{strip:m,line:h,content:p,measure:g}=d();for(let l of[i,m,h,p,g])l&&u.observe(l)};E();let w=new MutationObserver(()=>{E(),c()});return w.observe(i,{childList:!0}),()=>{u.disconnect(),w.disconnect()}},[e,r,a])}var we=480,se=0;function Se(e){let{app:r,seed:n,scheme:t="auto",brand:a=r.brand,fonts:i=!0,height:d="100%",label:s}=e,c=(0,o.useRef)(null);$(c);let u=d==="viewport"?"100dvh":d,E=G(typeof u=="string"&&/vh\b/.test(u)),w=(0,o.useMemo)(()=>`graview-embed-${++se}`,[]),m=(0,o.useMemo)(()=>e.store??e.remote?.store??H(r,n),[e.store,e.remote,r,n]),h=e.presence??e.remote?.presence,p=e.hostContext?.theme,g=ne(t==="auto"&&p===void 0,a?.scheme),l=t==="auto"?p??g:t,b=(0,o.useMemo)(()=>O(l,a,{scope:`.${w}`}),[l,a,w]);K(e.favicon?C(a):void 0),(0,o.useEffect)(()=>{if(!i||typeof document>"u")return;let v=ee(a);if(!v||document.querySelector(`link[href="${v}"]`))return;let f=document.createElement("link");f.rel="stylesheet",f.href=v,document.head.appendChild(f)},[a,i]);let A=(0,o.useRef)(void 0);(0,o.useLayoutEffect)(()=>{let v=c.current,f=A.current;if(A.current=s,!v||!s)return;let oe=S=>{let R=S.getAttribute("aria-label")??"",x=f&&f!==s?R.startsWith(`${f} \xB7 `)?R.slice(f.length+3):R===f?"":R:R;x===s&&(S.getAttribute("role")==="region"||S.tagName==="SECTION"&&!S.hasAttribute("role"))&&S.setAttribute("role","group");let V=x.startsWith(`${s} \xB7 `)||x===s?x:x?`${s} \xB7 ${x}`:s;V!==R&&S.setAttribute("aria-label",V)},B=()=>v.querySelectorAll("aside, nav, main, header, footer, section[aria-label]:not([role]), [role=region], [role=complementary], [role=navigation], [role=search]").forEach(S=>{S.hasAttribute("data-graview-named-by-lens")||oe(S)});B();let P=new MutationObserver(B);return P.observe(v,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-label"]}),()=>P.disconnect()},[s]);let re=E?`${u}`.replace(/([\d.]+)[sdl]?vh\b/g,(v,f)=>`${+f*E/100}px`):u;return{rootRef:c,scope:w,css:b,scheme:l,store:m,presence:h,brand:a,auto:d==="auto",height:re}}function ve({rootRef:e,board:r}){let n=(0,o.useCallback)(()=>e.current?.querySelector("[data-embed-content]")??e.current,[e]);return(0,y.jsx)(q,{board:r,anchor:n})}function Ee(e,r,n){return{brand:n,locale:e.locale,timeZone:e.timeZone,principal:e.principal,seats:e.seats,presence:r,typing:e.remote?.typing,people:e.people,memory:e.memory,presenceTtlMs:e.presenceTtlMs,onKeepLens:e.onKeepLens,ai:e.ai,files:e.files,resolveApp:e.resolveApp,history:e.history,linkedRecords:e.linkedRecords,subscriptions:e.subscriptions,dismissals:e.dismissals,whileAway:e.whileAway,keptViews:e.keptViews,onExport:e.onExport,signIn:e.signIn,menuSections:e.menuSections,app:e.app}}function Re({name:e,heading:r,faces:n,at:t,without:a,home:i,reach:d,standing:s,hostActions:c,keeping:u,onFind:E,switch:w,named:m=!0}){let{brand:h,store:p,principal:g,views:l}=T();N();let b=a?.has("places")?[]:z({store:p,principal:g,views:l}),A=_();return(0,y.jsx)(j,{brand:h,name:e,named:m,description:h?.subtitle,heading:r,faces:n,home:i,places:b,current:t===null?null:W(b,t),reach:d,onFind:E,...w?{switch:w}:{},...n||t===null?{scenePlaces:A}:{},tools:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(J,{clean:s}),(0,y.jsx)(Z,{...c?{hostActions:c}:{},...u?{keeping:u}:{}})]})})}var xe=e=>e===!1?2:Math.min(e+1,6);function Ae(e){let[r,n]=(0,o.useState)(e),t=(0,o.useRef)(void 0),a=(0,o.useRef)(void 0),i=(0,o.useMemo)(()=>({go:t,at:n,pending:a}),[]),d=(0,o.useCallback)(s=>{if(t.current){t.current(s);return}a.current=s,n(s)},[]);return{at:r,setAt:n,steering:i,steer:d}}function de(e){let r=typeof e=="object"&&e!==null?e.name:void 0;return{name:typeof r=="string"&&r.length>0?r:typeof e=="object"?"Error":typeof e}}var L=()=>typeof performance<"u"?performance.now():Date.now();function Fe(e,r){let n=(0,o.useRef)({onError:e,face:r});return n.current={onError:e,face:r},(0,o.useCallback)((t,a)=>n.current.onError?.(de(t),{module:a.module,face:n.current.face}),[])}function ke(e,r){let n=(0,o.useRef)(null);n.current===null&&(n.current=L());let t=(0,o.useRef)({onReady:e,face:r});t.current={onReady:e,face:r};let a=(0,o.useRef)(!1);return(0,o.useCallback)(i=>{a.current||(a.current=!0,t.current.onReady?.({ms:Math.max(0,L()-(n.current??L())),face:i}))},[])}var te=class extends o.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(r,n){console.error(`[graview] ${this.props.module} threw while rendering`,r,n.componentStack),this.props.report(r,{module:this.props.module})}render(){return this.state.failed?(0,y.jsxs)("div",{role:"alert","data-graview-face-error":this.props.module,...this.props.content?{"data-embed-content":""}:{},style:this.props.content?{flex:"1 1 auto",display:"grid",alignContent:"center",justifyItems:"center",gap:8,padding:24,background:"var(--graview-ground)",color:"var(--graview-ink)",fontSize:"0.9375rem"}:{display:"inline-flex",alignItems:"center",gap:6,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:[(0,y.jsx)("span",{children:this.props.content?"This part of the app could not draw.":"Could not draw."}),(0,y.jsx)("button",{type:"button",onClick:()=>this.setState({failed:!1}),style:{padding:"3px 11px",fontSize:"0.8125rem"},children:"Try again"})]}):this.props.children}};export{fe as a,he as b,ge as c,be as d,we as e,Se as f,ve as g,Ee as h,Re as i,xe as j,Ae as k,Fe as l,ke as m,te as n};
1
+ import{a as ee,b as H,c as ne}from"./chunk.XR6YR6RV.js";import{B as J,F as Q,H as X,K as Y,g as K,i as G,m as q,p as z,q as W,u as j,v as Z,x as _,z as U}from"./chunk.WC3DENU4.js";import{a as O}from"./chunk.VNDKKTED.js";import{G as ae,Ha as D,Qa as $,T as M,ba as T,da as N,ua as I}from"./chunk.4MP72LPR.js";import{Kc as C}from"./chunk.VSCIXAHN.js";import{b as k}from"./chunk.AJZBJBMO.js";var o=k(ae(),1);var y=k(M(),1),fe=e=>typeof e=="object"?e:{};function he({rootRef:e,firstLook:r,app:n}){let t=(0,o.useCallback)(()=>e.current,[e]);return r?(0,y.jsx)(Y,{firstLook:r,root:t,app:n}):null}function ge(e,r,n){let{app:t}=e,a=(0,o.useMemo)(()=>{let i=Q(r(t.schema,t.viewSpecs),t),d=n?ie(i,n):i,s=e.views?e.views(t.schema,d):i,c=s===d?i:I(i,s);return X(c,t.schema,U(e.brand??t.brand,t.schema)),n?n.register(c):c},[e.views,t.schema,t.viewSpecs,t.lenses,t.pages,t.home,n]);return D(a,e.keptViews)}function ie(e,r){let n={...e,register(t,a,i,d){return d?.name!==r.name&&e.register(t,a,i,d),n},...e.home?{home:(t,a)=>(r.home||e.home(t,a),n)}:{}};return n}var F=e=>e?e.getBoundingClientRect().height:0;function be(e,r,n){let t=(0,o.useRef)(n);t.current=n;let a=n!==void 0;(0,o.useLayoutEffect)(()=>{let i=e.current;if(!i||!a)return;let d=()=>{let m=[...i.children],h=m.find(b=>b.hasAttribute("data-graview-app-bar")),p=m.find(b=>b.hasAttribute("data-embed-content")),g=p?.querySelector("[data-embed-measure]")??null,l=m.find(b=>b.hasAttribute("data-graview-place-line"));return{strip:h,line:l,content:p,measure:g}},s=-1,c=()=>{let{strip:m,line:h,content:p,measure:g}=d(),l=Math.ceil(F(m)+F(h)+F(g||p));l!==s&&(s=l,t.current?.(l))};if(c(),typeof ResizeObserver>"u")return;let u=new ResizeObserver(c),E=()=>{u.disconnect();let{strip:m,line:h,content:p,measure:g}=d();for(let l of[i,m,h,p,g])l&&u.observe(l)};E();let w=new MutationObserver(()=>{E(),c()});return w.observe(i,{childList:!0}),()=>{u.disconnect(),w.disconnect()}},[e,r,a])}var we=480,se=0;function Se(e){let{app:r,seed:n,scheme:t="auto",brand:a=r.brand,fonts:i=!0,height:d="100%",label:s}=e,c=(0,o.useRef)(null);$(c);let u=d==="viewport"?"100dvh":d,E=G(typeof u=="string"&&/vh\b/.test(u)),w=(0,o.useMemo)(()=>`graview-embed-${++se}`,[]),m=(0,o.useMemo)(()=>e.store??e.remote?.store??H(r,n),[e.store,e.remote,r,n]),h=e.presence??e.remote?.presence,p=e.hostContext?.theme,g=ne(t==="auto"&&p===void 0,a?.scheme),l=t==="auto"?p??g:t,b=(0,o.useMemo)(()=>O(l,a,{scope:`.${w}`}),[l,a,w]);K(e.favicon?C(a):void 0),(0,o.useEffect)(()=>{if(!i||typeof document>"u")return;let v=ee(a);if(!v||document.querySelector(`link[href="${v}"]`))return;let f=document.createElement("link");f.rel="stylesheet",f.href=v,document.head.appendChild(f)},[a,i]);let A=(0,o.useRef)(void 0);(0,o.useLayoutEffect)(()=>{let v=c.current,f=A.current;if(A.current=s,!v||!s)return;let oe=S=>{let R=S.getAttribute("aria-label")??"",x=f&&f!==s?R.startsWith(`${f} \xB7 `)?R.slice(f.length+3):R===f?"":R:R;x===s&&(S.getAttribute("role")==="region"||S.tagName==="SECTION"&&!S.hasAttribute("role"))&&S.setAttribute("role","group");let V=x.startsWith(`${s} \xB7 `)||x===s?x:x?`${s} \xB7 ${x}`:s;V!==R&&S.setAttribute("aria-label",V)},B=()=>v.querySelectorAll("aside, nav, main, header, footer, section[aria-label]:not([role]), [role=region], [role=complementary], [role=navigation], [role=search]").forEach(S=>{S.hasAttribute("data-graview-named-by-lens")||oe(S)});B();let P=new MutationObserver(B);return P.observe(v,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-label"]}),()=>P.disconnect()},[s]);let re=E?`${u}`.replace(/([\d.]+)[sdl]?vh\b/g,(v,f)=>`${+f*E/100}px`):u;return{rootRef:c,scope:w,css:b,scheme:l,store:m,presence:h,brand:a,auto:d==="auto",height:re}}function ve({rootRef:e,board:r}){let n=(0,o.useCallback)(()=>e.current?.querySelector("[data-embed-content]")??e.current,[e]);return(0,y.jsx)(q,{board:r,anchor:n})}function Ee(e,r,n){return{brand:n,locale:e.locale,timeZone:e.timeZone,principal:e.principal,seats:e.seats,presence:r,typing:e.remote?.typing,people:e.people,memory:e.memory,presenceTtlMs:e.presenceTtlMs,onKeepLens:e.onKeepLens,ai:e.ai,files:e.files,resolveApp:e.resolveApp,history:e.history,linkedRecords:e.linkedRecords,subscriptions:e.subscriptions,dismissals:e.dismissals,whileAway:e.whileAway,keptViews:e.keptViews,onExport:e.onExport,signIn:e.signIn,menuSections:e.menuSections,app:e.app}}function Re({name:e,heading:r,faces:n,at:t,without:a,home:i,reach:d,standing:s,hostActions:c,keeping:u,onFind:E,switch:w,named:m=!0}){let{brand:h,store:p,principal:g,views:l}=T();N();let b=a?.has("places")?[]:z({store:p,principal:g,views:l}),A=_();return(0,y.jsx)(j,{brand:h,name:e,named:m,description:h?.subtitle,heading:r,faces:n,home:i,places:b,current:t===null?null:W(b,t),reach:d,onFind:E,...w?{switch:w}:{},...n||t===null?{scenePlaces:A}:{},tools:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(J,{clean:s}),(0,y.jsx)(Z,{...c?{hostActions:c}:{},...u?{keeping:u}:{}})]})})}var xe=e=>e===!1?2:Math.min(e+1,6);function Ae(e){let[r,n]=(0,o.useState)(e),t=(0,o.useRef)(void 0),a=(0,o.useRef)(void 0),i=(0,o.useMemo)(()=>({go:t,at:n,pending:a}),[]),d=(0,o.useCallback)(s=>{if(t.current){t.current(s);return}a.current=s,n(s)},[]);return{at:r,setAt:n,steering:i,steer:d}}function de(e){let r=typeof e=="object"&&e!==null?e.name:void 0;return{name:typeof r=="string"&&r.length>0?r:typeof e=="object"?"Error":typeof e}}var L=()=>typeof performance<"u"?performance.now():Date.now();function Fe(e,r){let n=(0,o.useRef)({onError:e,face:r});return n.current={onError:e,face:r},(0,o.useCallback)((t,a)=>n.current.onError?.(de(t),{module:a.module,face:n.current.face}),[])}function ke(e,r){let n=(0,o.useRef)(null);n.current===null&&(n.current=L());let t=(0,o.useRef)({onReady:e,face:r});t.current={onReady:e,face:r};let a=(0,o.useRef)(!1);return(0,o.useCallback)(i=>{a.current||(a.current=!0,t.current.onReady?.({ms:Math.max(0,L()-(n.current??L())),face:i}))},[])}var te=class extends o.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(r,n){console.error(`[graview] ${this.props.module} threw while rendering`,r,n.componentStack),this.props.report(r,{module:this.props.module})}render(){return this.state.failed?(0,y.jsxs)("div",{role:"alert","data-graview-face-error":this.props.module,...this.props.content?{"data-embed-content":""}:{},style:this.props.content?{flex:"1 1 auto",display:"grid",alignContent:"center",justifyItems:"center",gap:8,padding:24,background:"var(--graview-ground)",color:"var(--graview-ink)",fontSize:"0.9375rem"}:{display:"inline-flex",alignItems:"center",gap:6,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:[(0,y.jsx)("span",{children:this.props.content?"This part of the app could not draw.":"Could not draw."}),(0,y.jsx)("button",{type:"button",onClick:()=>this.setState({failed:!1}),style:{padding:"3px 11px",fontSize:"0.8125rem"},children:"Try again"})]}):this.props.children}};export{fe as a,he as b,ge as c,be as d,we as e,Se as f,ve as g,Ee as h,Re as i,xe as j,Ae as k,Fe as l,ke as m,te as n};
@@ -1 +1 @@
1
- import{a as U,b as Y,c as G,d as D}from"./chunk.ATSKKTUO.js";import"./chunk.6IUEGPCZ.js";import"./chunk.CUJX3IVA.js";import{G as ae,O as L,P as F,T as V,ca as _}from"./chunk.VNJKGSGZ.js";import"./chunk.SDO3U72B.js";import{T as H,Wc as M,Za as K,_a as B}from"./chunk.X3MMJ3QC.js";import"./chunk.FQLNBIQ5.js";import{b as R}from"./chunk.AJZBJBMO.js";function O(n,t){let r=K(n);return r==="agent"?"agent":r!=="human"&&r!=="visitor"?"app":n.onBehalfOf!==void 0?"person":n.id===void 0||t?.id===void 0||n.id===t.id?"you":"person"}var re=n=>n.ops.filter(t=>t.withheld!==!0);function X(n,t={}){let r=[];for(let e of n.batches()){let s=e.ops[0],d=e.ops.at(-1),l=re(e).length===0,h=l?void 0:Y(e.ops),c=r.at(-1);if(h&&c?.typed&&c.author&&U(c.author,e.author)&&c.typed.node===h.node&&c.typed.field===h.field){let S=G(c.typed,h);r[r.length-1]={...c,seq:d.seq+1,at:d.at,batch:e.id,batches:[...c.batches??[],e.id],typed:S,said:D(S,n.schema,n.graph,!1)};continue}r.push({seq:d.seq+1,from:s.seq,at:d.at,batch:e.id,maker:l?"person":O(e.author,t.me),author:l?void 0:e.author,said:h?D(h,n.schema,n.graph,!1):e.intent,declaration:!1,withheld:l,...h?{batches:[e.id],typed:h}:{}})}let i=[...n.log.epochs().filter(e=>e.change!==void 0).map(e=>({seq:e.seq,sentence:e.change,...e.at?{at:e.at}:{}})),...t.declarations??[]];for(let e of i){if(e.seq<n.log.horizon||e.seq>n.log.length)continue;let s=r.findIndex(d=>d.seq===e.seq);if(s>=0&&!r[s].withheld){r[s]={...r[s],declaration:!0,said:e.sentence};continue}r.push({seq:e.seq,from:e.seq,at:e.at,batch:void 0,maker:e.author?O(e.author,t.me):"app",author:e.author,said:e.sentence,declaration:!0,withheld:!1})}return r.sort((e,s)=>e.seq-s.seq||+(e.batch!==void 0)-+(s.batch!==void 0))}function J(n,t){let r=n.log.all(),i=new Map(r.map(e=>[e.id,e.seq]));return n.batches().filter(e=>!e.undone&&e.ops[0].seq>=t).filter(e=>!e.ops.every(s=>s.undoes!==void 0&&(i.get(s.undoes)??-1)>=t)).map(e=>e.id)}function Q(n,t){return n.withheld?"Someone":n.maker==="you"?"you":n.author?B(n.author,t):"the app"}var p=R(ae(),1);var o=R(V(),1),oe={kind:"human"},ie=[1,2,4,8],se=900,E={you:"You",person:"A person",agent:"An agent",app:"The app"},Z={you:"var(--graview-accent)",person:"var(--graview-ink-muted)",agent:"var(--graview-activity, var(--graview-good))",app:"var(--graview-edge-bright)"};function de(n,t,r){return[...new Set([...r,t,...n.map(i=>i.seq)])].sort((i,e)=>i-e)}function le(n,t){let r=n.withheld===!0;return{seq:n.seq+1,from:n.seq,at:n.at,batch:n.batch,maker:r?"person":O(n.author,t),author:r?void 0:n.author,said:n.batchIntent??n.intent,declaration:!1,withheld:r}}function ce(n,t){let r=0;for(let i=0;i<n.length;i++)n[i]<=t&&(r=i);return r}function pe(n,t,r){let i=J(n,t);if(i.length===0)return null;let e=n.canUndo(i);if(!e.ok)return null;let s=new Set(n.permittedMutations(r).map(d=>d.name));return e.ops.every(d=>d.mutation!==null&&s.has(d.mutation.name))?i:null}function we({face:n}){let t=L(),r=_(),i=r?.principal??oe,e=F(t.live,i),s=e.log.length,d=(0,p.useMemo)(()=>X(e,{me:i,...t.host?.declarations?{declarations:t.host.declarations}:{}}),[e,i,t.host,s]),l=e.log.horizon,h=l>0&&t.host?.archived!==void 0,c=t.kept,S=(0,p.useMemo)(()=>h?c?.stops??Array.from({length:l},(a,g)=>g):[],[h,c,l]),m=(0,p.useMemo)(()=>de(d,l,S),[d,l,S]),f=t.archive,y=f?.seq??t.past?.seq??s,x=t.host?.kept&&(f?.behindKept||c!==void 0&&(y<=c.through||c.from>0&&y<=c.from))?t.host.kept:void 0,w=ce(m,y),b=m.length-1,j=y<l&&t.past?.seq===y?t.past.store.log.all().at(-1):void 0,q=j?le(j,i):y<l?void 0:[...d].reverse().find(a=>a.seq<=y&&a.seq>(m[w-1]??-1))??[...d].reverse().find(a=>a.seq<=y),[k,A]=(0,p.useState)(!1),[T,ee]=(0,p.useState)(1),[C,W]=(0,p.useState)(null);(0,p.useEffect)(()=>{if(!k)return;if(w>=b){A(!1);return}let a=setTimeout(()=>t.show(m[w+1]),se/T);return()=>clearTimeout(a)},[k,w,b,T,m,t]);let z=(0,p.useMemo)(()=>t.past&&!f&&y>=l?pe(e,y,i):null,[t.past,f,e,y,l,i,s]),N=a=>Q(a,{graph:e.graph,schema:e.schema,...r?.seats?{seats:r.seats}:{},...r?.people?{people:r.people}:{}}),v=t.past?t.past.at?H(t.past.at,r?.locale):"the start":null,$=f?f.refused?"The archive could not be read":f.behindKept?"Nothing this far back is kept":"Reading the older changes from the archive\u2026":q?`${N(q)==="you"?"You":N(q)}: ${q.said}`:"Nothing had happened yet",I=(0,p.useRef)(null);(0,p.useLayoutEffect)(()=>{let a=I.current,g=a?.parentElement;if(n!=="scene"||!a||!g)return;let u=()=>g.style.setProperty("--graview-sheet",`${Math.ceil(a.getBoundingClientRect().height)+24}px`);u();let P=typeof ResizeObserver>"u"?null:new ResizeObserver(u);return P?.observe(a),()=>{P?.disconnect(),g.style.removeProperty("--graview-sheet")}},[n]);let te=n==="scene"?{position:"absolute",left:"50%",bottom:12,transform:"translateX(-50%)",width:"min(720px, calc(100% - 32px))",zIndex:M("rail")}:{position:"sticky",top:0,zIndex:M("rail"),margin:"0 auto 12px",maxWidth:960,width:"100%"};return(0,o.jsxs)("section",{ref:I,"aria-label":"Timeline","data-testid":"timeline","data-graview-past":t.past?String(t.past.seq):"now","data-graview-offstage":"",style:{...te,boxSizing:"border-box",display:"grid",gap:8,padding:"10px 12px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontSize:"0.8125rem"},children:[(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px"},children:[(0,o.jsx)("strong",{"data-testid":"as-of",role:"status",style:{fontWeight:600},children:f?"Archived changes":v?`As of ${v}`:"Now"}),(0,o.jsx)("span",{"data-testid":"timeline-caption",style:{color:"var(--graview-ink-muted)",minWidth:0,overflowWrap:"anywhere"},children:$}),v?(0,o.jsx)("span",{style:{color:"var(--graview-ink-faint)"},"data-testid":"past-read-only",children:"Nothing changes while you look back."}):null]}),(0,o.jsxs)("div",{style:{position:"relative",height:22},"aria-hidden":"true",children:[h?(0,o.jsx)("span",{"data-testid":"timeline-archived",title:"Changes read from the archive as you scrub back",style:{position:"absolute",left:0,bottom:0,height:6,width:`${b===0?0:m.indexOf(l)/b*100}%`,borderRadius:2,background:"var(--graview-edge)"}}):null,m.slice(1).map((a,g)=>{let u=[...d].reverse().find(ne=>ne.seq===a);if(!u)return null;let P=b===0?0:(g+1)/b*100;return(0,o.jsx)("span",{"data-graview-tick":a,"data-maker":u.maker,...u.declaration?{"data-declaration":""}:{},title:`${E[u.maker]}: ${u.said}`,style:{position:"absolute",left:`calc(${P}% - 1px)`,bottom:0,width:u.declaration?4:2,height:u.declaration?22:12,borderRadius:2,background:u.declaration?"var(--graview-ink)":Z[u.maker],opacity:a<=y?1:.45}},`${a}:${u.batch??"declaration"}`)})]}),(0,o.jsx)("input",{type:"range","data-testid":"scrubber","aria-label":"Moment",min:0,max:b,step:1,value:w,"aria-valuetext":v?`As of ${v}. ${$}`:`Now. ${$}`,onChange:a=>{A(!1),t.show(m[Number(a.currentTarget.value)]??s)},style:{width:"100%",margin:0,accentColor:"var(--graview-accent)"}}),(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,o.jsx)("button",{type:"button","data-testid":"play","aria-pressed":k,onClick:()=>{!k&&w>=b&&t.show(m[0]),A(!k)},style:{minHeight:28,minWidth:64},children:k?"Pause":"Play"}),(0,o.jsxs)("label",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--graview-ink-muted)"},children:["Speed",(0,o.jsx)("select",{"data-testid":"speed",value:T,onChange:a=>ee(Number(a.currentTarget.value)),style:{minHeight:28},children:ie.map(a=>(0,o.jsxs)("option",{value:a,children:[a,"\xD7"]},a))})]}),(0,o.jsx)("span",{"aria-hidden":"true",style:{display:"inline-flex",gap:10,color:"var(--graview-ink-faint)",flexWrap:"wrap"},children:Object.keys(E).filter(a=>d.some(g=>g.maker===a)).map(a=>(0,o.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[(0,o.jsx)("span",{style:{width:8,height:8,borderRadius:2,background:Z[a]}}),E[a]]},a))}),(0,o.jsxs)("span",{style:{marginLeft:"auto",display:"inline-flex",gap:8},children:[z?(0,o.jsx)("button",{type:"button","data-testid":"restore-here",title:"Take back every change since, as one change you can undo",onClick:()=>{W(null);try{e.undo([...z],{author:i,intent:v?`Restore to ${v}`:"Restore"}),t.show(null)}catch(a){W(a instanceof Error?a.message:String(a))}},style:{minHeight:28},children:"Restore to here"}):null,(0,o.jsx)("button",{type:"button","data-testid":"back-to-now",onClick:()=>t.show(null),style:{minHeight:28},children:"Back to now"})]})]}),C?(0,o.jsx)("span",{role:"alert","data-testid":"restore-refused",style:{color:"var(--graview-warn)"},children:C}):null,f?.refused?(0,o.jsx)("span",{role:"alert","data-testid":"archive-refused",style:{color:"var(--graview-warn)"},children:f.refused}):null,x?(0,o.jsxs)("span",{"data-testid":"timeline-kept",style:{color:"var(--graview-ink-faint)"},children:[x.sentence,x.action?(0,o.jsxs)(o.Fragment,{children:[" ",(0,o.jsx)("a",{"data-testid":"timeline-kept-action",href:x.action.href,style:{color:"var(--graview-ink-muted)"},children:x.action.label})]}):null]}):null,l>0&&!h?(0,o.jsx)("span",{"data-testid":"timeline-horizon",style:{color:"var(--graview-ink-faint)"},children:"The changes before the timeline's start were archived."}):null]})}export{we as Timeline};
1
+ import{a as U,b as Y,c as G,d as D}from"./chunk.RQOX5YDW.js";import"./chunk.WC3DENU4.js";import"./chunk.VNDKKTED.js";import{G as ae,O as L,P as F,T as V,ca as _}from"./chunk.4MP72LPR.js";import"./chunk.SDO3U72B.js";import{T as H,Za as K,_a as B,ad as M}from"./chunk.VSCIXAHN.js";import"./chunk.FQLNBIQ5.js";import{b as R}from"./chunk.AJZBJBMO.js";function O(n,t){let r=K(n);return r==="agent"?"agent":r!=="human"&&r!=="visitor"?"app":n.onBehalfOf!==void 0?"person":n.id===void 0||t?.id===void 0||n.id===t.id?"you":"person"}var re=n=>n.ops.filter(t=>t.withheld!==!0);function X(n,t={}){let r=[];for(let e of n.batches()){let s=e.ops[0],d=e.ops.at(-1),l=re(e).length===0,h=l?void 0:Y(e.ops),c=r.at(-1);if(h&&c?.typed&&c.author&&U(c.author,e.author)&&c.typed.node===h.node&&c.typed.field===h.field){let S=G(c.typed,h);r[r.length-1]={...c,seq:d.seq+1,at:d.at,batch:e.id,batches:[...c.batches??[],e.id],typed:S,said:D(S,n.schema,n.graph,!1)};continue}r.push({seq:d.seq+1,from:s.seq,at:d.at,batch:e.id,maker:l?"person":O(e.author,t.me),author:l?void 0:e.author,said:h?D(h,n.schema,n.graph,!1):e.intent,declaration:!1,withheld:l,...h?{batches:[e.id],typed:h}:{}})}let i=[...n.log.epochs().filter(e=>e.change!==void 0).map(e=>({seq:e.seq,sentence:e.change,...e.at?{at:e.at}:{}})),...t.declarations??[]];for(let e of i){if(e.seq<n.log.horizon||e.seq>n.log.length)continue;let s=r.findIndex(d=>d.seq===e.seq);if(s>=0&&!r[s].withheld){r[s]={...r[s],declaration:!0,said:e.sentence};continue}r.push({seq:e.seq,from:e.seq,at:e.at,batch:void 0,maker:e.author?O(e.author,t.me):"app",author:e.author,said:e.sentence,declaration:!0,withheld:!1})}return r.sort((e,s)=>e.seq-s.seq||+(e.batch!==void 0)-+(s.batch!==void 0))}function J(n,t){let r=n.log.all(),i=new Map(r.map(e=>[e.id,e.seq]));return n.batches().filter(e=>!e.undone&&e.ops[0].seq>=t).filter(e=>!e.ops.every(s=>s.undoes!==void 0&&(i.get(s.undoes)??-1)>=t)).map(e=>e.id)}function Q(n,t){return n.withheld?"Someone":n.maker==="you"?"you":n.author?B(n.author,t):"the app"}var p=R(ae(),1);var o=R(V(),1),oe={kind:"human"},ie=[1,2,4,8],se=900,E={you:"You",person:"A person",agent:"An agent",app:"The app"},Z={you:"var(--graview-accent)",person:"var(--graview-ink-muted)",agent:"var(--graview-activity, var(--graview-good))",app:"var(--graview-edge-bright)"};function de(n,t,r){return[...new Set([...r,t,...n.map(i=>i.seq)])].sort((i,e)=>i-e)}function le(n,t){let r=n.withheld===!0;return{seq:n.seq+1,from:n.seq,at:n.at,batch:n.batch,maker:r?"person":O(n.author,t),author:r?void 0:n.author,said:n.batchIntent??n.intent,declaration:!1,withheld:r}}function ce(n,t){let r=0;for(let i=0;i<n.length;i++)n[i]<=t&&(r=i);return r}function pe(n,t,r){let i=J(n,t);if(i.length===0)return null;let e=n.canUndo(i);if(!e.ok)return null;let s=new Set(n.permittedMutations(r).map(d=>d.name));return e.ops.every(d=>d.mutation!==null&&s.has(d.mutation.name))?i:null}function we({face:n}){let t=L(),r=_(),i=r?.principal??oe,e=F(t.live,i),s=e.log.length,d=(0,p.useMemo)(()=>X(e,{me:i,...t.host?.declarations?{declarations:t.host.declarations}:{}}),[e,i,t.host,s]),l=e.log.horizon,h=l>0&&t.host?.archived!==void 0,c=t.kept,S=(0,p.useMemo)(()=>h?c?.stops??Array.from({length:l},(a,g)=>g):[],[h,c,l]),m=(0,p.useMemo)(()=>de(d,l,S),[d,l,S]),f=t.archive,y=f?.seq??t.past?.seq??s,x=t.host?.kept&&(f?.behindKept||c!==void 0&&(y<=c.through||c.from>0&&y<=c.from))?t.host.kept:void 0,w=ce(m,y),b=m.length-1,j=y<l&&t.past?.seq===y?t.past.store.log.all().at(-1):void 0,q=j?le(j,i):y<l?void 0:[...d].reverse().find(a=>a.seq<=y&&a.seq>(m[w-1]??-1))??[...d].reverse().find(a=>a.seq<=y),[k,A]=(0,p.useState)(!1),[T,ee]=(0,p.useState)(1),[C,W]=(0,p.useState)(null);(0,p.useEffect)(()=>{if(!k)return;if(w>=b){A(!1);return}let a=setTimeout(()=>t.show(m[w+1]),se/T);return()=>clearTimeout(a)},[k,w,b,T,m,t]);let z=(0,p.useMemo)(()=>t.past&&!f&&y>=l?pe(e,y,i):null,[t.past,f,e,y,l,i,s]),N=a=>Q(a,{graph:e.graph,schema:e.schema,...r?.seats?{seats:r.seats}:{},...r?.people?{people:r.people}:{}}),v=t.past?t.past.at?H(t.past.at,r?.locale):"the start":null,$=f?f.refused?"The archive could not be read":f.behindKept?"Nothing this far back is kept":"Reading the older changes from the archive\u2026":q?`${N(q)==="you"?"You":N(q)}: ${q.said}`:"Nothing had happened yet",I=(0,p.useRef)(null);(0,p.useLayoutEffect)(()=>{let a=I.current,g=a?.parentElement;if(n!=="scene"||!a||!g)return;let u=()=>g.style.setProperty("--graview-sheet",`${Math.ceil(a.getBoundingClientRect().height)+24}px`);u();let P=typeof ResizeObserver>"u"?null:new ResizeObserver(u);return P?.observe(a),()=>{P?.disconnect(),g.style.removeProperty("--graview-sheet")}},[n]);let te=n==="scene"?{position:"absolute",left:"50%",bottom:12,transform:"translateX(-50%)",width:"min(720px, calc(100% - 32px))",zIndex:M("rail")}:{position:"sticky",top:0,zIndex:M("rail"),margin:"0 auto 12px",maxWidth:960,width:"100%"};return(0,o.jsxs)("section",{ref:I,"aria-label":"Timeline","data-testid":"timeline","data-graview-past":t.past?String(t.past.seq):"now","data-graview-offstage":"",style:{...te,boxSizing:"border-box",display:"grid",gap:8,padding:"10px 12px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontSize:"0.8125rem"},children:[(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px"},children:[(0,o.jsx)("strong",{"data-testid":"as-of",role:"status",style:{fontWeight:600},children:f?"Archived changes":v?`As of ${v}`:"Now"}),(0,o.jsx)("span",{"data-testid":"timeline-caption",style:{color:"var(--graview-ink-muted)",minWidth:0,overflowWrap:"anywhere"},children:$}),v?(0,o.jsx)("span",{style:{color:"var(--graview-ink-faint)"},"data-testid":"past-read-only",children:"Nothing changes while you look back."}):null]}),(0,o.jsxs)("div",{style:{position:"relative",height:22},"aria-hidden":"true",children:[h?(0,o.jsx)("span",{"data-testid":"timeline-archived",title:"Changes read from the archive as you scrub back",style:{position:"absolute",left:0,bottom:0,height:6,width:`${b===0?0:m.indexOf(l)/b*100}%`,borderRadius:2,background:"var(--graview-edge)"}}):null,m.slice(1).map((a,g)=>{let u=[...d].reverse().find(ne=>ne.seq===a);if(!u)return null;let P=b===0?0:(g+1)/b*100;return(0,o.jsx)("span",{"data-graview-tick":a,"data-maker":u.maker,...u.declaration?{"data-declaration":""}:{},title:`${E[u.maker]}: ${u.said}`,style:{position:"absolute",left:`calc(${P}% - 1px)`,bottom:0,width:u.declaration?4:2,height:u.declaration?22:12,borderRadius:2,background:u.declaration?"var(--graview-ink)":Z[u.maker],opacity:a<=y?1:.45}},`${a}:${u.batch??"declaration"}`)})]}),(0,o.jsx)("input",{type:"range","data-testid":"scrubber","aria-label":"Moment",min:0,max:b,step:1,value:w,"aria-valuetext":v?`As of ${v}. ${$}`:`Now. ${$}`,onChange:a=>{A(!1),t.show(m[Number(a.currentTarget.value)]??s)},style:{width:"100%",margin:0,accentColor:"var(--graview-accent)"}}),(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,o.jsx)("button",{type:"button","data-testid":"play","aria-pressed":k,onClick:()=>{!k&&w>=b&&t.show(m[0]),A(!k)},style:{minHeight:28,minWidth:64},children:k?"Pause":"Play"}),(0,o.jsxs)("label",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--graview-ink-muted)"},children:["Speed",(0,o.jsx)("select",{"data-testid":"speed",value:T,onChange:a=>ee(Number(a.currentTarget.value)),style:{minHeight:28},children:ie.map(a=>(0,o.jsxs)("option",{value:a,children:[a,"\xD7"]},a))})]}),(0,o.jsx)("span",{"aria-hidden":"true",style:{display:"inline-flex",gap:10,color:"var(--graview-ink-faint)",flexWrap:"wrap"},children:Object.keys(E).filter(a=>d.some(g=>g.maker===a)).map(a=>(0,o.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[(0,o.jsx)("span",{style:{width:8,height:8,borderRadius:2,background:Z[a]}}),E[a]]},a))}),(0,o.jsxs)("span",{style:{marginLeft:"auto",display:"inline-flex",gap:8},children:[z?(0,o.jsx)("button",{type:"button","data-testid":"restore-here",title:"Take back every change since, as one change you can undo",onClick:()=>{W(null);try{e.undo([...z],{author:i,intent:v?`Restore to ${v}`:"Restore"}),t.show(null)}catch(a){W(a instanceof Error?a.message:String(a))}},style:{minHeight:28},children:"Restore to here"}):null,(0,o.jsx)("button",{type:"button","data-testid":"back-to-now",onClick:()=>t.show(null),style:{minHeight:28},children:"Back to now"})]})]}),C?(0,o.jsx)("span",{role:"alert","data-testid":"restore-refused",style:{color:"var(--graview-warn)"},children:C}):null,f?.refused?(0,o.jsx)("span",{role:"alert","data-testid":"archive-refused",style:{color:"var(--graview-warn)"},children:f.refused}):null,x?(0,o.jsxs)("span",{"data-testid":"timeline-kept",style:{color:"var(--graview-ink-faint)"},children:[x.sentence,x.action?(0,o.jsxs)(o.Fragment,{children:[" ",(0,o.jsx)("a",{"data-testid":"timeline-kept-action",href:x.action.href,style:{color:"var(--graview-ink-muted)"},children:x.action.label})]}):null]}):null,l>0&&!h?(0,o.jsx)("span",{"data-testid":"timeline-horizon",style:{color:"var(--graview-ink-faint)"},children:"The changes before the timeline's start were archived."}):null]})}export{we as Timeline};
@@ -1,4 +1,4 @@
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 Qe,b as Xe,c as Je,d as at,e as tt,h as Ze,i as ea,k as aa,l as ta,m as rt}from"./chunk.2XTCDFWU.js";import{c as je}from"./chunk.WGTBQHHE.js";import{g as Qa,h as Ja,i as Za}from"./chunk.P52UTBNO.js";import"./chunk.S7ZLGODY.js";import{b as Ua,c as Va,d as Ye,e as Ya}from"./chunk.UM5H2VVR.js";import"./chunk.E22DDEQI.js";import{m as Re,q as qa,r as _a,s as Ga}from"./chunk.OLW44AP5.js";import{a as Xa}from"./chunk.HJCQ6I3S.js";import{b as ja}from"./chunk.ATVPAYS6.js";import"./chunk.VNBEAF62.js";import{b as Wa}from"./chunk.QHU3KUZZ.js";import{b as _e,d as Ue,e as Ve}from"./chunk.YMRVKG6W.js";import"./chunk.P3CUCDHO.js";import{b as Ge}from"./chunk.OVSZXILB.js";import"./chunk.BDBLGGFJ.js";import"./chunk.IZ2ZTNEV.js";import"./chunk.CJUIJ6TL.js";import"./chunk.LDYOQCY7.js";import"./chunk.VFRURRNI.js";import"./chunk.X2G4ZRB2.js";import"./chunk.UITZ74YJ.js";import{e as et}from"./chunk.S6VON4LU.js";import"./chunk.M3JIIF32.js";import"./chunk.ZFH4SCCF.js";import"./chunk.GZHZLJBF.js";import{c as Ha,d as Oa,e as we,o as Da}from"./chunk.KHZA5F7A.js";import"./chunk.OJGHDWI6.js";import"./chunk.KSVJHSRH.js";import"./chunk.NSGQXCH6.js";import"./chunk.SZG6HJWH.js";import"./chunk.2FOIJ5ID.js";import{E as Fa,c as Na,d as Ia,j as qe,l as Ba,s as Ka}from"./chunk.6IUEGPCZ.js";import{b as Ea,c as $t}from"./chunk.CUJX3IVA.js";import{G,Ga as Ee,Na as Ma,Oa as U,Ra as La,T as $,Va as Pa,_ as Ra,aa as Ta,ba as T,da as Ce,i as Ke,j as $e,ka as za,m as ee,n as Ae,o as Fe,r as ve,x as Aa,y as ue,z as Ca}from"./chunk.VNJKGSGZ.js";import{a as ie}from"./chunk.SDO3U72B.js";import{Uc as H,W as re,Wc as D,ia as ka,ja as Se,ka as _,oa as Sa,uc as $a}from"./chunk.X3MMJ3QC.js";import"./chunk.FQLNBIQ5.js";import{b as m}from"./chunk.AJZBJBMO.js";function At(e){return`
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 Qe,b as Xe,c as Je,d as at,e as tt,h as Ze,i as ea,k as aa,l as ta,m as rt}from"./chunk.3UOKUF5Z.js";import{c as je}from"./chunk.CC5BJH5A.js";import{g as Qa,h as Ja,i as Za}from"./chunk.QI4SLPQ4.js";import"./chunk.Y5C4RXG7.js";import{b as Ua,c as Va,d as Ye,e as Ya}from"./chunk.FRYBMS3W.js";import"./chunk.3MOJF7BA.js";import{m as Re,q as qa,r as _a,s as Ga}from"./chunk.LZIBQ3VX.js";import{a as Xa}from"./chunk.HJCQ6I3S.js";import{b as ja}from"./chunk.QDSEVPF3.js";import"./chunk.7N32AVIJ.js";import{b as Wa}from"./chunk.X6A4VSSD.js";import{b as _e,d as Ue,e as Ve}from"./chunk.KDRLUBVF.js";import"./chunk.PNW5K7BW.js";import{b as Ge}from"./chunk.ENL2JJ47.js";import"./chunk.BQIHNT7C.js";import"./chunk.3XGA65Y3.js";import"./chunk.2K4TT2BV.js";import"./chunk.OLFJH4RK.js";import"./chunk.67U6M7OV.js";import"./chunk.ZP5RT2EK.js";import"./chunk.VZJWJ5XM.js";import{e as et}from"./chunk.JJGCTGWA.js";import"./chunk.XR6YR6RV.js";import"./chunk.VFOON3Z3.js";import"./chunk.GZHZLJBF.js";import{c as Ha,d as Oa,e as we,o as Da}from"./chunk.IOK4GVJC.js";import"./chunk.OJGHDWI6.js";import"./chunk.TLJOZSDD.js";import"./chunk.MSWWWLEA.js";import"./chunk.UITT6JWW.js";import"./chunk.A5PDXNY6.js";import{E as Fa,c as Na,d as Ia,j as qe,l as Ba,s as Ka}from"./chunk.WC3DENU4.js";import{b as Ea,c as $t}from"./chunk.VNDKKTED.js";import{G,Ga as Ee,Na as Ma,Oa as U,Ra as La,T as $,Va as Pa,_ as Ra,aa as Ta,ba as T,da as Ce,i as Ke,j as $e,ka as za,m as ee,n as Ae,o as Fe,r as ve,x as Aa,y as ue,z as Ca}from"./chunk.4MP72LPR.js";import{a as ie}from"./chunk.SDO3U72B.js";import{Ac as $a,W as re,_c as H,ad as D,ia as ka,ja as Se,ka as _,oa as Sa}from"./chunk.VSCIXAHN.js";import"./chunk.FQLNBIQ5.js";import{b as m}from"./chunk.AJZBJBMO.js";function At(e){return`
2
2
 
3
3
 
4
4
  .graview-altitude-control {
@@ -1128,6 +1128,6 @@ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=gl
1128
1128
  }
1129
1129
  [data-graview-connector][data-graview-activity] {
1130
1130
  animation: graview-relation 1200ms cubic-bezier(0.22, 1, 0.36, 1);
1131
- }`}function ra(e="dark",o={}){let d=At(e);return o.scope===void 0?d:Ea(d,o.scope)}var O=m(G(),1);var V=m($(),1),Ct=Ee(ie(()=>(__graviewPreload(import.meta.url,["./chunk.6IUEGPCZ.js","./chunk.CUJX3IVA.js","./chunk.VNJKGSGZ.js","./chunk.SDO3U72B.js","./chunk.X3MMJ3QC.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.V6EEDYYW.js")))).part(e=>(0,V.jsx)(e.MapKey,{}),{quiet:!0});function ia(){let{store:e}=T(),{view:o}=U(),d=Ce(),s=(0,O.useMemo)(()=>e.graph.allEdges().length>0,[e,d]),[n,w]=(0,O.useState)(!1),v=(0,O.useId)(),g=(0,O.useRef)(null),x=(0,O.useRef)(null);return(0,O.useEffect)(()=>{if(!n)return;let h=c=>{let C=c.target;C&&(x.current?.contains(C)||g.current?.contains(C))||w(!1)};return document.addEventListener("pointerdown",h,!0),()=>document.removeEventListener("pointerdown",h,!0)},[n]),s?(0,V.jsxs)("div",{style:{display:"contents"},onKeyDown:h=>{h.key!=="Escape"||!n||(h.preventDefault(),h.stopPropagation(),w(!1),g.current?.focus({preventScroll:!0}))},children:[(0,V.jsx)("button",{ref:g,type:"button","data-testid":"lines-key","aria-expanded":n,"aria-controls":v,title:"What the lines mean",onClick:()=>w(h=>!h),style:{position:"absolute",top:60,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("overview"),height:30,padding:"0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.8125rem",color:n?"var(--graview-accent)":"var(--graview-ink-muted)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Key"}),n?(0,V.jsxs)("div",{ref:x,id:v,"data-testid":"lines-key-pane","data-graview-offstage":"",style:{position:"absolute",top:98,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("rail"),width:tt,maxHeight:"calc(100cqh - 120px)",overflowY:"auto",boxSizing:"border-box",padding:"8px 8px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[o.overview?(0,V.jsx)(Ct,{}):null,(0,V.jsx)(at,{inside:!0,widthOf:Xa})]}):null]}):null}var ze=m(G(),1),Te=m($(),1);function it(e){return e.lens!==null?{what:"lens",kind:e.lens}:e.records.length===1&&e.districts.length===0?{what:"record",id:e.records[0]}:e.districts.length===1&&e.records.length===0?{what:"district",kind:e.districts[0]}:null}var Et=Ee(ie(()=>(__graviewPreload(import.meta.url,["./chunk.P52UTBNO.js","./chunk.2QESVWUW.js","./chunk.UM5H2VVR.js","./chunk.E22DDEQI.js","./chunk.OLW44AP5.js","./chunk.HJCQ6I3S.js","./chunk.ATVPAYS6.js","./chunk.VNBEAF62.js","./chunk.IZ2ZTNEV.js","./chunk.6E36I2GC.js","./chunk.CJUIJ6TL.js","./chunk.IIESMHXY.js","./chunk.LDYOQCY7.js","./chunk.VFRURRNI.js","./chunk.X2G4ZRB2.js","./chunk.UITZ74YJ.js","./chunk.ZFH4SCCF.js","./chunk.WVUJXDXZ.js","./chunk.Q6LLURRM.js","./chunk.AXXYJCSW.js","./chunk.N4LOI3YA.js","./chunk.RKZ4J3H2.js","./chunk.HKINU7VO.js","./chunk.YGZCESXY.js","./chunk.GZHZLJBF.js","./chunk.KHZA5F7A.js","./chunk.OJGHDWI6.js","./chunk.KSVJHSRH.js","./chunk.NSGQXCH6.js","./chunk.SZG6HJWH.js","./chunk.2FOIJ5ID.js","./chunk.6IUEGPCZ.js","./chunk.CUJX3IVA.js","./chunk.VNJKGSGZ.js","./chunk.SDO3U72B.js","./chunk.X3MMJ3QC.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.6VNKGTLF.js")))),Rt=Et.part((e,o)=>(0,Te.jsx)(e.MapPanelFor,{showing:o.showing}),{what:"This panel",quiet:!0});function na(){let{store:e,view:o,selection:d,hiddenKinds:s,seatTalk:n}=T();Ce();let w=(0,ze.useSyncExternalStore)(n.subscribe,()=>n.get().draft!==null,()=>!1);if(!o.overview||w)return null;let v=it(ja(d,{...o,beside:!0},g=>e.graph.getNode(g)?.kind));return!v||v.what!=="record"&&(s.has(v.kind)||!e.schema.kinds.includes(v.kind))?null:(0,Te.jsx)(ze.Suspense,{fallback:null,children:(0,Te.jsx)(Rt,{showing:v})})}var Tt=m(G(),1);var W=m($(),1);function oa(){let{view:e,go:o}=U(),{store:d,views:s,hiddenKinds:n}=T(),w=e.overview??!1,v=s.places().map(E=>E.kind).filter(E=>!n.has(E)),g=Fa(e,d.schema.kinds,v),x=()=>{o($e(ee(e,!1),g))},h=(()=>{if(!g)return null;let E=Aa(g)[0],b=e.within?.view,R=(b?s.places().find(N=>N.as===b):void 0)??(E?s.places().filter(N=>N.kind===E).at(-1):void 0);return R?R.title:E?_(d.schema,E):d.graph.getNode(g)?.label??null})(),c=w?"Close the map":"Up",C=w&&h?`Close the map, down to ${h}`:c;return(0,W.jsxs)("button",{type:"button","data-testid":"overview",className:"graview-altitude-control","aria-pressed":w,"aria-label":C,title:w?C:"Up \u2014 the whole thing, from above",onClick:()=>w?x():o(ee(e,!0)),style:{position:"absolute",top:14,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("overview"),display:"inline-flex",alignItems:"center",justifyContent:"center",gap:7,height:38,padding:"0 13px 0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.875rem",whiteSpace:"nowrap",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)","--graview-altitude":w?1:0,...w?{color:"var(--graview-accent)"}:{}},children:[(0,W.jsxs)("svg",{className:"graview-altitude-mark",width:"16",height:"16",viewBox:"0 0 12 12","aria-hidden":"true",children:[(0,W.jsx)("ellipse",{className:"graview-altitude-mark-ring",cx:"6",cy:"6.6",rx:"5",ry:"2.6",fill:"none",stroke:"currentColor",strokeWidth:"0.9"}),(0,W.jsx)("circle",{className:"graview-altitude-mark-apex",cx:"6",cy:"4",r:"1.5",fill:"currentColor"}),(0,W.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"left",cx:"1.6",cy:"7.4",r:"1.2",fill:"currentColor"}),(0,W.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"right",cx:"10.4",cy:"7.4",r:"1.2",fill:"currentColor"})]}),(0,W.jsx)("span",{className:"graview-altitude-label",children:c})]})}var sa=m($(),1);function da(){let{administered:e}=T(),{view:o,go:d}=U(),s=e.filter(n=>n.canShow);return s.length===0?null:(0,sa.jsx)("div",{role:"group","aria-label":"Administered","data-testid":"administered",style:{display:"flex",gap:6},children:s.map(n=>(0,sa.jsx)("button",{type:"button","aria-pressed":n.shown,"data-testid":`show-${n.name}`,title:n.shown?`Hide the ${n.name}'s own districts again`:n.description??`Show the ${n.name}'s own districts beside the domain`,onClick:()=>d(Ua(o,n.name,!n.shown)),style:{padding:"3px 11px",borderRadius:999,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:n.shown?"var(--graview-accent)":"var(--graview-edge)",color:n.shown?"var(--graview-accent)":"var(--graview-ink-muted)",background:n.shown?"var(--graview-panel)":"transparent"},children:n.shown?`Hide the ${n.name}`:`Show the ${n.name}`},n.name))})}var u=m(G(),1);var t=m($(),1);Ra({search:_a,touchWeights:qa});var ne=e=>e!==void 0&&"act"in e,Me=e=>e!==void 0&&"hit"in e&&e.hit.about==="node"?e:void 0,zt=e=>e.about==="rule"?"rule:":e.about==="act"?"act:":e.kind;function Mt(e){let o=()=>typeof window>"u"||window.innerWidth>=Ft,[d,s]=(0,u.useState)(o);return(0,u.useEffect)(()=>{let n=()=>s(o());return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),d&&!e}function dt({compact:e=!1}){let{store:o,view:d,setView:s,principal:n,setMenuAt:w,brand:v,aiDesk:g,selection:x}=T(),h=Ia(g),c=Ta(),C=Ma(),E=Da().marks.flag,b=Mt(e),R=(0,u.useRef)(null),N=(0,u.useRef)(null),z=(0,u.useRef)(null),B=(0,u.useId)(),[Le,I]=(0,u.useState)(!1),[K,se]=(0,u.useState)(null),[ft,he]=(0,u.useState)(null),[Pe,be]=(0,u.useState)([]),M=d.q??"";(0,u.useEffect)(()=>{let a=r=>{if(r.defaultPrevented)return;let i=r.key.toLowerCase()==="k"&&(r.metaKey||r.ctrlKey)&&!r.altKey&&!r.shiftKey,l=r.key==="/"&&!r.metaKey&&!r.ctrlKey&&!r.altKey;if(!i&&!l)return;let p=R.current;if(!p)return;let f=p.closest("[data-graview-embed]"),S=r.target,J=S===document.body||S===document.documentElement||S===window;if(f&&!(i&&J||S instanceof Node&&f.contains(S)))return;let Z=document.activeElement,ge=Z instanceof HTMLInputElement||Z instanceof HTMLTextAreaElement||Z instanceof HTMLSelectElement||Z instanceof HTMLElement&&Z.isContentEditable;l&&ge||(r.preventDefault(),p.getClientRects().length===0&&p.closest("[data-graview-app-bar]")?.querySelector('[data-testid="app-find-open"]')?.click(),p.focus({preventScroll:!0}),p.select(),I(!0))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]);let Ne=(0,u.useMemo)(()=>{let a=new Map;for(let[i,l]of(c?.hits??[]).entries()){if(l.about==="act")continue;let p=zt(l),f=a.get(p)??[];f.push({id:`${B}-${i}`,hit:l}),a.set(p,f)}let r=[...a.values()].filter(i=>i.some(l=>l.hit.about==="node")).length>1;return[...a.entries()].map(([i,l])=>{let p=0,f=l.filter(ge=>ge.hit.about!=="node"||!r||++p<=Wt),S=f.filter(ge=>ge.hit.about==="node").length,J=i.endsWith(":")?l.length:c?.byKind[i]??S,Z=!i.endsWith(":")&&S>0&&J>S?{id:`${B}-all-${i}`,all:i,count:J}:null;return{key:i,rows:f,count:J,more:Z}})},[c,B]),ae=h&&M.trim()?{id:`${B}-ask`,ask:M.trim()}:null,k=(0,u.useMemo)(()=>[...Ne.flatMap(a=>a.more?[...a.rows,a.more]:a.rows),...ae?[ae]:[]],[Ne,ae?.ask]),wa=(c?.hits??[]).filter(a=>a.about==="node").length,xe=c?.words??M,Ie=(0,u.useMemo)(()=>Re(xe).split(" ").filter(Boolean),[xe]),F=(0,u.useCallback)(a=>a.hit.about==="node"?Ga(o,a.hit.id,xe,{principal:n,limit:Bt}).map((r,i)=>({id:`${a.id}-act-${i}`,act:r,of:a.id})):[],[o,xe,n]),He=k.find(a=>a.id===K),q=k.find(a=>a.id===ft)??He??k[0],de=(0,u.useMemo)(()=>b&&Me(q)?F(q):[],[b,q?.id,F]),ye=(0,u.useMemo)(()=>b?new Map:new Map(Pe.flatMap(a=>{let r=Me(k.find(i=>i.id===a));return r?[[a,F(r)]]:[]})),[b,Pe,k,F]),ht=(0,u.useMemo)(()=>b?new Set:new Set(k.flatMap(a=>Me(a)&&F(a).length>0?[a.id]:[])),[b,k,F]),Oe=(0,u.useMemo)(()=>b?de:[...ye.values()].flat(),[b,de,ye]),L=He??Oe.find(a=>a.id===K)??k[0];(0,u.useEffect)(()=>{se(null),he(null),be([])},[M]);let le=(0,u.useRef)(null);(0,u.useEffect)(()=>{let a=le.current;if(!a)return;le.current=null;let r=0,i=()=>{let l=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`),p=document.activeElement;if(!(!p||p===document.body||p===document.documentElement||p===R.current||p===z.current||p===l))return;let S=[...l?.querySelectorAll('[role="group"][aria-label="Arrange"] :is(button, input)')??[]].find(J=>J.checkVisibility?.()??!0);if(S)return S.focus({preventScroll:!0});l&&l.tabIndex>=0&&p!==l&&l.focus({preventScroll:!0}),++r<240?requestAnimationFrame(i):document.activeElement===z.current&&z.current?.blur()};requestAnimationFrame(i)},[d]);let De=(a,r)=>{let i=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`);if(i&&i.tabIndex>=0)return i.focus({preventScroll:!0});let l=z.current;if(!l)return R.current?.blur();l.setAttribute("aria-label",r),l.focus({preventScroll:!0})},ma=(0,u.useRef)({x:Number.NaN,y:Number.NaN,moved:!1});(0,u.useEffect)(()=>{let a=r=>{let i=ma.current;i.moved=r.clientX!==i.x||r.clientY!==i.y,i.x=r.clientX,i.y=r.clientY};return window.addEventListener("mousemove",a,{capture:!0,passive:!0}),()=>window.removeEventListener("mousemove",a,{capture:!0})},[]);let ce=(0,u.useRef)(void 0);(0,u.useEffect)(()=>()=>clearTimeout(ce.current),[]);let te=a=>{a&&(clearTimeout(ce.current),se(a.id),ne(a)||he(a.id))},fa=a=>{if(!ma.current.moved)return;let r=a.target.closest?.('[role="option"]')?.id;if(!r||r===K)return;let i=k.find(l=>l.id===r)??Oe.find(l=>l.id===r);i&&(se(i.id),!ne(i)&&(clearTimeout(ce.current),ce.current=setTimeout(()=>he(i.id),Kt)))},bt=()=>{clearTimeout(ce.current),q&&!ne(L)&&se(q.id)},xt=a=>be(r=>r.includes(a.id)?r.filter(i=>i!==a.id):[...r,a.id]),ha=a=>{let r=N.current,i=r?.querySelector('[role="option"]')?.getBoundingClientRect().height??0,l=r?.clientHeight??0;return Math.min(a,i>0&&l>0?Math.max(1,Math.floor(l/i)-1):Ot)};(0,u.useEffect)(()=>{K&&document.getElementById(K)?.scrollIntoView?.({block:"nearest"})},[K]);let We=a=>{if(!a)return;if("ask"in a){Na(g,{pointed:{...x[0]!==void 0?{on:x[0]}:{},about:x},asked:a.ask}),s(i=>Ye(i)),I(!1);return}if("all"in a)return s(i=>ue(ee(i,!1),ve(a.all),{ownPicture:!0,...i.q?{carry:i.q}:{}})),le.current=a.all,I(!1),De(a.all,`Opening ${_(o.schema,a.all)} matching \u201C${M.trim()}\u201D\u2026`);if(ne(a)){let i=a.act.subject;s(p=>Ae(p,[i]));let l=R.current?.getBoundingClientRect();w({x:l?.left??0,y:(l?.bottom??0)+6,on:i}),I(!1),R.current?.blur();return}let r=a.hit;switch(r.about){case"node":s(i=>Ae($e(ee(i,!1),r.id),[r.id]));break;case"kind":return s(i=>ue(ee(i,!1),ve(r.kind),{ownPicture:!0})),le.current=r.kind,I(!1),De(r.kind,`Opening ${r.label}\u2026`);case"place":return s(i=>Ca(i,r.kind,r.as)),le.current=r.kind,I(!1),De(r.kind,`Opening ${r.title}\u2026`);case"rule":{let i=C.filter(l=>l.invariant===r.name).flatMap(l=>l.nodeIds);s(l=>Ae(l,[...new Set(i)]));break}case"act":break}I(!1),R.current?.blur()},yt=c?Ht(c.byKind,c.hits,o.schema):"",pe=Le&&M.trim().length>0,kt=(0,u.useCallback)(()=>{let a=R.current?.closest("[data-graview-app-bar]")?.getBoundingClientRect();if(a)return{x:a.right,y:a.bottom-Ut};let r=R.current?.getBoundingClientRect();return r?{x:r.right,y:r.bottom}:null},[]),ba=Pa("find",{open:pe,onOpenChange:a=>{a||I(!1)},...e?{at:kt}:{}}),ke=k.every(a=>"ask"in a),xa=a=>ne(a)?Oe.filter(r=>r.of===a.of):[],St=a=>{let r=ne(L)&&K!==null,i=r?k.find(p=>p.id===L.of):K!==null?He:void 0,l=i?k.indexOf(i):-1;if(a.key==="ArrowDown"){if(a.preventDefault(),I(!0),r){let p=xa(L),f=p.indexOf(L)+1;if(f<p.length)return te(p[f]);if(b)return}te(k[Math.min(k.length-1,l+1)])}else if(a.key==="ArrowUp"){if(a.preventDefault(),r){let p=xa(L),f=p.indexOf(L)-1;return te(f>=0?p[f]:i)}te(k[Math.max(0,l-1)])}else if((a.key==="PageDown"||a.key==="PageUp")&&k.length>0){a.preventDefault(),I(!0);let p=a.key==="PageDown"?ha(k.length):-ha(k.length);te(k[Math.min(k.length-1,Math.max(0,(l<0?-1:l)+p))])}else if(a.key==="ArrowRight"&&!r&&Me(L)){let p=L,f=b?p.id===q?.id?de:F(p):ye.get(p.id)??F(p);if(f.length===0)return;a.preventDefault(),!b&&!Pe.includes(p.id)&&be(S=>[...S,p.id]),he(p.id),se(f[0].id)}else if(a.key==="ArrowLeft"&&r){a.preventDefault();let p=L.of;b||be(f=>f.filter(S=>S!==p)),te(k.find(f=>f.id===p))}else a.key==="Enter"?(a.preventDefault(),We(L)):a.key==="Escape"&&(a.preventDefault(),M?s(p=>Ye(p)):R.current?.blur())},Be=(a,r,i={},l={})=>{let p=a.id===L?.id;return(0,t.jsx)("div",{id:a.id,role:"option","aria-selected":p,onClick:()=>We(a),style:{...Zt,...p?er:null,...i},...l,children:r},a.id)},ya=(a,r)=>{let i=a.id===L?.id;return(0,t.jsx)("div",{id:a.id,role:"option","aria-selected":i,"data-testid":"find-act","data-about":"act",onClick:()=>We(a),style:{...r?ir:ct,...i?nr:null,...a.act.destructive?{color:"var(--graview-warn)"}:null},children:a.act.title},a.id)};return(0,t.jsxs)("div",{style:{position:"relative",minWidth:0,flex:"1 1 auto"},"data-testid":"find",children:[(0,t.jsx)("input",{ref:a=>{R.current=a,ba.trigger.ref(a)},"data-graview-popover-trigger":"find",type:"search",role:"combobox","aria-label":"Find anything","aria-expanded":pe,"aria-controls":B,"aria-autocomplete":"list",...pe&&L?{"aria-activedescendant":L.id}:{},"data-testid":"find-box",placeholder:"Find\u2026","aria-keyshortcuts":"/ Meta+K Control+K",value:M,onChange:a=>{let r=a.target.value;I(!0),s(i=>Va(i,r.length>0?r:null))},onFocus:()=>I(!0),onBlur:()=>I(!1),onKeyDown:St,style:{width:"100%",boxSizing:"border-box",minWidth:0,height:30,padding:"0 var(--graview-bar-find-end, 10px) 0 10px",font:"inherit",fontSize:"0.875rem",color:"var(--graview-ink)",background:"var(--graview-panel)",border:`1px solid ${M?"var(--graview-accent)":"var(--graview-edge)"}`,borderRadius:8}}),(0,t.jsx)("span",{role:"status","aria-live":"polite",style:qe,"data-testid":"find-count",children:M.trim()?yt:""}),(0,t.jsx)("span",{ref:z,tabIndex:-1,role:"status",style:qe,"data-testid":"find-landing"}),(0,t.jsxs)("div",{...ba.pane,id:B,role:"listbox","aria-label":M?`What \u201C${M}\u201D finds`:"What the words find","data-testid":"find-strip","data-graview-find":b?"panel":"narrow",hidden:!pe,onMouseDown:a=>a.preventDefault(),style:{..._t,...e?Vt:b&&!ke?Gt:null,...pe?{display:"flex"}:null},children:[(0,t.jsxs)("div",{style:{...Yt,gridTemplateColumns:b&&!ke?`minmax(0, 1fr) ${qt}`:"minmax(0, 1fr)"},children:[(0,t.jsxs)("div",{ref:N,role:"presentation","data-testid":"find-list",onMouseMove:fa,style:jt,children:[ke?(0,t.jsxs)("p",{role:"presentation",style:{margin:0,padding:"10px 12px",color:"var(--graview-ink-muted)",fontSize:"0.875rem"},"data-testid":"find-nothing",children:["Nothing here is called \u201C",c?.words||M,"\u201D."]}):Ne.map(a=>(0,t.jsxs)("div",{role:"group","aria-label":ot(a.key,o.schema),children:[(0,t.jsxs)("div",{role:"presentation",style:la,children:[a.key!=="rule:"&&a.key!=="act:"?(0,t.jsx)(lt,{kind:a.key,accents:v?.accents}):null,(0,t.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ot(a.key,o.schema)}),(0,t.jsx)("span",{"aria-hidden":"true",style:Jt,"data-testid":"find-group-count",children:re(a.count)})]}),a.rows.map(r=>{let i=r.hit,l=i.about==="node"?i:null,p=!b&&l!==null&&ht.has(r.id),f=ye.get(r.id);return(0,t.jsxs)(u.Fragment,{children:[Be(r,(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Pt,{hit:i,flag:E,words:l?.near&&l.why.matched?[...Ie,Re(l.why.matched)]:Ie}),p?(0,t.jsx)("span",{"aria-hidden":"true","data-testid":"find-acts-open","data-open":f?"":void 0,title:f?"Put its actions away":"Actions",onClick:S=>{S.stopPropagation(),xt(r)},style:{...sr,...f?dr:null},children:(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"3.5",cy:"8",r:"1.4",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"1.4",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"12.5",cy:"8",r:"1.4",fill:"currentColor"})]})}):null]}),p?{paddingRight:48}:{},{"data-testid":"find-hit","data-about":i.about,...l?.near?{"data-near":""}:{},title:It(i)}),f?(0,t.jsx)("div",{role:"group","aria-label":`What can be done about ${l?.label??"it"}`,style:or,children:f.map(S=>ya(S,!0))}):null]},r.id)}),a.more?Be(a.more,(0,t.jsxs)("span",{style:Q,children:["All ",re(a.more.count)," ",Se(o.schema,a.more.all).toLowerCase()," matching \u201C",M.trim(),"\u201D"]}),ar,{"data-testid":"find-all","data-about":"all"}):null]},a.key)),ae?Be(ae,(0,t.jsxs)("span",{style:Q,children:["Ask: ",(0,t.jsxs)("span",{style:{fontWeight:600},children:["\u2018",ae.ask,"\u2019"]})]}),{borderTop:"1px solid var(--graview-edge)",marginTop:4},{"data-testid":"find-ask"}):null,wa>Dt?(0,t.jsxs)("p",{role:"presentation",style:st,"data-testid":"find-more-words",children:[re(wa)," found: another word of the name narrows them."]}):null,c&&c.searched.past===!1&&c.searched.kinds.some(a=>o.schema.tryDefinition(a)?.lifecycle)?(0,t.jsx)("p",{role:"presentation",style:st,children:"Current ones; add is:any for the past."}):null]}),b&&!ke&&q?(0,t.jsxs)("div",{role:"group","aria-label":"The one lit","data-testid":"find-panel",onMouseEnter:bt,onMouseMove:fa,style:Qt,children:[(0,t.jsx)(Lt,{row:q,schema:o.schema,accents:v?.accents,marking:Ie,q:M.trim(),flag:E}),de.length>0?(0,t.jsxs)("div",{role:"group","aria-label":"Actions",style:{display:"grid",gap:4},children:[(0,t.jsx)("div",{role:"presentation",style:{...la,padding:"10px 0 4px"},children:"Actions"}),de.map(a=>ya(a,!1))]}):null]}):null]}),e?null:(0,t.jsxs)("div",{"aria-hidden":"true",style:lr,"data-testid":"find-keys",children:[(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"\u2191"}),(0,t.jsx)("kbd",{style:fe,children:"\u2193"})," move"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"\u21B5"})," open"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"\u2192"})," actions"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"esc"})," close"]})]})]})]})}function Lt({row:e,schema:o,accents:d,marking:s,q:n,flag:w}){let v=null,g="",x,h=null;if("ask"in e)g="Ask",x=`\u2018${e.ask}\u2019`,h=(0,t.jsx)("p",{style:Y,children:"Asks it of what is selected; the answer comes on a card beside it."});else if("all"in e)v=e.all,g=_(o,e.all),x=`All ${re(e.count)} matching \u201C${n}\u201D`,h=(0,t.jsxs)("p",{style:Y,children:["Opens the ",Se(o,e.all).toLowerCase(),", narrowed by these words."]});else{let c=e.hit;switch(c.about){case"node":{v=c.kind,g=nt(Sa(o.tryDefinition(c.kind),c.kind)),x=(0,t.jsxs)(t.Fragment,{children:[c.flagged?(0,t.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[w," "]}):null,(0,t.jsx)(j,{text:c.label,words:s})]});let C=[c.apart,c.current?null:"past",c.archived?"set aside":null].filter(Boolean).join(" \xB7 ");h=(0,t.jsxs)(t.Fragment,{children:[C?(0,t.jsx)("p",{style:Y,children:nt(C)}):null,c.near?(0,t.jsxs)("p",{style:Y,children:["Near \u201C",c.why.asked,"\u201D",c.why.field!=="label"?` \u2014 ${c.why.reading.toLowerCase()}: ${c.why.fragment}`:""]}):c.why.field!=="label"?(0,t.jsxs)("p",{style:Y,children:[(0,t.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:c.why.reading}),(0,t.jsx)("br",{}),(0,t.jsx)(j,{text:c.why.fragment,words:s})]}):null]});break}case"kind":v=c.kind,g="Kind",x=c.label,h=(0,t.jsxs)("p",{style:Y,children:["Goes into the ",c.label.toLowerCase(),", all of them",c.count>0?`; ${re(c.count)} match these words`:"","."]});break;case"place":v=c.kind,g="Place",x=c.title,h=(0,t.jsxs)("p",{style:Y,children:["A picture of the ",Se(o,c.kind).toLowerCase(),"."]});break;case"rule":g="Rule",x=c.label,h=(0,t.jsx)("p",{style:Y,children:"Selects what it flags."});break;case"act":g="Act",x=c.title;break}}return(0,t.jsxs)("div",{role:"presentation","data-testid":"find-said",style:{display:"grid",gap:6},children:[(0,t.jsxs)("div",{style:{...la,padding:0},children:[v?(0,t.jsx)(lt,{kind:v,accents:d}):null,g]}),(0,t.jsx)("div",{style:Xt,children:x}),h]})}function Pt({hit:e,flag:o,words:d}){switch(e.about){case"node":return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{style:tr,children:[e.flagged?(0,t.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[o," "]}):null,(0,t.jsx)(j,{text:e.label,words:d}),e.apart?(0,t.jsxs)("span",{style:me,children:[" \xB7 ",e.apart]}):null,e.current?null:(0,t.jsx)("span",{style:me,children:" \xB7 past"})]}),e.near?(0,t.jsxs)("span",{style:{...Q,...me},"data-testid":"find-near",children:["Near \u201C",e.why.asked,"\u201D",e.why.field!=="label"?` \u2014 ${e.why.reading.toLowerCase()}: `:"",e.why.field!=="label"?(0,t.jsx)(j,{text:e.why.fragment,words:d}):null]}):e.why.field!=="label"?(0,t.jsxs)("span",{style:{...Q,...me},children:[e.why.reading.toLowerCase(),": ",(0,t.jsx)(j,{text:e.why.fragment,words:d})]}):null]});case"kind":return(0,t.jsxs)("span",{style:Q,children:[(0,t.jsx)(j,{text:e.label,words:d}),(0,t.jsxs)("span",{style:me,children:[" \xB7 ",e.count," match"]})]});case"place":return(0,t.jsxs)("span",{style:Q,children:["Go to ",(0,t.jsx)(j,{text:e.title,words:d})]});case"rule":return(0,t.jsxs)("span",{style:Q,children:["The rule \u201C",(0,t.jsx)(j,{text:e.label,words:d}),"\u201D"]});case"act":return(0,t.jsx)("span",{style:Q,children:e.title})}}function Nt(e,o){if(o.length===0)return[{text:e}];let d=[],s=0;for(let n of e.matchAll(/[\p{L}\p{N}]+/gu)){let w=n[0],v=Re(w).replace(/ /g,""),g=o.filter(c=>v.startsWith(c)).sort((c,C)=>C.length-c.length)[0];if(!g)continue;let x=v.length===w.length?g.length:w.length,h=n.index??0;h>s&&d.push({text:e.slice(s,h)}),d.push({text:w.slice(0,x),marked:!0}),s=h+x}return s<e.length&&d.push({text:e.slice(s)}),d}function j({text:e,words:o}){return(0,t.jsx)(t.Fragment,{children:Nt(e,o).map((d,s)=>d.marked?(0,t.jsx)("mark",{style:rr,children:d.text},s):(0,t.jsx)(u.Fragment,{children:d.text},s))})}function It(e){if(e.about!=="node")return"";let o=e.near?`Near \u201C${e.why.asked}\u201D`:e.why.field!=="label"?`${e.why.reading}: ${e.why.fragment}`:"";return o?`${e.label}
1132
- ${o}`:e.label}var nt=e=>e&&e[0].toUpperCase()+e.slice(1);function lt({kind:e,accents:o}){let d=Math.round($a(e,o));return(0,t.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:2,flex:"0 0 auto",background:`hsl(${d} 55% 52%)`}})}function ot(e,o){return e==="rule:"?"Rules":e==="act:"?"Acts":_(o,e)}function Ht(e,o,d){let s=Object.entries(e).map(([v,g])=>ka(d,v,g)),n=o.filter(v=>v.about==="kind"||v.about==="place"||v.about==="rule").length;n>0&&s.push(`${n} ${n===1?"place or rule":"places and rules"}`);let w=o.filter(v=>v.about==="node"&&v.near).length;return s.length===0?"Nothing found":`${s.join(", ")} found${w>0?`, ${w} of them near`:""}`}var Ot=10,Dt=12,Wt=5,Bt=6,Kt=140,Ft=760,qt="15.5rem",_t={...La,flexDirection:"column",width:"min(26rem, calc(100vw - 24px))",maxHeight:"min(64vh, 30rem)",overflow:"hidden",boxSizing:"border-box",background:"linear-gradient(var(--graview-panel), var(--graview-panel)) var(--graview-ground, var(--graview-panel))",borderTop:"1px solid var(--graview-edge)",borderRight:"1px solid var(--graview-edge)",borderBottom:"1px solid var(--graview-edge)",borderLeft:"1px solid var(--graview-edge)",borderRadius:10,boxShadow:"0 10px 28px rgb(0 0 0 / 0.18)",padding:0},Gt={width:"min(42rem, calc(100vw - 24px))"},Ut=6,Vt={width:"var(--graview-bar-width, 100vw)",maxHeight:"55vh",borderRadius:0,borderLeft:"none",borderRight:"none"},Yt={display:"grid",gridTemplateRows:"minmax(0, 1fr)",flex:"1 1 auto",minHeight:0},jt={overflowY:"auto",overflowX:"hidden",minHeight:0,padding:"4px 0",overscrollBehavior:"contain"},Qt={overflowY:"auto",minHeight:0,padding:"12px 14px",borderLeft:"1px solid var(--graview-edge)",background:"var(--graview-panel-muted)",display:"flex",flexDirection:"column",gap:4},Xt={fontWeight:600,fontSize:"0.9375rem",lineHeight:1.35,color:"var(--graview-ink)",overflowWrap:"anywhere"},Y={margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)",overflowWrap:"anywhere"},la={display:"flex",alignItems:"center",gap:6,padding:"10px 12px 4px",fontSize:"0.6875rem",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},Jt={marginLeft:"auto",fontWeight:400,letterSpacing:0,fontVariantNumeric:"tabular-nums",color:"var(--graview-ink-faint)"},Zt={position:"relative",display:"grid",gap:1,minHeight:34,padding:"5px 12px",alignContent:"center",cursor:"pointer",fontSize:"0.875rem",lineHeight:1.35,color:"var(--graview-ink)",minWidth:0},er={background:"color-mix(in srgb, var(--graview-accent) 12%, var(--graview-panel))",boxShadow:"inset 3px 0 0 var(--graview-accent)"},ar={color:"var(--graview-accent)",fontSize:"0.8125rem",minHeight:30},Q={display:"block",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},tr={display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,minWidth:0,overflow:"hidden",overflowWrap:"anywhere",fontWeight:600},me={color:"var(--graview-ink-muted)",fontSize:"0.8125rem",fontWeight:400},rr={background:"color-mix(in srgb, var(--graview-accent) 24%, transparent)",color:"inherit",borderRadius:2,padding:0,boxShadow:"0 1px 0 color-mix(in srgb, var(--graview-accent) 70%, transparent)"},ct={display:"flex",alignItems:"center",minHeight:32,padding:"4px 10px",boxSizing:"border-box",borderWidth:1,borderStyle:"solid",borderColor:"var(--graview-edge)",borderRadius:6,background:"var(--graview-panel)",color:"var(--graview-ink)",fontSize:"0.8125rem",lineHeight:1.3,cursor:"pointer",overflowWrap:"anywhere"},ir={...ct,minHeight:32,margin:"0 12px 4px 24px"},nr={borderColor:"var(--graview-accent)",boxShadow:"inset 0 0 0 1px var(--graview-accent)",background:"color-mix(in srgb, var(--graview-accent) 12%, var(--graview-panel))"},or={display:"grid",padding:"2px 0 6px"},sr={position:"absolute",top:"50%",right:6,transform:"translateY(-50%)",width:36,height:32,display:"grid",placeItems:"center",borderRadius:6,color:"var(--graview-ink-muted)",borderWidth:1,borderStyle:"solid",borderColor:"transparent"},dr={color:"var(--graview-accent)",borderColor:"var(--graview-edge)",background:"var(--graview-panel)"},st={margin:0,padding:"6px 12px 4px",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},lr={display:"flex",flexWrap:"wrap",gap:"4px 14px",padding:"7px 12px",borderTop:"1px solid var(--graview-edge)",color:"var(--graview-ink-faint)",fontSize:"0.75rem",flex:"0 0 auto"},fe={display:"inline-block",minWidth:16,padding:"0 4px",marginRight:3,border:"1px solid var(--graview-edge)",borderRadius:4,font:"inherit",fontSize:"0.6875rem",lineHeight:"16px",textAlign:"center",color:"var(--graview-ink-muted)",background:"var(--graview-panel)"};var oe=m(G(),1);var ca=m($t(),1);var gt=m($(),1);function pt(){let{following:e,follow:o}=T();return e?(0,gt.jsxs)("button",{type:"button","data-testid":"following-who",onClick:()=>o(null),title:"Press, or Escape, to stop following",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,padding:"2px 9px",borderRadius:999,border:"1px solid var(--graview-accent)",background:"transparent",color:"var(--graview-accent)",fontSize:"0.875rem",whiteSpace:"nowrap"},children:["following ",e.name]}):null}var vt=m(G(),1);var A=m($(),1);function ut({home:e,homeLabel:o,children:d,onPicture:s=!1}){let{view:n,focus:w,show:v,go:g}=U(),{store:x}=T(),{movedByHand:h}=T(),c=h&&(n.pan!==void 0||Object.keys(n.pins).length>0),C=n.focusId&&n.focusId!==e?x.graph.getNode(n.focusId):void 0,E=z=>_(x.schema,z),b={display:"inline-flex",alignItems:"center",gap:6,minHeight:26,padding:"2px 6px",fontSize:"0.8125rem",borderRadius:6,border:"1px solid transparent",boxShadow:"none",background:"transparent",color:"var(--graview-ink-muted)",whiteSpace:"nowrap"},R=o!==void 0&&C!==void 0,N=[];if(C&&!s&&N.push({key:"focused",node:(0,A.jsxs)("button",{type:"button","data-testid":"focused",onClick:()=>g(Fe({...n,focusId:e},!1)),title:Ge(x,C.id),style:{...b,maxWidth:"min(14rem, 15vw)"},children:[(0,A.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:Ge(x,C.id)}),(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),n.past&&N.push({key:"past",node:(0,A.jsxs)("button",{type:"button","data-testid":"past",onClick:()=>g(Ya(n,!1)),title:"Back to now \u2014 retired things leave the picture again",style:b,children:["the past",(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),n.zoom&&N.push({key:"zoomed",node:(0,A.jsxs)("button",{type:"button","data-testid":"zoomed",onClick:()=>g(Fe(n,!1)),title:"Zoom back out",style:b,children:["zoomed in",(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),c&&N.push({key:"moved",node:(0,A.jsx)("button",{type:"button","data-testid":"moved",onClick:()=>g(Ke(n)),title:"Put the camera and everything you dragged back where the layout wanted them",style:b,children:"Reset view"})}),n.relation){let z=n.relation;N.push({key:"raised",node:(0,A.jsxs)("span",{style:{display:"inline-flex",alignItems:"center"},children:[(0,A.jsxs)("button",{type:"button","data-testid":"raised-into",onClick:()=>g(ue(n,ve(z),{ownPicture:!0})),title:`Go into the ${E(z).toLowerCase()}`,"aria-label":`Go into the ${E(z).toLowerCase()}`,style:{...b,color:"var(--graview-ink)"},children:[E(z),(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\u2198"})]}),(0,A.jsx)("button",{type:"button","data-testid":"raised",onClick:()=>v(null),title:`Stop showing ${E(z).toLowerCase()}`,"aria-label":`Stop showing ${E(z).toLowerCase()}`,style:{...b,minWidth:26,justifyContent:"center"},children:(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})})]})})}return s&&!R&&N.length===0&&d===void 0?null:(0,A.jsxs)("nav",{"aria-label":"View","data-testid":"trail",style:{display:"flex",alignItems:"center",gap:8,fontSize:"0.875rem",minWidth:0,...s?{pointerEvents:"auto",padding:"4px 6px",borderRadius:8,background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",overflow:"hidden"}:{}},children:[R?(0,A.jsx)("button",{type:"button",onClick:()=>w(e),style:{border:"none",background:"none",padding:"3px 0",minHeight:24,whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:o}):null,N.map(({key:z,node:B},Le)=>(0,A.jsxs)(vt.Fragment,{children:[R||Le>0?(0,A.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:"\u203A"}):null,B]},z)),d]})}var P=m($(),1);function pa(){let[e,o]=(0,oe.useState)([]),d=(0,oe.useCallback)(s=>{o(n=>{let w=s.phase!=="running"&&n[0]?.name===s.name&&n[0]?.at===s.at;return[s,...w?n.slice(1):n].slice(0,12)})},[]);return[e,d]}function ga({find:e,calls:o,seat:d,remembers:s=!1}){return e?(0,P.jsxs)(P.Fragment,{children:[(0,ca.createPortal)((0,P.jsx)(dt,{compact:e.compact}),e.slot),e.own?(0,ca.createPortal)((0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(oe.Suspense,{fallback:null,children:(0,P.jsx)(rt,{})}),(0,P.jsx)(Wa,{calls:o,remembers:s,...d!==void 0?{seat:d}:{}})]}),e.own):null]}):null}function va({home:e=null}){return(0,P.jsxs)("div",{"data-graview-scene-trail":"",style:{position:"absolute",top:14,left:14,maxWidth:"calc(100% - 150px - var(--graview-dock, 0px))",zIndex:D("overview"),display:"flex",alignItems:"center",gap:6,minWidth:0,pointerEvents:"none"},children:[(0,P.jsx)(ut,{home:e,onPicture:!0}),(0,P.jsx)("span",{style:{pointerEvents:"auto"},children:(0,P.jsx)(pt,{})})]})}var X=m(G(),1);var wt=m($(),1),cr=ie(()=>(__graviewPreload(import.meta.url,["./chunk.Q355UPFG.js","./chunk.6IUEGPCZ.js","./chunk.CUJX3IVA.js","./chunk.VNJKGSGZ.js","./chunk.SDO3U72B.js","./chunk.X3MMJ3QC.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.U5PX2ECA.js")));function ua(){let{store:e,principal:o}=T(),d=(0,X.useContext)(Ba),s=(0,X.useRef)(null),n=(0,X.useRef)(!1);return(0,X.useEffect)(()=>()=>void(n.current=!0),[]),(0,X.useEffect)(()=>{let w=e.batches().length,v=cr().then(g=>g.sceneWay(e,o,d,w,s.current),()=>{});return()=>void v.then(g=>g?.(n.current))},[e,o,d]),(0,wt.jsx)("span",{ref:s,hidden:!0})}var mt=m(G(),1);var y=m($(),1);function qi({address:e=!1,auto:o,quickAsk:d=!0,scheme:s,scope:n}){let w=(0,mt.useMemo)(()=>`${ta({scope:`.${n}`})}
1131
+ }`}function ra(e="dark",o={}){let d=At(e);return o.scope===void 0?d:Ea(d,o.scope)}var O=m(G(),1);var V=m($(),1),Ct=Ee(ie(()=>(__graviewPreload(import.meta.url,["./chunk.WC3DENU4.js","./chunk.VNDKKTED.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.NC7FXY2H.js")))).part(e=>(0,V.jsx)(e.MapKey,{}),{quiet:!0});function ia(){let{store:e}=T(),{view:o}=U(),d=Ce(),s=(0,O.useMemo)(()=>e.graph.allEdges().length>0,[e,d]),[n,w]=(0,O.useState)(!1),v=(0,O.useId)(),g=(0,O.useRef)(null),x=(0,O.useRef)(null);return(0,O.useEffect)(()=>{if(!n)return;let h=c=>{let C=c.target;C&&(x.current?.contains(C)||g.current?.contains(C))||w(!1)};return document.addEventListener("pointerdown",h,!0),()=>document.removeEventListener("pointerdown",h,!0)},[n]),s?(0,V.jsxs)("div",{style:{display:"contents"},onKeyDown:h=>{h.key!=="Escape"||!n||(h.preventDefault(),h.stopPropagation(),w(!1),g.current?.focus({preventScroll:!0}))},children:[(0,V.jsx)("button",{ref:g,type:"button","data-testid":"lines-key","aria-expanded":n,"aria-controls":v,title:"What the lines mean",onClick:()=>w(h=>!h),style:{position:"absolute",top:60,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("overview"),height:30,padding:"0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.8125rem",color:n?"var(--graview-accent)":"var(--graview-ink-muted)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Key"}),n?(0,V.jsxs)("div",{ref:x,id:v,"data-testid":"lines-key-pane","data-graview-offstage":"",style:{position:"absolute",top:98,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("rail"),width:tt,maxHeight:"calc(100cqh - 120px)",overflowY:"auto",boxSizing:"border-box",padding:"8px 8px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[o.overview?(0,V.jsx)(Ct,{}):null,(0,V.jsx)(at,{inside:!0,widthOf:Xa})]}):null]}):null}var ze=m(G(),1),Te=m($(),1);function it(e){return e.lens!==null?{what:"lens",kind:e.lens}:e.records.length===1&&e.districts.length===0?{what:"record",id:e.records[0]}:e.districts.length===1&&e.records.length===0?{what:"district",kind:e.districts[0]}:null}var Et=Ee(ie(()=>(__graviewPreload(import.meta.url,["./chunk.QI4SLPQ4.js","./chunk.7MHCGVGM.js","./chunk.FRYBMS3W.js","./chunk.3MOJF7BA.js","./chunk.LZIBQ3VX.js","./chunk.HJCQ6I3S.js","./chunk.QDSEVPF3.js","./chunk.7N32AVIJ.js","./chunk.3XGA65Y3.js","./chunk.BYKD5RLA.js","./chunk.2K4TT2BV.js","./chunk.VUBNBTJP.js","./chunk.OLFJH4RK.js","./chunk.67U6M7OV.js","./chunk.ZP5RT2EK.js","./chunk.VZJWJ5XM.js","./chunk.VFOON3Z3.js","./chunk.WVUJXDXZ.js","./chunk.7VKSXGTX.js","./chunk.TY4GQJKC.js","./chunk.6ZQAR5ZA.js","./chunk.W3W54DSX.js","./chunk.PI44XMY2.js","./chunk.KGW75Z5L.js","./chunk.GZHZLJBF.js","./chunk.IOK4GVJC.js","./chunk.OJGHDWI6.js","./chunk.TLJOZSDD.js","./chunk.MSWWWLEA.js","./chunk.UITT6JWW.js","./chunk.A5PDXNY6.js","./chunk.WC3DENU4.js","./chunk.VNDKKTED.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.QBLKTFF4.js")))),Rt=Et.part((e,o)=>(0,Te.jsx)(e.MapPanelFor,{showing:o.showing}),{what:"This panel",quiet:!0});function na(){let{store:e,view:o,selection:d,hiddenKinds:s,seatTalk:n}=T();Ce();let w=(0,ze.useSyncExternalStore)(n.subscribe,()=>n.get().draft!==null,()=>!1);if(!o.overview||w)return null;let v=it(ja(d,{...o,beside:!0},g=>e.graph.getNode(g)?.kind));return!v||v.what!=="record"&&(s.has(v.kind)||!e.schema.kinds.includes(v.kind))?null:(0,Te.jsx)(ze.Suspense,{fallback:null,children:(0,Te.jsx)(Rt,{showing:v})})}var Tt=m(G(),1);var W=m($(),1);function oa(){let{view:e,go:o}=U(),{store:d,views:s,hiddenKinds:n}=T(),w=e.overview??!1,v=s.places().map(E=>E.kind).filter(E=>!n.has(E)),g=Fa(e,d.schema.kinds,v),x=()=>{o($e(ee(e,!1),g))},h=(()=>{if(!g)return null;let E=Aa(g)[0],b=e.within?.view,R=(b?s.places().find(N=>N.as===b):void 0)??(E?s.places().filter(N=>N.kind===E).at(-1):void 0);return R?R.title:E?_(d.schema,E):d.graph.getNode(g)?.label??null})(),c=w?"Close the map":"Up",C=w&&h?`Close the map, down to ${h}`:c;return(0,W.jsxs)("button",{type:"button","data-testid":"overview",className:"graview-altitude-control","aria-pressed":w,"aria-label":C,title:w?C:"Up \u2014 the whole thing, from above",onClick:()=>w?x():o(ee(e,!0)),style:{position:"absolute",top:14,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("overview"),display:"inline-flex",alignItems:"center",justifyContent:"center",gap:7,height:38,padding:"0 13px 0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.875rem",whiteSpace:"nowrap",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)","--graview-altitude":w?1:0,...w?{color:"var(--graview-accent)"}:{}},children:[(0,W.jsxs)("svg",{className:"graview-altitude-mark",width:"16",height:"16",viewBox:"0 0 12 12","aria-hidden":"true",children:[(0,W.jsx)("ellipse",{className:"graview-altitude-mark-ring",cx:"6",cy:"6.6",rx:"5",ry:"2.6",fill:"none",stroke:"currentColor",strokeWidth:"0.9"}),(0,W.jsx)("circle",{className:"graview-altitude-mark-apex",cx:"6",cy:"4",r:"1.5",fill:"currentColor"}),(0,W.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"left",cx:"1.6",cy:"7.4",r:"1.2",fill:"currentColor"}),(0,W.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"right",cx:"10.4",cy:"7.4",r:"1.2",fill:"currentColor"})]}),(0,W.jsx)("span",{className:"graview-altitude-label",children:c})]})}var sa=m($(),1);function da(){let{administered:e}=T(),{view:o,go:d}=U(),s=e.filter(n=>n.canShow);return s.length===0?null:(0,sa.jsx)("div",{role:"group","aria-label":"Administered","data-testid":"administered",style:{display:"flex",gap:6},children:s.map(n=>(0,sa.jsx)("button",{type:"button","aria-pressed":n.shown,"data-testid":`show-${n.name}`,title:n.shown?`Hide the ${n.name}'s own districts again`:n.description??`Show the ${n.name}'s own districts beside the domain`,onClick:()=>d(Ua(o,n.name,!n.shown)),style:{padding:"3px 11px",borderRadius:999,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:n.shown?"var(--graview-accent)":"var(--graview-edge)",color:n.shown?"var(--graview-accent)":"var(--graview-ink-muted)",background:n.shown?"var(--graview-panel)":"transparent"},children:n.shown?`Hide the ${n.name}`:`Show the ${n.name}`},n.name))})}var u=m(G(),1);var t=m($(),1);Ra({search:_a,touchWeights:qa});var ne=e=>e!==void 0&&"act"in e,Me=e=>e!==void 0&&"hit"in e&&e.hit.about==="node"?e:void 0,zt=e=>e.about==="rule"?"rule:":e.about==="act"?"act:":e.kind;function Mt(e){let o=()=>typeof window>"u"||window.innerWidth>=Ft,[d,s]=(0,u.useState)(o);return(0,u.useEffect)(()=>{let n=()=>s(o());return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),d&&!e}function dt({compact:e=!1}){let{store:o,view:d,setView:s,principal:n,setMenuAt:w,brand:v,aiDesk:g,selection:x}=T(),h=Ia(g),c=Ta(),C=Ma(),E=Da().marks.flag,b=Mt(e),R=(0,u.useRef)(null),N=(0,u.useRef)(null),z=(0,u.useRef)(null),B=(0,u.useId)(),[Le,I]=(0,u.useState)(!1),[K,se]=(0,u.useState)(null),[ft,he]=(0,u.useState)(null),[Pe,be]=(0,u.useState)([]),M=d.q??"";(0,u.useEffect)(()=>{let a=r=>{if(r.defaultPrevented)return;let i=r.key.toLowerCase()==="k"&&(r.metaKey||r.ctrlKey)&&!r.altKey&&!r.shiftKey,l=r.key==="/"&&!r.metaKey&&!r.ctrlKey&&!r.altKey;if(!i&&!l)return;let p=R.current;if(!p)return;let f=p.closest("[data-graview-embed]"),S=r.target,J=S===document.body||S===document.documentElement||S===window;if(f&&!(i&&J||S instanceof Node&&f.contains(S)))return;let Z=document.activeElement,ge=Z instanceof HTMLInputElement||Z instanceof HTMLTextAreaElement||Z instanceof HTMLSelectElement||Z instanceof HTMLElement&&Z.isContentEditable;l&&ge||(r.preventDefault(),p.getClientRects().length===0&&p.closest("[data-graview-app-bar]")?.querySelector('[data-testid="app-find-open"]')?.click(),p.focus({preventScroll:!0}),p.select(),I(!0))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]);let Ne=(0,u.useMemo)(()=>{let a=new Map;for(let[i,l]of(c?.hits??[]).entries()){if(l.about==="act")continue;let p=zt(l),f=a.get(p)??[];f.push({id:`${B}-${i}`,hit:l}),a.set(p,f)}let r=[...a.values()].filter(i=>i.some(l=>l.hit.about==="node")).length>1;return[...a.entries()].map(([i,l])=>{let p=0,f=l.filter(ge=>ge.hit.about!=="node"||!r||++p<=Wt),S=f.filter(ge=>ge.hit.about==="node").length,J=i.endsWith(":")?l.length:c?.byKind[i]??S,Z=!i.endsWith(":")&&S>0&&J>S?{id:`${B}-all-${i}`,all:i,count:J}:null;return{key:i,rows:f,count:J,more:Z}})},[c,B]),ae=h&&M.trim()?{id:`${B}-ask`,ask:M.trim()}:null,k=(0,u.useMemo)(()=>[...Ne.flatMap(a=>a.more?[...a.rows,a.more]:a.rows),...ae?[ae]:[]],[Ne,ae?.ask]),wa=(c?.hits??[]).filter(a=>a.about==="node").length,xe=c?.words??M,Ie=(0,u.useMemo)(()=>Re(xe).split(" ").filter(Boolean),[xe]),F=(0,u.useCallback)(a=>a.hit.about==="node"?Ga(o,a.hit.id,xe,{principal:n,limit:Bt}).map((r,i)=>({id:`${a.id}-act-${i}`,act:r,of:a.id})):[],[o,xe,n]),He=k.find(a=>a.id===K),q=k.find(a=>a.id===ft)??He??k[0],de=(0,u.useMemo)(()=>b&&Me(q)?F(q):[],[b,q?.id,F]),ye=(0,u.useMemo)(()=>b?new Map:new Map(Pe.flatMap(a=>{let r=Me(k.find(i=>i.id===a));return r?[[a,F(r)]]:[]})),[b,Pe,k,F]),ht=(0,u.useMemo)(()=>b?new Set:new Set(k.flatMap(a=>Me(a)&&F(a).length>0?[a.id]:[])),[b,k,F]),Oe=(0,u.useMemo)(()=>b?de:[...ye.values()].flat(),[b,de,ye]),L=He??Oe.find(a=>a.id===K)??k[0];(0,u.useEffect)(()=>{se(null),he(null),be([])},[M]);let le=(0,u.useRef)(null);(0,u.useEffect)(()=>{let a=le.current;if(!a)return;le.current=null;let r=0,i=()=>{let l=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`),p=document.activeElement;if(!(!p||p===document.body||p===document.documentElement||p===R.current||p===z.current||p===l))return;let S=[...l?.querySelectorAll('[role="group"][aria-label="Arrange"] :is(button, input)')??[]].find(J=>J.checkVisibility?.()??!0);if(S)return S.focus({preventScroll:!0});l&&l.tabIndex>=0&&p!==l&&l.focus({preventScroll:!0}),++r<240?requestAnimationFrame(i):document.activeElement===z.current&&z.current?.blur()};requestAnimationFrame(i)},[d]);let De=(a,r)=>{let i=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`);if(i&&i.tabIndex>=0)return i.focus({preventScroll:!0});let l=z.current;if(!l)return R.current?.blur();l.setAttribute("aria-label",r),l.focus({preventScroll:!0})},ma=(0,u.useRef)({x:Number.NaN,y:Number.NaN,moved:!1});(0,u.useEffect)(()=>{let a=r=>{let i=ma.current;i.moved=r.clientX!==i.x||r.clientY!==i.y,i.x=r.clientX,i.y=r.clientY};return window.addEventListener("mousemove",a,{capture:!0,passive:!0}),()=>window.removeEventListener("mousemove",a,{capture:!0})},[]);let ce=(0,u.useRef)(void 0);(0,u.useEffect)(()=>()=>clearTimeout(ce.current),[]);let te=a=>{a&&(clearTimeout(ce.current),se(a.id),ne(a)||he(a.id))},fa=a=>{if(!ma.current.moved)return;let r=a.target.closest?.('[role="option"]')?.id;if(!r||r===K)return;let i=k.find(l=>l.id===r)??Oe.find(l=>l.id===r);i&&(se(i.id),!ne(i)&&(clearTimeout(ce.current),ce.current=setTimeout(()=>he(i.id),Kt)))},bt=()=>{clearTimeout(ce.current),q&&!ne(L)&&se(q.id)},xt=a=>be(r=>r.includes(a.id)?r.filter(i=>i!==a.id):[...r,a.id]),ha=a=>{let r=N.current,i=r?.querySelector('[role="option"]')?.getBoundingClientRect().height??0,l=r?.clientHeight??0;return Math.min(a,i>0&&l>0?Math.max(1,Math.floor(l/i)-1):Ot)};(0,u.useEffect)(()=>{K&&document.getElementById(K)?.scrollIntoView?.({block:"nearest"})},[K]);let We=a=>{if(!a)return;if("ask"in a){Na(g,{pointed:{...x[0]!==void 0?{on:x[0]}:{},about:x},asked:a.ask}),s(i=>Ye(i)),I(!1);return}if("all"in a)return s(i=>ue(ee(i,!1),ve(a.all),{ownPicture:!0,...i.q?{carry:i.q}:{}})),le.current=a.all,I(!1),De(a.all,`Opening ${_(o.schema,a.all)} matching \u201C${M.trim()}\u201D\u2026`);if(ne(a)){let i=a.act.subject;s(p=>Ae(p,[i]));let l=R.current?.getBoundingClientRect();w({x:l?.left??0,y:(l?.bottom??0)+6,on:i}),I(!1),R.current?.blur();return}let r=a.hit;switch(r.about){case"node":s(i=>Ae($e(ee(i,!1),r.id),[r.id]));break;case"kind":return s(i=>ue(ee(i,!1),ve(r.kind),{ownPicture:!0})),le.current=r.kind,I(!1),De(r.kind,`Opening ${r.label}\u2026`);case"place":return s(i=>Ca(i,r.kind,r.as)),le.current=r.kind,I(!1),De(r.kind,`Opening ${r.title}\u2026`);case"rule":{let i=C.filter(l=>l.invariant===r.name).flatMap(l=>l.nodeIds);s(l=>Ae(l,[...new Set(i)]));break}case"act":break}I(!1),R.current?.blur()},yt=c?Ht(c.byKind,c.hits,o.schema):"",pe=Le&&M.trim().length>0,kt=(0,u.useCallback)(()=>{let a=R.current?.closest("[data-graview-app-bar]")?.getBoundingClientRect();if(a)return{x:a.right,y:a.bottom-Ut};let r=R.current?.getBoundingClientRect();return r?{x:r.right,y:r.bottom}:null},[]),ba=Pa("find",{open:pe,onOpenChange:a=>{a||I(!1)},...e?{at:kt}:{}}),ke=k.every(a=>"ask"in a),xa=a=>ne(a)?Oe.filter(r=>r.of===a.of):[],St=a=>{let r=ne(L)&&K!==null,i=r?k.find(p=>p.id===L.of):K!==null?He:void 0,l=i?k.indexOf(i):-1;if(a.key==="ArrowDown"){if(a.preventDefault(),I(!0),r){let p=xa(L),f=p.indexOf(L)+1;if(f<p.length)return te(p[f]);if(b)return}te(k[Math.min(k.length-1,l+1)])}else if(a.key==="ArrowUp"){if(a.preventDefault(),r){let p=xa(L),f=p.indexOf(L)-1;return te(f>=0?p[f]:i)}te(k[Math.max(0,l-1)])}else if((a.key==="PageDown"||a.key==="PageUp")&&k.length>0){a.preventDefault(),I(!0);let p=a.key==="PageDown"?ha(k.length):-ha(k.length);te(k[Math.min(k.length-1,Math.max(0,(l<0?-1:l)+p))])}else if(a.key==="ArrowRight"&&!r&&Me(L)){let p=L,f=b?p.id===q?.id?de:F(p):ye.get(p.id)??F(p);if(f.length===0)return;a.preventDefault(),!b&&!Pe.includes(p.id)&&be(S=>[...S,p.id]),he(p.id),se(f[0].id)}else if(a.key==="ArrowLeft"&&r){a.preventDefault();let p=L.of;b||be(f=>f.filter(S=>S!==p)),te(k.find(f=>f.id===p))}else a.key==="Enter"?(a.preventDefault(),We(L)):a.key==="Escape"&&(a.preventDefault(),M?s(p=>Ye(p)):R.current?.blur())},Be=(a,r,i={},l={})=>{let p=a.id===L?.id;return(0,t.jsx)("div",{id:a.id,role:"option","aria-selected":p,onClick:()=>We(a),style:{...Zt,...p?er:null,...i},...l,children:r},a.id)},ya=(a,r)=>{let i=a.id===L?.id;return(0,t.jsx)("div",{id:a.id,role:"option","aria-selected":i,"data-testid":"find-act","data-about":"act",onClick:()=>We(a),style:{...r?ir:ct,...i?nr:null,...a.act.destructive?{color:"var(--graview-warn)"}:null},children:a.act.title},a.id)};return(0,t.jsxs)("div",{style:{position:"relative",minWidth:0,flex:"1 1 auto"},"data-testid":"find",children:[(0,t.jsx)("input",{ref:a=>{R.current=a,ba.trigger.ref(a)},"data-graview-popover-trigger":"find",type:"search",role:"combobox","aria-label":"Find anything","aria-expanded":pe,"aria-controls":B,"aria-autocomplete":"list",...pe&&L?{"aria-activedescendant":L.id}:{},"data-testid":"find-box",placeholder:"Find\u2026","aria-keyshortcuts":"/ Meta+K Control+K",value:M,onChange:a=>{let r=a.target.value;I(!0),s(i=>Va(i,r.length>0?r:null))},onFocus:()=>I(!0),onBlur:()=>I(!1),onKeyDown:St,style:{width:"100%",boxSizing:"border-box",minWidth:0,height:30,padding:"0 var(--graview-bar-find-end, 10px) 0 10px",font:"inherit",fontSize:"0.875rem",color:"var(--graview-ink)",background:"var(--graview-panel)",border:`1px solid ${M?"var(--graview-accent)":"var(--graview-edge)"}`,borderRadius:8}}),(0,t.jsx)("span",{role:"status","aria-live":"polite",style:qe,"data-testid":"find-count",children:M.trim()?yt:""}),(0,t.jsx)("span",{ref:z,tabIndex:-1,role:"status",style:qe,"data-testid":"find-landing"}),(0,t.jsxs)("div",{...ba.pane,id:B,role:"listbox","aria-label":M?`What \u201C${M}\u201D finds`:"What the words find","data-testid":"find-strip","data-graview-find":b?"panel":"narrow",hidden:!pe,onMouseDown:a=>a.preventDefault(),style:{..._t,...e?Vt:b&&!ke?Gt:null,...pe?{display:"flex"}:null},children:[(0,t.jsxs)("div",{style:{...Yt,gridTemplateColumns:b&&!ke?`minmax(0, 1fr) ${qt}`:"minmax(0, 1fr)"},children:[(0,t.jsxs)("div",{ref:N,role:"presentation","data-testid":"find-list",onMouseMove:fa,style:jt,children:[ke?(0,t.jsxs)("p",{role:"presentation",style:{margin:0,padding:"10px 12px",color:"var(--graview-ink-muted)",fontSize:"0.875rem"},"data-testid":"find-nothing",children:["Nothing here is called \u201C",c?.words||M,"\u201D."]}):Ne.map(a=>(0,t.jsxs)("div",{role:"group","aria-label":ot(a.key,o.schema),children:[(0,t.jsxs)("div",{role:"presentation",style:la,children:[a.key!=="rule:"&&a.key!=="act:"?(0,t.jsx)(lt,{kind:a.key,accents:v?.accents}):null,(0,t.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ot(a.key,o.schema)}),(0,t.jsx)("span",{"aria-hidden":"true",style:Jt,"data-testid":"find-group-count",children:re(a.count)})]}),a.rows.map(r=>{let i=r.hit,l=i.about==="node"?i:null,p=!b&&l!==null&&ht.has(r.id),f=ye.get(r.id);return(0,t.jsxs)(u.Fragment,{children:[Be(r,(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Pt,{hit:i,flag:E,words:l?.near&&l.why.matched?[...Ie,Re(l.why.matched)]:Ie}),p?(0,t.jsx)("span",{"aria-hidden":"true","data-testid":"find-acts-open","data-open":f?"":void 0,title:f?"Put its actions away":"Actions",onClick:S=>{S.stopPropagation(),xt(r)},style:{...sr,...f?dr:null},children:(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"3.5",cy:"8",r:"1.4",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"1.4",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"12.5",cy:"8",r:"1.4",fill:"currentColor"})]})}):null]}),p?{paddingRight:48}:{},{"data-testid":"find-hit","data-about":i.about,...l?.near?{"data-near":""}:{},title:It(i)}),f?(0,t.jsx)("div",{role:"group","aria-label":`What can be done about ${l?.label??"it"}`,style:or,children:f.map(S=>ya(S,!0))}):null]},r.id)}),a.more?Be(a.more,(0,t.jsxs)("span",{style:Q,children:["All ",re(a.more.count)," ",Se(o.schema,a.more.all).toLowerCase()," matching \u201C",M.trim(),"\u201D"]}),ar,{"data-testid":"find-all","data-about":"all"}):null]},a.key)),ae?Be(ae,(0,t.jsxs)("span",{style:Q,children:["Ask: ",(0,t.jsxs)("span",{style:{fontWeight:600},children:["\u2018",ae.ask,"\u2019"]})]}),{borderTop:"1px solid var(--graview-edge)",marginTop:4},{"data-testid":"find-ask"}):null,wa>Dt?(0,t.jsxs)("p",{role:"presentation",style:st,"data-testid":"find-more-words",children:[re(wa)," found: another word of the name narrows them."]}):null,c&&c.searched.past===!1&&c.searched.kinds.some(a=>o.schema.tryDefinition(a)?.lifecycle)?(0,t.jsx)("p",{role:"presentation",style:st,children:"Current ones; add is:any for the past."}):null]}),b&&!ke&&q?(0,t.jsxs)("div",{role:"group","aria-label":"The one lit","data-testid":"find-panel",onMouseEnter:bt,onMouseMove:fa,style:Qt,children:[(0,t.jsx)(Lt,{row:q,schema:o.schema,accents:v?.accents,marking:Ie,q:M.trim(),flag:E}),de.length>0?(0,t.jsxs)("div",{role:"group","aria-label":"Actions",style:{display:"grid",gap:4},children:[(0,t.jsx)("div",{role:"presentation",style:{...la,padding:"10px 0 4px"},children:"Actions"}),de.map(a=>ya(a,!1))]}):null]}):null]}),e?null:(0,t.jsxs)("div",{"aria-hidden":"true",style:lr,"data-testid":"find-keys",children:[(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"\u2191"}),(0,t.jsx)("kbd",{style:fe,children:"\u2193"})," move"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"\u21B5"})," open"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"\u2192"})," actions"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:fe,children:"esc"})," close"]})]})]})]})}function Lt({row:e,schema:o,accents:d,marking:s,q:n,flag:w}){let v=null,g="",x,h=null;if("ask"in e)g="Ask",x=`\u2018${e.ask}\u2019`,h=(0,t.jsx)("p",{style:Y,children:"Asks it of what is selected; the answer comes on a card beside it."});else if("all"in e)v=e.all,g=_(o,e.all),x=`All ${re(e.count)} matching \u201C${n}\u201D`,h=(0,t.jsxs)("p",{style:Y,children:["Opens the ",Se(o,e.all).toLowerCase(),", narrowed by these words."]});else{let c=e.hit;switch(c.about){case"node":{v=c.kind,g=nt(Sa(o.tryDefinition(c.kind),c.kind)),x=(0,t.jsxs)(t.Fragment,{children:[c.flagged?(0,t.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[w," "]}):null,(0,t.jsx)(j,{text:c.label,words:s})]});let C=[c.apart,c.current?null:"past",c.archived?"set aside":null].filter(Boolean).join(" \xB7 ");h=(0,t.jsxs)(t.Fragment,{children:[C?(0,t.jsx)("p",{style:Y,children:nt(C)}):null,c.near?(0,t.jsxs)("p",{style:Y,children:["Near \u201C",c.why.asked,"\u201D",c.why.field!=="label"?` \u2014 ${c.why.reading.toLowerCase()}: ${c.why.fragment}`:""]}):c.why.field!=="label"?(0,t.jsxs)("p",{style:Y,children:[(0,t.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:c.why.reading}),(0,t.jsx)("br",{}),(0,t.jsx)(j,{text:c.why.fragment,words:s})]}):null]});break}case"kind":v=c.kind,g="Kind",x=c.label,h=(0,t.jsxs)("p",{style:Y,children:["Goes into the ",c.label.toLowerCase(),", all of them",c.count>0?`; ${re(c.count)} match these words`:"","."]});break;case"place":v=c.kind,g="Place",x=c.title,h=(0,t.jsxs)("p",{style:Y,children:["A picture of the ",Se(o,c.kind).toLowerCase(),"."]});break;case"rule":g="Rule",x=c.label,h=(0,t.jsx)("p",{style:Y,children:"Selects what it flags."});break;case"act":g="Act",x=c.title;break}}return(0,t.jsxs)("div",{role:"presentation","data-testid":"find-said",style:{display:"grid",gap:6},children:[(0,t.jsxs)("div",{style:{...la,padding:0},children:[v?(0,t.jsx)(lt,{kind:v,accents:d}):null,g]}),(0,t.jsx)("div",{style:Xt,children:x}),h]})}function Pt({hit:e,flag:o,words:d}){switch(e.about){case"node":return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{style:tr,children:[e.flagged?(0,t.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[o," "]}):null,(0,t.jsx)(j,{text:e.label,words:d}),e.apart?(0,t.jsxs)("span",{style:me,children:[" \xB7 ",e.apart]}):null,e.current?null:(0,t.jsx)("span",{style:me,children:" \xB7 past"})]}),e.near?(0,t.jsxs)("span",{style:{...Q,...me},"data-testid":"find-near",children:["Near \u201C",e.why.asked,"\u201D",e.why.field!=="label"?` \u2014 ${e.why.reading.toLowerCase()}: `:"",e.why.field!=="label"?(0,t.jsx)(j,{text:e.why.fragment,words:d}):null]}):e.why.field!=="label"?(0,t.jsxs)("span",{style:{...Q,...me},children:[e.why.reading.toLowerCase(),": ",(0,t.jsx)(j,{text:e.why.fragment,words:d})]}):null]});case"kind":return(0,t.jsxs)("span",{style:Q,children:[(0,t.jsx)(j,{text:e.label,words:d}),(0,t.jsxs)("span",{style:me,children:[" \xB7 ",e.count," match"]})]});case"place":return(0,t.jsxs)("span",{style:Q,children:["Go to ",(0,t.jsx)(j,{text:e.title,words:d})]});case"rule":return(0,t.jsxs)("span",{style:Q,children:["The rule \u201C",(0,t.jsx)(j,{text:e.label,words:d}),"\u201D"]});case"act":return(0,t.jsx)("span",{style:Q,children:e.title})}}function Nt(e,o){if(o.length===0)return[{text:e}];let d=[],s=0;for(let n of e.matchAll(/[\p{L}\p{N}]+/gu)){let w=n[0],v=Re(w).replace(/ /g,""),g=o.filter(c=>v.startsWith(c)).sort((c,C)=>C.length-c.length)[0];if(!g)continue;let x=v.length===w.length?g.length:w.length,h=n.index??0;h>s&&d.push({text:e.slice(s,h)}),d.push({text:w.slice(0,x),marked:!0}),s=h+x}return s<e.length&&d.push({text:e.slice(s)}),d}function j({text:e,words:o}){return(0,t.jsx)(t.Fragment,{children:Nt(e,o).map((d,s)=>d.marked?(0,t.jsx)("mark",{style:rr,children:d.text},s):(0,t.jsx)(u.Fragment,{children:d.text},s))})}function It(e){if(e.about!=="node")return"";let o=e.near?`Near \u201C${e.why.asked}\u201D`:e.why.field!=="label"?`${e.why.reading}: ${e.why.fragment}`:"";return o?`${e.label}
1132
+ ${o}`:e.label}var nt=e=>e&&e[0].toUpperCase()+e.slice(1);function lt({kind:e,accents:o}){let d=Math.round($a(e,o));return(0,t.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:2,flex:"0 0 auto",background:`hsl(${d} 55% 52%)`}})}function ot(e,o){return e==="rule:"?"Rules":e==="act:"?"Acts":_(o,e)}function Ht(e,o,d){let s=Object.entries(e).map(([v,g])=>ka(d,v,g)),n=o.filter(v=>v.about==="kind"||v.about==="place"||v.about==="rule").length;n>0&&s.push(`${n} ${n===1?"place or rule":"places and rules"}`);let w=o.filter(v=>v.about==="node"&&v.near).length;return s.length===0?"Nothing found":`${s.join(", ")} found${w>0?`, ${w} of them near`:""}`}var Ot=10,Dt=12,Wt=5,Bt=6,Kt=140,Ft=760,qt="15.5rem",_t={...La,flexDirection:"column",width:"min(26rem, calc(100vw - 24px))",maxHeight:"min(64vh, 30rem)",overflow:"hidden",boxSizing:"border-box",background:"linear-gradient(var(--graview-panel), var(--graview-panel)) var(--graview-ground, var(--graview-panel))",borderTop:"1px solid var(--graview-edge)",borderRight:"1px solid var(--graview-edge)",borderBottom:"1px solid var(--graview-edge)",borderLeft:"1px solid var(--graview-edge)",borderRadius:10,boxShadow:"0 10px 28px rgb(0 0 0 / 0.18)",padding:0},Gt={width:"min(42rem, calc(100vw - 24px))"},Ut=6,Vt={width:"var(--graview-bar-width, 100vw)",maxHeight:"55vh",borderRadius:0,borderLeft:"none",borderRight:"none"},Yt={display:"grid",gridTemplateRows:"minmax(0, 1fr)",flex:"1 1 auto",minHeight:0},jt={overflowY:"auto",overflowX:"hidden",minHeight:0,padding:"4px 0",overscrollBehavior:"contain"},Qt={overflowY:"auto",minHeight:0,padding:"12px 14px",borderLeft:"1px solid var(--graview-edge)",background:"var(--graview-panel-muted)",display:"flex",flexDirection:"column",gap:4},Xt={fontWeight:600,fontSize:"0.9375rem",lineHeight:1.35,color:"var(--graview-ink)",overflowWrap:"anywhere"},Y={margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)",overflowWrap:"anywhere"},la={display:"flex",alignItems:"center",gap:6,padding:"10px 12px 4px",fontSize:"0.6875rem",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},Jt={marginLeft:"auto",fontWeight:400,letterSpacing:0,fontVariantNumeric:"tabular-nums",color:"var(--graview-ink-faint)"},Zt={position:"relative",display:"grid",gap:1,minHeight:34,padding:"5px 12px",alignContent:"center",cursor:"pointer",fontSize:"0.875rem",lineHeight:1.35,color:"var(--graview-ink)",minWidth:0},er={background:"color-mix(in srgb, var(--graview-accent) 12%, var(--graview-panel))",boxShadow:"inset 3px 0 0 var(--graview-accent)"},ar={color:"var(--graview-accent)",fontSize:"0.8125rem",minHeight:30},Q={display:"block",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},tr={display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,minWidth:0,overflow:"hidden",overflowWrap:"anywhere",fontWeight:600},me={color:"var(--graview-ink-muted)",fontSize:"0.8125rem",fontWeight:400},rr={background:"color-mix(in srgb, var(--graview-accent) 24%, transparent)",color:"inherit",borderRadius:2,padding:0,boxShadow:"0 1px 0 color-mix(in srgb, var(--graview-accent) 70%, transparent)"},ct={display:"flex",alignItems:"center",minHeight:32,padding:"4px 10px",boxSizing:"border-box",borderWidth:1,borderStyle:"solid",borderColor:"var(--graview-edge)",borderRadius:6,background:"var(--graview-panel)",color:"var(--graview-ink)",fontSize:"0.8125rem",lineHeight:1.3,cursor:"pointer",overflowWrap:"anywhere"},ir={...ct,minHeight:32,margin:"0 12px 4px 24px"},nr={borderColor:"var(--graview-accent)",boxShadow:"inset 0 0 0 1px var(--graview-accent)",background:"color-mix(in srgb, var(--graview-accent) 12%, var(--graview-panel))"},or={display:"grid",padding:"2px 0 6px"},sr={position:"absolute",top:"50%",right:6,transform:"translateY(-50%)",width:36,height:32,display:"grid",placeItems:"center",borderRadius:6,color:"var(--graview-ink-muted)",borderWidth:1,borderStyle:"solid",borderColor:"transparent"},dr={color:"var(--graview-accent)",borderColor:"var(--graview-edge)",background:"var(--graview-panel)"},st={margin:0,padding:"6px 12px 4px",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},lr={display:"flex",flexWrap:"wrap",gap:"4px 14px",padding:"7px 12px",borderTop:"1px solid var(--graview-edge)",color:"var(--graview-ink-faint)",fontSize:"0.75rem",flex:"0 0 auto"},fe={display:"inline-block",minWidth:16,padding:"0 4px",marginRight:3,border:"1px solid var(--graview-edge)",borderRadius:4,font:"inherit",fontSize:"0.6875rem",lineHeight:"16px",textAlign:"center",color:"var(--graview-ink-muted)",background:"var(--graview-panel)"};var oe=m(G(),1);var ca=m($t(),1);var gt=m($(),1);function pt(){let{following:e,follow:o}=T();return e?(0,gt.jsxs)("button",{type:"button","data-testid":"following-who",onClick:()=>o(null),title:"Press, or Escape, to stop following",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,padding:"2px 9px",borderRadius:999,border:"1px solid var(--graview-accent)",background:"transparent",color:"var(--graview-accent)",fontSize:"0.875rem",whiteSpace:"nowrap"},children:["following ",e.name]}):null}var vt=m(G(),1);var A=m($(),1);function ut({home:e,homeLabel:o,children:d,onPicture:s=!1}){let{view:n,focus:w,show:v,go:g}=U(),{store:x}=T(),{movedByHand:h}=T(),c=h&&(n.pan!==void 0||Object.keys(n.pins).length>0),C=n.focusId&&n.focusId!==e?x.graph.getNode(n.focusId):void 0,E=z=>_(x.schema,z),b={display:"inline-flex",alignItems:"center",gap:6,minHeight:26,padding:"2px 6px",fontSize:"0.8125rem",borderRadius:6,border:"1px solid transparent",boxShadow:"none",background:"transparent",color:"var(--graview-ink-muted)",whiteSpace:"nowrap"},R=o!==void 0&&C!==void 0,N=[];if(C&&!s&&N.push({key:"focused",node:(0,A.jsxs)("button",{type:"button","data-testid":"focused",onClick:()=>g(Fe({...n,focusId:e},!1)),title:Ge(x,C.id),style:{...b,maxWidth:"min(14rem, 15vw)"},children:[(0,A.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:Ge(x,C.id)}),(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),n.past&&N.push({key:"past",node:(0,A.jsxs)("button",{type:"button","data-testid":"past",onClick:()=>g(Ya(n,!1)),title:"Back to now \u2014 retired things leave the picture again",style:b,children:["the past",(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),n.zoom&&N.push({key:"zoomed",node:(0,A.jsxs)("button",{type:"button","data-testid":"zoomed",onClick:()=>g(Fe(n,!1)),title:"Zoom back out",style:b,children:["zoomed in",(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),c&&N.push({key:"moved",node:(0,A.jsx)("button",{type:"button","data-testid":"moved",onClick:()=>g(Ke(n)),title:"Put the camera and everything you dragged back where the layout wanted them",style:b,children:"Reset view"})}),n.relation){let z=n.relation;N.push({key:"raised",node:(0,A.jsxs)("span",{style:{display:"inline-flex",alignItems:"center"},children:[(0,A.jsxs)("button",{type:"button","data-testid":"raised-into",onClick:()=>g(ue(n,ve(z),{ownPicture:!0})),title:`Go into the ${E(z).toLowerCase()}`,"aria-label":`Go into the ${E(z).toLowerCase()}`,style:{...b,color:"var(--graview-ink)"},children:[E(z),(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\u2198"})]}),(0,A.jsx)("button",{type:"button","data-testid":"raised",onClick:()=>v(null),title:`Stop showing ${E(z).toLowerCase()}`,"aria-label":`Stop showing ${E(z).toLowerCase()}`,style:{...b,minWidth:26,justifyContent:"center"},children:(0,A.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})})]})})}return s&&!R&&N.length===0&&d===void 0?null:(0,A.jsxs)("nav",{"aria-label":"View","data-testid":"trail",style:{display:"flex",alignItems:"center",gap:8,fontSize:"0.875rem",minWidth:0,...s?{pointerEvents:"auto",padding:"4px 6px",borderRadius:8,background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",overflow:"hidden"}:{}},children:[R?(0,A.jsx)("button",{type:"button",onClick:()=>w(e),style:{border:"none",background:"none",padding:"3px 0",minHeight:24,whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:o}):null,N.map(({key:z,node:B},Le)=>(0,A.jsxs)(vt.Fragment,{children:[R||Le>0?(0,A.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:"\u203A"}):null,B]},z)),d]})}var P=m($(),1);function pa(){let[e,o]=(0,oe.useState)([]),d=(0,oe.useCallback)(s=>{o(n=>{let w=s.phase!=="running"&&n[0]?.name===s.name&&n[0]?.at===s.at;return[s,...w?n.slice(1):n].slice(0,12)})},[]);return[e,d]}function ga({find:e,calls:o,seat:d,remembers:s=!1}){return e?(0,P.jsxs)(P.Fragment,{children:[(0,ca.createPortal)((0,P.jsx)(dt,{compact:e.compact}),e.slot),e.own?(0,ca.createPortal)((0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(oe.Suspense,{fallback:null,children:(0,P.jsx)(rt,{})}),(0,P.jsx)(Wa,{calls:o,remembers:s,...d!==void 0?{seat:d}:{}})]}),e.own):null]}):null}function va({home:e=null}){return(0,P.jsxs)("div",{"data-graview-scene-trail":"",style:{position:"absolute",top:14,left:14,maxWidth:"calc(100% - 150px - var(--graview-dock, 0px))",zIndex:D("overview"),display:"flex",alignItems:"center",gap:6,minWidth:0,pointerEvents:"none"},children:[(0,P.jsx)(ut,{home:e,onPicture:!0}),(0,P.jsx)("span",{style:{pointerEvents:"auto"},children:(0,P.jsx)(pt,{})})]})}var X=m(G(),1);var wt=m($(),1),cr=ie(()=>(__graviewPreload(import.meta.url,["./chunk.Q355UPFG.js","./chunk.WC3DENU4.js","./chunk.VNDKKTED.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.TKVLNBRD.js")));function ua(){let{store:e,principal:o}=T(),d=(0,X.useContext)(Ba),s=(0,X.useRef)(null),n=(0,X.useRef)(!1);return(0,X.useEffect)(()=>()=>void(n.current=!0),[]),(0,X.useEffect)(()=>{let w=e.batches().length,v=cr().then(g=>g.sceneWay(e,o,d,w,s.current),()=>{});return()=>void v.then(g=>g?.(n.current))},[e,o,d]),(0,wt.jsx)("span",{ref:s,hidden:!0})}var mt=m(G(),1);var y=m($(),1);function qi({address:e=!1,auto:o,quickAsk:d=!0,scheme:s,scope:n}){let w=(0,mt.useMemo)(()=>`${ta({scope:`.${n}`})}
1133
1133
  ${ra(s,{scope:`.${n}`})}`,[s,n]),v=Ka(),[g]=pa();return(0,y.jsx)(za.Provider,{value:!0,children:(0,y.jsxs)("div",{"data-embed-content":"",style:{position:"relative",flex:o?`0 0 ${et}px`:"1 1 auto",minHeight:0,containerType:"size"},children:[(0,y.jsx)("style",{children:w}),e?(0,y.jsx)(Za,{}):null,(0,y.jsx)(Ja,{}),(0,y.jsx)(va,{}),(0,y.jsx)(oa,{}),(0,y.jsx)(ia,{}),(0,y.jsxs)(Qa,{children:[(0,y.jsx)(Xe,{}),(0,y.jsx)(Je,{face:"scene",on:d}),(0,y.jsx)(na,{}),(0,y.jsx)(Ue,{children:(0,y.jsx)(je,{children:(0,y.jsx)(Ze,{children:(0,y.jsx)(aa,{children:(0,y.jsx)(Qe,{placement:"menu"})})})})}),(0,y.jsx)(Ve,{}),(0,y.jsx)(ea,{}),(0,y.jsx)(ga,{find:v,calls:g}),(0,y.jsx)(ua,{}),(0,y.jsx)(_e,{face:"scene"})]})]})})}function _i(){return(0,y.jsx)(da,{})}export{qi as SceneFace,_i as SceneKeeping};