graview 0.1.42 → 0.1.44

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 (204) hide show
  1. package/dist/preview/{chunk.XDPIS7RS.js → chunk.27ZVVPRZ.js} +1 -1
  2. package/dist/preview/chunk.2AZTW66C.js +1 -0
  3. package/dist/preview/{chunk.CSWX7YGI.js → chunk.2CPC3HQI.js} +1 -1
  4. package/dist/preview/{chunk.HQMGTPDC.js → chunk.2EXY4AHX.js} +4 -4
  5. package/dist/preview/chunk.2O2THM2R.js +1 -0
  6. package/dist/preview/{chunk.J7ZMNAWB.js → chunk.3IUJ4GW7.js} +1 -1
  7. package/dist/preview/chunk.3L7OEBJH.js +1 -0
  8. package/dist/preview/{chunk.QHLD4TZW.js → chunk.3M4VCAA3.js} +1 -1
  9. package/dist/preview/chunk.3OKJ4GOA.js +1 -0
  10. package/dist/preview/chunk.3PNDXNX6.js +1 -0
  11. package/dist/preview/{chunk.WERBD5ZR.js → chunk.3TBH2FMZ.js} +1 -1
  12. package/dist/preview/{chunk.IWLVZGW5.js → chunk.4B4DKCS4.js} +1 -1
  13. package/dist/preview/{chunk.PCTVLNOS.js → chunk.4EPT2CQG.js} +1 -1
  14. package/dist/preview/chunk.4JWT6LIS.js +25 -0
  15. package/dist/preview/chunk.4WCQWILK.js +1 -0
  16. package/dist/preview/chunk.56DR42FA.js +1 -0
  17. package/dist/preview/chunk.5JPELFMA.js +2 -0
  18. package/dist/preview/chunk.5WEEZ7WD.js +1 -0
  19. package/dist/preview/chunk.64QDUERE.js +1 -0
  20. package/dist/preview/{chunk.I7QCXRP7.js → chunk.6BIRNR5P.js} +1 -1
  21. package/dist/preview/{chunk.7EB6SDUQ.js → chunk.6NFR2LYQ.js} +1 -1
  22. package/dist/preview/chunk.6VIZGLDK.js +1 -0
  23. package/dist/preview/{chunk.L6HKDIZB.js → chunk.7AEE3VHC.js} +1 -1
  24. package/dist/preview/chunk.7B5BZZBG.js +1 -0
  25. package/dist/preview/chunk.7HL7CFXJ.js +1 -0
  26. package/dist/preview/chunk.7JVBVB4A.js +1 -0
  27. package/dist/preview/{chunk.QXMTGLHR.js → chunk.7PUFYK3B.js} +1 -1
  28. package/dist/preview/{chunk.ARTJL3X2.js → chunk.7UV7ODXU.js} +1 -1
  29. package/dist/preview/chunk.ALFW4ZJQ.js +1 -0
  30. package/dist/preview/{chunk.HG2IO5NS.js → chunk.ATKKTPJS.js} +1 -1
  31. package/dist/preview/chunk.AW2T3KFV.js +5 -0
  32. package/dist/preview/{chunk.PACJFDDU.js → chunk.B2CIQ66N.js} +1 -1
  33. package/dist/preview/{chunk.5FHH5NR6.js → chunk.B7FZLIAO.js} +1 -1
  34. package/dist/preview/{chunk.NS3Z7QNP.js → chunk.BA4KQR5H.js} +1 -1
  35. package/dist/preview/chunk.CDFVEL2Y.js +1 -0
  36. package/dist/preview/chunk.CSQNDAEK.js +1 -0
  37. package/dist/preview/chunk.D2RK2KJD.js +35 -0
  38. package/dist/preview/chunk.DAZEFSWI.js +1 -0
  39. package/dist/preview/{chunk.KMGGP6XT.js → chunk.DGXWL4GC.js} +2 -2
  40. package/dist/preview/chunk.DLVNW4HU.js +1 -0
  41. package/dist/preview/chunk.E2AJ7U5Z.js +1 -0
  42. package/dist/preview/chunk.EJAWDI2V.js +1 -0
  43. package/dist/preview/chunk.EJOTTZWZ.js +1 -0
  44. package/dist/preview/{chunk.WVN62OMH.js → chunk.ESU2DD3J.js} +1 -1
  45. package/dist/preview/chunk.EW364363.js +9 -0
  46. package/dist/preview/chunk.EYEIDL3T.js +1 -0
  47. package/dist/preview/chunk.EZRGGPAN.js +1 -0
  48. package/dist/preview/{chunk.SUQU4AXG.js → chunk.F4DWRBO7.js} +1 -1
  49. package/dist/preview/{chunk.K63BUJBF.js → chunk.FBIK4LTM.js} +2 -2
  50. package/dist/preview/{chunk.ILPD5CZG.js → chunk.FIJNKSMQ.js} +1 -1
  51. package/dist/preview/{chunk.Y2QDZLSY.js → chunk.FNF6XQI5.js} +1 -1
  52. package/dist/preview/chunk.FNXW46U4.js +349 -0
  53. package/dist/preview/chunk.FUYMLDNJ.js +7 -0
  54. package/dist/preview/chunk.FVHECT47.js +1 -0
  55. package/dist/preview/{chunk.KZDLDXLB.js → chunk.GAN77YDU.js} +1 -1
  56. package/dist/preview/{chunk.O7VHAKSA.js → chunk.GBCWI2LF.js} +1 -1
  57. package/dist/preview/chunk.H4GHKBMH.js +1 -0
  58. package/dist/preview/chunk.HB34VQKQ.js +1 -0
  59. package/dist/preview/chunk.HKA27VJO.js +1 -0
  60. package/dist/preview/{chunk.4YBP552Z.js → chunk.HKD5SR45.js} +2 -2
  61. package/dist/preview/{chunk.6HUS5UHZ.js → chunk.HP72LB3B.js} +1 -1
  62. package/dist/preview/{chunk.B6DKKNVR.js → chunk.IBWPRK2R.js} +1 -1
  63. package/dist/preview/{chunk.V3K32XD7.js → chunk.IIB22IIP.js} +1 -1
  64. package/dist/preview/{chunk.57R4ZUMM.js → chunk.IN4PKQO5.js} +1 -1
  65. package/dist/preview/chunk.IPHWGBZE.js +6 -0
  66. package/dist/preview/{chunk.B7DCQJXV.js → chunk.IQWKEGWG.js} +1 -1
  67. package/dist/preview/chunk.JEMQ66FT.js +19 -0
  68. package/dist/preview/chunk.JGYGSNQY.js +1 -0
  69. package/dist/preview/{chunk.EC2T2UVH.js → chunk.JLOSQ5UY.js} +2 -2
  70. package/dist/preview/{chunk.X5WIS4BC.js → chunk.JQ7WY2VZ.js} +1 -1
  71. package/dist/preview/chunk.JUT2VCFW.js +1 -0
  72. package/dist/preview/{chunk.VTUMPH4Z.js → chunk.KERLVJ6I.js} +1 -1
  73. package/dist/preview/chunk.L6FWIQXS.js +1 -0
  74. package/dist/preview/{chunk.U3MQUIJL.js → chunk.LKF4BBCW.js} +1 -1
  75. package/dist/preview/chunk.LKXYZK5H.js +1 -0
  76. package/dist/preview/chunk.LULTKYE3.js +1 -0
  77. package/dist/preview/chunk.LUPBT6YM.js +1 -0
  78. package/dist/preview/{chunk.VO6DBVZR.js → chunk.LYSHLKAX.js} +1 -1
  79. package/dist/preview/chunk.LYUPJ4VV.js +1 -0
  80. package/dist/preview/{chunk.ZQCGDTQ3.js → chunk.MFLJIFZD.js} +1 -1
  81. package/dist/preview/chunk.MOF2D6DV.js +1 -0
  82. package/dist/preview/{chunk.CAZX6OPN.js → chunk.MWUP5X47.js} +1 -1
  83. package/dist/preview/{chunk.LFJH6X6O.js → chunk.MZOIPCDA.js} +1 -1
  84. package/dist/preview/{chunk.VMBIFUYX.js → chunk.N5ULWKR4.js} +1 -1
  85. package/dist/preview/{chunk.27P37343.js → chunk.NBOZPPSM.js} +1 -1
  86. package/dist/preview/chunk.NPS2WN7T.js +1 -0
  87. package/dist/preview/chunk.NTFCZYOR.js +1 -0
  88. package/dist/preview/chunk.O4VSQ2ER.js +1 -0
  89. package/dist/preview/{chunk.ROHM3ETN.js → chunk.OAWAUB4P.js} +1 -1
  90. package/dist/preview/chunk.OG6GNGTX.js +21 -0
  91. package/dist/preview/{chunk.V5VQCANB.js → chunk.OGF6UORU.js} +1 -1
  92. package/dist/preview/chunk.OK4FSBHI.js +1 -0
  93. package/dist/preview/chunk.P546VMA5.js +1 -0
  94. package/dist/preview/chunk.P5K7EYDK.js +1 -0
  95. package/dist/preview/{chunk.BZ4VZ6WQ.js → chunk.PL2P2OON.js} +1 -1
  96. package/dist/preview/chunk.PSTE3LZL.js +5 -0
  97. package/dist/preview/chunk.PX6VAZFJ.js +1 -0
  98. package/dist/preview/{chunk.P6J6VFF5.js → chunk.QJJKITXF.js} +1 -1
  99. package/dist/preview/{chunk.U6YOAS4X.js → chunk.QNJYXB3U.js} +1 -1
  100. package/dist/preview/chunk.RDGFZPKN.js +1 -0
  101. package/dist/preview/{chunk.LWAZ6ZO6.js → chunk.REEDZSCG.js} +2 -2
  102. package/dist/preview/chunk.REOYQTFP.js +1 -0
  103. package/dist/preview/{chunk.2ZGICECC.js → chunk.RLMW7DU6.js} +1 -1
  104. package/dist/preview/{chunk.VEP4EJ2N.js → chunk.RNUGQRJI.js} +1 -1
  105. package/dist/preview/{chunk.ZRIDKFTV.js → chunk.RVQYXPCM.js} +1 -1
  106. package/dist/preview/{chunk.LQGXUMUX.js → chunk.RYNCEZ6Q.js} +1 -1
  107. package/dist/preview/{chunk.WUQOSVQU.js → chunk.T6S3CEW7.js} +2 -2
  108. package/dist/preview/{chunk.PH5ITX3N.js → chunk.TDCO7LEA.js} +1 -1
  109. package/dist/preview/chunk.TJO5Y2OJ.js +1 -0
  110. package/dist/preview/chunk.TTSNHX3F.js +1 -0
  111. package/dist/preview/{chunk.QHP7AJUV.js → chunk.U3CV5CCL.js} +1 -1
  112. package/dist/preview/{chunk.VKJAGZNU.js → chunk.UG23RICT.js} +1 -1
  113. package/dist/preview/chunk.URCC626R.js +1 -0
  114. package/dist/preview/{chunk.37NF3YXZ.js → chunk.UXLJZIYX.js} +1 -1
  115. package/dist/preview/{chunk.AQTCN7KQ.js → chunk.UZSZPMRC.js} +1 -1
  116. package/dist/preview/chunk.V4DR25S4.js +1 -0
  117. package/dist/preview/chunk.VAUG5TGZ.js +1 -0
  118. package/dist/preview/{chunk.HAY22FPJ.js → chunk.WE5SA6TP.js} +1 -1
  119. package/dist/preview/chunk.WNYPP52L.js +1 -0
  120. package/dist/preview/chunk.WPLKHIO5.js +88 -0
  121. package/dist/preview/{chunk.XNW7PUAF.js → chunk.XPIDPZKS.js} +1 -1
  122. package/dist/preview/{chunk.P7ISPJAQ.js → chunk.Y2MIG2C2.js} +1 -1
  123. package/dist/preview/chunk.YE4GZVOX.js +1 -0
  124. package/dist/preview/chunk.YERDP6YF.js +1 -0
  125. package/dist/preview/{chunk.5NDYYTT4.js → chunk.YGX2AE36.js} +1 -1
  126. package/dist/preview/chunk.YTXEPWVW.js +1 -0
  127. package/dist/preview/chunk.YTZDCIX2.js +1 -0
  128. package/dist/preview/chunk.YYPK7IDM.js +1 -0
  129. package/dist/preview/chunk.ZKBSEUK4.js +1 -0
  130. package/dist/preview/chunk.ZN77U6SU.js +1 -0
  131. package/dist/preview/{chunk.HOTOH7ZB.js → chunk.ZP6PS5Z4.js} +1 -1
  132. package/dist/preview/chunk.ZZ5F5I3O.js +1 -0
  133. package/dist/preview/index.html +46 -45
  134. package/dist/preview/page.js +6 -6
  135. package/package.json +6 -6
  136. package/dist/preview/chunk.22QEYFWI.js +0 -1
  137. package/dist/preview/chunk.35FR36BQ.js +0 -1
  138. package/dist/preview/chunk.36LP3I7Z.js +0 -21
  139. package/dist/preview/chunk.3K2KBIRG.js +0 -1
  140. package/dist/preview/chunk.3SKUJWFC.js +0 -1
  141. package/dist/preview/chunk.3WABA2WQ.js +0 -1
  142. package/dist/preview/chunk.4NBB44YU.js +0 -1
  143. package/dist/preview/chunk.4QEDYRES.js +0 -349
  144. package/dist/preview/chunk.4YRCKOX2.js +0 -1
  145. package/dist/preview/chunk.6MLAJKYM.js +0 -1
  146. package/dist/preview/chunk.6NF32PAT.js +0 -1
  147. package/dist/preview/chunk.6WB24MS3.js +0 -1
  148. package/dist/preview/chunk.7HZVCW3Q.js +0 -1
  149. package/dist/preview/chunk.7MJM3OVC.js +0 -1
  150. package/dist/preview/chunk.7OSL64QH.js +0 -1
  151. package/dist/preview/chunk.7XDNCCLG.js +0 -6
  152. package/dist/preview/chunk.7Z2GTKA4.js +0 -1
  153. package/dist/preview/chunk.AOC2KUFE.js +0 -1
  154. package/dist/preview/chunk.AWSUMY3D.js +0 -1
  155. package/dist/preview/chunk.B65HPL4I.js +0 -1
  156. package/dist/preview/chunk.BJET6KOG.js +0 -1
  157. package/dist/preview/chunk.D3ELYLME.js +0 -1
  158. package/dist/preview/chunk.DNMBZONP.js +0 -1
  159. package/dist/preview/chunk.DXAUXGNN.js +0 -1
  160. package/dist/preview/chunk.EHMCRUYR.js +0 -1
  161. package/dist/preview/chunk.EQIQPY4O.js +0 -1
  162. package/dist/preview/chunk.ETWOZQWL.js +0 -1
  163. package/dist/preview/chunk.EVHXF7LZ.js +0 -19
  164. package/dist/preview/chunk.FFRWSODT.js +0 -1
  165. package/dist/preview/chunk.G4AY6NGN.js +0 -1
  166. package/dist/preview/chunk.GN2SZEFH.js +0 -1
  167. package/dist/preview/chunk.GXWOEOUY.js +0 -1
  168. package/dist/preview/chunk.IGA7OD3L.js +0 -1
  169. package/dist/preview/chunk.IXS5XBG6.js +0 -1
  170. package/dist/preview/chunk.JCTT2LAK.js +0 -1
  171. package/dist/preview/chunk.JE4QQEJE.js +0 -25
  172. package/dist/preview/chunk.JEBB3WM7.js +0 -1
  173. package/dist/preview/chunk.JPD2I4Z7.js +0 -1
  174. package/dist/preview/chunk.LKGDN25E.js +0 -1
  175. package/dist/preview/chunk.LMUFLZYT.js +0 -1
  176. package/dist/preview/chunk.LZH65VSN.js +0 -7
  177. package/dist/preview/chunk.MUBZIU6F.js +0 -1
  178. package/dist/preview/chunk.MZ6I2Q4E.js +0 -1
  179. package/dist/preview/chunk.NTJNBKWC.js +0 -1
  180. package/dist/preview/chunk.OMCXJGDI.js +0 -1
  181. package/dist/preview/chunk.OTHGZPUC.js +0 -1
  182. package/dist/preview/chunk.P6FGIYWP.js +0 -35
  183. package/dist/preview/chunk.PYFQGBU3.js +0 -1
  184. package/dist/preview/chunk.RFCTUGMU.js +0 -1
  185. package/dist/preview/chunk.RR4RZH4S.js +0 -1
  186. package/dist/preview/chunk.S5K4FLLG.js +0 -1
  187. package/dist/preview/chunk.SZKVNPEF.js +0 -1
  188. package/dist/preview/chunk.T3F6BKIO.js +0 -1
  189. package/dist/preview/chunk.UG727PEE.js +0 -5
  190. package/dist/preview/chunk.VXZFW52D.js +0 -1
  191. package/dist/preview/chunk.VYPR2MZO.js +0 -1
  192. package/dist/preview/chunk.W77OH637.js +0 -1
  193. package/dist/preview/chunk.WODEO2JF.js +0 -9
  194. package/dist/preview/chunk.WZEA2UK6.js +0 -1
  195. package/dist/preview/chunk.X2M7IOQA.js +0 -1
  196. package/dist/preview/chunk.XPML6T3P.js +0 -1
  197. package/dist/preview/chunk.YJM23BJL.js +0 -88
  198. package/dist/preview/chunk.YLGSXLXF.js +0 -1
  199. package/dist/preview/chunk.YLI6I6XP.js +0 -1
  200. package/dist/preview/chunk.YRYEWVNP.js +0 -1
  201. package/dist/preview/chunk.Z2TYCMBT.js +0 -5
  202. package/dist/preview/chunk.ZAFIZXGX.js +0 -1
  203. package/dist/preview/chunk.ZBYLAC3B.js +0 -2
  204. package/dist/preview/chunk.ZOS5APMD.js +0 -1
