graview 0.1.55 → 0.1.57

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 (192) hide show
  1. package/dist/preview/{chunk.XSMXSNDR.js → chunk.2PWVDUOU.js} +1 -1
  2. package/dist/preview/{chunk.AFK5HHLL.js → chunk.33PZEW5A.js} +1 -1
  3. package/dist/preview/{chunk.SUGOENC4.js → chunk.3DPTDMJ7.js} +1 -1
  4. package/dist/preview/chunk.47T3KUAA.js +1 -0
  5. package/dist/preview/{chunk.XUHY4XO2.js → chunk.4BRM5SGO.js} +1 -1
  6. package/dist/preview/{chunk.4TLWZVVG.js → chunk.4HFCOMR3.js} +1 -1
  7. package/dist/preview/{chunk.5MCXTY2P.js → chunk.4HPP35XQ.js} +1 -1
  8. package/dist/preview/chunk.4JDHBNEA.js +104 -0
  9. package/dist/preview/{chunk.QWICAV2C.js → chunk.4K6VAC2S.js} +2 -2
  10. package/dist/preview/{chunk.ZXOD5GM3.js → chunk.4L4F47QP.js} +1 -1
  11. package/dist/preview/{chunk.SIABGHF2.js → chunk.4NPXMYA5.js} +1 -1
  12. package/dist/preview/{chunk.354A4QCG.js → chunk.4OP4IEEY.js} +1 -1
  13. package/dist/preview/chunk.4SBYXHCQ.js +1 -0
  14. package/dist/preview/{chunk.LYVRXRIH.js → chunk.4UQBMFJZ.js} +1 -1
  15. package/dist/preview/{chunk.7WEQHJ3N.js → chunk.4W5GCPAP.js} +1 -1
  16. package/dist/preview/{chunk.TT6GKRBE.js → chunk.4XKRCAJZ.js} +1 -1
  17. package/dist/preview/{chunk.HXHFWZ2U.js → chunk.534TBZJ3.js} +2 -2
  18. package/dist/preview/{chunk.JRRVLGEK.js → chunk.53U6E5LD.js} +1 -1
  19. package/dist/preview/{chunk.HXR7EEXR.js → chunk.547FQPYG.js} +1 -1
  20. package/dist/preview/{chunk.O752PM42.js → chunk.57BKS5KD.js} +1 -1
  21. package/dist/preview/chunk.57KRCHQT.js +1 -0
  22. package/dist/preview/{chunk.KVQZ5FR6.js → chunk.5BPRGXIW.js} +1 -1
  23. package/dist/preview/{chunk.TAQB64FZ.js → chunk.5GTOF5D5.js} +1 -1
  24. package/dist/preview/{chunk.KY7QD22S.js → chunk.5IEFTFKQ.js} +1 -1
  25. package/dist/preview/chunk.5NZDFT6R.js +1 -0
  26. package/dist/preview/{chunk.AFEEXRN3.js → chunk.66LWZIY5.js} +1 -1
  27. package/dist/preview/{chunk.USJ4J3GL.js → chunk.6AH26OL7.js} +2 -2
  28. package/dist/preview/{chunk.PIQ52FCI.js → chunk.6SD7YZ4U.js} +2 -2
  29. package/dist/preview/{chunk.AVVNQKA7.js → chunk.72IHABM5.js} +1 -1
  30. package/dist/preview/chunk.7INWDFNG.js +1 -0
  31. package/dist/preview/{chunk.FUZWXKTN.js → chunk.7IXTNST2.js} +1 -1
  32. package/dist/preview/{chunk.6UAUME5U.js → chunk.7ML2BWSP.js} +1 -1
  33. package/dist/preview/chunk.7UBABS2T.js +1 -0
  34. package/dist/preview/{chunk.CM2ETM2A.js → chunk.7VIFAN3O.js} +1 -1
  35. package/dist/preview/chunk.7VZA34T4.js +1 -0
  36. package/dist/preview/{chunk.EJXUOL2C.js → chunk.AD3EC5DU.js} +1 -1
  37. package/dist/preview/{chunk.BRCKXL7B.js → chunk.BCE6LIDR.js} +1 -1
  38. package/dist/preview/chunk.BPEUHOKH.js +1 -0
  39. package/dist/preview/{chunk.KHJ2MCMS.js → chunk.BUSFJM6P.js} +1 -1
  40. package/dist/preview/{chunk.2HANQ737.js → chunk.BZEJM2PY.js} +1 -1
  41. package/dist/preview/{chunk.YGZGMRDC.js → chunk.C5EFUODO.js} +1 -1
  42. package/dist/preview/{chunk.ATXSLBE3.js → chunk.C7EJPV2N.js} +1 -1
  43. package/dist/preview/chunk.CMLNBJZG.js +3 -0
  44. package/dist/preview/{chunk.NXM73RZA.js → chunk.CUKRUQQ2.js} +1 -1
  45. package/dist/preview/chunk.CXB4BSI4.js +1 -0
  46. package/dist/preview/{chunk.5EOSEVZB.js → chunk.D3LQJXVP.js} +1 -1
  47. package/dist/preview/{chunk.YOBRVKJT.js → chunk.D4EP7FEC.js} +1 -1
  48. package/dist/preview/{chunk.WSMYFEGU.js → chunk.DBMZ3AQB.js} +1 -1
  49. package/dist/preview/chunk.DIFR37EZ.js +5 -0
  50. package/dist/preview/chunk.DJ4A76SX.js +1 -0
  51. package/dist/preview/{chunk.O7RMVGAB.js → chunk.DM5X3JBH.js} +1 -1
  52. package/dist/preview/chunk.DQUISKTC.js +1 -0
  53. package/dist/preview/chunk.DSLGMCB6.js +1 -0
  54. package/dist/preview/chunk.DSWMXM57.js +1 -0
  55. package/dist/preview/{chunk.DB3HOKZD.js → chunk.DWLKJGVT.js} +1 -1
  56. package/dist/preview/{chunk.2KH2LWZL.js → chunk.EQAAKYLA.js} +1 -1
  57. package/dist/preview/{chunk.4OMSQFIY.js → chunk.EXZLG3HK.js} +1 -1
  58. package/dist/preview/{chunk.QJ42D5GM.js → chunk.EZ4NUZWX.js} +1 -1
  59. package/dist/preview/{chunk.WUFCRE7O.js → chunk.EZ4TZUMM.js} +1 -1
  60. package/dist/preview/chunk.FJTWAU7N.js +1 -0
  61. package/dist/preview/{chunk.WVKXELAF.js → chunk.FLMNWVSY.js} +2 -2
  62. package/dist/preview/{chunk.K5WPS4RR.js → chunk.FLVE6IBM.js} +1 -1
  63. package/dist/preview/chunk.FPGU43SC.js +1 -0
  64. package/dist/preview/{chunk.5DPFAVCZ.js → chunk.FRERJWZJ.js} +1 -1
  65. package/dist/preview/{chunk.OT6EWYK2.js → chunk.G3BDQ6EA.js} +1 -1
  66. package/dist/preview/chunk.GBAUQXXD.js +1 -0
  67. package/dist/preview/{chunk.5SANELJT.js → chunk.H5CRRBNU.js} +1 -1
  68. package/dist/preview/{chunk.7Y6NK5CT.js → chunk.HFSG3F5Z.js} +1 -1
  69. package/dist/preview/chunk.I2NI7CT7.js +1 -0
  70. package/dist/preview/{chunk.ZAHVKXYQ.js → chunk.I5PSHASU.js} +1 -1
  71. package/dist/preview/{chunk.TDV7JGIQ.js → chunk.I636CZE4.js} +1 -1
  72. package/dist/preview/chunk.I6H3HRWT.js +1 -0
  73. package/dist/preview/{chunk.62LPYPP3.js → chunk.IRQOJATD.js} +1 -1
  74. package/dist/preview/chunk.IV7AUO53.js +1 -0
  75. package/dist/preview/{chunk.RZQKCLTW.js → chunk.IX63LTRQ.js} +1 -1
  76. package/dist/preview/{chunk.IXHLP2CL.js → chunk.JBSW7ZNH.js} +1 -1
  77. package/dist/preview/chunk.JD5HSAMC.js +18 -0
  78. package/dist/preview/{chunk.ZOW7AC7U.js → chunk.JETT6ELP.js} +1 -1
  79. package/dist/preview/{chunk.LQCH2NFE.js → chunk.JNNBHD4Z.js} +1 -1
  80. package/dist/preview/{chunk.LMXNHBGH.js → chunk.JQFIZRAZ.js} +2 -2
  81. package/dist/preview/chunk.KNYLY7MH.js +1 -0
  82. package/dist/preview/chunk.KO7IOFNY.js +1 -0
  83. package/dist/preview/{chunk.EGSE6NNE.js → chunk.KPIDJYIU.js} +1 -1
  84. package/dist/preview/{chunk.YRFN4VDD.js → chunk.KTV24HY7.js} +1 -1
  85. package/dist/preview/{chunk.6JYNNPAI.js → chunk.KYOI7BG3.js} +1 -1
  86. package/dist/preview/{chunk.PHLMQO7V.js → chunk.LE2KAR25.js} +1 -1
  87. package/dist/preview/{chunk.UE5GAP67.js → chunk.LHIT3EZD.js} +2 -2
  88. package/dist/preview/{chunk.DBCVZGCC.js → chunk.LKJ6FD6Y.js} +1 -1
  89. package/dist/preview/chunk.LUIRQ5UF.js +2 -0
  90. package/dist/preview/chunk.LWRXCO2Z.js +1 -0
  91. package/dist/preview/{chunk.YYWANGIC.js → chunk.M72JKVHP.js} +4 -4
  92. package/dist/preview/{chunk.6NQQUIBX.js → chunk.MAZFQIL5.js} +1 -1
  93. package/dist/preview/{chunk.CPNE6HPQ.js → chunk.MBLFZF5R.js} +1 -1
  94. package/dist/preview/{chunk.PSLCI3GO.js → chunk.MRHPOUA4.js} +1 -1
  95. package/dist/preview/{chunk.PIHCXN5U.js → chunk.MWWOI5PW.js} +1 -1
  96. package/dist/preview/{chunk.35O5H5L7.js → chunk.N2DM42SG.js} +2 -2
  97. package/dist/preview/chunk.N33WUCAN.js +3 -0
  98. package/dist/preview/{chunk.PCKX2FHR.js → chunk.N5MQARN6.js} +1 -1
  99. package/dist/preview/{chunk.G5XTASMO.js → chunk.NF72Z2HG.js} +1 -1
  100. package/dist/preview/{chunk.RNYLNBIB.js → chunk.NGK6IRV3.js} +1 -1
  101. package/dist/preview/chunk.NL3AJZ3N.js +1 -0
  102. package/dist/preview/chunk.NUS5K56R.js +21 -0
  103. package/dist/preview/{chunk.XTP5DGPJ.js → chunk.NX7CR4AE.js} +1 -1
  104. package/dist/preview/chunk.NZDWXX6H.js +1 -0
  105. package/dist/preview/{chunk.5L4J2XAI.js → chunk.O47MN7E5.js} +1 -1
  106. package/dist/preview/chunk.OYUDK3LK.js +1 -0
  107. package/dist/preview/chunk.PF5P5YVD.js +1 -0
  108. package/dist/preview/{chunk.V6X3U3JF.js → chunk.PHC2MI4C.js} +1 -1
  109. package/dist/preview/{chunk.U5AX4DD5.js → chunk.PQMMISCQ.js} +1 -1
  110. package/dist/preview/{chunk.TUBAFVV4.js → chunk.Q6OZLBNL.js} +1 -1
  111. package/dist/preview/{chunk.ZPXAKRKG.js → chunk.QMYHXMRV.js} +1 -1
  112. package/dist/preview/chunk.QPL3OXW3.js +1 -0
  113. package/dist/preview/{chunk.V5PAFSWP.js → chunk.QS6YW7UY.js} +1 -1
  114. package/dist/preview/chunk.QUJS63OJ.js +13 -0
  115. package/dist/preview/{chunk.EKP3HQAX.js → chunk.RALAID6N.js} +1 -1
  116. package/dist/preview/chunk.RQX4CQJN.js +1 -0
  117. package/dist/preview/{chunk.PM64C5PX.js → chunk.RVR6FWAF.js} +1 -1
  118. package/dist/preview/{chunk.MFCBAQS3.js → chunk.S5ECRIG5.js} +1 -1
  119. package/dist/preview/{chunk.DNJM6WQO.js → chunk.SAJLIA5M.js} +1 -1
  120. package/dist/preview/{chunk.RPVJ5IXD.js → chunk.TBRXNU6T.js} +1 -1
  121. package/dist/preview/{chunk.Y3BEKXYB.js → chunk.TVURUMU4.js} +1 -1
  122. package/dist/preview/chunk.UBNZDSS7.js +1 -0
  123. package/dist/preview/chunk.UDCDK7XJ.js +4 -0
  124. package/dist/preview/{chunk.6ZJE5M2A.js → chunk.UGOKORIF.js} +1 -1
  125. package/dist/preview/{chunk.NDLQXQV2.js → chunk.UV3U4FRT.js} +1 -1
  126. package/dist/preview/{chunk.QBMIET7P.js → chunk.UWQ3I5OW.js} +1 -1
  127. package/dist/preview/chunk.V6FUYRZI.js +1 -0
  128. package/dist/preview/{chunk.2SWQI4HF.js → chunk.VDS3IOTK.js} +1 -1
  129. package/dist/preview/chunk.VHPGGC2P.js +1 -0
  130. package/dist/preview/chunk.VSGTNYM2.js +1 -0
  131. package/dist/preview/{chunk.FUS2FJS3.js → chunk.VW4JAQCH.js} +1 -1
  132. package/dist/preview/{chunk.OS5EALHY.js → chunk.WASWMHND.js} +1 -1
  133. package/dist/preview/chunk.WYPL2QUA.js +1 -0
  134. package/dist/preview/{chunk.MFOSEOF4.js → chunk.XTBS64IT.js} +1 -1
  135. package/dist/preview/chunk.XVN3CQKH.js +2 -0
  136. package/dist/preview/{chunk.27ZSRO3O.js → chunk.Y3EOGXRS.js} +1 -1
  137. package/dist/preview/chunk.Y4KNR76Z.js +1 -0
  138. package/dist/preview/chunk.YDTXCVBU.js +1 -0
  139. package/dist/preview/{chunk.DH4AC7TC.js → chunk.YPP7FSEZ.js} +1 -1
  140. package/dist/preview/{chunk.FTW3K3G6.js → chunk.YQXA4WAM.js} +2 -2
  141. package/dist/preview/{chunk.4BFJWNVM.js → chunk.YR75TWDV.js} +1 -1
  142. package/dist/preview/{chunk.QIAH7HHO.js → chunk.YS5U3DUX.js} +1 -1
  143. package/dist/preview/chunk.Z5UVYOGC.js +1 -0
  144. package/dist/preview/{chunk.P4ZZSFOQ.js → chunk.ZNXRHOUI.js} +1 -1
  145. package/dist/preview/index.html +50 -50
  146. package/dist/preview/page.js +2 -2
  147. package/package.json +6 -6
  148. package/dist/preview/chunk.2ORJGMRT.js +0 -104
  149. package/dist/preview/chunk.3IZOXNJH.js +0 -1
  150. package/dist/preview/chunk.5D6SIBOK.js +0 -1
  151. package/dist/preview/chunk.5EZDXWOE.js +0 -1
  152. package/dist/preview/chunk.5MSNKSTE.js +0 -1
  153. package/dist/preview/chunk.5XUVCM7X.js +0 -1
  154. package/dist/preview/chunk.6NGSR2ZQ.js +0 -1
  155. package/dist/preview/chunk.7KERB5CH.js +0 -1
  156. package/dist/preview/chunk.AVNOLMCV.js +0 -1
  157. package/dist/preview/chunk.AZ6Q3WT2.js +0 -1
  158. package/dist/preview/chunk.DKJK2MMV.js +0 -2
  159. package/dist/preview/chunk.DU75P3Y7.js +0 -1
  160. package/dist/preview/chunk.DVG47BK3.js +0 -1
  161. package/dist/preview/chunk.DXJFAAOI.js +0 -1
  162. package/dist/preview/chunk.F5RN6YXG.js +0 -4
  163. package/dist/preview/chunk.FVOFTM5J.js +0 -1
  164. package/dist/preview/chunk.G2XDQPE4.js +0 -1
  165. package/dist/preview/chunk.H536YUAZ.js +0 -3
  166. package/dist/preview/chunk.HNJFBI7J.js +0 -1
  167. package/dist/preview/chunk.HUABTCQE.js +0 -1
  168. package/dist/preview/chunk.INBHY3SA.js +0 -1
  169. package/dist/preview/chunk.KIMIPHAI.js +0 -1
  170. package/dist/preview/chunk.KXNWZ33P.js +0 -1
  171. package/dist/preview/chunk.LEPKPNPA.js +0 -1
  172. package/dist/preview/chunk.LLXEWLIP.js +0 -1
  173. package/dist/preview/chunk.LWLI5PI4.js +0 -1
  174. package/dist/preview/chunk.MIQMPOWF.js +0 -2
  175. package/dist/preview/chunk.MNSKBGRM.js +0 -1
  176. package/dist/preview/chunk.MSM6E6JK.js +0 -1
  177. package/dist/preview/chunk.NS6KWKF5.js +0 -1
  178. package/dist/preview/chunk.OIMYSR2J.js +0 -1
  179. package/dist/preview/chunk.OL2N5NUV.js +0 -1
  180. package/dist/preview/chunk.QQ3YWKWU.js +0 -1
  181. package/dist/preview/chunk.R3ZS4QO6.js +0 -18
  182. package/dist/preview/chunk.SG67ID6C.js +0 -1
  183. package/dist/preview/chunk.SYX7AEHU.js +0 -1
  184. package/dist/preview/chunk.T66UK7PQ.js +0 -3
  185. package/dist/preview/chunk.TEE23CVQ.js +0 -1
  186. package/dist/preview/chunk.TZTRGNAA.js +0 -1
  187. package/dist/preview/chunk.UADL2LHO.js +0 -1
  188. package/dist/preview/chunk.URDCHVH3.js +0 -21
  189. package/dist/preview/chunk.WR63RQGU.js +0 -5
  190. package/dist/preview/chunk.XE72DFBV.js +0 -13
  191. package/dist/preview/chunk.XEHLSKHP.js +0 -1
  192. package/dist/preview/chunk.YG2WZO53.js +0 -1
