graview 0.1.54 → 0.1.55

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 (178) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +6 -6
  3. package/dist/index.js.map +1 -1
  4. package/dist/preview/{chunk.RCFAHV5N.js → chunk.27ZSRO3O.js} +1 -1
  5. package/dist/preview/{chunk.AKLVSZ5A.js → chunk.2HANQ737.js} +1 -1
  6. package/dist/preview/{chunk.DTJ4FIHM.js → chunk.2KH2LWZL.js} +1 -1
  7. package/dist/preview/{chunk.K2J26XMB.js → chunk.2ORJGMRT.js} +2 -2
  8. package/dist/preview/{chunk.L7MFTL5S.js → chunk.2SWQI4HF.js} +1 -1
  9. package/dist/preview/{chunk.6TILXTP6.js → chunk.354A4QCG.js} +1 -1
  10. package/dist/preview/chunk.35O5H5L7.js +2 -0
  11. package/dist/preview/chunk.3IZOXNJH.js +1 -0
  12. package/dist/preview/{chunk.4V64RBCK.js → chunk.4BFJWNVM.js} +1 -1
  13. package/dist/preview/{chunk.E5JX5LWY.js → chunk.4OMSQFIY.js} +1 -1
  14. package/dist/preview/{chunk.B6PKKEY3.js → chunk.4TLWZVVG.js} +1 -1
  15. package/dist/preview/chunk.5D6SIBOK.js +1 -0
  16. package/dist/preview/{chunk.NEJSKMJV.js → chunk.5DPFAVCZ.js} +1 -1
  17. package/dist/preview/{chunk.AN5QCSVK.js → chunk.5EOSEVZB.js} +1 -1
  18. package/dist/preview/{chunk.5ZWE72VJ.js → chunk.5EZDXWOE.js} +1 -1
  19. package/dist/preview/{chunk.KI6M3EWZ.js → chunk.5L4J2XAI.js} +1 -1
  20. package/dist/preview/{chunk.IYYP6QUH.js → chunk.5MCXTY2P.js} +1 -1
  21. package/dist/preview/{chunk.BUDEUNBN.js → chunk.5MSNKSTE.js} +1 -1
  22. package/dist/preview/{chunk.KJGNLWU3.js → chunk.5SANELJT.js} +1 -1
  23. package/dist/preview/{chunk.HLDMTKUP.js → chunk.5XUVCM7X.js} +1 -1
  24. package/dist/preview/{chunk.C3AHDHX7.js → chunk.62LPYPP3.js} +1 -1
  25. package/dist/preview/{chunk.FCZ7UFJI.js → chunk.6JYNNPAI.js} +1 -1
  26. package/dist/preview/chunk.6NGSR2ZQ.js +1 -0
  27. package/dist/preview/{chunk.VYKEIKY5.js → chunk.6NQQUIBX.js} +1 -1
  28. package/dist/preview/{chunk.45HTFSWD.js → chunk.6UAUME5U.js} +1 -1
  29. package/dist/preview/{chunk.5RH6FO3K.js → chunk.6ZJE5M2A.js} +1 -1
  30. package/dist/preview/chunk.7ECBGIUK.js +1 -0
  31. package/dist/preview/chunk.7KERB5CH.js +1 -0
  32. package/dist/preview/{chunk.SDO3DD77.js → chunk.7WEQHJ3N.js} +1 -1
  33. package/dist/preview/{chunk.Y2DFDMT6.js → chunk.7Y6NK5CT.js} +1 -1
  34. package/dist/preview/{chunk.6BBB7SJL.js → chunk.AFEEXRN3.js} +1 -1
  35. package/dist/preview/{chunk.VTO6UWUP.js → chunk.AFK5HHLL.js} +1 -1
  36. package/dist/preview/{chunk.BOMYLOCX.js → chunk.ATXSLBE3.js} +1 -1
  37. package/dist/preview/chunk.AVNOLMCV.js +1 -0
  38. package/dist/preview/{chunk.VW6X53E7.js → chunk.AVVNQKA7.js} +1 -1
  39. package/dist/preview/chunk.AZ6Q3WT2.js +1 -0
  40. package/dist/preview/chunk.BJUUSIQY.js +1 -0
  41. package/dist/preview/{chunk.Q6RUTFU3.js → chunk.BRCKXL7B.js} +1 -1
  42. package/dist/preview/{chunk.IMHUKSPM.js → chunk.CM2ETM2A.js} +1 -1
  43. package/dist/preview/{chunk.AZGXBTOQ.js → chunk.CPNE6HPQ.js} +1 -1
  44. package/dist/preview/{chunk.4GHXAWIE.js → chunk.DB3HOKZD.js} +1 -1
  45. package/dist/preview/{chunk.3JMZHCB4.js → chunk.DBCVZGCC.js} +1 -1
  46. package/dist/preview/{chunk.MAWP27FD.js → chunk.DH4AC7TC.js} +1 -1
  47. package/dist/preview/{chunk.MVRNEC3Y.js → chunk.DKJK2MMV.js} +1 -1
  48. package/dist/preview/{chunk.4F5M5XZG.js → chunk.DNJM6WQO.js} +1 -1
  49. package/dist/preview/{chunk.LOUICR7K.js → chunk.DU75P3Y7.js} +1 -1
  50. package/dist/preview/{chunk.7UD2JR6J.js → chunk.DXJFAAOI.js} +1 -1
  51. package/dist/preview/{chunk.7TMWMW4W.js → chunk.EGSE6NNE.js} +1 -1
  52. package/dist/preview/{chunk.463PGKOL.js → chunk.EJXUOL2C.js} +1 -1
  53. package/dist/preview/{chunk.KRVEAIKW.js → chunk.EKP3HQAX.js} +1 -1
  54. package/dist/preview/{chunk.SLBWPVIY.js → chunk.FQLNBIQ5.js} +1 -1
  55. package/dist/preview/chunk.FTW3K3G6.js +5 -0
  56. package/dist/preview/{chunk.562IVJHX.js → chunk.FUS2FJS3.js} +1 -1
  57. package/dist/preview/{chunk.5C43AM3X.js → chunk.FUZWXKTN.js} +1 -1
  58. package/dist/preview/chunk.FVOFTM5J.js +1 -0
  59. package/dist/preview/{chunk.LU3B3SZH.js → chunk.G2XDQPE4.js} +1 -1
  60. package/dist/preview/{chunk.ZBHFCSKO.js → chunk.G5XTASMO.js} +1 -1
  61. package/dist/preview/chunk.H536YUAZ.js +3 -0
  62. package/dist/preview/chunk.HNJFBI7J.js +1 -0
  63. package/dist/preview/{chunk.3V2WXZU3.js → chunk.HUABTCQE.js} +1 -1
  64. package/dist/preview/{chunk.PR2TSHE7.js → chunk.HXHFWZ2U.js} +2 -2
  65. package/dist/preview/{chunk.7SCENHVG.js → chunk.HXR7EEXR.js} +1 -1
  66. package/dist/preview/{chunk.MDWCX3YU.js → chunk.INBHY3SA.js} +1 -1
  67. package/dist/preview/{chunk.IDYPQ45A.js → chunk.IXHLP2CL.js} +1 -1
  68. package/dist/preview/{chunk.RBYRT2I2.js → chunk.JRRVLGEK.js} +1 -1
  69. package/dist/preview/{chunk.U7GN6UPR.js → chunk.K5WPS4RR.js} +1 -1
  70. package/dist/preview/{chunk.3SOJJAMY.js → chunk.KHJ2MCMS.js} +1 -1
  71. package/dist/preview/{chunk.C6HI3LRB.js → chunk.KIMIPHAI.js} +1 -1
  72. package/dist/preview/{chunk.3IEJQAK7.js → chunk.KVQZ5FR6.js} +1 -1
  73. package/dist/preview/chunk.KXNWZ33P.js +1 -0
  74. package/dist/preview/{chunk.LVOL2LEC.js → chunk.LEPKPNPA.js} +1 -1
  75. package/dist/preview/chunk.LLXEWLIP.js +1 -0
  76. package/dist/preview/{chunk.FWZF7X6A.js → chunk.LMXNHBGH.js} +2 -2
  77. package/dist/preview/{chunk.BPWSQVEN.js → chunk.LQCH2NFE.js} +1 -1
  78. package/dist/preview/{chunk.5VF2RT4H.js → chunk.LWLI5PI4.js} +1 -1
  79. package/dist/preview/{chunk.WICMCZ27.js → chunk.LYVRXRIH.js} +1 -1
  80. package/dist/preview/{chunk.XBDFXFWM.js → chunk.MFCBAQS3.js} +1 -1
  81. package/dist/preview/{chunk.C6HBYRGJ.js → chunk.MFOSEOF4.js} +1 -1
  82. package/dist/preview/{chunk.RLO3RDYH.js → chunk.MIQMPOWF.js} +1 -1
  83. package/dist/preview/{chunk.JLB4QP6Q.js → chunk.MNSKBGRM.js} +1 -1
  84. package/dist/preview/chunk.MSM6E6JK.js +1 -0
  85. package/dist/preview/{chunk.4KTHJY5N.js → chunk.NDLQXQV2.js} +1 -1
  86. package/dist/preview/chunk.NS6KWKF5.js +1 -0
  87. package/dist/preview/{chunk.R7RDUW37.js → chunk.NXM73RZA.js} +1 -1
  88. package/dist/preview/{chunk.FMP6NDRZ.js → chunk.O752PM42.js} +1 -1
  89. package/dist/preview/{chunk.ULSN3ASK.js → chunk.O7RMVGAB.js} +1 -1
  90. package/dist/preview/{chunk.4TGQ6Z6E.js → chunk.OIMYSR2J.js} +1 -1
  91. package/dist/preview/{chunk.PZWJUQAO.js → chunk.OL2N5NUV.js} +1 -1
  92. package/dist/preview/chunk.OS5EALHY.js +1 -0
  93. package/dist/preview/{chunk.W6NCLU5Y.js → chunk.OT6EWYK2.js} +1 -1
  94. package/dist/preview/chunk.P4ZZSFOQ.js +1 -0
  95. package/dist/preview/{chunk.7JCUSYS5.js → chunk.PCKX2FHR.js} +1 -1
  96. package/dist/preview/{chunk.CB7IUKY7.js → chunk.PHLMQO7V.js} +1 -1
  97. package/dist/preview/{chunk.FRZQSSGE.js → chunk.PIHCXN5U.js} +1 -1
  98. package/dist/preview/{chunk.FWKNR7XF.js → chunk.PIQ52FCI.js} +2 -2
  99. package/dist/preview/{chunk.NGWHV4G6.js → chunk.PM64C5PX.js} +1 -1
  100. package/dist/preview/chunk.PSLCI3GO.js +2 -0
  101. package/dist/preview/chunk.QBMIET7P.js +1 -0
  102. package/dist/preview/{chunk.XZJ6XX5I.js → chunk.QIAH7HHO.js} +1 -1
  103. package/dist/preview/{chunk.YXRKZMS5.js → chunk.QJ42D5GM.js} +1 -1
  104. package/dist/preview/{chunk.AG7CUSSV.js → chunk.QQ3YWKWU.js} +1 -1
  105. package/dist/preview/{chunk.VGOWGOGD.js → chunk.QWICAV2C.js} +2 -2
  106. package/dist/preview/chunk.R3ZS4QO6.js +18 -0
  107. package/dist/preview/{chunk.ZYW7Q5EN.js → chunk.RNYLNBIB.js} +1 -1
  108. package/dist/preview/{chunk.2LMB5E6N.js → chunk.RPVJ5IXD.js} +1 -1
  109. package/dist/preview/{chunk.GKLDSHHH.js → chunk.RZQKCLTW.js} +1 -1
  110. package/dist/preview/chunk.SDLUWRGI.js +1 -0
  111. package/dist/preview/chunk.SG67ID6C.js +1 -0
  112. package/dist/preview/{chunk.Y36WSKL5.js → chunk.SIABGHF2.js} +1 -1
  113. package/dist/preview/{chunk.ARRLAAG6.js → chunk.SUGOENC4.js} +1 -1
  114. package/dist/preview/chunk.SYX7AEHU.js +1 -0
  115. package/dist/preview/{chunk.TUNHUTQ5.js → chunk.T66UK7PQ.js} +1 -1
  116. package/dist/preview/{chunk.33YC5RCB.js → chunk.TAQB64FZ.js} +1 -1
  117. package/dist/preview/{chunk.CB5DGKR5.js → chunk.TDV7JGIQ.js} +1 -1
  118. package/dist/preview/chunk.TEE23CVQ.js +1 -0
  119. package/dist/preview/{chunk.MNW2ZBQ6.js → chunk.TT6GKRBE.js} +1 -1
  120. package/dist/preview/{chunk.DF7IPT7V.js → chunk.TUBAFVV4.js} +1 -1
  121. package/dist/preview/chunk.TZTRGNAA.js +1 -0
  122. package/dist/preview/{chunk.JTOAZ2IR.js → chunk.U5AX4DD5.js} +1 -1
  123. package/dist/preview/chunk.UADL2LHO.js +1 -0
  124. package/dist/preview/{chunk.OZ4EJ5M6.js → chunk.UE5GAP67.js} +2 -2
  125. package/dist/preview/{chunk.GHPCSNM6.js → chunk.URDCHVH3.js} +2 -2
  126. package/dist/preview/{chunk.WHGEDJB2.js → chunk.USJ4J3GL.js} +2 -2
  127. package/dist/preview/{chunk.WVWXNW74.js → chunk.V5PAFSWP.js} +1 -1
  128. package/dist/preview/{chunk.3MZIWKNG.js → chunk.WR63RQGU.js} +5 -5
  129. package/dist/preview/chunk.WSMYFEGU.js +25 -0
  130. package/dist/preview/{chunk.PZ4G5QA5.js → chunk.WUFCRE7O.js} +1 -1
  131. package/dist/preview/{chunk.GVUJCOKD.js → chunk.WVKXELAF.js} +2 -2
  132. package/dist/preview/{chunk.Y36MLVMT.js → chunk.XEHLSKHP.js} +1 -1
  133. package/dist/preview/{chunk.D2PJG5N7.js → chunk.XSMXSNDR.js} +1 -1
  134. package/dist/preview/{chunk.J2Z6WLCH.js → chunk.XTP5DGPJ.js} +1 -1
  135. package/dist/preview/{chunk.ZDDWXRPK.js → chunk.XUHY4XO2.js} +1 -1
  136. package/dist/preview/{chunk.OCV46AFN.js → chunk.Y3BEKXYB.js} +1 -1
  137. package/dist/preview/chunk.YG2WZO53.js +1 -0
  138. package/dist/preview/{chunk.XTT6ERI3.js → chunk.YGZGMRDC.js} +1 -1
  139. package/dist/preview/{chunk.4WH4N4V7.js → chunk.YOBRVKJT.js} +1 -1
  140. package/dist/preview/{chunk.2WSRJGW2.js → chunk.YRFN4VDD.js} +1 -1
  141. package/dist/preview/{chunk.B2X6DA2Q.js → chunk.YYWANGIC.js} +1 -1
  142. package/dist/preview/{chunk.COWJTVZV.js → chunk.ZAHVKXYQ.js} +1 -1
  143. package/dist/preview/{chunk.3ZONBC6L.js → chunk.ZOW7AC7U.js} +1 -1
  144. package/dist/preview/{chunk.2DFWOLL2.js → chunk.ZPXAKRKG.js} +1 -1
  145. package/dist/preview/{chunk.NDI5OWIB.js → chunk.ZXOD5GM3.js} +1 -1
  146. package/dist/preview/index.html +52 -51
  147. package/dist/preview/page.js +2 -2
  148. package/package.json +6 -6
  149. package/dist/preview/chunk.25P5SDNR.js +0 -1
  150. package/dist/preview/chunk.27O4LIDU.js +0 -1
  151. package/dist/preview/chunk.3G5DEGFA.js +0 -1
  152. package/dist/preview/chunk.4BX3KLAA.js +0 -1
  153. package/dist/preview/chunk.57VTD3CU.js +0 -1
  154. package/dist/preview/chunk.5M62CMLA.js +0 -1
  155. package/dist/preview/chunk.5XAIP3BS.js +0 -1
  156. package/dist/preview/chunk.6SPORDJC.js +0 -1
  157. package/dist/preview/chunk.D6ACCKYJ.js +0 -1
  158. package/dist/preview/chunk.EC7I33WI.js +0 -1
  159. package/dist/preview/chunk.J3OX474P.js +0 -1
  160. package/dist/preview/chunk.JCFYZEMY.js +0 -1
  161. package/dist/preview/chunk.JXGDVJ4N.js +0 -1
  162. package/dist/preview/chunk.KLJDBYAZ.js +0 -1
  163. package/dist/preview/chunk.LNOWO3IY.js +0 -2
  164. package/dist/preview/chunk.LYFEGG6E.js +0 -1
  165. package/dist/preview/chunk.MPMROUZA.js +0 -1
  166. package/dist/preview/chunk.OLKFEHWB.js +0 -1
  167. package/dist/preview/chunk.PCNEM3WE.js +0 -1
  168. package/dist/preview/chunk.QB7RYJ67.js +0 -5
  169. package/dist/preview/chunk.RYMSHMLM.js +0 -1
  170. package/dist/preview/chunk.SF4BYBH6.js +0 -25
  171. package/dist/preview/chunk.SG7YVKH4.js +0 -1
  172. package/dist/preview/chunk.T42H5RXN.js +0 -1
  173. package/dist/preview/chunk.TI4OSTQV.js +0 -1
  174. package/dist/preview/chunk.VFMC45E7.js +0 -1
  175. package/dist/preview/chunk.VWQ57LTT.js +0 -18
  176. package/dist/preview/chunk.Z6O7RUSR.js +0 -1
  177. package/dist/preview/chunk.ZAGP3OKY.js +0 -1
  178. package/dist/preview/chunk.ZUBC3UFG.js +0 -2
