graview 0.1.51 → 0.1.53

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 (214) hide show
  1. package/dist/preview/chunk.2IKVO743.js +1 -0
  2. package/dist/preview/{chunk.UK5F3S2N.js → chunk.2LQ37DC2.js} +1 -1
  3. package/dist/preview/{chunk.ALCH5H7U.js → chunk.3377DLPA.js} +1 -1
  4. package/dist/preview/chunk.34Q7OKK3.js +1 -0
  5. package/dist/preview/{chunk.5ZAK57JA.js → chunk.36XV4ZMC.js} +2 -2
  6. package/dist/preview/chunk.3FRVG6JW.js +32 -0
  7. package/dist/preview/{chunk.3MU37W5D.js → chunk.3FUFVVR4.js} +1 -1
  8. package/dist/preview/chunk.3Y7BDRP3.js +1 -0
  9. package/dist/preview/{chunk.3TVAE7LE.js → chunk.4DCPB67O.js} +1 -1
  10. package/dist/preview/chunk.4DFO43VM.js +1 -0
  11. package/dist/preview/chunk.4QVZXCV5.js +1 -0
  12. package/dist/preview/chunk.4SVAHPJA.js +1 -0
  13. package/dist/preview/chunk.52Y37IAD.js +1 -0
  14. package/dist/preview/chunk.56UFDIX5.js +1 -0
  15. package/dist/preview/chunk.5E4UGVAD.js +1 -0
  16. package/dist/preview/chunk.5H3VCAPN.js +1 -0
  17. package/dist/preview/chunk.5K5D4IMM.js +1 -0
  18. package/dist/preview/{chunk.DQNN5FE5.js → chunk.5XFRWXYQ.js} +1 -1
  19. package/dist/preview/{chunk.PYRJDTVS.js → chunk.65F3DF5Q.js} +1 -1
  20. package/dist/preview/{chunk.CMEETACI.js → chunk.6CVW53WA.js} +1 -1
  21. package/dist/preview/chunk.6ESAZJBN.js +1 -0
  22. package/dist/preview/chunk.6S3B4XC4.js +1 -0
  23. package/dist/preview/{chunk.P4CLT32V.js → chunk.6W2DUW5S.js} +5 -5
  24. package/dist/preview/chunk.6YGRRXJB.js +2 -0
  25. package/dist/preview/{chunk.CQPNDJAC.js → chunk.72Q4R7N6.js} +1 -1
  26. package/dist/preview/chunk.7BXOQEUP.js +1 -0
  27. package/dist/preview/{chunk.OJ64WTLW.js → chunk.7NFCI4LH.js} +2 -2
  28. package/dist/preview/{chunk.EA2NMVRE.js → chunk.7R6GXJS4.js} +1 -1
  29. package/dist/preview/chunk.A2RQFAZ6.js +1 -0
  30. package/dist/preview/{chunk.TNL2BVCH.js → chunk.AQJD23AN.js} +1 -1
  31. package/dist/preview/{chunk.NQ26KMSQ.js → chunk.ASCTAUFD.js} +1 -1
  32. package/dist/preview/chunk.B3T4N2XM.js +25 -0
  33. package/dist/preview/chunk.B3WVCSW5.js +1 -0
  34. package/dist/preview/{chunk.AL7LFNOS.js → chunk.BB5XKTVC.js} +1 -1
  35. package/dist/preview/{chunk.LYIHPVDZ.js → chunk.BG2SC77J.js} +1 -1
  36. package/dist/preview/{chunk.353CGK6C.js → chunk.BPPDBPTL.js} +1 -1
  37. package/dist/preview/chunk.BQHRZJ5Z.js +1 -0
  38. package/dist/preview/{chunk.W2DKFQ6R.js → chunk.CANTHIRO.js} +1 -1
  39. package/dist/preview/chunk.CIUQWCU4.js +1 -0
  40. package/dist/preview/chunk.CSA6SWTI.js +1 -0
  41. package/dist/preview/{chunk.GJQF7I22.js → chunk.CWPRQSED.js} +1 -1
  42. package/dist/preview/{chunk.4EZFOZBA.js → chunk.CYP5KXIQ.js} +1 -1
  43. package/dist/preview/chunk.D3A24PQ6.js +1 -0
  44. package/dist/preview/{chunk.7RIFDWDF.js → chunk.DQPEVPKQ.js} +1 -1
  45. package/dist/preview/{chunk.XWXYC3BJ.js → chunk.DUZS52WX.js} +1 -1
  46. package/dist/preview/chunk.E52UTLQ2.js +1 -0
  47. package/dist/preview/{chunk.2534FLZZ.js → chunk.E647LWH5.js} +1 -1
  48. package/dist/preview/chunk.EG2N5F6L.js +1 -0
  49. package/dist/preview/{chunk.SPU3BVAO.js → chunk.EZXGVTT2.js} +1 -1
  50. package/dist/preview/chunk.F5RN6YXG.js +4 -0
  51. package/dist/preview/chunk.FBRARPGR.js +4 -0
  52. package/dist/preview/{chunk.XCCBUWMC.js → chunk.FCAKLO5U.js} +1 -1
  53. package/dist/preview/{chunk.ACB4TD4W.js → chunk.FGJM4LJO.js} +1 -1
  54. package/dist/preview/{chunk.WESWDXRW.js → chunk.FJN4OGAS.js} +1 -1
  55. package/dist/preview/chunk.FXNUR5JI.js +88 -0
  56. package/dist/preview/chunk.G226CUJQ.js +1 -0
  57. package/dist/preview/chunk.G6DISMVT.js +67 -0
  58. package/dist/preview/{chunk.SRFZKDQ6.js → chunk.GANAZIRD.js} +1 -1
  59. package/dist/preview/{chunk.SJKHVIHA.js → chunk.GBIVIHGD.js} +19 -14
  60. package/dist/preview/chunk.GGHZEAAT.js +1 -0
  61. package/dist/preview/chunk.GPYZR6HE.js +1 -0
  62. package/dist/preview/{chunk.JI2UVZUU.js → chunk.GYO57LKD.js} +1 -1
  63. package/dist/preview/{chunk.MN6WHE4B.js → chunk.GZBODS7Z.js} +1 -1
  64. package/dist/preview/chunk.GZWC72HS.js +1 -0
  65. package/dist/preview/{chunk.2W2YVB6X.js → chunk.H2B3SEI7.js} +1 -1
  66. package/dist/preview/{chunk.ESK3UZRC.js → chunk.H6EMDQP5.js} +1 -1
  67. package/dist/preview/chunk.HAIHXBVX.js +1 -0
  68. package/dist/preview/{chunk.ESSENNHM.js → chunk.HBVURYWY.js} +2 -2
  69. package/dist/preview/{chunk.ZZODDJYK.js → chunk.HDXDYS4C.js} +1 -1
  70. package/dist/preview/chunk.HE545Z6I.js +1 -0
  71. package/dist/preview/chunk.HIDLE6BN.js +18 -0
  72. package/dist/preview/chunk.HIFLBWQJ.js +9 -0
  73. package/dist/preview/chunk.I62MCBQM.js +1 -0
  74. package/dist/preview/chunk.I6SUHXJF.js +1 -0
  75. package/dist/preview/chunk.I6W3IQ4W.js +1 -0
  76. package/dist/preview/chunk.ICYJ7QJG.js +2 -0
  77. package/dist/preview/{chunk.Z7N3MJ36.js → chunk.IYVBJDR7.js} +1 -1
  78. package/dist/preview/{chunk.FFCUZPTC.js → chunk.J6OT74RM.js} +1 -1
  79. package/dist/preview/{chunk.K7RKWB2K.js → chunk.JCJ7NTW4.js} +1 -1
  80. package/dist/preview/{chunk.4T67XS2D.js → chunk.JKCLYLT4.js} +1 -1
  81. package/dist/preview/chunk.JQTO52Q7.js +1 -0
  82. package/dist/preview/chunk.JRU5BT7K.js +5 -0
  83. package/dist/preview/{chunk.XCQ7ZPR5.js → chunk.K7WME4P4.js} +1 -1
  84. package/dist/preview/{chunk.APFRPN5S.js → chunk.KAKJYAHM.js} +1 -1
  85. package/dist/preview/chunk.KCM2VOC7.js +1 -0
  86. package/dist/preview/{chunk.CTOBNZLM.js → chunk.KWMBRB6O.js} +1 -1
  87. package/dist/preview/{chunk.KVEDMKUN.js → chunk.KY7QD22S.js} +1 -1
  88. package/dist/preview/{chunk.S32AGJ3W.js → chunk.LAOZEYYQ.js} +1 -1
  89. package/dist/preview/{chunk.7GAC7U34.js → chunk.LCG3VLCB.js} +1 -1
  90. package/dist/preview/{chunk.IUIDDNN3.js → chunk.LDLWYAHK.js} +1 -1
  91. package/dist/preview/chunk.LEKML4S4.js +1 -0
  92. package/dist/preview/{chunk.MY5OXSS7.js → chunk.MDIAWTNK.js} +1 -1
  93. package/dist/preview/chunk.MKWVNW4Q.js +35 -0
  94. package/dist/preview/{chunk.3H7YIKKC.js → chunk.MSPRCR3Q.js} +1 -1
  95. package/dist/preview/{chunk.VICCAWAN.js → chunk.MT45H2T5.js} +1 -1
  96. package/dist/preview/chunk.MXTDQXVW.js +1 -0
  97. package/dist/preview/{chunk.WQLAIEWJ.js → chunk.N6A3DIOY.js} +1 -1
  98. package/dist/preview/{chunk.FU4YSVWX.js → chunk.NAEEPUWJ.js} +1 -1
  99. package/dist/preview/{chunk.KK46XLGU.js → chunk.NCTTPW7A.js} +1 -1
  100. package/dist/preview/chunk.OCWZJNZF.js +1 -0
  101. package/dist/preview/chunk.OP3ZUI4W.js +1 -0
  102. package/dist/preview/{chunk.U7SNDY3F.js → chunk.OPKXCL5R.js} +1 -1
  103. package/dist/preview/chunk.OXLYDXQV.js +1 -0
  104. package/dist/preview/{chunk.6KYWJXZR.js → chunk.OZYZBRWO.js} +1 -1
  105. package/dist/preview/chunk.P2W727C7.js +1 -0
  106. package/dist/preview/{chunk.T3RTFTOZ.js → chunk.P7FN3SFB.js} +1 -1
  107. package/dist/preview/{chunk.NVRK6A7T.js → chunk.PEA4D66Y.js} +1 -1
  108. package/dist/preview/chunk.Q5JVKSEN.js +1 -0
  109. package/dist/preview/chunk.QATG5HNV.js +1 -0
  110. package/dist/preview/{chunk.NZDHXREL.js → chunk.R3DWF35R.js} +1 -1
  111. package/dist/preview/{chunk.BYY7YXBI.js → chunk.RIS3OKAI.js} +1 -1
  112. package/dist/preview/{chunk.GMAXA5GV.js → chunk.RUTZEEBR.js} +1 -1
  113. package/dist/preview/{chunk.OU5TRY4N.js → chunk.S2ATSY6P.js} +1 -1
  114. package/dist/preview/{chunk.MX3Y3LPH.js → chunk.S6TN3MLY.js} +1 -1
  115. package/dist/preview/{chunk.IE4ZJQV3.js → chunk.T56SOSIR.js} +4 -4
  116. package/dist/preview/chunk.THL67D77.js +1 -0
  117. package/dist/preview/{chunk.SSAY4ITS.js → chunk.TLQTDKOL.js} +2 -2
  118. package/dist/preview/{chunk.FKJ3HIA5.js → chunk.TRPPN2GD.js} +1 -1
  119. package/dist/preview/{chunk.OW72XZF4.js → chunk.TTFYXKLI.js} +1 -1
  120. package/dist/preview/{chunk.HVX7LFWR.js → chunk.TXEWSZGO.js} +1 -1
  121. package/dist/preview/chunk.U4T4Y2MT.js +1 -0
  122. package/dist/preview/chunk.ULTYDYTS.js +19 -0
  123. package/dist/preview/chunk.UQ4CASST.js +1 -0
  124. package/dist/preview/chunk.UQENE3VE.js +1 -0
  125. package/dist/preview/chunk.USAGE5C6.js +28 -0
  126. package/dist/preview/{chunk.RMMJQYJJ.js → chunk.UVMLX4US.js} +1 -1
  127. package/dist/preview/{chunk.2VJ52LGS.js → chunk.UXNZPPWR.js} +1 -1
  128. package/dist/preview/chunk.UYCPQ6IW.js +1 -0
  129. package/dist/preview/chunk.V6X3U3JF.js +1 -0
  130. package/dist/preview/{chunk.K7ECYKZL.js → chunk.VOHDRH3P.js} +1 -1
  131. package/dist/preview/{chunk.HFKGND5Q.js → chunk.VRJ4TULC.js} +1 -1
  132. package/dist/preview/{chunk.GLTWLQ6L.js → chunk.VTCPA4V4.js} +1 -1
  133. package/dist/preview/chunk.VTRI2MT2.js +2 -0
  134. package/dist/preview/chunk.W54NXXC5.js +293 -0
  135. package/dist/preview/{chunk.MG3DMURZ.js → chunk.WDEMPWS4.js} +1 -1
  136. package/dist/preview/chunk.XBNASVTY.js +1 -0
  137. package/dist/preview/{chunk.B4PUI3GO.js → chunk.XDEKL6TJ.js} +1 -1
  138. package/dist/preview/chunk.XE72DFBV.js +13 -0
  139. package/dist/preview/{chunk.UWFEXEY3.js → chunk.XFIZLWYA.js} +1 -1
  140. package/dist/preview/{chunk.76QSPWSJ.js → chunk.XXCT6DLX.js} +1 -1
  141. package/dist/preview/{chunk.JX2C3HVD.js → chunk.Y4VOCJ7R.js} +1 -1
  142. package/dist/preview/chunk.YA7ZMGOL.js +1 -0
  143. package/dist/preview/{chunk.B7LBG4UP.js → chunk.YI7WHBAD.js} +2 -2
  144. package/dist/preview/{chunk.WFHFWJ6E.js → chunk.Z4YSCHZT.js} +1 -1
  145. package/dist/preview/{chunk.B6LKLV32.js → chunk.ZQWKS6K5.js} +1 -1
  146. package/dist/preview/{chunk.R5R7CLOU.js → chunk.ZYYM52N5.js} +1 -1
  147. package/dist/preview/index.html +50 -50
  148. package/dist/preview/page.js +2 -2
  149. package/package.json +6 -6
  150. package/dist/preview/chunk.2W45NM7Q.js +0 -9
  151. package/dist/preview/chunk.32BOL7OL.js +0 -1
  152. package/dist/preview/chunk.34HGT7HQ.js +0 -1
  153. package/dist/preview/chunk.3SBTQ66X.js +0 -1
  154. package/dist/preview/chunk.4N5R4K6O.js +0 -1
  155. package/dist/preview/chunk.5ON3JSAK.js +0 -1
  156. package/dist/preview/chunk.7G4M2PX3.js +0 -5
  157. package/dist/preview/chunk.7NQROWHU.js +0 -1
  158. package/dist/preview/chunk.AJAMTRZ3.js +0 -1
  159. package/dist/preview/chunk.AL45OI4A.js +0 -1
  160. package/dist/preview/chunk.AZOW57MT.js +0 -1
  161. package/dist/preview/chunk.BRDAO2OF.js +0 -4
  162. package/dist/preview/chunk.BV6HKTHK.js +0 -1
  163. package/dist/preview/chunk.CI4DEKPX.js +0 -1
  164. package/dist/preview/chunk.CUB4IAUJ.js +0 -1
  165. package/dist/preview/chunk.CUN4VN42.js +0 -1
  166. package/dist/preview/chunk.CV55N3Y6.js +0 -1
  167. package/dist/preview/chunk.CXC5FOIO.js +0 -1
  168. package/dist/preview/chunk.DEH6O3K4.js +0 -28
  169. package/dist/preview/chunk.DUY27OJV.js +0 -1
  170. package/dist/preview/chunk.E2R6VFZX.js +0 -1
  171. package/dist/preview/chunk.ET3XJDPX.js +0 -1
  172. package/dist/preview/chunk.FEIJ7ETK.js +0 -1
  173. package/dist/preview/chunk.FG5ZFYYL.js +0 -1
  174. package/dist/preview/chunk.FTBH7CPZ.js +0 -1
  175. package/dist/preview/chunk.FYDDFOSD.js +0 -35
  176. package/dist/preview/chunk.G446PWV6.js +0 -1
  177. package/dist/preview/chunk.GRYS6VSF.js +0 -1
  178. package/dist/preview/chunk.GYTVL6GR.js +0 -359
  179. package/dist/preview/chunk.HASVT7IC.js +0 -1
  180. package/dist/preview/chunk.IBJBCZKG.js +0 -1
  181. package/dist/preview/chunk.IFL2MYTQ.js +0 -1
  182. package/dist/preview/chunk.JBR66TUP.js +0 -1
  183. package/dist/preview/chunk.JG2FGZF2.js +0 -18
  184. package/dist/preview/chunk.JMDKAP23.js +0 -1
  185. package/dist/preview/chunk.KOBCLWPC.js +0 -1
  186. package/dist/preview/chunk.KQSD5MLY.js +0 -1
  187. package/dist/preview/chunk.KRODTMGR.js +0 -1
  188. package/dist/preview/chunk.KYKHZZT7.js +0 -1
  189. package/dist/preview/chunk.MCFLCC42.js +0 -12
  190. package/dist/preview/chunk.MMVCZOEX.js +0 -32
  191. package/dist/preview/chunk.MRXQBEPQ.js +0 -1
  192. package/dist/preview/chunk.N5XONWU2.js +0 -1
  193. package/dist/preview/chunk.NNUUD26E.js +0 -1
  194. package/dist/preview/chunk.OHDJYGH7.js +0 -2
  195. package/dist/preview/chunk.OPCBZNKF.js +0 -19
  196. package/dist/preview/chunk.PMV6XVVZ.js +0 -1
  197. package/dist/preview/chunk.PPZ2TOB5.js +0 -1
  198. package/dist/preview/chunk.QEQQXWYU.js +0 -1
  199. package/dist/preview/chunk.QPAJCRFB.js +0 -1
  200. package/dist/preview/chunk.RNOBACJ6.js +0 -1
  201. package/dist/preview/chunk.S4CKKT3C.js +0 -1
  202. package/dist/preview/chunk.SJYQ72EC.js +0 -1
  203. package/dist/preview/chunk.SKG4IHT5.js +0 -88
  204. package/dist/preview/chunk.TBSPEO2L.js +0 -1
  205. package/dist/preview/chunk.TMYGLXR6.js +0 -25
  206. package/dist/preview/chunk.TVWN5I4M.js +0 -1
  207. package/dist/preview/chunk.UCUWEYKM.js +0 -1
  208. package/dist/preview/chunk.UIWI4GKW.js +0 -1
  209. package/dist/preview/chunk.UVAWWCFW.js +0 -1
  210. package/dist/preview/chunk.V4GAOZAW.js +0 -1
  211. package/dist/preview/chunk.XZVPVAIS.js +0 -1
  212. package/dist/preview/chunk.Y2ZBVWII.js +0 -1
  213. package/dist/preview/chunk.Y3LTHEN7.js +0 -1
  214. package/dist/preview/chunk.Y5AMZBHA.js +0 -4
