graview 0.1.38 → 0.1.39

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 (197) hide show
  1. package/dist/preview/chunk.23WYWIAJ.js +1 -0
  2. package/dist/preview/{chunk.5XJEGXDO.js → chunk.2BJRS3YJ.js} +1 -1
  3. package/dist/preview/{chunk.ROGYDMES.js → chunk.2GGDOFTF.js} +1 -1
  4. package/dist/preview/chunk.2HF54MYG.js +1 -0
  5. package/dist/preview/{chunk.OE4QOBJF.js → chunk.2IX3CZNP.js} +1 -1
  6. package/dist/preview/chunk.2NSTEREJ.js +1 -0
  7. package/dist/preview/chunk.2RCNSHXK.js +1 -0
  8. package/dist/preview/chunk.37ASLBGE.js +1 -0
  9. package/dist/preview/{chunk.33GN2NUT.js → chunk.3ZNQ5YKX.js} +1 -1
  10. package/dist/preview/{chunk.EUGWV3S6.js → chunk.4BBJ62ZO.js} +1 -1
  11. package/dist/preview/chunk.4ECICQ2S.js +1 -0
  12. package/dist/preview/{chunk.B5ILKGEF.js → chunk.4PNFX3TX.js} +1 -1
  13. package/dist/preview/{chunk.WG5NIR23.js → chunk.546WEHEX.js} +1 -1
  14. package/dist/preview/chunk.57OPL5WD.js +1 -0
  15. package/dist/preview/{chunk.36SQJMEE.js → chunk.5JPRFXYQ.js} +1 -1
  16. package/dist/preview/chunk.5OJJ2TKZ.js +9 -0
  17. package/dist/preview/chunk.5R4E5C76.js +1 -0
  18. package/dist/preview/{chunk.7H5KVW2F.js → chunk.5XNVN4HE.js} +1 -1
  19. package/dist/preview/chunk.5ZMENPY4.js +5 -0
  20. package/dist/preview/{chunk.YPY5BOEI.js → chunk.67USHK26.js} +1 -1
  21. package/dist/preview/chunk.6CFP5UYP.js +1 -0
  22. package/dist/preview/{chunk.74RMHUCX.js → chunk.6DHHUBSC.js} +1 -1
  23. package/dist/preview/chunk.6HBEYRJU.js +1 -0
  24. package/dist/preview/chunk.6L7IDF3J.js +1 -0
  25. package/dist/preview/{chunk.ZRQI5VJF.js → chunk.6XU2CXRZ.js} +1 -1
  26. package/dist/preview/{chunk.2VIGF4FO.js → chunk.7EFNLMKU.js} +1 -1
  27. package/dist/preview/chunk.7WSXVXP3.js +1 -0
  28. package/dist/preview/chunk.ALDLAQ7V.js +1 -0
  29. package/dist/preview/chunk.AYHCQWSU.js +1 -0
  30. package/dist/preview/{chunk.QYRPELLU.js → chunk.B2IRADR2.js} +1 -1
  31. package/dist/preview/{chunk.V2NBJDAX.js → chunk.B7TB6YRZ.js} +1 -1
  32. package/dist/preview/chunk.BCHHBGM6.js +1 -0
  33. package/dist/preview/{chunk.LHO7L3CS.js → chunk.BEC5ZH2L.js} +1 -1
  34. package/dist/preview/chunk.BL4S3I2N.js +1 -0
  35. package/dist/preview/chunk.BS3FX4PX.js +1 -0
  36. package/dist/preview/chunk.BTSXYZ6Z.js +25 -0
  37. package/dist/preview/chunk.BYKR7NEE.js +1 -0
  38. package/dist/preview/chunk.BZSU4HH2.js +1 -0
  39. package/dist/preview/chunk.C2OAKTZX.js +1 -0
  40. package/dist/preview/chunk.C4CFYTCW.js +1 -0
  41. package/dist/preview/{chunk.6ONRWFA6.js → chunk.C6X7CKU6.js} +1 -1
  42. package/dist/preview/chunk.CAMQ7MYJ.js +1 -0
  43. package/dist/preview/{chunk.NPX7SPXM.js → chunk.CC47O2DW.js} +1 -1
  44. package/dist/preview/{chunk.ZLXPIEUC.js → chunk.CF7DHTKL.js} +2 -2
  45. package/dist/preview/{chunk.SGB6IMWN.js → chunk.CMN6VVK2.js} +1 -1
  46. package/dist/preview/chunk.CTK2P4JV.js +3 -0
  47. package/dist/preview/chunk.DAA7IDQ4.js +1 -0
  48. package/dist/preview/{chunk.6UCRL4OF.js → chunk.DYNBWIPF.js} +1 -1
  49. package/dist/preview/chunk.E3HXXUKY.js +1 -0
  50. package/dist/preview/{chunk.GZ3IXNA4.js → chunk.EBHKKOPO.js} +1 -1
  51. package/dist/preview/chunk.EDC4EMIX.js +1 -0
  52. package/dist/preview/chunk.EM4Y4YAD.js +2 -0
  53. package/dist/preview/{chunk.IEDXW36H.js → chunk.EWWJMS6G.js} +1 -1
  54. package/dist/preview/chunk.F5UVEF2R.js +1 -0
  55. package/dist/preview/{chunk.TKSGC6XH.js → chunk.FCXBCKED.js} +1 -1
  56. package/dist/preview/chunk.FGDHEVH4.js +1 -0
  57. package/dist/preview/{chunk.IM7LXLIB.js → chunk.FILCNVGH.js} +1 -1
  58. package/dist/preview/chunk.FJBQ4UP3.js +32 -0
  59. package/dist/preview/{chunk.RZVZG2BQ.js → chunk.FMN5XDLE.js} +1 -1
  60. package/dist/preview/chunk.G23VFYGF.js +88 -0
  61. package/dist/preview/chunk.G46WGK5E.js +1 -0
  62. package/dist/preview/chunk.GAFYE37S.js +3 -0
  63. package/dist/preview/{chunk.VNBR4DHD.js → chunk.GP2F7TIN.js} +1 -1
  64. package/dist/preview/chunk.GXKECZ4S.js +19 -0
  65. package/dist/preview/{chunk.3D5T3XIE.js → chunk.H5CZZZLX.js} +1 -1
  66. package/dist/preview/{chunk.V5ZT5NSJ.js → chunk.HA3PPIEQ.js} +1 -1
  67. package/dist/preview/chunk.HFDYFPMJ.js +1 -0
  68. package/dist/preview/chunk.HFYUAK5Z.js +6 -0
  69. package/dist/preview/chunk.HGS32FT2.js +1 -0
  70. package/dist/preview/chunk.HHUCPVG5.js +1 -0
  71. package/dist/preview/{chunk.LF7PU77M.js → chunk.I7CU2E3C.js} +1 -1
  72. package/dist/preview/{chunk.MCVY6RRS.js → chunk.IAZRY42B.js} +1 -1
  73. package/dist/preview/{chunk.5MSO3KRO.js → chunk.ITEF3U2E.js} +1 -1
  74. package/dist/preview/{chunk.AZCFXPEL.js → chunk.IXYBIDAN.js} +1 -1
  75. package/dist/preview/{chunk.FTJBW25J.js → chunk.J3M2MZHG.js} +1 -1
  76. package/dist/preview/{chunk.MVNUWK5Y.js → chunk.JBTU2PJ4.js} +1 -1
  77. package/dist/preview/chunk.JCR3ECUM.js +1 -0
  78. package/dist/preview/{chunk.JWJQ2VXS.js → chunk.JEZTPXEB.js} +1 -1
  79. package/dist/preview/chunk.KIJCOW25.js +1 -0
  80. package/dist/preview/{chunk.2EJAIT33.js → chunk.KJNUZYXS.js} +1 -1
  81. package/dist/preview/chunk.L7DQKPJV.js +117 -0
  82. package/dist/preview/{chunk.RVJYEOFN.js → chunk.LCYMYLOP.js} +1 -1
  83. package/dist/preview/chunk.LP2DJ5ZB.js +6 -0
  84. package/dist/preview/chunk.LP3QUPCE.js +1 -0
  85. package/dist/preview/chunk.M5QFUGGG.js +1 -0
  86. package/dist/preview/chunk.N2SV3KX7.js +1 -0
  87. package/dist/preview/chunk.N7N5OFPL.js +1 -0
  88. package/dist/preview/{chunk.WERYQENC.js → chunk.NG3YMQ36.js} +1 -1
  89. package/dist/preview/{chunk.MWZK3HVG.js → chunk.NSNGPQGT.js} +1 -1
  90. package/dist/preview/chunk.OJKS3UQS.js +1 -0
  91. package/dist/preview/{chunk.KNJZ2YNJ.js → chunk.OM5CDW2S.js} +1 -1
  92. package/dist/preview/{chunk.QT4XGC5Z.js → chunk.ORXFUK6F.js} +2 -2
  93. package/dist/preview/chunk.OXTUXWMU.js +1 -0
  94. package/dist/preview/chunk.OYMM2UWE.js +1 -0
  95. package/dist/preview/chunk.P3JYH6HO.js +1 -0
  96. package/dist/preview/{chunk.FMVWXSQ7.js → chunk.P4WYBSYA.js} +1 -1
  97. package/dist/preview/chunk.P5325GYR.js +1 -0
  98. package/dist/preview/chunk.PMER4LVT.js +1 -0
  99. package/dist/preview/chunk.PONWLTTB.js +1 -0
  100. package/dist/preview/chunk.PXQVXBNG.js +1 -0
  101. package/dist/preview/chunk.QCF6Z2AZ.js +1 -0
  102. package/dist/preview/chunk.QEXXLWEU.js +6 -0
  103. package/dist/preview/chunk.QMFUPTR4.js +1 -0
  104. package/dist/preview/{chunk.BUVAMSOZ.js → chunk.RM7NVN7B.js} +2 -2
  105. package/dist/preview/{chunk.YUJG5SN5.js → chunk.ROINZMNO.js} +1 -1
  106. package/dist/preview/chunk.ROKRQRID.js +35 -0
  107. package/dist/preview/chunk.RWB4235L.js +1 -0
  108. package/dist/preview/chunk.RXSHFG6S.js +1 -0
  109. package/dist/preview/chunk.SDO3U72B.js +1 -0
  110. package/dist/preview/chunk.SHNYYBNW.js +1 -0
  111. package/dist/preview/{chunk.L73VUBXN.js → chunk.SK33IHL2.js} +2 -2
  112. package/dist/preview/chunk.STBJV6HJ.js +1 -0
  113. package/dist/preview/chunk.TCUB6IDY.js +1 -0
  114. package/dist/preview/chunk.TJCTTJWE.js +1 -0
  115. package/dist/preview/{chunk.SZWX56WR.js → chunk.TU4KG22J.js} +2 -2
  116. package/dist/preview/chunk.U4E5GQTK.js +1 -0
  117. package/dist/preview/{chunk.Z3ZKYSPN.js → chunk.U7QMA4H7.js} +1 -1
  118. package/dist/preview/{chunk.UXIFQIHA.js → chunk.UB3O3QJQ.js} +1 -1
  119. package/dist/preview/{chunk.6XJP7F3I.js → chunk.UCZR33MK.js} +1 -1
  120. package/dist/preview/chunk.UGCNMAPC.js +1 -0
  121. package/dist/preview/{chunk.VKHKYK5L.js → chunk.UIUHGA6W.js} +1 -1
  122. package/dist/preview/chunk.VC4JPG7O.js +1 -0
  123. package/dist/preview/{chunk.DL637Q3W.js → chunk.W4OX4BMP.js} +1 -1
  124. package/dist/preview/chunk.WJQY4E45.js +1 -0
  125. package/dist/preview/{chunk.XHWL7QBF.js → chunk.WQPNGBR7.js} +1 -1
  126. package/dist/preview/chunk.WTZOOAIW.js +1 -0
  127. package/dist/preview/{chunk.FUJM7GDV.js → chunk.WXYUWBKX.js} +1 -1
  128. package/dist/preview/chunk.XBOZTQQA.js +1 -0
  129. package/dist/preview/{chunk.TOWYHWPB.js → chunk.XLI44BBI.js} +1 -1
  130. package/dist/preview/chunk.XLZ2QRRS.js +1 -0
  131. package/dist/preview/chunk.XQTMO5PW.js +1 -0
  132. package/dist/preview/chunk.YWVOACSX.js +5 -0
  133. package/dist/preview/{chunk.67WL7BGF.js → chunk.YXGI7H4Y.js} +1 -1
  134. package/dist/preview/{chunk.GR5Q4HTW.js → chunk.Z7JRBKA7.js} +1 -1
  135. package/dist/preview/chunk.ZR5KVYWZ.js +21 -0
  136. package/dist/preview/{chunk.6IHXTT6Z.js → chunk.ZTMDU3OH.js} +1 -1
  137. package/dist/preview/index.html +45 -43
  138. package/dist/preview/page.js +7 -7
  139. package/package.json +6 -6
  140. package/dist/preview/chunk.2HFRVWWM.js +0 -1
  141. package/dist/preview/chunk.3FW4QNGV.js +0 -1
  142. package/dist/preview/chunk.3RT2GUZ5.js +0 -1
  143. package/dist/preview/chunk.3ZRHHB7X.js +0 -1
  144. package/dist/preview/chunk.4DEUD66C.js +0 -6
  145. package/dist/preview/chunk.4EQSP7I3.js +0 -1
  146. package/dist/preview/chunk.4Y6BCHV2.js +0 -1
  147. package/dist/preview/chunk.5VBBQ6Z3.js +0 -1
  148. package/dist/preview/chunk.6CKBIY7L.js +0 -1
  149. package/dist/preview/chunk.7RSZMIAL.js +0 -1
  150. package/dist/preview/chunk.AFY35RJP.js +0 -1
  151. package/dist/preview/chunk.BRHRAVU2.js +0 -3
  152. package/dist/preview/chunk.DFVVS6C5.js +0 -1
  153. package/dist/preview/chunk.DQJAEU4V.js +0 -1
  154. package/dist/preview/chunk.ESSQAMPM.js +0 -1
  155. package/dist/preview/chunk.EV553KRT.js +0 -1
  156. package/dist/preview/chunk.EZP4FHDX.js +0 -35
  157. package/dist/preview/chunk.F6PIK2J2.js +0 -1
  158. package/dist/preview/chunk.FYIQZMVF.js +0 -1
  159. package/dist/preview/chunk.HUSFMFXH.js +0 -1
  160. package/dist/preview/chunk.HVTGPEVW.js +0 -1
  161. package/dist/preview/chunk.I3SQJ2L2.js +0 -1
  162. package/dist/preview/chunk.IU6ISXXC.js +0 -1
  163. package/dist/preview/chunk.K5KEECHL.js +0 -88
  164. package/dist/preview/chunk.L34FY7QQ.js +0 -1
  165. package/dist/preview/chunk.L7JKEEMM.js +0 -1
  166. package/dist/preview/chunk.LAW5PQEM.js +0 -1
  167. package/dist/preview/chunk.LDD3QX7G.js +0 -1
  168. package/dist/preview/chunk.LU5LSXSW.js +0 -1
  169. package/dist/preview/chunk.MQ7FNHXG.js +0 -25
  170. package/dist/preview/chunk.NH5TDAB2.js +0 -1
  171. package/dist/preview/chunk.NORRCKGN.js +0 -1
  172. package/dist/preview/chunk.NQQHOSOK.js +0 -1
  173. package/dist/preview/chunk.NWWMUOZM.js +0 -1
  174. package/dist/preview/chunk.OEF3GPRM.js +0 -1
  175. package/dist/preview/chunk.OS3L4ZOF.js +0 -2
  176. package/dist/preview/chunk.OTL3Z345.js +0 -1
  177. package/dist/preview/chunk.P3UPCI23.js +0 -1
  178. package/dist/preview/chunk.PGKIEDYV.js +0 -9
  179. package/dist/preview/chunk.PKUWET2F.js +0 -1
  180. package/dist/preview/chunk.POHEWJKZ.js +0 -1
  181. package/dist/preview/chunk.PUBG2L6F.js +0 -117
  182. package/dist/preview/chunk.QTTBZJ6W.js +0 -1
  183. package/dist/preview/chunk.RJDZOF2L.js +0 -1
  184. package/dist/preview/chunk.SGLJTSTD.js +0 -1
  185. package/dist/preview/chunk.SITFEJES.js +0 -1
  186. package/dist/preview/chunk.UF3L6FJO.js +0 -1
  187. package/dist/preview/chunk.VSYHU5MA.js +0 -1
  188. package/dist/preview/chunk.VTWFVPKD.js +0 -19
  189. package/dist/preview/chunk.VV4BPOIK.js +0 -1
  190. package/dist/preview/chunk.W2HCJQVK.js +0 -32
  191. package/dist/preview/chunk.WLPTY4BF.js +0 -5
  192. package/dist/preview/chunk.XM3NPZLP.js +0 -1
  193. package/dist/preview/chunk.YAXZNQY6.js +0 -1
  194. package/dist/preview/chunk.YG423NEB.js +0 -1
  195. package/dist/preview/chunk.YVR3ZMTV.js +0 -1
  196. package/dist/preview/chunk.YXH3IWNR.js +0 -1
  197. package/dist/preview/chunk.ZYCNEOAQ.js +0 -1
