graview 0.1.60 → 0.1.62

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 (228) hide show
  1. package/dist/index.d.ts.map +1 -1
  2. package/dist/index.js +5 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/preview/{chunk.QDSEVPF3.js → chunk.22BZU7ME.js} +1 -1
  5. package/dist/preview/chunk.2AT3GRXM.js +1 -0
  6. package/dist/preview/chunk.2B6P4GPS.js +1 -0
  7. package/dist/preview/chunk.2GEJNG2U.js +1 -0
  8. package/dist/preview/{chunk.7N32AVIJ.js → chunk.2N4Z5K5S.js} +1 -1
  9. package/dist/preview/{chunk.NHUQ2N6J.js → chunk.3FON2Y72.js} +1 -1
  10. package/dist/preview/chunk.3L37FY3G.js +4 -0
  11. package/dist/preview/{chunk.ZYM2SSGW.js → chunk.4HEFUOLV.js} +1 -1
  12. package/dist/preview/chunk.4HRYB7HF.js +1 -0
  13. package/dist/preview/{chunk.YZ7FUKAL.js → chunk.4TX6VCBT.js} +1 -1
  14. package/dist/preview/{chunk.IGJZ4UH3.js → chunk.5HGD6OWL.js} +2 -2
  15. package/dist/preview/{chunk.2USDHXB4.js → chunk.5J3O2FVG.js} +1 -1
  16. package/dist/preview/{chunk.H45Q3O4F.js → chunk.5MZYCELA.js} +1 -1
  17. package/dist/preview/{chunk.SRVQJZRT.js → chunk.5ODHHH35.js} +1 -1
  18. package/dist/preview/{chunk.HDUO2USQ.js → chunk.5STU3KYG.js} +1 -1
  19. package/dist/preview/{chunk.TFWIG6LL.js → chunk.5YAOKOGV.js} +1 -1
  20. package/dist/preview/{chunk.BQIHNT7C.js → chunk.66P5IDTH.js} +1 -1
  21. package/dist/preview/{chunk.M4UD4ARP.js → chunk.6AKW7TXM.js} +1 -1
  22. package/dist/preview/{chunk.URWAFZHF.js → chunk.6JO5HQDR.js} +1 -1
  23. package/dist/preview/{chunk.HUJ6YTWE.js → chunk.75GVFX7L.js} +1 -1
  24. package/dist/preview/{chunk.A3ZXDG6V.js → chunk.7KVUUEZA.js} +1 -1
  25. package/dist/preview/{chunk.FFTYMBBT.js → chunk.7M4HNKDR.js} +1 -1
  26. package/dist/preview/chunk.7OBIBPYH.js +1 -0
  27. package/dist/preview/chunk.7V56P2A7.js +1 -0
  28. package/dist/preview/chunk.7XLS6XTY.js +1 -0
  29. package/dist/preview/chunk.7YOAW7ED.js +1 -0
  30. package/dist/preview/{chunk.FBJARKDT.js → chunk.A3OL2BI2.js} +1 -1
  31. package/dist/preview/{chunk.NGTRL5U4.js → chunk.A3ZC2JBO.js} +1 -1
  32. package/dist/preview/{chunk.A5PDXNY6.js → chunk.ACTXR2MI.js} +1 -1
  33. package/dist/preview/chunk.AFNSAQEQ.js +1 -0
  34. package/dist/preview/chunk.AI34V6WV.js +74 -0
  35. package/dist/preview/{chunk.3XGA65Y3.js → chunk.AJSUHPBE.js} +1 -1
  36. package/dist/preview/chunk.AQRB7LDA.js +1 -0
  37. package/dist/preview/{chunk.GNBIVVL3.js → chunk.B23WZQXQ.js} +1 -1
  38. package/dist/preview/chunk.BIDL7GQD.js +0 -0
  39. package/dist/preview/chunk.BLUKSGI4.js +1 -0
  40. package/dist/preview/chunk.BZMQDEIY.js +1 -0
  41. package/dist/preview/chunk.CAKFNKN5.js +1 -0
  42. package/dist/preview/chunk.CGALLZ54.js +1 -0
  43. package/dist/preview/{chunk.LSY256J4.js → chunk.CHHYIMB7.js} +1 -1
  44. package/dist/preview/chunk.CXDGE5ZS.js +1 -0
  45. package/dist/preview/{chunk.CC5BJH5A.js → chunk.CY3ELWCM.js} +1 -1
  46. package/dist/preview/chunk.DC35FJAB.js +1 -0
  47. package/dist/preview/{chunk.AVBTPSQF.js → chunk.DD2NKFDX.js} +1 -1
  48. package/dist/preview/{chunk.6HF6POIX.js → chunk.DDO3GLEJ.js} +1 -1
  49. package/dist/preview/{chunk.TLJOZSDD.js → chunk.DDUCIUVW.js} +1 -1
  50. package/dist/preview/chunk.DEAP3H2L.js +1 -0
  51. package/dist/preview/chunk.DHJ3FQTR.js +1 -0
  52. package/dist/preview/{chunk.P6RORYOT.js → chunk.DNVWSWL2.js} +1 -1
  53. package/dist/preview/chunk.DPEIT3TW.js +1 -0
  54. package/dist/preview/chunk.DVSTLVIH.js +15 -0
  55. package/dist/preview/chunk.DZZL5IDD.js +5 -0
  56. package/dist/preview/{chunk.IGVASEZU.js → chunk.ELOFPE25.js} +1 -1
  57. package/dist/preview/{chunk.MVWC3VR3.js → chunk.ELTV44HU.js} +2 -2
  58. package/dist/preview/chunk.EVBCEEQ4.js +1 -0
  59. package/dist/preview/{chunk.TKVLNBRD.js → chunk.F7YXLYLX.js} +1 -1
  60. package/dist/preview/{chunk.DCHQHKSA.js → chunk.FULEUL34.js} +1 -1
  61. package/dist/preview/{chunk.VNDKKTED.js → chunk.G4ULQK64.js} +14 -14
  62. package/dist/preview/{chunk.Y7G3OGDE.js → chunk.GX4G4BX3.js} +1 -1
  63. package/dist/preview/chunk.H24OC6OE.js +1 -0
  64. package/dist/preview/chunk.H5S7OL2U.js +1 -0
  65. package/dist/preview/chunk.H73ZPYUX.js +1 -0
  66. package/dist/preview/{chunk.GTKJJYQH.js → chunk.H7N7WN4U.js} +1 -1
  67. package/dist/preview/chunk.HANJZ6FA.js +1 -0
  68. package/dist/preview/chunk.HIMQ65QT.js +1 -0
  69. package/dist/preview/chunk.I77ZGIFE.js +1 -0
  70. package/dist/preview/{chunk.MJVYWLQQ.js → chunk.ILIIBSGA.js} +1 -1
  71. package/dist/preview/chunk.IQ3PRWGO.js +104 -0
  72. package/dist/preview/{chunk.NC7FXY2H.js → chunk.IQMD7DG3.js} +1 -1
  73. package/dist/preview/chunk.IQPILSV3.js +18 -0
  74. package/dist/preview/chunk.IYBEXENQ.js +1 -0
  75. package/dist/preview/{chunk.ULL6ZIJJ.js → chunk.J7Q2WAF4.js} +1 -1
  76. package/dist/preview/{chunk.TLWT67ON.js → chunk.JT3MFPRD.js} +1 -1
  77. package/dist/preview/chunk.JYFZCJ4N.js +2 -0
  78. package/dist/preview/chunk.K2HDEL7I.js +1 -0
  79. package/dist/preview/chunk.KDXU5DT3.js +1 -0
  80. package/dist/preview/chunk.KL7E4YHJ.js +1 -0
  81. package/dist/preview/{chunk.FRYBMS3W.js → chunk.KMV6PJFL.js} +1 -1
  82. package/dist/preview/{chunk.RXYNW5QB.js → chunk.L3WTKQQL.js} +1 -1
  83. package/dist/preview/chunk.LAYQ5PFS.js +1 -0
  84. package/dist/preview/{chunk.KBVTLNS5.js → chunk.LGRLVJGS.js} +3 -3
  85. package/dist/preview/chunk.LTZUF5VG.js +1 -0
  86. package/dist/preview/{chunk.OLFJH4RK.js → chunk.M4AYA2PL.js} +1 -1
  87. package/dist/preview/chunk.M7RESZB6.js +25 -0
  88. package/dist/preview/{chunk.WXUFATY5.js → chunk.MAKODQO3.js} +1 -1
  89. package/dist/preview/{chunk.F6V7RWDK.js → chunk.MDEX6ZVE.js} +1 -1
  90. package/dist/preview/chunk.MGALQLRW.js +1 -0
  91. package/dist/preview/{chunk.7OPM55I2.js → chunk.MYNMBOLD.js} +1 -1
  92. package/dist/preview/chunk.N6EJXXQK.js +2 -0
  93. package/dist/preview/chunk.NAD7ZXYP.js +1 -0
  94. package/dist/preview/chunk.NHTGAP3G.js +3 -0
  95. package/dist/preview/{chunk.5IEFTFKQ.js → chunk.NJSK3UO2.js} +1 -1
  96. package/dist/preview/{chunk.VFOON3Z3.js → chunk.NOGGSLVG.js} +1 -1
  97. package/dist/preview/chunk.NUWDMH47.js +1 -0
  98. package/dist/preview/chunk.NUYA4BWI.js +1 -0
  99. package/dist/preview/{chunk.VUBNBTJP.js → chunk.O2BHPYA4.js} +2 -2
  100. package/dist/preview/chunk.O75HWF3F.js +1 -0
  101. package/dist/preview/chunk.OFWNMTGB.js +21 -0
  102. package/dist/preview/chunk.OKZT2QBM.js +2 -0
  103. package/dist/preview/{chunk.EL5ICOOM.js → chunk.OUDATENL.js} +1 -1
  104. package/dist/preview/chunk.OUPURRDE.js +1 -0
  105. package/dist/preview/{chunk.Y5C4RXG7.js → chunk.OWOOKLIU.js} +2 -1
  106. package/dist/preview/{chunk.PI44XMY2.js → chunk.OWT3VVOT.js} +1 -1
  107. package/dist/preview/{chunk.VDMDPZ6U.js → chunk.PCDUV3WP.js} +1 -1
  108. package/dist/preview/chunk.PD2DECOP.js +1 -0
  109. package/dist/preview/{chunk.ZXOT3IXJ.js → chunk.PKWQKFPE.js} +1 -1
  110. package/dist/preview/{chunk.ENL2JJ47.js → chunk.PLTH2LW5.js} +1 -1
  111. package/dist/preview/{chunk.ZP5RT2EK.js → chunk.PZQNR4KZ.js} +1 -1
  112. package/dist/preview/chunk.Q5WEOX3Q.js +1 -0
  113. package/dist/preview/chunk.QDWSU47A.js +1 -0
  114. package/dist/preview/{chunk.VADQ7ZGA.js → chunk.QGU5QTR6.js} +1 -1
  115. package/dist/preview/chunk.QHY5NVYH.js +1 -0
  116. package/dist/preview/{chunk.6ZQAR5ZA.js → chunk.QIPASE42.js} +1 -1
  117. package/dist/preview/{chunk.7MHCGVGM.js → chunk.RD2X25XB.js} +1 -1
  118. package/dist/preview/chunk.RMR24LFJ.js +4 -0
  119. package/dist/preview/chunk.ROZTJ6IY.js +6 -0
  120. package/dist/preview/{chunk.RQOX5YDW.js → chunk.RPDH32XV.js} +1 -1
  121. package/dist/preview/chunk.RRKI24WY.js +1 -0
  122. package/dist/preview/{chunk.HDP3PS7N.js → chunk.RYRQ66JN.js} +1 -1
  123. package/dist/preview/chunk.SEHRPTNA.js +7 -0
  124. package/dist/preview/chunk.SGCW2XRC.js +1 -0
  125. package/dist/preview/{chunk.JPONLMU7.js → chunk.SS7234R6.js} +1 -1
  126. package/dist/preview/{chunk.BXDM3UMN.js → chunk.SVPKUWZU.js} +1 -1
  127. package/dist/preview/{chunk.LQVAABPS.js → chunk.SWMDFXUX.js} +1 -1
  128. package/dist/preview/{chunk.6WHAWOO7.js → chunk.T3UQ7ZQK.js} +1 -1
  129. package/dist/preview/chunk.T6PU3NKP.js +1 -0
  130. package/dist/preview/{chunk.6C2MHWSX.js → chunk.T6WHGKWR.js} +1 -1
  131. package/dist/preview/{chunk.QBLKTFF4.js → chunk.THVC2BEC.js} +1 -1
  132. package/dist/preview/{chunk.KDRLUBVF.js → chunk.TIALD6SC.js} +1 -1
  133. package/dist/preview/{chunk.Z2ERZ4S6.js → chunk.TM4EPUNO.js} +1 -1
  134. package/dist/preview/chunk.U5P23GO7.js +1 -0
  135. package/dist/preview/chunk.U6ZRJKVM.js +1 -0
  136. package/dist/preview/chunk.UFDJXQQQ.js +32 -0
  137. package/dist/preview/{chunk.IOK4GVJC.js → chunk.UKQUUPKE.js} +1 -1
  138. package/dist/preview/{chunk.TAT2IQUR.js → chunk.UQQKDBIH.js} +1 -1
  139. package/dist/preview/{chunk.QHDCTAD7.js → chunk.UVA7AALY.js} +1 -1
  140. package/dist/preview/chunk.UXMPFPFH.js +20 -0
  141. package/dist/preview/chunk.VACKSKGJ.js +1 -0
  142. package/dist/preview/{chunk.3UOKUF5Z.js → chunk.VC3V7HLL.js} +1 -1
  143. package/dist/preview/chunk.VIH5AX7S.js +5 -0
  144. package/dist/preview/{chunk.4LR64TPU.js → chunk.VJBBVLGZ.js} +1 -1
  145. package/dist/preview/chunk.VN23AGIY.js +1 -0
  146. package/dist/preview/{chunk.VZJWJ5XM.js → chunk.W4BKYSZX.js} +1 -1
  147. package/dist/preview/{chunk.CQT3W2SF.js → chunk.WEOVK2T4.js} +1 -1
  148. package/dist/preview/chunk.WKI5INH7.js +1 -0
  149. package/dist/preview/chunk.WPXPVD33.js +88 -0
  150. package/dist/preview/chunk.X6KYRBL6.js +1 -0
  151. package/dist/preview/chunk.Y2YYH3JN.js +1 -0
  152. package/dist/preview/chunk.Y4FZKUOK.js +1 -0
  153. package/dist/preview/chunk.Y4S7CDRB.js +1 -0
  154. package/dist/preview/{chunk.YFSBVZTG.js → chunk.YP2QSPXU.js} +1 -1
  155. package/dist/preview/{chunk.VWJGQDCE.js → chunk.Z2TDZSMN.js} +1 -1
  156. package/dist/preview/chunk.ZN3PUM2I.js +1 -0
  157. package/dist/preview/index.html +53 -51
  158. package/dist/preview/page.js +2 -2
  159. package/dist/preview/splash.js +57 -0
  160. package/package.json +6 -6
  161. package/dist/preview/chunk.2K4TT2BV.js +0 -1
  162. package/dist/preview/chunk.37TVS7CA.js +0 -1
  163. package/dist/preview/chunk.3IZ3ABII.js +0 -1
  164. package/dist/preview/chunk.3MOJF7BA.js +0 -1
  165. package/dist/preview/chunk.3V4WP7RY.js +0 -18
  166. package/dist/preview/chunk.3ZT5WQYL.js +0 -1
  167. package/dist/preview/chunk.4MP72LPR.js +0 -25
  168. package/dist/preview/chunk.4TCKEG6I.js +0 -1
  169. package/dist/preview/chunk.5DD62IOW.js +0 -21
  170. package/dist/preview/chunk.5YOLUDVO.js +0 -1
  171. package/dist/preview/chunk.644FUGSX.js +0 -1
  172. package/dist/preview/chunk.67U6M7OV.js +0 -1
  173. package/dist/preview/chunk.7TFLRR7D.js +0 -1
  174. package/dist/preview/chunk.7VKSXGTX.js +0 -1
  175. package/dist/preview/chunk.BF6S5UE4.js +0 -1
  176. package/dist/preview/chunk.BLPYNNR4.js +0 -1
  177. package/dist/preview/chunk.BRT27WON.js +0 -1
  178. package/dist/preview/chunk.BYKD5RLA.js +0 -1
  179. package/dist/preview/chunk.C7OLSEWK.js +0 -1
  180. package/dist/preview/chunk.CFKZXLXS.js +0 -1
  181. package/dist/preview/chunk.CMN6BBAD.js +0 -1
  182. package/dist/preview/chunk.D7YSL3NK.js +0 -2
  183. package/dist/preview/chunk.EQXB7LKI.js +0 -1
  184. package/dist/preview/chunk.ERFT54HT.js +0 -1
  185. package/dist/preview/chunk.FLUK3UXF.js +0 -1
  186. package/dist/preview/chunk.G3R4BTI7.js +0 -1
  187. package/dist/preview/chunk.G4YJPKRG.js +0 -5
  188. package/dist/preview/chunk.GLWSVSQL.js +0 -1
  189. package/dist/preview/chunk.I4XQBQRC.js +0 -1
  190. package/dist/preview/chunk.IBOKXVWN.js +0 -1
  191. package/dist/preview/chunk.IHBUBZQT.js +0 -2
  192. package/dist/preview/chunk.JEYQBH33.js +0 -32
  193. package/dist/preview/chunk.JJGCTGWA.js +0 -1
  194. package/dist/preview/chunk.KGW75Z5L.js +0 -3
  195. package/dist/preview/chunk.KI37ZEV3.js +0 -1
  196. package/dist/preview/chunk.KNYLY7MH.js +0 -1
  197. package/dist/preview/chunk.L6AWE76F.js +0 -1
  198. package/dist/preview/chunk.LGEA5257.js +0 -6
  199. package/dist/preview/chunk.LLYRFVIN.js +0 -104
  200. package/dist/preview/chunk.LZIBQ3VX.js +0 -1
  201. package/dist/preview/chunk.MDJWK5W2.js +0 -1
  202. package/dist/preview/chunk.MSWWWLEA.js +0 -1
  203. package/dist/preview/chunk.PFSYXD6Q.js +0 -1
  204. package/dist/preview/chunk.PHC2MI4C.js +0 -1
  205. package/dist/preview/chunk.PHJ6WPWH.js +0 -1
  206. package/dist/preview/chunk.PNW5K7BW.js +0 -1
  207. package/dist/preview/chunk.PXQVXBNG.js +0 -1
  208. package/dist/preview/chunk.QFUMFQJU.js +0 -1
  209. package/dist/preview/chunk.QI4SLPQ4.js +0 -4
  210. package/dist/preview/chunk.QUJS63OJ.js +0 -13
  211. package/dist/preview/chunk.SB2PZKN5.js +0 -88
  212. package/dist/preview/chunk.T7LQD67N.js +0 -20
  213. package/dist/preview/chunk.TY4GQJKC.js +0 -1
  214. package/dist/preview/chunk.UDCDK7XJ.js +0 -4
  215. package/dist/preview/chunk.UITT6JWW.js +0 -2
  216. package/dist/preview/chunk.UJTE7UAP.js +0 -1
  217. package/dist/preview/chunk.UQWTZJBV.js +0 -1
  218. package/dist/preview/chunk.VMV464JK.js +0 -1
  219. package/dist/preview/chunk.VSCIXAHN.js +0 -5
  220. package/dist/preview/chunk.W3W54DSX.js +0 -1
  221. package/dist/preview/chunk.WC3DENU4.js +0 -67
  222. package/dist/preview/chunk.WQ6RCEUQ.js +0 -1
  223. package/dist/preview/chunk.X6A4VSSD.js +0 -1
  224. package/dist/preview/chunk.XGASJAV2.js +0 -7
  225. package/dist/preview/chunk.XR6YR6RV.js +0 -1
  226. package/dist/preview/chunk.XZPKBHJT.js +0 -1
  227. package/dist/preview/chunk.YEBGI6ED.js +0 -1
  228. package/dist/preview/chunk.YH63KQ2G.js +0 -1