@@ -1,2 +1,2 @@
1
- import{a as Se}from"./chunk.WZEA2UK6.js";import{e as ke,f as $e,i as ve,j as J,k as xe}from"./chunk.WVN62OMH.js";import{f as he}from"./chunk.J7ZMNAWB.js";import{d as V,e as we}from"./chunk.VTUMPH4Z.js";import{b as ye,e as be}from"./chunk.PCTVLNOS.js";import{Ab as ie,C as X,I as ne,Ic as me,Nb as q,Ob as ae,Yc as pe,ba as E,ca as K,ea as oe,fa as Y,ga as re,gc as le,gd as fe,ic as ce,ja as _,kc as de,la as se,od as ge,pc as L,qc as ue}from"./chunk.UG727PEE.js";function Be(n,r,t){let i=n.tryDefinition(r)?.fields.shape,e=X(i?.[t]),l=!1,a=!1;for(;e&&(e.type==="optional"||e.type==="default"||e.type==="nullable"||e.type==="prefault");)(e.type==="optional"||e.type==="nullable")&&(l=!0),(e.type==="default"||e.type==="prefault")&&(a=!0),e=X(e.innerType);if(e?.type!=="enum")return;let h=(e.entries?Object.values(e.entries):e.values??[]).filter(m=>typeof m=="string");return h.length>0?{values:h,empty:l&&!a}:void 0}function H(n,r,t){let i=Be(n,r,t);if(!i)return[];let e=n.tryDefinition(r),l=i.values.map(a=>({value:a,label:ye(e,t,a)}));return i.empty&&l.push({value:null,label:`No ${_(e,t).toLowerCase()}`}),l}function z(n,r,t){let i=n[r];return typeof i=="string"&&t.some(e=>e.value===i)?i:null}function Q(n,r,t,i,e=H(n.schema,t.kind,i)){return De(n,r,t,i,e).flatMap(l=>l.move?[l.move]:[])}function De(n,r,t,i,e=H(n.schema,t.kind,i)){let l=Ce(n.schema,n.allMutations(),t.kind,i,e),a=z(t,i,e),h=se(n.schema.tryDefinition(t.kind),t.kind),m=[];for(let{value:x,label:P,by:O,acts:B}of l){if(x===a)continue;let C,G,F;for(let s of B){let p=O==="step"?{[s.subject.arg]:t.id}:{[s.subject.arg]:t.id,[i]:x},w={name:s.name,args:p};if(!s.input.safeParse(p).success){F??=`${s.title??s.name} asks for more than the ${h} itself.`;continue}let k=n.permits(w,r);if(!k.ok){G??=k.refusal?.message??`You may not ${s.title??s.name}.`;continue}try{ie(n.graph,s,p)}catch(c){G??=c instanceof Error?c.message:String(c);continue}C={to:x,call:w,title:s.title??s.name};break}m.push(C?{to:x,label:P,move:C}:{to:x,label:P,why:G??F??`Nothing in this app moves a ${h} to ${P}.`})}return m}function Ce(n,r,t,i,e=H(n,t,i)){let l=Re(n,r,t,i),a=Ae(n,r,t,i);return e.flatMap(h=>{if(h.value===null)return[];let m=l.filter(x=>x.sets?.[i]===h.value);return[{value:h.value,label:h.label,by:m.length>0?"step":a.length>0?"value":"none",acts:m.length>0?m:a}]})}function Re(n,r,t,i){return r.filter(e=>e.subject!==void 0&&e.derived===void 0&&typeof e.sets?.[i]=="string"&&q(n,e).includes(t))}function Ae(n,r,t,i){let e=n.tryDefinition(t);return e?r.filter(l=>{if(!l.subject||!q(n,l).includes(t)||!ae(l,e).includes(i))return!1;let a=l.input.shape;return a!==void 0&&i in a}).sort((l,a)=>+(l.derived!==void 0)-+(a.derived!==void 0)):[]}var ee=(n,r)=>r&&n[r]!==void 0?String(n[r]):"";function Ie(n,r,t){let i=s=>n.tryDefinition(s)?r.nodesOfKind(s).filter(p=>E(n.tryDefinition(s),p)):[],e=i(t.rows),l=i(t.columns),a=new Set(e.map(s=>s.id)),h=new Set(l.map(s=>s.id)),m=r.allEdges(),x=[],P=t.link;if(typeof P=="string"){let s=c=>n.tryDefinition(c)?.edges?.[P]?.to,p=(s(t.columns)??[]).some(c=>c===t.rows||c==="*"),w=(s(t.rows)??[]).some(c=>c===t.columns||c==="*"),k=p||!w;for(let c of m){if(c.kind!==P)continue;let A=k?c.to:c.from,o=k?c.from:c.to;a.has(A)&&h.has(o)&&x.push({rowId:A,columnId:o,via:[]})}}else{let s=new Map(P.path.map(w=>[w,new Map]));for(let w of m){let k=s.get(w.kind);if(!k)continue;let c=k.get(w.from);c?c.push(w.to):k.set(w.from,[w.to]);let A=k.get(w.to);A?A.push(w.from):k.set(w.to,[w.from])}let p=new Set;for(let w of l){let k=[{id:w.id,via:[]}];for(let c of P.path){let A=[],o=new Set;for(let $ of k)for(let R of s.get(c).get($.id)??[])o.has(`${$.id}|${R}`)||(o.add(`${$.id}|${R}`),A.push({id:R,via:[...$.via,$.id]}));k=A}for(let c of k){let A=`${c.id}|${w.id}`;!a.has(c.id)||p.has(A)||(p.add(A),x.push({rowId:c.id,columnId:w.id,via:c.via.slice(1)}))}}}let O=t.groupOrder??[],B=s=>O.indexOf(s)===-1?O.length:O.indexOf(s),C=(s,p)=>p==="label"?K(n.tryDefinition(s.kind),s):s[p],G=L(e,t.sort,C).map(s=>{let p=s;return{node:s,label:K(n.tryDefinition(s.kind),s),group:ee(p,t.rowGroup),ref:ee(p,t.rowRef)}}).sort((s,p)=>B(s.group)-B(p.group)||(t.sort!==void 0?0:s.ref<p.ref?-1:s.ref>p.ref?1:0)),F=L(l,t.columnSort,C).map(s=>({node:s,label:K(n.tryDefinition(s.kind),s),group:ee(s,t.columnGroup)})).sort((s,p)=>s.group<p.group?-1:s.group>p.group?1:t.columnSort!==void 0?0:s.node.id<p.node.id?-1:s.node.id>p.node.id?1:0);return{rows:G,columns:F,cells:x}}function Pe(n,r,t){let{rows:i,columns:e,cells:l}=Ie(n,r,t),a=(o,$)=>Y(n,o,$),h=o=>Y(n,o,1).replace(/^1 /,""),m=o=>({id:o.id,kind:o.kind,title:K(n.tryDefinition(o.kind),o),parts:[]}),x=o=>{let $=r.getNode(o);if(!$)return null;let R=n.tryDefinition($.kind),j=K(R,$),T=V($,R,{limit:3,said:[j],glance:!0}).map(N=>N.alone.startsWith(N.label)?`${N.label.toLowerCase()}${N.alone.slice(N.label.length)}`:N.alone);return[j,...T].join(", ")},P=typeof t.link=="string"?[]:t.link.path.slice(0,-1).flatMap((o,$,R)=>{let j=me(n,t.columns,R.slice(0,$+1));return j.ok?[...j.reached]:[]}),O=ue(n,t,{rows:i.length,columns:e.length,cells:l.length});if(O)return[{t:"text",text:`${a(t.rows,i.length)} against ${a(t.columns,e.length)}.`},{t:"text",text:O}];let B=[{t:"text",text:`${a(t.rows,i.length)} against ${a(t.columns,e.length)}${P.length>0?`, through ${[...new Set(P)].map(o=>a(o,2).replace(/^2 /,"")).join(" and ")}`:""}${e.length>0?`: ${e.map(o=>o.label).join(", ")}`:""}.`}],C=new Map(e.map(o=>[o.node.id,o.label])),G=new Map(e.map((o,$)=>[o.node.id,$])),F=new Map,s=new Map;for(let o of l){let $=F.get(o.rowId);$?$.push(o):F.set(o.rowId,[o]);let R=s.get(o.columnId);R?R.add(o.rowId):s.set(o.columnId,new Set([o.rowId]))}for(let o of i){let R=[...F.get(o.node.id)??[]].sort((j,T)=>G.get(j.columnId)-G.get(T.columnId)).map(j=>{let T=j.via.map(x).filter(N=>N!==null);return`${C.get(j.columnId)}${T.length>0?` (${T.join("; ")})`:""}`});B.push({t:"field",label:o.label,text:R.length>0?R.join(", "):"none"})}B.push({t:"list",as:"name",columns:1,groups:e.map(o=>{let $=s.get(o.node.id)??new Set,R=i.filter(j=>$.has(j.node.id)).map(j=>m(j.node));return{heading:`${o.label} (${R.length})`,items:R}})});let p=new Set(l.map(o=>o.rowId)),w=new Set(l.map(o=>o.columnId)),k=i.filter(o=>!p.has(o.node.id)),c=e.filter(o=>!w.has(o.node.id)),A=t.rows===t.columns;return k.length>0&&B.push({t:"text",text:`${A?`${k.length} with none across`:`${a(t.rows,k.length)} with no ${h(t.columns)}`}: ${k.map(o=>o.label).join(", ")}.`}),c.length>0&&B.push({t:"text",text:`${A?`${c.length} with none down`:`${a(t.columns,c.length)} on no ${h(t.rows)}`}: ${c.map(o=>o.label).join(", ")}.`}),B}function te(n,r,t,i={}){let{app:e,blocks:l=t?e?.viewSpecs?.[t.kind]?.[i.slot??"page"]:e?.home}=i;if(!l?.length)return[];let a=i.firstHeading??(t||i.blocks?void 0:1),h=xe(n,r,t,{...i,money:i.money??e?.brand,firstHeading:a});return t&&!h.node?[]:$e(typeof l[0]?.t=="string"?l:ke(l),h)}var Ge=240,je=10,Fe=1160,Ne=40,Ke=640,Te=3,We=n=>Math.max(1,Math.floor((Math.min(n,Fe)-Ne+je)/(Ge+je)));function Ee(n,r,t,i){let{app:e}=i,l=i.width??1440,a=i.today??n.today()??ne(e.brand?.timeZone),h=n.seenBy(r),m=h.schema,x=h.graph,P=Se(e),O=typeof t=="string"?t.trim():t.slug,B=typeof t=="string"?P.find(d=>d.slug===O||d.title===O||d.address===O):P.find(d=>d.slug===t.slug&&d.kind===t.kind)??t,C=!B&&typeof t=="string"?x.getNode(O):void 0;if(!B&&!C)return{ok:!1,error:`"${O}" is not a place this app has, nor a record this seat can see.`,places:P.map(d=>d.slug)};let G=[],F=e.viewSpecs??{},s=We(l),p=(d,y)=>te(h,null,d,{app:e,today:a,...y}),w=(d,y,v)=>{let g=m.tryDefinition(d.kind),S=K(g,d);if(y==="name")return{id:d.id,kind:d.kind,title:S,parts:[]};if(F[d.kind]?.[y]){let M=p(d,{slot:y}),[I,...f]=M,D=I?.t==="title";return{id:d.id,kind:d.kind,title:D?I.text:S,parts:k(D?f:M,v,`views.${d.kind}.${y}`,` (${d.id})`,D?1:0)}}if(y==="row")return{id:d.id,kind:d.kind,title:S,parts:[]};let u=g?.computed?J(m,x,d):d,W=V(u,g,{limit:3,said:[S],glance:!0,locale:e.brand?.locale,timeZone:e.brand?.timeZone});return{id:d.id,kind:d.kind,title:S,parts:W.map(M=>({t:"text",text:M.alone}))}};function k(d,y,v,g="",S=0){let b=[];return d.forEach((u,W)=>{let M=`${v}.${W+S}`;switch("problem"in u&&u.problem&&G.push({at:`${M}${g}`,says:u.problem}),u.t){case"title":b.push({t:"heading",level:3,text:u.text});return;case"text":b.push({t:"text",text:u.markdown?be(u.text):u.text,...u.tone?{tone:u.tone}:{}});return;case"badge":b.push({t:"badge",text:u.text});return;case"field":case"image":b.push({t:"field",label:u.label,text:u.text});return;case"progress":b.push({t:"progress",label:u.label,text:u.text});return;case"group":b.push(...k(u.blocks,y,`${M}.group`,g));return;case"when":b.push(...k(u.blocks,y,`${M}.show`,g));return;case"divider":case"figure":return;case"headline":b.push({t:"heading",level:u.level,text:u.text});return;case"number":b.push({t:"figure",text:u.text,...u.label?{label:u.label}:{}});return;case"list":{if(u.failed){b.push({t:"text",text:"\u2014"});return}if(u.members.length===0){u.empty&&b.push({t:"list",as:u.as,columns:1,groups:[],empty:u.empty});return}let I=y+1,f=I>Te?"name":u.as,D=(u.groups??[{value:null,members:u.members}]).map(U=>({..."heading"in U&&U.heading?{heading:U.heading}:{},items:U.members.map(Oe=>w(Oe,f,I))}));b.push({t:"list",as:f,columns:f==="card"?s:1,groups:D,...u.more>0?{more:u.more}:{}});return}}}),b}let c=[],A,o,$;if(C){o="record";let d=m.tryDefinition(C.kind),y=K(d,C);$={slug:C.id,title:y,kind:C.kind,address:pe(m,C.kind,C.id)},F[C.kind]?.page&&c.push(...k(p(C,{slot:"page"}),1,`views.${C.kind}.page`));let g=d?.computed?J(m,x,C):C;for(let S of we(d,V(g,d,{said:[y],locale:e.brand?.locale,timeZone:e.brand?.timeZone}))){S.title&&c.push({t:"heading",level:2,text:S.title});for(let b of S.fields)c.push({t:"field",label:b.label,text:b.value,...b.long?{long:!0}:{},...b.markdown?{markdown:!0}:{}})}}else{let d=B;$={slug:d.slug,title:d.title,kind:d.kind,address:d.address};let y=d.lens?fe(e).drawn.find(v=>v.as===d.slug&&(d.kind===null||v.kinds.includes(d.kind))):void 0;if(d.kind===null){let v=e.brand,g=v?.name??e.name,S=de(v)?.light,b=S&&ce(S)?S:void 0;if(A={name:g,...v?.subtitle?{subtitle:v.subtitle}:{},...b?{logo:{alt:v?.logoAlt??g,...le(b)?{drawn:"inline SVG"}:{drawn:"image",src:b}}}:{}},e.home)o="blocks",c=k(p(null,{}),0,"views.home");else{o="derived";let u=n.kindsKeptFrom(r),W=new Set([...e.pages?.hide??[],...u,...n.modules.disabledKinds]),M=ge(m.kinds,e.pages?.order).filter(I=>!W.has(I));c.push({t:"heading",level:1,text:e.name??"Home"});for(let I of M){let f=x.nodesOfKind(I).filter(D=>E(m.tryDefinition(I),D)).length;f>0&&c.push({t:"text",text:`${f} ${Z(m,I,f)}`})}}}else if(y?.lens==="blocks")o="lens:blocks",c=k(p(null,{blocks:y.options.blocks??[]}),0,`lenses.${y.index}.options.blocks`);else if(y?.lens==="columns"){o="lens:columns";let v=y.options.bindings??{};for(let g of Object.keys(v)){let S=v[g]?.column;if(!S)continue;let b=H(m,g,S),u=L(x.nodesOfKind(g).filter(f=>E(m.tryDefinition(g),f)),y.options.sort,(f,D)=>D==="label"?K(m.tryDefinition(f.kind),f):f[D]);Object.keys(v).length>1&&c.push({t:"heading",level:2,text:Z(m,g,2).replace(/^./,f=>f.toUpperCase())}),c.push({t:"text",text:`${u.length} ${Z(m,g,u.length)} in columns by ${_(m.tryDefinition(g),S).toLowerCase()}.`});let W=b.map(f=>({column:f,items:u.filter(D=>z(D,S,b)===f.value).map(D=>w(D,"card",1))})).filter(({column:f,items:D})=>f.value!==null||D.length>0).map(({column:f,items:D})=>({heading:`${f.label} (${D.length})`,items:D}));c.push({t:"list",as:"card",columns:1,groups:W});let M=new Map;for(let f of u)for(let D of Q(n,r,f,S,b))M.set(D.to,(M.get(D.to)??new Set).add(`"${D.title}"`));let I=b.filter(f=>f.value!==null&&M.has(f.value)).map(f=>`to ${f.label} by ${[...M.get(f.value)].join(" or ")}`);c.push({t:"text",text:I.length>0?`Moves: ${I.join("; ")}.`:"Moves: none for this seat."})}}else if(y?.lens==="coverage")o="lens:coverage",c=Pe(m,x,y.options);else if(y){o=`lens:${y.lens}`;let v=y.kinds.flatMap(g=>x.nodesOfKind(g).filter(S=>E(m.tryDefinition(g),S)));c.push({t:"text",text:`A ${y.lens} of ${v.length} ${y.kinds.map(g=>Z(m,g,v.length)).join(" and ")}.`}),c.push({t:"list",as:"name",columns:1,groups:[{items:v.map(g=>w(g,"name",1))}]})}else{o="derived";let v=x.nodesOfKind(d.kind).filter(g=>E(m.tryDefinition(d.kind),g));c.push({t:"heading",level:1,text:d.title}),v.length===0?c.push({t:"list",as:"row",columns:1,groups:[],empty:`No ${Z(m,d.kind,0)} yet.`}):c.push({t:"list",as:"row",columns:1,groups:[{items:v.map(g=>w(g,"row",1))}]})}}let R=r.kind==="system"?"the system":(r.roles??[]).length>0?(r.roles??[]).join(", "):r.kind,j=l<Ke?"phone":"wide",T=$.kind===null?He(m,x):[],N={...A?{masthead:A}:{},...T.length>0?{facts:T}:{},place:$,seat:R,width:l,variant:j,drawnBy:o,parts:c,problems:G};return{ok:!0,description:{...N,text:Me(N)}}}function He(n,r){let t=ve(n,r,null),i=e=>Array.isArray(e)?e.map(i).join(", "):e===null?"nothing":typeof e=="boolean"?e?"yes":"no":typeof e=="object"?e.label:String(e);return[...he(n)].map(([e,l])=>{let a=l.label??oe(e);return Object.hasOwn(t.values,e)?{name:e,label:a,value:i(t.values[e])}:{name:e,label:a,refused:t.refused[e]??"it could not be worked out"}})}function Z(n,r,t){let i=n.tryDefinition(r);if(t===1)return i?.noun??r;let e=re(n,r);return e.charAt(0).toLowerCase()+e.slice(1)}function Me(n){let r=[`${n.place.title} (${n.place.address}) \u2014 as ${n.seat}, ${n.width} wide (${n.variant}).`],t=n.masthead;t&&r.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 i=(e,l)=>{for(let a of e)switch(a.t){case"heading":r.push(`${l}${"#".repeat(a.level)} ${a.text}`);break;case"text":r.push(`${l}${a.text}`);break;case"badge":r.push(`${l}[${a.text}]`);break;case"field":case"progress":r.push(`${l}${a.label}: ${a.text}`);break;case"figure":r.push(`${l}${a.text}${a.label?` \u2014 ${a.label}`:""}`);break;case"list":if(a.groups.length===0){a.empty&&r.push(`${l}(${a.empty})`);break}for(let h of a.groups){h.heading&&r.push(`${l}${h.heading}:`);for(let m of h.items)r.push(`${l}${h.heading?" ":""}- ${m.title}`),i(m.parts,`${l}${h.heading?" ":" "}`)}a.as==="card"&&a.columns>1&&r.push(`${l}(cards, ${a.columns} across)`),a.more&&r.push(`${l}and ${a.more} more`);break}};if(i(n.parts,""),n.facts){r.push("Facts of the whole graph (what fact('<name>') reads):");for(let e of n.facts)r.push(`- ${e.label} (${e.name}): ${e.value??`not worked out \u2014 ${e.refused}`}`)}if(n.problems.length>0){r.push("Problems:");for(let e of n.problems)r.push(`- ${e.at}: ${e.says}`)}return r.join(`
1
+ import{a as Se}from"./chunk.DAZEFSWI.js";import{e as ke,f as $e,i as ve,j as J,k as xe}from"./chunk.ESU2DD3J.js";import{f as he}from"./chunk.3IUJ4GW7.js";import{d as V,e as we}from"./chunk.KERLVJ6I.js";import{b as ye,e as be}from"./chunk.4EPT2CQG.js";import{Ab as ie,C as X,I as ne,Ic as me,Nb as q,Ob as ae,Yc as pe,ba as E,ca as K,ea as oe,fa as Y,ga as re,gc as le,gd as fe,ic as ce,ja as _,kc as de,la as se,od as ge,pc as L,qc as ue}from"./chunk.AW2T3KFV.js";function Be(n,r,t){let i=n.tryDefinition(r)?.fields.shape,e=X(i?.[t]),l=!1,a=!1;for(;e&&(e.type==="optional"||e.type==="default"||e.type==="nullable"||e.type==="prefault");)(e.type==="optional"||e.type==="nullable")&&(l=!0),(e.type==="default"||e.type==="prefault")&&(a=!0),e=X(e.innerType);if(e?.type!=="enum")return;let h=(e.entries?Object.values(e.entries):e.values??[]).filter(m=>typeof m=="string");return h.length>0?{values:h,empty:l&&!a}:void 0}function H(n,r,t){let i=Be(n,r,t);if(!i)return[];let e=n.tryDefinition(r),l=i.values.map(a=>({value:a,label:ye(e,t,a)}));return i.empty&&l.push({value:null,label:`No ${_(e,t).toLowerCase()}`}),l}function z(n,r,t){let i=n[r];return typeof i=="string"&&t.some(e=>e.value===i)?i:null}function Q(n,r,t,i,e=H(n.schema,t.kind,i)){return De(n,r,t,i,e).flatMap(l=>l.move?[l.move]:[])}function De(n,r,t,i,e=H(n.schema,t.kind,i)){let l=Ce(n.schema,n.allMutations(),t.kind,i,e),a=z(t,i,e),h=se(n.schema.tryDefinition(t.kind),t.kind),m=[];for(let{value:x,label:P,by:O,acts:B}of l){if(x===a)continue;let C,G,F;for(let s of B){let p=O==="step"?{[s.subject.arg]:t.id}:{[s.subject.arg]:t.id,[i]:x},w={name:s.name,args:p};if(!s.input.safeParse(p).success){F??=`${s.title??s.name} asks for more than the ${h} itself.`;continue}let k=n.permits(w,r);if(!k.ok){G??=k.refusal?.message??`You may not ${s.title??s.name}.`;continue}try{ie(n.graph,s,p)}catch(c){G??=c instanceof Error?c.message:String(c);continue}C={to:x,call:w,title:s.title??s.name};break}m.push(C?{to:x,label:P,move:C}:{to:x,label:P,why:G??F??`Nothing in this app moves a ${h} to ${P}.`})}return m}function Ce(n,r,t,i,e=H(n,t,i)){let l=Re(n,r,t,i),a=Ae(n,r,t,i);return e.flatMap(h=>{if(h.value===null)return[];let m=l.filter(x=>x.sets?.[i]===h.value);return[{value:h.value,label:h.label,by:m.length>0?"step":a.length>0?"value":"none",acts:m.length>0?m:a}]})}function Re(n,r,t,i){return r.filter(e=>e.subject!==void 0&&e.derived===void 0&&typeof e.sets?.[i]=="string"&&q(n,e).includes(t))}function Ae(n,r,t,i){let e=n.tryDefinition(t);return e?r.filter(l=>{if(!l.subject||!q(n,l).includes(t)||!ae(l,e).includes(i))return!1;let a=l.input.shape;return a!==void 0&&i in a}).sort((l,a)=>+(l.derived!==void 0)-+(a.derived!==void 0)):[]}var ee=(n,r)=>r&&n[r]!==void 0?String(n[r]):"";function Ie(n,r,t){let i=s=>n.tryDefinition(s)?r.nodesOfKind(s).filter(p=>E(n.tryDefinition(s),p)):[],e=i(t.rows),l=i(t.columns),a=new Set(e.map(s=>s.id)),h=new Set(l.map(s=>s.id)),m=r.allEdges(),x=[],P=t.link;if(typeof P=="string"){let s=c=>n.tryDefinition(c)?.edges?.[P]?.to,p=(s(t.columns)??[]).some(c=>c===t.rows||c==="*"),w=(s(t.rows)??[]).some(c=>c===t.columns||c==="*"),k=p||!w;for(let c of m){if(c.kind!==P)continue;let A=k?c.to:c.from,o=k?c.from:c.to;a.has(A)&&h.has(o)&&x.push({rowId:A,columnId:o,via:[]})}}else{let s=new Map(P.path.map(w=>[w,new Map]));for(let w of m){let k=s.get(w.kind);if(!k)continue;let c=k.get(w.from);c?c.push(w.to):k.set(w.from,[w.to]);let A=k.get(w.to);A?A.push(w.from):k.set(w.to,[w.from])}let p=new Set;for(let w of l){let k=[{id:w.id,via:[]}];for(let c of P.path){let A=[],o=new Set;for(let $ of k)for(let R of s.get(c).get($.id)??[])o.has(`${$.id}|${R}`)||(o.add(`${$.id}|${R}`),A.push({id:R,via:[...$.via,$.id]}));k=A}for(let c of k){let A=`${c.id}|${w.id}`;!a.has(c.id)||p.has(A)||(p.add(A),x.push({rowId:c.id,columnId:w.id,via:c.via.slice(1)}))}}}let O=t.groupOrder??[],B=s=>O.indexOf(s)===-1?O.length:O.indexOf(s),C=(s,p)=>p==="label"?K(n.tryDefinition(s.kind),s):s[p],G=L(e,t.sort,C).map(s=>{let p=s;return{node:s,label:K(n.tryDefinition(s.kind),s),group:ee(p,t.rowGroup),ref:ee(p,t.rowRef)}}).sort((s,p)=>B(s.group)-B(p.group)||(t.sort!==void 0?0:s.ref<p.ref?-1:s.ref>p.ref?1:0)),F=L(l,t.columnSort,C).map(s=>({node:s,label:K(n.tryDefinition(s.kind),s),group:ee(s,t.columnGroup)})).sort((s,p)=>s.group<p.group?-1:s.group>p.group?1:t.columnSort!==void 0?0:s.node.id<p.node.id?-1:s.node.id>p.node.id?1:0);return{rows:G,columns:F,cells:x}}function Pe(n,r,t){let{rows:i,columns:e,cells:l}=Ie(n,r,t),a=(o,$)=>Y(n,o,$),h=o=>Y(n,o,1).replace(/^1 /,""),m=o=>({id:o.id,kind:o.kind,title:K(n.tryDefinition(o.kind),o),parts:[]}),x=o=>{let $=r.getNode(o);if(!$)return null;let R=n.tryDefinition($.kind),j=K(R,$),T=V($,R,{limit:3,said:[j],glance:!0}).map(N=>N.alone.startsWith(N.label)?`${N.label.toLowerCase()}${N.alone.slice(N.label.length)}`:N.alone);return[j,...T].join(", ")},P=typeof t.link=="string"?[]:t.link.path.slice(0,-1).flatMap((o,$,R)=>{let j=me(n,t.columns,R.slice(0,$+1));return j.ok?[...j.reached]:[]}),O=ue(n,t,{rows:i.length,columns:e.length,cells:l.length});if(O)return[{t:"text",text:`${a(t.rows,i.length)} against ${a(t.columns,e.length)}.`},{t:"text",text:O}];let B=[{t:"text",text:`${a(t.rows,i.length)} against ${a(t.columns,e.length)}${P.length>0?`, through ${[...new Set(P)].map(o=>a(o,2).replace(/^2 /,"")).join(" and ")}`:""}${e.length>0?`: ${e.map(o=>o.label).join(", ")}`:""}.`}],C=new Map(e.map(o=>[o.node.id,o.label])),G=new Map(e.map((o,$)=>[o.node.id,$])),F=new Map,s=new Map;for(let o of l){let $=F.get(o.rowId);$?$.push(o):F.set(o.rowId,[o]);let R=s.get(o.columnId);R?R.add(o.rowId):s.set(o.columnId,new Set([o.rowId]))}for(let o of i){let R=[...F.get(o.node.id)??[]].sort((j,T)=>G.get(j.columnId)-G.get(T.columnId)).map(j=>{let T=j.via.map(x).filter(N=>N!==null);return`${C.get(j.columnId)}${T.length>0?` (${T.join("; ")})`:""}`});B.push({t:"field",label:o.label,text:R.length>0?R.join(", "):"none"})}B.push({t:"list",as:"name",columns:1,groups:e.map(o=>{let $=s.get(o.node.id)??new Set,R=i.filter(j=>$.has(j.node.id)).map(j=>m(j.node));return{heading:`${o.label} (${R.length})`,items:R}})});let p=new Set(l.map(o=>o.rowId)),w=new Set(l.map(o=>o.columnId)),k=i.filter(o=>!p.has(o.node.id)),c=e.filter(o=>!w.has(o.node.id)),A=t.rows===t.columns;return k.length>0&&B.push({t:"text",text:`${A?`${k.length} with none across`:`${a(t.rows,k.length)} with no ${h(t.columns)}`}: ${k.map(o=>o.label).join(", ")}.`}),c.length>0&&B.push({t:"text",text:`${A?`${c.length} with none down`:`${a(t.columns,c.length)} on no ${h(t.rows)}`}: ${c.map(o=>o.label).join(", ")}.`}),B}function te(n,r,t,i={}){let{app:e,blocks:l=t?e?.viewSpecs?.[t.kind]?.[i.slot??"page"]:e?.home}=i;if(!l?.length)return[];let a=i.firstHeading??(t||i.blocks?void 0:1),h=xe(n,r,t,{...i,money:i.money??e?.brand,firstHeading:a});return t&&!h.node?[]:$e(typeof l[0]?.t=="string"?l:ke(l),h)}var Ge=240,je=10,Fe=1160,Ne=40,Ke=640,Te=3,We=n=>Math.max(1,Math.floor((Math.min(n,Fe)-Ne+je)/(Ge+je)));function Ee(n,r,t,i){let{app:e}=i,l=i.width??1440,a=i.today??n.today()??ne(e.brand?.timeZone),h=n.seenBy(r),m=h.schema,x=h.graph,P=Se(e),O=typeof t=="string"?t.trim():t.slug,B=typeof t=="string"?P.find(d=>d.slug===O||d.title===O||d.address===O):P.find(d=>d.slug===t.slug&&d.kind===t.kind)??t,C=!B&&typeof t=="string"?x.getNode(O):void 0;if(!B&&!C)return{ok:!1,error:`"${O}" is not a place this app has, nor a record this seat can see.`,places:P.map(d=>d.slug)};let G=[],F=e.viewSpecs??{},s=We(l),p=(d,y)=>te(h,null,d,{app:e,today:a,...y}),w=(d,y,v)=>{let g=m.tryDefinition(d.kind),S=K(g,d);if(y==="name")return{id:d.id,kind:d.kind,title:S,parts:[]};if(F[d.kind]?.[y]){let M=p(d,{slot:y}),[I,...f]=M,D=I?.t==="title";return{id:d.id,kind:d.kind,title:D?I.text:S,parts:k(D?f:M,v,`views.${d.kind}.${y}`,` (${d.id})`,D?1:0)}}if(y==="row")return{id:d.id,kind:d.kind,title:S,parts:[]};let u=g?.computed?J(m,x,d):d,W=V(u,g,{limit:3,said:[S],glance:!0,locale:e.brand?.locale,timeZone:e.brand?.timeZone});return{id:d.id,kind:d.kind,title:S,parts:W.map(M=>({t:"text",text:M.alone}))}};function k(d,y,v,g="",S=0){let b=[];return d.forEach((u,W)=>{let M=`${v}.${W+S}`;switch("problem"in u&&u.problem&&G.push({at:`${M}${g}`,says:u.problem}),u.t){case"title":b.push({t:"heading",level:3,text:u.text});return;case"text":b.push({t:"text",text:u.markdown?be(u.text):u.text,...u.tone?{tone:u.tone}:{}});return;case"badge":b.push({t:"badge",text:u.text});return;case"field":case"image":b.push({t:"field",label:u.label,text:u.text});return;case"progress":b.push({t:"progress",label:u.label,text:u.text});return;case"group":b.push(...k(u.blocks,y,`${M}.group`,g));return;case"when":b.push(...k(u.blocks,y,`${M}.show`,g));return;case"divider":case"figure":return;case"headline":b.push({t:"heading",level:u.level,text:u.text});return;case"number":b.push({t:"figure",text:u.text,...u.label?{label:u.label}:{}});return;case"list":{if(u.failed){b.push({t:"text",text:"\u2014"});return}if(u.members.length===0){u.empty&&b.push({t:"list",as:u.as,columns:1,groups:[],empty:u.empty});return}let I=y+1,f=I>Te?"name":u.as,D=(u.groups??[{value:null,members:u.members}]).map(U=>({..."heading"in U&&U.heading?{heading:U.heading}:{},items:U.members.map(Oe=>w(Oe,f,I))}));b.push({t:"list",as:f,columns:f==="card"?s:1,groups:D,...u.more>0?{more:u.more}:{}});return}}}),b}let c=[],A,o,$;if(C){o="record";let d=m.tryDefinition(C.kind),y=K(d,C);$={slug:C.id,title:y,kind:C.kind,address:pe(m,C.kind,C.id)},F[C.kind]?.page&&c.push(...k(p(C,{slot:"page"}),1,`views.${C.kind}.page`));let g=d?.computed?J(m,x,C):C;for(let S of we(d,V(g,d,{said:[y],locale:e.brand?.locale,timeZone:e.brand?.timeZone}))){S.title&&c.push({t:"heading",level:2,text:S.title});for(let b of S.fields)c.push({t:"field",label:b.label,text:b.value,...b.long?{long:!0}:{},...b.markdown?{markdown:!0}:{}})}}else{let d=B;$={slug:d.slug,title:d.title,kind:d.kind,address:d.address};let y=d.lens?fe(e).drawn.find(v=>v.as===d.slug&&(d.kind===null||v.kinds.includes(d.kind))):void 0;if(d.kind===null){let v=e.brand,g=v?.name??e.name,S=de(v)?.light,b=S&&ce(S)?S:void 0;if(A={name:g,...v?.subtitle?{subtitle:v.subtitle}:{},...b?{logo:{alt:v?.logoAlt??g,...le(b)?{drawn:"inline SVG"}:{drawn:"image",src:b}}}:{}},e.home)o="blocks",c=k(p(null,{}),0,"views.home");else{o="derived";let u=n.kindsKeptFrom(r),W=new Set([...e.pages?.hide??[],...u,...n.modules.disabledKinds]),M=ge(m.kinds,e.pages?.order).filter(I=>!W.has(I));c.push({t:"heading",level:1,text:e.name??"Home"});for(let I of M){let f=x.nodesOfKind(I).filter(D=>E(m.tryDefinition(I),D)).length;f>0&&c.push({t:"text",text:`${f} ${Z(m,I,f)}`})}}}else if(y?.lens==="blocks")o="lens:blocks",c=k(p(null,{blocks:y.options.blocks??[]}),0,`lenses.${y.index}.options.blocks`);else if(y?.lens==="columns"){o="lens:columns";let v=y.options.bindings??{};for(let g of Object.keys(v)){let S=v[g]?.column;if(!S)continue;let b=H(m,g,S),u=L(x.nodesOfKind(g).filter(f=>E(m.tryDefinition(g),f)),y.options.sort,(f,D)=>D==="label"?K(m.tryDefinition(f.kind),f):f[D]);Object.keys(v).length>1&&c.push({t:"heading",level:2,text:Z(m,g,2).replace(/^./,f=>f.toUpperCase())}),c.push({t:"text",text:`${u.length} ${Z(m,g,u.length)} in columns by ${_(m.tryDefinition(g),S).toLowerCase()}.`});let W=b.map(f=>({column:f,items:u.filter(D=>z(D,S,b)===f.value).map(D=>w(D,"card",1))})).filter(({column:f,items:D})=>f.value!==null||D.length>0).map(({column:f,items:D})=>({heading:`${f.label} (${D.length})`,items:D}));c.push({t:"list",as:"card",columns:1,groups:W});let M=new Map;for(let f of u)for(let D of Q(n,r,f,S,b))M.set(D.to,(M.get(D.to)??new Set).add(`"${D.title}"`));let I=b.filter(f=>f.value!==null&&M.has(f.value)).map(f=>`to ${f.label} by ${[...M.get(f.value)].join(" or ")}`);c.push({t:"text",text:I.length>0?`Moves: ${I.join("; ")}.`:"Moves: none for this seat."})}}else if(y?.lens==="coverage")o="lens:coverage",c=Pe(m,x,y.options);else if(y){o=`lens:${y.lens}`;let v=y.kinds.flatMap(g=>x.nodesOfKind(g).filter(S=>E(m.tryDefinition(g),S)));c.push({t:"text",text:`A ${y.lens} of ${v.length} ${y.kinds.map(g=>Z(m,g,v.length)).join(" and ")}.`}),c.push({t:"list",as:"name",columns:1,groups:[{items:v.map(g=>w(g,"name",1))}]})}else{o="derived";let v=x.nodesOfKind(d.kind).filter(g=>E(m.tryDefinition(d.kind),g));c.push({t:"heading",level:1,text:d.title}),v.length===0?c.push({t:"list",as:"row",columns:1,groups:[],empty:`No ${Z(m,d.kind,0)} yet.`}):c.push({t:"list",as:"row",columns:1,groups:[{items:v.map(g=>w(g,"row",1))}]})}}let R=r.kind==="system"?"the system":(r.roles??[]).length>0?(r.roles??[]).join(", "):r.kind,j=l<Ke?"phone":"wide",T=$.kind===null?He(m,x):[],N={...A?{masthead:A}:{},...T.length>0?{facts:T}:{},place:$,seat:R,width:l,variant:j,drawnBy:o,parts:c,problems:G};return{ok:!0,description:{...N,text:Me(N)}}}function He(n,r){let t=ve(n,r,null),i=e=>Array.isArray(e)?e.map(i).join(", "):e===null?"nothing":typeof e=="boolean"?e?"yes":"no":typeof e=="object"?e.label:String(e);return[...he(n)].map(([e,l])=>{let a=l.label??oe(e);return Object.hasOwn(t.values,e)?{name:e,label:a,value:i(t.values[e])}:{name:e,label:a,refused:t.refused[e]??"it could not be worked out"}})}function Z(n,r,t){let i=n.tryDefinition(r);if(t===1)return i?.noun??r;let e=re(n,r);return e.charAt(0).toLowerCase()+e.slice(1)}function Me(n){let r=[`${n.place.title} (${n.place.address}) \u2014 as ${n.seat}, ${n.width} wide (${n.variant}).`],t=n.masthead;t&&r.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 i=(e,l)=>{for(let a of e)switch(a.t){case"heading":r.push(`${l}${"#".repeat(a.level)} ${a.text}`);break;case"text":r.push(`${l}${a.text}`);break;case"badge":r.push(`${l}[${a.text}]`);break;case"field":case"progress":r.push(`${l}${a.label}: ${a.text}`);break;case"figure":r.push(`${l}${a.text}${a.label?` \u2014 ${a.label}`:""}`);break;case"list":if(a.groups.length===0){a.empty&&r.push(`${l}(${a.empty})`);break}for(let h of a.groups){h.heading&&r.push(`${l}${h.heading}:`);for(let m of h.items)r.push(`${l}${h.heading?" ":""}- ${m.title}`),i(m.parts,`${l}${h.heading?" ":" "}`)}a.as==="card"&&a.columns>1&&r.push(`${l}(cards, ${a.columns} across)`),a.more&&r.push(`${l}and ${a.more} more`);break}};if(i(n.parts,""),n.facts){r.push("Facts of the whole graph (what fact('<name>') reads):");for(let e of n.facts)r.push(`- ${e.label} (${e.name}): ${e.value??`not worked out \u2014 ${e.refused}`}`)}if(n.problems.length>0){r.push("Problems:");for(let e of n.problems)r.push(`- ${e.at}: ${e.says}`)}return r.join(`
2
2
  `)}export{H as a,z as b,Q as c,De as d,Ce as e,Re as f,Ae as g,te as h,Ee as i,Me as j};
@@ -0,0 +1 @@
1
+ import{a as xe}from"./chunk.HJCQ6I3S.js";import{a as je,b as Ee,c as Ie,d as Re}from"./chunk.B7FZLIAO.js";import"./chunk.TKUNRFDE.js";import{c as he}from"./chunk.N5ULWKR4.js";import"./chunk.MZOIPCDA.js";import"./chunk.KERLVJ6I.js";import"./chunk.4EPT2CQG.js";import{G as Ke,R as Pe}from"./chunk.4JWT6LIS.js";import"./chunk.SDO3U72B.js";import"./chunk.AW2T3KFV.js";import"./chunk.2AZTW66C.js";import{b as pe}from"./chunk.AJZBJBMO.js";var P=pe(Ke(),1);var E=.5,fe=1,ye=.76,Le=3,We=3,Ae=.6;function Oe(c){let{ribbons:m,plots:u,cell:i}=c,a=c.tilt??.5,g=c.labels??[],b=[...u.values()],k=new Map;if(b.length===0||i<=0)return k;let L=Math.min(...b.map(n=>n.col))-3,A=Math.min(...b.map(n=>n.row))-3,G=Math.max(...b.map(n=>n.col+n.side))+3,ce=Math.max(...b.map(n=>n.row+n.side))+3,h=Math.round((G-L)/E)+1,p=Math.round((ce-A)/E)+1,N=n=>L+n*E,B=n=>A+n*E,I=4,_=!0,C=(n,e)=>{if(!_)return!1;let t=he(n,e,i,a);return g.some(s=>t.x>s.x-I&&t.x<s.x+s.width+I&&t.y>s.y-I&&t.y<s.y+s.height+I)},H=(n,e)=>b.some(t=>n>t.col-ye&&n<t.col+t.side+ye&&e>t.row-ye&&e<t.row+t.side+ye),F=new Uint8Array(h*p),J=new Uint8Array(h*p);for(let n=0;n<h;n++)for(let e=0;e<p;e++){let t=N(n),s=B(e);J[e*h+n]=H(t,s)?0:1,F[e*h+n]=J[e*h+n]&&!C(t,s)?1:0}let Q=F,se=new Float32Array(h*p);for(let n=0;n<h;n++)for(let e=0;e<p;e++){let t=N(n),s=B(e);se[e*h+n]=Math.min(...b.map(o=>Math.max(0,o.col-t,t-(o.col+o.side),o.row-s,s-(o.row+o.side))))}let Z=(n,e,t,s)=>{let o=N(n)+t*E/2,l=B(e)+s*E/2;return!H(o,l)&&!C(o,l)},ue=n=>{let e=[],t=(o,l)=>{let w=[],d=Math.min(1,l/3);for(let y=Math.ceil((o+d)/E-1e-9)*E;y<=o+l-d+1e-9;y+=E)w.push(y);return w},s=(o,l,w,d)=>{let y=Math.round((o-L)/E),r=Math.round((l-A)/E);y>=0&&r>=0&&y<h&&r<p&&Q[r*h+y]&&e.push({i:y,j:r,out:w,curb:d})};for(let o of t(n.row,n.side))s(n.col-fe,o,1,{col:n.col,row:o}),s(n.col+n.side+fe,o,0,{col:n.col+n.side,row:o});for(let o of t(n.col,n.side))s(o,n.row-fe,3,{col:o,row:n.row}),s(o,n.row+n.side+fe,2,{col:o,row:n.row+n.side});return e},ee=new Map,V=(n,e,t,s)=>n<t||n===t&&e<s?`${n},${e}-${t},${s}`:`${t},${s}-${n},${e}`,de=[[1,0],[-1,0],[0,1],[0,-1]],X=new Map;for(let n of m){let e=u.get(n.from),t=u.get(n.to);if(!e||!t||e===t)continue;let s=-1,o=[],l=new Map,w=new Int32Array(0),d=1/0,y=[];for(let f of[!0,!1]){s=-1,d=1/0,_=f,Q=f?F:J,o=ue(e);let W=ue(t);if(o.length===0||W.length===0){y.push({reached:-1,starts:o,goal:l,back:w,best:d});continue}l=new Map(W.map(j=>[j.j*h+j.i,j]));let ne=(j,R)=>{let re=N(j),ae=B(R);return(Math.max(0,t.col-re,re-(t.col+t.side))+Math.max(0,t.row-ae,ae-(t.row+t.side)))*Ae},oe=h*p*4,ie=new Float64Array(oe).fill(1/0);w=new Int32Array(oe).fill(-1);let le=new ke;for(let j of o){let R=(j.j*h+j.i)*4+j.out;ie[R]=0,le.push(R,ne(j.i,j.j))}let Ce=[1,0,3,2];for(;le.size>0&&!(le.peekKey()>=d);){let R=le.pop(),re=Math.floor(R/4),ae=R%4,ge=re%h,we=Math.floor(re/h),ve=l.get(re);if(ve){let q=ie[R]+(ae===Ce[ve.out]?0:Le);q<d&&(d=q,s=R);continue}for(let q=0;q<4;q++){let[Me,$e]=de[q],U=ge+Me,z=we+$e;if(U<0||z<0||U>=h||z>=p||!Q[z*h+U]||!Z(ge,we,Me,$e))continue;let Te=E*(ee.has(V(ge,we,U,z))?Ae:1)*(1+Math.max(0,se[z*h+U]-We))+(q===ae?0:Le),me=(z*h+U)*4+q,be=ie[R]+Te;be<ie[me]&&(ie[me]=be,w[me]=R,le.push(me,be+ne(U,z)))}}y.push({reached:s,starts:o,goal:l,back:w,best:d})}_=!0,Q=F;let[r,v]=y,M=r&&r.reached!==-1&&(!v||v.reached===-1||r.best<=1.3*v.best+2)?r:v;if(!M||M.reached===-1)continue;({reached:s,starts:o,goal:l,back:w}=M);let x=[];for(let f=s;f!==-1;f=w[f]){let W=Math.floor(f/4),ne=x[x.length-1],oe={i:W%h,j:Math.floor(W/h)};(!ne||ne.i!==oe.i||ne.j!==oe.j)&&x.push(oe)}x.reverse();for(let f=1;f<x.length;f++){let W=V(x[f-1].i,x[f-1].j,x[f].i,x[f].j);ee.set(W,[...ee.get(W)??[],n.key])}let D=o.find(f=>f.i===x[0].i&&f.j===x[0].j),$=l.get(x[x.length-1].j*h+x[x.length-1].i);X.set(n.key,{cells:x,start:D.curb,end:$.curb})}let O=new Map(m.map(n=>[n.key,n.width])),T=new Map(m.map((n,e)=>[n.key,e])),te=i*a/Math.sqrt(1+a*a),Y=(n,e)=>n==="col"?`r${e.row.toFixed(2)}`:`c${e.col.toFixed(2)}`,K=new Map;for(let[n,e]of X)for(let t=1;t<e.cells.length;t++){let s=e.cells[t-1],o=e.cells[t],l=Y(s.i!==o.i?"col":"row",{col:N(s.i),row:B(s.j)});K.set(l,(K.get(l)??new Set).add(n))}for(let[n,e]of X){let t=[e.start,...e.cells.map(r=>({col:N(r.i),row:B(r.j)})),e.end],s=r=>r>=2&&r<=e.cells.length?V(e.cells[r-2].i,e.cells[r-2].j,e.cells[r-1].i,e.cells[r-1].j):null,o=[];for(let r=1;r<t.length;r++){let v=Math.abs(t[r].col-t[r-1].col)>1e-9?"col":"row",M=o[o.length-1];M&&M.axis===v?M.to=r:o.push({from:r-1,to:r,axis:v})}if(o.length===0)continue;let l=o.map(r=>{if(!Array.from({length:r.to-r.from},($,f)=>s(r.from+1+f)).some($=>$!==null))return 0;let v=K.get(Y(r.axis,t[r.from]))??new Set;if(!v.has(n))return 0;let M=[...v].sort(($,f)=>(T.get($)??0)-(T.get(f)??0)),D=-(M.reduce(($,f)=>$+(O.get(f)??2)+2,0)-2)/2;for(let $ of M){if($===n)return(D+(O.get($)??2)/2)/te;D+=(O.get($)??2)+2}return 0}),w=r=>{let v=o[r],M=t[v.from];return v.axis==="col"?{row:M.row+l[r]}:{col:M.col+l[r]}},d=(r,v,M)=>({col:r.col??v.col??M.col,row:r.row??v.row??M.row}),y=[d(w(0),{},t[0])];for(let r=0;r+1<o.length;r++)y.push(d(w(r),w(r+1),t[o[r].to]));y.push(d(w(o.length-1),{},t[t.length-1])),k.set(n,y.map(r=>he(r.col,r.row,i,a)))}return k}var ke=class{items=[];keys=[];get size(){return this.items.length}peekKey(){return this.keys[0]??1/0}push(m,u){this.items.push(m),this.keys.push(u);let i=this.items.length-1;for(;i>0;){let a=i-1>>1;if(this.keys[a]<=this.keys[i])break;this.swap(i,a),i=a}}pop(){let m=this.items[0],u=this.items.pop(),i=this.keys.pop();if(this.items.length>0){this.items[0]=u,this.keys[0]=i;let a=0;for(;;){let g=2*a+1,b=g+1,k=a;if(g<this.items.length&&this.keys[g]<this.keys[k]&&(k=g),b<this.items.length&&this.keys[b]<this.keys[k]&&(k=b),k===a)break;this.swap(a,k),a=k}}return m}swap(m,u){[this.items[m],this.items[u]]=[this.items[u],this.items[m]],[this.keys[m],this.keys[u]]=[this.keys[u],this.keys[m]]}};function Se(c,m){let u=c.col+c.side,i=u+.25+.22*Math.max(0,m),a=c.row+c.side*Math.max(.1,.3-.06*m),g=c.row+c.side*Math.min(.9,.7+.06*m);return[{col:u,row:a},{col:i,row:a},{col:i,row:g},{col:u,row:g}]}function Be(c,m){return c.map(u=>he(u.col,u.row,m.cell,m.tilt))}function Fe(c){return c.map((m,u)=>`${u===0?"M":"L"} ${m.x.toFixed(1)} ${m.y.toFixed(1)}`).join(" ")}function Ne(c){if(c.length===0)return{x:0,y:0};let m=0;for(let i=1;i<c.length;i++)m+=Math.hypot(c[i].x-c[i-1].x,c[i].y-c[i-1].y);let u=m/2;for(let i=1;i<c.length;i++){let a=c[i-1],g=c[i],b=Math.hypot(g.x-a.x,g.y-a.y);if(b>=u&&b>0)return{x:a.x+(g.x-a.x)*u/b,y:a.y+(g.y-a.y)*u/b};u-=b}return c[c.length-1]}var S=pe(Pe(),1);function Ue({frame:c,width:m,height:u,pan:i,store:a,graphVersion:g,selection:b,view:k,emphasis:L,hiddenKinds:A,drawn:G}){let[ce,h]=(0,P.useState)(null),p=c.city,N=e=>a.graph.getNode(e)?.kind,B=(0,P.useMemo)(()=>je(a.graph.allEdges(),e=>a.graph.getNode(e)?.kind),[a,g]),I=new Map;for(let e of c.nodes){let t=e.id.startsWith("kind:")?Ie(e.id):null;t!==null&&e.plot&&Math.round(e.plane)===2&&I.set(t,e.plot)}let _=[...I].map(([e,t])=>`${e}:${t.col},${t.row},${t.side}`).join(";"),C=p?.cell??0,H=B.filter(e=>I.has(e.from)&&I.has(e.to)&&!A.has(e.from)&&!A.has(e.to)&&G(e.edge)),F=p?.tilt??.5,[J,Q]=(0,P.useState)([]),se=J.map(e=>`${Math.round(e.x)},${Math.round(e.y)},${Math.round(e.width)},${Math.round(e.height)}`).join(";"),[Z,ue]=(0,P.useState)(null),ee=c.t>=1;(0,P.useLayoutEffect)(()=>{let e=Z?.parentElement;if(!e||!p||!ee)return;let t=e.getBoundingClientRect(),s=p.originX+i.x,o=p.originY+i.y,l=[...e.querySelectorAll('[data-graview-view^="kind:"] .graview-kind-face')].flatMap(d=>{let y=d.getBoundingClientRect();return y.width>0&&y.height>0?[{x:y.left-t.left-s,y:y.top-t.top-o,width:y.width,height:y.height}]:[]});l.map(d=>`${Math.round(d.x)},${Math.round(d.y)},${Math.round(d.width)},${Math.round(d.height)}`).join(";")!==se&&Q(l)},[Z,ee,_,C,F]);let V=(0,P.useMemo)(()=>{if(C===0)return[];let e=new Map,t=Math.max(0,...H.map(o=>o.links)),s=Oe({ribbons:H.map(o=>({key:o.key,from:o.from,to:o.to,width:xe(o.links,t)})),plots:I,cell:C,tilt:F,labels:J});return H.flatMap(o=>{let l;if(o.from===o.to){let w=e.get(o.from)??0;e.set(o.from,w+1),l=Be(Se(I.get(o.from),w),{cell:C,tilt:F})}else l=s.get(o.key);return!l||l.length<2?[]:[{ribbon:o,points:l,d:Fe(l),middle:Ne(l),width:xe(o.links,t)}]})},[C,F,_,B,G,A,se]),de=(0,P.useRef)([]),X=(0,P.useRef)({x:0,y:0});if(X.current=p?{x:p.originX+i.x,y:p.originY+i.y}:{x:0,y:0},(0,P.useEffect)(()=>{let e=Z?.parentElement;if(!e||typeof window>"u")return;let t=0,s=null,o=()=>{t=0;let d=s;if(!d)return;let y=d.target;if(d.pointerType==="touch"||d.buttons!==0||y?.closest("[data-graview-view], button, a, input, select, textarea, [data-graview-overlay], [data-graview-offstage]")){h(null);return}let r=e.getBoundingClientRect(),v=d.clientX-r.left-X.current.x,M=d.clientY-r.top-X.current.y,x=null,D=1/0;for(let $ of de.current){let f=qe($.points,v,M);f<=$.reach&&f<D&&(D=f,x=$.key)}h(x)},l=d=>{s=d,t===0&&(t=requestAnimationFrame(o))},w=()=>h(null);return e.addEventListener("pointermove",l,{passive:!0}),e.addEventListener("pointerleave",w),()=>{t!==0&&cancelAnimationFrame(t),e.removeEventListener("pointermove",l),e.removeEventListener("pointerleave",w)}},[Z]),!p||!k.overview||V.length===0)return null;let O=Ee(b,k,N);if(O.records.length>0||O.lens!==null)return null;let T=O.districts.length>0?V.filter(({ribbon:e})=>O.districts.includes(e.from)||O.districts.includes(e.to)):V;if(T.length===0)return null;let te=L??null,Y=T.find(({ribbon:e})=>e.key===ce);de.current=T.map(({ribbon:e,points:t,width:s})=>({key:e.key,points:t,reach:s/2+6}));let K={x:p.originX+i.x,y:p.originY+i.y},n=`translate(${K.x.toFixed(1)} ${K.y.toFixed(1)})`;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("svg",{ref:ue,className:"graview-ribbons","aria-hidden":"true","data-graview-world":"","data-graview-ribbons":T.length,width:m,height:u,style:{position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible"},children:(0,S.jsx)("g",{transform:n,children:T.map(({ribbon:e,d:t,width:s})=>{let o=ce===e.key||te!==null&&te===e.edge||O.districts.length>0,l=te!==null&&te!==e.edge;return(0,S.jsx)("g",{className:"graview-ribbon","data-graview-ribbon":e.edge,"data-graview-from":`kind:${e.from}`,"data-graview-to":`kind:${e.to}`,"data-graview-links":e.links,"data-graview-lit":o&&!l?"":void 0,"data-graview-receded":l?"":void 0,children:(0,S.jsx)("path",{className:"graview-ribbon-band",d:t,style:{strokeWidth:s}})},e.key)})})}),Y?(0,S.jsx)("div",{className:"graview-ribbon-said","data-graview-world":"","data-testid":"ribbon-said",role:"status",style:{position:"absolute",left:K.x+Y.middle.x,top:K.y+Y.middle.y,pointerEvents:"none"},children:Re(a.schema,Y.ribbon)}):null]})}function qe(c,m,u){let i=1/0;for(let a=1;a<c.length;a++){let g=c[a-1],b=c[a],k=b.x-g.x,L=b.y-g.y,A=k*k+L*L,G=A===0?0:Math.max(0,Math.min(1,((m-g.x)*k+(u-g.y)*L)/A));i=Math.min(i,Math.hypot(m-(g.x+G*k),u-(g.y+G*L)))}return i}export{Ue as Ribbons,qe as distanceTo};
@@ -0,0 +1 @@
1
+ import{a as v,b as m,c as h}from"./chunk.MB7LKKUD.js";import"./chunk.FNXW46U4.js";import{Ea as p,G as N,Ga as b,R as u}from"./chunk.4JWT6LIS.js";import"./chunk.SDO3U72B.js";import{wc as f}from"./chunk.AW2T3KFV.js";import"./chunk.2AZTW66C.js";import{b as c}from"./chunk.AJZBJBMO.js";var l=c(N(),1);var o=c(u(),1);function z({notices:r,anchor:n,board:a}){return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(w,{notices:r.filter(i=>i.kind==="banner"),at:"top",anchor:n,board:a}),(0,o.jsx)(w,{notices:r.filter(i=>i.kind==="toast"),at:"foot",anchor:n,board:a})]})}var y={info:"var(--graview-accent)",good:"var(--graview-good)",warn:"var(--graview-warn)",bad:"var(--graview-bad)"};function w({notices:r,at:n,anchor:a,board:i}){let s=(0,l.useRef)(null),t=r.length>0;return(0,l.useLayoutEffect)(()=>{let e=s.current;if(!t||!e)return;if(typeof e.showPopover=="function"&&!p(e))try{e.showPopover()}catch{}let d=()=>(n==="top"?h:m)(e,a());d(),n==="foot"&&i.hold?.(()=>e.matches(":hover, :focus-within"));let S=b(e);addEventListener("resize",d),addEventListener("scroll",d,!0),n==="foot"&&addEventListener(v,d);let g=typeof ResizeObserver=="function"?new ResizeObserver(d):null;return g?.observe(e),()=>{if(S(),g?.disconnect(),removeEventListener("resize",d),removeEventListener("scroll",d,!0),removeEventListener(v,d),e.isConnected&&p(e))try{e.hidePopover()}catch{}}},[t,n,a,i]),t?(0,o.jsx)("div",{ref:s,popover:"manual",role:"region","aria-label":n==="top"?"Notices":"Messages","data-testid":n==="top"?"notices-banners":"notices-toasts","data-graview-offstage":"",style:{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:f("toast"),width:"max-content",height:"auto",maxWidth:"min(560px, calc(100vw - 32px))",display:"grid",gap:8,color:"var(--graview-ink)"},children:r.map(e=>(0,o.jsx)(T,{notice:e,board:i},e.id))}):null}function T({notice:r,board:n}){let a=r.tone??"info",i=[...r.action?[r.action]:[],...r.actions??[]],s=()=>n.dismiss(r.id);return(0,o.jsxs)("div",{"data-testid":"notice","data-kind":r.kind,"data-tone":a,style:{boxSizing:"border-box",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px 12px",padding:r.kind==="banner"?"8px 10px 8px 14px":"10px 12px 10px 14px",borderRadius:"var(--graview-radius, 12px)",borderTop:"1px solid var(--graview-edge)",borderRight:"1px solid var(--graview-edge)",borderBottom:"1px solid var(--graview-edge)",borderLeft:`3px solid ${y[a]}`,background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,o.jsx)("span",{"aria-hidden":"true",style:{width:7,height:7,borderRadius:999,flex:"0 0 auto",background:y[a]}}),(0,o.jsx)("span",{style:{flex:"1 1 16rem",minWidth:0},children:r.sentence}),i.length>0?(0,o.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:6},children:i.map((t,e)=>t.href!==void 0?(0,o.jsx)("a",{href:t.href,...t.target?{target:t.target,rel:"noopener"}:{},"data-testid":"notice-action",onClick:()=>{t.onSelect?.(),s()},style:{...x,...e===0?k:{}},children:t.label},t.label):(0,o.jsx)("button",{type:"button","data-testid":"notice-action",onClick:()=>{s(),t.onSelect?.()},style:{...x,...e===0?k:{}},children:t.label},t.label))}):null,(0,o.jsx)("button",{type:"button","data-testid":"notice-dismiss","aria-label":`Dismiss: ${r.sentence}`,title:"Dismiss",onClick:s,style:E,children:"\xD7"})]})}var x={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 12px",borderRadius:9,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",font:"inherit",fontWeight:500,textDecoration:"none",cursor:"pointer"},k={background:"var(--graview-accent)",borderColor:"var(--graview-accent)",color:"var(--graview-accent-ink)"},E={minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",fontSize:"1rem",cursor:"pointer"};export{z as NoticeStacks};
@@ -0,0 +1 @@
1
+ import{a as n}from"./chunk.2EXY4AHX.js";import"./chunk.OAWAUB4P.js";import"./chunk.PSTE3LZL.js";import"./chunk.UGFDSE37.js";import{l as s}from"./chunk.JGYGSNQY.js";import"./chunk.JLOSQ5UY.js";import"./chunk.FNF6XQI5.js";import"./chunk.LUPBT6YM.js";import"./chunk.IBWPRK2R.js";import"./chunk.RNUGQRJI.js";import"./chunk.6NFR2LYQ.js";import"./chunk.PXQVXBNG.js";import"./chunk.YERDP6YF.js";import"./chunk.P5K7EYDK.js";import"./chunk.7AEE3VHC.js";import"./chunk.U3CV5CCL.js";import"./chunk.LKF4BBCW.js";import"./chunk.NPS2WN7T.js";import"./chunk.JUT2VCFW.js";import"./chunk.HKD5SR45.js";import"./chunk.JEMQ66FT.js";import"./chunk.7UV7ODXU.js";import"./chunk.IIB22IIP.js";import"./chunk.MWUP5X47.js";import"./chunk.OGF6UORU.js";import"./chunk.UT6642FC.js";import"./chunk.WE5SA6TP.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.ESU2DD3J.js";import"./chunk.PL2P2OON.js";import"./chunk.27ZVVPRZ.js";import"./chunk.IN4PKQO5.js";import"./chunk.3IUJ4GW7.js";import"./chunk.UG23RICT.js";import"./chunk.GZHZLJBF.js";import"./chunk.ATKKTPJS.js";import"./chunk.OJGHDWI6.js";import"./chunk.UZSZPMRC.js";import"./chunk.MZOIPCDA.js";import"./chunk.KERLVJ6I.js";import"./chunk.4EPT2CQG.js";import"./chunk.FNXW46U4.js";import{G as y,R as i}from"./chunk.4JWT6LIS.js";import"./chunk.SDO3U72B.js";import"./chunk.AW2T3KFV.js";import"./chunk.2AZTW66C.js";import{b as r}from"./chunk.AJZBJBMO.js";var c=r(y(),1),e=r(i(),1);function v({store:d,views:t,as:a,scope:o}){let l=(0,c.useMemo)(()=>s({scope:`.${o}`}),[o]);return(0,e.jsxs)("div",{"data-testid":"embed-picture","data-embed-content":"",tabIndex:0,"aria-label":t.places().find(m=>m.as===a)?.title??"The picture",style:{flex:"1 1 auto",minHeight:0,display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",background:"var(--graview-ground)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)"},children:[(0,e.jsx)("style",{children:l}),(0,e.jsx)(n,{store:d,views:t,as:a})]})}export{v as PictureFace};
@@ -1,3 +1,3 @@
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{G as f,R as u,oa as y}from"./chunk.JE4QQEJE.js";import{b as m}from"./chunk.AJZBJBMO.js";var d=m(f(),1),n=m(u(),1),c=/^\s*(\d{1,6})[.)]\s+(.*)$/s,S=/^\s*[-*•]\s+(.*)$/s;function h(o){let s=[];for(let p of o.replace(/\r\n?/g,`
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{G as f,R as u,oa as y}from"./chunk.4JWT6LIS.js";import{b as m}from"./chunk.AJZBJBMO.js";var d=m(f(),1),n=m(u(),1),c=/^\s*(\d{1,6})[.)]\s+(.*)$/s,S=/^\s*[-*•]\s+(.*)$/s;function h(o){let s=[];for(let p of o.replace(/\r\n?/g,`
2
2
  `).split(/\n[ \t]*\n+/)){let t=null,a=()=>{t&&(t.t==="p"?t.lines.length>0:t.items.length>0)&&s.push(t),t=null};for(let e of p.split(`
3
- `)){let i=c.exec(e),l=i?null:S.exec(e);if(i)t?.t!=="ol"&&(a(),t={t:"ol",start:Number(i[1]),items:[]}),t.items.push(i[2]);else if(l)t?.t!=="ul"&&(a(),t={t:"ul",items:[]}),t.items.push(l[1]);else if(t&&t.t!=="p"&&/^\s+\S/.test(e)){let r=t.items;r[r.length-1]=`${r[r.length-1]} ${e.trim()}`}else e.trim().length>0&&(t?.t!=="p"&&(a(),t={t:"p",lines:[]}),t.lines.push(e.trim()))}a()}return s}function T(o){return/[\r\n]/.test(o)}var k={display:"grid",gap:"0.7em",minWidth:0,overflowWrap:"anywhere"},x={margin:0},g={margin:0,paddingInlineStart:"1.6em",display:"grid",gap:"0.3em"},B=(0,d.lazy)(y(()=>(__graviewPreload(import.meta.url,["./chunk.4QEDYRES.js","./chunk.JE4QQEJE.js","./chunk.SDO3U72B.js","./chunk.UG727PEE.js","./chunk.AJZBJBMO.js"]),import("./chunk.P7ISPJAQ.js"))));function b({text:o,className:s,style:p,markdown:t,headingsFrom:a}){return t?(0,n.jsx)(d.Suspense,{fallback:(0,n.jsx)(b,{text:o,...s?{className:s}:{},...p?{style:p}:{}}),children:(0,n.jsx)(B,{text:o,...s?{className:s}:{},...p?{style:p}:{},...a?{headingsFrom:a}:{}})}):(0,n.jsx)("div",{"data-graview-text-body":"",...s?{className:s}:{},style:{...k,...p},children:h(o).map((e,i)=>e.t==="p"?(0,n.jsx)("p",{style:x,children:e.lines.map((l,r)=>(0,n.jsxs)("span",{children:[r>0?(0,n.jsx)("br",{}):null,l]},r))},i):e.t==="ol"?(0,n.jsx)("ol",{start:e.start,style:g,children:e.items.map((l,r)=>(0,n.jsx)("li",{children:l},r))},i):(0,n.jsx)("ul",{style:g,children:e.items.map((l,r)=>(0,n.jsx)("li",{children:l},r))},i))})}export{T as a,b};
3
+ `)){let i=c.exec(e),l=i?null:S.exec(e);if(i)t?.t!=="ol"&&(a(),t={t:"ol",start:Number(i[1]),items:[]}),t.items.push(i[2]);else if(l)t?.t!=="ul"&&(a(),t={t:"ul",items:[]}),t.items.push(l[1]);else if(t&&t.t!=="p"&&/^\s+\S/.test(e)){let r=t.items;r[r.length-1]=`${r[r.length-1]} ${e.trim()}`}else e.trim().length>0&&(t?.t!=="p"&&(a(),t={t:"p",lines:[]}),t.lines.push(e.trim()))}a()}return s}function T(o){return/[\r\n]/.test(o)}var k={display:"grid",gap:"0.7em",minWidth:0,overflowWrap:"anywhere"},x={margin:0},g={margin:0,paddingInlineStart:"1.6em",display:"grid",gap:"0.3em"},B=(0,d.lazy)(y(()=>(__graviewPreload(import.meta.url,["./chunk.FNXW46U4.js","./chunk.4JWT6LIS.js","./chunk.SDO3U72B.js","./chunk.AW2T3KFV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.Y2MIG2C2.js"))));function b({text:o,className:s,style:p,markdown:t,headingsFrom:a}){return t?(0,n.jsx)(d.Suspense,{fallback:(0,n.jsx)(b,{text:o,...s?{className:s}:{},...p?{style:p}:{}}),children:(0,n.jsx)(B,{text:o,...s?{className:s}:{},...p?{style:p}:{},...a?{headingsFrom:a}:{}})}):(0,n.jsx)("div",{"data-graview-text-body":"",...s?{className:s}:{},style:{...k,...p},children:h(o).map((e,i)=>e.t==="p"?(0,n.jsx)("p",{style:x,children:e.lines.map((l,r)=>(0,n.jsxs)("span",{children:[r>0?(0,n.jsx)("br",{}):null,l]},r))},i):e.t==="ol"?(0,n.jsx)("ol",{start:e.start,style:g,children:e.items.map((l,r)=>(0,n.jsx)("li",{children:l},r))},i):(0,n.jsx)("ul",{style:g,children:e.items.map((l,r)=>(0,n.jsx)("li",{children:l},r))},i))})}export{T as a,b};
@@ -1,4 +1,4 @@
1
- import"./chunk.4QEDYRES.js";import{R as o,_ as n}from"./chunk.JE4QQEJE.js";import"./chunk.SDO3U72B.js";import"./chunk.UG727PEE.js";import{b as t}from"./chunk.AJZBJBMO.js";var a=t(o(),1),d=[["waiting","Waiting"],["active","Under way: darker and taller"],["done","Done: flat and pale"],["flagged","A problem, or past its due date"],["recent","Changed since you were last here"],["own","Yours"]],g=i=>{let e=r=>`color-mix(in oklab,var(--graview-ink) ${r}%,var(--graview-panel))`;return`.graview-map-key{display:grid;gap:4px;padding:2px 4px 8px;margin-bottom:6px;border-bottom:1px solid var(--graview-edge);font-size:.8125rem;color:var(--graview-ink-muted)}
1
+ import"./chunk.FNXW46U4.js";import{R as o,_ as n}from"./chunk.4JWT6LIS.js";import"./chunk.SDO3U72B.js";import"./chunk.AW2T3KFV.js";import"./chunk.2AZTW66C.js";import{b as t}from"./chunk.AJZBJBMO.js";var a=t(o(),1),d=[["waiting","Waiting"],["active","Under way: darker and taller"],["done","Done: flat and pale"],["flagged","A problem, or past its due date"],["recent","Changed since you were last here"],["own","Yours"]],g=i=>{let e=r=>`color-mix(in oklab,var(--graview-ink) ${r}%,var(--graview-panel))`;return`.graview-map-key{display:grid;gap:4px;padding:2px 4px 8px;margin-bottom:6px;border-bottom:1px solid var(--graview-edge);font-size:.8125rem;color:var(--graview-ink-muted)}
2
2
  .graview-map-key>div{display:flex;align-items:center;gap:8px}
3
3
  .graview-map-key>div:first-child{color:var(--graview-ink)}
4
4
  .graview-map-key i{flex:none;width:14px;height:10px;border-radius:2px;background:${e(i?34:42)}}
@@ -1 +1 @@
1
- import{Aa as k,R as w,j as c,l as h,m as b,r as f,ya as y}from"./chunk.JE4QQEJE.js";import{U as i}from"./chunk.UG727PEE.js";import{b as g}from"./chunk.AJZBJBMO.js";var s=null,a=new Set,v=e=>{s={kind:e,n:(s?.n??0)+1};for(let t of a)t()},A=()=>s,C=e=>(a.add(e),()=>a.delete(e)),V=()=>{s=null};var d=g(w(),1);function T(e,t){if(e.length===0||t.length===0)return[];let o=new Set(t.map(n=>n.id));return e.filter(n=>n.nodeIds.some(l=>o.has(l)))}var x=(e,t)=>`${i(e)} ${e===1?"problem":"problems"} in ${t}`;function q({kind:e,plural:t,problems:o,flag:n,listed:l=!1}){let{view:p,go:P}=k(),{set:$}=y();if(o.length===0)return null;let u=x(o.length,t),m=o.length===1?"it":"them";return(0,d.jsx)("button",{type:"button",className:"graview-district-problems","data-testid":`district-problems-${e}`,"data-graview-problems":o.length,"aria-expanded":l,"aria-label":u,title:`${u} \u2014 ${o[0].message}${o.length>1?` (and ${i(o.length-1)} more)`:""}. Press to see ${m} and how to fix ${m}.`,onClick:r=>{r.stopPropagation(),p.overview||P(h(c(b(p,!0),null),"view",null)),$([f(e)]),v(e)},onDoubleClick:r=>r.stopPropagation(),onPointerDown:r=>r.stopPropagation(),children:(0,d.jsx)("span",{"aria-hidden":"true",children:`${n} ${i(o.length)}`})})}export{A as a,C as b,V as c,T as d,x as e,q as f};
1
+ import{Aa as k,R as w,j as c,l as h,m as b,r as f,ya as y}from"./chunk.4JWT6LIS.js";import{U as i}from"./chunk.AW2T3KFV.js";import{b as g}from"./chunk.AJZBJBMO.js";var s=null,a=new Set,v=e=>{s={kind:e,n:(s?.n??0)+1};for(let t of a)t()},A=()=>s,C=e=>(a.add(e),()=>a.delete(e)),V=()=>{s=null};var d=g(w(),1);function T(e,t){if(e.length===0||t.length===0)return[];let o=new Set(t.map(n=>n.id));return e.filter(n=>n.nodeIds.some(l=>o.has(l)))}var x=(e,t)=>`${i(e)} ${e===1?"problem":"problems"} in ${t}`;function q({kind:e,plural:t,problems:o,flag:n,listed:l=!1}){let{view:p,go:P}=k(),{set:$}=y();if(o.length===0)return null;let u=x(o.length,t),m=o.length===1?"it":"them";return(0,d.jsx)("button",{type:"button",className:"graview-district-problems","data-testid":`district-problems-${e}`,"data-graview-problems":o.length,"aria-expanded":l,"aria-label":u,title:`${u} \u2014 ${o[0].message}${o.length>1?` (and ${i(o.length-1)} more)`:""}. Press to see ${m} and how to fix ${m}.`,onClick:r=>{r.stopPropagation(),p.overview||P(h(c(b(p,!0),null),"view",null)),$([f(e)]),v(e)},onDoubleClick:r=>r.stopPropagation(),onPointerDown:r=>r.stopPropagation(),children:(0,d.jsx)("span",{"aria-hidden":"true",children:`${n} ${i(o.length)}`})})}export{A as a,C as b,V as c,T as d,x as e,q as f};
@@ -1 +1 @@
1
- import{a as I,b as H,c as T,e as D,h as V,i as R,j as A,k,l as x,n as Y,o as Z}from"./chunk.CAZX6OPN.js";import{b as U}from"./chunk.VTUMPH4Z.js";import{I as C,O as G,Va as F,X as M,Ya as B,ca as W,ea as j}from"./chunk.UG727PEE.js";function re(e,r){return e===void 0||e===!0?!0:e===!1?!1:e[r]!==!1}function te(e){let r={};return e.query&&e.query.trim().length>0&&(r.q=e.query),e.archived!==void 0&&e.archived!==!1&&(r.archived=String(e.archived)),e.sort&&(r.sort=e.sort.direction==="desc"?`${e.sort.by}:desc`:e.sort.by),e.filter?.length&&(r.filter=e.filter.map(n=>`${n.key}:${n.value}`).join(",")),e.group&&(r.group=e.group.bucket?`${e.group.by}:${e.group.bucket}`:e.group.by),r}function ne(e,r){let n=[],s={};if(e.query&&(s.query=e.query),e.archived!==void 0&&e.archived!==!1&&(s.archived=e.archived),e.sort&&(r.sorts.some(u=>u.key===e.sort.by)?s.sort=e.sort:n.push(`sort ${e.sort.by}`)),e.filter){let u=e.filter.filter(c=>r.filters.find(f=>f.key===c.key)?!0:(n.push(`filter ${c.key}`),!1));u.length>0&&(s.filter=u)}return e.group&&(r.groups.some(u=>u.key===e.group.by)?s.group=e.group:n.push(`group ${e.group.by}`)),{arrangement:s,dropped:n}}function S(e,r){return W(e.schema.tryDefinition(r.kind),A(r))}var oe=(e,r)=>e==null?r==null?0:1:r==null?-1:typeof e=="number"&&typeof r=="number"?e-r:typeof e=="boolean"&&typeof r=="boolean"?e===r?0:e?1:-1:String(e).localeCompare(String(r),void 0,{numeric:!0,sensitivity:"base"});function ie(e,r,n){if(n==="label")return S(e,r);let s=e.schema.tryDefinition(r.kind);return s&&n in(s.fields.shape??{})?F(R(r),n,e.today??C()):s?.computed?.[n]!==void 0?e.read?.(r,n):k(e.graph,r.id,n).map(c=>S(e,c)).sort()[0]}var se=/^(\d{4})-(\d{2})-(\d{2})/;function _(e,r){let n=se.exec(e);if(!n)return;let[,s,u,c]=n;if(r==="day")return`${s}-${u}-${c}`;if(r==="month")return`${s}-${u}-01`;if(r==="year")return`${s}-01-01`;if(r==="decade")return`${String(Number(s)-Number(s)%10).padStart(4,"0")}-01-01`;let a=new Date(Date.UTC(Number(s),Number(u)-1,Number(c))),f=(a.getUTCDay()+6)%7;return a.setUTCDate(a.getUTCDate()-f),a.toISOString().slice(0,10)}function de(e,r){return r==="month"?M(e):r==="week"?`Week of ${G(e)}`:r==="year"?e.slice(0,4):r==="decade"?`The ${e.slice(0,4)}s`:G(e)}function ue(e,r,n){return z(e,n)(r)}function z(e,r){let{words:n,conditions:s}=Y(r);if(n.length===0&&s.length===0)return()=>!0;let u=new Map,c=a=>{let f=u.get(a);return f||(f=new Set(D(e.schema,a).filters.map(d=>d.key)),u.set(a,f)),f};return a=>{let f=c(a.kind),d=s.filter(i=>f.has(i.key));return d.every(i=>x(e,a,i))?n.length>0?Z(e.schema.tryDefinition(a.kind),A(a),n,e.searchIn)!==void 0:d.length>0:!1}}function ae(e,r,n){let s=r.query?.trim(),u=r.archived===void 0?e:e.filter(t=>B(t,r.archived)),c=s?u.filter(z(n,s)):u,a=r.filter?.length?c.filter(t=>r.filter.every(l=>x(n,t,l))):[...c],f=[];for(let t=r.sort;t&&f.length<4;t=t.then)f.push(t);let d=f.length>0?a.map((t,l)=>({node:t,index:l,values:f.map(o=>ie(n,t,o.by))})).sort((t,l)=>{for(let[o,p]of f.entries()){let[h,K]=[t.values[o],l.values[o]],v=oe(h,K),E=p.direction==="desc"&&v!==0&&h!==void 0&&K!==void 0?-v:v;if(E!==0)return E}return t.index-l.index}).map(t=>t.node):a,i=r.group;if(!i)return{nodes:d,groups:[{key:"",label:"",nodes:d}],grouped:!1};let y=new Map,g=(t,l,o)=>{let p=y.get(t)??{label:l,nodes:[]};p.nodes.push(o),y.set(t,p)},N=d[0],m=N?n.schema.tryDefinition(N.kind):void 0,O=m?.fields.shape??{},J=m?I(m,i.by):j(i.by),$=i.by in O,b=$?H(O[i.by]):void 0,X=T(n.schema,N?.kind??"").find(t=>t.key===i.by)?.label,L=$?`No ${J.toLowerCase()}`:`Without ${(X??j(i.by)).toLowerCase()}`,q=$?new Map:U([...new Map(d.flatMap(t=>k(n.graph,t.id,i.by)).map(t=>[t.id,t])).values()].map(A),t=>n.schema.tryDefinition(t));for(let t of d){if($){let o=F(R(t),i.by,n.today??C());if(o==null||o==="")g("",L,t);else if(b==="date"){let p=i.bucket??"day",h=_(String(o),p);h?g(h,de(h,p),t):g("",L,t)}else if(b==="boolean")g(o?"1":"0",o?"Yes":"No",t);else{let p=m?.display?.format?.[i.by];g(String(o),p?p(o):String(o),t)}continue}let l=k(n.graph,t.id,i.by).map(o=>({id:o.id,label:q.has(o.id)?`${S(n,o)} \xB7 ${q.get(o.id)}`:S(n,o)})).sort((o,p)=>o.label.localeCompare(p.label));l.length===0?g("",L,t):g(l.map(o=>o.id).join(","),l.map(o=>o.label).join(", "),t)}let w=b==="choice"?V(O[i.by]):void 0,ee=[...y.entries()].sort(([t,l],[o,p])=>t===""?1:o===""?-1:w?w.indexOf(t)-w.indexOf(o):b==="boolean"?o.localeCompare(t):b==="date"?t.localeCompare(o):l.label.localeCompare(p.label)).map(([t,l])=>({key:t,label:l.label,nodes:l.nodes}));return{nodes:d,groups:ee,grouped:!0}}function P(e){if(e===void 0)return;if(typeof e=="string")return{by:e,direction:"asc"};let r=e.then===void 0?void 0:typeof e.then=="string"?{by:e.then,direction:"asc"}:{by:e.then.by,direction:e.then.direction??"asc"};return{by:e.by,direction:e.direction??"asc",...r?{then:r}:{}}}function Q(e){if(e!==void 0)return typeof e=="string"?{by:e}:e}function fe(e){let r=P(e?.sort),n=Q(e?.group);if(!(!r&&!n))return{...r?{sort:r}:{},...n?{group:{by:n.by}}:{}}}var le=(e,r)=>r?e==="1"?"true":"false":e;function ce(e,r,n){let s=n.type==="boolean",u=s?["true","false"]:n.options??[],c=[...new Set([...(r.order??[]).filter(d=>u.includes(d)),...u])],a=r.closed??[],f=d=>{if(d.key==="")return[1,0];let i=le(d.key,s);if(a.includes(i))return[2,a.indexOf(i)];let y=c.indexOf(i);return[0,y<0?c.length:y]};return e.map((d,i)=>({group:d,at:i,rank:f(d)})).sort((d,i)=>d.rank[0]-i.rank[0]||d.rank[1]-i.rank[1]||d.at-i.at).map(({group:d,rank:i})=>({...d,closed:i[0]===2}))}export{Q as a,fe as b,ce as c,re as d,te as e,ne as f,ue as g,ae as h};
1
+ import{a as I,b as H,c as T,e as D,h as V,i as R,j as A,k,l as x,n as Y,o as Z}from"./chunk.MWUP5X47.js";import{b as U}from"./chunk.KERLVJ6I.js";import{I as C,O as G,Va as F,X as M,Ya as B,ca as W,ea as j}from"./chunk.AW2T3KFV.js";function re(e,r){return e===void 0||e===!0?!0:e===!1?!1:e[r]!==!1}function te(e){let r={};return e.query&&e.query.trim().length>0&&(r.q=e.query),e.archived!==void 0&&e.archived!==!1&&(r.archived=String(e.archived)),e.sort&&(r.sort=e.sort.direction==="desc"?`${e.sort.by}:desc`:e.sort.by),e.filter?.length&&(r.filter=e.filter.map(n=>`${n.key}:${n.value}`).join(",")),e.group&&(r.group=e.group.bucket?`${e.group.by}:${e.group.bucket}`:e.group.by),r}function ne(e,r){let n=[],s={};if(e.query&&(s.query=e.query),e.archived!==void 0&&e.archived!==!1&&(s.archived=e.archived),e.sort&&(r.sorts.some(u=>u.key===e.sort.by)?s.sort=e.sort:n.push(`sort ${e.sort.by}`)),e.filter){let u=e.filter.filter(c=>r.filters.find(f=>f.key===c.key)?!0:(n.push(`filter ${c.key}`),!1));u.length>0&&(s.filter=u)}return e.group&&(r.groups.some(u=>u.key===e.group.by)?s.group=e.group:n.push(`group ${e.group.by}`)),{arrangement:s,dropped:n}}function S(e,r){return W(e.schema.tryDefinition(r.kind),A(r))}var oe=(e,r)=>e==null?r==null?0:1:r==null?-1:typeof e=="number"&&typeof r=="number"?e-r:typeof e=="boolean"&&typeof r=="boolean"?e===r?0:e?1:-1:String(e).localeCompare(String(r),void 0,{numeric:!0,sensitivity:"base"});function ie(e,r,n){if(n==="label")return S(e,r);let s=e.schema.tryDefinition(r.kind);return s&&n in(s.fields.shape??{})?F(R(r),n,e.today??C()):s?.computed?.[n]!==void 0?e.read?.(r,n):k(e.graph,r.id,n).map(c=>S(e,c)).sort()[0]}var se=/^(\d{4})-(\d{2})-(\d{2})/;function _(e,r){let n=se.exec(e);if(!n)return;let[,s,u,c]=n;if(r==="day")return`${s}-${u}-${c}`;if(r==="month")return`${s}-${u}-01`;if(r==="year")return`${s}-01-01`;if(r==="decade")return`${String(Number(s)-Number(s)%10).padStart(4,"0")}-01-01`;let a=new Date(Date.UTC(Number(s),Number(u)-1,Number(c))),f=(a.getUTCDay()+6)%7;return a.setUTCDate(a.getUTCDate()-f),a.toISOString().slice(0,10)}function de(e,r){return r==="month"?M(e):r==="week"?`Week of ${G(e)}`:r==="year"?e.slice(0,4):r==="decade"?`The ${e.slice(0,4)}s`:G(e)}function ue(e,r,n){return z(e,n)(r)}function z(e,r){let{words:n,conditions:s}=Y(r);if(n.length===0&&s.length===0)return()=>!0;let u=new Map,c=a=>{let f=u.get(a);return f||(f=new Set(D(e.schema,a).filters.map(d=>d.key)),u.set(a,f)),f};return a=>{let f=c(a.kind),d=s.filter(i=>f.has(i.key));return d.every(i=>x(e,a,i))?n.length>0?Z(e.schema.tryDefinition(a.kind),A(a),n,e.searchIn)!==void 0:d.length>0:!1}}function ae(e,r,n){let s=r.query?.trim(),u=r.archived===void 0?e:e.filter(t=>B(t,r.archived)),c=s?u.filter(z(n,s)):u,a=r.filter?.length?c.filter(t=>r.filter.every(l=>x(n,t,l))):[...c],f=[];for(let t=r.sort;t&&f.length<4;t=t.then)f.push(t);let d=f.length>0?a.map((t,l)=>({node:t,index:l,values:f.map(o=>ie(n,t,o.by))})).sort((t,l)=>{for(let[o,p]of f.entries()){let[h,K]=[t.values[o],l.values[o]],v=oe(h,K),E=p.direction==="desc"&&v!==0&&h!==void 0&&K!==void 0?-v:v;if(E!==0)return E}return t.index-l.index}).map(t=>t.node):a,i=r.group;if(!i)return{nodes:d,groups:[{key:"",label:"",nodes:d}],grouped:!1};let y=new Map,g=(t,l,o)=>{let p=y.get(t)??{label:l,nodes:[]};p.nodes.push(o),y.set(t,p)},N=d[0],m=N?n.schema.tryDefinition(N.kind):void 0,O=m?.fields.shape??{},J=m?I(m,i.by):j(i.by),$=i.by in O,b=$?H(O[i.by]):void 0,X=T(n.schema,N?.kind??"").find(t=>t.key===i.by)?.label,L=$?`No ${J.toLowerCase()}`:`Without ${(X??j(i.by)).toLowerCase()}`,q=$?new Map:U([...new Map(d.flatMap(t=>k(n.graph,t.id,i.by)).map(t=>[t.id,t])).values()].map(A),t=>n.schema.tryDefinition(t));for(let t of d){if($){let o=F(R(t),i.by,n.today??C());if(o==null||o==="")g("",L,t);else if(b==="date"){let p=i.bucket??"day",h=_(String(o),p);h?g(h,de(h,p),t):g("",L,t)}else if(b==="boolean")g(o?"1":"0",o?"Yes":"No",t);else{let p=m?.display?.format?.[i.by];g(String(o),p?p(o):String(o),t)}continue}let l=k(n.graph,t.id,i.by).map(o=>({id:o.id,label:q.has(o.id)?`${S(n,o)} \xB7 ${q.get(o.id)}`:S(n,o)})).sort((o,p)=>o.label.localeCompare(p.label));l.length===0?g("",L,t):g(l.map(o=>o.id).join(","),l.map(o=>o.label).join(", "),t)}let w=b==="choice"?V(O[i.by]):void 0,ee=[...y.entries()].sort(([t,l],[o,p])=>t===""?1:o===""?-1:w?w.indexOf(t)-w.indexOf(o):b==="boolean"?o.localeCompare(t):b==="date"?t.localeCompare(o):l.label.localeCompare(p.label)).map(([t,l])=>({key:t,label:l.label,nodes:l.nodes}));return{nodes:d,groups:ee,grouped:!0}}function P(e){if(e===void 0)return;if(typeof e=="string")return{by:e,direction:"asc"};let r=e.then===void 0?void 0:typeof e.then=="string"?{by:e.then,direction:"asc"}:{by:e.then.by,direction:e.then.direction??"asc"};return{by:e.by,direction:e.direction??"asc",...r?{then:r}:{}}}function Q(e){if(e!==void 0)return typeof e=="string"?{by:e}:e}function fe(e){let r=P(e?.sort),n=Q(e?.group);if(!(!r&&!n))return{...r?{sort:r}:{},...n?{group:{by:n.by}}:{}}}var le=(e,r)=>r?e==="1"?"true":"false":e;function ce(e,r,n){let s=n.type==="boolean",u=s?["true","false"]:n.options??[],c=[...new Set([...(r.order??[]).filter(d=>u.includes(d)),...u])],a=r.closed??[],f=d=>{if(d.key==="")return[1,0];let i=le(d.key,s);if(a.includes(i))return[2,a.indexOf(i)];let y=c.indexOf(i);return[0,y<0?c.length:y]};return e.map((d,i)=>({group:d,at:i,rank:f(d)})).sort((d,i)=>d.rank[0]-i.rank[0]||d.rank[1]-i.rank[1]||d.at-i.at).map(({group:d,rank:i})=>({...d,closed:i[0]===2}))}export{Q as a,fe as b,ce as c,re as d,te as e,ne as f,ue as g,ae as h};
@@ -1 +1 @@
1
- import{g as a}from"./chunk.J7ZMNAWB.js";import{c as p}from"./chunk.VKJAGZNU.js";import{Fa as d}from"./chunk.UG727PEE.js";function v(n){let r=new Map;for(let i of n.kinds){let e=n.tryDefinition(i),o=a(e),s=d(e);r.set(i,{fields:new Set(Object.keys(e?.fields?.shape??{})),edges:new Map(Object.entries(e?.edges??{}).map(([l,h])=>[l,h.cardinality??"many"])),...o?{computed:o}:{},...s.size>0?{linked:s}:{}})}let t=a(n);return t&&r.set(p,{computed:t}),r}export{v as a};
1
+ import{g as a}from"./chunk.3IUJ4GW7.js";import{c as p}from"./chunk.UG23RICT.js";import{Fa as d}from"./chunk.AW2T3KFV.js";function v(n){let r=new Map;for(let i of n.kinds){let e=n.tryDefinition(i),o=a(e),s=d(e);r.set(i,{fields:new Set(Object.keys(e?.fields?.shape??{})),edges:new Map(Object.entries(e?.edges??{}).map(([l,h])=>[l,h.cardinality??"many"])),...o?{computed:o}:{},...s.size>0?{linked:s}:{}})}let t=a(n);return t&&r.set(p,{computed:t}),r}export{v as a};
@@ -0,0 +1,6 @@
1
+ import{g as z,h as D,i as H}from"./chunk.PSTE3LZL.js";import{a as P,b as A,c as p,d as W}from"./chunk.UGFDSE37.js";import"./chunk.JGYGSNQY.js";import"./chunk.JLOSQ5UY.js";import"./chunk.FNF6XQI5.js";import"./chunk.LUPBT6YM.js";import"./chunk.IBWPRK2R.js";import"./chunk.RNUGQRJI.js";import"./chunk.6NFR2LYQ.js";import"./chunk.YERDP6YF.js";import"./chunk.P5K7EYDK.js";import"./chunk.7AEE3VHC.js";import"./chunk.U3CV5CCL.js";import"./chunk.LKF4BBCW.js";import"./chunk.NPS2WN7T.js";import"./chunk.JUT2VCFW.js";import"./chunk.HKD5SR45.js";import"./chunk.JEMQ66FT.js";import"./chunk.7UV7ODXU.js";import"./chunk.IIB22IIP.js";import"./chunk.MWUP5X47.js";import{a as C,b as O}from"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.ESU2DD3J.js";import"./chunk.PL2P2OON.js";import"./chunk.27ZVVPRZ.js";import"./chunk.IN4PKQO5.js";import"./chunk.3IUJ4GW7.js";import"./chunk.UG23RICT.js";import"./chunk.GZHZLJBF.js";import"./chunk.ATKKTPJS.js";import"./chunk.OJGHDWI6.js";import"./chunk.UZSZPMRC.js";import"./chunk.MZOIPCDA.js";import"./chunk.KERLVJ6I.js";import"./chunk.4EPT2CQG.js";import"./chunk.FNXW46U4.js";import{Ea as k,G as B,R as L}from"./chunk.4JWT6LIS.js";import"./chunk.SDO3U72B.js";import{wc as R}from"./chunk.AW2T3KFV.js";import"./chunk.2AZTW66C.js";import{b as E}from"./chunk.AJZBJBMO.js";var r=E(B(),1);var s=E(L(),1);function M(c){let e=document.activeElement;if(e!==null&&e!==document.body&&e!==document.documentElement&&e.isConnected)return;let n=c??document,o=n.querySelector("main")??n.querySelector("[data-graview-page]")??null,t=n.querySelector("[data-graview-page-title]")??o?.querySelector("h1, h2")??o;t instanceof HTMLElement&&(t.hasAttribute("tabindex")||t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0}))}var I=1500;function N(c,e,n){let{store:o,principal:t}=c,l=z(o),g=(0,r.useMemo)(()=>P(o,t),[o,t,l]),w=(0,r.useRef)(n),[b,d]=(0,r.useState)(),[y,u]=(0,r.useState)("");(0,r.useEffect)(()=>{let a=A(o,t,w.current);w.current=o.batches().length,a&&(d({batch:a.batch,at:e,when:Date.now()}),u(""))},[o,t,l]),(0,r.useEffect)(()=>{d(a=>!a||a.at===e?a:Date.now()-a.when<I?{...a,at:e}:void 0)},[e]);let[x,i]=(0,r.useState)(null),v=(0,r.useCallback)(()=>{d(void 0),i(null)},[]),f=(0,r.useCallback)(()=>{i(null);try{let a=W(o,t);a&&u(`Took back \u201C${a.intent}\u201D`)}catch(a){i(a instanceof Error?a.message:String(a))}},[o,t]),S=g&&b?.batch===g.batch&&b.at===e?g:void 0;return{change:g,offered:S,close:v,takeBack:f,refused:x,said:y}}function ee({context:c,docked:e,at:n,since:o,compact:t=!1,className:l,size:g}){let{change:w,offered:b,close:d,takeBack:y,refused:u,said:x}=N(c,n,o),i=e?b:w,v=(0,r.useRef)(null),f=e&&(i!==void 0||u!==null);j(v,f),(0,r.useEffect)(()=>{if(!f)return;let m,h=()=>m=setTimeout(()=>v.current?.matches(":hover, :focus-within")?h():d(),1e4);return h(),()=>clearTimeout(m)},[f,i?.batch,u,d]);let S=x||(e&&i?p(i):""),a=e?{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:R("toast"),width:"max-content",height:"auto",bottom:"calc(16px + env(safe-area-inset-bottom, 0px))",left:16,justifyItems:"start",color:"var(--graview-ink)",...f?{}:{display:"none"}}:{},T=i?(0,s.jsxs)("button",{type:"button","data-testid":"page-undo",title:`${p(i)} \u2014 \u2318Z or Ctrl+Z`,"aria-keyshortcuts":"Meta+Z Control+Z",onClick:m=>{let h=m.currentTarget.closest("[data-graview-face]");y(),requestAnimationFrame(()=>M(h))},...e?{style:U}:{className:H("graview-undo",l),...D(g),...t?{"data-compact":"","aria-label":p(i)}:{}},children:[(0,s.jsx)("span",{"aria-hidden":"true",children:"\u21B6"}),e?(0,s.jsx)("span",{style:K,children:p(i)}):(0,s.jsx)("span",{className:"graview-undo-words",children:t?"Undo":p(i)})]}):null;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{role:"status","aria-live":"polite",style:V,children:S}),(0,s.jsxs)("div",{ref:v,...e?{popover:"manual","data-graview-foot":"","data-graview-offstage":""}:{},"data-testid":e?"face-undo-dock":"page-undo-place",...e?{style:{...F,...a}}:{className:"graview-undo-place"},children:[e?null:(0,s.jsx)("style",{children:q}),e&&i?(0,s.jsxs)("div",{"data-testid":"page-undo-notice",style:Z,children:[T,(0,s.jsx)("button",{type:"button","data-testid":"page-undo-dismiss","aria-label":`Dismiss: ${p(i)}`,title:"Dismiss",onClick:m=>{let h=m.currentTarget.closest("[data-graview-face]");d(),requestAnimationFrame(()=>M(h))},style:$,children:"\xD7"})]}):T,u?(0,s.jsx)("span",{"data-testid":"page-undo-refused",role:"alert",className:"graview-undo-refused",...e?{style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-warn)",borderRadius:6,background:"var(--graview-float)",padding:"4px 8px"}}:{},children:u}):null]})]})}function j(c,e){(0,r.useLayoutEffect)(()=>{let n=c.current;if(!n||!e)return;if(typeof n.showPopover=="function"&&!k(n))try{n.showPopover()}catch{}let o=()=>n.parentElement?.closest("[data-embed-content]")??null,t=()=>{O(n,o()),dispatchEvent(new Event(C))};t(),addEventListener("resize",t),addEventListener("scroll",t,!0);let l=typeof ResizeObserver=="function"?new ResizeObserver(t):null;return l?.observe(n),()=>{if(l?.disconnect(),removeEventListener("resize",t),removeEventListener("scroll",t,!0),n.isConnected&&k(n))try{n.hidePopover()}catch{}dispatchEvent(new Event(C))}},[c,e])}var q=`:where(.graview-undo-place){display:grid;justify-items:end;gap:4px;max-width:100%;min-width:0}
2
+ :where(.graview-undo){box-sizing:border-box;display:inline-flex;align-items:center;gap:6px;min-height:var(--graview-control-height,36px);max-width:min(100%,var(--graview-undo-widest,18rem));min-width:0;padding:0 14px;border-radius:999px;border:1px solid var(--graview-edge);background:var(--graview-float);color:var(--graview-ink);font:inherit;font-size:.875rem;cursor:pointer}
3
+ :where(.graview-undo[data-size=sm]){--graview-control-height:30px}
4
+ :where(.graview-undo[data-compact]){padding:0 10px}
5
+ :where(.graview-undo-words){min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
6
+ :where(.graview-undo-refused){font-size:.8125rem;line-height:1.4;color:var(--graview-warn);border-radius:6px}`,F={display:"grid",justifyItems:"end",gap:4,maxWidth:"100%",minWidth:0},U={display:"inline-flex",alignItems:"center",gap:6,minHeight:36,maxWidth:"100%",minWidth:0,borderRadius:999,font:"inherit",fontSize:"0.875rem",cursor:"pointer",textAlign:"start",lineHeight:1.4,padding:"8px 4px 8px 14px",border:"none",background:"none",color:"inherit"},Z={display:"flex",alignItems:"center",gap:2,maxWidth:"100%",minWidth:0,paddingRight:6,borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},$={flex:"0 0 auto",minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"1rem",cursor:"pointer"},K={minWidth:0,overflow:"hidden",overflowWrap:"anywhere",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:4},V={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};export{ee as TakeBack};
@@ -1 +1 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as y}from"./chunk.U6YOAS4X.js";import{D as v,G as I,R as h,_ as w}from"./chunk.JE4QQEJE.js";import{Wa as g}from"./chunk.UG727PEE.js";import{b as d}from"./chunk.AJZBJBMO.js";var k=d(I(),1);var t=d(h(),1),r={display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem"};function E({shows:e,onShows:i,mine:a,onMine:l}){let o={all:"All",changes:"Changes",ai:"AI"};return(0,t.jsxs)("div",{"data-testid":"activity-filter",role:"group","aria-label":"Show",style:{display:"flex",flexWrap:"wrap",gap:4,alignItems:"center"},children:[["all","changes","ai"].map(s=>(0,t.jsx)("button",{type:"button","data-shows":s,"aria-pressed":e===s,onClick:()=>i(s),style:{...r,...e===s?{borderColor:"var(--graview-accent)",color:"var(--graview-ink)"}:{}},children:o[s]},s)),(0,t.jsx)("button",{type:"button","data-testid":"activity-mine","aria-pressed":a,onClick:()=>l(!a),style:{...r,marginLeft:"auto",...a?{borderColor:"var(--graview-accent)",color:"var(--graview-ink)"}:{}},children:"Just mine"})]})}var x=e=>e.ask.kind==="suggest"?"suggest":e.ask.kind==="fill"?"fill in":e.ask.kind==="record"?"add one":e.ask.kind==="panel"?"draw a panel":`answer \u201C${e.ask.said}\u201D`;function $(e){let i=e.offered.filter(a=>e.accepted?.includes(a.id)).map(a=>a.label);switch(e.outcome){case"accepted":return i.length>0?`Took ${i.join(", ")}`:"Taken";case"partly":return`Took ${i.length} of ${e.offered.length}: ${i.join(", ")}`;case"dismissed":return"Dismissed";case"drawn":return e.panel?`Drew \u201C${e.panel.title}\u201D`:"Drew a panel";case"failed":return e.failed??"Failed";default:return"Offered, not yet taken"}}function C(e){let i=[...new Set((e.usage??[]).map(o=>o.model))];if(i.length===0)return null;let a=(e.usage??[]).flatMap(o=>o.costUsd===void 0?[]:[o.costUsd]),l=a.length>0?a.reduce((o,s)=>o+s,0):void 0;return`${i.join(", ")}${l!==void 0?` \xB7 $${l<.01?l.toPrecision(2):l.toFixed(2)}`:""}`}function F({entry:e,undo:i}){let{store:a,principal:l,seats:o,people:s,ai:b}=w(),c=y(),[p,u]=(0,k.useState)(!1),A=e.by.kind==="human"&&e.by.onBehalfOf===void 0&&(e.by.id===void 0||l.id===void 0||e.by.id===l.id)?"you":g(e.by,{graph:a.graph,schema:a.schema,seats:o,people:s}),f=C(e),S=v(b),m=n=>{u(!0),(__graviewPreload(import.meta.url,["./chunk.LWAZ6ZO6.js","./chunk.V5VQCANB.js","./chunk.UT6642FC.js","./chunk.WERBD5ZR.js","./chunk.HAY22FPJ.js","./chunk.U6YOAS4X.js","./chunk.TI4OSTQV.js","./chunk.BZ4VZ6WQ.js","./chunk.LFJH6X6O.js","./chunk.VTUMPH4Z.js","./chunk.PCTVLNOS.js","./chunk.4QEDYRES.js","./chunk.JE4QQEJE.js","./chunk.SDO3U72B.js","./chunk.UG727PEE.js","./chunk.AJZBJBMO.js"]),import("./chunk.BJET6KOG.js")).then(n).finally(()=>u(!1))};return(0,t.jsxs)("li",{"data-testid":"activity-interaction","data-interaction":e.id,"data-outcome":e.outcome,style:{display:"grid",gap:3,lineHeight:1.45},children:[(0,t.jsx)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:(0,t.jsxs)("span",{style:{minWidth:0},children:[(0,t.jsx)("strong",{style:{fontWeight:600},children:A})," ",(0,t.jsxs)("span",{style:{color:"var(--graview-ink-muted)"},children:["asked AI to ",x(e)]}),(0,t.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",e.targetLabel]})]})}),e.offered.length>0&&e.outcome!=="accepted"&&e.outcome!=="partly"?(0,t.jsxs)("div",{"data-testid":"interaction-offered",style:{color:"var(--graview-ink-muted)"},children:["Offered ",e.offered.map(n=>n.label).join(", ")]}):null,(0,t.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6,flexWrap:"wrap"},children:[(0,t.jsx)("span",{"data-testid":"interaction-outcome",style:{color:e.outcome==="failed"?"var(--graview-warn)":"var(--graview-ink)"},children:$(e)}),(e.batches??[]).map(n=>(0,t.jsx)("span",{"data-interaction-batch":n,style:{marginLeft:"auto"},children:i(n)},n))]}),f?(0,t.jsx)("div",{"data-testid":"interaction-model",style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:f}):null,S?(0,t.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[e.panel?(0,t.jsx)("button",{type:"button","data-testid":"interaction-reopen",disabled:p,onClick:()=>m(n=>n.drawPanel(c,e.panel)),style:r,children:"Show the panel"}):null,(0,t.jsx)("button",{type:"button","data-testid":"interaction-again",disabled:p,onClick:()=>m(n=>n.askAgain(c,e)),style:r,children:"Ask again"})]}):null]})}export{E as a,F as b};
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 y}from"./chunk.QNJYXB3U.js";import{D as v,G as I,R as h,_ as w}from"./chunk.4JWT6LIS.js";import{Wa as g}from"./chunk.AW2T3KFV.js";import{b as d}from"./chunk.AJZBJBMO.js";var k=d(I(),1);var t=d(h(),1),r={display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem"};function E({shows:e,onShows:i,mine:a,onMine:l}){let o={all:"All",changes:"Changes",ai:"AI"};return(0,t.jsxs)("div",{"data-testid":"activity-filter",role:"group","aria-label":"Show",style:{display:"flex",flexWrap:"wrap",gap:4,alignItems:"center"},children:[["all","changes","ai"].map(s=>(0,t.jsx)("button",{type:"button","data-shows":s,"aria-pressed":e===s,onClick:()=>i(s),style:{...r,...e===s?{borderColor:"var(--graview-accent)",color:"var(--graview-ink)"}:{}},children:o[s]},s)),(0,t.jsx)("button",{type:"button","data-testid":"activity-mine","aria-pressed":a,onClick:()=>l(!a),style:{...r,marginLeft:"auto",...a?{borderColor:"var(--graview-accent)",color:"var(--graview-ink)"}:{}},children:"Just mine"})]})}var x=e=>e.ask.kind==="suggest"?"suggest":e.ask.kind==="fill"?"fill in":e.ask.kind==="record"?"add one":e.ask.kind==="panel"?"draw a panel":`answer \u201C${e.ask.said}\u201D`;function $(e){let i=e.offered.filter(a=>e.accepted?.includes(a.id)).map(a=>a.label);switch(e.outcome){case"accepted":return i.length>0?`Took ${i.join(", ")}`:"Taken";case"partly":return`Took ${i.length} of ${e.offered.length}: ${i.join(", ")}`;case"dismissed":return"Dismissed";case"drawn":return e.panel?`Drew \u201C${e.panel.title}\u201D`:"Drew a panel";case"failed":return e.failed??"Failed";default:return"Offered, not yet taken"}}function C(e){let i=[...new Set((e.usage??[]).map(o=>o.model))];if(i.length===0)return null;let a=(e.usage??[]).flatMap(o=>o.costUsd===void 0?[]:[o.costUsd]),l=a.length>0?a.reduce((o,s)=>o+s,0):void 0;return`${i.join(", ")}${l!==void 0?` \xB7 $${l<.01?l.toPrecision(2):l.toFixed(2)}`:""}`}function F({entry:e,undo:i}){let{store:a,principal:l,seats:o,people:s,ai:b}=w(),c=y(),[p,u]=(0,k.useState)(!1),A=e.by.kind==="human"&&e.by.onBehalfOf===void 0&&(e.by.id===void 0||l.id===void 0||e.by.id===l.id)?"you":g(e.by,{graph:a.graph,schema:a.schema,seats:o,people:s}),f=C(e),S=v(b),m=n=>{u(!0),(__graviewPreload(import.meta.url,["./chunk.REEDZSCG.js","./chunk.OGF6UORU.js","./chunk.UT6642FC.js","./chunk.3TBH2FMZ.js","./chunk.WE5SA6TP.js","./chunk.QNJYXB3U.js","./chunk.TI4OSTQV.js","./chunk.PL2P2OON.js","./chunk.MZOIPCDA.js","./chunk.KERLVJ6I.js","./chunk.4EPT2CQG.js","./chunk.FNXW46U4.js","./chunk.4JWT6LIS.js","./chunk.SDO3U72B.js","./chunk.AW2T3KFV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.WNYPP52L.js")).then(n).finally(()=>u(!1))};return(0,t.jsxs)("li",{"data-testid":"activity-interaction","data-interaction":e.id,"data-outcome":e.outcome,style:{display:"grid",gap:3,lineHeight:1.45},children:[(0,t.jsx)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:(0,t.jsxs)("span",{style:{minWidth:0},children:[(0,t.jsx)("strong",{style:{fontWeight:600},children:A})," ",(0,t.jsxs)("span",{style:{color:"var(--graview-ink-muted)"},children:["asked AI to ",x(e)]}),(0,t.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",e.targetLabel]})]})}),e.offered.length>0&&e.outcome!=="accepted"&&e.outcome!=="partly"?(0,t.jsxs)("div",{"data-testid":"interaction-offered",style:{color:"var(--graview-ink-muted)"},children:["Offered ",e.offered.map(n=>n.label).join(", ")]}):null,(0,t.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6,flexWrap:"wrap"},children:[(0,t.jsx)("span",{"data-testid":"interaction-outcome",style:{color:e.outcome==="failed"?"var(--graview-warn)":"var(--graview-ink)"},children:$(e)}),(e.batches??[]).map(n=>(0,t.jsx)("span",{"data-interaction-batch":n,style:{marginLeft:"auto"},children:i(n)},n))]}),f?(0,t.jsx)("div",{"data-testid":"interaction-model",style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:f}):null,S?(0,t.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[e.panel?(0,t.jsx)("button",{type:"button","data-testid":"interaction-reopen",disabled:p,onClick:()=>m(n=>n.drawPanel(c,e.panel)),style:r,children:"Show the panel"}):null,(0,t.jsx)("button",{type:"button","data-testid":"interaction-again",disabled:p,onClick:()=>m(n=>n.askAgain(c,e)),style:r,children:"Ask again"})]}):null]})}export{E as a,F as b};
@@ -0,0 +1,19 @@
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{d as C,e as re}from"./chunk.IIB22IIP.js";import{e as ee}from"./chunk.MWUP5X47.js";import{b as S}from"./chunk.4EPT2CQG.js";import{m as X}from"./chunk.FNXW46U4.js";import{Da as J,G as se,Ha as Q,R as Z,ua as V}from"./chunk.4JWT6LIS.js";import{a as K}from"./chunk.SDO3U72B.js";import{O as Y,U as M,ca as U}from"./chunk.AW2T3KFV.js";import{b as D}from"./chunk.AJZBJBMO.js";var h=D(se(),1);var n=D(Z(),1),Re=9,le=40,ge=2;function de(e){let r=new Map;for(let i of e.allNodes())r.set(i.kind,(r.get(i.kind)??0)+1);return r}var ue=(e,r)=>(e.far??[]).reduce((i,a)=>i+(r.get(a)??0),0);function ce(e,r,i){if(i)return i.flatMap(s=>e.filters.filter(u=>u.key===s));let a=de(r),o=new Set(e.filters.filter(s=>s.about==="edge"&&ue(s,a)>le).map(s=>s.key));return e.filters.filter(s=>s.about==="edge"?!o.has(s.key):s.about==="via"?o.has(s.key.split(".")[0]):!0)}function pe(e,r){let i=e.filter(a=>a.about==="field"&&a.type==="choice"&&(a.options?.length??0)>0);return r?i:i.slice(0,ge)}var fe=520;function ye(e,r,i,a){let o=i.filters.find(s=>s.key===a.key);if(!o)return`${a.key}: ${a.value}`;if(o.about==="is")return a.value.charAt(0).toUpperCase()+a.value.slice(1);if(o.about==="via")return`${o.label}: ${S(e.tryDefinition(o.far?.[0]??""),o.key.split(".")[1],a.value)}`;if(o.about==="edge"){if(a.value==="*")return`${o.label}: anything`;if(a.value==="none")return`${o.label}: nothing`;let s=r.getNode(a.value);return`${o.label}: ${s?U(e.tryDefinition(s.kind),s):a.value}`}if(o.type==="date"){let[s,u]=a.value.split(":");return`${o.label} ${s} ${u?Y(u):""}`.trim()}if(o.type==="boolean")return`${o.label}: ${a.value==="true"?"yes":"no"}`;if(o.type==="number"){let s=a.value.lastIndexOf(":"),u=a.value.slice(0,Math.max(0,s));if(u==="at-most"||u==="at-least")return`${o.label}: ${u==="at-most"?"at most":"at least"} ${S(e.tryDefinition(i.kind),o.key,Number(a.value.slice(s+1)))}`}return o.type==="text"?`${o.label}: ${a.value}`:`${o.label}: ${S(e.tryDefinition(i.kind),o.key,a.value)}`}var P=e=>/^[A-Z][a-z]/.test(e)?e.charAt(0).toLowerCase()+e.slice(1):e;function me(e){return e?.type==="date"?{asc:"Earliest first",desc:"Latest first"}:e?.type==="number"?{asc:"Lowest first",desc:"Highest first"}:e?.type==="boolean"?{asc:"No first",desc:"Yes first"}:e?.type==="choice"?{asc:"In their order",desc:"In reverse order"}:{asc:"A to Z",desc:"Z to A"}}var x=V(K(()=>(__graviewPreload(import.meta.url,["./chunk.JEMQ66FT.js","./chunk.7UV7ODXU.js","./chunk.IIB22IIP.js","./chunk.MWUP5X47.js","./chunk.MZOIPCDA.js","./chunk.KERLVJ6I.js","./chunk.4EPT2CQG.js","./chunk.FNXW46U4.js","./chunk.4JWT6LIS.js","./chunk.SDO3U72B.js","./chunk.AW2T3KFV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.D2RK2KJD.js")))),N=x.part((e,r)=>(0,n.jsx)(e.ArrangeLists,{...r}),{what:"This list",quiet:!0}),he=x.part((e,r)=>(0,n.jsx)(e.ArrangeChips,{...r}),{what:"This list",quiet:!0}),Te=()=>x.load(),q=new Map;function Ie(e){let{schema:r,graph:i,kind:a,arrangement:o,onChange:s}=e,u=e.offers??ee(r,a),g=e.testId??"arrange",y=C(e.allow,"sort")&&u.sorts.length>1,m=C(e.allow,"group")&&u.groups.length>0,F=C(e.allow,"filter")?ce(u,i,e.filters):[],L=e.chips?pe(F,e.filters):[],H=F.filter(t=>!L.includes(t)),G=H.length>0,_=e.query!==!1&&e.allow!==!1,w=we(e.noun,e.kept),v=e.past&&e.past.count>0?e.past:null;if(!y&&!m&&!G&&!_&&!w&&!v)return null;let z=t=>JSON.stringify(re(t)),O=`${g}|${a}`,p={current:q.get(O)??{words:new Set,latest:null,at:0}};q.set(O,p.current),p.current.latest&&Date.now()-p.current.at>1500&&!p.current.words.has(z(o))&&(p.current={words:new Set,latest:null,at:0},q.set(O,p.current));let d=p.current.latest??o,b=t=>{let l={...p.current.latest??o,...t};for(let c of Object.keys(l))l[c]===void 0&&delete l[c];p.current.latest=l,p.current.at=Date.now(),p.current.words.add(z(l)),s(l)},f=d.filter??[],R=t=>{let l=f.filter((c,I)=>I!==t);b({filter:l.length>0?l:void 0})},A=t=>f.some(l=>l.key===t.key&&l.value===t.value),te=t=>A(t)?R(f.findIndex(l=>l.key===t.key&&l.value===t.value)):b({filter:[...f,t]}),T=d.sort?u.sorts.find(t=>t.key===d.sort.by):void 0,j=d.group?u.groups.find(t=>t.key===d.group.by):void 0,ne=me(T),k={schema:r,graph:i,offers:{...u,filters:H},arrangement:d,set:b,toggle:te,has:A,testId:g},ae=(t,l)=>A({key:t,value:l})?R(f.findIndex(c=>c.key===t&&c.value===l)):b({filter:[...f.filter(c=>c.key!==t),{key:t,value:l}]}),oe=d.sort?(0,n.jsxs)(n.Fragment,{children:["Sorted by ",P(T?.label??d.sort.by),(0,n.jsx)("span",{"aria-hidden":"true",children:d.sort.direction==="desc"?" \u2193":" \u2191"})]}):"Sort",ie=d.group?.bucket&&j?.buckets?`, a ${d.group.bucket} each`:"",B=d.group?`Grouped by ${P(j?.label??d.group.by)}${ie}`:"Group";return(0,n.jsxs)("div",{"data-testid":`${g}-bar`,role:"group","aria-label":"Arrange",className:"graview-arrange",style:e.style,onPointerEnter:x.prefetch,onFocus:x.prefetch,children:[(0,n.jsx)("style",{children:xe}),(0,n.jsxs)("div",{className:"graview-arrange-line",children:[w?(0,n.jsxs)("span",{className:"graview-arrange-count","data-testid":`${g}-count`,children:[w.kept?(0,n.jsx)("span",{"data-testid":`${g}-kept`,children:w.kept}):null,w.words]}):null,v?(0,n.jsxs)("button",{type:"button",className:"graview-arrange-open","data-testid":`${g}-past`,title:`${M(v.count)} more behind the horizon \u2014 press to widen the view to the past`,onClick:t=>{let l=t.currentTarget.closest("[data-graview-view]"),c=t.currentTarget;v.widen();let I=0,W=()=>{if(document.activeElement!==c&&document.activeElement!==document.body&&c.isConnected)return;let $=l?.querySelector('[role="group"][aria-label="Arrange"] :is(button, input)');if($&&$!==c&&$.isConnected)return $.focus({preventScroll:!0});++I<120&&requestAnimationFrame(W)};requestAnimationFrame(W)},children:["+",M(v.count)," past"]}):null,f.map((t,l)=>{let c=ye(r,i,u,t);return(0,n.jsxs)("span",{className:"graview-arrange-token","data-testid":`${g}-condition`,children:[c,(0,n.jsx)("button",{type:"button","aria-label":`Remove: ${c}`,title:"Remove",onClick:()=>R(l),children:"\xD7"})]},`${t.key}:${t.value}`)}),y?(0,n.jsx)("span",{className:"graview-arrange-part graview-arrange-one",children:(0,n.jsx)(E,{testId:`${g}-sort`,value:d.sort?.by??"",set:d.sort!==void 0,label:"Sort",name:d.sort?`Sorted by ${P(T?.label??d.sort.by)}, ${ne[d.sort.direction].toLowerCase()}`:"Sort",list:t=>(0,n.jsx)(N,{which:"sort",done:t,...k}),children:oe})}):null,m?(0,n.jsx)("span",{className:"graview-arrange-part graview-arrange-one",children:(0,n.jsx)(E,{testId:`${g}-group`,value:d.group?.by??"",set:d.group!==void 0,label:"Group",name:B,list:t=>(0,n.jsx)(N,{which:"group",done:t,...k}),children:B})}):null,G?(0,n.jsx)("span",{className:"graview-arrange-part",children:(0,n.jsx)(E,{testId:`${g}-add`,value:"",set:!1,label:"Filter",name:f.length>0?`Filter \u2014 ${f.length} on`:"Filter",list:t=>(0,n.jsx)(N,{which:"filter",done:t,...k}),children:"Filter"})}):null,y||m?(0,n.jsx)("span",{className:"graview-arrange-part graview-arrange-all",children:(0,n.jsx)(E,{testId:`${g}-all`,value:"",set:!1,label:"Arrange",name:"Arrange: sort and group",list:t=>(0,n.jsx)(N,{which:"all",done:t,parts:{sort:y,group:m,filter:!1},...k}),children:"Arrange"})}):null,_?(0,n.jsxs)("label",{className:"graview-arrange-words-at",children:[(0,n.jsx)("span",{style:X,children:"Find"}),(0,n.jsx)("input",{type:"search",className:"graview-arrange-words","data-testid":`${g}-query`,value:d.query??"",placeholder:"Find\u2026",onChange:t=>b({query:t.target.value.length>0?t.target.value:void 0})})]}):null,L.length>0&&e.chips?(0,n.jsx)(h.Suspense,{fallback:null,children:(0,n.jsx)(he,{offers:L,chips:e.chips,schema:r,graph:i,kind:a,arrangement:d,has:A,choose:ae,testId:g})}):null]})]})}function we(e,r){if(!r)return null;let i=r.shown!==r.of;if(!e)return i?{words:"",kept:`${r.shown} of ${r.of}`}:null;let a=r.of===1?e.one:e.many;return i?{words:` ${a}`,kept:`${r.shown} of ${r.of}`}:{words:`${r.of} ${a}`}}function E({testId:e,value:r,set:i,label:a,name:o,list:s,children:u}){let g=Q("arrange",{align:"start"}),y=(0,h.useRef)(null);return(0,h.useEffect)(()=>{g.open&&y.current?.querySelector('[aria-pressed="true"]')?.focus({preventScroll:!0})},[g.open]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{type:"button",className:"graview-arrange-open","data-testid":e,"data-set":i?"":void 0,value:r,"aria-label":o,...g.trigger,onClick:g.toggle,children:[u,(0,n.jsx)(be,{})]}),g.open?(0,n.jsx)("div",{...g.pane,ref:m=>{g.pane.ref(m),y.current=m},role:"group","aria-label":a,"data-testid":"arrange-list","data-arrange":e,className:"graview-arrange-list",style:J,onKeyDown:ve,children:s(()=>g.setOpen(!1))}):null]})}function ve(e){if(!["ArrowDown","ArrowUp","Home","End"].includes(e.key))return;let r=[...e.currentTarget.querySelectorAll("button:not([disabled]), input")];if(r.length===0)return;let i=r.indexOf(document.activeElement);if(document.activeElement instanceof HTMLInputElement&&document.activeElement.type==="date"&&(e.key==="ArrowUp"||e.key==="ArrowDown"))return;e.preventDefault();let a=e.key==="Home"?0:e.key==="End"?r.length-1:e.key==="ArrowDown"?(i+1)%r.length:(i-1+r.length)%r.length;r[a].focus()}function be(){return(0,n.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 10 10","aria-hidden":"true",focusable:"false",style:{flex:"0 0 auto",opacity:.7},children:(0,n.jsx)("path",{d:"M2 3.5 L5 6.5 L8 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}var xe=`
2
+ .graview-arrange{container-type:inline-size;box-sizing:border-box;width:100%;min-width:0;max-width:100%}
3
+ .graview-arrange-line{display:flex;flex-wrap:wrap;align-items:center;gap:2px 6px;min-width:0;font-size:.875rem;line-height:1.35;color:var(--graview-ink-muted)}
4
+ .graview-arrange-count{margin-right:2px;color:var(--graview-ink-muted)}
5
+ .graview-arrange-part{display:inline-flex;align-items:center;min-width:0}
6
+ .graview-arrange-count~.graview-arrange-part::before{content:"\xB7" / "";margin-right:6px;color:var(--graview-ink-muted)}
7
+ .graview-arrange-open{display:inline-flex;align-items:center;gap:5px;min-height:28px;min-width:0;max-width:100%;margin:0;padding:0 6px;border:1px solid transparent;border-radius:7px;background:none;box-shadow:none;font:inherit;letter-spacing:normal;text-transform:none;text-align:left;color:var(--graview-ink-muted);cursor:pointer}
8
+ .graview-arrange-open[data-set]{color:var(--graview-ink)}
9
+ .graview-arrange-open:hover,.graview-arrange-open[aria-expanded=true]{border-color:var(--graview-edge);color:var(--graview-ink)}
10
+ .graview-arrange :focus-visible,.graview-arrange-list :focus-visible{outline:2px solid var(--graview-accent);outline-offset:1px}
11
+ .graview-arrange-all{display:none}
12
+ @container (max-width: ${fe-1}px){.graview-arrange-one{display:none}.graview-arrange-all{display:inline-flex}}
13
+ .graview-arrange-token{display:inline-flex;align-items:center;gap:0;min-width:0;min-height:26px;box-sizing:border-box;padding:0 2px 0 10px;border:1px solid var(--graview-edge);border-radius:999px;background:var(--graview-panel);color:var(--graview-ink);overflow-wrap:anywhere}
14
+ .graview-arrange-token button{display:inline-flex;align-items:center;justify-content:center;min-width:24px;min-height:24px;margin:0;padding:0;border:0;border-radius:6px;background:none;font:inherit;line-height:1;color:var(--graview-ink-muted);cursor:pointer}
15
+ .graview-arrange-token button:hover{color:var(--graview-ink);background:color-mix(in srgb,var(--graview-ink) 7%,transparent)}
16
+ .graview-arrange-words-at{display:inline-flex;min-width:0;max-width:100%}
17
+ .graview-arrange-words{box-sizing:border-box;width:min(100%,12rem);min-height:28px;margin:0;padding:0 8px;border:1px solid transparent;border-radius:7px;background:transparent;font:inherit;color:var(--graview-ink)}
18
+ .graview-arrange-words:hover,.graview-arrange-words:focus{border-color:var(--graview-edge)}
19
+ `;function De(e){let r=[];return e.query&&r.push(`\u201C${e.query}\u201D`),e.filter?.length&&r.push(`${e.filter.length} condition${e.filter.length===1?"":"s"}`),e.group&&r.push(`by ${e.group.by}`),e.sort&&r.push(`sorted by ${e.sort.by}`),r.length>0?r.join(" \xB7 "):null}export{Re as a,le as b,ge as c,de as d,ue as e,ce as f,pe as g,fe as h,ye as i,P as j,me as k,Te as l,Ie as m,De as n};
@@ -0,0 +1 @@
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as ne}from"./chunk.RNUGQRJI.js";import{o as be,p as te,s as V,t as Me}from"./chunk.ATKKTPJS.js";import{m as X,n as we,o as ke,p as Z,q as ee}from"./chunk.OJGHDWI6.js";import{c as Se}from"./chunk.4EPT2CQG.js";import{b as pe,c as ve,d as j,e as J,g as ye,o as Ae}from"./chunk.FNXW46U4.js";import{$ as B,Aa as Q,D as q,F as K,G as O,J as me,O as fe,R as M,_ as A,aa as _,m as ce,sa as ge,ta as he,ua as T,v as ue,ya as F,z as de}from"./chunk.4JWT6LIS.js";import{a as E}from"./chunk.SDO3U72B.js";import{Sc as le,ha as z,rc as ae,wc as se}from"./chunk.AW2T3KFV.js";import{b as y}from"./chunk.AJZBJBMO.js";var P=y(O(),1),D=y(M(),1),re=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.4JWT6LIS.js","./chunk.SDO3U72B.js","./chunk.AW2T3KFV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.5WEEZ7WD.js")))),De=re.part(t=>(0,D.jsx)(t.HoverChipDoor,{}),{quiet:!0}),xe="A",$=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.5A4AOFOA.js","./chunk.KSXB4LDF.js","./chunk.CDFVEL2Y.js","./chunk.T6S3CEW7.js","./chunk.6NFR2LYQ.js","./chunk.HJCQ6I3S.js","./chunk.B7FZLIAO.js","./chunk.N5ULWKR4.js","./chunk.6BIRNR5P.js","./chunk.GBCWI2LF.js","./chunk.7PUFYK3B.js","./chunk.QJJKITXF.js","./chunk.7AEE3VHC.js","./chunk.LKF4BBCW.js","./chunk.JUT2VCFW.js","./chunk.IIB22IIP.js","./chunk.MWUP5X47.js","./chunk.OK4FSBHI.js","./chunk.DAZEFSWI.js","./chunk.OGF6UORU.js","./chunk.UT6642FC.js","./chunk.3TBH2FMZ.js","./chunk.WE5SA6TP.js","./chunk.TI4OSTQV.js","./chunk.TDCO7LEA.js","./chunk.ESU2DD3J.js","./chunk.PL2P2OON.js","./chunk.27ZVVPRZ.js","./chunk.IN4PKQO5.js","./chunk.3IUJ4GW7.js","./chunk.UG23RICT.js","./chunk.ATKKTPJS.js","./chunk.OJGHDWI6.js","./chunk.UZSZPMRC.js","./chunk.MZOIPCDA.js","./chunk.KERLVJ6I.js","./chunk.4EPT2CQG.js","./chunk.FNXW46U4.js","./chunk.4JWT6LIS.js","./chunk.SDO3U72B.js","./chunk.AW2T3KFV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.5JPELFMA.js"))));var Ce=$.part((t,e)=>(0,D.jsx)(t.InspectorPane,{...e}),{what:"This card's acts"});function Le(t){let e=()=>{(typeof navigator>"u"||navigator.onLine!==!1)&&t()},n=globalThis;if(n.requestIdleCallback){let d=n.requestIdleCallback(e,{timeout:5e3});return()=>n.cancelIdleCallback?.(d)}let r=setTimeout(e,2500);return()=>clearTimeout(r)}var Oe=150,Ne="[data-graview-pick], [data-graview-view], [data-graview-record], [data-graview-act], [data-graview-field], a[href]";function Re(t){if(t.closest("[data-graview-face='pages'], [data-graview-popover]"))return null;let e=t.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??t.closest("[data-graview-view]")?.getAttribute("data-graview-view");return e?{face:"scene",on:e,about:[e]}:null}function We(t){let{store:e,principal:n,providers:r,ai:d}=A(),c=Me(),v=K(d),o=(0,P.useRef)({aimAt:t,store:e,principal:n,providers:r,prepareSections:c,chipsOn:v});o.current={aimAt:t,store:e,principal:n,providers:r,prepareSections:c,chipsOn:v},(0,P.useEffect)(()=>{if(typeof document>"u")return;let i=null,w=null,k=null,f=h=>{let u=o.current,b=u.chipsOn?u.aimAt(h):null;b&&(k=h,re.load().then(H=>{k===h&&H.restOn(b,h)},()=>{}))},l=()=>{i&&clearTimeout(i.timer),i=null},p=h=>{let u=o.current,b=u.aimAt(h);if(!b)return;let H=JSON.stringify([b.face,b.on,b.about,b.field,b.place,b.act,u.store.log.length]);H!==w&&(w=H,u.prepareSections(b),$.load().then(Pe=>Pe.prepareActs(u.store,b,{principal:u.principal,providers:u.providers}),()=>{}))},a=h=>h.target instanceof Element?h.target.closest(Ne):null,m=h=>{if(h.pointerType==="touch")return;let u=a(h);u!==null&&u===i?.element||(l(),u!==null&&(i={element:u,timer:setTimeout(()=>{i=null,p(u),f(u)},Oe)}))},g=h=>{let u=h.relatedTarget;k!==null&&!(u instanceof Node&&k.contains(u))&&(k=null,re.current?.leaveRest()),i!==null&&(u instanceof Node&&i.element.contains(u)||l())},S=h=>{if(h.pointerType==="mouse")return;let u=a(h);u&&p(u)},I=h=>{if(!ge())return;let u=a(h);u&&p(u)};return document.addEventListener("pointerover",m,{passive:!0}),document.addEventListener("pointerout",g,{passive:!0}),document.addEventListener("pointerdown",S,{capture:!0,passive:!0}),document.addEventListener("focusin",I),()=>{l(),document.removeEventListener("pointerover",m),document.removeEventListener("pointerout",g),document.removeEventListener("pointerdown",S,{capture:!0}),document.removeEventListener("focusin",I)}},[])}function ot({placement:t="float",openActs:e,aimAt:n}={}){let{menuAt:r,setMenuAt:d,registerActsDoor:c,ai:v}=A(),{selection:o}=F();We(n??Re),(0,P.useEffect)(()=>{if($.current)return;let l=()=>{g(),$.prefetch()},p=()=>{},a=he(()=>void(p=Le(l))),m=["pointerdown","keydown"];for(let S of m)document.addEventListener(S,l,{capture:!0,passive:!0});function g(){a(),p();for(let S of m)document.removeEventListener(S,l,{capture:!0})}return g},[]),(0,P.useEffect)(()=>{if(t==="menu")return c({key:xe,open:e??(l=>{let p=l.getBoundingClientRect(),a=l.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??l.closest("[data-graview-view]")?.getAttribute("data-graview-view")??void 0;d({x:Math.round(p.left+Math.min(16,p.width/2)),y:Math.round(Math.min(p.bottom,p.top+36)),...a?{on:a}:{}})})}),()=>c(null)},[t,c,d,e]);let i=r!==null||o.length>0&&e===void 0,[w,k]=(0,P.useState)(i);(0,P.useEffect)(()=>{i&&k(!0)},[i]);let f=K(v)?(0,D.jsx)(P.Suspense,{fallback:null,children:(0,D.jsx)(De,{})}):null;return!w&&!i?f:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(P.Suspense,{fallback:null,children:(0,D.jsx)(Ce,{placement:t,chosen:e===void 0})}),f]})}var U=y(O(),1),Y=y(M(),1),Ge=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.5A4AOFOA.js","./chunk.KSXB4LDF.js","./chunk.CDFVEL2Y.js","./chunk.FIJNKSMQ.js","./chunk.GAN77YDU.js","./chunk.JLOSQ5UY.js","./chunk.FNF6XQI5.js","./chunk.T6S3CEW7.js","./chunk.LUPBT6YM.js","./chunk.IBWPRK2R.js","./chunk.RNUGQRJI.js","./chunk.6NFR2LYQ.js","./chunk.HJCQ6I3S.js","./chunk.B7FZLIAO.js","./chunk.N5ULWKR4.js","./chunk.6BIRNR5P.js","./chunk.GBCWI2LF.js","./chunk.7PUFYK3B.js","./chunk.QJJKITXF.js","./chunk.7AEE3VHC.js","./chunk.U3CV5CCL.js","./chunk.LKF4BBCW.js","./chunk.NPS2WN7T.js","./chunk.JUT2VCFW.js","./chunk.HKD5SR45.js","./chunk.JEMQ66FT.js","./chunk.7UV7ODXU.js","./chunk.IIB22IIP.js","./chunk.MWUP5X47.js","./chunk.OK4FSBHI.js","./chunk.DAZEFSWI.js","./chunk.OGF6UORU.js","./chunk.UT6642FC.js","./chunk.3TBH2FMZ.js","./chunk.WE5SA6TP.js","./chunk.TI4OSTQV.js","./chunk.TDCO7LEA.js","./chunk.WVUJXDXZ.js","./chunk.ESU2DD3J.js","./chunk.PL2P2OON.js","./chunk.27ZVVPRZ.js","./chunk.IN4PKQO5.js","./chunk.3IUJ4GW7.js","./chunk.UG23RICT.js","./chunk.GZHZLJBF.js","./chunk.ATKKTPJS.js","./chunk.OJGHDWI6.js","./chunk.UZSZPMRC.js","./chunk.MZOIPCDA.js","./chunk.KERLVJ6I.js","./chunk.4EPT2CQG.js","./chunk.FNXW46U4.js","./chunk.4JWT6LIS.js","./chunk.SDO3U72B.js","./chunk.AW2T3KFV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.EYEIDL3T.js")))),He=Ge.part((t,e)=>{let n=t.DraftFrame;return(0,Y.jsx)(n,{...e})},{what:"The view"});function lt(t){let{seatTalk:e}=A();return(0,U.useSyncExternalStore)(e.subscribe,()=>e.get().draft!==null,()=>!1)?(0,Y.jsx)(U.Suspense,{fallback:null,children:(0,Y.jsx)(He,{...t})}):null}var C=y(O(),1),x=y(M(),1),Ee=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.MWUP5X47.js","./chunk.REEDZSCG.js","./chunk.OGF6UORU.js","./chunk.UT6642FC.js","./chunk.3TBH2FMZ.js","./chunk.WE5SA6TP.js","./chunk.QNJYXB3U.js","./chunk.TI4OSTQV.js","./chunk.PL2P2OON.js","./chunk.MZOIPCDA.js","./chunk.KERLVJ6I.js","./chunk.4EPT2CQG.js","./chunk.FNXW46U4.js","./chunk.4JWT6LIS.js","./chunk.SDO3U72B.js","./chunk.AW2T3KFV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.RDGFZPKN.js")))),ze=Ee.part((t,e)=>{let n=t.QuickAskCard;return(0,x.jsx)(n,{...e})},{what:"The quick ask"});function ft({face:t,on:e=!0}){let{ai:n,aiDesk:r,selection:d,view:c}=A(),v=fe()?.open??!1,o=e&&q(n)&&!v,i=ye(r),w=(0,C.useRef)(null),k=(0,C.useRef)({selection:d,place:c.within?.view});return k.current={selection:d,place:c.within?.view},(0,C.useEffect)(()=>{if(!o)return;let f=ve(r);return f.drawn+=1,j(f),()=>{f.drawn=Math.max(0,f.drawn-1),f.drawn===0&&(f.open=null),j(f)}},[o,r]),(0,C.useEffect)(()=>{if(!o)return;let f=l=>{if(l.defaultPrevented||l.key.toLowerCase()!=="k"||!(l.metaKey||l.ctrlKey)||l.altKey||l.shiftKey)return;let p=w.current?.closest("[data-graview-embed]"),a=l.target,m=!(a instanceof Node)||a===document.body||a===document.documentElement;if(p&&!(m||a instanceof Node&&p.contains(a)))return;l.preventDefault(),Ee.prefetch();let g=document.activeElement,{selection:S,place:I}=k.current;J(r,{pointed:{...S[0]!==void 0?{on:S[0]}:{},about:S,...I?{place:I}:{}},returnTo:g instanceof HTMLElement&&g!==document.body?g:null})};return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[o,r]),o?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("span",{ref:w,hidden:!0,"data-graview-quick-ask":t}),i?(0,x.jsx)(C.Suspense,{fallback:null,children:(0,x.jsx)(ze,{face:t,opening:i,close:()=>J(r,null)},i.at)}):null]}):null}var R=y(O(),1),L=y(M(),1),oe=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.REEDZSCG.js","./chunk.OGF6UORU.js","./chunk.UT6642FC.js","./chunk.3TBH2FMZ.js","./chunk.WE5SA6TP.js","./chunk.QNJYXB3U.js","./chunk.TI4OSTQV.js","./chunk.PL2P2OON.js","./chunk.MZOIPCDA.js","./chunk.KERLVJ6I.js","./chunk.4EPT2CQG.js","./chunk.FNXW46U4.js","./chunk.4JWT6LIS.js","./chunk.SDO3U72B.js","./chunk.AW2T3KFV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.WNYPP52L.js")))),qe=oe.part((t,e)=>{let n=t.InlineAiMenu;return(0,L.jsx)(n,{...e})},{what:"The AI's suggestions"}),Be=oe.part((t,e)=>{let n=t.GhostTray;return(0,L.jsx)(n,{...e})},{quiet:!0});function _e(){let{ai:t}=A(),e=q(t);return(0,R.useMemo)(()=>e?n=>({id:"inline-ai",heading:"AI",render:r=>(0,L.jsx)(R.Suspense,{fallback:null,children:(0,L.jsx)(qe,{target:n,close:r})}),prepare:()=>oe.prefetch()}):null,[e])}var Fe=[];function kt({children:t}){let e=_e(),n=(0,R.useMemo)(()=>e?[e]:Fe,[e]);return(0,L.jsx)(V,{sections:n,children:t})}function St(t){let{ai:e,aiDesk:n}=A(),{ghost:r}=me(n);return r===null||r.onCard||e.off?null:(0,L.jsx)(R.Suspense,{fallback:null,children:(0,L.jsx)(Be,{...t})})}var N=y(O(),1);var Te=y(M(),1),W=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.FNXW46U4.js","./chunk.4JWT6LIS.js","./chunk.SDO3U72B.js","./chunk.AW2T3KFV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.FUYMLDNJ.js"))));function Ve(t){let e=t.about[0];if(t.about.length!==1||!e?.startsWith("aggregate:"))return;let n=e.slice(10).split("+");return n.length===1?n[0]:void 0}function $e(t,e){return t.filter(n=>n.as!==e.as&&!n.hidden&&(n.kind===e.kind||n.over?.includes(e.kind)===!0)).at(-1)}function Ye(t){let e=B(),n=e?.keptViews,r=e?.views,d=(0,N.useContext)(Ae);return(0,N.useMemo)(()=>!n||!r?null:c=>{let v=n.current(),o=Ve(c);if(c.place===void 0){if(c.face!=="pages"||o===void 0||c.on!==void 0||!v.may.lenses||!n.lens)return null;let l=r.arrangement?.()?.hide?.includes(o)===!0,p=m=>void W.load().then(g=>g.setListHidden(o,z(e.store.schema,o),n,m,d),String);return{id:"tidy-view",items:[l?{id:"show-list",label:"Show",hint:"Back in the places, for everyone",run:()=>p(!1)}:{id:"hide-list",label:"Hide",hint:"Off the places, for everyone; still at its address",run:()=>p(!0)}],prepare:()=>W.prefetch()}}let i=r.places().find(l=>l.as===c.place&&(o===void 0||l.kind===o||l.over?.includes(o)===!0));if(!i)return null;let w=le(i,v,n);if(!w)return null;let k=l=>void W.load().then(p=>p.setHidden(i,w,n,l,d),String);return{id:"tidy-view",items:[i.hidden?{id:"show-view",label:"Show",hint:"Back in the places, for everyone",run:()=>k(!1)}:{id:"hide-view",label:"Hide",hint:"Off the places and the scene, for everyone",run:()=>k(!0)},{id:"delete-view",label:"Delete",hint:`Kept ${30} days under Recently deleted`,run:()=>{let l=$e(r.places(),i);W.load().then(p=>p.remove(i,w,n,d).then(a=>a&&t?.(i,l)),String)}}],prepare:()=>W.prefetch()}},[n,r,d,t])}var Ue=[];function Dt({children:t}){let{view:e,go:n}=Q(),r=(0,N.useCallback)((v,o)=>{let i=e.within?.view;e.focusId===ue(v.kind)&&(i===void 0||i===v.as)&&n(o?de(e,o.kind,o.as):ce(e,!0))},[e,n]),d=Ye(r),c=(0,N.useMemo)(()=>d?[d]:Ue,[d]);return(0,Te.jsx)(V,{sections:c,children:t})}function Ot(t={}){return t.scope===void 0?ne:pe(ne,t.scope)}var G=y(O(),1),s=y(M(),1);function qt({inside:t=!1,widthOf:e}={}){let{store:n,view:r,emphasis:d,setEmphasis:c}=A(),v=be(),{selection:o,set:i}=F(),{show:w}=Q(),k=_(),f=(0,G.useMemo)(()=>{let a=new Map;for(let m of n.graph.allEdges()){let g=a.get(m.kind)??{count:0,ends:new Set};g.count+=1;for(let S of[m.from,m.to]){let I=n.graph.getNode(S);I&&g.ends.add(`kind:${I.kind}`)}a.set(m.kind,g)}return[...a.entries()].sort(([m],[g])=>m.localeCompare(g)).map(([m,g])=>({kind:m,count:g.count,ends:[...g.ends]}))},[n,k]),l=Math.max(0,...f.map(a=>a.count));if((0,G.useEffect)(()=>()=>c(null),[c]),!r.overview&&!t||f.length===0)return null;let p=new Set;for(let a of o){if(a.startsWith("kind:")){p.add(a);continue}let m=n.graph.getNode(a);m&&p.add(`kind:${m.kind}`)}return(0,s.jsxs)("section",{"aria-label":"What the lines mean",role:t?"group":void 0,"data-testid":"relation-key",style:t?{display:"grid",gap:1}:{position:"absolute",left:16,top:14,zIndex:se("rail"),display:"grid",gap:1,padding:"8px 10px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",maxWidth:Ke,animation:"graview-settle 380ms 280ms ease backwards"},children:[t?null:(0,s.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:"var(--graview-ink-faint)",paddingBottom:2},children:f.length===1?"1 relation":`${f.length} relations`}),e?(0,s.jsx)(Je,{aloft:r.overview===!0}):null,f.map(({kind:a,count:m,ends:g})=>{let{connector:S,style:I}=te(v,a),h=je(n.schema,a),u=d!==null?d===a:p.size===0||g.some(b=>p.has(b));return(0,s.jsxs)("button",{type:"button",title:n.schema.edge(a)?.description===void 0?`${m} of these`:h.words,onMouseEnter:()=>c(a),onMouseLeave:()=>c(null),onFocus:()=>c(a),onBlur:()=>c(null),onClick:()=>{i(g),w(null)},style:{all:"unset",outline:"revert-layer",cursor:"pointer",display:"grid",gridTemplateColumns:"30px 1fr auto",alignItems:"center",gap:8,minHeight:23,padding:"2px 4px",borderRadius:6,opacity:u?1:.4},children:[(0,s.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",style:{display:"block",opacity:S.visible?1:.35},children:r.overview&&e?(0,s.jsx)("path",{d:"M 1 5 L 29 5",fill:"none",className:"graview-key-ribbon",stroke:"var(--graview-ink)",strokeOpacity:.35,strokeWidth:e(m,l)}):(0,s.jsx)("path",{d:"M 1 5 L 29 5",fill:"none",stroke:Z(I),strokeWidth:ee(I,!0),strokeDasharray:X[I.pattern],strokeLinecap:"round"})}),(0,s.jsxs)("span",{style:{display:"grid",minWidth:0},"data-graview-relation-words":a,children:[(0,s.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink)"},children:h.words}),(0,s.jsx)("span",{style:{fontSize:"0.6875rem",color:"var(--graview-ink-faint)"},children:h.ends})]}),S.visible?null:(0,s.jsx)("span",{"data-graview-quiet":a,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontStyle:"italic"},children:"not drawn"}),(0,s.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontVariantNumeric:"tabular-nums"},children:m})]},a)})]})}var Ke="min(280px, calc(100% - 28px))";function je(t,e,n){let r=t.edge(e)?.from??[],d=new Map;for(let o of n!==void 0&&r.includes(n)?[n]:r.length>0?r:[""]){let i=Se(t,o,e,"out");d.set(i,[...d.get(i)??[],o])}let c=o=>o==="*"?"anything":z(t,o),v=[...d].map(([o,i])=>{let w=i.flatMap(f=>t.tryDefinition(f)?.edges[e]?.to??[]),k=i[0]&&w.length>0?`${i.map(c).join(", ")} \u2192 ${(w.includes("*")?["*"]:[...new Set(w)]).map(c).join(", ")}`:"";return[o.charAt(0).toUpperCase()+o.slice(1),k]});return{words:v.map(([o])=>o).join(" \xB7 "),ends:v.flatMap(([,o])=>o?[o]:[]).join(" \xB7 ")}}function Bt({edgeKind:t,kit:e,width:n=30}){let r=B(),d=(0,G.useMemo)(()=>ae(e??r?.brand?.kit),[e,r?.brand?.kit]),{connector:c,style:v}=te(d,t);return(0,s.jsx)("svg",{width:n,height:"8","aria-hidden":"true","data-testid":"relation-mark","data-graview-relation":t,style:{display:"inline-block",verticalAlign:"middle",opacity:c.visible?1:.35},children:(0,s.jsx)("path",{d:`M 1 4 L ${n-1} 4`,fill:"none",stroke:Z(v),strokeWidth:ee(v,!0),strokeDasharray:X[v.pattern],strokeLinecap:"round"})})}function Je({aloft:t}){let e={display:"grid",gridTemplateColumns:"30px 1fr",alignItems:"center",gap:8,minHeight:23,padding:"2px 4px"},n={fontSize:"0.75rem",color:"var(--graview-ink-muted)"};return(0,s.jsxs)("div",{role:"group","aria-label":"The lines","data-testid":"line-manners",style:{display:"grid",gap:1,paddingBottom:6,marginBottom:4,borderBottom:"1px solid var(--graview-edge)"},children:[t?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{style:e,"data-graview-manner":"ribbon",children:[(0,s.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-ink)",strokeOpacity:.35,strokeWidth:6})}),(0,s.jsx)("span",{style:n,children:"A relation between two districts, as wide as the links along it \u2014 point at one for its words"})]}),(0,s.jsxs)("div",{style:e,"data-graview-manner":"record",children:[(0,s.jsxs)("svg",{width:"30",height:"10","aria-hidden":"true",children:[(0,s.jsx)("path",{d:"M 1 5 L 25 5",stroke:"var(--graview-accent)",strokeWidth:1.8,strokeLinecap:"round"}),(0,s.jsx)("circle",{cx:26,cy:5,r:3,fill:"var(--graview-accent)"})]}),(0,s.jsx)("span",{style:n,children:"A chosen record's link to another record, labeled with the relation"})]}),(0,s.jsxs)("div",{style:e,"data-graview-manner":"district",children:[(0,s.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-accent)",strokeWidth:1.8,strokeDasharray:"5 4"})}),(0,s.jsx)("span",{style:n,children:"A chosen record's links into a district, with how many"})]})]}):null,(0,s.jsxs)("div",{style:e,"data-graview-manner":"unsure",children:[(0,s.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-accent)",strokeOpacity:ke,strokeWidth:1.8,strokeDasharray:we,strokeLinecap:"round"})}),(0,s.jsx)("span",{style:n,children:"Unsure: a link its maker was less than sure of, until a person keeps it \u2014 point at its words for what it was based on"})]})]})}var Ie=y(O(),1),ie=y(M(),1),Xe=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.7PUFYK3B.js","./chunk.QJJKITXF.js","./chunk.7AEE3VHC.js","./chunk.LKF4BBCW.js","./chunk.JUT2VCFW.js","./chunk.UT6642FC.js","./chunk.TI4OSTQV.js","./chunk.MZOIPCDA.js","./chunk.KERLVJ6I.js","./chunk.4EPT2CQG.js","./chunk.FNXW46U4.js","./chunk.4JWT6LIS.js","./chunk.SDO3U72B.js","./chunk.AW2T3KFV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.TJO5Y2OJ.js")))),Ze=Xe.part(t=>(0,ie.jsx)(t.SuggestedTray,{}),{quiet:!0});function Vt(){let{store:t}=A(),e=_();return(0,Ie.useMemo)(()=>t.log.all().some(r=>r.suggests!==void 0&&!r.withheld),[t,e])?(0,ie.jsx)(Ze,{}):null}export{ot as a,lt as b,ft as c,qt as d,Ke as e,Bt as f,_e as g,kt as h,St as i,Ye as j,Dt as k,Ot as l,Vt as m};
@@ -1,6 +1,6 @@
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{G as C,R as k,ua as K}from"./chunk.JE4QQEJE.js";import{a as H}from"./chunk.SDO3U72B.js";import{b}from"./chunk.AJZBJBMO.js";var n=b(C(),1),N=450,_=10,O=t=>t instanceof HTMLInputElement?t.dataset.graviewChooseBox??void 0:void 0,q={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:-1/0,End:1/0},S=t=>t instanceof Element?t.closest("[data-graview-choose]"):null,G=t=>t instanceof HTMLElement&&(t.isContentEditable||t instanceof HTMLInputElement&&t.type!=="checkbox"||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement);function Y(t){let[i,d]=(0,n.useState)(()=>new Set),l=(0,n.useRef)(null),x=(0,n.useRef)(null),[E,P]=(0,n.useState)(null),R=E!==null&&t.includes(E)?E:t[0],L=(0,n.useMemo)(()=>t.filter(e=>i.has(e)),[t,i]),M=(0,n.useMemo)(()=>new Set(t),[t]);(0,n.useEffect)(()=>{[...i].some(e=>!M.has(e))&&d(e=>new Set([...e].filter(o=>M.has(o))))},[M,i]);let u=(0,n.useCallback)((e,o=!1)=>{let a=l.current;d(s=>{let r=new Set(s),f=a===null?-1:t.indexOf(a),y=t.indexOf(e);if(o&&f>=0&&y>=0){let T=s.has(a);for(let p of t.slice(Math.min(f,y),Math.max(f,y)+1))T?r.add(p):r.delete(p)}else r.has(e)?r.delete(e):r.add(e);return r}),l.current=e},[t]),v=(0,n.useCallback)(e=>d(new Set(e)),[]),A=(0,n.useCallback)(()=>{l.current=null,d(new Set)},[]),c=(0,n.useRef)(null),g=(0,n.useRef)(!1),m=L.length>0,h=()=>{c.current&&clearTimeout(c.current.timer),c.current=null};(0,n.useEffect)(()=>h,[]);let B={ref:x,onKeyDown:e=>{if(G(e.target))return;let o=O(e.target);if(e.key==="Tab"&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&o!==void 0&&m){let s=document.querySelector('[data-testid="several-bar"]'),r=s?.querySelector("[data-mutation]:not([disabled])")??s?.querySelector("button:not([disabled])");if(r){e.preventDefault(),e.stopPropagation(),r.focus();return}}let a=q[e.key];if(o!==void 0&&a!==void 0&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let s=t.indexOf(o),r=t[Math.max(0,Math.min(t.length-1,s+(Number.isFinite(a)?a:a>0?t.length:-t.length)))];if(e.preventDefault(),e.stopPropagation(),r===void 0||r===o)return;if(e.shiftKey){let f=l.current!==null&&t.includes(l.current)?l.current:o,[y,T]=[t.indexOf(f),t.indexOf(r)].sort((p,F)=>p-F);d(p=>new Set([...p,...t.slice(y,T+1)])),l.current=f}P(r),x.current?.querySelector(`[data-graview-choose-box="${CSS.escape(r)}"]`)?.focus();return}if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="a"){e.preventDefault(),e.stopPropagation(),v(t);return}if(e.key===" "&&!e.metaKey&&!e.ctrlKey){let s=S(e.target),r=e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement&&e.target.type==="checkbox";if(!s||r)return;e.preventDefault(),u(s.dataset.graviewChoose,e.shiftKey)}},onFocus:e=>{let o=O(e.target);o!==void 0&&P(o)},onPointerDown:e=>{if(g.current=!1,e.pointerType==="mouse"||e.button>0)return;let o=S(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox")return;let a=o.dataset.graviewChoose;h(),c.current={id:a,x:e.clientX,y:e.clientY,timer:setTimeout(()=>{c.current=null,g.current=!0,u(a)},N)}},onPointerMove:e=>{let o=c.current;o&&Math.hypot(e.clientX-o.x,e.clientY-o.y)>_&&h()},onPointerUp:h,onPointerCancel:h,onClickCapture:e=>{let o=S(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox"&&e.target.hasAttribute("data-graview-choose-box"))return;if(g.current){g.current=!1,e.preventDefault(),e.stopPropagation();return}let s=o.dataset.graviewChoose;if(e.shiftKey&&(m||l.current!==null)){e.preventDefault(),e.stopPropagation(),u(s,!0);return}m&&matchMedia?.("(pointer: coarse)").matches&&(e.preventDefault(),e.stopPropagation(),u(s))},onContextMenu:e=>{(g.current||c.current)&&(e.preventDefault(),e.stopPropagation())},...m?{"data-graview-choosing":""}:{}},j=(0,n.useCallback)(e=>i.has(e),[i]);return{chosen:L,has:j,toggle:u,choose:v,clear:A,listProps:B,boxProps:(e,o)=>({type:"checkbox",className:"graview-choose-box","data-graview-choose-box":e,"aria-label":`Choose ${o}`,tabIndex:e===R?0:-1,checked:i.has(e),onChange:()=>{},onClick:a=>{a.stopPropagation(),u(e,a.shiftKey)}}),list:x}}var $=`
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{G as C,R as k,ua as K}from"./chunk.4JWT6LIS.js";import{a as H}from"./chunk.SDO3U72B.js";import{b}from"./chunk.AJZBJBMO.js";var n=b(C(),1),N=450,_=10,O=t=>t instanceof HTMLInputElement?t.dataset.graviewChooseBox??void 0:void 0,q={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:-1/0,End:1/0},S=t=>t instanceof Element?t.closest("[data-graview-choose]"):null,G=t=>t instanceof HTMLElement&&(t.isContentEditable||t instanceof HTMLInputElement&&t.type!=="checkbox"||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement);function Y(t){let[i,d]=(0,n.useState)(()=>new Set),l=(0,n.useRef)(null),x=(0,n.useRef)(null),[E,P]=(0,n.useState)(null),R=E!==null&&t.includes(E)?E:t[0],L=(0,n.useMemo)(()=>t.filter(e=>i.has(e)),[t,i]),M=(0,n.useMemo)(()=>new Set(t),[t]);(0,n.useEffect)(()=>{[...i].some(e=>!M.has(e))&&d(e=>new Set([...e].filter(o=>M.has(o))))},[M,i]);let u=(0,n.useCallback)((e,o=!1)=>{let a=l.current;d(s=>{let r=new Set(s),f=a===null?-1:t.indexOf(a),y=t.indexOf(e);if(o&&f>=0&&y>=0){let T=s.has(a);for(let p of t.slice(Math.min(f,y),Math.max(f,y)+1))T?r.add(p):r.delete(p)}else r.has(e)?r.delete(e):r.add(e);return r}),l.current=e},[t]),v=(0,n.useCallback)(e=>d(new Set(e)),[]),A=(0,n.useCallback)(()=>{l.current=null,d(new Set)},[]),c=(0,n.useRef)(null),g=(0,n.useRef)(!1),m=L.length>0,h=()=>{c.current&&clearTimeout(c.current.timer),c.current=null};(0,n.useEffect)(()=>h,[]);let B={ref:x,onKeyDown:e=>{if(G(e.target))return;let o=O(e.target);if(e.key==="Tab"&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&o!==void 0&&m){let s=document.querySelector('[data-testid="several-bar"]'),r=s?.querySelector("[data-mutation]:not([disabled])")??s?.querySelector("button:not([disabled])");if(r){e.preventDefault(),e.stopPropagation(),r.focus();return}}let a=q[e.key];if(o!==void 0&&a!==void 0&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let s=t.indexOf(o),r=t[Math.max(0,Math.min(t.length-1,s+(Number.isFinite(a)?a:a>0?t.length:-t.length)))];if(e.preventDefault(),e.stopPropagation(),r===void 0||r===o)return;if(e.shiftKey){let f=l.current!==null&&t.includes(l.current)?l.current:o,[y,T]=[t.indexOf(f),t.indexOf(r)].sort((p,F)=>p-F);d(p=>new Set([...p,...t.slice(y,T+1)])),l.current=f}P(r),x.current?.querySelector(`[data-graview-choose-box="${CSS.escape(r)}"]`)?.focus();return}if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="a"){e.preventDefault(),e.stopPropagation(),v(t);return}if(e.key===" "&&!e.metaKey&&!e.ctrlKey){let s=S(e.target),r=e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement&&e.target.type==="checkbox";if(!s||r)return;e.preventDefault(),u(s.dataset.graviewChoose,e.shiftKey)}},onFocus:e=>{let o=O(e.target);o!==void 0&&P(o)},onPointerDown:e=>{if(g.current=!1,e.pointerType==="mouse"||e.button>0)return;let o=S(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox")return;let a=o.dataset.graviewChoose;h(),c.current={id:a,x:e.clientX,y:e.clientY,timer:setTimeout(()=>{c.current=null,g.current=!0,u(a)},N)}},onPointerMove:e=>{let o=c.current;o&&Math.hypot(e.clientX-o.x,e.clientY-o.y)>_&&h()},onPointerUp:h,onPointerCancel:h,onClickCapture:e=>{let o=S(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox"&&e.target.hasAttribute("data-graview-choose-box"))return;if(g.current){g.current=!1,e.preventDefault(),e.stopPropagation();return}let s=o.dataset.graviewChoose;if(e.shiftKey&&(m||l.current!==null)){e.preventDefault(),e.stopPropagation(),u(s,!0);return}m&&matchMedia?.("(pointer: coarse)").matches&&(e.preventDefault(),e.stopPropagation(),u(s))},onContextMenu:e=>{(g.current||c.current)&&(e.preventDefault(),e.stopPropagation())},...m?{"data-graview-choosing":""}:{}},j=(0,n.useCallback)(e=>i.has(e),[i]);return{chosen:L,has:j,toggle:u,choose:v,clear:A,listProps:B,boxProps:(e,o)=>({type:"checkbox",className:"graview-choose-box","data-graview-choose-box":e,"aria-label":`Choose ${o}`,tabIndex:e===R?0:-1,checked:i.has(e),onChange:()=>{},onClick:a=>{a.stopPropagation(),u(e,a.shiftKey)}}),list:x}}var $=`
2
2
  .graview-choose-box{width:24px;height:24px;margin:0;accent-color:var(--graview-accent);cursor:pointer;opacity:0}
3
3
  [data-graview-choose]:hover .graview-choose-box,[data-graview-choose]:focus-within .graview-choose-box,.graview-choose-box:focus-visible,.graview-choose-box:checked,[data-graview-choosing] .graview-choose-box{opacity:1}
4
4
  [data-graview-choose]{-webkit-touch-callout:none}
5
5
  [data-graview-choosing] [data-graview-choose]{-webkit-user-select:none;user-select:none}
6
- `;var D=b(C(),1),w=b(k(),1),I=K(H(()=>(__graviewPreload(import.meta.url,["./chunk.I7QCXRP7.js","./chunk.O7VHAKSA.js","./chunk.P6J6VFF5.js","./chunk.L6HKDIZB.js","./chunk.OTHGZPUC.js","./chunk.WZEA2UK6.js","./chunk.V5VQCANB.js","./chunk.UT6642FC.js","./chunk.MB7LKKUD.js","./chunk.WVN62OMH.js","./chunk.BZ4VZ6WQ.js","./chunk.XDPIS7RS.js","./chunk.57R4ZUMM.js","./chunk.J7ZMNAWB.js","./chunk.VKJAGZNU.js","./chunk.LFJH6X6O.js","./chunk.VTUMPH4Z.js","./chunk.PCTVLNOS.js","./chunk.4QEDYRES.js","./chunk.JE4QQEJE.js","./chunk.SDO3U72B.js","./chunk.UG727PEE.js","./chunk.AJZBJBMO.js"]),import("./chunk.HOTOH7ZB.js")))),U=I.part((t,i)=>(0,w.jsx)(t.SeveralBar,{...i}),{what:"The selection bar"});function Q(t){return t.chosen.length===0?null:(0,w.jsx)(D.Suspense,{fallback:null,children:(0,w.jsx)(U,{...t})})}var W=()=>I.prefetch();export{Y as a,$ as b,Q as c,W as d};
6
+ `;var D=b(C(),1),w=b(k(),1),I=K(H(()=>(__graviewPreload(import.meta.url,["./chunk.6BIRNR5P.js","./chunk.GBCWI2LF.js","./chunk.QJJKITXF.js","./chunk.7AEE3VHC.js","./chunk.JUT2VCFW.js","./chunk.DAZEFSWI.js","./chunk.OGF6UORU.js","./chunk.UT6642FC.js","./chunk.MB7LKKUD.js","./chunk.ESU2DD3J.js","./chunk.PL2P2OON.js","./chunk.27ZVVPRZ.js","./chunk.IN4PKQO5.js","./chunk.3IUJ4GW7.js","./chunk.UG23RICT.js","./chunk.MZOIPCDA.js","./chunk.KERLVJ6I.js","./chunk.4EPT2CQG.js","./chunk.FNXW46U4.js","./chunk.4JWT6LIS.js","./chunk.SDO3U72B.js","./chunk.AW2T3KFV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZP6PS5Z4.js")))),U=I.part((t,i)=>(0,w.jsx)(t.SeveralBar,{...i}),{what:"The selection bar"});function Q(t){return t.chosen.length===0?null:(0,w.jsx)(D.Suspense,{fallback:null,children:(0,w.jsx)(U,{...t})})}var W=()=>I.prefetch();export{Y as a,$ as b,Q as c,W as d};
@@ -1 +1 @@
1
- import{b as on,c as an,d as te,e as sn,f as re,h as Re,i as dn,n as cn,q as oe}from"./chunk.VKJAGZNU.js";import{$a as We,B as pe,Ba as Be,Bb as Xe,C as me,Da as _e,F as ke,Gb as en,H as Ce,Ha as be,I as Ze,Ia as ve,Oa as He,Ra as Ue,aa as Ke,ab as Je,b as Te,c as De,cc as nn,d as $e,e as K,ea as Ve,eb as xe,fb as Ye,g as de,h as M,i as Pe,j as Ge,k as ce,ka as Ie,l as Me,m as Le,nc as tn,o as Fe,oc as rn,p as le,q as he,ub as U,v as Ne,va as we,x as ne,xb as Qe,ya as qe,z as fe}from"./chunk.UG727PEE.js";function ln(e){if(typeof e=="string")return{form:"string",light:e};if(typeof e!="object"||e===null)return;let s=e,n=w=>typeof s[w]=="string"?s[w]:void 0,t=n("light")??n("src");if(t===void 0)return;let[o,u,m]=[n("dark"),n("alt"),n("darkFallback")];return{form:n("light")!==void 0?"light":"src",light:t,...o!==void 0?{dark:o}:{},...u!==void 0?{alt:u}:{},...m!==void 0?{darkFallback:m}:{}}}function Gn(e,s){let n=e.brand??{},t=n.accent?rn(n.accent):void 0;t&&!t.ok&&s.push(dn("brand","brand.accent",`that accent cannot make a readable brand, so the app keeps Graview's colors: ${t.why}`,"pick a color further from orange-red, or a darker one"));let o=ln(n.logo),u=n.name??e.name,m=n.typography?Object.fromEntries(Object.entries(n.typography).filter(([,w])=>typeof w=="string"&&!/url\(|@import|[;{}<>\\]/i.test(w)).map(([w,L])=>[w,tn(L)])):void 0;return{name:u,schemes:t?.ok?t.schemes:nn,...n.currency?{currency:n.currency}:{},...n.locale?{locale:n.locale}:{},...n.timeZone?{timeZone:n.timeZone}:{},...o?{logo:o.dark||o.darkFallback==="invert"?{light:o.light,...o.dark?{dark:o.dark}:{darkFallback:"invert"}}:o.light,logoAlt:o.alt??u}:{},...n.favicon?{favicon:n.favicon}:{},...e.description?{subtitle:e.description}:{},...m?{typography:m}:{},...n.shape?{shape:n.shape}:{},...n.accents?{accents:n.accents}:{},...n.scheme?{scheme:n.scheme}:{}}}function fn(e){let{currency:s,locale:n,timeZone:t}=e.brand??{};return{...s?{currency:s}:{},...n?{locale:n}:{},...t?{timeZone:t}:{}}}var bn=Symbol.for("@graview/core:typed-field"),pn=(e,s)=>(/^(phone|place|duration)$/.test(s)&&(me(e)[bn]=s),e),mn=/^(?=(?:\D*\d){3})\+?[\d ()./-]+(?: *(?:ext\.?|x|#) *\d+)?$/i;function un(e){let s=M().check(K(300),fe(t=>Be(t,e)!==void 0,`a record of ${e.kinds.join(" or ")} in ${e.address}, as "<kind>:<id>"`)),n=e.cardinality==="one"?s:le(s).check(K(200));return _e(e.description?n.check(pe(e.description)):n,e)}var xn=new WeakMap;function gn(e,s){xn.set(e,s)}var Rn=[{where:"settings[]",was:"honoured",now:"honored",since:"0.1.16"},{where:"pages",was:"overview",now:"scene",since:"0.1.17"}],V=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function yn(e,s=Rn){if(!V(e))return{document:e,respelled:[]};let n=[],t=e;for(let o of s)t=Oe(t,o.where.split("."),o,"",n);return{document:t,respelled:n}}function Oe(e,s,n,t,o){if(s.length===0){if(!V(e)||!Object.hasOwn(e,n.was))return e;o.push(`${t}${n.was}`);let{[n.was]:D,...N}=e;return Object.hasOwn(e,n.now)?N:{...N,[n.now]:D}}if(!V(e))return e;let[u,...m]=s,w=u.endsWith("[]"),L=w?u.slice(0,-2):u,F=e[L],B=F;if(!w)B=Oe(F,m,n,`${t}${L}.`,o);else if(Array.isArray(F)){let D=F.map((N,W)=>Oe(N,m,n,`${t}${L}.${W}.`,o));B=D.some((N,W)=>N!==F[W])?D:F}return B===F?e:{...e,[L]:B}}var hn="graview-compiled@1";function On(e,s){return e.find(([n,t])=>n!==q&&"ref"in t&&(t.ref==="*"||t.ref.includes(s)))?.[0]}var q="id",ue=e=>typeof e=="string"&&/^\$[A-Za-z][A-Za-z0-9]*$/.test(e)?e.slice(1):void 0;function kn(e){let s=Object.entries(e.fields),n=t=>["name","title","label"].find(o=>t.some(([u])=>u===o))??t[0]?.[0];return n(s.filter(([,t])=>t.required&&(t.type==="string"||t.type==="text")))??n(s.filter(([,t])=>t.type==="string"))}function wn(e,s,n){let t;switch(e.type){case"string":case"place":t=M().check(K(500));break;case"phone":t=M().check(K(40),de(mn,"a phone number"));break;case"text":t=M().check(K(2e4)),e.format&&(me(t)[Symbol.for("@graview/core:markdown")]=1);break;case"number":case"integer":case"duration":{let u=e.min??(e.type==="duration"?0:void 0),m=[...e.type==="number"?[]:[Me()],...u===void 0?[]:[De(u)],...e.max===void 0?[]:[Te(e.max)],...e.step===void 0?[]:[$e(e.step)]];t=m.length>0?ce().check(...m):ce();break}case"boolean":t=Le();break;case"date":t=M().check(de(ke,"a date like 2026-10-02"));break;case"datetime":t=M().check(fe(Ce,"a date and time like 2026-10-02T14:30:00Z"));break;case"enum":t=Ne(e.options);break;case"list":t=le(e.of==="number"?ce():e.of==="date"?M().check(de(ke)):e.of==="image"||e.of==="video"||e.of==="file"?we(e.of):M().check(K(500))).check(K(200));break;case"image":case"video":case"file":t=we(e.type);break;case"app-link":t=qe();break;case"url":t=Ge();break;case"email":t=Pe();break}let o=e.type==="number"||e.type==="integer";return pn(t,o&&e.format==="duration"?"duration":e.type),e.description&&(t=t.check(pe(e.description))),o&&(e.format==="money"||e.format==="percent"||!e.format&&e.unit)&&Xe(t,{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{}}),s?ne(t):t}var ie=e=>{throw new U(`there is no record "${e}"`,"invalid")},zn=(e,s)=>"field"in e?wn(e.field,e.optional,s):"ref"in e?en(e.ref):ne(Fe()),An=new WeakMap;var ze=(e,s)=>V(s)&&Object.keys(e??{}).length===Object.keys(s).length&&Object.keys(e??{}).every(n=>Object.hasOwn(s,n));function it(e,s={}){let n=V(e)?e.format:void 0;if(n!==hn)return{ok:!1,findings:[Re("compiled-format","format",n===void 0?"this is not a compiled Graview app":`this compiled app is ${JSON.stringify(n)}, and this build reads ${hn}`,"compile the document instead")]};let t=e,o=yn(t.document).document,u=o===t.document?t:{...t,document:o},m=V(o)&&typeof o.name=="string"&&V(o.kinds)&&ze(o.kinds,u.kinds)&&ze(o.acts,u.acts)&&ze(o.rules,u.rules)&&Array.isArray(u.edges)&&Array.isArray(u.findings),w={ok:!1,findings:[Re("compiled-shape","","this compiled app's parts do not match its document","compile the document instead")]};if(!m)return w;try{return Sn(u,s)}catch{return w}}function Sn(e,s={}){let{document:n}=e,t=n.brand?.timeZone,o=s.today??(()=>Ze(t)),u=new Map(e.edges.map(([h,r])=>[h,r])),m=new Map;for(let[h,r]of Object.entries(n.kinds)){let z=e.kinds[h]?.computed,O=ve(r.edges);m.set(h,{fields:new Set([...Object.keys(r.fields),...O.keys()]),edges:new Map(Object.entries(be(r.edges)).map(([j,$])=>[j,$.cardinality??"many"])),...z?{computed:new Map(z)}:{},...O.size>0?{linked:O}:{}})}e.facts&&m.set(an,{computed:new Map(e.facts)});let w=fn(n),L=new Map,F=Object.entries(n.kinds).map(([h,r])=>{let z={};for(let[i,g]of Object.entries(r.fields))z[i]=wn(g,!g.required,w),g.repeats&&(z[He(i)]=ne(Ue()));for(let[i,g]of ve(r.edges))z[i]=ne(un(g));let{label:O,describe:j,durations:$}=e.kinds[h]??{},P=Object.entries(r.computed??{}).map(([i,g])=>[i,typeof g=="string"?{expr:g}:g]),J=Object.hasOwn(r.fields,"label")&&!r.fields.label.label&&!/\{\s*label\b/.test(r.label??`{${kn(r)??""}}`),_=Object.fromEntries([...J?[["label","Label"]]:[],...Object.entries(r.fields).filter(([,i])=>i.label).map(([i,g])=>[i,g.label]),...P.filter(([,i])=>i.label).map(([i,g])=>[i,g.label])]),A=Object.keys(_).length>0,l=Object.fromEntries(Object.entries(r.fields).filter(([,i])=>i.default!==void 0).map(([i,g])=>[i,g.default]));L.set(h,l);let T=Object.fromEntries(Object.entries(be(r.edges)).map(([i,{renamedFrom:g,...I}])=>[i,I])),S=i=>r[i]?{[i]:r[i]}:{};return Ke(h,{fields:he(z),edges:T,...S("plural"),...S("noun"),...S("description"),...O?{label:i=>oe(O,{node:i,kinds:m,today:o(),money:w})||i.id}:{},...j?{describe:i=>oe(j,{node:i,kinds:m,today:o(),money:w})}:{},...S("lifecycle"),...S("figure"),...S("fieldRoles"),...S("people"),archives:r.archives,...r.tidying?{tidying:r.tidying}:{},...P.length>0?{computed:Object.fromEntries(P.map(([i,g])=>[i,$?.includes(i)?{...g,as:"duration"}:r.computed[i]]))}:{},...A||r.glance||r.page?{display:{...A?{labels:_}:{},...r.glance?{glance:[...r.glance]}:{},...r.page?{page:r.page}:{}}}:{},...Object.keys(l).length>0?{defaults:l}:{}})}),B=We(F,n.computed);function D(h){return B.tryDefinition(h.kind)?.label?.(h)??h.id}let N=h=>({id:"",kind:h,...L.get(h)}),W=[];for(let[h,r]of Object.entries(n.acts??{})){let z=e.acts[h],{title:O,effects:j,guard:$,refusal:P,destructive:J,idempotent:_,creates:A,connects:l,severs:T,writes:S,writesOther:i,sets:g}=z,I=new Map(z.args),ae={};for(let[d,x]of I)ae[d]=zn(x,w);let b=[r.on??[]].flat(),C=new Map(z.exprs),G=j.find(d=>"create"in d),Y=(d,x,f,v=null)=>{if(V(d)&&"expr"in d)return re(C.get(d.expr),{graph:f,subject:v,kinds:m,bindings:x,today:o()});let k=ue(d);return k===void 0?typeof d=="string"&&d.startsWith("$$")?d.slice(1):d:k==="now"?new Date().toISOString():k==="today"?o():x[k]},Ee=(d,x)=>{if(!G)return"";let f=n.kinds[G.create].fields,v=N(G.create),k=[];for(let[R,ee]of Object.entries(G.set??{})){try{v[R]=Y(ee,d,x)??v[R]}catch{}let Q=ue(ee);Q&&d[Q]!==void 0&&k.push(R)}let Z=D(v).trim(),H=k.filter(R=>v[R]!==!1&&f[R].type!=="text"&&!(/[^]{41}/.test(v[R])||/ .*[.!?]$/.test(v[R])&&!/[ .][A-Z]\w{0,3}\.$/.test(v[R]))&&D({...v,[R]:void 0}).trim()===Z).map(R=>v[R]===!0?f[R].label??Ve(R):cn(v[R],f[R].format,o(),[],w));return Z&&H.length>0?`${Z} (${H.join(", ")})`:Z};W.push(Qe(h,{input:he(ae),title:O,...r.description?{description:r.description}:{},...r.fromTheOtherEnd?{fromTheOtherEnd:r.fromTheOtherEnd}:{},...I.has(q)?{subject:{kinds:b.length>0?b:"*",arg:q}}:{},...J?{destructive:!0}:{},..._?{idempotent:!0}:{},...A.length>0?{creates:A}:{},...l.length>0?{connects:l}:{},...T.length>0?{severs:T}:{},writes:S,...Object.keys(i).length>0?{writesOther:i}:{},...Object.keys(g).length>0?{sets:g}:{},describe:(d,x)=>{let f=typeof d[q]=="string"?x.getNode(d[q]):void 0,v=f?D(f):Ee(d,x);return v?`${O}: ${v}`:O},apply(d,x){let f=d.graph,v=typeof x[q]=="string"?x[q]:void 0,k=v?f.getNode(v):void 0;if(v&&!k&&ie(v),k&&b.length>0&&!b.includes(k.kind))throw new U(`"${O}" acts on ${b.join(" or ")}, not on ${Ie(k.kind)}`,"invalid");let Z={};for(let[a,c]of Object.entries(x))c!==void 0&&(Z[a]=c);if($&&k){let a;try{a=re($,{graph:f,subject:k,kinds:m,bindings:Z,today:o()})}catch(c){throw c instanceof te?new U(`"${O}" could not be judged: ${c.sentence}`):c}if(a!==!0)throw new U(P?oe(P,{node:k,kinds:m,graph:f,bindings:Z,today:o(),money:w}):`"${O}" is not allowed for ${D(k)} right now`)}let H=new Map,R=a=>f.has(a)||[...H.values()].includes(a),ee=new Set,Q=a=>{let c=Je(a);ee.has(c)||(ee.add(c),d.removeEdge(a))},X=(a,c)=>{let p=ue(a);if(p==="subject")return v;if(p==="me"){let y=d.me;if(y&&n.kinds[f.getNode(y)?.kind]?.people)return y;throw new U(`"${O}" is done as you, and you have no record here`)}if(H.has(p))return H.get(p);try{return Y(a,Z,f,c??k??null)}catch(y){throw y instanceof te?new U(`"${O}" could not work out a value: ${y.sentence}`):y}};for(let a of j)if("create"in a){let c=n.kinds[a.create],p=N(a.create);for(let[ye,se]of Object.entries(a.set??{})){let je=X(se,void 0);je!==void 0&&(p[ye]=je)}let y=kn(c),E=d.freshId(String((y&&p[y])??a.create),a.create);d.addNode({...p,id:E}),a.as&&H.set(a.as,E)}else if("connect"in a||"sever"in a){let c="connect"in a?a.connect:a.sever,p=String(X(a.from,void 0)??""),y=String(X(a.to,void 0)??"");if(R(p)||ie(p),R(y)||ie(y),"connect"in a){if(u.get(c)?.cardinality==="one")for(let E of f.out(p,c))E.id!==y&&Q({kind:c,from:p,to:E.id});f.out(p,c).some(E=>E.id===y)||d.addEdge({kind:c,from:p,to:y})}else Q({kind:c,from:p,to:y})}else if("set"in a){let c=String(X(a.target??"$subject",void 0)??""),p=f.getNode(c);!p&&!R(c)&&ie(c);let y={};for(let[E,ye]of Object.entries(a.set)){let se=X(ye,p);se!==void 0&&(y[E]=se)}Object.keys(y).length>0&&d.patchNode(c,y)}else if("remove"in a){let c=String(X(a.remove,void 0)??"");f.has(c)||ie(c),d.removeNode(c)}else if("replace"in a&&k){let c=x.to;for(let p of a.replace){let y=u.get(p)?.from.includes(k.kind)??!0;for(let E of y?f.out(k.id,p):f.in(k.id,p))p===a.keep&&E.id===c||Q(y?{kind:p,from:k.id,to:E.id}:{kind:p,from:E.id,to:k.id})}}}}))}let Ae=[];for(let[h,r]of Object.entries(n.rules??{})){let{title:z,require:O,when:j,says:$}=e.rules[h],P=r.repairs??[],J=(A,l,T=o(),S)=>{let i=[],g={graph:A,subject:l,kinds:m,today:T,...S?{linked:S}:{},onUnread:b=>i.push(b)},I;try{if(j&&re(j,g)!==!0)return[];if(I=re(O,g)===!0,!I&&i.length>0)throw new te(`it reads ${on(i[0])}`,0)}catch(b){throw b instanceof sn?new Ye(b.sentence):b instanceof te?new Error(b.sentence):b}if(I)return[];let ae=P.flatMap(b=>{let C=n.acts?.[b.act],G={},Y=l&&C?.on&&C.fromTheOtherEnd&&![C.on].flat().includes(l.kind)?On(e.acts[b.act].args,l.kind):void 0;Y?G[Y]=l.id:l&&(C?.on||/^(edit|remove|archive|unarchive|merge|skip|detach|split)-/.test(b.act))&&(G[q]=l.id);for(let[x,f]of Object.entries(b.args??{}))G[x]=ue(f)==="subject"?l?.id:f;let d=(C?e.acts[b.act].args:[]).filter(([x,f])=>f.required&&G[x]===void 0).map(([x])=>x);return[{mutation:b.act,label:b.label??(Y?C.fromTheOtherEnd:C?.title)??b.act.replace(/-/g," "),args:G,...d.length>0?{missing:d}:{}}]});return[{invariant:h,...l?{subjectId:l.id}:{},label:z,message:$?oe($,{node:l,kinds:m,graph:A,today:T,money:w}):l?`${D(l)}: ${z}`:z,nodeIds:l?[l.id]:[],repairs:ae}]},_={label:z,shape:{over:r.over,require:O,when:j,says:$,declared:n.kinds,money:w,kinds:m,today:o},judgment:{require:r.require,...r.when?{when:r.when}:{},...r.says?{says:r.says}:{}},...r.description?{description:r.description}:{},...P.length>0?{repairs:P.map(A=>A.act)}:{}};Ae.push(r.over==="graph"?xe(h,{scope:"graph",..._,evaluate:({graph:A,today:l,context:T})=>J(A,null,l,T?.linked)}):xe(h,{scope:{kind:r.over},..._,evaluate:({graph:A,subject:l,today:T,context:S})=>J(A,l,T,S?.linked)}))}let Se=n.policy&&{...n.policy,...n.roles?{roles:n.roles}:{}},ge={name:n.name,schema:B,mutations:W,invariants:Ae,...Se?{policy:Se}:{},...e.brand?{brand:e.brand}:{},...n.modules?{modules:n.modules}:{},...n.lenses?{lenses:n.lenses}:{},...n.pages?{pages:n.pages}:{},...n.settings?{settings:n.settings}:{},...n.connections?{connections:n.connections}:{},...e.viewSpecs?{viewSpecs:e.viewSpecs}:{},...e.home?{home:e.home}:{},version:n.version??1};return gn(ge,n),An.set(ge,e),{ok:!0,app:ge,document:n,findings:e.findings,sights:n.policy?.sees,kinds:m}}export{yn as a,Gn as b,hn as c,q as d,ue as e,kn as f,it as g,Sn as h};
1
+ import{b as on,c as an,d as te,e as sn,f as re,h as Oe,i as dn,n as cn,q as oe}from"./chunk.UG23RICT.js";import{$a as We,B as pe,Ba as Be,Bb as Xe,C as me,Da as _e,F as ke,Gb as en,H as Ce,Ha as be,I as Ze,Ia as ve,Oa as He,Ra as Ue,aa as Ke,ab as Je,b as De,c as Te,cc as nn,d as $e,db as xe,e as K,ea as Ve,eb as Ye,g as de,h as M,i as Pe,j as Ge,k as ce,ka as Ie,l as Me,m as Le,nc as tn,o as Fe,oc as rn,p as le,q as he,ub as U,v as Ne,va as we,x as ne,xb as Qe,ya as qe,z as fe}from"./chunk.AW2T3KFV.js";function ln(e){if(typeof e=="string")return{form:"string",light:e};if(typeof e!="object"||e===null)return;let s=e,n=w=>typeof s[w]=="string"?s[w]:void 0,t=n("light")??n("src");if(t===void 0)return;let[o,u,m]=[n("dark"),n("alt"),n("darkFallback")];return{form:n("light")!==void 0?"light":"src",light:t,...o!==void 0?{dark:o}:{},...u!==void 0?{alt:u}:{},...m!==void 0?{darkFallback:m}:{}}}function Gn(e,s){let n=e.brand??{},t=n.accent?rn(n.accent):void 0;t&&!t.ok&&s.push(dn("brand","brand.accent",`that accent cannot make a readable brand, so the app keeps Graview's colors: ${t.why}`,"pick a color further from orange-red, or a darker one"));let o=ln(n.logo),u=n.name??e.name,m=n.typography?Object.fromEntries(Object.entries(n.typography).filter(([,w])=>typeof w=="string"&&!/url\(|@import|[;{}<>\\]/i.test(w)).map(([w,L])=>[w,tn(L)])):void 0;return{name:u,schemes:t?.ok?t.schemes:nn,...n.currency?{currency:n.currency}:{},...n.locale?{locale:n.locale}:{},...n.timeZone?{timeZone:n.timeZone}:{},...o?{logo:o.dark||o.darkFallback==="invert"?{light:o.light,...o.dark?{dark:o.dark}:{darkFallback:"invert"}}:o.light,logoAlt:o.alt??u}:{},...n.favicon?{favicon:n.favicon}:{},...e.description?{subtitle:e.description}:{},...m?{typography:m}:{},...n.shape?{shape:n.shape}:{},...n.accents?{accents:n.accents}:{},...n.scheme?{scheme:n.scheme}:{}}}function fn(e){let{currency:s,locale:n,timeZone:t}=e.brand??{};return{...s?{currency:s}:{},...n?{locale:n}:{},...t?{timeZone:t}:{}}}var bn=Symbol.for("@graview/core:typed-field"),pn=(e,s)=>(/^(phone|place|duration)$/.test(s)&&(me(e)[bn]=s),e),mn=/^(?=(?:\D*\d){3})\+?[\d ()./-]+(?: *(?:ext\.?|x|#) *\d+)?$/i;function un(e){let s=M().check(K(300),fe(t=>Be(t,e)!==void 0,`a record of ${e.kinds.join(" or ")} in ${e.address}, as "<kind>:<id>"`)),n=e.cardinality==="one"?s:le(s).check(K(200));return _e(e.description?n.check(pe(e.description)):n,e)}var xn=new WeakMap;function gn(e,s){xn.set(e,s)}var On=[{where:"settings[]",was:"honoured",now:"honored",since:"0.1.16"},{where:"pages",was:"overview",now:"scene",since:"0.1.17"}],V=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function yn(e,s=On){if(!V(e))return{document:e,respelled:[]};let n=[],t=e;for(let o of s)t=Re(t,o.where.split("."),o,"",n);return{document:t,respelled:n}}function Re(e,s,n,t,o){if(s.length===0){if(!V(e)||!Object.hasOwn(e,n.was))return e;o.push(`${t}${n.was}`);let{[n.was]:T,...N}=e;return Object.hasOwn(e,n.now)?N:{...N,[n.now]:T}}if(!V(e))return e;let[u,...m]=s,w=u.endsWith("[]"),L=w?u.slice(0,-2):u,F=e[L],B=F;if(!w)B=Re(F,m,n,`${t}${L}.`,o);else if(Array.isArray(F)){let T=F.map((N,W)=>Re(N,m,n,`${t}${L}.${W}.`,o));B=T.some((N,W)=>N!==F[W])?T:F}return B===F?e:{...e,[L]:B}}var hn="graview-compiled@1";function Rn(e,s){return e.find(([n,t])=>n!==q&&"ref"in t&&(t.ref==="*"||t.ref.includes(s)))?.[0]}var q="id",ue=e=>typeof e=="string"&&/^\$[A-Za-z][A-Za-z0-9]*$/.test(e)?e.slice(1):void 0;function kn(e){let s=Object.entries(e.fields),n=t=>["name","title","label"].find(o=>t.some(([u])=>u===o))??t[0]?.[0];return n(s.filter(([,t])=>t.required&&(t.type==="string"||t.type==="text")))??n(s.filter(([,t])=>t.type==="string"))}function wn(e,s,n){let t;switch(e.type){case"string":case"place":t=M().check(K(500));break;case"phone":t=M().check(K(40),de(mn,"a phone number"));break;case"text":t=M().check(K(2e4)),e.format&&(me(t)[Symbol.for("@graview/core:markdown")]=1);break;case"number":case"integer":case"duration":{let u=e.min??(e.type==="duration"?0:void 0),m=[...e.type==="number"?[]:[Me()],...u===void 0?[]:[Te(u)],...e.max===void 0?[]:[De(e.max)],...e.step===void 0?[]:[$e(e.step)]];t=m.length>0?ce().check(...m):ce();break}case"boolean":t=Le();break;case"date":t=M().check(de(ke,"a date like 2026-10-02"));break;case"datetime":t=M().check(fe(Ce,"a date and time like 2026-10-02T14:30:00Z"));break;case"enum":t=Ne(e.options);break;case"list":t=le(e.of==="number"?ce():e.of==="date"?M().check(de(ke)):e.of==="image"||e.of==="video"||e.of==="file"?we(e.of):M().check(K(500))).check(K(200));break;case"image":case"video":case"file":t=we(e.type);break;case"app-link":t=qe();break;case"url":t=Ge();break;case"email":t=Pe();break}let o=e.type==="number"||e.type==="integer";return pn(t,o&&e.format==="duration"?"duration":e.type),e.description&&(t=t.check(pe(e.description))),o&&(e.format==="money"||e.format==="percent"||!e.format&&e.unit)&&Xe(t,{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{}}),s?ne(t):t}var ie=e=>{throw new U(`there is no record "${e}"`,"invalid")},zn=(e,s)=>"field"in e?wn(e.field,e.optional,s):"ref"in e?en(e.ref):ne(Fe()),An=new WeakMap;var ze=(e,s)=>V(s)&&Object.keys(e??{}).length===Object.keys(s).length&&Object.keys(e??{}).every(n=>Object.hasOwn(s,n));function it(e,s={}){let n=V(e)?e.format:void 0;if(n!==hn)return{ok:!1,findings:[Oe("compiled-format","format",n===void 0?"this is not a compiled Graview app":`this compiled app is ${JSON.stringify(n)}, and this build reads ${hn}`,"compile the document instead")]};let t=e,o=yn(t.document).document,u=o===t.document?t:{...t,document:o},m=V(o)&&typeof o.name=="string"&&V(o.kinds)&&ze(o.kinds,u.kinds)&&ze(o.acts,u.acts)&&ze(o.rules,u.rules)&&Array.isArray(u.edges)&&Array.isArray(u.findings),w={ok:!1,findings:[Oe("compiled-shape","","this compiled app's parts do not match its document","compile the document instead")]};if(!m)return w;try{return Sn(u,s)}catch{return w}}function Sn(e,s={}){let{document:n}=e,t=n.brand?.timeZone,o=s.today??(()=>Ze(t)),u=new Map(e.edges.map(([h,r])=>[h,r])),m=new Map;for(let[h,r]of Object.entries(n.kinds)){let z=e.kinds[h]?.computed,R=ve(r.edges);m.set(h,{fields:new Set([...Object.keys(r.fields),...R.keys()]),edges:new Map(Object.entries(be(r.edges)).map(([j,$])=>[j,$.cardinality??"many"])),...z?{computed:new Map(z)}:{},...R.size>0?{linked:R}:{}})}e.facts&&m.set(an,{computed:new Map(e.facts)});let w=fn(n),L=new Map,F=Object.entries(n.kinds).map(([h,r])=>{let z={};for(let[i,g]of Object.entries(r.fields))z[i]=wn(g,!g.required,w),g.repeats&&(z[He(i)]=ne(Ue()));for(let[i,g]of ve(r.edges))z[i]=ne(un(g));let{label:R,describe:j,durations:$}=e.kinds[h]??{},P=Object.entries(r.computed??{}).map(([i,g])=>[i,typeof g=="string"?{expr:g}:g]),J=Object.hasOwn(r.fields,"label")&&!r.fields.label.label&&!/\{\s*label\b/.test(r.label??`{${kn(r)??""}}`),_=Object.fromEntries([...J?[["label","Label"]]:[],...Object.entries(r.fields).filter(([,i])=>i.label).map(([i,g])=>[i,g.label]),...P.filter(([,i])=>i.label).map(([i,g])=>[i,g.label])]),A=Object.keys(_).length>0,l=Object.fromEntries(Object.entries(r.fields).filter(([,i])=>i.default!==void 0).map(([i,g])=>[i,g.default]));L.set(h,l);let D=Object.fromEntries(Object.entries(be(r.edges)).map(([i,{renamedFrom:g,...I}])=>[i,I])),S=i=>r[i]?{[i]:r[i]}:{};return Ke(h,{fields:he(z),edges:D,...S("plural"),...S("noun"),...S("description"),...R?{label:i=>oe(R,{node:i,kinds:m,today:o(),money:w})||i.id}:{},...j?{describe:i=>oe(j,{node:i,kinds:m,today:o(),money:w})}:{},...S("lifecycle"),...S("figure"),...S("fieldRoles"),...S("people"),archives:r.archives,...r.tidying?{tidying:r.tidying}:{},...P.length>0?{computed:Object.fromEntries(P.map(([i,g])=>[i,$?.includes(i)?{...g,as:"duration"}:r.computed[i]]))}:{},...A||r.glance||r.page?{display:{...A?{labels:_}:{},...r.glance?{glance:[...r.glance]}:{},...r.page?{page:r.page}:{}}}:{},...Object.keys(l).length>0?{defaults:l}:{}})}),B=We(F,n.computed);function T(h){return B.tryDefinition(h.kind)?.label?.(h)??h.id}let N=h=>({id:"",kind:h,...L.get(h)}),W=[];for(let[h,r]of Object.entries(n.acts??{})){let z=e.acts[h],{title:R,effects:j,guard:$,refusal:P,destructive:J,idempotent:_,creates:A,connects:l,severs:D,writes:S,writesOther:i,sets:g}=z,I=new Map(z.args),ae={};for(let[d,x]of I)ae[d]=zn(x,w);let b=[r.on??[]].flat(),C=new Map(z.exprs),G=j.find(d=>"create"in d),Y=(d,x,f,v=null)=>{if(V(d)&&"expr"in d)return re(C.get(d.expr),{graph:f,subject:v,kinds:m,bindings:x,today:o()});let k=ue(d);return k===void 0?typeof d=="string"&&d.startsWith("$$")?d.slice(1):d:k==="now"?new Date().toISOString():k==="today"?o():x[k]},Ee=(d,x)=>{if(!G)return"";let f=n.kinds[G.create].fields,v=N(G.create),k=[];for(let[O,ee]of Object.entries(G.set??{})){try{v[O]=Y(ee,d,x)??v[O]}catch{}let Q=ue(ee);Q&&d[Q]!==void 0&&k.push(O)}let Z=T(v).trim(),H=k.filter(O=>v[O]!==!1&&f[O].type!=="text"&&!(/[^]{41}/.test(v[O])||/ .*[.!?]$/.test(v[O])&&!/[ .][A-Z]\w{0,3}\.$/.test(v[O]))&&T({...v,[O]:void 0}).trim()===Z).map(O=>v[O]===!0?f[O].label??Ve(O):cn(v[O],f[O].format,o(),[],w));return Z&&H.length>0?`${Z} (${H.join(", ")})`:Z};W.push(Qe(h,{input:he(ae),title:R,...r.description?{description:r.description}:{},...r.fromTheOtherEnd?{fromTheOtherEnd:r.fromTheOtherEnd}:{},...I.has(q)?{subject:{kinds:b.length>0?b:"*",arg:q}}:{},...J?{destructive:!0}:{},..._?{idempotent:!0}:{},...A.length>0?{creates:A}:{},...l.length>0?{connects:l}:{},...D.length>0?{severs:D}:{},writes:S,...Object.keys(i).length>0?{writesOther:i}:{},...Object.keys(g).length>0?{sets:g}:{},describe:(d,x)=>{let f=typeof d[q]=="string"?x.getNode(d[q]):void 0,v=f?T(f):Ee(d,x);return v?`${R}: ${v}`:R},apply(d,x){let f=d.graph,v=typeof x[q]=="string"?x[q]:void 0,k=v?f.getNode(v):void 0;if(v&&!k&&ie(v),k&&b.length>0&&!b.includes(k.kind))throw new U(`"${R}" acts on ${b.join(" or ")}, not on ${Ie(k.kind)}`,"invalid");let Z={};for(let[a,c]of Object.entries(x))c!==void 0&&(Z[a]=c);if($&&k){let a;try{a=re($,{graph:f,subject:k,kinds:m,bindings:Z,today:o()})}catch(c){throw c instanceof te?new U(`"${R}" could not be judged: ${c.sentence}`):c}if(a!==!0)throw new U(P?oe(P,{node:k,kinds:m,graph:f,bindings:Z,today:o(),money:w}):`"${R}" is not allowed for ${T(k)} right now`)}let H=new Map,O=a=>f.has(a)||[...H.values()].includes(a),ee=new Set,Q=a=>{let c=Je(a);ee.has(c)||(ee.add(c),d.removeEdge(a))},X=(a,c)=>{let p=ue(a);if(p==="subject")return v;if(p==="me"){let y=d.me;if(y&&n.kinds[f.getNode(y)?.kind]?.people)return y;throw new U(`"${R}" is done as you, and you have no record here`)}if(H.has(p))return H.get(p);try{return Y(a,Z,f,c??k??null)}catch(y){throw y instanceof te?new U(`"${R}" could not work out a value: ${y.sentence}`):y}};for(let a of j)if("create"in a){let c=n.kinds[a.create],p=N(a.create);for(let[ye,se]of Object.entries(a.set??{})){let je=X(se,void 0);je!==void 0&&(p[ye]=je)}let y=kn(c),E=d.freshId(String((y&&p[y])??a.create),a.create);d.addNode({...p,id:E}),a.as&&H.set(a.as,E)}else if("connect"in a||"sever"in a){let c="connect"in a?a.connect:a.sever,p=String(X(a.from,void 0)??""),y=String(X(a.to,void 0)??"");if(O(p)||ie(p),O(y)||ie(y),"connect"in a){if(u.get(c)?.cardinality==="one")for(let E of f.out(p,c))E.id!==y&&Q({kind:c,from:p,to:E.id});f.out(p,c).some(E=>E.id===y)||d.addEdge({kind:c,from:p,to:y})}else Q({kind:c,from:p,to:y})}else if("set"in a){let c=String(X(a.target??"$subject",void 0)??""),p=f.getNode(c);!p&&!O(c)&&ie(c);let y={};for(let[E,ye]of Object.entries(a.set)){let se=X(ye,p);se!==void 0&&(y[E]=se)}Object.keys(y).length>0&&d.patchNode(c,y)}else if("remove"in a){let c=String(X(a.remove,void 0)??"");f.has(c)||ie(c),d.removeNode(c)}else if("replace"in a&&k){let c=x.to;for(let p of a.replace){let y=u.get(p)?.from.includes(k.kind)??!0;for(let E of y?f.out(k.id,p):f.in(k.id,p))p===a.keep&&E.id===c||Q(y?{kind:p,from:k.id,to:E.id}:{kind:p,from:E.id,to:k.id})}}}}))}let Ae=[];for(let[h,r]of Object.entries(n.rules??{})){let{title:z,require:R,when:j,says:$}=e.rules[h],P=r.repairs??[],J=(A,l,D=o(),S)=>{let i=[],g={graph:A,subject:l,kinds:m,today:D,...S?{linked:S}:{},onUnread:b=>i.push(b)},I;try{if(j&&re(j,g)!==!0)return[];if(I=re(R,g)===!0,!I&&i.length>0)throw new te(`it reads ${on(i[0])}`,0)}catch(b){throw b instanceof sn?new Ye(b.sentence):b instanceof te?new Error(b.sentence):b}if(I)return[];let ae=P.flatMap(b=>{let C=n.acts?.[b.act],G={},Y=l&&C?.on&&C.fromTheOtherEnd&&![C.on].flat().includes(l.kind)?Rn(e.acts[b.act].args,l.kind):void 0;Y?G[Y]=l.id:l&&(C?.on||/^(edit|remove|archive|unarchive|merge|skip|detach|split)-/.test(b.act))&&(G[q]=l.id);for(let[x,f]of Object.entries(b.args??{}))G[x]=ue(f)==="subject"?l?.id:f;let d=(C?e.acts[b.act].args:[]).filter(([x,f])=>f.required&&G[x]===void 0).map(([x])=>x);return[{mutation:b.act,label:b.label??(Y?C.fromTheOtherEnd:C?.title)??b.act.replace(/-/g," "),args:G,...d.length>0?{missing:d}:{}}]});return[{invariant:h,...l?{subjectId:l.id}:{},label:z,message:$?oe($,{node:l,kinds:m,graph:A,today:D,money:w}):l?`${T(l)}: ${z}`:z,nodeIds:l?[l.id]:[],repairs:ae}]},_={label:z,shape:{over:r.over,require:R,when:j,says:$,declared:n.kinds,money:w,kinds:m,today:o},judgment:{require:r.require,...r.when?{when:r.when}:{},...r.says?{says:r.says}:{}},...r.description?{description:r.description}:{},...P.length>0?{repairs:P.map(A=>A.act)}:{}};Ae.push(r.over==="graph"?xe(h,{scope:"graph",..._,evaluate:({graph:A,today:l,context:D})=>J(A,null,l,D?.linked)}):xe(h,{scope:{kind:r.over},..._,evaluate:({graph:A,subject:l,today:D,context:S})=>J(A,l,D,S?.linked)}))}let Se=n.policy&&{...n.policy,...n.roles?{roles:n.roles}:{}},ge={name:n.name,schema:B,mutations:W,invariants:Ae,...Se?{policy:Se}:{},...e.brand?{brand:e.brand}:{},...n.modules?{modules:n.modules}:{},...n.lenses?{lenses:n.lenses}:{},...n.pages?{pages:n.pages}:{},...n.settings?{settings:n.settings}:{},...n.connections?{connections:n.connections}:{},...e.viewSpecs?{viewSpecs:e.viewSpecs}:{},...e.home?{home:e.home}:{},version:n.version??1};return gn(ge,n),An.set(ge,e),{ok:!0,app:ge,document:n,findings:e.findings,sights:n.policy?.sees,kinds:m}}export{yn as a,Gn as b,hn as c,q as d,ue as e,kn as f,it as g,Sn as h};
@@ -0,0 +1 @@
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{G as k,R as n,ua as o}from"./chunk.4JWT6LIS.js";import{a as t}from"./chunk.SDO3U72B.js";import{b as p}from"./chunk.AJZBJBMO.js";var f=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.ESU2DD3J.js","./chunk.PL2P2OON.js","./chunk.27ZVVPRZ.js","./chunk.IN4PKQO5.js","./chunk.3IUJ4GW7.js","./chunk.UG23RICT.js","./chunk.GZHZLJBF.js","./chunk.ATKKTPJS.js","./chunk.OJGHDWI6.js","./chunk.UZSZPMRC.js","./chunk.MZOIPCDA.js","./chunk.KERLVJ6I.js","./chunk.4EPT2CQG.js","./chunk.FNXW46U4.js","./chunk.4JWT6LIS.js","./chunk.SDO3U72B.js","./chunk.AW2T3KFV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.YTZDCIX2.js")))),y=f.part((e,r)=>e.drawFiles(r),{quiet:!0});var d=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.GZHZLJBF.js","./chunk.ATKKTPJS.js","./chunk.OJGHDWI6.js","./chunk.UZSZPMRC.js","./chunk.MZOIPCDA.js","./chunk.KERLVJ6I.js","./chunk.4EPT2CQG.js","./chunk.FNXW46U4.js","./chunk.4JWT6LIS.js","./chunk.SDO3U72B.js","./chunk.AW2T3KFV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.LKXYZK5H.js")))),I=d.part((e,r)=>e.drawLinkedRecord(r),{quiet:!0}),w=d.part((e,r)=>e.drawLinkedPicker(r),{what:"Picking a linked record"});var s=p(n(),1),m=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.GZHZLJBF.js","./chunk.ATKKTPJS.js","./chunk.OJGHDWI6.js","./chunk.UZSZPMRC.js","./chunk.MZOIPCDA.js","./chunk.KERLVJ6I.js","./chunk.4EPT2CQG.js","./chunk.FNXW46U4.js","./chunk.4JWT6LIS.js","./chunk.SDO3U72B.js","./chunk.AW2T3KFV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.V4DR25S4.js")))),E=m.part((e,r)=>(0,s.jsx)(e.RepeatPicker,{...r}),{quiet:!0}),W=m.part((e,r)=>(0,s.jsx)(e.RepeatEditor,{...r}),{quiet:!0});var a=p(k(),1),i=p(n(),1),c=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.MZOIPCDA.js","./chunk.KERLVJ6I.js","./chunk.4EPT2CQG.js","./chunk.FNXW46U4.js","./chunk.4JWT6LIS.js","./chunk.SDO3U72B.js","./chunk.AW2T3KFV.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.4WCQWILK.js")))),l=c.part((e,r)=>(0,i.jsx)(e.WhenInput,{...r}),{quiet:!0});function M(e){return(0,i.jsx)(a.Suspense,{fallback:(0,i.jsx)("span",{"data-graview-when-arriving":"",style:{display:"inline-block",minHeight:24}}),children:(0,i.jsx)(l,{...e})})}var N=()=>c.load().then(()=>{},()=>{});export{y as a,I as b,w as c,E as d,W as e,M as f,N as g};
@@ -1,2 +1,2 @@
1
- import{a as te,b as E,d as re,g as ie,h as de,i as ae}from"./chunk.PCTVLNOS.js";import{Ca as J,Cb as oe,Ea as Q,Eb as se,F as I,G as x,I as P,Ma as M,O as A,Qa as X,R as K,S as Y,Sa as ee,Ua as ne,W as T,Y as Z,ca as v,ja as B,la as H,ra as U,sa as G,ta as V,xa as q}from"./chunk.UG727PEE.js";var ye=t=>`${t}${t%100>=11&&t%100<=13?"th":["th","st","nd","rd"][t%10]??"th"}`,ue={day:"day",week:"week",month:"month",year:"year"},S=t=>t.length<2?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`;function ge(t,e,n){let o=e.interval??1,d=ue[e.every],c=t.slice(0,10),y=o===1?`Every ${d}`:o===2?`Every other ${d}`:`Every ${o} ${d}s`,a;if(e.every==="week"){let u=(e.on?.length?e.on:[M[new Date(`${c}T00:00:00Z`).getUTCDay()]]).map(f=>Z(M.indexOf(f),"long",n));a=o===1?`Every ${S(u)}`:o===2?`Every other ${S(u)}`:`${y} on ${S(u)}`}else if(e.every==="month"){let u=(e.on?.length?e.on:[+c.slice(8,10)]).map(f=>f===-1?"the last day":`the ${ye(Number(f))}`);a=`${y} on ${S(u)}`}else e.every==="year"?a=`${y} on ${T(c,n)}`:a=y;return x.test(t)&&(a+=` at ${Y(t,n)}`),e.until&&(a+=`, until ${A(e.until,n)}`),e.count&&(a+=`, ${e.count===1?"once":`${e.count} times`}`),a}function le(t,e,n={}){if(!ee(e)||typeof t!="string")return;let o=n.today??P(),d=ne(t,e,o),c=ge(t,e,n.locale),y=d.slice(0,4)===o.slice(0,4)?T(d.slice(0,10),n.locale):A(d.slice(0,10),n.locale);return d.slice(0,10)<o?`${c}, last ${y}`:`${c}, next ${y}`}function Ye(t,e){let n=new Map,o=new Map;for(let d of t){let c=v(e(d.kind),d).trim().toLowerCase();o.set(c,[...o.get(c)??[],d])}for(let d of o.values()){if(d.length<2)continue;let c=new Map;for(let y of d)c.set(y.kind,[...c.get(y.kind)??[],y]);for(let[y,a]of c){if(a.length===1){n.set(a[0].id,H(e(y),y));continue}let u=a.map(r=>new Map(he(r,e(r.kind)).map(l=>[l.key,l.alone]))),f=[...new Set(u.flatMap(r=>[...r.keys()]))],h=r=>u.every(l=>!/\d/.test(l.get(r)??"")),$=[...f.filter(h),...f.filter(r=>!h(r))],O=(r,l)=>l.map(g=>u[r].get(g)??"").filter(Boolean).join(" \xB7 "),_=r=>new Set(a.map((l,g)=>O(g,r))).size===a.length&&a.every((l,g)=>O(g,r)!==""),i=$.find(r=>_([r])),s=i?void 0:$.flatMap((r,l)=>$.slice(l+1).map(g=>[r,g])).find(r=>_(r));a.forEach((r,l)=>{if(i||s)return void n.set(r.id,O(l,i?[i]:s));let g=$.find(b=>{let k=u[l].get(b);return k!==void 0&&k!==""&&u.every((R,m)=>m===l||R.get(b)!==k)});n.set(r.id,g?u[l].get(g):`${l+1} of ${a.length}`)})}}return n}function Ze(t,e){return t?.describe?t.describe(e):`${e.kind} ${v(t,e)}`}var pe=new Set(["id","kind","label"]);function me(t,e){if(e.length===0)return!1;let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[\\s\xB7,(/])${n}($|[\\s\xB7,)/])`).test(t)}function he(t,e,n={}){let o=e?.display,d=new Set([...pe,...o?.hide??[]]);typeof t.label=="string"&&e?.label&&!v(e,t).includes(t.label)&&d.delete("label");let c=(n.said??[]).filter(i=>!!i),y=c.filter(i=>i.endsWith("\u2026")).map(i=>i.replace(/…$/,"").trim()).filter(i=>i.length>12),a=[],u=e?.fields?.shape,f=e?.fieldRoles,h=n.glance?o?.glance??[f?.who,f?.when].filter(i=>!!i):ce(o?.page),$=n.glance&&o?.glance!==void 0,_=[...new Set($?h:[...h,...be(e),...Object.keys(t)])].filter(i=>Object.hasOwn(t,i)).map(i=>[i,t[i]]);for(let[i,s]of _){if(d.has(i)||s===void 0||s===null)continue;let r=o?.format?.[i],l=r?[]:V(s);if(l[0]&&n.glance)continue;let g=e?.fields?.shape?.[i],b=!r&&typeof s=="string"&&q(g)?s:void 0,k=!r&&typeof s=="string"&&te(g);if(b&&n.glance)continue;let R=r?void 0:Q(g),m=R?{relation:R,refs:J(s,R)}:void 0;if(m&&(n.glance||m.refs.length===0)||!l[0]&&typeof s=="object"&&(!Array.isArray(s)||s.some(p=>typeof p=="object"&&p!==null))&&r===void 0)continue;let j=typeof s=="string"&&!r?le(s,t[`${i}Repeat`],{locale:n.locale}):void 0,F=l[0]?l.map(p=>`${p.caption?`${p.name} \u2014 ${p.caption}`:p.name}${U(p)?` (${G(p)})`:""}`).join(", "):Array.isArray(s)?s.join(", "):typeof s=="boolean"?s?"Yes":"No":String(s),N=r?void 0:ie(e,i),L=ae(N,s),W=!r&&!N&&typeof s=="number"?oe(e?.fields?.shape?.[i]):void 0,z=m?m.refs.length>1?`${m.refs.length} linked records`:"linked record":r?r(s):W?se(s,W):de(N,s,n.locale)??(Array.isArray(s)||typeof s=="boolean"?F:typeof s=="string"&&j!==void 0?j:typeof s=="string"&&I.test(s)?A(s,n.locale):typeof s=="string"&&x.test(s)?K(s,n.locale,n.timeZone):typeof s=="string"&&$e(e,i)?E(e,i,s):F),C=typeof s=="string"&&_e(e,i,z),w=(n.glance||n.excerpt)&&!r&&(C||k)?re(z,{markdown:k}):z;if(c.includes(w)||y.some(p=>w.startsWith(p))||n.glance&&(typeof s=="string"||typeof s=="number")&&c.some(p=>me(p,w)))continue;let D=B(e,i),fe=typeof s=="number"?`${D} ${w}`:typeof s=="boolean"&&!r?`${D}: ${w.toLowerCase()}`:w;if(a.push({key:i,label:D,value:w,stored:F,alone:fe,long:C,...k?{markdown:!0}:{},...l[0]?{files:l}:{},...b?{app:b}:{},...m?{linked:m}:{},...L?{href:L}:{},...X(u?.[`${i}Repeat`])?{repeats:!0}:{}}),n.limit!==void 0&&a.length>=n.limit)break}return ke(a,e)}function ke(t,e){let n=new Map;for(let o of t){let d=we(e,o.key);d&&n.set(o.key,new Set(d.map(c=>E(e,o.key,c).toLowerCase())))}return n.size<2?t:t.map(o=>{let d=n.get(o.key);return d!==void 0&&[...n].some(([y,a])=>y!==o.key&&[...d].some(u=>a.has(u)))?{...o,alone:`${o.label}: ${o.value.toLowerCase()}`}:o})}function we(t,e){let n=t?.fields?.shape?.[e];for(let o=0;o<6&&n?._zod?.def?.innerType!==void 0;o++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"&&n._zod.def.entries?Object.values(n._zod.def.entries).map(String):void 0}function $e(t,e){let n=t?.fields?.shape?.[e];for(let o=0;o<6&&n?._zod?.def?.innerType!==void 0;o++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"}function be(t){let e=t?.fields?.shape;return[...Object.keys(e??{}),...Object.keys(t?.computed??{})]}function ce(t){return[...t?.fields??[],...(t?.groups??[]).flatMap(e=>e.fields)]}var Re=500,Ae=160;function Oe(t){let e=t;for(let n=0;n<6&&e?._zod?.def?.innerType!==void 0;n++)e=e._zod.def.innerType;return e?._zod?.def?.type==="string"?e._zod.def:void 0}function _e(t,e,n){return Oe(t?.fields?.shape?.[e])?.checks?.some(d=>d._zod?.def?.check==="max_length"&&(d._zod.def.maximum??0)>Re)?!0:typeof n=="string"&&(n.includes(`
1
+ import{a as te,b as E,d as re,g as ie,h as de,i as ae}from"./chunk.4EPT2CQG.js";import{Ca as J,Cb as oe,Ea as Q,Eb as se,F as I,G as x,I as P,Ma as M,O as A,Qa as X,R as K,S as Y,Sa as ee,Ua as ne,W as T,Y as Z,ca as v,ja as B,la as H,ra as U,sa as G,ta as V,xa as q}from"./chunk.AW2T3KFV.js";var ye=t=>`${t}${t%100>=11&&t%100<=13?"th":["th","st","nd","rd"][t%10]??"th"}`,ue={day:"day",week:"week",month:"month",year:"year"},S=t=>t.length<2?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`;function ge(t,e,n){let o=e.interval??1,d=ue[e.every],c=t.slice(0,10),y=o===1?`Every ${d}`:o===2?`Every other ${d}`:`Every ${o} ${d}s`,a;if(e.every==="week"){let u=(e.on?.length?e.on:[M[new Date(`${c}T00:00:00Z`).getUTCDay()]]).map(f=>Z(M.indexOf(f),"long",n));a=o===1?`Every ${S(u)}`:o===2?`Every other ${S(u)}`:`${y} on ${S(u)}`}else if(e.every==="month"){let u=(e.on?.length?e.on:[+c.slice(8,10)]).map(f=>f===-1?"the last day":`the ${ye(Number(f))}`);a=`${y} on ${S(u)}`}else e.every==="year"?a=`${y} on ${T(c,n)}`:a=y;return x.test(t)&&(a+=` at ${Y(t,n)}`),e.until&&(a+=`, until ${A(e.until,n)}`),e.count&&(a+=`, ${e.count===1?"once":`${e.count} times`}`),a}function le(t,e,n={}){if(!ee(e)||typeof t!="string")return;let o=n.today??P(),d=ne(t,e,o),c=ge(t,e,n.locale),y=d.slice(0,4)===o.slice(0,4)?T(d.slice(0,10),n.locale):A(d.slice(0,10),n.locale);return d.slice(0,10)<o?`${c}, last ${y}`:`${c}, next ${y}`}function Ye(t,e){let n=new Map,o=new Map;for(let d of t){let c=v(e(d.kind),d).trim().toLowerCase();o.set(c,[...o.get(c)??[],d])}for(let d of o.values()){if(d.length<2)continue;let c=new Map;for(let y of d)c.set(y.kind,[...c.get(y.kind)??[],y]);for(let[y,a]of c){if(a.length===1){n.set(a[0].id,H(e(y),y));continue}let u=a.map(r=>new Map(he(r,e(r.kind)).map(l=>[l.key,l.alone]))),f=[...new Set(u.flatMap(r=>[...r.keys()]))],h=r=>u.every(l=>!/\d/.test(l.get(r)??"")),$=[...f.filter(h),...f.filter(r=>!h(r))],O=(r,l)=>l.map(g=>u[r].get(g)??"").filter(Boolean).join(" \xB7 "),_=r=>new Set(a.map((l,g)=>O(g,r))).size===a.length&&a.every((l,g)=>O(g,r)!==""),i=$.find(r=>_([r])),s=i?void 0:$.flatMap((r,l)=>$.slice(l+1).map(g=>[r,g])).find(r=>_(r));a.forEach((r,l)=>{if(i||s)return void n.set(r.id,O(l,i?[i]:s));let g=$.find(b=>{let k=u[l].get(b);return k!==void 0&&k!==""&&u.every((R,m)=>m===l||R.get(b)!==k)});n.set(r.id,g?u[l].get(g):`${l+1} of ${a.length}`)})}}return n}function Ze(t,e){return t?.describe?t.describe(e):`${e.kind} ${v(t,e)}`}var pe=new Set(["id","kind","label"]);function me(t,e){if(e.length===0)return!1;let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[\\s\xB7,(/])${n}($|[\\s\xB7,)/])`).test(t)}function he(t,e,n={}){let o=e?.display,d=new Set([...pe,...o?.hide??[]]);typeof t.label=="string"&&e?.label&&!v(e,t).includes(t.label)&&d.delete("label");let c=(n.said??[]).filter(i=>!!i),y=c.filter(i=>i.endsWith("\u2026")).map(i=>i.replace(/…$/,"").trim()).filter(i=>i.length>12),a=[],u=e?.fields?.shape,f=e?.fieldRoles,h=n.glance?o?.glance??[f?.who,f?.when].filter(i=>!!i):ce(o?.page),$=n.glance&&o?.glance!==void 0,_=[...new Set($?h:[...h,...be(e),...Object.keys(t)])].filter(i=>Object.hasOwn(t,i)).map(i=>[i,t[i]]);for(let[i,s]of _){if(d.has(i)||s===void 0||s===null)continue;let r=o?.format?.[i],l=r?[]:V(s);if(l[0]&&n.glance)continue;let g=e?.fields?.shape?.[i],b=!r&&typeof s=="string"&&q(g)?s:void 0,k=!r&&typeof s=="string"&&te(g);if(b&&n.glance)continue;let R=r?void 0:Q(g),m=R?{relation:R,refs:J(s,R)}:void 0;if(m&&(n.glance||m.refs.length===0)||!l[0]&&typeof s=="object"&&(!Array.isArray(s)||s.some(p=>typeof p=="object"&&p!==null))&&r===void 0)continue;let j=typeof s=="string"&&!r?le(s,t[`${i}Repeat`],{locale:n.locale}):void 0,F=l[0]?l.map(p=>`${p.caption?`${p.name} \u2014 ${p.caption}`:p.name}${U(p)?` (${G(p)})`:""}`).join(", "):Array.isArray(s)?s.join(", "):typeof s=="boolean"?s?"Yes":"No":String(s),N=r?void 0:ie(e,i),L=ae(N,s),W=!r&&!N&&typeof s=="number"?oe(e?.fields?.shape?.[i]):void 0,z=m?m.refs.length>1?`${m.refs.length} linked records`:"linked record":r?r(s):W?se(s,W):de(N,s,n.locale)??(Array.isArray(s)||typeof s=="boolean"?F:typeof s=="string"&&j!==void 0?j:typeof s=="string"&&I.test(s)?A(s,n.locale):typeof s=="string"&&x.test(s)?K(s,n.locale,n.timeZone):typeof s=="string"&&$e(e,i)?E(e,i,s):F),C=typeof s=="string"&&_e(e,i,z),w=(n.glance||n.excerpt)&&!r&&(C||k)?re(z,{markdown:k}):z;if(c.includes(w)||y.some(p=>w.startsWith(p))||n.glance&&(typeof s=="string"||typeof s=="number")&&c.some(p=>me(p,w)))continue;let D=B(e,i),fe=typeof s=="number"?`${D} ${w}`:typeof s=="boolean"&&!r?`${D}: ${w.toLowerCase()}`:w;if(a.push({key:i,label:D,value:w,stored:F,alone:fe,long:C,...k?{markdown:!0}:{},...l[0]?{files:l}:{},...b?{app:b}:{},...m?{linked:m}:{},...L?{href:L}:{},...X(u?.[`${i}Repeat`])?{repeats:!0}:{}}),n.limit!==void 0&&a.length>=n.limit)break}return ke(a,e)}function ke(t,e){let n=new Map;for(let o of t){let d=we(e,o.key);d&&n.set(o.key,new Set(d.map(c=>E(e,o.key,c).toLowerCase())))}return n.size<2?t:t.map(o=>{let d=n.get(o.key);return d!==void 0&&[...n].some(([y,a])=>y!==o.key&&[...d].some(u=>a.has(u)))?{...o,alone:`${o.label}: ${o.value.toLowerCase()}`}:o})}function we(t,e){let n=t?.fields?.shape?.[e];for(let o=0;o<6&&n?._zod?.def?.innerType!==void 0;o++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"&&n._zod.def.entries?Object.values(n._zod.def.entries).map(String):void 0}function $e(t,e){let n=t?.fields?.shape?.[e];for(let o=0;o<6&&n?._zod?.def?.innerType!==void 0;o++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"}function be(t){let e=t?.fields?.shape;return[...Object.keys(e??{}),...Object.keys(t?.computed??{})]}function ce(t){return[...t?.fields??[],...(t?.groups??[]).flatMap(e=>e.fields)]}var Re=500,Ae=160;function Oe(t){let e=t;for(let n=0;n<6&&e?._zod?.def?.innerType!==void 0;n++)e=e._zod.def.innerType;return e?._zod?.def?.type==="string"?e._zod.def:void 0}function _e(t,e,n){return Oe(t?.fields?.shape?.[e])?.checks?.some(d=>d._zod?.def?.check==="max_length"&&(d._zod.def.maximum??0)>Re)?!0:typeof n=="string"&&(n.includes(`
2
2
  `)||n.length>Ae)}function Be(t,e){let n=t?.display?.page,o=n?.groups??[],d=new Map(e.map(f=>[f.key,f])),c=new Set(ce(n)),y=f=>f.flatMap(h=>d.has(h)?[d.get(h)]:[]),a=e.filter(f=>!c.has(f.key));return[{fields:[...y(n?.fields??[]),...o.length>0?[]:a]},...o.map(f=>({title:f.title,fields:y(f.fields)})),...o.length>0?[{title:"Details",fields:a}]:[]].filter(f=>f.fields.length>0)}export{ge as a,Ye as b,Ze as c,he as d,Be as e};
@@ -0,0 +1 @@
1
+ import{b as c}from"./chunk.2EXY4AHX.js";import"./chunk.OAWAUB4P.js";import"./chunk.PSTE3LZL.js";import"./chunk.UGFDSE37.js";import{l as m}from"./chunk.JGYGSNQY.js";import"./chunk.JLOSQ5UY.js";import"./chunk.FNF6XQI5.js";import"./chunk.LUPBT6YM.js";import"./chunk.IBWPRK2R.js";import"./chunk.RNUGQRJI.js";import"./chunk.6NFR2LYQ.js";import"./chunk.PXQVXBNG.js";import"./chunk.YERDP6YF.js";import"./chunk.P5K7EYDK.js";import"./chunk.7AEE3VHC.js";import"./chunk.U3CV5CCL.js";import"./chunk.LKF4BBCW.js";import"./chunk.NPS2WN7T.js";import"./chunk.JUT2VCFW.js";import"./chunk.HKD5SR45.js";import"./chunk.JEMQ66FT.js";import"./chunk.7UV7ODXU.js";import"./chunk.IIB22IIP.js";import"./chunk.MWUP5X47.js";import"./chunk.OGF6UORU.js";import"./chunk.UT6642FC.js";import"./chunk.WE5SA6TP.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.ESU2DD3J.js";import"./chunk.PL2P2OON.js";import"./chunk.27ZVVPRZ.js";import"./chunk.IN4PKQO5.js";import"./chunk.3IUJ4GW7.js";import"./chunk.UG23RICT.js";import"./chunk.GZHZLJBF.js";import"./chunk.ATKKTPJS.js";import"./chunk.OJGHDWI6.js";import"./chunk.UZSZPMRC.js";import"./chunk.MZOIPCDA.js";import"./chunk.KERLVJ6I.js";import"./chunk.4EPT2CQG.js";import"./chunk.FNXW46U4.js";import{G as S,R as g}from"./chunk.4JWT6LIS.js";import"./chunk.SDO3U72B.js";import{rd as n}from"./chunk.AW2T3KFV.js";import"./chunk.2AZTW66C.js";import{b as t}from"./chunk.AJZBJBMO.js";var y=t(S(),1),a=t(g(),1);function E({store:h,auto:f,brand:i,views:u,presence:o,steering:r,overview:s,scope:d,titleLevel:v=2,quickAsk:l,props:e}){let b=(0,y.useMemo)(()=>m({scope:`.${d}`}),[d]);return(0,a.jsxs)("div",{"data-embed-content":"",style:f?{flex:"0 0 auto",background:"var(--graview-ground)"}:{flex:"1 1 auto",minHeight:0,overflow:"auto",background:"var(--graview-ground)"},children:[(0,a.jsx)("style",{children:b}),(0,a.jsx)("div",{"data-embed-measure":"",style:{display:"flow-root"},children:(0,a.jsx)(c,{context:{store:h,embedded:!0,...e.bar!==!1?{barAbove:!0}:{},...s?{overview:s}:{},titleLevel:v,views:u,settings:e.app.settings??[],...o?{presence:o}:{},...i?{brand:i}:{},...e.locale?{locale:e.locale}:{},...e.timeZone?{timeZone:e.timeZone}:{},...e.principal?{principal:e.principal}:{},...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{},...e.subscriptions?{subscriptions:e.subscriptions}:{},...e.signIn?{signIn:e.signIn}:{},...l!==void 0?{quickAsk:l}:{}},...e.pages?{registry:e.pages}:{},...r?{steering:r}:{},...e.routing==="address"?n(e.basePath)===""?{}:{basename:n(e.basePath)}:{initialPath:e.path??"/"},...e.path!==void 0?{path:e.path}:{},...e.onNavigate?{onNavigate:e.onNavigate}:{}})})]})}export{E as PagesContent};