@@ -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 y}from"./chunk.2GGDOFTF.js";import{m as g}from"./chunk.ORXFUK6F.js";import{G as R,R as c,qa as m}from"./chunk.BTSXYZ6Z.js";import{a as f}from"./chunk.SDO3U72B.js";import{ka as p}from"./chunk.5ZMENPY4.js";import{b as u}from"./chunk.AJZBJBMO.js";var o=u(R(),1);var r=u(c(),1),S,h=()=>S??=m(f(()=>(__graviewPreload(import.meta.url,["./chunk.B7TB6YRZ.js","./chunk.CC47O2DW.js","./chunk.2IX3CZNP.js","./chunk.6DHHUBSC.js","./chunk.5ZMENPY4.js","./chunk.AJZBJBMO.js"]),import("./chunk.HA3PPIEQ.js"))));function L(e){let[n,t]=(0,o.useState)(()=>h().current);return(0,o.useEffect)(()=>{if(!e||n)return;let i=!0;return h().load().then(a=>i&&t(a),()=>{}),()=>{i=!1}},[e,n]),n}function D(e,n){let t=L(n.length>0);return(0,o.useMemo)(()=>t?t.withLines(e,n):n,[t,e,n])}function I(e,n){let t=L(n.some(i=>i.shape));return(0,o.useMemo)(()=>{let i=new Map;if(!t)return i;for(let a of n){let l=t.ruleLine(a,e);l&&i.set(a.name,l)}return i},[t,e,n])}function M(e){let n=e.line;if(!(!n||e.message.endsWith(` \u2014 ${n.text}`)||e.message===b(e)))return e.message}function b(e){let n=e.line;return n?n.record!==void 0?`${n.record} \u2014 ${n.text}`:n.text:e.message}var P={name:{},op:{color:"var(--graview-ink-muted)",fontWeight:500},value:{fontWeight:600,fontVariantNumeric:"tabular-nums"},word:{color:"var(--graview-ink-muted)"},open:{color:"var(--graview-ink-faint)"},close:{color:"var(--graview-ink-faint)"}};function w({parts:e}){return(0,r.jsx)(r.Fragment,{children:e.map((n,t)=>(0,r.jsxs)("span",{children:[n.space?" ":"",(0,r.jsx)("span",{"data-graview-rule-part":n.as,style:P[n.as],children:n.text})]},t))})}function x(e,n){let t=p(e?.tryDefinition(n),n);return t.charAt(0).toUpperCase()+t.slice(1)}function C({line:e,schema:n,brand:t,lead:i=e.record===void 0?"kind":"record",stacked:a=!1,style:l}){let d=e.kind,s=i==="kind"?d?x(n,d):void 0:i==="record"?e.record:void 0,k=i==="kind"&&s?`${s}: ${e.said}`:i==="record"&&s?`${s} \u2014 ${e.said}`:e.said;return(0,r.jsxs)("span",{"data-graview-rule-line":"",style:{overflowWrap:"anywhere",...l},children:[(0,r.jsx)("span",{style:g,children:k}),(0,r.jsxs)("span",{"aria-hidden":"true",children:[i!=="none"&&d?(0,r.jsx)("span",{style:{display:"inline-flex",verticalAlign:"-0.1em",marginRight:"0.4em"},children:(0,r.jsx)(y,{kind:d,...n?{schema:n}:{},...t?{brand:t}:{},size:13})}):null,s?(0,r.jsxs)("span",{"data-graview-rule-head":"",style:{fontWeight:600,marginRight:i==="record"||a?0:"0.6em"},children:[s,i==="record"&&!a?(0,r.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontWeight:400},children:" \u2014 "}):null]}):null,a&&s?(0,r.jsx)("br",{}):null,(0,r.jsx)(w,{parts:e.parts}),e.when&&e.when.length>0?(0,r.jsxs)("span",{"data-graview-rule-when":"",style:{color:"var(--graview-ink-faint)"},children:[", when ",(0,r.jsx)(w,{parts:e.when})]}):null]})]})}function z(e){return e.line?e.label&&e.label.trim().length>0?e.label:void 0:e.label&&e.label!==e.message&&!e.message.startsWith(e.label)?e.label:void 0}export{D as a,I as b,M as c,C as d,z as e};
@@ -1,2 +1,2 @@
1
- import{Aa as Q,Ab as I,E as F,F as Y,H as L,Hb as en,Ia as X,N as O,Q as j,R as B,S as U,T as K,Ta as v,Va as nn,Z as J,_ as Z,ja as P}from"./chunk.WLPTY4BF.js";var un=1e4,p=class{constructor(a){this.nodes=a}},rn=Symbol.for("@graview/core:far-record"),fn=e=>typeof e=="object"&&e!==null&&e[rn]===!0;function cn(e){let a={...e.fields,id:`@${e.address}/${e.kind}:${e.id}`,kind:`@${e.address}/${e.kind}`,label:e.label};return Object.defineProperty(a,rn,{value:!0}),a}function Nn(e){let a=`the linked record in ${e.ref.address}`;return e.reason==="denied"?`${a} is not one this viewer may open`:`${a} has not been read`}var pn="",f=class extends Error{constructor(g,l){super(g);this.sentence=g;this.at=l}},z=class extends f{},V=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof p)&&typeof e.id=="string",tn=e=>{let a=new Set;return new p(e.filter(g=>!a.has(g.id)&&a.add(g.id)))},w=e=>e===null?"nothing":e instanceof p?"a set of records":Array.isArray(e)?"a list":V(e)?"a record":typeof e=="string"?"a word":typeof e;function on(e,a){let g=a.budget??un,l=(n,s)=>{if(g-=n,g<0)throw new z("this rule looks at too much of the graph to judge in one go",s)},u=a.today??L(),b=a.now??new Date().toISOString(),k=new Map,S=new Set,A=a.bindings,q=(n,s,t,o)=>{let d=`${n?.id}\0${s}`;if(k.has(d))return k.get(d);if(S.has(d))throw new f(`"${s}"${n?` of ${P(n.kind)}`:""} depends on itself`,o);S.add(d);let r=A;A=void 0;try{let i=$(t,n);return k.set(d,i),i}finally{A=r,S.delete(d)}},E=(n,s,t)=>{l(1,t);let o=a.kinds.get(n.kind),d=o?.computed?.get(s);if(d)return q(n,s,d,t);let r=o?.linked?.get(s);if(r){let y=Q(Object.hasOwn(n,s)?n[s]:void 0,r);l(y.length,t);let m=a.linked??X(a.graph),h=y.flatMap(x=>{let C=m?m(x):{unread:!0};return"record"in C?[cn(C.record)]:(a.onUnread?.({relation:s,ref:x,reason:"denied"in C?"denied":"unread"}),[])});return r.cardinality==="one"?h[0]??null:new p(h)}let i=Object.hasOwn(n,s);if(o?.fields.has(s)||i){let y=i?v(n,s,u):void 0;return y===void 0?null:y}let c=o?.edges.get(s);if(c){let y=a.graph.out(n.id,s);return l(y.length,t),c==="one"?y[0]??null:new p(y)}if(s==="id")return n.id;if(fn(n))return null;throw new f(`${P(n.kind)} has no field or relation called "${s}"`,t)},N=(n,s,t)=>{if(n instanceof p)return n;if(n===null)return new p([]);if(V(n))return new p([n]);throw new f(`${t}(\u2026) needs a set of records, and was given ${w(n)}`,s)},G=(n,s,t)=>{if(n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean")return String(n);throw new f(`${t}(\u2026) needs a word, and was given ${w(n)}`,s)},_=(n,s,t)=>{let o=G(n,s,t);if(o===null)return null;let d=Date.parse(o.length===10?`${o}T00:00:00Z`:o);if(Number.isNaN(d))throw new f(`${t}(\u2026) needs a date, and "${o}" is not one`,s);return d},M=(n,s)=>V(n)&&V(s)?n.id===s.id:V(n)&&typeof s=="string"?n.id===s:typeof n=="string"&&V(s)?n===s.id:Array.isArray(n)&&Array.isArray(s)?n.length===s.length&&n.every((t,o)=>M(t,s[o])):n===s,R=(n,s,t)=>{if(n===null)return!1;if(typeof n=="boolean")return n;throw new f(`${t} must be true or false, and was ${w(n)}`,s)},T=(n,s)=>$(s,n);function $(n,s){switch(l(1,n.at),n.t){case"lit":return n.value;case"list":return n.items.map(t=>$(t,s));case"ident":{let t=A&&Object.hasOwn(A,n.name)?A[n.name]:void 0;if(t!==void 0)return t;if(s)return E(s,n.name,n.at);throw new f(`"${n.name}" means nothing in a rule over the whole graph`,n.at)}case"member":{let t=$(n.object,s);if(t===null)return null;if(V(t))return E(t,n.name,n.at);throw new f(`".${n.name}" needs a record before it, and was given ${w(t)}`,n.at)}case"unary":{let t=$(n.operand,s);if(n.op==="!")return!R(t,n.at,"what follows not");if(t===null)return null;if(typeof t!="number")throw new f(`"-" needs a number, and was given ${w(t)}`,n.at);return-t}case"where":{let t=N($(n.set,s),n.at,"where");return l(t.nodes.length,n.at),new p(t.nodes.filter(o=>R(T(o,n.filter),n.at,"a where condition")))}case"binary":return dn(n,s);case"call":return ln(n,s)}}function dn(n,s){if(n.op==="&&")return R($(n.left,s),n.at,"each side of and")&&R($(n.right,s),n.at,"each side of and");if(n.op==="||")return R($(n.left,s),n.at,"each side of or")||R($(n.right,s),n.at,"each side of or");let t=$(n.left,s),o=$(n.right,s);if(n.op==="&"||n.op==="|"||n.op==="-"&&(t instanceof p||o instanceof p)){let d=N(t,n.at,n.op).nodes,r=N(o,n.at,n.op).nodes;l(d.length+r.length,n.at);let i=new Set(r.map(c=>c.id));return tn(n.op==="|"?[...d,...r]:d.filter(c=>i.has(c.id)===(n.op==="&")))}switch(n.op){case"==":return M(t,o);case"!=":return!M(t,o);case"in":{if(o===null)return!1;if(o instanceof p)return o.nodes.some(d=>M(t,d));if(Array.isArray(o))return o.some(d=>M(t,d));if(typeof o=="string"&&typeof t=="string")return o.includes(t);throw new f(`"in" needs a list or a set on its right, and was given ${w(o)}`,n.at)}case"<":case"<=":case">":case">=":{if(t===null||o===null)return!1;if(!(typeof t=="number"&&typeof o=="number"||typeof t=="string"&&typeof o=="string"))throw new f(`cannot compare ${w(t)} with ${w(o)}`,n.at);return n.op==="<"?t<o:n.op==="<="?t<=o:n.op===">"?t>o:t>=o}default:{if(t===null||o===null)return null;if(n.op==="+"&&(typeof t=="string"||typeof o=="string")){let d=`${G(t,n.at,"+")}${G(o,n.at,"+")}`;if(d.length>1e4)throw new f("that makes a word too long",n.at);return d}if(typeof t!="number"||typeof o!="number")throw new f(`"${n.op}" needs numbers, and was given ${w(t)} and ${w(o)}`,n.at);return(n.op==="/"||n.op==="%")&&o===0?null:n.op==="+"?t+o:n.op==="-"?t-o:n.op==="*"?t*o:n.op==="/"?t/o:t%o}}}function ln(n,s){let t=(r,i=r)=>{if(n.args.length<r||n.args.length>i)throw new f(`${n.fn}(\u2026) takes ${r===i?r:`${r} to ${i}`} argument${i===1?"":"s"}`,n.at)},o=r=>$(n.args[r],s),d=r=>{let i=o(r);if(typeof i!="string")throw new f(`${n.fn}(\u2026) needs a quoted name, like ${n.fn}('name')`,n.at);return i};switch(n.fn){case"out":case"in":{t(1,2);let r=(y,m)=>n.fn==="out"?a.graph.out(y,m):a.graph.in(y,m);if(n.args.length===2){let y=N(o(0),n.at,n.fn).nodes,m=d(1);return tn(y.flatMap(h=>{let x=r(h.id,m);return l(x.length+1,n.at),x}))}let i=d(0);if(!s)throw new f(`${n.fn}('${i}') needs a record to start from`,n.at);let c=r(s.id,i);return l(c.length,n.at),new p(c)}case"all":{t(1,2);let r=a.graph.nodesOfKind(d(0),{archived:n.args.length===2?o(1):!1});return l(r.length,n.at),new p(r)}case"archived":return t(0,1),nn(n.args.length===1?o(0):s);case"count":return t(1),N(o(0),n.at,"count").nodes.length;case"exists":return t(1),N(o(0),n.at,"exists").nodes.length>0;case"every":case"some":{t(2);let r=N(o(0),n.at,n.fn);l(r.nodes.length,n.at);let i=c=>R(T(c,n.args[1]),n.at,`the condition in ${n.fn}(\u2026)`);return n.fn==="every"?r.nodes.every(i):r.nodes.some(i)}case"sum":case"min":case"max":{t(2);let r=N(o(0),n.at,n.fn);l(r.nodes.length,n.at);let i=n.args[1],c=i.t==="lit"&&typeof i.value=="string"?i.value:void 0,y=i.t==="ident"?`'${i.name}'`:c!==void 0?`'${c}'`:"\u2026",m=r.nodes.map(h=>i.t==="ident"?E(h,i.name,n.at):c!==void 0?E(h,c,n.at):T(h,i)).filter(h=>{if(h===null)return!1;if(typeof h!="number")throw new f(`${n.fn}(\u2026, ${y}) needs a number for each member, and found ${w(h)}`,n.at);return!0});return n.fn==="sum"?m.reduce((h,x)=>h+x,0):m.length===0?null:n.fn==="min"?Math.min(...m):Math.max(...m)}case"fact":{t(1);let r=d(0),i=a.kinds.get(pn)?.computed?.get(r);if(!i)throw new f(`no fact is called "${r}"`,n.at);return q(null,r,i,n.at)}case"first":return t(1),N(o(0),n.at,"first").nodes[0]??null;case"sort":{t(2,3);let r=N(o(0),n.at,"sort"),i=n.args.length===3?o(2):"asc";if(i!=="asc"&&i!=="desc")throw new f("sort(\u2026) goes 'asc' or 'desc'",n.at);let c=r.nodes.length;l(c+c*Math.ceil(Math.log2(c+1)),n.at);let y=r.nodes.map((h,x)=>({node:h,i:x,key:T(h,n.args[1])})),m=i==="desc"?-1:1;return y.sort((h,x)=>H(h.key,x.key,m,n.at)||h.i-x.i),new p(y.map(h=>h.node))}case"either":{if(n.args.length<1)throw new f("either(\u2026) takes at least one argument",n.at);for(let r=0;r<n.args.length;r++){let i=o(r);if(i!==null&&!(i instanceof p&&i.nodes.length===0))return i}return null}case"present":{t(1);let r=o(0);return r===null||r===""?!1:Array.isArray(r)?r.length>0:r instanceof p?r.nodes.length>0:!0}case"len":{t(1);let r=o(0);if(r===null)return 0;if(typeof r=="string"||Array.isArray(r))return r.length;if(r instanceof p)return r.nodes.length;throw new f(`len(\u2026) needs a word or a list, and was given ${w(r)}`,n.at)}case"contains":case"startsWith":{t(2);let r=o(0),i=o(1);if(r===null||i===null)return!1;if(n.fn==="contains"&&Array.isArray(r))return r.some(m=>M(m,i));let c=G(r,n.at,n.fn),y=G(i,n.at,n.fn);return n.fn==="contains"?c.toLowerCase().includes(y.toLowerCase()):c.startsWith(y)}case"lower":{t(1);let r=G(o(0),n.at,"lower");return r===null?null:r.toLowerCase()}case"today":return t(0),u;case"now":return t(0),b;case"date":{t(1);let r=_(o(0),n.at,"date");return r===null?null:new Date(r).toISOString().slice(0,10)}case"days":case"hours":{t(2);let r=_(o(0),n.at,n.fn),i=_(o(1),n.at,n.fn);if(r===null||i===null)return null;let c=(i-r)/(n.fn==="days"?864e5:36e5);return n.fn==="days"?Math.round(c):c}case"if":return t(3),R(o(0),n.at,"the condition in if(\u2026)")?o(1):o(2);default:throw new f(`"${n.fn}" is not a function the rule language knows`,n.at)}}function H(n,s,t,o){if(n===null||s===null)return n===s?0:n===null?1:-1;if(Array.isArray(n)&&Array.isArray(s)){for(let r=0;r<Math.max(n.length,s.length);r++){let i=H(n[r]??null,s[r]??null,t,o);if(i!==0)return i}return 0}let d=r=>typeof r=="number"||typeof r=="string"||typeof r=="boolean"?typeof r:w(r);if(d(n)!==d(s)||typeof n=="object"||typeof s=="object")throw new f(`sort(\u2026) cannot put ${w(n)} and ${w(s)} in order`,o);return typeof n=="string"?t*(n<s?-1:n>s?1:0):t*(Number(n)-Number(s))}return $(e,a.subject)}var Sn=["out","in","all","count","exists","every","some","sum","min","max","present","len","contains","startsWith","lower","today","now","date","days","hours","if","first","sort","either","fact","archived"];var Vn=(e,a,g,l)=>({severity:"error",code:e,path:a,message:g,...l?{fix:l}:{}}),Gn=(e,a,g,l)=>({severity:"warning",code:e,path:a,message:g,...l?{fix:l}:{}}),Mn=e=>e.some(a=>a.severity==="error");function On(e){return e.map(a=>`${a.severity==="error"?"\u2717":a.severity==="warning"?"!":"\xB7"} ${a.path||"(document)"}: ${a.message}${a.fix?` \u2014 ${a.fix}`:""}`).join(`
1
+ import{Aa as Q,Bb as I,E as F,F as Y,H as L,Ia as X,Ib as en,N as O,Q as j,R as B,S as U,T as K,Ta as v,Va as nn,Z as J,_ as Z,ja as P}from"./chunk.5ZMENPY4.js";var un=1e4,p=class{constructor(a){this.nodes=a}},rn=Symbol.for("@graview/core:far-record"),fn=e=>typeof e=="object"&&e!==null&&e[rn]===!0;function cn(e){let a={...e.fields,id:`@${e.address}/${e.kind}:${e.id}`,kind:`@${e.address}/${e.kind}`,label:e.label};return Object.defineProperty(a,rn,{value:!0}),a}function Nn(e){let a=`the linked record in ${e.ref.address}`;return e.reason==="denied"?`${a} is not one this viewer may open`:`${a} has not been read`}var pn="",f=class extends Error{constructor(g,l){super(g);this.sentence=g;this.at=l}},z=class extends f{},V=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof p)&&typeof e.id=="string",tn=e=>{let a=new Set;return new p(e.filter(g=>!a.has(g.id)&&a.add(g.id)))},w=e=>e===null?"nothing":e instanceof p?"a set of records":Array.isArray(e)?"a list":V(e)?"a record":typeof e=="string"?"a word":typeof e;function on(e,a){let g=a.budget??un,l=(n,s)=>{if(g-=n,g<0)throw new z("this rule looks at too much of the graph to judge in one go",s)},u=a.today??L(),b=a.now??new Date().toISOString(),k=new Map,S=new Set,A=a.bindings,q=(n,s,t,o)=>{let d=`${n?.id}\0${s}`;if(k.has(d))return k.get(d);if(S.has(d))throw new f(`"${s}"${n?` of ${P(n.kind)}`:""} depends on itself`,o);S.add(d);let r=A;A=void 0;try{let i=$(t,n);return k.set(d,i),i}finally{A=r,S.delete(d)}},E=(n,s,t)=>{l(1,t);let o=a.kinds.get(n.kind),d=o?.computed?.get(s);if(d)return q(n,s,d,t);let r=o?.linked?.get(s);if(r){let y=Q(Object.hasOwn(n,s)?n[s]:void 0,r);l(y.length,t);let m=a.linked??X(a.graph),h=y.flatMap(x=>{let C=m?m(x):{unread:!0};return"record"in C?[cn(C.record)]:(a.onUnread?.({relation:s,ref:x,reason:"denied"in C?"denied":"unread"}),[])});return r.cardinality==="one"?h[0]??null:new p(h)}let i=Object.hasOwn(n,s);if(o?.fields.has(s)||i){let y=i?v(n,s,u):void 0;return y===void 0?null:y}let c=o?.edges.get(s);if(c){let y=a.graph.out(n.id,s);return l(y.length,t),c==="one"?y[0]??null:new p(y)}if(s==="id")return n.id;if(fn(n))return null;throw new f(`${P(n.kind)} has no field or relation called "${s}"`,t)},N=(n,s,t)=>{if(n instanceof p)return n;if(n===null)return new p([]);if(V(n))return new p([n]);throw new f(`${t}(\u2026) needs a set of records, and was given ${w(n)}`,s)},G=(n,s,t)=>{if(n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean")return String(n);throw new f(`${t}(\u2026) needs a word, and was given ${w(n)}`,s)},_=(n,s,t)=>{let o=G(n,s,t);if(o===null)return null;let d=Date.parse(o.length===10?`${o}T00:00:00Z`:o);if(Number.isNaN(d))throw new f(`${t}(\u2026) needs a date, and "${o}" is not one`,s);return d},M=(n,s)=>V(n)&&V(s)?n.id===s.id:V(n)&&typeof s=="string"?n.id===s:typeof n=="string"&&V(s)?n===s.id:Array.isArray(n)&&Array.isArray(s)?n.length===s.length&&n.every((t,o)=>M(t,s[o])):n===s,R=(n,s,t)=>{if(n===null)return!1;if(typeof n=="boolean")return n;throw new f(`${t} must be true or false, and was ${w(n)}`,s)},T=(n,s)=>$(s,n);function $(n,s){switch(l(1,n.at),n.t){case"lit":return n.value;case"list":return n.items.map(t=>$(t,s));case"ident":{let t=A&&Object.hasOwn(A,n.name)?A[n.name]:void 0;if(t!==void 0)return t;if(s)return E(s,n.name,n.at);throw new f(`"${n.name}" means nothing in a rule over the whole graph`,n.at)}case"member":{let t=$(n.object,s);if(t===null)return null;if(V(t))return E(t,n.name,n.at);throw new f(`".${n.name}" needs a record before it, and was given ${w(t)}`,n.at)}case"unary":{let t=$(n.operand,s);if(n.op==="!")return!R(t,n.at,"what follows not");if(t===null)return null;if(typeof t!="number")throw new f(`"-" needs a number, and was given ${w(t)}`,n.at);return-t}case"where":{let t=N($(n.set,s),n.at,"where");return l(t.nodes.length,n.at),new p(t.nodes.filter(o=>R(T(o,n.filter),n.at,"a where condition")))}case"binary":return dn(n,s);case"call":return ln(n,s)}}function dn(n,s){if(n.op==="&&")return R($(n.left,s),n.at,"each side of and")&&R($(n.right,s),n.at,"each side of and");if(n.op==="||")return R($(n.left,s),n.at,"each side of or")||R($(n.right,s),n.at,"each side of or");let t=$(n.left,s),o=$(n.right,s);if(n.op==="&"||n.op==="|"||n.op==="-"&&(t instanceof p||o instanceof p)){let d=N(t,n.at,n.op).nodes,r=N(o,n.at,n.op).nodes;l(d.length+r.length,n.at);let i=new Set(r.map(c=>c.id));return tn(n.op==="|"?[...d,...r]:d.filter(c=>i.has(c.id)===(n.op==="&")))}switch(n.op){case"==":return M(t,o);case"!=":return!M(t,o);case"in":{if(o===null)return!1;if(o instanceof p)return o.nodes.some(d=>M(t,d));if(Array.isArray(o))return o.some(d=>M(t,d));if(typeof o=="string"&&typeof t=="string")return o.includes(t);throw new f(`"in" needs a list or a set on its right, and was given ${w(o)}`,n.at)}case"<":case"<=":case">":case">=":{if(t===null||o===null)return!1;if(!(typeof t=="number"&&typeof o=="number"||typeof t=="string"&&typeof o=="string"))throw new f(`cannot compare ${w(t)} with ${w(o)}`,n.at);return n.op==="<"?t<o:n.op==="<="?t<=o:n.op===">"?t>o:t>=o}default:{if(t===null||o===null)return null;if(n.op==="+"&&(typeof t=="string"||typeof o=="string")){let d=`${G(t,n.at,"+")}${G(o,n.at,"+")}`;if(d.length>1e4)throw new f("that makes a word too long",n.at);return d}if(typeof t!="number"||typeof o!="number")throw new f(`"${n.op}" needs numbers, and was given ${w(t)} and ${w(o)}`,n.at);return(n.op==="/"||n.op==="%")&&o===0?null:n.op==="+"?t+o:n.op==="-"?t-o:n.op==="*"?t*o:n.op==="/"?t/o:t%o}}}function ln(n,s){let t=(r,i=r)=>{if(n.args.length<r||n.args.length>i)throw new f(`${n.fn}(\u2026) takes ${r===i?r:`${r} to ${i}`} argument${i===1?"":"s"}`,n.at)},o=r=>$(n.args[r],s),d=r=>{let i=o(r);if(typeof i!="string")throw new f(`${n.fn}(\u2026) needs a quoted name, like ${n.fn}('name')`,n.at);return i};switch(n.fn){case"out":case"in":{t(1,2);let r=(y,m)=>n.fn==="out"?a.graph.out(y,m):a.graph.in(y,m);if(n.args.length===2){let y=N(o(0),n.at,n.fn).nodes,m=d(1);return tn(y.flatMap(h=>{let x=r(h.id,m);return l(x.length+1,n.at),x}))}let i=d(0);if(!s)throw new f(`${n.fn}('${i}') needs a record to start from`,n.at);let c=r(s.id,i);return l(c.length,n.at),new p(c)}case"all":{t(1,2);let r=a.graph.nodesOfKind(d(0),{archived:n.args.length===2?o(1):!1});return l(r.length,n.at),new p(r)}case"archived":return t(0,1),nn(n.args.length===1?o(0):s);case"count":return t(1),N(o(0),n.at,"count").nodes.length;case"exists":return t(1),N(o(0),n.at,"exists").nodes.length>0;case"every":case"some":{t(2);let r=N(o(0),n.at,n.fn);l(r.nodes.length,n.at);let i=c=>R(T(c,n.args[1]),n.at,`the condition in ${n.fn}(\u2026)`);return n.fn==="every"?r.nodes.every(i):r.nodes.some(i)}case"sum":case"min":case"max":{t(2);let r=N(o(0),n.at,n.fn);l(r.nodes.length,n.at);let i=n.args[1],c=i.t==="lit"&&typeof i.value=="string"?i.value:void 0,y=i.t==="ident"?`'${i.name}'`:c!==void 0?`'${c}'`:"\u2026",m=r.nodes.map(h=>i.t==="ident"?E(h,i.name,n.at):c!==void 0?E(h,c,n.at):T(h,i)).filter(h=>{if(h===null)return!1;if(typeof h!="number")throw new f(`${n.fn}(\u2026, ${y}) needs a number for each member, and found ${w(h)}`,n.at);return!0});return n.fn==="sum"?m.reduce((h,x)=>h+x,0):m.length===0?null:n.fn==="min"?Math.min(...m):Math.max(...m)}case"fact":{t(1);let r=d(0),i=a.kinds.get(pn)?.computed?.get(r);if(!i)throw new f(`no fact is called "${r}"`,n.at);return q(null,r,i,n.at)}case"first":return t(1),N(o(0),n.at,"first").nodes[0]??null;case"sort":{t(2,3);let r=N(o(0),n.at,"sort"),i=n.args.length===3?o(2):"asc";if(i!=="asc"&&i!=="desc")throw new f("sort(\u2026) goes 'asc' or 'desc'",n.at);let c=r.nodes.length;l(c+c*Math.ceil(Math.log2(c+1)),n.at);let y=r.nodes.map((h,x)=>({node:h,i:x,key:T(h,n.args[1])})),m=i==="desc"?-1:1;return y.sort((h,x)=>H(h.key,x.key,m,n.at)||h.i-x.i),new p(y.map(h=>h.node))}case"either":{if(n.args.length<1)throw new f("either(\u2026) takes at least one argument",n.at);for(let r=0;r<n.args.length;r++){let i=o(r);if(i!==null&&!(i instanceof p&&i.nodes.length===0))return i}return null}case"present":{t(1);let r=o(0);return r===null||r===""?!1:Array.isArray(r)?r.length>0:r instanceof p?r.nodes.length>0:!0}case"len":{t(1);let r=o(0);if(r===null)return 0;if(typeof r=="string"||Array.isArray(r))return r.length;if(r instanceof p)return r.nodes.length;throw new f(`len(\u2026) needs a word or a list, and was given ${w(r)}`,n.at)}case"contains":case"startsWith":{t(2);let r=o(0),i=o(1);if(r===null||i===null)return!1;if(n.fn==="contains"&&Array.isArray(r))return r.some(m=>M(m,i));let c=G(r,n.at,n.fn),y=G(i,n.at,n.fn);return n.fn==="contains"?c.toLowerCase().includes(y.toLowerCase()):c.startsWith(y)}case"lower":{t(1);let r=G(o(0),n.at,"lower");return r===null?null:r.toLowerCase()}case"today":return t(0),u;case"now":return t(0),b;case"date":{t(1);let r=_(o(0),n.at,"date");return r===null?null:new Date(r).toISOString().slice(0,10)}case"days":case"hours":{t(2);let r=_(o(0),n.at,n.fn),i=_(o(1),n.at,n.fn);if(r===null||i===null)return null;let c=(i-r)/(n.fn==="days"?864e5:36e5);return n.fn==="days"?Math.round(c):c}case"if":return t(3),R(o(0),n.at,"the condition in if(\u2026)")?o(1):o(2);default:throw new f(`"${n.fn}" is not a function the rule language knows`,n.at)}}function H(n,s,t,o){if(n===null||s===null)return n===s?0:n===null?1:-1;if(Array.isArray(n)&&Array.isArray(s)){for(let r=0;r<Math.max(n.length,s.length);r++){let i=H(n[r]??null,s[r]??null,t,o);if(i!==0)return i}return 0}let d=r=>typeof r=="number"||typeof r=="string"||typeof r=="boolean"?typeof r:w(r);if(d(n)!==d(s)||typeof n=="object"||typeof s=="object")throw new f(`sort(\u2026) cannot put ${w(n)} and ${w(s)} in order`,o);return typeof n=="string"?t*(n<s?-1:n>s?1:0):t*(Number(n)-Number(s))}return $(e,a.subject)}var Sn=["out","in","all","count","exists","every","some","sum","min","max","present","len","contains","startsWith","lower","today","now","date","days","hours","if","first","sort","either","fact","archived"];var Vn=(e,a,g,l)=>({severity:"error",code:e,path:a,message:g,...l?{fix:l}:{}}),Gn=(e,a,g,l)=>({severity:"warning",code:e,path:a,message:g,...l?{fix:l}:{}}),Mn=e=>e.some(a=>a.severity==="error");function On(e){return e.map(a=>`${a.severity==="error"?"\u2717":a.severity==="warning"?"!":"\xB7"} ${a.path||"(document)"}: ${a.message}${a.fix?` \u2014 ${a.fix}`:""}`).join(`
2
2
  `)}var Cn=["money","percent","date","time","datetime","relative","upper","lower","count","words","and","plural","excerpt"],gn={getNode:()=>{},allNodes:()=>[],allEdges:()=>[],nodesOfKind:()=>[],edgesOfKind:()=>[],out:()=>[],in:()=>[],neighbors:()=>[],has:()=>!1};function jn(e,a,g,l=[],u,b=D){return W(e,a,g,l,u,b)}var yn=(e,a)=>e.capital?J(a):a;function hn(e){return e?a=>{let g=e.tryDefinition(a.kind)?.label;return g?g(a):D(a)}:D}var sn=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],an=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];function mn(e,a){return!Number.isInteger(e)||e<0||e>99?K(e,a):e<20?sn[e]:e%10===0?an[e/10]:`${an[Math.floor(e/10)]}-${sn[e%10]}`}function wn(e){return/[^aeiou]y$/i.test(e)?`${e.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/i.test(e)?`${e}es`:`${e}s`}var D=e=>String(e.name??e.title??e.label??e.id);function W(e,a,g,l=[],u,b=D){if(a==="plural"){let k=e instanceof p?e.nodes.length:Array.isArray(e)?e.length:typeof e=="number"?e:null;return k===null||l[0]===void 0?"\u2014":k===1?l[0]:l[1]??wn(l[0])}if(e===null)return"\u2014";if(e instanceof p)return a==="count"?String(e.nodes.length):a==="and"?Z(e.nodes.map(b)):e.nodes.map(b).join(", ");if(Array.isArray(e)){if(a==="count")return String(e.length);let k=e.map(S=>W(S,void 0,g,[],u,b));return a==="and"?Z(k):k.join(", ")}if(typeof e=="object")return b(e);switch(a){case"words":return typeof e=="number"?mn(e,u?.locale):String(e);case"money":return typeof e=="number"?I(e,u):String(e);case"percent":return typeof e=="number"?K(e,u?.locale,{style:"percent",maximumFractionDigits:0}):String(e);case"upper":return String(e).toUpperCase();case"lower":return String(e).toLowerCase();case"excerpt":return en(String(e),Number(l[0])||void 0);case"date":return O(U(String(e),u?.timeZone)??String(e).slice(0,10),u?.locale);case"time":return typeof e=="string"&&F.test(e)?O(e,u?.locale):B(String(e),u?.locale,u?.timeZone);case"datetime":return typeof e=="string"&&F.test(e)?O(e,u?.locale):j(String(e),u?.locale,u?.timeZone);case"relative":{let k=U(String(e),u?.timeZone),S=k===void 0?Date.parse(String(e)):Date.parse(`${k}T00:00:00Z`);if(Number.isNaN(S))return String(e);let A=Math.round((S-Date.parse(`${g}T00:00:00Z`))/864e5);return A===0?"today":A===1?"tomorrow":A===-1?"yesterday":A>0?`in ${A} days`:`${-A} days ago`}default:return typeof e=="string"&&F.test(e)?O(e,u?.locale):typeof e=="string"&&Y.test(e)?j(e,u?.locale,u?.timeZone):String(e)}}function Un(e,a){let g=a.today??L(),l=a.name??hn(a.graph?.schema);return e.map(u=>{if(u.text!==void 0)return u.text;try{let b=on(u.expr,{graph:a.graph??gn,subject:a.node,kinds:a.kinds,today:g,budget:a.budget??500,...a.bindings?{bindings:a.bindings}:{}});return yn(u,W(b,u.format,g,u.formatArgs,a.money,l))}catch(b){if(b instanceof f)return"\u2014";throw b}}).join("")}export{p as a,Nn as b,pn as c,f as d,z as e,on as f,Sn as g,Vn as h,Gn as i,Mn as j,On as k,Cn as l,gn as m,jn as n,yn as o,hn as p,Un as q};
@@ -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{d as Se,f as be}from"./chunk.U7QMA4H7.js";import{e as pt}from"./chunk.C6X7CKU6.js";import{a as ae,b as tt}from"./chunk.2GGDOFTF.js";import{b as Pe,c as U,d as X,e as it,f as rt}from"./chunk.ZTMDU3OH.js";import{a as yt,d as wt,f as vt}from"./chunk.HFDYFPMJ.js";import{a as ve,b as gt}from"./chunk.RWB4235L.js";import{a as Ce,b as ft}from"./chunk.CTK2P4JV.js";import{a as mt,b as ht}from"./chunk.6XU2CXRZ.js";import{h as ut}from"./chunk.3ZNQ5YKX.js";import{d as ot,e as ie,f as J,g as ye,h as st,j as lt,k as re}from"./chunk.KJNUZYXS.js";import{j as dt,o as we}from"./chunk.HHUCPVG5.js";import{c as ct}from"./chunk.WXYUWBKX.js";import{c as at,d as Re}from"./chunk.H5CZZZLX.js";import{c as nt}from"./chunk.Z7JRBKA7.js";import{G as q,R as I,T as Ye,Z as Ze,_ as V,aa as ue,ha as Qe,ia as j,j as je,ja as pe,l as _e,m as qe,ma as me,qa as he,r as ne,sa as et,ua as xe,v as Ue,va as fe,wa as Ne,y as Xe,z as Je}from"./chunk.BTSXYZ6Z.js";import{a as ge}from"./chunk.SDO3U72B.js";import{T as Q,Zb as te,ba as $,da as ee,fb as Ke,ka as H}from"./chunk.5ZMENPY4.js";import{b as E}from"./chunk.AJZBJBMO.js";var v=E(q(),1);var St=E(q(),1);function bt(e){(0,St.useLayoutEffect)(()=>{let n=e.current,t=n?.parentElement;if(!n||!t)return;let a=n.style.bottom,o=()=>{let g=t.querySelector(zt);if(!g){n.style.bottom=a;return}let u=t.getBoundingClientRect(),m=g.getBoundingClientRect(),c=u.height>0?t.offsetHeight/u.height:1;n.style.bottom=`${Math.max(0,Math.round((u.bottom-m.top)*c))}px`};if(o(),typeof ResizeObserver>"u")return;let l=new ResizeObserver(o);return l.observe(t),()=>l.disconnect()},[e])}var zt=".graview-spec-listing";var $e=E(q(),1);var P=E(q(),1);var kt=E(q(),1);var B=E(I(),1);function xt({id:e,max:n=8,empty:t,hide:a}){let{store:o}=V();ue();let l=Kt(o,e,o.violations()),[g,u]=(0,kt.useState)(()=>new Set),m=a?l.flatMap(c=>{let f=c.ids.filter(r=>!a.has(r));return f.length>0?[{...c,ids:f}]:[]}):l;return m.length===0?t&&l.length===0?(0,B.jsx)("p",{style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-faint)"},children:t}):null:(0,B.jsx)("div",{"data-graview-primitive":"connections",style:{display:"flex",flexDirection:"column",gap:12},children:m.map(c=>{let f=g.has(c.key),r=c.ids.length>n,d=f?c.ids:c.ids.slice(0,n),y=c.ids.length-Math.min(n,c.ids.length),k=`graview-more-${e}-${c.key}`.replace(/[^A-Za-z0-9_-]/g,"-");return(0,B.jsxs)("section",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,B.jsx)("h2",{...c.said?{"aria-label":c.said}:{},style:{margin:0,fontSize:"0.75rem",fontWeight:600,letterSpacing:"0.09em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:c.label}),(0,B.jsxs)("div",{id:k,style:{display:"flex",flexWrap:"wrap",gap:6},children:[d.map(h=>{let w=o.graph.getNode(h);return w?(0,B.jsx)(X,{pickId:h,hue:te(w.kind),title:`Go to the ${H(o.schema.tryDefinition(w.kind),w.kind)}`,label:$(o.schema.tryDefinition(w.kind),w)},h):null}),r?(0,B.jsx)("button",{type:"button","data-graview-more":c.key,"aria-expanded":f,"aria-controls":k,...f?{}:{"aria-label":`${y} more: ${c.said??c.label}`},onClick:h=>{h.stopPropagation(),u(w=>{let S=new Set(w);return S.has(c.key)?S.delete(c.key):S.add(c.key),S})},style:Ft,children:f?"Show fewer":`+${y} more`}):null]})]},c.key)})})}var Ft={display:"inline-flex",alignItems:"center",alignSelf:"flex-start",minHeight:24,boxSizing:"border-box",padding:"3px 9px",borderRadius:6,border:"1px solid var(--graview-edge)",background:"var(--graview-panel-muted)",color:"var(--graview-accent)",font:"inherit",fontSize:"0.8125rem",lineHeight:1.5,whiteSpace:"nowrap",cursor:"pointer"};function Kt(e,n,t=[]){let a=e.graph.getNode(n);if(!a)return[];let o=new Map,l=[];for(let g of t)if(g.subjectId===n)for(let u of g.nodeIds)u!==n&&!l.includes(u)&&e.graph.has(u)&&l.push(u);l.length>0&&o.set("judges",{key:"judges",label:"what it finds wrong",ids:l});for(let g of e.graph.allEdges()){let u=g.from===n?g.to:g.to===n?g.from:null;if(u===null||u===n)continue;let m=e.graph.getNode(u);if(!m)continue;let c=g.from===n?"out":"in",f=c==="out"?a.kind:m.kind,r=jt(e.schema,f,g.kind,c),d=`${g.kind}:${c}:${r.label}`,y=o.get(d)??{key:d,...r,ids:[]};y.ids.includes(u)||y.ids.push(u),o.set(d,y)}for(let g of o.values())g.ids.sort();return[...o.values()].sort((g,u)=>g.key<u.key?-1:g.key>u.key?1:0)}function jt(e,n,t,a){let o=nt(e,n,t,a),l=ee(t).toLowerCase();return o.trim().toLowerCase()!==l?{label:o}:a==="out"?{label:`\u2192 ${l}`,said:l}:{label:`\u2190 ${l}`,said:`${l}, pointing here`}}var Nt=E(q(),1),oe=(0,Nt.createContext)(null);var s=E(I(),1),_t=he(ge(()=>(__graviewPreload(import.meta.url,["./chunk.GXKECZ4S.js","./chunk.6XU2CXRZ.js","./chunk.3ZNQ5YKX.js","./chunk.7EFNLMKU.js","./chunk.NSNGPQGT.js","./chunk.H5CZZZLX.js","./chunk.Z7JRBKA7.js","./chunk.ORXFUK6F.js","./chunk.BTSXYZ6Z.js","./chunk.SDO3U72B.js","./chunk.5ZMENPY4.js","./chunk.AJZBJBMO.js"]),import("./chunk.UGCNMAPC.js")))).part((e,n)=>(0,s.jsx)(e.ArrangeBar,{...n}),{what:"Arranging this list"}),qt=he(ge(()=>(__graviewPreload(import.meta.url,["./chunk.IXYBIDAN.js","./chunk.FJBQ4UP3.js","./chunk.QEXXLWEU.js","./chunk.BEC5ZH2L.js","./chunk.SK33IHL2.js","./chunk.6HBEYRJU.js","./chunk.U7QMA4H7.js","./chunk.GP2F7TIN.js","./chunk.C6X7CKU6.js","./chunk.HJCQ6I3S.js","./chunk.EBHKKOPO.js","./chunk.P4WYBSYA.js","./chunk.FILCNVGH.js","./chunk.2RCNSHXK.js","./chunk.2GGDOFTF.js","./chunk.ZTMDU3OH.js","./chunk.HFDYFPMJ.js","./chunk.RWB4235L.js","./chunk.CTK2P4JV.js","./chunk.GXKECZ4S.js","./chunk.6XU2CXRZ.js","./chunk.3ZNQ5YKX.js","./chunk.7EFNLMKU.js","./chunk.YXGI7H4Y.js","./chunk.G4JJXA63.js","./chunk.ITEF3U2E.js","./chunk.B2IRADR2.js","./chunk.J3M2MZHG.js","./chunk.UT6642FC.js","./chunk.IAZRY42B.js","./chunk.FMN5XDLE.js","./chunk.Q5WEOX3Q.js","./chunk.WQPNGBR7.js","./chunk.DYNBWIPF.js","./chunk.B7TB6YRZ.js","./chunk.WVUJXDXZ.js","./chunk.KJNUZYXS.js","./chunk.4BBJ62ZO.js","./chunk.UCZR33MK.js","./chunk.CC47O2DW.js","./chunk.2IX3CZNP.js","./chunk.6DHHUBSC.js","./chunk.GZHZLJBF.js","./chunk.HHUCPVG5.js","./chunk.OJGHDWI6.js","./chunk.WXYUWBKX.js","./chunk.NSNGPQGT.js","./chunk.H5CZZZLX.js","./chunk.Z7JRBKA7.js","./chunk.ORXFUK6F.js","./chunk.BTSXYZ6Z.js","./chunk.SDO3U72B.js","./chunk.5ZMENPY4.js","./chunk.AJZBJBMO.js"]),import("./chunk.G23VFYGF.js")))).part((e,n)=>(0,s.jsx)(e.KindStop,{...n}),{what:"This list"});function Ae(e){let{brand:n}=V();return te(e,n?.accents)}function Ut(e,n){if(!n.endsWith("\u2026")&&!n.endsWith("..."))return;let t=n.replace(/[…]|\.\.\.$/g,"").trim();if(!(t.length<12)){for(let a of Object.values(e))if(typeof a=="string"&&a.length>t.length&&a.startsWith(t))return a}}function Xt(e,n){let a=Math.max(0,...e.slice(0,n*2).map(l=>l.length))*7.5+28<=212/2?2:1,o=n*a;return{columns:a,shown:Math.min(e.length,o)}}var Jt=8,Rt=500,Yt=12;function Ct(e){return{x:e.clientX,y:e.clientY,pointerType:e.pointerType??""}}function Zt(e,n,t){let a=performance.now()+Rt,o=["pointerdown","pointerup","mousedown","mouseup","dblclick"],l=r=>{if(performance.now()>a||!(r instanceof MouseEvent))return!1;let d=Ct(r);return n.pointerType&&d.pointerType&&n.pointerType!==d.pointerType?!1:Math.hypot(d.x-n.x,d.y-n.y)<=Yt},g=r=>{if(!l(r))return c();r.stopPropagation()},u=r=>{if(!l(r))return c();r.stopPropagation(),r.preventDefault(),e.removeEventListener("click",u,!0),setTimeout(c,50),t()},m=!1,c=()=>{if(!m){m=!0,clearTimeout(f),e.removeEventListener("click",u,!0);for(let r of o)e.removeEventListener(r,g,!0)}};for(let r of o)e.addEventListener(r,g,!0);e.addEventListener("click",u,!0);let f=setTimeout(c,Rt)}function Qt({View:e,members:n,mode:t,flagged:a}){let{isSelected:o}=xe(),l=n.slice(0,Jt);return(0,s.jsxs)("div",{"data-graview-rows":"",style:{display:"grid",gap:4,minWidth:0},children:[l.map(g=>(0,s.jsx)("div",{"data-graview-pick":g.id,style:{minWidth:0,cursor:"pointer"},children:(0,s.jsx)(e,{node:g,cardinality:"one",fidelity:"glyph",mode:t,selected:o(g.id),...a?.includes(g.id)?{flagged:[g.id]}:{}})},g.id)),n.length>l.length?(0,s.jsx)(X,{label:`+${n.length-l.length} more`}):null]})}var en=11/15,tn=he(ge(()=>(__graviewPreload(import.meta.url,["./chunk.NSNGPQGT.js","./chunk.H5CZZZLX.js","./chunk.Z7JRBKA7.js","./chunk.ORXFUK6F.js","./chunk.BTSXYZ6Z.js","./chunk.SDO3U72B.js","./chunk.5ZMENPY4.js","./chunk.AJZBJBMO.js"]),import("./chunk.C4CFYTCW.js")))).part((e,n)=>(0,s.jsx)(e.StatesBar,{...n}),{quiet:!0});function nn({text:e,accent:n}){let t=(0,P.useRef)(null),a=(0,P.useRef)(null),[o,l]=(0,P.useState)(1),[g,u]=(0,P.useState)(!1),m=o<1?`${o}em`:void 0;return(0,P.useLayoutEffect)(()=>{let c=t.current,f=a.current;if(!c||!f)return;let r=()=>{let y=c.clientWidth,k=f.offsetWidth;if(y<=0||k<=0)return;let h=parseFloat(getComputedStyle(f).fontSize)/parseFloat(getComputedStyle(c).fontSize)||1,w=k/h,S=Math.max(en,Math.min(1,Math.floor(y/w*100)/100));l(x=>Math.abs(x-S)<.01?x:S),u(w*S>y+.5)};if(r(),typeof ResizeObserver>"u")return;let d=new ResizeObserver(r);return d.observe(c),()=>d.disconnect()},[e]),(0,s.jsx)("span",{ref:t,"data-graview-district-name":"",...o<1?{"data-graview-fitted":""}:{},...g?{title:e}:{},style:{display:"block",minWidth:0,fontSize:"0.9375rem",lineHeight:1.25,letterSpacing:"0.05em",textTransform:"uppercase",color:n?"var(--graview-accent)":"var(--graview-ink-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:(0,s.jsx)("span",{ref:a,style:{fontSize:m},children:e})})}function Pt(e,n){return!!e?.display?.page?.groups?.length||Re(n,e).some(t=>t.long)}function At(e,n=me(e)){for(let t of e.kinds){let a=e.tryDefinition(t),o=a?.plural??`${String(t)}s`,l=r=>{let d=r.node,y=fe(),k=(0,P.useContext)(oe);if(!d)return null;let h=k?.nodeId===d.id?k:null,w=$(a,d),S=r.mode==="fullscreen"?Ut(d,w)??w:w,x=Ke(y,[d.id]);return(0,s.jsxs)(U,{title:(0,s.jsx)(vt,{nodeId:d.id,children:h?.title??S}),...h?{}:{subtitle:a?.describe?at(a,d):a?.description??String(t)},selected:r.selected,...r.flagged?.includes(d.id)?{tone:"warning"}:{},fit:!0,children:[h?(0,s.jsx)(oe.Provider,{value:null,children:h.body}):null,(0,s.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"22px 34px",alignItems:"flex-start"},children:[(0,s.jsx)("div",{style:{flex:Pt(a,d)?"1 1 100%":"1 1 0",minWidth:"min(200px, 100%)"},children:(0,s.jsx)(wt,{id:d.id,shown:[S,w,a?.description,h?.title],...h?{hide:[...h.fields]}:{}})}),(0,s.jsx)("div",{style:{flex:Pt(a,d)?"1 1 100%":"1.4 1 0",minWidth:"min(220px, 100%)"},children:(0,s.jsx)(xt,{id:d.id,empty:`Nothing is connected to this ${H(a,String(t))} yet.`,...h?{hide:h.records}:{}})})]}),x.length>0?(0,s.jsx)("p",{"data-graview-broken":"",style:{margin:"14px 0 0",paddingTop:12,borderTop:"1px solid var(--graview-edge)",fontSize:"0.875rem",color:"var(--graview-warn)"},children:x.map(b=>b.message).join(" \xB7 ")}):null]})},g=r=>{let d=r.node;if(!d)return null;let{store:y}=V(),k=a?.computed?lt(y.schema,y.graph,d):d,h=Re(k,a,{limit:3,said:[$(a,d)],glance:!0}),w=Ae(t),S=h.filter(N=>!N.long&&!N.markdown),x=h.find(N=>N.long||N.markdown),b=ot(d,a);return(0,s.jsxs)(U,{title:$(a,d),selected:r.selected,tone:r.flagged?.includes(d.id)?"warning":"muted",fit:!0,children:[b?(0,s.jsx)(ve,{as:"thumb",file:b,size:64,style:{marginBottom:6}}):null,(0,s.jsx)(it,{items:S.map(N=>({id:N.key,label:N.alone,hue:w})),max:3}),x?(0,s.jsx)("p",{"data-graview-excerpt":x.key,title:x.value,style:{margin:S.length>0?"6px 0 0":0,fontSize:"0.8125rem",lineHeight:1.35,color:"var(--graview-ink-muted)",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:x.value}):null]})},u=r=>{let d=r.node,y=Ae(t),k=we().marks.flag;if(!d)return null;let h=r.flagged?.includes(d.id)??!1;return(0,s.jsx)(X,{label:h?`${$(a,d)} ${k}`:$(a,d),hue:y,selected:r.selected,title:h?`${ee(H(a,String(t)))} \u2014 implicated in a problem`:ee(H(a,String(t)))})},m=r=>r.fidelity==="full"?(0,s.jsx)(P.Suspense,{fallback:(0,s.jsx)(c,{...r}),children:(0,s.jsx)(qt,{kind:String(t),members:r.nodes??[],...r.flagged?{flagged:r.flagged}:{},...r.label?{label:r.label}:{},...r.retired?{retired:r.retired}:{}})}):(0,s.jsx)(c,{...r}),c=r=>{let{brand:d,store:y,views:k}=V(),{view:h,go:w}=Ne(),S=r.nodes??[],x=k.lookup(String(t),{cardinality:"one",fidelity:"glyph"}),b=x!==void 0&&!pe(x)?x:void 0,N=mt(h),C=ut(S,N,{schema:e,graph:y.graph,flagged:new Set(r.flagged??[])}),L=R=>({id:R.id,label:$(e.tryDefinition(R.kind),R),hue:te(R.kind,d?.accents)}),W=r.fidelity==="full"&&S.length>1?(0,s.jsx)(P.Suspense,{fallback:null,children:(0,s.jsx)(_t,{schema:e,graph:y.graph,kind:String(t),arrangement:N,onChange:R=>w(ht(h,R)),kept:{shown:C.nodes.length,of:S.length},style:{marginBottom:8}})}):null,se=R=>R.some(A=>r.flagged?.includes(A.id)),le=fe(),Y=we().marks.flag,z=(R,A,de)=>b?(0,s.jsx)(U,{title:R,meta:(0,s.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[(0,s.jsx)(be,{kind:String(t),plural:o,problems:Se(le,A),flag:Y}),(0,s.jsx)("span",{title:`${Q(A.length)} ${A.length===1?H(a,String(t)):o.toLowerCase()}`,children:Q(A.length)})]}),tone:se(A)?"warning":"muted",children:(0,s.jsx)(Qt,{View:b,members:A,mode:r.mode,...r.flagged?{flagged:r.flagged}:{}})},de):(0,s.jsx)(rt,{label:R,count:A.length,flagged:se(A),items:A.map(L),problems:(0,s.jsx)(be,{kind:String(t),plural:o,problems:Se(le,A),flag:Y})},de);return C.grouped?(0,s.jsxs)("div",{style:{display:"grid",gap:8},"data-graview-grouped":N.group?.by,children:[W,C.groups.map(R=>z(`${r.label??o} \xB7 ${R.label}`,R.nodes,R.key||"-"))]}):(0,s.jsxs)("div",{style:{display:"grid",gap:4},children:[W,z(r.label??o,C.nodes)]})},f=r=>{let d=r.nodes??[],y=Xt(d.map(p=>$(a,p)),r.openedRows??dt(d.length)),k=Ae(t),{brand:h}=V(),w=tt(String(t),e,h),S=we().marks.flag,{selection:x,set:b,clear:N}=xe(),{toggle:C,view:L,go:W}=Ne(),{views:se,hiddenKinds:le}=V(),Y=(0,P.useContext)(Qe),z=L.overview&&!le.has(String(t))?se.places().filter(p=>p.kind===String(t)):[],R=r.focused?L.within?.view??z[0]?.as:void 0,A=d.filter(p=>r.flagged?.includes(p.id)).length,de=A>0,Ot=fe(),Ht=Se(Ot,d),F=(L.overview??!1)&&r.nestedUnder===void 0,G=r.focused||r.raised,He=r.rank==="secondary"&&!G,M=r.nestedUnder!==void 0,Ie=new Set(x),K=Y?x.length===1&&x[0]===ne(String(t)):r.opened??!1,It=ct(),O=G||F?0:d.filter(p=>It.includes(p.id)&&!Ie.has(p.id)).length,ke=O>0&&!de,ce=Ze(),_=ce&&!M?ce.byKind[String(t)]??0:0,We=(0,P.useRef)(null),ze=(0,P.useRef)(null);(0,P.useLayoutEffect)(()=>{let p=ze.current,D=We.current;if(!p||!D||!F)return;let T=()=>D.style.setProperty("--graview-plate-h",`${p.offsetHeight}px`);if(T(),typeof ResizeObserver>"u")return;let Z=new ResizeObserver(T);return Z.observe(p,{box:"border-box"}),()=>Z.disconnect()},[F]);let Wt=M?8:Math.min(46,10+Math.round(Math.sqrt(d.length)*8)),Fe=M?(0,s.jsx)("span",{style:{fontSize:"0.75rem",lineHeight:1.25,letterSpacing:"0.05em",textTransform:"uppercase",color:G?"var(--graview-accent)":"var(--graview-ink-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r.label??o}):(0,s.jsx)(nn,{text:r.label??o,accent:!!G});return(0,s.jsxs)("div",{ref:We,className:"graview-kind-card","data-graview-rank":r.rank,"data-graview-landmark":w||void 0,"data-graview-nested":M||void 0,"data-graview-tied":O||void 0,"data-graview-hits":ce&&!M?_:void 0,"data-graview-emphasis":ce&&!M?_>0?"lit":"dimmed":void 0,...a?.description||M?{title:M?[r.label??o,a?.description].filter(Boolean).join(" \u2014 "):a.description}:{},style:{position:"relative",height:"100%","--graview-hue":Math.round(k)},children:[w?(0,s.jsx)("span",{className:"graview-kind-block graview-kind-landmark","data-graview-opened":r.opened||void 0,"aria-hidden":"true",style:{"--graview-rise":Wt},children:(0,s.jsx)(ae,{kind:String(t),schema:e,...h?{brand:h}:{},size:96})}):null,(0,s.jsxs)("div",{ref:ze,className:"graview-kind-face","data-graview-opened":r.opened||void 0,"data-graview-nameplate":F?r.nameplate??"full":void 0,style:{display:"flex",flexDirection:"column",gap:M?1:3,padding:M?"5px 7px":"7px 10px",borderRadius:"var(--graview-radius-sm, 9px)",justifyContent:"center",position:"relative",height:"100%",overflow:"hidden",boxSizing:"border-box",border:G?"1px solid var(--graview-accent)":O>0?"1px solid var(--graview-accent-dim)":`1px solid hsl(${Math.round(k)} 55% var(--graview-tint-lightness) / 0.34)`,backgroundColor:"var(--graview-panel)",backgroundImage:`linear-gradient(hsl(${Math.round(k)} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * ${G?1.1:He?.28:.5})), hsl(${Math.round(k)} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * ${G?1.1:He?.28:.5})))`,boxShadow:G?"0 0 0 1px var(--graview-accent-dim)":void 0},children:[!M&&!F&&d.length>0?(0,s.jsx)("div",{"data-graview-tally":d.length,"data-graview-broken":A||void 0,"aria-hidden":"true",style:{position:"absolute",left:0,right:0,top:0,display:"flex",height:3,background:`hsl(${Math.round(k)} 55% var(--graview-tint-lightness) / 0.4)`},children:A>0?(0,s.jsx)("span",{style:{width:`${Math.max(6,Math.round(A/d.length*100))}%`,background:"var(--graview-warn)"}}):null}):null,w?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:M?4:6},children:[(0,s.jsx)(ae,{kind:String(t),schema:e,...h?{brand:h}:{},size:M?14:18}),Fe]}):Fe,(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:5,fontSize:"0.875rem"},children:[(0,s.jsx)("span",{title:d.length>0?`${Q(d.length)} ${d.length===1?H(a,String(t)):o.toLowerCase()}`:void 0,style:{fontVariantNumeric:"tabular-nums",color:ke?"var(--graview-accent)":"var(--graview-ink-faint)"},children:d.length===0?"none yet":ke?O===d.length?`${O} tied`:`${O} of ${d.length} tied`:Q(d.length)}),(0,s.jsx)(be,{kind:String(t),plural:o,problems:Ht,flag:S,listed:K}),(r.retired??0)>0?(0,s.jsxs)("button",{type:"button",className:"graview-kind-past","data-graview-retired":r.retired,title:`${r.retired} retired ${o.toLowerCase()} \u2014 press to widen the view to the past`,onClick:p=>{p.stopPropagation(),W(pt(L,!0))},onDoubleClick:p=>p.stopPropagation(),onPointerDown:p=>p.stopPropagation(),children:["+",r.retired," past"]}):null,_>0?(0,s.jsxs)("button",{type:"button",className:"graview-kind-hits","data-testid":`hits-${String(t)}`,title:`${_} ${_===1?"match":"matches"} for \u201C${L.q??""}\u201D \u2014 press to go in, narrowed`,onClick:p=>{p.stopPropagation(),W(Xe(L,ne(String(t)),{ownPicture:!0,...L.q?{carry:L.q}:{}}))},onDoubleClick:p=>p.stopPropagation(),onPointerDown:p=>p.stopPropagation(),children:[_," match"]}):null,O>0&&!ke?(0,s.jsxs)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-accent)"},children:[O," tied"]}):null,r.hasOwnView&&!F?(0,s.jsx)("span",{title:`${o} has a view of its own`,"aria-label":"has its own view",style:{fontSize:"0.6875rem",color:"var(--graview-accent)"},children:"\u25C6"}):null,!M&&d.length>0&&!r.focused?(0,s.jsxs)("button",{type:"button",className:"graview-kind-open","data-testid":`open-${String(t)}`,"aria-expanded":K,"aria-label":K?`Close up the ${o}`:`See the ${o} in here`,title:K?"Close it up":`See the ${o} in here`,onClick:p=>{p.stopPropagation(),Y?K?N():b([ne(String(t))]):C(ne(String(t)))},onDoubleClick:p=>p.stopPropagation(),onPointerDown:p=>p.stopPropagation(),children:[(0,s.jsx)("span",{className:"graview-kind-open-word",children:K?"close":"open"})," ",(0,s.jsx)("span",{"aria-hidden":"true",children:K?"\u25B4":"\u25BE"})]}):null]}),F&&r.states?(0,s.jsx)(P.Suspense,{fallback:null,children:(0,s.jsx)(tn,{states:r.states,definition:a})}):null,r.opened?(0,s.jsxs)("div",{className:"graview-kind-members","data-graview-buildings":r.plot?.side??1,style:{display:"grid",gridTemplateColumns:`repeat(${y.columns}, minmax(0, 1fr))`,gap:3},children:[d.slice(0,y.shown).map(p=>{let D=r.flagged?.includes(p.id)??!1,T=$(a,p);return(0,s.jsx)(X,{pickId:p.id,label:D?`${T} ${S}`:T,title:D?`${T} \u2014 implicated in a problem`:void 0,hue:k,selected:Ie.has(p.id)},p.id)}),d.length>y.shown?(0,s.jsxs)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",padding:"2px 4px",gridColumn:"1 / -1"},children:["+",d.length-y.shown," more \u2014 double-click to go in"]}):null]}):null]}),!M&&z.length>0?(0,s.jsx)("div",{className:"graview-drive-in","data-testid":`drive-in-${String(t)}`,"data-graview-showing":R,onPointerDown:p=>p.stopPropagation(),onDoubleClick:p=>p.stopPropagation(),children:(0,s.jsx)("div",{className:"graview-drive-in-marquee",role:"group","aria-label":`${o}: pictures`,"data-graview-thumbs":z.length===1?"one":"two",children:z.map(p=>{let D=R===p.as;return(0,s.jsxs)("div",{className:"graview-drive-in-thumb","data-graview-pressed":D||void 0,children:[(0,s.jsx)("span",{className:"graview-drive-in-thumb-title","aria-hidden":"true",children:p.title}),(0,s.jsx)("button",{type:"button",className:"graview-drive-in-thumb-press","data-testid":`showing-${p.as}`,"aria-label":`${o}: ${p.title}`,"aria-pressed":D,title:D?`${p.title} is showing \u2014 press again to open it`:`Show ${p.title} on the billboard \u2014 double-click to open it`,onClick:T=>{T.stopPropagation();let Z=()=>W(Je(L,String(t),p.as));if(T.detail>=2||D&&r.focused){Z();return}W(_e(je(qe(L,!0),Ue(String(t))),"view",p.as)),T.detail===1&&Zt(T.currentTarget.ownerDocument,Ct(T.nativeEvent),Z)}})]},p.as)})})}):null]})};m.generic=!0,f.generic=!0,n.register(t,{cardinality:"one",fidelity:"full"},j(l)).register(t,{cardinality:"one",fidelity:"summary"},j(g)).register(t,{cardinality:"one",fidelity:"glyph"},j(u)).register(t,{cardinality:"many",fidelity:"full"},j(m)).register(t,{cardinality:"many",fidelity:"summary"},j(m)).register(t,{cardinality:"many",fidelity:"glyph"},j(f))}return n}var Me=E(I(),1),$t=new WeakMap;function an(e){let n=$t.get(e);return n||$t.set(e,n=At(e,me(e))),n}var Ve=et;function Vt(){return(0,$e.useContext)(Ve)}function jn({children:e}){return(0,Me.jsx)(Ve.Provider,{value:!0,children:e})}function Mt(e){let n=(0,$e.useContext)(Ve),{store:t}=V();if(n)return null;let a=e.kind??e.node?.kind??e.nodes?.[0]?.kind;if(!a)return null;let o=an(t.schema).lookup(a,{cardinality:e.cardinality,fidelity:e.fidelity});return o?(0,Me.jsx)(o,{...e}):null}var i=E(I(),1),Tt=(0,v.createContext)(null),Et=(e,n)=>e.trim().toLowerCase().replace(/[_-]+/g," ")===n.trim().toLowerCase().replace(/[_-]+/g," "),rn=(0,v.createContext)(null),Be=(0,v.createContext)(null);function Lt({block:e}){let n=(0,v.useContext)(Be),t=n?.slots?.[e.key],a=(0,i.jsx)(on,{block:e});return t?(0,i.jsx)(v.Suspense,{fallback:a,children:(0,i.jsx)(t,{block:e,node:n.node,drawn:a})}):a}function on({block:e}){let n=(0,v.useContext)(Tt),t=(0,v.useContext)(ln),a=(0,v.useContext)(Te),o=(0,v.useContext)(Pe);if(n&&e.t==="badge"&&n.values.some(l=>Et(l,e.text))||n&&e.t==="field"&&n.field!==void 0&&e.field===n.field||e.t==="badge"&&/^0(?:\s+\p{L}+)?$/u.test(e.text.trim()))return null;switch(e.t){case"title":return(0,i.jsx)("strong",{className:"graview-spec-title",...o!==null&&Et(o,e.text)?{"aria-hidden":!0}:{},children:e.text});case"text":return e.markdown||Ce(e.text)?(0,i.jsx)("div",{className:"graview-spec-text",...e.tone?{"data-graview-tone":e.tone}:{},children:(0,i.jsx)(ft,{text:e.text,markdown:e.markdown})}):(0,i.jsx)("p",{className:"graview-spec-text",...e.tone?{"data-graview-tone":e.tone}:{},children:e.text});case"badge":return(0,i.jsx)("span",{className:"graview-spec-badge","data-graview-tone":e.tone,children:e.text});case"field":return(0,i.jsxs)("span",{className:"graview-spec-field","data-graview-field":e.field,children:[(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,i.jsx)("span",{className:"graview-spec-value",...Ce(e.text)?{style:{whiteSpace:"pre-line"}}:{},children:e.linked?(0,i.jsx)(gt,{relation:e.linked.relation,refs:e.linked.refs,as:"chip"}):e.app?(0,i.jsx)(yt,{address:e.app}):e.href?(0,i.jsx)("a",{className:"graview-spec-link",href:e.href,...e.href.startsWith("tel:")?{}:{rel:"noopener noreferrer",target:"_blank"},children:e.text}):e.text})]});case"image":return(0,i.jsx)(ve,{as:"block",field:e.field,files:e.files,label:e.label,view:e.as});case"progress":return e.value===void 0||e.max===void 0?(0,i.jsxs)("span",{className:"graview-spec-progress",children:[(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,i.jsx)("span",{className:"graview-spec-value",children:e.text})]}):(0,i.jsxs)("span",{className:"graview-spec-progress",children:[(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,i.jsx)("span",{className:"graview-spec-track",role:"progressbar","aria-label":e.label,"aria-valuemin":0,"aria-valuemax":e.max,"aria-valuenow":Math.max(0,Math.min(e.value,e.max)),"aria-valuetext":e.text,children:(0,i.jsx)("span",{className:"graview-spec-fill",style:{width:`${Math.round(Math.max(0,Math.min(e.value,e.max))/e.max*100)}%`}})}),(0,i.jsx)("span",{className:"graview-spec-value",children:e.text})]});case"group":return(0,i.jsx)("span",{className:"graview-spec-group","data-direction":e.direction,children:(0,i.jsx)(Ee,{blocks:e.blocks})});case"when":return e.shown?(0,i.jsx)(Ee,{blocks:e.blocks}):null;case"divider":return(0,i.jsx)("hr",{className:"graview-spec-divider"});case"figure":return(0,i.jsx)(sn,{});case"headline":{let l=`h${Math.min(6,e.level+t)}`,g=(0,i.jsx)(l,{className:"graview-spec-headline","data-level":e.level,children:e.text});return a!==null&&e.level===1?(0,i.jsxs)(i.Fragment,{children:[g,a]}):g}case"number":return(0,i.jsxs)("span",{className:"graview-spec-number",...e.emphasis?{"data-emphasis":e.emphasis}:{},children:[(0,i.jsx)("span",{className:"graview-spec-number-value",children:e.text}),e.label?(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}):null]});case"list":return(0,i.jsx)(cn,{list:e})}}function sn(){let e=(0,v.useContext)(Be)?.figure;return e?(0,i.jsx)("span",{className:"graview-spec-figure","aria-hidden":"true",children:e()}):null}function Ee({blocks:e}){let n=[];for(let t=0;t<e.length;t++){let a=t;for(;e[a]?.t==="badge"&&e[a+1]?.t==="badge";)a++;if(a===t){n.push((0,i.jsx)(Lt,{block:e[t]},t));continue}n.push((0,i.jsx)("span",{className:"graview-spec-badges",children:e.slice(t,a+1).map((o,l)=>(0,i.jsx)(Lt,{block:o},l))},t)),t=a}return n}function Dt({blocks:e,ctx:n,view:t}){let a=(0,v.useContext)(rn)?.[t];return(0,i.jsx)(Be.Provider,{value:{figure:n.figure,slots:a,node:n.node},children:(0,i.jsx)(Ee,{blocks:e})})}function Ge({blocks:e,ctx:n,view:t}){return(0,i.jsx)(Dt,{blocks:J(e,n),ctx:n,view:t})}var Le=3,Bt=(0,v.createContext)(0),Gt=(0,v.createContext)(null),ln=(0,v.createContext)(0),Te=(0,v.createContext)(null);function dn({node:e,as:n,depth:t,said:a=null}){let{store:o,views:l}=V(),g=$(o.schema.tryDefinition(e.kind),e),u=l.lookup(e.kind,{cardinality:"one",fidelity:n==="card"?"summary":"glyph"});return n==="row"&&t<=Le&&(!u||pe(u))?(0,i.jsxs)("li",{className:"graview-spec-item","data-graview-listed":e.id,"data-as":n,children:[(0,i.jsx)(De,{node:e,label:g}),(0,i.jsx)("div",{className:"graview-spec graview-spec-row","data-graview-spec":"row","data-graview-kind":e.kind,"aria-hidden":"true",children:(0,i.jsx)("strong",{className:"graview-spec-title",children:g})})]}):(0,i.jsxs)("li",{className:"graview-spec-item","data-graview-listed":e.id,"data-as":n,children:[(0,i.jsx)(De,{node:e,label:g}),t<=Le&&u?(0,i.jsx)(Ye,{mode:"scene",children:(0,i.jsx)(Bt.Provider,{value:t,children:(0,i.jsx)(Tt.Provider,{value:a,children:(0,i.jsx)(Pe.Provider,{value:g,children:(0,i.jsx)(u,{node:e,cardinality:"one",fidelity:n==="card"?"summary":"glyph",mode:"scene",selected:!1})})})})}):(0,i.jsx)("span",{className:"graview-spec-item-name","aria-hidden":"true",children:g})]})}function De({node:e,label:n,describedBy:t}){let a=(0,v.useContext)(Gt),o=(0,v.useRef)(null);return bt(o),a?(0,i.jsx)("a",{ref:o,className:"graview-spec-item-link",href:a.href(e),"aria-label":n,...t?{"aria-describedby":t}:{},onClick:l=>{l.metaKey||l.ctrlKey||l.shiftKey||l.button!==0||(l.preventDefault(),l.stopPropagation(),a.go(e))}}):(0,i.jsx)("button",{ref:o,type:"button",className:"graview-spec-item-link","data-graview-pick":e.id,"aria-label":n,...t?{"aria-describedby":t}:{}})}function cn({list:e}){let n=(0,v.useContext)(Bt)+1,{store:t}=V(),a=(0,v.useContext)(Gt),[o,l]=(0,v.useState)(e.members.length);if(e.failed)return(0,i.jsx)("p",{className:"graview-spec-text",children:"\u2014"});if(e.members.length===0)return e.empty?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-empty",children:e.empty}):null;let g=(b,N=null)=>n>Le?(0,i.jsx)("ul",{className:"graview-spec-list","data-as":"names",children:b.map(C=>(0,i.jsxs)("li",{className:"graview-spec-item","data-graview-listed":C.id,"data-as":"name",children:[(0,i.jsx)(De,{node:C,label:$(t.schema.tryDefinition(C.kind),C)}),(0,i.jsx)("span",{className:"graview-spec-item-name","aria-hidden":"true",children:$(t.schema.tryDefinition(C.kind),C)})]},C.id))}):(0,i.jsx)("ul",{className:"graview-spec-list","data-as":e.as,children:b.map(C=>(0,i.jsx)(dn,{node:C,as:e.as,depth:n,said:N},C.id))}),u=e.rest??[],m=Math.min(o,e.members.length+u.length),c=m>e.members.length?[...e.members,...u].slice(0,m):e.members,f=e.members.length+u.length-m,r=Math.max(1,e.members.length),d=f>0?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-more",children:(0,i.jsx)("button",{type:"button",className:"graview-spec-show-more","data-graview-show-more":f,onClick:()=>l(m+r),children:`Show ${Math.min(r,f)} more`})}):null,y=e.total??e.members.length+e.more,k=e.more-u.length,h=d??(a?.more&&y>c.length?a.more({members:c,total:y}):k>0?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-more",children:`and ${k} more`}):null);if(!e.groups)return(0,i.jsxs)("div",{className:"graview-spec-listing",children:[g(c),h]});let w=`h${e.headingLevel}`,S=m,x=m>e.members.length&&e.everyGroup?e.everyGroup.flatMap(b=>{if(S<=0)return[];let N=b.members.slice(0,S);return S-=N.length,[{...b,members:N}]}):e.groups;return(0,i.jsxs)("div",{className:"graview-spec-listing",children:[x.map(b=>(0,i.jsxs)("section",{className:"graview-spec-list-group","data-graview-group":b.value??"",children:[b.heading?(0,i.jsx)(w,{className:"graview-spec-list-heading",children:b.heading}):null,g(b.members,b.value!==null?{values:[b.value,...b.heading?[b.heading]:[]]}:null)]},b.value??"")),h]})}function sa({blocks:e,heading:n=2,firstHeading:t,slot:a,view:o=a}){let{store:l,brand:g}=V();ue();let u=re(l,null,null,{heading:n,firstHeading:t,money:g}),m=(0,v.useContext)(Te),c=e.some(f=>f.t==="headline");return(0,i.jsxs)("div",{className:`graview-spec graview-spec-${a}`,"data-graview-spec":a,children:[m!==null&&!c?m:null,(0,i.jsx)(Te.Provider,{value:c?m:null,children:(0,i.jsx)(Ge,{blocks:e,ctx:u,view:o})})]})}function Oe(e,n="card"){let{store:t,brand:a}=V(),o=t.schema;return{...re(t,null,e,{slot:n,money:a}),figure:()=>(0,i.jsx)(ae,{kind:e.kind,schema:o,...a?{brand:a}:{},size:22})}}function gn({slot:e,blocks:n,node:t,selected:a}){let o=Oe(t,e);return(0,i.jsx)("div",{className:`graview-spec graview-spec-${e}`,"data-graview-spec":e,"data-graview-kind":t.kind,...e==="row"&&n.some(st)?{"data-graview-tall":""}:{},...a?{"data-selected":""}:{},children:(0,i.jsx)(Ge,{blocks:n,ctx:o,view:`${t.kind}.${e}`})})}function un({blocks:e,node:n,selected:t,flagged:a}){let o=Oe(n),[l,...g]=e,u=l?.t==="title";return(0,i.jsx)(U,{...u?{title:J([l],o)[0].text}:{},selected:t,tone:a?"warning":"muted",fit:!0,children:(0,i.jsx)("div",{className:"graview-spec graview-spec-card","data-graview-spec":"card","data-graview-kind":n.kind,children:(0,i.jsx)(Ge,{blocks:u?g:e,ctx:o,view:`${n.kind}.card`})})})}function pn({blocks:e,props:n}){let t=n.node,a=Oe(t,"page"),o=Vt(),l=J(e,a),g=ye(e,l),u=g.title!==void 0&&(!o||g.title===$(a.schema?.tryDefinition(t.kind),t)),m=(0,i.jsx)("div",{className:"graview-spec graview-spec-page","data-graview-spec":"page","data-graview-kind":t.kind,children:(0,i.jsx)(Dt,{blocks:u?l.slice(1):l,ctx:a,view:`${t.kind}.page`})});return o?m:(0,i.jsx)(oe.Provider,{value:{nodeId:t.id,...g.title!==void 0?{title:g.title}:{},body:m,fields:g.fields,records:g.records},children:(0,i.jsx)(Mt,{...n})})}function la(e,n,t){return typeof e=="function"?e.says?.(n,t):void 0}function mn({blocks:e,node:n,selected:t}){let{store:a}=V();return(0,i.jsx)("div",{title:$(a.schema.tryDefinition(n.kind),n),style:{minWidth:0,maxWidth:"100%"},children:(0,i.jsx)(gn,{slot:"row",blocks:e,node:n,selected:t})})}function da(e,n,t){if(!t)return e;let a=new Set(n.kinds);for(let[o,l]of Object.entries(t)){if(!a.has(o)||!l)continue;let g=o;if(l.card){let u=ie(l.card),m=c=>c.node?(0,i.jsx)(un,{blocks:u,node:c.node,selected:c.selected,flagged:c.flagged?.includes(c.node.id)??!1}):null;e.register(g,{cardinality:"one",fidelity:"summary"},m)}if(l.row){let u=ie(l.row),m=c=>c.node?(0,i.jsx)(mn,{blocks:u,node:c.node,selected:c.selected}):null;m.says=(c,f)=>ye(u,J(u,re({graph:f,schema:n},null,c,{slot:"row"}))),e.register(g,{cardinality:"one",fidelity:"glyph"},m)}if(l.page){let u=ie(l.page),m=c=>c.node?(0,i.jsx)(pn,{blocks:u,props:c}):null;m.says=(c,f)=>ye(u,J(u,re({graph:f,schema:n},null,c))),e.register(g,{cardinality:"one",fidelity:"full"},m)}}return e}export{bt as a,jn as b,Tt as c,Gt as d,ln as e,Te as f,De as g,sa as h,la as i,da as j,At as k};
@@ -0,0 +1 @@
1
+ import{a as n}from"./chunk.L7DQKPJV.js";import"./chunk.546WEHEX.js";import"./chunk.BZSU4HH2.js";import"./chunk.UGFDSE37.js";import{l as s}from"./chunk.P5325GYR.js";import"./chunk.QEXXLWEU.js";import"./chunk.BEC5ZH2L.js";import"./chunk.6HBEYRJU.js";import"./chunk.U7QMA4H7.js";import"./chunk.GP2F7TIN.js";import"./chunk.C6X7CKU6.js";import"./chunk.PXQVXBNG.js";import"./chunk.6CFP5UYP.js";import"./chunk.CAMQ7MYJ.js";import"./chunk.2GGDOFTF.js";import"./chunk.ZTMDU3OH.js";import"./chunk.HFDYFPMJ.js";import"./chunk.RWB4235L.js";import"./chunk.CTK2P4JV.js";import"./chunk.GXKECZ4S.js";import"./chunk.6XU2CXRZ.js";import"./chunk.3ZNQ5YKX.js";import"./chunk.7EFNLMKU.js";import"./chunk.J3M2MZHG.js";import"./chunk.UT6642FC.js";import"./chunk.FMN5XDLE.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.KJNUZYXS.js";import"./chunk.4BBJ62ZO.js";import"./chunk.UCZR33MK.js";import"./chunk.CC47O2DW.js";import"./chunk.2IX3CZNP.js";import"./chunk.6DHHUBSC.js";import"./chunk.GZHZLJBF.js";import"./chunk.HHUCPVG5.js";import"./chunk.OJGHDWI6.js";import"./chunk.WXYUWBKX.js";import"./chunk.NSNGPQGT.js";import"./chunk.H5CZZZLX.js";import"./chunk.Z7JRBKA7.js";import"./chunk.ORXFUK6F.js";import{G as y,R as i}from"./chunk.BTSXYZ6Z.js";import"./chunk.SDO3U72B.js";import"./chunk.5ZMENPY4.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 +1 @@
1
- import{e as a}from"./chunk.33GN2NUT.js";import{m as i}from"./chunk.MQ7FNHXG.js";import{Wc as o}from"./chunk.WLPTY4BF.js";function p(t){let r=t.within??{};return o({...r.sort?{sort:r.sort}:{},...r.filter?{filter:r.filter}:{},...r.group?{group:r.group}:{},...r.q?{q:r.q}:{},...r.archived?{archived:r.archived}:{}})}function c(t,r){let m=a(r),e=t;for(let n of["sort","filter","group","q","archived"])e=i(e,n,m[n]??null);return e}export{p as a,c as b};
1
+ import{e as a}from"./chunk.3ZNQ5YKX.js";import{l as i}from"./chunk.BTSXYZ6Z.js";import{Zc as o}from"./chunk.5ZMENPY4.js";function p(t){let r=t.within??{};return o({...r.sort?{sort:r.sort}:{},...r.filter?{filter:r.filter}:{},...r.group?{group:r.group}:{},...r.q?{q:r.q}:{},...r.archived?{archived:r.archived}:{}})}function c(t,r){let m=a(r),e=t;for(let n of["sort","filter","group","q","archived"])e=i(e,n,m[n]??null);return e}export{p as a,c as b};
@@ -1 +1 @@
1
- import{d as ae}from"./chunk.MWZK3HVG.js";import{b as Ce,d as $e}from"./chunk.3D5T3XIE.js";import{e as Te}from"./chunk.GR5Q4HTW.js";import{H as ke,Oc as Re,Qc as De,Sc as We,Ta as Se,Tb as ie,Tc as Me,Va as G,Z as M,_ as xe,aa as _,ba as z,ca as Ae,da as W,fa as we,ga as Ne,kd as je,sc as oe,wc as ve,xc as Oe}from"./chunk.WLPTY4BF.js";function se(n,e){return n.display?.labels?.[e]??W(e)}function de(n){let e=ae(n);switch(e.type){case"text":case"date":case"number":case"boolean":case"choice":return e.type;default:return}}function Je(n,e){let t=new Map,o=n.tryDefinition(e);for(let[r,a]of Object.entries(o?.edges??{}))t.set(r,{key:r,label:a.description?M(a.description):W(r),about:"edge",far:a.to==="*"?[...n.kinds]:[...a.to]});for(let r of n.definitions)if(r.kind!==e)for(let[a,d]of Object.entries(r.edges??{}))t.has(a)||d.to!=="*"&&!d.to.includes(e)||t.set(a,{key:a,label:d.inverse?M(d.inverse):W(a),about:"edge",far:[r.kind]});return[...t.values()]}var Ze=["current","past","any","flagged","clear"];function Fe(n,e){let t=n?.lifecycle;if(!t||t.retired==="date")return!1;let o=t.retired.map(String);return e.some(r=>r.key===t.field&&o.includes(r.value))}function Be(n,e){let t=n.tryDefinition(e);if(!t)return{kind:e,sorts:[],filters:[],groups:[]};let o=new Set(t.display?.hide??[]),r=t.fields.shape??{},a=[{key:"label",label:"Name",about:"label",type:"text"}],d=[],f=[];for(let[y,x]of Object.entries(r)){if(y==="id"||y==="kind"||y==="label"||o.has(y))continue;let p=de(x);if(!p)continue;let O=se(t,y),w=p==="choice"?Le(x):p==="boolean"?["true","false"]:void 0,N={key:y,label:O,about:"field",type:p,...w?{options:w}:{}};a.push(N),d.push(N),(p==="boolean"||p==="choice")&&f.push(N),p==="date"&&f.push({...N,buckets:["day","week","month","year","decade"]})}for(let y of Je(n,e))a.push(y),d.push(y),f.push(y);let l={key:"is",label:t.lifecycle?"Standing and currency":"Standing",about:"is",type:"choice",options:t.lifecycle?[...Ze]:["flagged","clear"]};d.push(l);let u=t.fieldRoles?.order,g=u&&(u in r||u==="label")?{by:u,direction:"asc"}:void 0;return{kind:e,sorts:a,filters:d,groups:f,...g?{natural:g}:{}}}function vn(n,e){let t=[];for(let r of e.filters){let a=r.about==="edge"&&r.far?.length===1?n.tryDefinition(r.far[0]):void 0;if(!(!a||a.kind===e.kind))for(let[d,f]of Object.entries(a.fields.shape??{}))de(f)!=="choice"||a.display?.hide?.includes(d)||t.push({key:`${r.key}.${d}`,label:`${r.label} \xB7 ${se(a,d)}`,about:"via",type:"choice",options:Le(f),far:[a.kind]})}if(t.length===0)return e;let o=e.filters.filter(r=>r.about!=="is");return{...e,filters:[...o,...t,...e.filters.filter(r=>r.about==="is")]}}function On(n,e){let t=n.tryDefinition(e.kind),o=Object.entries(t?.computed??{});if(!t||o.length===0)return e;let r=o.filter(([a])=>!e.sorts.some(d=>d.key===a)).map(([a,d])=>({key:a,label:(typeof d=="object"?d.label:void 0)??se(t,a),about:"field",type:"number"}));return{...e,sorts:[...e.sorts,...r]}}function Le(n){let e=ae(n);return e.type==="choice"?e.options:[]}var Ie=n=>n,Pe=n=>n;function en(n,e,t){let o=new Map;for(let r of[...n.out(e,t),...n.in(e,t)])o.set(r.id,r);return[...o.values()]}function le(n,e,t){let o=n.schema.tryDefinition(e.kind);if(t.key==="is")switch(t.value){case"current":return _(o,Pe(e),n.today);case"past":return!_(o,Pe(e),n.today);case"any":return!0;case"flagged":return n.flagged?.has(e.id)??!1;case"clear":return!(n.flagged?.has(e.id)??!1);default:return!0}let r=o?.fields.shape??{};if(t.key in r){let l=Se(Ie(e),t.key,n.today??ke()),u=de(r[t.key]);if(u==="date"){let[g,y]=t.value.split(":");if(typeof l!="string"||!y)return!1;let x=l.slice(0,10);return g==="before"?x<y:g==="after"?x>y:x===y}if(u==="boolean")return String(l)===t.value;if(u==="number"){let g=t.value.lastIndexOf(":"),y=g>0?t.value.slice(0,g):"",x=Number(t.value.slice(g+1));if(y==="at-most"||y==="at-least")return typeof l!="number"||!Number.isFinite(x)?!1:y==="at-most"?l<=x:l>=x}return String(l)===t.value}let[a,d]=t.key.split("."),f=en(n.graph,e.id,a);return d?f.some(l=>String(Ie(l)[d])===t.value):t.value==="*"?f.length>0:t.value==="none"?f.length===0:f.some(l=>l.id===t.value)}var nn=5;function ze(n){return n.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function ce(n){return ze(n).replace(/ /g,"")}var U=new Map,tn=5e4;function $(n){let e=U.get(n);if(e===void 0){U.size>=tn&&U.clear();let t=ze(n);e={tokens:t.split(" ").filter(Boolean),whole:t.replace(/ /g,"")},U.set(n,e)}return e}var T=n=>[...$(n).tokens];function j(n,e){if(e.length===0)return;let{whole:t,tokens:o}=$(n),r=e.join("");if(t.length===0)return;if(t===r)return"exact";if(e.every(d=>o.some(f=>f.startsWith(d))))return t.startsWith(r)?"prefix":e.every(d=>o.includes(d))?"word":"part"}function q(n,e,t=48){let o=n.replace(/\s+/g," ").trim();if(o.length<=t)return o;let r=e[0],a=o.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase(),d=r?a.search(new RegExp(`(^|[^\\p{L}\\p{N}])${rn(r)}`,"u")):-1,f=d<0?0:d+(a[d]&&/[\p{L}\p{N}]/u.test(a[d])?0:1),l=Math.max(0,f-Math.floor(t/3));if(l>0){let g=o.lastIndexOf(" ",l);l=g<0?0:g+1}let u=Math.min(o.length,l+t);if(u<o.length){let g=o.indexOf(" ",u);u=g<0||g-u>16?u:g}return`${l>0?"\u2026":""}${o.slice(l,u).trim()}${u<o.length?"\u2026":""}`}var rn=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),on=/^([\p{L}][\p{L}\p{N}_-]*):(\S+)$/u;function an(n){let e=[],t=[];for(let o of n.trim().split(/\s+/).filter(Boolean)){let r=on.exec(o);r?t.push({key:r[1],value:r[2]}):e.push(o)}return{words:e.join(" "),conditions:t}}var Ee=new WeakMap;function Q(n,e){let t=Ee.get(e);if(t&&t.definition===n)return t.texts;let o=sn(n,e);return Ee.set(e,{definition:n,texts:o}),o}function sn(n,e){let t=z(n,e),o=[{field:"label",reading:"Name",text:t}];for(let r of $e(e,n,{limit:Number.POSITIVE_INFINITY}))r.key==="label"||r.value===t||typeof e[r.key]!="boolean"&&o.push({field:r.key,reading:r.label,text:r.markdown?Te(r.value):r.value});return o}var I={exact:0,prefix:1,word:2,part:3,field:4,near:5},Ge=new Set(["a","an","the","of","and","or","for","to","in","on","at","by","with","my","our","is"]);function Ke(n){let e=n;e.length>4&&e.endsWith("ies")?e=`${e.slice(0,-3)}y`:e.length>4&&/(ss|x|ch|sh|z)es$/.test(e)?e=e.slice(0,-2):e.length>3&&e.endsWith("s")&&!/(ss|us|is)$/.test(e)&&(e=e.slice(0,-1));for(let t of["ing","ed"])if(e.length>t.length+2&&e.endsWith(t)){e=e.slice(0,-t.length),/([b-df-hj-km-np-rtv-z])\1$/.test(e)&&(e=e.slice(0,-1));break}return e.length>3&&e.endsWith("e")?e.slice(0,-1):e}function He(n,e,t){if(Math.abs(n.length-e.length)>t)return t+1;let o=[],r=Array.from({length:e.length+1},(a,d)=>d);for(let a=1;a<=n.length;a++){let d=[a],f=a;for(let l=1;l<=e.length;l++){let u=Math.min(r[l]+1,d[l-1]+1,r[l-1]+(n[a-1]===e[l-1]?0:1));a>1&&l>1&&n[a-1]===e[l-2]&&n[a-2]===e[l-1]&&(u=Math.min(u,o[l-2]+1)),d[l]=u,u<f&&(f=u)}if(f>t)return t+1;o=r,r=d}return r[e.length]}var V=new Map;function dn(n,e){let t=V.get(n);t||(V.size>=64&&V.clear(),V.set(n,t=new Map));let o=t.get(e);return o===void 0&&(o=ln(n,e)??null,t.set(e,o)),o??void 0}function ln(n,e){if(/\d/.test(n))return;let t=Ke(n);if(t.length>=3&&(Ke(e)===t||t.length>=4&&e.startsWith(t)))return"stem";let o=n.length<4?0:n.length<=7?1:2;if(o!==0){if(He(n,e,o)<=o)return"spelling";if(n.length>=5){for(let r=n.length-o;r<=n.length+o;r++)if(r<e.length&&He(n,e.slice(0,r),o)<=o)return"spelling"}}}function cn(n,e){let t=e.length>1?e.filter(r=>!Ge.has(r)):e;if(t.length===0)return;let o;for(let r of t){let a;for(let d of n){for(let f of $(d.text).tokens){if(f.startsWith(r)){a={text:d,matched:f};break}let l=a?void 0:dn(r,f);l&&(a={text:d,matched:f,by:l})}if(a&&!a.by)break}if(!a)return;a.by&&!o&&(o={text:a.text,asked:r,matched:a.matched,by:a.by})}if(o)return{field:o.text.field,reading:o.text.reading,fragment:q(o.text.text,[o.matched]),strength:"near",asked:o.asked,matched:o.matched,by:o.by}}var fn=80;function gn(n,e,t){let o=T(e).filter(d=>!Ge.has(d)).join(" ")||e,r=t===void 0?[]:T(t),a=r.length>0&&n.find(d=>r.every(f=>$(d.text).tokens.some(l=>l.startsWith(f))))||n[0];return{field:a.field,reading:a.reading,fragment:q(a.text,r),strength:"near",asked:o,matched:(t??a.text).slice(0,fn),by:"meaning"}}function _e(n,e,t,o){let r=T(t);if(r.length===0)return;if(o){let p=Q(n,e),O=o.includes("label")||o.some(v=>typeof e[v]=="string"&&e[v]===p[0].text),w=p.filter((v,D)=>D===0?O:o.includes(v.field)),N=v=>D=>$(D.text).tokens.some(P=>P.startsWith(v));if(!r.every(v=>w.some(N(v))))return;let S=w.find(N(r[0]));return{field:S.field,reading:S.reading,fragment:q(S.text,r),strength:S.field==="label"?j(S.text,r)??"field":"field"}}let a=Q(n,e),[d,...f]=a,l=j(d.text,r);if(l)return{field:"label",reading:d.reading,fragment:q(d.text,r),strength:l};let u=p=>O=>$(O.text).tokens.some(w=>w.startsWith(p));if(!r.every(p=>a.some(u(p))))return;let g=T(d.text),y=r.find(p=>!g.some(O=>O.startsWith(p)))??r[0],x=f.find(u(y));return{field:x.field,reading:x.reading,fragment:q(x.text,[y]),strength:"field"}}var un=512,yn=64;function hn(n){let e=new Map;if(n.length===0)return e;let t=n.slice(-un),o=n[n.length-1].seq;for(let r of t){let a=Math.pow(.5,(o-r.seq)/yn);for(let d of r.writes)e.set(d,(e.get(d)??0)+a)}return e}var ge=(n,e)=>we({tryDefinition:()=>n},e),fe=(n,e)=>De({tryDefinition:()=>n},e);function pn(n,e,t){let o=n.tryDefinition(e),r=[{field:"plural",text:ge(o,e)},{field:"kind",text:W(e)},...o?.noun?[{field:"noun",text:o.noun}]:[]],a;for(let d of r){let f=j(d.text,t);f&&(!a||I[f]<I[a.strength])&&(a={strength:f,...d})}return a}var mn,bn=(n,e)=>(mn??=new Intl.Collator(void 0,{sensitivity:"base",numeric:!0})).compare(n,e),qe=(n,e)=>(n.nearly??0)-(e.nearly??0)||(n.archived??0)-(e.archived??0)||n.tier-e.tier||n.inKind-e.inKind||n.near-e.near||n.past-e.past||n.touched-e.touched||n.flagged-e.flagged||bn(n.name,e.name)||(n.id<e.id?-1:n.id>e.id?1:0);function Ln(n,e,t={}){let o=n.schema,r=an(e),a=T(r.words),d=t.principal??{kind:"human"},f=n.kindsKeptFrom(d),l=n.modules.disabledKinds,u=r.conditions.filter(i=>i.key==="kind").map(i=>i.value),g=r.conditions.filter(i=>i.key==="is").map(i=>i.value),y=g.includes("any")||g.includes("past"),x=g.includes("past")&&!g.includes("any")&&!g.includes("current"),p=g.includes("archived")?!0:t.archived??"all",O=(i,s)=>{let c=ce(s),h=o.tryDefinition(i);return ce(i)===c||ce(ge(h,i))===c},w=o.kinds.filter(i=>!f.has(i)&&!l.has(i)&&(t.kinds===void 0||t.kinds.includes(i))&&(u.length===0||u.some(s=>O(i,s)))),S=r.conditions.filter(i=>i.key!=="kind").map(i=>({...i,admittedBy:w.filter(s=>Be(o,s).filters.some(c=>c.key===i.key))})),v=S.filter(i=>i.key!=="is"),D=g.filter(i=>i==="flagged"||i==="clear"||i==="past"||i==="archived"),P={kinds:w,past:y},Qe={hits:[],words:r.words,conditions:S,searched:P,byKind:{},total:0,matched:[]};if(a.length===0&&v.length===0&&D.length===0)return Qe;let X=t.today,F=t.flagged??new Set(n.violations().flatMap(i=>i.nodeIds)),Ue=t.touched??hn(n.log.all()),Y=new Set;for(let i of t.from??[]){Y.add(i);for(let s of n.graph.neighbors(i))Y.add(s.id)}let ue=ve(n,d)?Oe(n,d):void 0,J=oe.keptFrom?.(n,d)&&n.seenBy(d).graph,Z=i=>je(i,t.basePath===void 0?{}:{basePath:t.basePath}),ye={schema:o,graph:n.graph,flagged:F,...X?{today:X}:{}},R=[],B={},L=[],E=[],K=(i,s,c,h,m,b)=>{let A=z(c,i);B[s]=(B[s]??0)+1,R.push({hit:{about:"node",id:i.id,kind:s,label:A,why:m,current:h,flagged:F.has(i.id),address:Z(`${fe(c,s)}/${encodeURIComponent(i.id)}`),...b===void 0?{}:{near:!0},...G(i)?{archived:!0}:{}},...b===void 0?{}:{nearly:2-b},tier:I[m.strength],inKind:s===t.inKind?0:1,near:Y.has(i.id)?0:1,past:h?0:1,archived:G(i)?1:0,touched:-(Ue.get(i.id)??0),flagged:F.has(i.id)?0:1,name:A,id:i.id})};for(let i of w){let s=o.tryDefinition(i),c=S.filter(m=>m.key!=="is"&&m.admittedBy.includes(i));if(a.length===0&&c.length===0&&D.length===0)continue;let h=Fe(s,c);for(let m of n.graph.nodesOfKind(i,{archived:p})){if(ue&&!ue(m.id))continue;let b=J?J.getNode(m.id):m;if(!b)continue;let A=_(s,b,X);if(!y&&!h&&!A){if(a.length>0&&g.length===0&&c.every(k=>le(ye,b,k))){let k=_e(s,b,r.words);k&&E.push({node:b,kind:i,definition:s,why:k})}continue}if(x&&A||!c.every(k=>le(ye,b,k))||g.includes("flagged")&&!F.has(b.id)||g.includes("clear")&&F.has(b.id))continue;let C=a.length>0?_e(s,b,r.words):c[0]?{field:c[0].key,reading:W(c[0].key),fragment:`${c[0].key}:${c[0].value}`,strength:"field"}:{field:"is",reading:"Is",fragment:`is:${D[0]}`,strength:"field"};C?K(b,i,s,A,C):a.length>0&&L.push({node:b,kind:i,definition:s,current:A})}}let ee=i=>i.strength!=="field",ne=!1;if(E.length>0&&R.length===0){ne=!0;for(let i of E)K(i.node,i.kind,i.definition,!1,i.why)}else if(E.some(i=>ee(i.why))&&!R.some(i=>ee(i.hit.why))){ne=!0;for(let i of E)ee(i.why)&&K(i.node,i.kind,i.definition,!1,i.why)}let he=t.near!==!1&&a.length>0&&R.length<nn&&L.length>0,te=new Set;if(he)for(let i of L){let s=cn(Q(i.definition,i.node),a);s&&(te.add(i.node.id),K(i.node,i.kind,i.definition,i.current,s,s.by==="stem"?.9:.8))}let Ve=i=>i==="exact"||i==="prefix"?-1:I[i],re=(i,s,c,h)=>({hit:i,tier:Ve(s),inKind:1,near:1,past:0,touched:0,flagged:1,name:c,id:h});if(a.length>0){for(let s of w){let c=pn(o,s,a);if(!c)continue;let h=Ne(o,s),m={field:c.field,reading:c.field==="plural"?"Plural":"Kind",fragment:c.text,strength:c.strength};R.push(re({about:"kind",kind:s,label:h,why:m,count:B[s]??0,address:Z(fe(o.tryDefinition(s),s))},c.strength,h,`kind:${s}`))}let i=t.places??[];for(let s of Re(i.filter(c=>w.includes(c.kind)))){if(s.across&&f.has(s.across))continue;let c=j(s.title,a);if(!c)continue;let h={field:"title",reading:"Title",fragment:s.title,strength:c},m=Me(s,i)?fe(o.tryDefinition(s.kind),s.kind).slice(1):void 0,b=Z(We(s.as,m));R.push(re({about:"place",kind:s.kind,title:s.title,as:s.as,why:h,address:b},c,s.title,`place:${s.kind}:${s.as}`))}for(let s of n.allInvariants()){let c=s.scope==="graph"?void 0:s.scope.kind;if(c&&!w.includes(c))continue;let h=s.label??W(s.name),m=j(h,a),b=m?void 0:j(W(s.name),a),A=m??b;if(!A)continue;let C={field:m?"label":"name",reading:m?"Rule":"Name",fragment:m?h:s.name,strength:A};R.push(re({about:"rule",name:s.name,label:h,...c?{kind:c}:{},why:C},A,h,`rule:${s.name}`))}}let pe=()=>{R.sort(qe);let i=t.limit??50,s=R.slice(0,i).map(k=>k.hit),c=s.flatMap(k=>k.about==="node"?[(J||n.graph).getNode(k.id)]:[]).filter(Boolean),h=Ce(c,k=>o.tryDefinition(k)),m=s.map(k=>k.about==="node"&&h.has(k.id)?{...k,apart:h.get(k.id)}:k),b=Object.values(B).reduce((k,Ye)=>k+Ye,0),A=R.flatMap(k=>k.hit.about==="node"?[k.hit.id]:[]),C=t.subject&&w.includes(String(n.graph.getNode(t.subject)?.kind))?kn(n,t.subject,r.words,{principal:d}):[];return{hits:[...m,...C],words:r.words,conditions:S,searched:ne?{...P,past:!0}:P,byKind:{...B},total:b,matched:A}},H=pe(),me=t.rank;if(!he||!me)return H;let be=L.filter(i=>!te.has(i.node.id)).map(({node:i,kind:s,definition:c})=>({id:i.id,kind:s,label:z(c,i),texts:Q(c,i)}));if(be.length===0)return H;let Xe=(async()=>{let i;try{i=await me(r.words,be)}catch{return H}let s=new Map(L.filter(h=>!te.has(h.node.id)).map(h=>[h.node.id,h])),c=!1;for(let{id:h,score:m,matched:b}of Array.isArray(i)?i:[]){let A=s.get(h);!A||!(m>0)||(s.delete(h),c=!0,K(A.node,A.kind,A.definition,A.current,gn(Q(A.definition,A.node),r.words,typeof b=="string"?b:void 0),Math.min(1,m)))}return c?pe():H})();return{...H,later:Xe}}function kn(n,e,t,o={}){let r=o.principal??{kind:"human"},a=(oe.keptFrom?.(n,r)?n.seenBy(r):n).graph.getNode(e);if(!a)return[];if(n.kindsKeptFrom(r).has(a.kind))return[];let d=T(t),f=z(n.schema.tryDefinition(a.kind),a),l=[];for(let g of n.allMutations()){let y=g.subject;if(!y||y.kinds!=="*"&&!y.kinds.includes(a.kind))continue;let x=g.derived?.act;if((x==="archive"||x==="merge")&&G(a)||x==="unarchive"&&!G(a)||x==="leave-alone"&&ie(a)||x==="allow-tidying"&&!ie(a)||!n.permits({name:g.name,args:{[y.arg]:a.id}},r).ok)continue;let p=Ae(g),O=T(p),w=d.filter(v=>O.some(D=>D.startsWith(v))),N=w.length>0?j(p,w):void 0,S=N?{field:"title",reading:"Act",fragment:p,strength:N}:{field:"subject",reading:"On",fragment:f,strength:"field"};l.push({hit:{about:"act",name:g.name,title:p,subject:a.id,why:S,destructive:g.destructive===!0},tier:N?I[N]:I.field+1,inKind:0,near:0,past:g.destructive?1:0,touched:0,flagged:g.pinned?0:1,name:p,id:`act:${g.name}`})}l.sort(qe);let u=l.map(g=>g.hit);return o.limit===void 0?u:u.slice(0,o.limit)}function En(n,e){let t=e.kinds.map((a,d)=>{let f=ge(n.tryDefinition(a),a);return d===0?f:f.toLowerCase()}),o=xe(t)||"Nothing";return e.kinds.some(a=>n.tryDefinition(a)?.lifecycle)?e.past?`${M(o)}, past ones included.`:`${M(o)}, current ones; add is:any for past ones.`:`${M(o)}.`}export{se as a,de as b,Je as c,Fe as d,Be as e,vn as f,On as g,Le as h,Ie as i,Pe as j,en as k,le as l,ce as m,an as n,_e as o,hn as p,Ln as q,kn as r,En as s};
1
+ import{d as ae}from"./chunk.NSNGPQGT.js";import{b as Ce,d as $e}from"./chunk.H5CZZZLX.js";import{e as Te}from"./chunk.Z7JRBKA7.js";import{Ac as Oe,H as ke,Rc as Re,Ta as Se,Tc as De,Va as G,Vc as We,Wb as ie,Wc as Me,Z as M,_ as xe,aa as _,ba as z,ca as Ae,da as W,fa as we,ga as Ne,nd as je,vc as oe,zc as ve}from"./chunk.5ZMENPY4.js";function se(n,e){return n.display?.labels?.[e]??W(e)}function de(n){let e=ae(n);switch(e.type){case"text":case"date":case"number":case"boolean":case"choice":return e.type;default:return}}function Je(n,e){let t=new Map,o=n.tryDefinition(e);for(let[r,a]of Object.entries(o?.edges??{}))t.set(r,{key:r,label:a.description?M(a.description):W(r),about:"edge",far:a.to==="*"?[...n.kinds]:[...a.to]});for(let r of n.definitions)if(r.kind!==e)for(let[a,d]of Object.entries(r.edges??{}))t.has(a)||d.to!=="*"&&!d.to.includes(e)||t.set(a,{key:a,label:d.inverse?M(d.inverse):W(a),about:"edge",far:[r.kind]});return[...t.values()]}var Ze=["current","past","any","flagged","clear"];function Fe(n,e){let t=n?.lifecycle;if(!t||t.retired==="date")return!1;let o=t.retired.map(String);return e.some(r=>r.key===t.field&&o.includes(r.value))}function Be(n,e){let t=n.tryDefinition(e);if(!t)return{kind:e,sorts:[],filters:[],groups:[]};let o=new Set(t.display?.hide??[]),r=t.fields.shape??{},a=[{key:"label",label:"Name",about:"label",type:"text"}],d=[],f=[];for(let[y,x]of Object.entries(r)){if(y==="id"||y==="kind"||y==="label"||o.has(y))continue;let p=de(x);if(!p)continue;let O=se(t,y),w=p==="choice"?Le(x):p==="boolean"?["true","false"]:void 0,N={key:y,label:O,about:"field",type:p,...w?{options:w}:{}};a.push(N),d.push(N),(p==="boolean"||p==="choice")&&f.push(N),p==="date"&&f.push({...N,buckets:["day","week","month","year","decade"]})}for(let y of Je(n,e))a.push(y),d.push(y),f.push(y);let l={key:"is",label:t.lifecycle?"Standing and currency":"Standing",about:"is",type:"choice",options:t.lifecycle?[...Ze]:["flagged","clear"]};d.push(l);let u=t.fieldRoles?.order,g=u&&(u in r||u==="label")?{by:u,direction:"asc"}:void 0;return{kind:e,sorts:a,filters:d,groups:f,...g?{natural:g}:{}}}function vn(n,e){let t=[];for(let r of e.filters){let a=r.about==="edge"&&r.far?.length===1?n.tryDefinition(r.far[0]):void 0;if(!(!a||a.kind===e.kind))for(let[d,f]of Object.entries(a.fields.shape??{}))de(f)!=="choice"||a.display?.hide?.includes(d)||t.push({key:`${r.key}.${d}`,label:`${r.label} \xB7 ${se(a,d)}`,about:"via",type:"choice",options:Le(f),far:[a.kind]})}if(t.length===0)return e;let o=e.filters.filter(r=>r.about!=="is");return{...e,filters:[...o,...t,...e.filters.filter(r=>r.about==="is")]}}function On(n,e){let t=n.tryDefinition(e.kind),o=Object.entries(t?.computed??{});if(!t||o.length===0)return e;let r=o.filter(([a])=>!e.sorts.some(d=>d.key===a)).map(([a,d])=>({key:a,label:(typeof d=="object"?d.label:void 0)??se(t,a),about:"field",type:"number"}));return{...e,sorts:[...e.sorts,...r]}}function Le(n){let e=ae(n);return e.type==="choice"?e.options:[]}var Ie=n=>n,Pe=n=>n;function en(n,e,t){let o=new Map;for(let r of[...n.out(e,t),...n.in(e,t)])o.set(r.id,r);return[...o.values()]}function le(n,e,t){let o=n.schema.tryDefinition(e.kind);if(t.key==="is")switch(t.value){case"current":return _(o,Pe(e),n.today);case"past":return!_(o,Pe(e),n.today);case"any":return!0;case"flagged":return n.flagged?.has(e.id)??!1;case"clear":return!(n.flagged?.has(e.id)??!1);default:return!0}let r=o?.fields.shape??{};if(t.key in r){let l=Se(Ie(e),t.key,n.today??ke()),u=de(r[t.key]);if(u==="date"){let[g,y]=t.value.split(":");if(typeof l!="string"||!y)return!1;let x=l.slice(0,10);return g==="before"?x<y:g==="after"?x>y:x===y}if(u==="boolean")return String(l)===t.value;if(u==="number"){let g=t.value.lastIndexOf(":"),y=g>0?t.value.slice(0,g):"",x=Number(t.value.slice(g+1));if(y==="at-most"||y==="at-least")return typeof l!="number"||!Number.isFinite(x)?!1:y==="at-most"?l<=x:l>=x}return String(l)===t.value}let[a,d]=t.key.split("."),f=en(n.graph,e.id,a);return d?f.some(l=>String(Ie(l)[d])===t.value):t.value==="*"?f.length>0:t.value==="none"?f.length===0:f.some(l=>l.id===t.value)}var nn=5;function ze(n){return n.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function ce(n){return ze(n).replace(/ /g,"")}var U=new Map,tn=5e4;function $(n){let e=U.get(n);if(e===void 0){U.size>=tn&&U.clear();let t=ze(n);e={tokens:t.split(" ").filter(Boolean),whole:t.replace(/ /g,"")},U.set(n,e)}return e}var T=n=>[...$(n).tokens];function j(n,e){if(e.length===0)return;let{whole:t,tokens:o}=$(n),r=e.join("");if(t.length===0)return;if(t===r)return"exact";if(e.every(d=>o.some(f=>f.startsWith(d))))return t.startsWith(r)?"prefix":e.every(d=>o.includes(d))?"word":"part"}function q(n,e,t=48){let o=n.replace(/\s+/g," ").trim();if(o.length<=t)return o;let r=e[0],a=o.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase(),d=r?a.search(new RegExp(`(^|[^\\p{L}\\p{N}])${rn(r)}`,"u")):-1,f=d<0?0:d+(a[d]&&/[\p{L}\p{N}]/u.test(a[d])?0:1),l=Math.max(0,f-Math.floor(t/3));if(l>0){let g=o.lastIndexOf(" ",l);l=g<0?0:g+1}let u=Math.min(o.length,l+t);if(u<o.length){let g=o.indexOf(" ",u);u=g<0||g-u>16?u:g}return`${l>0?"\u2026":""}${o.slice(l,u).trim()}${u<o.length?"\u2026":""}`}var rn=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),on=/^([\p{L}][\p{L}\p{N}_-]*):(\S+)$/u;function an(n){let e=[],t=[];for(let o of n.trim().split(/\s+/).filter(Boolean)){let r=on.exec(o);r?t.push({key:r[1],value:r[2]}):e.push(o)}return{words:e.join(" "),conditions:t}}var Ee=new WeakMap;function Q(n,e){let t=Ee.get(e);if(t&&t.definition===n)return t.texts;let o=sn(n,e);return Ee.set(e,{definition:n,texts:o}),o}function sn(n,e){let t=z(n,e),o=[{field:"label",reading:"Name",text:t}];for(let r of $e(e,n,{limit:Number.POSITIVE_INFINITY}))r.key==="label"||r.value===t||typeof e[r.key]!="boolean"&&o.push({field:r.key,reading:r.label,text:r.markdown?Te(r.value):r.value});return o}var I={exact:0,prefix:1,word:2,part:3,field:4,near:5},Ge=new Set(["a","an","the","of","and","or","for","to","in","on","at","by","with","my","our","is"]);function Ke(n){let e=n;e.length>4&&e.endsWith("ies")?e=`${e.slice(0,-3)}y`:e.length>4&&/(ss|x|ch|sh|z)es$/.test(e)?e=e.slice(0,-2):e.length>3&&e.endsWith("s")&&!/(ss|us|is)$/.test(e)&&(e=e.slice(0,-1));for(let t of["ing","ed"])if(e.length>t.length+2&&e.endsWith(t)){e=e.slice(0,-t.length),/([b-df-hj-km-np-rtv-z])\1$/.test(e)&&(e=e.slice(0,-1));break}return e.length>3&&e.endsWith("e")?e.slice(0,-1):e}function He(n,e,t){if(Math.abs(n.length-e.length)>t)return t+1;let o=[],r=Array.from({length:e.length+1},(a,d)=>d);for(let a=1;a<=n.length;a++){let d=[a],f=a;for(let l=1;l<=e.length;l++){let u=Math.min(r[l]+1,d[l-1]+1,r[l-1]+(n[a-1]===e[l-1]?0:1));a>1&&l>1&&n[a-1]===e[l-2]&&n[a-2]===e[l-1]&&(u=Math.min(u,o[l-2]+1)),d[l]=u,u<f&&(f=u)}if(f>t)return t+1;o=r,r=d}return r[e.length]}var V=new Map;function dn(n,e){let t=V.get(n);t||(V.size>=64&&V.clear(),V.set(n,t=new Map));let o=t.get(e);return o===void 0&&(o=ln(n,e)??null,t.set(e,o)),o??void 0}function ln(n,e){if(/\d/.test(n))return;let t=Ke(n);if(t.length>=3&&(Ke(e)===t||t.length>=4&&e.startsWith(t)))return"stem";let o=n.length<4?0:n.length<=7?1:2;if(o!==0){if(He(n,e,o)<=o)return"spelling";if(n.length>=5){for(let r=n.length-o;r<=n.length+o;r++)if(r<e.length&&He(n,e.slice(0,r),o)<=o)return"spelling"}}}function cn(n,e){let t=e.length>1?e.filter(r=>!Ge.has(r)):e;if(t.length===0)return;let o;for(let r of t){let a;for(let d of n){for(let f of $(d.text).tokens){if(f.startsWith(r)){a={text:d,matched:f};break}let l=a?void 0:dn(r,f);l&&(a={text:d,matched:f,by:l})}if(a&&!a.by)break}if(!a)return;a.by&&!o&&(o={text:a.text,asked:r,matched:a.matched,by:a.by})}if(o)return{field:o.text.field,reading:o.text.reading,fragment:q(o.text.text,[o.matched]),strength:"near",asked:o.asked,matched:o.matched,by:o.by}}var fn=80;function gn(n,e,t){let o=T(e).filter(d=>!Ge.has(d)).join(" ")||e,r=t===void 0?[]:T(t),a=r.length>0&&n.find(d=>r.every(f=>$(d.text).tokens.some(l=>l.startsWith(f))))||n[0];return{field:a.field,reading:a.reading,fragment:q(a.text,r),strength:"near",asked:o,matched:(t??a.text).slice(0,fn),by:"meaning"}}function _e(n,e,t,o){let r=T(t);if(r.length===0)return;if(o){let p=Q(n,e),O=o.includes("label")||o.some(v=>typeof e[v]=="string"&&e[v]===p[0].text),w=p.filter((v,D)=>D===0?O:o.includes(v.field)),N=v=>D=>$(D.text).tokens.some(P=>P.startsWith(v));if(!r.every(v=>w.some(N(v))))return;let S=w.find(N(r[0]));return{field:S.field,reading:S.reading,fragment:q(S.text,r),strength:S.field==="label"?j(S.text,r)??"field":"field"}}let a=Q(n,e),[d,...f]=a,l=j(d.text,r);if(l)return{field:"label",reading:d.reading,fragment:q(d.text,r),strength:l};let u=p=>O=>$(O.text).tokens.some(w=>w.startsWith(p));if(!r.every(p=>a.some(u(p))))return;let g=T(d.text),y=r.find(p=>!g.some(O=>O.startsWith(p)))??r[0],x=f.find(u(y));return{field:x.field,reading:x.reading,fragment:q(x.text,[y]),strength:"field"}}var un=512,yn=64;function hn(n){let e=new Map;if(n.length===0)return e;let t=n.slice(-un),o=n[n.length-1].seq;for(let r of t){let a=Math.pow(.5,(o-r.seq)/yn);for(let d of r.writes)e.set(d,(e.get(d)??0)+a)}return e}var ge=(n,e)=>we({tryDefinition:()=>n},e),fe=(n,e)=>De({tryDefinition:()=>n},e);function pn(n,e,t){let o=n.tryDefinition(e),r=[{field:"plural",text:ge(o,e)},{field:"kind",text:W(e)},...o?.noun?[{field:"noun",text:o.noun}]:[]],a;for(let d of r){let f=j(d.text,t);f&&(!a||I[f]<I[a.strength])&&(a={strength:f,...d})}return a}var mn,bn=(n,e)=>(mn??=new Intl.Collator(void 0,{sensitivity:"base",numeric:!0})).compare(n,e),qe=(n,e)=>(n.nearly??0)-(e.nearly??0)||(n.archived??0)-(e.archived??0)||n.tier-e.tier||n.inKind-e.inKind||n.near-e.near||n.past-e.past||n.touched-e.touched||n.flagged-e.flagged||bn(n.name,e.name)||(n.id<e.id?-1:n.id>e.id?1:0);function Ln(n,e,t={}){let o=n.schema,r=an(e),a=T(r.words),d=t.principal??{kind:"human"},f=n.kindsKeptFrom(d),l=n.modules.disabledKinds,u=r.conditions.filter(i=>i.key==="kind").map(i=>i.value),g=r.conditions.filter(i=>i.key==="is").map(i=>i.value),y=g.includes("any")||g.includes("past"),x=g.includes("past")&&!g.includes("any")&&!g.includes("current"),p=g.includes("archived")?!0:t.archived??"all",O=(i,s)=>{let c=ce(s),h=o.tryDefinition(i);return ce(i)===c||ce(ge(h,i))===c},w=o.kinds.filter(i=>!f.has(i)&&!l.has(i)&&(t.kinds===void 0||t.kinds.includes(i))&&(u.length===0||u.some(s=>O(i,s)))),S=r.conditions.filter(i=>i.key!=="kind").map(i=>({...i,admittedBy:w.filter(s=>Be(o,s).filters.some(c=>c.key===i.key))})),v=S.filter(i=>i.key!=="is"),D=g.filter(i=>i==="flagged"||i==="clear"||i==="past"||i==="archived"),P={kinds:w,past:y},Qe={hits:[],words:r.words,conditions:S,searched:P,byKind:{},total:0,matched:[]};if(a.length===0&&v.length===0&&D.length===0)return Qe;let X=t.today,F=t.flagged??new Set(n.violations().flatMap(i=>i.nodeIds)),Ue=t.touched??hn(n.log.all()),Y=new Set;for(let i of t.from??[]){Y.add(i);for(let s of n.graph.neighbors(i))Y.add(s.id)}let ue=ve(n,d)?Oe(n,d):void 0,J=oe.keptFrom?.(n,d)&&n.seenBy(d).graph,Z=i=>je(i,t.basePath===void 0?{}:{basePath:t.basePath}),ye={schema:o,graph:n.graph,flagged:F,...X?{today:X}:{}},R=[],B={},L=[],E=[],K=(i,s,c,h,m,b)=>{let A=z(c,i);B[s]=(B[s]??0)+1,R.push({hit:{about:"node",id:i.id,kind:s,label:A,why:m,current:h,flagged:F.has(i.id),address:Z(`${fe(c,s)}/${encodeURIComponent(i.id)}`),...b===void 0?{}:{near:!0},...G(i)?{archived:!0}:{}},...b===void 0?{}:{nearly:2-b},tier:I[m.strength],inKind:s===t.inKind?0:1,near:Y.has(i.id)?0:1,past:h?0:1,archived:G(i)?1:0,touched:-(Ue.get(i.id)??0),flagged:F.has(i.id)?0:1,name:A,id:i.id})};for(let i of w){let s=o.tryDefinition(i),c=S.filter(m=>m.key!=="is"&&m.admittedBy.includes(i));if(a.length===0&&c.length===0&&D.length===0)continue;let h=Fe(s,c);for(let m of n.graph.nodesOfKind(i,{archived:p})){if(ue&&!ue(m.id))continue;let b=J?J.getNode(m.id):m;if(!b)continue;let A=_(s,b,X);if(!y&&!h&&!A){if(a.length>0&&g.length===0&&c.every(k=>le(ye,b,k))){let k=_e(s,b,r.words);k&&E.push({node:b,kind:i,definition:s,why:k})}continue}if(x&&A||!c.every(k=>le(ye,b,k))||g.includes("flagged")&&!F.has(b.id)||g.includes("clear")&&F.has(b.id))continue;let C=a.length>0?_e(s,b,r.words):c[0]?{field:c[0].key,reading:W(c[0].key),fragment:`${c[0].key}:${c[0].value}`,strength:"field"}:{field:"is",reading:"Is",fragment:`is:${D[0]}`,strength:"field"};C?K(b,i,s,A,C):a.length>0&&L.push({node:b,kind:i,definition:s,current:A})}}let ee=i=>i.strength!=="field",ne=!1;if(E.length>0&&R.length===0){ne=!0;for(let i of E)K(i.node,i.kind,i.definition,!1,i.why)}else if(E.some(i=>ee(i.why))&&!R.some(i=>ee(i.hit.why))){ne=!0;for(let i of E)ee(i.why)&&K(i.node,i.kind,i.definition,!1,i.why)}let he=t.near!==!1&&a.length>0&&R.length<nn&&L.length>0,te=new Set;if(he)for(let i of L){let s=cn(Q(i.definition,i.node),a);s&&(te.add(i.node.id),K(i.node,i.kind,i.definition,i.current,s,s.by==="stem"?.9:.8))}let Ve=i=>i==="exact"||i==="prefix"?-1:I[i],re=(i,s,c,h)=>({hit:i,tier:Ve(s),inKind:1,near:1,past:0,touched:0,flagged:1,name:c,id:h});if(a.length>0){for(let s of w){let c=pn(o,s,a);if(!c)continue;let h=Ne(o,s),m={field:c.field,reading:c.field==="plural"?"Plural":"Kind",fragment:c.text,strength:c.strength};R.push(re({about:"kind",kind:s,label:h,why:m,count:B[s]??0,address:Z(fe(o.tryDefinition(s),s))},c.strength,h,`kind:${s}`))}let i=t.places??[];for(let s of Re(i.filter(c=>w.includes(c.kind)))){if(s.across&&f.has(s.across))continue;let c=j(s.title,a);if(!c)continue;let h={field:"title",reading:"Title",fragment:s.title,strength:c},m=Me(s,i)?fe(o.tryDefinition(s.kind),s.kind).slice(1):void 0,b=Z(We(s.as,m));R.push(re({about:"place",kind:s.kind,title:s.title,as:s.as,why:h,address:b},c,s.title,`place:${s.kind}:${s.as}`))}for(let s of n.allInvariants()){let c=s.scope==="graph"?void 0:s.scope.kind;if(c&&!w.includes(c))continue;let h=s.label??W(s.name),m=j(h,a),b=m?void 0:j(W(s.name),a),A=m??b;if(!A)continue;let C={field:m?"label":"name",reading:m?"Rule":"Name",fragment:m?h:s.name,strength:A};R.push(re({about:"rule",name:s.name,label:h,...c?{kind:c}:{},why:C},A,h,`rule:${s.name}`))}}let pe=()=>{R.sort(qe);let i=t.limit??50,s=R.slice(0,i).map(k=>k.hit),c=s.flatMap(k=>k.about==="node"?[(J||n.graph).getNode(k.id)]:[]).filter(Boolean),h=Ce(c,k=>o.tryDefinition(k)),m=s.map(k=>k.about==="node"&&h.has(k.id)?{...k,apart:h.get(k.id)}:k),b=Object.values(B).reduce((k,Ye)=>k+Ye,0),A=R.flatMap(k=>k.hit.about==="node"?[k.hit.id]:[]),C=t.subject&&w.includes(String(n.graph.getNode(t.subject)?.kind))?kn(n,t.subject,r.words,{principal:d}):[];return{hits:[...m,...C],words:r.words,conditions:S,searched:ne?{...P,past:!0}:P,byKind:{...B},total:b,matched:A}},H=pe(),me=t.rank;if(!he||!me)return H;let be=L.filter(i=>!te.has(i.node.id)).map(({node:i,kind:s,definition:c})=>({id:i.id,kind:s,label:z(c,i),texts:Q(c,i)}));if(be.length===0)return H;let Xe=(async()=>{let i;try{i=await me(r.words,be)}catch{return H}let s=new Map(L.filter(h=>!te.has(h.node.id)).map(h=>[h.node.id,h])),c=!1;for(let{id:h,score:m,matched:b}of Array.isArray(i)?i:[]){let A=s.get(h);!A||!(m>0)||(s.delete(h),c=!0,K(A.node,A.kind,A.definition,A.current,gn(Q(A.definition,A.node),r.words,typeof b=="string"?b:void 0),Math.min(1,m)))}return c?pe():H})();return{...H,later:Xe}}function kn(n,e,t,o={}){let r=o.principal??{kind:"human"},a=(oe.keptFrom?.(n,r)?n.seenBy(r):n).graph.getNode(e);if(!a)return[];if(n.kindsKeptFrom(r).has(a.kind))return[];let d=T(t),f=z(n.schema.tryDefinition(a.kind),a),l=[];for(let g of n.allMutations()){let y=g.subject;if(!y||y.kinds!=="*"&&!y.kinds.includes(a.kind))continue;let x=g.derived?.act;if((x==="archive"||x==="merge")&&G(a)||x==="unarchive"&&!G(a)||x==="leave-alone"&&ie(a)||x==="allow-tidying"&&!ie(a)||!n.permits({name:g.name,args:{[y.arg]:a.id}},r).ok)continue;let p=Ae(g),O=T(p),w=d.filter(v=>O.some(D=>D.startsWith(v))),N=w.length>0?j(p,w):void 0,S=N?{field:"title",reading:"Act",fragment:p,strength:N}:{field:"subject",reading:"On",fragment:f,strength:"field"};l.push({hit:{about:"act",name:g.name,title:p,subject:a.id,why:S,destructive:g.destructive===!0},tier:N?I[N]:I.field+1,inKind:0,near:0,past:g.destructive?1:0,touched:0,flagged:g.pinned?0:1,name:p,id:`act:${g.name}`})}l.sort(qe);let u=l.map(g=>g.hit);return o.limit===void 0?u:u.slice(0,o.limit)}function En(n,e){let t=e.kinds.map((a,d)=>{let f=ge(n.tryDefinition(a),a);return d===0?f:f.toLowerCase()}),o=xe(t)||"Nothing";return e.kinds.some(a=>n.tryDefinition(a)?.lifecycle)?e.past?`${M(o)}, past ones included.`:`${M(o)}, current ones; add is:any for past ones.`:`${M(o)}.`}export{se as a,de as b,Je as c,Fe as d,Be as e,vn as f,On as g,Le as h,Ie as i,Pe as j,en as k,le as l,ce as m,an as n,_e as o,hn as p,Ln as q,kn as r,En as s};
@@ -0,0 +1 @@
1
+ import"./chunk.GZHZLJBF.js";import{n as D}from"./chunk.HHUCPVG5.js";import"./chunk.OJGHDWI6.js";import"./chunk.WXYUWBKX.js";import"./chunk.NSNGPQGT.js";import{a as $}from"./chunk.H5CZZZLX.js";import"./chunk.Z7JRBKA7.js";import"./chunk.ORXFUK6F.js";import{G as P,R as C}from"./chunk.BTSXYZ6Z.js";import"./chunk.SDO3U72B.js";import{Ka as w,Ma as R,Qa as c,X as S}from"./chunk.5ZMENPY4.js";import{b as k}from"./chunk.AJZBJBMO.js";var m=k(P(),1);var e=k(C(),1),W=[["","Does not repeat"],["day","Daily"],["week","Weekly"],["month","Monthly"],["year","Yearly"]],E=r=>`${r}${r%100>=11&&r%100<=13?"th":["th","st","nd","rd"][r%10]??"th"}`,v={display:"flex",flexWrap:"wrap",gap:"6px 12px",alignItems:"center"};function N({value:r,onChange:d,start:p,label:s,name:l="repeat"}){let f=(0,m.useId)(),a=c(r)?r:void 0,i=typeof p=="string"&&/^\d{4}-\d{2}-\d{2}/.test(p)?p:void 0,u=i?w[new Date(`${i.slice(0,10)}T00:00:00Z`).getUTCDay()]:void 0,o=t=>{let n={...a??{every:"week"},...t};for(let b of Object.keys(n))n[b]===void 0&&delete n[b];d(n)},y=a?.every??"week",g=a?.on??(u?[u]:[]);return(0,e.jsxs)("fieldset",{"data-graview-part":"field","data-graview-field":"repeat","data-graview-repeat":l,style:{display:"grid",gap:8,border:"1px solid var(--graview-edge)",borderRadius:8,padding:"8px 12px",margin:0,minWidth:0},children:[(0,e.jsx)("legend",{"data-graview-part":"label",style:{padding:"0 4px"},children:s}),(0,e.jsxs)("div",{style:v,children:[(0,e.jsx)("label",{htmlFor:`${f}-every`,children:"Repeats"}),(0,e.jsx)("select",{id:`${f}-every`,name:`${l}.every`,value:a?.every??"",onChange:t=>{let n=t.target.value;d(n===""?void 0:{...a?.interval?{interval:a.interval}:{},...a?.until?{until:a.until}:{},every:n})},"data-graview-part":"control",children:W.map(([t,n])=>(0,e.jsx)("option",{value:t,children:n},t))}),a?(0,e.jsxs)("label",{style:v,children:["every",(0,e.jsx)("input",{type:"number",min:1,max:99,name:`${l}.interval`,"aria-label":`Every how many ${y}s`,value:a.interval??1,onChange:t=>o({interval:Number(t.target.value)>1?Math.min(99,Math.round(Number(t.target.value))):void 0}),style:{width:"4.5em"},"data-graview-part":"control"}),y,(a.interval??1)>1?"s":""]}):null]}),a?.every==="week"?(0,e.jsxs)("div",{role:"group","aria-label":"On",style:v,children:[(0,e.jsx)("span",{"aria-hidden":"true",children:"On"}),w.map((t,n)=>(0,e.jsxs)("label",{style:{display:"inline-flex",gap:4,alignItems:"center",minHeight:24},children:[(0,e.jsx)("input",{type:"checkbox",name:`${l}.on`,value:t,checked:g.includes(t),onChange:b=>{let h=w.filter(x=>x===t?b.target.checked:g.includes(x));o({on:h.length===0||h.length===1&&h[0]===u?void 0:h})}}),S(n,"short")]},t))]}):null,a?.every==="month"?(0,e.jsxs)("label",{style:v,children:["On",(0,e.jsxs)("select",{name:`${l}.on`,value:a.on?.[0]===-1?"last":"",onChange:t=>o({on:t.target.value==="last"?[-1]:void 0}),"data-graview-part":"control",children:[(0,e.jsx)("option",{value:"",children:i?`the ${E(Number(i.slice(8,10)))}`:"the same day"}),(0,e.jsx)("option",{value:"last",children:"the last day"})]})]}):null,a?(0,e.jsxs)("label",{style:v,children:["Until",(0,e.jsx)("input",{type:"date",name:`${l}.until`,value:a.until??"",onChange:t=>o({until:t.target.value||void 0}),"data-graview-part":"control"})]}):null,(0,e.jsx)("p",{"aria-live":"polite","data-graview-repeat-said":"",style:{margin:0,color:"var(--graview-ink-dim)",fontSize:"0.8125rem"},children:a?$(i??"",a):"Does not repeat"})]})}function M({nodeId:r,field:d,start:p,value:s,label:l}){let{fields:f,commit:a}=D(r),i=f.find(t=>t.field===R(d)&&t.takesValue&&t.open.length===0),[u,o]=(0,m.useState)(!1),[y,g]=(0,m.useState)(c(s)?s:void 0);return i?u?(0,e.jsxs)("form",{onSubmit:t=>{t.preventDefault(),o(!1),a(i,y??null)},style:{display:"grid",gap:6,marginTop:6},children:[(0,e.jsx)(N,{value:y,onChange:g,start:p,label:l,name:R(d)}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,e.jsx)("button",{type:"submit","data-graview-repeat-keep":d,children:"Keep"}),(0,e.jsx)("button",{type:"button",onClick:()=>o(!1),children:"Cancel"})]})]}):(0,e.jsx)("button",{type:"button","data-graview-repeat-open":d,onClick:()=>(g(c(s)?s:void 0),o(!0)),style:{marginInlineStart:8,fontSize:"0.75rem",padding:"1px 8px",borderRadius:999,minHeight:24},children:c(s)?"Change how it repeats":"Repeat\u2026"}):null}export{M as RepeatEditor,N as RepeatPicker};
@@ -0,0 +1 @@
1
+ import{a as b,b as c,c as d,d as e,e as f}from"./chunk.WQPNGBR7.js";import"./chunk.DYNBWIPF.js";import"./chunk.UCZR33MK.js";import"./chunk.2IX3CZNP.js";import"./chunk.6DHHUBSC.js";import{sb as a}from"./chunk.5ZMENPY4.js";import"./chunk.AJZBJBMO.js";export{a as ActRefusal,e as compileDocumentWithoutCheck,d as effectsOf,f as inDocumentWords,c as kindShapes,b as readDocument};
@@ -0,0 +1 @@
1
+ import{b as a,c as b,d as c,e as d,f as e,g as f,h as g}from"./chunk.M5QFUGGG.js";import"./chunk.PXQVXBNG.js";import"./chunk.5ZMENPY4.js";import"./chunk.AJZBJBMO.js";export{g as createLinks,f as judgeDestination,e as listsOf,c as nowhere,a as placesSaid,b as quoted,d as whereOfWords};
@@ -1 +1 @@
1
- import{$c as f,Oc as y,Qc as d,Sc as u,Tc as k,dd as w,ed as $,fd as v,ga as g,hd as b,id as S}from"./chunk.WLPTY4BF.js";function A(s){let i=[];for(let n of f(s).drawn)for(let t of n.kinds)i.push({kind:t,title:n.title,as:n.as,...n.across?{across:n.across}:{},...n.kinds.length>1?{over:n.kinds}:{},...n.hidden?{hidden:!0}:{}});for(let n of s.views?.places?.()??[])i.some(t=>t.kind===n.kind&&t.as===n.as)||i.push(n);return i}function F(s){return L(s.schema,A(s),{...s.pages?{pages:s.pages}:{},lenses:f(s).drawn,home:(s.home?.length??0)>0})}function L(s,i,n={}){let{pages:t}=n,l=s.kinds,h=i.filter(e=>l.includes(e.kind)),a=S(t?.first,s,h),P=new Set(t?.hide??[]),c=b(l,t?.order),p=[{slug:"home",title:"Home",kind:null,cardinality:"many",address:"/",stop:"#",...a?.to==="home"||a===void 0&&n.home?{first:!0}:{}},{slug:w,title:v(t),kind:null,cardinality:"many",address:$,stop:"#"}],x=y([...h].sort((e,o)=>c.indexOf(e.kind)-c.indexOf(o.kind)));for(let e of x){let o=n.lenses?.find(r=>r.as===e.as&&r.kinds.includes(e.kind)),m=k(e,h);p.push({slug:e.as,title:e.title,kind:e.kind,...e.over?{over:e.over.filter(r=>l.includes(r))}:{},cardinality:"many",address:u(e.as,m?d(s,e.kind).slice(1):void 0),stop:m?`#focus=aggregate:${e.kind}&in.view=${encodeURIComponent(e.as)}`:`#view=${encodeURIComponent(e.as)}`,...o?{lens:o.lens}:{},...e.hidden?{hidden:!0}:{},...a?.to==="place"&&a.place.as===e.as&&(a.place.kind===e.kind||e.over?.includes(a.place.kind))?{first:!0}:{}})}for(let e of c)p.push({slug:d(s,e).slice(1),title:g(s,e),kind:e,cardinality:"many",address:d(s,e),stop:`#focus=aggregate:${e}`,...P.has(e)?{hidden:!0}:{},...a?.to==="kind"&&a.kind===e?{first:!0}:{}});return p}export{F as a,L as b};
1
+ import{Rc as y,Tc as d,Vc as u,Wc as k,cd as f,ga as g,gd as w,hd as $,id as v,kd as b,ld as S}from"./chunk.5ZMENPY4.js";function A(s){let i=[];for(let n of f(s).drawn)for(let t of n.kinds)i.push({kind:t,title:n.title,as:n.as,...n.across?{across:n.across}:{},...n.kinds.length>1?{over:n.kinds}:{},...n.hidden?{hidden:!0}:{}});for(let n of s.views?.places?.()??[])i.some(t=>t.kind===n.kind&&t.as===n.as)||i.push(n);return i}function F(s){return L(s.schema,A(s),{...s.pages?{pages:s.pages}:{},lenses:f(s).drawn,home:(s.home?.length??0)>0})}function L(s,i,n={}){let{pages:t}=n,l=s.kinds,h=i.filter(e=>l.includes(e.kind)),a=S(t?.first,s,h),P=new Set(t?.hide??[]),c=b(l,t?.order),p=[{slug:"home",title:"Home",kind:null,cardinality:"many",address:"/",stop:"#",...a?.to==="home"||a===void 0&&n.home?{first:!0}:{}},{slug:w,title:v(t),kind:null,cardinality:"many",address:$,stop:"#"}],x=y([...h].sort((e,o)=>c.indexOf(e.kind)-c.indexOf(o.kind)));for(let e of x){let o=n.lenses?.find(r=>r.as===e.as&&r.kinds.includes(e.kind)),m=k(e,h);p.push({slug:e.as,title:e.title,kind:e.kind,...e.over?{over:e.over.filter(r=>l.includes(r))}:{},cardinality:"many",address:u(e.as,m?d(s,e.kind).slice(1):void 0),stop:m?`#focus=aggregate:${e.kind}&in.view=${encodeURIComponent(e.as)}`:`#view=${encodeURIComponent(e.as)}`,...o?{lens:o.lens}:{},...e.hidden?{hidden:!0}:{},...a?.to==="place"&&a.place.as===e.as&&(a.place.kind===e.kind||e.over?.includes(a.place.kind))?{first:!0}:{}})}for(let e of c)p.push({slug:d(s,e).slice(1),title:g(s,e),kind:e,cardinality:"many",address:d(s,e),stop:`#focus=aggregate:${e}`,...P.has(e)?{hidden:!0}:{},...a?.to==="kind"&&a.kind===e?{first:!0}:{}});return p}export{F as a,L as b};
@@ -1 +1 @@
1
- import{ib as k,mb as O,nb as P,pb as h,qb as j,uc as E,vc as G,wc as F,yc as J,zc as W}from"./chunk.WLPTY4BF.js";var I=(o,a)=>{let t=o.kindOf(a);return t===void 0?void 0:o.kept?.({id:a,kind:t})};function w(o,a){return o.flatMap(t=>{if(t.op!=="patch-node")return[t];let i=I(a,t.id);if(!i||!Object.keys(t.after).some(i))return[t];let c=r=>Object.fromEntries(Object.entries(r).filter(([f])=>!i(f))),s=c(t.after);return Object.keys(s).length===0?[]:[{op:"patch-node",id:t.id,before:c(t.before),after:s}]})}function _(o,a,t){if(!F(o,a))return t;let i=J(o,a),c=r=>o.graph.getNode(r)!==void 0||E(o.log).kindOf(r)!==void 0,s={...t};if(t.diff){let r=t.diff,f=G(o.log),l=o.log.length??o.log.all().length,u=t.ops?.[0]?.seq??l,x=k(a).id,y=(e,n)=>d=>f.writerAt(e,d,n),m=(e,n)=>i.shows(e.id)?i.servedWith(e,n):void 0,b=(e,n)=>e.flatMap(d=>m(d,n(d.id))??[]),S=e=>i.shows(e.from)&&i.shows(e.to)&&!h(e,i.sees),v=(e,n)=>t.ops?y(e,l):d=>n===void 0||n.includes(d)?x:f.writerAt(e,d,l),M=r.changedNodes.flatMap(e=>{let n=m(e.before,y(e.before.id,u)),d=m(e.after,v(e.after.id,e.fields));return n&&d?[{before:n,after:d,fields:e.fields.filter(p=>p in n||p in d)}]:[]}),D=new Set(r.changedNodes.map(e=>e.after.id)),g=new Map;for(let e of t.ops?.flatMap(n=>n.primitives)??t.primitives??[])e.op!=="patch-node"||D.has(e.id)||g.set(e.id,[...g.get(e.id)??[],...Object.keys(e.after)]);let B=[...g].flatMap(([e,n])=>{let d=o.graph.getNode(e);if(!d)return[];let p=m(d,y(e,u)),N=m(d,v(e,n));return p&&N&&JSON.stringify(p)!==JSON.stringify(N)?[{before:p,after:N,fields:n}]:[]});s.diff={addedNodes:b(r.addedNodes,e=>v(e)),removedNodes:b(r.removedNodes,e=>y(e,u)),changedNodes:[...M,...B],addedEdges:r.addedEdges.filter(S),removedEdges:r.removedEdges.filter(S),touched:[...r.touched.filter(i.shows),...[...g.keys()].filter(e=>i.shows(e)&&!r.touched.includes(e))]}}if(t.ops&&(s.ops=j(t.ops,i)),t.primitives){let r=s.ops;s.primitives=r?r.flatMap(f=>f.primitives):i.timeline?O(t.primitives,i.timeline,{served:(f,l)=>i.servedWith(f,l),edgeClean:f=>!h(f,i.sees),sees:i.sees},k(a).id):j([{id:"",seq:0,batch:"",author:{kind:"system"},intent:"",mutation:null,primitives:t.primitives,inverse:[],reads:[],writes:[],at:""}],i)[0].primitives}return i.kept&&s.primitives&&(s.primitives=w(s.primitives,i)),t.reads&&(s.reads=t.reads.filter(r=>i.shows(r)&&c(r))),t.writes&&(s.writes=t.writes.filter(i.shows)),t.intent!==void 0&&h(t.intent,i.sees)&&(s.intent=P),t.violationsAfter&&Object.assign(s,A?A(o,W(o,a),!!t.ops,s.primitives??[]):{introduces:[],resolves:[],violationsAfter:[]}),s}var A,z=o=>void(A=o);export{_ as a,z as b};
1
+ import{Bc as J,Cc as W,ib as k,mb as O,nb as P,pb as h,qb as j,xc as E,yc as G,zc as F}from"./chunk.5ZMENPY4.js";var I=(o,a)=>{let t=o.kindOf(a);return t===void 0?void 0:o.kept?.({id:a,kind:t})};function w(o,a){return o.flatMap(t=>{if(t.op!=="patch-node")return[t];let i=I(a,t.id);if(!i||!Object.keys(t.after).some(i))return[t];let c=r=>Object.fromEntries(Object.entries(r).filter(([f])=>!i(f))),s=c(t.after);return Object.keys(s).length===0?[]:[{op:"patch-node",id:t.id,before:c(t.before),after:s}]})}function _(o,a,t){if(!F(o,a))return t;let i=J(o,a),c=r=>o.graph.getNode(r)!==void 0||E(o.log).kindOf(r)!==void 0,s={...t};if(t.diff){let r=t.diff,f=G(o.log),l=o.log.length??o.log.all().length,u=t.ops?.[0]?.seq??l,x=k(a).id,y=(e,n)=>d=>f.writerAt(e,d,n),m=(e,n)=>i.shows(e.id)?i.servedWith(e,n):void 0,b=(e,n)=>e.flatMap(d=>m(d,n(d.id))??[]),S=e=>i.shows(e.from)&&i.shows(e.to)&&!h(e,i.sees),v=(e,n)=>t.ops?y(e,l):d=>n===void 0||n.includes(d)?x:f.writerAt(e,d,l),M=r.changedNodes.flatMap(e=>{let n=m(e.before,y(e.before.id,u)),d=m(e.after,v(e.after.id,e.fields));return n&&d?[{before:n,after:d,fields:e.fields.filter(p=>p in n||p in d)}]:[]}),D=new Set(r.changedNodes.map(e=>e.after.id)),g=new Map;for(let e of t.ops?.flatMap(n=>n.primitives)??t.primitives??[])e.op!=="patch-node"||D.has(e.id)||g.set(e.id,[...g.get(e.id)??[],...Object.keys(e.after)]);let B=[...g].flatMap(([e,n])=>{let d=o.graph.getNode(e);if(!d)return[];let p=m(d,y(e,u)),N=m(d,v(e,n));return p&&N&&JSON.stringify(p)!==JSON.stringify(N)?[{before:p,after:N,fields:n}]:[]});s.diff={addedNodes:b(r.addedNodes,e=>v(e)),removedNodes:b(r.removedNodes,e=>y(e,u)),changedNodes:[...M,...B],addedEdges:r.addedEdges.filter(S),removedEdges:r.removedEdges.filter(S),touched:[...r.touched.filter(i.shows),...[...g.keys()].filter(e=>i.shows(e)&&!r.touched.includes(e))]}}if(t.ops&&(s.ops=j(t.ops,i)),t.primitives){let r=s.ops;s.primitives=r?r.flatMap(f=>f.primitives):i.timeline?O(t.primitives,i.timeline,{served:(f,l)=>i.servedWith(f,l),edgeClean:f=>!h(f,i.sees),sees:i.sees},k(a).id):j([{id:"",seq:0,batch:"",author:{kind:"system"},intent:"",mutation:null,primitives:t.primitives,inverse:[],reads:[],writes:[],at:""}],i)[0].primitives}return i.kept&&s.primitives&&(s.primitives=w(s.primitives,i)),t.reads&&(s.reads=t.reads.filter(r=>i.shows(r)&&c(r))),t.writes&&(s.writes=t.writes.filter(i.shows)),t.intent!==void 0&&h(t.intent,i.sees)&&(s.intent=P),t.violationsAfter&&Object.assign(s,A?A(o,W(o,a),!!t.ops,s.primitives??[]):{introduces:[],resolves:[],violationsAfter:[]}),s}var A,z=o=>void(A=o);export{_ as a,z as b};
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e,f,g,h,i,j}from"./chunk.FILCNVGH.js";import"./chunk.B2IRADR2.js";import"./chunk.KJNUZYXS.js";import"./chunk.4BBJ62ZO.js";import"./chunk.UCZR33MK.js";import"./chunk.CC47O2DW.js";import"./chunk.2IX3CZNP.js";import"./chunk.6DHHUBSC.js";import"./chunk.H5CZZZLX.js";import"./chunk.Z7JRBKA7.js";import"./chunk.5ZMENPY4.js";import"./chunk.AJZBJBMO.js";export{g as columnActs,d as columnChoices,c as columnMoves,b as columnOf,e as columnReach,f as columnSteps,i as describePlace,j as placeText,h as resolveFor,a as statusColumns};
@@ -1 +1 @@
1
- import{s as a}from"./chunk.I3SQJ2L2.js";import{$ as l,H as f,S as s}from"./chunk.MQ7FNHXG.js";import{b as i}from"./chunk.AJZBJBMO.js";var d=i(f(),1),p=i(s(),1),c=new Set;function B(e){return c.add(e),()=>void c.delete(e)}function S(){let{store:e,principal:o}=l();return(0,d.useMemo)(()=>n=>{let t=n.on===void 0?void 0:e.graph.getNode(n.on);if(!t)return null;let u=[...c].filter(r=>r.store===e&&r.kind===t.kind);return(n.element?u.find(r=>r.root()?.contains(n.element)??!1):u[0])?.section(t.id,o)??null},[e,o])}function v({children:e}){let o=S(),n=(0,d.useMemo)(()=>[o],[o]);return(0,p.jsx)(a,{sections:n,children:e})}export{B as a,S as b,v as c};
1
+ import{s as a}from"./chunk.HHUCPVG5.js";import{G as f,R as s,_ as l}from"./chunk.BTSXYZ6Z.js";import{b as i}from"./chunk.AJZBJBMO.js";var d=i(f(),1),p=i(s(),1),c=new Set;function B(e){return c.add(e),()=>void c.delete(e)}function S(){let{store:e,principal:o}=l();return(0,d.useMemo)(()=>n=>{let t=n.on===void 0?void 0:e.graph.getNode(n.on);if(!t)return null;let u=[...c].filter(r=>r.store===e&&r.kind===t.kind);return(n.element?u.find(r=>r.root()?.contains(n.element)??!1):u[0])?.section(t.id,o)??null},[e,o])}function v({children:e}){let o=S(),n=(0,d.useMemo)(()=>[o],[o]);return(0,p.jsx)(a,{sections:n,children:e})}export{B as a,S as b,v as c};
@@ -0,0 +1 @@
1
+ import{a,b}from"./chunk.FCXBCKED.js";import"./chunk.FILCNVGH.js";import"./chunk.B2IRADR2.js";import"./chunk.J3M2MZHG.js";import"./chunk.UT6642FC.js";import"./chunk.KJNUZYXS.js";import"./chunk.4BBJ62ZO.js";import"./chunk.UCZR33MK.js";import"./chunk.CC47O2DW.js";import"./chunk.2IX3CZNP.js";import"./chunk.6DHHUBSC.js";import"./chunk.NSNGPQGT.js";import"./chunk.H5CZZZLX.js";import"./chunk.Z7JRBKA7.js";import"./chunk.5ZMENPY4.js";import"./chunk.AJZBJBMO.js";export{b as actOnSeveral,a as actsForSeveral};
@@ -0,0 +1 @@
1
+ import{j as a,k as o}from"./chunk.6HBEYRJU.js";import"./chunk.U7QMA4H7.js";import"./chunk.GP2F7TIN.js";import"./chunk.C6X7CKU6.js";import"./chunk.2GGDOFTF.js";import"./chunk.ZTMDU3OH.js";import"./chunk.HFDYFPMJ.js";import"./chunk.RWB4235L.js";import"./chunk.CTK2P4JV.js";import"./chunk.6XU2CXRZ.js";import"./chunk.3ZNQ5YKX.js";import"./chunk.7EFNLMKU.js";import"./chunk.WVUJXDXZ.js";import"./chunk.KJNUZYXS.js";import"./chunk.4BBJ62ZO.js";import"./chunk.UCZR33MK.js";import"./chunk.CC47O2DW.js";import"./chunk.2IX3CZNP.js";import"./chunk.6DHHUBSC.js";import"./chunk.GZHZLJBF.js";import"./chunk.HHUCPVG5.js";import"./chunk.OJGHDWI6.js";import"./chunk.WXYUWBKX.js";import"./chunk.NSNGPQGT.js";import"./chunk.H5CZZZLX.js";import"./chunk.Z7JRBKA7.js";import"./chunk.ORXFUK6F.js";import{ma as n}from"./chunk.BTSXYZ6Z.js";import"./chunk.SDO3U72B.js";import"./chunk.5ZMENPY4.js";import"./chunk.AJZBJBMO.js";var w=new WeakMap;function s(e,i){let t=w.get(e);t||w.set(e,t=new Map);let r=t.get(i);return r||t.set(i,r=a(o(e,n(e)),e,i)),r}export{s as frameworkViews};
@@ -0,0 +1,25 @@
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 Ke}from"./chunk.SDO3U72B.js";import{Da as Cn,Ec as Nn,Gc as jn,Ha as yt,I as In,Ja as _n,Jc as Gn,Ua as Ln,Yc as Wn,Zb as Hn,ld as Fn,qd as Fe,rd as mt,tc as Dn}from"./chunk.5ZMENPY4.js";import{a as We,b as C}from"./chunk.AJZBJBMO.js";var so=We(w=>{"use strict";var Et=Symbol.for("react.transitional.element"),Ar=Symbol.for("react.portal"),kr=Symbol.for("react.fragment"),Pr=Symbol.for("react.strict_mode"),Rr=Symbol.for("react.profiler"),Tr=Symbol.for("react.consumer"),Mr=Symbol.for("react.context"),Or=Symbol.for("react.forward_ref"),Vr=Symbol.for("react.suspense"),Ir=Symbol.for("react.memo"),to=Symbol.for("react.lazy"),Cr=Symbol.for("react.activity"),Xn=Symbol.iterator;function _r(e){return e===null||typeof e!="object"?null:(e=Xn&&e[Xn]||e["@@iterator"],typeof e=="function"?e:null)}var no={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},oo=Object.assign,ro={};function ge(e,t,n){this.props=e,this.context=t,this.refs=ro,this.updater=n||no}ge.prototype.isReactComponent={};ge.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ge.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function io(){}io.prototype=ge.prototype;function At(e,t,n){this.props=e,this.context=t,this.refs=ro,this.updater=n||no}var kt=At.prototype=new io;kt.constructor=At;oo(kt,ge.prototype);kt.isPureReactComponent=!0;var Jn=Array.isArray;function xt(){}var O={H:null,A:null,T:null,S:null},ao=Object.prototype.hasOwnProperty;function Pt(e,t,n){var o=n.ref;return{$$typeof:Et,type:e,key:t,ref:o!==void 0?o:null,props:n}}function Lr(e,t){return Pt(e.type,t,e.props)}function Rt(e){return typeof e=="object"&&e!==null&&e.$$typeof===Et}function Hr(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Qn=/\/+/g;function bt(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Hr(""+e.key):t.toString(36)}function Dr(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(xt,xt):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function me(e,t,n,o,r){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Et:case Ar:a=!0;break;case to:return a=e._init,me(a(e._payload),t,n,o,r)}}if(a)return r=r(e),a=o===""?"."+bt(e,0):o,Jn(r)?(n="",a!=null&&(n=a.replace(Qn,"$&/")+"/"),me(r,t,n,"",function(u){return u})):r!=null&&(Rt(r)&&(r=Lr(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(Qn,"$&/")+"/")+a)),t.push(r)),1;a=0;var d=o===""?".":o+":";if(Jn(e))for(var s=0;s<e.length;s++)o=e[s],i=d+bt(o,s),a+=me(o,t,n,i,r);else if(s=_r(e),typeof s=="function")for(e=s.call(e),s=0;!(o=e.next()).done;)o=o.value,i=d+bt(o,s++),a+=me(o,t,n,i,r);else if(i==="object"){if(typeof e.then=="function")return me(Dr(e),t,n,o,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return a}function Xe(e,t,n){if(e==null)return e;var o=[],r=0;return me(e,o,"","",function(i){return t.call(n,i,r++)}),o}function Nr(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var eo=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},jr={map:Xe,forEach:function(e,t,n){Xe(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Xe(e,function(){t++}),t},toArray:function(e){return Xe(e,function(t){return t})||[]},only:function(e){if(!Rt(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};w.Activity=Cr;w.Children=jr;w.Component=ge;w.Fragment=kr;w.Profiler=Rr;w.PureComponent=At;w.StrictMode=Pr;w.Suspense=Vr;w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O;w.__COMPILER_RUNTIME={__proto__:null,c:function(e){return O.H.useMemoCache(e)}};w.cache=function(e){return function(){return e.apply(null,arguments)}};w.cacheSignal=function(){return null};w.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var o=oo({},e.props),r=e.key;if(t!=null)for(i in t.key!==void 0&&(r=""+t.key),t)!ao.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(o[i]=t[i]);var i=arguments.length-2;if(i===1)o.children=n;else if(1<i){for(var a=Array(i),d=0;d<i;d++)a[d]=arguments[d+2];o.children=a}return Pt(e.type,r,o)};w.createContext=function(e){return e={$$typeof:Mr,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Tr,_context:e},e};w.createElement=function(e,t,n){var o,r={},i=null;if(t!=null)for(o in t.key!==void 0&&(i=""+t.key),t)ao.call(t,o)&&o!=="key"&&o!=="__self"&&o!=="__source"&&(r[o]=t[o]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var d=Array(a),s=0;s<a;s++)d[s]=arguments[s+2];r.children=d}if(e&&e.defaultProps)for(o in a=e.defaultProps,a)r[o]===void 0&&(r[o]=a[o]);return Pt(e,i,r)};w.createRef=function(){return{current:null}};w.forwardRef=function(e){return{$$typeof:Or,render:e}};w.isValidElement=Rt;w.lazy=function(e){return{$$typeof:to,_payload:{_status:-1,_result:e},_init:Nr}};w.memo=function(e,t){return{$$typeof:Ir,type:e,compare:t===void 0?null:t}};w.startTransition=function(e){var t=O.T,n={};O.T=n;try{var o=e(),r=O.S;r!==null&&r(n,o),typeof o=="object"&&o!==null&&typeof o.then=="function"&&o.then(xt,eo)}catch(i){eo(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),O.T=t}};w.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()};w.use=function(e){return O.H.use(e)};w.useActionState=function(e,t,n){return O.H.useActionState(e,t,n)};w.useCallback=function(e,t){return O.H.useCallback(e,t)};w.useContext=function(e){return O.H.useContext(e)};w.useDebugValue=function(){};w.useDeferredValue=function(e,t){return O.H.useDeferredValue(e,t)};w.useEffect=function(e,t){return O.H.useEffect(e,t)};w.useEffectEvent=function(e){return O.H.useEffectEvent(e)};w.useId=function(){return O.H.useId()};w.useImperativeHandle=function(e,t,n){return O.H.useImperativeHandle(e,t,n)};w.useInsertionEffect=function(e,t){return O.H.useInsertionEffect(e,t)};w.useLayoutEffect=function(e,t){return O.H.useLayoutEffect(e,t)};w.useMemo=function(e,t){return O.H.useMemo(e,t)};w.useOptimistic=function(e,t){return O.H.useOptimistic(e,t)};w.useReducer=function(e,t,n){return O.H.useReducer(e,t,n)};w.useRef=function(e){return O.H.useRef(e)};w.useState=function(e){return O.H.useState(e)};w.useSyncExternalStore=function(e,t,n){return O.H.useSyncExternalStore(e,t,n)};w.useTransition=function(){return O.H.useTransition()};w.version="19.2.8"});var N=We((ma,lo)=>{"use strict";lo.exports=so()});var So=We(et=>{"use strict";var Zr=Symbol.for("react.transitional.element"),Xr=Symbol.for("react.fragment");function ho(e,t,n){var o=null;if(n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:Zr,type:e,key:o,ref:t!==void 0?t:null,props:n}}et.Fragment=Xr;et.jsx=ho;et.jsxs=ho});var Ce=We((Ea,wo)=>{"use strict";wo.exports=So()});var fe={focusId:null,relation:null,expanded:[],pins:{}},Be=e=>{let t=Number(e);return Number.isFinite(t)?t:null};function te(e){let t=new URLSearchParams;e.focusId&&t.set("focus",e.focusId),e.relation&&t.set("relation",e.relation),e.overview&&t.set("overview","1"),e.zoom&&t.set("zoom","1"),e.past&&t.set("past","1"),e.shown&&e.shown.length>0&&t.set("show",[...e.shown].sort().join(",")),e.selection!==void 0&&e.selection.length>0&&t.set("sel",[...e.selection].sort().join(",")),e.expanded.length>0&&t.set("expand",[...e.expanded].sort().join(","));for(let o of Object.keys(e.pins).sort()){let r=e.pins[o];t.set(`pin.${o}`,`${qe(r.x)},${qe(r.y)}`)}e.pan&&(e.pan.x!==0||e.pan.y!==0)&&t.set("pan",`${qe(e.pan.x)},${qe(e.pan.y)}`);for(let o of Object.keys(e.within??{}).sort()){let r=e.within[o];r.length>0&&t.set(`in.${o}`,r)}e.q&&e.q.trim().length>0&&t.set("q",e.q);let n=t.toString();return n?`#${n}`:"#"}function Sr(e){return e&&e.startsWith("agg:")?`aggregate:${e.slice(4)}`:e}function $e(e){let t=e.includes("#")?e.slice(e.indexOf("#")+1):e,n=new URLSearchParams(t),o=Object.create(null);for(let[h,p]of n){if(!h.startsWith("pin."))continue;let[g,b]=p.split(","),A=g===void 0?null:Be(g),m=b===void 0?null:Be(b);A===null||m===null||(o[h.slice(4)]={x:A,y:m})}let r=Object.create(null);for(let[h,p]of n)!h.startsWith("in.")||p.length===0||(r[h.slice(3)]=p);let i=n.get("view");i&&i.length>0&&r.view===void 0&&(r.view=i);let a=n.get("pan")?.split(",")??[],d=a[0]===void 0?null:Be(a[0]),s=a[1]===void 0?null:Be(a[1]),u=(n.get("sel")??"").split(",").filter(h=>h.length>0).sort(),f=n.get("overview")==="1";return{...u.length>0?{selection:u}:{},...f?{overview:!0}:{},...n.get("zoom")==="1"?{zoom:!0}:{},...n.get("past")==="1"?{past:!0}:{},...n.get("show")?{shown:[...new Set(n.get("show").split(",").filter(Boolean))].sort()}:{},...d!==null&&s!==null?{pan:{x:d,y:s}}:{},...Object.keys(r).length>0?{within:r}:{},...n.get("q")?.trim()?{q:n.get("q")}:{},focusId:Sr(n.get("focus")),relation:n.get("relation"),expanded:(n.get("expand")??"").split(",").filter(h=>h.length>0&&(f||!h.startsWith("kind:"))).sort(),pins:o}}function Ji(e){let t=$e(e);return te(t)==="#"?{...t,overview:!0}:t}function Qi(e){let t=te(e);return t==="#overview=1"?"":t}function qe(e){return Math.round(e*100)/100}function Bn(e,t){return te(e)===te(t)}var Kn="edge:";function qn(e){if(!e.startsWith(Kn))return null;let t=e.slice(Kn.length).split(":");if(t.length!==3)return null;let[n,o,r]=t;if(!n||!o||!r)return null;try{return{kind:decodeURIComponent(n),from:decodeURIComponent(o),to:decodeURIComponent(r)}}catch{return null}}function gt(e){let{pan:t,...n}=e;return{...n,pins:{}}}function q(e,t){if(t===e.focusId)return{...e,focusId:t};let n=gt(e);return{...n.within?.q!==void 0?ae(n,"q",null):n,focusId:t}}function $n(e,t){return{...e,relation:t}}function ae(e,t,n){let o={...e.within??{}};if(n===null?delete o[t]:o[t]=n,Object.keys(o).length===0){let{within:r,...i}=e;return i}return{...e,within:o}}function pe(e,t){if(t!==e.overview&&(e=gt(e)),!t){let n=e.expanded.filter(o=>!o.startsWith("kind:"));return{...e,overview:!1,expanded:n}}return{...e,overview:t}}function ze(e,t){if(t.length===0){let{selection:n,...o}=e;return o}return{...e,selection:[...t]}}function Ve(e,t){if(t!==(e.zoom===!0)&&(e=gt(e)),!t){let{zoom:n,...o}=e;return o}return{...e,zoom:!0}}function Ue(e,t){let n=new Set(e.expanded);return n.has(t)?n.delete(t):n.add(t),{...e,expanded:[...n].sort()}}var Ze="aggregate:",Ye="kind:";function ht(e){return`${Ye}${e}`}function ye(e){return e.startsWith(Ye)?e.slice(Ye.length):null}var na="kinds:beyond";function wr(e){let t=ye(e);return t?[t]:se(e)}function ne(...e){return`${Ze}${[...e].sort().join("+")}`}function zn(e){return e.startsWith(Ze)}function se(e){return!zn(e)||e.includes("|")?[]:e.slice(Ze.length).split("+").filter(Boolean)}function Un(e,t,n={}){let o=ye(t);if(o!==null&&e.overview&&n.ownPicture!==!0)return Ue(e,t);let r=o!==null?ne(o):t;if(e.zoom&&e.focusId===r&&!(o!==null&&n.carry))return Ve(e,!1);if(o!==null&&n.carry){let i=pe({...q(e,r),relation:null},!1);return ae(Ve(i,!0),"q",n.carry)}return Ve({...q(e,r),relation:null},!0)}function vr(e,t,n){return ae(pe(q(e,ne(t)),!1),"view",n)}function oa(e,t){return e.id<t.id?-1:e.id>t.id?1:0}var Yn="aggregate:";function St(e){return e.startsWith(Yn)&&e.includes("|")}var wt=e=>e?.off===!0,br=e=>e!==void 0&&!wt(e)&&(e.fast!==void 0||e.thinking!==void 0||e.answer!==void 0||e.decide!==void 0||e.complete!==void 0||e.turn!==void 0),Zn=e=>e!==void 0&&!wt(e)&&(e.fast!==void 0||e.decide!==void 0),xr=e=>e?.suggestOnOpen!==!1&&Zn(e),Er=e=>e?.hoverChips===!0&&Zn(e);var vt={};var uo=C(N(),1),Gr={turns:[],outcomes:new Map,busy:!1,pending:null,draft:null,draftNote:null},co=e=>`graview:seat:${e}`;function Wr(e){if(!e)return{};try{let t=sessionStorage.getItem(e);if(!t)return{};let n=JSON.parse(t);return{...Array.isArray(n.turns)?{turns:n.turns}:{},...Array.isArray(n.outcomes)?{outcomes:new Map(n.outcomes)}:{},...n.draft?.drawn?{draft:n.draft}:{}}}catch{return{}}}function Fr(e,t){if(e)try{sessionStorage.setItem(e,JSON.stringify({turns:t.turns.slice(-40),outcomes:[...t.outcomes],draft:t.draft}))}catch{}}function Tt(e){let t=e===null?null:co(e),n={...Gr,...Wr(t)},o=new Set,r=(i,a=!0)=>{n=i,a&&Fr(t,n);for(let d of[...o])d()};return{get:()=>n,subscribe(i){return o.add(i),()=>void o.delete(i)},setTurns:i=>r({...n,turns:i(n.turns)}),settle:(i,a)=>r({...n,outcomes:new Map(n.outcomes).set(i,a)}),setBusy:i=>r({...n,busy:i},!1),ask:i=>r({...n,pending:i.trim()||null}),takePending(){let i=n.pending;return i!==null&&r({...n,pending:null},!1),i},setDraft:(i,a=null)=>r({...n,draft:i,draftNote:a})}}function Kr(e){return(0,uo.useSyncExternalStore)(e.subscribe,e.get,e.get)}var po=C(N(),1),Br={entries:[],ghost:null,loaded:!1};function fo(e,t){let n=new Map(e.map(o=>[o.id,o]));for(let o of t)n.set(o.id,{...n.get(o.id),...o});return[...n.values()].sort((o,r)=>o.at<r.at?1:o.at>r.at?-1:0)}function Mt(e){let t=Br,n=new Set,o=r=>{t=r;for(let i of[...n])i()};return{get:()=>t,subscribe:r=>(n.add(r),()=>n.delete(r)),record:r=>{o({...t,entries:fo(t.entries,[r])}),Promise.resolve(e()?.keep?.(r)).catch(i=>{console.warn("The host did not keep an AI interaction:",i)})},setGhost:r=>o({...t,ghost:r}),load:()=>{if(t.loaded)return;o({...t,loaded:!0});let r=e()?.load;r&&Promise.resolve(r()).then(i=>o({...t,entries:fo(t.entries,i)})).catch(i=>{console.warn("The host's AI interactions could not be read:",i)})}}}function qr(e){return(0,po.useSyncExternalStore)(e.subscribe,e.get,e.get)}function yo(e){return e?.closest?.("[data-graview-pick]")?.getAttribute("data-graview-pick")??null}var Je=C(N(),1),Qe=(0,Je.createContext)(void 0),$r=()=>(0,Je.useContext)(Qe);var k=C(N(),1),Ie=(0,k.createContext)(null);function go(){return(0,k.useContext)(Ie)}function zr(e,t){let n=go(),o=(0,k.useMemo)(()=>n?n.live.seenBy(t):e,[n,e,t]),r=(0,k.useRef)(0),i=(0,k.useCallback)(a=>o.subscribe(()=>{r.current+=1,a()}),[o]);return(0,k.useSyncExternalStore)(i,()=>r.current,()=>0),o}var Ur=Ke(()=>(__graviewPreload(import.meta.url,["./chunk.TI4OSTQV.js","./chunk.AJZBJBMO.js"]),import("./chunk.J2CR4RRH.js"))),mo,Yr=400;function Ot(e,t,n){let o=(0,k.useContext)(Ie),r=o!==null&&o.owns(e,t),[i,a]=(0,k.useState)(null),[d,s]=(0,k.useState)(mo);(0,k.useEffect)(()=>{if(d||r||i===null)return;let E=!0;return Ur().then(R=>{mo=R,E&&s(R)},()=>{}),()=>{E=!1}},[d,r,i]);let[u,f]=(0,k.useState)(0),h=(0,k.useMemo)(()=>r||i===null||i>=e.log.length||!d?void 0:d.askDeclaration(n,i),[r,e,i,n,d,u]),p=h&&"waiting"in h?h.waiting:void 0,[g,b]=(0,k.useState)(void 0);(0,k.useEffect)(()=>{if(!p)return;let E=!0,R=setTimeout(()=>E&&b(p),Yr);return p.then(()=>E&&f(I=>I+1)),()=>{E=!1,clearTimeout(R)}},[p]);let A=p!==void 0&&g!==p,m=(0,k.useMemo)(()=>{if(r||i===null||i>=e.log.length||!d||A)return null;try{let E=d.pastAt(e,i,n);return{seq:i,at:E.past?.at,store:E}}catch{return null}},[r,e,i,n,d,A,u]),v=(0,k.useRef)(null),y=A?v.current:m;(0,k.useEffect)(()=>{v.current=y},[y]);let x=(0,k.useCallback)(E=>a(E===null?null:E>=e.log.length?Number.POSITIVE_INFINITY:E),[e]),P=(0,k.useCallback)((E,R)=>[e,y?.store].some(I=>I!==void 0&&(I===E||I.seenBy(R)===E)),[e,y]),D=i!==null,L=(0,k.useMemo)(()=>({past:y,open:D,show:x,live:e,host:n,owns:P}),[y,D,x,e,n,P]);return r?o:L}var vo=e=>`graview:setting:${e}`;function bo(){return localStorage}function xo(e,t){try{let n=(t??bo()).getItem(vo(e.name));if(n!==null&&e.options.some(o=>o.value===n))return n}catch{}return e.initial}function Eo(e,t,n){try{(n??bo()).setItem(vo(e.name),t)}catch{}}function Ao(e,t){if(typeof document>"u")return;let n=document.documentElement;if(e.honored==="root-font-size"){n.style.fontSize=t===e.initial?"":t;return}let o=`graview${e.name.replace(/-([a-z0-9])/g,(r,i)=>i.toUpperCase()).replace(/^[a-z]/,r=>r.toUpperCase())}`;t===e.initial?delete n.dataset[o]:n.dataset[o]=t}var _=C(N(),1);function Vt(e){return Fe(e)}var Jr=12,Qr=4;function ei(e,t,n){let o=Vt(t);return e.get(o)??{participant:o,who:t.id??t.kind,at:null,mode:"docked",since:n,trail:[]}}var tt=(e,t)=>t===null||e[e.length-1]===t?e:[...e,t].slice(-Jr);function ko(e,t){let n=e.filter(r=>r.length>0);if(n.length===0)return null;if(n.length<=Qr)return n[0];let o=new Set(n.map(r=>t(r)).filter(r=>r!==void 0));return o.size===1?ht([...o][0]):n[0]}function It(e,t,n){let o=new Map(e);if(t.type==="rest"){for(let[a,d]of e)d.mode!=="asking"&&d.mode!=="docked"&&t.at-d.since>=t.holdMs&&o.set(a,{...d,mode:"docked",at:null,trail:[],say:void 0,confidence:void 0});return o}if(t.author.kind!=="agent")return o;let r=ei(e,t.author,t.at),i=a=>o.set(r.participant,{...r,...a,since:t.at});switch(t.type){case"read":{let a=ko(t.ids,n);return i({at:a,mode:"reading",trail:tt(r.trail,a)}),o}case"about-to-write":case"write":{let a=ko(t.ids,n);return i({at:a,mode:"writing",trail:tt(r.trail,a),say:void 0,confidence:void 0}),o}case"refused":return i({at:t.where,mode:"refused",say:t.say,confidence:void 0,trail:tt(r.trail,t.where)}),o;case"asking":return i({at:t.where??r.at,mode:"asking",say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},trail:tt(r.trail,t.where)}),o;case"said":return i({say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},...t.caption?{caption:t.caption}:{}}),o;case"over":return i({over:t.over}),o;case"home":return i({at:null,mode:"docked",trail:[],say:void 0,confidence:void 0,over:null}),o;default:return o}}var Po="graview:session";function Ro(e){let t=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);try{let n=e??sessionStorage,o=n.getItem(Po);if(o)return o;let r=t();return n.setItem(Po,r),r}catch{return t()}}var Ct={name:"share-where",title:"Where you are",description:"Whether the others here see which stop you are on.",honored:"root-attribute",options:[{value:"shared",label:"Shown"},{value:"private",label:"Hidden"}],initial:"shared"},_t={name:"share-over",title:"What you point at",description:"Whether the others see the thing under your pointer, outlined in your color.",honored:"root-attribute",options:[{value:"private",label:"Kept to yourself"},{value:"shared",label:"Outlined for others"}],initial:"private"},To=[Ct,_t],ni=800;function Mo(e){let{channel:t,store:n,view:o,principal:r,session:i,robots:a,seatWho:d,settingValues:s,setView:u,ttlMs:f=1e4,people:h,seats:p}=e,[g,b]=(0,_.useState)(()=>new Map),[A,m]=(0,_.useState)(null),[v,y]=(0,_.useState)(null),[x,P]=(0,_.useState)(null),D=typeof r.id=="string"&&r.id.length>0,L=D&&(s[Ct.name]??Ct.initial)==="shared",E=L&&(s[_t.name]??_t.initial)==="shared",R=Vt({kind:r.kind,...r.id?{id:r.id}:{},session:i}),I=D?Ln(r,{graph:n.graph,schema:n.schema,...p?{seats:p}:{},...h?{people:h}:{}}):"",G=d?a.get(`agent:${d}:${i}`):void 0,W=(0,_.useMemo)(()=>!t||!L?null:{participant:R,kind:r.kind,name:I,...r.onBehalfOf?.id?{onBehalfOf:r.onBehalfOf.id,...r.onBehalfOf.name?{onBehalfOfName:r.onBehalfOf.name}:{}}:{},hue:Hn(r.id??"nobody"),stop:x??te(o),...E?{over:A}:{},...G?{robot:{at:G.at,mode:G.mode}}:{},at:new Date().toISOString()},[t,L,E,R,I,r.id,r.kind,r.onBehalfOf?.id,r.onBehalfOf?.name,o,x,A,G?.at,G?.mode]);(0,_.useEffect)(()=>{if(!t||!W)return;t.here(W);let V=setInterval(()=>t.here({...W,at:new Date().toISOString()}),ni);return()=>clearInterval(V)},[t,W]),(0,_.useEffect)(()=>t?t.onWho(K=>b(mt(new Map,K,Date.now(),f))):void 0,[t,f]);let Z=g.size>0;(0,_.useEffect)(()=>{if(!Z)return;let V=setInterval(()=>{b(K=>{let Q=mt(K,[],Date.now(),f);return Q.size===K.size?K:Q})},Math.max(250,Math.min(1e3,f/4)));return()=>clearInterval(V)},[Z,f]),(0,_.useEffect)(()=>{if(!t||typeof window>"u")return;let V=()=>t.leave();return window.addEventListener("pagehide",V),()=>window.removeEventListener("pagehide",V)},[t]),(0,_.useEffect)(()=>{if(!E||typeof document>"u")return;let V=null,K=Q=>{let Ee=yo(Q.target);Ee!==V&&(V=Ee,m(Ee))};return document.addEventListener("pointermove",K,{passive:!0}),()=>document.removeEventListener("pointermove",K)},[E]);let X=(0,_.useRef)(null),$=v?g.get(v)??null:null,de=(0,_.useCallback)(V=>{X.current=null,y(V)},[]);return(0,_.useEffect)(()=>{if(v){if(!$){y(null);return}$.stop!==X.current?.stop&&(X.current={stop:$.stop,at:Date.now()},u($e($.stop)))}},[v,$,u]),(0,_.useEffect)(()=>{let V=X.current;!v||V===null||Date.now()-V.at<400||Bn(o,$e(V.stop))||y(null)},[o,v]),(0,_.useEffect)(()=>{if(!v||typeof document>"u")return;let V=K=>{K.key==="Escape"&&y(null)};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[v]),(0,_.useMemo)(()=>({who:g,sharing:W?{participant:R,name:I}:null,following:$,follow:de,sayWhere:P}),[g,W,R,I,$,de])}var U=C(N(),1);function Oo(e){return Fe(e.author)}function oi(e,t){return e.length>1?"co-edited":t==="rule"?"rule":t==="agent"?"autonomous":"directed"}function Vo(e,t,n,o,r){let i=new Map;for(let[s,u]of e)o-u.at<r&&i.set(s,u);let a=new Set(n.flatMap(s=>s.nodeIds)),d=(s,u,f)=>{let h=i.get(s),p=h?.participants.includes(Oo(u))?h.participants:[...h?.participants??[],Oo(u)];i.set(s,{at:o,manner:oi(p,u.author.kind),intent:u.intent,wrote:(h?.wrote??!1)||(f.wrote??!1),read:(h?.read??!1)||(f.read??!1),broke:(h?.broke??!1)||a.has(s),participants:p})};for(let s of t){for(let u of s.writes)d(u,s,{wrote:!0});for(let u of s.reads)s.writes.includes(u)||d(u,s,{read:!0})}for(let s of n)for(let u of s.nodeIds){let f=i.get(u);i.set(u,{at:o,manner:f?.manner??"rule",intent:f?.intent??s.message,wrote:f?.wrote??!1,read:f?.read??!1,broke:!0,participants:f?.participants??["rule::"]})}return i}var ri=2600;function Io(e,t=ri){let[n,o]=(0,U.useState)(()=>new Map),r=(0,U.useRef)(n);r.current=n;let i=(0,U.useRef)(null),a=(0,U.useCallback)(s=>{r.current=s,o(s),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{r.current=new Map,o(new Map)},t)},[t]);(0,U.useEffect)(()=>{let s=e.violations(),u=e.subscribe((f,h)=>{let p=e.violations(),g=Gn(e.allInvariants(),s,p).introduces;s=p,a(Vo(r.current,h,g.map(b=>({nodeIds:b.nodeIds,message:b.message})),Date.now(),t))});return()=>{u(),i.current&&clearTimeout(i.current)}},[e,t,a]);let d=(0,U.useCallback)(s=>{s.reads.length!==0&&a(Vo(r.current,[ii(s)],[],Date.now(),t))},[t,a]);return{activity:n,noteAttention:d}}function ii(e){return{id:`attention:${e.intent}`,seq:-1,batch:"attention",author:e.author,intent:e.intent,mutation:null,primitives:[],inverse:[],reads:e.reads,writes:[],at:new Date().toISOString()}}var l=C(N(),1);function Co(){let e=null,t=new Set,n=new Set,o=r=>{for(let i of n)i(r)};return{subscribe(r){return t.add(r),t.size===1&&o(!0),()=>{t.delete(r),t.size===0&&(e=null,o(!1))}},snapshot:()=>e,set(r){if(!(e===r||e&&r&&e.x===r.x&&e.y===r.y)){e=r;for(let i of t)i()}},get listeners(){return t.size},onActive(r){return n.add(r),()=>void n.delete(r)}}}var nt=C(N(),1),ai=e=>e.definitions.some(t=>Cn(t).size>0);function _o(e,t,n){let[o,r]=(0,nt.useState)(void 0),i=(n.roles??[]).join("\0");return(0,nt.useEffect)(()=>{if(!t||!ai(e.schema)){r(void 0);return}let a=!0,d=!1,s=e.graph,u=()=>{d||(d=!0,queueMicrotask(()=>{d=!1,a&&e.reread()}))},f=_n(t,{kind:n.kind,...n.id===void 0?{}:{id:n.id},...n.roles?{roles:n.roles}:{}},u);return yt(s,f.read),r(f),e.reread(),()=>{a=!1,yt(s,void 0)}},[e,t,n.kind,n.id,i]),o}function Lo(){let e=!1,t=new Set;return{moving:()=>e,set(n){if(n!==e){e=n;for(let o of t)o()}},subscribe(n){return t.add(n),()=>t.delete(n)}}}var le=C(Ce(),1),si="graview:place-menu",_e=(0,l.createContext)(null),jo=(0,l.createContext)("scene");function li({mode:e,children:t}){return(0,le.jsx)(jo.Provider,{value:e,children:t})}function di(){return(0,l.useContext)(jo)}var Go={kind:"human"},ui=[],ci=[],fi=[],Lt=[];function Wo(e,t){let n=(0,l.useId)();(0,l.useEffect)(()=>{if(!globalThis.__graviewWatch)return;let o=t??Go,r=()=>jn(e,o,n);r();let i,a=e.subscribe(()=>{clearTimeout(i),i=setTimeout(r,250)});return()=>{clearTimeout(i),a(),globalThis.__graviewWatch?.unseen?.({words:[],from:n,gone:!0})}},[e,t,n])}var pi={off:!0};function yi({store:e,views:t,initialView:n,scheme:o="dark",initialSelection:r,principal:i,seats:a=ui,onSeat:d,people:s=ci,memory:u,presenceTtlMs:f,app:h,settings:p=h?.settings??fi,presence:g,brand:b,locale:A,timeZone:m,onKeepLens:v,providers:y,ai:x,files:P,resolveApp:D,history:L,linkedRecords:E,menuSections:R,keptViews:I,subscriptions:G,signIn:W,view:Z,onViewChange:X,children:$}){let de=(0,l.useContext)(_e),V=R??de?.menuSections,K=W??de?.signIn,Q=I??de?.keptViews,[Ee,ir]=(0,l.useState)(null),ue=Ee??i??a[0]?.principal??Go,He=Ot(e,ue,L),Zt=He.past&&He.live===e?He.past.store:e,H=(0,l.useMemo)(()=>Zt.seenBy(ue),[Zt,ue]);Wo(e,ue);let[re]=(0,l.useState)(()=>Ro(u)),[Xt,ar]=(0,l.useState)(!1),Jt=(0,l.useCallback)(()=>ar(!0),[]),ie=(0,l.useMemo)(()=>g?[...p,...To]:p,[p,g]),[dt]=(0,l.useState)(()=>n??jt(t,e.schema)),[sr,Qt]=(0,l.useState)(()=>ze(dt??fe,r??dt?.selection??[])),Ae=(0,l.useRef)(dt??fe).current,[en,lr]=(0,l.useState)(null),[tn,dr]=(0,l.useState)(null),J=(0,l.useContext)(_e),[nn]=(0,l.useState)(()=>J?.seatTalk??Tt(b?.name??e.schema.kinds.join(","))),ut=x??J?.ai??vt,De=(0,l.useMemo)(()=>ut.off?pi:ut,[ut]),on=(0,l.useRef)(De.interactions);on.current=De.interactions;let[rn]=(0,l.useState)(()=>J?.aiDesk??Mt(()=>on.current)),[ur]=(0,l.useState)(()=>J?.subscriptions??Nn()),an=G??J?.subscriptions??ur,ct=v??J?.onKeepLens,Ne=h??J?.app,je=A??J?.locale,cr=b?.locale??Ne?.brand?.locale,Ge=m??J?.timeZone;In({reader:je,app:cr,readerTimeZone:Ge,appTimeZone:b?.timeZone??Ne?.brand?.timeZone});let sn=(0,l.useRef)(null),ln=(0,l.useCallback)(c=>{sn.current=c},[]),dn=(0,l.useCallback)(c=>sn.current?.whereIs(c)??null,[]),[un]=(0,l.useState)(()=>Co()),[cn]=(0,l.useState)(()=>Lo()),[ft,fr]=(0,l.useState)(null),[ke,fn]=(0,l.useState)(()=>new Map),Pe=(0,l.useRef)(ke);Pe.current=ke;let Re=(0,l.useRef)(null),pt=(0,l.useCallback)(c=>H.graph.getNode(c)?.kind,[H]),ee=(0,l.useCallback)(c=>{let S=It(Pe.current,c,pt);Pe.current=S,fn(S),Re.current&&clearTimeout(Re.current),[...S.values()].some(M=>M.mode!=="docked"&&M.mode!=="asking")&&(Re.current=setTimeout(()=>{let M=It(Pe.current,{type:"rest",at:Date.now(),holdMs:Nt},pt);Pe.current=M,fn(M)},Nt+20))},[pt]),pn=(0,l.useCallback)(c=>ee({...c,at:c.at??Date.now()}),[ee]),yn=(0,l.useCallback)(c=>{fr(c),c&&ee({type:"home",author:{kind:"agent",id:c,session:re},at:Date.now()})},[ee,re]);(0,l.useEffect)(()=>H.subscribe((c,S)=>{for(let T of S)T.author.kind==="agent"&&ee({type:"write",author:T.author,ids:T.writes,at:Date.now()})}),[H,ee]),(0,l.useEffect)(()=>()=>{Re.current&&clearTimeout(Re.current)},[]);let z=(0,l.useMemo)(()=>({...ue,session:re}),[ue,re]),mn=_o(H,E,z),gn=(0,l.useCallback)(c=>{ir(c),d?.(c)},[d]),[Te,pr]=(0,l.useState)(()=>Object.fromEntries(ie.map(c=>[c.name,xo(c,u)])));(0,l.useEffect)(()=>{for(let c of ie)Ao(c,Te[c.name]??c.initial)},[ie,Te]);let hn=(0,l.useCallback)((c,S)=>{let T=ie.find(M=>M.name===c);!T||!T.options.some(M=>M.value===S)||(Eo(T,S,u),pr(M=>({...M,[c]:S})))},[ie,u]),[Sn,yr]=(0,l.useState)(null),{activity:wn,noteAttention:vn}=Io(H),bn=(0,l.useCallback)(c=>{vn(c),ee({type:"read",author:c.author,ids:c.reads,at:Date.now()})},[vn,ee]),ce=(0,l.useCallback)(c=>{if(ye(c)!==null||se(c).length>0||St(c))return!0;let S=qn(c);return S?H.graph.allEdges().some(T=>T.kind===S.kind&&T.from===S.from&&T.to===S.to):H.graph.getNode(c)!==void 0},[H]),xn=(0,l.useCallback)(c=>{let S=c.selection??Lt,T=S.filter(ce),M=T.length===S.length?c:ze(c,T);return M.focusId!==null&&!ce(M.focusId)&&(M=q(M,null)),M},[ce]),Me=(0,l.useCallback)(c=>{let S=xn(c),T=No(H,z,S.shown);if(S.focusId!==null&&T.size>0){let M=se(S.focusId),Vn=H.graph.getNode(S.focusId);(M.length>0?M.every(hr=>T.has(hr)):Vn?T.has(Vn.kind):!1)&&(S={...S,focusId:null})}if(!S.overview&&S.focusId===null){let M=Ae.focusId!==null&&!ce(Ae.focusId)?jt(t,e.schema)??{...fe,overview:!0}:Ae;M.focusId!==null&&ce(M.focusId)?S={...S,focusId:M.focusId}:M.overview===!0&&(S={...S,overview:!0})}return S},[xn,ce,H,Ae,z,t,e.schema]),B=Me(Z??sr),En=(0,l.useMemo)(()=>No(H,z,B.shown),[H,z,B.shown]),An=(0,l.useMemo)(()=>[...H.modules.administered.entries()].map(([c,S])=>{let T=H.mayAdminister(c,z);return{name:c,...S.description?{description:S.description}:{},kinds:S.kinds??[],canShow:T,shown:T&&(B.shown??[]).includes(c)}}),[H,z,B.shown]),Oe=(0,l.useCallback)(c=>{let S=T=>Me(typeof c=="function"?c(T):c);if(Z!==void 0){X?.(S(Z));return}X&&X(S(B)),Qt(T=>S(T))},[B,X,Z,Me]);(0,l.useEffect)(()=>{Z===void 0&&Qt(c=>{let S=Me(c);return S===c?c:S})},[B,Z,Me]);let kn=B.selection??Lt,Pn=(0,l.useCallback)(c=>{Oe(S=>ze(S,typeof c=="function"?c(S.selection??Lt):c))},[Oe]),{who:Rn,following:Tn,follow:Mn,sayWhere:mr,sharing:On}=Mo({channel:g,store:H,view:B,principal:z,session:re,robots:ke,seatWho:ft,settingValues:Te,setView:Oe,seats:a,people:s,...f!==void 0?{ttlMs:f}:{}}),gr=(0,l.useMemo)(()=>({store:H,scheme:o,views:t,view:B,setView:Oe,homeView:Ae,selection:kn,setSelection:Pn,menuAt:en,setMenuAt:lr,whereIs:dn,pointer:un,motion:cn,registerScene:ln,robots:ke,noteSeat:pn,seatWho:ft,registerSeatWho:yn,actsDoor:tn,registerActsDoor:dr,seatTalk:nn,aiDesk:rn,...u?{memory:u}:{},who:Rn,following:Tn,follow:Mn,sayWhere:mr,sharing:On,session:re,ai:De,resolveApp:D,linkedRecords:E,menuSections:V,...Q?{keptViews:Q}:{},subscriptions:an,signIn:K,linkedReads:mn,movedByHand:Xt,noteMoved:Jt,emphasis:Sn,setEmphasis:yr,activity:wn,noteAttention:bn,principal:z,seats:a,people:s,takeSeat:gn,settings:ie,settingValues:Te,chooseSetting:hn,hiddenKinds:En,administered:An,...y?{providers:y}:{},...b?{brand:b}:{},...ct?{onKeepLens:ct}:{},app:Ne,...je?{locale:je}:{},...Ge?{timeZone:Ge}:{}}),[H,o,t,B,Oe,kn,Pn,en,dn,un,cn,ln,ke,pn,ft,yn,tn,nn,rn,u,Rn,Tn,Mn,On,re,De,D,E,V,Q,an,K,mn,Xt,Jt,Sn,wn,bn,z,a,s,gn,ie,Te,hn,En,An,y,b,ct,Ne,je,Ge]);return(0,le.jsx)(_e.Provider,{value:gr,children:(0,le.jsx)(Ie.Provider,{value:He,children:(0,le.jsx)(wi,{children:P?(0,le.jsx)(Qe.Provider,{value:P,children:$}):$})})})}var Fo=(0,l.createContext)(null),Ht,Dt=new Set,mi=e=>(Dt.add(e),()=>void Dt.delete(e)),Ho=()=>Ht;function gi(e){if(!Ht){Ht=e;for(let t of[...Dt])t()}}var hi=300;function Si(e){let t=0;return async(n,o)=>{let r=++t;return await new Promise(i=>setTimeout(i,hi)),r===t?e(n,o):[]}}function wi({children:e}){let{store:t,view:n,views:o,principal:r,hiddenKinds:i,selection:a,ai:d}=oe(),s=ot(),u=n.q,f=n.focusId,h=!!(u&&u.trim().length>0),p=(0,l.useSyncExternalStore)(mi,Ho,Ho),g=(0,l.useMemo)(()=>h&&p?{flagged:new Set(t.violations().flatMap(x=>x.nodeIds)),touched:p.touchWeights(t.log.all())}:null,[t,s,h,p]),b=f?t.graph.getNode(f)?.kind??ye(f)??(se(f).length===1?se(f)[0]:void 0):void 0,A=(0,l.useMemo)(()=>d.near&&Si(d.near),[d.near]),m=(0,l.useMemo)(()=>!u||!g||!p?null:p.search(t,u,{...b?{inKind:b}:{},principal:r,places:o.places(),kinds:t.schema.kinds.filter(x=>!i.has(x)),from:[...a,...f&&t.graph.has(f)?[f]:[]],flagged:g.flagged,touched:g.touched,limit:200,rank:A}),[t,u,r,o,i,a,f,b,g,A]),[v,y]=(0,l.useState)();return(0,l.useEffect)(()=>void m?.later?.then(x=>y([m,x])),[m]),(0,le.jsx)(Fo.Provider,{value:v?.[0]===m?v[1]:m,children:e})}var Do=new WeakMap;function Qa(e){let t=Do.get(e);return t||Do.set(e,t=new Set(e.matched)),t}function vi(){return(0,l.useContext)(Fo)}function oe(){let e=(0,l.useContext)(_e);if(!e)throw new Error("useGraview must be used inside a <GraviewProvider>.");return e}function Gt(){return(0,l.useContext)(_e)??null}function ot(){let{store:e}=oe(),t=(0,l.useRef)(null),n=(0,l.useRef)(null),o=(0,l.useCallback)(()=>(n.current!==e&&(n.current=e,t.current=null),t.current??=e.graph.allNodes(),t.current),[e]),r=(0,l.useCallback)(i=>e.subscribe(()=>{t.current=null,i()}),[e]);return(0,l.useSyncExternalStore)(r,o,o)}function bi(e){let{store:t}=oe(),n=(0,l.useCallback)(r=>t.subscribe(r),[t]),o=(0,l.useCallback)(()=>e===null?void 0:t.graph.getNode(e),[t,e]);return(0,l.useSyncExternalStore)(n,o,o)}function No(e,t,n){let o=new Set(e.modules.disabledKinds);for(let r of e.kindsKeptFrom(t))o.add(r);for(let[r,i]of e.modules.administered)if(!(e.mayAdminister(r,t)&&(n??[]).includes(r)))for(let a of i.kinds??[])o.add(a);return o}var Nt=2600;var Ko=new WeakSet,xi=e=>Ko.has(e),Ei=e=>void Ko.add(e);function jt(e,t){let n=Fn(e.arrangement?.()?.first,t,e.places());if(!(!n||n.to==="home"))return n.to==="place"?{...fe,focusId:ne(n.place.kind),within:{view:n.place.as}}:{...fe,focusId:ne(n.kind)}}var Bo=C(N(),1),Ai=(0,Bo.createContext)(!1);var rt=Symbol.for("graview.default-view");function qo(e){return Object.defineProperty(e,rt,{value:!0,enumerable:!1}),e}function $o(e){return typeof e=="function"&&e[rt]===!0}var it=Symbol.for("graview.replaces-page");function zo(e){return Object.defineProperty(e,it,{value:!0,enumerable:!1}),e}function Uo(e){return typeof e=="function"&&e[it]===!0}function ki(e){return Wn(e)}function Pi(e,t){if(t===e)return e;for(let r of t.registrations())e.register(r.kind,r,r.view,r);let n=t.arrangement?.();n&&e.arrange?.(n);let o=t.homeView?.();return o&&e.home?.(o),e}var F=C(N(),1),Y=C(Ce(),1),Wt=new Set,at=0;function Xo(e){return()=>{at+=1;let t=e();return t.then(()=>void(at-=1),()=>void(at-=1)),t}}var Ri=()=>at,Yo=!1;function Ft(){for(let e of[...Wt])e()}function Ti(){Yo||typeof window>"u"||(Yo=!0,window.addEventListener("online",Ft))}function Kt(e){let t,n=!1,o=!1,r,i=0,a=new Set,d=()=>{i+=1;for(let p of[...a])p()},s=p=>(a.add(p),()=>void a.delete(p)),u=()=>i,f=()=>void h().catch(()=>{});function h(){if(n)return Promise.resolve(t);if(r)return r;let p=e().then(g=>(t=g,n=!0,o=!1,r=void 0,Wt.delete(f),d(),g),g=>{throw r=void 0,o=!0,Wt.add(f),Ti(),d(),g});return p.catch(()=>{}),r=p,p}return{load:h,prefetch:f,get current(){return t},get failed(){return o},part(p,g={}){let b=g.what??"This part";function A(y){(0,F.useSyncExternalStore)(s,u,u);let x=(0,F.useRef)(null),P=(0,F.useRef)(null),D=(0,F.useRef)(!1);return(0,F.useEffect)(()=>{o&&r===void 0&&f()},[]),n&&typeof document<"u"&&x.current!==null&&document.activeElement===x.current&&(D.current=!0),(0,F.useLayoutEffect)(()=>{if(!(!n||!D.current)){D.current=!1;for(let L=P.current?.nextElementSibling??null;L!==null;L=L.nextElementSibling){let E=L.matches(Zo)?L:L.querySelector(Zo);if(E instanceof HTMLElement){E.focus();return}}}}),n?(0,Y.jsxs)(Y.Fragment,{children:[D.current?(0,Y.jsx)("span",{ref:P,hidden:!0}):null,p(t,y)]}):g.quiet?null:(0,Y.jsx)(Mi,{what:b,button:x,...g.as?{as:g.as}:{}})}let m=(0,F.lazy)(Xo(()=>h().then(()=>({default:A}),()=>({default:A}))));function v(y){let[x]=(0,F.useState)(()=>n||o);return(0,F.createElement)(x?A:m,y)}return v}}}var Zo="button,a[href],input,select,textarea,[tabindex]:not([tabindex='-1'])";function Mi({what:e,button:t,as:n="p"}){let r=typeof navigator<"u"&&navigator.onLine===!1?`${e} will load when you're back online.`:`${e} didn't load.`;return(0,Y.jsxs)(n,{"data-testid":"lazy-part-missing",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:[(0,Y.jsx)("span",{role:"status",children:r})," ",(0,Y.jsx)("button",{ref:t,type:"button","data-testid":"lazy-part-retry",onClick:Ft,style:{font:"inherit",fontWeight:600,color:"var(--graview-ink)",background:"none",border:"1px solid var(--graview-edge)",borderRadius:6,padding:"2px 10px"},children:"Try again"})]})}var Se=C(N(),1);function Oi(){let{selection:e,setSelection:t}=oe();return(0,Se.useMemo)(()=>({selection:e,set:n=>t(n),clear:()=>t([]),toggle:n=>t(o=>o.includes(n)?o.filter(r=>r!==n):[...o,n]),isSelected:n=>e.includes(n)}),[e,t])}function Vi(){let{store:e}=oe(),t=ot();return(0,Se.useMemo)(()=>Ii(e),[e,t])}var Jo=new WeakMap;function Ii(e){let t=Jo.get(e);if(!t){let n={violations:null};e.subscribe(()=>{n.violations=null}),Jo.set(e,n),t=n}return t.violations??=e.violations(),t.violations}function Ci(){let{view:e,setView:t}=oe();return(0,Se.useMemo)(()=>({view:e,url:te(e),focus:n=>t(o=>q(o,n)),show:n=>t(o=>$n(o,n)),toggle:n=>t(o=>Ue(o,n)),go:n=>t(n)}),[e,t])}var he={at:0,depth:0,listeners:new Set,tell(){for(let e of this.listeners)e()}};typeof window<"u"&&window.addEventListener("popstate",e=>{let t=e.state;he.at=typeof t?.graview=="number"?t.graview:0,he.at>he.depth&&(he.depth=he.at),he.tell()});var j=C(N(),1),qt={profile:{trigger:"profile-button",pane:"profile",opens:"press",focus:"into",drawn:["shell","embed"]},problems:{trigger:"standing",pane:"problems",opens:"press",focus:"into",drawn:["shell","embed"]},places:{trigger:"app-places-open",pane:"app-places",opens:"press",focus:"into",drawn:["embed"]},here:{trigger:"here-open",pane:"here-list",opens:"press",focus:"into",drawn:["shell","embed","pages"]},suggested:{trigger:"suggested-button",pane:"suggested",opens:"press",focus:"into",drawn:["shell","embed","pages"]},activity:{trigger:"activity-button",pane:"activity",opens:"press",focus:"into",drawn:["shell","embed","pages"]},find:{trigger:"find-box",pane:"find-strip",opens:"typing",focus:"stays",drawn:["shell"]},districts:{trigger:"beyond-more",pane:"beyond-list",opens:"press",focus:"into",drawn:["shell","embed"]},acts:{trigger:null,pane:"context-menu",opens:"context-menu",focus:"into",drawn:["shell","embed","pages"]},arrange:{trigger:"arrange-add",pane:"arrange-list",opens:"press",focus:"into",drawn:["pages"]},"studio-ask":{trigger:"studio-agent",pane:"studio-agent-panel",opens:"press",focus:"into",drawn:["studio"]}},_i={position:"fixed",inset:"auto",margin:0,zIndex:Dn("popover"),boxSizing:"border-box"},st=6,we=8,Li=e=>typeof e.showPopover=="function";function lt(e){try{return e.matches(":popover-open")}catch{return!1}}function Hi(e){if(typeof e=="function"){let o=e();return o?{left:o.x,right:o.x,top:o.y,bottom:o.y}:null}let t=e.current;if(!t||!t.isConnected)return null;let n=t.getBoundingClientRect();return{left:n.left,right:n.right,top:n.top,bottom:n.bottom}}function $t(e,t,n={}){let o=Hi(t);if(!o)return;let r={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},i=e.dataset.graviewDesignedHeight??=e.style.maxHeight;e.style.maxHeight=i;let a=e.getBoundingClientRect(),d=r.height-o.bottom-st-we,s=o.top-st-we,u=a.height<=d||d>=s,f=Math.max(96,Math.floor(u?d:s)),h=Math.min(a.height,f);a.height>f&&(e.style.maxHeight=i?`min(${i}, ${f}px)`:`${f}px`);let p=a.width,g=n.align==="start"?o.left:o.right-p,b=typeof t=="function"?null:t.current?.closest("[data-graview-embed]")?.getBoundingClientRect();b&&p<=b.right-b.left&&(g<b.left?g=o.left+p<=b.right?o.left:b.left:g+p>b.right&&(g=o.right-p>=b.left?o.right-p:b.right-p));let A=p>=r.width-2*we?Math.max(0,(r.width-p)/2):Math.max(we,Math.min(g,r.width-we-p)),m=u?o.bottom+st:Math.max(we,o.top-st-h);e.style.left=`${Math.round(A)}px`,e.style.top=`${Math.round(m)}px`}function Qo(e,t,n,o={}){let r=o.align??"end";(0,j.useLayoutEffect)(()=>{let i=e.current;if(!t||!i)return;if(Li(i)&&!lt(i))try{i.showPopover(),Ni()}catch{}let a=0,d=u=>{u?.target instanceof Node&&i.contains(u.target)||(cancelAnimationFrame(a),a=requestAnimationFrame(()=>$t(i,n,{align:r})))};$t(i,n,{align:r}),addEventListener("resize",d),addEventListener("scroll",d,!0);let s=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>d());return s?.observe(i),()=>{if(cancelAnimationFrame(a),removeEventListener("resize",d),removeEventListener("scroll",d,!0),s?.disconnect(),i.isConnected&&lt(i))try{i.hidePopover()}catch{}}},[t,e,r])}var zt=new Set;function Di(e){return zt.add(e),()=>zt.delete(e)}function Ni(){for(let e of zt)if(!(!e.isConnected||!lt(e)))try{e.hidePopover(),e.showPopover()}catch{}}var ve=null,ji='button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])';function Gi(e){for(let t of e.querySelectorAll(ji))if(t.closest("[hidden]")===null&&getComputedStyle(t).visibility!=="hidden")return t;return e}var Bt=()=>{let e=document.activeElement;return e===null||e===document.body};function Wi(e,t={}){let{at:n,returnTo:o,onOpenChange:r}=t,i=t.popover!==!1,[a,d]=(0,j.useState)(!1),s=t.open??a,u=(0,j.useRef)(null),f=(0,j.useRef)(null),h=(0,j.useCallback)(y=>{u.current=y},[]),p=(0,j.useCallback)(y=>{f.current=y},[]),g=`graview-popover-${(0,j.useId)().replace(/:/g,"")}`,b=(0,j.useRef)({onOpenChange:r,returnTo:o,controlled:t.open!==void 0});b.current={onOpenChange:r,returnTo:o,controlled:t.open!==void 0};let A=(0,j.useCallback)(y=>{b.current.controlled||d(y),b.current.onOpenChange?.(y)},[]),m=(0,j.useCallback)(()=>{(document.querySelector(`[aria-controls="${g}"]`)??u.current??b.current.returnTo?.()??null)?.focus({preventScroll:!0})},[g]),v=(0,j.useCallback)(y=>{let x=f.current,P=typeof document>"u"?null:document.activeElement,D=P===null||P===document.body||x!==null&&x.contains(P);A(!1),!(!y||!D)&&(m(),requestAnimationFrame(()=>{Bt()&&m()}))},[A,m]);return Qo(f,i&&s,n??u,t.align?{align:t.align}:{}),(0,j.useEffect)(()=>{if(!i||!s)return;let y={name:e,close:()=>v(!1)};if(ve&&ve.close!==y.close&&ve.close(),ve=y,qt[e].focus==="into"){let R=f.current;R&&!R.contains(document.activeElement)&&Gi(R).focus({preventScroll:!0})}let x=R=>{R.key==="Escape"&&v(!0)},P=R=>{let I=R.target;if(!(I instanceof Node))return;let G=f.current;if(G?.contains(I)||u.current?.contains(I))return;let W=I instanceof Element?I.closest('[role="dialog"], [role="alertdialog"]'):null;W&&!(G&&W.contains(G))||(v(!1),qt[e].focus==="into"&&requestAnimationFrame(()=>{(Bt()||G!==null&&G.contains(document.activeElement))&&m()}))},D=null,L=null,E=R=>{let I=R.target;if(!(I instanceof Element))return;let G=f.current,W=I.closest('[role="dialog"], [role="alertdialog"]');!W||G&&(G.contains(W)||W.contains(G))||(D=W,v(!1))};return document.addEventListener("keydown",x),document.addEventListener("pointerdown",P,!0),document.addEventListener("focusin",E),()=>{document.removeEventListener("keydown",x),document.removeEventListener("pointerdown",P,!0),document.removeEventListener("focusin",E);let R=D;R&&typeof MutationObserver<"u"&&(L?.disconnect(),L=new MutationObserver(()=>{R.isConnected||(L?.disconnect(),requestAnimationFrame(()=>{(Bt()||document.activeElement.closest("[hidden]")!==null)&&m()}))}),L.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>L?.disconnect(),10*6e4)),ve?.close===y.close&&(ve=null)}},[i,s,e,v,m]),{open:s,setOpen:y=>y?A(!0):v(!0),toggle:()=>s?v(!0):A(!0),trigger:{ref:h,"aria-expanded":s,"aria-controls":g,"data-graview-popover-trigger":e},pane:{ref:p,id:g,popover:"manual",tabIndex:-1,"data-graview-popover":e,"data-graview-overlay":""}}}var be=C(N(),1);var er=(0,be.createContext)(null);function Fi(){let e=(0,be.useContext)(er),t=Gt(),n=(o,r,i)=>t?.setView(a=>ae(ae(pe(q(a,ne(o)),!1),"view",r),"filter",i?.filter??null));return(0,be.useMemo)(()=>e??{record:o=>{t&&(t.setView(r=>q(pe(r,!1),o)),t.setSelection([o]))},place:(o,r)=>{let i=t?.views.places().find(a=>a.as===o);i&&n(i.kind,i.as,r)},list:(o,r)=>n(o,null,r)},[e,t])}var xe=C(N(),1);var Ki=Kt(Ke(()=>(__graviewPreload(import.meta.url,["./chunk.BTSXYZ6Z.js","./chunk.SDO3U72B.js","./chunk.5ZMENPY4.js","./chunk.AJZBJBMO.js"]),import("./chunk.37ASLBGE.js"))));function Bi(e,t,n){let o,r=!1,i=()=>{let{hidden:d,removed:s}=t.current();o||r||d.length+s.length===0||(o=()=>{},Ki.load().then(u=>{r||(o=u.watchTidied(e,t,n))},String))};i();let a=t.onChange?.(i);return()=>{r=!0,a?.(),o?.()}}function qi(e,t){let[n,o]=(0,xe.useState)();return(0,xe.useEffect)(()=>t?Bi(e,t,r=>o([e,r])):void 0,[e,t]),n?.[0]===e?n[1]:e}var tr=C(N(),1),$i=(0,tr.createContext)(!1);var nr=C(N(),1),zi=(0,nr.createContext)(null);var or=C(N(),1),Ut='button:not([disabled]), a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])',Yt=e=>e instanceof HTMLElement&&(e.matches(Ut)||e.hasAttribute("tabindex")),Le=e=>typeof e.checkVisibility=="function"?e.checkVisibility():e.getClientRects().length>0;function Ui(e,t){let n=s=>s.replace(/["\\]/g,"\\$&"),o=t.getAttribute("data-testid"),r=t.getAttribute("data-graview-pick"),i=t.getAttribute("aria-label"),a=o?`[data-testid="${n(o)}"]`:r?`[data-graview-pick="${n(r)}"]`:i?`${t.tagName.toLowerCase()}[aria-label="${n(i)}"]`:null;if(!a)return null;let d=e.querySelector(a);return d&&Yt(d)&&Le(d)?d:null}var Yi=e=>e.isConnected&&Yt(e)&&!e.matches(":disabled")&&e instanceof HTMLElement&&Le(e);function rr(e,t){let n=t?Ui(e,t):null;if(n)return n;let o=e.querySelector("[data-graview-view][tabindex]");if(o&&Le(o))return o;for(let r of e.querySelectorAll(Ut))if(Le(r))return r;return Yt(e)&&Le(e)?e:null}function Zi(e){(0,or.useEffect)(()=>{let t=e.current;if(!t||typeof MutationObserver>"u")return;let n=[],o=m=>{let v=m.target;if(v instanceof Element){n=[];for(let y=v;y&&y!==t.parentElement;y=y.parentElement)n.push(y)}},r=!1,i=!1,a=t.ownerDocument,d=()=>!i&&a.defaultView!==null,s=(m,v)=>void setTimeout(()=>d()&&v(),m),u=m=>void requestAnimationFrame(()=>d()&&m()),f=m=>{if(r=!1,i)return;let v=a.activeElement;if(!(!(v===null||v===a.body||v===a.documentElement)||n.length===0)){if(Yi(n[0])){m&&n[0]instanceof HTMLElement&&n[0].focus({preventScroll:!0});return}for(let x of n.slice(1)){if(!x.isConnected)continue;let P=rr(x,n[0]);if(P){P.focus({preventScroll:!0}),n=[];return}}}},h=(m,v=Date.now()+2500)=>{s(100,()=>{f(m);let y=a.activeElement;(y===null||y===a.body||y===a.documentElement)&&n.length>0&&Date.now()<v&&h(m,v)})},p=()=>{r||n.length===0||(r=!0,s(60,()=>u(()=>{f(!1),h(!1)})))},g=m=>{if(!(m instanceof KeyboardEvent&&!["Enter"," ","Escape"].includes(m.key))){if(!(m instanceof KeyboardEvent)){let v=m.target instanceof Element?m.target.closest(Ut):null,y=a.activeElement,x=y===null||y===a.body||y===a.documentElement;if(v&&x&&t.contains(v)){n=[];for(let P=v;P&&P!==t.parentElement;P=P.parentElement)n.push(P);s(150,()=>u(()=>{f(!1),h(!1)}));return}}!(m instanceof KeyboardEvent)&&!(m.target instanceof Node&&n[0]?.contains(m.target))||s(150,()=>u(()=>{f(!0),h(!0)}))}},b=new MutationObserver(()=>{n.length>0&&!n[0].isConnected&&p()}),A=m=>{m.relatedTarget===null&&p()};return t.addEventListener("focusin",o),t.addEventListener("focusout",A),t.addEventListener("click",g),t.addEventListener("keydown",g),b.observe(t,{childList:!0,subtree:!0}),()=>{i=!0,t.removeEventListener("focusin",o),t.removeEventListener("focusout",A),t.removeEventListener("click",g),t.removeEventListener("keydown",g),b.disconnect()}},[e])}export{fe as a,te as b,$e as c,Ji as d,Qi as e,Bn as f,Kn as g,qn as h,gt as i,q as j,$n as k,ae as l,pe as m,ze as n,Ve as o,Ue as p,Ze as q,ht as r,ye as s,na as t,wr as u,ne as v,zn as w,se as x,Un as y,vr as z,oa as A,Yn as B,St as C,br as D,xr as E,Er as F,N as G,Tt as H,Kr as I,qr as J,yo as K,Qe as L,$r as M,Ie as N,go as O,zr as P,Ot as Q,Ce as R,si as S,li as T,di as U,Wo as V,yi as W,gi as X,Qa as Y,vi as Z,oe as _,Gt as $,ot as aa,bi as ba,xi as ca,Ei as da,jt as ea,er as fa,Fi as ga,Ai as ha,qo as ia,$o as ja,zo as ka,Uo as la,ki as ma,Pi as na,Xo as oa,Ri as pa,Kt as qa,qi as ra,$i as sa,zi as ta,Oi as ua,Vi as va,Ci as wa,he as xa,Zi as ya,_i as za,lt as Aa,Qo as Ba,Di as Ca,Wi as Da};
2
+ /*! Bundled license information:
3
+
4
+ react/cjs/react.production.js:
5
+ (**
6
+ * @license React
7
+ * react.production.js
8
+ *
9
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
10
+ *
11
+ * This source code is licensed under the MIT license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ *)
14
+
15
+ react/cjs/react-jsx-runtime.production.js:
16
+ (**
17
+ * @license React
18
+ * react-jsx-runtime.production.js
19
+ *
20
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
21
+ *
22
+ * This source code is licensed under the MIT license found in the
23
+ * LICENSE file in the root directory of this source tree.
24
+ *)
25
+ */
@@ -0,0 +1 @@
1
+ import"./chunk.ORXFUK6F.js";import{$ as W,G as K,O as E,P as j,R as C}from"./chunk.BTSXYZ6Z.js";import"./chunk.SDO3U72B.js";import{Q as R,Ua as T,tc as P}from"./chunk.5ZMENPY4.js";import{b as x}from"./chunk.AJZBJBMO.js";function N(a,t){return a.kind==="agent"?"agent":a.kind!=="human"?"app":a.onBehalfOf!==void 0?"person":a.id===void 0||t?.id===void 0||a.id===t.id?"you":"person"}var Y=a=>a.ops.filter(t=>t.withheld!==!0);function z(a,t={}){let r=a.batches().map(e=>{let s=e.ops[0],l=e.ops.at(-1),c=Y(e).length===0;return{seq:l.seq+1,from:s.seq,at:l.at,batch:e.id,maker:c?"person":N(e.author,t.me),author:c?void 0:e.author,said:e.intent,declaration:!1,withheld:c}}),i=[...a.log.epochs().filter(e=>e.change!==void 0).map(e=>({seq:e.seq,sentence:e.change,...e.at?{at:e.at}:{}})),...t.declarations??[]];for(let e of i){if(e.seq<a.log.horizon||e.seq>a.log.length)continue;let s=r.findIndex(l=>l.seq===e.seq);if(s>=0&&!r[s].withheld){r[s]={...r[s],declaration:!0,said:e.sentence};continue}r.push({seq:e.seq,from:e.seq,at:e.at,batch:void 0,maker:e.author?N(e.author,t.me):"app",author:e.author,said:e.sentence,declaration:!0,withheld:!1})}return r.sort((e,s)=>e.seq-s.seq||+(e.batch!==void 0)-+(s.batch!==void 0))}function I(a,t){let r=a.log.all(),i=new Map(r.map(e=>[e.id,e.seq]));return a.batches().filter(e=>!e.undone&&e.ops[0].seq>=t).filter(e=>!e.ops.every(s=>s.undoes!==void 0&&(i.get(s.undoes)??-1)>=t)).map(e=>e.id)}function B(a,t){return a.withheld?"Someone":a.maker==="you"?"you":a.author?T(a.author,t):"the app"}var d=x(K(),1);var o=x(C(),1),_={kind:"human"},G=[1,2,4,8],U=900,q={you:"You",person:"A person",agent:"An agent",app:"The app"},H={you:"var(--graview-accent)",person:"var(--graview-ink-muted)",agent:"var(--graview-activity, var(--graview-good))",app:"var(--graview-edge-bright)"};function X(a,t){return[...new Set([t,...a.map(r=>r.seq)])].sort((r,i)=>r-i)}function J(a,t){let r=0;for(let i=0;i<a.length;i++)a[i]<=t&&(r=i);return r}function Q(a,t,r){let i=I(a,t);if(i.length===0)return null;let e=a.canUndo(i);if(!e.ok)return null;let s=new Set(a.permittedMutations(r).map(l=>l.name));return e.ops.every(l=>l.mutation!==null&&s.has(l.mutation.name))?i:null}function oe({face:a}){let t=E(),r=W(),i=r?.principal??_,e=j(t.live,i),s=e.log.length,l=(0,d.useMemo)(()=>z(e,{me:i,...t.host?.declarations?{declarations:t.host.declarations}:{}}),[e,i,t.host,s]),c=(0,d.useMemo)(()=>X(l,e.log.horizon),[l,e]),f=t.past?.seq??s,h=J(c,f),y=c.length-1,k=[...l].reverse().find(n=>n.seq<=f&&n.seq>(c[h-1]??-1))??[...l].reverse().find(n=>n.seq<=f),[g,v]=(0,d.useState)(!1),[w,L]=(0,d.useState)(1),[A,$]=(0,d.useState)(null);(0,d.useEffect)(()=>{if(!g)return;if(h>=y){v(!1);return}let n=setTimeout(()=>t.show(c[h+1]),U/w);return()=>clearTimeout(n)},[g,h,y,w,c,t]);let D=(0,d.useMemo)(()=>t.past?Q(e,f,i):null,[t.past,e,f,i,s]),M=n=>B(n,{graph:e.graph,schema:e.schema,...r?.seats?{seats:r.seats}:{},...r?.people?{people:r.people}:{}}),u=t.past?t.past.at?R(t.past.at,r?.locale):"the start":null,S=k?`${M(k)==="you"?"You":M(k)}: ${k.said}`:"Nothing had happened yet",O=(0,d.useRef)(null);(0,d.useLayoutEffect)(()=>{let n=O.current,m=n?.parentElement;if(a!=="scene"||!n||!m)return;let p=()=>m.style.setProperty("--graview-sheet",`${Math.ceil(n.getBoundingClientRect().height)+24}px`);p();let b=typeof ResizeObserver>"u"?null:new ResizeObserver(p);return b?.observe(n),()=>{b?.disconnect(),m.style.removeProperty("--graview-sheet")}},[a]);let V=a==="scene"?{position:"absolute",left:"50%",bottom:12,transform:"translateX(-50%)",width:"min(720px, calc(100% - 32px))",zIndex:P("rail")}:{position:"sticky",top:0,zIndex:P("rail"),margin:"0 auto 12px",maxWidth:960,width:"100%"};return(0,o.jsxs)("section",{ref:O,"aria-label":"Timeline","data-testid":"timeline","data-graview-past":t.past?String(t.past.seq):"now","data-graview-offstage":"",style:{...V,boxSizing:"border-box",display:"grid",gap:8,padding:"10px 12px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontSize:"0.8125rem"},children:[(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px"},children:[(0,o.jsx)("strong",{"data-testid":"as-of",role:"status",style:{fontWeight:600},children:u?`As of ${u}`:"Now"}),(0,o.jsx)("span",{"data-testid":"timeline-caption",style:{color:"var(--graview-ink-muted)",minWidth:0,overflowWrap:"anywhere"},children:S}),u?(0,o.jsx)("span",{style:{color:"var(--graview-ink-faint)"},"data-testid":"past-read-only",children:"Nothing changes while you look back."}):null]}),(0,o.jsx)("div",{style:{position:"relative",height:22},"aria-hidden":"true",children:c.slice(1).map((n,m)=>{let p=[...l].reverse().find(F=>F.seq===n),b=y===0?0:(m+1)/y*100;return(0,o.jsx)("span",{"data-graview-tick":n,"data-maker":p.maker,...p.declaration?{"data-declaration":""}:{},title:`${q[p.maker]}: ${p.said}`,style:{position:"absolute",left:`calc(${b}% - 1px)`,bottom:0,width:p.declaration?4:2,height:p.declaration?22:12,borderRadius:2,background:p.declaration?"var(--graview-ink)":H[p.maker],opacity:n<=f?1:.45}},`${n}:${p.batch??"declaration"}`)})}),(0,o.jsx)("input",{type:"range","data-testid":"scrubber","aria-label":"Moment",min:0,max:y,step:1,value:h,"aria-valuetext":u?`As of ${u}. ${S}`:`Now. ${S}`,onChange:n=>{v(!1),t.show(c[Number(n.currentTarget.value)]??s)},style:{width:"100%",margin:0,accentColor:"var(--graview-accent)"}}),(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,o.jsx)("button",{type:"button","data-testid":"play","aria-pressed":g,onClick:()=>{!g&&h>=y&&t.show(c[0]),v(!g)},style:{minHeight:28,minWidth:64},children:g?"Pause":"Play"}),(0,o.jsxs)("label",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--graview-ink-muted)"},children:["Speed",(0,o.jsx)("select",{"data-testid":"speed",value:w,onChange:n=>L(Number(n.currentTarget.value)),style:{minHeight:28},children:G.map(n=>(0,o.jsxs)("option",{value:n,children:[n,"\xD7"]},n))})]}),(0,o.jsx)("span",{"aria-hidden":"true",style:{display:"inline-flex",gap:10,color:"var(--graview-ink-faint)",flexWrap:"wrap"},children:Object.keys(q).filter(n=>l.some(m=>m.maker===n)).map(n=>(0,o.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[(0,o.jsx)("span",{style:{width:8,height:8,borderRadius:2,background:H[n]}}),q[n]]},n))}),(0,o.jsxs)("span",{style:{marginLeft:"auto",display:"inline-flex",gap:8},children:[D?(0,o.jsx)("button",{type:"button","data-testid":"restore-here",title:"Take back every change since, as one change you can undo",onClick:()=>{$(null);try{e.undo([...D],{author:i,intent:u?`Restore to ${u}`:"Restore"}),t.show(null)}catch(n){$(n instanceof Error?n.message:String(n))}},style:{minHeight:28},children:"Restore to here"}):null,(0,o.jsx)("button",{type:"button","data-testid":"back-to-now",onClick:()=>t.show(null),style:{minHeight:28},children:"Back to now"})]})]}),A?(0,o.jsx)("span",{role:"alert","data-testid":"restore-refused",style:{color:"var(--graview-warn)"},children:A}):null]})}export{oe as Timeline};
@@ -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{r as b}from"./chunk.ORXFUK6F.js";import{G as w,J as P,R as p,_ as v,qa as R}from"./chunk.BTSXYZ6Z.js";import{a as A}from"./chunk.SDO3U72B.js";import{id as k}from"./chunk.5ZMENPY4.js";import{b as a}from"./chunk.AJZBJBMO.js";var L=a(p(),1),B=b.part(e=>(0,L.jsx)(e.ActivityRail,{calls:[]}),{quiet:!0});var l=a(w(),1),g=a(p(),1),C=R(A(()=>(__graviewPreload(import.meta.url,["./chunk.2NSTEREJ.js","./chunk.CAMQ7MYJ.js","./chunk.EWWJMS6G.js","./chunk.2RCNSHXK.js","./chunk.ZTMDU3OH.js","./chunk.RWB4235L.js","./chunk.UT6642FC.js","./chunk.67USHK26.js","./chunk.UIUHGA6W.js","./chunk.TI4OSTQV.js","./chunk.GZHZLJBF.js","./chunk.HHUCPVG5.js","./chunk.OJGHDWI6.js","./chunk.WXYUWBKX.js","./chunk.NSNGPQGT.js","./chunk.H5CZZZLX.js","./chunk.Z7JRBKA7.js","./chunk.ORXFUK6F.js","./chunk.BTSXYZ6Z.js","./chunk.SDO3U72B.js","./chunk.5ZMENPY4.js","./chunk.AJZBJBMO.js"]),import("./chunk.57OPL5WD.js")))),T=C.part((e,r)=>{let t=e.RecordInteractions;return(0,g.jsx)(t,{...r})},{quiet:!0});function F(e,r,t){let o=e.target;return(o.on==="record"||o.on==="field"?o.id===r:o.on==="selection"?o.ids.includes(r):o.on==="act"?o.id===r:!1)||e.offered.some(n=>n.id===`record:${r}`||n.id.startsWith(`fill:${r}:`))||(e.batches??[]).some(n=>t(n).includes(r))}function I({id:e,style:r,headingStyle:t,className:o}){let{ai:d,aiDesk:n,store:f}=v(),{entries:y}=P(n),s=d.off===!0;(0,l.useEffect)(()=>{s||n.load()},[n,s]);let S=f.log.length,m=(0,l.useMemo)(()=>{let x=u=>f.log.all().flatMap(h=>h.batch===u?h.writes:[]);return y.filter(u=>F(u,e,x))},[y,e,f,S]);return s||m.length===0?null:(0,g.jsx)(l.Suspense,{fallback:null,children:(0,g.jsx)(T,{entries:m,...r?{style:r}:{},...t?{headingStyle:t}:{},...o?{className:o}:{}})})}var c=a(w(),1),i=a(p(),1);function po({context:e,stop:r,title:t,label:o,style:d,className:n,children:f,...y}){let s=k(e.views?.arrangement?.()),S=f??(0,i.jsxs)(i.Fragment,{children:["In ",s==="Scene"?"the scene":s.replace(/^The /,"the ")," ",(0,i.jsx)("span",{"aria-hidden":"true",children:"\u2197"})]}),m=o?{"aria-label":o}:{};if(e.overview){let x=e.overview;return(0,i.jsx)("a",{href:r,...y,...m,...t?{title:t}:{},style:d,...n?{className:n}:{},onClick:u=>{u.preventDefault(),x(r)},children:S})}return e.embedded?null:(0,i.jsx)("a",{href:`${e.sceneHref??"/"}${r}`,...y,...m,...t?{title:t}:{},style:d,...n?{className:n}:{},children:S})}function lo(){return(0,i.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:e=>{e.preventDefault();let r=new URL(window.location.href);r.searchParams.set("fresh","1"),window.location.assign(r.toString())},style:{color:"inherit",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24},children:"Start fresh"})}function co(e){let r=(0,c.useRef)(0),t=(0,c.useCallback)(o=>e.subscribe(()=>{r.current+=1,o()}),[e]);return(0,c.useSyncExternalStore)(t,()=>r.current,()=>0)}export{B as a,I as b,po as c,lo as d,co as e};
@@ -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 t}from"./chunk.SDO3U72B.js";var d=t(()=>(__graviewPreload(import.meta.url,["./chunk.HFYUAK5Z.js","./chunk.GAFYE37S.js","./chunk.STBJV6HJ.js","./chunk.F5UVEF2R.js","./chunk.OYMM2UWE.js","./chunk.FGDHEVH4.js","./chunk.M5QFUGGG.js","./chunk.PXQVXBNG.js","./chunk.SDO3U72B.js","./chunk.5ZMENPY4.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZR5KVYWZ.js")));function v(i,r){let e=!1,n=()=>{window.removeEventListener("online",n),e||o()},o=()=>void i().then(m=>{e||r(m)},()=>{e||window.addEventListener("online",n)});return o(),()=>{e=!0,window.removeEventListener("online",n)}}export{d as a,v as b};
@@ -0,0 +1 @@
1
+ import"./chunk.NSNGPQGT.js";import"./chunk.H5CZZZLX.js";import{b as m}from"./chunk.Z7JRBKA7.js";import"./chunk.ORXFUK6F.js";import{R as p}from"./chunk.BTSXYZ6Z.js";import"./chunk.SDO3U72B.js";import{T as l}from"./chunk.5ZMENPY4.js";import{b as f}from"./chunk.AJZBJBMO.js";var a=f(p(),1);function N({states:e,definition:v}){let s=e.values.reduce((t,n)=>t+n.count,0),u=t=>t===null?"with none":m(v,e.field,t).toLowerCase(),c=e.values.filter(t=>t.count>0).map(t=>`${l(t.count)} ${u(t.value)}`).join(", ");return s===0?null:(0,a.jsx)("div",{className:"graview-district-states",role:"img","aria-label":c,title:c,children:e.values.map((t,n)=>{if(t.count===0)return null;let y=e.values.filter(r=>r.count>0).length,w=t.count/s*(168-(y-1)),o=l(t.count),i=`${o} ${u(t.value)}`,d=r=>r.length*6.2+8<=w;return(0,a.jsx)("span",{"data-graview-tier":t.tier,style:{flexGrow:t.count},title:i,children:d(i)?i:d(o)?o:""},n)})})}export{N as StatesBar};
@@ -1 +1 @@
1
- import{h as o,m as u}from"./chunk.MQ7FNHXG.js";function c(t,n,i){let e=r=>encodeURIComponent(r);return`${o}${e(t)}:${e(n)}:${e(i)}`}function S(t,n,i){let e=new Set(t.shown??[]);if(i?e.add(n):e.delete(n),e.size===0){let{shown:r,...w}=t;return w}return{...t,shown:[...e].sort()}}function l(t,n){if(n===null||n.trim().length===0){let{q:i,...e}=t;return e}return{...t,q:n}}function p(t){let n=t.q!==void 0&&t.within?.q===t.q;return l(n?u(t,"q",null):t,null)}function h(t,n){if(!n){let{past:i,...e}=t;return e}return{...t,past:!0}}function f(t,n){if(n===null||n.x===0&&n.y===0){let{pan:i,...e}=t;return e}return{...t,pan:n}}function d(t,n,i){let e={...t.pins};return i===null?delete e[n]:e[n]=i,{...t,pins:e}}export{c as a,S as b,l as c,p as d,h as e,f,d as g};
1
+ import{g as o,l as u}from"./chunk.BTSXYZ6Z.js";function c(t,n,i){let e=r=>encodeURIComponent(r);return`${o}${e(t)}:${e(n)}:${e(i)}`}function S(t,n,i){let e=new Set(t.shown??[]);if(i?e.add(n):e.delete(n),e.size===0){let{shown:r,...w}=t;return w}return{...t,shown:[...e].sort()}}function l(t,n){if(n===null||n.trim().length===0){let{q:i,...e}=t;return e}return{...t,q:n}}function p(t){let n=t.q!==void 0&&t.within?.q===t.q;return l(n?u(t,"q",null):t,null)}function h(t,n){if(!n){let{past:i,...e}=t;return e}return{...t,past:!0}}function f(t,n){if(n===null||n.x===0&&n.y===0){let{pan:i,...e}=t;return e}return{...t,pan:n}}function d(t,n,i){let e={...t.pins};return i===null?delete e[n]:e[n]=i,{...t,pins:e}}export{c as a,S as b,l as c,p as d,h as e,f,d as g};
@@ -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{s as P}from"./chunk.HHUCPVG5.js";import{$ as I,G as M,O as w,R as y,_ as m,qa as S,s as b,w as T,x as A}from"./chunk.BTSXYZ6Z.js";import{a as p}from"./chunk.SDO3U72B.js";import{b as f}from"./chunk.AJZBJBMO.js";var C=f(M(),1),h=f(y(),1),x=S(p(()=>(__graviewPreload(import.meta.url,["./chunk.ORXFUK6F.js","./chunk.BTSXYZ6Z.js","./chunk.SDO3U72B.js","./chunk.5ZMENPY4.js","./chunk.AJZBJBMO.js"]),import("./chunk.BYKR7NEE.js")))),O=x.part((e,n)=>(0,h.jsx)(e.Timeline,{...n}),{what:"The timeline"}),q=()=>x.prefetch();function K({face:e}){return w()?.open?(0,h.jsx)(C.Suspense,{fallback:null,children:(0,h.jsx)(O,{face:e})}):null}var i=f(M(),1),u=f(y(),1),v=new WeakMap,D=e=>{let n=v.get(e);return n||v.set(e,n={ask:null,doors:[],listeners:new Set}),n},k=e=>{for(let n of e.listeners)n()};function g(e,n){let t=D(e);t.ask=n,k(t)}var N=S(p(()=>(__graviewPreload(import.meta.url,["./chunk.CMN6VVK2.js","./chunk.CC47O2DW.js","./chunk.2IX3CZNP.js","./chunk.6DHHUBSC.js","./chunk.ORXFUK6F.js","./chunk.BTSXYZ6Z.js","./chunk.SDO3U72B.js","./chunk.5ZMENPY4.js","./chunk.AJZBJBMO.js"]),import("./chunk.XLZ2QRRS.js")))),B=N.part((e,n)=>{let t=e.NotifySheet;return(0,u.jsx)(t,{...n})},{what:"Notify me"}),W=N.part((e,n)=>{let t=e.NotifiedList;return(0,u.jsx)(t,{...n})},{quiet:!0}),E=(e,n)=>n===void 0&&(e.onBehalfOf??e).id!==void 0;function F(e,n,t){let c=d=>t.tryDefinition(d)?.noun??d.replace(/[-_]+/g," "),o=e.on!==void 0?e.on:e.about.length===1?e.about[0]:void 0;if(e.act!==void 0){let d=o!==void 0&&n(o)!==void 0?o:void 0;return{label:"Notify me when someone does this\u2026",choices:[{on:"act",act:e.act,...d!==void 0?{record:d}:{}},...d!==void 0?[{on:"act",act:e.act}]:[]]}}if(o===void 0)return null;let s=n(o);if(s!==void 0)return{label:"Notify me when this changes\u2026",choices:[{on:"changed",record:o},{on:"act",record:o},{on:"reaches",kind:s,condition:"",record:o}]};let r=b(o)!==null?[b(o)]:T(o)?A(o):[];if(r.length!==1||!t.kinds.includes(r[0]))return null;let l=r[0],a=c(l);return{label:`Notify me when ${/^[aeiou]/i.test(a)?"an":"a"} ${a} is added\u2026`,choices:[{on:"created",kind:l},{on:"changed",kind:l},{on:"reaches",kind:l,condition:""}]}}function L(){let{store:e,principal:n,subscriptions:t,signIn:c}=m(),o=E(n,c);return(0,i.useMemo)(()=>o?s=>{let r=F(s,a=>e.graph.getNode(a)?.kind,e.schema);return r?{id:"notify",items:[{id:"notify-me",label:r.label,run:()=>g(t,{choices:r.choices,returnTo:s.element??null})}],prepare:()=>N.prefetch()}:null}:null,[o,e,t])}var z=[];function U({children:e}){let n=L(),t=(0,i.useMemo)(()=>n?[n]:z,[n]);return(0,u.jsx)(P,{sections:t,children:e})}function V(){let{subscriptions:e}=m(),n=(0,i.useId)(),t=D(e);(0,i.useEffect)(()=>(t.doors.push(n),k(t),()=>{t.doors.splice(t.doors.indexOf(n),1),k(t)}),[t,n]);let c=(0,i.useMemo)(()=>r=>(t.listeners.add(r),()=>void t.listeners.delete(r)),[t]),o=(0,i.useSyncExternalStore)(c,()=>t.ask,()=>null),s=(0,i.useSyncExternalStore)(c,()=>t.doors[0]===n,()=>!1);return!o||!s?null:(0,u.jsx)(i.Suspense,{fallback:null,children:(0,u.jsx)(B,{ask:o,close:()=>g(e,null)})})}function X({choices:e,label:n="Notify me",style:t,className:c,testId:o="notify-me"}){let{principal:s,subscriptions:r,signIn:l}=m();return E(s,l)?(0,u.jsx)("button",{type:"button","data-testid":o,className:c,onClick:a=>g(r,{choices:e,returnTo:a.currentTarget}),style:t,children:n}):null}function G(){let e=I(),n=e?.subscriptions,t=e?(e.principal.onBehalfOf??e.principal).id:void 0,[c,o]=(0,i.useState)(0);return(0,i.useEffect)(()=>{if(t===void 0||!n)return;let s=!0,r=()=>void Promise.resolve(n.list(t)).then(a=>s&&o(a.length),()=>s&&o(0));r();let l=n.onChange?.(r);return()=>{s=!1,l?.()}},[n,t]),c}function Y({style:e}){return G()===0?null:(0,u.jsx)(i.Suspense,{fallback:null,children:(0,u.jsx)(W,{...e?{style:e}:{}})})}export{q as a,K as b,L as c,U as d,V as e,X as f,G as g,Y as h};