@@ -1 +0,0 @@
1
- import{a as ve,b as qe,c as Ie,d as pe,e as R,f as fe,h as Ve}from"./chunk.76QSPWSJ.js";import{h as Le,i as Ue,j as We}from"./chunk.XCQ7ZPR5.js";import{a as se,b as ie,c as H,d as Be,e as J,g as ne,h as Ze}from"./chunk.NVRK6A7T.js";import{c as _e,h as y,i as Ne,j as le}from"./chunk.FKJ3HIA5.js";import{A as Re,Aa as Fe,Ha as De,Ia as ee,Ja as ce,Rb as Ke,Sb as de,Tb as Me,Ub as Pe,Vb as Te,b as W,c as L,e as xe,f as Ee,g as q,h as O,k as C,kc as Ge,l as X,lc as Ce,m as _,n as Ae,o as U,p as K,r as $,s as Q,t as x,u as E,v as I,w as P,x as n,y as M,z as Z}from"./chunk.P4CLT32V.js";var ue=e=>Object.entries(e).map(([s,r])=>[s,Object.keys(ee(r?.edges))]),me=(e,s)=>Me(e,ue(s));function Ye(e){return[...Object.keys(e.acts??{}),...Object.keys(e.kinds).flatMap(s=>Ke(s)),...Pe(ue(e.kinds))]}var V=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function He(e){if(!V(e)||!V(e.kinds))return e;let s;try{let f=Object.fromEntries(Object.entries(e.kinds).map(([z,i])=>[z,V(i)&&V(i.edges)?{edges:i.edges}:{}]));s=Ye({acts:V(e.acts)?e.acts:{},kinds:f})}catch{return e}let r=new Set(s),t=!1,a=f=>{if(typeof f!="string"||r.has(f))return f;let z=Ge(f,s);return z===void 0?f:(t=!0,z)},d=V(e.policy)&&Array.isArray(e.policy.grants)?{...e.policy,grants:e.policy.grants.map(f=>V(f)&&Array.isArray(f.mutations)?{...f,mutations:f.mutations.map(a)}:f)}:void 0,u=V(e.rules)?Object.fromEntries(Object.entries(e.rules).map(([f,z])=>[f,V(z)&&Array.isArray(z.repairs)?{...z,repairs:z.repairs.map(i=>V(i)?{...i,act:a(i.act)}:i)}:z])):void 0;return t?{...e,...d?{policy:d}:{},...u?{rules:u}:{}}:e}function ge(e,s){let r=Ce(e,Ye(s));return r&&r!==e?`did you mean "${r}"?`:void 0}var he="graview-document",be=1,ke=256*1024,te=64*1024,ze=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ye=/^[a-z][A-Za-z0-9]*$/,zn=new Set(["id","kind"]),yn=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,hn=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"];function bn(){let e=k=>k in Object.prototype,s=Z(k=>!e(k),"every object already has this name \u2014 choose another"),r=(k,N)=>[...k===void 0?[]:[Ee(k)],...N===void 0?[]:[xe(N)]],t=(k,N)=>O().check(...r(k,N)),a=(k,N,gn)=>K(k).check(...r(N,gn)),d=k=>O().check(q(ze,`${k} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),u=O().check(q(yn,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),s),f=O().check(q(ye,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),Z(k=>!zn.has(k),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),s),z=t(1,500),i=t(1,2e3),o=t(1,300),p=$({type:I(hn),required:n(_()),description:n(z),label:n(t(1,60)),options:n(a(t(1,80),1,100)),of:n(I(["string","number","date","image","video","file"])),default:n(U()),unit:n(t(void 0,12)),format:n(I(["money","percent","duration","markdown"])),min:n(C()),max:n(C()),step:n(C()),renamedFrom:n(O().check(q(ye))),repeats:n(_()),collaborative:n(_())}).check(Re((k,N)=>{k.type==="enum"&&!k.options&&N.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),k.type!=="enum"&&k.options&&N.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]}),k.type!=="list"&&k.of&&N.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),k.repeats&&k.type!=="date"&&k.type!=="datetime"&&N.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),w=O().check(q(new RegExp(`${ze.source}|${Fe.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),m=$({to:x([a(w,1),P("*")]),cardinality:n(I(["one","many"])),description:n(z),inverse:n(t(1,80)),appendOnly:n(_()),renamedFrom:n(O()),tidying:n(P("never"))}),l=x([i,$({expr:i,label:n(t(1,60)),description:n(z)})]),c=$({noun:n(t(1,40)),plural:n(t(1,40)),description:n(z),fields:E(f,p).check(Z(k=>Object.keys(k).length>0,"a kind has at least one field")),label:n(o),describe:n(o),lifecycle:n($({field:f,retired:a(x([O(),C(),_()]),1)})),figure:n(t(void 0,2e4)),glance:n(a(f,1,20)),page:n($({fields:n(a(f,1,40)),groups:n(a($({title:t(1,60),fields:a(f,1,40)}),1,12))})),edges:n(E(u,m)),computed:n(E(O(),l).check(Z(k=>Object.keys(k).length<=20,"a kind works out at most 20 computed fields"))),fieldRoles:n(E(O(),O())),renamedFrom:n(O().check(q(ze))),people:n(_()),archives:n(P(!1)),tidying:n(I(["never","no-links"]))}),j=x([O(),C(),_(),Ae(),K(U()),$({expr:i})]),h=O().check(q(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),S=x([$({create:d("kind"),as:n(O().check(q(ye))),set:n(E(f,j))}),$({set:E(f,j),target:n(h)}),$({connect:u,from:h,to:h}),$({sever:u,from:h,to:h}),$({remove:h})]),A=$({title:n(t(1,80)),description:n(z),fromTheOtherEnd:n(t(1,80)),on:n(x([d("kind"),a(d("kind"),1)])),creates:n(d("kind")),sets:n(E(f,j)),writes:n(a(f,1)),connects:n(u),severs:n(u),setsOther:n(E(f,j)),replaces:n(x([P(!0),a(u,1,10)])),removes:n(P(!0)),args:n(E(f,p)),effects:n(a(S,1,20)),allowedWhen:n(i),refusal:n(o),destructive:n(_())}),b=$({act:d("act"),label:n(t(1,80)),args:n(E(O(),j))}),G=$({title:n(t(1,120)),description:n(z),over:x([P("graph"),d("kind")]),when:n(i),require:i,says:n(o),repairs:n(a(b,void 0,10))}),F=$({roles:x([a(d("role"),1),P("*")]),mutations:x([a(d("act"),1),P("*")]),kinds:n(x([K(d("kind")),P("*")])),describe:n(z),self:n(_()),ownEnd:n(_())}),g=n(a(d("field"),1)),v=$({roles:x([a(d("role"),1),P("*")]),kinds:a(d("kind"),1),own:n(_()),via:n(u),fields:g,hide:g}),D=$({grants:K(F),sees:n(K(v))}),oe=$({accent:n(O().check(q(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),name:n(t(1,60)),currency:n(O().check(q(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:n(t(2,35)),timeZone:n(t(1,64)),logo:n(x([t(1,te),$({src:t(1,te),alt:n(t(1,120))}),$({light:t(1,te),dark:n(t(1,te)),alt:n(t(1,120)),darkFallback:n(P("invert"))})])),favicon:n(x([t(1,te),$({emoji:O()})])),typography:n($({display:n(t(1,200)),body:n(t(1,200)),mono:n(t(1,200))})),shape:n($({radius:n(C().check(L(0),W(32))),density:n(C().check(L(.75),W(1.5)))})),accents:n(E(O(),C().check(L(0),W(360)))),scheme:n(I(["light","dark","auto"])),subtitle:n(P(!1))}),B=E(O(),U()),Y=x([t(1,120),$({by:t(1,120),direction:n(I(["asc","desc"]))})]),je=C().check(X(),L(1),W(9999)),dn=Q({create:n(_()),options:n(Q({sort:n(Y),columnSort:n(Y),search:n(a(t(1,120),void 0,40)),filters:n(a(t(1,120),void 0,40)),horizon:n(x([C().check(X(),L(1),W(200)),Q({years:C().check(X(),L(1),W(200)),title:t(1,80),from:n(je),to:n(je)})]))}))}),ln=$({card:n(K(U())),row:n(K(U())),page:n(K(U()))}),pn=()=>{let k=n(I(["asc","desc"]));return x([t(1,120),$({by:t(1,120),direction:k,then:n(x([t(1,120),$({by:t(1,120),direction:k})]))})])},fn=()=>x([t(1,120),$({by:t(1,120),order:n(a(t(1,80),void 0,40)),closed:n(a(t(1,80),void 0,40))})]),Oe=Q({order:n(K(O())),hide:n(K(O())),first:n(O()),primary:n(a(t(1,80),void 0,40)),scene:n(t(1,40)),pages:n(t(1,40)),lists:n(E(O(),$({filters:n(a(t(1,120),void 0,40)),sort:n(pn()),group:n(fn())})))}),un=$({act:d("act"),title:n(t(1,80)),intro:n(z),fields:n(a(f,1,40)),say:n(z),submit:n(t(1,80)),role:n(d("role"))}),mn=$({$schema:n(O()),format:P(he),formatVersion:P(be),name:t(1,80),description:n(z),version:n(C().check(X(),L(1))),kinds:E(d("kind"),c).check(Z(k=>Object.keys(k).length>0,"a document declares at least one kind"),Z(k=>Object.keys(k).length<=40,"a document declares at most 40 kinds")),computed:n(E(O(),l)),acts:n(E(d("act"),A)),rules:n(E(d("rule"),G)),roles:n(K(d("role"))),policy:n(D),modules:n(B),lenses:n(K(dn)),pages:n(Oe),views:n(E(O(),x([ln,K(U())]))),brand:n(oe),settings:n(K(B)),migrations:n(K(B)),connections:n(E(d("connection"),B)),forms:n(E(d("form"),un)),publishing:n($({mode:I(["live","on-publish"]),working:a(d("role"),void 0,40),publishers:n(a(d("role"),1,40))}))});return{FieldSpec:p,EdgeSpec:m,ComputedSpec:l,KindSpec:c,ValueSpec:j,EffectSpec:S,ActSpec:A,RepairSpec:b,RuleSpec:G,GrantSpec:F,SightSpec:v,PolicySpec:D,BrandSpec:oe,PagesSpec:Oe,DocumentSpec:mn}}var kn,T=()=>kn??=bn(),_n=M(()=>T().FieldSpec),Nn=M(()=>T().EdgeSpec),qn=M(()=>T().ComputedSpec),In=M(()=>T().KindSpec),Vn=M(()=>T().ValueSpec),Bn=M(()=>T().EffectSpec),Ln=M(()=>T().ActSpec),Un=M(()=>T().RepairSpec),Wn=M(()=>T().RuleSpec),Zn=M(()=>T().GrantSpec),Yn=M(()=>T().SightSpec),Hn=M(()=>T().PolicySpec),Jn=M(()=>T().BrandSpec),Xn=M(()=>T().PagesSpec),Je=M(()=>T().DocumentSpec);var $n={};function Xe(e,s=$n,r=be){let{document:t,respelled:a}=ve(e),d=a.length>0?{respelled:a}:{};if(!t||typeof t!="object"||Array.isArray(t))return{document:t};let u=t;if(u.format!==he||typeof u.formatVersion!="number"||u.formatVersion>=r)return{document:t,...d};let f=u.formatVersion,z=structuredClone(u);for(let i=f;i<r;i++){let o=s[i];if(!o)throw new Error(`there is no upgrade from format ${i} to ${i+1}`);z={...o(z),formatVersion:i+1}}return{document:z,from:f,...d}}function Qe(e,s,r){let t=Object.keys(e).filter(f=>e[f].edges?.[s]!==void 0);if(t.length===0)return;let a=t.map(f=>e[f].edges[s].to),d=a.some(f=>f==="*")?"*":[...new Set(a.flatMap(f=>f))];if(r.length===0||r.some(f=>t.includes(f)))return{reversed:!1,kinds:d};let u=t.filter(f=>{let z=e[f].edges[s].to;return z==="*"||r.every(i=>z.includes(i))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:d}}var tn=(e,s)=>{let r=e?.fields[s];return r!==void 0&&(r.type==="duration"||(r.type==="number"||r.type==="integer")&&r.format==="duration")};function en(e,s,r,t){if(t==="out"){let a=e[s]?.edges?.[r]?.to;return a===void 0?[]:a==="*"?Object.keys(e):a}return Object.entries(e).filter(([,a])=>{let d=a.edges?.[r]?.to;return d!==void 0&&(d==="*"||d.includes(s))}).map(([a])=>a)}function $e(e,s,r){if(r.t==="ident")return e[s]?.edges?.[r.name]?en(e,s,r.name,"out"):void 0;if(r.t==="where")return $e(e,s,r.set);if(r.t==="call"&&(r.fn==="out"||r.fn==="in")&&r.args[0]?.t==="lit"&&typeof r.args[0].value=="string")return en(e,s,r.args[0].value,r.fn)}var nn=(e,s,r)=>{let t=s.filter(a=>e[a]?.fields[r]!==void 0);return t.length>0&&t.every(a=>tn(e[a],r))};function on(e,s,r){let t=e.kinds,a=t[s],d=new Map(r),u=new Map,f=(i,o)=>{if(o>8)return!1;switch(i.t){case"ident":return tn(a,i.name)||z(i.name,o+1);case"member":{let p=$e(t,s,i.object);return p!==void 0&&nn(t,p,i.name)}case"call":{if(i.fn!=="sum"&&i.fn!=="min"&&i.fn!=="max")return!1;let[p,w]=i.args,m=p&&$e(t,s,p);return m!==void 0&&w?.t==="ident"&&nn(t,m,w.name)}case"binary":return(i.op==="+"||i.op==="-")&&f(i.left,o)&&f(i.right,o);case"unary":return i.op==="-"&&f(i.operand,o);default:return!1}},z=(i,o)=>{if(a?.computed?.[i]===void 0)return!1;if(u.has(i))return u.get(i);u.set(i,!1);let p=d.get(i),w=p!==void 0&&f(p,o);return u.set(i,w),w};return r.map(([i])=>i).filter(i=>z(i,0))}function sn(e,s,r=`kinds.${e}.page`){let t=s.page;if(!t)return[];let a=[],d=[...Object.keys(s.fields),...Object.keys(s.computed??{})],u=new Set,f=(i,o)=>{d.includes(i)?u.has(i)&&a.push(y("page-field-twice",o,`"${i}" is on ${e}'s page twice; name each field once`)):a.push(y("page-field",o,`${e}'s page is to show "${i}", and ${e} has no field or computed field called that`,`use one of: ${d.join(", ")}`)),u.add(i)};(t.fields??[]).forEach((i,o)=>f(i,`${r}.fields.${o}`));let z=new Set;return(t.groups??[]).forEach((i,o)=>{let p=i.title.trim().toLowerCase();z.has(p)&&a.push(y("page-group-twice",`${r}.groups.${o}.title`,`${e}'s page has two groups called "${i.title}"; give each its own title`)),z.add(p),i.fields.forEach((w,m)=>f(w,`${r}.groups.${o}.fields.${m}`))}),a}function rn(e,s=[]){return Te({declared:Object.keys(e.fields),paged:[...e.page?.fields??[],...(e.page?.groups??[]).flatMap(r=>r.fields)],must:r=>!!e.fields[r].required&&e.fields[r].default===void 0,naming:s})}var wn=new Set(["subject","now","today","me"]);function Sn(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>ke)return{findings:[y("too-large","",`a document may be at most ${ke/1024} KB`)]};if(typeof e=="string")try{e=JSON.parse(e)}catch(t){return{findings:[y("not-json","",`this is not JSON: ${t.message}`)]}}try{e=Xe(e).document}catch(t){return{findings:[y("format","formatVersion",t.message)]}}e=He(e);let s=Je.safeParse(e);if(!s.success)return{findings:s.error.issues.map(t=>{let a=t.path.map(String).join(".");if(t.code==="unrecognized_keys")return y("unknown-key",a,`${t.keys.map(d=>`"${d}"`).join(", ")} ${t.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(t.code==="invalid_union"&&/\.effects\.\d+$/.test(a))return y("effect-shape",a,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(t.code==="invalid_key"){let d=t.issues?.[0]?.message;return y("shape",a,`the name "${String(t.path.at(-1))}" is not allowed here${d?`: ${d}`:""}`)}return y("shape",a,t.message)})};let r=s.data;return{document:r,findings:jn(r)}}var ae=e=>[e??[]].flat();function an(e){let s=new Map;for(let[r,t]of Object.entries(e.kinds))for(let[a,d]of Object.entries(ee(t.edges))){let u=s.get(a);s.set(a,{name:a,from:[...u?.from??[],r],to:d.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...d.to])],cardinality:d.cardinality??"many"})}return s}function Et(e){let s=new Map;for(let[t,a]of Object.entries(e.kinds)){let d=ne(a),u=ce(a.edges);s.set(t,{fields:new Set([...Object.keys(a.fields),...u.keys()]),edges:new Map(Object.entries(ee(a.edges)).map(([f,z])=>[f,z.cardinality??"many"])),...d?{computed:d}:{},...u.size>0?{linked:u}:{}})}let r=ne(e);return r&&s.set(_e,{computed:r}),s}function cn(e,s){let r=[],t=ae(e.on),a=(d,u)=>{let f=Qe(s.kinds,d,t)?.reversed===!0,[z,i]=f?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:d,from:z,to:i}:{sever:d,from:z,to:i}};if(e.creates){let d=s.kinds[e.creates],u={};for(let f of Object.keys(d?.fields??{}))u[f]=`$${f}`;for(let f of e.effects??[])"set"in f&&!("create"in f)&&R(f.target)==="new"&&Object.assign(u,f.set);r.push({create:e.creates,as:"new",set:u})}return e.sets&&r.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&r.push({set:Object.fromEntries(e.writes.map(d=>[d,`$${d}`]))}),e.connects&&(e.replaces&&r.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),r.push(a(e.connects,"connect"))),e.severs&&r.push(a(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&r.push({set:e.setsOther,target:"$to"}),e.removes&&r.push({remove:"$subject"}),e.effects&&r.push(...e.effects.filter(d=>!(e.creates&&"set"in d&&!("create"in d)&&R(d.target)==="new"))),r}function we(e,s,r){try{let t=H(e),a=se(t);for(let d of a.unknownFunctions)r.push(y("unknown-function",s,`"${d}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));return t}catch(t){if(t instanceof ie){r.push(y("expression",s,t.sentence+` (at character ${t.at+1})`));return}throw t}}function Se(e,s,r){try{return J(e)}catch(t){if(t instanceof Be||t instanceof ie){r.push(y("template",s,(t instanceof ie,t.sentence)));return}throw t}}function jn(e){let s=[],r=new Set(Object.keys(e.kinds)),t=an(e),a=e.acts??{},d=new Set(e.roles??[]),u=(i,o)=>ce(e.kinds[i]?.edges).has(o),f=i=>Object.keys(e.kinds).some(o=>u(o,i));for(let[i,o]of Object.entries(e.kinds)){let p=`kinds.${i}`;for(let[m,l]of Object.entries(o.edges??{})){if(!De(l)&&l.to!=="*")for(let c of l.to)r.has(c)||s.push(y("edge-target",`${p}.edges.${m}.to`,`"${c}" is not a kind this document declares`));o.fields[m]&&s.push(y("edge-field-clash",`${p}.edges.${m}`,`"${m}" is both a field and a relation of ${i}`,"rename one of them"))}o.lifecycle&&!o.fields[o.lifecycle.field]&&s.push(y("lifecycle-field",`${p}.lifecycle.field`,`${i} has no field "${o.lifecycle.field}"`));let w=m=>o.computed!==void 0&&Object.hasOwn(o.computed,m);for(let m of o.glance??[])!o.fields[m]&&!w(m)&&s.push(y("glance-field",`${p}.glance`,`a glance at ${i} is to say "${m}", and ${i} has no field or computed field called that`,`use one of: ${[...Object.keys(o.fields),...Object.keys(o.computed??{})].join(", ")}`));s.push(...sn(i,o));for(let m of["label","describe"]){let l=o[m];if(!l)continue;let c=Se(l,`${p}.${m}`,s);for(let j of c??[])if(j.expr){for(let h of se(j.expr).names)if(!o.fields[h]){if(w(h)){Ze(o,h)||s.push(y("template-field",`${p}.${m}`,`${i}'s ${h} is worked out from beyond the record, and a ${m} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${i}'s own fields`));continue}s.push(y("template-field",`${p}.${m}`,`${i} has no field "${h}" for its ${m} to show`,m==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[m,l]of Object.entries(o.fields)){l.default!==void 0&&l.type==="enum"&&!l.options?.includes(String(l.default))&&s.push(y("default-option",`${p}.fields.${m}.default`,`"${String(l.default)}" is not one of ${m}'s options`));let c=`${m}Repeat`;l.repeats&&(o.fields[c]||o.edges?.[c]||o.computed?.[c])&&s.push(y("repeat-clash",`${p}.fields.${m}.repeats`,`${i} already has "${c}", where how ${m} repeats is kept`))}}for(let[i,o]of Object.entries(a)){let p=`acts.${i}`;for(let c of ae(o.on))r.has(c)||s.push(y("act-kind",`${p}.on`,`"${c}" is not a kind this document declares`));let w=ae(o.on),m=cn(o,e);if(o.creates&&o.on===void 0&&o.writes&&r.has(o.creates)){for(let c of o.writes)if(!e.kinds[o.creates].fields[c])if(e.kinds[o.creates].computed?.[c]!==void 0)s.push(y("computed-written",`${p}.writes`,`${o.creates}'s ${c} is worked out, not written: no act can set it`,"write the stored fields it is worked out from"));else{if(u(o.creates,c))continue;s.push(y("act-field",`${p}.writes`,`${o.creates} has no field "${c}"`))}}m.length===0&&s.push(y("act-empty",p,`"${i}" does nothing`,"give it effects or a shorthand such as sets or creates"));let l=new Map;m.forEach((c,j)=>{let h=m.length-(o.effects?.length??0),S=o.effects&&j>=h?`${p}.effects.${j-h}`:p;if("create"in c){if(!r.has(c.create))s.push(y("act-kind",`${S}.create`,`"${c.create}" is not a kind this document declares`));else for(let b of Object.keys(c.set??{}))e.kinds[c.create].fields[b]||(e.kinds[c.create].computed?.[b]!==void 0?s.push(y("computed-written",`${S}.set.${b}`,`${c.create}'s ${b} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):s.push(y("act-field",`${S}.set.${b}`,`${c.create} has no field "${b}"`)));c.as&&l.set(c.as,c.create)}else if("connect"in c||"sever"in c){let b="connect"in c?c.connect:c.sever;!t.has(b)&&!f(b)&&s.push(y("act-edge",`${S}.${"connect"in c?"connect":"sever"}`,`"${b}" is not a relation any kind declares`)),R(c.from)==="subject"&&w.length===0&&s.push(y("act-subject",`${p}.on`,`"${i}" acts on "$subject" but does not say which kinds it is "on"`))}else if("set"in c){let b=R(c.target??"$subject"),G=b==="subject"?w:l.has(b??"")?[l.get(b)]:[];b==="subject"&&w.length===0&&s.push(y("act-subject",`${p}.on`,`"${i}" changes "$subject" but does not say which kinds it is "on"`));for(let F of Object.keys(c.set))for(let g of G)if(!(!r.has(g)||e.kinds[g].fields[F]))if(e.kinds[g].computed?.[F]!==void 0)s.push(y("computed-written",`${S}.set.${F}`,`${g}'s ${F} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(g,F))continue;s.push(y("act-field",`${S}.set.${F}`,`${g} has no field "${F}"`))}}else"remove"in c&&R(c.remove)==="subject"&&w.length===0&&s.push(y("act-subject",`${p}.on`,`"${i}" removes "$subject" but does not say which kinds it is "on"`));("set"in c&&c.set?Object.values(c.set):[]).forEach(b=>{b&&typeof b=="object"&&!Array.isArray(b)&&"expr"in b&&we(b.expr,`${S}.set`,s)})}),o.allowedWhen&&we(o.allowedWhen,`${p}.allowedWhen`,s),o.refusal&&Se(o.refusal,`${p}.refusal`,s)}for(let[i,o]of Object.entries(e.rules??{})){let p=`rules.${i}`;o.over!=="graph"&&!r.has(o.over)&&s.push(y("rule-kind",`${p}.over`,`"${o.over}" is not a kind this document declares`));let w=o.over==="graph"?void 0:e.kinds[o.over];for(let m of["when","require"]){let l=o[m];if(!l)continue;let c=we(l,`${p}.${m}`,s);if(!c)continue;let j=se(c);for(let h of j.names)if(o.over==="graph")s.push(y("rule-name",`${p}.${m}`,`"${h}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(w&&!w.fields[h]&&!w.edges?.[h]&&w.computed?.[h]===void 0){let S=Object.keys(w.edges??{}).find(A=>A.includes("-")&&A.split("-").includes(h));s.push(y("rule-name",`${p}.${m}`,`${o.over} has no field or relation called "${h}"`,S?`"${S}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${S.replace(/-([a-z0-9])/g,(A,b)=>b.toUpperCase())}"`:void 0))}for(let h of j.edges)!t.has(h)&&!f(h)&&s.push(y("rule-edge",`${p}.${m}`,`"${h}" is not a relation any kind declares`));for(let h of j.sweeps)r.has(h)?o.over!=="graph"&&s.push(Ne("rule-cost",`${p}.${m}`,`this rule looks at every ${h} for every ${o.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):s.push(y("rule-kind",`${p}.${m}`,`"${h}" is not a kind this document declares`))}o.says&&Se(o.says,`${p}.says`,s),(o.repairs??[]).forEach((m,l)=>{!a[m.act]&&!de(m.act)&&!me(m.act,e.kinds)&&s.push(y("repair-act",`${p}.repairs.${l}.act`,`"${m.act}" is not an act this document declares`,ge(m.act,e)))})}let z=e.policy;return z&&(z.grants.forEach((i,o)=>{if(i.roles!=="*"&&d.size>0)for(let p of i.roles)d.has(p)||s.push(y("grant-role",`policy.grants.${o}.roles`,`"${p}" is not one of the document's roles`));if(i.mutations!=="*")for(let p of i.mutations)!a[p]&&!de(p)&&!me(p,e.kinds)&&s.push(y("grant-act",`policy.grants.${o}.mutations`,`"${p}" is not an act this document declares`,ge(p,e)))}),(z.sees??[]).forEach((i,o)=>{for(let p of i.kinds)r.has(p)||s.push(y("sight-kind",`policy.sees.${o}.kinds`,`"${p}" is not a kind this document declares`));if(i.roles!=="*"&&d.size>0)for(let p of i.roles)d.has(p)||s.push(y("sight-role",`policy.sees.${o}.roles`,`"${p}" is not one of the document's roles`))})),s.push(...We(e)),s}function On(e){return e.label?[...e.label.matchAll(/\{\s*([A-Za-z_][A-Za-z0-9_]*)/g)].map(s=>s[1]):[fe(e)??[]].flat()}function vn(e,s,r,t){let a=new Map,d=ae(e.on),u=new Map,f=new Map;(d.length>0||s.some(l=>"remove"in l&&R(l.remove)==="subject"||"from"in l&&(R(l.from)==="subject"||R(l.to)==="subject")||"set"in l&&!("create"in l)&&R(l.target??"$subject")==="subject"))&&a.set(pe,{ref:d.length>0?d:"*",required:!0});let i=e.args??{},o=e.writes?.length===1,p=(l,c)=>c&&l.type===c.type&&l.min===void 0&&l.max===void 0&&l.step===void 0?{...l,...c.min===void 0?{}:{min:c.min},...c.max===void 0?{}:{max:c.max},...c.step===void 0?{}:{step:c.step}}:l,w=(l,c)=>c&&l.type===c.type&&l.format===void 0&&l.unit===void 0?{...p(l,c),...c.format?{format:c.format}:{},...c.unit?{unit:c.unit}:{}}:p(l,c),m=(l,c,j)=>{if(l===pe||wn.has(l)||u.has(l)||a.has(l))return;let h=i[l]?w(i[l],j):void 0;a.set(l,h?{field:h,optional:!h.required,required:!!h.required}:c())};for(let l of s)if("create"in l){let c=r.kinds[l.create],j=c?rn(c,On(c)):[],h=S=>j.includes(S)?j.indexOf(S):j.length;for(let[S,A]of Object.entries(l.set??{}).sort(([b],[G])=>h(b)-h(G))){let b=R(A),G=c?.fields[S];if(b&&G){let F=!!G.required&&G.default===void 0;m(b,()=>({field:G,optional:!F,required:F}),G)}}l.as&&u.set(l.as,l.create)}else if("connect"in l||"sever"in l){let c=t.get("connect"in l?l.connect:l.sever);for(let[j,h]of[["from",l.from],["to",l.to]]){let S=R(h);if(!S)continue;let A=j==="to"?c?.to??"*":c?.from??"*";A!=="*"&&!f.has(S)&&f.set(S,A),m(S,()=>({ref:A,required:!0}))}}else if("set"in l){let c=R(l.target??"$subject"),j=c==="subject"?d[0]:u.get(c??"")??f.get(c??"")?.[0];c&&c!=="subject"&&!u.has(c)&&m(c,()=>({ref:"*",required:!0}));for(let[h,S]of Object.entries(l.set)){let A=R(S);if(!A)continue;let b=j?r.kinds[j]?.fields[h]:void 0;m(A,()=>b?{field:b,optional:!o,required:o}:{any:!0,required:!1},b)}}else if("remove"in l){let c=R(l.remove);c&&m(c,()=>({ref:"*",required:!0}))}for(let[l,c]of Object.entries(i))a.has(l)||a.set(l,{field:c,optional:!c.required,required:!!c.required});return a}function At(e,s={}){let r=Sn(e);if(!r.document||le(r.findings))return{ok:!1,findings:r.findings};let t=r.document,a=[...r.findings];s.previous&&a.push(...En(t,s.previous));let d=xn(t,a);return le(d.findings)?{ok:!1,findings:d.findings}:Ve(d,s)}function re(e,s){return e.map(r=>{let t=!r.format&&r.expr?.t==="ident"?s?.[r.expr.name]?.format:void 0;return t==="money"||t==="percent"?{...r,format:t}:r})}function xn(e,s){let r=an(e),t={};for(let[i,o]of Object.entries(e.kinds)){let p=fe(o),w=o.label??(p?`{${p}}`:void 0),m=ne(o),l=m?on(e,i,[...m]):[];t[i]={...w?{label:re(J(w),o.fields)}:{},...o.describe?{describe:re(J(o.describe),o.fields)}:{},...m?{computed:[...m]}:{},...l.length>0?{durations:l}:{}}}let a={};for(let[i,o]of Object.entries(e.acts??{})){let p=cn(o,e),w=vn(o,p,e,r),m=o.destructive??p.some(g=>"remove"in g||"sever"in g||"replace"in g),l=[...new Set(p.flatMap(g=>"create"in g?[g.create]:[]))],c=[...new Set(p.flatMap(g=>"connect"in g?[g.connect]:[]))],j=[...new Set(p.flatMap(g=>"sever"in g?[g.sever]:"replace"in g?g.replace:[]))],h=[...new Set(p.flatMap(g=>"set"in g&&!("create"in g)&&R(g.target??"$subject")==="subject"?Object.keys(g.set):[]))],S=new Map;for(let g of p){if(!("connect"in g)&&!("sever"in g))continue;let v=r.get("connect"in g?g.connect:g.sever);for(let[D,oe]of[["from",g.from],["to",g.to]]){let B=R(oe),Y=D==="to"?v?.to:v?.from;B&&B!=="subject"&&Y&&Y!=="*"&&S.set(B,[...new Set([...S.get(B)??[],...Y])])}}let A={};for(let g of p){if(!("set"in g)||"create"in g)continue;let v=R(g.target??"$subject");for(let D of v&&v!=="subject"&&S.get(v)||[])A[D]=[...new Set([...A[D]??[],...Object.keys(g.set)])]}let b={};for(let g of p)if(!(!("set"in g)||"create"in g||R(g.target??"$subject")!=="subject"))for(let[v,D]of Object.entries(g.set??{}))typeof D=="string"&&R(D)===void 0||typeof D=="number"||typeof D=="boolean"?b[v]=typeof D=="string"&&D.startsWith("$$")?D.slice(1):D:delete b[v];let G=l.length===0&&p.every(g=>!("set"in g)||!g.set||Object.values(g.set).every(v=>!(v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v))),F=new Map;for(let g of p)if(!(!("set"in g)||!g.set))for(let v of Object.values(g.set))v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v&&F.set(v.expr,H(v.expr));a[i]={title:o.title??i.replace(/-/g," "),effects:p,args:[...w],...o.allowedWhen?{guard:H(o.allowedWhen)}:{},...o.refusal?{refusal:re(J(o.refusal),e.kinds[[o.on??[]].flat()[0]??""]?.fields)}:{},exprs:[...F],destructive:m,idempotent:G,creates:l,connects:c,severs:j,writes:h,writesOther:A,sets:b}}let d={};for(let[i,o]of Object.entries(e.rules??{}))d[i]={title:o.title??i.replace(/-/g," "),require:H(o.require),...o.when?{when:H(o.when)}:{},...o.says?{says:re(J(o.says),e.kinds[o.over]?.fields)}:{}};let u=qe(e,s),f=Le(e),z=Ue(e);return{format:Ie,document:e,findings:s,kinds:t,...e.computed?{facts:[...ne(e)??[]]}:{},edges:[...r].map(([i,{from:o,to:p,cardinality:w}])=>[i,{from:o,to:p,cardinality:w}]),acts:a,rules:d,brand:u,...Object.keys(f).length>0?{viewSpecs:f}:{},...z?{home:z}:{}}}function Rt(e,s,r){let t=/^defineNode\("([^"]+)"\)/.exec(s)?.[1],a=t?r.kinds[t]:void 0;if(!t||!a)return e;let d=Object.keys(a.fields).filter(u=>u!=="label").slice(0,3);return{...e,path:`kinds.${t}.glance`,fix:`Say which: "glance": [${d.map(u=>`"${u}"`).join(", ")}] on kinds.${t} \u2014 the facts a person compares one by, at a glance.`}}function En(e,s){let r=[],t=new Set(Object.values(s.kinds).flatMap(a=>Object.keys(a.edges??{})));for(let[a,d]of Object.entries(e.kinds)){let u=d.renamedFrom;u&&!s.kinds[u]&&r.push(y("renamed-from-nothing",`kinds.${a}.renamedFrom`,`${a} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let f=s.kinds[u??a];for(let[z,i]of Object.entries(d.fields)){let o=i.renamedFrom;o&&!f?.fields[o]&&r.push(y("renamed-from-nothing",`kinds.${a}.fields.${z}.renamedFrom`,`${z} says it was ${o}, and the previous ${u??a} has no field called ${o}`,"name the field it was, or drop renamedFrom"))}for(let[z,i]of Object.entries(d.edges??{})){let o=i.renamedFrom;o&&!t.has(o)&&r.push(y("renamed-from-nothing",`kinds.${a}.edges.${z}.renamedFrom`,`${z} says it was ${o}, and the previous version has no relation called ${o}`,"name the relation it was, or drop renamedFrom"))}}return r}export{Sn as a,Et as b,cn as c,At as d,Rt as e};
@@ -1,18 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{A as zt,B as Re,C as ri,D as Ze,E as fe,F as Wn,G as De,H as Ue,I as ii,J as Kn,K as Le,L as oi,M as si,N as H,O as pt,P as wt,Q as li,R as vt,S as Qt,T as di,U as te,V as Zt,W as ie,X as Bn,a as V,b as ve,c as z,d as jt,e as Hn,f as In,g as ct,h as J,i as we,j as re,k as C,l as ee,m as U,n as qe,o as Se,p as _t,q as ke,r as ce,s as ti,t as ht,u as ni,v as Fn,w as Dn,x as Q,y as Fe,z as ai}from"./chunk.IE4ZJQV3.js";import{a as Qe,b as Yt,d as Z}from"./chunk.TVWN5I4M.js";import{a as Ie}from"./chunk.B7LBG4UP.js";import{b as Nn,c as Jr,d as ei}from"./chunk.7G4M2PX3.js";import{a as Qr,d as Zr,e as Xr}from"./chunk.UGFDSE37.js";import{a as Ur,c as Vr,f as jr,g as _r,i as zr,j as Yr}from"./chunk.NNUUD26E.js";import{a as Ut,b as Vt}from"./chunk.PXQVXBNG.js";import{a as Nr,b as Hr,c as Ir,d as On}from"./chunk.OJ64WTLW.js";import{b as Or}from"./chunk.GMAXA5GV.js";import{a as Fr,b as Dr,d as Gt,e as Wr,f as Kr,g as Br,j as qt}from"./chunk.IBJBCZKG.js";import{m as $r}from"./chunk.OPCBZNKF.js";import{a as hr,b as wr,c as vr,e as Tr,f as $n,h as Wt}from"./chunk.2VJ52LGS.js";import{d as br,e as xr,f as Pr,g as Cr,n as Ar,o as Rr,q as Lr,s as Dt}from"./chunk.JI2UVZUU.js";import{a as Ht,b as za,c as Ya,d as It,e as Qa}from"./chunk.CTOBNZLM.js";import{b as ar,c as mr,e as fr,f as Tn}from"./chunk.34HGT7HQ.js";import{a as Ln,b as gr}from"./chunk.TNL2BVCH.js";import{a as Kt,b as Bt,c as Mr,e as Er}from"./chunk.5ON3JSAK.js";import{a as dt,b as pr,e as ur}from"./chunk.3SBTQ66X.js";import{a as Mn}from"./chunk.3TVAE7LE.js";import{a as An,b as tr,c as nr}from"./chunk.JX2C3HVD.js";import{a as yr}from"./chunk.Z7N3MJ36.js";import{c as ir,d as or,e as sr,f as lr,k as yt,l as dr}from"./chunk.GLTWLQ6L.js";import{a as rr}from"./chunk.ACB4TD4W.js";import{r as Rn,s as cr}from"./chunk.OW72XZF4.js";import{b as Za,c as Xa,d as Ja,e as er,l as Ft}from"./chunk.OU5TRY4N.js";import{C as En,K as Gr,N as qr,e as ja,f as _a,j as Zi,u as Sr,v as kr}from"./chunk.GYTVL6GR.js";import{Aa as Nt,G as He,L as Ha,N as Ia,Pa as Va,R as Fa,T as q,U as Cn,X as Da,Y as Wa,aa as Ka,ba as de,ea as Ba,fa as Ga,ha as qa,la as lt,na as Ua,pa as Ot,r as Na,v as Ne}from"./chunk.TMYGLXR6.js";import{a as Oa}from"./chunk.SDO3U72B.js";import{$a as Pa,Dd as Pn,Ed as Ea,J as wa,Jd as $a,Nc as Ta,U as ft,Za as xa,ca as st,da as me,fa as ze,ga as Tt,hc as Aa,ia as Ge,ka as va,la as Sa,lb as bn,ma as Ye,mb as Ca,md as xn,oc as Ra,qc as La,rd as Et,sd as Ma,ud as $t,wb as Mt,xa as ka,ya as ba}from"./chunk.P4CLT32V.js";import{b as I}from"./chunk.AJZBJBMO.js";function ci(e,t,n={}){let a=e.graph.getNode(t);if(!a)return;let r=e.schema.tryDefinition(a.kind),i=l=>me(e.schema.tryDefinition(l.kind),l),d=new Map;for(let l of e.graph.allEdges()){let s=l.from===t?"out":l.to===t?"in":null;if(!s)continue;let c=s==="out"?l.to:l.from,m=e.graph.getNode(c);if(!m)continue;let g=(s==="out"?r:e.schema.tryDefinition(m.kind))?.edges?.[l.kind],u=s==="in"?g?.inverse??g?.description:g?.description,A=`${l.kind}|${s}|${u??""}`;(d.get(A)??(()=>{let G={edgeKind:l.kind,direction:s,...u?{description:u}:{},targets:[]};return d.set(A,G),G})()).targets.push({id:m.id,kind:m.kind,label:i(m)})}return{id:t,kind:a.kind,label:i(a),fields:Ja(yt(e.schema,e.graph,a),r),violations:bn(e.violations(n.context),[t]),actions:Mn(e,[t],{focus:t,...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}}),links:[...d.values()].map(l=>{let s=Za(l.targets.flatMap(c=>{let m=e.graph.getNode(c.id);return m?[m]:[]}),c=>e.schema.tryDefinition(c));return{...l,targets:[...l.targets].map(c=>s.has(c.id)?{...c,apart:s.get(c.id)}:c).sort((c,m)=>c.label.localeCompare(m.label))}})}}function Xe(e,t,n={}){return{kind:t,members:e.graph.nodesOfKind(t),actions:Mn(e,[],{kindSelection:[t],...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}})}}function pi(e,t){let n=(i,d)=>`${i}|${JSON.stringify(d)}`,a=new Map;for(let i of[...e.affordances,...e.withheld]){if(i.provider!=="invariant")continue;let d=n(i.mutation,i.args);a.has(d)||a.set(d,i.rank??Number.MAX_SAFE_INTEGER)}let r=Number.MAX_SAFE_INTEGER;return[...t].map((i,d)=>({repair:i,declared:d})).sort((i,d)=>(a.get(n(i.repair.mutation,i.repair.args??{}))??r)-(a.get(n(d.repair.mutation,d.repair.args??{}))??r)||i.declared-d.declared).map(i=>i.repair)}function Je(e){let t=e.schema.kinds.map(r=>({kind:r,plural:Ge(e.schema,r),count:e.graph.nodesOfKind(r).length})),n=new Map;for(let r of e.graph.allEdges()){let i=e.graph.getNode(r.from),d=e.graph.getNode(r.to);if(!i||!d)continue;let l=`${r.kind}|${i.kind}|${d.kind}`;n.set(l,(n.get(l)??0)+1)}let a=[];for(let{kind:r}of t){let i=e.schema.tryDefinition(r)?.edges??{};for(let[d,l]of Object.entries(i)){let s=l.to==="*"||l.to===void 0?(()=>{let c=[...n.keys()].filter(m=>m.startsWith(`${d}|${r}|`)).map(m=>m.split("|")[2]);return c.length>0?c:["*"]})():l.to;for(let c of s)a.push({edgeKind:d,from:r,to:c,...l.description?{description:l.description}:{},...l.inverse?{inverse:l.inverse}:{},count:n.get(`${d}|${r}|${c}`)??0})}}return{kinds:t,relations:a}}var We=I(He(),1);var St=I(He(),1);var Te=I(q(),1),Ji={problems:"Problems",search:"Search",map:"Connections",places:"Pictures","~draft":"A view drawn"},eo=e=>{try{return decodeURIComponent(e)}catch{return e}};function to(e,t,n={}){let{store:a}=e,r=a.schema,i=(n.base??"").replace(/\/$/,""),[d="/",l=""]=t.split("#")[0].split("?"),s=(b,E,k)=>({label:b,href:`${i}${E}`,path:E,...k?{current:k}:{}}),c=b=>{let E=n.registry?.sectionOf(b);return E?[E.path===void 0?{label:E.label}:s(E.label,E.path)]:[]},m=b=>n.registry?.sectionOf(b)?.label,x=b=>{let E=m(b);return E===void 0?{}:{section:E}},[g,u,...A]=d.split("/").filter(Boolean).map(eo);if(g===void 0)return{as:"home",label:"Home",trail:[s("Home","/",!0)]};if(g==="places"&&u!==void 0&&A.length===0){let b=new URLSearchParams(l).get("of"),E=new Set(Fe(a,e.principal)),k=e.views?.places()??[],P=k.find(K=>E.has(K.kind)&&K.as===u&&(!b||V(r,K.kind)===b));if(P){let K=jt(P.as,Et(P,k)?V(r,P.kind):void 0);return{as:"place",kind:P.kind,label:P.title,...x(P.kind),trail:[...c(P.kind),s(P.title,K,!0)]}}}let N=A.length===0?ve(r,g):void 0;if(N!==void 0){let b=s(Ge(r,N),`/${V(r,N)}`);if(u===void 0)return{as:"list",kind:N,label:b.label,...x(N),trail:[...c(N),{...b,current:!0}]};let E=a.graph.getNode(u),k=E&&E.kind===N?me(r.tryDefinition(N),E):"Nothing lives here";return{as:"record",kind:N,id:u,label:k,...x(N),trail:[...c(N),b,s(k,z(r,N,u),!0)]}}let G=Ji[g]??no((A.at(-1)??u??g).replace(/[-_]+/g," "));return{as:"page",label:G,trail:[s(G,d,!0)]}}var no=e=>e.charAt(0).toUpperCase()+e.slice(1),Gn=(0,St.createContext)(null);function ao(e){let t=fe(),n=Ze("/");return Z(e.context.store),to(e.context,`${t.pathname}${t.search}`,{registry:e.registry,base:n})}var ro={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0},ui={display:"flex",alignItems:"center",gap:6,minWidth:0},gi={display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,lineHeight:"24px"};function ut({context:e,style:t}){let n=(0,St.useContext)(Gn),a=(0,St.useContext)(wt);return vt(a??oo,"trail")||n?.registry?.without().has("trail")?null:(0,Te.jsx)(io,{root:n??{context:e,registry:void 0},context:e,...t?{style:t}:{}})}function io({root:e,context:t,style:n}){let a=ao(e);return a.trail.length<2?null:(0,Te.jsx)(so,{here:a,mark:a.as==="record"?{kind:a.kind,context:t}:void 0,...n?{style:n}:{},"data-testid":"page-trail"})}var oo={count:()=>0,place:()=>()=>{},subscribe:()=>()=>{}};function so({here:e,mark:t,style:n,...a}){let r=e.as==="record"?e.trail.length-2:-1;return(0,Te.jsx)("nav",{"aria-label":"You are here","data-graview-trail":"",style:{minWidth:0,...n},...a,children:(0,Te.jsx)("ol",{style:{...we,listStyle:"none",padding:0,display:"flex",alignItems:"center",gap:6,minWidth:0,overflow:"hidden"},children:e.trail.map((i,d)=>(0,Te.jsxs)("li",{style:i.current?ro:{...ui,flexShrink:d===e.trail.length-2?0:1,maxWidth:"100%"},...i.current?{"aria-current":"page"}:{},children:[d>0&&!i.current?(0,Te.jsx)("span",{"aria-hidden":"true",children:"\u203A"}):null,i.current?i.label:i.path!==void 0?(0,Te.jsxs)(H,{to:i.path,style:{...Se,...ui},...d===r?{"data-testid":"trail-list"}:{},children:[d===r&&t?(0,Te.jsx)(ce,{kind:t.kind,brand:t.context.brand,schema:t.context.store.schema,size:8}):null,(0,Te.jsx)("span",{style:gi,children:i.label})]}):(0,Te.jsx)("span",{style:gi,children:i.label})]},`${d}:${i.label}`))})})}var R=I(q(),1);function $e(e){let t=e.views;if(!t)return[];let n=new Set(Fe(e.store,e.principal));return t.places().filter(a=>n.has(a.kind))}function Xt(e,t){if(!t.over)return[t.kind];let n=new Set(Fe(e.store,e.principal));return t.over.filter(a=>a===t.kind||n.has(a))}var et=e=>`place:${e.kind}:${e.as}`;function ye(e,t){return jt(t.as,Et(t,e.views?.places()??[])?V(e.store.schema,t.kind):void 0)}function kt(e,t){let n=e.schema.tryDefinition(t);return e.graph.nodesOfKind(t).filter(a=>st(n,a))}function qn(e,t,n){let a=(i,d)=>Tt(e.schema,d,i),r=(typeof t=="string"?[t]:t).map(i=>a(kt(e,i).length,i)).join(" and ");return n?`${r} across ${a(kt(e,n).length,n)}`:r}function Un({context:e,place:t,chosen:n,filter:a}){let{store:r,views:i,invariantContext:d}=e,s=i?.resolve(t.kind,{cardinality:"many",fidelity:"full"},t.as)?.view,c=[...new Set(r.violations(d).flatMap(g=>g.nodeIds))],m=Xt(e,t).flatMap(g=>kt(r,g));if(!s)return null;let x=lo(r,m,a,c);return(0,R.jsx)(Rn,{kind:t.kind,view:t.title,children:(0,R.jsx)(s,{nodes:x,label:t.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...n&&n.length>0?{implicated:n}:{},...c.length>0?{flagged:c}:{}})})}function lo(e,t,n,a){let r=n?$t({filter:n}).filter??[]:[];return r.length===0?t:Wt(t,{filter:r},{schema:e.schema,graph:e.graph,flagged:new Set(a)}).nodes}function co({store:e,views:t,as:n,invariantContext:a}){Z(e);let r={store:e,views:t,...a?{invariantContext:a}:{}},i=t.places().find(d=>d.as===n);return i?(0,R.jsx)(Un,{context:r,place:i}):null}function po({context:e,kind:t}){let{store:n,views:a,invariantContext:r}=e,i=kt(n,t),d=n.schema.tryDefinition(t),l=Q(n,t),c=a?.resolve(t,{cardinality:"many",fidelity:"full"})?.view,m=[...new Set(n.violations(r).flatMap(A=>A.nodeIds))];if(c&&!lt(c))return(0,R.jsx)(Rn,{kind:t,children:(0,R.jsx)(c,{nodes:i,label:l,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...m.length>0?{flagged:m}:{}})});let x=a?.resolve(t,{cardinality:"one",fidelity:"summary"})?.view,g=8,u=i.slice(0,g);return(0,R.jsxs)("div",{"data-testid":"kind-sheet",style:x?{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gridAutoRows:"max-content",alignContent:"center",gap:12,padding:24}:{display:"flex",flexWrap:"wrap",alignContent:"center",justifyContent:"center",gap:10,padding:24},children:[u.map(A=>x?(0,R.jsx)(x,{node:A,fidelity:"summary",cardinality:"one",mode:"fullscreen",selected:!1,...m.includes(A.id)?{flagged:[A.id]}:{}},A.id):(0,R.jsx)("span",{style:{padding:"8px 14px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:me(d,A)},A.id)),i.length>g?(0,R.jsxs)("span",{style:{...C,alignSelf:"center",padding:"0 6px"},children:["+",i.length-g," more ",l.toLowerCase()]}):null]})}function Vn(e){let{store:t}=e,n=ai(e),a=$e(e),r=e.views?.arrangement?.()?.order??[],i=s=>{let c=s.name===void 0?-1:r.indexOf(`view:${s.name}`);return c>=0?c-r.length:n.indexOf(s.kind)},d=xn([...a].sort((s,c)=>i(s)-i(c))).filter(s=>!s.hidden),l=new Set(d.flatMap(s=>s.over??[s.kind]));return[...d.map(s=>({key:et(s),kind:s.kind,title:Ma(s,a,t.schema),to:ye(e,s),place:s})),...zt(e).filter(s=>!l.has(s)).map(s=>({key:`kind:${s}`,kind:s,title:Q(t,s),to:`/${V(t.schema,s)}`}))]}var mi=.72,uo=540,fi=16/10;function go(e){let t=(0,We.useRef)(null),[n,a]=(0,We.useState)(e);return(0,We.useLayoutEffect)(()=>{let r=t.current;if(!r||typeof ResizeObserver>"u")return;let i=()=>{let l=r.getBoundingClientRect().width;l>0&&a(s=>Math.abs(s-l)<.5?s:l)};i();let d=new ResizeObserver(i);return d.observe(r),()=>d.disconnect()},[]),{ref:t,width:n}}function mo(e){for(let t=e.parentElement;t;t=t.parentElement)if(/(auto|scroll)/.test(getComputedStyle(t).overflowY))return t;return null}function fo(e){let[t,n]=(0,We.useState)(()=>typeof IntersectionObserver>"u");return(0,We.useLayoutEffect)(()=>{let a=e.current;if(t||!a)return;let r=new IntersectionObserver(i=>{i.some(d=>d.isIntersecting)&&(r.disconnect(),n(!0))},{root:mo(a),rootMargin:"50% 0px"});return r.observe(a),()=>r.disconnect()},[t,e]),t}function jn({context:e,entry:t}){let{store:n,brand:a,principal:r}=e,{ref:i,width:d}=go(uo),l=fo(i),s=d/mi,c=kt(n,t.kind),m=n.schema.tryDefinition(t.kind),x=c.length===0?Xe(n,t.kind,{...r?{principal:r}:{},...e.invariantContext?{context:e.invariantContext}:{}}).actions.affordances[0]:void 0,g=t.place!==void 0;return(0,R.jsxs)(H,{to:t.to,"data-testid":g?"place-card":"kind-card",className:"graview-gallery-card",style:{...Se,display:"grid",gap:10,alignContent:"start",minWidth:0},children:[(0,R.jsxs)("span",{ref:i,"data-testid":g?"place-picture":"kind-picture","aria-hidden":"true",inert:!0,style:{display:"block",position:"relative",width:"100%",aspectRatio:`${fi}`,overflow:"hidden",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",pointerEvents:"none"},children:[(0,R.jsx)("span",{style:{position:"absolute",left:0,top:0,width:s,height:s/fi,display:"grid",gridTemplateRows:"minmax(0, 1fr)",transform:`scale(${mi})`,transformOrigin:"0 0"},children:l?(0,R.jsx)(Gt.Provider,{value:null,children:t.place?(0,R.jsx)(Un,{context:e,place:t.place}):(0,R.jsx)(po,{context:e,kind:t.kind})}):null}),c.length===0?(0,R.jsx)("span",{"data-testid":"picture-empty",style:{position:"absolute",inset:0,display:"grid",placeContent:"center",justifyItems:"center",gap:2,padding:20,textAlign:"center"},children:(0,R.jsxs)("span",{style:{display:"grid",gap:2,padding:"10px 16px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:[(0,R.jsxs)("span",{style:{fontFamily:In,fontWeight:"var(--graview-weight-display)"},children:["No ",Q(n,t.kind).toLowerCase()," yet"]}),x?(0,R.jsxs)("span",{style:C,children:["Begin with \u201C",x.label,"\u201D"]}):null]})}):null]}),(0,R.jsxs)("span",{style:{display:"grid",gap:2,minWidth:0},children:[(0,R.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[g?null:(0,R.jsx)(ce,{kind:t.kind,brand:a,schema:n.schema,size:8}),(0,R.jsx)("span",{style:{fontFamily:In,fontSize:"var(--graview-text-heading)",fontWeight:"var(--graview-weight-display)",lineHeight:1.3,overflowWrap:"anywhere",textWrap:"balance"},children:t.title})]}),(0,R.jsxs)("span",{style:C,children:[t.place?qn(n,Xt(e,t.place),t.place.across):qn(n,t.kind),!g&&m?.description?` \xB7 ${m.description}`:null]})]})]})}var yi={display:"grid",gap:"32px 28px",gridTemplateColumns:"repeat(auto-fill, minmax(min(420px, 100%), 1fr))"},yo=`
2
- .graview-gallery-card > span:first-child { transition: border-color 160ms ease, box-shadow 160ms ease; }
3
- .graview-gallery-card:hover > span:first-child,
4
- .graview-gallery-card:focus-visible > span:first-child { border-color: var(--graview-edge-bright); box-shadow: 0 1px 0 var(--graview-edge), 0 10px 30px -18px var(--graview-ink); }
5
- `;function _n({context:e}){Z(e.store);let t=Vn(e);return t.length===0?null:(0,R.jsxs)("section",{style:yi,"data-testid":"gallery",children:[(0,R.jsx)("style",{children:yo}),t.map(n=>(0,R.jsx)(jn,{context:e,entry:n},n.key))]})}function zn({context:e}){let{store:t}=e;Z(t);let n=xn($e(e)).filter(r=>!r.hidden),a=Vn(e);return(0,R.jsxs)(te,{context:e,style:ct,children:[(0,R.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,R.jsx)("p",{style:we,children:n.length===0?"None of its own yet":`${n.length} ${n.length===1?"picture":"pictures"}`}),(0,R.jsx)(ie,{context:e,children:"Pictures"}),(0,R.jsx)("p",{style:re,children:n.length===0?"Nothing here has a picture of its own yet, so each kind is drawn as the scene draws it. Title a group view and it appears here by name.":"The ways this installation looks at what it holds \u2014 each one the same picture the scene shows, here as a page."})]}),a.length>0?(0,R.jsx)("div",{style:yi,"data-testid":"places",children:a.map(r=>(0,R.jsx)(jn,{context:e,entry:r},r.key))}):null]})}var ho={lede:!0},wo={lede:!1},vo={...re,textWrap:"pretty"};function So(e,t){if(t===void 0)return;let[n]=lr(sr([t]),dr(e.store,null,null,e.brand?{money:e.brand}:{}));return n?.t==="headline"&&!n.problem&&n.text.trim()!==""?n.text:void 0}function Yn({context:e}){let{store:t,principal:n}=e;Z(t);let a=Ue(),r=De(),[i]=pt(),d=decodeURIComponent(a.as??""),[l,s]=(0,We.useState)(null),c=i.get("of"),m=i.get("filter"),g=$e(e).find(P=>P.as===d&&(!c||V(t.schema,P.kind)===c));if(!g)return(0,R.jsxs)(te,{context:e,children:[(0,R.jsx)(ie,{context:e,children:"No picture is called that."}),(0,R.jsx)("p",{style:re,children:(0,R.jsx)(H,{to:"/places",style:qe,children:(0,R.jsx)(Qe,{children:"The pictures there are"})})})]});let u=Q(t,g.kind),A=e.views?.resolve(g.kind,{cardinality:"many",fidelity:"full"},g.as)?.view,N=A?.flows===!0,G=A?.creates!==!1,b=So(e,A?.lede),E=Xe(t,g.kind,{...n?{principal:n}:{},...e.invariantContext?{context:e.invariantContext}:{}}),k=G?E.actions.affordances.map(P=>({affordance:P,mutation:t.allMutations().find(K=>K.name===P.mutation)})).filter(P=>P.mutation!==void 0):[];return(0,R.jsxs)(te,{context:e,style:{...ct,gap:"var(--graview-space-6, 32px)"},children:[(0,R.jsxs)("header",{style:{display:"grid",gap:"var(--graview-space-2, 8px)"},children:[(0,R.jsx)(ut,{context:e}),(0,R.jsx)(ie,{context:e,children:g.title}),(0,R.jsx)("p",{style:vo,"data-testid":"place-lede",...b!==void 0?{"data-graview-lede":"headline"}:{},children:b??`${qn(t,Xt(e,g),g.across)}.`}),m&&!N?(0,R.jsxs)("p",{style:{...C,margin:0},"data-testid":"place-narrowed",children:[`Only those where ${m.split(",").map(P=>P.replace(":"," is ")).join(" and ")}. `,(0,R.jsx)(H,{to:`?${(()=>{let P=new URLSearchParams(i);return P.delete("filter"),P.toString()})()}`,style:{...U,...C},children:"Show all"})]}):null,(0,R.jsx)("p",{style:{...C,margin:0,display:"flex",flexWrap:"wrap",gap:"4px 16px"},children:Xt(e,g).map((P,K)=>(0,R.jsx)(H,{to:`/${V(t.schema,P)}`,style:{...qe,...C},...K===0?{"data-testid":"place-as-list"}:{},children:(0,R.jsxs)(Qe,{children:["All ",(P===g.kind?u:Q(t,P)).toLowerCase()," as a list"]})},P))})]}),(0,R.jsx)("div",{"data-testid":"place-lens","data-flows":N?"":void 0,...N?{}:{role:"group","aria-label":g.title,tabIndex:0},style:N?{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",maxWidth:"100%"}:{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",maxWidth:"100%",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)"},onClick:P=>{let K=P.target?.closest("[data-graview-pick]"),ae=K?.getAttribute("data-graview-pick"),ue=K?.getAttribute("data-graview-joins");if(ue)try{let _=JSON.parse(ue);if(Array.isArray(_)&&_.every(ge=>typeof ge=="string")){P.preventDefault(),s({at:et(g),ids:_});return}}catch{}if(!ae)return;let oe=t.graph.getNode(ae);oe&&(P.preventDefault(),r(z(t.schema,oe.kind,ae)))},children:(0,R.jsx)(Br.Provider,{value:b!==void 0?ho:wo,children:(0,R.jsx)(Un,{context:e,place:g,filter:m,...l?.at===et(g)?{chosen:l.ids}:{}})})}),k.length>0?(0,R.jsx)("div",{style:{maxWidth:760,display:"grid",gap:40},"data-testid":"place-creators",children:k.map(({affordance:P,mutation:K})=>(0,R.jsxs)("section",{style:{...ee,display:"grid",gap:14},children:[(0,R.jsx)("h2",{style:J,children:K.title??K.name}),K.description?(0,R.jsx)("p",{style:{...C,margin:0,maxWidth:"58ch"},children:K.description}):null,(0,R.jsx)(Ie,{store:t,mutation:K,prefilled:P.args,open:P.open,label:P.label,...n?{principal:n}:{}})]},P.id))}):null]})}function ko(e,t=document){let n=Ut(e);if(!n)return null;let a=[t,...[...t.querySelectorAll("[data-worker-view]")].flatMap(r=>r.shadowRoot?[r.shadowRoot]:[])];for(let r of a)for(let i of r.querySelectorAll("[id], [data-section]")){let d=i.getAttribute("data-section")??i.id;if(d===e||Ut(d)===n)return i}for(let r of a)for(let i of r.querySelectorAll("h1, h2, h3, h4, h5, h6, [role=heading]"))if(Ut(i.textContent??"")===n)return i;return null}function hi(e,t={}){if(typeof document>"u"||typeof requestAnimationFrame>"u")return()=>{};let n=t.frames??120,a=0,r=()=>{let i=ko(e,t.root??document);if(i){i.hasAttribute("tabindex")||i.setAttribute("tabindex","-1"),i.scrollIntoView?.({block:"start"}),i.focus({preventScroll:!0});return}n-=1,n>0&&(a=requestAnimationFrame(r))};return a=requestAnimationFrame(()=>{a=requestAnimationFrame(r)}),()=>cancelAnimationFrame(a)}var B=I(He(),1);var Jt=I(He(),1);var tt=I(q(),1);function wi({context:e}){return de()?(0,tt.jsxs)(tt.Fragment,{children:[(0,tt.jsx)(bo,{context:e}),(0,tt.jsx)(Vr,{face:"pages",on:e.quickAsk??!0})]}):null}function bo({context:e}){let{store:t}=e,n=de(),{pathname:a}=fe(),r=(0,Jt.useRef)(n?.setSelection);return r.current=n?.setSelection,(0,Jt.useEffect)(()=>{let i=r.current;if(!i)return;let[,d,l]=a.split("/"),s=(()=>{if(d==="places"){let m=e.views?.places().find(x=>x.as===decodeURIComponent(l??""));return m?[Ne(m.kind)]:[]}let c=d?ve(t.schema,d):void 0;return c&&l?[decodeURIComponent(l)]:c?[Na(c)]:[]})();i(c=>c.length===s.length&&c.every((m,x)=>m===s[x])?c:s)},[a]),null}var be=I(He(),1);var Si=I(Zi(),1);var pe=I(q(),1);var xo=Nt(Oa(()=>(__graviewPreload(import.meta.url,["./chunk.TVWN5I4M.js","./chunk.7G4M2PX3.js","./chunk.UGFDSE37.js","./chunk.NNUUD26E.js","./chunk.OJ64WTLW.js","./chunk.GMAXA5GV.js","./chunk.IBJBCZKG.js","./chunk.NQ26KMSQ.js","./chunk.GJQF7I22.js","./chunk.SPU3BVAO.js","./chunk.OPCBZNKF.js","./chunk.UK5F3S2N.js","./chunk.2VJ52LGS.js","./chunk.JI2UVZUU.js","./chunk.CTOBNZLM.js","./chunk.34HGT7HQ.js","./chunk.TNL2BVCH.js","./chunk.NZDHXREL.js","./chunk.TBSPEO2L.js","./chunk.5ON3JSAK.js","./chunk.3SBTQ66X.js","./chunk.SSAY4ITS.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.GLTWLQ6L.js","./chunk.ACB4TD4W.js","./chunk.XCQ7ZPR5.js","./chunk.MY5OXSS7.js","./chunk.NVRK6A7T.js","./chunk.FKJ3HIA5.js","./chunk.GZHZLJBF.js","./chunk.OW72XZF4.js","./chunk.OJGHDWI6.js","./chunk.KRODTMGR.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.HFKGND5Q.js")).then(e=>({default:e.TakeBack}))));function Po({context:e,docked:t,at:n,...a}){let{store:r}=e,i=Z(r),[d]=(0,be.useState)(()=>r.batches().length),l=(0,be.useRef)(!1);return l.current||=i>0||!t&&d>0,l.current?(0,pe.jsx)(be.Suspense,{fallback:null,children:(0,pe.jsx)(xo,{context:e,docked:t,at:n,since:d,...a})}):null}function Co(e,t,n){let{store:a,principal:r,embedded:i}=e;(0,be.useEffect)(()=>{if(!n)return;let d=l=>{if(!Xr(l))return;let s=l.target,c=s instanceof Node&&t.current?.contains(s),m=s===document.body||s===document.documentElement||s===document;if(!(!c&&!(m&&!i))&&Qr(a,r)){l.preventDefault();try{Zr(a,r)}catch{}}};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[a,r,i,t,n])}function ki({context:e,registry:t,root:n,children:a}){let r=(0,be.useMemo)(li,[]),i=t?.without()??new Set;return Co(e,n,!i.has("undo")),(0,pe.jsxs)(wt.Provider,{value:r,children:[(0,pe.jsx)(Ao,{context:e,placed:r,without:i}),a]})}function Ao({context:e,placed:t,without:n}){let[a,r]=(0,be.useState)(!1);(0,be.useLayoutEffect)(()=>r(!0),[]);let i=vt(t,"find"),d=vt(t,"undo"),l=fe(),s=kr();if(!a)return null;let c=l.pathname.split("/").filter(Boolean),x=(c.length===1?ve(e.store.schema,c[0]):void 0)!==void 0;return(0,pe.jsxs)(pe.Fragment,{children:[!i&&!n.has("find")&&s?(0,Si.createPortal)((0,pe.jsx)(vi,{context:e,narrowsLists:x}),s.slot):null,!i&&!n.has("find")&&!s?(0,pe.jsx)("div",{"data-testid":"face-find-bar",style:{display:"flex",alignItems:"center",padding:"8px 16px",borderBottom:"1px solid var(--graview-edge)",background:"var(--graview-bar)",minWidth:0},children:(0,pe.jsx)(vi,{context:e,narrowsLists:x})}):null,!d&&!n.has("undo")?(0,pe.jsx)(Po,{context:e,docked:!0,at:l.pathname+l.search}):null,s?.own&&!n.has("undo")?(0,pe.jsx)(ri,{context:e,own:s.own}):null]})}function vi({context:e,narrowsLists:t}){return(0,pe.jsx)(wt.Provider,{value:null,children:(0,pe.jsx)(Bn,{context:e,narrowsLists:t})})}var X=I(He(),1);var xe=I(q(),1),Ro=500,Lo=10;function en(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA"||e.tagName==="SELECT"?!0:e.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(e.type):!1}function To(e){let t=typeof getSelection=="function"?getSelection():null;return t!==null&&!t.isCollapsed&&t.containsNode(e,!0)}function bi(e){let t=e.closest('a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])');if(t)return t;let n=document.activeElement;return n instanceof HTMLElement&&n!==document.body?n:null}function xi({context:e,root:t,children:n}){return de()===null?(0,xe.jsx)(xe.Fragment,{children:n}):(0,xe.jsx)(Mo,{context:e,root:t,children:n})}function Mo({context:e,root:t,children:n}){let{setMenuAt:a}=Ka(),{store:r}=e,i=r.schema,d=De(),{pathname:l,search:s}=fe(),c=Ze("/").replace(/\/$/,""),m=(0,X.useCallback)((w,f)=>e.views?.places().find(L=>L.as===w&&(f===null||L.kind===f)),[e.views]),x=(0,X.useCallback)((w,f)=>{let[L="",$,ne]=w.split("/").filter(Boolean).map(p=>{try{return decodeURIComponent(p)}catch{return p}});if(ne!==void 0)return null;if(L==="places"&&$!==void 0){let p=m($,new URLSearchParams(f).get("of"));return p?{face:"pages",place:p.as,about:[Ne(p.kind)],title:p.title}:null}let Y=ve(i,L);return Y?$===void 0?{face:"pages",about:[Ne(Y)],title:Ge(i,Y)}:r.graph.getNode($)?{face:"pages",on:$,about:[$]}:null:null},[i,r,m]),g=(0,X.useCallback)(w=>{let f=w.href;try{let L=new URL(f,location.href);if(L.origin===location.origin&&(c===""||L.pathname===c||L.pathname.startsWith(`${c}/`))){let $=x(L.pathname.slice(c.length),L.search);if($)return{...$,href:f}}}catch{}return{face:"pages",about:[],href:f}},[c,x]),u=(0,X.useCallback)(()=>x(l,s)??{face:"pages",about:[]},[x,l,s]),A=(0,X.useCallback)(w=>{let f=u(),L=w.closest("[data-graview-field]")?.getAttribute("data-graview-field");if(L&&f.on!==void 0&&w.closest("[data-graview-pick], a[href]")===null)return{...f,field:L};let $=w.closest("[data-graview-act]")?.getAttribute("data-graview-act");if($)return{...f,act:$};let ne=w.closest("a[href]"),Y=w.closest("[data-graview-listed]"),p=[w.closest("[data-graview-pick]")?.getAttribute("data-graview-pick"),Y&&(!ne||Y.contains(ne)&&ne.classList.contains("graview-spec-item-link"))?Y.getAttribute("data-graview-listed"):null].map(j=>j?r.graph.getNode(j):void 0).find(Boolean);if(p)return{face:"pages",on:p.id,about:[p.id],href:`${c}${z(i,p.kind,p.id)}`};if(ne)return g(ne);let T=w.closest("[data-graview-record]")?.getAttribute("data-graview-record");return T&&r.graph.getNode(T)?{face:"pages",on:T,about:[T]}:f},[u,g,r,i,c]),N=(0,X.useCallback)(w=>{let f=t.current;if(f===null||!f.contains(w)||en(w)||w.closest("[data-graview-popover]"))return null;let L=A(w);return{face:"pages",on:L.on,about:L.about??[],field:L.field,place:L.place,href:L.href,act:L.act,element:bi(w)}},[A,t]),G=(0,X.useCallback)((w,f,L)=>{let $=A(w);a({...$,x:Math.round(f),y:Math.round(L),returnTo:bi(w)})},[A,a]),b=(0,X.useCallback)(w=>{let f=w.getBoundingClientRect();G(w,f.left+Math.min(16,f.width/2),Math.min(f.bottom,f.top+36))},[G]),E=(0,X.useRef)(0),k=(0,X.useRef)(null),P=(0,X.useRef)(!1),K=()=>{k.current&&clearTimeout(k.current.timer),k.current=null};(0,X.useEffect)(()=>K,[]),(0,X.useEffect)(()=>{let w=f=>{if(f.defaultPrevented||!(f.key==="ContextMenu"||f.key==="F10"&&f.shiftKey))return;let L=t.current,$=f.target instanceof Element?f.target:null,ne=$===null||$===document.body||$===document.documentElement,Y=L!==null&&$!==null&&L.contains($);if(!Y&&!(ne&&document.querySelector("[data-graview-face='pages']")===L)||en($)||$?.closest("[data-graview-popover]"))return;f.preventDefault(),E.current=Date.now();let p=Y&&$ instanceof HTMLElement?$:L?.querySelector("[data-graview-page-title], main h1, main")??null;p&&b(p)};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[t,b]),(0,X.useEffect)(()=>{let w=t.current;if(!w)return;let f=L=>{let $=L.detail;$&&a({...$,face:"pages"})};return w.addEventListener(Cn,f),()=>w.removeEventListener(Cn,f)},[t,a]);let ae=(0,X.useMemo)(()=>w=>{if(w.face!=="pages")return null;let f=[],L=w.on===void 0?void 0:r.graph.getNode(w.on),$=w.place===void 0?void 0:e.views?.places().find(se=>se.as===w.place),ne=L?void 0:w.about.length===1&&w.about[0].startsWith("aggregate:")&&!$?Eo(w.about[0]):void 0,Y=L?z(i,L.kind,L.id):$?ye(e,$):ne?`/${V(i,ne)}`:void 0,p=Y!==void 0&&l===Y.split("?")[0];Y!==void 0&&!p&&f.push({id:"open",label:"Open",run:()=>d(Y)});let T=Y!==void 0?`${c}${Y}`:w.href;T!==void 0&&f.push({id:"open-in-a-new-tab",label:"Open in a new tab",run:()=>void window.open(T,"_blank","noopener")});let j=L?`#focus=${encodeURIComponent(L.id)}`:$?`#focus=${encodeURIComponent(Ne($.kind))}&view=${encodeURIComponent($.as)}`:ne?`#focus=${encodeURIComponent(Ne(ne))}`:void 0;if(j!==void 0&&(e.overview||!e.embedded)){let se=e.overview;f.push({id:"in-the-scene",label:"Show in the scene",run:()=>se?se(j):location.assign(`${e.sceneHref??"/"}${j}`)})}return L===void 0&&w.href===void 0&&f.push({id:"find",label:"Find\u2026",run:()=>{let se=t.current?.querySelector('[data-testid="nav-find"]')??document.querySelector('[data-testid="nav-find"]');se&&se.offsetParent!==null?se.focus():d("/search")}}),f.length>0?{id:"pages",items:f}:null},[r,i,e,l,c,d,t]),ue=(0,X.useMemo)(()=>w=>{if(w.face!=="pages"||w.field===void 0||w.on===void 0)return null;let f=r.graph.getNode(w.on),L=w.element?.closest("[data-graview-field]")??t.current?.querySelector(`[data-graview-field="${CSS.escape(w.field)}"]`);return!f||!(L instanceof HTMLElement)||!L.hasAttribute("data-graview-editable")?null:{id:"field",at:"start",items:[{id:"change-field",label:`Change \u201C${va(i.tryDefinition(f.kind),w.field)}\u201D`,run:()=>L.click()}]}},[r,i,t]),oe=_r(),_=mr(),ge=Or(),Ke=(0,X.useCallback)((w,f)=>{l===ye(e,w).split("?")[0]&&d(f?ye(e,f):"/")},[l,e,d]),Pe=Yr(Ke),Ce=(0,X.useMemo)(()=>[ue,ge,ae,...Pe?[Pe]:[],..._?[_]:[],...oe?[oe]:[]],[ue,ge,ae,Pe,_,oe]);return(0,xe.jsxs)(cr,{sections:Ce,children:[(0,xe.jsx)("div",{"data-graview-menu-ground":"",style:{display:"contents"},onContextMenu:w=>{let f=w.target;w.shiftKey||en(f)||To(f)||(w.preventDefault(),!f.closest("[data-graview-popover]")&&(Date.now()-E.current<700||(w.clientX===0&&w.clientY===0&&f instanceof HTMLElement?b(f):G(f,w.clientX,w.clientY))))},onPointerDown:w=>{if(P.current=!1,w.pointerType==="mouse"||!w.isPrimary)return;let f=w.target;if(en(f)||f.closest("[data-graview-choose], [data-graview-popover]"))return;K();let{clientX:L,clientY:$}=w;k.current={x:L,y:$,timer:setTimeout(()=>{k.current=null,P.current=!0,E.current=Date.now(),G(f,L,$)},Ro)}},onPointerMove:w=>{let f=k.current;f&&Math.hypot(w.clientX-f.x,w.clientY-f.y)>Lo&&K()},onPointerUp:K,onPointerCancel:K,onClickCapture:w=>{P.current&&(P.current=!1,w.preventDefault(),w.stopPropagation())},children:n}),(0,xe.jsx)($o,{openAt:b,readyAt:N}),(0,xe.jsx)(zr,{placement:"page"}),(0,xe.jsx)(fr,{})]})}function Eo(e){let t=e.slice(10).split("+");return t.length===1&&t[0]?t[0]:void 0}function $o({openAt:e,readyAt:t}){return(0,xe.jsx)("span",{"data-graview-menu-home":"",tabIndex:-1,onFocus:n=>{if(n.target!==n.currentTarget)return;let a=n.currentTarget.closest("[data-graview-face]"),r=a?.querySelector("[data-graview-page-title]")??a?.querySelector("main h1, main")??null;r&&(r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),r.focus({preventScroll:!0}))},style:{position:"absolute",width:0,height:0,overflow:"hidden"},children:(0,xe.jsx)(Ur,{placement:"menu",openActs:e,aimAt:t})})}var D=I(q(),1);function Pi(e,t){return t==="*"?{label:"anything",path:null}:{label:Q(e,t),path:`/${V(e.schema,t)}`}}function Oo({context:e,relation:t}){let{store:n}=e,a=Pi(n,t.from),r=Pi(n,t.to),i=d=>d.path?(0,D.jsx)(H,{to:d.path,style:{...Se,fontWeight:550},children:d.label}):(0,D.jsx)("span",{children:d.label});return(0,D.jsxs)("li",{"data-testid":"relation","data-relation":t.edgeKind,style:{display:"grid",gridTemplateColumns:"30px minmax(0, 1fr) auto",gap:12,alignItems:"baseline"},children:[(0,D.jsx)(jr,{edgeKind:t.edgeKind,...e.brand?.kit?{kit:e.brand.kit}:{}}),(0,D.jsxs)("span",{style:{display:"grid",gap:1},children:[(0,D.jsxs)("span",{children:[i(a)," ",(0,D.jsxs)("span",{style:C,"data-graview-speaks-ids":"",children:[ze(t.edgeKind)," \u2192"]})," ",i(r)]}),t.description||t.inverse?(0,D.jsxs)("span",{style:C,children:[t.description?Re(t.description):null,t.description&&t.inverse?" \xB7 ":null,t.inverse?`from the other end, ${t.inverse}`:null]}):null]}),r.path?(0,D.jsx)(H,{to:`${r.path}?with=${encodeURIComponent(t.edgeKind)}`,style:{...U,...C,fontVariantNumeric:"tabular-nums",display:"inline-block",minWidth:24,minHeight:24,textAlign:"center"},title:`The ${r.label.toLowerCase()} that have this`,children:t.count}):(0,D.jsx)("span",{style:{...C,fontVariantNumeric:"tabular-nums"},children:t.count})]})}function Ci({context:e,heading:t=!0}){let{store:n}=e,a=new Set(Fe(n,e.principal)),r=Je(n).relations.filter(i=>a.has(i.from)&&(i.to==="*"||a.has(i.to)));return r.length===0?null:(0,D.jsxs)("section",{style:{...ee,display:"grid",gap:12},"data-testid":"kind-map",children:[t?(0,D.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,D.jsx)("h2",{style:J,children:(0,D.jsx)(H,{to:"/map",style:Se,children:"Connections"})}),(0,D.jsx)("span",{style:C,children:r.length===1?"1 relation":`${r.length} relations`})]}):null,(0,D.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:r.map(i=>(0,D.jsx)(Oo,{context:e,relation:i},`${i.edgeKind}|${i.from}|${i.to}`))})]})}function Qn({context:e}){let{store:t}=e;Z(t);let n=new Set(Fe(t,e.principal)),a=Je(t),r=a.relations.filter(i=>n.has(i.from));return(0,D.jsxs)(te,{context:e,children:[(0,D.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,D.jsx)("p",{style:we,children:r.length===0?"No relations":`${r.length} ${r.length===1?"relation":"relations"}`}),(0,D.jsx)(ie,{context:e,children:"Connections"}),(0,D.jsx)("p",{style:re,children:r.length===0?"Nothing here is declared to relate to anything else yet.":"The kinds this installation holds, and the relations declared between them \u2014 each in the declaration's own words, with how many of it there are."})]}),(0,D.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},"data-testid":"map-kinds",children:a.kinds.filter(i=>n.has(i.kind)).map(i=>(0,D.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,D.jsx)(ce,{kind:i.kind,brand:e.brand,schema:t.schema,size:7}),(0,D.jsx)(H,{to:`/${V(t.schema,i.kind)}`,style:U,children:i.plural}),(0,D.jsx)("span",{style:C,children:i.count})]},i.kind))}),(0,D.jsx)(Ci,{context:e,heading:!1})]})}function Ai({context:e}){let n=[...de()?.robots.values()??[]].filter(r=>r.mode==="asking"&&r.say);if(n.length===0)return null;let{store:a}=e;return(0,D.jsxs)("section",{style:{...ee,display:"grid",gap:10},"data-testid":"seat-questions",children:[(0,D.jsx)("h2",{style:J,children:n.length===1?"The seat asked something":`The seat asked ${n.length} things`}),(0,D.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8},children:n.map(r=>{let i=r.at?a.graph.getNode(r.at):void 0;return(0,D.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,D.jsx)("span",{children:r.say}),i?(0,D.jsxs)(H,{to:z(a.schema,i.kind,i.id),style:{...U,...C},children:[me(a.schema.tryDefinition(i.kind),i)," \u2192"]}):null]},r.participant)})})]})}var W=I(q(),1);function Zn({context:e}){let{principal:t}=e,{store:n,brand:a,invariantContext:r}=e;Z(n);let i=n.violations(r),d=`${i.length===1?"A rule is broken":"Rules are broken"} \u2014 see what, and what would fix it`,l=[...n.log.all()].slice(-5).reverse(),c=zt(e).map(b=>({kind:b,members:n.graph.nodesOfKind(b).filter(E=>st(n.schema.tryDefinition(b),E))})),m=c.filter(b=>b.members.length>0),x=c.map(b=>({entry:b,creator:n.allMutations().find(E=>(E.creates??[]).includes(b.kind)&&n.permits({name:E.name,args:{}},e.principal).ok)})).find(b=>b.creator!==void 0),g=m.length===0?"Nothing here yet.":`${m.map(b=>Tt(n.schema,b.kind,b.members.length)).join(", ").replace(/, ([^,]*)$/," and $1")}.`,u=e.views?.homeView?.(),A=n.schema.kinds.some(b=>n.graph.nodesOfKind(b).length>0);if(u&&A){let b=a?.subtitle&&a.subtitleDrawn!==!1?(0,W.jsx)("p",{style:{...C,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,E=u[Symbol.for("graview.home-blocks")]===!0;return(0,W.jsx)(te,{context:e,style:ct,children:(0,W.jsxs)("div",{style:{display:"grid",gap:12},"data-testid":"home-view",children:[E?null:b,i.length>0?(0,W.jsx)(H,{to:"/problems",style:{...U,color:"var(--graview-warn)"},children:d}):null,(0,W.jsx)(Kr.Provider,{value:E?b:null,children:(0,W.jsx)(Zt,{when:Ot(u),children:(0,W.jsx)(u,{cardinality:"many",fidelity:"full",mode:"fullscreen",selected:!1})})})]})})}let N=new Set(Fe(n,e.principal)),G=Je(n).relations.filter(b=>N.has(b.from)&&(b.to==="*"||N.has(b.to)));return(0,W.jsxs)(te,{context:e,style:ct,children:[(0,W.jsxs)("header",{style:{display:"grid",gap:12},children:[a?.subtitle&&a.subtitleDrawn!==!1?(0,W.jsx)("p",{style:{...C,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,(0,W.jsx)(ie,{context:e,"data-testid":"standing",children:g}),(0,W.jsxs)("p",{style:{...re,display:"grid",gap:4},"data-testid":"standing-card",children:[m.length===0&&x?(0,W.jsxs)("span",{children:["Begin with \u201C",x.creator?.title??x.creator?.name,"\u201D, under"," ",(0,W.jsx)(H,{to:`/${V(n.schema,x.entry.kind)}`,style:U,children:Q(n,x.entry.kind)}),"."]}):null,i.length===0?(0,W.jsx)("span",{children:"All rules hold."}):(0,W.jsx)(H,{to:"/problems",style:{...U,color:"var(--graview-warn)"},children:d})]})]}),(0,W.jsx)(_n,{context:e}),(0,W.jsxs)("section",{style:{...ee,display:"grid",gap:14},"data-testid":"kinds",children:[(0,W.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,W.jsx)("h2",{style:J,children:"What is here"}),G.length>0?(0,W.jsx)(H,{to:"/map",style:{...qe,...C,marginLeft:"auto"},"data-testid":"map-link",children:(0,W.jsxs)(Qe,{children:["Connections \xB7 ",G.length===1?"1 relation":`${G.length} relations`]})}):null]}),(0,W.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"8px 10px"},children:c.map(({kind:b,members:E})=>(0,W.jsx)("li",{style:{maxWidth:"100%"},children:(0,W.jsxs)(H,{to:`/${V(n.schema,b)}`,style:{...Se,flexWrap:"wrap",gap:8,padding:"6px 14px 6px 10px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)"},children:[(0,W.jsx)(ce,{kind:b,brand:a,schema:n.schema,size:7}),(0,W.jsx)("span",{style:{fontWeight:550,overflowWrap:"anywhere"},children:Q(n,b)}),(0,W.jsx)("span",{style:{...C,fontVariantNumeric:"tabular-nums"},children:E.length===0?"none yet":ft(E.length)})]})},b))})]}),l.length>0?(0,W.jsxs)("section",{style:{...ee,display:"grid",gap:10},children:[(0,W.jsx)("h2",{style:J,children:"Recently"}),(0,W.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:l.map(b=>(0,W.jsxs)("li",{style:C,children:[(0,W.jsx)("span",{style:{color:"var(--graview-ink)"},children:b.intent})," \u2014 ",ht(b,t,{graph:n.graph,schema:n.schema,...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}})]},b.id))})]}):null]})}var Me=I(He(),1);var nt=I(q(),1);function tn({context:e,withheld:t,style:n,testId:a}){let r=de(),i=La(t,e.signIn??r?.signIn);return i?(0,nt.jsx)("p",{style:{...n,margin:0},children:(0,nt.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>i.run(),style:ke,children:i.label})}):t.length===0?null:(0,nt.jsx)("ul",{style:{...n,margin:0,padding:0,listStyle:"none",display:"grid",gap:4},...a?{"data-testid":a}:{},children:t.map(d=>(0,nt.jsxs)("li",{style:C,children:[(0,nt.jsx)("s",{children:d.label})," \u2014 ",d.refusal.message]},d.id))})}var M=I(q(),1);function Xn({context:e}){let{store:t,brand:n,principal:a,invariantContext:r}=e;Z(t);let[i]=pt(),d=i.get("q")??"",l=typeof r?.today=="string"?r.today:void 0,s=Lr(t,d,{...a?{principal:a}:{},places:$e(e),flagged:new Set(t.violations(r).flatMap(u=>u.nodeIds)),...l?{today:l}:{},limit:200}),c=s.hits.filter(u=>u.about==="node"),m=s.hits.filter(u=>u.about==="kind"||u.about==="place"||u.about==="rule"),x=[...new Set(c.map(u=>u.kind))],g=d.trim();return(0,M.jsxs)(te,{context:e,children:[(0,M.jsx)("style",{children:_t}),(0,M.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,M.jsx)("p",{style:we,children:"Search"}),(0,M.jsx)(ie,{context:e,"data-testid":"search-heading",children:g.length===0?"Find anything by its name":s.hits.length===0?(0,M.jsxs)(M.Fragment,{children:["Nothing here is called \u201C",g,"\u201D."]}):(0,M.jsxs)(M.Fragment,{children:[No(t,s.byKind)," for \u201C",g,"\u201D"]})}),g.length>0?(0,M.jsxs)("p",{style:{...C,margin:0},"data-testid":"search-searched",children:[Dt(t.schema,s.searched),s.conditions.filter(u=>u.key!=="is"&&u.admittedBy.length<s.searched.kinds.length).map(u=>(0,M.jsxs)("span",{children:[" ",u.key,":",u.value," narrows"," ",u.admittedBy.length===0?"nothing here":u.admittedBy.map(A=>Q(t,A).toLowerCase()).join(" and "),"."]},`${u.key}:${u.value}`))]}):(0,M.jsxs)("p",{style:re,children:["Type in the box above. Words find the start of words in names and in what each record says;"," ",(0,M.jsx)("code",{children:"done:false"})," and the like narrow as a list does, and ",(0,M.jsx)("code",{children:"is:any"})," includes what is past."]})]}),m.length>0?(0,M.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},"data-testid":"search-named",children:m.map(u=>(0,M.jsx)("li",{"data-testid":"search-hit","data-about":u.about,children:u.about==="kind"?(0,M.jsxs)(H,{to:`/${V(t.schema,u.kind)}`,style:U,children:[u.label,u.count>0?(0,M.jsxs)("span",{style:C,children:[" \xB7 ",u.count," match"]}):null]}):u.about==="place"?(0,M.jsxs)(H,{to:ye(e,u),style:U,children:["Go to ",u.title]}):u.about==="rule"?(0,M.jsxs)(H,{to:"/problems",style:U,children:["The rule \u201C",u.label,"\u201D"]}):null},`${u.about}:${u.about==="rule"?u.name:u.about==="place"?u.as:u.kind}`))}):null,x.map(u=>(0,M.jsxs)("section",{className:"graview-list",style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",minWidth:0},"data-testid":"search-group","data-kind":u,children:[(0,M.jsxs)("h2",{className:"graview-group-head",style:{alignItems:"center"},children:[(0,M.jsx)(ce,{kind:u,brand:n,schema:t.schema,size:8}),(0,M.jsx)(H,{to:`/${V(t.schema,u)}?${new URLSearchParams({q:g}).toString()}`,style:U,"data-testid":"search-kind-link",children:Q(t,u)}),(0,M.jsx)("span",{children:s.byKind[u]})]}),(0,M.jsx)("ul",{className:"graview-rows",children:c.filter(A=>A.kind===u).map(A=>(0,M.jsxs)("li",{"data-testid":"search-hit","data-about":"node",className:"graview-row",children:[(0,M.jsxs)(H,{to:z(t.schema,u,A.id),className:"graview-row-title",...A.label.length>60?{title:A.label}:{},children:[A.flagged?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,A.label]}),A.apart||!A.current?(0,M.jsx)("span",{className:"graview-row-glance",children:[A.apart,A.current?"":"past"].filter(Boolean).join(" \xB7 ")}):null,(0,M.jsx)(nn,{why:A.why})]},A.id))})]},u)),g.length>0?(0,M.jsx)(Ho,{asked:g}):null,g.length>0&&s.hits.length===0?(0,M.jsx)(Li,{store:t,kinds:s.searched.kinds,words:s.words,...a?{principal:a}:{},...r?{invariantContext:r}:{}}):null]})}function nn({why:e}){return e.strength==="near"?(0,M.jsxs)("span",{style:C,"data-testid":"search-why","data-near":"",children:["Near \u201C",e.asked,"\u201D",e.field==="label"?"":` \u2014 ${e.reading}: ${e.fragment}`]}):e.field==="label"?null:(0,M.jsxs)("span",{style:C,"data-testid":"search-why",children:[e.reading,": ",e.fragment]})}function No(e,t){let n=Object.entries(t).map(([a,r])=>`${r} ${r===1?Ye(e.schema.tryDefinition(a),a):Q(e,a).toLowerCase()}`);return n.length===0?"Found":n.length===1?Re(n[0]):Re(`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`)}function Ri(e,t,n={}){let a=[];for(let r of t){let i=Xe(e,r,{...n.principal?{principal:n.principal}:{},...n.invariantContext?{context:n.invariantContext}:{}});for(let d of an(e,r,i.actions.affordances))a.some(l=>l.mutation.name===d.mutation.name)||a.push(d)}return a}function an(e,t,n){let a=e.schema.tryDefinition(t)?.fieldRoles?.label,r=[];for(let i of n){let d=e.allMutations().find(c=>c.name===i.mutation);if(!d||!d.creates?.includes(t)||r.some(c=>c.mutation.name===d.name))continue;let l=yr(d.input).map(c=>c.name),s=l.includes("label")?"label":a&&l.includes(a)?a:void 0;!s||i.args[s]!==void 0||r.push({kind:t,affordance:i,mutation:d,arg:s})}return r}function Li({store:e,kinds:t,words:n,principal:a,invariantContext:r}){let i=Ri(e,t,{...a?{principal:a}:{},...r?{invariantContext:r}:{}});return i.length===0||n.trim().length===0?null:(0,M.jsx)("div",{style:{display:"grid",gap:24},"data-testid":"search-to-create",children:i.map(({kind:d,affordance:l,mutation:s,arg:c})=>(0,M.jsxs)("section",{style:{...ee,display:"grid",gap:14},children:[(0,M.jsxs)("h2",{style:J,children:[Re(Sa(Ye(e.schema.tryDefinition(d),d)))," called \u201C",n,"\u201D"]}),(0,M.jsx)(Ie,{store:e,mutation:s,prefilled:l.args,open:l.open,initial:{[c]:n},...a?{principal:a}:{}})]},`${l.id}|${n}`))})}function Ho({asked:e}){let t=de();return t?(0,M.jsx)(Io,{asked:e,desk:t.aiDesk}):null}function Io({asked:e,desk:t}){return _a(t)?(0,M.jsx)("p",{style:{margin:0},children:(0,M.jsxs)("button",{type:"button","data-testid":"search-ask",onClick:a=>ja(t,{pointed:{about:[]},asked:e,returnTo:a.currentTarget}),style:{...U,font:"inherit",padding:0,border:0,background:"transparent",cursor:"pointer",textAlign:"start"},children:["Ask: \u2018",e,"\u2019"]})}):null}var h=I(q(),1),Mi=8,Ei=40;function Fo(e,t){let n=t?.fields?.shape??{},a=Object.keys(n).find(r=>ba(n[r])&&ka(e[r]));return a===void 0?void 0:e[a]}function Jn({context:e}){let t=Ue(),n=ve(e.store.schema,t.slug??"");return n?(0,h.jsx)($i,{context:e,kind:n}):(0,h.jsx)(te,{context:e,children:(0,h.jsx)(ie,{context:e,children:"No such kind of thing here."})})}function $i({context:e,kind:t,opening:n,row:a,layout:r="list",description:i,bare:d}){let{store:l,brand:s,invariantContext:c}=e;Z(l);let[m,x]=pt(),g=`list-${(0,Me.useId)().replace(/:/g,"")}`,u=l.schema.tryDefinition(t),A=Pa(m.get("archived")),N=l.graph.nodesOfKind(t,{archived:A}),G=Je(l).relations.filter(o=>o.from===t||o.to===t),b=new Set(l.violations(c).flatMap(o=>o.nodeIds)),E=Cr(l.schema,Pr(l.schema,xr(l.schema,t))),k=G.map(o=>o.edgeKind),P=qo(m,E,k),K=["sort","filter","group","q","by","with","past","archived",...k].some(o=>m.has(o)),ae=N.length>=Ei,ue=u?.fieldRoles?.when,oe=e.views?.arrangement?.()?.lists?.[t],_=wr(oe),ge=hr(oe?.group),Ke=Go(ae,ue),Pe=n??(_?{...Ke,..._}:Ke),Ce=K?P.arrangement:$n(Pe,E).arrangement,w=_?.sort,f=Ce.sort&&w?.then&&Ce.sort.by===w.by&&Ce.sort.direction===w.direction?{...Ce,sort:w}:Ce,L=Ar(f.query??""),$=[...f.filter??[],...L.conditions].some(o=>o.key==="is"&&(o.value==="past"||o.value==="any"))||br(u,[...f.filter??[],...L.conditions]),ne=$||!u?.lifecycle?f:{...f,filter:[...f.filter??[],{key:"is",value:"current"}]},Y=new Map,p=Wt(N,ne,{schema:l.schema,graph:l.graph,flagged:b,...typeof c?.today=="string"?{today:c.today}:{},read:(o,y)=>{let O=Y.get(o.id);return O||Y.set(o.id,O=yt(l.schema,l.graph,o)),O[y]}}),T=ge&&f.group?.by===ge.by&&!f.group.bucket?E.groups.find(o=>o.key===ge.by):void 0,j=ge&&T&&(T.type==="choice"||T.type==="boolean")?vr(p.groups,ge,{type:T.type,...T.options?{options:T.options}:{}}):p.groups.map(o=>({...o,closed:!1})),se=new Set((m.get("open")??"").split(",").filter(Boolean)),Wi=!!f.query||(f.filter??[]).some(o=>o.key===ge?.by),aa=o=>T?.type==="boolean"?o==="1"?"true":"false":o,ra=o=>o.closed&&!Wi&&!se.has(aa(o.key)),Ki=o=>{let y=new URLSearchParams(m),O=new Set(se);O.has(o)?O.delete(o):O.add(o),O.size>0?y.set("open",[...O].join(",")):y.delete("open"),x(y,{replace:!0})},Ae=p.nodes,rt=u?.lifecycle&&!$?N.filter(o=>st(u,o)):N,ia=N.length-rt.length,sn=f.group?.by??null,Bi=o=>{let y=new URLSearchParams(m);for(let le of["sort","filter","group","q","by","with","past","archived",...G.map(Rt=>Rt.edgeKind)])y.delete(le);let O=Tr(o);for(let le of["sort","filter","group","q","archived"])O[le]&&y.set(le,O[le]);![...y.keys()].some(le=>["sort","filter","group","q"].includes(le))&&(n||_||ae||ue)&&y.set("sort",""),x(y)},{principal:it}=e,ln=Xe(l,t,{...it?{principal:it}:{},...e.invariantContext?{context:e.invariantContext}:{}}),Be=ln.actions.affordances.map(o=>({affordance:o,mutation:l.allMutations().find(y=>y.name===o.mutation)})).filter(o=>o.mutation!==void 0),Gi=ln.actions.withheld,dn=()=>new Set(Ae.length===0?Be.map(({mutation:o})=>o.name):[]),[cn,oa]=(0,Me.useState)(()=>({kind:t,open:dn()}));cn.kind!==t&&oa({kind:t,open:dn()});let sa=o=>(cn.kind===t?cn.open:dn()).has(o),la=(o,y)=>oa(O=>{let le=new Set(O.open);return y?le.add(o):le.delete(o),{kind:O.kind,open:le}}),da=`begin-${(0,Me.useId)().replace(/:/g,"")}`,ca=L.words&&Ae.length===0?Object.fromEntries(an(l,t,ln.actions.affordances).map(o=>[o.mutation.name,o.arg])):{},je=Q(l,t),xt=e.views?.lookup(t,{cardinality:"one",fidelity:"glyph"}),pn=xt!==void 0&&!lt(xt)?xt:void 0,un=(f.group?.bucket??"day")==="day"?f.group?.by:void 0,gn=(f.filter??[]).map(o=>o.key),qi=gn.filter(o=>gn.indexOf(o)===gn.lastIndexOf(o)&&/choice|boolean/.test(E.filters.find(y=>y.key===o)?.type??"")),mn=o=>{let y={...u?.computed?yt(l.schema,l.graph,o):o};un&&!String(y[un]).includes("T")&&delete y[un];for(let O of qi)delete y[O];return y},pa=o=>rr(u?.fields?.shape?.[o])?.type==="enum",Pt=o=>{let y=me(u,o);if(a)return(0,h.jsxs)("li",{"data-testid":"record-row","data-graview-record":o.id,style:{minWidth:0},...Sn(o.id),children:[vn(o,y),a(o,{label:y,href:z(l.schema,t,o.id),flagged:b.has(o.id),glance:ni(mn(o),u,y)})]},o.id);if(pn){let kn=qt(xt,o,l.graph),Yi=Object.fromEntries(Object.entries(mn(o)).filter(([Qi])=>!kn?.fields.has(Qi))),ha=kn?Fn(Yi,u,kn.title??y,pa):[];return(0,h.jsxs)("li",{"data-testid":"record-row","data-graview-record":o.id,style:{position:"relative",display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:16,rowGap:2,paddingBlock:10,borderTop:"1px solid var(--graview-edge)"},...Sn(o.id),children:[vn(o,y),(0,h.jsx)("div",{style:{flex:"1 1 14rem",minWidth:0},children:(0,h.jsx)(pn,{node:o,cardinality:"one",fidelity:"glyph",mode:"fullscreen",selected:!1,...b.has(o.id)?{flagged:[o.id]}:{}})}),ha.length>0?(0,h.jsx)("span",{style:{...C,flex:"0 1 auto",minWidth:0,overflowWrap:"anywhere"},"data-testid":"record-glance",children:(0,h.jsx)(Dn,{runs:ha})}):null,(0,h.jsx)(jo,{to:z(l.schema,t,o.id),label:b.has(o.id)?`${y} \u2014 implicated in a problem`:y})]},o.id)}let O=Fn(mn(o),u,y,pa),le=O.length>0,Rt=L.words?Rr(u,o,L.words):void 0,fa=ae?void 0:or(o,u),Lt=Fo(o,u),ya=(0,h.jsxs)(H,{to:z(l.schema,t,o.id),className:"graview-row-title",...y.length>60?{title:y}:{},children:[b.has(o.id)?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,y]});return(0,h.jsxs)("li",{className:"graview-row","data-graview-record":o.id,...Sn(o.id),children:[vn(o,y),fa?(0,h.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:14,minWidth:0},children:[(0,h.jsx)(dt,{as:"thumb",file:fa}),ya]}):ya,le||Lt?(0,h.jsxs)("span",{className:"graview-row-glance",children:[(0,h.jsx)(Dn,{runs:O}),le&&Lt?" \xB7 ":null,Lt?(0,h.jsx)(Kt,{address:Lt}):null]}):null,Rt?(0,h.jsx)(nn,{why:Rt}):null]},o.id)},fn=$e(e).filter(o=>o.kind===t&&!o.hidden),ua=oe?.filters,Ui=(f.filter??[]).some(o=>o.key!=="is"||o.value!=="any"),Vi=!!(f.sort||f.group||f.query||Ui),ji=rt.length>=Mi||K&&Vi,Oe=f.sort?E.sorts.find(o=>o.key===f.sort.by):void 0,yn=Oe?.type==="date"||Oe!==void 0&&Oe.key===ue,ga=ae&&!p.grouped&&Oe&&(Oe.about==="label"||Oe.type==="text"||yn)?o=>{let y=Oe.about==="label"?me(u,o):o[Oe.key];if(typeof y!="string"||y.length===0)return yn?"No date":"#";if(yn)return y.slice(0,4);let O=y.trim().charAt(0).toLocaleUpperCase();return/\p{L}/u.test(O)?O:"#"}:void 0,_e=ga?Ae.reduce((o,y)=>{let O=ga(y);return o.at(-1)?.key===O?o.at(-1).nodes.push(y):o.push({key:O,nodes:[y]}),o},[]):void 0,ma=p.grouped&&sn?j.flatMap(o=>ra(o)?[]:o.nodes):_e&&_e.length>1?_e.flatMap(o=>o.nodes):Ae,hn=(0,Me.useMemo)(()=>ma.map(o=>o.id),[ma.map(o=>o.id).join(`
6
- `)]),Ee=Nr(hn),wn=(0,Me.useId)(),gt=(it?l.permittedMutations(it):l.permittedMutations()).some(o=>{let y=o.subject?.kinds;return y!==void 0&&(y==="*"||y.includes(t))}),vn=(o,y)=>gt?(0,h.jsx)("span",{className:"graview-choose-at",children:(0,h.jsx)("input",{...Ee.boxProps(o.id,y),onPointerEnter:On,onFocus:On})}):null,Sn=o=>gt?{"data-graview-choose":o}:{},_i=(0,Me.useCallback)(o=>{Ee.choose(o),requestAnimationFrame(()=>{let y=Ee.list.current;((o[0]===void 0?null:y?.querySelector(`[data-graview-choose-box="${CSS.escape(o[0])}"]`))??y)?.focus({preventScroll:!0})})},[Ee]),ot=r==="grid"?{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 15rem), 1fr))",alignItems:"start",gap:12}:a||pn?{margin:0,padding:0,listStyle:"none",display:"grid",gap:a&&r==="list"?6:0}:void 0,Ct=ot?void 0:"graview-rows",mt=o=>`list-at-${o.replace(/[^\p{L}\p{N}]/gu,"_")}`,At=G.map(o=>{let y=o.from===t?o.to:o.from,O=o.from===t?o.description:o.inverse??o.description;return{relation:o,far:y,words:O}}),zi=new Set(At.map(o=>(o.words??"").toLowerCase()).filter((o,y,O)=>o&&O.indexOf(o)!==y));return(0,h.jsxs)(d?Bo:te,{context:e,children:[(0,h.jsxs)("div",{style:{display:"grid",gap:12},children:[(0,h.jsxs)("header",{style:{display:"grid",gap:4},children:[d?null:(0,h.jsx)(ut,{context:e}),(0,h.jsxs)("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",columnGap:10,rowGap:4,minWidth:0},children:[(0,h.jsx)(ce,{kind:t,brand:s,schema:l.schema,size:8}),(0,h.jsx)(ie,{context:e,children:je}),Be.length>0?(0,h.jsx)("span",{style:{marginLeft:"auto",display:"flex",flexWrap:"wrap",columnGap:14,rowGap:8},"data-testid":"beginnings-open",children:Be.map(({affordance:o,mutation:y})=>(0,h.jsx)(Uo,{name:y.name,title:y.title??y.name,panel:`${da}-${y.name}`,open:sa(y.name),onOpen:O=>la(y.name,O)},o.id))}):null]}),Ae.length>0?(0,h.jsx)(Jr,{place:"here",to:[{label:`Skip to the ${Ae.length===1?Ye(u,t):`${Ae.length} ${je.toLowerCase()}`}`,testid:"records",go:()=>{let o=document.querySelector(`[data-graview-skip-target="${CSS.escape(wn)}"]`);Nn(o?.querySelector('[data-graview-choose-box][tabindex="0"]')??o)}},...rt.length>0?[{label:"Skip to arranging them",testid:"arranging",go:()=>{let o=document.querySelector(`[data-graview-skip-target="${CSS.escape(wn)}"]`)?.parentElement?.querySelector('[role="group"][aria-label="Arrange"]');Nn(o?.querySelector('button[data-testid$="-add"], button[data-testid$="-all"]')??o)}}]:[]]}):null,i??u?.description?(0,h.jsx)("p",{style:re,children:i??u?.description}):null,At.length>0||fn.length>0?(0,h.jsxs)("p",{style:{...C,margin:0,display:"flex",flexWrap:"wrap",columnGap:18,rowGap:2},"data-testid":"kind-related",children:[At.length>0?(0,h.jsxs)("span",{"data-testid":"kind-relations",children:["Related:"," ",At.map(({relation:o,far:y,words:O},le)=>(0,h.jsxs)("span",{"data-relation":o.edgeKind,children:[le>0?(0,h.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,y==="*"?Re(O??ze(o.edgeKind)):(0,h.jsx)(H,{to:`/${V(l.schema,y)}`,style:U,title:Q(l,y),children:O&&zi.has(O.toLowerCase())?`${Re(O)}: ${Q(l,y).toLowerCase()}`:Re(O??Q(l,y))})]},`${o.edgeKind}|${o.from}|${o.to}`))]}):null,fn.length>0?(0,h.jsxs)("span",{"data-testid":"kind-pictures",children:["Also as:"," ",fn.map((o,y)=>(0,h.jsxs)("span",{children:[y>0?(0,h.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,h.jsx)(H,{to:ye(e,o),style:U,children:o.title})]},et(o)))]}):null]}):null]}),Be.length>0?(0,h.jsx)("div",{style:{display:"contents"},"data-testid":"beginnings",children:Be.map(({affordance:o,mutation:y})=>{let O=!!(ca[y.name]&&Ae.length===0);return(0,h.jsx)(Vo,{name:y.name,id:`${da}-${y.name}`,description:y.description,open:sa(y.name),onClose:()=>la(y.name,!1),children:(0,h.jsx)(Ie,{store:l,mutation:y,prefilled:o.args,open:o.open,...O?{initial:{[ca[y.name]]:L.words}}:{},...e.principal?{principal:e.principal}:{}},O?`${y.name}|${L.words}`:y.name)},o.id)})}):null,P.dropped.length>0?(0,h.jsxs)("p",{style:{...C,margin:0},"data-testid":"list-dropped",children:["This link asked for ",P.dropped.join(", "),", which ",je.toLowerCase()," cannot be arranged by; the rest is shown."]}):null,rt.length>0?(0,h.jsx)($r,{schema:l.schema,graph:l.graph,kind:t,arrangement:f,onChange:Bi,kept:{shown:Ae.length,of:rt.length},noun:{one:Ye(u,t),many:je.toLowerCase()},...ji?{}:{allow:!1},...ua?{filters:ua}:{},offers:E,chips:{nodes:rt,flagged:b,...typeof c?.today=="string"?{today:c.today}:{}},query:e.framed===!0&&e.barAbove!==!0}):null,(0,h.jsx)("style",{children:_t}),gt?(0,h.jsx)("style",{children:Hr+Ko}):null,(0,h.jsx)("div",{className:"graview-list","data-graview-skip-target":wn,...gt?{...Ee.listProps,ref:Ee.list,tabIndex:-1,"data-graview-choosable":"","aria-label":Ee.chosen.length>0?`${je}, ${Ee.chosen.length} chosen`:je,role:"group"}:{},children:Ae.length===0&&L.words?(0,h.jsxs)("p",{style:re,"data-testid":"none-yet",children:["Nothing here is called \u201C",L.words,"\u201D."," ",(0,h.jsx)("span",{style:C,"data-testid":"list-searched",children:Dt(l.schema,{kinds:[t],past:$})})," ",(0,h.jsx)(H,{to:"?",style:U,children:"Show every one"})]}):Ae.length===0?(0,h.jsxs)("p",{style:re,"data-testid":"none-yet",children:[f.filter?.length||f.query?"None of them.":"None yet",!f.filter?.length&&!f.query&&Be.length>0?` \u2014 the first one starts above, with \u201C${Be[0]?.mutation.title??Be[0]?.mutation.name}\u201D.`:!f.filter?.length&&!f.query?".":"",f.filter?.length||f.query?(0,h.jsxs)(h.Fragment,{children:[" ",(0,h.jsx)(H,{to:"?",style:U,children:"Show every one"})]}):null]}):p.grouped&&sn?(0,h.jsx)("div",{style:{display:"grid",gap:"1rem"},"data-testid":"records","data-grouped":sn,children:j.map(o=>{if(!o.closed)return(0,h.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group",children:[(0,h.jsxs)("h2",{className:"graview-group-head",children:[o.label," ",(0,h.jsx)("span",{children:o.nodes.length})]}),(0,h.jsx)("ul",{style:ot,className:Ct,"data-graview-rows":"",children:o.nodes.map(Pt)})]},o.key||"-");let y=ra(o),O=`${g}-${mt(o.key||"none")}`;return(0,h.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group","data-closed":y?"shut":"open",children:[(0,h.jsx)("h2",{className:"graview-group-head",children:(0,h.jsxs)("button",{type:"button",className:"graview-group-toggle","aria-expanded":!y,"aria-controls":O,"data-testid":"list-group-toggle",onClick:()=>Ki(aa(o.key)),children:[(0,h.jsx)("span",{"aria-hidden":"true",children:y?"\u25B8":"\u25BE"}),o.label," ",(0,h.jsxs)("span",{children:["\xB7 ",o.nodes.length]}),(0,h.jsxs)("span",{style:Do,children:[" ",o.nodes.length===1?Ye(u,t):je.toLowerCase()]})]})}),(0,h.jsx)("ul",{id:O,style:y?{...ot,display:"none"}:ot,className:Ct,"data-graview-rows":"",hidden:y,children:y?null:o.nodes.map(Pt)})]},o.key||"-")})}):_e&&_e.length>1?(0,h.jsxs)("div",{style:{display:"grid",gap:14},"data-testid":"records","data-sectioned":Oe?.type==="date"?"year":"letter",children:[(0,h.jsx)("nav",{"aria-label":"Jump to","data-testid":"list-index",style:{...C,display:"flex",flexWrap:"wrap",gap:Oe?.type==="date"?"0 10px":"0 4px",lineHeight:1.3},children:_e.map(o=>(0,h.jsx)("a",{href:`#${mt(o.key)}`,onClick:y=>{y.preventDefault(),document.getElementById(mt(o.key))?.scrollIntoView({block:"start"})},style:{...Se,minWidth:24,justifyContent:"center"},children:o.key},o.key))}),_e.map(o=>(0,h.jsxs)("section",{"data-testid":"list-section","aria-labelledby":mt(o.key),style:{display:"grid",gap:0},children:[(0,h.jsx)("h2",{id:mt(o.key),className:"graview-group-head",children:o.key}),(0,h.jsx)("ul",{style:ot,className:Ct,"data-graview-rows":"",children:o.nodes.map(Pt)})]},o.key))]}):(0,h.jsx)("ul",{style:ot,className:Ct,"data-testid":"records","data-graview-rows":"",children:Ae.map(Pt)})}),gt?(0,h.jsx)(Ir,{store:l,chosen:Ee.chosen,...it?{principal:it}:{},...c?{context:c}:{},anchor:Wo,of:hn.length,onChooseAll:()=>Ee.choose(hn),onClear:Ee.clear,onActed:_i}):null,ia>0?(0,h.jsxs)(H,{to:Ti(m,"filter","is:any"),style:{...U,...C,justifySelf:"start"},"data-testid":"past-link",children:["+",ia," past"]}):null,A===!1&&l.graph.count(t,{archived:!0})>0?(0,h.jsxs)(H,{to:Ti(m,"archived","true"),style:{...U,...C,justifySelf:"start"},"data-testid":"archived-link",children:["+",l.graph.count(t,{archived:!0})," archived"]}):null]}),(0,h.jsx)(tn,{context:e,withheld:Gi,style:ee,testId:"withheld"})]})}var Do={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Wo=()=>document.querySelector("[data-graview-choosable]")?.closest("[data-embed-content]")??null,Ko=`
7
- .graview-list[data-graview-choosable]{outline:none}
8
- .graview-list [data-graview-choose]{position:relative;padding-left:34px}
9
- .graview-choose-at{position:absolute;left:2px;top:0;bottom:0;z-index:${Ta.raised};display:flex;align-items:center}
10
- @media (min-width: 900px) and (pointer: fine){
11
- .graview-list [data-graview-choose]{padding-left:0}
12
- .graview-choose-at{left:-34px}
13
- }
14
- @media (pointer: coarse){
15
- .graview-list:not([data-graview-choosing]) [data-graview-choose]{padding-left:0}
16
- .graview-list:not([data-graview-choosing]) .graview-choose-at{display:none}
17
- }
18
- `;function Bo({children:e}){return(0,h.jsx)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40,minWidth:0},children:e})}var Go=(e,t)=>t?{sort:{by:t,direction:"desc"}}:e?{sort:{by:"label",direction:"asc"}}:{};function qo(e,t,n){let a=$t({...e.get("sort")?{sort:e.get("sort")}:{},...e.get("filter")?{filter:e.get("filter")}:{},...e.get("group")?{group:e.get("group")}:{},...e.get("q")?{q:e.get("q")}:{},...e.get("archived")?{archived:e.get("archived")}:{}}),r=[...a.filter??[]],i=e.get("by"),d=a.group??(i?{by:i}:void 0);for(let s of n){let c=e.get(s);c&&r.push({key:s,value:c})}let l=e.get("with");return l&&r.push({key:l,value:"*"}),e.get("past")==="1"&&!r.some(s=>s.key==="is")&&r.push({key:"is",value:"any"}),$n({...a.sort?{sort:a.sort}:{},...a.query?{query:a.query}:{},...r.length>0?{filter:r}:{},...d?{group:d}:{},...a.archived!==void 0?{archived:a.archived}:{}},t)}function Ti(e,t,n){let a=new URLSearchParams(e);return a.set(t,n),a.delete("past"),`?${a.toString()}`}function Uo({name:e,title:t,panel:n,open:a,onOpen:r}){return(0,h.jsxs)("button",{type:"button","data-testid":`act-open-${e}`,"data-graview-act":e,"aria-expanded":a,"aria-controls":n,onClick:()=>{r(!a),a||requestAnimationFrame(()=>document.getElementById(n)?.querySelector("input, select, textarea, button")?.focus())},style:{...Se,minHeight:28,margin:"-4px 0",padding:"0 2px",border:0,background:"none",font:"inherit",fontWeight:600,color:"var(--graview-ink)",cursor:"pointer"},children:[(0,h.jsx)("span",{"aria-hidden":"true",style:{marginRight:6},children:a?"\u2212":"+"}),t]})}function Vo({name:e,id:t,description:n,open:a,onClose:r,children:i}){return(0,h.jsxs)("div",{"data-testid":`act-${e}`,id:t,hidden:!a,onKeyDown:d=>{d.key==="Escape"&&(d.preventDefault(),r(),document.querySelector(`[aria-controls="${t}"]`)?.focus())},style:a?{display:"grid",gap:12,padding:"4px 0 12px"}:void 0,children:[n?(0,h.jsx)("p",{style:{...C,margin:0,maxWidth:"58ch"},children:n}):null,i]})}function jo({to:e,label:t}){let n=(0,Me.useRef)(null);return Fr(n),(0,h.jsx)(H,{ref:n,to:e,"aria-label":t,style:{position:"absolute",inset:0,borderRadius:6}})}var at=I(He(),1);var bt=I(He(),1);var F=I(q(),1);function ea({context:e}){let{store:t,brand:n,invariantContext:a,principal:r}=e;Z(t);let i=t.violations(a),d=t.allInvariants(),l=Ht(t,i),s=za(t.schema,d);return(0,F.jsxs)(te,{context:e,children:[(0,F.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,F.jsx)(ie,{context:e,children:i.length===0?"All rules hold":"What is broken"}),(0,F.jsx)("p",{style:re,"data-testid":"problems-count",children:i.length===0?"Every declared rule is satisfied by what is here.":Ca(i)})]}),(0,F.jsx)(Ai,{context:e}),l.map((c,m)=>{let x=c.nodeIds[0],g=x?t.graph.getNode(x):void 0;return(0,F.jsxs)("section",{style:{display:"grid",gap:10,padding:"16px 18px",borderLeft:"3px solid var(--graview-warn)",background:"var(--graview-panel-warning)",borderRadius:"0 var(--graview-radius, 12px) var(--graview-radius, 12px) 0"},children:[c.line?null:(0,F.jsx)(rn,{violation:c,schema:t.schema,...n?{brand:n}:{}}),g?(0,F.jsxs)("p",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[(0,F.jsx)(ce,{kind:g.kind,brand:n,schema:t.schema,size:7}),(0,F.jsx)(H,{to:z(t.schema,g.kind,g.id),style:U,children:me(t.schema.tryDefinition(g.kind),g)})]}):null,c.line?(0,F.jsx)(rn,{violation:c,schema:t.schema,...n?{brand:n}:{}}):null,(0,F.jsx)(on,{store:t,repairs:c.repairs,...r?{principal:r}:{}})]},m)}),d.length>0?(0,F.jsxs)("section",{style:{...ee,display:"grid",gap:12},"data-testid":"rules",children:[(0,F.jsx)("h2",{style:J,children:"The rules"}),(0,F.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:d.map(c=>{let m=i.filter(u=>u.invariant===c.name).length,x=s.get(c.name),g=c.label??c.name;return(0,F.jsxs)("li",{"data-graview-rule":c.name,style:{display:"grid",gap:2},children:[(0,F.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:12,rowGap:2},children:[x?(0,F.jsx)(It,{line:x,schema:t.schema,...n?{brand:n}:{},style:{flex:"1 1 18rem"}}):(0,F.jsx)("span",{style:{flex:"1 1 18rem",fontWeight:550},children:g}),(0,F.jsx)("span",{style:{...C,color:m>0?"var(--graview-warn)":"var(--graview-ink-faint)"},children:m===0?"holds":`broken in ${m} ${m===1?"place":"places"}`})]}),x&&g.trim().length>0?(0,F.jsx)("span",{style:C,children:g}):null]},c.name)})})]}):null]})}function rn({violation:e,schema:t,brand:n}){if(!e.line)return(0,F.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},children:e.message});let a=Qa(e),r=Ya(e);return r?(0,F.jsxs)("div",{style:{display:"grid",gap:4},"data-testid":"problem-line",children:[(0,F.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},"data-testid":"problem-says",children:r}),a?(0,F.jsx)("span",{style:C,children:a}):null,(0,F.jsxs)("details",{"data-testid":"problem-judged",style:C,children:[(0,F.jsx)("summary",{style:{cursor:"pointer",width:"fit-content",minHeight:24},children:"How it is judged"}),(0,F.jsx)(It,{line:e.line,schema:t,...n?{brand:n}:{},lead:"none"})]})]}):(0,F.jsxs)("div",{style:{display:"grid",gap:2},"data-testid":"problem-line",children:[(0,F.jsx)(It,{line:e.line,schema:t,...n?{brand:n}:{},lead:"none",style:{color:"var(--graview-warn)"}}),a?(0,F.jsx)("span",{style:C,children:a}):null]})}function on({store:e,repairs:t,principal:n}){let[a,r]=(0,bt.useState)(null),[i,d]=(0,bt.useState)(null),l=(0,bt.useRef)([]);if(t.length===0)return null;let s=a===null?null:t[a],c=s&&(s.missing??[]).length>0?e.allMutations().find(m=>m.name===s.mutation):void 0;return(0,F.jsxs)("div",{style:{display:"grid",gap:10},"data-testid":"repairs",children:[(0,F.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:t.map((m,x)=>{let g=(m.missing??[]).length>0,u=e.permits({name:m.mutation,args:{...m.args}},n);return u.ok?(0,F.jsx)("button",{ref:A=>{l.current[x]=A},type:"button","data-graview-repair":m.mutation,"data-graview-asks":g||void 0,"aria-expanded":g?a===x:void 0,onClick:()=>{if(d(null),g){r(a===x?null:x);return}r(null);try{e.apply({name:m.mutation,args:{...m.args}},n?{author:n}:{})}catch(A){d(Ft(e.schema,e.allMutations(),A))}},style:ke,children:g?`${m.label} \u2026`:m.label},x):(0,F.jsxs)("p",{"data-testid":"withheld","data-withheld":u.refusal.wouldNeed.join(",")||"nobody",style:{...C,margin:0},children:[(0,F.jsx)("s",{children:m.label})," \u2014 ",u.refusal.message]},x)})}),c&&s?(0,F.jsx)(Ie,{store:e,mutation:c,prefilled:{...s.args},only:s.missing??[],label:s.label,autoFocus:!0,onDone:()=>{let m=a;r(null),requestAnimationFrame(()=>{let x=m===null?null:l.current[m];if(x?.isConnected){x.focus();return}let g=document.querySelector("[data-graview-page-title]")??document.querySelector("main h1, main h2");g&&(g.hasAttribute("tabindex")||(g.tabIndex=-1),g.focus())})},...n?{principal:n}:{}}):null,s&&!c&&(s.missing??[]).length>0?(0,F.jsxs)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:Hn},children:["\u201C",s.label,"\u201D names ",s.mutation,", which this app does not declare."]}):null,i?(0,F.jsx)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:Hn},children:i}):null]})}var ta=I(He(),1);var Ve=I(q(),1);function Oi({store:e,link:t,principal:n}){let[a,r]=(0,ta.useState)(!1),[i,d]=(0,ta.useState)(null),l=tr(t);return(0,Ve.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[(0,Ve.jsx)("button",{type:"button","data-graview-provisional":"",title:l,"aria-label":`Unsure link: ${l}`,"aria-expanded":a,onClick:()=>r(!a),style:{border:"1px dashed var(--graview-ink-muted)",borderRadius:999,background:"transparent",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"0.75rem",lineHeight:1,padding:"2px 6px",cursor:"pointer"},children:"unsure"}),a?(0,Ve.jsxs)("span",{style:{...C,display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,Ve.jsx)("span",{children:l}),(0,Ve.jsx)("button",{type:"button",style:{...ke,padding:"4px 10px"},onClick:()=>{try{e.apply({name:Aa,args:{kind:t.edge.kind,from:t.edge.from,to:t.edge.to}},n?{author:n}:{}),r(!1)}catch(s){d(Ft(e.schema,e.allMutations(),s))}},children:"Keep this link"}),i?(0,Ve.jsx)("span",{role:"alert",children:i}):null]}):null]})}var he=I(q(),1);function Ni({nodeId:e,node:t,field:n,inPlace:a,labelStyle:r=we}){return n.files?(0,he.jsx)(dt,{as:"field",read:!a,nodeId:e,field:n.key,label:n.label,files:n.files,labelStyle:r,style:{gap:4}}):n.long?(0,he.jsx)(Er,{nodeId:e,field:n.key,label:n.label,value:n.value,markdown:n.markdown,style:{gridColumn:"1 / -1",gap:4},labelStyle:r,valueStyle:{lineHeight:1.6}}):(0,he.jsxs)("div",{style:{display:"grid",gap:2,minWidth:0,alignContent:"start"},children:[(0,he.jsx)("dt",{style:r,children:n.label}),(0,he.jsx)("dd",{style:{margin:0,overflowWrap:"anywhere",minWidth:0},children:n.linked?(0,he.jsx)(pr,{relation:n.linked.relation,refs:n.linked.refs,...a?{nodeId:e,field:n.key}:{}}):n.app?(0,he.jsx)(Kt,{address:n.app,as:"record",...a?{nodeId:e,field:n.key}:{}}):n.href?(0,he.jsx)(Mr,{href:n.href,field:n.key,value:n.value,stored:n.stored,...a?{nodeId:e}:{}}):a?(0,he.jsxs)(he.Fragment,{children:[(0,he.jsx)(Bt,{nodeId:e,field:n.key,value:n.value,stored:n.stored}),n.repeats?(0,he.jsx)(ur,{nodeId:e,field:n.key,start:t?.[n.key],value:t?.[`${n.key}Repeat`],label:`${n.label} repeats`}):null]}):n.value})]})}var v=I(q(),1),_o=[];function na({context:e}){let{store:t,brand:n,principal:a,invariantContext:r}=e;Z(t);let i=de()!==null,d=Ue(),l=decodeURIComponent(d.id??""),s=ci(t,l,{...a?{principal:a}:{},...r?{context:r}:{}}),c=Ht(t,s?.violations??_o),[m,x]=(0,at.useState)(null),[g,u]=(0,at.useState)(!1),[A,N]=(0,at.useState)(null),G=(0,at.useRef)(null),b=(0,at.useRef)(null),E=gr({flow:"both",letters:!0}),k=p=>{(G.current?.parentElement?.querySelector(`[data-affordance="${p.replace(/["\\]/g,"\\$&")}"]`)??G.current)?.focus()};if(!s)return(0,v.jsx)(te,{context:e,children:(0,v.jsx)(ie,{context:e,children:"Nothing lives at this address."})});let P=t.graph.getNode(l),K=t.schema.tryDefinition(s.kind),ae=K?.describe&&P?Xa(K,P):null,ue=[...t.log.all()].filter(p=>!Mt(p)&&(p.writes.includes(l)||p.reads.includes(l))).slice(-8).reverse(),oe=t.log.all().find(p=>!Mt(p)&&p.undoes===void 0&&p.primitives.some(T=>T.op==="add-node"&&T.node.id===l)),_=s.actions.affordances.filter(p=>p.provider!=="invariant"),ge=_.filter(p=>p.destructive||p.setsAside),Ke=g||ge.length<2?_:_.filter(p=>!ge.includes(p)),Pe=e.views?.lookup(s.kind,{cardinality:"one",fidelity:"full"}),Ce=Pe!==void 0&&!lt(Pe)?Pe:void 0,w=Ce&&P?qt(Pe,P,t.graph):void 0,f=w?s.fields.filter(p=>!w.fields.has(p.key)):s.fields,L=w?s.links.flatMap(p=>{let T=p.targets.filter(j=>!w.records.has(j.id));return T.length>0?[{...p,targets:T}]:[]}):s.links,$=Ce!==void 0&&Ua(Pe),ne=i&&ir(K).length>0,Y=$e(e).filter(p=>!p.hidden&&(p.kind===s.kind||p.across===s.kind));return(0,v.jsxs)(te,{context:e,children:[(0,v.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,v.jsx)(ut,{context:e}),(0,v.jsx)(ie,{context:e,children:i&&P?.label===s.label?(0,v.jsx)(Bt,{nodeId:l,field:"label",value:s.label,said:s.label}):s.label}),ae&&ae!==s.label?(0,v.jsx)("p",{style:re,children:ae}):null,oe?.lineage?(0,v.jsxs)("p",{style:{...C,margin:0},"data-testid":"record-lineage",children:["Made by ",ht(oe,a,{graph:t.graph,schema:t.schema,...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}}),", ",An(oe.lineage)]}):null,(0,v.jsx)(Yt,{context:e,stop:`#focus=${encodeURIComponent(l)}`,style:{...qe,...C},"data-testid":"spatial-link"}),i&&P?(0,v.jsx)(Tn,{choices:[{on:"changed",record:l},{on:"act",record:l},{on:"reaches",kind:s.kind,condition:"",record:l}],label:"Notify me when this changes",testId:"record-notify",style:{...ke,...C,justifySelf:"start"}}):null,Y.length>0?(0,v.jsxs)("p",{style:{...C,margin:0},"data-testid":"seen-in",children:["Seen in:"," ",Y.map((p,T)=>(0,v.jsxs)("span",{children:[T>0?(0,v.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,v.jsx)(H,{to:ye(e,p),style:U,children:p.title})," ",(0,v.jsx)(Yt,{context:e,stop:`#view=${encodeURIComponent(p.as)}`,style:{...U,...C,display:"inline-block",minWidth:24,textAlign:"center"},title:`${p.title}, in the scene`,label:`${p.title}, in the scene`,children:(0,v.jsx)("span",{"aria-hidden":"true",children:"\u2197"})})]},et(p)))]}):null]}),P&&xa(P)?(0,v.jsx)(Yo,{context:e,id:l,kind:s.kind}):null,P&&Ra(t,l)?(0,v.jsx)(zo,{context:e,id:l,kind:s.kind}):null,Ce&&P?(0,v.jsx)("section",{"data-testid":"record-view",style:{display:"grid",minWidth:0},children:(0,v.jsx)(Dr,{children:(0,v.jsx)(Zt,{when:Ot(Pe),children:(0,v.jsx)(Ce,{node:P,cardinality:"one",fidelity:"full",mode:"fullscreen",selected:!1,...s.violations.length>0?{flagged:[l]}:{}})})})}):null,s.violations.length>0?(0,v.jsx)("section",{"data-testid":"record-violations",style:{display:"grid",gap:12,padding:"16px 18px",borderLeft:"3px solid var(--graview-warn)",background:"var(--graview-panel-warning)",borderRadius:"0 var(--graview-radius, 12px) var(--graview-radius, 12px) 0"},children:c.map((p,T)=>(0,v.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,v.jsx)(rn,{violation:p,schema:t.schema,...n?{brand:n}:{}}),(0,v.jsx)(on,{store:t,repairs:pi(s.actions,p.repairs),...a?{principal:a}:{}})]},T))}):null,!$&&(f.length>0||ne)?(0,v.jsxs)("section",{style:{...ee,display:"grid",gap:14},"data-testid":"record-fields",children:[(0,v.jsx)("h2",{style:J,children:"The facts"}),er(K,f).map((p,T)=>{let j=(0,v.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"14px 24px"},children:p.fields.map(se=>(0,v.jsx)(Ni,{nodeId:l,node:P,field:se,inPlace:i},se.key))});return p.title?(0,v.jsxs)("section",{style:{display:"grid",gap:10,minWidth:0},children:[(0,v.jsx)("h3",{"data-graview-field-group":p.title,style:{...J,fontSize:"inherit"},children:p.title}),j]},T):(0,v.jsx)("div",{children:j},T)}),ne?(0,v.jsx)(dt,{as:"unfilled",nodeId:l,skip:[...w?.fields??[]],labelStyle:we,style:{gap:4}}):null]}):null,($?[]:L).map(p=>(0,v.jsxs)("section",{style:{...ee,display:"grid",gap:10},children:[(0,v.jsx)("p",{style:we,children:ti(t,p)}),p.description?(0,v.jsx)("h2",{style:J,children:Re(p.description)}):(0,v.jsxs)("h2",{style:J,"aria-label":ze(p.edgeKind),children:[p.direction==="in"?"\u2190 ":"\u2192 ",ze(p.edgeKind)]}),(0,v.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},children:p.targets.map(T=>{let j=nr(t,p.direction==="in"?{kind:p.edgeKind,from:T.id,to:l}:{kind:p.edgeKind,from:l,to:T.id});return(0,v.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,v.jsx)(ce,{kind:T.kind,brand:n,schema:t.schema,size:7}),(0,v.jsxs)(H,{to:z(t.schema,T.kind,T.id),style:U,children:[T.label,T.apart?(0,v.jsxs)("span",{style:C,children:[" \xB7 ",T.apart]}):null]}),j?.provisional?(0,v.jsx)(Oi,{store:t,link:j,...a?{principal:a}:{}}):null]},T.id)})}),(p.direction==="out"&&t.schema.edge(p.edgeKind)?.cardinality==="one"?[]:[...new Set(p.targets.map(T=>T.kind))]).map(T=>(0,v.jsx)(H,{to:`/${V(t.schema,T)}?${encodeURIComponent(p.edgeKind)}=${encodeURIComponent(l)}`,style:{...qe,...C},"data-testid":"related-all",children:(0,v.jsxs)(Qe,{children:["Sort and filter ",p.description??`these ${Q(t,T).toLowerCase()}`,p.targets.some(j=>j.kind!==T)?` (${Q(t,T).toLowerCase()})`:""]})},T))]},`${p.edgeKind}|${p.direction}|${p.description??""}`)),!$&&(_.length>0||s.actions.withheld.length>0)?(0,v.jsxs)("section",{style:{...ee,display:"grid",gap:14},"data-testid":"record-actions",children:[(0,v.jsx)("h2",{style:J,ref:G,tabIndex:-1,children:"What can be done"}),(0,v.jsxs)("div",{role:"toolbar","aria-label":"What can be done",...E,style:{display:"flex",flexWrap:"wrap",gap:8},children:[Ke.map(p=>{let T=m===p.id;return(0,v.jsx)("button",{type:"button","data-affordance":p.id,"data-rank":p.rank,"data-graview-act":p.mutation,[Ln]:"",autoFocus:g&&p===ge[0],"aria-expanded":T,onClick:()=>x(T?null:p.id),style:{...ke,...T?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},children:p.label},p.id)}),Ke.length<_.length?(0,v.jsxs)("button",{type:"button","aria-expanded":!1,onClick:()=>u(!0),style:{...ke,...C},"data-testid":"record-actions-more",[Ln]:"",children:["Show ",_.length-Ke.length," more"]}):null]}),_.map(p=>{if(m!==p.id)return null;let T=t.allMutations().find(j=>j.name===p.mutation);return T?(0,v.jsxs)("div",{ref:b,onKeyDown:j=>{if(j.key!=="Escape"||j.defaultPrevented)return;j.preventDefault(),x(null);let se=p.id;requestAnimationFrame(()=>k(se))},style:{display:"grid",gap:10,padding:18,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,v.jsx)("h3",{style:J,children:p.label}),T.description?(0,v.jsx)("p",{style:{...C,margin:0},children:T.description}):null,(0,v.jsx)(Ie,{store:t,mutation:T,prefilled:p.args,open:p.open,label:p.label,autoFocus:!0,onDone:()=>{x(null),N(p.mutation);let j=p.id;requestAnimationFrame(()=>k(j))},...a?{principal:a}:{}})]},p.id):null}),i&&A!==null&&m===null?(0,v.jsx)(Tn,{choices:[{on:"act",act:A,record:l},{on:"act",act:A}],label:"Notify me when someone else does this",testId:"notify-after-act",style:{...ke,...C,justifySelf:"start"}}):null,(0,v.jsx)(tn,{context:e,withheld:s.actions.withheld})]}):null,i?(0,v.jsx)(ei,{id:l,style:ee,headingStyle:J}):null,ue.length>0?(0,v.jsxs)("section",{style:{...ee,display:"grid",gap:10},"data-testid":"record-history",children:[(0,v.jsx)("h2",{style:J,children:"What has happened"}),(0,v.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:ue.map(p=>(0,v.jsxs)("li",{style:C,children:[(0,v.jsx)("span",{style:{color:"var(--graview-ink)"},children:p.intent}),p.lineage?(0,v.jsxs)("span",{"data-graview-lineage":"",children:[" \xB7 ",An(p.lineage)]}):null," \u2014 ",ht(p,a,{graph:t.graph,schema:t.schema,...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}})]},p.id))})]}):null]})}function zo({context:e,id:t,kind:n}){let{store:a,principal:r}=e,i={name:`allow-tidying-${n}`,args:{id:t}},d=a.allMutations().some(l=>l.name===i.name)&&a.permits(i,r).ok;return(0,v.jsxs)("section",{"data-testid":"record-left-alone",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,padding:"12px 16px",border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,v.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,v.jsx)("strong",{children:"Left alone."})," Nothing automated changes it; tidying passes it by."]}),d?(0,v.jsx)("button",{type:"button",style:ke,"data-testid":"allow-tidying",onClick:()=>a.apply(i,r?{author:r}:{}),children:"Allow tidying again"}):null]})}function Yo({context:e,id:t,kind:n}){let{store:a,principal:r}=e,i={name:`unarchive-${n}`,args:{id:t}},d=a.allMutations().some(c=>c.name===i.name)&&a.permits(i,r).ok,l=[...a.log.all()].reverse().find(c=>!Mt(c)&&c.mergedInto!==void 0&&c.writes.includes(t)),s=l?.mergedInto!==void 0?a.graph.getNode(l.mergedInto):void 0;return(0,v.jsxs)("section",{"data-testid":"record-archived",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,padding:"12px 16px",border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,v.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,v.jsx)("strong",{children:"Archived."})," Kept with its ties and history, and out of lists, counts and rules.",s?(0,v.jsxs)(v.Fragment,{children:[" ","Merged into ",(0,v.jsx)(H,{to:z(a.schema,s.kind,s.id),style:U,children:me(a.schema.tryDefinition(s.kind),s)}),"."]}):null]}),d?(0,v.jsx)("button",{type:"button",style:ke,"data-testid":"bring-it-back",onClick:()=>a.apply(i,r?{author:r}:{}),children:"Bring it back"}):null]})}var S=I(q(),1),Qo=Nt(()=>(__graviewPreload(import.meta.url,["./chunk.IE4ZJQV3.js","./chunk.TVWN5I4M.js","./chunk.7G4M2PX3.js","./chunk.UGFDSE37.js","./chunk.NNUUD26E.js","./chunk.OJ64WTLW.js","./chunk.GMAXA5GV.js","./chunk.IBJBCZKG.js","./chunk.NQ26KMSQ.js","./chunk.GJQF7I22.js","./chunk.SPU3BVAO.js","./chunk.OPCBZNKF.js","./chunk.UK5F3S2N.js","./chunk.2VJ52LGS.js","./chunk.JI2UVZUU.js","./chunk.CTOBNZLM.js","./chunk.34HGT7HQ.js","./chunk.TNL2BVCH.js","./chunk.NZDHXREL.js","./chunk.TBSPEO2L.js","./chunk.5ON3JSAK.js","./chunk.3SBTQ66X.js","./chunk.SSAY4ITS.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.GLTWLQ6L.js","./chunk.ACB4TD4W.js","./chunk.XCQ7ZPR5.js","./chunk.MY5OXSS7.js","./chunk.NVRK6A7T.js","./chunk.FKJ3HIA5.js","./chunk.GZHZLJBF.js","./chunk.OW72XZF4.js","./chunk.OJGHDWI6.js","./chunk.KRODTMGR.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.FG5ZFYYL.js")).then(e=>({default:e.DraftPage}))),Zo={kind:"human"};function Xo({list:e,store:t}){let n=new Set(e.members.map(d=>d.kind)),a=e.total-e.members.length,r=n.size===1?[...n][0]:void 0;if(!r)return(0,S.jsx)("p",{className:"graview-spec-text graview-spec-more",children:`and ${a} more`});let i=Ge(t.schema,r).toLowerCase();return(0,S.jsx)("p",{className:"graview-spec-text graview-spec-more",children:(0,S.jsx)(H,{to:`/${V(t.schema,r)}`,className:"graview-spec-link graview-spec-see-all","data-testid":"see-all",children:e.total===t.graph.nodesOfKind(r).length?`See all ${ft(e.total)} ${i}`:`${ft(a)} more \xB7 all ${i}`})})}function Jo({context:e,children:t}){let n=De(),a=e.store.schema,r=Ze("/").replace(/\/$/,""),i=(0,B.useMemo)(()=>({href:d=>`${r}${z(a,d.kind,d.id)}`,go:d=>n(z(a,d.kind,d.id)),more:d=>(0,S.jsx)(Xo,{list:d,store:e.store})}),[r,a,n,e.store]);return(0,S.jsx)(Gt.Provider,{value:i,children:(0,S.jsx)(Wr.Provider,{value:(e.titleLevel??(e.framed&&!e.barAbove?1:2))-1,children:t})})}var Ii=(0,B.createContext)(void 0);function es({steering:e}){let t=fe(),n=De(),a=`${t.pathname}${t.search}`;return(0,B.useLayoutEffect)(()=>e.at(a),[a,e]),(0,B.useLayoutEffect)(()=>{let r=d=>{d!==a&&n(d)};e.go.current=r;let i=e.pending?.current;return i!==void 0&&(e.pending.current=void 0,r(i)),()=>{e.go.current===r&&(e.go.current=void 0)}},[a,n,e]),null}function ts({context:e,to:t}){let{pathname:n}=fe(),a=de(),r=(t??a)?.sayWhere,i=ns(e,n);return(0,B.useEffect)(()=>(r?.(i),()=>r?.(null)),[r,i]),null}function ns(e,t){let[n="",a,r]=t.split("/").filter(Boolean).map(d=>{try{return decodeURIComponent(d)}catch{return d}});if(r!==void 0)return"#";if(n==="places"&&a!==void 0){if(a===Pn)return"#overview=1";let d=e.views?.places().find(l=>l.as===a);return d?`#focus=${encodeURIComponent(Ne(d.kind))}&view=${encodeURIComponent(d.as)}`:"#"}let i=ve(e.store.schema,n);return i?`#focus=${encodeURIComponent(a??Ne(i))}`:"#"}function as({onNavigate:e,path:t}){let n=fe(),a=Wn(),r=De(),i=n.hash&&!n.hash.includes("=")?n.hash:"",d=`${n.pathname}${n.search}${i}`,l=(0,B.useRef)(e);l.current=e;let s=(0,B.useRef)(null);(0,B.useEffect)(()=>{let m=s.current;s.current=d,m!==null&&(d===m&&a!=="PUSH"||l.current?.(d,a==="POP"?"pop":a==="REPLACE"?"replace":"push"))},[n.key]);let c=(0,B.useRef)(t);return(0,B.useEffect)(()=>{t===void 0||t===c.current||(c.current=t,t!==d&&r(t))},[t]),null}function Hi({context:e,registry:t,page:n}){let a=Ue(),r=ve(e.store.schema,a.slug??""),i=n==="list"?Jn:na,l=(r?t?.lookup(r,n):void 0)??i;return(0,S.jsx)(l,{context:e})}function rs({context:e,registry:t,children:n}){let a=(0,B.useRef)(null);return Va(a),(0,S.jsx)("div",{ref:a,"data-graview-face":"pages",style:{display:"contents"},children:(0,S.jsx)(ki,{context:e,registry:t,root:a,children:(0,S.jsx)(xi,{context:e,root:a,children:n})})})}function is(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA"||e.tagName==="SELECT"?!0:e.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(e.type):!1}function os(){let{pathname:e}=fe(),t=Wn(),n=(0,B.useRef)(null);(0,B.useLayoutEffect)(()=>{if(t!=="POP"){for(let i=n.current?.parentElement;i;i=i.parentElement){let{overflowY:d}=getComputedStyle(i);if((d==="auto"||d==="scroll")&&i.scrollHeight>i.clientHeight){i.scrollTop=0;return}}window.scrollTo(0,0)}},[e]);let a=(0,B.useRef)(e),r=(0,B.useRef)(!1);return(0,B.useEffect)(()=>{if(!r.current&&e===a.current)return;r.current=!0;let i=document.activeElement;if(is(i))return;let d=n.current?.closest("main")??document.querySelector("main"),s=n.current?.closest("[data-graview-face]")?.querySelector("[data-graview-page-title]")??d?.querySelector("h1, h2")??null??d??null;s&&(s.hasAttribute("tabindex")||s.setAttribute("tabindex","-1"),s.focus({preventScroll:!0}))},[e]),(0,S.jsx)("span",{ref:n,hidden:!0,"data-graview-scroll-reset":""})}function Fi({context:e,children:t}){let n=De(),a=Ze("/").replace(/\/$/,""),r=(0,B.useContext)(Ii),i=(0,B.useMemo)(()=>{let d=(s,c)=>{if("record"in s){let m=e.store.graph.getNode(s.record);return m?Vt(z(e.store.schema,m.kind,s.record),{section:c?.section}):void 0}if("place"in s){let m=e.views?.places().find(x=>x.as===s.place);return m?Vt(ye(e,m),c):void 0}return e.store.schema.tryDefinition(s.list)?Vt(`/${V(e.store.schema,s.list)}`,c):void 0},l=s=>{s!==void 0&&n(s)};return{record:(s,c)=>l(d({record:s},c)),place:(s,c)=>l(d({place:s},c)),list:(s,c)=>l(d({list:s},c)),draft:()=>n("/~draft"),href:(s,c)=>{let m=r===!1?void 0:d(s,c);if(m!==void 0)return r?r(m):`${a}${m}`}}},[e,n,a,r]);return(0,S.jsx)(qa.Provider,{value:i,children:t})}function ss(){let{pathname:e,search:t,hash:n}=fe();return(0,B.useEffect)(()=>{let a=decodeURIComponent(n.replace(/^#/,""));if(!(!a||a.includes("=")))return hi(a)},[e,t,n]),null}function ls({context:e,Home:t}){let n=fe(),a=e.views,r=n.key==="default"&&!(a&&Ba(a));(0,B.useEffect)(()=>{a&&Ga(a)},[a]);let i=r?$a(e.views?.arrangement?.()?.first,e.store.schema,e.views?.places()??[]):void 0,d=i?.to==="place"?ye(e,i.place):i?.to==="kind"?`/${V(e.store.schema,i.kind)}`:void 0;return d?(0,S.jsx)(Kn,{to:d,replace:!0}):(0,S.jsx)(t,{context:e})}function Di({context:e,registry:t}){let n=t?.lookupSurface("shell"),a=n!==void 0,r=a&&(t?.without().has("bar")??!1),i=a&&!r&&!e.embedded?{...e,barAbove:!0}:e,d=N=>n===void 0?(0,S.jsx)(Qt,{context:e,children:N}):r?(0,S.jsx)(n,{context:e,children:N}):(0,S.jsx)(Qt,{context:e,children:(0,S.jsx)(n,{context:i,children:N})}),l=t?.lookupSurface("home")??Zn,s=t?.lookupSurface("problems")??ea,c=a?{...i,framed:!0}:e,[m,x]=(0,B.useState)(null),g=(0,B.useMemo)(()=>({context:c,registry:t}),[c,t]),u=(0,B.useMemo)(()=>({onFind:x,find:!(t?.without().has("find")??!1),places:!(t?.without().has("places")??!1)}),[t]),A=(0,S.jsx)(Gn.Provider,{value:g,children:(0,S.jsx)(Fi,{context:e,children:(0,S.jsx)(rs,{context:e,registry:t,children:d((0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(ar,{face:"pages"}),(0,S.jsxs)(Jo,{context:c,children:[(0,S.jsx)(os,{}),(0,S.jsx)(ss,{}),(0,S.jsxs)(oi,{children:[(t?.routes()??[]).map(({path:N,component:G})=>(0,S.jsx)(Le,{path:N,element:(0,S.jsx)(G,{context:c})},N)),(0,S.jsx)(Le,{path:"/",element:(0,S.jsx)(ls,{context:c,Home:l})}),(0,S.jsx)(Le,{path:"/problems",element:(0,S.jsx)(s,{context:c})}),(0,S.jsx)(Le,{path:"/~draft",element:(0,S.jsx)(B.Suspense,{fallback:null,children:(0,S.jsx)(Qo,{context:c})})}),(0,S.jsx)(Le,{path:"/search",element:(0,S.jsx)(Xn,{context:c})}),(0,S.jsx)(Le,{path:"/map",element:(0,S.jsx)(Qn,{context:c})}),(0,S.jsx)(Le,{path:"/places",element:(0,S.jsx)(zn,{context:c})}),$e(c).some(N=>N.as===Pn)?null:(0,S.jsx)(Le,{path:Ea,element:(0,S.jsx)(Kn,{to:"/",replace:!0})}),(0,S.jsx)(Le,{path:"/places/:as",element:(0,S.jsx)(Yn,{context:c})}),(0,S.jsx)(Le,{path:"/:slug",element:(0,S.jsx)(Hi,{context:c,registry:t,page:"list"})}),(0,S.jsx)(Le,{path:"/:slug/:id",element:(0,S.jsx)(Hi,{context:c,registry:t,page:"record"})})]})]})]}))})})});return e.embedded||!a||r?A:(0,S.jsx)(di.Provider,{value:u,children:(0,S.jsx)(Sr.Provider,{value:m,children:A})})}var ds=()=>typeof document>"u"?null:document.body;function cs({context:e,registry:t,basename:n,initialPath:a,onNavigate:r,path:i,steering:d,firstLook:l,hrefOf:s,typing:c}){let[m,x]=(0,B.useState)(void 0),g=m!==void 0&&m.from===e.principal?{...e,principal:m.seat}:e;(0,B.useState)(()=>g.views?Gr(g.views,g.store.schema,En(g.brand,g.store.schema)):void 0);let u=de(),A=c??g.typing;wa({reader:g.locale??u?.locale,app:g.brand?.locale??g.app?.brand?.locale,readerTimeZone:g.timeZone??u?.timeZone,appTimeZone:g.brand?.timeZone??g.app?.brand?.timeZone});let N=g.principal??Zo,G=Fa(g.store,N,g.history),E=(G.past&&G.live===g.store?G.past.store:g.store).seenBy(N),k=E===g.store?g:{...g,store:E};Da(g.store,g.principal);let P=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(as,{onNavigate:r,path:i}),d?(0,S.jsx)(es,{steering:d}):null,k.presence||u?(0,S.jsx)(ts,{context:k,to:u}):null,(0,S.jsx)(Di,{context:k,...t?{registry:t}:{}}),l?(0,S.jsx)(qr,{firstLook:l,root:ds,app:En(g.brand,g.store.schema)}):null]}),K=k.views?(0,S.jsxs)(Wa,{store:k.store,views:k.views,...k.principal?{principal:k.principal}:{},...k.brand?{brand:k.brand}:{},...k.locale?{locale:k.locale}:{},...k.timeZone?{timeZone:k.timeZone}:{},...k.settings?{settings:k.settings}:{},...k.presence&&!u?{presence:k.presence}:{},...A?{typing:A}:{},...k.people?{people:k.people}:{},...k.seats?{seats:k.seats}:{},onSeat:_=>u?u.takeSeat(_):x({from:e.principal,seat:_}),...k.onKeepLens?{onKeepLens:k.onKeepLens}:{},...k.ai?{ai:k.ai}:{},...k.subscriptions?{subscriptions:k.subscriptions}:{},dismissals:k.dismissals,whileAway:k.whileAway,...k.signIn?{signIn:k.signIn}:{},resolveApp:k.resolveApp??u?.resolveApp,linkedRecords:k.linkedRecords??u?.linkedRecords,...k.app?{app:k.app}:{},...k.menuSections?{menuSections:k.menuSections}:{},children:[P,(0,S.jsx)(Fi,{context:k,children:(0,S.jsx)(wi,{context:k})})]}):P,ae=(0,S.jsx)(Ia.Provider,{value:G,children:K}),ue=k.files?(0,S.jsx)(Ha.Provider,{value:k.files,children:ae}):ae,oe=s===void 0?ue:(0,S.jsx)(Ii.Provider,{value:s,children:ue});if(a!==void 0){let _=n===void 0?a:`${n.replace(/\/$/,"")}${a}`;return(0,S.jsx)(ii,{initialEntries:[_],...n===void 0?{}:{basename:n},children:oe})}return(0,S.jsx)(si,{...n===void 0?{}:{basename:n},children:oe})}export{co as a,cs as b};
@@ -1 +0,0 @@
1
- import"./chunk.GYTVL6GR.js";import{G as W,T as x}from"./chunk.TMYGLXR6.js";import"./chunk.SDO3U72B.js";import"./chunk.P4CLT32V.js";import"./chunk.SLBWPVIY.js";import{b as D}from"./chunk.AJZBJBMO.js";var g=D(W(),1);var o=D(x(),1),v=864e5,l=t=>Date.UTC(+t.slice(0,4),+t.slice(5,7)-1,+t.slice(8,10)),I=t=>new Date(t).toISOString().slice(0,10),s=(t,i)=>I(l(t)+i*v),m=(t,i)=>{let a=new Date(l(t)),u=a.getUTCMonth()+i,d=Date.UTC(a.getUTCFullYear(),u,1),w=new Date(Date.UTC(a.getUTCFullYear(),u+1,0)).getUTCDate();return I(d+(Math.min(a.getUTCDate(),w)-1)*v)};function p(t,i,a){try{return new Intl.DateTimeFormat(t??"en-US",{...i,timeZone:"UTC"}).format(a)}catch{return new Intl.DateTimeFormat("en-US",{...i,timeZone:"UTC"}).format(a)}}function F(t){try{let i=new Intl.Locale(t??"en-US"),a=i.getWeekInfo?.().firstDay??i.weekInfo?.firstDay;if(a!==void 0)return a%7}catch{return 0}return/^en-US|^en$|-(US|CA|JP|BR|IL|MX|PH)$/.test(t??"en-US")?0:1}function L({id:t,label:i,selected:a,today:u,locale:d,onPick:w,onClose:T}){let[r,f]=(0,g.useState)(a??u),U=(0,g.useRef)(null),y=F(d),b=`${r.slice(0,7)}-01`,M=(new Date(l(b)).getUTCDay()-y+7)%7,P=s(b,-M),A=Array.from({length:6},(e,n)=>Array.from({length:7},(S,c)=>s(P,n*7+c))),$=p(d,{month:"long",year:"numeric"},l(b)),h=(0,g.useRef)(!0);(0,g.useEffect)(()=>{h.current&&U.current?.querySelector(`[data-day="${r}"]`)?.focus(),h.current=!1},[r]);let E=e=>{let n={ArrowLeft:()=>s(r,-1),ArrowRight:()=>s(r,1),ArrowUp:()=>s(r,-7),ArrowDown:()=>s(r,7),PageUp:()=>m(r,e.shiftKey?-12:-1),PageDown:()=>m(r,e.shiftKey?12:1),Home:()=>s(r,-((new Date(l(r)).getUTCDay()-y+7)%7)),End:()=>s(r,6-(new Date(l(r)).getUTCDay()-y+7)%7)};n[e.key]?(e.preventDefault(),h.current=!0,f(n[e.key]())):e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),T())},R=Array.from({length:7},(e,n)=>l("1970-01-04")+(y+n)%7*v),C={minWidth:32,minHeight:32,padding:"0 8px",borderRadius:6};return(0,o.jsxs)("div",{id:t,role:"group","aria-label":`Pick a date for ${i}`,"data-graview-part":"when-month",onKeyDown:e=>{e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),T())},style:{flexBasis:"100%",width:"min(100%, 20rem)",boxSizing:"border-box",padding:8,border:"1px solid var(--graview-edge)",borderRadius:8,background:"var(--graview-panel)",color:"var(--graview-ink)"},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:6,marginBottom:6},children:[(0,o.jsx)("button",{type:"button","aria-label":"Previous month",onClick:()=>f(m(r,-1)),style:C,children:"\u2039"}),(0,o.jsx)("span",{id:`${t}-title`,"aria-live":"polite",style:{fontWeight:600,fontSize:"0.875rem"},children:$}),(0,o.jsx)("button",{type:"button","aria-label":"Next month",onClick:()=>f(m(r,1)),style:C,children:"\u203A"})]}),(0,o.jsxs)("table",{ref:U,role:"grid","aria-labelledby":`${t}-title`,onKeyDown:E,style:{width:"100%",borderCollapse:"collapse",tableLayout:"fixed",fontSize:"0.8125rem"},children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:R.map(e=>(0,o.jsx)("th",{scope:"col",abbr:p(d,{weekday:"long"},e),style:{fontWeight:500,color:"var(--graview-ink-faint)",padding:"2px 0"},children:p(d,{weekday:"narrow"},e)},e))})}),(0,o.jsx)("tbody",{children:A.map(e=>(0,o.jsx)("tr",{children:e.map(n=>{let S=n.slice(0,7)===b.slice(0,7),c=n===a,k=n===u;return(0,o.jsx)("td",{role:"gridcell","aria-selected":c||void 0,style:{padding:1,textAlign:"center"},children:(0,o.jsx)("button",{type:"button","data-day":n,tabIndex:n===r?0:-1,"aria-label":`${p(d,{weekday:"long",year:"numeric",month:"long",day:"numeric"},l(n))}${k?", today":""}${c?", selected":""}`,...k?{"aria-current":"date"}:{},onClick:()=>w(n),onFocus:()=>n!==r&&f(n),style:{width:"100%",minHeight:36,padding:0,borderRadius:6,border:k?"1px solid var(--graview-accent)":"1px solid transparent",background:c?"var(--graview-accent)":"transparent",color:c?"var(--graview-accent-ink)":S?"var(--graview-ink)":"var(--graview-ink-faint)",fontWeight:c?600:400},children:Number(n.slice(8,10))})},n)})},e[0]))})]})]})}export{L as WhenMonth};
@@ -1 +0,0 @@
1
- import"./chunk.GZHZLJBF.js";import{n as P}from"./chunk.OW72XZF4.js";import"./chunk.OJGHDWI6.js";import"./chunk.KRODTMGR.js";import"./chunk.VICCAWAN.js";import"./chunk.OU5TRY4N.js";import"./chunk.CQPNDJAC.js";import"./chunk.GYTVL6GR.js";import{G as A,T as S,ba as b}from"./chunk.TMYGLXR6.js";import"./chunk.SDO3U72B.js";import{Ba as w,Nc as x,oa as L}from"./chunk.P4CLT32V.js";import"./chunk.SLBWPVIY.js";import{b as R}from"./chunk.AJZBJBMO.js";var u=R(A(),1);var n=R(S(),1),C={kind:"human"},p={color:"var(--graview-ink-muted)"};function I(e){if(e){if(/^https?:\/\//i.test(e))try{return new URL(e).href}catch{return}return L(e)?e:void 0}}function z(e){let o=b(),t=o?.linkedReads,[i,a]=(0,u.useState)(()=>t?t.answered(e)??"asking":null);return(0,u.useEffect)(()=>{if(!t){a(o?.linkedRecords?"asking":null);return}let d=t.answered(e);if(a(d===void 0?"asking":d),d!==void 0)return;let s=!0;return t.ask(e).then(l=>s&&a(l)),()=>{s=!1}},[t,o?.linkedRecords,e.address,e.kind,e.id]),i}function V({reference:e,as:o}){let t=b(),i=z(e),a={position:"relative",zIndex:x.raised,overflowWrap:"anywhere",minWidth:0,maxWidth:"100%"};if(i==="asking")return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"asking","aria-busy":"true",style:{...p,...a},children:"Linked record"});if(i&&"denied"in i)return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"denied",style:{...p,fontStyle:"italic",...a},children:"linked record (no access)"});if(!i)return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"missing",style:{...p,fontStyle:"italic",...a},children:"linked record (not found)"});let d=I(i.href),s=t?.linkedRecords,l=t?.principal??C,g=s?.open?c=>{c.metaKey||c.ctrlKey||(c.preventDefault(),s.open(e,l))}:void 0,k=(0,n.jsx)("a",{"data-graview-linked-title":"",...d?{href:d}:{role:"link",tabIndex:0},...g?{onClick:g,onKeyDown:c=>!d&&(c.key==="Enter"||c.key===" ")?g(c):void 0}:{},style:{fontWeight:600,color:"inherit",textUnderlineOffset:3,cursor:d||g?"pointer":"default"},children:i.label});return o==="chip"?(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"found",title:i.describe,style:{display:"inline-flex",alignItems:"center",minHeight:24,...a},children:k}):(0,n.jsx)(D,{record:i,title:k,base:a})}function D({record:e,title:o,base:t}){return(0,n.jsxs)("span",{"data-graview-linked":"","data-graview-linked-state":"found",style:{display:"grid",gap:2,padding:"8px 10px",border:"1px solid var(--graview-line)",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-surface)",...t},children:[(0,n.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"2px 8px"},children:[o,e.app?(0,n.jsxs)("span",{"data-graview-linked-app":"",style:{...p,fontSize:"0.75rem"},children:["in ",e.app]}):null]}),e.describe?(0,n.jsx)("span",{"data-graview-linked-describe":"",style:{...p,fontSize:"0.8125rem"},children:e.describe}):null,e.card&&e.card.length>0?(0,n.jsx)("span",{"data-graview-linked-card":"",style:{display:"flex",flexWrap:"wrap",gap:"2px 12px",fontSize:"0.8125rem"},children:e.card.map(i=>(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{style:p,children:i.label})," ",i.text]},i.label))}):null]})}function H({relation:e,refs:o,as:t="record",nodeId:i,field:a,style:d}){let s=(0,n.jsx)("span",{"data-graview-linked-list":"",style:{display:"grid",gap:6,minWidth:0,...d},children:o.map(l=>(0,n.jsx)(V,{reference:l,as:t},w(l)))});return i&&a?(0,n.jsx)(K,{nodeId:i,field:a,relation:e,refs:o,drawn:s}):s}function K({nodeId:e,field:o,relation:t,refs:i,drawn:a}){let{fields:d,commit:s}=P(e),l=d.find(f=>f.field===o),[g,k]=(0,u.useState)(!1);if(!l)return a;let c=t.cardinality==="one"?i[0]?w(i[0]):void 0:i.map(w);return(0,n.jsxs)("span",{style:{display:"grid",gap:6,minWidth:0},children:[a,g?(0,n.jsx)(N,{relation:t,value:c,label:"Link another record",onChange:f=>{s(l,f),k(!1)},onCancel:()=>k(!1)}):(0,n.jsx)("button",{type:"button","data-graview-linked-change":"",onClick:()=>k(!0),style:{justifySelf:"start",font:"inherit",fontSize:"0.8125rem",background:"none",border:0,padding:"4px 0",color:"var(--graview-accent)",cursor:"pointer",minHeight:24},children:"Change"})]})}function N({relation:e,value:o,onChange:t,onCancel:i,label:a}){let d=b(),s=d?.linkedRecords,l=d?.principal??C,g=(0,u.useId)(),[k,c]=(0,u.useState)(""),[f,m]=(0,u.useState)("asking");(0,u.useEffect)(()=>{if(!s)return;let r=!0;m("asking");let y=setTimeout(()=>{Promise.resolve().then(()=>s.find({address:e.address,kinds:e.kinds,query:k,limit:20},l)).then(h=>r&&m(Array.isArray(h)?h:"denied"),()=>r&&m([]))},150);return()=>{r=!1,clearTimeout(y)}},[s,e.address,e.kinds.join(","),k,l.kind,l.id]);let v=new Set([o].flat().filter(r=>typeof r=="string")),W=r=>{let y=w(r);if(e.cardinality==="one")return t(y);t(v.has(y)?[...v].filter(h=>h!==y):[...v,y])};return s?(0,n.jsxs)("span",{"data-graview-linked-picker":"",style:{display:"grid",gap:6,minWidth:0},children:[(0,n.jsx)("label",{htmlFor:g,style:{...p,fontSize:"0.8125rem"},children:a}),(0,n.jsx)("input",{id:g,type:"search",value:k,placeholder:`Find one in ${e.address}`,onChange:r=>c(r.target.value),style:{font:"inherit",minHeight:32,padding:"4px 8px",border:"1px solid var(--graview-line)",borderRadius:6,background:"var(--graview-surface)",color:"inherit",minWidth:0}}),f==="asking"?(0,n.jsx)("span",{"aria-busy":"true",style:p,children:"Looking\u2026"}):f==="denied"?(0,n.jsx)("span",{"data-graview-linked-state":"denied",style:{...p,fontStyle:"italic"},children:"linked record (no access)"}):f.length===0?(0,n.jsx)("span",{style:p,children:"Nothing there matches."}):(0,n.jsx)("ul",{role:"list",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:4},children:f.map(r=>{let y=v.has(w(r));return(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button","data-graview-linked-candidate":w(r),"aria-pressed":y,onClick:()=>W(r),style:{display:"grid",gap:2,width:"100%",textAlign:"start",font:"inherit",padding:"6px 8px",minHeight:32,border:"1px solid var(--graview-line)",borderRadius:6,background:y?"var(--graview-accent-soft, var(--graview-surface))":"var(--graview-surface)",color:"inherit",cursor:"pointer"},children:[(0,n.jsx)("span",{style:{fontWeight:600},children:r.label}),r.describe?(0,n.jsx)("span",{style:{...p,fontSize:"0.8125rem"},children:r.describe}):null]})},w(r))})}),i?(0,n.jsx)("button",{type:"button",onClick:i,style:{justifySelf:"start",font:"inherit",fontSize:"0.8125rem",background:"none",border:0,padding:"4px 0",color:"var(--graview-ink-muted)",cursor:"pointer",minHeight:24},children:"Keep it as it is"}):null]}):(0,n.jsxs)("span",{"data-graview-linked-picker":"","data-graview-linked-state":"no-host",style:p,children:["This page cannot read ",e.address,", so nothing there can be linked here."]})}var U=e=>(0,n.jsx)(H,{...e}),j=e=>(0,n.jsx)(N,{...e});export{N as LinkedPicker,H as LinkedRecordView,j as drawLinkedPicker,U as drawLinkedRecord};
@@ -1 +0,0 @@
1
- import"./chunk.AJZBJBMO.js";var e='"use strict";\n/*! @remote-dom/core and @remote-dom/polyfill \u2014 Copyright 2020-present, Shopify Inc. \u2014 MIT License.\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n * @graview/guest\'s worker runtime \u2014 Elastic License 2.0. */\n"use strict";(()=>{var Oe=globalThis,Jr=Oe.addEventListener,eo=Oe.removeEventListener,to=Oe.postMessage,no=globalThis.queueMicrotask,dn=globalThis.performance,ro=dn?dn.now.bind(dn):Date.now,Re={listen:t=>Jr.call(Oe,"message",t),unlisten:t=>eo.call(Oe,"message",t),post:t=>to.call(Oe,t),microtask:t=>no.call(globalThis,t),now:()=>ro()};var v=Symbol("name"),ue=Symbol("prefix"),de=Symbol("value"),S=Symbol("ns"),q=Symbol("owner"),I=Symbol("owner_document"),ne=Symbol("attributes"),M=Symbol("prev"),p=Symbol("next"),R=Symbol("child"),Y=Symbol("parent"),me=Symbol("host"),K=Symbol("data"),Ee=Symbol("listeners"),mn=Symbol("isTrusted"),Ae=Symbol("path"),_e=Symbol("stop_immediate_propagation"),Pe=Symbol("dispatching"),se=Symbol("content"),D=Symbol("hooks"),mt=Symbol("extensions"),Ne=Symbol("hooks_dispatch"),U=Symbol("is_connected"),ke=Symbol("create_element"),Xn=0,X=1,Ce=2,Ie=3,Me=8,Te=9,$n=10,fe=11,A="http://www.w3.org/1999/xhtml",Z="http://www.w3.org/2000/svg",Kn="http://www.w3.org/XML/1998/namespace",Xe="http://www.w3.org/2000/xmlns/";function ft(t){return t.split(/[\\t\\n\\f\\r ]+/).filter(Boolean)}function G(t){return t.replace(/[A-Z]/g,e=>String.fromCharCode(e.charCodeAt(0)+32))}function Zn(t){return t.replace(/[a-z]/g,e=>String.fromCharCode(e.charCodeAt(0)-32))}function k(t,e){let n=globalThis.DOMException;if(typeof n=="function")return new n(t,e);let r=new Error(t);return r.name=e,r}var Qn=/^(?:[A-Za-z][^\\0\\t\\n\\f\\r\\u0020/>]*|[:_\\u0080-\\u{10FFFF}][A-Za-z0-9-.:_\\u0080-\\u{10FFFF}]*)$/u,Jn=/[\\0\\t\\n\\f\\r />=]/u,oo=/[\\0\\t\\n\\f\\r />]/u;function ie(t){if(t==null)return null;let e=String(t);return e===""?null:e}function er(t){Qn.test(t)||pn(t)}function fn(t){(t===""||Jn.test(t))&&pn(t)}function pt(t,e,n){let r=ie(t),o=String(e),s=o.indexOf(":"),i=s<0?null:o.slice(0,s),a=s<0?o:o.slice(s+1);if((i!=null&&(i===""||oo.test(i))||(n==="element"?!Qn.test(a):a===""||Jn.test(a)))&&pn(o),i!=null&&r==null)throw k(`A namespace is required for the prefix in "${o}"`,"NamespaceError");if(i==="xml"&&r!==Kn)throw k("The xml prefix requires the XML namespace","NamespaceError");if((o==="xmlns"||i==="xmlns")&&r!==Xe)throw k("The xmlns name requires the XMLNS namespace","NamespaceError");if(r===Xe&&o!=="xmlns"&&i!=="xmlns")throw k("The XMLNS namespace requires the xmlns name or prefix","NamespaceError");return{namespace:r,qualifiedName:o,prefix:i,localName:a}}function pn(t){throw k(`Invalid name: "${t}"`,"InvalidCharacterError")}var ht=0,gt=1,tr=2,hn=3,so=typeof performance>"u"?Date.now:performance.now.bind(performance),V=class{static NONE=ht;static CAPTURING_PHASE=gt;static AT_TARGET=tr;static BUBBLING_PHASE=hn;timeStamp=so();target=null;currentTarget=null;srcElement=null;bubbles=!1;cancelable=!1;composed=!1;defaultPrevented=!1;cancelBubble=!1;eventPhase=ht;[Ae]=[];[_e]=!1;[Pe]=!1;constructor(e,n){this.type=e,Object.defineProperty(this,mn,{writable:!0,value:!1}),n&&(n.bubbles&&(this.bubbles=n.bubbles),n.cancelable&&(this.cancelable=n.cancelable),n.composed&&(this.composed=n.composed))}get isTrusted(){return this[mn]}composedPath(){return[...this[Ae]]}stopPropagation(){this.cancelBubble=!0}stopImmediatePropagation(){this[_e]=!0,this.cancelBubble=!0}preventDefault(){this.cancelable&&(this.defaultPrevented=!0)}set returnValue(e){e||this.preventDefault()}get returnValue(){return!this.defaultPrevented}initEvent(e,n,r){this.type=e,this.bubbles=!!n,this.cancelable=!!r}};function gn(t,e,n){if(t.cancelBubble)return;let o=e[Ee]?.get(t.type)?.[n===gt?"capture":"bubble"];if(o)for(let s of[...o]){if(!o.has(s)||s.signal?.aborted)continue;t.eventPhase=t.target===e?tr:n,t.currentTarget=e;let i=s.normalizedListener;try{typeof i=="object"?i.handleEvent(t):i.call(e,t)}catch(a){setTimeout(io,0,a)}if(t[_e])break}}function io(t){throw t}var $e=[],yt=new WeakMap;function bt(t,e){let n=yt.get(t);n?n.push(e):yt.set(t,[e]),$e[$e.length-1].push(t)}function B(t){let e=[];$e.push(e);let n;try{n=t()}catch(r){$e.pop();try{nr(e)}catch{}throw r}return $e.pop(),nr(e),n}function nr(t){let e,n=!1;for(let r of t){let o=yt.get(r);if(o){for(;o.length>0;){let s=o.shift();try{s()}catch(i){n||(e=i,n=!0)}}yt.delete(r)}}if(n)throw e}var Et=[],Ke=[],yn=!1;function we(t){for(let e of t)Et.push(e),e[1]&&Ke.push(e[1]);if(!yn){yn=!0;try{let e,n=!1;for(let r=0;r<Et.length;r++){let[o,s]=Et[r];s&&Ke.splice(Ke.indexOf(s),1);try{o()}catch(i){n||(e=i,n=!0)}}if(n)throw e}finally{Et.length=0,Ke.length=0,yn=!1}}}function Ze(t){let e=t;for(;e;){if(Ke.includes(e))return!0;e=e[Y]??e[me]}return!1}var Qe=Symbol("listenerRegistrations"),pe=class{[Ee]=void 0;[Qe]=void 0;[I]=void 0;addEventListener(e,n,r){if(n==null)return;let o=r===!0||typeof r=="object"&&r.capture===!0,s=typeof r=="object"&&r.once===!0,i=typeof r=="object"?r.signal:void 0;if(i?.aborted)return;let a=bn(o),c=this[Qe];c||(c=new Map,this[Qe]=c);let u=c.get(e);u||(u={},c.set(e,u));let m=u[a];if(m||(m=new Map,u[a]=m),m.has(n))return;let h=this,g={type:e,listener:n,capture:o,once:s,normalizedListener:n,signal:i};(s||i)&&(g.normalizedListener=function(...C){if(g.signal?.aborted){Nt(h,g);return}return g.once&&Nt(h,g),typeof g.listener=="object"?g.listener.handleEvent(...C):g.listener.call(this,...C)});let y=this[Ee];y||(y=new Map,this[Ee]=y);let O=y.get(e);O||(O={},y.set(e,O));let E=O[a];if(E||(E=new Set,O[a]=E),m.set(n,g),E.add(g),i){let N=()=>{Nt(h,g)};g.abortListener=N,i.addEventListener("abort",N,{once:!0})}this[I]?.defaultView[Ne].addEventListener?.(this,e,n,r)}removeEventListener(e,n,r){return ao.call(this,e,n,r)}dispatchEvent(e){if(e[Pe])throw k("Failed to execute \'dispatchEvent\' on \'EventTarget\': The event is already being dispatched.","InvalidStateError");e[Pe]=!0;try{let n=[],r=this;for(;r!=null;)n.push(r),r=r.parentNode;e.target=this,e.srcElement=this,e[Ae]=n;for(let s=n.length;s--;)if(gn(e,n[s],gt),e.cancelBubble)return!e.defaultPrevented;let o=e.bubbles?n:n.slice(0,1);for(let s=0;s<o.length;s++)if(gn(e,o[s],hn),e.cancelBubble)return!e.defaultPrevented;return!e.defaultPrevented}finally{e[Pe]=!1,e.cancelBubble=!1,e[_e]=!1,e.eventPhase=ht,e.currentTarget=null,e[Ae]=[]}}};function ao(t,e,n){if(e==null)return;let r=n===!0||n&&n.capture===!0,o=bn(!!r),s=this[Qe]?.get(t)?.[o]?.get(e);s&&Nt(this,s)}function bn(t){return t?"capture":"bubble"}function Nt(t,e){let n=bn(e.capture),r=t[Qe],o=r?.get(e.type);if(!o)return;let s=o[n];if(!s||s.get(e.listener)!==e)return;s.delete(e.listener),s.size===0&&delete o[n],!o.bubble&&!o.capture&&r?.delete(e.type),e.signal&&e.abortListener&&e.signal.removeEventListener("abort",e.abortListener);let i=t[Ee],a=i?.get(e.type);if(!a)return;let c=a[n];c?.delete(e)&&(c.size===0&&delete a[n],!a.bubble&&!a.capture&&i?.delete(e.type),t[I]?.defaultView[Ne].removeEventListener?.(t,e.type,e.listener,e.capture))}var Q=class extends Array{item(e){return this[e]??null}};var et=0,rr=1,Tn=2,wn=3,tt=4,or=0,sr=1,xt=2,vt=3,ir=4,Nn=5,ar=6,lr=7,Tt=/^(?:--|-?[A-Za-z_\\u0080-\\u{10FFFF}])[A-Za-z0-9_\\u0080-\\u{10FFFF}-]*$/u;function lo(t,e){let n=1,r=null;for(let o=e;o<t.length;o++){let s=t[o];if(r){s==="\\\\"?o++:s===r&&(r=null);continue}if(s===\'"\'||s==="\'")r=s;else if(s==="(")n++;else if(s===")"&&--n===0)return[t.slice(e,o),o+1]}return[t.slice(e),t.length]}function W(t){throw k(`Invalid or unsupported selector: "${t}"`,"SyntaxError")}function St(t,e){let n=typeof e=="string"?nt(e):[{combinator:tt,matchers:e}],r=null,o=t[R];return o&&n[0].matchers.length&&xn(o,n,s=>(r=s,!1)),r}function Ot(t,e){let n=typeof e=="string"?nt(e):[{combinator:tt,matchers:e}],r=new Q,o=t[R];return o&&n[0].matchers.length&&xn(o,n,s=>{r.push(s)}),r}function nt(t,e=!1,n=!1){let r={combinator:tt,matchers:[]},o=[r],s=/[\\t\\n\\f\\r ]*?([>\\t\\n\\f\\r +~]?)[\\t\\n\\f\\r ]*?(?:(?:\\[[\\t\\n\\f\\r ]*([^\\]=\\t\\n\\f\\r ]+)[\\t\\n\\f\\r ]*(?:=[\\t\\n\\f\\r ]*(?:([\'"])(.*?)\\3|([^\\]\\t\\n\\f\\r ]+)))?[\\t\\n\\f\\r ]*(?:\\]|$))|([#.]?)([^\\t\\n\\f\\r #.[>:+~()]+)|:(\\w+)(\\()?)/gi,i=t.replace(/^[\\t\\n\\f\\r ]+|[\\t\\n\\f\\r ]+$/g,"");i===""&&W(t);let a=0,c;for(;c=s.exec(i);){c.index!==a&&W(t),c[1]&&(r.matchers.length===0&&!(n&&o.length===1)&&W(t),c[1]===">"?r.combinator=rr:c[1]==="+"?r.combinator=wn:c[1]==="~"?r.combinator=Tn:r.combinator=et,r={combinator:tt,matchers:[]},o.push(r));let u=c[8]?G(c[8]):c[2]||c[7];c[7]!=null&&!c[6]&&r.matchers.length>0&&W(t);let h,g=c[4]??c[5]??c[7];if(c[2]){Tt.test(u)||W(t);let y=c[5],O=y?.[0];if(c[3]==null&&(O===\'"\'||O==="\'")){let E=c[0].lastIndexOf(y);g=i.slice(c.index+E+1),s.lastIndex=i.length}else y!=null&&!Tt.test(y)&&W(t);h=ir}else c[6]?(Tt.test(u)||W(t),h=c[6]==="#"?xt:vt):c[8]?h=c[9]==null?Nn:ar:c[7]==="*"?h=or:c[7]&&Tt.test(c[7])?h=sr:W(t);c[9]?([g,s.lastIndex]=lo(i,s.lastIndex),u!=="has"&&u!=="not"&&W(t),u==="has"&&e&&W(t),nt(g,e||u==="has",u==="has")):h===Nn&&W(t),r.matchers.push({type:h,name:u,value:g}),a=s.lastIndex}return(a!==i.length||r.matchers.length===0)&&W(t),o}function co(t,e){let n=nt(e);return n[0]?.matchers.length?Je(t,n):!1}function uo(t,e){let n=nt(e,!0,!0),r=n[0];if(n.length===1&&r.matchers.length===0)return!1;let o=et,s={type:lr,name:":scope"};if(r.matchers.length===0?(o=r.combinator,r.matchers.push(s)):n.unshift({combinator:et,matchers:[s]}),n.some(({matchers:c})=>c.length===0))return!1;let i=o===wn||o===Tn?t[p]:t[R];if(!i)return!1;let a=!1;return xn(i,n,()=>(a=!0,!1),t),a}function xn(t,e,n,r){let o=[],s=t;for(;s;){if(j(s)){if(Je(s,e,r)&&n(s)===!1)return!1;let i=s[R];if(i){let a=s[p];a&&o.push(a),s=i;continue}}s=s[p]??o.pop()??null}return!0}function Je(t,e,n){let{combinator:r,matchers:o}=e[e.length-1];if(r===tt){if(!wt(t,o,n))return!1;let a=e.slice(0,-1);return a.length===0||Je(t,a,n)}let s=r===rr||r===et?Y:M,i=t[s];if(!i)return!1;if(r===et||r===Tn){for(;i;){if(j(i)&&wt(i,o,n)){let a=e.slice(0,-1);if(a.length===0||Je(i,a,n))return!0}i=i[s]}return!1}else{if(r===wn&&!j(i)){for(;i&&!j(i);)i=i[s];if(!i)return!1}if(!j(i)||!wt(i,o,n))return!1;let a=e.slice(0,-1);return a.length===0||Je(i,a,n)}}function En(t,e){return t.getAttributeNS(null,t.namespaceURI===A?G(e):e)}function wt(t,e,n){if(!t)return!1;if(Array.isArray(e)){for(let i of e)if(wt(t,i,n)===!1)return!1;return!0}let{type:r,name:o,value:s}=e;switch(r){case or:return o==="*";case sr:return t.namespaceURI===A?t.localName===G(o):t.localName===o;case xt:return En(t,"id")===o;case vt:let i=En(t,"class");return i?ft(i).includes(o):!1;case ir:let a=En(t,o);return s==null?a!=null:a===s;case lr:return t===n;case Nn:W(`:${o}`);case ar:switch(o){case"has":return uo(t,s||"");case"not":return!co(t,s||"");default:W(`:${o}(${s})`)}}return!1}function mo(t){return t.nodeType===Ce}function rt(t){return K in t}function Sn(t){return t.nodeType===Ie}function fo(t){return t.nodeType===Me}function j(t){return t.nodeType===X}function vn(t){return t.nodeType===fe}function mr(t){return"appendChild"in t}function Rt(t){let e=[],n=[t],r=new Set(n),o=new Set,s;for(;n.length>0;){let i=n.pop();if(r.delete(i),o.has(i))continue;let a=[];for(let c of st(i)){if(o.has(c)||(o.add(c),e.push(c),a.push(c),!j(c)))continue;let u=c[ne];if(u)for(let h of u)o.has(h)||(o.add(h),e.push(h));let m=c[se];m&&!o.has(m)&&!r.has(m)&&(r.add(m),n.push(m))}s??=a}return{nodes:e,treeNodes:s}}function ot(t,e){for(let n of t)n[I]=e}function cr(t,e){let n=t.constructor,r=new n(t.name,t.value,t.namespaceURI);return r[I]=e,r}function ur(t,e){if(Sn(t))return e.createTextNode(t.data);if(fo(t))return e.createComment(t.data);if(mo(t))return cr(t,e);if(j(t)){let n=e[ke](t[v],t.namespaceURI,t[ue],t.localName);if(t[ne])for(let r=0;r<t[ne].length;r++){let o=t[ne].item(r);n.attributes.setNamedItem(cr(o,e))}return n}else{if(vn(t))return e.createDocumentFragment();{let n=new t.constructor;return n[I]=e,n}}}function At(t,e,n=t.ownerDocument){if(t.nodeType===Te)throw k("Cannot clone a document node","NotSupportedError");let r=ur(t,n);if(!e||!j(t)&&!vn(t))return r;let o=new Set([t]),s=[{source:t,destination:r,childIndex:0,cloningContent:!1}];for(;s.length>0;){let i=s[s.length-1],a,c;if(i.cloningContent)if(i.contentSource&&i.contentDestination)a=i.contentSource.childNodes[i.childIndex++],c=i.contentDestination;else{s.pop(),i.appendTo&&i.appendTo.appendChild(i.destination);continue}else if(a=i.source.childNodes[i.childIndex++],c=i.destination,!a){if(i.cloningContent=!0,i.childIndex=0,j(i.source)&&i.source.namespaceURI===A&&i.source.localName==="template"){let m=i.source[se];m&&(o.has(m)&&dr(),o.add(m),i.contentSource=m,i.contentDestination=i.destination.content)}continue}if(!a){s.pop(),i.appendTo&&i.appendTo.appendChild(i.destination);continue}o.has(a)&&dr(),o.add(a);let u=ur(a,n);j(a)||vn(a)?s.push({source:a,destination:u,appendTo:c,childIndex:0,cloningContent:!1}):c.appendChild(u)}return r}function dr(){throw new Error("Cannot clone a cyclic or repeated node graph")}function _t(t,e){let n=String(e);return n===""?null:St(t,[{type:xt,name:n}])}function Pt(t,e){let n=[...new Set(ft(String(e)))];return Ot(t,n.map(r=>({type:vt,name:r})))}function kt(t,e){let n=String(e),r=G(n),o=[];for(let s of Ct(t))j(s)&&(n==="*"||(s.namespaceURI===A?s[v]===r:s[v]===n))&&o.push(s);return o}function Ct(t){let e=[],n=[],r=t[R];for(;r;){e.push(r);let o=r[R],s=r[p];o?(s&&n.push(s),r=o):r=s??n.pop()??null}return e}function st(t){let e=Ct(t);return e.unshift(t),e}var J=class extends pe{nodeType=Xn;[v]="";[Y]=null;[me]=null;[R]=null;[M]=null;[p]=null;[U]=!1;get[D](){return this[I].defaultView[Ne]}get localName(){return this[v]}get nodeName(){return this[v]}get ownerDocument(){return this[I]}get isConnected(){return this[U]}isDefaultNamespace(e){let n=ie(e);return po(this)===n}get parentNode(){return this[Y]}set parentNode(e){}get parentElement(){let e=this[Y];return!e||e.nodeType!==1?null:e}set parentElement(e){}get previousSibling(){return this[M]}set previousSibling(e){}get nextSibling(){return this[p]}set nextSibling(e){}get previousElementSibling(){let e=this[M];for(;e&&e.nodeType!==1;)e=e[M];return e}set previousElementSibling(e){}get nextElementSibling(){let e=this[p];for(;e&&e.nodeType!==1;)e=e[p];return e}set nextElementSibling(e){}get firstChild(){return this[R]}set firstChild(e){}get lastChild(){let e=this[R];for(;e;){let n=e[p];if(n==null)break;e=n}return e}set lastChild(e){}get nodeValue(){return rt(this)?this.data:null}set nodeValue(e){rt(this)&&(this.data=e)}get textContent(){if(rt(this))return this.data;let e="";for(let n of Ct(this))Sn(n)&&(e+=n.data);return e}set textContent(e){if(rt(this))this.data=e;else if(mr(this)){let n=e==null?"":String(e);n===""?this.replaceChildren():this.replaceChildren(n)}}cloneNode(e){return At(this,e)}contains(e){let n=e;for(;n!=null;){if(n===this)return!0;n=n.parentNode}return!1}};function po(t){let e=t;for(;e;)switch(e.nodeType){case X:{let n=e;if(n.prefix==null&&n.namespaceURI!=null)return n.namespaceURI;let r=n.attributes.getNamedItemNS(Xe,"xmlns");if(r!=null&&r.prefix==null)return ie(r.value);e=n.parentElement;break}case Te:e=e.documentElement;break;case $n:case fe:return null;case Ce:e=e.ownerElement;break;default:e=e.parentElement}return null}var ee=Symbol("insertNode"),An=Symbol("preflightInsertions"),It=Symbol("replaceNode"),he=class extends J{remove(){let e=this.parentNode;e&&e.removeChild(this)}replaceWith(...e){let n=xe(e),r=this.parentNode;if(r)return On(o=>{ae(r,n);let s=this[p];for(;s&&n.includes(s);)s=s[p];let i=Rn(r,n,o);this.parentNode===r?r[It](i,this,o):r[ee](i,s,o)})}before(...e){let n=xe(e),r=this.parentNode;if(r)return On(o=>{ae(r,n);let s=this[M];for(;s&&n.includes(s);)s=s[M];let i=Rn(r,n,o);r[ee](i,s?s[p]:r.firstChild,o)})}after(...e){let n=xe(e),r=this.parentNode;if(r)return On(o=>{ae(r,n);let s=this[p];for(;s&&n.includes(s);)s=s[p];let i=Rn(r,n,o);r[ee](i,s,o)})}};function On(t){return B(()=>{let e=[];try{t(e)}catch(n){try{we(e)}catch{}throw n}we(e)})}function xe(t){return t.map(e=>e instanceof J?e:String(e))}function it(t,e){return e instanceof J?e:t.ownerDocument.createTextNode(String(e))}function ae(t,e){for(let n of e){if(!(n instanceof J))continue;let r=t;for(;r;){if(r===n)throw k("Cannot insert a node into itself or one of its descendants","HierarchyRequestError");r=r[Y]??r[me]}}}function Rn(t,e,n){let r=[];for(let s of e)r.push(it(t,s));if(r.length===1)return r[0];let o=t.ownerDocument.createDocumentFragment();o[An](r);for(let s of r)o[ee](s,null,n);return o}var Mt,_n=0,fr=0,pr=0,hr=0,De=!1,kn=!1,at=!1,Dt=class{#t;#n=[];#e=new Set;#r=!1;constructor(e){if(typeof e!="function")throw new TypeError("MutationObserver callback must be a function");this.#t=e}observe(e,n={}){let r=ho(n),o=Mt??=new WeakMap,s=o.get(e);s==null&&(s=new Map,o.set(e,s));let i=s.get(this);i==null?_n++:Pn(i,-1),s.set(this,r),Pn(r,1),this.#e.add(e)}disconnect(){let e=Mt;if(e!=null){for(let n of this.#e){let r=e.get(n),o=r?.get(this);o!=null&&(r.delete(this),_n--,Pn(o,-1)),r?.size===0&&e.delete(n)}this.#e.clear(),this.#n.length=0,_n===0&&(Mt=void 0)}}takeRecords(){return this.#n.splice(0)}enqueue(e){this.#n.push(e),!this.#r&&(this.#r=!0,queueMicrotask(()=>{this.#r=!1;let n=this.takeRecords();n.length>0&&this.#t.call(this,n,this)}))}};function te(t){let e=Mt;if(e==null)return;let n=new Map,r=t.target;for(;r;){let o=e.get(r);if(o)for(let[s,i]of o){if(r!==t.target&&!i.subtree)continue;let a=!1;if(t.type==="attributes"){if(!i.attributes||i.attributeFilter&&!i.attributeFilter.has(t.attributeName??""))continue;a=i.attributeOldValue}else if(t.type==="characterData"){if(!i.characterData)continue;a=i.characterDataOldValue}else if(!i.childList)continue;n.set(s,n.get(s)===!0||a)}r=r.parentNode}for(let[o,s]of n)o.enqueue({addedNodes:t.addedNodes??new Q,attributeName:t.attributeName??null,attributeNamespace:t.attributeNamespace??null,nextSibling:t.nextSibling??null,oldValue:s?t.oldValue??null:null,previousSibling:t.previousSibling??null,removedNodes:t.removedNodes??new Q,target:t.target,type:t.type})}function Lt(...t){let e=new Q;return e.push(...t),e}function ho(t){if(t.attributes===!1&&(t.attributeOldValue||t.attributeFilter!=null))throw new TypeError("attributeOldValue and attributeFilter require attributes to be enabled");if(t.characterData===!1&&t.characterDataOldValue)throw new TypeError("characterDataOldValue requires characterData to be enabled");let e=t.attributes??(t.attributeOldValue===!0||t.attributeFilter!=null),n=t.characterData??t.characterDataOldValue===!0,r=t.childList===!0;if(!e&&!n&&!r)throw new TypeError("MutationObserver options must enable childList, attributes, or characterData");return{attributes:e,attributeFilter:t.attributeFilter==null?void 0:new Set(t.attributeFilter.map(String)),attributeOldValue:t.attributeOldValue===!0,characterData:n,characterDataOldValue:t.characterDataOldValue===!0,childList:r,subtree:t.subtree===!0}}function Pn(t,e){t.attributes&&(fr+=e),t.characterData&&(pr+=e),t.childList&&(hr+=e),De=fr>0,kn=pr>0,at=hr>0}var re=class extends he{childNodes=new Q;children=new Q;appendChild(e){return B(()=>this[ee](e,null))}insertBefore(e,n){return B(()=>this[ee](e,n||null))}append(...e){return B(()=>{let n=xe(e.filter(r=>r!=null));n.length>1&&ae(this,n);for(let r of n)this[ee](it(this,r),null)})}prepend(...e){return B(()=>{let n=xe(e.filter(o=>o!=null));n.length>1&&ae(this,n);let r=this.firstChild;for(let o of n)this[ee](it(this,o),r)})}replaceChildren(...e){return B(()=>{let n=xe(e.filter(o=>o!=null));ae(this,n);let r;for(;r=this.firstChild;)this.removeChildImmediately(r);for(let o of n)this[ee](it(this,o),null)})}removeChild(e){return B(()=>(this.removeChildImmediately(e),e))}removeChildImmediately(e){if(e.parentNode!==this)throw k("The node is not a child of this node","NotFoundError");let n=this[U]?st(e):void 0,r=e[M],o=e[p],s=Gt(this,e);if(n)for(let i of n)i[U]=!1;this.queueRemovalMutationRecord(this,e,r,o),n&&this.enqueueTreeReactions(n,"disconnectedCallback"),we(this.collectRemovalHookEffects(e,s))}replaceChild(e,n){return B(()=>this[It](e,n))}[It](e,n,r){if(ae(this,[e]),n.parentNode!==this)throw k("The reference node is not a child of this parent","NotFoundError");let o=n[M],s=n[p],i=this.prepareInsertion(e),a=this[U]?st(n):void 0,c=new Set(i.map(({node:g})=>g)),u=s;for(;u&&c.has(u);)u=u[p];let m=Gt(this,n);if(a){for(let y of a)y[U]=!1;let g=new Set(a);for(let y of i)g.has(y.node)&&(y.shouldDisconnect=!1)}this.commitInsertion(i,u);let h=this[U];return this.queueRemovalMutationRecord(this,n,o,s),this.queueInsertionMutationRecords(i),a&&this.enqueueTreeReactions(a,"disconnectedCallback"),this.enqueueInsertionReactions(i,h),this.performOrCollectHookEffects([...this.collectRemovalHookEffects(n,m),...this.collectInsertionHookEffects(i)],r),n}querySelectorAll(e){return Ot(this,e)}querySelector(e){return St(this,e)}[ee](e,n,r){return this.validateInsertion(e,n),this.insertIntoValidated(e,n,r),e}[An](e){for(let n of e)this.validateInsertion(n,null),this.prepareInsertion(n)}validateInsertion(e,n){if(ae(this,[e]),n&&n.parentNode!==this)throw k("The reference node is not a child of this parent","NotFoundError")}insertIntoValidated(e,n,r){e===n&&(n=e[p]);let o=this.prepareInsertion(e);this.commitInsertion(o,n);let s=this[U];this.queueInsertionMutationRecords(o),this.enqueueInsertionReactions(o,s),this.performOrCollectHookEffects(this.collectInsertionHookEffects(o),r)}performOrCollectHookEffects(e,n){n?n.push(...e):we(e)}prepareInsertion(e){let n=[];if(e.nodeType===fe){let i=e[R];for(;i;)n.push(i),i=i[p]}else n.push(e);let r=this[U],o=this[I],s=[];for(let i of n){let a=i[U],c=a||r,u,m;if(i[I]===o)c&&(u=st(i));else{let h=Rt(i);m=h.nodes,c&&(u=h.treeNodes)}s.push({node:i,nodes:u,adoption:m,shouldDisconnect:a})}return s}commitInsertion(e,n){for(let s of e){let i=s.node[Y];if(i){let a=s.node[M],c=s.node[p];s.source={parent:i,index:Gt(i,s.node),previousSibling:a,nextSibling:c}}}for(let s of e){let i=this.attachChild(s.node,n);s.insertIndex=i.index,s.previousSibling=i.previousSibling,s.nextSibling=i.nextSibling}let r=this[I];for(let{adoption:s}of e)s&&ot(s,r);let o=this[U];for(let{nodes:s}of e)if(s)for(let i of s)i[U]=o}attachChild(e,n){if(n){let s=n[M];e[p]=n,e[M]=s,s?s[p]=e:this[R]=e,n[M]=e}else{e[p]=null;let s=this[R];if(s){let i;for(;i=s[p];)s=i;s[p]=e,e[M]=s}else this[R]=e,e[M]=null}let r=j(e);e[Y]=this;let o;if(n){if(o=this.childNodes.indexOf(n),this.childNodes.splice(o,0,e),r){let s=n;for(;s&&!j(s);)s=s[p];s?this.children.splice(this.children.indexOf(s),0,e):this.children.push(e)}}else o=this.childNodes.length,this.childNodes.push(e),r&&this.children.push(e);return{index:o,previousSibling:e[M],nextSibling:e[p]}}queueRemovalMutationRecord(e,n,r,o){at&&te({type:"childList",target:e,removedNodes:Lt(n),previousSibling:r,nextSibling:o})}queueInsertionMutationRecords(e){if(at)for(let n of e){let{node:r,source:o}=n;o&&this.queueRemovalMutationRecord(o.parent,r,o.previousSibling,o.nextSibling),te({type:"childList",target:this,addedNodes:Lt(r),previousSibling:n.previousSibling,nextSibling:n.nextSibling})}}collectRemovalHookEffects(e,n){return this.nodeType!==X||Ze(this)?[]:[[()=>this[D].removeChild?.(this,e,n)]]}collectInsertionHookEffects(e){let n=[];for(let r of e){let{node:o,source:s}=r;s?.parent.nodeType===X&&!Ze(s.parent)&&n.push([()=>s.parent[D].removeChild?.(s.parent,o,s.index)]),this.nodeType===X&&!Ze(this)&&n.push([()=>this[D].insertChild?.(this,o,r.insertIndex),o])}return n}enqueueInsertionReactions(e,n){for(let r of e){let{nodes:o}=r;o&&(r.shouldDisconnect&&this.enqueueTreeReactions(o,"disconnectedCallback"),n&&this.enqueueTreeReactions(o,"connectedCallback"))}}enqueueTreeReactions(e,n){yr(e,n)}};function gr(t,e,n,r){if(e.parentNode!==t)throw Error("not a child of this node");let o=t[U]?n.treeNodes:void 0,s=e[M],i=e[p],a=Gt(t,e);if(o)for(let u of o)u[U]=!1;ot(n.nodes,r),at&&te({type:"childList",target:t,removedNodes:Lt(e),previousSibling:s,nextSibling:i}),o&&yr(o,"disconnectedCallback");let c=[];t.nodeType===X&&!Ze(t)&&c.push([()=>t[D].removeChild?.(t,e,a)]),we(c)}function Gt(t,e){let n=e[M],r=e[p];n?n[p]=r:t[R]=r,r&&(r[M]=n);let o=t.childNodes.indexOf(e);return t.childNodes.splice(o,1),j(e)&&t.children.splice(t.children.indexOf(e),1),e[Y]=null,e[p]=null,e[M]=null,o}function yr(t,e){for(let n of t){let r=n[e];typeof r=="function"&&bt(n,()=>r.call(n))}}function lt(t,e,n,r,o){let{observedAttributes:s}=t.constructor,{attributeChangedCallback:i}=t;i==null||s==null||!s.includes(e)||bt(t,()=>i.call(t,e,n,r,o))}var Ht=class{[R]=null;constructor(e){this[q]=e}getNamedItem(e){let n=String(e),r=this[q][S]===A?G(n):n,o=this[R];for(;o;){if(o.name===r)return o;o=o[p]}return null}getNamedItemNS(e,n){let r=ie(e),o=String(n),s=this[R];for(;s;){if(s.localName===o&&s[S]===r)return s;s=s[p]}return null}item(e){let n=this[R],r=0;for(;n;){if(r++===e)return n;n=n[p]}return null}get length(){let e=0,n=this[R];for(;n;)e++,n=n[p];return e}removeNamedItem(e){let n=String(e),r=this[q][S]===A?G(n):n;return B(()=>this.removeNamedItemImmediately(o=>o.name===r))}removeNamedItemNS(e,n){let r=ie(e),o=String(n);return B(()=>this.removeNamedItemImmediately(s=>s.localName===o&&s[S]===r))}removeNamedItemImmediately(e){let n=this[q],r=this[R],o=null;for(;r!=null;){if(e(r)){o&&(o[p]=r[p]),this[R]===r&&(this[R]=r[p]);let s=r.value;return r[p]=null,r[q]=null,De&&te({type:"attributes",target:n,attributeName:r.name,attributeNamespace:r[S],oldValue:s}),n[D].removeAttribute?.(n,r.name,r[S]),lt(n,r.localName,s,null,r[S]),r}o=r,r=r[p]}return null}setNamedItem(e){return B(()=>this.setNamedItemImmediately(e))}setNamedItemImmediately(e){let n=this[q],r=e[q];if(r!=null&&r!==n)throw k("The attribute is already in use by another element.","InUseAttributeError");let o=null,s=this[R],i=null;for(;s;){if(s.localName===e.localName&&s[S]===e[S]){if(s===e)return s;i?i[p]=e:this[R]=e,e[p]=s[p],s[p]=null,o=s;break}i=s,s=s[p]}o==null&&(i?i[p]=e:this[R]=e),e[q]=n,e[I]=n[I],o&&(o[q]=null);let a=o==null||o.value!==e.value,c=o!=null&&o.name!==e.name;return a&&De&&te({type:"attributes",target:n,attributeName:e.name,attributeNamespace:e[S],oldValue:o?.value??null}),c&&n[D].removeAttribute?.(n,o.name,o[S]),(a||c)&&n[D].setAttribute?.(n,e.name,e.value,e[S]),a&&lt(n,e.localName,o?.value??null,e.value,e[S]),o}setNamedItemNS(e){return this.setNamedItem(e)}*[Symbol.iterator](){let e=this[R];for(;e;)yield e,e=e[p]}};var ve=class extends J{nodeType=Ce;[S]=null;[p]=null;[q]=null;constructor(e,n,r){super(),this[v]=e,this[de]=n,r&&(this[S]=r)}get nodeName(){return this[v]}set nodeName(e){}get name(){return this[v]}set name(e){}get localName(){if(this[S]==null)return this[v];let e=this[v].indexOf(":");return e<0?this[v]:this[v].slice(e+1)}get prefix(){if(this[S]==null)return null;let e=this[v].indexOf(":");return e<0?null:this[v].slice(0,e)}get value(){return this[de]}set value(e){let n=String(e),r=this[q];if(!r){this[de]=n;return}B(()=>{let o=this[de];this[de]=n,De&&o!==n&&te({type:"attributes",target:r,attributeName:this[v],attributeNamespace:this[S],oldValue:o}),this[D].setAttribute?.(r,this[v],n,this[S]),lt(r,this.localName,o,n,this[S])})}get nodeValue(){return this.value}set nodeValue(e){this.value=e}get ownerElement(){return this[q]}get namespaceURI(){return this[S]}get specified(){return!0}};var go={amp:"&",AMP:"&",apos:"\'",gt:">",GT:">",lt:"<",LT:"<",quot:\'"\',QUOT:\'"\'},yo=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),bo=/(?:<([a-z][a-z0-9-:]*)((?:[\\s]+[^<>\'"=/\\s]+(?:=([\'"])[^]*?\\3|=[^>\'"\\s]*|))*)[\\s]*(\\/?)\\s*>|<\\/([a-z][a-z0-9-:]*)>|<!--(.*?)-->|([^<>]+))/gi,Nr=/\\s([^<>\'"=/\\n\\s]+)(?:=(["\'])([\\s\\S]*?)\\2|=([^>\'"\\n\\s]*)|)/g,Eo="|b|big|blockquote|body|br|center|code|dd|div|dl|dt|em|embed|h1|h2|h3|h4|h5|h6|head|hr|i|img|li|listing|menu|meta|nobr|ol|p|pre|ruby|s|small|span|strong|strike|sub|sup|table|tt|u|ul|var|",No=/^(?:color|face|size)$/i;function br(t){return t.replace(/&(?:(amp|AMP|apos|gt|GT|lt|LT|quot|QUOT)|#(\\d+)|#[xX]([\\da-fA-F]+));/g,(e,n,r,o)=>{if(n)return go[n];let s=Number.parseInt(r??o,r?10:16);try{return String.fromCodePoint(s)}catch{return e}})}function Tr(t){return t.namespaceURI===A&&yo.has(t.localName)}function Er(t){let e=t.localName;return t[S]===Z&&(e==="foreignObject"||e==="desc"||e==="title")}function To(t,e){if(Eo.includes(`|${t}|`))return!0;if(t!=="font")return!1;for(let n of e.matchAll(Nr))if(No.test(n[1]))return!0;return!1}function Ut(t,e){let n=e.ownerDocument,r=n.createDocumentFragment(),o=[],s=r;for(let i of t.matchAll(bo)){let a=i[1];if(a){let c=i[2],u=G(a),m=o[o.length-1]?.element??e,h=m[S]===Z?Z:A;if(u==="svg")h=Z;else if(h===Z){if(Er(m))h=A;else if(To(u,c)){for(;o.length>0;){let O=o[o.length-1];if(O.element[S]!==Z||Er(O.element))break;o.pop(),s=O.target}h=A}}let g=h===A?u:a,y=n[ke](g,h,null,g);for(let O of c.matchAll(Nr))y.setAttribute(O[1],br(O[3]||O[4]||""));if(s.append(y),Tr(y)||h!==A&&i[4])continue;o.push({element:y,target:s}),s=h===A&&u==="template"?y.content:y}else if(i[5]){let c=G(i[5]);for(let u=o.length-1;u>=0;u--){let m=o[u],h=G(m.element[v]);if(h===c){s=m.target,o.length=u;break}if(m.element[S]===A&&h==="template")break}}else i[6]?s.append(n.createComment(i[6])):s.append(br(i[7]))}return r}function Vt(t){return xr([{type:"content",child:t[R]}])}function wr(t){return xr([{type:"opening",node:t}])}function xr(t){let e=[],n;for(;n=t.pop();)switch(n.type){case"opening":{let r=n.node;switch(r.nodeType){case X:{let o=r;e.push(`<${o[v]}`);let s=o[ne]?.[R];for(;s;){e.push(` ${s[v]}`);let a=s[de];a!==""&&(a=String(a).replace(/&/g,"&amp;").replace(/"/g,"&quot;"),e.push(`="${a}"`)),s=s[p]}if(e.push(">"),Tr(o))break;let i=o.namespaceURI===A&&o.localName==="template"?o[se]:o;t.push({type:"closing",name:o[v]}),t.push({type:"content",child:i?.[R]??null});break}case Ie:{let o=r;e.push(o[K].replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"));break}case Me:{let o=r;e.push(`<!--${o[K]}-->`);break}}break}case"content":{let r=n.child;r&&(t.push({type:"content",child:r[p]}),t.push({type:"opening",node:r}));break}case"closing":e.push(`</${n.name}>`);break}return e.join("")}var H=class extends re{nodeType=X;[S]=A;[ue]=null;get namespaceURI(){return this[S]}get prefix(){return this[ue]}get localName(){let e=this[ue];return e==null?this[v]:this[v].slice(e.length+1)}get nodeName(){return this[S]===A?Zn(this[v]):this[v]}get tagName(){return this.nodeName}get id(){return this.getAttributeNS(null,"id")??""}set id(e){this.setAttribute("id",String(e))}get slot(){return this.getAttributeNS(null,"slot")??""}set slot(e){let n=String(e);this.getAttributeNS(null,"slot")!==n&&this.attributes.setNamedItem(new ve("slot",n))}get attributes(){let e=this[ne];return e||(e=new Ht(this),this[ne]=e),e}getAttributeNames(){return[...this.attributes].map(e=>e.name)}getElementsByTagName(e){return kt(this,e)}get firstElementChild(){return this.children[0]??null}getElementsByClassName(e){return Pt(this,e)}get lastElementChild(){return this.children[this.children.length-1]??null}get nextElementSibling(){let e=this.nextSibling;for(;e&&e.nodeType!==1;)e=e.nextSibling;return e}get previousElementSibling(){let e=this.previousSibling;for(;e&&e.nodeType!==1;)e=e.previousSibling;return e}setAttribute(e,n){let r=String(e),o=String(n);fn(r);let s=this[S]===A?G(r):r,i=this.attributes.getNamedItemNS(null,s);i?i.value=o:this.attributes.setNamedItem(new ve(s,o))}setAttributeNS(e,n,r){let o=ie(e),s=String(n),i=String(r),a=pt(o,s,"attribute"),c=this.attributes.getNamedItemNS(a.namespace,a.localName);c?c.value=i:this.attributes.setNamedItemNS(new ve(a.qualifiedName,i,a.namespace))}toggleAttribute(e,n){let r=String(e);fn(r);let o=this[S]===A?G(r):r,s=this.attributes.getNamedItemNS(null,o),i=n===void 0?void 0:!!n;return s==null?i===!1?!1:(this.attributes.setNamedItem(new ve(o,"")),!0):i===!0?!0:(this.attributes.removeNamedItemNS(null,o),!1)}getAttribute(e){let n=this.attributes.getNamedItem(e);return n&&n.value}getAttributeNS(e,n){let r=this.attributes.getNamedItemNS(e,n);return r&&r.value}hasAttribute(e){return this.attributes.getNamedItem(e)!=null}hasAttributeNS(e,n){return this.attributes.getNamedItemNS(e,n)!=null}removeAttribute(e){let n=String(e),r=this[S]===A?G(n):n;this.attributes.removeNamedItemNS(null,r)}removeAttributeNS(e,n){this.attributes.removeNamedItemNS(e,n)}get outerHTML(){return wr(this)}get innerHTML(){return Vt(this)}set innerHTML(e){if(e==null||e==="")this.replaceChildren();else{let n=Ut(String(e),this);this.replaceChildren(n)}}};var Le=class t extends H{[S]=Z;get ownerSVGElement(){let e=null,n=this.parentNode;for(;n instanceof t;)e=n,n=n.parentNode;return e}};var ge=class extends he{[K]="";constructor(e){super(),this[K]=e==null?"":String(e)}setData(e){let n=kn,r=n?this[K]:null,o="";e!=null&&(o=typeof e=="string"?e:String(e)),this[K]=o,n&&r!==o&&te({type:"characterData",target:this,oldValue:r}),this[D].setText?.(this,o)}get data(){return this[K]}set data(e){this.setData(e)}};var Ge=class extends ge{nodeType=Ie;[v]="#text"};var He=class extends ge{nodeType=Me;[v]="#comment"};var Ue=class extends re{nodeType=fe;[v]="#document-fragment";[I]=typeof window<"u"?window.document:null;getElementById(e){return _t(this,e)}};var Ve=class extends H{get content(){let e=this[se];return e||(e=this.ownerDocument.createDocumentFragment(),e[me]=this,this[se]=e),e}set content(e){}set innerHTML(e){this.content.replaceChildren(Ut(String(e),this))}get innerHTML(){let e=this[se];return e?Vt(e):""}};var Bt=class extends H{};var zt=class extends H{};var jt=class extends H{};var ct=class extends re{nodeType=Te;[v]="#document";[U]=!0;constructor(e){super(),this.defaultView=e,this[I]=this,this.documentElement=qt(new jt,this,"html"),this.body=qt(new Bt,this,"body"),this.head=qt(new zt,this,"head"),this.appendChild(this.documentElement),this.documentElement.appendChild(this.head),this.documentElement.appendChild(this.body)}get textContent(){return null}set textContent(e){}getElementsByClassName(e){return Pt(this,e)}createElement(e){let n=String(e);return er(n),Cn(this,G(n))}createElementNS(e,n){let r=pt(e,n,"element");return Cn(this,r.qualifiedName,r.namespace,r.prefix,r.localName)}[ke](e,n,r,o){return Cn(this,e,n,r,o)}createTextNode(e){let n=Ft(new Ge(e),this);return this[D].createText?.(n,n.data),n}createComment(e){return Ft(new He(e),this)}createDocumentFragment(){return Ft(new Ue,this)}createEvent(){return new V("")}getElementById(e){return _t(this,e)}getElementsByTagName(e){return kt(this,e)}importNode(e,n){if(e.nodeType===Te)throw k("Cannot import a document node","NotSupportedError");return At(e,n,this)}adoptNode(e){if(e[I]===this)return e;let n=Rt(e);return B(()=>{let r=e.parentNode;return r?gr(r,e,n,this):ot(n.nodes,this),e})}};function Ft(t,e){return Object.defineProperty(t,I,{value:e,writable:!0,enumerable:!1}),t}function Cn(t,e,n=A,r=null,o=e){let s;if(n===Z)s=new Le;else if(n===A&&o==="template")s=new Ve;else if(n===A){let i=t.defaultView.customElements.get(o);s=i?new i:new H}else s=new H;return qt(s,t,e,n,r)}function qt(t,e,n,r=A,o=null){return Ft(t,e),Object.defineProperties(t,{[v]:{value:n},[S]:{value:r},[ue]:{value:o}}),e[D].createElement?.(t,r),t}var Yt=class extends V{constructor(e,n){super(e,n),this.detail=n?.detail??null}initCustomEvent(e,n,r,o){super.initEvent(e,n,r),this.detail=o??null}};var Wt=class extends V{constructor(e,n){super(e,n),this.message=n.message,this.filename=n.filename,this.lineno=n.lineno,this.colno=n.colno,this.error=n.error}};var Xt=class extends V{constructor(e,n){super(e,n),this.promise=n.promise,this.reason=n.reason}};var $t=class extends V{constructor(e,n){super(e,n),this.oldState=n.oldState,this.newState=n.newState}};var Kt=class extends V{constructor(e,n={}){super(e,n),this.relatedTarget=n.relatedTarget??null}};var Zt=class extends V{constructor(e,n={}){super(e,n),this.clipboardData=n.clipboardData??null}};var Qt=class extends H{};var wo=/^[a-z][^A-Z\\u0000\\t\\n\\f\\r />]*-[^A-Z\\u0000\\t\\n\\f\\r />]*$/u,xo=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function vr(t){return wo.test(t)&&!xo.has(t)}function Sr(t){return k(`Invalid custom element name: "${t}"`,"SyntaxError")}var Jt=class{registry=new Map;listenersByName=new Map;define(e,n,r){if(!vr(e))throw Sr(e);if(this.registry.has(e))throw k(`A custom element named "${e}" has already been defined`,"NotSupportedError");if(this.getName(n)!=null)throw k("This constructor has already been registered in this custom element registry","NotSupportedError");this.registry.set(e,n);let o=this.listenersByName.get(e);if(o!=null){this.listenersByName.delete(e);for(let s of o)s(n)}}get(e){return this.registry.get(e)}getName(e){for(let[n,r]of this.registry)if(r===e)return n;return null}whenDefined(e){if(!vr(e))return Promise.reject(Sr(e));let n=this.registry.get(e);if(n!=null)return Promise.resolve(n);let r=this.listenersByName.get(e);return r==null&&(r=[],this.listenersByName.set(e,r)),new Promise(o=>{r.push(o)})}upgrade(e){}initialize(e){}};var vo=["onerror","onunhandledrejection"],Rr=Symbol.for("@remote-dom/polyfill/global-property");function Ar(t){return Object.getOwnPropertyDescriptors(t)}function _r(t){let e={};for(let[n,r]of Object.entries(Object.getOwnPropertyDescriptors(pe.prototype)))n!=="constructor"&&typeof r.value=="function"&&(r.value=In(r.value.bind(t)),e[n]=r);return e}function Pr(t){let e={};for(let n of vo)e[n]={configurable:!0,enumerable:!0,get:In(()=>t[n]),set:In(r=>{t[n]=r})};return e}function So(t){return Object.assign(Ar(t),_r(t),Pr(t))}function In(t){return Object.defineProperty(t,Rr,{value:!0}),t}function Or(t,e){for(let n of Reflect.ownKeys(e)){let r=Oo(t,n);(r==null||Ro(r))&&Object.defineProperty(t,n,e[n])}}function Oo(t,e){let n=t;for(;n;){let r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Object.getPrototypeOf(n)}}function Ro(t){return[t.value,t.get,t.set].some(e=>typeof e=="function"&&e[Rr]===!0)}var Se=class extends pe{[D]={};[mt]=[];[Ne]=_o(this);name="";window=this;parent=this;self=this;top=this;document=new ct(this);customElements=new Jt;location=globalThis.location;navigator=globalThis.navigator;Event=V;ErrorEvent=Wt;PromiseRejectionEvent=Xt;ToggleEvent=$t;FocusEvent=Kt;ClipboardEvent=Zt;EventTarget=pe;CustomEvent=Yt;Node=J;ParentNode=re;ChildNode=he;DocumentFragment=Ue;Document=ct;CharacterData=ge;Comment=He;Text=Ge;Element=H;HTMLElement=Qt;SVGElement=Le;HTMLTemplateElement=Ve;MutationObserver=Dt;#t=null;#n=null;#e=null;static with(...e){let n=this;return class extends n{constructor(){super();for(let o of e)Ao(this,o)}}}get onerror(){return this.#n}set onerror(e){this.#t&&this.removeEventListener("error",this.#t),e&&typeof e=="function"?(this.#n=e,this.#t=n=>{e(n.message??"Error",n.filename,n.lineno,n.colno,n.error)},this.addEventListener("error",this.#t)):(this.#t=null,this.#n=null)}get onunhandledrejection(){return this.#e}set onunhandledrejection(e){this.#e&&this.removeEventListener("unhandledrejection",this.#e),e&&typeof e=="function"?(this.#e=e,this.addEventListener("unhandledrejection",this.#e)):this.#e=null}static setGlobal(e){let n=globalThis.self,r=globalThis.window,o=Ar(e),s=Object.assign(_r(e),Pr(e));delete o.self,Object.defineProperties(globalThis,o),Or(globalThis,s),typeof n>"u"||n===r&&n!==globalThis?Object.defineProperty(globalThis,"self",{value:e,configurable:!0,writable:!0,enumerable:!0}):n!==globalThis&&(Object.defineProperties(n,o),Or(n,s))}static setGlobalThis(e){for(let n in e)e[n]===e&&(e[n]=globalThis);Object.defineProperties(globalThis,So(e))}};function Ao(t,e){t[mt].push(e(t)??{})}function _o(t){return{createElement:le.bind(null,t,"createElement"),setAttribute:le.bind(null,t,"setAttribute"),removeAttribute:le.bind(null,t,"removeAttribute"),createText:le.bind(null,t,"createText"),setText:le.bind(null,t,"setText"),insertChild:le.bind(null,t,"insertChild"),removeChild:le.bind(null,t,"removeChild"),addEventListener:le.bind(null,t,"addEventListener"),removeEventListener:le.bind(null,t,"removeEventListener")}}function le(t,e,...n){for(let s of t[mt])s[e]?.apply(s,n);let r=t[D];r[e]?.apply(r,n)}var en=new Se;var Mn="~";var ye=new WeakMap;function Be(t){return ye.get(t)}var Hn=new WeakMap,ko=0;function $(t){let e=Hn.get(t);return e==null&&(e=String(ko++),tn(t,e)),e}function tn(t,e){Hn.set(t,e)}var Ln=new WeakMap;function Co(t){return Ln.get(t)}var Gn=new WeakMap;function Io(t){let e=Gn.get(t);if(e!=null)return e;if(!(!(t instanceof Element)||t.tagName.includes("-"))){e={};for(let{name:n,value:r}of t.attributes)e[n]=r;return e}}var Mo=new WeakMap;function Do(t){return Mo.get(t)}function Un(t,e,n){let r=Ln.get(t);if(r==null&&(r={},Ln.set(t,r)),r[e]===n)return;r[e]=n;let o=ye.get(t);o?.mutate([[3,$(t),e,n,1]])}function be(t,e,n){let r=Gn.get(t);if(r==null&&(r={},Gn.set(t,r)),r[e]===n)return;n==null?delete r[e]:r[e]=String(n);let o=ye.get(t);o?.mutate([[3,$(t),e,n,2]])}function ze(t,e){if(ye.get(t)!==e&&(ye.set(t,e),t.childNodes))for(let r=0;r<t.childNodes.length;r++)ze(t.childNodes[r],e)}function nn(t){if(ye.get(t)!=null&&(ye.delete(t),t.childNodes))for(let n=0;n<t.childNodes.length;n++)nn(t.childNodes[n])}function je(t){let{nodeType:e}=t;switch(e){case 1:return{id:$(t),type:e,element:t.localName,properties:Dn(Co(t)),attributes:Dn(Io(t)),eventListeners:Dn(Do(t)),children:Array.from(t.childNodes).map(je)};case 3:case 8:return{id:$(t),type:e,data:t.data};default:throw new Error(`Cannot serialize node of type ${t.nodeType} (${typeof t.nodeType})`)}}function Dn(t){return t?{...t}:void 0}function Vn(t,e,...n){let r=Hn.get(t),o=ye.get(t);if(r==null||o==null)throw new Error(`Cannot call method ${e} on an unconnected node`);return o.call(r,e,...n)}var Fe=en[D];Fe.insertChild=(t,e,n)=>{let r=Be(t);r!=null&&(ze(e,r),r.mutate([[0,$(t),je(e),n]]))};Fe.removeChild=(t,e,n)=>{let r=Be(t);r!=null&&(nn(e),r.mutate([[1,$(t),n]]))};Fe.setText=(t,e)=>{let n=Be(t);n?.mutate([[2,$(t),e]])};Fe.setAttribute=(t,e,n)=>{t.tagName.includes("-")||be(t,e,n)};Fe.removeAttribute=(t,e)=>{t.tagName.includes("-")||be(t,e)};Se.setGlobal(en);function rn(t){if(typeof t=="string")return{type:"navigate",to:t};let{place:e,record:n,where:r,section:o}=t??{},s={...r===void 0?{}:{where:r},...o===void 0?{}:{section:String(o)}};return typeof e=="string"?{type:"navigate",place:e,...s}:typeof n=="string"?{type:"navigate",to:n,...s}:void 0}var Cr=["wheel","drag","pinch"];function Ir(t){let e=t;return typeof t=="object"&&t!==null&&e.graview==="host-hello"&&typeof e.nonce=="string"}function Dr(t,e={}){let n,r="",o,s=0,i=new Set,a=new Map,c=[],u=E=>{n?n.postMessage({...E,nonce:r}):c.push(E)},m=E=>{let N=E.data;if(!(!N||typeof N!="object")){if(N.type==="props"){o=N.props;for(let C of i)C(N.props)}else N.type==="answer"?(a.get(N.id)?.(N),a.delete(N.id)):N.type==="event"&&typeof N.listener=="number"?e.onEvent?.(N):N.type==="heartbeat"&&typeof N.beat=="number"&&u({type:"heartbeat",beat:N.beat});e.onMessage?.(N)}},h=()=>{},g=E=>{if(n||!t.fromHost(E)||!Ir(E.data)||E.data.protocol!==1)return;let N=E.ports[0];if(N){n=N,r=E.data.nonce,n.onmessage=m,n.start?.(),h();for(let C of c.splice(0))u(C)}};h=t.listen(g),t.ready({graview:"guest-ready",protocol:1});let y,O={get props(){return o},subscribe(E){return i.add(E),()=>i.delete(E)},act(E,N={}){let C=s+=1;return new Promise(L=>{a.set(C,L),u({type:"act",id:C,name:E,args:N})})},navigate(E){let N=rn(E);N&&u(N)},size(E){u({type:"size",height:E})},autoSize(E){let N=E??globalThis.document?.documentElement,C=globalThis.ResizeObserver;if(!N||!C||typeof N.getBoundingClientRect!="function")return()=>{};y?.disconnect();let L=new C(()=>O.size(Math.ceil(N.getBoundingClientRect().height)));return L.observe(N),y=L,()=>L.disconnect()},close(){y?.disconnect(),h(),n?.close(),i.clear()}};return{guest:O,send:u}}var Gr=["globalThis","Infinity","NaN","undefined","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape","Object","Function","Array","Number","Boolean","String","Symbol","BigInt","Date","Promise","RegExp","Math","JSON","Reflect","Proxy","Intl","Error","AggregateError","EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError","SuppressedError","Map","Set","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Iterator","AsyncIterator","DisposableStack","AsyncDisposableStack","ArrayBuffer","SharedArrayBuffer","DataView","Atomics","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float16Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"],Hr=["window","parent","top","document","customElements","Event","ErrorEvent","PromiseRejectionEvent","ToggleEvent","FocusEvent","ClipboardEvent","CustomEvent","EventTarget","Node","ParentNode","ChildNode","DocumentFragment","Document","CharacterData","Comment","Text","Element","HTMLElement","SVGElement","HTMLTemplateElement","MutationObserver"],Ur=["self","postMessage","setTimeout","clearTimeout","setInterval","clearInterval","queueMicrotask","structuredClone","crypto","console","DOMException"],Vr=["TEMPORARY","PERSISTENT"],fl=Object.freeze([...Gr,...Hr,...Ur,...Vr]),pl=Object.freeze(["constructor","__defineGetter__","__defineSetter__","hasOwnProperty","__lookupGetter__","__lookupSetter__","isPrototypeOf","propertyIsEnumerable","toString","valueOf","__proto__","toLocaleString"]),Lr=t=>typeof t=="symbol"?`[${t.description??"symbol"}]`:t;function Br(t=globalThis,e=[],n={}){let r=[],o=[],s=new Set([...Gr,...Hr,...Ur,...e,"constructor",Symbol.toStringTag]),i=(x,P)=>{let F=Reflect.getOwnPropertyDescriptor(x,P);return F===void 0||!("value"in F)||F.writable||F.configurable?!1:n.primitivesStay&&typeof P=="symbol"&&(typeof F.value!="object"||F.value===null)&&typeof F.value!="function"?!0:Vr.includes(P)&&typeof F.value=="number"},a=t,c=a.setTimeout,u=a.setInterval,m=a.crypto,h=(x,P)=>function(F,Ye,...dt){if(typeof F!="function")throw new TypeError(`${P} takes a function: a guest view cannot run code from text`);return x.call(t,F,Ye,...dt)},g=m?Object.freeze({getRandomValues:x=>m.getRandomValues(x)}):void 0,y=a.document?.defaultView;if(y&&y!==a)for(let x of Reflect.ownKeys(y))typeof x=="symbol"||s.has(x)||Reflect.deleteProperty(y,x)||o.push(`window.${x}`);let O=[];for(let x=t;x&&x!==Object.prototype;x=Object.getPrototypeOf(x))O.push(x);for(let x of O)for(let P of Reflect.ownKeys(x))s.has(P)||(Reflect.deleteProperty(x,P)?r.push(Lr(P)):i(x,P)||o.push(Lr(P)));let E=()=>function(){throw new EvalError("A guest view cannot make code from text.")},N=[Function.prototype,Object.getPrototypeOf(async function(){}),Object.getPrototypeOf(function*(){}),Object.getPrototypeOf(async function*(){})];for(let x of N){let P=E();Object.defineProperty(P,"prototype",{value:x,writable:!1,enumerable:!1,configurable:!1}),Reflect.defineProperty(x,"constructor",{value:P,writable:!1,enumerable:!1,configurable:!1})||o.push("Function.prototype.constructor"),x===Function.prototype&&Reflect.defineProperty(t,"Function",{value:P,writable:!0,enumerable:!1,configurable:!0})}let C=(x,P)=>{Reflect.defineProperty(t,x,{value:P,writable:!0,enumerable:!0,configurable:!0})||o.push(x)};C("setTimeout",h(c,"setTimeout")),C("setInterval",h(u,"setInterval")),g&&C("crypto",g);for(let x of O.slice(1))Object.freeze(x);for(let x of Reflect.ownKeys(t)){let P=Reflect.getOwnPropertyDescriptor(t,x);Reflect.defineProperty(t,x,"value"in P?{...P,writable:!1,configurable:!1}:{...P,configurable:!1})}let L;try{L=Reflect.preventExtensions(t)}catch{L=!1}return{removed:r,stuck:o,sealed:L}}var ut=class extends HTMLElement{constructor(){super(),tn(this,Mn)}connect(e){if(Be(this)===e||(ze(this,e),this.childNodes.length===0))return;let n=[];for(let r=0;r<this.childNodes.length;r++){let o=this.childNodes[r];n.push([0,Mn,je(o),r])}e.mutate(n)}updateRemoteProperty(e,n){Un(this,e,n)}callRemoteMethod(e,...n){return Vn(this,e,...n)}};var d={},on={empty:!0},Lo={id:"text",class:"text",title:"text",lang:"text",dir:{oneOf:["ltr","rtl","auto"]},hidden:"text",tabindex:{oneOf:["-1","0"]},role:"text",style:"style",translate:{oneOf:["yes","no"]},spellcheck:{oneOf:["true","false"]},draggable:{oneOf:["true","false"]},inert:"boolean"},Bn={div:d,section:d,article:d,aside:d,header:d,footer:d,nav:d,hgroup:d,search:d,address:d,figure:d,figcaption:d,blockquote:d,p:d,pre:d,hr:on,br:on,wbr:on,h1:d,h2:d,h3:d,h4:d,h5:d,h6:d,span:d,strong:d,em:d,b:d,i:d,u:d,s:d,small:d,mark:d,abbr:d,cite:d,q:d,code:d,kbd:d,samp:d,var:d,sub:d,sup:d,dfn:d,bdi:d,bdo:d,ruby:d,rt:d,rp:d,time:{attributes:{datetime:"text"}},data:{attributes:{value:"text"}},del:{attributes:{datetime:"text"}},ins:{attributes:{datetime:"text"}},a:{attributes:{href:"link"}},ul:d,menu:d,dl:d,dt:d,dd:d,ol:{attributes:{start:"number",reversed:"boolean",type:{oneOf:["1","a","A","i","I"]}}},li:{attributes:{value:"number"}},table:d,caption:d,thead:d,tbody:d,tfoot:d,tr:d,colgroup:{attributes:{span:"number"}},col:{attributes:{span:"number"},empty:!0},th:{attributes:{colspan:"number",rowspan:"number",headers:"text",scope:{oneOf:["row","col","rowgroup","colgroup"]},abbr:"text"}},td:{attributes:{colspan:"number",rowspan:"number",headers:"text"}},details:{attributes:{open:"boolean",name:"text"}},summary:d,button:{attributes:{type:{oneOf:["button"]},disabled:"boolean",name:"text",value:"text"}},input:{empty:!0,attributes:{type:{oneOf:["text","search","number","range","checkbox","radio","date","time","datetime-local","month","week","color","email","tel","url"]},name:"text",value:"text",placeholder:"text",min:"text",max:"text",step:"text",checked:"boolean",disabled:"boolean",readonly:"boolean",required:"boolean",maxlength:"number",minlength:"number",size:"number",pattern:"text",multiple:"boolean",inputmode:"text",enterkeyhint:"text"}},select:{attributes:{name:"text",disabled:"boolean",multiple:"boolean",required:"boolean",size:"number"}},option:{attributes:{value:"text",selected:"boolean",disabled:"boolean",label:"text"}},optgroup:{attributes:{label:"text",disabled:"boolean"}},textarea:{attributes:{name:"text",placeholder:"text",rows:"number",cols:"number",disabled:"boolean",readonly:"boolean",required:"boolean",maxlength:"number",minlength:"number",wrap:{oneOf:["soft","hard","off"]}}},label:{attributes:{for:"text"}},fieldset:{attributes:{disabled:"boolean",name:"text"}},legend:d,output:d,meter:{attributes:{value:"number",min:"number",max:"number",low:"number",high:"number",optimum:"number"}},progress:{attributes:{value:"number",max:"number"}},img:{empty:!0,attributes:{src:"image",alt:"text",width:"number",height:"number",decoding:{oneOf:["async","sync","auto"]}}},"graview-video":on},Go=["fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray","stroke-dashoffset","stroke-opacity","stroke-miterlimit","opacity","color","display","visibility","transform-origin","clip-path","clip-rule","marker-start","marker-mid","marker-end","font-family","font-size","font-weight","font-style","text-anchor","dominant-baseline","alignment-baseline","letter-spacing","text-decoration","paint-order","vector-effect","shape-rendering","pointer-events","stop-color","stop-opacity","overflow","mask"],Ho={id:"text",class:"text",style:"style",lang:"text",role:"text",tabindex:{oneOf:["-1","0"]},transform:"geometry",...Object.fromEntries(Go.map(t=>[t,"css"]))},qe={x:"geometry",y:"geometry",width:"geometry",height:"geometry"},sn={viewBox:"geometry",preserveAspectRatio:"geometry"},zr={gradientUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]},gradientTransform:"geometry",spreadMethod:{oneOf:["pad","reflect","repeat"]},href:"fragment"},jr={svg:{attributes:{...qe,...sn}},g:d,defs:d,symbol:{attributes:{...qe,...sn,refX:"geometry",refY:"geometry"}},use:{attributes:{...qe,href:"fragment"}},title:d,desc:d,path:{attributes:{d:"geometry",pathLength:"number"}},rect:{attributes:{...qe,rx:"geometry",ry:"geometry",pathLength:"number"}},circle:{attributes:{cx:"geometry",cy:"geometry",r:"geometry",pathLength:"number"}},ellipse:{attributes:{cx:"geometry",cy:"geometry",rx:"geometry",ry:"geometry",pathLength:"number"}},line:{attributes:{x1:"geometry",y1:"geometry",x2:"geometry",y2:"geometry",pathLength:"number"}},polyline:{attributes:{points:"geometry",pathLength:"number"}},polygon:{attributes:{points:"geometry",pathLength:"number"}},text:{attributes:{x:"geometry",y:"geometry",dx:"geometry",dy:"geometry",rotate:"geometry",textLength:"geometry",lengthAdjust:{oneOf:["spacing","spacingAndGlyphs"]}}},tspan:{attributes:{x:"geometry",y:"geometry",dx:"geometry",dy:"geometry",rotate:"geometry",textLength:"geometry"}},textPath:{attributes:{href:"fragment",startOffset:"geometry",method:{oneOf:["align","stretch"]},spacing:{oneOf:["auto","exact"]},side:{oneOf:["left","right"]}}},linearGradient:{attributes:{x1:"geometry",y1:"geometry",x2:"geometry",y2:"geometry",...zr}},radialGradient:{attributes:{cx:"geometry",cy:"geometry",r:"geometry",fx:"geometry",fy:"geometry",fr:"geometry",...zr}},stop:{attributes:{offset:"geometry"}},clipPath:{attributes:{clipPathUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]}}},mask:{attributes:{...qe,maskUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]},maskContentUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]}}},pattern:{attributes:{...qe,...sn,patternUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]},patternContentUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]},patternTransform:"geometry",href:"fragment"}},marker:{attributes:{...sn,markerWidth:"geometry",markerHeight:"geometry",refX:"geometry",refY:"geometry",orient:"geometry",markerUnits:{oneOf:["strokeWidth","userSpaceOnUse"]}}}};var Fr={section:["aria-label","aria-labelledby","title"]};function Uo(t){return/^aria-[a-z]+$/.test(t)}function Vo(t){return/^data-[a-z0-9][a-z0-9_.-]*$/.test(t)}var Bo=new Map(Object.keys(jr).map(t=>[t.toLowerCase(),t]));function qr(t){return Bo.get(t.toLowerCase())}function Yr(t,e,n){let r=n.toLowerCase(),o=t==="html"?[Bn[e]?.attributes,Lo]:[jr[e]?.attributes,Ho],s=t==="svg"&&r==="xlink:href"?"href":r;for(let i of o)if(i){for(let[a,c]of Object.entries(i))if(a.toLowerCase()===s)return{name:a,kind:c}}if(Uo(r)||Vo(r))return{name:r,kind:"text"}}var Wr="~",an=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),oe=(t,e=0)=>{if(t===null||typeof t=="string"||typeof t=="number"||typeof t=="boolean"||t===void 0)return t;if(!(e>64||typeof t!="object"))return Array.isArray(t)?t.map(n=>oe(n,e+1)):Object.fromEntries(Object.entries(t).map(([n,r])=>[n,oe(r,e+1)]))};function Xr(){let t=new Map,e=new Map,n=new Map([[Wr,{children:[],listeners:new Map}]]),r=0,o=u=>{let m=e.get(u);return m===void 0&&(m=r+=1,e.set(u,m),t.set(m,{listener:u,count:0})),t.get(m).count+=1,m},s=u=>{let m=t.get(u);m&&(m.count-=1,!(m.count>0)&&(t.delete(u),e.delete(m.listener)))},i=u=>{let m=n.get(u);if(m){n.delete(u);for(let h of m.listeners.values())s(h);for(let h of m.children)i(h)}},a=(u,m,h=0)=>{if(!an(u)||h>64)return oe(u);let g=typeof u.id=="string"?u.id:void 0,y=m&&g!==void 0&&g!==Wr;y&&i(g);let O={children:[],listeners:new Map};y&&n.set(g,O);let E={};for(let[N,C]of Object.entries(u))N==="children"&&Array.isArray(C)?E[N]=C.map(L=>{let x=a(L,y,h+1);return y&&an(L)&&typeof L.id=="string"&&O.children.push(L.id),x}):N==="eventListeners"&&an(C)?E[N]=Object.fromEntries(Object.entries(C).map(([L,x])=>{if(typeof x!="function"||!y)return[L,void 0];let P=o(x);return O.listeners.set(L,P),[L,{listener:P}]})):E[N]=oe(C,h+1);return E},c=u=>{if(!Array.isArray(u))return oe(u);let[m,h]=u,g=typeof h=="string"?n.get(h):void 0;if(m===0){let y=a(u[2],g!==void 0),O=an(u[2])?u[2].id:void 0;if(g&&typeof O=="string"&&n.has(O)){let E=Number(u[3]);g.children.splice(Number.isInteger(E)&&E>=0&&E<=g.children.length?E:g.children.length,0,O)}return[m,oe(h),y,oe(u[3])]}if(m===1){let y=Number(u[2]);return g&&Number.isInteger(y)&&y>=0&&y<g.children.length&&i(g.children.splice(y,1)[0]),oe(u)}if(m===3&&u[4]===3){let y=String(u[2]),O=u[3],E=g&&typeof O=="function"?o(O):void 0,N=g?.listeners.get(y);return N!==void 0&&s(N),E===void 0?g?.listeners.delete(y):g.listeners.set(y,E),[m,oe(h),y,E===void 0?void 0:{listener:E},3]}return oe(u)};return{encode:u=>u.map(c),listener:u=>t.get(u)?.listener,get listening(){return t.size},get nodes(){return n.size-1}}}var ln="graview-view-root",zo=["value","checked","key","pressed","files","refused","x","y","width","height","deltaX","deltaY","deltaMode","ctrlKey","metaKey","phase","pointerId","button","pressure","dx","dy","scale","rotation"],jo=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/\'/g,"&#39;"),Fo=t=>Object.freeze({html:t,toString:()=>t}),$r=t=>typeof t=="object"&&t!==null&&typeof t.html=="string"&&Object.isFrozen(t),Kr=t=>t==null||t===!1?"":Array.isArray(t)?t.map(Kr).join(""):$r(t)?t.html:jo(String(t));function Zr(t){customElements.get(ln)||customElements.define(ln,ut);let e=Event,n=Xr(),r=new Set,o=new Set,s,i=[],a=new Set;for(let l of["closest","matches","dataset"]){let f=()=>{throw new TypeError(`A view\'s element has no ${l}: graview.on hands event.element, the element its selector matched; read event.element.getAttribute("data-\\u2026").`)};l in Element.prototype||Object.defineProperty(Element.prototype,l,l==="dataset"?{get:f}:{value:f})}let c=document.createElement(ln),u=l=>{let f=b=>{for(let w of Array.from(b.childNodes)){if(w.nodeType!==1)continue;if($(w)===l)return w;let T=f(w);if(T)return T}};return f(c)},m=l=>{let f=u(l.target);if(!f)return;let b=new e(l.event,{bubbles:!0}),w={};for(let T of zo)l[T]!==void 0&&(w[T]=l[T]);for(let T of Object.keys(w))Object.defineProperty(b,T,{value:w[T],enumerable:!0});f.dispatchEvent(b);for(let T of o){if(T.type!==l.event)continue;let _;try{_=new Set(Array.from(c.querySelectorAll(T.selector)))}catch{continue}for(let z=f;z&&z!==c;z=z.parentNode)if(_.has(z)){T.listener(Object.freeze({type:l.event,target:f,element:z,...w}));break}}},h=l=>{if(l.type==="dom-event"&&typeof l.target=="string")return m(l);if(l.type==="notice")return t.warn(l.text);if(l.type!=="props")return;s=l.props;let f=t.now();for(let T of r)try{T(l.props)}catch(_){t.threw(_)}let b=t.now()-f,w=l.push;typeof w=="number"&&t.microtask(()=>t.microtask(()=>t.send({type:"pushed",push:w,ms:b})))},g;c.connect({mutate(l){g||(g=[],t.microtask(()=>{let f=g??[];g=void 0,t.send({type:"render",records:n.encode(f)})})),g.push(...l)},call:()=>{}});let y=l=>l.nodeType===1?l.getAttribute("data-key")??l.getAttribute("id"):null,O=(l,f)=>l.nodeType===f.nodeType&&(l.nodeType!==1||l.localName===f.localName&&l.namespaceURI===f.namespaceURI&&y(l)===y(f));function E(l,f){let b=Array.from(f.childNodes),w=0;for(let T of b){let _=l.childNodes[w]??null;if(_&&O(_,T)){N(_,T),w+=1;continue}if(y(T)!==null){let ce=Array.from(l.childNodes).slice(w+1).find(We=>O(We,T));if(ce){l.insertBefore(ce,_),N(ce,T),w+=1;continue}}l.insertBefore(T,_),w+=1}for(;l.childNodes.length>w;)l.removeChild(l.lastChild)}function N(l,f){if(l.nodeType!==1){l.data!==f.data&&(l.data=f.data);return}let b=l,w=f,T=C(b);for(let _ of b.getAttributeNames())w.hasAttribute(_)||(b.removeAttribute(_),T&&be(b,_,void 0));for(let _ of w.getAttributeNames()){let z=w.getAttribute(_);b.getAttribute(_)!==z&&b.setAttribute(_,z),T&&be(b,_,z)}E(b,w)}let C=l=>l.localName.includes("-");function L(l){for(let f of Array.from(l.childNodes)){if(f.nodeType!==1)continue;let b=f;if(C(b))for(let w of b.getAttributeNames())be(b,w,b.getAttribute(w)??void 0);L(b)}}function x(l,f,b){for(let w of Array.from(l.childNodes)){if(w.nodeType!==1)continue;let T=w,_=T.localName,z=f||_.toLowerCase()==="svg",ce=z?qr(_):Object.prototype.hasOwnProperty.call(Bn,_.toLowerCase())?_.toLowerCase():void 0;if(!ce){b.add(`<${_}>`);continue}for(let We of T.getAttributeNames())(!Yr(z?"svg":"html",ce,We)||!z&&Fr[ce]?.includes(We.toLowerCase()))&&b.add(`${ce} ${We}`);x(T,z,b)}}function P(l){let f=document.createElement("div"),b=Array.isArray(l)?l:[l];for(let T of b)if(T!=null)if(typeof T=="string"||$r(T)){let _=document.createElement("div");_.innerHTML=typeof T=="string"?T:T.html,f.append(...Array.from(_.childNodes))}else f.append(T);let w=new Set;x(f,!1,w),i=[...w],i.length>0&&t.warn(`The host will not draw: ${i.join(", ")}`),L(f),E(c,f)}let F=[],Ye=new Set(Cr),dt="[]",cn=!1,qn=()=>{cn||(cn=!0,t.microtask(()=>{cn=!1;let l=[...new Map([...o].filter(b=>Ye.has(b.type)).map(b=>[`${b.type} ${b.selector}`,{event:b.type,selector:b.selector}])).entries()].sort(([b],[w])=>b<w?-1:b>w?1:0).map(([,b])=>b),f=JSON.stringify(l);f!==dt&&(dt=f,t.send({type:"gestures",bound:l}))}))},Yn="[]",un=!1,Wn=()=>{un||(un=!0,t.microtask(()=>{un=!1;let l=[...new Set([...o].filter(b=>b.type==="click"&&typeof b.selector=="string").map(b=>b.selector))].sort().slice(0,200),f=JSON.stringify(l);f!==Yn&&(Yn=f,t.send({type:"clicks",selectors:l}))}))};return{view:Object.freeze({get props(){return s},onProps(l){return r.add(l),s&&l(s),()=>void r.delete(l)},render:P,style(l){typeof l!="string"||F.includes(l)||(F.push(l),t.send({type:"style",sheets:[...F]}))},on(l,f,b){let w={type:l,selector:f,listener:b};return o.add(w),typeof l=="string"&&!a.has(l)&&(a.add(l),t.send({type:"hears",events:[l]})),Ye.has(l)&&qn(),l==="click"&&Wn(),()=>{o.delete(w),Ye.has(l)&&qn(),l==="click"&&Wn()}},act:(l,f={})=>t.act(l,f),navigate(l){if(typeof l=="string")return t.navigate(l);let f=rn(l);f&&t.send(f)},html(l,...f){return Fo(l.reduce((b,w,T)=>b+w+(T<f.length?Kr(f[T]):""),""))},get refused(){return i},get hardening(){return t.hardening()}}),hear:h,find:l=>{try{let f=c.querySelectorAll(l)[0];return f?$(f):void 0}catch{return}},listened:l=>{let f=new Set;for(let b of o)if(b.type===l)try{for(let w of Array.from(c.querySelectorAll(b.selector))){let T=$(w);T&&f.add(T)}}catch{}return[...f]}}}var Fn={removed:[],stuck:[],sealed:!1,worker:!1},zn=Dr({listen(t){return Re.listen(t),()=>Re.unlisten(t)},fromHost:()=>!0,ready:t=>Re.post(t)},{onMessage:t=>Qr.hear(t)}),Qr=Zr({send:t=>zn.send(t),act:(t,e)=>zn.guest.act(t,e),navigate:t=>zn.guest.navigate(t),microtask:Re.microtask,now:Re.now,threw:t=>console.error(t),warn:t=>console.warn(t),hardening:()=>Fn}),qo=Qr.view;Object.defineProperty(globalThis,"graview",{value:qo,enumerable:!0,configurable:!0,writable:!1});var jn="WorkerGlobalScope"in globalThis?Br(globalThis,["graview"]):Fn;Fn=jn;if(jn.stuck.length>0)throw new Error(`The view\'s worker could not be hardened: ${jn.stuck.join(", ")} would not go.`);})();\n';export{e as VIEW_RUNTIME};
@@ -1 +0,0 @@
1
- import{$ as d,G as h,Ma as u,aa as a,ca as c}from"./chunk.TMYGLXR6.js";import{b as l}from"./chunk.AJZBJBMO.js";var i=l(h(),1);function w(){let e=u();return(0,i.useMemo)(()=>[...new Set(e.flatMap(o=>o.nodeIds))],[e])}function S(){let e=g(),o=d();return(0,i.useMemo)(()=>{if(!o)return e;let n=o.matched;return n.length===0&&e.length===0?[m]:[...new Set([...e,...n])]},[o,e])}function g(){let{store:e,selection:o}=a(),n=c();return(0,i.useMemo)(()=>{if(o.length===0)return[];let r=new Set(o),s=new Set(r);for(let t of e.graph.allEdges())r.has(t.from)&&s.add(t.to),r.has(t.to)&&s.add(t.from);for(let t of e.violations())if(t.subjectId!==void 0&&r.has(t.subjectId))for(let f of t.nodeIds)s.add(f);return[...s]},[e,o,n])}var m="search:nothing";export{w as a,S as b,g as c};
@@ -1 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as y}from"./chunk.6KYWJXZR.js";import{D as v,G as I,T as h,aa as w}from"./chunk.TMYGLXR6.js";import{Ya as g}from"./chunk.P4CLT32V.js";import{b as d}from"./chunk.AJZBJBMO.js";var k=d(I(),1);var t=d(h(),1),r={display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem"};function E({shows:e,onShows:i,mine:a,onMine:l}){let o={all:"All",changes:"Changes",ai:"AI"};return(0,t.jsxs)("div",{"data-testid":"activity-filter",role:"group","aria-label":"Show",style:{display:"flex",flexWrap:"wrap",gap:4,alignItems:"center"},children:[["all","changes","ai"].map(s=>(0,t.jsx)("button",{type:"button","data-shows":s,"aria-pressed":e===s,onClick:()=>i(s),style:{...r,...e===s?{borderColor:"var(--graview-accent)",color:"var(--graview-ink)"}:{}},children:o[s]},s)),(0,t.jsx)("button",{type:"button","data-testid":"activity-mine","aria-pressed":a,onClick:()=>l(!a),style:{...r,marginLeft:"auto",...a?{borderColor:"var(--graview-accent)",color:"var(--graview-ink)"}:{}},children:"Just mine"})]})}var x=e=>e.ask.kind==="suggest"?"suggest":e.ask.kind==="fill"?"fill in":e.ask.kind==="record"?"add one":e.ask.kind==="panel"?"draw a panel":`answer \u201C${e.ask.said}\u201D`;function $(e){let i=e.offered.filter(a=>e.accepted?.includes(a.id)).map(a=>a.label);switch(e.outcome){case"accepted":return i.length>0?`Took ${i.join(", ")}`:"Taken";case"partly":return`Took ${i.length} of ${e.offered.length}: ${i.join(", ")}`;case"dismissed":return"Dismissed";case"drawn":return e.panel?`Drew \u201C${e.panel.title}\u201D`:"Drew a panel";case"failed":return e.failed??"Failed";default:return"Offered, not yet taken"}}function C(e){let i=[...new Set((e.usage??[]).map(o=>o.model))];if(i.length===0)return null;let a=(e.usage??[]).flatMap(o=>o.costUsd===void 0?[]:[o.costUsd]),l=a.length>0?a.reduce((o,s)=>o+s,0):void 0;return`${i.join(", ")}${l!==void 0?` \xB7 $${l<.01?l.toPrecision(2):l.toFixed(2)}`:""}`}function F({entry:e,undo:i}){let{store:a,principal:l,seats:o,people:s,ai:b}=w(),c=y(),[p,u]=(0,k.useState)(!1),A=e.by.kind==="human"&&e.by.onBehalfOf===void 0&&(e.by.id===void 0||l.id===void 0||e.by.id===l.id)?"you":g(e.by,{graph:a.graph,schema:a.schema,seats:o,people:s}),f=C(e),S=v(b),m=n=>{u(!0),(__graviewPreload(import.meta.url,["./chunk.R5R7CLOU.js","./chunk.3TVAE7LE.js","./chunk.JX2C3HVD.js","./chunk.3MU37W5D.js","./chunk.XOZU4OFA.js","./chunk.Z7N3MJ36.js","./chunk.6KYWJXZR.js","./chunk.TI4OSTQV.js","./chunk.ACB4TD4W.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.QPAJCRFB.js")).then(n).finally(()=>u(!1))};return(0,t.jsxs)("li",{"data-testid":"activity-interaction","data-interaction":e.id,"data-outcome":e.outcome,style:{display:"grid",gap:3,lineHeight:1.45},children:[(0,t.jsx)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:(0,t.jsxs)("span",{style:{minWidth:0},children:[(0,t.jsx)("strong",{style:{fontWeight:600},children:A})," ",(0,t.jsxs)("span",{style:{color:"var(--graview-ink-muted)"},children:["asked AI to ",x(e)]}),(0,t.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",e.targetLabel]})]})}),e.offered.length>0&&e.outcome!=="accepted"&&e.outcome!=="partly"?(0,t.jsxs)("div",{"data-testid":"interaction-offered",style:{color:"var(--graview-ink-muted)"},children:["Offered ",e.offered.map(n=>n.label).join(", ")]}):null,(0,t.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6,flexWrap:"wrap"},children:[(0,t.jsx)("span",{"data-testid":"interaction-outcome",style:{color:e.outcome==="failed"?"var(--graview-warn)":"var(--graview-ink)"},children:$(e)}),(e.batches??[]).map(n=>(0,t.jsx)("span",{"data-interaction-batch":n,style:{marginLeft:"auto"},children:i(n)},n))]}),f?(0,t.jsx)("div",{"data-testid":"interaction-model",style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:f}):null,S?(0,t.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[e.panel?(0,t.jsx)("button",{type:"button","data-testid":"interaction-reopen",disabled:p,onClick:()=>m(n=>n.drawPanel(c,e.panel)),style:r,children:"Show the panel"}):null,(0,t.jsx)("button",{type:"button","data-testid":"interaction-again",disabled:p,onClick:()=>m(n=>n.askAgain(c,e)),style:r,children:"Ask again"})]}):null]})}export{E as a,F as b};