@@ -1,2 +1,2 @@
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 co}from"./chunk.HUJ6YTWE.js";import{a as qt,b as hr,c as yr,d as gr,e as zt,f as wr,g as vr,h as br,i as Sr,j as kr,k as Pr,l as Ar,m as Er,n as Ze}from"./chunk.JJGCTGWA.js";import{b as mr}from"./chunk.XR6YR6RV.js";import{a as It,b as cr,c as lr,d as ur,e as fr,f as _t,g as pr,h as jt}from"./chunk.NHUQ2N6J.js";import{a as Ot,g as $n}from"./chunk.7TFLRR7D.js";import{k as ct}from"./chunk.KGW75Z5L.js";import{E as ir,I as sr,J as dr,h as tr,k as Nt,l as nr,n as rr,r as or,w as Wt,z as ar}from"./chunk.WC3DENU4.js";import{c as so}from"./chunk.VNDKKTED.js";import{Aa as Jn,Ca as Yn,Da as Qn,Fa as Zn,G as $t,Ga as Bt,Ka as Xn,La as er,Oa as ft,T as Wn,Z as In,a as Bn,b as lt,c as ut,ga as _n,ha as jn,j as Nn,m as Dt,va as qn,wa as zn,xa as Gn,ya as Un,za as Kn}from"./chunk.4MP72LPR.js";import{a as Re}from"./chunk.SDO3U72B.js";import{$d as Mt,Eb as Rn,Gb as Tn,Td as Ee,Ud as Hn,Vd as Vn,_d as Lt,ae as Ht,de as Dn,ee as Vt,fb as je,ld as Fn,md as On,nc as Ct,oc as xn,qb as st,rd as Cn,td as Ln,ud as Mn,vb as En,wd as dt}from"./chunk.VSCIXAHN.js";import"./chunk.FQLNBIQ5.js";import{b as Me}from"./chunk.AJZBJBMO.js";function Gt(e){if(Array.isArray(e))return e.map(Gt);if(e&&typeof e=="object"){let n={};for(let o of Object.keys(e).sort()){let i=e[o];i!==void 0&&(n[o]=Gt(i))}return n}return e}function Ut(e){return JSON.stringify(Gt(e))??"undefined"}async function pt(e,n={}){let o=e.compiled===void 0||!uo(e.compiled,e.document)?void 0:$n(e.compiled,n);if(o?.ok)return o;let{compileDocumentWithoutCheck:i}=await lo();return i(e.document,n)}var Rr,lo=()=>Rr??=(__graviewPreload(import.meta.url,["./chunk.7TFLRR7D.js","./chunk.6ZQAR5ZA.js","./chunk.PI44XMY2.js","./chunk.KGW75Z5L.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.C7OLSEWK.js")).catch(e=>{throw Rr=void 0,e});function uo(e,n){let o=typeof e=="object"&&e!==null?e.document:void 0,i=n;if(typeof i=="string")try{i=JSON.parse(i)}catch{return!1}return o!==void 0&&Ut(Ot(o).document)===Ut(Ot(i).document)}var c=Me($t(),1);var ht=Me($t(),1),Kt="data-graview-drawn",fo=200,Tr=50,po=1e4,mt=()=>typeof performance<"u"?performance.now():Date.now();function mo(e){let n=[...e.querySelectorAll("img")];for(let o of e.querySelectorAll("[data-worker-view]"))o.shadowRoot&&n.push(...o.shadowRoot.querySelectorAll("img"));return n}function ho(e,n){if(e.ownerDocument.fonts?.status==="loading"||zn()>0||Jn(n)>0||e.querySelector('[aria-busy="true"]')||mo(e).some(i=>!i.complete&&i.loading!=="lazy"))return!1;for(let i of e.querySelectorAll("[data-worker-view-place]"))if(!i.querySelector("[data-worker-view][data-worker-view-drawn], [data-worker-view][data-worker-view-failed]"))return!1;return!0}function xr(e){let n=e.querySelector("[data-embed-content]"),o=[...e.querySelectorAll("[data-worker-view]")].map(i=>`${i.offsetWidth}x${i.offsetHeight}`);return`${e.scrollWidth}x${e.scrollHeight}|${n?`${n.scrollWidth}x${n.scrollHeight}`:""}|${o.join(",")}`}function yo(e,n,o,i){e.removeAttribute(Kt);let l=e.ownerDocument.defaultView;if(!l)return()=>{};let u=mt(),d=u,w=xr(e),m=!1,P,F=typeof MutationObserver>"u"?void 0:new MutationObserver(x=>{x.some(O=>!(O.target===e&&O.attributeName===Kt))&&(d=mt())});F?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let B=()=>{m=!0,F?.disconnect(),P!==void 0&&clearTimeout(P)},b=x=>{let O=!1,ne=()=>{O||(O=!0,x())};typeof l.requestAnimationFrame=="function"&&l.requestAnimationFrame(()=>setTimeout(ne,0)),setTimeout(ne,100)},T=()=>{if(m)return;let x=xr(e);x!==w&&(w=x,d=mt());let O=mt();if(ho(e,i)&&O-d>=fo||O-u>=po){b(()=>{m||(B(),e.setAttribute(Kt,n),Qn(),o())});return}P=setTimeout(T,Tr)};return P=setTimeout(T,Tr),B}function Fr(e,n,o,i,l){Yn();let u=(0,ht.useRef)({place:o,onDrawn:i});u.current={place:o,onDrawn:i},(0,ht.useLayoutEffect)(()=>{l&&Kn(l);let d=P=>yo(P,u.current.place.path,()=>u.current.onDrawn?.(u.current.place),l);if(e.current)return d(e.current);let w,m=!1;return queueMicrotask(()=>{!m&&e.current&&(w=d(e.current))}),()=>{m=!0,w?.()}},[n,e,l])}var we=Me($t(),1),Xe,go=Re(()=>(__graviewPreload(import.meta.url,["./chunk.5IEFTFKQ.js","./chunk.BRT27WON.js","./chunk.DCHQHKSA.js","./chunk.RXYNW5QB.js","./chunk.PFSYXD6Q.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.4TCKEG6I.js"))),Or=()=>go().then(e=>void(Xe=e),()=>new Promise(e=>setTimeout(e,2e3)).then(Or)),Jt=qn(Or),Cr=e=>!!e&&Xe===void 0;function Yt({onReady:e,fetch:n}){return(0,we.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var wo=0;function Lr(e){let[n,o]=(0,we.useState)(()=>Xe);(0,we.useEffect)(()=>{if(!e||n)return;let u=!1;return Jt().then(()=>{u||o(Xe)}),()=>{u=!0}},[e,n]);let i=(0,we.useMemo)(()=>wo+=1,[e]);return{over:(0,we.useMemo)(()=>{let u=n??Xe;if(!e||!u)return;let{source:d,worker:w,...m}=e,P={...m,worker:w??{source:d},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:F=>u.registerWorkerView(F,P)}},[e,n]),n:i}}var Vr=Me(co(),1),I=Me(so(),1);var g=Me(Wn(),1);function yt(e,n={}){let o=Bt(e);return{Face:o.part((l,u)=>(0,c.createElement)(l,u),n),fetch:()=>o.load().then(()=>{}),here:()=>o.current!==void 0||o.failed}}var Xt=e=>Promise.all([e,sr()]).then(([n])=>n),Dr=Re(()=>(__graviewPreload(import.meta.url,["./chunk.3UOKUF5Z.js","./chunk.CC5BJH5A.js","./chunk.QI4SLPQ4.js","./chunk.Y5C4RXG7.js","./chunk.FRYBMS3W.js","./chunk.3MOJF7BA.js","./chunk.LZIBQ3VX.js","./chunk.HJCQ6I3S.js","./chunk.QDSEVPF3.js","./chunk.7N32AVIJ.js","./chunk.X6A4VSSD.js","./chunk.KDRLUBVF.js","./chunk.PNW5K7BW.js","./chunk.ENL2JJ47.js","./chunk.BQIHNT7C.js","./chunk.3XGA65Y3.js","./chunk.2K4TT2BV.js","./chunk.OLFJH4RK.js","./chunk.67U6M7OV.js","./chunk.ZP5RT2EK.js","./chunk.VZJWJ5XM.js","./chunk.JJGCTGWA.js","./chunk.XR6YR6RV.js","./chunk.VFOON3Z3.js","./chunk.GZHZLJBF.js","./chunk.IOK4GVJC.js","./chunk.OJGHDWI6.js","./chunk.TLJOZSDD.js","./chunk.MSWWWLEA.js","./chunk.UITT6JWW.js","./chunk.A5PDXNY6.js","./chunk.WC3DENU4.js","./chunk.VNDKKTED.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.KBVTLNS5.js"))),vo=Re(()=>(__graviewPreload(import.meta.url,["./chunk.3V4WP7RY.js","./chunk.LLYRFVIN.js","./chunk.YFSBVZTG.js","./chunk.G4YJPKRG.js","./chunk.3UOKUF5Z.js","./chunk.Q355UPFG.js","./chunk.PXQVXBNG.js","./chunk.MVWC3VR3.js","./chunk.CC5BJH5A.js","./chunk.CFKZXLXS.js","./chunk.Y5C4RXG7.js","./chunk.7MHCGVGM.js","./chunk.FRYBMS3W.js","./chunk.LQVAABPS.js","./chunk.NGTRL5U4.js","./chunk.3MOJF7BA.js","./chunk.LZIBQ3VX.js","./chunk.YZ7FUKAL.js","./chunk.KDRLUBVF.js","./chunk.BQIHNT7C.js","./chunk.TAT2IQUR.js","./chunk.3XGA65Y3.js","./chunk.BYKD5RLA.js","./chunk.2K4TT2BV.js","./chunk.VUBNBTJP.js","./chunk.BJUUSIQY.js","./chunk.ZP5RT2EK.js","./chunk.VZJWJ5XM.js","./chunk.XOZU4OFA.js","./chunk.GLWSVSQL.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.7VKSXGTX.js","./chunk.TY4GQJKC.js","./chunk.6ZQAR5ZA.js","./chunk.W3W54DSX.js","./chunk.PI44XMY2.js","./chunk.KGW75Z5L.js","./chunk.GZHZLJBF.js","./chunk.IOK4GVJC.js","./chunk.OJGHDWI6.js","./chunk.TLJOZSDD.js","./chunk.MSWWWLEA.js","./chunk.UITT6JWW.js","./chunk.A5PDXNY6.js","./chunk.WC3DENU4.js","./chunk.VNDKKTED.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.L6AWE76F.js"))),bo=Re(()=>(__graviewPreload(import.meta.url,["./chunk.3V4WP7RY.js","./chunk.LLYRFVIN.js","./chunk.YFSBVZTG.js","./chunk.G4YJPKRG.js","./chunk.3UOKUF5Z.js","./chunk.Q355UPFG.js","./chunk.PXQVXBNG.js","./chunk.MVWC3VR3.js","./chunk.CC5BJH5A.js","./chunk.CFKZXLXS.js","./chunk.Y5C4RXG7.js","./chunk.7MHCGVGM.js","./chunk.FRYBMS3W.js","./chunk.LQVAABPS.js","./chunk.NGTRL5U4.js","./chunk.3MOJF7BA.js","./chunk.LZIBQ3VX.js","./chunk.YZ7FUKAL.js","./chunk.KDRLUBVF.js","./chunk.BQIHNT7C.js","./chunk.TAT2IQUR.js","./chunk.3XGA65Y3.js","./chunk.BYKD5RLA.js","./chunk.2K4TT2BV.js","./chunk.VUBNBTJP.js","./chunk.BJUUSIQY.js","./chunk.ZP5RT2EK.js","./chunk.VZJWJ5XM.js","./chunk.XOZU4OFA.js","./chunk.GLWSVSQL.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.7VKSXGTX.js","./chunk.TY4GQJKC.js","./chunk.6ZQAR5ZA.js","./chunk.W3W54DSX.js","./chunk.PI44XMY2.js","./chunk.KGW75Z5L.js","./chunk.GZHZLJBF.js","./chunk.IOK4GVJC.js","./chunk.OJGHDWI6.js","./chunk.TLJOZSDD.js","./chunk.MSWWWLEA.js","./chunk.UITT6JWW.js","./chunk.A5PDXNY6.js","./chunk.WC3DENU4.js","./chunk.VNDKKTED.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.MDJWK5W2.js"))),$r=yt(()=>Xt(Dr().then(e=>e.SceneFace)),{what:"This view"}),Br=yt(()=>Dr().then(e=>e.SceneKeeping),{quiet:!0}),Nr=yt(()=>Xt(vo().then(e=>e.PagesContent)),{what:"This page"}),Wr=yt(()=>Xt(bo().then(e=>e.PictureFace)),{what:"This picture"}),So=$r.Face,ko=Br.Face,Po=Nr.Face,Ao=Wr.Face;function He(...e){let n=e.length>0?e:["scene","pages","picture"],o=new Set(n.flatMap(Ir));return Promise.all([...[...o].map(i=>i.fetch()),rr()]).then(()=>{},()=>{})}var Ir=e=>e==="pages"?[Nr]:e==="picture"?[Wr]:[$r,Br],_r=e=>Ir(e).every(n=>n.here()),Eo=150,Qt=0;function Mr(e,n){if(_r(e))return n();let o=++Qt,i=()=>{o===Qt&&(Qt+=1,n())};He(e).then(i),setTimeout(i,Eo)}var Ro=768;function To(e,n){let o=n!==null&&n>=Ro;(0,c.useEffect)(()=>{if(!o||e==="picture")return;let i=e==="pages"?"scene":"pages";if(_r(i))return;let l=globalThis,u=()=>void He(i),d=()=>{},w=Zn(()=>{if(l.requestIdleCallback&&l.cancelIdleCallback){let m=l.requestIdleCallback(u,{timeout:4e3});d=()=>l.cancelIdleCallback?.(m)}else{let m=setTimeout(u,1500);d=()=>clearTimeout(m)}});return()=>(w(),d())},[e,o])}function xo({asked:e,shown:n,onDrawn:o}){return(0,c.useLayoutEffect)(()=>o(e,n),[e,n,o]),null}function Fo({auto:e,scene:n}){return(0,g.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${zt}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var Oo=Bt(Re(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,g.jsx)(e.StudioPlace,{...n}),{quiet:!0});function jr(e,n,o,i,l){return _t(e,fr(n?ut(n):l??Bn,i),o)}function en(e){return e&&ut(e).overview?"graview":"scene"}function Hr(e,n){if(n.homeView?.()===void 0)return!1;let o=e.pages?.first?.trim();return o===void 0||o===""||o==="/"||o.toLowerCase()==="home"}function qr(e){let[,n]=(0,c.useState)(!1),o=(0,c.useCallback)(()=>n(!0),[]),i=(0,c.useRef)(!1);return e.at&&!gt?(0,g.jsx)(Yt,{onReady:o,fetch:tn}):!i.current&&Cr(e.draftView)?(0,g.jsx)(Yt,{onReady:o,fetch:Jt}):(i.current=!0,(0,g.jsx)(Co,{...e}))}function Co(e){let{app:n,stop:o,bar:i=!0,standing:l="Everything is in order",principal:u,heading:d=2}=e,{rootRef:w,scope:m,css:P,scheme:F,store:B,presence:b,brand:T,auto:x,height:O}=wr(e),ne=Lr(e.draftView),E=yr(e,dr,ne.over),[de]=(0,c.useState)(Un),p=e.basePath===void 0?{}:{basePath:e.basePath},[D]=(0,c.useState)(Nt),N=e.notices??D,U=v=>Lt(v,p),oe={...e.routing?{routing:e.routing}:{},...p},[ae]=(0,c.useState)(()=>{let v=e.at?.face;if(v)return v;let X=o===void 0&&Hr(n,E)?"pages":en(o),$=It({...oe,face:X});return e.face===void 0&&e.onOpening?.($),$}),[be,H]=(0,c.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&o===void 0&&cr(oe)&&Hr(n,E)),Se=(0,c.useRef)(e.onFace);Se.current=e.onFace,(0,c.useLayoutEffect)(()=>{be&&(Se.current?.("pages"),H(!1))},[be]);let A=be?"pages":e.face??ae,k=n.schema.kinds,V=e.routing==="address",ke=(0,c.useMemo)(()=>e.at?gt.settleAt(e,B.seenBy(u??{kind:"human"}),E.places()):void 0,[]),L=(0,c.useMemo)(()=>jn(E,n.schema),[E,n.schema]),pe=(0,c.useMemo)(()=>{let v=ke?.stop??(V?lr(e.basePath):void 0)??o;return A==="scene"&&v===void 0&&L===void 0&&(e.path===void 0||Zt(e.path))?jt(void 0):jr(A,v,k,E.places(),L)},[]),[W]=(0,c.useState)(A);(0,c.useEffect)(()=>{W!=="pages"&&_n(E)},[W,E]);let M=(0,c.useRef)(void 0),q=v=>v===void 0||Zt(v)?"/":v;M.current??={path:q(ke?.path??(V?A==="pages"?(Mt(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==M.current.asked&&(M.current={path:q(e.path),asked:e.path});let Z=(0,c.useRef)(e.onNavigate);Z.current=e.onNavigate;let xe=(0,c.useCallback)((v,X)=>{M.current.path=v,Z.current?.(v,X)},[]),{at:Pe,setAt:_,steering:K,steer:re}=Pr(M.current.path),C=(0,c.useContext)(zr);C&&(C.pages=()=>M.current.path);let Fe=(0,c.useRef)(void 0),J=(0,c.useCallback)(v=>void(M.current.path=v),[]),Y=tr(w),[z,me]=(0,c.useState)(!1),Q=e.pagesBelow!==void 0&&Y!==null&&Y<e.pagesBelow&&(A==="scene"||A==="graview")&&!z,R=Q?"pages":A,Ve=(0,c.useRef)(!1);Ve.current=z&&e.pagesBelow!==void 0&&Y!==null&&Y<e.pagesBelow&&(A==="scene"||A==="graview"),C&&(C.shown=R);let De=(0,c.useRef)(A==="graview"?"graview":"scene");(R==="scene"||R==="graview")&&(De.current=R),(0,c.useState)(()=>{if(!V||typeof window>"u"||R==="pages"||R==="picture")return;let{pathname:v,search:X,hash:$}=window.location;Mt(v,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${U(Ee)}${X}${$}`)}),gr(w,R,e.onIntrinsicHeight),To(R,Y);let ce=Ar(e.onError,R),Oe=Er(e.onReady,R),Ue=(0,c.useRef)(e.onFaceDrawn);Ue.current=e.onFaceDrawn;let he=(0,c.useCallback)((v,X)=>{Oe(X),Ue.current?.(v)},[Oe]),[$e,Ce]=(0,c.useState)(null),Ke=E.places(),ye=(0,c.useRef)({shown:R,onFace:e.onFace});ye.current={shown:R,onFace:e.onFace};let Be=(0,c.useCallback)((v,X,$)=>{if(V){Fe.current?.(v,X,$);return}ye.current.onFace?.(v),Z.current?.(v==="pages"?X??M.current.path:Ee,"push")},[V]),[kt,Je]=(0,c.useState)(void 0);(0,c.useEffect)(()=>{R==="pages"&&Je(void 0)},[R]);let G=(0,c.useRef)(o);(0,c.useEffect)(()=>{G.current!==o&&(G.current=o,Je(void 0))},[o]);let le=(0,c.useCallback)(v=>{if(ye.current.shown==="pages"){if(me(!0),Je(v),A==="scene"||A==="graview"){Mr(A,()=>{V?window.history.pushState(null,"",`${U(Ee)}${v??""}`):Z.current?.(Ee,"push")});return}Mr(De.current,()=>Be(De.current,void 0,v))}},[V,A,e.basePath,Be]),j=(0,c.useCallback)(v=>{if(ye.current.shown==="pages"){K.go.current||(M.current.path=v),re(v);return}if(M.current.path=v,_(v),Ve.current){me(!1),V?window.history.pushState(null,"",U(v)):Z.current?.(v,"push");return}Be("pages",v)},[K,re,_,Be,V,e.basePath]),Ne=E.arrangement?.(),ie=R==="pages",We=e.hrefOf,Le=We??(V?U:void 0),Ie=(0,c.useMemo)(()=>({open:j,...We?{href:We}:V?{href:v=>Lt(v,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[j,V,e.basePath,We]);return(0,g.jsxs)("section",{ref:w,className:m,"aria-label":e.label??n.name,"data-graview-embed":R,"data-graview-scheme":F,...Q?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:O,minHeight:x?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,g.jsx)("style",{children:P}),(0,g.jsxs)(er.Provider,{value:ce,children:[(0,g.jsx)(vr,{rootRef:w,board:N}),(0,g.jsx)(hr,{rootRef:w,firstLook:e.firstLook,app:ar(T??{name:n.name},n.schema)}),(0,g.jsx)(Ze,{module:"@graview/react",report:ce,content:!0,children:(0,g.jsx)(Gn.Provider,{value:de,children:(0,g.jsx)(In,{store:B,views:E,initialView:pe,scheme:F,...br(e,b,T),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,g.jsxs)(nr.Provider,{value:N,children:[(0,g.jsx)(Vo,{face:R,stop:kt??o,kinds:k,places:Ke,opens:L}),C?(0,g.jsx)(Lo,{into:C}):null,(0,g.jsx)(Mo,{rootRef:w,face:A,shown:R,path:Pe,stop:o,draft:ne.n,onDrawn:e.onDrawn,parts:de}),V?(0,g.jsx)(ur,{pagesWere:ke?.path,basePath:e.basePath,shown:R,onFace:e.onFace,toggle:Fe,kinds:k,places:Ke,opens:L,landed:J}):null,i&&R!=="picture"?(0,g.jsx)(Ze,{module:"@graview/embed",report:ce,children:(0,g.jsx)(Sr,{name:T?.name??n.name,heading:d,named:qt(i).name!==!1,faces:qt(i).faces===!1?void 0:{scene:{label:Hn(Ne),current:!ie,go:()=>le(),reach:()=>void He(De.current)},pages:{label:Vn(Ne),current:ie,go:()=>j(M.current.path),reach:()=>void He("pages")}},at:ie?Pe:null,without:e.pages?.without(),home:{...Le?.("/")!==void 0?{href:Le("/")}:{},go:()=>j("/"),current:ie&&Pe.split("?")[0]==="/"},reach:{...Le?{href:Le}:{},go:v=>j(v.path)},standing:l,hostActions:e.hostActions,keeping:ie?void 0:(0,g.jsx)(Do,{app:n,studio:e.studio,report:ce}),onFind:Ce,switch:e.switch})}):null,(0,g.jsx)(or.Provider,{value:$e,children:(0,g.jsx)(Ze,{module:R==="pages"||R==="picture"?"@graview/pages":"@graview/react",report:ce,content:!0,children:(0,g.jsxs)(c.Suspense,{fallback:(0,g.jsx)(Fo,{auto:x,scene:R!=="pages"&&R!=="picture"}),children:[R==="picture"?(0,g.jsx)(Ao,{scope:m,store:B,views:E,as:(o?ut(o).within?.view:void 0)??""}):R==="pages"?(0,g.jsx)(Po,{store:B,views:E,presence:b,auto:x,brand:T,steering:K,overview:le,scope:m,titleLevel:kr(d),quickAsk:Wt(e.quickAsk),props:{...e,onNavigate:xe,...V?{}:{path:M.current.path}}}):(0,g.jsx)(Xn.Provider,{value:Ie,children:(0,g.jsx)(So,{address:V,auto:x,scheme:F,scope:m,quickAsk:Wt(e.quickAsk)})}),(0,g.jsx)(xo,{asked:A,shown:R,onDrawn:he})]})},R)})]})})})})]})]})}var Zt=e=>e.split(/[?#]/)[0]===Ee,zr=(0,c.createContext)(null);function Lo({into:e}){return e.view=ft().view,null}function Mo({rootRef:e,face:n,shown:o,path:i,stop:l,draft:u,onDrawn:d,parts:w}){let{view:m}=ft(),P=o==="scene"||o==="graview",F=lt(m),{pan:B,...b}=m,T=m.pan?lt(b):F,x={face:n,path:P?Ee:o==="picture"?l??"#":i,stop:F};return Fr(e,`${o} ${P?T:x.path} ${u}`,x,d,w),null}var gt,Ho=Re(()=>(__graviewPreload(import.meta.url,["./chunk.NHUQ2N6J.js","./chunk.WC3DENU4.js","./chunk.VNDKKTED.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.BXDM3UMN.js"))),tn=()=>Ho().then(e=>void(gt=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(o),e()},o=setTimeout(n,1e4);window.addEventListener("online",n)}).then(tn));function Vo({face:e,stop:n,kinds:o,places:i,opens:l}){let{view:u,go:d}=ft(),w=(0,c.useRef)({face:e,stop:n});return(0,c.useLayoutEffect)(()=>{let m=w.current.stop!==n,P=w.current.face!==e,F=w.current.face==="pages";if(w.current={face:e,stop:n},!m&&!P||e==="pages"||e==="picture")return;let B=(m||F)&&n!==void 0?jr(e,n,o,i):F&&pr(u)?_t(e,jt(l),o):e==="graview"?Dt(u,!0):u.overview?Nn(Dt(u,!1),ir(u,o)):u;d(B)},[e,n,o,u,d,l]),null}function Do({app:e,studio:n,report:o}){return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(c.Suspense,{fallback:null,children:(0,g.jsx)(ko,{})}),n!==!1?(0,g.jsx)(Ze,{module:"@graview/studio",report:o,children:(0,g.jsx)($o,{app:e,studio:n})}):null]})}function $o({app:e,studio:n}){let o={app:e,within:"box",...n?{onApply:n.onApply}:{},...n?.landmark?{landmark:n.landmark}:{},...n?.offered!==void 0?{offered:n.offered}:{}},i=n?.place;return i?(0,g.jsx)(i,{...o}):(0,g.jsx)(c.Suspense,{fallback:null,children:(0,g.jsx)(Oo,{...o})})}function Bo({path:e,stop:n,...o},i){return{...o,app:i.app,at:i.at,remote:i.remote,...i.remote.presence?{presence:i.remote.presence}:{}}}function nn(e,n){let o=n.store??n.remote?.store??mr(n.app,n.seed),i=n.notices??Nt(),l=null,u={},d=0,w=n.label,m=n.app,P=Promise.resolve(),F=n.at?.face??n.face,B=F===void 0?void 0:It({...n,face:F}),b=B??en(n.stop),T=null,x=[],O=p=>{if(T=p,p!==b)return;let D=x;x=[];for(let N of D)N()};function ne(){let[p,D]=(0,c.useState)(B),[N,U]=(0,c.useState)(n.stop),[oe,ae]=(0,c.useState)(n.path),[be,H]=(0,c.useState)(n.scheme??"auto"),[Se,A]=(0,c.useState)(n.principal),[k,V]=(0,c.useState)(n.seats),[ke,L]=(0,c.useState)(n.quickAsk),[pe,W]=(0,c.useState)(n.people),[M,q]=(0,c.useState)(n.hostContext),[Z,xe]=(0,c.useState)(n.brand),[Pe,_]=(0,c.useState)(n.whileAway),[K,re]=(0,c.useState)(n.label),[C,Fe]=(0,c.useState)(n.hostActions),[J,Y]=(0,c.useState)(void 0),[z,me]=(0,c.useState)(n.draftView);return l={app:Q=>{Y(Q),ae(void 0),U(void 0)},face:D,stop:U,path:ae,scheme:H,seat:A,seats:V,quickAsk:L,people:W,hostContext:q,brand:xe,whileAway:_,label:re,hostActions:Fe,draft:me},(0,g.jsx)(zr.Provider,{value:u,children:(0,g.jsx)(qr,{...J?Bo(n,J):n,store:o,notices:i,...p!==void 0?{face:p}:{},onOpening:Q=>{b=Q},...N!==void 0?{stop:N}:{},...oe!==void 0?{path:oe}:{},...Se?{principal:Se}:{},...k?{seats:k}:{},...ke!==void 0?{quickAsk:ke}:{},...pe?{people:pe}:{},...M?{hostContext:M}:{},...Z?{brand:Z}:{},whileAway:Pe,label:K,hostActions:C,draftView:z,scheme:be,onFace:Q=>{b=Q,D(Q)},onSeat:A,onFaceDrawn:O},J?.n??0)})}let E=()=>{let p=u.view?.focusId,D=p?o.graph.getNode(p)?.kind:void 0,N=(u.shown??b)==="scene"||(u.shown??b)==="graview";return{face:b,path:N?Ee:u.pages?.()??n.path??"/",stop:u.view?lt(u.view):n.stop??"#",...D?{kind:D}:{}}},de=(0,Vr.createRoot)(e);return(0,I.flushSync)(()=>de.render((0,g.jsx)(ne,{}))),{get store(){return o},where:E,setApp:(p,D,N)=>{let U="graph"in D?{store:D}:D,oe=()=>{let ae=E();o=U.store,w=N?.label??(w===m.name?p.name:w),m=p,(0,I.flushSync)(()=>{l?.label(w),l?.app({app:p,remote:U,at:ae,n:++d})})};gt?oe():P=P.then(tn).then(oe)},setFace:p=>{b=p,(0,I.flushSync)(()=>l?.face(p))},setStop:p=>(0,I.flushSync)(()=>l?.stop(p)),setPath:p=>(0,I.flushSync)(()=>{if(Zt(p)){(b==="pages"||b==="picture")&&(b="scene",l?.face("scene"));return}l?.path(p),b!=="pages"&&(b="pages",l?.face("pages"))}),setScheme:p=>(0,I.flushSync)(()=>l?.scheme(p)),setSeat:p=>(0,I.flushSync)(()=>l?.seat(p)),setSeats:p=>(0,I.flushSync)(()=>l?.seats(p)),setQuickAsk:p=>(0,I.flushSync)(()=>l?.quickAsk(p)),setPeople:p=>(0,I.flushSync)(()=>l?.people(p)),setHostContext:p=>(0,I.flushSync)(()=>l?.hostContext(p)),setBrand:p=>(0,I.flushSync)(()=>l?.brand(p)),setWhileAway:p=>(0,I.flushSync)(()=>l?.whileAway(p)),setDraftView:p=>(0,I.flushSync)(()=>l?.draft(p)),setLabel:p=>{w=p,(0,I.flushSync)(()=>l?.label(p))},setHostActions:p=>(0,I.flushSync)(()=>l?.hostActions(p)),drawn:()=>P.then(()=>T===b?void 0:new Promise(p=>x.push(p))),notify:p=>{let D;return(0,I.flushSync)(()=>{D=i.notify(p)}),D},unmount:()=>de.unmount()}}var wt=e=>`s${(e+1).toString(36)}`;var ve={seat:"x-graview-seat",roles:"x-graview-roles",kind:"x-graview-kind",name:"x-graview-name",for:"x-graview-for",forRoles:"x-graview-for-roles",forName:"x-graview-for-name",via:"x-graview-via"},qe={header:"x-graview-key",param:"graview_key",cookie:"graview_key"};function vt(e,n={}){try{let o=new URL(e),i=o.searchParams.get(qe.param);if(i)return o.searchParams.delete(qe.param),{url:o.origin+o.pathname.replace(/\/$/,"")+o.search,key:i,headers:{[qe.header]:i,...n}}}catch{}return{url:e.replace(/\/$/,""),headers:n}}var Gr="/graview/friction";var Ur="/graview/live",rn="graview.ship",on=`${rn}.${st}`;var ze=class extends Error{constructor(n){super(n),this.name="Superseded"}},Te=e=>e?.lineage?{lineage:e.lineage}:{},No=(e,n)=>`${e.calls.map(o=>o.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
2
- `)[0]??"":String(n)})`;function Wo(e){if(!e)return[];try{let n=e.storage.getItem(e.key);if(n===null)return[];e.storage.removeItem(e.key);let o=JSON.parse(n);return Array.isArray(o)?o.filter(i=>!!i&&Array.isArray(i.calls)):[]}catch{return[]}}var Ge=class extends Error{constructor(o){super(o.sentence);this.refusal=o;this.name="RemoteRefusedError"}},Io={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},fe=class extends Error{constructor(o,i){super(o);this.conflicts=i;this.name="StaleWrite"}},et=class extends Error{constructor(n){super(n),this.name="Unreached"}},_o=new Set([502,503,504]);async function jo(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function qo(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var zo=1,Go=()=>({refusals:new Set,conflicts:new Set,statuses:new Set,helds:new Set,builds:new Set,who:new Set,declarations:new Set,tally:{reconnects:0,rebases:0,conflicts:0,resyncs:0}});async function bt(e){return(await Kr(e,Wo(e.carry),"This app was updated while your changes were on the way.",Go())).remote}async function Kr(e,n,o,i){let{key:l,...u}=vt(e.url,e.headers),d={...e,...u},w=d.fetch??fetch,m={"content-type":"application/json",...d.headers??{}},P={...St(d.principal),[ve.via]:d.via??"web"};Object.assign(m,P);let F=d.live===!0,B=d.presenceEveryMs,b=d.visible??Jo,T="connecting",x=i.statuses,O=i.tally,ne=[],E,de=[],p=()=>T==="online"&&E!==void 0?"held":T,D=()=>{let t=p();if(i.told!==t){i.told=t;for(let r of[...x])r(t)}},N=t=>{if(!(t===T||se)&&(T==="offline"&&t==="online"&&O.reconnects++,T=t,D(),t==="online"))for(let r of ne.splice(0))r.again()},U=t=>{if(se)return;let r=typeof t=="string"&&t.length>0?t:void 0,s=r!==E;if(E=r,oe(),!!s&&(D(),r===void 0)){for(let a of de.splice(0))a();ee&&clearTimeout(ee),un()}},oe=()=>{if(i.toldHeld!==E){i.toldHeld=E;for(let t of[...i.helds])t(E??null)}},ae=async(t,r)=>{let s;try{s=await w(t,r)}catch(a){throw $()||N("offline"),new et(a instanceof Error?a.message:String(a))}if(s.status===503&&await jo(s))return N("online"),s;if(_o.has(s.status))throw $()||N("offline"),new et(`The server is away (${s.status})`);return N("online"),s},be=async(t=!1)=>{let r=`${d.url}/graview/state?opFormat=${je.op}`,s=t?await w(r,{headers:m}):await ae(r,{headers:m});if(!s.ok)throw new Error((await s.json().catch(()=>({}))).error??`The server refused (${s.status})`);return await s.json()},H=d.state??await be(!0);F||(T="online"),E=typeof H.held=="string"&&H.held.length>0?H.held:void 0,oe();let Se=H.enabledModules??d.enabledModules,A=d.localApp?d.localApp(d.app):d.app,k=new Mn({schema:A.schema,mutations:A.mutations??[],invariants:A.invariants??[],...A.policy?{policy:A.policy}:{},...A.publishing?{publishing:A.publishing}:{},...A.modules?{modules:A.modules}:{},...Se?{enabledModules:Se}:{},...A.intelligence?{intelligence:A.intelligence}:{},...A.brand?.timeZone?{timeZone:A.brand.timeZone}:{},snapshot:H.snapshot,log:H.log,...H.horizon!==void 0?{horizon:H.horizon}:{},ids:qo(),...d.storeOptions??{}});Tn.served.add(k);let V=d.friction!==!1&&d.principal?.kind!=="visitor";V&&Fn(k,t=>{V&&w(`${d.url}${Gr}`,{method:"POST",headers:m,body:JSON.stringify({event:t})}).then(r=>void(V=r.status!==404&&r.status!==410),()=>{})});let ke=Cn(k),L=H.log.at(-1)?.seq??(H.horizon??0)-1,pe=Ct.of(H.log,{horizon:H.horizon??0}),W=null,M,q=new Map,Z=i.who,xe=!1,Pe=t=>{if(se)return;xe=!0;let r=Dn(new Map,t,Date.now(),Ht,W?.participant);M!==void 0&&r.delete(M);let s=r.size!==q.size;if(!s)for(let[a,f]of r)Vt(f,q.get(a))||(s=!0);if(q=r,!!s)for(let a of[...Z])a([...q.values()])},_=[],K=new Set,re=t=>{let r=_.indexOf(t);r>=0&&_.splice(r,1)},C=new Map,Fe=(t,r)=>{let s=C.get(t);s&&(C.delete(t),s.resolve({ops:r.filter(a=>a.batch===t),batch:t}))},J,Y=[],z=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(J)return Y.push({ops:t,drop:r}),[];let s=Math.min(...t.filter(h=>h.seq>L).map(h=>h.seq));if(Number.isFinite(s)&&s>L+1)return Y.push({ops:t,drop:r}),me(),[];let a=_.filter(h=>t.some(te=>te.batch===h)),f=[...new Set([...r,...a])].filter(h=>K.has(h)),y,S=_.filter(h=>!a.includes(h));try{y=k.rebase({confirmed:t,pending:S,drop:f}).confirmed}catch(h){if(!(h instanceof Ln))throw h;return Y.push({ops:t,drop:r}),me(),[]}for(let h of a)re(h);t.some(h=>h.seq>L)&&S.some(h=>!f.includes(h))&&O.rebases++,t.length>0&&(L=Math.max(L,...t.map(h=>h.seq)),pe.note(t));for(let h of f)K.delete(h);for(let h of a)Fe(h,t);return y},me=()=>{J||(J=Ce(be().then(t=>{if(Q(t)){Y=[];return}let r=new Set(t.log.map(f=>f.batch)),s=_.filter(f=>r.has(f));for(let f of s)re(f);let a=k.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[..._],drop:[...K].filter(f=>!_.includes(f))});K.clear();for(let f of a.pending)K.add(f.batch);L=t.log.at(-1)?.seq??(t.horizon??0)-1,pe=Ct.of(t.log,{horizon:t.horizon??0}),O.resyncs++;for(let f of s)Fe(f,t.log)}).then(()=>{J=void 0;let t=Y;Y=[];for(let{ops:r,drop:s}of t)z(r,s)},()=>{J=void 0,Y=[]})))},Q=t=>(typeof t.build=="string"&&pn(t.build),typeof t.version=="number"&&U(t.held),typeof t.version!="number"||t.version===H.version?!1:(Et(t.version),!0)),R=async t=>{let s=await(await ae(`${d.url}/graview/since?seq=${wt(t)}&opFormat=${je.op}`,{headers:m})).json();return Q(s)?[]:s.reset===!0?(me(),[]):s.ops??[]},Ve=async()=>{let t=await De();return J&&await J,t},De=async()=>{if(W&&!$()&&b()){let r=await(await ae(`${d.url}/graview/here?opFormat=${je.op}`,{method:"POST",headers:m,body:JSON.stringify({presence:W,seq:wt(L)})})).json();return Q(r)?[]:(typeof r.participant=="string"&&(M=r.participant),Pe(r.who??[]),z(r.ops??[]))}return z(await R(L))},ce=new Map,Oe=new Map,Ue=new Set,he=new Map,$e=new Set,Ce=t=>($e.add(t),t.finally(()=>$e.delete(t)).catch(()=>{}),t),Ke=Promise.resolve(),ye=0,Be=(t,r)=>{let s=Ke.then(()=>Je(t,r));return Ke=s.catch(()=>{}),s},kt=()=>new Promise((t,r)=>ne.push({again:t,give:r})),Je=async(t,r)=>{let s,a;for(;;){try{s=await ae(`${d.url}/graview/ops`,{method:"POST",headers:m,body:JSON.stringify({...t,opFormat:je.op})})}catch(h){if(!(h instanceof et)||j)throw h;if(await kt(),$())return tt(t,r);continue}if(a=await s.json().catch(()=>({})),s.status===503&&a.reason==="unavailable"&&typeof a.held=="string"&&!j){if(typeof a.version=="number"?Q(a):(U(a.held),!1))break;if(E!==void 0&&(Ft>0||F)){if(await new Promise(h=>de.push(h)),j)throw new ze("The client closed.");if($())return tt(t,r);continue}}let S;if(s.status===503&&a.reason==="unavailable"&&!j)S=an(d.backoff,ye++);else{if(ye=0,s.status!==429||j)break;S=Uo(s.headers.get("retry-after"),a.retryAfter)}if(await new Promise(h=>setTimeout(h,S)),$())return tt(t,r)}if(se||Q(a))throw new ze("The app was changed.");if(!s.ok){let S=a.error??`The server refused (${s.status})`;throw a.conflict?new fe(S,a.conflicts??[]):new Ge({reason:a.reason??Io[s.status]??"invalid",sentence:S,...a.wouldNeed?.length?{wouldNeed:a.wouldNeed}:{}})}let f=a.ops??[],y=f[0]?.seq;return y!==void 0&&y>L+1&&(f=await R(L)),r!==void 0&&(a.batch&&ce.set(r,a.batch),re(r)),z(f,r!==void 0?[r]:[]),{ops:a.ops??[],...a.batch?{batch:a.batch}:{}}},G,le=!1,j=!1,Ne=0,ie,We=0,Le=0,Ie=null,v=()=>{},X=new Promise(t=>{v=t}),$=()=>F&&le&&G?.readyState===zo,Ye=t=>{if(!$())return!1;try{return G.send(JSON.stringify(t)),!0}catch{return!1}},ln=(t=!1)=>{!W||!$()||!b()||!t&&Ie&&Vt(W,Ie)&&(B===void 0||Date.now()-Le<B)||Ye({t:"here",presence:W})&&(Ie=W,Le=Date.now())},Ae=new Set,ee,un=()=>{if(ee=void 0,E!==void 0)return;let t=[...C.entries()].filter(([r])=>Ae.has(r));Ae.clear();for(let[,r]of t)Ye(r.message)},fn=(t,r)=>{C.has(t)&&(Ae.add(t),ee&&clearTimeout(ee),ee=setTimeout(un,Math.max(0,r)))},Qr=t=>{C.has(t)&&Ae.add(t)},tt=(t,r)=>new Promise((s,a)=>{let f=r??`send-${++We}`,y=t.undo?{t:"undo",cid:f,batches:t.undo,...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.via?{via:t.via}:{},...Te(t)}:{t:"call",cid:f,calls:t.calls??[],...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.base?.length?{base:t.base}:{},...t.via?{via:t.via}:{},...Te(t)};if(C.set(f,{message:y,...r!==void 0?{mine:r}:{},resolve:s,reject:a}),Ae.size>0||E!==void 0){Ae.add(f);return}Ye(y)}),nt=(t,r)=>$()?tt(t,r):Be(t,r),Zr=t=>{switch(t.t){case"welcome":{if(pn(t.build),typeof t.version=="number"&&t.version!==H.version){Et(t.version);return}if(le=!0,Ne=0,typeof t.participant=="string"&&(M=t.participant),U(t.held),t.state?me():z(t.ops??[]),Ae.clear(),ee&&clearTimeout(ee),ee=void 0,E!==void 0)for(let r of C.keys())Ae.add(r);else for(let r of C.values())Ye(r.message);ln(!0),N("online"),v();return}case"ops":z(t.ops??[]);return;case"ack":{let r=C.get(t.cid);if(!r){z(t.ops??[]);return}C.delete(t.cid),ye=0,r.mine!==void 0&&(ce.set(r.mine,t.batch),re(r.mine)),z(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=C.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){E!==void 0?Qr(t.cid):fn(t.cid,an(d.backoff,ye++));return}C.delete(t.cid),r.reject(t.t==="conflict"?new fe(t.sentence,t.conflicts??[]):new Ge({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&fn(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":Pe(t.who??[]);return;case"held":U(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==H.version&&Et(t.version);return;case"reload":gn(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&G){let r=G;vn(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},se=!1,Pt=i.declarations,At=i.builds,pn=t=>{if(!(se||i.otherBuild!==void 0||!d.build||typeof t!="string"||t.length===0||t===d.build)){i.otherBuild=t;for(let r of[...At])r(t)}},mn=()=>{let t=[],r=0;for(let s of _){let a=he.get(s);a?t.push({calls:a.calls,...a.intent?{intent:a.intent}:{},...a.via?{via:a.via}:{},...Te(a),batch:s}):r++}return{carried:t,undos:r}},hn=(t,r)=>`${r} while ${t===1?"an undo of yours was":"undos of yours were"} on the way; ${t===1?"it was":"they were"} not made.`,yn=t=>{se=!0,W=null;let r=new ze(t);for(let a of C.values())a.reject(r);C.clear(),at&&clearInterval(at),j=!0,ie&&clearTimeout(ie),ee&&clearTimeout(ee),ge&&clearTimeout(ge);for(let a of ne.splice(0))a.give(r);for(let a of de.splice(0))a();let s=G;G=void 0,le=!1;try{s?.close(1e3,t)}catch{}v()};async function Et(t){if(se)return;if(!d.resolveApp){gn(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:s}=mn(),a=d.resolveApp,f=W;yn("The app was changed.");try{let y=await a(t),{state:S,...h}=d,te=await Kr({...h,app:y},r,"The app was changed while your changes were on the way.",i);f&&te.remote.presence.here(f);for(let it of[...Pt])it(te.remote,t);let ue=[...s>0?[rt(hn(s,"The app was changed"))]:[],...te.unheard()];for(let it of ue)for(let io of _e)io(it.sentence,it)}catch(y){let S=`The app was changed, but the new version could not be opened: ${y instanceof Error?y.message:String(y)}`;for(let h of _e)h(S,rt(S))}}function gn(t){if(se)return;let{carried:r,undos:s}=mn();yn(t);let a=!1;if(d.carry&&r.length>0)try{d.carry.storage.setItem(d.carry.key,JSON.stringify(r)),a=!0}catch{}let f=[];!a&&r.length>0&&f.push(`${t} ${r.length===1?"A change of yours was":`${r.length} changes of yours were`} not sent; make ${r.length===1?"it":"them"} again after the page reloads.`),s>0&&f.push(hn(s,"This app was updated"));for(let y of f)for(let S of _e)S(y,rt(y));(d.reloadPage??Ko)()}let wn=()=>{if(j||!F)return;let t=`${d.url.replace(/^http/,"ws").replace(/\/$/,"")}${Ur}`,{"content-type":r,...s}=m,a;try{a=d.socket?d.socket(t,s,[on]):ao(t,s)}catch{return bn()}G=a,le=!1,a.onopen=()=>{G===a&&a.send(JSON.stringify({t:"hello",seq:wt(L),protocol:st,wire:rn,opFormat:je.op,...d.build?{build:d.build.slice(0,64)}:{},...d.hostProtocol!==void 0?{hostProtocol:d.hostProtocol}:{}}))},a.onmessage=f=>{if(G!==a)return;let y;try{y=JSON.parse(String(f.data))}catch{return}Zr(y)},a.onclose=()=>vn(a),a.onerror=()=>{}},ge,Xr=()=>{xe=!1,ge&&clearTimeout(ge),ge=setTimeout(()=>{if(ge=void 0,xe||j)return;let t=new Map([...q].filter(([,r])=>r.held!=="socket"));if(t.size!==q.size){q=t;for(let r of Z)r([...q.values()])}},Ht),ge.unref?.()};function vn(t){if(G!==t)return;let r=le;G=void 0,le=!1,Ie=null,r&&(N("offline"),Xr()),bn()}let bn=()=>{if(j)return;let t=an(d.backoff,Ne);Ne++,ie=setTimeout(wn,t)},Sn=k.applyAll.bind(k),eo=k.undo.bind(k),to=k.previewAll.bind(k);k.previewAll=(t,r)=>to(t,{...d.principal?{author:d.principal}:{},...r});let _e=i.refusals,Qe=[],rt=t=>({reason:"invalid",sentence:t}),ot=i.conflicts,Rt=!1,kn,Tt=async(t,r)=>{if(r instanceof ze||se)return;let s=r instanceof Ge?r.refusal:Rn(r),a=s.sentence,f=r instanceof fe?kn?.yoursOf(k,he.get(t)?.calls??[]):void 0;re(t);try{z([],[t])}catch{}let y=he.get(t);he.delete(t);let S=y?.calls[0];if(S&&!(r instanceof fe)){let h=k.allMutations().find(ue=>ue.name===S.name)?.subject?.arg,te=h&&k.graph.getNode(S.args[h])?.kind;On(k,{type:"refused",act:S.name,code:s.reason,...te?{kind:te}:{}},d.principal)}if(r instanceof fe&&O.conflicts++,r instanceof fe&&!$()&&await Ve().catch(()=>[]),r instanceof fe&&J&&await J,r instanceof fe&&ot.size>0){let h=!1,te={sentence:a,conflicts:f?r.conflicts.map(ue=>ue.node===f.node&&ue.field===f.field?{...ue,yours:f.yours}:ue):r.conflicts,keepTheirs(){h=!0},useMine(){if(!(h||!y)){h=!0,Rt=!0;try{k.applyAll(f?[f.over(L)]:y.calls,{...y.intent?{intent:y.intent}:{},...y.via?{via:y.via}:{},...Te(y)})}finally{Rt=!1}}}};for(let ue of ot)ue(te);return}for(let h of _e)h(a,s)},no=(t,r)=>t.flatMap(s=>s.mutation?.name===En?[]:s.primitives.flatMap(a=>a.op==="splice-text"&&!r.has(a.id)&&!r.has(`${a.id}\0${a.field}`)?[{node:a.id,field:a.field,rev:L}]:[]));k.applyAll=(t,r)=>{let s=xn(k.log.all().filter(S=>K.has(S.batch))),a=Sn(t,{...d.principal?{author:d.principal}:{},...r}),f=t.map((S,h)=>{let te=a.minted?.[h];return te===void 0||S.args?.id!==void 0?S:{...S,mintedHint:te}});_.push(a.batch),K.add(a.batch),he.set(a.batch,{calls:f,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...Te(r)});let y=Rt?[]:[...pe.baseFor(a.ops,s,(S,h)=>k.collaborative(S,h)),...no(a.ops,s)];return Oe.set(a.batch,Ce(nt({calls:f,...r?.intent?{intent:r.intent}:{},batch:a.batch,...y.length>0?{base:y}:{},...r?.via?{via:r.via}:{},...Te(r)},a.batch).catch(S=>Tt(a.batch,S)))),a},k.apply=(t,r)=>k.applyAll([t],r),k.undo=(t,r)=>{let s=typeof t=="string"?[t]:t,a=eo(s.map(y=>ce.get(y)??y),{...d.principal?{author:d.principal}:{},...r});_.push(a.batch),K.add(a.batch);let f=Promise.allSettled(s.map(y=>Oe.get(y)));return Oe.set(a.batch,Ce(f.then(()=>{let y=s.filter(S=>!Ue.has(S));if(y.length===0){re(a.batch),he.delete(a.batch),z([],[a.batch]);return}return nt({undo:y.map(S=>ce.get(S)??S),...r?.intent?{intent:r.intent}:{},batch:a.batch,...r?.via?{via:r.via}:{},...Te(r)},a.batch)}).catch(y=>Tt(a.batch,y)))),a};let ro=async(t,r={})=>{xt++;try{return(await Ce(nt({calls:t,...r}))).ops}finally{xt--}},xt=0,Pn={here(t){W=t,ln()},onWho(t){return Z.add(t),q.size>0&&t([...q.values()]),()=>{Z.delete(t)}},leave(){if(!W)return;let t=JSON.stringify({participant:M??W.participant});if(W=null,Ye({t:"bye"}))return;let r=globalThis.navigator?.sendBeacon;r?r.call(globalThis.navigator,`${d.url}/graview/leave${l!==void 0?`?${qe.param}=${encodeURIComponent(l)}`:""}`,t):w(`${d.url}/graview/leave`,{method:"POST",headers:m,body:t}).catch(()=>{})}},Ft=d.pollMs??800,at=Ft>0&&typeof setInterval=="function"?setInterval(()=>{$()||Ve().catch(()=>{})},Ft):null;if(F){wn();let t;await Promise.race([X,new Promise(r=>t=setTimeout(r,d.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!se){let t=[],r=new Set(k.log.all().map(s=>s.batch));for(let s of n)if(!(s.batch!==void 0&&r.has(s.batch)))try{k.applyAll(s.calls,{...s.intent?{intent:s.intent}:{},...s.batch?{batch:s.batch}:{},...s.via?{via:s.via}:{},...Te(s)})}catch(a){t.push(No(s,a))}t.length>0&&Qe.push(rt(`${o} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}let An=new Map,oo=()=>({store:k,author:d.principal,appliedAll:Sn,pending:_,provisional:K,asked:he,answers:Oe,letGo:Ue,sent:(t,r)=>Ce(nt({calls:r,batch:t},t).catch(s=>Tt(t,s))),settle:re,land:z,seen:()=>L,gone:()=>j||se});return{remote:{store:k,typing(t,r){let s=`${t}\0${r}`,a=An.get(s);return a||(a=(__graviewPreload(import.meta.url,["./chunk.RQOX5YDW.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.AVBTPSQF.js")).then(f=>(kn=f,f.typingOf(t,r,f.wireOf(oo())))),An.set(s,a)),a},version:H.version,migrated:H.migrated??[],send:ro,pull:Ve,onRefusal(t){_e.add(t);let r=Qe;Qe=[];for(let s of r)t(s.sentence,s);return()=>_e.delete(t)},onDeclaration(t){return Pt.add(t),()=>Pt.delete(t)},onBuild(t){return At.add(t),i.otherBuild!==void 0&&t(i.otherBuild),()=>At.delete(t)},onConflict(t){return ot.add(t),()=>ot.delete(t)},revision:(t,r)=>pe.of(t,r),seq:()=>L,participant:()=>M,transport:()=>$()?"socket":"poll",status:p,onStatus(t){return x.add(t),()=>x.delete(t)},held:()=>E,onHeld(t){return i.helds.add(t),E!==void 0&&t(E),()=>i.helds.delete(t)},counters:()=>({...O}),who:()=>[...q.values()],pending:()=>_.length+xt,async settled(){for(;$e.size>0;)await Promise.allSettled([...$e])},presence:Pn,close(){at&&clearInterval(at),ke(),Pn.leave(),j=!0,ie&&clearTimeout(ie),ee&&clearTimeout(ee),ge&&clearTimeout(ge);for(let r of ne.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of de.splice(0))r();let t=G;G=void 0,le=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=Qe;return Qe=[],t}};function ao(t,r){let s=globalThis.WebSocket;if(!s)throw new Error("This runtime has no WebSocket; the client polls instead.");let a=typeof globalThis.document<"u",f=d.subprotocol?[on]:[];if(!a)try{return new s(t,{headers:r,...f.length>0?{protocols:f}:{}})}catch{}let y=new URL(t);for(let[S,h]of Object.entries(P))y.searchParams.set(S,h);return l!==void 0&&y.searchParams.set(qe.param,l),f.length>0?new s(y.toString(),f):new s(y.toString())}}function Uo(e,n,o=Date.now()){let i,l=e?.trim();if(l)if(/^\d+(\.\d+)?$/.test(l))i=Number(l)*1e3;else{let w=Date.parse(l);Number.isFinite(w)&&(i=Math.max(0,w-o))}let u=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,d=u!==void 0&&u<50&&i!==void 0&&Math.abs(u*1e3-i)<1e3;return u!==void 0&&!d?u:i??1e3}function Ko(){globalThis.location?.reload?.()}function Jo(){return globalThis.document?.visibilityState!=="hidden"}function an(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:o=250,max:i=1e4,factor:l=2}=e??{};return Math.min(i,o*l**n)*(.75+Math.random()*.5)}function St(e){let n={};if(!e)return n;e.id&&(n[ve.seat]=e.id),e.roles?.length&&(n[ve.roles]=e.roles.join(",")),e.kind!=="human"&&(n[ve.kind]=e.kind),e.name&&(n[ve.name]=encodeURIComponent(e.name));let o=e.onBehalfOf;return o?.id&&(n[ve.for]=o.id),o?.roles?.length&&(n[ve.forRoles]=o.roles.join(",")),o?.name&&(n[ve.forName]=encodeURIComponent(o.name)),n}var Jr="/graview/views";function sn(e){let n=e.fetch??fetch,o=vt(e.url,e.headers),i=o.url,l={"content-type":"application/json",...e.principal?St(e.principal):{},...o.headers},u=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??dt.may}:dt,d=new Set,w=b=>{if(JSON.stringify(b)!==JSON.stringify(u)){u=b;for(let T of d)T()}},m=async(b,T)=>{let x=await n(`${i}${e.path??Jr}`,{method:b,headers:l,...T!==void 0?{body:JSON.stringify(T)}:{}}),O=await x.json();if(!x.ok)throw new Error(O.error??`The store answered ${x.status}.`);w({hidden:O.hidden??[],removed:O.removed??[],may:O.may??dt.may})},P=()=>m("GET"),F=e.state?Promise.resolve():P().catch(()=>{}),B=e.pollMs?setInterval(()=>void P().catch(()=>{}),e.pollMs):void 0;return{ready:F,refresh:P,close:()=>clearInterval(B),current:()=>u,onChange(b){return d.add(b),()=>void d.delete(b)},hide:b=>m("POST",{hide:b}),show:b=>m("POST",{show:b}),remove:(b,T)=>m("POST",{remove:b,...T?{about:T}:{}}),async restore(b){let T=u.removed.find(x=>x.name===b)?.lens;await m("POST",{restore:b}),T&&await e.onDeclaration?.()},async lens(b){await m("POST",{lens:b}),await e.onDeclaration?.()}}}var cn=document.getElementById("graview-app"),dn=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),Yr=dn?(__graviewPreload(import.meta.url,["./chunk.LLYRFVIN.js","./chunk.2K4TT2BV.js","./chunk.XOZU4OFA.js","./chunk.GLWSVSQL.js","./chunk.HUJ6YTWE.js","./chunk.XR6YR6RV.js","./chunk.MSWWWLEA.js","./chunk.UITT6JWW.js","./chunk.A5PDXNY6.js","./chunk.VNDKKTED.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.Z2ERZ4S6.js")):He("pages");try{dn?await Yo(decodeURIComponent(dn[1])):await Qo()}catch(e){let n=document.createElement("pre");n.setAttribute("role","alert"),n.style.cssText="margin:2rem;font:14px/1.5 ui-monospace,monospace;white-space:pre-wrap",n.textContent=e instanceof Error?e.message:String(e),cn.replaceChildren(n),window.__graviewFailed=n.textContent}async function Yo(e){let n=await fetch(`/graview/document?form=${encodeURIComponent(e)}`),o=await n.json();if(!n.ok)throw new Error(o.error??`The preview server did not hand over the form (${n.status}).`);let i=await pt(o);if(!i.ok)throw new Error(ct(i.findings));let l=i.app,u=o.principal,d=await bt({app:l,url:location.origin,principal:u,...o.state?{state:o.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=l.forms?.[e]?.title??l.name;let{mount:w}=await Yr;window.__graview=w(cn,{app:l,form:e,principal:u,remote:d,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function Qo(){let e=await fetch("/graview/document");if(!e.ok)throw new Error(`The preview server did not hand over the document (${e.status}).`);let n=await e.json(),i=await(async m=>{if(typeof m.module=="string")return(await import(m.module)).app;let P=await pt(m);if(!P.ok)throw new Error(ct(P.findings));return P.app})(n);if(!i||typeof i!="object"||!("schema"in i))throw new Error("The app module the preview server handed does not export an app.");let l=n.principal,u=await bt({app:i,url:location.origin,principal:l,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=i.name;let d,w=sn({url:location.origin,principal:l,...n.views?{state:n.views}:{},onDeclaration:async()=>{let m=await(await fetch("/graview/document")).json();if(typeof m.module=="string")return;let P=await pt(m);P.ok&&d?.setApp(P.app,u)}});await Promise.all([Yr,w.ready]),d=nn(cn,{app:i,remote:u,principal:l,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:i.name,heading:1,keptViews:w,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=d,d.drawn().then(()=>{window.__graviewReady=!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 jt,b as lr,c as ur,d as fr,e as pr,f as qt,g as mr,h as zt}from"./chunk.3FON2Y72.js";import{a as uo}from"./chunk.75GVFX7L.js";import{a as Gt,b as yr,c as gr,d as wr,e as Ut,f as vr,g as br,h as Sr,i as Ar,j as Pr,k as kr,l as Er,m as Rr,n as Tr,o as Ye}from"./chunk.7V56P2A7.js";import{b as hr}from"./chunk.2B6P4GPS.js";import{a as Ct}from"./chunk.Q5WEOX3Q.js";import{a as Lt,h as Bn}from"./chunk.WKI5INH7.js";import{k as lt}from"./chunk.NHTGAP3G.js";import{B as ir,G as sr,K as cr,L as dr,h as er,k as tr,l as nr,m as It,n as rr,p as or,t as ar,y as _t}from"./chunk.AI34V6WV.js";import{c as lo}from"./chunk.G4ULQK64.js";import{Aa as Un,Ba as Kn,Ca as Jn,Ea as Yn,Fa as Qn,G as Wt,Ha as Zn,Ia as Nt,La as Xn,Oa as pt,T as Wn,Z as Nn,a as Dn,b as ut,c as ft,ga as In,ha as _n,j as $n,ja as jn,m as $t,xa as qn,ya as zn,za as Gn}from"./chunk.M7RESZB6.js";import{a as xe}from"./chunk.SDO3U72B.js";import{Bd as Cn,Cd as Ln,Ed as dt,Ib as En,Kb as Rn,ae as Te,be as Mn,ce as Hn,he as Ht,ie as Vt,jb as qe,je as Bt,me as Vn,ne as Dt,rc as Mt,sc as Tn,td as xn,ub as ct,ud as Fn,zb as kn,zd as On}from"./chunk.DZZL5IDD.js";import"./chunk.FQLNBIQ5.js";import{b as Be}from"./chunk.AJZBJBMO.js";async function mt(e,n={}){let o=e.compiled===void 0||!po(e.compiled,e.document)?void 0:Bn(e.compiled,n);if(o?.ok)return o;let{compileDocumentWithoutCheck:i}=await fo();return i(e.document,n)}var xr,fo=()=>xr??=(__graviewPreload(import.meta.url,["./chunk.CGALLZ54.js","./chunk.WKI5INH7.js","./chunk.QIPASE42.js","./chunk.OWT3VVOT.js","./chunk.NHTGAP3G.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.Y4S7CDRB.js")).catch(e=>{throw xr=void 0,e});function po(e,n){let o=typeof e=="object"&&e!==null?e.document:void 0,i=n;if(typeof i=="string")try{i=JSON.parse(i)}catch{return!1}return o!==void 0&&Ct(Lt(o).document)===Ct(Lt(i).document)}var d=Be(Wt(),1);var yt=Be(Wt(),1),Kt="data-graview-drawn",mo=200,Fr=50,ho=1e4,ht=()=>typeof performance<"u"?performance.now():Date.now();function yo(e){let n=[...e.querySelectorAll("img")];for(let o of e.querySelectorAll("[data-worker-view]"))o.shadowRoot&&n.push(...o.shadowRoot.querySelectorAll("img"));return n}function go(e,n){if(e.ownerDocument.fonts?.status==="loading"||zn()>0||Jn(n)>0||e.querySelector('[aria-busy="true"]')||yo(e).some(i=>!i.complete&&i.loading!=="lazy"))return!1;for(let i of e.querySelectorAll("[data-worker-view-place]"))if(!i.querySelector("[data-worker-view][data-worker-view-drawn], [data-worker-view][data-worker-view-failed]"))return!1;return!0}function Or(e){let n=e.querySelector("[data-embed-content]"),o=[...e.querySelectorAll("[data-worker-view]")].map(i=>`${i.offsetWidth}x${i.offsetHeight}`);return`${e.scrollWidth}x${e.scrollHeight}|${n?`${n.scrollWidth}x${n.scrollHeight}`:""}|${o.join(",")}`}function wo(e,n,o,i){e.removeAttribute(Kt);let l=e.ownerDocument.defaultView;if(!l)return()=>{};let u=ht(),c=u,v=Or(e),m=!1,E,F=typeof MutationObserver>"u"?void 0:new MutationObserver(x=>{x.some(O=>!(O.target===e&&O.attributeName===Kt))&&(c=ht())});F?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let W=()=>{m=!0,F?.disconnect(),E!==void 0&&clearTimeout(E)},b=x=>{let O=!1,oe=()=>{O||(O=!0,x())};typeof l.requestAnimationFrame=="function"&&l.requestAnimationFrame(()=>setTimeout(oe,0)),setTimeout(oe,100)},T=()=>{if(m)return;let x=Or(e);x!==v&&(v=x,c=ht());let O=ht();if(go(e,i)&&O-c>=mo||O-u>=ho){b(()=>{m||(W(),e.setAttribute(Kt,n),Qn(),o())});return}E=setTimeout(T,Fr)};return E=setTimeout(T,Fr),W}function Cr(e,n,o,i,l){Yn();let u=(0,yt.useRef)({place:o,onDrawn:i});u.current={place:o,onDrawn:i},(0,yt.useLayoutEffect)(()=>{l&&Kn(l);let c=E=>wo(E,u.current.place.path,()=>u.current.onDrawn?.(u.current.place),l);if(e.current)return c(e.current);let v,m=!1;return queueMicrotask(()=>{!m&&e.current&&(v=c(e.current))}),()=>{m=!0,v?.()}},[n,e,l])}var we=Be(Wt(),1),Qe,vo=xe(()=>(__graviewPreload(import.meta.url,["./chunk.NJSK3UO2.js","./chunk.DEAP3H2L.js","./chunk.FULEUL34.js","./chunk.L3WTKQQL.js","./chunk.QDWSU47A.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.VACKSKGJ.js"))),Lr=()=>vo().then(e=>void(Qe=e),()=>new Promise(e=>setTimeout(e,2e3)).then(Lr)),Jt=qn(Lr),Mr=e=>!!e&&Qe===void 0;function Yt({onReady:e,fetch:n}){return(0,we.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var bo=0;function Hr(e){let[n,o]=(0,we.useState)(()=>Qe);(0,we.useEffect)(()=>{if(!e||n)return;let u=!1;return Jt().then(()=>{u||o(Qe)}),()=>{u=!0}},[e,n]);let i=(0,we.useMemo)(()=>bo+=1,[e]);return{over:(0,we.useMemo)(()=>{let u=n??Qe;if(!e||!u)return;let{source:c,worker:v,...m}=e,E={...m,worker:v??{source:c},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:F=>u.registerWorkerView(F,E)}},[e,n]),n:i}}var Dr=Be(uo(),1),$=Be(lo(),1);var w=Be(Wn(),1);function gt(e,n={}){let o=Nt(e);return{Face:o.part((l,u)=>(0,d.createElement)(l,u),n),fetch:()=>o.load().then(()=>{}),here:()=>o.current!==void 0||o.failed}}var Xt=e=>Promise.all([e,cr()]).then(([n])=>n),$r=xe(()=>(__graviewPreload(import.meta.url,["./chunk.VC3V7HLL.js","./chunk.CY3ELWCM.js","./chunk.RMR24LFJ.js","./chunk.OWOOKLIU.js","./chunk.KMV6PJFL.js","./chunk.NAD7ZXYP.js","./chunk.2GEJNG2U.js","./chunk.HJCQ6I3S.js","./chunk.22BZU7ME.js","./chunk.2N4Z5K5S.js","./chunk.Y4FZKUOK.js","./chunk.TIALD6SC.js","./chunk.QHY5NVYH.js","./chunk.U6ZRJKVM.js","./chunk.PLTH2LW5.js","./chunk.66P5IDTH.js","./chunk.AJSUHPBE.js","./chunk.KDXU5DT3.js","./chunk.M4AYA2PL.js","./chunk.H5S7OL2U.js","./chunk.PZQNR4KZ.js","./chunk.W4BKYSZX.js","./chunk.U5P23GO7.js","./chunk.7V56P2A7.js","./chunk.2B6P4GPS.js","./chunk.NOGGSLVG.js","./chunk.GZHZLJBF.js","./chunk.UKQUUPKE.js","./chunk.OJGHDWI6.js","./chunk.DDUCIUVW.js","./chunk.NUYA4BWI.js","./chunk.OKZT2QBM.js","./chunk.ACTXR2MI.js","./chunk.AI34V6WV.js","./chunk.G4ULQK64.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.LGRLVJGS.js"))),So=xe(()=>(__graviewPreload(import.meta.url,["./chunk.IQPILSV3.js","./chunk.IQ3PRWGO.js","./chunk.YP2QSPXU.js","./chunk.VIH5AX7S.js","./chunk.Q355UPFG.js","./chunk.VC3V7HLL.js","./chunk.BZMQDEIY.js","./chunk.ELTV44HU.js","./chunk.CY3ELWCM.js","./chunk.I77ZGIFE.js","./chunk.OWOOKLIU.js","./chunk.RD2X25XB.js","./chunk.KMV6PJFL.js","./chunk.SWMDFXUX.js","./chunk.A3ZC2JBO.js","./chunk.NAD7ZXYP.js","./chunk.2GEJNG2U.js","./chunk.4TX6VCBT.js","./chunk.TIALD6SC.js","./chunk.66P5IDTH.js","./chunk.UQQKDBIH.js","./chunk.AJSUHPBE.js","./chunk.LAYQ5PFS.js","./chunk.KDXU5DT3.js","./chunk.O2BHPYA4.js","./chunk.H5S7OL2U.js","./chunk.BJUUSIQY.js","./chunk.PZQNR4KZ.js","./chunk.W4BKYSZX.js","./chunk.XOZU4OFA.js","./chunk.Y2YYH3JN.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.SGCW2XRC.js","./chunk.ZN3PUM2I.js","./chunk.QIPASE42.js","./chunk.EVBCEEQ4.js","./chunk.OWT3VVOT.js","./chunk.NHTGAP3G.js","./chunk.GZHZLJBF.js","./chunk.UKQUUPKE.js","./chunk.OJGHDWI6.js","./chunk.DDUCIUVW.js","./chunk.NUYA4BWI.js","./chunk.OKZT2QBM.js","./chunk.ACTXR2MI.js","./chunk.AI34V6WV.js","./chunk.G4ULQK64.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.PD2DECOP.js"))),Ao=xe(()=>(__graviewPreload(import.meta.url,["./chunk.IQPILSV3.js","./chunk.IQ3PRWGO.js","./chunk.YP2QSPXU.js","./chunk.VIH5AX7S.js","./chunk.Q355UPFG.js","./chunk.VC3V7HLL.js","./chunk.BZMQDEIY.js","./chunk.ELTV44HU.js","./chunk.CY3ELWCM.js","./chunk.I77ZGIFE.js","./chunk.OWOOKLIU.js","./chunk.RD2X25XB.js","./chunk.KMV6PJFL.js","./chunk.SWMDFXUX.js","./chunk.A3ZC2JBO.js","./chunk.NAD7ZXYP.js","./chunk.2GEJNG2U.js","./chunk.4TX6VCBT.js","./chunk.TIALD6SC.js","./chunk.66P5IDTH.js","./chunk.UQQKDBIH.js","./chunk.AJSUHPBE.js","./chunk.LAYQ5PFS.js","./chunk.KDXU5DT3.js","./chunk.O2BHPYA4.js","./chunk.H5S7OL2U.js","./chunk.BJUUSIQY.js","./chunk.PZQNR4KZ.js","./chunk.W4BKYSZX.js","./chunk.XOZU4OFA.js","./chunk.Y2YYH3JN.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.SGCW2XRC.js","./chunk.ZN3PUM2I.js","./chunk.QIPASE42.js","./chunk.EVBCEEQ4.js","./chunk.OWT3VVOT.js","./chunk.NHTGAP3G.js","./chunk.GZHZLJBF.js","./chunk.UKQUUPKE.js","./chunk.OJGHDWI6.js","./chunk.DDUCIUVW.js","./chunk.NUYA4BWI.js","./chunk.OKZT2QBM.js","./chunk.ACTXR2MI.js","./chunk.AI34V6WV.js","./chunk.G4ULQK64.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.OUPURRDE.js"))),Wr=gt(()=>Xt($r().then(e=>e.SceneFace)),{what:"This view"}),Nr=gt(()=>$r().then(e=>e.SceneKeeping),{quiet:!0}),Ir=gt(()=>Xt(So().then(e=>e.PagesContent)),{what:"This page"}),_r=gt(()=>Xt(Ao().then(e=>e.PictureFace)),{what:"This picture"}),Po=Wr.Face,ko=Nr.Face,Eo=Ir.Face,Ro=_r.Face;function De(...e){let n=e.length>0?e:["scene","pages","picture"],o=new Set(n.flatMap(jr));return Promise.all([...[...o].map(i=>i.fetch()),or()]).then(()=>{},()=>{})}var jr=e=>e==="pages"?[Ir]:e==="picture"?[_r]:[Wr,Nr],qr=e=>jr(e).every(n=>n.here()),To=150,Qt=0;function Vr(e,n){if(qr(e))return n();let o=++Qt,i=()=>{o===Qt&&(Qt+=1,n())};De(e).then(i),setTimeout(i,To)}var xo=768;function Fo(e,n){let o=n!==null&&n>=xo;(0,d.useEffect)(()=>{if(!o||e==="picture")return;let i=e==="pages"?"scene":"pages";if(qr(i))return;let l=globalThis,u=()=>void De(i),c=()=>{},v=Zn(()=>{if(l.requestIdleCallback&&l.cancelIdleCallback){let m=l.requestIdleCallback(u,{timeout:4e3});c=()=>l.cancelIdleCallback?.(m)}else{let m=setTimeout(u,1500);c=()=>clearTimeout(m)}});return()=>(v(),c())},[e,o])}function Oo({asked:e,shown:n,onDrawn:o}){return(0,d.useLayoutEffect)(()=>o(e,n),[e,n,o]),null}function Co({auto:e,scene:n}){return(0,w.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${Ut}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var Lo=Nt(xe(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,w.jsx)(e.StudioPlace,{...n}),{quiet:!0});function zr(e,n,o,i,l){return qt(e,pr(n?ft(n):l??Dn,i),o)}function en(e){return e&&ft(e).overview?"graview":"scene"}function Br(e,n){if(n.homeView?.()===void 0)return!1;let o=e.pages?.first?.trim();return o===void 0||o===""||o==="/"||o.toLowerCase()==="home"}function Gr(e){let[,n]=(0,d.useState)(!1),o=(0,d.useCallback)(()=>n(!0),[]),i=(0,d.useRef)(!1);return e.at&&!wt?(0,w.jsx)(Yt,{onReady:o,fetch:tn}):!i.current&&Mr(e.draftView)?(0,w.jsx)(Yt,{onReady:o,fetch:Jt}):(i.current=!0,(0,w.jsx)(Mo,{...e}))}function Mo(e){let{app:n,stop:o,bar:i=!0,standing:l="Everything is in order",principal:u,heading:c=2}=e,{rootRef:v,scope:m,css:E,scheme:F,store:W,presence:b,brand:T,auto:x,height:O}=vr(e),oe=Hr(e.draftView),R=gr(e,dr,oe.over),[le]=(0,d.useState)(Un),p=e.basePath===void 0?{}:{basePath:e.basePath},[B]=(0,d.useState)(It),D=e.notices??B,z=g=>Ht(g,p),ie={...e.routing?{routing:e.routing}:{},...p},[se]=(0,d.useState)(()=>{let g=e.at?.face;if(g)return g;let Q=o===void 0&&Br(n,R)?"pages":en(o),K=jt({...ie,face:Q});return e.face===void 0&&e.onOpening?.(K),K}),[be,H]=(0,d.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&o===void 0&&lr(ie)&&Br(n,R)),Se=(0,d.useRef)(e.onFace);Se.current=e.onFace,(0,d.useLayoutEffect)(()=>{be&&(Se.current?.("pages"),H(!1))},[be]);let A=be?"pages":e.face??se,k=n.schema.kinds,V=e.routing==="address",Ae=(0,d.useMemo)(()=>e.at?wt.settleAt(e,W.seenBy(u??{kind:"human"}),R.places()):void 0,[]),C=(0,d.useMemo)(()=>_n(R,n.schema),[R,n.schema]),me=(0,d.useMemo)(()=>{let g=Ae?.stop??(V?ur(e.basePath):void 0)??o;return A==="scene"&&g===void 0&&C===void 0&&(e.path===void 0||Zt(e.path))?zt(void 0):zr(A,g,k,R.places(),C)},[]),[N]=(0,d.useState)(A);(0,d.useEffect)(()=>{N!=="pages"&&In(R)},[N,R]);let L=(0,d.useRef)(void 0),q=g=>g===void 0||Zt(g)?"/":g;L.current??={path:q(Ae?.path??(V?A==="pages"?(Vt(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==L.current.asked&&(L.current={path:q(e.path),asked:e.path});let Z=(0,d.useRef)(e.onNavigate);Z.current=e.onNavigate;let Oe=(0,d.useCallback)((g,Q)=>{L.current.path=g,Z.current?.(g,Q)},[]),{at:he,setAt:j,steering:G,steer:ae}=Er(L.current.path),M=(0,d.useContext)(Ur);M&&(M.pages=()=>L.current.path);let[$e]=(0,d.useState)(()=>({})),J=M??$e,ce=(0,d.useMemo)(()=>tr(D),[D]),I=(0,d.useRef)(void 0),Pe=(0,d.useCallback)(g=>void(L.current.path=g),[]),X=er(v),[Ce,ee]=(0,d.useState)(!1),Xe=e.pagesBelow!==void 0&&X!==null&&X<e.pagesBelow&&(A==="scene"||A==="graview")&&!Ce,P=Xe?"pages":A,Le=(0,d.useRef)(!1);Le.current=Ce&&e.pagesBelow!==void 0&&X!==null&&X<e.pagesBelow&&(A==="scene"||A==="graview"),M&&(M.shown=P);let Me=(0,d.useRef)(A==="graview"?"graview":"scene");(P==="scene"||P==="graview")&&(Me.current=P),(0,d.useState)(()=>{if(!V||typeof window>"u"||P==="pages"||P==="picture")return;let{pathname:g,search:Q,hash:K}=window.location;Vt(g,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${z(Te)}${Q}${K}`)}),wr(v,P,e.onIntrinsicHeight),Fo(P,X);let te=Rr(e.onError,P),He=Tr(e.onReady,P),ke=(0,d.useRef)(e.onFaceDrawn);ke.current=e.onFaceDrawn;let et=(0,d.useCallback)((g,Q)=>{He(Q),ke.current?.(g)},[He]),[We,Pt]=(0,d.useState)(null),tt=R.places(),Ne=(0,d.useRef)({shown:P,onFace:e.onFace});Ne.current={shown:P,onFace:e.onFace};let _=(0,d.useCallback)((g,Q,K)=>{if(V){I.current?.(g,Q,K);return}Ne.current.onFace?.(g),Z.current?.(g==="pages"?Q??L.current.path:Te,"push")},[V]),[ye,U]=(0,d.useState)(void 0);(0,d.useEffect)(()=>{P==="pages"&&U(void 0)},[P]);let Ie=(0,d.useRef)(o);(0,d.useEffect)(()=>{Ie.current!==o&&(Ie.current=o,U(void 0))},[o]);let Ee=(0,d.useCallback)(g=>{if(Ne.current.shown==="pages"){if(ee(!0),U(g),A==="scene"||A==="graview"){Vr(A,()=>{V?window.history.pushState(null,"",`${z(Te)}${g??""}`):Z.current?.(Te,"push")});return}Vr(Me.current,()=>_(Me.current,void 0,g))}},[V,A,e.basePath,_]),Ve=(0,d.useCallback)(g=>{if(Ne.current.shown==="pages"){G.go.current||(L.current.path=g),ae(g);return}if(L.current.path=g,j(g),Le.current){ee(!1),V?window.history.pushState(null,"",z(g)):Z.current?.(g,"push");return}_("pages",g)},[G,ae,j,_,V,e.basePath]),Ke=R.arrangement?.(),ue=P==="pages",Re=e.hrefOf,_e=Re??(V?z:void 0),Y=(0,d.useMemo)(()=>({open:Ve,...Re?{href:Re}:V?{href:g=>Ht(g,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[Ve,V,e.basePath,Re]);return(0,w.jsxs)("section",{ref:v,className:m,"aria-label":e.label??n.name,"data-graview-embed":P,"data-graview-scheme":F,...Xe?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:O,minHeight:x?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,w.jsx)("style",{children:E}),(0,w.jsxs)(Xn.Provider,{value:te,children:[(0,w.jsx)(br,{rootRef:v,board:D,onReport:e.onReport,where:()=>P==="pages"?Sr(he):P==="picture"?{place:"picture"}:nr(J.view?.focusId)}),(0,w.jsx)(yr,{rootRef:v,firstLook:e.firstLook,app:ir(T??{name:n.name},n.schema)}),(0,w.jsx)(Ye,{module:"@graview/react",report:te,content:!0,children:(0,w.jsx)(Gn.Provider,{value:le,children:(0,w.jsx)(Nn,{store:W,views:R,initialView:me,scheme:F,...Ar(e,b,T),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,w.jsxs)(rr.Provider,{value:ce,children:[(0,w.jsx)(Do,{face:P,stop:ye??o,kinds:k,places:tt,opens:C}),(0,w.jsx)(Ho,{into:J}),(0,w.jsx)(Vo,{rootRef:v,face:A,shown:P,path:he,stop:o,draft:oe.n,onDrawn:e.onDrawn,parts:le}),V?(0,w.jsx)(fr,{pagesWere:Ae?.path,basePath:e.basePath,shown:P,onFace:e.onFace,toggle:I,kinds:k,places:tt,opens:C,landed:Pe}):null,i&&P!=="picture"?(0,w.jsx)(Ye,{module:"@graview/embed",report:te,children:(0,w.jsx)(Pr,{name:T?.name??n.name,heading:c,named:Gt(i).name!==!1,faces:Gt(i).faces===!1?void 0:{scene:{label:Mn(Ke),current:!ue,go:()=>Ee(),reach:()=>void De(Me.current)},pages:{label:Hn(Ke),current:ue,go:()=>Ve(L.current.path),reach:()=>void De("pages")}},at:ue?he:null,without:e.pages?.without(),home:{..._e?.("/")!==void 0?{href:_e("/")}:{},go:()=>Ve("/"),current:ue&&he.split("?")[0]==="/"},reach:{..._e?{href:_e}:{},go:g=>Ve(g.path)},standing:l,hostActions:e.hostActions,barActions:e.barActions,keeping:ue?void 0:(0,w.jsx)($o,{app:n,studio:e.studio,report:te}),onFind:Pt,switch:e.switch})}):null,(0,w.jsx)(ar.Provider,{value:We,children:(0,w.jsx)(Ye,{module:P==="pages"||P==="picture"?"@graview/pages":"@graview/react",report:te,content:!0,children:(0,w.jsxs)(d.Suspense,{fallback:(0,w.jsx)(Co,{auto:x,scene:P!=="pages"&&P!=="picture"}),children:[P==="picture"?(0,w.jsx)(Ro,{scope:m,store:W,views:R,as:(o?ft(o).within?.view:void 0)??""}):P==="pages"?(0,w.jsx)(Eo,{store:W,views:R,presence:b,auto:x,brand:T,steering:G,overview:Ee,scope:m,titleLevel:kr(c),quickAsk:_t(e.quickAsk),props:{...e,onNavigate:Oe,...V?{}:{path:L.current.path}}}):(0,w.jsx)(jn.Provider,{value:Y,children:(0,w.jsx)(Po,{address:V,auto:x,scheme:F,scope:m,quickAsk:_t(e.quickAsk)})}),(0,w.jsx)(Oo,{asked:A,shown:P,onDrawn:et})]})},P)})]})})})})]})]})}var Zt=e=>e.split(/[?#]/)[0]===Te,Ur=(0,d.createContext)(null);function Ho({into:e}){return e.view=pt().view,null}function Vo({rootRef:e,face:n,shown:o,path:i,stop:l,draft:u,onDrawn:c,parts:v}){let{view:m}=pt(),E=o==="scene"||o==="graview",F=ut(m),{pan:W,...b}=m,T=m.pan?ut(b):F,x={face:n,path:E?Te:o==="picture"?l??"#":i,stop:F};return Cr(e,`${o} ${E?T:x.path} ${u}`,x,c,v),null}var wt,Bo=xe(()=>(__graviewPreload(import.meta.url,["./chunk.3FON2Y72.js","./chunk.AI34V6WV.js","./chunk.G4ULQK64.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.SVPKUWZU.js"))),tn=()=>Bo().then(e=>void(wt=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(o),e()},o=setTimeout(n,1e4);window.addEventListener("online",n)}).then(tn));function Do({face:e,stop:n,kinds:o,places:i,opens:l}){let{view:u,go:c}=pt(),v=(0,d.useRef)({face:e,stop:n});return(0,d.useLayoutEffect)(()=>{let m=v.current.stop!==n,E=v.current.face!==e,F=v.current.face==="pages";if(v.current={face:e,stop:n},!m&&!E||e==="pages"||e==="picture")return;let W=(m||F)&&n!==void 0?zr(e,n,o,i):F&&mr(u)?qt(e,zt(l),o):e==="graview"?$t(u,!0):u.overview?$n($t(u,!1),sr(u,o)):u;c(W)},[e,n,o,u,c,l]),null}function $o({app:e,studio:n,report:o}){return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(d.Suspense,{fallback:null,children:(0,w.jsx)(ko,{})}),n!==!1?(0,w.jsx)(Ye,{module:"@graview/studio",report:o,children:(0,w.jsx)(Wo,{app:e,studio:n})}):null]})}function Wo({app:e,studio:n}){let o={app:e,within:"box",...n?{onApply:n.onApply}:{},...n?.landmark?{landmark:n.landmark}:{},...n?.offered!==void 0?{offered:n.offered}:{}},i=n?.place;return i?(0,w.jsx)(i,{...o}):(0,w.jsx)(d.Suspense,{fallback:null,children:(0,w.jsx)(Lo,{...o})})}function No({path:e,stop:n,...o},i){return{...o,app:i.app,at:i.at,remote:i.remote,...i.remote.presence?{presence:i.remote.presence}:{}}}function nn(e,n){let o=n.store??n.remote?.store??hr(n.app,n.seed),i=n.notices??It(),l=null,u={},c=0,v=n.label,m=n.app,E=Promise.resolve(),F=n.at?.face??n.face,W=F===void 0?void 0:jt({...n,face:F}),b=W??en(n.stop),T=null,x=[],O=p=>{if(T=p,p!==b)return;let B=x;x=[];for(let D of B)D()};function oe(){let[p,B]=(0,d.useState)(W),[D,z]=(0,d.useState)(n.stop),[ie,se]=(0,d.useState)(n.path),[be,H]=(0,d.useState)(n.scheme??"auto"),[Se,A]=(0,d.useState)(n.principal),[k,V]=(0,d.useState)(n.seats),[Ae,C]=(0,d.useState)(n.quickAsk),[me,N]=(0,d.useState)(n.people),[L,q]=(0,d.useState)(n.hostContext),[Z,Oe]=(0,d.useState)(n.brand),[he,j]=(0,d.useState)(n.whileAway),[G,ae]=(0,d.useState)(n.label),[M,$e]=(0,d.useState)(n.hostActions),[J,ce]=(0,d.useState)(n.barActions),[I,Pe]=(0,d.useState)(void 0),[X,Ce]=(0,d.useState)(n.draftView);return l={app:ee=>{Pe(ee),se(void 0),z(void 0)},face:B,stop:z,path:se,scheme:H,seat:A,seats:V,quickAsk:C,people:N,hostContext:q,brand:Oe,whileAway:j,label:ae,hostActions:$e,barActions:ce,draft:Ce},(0,w.jsx)(Ur.Provider,{value:u,children:(0,w.jsx)(Gr,{...I?No(n,I):n,store:o,notices:i,...p!==void 0?{face:p}:{},onOpening:ee=>{b=ee},...D!==void 0?{stop:D}:{},...ie!==void 0?{path:ie}:{},...Se?{principal:Se}:{},...k?{seats:k}:{},...Ae!==void 0?{quickAsk:Ae}:{},...me?{people:me}:{},...L?{hostContext:L}:{},...Z?{brand:Z}:{},whileAway:he,label:G,hostActions:M,barActions:J,draftView:X,scheme:be,onFace:ee=>{b=ee,B(ee)},onSeat:A,onFaceDrawn:O},I?.n??0)})}let R=()=>{let p=u.view?.focusId,B=p?o.graph.getNode(p)?.kind:void 0,D=(u.shown??b)==="scene"||(u.shown??b)==="graview";return{face:b,path:D?Te:u.pages?.()??n.path??"/",stop:u.view?ut(u.view):n.stop??"#",...B?{kind:B}:{}}},le=(0,Dr.createRoot)(e);return(0,$.flushSync)(()=>le.render((0,w.jsx)(oe,{}))),{get store(){return o},where:R,setApp:(p,B,D)=>{let z="graph"in B?{store:B}:B,ie=()=>{let se=R();o=z.store,v=D?.label??(v===m.name?p.name:v),m=p,(0,$.flushSync)(()=>{l?.label(v),l?.app({app:p,remote:z,at:se,n:++c})})};wt?ie():E=E.then(tn).then(ie)},setFace:p=>{b=p,(0,$.flushSync)(()=>l?.face(p))},setStop:p=>(0,$.flushSync)(()=>l?.stop(p)),setPath:p=>(0,$.flushSync)(()=>{if(Zt(p)){(b==="pages"||b==="picture")&&(b="scene",l?.face("scene"));return}l?.path(p),b!=="pages"&&(b="pages",l?.face("pages"))}),setScheme:p=>(0,$.flushSync)(()=>l?.scheme(p)),setSeat:p=>(0,$.flushSync)(()=>l?.seat(p)),setSeats:p=>(0,$.flushSync)(()=>l?.seats(p)),setQuickAsk:p=>(0,$.flushSync)(()=>l?.quickAsk(p)),setPeople:p=>(0,$.flushSync)(()=>l?.people(p)),setHostContext:p=>(0,$.flushSync)(()=>l?.hostContext(p)),setBrand:p=>(0,$.flushSync)(()=>l?.brand(p)),setWhileAway:p=>(0,$.flushSync)(()=>l?.whileAway(p)),setDraftView:p=>(0,$.flushSync)(()=>l?.draft(p)),setLabel:p=>{v=p,(0,$.flushSync)(()=>l?.label(p))},setHostActions:p=>(0,$.flushSync)(()=>l?.hostActions(p)),setBarActions:p=>(0,$.flushSync)(()=>l?.barActions(p)),drawn:()=>E.then(()=>T===b?void 0:new Promise(p=>x.push(p))),notify:p=>{let B;return(0,$.flushSync)(()=>{B=i.notify(p)}),B},unmount:()=>le.unmount()}}var vt=e=>`s${(e+1).toString(36)}`;var ve={seat:"x-graview-seat",roles:"x-graview-roles",kind:"x-graview-kind",name:"x-graview-name",for:"x-graview-for",forRoles:"x-graview-for-roles",forName:"x-graview-for-name",via:"x-graview-via"},ze={header:"x-graview-key",param:"graview_key",cookie:"graview_key"};function bt(e,n={}){try{let o=new URL(e),i=o.searchParams.get(ze.param);if(i)return o.searchParams.delete(ze.param),{url:o.origin+o.pathname.replace(/\/$/,"")+o.search,key:i,headers:{[ze.header]:i,...n}}}catch{}return{url:e.replace(/\/$/,""),headers:n}}var Kr="/graview/friction";var Jr="/graview/live",rn="graview.ship",on=`${rn}.${ct}`;var Ge=class extends Error{constructor(n){super(n),this.name="Superseded"}},Fe=e=>e?.lineage?{lineage:e.lineage}:{},Io=(e,n)=>`${e.calls.map(o=>o.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
2
+ `)[0]??"":String(n)})`;function _o(e){if(!e)return[];try{let n=e.storage.getItem(e.key);if(n===null)return[];e.storage.removeItem(e.key);let o=JSON.parse(n);return Array.isArray(o)?o.filter(i=>!!i&&Array.isArray(i.calls)):[]}catch{return[]}}var Ue=class extends Error{constructor(o){super(o.sentence);this.refusal=o;this.name="RemoteRefusedError"}},jo={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},pe=class extends Error{constructor(o,i){super(o);this.conflicts=i;this.name="StaleWrite"}},Ze=class extends Error{constructor(n){super(n),this.name="Unreached"}},qo=new Set([502,503,504]);async function zo(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function Go(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var Uo=1,Ko=()=>({refusals:new Set,conflicts:new Set,statuses:new Set,helds:new Set,builds:new Set,who:new Set,declarations:new Set,tally:{reconnects:0,rebases:0,conflicts:0,resyncs:0}});async function St(e){return(await Yr(e,_o(e.carry),"This app was updated while your changes were on the way.",Ko())).remote}async function Yr(e,n,o,i){let{key:l,...u}=bt(e.url,e.headers),c={...e,...u},v=c.fetch??fetch,m={"content-type":"application/json",...c.headers??{}},E={...At(c.principal),[ve.via]:c.via??"web"};Object.assign(m,E);let F=c.live===!0,W=c.presenceEveryMs,b=c.visible??Qo,T="connecting",x=i.statuses,O=i.tally,oe=[],R,le=[],p=()=>T==="online"&&R!==void 0?"held":T,B=()=>{let t=p();if(i.told!==t){i.told=t;for(let r of[...x])r(t)}},D=t=>{if(!(t===T||de)&&(T==="offline"&&t==="online"&&O.reconnects++,T=t,B(),t==="online"))for(let r of oe.splice(0))r.again()},z=t=>{if(de)return;let r=typeof t=="string"&&t.length>0?t:void 0,s=r!==R;if(R=r,ie(),!!s&&(B(),r===void 0)){for(let a of le.splice(0))a();ne&&clearTimeout(ne),ln()}},ie=()=>{if(i.toldHeld!==R){i.toldHeld=R;for(let t of[...i.helds])t(R??null)}},se=async(t,r)=>{let s;try{s=await v(t,r)}catch(a){throw Y()||D("offline"),new Ze(a instanceof Error?a.message:String(a))}if(s.status===503&&await zo(s))return D("online"),s;if(qo.has(s.status))throw Y()||D("offline"),new Ze(`The server is away (${s.status})`);return D("online"),s},be=async(t=!1)=>{let r=`${c.url}/graview/state?opFormat=${qe.op}`,s=t?await v(r,{headers:m}):await se(r,{headers:m});if(!s.ok)throw new Error((await s.json().catch(()=>({}))).error??`The server refused (${s.status})`);return await s.json()},H=c.state??await be(!0);F||(T="online"),R=typeof H.held=="string"&&H.held.length>0?H.held:void 0,ie();let Se=H.enabledModules??c.enabledModules,A=c.localApp?c.localApp(c.app):c.app,k=new Ln({schema:A.schema,mutations:A.mutations??[],invariants:A.invariants??[],...A.policy?{policy:A.policy}:{},...A.publishing?{publishing:A.publishing}:{},...A.tidying?{tidying:A.tidying}:{},...A.modules?{modules:A.modules}:{},...Se?{enabledModules:Se}:{},...A.intelligence?{intelligence:A.intelligence}:{},...A.brand?.timeZone?{timeZone:A.brand.timeZone}:{},snapshot:H.snapshot,log:H.log,...H.horizon!==void 0?{horizon:H.horizon}:{},ids:Go(),...c.storeOptions??{}});Rn.served.add(k);let V=c.friction!==!1&&c.principal?.kind!=="visitor";V&&xn(k,t=>{V&&v(`${c.url}${Kr}`,{method:"POST",headers:m,body:JSON.stringify({event:t})}).then(r=>void(V=r.status!==404&&r.status!==410),()=>{})});let Ae=On(k),C=H.log.at(-1)?.seq??(H.horizon??0)-1,me=Mt.of(H.log,{horizon:H.horizon??0}),N=null,L,q=new Map,Z=i.who,Oe=!1,he=t=>{if(de)return;Oe=!0;let r=Vn(new Map,t,Date.now(),Bt,N?.participant);L!==void 0&&r.delete(L);let s=r.size!==q.size;if(!s)for(let[a,f]of r)Dt(f,q.get(a))||(s=!0);if(q=r,!!s)for(let a of[...Z])a([...q.values()])},j=[],G=new Set,ae=t=>{let r=j.indexOf(t);r>=0&&j.splice(r,1)},M=new Map,$e=(t,r)=>{let s=M.get(t);s&&(M.delete(t),s.resolve({ops:r.filter(a=>a.batch===t),batch:t}))},J,ce=[],I=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(J)return ce.push({ops:t,drop:r}),[];let s=Math.min(...t.filter(h=>h.seq>C).map(h=>h.seq));if(Number.isFinite(s)&&s>C+1)return ce.push({ops:t,drop:r}),Pe(),[];let a=j.filter(h=>t.some(re=>re.batch===h)),f=[...new Set([...r,...a])].filter(h=>G.has(h)),y,S=j.filter(h=>!a.includes(h));try{y=k.rebase({confirmed:t,pending:S,drop:f}).confirmed}catch(h){if(!(h instanceof Cn))throw h;return ce.push({ops:t,drop:r}),Pe(),[]}for(let h of a)ae(h);t.some(h=>h.seq>C)&&S.some(h=>!f.includes(h))&&O.rebases++,t.length>0&&(C=Math.max(C,...t.map(h=>h.seq)),me.note(t));for(let h of f)G.delete(h);for(let h of a)$e(h,t);return y},Pe=()=>{J||(J=ke(be().then(t=>{if(X(t)){ce=[];return}let r=new Set(t.log.map(f=>f.batch)),s=j.filter(f=>r.has(f));for(let f of s)ae(f);let a=k.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[...j],drop:[...G].filter(f=>!j.includes(f))});G.clear();for(let f of a.pending)G.add(f.batch);C=t.log.at(-1)?.seq??(t.horizon??0)-1,me=Mt.of(t.log,{horizon:t.horizon??0}),O.resyncs++;for(let f of s)$e(f,t.log)}).then(()=>{J=void 0;let t=ce;ce=[];for(let{ops:r,drop:s}of t)I(r,s)},()=>{J=void 0,ce=[]})))},X=t=>(typeof t.build=="string"&&fn(t.build),typeof t.version=="number"&&z(t.held),typeof t.version!="number"||t.version===H.version?!1:(Rt(t.version),!0)),Ce=async t=>{let s=await(await se(`${c.url}/graview/since?seq=${vt(t)}&opFormat=${qe.op}`,{headers:m})).json();return X(s)?[]:s.reset===!0?(Pe(),[]):s.ops??[]},ee=async()=>{let t=await Xe();return J&&await J,t},Xe=async()=>{if(N&&!Y()&&b()){let r=await(await se(`${c.url}/graview/here?opFormat=${qe.op}`,{method:"POST",headers:m,body:JSON.stringify({presence:N,seq:vt(C)})})).json();return X(r)?[]:(typeof r.participant=="string"&&(L=r.participant),he(r.who??[]),I(r.ops??[]))}return I(await Ce(C))},P=new Map,Le=new Map,Me=new Set,te=new Map,He=new Set,ke=t=>(He.add(t),t.finally(()=>He.delete(t)).catch(()=>{}),t),et=Promise.resolve(),We=0,Pt=(t,r)=>{let s=et.then(()=>Ne(t,r));return et=s.catch(()=>{}),s},tt=()=>new Promise((t,r)=>oe.push({again:t,give:r})),Ne=async(t,r)=>{let s,a;for(;;){try{s=await se(`${c.url}/graview/ops`,{method:"POST",headers:m,body:JSON.stringify({...t,opFormat:qe.op})})}catch(h){if(!(h instanceof Ze)||U)throw h;if(await tt(),Y())return nt(t,r);continue}if(a=await s.json().catch(()=>({})),s.status===503&&a.reason==="unavailable"&&typeof a.held=="string"&&!U){if(typeof a.version=="number"?X(a):(z(a.held),!1))break;if(R!==void 0&&(Ot>0||F)){if(await new Promise(h=>le.push(h)),U)throw new Ge("The client closed.");if(Y())return nt(t,r);continue}}let S;if(s.status===503&&a.reason==="unavailable"&&!U)S=an(c.backoff,We++);else{if(We=0,s.status!==429||U)break;S=Jo(s.headers.get("retry-after"),a.retryAfter)}if(await new Promise(h=>setTimeout(h,S)),Y())return nt(t,r)}if(de||X(a))throw new Ge("The app was changed.");if(!s.ok){let S=a.error??`The server refused (${s.status})`;throw a.conflict?new pe(S,a.conflicts??[]):new Ue({reason:a.reason??jo[s.status]??"invalid",sentence:S,...a.wouldNeed?.length?{wouldNeed:a.wouldNeed}:{}})}let f=a.ops??[],y=f[0]?.seq;return y!==void 0&&y>C+1&&(f=await Ce(C)),r!==void 0&&(a.batch&&P.set(r,a.batch),ae(r)),I(f,r!==void 0?[r]:[]),{ops:a.ops??[],...a.batch?{batch:a.batch}:{}}},_,ye=!1,U=!1,Ie=0,Ee,Ve=0,Ke=0,ue=null,Re=()=>{},_e=new Promise(t=>{Re=t}),Y=()=>F&&ye&&_?.readyState===Uo,g=t=>{if(!Y())return!1;try{return _.send(JSON.stringify(t)),!0}catch{return!1}},Q=(t=!1)=>{!N||!Y()||!b()||!t&&ue&&Dt(N,ue)&&(W===void 0||Date.now()-Ke<W)||g({t:"here",presence:N})&&(ue=N,Ke=Date.now())},K=new Set,ne,ln=()=>{if(ne=void 0,R!==void 0)return;let t=[...M.entries()].filter(([r])=>K.has(r));K.clear();for(let[,r]of t)g(r.message)},un=(t,r)=>{M.has(t)&&(K.add(t),ne&&clearTimeout(ne),ne=setTimeout(ln,Math.max(0,r)))},Xr=t=>{M.has(t)&&K.add(t)},nt=(t,r)=>new Promise((s,a)=>{let f=r??`send-${++Ve}`,y=t.undo?{t:"undo",cid:f,batches:t.undo,...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.via?{via:t.via}:{},...Fe(t)}:{t:"call",cid:f,calls:t.calls??[],...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.base?.length?{base:t.base}:{},...t.via?{via:t.via}:{},...Fe(t)};if(M.set(f,{message:y,...r!==void 0?{mine:r}:{},resolve:s,reject:a}),K.size>0||R!==void 0){K.add(f);return}g(y)}),rt=(t,r)=>Y()?nt(t,r):Pt(t,r),eo=t=>{switch(t.t){case"welcome":{if(fn(t.build),typeof t.version=="number"&&t.version!==H.version){Rt(t.version);return}if(ye=!0,Ie=0,typeof t.participant=="string"&&(L=t.participant),z(t.held),t.state?Pe():I(t.ops??[]),K.clear(),ne&&clearTimeout(ne),ne=void 0,R!==void 0)for(let r of M.keys())K.add(r);else for(let r of M.values())g(r.message);Q(!0),D("online"),Re();return}case"ops":I(t.ops??[]);return;case"ack":{let r=M.get(t.cid);if(!r){I(t.ops??[]);return}M.delete(t.cid),We=0,r.mine!==void 0&&(P.set(r.mine,t.batch),ae(r.mine)),I(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=M.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){R!==void 0?Xr(t.cid):un(t.cid,an(c.backoff,We++));return}M.delete(t.cid),r.reject(t.t==="conflict"?new pe(t.sentence,t.conflicts??[]):new Ue({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&un(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":he(t.who??[]);return;case"held":z(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==H.version&&Rt(t.version);return;case"reload":yn(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&_){let r=_;wn(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},de=!1,kt=i.declarations,Et=i.builds,fn=t=>{if(!(de||i.otherBuild!==void 0||!c.build||typeof t!="string"||t.length===0||t===c.build)){i.otherBuild=t;for(let r of[...Et])r(t)}},pn=()=>{let t=[],r=0;for(let s of j){let a=te.get(s);a?t.push({calls:a.calls,...a.intent?{intent:a.intent}:{},...a.via?{via:a.via}:{},...Fe(a),batch:s}):r++}return{carried:t,undos:r}},mn=(t,r)=>`${r} while ${t===1?"an undo of yours was":"undos of yours were"} on the way; ${t===1?"it was":"they were"} not made.`,hn=t=>{de=!0,N=null;let r=new Ge(t);for(let a of M.values())a.reject(r);M.clear(),it&&clearInterval(it),U=!0,Ee&&clearTimeout(Ee),ne&&clearTimeout(ne),ge&&clearTimeout(ge);for(let a of oe.splice(0))a.give(r);for(let a of le.splice(0))a();let s=_;_=void 0,ye=!1;try{s?.close(1e3,t)}catch{}Re()};async function Rt(t){if(de)return;if(!c.resolveApp){yn(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:s}=pn(),a=c.resolveApp,f=N;hn("The app was changed.");try{let y=await a(t),{state:S,...h}=c,re=await Yr({...h,app:y},r,"The app was changed while your changes were on the way.",i);f&&re.remote.presence.here(f);for(let st of[...kt])st(re.remote,t);let fe=[...s>0?[ot(mn(s,"The app was changed"))]:[],...re.unheard()];for(let st of fe)for(let co of je)co(st.sentence,st)}catch(y){let S=`The app was changed, but the new version could not be opened: ${y instanceof Error?y.message:String(y)}`;for(let h of je)h(S,ot(S))}}function yn(t){if(de)return;let{carried:r,undos:s}=pn();hn(t);let a=!1;if(c.carry&&r.length>0)try{c.carry.storage.setItem(c.carry.key,JSON.stringify(r)),a=!0}catch{}let f=[];!a&&r.length>0&&f.push(`${t} ${r.length===1?"A change of yours was":`${r.length} changes of yours were`} not sent; make ${r.length===1?"it":"them"} again after the page reloads.`),s>0&&f.push(mn(s,"This app was updated"));for(let y of f)for(let S of je)S(y,ot(y));(c.reloadPage??Yo)()}let gn=()=>{if(U||!F)return;let t=`${c.url.replace(/^http/,"ws").replace(/\/$/,"")}${Jr}`,{"content-type":r,...s}=m,a;try{a=c.socket?c.socket(t,s,[on]):so(t,s)}catch{return vn()}_=a,ye=!1,a.onopen=()=>{_===a&&a.send(JSON.stringify({t:"hello",seq:vt(C),protocol:ct,wire:rn,opFormat:qe.op,...c.build?{build:c.build.slice(0,64)}:{},...c.hostProtocol!==void 0?{hostProtocol:c.hostProtocol}:{}}))},a.onmessage=f=>{if(_!==a)return;let y;try{y=JSON.parse(String(f.data))}catch{return}eo(y)},a.onclose=()=>wn(a),a.onerror=()=>{}},ge,to=()=>{Oe=!1,ge&&clearTimeout(ge),ge=setTimeout(()=>{if(ge=void 0,Oe||U)return;let t=new Map([...q].filter(([,r])=>r.held!=="socket"));if(t.size!==q.size){q=t;for(let r of Z)r([...q.values()])}},Bt),ge.unref?.()};function wn(t){if(_!==t)return;let r=ye;_=void 0,ye=!1,ue=null,r&&(D("offline"),to()),vn()}let vn=()=>{if(U)return;let t=an(c.backoff,Ie);Ie++,Ee=setTimeout(gn,t)},bn=k.applyAll.bind(k),no=k.undo.bind(k),ro=k.previewAll.bind(k);k.previewAll=(t,r)=>ro(t,{...c.principal?{author:c.principal}:{},...r});let je=i.refusals,Je=[],ot=t=>({reason:"invalid",sentence:t}),at=i.conflicts,Tt=!1,Sn,xt=async(t,r)=>{if(r instanceof Ge||de)return;let s=r instanceof Ue?r.refusal:En(r),a=s.sentence,f=r instanceof pe?Sn?.yoursOf(k,te.get(t)?.calls??[]):void 0;ae(t);try{I([],[t])}catch{}let y=te.get(t);te.delete(t);let S=y?.calls[0];if(S&&!(r instanceof pe)){let h=k.allMutations().find(fe=>fe.name===S.name)?.subject?.arg,re=h&&k.graph.getNode(S.args[h])?.kind;Fn(k,{type:"refused",act:S.name,code:s.reason,...re?{kind:re}:{}},c.principal)}if(r instanceof pe&&O.conflicts++,r instanceof pe&&!Y()&&await ee().catch(()=>[]),r instanceof pe&&J&&await J,r instanceof pe&&at.size>0){let h=!1,re={sentence:a,conflicts:f?r.conflicts.map(fe=>fe.node===f.node&&fe.field===f.field?{...fe,yours:f.yours}:fe):r.conflicts,keepTheirs(){h=!0},useMine(){if(!(h||!y)){h=!0,Tt=!0;try{k.applyAll(f?[f.over(C)]:y.calls,{...y.intent?{intent:y.intent}:{},...y.via?{via:y.via}:{},...Fe(y)})}finally{Tt=!1}}}};for(let fe of at)fe(re);return}for(let h of je)h(a,s)},oo=(t,r)=>t.flatMap(s=>s.mutation?.name===kn?[]:s.primitives.flatMap(a=>a.op==="splice-text"&&!r.has(a.id)&&!r.has(`${a.id}\0${a.field}`)?[{node:a.id,field:a.field,rev:C}]:[]));k.applyAll=(t,r)=>{let s=Tn(k.log.all().filter(S=>G.has(S.batch))),a=bn(t,{...c.principal?{author:c.principal}:{},...r}),f=t.map((S,h)=>{let re=a.minted?.[h];return re===void 0||S.args?.id!==void 0?S:{...S,mintedHint:re}});j.push(a.batch),G.add(a.batch),te.set(a.batch,{calls:f,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...Fe(r)});let y=Tt?[]:[...me.baseFor(a.ops,s,(S,h)=>k.collaborative(S,h)),...oo(a.ops,s)];return Le.set(a.batch,ke(rt({calls:f,...r?.intent?{intent:r.intent}:{},batch:a.batch,...y.length>0?{base:y}:{},...r?.via?{via:r.via}:{},...Fe(r)},a.batch).catch(S=>xt(a.batch,S)))),a},k.apply=(t,r)=>k.applyAll([t],r),k.undo=(t,r)=>{let s=typeof t=="string"?[t]:t,a=no(s.map(y=>P.get(y)??y),{...c.principal?{author:c.principal}:{},...r});j.push(a.batch),G.add(a.batch);let f=Promise.allSettled(s.map(y=>Le.get(y)));return Le.set(a.batch,ke(f.then(()=>{let y=s.filter(S=>!Me.has(S));if(y.length===0){ae(a.batch),te.delete(a.batch),I([],[a.batch]);return}return rt({undo:y.map(S=>P.get(S)??S),...r?.intent?{intent:r.intent}:{},batch:a.batch,...r?.via?{via:r.via}:{},...Fe(r)},a.batch)}).catch(y=>xt(a.batch,y)))),a};let ao=async(t,r={})=>{Ft++;try{return(await ke(rt({calls:t,...r}))).ops}finally{Ft--}},Ft=0,An={here(t){N=t,Q()},onWho(t){return Z.add(t),q.size>0&&t([...q.values()]),()=>{Z.delete(t)}},leave(){if(!N)return;let t=JSON.stringify({participant:L??N.participant});if(N=null,g({t:"bye"}))return;let r=globalThis.navigator?.sendBeacon;r?r.call(globalThis.navigator,`${c.url}/graview/leave${l!==void 0?`?${ze.param}=${encodeURIComponent(l)}`:""}`,t):v(`${c.url}/graview/leave`,{method:"POST",headers:m,body:t}).catch(()=>{})}},Ot=c.pollMs??800,it=Ot>0&&typeof setInterval=="function"?setInterval(()=>{Y()||ee().catch(()=>{})},Ot):null;if(F){gn();let t;await Promise.race([_e,new Promise(r=>t=setTimeout(r,c.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!de){let t=[],r=new Set(k.log.all().map(s=>s.batch));for(let s of n)if(!(s.batch!==void 0&&r.has(s.batch)))try{k.applyAll(s.calls,{...s.intent?{intent:s.intent}:{},...s.batch?{batch:s.batch}:{},...s.via?{via:s.via}:{},...Fe(s)})}catch(a){t.push(Io(s,a))}t.length>0&&Je.push(ot(`${o} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}let Pn=new Map,io=()=>({store:k,author:c.principal,appliedAll:bn,pending:j,provisional:G,asked:te,answers:Le,letGo:Me,sent:(t,r)=>ke(rt({calls:r,batch:t},t).catch(s=>xt(t,s))),settle:ae,land:I,seen:()=>C,gone:()=>U||de});return{remote:{store:k,typing(t,r){let s=`${t}\0${r}`,a=Pn.get(s);return a||(a=(__graviewPreload(import.meta.url,["./chunk.RPDH32XV.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.DD2NKFDX.js")).then(f=>(Sn=f,f.typingOf(t,r,f.wireOf(io())))),Pn.set(s,a)),a},version:H.version,migrated:H.migrated??[],send:ao,pull:ee,onRefusal(t){je.add(t);let r=Je;Je=[];for(let s of r)t(s.sentence,s);return()=>je.delete(t)},onDeclaration(t){return kt.add(t),()=>kt.delete(t)},onBuild(t){return Et.add(t),i.otherBuild!==void 0&&t(i.otherBuild),()=>Et.delete(t)},onConflict(t){return at.add(t),()=>at.delete(t)},revision:(t,r)=>me.of(t,r),seq:()=>C,participant:()=>L,transport:()=>Y()?"socket":"poll",status:p,onStatus(t){return x.add(t),()=>x.delete(t)},held:()=>R,onHeld(t){return i.helds.add(t),R!==void 0&&t(R),()=>i.helds.delete(t)},counters:()=>({...O}),who:()=>[...q.values()],pending:()=>j.length+Ft,async settled(){for(;He.size>0;)await Promise.allSettled([...He])},presence:An,close(){it&&clearInterval(it),Ae(),An.leave(),U=!0,Ee&&clearTimeout(Ee),ne&&clearTimeout(ne),ge&&clearTimeout(ge);for(let r of oe.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of le.splice(0))r();let t=_;_=void 0,ye=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=Je;return Je=[],t}};function so(t,r){let s=globalThis.WebSocket;if(!s)throw new Error("This runtime has no WebSocket; the client polls instead.");let a=typeof globalThis.document<"u",f=c.subprotocol?[on]:[];if(!a)try{return new s(t,{headers:r,...f.length>0?{protocols:f}:{}})}catch{}let y=new URL(t);for(let[S,h]of Object.entries(E))y.searchParams.set(S,h);return l!==void 0&&y.searchParams.set(ze.param,l),f.length>0?new s(y.toString(),f):new s(y.toString())}}function Jo(e,n,o=Date.now()){let i,l=e?.trim();if(l)if(/^\d+(\.\d+)?$/.test(l))i=Number(l)*1e3;else{let v=Date.parse(l);Number.isFinite(v)&&(i=Math.max(0,v-o))}let u=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,c=u!==void 0&&u<50&&i!==void 0&&Math.abs(u*1e3-i)<1e3;return u!==void 0&&!c?u:i??1e3}function Yo(){globalThis.location?.reload?.()}function Qo(){return globalThis.document?.visibilityState!=="hidden"}function an(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:o=250,max:i=1e4,factor:l=2}=e??{};return Math.min(i,o*l**n)*(.75+Math.random()*.5)}function At(e){let n={};if(!e)return n;e.id&&(n[ve.seat]=e.id),e.roles?.length&&(n[ve.roles]=e.roles.join(",")),e.kind!=="human"&&(n[ve.kind]=e.kind),e.name&&(n[ve.name]=encodeURIComponent(e.name));let o=e.onBehalfOf;return o?.id&&(n[ve.for]=o.id),o?.roles?.length&&(n[ve.forRoles]=o.roles.join(",")),o?.name&&(n[ve.forName]=encodeURIComponent(o.name)),n}var Qr="/graview/views";function sn(e){let n=e.fetch??fetch,o=bt(e.url,e.headers),i=o.url,l={"content-type":"application/json",...e.principal?At(e.principal):{},...o.headers},u=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??dt.may}:dt,c=new Set,v=b=>{if(JSON.stringify(b)!==JSON.stringify(u)){u=b;for(let T of c)T()}},m=async(b,T)=>{let x=await n(`${i}${e.path??Qr}`,{method:b,headers:l,...T!==void 0?{body:JSON.stringify(T)}:{}}),O=await x.json();if(!x.ok)throw new Error(O.error??`The store answered ${x.status}.`);v({hidden:O.hidden??[],removed:O.removed??[],may:O.may??dt.may})},E=()=>m("GET"),F=e.state?Promise.resolve():E().catch(()=>{}),W=e.pollMs?setInterval(()=>void E().catch(()=>{}),e.pollMs):void 0;return{ready:F,refresh:E,close:()=>clearInterval(W),current:()=>u,onChange(b){return c.add(b),()=>void c.delete(b)},hide:b=>m("POST",{hide:b}),show:b=>m("POST",{show:b}),remove:(b,T)=>m("POST",{remove:b,...T?{about:T}:{}}),async restore(b){let T=u.removed.find(x=>x.name===b)?.lens;await m("POST",{restore:b}),T&&await e.onDeclaration?.()},async lens(b){await m("POST",{lens:b}),await e.onDeclaration?.()}}}var dn=document.getElementById("graview-app"),cn=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),Zr=cn?(__graviewPreload(import.meta.url,["./chunk.IQ3PRWGO.js","./chunk.KDXU5DT3.js","./chunk.XOZU4OFA.js","./chunk.Y2YYH3JN.js","./chunk.75GVFX7L.js","./chunk.2B6P4GPS.js","./chunk.NUYA4BWI.js","./chunk.OKZT2QBM.js","./chunk.ACTXR2MI.js","./chunk.G4ULQK64.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.TM4EPUNO.js")):De("pages");try{cn?await Zo(decodeURIComponent(cn[1])):await Xo()}catch(e){let n=document.createElement("pre");n.setAttribute("role","alert"),n.style.cssText="margin:2rem;font:14px/1.5 ui-monospace,monospace;white-space:pre-wrap",n.textContent=e instanceof Error?e.message:String(e),dn.replaceChildren(n),window.__graviewFailed=n.textContent}async function Zo(e){let n=await fetch(`/graview/document?form=${encodeURIComponent(e)}`),o=await n.json();if(!n.ok)throw new Error(o.error??`The preview server did not hand over the form (${n.status}).`);let i=await mt(o);if(!i.ok)throw new Error(lt(i.findings));let l=i.app,u=o.principal,c=await St({app:l,url:location.origin,principal:u,...o.state?{state:o.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=l.forms?.[e]?.title??l.name;let{mount:v}=await Zr;window.__graview=v(dn,{app:l,form:e,principal:u,remote:c,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function Xo(){let e=await fetch("/graview/document");if(!e.ok)throw new Error(`The preview server did not hand over the document (${e.status}).`);let n=await e.json(),i=await(async m=>{if(typeof m.module=="string")return(await import(m.module)).app;let E=await mt(m);if(!E.ok)throw new Error(lt(E.findings));return E.app})(n);if(!i||typeof i!="object"||!("schema"in i))throw new Error("The app module the preview server handed does not export an app.");let l=n.principal,u=await St({app:i,url:location.origin,principal:l,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=i.name;let c,v=sn({url:location.origin,principal:l,...n.views?{state:n.views}:{},onDeclaration:async()=>{let m=await(await fetch("/graview/document")).json();if(typeof m.module=="string")return;let E=await mt(m);E.ok&&c?.setApp(E.app,u)}});await Promise.all([Zr,v.ready]),c=nn(dn,{app:i,remote:u,principal:l,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:i.name,heading:1,keptViews:v,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=c,c.drawn().then(()=>{window.__graviewReady=!0})}
@@ -0,0 +1,57 @@
1
+ var L=["plain","editorial","shader","ascii"],_=["drift","ripple","veil"],S="graview-splash",u=/^#[0-9a-fA-F]{6}$/,P=/^[A-Za-z0-9 ,'"-]{1,200}$/,o='system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',F='Georgia, "Times New Roman", serif',h='ui-monospace, "SF Mono", Menlo, Consolas, monospace',r=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");function p(e){if(!e)return;let a=e.trim();if(/^<svg[\s>]/i.test(a)&&!/<script|\bon[a-z]+\s*=|javascript:/i.test(a))return`data:image/svg+xml,${encodeURIComponent(a)}`;if(!(/^</.test(a)||/^[a-z][a-z0-9+.-]*:/i.test(a)||a.startsWith("//")))return/^[A-Za-z0-9._~/-]+$/.test(a)?a:void 0}function k(e,a){if(e)return typeof e=="string"?e:"src"in e?e.src:a==="dark"&&e.dark?e.dark:e.light}function I(e){return e?e==="system-serif"?F:e==="system-mono"?h:e==="system-sans"?o:P.test(e)?e:o:o}function q(e){let a=typeof e.ground=="string"?{light:e.ground}:e.ground??{},i=a.light&&u.test(a.light)?a.light:"#f7f7f2",l=a.dark&&u.test(a.dark)?a.dark:"#0a0f1f",n=e.accent&&u.test(e.accent)?e.accent:void 0;return{light:i,dark:l,tintLight:n??"#001769",tintDark:n??"#9aabff",inkLight:"#18213a",inkDark:"#e8ecf5"}}function $(e){return[1,3,5].map(a=>(parseInt(e.slice(a,a+2),16)/255).toFixed(3)).join(",")}function N(e,a={}){let i=e.splash;if(!i||!L.includes(i.style))return{html:"",css:"",script:""};let l=a.scheme??e.scheme??"auto",{light:n,dark:E,tintLight:m,tintDark:f,inkLight:A,inkDark:T}=q(e),g=i.title??e.name??a.name??"",v=i.style==="shader"?_.includes(i.shader??"")?i.shader:_[0]:void 0,c=p(i.image),d=c??(i.style==="plain"?p(k(e.logo,"light")):void 0),y=c??(i.style==="plain"?p(k(e.logo,"dark")):void 0),s=(x,M)=>x?`<img class="graview-splash-image" data-scheme="${M}" src="${r(x)}" alt="" decoding="async">`:"",b=i.style==="plain"?d===y?s(d,"light").replace(' data-scheme="light"',""):s(d,"light")+s(y,"dark"):s(c,"light").replace(' data-scheme="light"',""),R=`${i.kicker?`<p class="graview-splash-kicker">${r(i.kicker)}</p>`:""}<p class="graview-splash-title"${i.style==="ascii"?` data-types="${r(g)}"`:""}>${i.style==="ascii"?"":r(g)}</p>`,U=`<div id="${S}" popover="manual" data-style="${i.style}" data-scheme="${l}"${v?` data-shader="${v}"`:""} data-tint-light="${$(m)}" data-tint-dark="${$(f)}" aria-label="${r(g)}">${b}${i.style==="ascii"?'<pre class="graview-splash-ascii" aria-hidden="true"></pre>':""}${i.style==="shader"?'<canvas class="graview-splash-canvas" aria-hidden="true"></canvas>':""}<div class="graview-splash-words">${R}</div></div>`,t=`#${S}`,w=`--gs-ground:${E};--gs-ink:${T};--gs-tint:${f};--gs-light:0`,D=[`${t}{--gs-ground:${n};--gs-ink:${A};--gs-tint:${m};--gs-light:1;position:fixed;inset:0;width:100%;height:100%;max-width:none;max-height:none;margin:0;padding:0;border:0;overflow:hidden;background:var(--gs-ground);color:var(--gs-ink);font-family:${I(e.typography?.display)};transition:opacity .28s ease}`,`${t}::backdrop{background:transparent}`,`${t}[data-scheme="dark"]{${w}}`,`@media (prefers-color-scheme: dark){${t}[data-scheme="auto"]{${w}}}`,`${t}[data-gone]{opacity:0;pointer-events:none}`,`${t} .graview-splash-words{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:flex-end;padding:clamp(24px,6vw,72px);box-sizing:border-box}`,`${t} .graview-splash-kicker{margin:0 0 .6em;font:600 clamp(12px,1.4vw,15px)/1.3 ${o};letter-spacing:.14em;text-transform:uppercase;color:var(--gs-tint)}`,`${t} .graview-splash-title{margin:0;font-size:clamp(40px,9vw,128px);font-weight:600;line-height:.95;letter-spacing:-.03em;max-width:14ch;overflow-wrap:anywhere}`,`${t} .graview-splash-image{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}`,`${t}[data-style="editorial"] .graview-splash-words,${t}[data-style="shader"] .graview-splash-words{background:linear-gradient(to top,var(--gs-ground) 0,transparent 55%)}`,`${t}[data-style="plain"] .graview-splash-words{justify-content:center;align-items:center;text-align:center}`,`${t}[data-style="plain"] .graview-splash-title{font-size:clamp(28px,5vw,56px);letter-spacing:-.02em}`,`${t}[data-style="plain"] .graview-splash-image{position:static;width:min(160px,30vw);height:auto;max-height:160px;object-fit:contain;margin:0 auto 24px}`,`${t}[data-style="plain"] .graview-splash-image[data-scheme="dark"]{display:none}`,`${t}[data-scheme="dark"][data-style="plain"] .graview-splash-image[data-scheme="light"]{display:none}${t}[data-scheme="dark"][data-style="plain"] .graview-splash-image[data-scheme="dark"]{display:block}`,`@media (prefers-color-scheme: dark){${t}[data-scheme="auto"][data-style="plain"] .graview-splash-image[data-scheme="light"]{display:none}${t}[data-scheme="auto"][data-style="plain"] .graview-splash-image[data-scheme="dark"]{display:block}}`,`${t} .graview-splash-canvas{position:absolute;inset:0;width:100%;height:100%}`,`${t}[data-style="ascii"] .graview-splash-image{visibility:hidden}`,`${t} .graview-splash-ascii{position:absolute;inset:0;margin:0;padding:0;overflow:hidden;font:12px/14px ${h};color:var(--gs-tint);opacity:.85;white-space:pre;user-select:none}`,`${t}[data-style="ascii"] .graview-splash-title{font-family:${h};font-weight:500}`,`${t}[data-style="ascii"] .graview-splash-title::after{content:"_";animation:graview-splash-blink 1s steps(2) infinite}`,"@keyframes graview-splash-blink{to{visibility:hidden}}",`@media (prefers-reduced-motion: reduce){${t}{transition:none}${t}[data-style="ascii"] .graview-splash-title::after{animation:none;content:""}}`].join(`
2
+ `);return{html:U,css:D,script:C}}var C=String.raw`(function(){
3
+ var s=document.getElementById("graview-splash");if(!s)return;
4
+ if(s.showPopover){try{s.showPopover()}catch(e){}}
5
+ var mq=window.matchMedia?matchMedia("(prefers-reduced-motion: reduce)"):null,still=!!(mq&&mq.matches);
6
+ var dark=s.getAttribute("data-scheme")==="dark"||(s.getAttribute("data-scheme")==="auto"&&window.matchMedia&&matchMedia("(prefers-color-scheme: dark)").matches);
7
+ var tint=(s.getAttribute(dark?"data-tint-dark":"data-tint-light")||"0,0,0").split(",").map(Number);
8
+ var stop=null,gone=false,t0=Date.now();
9
+ function go(){if(gone)return;gone=true;ob.disconnect();clearTimeout(most);if(stop)stop();if(still){if(s.parentNode)s.parentNode.removeChild(s);return}
10
+ s.setAttribute("data-gone","");setTimeout(function(){if(s.parentNode)s.parentNode.removeChild(s)},320)}
11
+ function drawn(){return !!document.querySelector("[data-graview-drawn],[role=alert]")}
12
+ var ob=new MutationObserver(function(){if(drawn())go()});
13
+ ob.observe(document.documentElement,{attributes:true,childList:true,subtree:true,attributeFilter:["data-graview-drawn","role"]});
14
+ var most=setTimeout(go,15000);
15
+ if(drawn()){go();return}
16
+ var style=s.getAttribute("data-style"),img=s.querySelector(".graview-splash-image");
17
+ function ready(fn){if(!img){fn(null);return}if(img.complete&&img.naturalWidth)fn(img);else{img.addEventListener("load",function(){fn(img)});img.addEventListener("error",function(){fn(null)})}}
18
+ function loop(frame){if(still){frame(0);return}var on=true,last=0;function tick(now){if(!on)return;if(now-last>66){last=now;frame((Date.now()-t0)/1000)}requestAnimationFrame(tick)}requestAnimationFrame(tick);stop=function(){on=false}}
19
+ if(style==="ascii"){
20
+ var pre=s.querySelector(".graview-splash-ascii"),title=s.querySelector(".graview-splash-title"),words=title?title.getAttribute("data-types")||"":"";
21
+ var ramp=dark?" .:-=+*#%@":"@%#*+=-:. ";
22
+ var cv=document.createElement("canvas"),cx=cv.getContext("2d",{willReadFrequently:true});
23
+ ready(function(im){var cols=Math.ceil(s.clientWidth/7.2),rows=Math.ceil(s.clientHeight/14);cv.width=cols;cv.height=rows;
24
+ var px=null;if(im&&cx){try{var r=Math.max(cols/im.naturalWidth,rows/im.naturalHeight),w=im.naturalWidth*r,h=im.naturalHeight*r;cx.drawImage(im,(cols-w)/2,(rows-h)/2,w,h);px=cx.getImageData(0,0,cols,rows).data}catch(e){px=null}}
25
+ loop(function(t){var out="",p=Math.min(1,t/1.6);for(var y=0;y<rows;y++){for(var x=0;x<cols;x++){var v;if(px){var i=(y*cols+x)*4;v=(px[i]*.3+px[i+1]*.59+px[i+2]*.11)/255}else{v=.5+.5*Math.sin(x*.11+t*.6)*Math.cos(y*.19-t*.4)}
26
+ if(dark)v=v*p;else v=1-(1-v)*p;out+=ramp.charAt(Math.max(0,Math.min(ramp.length-1,Math.floor(v*(ramp.length-1)))))}out+="\n"}pre.textContent=out});
27
+ });
28
+ if(title&&words){if(still)title.textContent=words;else{var n=0,ty=setInterval(function(){n++;title.textContent=words.slice(0,n);if(n>=words.length)clearInterval(ty)},Math.max(30,Math.min(90,1200/words.length)));var before=stop;stop=function(){clearInterval(ty);if(before)before()}}}
29
+ }
30
+ if(style==="shader"){
31
+ var canvas=s.querySelector(".graview-splash-canvas"),gl=canvas&&(canvas.getContext("webgl",{premultipliedAlpha:false})||canvas.getContext("experimental-webgl"));
32
+ var which=s.getAttribute("data-shader")||"drift";
33
+ var F={drift:"vec2 d=vec2(sin(u_time*.21)*.02,cos(u_time*.17)*.02);vec2 q=(uv-.5)*(1.06-.04*u_progress)+.5+d;q+=vec2(sin(q.y*6.+u_time*.5),cos(q.x*5.-u_time*.4))*.004;vec3 c=pic(q);c=mix(c,u_tint,(1.-u_progress)*.35+.12*(1.-uv.y));",
34
+ ripple:"vec2 p=uv-.5;p.x*=u_resolution.x/u_resolution.y;float r=length(p);float w=sin(r*28.-u_time*2.6)*exp(-r*2.2)*.012*(1.-u_progress*.6);vec3 c=pic(uv+normalize(p+1e-5)*w);c=mix(c,u_tint,.18*(1.-u_progress)+.1*(1.-uv.y));",
35
+ veil:"vec3 c=pic(uv);float band=smoothstep(-.3,.3,uv.x-uv.y*.6+sin(u_time*.35)*.25-.2);c=mix(c,u_tint,(.55-.4*u_progress)*band+.1*(1.-uv.y));"};
36
+ if(gl){
37
+ var vs="attribute vec2 a;void main(){gl_Position=vec4(a,0.,1.);}";
38
+ var fs="precision mediump float;uniform sampler2D u_image;uniform float u_time,u_progress,u_light,u_has;uniform vec2 u_resolution,u_size;uniform vec3 u_tint,u_ground;"+
39
+ "vec3 pic(vec2 q){if(u_has<.5){return mix(u_ground,u_tint,.25+.35*q.y);}float ra=u_resolution.x/u_resolution.y,ia=u_size.x/u_size.y;vec2 t=q;if(ra>ia){t.y=(q.y-.5)*ia/ra+.5;}else{t.x=(q.x-.5)*ra/ia+.5;}return texture2D(u_image,vec2(t.x,1.-t.y)).rgb;}"+
40
+ "void main(){vec2 uv=gl_FragCoord.xy/u_resolution;"+(F[which]||F.drift)+"gl_FragColor=vec4(c,1.);}";
41
+ function sh(type,src){var o=gl.createShader(type);gl.shaderSource(o,src);gl.compileShader(o);return gl.getShaderParameter(o,gl.COMPILE_STATUS)?o:null}
42
+ var v=sh(gl.VERTEX_SHADER,vs),f=sh(gl.FRAGMENT_SHADER,fs),prog=v&&f&&gl.createProgram();
43
+ if(prog){gl.attachShader(prog,v);gl.attachShader(prog,f);gl.linkProgram(prog)}
44
+ if(prog&&gl.getProgramParameter(prog,gl.LINK_STATUS)){gl.useProgram(prog);
45
+ var buf=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,buf);gl.bufferData(gl.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),gl.STATIC_DRAW);
46
+ var a=gl.getAttribLocation(prog,"a");gl.enableVertexAttribArray(a);gl.vertexAttribPointer(a,2,gl.FLOAT,false,0,0);
47
+ var U=function(n){return gl.getUniformLocation(prog,n)};
48
+ var tex=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,tex);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.LINEAR);
49
+ gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,1,1,0,gl.RGBA,gl.UNSIGNED_BYTE,new Uint8Array([0,0,0,255]));
50
+ var g=getComputedStyle(s).backgroundColor.match(/[\d.]+/g)||[0,0,0];
51
+ gl.uniform3f(U("u_tint"),tint[0],tint[1],tint[2]);gl.uniform3f(U("u_ground"),g[0]/255,g[1]/255,g[2]/255);gl.uniform1f(U("u_light"),dark?0:1);gl.uniform1f(U("u_has"),0);gl.uniform2f(U("u_size"),1,1);
52
+ ready(function(im){if(!im)return;try{gl.bindTexture(gl.TEXTURE_2D,tex);gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,gl.RGBA,gl.UNSIGNED_BYTE,im);gl.uniform1f(U("u_has"),1);gl.uniform2f(U("u_size"),im.naturalWidth,im.naturalHeight)}catch(e){}});
53
+ loop(function(t){var w=s.clientWidth,h=s.clientHeight,dpr=Math.min(2,window.devicePixelRatio||1);if(canvas.width!==(w*dpr|0)||canvas.height!==(h*dpr|0)){canvas.width=w*dpr;canvas.height=h*dpr;gl.viewport(0,0,canvas.width,canvas.height)}
54
+ gl.uniform1f(U("u_time"),t);gl.uniform1f(U("u_progress"),Math.min(1,t/2.4));gl.uniform2f(U("u_resolution"),canvas.width,canvas.height);gl.drawArrays(gl.TRIANGLES,0,3)});
55
+ }else if(canvas)canvas.remove()}else if(canvas)canvas.remove();
56
+ }
57
+ })();`;export{S as SPLASH_ID,_ as SPLASH_SHADERS,L as SPLASH_STYLES,N as splashHtml};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graview",
3
- "version": "0.1.60",
3
+ "version": "0.1.62",
4
4
  "type": "module",
5
5
  "description": "The Graview command line: start a product, check its declaration, write its agent docs, serve its store, preview a document with no product and photograph its places, say whether a product is on one release, host it for an agent over MCP, apply an act to it, sync its seed, install the authoring skills. The tool; @graview/* is the framework.",
6
6
  "keywords": [
@@ -29,11 +29,11 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@graview/core": "0.1.60",
33
- "@graview/guest": "0.1.60",
34
- "@graview/ship": "0.1.60",
35
- "@graview/skills": "0.1.60",
36
- "@graview/tools": "0.1.60"
32
+ "@graview/guest": "0.1.62",
33
+ "@graview/ship": "0.1.62",
34
+ "@graview/skills": "0.1.62",
35
+ "@graview/tools": "0.1.62",
36
+ "@graview/core": "0.1.62"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=22"
@@ -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{G as k,Ga as o,T as n}from"./chunk.4MP72LPR.js";import{a as t}from"./chunk.SDO3U72B.js";import{b as p}from"./chunk.AJZBJBMO.js";var f=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.7VKSXGTX.js","./chunk.TY4GQJKC.js","./chunk.6ZQAR5ZA.js","./chunk.W3W54DSX.js","./chunk.PI44XMY2.js","./chunk.KGW75Z5L.js","./chunk.GZHZLJBF.js","./chunk.IOK4GVJC.js","./chunk.OJGHDWI6.js","./chunk.TLJOZSDD.js","./chunk.MSWWWLEA.js","./chunk.UITT6JWW.js","./chunk.A5PDXNY6.js","./chunk.WC3DENU4.js","./chunk.VNDKKTED.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.BF6S5UE4.js")))),y=f.part((e,r)=>e.drawFiles(r),{quiet:!0});var d=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.GZHZLJBF.js","./chunk.IOK4GVJC.js","./chunk.OJGHDWI6.js","./chunk.TLJOZSDD.js","./chunk.MSWWWLEA.js","./chunk.UITT6JWW.js","./chunk.A5PDXNY6.js","./chunk.WC3DENU4.js","./chunk.VNDKKTED.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.EL5ICOOM.js")))),I=d.part((e,r)=>e.drawLinkedRecord(r),{quiet:!0}),w=d.part((e,r)=>e.drawLinkedPicker(r),{what:"Picking a linked record"});var s=p(n(),1),m=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.GZHZLJBF.js","./chunk.IOK4GVJC.js","./chunk.OJGHDWI6.js","./chunk.TLJOZSDD.js","./chunk.MSWWWLEA.js","./chunk.UITT6JWW.js","./chunk.A5PDXNY6.js","./chunk.WC3DENU4.js","./chunk.VNDKKTED.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.UQWTZJBV.js")))),E=m.part((e,r)=>(0,s.jsx)(e.RepeatPicker,{...r}),{quiet:!0}),W=m.part((e,r)=>(0,s.jsx)(e.RepeatEditor,{...r}),{quiet:!0});var a=p(k(),1),i=p(n(),1),c=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.MSWWWLEA.js","./chunk.UITT6JWW.js","./chunk.A5PDXNY6.js","./chunk.WC3DENU4.js","./chunk.VNDKKTED.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.QHDCTAD7.js")))),l=c.part((e,r)=>(0,i.jsx)(e.WhenInput,{...r}),{quiet:!0});function M(e){return(0,i.jsx)(a.Suspense,{fallback:(0,i.jsx)("span",{"data-graview-when-arriving":"",style:{display:"inline-block",minHeight:24}}),children:(0,i.jsx)(l,{...e})})}var N=()=>c.load().then(()=>{},()=>{});export{y as a,I as b,w as c,E as d,W as e,M as f,N as g};
@@ -1 +0,0 @@
1
- import{a as N,b as T}from"./chunk.25VJPUDH.js";import{e as D,f as E,g as R}from"./chunk.PNW5K7BW.js";import{b as I}from"./chunk.ENL2JJ47.js";import"./chunk.BQIHNT7C.js";import{d as z}from"./chunk.3XGA65Y3.js";import"./chunk.2K4TT2BV.js";import{a as C}from"./chunk.VZJWJ5XM.js";import"./chunk.MSWWWLEA.js";import"./chunk.UITT6JWW.js";import"./chunk.A5PDXNY6.js";import{j as f}from"./chunk.WC3DENU4.js";import"./chunk.VNDKKTED.js";import{G as M,Ra as W,T as k,Va as A,ba as b,da as H}from"./chunk.4MP72LPR.js";import"./chunk.SDO3U72B.js";import{_a as x}from"./chunk.VSCIXAHN.js";import"./chunk.FQLNBIQ5.js";import{b as v}from"./chunk.AJZBJBMO.js";var n=v(M(),1);var e=v(k(),1);function O(t,o){let r=[t>0?`${t===1?"one suggestion":`${t} suggestions`} waiting`:"",o>0?`tidied ${o===1?"one thing":`${o} things`} while you were away`:""].filter(Boolean);return r.length>0?r.join(" \xB7 ").replace(/^./,s=>s.toUpperCase()):void 0}function F(){let{store:t,principal:o,dismissals:r,whileAway:s,app:u}=b(),h=H(),l=(0,n.useMemo)(()=>T(r,u?.name??"app",o),[r,u?.name,o]),[m,y]=(0,n.useReducer)(g=>g+1,0);(0,n.useEffect)(()=>l.onChange?.(y),[l]);let a=(0,n.useMemo)(()=>D(t,o,{dismissed:l.list()}),[t,o,h,l,m]),[w,p]=(0,n.useState)(""),i=A("suggested"),d=s?.tidied??0,c=s?O(a.length,d):void 0;if(a.length===0&&d===0)return null;let L=g=>{if(p(g),a.length>1){requestAnimationFrame(()=>document.querySelector('[data-testid="suggested"] [data-testid="suggestion-accept"]')?.focus());return}i.setOpen(!1),(document.querySelector('[data-testid="activity-button"]')??document.querySelector('[data-graview-app-bar] button:not([data-testid="suggested-button"])'))?.focus()};return(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"suggested-button",...i.trigger,onClick:i.toggle,title:c??"What tidying suggests, waiting for you",...c?{"aria-label":`Suggested: ${c}`}:{},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:[a.length>0?a.length:`Tidied ${d}`,(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("path",{d:"M3 4.5 H13 M3 8 H10 M3 11.5 H8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12.25",cy:"11.5",r:"1.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]}),a.length>0?(0,e.jsx)("span",{className:"graview-activity-word",children:" Suggested"}):null]}),i.open?(0,e.jsxs)("section",{...i.pane,"aria-label":"Suggested","data-testid":"suggested","data-graview-offstage":"",style:{...W,width:"min(320px, calc(100vw - 16px))",maxHeight:"min(52cqh, 460px)",overflowX:"hidden",overflowY:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...f,margin:0},children:"Suggested"}),c?(0,e.jsxs)("p",{"data-testid":"while-away",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[c,"."]}):null,(0,e.jsx)("p",{style:{margin:0,fontSize:"0.75rem",lineHeight:1.45,color:"var(--graview-ink-faint)"},children:a.length>0?"Not made yet: each waits for you.":"What it did is in Activity."}),(0,e.jsx)("ol",{"data-testid":"suggestions",style:{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:10,fontSize:"0.8125rem",minWidth:0},children:a.map(g=>(0,e.jsx)(q,{suggestion:g,notNow:l,settled:L},g.id))}),(0,e.jsx)("span",{role:"status","data-testid":"suggestion-heard",style:f,children:w})]}):null]})}var S={minWidth:0,overflowWrap:"anywhere"},$={accept:"Accepted.",decline:"Declined: it will not be suggested again.",later:"Hidden from you until tomorrow."};function q({suggestion:t,notNow:o,settled:r}){let{store:s,principal:u,seats:h,people:l}=b(),[m,y]=(0,n.useState)(null),a=(0,n.useId)(),w=x(t.author,{graph:s.graph,schema:s.schema,seats:h,people:l}),p=async i=>{y(null);try{i==="accept"?E(s,t.id,{author:u}):i==="decline"?R(s,t.id,{author:u}):await o.dismiss({suggestion:t.id,at:new Date().toISOString(),until:N()}),r($[i])}catch(d){y(d instanceof Error?d.message:String(d))}};return(0,e.jsxs)("li",{"data-testid":"suggestion","data-suggestion":t.id,style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:5,lineHeight:1.45,minWidth:0},children:[(0,e.jsxs)("span",{"data-graview-suggestion-words":"",style:S,children:[(0,e.jsx)("strong",{style:{fontWeight:600},children:w})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:"suggests"})," ",t.intent]}),t.lineage?(0,e.jsx)("span",{"data-graview-lineage":"",style:{...S,color:"var(--graview-ink-faint)"},children:C(t.lineage)}):null,t.about.length>0?(0,e.jsx)("div",{"data-graview-suggestion-records":"",style:{display:"flex",flexWrap:"wrap",gap:4,minWidth:0},children:t.about.slice(0,4).map(i=>(0,e.jsx)(z,{label:I(s,i),pickId:i},i))}):null,(0,e.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:6,minWidth:0},children:[(0,e.jsx)("button",{type:"button","data-testid":"suggestion-accept",onClick:()=>void p("accept"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Accept"}),(0,e.jsx)("button",{type:"button","data-testid":"suggestion-decline",onClick:()=>void p("decline"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Decline"}),(0,e.jsx)("button",{type:"button","data-testid":"suggestion-not-now",onClick:()=>void p("later"),title:"Hide it from you until tomorrow. It still waits for everyone else.","aria-describedby":a,style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem",marginInlineStart:"auto",border:"1px solid transparent",background:"transparent",boxShadow:"none",color:"var(--graview-ink-muted)"},children:"Not now"}),(0,e.jsx)("span",{id:a,style:f,children:"Hides it from you until tomorrow; it still waits for everyone else."})]}),m?(0,e.jsx)("span",{"data-testid":"suggestion-refused",role:"alert",style:{...S,fontSize:"0.75rem",color:"var(--graview-warn)"},children:m}):null]})}export{F as SuggestedTray,O as awayWords};
@@ -1 +0,0 @@
1
- import{k as a,l as o}from"./chunk.CFKZXLXS.js";import"./chunk.Y5C4RXG7.js";import"./chunk.7MHCGVGM.js";import"./chunk.FRYBMS3W.js";import"./chunk.NGTRL5U4.js";import"./chunk.3MOJF7BA.js";import"./chunk.LZIBQ3VX.js";import"./chunk.TAT2IQUR.js";import"./chunk.3XGA65Y3.js";import"./chunk.BYKD5RLA.js";import"./chunk.2K4TT2BV.js";import"./chunk.VUBNBTJP.js";import"./chunk.WVUJXDXZ.js";import"./chunk.7VKSXGTX.js";import"./chunk.TY4GQJKC.js";import"./chunk.6ZQAR5ZA.js";import"./chunk.W3W54DSX.js";import"./chunk.PI44XMY2.js";import"./chunk.KGW75Z5L.js";import"./chunk.GZHZLJBF.js";import"./chunk.IOK4GVJC.js";import"./chunk.OJGHDWI6.js";import"./chunk.TLJOZSDD.js";import"./chunk.MSWWWLEA.js";import"./chunk.UITT6JWW.js";import"./chunk.A5PDXNY6.js";import"./chunk.WC3DENU4.js";import"./chunk.VNDKKTED.js";import{ta as n}from"./chunk.4MP72LPR.js";import"./chunk.SDO3U72B.js";import"./chunk.VSCIXAHN.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var w=new WeakMap;function p(e,i){let t=w.get(e);t||w.set(e,t=new Map);let r=t.get(i);return r||t.set(i,r=a(o(e,n(e)),e,i)),r}export{p as frameworkViews};
@@ -1 +0,0 @@
1
- import{a as Y,b as _,c as D,e as R,h as H,i as q,j as S,k as N,l as x,o as P,p as V}from"./chunk.LZIBQ3VX.js";import{b as U}from"./chunk.UITT6JWW.js";import{G as T,K as j,Q as A,Ya as F,Z as W,bb as I,da as k,ga as B}from"./chunk.VSCIXAHN.js";function te(e,r){return e===void 0||e===!0?!0:e===!1?!1:e[r]!==!1}function ne(e){let r={};return e.query&&e.query.trim().length>0&&(r.q=e.query),e.archived!==void 0&&e.archived!==!1&&(r.archived=String(e.archived)),e.sort&&(r.sort=e.sort.direction==="desc"?`${e.sort.by}:desc`:e.sort.by),e.filter?.length&&(r.filter=e.filter.map(n=>`${n.key}:${n.value}`).join(",")),e.group&&(r.group=e.group.bucket?`${e.group.by}:${e.group.bucket}`:e.group.by),r}function oe(e,r){let n=[],d={};if(e.query&&(d.query=e.query),e.archived!==void 0&&e.archived!==!1&&(d.archived=e.archived),e.sort&&(r.sorts.some(u=>u.key===e.sort.by)?d.sort=e.sort:n.push(`sort ${e.sort.by}`)),e.filter){let u=e.filter.filter(c=>r.filters.find(a=>a.key===c.key)?!0:(n.push(`filter ${c.key}`),!1));u.length>0&&(d.filter=u)}return e.group&&(r.groups.some(u=>u.key===e.group.by)?d.group=e.group:n.push(`group ${e.group.by}`)),{arrangement:d,dropped:n}}function O(e,r){return B(e.schema.tryDefinition(r.kind),S(r))}var ie=(e,r)=>e==null?r==null?0:1:r==null?-1:typeof e=="number"&&typeof r=="number"?e-r:typeof e=="boolean"&&typeof r=="boolean"?e===r?0:e?1:-1:String(e).localeCompare(String(r),void 0,{numeric:!0,sensitivity:"base"});function se(e,r,n){if(n==="label")return O(e,r);let d=e.schema.tryDefinition(r.kind);return d&&n in(d.fields.shape??{})?F(q(r),n,e.today??j()):d?.computed?.[n]!==void 0?e.read?.(r,n):N(e.graph,r.id,n).map(c=>O(e,c)).sort()[0]}var de=/^(\d{4})-(\d{2})-(\d{2})/;function Z(e,r){if(T.test(e)){let[s,i]=[e.slice(0,4),e.slice(5,7)];return r==="year"?`${s}-01-01`:r==="decade"?`${String(Number(s)-Number(s)%10).padStart(4,"0")}-01-01`:r==="month"&&i?`${s}-${i}-01`:e}let n=de.exec(e);if(!n)return;let[,d,u,c]=n;if(r==="day")return`${d}-${u}-${c}`;if(r==="month")return`${d}-${u}-01`;if(r==="year")return`${d}-01-01`;if(r==="decade")return`${String(Number(d)-Number(d)%10).padStart(4,"0")}-01-01`;let f=new Date(Date.UTC(Number(d),Number(u)-1,Number(c))),a=(f.getUTCDay()+6)%7;return f.setUTCDate(f.getUTCDate()-a),f.toISOString().slice(0,10)}function ue(e,r){return T.test(e)?A(e):r==="month"?W(e):r==="week"?`Week of ${A(e)}`:r==="year"?e.slice(0,4):r==="decade"?`The ${e.slice(0,4)}s`:A(e)}function fe(e,r,n){return z(e,n)(r)}function z(e,r){let{words:n,conditions:d}=P(r);if(n.length===0&&d.length===0)return()=>!0;let u=new Map,c=f=>{let a=u.get(f);return a||(a=new Set(R(e.schema,f).filters.map(s=>s.key)),u.set(f,a)),a};return f=>{let a=c(f.kind),s=d.filter(i=>a.has(i.key));return s.every(i=>x(e,f,i))?n.length>0?V(e.schema.tryDefinition(f.kind),S(f),n,e.searchIn)!==void 0:s.length>0:!1}}function ae(e,r,n){let d=r.query?.trim(),u=r.archived===void 0?e:e.filter(t=>I(t,r.archived)),c=d?u.filter(z(n,d)):u,f=r.filter?.length?c.filter(t=>r.filter.every(l=>x(n,t,l))):[...c],a=[];for(let t=r.sort;t&&a.length<4;t=t.then)a.push(t);let s=a.length>0?f.map((t,l)=>({node:t,index:l,values:a.map(o=>se(n,t,o.by))})).sort((t,l)=>{for(let[o,p]of a.entries()){let[b,E]=[t.values[o],l.values[o]],G=ie(b,E),M=p.direction==="desc"&&G!==0&&b!==void 0&&E!==void 0?-G:G;if(M!==0)return M}return t.index-l.index}).map(t=>t.node):f,i=r.group;if(!i)return{nodes:s,groups:[{key:"",label:"",nodes:s}],grouped:!1};let y=new Map,g=(t,l,o)=>{let p=y.get(t)??{label:l,nodes:[]};p.nodes.push(o),y.set(t,p)},L=s[0],m=L?n.schema.tryDefinition(L.kind):void 0,w=m?.fields.shape??{},X=m?Y(m,i.by):k(i.by),$=i.by in w,h=$?_(w[i.by]):void 0,ee=D(n.schema,L?.kind??"").find(t=>t.key===i.by)?.label,v=$?`No ${X.toLowerCase()}`:`Without ${(ee??k(i.by)).toLowerCase()}`,K=$?new Map:U([...new Map(s.flatMap(t=>N(n.graph,t.id,i.by)).map(t=>[t.id,t])).values()].map(S),t=>n.schema.tryDefinition(t));for(let t of s){if($){let o=F(q(t),i.by,n.today??j());if(o==null||o==="")g("",v,t);else if(h==="date"){let p=i.bucket??"day",b=Z(String(o),p);b?g(b,ue(b,p),t):g("",v,t)}else if(h==="boolean")g(o?"1":"0",o?"Yes":"No",t);else{let p=m?.display?.format?.[i.by];g(String(o),p?p(o):h==="choice"?k(String(o)):String(o),t)}continue}let l=N(n.graph,t.id,i.by).map(o=>({id:o.id,label:K.has(o.id)?`${O(n,o)} \xB7 ${K.get(o.id)}`:O(n,o)})).sort((o,p)=>o.label.localeCompare(p.label));l.length===0?g("",v,t):g(l.map(o=>o.id).join(","),l.map(o=>o.label).join(", "),t)}let C=h==="choice"?H(w[i.by]):void 0,re=[...y.entries()].sort(([t,l],[o,p])=>t===""?1:o===""?-1:C?C.indexOf(t)-C.indexOf(o):h==="boolean"?o.localeCompare(t):h==="date"?t.localeCompare(o):l.label.localeCompare(p.label)).map(([t,l])=>({key:t,label:l.label,nodes:l.nodes}));return{nodes:s,groups:re,grouped:!0}}function Q(e){if(e===void 0)return;if(typeof e=="string")return{by:e,direction:"asc"};let r=e.then===void 0?void 0:typeof e.then=="string"?{by:e.then,direction:"asc"}:{by:e.then.by,direction:e.then.direction??"asc"};return{by:e.by,direction:e.direction??"asc",...r?{then:r}:{}}}function J(e){if(e!==void 0)return typeof e=="string"?{by:e}:e}function le(e){let r=Q(e?.sort),n=J(e?.group);if(!(!r&&!n))return{...r?{sort:r}:{},...n?{group:{by:n.by}}:{}}}var ce=(e,r)=>r?e==="1"?"true":"false":e;function pe(e,r,n){let d=n.type==="boolean",u=d?["true","false"]:n.options??[],c=[...new Set([...(r.order??[]).filter(s=>u.includes(s)),...u])],f=r.closed??[],a=s=>{if(s.key==="")return[1,0];let i=ce(s.key,d);if(f.includes(i))return[2,f.indexOf(i)];let y=c.indexOf(i);return[0,y<0?c.length:y]};return e.map((s,i)=>({group:s,at:i,rank:a(s)})).sort((s,i)=>s.rank[0]-i.rank[0]||s.rank[1]-i.rank[1]||s.at-i.at).map(({group:s,rank:i})=>({...s,closed:i[0]===2}))}export{J as a,le as b,pe as c,te as d,ne as e,oe as f,fe as g,ae as h};