@@ -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 Xr}from"./chunk.ZBHFCSKO.js";import{a as Dt,b as er,c as tr,d as nr,e as rr,f as Vt,g as or,h as Bt}from"./chunk.7JCUSYS5.js";import{a as Wt,b as ir,c as sr,d as dr,e as $t,f as cr,g as lr,h as ur,i as fr,j as pr,k as mr,l as hr,m as yr,n as qe}from"./chunk.2WSRJGW2.js";import{b as ar}from"./chunk.7TMWMW4W.js";import{a as At,g as xn}from"./chunk.JCFYZEMY.js";import{k as rt}from"./chunk.ZUBC3UFG.js";import{E as Qn,I as Zn,J as Xn,h as Gn,k as Mt,l as Un,n as Kn,r as Jn,w as Ht,z as Yn}from"./chunk.FWZF7X6A.js";import{c as Zr}from"./chunk.3JMZHCB4.js";import{Aa as Nn,Ca as In,Da as _n,Fa as jn,G as Ct,Ga as Lt,Ka as qn,La as zn,Oa as it,T as Cn,Z as Ln,a as On,b as ot,c as at,ga as Mn,ha as Hn,j as Fn,m as Ft,va as Dn,wa as Vn,xa as Bn,ya as Wn,za as $n}from"./chunk.SF4BYBH6.js";import{a as Ee}from"./chunk.SDO3U72B.js";import{Bb as vn,Hd as Ae,Id as En,Jd as Rn,Od as Rt,Pd as Tt,Qd as xt,Sc as Sn,Td as Tn,Ud as Ot,cb as We,ec as Et,fc as bn,fd as Pn,hd as kn,id as An,kd as nt,nb as tt,ob as wn}from"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as Le}from"./chunk.AJZBJBMO.js";function Nt(e){if(Array.isArray(e))return e.map(Nt);if(e&&typeof e=="object"){let n={};for(let o of Object.keys(e).sort()){let i=e[o];i!==void 0&&(n[o]=Nt(i))}return n}return e}function It(e){return JSON.stringify(Nt(e))??"undefined"}async function st(e,n={}){let o=e.compiled===void 0||!to(e.compiled,e.document)?void 0:xn(e.compiled,n);if(o?.ok)return o;let{compileDocumentWithoutCheck:i}=await eo();return i(e.document,n)}var gr,eo=()=>gr??=(__graviewPreload(import.meta.url,["./chunk.JCFYZEMY.js","./chunk.BUDEUNBN.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.T42H5RXN.js")).catch(e=>{throw gr=void 0,e});function to(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&&It(At(o).document)===It(At(i).document)}var c=Le(Ct(),1);var ct=Le(Ct(),1),_t="data-graview-drawn",no=200,wr=50,ro=1e4,dt=()=>typeof performance<"u"?performance.now():Date.now();function oo(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 ao(e,n){if(e.ownerDocument.fonts?.status==="loading"||Vn()>0||Nn(n)>0||e.querySelector('[aria-busy="true"]')||oo(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 vr(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 io(e,n,o,i){e.removeAttribute(_t);let d=e.ownerDocument.defaultView;if(!d)return()=>{};let l=dt(),S=l,p=vr(e),w=!1,R,O=typeof MutationObserver>"u"?void 0:new MutationObserver(v=>{v.some(q=>!(q.target===e&&q.attributeName===_t))&&(S=dt())});O?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let P=()=>{w=!0,O?.disconnect(),R!==void 0&&clearTimeout(R)},k=v=>{let q=!1,de=()=>{q||(q=!0,v())};typeof d.requestAnimationFrame=="function"&&d.requestAnimationFrame(()=>setTimeout(de,0)),setTimeout(de,100)},C=()=>{if(w)return;let v=vr(e);v!==p&&(p=v,S=dt());let q=dt();if(ao(e,i)&&q-S>=no||q-l>=ro){k(()=>{w||(P(),e.setAttribute(_t,n),_n(),o())});return}R=setTimeout(C,wr)};return R=setTimeout(C,wr),P}function br(e,n,o,i,d){In();let l=(0,ct.useRef)({place:o,onDrawn:i});l.current={place:o,onDrawn:i},(0,ct.useLayoutEffect)(()=>{d&&$n(d);let S=R=>io(R,l.current.place.path,()=>l.current.onDrawn?.(l.current.place),d);if(e.current)return S(e.current);let p,w=!1;return queueMicrotask(()=>{!w&&e.current&&(p=S(e.current))}),()=>{w=!0,p?.()}},[n,e,d])}var ye=Le(Ct(),1),ze,so=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.KY7QD22S.js","./chunk.WICMCZ27.js","./chunk.2DFWOLL2.js","./chunk.LU3B3SZH.js","./chunk.HLDMTKUP.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.C6HI3LRB.js"))),Sr=()=>so().then(e=>void(ze=e),()=>new Promise(e=>setTimeout(e,2e3)).then(Sr)),jt=Dn(Sr),Pr=e=>!!e&&ze===void 0;function qt({onReady:e,fetch:n}){return(0,ye.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var co=0;function kr(e){let[n,o]=(0,ye.useState)(()=>ze);(0,ye.useEffect)(()=>{if(!e||n)return;let l=!1;return jt().then(()=>{l||o(ze)}),()=>{l=!0}},[e,n]);let i=(0,ye.useMemo)(()=>co+=1,[e]);return{over:(0,ye.useMemo)(()=>{let l=n??ze;if(!e||!l)return;let{source:S,worker:p,...w}=e,R={...w,worker:p??{source:S},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:O=>l.registerWorkerView(O,R)}},[e,n]),n:i}}var Rr=Le(Xr(),1),j=Le(Zr(),1);var h=Le(Cn(),1);function lt(e,n={}){let o=Lt(e);return{Face:o.part((d,l)=>(0,c.createElement)(d,l),n),fetch:()=>o.load().then(()=>{}),here:()=>o.current!==void 0||o.failed}}var Ut=e=>Promise.all([e,Zn()]).then(([n])=>n),Tr=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.EC7I33WI.js","./chunk.3ZONBC6L.js","./chunk.FWKNR7XF.js","./chunk.GKLDSHHH.js","./chunk.OCV46AFN.js","./chunk.Y36MLVMT.js","./chunk.MPMROUZA.js","./chunk.HJCQ6I3S.js","./chunk.5C43AM3X.js","./chunk.4WH4N4V7.js","./chunk.5VF2RT4H.js","./chunk.5RH6FO3K.js","./chunk.ZDDWXRPK.js","./chunk.LOUICR7K.js","./chunk.L7MFTL5S.js","./chunk.4F5M5XZG.js","./chunk.3G5DEGFA.js","./chunk.BOMYLOCX.js","./chunk.45HTFSWD.js","./chunk.Q6RUTFU3.js","./chunk.AZGXBTOQ.js","./chunk.2WSRJGW2.js","./chunk.7TMWMW4W.js","./chunk.TI4OSTQV.js","./chunk.C6HBYRGJ.js","./chunk.GZHZLJBF.js","./chunk.PZWJUQAO.js","./chunk.OJGHDWI6.js","./chunk.NEJSKMJV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.WHGEDJB2.js"))),lo=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.VWQ57LTT.js","./chunk.K2J26XMB.js","./chunk.B2X6DA2Q.js","./chunk.QB7RYJ67.js","./chunk.UGFDSE37.js","./chunk.EC7I33WI.js","./chunk.PXQVXBNG.js","./chunk.GVUJCOKD.js","./chunk.3ZONBC6L.js","./chunk.MDWCX3YU.js","./chunk.CB5DGKR5.js","./chunk.GKLDSHHH.js","./chunk.OCV46AFN.js","./chunk.4KTHJY5N.js","./chunk.PZ4G5QA5.js","./chunk.Y36MLVMT.js","./chunk.MPMROUZA.js","./chunk.XTT6ERI3.js","./chunk.5RH6FO3K.js","./chunk.L7MFTL5S.js","./chunk.XZJ6XX5I.js","./chunk.4F5M5XZG.js","./chunk.LVOL2LEC.js","./chunk.3G5DEGFA.js","./chunk.OZ4EJ5M6.js","./chunk.Q6RUTFU3.js","./chunk.AZGXBTOQ.js","./chunk.XOZU4OFA.js","./chunk.AG7CUSSV.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.GZHZLJBF.js","./chunk.PZWJUQAO.js","./chunk.OJGHDWI6.js","./chunk.NEJSKMJV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.57VTD3CU.js"))),uo=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.VWQ57LTT.js","./chunk.K2J26XMB.js","./chunk.B2X6DA2Q.js","./chunk.QB7RYJ67.js","./chunk.UGFDSE37.js","./chunk.EC7I33WI.js","./chunk.PXQVXBNG.js","./chunk.GVUJCOKD.js","./chunk.3ZONBC6L.js","./chunk.MDWCX3YU.js","./chunk.CB5DGKR5.js","./chunk.GKLDSHHH.js","./chunk.OCV46AFN.js","./chunk.4KTHJY5N.js","./chunk.PZ4G5QA5.js","./chunk.Y36MLVMT.js","./chunk.MPMROUZA.js","./chunk.XTT6ERI3.js","./chunk.5RH6FO3K.js","./chunk.L7MFTL5S.js","./chunk.XZJ6XX5I.js","./chunk.4F5M5XZG.js","./chunk.LVOL2LEC.js","./chunk.3G5DEGFA.js","./chunk.OZ4EJ5M6.js","./chunk.Q6RUTFU3.js","./chunk.AZGXBTOQ.js","./chunk.XOZU4OFA.js","./chunk.AG7CUSSV.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.GZHZLJBF.js","./chunk.PZWJUQAO.js","./chunk.OJGHDWI6.js","./chunk.NEJSKMJV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.KLJDBYAZ.js"))),xr=lt(()=>Ut(Tr().then(e=>e.SceneFace)),{what:"This view"}),Or=lt(()=>Tr().then(e=>e.SceneKeeping),{quiet:!0}),Fr=lt(()=>Ut(lo().then(e=>e.PagesContent)),{what:"This page"}),Cr=lt(()=>Ut(uo().then(e=>e.PictureFace)),{what:"This picture"}),fo=xr.Face,po=Or.Face,mo=Fr.Face,ho=Cr.Face;function Me(...e){let n=e.length>0?e:["scene","pages","picture"],o=new Set(n.flatMap(Lr));return Promise.all([...[...o].map(i=>i.fetch()),Kn()]).then(()=>{},()=>{})}var Lr=e=>e==="pages"?[Fr]:e==="picture"?[Cr]:[xr,Or],Mr=e=>Lr(e).every(n=>n.here()),yo=150,zt=0;function Ar(e,n){if(Mr(e))return n();let o=++zt,i=()=>{o===zt&&(zt+=1,n())};Me(e).then(i),setTimeout(i,yo)}var go=768;function wo(e,n){let o=n!==null&&n>=go;(0,c.useEffect)(()=>{if(!o||e==="picture")return;let i=e==="pages"?"scene":"pages";if(Mr(i))return;let d=globalThis,l=()=>void Me(i),S=()=>{},p=jn(()=>{if(d.requestIdleCallback&&d.cancelIdleCallback){let w=d.requestIdleCallback(l,{timeout:4e3});S=()=>d.cancelIdleCallback?.(w)}else{let w=setTimeout(l,1500);S=()=>clearTimeout(w)}});return()=>(p(),S())},[e,o])}function vo({asked:e,shown:n,onDrawn:o}){return(0,c.useLayoutEffect)(()=>o(e,n),[e,n,o]),null}function bo({auto:e,scene:n}){return(0,h.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${$t}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var So=Lt(Ee(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,h.jsx)(e.StudioPlace,{...n}),{quiet:!0});function Hr(e,n,o,i,d){return Vt(e,rr(n?at(n):d??On,i),o)}function Kt(e){return e&&at(e).overview?"graview":"scene"}function Er(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 Dr(e){let[,n]=(0,c.useState)(!1),o=(0,c.useCallback)(()=>n(!0),[]),i=(0,c.useRef)(!1);return e.at&&!ut?(0,h.jsx)(qt,{onReady:o,fetch:Jt}):!i.current&&Pr(e.draftView)?(0,h.jsx)(qt,{onReady:o,fetch:jt}):(i.current=!0,(0,h.jsx)(Po,{...e}))}function Po(e){let{app:n,stop:o,bar:i=!0,standing:d="Everything is in order",principal:l,heading:S=2}=e,{rootRef:p,scope:w,css:R,scheme:O,store:P,presence:k,brand:C,auto:v,height:q}=cr(e),de=kr(e.draftView),V=sr(e,Xn,de.over),[ee]=(0,c.useState)(Wn),f=e.basePath===void 0?{}:{basePath:e.basePath},[B]=(0,c.useState)(Mt),U=e.notices??B,Q=y=>Rt(y,f),F={...e.routing?{routing:e.routing}:{},...f},[ue]=(0,c.useState)(()=>{let y=e.at?.face;if(y)return y;let H=o===void 0&&Er(n,V)?"pages":Kt(o),D=Dt({...F,face:H});return e.face===void 0&&e.onOpening?.(D),D}),[W,x]=(0,c.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&o===void 0&&er(F)&&Er(n,V)),Te=(0,c.useRef)(e.onFace);Te.current=e.onFace,(0,c.useLayoutEffect)(()=>{W&&(Te.current?.("pages"),x(!1))},[W]);let A=W?"pages":e.face??ue,oe=n.schema.kinds,T=e.routing==="address",Z=(0,c.useMemo)(()=>e.at?ut.settleAt(e,P.seenBy(l??{kind:"human"}),V.places()):void 0,[]),$=(0,c.useMemo)(()=>Hn(V,n.schema),[V,n.schema]),fe=(0,c.useMemo)(()=>{let y=Z?.stop??(T?tr(e.basePath):void 0)??o;return A==="scene"&&y===void 0&&$===void 0&&(e.path===void 0||Gt(e.path))?Bt(void 0):Hr(A,y,oe,V.places(),$)},[]),[ve]=(0,c.useState)(A);(0,c.useEffect)(()=>{ve!=="pages"&&Mn(V)},[ve,V]);let N=(0,c.useRef)(void 0),z=y=>y===void 0||Gt(y)?"/":y;N.current??={path:z(Z?.path??(T?A==="pages"?(Tt(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==N.current.asked&&(N.current={path:z(e.path),asked:e.path});let I=(0,c.useRef)(e.onNavigate);I.current=e.onNavigate;let ae=(0,c.useCallback)((y,H)=>{N.current.path=y,I.current?.(y,H)},[]),{at:L,setAt:xe,steering:K,steer:te}=mr(N.current.path),M=(0,c.useContext)(Vr);M&&(M.pages=()=>N.current.path);let pe=(0,c.useRef)(void 0),ie=(0,c.useCallback)(y=>void(N.current.path=y),[]),ce=Gn(p),[be,He]=(0,c.useState)(!1),Y=e.pagesBelow!==void 0&&ce!==null&&ce<e.pagesBelow&&(A==="scene"||A==="graview")&&!be,E=Y?"pages":A,Ie=(0,c.useRef)(!1);Ie.current=be&&e.pagesBelow!==void 0&&ce!==null&&ce<e.pagesBelow&&(A==="scene"||A==="graview"),M&&(M.shown=E);let ne=(0,c.useRef)(A==="graview"?"graview":"scene");(E==="scene"||E==="graview")&&(ne.current=E),(0,c.useState)(()=>{if(!T||typeof window>"u"||E==="pages"||E==="picture")return;let{pathname:y,search:H,hash:D}=window.location;Tt(y,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${Q(Ae)}${H}${D}`)}),dr(p,E,e.onIntrinsicHeight),wo(E,ce);let le=hr(e.onError,E),Se=yr(e.onReady,E),_e=(0,c.useRef)(e.onFaceDrawn);_e.current=e.onFaceDrawn;let De=(0,c.useCallback)((y,H)=>{Se(H),_e.current?.(y)},[Se]),[ht,yt]=(0,c.useState)(null),Ue=V.places(),_=(0,c.useRef)({shown:E,onFace:e.onFace});_.current={shown:E,onFace:e.onFace};let re=(0,c.useCallback)((y,H,D)=>{if(T){pe.current?.(y,H,D);return}_.current.onFace?.(y),I.current?.(y==="pages"?H??N.current.path:Ae,"push")},[T]),[X,Oe]=(0,c.useState)(void 0);(0,c.useEffect)(()=>{E==="pages"&&Oe(void 0)},[E]);let Pe=(0,c.useRef)(o);(0,c.useEffect)(()=>{Pe.current!==o&&(Pe.current=o,Oe(void 0))},[o]);let Ke=(0,c.useCallback)(y=>{if(_.current.shown==="pages"){if(He(!0),Oe(y),A==="scene"||A==="graview"){Ar(A,()=>{T?window.history.pushState(null,"",`${Q(Ae)}${y??""}`):I.current?.(Ae,"push")});return}Ar(ne.current,()=>re(ne.current,void 0,y))}},[T,A,e.basePath,re]),ke=(0,c.useCallback)(y=>{if(_.current.shown==="pages"){K.go.current||(N.current.path=y),te(y);return}if(N.current.path=y,xe(y),Ie.current){He(!1),T?window.history.pushState(null,"",Q(y)):I.current?.(y,"push");return}re("pages",y)},[K,te,xe,re,T,e.basePath]),Fe=V.arrangement?.(),me=E==="pages",Ve=e.hrefOf,G=Ve??(T?Q:void 0),Ce=(0,c.useMemo)(()=>({open:ke,...Ve?{href:Ve}:T?{href:y=>Rt(y,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[ke,T,e.basePath,Ve]);return(0,h.jsxs)("section",{ref:p,className:w,"aria-label":e.label??n.name,"data-graview-embed":E,"data-graview-scheme":O,...Y?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:q,minHeight:v?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,h.jsx)("style",{children:R}),(0,h.jsxs)(zn.Provider,{value:le,children:[(0,h.jsx)(lr,{rootRef:p,board:U}),(0,h.jsx)(ir,{rootRef:p,firstLook:e.firstLook,app:Yn(C??{name:n.name},n.schema)}),(0,h.jsx)(qe,{module:"@graview/react",report:le,content:!0,children:(0,h.jsx)(Bn.Provider,{value:ee,children:(0,h.jsx)(Ln,{store:P,views:V,initialView:fe,scheme:O,...ur(e,k,C),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,h.jsxs)(Un.Provider,{value:U,children:[(0,h.jsx)(Ro,{face:E,stop:X??o,kinds:oe,places:Ue,opens:$}),M?(0,h.jsx)(ko,{into:M}):null,(0,h.jsx)(Ao,{rootRef:p,face:A,shown:E,path:L,stop:o,draft:de.n,onDrawn:e.onDrawn,parts:ee}),T?(0,h.jsx)(nr,{pagesWere:Z?.path,basePath:e.basePath,shown:E,onFace:e.onFace,toggle:pe,kinds:oe,places:Ue,opens:$,landed:ie}):null,i&&E!=="picture"?(0,h.jsx)(qe,{module:"@graview/embed",report:le,children:(0,h.jsx)(fr,{name:C?.name??n.name,heading:S,named:Wt(i).name!==!1,faces:Wt(i).faces===!1?void 0:{scene:{label:En(Fe),current:!me,go:()=>Ke(),reach:()=>void Me(ne.current)},pages:{label:Rn(Fe),current:me,go:()=>ke(N.current.path),reach:()=>void Me("pages")}},at:me?L:null,without:e.pages?.without(),home:{...G?.("/")!==void 0?{href:G("/")}:{},go:()=>ke("/"),current:me&&L.split("?")[0]==="/"},reach:{...G?{href:G}:{},go:y=>ke(y.path)},standing:d,hostActions:e.hostActions,keeping:me?void 0:(0,h.jsx)(To,{app:n,studio:e.studio,report:le}),onFind:yt,switch:e.switch})}):null,(0,h.jsx)(Jn.Provider,{value:ht,children:(0,h.jsx)(qe,{module:E==="pages"||E==="picture"?"@graview/pages":"@graview/react",report:le,content:!0,children:(0,h.jsxs)(c.Suspense,{fallback:(0,h.jsx)(bo,{auto:v,scene:E!=="pages"&&E!=="picture"}),children:[E==="picture"?(0,h.jsx)(ho,{scope:w,store:P,views:V,as:(o?at(o).within?.view:void 0)??""}):E==="pages"?(0,h.jsx)(mo,{store:P,views:V,presence:k,auto:v,brand:C,steering:K,overview:Ke,scope:w,titleLevel:pr(S),quickAsk:Ht(e.quickAsk),props:{...e,onNavigate:ae,...T?{}:{path:N.current.path}}}):(0,h.jsx)(qn.Provider,{value:Ce,children:(0,h.jsx)(fo,{address:T,auto:v,scheme:O,scope:w,quickAsk:Ht(e.quickAsk)})}),(0,h.jsx)(vo,{asked:A,shown:E,onDrawn:De})]})},E)})]})})})})]})]})}var Gt=e=>e.split(/[?#]/)[0]===Ae,Vr=(0,c.createContext)(null);function ko({into:e}){return e.view=it().view,null}function Ao({rootRef:e,face:n,shown:o,path:i,stop:d,draft:l,onDrawn:S,parts:p}){let{view:w}=it(),R=o==="scene"||o==="graview",O=ot(w),{pan:P,...k}=w,C=w.pan?ot(k):O,v={face:n,path:R?Ae:o==="picture"?d??"#":i,stop:O};return br(e,`${o} ${R?C:v.path} ${l}`,v,S,p),null}var ut,Eo=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.7JCUSYS5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.Y36WSKL5.js"))),Jt=()=>Eo().then(e=>void(ut=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(o),e()},o=setTimeout(n,1e4);window.addEventListener("online",n)}).then(Jt));function Ro({face:e,stop:n,kinds:o,places:i,opens:d}){let{view:l,go:S}=it(),p=(0,c.useRef)({face:e,stop:n});return(0,c.useLayoutEffect)(()=>{let w=p.current.stop!==n,R=p.current.face!==e,O=p.current.face==="pages";if(p.current={face:e,stop:n},!w&&!R||e==="pages"||e==="picture")return;let P=(w||O)&&n!==void 0?Hr(e,n,o,i):O&&or(l)?Vt(e,Bt(d),o):e==="graview"?Ft(l,!0):l.overview?Fn(Ft(l,!1),Qn(l,o)):l;S(P)},[e,n,o,l,S,d]),null}function To({app:e,studio:n,report:o}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c.Suspense,{fallback:null,children:(0,h.jsx)(po,{})}),n!==!1?(0,h.jsx)(qe,{module:"@graview/studio",report:o,children:(0,h.jsx)(xo,{app:e,studio:n})}):null]})}function xo({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,h.jsx)(i,{...o}):(0,h.jsx)(c.Suspense,{fallback:null,children:(0,h.jsx)(So,{...o})})}function Oo({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 Yt(e,n){let o=n.store??n.remote?.store??ar(n.app,n.seed),i=n.notices??Mt(),d=null,l={},S=0,p=n.label,w=n.app,R=Promise.resolve(),O=n.at?.face??n.face,P=O===void 0?void 0:Dt({...n,face:O}),k=P??Kt(n.stop),C=null,v=[],q=f=>{if(C=f,f!==k)return;let B=v;v=[];for(let U of B)U()};function de(){let[f,B]=(0,c.useState)(P),[U,Q]=(0,c.useState)(n.stop),[F,ue]=(0,c.useState)(n.path),[W,x]=(0,c.useState)(n.scheme??"auto"),[Te,A]=(0,c.useState)(n.principal),[oe,T]=(0,c.useState)(n.seats),[Z,$]=(0,c.useState)(n.quickAsk),[fe,ve]=(0,c.useState)(n.people),[N,z]=(0,c.useState)(n.hostContext),[I,ae]=(0,c.useState)(n.brand),[L,xe]=(0,c.useState)(n.whileAway),[K,te]=(0,c.useState)(n.label),[M,pe]=(0,c.useState)(n.hostActions),[ie,ce]=(0,c.useState)(void 0),[be,He]=(0,c.useState)(n.draftView);return d={app:Y=>{ce(Y),ue(void 0),Q(void 0)},face:B,stop:Q,path:ue,scheme:x,seat:A,seats:T,quickAsk:$,people:ve,hostContext:z,brand:ae,whileAway:xe,label:te,hostActions:pe,draft:He},(0,h.jsx)(Vr.Provider,{value:l,children:(0,h.jsx)(Dr,{...ie?Oo(n,ie):n,store:o,notices:i,...f!==void 0?{face:f}:{},onOpening:Y=>{k=Y},...U!==void 0?{stop:U}:{},...F!==void 0?{path:F}:{},...Te?{principal:Te}:{},...oe?{seats:oe}:{},...Z!==void 0?{quickAsk:Z}:{},...fe?{people:fe}:{},...N?{hostContext:N}:{},...I?{brand:I}:{},whileAway:L,label:K,hostActions:M,draftView:be,scheme:W,onFace:Y=>{k=Y,B(Y)},onSeat:A,onFaceDrawn:q},ie?.n??0)})}let V=()=>{let f=l.view?.focusId,B=f?o.graph.getNode(f)?.kind:void 0,U=(l.shown??k)==="scene"||(l.shown??k)==="graview";return{face:k,path:U?Ae:l.pages?.()??n.path??"/",stop:l.view?ot(l.view):n.stop??"#",...B?{kind:B}:{}}},ee=(0,Rr.createRoot)(e);return(0,j.flushSync)(()=>ee.render((0,h.jsx)(de,{}))),{get store(){return o},where:V,setApp:(f,B,U)=>{let Q="graph"in B?{store:B}:B,F=()=>{let ue=V();o=Q.store,p=U?.label??(p===w.name?f.name:p),w=f,(0,j.flushSync)(()=>{d?.label(p),d?.app({app:f,remote:Q,at:ue,n:++S})})};ut?F():R=R.then(Jt).then(F)},setFace:f=>{k=f,(0,j.flushSync)(()=>d?.face(f))},setStop:f=>(0,j.flushSync)(()=>d?.stop(f)),setPath:f=>(0,j.flushSync)(()=>{if(Gt(f)){(k==="pages"||k==="picture")&&(k="scene",d?.face("scene"));return}d?.path(f),k!=="pages"&&(k="pages",d?.face("pages"))}),setScheme:f=>(0,j.flushSync)(()=>d?.scheme(f)),setSeat:f=>(0,j.flushSync)(()=>d?.seat(f)),setSeats:f=>(0,j.flushSync)(()=>d?.seats(f)),setQuickAsk:f=>(0,j.flushSync)(()=>d?.quickAsk(f)),setPeople:f=>(0,j.flushSync)(()=>d?.people(f)),setHostContext:f=>(0,j.flushSync)(()=>d?.hostContext(f)),setBrand:f=>(0,j.flushSync)(()=>d?.brand(f)),setWhileAway:f=>(0,j.flushSync)(()=>d?.whileAway(f)),setDraftView:f=>(0,j.flushSync)(()=>d?.draft(f)),setLabel:f=>{p=f,(0,j.flushSync)(()=>d?.label(f))},setHostActions:f=>(0,j.flushSync)(()=>d?.hostActions(f)),drawn:()=>R.then(()=>C===k?void 0:new Promise(f=>v.push(f))),notify:f=>{let B;return(0,j.flushSync)(()=>{B=i.notify(f)}),B},unmount:()=>ee.unmount()}}var ft=e=>`s${(e+1).toString(36)}`;var Br="/graview/live",Qt="graview.ship",Zt=`${Qt}.${tt}`;var ge={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"};var $e=class extends Error{constructor(n){super(n),this.name="Superseded"}},Re=e=>e?.lineage?{lineage:e.lineage}:{},Fo=(e,n)=>`${e.calls.map(o=>o.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
2
- `)[0]??"":String(n)})`;function Co(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 Ne=class extends Error{constructor(o){super(o.sentence);this.refusal=o;this.name="RemoteRefusedError"}},Lo={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},we=class extends Error{constructor(o,i){super(o);this.conflicts=i;this.name="StaleWrite"}},Ge=class extends Error{constructor(n){super(n),this.name="Unreached"}},Mo=new Set([502,503,504]);async function Ho(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function Do(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var Vo=1,Bo=()=>({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 pt(e){return(await Wr(e,Co(e.carry),"This app was updated while your changes were on the way.",Bo())).remote}async function Wr(e,n,o,i){let d=e.fetch??fetch,l={"content-type":"application/json",...e.headers??{}},S={...mt(e.principal),[ge.via]:e.via??"web"};Object.assign(l,S);let p=e.live===!0,w=e.presenceEveryMs,R=e.visible??No,O="connecting",P=i.statuses,k=i.tally,C=[],v,q=[],de=()=>O==="online"&&v!==void 0?"held":O,V=()=>{let t=de();if(i.told!==t){i.told=t;for(let r of[...P])r(t)}},ee=t=>{if(!(t===O||se)&&(O==="offline"&&t==="online"&&k.reconnects++,O=t,V(),t==="online"))for(let r of C.splice(0))r.again()},f=t=>{if(se)return;let r=typeof t=="string"&&t.length>0?t:void 0,s=r!==v;if(v=r,B(),!!s&&(V(),r===void 0)){for(let a of q.splice(0))a();D&&clearTimeout(D),rn()}},B=()=>{if(i.toldHeld!==v){i.toldHeld=v;for(let t of[...i.helds])t(v??null)}},U=async(t,r)=>{let s;try{s=await d(t,r)}catch(a){throw G()||ee("offline"),new Ge(a instanceof Error?a.message:String(a))}if(s.status===503&&await Ho(s))return ee("online"),s;if(Mo.has(s.status))throw G()||ee("offline"),new Ge(`The server is away (${s.status})`);return ee("online"),s},Q=async(t=!1)=>{let r=`${e.url}/graview/state?opFormat=${We.op}`,s=t?await d(r,{headers:l}):await U(r,{headers:l});if(!s.ok)throw new Error((await s.json().catch(()=>({}))).error??`The server refused (${s.status})`);return await s.json()},F=e.state??await Q(!0);p||(O="online"),v=typeof F.held=="string"&&F.held.length>0?F.held:void 0,B();let ue=F.enabledModules??e.enabledModules,W=e.localApp?e.localApp(e.app):e.app,x=new An({schema:W.schema,mutations:W.mutations??[],invariants:W.invariants??[],...W.policy?{policy:W.policy}:{},...W.publishing?{publishing:W.publishing}:{},...W.modules?{modules:W.modules}:{},...ue?{enabledModules:ue}:{},...W.intelligence?{intelligence:W.intelligence}:{},...W.brand?.timeZone?{timeZone:W.brand.timeZone}:{},snapshot:F.snapshot,log:F.log,...F.horizon!==void 0?{horizon:F.horizon}:{},ids:Do(),...e.storeOptions??{}});Sn.served.add(x);let Te=Pn(x),A=F.log.at(-1)?.seq??(F.horizon??0)-1,oe=Et.of(F.log,{horizon:F.horizon??0}),T=null,Z,$=new Map,fe=i.who,ve=!1,N=t=>{if(se)return;ve=!0;let r=Tn(new Map,t,Date.now(),xt,T?.participant);Z!==void 0&&r.delete(Z);let s=r.size!==$.size;if(!s)for(let[a,u]of r)Ot(u,$.get(a))||(s=!0);if($=r,!!s)for(let a of[...fe])a([...$.values()])},z=[],I=new Set,ae=t=>{let r=z.indexOf(t);r>=0&&z.splice(r,1)},L=new Map,xe=(t,r)=>{let s=L.get(t);s&&(L.delete(t),s.resolve({ops:r.filter(a=>a.batch===t),batch:t}))},K,te=[],M=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(K)return te.push({ops:t,drop:r}),[];let s=Math.min(...t.filter(g=>g.seq>A).map(g=>g.seq));if(Number.isFinite(s)&&s>A+1)return te.push({ops:t,drop:r}),pe(),[];let a=z.filter(g=>t.some(J=>J.batch===g)),u=[...new Set([...r,...a])].filter(g=>I.has(g)),m,b=z.filter(g=>!a.includes(g));try{m=x.rebase({confirmed:t,pending:b,drop:u}).confirmed}catch(g){if(!(g instanceof kn))throw g;return te.push({ops:t,drop:r}),pe(),[]}for(let g of a)ae(g);t.some(g=>g.seq>A)&&b.some(g=>!u.includes(g))&&k.rebases++,t.length>0&&(A=Math.max(A,...t.map(g=>g.seq)),oe.note(t));for(let g of u)I.delete(g);for(let g of a)xe(g,t);return m},pe=()=>{K||(K=Se(Q().then(t=>{if(ie(t)){te=[];return}let r=new Set(t.log.map(u=>u.batch)),s=z.filter(u=>r.has(u));for(let u of s)ae(u);let a=x.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[...z],drop:[...I].filter(u=>!z.includes(u))});I.clear();for(let u of a.pending)I.add(u.batch);A=t.log.at(-1)?.seq??(t.horizon??0)-1,oe=Et.of(t.log,{horizon:t.horizon??0}),k.resyncs++;for(let u of s)xe(u,t.log)}).then(()=>{K=void 0;let t=te;te=[];for(let{ops:r,drop:s}of t)M(r,s)},()=>{K=void 0,te=[]})))},ie=t=>(typeof t.build=="string"&&an(t.build),typeof t.version=="number"&&f(t.held),typeof t.version!="number"||t.version===F.version?!1:(vt(t.version),!0)),ce=async t=>{let s=await(await U(`${e.url}/graview/since?seq=${ft(t)}&opFormat=${We.op}`,{headers:l})).json();return ie(s)?[]:s.reset===!0?(pe(),[]):s.ops??[]},be=async()=>{let t=await He();return K&&await K,t},He=async()=>{if(T&&!G()&&R()){let r=await(await U(`${e.url}/graview/here?opFormat=${We.op}`,{method:"POST",headers:l,body:JSON.stringify({presence:T,seq:ft(A)})})).json();return ie(r)?[]:(typeof r.participant=="string"&&(Z=r.participant),N(r.who??[]),M(r.ops??[]))}return M(await ce(A))},Y=new Map,E=new Map,Ie=new Set,ne=new Map,le=new Set,Se=t=>(le.add(t),t.finally(()=>le.delete(t)).catch(()=>{}),t),_e=Promise.resolve(),De=0,ht=(t,r)=>{let s=_e.then(()=>Ue(t,r));return _e=s.catch(()=>{}),s},yt=()=>new Promise((t,r)=>C.push({again:t,give:r})),Ue=async(t,r)=>{let s,a;for(;;){try{s=await U(`${e.url}/graview/ops`,{method:"POST",headers:l,body:JSON.stringify({...t,opFormat:We.op})})}catch(g){if(!(g instanceof Ge)||X)throw g;if(await yt(),G())return Je(t,r);continue}if(a=await s.json().catch(()=>({})),s.status===503&&a.reason==="unavailable"&&typeof a.held=="string"&&!X){if(typeof a.version=="number"?ie(a):(f(a.held),!1))break;if(v!==void 0&&(kt>0||p)){if(await new Promise(g=>q.push(g)),X)throw new $e("The client closed.");if(G())return Je(t,r);continue}}let b;if(s.status===503&&a.reason==="unavailable"&&!X)b=Xt(e.backoff,De++);else{if(De=0,s.status!==429||X)break;b=Wo(s.headers.get("retry-after"),a.retryAfter)}if(await new Promise(g=>setTimeout(g,b)),G())return Je(t,r)}if(se||ie(a))throw new $e("The app was changed.");if(!s.ok){let b=a.error??`The server refused (${s.status})`;throw a.conflict?new we(b,a.conflicts??[]):new Ne({reason:a.reason??Lo[s.status]??"invalid",sentence:b,...a.wouldNeed?.length?{wouldNeed:a.wouldNeed}:{}})}let u=a.ops??[],m=u[0]?.seq;return m!==void 0&&m>A+1&&(u=await ce(A)),r!==void 0&&(a.batch&&Y.set(r,a.batch),ae(r)),M(u,r!==void 0?[r]:[]),{ops:a.ops??[],...a.batch?{batch:a.batch}:{}}},_,re=!1,X=!1,Oe=0,Pe,Ke=0,ke=0,Fe=null,me=()=>{},Ve=new Promise(t=>{me=t}),G=()=>p&&re&&_?.readyState===Vo,Ce=t=>{if(!G())return!1;try{return _.send(JSON.stringify(t)),!0}catch{return!1}},y=(t=!1)=>{!T||!G()||!R()||!t&&Fe&&Ot(T,Fe)&&(w===void 0||Date.now()-ke<w)||Ce({t:"here",presence:T})&&(Fe=T,ke=Date.now())},H=new Set,D,rn=()=>{if(D=void 0,v!==void 0)return;let t=[...L.entries()].filter(([r])=>H.has(r));H.clear();for(let[,r]of t)Ce(r.message)},on=(t,r)=>{L.has(t)&&(H.add(t),D&&clearTimeout(D),D=setTimeout(rn,Math.max(0,r)))},Ir=t=>{L.has(t)&&H.add(t)},Je=(t,r)=>new Promise((s,a)=>{let u=r??`send-${++Ke}`,m=t.undo?{t:"undo",cid:u,batches:t.undo,...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.via?{via:t.via}:{},...Re(t)}:{t:"call",cid:u,calls:t.calls??[],...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.base?.length?{base:t.base}:{},...t.via?{via:t.via}:{},...Re(t)};if(L.set(u,{message:m,...r!==void 0?{mine:r}:{},resolve:s,reject:a}),H.size>0||v!==void 0){H.add(u);return}Ce(m)}),Ye=(t,r)=>G()?Je(t,r):ht(t,r),_r=t=>{switch(t.t){case"welcome":{if(an(t.build),typeof t.version=="number"&&t.version!==F.version){vt(t.version);return}if(re=!0,Oe=0,typeof t.participant=="string"&&(Z=t.participant),f(t.held),t.state?pe():M(t.ops??[]),H.clear(),D&&clearTimeout(D),D=void 0,v!==void 0)for(let r of L.keys())H.add(r);else for(let r of L.values())Ce(r.message);y(!0),ee("online"),me();return}case"ops":M(t.ops??[]);return;case"ack":{let r=L.get(t.cid);if(!r){M(t.ops??[]);return}L.delete(t.cid),De=0,r.mine!==void 0&&(Y.set(r.mine,t.batch),ae(r.mine)),M(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=L.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){v!==void 0?Ir(t.cid):on(t.cid,Xt(e.backoff,De++));return}L.delete(t.cid),r.reject(t.t==="conflict"?new we(t.sentence,t.conflicts??[]):new Ne({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&on(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":N(t.who??[]);return;case"held":f(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==F.version&&vt(t.version);return;case"reload":ln(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&_){let r=_;fn(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},se=!1,gt=i.declarations,wt=i.builds,an=t=>{if(!(se||i.otherBuild!==void 0||!e.build||typeof t!="string"||t.length===0||t===e.build)){i.otherBuild=t;for(let r of[...wt])r(t)}},sn=()=>{let t=[],r=0;for(let s of z){let a=ne.get(s);a?t.push({calls:a.calls,...a.intent?{intent:a.intent}:{},...a.via?{via:a.via}:{},...Re(a),batch:s}):r++}return{carried:t,undos:r}},dn=(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.`,cn=t=>{se=!0,T=null;let r=new $e(t);for(let a of L.values())a.reject(r);L.clear(),Xe&&clearInterval(Xe),X=!0,Pe&&clearTimeout(Pe),D&&clearTimeout(D),he&&clearTimeout(he);for(let a of C.splice(0))a.give(r);for(let a of q.splice(0))a();let s=_;_=void 0,re=!1;try{s?.close(1e3,t)}catch{}me()};async function vt(t){if(se)return;if(!e.resolveApp){ln(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:s}=sn(),a=e.resolveApp,u=T;cn("The app was changed.");try{let m=await a(t),{state:b,...g}=e,J=await Wr({...g,app:m},r,"The app was changed while your changes were on the way.",i);u&&J.remote.presence.here(u);for(let et of[...gt])et(J.remote,t);let Yr=[...s>0?[Qe(dn(s,"The app was changed"))]:[],...J.unheard()];for(let et of Yr)for(let Qr of Be)Qr(et.sentence,et)}catch(m){let b=`The app was changed, but the new version could not be opened: ${m instanceof Error?m.message:String(m)}`;for(let g of Be)g(b,Qe(b))}}function ln(t){if(se)return;let{carried:r,undos:s}=sn();cn(t);let a=!1;if(e.carry&&r.length>0)try{e.carry.storage.setItem(e.carry.key,JSON.stringify(r)),a=!0}catch{}let u=[];!a&&r.length>0&&u.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&&u.push(dn(s,"This app was updated"));for(let m of u)for(let b of Be)b(m,Qe(m));(e.reloadPage??$o)()}let un=()=>{if(X||!p)return;let t=`${e.url.replace(/^http/,"ws").replace(/\/$/,"")}${Br}`,{"content-type":r,...s}=l,a;try{a=e.socket?e.socket(t,s,[Zt]):Jr(t,s)}catch{return pn()}_=a,re=!1,a.onopen=()=>{_===a&&a.send(JSON.stringify({t:"hello",seq:ft(A),protocol:tt,wire:Qt,opFormat:We.op,...e.build?{build:e.build.slice(0,64)}:{},...e.hostProtocol!==void 0?{hostProtocol:e.hostProtocol}:{}}))},a.onmessage=u=>{if(_!==a)return;let m;try{m=JSON.parse(String(u.data))}catch{return}_r(m)},a.onclose=()=>fn(a),a.onerror=()=>{}},he,jr=()=>{ve=!1,he&&clearTimeout(he),he=setTimeout(()=>{if(he=void 0,ve||X)return;let t=new Map([...$].filter(([,r])=>r.held!=="socket"));if(t.size!==$.size){$=t;for(let r of fe)r([...$.values()])}},xt),he.unref?.()};function fn(t){if(_!==t)return;let r=re;_=void 0,re=!1,Fe=null,r&&(ee("offline"),jr()),pn()}let pn=()=>{if(X)return;let t=Xt(e.backoff,Oe);Oe++,Pe=setTimeout(un,t)},mn=x.applyAll.bind(x),qr=x.undo.bind(x),zr=x.previewAll.bind(x);x.previewAll=(t,r)=>zr(t,{...e.principal?{author:e.principal}:{},...r});let Be=i.refusals,je=[],Qe=t=>({reason:"invalid",sentence:t}),Ze=i.conflicts,bt=!1,hn,St=async(t,r)=>{if(r instanceof $e||se)return;let s=r instanceof Ne?r.refusal:vn(r),a=s.sentence,u=r instanceof we?hn?.yoursOf(x,ne.get(t)?.calls??[]):void 0;ae(t);try{M([],[t])}catch{}let m=ne.get(t);if(ne.delete(t),r instanceof we&&k.conflicts++,r instanceof we&&!G()&&await be().catch(()=>[]),r instanceof we&&K&&await K,r instanceof we&&Ze.size>0){let b=!1,g={sentence:a,conflicts:u?r.conflicts.map(J=>J.node===u.node&&J.field===u.field?{...J,yours:u.yours}:J):r.conflicts,keepTheirs(){b=!0},useMine(){if(!(b||!m)){b=!0,bt=!0;try{x.applyAll(u?[u.over(A)]:m.calls,{...m.intent?{intent:m.intent}:{},...m.via?{via:m.via}:{},...Re(m)})}finally{bt=!1}}}};for(let J of Ze)J(g);return}for(let b of Be)b(a,s)},Gr=(t,r)=>t.flatMap(s=>s.mutation?.name===wn?[]: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:A}]:[]));x.applyAll=(t,r)=>{let s=bn(x.log.all().filter(b=>I.has(b.batch))),a=mn(t,{...e.principal?{author:e.principal}:{},...r}),u=t.map((b,g)=>{let J=a.minted?.[g];return J===void 0||b.args?.id!==void 0?b:{...b,mintedHint:J}});z.push(a.batch),I.add(a.batch),ne.set(a.batch,{calls:u,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...Re(r)});let m=bt?[]:[...oe.baseFor(a.ops,s,(b,g)=>x.collaborative(b,g)),...Gr(a.ops,s)];return E.set(a.batch,Se(Ye({calls:u,...r?.intent?{intent:r.intent}:{},batch:a.batch,...m.length>0?{base:m}:{},...r?.via?{via:r.via}:{},...Re(r)},a.batch).catch(b=>St(a.batch,b)))),a},x.apply=(t,r)=>x.applyAll([t],r),x.undo=(t,r)=>{let s=typeof t=="string"?[t]:t,a=qr(s.map(m=>Y.get(m)??m),{...e.principal?{author:e.principal}:{},...r});z.push(a.batch),I.add(a.batch);let u=Promise.allSettled(s.map(m=>E.get(m)));return E.set(a.batch,Se(u.then(()=>{let m=s.filter(b=>!Ie.has(b));if(m.length===0){ae(a.batch),ne.delete(a.batch),M([],[a.batch]);return}return Ye({undo:m.map(b=>Y.get(b)??b),...r?.intent?{intent:r.intent}:{},batch:a.batch,...r?.via?{via:r.via}:{},...Re(r)},a.batch)}).catch(m=>St(a.batch,m)))),a};let Ur=async(t,r={})=>{Pt++;try{return(await Se(Ye({calls:t,...r}))).ops}finally{Pt--}},Pt=0,yn={here(t){T=t,y()},onWho(t){return fe.add(t),$.size>0&&t([...$.values()]),()=>{fe.delete(t)}},leave(){if(!T)return;let t=JSON.stringify({participant:Z??T.participant});if(T=null,Ce({t:"bye"}))return;let r=globalThis.navigator?.sendBeacon;r?r.call(globalThis.navigator,`${e.url}/graview/leave`,t):d(`${e.url}/graview/leave`,{method:"POST",headers:l,body:t}).catch(()=>{})}},kt=e.pollMs??800,Xe=kt>0&&typeof setInterval=="function"?setInterval(()=>{G()||be().catch(()=>{})},kt):null;if(p){un();let t;await Promise.race([Ve,new Promise(r=>t=setTimeout(r,e.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!se){let t=[],r=new Set(x.log.all().map(s=>s.batch));for(let s of n)if(!(s.batch!==void 0&&r.has(s.batch)))try{x.applyAll(s.calls,{...s.intent?{intent:s.intent}:{},...s.batch?{batch:s.batch}:{},...s.via?{via:s.via}:{},...Re(s)})}catch(a){t.push(Fo(s,a))}t.length>0&&je.push(Qe(`${o} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}let gn=new Map,Kr=()=>({store:x,author:e.principal,appliedAll:mn,pending:z,provisional:I,asked:ne,answers:E,letGo:Ie,sent:(t,r)=>Se(Ye({calls:r,batch:t},t).catch(s=>St(t,s))),settle:ae,land:M,seen:()=>A,gone:()=>X||se});return{remote:{store:x,typing(t,r){let s=`${t}\0${r}`,a=gn.get(s);return a||(a=(__graviewPreload(import.meta.url,["./chunk.JTOAZ2IR.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.6TILXTP6.js")).then(u=>(hn=u,u.typingOf(t,r,u.wireOf(Kr())))),gn.set(s,a)),a},version:F.version,migrated:F.migrated??[],send:Ur,pull:be,onRefusal(t){Be.add(t);let r=je;je=[];for(let s of r)t(s.sentence,s);return()=>Be.delete(t)},onDeclaration(t){return gt.add(t),()=>gt.delete(t)},onBuild(t){return wt.add(t),i.otherBuild!==void 0&&t(i.otherBuild),()=>wt.delete(t)},onConflict(t){return Ze.add(t),()=>Ze.delete(t)},revision:(t,r)=>oe.of(t,r),seq:()=>A,participant:()=>Z,transport:()=>G()?"socket":"poll",status:de,onStatus(t){return P.add(t),()=>P.delete(t)},held:()=>v,onHeld(t){return i.helds.add(t),v!==void 0&&t(v),()=>i.helds.delete(t)},counters:()=>({...k}),who:()=>[...$.values()],pending:()=>z.length+Pt,async settled(){for(;le.size>0;)await Promise.allSettled([...le])},presence:yn,close(){Xe&&clearInterval(Xe),Te(),yn.leave(),X=!0,Pe&&clearTimeout(Pe),D&&clearTimeout(D),he&&clearTimeout(he);for(let r of C.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of q.splice(0))r();let t=_;_=void 0,re=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=je;return je=[],t}};function Jr(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",u=e.subprotocol?[Zt]:[];if(!a)try{return new s(t,{headers:r,...u.length>0?{protocols:u}:{}})}catch{}let m=new URL(t);for(let[b,g]of Object.entries(S))m.searchParams.set(b,g);return u.length>0?new s(m.toString(),u):new s(m.toString())}}function Wo(e,n,o=Date.now()){let i,d=e?.trim();if(d)if(/^\d+(\.\d+)?$/.test(d))i=Number(d)*1e3;else{let p=Date.parse(d);Number.isFinite(p)&&(i=Math.max(0,p-o))}let l=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,S=l!==void 0&&l<50&&i!==void 0&&Math.abs(l*1e3-i)<1e3;return l!==void 0&&!S?l:i??1e3}function $o(){globalThis.location?.reload?.()}function No(){return globalThis.document?.visibilityState!=="hidden"}function Xt(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:o=250,max:i=1e4,factor:d=2}=e??{};return Math.min(i,o*d**n)*(.75+Math.random()*.5)}function mt(e){let n={};if(!e)return n;e.id&&(n[ge.seat]=e.id),e.roles?.length&&(n[ge.roles]=e.roles.join(",")),e.kind!=="human"&&(n[ge.kind]=e.kind),e.name&&(n[ge.name]=encodeURIComponent(e.name));let o=e.onBehalfOf;return o?.id&&(n[ge.for]=o.id),o?.roles?.length&&(n[ge.forRoles]=o.roles.join(",")),o?.name&&(n[ge.forName]=encodeURIComponent(o.name)),n}var $r="/graview/views";function en(e){let n=e.fetch??fetch,o=e.url.replace(/\/$/,""),i={"content-type":"application/json",...e.principal?mt(e.principal):{},...e.headers??{}},d=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??nt.may}:nt,l=new Set,S=P=>{if(JSON.stringify(P)!==JSON.stringify(d)){d=P;for(let k of l)k()}},p=async(P,k)=>{let C=await n(`${o}${e.path??$r}`,{method:P,headers:i,...k!==void 0?{body:JSON.stringify(k)}:{}}),v=await C.json();if(!C.ok)throw new Error(v.error??`The store answered ${C.status}.`);S({hidden:v.hidden??[],removed:v.removed??[],may:v.may??nt.may})},w=()=>p("GET"),R=e.state?Promise.resolve():w().catch(()=>{}),O=e.pollMs?setInterval(()=>void w().catch(()=>{}),e.pollMs):void 0;return{ready:R,refresh:w,close:()=>clearInterval(O),current:()=>d,onChange(P){return l.add(P),()=>void l.delete(P)},hide:P=>p("POST",{hide:P}),show:P=>p("POST",{show:P}),remove:(P,k)=>p("POST",{remove:P,...k?{about:k}:{}}),async restore(P){let k=d.removed.find(C=>C.name===P)?.lens;await p("POST",{restore:P}),k&&await e.onDeclaration?.()},async lens(P){await p("POST",{lens:P}),await e.onDeclaration?.()}}}var nn=document.getElementById("graview-app"),tn=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),Nr=tn?(__graviewPreload(import.meta.url,["./chunk.K2J26XMB.js","./chunk.3G5DEGFA.js","./chunk.XOZU4OFA.js","./chunk.AG7CUSSV.js","./chunk.ZBHFCSKO.js","./chunk.7TMWMW4W.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.3SOJJAMY.js")):Me("pages");try{tn?await Io(decodeURIComponent(tn[1])):await _o()}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),nn.replaceChildren(n),window.__graviewFailed=n.textContent}async function Io(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 st(o);if(!i.ok)throw new Error(rt(i.findings));let d=i.app,l=o.principal,S=await pt({app:d,url:location.origin,principal:l,...o.state?{state:o.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=d.forms?.[e]?.title??d.name;let{mount:p}=await Nr;window.__graview=p(nn,{app:d,form:e,principal:l,remote:S,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function _o(){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 w=>{if(typeof w.module=="string")return(await import(w.module)).app;let R=await st(w);if(!R.ok)throw new Error(rt(R.findings));return R.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 d=n.principal,l=await pt({app:i,url:location.origin,principal:d,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=i.name;let S,p=en({url:location.origin,principal:d,...n.views?{state:n.views}:{},onDeclaration:async()=>{let w=await(await fetch("/graview/document")).json();if(typeof w.module=="string")return;let R=await st(w);R.ok&&S?.setApp(R.app,l)}});await Promise.all([Nr,p.ready]),S=Yt(nn,{app:i,remote:l,principal:d,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:i.name,heading:1,keptViews:p,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=S,S.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 ro}from"./chunk.G5XTASMO.js";import{a as Bt,b as or,c as ar,d as ir,e as sr,f as $t,g as cr,h as Nt}from"./chunk.PCKX2FHR.js";import{a as Wt,b as lr,c as ur,d as fr,e as It,f as pr,g as mr,h as hr,i as yr,j as gr,k as wr,l as vr,m as br,n as Ue}from"./chunk.YRFN4VDD.js";import{b as dr}from"./chunk.EGSE6NNE.js";import{a as Rt,g as Ln}from"./chunk.SG67ID6C.js";import{k as it}from"./chunk.H536YUAZ.js";import{E as tr,I as nr,J as rr,h as Yn,k as Dt,l as Qn,n as Zn,r as Xn,w as Vt,z as er}from"./chunk.LMXNHBGH.js";import{c as no}from"./chunk.DBCVZGCC.js";import{Aa as qn,Ca as zn,Da as Gn,Fa as Un,G as Mt,Ga as Ht,Ka as Kn,La as Jn,Oa as dt,T as Dn,Z as Vn,a as Mn,b as st,c as ct,ga as Bn,ha as $n,j as Hn,m as Lt,va as Nn,wa as Wn,xa as In,ya as _n,za as jn}from"./chunk.WSMYFEGU.js";import{a as Te}from"./chunk.SDO3U72B.js";import{Bb as Sn,Ld as Re,Md as Fn,Nd as On,Sd as xt,Tc as kn,Td as Ft,Ud as Ot,Xd as Cn,Yd as Ct,cb as _e,dd as An,ec as Tt,ed as En,fc as Pn,jd as Rn,ld as Tn,md as xn,nb as ot,ob as bn,od as at}from"./chunk.WR63RQGU.js";import"./chunk.FQLNBIQ5.js";import{b as De}from"./chunk.AJZBJBMO.js";function _t(e){if(Array.isArray(e))return e.map(_t);if(e&&typeof e=="object"){let n={};for(let o of Object.keys(e).sort()){let i=e[o];i!==void 0&&(n[o]=_t(i))}return n}return e}function jt(e){return JSON.stringify(_t(e))??"undefined"}async function lt(e,n={}){let o=e.compiled===void 0||!ao(e.compiled,e.document)?void 0:Ln(e.compiled,n);if(o?.ok)return o;let{compileDocumentWithoutCheck:i}=await oo();return i(e.document,n)}var Sr,oo=()=>Sr??=(__graviewPreload(import.meta.url,["./chunk.SG67ID6C.js","./chunk.5MSNKSTE.js","./chunk.2HANQ737.js","./chunk.H536YUAZ.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.FVOFTM5J.js")).catch(e=>{throw Sr=void 0,e});function ao(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&&jt(Rt(o).document)===jt(Rt(i).document)}var d=De(Mt(),1);var ft=De(Mt(),1),qt="data-graview-drawn",io=200,Pr=50,so=1e4,ut=()=>typeof performance<"u"?performance.now():Date.now();function co(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 lo(e,n){if(e.ownerDocument.fonts?.status==="loading"||Wn()>0||qn(n)>0||e.querySelector('[aria-busy="true"]')||co(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 kr(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 uo(e,n,o,i){e.removeAttribute(qt);let c=e.ownerDocument.defaultView;if(!c)return()=>{};let l=ut(),S=l,p=kr(e),w=!1,E,T=typeof MutationObserver>"u"?void 0:new MutationObserver(v=>{v.some(_=>!(_.target===e&&_.attributeName===qt))&&(S=ut())});T?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let P=()=>{w=!0,T?.disconnect(),E!==void 0&&clearTimeout(E)},k=v=>{let _=!1,de=()=>{_||(_=!0,v())};typeof c.requestAnimationFrame=="function"&&c.requestAnimationFrame(()=>setTimeout(de,0)),setTimeout(de,100)},F=()=>{if(w)return;let v=kr(e);v!==p&&(p=v,S=ut());let _=ut();if(lo(e,i)&&_-S>=io||_-l>=so){k(()=>{w||(P(),e.setAttribute(qt,n),Gn(),o())});return}E=setTimeout(F,Pr)};return E=setTimeout(F,Pr),P}function Ar(e,n,o,i,c){zn();let l=(0,ft.useRef)({place:o,onDrawn:i});l.current={place:o,onDrawn:i},(0,ft.useLayoutEffect)(()=>{c&&jn(c);let S=E=>uo(E,l.current.place.path,()=>l.current.onDrawn?.(l.current.place),c);if(e.current)return S(e.current);let p,w=!1;return queueMicrotask(()=>{!w&&e.current&&(p=S(e.current))}),()=>{w=!0,p?.()}},[n,e,c])}var ve=De(Mt(),1),Ke,fo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.KY7QD22S.js","./chunk.LYVRXRIH.js","./chunk.ZPXAKRKG.js","./chunk.G2XDQPE4.js","./chunk.5XUVCM7X.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.KIMIPHAI.js"))),Er=()=>fo().then(e=>void(Ke=e),()=>new Promise(e=>setTimeout(e,2e3)).then(Er)),zt=Nn(Er),Rr=e=>!!e&&Ke===void 0;function Gt({onReady:e,fetch:n}){return(0,ve.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var po=0;function Tr(e){let[n,o]=(0,ve.useState)(()=>Ke);(0,ve.useEffect)(()=>{if(!e||n)return;let l=!1;return zt().then(()=>{l||o(Ke)}),()=>{l=!0}},[e,n]);let i=(0,ve.useMemo)(()=>po+=1,[e]);return{over:(0,ve.useMemo)(()=>{let l=n??Ke;if(!e||!l)return;let{source:S,worker:p,...w}=e,E={...w,worker:p??{source:S},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:T=>l.registerWorkerView(T,E)}},[e,n]),n:i}}var Or=De(ro(),1),I=De(no(),1);var g=De(Dn(),1);function pt(e,n={}){let o=Ht(e);return{Face:o.part((c,l)=>(0,d.createElement)(c,l),n),fetch:()=>o.load().then(()=>{}),here:()=>o.current!==void 0||o.failed}}var Jt=e=>Promise.all([e,nr()]).then(([n])=>n),Cr=Te(()=>(__graviewPreload(import.meta.url,["./chunk.QBMIET7P.js","./chunk.ZOW7AC7U.js","./chunk.PIQ52FCI.js","./chunk.RZQKCLTW.js","./chunk.Y3BEKXYB.js","./chunk.XEHLSKHP.js","./chunk.MSM6E6JK.js","./chunk.HJCQ6I3S.js","./chunk.FUZWXKTN.js","./chunk.YOBRVKJT.js","./chunk.LWLI5PI4.js","./chunk.6ZJE5M2A.js","./chunk.XUHY4XO2.js","./chunk.DU75P3Y7.js","./chunk.2SWQI4HF.js","./chunk.DNJM6WQO.js","./chunk.5D6SIBOK.js","./chunk.ATXSLBE3.js","./chunk.6UAUME5U.js","./chunk.BRCKXL7B.js","./chunk.CPNE6HPQ.js","./chunk.YRFN4VDD.js","./chunk.EGSE6NNE.js","./chunk.MFOSEOF4.js","./chunk.GZHZLJBF.js","./chunk.OL2N5NUV.js","./chunk.OJGHDWI6.js","./chunk.5DPFAVCZ.js","./chunk.5EZDXWOE.js","./chunk.MIQMPOWF.js","./chunk.T66UK7PQ.js","./chunk.LMXNHBGH.js","./chunk.DBCVZGCC.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.USJ4J3GL.js"))),mo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.R3ZS4QO6.js","./chunk.2ORJGMRT.js","./chunk.YYWANGIC.js","./chunk.FTW3K3G6.js","./chunk.UGFDSE37.js","./chunk.QBMIET7P.js","./chunk.PXQVXBNG.js","./chunk.WVKXELAF.js","./chunk.ZOW7AC7U.js","./chunk.INBHY3SA.js","./chunk.TDV7JGIQ.js","./chunk.RZQKCLTW.js","./chunk.Y3BEKXYB.js","./chunk.NDLQXQV2.js","./chunk.WUFCRE7O.js","./chunk.XEHLSKHP.js","./chunk.MSM6E6JK.js","./chunk.YGZGMRDC.js","./chunk.6ZJE5M2A.js","./chunk.2SWQI4HF.js","./chunk.QIAH7HHO.js","./chunk.DNJM6WQO.js","./chunk.LEPKPNPA.js","./chunk.5D6SIBOK.js","./chunk.UE5GAP67.js","./chunk.BJUUSIQY.js","./chunk.BRCKXL7B.js","./chunk.CPNE6HPQ.js","./chunk.XOZU4OFA.js","./chunk.QQ3YWKWU.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.HUABTCQE.js","./chunk.DXJFAAOI.js","./chunk.5MSNKSTE.js","./chunk.KVQZ5FR6.js","./chunk.2HANQ737.js","./chunk.H536YUAZ.js","./chunk.GZHZLJBF.js","./chunk.OL2N5NUV.js","./chunk.OJGHDWI6.js","./chunk.5DPFAVCZ.js","./chunk.5EZDXWOE.js","./chunk.MIQMPOWF.js","./chunk.T66UK7PQ.js","./chunk.LMXNHBGH.js","./chunk.DBCVZGCC.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.3IZOXNJH.js"))),ho=Te(()=>(__graviewPreload(import.meta.url,["./chunk.R3ZS4QO6.js","./chunk.2ORJGMRT.js","./chunk.YYWANGIC.js","./chunk.FTW3K3G6.js","./chunk.UGFDSE37.js","./chunk.QBMIET7P.js","./chunk.PXQVXBNG.js","./chunk.WVKXELAF.js","./chunk.ZOW7AC7U.js","./chunk.INBHY3SA.js","./chunk.TDV7JGIQ.js","./chunk.RZQKCLTW.js","./chunk.Y3BEKXYB.js","./chunk.NDLQXQV2.js","./chunk.WUFCRE7O.js","./chunk.XEHLSKHP.js","./chunk.MSM6E6JK.js","./chunk.YGZGMRDC.js","./chunk.6ZJE5M2A.js","./chunk.2SWQI4HF.js","./chunk.QIAH7HHO.js","./chunk.DNJM6WQO.js","./chunk.LEPKPNPA.js","./chunk.5D6SIBOK.js","./chunk.UE5GAP67.js","./chunk.BJUUSIQY.js","./chunk.BRCKXL7B.js","./chunk.CPNE6HPQ.js","./chunk.XOZU4OFA.js","./chunk.QQ3YWKWU.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.HUABTCQE.js","./chunk.DXJFAAOI.js","./chunk.5MSNKSTE.js","./chunk.KVQZ5FR6.js","./chunk.2HANQ737.js","./chunk.H536YUAZ.js","./chunk.GZHZLJBF.js","./chunk.OL2N5NUV.js","./chunk.OJGHDWI6.js","./chunk.5DPFAVCZ.js","./chunk.5EZDXWOE.js","./chunk.MIQMPOWF.js","./chunk.T66UK7PQ.js","./chunk.LMXNHBGH.js","./chunk.DBCVZGCC.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.TEE23CVQ.js"))),Lr=pt(()=>Jt(Cr().then(e=>e.SceneFace)),{what:"This view"}),Mr=pt(()=>Cr().then(e=>e.SceneKeeping),{quiet:!0}),Hr=pt(()=>Jt(mo().then(e=>e.PagesContent)),{what:"This page"}),Dr=pt(()=>Jt(ho().then(e=>e.PictureFace)),{what:"This picture"}),yo=Lr.Face,go=Mr.Face,wo=Hr.Face,vo=Dr.Face;function Ve(...e){let n=e.length>0?e:["scene","pages","picture"],o=new Set(n.flatMap(Vr));return Promise.all([...[...o].map(i=>i.fetch()),Zn()]).then(()=>{},()=>{})}var Vr=e=>e==="pages"?[Hr]:e==="picture"?[Dr]:[Lr,Mr],Br=e=>Vr(e).every(n=>n.here()),bo=150,Ut=0;function xr(e,n){if(Br(e))return n();let o=++Ut,i=()=>{o===Ut&&(Ut+=1,n())};Ve(e).then(i),setTimeout(i,bo)}var So=768;function Po(e,n){let o=n!==null&&n>=So;(0,d.useEffect)(()=>{if(!o||e==="picture")return;let i=e==="pages"?"scene":"pages";if(Br(i))return;let c=globalThis,l=()=>void Ve(i),S=()=>{},p=Un(()=>{if(c.requestIdleCallback&&c.cancelIdleCallback){let w=c.requestIdleCallback(l,{timeout:4e3});S=()=>c.cancelIdleCallback?.(w)}else{let w=setTimeout(l,1500);S=()=>clearTimeout(w)}});return()=>(p(),S())},[e,o])}function ko({asked:e,shown:n,onDrawn:o}){return(0,d.useLayoutEffect)(()=>o(e,n),[e,n,o]),null}function Ao({auto:e,scene:n}){return(0,g.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${It}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var Eo=Ht(Te(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,g.jsx)(e.StudioPlace,{...n}),{quiet:!0});function $r(e,n,o,i,c){return $t(e,sr(n?ct(n):c??Mn,i),o)}function Yt(e){return e&&ct(e).overview?"graview":"scene"}function Fr(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 Nr(e){let[,n]=(0,d.useState)(!1),o=(0,d.useCallback)(()=>n(!0),[]),i=(0,d.useRef)(!1);return e.at&&!mt?(0,g.jsx)(Gt,{onReady:o,fetch:Qt}):!i.current&&Rr(e.draftView)?(0,g.jsx)(Gt,{onReady:o,fetch:zt}):(i.current=!0,(0,g.jsx)(Ro,{...e}))}function Ro(e){let{app:n,stop:o,bar:i=!0,standing:c="Everything is in order",principal:l,heading:S=2}=e,{rootRef:p,scope:w,css:E,scheme:T,store:P,presence:k,brand:F,auto:v,height:_}=pr(e),de=Tr(e.draftView),D=ur(e,rr,de.over),[ie]=(0,d.useState)(_n),f=e.basePath===void 0?{}:{basePath:e.basePath},[V]=(0,d.useState)(Dt),j=e.notices??V,Z=h=>xt(h,f),x={...e.routing?{routing:e.routing}:{},...f},[me]=(0,d.useState)(()=>{let h=e.at?.face;if(h)return h;let Q=o===void 0&&Fr(n,D)?"pages":Yt(o),K=Bt({...x,face:Q});return e.face===void 0&&e.onOpening?.(K),K}),[B,R]=(0,d.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&o===void 0&&or(x)&&Fr(n,D)),he=(0,d.useRef)(e.onFace);he.current=e.onFace,(0,d.useLayoutEffect)(()=>{B&&(he.current?.("pages"),R(!1))},[B]);let L=B?"pages":e.face??me,O=n.schema.kinds,C=e.routing==="address",H=(0,d.useMemo)(()=>e.at?mt.settleAt(e,P.seenBy(l??{kind:"human"}),D.places()):void 0,[]),X=(0,d.useMemo)(()=>$n(D,n.schema),[D,n.schema]),q=(0,d.useMemo)(()=>{let h=H?.stop??(C?ar(e.basePath):void 0)??o;return L==="scene"&&h===void 0&&X===void 0&&(e.path===void 0||Kt(e.path))?Nt(void 0):$r(L,h,O,D.places(),X)},[]),[ye]=(0,d.useState)(L);(0,d.useEffect)(()=>{ye!=="pages"&&Bn(D)},[ye,D]);let $=(0,d.useRef)(void 0),Fe=h=>h===void 0||Kt(h)?"/":h;$.current??={path:Fe(H?.path??(C?L==="pages"?(Ft(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==$.current.asked&&($.current={path:Fe(e.path),asked:e.path});let M=(0,d.useRef)(e.onNavigate);M.current=e.onNavigate;let ee=(0,d.useCallback)((h,Q)=>{$.current.path=h,M.current?.(h,Q)},[]),{at:te,setAt:N,steering:Se,steer:J}=wr($.current.path),z=(0,d.useContext)(Wr);z&&(z.pages=()=>$.current.path);let G=(0,d.useRef)(void 0),le=(0,d.useCallback)(h=>void($.current.path=h),[]),ne=Yn(p),[Oe,Pe]=(0,d.useState)(!1),se=e.pagesBelow!==void 0&&ne!==null&&ne<e.pagesBelow&&(L==="scene"||L==="graview")&&!Oe,A=se?"pages":L,Ce=(0,d.useRef)(!1);Ce.current=Oe&&e.pagesBelow!==void 0&&ne!==null&&ne<e.pagesBelow&&(L==="scene"||L==="graview"),z&&(z.shown=A);let Le=(0,d.useRef)(L==="graview"?"graview":"scene");(A==="scene"||A==="graview")&&(Le.current=A),(0,d.useState)(()=>{if(!C||typeof window>"u"||A==="pages"||A==="picture")return;let{pathname:h,search:Q,hash:K}=window.location;Ft(h,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${Z(Re)}${Q}${K}`)}),fr(p,A,e.onIntrinsicHeight),Po(A,ne);let re=vr(e.onError,A),Me=br(e.onReady,A),ke=(0,d.useRef)(e.onFaceDrawn);ke.current=e.onFaceDrawn;let Ye=(0,d.useCallback)((h,Q)=>{Me(Q),ke.current?.(h)},[Me]),[Be,wt]=(0,d.useState)(null),Qe=D.places(),$e=(0,d.useRef)({shown:A,onFace:e.onFace});$e.current={shown:A,onFace:e.onFace};let W=(0,d.useCallback)((h,Q,K)=>{if(C){G.current?.(h,Q,K);return}$e.current.onFace?.(h),M.current?.(h==="pages"?Q??$.current.path:Re,"push")},[C]),[ge,U]=(0,d.useState)(void 0);(0,d.useEffect)(()=>{A==="pages"&&U(void 0)},[A]);let Ne=(0,d.useRef)(o);(0,d.useEffect)(()=>{Ne.current!==o&&(Ne.current=o,U(void 0))},[o]);let Ae=(0,d.useCallback)(h=>{if($e.current.shown==="pages"){if(Pe(!0),U(h),L==="scene"||L==="graview"){xr(L,()=>{C?window.history.pushState(null,"",`${Z(Re)}${h??""}`):M.current?.(Re,"push")});return}xr(Le.current,()=>W(Le.current,void 0,h))}},[C,L,e.basePath,W]),He=(0,d.useCallback)(h=>{if($e.current.shown==="pages"){Se.go.current||($.current.path=h),J(h);return}if($.current.path=h,N(h),Ce.current){Pe(!1),C?window.history.pushState(null,"",Z(h)):M.current?.(h,"push");return}W("pages",h)},[Se,J,N,W,C,e.basePath]),ze=D.arrangement?.(),ue=A==="pages",Ee=e.hrefOf,We=Ee??(C?Z:void 0),Y=(0,d.useMemo)(()=>({open:He,...Ee?{href:Ee}:C?{href:h=>xt(h,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[He,C,e.basePath,Ee]);return(0,g.jsxs)("section",{ref:p,className:w,"aria-label":e.label??n.name,"data-graview-embed":A,"data-graview-scheme":T,...se?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:_,minHeight:v?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,g.jsx)("style",{children:E}),(0,g.jsxs)(Jn.Provider,{value:re,children:[(0,g.jsx)(mr,{rootRef:p,board:j}),(0,g.jsx)(lr,{rootRef:p,firstLook:e.firstLook,app:er(F??{name:n.name},n.schema)}),(0,g.jsx)(Ue,{module:"@graview/react",report:re,content:!0,children:(0,g.jsx)(In.Provider,{value:ie,children:(0,g.jsx)(Vn,{store:P,views:D,initialView:q,scheme:T,...hr(e,k,F),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,g.jsxs)(Qn.Provider,{value:j,children:[(0,g.jsx)(Oo,{face:A,stop:ge??o,kinds:O,places:Qe,opens:X}),z?(0,g.jsx)(To,{into:z}):null,(0,g.jsx)(xo,{rootRef:p,face:L,shown:A,path:te,stop:o,draft:de.n,onDrawn:e.onDrawn,parts:ie}),C?(0,g.jsx)(ir,{pagesWere:H?.path,basePath:e.basePath,shown:A,onFace:e.onFace,toggle:G,kinds:O,places:Qe,opens:X,landed:le}):null,i&&A!=="picture"?(0,g.jsx)(Ue,{module:"@graview/embed",report:re,children:(0,g.jsx)(yr,{name:F?.name??n.name,heading:S,named:Wt(i).name!==!1,faces:Wt(i).faces===!1?void 0:{scene:{label:Fn(ze),current:!ue,go:()=>Ae(),reach:()=>void Ve(Le.current)},pages:{label:On(ze),current:ue,go:()=>He($.current.path),reach:()=>void Ve("pages")}},at:ue?te:null,without:e.pages?.without(),home:{...We?.("/")!==void 0?{href:We("/")}:{},go:()=>He("/"),current:ue&&te.split("?")[0]==="/"},reach:{...We?{href:We}:{},go:h=>He(h.path)},standing:c,hostActions:e.hostActions,keeping:ue?void 0:(0,g.jsx)(Co,{app:n,studio:e.studio,report:re}),onFind:wt,switch:e.switch})}):null,(0,g.jsx)(Xn.Provider,{value:Be,children:(0,g.jsx)(Ue,{module:A==="pages"||A==="picture"?"@graview/pages":"@graview/react",report:re,content:!0,children:(0,g.jsxs)(d.Suspense,{fallback:(0,g.jsx)(Ao,{auto:v,scene:A!=="pages"&&A!=="picture"}),children:[A==="picture"?(0,g.jsx)(vo,{scope:w,store:P,views:D,as:(o?ct(o).within?.view:void 0)??""}):A==="pages"?(0,g.jsx)(wo,{store:P,views:D,presence:k,auto:v,brand:F,steering:Se,overview:Ae,scope:w,titleLevel:gr(S),quickAsk:Vt(e.quickAsk),props:{...e,onNavigate:ee,...C?{}:{path:$.current.path}}}):(0,g.jsx)(Kn.Provider,{value:Y,children:(0,g.jsx)(yo,{address:C,auto:v,scheme:T,scope:w,quickAsk:Vt(e.quickAsk)})}),(0,g.jsx)(ko,{asked:L,shown:A,onDrawn:Ye})]})},A)})]})})})})]})]})}var Kt=e=>e.split(/[?#]/)[0]===Re,Wr=(0,d.createContext)(null);function To({into:e}){return e.view=dt().view,null}function xo({rootRef:e,face:n,shown:o,path:i,stop:c,draft:l,onDrawn:S,parts:p}){let{view:w}=dt(),E=o==="scene"||o==="graview",T=st(w),{pan:P,...k}=w,F=w.pan?st(k):T,v={face:n,path:E?Re:o==="picture"?c??"#":i,stop:T};return Ar(e,`${o} ${E?F:v.path} ${l}`,v,S,p),null}var mt,Fo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.PCKX2FHR.js","./chunk.LMXNHBGH.js","./chunk.DBCVZGCC.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.SIABGHF2.js"))),Qt=()=>Fo().then(e=>void(mt=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(o),e()},o=setTimeout(n,1e4);window.addEventListener("online",n)}).then(Qt));function Oo({face:e,stop:n,kinds:o,places:i,opens:c}){let{view:l,go:S}=dt(),p=(0,d.useRef)({face:e,stop:n});return(0,d.useLayoutEffect)(()=>{let w=p.current.stop!==n,E=p.current.face!==e,T=p.current.face==="pages";if(p.current={face:e,stop:n},!w&&!E||e==="pages"||e==="picture")return;let P=(w||T)&&n!==void 0?$r(e,n,o,i):T&&cr(l)?$t(e,Nt(c),o):e==="graview"?Lt(l,!0):l.overview?Hn(Lt(l,!1),tr(l,o)):l;S(P)},[e,n,o,l,S,c]),null}function Co({app:e,studio:n,report:o}){return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Suspense,{fallback:null,children:(0,g.jsx)(go,{})}),n!==!1?(0,g.jsx)(Ue,{module:"@graview/studio",report:o,children:(0,g.jsx)(Lo,{app:e,studio:n})}):null]})}function Lo({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)(d.Suspense,{fallback:null,children:(0,g.jsx)(Eo,{...o})})}function Mo({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 Zt(e,n){let o=n.store??n.remote?.store??dr(n.app,n.seed),i=n.notices??Dt(),c=null,l={},S=0,p=n.label,w=n.app,E=Promise.resolve(),T=n.at?.face??n.face,P=T===void 0?void 0:Bt({...n,face:T}),k=P??Yt(n.stop),F=null,v=[],_=f=>{if(F=f,f!==k)return;let V=v;v=[];for(let j of V)j()};function de(){let[f,V]=(0,d.useState)(P),[j,Z]=(0,d.useState)(n.stop),[x,me]=(0,d.useState)(n.path),[B,R]=(0,d.useState)(n.scheme??"auto"),[he,L]=(0,d.useState)(n.principal),[O,C]=(0,d.useState)(n.seats),[H,X]=(0,d.useState)(n.quickAsk),[q,ye]=(0,d.useState)(n.people),[$,Fe]=(0,d.useState)(n.hostContext),[M,ee]=(0,d.useState)(n.brand),[te,N]=(0,d.useState)(n.whileAway),[Se,J]=(0,d.useState)(n.label),[z,G]=(0,d.useState)(n.hostActions),[le,ne]=(0,d.useState)(void 0),[Oe,Pe]=(0,d.useState)(n.draftView);return c={app:se=>{ne(se),me(void 0),Z(void 0)},face:V,stop:Z,path:me,scheme:R,seat:L,seats:C,quickAsk:X,people:ye,hostContext:Fe,brand:ee,whileAway:N,label:J,hostActions:G,draft:Pe},(0,g.jsx)(Wr.Provider,{value:l,children:(0,g.jsx)(Nr,{...le?Mo(n,le):n,store:o,notices:i,...f!==void 0?{face:f}:{},onOpening:se=>{k=se},...j!==void 0?{stop:j}:{},...x!==void 0?{path:x}:{},...he?{principal:he}:{},...O?{seats:O}:{},...H!==void 0?{quickAsk:H}:{},...q?{people:q}:{},...$?{hostContext:$}:{},...M?{brand:M}:{},whileAway:te,label:Se,hostActions:z,draftView:Oe,scheme:B,onFace:se=>{k=se,V(se)},onSeat:L,onFaceDrawn:_},le?.n??0)})}let D=()=>{let f=l.view?.focusId,V=f?o.graph.getNode(f)?.kind:void 0,j=(l.shown??k)==="scene"||(l.shown??k)==="graview";return{face:k,path:j?Re:l.pages?.()??n.path??"/",stop:l.view?st(l.view):n.stop??"#",...V?{kind:V}:{}}},ie=(0,Or.createRoot)(e);return(0,I.flushSync)(()=>ie.render((0,g.jsx)(de,{}))),{get store(){return o},where:D,setApp:(f,V,j)=>{let Z="graph"in V?{store:V}:V,x=()=>{let me=D();o=Z.store,p=j?.label??(p===w.name?f.name:p),w=f,(0,I.flushSync)(()=>{c?.label(p),c?.app({app:f,remote:Z,at:me,n:++S})})};mt?x():E=E.then(Qt).then(x)},setFace:f=>{k=f,(0,I.flushSync)(()=>c?.face(f))},setStop:f=>(0,I.flushSync)(()=>c?.stop(f)),setPath:f=>(0,I.flushSync)(()=>{if(Kt(f)){(k==="pages"||k==="picture")&&(k="scene",c?.face("scene"));return}c?.path(f),k!=="pages"&&(k="pages",c?.face("pages"))}),setScheme:f=>(0,I.flushSync)(()=>c?.scheme(f)),setSeat:f=>(0,I.flushSync)(()=>c?.seat(f)),setSeats:f=>(0,I.flushSync)(()=>c?.seats(f)),setQuickAsk:f=>(0,I.flushSync)(()=>c?.quickAsk(f)),setPeople:f=>(0,I.flushSync)(()=>c?.people(f)),setHostContext:f=>(0,I.flushSync)(()=>c?.hostContext(f)),setBrand:f=>(0,I.flushSync)(()=>c?.brand(f)),setWhileAway:f=>(0,I.flushSync)(()=>c?.whileAway(f)),setDraftView:f=>(0,I.flushSync)(()=>c?.draft(f)),setLabel:f=>{p=f,(0,I.flushSync)(()=>c?.label(f))},setHostActions:f=>(0,I.flushSync)(()=>c?.hostActions(f)),drawn:()=>E.then(()=>F===k?void 0:new Promise(f=>v.push(f))),notify:f=>{let V;return(0,I.flushSync)(()=>{V=i.notify(f)}),V},unmount:()=>ie.unmount()}}var ht=e=>`s${(e+1).toString(36)}`;var Ir="/graview/friction";var _r="/graview/live",Xt="graview.ship",en=`${Xt}.${ot}`;var be={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"};var je=class extends Error{constructor(n){super(n),this.name="Superseded"}},xe=e=>e?.lineage?{lineage:e.lineage}:{},Ho=(e,n)=>`${e.calls.map(o=>o.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
2
+ `)[0]??"":String(n)})`;function Do(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 qe=class extends Error{constructor(o){super(o.sentence);this.refusal=o;this.name="RemoteRefusedError"}},Vo={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},pe=class extends Error{constructor(o,i){super(o);this.conflicts=i;this.name="StaleWrite"}},Je=class extends Error{constructor(n){super(n),this.name="Unreached"}},Bo=new Set([502,503,504]);async function $o(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function No(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var Wo=1,Io=()=>({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 yt(e){return(await jr(e,Do(e.carry),"This app was updated while your changes were on the way.",Io())).remote}async function jr(e,n,o,i){let c=e.fetch??fetch,l={"content-type":"application/json",...e.headers??{}},S={...gt(e.principal),[be.via]:e.via??"web"};Object.assign(l,S);let p=e.live===!0,w=e.presenceEveryMs,E=e.visible??qo,T="connecting",P=i.statuses,k=i.tally,F=[],v,_=[],de=()=>T==="online"&&v!==void 0?"held":T,D=()=>{let t=de();if(i.told!==t){i.told=t;for(let r of[...P])r(t)}},ie=t=>{if(!(t===T||ce)&&(T==="offline"&&t==="online"&&k.reconnects++,T=t,D(),t==="online"))for(let r of F.splice(0))r.again()},f=t=>{if(ce)return;let r=typeof t=="string"&&t.length>0?t:void 0,s=r!==v;if(v=r,V(),!!s&&(D(),r===void 0)){for(let a of _.splice(0))a();oe&&clearTimeout(oe),an()}},V=()=>{if(i.toldHeld!==v){i.toldHeld=v;for(let t of[...i.helds])t(v??null)}},j=async(t,r)=>{let s;try{s=await c(t,r)}catch(a){throw Y()||ie("offline"),new Je(a instanceof Error?a.message:String(a))}if(s.status===503&&await $o(s))return ie("online"),s;if(Bo.has(s.status))throw Y()||ie("offline"),new Je(`The server is away (${s.status})`);return ie("online"),s},Z=async(t=!1)=>{let r=`${e.url}/graview/state?opFormat=${_e.op}`,s=t?await c(r,{headers:l}):await j(r,{headers:l});if(!s.ok)throw new Error((await s.json().catch(()=>({}))).error??`The server refused (${s.status})`);return await s.json()},x=e.state??await Z(!0);p||(T="online"),v=typeof x.held=="string"&&x.held.length>0?x.held:void 0,V();let me=x.enabledModules??e.enabledModules,B=e.localApp?e.localApp(e.app):e.app,R=new xn({schema:B.schema,mutations:B.mutations??[],invariants:B.invariants??[],...B.policy?{policy:B.policy}:{},...B.publishing?{publishing:B.publishing}:{},...B.modules?{modules:B.modules}:{},...me?{enabledModules:me}:{},...B.intelligence?{intelligence:B.intelligence}:{},...B.brand?.timeZone?{timeZone:B.brand.timeZone}:{},snapshot:x.snapshot,log:x.log,...x.horizon!==void 0?{horizon:x.horizon}:{},ids:No(),...e.storeOptions??{}});kn.served.add(R);let he=e.friction!==!1&&e.principal?.kind!=="visitor";he&&An(R,t=>{he&&c(`${e.url}${Ir}`,{method:"POST",headers:l,body:JSON.stringify({event:t})}).then(r=>void(he=r.status!==404&&r.status!==410),()=>{})});let L=Rn(R),O=x.log.at(-1)?.seq??(x.horizon??0)-1,C=Tt.of(x.log,{horizon:x.horizon??0}),H=null,X,q=new Map,ye=i.who,$=!1,Fe=t=>{if(ce)return;$=!0;let r=Cn(new Map,t,Date.now(),Ot,H?.participant);X!==void 0&&r.delete(X);let s=r.size!==q.size;if(!s)for(let[a,u]of r)Ct(u,q.get(a))||(s=!0);if(q=r,!!s)for(let a of[...ye])a([...q.values()])},M=[],ee=new Set,te=t=>{let r=M.indexOf(t);r>=0&&M.splice(r,1)},N=new Map,Se=(t,r)=>{let s=N.get(t);s&&(N.delete(t),s.resolve({ops:r.filter(a=>a.batch===t),batch:t}))},J,z=[],G=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(J)return z.push({ops:t,drop:r}),[];let s=Math.min(...t.filter(m=>m.seq>O).map(m=>m.seq));if(Number.isFinite(s)&&s>O+1)return z.push({ops:t,drop:r}),le(),[];let a=M.filter(m=>t.some(ae=>ae.batch===m)),u=[...new Set([...r,...a])].filter(m=>ee.has(m)),y,b=M.filter(m=>!a.includes(m));try{y=R.rebase({confirmed:t,pending:b,drop:u}).confirmed}catch(m){if(!(m instanceof Tn))throw m;return z.push({ops:t,drop:r}),le(),[]}for(let m of a)te(m);t.some(m=>m.seq>O)&&b.some(m=>!u.includes(m))&&k.rebases++,t.length>0&&(O=Math.max(O,...t.map(m=>m.seq)),C.note(t));for(let m of u)ee.delete(m);for(let m of a)Se(m,t);return y},le=()=>{J||(J=ke(Z().then(t=>{if(ne(t)){z=[];return}let r=new Set(t.log.map(u=>u.batch)),s=M.filter(u=>r.has(u));for(let u of s)te(u);let a=R.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[...M],drop:[...ee].filter(u=>!M.includes(u))});ee.clear();for(let u of a.pending)ee.add(u.batch);O=t.log.at(-1)?.seq??(t.horizon??0)-1,C=Tt.of(t.log,{horizon:t.horizon??0}),k.resyncs++;for(let u of s)Se(u,t.log)}).then(()=>{J=void 0;let t=z;z=[];for(let{ops:r,drop:s}of t)G(r,s)},()=>{J=void 0,z=[]})))},ne=t=>(typeof t.build=="string"&&cn(t.build),typeof t.version=="number"&&f(t.held),typeof t.version!="number"||t.version===x.version?!1:(St(t.version),!0)),Oe=async t=>{let s=await(await j(`${e.url}/graview/since?seq=${ht(t)}&opFormat=${_e.op}`,{headers:l})).json();return ne(s)?[]:s.reset===!0?(le(),[]):s.ops??[]},Pe=async()=>{let t=await se();return J&&await J,t},se=async()=>{if(H&&!Y()&&E()){let r=await(await j(`${e.url}/graview/here?opFormat=${_e.op}`,{method:"POST",headers:l,body:JSON.stringify({presence:H,seq:ht(O)})})).json();return ne(r)?[]:(typeof r.participant=="string"&&(X=r.participant),Fe(r.who??[]),G(r.ops??[]))}return G(await Oe(O))},A=new Map,Ce=new Map,Le=new Set,re=new Map,Me=new Set,ke=t=>(Me.add(t),t.finally(()=>Me.delete(t)).catch(()=>{}),t),Ye=Promise.resolve(),Be=0,wt=(t,r)=>{let s=Ye.then(()=>$e(t,r));return Ye=s.catch(()=>{}),s},Qe=()=>new Promise((t,r)=>F.push({again:t,give:r})),$e=async(t,r)=>{let s,a;for(;;){try{s=await j(`${e.url}/graview/ops`,{method:"POST",headers:l,body:JSON.stringify({...t,opFormat:_e.op})})}catch(m){if(!(m instanceof Je)||U)throw m;if(await Qe(),Y())return Ze(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"?ne(a):(f(a.held),!1))break;if(v!==void 0&&(Et>0||p)){if(await new Promise(m=>_.push(m)),U)throw new je("The client closed.");if(Y())return Ze(t,r);continue}}let b;if(s.status===503&&a.reason==="unavailable"&&!U)b=tn(e.backoff,Be++);else{if(Be=0,s.status!==429||U)break;b=_o(s.headers.get("retry-after"),a.retryAfter)}if(await new Promise(m=>setTimeout(m,b)),Y())return Ze(t,r)}if(ce||ne(a))throw new je("The app was changed.");if(!s.ok){let b=a.error??`The server refused (${s.status})`;throw a.conflict?new pe(b,a.conflicts??[]):new qe({reason:a.reason??Vo[s.status]??"invalid",sentence:b,...a.wouldNeed?.length?{wouldNeed:a.wouldNeed}:{}})}let u=a.ops??[],y=u[0]?.seq;return y!==void 0&&y>O+1&&(u=await Oe(O)),r!==void 0&&(a.batch&&A.set(r,a.batch),te(r)),G(u,r!==void 0?[r]:[]),{ops:a.ops??[],...a.batch?{batch:a.batch}:{}}},W,ge=!1,U=!1,Ne=0,Ae,He=0,ze=0,ue=null,Ee=()=>{},We=new Promise(t=>{Ee=t}),Y=()=>p&&ge&&W?.readyState===Wo,h=t=>{if(!Y())return!1;try{return W.send(JSON.stringify(t)),!0}catch{return!1}},Q=(t=!1)=>{!H||!Y()||!E()||!t&&ue&&Ct(H,ue)&&(w===void 0||Date.now()-ze<w)||h({t:"here",presence:H})&&(ue=H,ze=Date.now())},K=new Set,oe,an=()=>{if(oe=void 0,v!==void 0)return;let t=[...N.entries()].filter(([r])=>K.has(r));K.clear();for(let[,r]of t)h(r.message)},sn=(t,r)=>{N.has(t)&&(K.add(t),oe&&clearTimeout(oe),oe=setTimeout(an,Math.max(0,r)))},Gr=t=>{N.has(t)&&K.add(t)},Ze=(t,r)=>new Promise((s,a)=>{let u=r??`send-${++He}`,y=t.undo?{t:"undo",cid:u,batches:t.undo,...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.via?{via:t.via}:{},...xe(t)}:{t:"call",cid:u,calls:t.calls??[],...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.base?.length?{base:t.base}:{},...t.via?{via:t.via}:{},...xe(t)};if(N.set(u,{message:y,...r!==void 0?{mine:r}:{},resolve:s,reject:a}),K.size>0||v!==void 0){K.add(u);return}h(y)}),Xe=(t,r)=>Y()?Ze(t,r):wt(t,r),Ur=t=>{switch(t.t){case"welcome":{if(cn(t.build),typeof t.version=="number"&&t.version!==x.version){St(t.version);return}if(ge=!0,Ne=0,typeof t.participant=="string"&&(X=t.participant),f(t.held),t.state?le():G(t.ops??[]),K.clear(),oe&&clearTimeout(oe),oe=void 0,v!==void 0)for(let r of N.keys())K.add(r);else for(let r of N.values())h(r.message);Q(!0),ie("online"),Ee();return}case"ops":G(t.ops??[]);return;case"ack":{let r=N.get(t.cid);if(!r){G(t.ops??[]);return}N.delete(t.cid),Be=0,r.mine!==void 0&&(A.set(r.mine,t.batch),te(r.mine)),G(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=N.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){v!==void 0?Gr(t.cid):sn(t.cid,tn(e.backoff,Be++));return}N.delete(t.cid),r.reject(t.t==="conflict"?new pe(t.sentence,t.conflicts??[]):new qe({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&sn(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":Fe(t.who??[]);return;case"held":f(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==x.version&&St(t.version);return;case"reload":fn(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&W){let r=W;mn(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},ce=!1,vt=i.declarations,bt=i.builds,cn=t=>{if(!(ce||i.otherBuild!==void 0||!e.build||typeof t!="string"||t.length===0||t===e.build)){i.otherBuild=t;for(let r of[...bt])r(t)}},dn=()=>{let t=[],r=0;for(let s of M){let a=re.get(s);a?t.push({calls:a.calls,...a.intent?{intent:a.intent}:{},...a.via?{via:a.via}:{},...xe(a),batch:s}):r++}return{carried:t,undos:r}},ln=(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.`,un=t=>{ce=!0,H=null;let r=new je(t);for(let a of N.values())a.reject(r);N.clear(),nt&&clearInterval(nt),U=!0,Ae&&clearTimeout(Ae),oe&&clearTimeout(oe),we&&clearTimeout(we);for(let a of F.splice(0))a.give(r);for(let a of _.splice(0))a();let s=W;W=void 0,ge=!1;try{s?.close(1e3,t)}catch{}Ee()};async function St(t){if(ce)return;if(!e.resolveApp){fn(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:s}=dn(),a=e.resolveApp,u=H;un("The app was changed.");try{let y=await a(t),{state:b,...m}=e,ae=await jr({...m,app:y},r,"The app was changed while your changes were on the way.",i);u&&ae.remote.presence.here(u);for(let rt of[...vt])rt(ae.remote,t);let fe=[...s>0?[et(ln(s,"The app was changed"))]:[],...ae.unheard()];for(let rt of fe)for(let to of Ie)to(rt.sentence,rt)}catch(y){let b=`The app was changed, but the new version could not be opened: ${y instanceof Error?y.message:String(y)}`;for(let m of Ie)m(b,et(b))}}function fn(t){if(ce)return;let{carried:r,undos:s}=dn();un(t);let a=!1;if(e.carry&&r.length>0)try{e.carry.storage.setItem(e.carry.key,JSON.stringify(r)),a=!0}catch{}let u=[];!a&&r.length>0&&u.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&&u.push(ln(s,"This app was updated"));for(let y of u)for(let b of Ie)b(y,et(y));(e.reloadPage??jo)()}let pn=()=>{if(U||!p)return;let t=`${e.url.replace(/^http/,"ws").replace(/\/$/,"")}${_r}`,{"content-type":r,...s}=l,a;try{a=e.socket?e.socket(t,s,[en]):eo(t,s)}catch{return hn()}W=a,ge=!1,a.onopen=()=>{W===a&&a.send(JSON.stringify({t:"hello",seq:ht(O),protocol:ot,wire:Xt,opFormat:_e.op,...e.build?{build:e.build.slice(0,64)}:{},...e.hostProtocol!==void 0?{hostProtocol:e.hostProtocol}:{}}))},a.onmessage=u=>{if(W!==a)return;let y;try{y=JSON.parse(String(u.data))}catch{return}Ur(y)},a.onclose=()=>mn(a),a.onerror=()=>{}},we,Kr=()=>{$=!1,we&&clearTimeout(we),we=setTimeout(()=>{if(we=void 0,$||U)return;let t=new Map([...q].filter(([,r])=>r.held!=="socket"));if(t.size!==q.size){q=t;for(let r of ye)r([...q.values()])}},Ot),we.unref?.()};function mn(t){if(W!==t)return;let r=ge;W=void 0,ge=!1,ue=null,r&&(ie("offline"),Kr()),hn()}let hn=()=>{if(U)return;let t=tn(e.backoff,Ne);Ne++,Ae=setTimeout(pn,t)},yn=R.applyAll.bind(R),Jr=R.undo.bind(R),Yr=R.previewAll.bind(R);R.previewAll=(t,r)=>Yr(t,{...e.principal?{author:e.principal}:{},...r});let Ie=i.refusals,Ge=[],et=t=>({reason:"invalid",sentence:t}),tt=i.conflicts,Pt=!1,gn,kt=async(t,r)=>{if(r instanceof je||ce)return;let s=r instanceof qe?r.refusal:Sn(r),a=s.sentence,u=r instanceof pe?gn?.yoursOf(R,re.get(t)?.calls??[]):void 0;te(t);try{G([],[t])}catch{}let y=re.get(t);re.delete(t);let b=y?.calls[0];if(b&&!(r instanceof pe)){let m=R.allMutations().find(fe=>fe.name===b.name)?.subject?.arg,ae=m&&R.graph.getNode(b.args[m])?.kind;En(R,{type:"refused",act:b.name,code:s.reason,...ae?{kind:ae}:{}},e.principal)}if(r instanceof pe&&k.conflicts++,r instanceof pe&&!Y()&&await Pe().catch(()=>[]),r instanceof pe&&J&&await J,r instanceof pe&&tt.size>0){let m=!1,ae={sentence:a,conflicts:u?r.conflicts.map(fe=>fe.node===u.node&&fe.field===u.field?{...fe,yours:u.yours}:fe):r.conflicts,keepTheirs(){m=!0},useMine(){if(!(m||!y)){m=!0,Pt=!0;try{R.applyAll(u?[u.over(O)]:y.calls,{...y.intent?{intent:y.intent}:{},...y.via?{via:y.via}:{},...xe(y)})}finally{Pt=!1}}}};for(let fe of tt)fe(ae);return}for(let m of Ie)m(a,s)},Qr=(t,r)=>t.flatMap(s=>s.mutation?.name===bn?[]: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:O}]:[]));R.applyAll=(t,r)=>{let s=Pn(R.log.all().filter(b=>ee.has(b.batch))),a=yn(t,{...e.principal?{author:e.principal}:{},...r}),u=t.map((b,m)=>{let ae=a.minted?.[m];return ae===void 0||b.args?.id!==void 0?b:{...b,mintedHint:ae}});M.push(a.batch),ee.add(a.batch),re.set(a.batch,{calls:u,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...xe(r)});let y=Pt?[]:[...C.baseFor(a.ops,s,(b,m)=>R.collaborative(b,m)),...Qr(a.ops,s)];return Ce.set(a.batch,ke(Xe({calls:u,...r?.intent?{intent:r.intent}:{},batch:a.batch,...y.length>0?{base:y}:{},...r?.via?{via:r.via}:{},...xe(r)},a.batch).catch(b=>kt(a.batch,b)))),a},R.apply=(t,r)=>R.applyAll([t],r),R.undo=(t,r)=>{let s=typeof t=="string"?[t]:t,a=Jr(s.map(y=>A.get(y)??y),{...e.principal?{author:e.principal}:{},...r});M.push(a.batch),ee.add(a.batch);let u=Promise.allSettled(s.map(y=>Ce.get(y)));return Ce.set(a.batch,ke(u.then(()=>{let y=s.filter(b=>!Le.has(b));if(y.length===0){te(a.batch),re.delete(a.batch),G([],[a.batch]);return}return Xe({undo:y.map(b=>A.get(b)??b),...r?.intent?{intent:r.intent}:{},batch:a.batch,...r?.via?{via:r.via}:{},...xe(r)},a.batch)}).catch(y=>kt(a.batch,y)))),a};let Zr=async(t,r={})=>{At++;try{return(await ke(Xe({calls:t,...r}))).ops}finally{At--}},At=0,wn={here(t){H=t,Q()},onWho(t){return ye.add(t),q.size>0&&t([...q.values()]),()=>{ye.delete(t)}},leave(){if(!H)return;let t=JSON.stringify({participant:X??H.participant});if(H=null,h({t:"bye"}))return;let r=globalThis.navigator?.sendBeacon;r?r.call(globalThis.navigator,`${e.url}/graview/leave`,t):c(`${e.url}/graview/leave`,{method:"POST",headers:l,body:t}).catch(()=>{})}},Et=e.pollMs??800,nt=Et>0&&typeof setInterval=="function"?setInterval(()=>{Y()||Pe().catch(()=>{})},Et):null;if(p){pn();let t;await Promise.race([We,new Promise(r=>t=setTimeout(r,e.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!ce){let t=[],r=new Set(R.log.all().map(s=>s.batch));for(let s of n)if(!(s.batch!==void 0&&r.has(s.batch)))try{R.applyAll(s.calls,{...s.intent?{intent:s.intent}:{},...s.batch?{batch:s.batch}:{},...s.via?{via:s.via}:{},...xe(s)})}catch(a){t.push(Ho(s,a))}t.length>0&&Ge.push(et(`${o} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}let vn=new Map,Xr=()=>({store:R,author:e.principal,appliedAll:yn,pending:M,provisional:ee,asked:re,answers:Ce,letGo:Le,sent:(t,r)=>ke(Xe({calls:r,batch:t},t).catch(s=>kt(t,s))),settle:te,land:G,seen:()=>O,gone:()=>U||ce});return{remote:{store:R,typing(t,r){let s=`${t}\0${r}`,a=vn.get(s);return a||(a=(__graviewPreload(import.meta.url,["./chunk.U5AX4DD5.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.354A4QCG.js")).then(u=>(gn=u,u.typingOf(t,r,u.wireOf(Xr())))),vn.set(s,a)),a},version:x.version,migrated:x.migrated??[],send:Zr,pull:Pe,onRefusal(t){Ie.add(t);let r=Ge;Ge=[];for(let s of r)t(s.sentence,s);return()=>Ie.delete(t)},onDeclaration(t){return vt.add(t),()=>vt.delete(t)},onBuild(t){return bt.add(t),i.otherBuild!==void 0&&t(i.otherBuild),()=>bt.delete(t)},onConflict(t){return tt.add(t),()=>tt.delete(t)},revision:(t,r)=>C.of(t,r),seq:()=>O,participant:()=>X,transport:()=>Y()?"socket":"poll",status:de,onStatus(t){return P.add(t),()=>P.delete(t)},held:()=>v,onHeld(t){return i.helds.add(t),v!==void 0&&t(v),()=>i.helds.delete(t)},counters:()=>({...k}),who:()=>[...q.values()],pending:()=>M.length+At,async settled(){for(;Me.size>0;)await Promise.allSettled([...Me])},presence:wn,close(){nt&&clearInterval(nt),L(),wn.leave(),U=!0,Ae&&clearTimeout(Ae),oe&&clearTimeout(oe),we&&clearTimeout(we);for(let r of F.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of _.splice(0))r();let t=W;W=void 0,ge=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=Ge;return Ge=[],t}};function eo(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",u=e.subprotocol?[en]:[];if(!a)try{return new s(t,{headers:r,...u.length>0?{protocols:u}:{}})}catch{}let y=new URL(t);for(let[b,m]of Object.entries(S))y.searchParams.set(b,m);return u.length>0?new s(y.toString(),u):new s(y.toString())}}function _o(e,n,o=Date.now()){let i,c=e?.trim();if(c)if(/^\d+(\.\d+)?$/.test(c))i=Number(c)*1e3;else{let p=Date.parse(c);Number.isFinite(p)&&(i=Math.max(0,p-o))}let l=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,S=l!==void 0&&l<50&&i!==void 0&&Math.abs(l*1e3-i)<1e3;return l!==void 0&&!S?l:i??1e3}function jo(){globalThis.location?.reload?.()}function qo(){return globalThis.document?.visibilityState!=="hidden"}function tn(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:o=250,max:i=1e4,factor:c=2}=e??{};return Math.min(i,o*c**n)*(.75+Math.random()*.5)}function gt(e){let n={};if(!e)return n;e.id&&(n[be.seat]=e.id),e.roles?.length&&(n[be.roles]=e.roles.join(",")),e.kind!=="human"&&(n[be.kind]=e.kind),e.name&&(n[be.name]=encodeURIComponent(e.name));let o=e.onBehalfOf;return o?.id&&(n[be.for]=o.id),o?.roles?.length&&(n[be.forRoles]=o.roles.join(",")),o?.name&&(n[be.forName]=encodeURIComponent(o.name)),n}var qr="/graview/views";function nn(e){let n=e.fetch??fetch,o=e.url.replace(/\/$/,""),i={"content-type":"application/json",...e.principal?gt(e.principal):{},...e.headers??{}},c=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??at.may}:at,l=new Set,S=P=>{if(JSON.stringify(P)!==JSON.stringify(c)){c=P;for(let k of l)k()}},p=async(P,k)=>{let F=await n(`${o}${e.path??qr}`,{method:P,headers:i,...k!==void 0?{body:JSON.stringify(k)}:{}}),v=await F.json();if(!F.ok)throw new Error(v.error??`The store answered ${F.status}.`);S({hidden:v.hidden??[],removed:v.removed??[],may:v.may??at.may})},w=()=>p("GET"),E=e.state?Promise.resolve():w().catch(()=>{}),T=e.pollMs?setInterval(()=>void w().catch(()=>{}),e.pollMs):void 0;return{ready:E,refresh:w,close:()=>clearInterval(T),current:()=>c,onChange(P){return l.add(P),()=>void l.delete(P)},hide:P=>p("POST",{hide:P}),show:P=>p("POST",{show:P}),remove:(P,k)=>p("POST",{remove:P,...k?{about:k}:{}}),async restore(P){let k=c.removed.find(F=>F.name===P)?.lens;await p("POST",{restore:P}),k&&await e.onDeclaration?.()},async lens(P){await p("POST",{lens:P}),await e.onDeclaration?.()}}}var on=document.getElementById("graview-app"),rn=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),zr=rn?(__graviewPreload(import.meta.url,["./chunk.2ORJGMRT.js","./chunk.5D6SIBOK.js","./chunk.XOZU4OFA.js","./chunk.QQ3YWKWU.js","./chunk.G5XTASMO.js","./chunk.EGSE6NNE.js","./chunk.5EZDXWOE.js","./chunk.MIQMPOWF.js","./chunk.T66UK7PQ.js","./chunk.DBCVZGCC.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.KHJ2MCMS.js")):Ve("pages");try{rn?await zo(decodeURIComponent(rn[1])):await Go()}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),on.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 lt(o);if(!i.ok)throw new Error(it(i.findings));let c=i.app,l=o.principal,S=await yt({app:c,url:location.origin,principal:l,...o.state?{state:o.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=c.forms?.[e]?.title??c.name;let{mount:p}=await zr;window.__graview=p(on,{app:c,form:e,principal:l,remote:S,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function Go(){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 w=>{if(typeof w.module=="string")return(await import(w.module)).app;let E=await lt(w);if(!E.ok)throw new Error(it(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 c=n.principal,l=await yt({app:i,url:location.origin,principal:c,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=i.name;let S,p=nn({url:location.origin,principal:c,...n.views?{state:n.views}:{},onDeclaration:async()=>{let w=await(await fetch("/graview/document")).json();if(typeof w.module=="string")return;let E=await lt(w);E.ok&&S?.setApp(E.app,l)}});await Promise.all([zr,p.ready]),S=Zt(on,{app:i,remote:l,principal:c,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:i.name,heading:1,keptViews:p,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=S,S.drawn().then(()=>{window.__graviewReady=!0})}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graview",
3
- "version": "0.1.54",
3
+ "version": "0.1.55",
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.54",
33
- "@graview/guest": "0.1.54",
34
- "@graview/skills": "0.1.54",
35
- "@graview/tools": "0.1.54",
36
- "@graview/ship": "0.1.54"
32
+ "@graview/guest": "0.1.55",
33
+ "@graview/ship": "0.1.55",
34
+ "@graview/skills": "0.1.55",
35
+ "@graview/core": "0.1.55",
36
+ "@graview/tools": "0.1.55"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=22"
@@ -1 +0,0 @@
1
- import{a,b,c,d,e,f,g}from"./chunk.RYMSHMLM.js";import"./chunk.TI4OSTQV.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";export{e as askArchived,b as askDeclaration,a as declarationAt,f as keptOf,g as pastAt,d as pastOf,c as seqAt};
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk.VYKEIKY5.js";import"./chunk.IDYPQ45A.js";import"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";export{a as ActivityFilter,b as InteractionRow};
@@ -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.SF4BYBH6.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.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.GZHZLJBF.js","./chunk.PZWJUQAO.js","./chunk.OJGHDWI6.js","./chunk.NEJSKMJV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.XBDFXFWM.js")))),y=f.part((e,r)=>e.drawFiles(r),{quiet:!0});var d=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.GZHZLJBF.js","./chunk.PZWJUQAO.js","./chunk.OJGHDWI6.js","./chunk.NEJSKMJV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.AN5QCSVK.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.PZWJUQAO.js","./chunk.OJGHDWI6.js","./chunk.NEJSKMJV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.ARRLAAG6.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.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.JLB4QP6Q.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,b,c,d,e,f,g,h,i,j,k}from"./chunk.MVRNEC3Y.js";import"./chunk.45HTFSWD.js";import"./chunk.AG7CUSSV.js";import"./chunk.3V2WXZU3.js";import"./chunk.7UD2JR6J.js";import"./chunk.BUDEUNBN.js";import"./chunk.3IEJQAK7.js";import"./chunk.AKLVSZ5A.js";import"./chunk.ZUBC3UFG.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";export{g as columnActs,d as columnChoices,c as columnMoves,b as columnOf,e as columnReach,f as columnSteps,j as describePlace,k as placeText,h as resolveFor,i as shadowedPageSlots,a as statusColumns};
@@ -1 +0,0 @@
1
- import{b as f}from"./chunk.VWQ57LTT.js";import"./chunk.K2J26XMB.js";import"./chunk.B2X6DA2Q.js";import"./chunk.QB7RYJ67.js";import"./chunk.UGFDSE37.js";import{l as g}from"./chunk.EC7I33WI.js";import"./chunk.PXQVXBNG.js";import"./chunk.GVUJCOKD.js";import"./chunk.3ZONBC6L.js";import"./chunk.MDWCX3YU.js";import"./chunk.CB5DGKR5.js";import"./chunk.GKLDSHHH.js";import"./chunk.OCV46AFN.js";import"./chunk.4KTHJY5N.js";import"./chunk.PZ4G5QA5.js";import"./chunk.Y36MLVMT.js";import"./chunk.MPMROUZA.js";import"./chunk.XTT6ERI3.js";import"./chunk.5RH6FO3K.js";import"./chunk.L7MFTL5S.js";import"./chunk.XZJ6XX5I.js";import"./chunk.4F5M5XZG.js";import"./chunk.LVOL2LEC.js";import"./chunk.3G5DEGFA.js";import"./chunk.OZ4EJ5M6.js";import"./chunk.Q6RUTFU3.js";import"./chunk.AZGXBTOQ.js";import"./chunk.XOZU4OFA.js";import"./chunk.AG7CUSSV.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.3V2WXZU3.js";import"./chunk.7UD2JR6J.js";import"./chunk.BUDEUNBN.js";import"./chunk.3IEJQAK7.js";import"./chunk.AKLVSZ5A.js";import"./chunk.ZUBC3UFG.js";import"./chunk.GZHZLJBF.js";import"./chunk.PZWJUQAO.js";import"./chunk.OJGHDWI6.js";import"./chunk.NEJSKMJV.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import{G as b,T as h}from"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import{Nd as n}from"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as t}from"./chunk.AJZBJBMO.js";var m=t(b(),1),a=t(h(),1);function P({store:c,auto:y,brand:i,views:u,presence:s,steering:r,overview:o,scope:d,titleLevel:w=2,quickAsk:l,props:e}){let v=(0,m.useMemo)(()=>g({scope:`.${d}`}),[d]);return(0,a.jsxs)("div",{"data-embed-content":"",style:y?{flex:"0 0 auto",background:"var(--graview-ground)"}:{flex:"1 1 auto",minHeight:0,overflow:"auto",background:"var(--graview-ground)"},children:[(0,a.jsx)("style",{children:v}),(0,a.jsx)("div",{"data-embed-measure":"",style:{display:"flow-root"},children:(0,a.jsx)(f,{context:{store:c,embedded:!0,...e.bar!==!1?{barAbove:!0}:{},...o?{overview:o}:{},titleLevel:w,views:u,settings:e.app.settings??[],...s?{presence:s}:{},...i?{brand:i}:{},...e.locale?{locale:e.locale}:{},...e.timeZone?{timeZone:e.timeZone}:{},...e.principal?{principal:e.principal}:{},...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{},...e.subscriptions?{subscriptions:e.subscriptions}:{},dismissals:e.dismissals,whileAway:e.whileAway,...e.signIn?{signIn:e.signIn}:{},...l!==void 0?{quickAsk:l}:{}},...e.pages?{registry:e.pages}:{},...r?{steering:r}:{},...e.routing==="address"?n(e.basePath)===""?{}:{basename:n(e.basePath)}:{initialPath:e.path??"/"},...e.path!==void 0?{path:e.path}:{},...e.hrefOf?{hrefOf:e.hrefOf}:e.routing==="address"?{}:{hrefOf:!1},...e.onNavigate?{onNavigate:e.onNavigate}:{}})})]})}export{P as PagesContent};
@@ -1 +0,0 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}from"./chunk.SDO3DD77.js";import"./chunk.G4JJXA63.js";import"./chunk.BOMYLOCX.js";import"./chunk.45HTFSWD.js";import"./chunk.KRVEAIKW.js";import"./chunk.XOZU4OFA.js";import"./chunk.AG7CUSSV.js";import"./chunk.C6HBYRGJ.js";import"./chunk.WVUJXDXZ.js";import"./chunk.3V2WXZU3.js";import"./chunk.7UD2JR6J.js";import"./chunk.BUDEUNBN.js";import"./chunk.3IEJQAK7.js";import"./chunk.AKLVSZ5A.js";import"./chunk.ZUBC3UFG.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";export{i as draftAnswer,h as draftFromLens,b as draftSight,l as draftView,a as isDraftFailure,c as judgeLens,d as lensEditOf,f as lensFromSpec,j as recipeDraft,g as recipeOfLens,m as refineDraft,o as runDraftTool,e as takeBackEditOf,k as templateDraft,n as withReaderLenses};
@@ -1 +0,0 @@
1
- import{a as R,b as W}from"./chunk.25VJPUDH.js";import{e as E,f as C,g as z}from"./chunk.ZDDWXRPK.js";import{b as N}from"./chunk.LOUICR7K.js";import"./chunk.L7MFTL5S.js";import{d as I}from"./chunk.4F5M5XZG.js";import"./chunk.3G5DEGFA.js";import{a as D}from"./chunk.AZGXBTOQ.js";import"./chunk.TI4OSTQV.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import{j as f}from"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import{G as M,Ra as H,T as k,Va as A,ba as b,da as x}from"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import{Ya as S}from"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as w}from"./chunk.AJZBJBMO.js";var n=w(M(),1);var e=w(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 _(){let{store:t,principal:o,dismissals:r,whileAway:s,app:u}=b(),h=x(),l=(0,n.useMemo)(()=>W(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)(()=>E(t,o,{dismissed:l.list()}),[t,o,h,l,m]),[v,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:{...H,width:320,maxHeight:"min(52cqh, 460px)",overflow:"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",gap:10,fontSize:"0.8125rem"},children:a.map(g=>(0,e.jsx)($,{suggestion:g,notNow:l,settled:L},g.id))}),(0,e.jsx)("span",{role:"status","data-testid":"suggestion-heard",style:f,children:v})]}):null]})}var T={accept:"Accepted.",decline:"Declined: it will not be suggested again.",later:"Hidden from you until tomorrow."};function $({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)(),v=S(t.author,{graph:s.graph,schema:s.schema,seats:h,people:l}),p=async i=>{y(null);try{i==="accept"?C(s,t.id,{author:u}):i==="decline"?z(s,t.id,{author:u}):await o.dismiss({suggestion:t.id,at:new Date().toISOString(),until:R()}),r(T[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",gap:5,lineHeight:1.45},children:[(0,e.jsxs)("span",{children:[(0,e.jsx)("strong",{style:{fontWeight:600},children:v})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:"suggests"})," ",t.intent]}),t.lineage?(0,e.jsx)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:D(t.lineage)}):null,t.about.length>0?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:t.about.slice(0,4).map(i=>(0,e.jsx)(I,{label:N(s,i),pickId:i},i))}):null,(0,e.jsxs)("div",{style:{display:"flex",gap:6},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:{fontSize:"0.75rem",color:"var(--graview-warn)"},children:m}):null]})}export{_ as SuggestedTray,O as awayWords};
@@ -1 +0,0 @@
1
- import{a}from"./chunk.5VF2RT4H.js";import"./chunk.5RH6FO3K.js";import"./chunk.ZDDWXRPK.js";import"./chunk.LOUICR7K.js";import"./chunk.L7MFTL5S.js";import"./chunk.4F5M5XZG.js";import"./chunk.3G5DEGFA.js";import"./chunk.AZGXBTOQ.js";import{b as n}from"./chunk.VYKEIKY5.js";import"./chunk.IDYPQ45A.js";import"./chunk.TI4OSTQV.js";import"./chunk.GZHZLJBF.js";import"./chunk.PZWJUQAO.js";import"./chunk.OJGHDWI6.js";import"./chunk.NEJSKMJV.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import{T as i}from"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as o}from"./chunk.AJZBJBMO.js";var e=o(i(),1);function m({entries:d,style:l,headingStyle:p,className:r}){return(0,e.jsxs)("section",{...r?{className:r}:{},"data-testid":"record-ai","aria-label":"What AI did here",style:{display:"grid",gap:10,...l},children:[(0,e.jsx)("h2",{style:p??{margin:0,fontSize:"1rem"},children:"What AI did here"}),(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8,fontSize:"0.875rem"},children:d.slice(0,8).map(t=>(0,e.jsx)(n,{entry:t,undo:s=>(0,e.jsx)(a,{batch:s})},t.id))})]})}export{m as RecordInteractions};
@@ -1 +0,0 @@
1
- import{G as l,N as p,U as k,W as y,c}from"./chunk.B2X6DA2Q.js";import"./chunk.QB7RYJ67.js";import"./chunk.UGFDSE37.js";import{b as m}from"./chunk.EC7I33WI.js";import"./chunk.GVUJCOKD.js";import"./chunk.3ZONBC6L.js";import"./chunk.MDWCX3YU.js";import"./chunk.CB5DGKR5.js";import"./chunk.GKLDSHHH.js";import"./chunk.OCV46AFN.js";import"./chunk.4KTHJY5N.js";import"./chunk.PZ4G5QA5.js";import"./chunk.Y36MLVMT.js";import"./chunk.MPMROUZA.js";import"./chunk.XTT6ERI3.js";import"./chunk.5RH6FO3K.js";import"./chunk.L7MFTL5S.js";import"./chunk.XZJ6XX5I.js";import"./chunk.4F5M5XZG.js";import"./chunk.LVOL2LEC.js";import"./chunk.3G5DEGFA.js";import"./chunk.OZ4EJ5M6.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.3V2WXZU3.js";import"./chunk.7UD2JR6J.js";import"./chunk.BUDEUNBN.js";import"./chunk.3IEJQAK7.js";import"./chunk.AKLVSZ5A.js";import"./chunk.ZUBC3UFG.js";import"./chunk.GZHZLJBF.js";import"./chunk.PZWJUQAO.js";import"./chunk.OJGHDWI6.js";import"./chunk.NEJSKMJV.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import{G as S,H as s,I as d,T as f,ca as g}from"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as n}from"./chunk.AJZBJBMO.js";var u=n(S(),1);var t=n(f(),1);function D({context:a}){let r=l(),h=g(),[w]=(0,u.useState)(()=>s(null)),o=d(h?.seatTalk??w),P=()=>{(window.history.state?.idx??0)>0?r(-1):r("/")};return(0,t.jsxs)(k,{context:a,"data-testid":"draft-page",children:[(0,t.jsx)(y,{context:a,...o.draft?{"data-testid":"draft-title"}:{},children:o.draft?o.draft.title:"Nothing drawn"}),o.draft?(0,t.jsx)(m,{page:!0,go:e=>r(e.address),onPick:e=>{let i=a.store.graph.getNode(e);i&&r(c(a.store.schema,i.kind,e))},onDiscard:P}):(0,t.jsxs)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:["Ask for a way of seeing \u2014 \u201Ca board of tasks by status\u201D \u2014 and it is drawn here."," ",(0,t.jsx)(p,{to:"/",style:{color:"var(--graview-accent)"},children:"Home \u2192"})]})]})}export{D as DraftPage};
@@ -1 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as te}from"./chunk.GKLDSHHH.js";import{o as Se,p as ee,s as $,t as be}from"./chunk.PZWJUQAO.js";import{m as J,n as ye,o as we,p as X,q as Z}from"./chunk.OJGHDWI6.js";import{c as ke}from"./chunk.TUNHUTQ5.js";import{a as he,b as U,c as j,e as ve,l as Me}from"./chunk.FWZF7X6A.js";import{b as de}from"./chunk.3JMZHCB4.js";import{D as z,Ea as fe,F as Y,Fa as ge,G as O,Ga as T,J as pe,Ma as _,O as me,Oa as F,T as M,ba as A,ca as q,da as B,m as le,v as ce,z as ue}from"./chunk.SF4BYBH6.js";import{a as E}from"./chunk.SDO3U72B.js";import{Lc as ie,Qc as ae,ia as H,ld as se}from"./chunk.3MZIWKNG.js";import{b as y}from"./chunk.AJZBJBMO.js";var P=y(O(),1),x=y(M(),1),ne=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.E5JX5LWY.js")))),xe=ne.part(t=>(0,x.jsx)(t.HoverChipDoor,{}),{quiet:!0}),De="A",Q=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.KHRS2SKB.js","./chunk.644FUGSX.js","./chunk.J3OX474P.js","./chunk.7SCENHVG.js","./chunk.FWKNR7XF.js","./chunk.OCV46AFN.js","./chunk.Y36MLVMT.js","./chunk.MPMROUZA.js","./chunk.HJCQ6I3S.js","./chunk.5C43AM3X.js","./chunk.4WH4N4V7.js","./chunk.MVRNEC3Y.js","./chunk.ZDDWXRPK.js","./chunk.LOUICR7K.js","./chunk.L7MFTL5S.js","./chunk.4F5M5XZG.js","./chunk.3G5DEGFA.js","./chunk.BOMYLOCX.js","./chunk.45HTFSWD.js","./chunk.Q6RUTFU3.js","./chunk.AZGXBTOQ.js","./chunk.KRVEAIKW.js","./chunk.XOZU4OFA.js","./chunk.AG7CUSSV.js","./chunk.RYMSHMLM.js","./chunk.TI4OSTQV.js","./chunk.C6HBYRGJ.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.PZWJUQAO.js","./chunk.OJGHDWI6.js","./chunk.NEJSKMJV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.LNOWO3IY.js"))));var Ce=Q.part((t,e)=>(0,x.jsx)(t.InspectorPane,{...e}),{what:"This card's acts"});function Le(t){let e=()=>{(typeof navigator>"u"||navigator.onLine!==!1)&&t()},n=globalThis;if(n.requestIdleCallback){let c=n.requestIdleCallback(e,{timeout:5e3});return()=>n.cancelIdleCallback?.(c)}let i=setTimeout(e,2500);return()=>clearTimeout(i)}var Oe=150,Ne="[data-graview-pick], [data-graview-view], [data-graview-record], [data-graview-act], [data-graview-field], a[href]";function Re(t){if(t.closest("[data-graview-face='pages'], [data-graview-popover]"))return null;let e=t.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??t.closest("[data-graview-view]")?.getAttribute("data-graview-view");return e?{face:"scene",on:e,about:[e]}:null}function We(t){let{store:e,principal:n,providers:i,ai:c}=A(),p=be(),h=Y(c),r=(0,P.useRef)({aimAt:t,store:e,principal:n,providers:i,prepareSections:p,chipsOn:h});r.current={aimAt:t,store:e,principal:n,providers:i,prepareSections:p,chipsOn:h},(0,P.useEffect)(()=>{if(typeof document>"u")return;let u=null,w=null,k=null,l=g=>{let m=r.current,b=m.chipsOn?m.aimAt(g):null;b&&(k=g,ne.load().then(G=>{k===g&&G.restOn(b,g)},()=>{}))},f=()=>{u&&clearTimeout(u.timer),u=null},s=g=>{let m=r.current,b=m.aimAt(g);if(!b)return;let G=JSON.stringify([b.face,b.on,b.about,b.field,b.place,b.act,m.store.log.length]);G!==w&&(w=G,m.prepareSections(b),Q.load().then(Pe=>Pe.prepareActs(m.store,b,{principal:m.principal,providers:m.providers}),()=>{}))},o=g=>g.target instanceof Element?g.target.closest(Ne):null,d=g=>{if(g.pointerType==="touch")return;let m=o(g);m!==null&&m===u?.element||(f(),m!==null&&(u={element:m,timer:setTimeout(()=>{u=null,s(m),l(m)},Oe)}))},v=g=>{let m=g.relatedTarget;k!==null&&!(m instanceof Node&&k.contains(m))&&(k=null,ne.current?.leaveRest()),u!==null&&(m instanceof Node&&u.element.contains(m)||f())},S=g=>{if(g.pointerType==="mouse")return;let m=o(g);m&&s(m)},I=g=>{if(!fe())return;let m=o(g);m&&s(m)};return document.addEventListener("pointerover",d,{passive:!0}),document.addEventListener("pointerout",v,{passive:!0}),document.addEventListener("pointerdown",S,{capture:!0,passive:!0}),document.addEventListener("focusin",I),()=>{f(),document.removeEventListener("pointerover",d),document.removeEventListener("pointerout",v),document.removeEventListener("pointerdown",S,{capture:!0}),document.removeEventListener("focusin",I)}},[])}function it({placement:t="float",openActs:e,aimAt:n}={}){let{menuAt:i,setMenuAt:c,registerActsDoor:p,ai:h}=A(),{selection:r}=_();We(n??Re),(0,P.useEffect)(()=>{if(Q.current)return;let f=()=>{v(),Q.prefetch()},s=()=>{},o=ge(()=>void(s=Le(f))),d=["pointerdown","keydown"];for(let S of d)document.addEventListener(S,f,{capture:!0,passive:!0});function v(){o(),s();for(let S of d)document.removeEventListener(S,f,{capture:!0})}return v},[]),(0,P.useEffect)(()=>{if(t==="menu")return p({key:De,open:e??(f=>{let s=f.getBoundingClientRect(),o=f.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??f.closest("[data-graview-view]")?.getAttribute("data-graview-view")??void 0;c({x:Math.round(s.left+Math.min(16,s.width/2)),y:Math.round(Math.min(s.bottom,s.top+36)),...o?{on:o}:{}})})}),()=>p(null)},[t,p,c,e]);let u=i!==null||r.length>0&&e===void 0,[w,k]=(0,P.useState)(u);(0,P.useEffect)(()=>{u&&k(!0)},[u]);let l=Y(h)?(0,x.jsx)(P.Suspense,{fallback:null,children:(0,x.jsx)(xe,{})}):null;return!w&&!u?l:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(P.Suspense,{fallback:null,children:(0,x.jsx)(Ce,{placement:t,chosen:e===void 0})}),l]})}var K=y(O(),1),V=y(M(),1),Ge=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.KHRS2SKB.js","./chunk.25VJPUDH.js","./chunk.644FUGSX.js","./chunk.J3OX474P.js","./chunk.7SCENHVG.js","./chunk.2LMB5E6N.js","./chunk.KJGNLWU3.js","./chunk.GVUJCOKD.js","./chunk.3ZONBC6L.js","./chunk.FWKNR7XF.js","./chunk.MDWCX3YU.js","./chunk.CB5DGKR5.js","./chunk.GKLDSHHH.js","./chunk.OCV46AFN.js","./chunk.4KTHJY5N.js","./chunk.PZ4G5QA5.js","./chunk.Y36MLVMT.js","./chunk.MPMROUZA.js","./chunk.HJCQ6I3S.js","./chunk.5C43AM3X.js","./chunk.4WH4N4V7.js","./chunk.MVRNEC3Y.js","./chunk.ZDDWXRPK.js","./chunk.LOUICR7K.js","./chunk.L7MFTL5S.js","./chunk.XZJ6XX5I.js","./chunk.4F5M5XZG.js","./chunk.LVOL2LEC.js","./chunk.3G5DEGFA.js","./chunk.OZ4EJ5M6.js","./chunk.BOMYLOCX.js","./chunk.45HTFSWD.js","./chunk.Q6RUTFU3.js","./chunk.AZGXBTOQ.js","./chunk.KRVEAIKW.js","./chunk.XOZU4OFA.js","./chunk.AG7CUSSV.js","./chunk.RYMSHMLM.js","./chunk.TI4OSTQV.js","./chunk.C6HBYRGJ.js","./chunk.WVUJXDXZ.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.GZHZLJBF.js","./chunk.PZWJUQAO.js","./chunk.OJGHDWI6.js","./chunk.NEJSKMJV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.Z6O7RUSR.js")))),He=Ge.part((t,e)=>{let n=t.DraftFrame;return(0,V.jsx)(n,{...e})},{what:"The view"});function ct(t){let{seatTalk:e}=A();return(0,K.useSyncExternalStore)(e.subscribe,()=>e.get().draft!==null,()=>!1)?(0,V.jsx)(K.Suspense,{fallback:null,children:(0,V.jsx)(He,{...t})}):null}var C=y(O(),1),D=y(M(),1),Ae=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.MPMROUZA.js","./chunk.OLKFEHWB.js","./chunk.Q6RUTFU3.js","./chunk.AZGXBTOQ.js","./chunk.KRVEAIKW.js","./chunk.XOZU4OFA.js","./chunk.AG7CUSSV.js","./chunk.IDYPQ45A.js","./chunk.TI4OSTQV.js","./chunk.7UD2JR6J.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.B6PKKEY3.js")))),ze=Ae.part((t,e)=>{let n=t.QuickAskCard;return(0,D.jsx)(n,{...e})},{what:"The quick ask"});function gt({face:t,on:e=!0}){let{ai:n,aiDesk:i,selection:c,view:p}=A(),h=me()?.open??!1,r=e&&z(n)&&!h,u=ve(i),w=(0,C.useRef)(null),k=(0,C.useRef)({selection:c,place:p.within?.view});return k.current={selection:c,place:p.within?.view},(0,C.useEffect)(()=>{if(!r)return;let l=he(i);return l.drawn+=1,U(l),()=>{l.drawn=Math.max(0,l.drawn-1),l.drawn===0&&(l.open=null),U(l)}},[r,i]),(0,C.useEffect)(()=>{if(!r)return;let l=f=>{if(f.defaultPrevented||f.key.toLowerCase()!=="k"||!(f.metaKey||f.ctrlKey)||f.altKey||f.shiftKey)return;let s=w.current?.closest("[data-graview-embed]"),o=f.target,d=!(o instanceof Node)||o===document.body||o===document.documentElement;if(s&&!(d||o instanceof Node&&s.contains(o)))return;f.preventDefault(),Ae.prefetch();let v=document.activeElement,{selection:S,place:I}=k.current;j(i,{pointed:{...S[0]!==void 0?{on:S[0]}:{},about:S,...I?{place:I}:{}},returnTo:v instanceof HTMLElement&&v!==document.body?v:null})};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[r,i]),r?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("span",{ref:w,hidden:!0,"data-graview-quick-ask":t}),u?(0,D.jsx)(C.Suspense,{fallback:null,children:(0,D.jsx)(ze,{face:t,opening:u,close:()=>j(i,null)},u.at)}):null]}):null}var R=y(O(),1),L=y(M(),1),oe=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.OLKFEHWB.js","./chunk.Q6RUTFU3.js","./chunk.AZGXBTOQ.js","./chunk.KRVEAIKW.js","./chunk.XOZU4OFA.js","./chunk.AG7CUSSV.js","./chunk.IDYPQ45A.js","./chunk.TI4OSTQV.js","./chunk.7UD2JR6J.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZAGP3OKY.js")))),qe=oe.part((t,e)=>{let n=t.InlineAiMenu;return(0,L.jsx)(n,{...e})},{what:"The AI's suggestions"}),Be=oe.part((t,e)=>{let n=t.GhostTray;return(0,L.jsx)(n,{...e})},{quiet:!0});function _e(){let{ai:t}=A(),e=z(t);return(0,R.useMemo)(()=>e?n=>({id:"inline-ai",heading:"AI",render:i=>(0,L.jsx)(R.Suspense,{fallback:null,children:(0,L.jsx)(qe,{target:n,close:i})}),prepare:()=>oe.prefetch()}):null,[e])}var Fe=[];function St({children:t}){let e=_e(),n=(0,R.useMemo)(()=>e?[e]:Fe,[e]);return(0,L.jsx)($,{sections:n,children:t})}function bt(t){let{ai:e,aiDesk:n}=A(),{ghost:i}=pe(n);return i===null||i.onCard||e.off?null:(0,L.jsx)(R.Suspense,{fallback:null,children:(0,L.jsx)(Be,{...t})})}var N=y(O(),1);var Te=y(M(),1),Qe=t=>globalThis[Symbol.for("graview.shown-lists")]?.get(t),Ee=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.FRZQSSGE.js"))));function Ve(t){let e=t.about[0];if(t.about.length!==1||!e?.startsWith("aggregate:"))return;let n=e.slice(10).split("+");return n.length===1?n[0]:void 0}function Ke(t,e){return t.filter(n=>n.as!==e.as&&!n.hidden&&(n.kind===e.kind||n.over?.includes(e.kind)===!0)).at(-1)}function Ye(t){let e=q(),n=e?.keptViews,i=e?.views,c=(0,N.useContext)(Me);return(0,N.useMemo)(()=>i?p=>{let h=n?.current(),r=Ve(p),u=s=>s.length>0?{id:"tidy-view",items:s,prepare:()=>Ee.prefetch()}:null,w=(s,...o)=>Ee.load().then(d=>d[s](...o),()=>!1),k=(s,o)=>Qe(s)?.().menu(o,n,c)??[];if(p.place===void 0){if(p.face!=="pages"||r===void 0||p.on!==void 0)return null;let s=h?.may.lenses===!0&&n?.lens!==void 0,o=H(e.store.schema,r),d=i.arrangement?.()?.hide?.includes(r)===!0;return u([...s?[{id:d?"show-list":"hide-list",label:d?"Show":"Hide",hint:d?"Back in the places, for everyone":"Off the places, for everyone; still at its address",run:()=>void w("setListHidden",r,o,n,!d,c)}]:[],...k(`list:${r}`,s)])}let l=i.places().find(s=>s.as===p.place&&(r===void 0||s.kind===r||s.over?.includes(r)===!0));if(!l)return null;let f=n&&h?se(l,h,n):null;return u([...f?[l.hidden?{id:"show-view",label:"Show",hint:"Back in the places, for everyone",run:()=>void w("setHidden",l,f,n,!1,c)}:{id:"hide-view",label:"Hide",hint:"Off the places and the scene, for everyone",run:()=>void w("setHidden",l,f,n,!0,c)},{id:"delete-view",label:"Delete",hint:`Kept ${30} days under Recently deleted`,run:()=>{let s=Ke(i.places(),l);w("remove",l,f,n,c).then(o=>o&&t?.(l,s))}}]:[],...k(`place:${l.as}`,f==="lens")])}:null,[n,i,c,t])}var Ue=[];function Dt({children:t}){let{view:e,go:n}=F(),i=(0,N.useCallback)((h,r)=>{let u=e.within?.view;e.focusId===ce(h.kind)&&(u===void 0||u===h.as)&&n(r?ue(e,r.kind,r.as):le(e,!0))},[e,n]),c=Ye(i),p=(0,N.useMemo)(()=>c?[c]:Ue,[c]);return(0,Te.jsx)($,{sections:p,children:t})}function Nt(t={}){return t.scope===void 0?te:de(te,t.scope)}var W=y(O(),1),a=y(M(),1);function Bt({inside:t=!1,widthOf:e}={}){let{store:n,view:i,emphasis:c,setEmphasis:p}=A(),h=Se(),{selection:r,set:u}=_(),{show:w}=F(),k=B(),l=(0,W.useMemo)(()=>{let o=new Map;for(let d of n.graph.allEdges()){let v=o.get(d.kind)??{count:0,ends:new Set};v.count+=1;for(let S of[d.from,d.to]){let I=n.graph.getNode(S);I&&v.ends.add(`kind:${I.kind}`)}o.set(d.kind,v)}return[...o.entries()].sort(([d],[v])=>d.localeCompare(v)).map(([d,v])=>({kind:d,count:v.count,ends:[...v.ends]}))},[n,k]),f=Math.max(0,...l.map(o=>o.count));if((0,W.useEffect)(()=>()=>p(null),[p]),!i.overview&&!t||l.length===0)return null;let s=new Set;for(let o of r){if(o.startsWith("kind:")){s.add(o);continue}let d=n.graph.getNode(o);d&&s.add(`kind:${d.kind}`)}return(0,a.jsxs)("section",{"aria-label":"What the lines mean",role:t?"group":void 0,"data-testid":"relation-key",style:t?{display:"grid",gap:1}:{position:"absolute",left:16,top:14,zIndex:ae("rail"),display:"grid",gap:1,padding:"8px 10px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",maxWidth:je,animation:"graview-settle 380ms 280ms ease backwards"},children:[t?null:(0,a.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:"var(--graview-ink-faint)",paddingBottom:2},children:l.length===1?"1 relation":`${l.length} relations`}),e?(0,a.jsx)(Xe,{aloft:i.overview===!0}):null,l.map(({kind:o,count:d,ends:v})=>{let{connector:S,style:I}=ee(h,o),g=Je(n.schema,o),m=c!==null?c===o:s.size===0||v.some(b=>s.has(b));return(0,a.jsxs)("button",{type:"button",title:n.schema.edge(o)?.description===void 0?`${d} of these`:g.words,onMouseEnter:()=>p(o),onMouseLeave:()=>p(null),onFocus:()=>p(o),onBlur:()=>p(null),onClick:()=>{u(v),w(null)},style:{all:"unset",outline:"revert-layer",cursor:"pointer",display:"grid",gridTemplateColumns:"30px 1fr auto",alignItems:"center",gap:8,minHeight:23,padding:"2px 4px",borderRadius:6,opacity:m?1:.4},children:[(0,a.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",style:{display:"block",opacity:S.visible?1:.35},children:i.overview&&e?(0,a.jsx)("path",{d:"M 1 5 L 29 5",fill:"none",className:"graview-key-ribbon",stroke:"var(--graview-ink)",strokeOpacity:.35,strokeWidth:e(d,f)}):(0,a.jsx)("path",{d:"M 1 5 L 29 5",fill:"none",stroke:X(I),strokeWidth:Z(I,!0),strokeDasharray:J[I.pattern],strokeLinecap:"round"})}),(0,a.jsxs)("span",{style:{display:"grid",minWidth:0},"data-graview-relation-words":o,children:[(0,a.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink)"},children:g.words}),(0,a.jsx)("span",{style:{fontSize:"0.6875rem",color:"var(--graview-ink-faint)"},children:g.ends})]}),S.visible?null:(0,a.jsx)("span",{"data-graview-quiet":o,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontStyle:"italic"},children:"not drawn"}),(0,a.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontVariantNumeric:"tabular-nums"},children:d})]},o)})]})}var je="min(280px, calc(100% - 28px))";function Je(t,e,n){let i=t.edge(e)?.from??[],c=new Map;for(let r of n!==void 0&&i.includes(n)?[n]:i.length>0?i:[""]){let u=ke(t,r,e,"out");c.set(u,[...c.get(u)??[],r])}let p=r=>r==="*"?"anything":H(t,r),h=[...c].map(([r,u])=>{let w=u.flatMap(l=>t.tryDefinition(l)?.edges[e]?.to??[]),k=u[0]&&w.length>0?`${u.map(p).join(", ")} \u2192 ${(w.includes("*")?["*"]:[...new Set(w)]).map(p).join(", ")}`:"";return[r.charAt(0).toUpperCase()+r.slice(1),k]});return{words:h.map(([r])=>r).join(" \xB7 "),ends:h.flatMap(([,r])=>r?[r]:[]).join(" \xB7 ")}}function _t({edgeKind:t,kit:e,width:n=30}){let i=q(),c=(0,W.useMemo)(()=>ie(e??i?.brand?.kit),[e,i?.brand?.kit]),{connector:p,style:h}=ee(c,t);return(0,a.jsx)("svg",{width:n,height:"8","aria-hidden":"true","data-testid":"relation-mark","data-graview-relation":t,style:{display:"inline-block",verticalAlign:"middle",opacity:p.visible?1:.35},children:(0,a.jsx)("path",{d:`M 1 4 L ${n-1} 4`,fill:"none",stroke:X(h),strokeWidth:Z(h,!0),strokeDasharray:J[h.pattern],strokeLinecap:"round"})})}function Xe({aloft:t}){let e={display:"grid",gridTemplateColumns:"30px 1fr",alignItems:"center",gap:8,minHeight:23,padding:"2px 4px"},n={fontSize:"0.75rem",color:"var(--graview-ink-muted)"};return(0,a.jsxs)("div",{role:"group","aria-label":"The lines","data-testid":"line-manners",style:{display:"grid",gap:1,paddingBottom:6,marginBottom:4,borderBottom:"1px solid var(--graview-edge)"},children:[t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{style:e,"data-graview-manner":"ribbon",children:[(0,a.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-ink)",strokeOpacity:.35,strokeWidth:6})}),(0,a.jsx)("span",{style:n,children:"A relation between two districts, as wide as the links along it \u2014 point at one for its words"})]}),(0,a.jsxs)("div",{style:e,"data-graview-manner":"record",children:[(0,a.jsxs)("svg",{width:"30",height:"10","aria-hidden":"true",children:[(0,a.jsx)("path",{d:"M 1 5 L 25 5",stroke:"var(--graview-accent)",strokeWidth:1.8,strokeLinecap:"round"}),(0,a.jsx)("circle",{cx:26,cy:5,r:3,fill:"var(--graview-accent)"})]}),(0,a.jsx)("span",{style:n,children:"A chosen record's link to another record, labeled with the relation"})]}),(0,a.jsxs)("div",{style:e,"data-graview-manner":"district",children:[(0,a.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-accent)",strokeWidth:1.8,strokeDasharray:"5 4"})}),(0,a.jsx)("span",{style:n,children:"A chosen record's links into a district, with how many"})]})]}):null,(0,a.jsxs)("div",{style:e,"data-graview-manner":"unsure",children:[(0,a.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-accent)",strokeOpacity:we,strokeWidth:1.8,strokeDasharray:ye,strokeLinecap:"round"})}),(0,a.jsx)("span",{style:n,children:"Unsure: a link its maker was less than sure of, until a person keeps it \u2014 point at its words for what it was based on"})]})]})}var Ie=y(O(),1),re=y(M(),1),Ze=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.25VJPUDH.js","./chunk.ZDDWXRPK.js","./chunk.LOUICR7K.js","./chunk.L7MFTL5S.js","./chunk.4F5M5XZG.js","./chunk.3G5DEGFA.js","./chunk.AZGXBTOQ.js","./chunk.TI4OSTQV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.5XAIP3BS.js")))),et=Ze.part(t=>(0,re.jsx)(t.SuggestedTray,{}),{quiet:!0});function Vt(){let{store:t,whileAway:e}=A(),n=B();return(0,Ie.useMemo)(()=>t.log.all().some(c=>c.suggests!==void 0&&!c.withheld),[t,n])||e?.tidied?(0,re.jsx)(et,{}):null}export{it as a,ct as b,gt as c,Bt as d,je as e,_t as f,_e as g,St as h,bt as i,Ye as j,Dt as k,Nt as l,Vt as m};
@@ -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{q as He}from"./chunk.MPMROUZA.js";import{d as Je,e as Ee,f as ze,g as je}from"./chunk.ZDDWXRPK.js";import{a as Ie}from"./chunk.Q6RUTFU3.js";import{e as X}from"./chunk.AG7CUSSV.js";import{a as j}from"./chunk.C6HBYRGJ.js";import{f as De,g as Y,i as Pe}from"./chunk.RLO3RDYH.js";import{a as Se}from"./chunk.TUNHUTQ5.js";import{$a as ke,Ba as K,Bb as ve,Da as he,Eb as Ae,Fa as ye,Fb as Oe,Ga as Z,Ib as Re,K as pe,Lb as Te,Na as ge,Oa as be,Ob as C,Ra as we,Wb as _e,Ya as W,a as fe,ea as G,ed as $e,kc as xe,lc as Me,mc as Ne,ya as me}from"./chunk.3MZIWKNG.js";var E=(t,e,n)=>{(t[e]===void 0||n>t[e])&&(t[e]=n)},z=(t,e,n)=>{(t[e]===void 0||n<t[e])&&(t[e]=n)},Q=(t,e)=>{t.format=e,e.includes("int")&&(t.isInt=!0)},Le=(t,e)=>{t.mime=t.mime?t.mime.filter(n=>e.includes(n)):[...e]},qe=(t,e)=>{t.multipleOf??=[],t.multipleOf.includes(e)||t.multipleOf.push(e)},Fe=(t,e)=>(t.patterns??=new Set).add(e),sn={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function I(t){let e={},{def:n,bag:r}=t._zod,i=t._zod.traits.has("$ZodCheck")?[t,...n.checks??[]]:n.checks??[];for(let o of i){let a=o._zod.def;switch(a.check){case"greater_than":E(e,a.inclusive?"minimum":"exclusiveMinimum",a.value);break;case"less_than":z(e,a.inclusive?"maximum":"exclusiveMaximum",a.value);break;case"multiple_of":qe(e,a.value);break;case"number_format":{Q(e,a.format);let d=sn[a.format];d&&(E(e,"minimum",d[0]),z(e,"maximum",d[1]));break}case"bigint_format":Q(e,a.format);break;case"min_length":case"min_size":E(e,"minimum",a.minimum);break;case"max_length":case"max_size":z(e,"maximum",a.maximum);break;case"length_equals":E(e,"minimum",a.length),z(e,"maximum",a.length);break;case"size_equals":E(e,"minimum",a.size),z(e,"maximum",a.size);break;case"string_format":Q(e,a.format),a.pattern&&Fe(e,a.pattern),(a.format==="base64"||a.format==="base64url")&&(e.contentEncoding=a.format),(a.local||a.precision===-1)&&(e.laxFormat=!0);break;case"mime_type":Le(e,a.mime);break}}r.minimum!==void 0&&E(e,"minimum",r.minimum),r.exclusiveMinimum!==void 0&&E(e,"exclusiveMinimum",r.exclusiveMinimum),r.maximum!==void 0&&z(e,"maximum",r.maximum),r.exclusiveMaximum!==void 0&&z(e,"exclusiveMaximum",r.exclusiveMaximum),r.multipleOf!==void 0&&qe(e,r.multipleOf),r.format!==void 0&&(e.format??=r.format,r.format.includes("int")&&(e.isInt=!0)),r.mime&&Le(e,r.mime);for(let o of r.patterns??[])Fe(e,o);return e}var dn={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""};function L(t){let e=t._zod.def;return e.type==="pipe"&&e.in._zod.traits.has("$ZodTransform")?L(e.out):e.type==="catch"?L(e.innerType):t._zod.optin}var cn=new Set(["promise","optional","nonoptional","nullable","readonly","default","prefault","catch"]);function _(t,e=new Set){if(e.has(t))return!1;e.add(t);let n=t._zod.def,r=n.type;return r==="transform"?!0:r==="array"?_(n.element,e):r==="set"?_(n.valueType,e):r==="lazy"?_(n.getter(),e):cn.has(r)?_(n.innerType,e):r==="intersection"?_(n.left,e)||_(n.right,e):r==="record"||r==="map"?_(n.keyType,e)||_(n.valueType,e):r==="pipe"?t._zod.traits.has("$ZodCodec")||_(n.in,e)||_(n.out,e):r==="object"?Object.values(n.shape).some(i=>_(i,e)):r==="union"?n.options.some(i=>_(i,e)):r==="tuple"?n.items.some(i=>_(i,e))||(n.rest?_(n.rest,e):!1):!1}function ln(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n])=>e.indexOf(+n)===-1).map(([,n])=>n)}function Be(t){let e=t.anyOf;if(!Array.isArray(e)||e.length===0||t.type!==void 0)return;let n=[];for(let r of e){if(!r||typeof r!="object")return;Be(r);let i=Object.keys(r);if(i.length!==1||i[0]!=="type")return;for(let o of[r.type].flat()){if(typeof o!="string")return;n.includes(o)||n.push(o)}}delete t.anyOf,t.type=n.length===1?n[0]:n}var Ue=new Set(["type","properties","required","additionalProperties"]),We=t=>{let e=t.additionalProperties;return e&&typeof e=="object"&&Object.keys(e).length?e:null},Ce=(t,e)=>JSON.stringify(t)===JSON.stringify(e);function ee(t){for(let i of t){if(typeof i!="object"||i.type!=="object")return null;for(let o in i)if(!Ue.has(o))return null}let e={},n=new Set;for(let i of t){for(let o in i.properties){if(Object.prototype.hasOwnProperty.call(e,o))continue;let a=[];for(let d of t){let s=d.properties?.[o]??We(d);s&&!a.some(y=>Ce(y,s))&&a.push(s)}e[o]=a.length===1?a[0]:ee(a)??{allOf:a}}for(let o of i.required??[])n.add(o)}let r={type:"object",properties:e};if(n.size&&(r.required=[...n]),t.every(i=>i.additionalProperties===!1))r.additionalProperties=!1;else{let i=[];for(let o of t){let a=We(o);a&&!i.some(d=>Ce(d,a))&&i.push(a)}i.length===1?r.additionalProperties=i[0]:i.length>1&&(r.additionalProperties={allOf:i})}return r}function un(t){let e=t.allOf;if(!Array.isArray(e)||e.length<2)return;for(let i of Ue)if(i in t)return;let n=e.filter(i=>Array.isArray(i.oneOf)||Array.isArray(i.anyOf)),r;if(!n.length)r=ee(e);else{let i=n[0],o=Array.isArray(i.oneOf)?"oneOf":"anyOf";if(Object.keys(i).length!==1)return;let a=e.filter(s=>s!==i),d=i[o].map(s=>ee([...a,s]));if(d.some(s=>!s))return;r={[o]:d}}r&&(delete t.allOf,Object.assign(t,r))}function Ve(t){let e=t;for(let S of["anyOf","oneOf"]){let T=e[S];if(!Array.isArray(T))continue;let O=T.map(Ve);O.some((v,h)=>v!==T[h])&&(e={...e,[S]:O})}let n=[e.type].flat(),r=!n.includes("string")&&n.some(S=>S==="number"||S==="integer"),i=e.enum??(e.const!==void 0?[e.const]:void 0);if(!r&&!i?.some(S=>typeof S=="number"))return e;let{minimum:o,maximum:a,exclusiveMinimum:d,exclusiveMaximum:s,multipleOf:y,format:p,id:b,...f}=e;return f.enum?f.enum=f.enum.map(S=>typeof S=="number"?String(S):S):typeof f.const=="number"&&(f.const=String(f.const)),r&&(f.type="string",i||(f.pattern=n.includes("number")?"^-?\\d+(?:\\.\\d+)?$":"^-?\\d+$")),f}var B=class{constructor(e,n){this.override=e;this.refs=n}done=new Map;path=[];cyclic=new Map;write(e,n=!1){let r=this.refs.get(e);if(r!==void 0&&!n)return{$ref:r};if(this.path.includes(e))return this.cyclic.has(e)||this.cyclic.set(e,""),{};let i=this.done.get(e);if(i)return i;this.path.push(e);try{let o=this.written(e);return this.done.set(e,o),o}finally{this.path.pop()}}written(e){let n={},r,i=e._zod.toJSONSchema?.();i?Object.assign(n,i):r=this.process(e,n);let o=fe.get(e);if(o)for(let d of Object.keys(o))n[d]=o[d];_(e)&&(delete n.examples,delete n.default),"_prefault"in n&&(n.default??=n._prefault,delete n._prefault);let a=n;if(r){let d=this.write(r);a={...n};for(let s of Object.keys(d))s in n||(a[s]=d[s])}return this.override({zodSchema:e,jsonSchema:a}),Be(a),e._zod.def.type==="intersection"&&un(a),a}process(e,n){let r=e._zod.def;switch(r.type){case"string":{n.type="string";let{minimum:i,maximum:o,format:a,patterns:d,contentEncoding:s,laxFormat:y}=I(e);if(typeof i=="number"&&(n.minLength=i),typeof o=="number"&&(n.maxLength=o),a&&(n.format=dn[a]??a,(n.format===""||a==="time"||y)&&delete n.format),s&&(n.contentEncoding=s),d&&d.size>0){let p=[...d];p.length===1?n.pattern=p[0].source:n.allOf=p.map(b=>({pattern:b.source}))}return}case"number":{let{minimum:i,maximum:o,multipleOf:a,exclusiveMinimum:d,exclusiveMaximum:s,isInt:y}=I(e);if(n.type=y?"integer":"number",typeof d=="number"&&d>=(i??Number.NEGATIVE_INFINITY)?n.exclusiveMinimum=d:typeof i=="number"&&(n.minimum=i),typeof s=="number"&&s<=(o??Number.POSITIVE_INFINITY)?n.exclusiveMaximum=s:typeof o=="number"&&(n.maximum=o),a){let[p,...b]=new Set(a.filter(f=>Number.isFinite(f)&&f!==0).map(Math.abs));p!==void 0&&(n.multipleOf=p),b.length&&(n.allOf=[...n.allOf??[],...b.map(f=>({multipleOf:f}))])}return}case"boolean":case"success":n.type="boolean";return;case"null":n.type="null";return;case"never":n.not={};return;case"enum":{let i=ln(r.entries);i.length===0?n.not={}:(i.every(o=>typeof o=="number")&&(n.type="number"),i.every(o=>typeof o=="string")&&(n.type="string"),n.enum=i);return}case"literal":{let i=r.values.filter(o=>o!==void 0).map(o=>typeof o=="bigint"?Number(o):o);if(r.values.length===0)n.not={};else if(i.length===1)n.type=i[0]===null?"null":typeof i[0],n.const=i[0];else if(i.length>1){for(let o of["number","string","boolean"])i.every(a=>typeof a===o)&&(n.type=o);i.every(o=>o===null)&&(n.type="null"),n.enum=i}return}case"template_literal":n.type="string",n.pattern=e._zod.pattern.source;return;case"file":{n.type="string",n.format="binary",n.contentEncoding="binary";let{minimum:i,maximum:o,mime:a}=I(e);i!==void 0&&(n.minLength=i),o!==void 0&&(n.maxLength=o),a&&(a.length===0?n.not={}:a.length===1?n.contentMediaType=a[0]:n.anyOf=a.map(d=>({contentMediaType:d})));return}case"array":{let{minimum:i,maximum:o}=I(e);typeof i=="number"&&(n.minItems=i),typeof o=="number"&&(n.maxItems=o),n.type="array",n.items=this.write(r.element);return}case"object":{let i=r.shape;n.type="object";let o={};n.properties=o;for(let d in i)Object.defineProperty(o,d,{value:this.write(i[d]),writable:!0,enumerable:!0,configurable:!0});let a=Object.keys(i).filter(d=>L(i[d])===void 0);a.length>0&&(n.required=a),r.catchall?._zod.def.type==="never"?n.additionalProperties=!1:r.catchall&&(n.additionalProperties=this.write(r.catchall));return}case"union":n[r.inclusive===!1?"oneOf":"anyOf"]=r.options.map(i=>this.write(i));return;case"intersection":{let i=d=>"allOf"in d&&Object.keys(d).length===1,o=this.write(r.left),a=this.write(r.right);n.allOf=[...i(o)?o.allOf:[o],...i(a)?a.allOf:[a]];return}case"tuple":{let i=r.items;n.type="array",n.prefixItems=i.map(s=>this.write(s)),r.rest?n.items=this.write(r.rest):n.items=!1;let o=i.length;for(;o>0&&L(i[o-1])!==void 0;)o-=1;o>0&&(n.minItems=o),r.rest||(n.maxItems=i.length);let{minimum:a,maximum:d}=I(e);typeof a=="number"&&(n.minItems=a),typeof d=="number"&&(n.maxItems=d);return}case"record":{let i=r.keyType;n.type="object";let o=I(i).patterns;if(r.mode==="loose"&&o&&o.size>0){let d=this.write(r.valueType),s={};for(let y of o)s[y.source]=d;n.patternProperties=s}else n.propertyNames=Ve(this.write(i)),n.additionalProperties=this.write(r.valueType);let a=i._zod.values;if(a&&!r.partial&&L(r.valueType)===void 0){let d=[...a].filter(s=>typeof s=="string"||typeof s=="number");d.length>0&&(n.required=d.map(String))}return}case"nullable":n.anyOf=[this.write(r.innerType),{type:"null"}];return;case"default":case"prefault":{let i=r.defaultValue,o,a=!1,d=JSON.stringify(i,(s,y)=>typeof y=="bigint"?(a=!0,null):y);return!a&&d!==void 0&&(o=JSON.parse(d)),a||(n[r.type==="default"?"default":"_prefault"]=o),r.innerType}case"catch":{try{n.default=r.catchValue(void 0)}catch{}return r.innerType}case"readonly":return n.readOnly=!0,r.innerType;case"pipe":return r.in._zod.traits.has("$ZodTransform")?r.out:r.in;case"lazy":return e._zod.innerType;case"optional":case"nonoptional":case"promise":return r.innerType;default:return}}};function Ge(t,e=()=>{}){let n=t,r=new B(e,new Map),i=r.write(n,!0);if(r.cyclic.size>0){let o=new Map,a=0,d=[];for(let y of r.cyclic.keys())if(y===n)o.set(y,"#");else{let p=`__schema${a++}`;o.set(y,`#/$defs/${p}`),d.push([y,p])}r=new B(e,o),i=r.write(n,!0);let s={};for(let[y,p]of d)s[p]=r.write(y,!0);d.length>0&&(i={...i,$defs:s})}return JSON.parse(JSON.stringify({$schema:"https://json-schema.org/draft/2020-12/schema",...i}))}function Ke(t){return Ge(t,mn)}var fn={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string"},pn={phone:"A phone number as it is written, like +1 555 123 4567 or 020 7946 0958 ext. 12.",place:"An address or a place's name, as a person would search a map for it.",duration:"A length of time in whole minutes: 90 is 1 h 30 min."};function mn(t){me(t.zodSchema)&&(t.jsonSchema["x-graview-app-link"]=!0);let e=ye(t.zodSchema);if(e&&(t.jsonSchema.type==="string"||t.jsonSchema.type==="array")){t.jsonSchema["x-graview-linked"]={address:e.address,kinds:[...e.kinds],cardinality:e.cardinality};let s=e.kinds.join(" or "),y=`${e.cardinality==="many"?"Records":"A record"}: a ${s} in the app ${e.address}, as "${e.kinds[0]}:<id>" \u2014 an id found there with find_linked. Linking never changes that app.`,p=t.jsonSchema.description;typeof p=="string"&&p.includes(y)||(t.jsonSchema.description=`${typeof p=="string"&&p?`${p.replace(/\.?$/,".")} `:""}${y}`)}if(we(t.zodSchema)&&(t.jsonSchema["x-graview-repeat"]=!0,!t.jsonSchema.type&&!t.jsonSchema.anyOf&&!t.jsonSchema.oneOf&&Object.assign(t.jsonSchema,hn())),Se(t.zodSchema)){t.jsonSchema.contentMediaType="text/markdown";let s=t.jsonSchema.description;typeof s=="string"&&s.endsWith("Written in Markdown.")||(t.jsonSchema.description=`${typeof s=="string"&&s?`${s.replace(/\.?$/,".")} `:""}Written in Markdown.`)}let n=Te(t.zodSchema);if(n){let s=t.jsonSchema;s["x-graview-type"]=n,n==="duration"&&(s["x-graview-unit"]="minutes"),s.description??=pn[n]}let r=Re(t.zodSchema,!1);if(r){let s=De(r);t.jsonSchema["x-graview-format"]=s.format??"unit",s.currency&&(t.jsonSchema["x-graview-currency"]=s.currency),s.unit&&s.format!=="money"&&(t.jsonSchema["x-graview-unit"]=s.unit);let y=t.jsonSchema.description;t.jsonSchema.description=typeof y=="string"&&y.length>0?`${y} ${Y(s)}`:Y(s)}let i=t.zodSchema._zod?.def;if(!i||i.type!=="string"||typeof i.format!="string"||i.format==="regex")return;let o=t.jsonSchema,a=(i.checks??[]).map(s=>s._zod?.def).filter(s=>s?.format==="regex"&&s.pattern instanceof RegExp).map(s=>s.pattern.source);delete o.pattern;let d=o.allOf;Array.isArray(d)&&d.every(s=>typeof s=="object"&&s!==null&&Object.keys(s).length===1&&"pattern"in s)&&delete o.allOf,o.format=fn[i.format]??i.format,a.length===1?o.pattern=a[0]:a.length>1&&(o.allOf=a.map(s=>({pattern:s})))}function ne(t,e){let n=C(t.input),r=Ke(t.input);if(e&&r.properties){let o=a=>e.includes(a)?e.indexOf(a):e.length;r.properties=Object.fromEntries(Object.entries(r.properties).sort(([a],[d])=>o(a)-o(d)))}let i=r.properties??{};if(Ae(t)){let o=t.creates.join(" | ");i.id={type:"string",minLength:1,description:`Optional: the id for the ${o} this makes. Refused if the graph already has it; left out, one is minted from the label.`},r.properties=i}Oe(t)&&(r.additionalProperties=!1);for(let o of n){let a=i[o.name];if(!a)continue;let d=o.kinds.includes("*")?"any node kind":o.kinds.join(" | ");a.description=[a.description,`Id of a node (${d}).`].filter(Boolean).join(" ")}return{name:t.name,...t.title===void 0?{}:{title:t.title},description:t.description??t.title??t.name,inputSchema:r,nodeRefs:n}}function hn(){let t={type:"string",pattern:"^\\d{4}-\\d{2}-\\d{2}$"},e=(n,r)=>({type:"integer",minimum:n,maximum:r});return{type:"object",description:'How the date beside it repeats; the date is the first occurrence. "on" is weekdays for "week", days of the month (-1 the last) for "month".',properties:{every:{type:"string",enum:[...be]},interval:e(1,99),on:{type:"array",minItems:1,maxItems:31,items:{anyOf:[{type:"string",enum:[...ge]},e(-1,31)]}},until:t,count:e(1,1e3),except:{type:"array",maxItems:500,items:t},continues:{type:"string",maxLength:200}},required:["every"],additionalProperties:!1}}function Ze(t){let e=new Set;for(let n=t;n;n=n.onBehalfOf)n.id!==void 0&&e.add(`${n.kind}:${n.id}`);return e}function U(t,e){let n=Ze(e),r=p=>{if(p.kind==="rule")return!1;let b=Ze(p);if(b.size===0)return!1;for(let f of b)if(n.has(f))return!1;return!0},i,o=()=>{if(i)return i;i=new Map;for(let p of t.log.live()){if(p.undoes!==void 0)continue;let b=r(p.author)?p.author:void 0;for(let f of p.primitives){f.op==="remove-node"&&i.delete(f.node.id);let S=f.op==="add-node"?f.node.id:f.op==="patch-node"||f.op==="splice-text"?f.id:void 0;if(S===void 0)continue;let T=f.op==="add-node"?Object.keys(f.node):f.op==="splice-text"?[f.field]:Object.keys(f.after),O=i.get(S);(f.op==="add-node"||!O)&&i.set(S,O=new Map);for(let v of T)v==="id"||v==="kind"||(b?O.set(v,b):O.delete(v))}}return i},a=t.schema,d=new Map,s=(p,b)=>{let f=`${p}\0${b}`,S=d.get(f);if(S===void 0){let T=a.tryDefinition(p)?.fields?.shape;S=T!==void 0&&b in T&&Pe(T[b]).type==="text",d.set(f,S)}return S},y=p=>t.graph.getNode(p)?.kind;return{prose:s,say:p=>W(p,{graph:t.graph,schema:a}),fieldBy(p,b){let f=y(p);if(!(f===void 0||!s(f,b)))return o().get(p)?.get(b)},recordBy(p){let b=y(p),f=o().get(p);if(b===void 0||!f)return;let S;for(let[T,O]of f)s(b,T)&&(S=O);return S}}}var te=(t,e,n)=>({untrusted:!0,authoredBy:n.say(e),text:t}),yn="the host's ranker";function Ye(t,e){return{...t,hits:t.hits.map(n=>{if(n.about!=="node")return n;n.why.by==="meaning"&&n.why.matched!==void 0&&(n={...n,why:{...n.why,matched:{untrusted:!0,authoredBy:yn,text:n.why.matched}}});let r=e.recordBy(n.id);if(!r)return n;let i=e.prose(n.kind,n.why.field)?e.fieldBy(n.id,n.why.field):r;return{...n,label:te(n.label,r,e),...n.apart!==void 0?{apart:te(n.apart,r,e)}:{},why:i?{...n.why,fragment:te(n.why.fragment,i,e)}:n.why}})}}var ie=(t,e,n)=>({title:t,readOnlyHint:e,destructiveHint:!1,idempotentHint:n,openWorldHint:!1}),gn={name:"subscribe",title:"Notify me when something happens",description:`Subscribe the person you act for to be told when something happens in this app \u2014 their host delivers it (an email, a push). on is one of: "act" (an act runs; give act, its declared name, and/or record), "created" (a record of kind is added), "changed" (a record of kind, or the one record, changes), "reaches" (a record of kind, or the one record, comes to satisfy condition, an expression in the app's rule language such as done == true or amount > 100). They are told only of changes someone else made, unless alsoMine is true, and only of records they may see. Returns the subscription and its sentence. Changes nothing in the app.`,inputSchema:{type:"object",properties:{on:{type:"string",enum:["act","created","changed","reaches"],description:"What to be told of."},act:{type:"string",description:"An act's declared name, for on: act."},kind:{type:"string",description:"A kind, for created, changed and reaches."},record:{type:"string",description:"One record, by id or name: for act, changed and reaches."},condition:{type:"string",description:"For reaches: what the record should come to satisfy, in the rule language (done == true)."},alsoMine:{type:"boolean",description:"Also when the person themselves made the change; false when unsaid."}},required:["on"],additionalProperties:!1},mutating:!1,annotations:ie("Notify me when something happens",!1,!1)},bn={name:"unsubscribe",title:"Stop notifying me",description:"Take away one of the person's subscriptions, by the id list_subscriptions or subscribe answered. Changes nothing in the app.",inputSchema:{type:"object",properties:{id:{type:"string",description:"The subscription's id."}},required:["id"],additionalProperties:!1},mutating:!1,annotations:ie("Stop notifying me",!1,!0)},wn={name:"list_subscriptions",title:"What I am notified of",description:`List what the person you act for is told of in this app: each subscription's id and its sentence ("When someone else adds a task").`,inputSchema:{type:"object",properties:{},additionalProperties:!1},mutating:!1,annotations:ie("What I am notified of",!0,!0)},re=[gn,bn,wn];var F=t=>{let e;return()=>e??=t().catch(n=>{throw e=void 0,n})},Sn=F(()=>(__graviewPreload(import.meta.url,["./chunk.MVRNEC3Y.js","./chunk.45HTFSWD.js","./chunk.AG7CUSSV.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.4BX3KLAA.js"))),kn=()=>(__graviewPreload(import.meta.url,["./chunk.C6HBYRGJ.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.4TGQ6Z6E.js")).catch(()=>{}),vn=async()=>{(await kn())?.judgeWithLines()},q=F(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.TUNHUTQ5.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.COWJTVZV.js"))),An=F(()=>(__graviewPreload(import.meta.url,["./chunk.SDO3DD77.js","./chunk.G4JJXA63.js","./chunk.BOMYLOCX.js","./chunk.45HTFSWD.js","./chunk.KRVEAIKW.js","./chunk.XOZU4OFA.js","./chunk.AG7CUSSV.js","./chunk.C6HBYRGJ.js","./chunk.WVUJXDXZ.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.5M62CMLA.js"))),On=F(()=>(__graviewPreload(import.meta.url,["./chunk.7SCENHVG.js","./chunk.MVRNEC3Y.js","./chunk.45HTFSWD.js","./chunk.Q6RUTFU3.js","./chunk.AZGXBTOQ.js","./chunk.AG7CUSSV.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.PCNEM3WE.js"))),Rn=F(()=>(__graviewPreload(import.meta.url,["./chunk.RBYRT2I2.js","./chunk.JTOAZ2IR.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.W6NCLU5Y.js"))),Tn=t=>t.definitions.some(e=>Z(e).size>0),Xe=t=>({value:K(t),label:t.label,...t.describe?{describe:t.describe}:{},...t.card?{card:t.card}:{},fields:t.fields,...t.app?{app:t.app}:{}});async function _n(t,e,n,r){let i=String(n.relation??""),[o,a]=i.includes(".")?i.split(".",2):[void 0,i],d=t.schema.definitions.flatMap(v=>[...Z(v)].map(([h,u])=>({kind:v.kind,name:h,relation:u}))),s=d.filter(v=>v.name===a&&(o===void 0||v.kind===o));if(s.length!==1){let v=d.map(h=>`${h.kind}.${h.name}`).join(", ")||"none";return{ok:!1,error:`${s.length===0?`No relation to another app is called "${i}"`:`"${i}" names a relation of several kinds`}. The relations to other apps are: ${v}.`}}let{kind:y,name:p,relation:b}=s[0];if(!r)return{ok:!1,error:`This seat cannot read ${b.address}: its host reads no other app's records. Nothing was changed.`};let f={kind:e.kind,...e.id===void 0?{}:{id:e.id},...e.roles?{roles:e.roles}:{}},S=typeof n.of=="string"?n.of:void 0;if(S!==void 0){let v=t.graph.getNode(S);if(!v||v.kind!==y)return{ok:!1,error:`No ${y} "${S}".`};let h=he(v[p],b),u=await Promise.all(h.map(w=>Promise.resolve().then(()=>r.resolve(w,f)).catch(()=>null)));return{ok:!0,data:{relation:`${y}.${p}`,app:b.address,records:u.map((w,k)=>w===null?{value:K(h[k]),missing:!0}:"denied"in w?{denied:!0,said:"linked record (no access)"}:Xe(w))},reads:[S]}}let T=typeof n.limit=="number"&&n.limit>0?Math.min(n.limit,20):20,O=await Promise.resolve().then(()=>r.find({address:b.address,kinds:b.kinds,query:String(n.query??""),limit:T},f)).catch(()=>[]);return Array.isArray(O)?{ok:!0,data:{relation:`${y}.${p}`,app:b.address,records:O.map(Xe),link:`edit-${y} with ${p} set to a record's value`}}:{ok:!0,data:{relation:`${y}.${p}`,app:b.address,denied:!0,said:"linked record (no access)"}}}var M=t=>({title:t,readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}),Qe={description:'Which records: false (the default) the live ones, true only the archived ones, "all" both. An archived record is set aside, not gone: unarchive-<kind> brings it back.',anyOf:[{type:"boolean"},{type:"string",enum:["all"]}]},oe={type:"number",description:"Where the page starts; 0 when unsaid."},se=[{name:"search_graph",title:"Find by name",description:"Find things by name: records whose name or readable fields carry the words, and the kinds, places and rules the words name \u2014 each with why it matched. Reach for this before get_graph when you know what something is called. Words match the start of words, case and accents aside; key:value tokens narrow as a list's filter does (done:false, is:any for past records, kind:<kind>). Pass subject (a node id) to get the acts you may run on it as hits too. When few records match exactly, records with a near word follow \u2014 a typo, another form of the word, a meaning \u2014 each with near: true and why.matched, the record's own word that answered.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Words, with optional key:value conditions."},limit:{type:"number",description:"Most hits to return; at most 20."},subject:{type:"string",description:"A node id whose acts to include."},archived:Qe},required:["query"],additionalProperties:!1},mutating:!1,annotations:M("Find by name")},{name:"get_graph",title:"Read the graph",description:"Read the graph, 25 nodes a page: their fields, the edges out of them, and how many more. Start here when you need the shape of the domain rather than one thing in it.",inputSchema:{type:"object",properties:{offset:oe,archived:Qe},additionalProperties:!1},mutating:!1,annotations:M("Read the graph")},{name:"get_node",title:"Read one node",description:"Read one node: its fields, its links (id, kind and label, 20 each way a page), the violations that implicate it, and its computed values: read-only fields worked out from what you can see, which no act sets. Use this to check a thing before you change it.",inputSchema:{type:"object",properties:{id:{type:"string",description:"A node's id, or its name."},offset:oe},required:["id"],additionalProperties:!1},mutating:!1,annotations:M("Read one node")},{name:"get_violations",title:"List the problems",description:"List the invariant violations the graph currently has, 20 a page, with the repairs that would resolve each one. Read this before proposing work: a rule that is already broken is more urgent than anything you could add.",inputSchema:{type:"object",properties:{offset:oe,context:{type:"object",description:"Evaluation context, e.g. { weekStart }."}},additionalProperties:!1},mutating:!1,annotations:M("List the problems")},{name:"get_affordances",title:"Ask what can be done",description:"Ask what can legally be done with a selection, ranked. Prefer these over composing a mutation by hand: they are derived from the schema, the invariants and the shape of the graph, so they cannot name an action that does not exist.",inputSchema:{type:"object",properties:{selection:{type:"array",items:{type:"string"},description:"Node ids."},context:{type:"object"}},required:["selection"],additionalProperties:!1},mutating:!1,annotations:M("Ask what can be done")},{name:"describe_place",title:"Say what a place shows",description:`Say what one place of the app shows you, as a person in your seat would see it: its headings, its figures as drawn, its lists with each record's title and what its card or row says, the headings a list is grouped under, what an empty list says, the forms it offers (each field in the order asked, its label, whether it must be answered, what it takes and its choices), and any block that could not be worked out. Pass a place's slug ("home", a lens's address like "the-offers", a kind's like "offers"), a record's id, or a visitor form's "forms/<name>", and width 390 for a phone. Use it after a change to check what somebody now sees, instead of guessing.`,inputSchema:{type:"object",properties:{place:{type:"string",description:`"home", a place's slug, a record's id, or "forms/<name>" for a visitor form.`},width:{type:"number",description:"The screen's width in CSS pixels; 390 is a phone, 1440 when unsaid."}},required:["place"],additionalProperties:!1},mutating:!1,annotations:M("Say what a place shows")},{name:"preview_mutation",title:"Try an act without applying it",description:"Try a mutation without applying it: get back the diff it would produce and any invariant it would break. Do this when you are unsure, rather than applying and undoing.",inputSchema:{type:"object",properties:{mutation:{type:"string"},args:{type:"object"}},required:["mutation","args"],additionalProperties:!1},mutating:!1,annotations:M("Try an act without applying it")},{name:"undo_batch",title:"Undo a batch",description:"Undo one batch of operations. Fails, naming the blocking operation, when a later operation read what it wrote.",inputSchema:{type:"object",properties:{batch:{type:"string"},include:{type:"array",items:{type:"string"}}},required:["batch"],additionalProperties:!1},mutating:!0,annotations:{title:"Undo a batch",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1}},{name:"list_suggestions",title:"List what is suggested",description:"List the suggestions waiting for a person: changes the app's own actor proposed and did not make, each with its id, what it would do, who suggested it, what it was based on and how sure (0 to 1). Nothing changes until one is accepted (accept_suggestion) or declined (decline_suggestion); a declined one is never suggested again.",inputSchema:{type:"object",properties:{},additionalProperties:!1},mutating:!1,annotations:M("List what is suggested")},{name:"accept_suggestion",title:"Accept a suggestion",description:"Make a waiting suggestion's change, as this seat, carrying what it was based on. Returns the batch (undo_batch takes it back).",inputSchema:{type:"object",properties:{suggestion:{type:"string",description:"The suggestion's id, from list_suggestions."}},required:["suggestion"],additionalProperties:!1},mutating:!0,annotations:{title:"Accept a suggestion",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1}},{name:"decline_suggestion",title:"Decline a suggestion",description:"Decline a waiting suggestion: nothing changes, the decline is kept in the log, and the same change is never suggested or made by the app's own actor again.",inputSchema:{type:"object",properties:{suggestion:{type:"string",description:"The suggestion's id, from list_suggestions."}},required:["suggestion"],additionalProperties:!1},mutating:!0,annotations:{title:"Decline a suggestion",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}}],nn={name:"act_on_several",title:"Do one act to several records",description:`Run one act on several records at once, as one change with one undo. act is the act (its tool name or its declared name), records the records it runs on (ids or names; each goes in the act's subject), args what every call shares ("Set stage to Declined" is args { stage: "declined" }). Each record is judged on its own: one this seat may not change is named with why, and the rest still apply. Returns the batch (undo_batch takes it all back), the records changed, those already so, and those refused.`,inputSchema:{type:"object",properties:{act:{type:"string",description:"The act to run on each record."},records:{type:"array",items:{type:"string"},minItems:1,maxItems:200,description:"Ids or names of the records."},args:{type:"object",description:"Arguments every call shares, besides the record."}},required:["act","records"],additionalProperties:!1},mutating:!0,annotations:{title:"Do one act to several records",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1}},ue={name:"suggest_changes",title:"Suggest changes",description:"Keep calls ({ act, args }) as one suggestion a person accepts or declines, with its basis and confidence (0 to 1). Changes nothing; a declined change is refused.",inputSchema:{type:"object",properties:{calls:{type:"array",items:{type:"object"}},basis:{type:"string"},confidence:{type:"number"}},required:["calls","basis"]},mutating:!0,annotations:{title:"Suggest changes",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},de={type:"object",description:"A lens, as draft_view returns one.",properties:{title:{type:"string"},lens:{type:"string"},on:{type:"string"},bindings:{type:"object"},options:{type:"object"}},required:["title","lens","on"]},ce={name:"draft_view",title:"Draw a view",description:'Draw a view of the data from words ("a board of tasks by status", "who covers what") as a lens the app could keep; or check a lens you wrote (lens); or change the one on screen (current, with ask: "only this month"). Returns the lens and its add-lens edit, or one sentence saying why not. Writes nothing.',inputSchema:{type:"object",properties:{ask:{type:"string",description:"What to see, in words."},lens:de,current:de},additionalProperties:!1},mutating:!1,annotations:M("Draw a view")},tn={name:"keep_lens",title:"Keep a view as a lens",description:"Keep a lens draft_view drew as one of the app's places: checked again, then written as the add-lens edit. Returns the remove-lens edit that takes it back.",inputSchema:{...de,additionalProperties:!1},mutating:!0,annotations:{title:"Keep a view as a lens",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},rn={name:"find_linked",title:"Find a record in another app",description:`A relation may go to a kind in another app (describe_app lists them under "Linked from other apps"). With relation and words, list the records there this seat may link \u2014 each with the value to link it by ("house:h1"), its name and its describe line. With of (a record id here), read the records that record links, as this seat may see them there. Linking one is the record's edit (edit-<kind>) with the relation set to the value. Another app this seat may not open answers denied, and nothing of it. Writes nothing; never changes the other app.`,inputSchema:{type:"object",properties:{relation:{type:"string",description:"The relation, by name (forHouse) or as <kind>.<relation> (scenario.forHouse)."},query:{type:"string",description:"Words to find by, in the other app's names; empty for the first few."},of:{type:"string",description:"A record here whose linked records to read, instead of finding."},limit:{type:"number",description:"Most records to return; at most 20."}},required:["relation"],additionalProperties:!1},mutating:!1,annotations:M("Find a record in another app")};function xn(t,e){return t===void 0?[]:t==="keep"&&!e?[ce,tn]:[ce]}var Mn="An argument that names a record takes its id or its name.",on=[...se.map(t=>t.name),nn.name,ue.name,ce.name,tn.name,rn.name,...re.map(t=>t.name)],an=64;function N(t){let{line:e,...n}=t;return n}function en(t){return{...t,...t.introduces?{introduces:t.introduces.map(N)}:{},...t.resolves?{resolves:t.resolves.map(N)}:{},...t.violationsAfter?{violationsAfter:t.violationsAfter.map(N)}:{}}}function Nn(t){let e=t.normalize("NFKD").replace(/\p{M}/gu,"").replace(/[^A-Za-z0-9_-]/g,"_");return e.length===0&&(e="act"),/^[A-Za-z_]/.test(e)||(e=`act_${e}`),e.slice(0,an)}function $n(t){let e=new Set(on),n=new Map;for(let r of t){let i=Nn(r),o=i;for(let a=2;e.has(o);a+=1)o=`${i.slice(0,an-`_${a}`.length)}_${a}`;e.add(o),n.set(r,o)}return n}function Dn(t,e){if(e.size===0)return t;let n=Object.fromEntries(Object.entries(t.properties??{}).filter(([i])=>!e.has(i))),r=(t.required??[]).filter(i=>!e.has(i));return{...t,properties:n,...t.required?{required:r}:{}}}function Pn(t,e,n,r){let i=ne(t,_e(r,t)),o=G(t),a=i.nodeRefs.length>0?`${i.description}${/[.!?]$/.test(i.description)?"":"."} ${Mn}`:i.description;return{name:e,title:o,description:a,inputSchema:Dn(i.inputSchema,n),mutating:!0,annotations:{title:o,readOnlyHint:!1,destructiveHint:t.destructive===!0||(t.severs?.length??0)>0,idempotentHint:t.idempotent===!0,openWorldHint:!1},act:t.name}}function le(t){if(t===null||typeof t!="object")return JSON.stringify(t)??"null";if(Array.isArray(t))return`[${t.map(le).join(",")}]`;let e=t;return`{${Object.keys(e).filter(n=>e[n]!==void 0).sort().map(n=>`${JSON.stringify(n)}:${le(e[n])}`).join(",")}}`}function Jn(t){return`sha256:${$e(le(t))}`}function En(t,e,n,r,i,o=!1,a=!1,d=!1,s){let y=$n(t.map(f=>f.name)),p=[...xn(r,n),...o?[rn]:[],...a?re:[]];return{definitions:n?[...se.filter(f=>!f.mutating),...p]:[...se,nn,...d?[ue]:[],...p,...t.filter(f=>e.has(f.name)).map(f=>Pn(f,y.get(f.name),i(f),s))],names:y}}function At(t,e={}){let n=e.author??{kind:"agent"},r=t.allMutations(),i=new Set(t.permittedMutations(n).map(h=>h.name)),{definitions:o,names:a}=En(r,i,e.readOnly===!0,e.drafts?e.drafts.keep?"keep":"draw":void 0,h=>X(t.schema,t.policy,n,h),Tn(t.schema),e.subscriptions!==void 0,Ne(n),t.schema),d=Jn(o),s={app:e.app?.brand?.locale,appTimeZone:e.app?.brand?.timeZone},y=h=>pe(s,h),p=h=>{if(!on.includes(h)){for(let[u,w]of a)if(w===h)return u;return a.has(h)?h:xe(h,a.keys())}},b=h=>{let u=Me(h,a.keys());return u?` Did you mean "${u}"?`:""},f=h=>{let u=o.find(k=>k.name===h)??o.find(k=>k.act===h);if(u)return u;let w=p(h);return w===void 0?void 0:o.find(k=>k.act===w)},S=(h,u)=>{let w=r.find(c=>c.name===h);if(!w)return{args:u,resolved:[]};let k={...u},l=[];for(let c of C(w.input)){let m=k[c.name];if(typeof m!="string"||m.trim()==="")continue;let g=t.resolveRef(c,m,n);if(!g.ok){let A=g.reason==="none"?` Nothing was changed. Use search_graph to look it up, then pass its id as ${c.name}.`:" Nothing was changed.";return{ok:!1,error:`${g.message}${A}`,argument:c.name,candidates:g.candidates}}g.by!=="id"&&(k[c.name]=g.id,l.push({argument:c.name,given:m,id:g.id,label:g.label}))}return{args:k,resolved:l}},T=async(h,u)=>{try{await vn();let w=f(h);if(!w&&h===ue.name)return{ok:!1,error:"Only the app's own actor (automated: true) suggests changes.",reason:"forbidden"};if(!w){let l=p(h);if(l){let c=t.permits({name:l,args:u},n);if(!c.ok)return{ok:!1,error:c.refusal.message,reason:"forbidden"}}return{ok:!1,error:`Unknown tool "${h}".${b(h)} Available: ${o.map(c=>c.name).join(", ")}`}}if(w.mutating&&e.readOnly)return{ok:!1,error:`"${h}" changes the graph, and this seat is read-only.`,reason:"forbidden"};if(w.act!==void 0){let l=S(w.act,u);if("ok"in l)return l;let c=w.act,m=y(()=>j(t,n,t.apply({name:c,args:l.args},{...e.author?{author:e.author}:{},...V(e.via)})));return{ok:!0,data:{batch:m.batch,intent:m.intent,introduces:m.introduces.map(N),resolves:m.resolves.map(N),...l.resolved.length>0?{resolved:l.resolved}:{}},diff:m.diff}}let k=t.seenBy(n);switch(w.name){case"search_graph":{let l=typeof e.places=="function"?e.places():e.places,c=typeof u.subject=="string"?u.subject:void 0,m=He(k,String(u.query??""),{principal:n,rank:e.near,archived:ke(u.archived),limit:typeof u.limit=="number"&&u.limit>0?Math.min(u.limit,20):20,...l?{places:l}:{},...c?{subject:c,from:[c]}:{}}),g=m.later?await m.later:m;return{ok:!0,data:(await q()).searchRead(g,Ye(g,U(k,n))),reads:g.hits.flatMap(A=>A.about==="node"?[A.id]:[])}}case"get_graph":return{ok:!0,...(await q()).graphRead(k,U(k,n),u)};case"get_node":{let l=String(u.id??""),c=l,m;if(!k.graph.getNode(l)){let A=l.trim()===""?void 0:t.resolveRef({name:"id",kinds:["*"]},l,n);if(A?.ok)c=A.id,m={argument:"id",given:l,id:c,label:A.label};else return A?.reason==="ambiguous"?{ok:!1,error:A.message,argument:"id",candidates:A.candidates}:{ok:!1,error:`No node "${l}".`}}let g=(await q()).nodeRead(k,U(k,n),c,u);return{ok:!0,data:m?{...g.data,resolved:[m]}:g.data,reads:g.reads}}case"describe_place":{let l=e.app??{name:"",schema:t.schema},c=typeof u.width=="number"&&Number.isFinite(u.width)&&u.width>0?u.width:1440,{describePlace:m}=await Sn(),g=m(t,n,String(u.place??""),{app:l,width:c});if(!g.ok)return{ok:!1,error:`${g.error} The places are: ${g.places.join(", ")}.`};let A=new Set,$=H=>{for(let P of H)for(let x of P.groups??[])for(let D of x.items)A.add(D.id),$(D.parts)};return $(g.description.parts),{ok:!0,data:g.description,reads:[...A]}}case"find_linked":return _n(k,n,u,e.linked);case"draft_view":case"keep_lens":{let l=e.app??{name:"",schema:t.schema};return(await An()).runDraftTool(w.name,u,{app:l,principal:n,...e.drafts?{drafts:e.drafts}:{}})}case"get_violations":{let l=k.violations(u.context);return{ok:!0,...(await q()).violationsRead(l,u)}}case"get_affordances":{let l=u.selection??[];return{ok:!0,data:Ie(k,l,{...typeof e.derive=="function"?e.derive():e.derive,...e.author?{principal:e.author}:{},...u.context?{context:u.context}:{}}),reads:l.filter(m=>k.graph.has(m))}}case"preview_mutation":{let l=String(u.mutation),c=p(l)??l,m=S(c,u.args??{});if("ok"in m)return m;let g=t.missingFor({name:c,args:m.args},n);if(g)return{ok:!1,error:g.message,reason:"missing"};let A=j(t,n,t.preview({name:c,args:m.args},void 0,{author:n})),$=en(A);return{ok:!0,data:m.resolved.length>0?{...$,resolved:m.resolved}:$}}case"act_on_several":{let l=String(u.act??""),c=p(l)??l,m=r.find(R=>R.name===c);if(!m||!i.has(c)){let R=m?t.permits({name:c,args:{}},n):void 0;return R&&!R.ok?{ok:!1,error:R.refusal.message,reason:"forbidden"}:{ok:!1,error:`There is no act "${l}" this seat may run.${b(l)} Nothing was changed.`,reason:"invalid"}}let g=m.subject;if(!g)return{ok:!1,error:`"${G(m)}" does not act on a record, so it cannot be run on several. Nothing was changed.`,reason:"invalid"};let A=Array.isArray(u.records)?u.records.filter(R=>typeof R=="string"&&R.trim()!==""):[];if(A.length===0)return{ok:!1,error:"Name at least one record. Nothing was changed.",reason:"invalid"};let $=[],H=[];for(let R of A.slice(0,200)){let J=t.resolveRef({name:g.arg,kinds:g.kinds},R,n);if(!J.ok)return{ok:!1,error:`${J.message} Nothing was changed.`,argument:"records",candidates:J.candidates};$.push(J.id),J.by!=="id"&&H.push({argument:"records",given:R,id:J.id,label:J.label})}let P=S(c,{...u.args??{}});if("ok"in P)return P;let x=(await On()).actOnSeveral(t,{mutation:c,subject:g.arg,args:P.args},$,{author:n,...V(e.via)}),D=x.result?j(t,n,x.result):void 0;return{ok:!0,data:{...x.batch?{batch:x.batch,intent:x.intent}:{},applied:x.applied,unchanged:x.unchanged,refused:x.refused.map(R=>({record:R.id,label:R.label,error:R.message,reason:R.reason})),...x.allOrNothing?{keptNone:!0}:{},...D?{introduces:D.introduces.map(N),resolves:D.resolves.map(N)}:{},...H.length>0||P.resolved.length>0?{resolved:[...H,...P.resolved]}:{}},...D?{diff:D.diff}:{}}}case"subscribe":case"unsubscribe":case"list_subscriptions":{let l=await(await Rn()).runSubscriptionTool(w.name,u,{store:t,principal:e.subscriber??n,app:e.app?.name??"app",subscriptions:e.subscriptions});return l.ok?{ok:!0,data:l.data}:{ok:!1,error:l.error}}case"list_suggestions":{let l=Ee(t,n).map(c=>{let m=W(c.author,{graph:k.graph,schema:t.schema});return{id:c.id,intent:c.intent,by:m,at:c.at,about:c.about,...c.lineage?{basis:{untrusted:!0,authoredBy:m,text:c.lineage.basis},...c.lineage.confidence!==void 0?{confidence:c.lineage.confidence}:{}}:{}}});return{ok:!0,data:{suggestions:l},reads:[...new Set(l.flatMap(c=>c.about))]}}case"suggest_changes":{let l=u.calls.map(m=>({name:p(m.act)??m.act,args:m.args}));return{ok:!0,data:{suggestion:Je(t,l,{author:n,lineage:{basis:u.basis,confidence:u.confidence},...V(e.via)})?.id??null}}}case"accept_suggestion":case"decline_suggestion":{let l=String(u.suggestion??""),c={author:n,...V(e.via)},m=w.name==="accept_suggestion"?ze(t,l,c):je(t,l,c),g=j(t,n,m);return{ok:!0,data:{batch:g.batch,intent:g.intent,introduces:g.introduces.map(N),resolves:g.resolves.map(N)},diff:g.diff}}case"undo_batch":{let l=String(u.batch),c=u.include??[],m=k.canUndo([l,...c]);if(!m.ok)return{ok:!1,error:m.message};let g=j(t,n,t.undo([l,...c],{...e.author?{author:e.author}:{}}));return{ok:!0,data:en(g),diff:g.diff}}default:return{ok:!1,error:`Unknown tool "${h}".`}}}catch(w){let{reason:k,wouldNeed:l}=ve(w);return{ok:!1,error:w instanceof Error?w.message:String(w),reason:k,...l?{wouldNeed:l}:{}}}},O=new Set,v=h=>{for(let u of O)u(h)};return{definitions:o,hash:d,...e.author?{author:e.author}:{},onDiff(h){return t.subscribe(h)},onCall(h){return O.add(h),()=>O.delete(h)},async call(h,u){let w=f(h)?.mutating??!1,k={name:h,args:u,mutating:w,at:new Date().toISOString()};v({...k,phase:"running"});let l=m=>(v(m.ok?{...k,phase:"ok",...!w&&m.reads?{reads:m.reads}:{}}:{...k,phase:"failed",error:m.error}),m),c=await T(h,u);return l(c.ok&&!w?{...c,data:(await q()).withinReadChars(h,c.data)}:c)}}}function V(t){let e=typeof t=="function"?t():t;return e?{via:e}:{}}export{le as a,At as b};
@@ -1 +0,0 @@
1
- import{b as dn,c as cn,d as re,e as ln,f as oe,h as ze,i as Ae,n as fn,r as ie}from"./chunk.ZUBC3UFG.js";import{Ab as U,B as ue,C as te,Ca as Ue,Db as nn,Ea as We,F as ke,Fc as an,Gc as Oe,H as Ve,Hb as tn,Hc as sn,I as Ie,Ia as we,Ic as Re,Ja as ve,Mb as rn,Pa as Je,Sa as Ye,b as Ge,ba as qe,bb as Qe,c as Pe,d as Me,db as Xe,e as K,fa as Be,g as ce,h as F,i as Le,ib as xe,j as Fe,jb as en,k as le,l as Ne,la as _e,m as Ce,o as Ze,p as fe,q as he,uc as on,v as Ke,wa as be,x as ne,z as pe,za as He}from"./chunk.3MZIWKNG.js";function pn(e){if(typeof e=="string")return{form:"string",light:e};if(typeof e!="object"||e===null)return;let a=e,n=v=>typeof a[v]=="string"?a[v]:void 0,t=n("light")??n("src");if(t===void 0)return;let[o,l,m]=[n("dark"),n("alt"),n("darkFallback")];return{form:n("light")!==void 0?"light":"src",light:t,...o!==void 0?{dark:o}:{},...l!==void 0?{alt:l}:{},...m!==void 0?{darkFallback:m}:{}}}function Fn(e,a){let n=e.brand??{},t=n.ground,o=n.accent?Re(n.accent,t):void 0;t&&sn(o?.ok?o.schemes:Oe(t),n.accent)&&(a.push(Ae("brand","brand.ground","words would not read on that page background, so the app keeps Graview's","pick a lighter ground for the light scheme, a darker one for the dark")),t=void 0,o=n.accent?Re(n.accent):void 0),o&&!o.ok&&a.push(Ae("brand","brand.accent",`that accent cannot make a readable brand, so the app keeps Graview's colors: ${o.why}`,"pick a color further from orange-red, or a darker one"));let l=pn(n.logo),m=n.name??e.name,v=n.typography?Object.fromEntries(Object.entries(n.typography).filter(([,j])=>typeof j=="string"&&!/url\(|@import|[;{}<>\\]/i.test(j)).map(([j,D])=>[j,an(D)])):void 0;return{name:m,schemes:o?.ok?o.schemes:t?Oe(t):on,...n.currency?{currency:n.currency}:{},...n.locale?{locale:n.locale}:{},...n.timeZone?{timeZone:n.timeZone}:{},...l?{logo:l.dark||l.darkFallback==="invert"?{light:l.light,...l.dark?{dark:l.dark}:{darkFallback:"invert"}}:l.light,logoAlt:l.alt??m}:{},...n.favicon?{favicon:n.favicon}:{},...e.description?{subtitle:e.description}:{},...n.subtitle===!1?{subtitleDrawn:!1}:{},...v?{typography:v}:{},...n.shape?{shape:n.shape}:{},...n.accents?{accents:n.accents}:{},...n.scheme?{scheme:n.scheme}:{}}}function un(e){let{currency:a,locale:n,timeZone:t}=e.brand??{};return{...a?{currency:a}:{},...n?{locale:n}:{},...t?{timeZone:t}:{}}}var xn=Symbol.for("@graview/core:typed-field"),mn=(e,a)=>(/^(phone|place|duration)$/.test(a)&&(te(e)[xn]=a),e),gn=/^(?=(?:\D*\d){3})\+?[\d ()./-]+(?: *(?:ext\.?|x|#) *\d+)?$/i;function yn(e){let a=F().check(K(300),pe(t=>Ue(t,e)!==void 0,`a record of ${e.kinds.join(" or ")} in ${e.address}, as "<kind>:<id>"`)),n=e.cardinality==="one"?a:fe(a).check(K(200));return We(e.description?n.check(ue(e.description)):n,e)}var Rn=new WeakMap;function hn(e,a){Rn.set(e,a)}var zn=[{where:"settings[]",was:"honoured",now:"honored",since:"0.1.16"},{where:"pages",was:"overview",now:"scene",since:"0.1.17"}],V=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function kn(e,a=zn){if(!V(e))return{document:e,respelled:[]};let n=[],t=e;for(let o of a)t=Se(t,o.where.split("."),o,"",n);return{document:t,respelled:n}}function Se(e,a,n,t,o){if(a.length===0){if(!V(e)||!Object.hasOwn(e,n.was))return e;o.push(`${t}${n.was}`);let{[n.was]:G,...N}=e;return Object.hasOwn(e,n.now)?N:{...N,[n.now]:G}}if(!V(e))return e;let[l,...m]=a,v=l.endsWith("[]"),j=v?l.slice(0,-2):l,D=e[j],B=D;if(!v)B=Se(D,m,n,`${t}${j}.`,o);else if(Array.isArray(D)){let G=D.map((N,W)=>Se(N,m,n,`${t}${j}.${W}.`,o));B=G.some((N,W)=>N!==D[W])?G:D}return B===D?e:{...e,[j]:B}}var bn="graview-compiled@1";function An(e,a){return e.find(([n,t])=>n!==q&&"ref"in t&&(t.ref==="*"||t.ref.includes(a)))?.[0]}var q="id",me=e=>typeof e=="string"&&/^\$[A-Za-z][A-Za-z0-9]*$/.test(e)?e.slice(1):void 0;function wn(e){let a=Object.entries(e.fields),n=t=>["name","title","label"].find(o=>t.some(([l])=>l===o))??t[0]?.[0];return n(a.filter(([,t])=>t.required&&(t.type==="string"||t.type==="text")))??n(a.filter(([,t])=>t.type==="string"))}function vn(e,a,n){let t;switch(e.type){case"string":case"place":t=F().check(K(500));break;case"phone":t=F().check(K(40),ce(gn,"a phone number"));break;case"text":t=F().check(K(2e4)),e.format&&(te(t)[Symbol.for("@graview/core:markdown")]=1);break;case"number":case"integer":case"duration":{let l=e.min??(e.type==="duration"?0:void 0),m=[...e.type==="number"?[]:[Ne()],...l===void 0?[]:[Pe(l)],...e.max===void 0?[]:[Ge(e.max)],...e.step===void 0?[]:[Me(e.step)]];t=m.length>0?le().check(...m):le();break}case"boolean":t=Ce();break;case"date":t=F().check(ce(ke,"a date like 2026-10-02"));break;case"datetime":t=F().check(pe(Ve,"a date and time like 2026-10-02T14:30:00Z"));break;case"enum":t=Ke(e.options);break;case"list":t=fe(e.of==="number"?le():e.of==="date"?F().check(ce(ke)):e.of==="image"||e.of==="video"||e.of==="file"?be(e.of):F().check(K(500))).check(K(200));break;case"image":case"video":case"file":t=be(e.type);break;case"app-link":t=He();break;case"url":t=Fe();break;case"email":t=Le();break}let o=e.type==="number"||e.type==="integer";return mn(t,o&&e.format==="duration"?"duration":e.type),e.collaborative!==void 0&&(e.type==="text"||e.type==="string")&&(te(t)[Symbol.for("@graview/core:collaborative")]=e.collaborative?1:0),e.description&&(t=t.check(ue(e.description))),o&&(e.format==="money"||e.format==="percent"||!e.format&&e.unit)&&tn(t,{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{}}),a?ne(t):t}var ae=e=>{throw new U(`there is no record "${e}"`,"invalid")},Sn=(e,a)=>"field"in e?vn(e.field,e.optional,a):"ref"in e?rn(e.ref):ne(Ze()),En=new WeakMap;var Ee=(e,a)=>V(a)&&Object.keys(e??{}).length===Object.keys(a).length&&Object.keys(e??{}).every(n=>Object.hasOwn(a,n));function dt(e,a={}){let n=V(e)?e.format:void 0;if(n!==bn)return{ok:!1,findings:[ze("compiled-format","format",n===void 0?"this is not a compiled Graview app":`this compiled app is ${JSON.stringify(n)}, and this build reads ${bn}`,"compile the document instead")]};let t=e,o=kn(t.document).document,l=o===t.document?t:{...t,document:o},m=V(o)&&typeof o.name=="string"&&V(o.kinds)&&Ee(o.kinds,l.kinds)&&Ee(o.acts,l.acts)&&Ee(o.rules,l.rules)&&Array.isArray(l.edges)&&Array.isArray(l.findings),v={ok:!1,findings:[ze("compiled-shape","","this compiled app's parts do not match its document","compile the document instead")]};if(!m)return v;try{return jn(l,a)}catch{return v}}function jn(e,a={}){let{document:n}=e,t=n.brand?.timeZone,o=a.today??(()=>Ie(t)),l=new Map(e.edges.map(([h,r])=>[h,r])),m=new Map;for(let[h,r]of Object.entries(n.kinds)){let z=e.kinds[h]?.computed,R=ve(r.edges);m.set(h,{fields:new Set([...Object.keys(r.fields),...R.keys()]),edges:new Map(Object.entries(we(r.edges)).map(([T,P])=>[T,P.cardinality??"many"])),...z?{computed:new Map(z)}:{},...R.size>0?{linked:R}:{}})}e.facts&&m.set(cn,{computed:new Map(e.facts)});let v=un(n),j=new Map,D=Object.entries(n.kinds).map(([h,r])=>{let z={};for(let[i,g]of Object.entries(r.fields))z[i]=vn(g,!g.required,v),g.repeats&&(z[Je(i)]=ne(Ye()));for(let[i,g]of ve(r.edges))z[i]=ne(yn(g));let{label:R,describe:T,durations:P}=e.kinds[h]??{},M=Object.entries(r.computed??{}).map(([i,g])=>[i,typeof g=="string"?{expr:g}:g]),J=Object.hasOwn(r.fields,"label")&&!r.fields.label.label&&!/\{\s*label\b/.test(r.label??`{${wn(r)??""}}`),_=Object.fromEntries([...J?[["label","Label"]]:[],...Object.entries(r.fields).filter(([,i])=>i.label).map(([i,g])=>[i,g.label]),...M.filter(([,i])=>i.label).map(([i,g])=>[i,g.label])]),A=Object.keys(_).length>0,f=Object.fromEntries(Object.entries(r.fields).filter(([,i])=>i.default!==void 0).map(([i,g])=>[i,g.default]));j.set(h,f);let $=Object.fromEntries(Object.entries(we(r.edges)).map(([i,{renamedFrom:g,...I}])=>[i,I])),S=i=>r[i]?{[i]:r[i]}:{};return qe(h,{fields:he(z),edges:$,...S("plural"),...S("noun"),...S("description"),...R?{label:i=>ie(R,{node:i,kinds:m,today:o(),money:v})||i.id}:{},...T?{describe:i=>ie(T,{node:i,kinds:m,today:o(),money:v})}:{},...S("lifecycle"),...S("figure"),...S("fieldRoles"),...S("people"),archives:r.archives,...r.tidying?{tidying:r.tidying}:{},...M.length>0?{computed:Object.fromEntries(M.map(([i,g])=>[i,P?.includes(i)?{...g,as:"duration"}:r.computed[i]]))}:{},...A||r.glance||r.page?{display:{...A?{labels:_}:{},...r.glance?{glance:[...r.glance]}:{},...r.page?{page:r.page}:{}}}:{},...Object.keys(f).length>0?{defaults:f}:{}})}),B=Qe(D,n.computed);function G(h){return B.tryDefinition(h.kind)?.label?.(h)??h.id}let N=h=>({id:"",kind:h,...j.get(h)}),W=[];for(let[h,r]of Object.entries(n.acts??{})){let z=e.acts[h],{title:R,effects:T,guard:P,refusal:M,destructive:J,idempotent:_,creates:A,connects:f,severs:$,writes:S,writesOther:i,sets:g}=z,I=new Map(z.args),se={};for(let[d,x]of I)se[d]=Sn(x,v);let b=[r.on??[]].flat(),C=new Map(z.exprs),L=T.find(d=>"create"in d),Y=(d,x,p,w=null)=>{if(V(d)&&"expr"in d)return oe(C.get(d.expr),{graph:p,subject:w,kinds:m,bindings:x,today:o()});let k=me(d);return k===void 0?typeof d=="string"&&d.startsWith("$$")?d.slice(1):d:k==="now"?new Date().toISOString():k==="today"?o():x[k]},Te=(d,x)=>{if(!L)return"";let p=n.kinds[L.create].fields,w=N(L.create),k=[];for(let[O,ee]of Object.entries(L.set??{})){try{w[O]=Y(ee,d,x)??w[O]}catch{}let Q=me(ee);Q&&d[Q]!==void 0&&k.push(O)}let Z=G(w).trim(),H=k.filter(O=>w[O]!==!1&&p[O].type!=="text"&&!(/[^]{41}/.test(w[O])||/ .*[.!?]$/.test(w[O])&&!/[ .][A-Z]\w{0,3}\.$/.test(w[O]))&&G({...w,[O]:void 0}).trim()===Z).map(O=>w[O]===!0?p[O].label??Be(O):fn(w[O],p[O].format,o(),[],v));return Z&&H.length>0?`${Z} (${H.join(", ")})`:Z};W.push(nn(h,{input:he(se),title:R,...r.description?{description:r.description}:{},...r.fromTheOtherEnd?{fromTheOtherEnd:r.fromTheOtherEnd}:{},...I.has(q)?{subject:{kinds:b.length>0?b:"*",arg:q}}:{},...J?{destructive:!0}:{},..._?{idempotent:!0}:{},...A.length>0?{creates:A}:{},...f.length>0?{connects:f}:{},...$.length>0?{severs:$}:{},writes:S,...Object.keys(i).length>0?{writesOther:i}:{},...Object.keys(g).length>0?{sets:g}:{},describe:(d,x)=>{let p=typeof d[q]=="string"?x.getNode(d[q]):void 0,w=p?G(p):Te(d,x);return w?`${R}: ${w}`:R},apply(d,x){let p=d.graph,w=typeof x[q]=="string"?x[q]:void 0,k=w?p.getNode(w):void 0;if(w&&!k&&ae(w),k&&b.length>0&&!b.includes(k.kind))throw new U(`"${R}" acts on ${b.join(" or ")}, not on ${_e(k.kind)}`,"invalid");let Z={};for(let[s,c]of Object.entries(x))c!==void 0&&(Z[s]=c);if(P&&k){let s;try{s=oe(P,{graph:p,subject:k,kinds:m,bindings:Z,today:o()})}catch(c){throw c instanceof re?new U(`"${R}" could not be judged: ${c.sentence}`):c}if(s!==!0)throw new U(M?ie(M,{node:k,kinds:m,graph:p,bindings:Z,today:o(),money:v}):`"${R}" is not allowed for ${G(k)} right now`)}let H=new Map,O=s=>p.has(s)||[...H.values()].includes(s),ee=new Set,Q=s=>{let c=Xe(s);ee.has(c)||(ee.add(c),d.removeEdge(s))},X=(s,c)=>{let u=me(s);if(u==="subject")return w;if(u==="me"){let y=d.me;if(y&&n.kinds[p.getNode(y)?.kind]?.people)return y;throw new U(`"${R}" is done as you, and you have no record here`)}if(H.has(u))return H.get(u);try{return Y(s,Z,p,c??k??null)}catch(y){throw y instanceof re?new U(`"${R}" could not work out a value: ${y.sentence}`):y}};for(let s of T)if("create"in s){let c=n.kinds[s.create],u=N(s.create);for(let[ye,de]of Object.entries(s.set??{})){let $e=X(de,void 0);$e!==void 0&&(u[ye]=$e)}let y=wn(c),E=d.freshId(String((y&&u[y])??s.create),s.create);d.addNode({...u,id:E}),s.as&&H.set(s.as,E)}else if("connect"in s||"sever"in s){let c="connect"in s?s.connect:s.sever,u=String(X(s.from,void 0)??""),y=String(X(s.to,void 0)??"");if(O(u)||ae(u),O(y)||ae(y),"connect"in s){if(l.get(c)?.cardinality==="one")for(let E of p.out(u,c))E.id!==y&&Q({kind:c,from:u,to:E.id});p.out(u,c).some(E=>E.id===y)||d.addEdge({kind:c,from:u,to:y})}else Q({kind:c,from:u,to:y})}else if("set"in s){let c=String(X(s.target??"$subject",void 0)??""),u=p.getNode(c);!u&&!O(c)&&ae(c);let y={};for(let[E,ye]of Object.entries(s.set)){let de=X(ye,u);de!==void 0&&(y[E]=de)}Object.keys(y).length>0&&d.patchNode(c,y)}else if("remove"in s){let c=String(X(s.remove,void 0)??"");p.has(c)||ae(c),d.removeNode(c)}else if("replace"in s&&k){let c=x.to;for(let u of s.replace){let y=l.get(u)?.from.includes(k.kind)??!0;for(let E of y?p.out(k.id,u):p.in(k.id,u))u===s.keep&&E.id===c||Q(y?{kind:u,from:k.id,to:E.id}:{kind:u,from:E.id,to:k.id})}}}}))}let je=[];for(let[h,r]of Object.entries(n.rules??{})){let{title:z,require:R,when:T,says:P}=e.rules[h],M=r.repairs??[],J=(A,f,$=o(),S)=>{let i=[],g={graph:A,subject:f,kinds:m,today:$,...S?{linked:S}:{},onUnread:b=>i.push(b)},I;try{if(T&&oe(T,g)!==!0)return[];if(I=oe(R,g)===!0,!I&&i.length>0)throw new re(`it reads ${dn(i[0])}`,0)}catch(b){throw b instanceof ln?new en(b.sentence):b instanceof re?new Error(b.sentence):b}if(I)return[];let se=M.flatMap(b=>{let C=n.acts?.[b.act],L={},Y=f&&C?.on&&C.fromTheOtherEnd&&![C.on].flat().includes(f.kind)?An(e.acts[b.act].args,f.kind):void 0;Y?L[Y]=f.id:f&&(C?.on||/^(edit|remove|archive|unarchive|merge|skip|detach|split)-/.test(b.act))&&(L[q]=f.id);for(let[x,p]of Object.entries(b.args??{}))L[x]=me(p)==="subject"?f?.id:p;let d=(C?e.acts[b.act].args:[]).filter(([x,p])=>p.required&&L[x]===void 0).map(([x])=>x);return[{mutation:b.act,label:b.label??(Y?C.fromTheOtherEnd:C?.title)??b.act.replace(/-/g," "),args:L,...d.length>0?{missing:d}:{}}]});return[{invariant:h,...f?{subjectId:f.id}:{},label:z,message:P?ie(P,{node:f,kinds:m,graph:A,today:$,money:v}):f?`${G(f)}: ${z}`:z,nodeIds:f?[f.id]:[],repairs:se}]},_={label:z,shape:{over:r.over,require:R,when:T,says:P,declared:n.kinds,money:v,kinds:m,today:o},judgment:{require:r.require,...r.when?{when:r.when}:{},...r.says?{says:r.says}:{}},...r.description?{description:r.description}:{},...M.length>0?{repairs:M.map(A=>A.act)}:{}};je.push(r.over==="graph"?xe(h,{scope:"graph",..._,evaluate:({graph:A,today:f,context:$})=>J(A,null,f,$?.linked)}):xe(h,{scope:{kind:r.over},..._,evaluate:({graph:A,subject:f,today:$,context:S})=>J(A,f,$,S?.linked)}))}let De=n.policy&&{...n.policy,...n.roles?{roles:n.roles}:{}},ge={name:n.name,schema:B,mutations:W,invariants:je,...De?{policy:De}:{},...e.brand?{brand:e.brand}:{},...n.modules?{modules:n.modules}:{},...n.lenses?{lenses:n.lenses}:{},...n.pages?{pages:n.pages}:{},...n.settings?{settings:n.settings}:{},...n.connections?{connections:n.connections}:{},...n.forms?{forms:n.forms}:{},...n.publishing?{publishing:n.publishing}:{},...e.viewSpecs?{viewSpecs:e.viewSpecs}:{},...e.home?{home:e.home}:{},version:n.version??1};return hn(ge,n),En.set(ge,e),{ok:!0,app:ge,document:n,findings:e.findings,sights:n.policy?.sees,kinds:m}}export{kn as a,Fn as b,bn as c,q as d,me as e,wn as f,dt as g,jn as h};
@@ -1 +0,0 @@
1
- import{i as n}from"./chunk.MDWCX3YU.js";import"./chunk.CB5DGKR5.js";import"./chunk.GKLDSHHH.js";import"./chunk.OCV46AFN.js";import"./chunk.PZ4G5QA5.js";import"./chunk.Y36MLVMT.js";import"./chunk.MPMROUZA.js";import"./chunk.XZJ6XX5I.js";import"./chunk.4F5M5XZG.js";import"./chunk.LVOL2LEC.js";import"./chunk.3G5DEGFA.js";import"./chunk.OZ4EJ5M6.js";import"./chunk.WVUJXDXZ.js";import{e as p}from"./chunk.3V2WXZU3.js";import"./chunk.7UD2JR6J.js";import"./chunk.BUDEUNBN.js";import"./chunk.3IEJQAK7.js";import"./chunk.AKLVSZ5A.js";import"./chunk.ZUBC3UFG.js";import"./chunk.GZHZLJBF.js";import"./chunk.PZWJUQAO.js";import"./chunk.OJGHDWI6.js";import"./chunk.NEJSKMJV.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import{T as m}from"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as t}from"./chunk.AJZBJBMO.js";var i=t(m(),1),a=new WeakMap;function l(o){let e=a.get(o);if(!e){let r=p(o);e=c=>c.mode==="fullscreen"?(0,i.jsx)(n,{blocks:r,slot:"home",heading:2,firstHeading:1}):(0,i.jsx)(n,{blocks:r,slot:"home",heading:3,firstHeading:2}),a.set(o,e)}return e}export{l as homeView};