@@ -1,4 +1,4 @@
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 G,b as J}from"./chunk.HXR7EEXR.js";import"./chunk.DKJK2MMV.js";import{a as K}from"./chunk.DU75P3Y7.js";import"./chunk.2SWQI4HF.js";import"./chunk.5D6SIBOK.js";import"./chunk.6UAUME5U.js";import"./chunk.BRCKXL7B.js";import"./chunk.CPNE6HPQ.js";import"./chunk.QQ3YWKWU.js";import{a as S,b as W}from"./chunk.MB7LKKUD.js";import"./chunk.HUABTCQE.js";import"./chunk.DXJFAAOI.js";import"./chunk.5MSNKSTE.js";import"./chunk.KVQZ5FR6.js";import"./chunk.2HANQ737.js";import"./chunk.H536YUAZ.js";import"./chunk.5EZDXWOE.js";import"./chunk.MIQMPOWF.js";import"./chunk.T66UK7PQ.js";import"./chunk.LMXNHBGH.js";import"./chunk.DBCVZGCC.js";import{D as H,E as V,G as ee,Ga as _,Sa as x,T as D,ca as F}from"./chunk.WSMYFEGU.js";import{a as j}from"./chunk.SDO3U72B.js";import{Rc as B,ga as q}from"./chunk.WR63RQGU.js";import"./chunk.FQLNBIQ5.js";import{b}from"./chunk.AJZBJBMO.js";var t=b(ee(),1);var a=b(D(),1);function ae(n){let r=[];return n.applied.length>0&&n.intent&&r.push(`${n.intent}.`),n.unchanged.length>0&&r.push(`${n.unchanged.length} already so.`),n.allOrNothing&&r.push("None of it was kept."),r.join(" ")}var re=_(j(()=>(__graviewPreload(import.meta.url,["./chunk.35O5H5L7.js","./chunk.BJUUSIQY.js","./chunk.BRCKXL7B.js","./chunk.CPNE6HPQ.js","./chunk.EKP3HQAX.js","./chunk.XOZU4OFA.js","./chunk.QQ3YWKWU.js","./chunk.IXHLP2CL.js","./chunk.DXJFAAOI.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.V5PAFSWP.js")))),te=re.part((n,r)=>(0,a.jsx)(n.SeveralAi,{...r}),{quiet:!0});function ne(n){let r=F()?.ai;return!H(r)||!V(r)?null:(0,a.jsx)(t.Suspense,{fallback:null,children:(0,a.jsx)(te,{...n})})}function ge({store:n,chosen:r,principal:d,context:v,via:k,anchor:A,of:g,onChooseAll:E,onClear:m,onActed:Q}){let[U,X]=(0,t.useState)(0);(0,t.useEffect)(()=>n.subscribe(()=>X(e=>e+1)),[n]);let f=r.join(`
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 G,b as J}from"./chunk.547FQPYG.js";import"./chunk.XVN3CQKH.js";import{a as K}from"./chunk.DJ4A76SX.js";import"./chunk.VDS3IOTK.js";import"./chunk.I2NI7CT7.js";import"./chunk.7ML2BWSP.js";import"./chunk.BCE6LIDR.js";import"./chunk.MBLFZF5R.js";import"./chunk.5NZDFT6R.js";import{a as S,b as W}from"./chunk.MB7LKKUD.js";import"./chunk.7INWDFNG.js";import"./chunk.FPGU43SC.js";import"./chunk.V6FUYRZI.js";import"./chunk.5BPRGXIW.js";import"./chunk.BZEJM2PY.js";import"./chunk.CMLNBJZG.js";import"./chunk.RQX4CQJN.js";import"./chunk.LUIRQ5UF.js";import"./chunk.N33WUCAN.js";import"./chunk.JQFIZRAZ.js";import"./chunk.LKJ6FD6Y.js";import{D as H,E as V,G as ee,Ga as _,Sa as x,T as D,ca as F}from"./chunk.DBMZ3AQB.js";import{a as j}from"./chunk.SDO3U72B.js";import{Vc as B,ia as q}from"./chunk.DIFR37EZ.js";import"./chunk.FQLNBIQ5.js";import{b}from"./chunk.AJZBJBMO.js";var t=b(ee(),1);var a=b(D(),1);function ae(n){let r=[];return n.applied.length>0&&n.intent&&r.push(`${n.intent}.`),n.unchanged.length>0&&r.push(`${n.unchanged.length} already so.`),n.allOrNothing&&r.push("None of it was kept."),r.join(" ")}var re=_(j(()=>(__graviewPreload(import.meta.url,["./chunk.N2DM42SG.js","./chunk.BJUUSIQY.js","./chunk.BCE6LIDR.js","./chunk.MBLFZF5R.js","./chunk.RALAID6N.js","./chunk.XOZU4OFA.js","./chunk.5NZDFT6R.js","./chunk.JBSW7ZNH.js","./chunk.FPGU43SC.js","./chunk.RQX4CQJN.js","./chunk.LUIRQ5UF.js","./chunk.N33WUCAN.js","./chunk.JQFIZRAZ.js","./chunk.LKJ6FD6Y.js","./chunk.DBMZ3AQB.js","./chunk.SDO3U72B.js","./chunk.DIFR37EZ.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.QS6YW7UY.js")))),te=re.part((n,r)=>(0,a.jsx)(n.SeveralAi,{...r}),{quiet:!0});function ne(n){let r=F()?.ai;return!H(r)||!V(r)?null:(0,a.jsx)(t.Suspense,{fallback:null,children:(0,a.jsx)(te,{...n})})}function ge({store:n,chosen:r,principal:d,context:v,via:k,anchor:A,of:g,onChooseAll:E,onClear:m,onActed:Q}){let[U,X]=(0,t.useState)(0);(0,t.useEffect)(()=>n.subscribe(()=>X(e=>e+1)),[n]);let f=r.join(`
2
2
  `),{acts:c,withheld:N}=(0,t.useMemo)(()=>G(n,r,{...d?{principal:d}:{},...v?{context:v}:{}}),[n,f,d,v,U]),[O,p]=(0,t.useState)(!1),[l,u]=(0,t.useState)(null),[s,P]=(0,t.useState)(null),h=(0,t.useRef)(null),L=(0,t.useId)(),w=(0,t.useMemo)(()=>[...new Set(r.map(e=>n.graph.getNode(e)?.kind))],[n,f]),Y=w.length===1&&w[0]?`${q(n.schema,w[0],r.length)} chosen`:`${r.length} chosen`,M=typeof matchMedia=="function"&&matchMedia("(pointer: coarse), (max-width: 599px)").matches?2:3,C=c.filter(e=>!e.more),Z=C.slice(0,M),R=[...C.slice(M),...c.filter(e=>e.more)];(0,t.useEffect)(()=>{u(null),p(!1)},[f]),(0,t.useLayoutEffect)(()=>{let e=h.current;if(!e)return;if(typeof e.showPopover=="function"&&!x(e))try{e.showPopover()}catch{}let i=()=>{W(e,A?.()??null),dispatchEvent(new Event(S))};i(),addEventListener("resize",i),addEventListener("scroll",i,!0);let o=typeof ResizeObserver=="function"?new ResizeObserver(i):null;return o?.observe(e),()=>{if(o?.disconnect(),removeEventListener("resize",i),removeEventListener("scroll",i,!0),e.isConnected&&x(e))try{e.hidePopover()}catch{}dispatchEvent(new Event(S))}},[A]);let y=(0,t.useRef)({asking:l,onClear:m});y.current={asking:l,onClear:m},(0,t.useEffect)(()=>{let e=i=>{if(i.key!=="Escape"||i.defaultPrevented)return;let o=document.activeElement;if(!(!(h.current?.contains(o)??!1)&&(o instanceof HTMLTextAreaElement||o instanceof HTMLInputElement&&o.type!=="checkbox"||o instanceof HTMLSelectElement))){if(i.preventDefault(),i.stopPropagation(),y.current.asking){u(null);return}y.current.onClear()}};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]);let T=(e,i={})=>{let o=J(n,{mutation:e.mutation,subject:e.subject,args:{...e.args,...i},label:e.label},r,{...d?{author:d}:{},...k?{via:k}:{},...v?{context:v}:{}});u(null),p(!1),P(o.refused.length>0||o.applied.length===0?o:null),Q(o.refused.map(I=>I.id))},$=e=>{P(null),p(!1),e.open.length>0?u(e):T(e)},z=e=>(0,a.jsxs)("button",{type:"button",className:"graview-several-act","data-testid":"several-act","data-act":e.id,"data-mutation":e.mutation,...e.destructive?{"data-tone":"warn"}:{},"aria-pressed":l?.id===e.id?!0:void 0,onClick:()=>$(e),children:[e.label,e.open.length>0?"\u2026":""]},e.id);return(0,a.jsxs)("div",{ref:h,popover:"manual",role:"region","aria-label":"The chosen records",className:"graview-several-bar","data-testid":"several-bar","data-graview-foot":"","data-graview-overlay":"","data-graview-popover":"","data-graview-offstage":"",style:ie,children:[(0,a.jsx)("style",{children:oe}),(0,a.jsxs)("div",{className:"graview-several-line",children:[(0,a.jsx)("span",{role:"status","aria-live":"polite",className:"graview-several-count","data-testid":"several-count",children:Y}),(0,a.jsxs)("div",{role:"group","aria-label":`What to do with the ${r.length} chosen`,className:"graview-several-acts",children:[Z.map(z),R.length>0?(0,a.jsx)("button",{type:"button",className:"graview-several-act","data-testid":"several-more","aria-expanded":O,"aria-controls":L,onClick:()=>p(e=>!e),children:"More"}):null,E&&g!==void 0&&g>r.length?(0,a.jsxs)("button",{type:"button",className:"graview-several-quiet","data-testid":"several-all",onClick:E,children:["Choose all ",g]}):null,(0,a.jsx)("button",{type:"button",className:"graview-several-quiet","data-testid":"several-clear","aria-keyshortcuts":"Escape",title:"Put the choice down \u2014 Escape",onClick:m,children:"Clear"})]})]}),c.length>0&&r.length>1?(0,a.jsx)(ne,{chosen:r,acts:c,onAct:$}):null,O?(0,a.jsx)("div",{id:L,role:"group","aria-label":"More",className:"graview-several-acts","data-testid":"several-more-acts",children:R.map(z)}):null,c.length===0?(0,a.jsx)("p",{className:"graview-several-said","data-testid":"several-none",children:N.length>0?`Nothing here can be done to all of them by you: ${N[0].message}`:"Nothing can be done to all of these at once."}):null,l?(0,a.jsx)("div",{className:"graview-several-ask",role:"group","aria-label":`${l.label}, for all ${r.length}`,"data-testid":"several-ask",children:(0,a.jsx)(K,{store:n,affordance:l.affordance,onApply:e=>T(l,e),onCancel:()=>u(null)})}):null,s?(0,a.jsxs)("div",{role:"alert",className:"graview-several-said","data-testid":"several-outcome",children:[ae(s),s.refused.length>0?(0,a.jsxs)(a.Fragment,{children:[" ",s.refused.length===1?"One was not changed, and is still chosen:":`${s.refused.length} were not changed, and are still chosen:`,(0,a.jsx)("ul",{"data-testid":"several-refused",children:s.refused.map(e=>(0,a.jsxs)("li",{"data-record":e.id,children:["\u201C",e.label,"\u201D \u2014 ",e.message]},e.id))})]}):null]}):null]})}var ie={position:"fixed",inset:"auto",margin:0,zIndex:B("toast"),boxSizing:"border-box",width:"max-content",height:"auto",bottom:"calc(16px + env(safe-area-inset-bottom, 0px))",left:16,overflow:"visible"},oe=`
3
3
  .graview-several-bar{display:grid;gap:8px;padding:8px 10px;border:1px solid var(--graview-edge);border-radius:var(--graview-radius,12px);background:var(--graview-float);color:var(--graview-ink);box-shadow:var(--graview-lift-high);font-size:.875rem;line-height:1.4;max-height:70vh;overflow:auto}
4
4
  .graview-several-line{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;min-width:0}
@@ -1 +1 @@
1
- import{e as c}from"./chunk.G2XDQPE4.js";import{cc as m}from"./chunk.WR63RQGU.js";function k(e){let n=e.policy?.sees??[];return n.length===0?!0:e.schema.kinds.every(r=>n.some(o=>o.roles==="*"&&!o.own&&!o.via&&o.kinds.includes(r)))}function A(e){let n=e;for(let r=0;r<8&&n?._zod?.def;r+=1){let o=n._zod.def;if(o.type==="enum")return Object.values(o.entries);if(o.type==="literal")return o.values;if(!("innerType"in o))return;n=o.innerType}}var h=(e,n)=>({ok:!1,reason:e,message:n});function b(e,n){return c(e).find(r=>(r.as??r.act)===n)??c(e).find(r=>r.act===n&&r.as===void 0)}var w=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&"href"in e;function S(e,n,r,o,f){let l=b(n,r);if(!l)return h("undeclared",`This view may not ask for \u201C${r}\u201D: its manifest does not name it.`);let u={},g=0;for(let[y,i]of Object.entries(o)){let d=a=>{if(!w(a))return a;let s=typeof a.href=="string"?f?.file(a.href):void 0;if(!s)throw h("malformed",`\u201C${y}\u201D is a file the host did not hand this view: a view hands an act a file the person dropped (event.files), or one a record it was shown holds, as it was handed.`);return f?.dropped(s.href)&&(g+=1),s};try{u[y]=Array.isArray(i)?i.map(d):d(i)}catch(a){return a}}if(!k(e)){let i=e.allMutations().find(s=>s.name===l.act)?.input?.shape??{},d=(s,t)=>w(t)&&typeof t.href=="string"&&f?.dropped(t.href)===!0||m(t)||typeof t=="string"&&f?.shown.has(t)===!0||(A(i[s])?.some(p=>p===t)??!1);if(!(g>0&&Object.entries(u).every(([s,t])=>Array.isArray(t)?t.every(p=>d(s,p)):d(s,t))))return h("press-only","In this app some members may not see some records, so a view's act applies only when you press it.")}return{ok:!0,name:l.act,args:{...u,...l.constants??{}}}}export{k as a,A as b,h as c,b as d,S as e};
1
+ import{e as c}from"./chunk.Z5UVYOGC.js";import{fc as m}from"./chunk.DIFR37EZ.js";function k(e){let n=e.policy?.sees??[];return n.length===0?!0:e.schema.kinds.every(r=>n.some(o=>o.roles==="*"&&!o.own&&!o.via&&o.kinds.includes(r)))}function A(e){let n=e;for(let r=0;r<8&&n?._zod?.def;r+=1){let o=n._zod.def;if(o.type==="enum")return Object.values(o.entries);if(o.type==="literal")return o.values;if(!("innerType"in o))return;n=o.innerType}}var h=(e,n)=>({ok:!1,reason:e,message:n});function b(e,n){return c(e).find(r=>(r.as??r.act)===n)??c(e).find(r=>r.act===n&&r.as===void 0)}var w=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&"href"in e;function S(e,n,r,o,f){let l=b(n,r);if(!l)return h("undeclared",`This view may not ask for \u201C${r}\u201D: its manifest does not name it.`);let u={},g=0;for(let[y,i]of Object.entries(o)){let d=a=>{if(!w(a))return a;let s=typeof a.href=="string"?f?.file(a.href):void 0;if(!s)throw h("malformed",`\u201C${y}\u201D is a file the host did not hand this view: a view hands an act a file the person dropped (event.files), or one a record it was shown holds, as it was handed.`);return f?.dropped(s.href)&&(g+=1),s};try{u[y]=Array.isArray(i)?i.map(d):d(i)}catch(a){return a}}if(!k(e)){let i=e.allMutations().find(s=>s.name===l.act)?.input?.shape??{},d=(s,t)=>w(t)&&typeof t.href=="string"&&f?.dropped(t.href)===!0||m(t)||typeof t=="string"&&f?.shown.has(t)===!0||(A(i[s])?.some(p=>p===t)??!1);if(!(g>0&&Object.entries(u).every(([s,t])=>Array.isArray(t)?t.every(p=>d(s,p)):d(s,t))))return h("press-only","In this app some members may not see some records, so a view's act applies only when you press it.")}return{ok:!0,name:l.act,args:{...u,...l.constants??{}}}}export{k as a,A as b,h as c,b as d,S as e};
@@ -0,0 +1 @@
1
+ import{l as O}from"./chunk.OJGHDWI6.js";import{j as C}from"./chunk.LUIRQ5UF.js";import{G as b,La as G,T as M,ba as w,c as V,ca as I,da as W,x as B}from"./chunk.DBMZ3AQB.js";import{C as D,Qc as _,Rb as F,Rc as L,Xc as j,ac as N}from"./chunk.DIFR37EZ.js";import{b as m}from"./chunk.AJZBJBMO.js";function H(n,e){let t=n.graph.getNode(e);if(!t)return[];let i=t.kind,a=n.schema.tryDefinition(i);if(!a)return[];let c=n.seenFor,u=c?j.keptFrom?.(n,c)?.(t):void 0,o=new Map;for(let r of n.allMutations()){let s=r.subject;if(!s||!(s.kinds==="*"||s.kinds.includes(i)))continue;let l=r.input.shape??{};for(let d of N(r,a)){if(u?.(d))continue;let x=d in l,k=[];for(let h of Object.keys(l)){if(h===s.arg||h===d||X(l[h]))continue;let v=F(r.input).find(S=>S.name===h);k.push({name:h,...v?{kinds:v.kinds}:{},...v?{candidates:v.kinds.includes("*")?n.graph.allNodes().map(S=>S.id):v.kinds.flatMap(S=>n.graph.nodesOfKind(S).map(J=>J.id))}:{},shape:C(r.input,h)})}let Q={field:d,mutation:r.name,title:r.title??r.name,shape:x?C(r.input,d):{type:"unknown"},takesValue:x,alternatives:[],open:k,clearable:x&&(r.clearable?.includes(d)??!1),call:h=>({name:r.name,args:x?{[s.arg]:e,[d]:h}:{[s.arg]:e}})};o.set(d,[...o.get(d)??[],Q])}}return[...o.values()].map(r=>{let s=[...r.filter(d=>d.takesValue),...r.filter(d=>!d.takesValue)],[f,...l]=s;return{...f,alternatives:l}})}function X(n){let e=D(n)?.type;return e==="optional"||e==="default"||e==="nullable"}var R=m(b(),1);function we(n){let{store:e,principal:t}=w(),i=W(),a=(0,R.useMemo)(()=>n===null?[]:H(e,n),[e,n,i]),c=(0,R.useCallback)((u,o,r={})=>{let s=u.call(o);e.apply({name:s.name,args:{...s.args,...r}},{author:t})},[e,t]);return{fields:a,commit:c}}var K=m(b(),1);function Qe(){let{brand:n}=w(),e=n?.kit;return(0,K.useMemo)(()=>_(e),[e])}function Je(n,e){let t=L(n,e),i={...t.color!==void 0?{color:t.color}:{},...t.pattern!==void 0?{pattern:t.pattern}:{},...t.width!==void 0?{width:t.width}:{},...t.cap!==void 0?{cap:t.cap}:{},...t.opacity!==void 0?{opacity:t.opacity}:{}};return{connector:t,style:O(e,{[e]:i})}}var $=m(b(),1);var g=m(M(),1);function Z(n){let e=n?.hint;return typeof e=="string"&&e.length>0?e:void 0}function ee(n){if(n instanceof Error&&n.message)return n.message;let e=String(n);return e==="[object Object]"?"The view threw without a message.":e}var U=class extends $.Component{static contextType=G;state={};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[graview] the ${this.props.view??"view"} of ${this.props.kind} threw while rendering`,e,t.componentStack),this.context?.(e,{module:"@graview/react"})}render(){let{error:e}=this.state;if(!e)return this.props.children;let t=Z(e);return(0,g.jsxs)("div",{role:"alert","data-graview-view-error":this.props.kind,style:{display:"flex",flexDirection:"column",gap:"0.375rem",padding:"var(--graview-pad, 12px)",height:"100%",overflow:"auto",boxSizing:"border-box",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)",font:"var(--graview-font-body, 13px/1.45 system-ui)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,g.jsx)("strong",{style:{color:"var(--graview-warn, #b4462a)"},children:this.props.view?`${this.props.view} could not draw`:"This view could not draw"}),(0,g.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:this.props.kind}),(0,g.jsx)("span",{children:ee(e)}),t?(0,g.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:t}):null]})}};var y=m(b(),1);var q=m(M(),1),A=(0,y.createContext)([]);function tn({sections:n,children:e}){let t=(0,y.useContext)(A),i=(0,y.useMemo)(()=>[...t,...n.filter(a=>!t.includes(a))],[t,n]);return(0,q.jsx)(A.Provider,{value:i,children:e})}function z(){let n=(0,y.useContext)(A),e=I()?.menuSections;return(0,y.useMemo)(()=>e?[...n,...e.filter(t=>!n.includes(t))]:n,[n,e])}function rn(){let n=z();return(0,y.useCallback)(e=>{for(let t of n)try{t(e)?.prepare?.()}catch{}},[n])}function on(n){let e=z();if(n===null||e.length===0)return{start:[],end:[]};let t=e.flatMap(i=>{try{let a=i(n);return a&&((a.items?.length??0)>0||a.render)?[a]:[]}catch{return[]}});return{start:t.filter(i=>i.at==="start"),end:t.filter(i=>i.at!=="start")}}var ne=m(b(),1);function cn(){return w().activity}var P=(n,e)=>n.length*e*.58;var te=156,re=2,E=te-18,oe=7.1,ie=16;function ae(n,e){let t=0,i=E;for(let a of n.split(" ")){let c=e(a),u=i+e(" ")+c;if(u<=E)i=u;else{let o=Math.ceil(c/E)||1;t+=o,i=c-(o-1)*E}}return t}var se=16.25,Y=27,ce=(n,e)=>{let t=Math.ceil(n.length*oe/E);return e?Math.max(Y,Math.ceil(Math.max(t,ae(n,e))*se)+6):Math.max(Y,t*ie+6)};function ln(n,e,t){return n.length===0?0:10+n.reduce((i,a)=>i+ce(a,t),0)+(n.length-1)*re}var de=27,ue=8,pn=4,le=64,fn=n=>Math.max(1,Math.min(ue,n)),mn=n=>n*de+le;var p=m(b(),1);function xn(n,{units:e,target:t=0,legibleAt:i=260}){let[a,c]=(0,p.useState)(e);(0,p.useEffect)(()=>{let o=n.current;if(o===null||typeof ResizeObserver>"u")return;let r=new ResizeObserver(([s])=>{let f=s?.contentRect.width??0;f>0&&c(f)});return r.observe(o),()=>r.disconnect()},[n]);let u=a/e;return{scale:u,width:a,touchable:u*t>=24,legible:a>=i}}function bn(n="--graview-font-body",e="sans-serif"){let t=(0,p.useRef)(void 0),i=(0,p.useMemo)(()=>{if(typeof getComputedStyle!="function"||typeof document>"u")return e;let a=getComputedStyle(document.documentElement).getPropertyValue(n).trim();return a.length>0?a:e},[n,e]);return(0,p.useMemo)(()=>{t.current===void 0&&(t.current=typeof document>"u"?null:document.createElement("canvas").getContext("2d")??null);let a=t.current;return a===null?P:(c,u)=>{a.font=`${u}px ${i}`;let o=a.measureText(c).width;return o>0?o:P(c,u)}},[i])}var wn=(0,p.createContext)(void 0);var T=3;function pe(n){let e=V(n),t=e.focusId;if(!t)return null;if(e.within?.view){let[a]=B(t);if(a)return{at:`screen:${a}`,audience:!0}}return{at:t,audience:!1}}var fe=102,me=32;function En(n,e,t){let i=[],a=new Map,c=new Map,u=0;for(let o of n){let r=pe(o.stop),s=r?e(r.at):null;if(!r||!s){o.name&&i.push({kind:"edge",presence:o,point:{x:t-8,y:fe+u++*me}});continue}if(!o.name){let k=c.get(r.at);c.set(r.at,{n:(k?.n??0)+1,box:s});continue}let f=a.get(r.at)??[];if(f.push(o),a.set(r.at,f),f.length>T)continue;let l=s,d=f.length-1,x=r.audience?{x:l.x+l.width*.5+(d-1)*26,y:l.y+Math.min(l.height,24)}:{x:l.x+l.width*.5-26-d*26,y:l.y+l.height-4};i.push({kind:"person",presence:o,point:x,at:r.at,index:d,of:f.length,audience:r.audience})}for(let[o,r]of a){if(r.length<=T)continue;let s=e(o);s&&i.push({kind:"count",at:o,point:{x:s.x+s.width*.5+2*26+18,y:s.y+s.height-4},n:r.length-T})}for(let[o,{n:r,box:s}]of c)i.push({kind:"count",at:o,point:{x:s.x+s.width*.5+40,y:s.y+s.height-4},n:r});for(let o of n)if(o.name){if(o.robot?.at&&o.robot.mode!=="docked"){let r=e(o.robot.at);r&&i.push({kind:"robot",presence:o,point:{x:r.x+r.width/2+22,y:r.y+r.height-4},mode:o.robot.mode})}if(o.over){let r=e(o.over);r&&i.push({kind:"over",presence:o,box:r})}}return i}export{cn as a,P as b,te as c,re as d,Y as e,ln as f,de as g,pn as h,le as i,fn as j,mn as k,xn as l,bn as m,we as n,Qe as o,Je as p,En as q,U as r,tn as s,rn as t,on as u};
@@ -1,2 +1,2 @@
1
- import{f as k,h,i as b,n as S,o as w,p as I}from"./chunk.35O5H5L7.js";import"./chunk.BJUUSIQY.js";import"./chunk.BRCKXL7B.js";import"./chunk.CPNE6HPQ.js";import"./chunk.EKP3HQAX.js";import"./chunk.XOZU4OFA.js";import"./chunk.QQ3YWKWU.js";import{a as A}from"./chunk.IXHLP2CL.js";import"./chunk.DXJFAAOI.js";import"./chunk.5EZDXWOE.js";import"./chunk.MIQMPOWF.js";import"./chunk.T66UK7PQ.js";import"./chunk.LMXNHBGH.js";import"./chunk.DBCVZGCC.js";import{G as M,T as f}from"./chunk.WSMYFEGU.js";import"./chunk.SDO3U72B.js";import"./chunk.WR63RQGU.js";import"./chunk.FQLNBIQ5.js";import{b as d}from"./chunk.AJZBJBMO.js";var n=d(M(),1);var r=d(f(),1),C="several";function T({chosen:c,acts:p,onAct:N}){let t=A(),u=(0,n.useMemo)(()=>[...c].sort(),[c]),i=u.join(`
1
+ import{f as k,h,i as b,n as S,o as w,p as I}from"./chunk.N2DM42SG.js";import"./chunk.BJUUSIQY.js";import"./chunk.BCE6LIDR.js";import"./chunk.MBLFZF5R.js";import"./chunk.RALAID6N.js";import"./chunk.XOZU4OFA.js";import"./chunk.5NZDFT6R.js";import{a as A}from"./chunk.JBSW7ZNH.js";import"./chunk.FPGU43SC.js";import"./chunk.RQX4CQJN.js";import"./chunk.LUIRQ5UF.js";import"./chunk.N33WUCAN.js";import"./chunk.JQFIZRAZ.js";import"./chunk.LKJ6FD6Y.js";import{G as M,T as f}from"./chunk.DBMZ3AQB.js";import"./chunk.SDO3U72B.js";import"./chunk.DIFR37EZ.js";import"./chunk.FQLNBIQ5.js";import{b as d}from"./chunk.AJZBJBMO.js";var n=d(M(),1);var r=d(f(),1),C="several";function T({chosen:c,acts:p,onAct:N}){let t=A(),u=(0,n.useMemo)(()=>[...c].sort(),[c]),i=u.join(`
2
2
  `),o=(0,n.useMemo)(()=>({on:"selection",ids:u}),[i]),l=(0,n.useMemo)(()=>p.filter(e=>e.open.length===0&&!e.more&&!e.destructive),[p]),g=(0,n.useMemo)(()=>new Map(l.map(e=>[h(e.id),e])),[l]),v=S(t,o,C),[y,x]=(0,n.useState)(null);(0,n.useEffect)(()=>{if(v!==void 0)return;let e=!0;return w(t,o,{by:C,ask:()=>b(t.ai,{store:t.store,target:o,principal:t.principal,interaction:k(),places:t.places,selection:t.selection,...t.place?{place:t.place}:{},shared:l.map(a=>({id:a.id,label:a.label,mutation:a.mutation,args:a.args}))})}).then(a=>{e&&x({key:i,result:a})}),()=>{e=!1}},[i]);let s=v??(y?.key===i?y.result:void 0);if(s===void 0)return(0,r.jsx)("span",{role:"status",className:"graview-several-quiet","data-testid":"several-ai-thinking",style:{textDecoration:"none"},children:"AI: thinking\u2026"});let m=s.offers.filter(e=>e.type!=="act"||g.has(e.id));if(m.length===0)return null;let E=e=>{let a=g.get(e.id);if(a){t.desk.record({...s.interaction,outcome:"accepted",accepted:[e.id]}),N(a);return}I(t,s,e)};return(0,r.jsx)("div",{role:"group","aria-label":"Suggested by AI",className:"graview-several-acts","data-testid":"several-ai",children:m.map(e=>(0,r.jsxs)("button",{type:"button",className:"graview-several-act","data-testid":"several-ai-offer","data-ai-offer":e.id,"data-ai-offer-type":e.type,onClick:()=>E(e),children:[e.label,(0,r.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontWeight:400},children:" \xB7 suggested"})]},e.id))})}export{T as SeveralAi};
@@ -0,0 +1,13 @@
1
+ import{a as I,b as j,c as C,d as F,e as P,f as H,g as B,h as L,j as M}from"./chunk.UDCDK7XJ.js";import"./chunk.AJZBJBMO.js";var Z=0,ee=1,te=2,ne=3,U=1,re=2,G=3,oe=1,ie=3,ae=8,V="~",D=i=>typeof i=="object"&&i!==null&&!Array.isArray(i),W=new Set(["input","select","textarea","option"]),se=new Set(["value","checked","selected"]),$=["aria-label","aria-labelledby","title"],de=i=>$.some(n=>(i.getAttribute(n)??"").trim()!=="");function z(i,n){let u=i.ownerDocument??i,h=n.maxNodes??5e3,y=[],g=new Map,E=new WeakMap,k={dom:i,name:"div",namespace:"html",children:[],id:V};g.set(V,k);let R=0,T=!1,O=new WeakMap,A=new Map,d=new Map,t=e=>{y.push(e),y.length>200&&y.shift(),n.onRefused?.(e)},f=()=>({dom:u.createComment(""),children:[],refused:!0}),x=(e,l)=>{if(e.namespace==="html"&&e.name&&W.has(e.name))return e.dom;if(l?.namespace==="html"&&l.name==="textarea")return l.dom},v=(e,l)=>{let s=e.dom,a=O.get(s)??s.getAttribute("role");if(a===null||!a.split(/\s+/).some(o=>I.includes(o.toLowerCase())))return void O.delete(s);if(de(s)){O.delete(s),s.getAttribute("role")!==a&&s.setAttribute("role",a);return}O.set(s,a),s.removeAttribute("role"),l&&t({reason:"value",element:e.name,name:"role"})},b=()=>{if(d.size===0)return;let e=new Set,l=s=>{for(let a of s.children){if(a.refused||a.text)continue;let o=a.dom.getAttribute("id");o&&e.add(o),l(a)}};l(k);for(let[s,a]of d){if(s.id===void 0||g.get(s.id)!==s){d.delete(s);continue}let o=s.dom;for(let[r,m]of a){let c=m.value.split(/\s+/).filter(w=>w!==""),p=c.filter(w=>!e.has(w));if(c.length>0&&p.length===0){if(m.drawn)continue;m.drawn=!0,o.setAttribute(r,m.value),v(s,!1)}else m.drawn&&(m.drawn=!1,o.removeAttribute(r),t({reason:"reference",element:s.name,name:r,ids:p.length>0?p:c}),v(s,!0))}}},S=(e,l,s,a=!0)=>{let o=e.dom;if(s!=null&&typeof s!="string")return t({reason:"value",element:e.name,name:l});let r=M(e.namespace,e.name,l,s??null,n);if("refused"in r){let w=M(e.namespace,e.name,l,null,n);return"refused"in w||o.removeAttribute(w.name),!("refused"in w)&&w.name==="role"&&O.delete(o),t(r.refused)}for(let w of r.dropped??[])t(w);let m=e.namespace==="html"&&se.has(r.name)&&W.has(e.name),c=o,p=m?r.name==="value"?c.value:r.name==="checked"?c.checked:c.selected:void 0;if(r.name==="role"&&O.delete(o),j.includes(r.name)){let w=d.get(e)??new Map;r.value===null?w.delete(r.name):w.set(r.name,{value:r.value,drawn:!0}),w.size>0?d.set(e,w):d.delete(e)}r.value===null?o.removeAttribute(r.name):o.setAttribute(r.name,r.value),a&&(r.name==="role"||$.includes(r.name))&&v(e,r.name==="role"),n.onAttribute?.(o,r.name),m&&(r.name==="value"&&"value"in c?(c.value=r.value??"",p!==c.value&&n.onFieldSet?.(o)):r.name==="checked"&&"checked"in c?(c.checked=r.value!==null,p!==c.checked&&n.onFieldSet?.(o)):r.name==="selected"&&"selected"in c&&(c.selected=r.value!==null,p!==c.selected&&n.onFieldSet?.(o.parentElement?.closest("select")??o)))},N=e=>{if(!e.refused){R-=1,e.id!==void 0&&g.delete(e.id);for(let l of e.children)N(l)}},_=(e,l)=>{if(!D(e)||typeof e.id!="string"||g.has(e.id))return t({reason:"record"}),f();if(R>=h)return t({reason:"budget"}),T||(T=!0,n.onOverBudget?.()),f();let s=e.id;if(e.type===ae)return f();if(e.type===ie){if(L(l.namespace,l.name))return t({reason:"child",element:l.name}),f();let c=u.createTextNode(String(e.data??"").slice(0,C)),p={dom:c,children:[],text:!0,id:s,parent:l};return g.set(s,p),E.set(c,s),R+=1,p}if(e.type!==oe)return t({reason:"record"}),f();let a=String(e.element);if(L(l.namespace,l.name))return t({reason:"child",element:a}),f();let o=B(a,l.namespace);if("refused"in o)return t(o.refused),f();let r=u.createElementNS(o.namespace==="svg"?P:F,o.name);o.as&&r.setAttribute("data-graview-as",o.as),o.namespace==="html"&&o.name==="img"&&r.setAttribute("referrerpolicy","no-referrer"),o.namespace==="html"&&o.name==="a"&&(r.setAttribute("target","_blank"),r.setAttribute("rel","noopener noreferrer"),r.setAttribute("referrerpolicy","no-referrer"));let m={dom:r,name:o.name,namespace:o.namespace,children:[],id:s,parent:l};if(g.set(s,m),E.set(r,s),R+=1,D(e.attributes)){for(let[c,p]of Object.entries(e.attributes))S(m,c,p,!1);v(m,!0)}if(n.decorate?.(r,o.name,o.namespace),D(e.properties))for(let c of Object.keys(e.properties))t({reason:"attribute",element:o.name,name:c});if(D(e.eventListeners))for(let c of Object.keys(e.eventListeners))e.eventListeners[c]!=null&&t({reason:"attribute",element:o.name,name:`on${c}`});if(Array.isArray(e.children))for(let c of e.children){let p=_(c,m);m.children.push(p),r.appendChild(p.dom)}return m},Q=e=>{if(!Array.isArray(e))return t({reason:"record"});let[l,s]=e,a=typeof s=="string"?g.get(s):void 0;if(!a)return t({reason:"record"});switch(l){case Z:{if(a.text)return t({reason:"record"});let o=Number(e[3]),r=Number.isInteger(o)&&o>=0&&o<=a.children.length?o:a.children.length,m=e[2],c=D(m)&&typeof m.id=="string"?A.get(m.id):void 0,p;c&&c.parent?.namespace===a.namespace&&!L(a.namespace,a.name)?(A.delete(m.id),c.parent=a,p=c):p=_(m,a),a.dom.insertBefore(p.dom,a.children[r]?.dom??null),a.children.splice(r,0,p),a.namespace==="html"&&a.name==="textarea"&&n.onFieldSet?.(a.dom);return}case ee:{let o=Number(e[2]),r=a.children[o];if(!r)return t({reason:"record"});a.children.splice(o,1),r.dom.parentNode?.removeChild(r.dom),r.id!==void 0&&!r.refused?A.set(r.id,r):N(r);return}case te:{if(!a.text)return t({reason:"record"});a.dom.data=String(e[2]??"").slice(0,C);let o=x(a,a.parent);o&&n.onFieldSet?.(o);return}case ne:{if(a===k||a.text)return t({reason:"record"});let o=String(e[2]),r=e[4]??U;return r===re?S(a,o,e[3]):t(r===U||r===G?{reason:"attribute",element:a.name,name:r===G?`on${o}`:o}:{reason:"record"})}default:return t({reason:"record"})}};return{apply(e,l){if(!Array.isArray(e))return t({reason:"record"}),!0;try{for(let s=0;s<e.length;s+=1){if(l&&s%32===0&&l())return!1;Q(e[s])}return!0}finally{for(let s of A.values())N(s);A.clear(),b()}},get refused(){return y},get size(){return R},idOf:e=>E.get(e),elementOf(e){let l=g.get(e);return l&&!l.text&&l!==k?l.dom:void 0},dispose(){for(let e of k.children)N(e);for(k.children.length=0;i.firstChild;)i.removeChild(i.firstChild)}}}var K=["https:","mailto:","tel:"];function X(i){if(!(typeof i!="string"||i.length>2e3||/[\s<>"]/.test(i.trim())||i.trim()!==i))try{let n=new URL(i);return!K.includes(n.protocol)||n.protocol==="https:"&&(n.hostname===""||n.username!==""||n.password!=="")?void 0:n.href}catch{return}}function le(i){let n=new Set,u=h=>{if(typeof h!="string"||!/^(https|mailto|tel):/i.test(h))return;let y=X(h);y&&n.add(y)};for(let h of[...i?.node?[i.node]:[],...i?.nodes??[]])for(let[y,g]of Object.entries(h))y==="id"||y==="kind"||(Array.isArray(g)?g.forEach(u):u(g));return n}function Y(i){return(i??[]).flatMap(n=>{try{let u=new URL(n);return u.protocol==="https:"&&u.hostname!==""&&u.username===""&&u.password===""?[u.origin]:[]}catch{return[]}})}function ce(i,n){let u=X(i);if(u&&(n.handed.has(u)||u.startsWith("https:")&&Y(n.origins).includes(new URL(u).origin)))return u}function ue(i,n){let u=i.length>120?`${i.slice(0,119)}\u2026`:i,h="";try{h=new URL(i).protocol}catch{h=""}if(!K.includes(h))return`The link "${u}" was not drawn: a view links only to an https:, mailto: or tel: address.`;let y=Y(n);return`The link "${u}" was not drawn: it is no address this view was handed. A view links out only to an address a record it was shown holds (a url field), as the record holds it${y.length>0?`, or an https: address on ${y.join(", ")}`:""}; a record or a place of this app is <a data-record> or <a data-place>.`}var fe=`
2
+ :host { display: block; position: relative; contain: layout paint style; isolation: isolate; overflow: clip; min-width: 0; }
3
+ :host(:focus-within) { overflow-clip-margin: var(--graview-ring-reach, 4px); }
4
+ [data-graview-view-root] { display: flow-root; color: var(--graview-ink, CanvasText); font-family: var(--graview-font-body, system-ui, sans-serif); line-height: 1.45; }
5
+ :where([data-graview-view-root]) :where(button) { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; text-align: inherit; appearance: none; cursor: pointer; }
6
+ :where([data-graview-view-root]) :where(a[data-graview-link]) { color: inherit; text-decoration: none; }
7
+ [data-graview-view-root] :is([data-graview-link], [data-graview-press]) { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: rgb(128 128 128 / 0.16); }
8
+ [data-graview-view-root] :focus-visible { outline: max(2px, var(--graview-focus-width, 2px)) solid var(--graview-focus-color, var(--graview-accent, Highlight)) !important; outline-offset: var(--graview-focus-offset, 2px) !important; }
9
+ [data-graview-view-root] [data-graview-ring-inside]:focus-visible { outline-offset: calc(-1 * max(2px, var(--graview-focus-width, 2px))) !important; }
10
+ [data-graview-view-root] .graview-sr { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important; border: 0 !important; overflow: hidden !important; clip-path: inset(50%) !important; white-space: nowrap !important; }
11
+ [data-graview-view-root] a[href]:not([data-graview-link])::after { content: " \u2197" !important; content: " \u2197" / " (opens in a new tab)" !important; }
12
+ @layer graview-motion { @media (prefers-reduced-motion: reduce) { [data-graview-view-root] *, [data-graview-view-root] ::before, [data-graview-view-root] ::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; animation-timeline: auto !important; transition-duration: 1ms !important; scroll-behavior: auto !important; } } }
13
+ `,J=4,me=16;function pe(i){let n=i.ownerDocument.defaultView?.getComputedStyle(i);if(!n)return J;let u=Number.parseFloat(n.outlineWidth)||0,h=Math.max(0,Number.parseFloat(n.outlineOffset)||0);return Math.min(me,Math.max(J,Math.ceil(u+h)))}var ge=new Set(["Enter"," ","Escape","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"]),q=["click","input","change","keydown"];function ke(i,n){let u=i.ownerDocument,h=u.createElement("style");h.setAttribute("data-graview-region",""),h.textContent=fe;let y=u.createElement("style");y.setAttribute("data-graview-view-style","");let g=u.createElement("div");g.setAttribute("data-graview-view-root",""),i.append(h,y,g);let E=z(g,{origin:n.origin,...n.asset?{asset:n.asset}:{},...n.imageOrigins?{imageOrigins:n.imageOrigins}:{},...n.picture?{picture:n.picture}:{},...n.link?{link:n.link}:{},...n.onRefused?{onRefused:n.onRefused}:{},...n.maxNodes!==void 0?{maxNodes:n.maxNodes}:{},...n.onOverBudget?{onOverBudget:n.onOverBudget}:{},decorate:(d,t,f)=>{f==="html"&&t==="button"&&d.setAttribute("type","button"),f==="html"&&(t==="input"||t==="textarea"||t==="select")&&d.setAttribute("autocomplete","off"),n.decorate?.(d,t,f)},...n.onFieldSet?{onFieldSet:n.onFieldSet}:{},...n.onAttribute?{onAttribute:n.onAttribute}:{}}),k=[],R="",T=d=>{for(let t=d.composedPath()[0];t&&t!==g&&t!==i;t=t.parentNode)if(t.nodeType===1&&E.idOf(t)!==void 0)return t},O=d=>{let t=T(d);if(!t||d.type==="keydown"&&!ge.has(d.key))return;let f=n.before?.(d,t,g);if(f===!1)return;let x=t,v=t.namespaceURI==="http://www.w3.org/1999/xhtml"&&["input","select","textarea"].includes(t.localName);n.send({type:"dom-event",target:E.idOf(t),event:d.type,...v?{value:String(x.value??"")}:{},...v&&(x.type==="checkbox"||x.type==="radio")?{checked:x.checked}:{},...d.type==="keydown"?{key:d.key}:{},...f??{}});let b=d.type==="keydown"?d.key:void 0;(b==="Enter"||b===" ")&&t.hasAttribute("data-graview-press")&&d.composedPath()[0]===t&&(d.preventDefault(),n.send({type:"dom-event",target:E.idOf(t),event:"click"}))};for(let d of q)i.addEventListener(d,O);i.addEventListener("toggle",O,!0);let A=typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("overflow-clip-margin","4px");return i.addEventListener("focusin",d=>{let t=d.composedPath()[0],f=i.host;if(!t||t.nodeType!==1||!g.contains(t))return;let x=pe(t);if(A){f.style.setProperty("--graview-ring-reach",`${x}px`);return}let v=f.getBoundingClientRect(),b=t.getBoundingClientRect(),S=x*(f.offsetWidth>0?v.width/f.offsetWidth:1),N=b.left-v.left<S||v.right-b.right<S||b.top-v.top<S||v.bottom-b.bottom<S;t.toggleAttribute("data-graview-ring-inside",N)}),{apply(d,t){let f=i.activeElement,x=f?E.idOf(f):void 0,v=E.apply(d,t);if(x!==void 0&&i.activeElement!==f){let b=E.elementOf(x);b?.isConnected&&typeof b.focus=="function"&&b.focus({preventScroll:!0})}return v},style(d){let t=H(d);k.length=0;for(let f of t.refused)k.push({reason:"css",name:"stylesheet",css:f}),k.length>200&&k.shift();R=t.css,y.textContent=R},renderer:E,get refused(){return[...E.refused,...k]},get css(){return R},dispose(){for(let d of q)i.removeEventListener(d,O);i.removeEventListener("toggle",O,!0),E.dispose(),i.replaceChildren()}}}export{fe as REGION_CSS,ke as createOpenDrawing,le as handedLinks,ce as judgeLink,ue as linkRefusedWords,pe as ringReach};
@@ -1 +1 @@
1
- import{a as f}from"./chunk.QQ3YWKWU.js";import{da as d}from"./chunk.WR63RQGU.js";function S(e){let o=e.indexOf("{"),a=e.indexOf("["),t=a!==-1&&(o===-1||a<o)?a:o;if(t===-1)return;let n=e[t],r=n==="["?"]":"}",i=0,u=!1,l=!1;for(let s=t;s<e.length;s++){let c=e[s];if(u){l?l=!1:c==="\\"?l=!0:c==='"'&&(u=!1);continue}if(c==='"')u=!0;else if(c===n)i+=1;else if(c===r&&(i-=1,i===0))try{return JSON.parse(e.slice(t,s+1))}catch{return}}}function w(e,o){let a;try{a=e.mutation(o.mutation)}catch{return o}let t={...o.args},n=!1;for(let r of f(a.input)){if(r.control!=="node")continue;let i=t[r.name];if(typeof i!="string"||i.length===0||e.graph.getNode(i))continue;let u=i.trim().toLowerCase(),l=[...e.graph.allNodes()].filter(s=>(r.kinds.includes("*")||r.kinds.includes(s.kind))&&d(e.schema.tryDefinition(s.kind),s).trim().toLowerCase()===u);l.length===1&&(t[r.name]=l[0].id,n=!0)}return n?{...o,args:t}:o}function x(e,o,a){let t=a===void 0?null:new Set(a),n=[];for(let r of o){if(typeof r.mutation!="string")continue;let i=!0;try{e.mutation(r.mutation)}catch{i=!1}i?t&&!t.has(r.mutation)&&n.push({proposal:r,why:"not-allowed"}):n.push({proposal:r,why:"unknown"})}return n}function v(e,o,a){let t=a===void 0?null:new Set(a);return o.filter(n=>{if(typeof n.mutation!="string"||t&&!t.has(n.mutation))return!1;try{e.mutation(n.mutation)}catch{return!1}return n.args!==null&&typeof n.args=="object"})}export{S as a,w as b,x as c,v as d};
1
+ import{a as f}from"./chunk.5NZDFT6R.js";import{ga as d}from"./chunk.DIFR37EZ.js";function S(e){let o=e.indexOf("{"),a=e.indexOf("["),t=a!==-1&&(o===-1||a<o)?a:o;if(t===-1)return;let n=e[t],r=n==="["?"]":"}",i=0,u=!1,l=!1;for(let s=t;s<e.length;s++){let c=e[s];if(u){l?l=!1:c==="\\"?l=!0:c==='"'&&(u=!1);continue}if(c==='"')u=!0;else if(c===n)i+=1;else if(c===r&&(i-=1,i===0))try{return JSON.parse(e.slice(t,s+1))}catch{return}}}function w(e,o){let a;try{a=e.mutation(o.mutation)}catch{return o}let t={...o.args},n=!1;for(let r of f(a.input)){if(r.control!=="node")continue;let i=t[r.name];if(typeof i!="string"||i.length===0||e.graph.getNode(i))continue;let u=i.trim().toLowerCase(),l=[...e.graph.allNodes()].filter(s=>(r.kinds.includes("*")||r.kinds.includes(s.kind))&&d(e.schema.tryDefinition(s.kind),s).trim().toLowerCase()===u);l.length===1&&(t[r.name]=l[0].id,n=!0)}return n?{...o,args:t}:o}function x(e,o,a){let t=a===void 0?null:new Set(a),n=[];for(let r of o){if(typeof r.mutation!="string")continue;let i=!0;try{e.mutation(r.mutation)}catch{i=!1}i?t&&!t.has(r.mutation)&&n.push({proposal:r,why:"not-allowed"}):n.push({proposal:r,why:"unknown"})}return n}function v(e,o,a){let t=a===void 0?null:new Set(a);return o.filter(n=>{if(typeof n.mutation!="string"||t&&!t.has(n.mutation))return!1;try{e.mutation(n.mutation)}catch{return!1}return n.args!==null&&typeof n.args=="object"})}export{S as a,w as b,x as c,v as d};
@@ -0,0 +1 @@
1
+ import{E as b,N as w,O as N,P as S,R as O,S as W,W as m}from"./chunk.DIFR37EZ.js";var x=864e5,L=/^(\d{4})-(\d{2})-(\d{2})/,g=e=>String(e).padStart(2,"0"),A=e=>new Date(e).toISOString().slice(0,10),a=e=>Date.UTC(+e.slice(0,4),+e.slice(5,7)-1,+e.slice(8,10)),p=(e,n)=>A(a(e)+n*x),F=e=>new Date(a(e)).getUTCDay();function c(e,n,r){if(!(n>=1&&n<=12&&r>=1&&r<=31))return;let i=`${String(e).padStart(4,"0")}-${g(n)}-${g(r)}`;return A(a(i))===i?i:void 0}function I(e=new Date){let n=N();return n?O(e.getTime(),n):{day:`${e.getFullYear()}-${g(e.getMonth()+1)}-${g(e.getDate())}`,minutes:e.getHours()*60+e.getMinutes()}}var h=e=>/T\d\d:\d\d(:[\d.]+)?(Z|[+-]\d\d:?\d\d)$/.test(e);function l(e){if(typeof e!="string")return;if(h(e)){let i=new Date(e);return Number.isNaN(i.getTime())?void 0:I(i)}let n=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!n||!c(Number(n[1]),Number(n[2]),Number(n[3])))return;let r=e.slice(0,10);return n[4]===void 0?{day:r}:{day:r,minutes:Number(n[4])*60+Number(n[5])}}function D(e,n){if(!n.time)return e.day;let r=e.minutes??9*60;if(!n.instant)return`${e.day}T${g(Math.floor(r/60))}:${g(r%60)}`;let i=N(),[,t,o,d]=L.exec(e.day);return(i?new Date(W(e.day,r,i)):new Date(Number(t),Number(o)-1,Number(d),Math.floor(r/60),r%60)).toISOString().replace(/\.\d{3}Z$/,"Z")}function P(e,n=new Date){let r=S(),i=r;try{i=new Intl.DateTimeFormat(e??b,{timeZoneName:"short",timeZone:r}).formatToParts(n).find(t=>t.type==="timeZoneName")?.value??r}catch{i=r}return{zone:r,short:i}}function z(e,n,r,i){let t=l(n);if(!t)return r;let o=e===void 0?void 0:l(e),d=r===void 0?void 0:l(r),u=s=>a(s.day)+(s.minutes??0)*6e4,f=(s,$)=>{let y=u(s)+$;return{day:A(y),...i.time?{minutes:Math.round(y%x/6e4)}:{}}};return o&&d?D(f(d,u(t)-u(o)),i):d&&u(d)>=u(t)?r:i.time?D(f(t,36e5),i):r}var Y=/^(start|starts|startsAt|startsOn|startAt|begins|from|opens|checkIn)$/i,B=/^(end|ends|endsAt|endsOn|endAt|until|to|finish|finishes|closes|through|checkOut)$/i;function Z(e,n={}){let r=(n.start&&e.includes(n.start)?n.start:void 0)??e.find(t=>Y.test(t)),i=(n.end&&e.includes(n.end)?n.end:void 0)??e.find(t=>t!==r&&B.test(t));return r&&i?{start:r,end:i}:void 0}var C=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],H=["sun","mon","tue","wed","thu","fri","sat"],T="(jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|june?|july?|aug(?:ust)?|sept?(?:ember)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?)",E="(sun(?:day)?|mon(?:day)?|tue(?:s|sday)?|wed(?:nesday)?|thu(?:r|rs|rsday)?|fri(?:day)?|sat(?:urday)?)",_=e=>C.indexOf(e.slice(0,3))+1,M=e=>e===void 0?void 0:e.length===2?2e3+Number(e):Number(e);function U(e){try{let n=new Intl.DateTimeFormat(e,{month:"numeric",day:"numeric"}).formatToParts(0).map(r=>r.type);return n.indexOf("month")<n.indexOf("day")}catch{return!0}}function v(e){let n=(t,o)=>({minutes:o,rest:`${e.slice(0,t.index)} ${e.slice(t.index+t[0].length)}`}),r=/\b(noon|midday)\b/.exec(e);if(r)return n(r,12*60);if(r=/\bmidnight\b/.exec(e),r)return n(r,0);if(r=/\b(\d{1,2})(?::(\d{2}))?\s*([ap])\.?m?\.?(?=\s|$)/.exec(e),r){let t=Number(r[1]),o=Number(r[2]??0);return t<1||t>12||o>59?{rest:e,bad:!0}:n(r,(t%12+(r[3]==="p"?12:0))*60+o)}if(r=/\b(\d{1,2}):(\d{2})\b/.exec(e),r){let t=Number(r[1]),o=Number(r[2]);return t>23||o>59?{rest:e,bad:!0}:n(r,t*60+o)}if(r=/\bat\s+(\d{1,2})\b/.exec(e),r){let t=Number(r[1]);return t>23?{rest:e,bad:!0}:n(r,(t>=1&&t<=7?t+12:t)*60)}let i=/\b(morning|afternoon|evening|tonight)\b/.exec(e);return i?{minutes:{morning:9,afternoon:15,evening:18,tonight:20}[i[1]]*60,rest:i[1]==="tonight"?`${e.slice(0,i.index)} today ${e.slice(i.index+i[0].length)}`:`${e.slice(0,i.index)} ${e.slice(i.index+i[0].length)}`}:{rest:e}}function K(e,n,r){let i=e.replace(/\b(on|at|the|of|this)\b/g," ").replace(/\s+/g," ").trim();if(i==="")return null;if(i==="today"||i==="now")return n;if(i==="tomorrow"||i==="tmrw"||i==="tmr")return p(n,1);if(i==="yesterday")return p(n,-1);if(i==="next week")return p(n,7);let t=/^in (\d{1,3}) (day|days|week|weeks)$/.exec(i);if(t)return p(n,Number(t[1])*(t[2].startsWith("week")?7:1));if(t=new RegExp(`^(next )?${E}$`).exec(i),t){let s=(H.indexOf(t[2].slice(0,3))-F(n)+7)%7;return p(n,t[1]&&s===0?7:s)}if(t=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(i),t)return c(Number(t[1]),Number(t[2]),Number(t[3]));let o=i.replace(new RegExp(`^${E} `),"");t=new RegExp(`^(\\d{1,2})(?:st|nd|rd|th)? ${T}(?: (\\d{4}))?$`).exec(o);let d=t?{date:t[1],month:t[2],year:t[3]}:void 0;t=new RegExp(`^${T} (\\d{1,2})(?:st|nd|rd|th)?(?: (\\d{4}))?$`).exec(o);let u=d??(t?{date:t[2],month:t[1],year:t[3]}:void 0);if(u)return R(n,M(u.year),_(u.month),Number(u.date));if(t=/^(\d{1,2})[/.-](\d{1,2})(?:[/.-](\d{2}|\d{4}))?$/.exec(o),t){let[f,s]=[Number(t[1]),Number(t[2])],[$,y]=U(r)?[f,s]:[s,f];return R(n,M(t[3]),$,y)}}function R(e,n,r,i){if(n!==void 0)return c(n,r,i);let t=Number(e.slice(0,4)),o=c(t,r,i);return o===void 0?c(t+1,r,i):a(e)-a(o)>183*x?c(t+1,r,i):o}function q(e){if(typeof e=="number")return Number.isInteger(e)&&e>=1e3&&e<=9999?String(e):void 0;let n=String(e).trim().toLowerCase().replace(/,/g," ").replace(/\s+/g," ");if(/^\d{4}$/.test(n))return Number(n)>=1e3?n:void 0;let r=(t,o)=>o>=1&&o<=12&&Number(t)>=1e3?`${t}-${String(o).padStart(2,"0")}`:void 0,i=/^(\d{4})[-/](\d{1,2})$/.exec(n);if(i)return r(i[1],Number(i[2]));if(i=/^(\d{1,2})\/(\d{4})$/.exec(n),i)return r(i[2],Number(i[1]));if(i=new RegExp(`^${T}\\.? (\\d{4})$`).exec(n),i)return r(i[2],_(i[1]))}function G(e,n){let r=e.trim();if(h(r)){let u=l(r);if(u)return n.time?u:{day:u.day}}let i=e.toLowerCase().replace(/,/g," ").replace(/(\d{4}-\d{2}-\d{2})t(\d\d:\d\d)(:\d\d(\.\d+)?)?/,"$1 $2").replace(/\s+/g," ").trim();if(i==="")return;let t=v(i);if(t.bad)return;let o=K(t.rest,n.today,n.locale??b);if(o===void 0||o===null&&t.minutes===void 0)return;let d=o??n.base?.day??n.today;return n.time?{day:d,minutes:t.minutes??n.base?.minutes??9*60}:{day:d}}function J(e){if(e===void 0||e==="web"||e.startsWith("ai:")||e.startsWith("app:"))return;if(e==="api")return"via the API";if(e==="cli")return"via the command line";let[n,...r]=e.split(":"),i=r.join(":");return(n==="mcp"||n==="view")&&i?`via ${i}`:n==="mcp"?"via an agent's tools":`via ${e}`}var j=e=>{if(!e.currency)return{before:!0};try{let n=w(e.locale),r=new Intl.NumberFormat(n,{style:"currency",currency:e.currency}).formatToParts(1),i=r.findIndex(d=>d.type==="currency"),t=r.findIndex(d=>d.type==="integer"),o;try{o=new Intl.DisplayNames([n],{type:"currency"}).of(e.currency)}catch{}return{...i>=0?{symbol:r[i].value}:{},before:i<t,...o?{name:o}:{}}}catch{return{symbol:e.currency,before:!0}}};function Q(e){let n=e.locale;if(e.format==="money"){let{symbol:r,before:i,name:t}=j(e),o=m(1250,n,{minimumFractionDigits:2,maximumFractionDigits:2});return{...r?i?{prefix:r}:{suffix:r}:{},placeholder:o,hint:t?`in ${t}`:e.currency?`in ${e.currency}`:"an amount of money"}}return e.format==="percent"?{suffix:"%",placeholder:m(15,n),hint:"as a percent"}:{...e.unit?{suffix:e.unit}:{},placeholder:"",hint:e.unit?`in ${e.unit}`:"a number"}}function V(e,n){return e===void 0||!Number.isFinite(e)?"":n.format==="money"?m(e,n.locale,Number.isInteger(e)?{maximumFractionDigits:0}:{minimumFractionDigits:2,maximumFractionDigits:2}):n.format==="percent"?m(e*100,n.locale,{maximumFractionDigits:4}):m(e,n.locale,{maximumFractionDigits:6})}function X(e){try{let n=new Intl.NumberFormat(w(e)).formatToParts(12345.6);return{group:n.find(r=>r.type==="group")?.value??",",decimal:n.find(r=>r.type==="decimal")?.value??"."}}catch{return{group:",",decimal:"."}}}function k(e,n){let{group:r,decimal:i}=X(n),t=e.replace(/[\s  ']/g,"").replace(/[−–]/g,"-");if(i!=="."&&!t.includes(i)&&/^-?\d+\.\d{1,2}$/.test(t))return Number(t);if(r&&(t=t.split(r).join("")),i!=="."&&(t=t.replace(i,".")),!/^-?(\d+\.?\d*|\.\d+)$/.test(t))return;let o=Number(t);return Number.isFinite(o)?o:void 0}function ee(e,n){let r=e.trim();if(r==="")return;let i=n?.format==="money"&&n.currency?j(n).symbol:void 0,t=r;i&&(t=t.split(i).join("")),n?.currency&&(t=t.replace(new RegExp(n.currency,"gi"),"")),t=t.replace(/^[$€£¥₹]|[$€£¥₹]$/g,""),/%\s*$/.test(t)&&(t=t.replace(/%\s*$/,"")),n?.unit&&n.format!=="money"&&(t=t.replace(new RegExp(`\\s*${n.unit.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*$`),""));let d=k(t,n?.locale);if(d!==void 0)return n?.format==="percent"?d/100:d}export{J as a,Q as b,V as c,ee as d,I as e,h as f,l as g,D as h,P as i,z as j,Z as k,q as l,G as m};
@@ -1,4 +1,4 @@
1
- import{a as z,b as Y,d as ee}from"./chunk.G2XDQPE4.js";import"./chunk.5XUVCM7X.js";import{bc as J,da as Q,ha as U,ma as X,qa as _}from"./chunk.WR63RQGU.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";function ce(t){let r=t?.indexOf(":")??-1;if(!(!t||r<=0||r===t.length-1))return{relation:t.slice(0,r),record:t.slice(r+1)}}function ne(t,r){if(t.length===0)return!0;let d=`${r.split("/")[0]}/*`;return t.some(a=>a==="*"||a==="*/*"||a===r||a===d)}function re(t,r){let d=r.startsWith("image/")?"image":r.startsWith("video/")?"video":"file";return t.find(a=>a.as===d)??t.find(a=>a.as==="file")}function fe(t,r){let d=new Set(t.map(k=>k.as==="image"?"image/":k.as==="video"?"video/":""));if(d.has("")||r.kinds.length===0)return r.kinds.join(",");let a=[];for(let k of d){let m=r.kinds.filter(l=>l.startsWith(k));a.push(...m.length>0?m:[`${k}*`])}return a.join(",")}var T=t=>t.input?.shape??{},ie=(t,r)=>T(t)[r]?.safeParse(void 0).success===!1;function ae(t,r){let d=new Set(z(t.input).map(a=>a.name));return Object.keys(T(t)).filter(a=>!r.has(a)&&!d.has(a)&&ie(t,a)&&T(t)[a].safeParse("a name").success&&!T(t)[a].safeParse(1).success)}var ue=t=>t.replace(/\.[a-z0-9]{1,5}$/i,"")||t,se=(t,r)=>{let d=Number.isFinite(Date.parse(r))?new Date(Date.parse(r)).toISOString():r;return[r,d,d.replace(/\.\d{3}Z$/,"Z"),r.slice(0,10)].find(a=>t.safeParse(a).success)},pe="2026-01-01T00:00:00.000Z";function te(t,r){let d=T(t),a=new Set(ae(t,r)),k=Object.keys(d).filter(l=>!r.has(l)&&!a.has(l)&&ie(t,l)),m=k.filter(l=>se(d[l],pe)!==void 0);return{timed:m,left:k.filter(l=>!m.includes(l))}}function oe(t,r,d,a,k){let m=e=>({ok:!1,says:e}),{kind:l}=a,R=(d.accepts??[]).filter(e=>e.kind===l&&(a.field===void 0||e.field===a.field));if(R.length===0)return m(a.field===void 0?`The view's accepts names no field of "${l}", so nothing dropped there can become one.`:`The view's accepts does not name ${l}'s "${a.field}".`);let A=k.files;if(!A||!(A.maxBytes>0))return m("This host takes no files.");let j=R.flatMap(e=>{let n=ee(t,e.kind,e.field);return n?[{field:e.field,...n}]:[]}),w=j.filter(e=>e.as==="file"||A.kinds.length===0||A.kinds.some(n=>n==="*"||n==="*/*"||n.startsWith(e.as==="image"?"image/":"video/")));if(w.length===0)return m(`This host takes none of what ${l}'s ${j.map(e=>`"${e.field}"`).join(" or ")} holds.`);let c=a.connect===void 0?void 0:ce(a.connect);if(a.connect!==void 0&&(!c||k.shown.has(a.connect)))return m(`data-drop-connect is "<relation>:<record id>", not "${a.connect}".`);if(c&&!k.shown.has(c.record))return m(`data-drop-connect names "${c.record}", which this view was not shown.`);let g=c?t.seenBy(r).graph.getNode(c.record):void 0;if(c&&!g)return m(`data-drop-connect names "${c.record}", which this seat does not see.`);let $=e=>Object.hasOwn(t.schema.tryDefinition(e)?.edges??{},c.relation),E=c?$(l):!1;if(c&&!E&&!$(g.kind))return m(`Neither a "${l}" nor a "${g.kind}" has the relation "${c.relation}".`);let H=t.allMutations(),F=e=>t.permits(e,r).ok,Z=e=>w.every(n=>Object.hasOwn(T(e),n.field)),V=H.filter(e=>(e.creates??[]).includes(l)&&Z(e)),x=X(t.schema.tryDefinition(l),l),O=U(t.schema,l).toLowerCase(),S=g?Q(t.schema.tryDefinition(g.kind),g):void 0,G=e=>`${e===1?`a ${x}`:`${e} ${O}`}${S?` to ${S}`:""}`,K=e=>`Add ${G(e)}`,L=e=>`Added ${G(e)}.`,B=`Drop to add ${O}${S?` to ${S}`:""}.`,N=(e,n,u,v)=>{let I=new Set(Object.keys(n)),D=_(u.at)??v??new Date().toISOString();for(let C of te(e,I).timed)n[C]=se(T(e)[C],D);for(let C of ae(e,I))n[C]=ue(u.name);return n},q=(e,...n)=>new Set([...w.map(u=>u.field),...n,...z(e.input).map(u=>u.name)]),P=(e,...n)=>te(e,q(e,...n)).left,i=(e,n)=>m(`"${e.title??e.name}" asks for ${n.map(u=>`"${u}"`).join(" and ")}, which no dropped file says, so nothing dropped here can become a ${x}.`),o=(e,n)=>e.list?[n]:n,f={ok:!0,kind:l,fields:w,accept:fe(w,A),...c?{connect:c}:{},intent:K,invite:B,added:L};if(!c){let e=V.find(n=>!n.subject&&F({name:n.name,args:{}}));return e?P(e).length>0?i(e,P(e)):{...f,calls:n=>[{name:e.name,args:N(e,{[n.field]:o(w.find(u=>u.field===n.field),n.value)},n.value,n.at)}]}:m(`This seat may not make a "${l}" here.`)}let s=V.find(e=>e.subject&&(e.subject.kinds==="*"||e.subject.kinds.includes(g.kind))&&(e.connects??[]).includes(c.relation)&&F({name:e.name,args:{[e.subject.arg]:c.record}}));if(s){let e=s.subject.arg;return P(s,e).length>0?i(s,P(s,e)):{...f,calls:n=>[{name:s.name,args:N(s,{[e]:c.record,[n.field]:o(w.find(u=>u.field===n.field),n.value)},n.value,n.at)}]}}let p=V.find(e=>!e.subject&&F({name:e.name,args:{}}));if(!p)return m(`This seat may not make a "${l}" here.`);if(P(p).length>0)return i(p,P(p));let y=E?l:g.kind,W=E?g.kind:l,M=H.find(e=>{if(!(e.connects??[]).includes(c.relation)||!e.subject)return!1;let n=e.subject.kinds;if(n!=="*"&&!n.includes(y))return!1;let u=z(e.input).find(v=>v.name!==e.subject.arg&&(v.kinds.includes("*")||v.kinds.includes(W)));return u?F({name:e.name,args:E?{[u.name]:c.record}:{[e.subject.arg]:c.record}}):!1});if(!M)return m(`This seat may not link a "${l}" to ${c.record} by "${c.relation}".`);let h=M.subject.arg,b=z(M.input).find(e=>e.name!==h&&(e.kinds.includes("*")||e.kinds.includes(W))).name;return{...f,calls:(e,n)=>[{name:p.name,args:N(p,{[e.field]:o(w.find(u=>u.field===e.field),e.value)},e.value,e.at)},{name:M.name,args:E?{[h]:J(n*2),[b]:c.record}:{[h]:c.record,[b]:J(n*2)}}]}}var de=t=>t.type.startsWith("image/"),me=t=>t.type.startsWith("video/"),ge=`
1
+ import{a as z,b as Y,d as ee}from"./chunk.Z5UVYOGC.js";import"./chunk.VSGTNYM2.js";import{ec as J,ga as Q,ja as U,oa as X,sa as _}from"./chunk.DIFR37EZ.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";function ce(t){let r=t?.indexOf(":")??-1;if(!(!t||r<=0||r===t.length-1))return{relation:t.slice(0,r),record:t.slice(r+1)}}function ne(t,r){if(t.length===0)return!0;let d=`${r.split("/")[0]}/*`;return t.some(a=>a==="*"||a==="*/*"||a===r||a===d)}function re(t,r){let d=r.startsWith("image/")?"image":r.startsWith("video/")?"video":"file";return t.find(a=>a.as===d)??t.find(a=>a.as==="file")}function fe(t,r){let d=new Set(t.map(k=>k.as==="image"?"image/":k.as==="video"?"video/":""));if(d.has("")||r.kinds.length===0)return r.kinds.join(",");let a=[];for(let k of d){let m=r.kinds.filter(l=>l.startsWith(k));a.push(...m.length>0?m:[`${k}*`])}return a.join(",")}var T=t=>t.input?.shape??{},ie=(t,r)=>T(t)[r]?.safeParse(void 0).success===!1;function ae(t,r){let d=new Set(z(t.input).map(a=>a.name));return Object.keys(T(t)).filter(a=>!r.has(a)&&!d.has(a)&&ie(t,a)&&T(t)[a].safeParse("a name").success&&!T(t)[a].safeParse(1).success)}var ue=t=>t.replace(/\.[a-z0-9]{1,5}$/i,"")||t,se=(t,r)=>{let d=Number.isFinite(Date.parse(r))?new Date(Date.parse(r)).toISOString():r;return[r,d,d.replace(/\.\d{3}Z$/,"Z"),r.slice(0,10)].find(a=>t.safeParse(a).success)},pe="2026-01-01T00:00:00.000Z";function te(t,r){let d=T(t),a=new Set(ae(t,r)),k=Object.keys(d).filter(l=>!r.has(l)&&!a.has(l)&&ie(t,l)),m=k.filter(l=>se(d[l],pe)!==void 0);return{timed:m,left:k.filter(l=>!m.includes(l))}}function oe(t,r,d,a,k){let m=e=>({ok:!1,says:e}),{kind:l}=a,R=(d.accepts??[]).filter(e=>e.kind===l&&(a.field===void 0||e.field===a.field));if(R.length===0)return m(a.field===void 0?`The view's accepts names no field of "${l}", so nothing dropped there can become one.`:`The view's accepts does not name ${l}'s "${a.field}".`);let A=k.files;if(!A||!(A.maxBytes>0))return m("This host takes no files.");let j=R.flatMap(e=>{let n=ee(t,e.kind,e.field);return n?[{field:e.field,...n}]:[]}),w=j.filter(e=>e.as==="file"||A.kinds.length===0||A.kinds.some(n=>n==="*"||n==="*/*"||n.startsWith(e.as==="image"?"image/":"video/")));if(w.length===0)return m(`This host takes none of what ${l}'s ${j.map(e=>`"${e.field}"`).join(" or ")} holds.`);let c=a.connect===void 0?void 0:ce(a.connect);if(a.connect!==void 0&&(!c||k.shown.has(a.connect)))return m(`data-drop-connect is "<relation>:<record id>", not "${a.connect}".`);if(c&&!k.shown.has(c.record))return m(`data-drop-connect names "${c.record}", which this view was not shown.`);let g=c?t.seenBy(r).graph.getNode(c.record):void 0;if(c&&!g)return m(`data-drop-connect names "${c.record}", which this seat does not see.`);let $=e=>Object.hasOwn(t.schema.tryDefinition(e)?.edges??{},c.relation),E=c?$(l):!1;if(c&&!E&&!$(g.kind))return m(`Neither a "${l}" nor a "${g.kind}" has the relation "${c.relation}".`);let H=t.allMutations(),F=e=>t.permits(e,r).ok,Z=e=>w.every(n=>Object.hasOwn(T(e),n.field)),V=H.filter(e=>(e.creates??[]).includes(l)&&Z(e)),x=X(t.schema.tryDefinition(l),l),O=U(t.schema,l).toLowerCase(),S=g?Q(t.schema.tryDefinition(g.kind),g):void 0,G=e=>`${e===1?`a ${x}`:`${e} ${O}`}${S?` to ${S}`:""}`,K=e=>`Add ${G(e)}`,L=e=>`Added ${G(e)}.`,B=`Drop to add ${O}${S?` to ${S}`:""}.`,N=(e,n,u,v)=>{let I=new Set(Object.keys(n)),D=_(u.at)??v??new Date().toISOString();for(let C of te(e,I).timed)n[C]=se(T(e)[C],D);for(let C of ae(e,I))n[C]=ue(u.name);return n},q=(e,...n)=>new Set([...w.map(u=>u.field),...n,...z(e.input).map(u=>u.name)]),P=(e,...n)=>te(e,q(e,...n)).left,i=(e,n)=>m(`"${e.title??e.name}" asks for ${n.map(u=>`"${u}"`).join(" and ")}, which no dropped file says, so nothing dropped here can become a ${x}.`),o=(e,n)=>e.list?[n]:n,f={ok:!0,kind:l,fields:w,accept:fe(w,A),...c?{connect:c}:{},intent:K,invite:B,added:L};if(!c){let e=V.find(n=>!n.subject&&F({name:n.name,args:{}}));return e?P(e).length>0?i(e,P(e)):{...f,calls:n=>[{name:e.name,args:N(e,{[n.field]:o(w.find(u=>u.field===n.field),n.value)},n.value,n.at)}]}:m(`This seat may not make a "${l}" here.`)}let s=V.find(e=>e.subject&&(e.subject.kinds==="*"||e.subject.kinds.includes(g.kind))&&(e.connects??[]).includes(c.relation)&&F({name:e.name,args:{[e.subject.arg]:c.record}}));if(s){let e=s.subject.arg;return P(s,e).length>0?i(s,P(s,e)):{...f,calls:n=>[{name:s.name,args:N(s,{[e]:c.record,[n.field]:o(w.find(u=>u.field===n.field),n.value)},n.value,n.at)}]}}let p=V.find(e=>!e.subject&&F({name:e.name,args:{}}));if(!p)return m(`This seat may not make a "${l}" here.`);if(P(p).length>0)return i(p,P(p));let y=E?l:g.kind,W=E?g.kind:l,M=H.find(e=>{if(!(e.connects??[]).includes(c.relation)||!e.subject)return!1;let n=e.subject.kinds;if(n!=="*"&&!n.includes(y))return!1;let u=z(e.input).find(v=>v.name!==e.subject.arg&&(v.kinds.includes("*")||v.kinds.includes(W)));return u?F({name:e.name,args:E?{[u.name]:c.record}:{[e.subject.arg]:c.record}}):!1});if(!M)return m(`This seat may not link a "${l}" to ${c.record} by "${c.relation}".`);let h=M.subject.arg,b=z(M.input).find(e=>e.name!==h&&(e.kinds.includes("*")||e.kinds.includes(W))).name;return{...f,calls:(e,n)=>[{name:p.name,args:N(p,{[e.field]:o(w.find(u=>u.field===e.field),e.value)},e.value,e.at)},{name:M.name,args:E?{[h]:J(n*2),[b]:c.record}:{[h]:c.record,[b]:J(n*2)}}]}}var de=t=>t.type.startsWith("image/"),me=t=>t.type.startsWith("video/"),ge=`
2
2
  [data-graview-drop-over] { outline: 2px dashed var(--graview-accent, Highlight) !important; outline-offset: 2px !important; background-color: color-mix(in srgb, var(--graview-accent, Highlight) 10%, transparent) !important; }
3
3
  [data-graview-drop-status], [data-graview-drop-refused] { margin: 4px 0 0; font: 0.8125rem/1.4 var(--graview-font-body, system-ui, sans-serif); color: var(--graview-ink-muted, GrayText); }
4
4
  [data-graview-drop-refused] { color: var(--graview-warn, var(--graview-ink, CanvasText)); }
@@ -1 +1 @@
1
- import"./chunk.WVUJXDXZ.js";import{a as k,b as q,c as pe}from"./chunk.HUABTCQE.js";import"./chunk.DXJFAAOI.js";import"./chunk.5MSNKSTE.js";import"./chunk.KVQZ5FR6.js";import"./chunk.2HANQ737.js";import"./chunk.H536YUAZ.js";import"./chunk.GZHZLJBF.js";import{n as me}from"./chunk.OL2N5NUV.js";import"./chunk.OJGHDWI6.js";import"./chunk.5DPFAVCZ.js";import"./chunk.5EZDXWOE.js";import"./chunk.MIQMPOWF.js";import"./chunk.T66UK7PQ.js";import"./chunk.LMXNHBGH.js";import"./chunk.DBCVZGCC.js";import{G as Le,M as S,O as ue,T as ce,ba as ge,ea as he}from"./chunk.WSMYFEGU.js";import"./chunk.SDO3U72B.js";import{Qc as de,ka as oe,na as w,pa as le,ra as E,sa as x,ta as se,ua as Y}from"./chunk.WR63RQGU.js";import"./chunk.FQLNBIQ5.js";import{b as U}from"./chunk.AJZBJBMO.js";var h=U(Le(),1);async function ye(e,n){let i=await createImageBitmap(e);try{let r=Math.min(1,n/Math.max(i.width,i.height)),a=document.createElement("canvas");a.width=Math.max(1,Math.round(i.width*r)),a.height=Math.max(1,Math.round(i.height*r));let l=a.getContext("2d");if(l===null)throw new Error("This browser will not give us a canvas to resize with.");return l.drawImage(i,0,0,a.width,a.height),a}finally{i.close()}}var t=U(ce(),1),Ve=2048,Ie=.85;function _(e){return e<1e3?`${e} bytes`:e<1e6?`${Math.round(e/1e3)} KB`:`${(e/1e6).toFixed(e<1e7?1:0)} MB`}function z(e){if(e.type==="application/pdf")return"PDF";let n=/\.([a-z0-9]{2,5})$/i.exec(e.name??"")?.[1];return n?n.toUpperCase():(e.type.split("/")[1]??e.type).replace(/^x-|^vnd\./,"").split(/[.+-]/)[0].toUpperCase()}function ke(e){let n=[...new Set(e.map(i=>i==="image/*"?"pictures":i==="video/*"?"videos":i==="*/*"||i==="*"?"any file":`${z({type:i})} files`))];return n.length<=1?n[0]??"no files":`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`}function Fe(e,n){if(e.length===0)return!0;let i=`${n.split("/")[0]}/*`;return e.some(r=>r==="*"||r==="*/*"||r===n||r===i)}var fe=/^image\/hei[cf]$|\.hei[cf]$/i,be=e=>fe.test(e.type)||fe.test(e.name),De={mov:"video/quicktime",mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",ogv:"video/ogg"},Be=e=>De[/\.([a-z0-9]{2,4})$/i.exec(e)?.[1]?.toLowerCase()??""];async function je(e,n,i){let r=e.name||(i.camera?"photo.jpg":"file"),a=e.type||(be({type:"",name:r})?"image/heic":Be(r)??"application/octet-stream"),l=be({type:a,name:r}),u=a.startsWith("image/")||l;if(i.image&&!u)return{refused:`\u201C${r}\u201D isn\u2019t a picture.`};if(i.video)return a.startsWith("video/")?K({blob:e,name:r,type:a},n):{refused:`\u201C${r}\u201D isn\u2019t a video.`};if(l||u&&/^image\/(jpeg|webp)$/.test(a)&&(i.camera||e.size>n.maxBytes||e.size>15e5))try{let c=await ye(e,Ve),b=await new Promise(p=>c.toBlob(p,"image/jpeg",Ie));if(b)return K({blob:b,name:l?r.replace(/\.hei[cf]$/i,"")+".jpg":r,type:"image/jpeg",width:c.width,height:c.height},n)}catch{if(l&&!Fe(n.kinds,a))return{refused:`\u201C${r}\u201D is a HEIC photo, which this browser can\u2019t turn into a JPEG and this host doesn\u2019t take. Save it as a JPEG and try again.`}}let y={};if(u&&!l)try{let c=await createImageBitmap(e);y={width:c.width,height:c.height},c.close()}catch{}return K({blob:e,name:r,type:a,...y},n)}function K(e,n){return Fe(n.kinds,e.type)?e.blob.size>n.maxBytes?{refused:`\u201C${e.name}\u201D is ${_(e.blob.size)}; this host takes files up to ${_(n.maxBytes)}.`}:e:{refused:`\u201C${e.name}\u201D is a ${z(e)} file; this host takes ${ke(n.kinds)}.`}}async function _e(e,n,i,r=!1){let a;try{a=await n.upload(e.blob,e.name)}catch(u){let s=u instanceof Error&&u.message.trim()?u.message.trim():"the host refused it";return{refused:`\u201C${e.name}\u201D wasn\u2019t kept: ${s}`}}return le(a)?i&&!E(a)?{refused:`\u201C${e.name}\u201D isn\u2019t a picture.`}:r&&!x(a)?{refused:`The host kept \u201C${e.name}\u201D as ${z(a)}, not as a video.`}:{...a,...a.width===void 0&&e.width?{width:e.width}:{},...a.height===void 0&&e.height?{height:e.height}:{}}:{refused:`The host\u2019s answer for \u201C${e.name}\u201D isn\u2019t a file a record can keep.`}}var F="var(--graview-radius, 8px)",P={color:"var(--graview-ink-muted)",fontSize:"0.8125rem"};function Z(e){let n=S(),i=ue()?.past!=null,[r,a]=(0,h.useState)(!1),l=n?.kept?ze(n,e.href):!0,[,u]=(0,h.useState)(0);return(0,h.useEffect)(()=>{if(typeof l!="object")return;let s=!0;return l.then(()=>s&&u(y=>y+1)),()=>void(s=!1)},[l]),[l===!1||i&&r,()=>a(!0)]}var J=new WeakMap;function ze(e,n){let i=J.get(e)?.get(n);if(i!==void 0)return i;let r;try{r=e.kept(n)}catch{return!0}if(typeof r=="boolean")return r;let a=J.get(e)??new Map;J.set(e,a);let l=Promise.resolve(r).then(u=>u!==!1,()=>!0);return a.set(n,l),l.then(u=>a.set(n,u)),l}function ee({file:e,style:n}){return(0,t.jsx)("span",{role:"img","aria-label":`${k(e)}, removed later`,"data-graview-removed-later":e.href,style:{display:"grid",placeItems:"center",textAlign:"center",padding:4,boxSizing:"border-box",fontSize:"0.6875rem",lineHeight:1.2,color:"var(--graview-ink-muted)",border:"1px dashed var(--graview-edge-bright)",borderRadius:F,...n},children:"removed later"})}function Q({file:e,size:n=56,style:i}){let r=S(),[a,l]=Z(e);return a?(0,t.jsx)(ee,{file:e,style:{width:n,height:n,flex:"none",...i}}):x(e)?(0,t.jsx)(Ae,{file:e,size:n,...i?{style:i}:{},onError:l}):(0,t.jsx)("img",{onError:l,src:w(r,e.href),alt:k(e),width:n,height:n,loading:"lazy",decoding:"async","data-graview-thumb":e.href,style:{width:n,height:n,objectFit:"cover",borderRadius:F,display:"block",flex:"none",background:"var(--graview-edge)",...i}})}function $e(e){let[n,i]=(0,h.useState)({}),r=e.duration??n.duration;return[{...r!==void 0?{duration:r}:{},width:e.width??n.width,height:e.height??n.height},u=>{let s=u.currentTarget;i({...Number.isFinite(s.duration)&&s.duration>0?{duration:s.duration}:{},...s.videoWidth>0&&s.videoHeight>0?{width:s.videoWidth,height:s.videoHeight}:{}})}]}var Ne=320,xe=(e,n)=>`${k(e)}, ${se({...n!==void 0?{duration:n}:{}})}`,Oe=(0,t.jsx)("span",{"data-graview-play-glyph":"","aria-hidden":"true",style:{position:"absolute",inset:0,display:"grid",placeItems:"center",pointerEvents:"none"},children:(0,t.jsxs)("svg",{viewBox:"0 0 24 24",width:"40%",height:"40%",style:{maxWidth:40,maxHeight:40,filter:"drop-shadow(0 1px 2px rgb(0 0 0 / 0.5))"},children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"11",fill:"rgb(0 0 0 / 0.55)"}),(0,t.jsx)("path",{d:"M9.5 7.5v9l7-4.5z",fill:"#fff"})]})});function Ae({file:e,size:n,style:i,onError:r}){let a=S(),[l,u]=$e(e),s={width:n,height:n,objectFit:"cover",display:"block",borderRadius:F,background:"var(--graview-edge)"};return(0,t.jsxs)("span",{role:"img","aria-label":xe(e,l.duration),"data-graview-thumb":e.href,"data-graview-video-thumb":"",style:{position:"relative",display:"block",width:n,height:n,flex:"none",...i},children:[e.poster?(0,t.jsx)("img",{src:w(a,e.poster),alt:"",width:n,height:n,loading:"lazy",decoding:"async",onError:r,style:s}):(0,t.jsx)("video",{src:w(a,e.href),preload:"metadata",muted:!0,playsInline:!0,"aria-hidden":"true",tabIndex:-1,width:n,height:n,onLoadedMetadata:u,onError:r,style:s}),Oe,l.duration!==void 0?(0,t.jsx)("span",{"data-graview-video-clock":"","aria-hidden":"true",style:{position:"absolute",right:3,bottom:3,padding:"0 4px",borderRadius:4,background:"rgb(0 0 0 / 0.65)",color:"#fff",fontSize:"0.6875rem",lineHeight:"16px",fontVariantNumeric:"tabular-nums"},children:q(l.duration)}):null]})}function Ge({file:e}){let n=S(),[i,r]=Z(e),[a,l]=$e(e);if(i)return(0,t.jsx)(ee,{file:e,style:{width:"100%",aspectRatio:"16 / 9"}});let u=a.width!==void 0&&a.height!==void 0;return(0,t.jsxs)("figure",{"data-graview-video-figure":e.href,style:{margin:0,display:"grid",gap:4,minWidth:0},children:[(0,t.jsx)("video",{"data-graview-video":e.href,src:w(n,e.href),...e.poster?{poster:w(n,e.poster)}:{},controls:!0,preload:"metadata",playsInline:!0,...u?{width:a.width,height:a.height}:{},"aria-label":xe(e,a.duration),onLoadedMetadata:l,onError:r,style:{display:"block",width:"100%",maxWidth:u?Math.max(a.width,Ne):"100%",height:"auto",maxHeight:"80vh",aspectRatio:u?`${a.width} / ${a.height}`:"16 / 9",borderRadius:F,background:"#000"},children:e.captions?(0,t.jsx)("track",{kind:"captions",src:w(n,e.captions),srcLang:"en",label:"Captions",default:!0}):null}),(0,t.jsx)("figcaption",{"data-graview-video-said":"",style:P,children:[e.caption??e.name,...a.duration!==void 0?[q(a.duration)]:[]].join(" \xB7 ")})]})}function Ue({file:e,onOpen:n}){let i=S(),[r,a]=Z(e);return r?(0,t.jsx)(ee,{file:e,style:{width:"100%",aspectRatio:"1"}}):(0,t.jsx)("button",{type:"button","aria-label":`Open ${k(e)} full size`,onClick:l=>n(l.currentTarget),style:{padding:0,border:0,background:"none",cursor:"zoom-in",display:"block",width:"100%",borderRadius:F},children:(0,t.jsx)("img",{src:w(i,e.href),alt:k(e),loading:"lazy",decoding:"async",onError:a,style:{width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:F,display:"block",background:"var(--graview-edge)"}})})}function X({files:e,label:n}){let i=S(),r=d=>w(i,d.href),a=e.filter(E),l=e.filter(x),u=e.filter(d=>!E(d)&&!x(d)),[s,y]=(0,h.useState)(null),c=(0,h.useRef)(null),b=(0,h.useRef)(null);(0,h.useEffect)(()=>{let d=c.current;s!==null&&d&&!d.open&&d.showModal?.()},[s]);let p=s===null?void 0:a[s];return(0,t.jsxs)("div",{style:{display:"grid",gap:10,minWidth:0},children:[a.length>0?(0,t.jsx)("ul",{"data-graview-gallery":"","aria-label":n,style:{listStyle:"none",margin:0,padding:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(96px, 1fr))",gap:8},children:a.map((d,T)=>(0,t.jsx)("li",{style:{minWidth:0},children:(0,t.jsx)(Ue,{file:d,onOpen:R=>{b.current=R,y(T)}})},d.href))}):null,l.length>0?(0,t.jsx)("ul",{"data-graview-videos":"","aria-label":n,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:12},children:l.map(d=>(0,t.jsx)("li",{style:{minWidth:0},children:(0,t.jsx)(Ge,{file:d})},d.href))}):null,u.length>0?(0,t.jsx)("ul",{"data-graview-documents":"",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:10},children:u.map(d=>(0,t.jsxs)("li",{"data-graview-document":d.type,style:{display:"grid",gap:6,minWidth:0},children:[d.type==="application/pdf"?(0,t.jsx)("object",{data:r(d),type:"application/pdf","aria-label":k(d),style:{width:"100%",height:420,border:"1px solid var(--graview-edge)",borderRadius:F},children:(0,t.jsxs)("p",{style:{margin:0,padding:12},children:["This browser shows no PDF here: ",(0,t.jsxs)("a",{href:r(d),download:d.name,children:["download ",d.name]}),"."]})}):null,(0,t.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",gap:"2px 10px",alignItems:"baseline",minWidth:0,overflowWrap:"anywhere"},children:[(0,t.jsx)("a",{href:r(d),download:d.name,...d.type==="application/pdf"?{target:"_blank",rel:"noopener"}:{},children:d.name}),(0,t.jsxs)("span",{style:P,children:[z(d)," \xB7 ",_(d.bytes)]})]}),d.caption?(0,t.jsx)("span",{style:P,children:d.caption}):null]},d.href))}):null,p?(0,t.jsx)("dialog",{ref:c,"data-graview-full":p.href,"aria-label":k(p),onClose:()=>{y(null),b.current?.focus()},onClick:d=>{d.target===d.currentTarget&&d.currentTarget.close()},style:{padding:0,border:0,borderRadius:F,maxWidth:"min(96vw, 1600px)",maxHeight:"94vh",background:"var(--graview-panel)",color:"var(--graview-ink)"},children:(0,t.jsxs)("figure",{style:{margin:0,display:"grid",gap:8,padding:10},children:[(0,t.jsx)("img",{src:r(p),alt:k(p),style:{maxWidth:"100%",maxHeight:"80vh",objectFit:"contain",display:"block",margin:"0 auto"}}),(0,t.jsxs)("figcaption",{style:{display:"flex",gap:12,alignItems:"center",justifyContent:"space-between"},children:[(0,t.jsx)("span",{children:p.caption??p.name}),(0,t.jsx)("form",{method:"dialog",style:{margin:0},children:(0,t.jsx)("button",{type:"submit",autoFocus:!0,children:"Close"})})]})]})}):null]})}function Se({value:e,onChange:n,several:i,image:r,video:a=!1,label:l,thumbs:u=!0}){let s=S(),y=(0,h.useId)(),c=(0,h.useRef)(null),b=(0,h.useRef)(null),[p,d]=(0,h.useState)(null),[T,R]=(0,h.useState)(null),[te,H]=(0,h.useState)([]),[N,O]=(0,h.useState)(!1),W=r?"image/":a?"video/":void 0,C=s?W?s.kinds.filter(o=>o.startsWith(W)||o==="*"||o==="*/*"):s.kinds:[],Pe=s?s.kinds.length===0||C.length>0:!1,Re=!a&&(s?s.kinds.length===0||(r?C:s.kinds).some(o=>o.startsWith("image/")||o.startsWith("*")):!1),ne=!!s&&s.maxBytes>0,L=ne&&(!W||Pe),V=r?"picture":a?"video":"file",ae=i?`${V}s`:`a ${V}`,ie=W?C.length>0?C.join(","):`${W}*`:s?.kinds.join(",")||void 0,We=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,A=(0,h.useRef)(e);A.current=e;let re=(0,h.useRef)(null),I=(0,h.useRef)(null);(0,h.useEffect)(()=>{let o=I.current;if(!o||o.from===e)return;I.current=null;let g=re.current?.children,f=g?.[Math.min(o.at,g.length-1)];((o.what==="move"?f?.querySelector("[data-graview-file-move]"):null)??f?.querySelector("[data-graview-file-remove]")??c.current?.parentElement?.querySelector("[data-graview-file-choose]"))?.focus()});let D=async(o,g)=>{if(!s||o.length===0)return;let f=i?o:o.slice(0,1),m=[],$=[];f.length<o.length&&$.push(`${l} holds one ${V}, so ${o.slice(1).map(v=>`\u201C${v.name||"the photo"}\u201D`).join(", ")} ${o.length>2?"were":"was"} left out.`),H([]),R(null);for(let v of f){d(`Sending ${v.name||"the photo"}\u2026`);let G=await je(v,s,{image:r,video:a,camera:g==="camera"});if("refused"in G){$.push(G.refused);continue}let M=await _e(G,s,r,a);"refused"in M?$.push(M.refused):[...i?A.current:[],...m].some(He=>He.href===M.href)?$.push(`\u201C${M.name}\u201D is already here.`):m.push(M)}if(d(null),H($),m.length!==0)try{n(i?[...A.current,...m]:m.slice(-1)),R(`Added ${m.map(v=>v.name).join(", ")}.`)}catch(v){H([...$,v instanceof Error?v.message:String(v)])}},B=(o,g,f)=>{try{I.current=f?{...f,from:e}:null,n(o),R(g)}catch(m){I.current=null,H([m instanceof Error?m.message:String(m)])}},j=o=>o?Array.from(o):[],Me=o=>{let g=j(o.clipboardData?.files);!L||g.length===0||(o.preventDefault(),D(g,"pasted"))},Te=o=>{O(!1),L&&(o.preventDefault(),D(j(o.dataTransfer?.files),"dropped"))};return(0,t.jsxs)("div",{role:"group","aria-labelledby":`${y}-label`,"data-graview-file-editor":"","data-graview-dropping":N?"":void 0,onPaste:Me,onDragOver:o=>{L&&(o.preventDefault(),O(!0))},onDragLeave:()=>O(!1),onDrop:Te,style:{display:"grid",gap:8,minWidth:0,padding:N?6:0,outline:N?"2px dashed var(--graview-accent)":"none",borderRadius:F},children:[(0,t.jsx)("span",{id:`${y}-label`,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap"},children:l}),e.length>0&&(i||e.length>1)?(0,t.jsx)("ul",{ref:re,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:6},children:e.map((o,g)=>(0,t.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",minWidth:0},children:[u&&(E(o)||x(o))?(0,t.jsx)(Q,{file:o,size:40}):null,(0,t.jsx)("span",{style:{flex:"1 1 8rem",minWidth:0,overflowWrap:"anywhere"},children:o.name}),(0,t.jsx)(we,{file:o,onCaption:f=>B(e.map((m,$)=>$===g?ve(m,f):m),f?`${o.name} now says \u201C${f}\u201D.`:`${o.name} says its name again.`)}),i&&g>0?(0,t.jsx)("button",{type:"button","data-graview-file-move":"","aria-label":`Move ${o.name} earlier`,onClick:()=>B(e.map((f,m)=>m===g-1?o:m===g?e[g-1]:f),`Moved ${o.name} earlier.`,{at:g-1,what:"move"}),children:"\u2191"}):null,i?(0,t.jsx)("button",{type:"button","data-graview-file-remove":"","aria-label":`Remove ${o.name}`,onClick:()=>B(e.filter((f,m)=>m!==g),`Removed ${o.name}.`,{at:g,what:"remove"}),children:"Remove"}):null]},`${g}:${o.href}`))}):e.length===1?(0,t.jsx)(we,{file:e[0],onCaption:o=>B([ve(e[0],o)],o?`${e[0].name} now says \u201C${o}\u201D.`:`${e[0].name} says its name again.`)}):null,L?(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center"},children:[(0,t.jsx)("input",{ref:c,type:"file",hidden:!0,multiple:i,...ie?{accept:ie}:{},"data-graview-file-input":"","aria-label":`Choose ${ae}`,onChange:o=>{let g=j(o.currentTarget.files);o.currentTarget.value="",D(g,"picked")}}),(0,t.jsx)("button",{type:"button",disabled:p!==null,onClick:()=>c.current?.click(),"data-graview-file-choose":"",children:e.length>0&&!i?`Replace the ${V}`:`Choose ${ae}`}),Re?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:b,type:"file",hidden:!0,accept:"image/*",capture:"environment","data-graview-photo-input":"","aria-label":"Take a photo",onChange:o=>{let g=j(o.currentTarget.files);o.currentTarget.value="",D(g,"camera")}}),We?(0,t.jsx)("button",{type:"button",disabled:p!==null,onClick:()=>b.current?.click(),children:"Take a photo"}):null]}):null,(0,t.jsxs)("span",{style:P,"data-graview-file-takes":"",children:["or drop or paste ",i?"them":"it"," here \xB7 ",s.kinds.length>0?ke(C.length>0?C:s.kinds):"any file",", up to ",_(s.maxBytes)]})]}):(0,t.jsx)("p",{style:{...P,margin:0},"data-graview-file-none":"",children:ne?`This host doesn\u2019t take ${a?"videos":"pictures"}, so none can be added here.`:"This host doesn\u2019t take files, so none can be added here."}),(0,t.jsx)("p",{"aria-live":"polite",style:{...P,margin:0,minHeight:p||T?void 0:0},"data-graview-file-status":"",children:p??T??""}),te.length>0?(0,t.jsx)("div",{role:"alert","data-graview-file-refused":"",style:{color:"var(--graview-warn)",fontSize:"0.875rem",display:"grid",gap:2},children:te.map((o,g)=>(0,t.jsx)("p",{style:{margin:0},children:o},g))}):null]})}var ve=(e,n)=>{let{caption:i,...r}=e;return n?{...r,caption:n}:r};function we({file:e,onCaption:n}){let[i,r]=(0,h.useState)(e.caption??"");(0,h.useEffect)(()=>r(e.caption??""),[e.caption]);let a=()=>{let l=i.trim().slice(0,500);l!==(e.caption??"")&&n(l)};return(0,t.jsx)("input",{type:"text",value:i,placeholder:E(e)||x(e)?"What it shows":"What it is","aria-label":`What ${e.name} ${E(e)||x(e)?"shows":"is"}`,"data-graview-file-caption":e.href,onChange:l=>r(l.target.value),onBlur:a,onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),a())},style:{flex:"1 1 10rem",minWidth:0,font:"inherit",fontSize:"0.875rem",minHeight:24}})}function Ee({field:e,label:n,labelStyle:i,valueStyle:r,style:a,children:l}){return(0,t.jsxs)("div",{"data-graview-files":e,style:{display:"grid",gap:6,minWidth:0,gridColumn:"1 / -1",...a},children:[(0,t.jsx)("dt",{style:i,children:n}),(0,t.jsx)("dd",{style:{margin:0,minWidth:0,display:"grid",gap:10,...r},children:l})]})}function Ce(e){let{nodeId:n,field:i,label:r,files:a}=e,{fields:l,commit:u}=me(n),s=l.find(p=>p.field===i&&p.takesValue),y=s?.shape,c=y?.type==="several"?y.of:y,b=y?.type==="several";return a.length===0&&c?.type!=="file"?null:(0,t.jsxs)(Ee,{...e,children:[(0,t.jsx)(X,{files:a,label:r}),s&&c?.type==="file"?(0,t.jsx)(Se,{value:a,thumbs:!1,several:b,image:c.image===!0,video:c.video===!0,label:r,onChange:p=>{let d=b?p:p[p.length-1];d!==void 0&&u(s,d)}}):null]})}function et(e){switch(e.as){case"field":return e.read?e.files.length>0?(0,t.jsx)(Ee,{...e,children:(0,t.jsx)(X,{files:e.files,label:e.label})}):null:(0,t.jsx)(Ce,{...e});case"unfilled":return(0,t.jsx)(Ye,{...e});case"thumb":return(0,t.jsx)(Q,{...e});case"block":return e.files.length>0?(0,t.jsx)("span",{className:"graview-spec-image","data-graview-field":e.field,"data-graview-image":e.view,style:{display:"block",minWidth:0,...e.view==="gallery"?{position:"relative",zIndex:de.raised}:{}},children:e.view==="thumb"?(0,t.jsx)(Q,{file:e.files[0],size:72}):(0,t.jsx)(X,{files:e.files,label:e.label})}):null;case"control":{let n=(0,t.jsx)(Se,{value:Y(e.value),several:e.several,image:e.image,video:e.video===!0,label:e.label,onChange:i=>e.onChange(e.several?i:i[i.length-1])});return e.title===void 0?n:(0,t.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.several?"files":"file",children:[(0,t.jsx)("legend",{"data-graview-part":"label",children:e.title}),n]})}}}function Ye({nodeId:e,skip:n,labels:i,labelStyle:r,style:a}){let{store:l}=ge(),u=he(e),s=u?l.schema.tryDefinition(u.kind):void 0,y=pe(s).filter(c=>!n.includes(c)&&!(s?.display?.hide??[]).includes(c)&&Y(u?.[c]).length===0);return y.length===0?null:(0,t.jsx)("dl",{style:{margin:0,display:"grid",gap:14,minWidth:0},children:y.map(c=>(0,t.jsx)(Ce,{nodeId:e,field:c,label:i?.[c]??oe(s,c),files:[],...r?{labelStyle:r}:{},...a?{style:a}:{}},c))})}export{Se as FilesEditor,Ve as SEND_EDGE,et as drawFiles,ke as kindsWords,je as prepare,_e as send,_ as sizeWords,Fe as takes,z as typeWords};
1
+ import"./chunk.WVUJXDXZ.js";import{a as k,b as q,c as pe}from"./chunk.7INWDFNG.js";import"./chunk.FPGU43SC.js";import"./chunk.V6FUYRZI.js";import"./chunk.5BPRGXIW.js";import"./chunk.BZEJM2PY.js";import"./chunk.CMLNBJZG.js";import"./chunk.GZHZLJBF.js";import{n as me}from"./chunk.QPL3OXW3.js";import"./chunk.OJGHDWI6.js";import"./chunk.FRERJWZJ.js";import"./chunk.RQX4CQJN.js";import"./chunk.LUIRQ5UF.js";import"./chunk.N33WUCAN.js";import"./chunk.JQFIZRAZ.js";import"./chunk.LKJ6FD6Y.js";import{G as Le,M as S,O as ue,T as ce,ba as ge,ea as he}from"./chunk.DBMZ3AQB.js";import"./chunk.SDO3U72B.js";import{Uc as de,ma as oe,pa as w,ra as le,ta as E,ua as x,va as se,wa as Y}from"./chunk.DIFR37EZ.js";import"./chunk.FQLNBIQ5.js";import{b as U}from"./chunk.AJZBJBMO.js";var h=U(Le(),1);async function ye(e,n){let i=await createImageBitmap(e);try{let r=Math.min(1,n/Math.max(i.width,i.height)),a=document.createElement("canvas");a.width=Math.max(1,Math.round(i.width*r)),a.height=Math.max(1,Math.round(i.height*r));let l=a.getContext("2d");if(l===null)throw new Error("This browser will not give us a canvas to resize with.");return l.drawImage(i,0,0,a.width,a.height),a}finally{i.close()}}var t=U(ce(),1),Ve=2048,Ie=.85;function _(e){return e<1e3?`${e} bytes`:e<1e6?`${Math.round(e/1e3)} KB`:`${(e/1e6).toFixed(e<1e7?1:0)} MB`}function z(e){if(e.type==="application/pdf")return"PDF";let n=/\.([a-z0-9]{2,5})$/i.exec(e.name??"")?.[1];return n?n.toUpperCase():(e.type.split("/")[1]??e.type).replace(/^x-|^vnd\./,"").split(/[.+-]/)[0].toUpperCase()}function ke(e){let n=[...new Set(e.map(i=>i==="image/*"?"pictures":i==="video/*"?"videos":i==="*/*"||i==="*"?"any file":`${z({type:i})} files`))];return n.length<=1?n[0]??"no files":`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`}function Fe(e,n){if(e.length===0)return!0;let i=`${n.split("/")[0]}/*`;return e.some(r=>r==="*"||r==="*/*"||r===n||r===i)}var fe=/^image\/hei[cf]$|\.hei[cf]$/i,be=e=>fe.test(e.type)||fe.test(e.name),De={mov:"video/quicktime",mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",ogv:"video/ogg"},Be=e=>De[/\.([a-z0-9]{2,4})$/i.exec(e)?.[1]?.toLowerCase()??""];async function je(e,n,i){let r=e.name||(i.camera?"photo.jpg":"file"),a=e.type||(be({type:"",name:r})?"image/heic":Be(r)??"application/octet-stream"),l=be({type:a,name:r}),u=a.startsWith("image/")||l;if(i.image&&!u)return{refused:`\u201C${r}\u201D isn\u2019t a picture.`};if(i.video)return a.startsWith("video/")?K({blob:e,name:r,type:a},n):{refused:`\u201C${r}\u201D isn\u2019t a video.`};if(l||u&&/^image\/(jpeg|webp)$/.test(a)&&(i.camera||e.size>n.maxBytes||e.size>15e5))try{let c=await ye(e,Ve),b=await new Promise(p=>c.toBlob(p,"image/jpeg",Ie));if(b)return K({blob:b,name:l?r.replace(/\.hei[cf]$/i,"")+".jpg":r,type:"image/jpeg",width:c.width,height:c.height},n)}catch{if(l&&!Fe(n.kinds,a))return{refused:`\u201C${r}\u201D is a HEIC photo, which this browser can\u2019t turn into a JPEG and this host doesn\u2019t take. Save it as a JPEG and try again.`}}let y={};if(u&&!l)try{let c=await createImageBitmap(e);y={width:c.width,height:c.height},c.close()}catch{}return K({blob:e,name:r,type:a,...y},n)}function K(e,n){return Fe(n.kinds,e.type)?e.blob.size>n.maxBytes?{refused:`\u201C${e.name}\u201D is ${_(e.blob.size)}; this host takes files up to ${_(n.maxBytes)}.`}:e:{refused:`\u201C${e.name}\u201D is a ${z(e)} file; this host takes ${ke(n.kinds)}.`}}async function _e(e,n,i,r=!1){let a;try{a=await n.upload(e.blob,e.name)}catch(u){let s=u instanceof Error&&u.message.trim()?u.message.trim():"the host refused it";return{refused:`\u201C${e.name}\u201D wasn\u2019t kept: ${s}`}}return le(a)?i&&!E(a)?{refused:`\u201C${e.name}\u201D isn\u2019t a picture.`}:r&&!x(a)?{refused:`The host kept \u201C${e.name}\u201D as ${z(a)}, not as a video.`}:{...a,...a.width===void 0&&e.width?{width:e.width}:{},...a.height===void 0&&e.height?{height:e.height}:{}}:{refused:`The host\u2019s answer for \u201C${e.name}\u201D isn\u2019t a file a record can keep.`}}var F="var(--graview-radius, 8px)",P={color:"var(--graview-ink-muted)",fontSize:"0.8125rem"};function Z(e){let n=S(),i=ue()?.past!=null,[r,a]=(0,h.useState)(!1),l=n?.kept?ze(n,e.href):!0,[,u]=(0,h.useState)(0);return(0,h.useEffect)(()=>{if(typeof l!="object")return;let s=!0;return l.then(()=>s&&u(y=>y+1)),()=>void(s=!1)},[l]),[l===!1||i&&r,()=>a(!0)]}var J=new WeakMap;function ze(e,n){let i=J.get(e)?.get(n);if(i!==void 0)return i;let r;try{r=e.kept(n)}catch{return!0}if(typeof r=="boolean")return r;let a=J.get(e)??new Map;J.set(e,a);let l=Promise.resolve(r).then(u=>u!==!1,()=>!0);return a.set(n,l),l.then(u=>a.set(n,u)),l}function ee({file:e,style:n}){return(0,t.jsx)("span",{role:"img","aria-label":`${k(e)}, removed later`,"data-graview-removed-later":e.href,style:{display:"grid",placeItems:"center",textAlign:"center",padding:4,boxSizing:"border-box",fontSize:"0.6875rem",lineHeight:1.2,color:"var(--graview-ink-muted)",border:"1px dashed var(--graview-edge-bright)",borderRadius:F,...n},children:"removed later"})}function Q({file:e,size:n=56,style:i}){let r=S(),[a,l]=Z(e);return a?(0,t.jsx)(ee,{file:e,style:{width:n,height:n,flex:"none",...i}}):x(e)?(0,t.jsx)(Ae,{file:e,size:n,...i?{style:i}:{},onError:l}):(0,t.jsx)("img",{onError:l,src:w(r,e.href),alt:k(e),width:n,height:n,loading:"lazy",decoding:"async","data-graview-thumb":e.href,style:{width:n,height:n,objectFit:"cover",borderRadius:F,display:"block",flex:"none",background:"var(--graview-edge)",...i}})}function $e(e){let[n,i]=(0,h.useState)({}),r=e.duration??n.duration;return[{...r!==void 0?{duration:r}:{},width:e.width??n.width,height:e.height??n.height},u=>{let s=u.currentTarget;i({...Number.isFinite(s.duration)&&s.duration>0?{duration:s.duration}:{},...s.videoWidth>0&&s.videoHeight>0?{width:s.videoWidth,height:s.videoHeight}:{}})}]}var Ne=320,xe=(e,n)=>`${k(e)}, ${se({...n!==void 0?{duration:n}:{}})}`,Oe=(0,t.jsx)("span",{"data-graview-play-glyph":"","aria-hidden":"true",style:{position:"absolute",inset:0,display:"grid",placeItems:"center",pointerEvents:"none"},children:(0,t.jsxs)("svg",{viewBox:"0 0 24 24",width:"40%",height:"40%",style:{maxWidth:40,maxHeight:40,filter:"drop-shadow(0 1px 2px rgb(0 0 0 / 0.5))"},children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"11",fill:"rgb(0 0 0 / 0.55)"}),(0,t.jsx)("path",{d:"M9.5 7.5v9l7-4.5z",fill:"#fff"})]})});function Ae({file:e,size:n,style:i,onError:r}){let a=S(),[l,u]=$e(e),s={width:n,height:n,objectFit:"cover",display:"block",borderRadius:F,background:"var(--graview-edge)"};return(0,t.jsxs)("span",{role:"img","aria-label":xe(e,l.duration),"data-graview-thumb":e.href,"data-graview-video-thumb":"",style:{position:"relative",display:"block",width:n,height:n,flex:"none",...i},children:[e.poster?(0,t.jsx)("img",{src:w(a,e.poster),alt:"",width:n,height:n,loading:"lazy",decoding:"async",onError:r,style:s}):(0,t.jsx)("video",{src:w(a,e.href),preload:"metadata",muted:!0,playsInline:!0,"aria-hidden":"true",tabIndex:-1,width:n,height:n,onLoadedMetadata:u,onError:r,style:s}),Oe,l.duration!==void 0?(0,t.jsx)("span",{"data-graview-video-clock":"","aria-hidden":"true",style:{position:"absolute",right:3,bottom:3,padding:"0 4px",borderRadius:4,background:"rgb(0 0 0 / 0.65)",color:"#fff",fontSize:"0.6875rem",lineHeight:"16px",fontVariantNumeric:"tabular-nums"},children:q(l.duration)}):null]})}function Ge({file:e}){let n=S(),[i,r]=Z(e),[a,l]=$e(e);if(i)return(0,t.jsx)(ee,{file:e,style:{width:"100%",aspectRatio:"16 / 9"}});let u=a.width!==void 0&&a.height!==void 0;return(0,t.jsxs)("figure",{"data-graview-video-figure":e.href,style:{margin:0,display:"grid",gap:4,minWidth:0},children:[(0,t.jsx)("video",{"data-graview-video":e.href,src:w(n,e.href),...e.poster?{poster:w(n,e.poster)}:{},controls:!0,preload:"metadata",playsInline:!0,...u?{width:a.width,height:a.height}:{},"aria-label":xe(e,a.duration),onLoadedMetadata:l,onError:r,style:{display:"block",width:"100%",maxWidth:u?Math.max(a.width,Ne):"100%",height:"auto",maxHeight:"80vh",aspectRatio:u?`${a.width} / ${a.height}`:"16 / 9",borderRadius:F,background:"#000"},children:e.captions?(0,t.jsx)("track",{kind:"captions",src:w(n,e.captions),srcLang:"en",label:"Captions",default:!0}):null}),(0,t.jsx)("figcaption",{"data-graview-video-said":"",style:P,children:[e.caption??e.name,...a.duration!==void 0?[q(a.duration)]:[]].join(" \xB7 ")})]})}function Ue({file:e,onOpen:n}){let i=S(),[r,a]=Z(e);return r?(0,t.jsx)(ee,{file:e,style:{width:"100%",aspectRatio:"1"}}):(0,t.jsx)("button",{type:"button","aria-label":`Open ${k(e)} full size`,onClick:l=>n(l.currentTarget),style:{padding:0,border:0,background:"none",cursor:"zoom-in",display:"block",width:"100%",borderRadius:F},children:(0,t.jsx)("img",{src:w(i,e.href),alt:k(e),loading:"lazy",decoding:"async",onError:a,style:{width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:F,display:"block",background:"var(--graview-edge)"}})})}function X({files:e,label:n}){let i=S(),r=d=>w(i,d.href),a=e.filter(E),l=e.filter(x),u=e.filter(d=>!E(d)&&!x(d)),[s,y]=(0,h.useState)(null),c=(0,h.useRef)(null),b=(0,h.useRef)(null);(0,h.useEffect)(()=>{let d=c.current;s!==null&&d&&!d.open&&d.showModal?.()},[s]);let p=s===null?void 0:a[s];return(0,t.jsxs)("div",{style:{display:"grid",gap:10,minWidth:0},children:[a.length>0?(0,t.jsx)("ul",{"data-graview-gallery":"","aria-label":n,style:{listStyle:"none",margin:0,padding:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(96px, 1fr))",gap:8},children:a.map((d,T)=>(0,t.jsx)("li",{style:{minWidth:0},children:(0,t.jsx)(Ue,{file:d,onOpen:R=>{b.current=R,y(T)}})},d.href))}):null,l.length>0?(0,t.jsx)("ul",{"data-graview-videos":"","aria-label":n,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:12},children:l.map(d=>(0,t.jsx)("li",{style:{minWidth:0},children:(0,t.jsx)(Ge,{file:d})},d.href))}):null,u.length>0?(0,t.jsx)("ul",{"data-graview-documents":"",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:10},children:u.map(d=>(0,t.jsxs)("li",{"data-graview-document":d.type,style:{display:"grid",gap:6,minWidth:0},children:[d.type==="application/pdf"?(0,t.jsx)("object",{data:r(d),type:"application/pdf","aria-label":k(d),style:{width:"100%",height:420,border:"1px solid var(--graview-edge)",borderRadius:F},children:(0,t.jsxs)("p",{style:{margin:0,padding:12},children:["This browser shows no PDF here: ",(0,t.jsxs)("a",{href:r(d),download:d.name,children:["download ",d.name]}),"."]})}):null,(0,t.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",gap:"2px 10px",alignItems:"baseline",minWidth:0,overflowWrap:"anywhere"},children:[(0,t.jsx)("a",{href:r(d),download:d.name,...d.type==="application/pdf"?{target:"_blank",rel:"noopener"}:{},children:d.name}),(0,t.jsxs)("span",{style:P,children:[z(d)," \xB7 ",_(d.bytes)]})]}),d.caption?(0,t.jsx)("span",{style:P,children:d.caption}):null]},d.href))}):null,p?(0,t.jsx)("dialog",{ref:c,"data-graview-full":p.href,"aria-label":k(p),onClose:()=>{y(null),b.current?.focus()},onClick:d=>{d.target===d.currentTarget&&d.currentTarget.close()},style:{padding:0,border:0,borderRadius:F,maxWidth:"min(96vw, 1600px)",maxHeight:"94vh",background:"var(--graview-panel)",color:"var(--graview-ink)"},children:(0,t.jsxs)("figure",{style:{margin:0,display:"grid",gap:8,padding:10},children:[(0,t.jsx)("img",{src:r(p),alt:k(p),style:{maxWidth:"100%",maxHeight:"80vh",objectFit:"contain",display:"block",margin:"0 auto"}}),(0,t.jsxs)("figcaption",{style:{display:"flex",gap:12,alignItems:"center",justifyContent:"space-between"},children:[(0,t.jsx)("span",{children:p.caption??p.name}),(0,t.jsx)("form",{method:"dialog",style:{margin:0},children:(0,t.jsx)("button",{type:"submit",autoFocus:!0,children:"Close"})})]})]})}):null]})}function Se({value:e,onChange:n,several:i,image:r,video:a=!1,label:l,thumbs:u=!0}){let s=S(),y=(0,h.useId)(),c=(0,h.useRef)(null),b=(0,h.useRef)(null),[p,d]=(0,h.useState)(null),[T,R]=(0,h.useState)(null),[te,H]=(0,h.useState)([]),[N,O]=(0,h.useState)(!1),W=r?"image/":a?"video/":void 0,C=s?W?s.kinds.filter(o=>o.startsWith(W)||o==="*"||o==="*/*"):s.kinds:[],Pe=s?s.kinds.length===0||C.length>0:!1,Re=!a&&(s?s.kinds.length===0||(r?C:s.kinds).some(o=>o.startsWith("image/")||o.startsWith("*")):!1),ne=!!s&&s.maxBytes>0,L=ne&&(!W||Pe),V=r?"picture":a?"video":"file",ae=i?`${V}s`:`a ${V}`,ie=W?C.length>0?C.join(","):`${W}*`:s?.kinds.join(",")||void 0,We=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,A=(0,h.useRef)(e);A.current=e;let re=(0,h.useRef)(null),I=(0,h.useRef)(null);(0,h.useEffect)(()=>{let o=I.current;if(!o||o.from===e)return;I.current=null;let g=re.current?.children,f=g?.[Math.min(o.at,g.length-1)];((o.what==="move"?f?.querySelector("[data-graview-file-move]"):null)??f?.querySelector("[data-graview-file-remove]")??c.current?.parentElement?.querySelector("[data-graview-file-choose]"))?.focus()});let D=async(o,g)=>{if(!s||o.length===0)return;let f=i?o:o.slice(0,1),m=[],$=[];f.length<o.length&&$.push(`${l} holds one ${V}, so ${o.slice(1).map(v=>`\u201C${v.name||"the photo"}\u201D`).join(", ")} ${o.length>2?"were":"was"} left out.`),H([]),R(null);for(let v of f){d(`Sending ${v.name||"the photo"}\u2026`);let G=await je(v,s,{image:r,video:a,camera:g==="camera"});if("refused"in G){$.push(G.refused);continue}let M=await _e(G,s,r,a);"refused"in M?$.push(M.refused):[...i?A.current:[],...m].some(He=>He.href===M.href)?$.push(`\u201C${M.name}\u201D is already here.`):m.push(M)}if(d(null),H($),m.length!==0)try{n(i?[...A.current,...m]:m.slice(-1)),R(`Added ${m.map(v=>v.name).join(", ")}.`)}catch(v){H([...$,v instanceof Error?v.message:String(v)])}},B=(o,g,f)=>{try{I.current=f?{...f,from:e}:null,n(o),R(g)}catch(m){I.current=null,H([m instanceof Error?m.message:String(m)])}},j=o=>o?Array.from(o):[],Me=o=>{let g=j(o.clipboardData?.files);!L||g.length===0||(o.preventDefault(),D(g,"pasted"))},Te=o=>{O(!1),L&&(o.preventDefault(),D(j(o.dataTransfer?.files),"dropped"))};return(0,t.jsxs)("div",{role:"group","aria-labelledby":`${y}-label`,"data-graview-file-editor":"","data-graview-dropping":N?"":void 0,onPaste:Me,onDragOver:o=>{L&&(o.preventDefault(),O(!0))},onDragLeave:()=>O(!1),onDrop:Te,style:{display:"grid",gap:8,minWidth:0,padding:N?6:0,outline:N?"2px dashed var(--graview-accent)":"none",borderRadius:F},children:[(0,t.jsx)("span",{id:`${y}-label`,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap"},children:l}),e.length>0&&(i||e.length>1)?(0,t.jsx)("ul",{ref:re,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:6},children:e.map((o,g)=>(0,t.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",minWidth:0},children:[u&&(E(o)||x(o))?(0,t.jsx)(Q,{file:o,size:40}):null,(0,t.jsx)("span",{style:{flex:"1 1 8rem",minWidth:0,overflowWrap:"anywhere"},children:o.name}),(0,t.jsx)(we,{file:o,onCaption:f=>B(e.map((m,$)=>$===g?ve(m,f):m),f?`${o.name} now says \u201C${f}\u201D.`:`${o.name} says its name again.`)}),i&&g>0?(0,t.jsx)("button",{type:"button","data-graview-file-move":"","aria-label":`Move ${o.name} earlier`,onClick:()=>B(e.map((f,m)=>m===g-1?o:m===g?e[g-1]:f),`Moved ${o.name} earlier.`,{at:g-1,what:"move"}),children:"\u2191"}):null,i?(0,t.jsx)("button",{type:"button","data-graview-file-remove":"","aria-label":`Remove ${o.name}`,onClick:()=>B(e.filter((f,m)=>m!==g),`Removed ${o.name}.`,{at:g,what:"remove"}),children:"Remove"}):null]},`${g}:${o.href}`))}):e.length===1?(0,t.jsx)(we,{file:e[0],onCaption:o=>B([ve(e[0],o)],o?`${e[0].name} now says \u201C${o}\u201D.`:`${e[0].name} says its name again.`)}):null,L?(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center"},children:[(0,t.jsx)("input",{ref:c,type:"file",hidden:!0,multiple:i,...ie?{accept:ie}:{},"data-graview-file-input":"","aria-label":`Choose ${ae}`,onChange:o=>{let g=j(o.currentTarget.files);o.currentTarget.value="",D(g,"picked")}}),(0,t.jsx)("button",{type:"button",disabled:p!==null,onClick:()=>c.current?.click(),"data-graview-file-choose":"",children:e.length>0&&!i?`Replace the ${V}`:`Choose ${ae}`}),Re?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:b,type:"file",hidden:!0,accept:"image/*",capture:"environment","data-graview-photo-input":"","aria-label":"Take a photo",onChange:o=>{let g=j(o.currentTarget.files);o.currentTarget.value="",D(g,"camera")}}),We?(0,t.jsx)("button",{type:"button",disabled:p!==null,onClick:()=>b.current?.click(),children:"Take a photo"}):null]}):null,(0,t.jsxs)("span",{style:P,"data-graview-file-takes":"",children:["or drop or paste ",i?"them":"it"," here \xB7 ",s.kinds.length>0?ke(C.length>0?C:s.kinds):"any file",", up to ",_(s.maxBytes)]})]}):(0,t.jsx)("p",{style:{...P,margin:0},"data-graview-file-none":"",children:ne?`This host doesn\u2019t take ${a?"videos":"pictures"}, so none can be added here.`:"This host doesn\u2019t take files, so none can be added here."}),(0,t.jsx)("p",{"aria-live":"polite",style:{...P,margin:0,minHeight:p||T?void 0:0},"data-graview-file-status":"",children:p??T??""}),te.length>0?(0,t.jsx)("div",{role:"alert","data-graview-file-refused":"",style:{color:"var(--graview-warn)",fontSize:"0.875rem",display:"grid",gap:2},children:te.map((o,g)=>(0,t.jsx)("p",{style:{margin:0},children:o},g))}):null]})}var ve=(e,n)=>{let{caption:i,...r}=e;return n?{...r,caption:n}:r};function we({file:e,onCaption:n}){let[i,r]=(0,h.useState)(e.caption??"");(0,h.useEffect)(()=>r(e.caption??""),[e.caption]);let a=()=>{let l=i.trim().slice(0,500);l!==(e.caption??"")&&n(l)};return(0,t.jsx)("input",{type:"text",value:i,placeholder:E(e)||x(e)?"What it shows":"What it is","aria-label":`What ${e.name} ${E(e)||x(e)?"shows":"is"}`,"data-graview-file-caption":e.href,onChange:l=>r(l.target.value),onBlur:a,onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),a())},style:{flex:"1 1 10rem",minWidth:0,font:"inherit",fontSize:"0.875rem",minHeight:24}})}function Ee({field:e,label:n,labelStyle:i,valueStyle:r,style:a,children:l}){return(0,t.jsxs)("div",{"data-graview-files":e,style:{display:"grid",gap:6,minWidth:0,gridColumn:"1 / -1",...a},children:[(0,t.jsx)("dt",{style:i,children:n}),(0,t.jsx)("dd",{style:{margin:0,minWidth:0,display:"grid",gap:10,...r},children:l})]})}function Ce(e){let{nodeId:n,field:i,label:r,files:a}=e,{fields:l,commit:u}=me(n),s=l.find(p=>p.field===i&&p.takesValue),y=s?.shape,c=y?.type==="several"?y.of:y,b=y?.type==="several";return a.length===0&&c?.type!=="file"?null:(0,t.jsxs)(Ee,{...e,children:[(0,t.jsx)(X,{files:a,label:r}),s&&c?.type==="file"?(0,t.jsx)(Se,{value:a,thumbs:!1,several:b,image:c.image===!0,video:c.video===!0,label:r,onChange:p=>{let d=b?p:p[p.length-1];d!==void 0&&u(s,d)}}):null]})}function et(e){switch(e.as){case"field":return e.read?e.files.length>0?(0,t.jsx)(Ee,{...e,children:(0,t.jsx)(X,{files:e.files,label:e.label})}):null:(0,t.jsx)(Ce,{...e});case"unfilled":return(0,t.jsx)(Ye,{...e});case"thumb":return(0,t.jsx)(Q,{...e});case"block":return e.files.length>0?(0,t.jsx)("span",{className:"graview-spec-image","data-graview-field":e.field,"data-graview-image":e.view,style:{display:"block",minWidth:0,...e.view==="gallery"?{position:"relative",zIndex:de.raised}:{}},children:e.view==="thumb"?(0,t.jsx)(Q,{file:e.files[0],size:72}):(0,t.jsx)(X,{files:e.files,label:e.label})}):null;case"control":{let n=(0,t.jsx)(Se,{value:Y(e.value),several:e.several,image:e.image,video:e.video===!0,label:e.label,onChange:i=>e.onChange(e.several?i:i[i.length-1])});return e.title===void 0?n:(0,t.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.several?"files":"file",children:[(0,t.jsx)("legend",{"data-graview-part":"label",children:e.title}),n]})}}}function Ye({nodeId:e,skip:n,labels:i,labelStyle:r,style:a}){let{store:l}=ge(),u=he(e),s=u?l.schema.tryDefinition(u.kind):void 0,y=pe(s).filter(c=>!n.includes(c)&&!(s?.display?.hide??[]).includes(c)&&Y(u?.[c]).length===0);return y.length===0?null:(0,t.jsx)("dl",{style:{margin:0,display:"grid",gap:14,minWidth:0},children:y.map(c=>(0,t.jsx)(Ce,{nodeId:e,field:c,label:i?.[c]??oe(s,c),files:[],...r?{labelStyle:r}:{},...a?{style:a}:{}},c))})}export{Se as FilesEditor,Ve as SEND_EDGE,et as drawFiles,ke as kindsWords,je as prepare,_e as send,_ as sizeWords,Fe as takes,z as typeWords};
@@ -1 +1 @@
1
- import{j as m}from"./chunk.LMXNHBGH.js";import{G as N,T as f,X as y}from"./chunk.WSMYFEGU.js";import{b as g}from"./chunk.AJZBJBMO.js";var p=g(N(),1);var a=g(f(),1);var R={default:{background:"var(--graview-panel, #ffffff)",color:"var(--graview-ink, #1a1a1a)"},muted:{background:"var(--graview-panel-muted, #f7f5f1)",color:"var(--graview-ink, #1a1a1a)"},warning:{background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)"}},T={color:"var(--graview-ink-muted, #55514a)"},C={color:"var(--graview-ink-faint, #625d55)"};function H(e){let[l,o]=(0,p.useState)(z);return(0,p.useEffect)(()=>{let r=e.current;if(!r||typeof ResizeObserver>"u")return;let t=()=>{let i=W(r,parseFloat(getComputedStyle(r).paddingBottom)||0);o(s=>s.overflowing===i.overflowing&&s.above===i.above&&s.below===i.below?s:i)};t();let d=new ResizeObserver(t);d.observe(r);for(let i of r.children)d.observe(i);return r.addEventListener("scroll",t,{passive:!0}),()=>{d.disconnect(),r.removeEventListener("scroll",t)}}),l}var z={overflowing:!1,above:!1,below:!1};function W(e,l=0){let o=e.scrollHeight>e.clientHeight+1,r=e.scrollWidth>e.clientWidth+1;return{overflowing:o||r,above:o&&e.scrollTop>1,below:o&&e.scrollTop+e.clientHeight<e.scrollHeight-l-1}}var A=(0,p.createContext)(null),I=(0,p.createContext)(null);function O({level:e,said:l=!0,style:o,children:r}){if(e===void 0)return(0,a.jsx)("strong",{style:o,...l?{}:{"aria-hidden":!0},children:r});let t=`h${e}`;return(0,a.jsx)(t,{style:{margin:0,...o},children:r})}function E({title:e,subtitle:l,meta:o,selected:r,tone:t="default",children:d,style:i,fit:s=!1,variant:w,heading:b}){let c=(0,p.useRef)(null),{overflowing:v,above:x,below:S}=H(c),P=y(),n=(w??(P==="fullscreen"?"page":"card"))==="page",k=(0,p.useContext)(A),u=(0,p.useContext)(I);return(0,a.jsxs)("div",{"data-graview-primitive":"panel","data-graview-variant":n?"page":"card","data-selected":r||void 0,style:{display:"flex",flexDirection:"column",gap:n?12:"var(--graview-gap, 7px)",height:n||s?"auto":"100%",maxHeight:n?"none":"100%",padding:n?0:"var(--graview-pad, 15px)",boxSizing:"border-box",borderRadius:n?0:"var(--graview-radius, 12px)",border:n?"none":`1px solid ${r?"var(--graview-accent, #2f6f5e)":"var(--graview-edge, #e4e0d8)"}`,boxShadow:n?"none":r?"0 0 0 1px var(--graview-accent-dim), var(--graview-lift-low)":"var(--graview-lift-low)",overflow:n?"visible":"hidden",...R[t],...n?{background:"transparent"}:{},...i},children:[t==="warning"?(0,a.jsx)("span",{"data-graview-broken":"",style:m,children:"Implicated in a problem."}):null,e===void 0||e===k?null:(0,a.jsxs)("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:8,minWidth:0},children:[t==="warning"?(0,a.jsx)("span",{"aria-hidden":"true",title:"Implicated in a problem",style:{color:"var(--graview-warn)",flex:"0 0 auto"},children:"\u26A0"}):null,(0,a.jsx)(O,{level:b,said:u===null||e!==u,style:{fontFamily:"var(--graview-font-display, inherit)",fontSize:n?"1.5625rem":"0.9375rem",lineHeight:n?1.15:1.25,fontWeight:n?600:560,letterSpacing:n?"-0.012em":"0.005em",minWidth:0,overflowWrap:"anywhere"},children:e}),o===void 0?null:(0,a.jsx)("span",{style:{marginLeft:"auto",fontSize:"0.75rem",letterSpacing:"0.08em",textTransform:"uppercase",minWidth:0,overflowWrap:"anywhere",...C},children:o})]}),l===void 0?null:(0,a.jsx)("div",{style:{fontSize:n?"0.90625rem":"0.8125rem",lineHeight:1.5,...T},children:l}),(0,a.jsx)("div",{ref:c,className:n?void 0:"graview-scroll",...v&&!n?{tabIndex:0,role:"region",...typeof e=="string"?{"aria-label":e}:{}}:{},style:{display:"flex",flexDirection:"column",gap:n?22:"var(--graview-gap, 7px)",flex:"1 1 auto",...n?{overflow:"visible"}:{marginBottom:"calc(-1 * var(--graview-pad, 15px))",paddingBottom:"var(--graview-pad, 15px)"},...!n&&!v?{overflow:"hidden"}:{}},"data-graview-more-above":x&&!n?"":void 0,"data-graview-more-below":S&&!n?"":void 0,children:d})]})}function h({label:e,hue:l,selected:o,title:r,pickId:t,emphasis:d}){let i=typeof e=="string"?e:void 0,s=l===void 0?void 0:Math.round(l);return(0,a.jsxs)("span",{"data-graview-primitive":"chip","data-selected":o||void 0,"data-graview-pick":t,"data-graview-emphasis":d,title:r??i,style:{cursor:t?"pointer":void 0,display:"inline-flex",alignItems:"center",alignSelf:"flex-start",minHeight:24,boxSizing:"border-box",padding:"3px 9px",borderRadius:6,fontSize:"0.8125rem",lineHeight:1.5,whiteSpace:"nowrap",maxWidth:"min(28ch, 100%)",overflow:"hidden",letterSpacing:"0.01em",border:`1px solid ${o?"var(--graview-accent)":s===void 0?"var(--graview-edge)":`hsl(${s} 55% var(--graview-tint-lightness) / 0.45)`}`,background:s===void 0?"var(--graview-panel-muted)":`hsl(${s} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * 0.65))`,color:"var(--graview-ink, #1a1a1a)",boxShadow:o?"0 0 14px -4px var(--graview-accent)":void 0},children:[s===void 0?null:(0,a.jsx)("span",{"aria-hidden":"true",style:{width:9,height:6,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",flex:"0 0 auto",marginRight:6,background:`hsl(${s} 55% var(--graview-tint-lightness) / 0.9)`}}),(0,a.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]})}function L({items:e,max:l=8,selectedIds:o=[],pick:r=!1}){let t=e.slice(0,l),d=e.length-t.length;return(0,a.jsxs)("div",{"data-graview-primitive":"roster",style:{display:"flex",flexWrap:"wrap",gap:6,alignContent:"flex-start"},children:[t.map(i=>(0,a.jsx)(h,{label:i.label,...i.hue===void 0?{}:{hue:i.hue},...r?{pickId:i.id}:{},...i.emphasis===void 0?{}:{emphasis:i.emphasis},selected:o.includes(i.id)},i.id)),d>0?(0,a.jsx)(h,{label:`+${d} more`}):null]})}function F({label:e,count:l,items:o,onExpand:r,flagged:t,problems:d}){return(0,a.jsx)(E,{title:e,meta:d?(0,a.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[d,(0,a.jsx)("span",{children:l})]}):l,tone:t?"warning":"muted",style:r?{cursor:"zoom-in"}:void 0,children:o&&o.length>0?(0,a.jsx)(L,{items:o,max:6,pick:!0}):null})}export{A as a,I as b,E as c,h as d,L as e,F as f};
1
+ import{j as m}from"./chunk.JQFIZRAZ.js";import{G as N,T as f,X as y}from"./chunk.DBMZ3AQB.js";import{b as g}from"./chunk.AJZBJBMO.js";var p=g(N(),1);var a=g(f(),1);var R={default:{background:"var(--graview-panel, #ffffff)",color:"var(--graview-ink, #1a1a1a)"},muted:{background:"var(--graview-panel-muted, #f7f5f1)",color:"var(--graview-ink, #1a1a1a)"},warning:{background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)"}},T={color:"var(--graview-ink-muted, #55514a)"},C={color:"var(--graview-ink-faint, #625d55)"};function H(e){let[l,o]=(0,p.useState)(z);return(0,p.useEffect)(()=>{let r=e.current;if(!r||typeof ResizeObserver>"u")return;let t=()=>{let i=W(r,parseFloat(getComputedStyle(r).paddingBottom)||0);o(s=>s.overflowing===i.overflowing&&s.above===i.above&&s.below===i.below?s:i)};t();let d=new ResizeObserver(t);d.observe(r);for(let i of r.children)d.observe(i);return r.addEventListener("scroll",t,{passive:!0}),()=>{d.disconnect(),r.removeEventListener("scroll",t)}}),l}var z={overflowing:!1,above:!1,below:!1};function W(e,l=0){let o=e.scrollHeight>e.clientHeight+1,r=e.scrollWidth>e.clientWidth+1;return{overflowing:o||r,above:o&&e.scrollTop>1,below:o&&e.scrollTop+e.clientHeight<e.scrollHeight-l-1}}var A=(0,p.createContext)(null),I=(0,p.createContext)(null);function O({level:e,said:l=!0,style:o,children:r}){if(e===void 0)return(0,a.jsx)("strong",{style:o,...l?{}:{"aria-hidden":!0},children:r});let t=`h${e}`;return(0,a.jsx)(t,{style:{margin:0,...o},children:r})}function E({title:e,subtitle:l,meta:o,selected:r,tone:t="default",children:d,style:i,fit:s=!1,variant:w,heading:b}){let c=(0,p.useRef)(null),{overflowing:v,above:x,below:S}=H(c),P=y(),n=(w??(P==="fullscreen"?"page":"card"))==="page",k=(0,p.useContext)(A),u=(0,p.useContext)(I);return(0,a.jsxs)("div",{"data-graview-primitive":"panel","data-graview-variant":n?"page":"card","data-selected":r||void 0,style:{display:"flex",flexDirection:"column",gap:n?12:"var(--graview-gap, 7px)",height:n||s?"auto":"100%",maxHeight:n?"none":"100%",padding:n?0:"var(--graview-pad, 15px)",boxSizing:"border-box",borderRadius:n?0:"var(--graview-radius, 12px)",border:n?"none":`1px solid ${r?"var(--graview-accent, #2f6f5e)":"var(--graview-edge, #e4e0d8)"}`,boxShadow:n?"none":r?"0 0 0 1px var(--graview-accent-dim), var(--graview-lift-low)":"var(--graview-lift-low)",overflow:n?"visible":"hidden",...R[t],...n?{background:"transparent"}:{},...i},children:[t==="warning"?(0,a.jsx)("span",{"data-graview-broken":"",style:m,children:"Implicated in a problem."}):null,e===void 0||e===k?null:(0,a.jsxs)("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:8,minWidth:0},children:[t==="warning"?(0,a.jsx)("span",{"aria-hidden":"true",title:"Implicated in a problem",style:{color:"var(--graview-warn)",flex:"0 0 auto"},children:"\u26A0"}):null,(0,a.jsx)(O,{level:b,said:u===null||e!==u,style:{fontFamily:"var(--graview-font-display, inherit)",fontSize:n?"1.5625rem":"0.9375rem",lineHeight:n?1.15:1.25,fontWeight:n?600:560,letterSpacing:n?"-0.012em":"0.005em",minWidth:0,overflowWrap:"anywhere"},children:e}),o===void 0?null:(0,a.jsx)("span",{style:{marginLeft:"auto",fontSize:"0.75rem",letterSpacing:"0.08em",textTransform:"uppercase",minWidth:0,overflowWrap:"anywhere",...C},children:o})]}),l===void 0?null:(0,a.jsx)("div",{style:{fontSize:n?"0.90625rem":"0.8125rem",lineHeight:1.5,...T},children:l}),(0,a.jsx)("div",{ref:c,className:n?void 0:"graview-scroll",...v&&!n?{tabIndex:0,role:"region",...typeof e=="string"?{"aria-label":e}:{}}:{},style:{display:"flex",flexDirection:"column",gap:n?22:"var(--graview-gap, 7px)",flex:"1 1 auto",...n?{overflow:"visible"}:{marginBottom:"calc(-1 * var(--graview-pad, 15px))",paddingBottom:"var(--graview-pad, 15px)"},...!n&&!v?{overflow:"hidden"}:{}},"data-graview-more-above":x&&!n?"":void 0,"data-graview-more-below":S&&!n?"":void 0,children:d})]})}function h({label:e,hue:l,selected:o,title:r,pickId:t,emphasis:d}){let i=typeof e=="string"?e:void 0,s=l===void 0?void 0:Math.round(l);return(0,a.jsxs)("span",{"data-graview-primitive":"chip","data-selected":o||void 0,"data-graview-pick":t,"data-graview-emphasis":d,title:r??i,style:{cursor:t?"pointer":void 0,display:"inline-flex",alignItems:"center",alignSelf:"flex-start",minHeight:24,boxSizing:"border-box",padding:"3px 9px",borderRadius:6,fontSize:"0.8125rem",lineHeight:1.5,whiteSpace:"nowrap",maxWidth:"min(28ch, 100%)",overflow:"hidden",letterSpacing:"0.01em",border:`1px solid ${o?"var(--graview-accent)":s===void 0?"var(--graview-edge)":`hsl(${s} 55% var(--graview-tint-lightness) / 0.45)`}`,background:s===void 0?"var(--graview-panel-muted)":`hsl(${s} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * 0.65))`,color:"var(--graview-ink, #1a1a1a)",boxShadow:o?"0 0 14px -4px var(--graview-accent)":void 0},children:[s===void 0?null:(0,a.jsx)("span",{"aria-hidden":"true",style:{width:9,height:6,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",flex:"0 0 auto",marginRight:6,background:`hsl(${s} 55% var(--graview-tint-lightness) / 0.9)`}}),(0,a.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]})}function L({items:e,max:l=8,selectedIds:o=[],pick:r=!1}){let t=e.slice(0,l),d=e.length-t.length;return(0,a.jsxs)("div",{"data-graview-primitive":"roster",style:{display:"flex",flexWrap:"wrap",gap:6,alignContent:"flex-start"},children:[t.map(i=>(0,a.jsx)(h,{label:i.label,...i.hue===void 0?{}:{hue:i.hue},...r?{pickId:i.id}:{},...i.emphasis===void 0?{}:{emphasis:i.emphasis},selected:o.includes(i.id)},i.id)),d>0?(0,a.jsx)(h,{label:`+${d} more`}):null]})}function F({label:e,count:l,items:o,onExpand:r,flagged:t,problems:d}){return(0,a.jsx)(E,{title:e,meta:d?(0,a.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[d,(0,a.jsx)("span",{children:l})]}):l,tone:t?"warning":"muted",style:r?{cursor:"zoom-in"}:void 0,children:o&&o.length>0?(0,a.jsx)(L,{items:o,max:6,pick:!0}):null})}export{A as a,I as b,E as c,h as d,L as e,F as f};
@@ -1 +1 @@
1
- import{A as S,G,l as O,y as v,z as C}from"./chunk.LMXNHBGH.js";import{G as I,ba as m,c as V,j as y,l as p,m as g,n as u,o as D,v as B,z as E}from"./chunk.WSMYFEGU.js";import{ia as M,ud as P,vd as k,xd as R,yd as T}from"./chunk.WR63RQGU.js";import{b as A}from"./chunk.AJZBJBMO.js";var W=A(I(),1);function j(e,t){try{t.length===0?localStorage.removeItem(v(e)):localStorage.setItem(v(e),JSON.stringify(t))}catch{}}function F(e,t){j(e,[...S(e).filter(n=>n.title!==t.title),t])}function H(e,t){j(e,S(e).filter(n=>n.title!==t))}function J(e,t){for(let n of e.places().filter(o=>o.title===t))e.forget?.(n.kind,n.as)}var U=e=>e===!0?{written:!0}:typeof e=="object"&&e!==null?{written:e.kept===!0,...e.said?{said:e.said}:{}}:{written:!1},N=e=>({title:e.title,lens:e.lens,on:e.on,...e.bindings?{bindings:e.bindings}:{},...e.options?{options:e.options}:{}});function Z(e,t){let n=o=>t.some(r=>r.title===o||r.as===P(o));if(!n(e))return e;for(let o=2;;o++)if(!n(`${e} ${o}`))return`${e} ${o}`}function ie(e){let{store:t,views:n,brand:o,seatTalk:r,onKeepLens:d}=m(),h=(0,W.useContext)(O),L=C(o,t.schema),b=async f=>{let{edit:i}=f;if(f.written&&d)try{await d({op:"remove-lens",title:i.title,on:i.on})}catch{}H(L,i.title),J(n,i.title),h?.dismiss(`kept:${i.title}`),r.setTurns(l=>[...l.map(s=>s.kept&&s.kept.edit.title===i.title&&!s.kept.taken?{...s,kept:{...s.kept,taken:!0}}:s),{role:"seat",text:`Took \u201C${i.title}\u201D back out of the places.`}]);let a=M(t.schema,i.on);e({to:"kind",kind:i.on,title:a,address:k(t.schema,i.on),said:`Went to ${a}.`})};return{keep:async f=>{let i=Z(f.edit.title,n.places()),a={...f.edit,title:i},l=!1,s;if(d)try{({written:l,said:s}=U(await d(a)))}catch{l=!1}l||F(L,N(a)),G(n,t.schema,[N(a)]);let K=n.places(),c=K.find(w=>w.title===i),x=s??(l?`Kept \u201C${i}\u201D as a lens: it is in the places now.`:d?`Kept \u201C${i}\u201D as your own lens. Ask the owner to keep it for everyone.`:`Kept \u201C${i}\u201D as your own lens.`),$={edit:a,written:l};r.setDraft(null),r.setTurns(w=>[...w,{role:"seat",text:x,kept:$}]),h?.notify({kind:"toast",id:`kept:${i}`,sentence:x,timeout:1e4,action:{label:"Take back",onSelect:()=>void b($)}}),c&&e({to:"picture",kind:c.kind,as:c.as,title:i,address:R(c.as,T(c,K)?k(t.schema,c.kind).slice(1):void 0),said:`Went to ${i}.`})},takeBack:b}}var q=A(I(),1);function _(e,t){switch(t.to){case"place":return{view:V("#")};case"picture":return{view:u(E(p(e,"filter",null),t.kind,t.as),[])};case"kind":{let n=D(g({...y(e,B(t.kind)),relation:null},!1),!0);return{view:u(p(p(n,"view",null),"filter",t.filter??null),[])}}case"record":return{view:u(y(g(p(p(e,"view",null),"filter",null),!1),t.id),[t.id])};case"problems":return{pane:"problems"}}}function z(e){let t=typeof document>"u"?null:document.querySelector('[data-testid="standing"]');t&&t.getAttribute("aria-expanded")==="true"!==e&&t.click()}function ae(){let{setView:e,seatTalk:t}=m();return(0,q.useCallback)(n=>{t.get().draft&&t.setDraft(null),z(n.to==="problems"),n.to!=="problems"&&e(o=>{let r=_(o,n);return"view"in r?r.view:o})},[e,t])}export{ie as a,z as b,ae as c};
1
+ import{A as S,G,l as O,y as v,z as C}from"./chunk.JQFIZRAZ.js";import{G as I,ba as m,c as V,j as y,l as p,m as g,n as u,o as D,v as B,z as E}from"./chunk.DBMZ3AQB.js";import{Bd as R,Cd as T,ka as M,yd as P,zd as k}from"./chunk.DIFR37EZ.js";import{b as A}from"./chunk.AJZBJBMO.js";var W=A(I(),1);function j(e,t){try{t.length===0?localStorage.removeItem(v(e)):localStorage.setItem(v(e),JSON.stringify(t))}catch{}}function F(e,t){j(e,[...S(e).filter(n=>n.title!==t.title),t])}function H(e,t){j(e,S(e).filter(n=>n.title!==t))}function J(e,t){for(let n of e.places().filter(o=>o.title===t))e.forget?.(n.kind,n.as)}var U=e=>e===!0?{written:!0}:typeof e=="object"&&e!==null?{written:e.kept===!0,...e.said?{said:e.said}:{}}:{written:!1},N=e=>({title:e.title,lens:e.lens,on:e.on,...e.bindings?{bindings:e.bindings}:{},...e.options?{options:e.options}:{}});function Z(e,t){let n=o=>t.some(r=>r.title===o||r.as===P(o));if(!n(e))return e;for(let o=2;;o++)if(!n(`${e} ${o}`))return`${e} ${o}`}function ie(e){let{store:t,views:n,brand:o,seatTalk:r,onKeepLens:d}=m(),h=(0,W.useContext)(O),L=C(o,t.schema),b=async f=>{let{edit:i}=f;if(f.written&&d)try{await d({op:"remove-lens",title:i.title,on:i.on})}catch{}H(L,i.title),J(n,i.title),h?.dismiss(`kept:${i.title}`),r.setTurns(l=>[...l.map(s=>s.kept&&s.kept.edit.title===i.title&&!s.kept.taken?{...s,kept:{...s.kept,taken:!0}}:s),{role:"seat",text:`Took \u201C${i.title}\u201D back out of the places.`}]);let a=M(t.schema,i.on);e({to:"kind",kind:i.on,title:a,address:k(t.schema,i.on),said:`Went to ${a}.`})};return{keep:async f=>{let i=Z(f.edit.title,n.places()),a={...f.edit,title:i},l=!1,s;if(d)try{({written:l,said:s}=U(await d(a)))}catch{l=!1}l||F(L,N(a)),G(n,t.schema,[N(a)]);let K=n.places(),c=K.find(w=>w.title===i),x=s??(l?`Kept \u201C${i}\u201D as a lens: it is in the places now.`:d?`Kept \u201C${i}\u201D as your own lens. Ask the owner to keep it for everyone.`:`Kept \u201C${i}\u201D as your own lens.`),$={edit:a,written:l};r.setDraft(null),r.setTurns(w=>[...w,{role:"seat",text:x,kept:$}]),h?.notify({kind:"toast",id:`kept:${i}`,sentence:x,timeout:1e4,action:{label:"Take back",onSelect:()=>void b($)}}),c&&e({to:"picture",kind:c.kind,as:c.as,title:i,address:R(c.as,T(c,K)?k(t.schema,c.kind).slice(1):void 0),said:`Went to ${i}.`})},takeBack:b}}var q=A(I(),1);function _(e,t){switch(t.to){case"place":return{view:V("#")};case"picture":return{view:u(E(p(e,"filter",null),t.kind,t.as),[])};case"kind":{let n=D(g({...y(e,B(t.kind)),relation:null},!1),!0);return{view:u(p(p(n,"view",null),"filter",t.filter??null),[])}}case"record":return{view:u(y(g(p(p(e,"view",null),"filter",null),!1),t.id),[t.id])};case"problems":return{pane:"problems"}}}function z(e){let t=typeof document>"u"?null:document.querySelector('[data-testid="standing"]');t&&t.getAttribute("aria-expanded")==="true"!==e&&t.click()}function ae(){let{setView:e,seatTalk:t}=m();return(0,q.useCallback)(n=>{t.get().draft&&t.setDraft(null),z(n.to==="problems"),n.to!=="problems"&&e(o=>{let r=_(o,n);return"view"in r?r.view:o})},[e,t])}export{ie as a,z as b,ae as c};
@@ -1 +1 @@
1
- import{g as o,l as u}from"./chunk.WSMYFEGU.js";function c(t,n,i){let e=r=>encodeURIComponent(r);return`${o}${e(t)}:${e(n)}:${e(i)}`}function S(t,n,i){let e=new Set(t.shown??[]);if(i?e.add(n):e.delete(n),e.size===0){let{shown:r,...w}=t;return w}return{...t,shown:[...e].sort()}}function l(t,n){if(n===null||n.trim().length===0){let{q:i,...e}=t;return e}return{...t,q:n}}function p(t){let n=t.q!==void 0&&t.within?.q===t.q;return l(n?u(t,"q",null):t,null)}function h(t,n){if(!n){let{past:i,...e}=t;return e}return{...t,past:!0}}function f(t,n){if(n===null||n.x===0&&n.y===0){let{pan:i,...e}=t;return e}return{...t,pan:n}}function d(t,n,i){let e={...t.pins};return i===null?delete e[n]:e[n]=i,{...t,pins:e}}export{c as a,S as b,l as c,p as d,h as e,f,d as g};
1
+ import{g as o,l as u}from"./chunk.DBMZ3AQB.js";function c(t,n,i){let e=r=>encodeURIComponent(r);return`${o}${e(t)}:${e(n)}:${e(i)}`}function S(t,n,i){let e=new Set(t.shown??[]);if(i?e.add(n):e.delete(n),e.size===0){let{shown:r,...w}=t;return w}return{...t,shown:[...e].sort()}}function l(t,n){if(n===null||n.trim().length===0){let{q:i,...e}=t;return e}return{...t,q:n}}function p(t){let n=t.q!==void 0&&t.within?.q===t.q;return l(n?u(t,"q",null):t,null)}function h(t,n){if(!n){let{past:i,...e}=t;return e}return{...t,past:!0}}function f(t,n){if(n===null||n.x===0&&n.y===0){let{pan:i,...e}=t;return e}return{...t,pan:n}}function d(t,n,i){let e={...t.pins};return i===null?delete e[n]:e[n]=i,{...t,pins:e}}export{c as a,S as b,l as c,p as d,h as e,f,d as g};
@@ -0,0 +1 @@
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{q as Ie}from"./chunk.NZDWXX6H.js";import{d as Je,e as Ee,f as je,g as ze}from"./chunk.4BRM5SGO.js";import{a as He}from"./chunk.BCE6LIDR.js";import{e as X}from"./chunk.5NZDFT6R.js";import{a as z}from"./chunk.XTBS64IT.js";import{f as Pe,g as Y,i as De}from"./chunk.LUIRQ5UF.js";import{a as Se}from"./chunk.N33WUCAN.js";import{Aa as me,Da as K,Eb as ve,Fa as he,Ha as ye,Hb as Ae,Ia as Z,Ib as Oe,Lb as Re,M as pe,Ob as _e,Pa as ge,Qa as be,Rb as C,Ta as we,Zb as Te,_a as W,a as fe,cb as ke,ha as G,md as $e,nc as xe,oc as Me,pc as Ne}from"./chunk.DIFR37EZ.js";var E=(n,e,t)=>{(n[e]===void 0||t>n[e])&&(n[e]=t)},j=(n,e,t)=>{(n[e]===void 0||t<n[e])&&(n[e]=t)},Q=(n,e)=>{n.format=e,e.includes("int")&&(n.isInt=!0)},Le=(n,e)=>{n.mime=n.mime?n.mime.filter(t=>e.includes(t)):[...e]},qe=(n,e)=>{n.multipleOf??=[],n.multipleOf.includes(e)||n.multipleOf.push(e)},Fe=(n,e)=>(n.patterns??=new Set).add(e),st={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 H(n){let e={},{def:t,bag:r}=n._zod,i=n._zod.traits.has("$ZodCheck")?[n,...t.checks??[]]:t.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":j(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=st[a.format];d&&(E(e,"minimum",d[0]),j(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":j(e,"maximum",a.maximum);break;case"length_equals":E(e,"minimum",a.length),j(e,"maximum",a.length);break;case"size_equals":E(e,"minimum",a.size),j(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&&j(e,"maximum",r.maximum),r.exclusiveMaximum!==void 0&&j(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 dt={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""};function L(n){let e=n._zod.def;return e.type==="pipe"&&e.in._zod.traits.has("$ZodTransform")?L(e.out):e.type==="catch"?L(e.innerType):n._zod.optin}var ct=new Set(["promise","optional","nonoptional","nullable","readonly","default","prefault","catch"]);function T(n,e=new Set){if(e.has(n))return!1;e.add(n);let t=n._zod.def,r=t.type;return r==="transform"?!0:r==="array"?T(t.element,e):r==="set"?T(t.valueType,e):r==="lazy"?T(t.getter(),e):ct.has(r)?T(t.innerType,e):r==="intersection"?T(t.left,e)||T(t.right,e):r==="record"||r==="map"?T(t.keyType,e)||T(t.valueType,e):r==="pipe"?n._zod.traits.has("$ZodCodec")||T(t.in,e)||T(t.out,e):r==="object"?Object.values(t.shape).some(i=>T(i,e)):r==="union"?t.options.some(i=>T(i,e)):r==="tuple"?t.items.some(i=>T(i,e))||(t.rest?T(t.rest,e):!1):!1}function lt(n){let e=Object.values(n).filter(t=>typeof t=="number");return Object.entries(n).filter(([t])=>e.indexOf(+t)===-1).map(([,t])=>t)}function Be(n){let e=n.anyOf;if(!Array.isArray(e)||e.length===0||n.type!==void 0)return;let t=[];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;t.includes(o)||t.push(o)}}delete n.anyOf,n.type=t.length===1?t[0]:t}var Ue=new Set(["type","properties","required","additionalProperties"]),We=n=>{let e=n.additionalProperties;return e&&typeof e=="object"&&Object.keys(e).length?e:null},Ce=(n,e)=>JSON.stringify(n)===JSON.stringify(e);function ee(n){for(let i of n){if(typeof i!="object"||i.type!=="object")return null;for(let o in i)if(!Ue.has(o))return null}let e={},t=new Set;for(let i of n){for(let o in i.properties){if(Object.prototype.hasOwnProperty.call(e,o))continue;let a=[];for(let d of n){let s=d.properties?.[o]??We(d);s&&!a.some(b=>Ce(b,s))&&a.push(s)}e[o]=a.length===1?a[0]:ee(a)??{allOf:a}}for(let o of i.required??[])t.add(o)}let r={type:"object",properties:e};if(t.size&&(r.required=[...t]),n.every(i=>i.additionalProperties===!1))r.additionalProperties=!1;else{let i=[];for(let o of n){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 ut(n){let e=n.allOf;if(!Array.isArray(e)||e.length<2)return;for(let i of Ue)if(i in n)return;let t=e.filter(i=>Array.isArray(i.oneOf)||Array.isArray(i.anyOf)),r;if(!t.length)r=ee(e);else{let i=t[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 n.allOf,Object.assign(n,r))}function Ve(n){let e=n;for(let y of["anyOf","oneOf"]){let _=e[y];if(!Array.isArray(_))continue;let O=_.map(Ve);O.some((v,m)=>v!==_[m])&&(e={...e,[y]:O})}let t=[e.type].flat(),r=!t.includes("string")&&t.some(y=>y==="number"||y==="integer"),i=e.enum??(e.const!==void 0?[e.const]:void 0);if(!r&&!i?.some(y=>typeof y=="number"))return e;let{minimum:o,maximum:a,exclusiveMinimum:d,exclusiveMaximum:s,multipleOf:b,format:f,id:w,...h}=e;return h.enum?h.enum=h.enum.map(y=>typeof y=="number"?String(y):y):typeof h.const=="number"&&(h.const=String(h.const)),r&&(h.type="string",i||(h.pattern=t.includes("number")?"^-?\\d+(?:\\.\\d+)?$":"^-?\\d+$")),h}var B=class{constructor(e,t){this.override=e;this.refs=t}done=new Map;path=[];cyclic=new Map;write(e,t=!1){let r=this.refs.get(e);if(r!==void 0&&!t)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 t={},r,i=e._zod.toJSONSchema?.();i?Object.assign(t,i):r=this.process(e,t);let o=fe.get(e);if(o)for(let d of Object.keys(o))t[d]=o[d];T(e)&&(delete t.examples,delete t.default),"_prefault"in t&&(t.default??=t._prefault,delete t._prefault);let a=t;if(r){let d=this.write(r);a={...t};for(let s of Object.keys(d))s in t||(a[s]=d[s])}return this.override({zodSchema:e,jsonSchema:a}),Be(a),e._zod.def.type==="intersection"&&ut(a),a}process(e,t){let r=e._zod.def;switch(r.type){case"string":{t.type="string";let{minimum:i,maximum:o,format:a,patterns:d,contentEncoding:s,laxFormat:b}=H(e);if(typeof i=="number"&&(t.minLength=i),typeof o=="number"&&(t.maxLength=o),a&&(t.format=dt[a]??a,(t.format===""||a==="time"||b)&&delete t.format),s&&(t.contentEncoding=s),d&&d.size>0){let f=[...d];f.length===1?t.pattern=f[0].source:t.allOf=f.map(w=>({pattern:w.source}))}return}case"number":{let{minimum:i,maximum:o,multipleOf:a,exclusiveMinimum:d,exclusiveMaximum:s,isInt:b}=H(e);if(t.type=b?"integer":"number",typeof d=="number"&&d>=(i??Number.NEGATIVE_INFINITY)?t.exclusiveMinimum=d:typeof i=="number"&&(t.minimum=i),typeof s=="number"&&s<=(o??Number.POSITIVE_INFINITY)?t.exclusiveMaximum=s:typeof o=="number"&&(t.maximum=o),a){let[f,...w]=new Set(a.filter(h=>Number.isFinite(h)&&h!==0).map(Math.abs));f!==void 0&&(t.multipleOf=f),w.length&&(t.allOf=[...t.allOf??[],...w.map(h=>({multipleOf:h}))])}return}case"boolean":case"success":t.type="boolean";return;case"null":t.type="null";return;case"never":t.not={};return;case"enum":{let i=lt(r.entries);i.length===0?t.not={}:(i.every(o=>typeof o=="number")&&(t.type="number"),i.every(o=>typeof o=="string")&&(t.type="string"),t.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)t.not={};else if(i.length===1)t.type=i[0]===null?"null":typeof i[0],t.const=i[0];else if(i.length>1){for(let o of["number","string","boolean"])i.every(a=>typeof a===o)&&(t.type=o);i.every(o=>o===null)&&(t.type="null"),t.enum=i}return}case"template_literal":t.type="string",t.pattern=e._zod.pattern.source;return;case"file":{t.type="string",t.format="binary",t.contentEncoding="binary";let{minimum:i,maximum:o,mime:a}=H(e);i!==void 0&&(t.minLength=i),o!==void 0&&(t.maxLength=o),a&&(a.length===0?t.not={}:a.length===1?t.contentMediaType=a[0]:t.anyOf=a.map(d=>({contentMediaType:d})));return}case"array":{let{minimum:i,maximum:o}=H(e);typeof i=="number"&&(t.minItems=i),typeof o=="number"&&(t.maxItems=o),t.type="array",t.items=this.write(r.element);return}case"object":{let i=r.shape;t.type="object";let o={};t.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&&(t.required=a),r.catchall?._zod.def.type==="never"?t.additionalProperties=!1:r.catchall&&(t.additionalProperties=this.write(r.catchall));return}case"union":t[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);t.allOf=[...i(o)?o.allOf:[o],...i(a)?a.allOf:[a]];return}case"tuple":{let i=r.items;t.type="array",t.prefixItems=i.map(s=>this.write(s)),r.rest?t.items=this.write(r.rest):t.items=!1;let o=i.length;for(;o>0&&L(i[o-1])!==void 0;)o-=1;o>0&&(t.minItems=o),r.rest||(t.maxItems=i.length);let{minimum:a,maximum:d}=H(e);typeof a=="number"&&(t.minItems=a),typeof d=="number"&&(t.maxItems=d);return}case"record":{let i=r.keyType;t.type="object";let o=H(i).patterns;if(r.mode==="loose"&&o&&o.size>0){let d=this.write(r.valueType),s={};for(let b of o)s[b.source]=d;t.patternProperties=s}else t.propertyNames=Ve(this.write(i)),t.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&&(t.required=d.map(String))}return}case"nullable":t.anyOf=[this.write(r.innerType),{type:"null"}];return;case"default":case"prefault":{let i=r.defaultValue,o,a=!1,d=JSON.stringify(i,(s,b)=>typeof b=="bigint"?(a=!0,null):b);return!a&&d!==void 0&&(o=JSON.parse(d)),a||(t[r.type==="default"?"default":"_prefault"]=o),r.innerType}case"catch":{try{t.default=r.catchValue(void 0)}catch{}return r.innerType}case"readonly":return t.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(n,e=()=>{}){let t=n,r=new B(e,new Map),i=r.write(t,!0);if(r.cyclic.size>0){let o=new Map,a=0,d=[];for(let b of r.cyclic.keys())if(b===t)o.set(b,"#");else{let f=`__schema${a++}`;o.set(b,`#/$defs/${f}`),d.push([b,f])}r=new B(e,o),i=r.write(t,!0);let s={};for(let[b,f]of d)s[f]=r.write(b,!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(n){return Ge(n,mt)}var ft={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string"},pt={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 mt(n){me(n.zodSchema)&&(n.jsonSchema["x-graview-app-link"]=!0);let e=ye(n.zodSchema);if(e&&(n.jsonSchema.type==="string"||n.jsonSchema.type==="array")){n.jsonSchema["x-graview-linked"]={address:e.address,kinds:[...e.kinds],cardinality:e.cardinality};let s=e.kinds.join(" or "),b=`${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.`,f=n.jsonSchema.description;typeof f=="string"&&f.includes(b)||(n.jsonSchema.description=`${typeof f=="string"&&f?`${f.replace(/\.?$/,".")} `:""}${b}`)}if(we(n.zodSchema)&&(n.jsonSchema["x-graview-repeat"]=!0,!n.jsonSchema.type&&!n.jsonSchema.anyOf&&!n.jsonSchema.oneOf&&Object.assign(n.jsonSchema,ht())),Se(n.zodSchema)){n.jsonSchema.contentMediaType="text/markdown";let s=n.jsonSchema.description;typeof s=="string"&&s.endsWith("Written in Markdown.")||(n.jsonSchema.description=`${typeof s=="string"&&s?`${s.replace(/\.?$/,".")} `:""}Written in Markdown.`)}let t=_e(n.zodSchema);if(t){let s=n.jsonSchema;s["x-graview-type"]=t,t==="duration"&&(s["x-graview-unit"]="minutes"),s.description??=pt[t]}let r=Re(n.zodSchema,!1);if(r){let s=Pe(r);n.jsonSchema["x-graview-format"]=s.format??"unit",s.currency&&(n.jsonSchema["x-graview-currency"]=s.currency),s.unit&&s.format!=="money"&&(n.jsonSchema["x-graview-unit"]=s.unit);let b=n.jsonSchema.description;n.jsonSchema.description=typeof b=="string"&&b.length>0?`${b} ${Y(s)}`:Y(s)}let i=n.zodSchema._zod?.def;if(!i||i.type!=="string"||typeof i.format!="string"||i.format==="regex")return;let o=n.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=ft[i.format]??i.format,a.length===1?o.pattern=a[0]:a.length>1&&(o.allOf=a.map(s=>({pattern:s})))}function te(n,e){let t=C(n.input),r=Ke(n.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(n)){let o=n.creates.join(" | ");i.id={type:"string",minLength:1,description:`Optional: the id for the ${o} this makes, beginning with its kind (${n.creates.map(a=>`"${a}:"`).join(" or ")}). Refused if the graph already has it; left out, one is minted from the label.`},r.properties=i}Oe(n)&&(r.additionalProperties=!1);for(let o of t){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:n.name,...n.title===void 0?{}:{title:n.title},description:n.description??n.title??n.name,inputSchema:r,nodeRefs:t}}function ht(){let n={type:"string",pattern:"^\\d{4}-\\d{2}-\\d{2}$"},e=(t,r)=>({type:"integer",minimum:t,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:n,count:e(1,1e3),except:{type:"array",maxItems:500,items:n},continues:{type:"string",maxLength:200}},required:["every"],additionalProperties:!1}}function Ze(n){let e=new Set;for(let t=n;t;t=t.onBehalfOf)t.id!==void 0&&e.add(`${t.kind}:${t.id}`);return e}function U(n,e){let t=Ze(e),r=f=>{if(f.kind==="rule")return!1;let w=Ze(f);if(w.size===0)return!1;for(let h of w)if(t.has(h))return!1;return!0},i,o=()=>{if(i)return i;i=new Map;for(let f of n.log.live()){if(f.undoes!==void 0)continue;let w=r(f.author)?f.author:void 0;for(let h of f.primitives){h.op==="remove-node"&&i.delete(h.node.id);let y=h.op==="add-node"?h.node.id:h.op==="patch-node"||h.op==="splice-text"?h.id:void 0;if(y===void 0)continue;let _=h.op==="add-node"?Object.keys(h.node):h.op==="splice-text"?[h.field]:Object.keys(h.after),O=i.get(y);(h.op==="add-node"||!O)&&i.set(y,O=new Map);for(let v of _)v==="id"||v==="kind"||(w?O.set(v,w):O.delete(v))}}return i},a=n.schema,d=new Map,s=(f,w)=>{let h=`${f}\0${w}`,y=d.get(h);if(y===void 0){let _=a.tryDefinition(f)?.fields?.shape;y=_!==void 0&&w in _&&De(_[w]).type==="text",d.set(h,y)}return y},b=f=>n.graph.getNode(f)?.kind;return{prose:s,say:f=>W(f,{graph:n.graph,schema:a}),fieldBy(f,w){let h=b(f);if(!(h===void 0||!s(h,w)))return o().get(f)?.get(w)},recordBy(f){let w=b(f),h=o().get(f);if(w===void 0||!h)return;let y;for(let[_,O]of h)s(w,_)&&(y=O);return y}}}var ne=(n,e,t)=>({untrusted:!0,authoredBy:t.say(e),text:n}),yt="the host's ranker";function Ye(n,e){return{...n,hits:n.hits.map(t=>{if(t.about!=="node")return t;t.why.by==="meaning"&&t.why.matched!==void 0&&(t={...t,why:{...t.why,matched:{untrusted:!0,authoredBy:yt,text:t.why.matched}}});let r=e.recordBy(t.id);if(!r)return t;let i=e.prose(t.kind,t.why.field)?e.fieldBy(t.id,t.why.field):r;return{...t,label:ne(t.label,r,e),...t.apart!==void 0?{apart:ne(t.apart,r,e)}:{},why:i?{...t.why,fragment:ne(t.why.fragment,i,e)}:t.why}})}}var ie=(n,e,t)=>({title:n,readOnlyHint:e,destructiveHint:!1,idempotentHint:t,openWorldHint:!1}),gt={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)},bt={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)},wt={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=[gt,bt,wt];var F=n=>{let e;return()=>e??=n().catch(t=>{throw e=void 0,t})},St=F(()=>(__graviewPreload(import.meta.url,["./chunk.XVN3CQKH.js","./chunk.7ML2BWSP.js","./chunk.5NZDFT6R.js","./chunk.7INWDFNG.js","./chunk.FPGU43SC.js","./chunk.V6FUYRZI.js","./chunk.5BPRGXIW.js","./chunk.BZEJM2PY.js","./chunk.CMLNBJZG.js","./chunk.LUIRQ5UF.js","./chunk.N33WUCAN.js","./chunk.DIFR37EZ.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.GBAUQXXD.js"))),kt=()=>(__graviewPreload(import.meta.url,["./chunk.XTBS64IT.js","./chunk.5BPRGXIW.js","./chunk.BZEJM2PY.js","./chunk.CMLNBJZG.js","./chunk.DIFR37EZ.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.7UBABS2T.js")).catch(()=>{}),vt=async()=>{(await kt())?.judgeWithLines()},q=F(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.7INWDFNG.js","./chunk.FPGU43SC.js","./chunk.V6FUYRZI.js","./chunk.5BPRGXIW.js","./chunk.BZEJM2PY.js","./chunk.CMLNBJZG.js","./chunk.N33WUCAN.js","./chunk.DIFR37EZ.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.I5PSHASU.js"))),At=F(()=>(__graviewPreload(import.meta.url,["./chunk.4W5GCPAP.js","./chunk.G4JJXA63.js","./chunk.C7EJPV2N.js","./chunk.7ML2BWSP.js","./chunk.RALAID6N.js","./chunk.XOZU4OFA.js","./chunk.5NZDFT6R.js","./chunk.XTBS64IT.js","./chunk.WVUJXDXZ.js","./chunk.7INWDFNG.js","./chunk.FPGU43SC.js","./chunk.V6FUYRZI.js","./chunk.5BPRGXIW.js","./chunk.BZEJM2PY.js","./chunk.CMLNBJZG.js","./chunk.RQX4CQJN.js","./chunk.LUIRQ5UF.js","./chunk.N33WUCAN.js","./chunk.DIFR37EZ.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.57KRCHQT.js"))),Ot=F(()=>(__graviewPreload(import.meta.url,["./chunk.547FQPYG.js","./chunk.XVN3CQKH.js","./chunk.7ML2BWSP.js","./chunk.BCE6LIDR.js","./chunk.MBLFZF5R.js","./chunk.5NZDFT6R.js","./chunk.7INWDFNG.js","./chunk.FPGU43SC.js","./chunk.V6FUYRZI.js","./chunk.5BPRGXIW.js","./chunk.BZEJM2PY.js","./chunk.CMLNBJZG.js","./chunk.RQX4CQJN.js","./chunk.LUIRQ5UF.js","./chunk.N33WUCAN.js","./chunk.DIFR37EZ.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.DSWMXM57.js"))),Rt=F(()=>(__graviewPreload(import.meta.url,["./chunk.53U6E5LD.js","./chunk.PQMMISCQ.js","./chunk.5BPRGXIW.js","./chunk.BZEJM2PY.js","./chunk.CMLNBJZG.js","./chunk.DIFR37EZ.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.G3BDQ6EA.js"))),_t=n=>n.definitions.some(e=>Z(e).size>0),Xe=n=>({value:K(n),label:n.label,...n.describe?{describe:n.describe}:{},...n.card?{card:n.card}:{},fields:n.fields,...n.app?{app:n.app}:{}});async function Tt(n,e,t,r){let i=String(t.relation??""),[o,a]=i.includes(".")?i.split(".",2):[void 0,i],d=n.schema.definitions.flatMap(v=>[...Z(v)].map(([m,u])=>({kind:v.kind,name:m,relation:u}))),s=d.filter(v=>v.name===a&&(o===void 0||v.kind===o));if(s.length!==1){let v=d.map(m=>`${m.kind}.${m.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:b,name:f,relation:w}=s[0];if(!r)return{ok:!1,error:`This seat cannot read ${w.address}: its host reads no other app's records. Nothing was changed.`};let h={kind:e.kind,...e.id===void 0?{}:{id:e.id},...e.roles?{roles:e.roles}:{}},y=typeof t.of=="string"?t.of:void 0;if(y!==void 0){let v=n.graph.getNode(y);if(!v||v.kind!==b)return{ok:!1,error:`No ${b} "${y}".`};let m=he(v[f],w),u=await Promise.all(m.map(S=>Promise.resolve().then(()=>r.resolve(S,h)).catch(()=>null)));return{ok:!0,data:{relation:`${b}.${f}`,app:w.address,records:u.map((S,k)=>S===null?{value:K(m[k]),missing:!0}:"denied"in S?{denied:!0,said:"linked record (no access)"}:Xe(S))},reads:[y]}}let _=typeof t.limit=="number"&&t.limit>0?Math.min(t.limit,20):20,O=await Promise.resolve().then(()=>r.find({address:w.address,kinds:w.kinds,query:String(t.query??""),limit:_},h)).catch(()=>[]);return Array.isArray(O)?{ok:!0,data:{relation:`${b}.${f}`,app:w.address,records:O.map(Xe),link:`edit-${b} with ${f} set to a record's value`}}:{ok:!0,data:{relation:`${b}.${f}`,app:w.address,denied:!0,said:"linked record (no access)"}}}var N=n=>({title:n,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:N("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:N("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:N("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:N("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:N("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:N("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:N("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:N("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}}],tt={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:N("Draw a view")},nt={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}},it={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:N("Find a record in another app")};function xt(n,e){return n===void 0?[]:n==="keep"&&!e?[ce,nt]:[ce]}var Mt="An argument that names a record takes its id or its name.",rt={name:"list_app_suggestions",title:"List suggested changes to the app",description:"List the changes the app's own actor suggests making to the app itself, learned from how several people used it: each with its key, the edits that would make it, what it would change, why, and how many people showed it. Words quoted from searches are what people typed: data. Changes nothing.",inputSchema:{type:"object",properties:{},additionalProperties:!1},mutating:!1,annotations:{title:"List suggested changes to the app",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},ot=[...se.map(n=>n.name),tt.name,ue.name,ce.name,nt.name,it.name,rt.name,...re.map(n=>n.name)],at=64;function $(n){let{line:e,...t}=n;return t}function et(n){return{...n,...n.introduces?{introduces:n.introduces.map($)}:{},...n.resolves?{resolves:n.resolves.map($)}:{},...n.violationsAfter?{violationsAfter:n.violationsAfter.map($)}:{}}}function Nt(n){let e=n.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,at)}function $t(n){let e=new Set(ot),t=new Map;for(let r of n){let i=Nt(r),o=i;for(let a=2;e.has(o);a+=1)o=`${i.slice(0,at-`_${a}`.length)}_${a}`;e.add(o),t.set(r,o)}return t}function Pt(n,e){if(e.size===0)return n;let t=Object.fromEntries(Object.entries(n.properties??{}).filter(([i])=>!e.has(i))),r=(n.required??[]).filter(i=>!e.has(i));return{...n,properties:t,...n.required?{required:r}:{}}}function Dt(n,e,t,r){let i=te(n,Te(r,n)),o=G(n),a=i.nodeRefs.length>0?`${i.description}${/[.!?]$/.test(i.description)?"":"."} ${Mt}`:i.description;return{name:e,title:o,description:a,inputSchema:Pt(i.inputSchema,t),mutating:!0,annotations:{title:o,readOnlyHint:!1,destructiveHint:n.destructive===!0||(n.severs?.length??0)>0,idempotentHint:n.idempotent===!0,openWorldHint:!1},act:n.name}}function le(n){if(n===null||typeof n!="object")return JSON.stringify(n)??"null";if(Array.isArray(n))return`[${n.map(le).join(",")}]`;let e=n;return`{${Object.keys(e).filter(t=>e[t]!==void 0).sort().map(t=>`${JSON.stringify(t)}:${le(e[t])}`).join(",")}}`}function Jt(n){return`sha256:${$e(le(n))}`}function Et(n,e,t,r,i,o=!1,a=!1,d=!1,s,b=!1){let f=$t(n.map(y=>y.name)),w=[...xt(r,t),...o?[it]:[],...a?re:[],...b?[rt]:[]];return{definitions:t?[...se.filter(y=>!y.mutating),...w]:[...se,tt,...d?[ue]:[],...w,...n.filter(y=>e.has(y.name)).map(y=>Dt(y,f.get(y.name),i(y),s))],names:f}}function On(n,e={}){let t=e.author??{kind:"agent"},r=n.allMutations(),i=new Set(n.permittedMutations(t).map(m=>m.name)),{definitions:o,names:a}=Et(r,i,e.readOnly===!0,e.drafts?e.drafts.keep?"keep":"draw":void 0,m=>X(n.schema,n.policy,t,m),_t(n.schema),e.subscriptions!==void 0,Ne(t),n.schema,e.learned!==void 0),d=Jt(o),s={app:e.app?.brand?.locale,appTimeZone:e.app?.brand?.timeZone},b=m=>pe(s,m),f=m=>{if(!ot.includes(m)){for(let[u,S]of a)if(S===m)return u;return a.has(m)?m:xe(m,a.keys())}},w=m=>{let u=Me(m,a.keys());return u?` Did you mean "${u}"?`:""},h=m=>{let u=o.find(k=>k.name===m)??o.find(k=>k.act===m);if(u)return u;let S=f(m);return S===void 0?void 0:o.find(k=>k.act===S)},y=(m,u)=>{let S=r.find(c=>c.name===m);if(!S)return{args:u,resolved:[]};let k={...u},l=[];for(let c of C(S.input)){let p=k[c.name];if(typeof p!="string"||p.trim()==="")continue;let g=n.resolveRef(c,p,t);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:p,id:g.id,label:g.label}))}return{args:k,resolved:l}},_=async(m,u)=>{try{await vt();let S=h(m);if(!S&&m===ue.name)return{ok:!1,error:"Only the app's own actor (automated: true) suggests changes.",reason:"forbidden"};if(!S){let l=f(m);if(l){let c=n.permits({name:l,args:u},t);if(!c.ok)return{ok:!1,error:c.refusal.message,reason:"forbidden"}}return{ok:!1,error:`Unknown tool "${m}".${w(m)} Available: ${o.map(c=>c.name).join(", ")}`}}if(S.mutating&&e.readOnly)return{ok:!1,error:`"${m}" changes the graph, and this seat is read-only.`,reason:"forbidden"};if(S.act!==void 0){let l=y(S.act,u);if("ok"in l)return l;let c=S.act,p=b(()=>z(n,t,n.apply({name:c,args:l.args},{...e.author?{author:e.author}:{},...V(e.via)})));return{ok:!0,data:{batch:p.batch,intent:p.intent,introduces:p.introduces.map($),resolves:p.resolves.map($),...l.resolved.length>0?{resolved:l.resolved}:{}},diff:p.diff}}let k=n.seenBy(t);switch(S.name){case"search_graph":{let l=typeof e.places=="function"?e.places():e.places,c=typeof u.subject=="string"?u.subject:void 0,p=Ie(k,String(u.query??""),{principal:t,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=p.later?await p.later:p;return{ok:!0,data:(await q()).searchRead(g,Ye(g,U(k,t))),reads:g.hits.flatMap(A=>A.about==="node"?[A.id]:[])}}case"get_graph":return{ok:!0,...(await q()).graphRead(k,U(k,t),u)};case"get_node":{let l=String(u.id??""),c=l,p;if(!k.graph.getNode(l)){let A=l.trim()===""?void 0:n.resolveRef({name:"id",kinds:["*"]},l,t);if(A?.ok)c=A.id,p={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,t),c,u);return{ok:!0,data:p?{...g.data,resolved:[p]}:g.data,reads:g.reads}}case"describe_place":{let l=e.app??{name:"",schema:n.schema},c=typeof u.width=="number"&&Number.isFinite(u.width)&&u.width>0?u.width:1440,{describePlace:p}=await St(),g=p(n,t,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,M=I=>{for(let D of I)for(let x of D.groups??[])for(let P of x.items)A.add(P.id),M(P.parts)};return M(g.description.parts),{ok:!0,data:g.description,reads:[...A]}}case"find_linked":return Tt(k,t,u,e.linked);case"draft_view":case"keep_lens":{let l=e.app??{name:"",schema:n.schema};return(await At()).runDraftTool(S.name,u,{app:l,principal:t,...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:He(k,l,{...typeof e.derive=="function"?e.derive():e.derive,...e.author?{principal:e.author}:{},...u.context?{context:u.context}:{}}),reads:l.filter(p=>k.graph.has(p))}}case"preview_mutation":{let l=String(u.mutation),c=f(l)??l,p=y(c,u.args??{});if("ok"in p)return p;let g=n.missingFor({name:c,args:p.args},t);if(g)return{ok:!1,error:g.message,reason:"missing"};let A=z(n,t,n.preview({name:c,args:p.args},void 0,{author:t})),M=et(A);return{ok:!0,data:p.resolved.length>0?{...M,resolved:p.resolved}:M}}case"act_on_several":{let l=String(u.act??""),c=f(l)??l,p=r.find(R=>R.name===c);if(!p||!i.has(c)){let R=p?n.permits({name:c,args:{}},t):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.${w(l)} Nothing was changed.`,reason:"invalid"}}let g=p.subject;if(!g)return{ok:!1,error:`"${G(p)}" 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 M=[],I=[];for(let R of A.slice(0,200)){let J=n.resolveRef({name:g.arg,kinds:g.kinds},R,t);if(!J.ok)return{ok:!1,error:`${J.message} Nothing was changed.`,argument:"records",candidates:J.candidates};M.push(J.id),J.by!=="id"&&I.push({argument:"records",given:R,id:J.id,label:J.label})}let D=y(c,{...u.args??{}});if("ok"in D)return D;let x=(await Ot()).actOnSeveral(n,{mutation:c,subject:g.arg,args:D.args},M,{author:t,...V(e.via)}),P=x.result?z(n,t,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}:{},...P?{introduces:P.introduces.map($),resolves:P.resolves.map($)}:{},...I.length>0||D.resolved.length>0?{resolved:[...I,...D.resolved]}:{}},...P?{diff:P.diff}:{}}}case"subscribe":case"unsubscribe":case"list_subscriptions":{let l=await(await Rt()).runSubscriptionTool(S.name,u,{store:n,principal:e.subscriber??t,app:e.app?.name??"app",subscriptions:e.subscriptions});return l.ok?{ok:!0,data:l.data}:{ok:!1,error:l.error}}case"list_app_suggestions":return{ok:!0,data:{suggestions:(await e.learned()).map(({key:c,said:p,why:g,edits:A,evidence:M})=>({key:c,said:p,why:g,edits:A,evidence:M}))}};case"list_suggestions":{let l=Ee(n,t).map(c=>{let p=W(c.author,{graph:k.graph,schema:n.schema});return{id:c.id,intent:c.intent,by:p,at:c.at,about:c.about,...c.lineage?{basis:{untrusted:!0,authoredBy:p,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(p=>({name:f(p.act)??p.act,args:p.args}));return{ok:!0,data:{suggestion:Je(n,l,{author:t,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:t,...V(e.via)},p=S.name==="accept_suggestion"?je(n,l,c):ze(n,l,c),g=z(n,t,p);return{ok:!0,data:{batch:g.batch,intent:g.intent,introduces:g.introduces.map($),resolves:g.resolves.map($)},diff:g.diff}}case"undo_batch":{let l=String(u.batch),c=u.include??[],p=k.canUndo([l,...c]);if(!p.ok)return{ok:!1,error:p.message};let g=z(n,t,n.undo([l,...c],{...e.author?{author:e.author}:{}}));return{ok:!0,data:et(g),diff:g.diff}}default:return{ok:!1,error:`Unknown tool "${m}".`}}}catch(S){let{reason:k,wouldNeed:l}=ve(S);return{ok:!1,error:S instanceof Error?S.message:String(S),reason:k,...l?{wouldNeed:l}:{}}}},O=new Set,v=m=>{for(let u of O)u(m)};return{definitions:o,hash:d,...e.author?{author:e.author}:{},onDiff(m){return n.subscribe(m)},onCall(m){return O.add(m),()=>O.delete(m)},async call(m,u){let S=h(m)?.mutating??!1,k={name:m,args:u,mutating:S,at:new Date().toISOString()};v({...k,phase:"running"});let l=p=>(v(p.ok?{...k,phase:"ok",...!S&&p.reads?{reads:p.reads}:{}}:{...k,phase:"failed",error:p.error}),p),c=await _(m,u);return l(c.ok&&!S?{...c,data:(await q()).withinReadChars(m,c.data)}:c)}}}function V(n){let e=typeof n=="function"?n():n;return e?{via:e}:{}}export{le as a,On as b};