graview 0.1.49 → 0.1.51

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 (205) hide show
  1. package/dist/preview/{chunk.THENABJU.js → chunk.2534FLZZ.js} +1 -1
  2. package/dist/preview/chunk.25VJPUDH.js +1 -0
  3. package/dist/preview/{chunk.AGVFW6WC.js → chunk.2VJ52LGS.js} +1 -1
  4. package/dist/preview/{chunk.KDTNKKOY.js → chunk.2W2YVB6X.js} +1 -1
  5. package/dist/preview/chunk.2W45NM7Q.js +9 -0
  6. package/dist/preview/chunk.32BOL7OL.js +1 -0
  7. package/dist/preview/chunk.34HGT7HQ.js +1 -0
  8. package/dist/preview/{chunk.CXIIRL67.js → chunk.353CGK6C.js} +1 -1
  9. package/dist/preview/{chunk.NQ7SRWXA.js → chunk.3H7YIKKC.js} +1 -1
  10. package/dist/preview/{chunk.PBCT33FF.js → chunk.3MU37W5D.js} +1 -1
  11. package/dist/preview/chunk.3SBTQ66X.js +1 -0
  12. package/dist/preview/{chunk.3NEALGMI.js → chunk.3TVAE7LE.js} +1 -1
  13. package/dist/preview/{chunk.6RLFO5GA.js → chunk.4EZFOZBA.js} +1 -1
  14. package/dist/preview/chunk.4N5R4K6O.js +1 -0
  15. package/dist/preview/{chunk.NUUT37ER.js → chunk.4T67XS2D.js} +1 -1
  16. package/dist/preview/chunk.5ON3JSAK.js +1 -0
  17. package/dist/preview/{chunk.RMWLV3PR.js → chunk.5ZAK57JA.js} +2 -2
  18. package/dist/preview/chunk.6KYWJXZR.js +1 -0
  19. package/dist/preview/chunk.76QSPWSJ.js +1 -0
  20. package/dist/preview/{chunk.VSWEKNKS.js → chunk.7G4M2PX3.js} +2 -2
  21. package/dist/preview/{chunk.DFGXNFFE.js → chunk.7GAC7U34.js} +1 -1
  22. package/dist/preview/chunk.7NQROWHU.js +1 -0
  23. package/dist/preview/{chunk.7SGQ3HFG.js → chunk.7RIFDWDF.js} +1 -1
  24. package/dist/preview/chunk.ACB4TD4W.js +1 -0
  25. package/dist/preview/chunk.AJAMTRZ3.js +1 -0
  26. package/dist/preview/chunk.AL45OI4A.js +1 -0
  27. package/dist/preview/{chunk.7JLYEZW4.js → chunk.AL7LFNOS.js} +1 -1
  28. package/dist/preview/{chunk.OS75HEZP.js → chunk.ALCH5H7U.js} +1 -1
  29. package/dist/preview/chunk.APFRPN5S.js +1 -0
  30. package/dist/preview/{chunk.MUHFZXPS.js → chunk.AZOW57MT.js} +1 -1
  31. package/dist/preview/chunk.B4PUI3GO.js +1 -0
  32. package/dist/preview/chunk.B6LKLV32.js +1 -0
  33. package/dist/preview/{chunk.QWX2N2VD.js → chunk.B7LBG4UP.js} +1 -1
  34. package/dist/preview/{chunk.B2BLZDBD.js → chunk.BV6HKTHK.js} +1 -1
  35. package/dist/preview/{chunk.2QKSWK4U.js → chunk.BYY7YXBI.js} +1 -1
  36. package/dist/preview/{chunk.REANMQ6K.js → chunk.CI4DEKPX.js} +1 -1
  37. package/dist/preview/{chunk.DSNHE4MZ.js → chunk.CMEETACI.js} +1 -1
  38. package/dist/preview/{chunk.EJAVIZ7Y.js → chunk.CQPNDJAC.js} +1 -1
  39. package/dist/preview/{chunk.4SEY7VWZ.js → chunk.CTOBNZLM.js} +1 -1
  40. package/dist/preview/chunk.CUB4IAUJ.js +1 -0
  41. package/dist/preview/chunk.CUN4VN42.js +1 -0
  42. package/dist/preview/chunk.CV55N3Y6.js +1 -0
  43. package/dist/preview/{chunk.4OTESF7W.js → chunk.CXC5FOIO.js} +1 -1
  44. package/dist/preview/{chunk.BNU3KXKL.js → chunk.DEH6O3K4.js} +1 -1
  45. package/dist/preview/chunk.DQNN5FE5.js +1 -0
  46. package/dist/preview/chunk.DUY27OJV.js +1 -0
  47. package/dist/preview/chunk.E2R6VFZX.js +1 -0
  48. package/dist/preview/{chunk.GEY4MA4D.js → chunk.EA2NMVRE.js} +1 -1
  49. package/dist/preview/chunk.ESK3UZRC.js +1 -0
  50. package/dist/preview/{chunk.KJBXNMIU.js → chunk.ESSENNHM.js} +2 -2
  51. package/dist/preview/{chunk.AOEXSQDG.js → chunk.ET3XJDPX.js} +1 -1
  52. package/dist/preview/chunk.FEIJ7ETK.js +1 -0
  53. package/dist/preview/{chunk.FUMQLGNM.js → chunk.FFCUZPTC.js} +1 -1
  54. package/dist/preview/chunk.FG5ZFYYL.js +1 -0
  55. package/dist/preview/{chunk.TABIRLQS.js → chunk.FKJ3HIA5.js} +1 -1
  56. package/dist/preview/chunk.FTBH7CPZ.js +1 -0
  57. package/dist/preview/chunk.FU4YSVWX.js +1 -0
  58. package/dist/preview/{chunk.XMOIMPUC.js → chunk.FYDDFOSD.js} +1 -1
  59. package/dist/preview/{chunk.N2S3TMBC.js → chunk.GJQF7I22.js} +1 -1
  60. package/dist/preview/{chunk.NQDGUIUQ.js → chunk.GLTWLQ6L.js} +1 -1
  61. package/dist/preview/chunk.GMAXA5GV.js +1 -0
  62. package/dist/preview/{chunk.BTORFVKO.js → chunk.GRYS6VSF.js} +1 -1
  63. package/dist/preview/{chunk.423SZS7C.js → chunk.GYTVL6GR.js} +3 -3
  64. package/dist/preview/chunk.HASVT7IC.js +1 -0
  65. package/dist/preview/{chunk.IQHVVQEA.js → chunk.HFKGND5Q.js} +1 -1
  66. package/dist/preview/chunk.HVX7LFWR.js +1 -0
  67. package/dist/preview/chunk.IBJBCZKG.js +1 -0
  68. package/dist/preview/{chunk.7MJGZHTS.js → chunk.IE4ZJQV3.js} +1 -1
  69. package/dist/preview/chunk.IFL2MYTQ.js +1 -0
  70. package/dist/preview/{chunk.2N6RQ427.js → chunk.IUIDDNN3.js} +1 -1
  71. package/dist/preview/chunk.JBR66TUP.js +1 -0
  72. package/dist/preview/chunk.JG2FGZF2.js +18 -0
  73. package/dist/preview/{chunk.SIVMZNHZ.js → chunk.JI2UVZUU.js} +1 -1
  74. package/dist/preview/{chunk.D25QV6DK.js → chunk.JMDKAP23.js} +1 -1
  75. package/dist/preview/chunk.JX2C3HVD.js +1 -0
  76. package/dist/preview/{chunk.MU5WUTVF.js → chunk.K7ECYKZL.js} +1 -1
  77. package/dist/preview/{chunk.X4MTZKL3.js → chunk.K7RKWB2K.js} +1 -1
  78. package/dist/preview/chunk.KK46XLGU.js +1 -0
  79. package/dist/preview/chunk.KOBCLWPC.js +1 -0
  80. package/dist/preview/chunk.KRODTMGR.js +1 -0
  81. package/dist/preview/chunk.KYKHZZT7.js +1 -0
  82. package/dist/preview/chunk.LYIHPVDZ.js +1 -0
  83. package/dist/preview/{chunk.BVXOLZQ3.js → chunk.MG3DMURZ.js} +1 -1
  84. package/dist/preview/{chunk.ERWBI2NK.js → chunk.MMVCZOEX.js} +1 -1
  85. package/dist/preview/{chunk.FIS27KW4.js → chunk.MN6WHE4B.js} +1 -1
  86. package/dist/preview/{chunk.4D26JY5U.js → chunk.MRXQBEPQ.js} +1 -1
  87. package/dist/preview/{chunk.NB6WN4DO.js → chunk.MX3Y3LPH.js} +1 -1
  88. package/dist/preview/{chunk.AVDXG57A.js → chunk.MY5OXSS7.js} +1 -1
  89. package/dist/preview/chunk.N5XONWU2.js +1 -0
  90. package/dist/preview/chunk.NNUUD26E.js +1 -0
  91. package/dist/preview/{chunk.6EHE26ZS.js → chunk.NQ26KMSQ.js} +1 -1
  92. package/dist/preview/{chunk.LD6S2FL5.js → chunk.NVRK6A7T.js} +1 -1
  93. package/dist/preview/{chunk.MJ4XTNTL.js → chunk.NZDHXREL.js} +1 -1
  94. package/dist/preview/chunk.OHDJYGH7.js +2 -0
  95. package/dist/preview/{chunk.2OXXGN7C.js → chunk.OJ64WTLW.js} +2 -2
  96. package/dist/preview/{chunk.EM5CGFNB.js → chunk.OPCBZNKF.js} +1 -1
  97. package/dist/preview/{chunk.GRLPNTUW.js → chunk.OU5TRY4N.js} +1 -1
  98. package/dist/preview/chunk.OW72XZF4.js +1 -0
  99. package/dist/preview/chunk.P4CLT32V.js +5 -0
  100. package/dist/preview/chunk.PFXGWY3P.js +1 -0
  101. package/dist/preview/{chunk.QQE7N7LB.js → chunk.PMV6XVVZ.js} +1 -1
  102. package/dist/preview/{chunk.PCVU3LY3.js → chunk.PPZ2TOB5.js} +1 -1
  103. package/dist/preview/{chunk.QBHVBL42.js → chunk.PYRJDTVS.js} +1 -1
  104. package/dist/preview/chunk.QEQQXWYU.js +1 -0
  105. package/dist/preview/chunk.QPAJCRFB.js +1 -0
  106. package/dist/preview/chunk.R5R7CLOU.js +1 -0
  107. package/dist/preview/{chunk.TBA4GF34.js → chunk.RMMJQYJJ.js} +1 -1
  108. package/dist/preview/{chunk.2CO2EJQA.js → chunk.RNOBACJ6.js} +1 -1
  109. package/dist/preview/{chunk.ZILULTJJ.js → chunk.S32AGJ3W.js} +1 -1
  110. package/dist/preview/chunk.S4CKKT3C.js +1 -0
  111. package/dist/preview/{chunk.4Q5KWYVY.js → chunk.SJKHVIHA.js} +2 -2
  112. package/dist/preview/chunk.SJYQ72EC.js +1 -0
  113. package/dist/preview/chunk.SKG4IHT5.js +88 -0
  114. package/dist/preview/chunk.SLBWPVIY.js +1 -0
  115. package/dist/preview/{chunk.7JW5SHRR.js → chunk.SPU3BVAO.js} +1 -1
  116. package/dist/preview/chunk.SRFZKDQ6.js +1 -0
  117. package/dist/preview/{chunk.RSR2M7ZO.js → chunk.SSAY4ITS.js} +2 -2
  118. package/dist/preview/{chunk.XN7PIWVC.js → chunk.T3RTFTOZ.js} +1 -1
  119. package/dist/preview/{chunk.AP22NNIM.js → chunk.TBSPEO2L.js} +1 -1
  120. package/dist/preview/chunk.TMYGLXR6.js +25 -0
  121. package/dist/preview/{chunk.D53IGR45.js → chunk.TNL2BVCH.js} +1 -1
  122. package/dist/preview/{chunk.BJR6E2CT.js → chunk.TVWN5I4M.js} +1 -1
  123. package/dist/preview/{chunk.RI624PFK.js → chunk.U7SNDY3F.js} +1 -1
  124. package/dist/preview/chunk.UCUWEYKM.js +1 -0
  125. package/dist/preview/{chunk.ON35FJ5H.js → chunk.UIWI4GKW.js} +1 -1
  126. package/dist/preview/{chunk.N2S45SSL.js → chunk.UK5F3S2N.js} +1 -1
  127. package/dist/preview/{chunk.H42WBU5C.js → chunk.UVAWWCFW.js} +1 -1
  128. package/dist/preview/{chunk.UL43GFVC.js → chunk.UWFEXEY3.js} +1 -1
  129. package/dist/preview/chunk.V4GAOZAW.js +1 -0
  130. package/dist/preview/{chunk.A7HMVWMG.js → chunk.VICCAWAN.js} +1 -1
  131. package/dist/preview/{chunk.EYSQPXVE.js → chunk.W2DKFQ6R.js} +1 -1
  132. package/dist/preview/{chunk.TSHBXCMU.js → chunk.WESWDXRW.js} +1 -1
  133. package/dist/preview/{chunk.O3ONLQUF.js → chunk.WFHFWJ6E.js} +1 -1
  134. package/dist/preview/{chunk.YECMUK4X.js → chunk.WQLAIEWJ.js} +1 -1
  135. package/dist/preview/{chunk.G3Q5CYEM.js → chunk.XCCBUWMC.js} +1 -1
  136. package/dist/preview/{chunk.3EW6L5DY.js → chunk.XCQ7ZPR5.js} +1 -1
  137. package/dist/preview/chunk.XWXYC3BJ.js +1 -0
  138. package/dist/preview/chunk.XZVPVAIS.js +1 -0
  139. package/dist/preview/chunk.Y2ZBVWII.js +1 -0
  140. package/dist/preview/chunk.Y3LTHEN7.js +1 -0
  141. package/dist/preview/{chunk.WQN7EFW3.js → chunk.Y5AMZBHA.js} +2 -2
  142. package/dist/preview/{chunk.35FUGOSG.js → chunk.Z7N3MJ36.js} +1 -1
  143. package/dist/preview/chunk.ZJXUWOG3.js +1 -0
  144. package/dist/preview/{chunk.OFBESPHJ.js → chunk.ZZODDJYK.js} +1 -1
  145. package/dist/preview/index.html +51 -51
  146. package/dist/preview/page.js +2 -2
  147. package/package.json +6 -6
  148. package/dist/preview/chunk.2AZTW66C.js +0 -1
  149. package/dist/preview/chunk.2OLZ6BYI.js +0 -1
  150. package/dist/preview/chunk.4K7I7WYF.js +0 -1
  151. package/dist/preview/chunk.4QINLTDZ.js +0 -1
  152. package/dist/preview/chunk.4XKACWLT.js +0 -1
  153. package/dist/preview/chunk.52QB4YW2.js +0 -1
  154. package/dist/preview/chunk.54PZWX23.js +0 -1
  155. package/dist/preview/chunk.5YFO6D7J.js +0 -1
  156. package/dist/preview/chunk.6EGHJCEM.js +0 -1
  157. package/dist/preview/chunk.6WRA3Y7D.js +0 -1
  158. package/dist/preview/chunk.7C4IR4S7.js +0 -1
  159. package/dist/preview/chunk.7MWLDDFL.js +0 -1
  160. package/dist/preview/chunk.B445DZOY.js +0 -1
  161. package/dist/preview/chunk.BH365UJ5.js +0 -1
  162. package/dist/preview/chunk.BU6V76EF.js +0 -1
  163. package/dist/preview/chunk.C75I24Z5.js +0 -1
  164. package/dist/preview/chunk.D4IKO5YA.js +0 -18
  165. package/dist/preview/chunk.D4K23FUB.js +0 -1
  166. package/dist/preview/chunk.D66RI4QS.js +0 -1
  167. package/dist/preview/chunk.DTRNDSMS.js +0 -1
  168. package/dist/preview/chunk.DV4GSLGX.js +0 -9
  169. package/dist/preview/chunk.E2AJ7U5Z.js +0 -1
  170. package/dist/preview/chunk.EPTUOPPC.js +0 -1
  171. package/dist/preview/chunk.FNK2ZZ5E.js +0 -1
  172. package/dist/preview/chunk.FOYVTN5B.js +0 -1
  173. package/dist/preview/chunk.G25JEYCC.js +0 -1
  174. package/dist/preview/chunk.IVHPJUFM.js +0 -1
  175. package/dist/preview/chunk.IWEPDTVG.js +0 -1
  176. package/dist/preview/chunk.IYLOA3MV.js +0 -1
  177. package/dist/preview/chunk.JBG5UQLM.js +0 -1
  178. package/dist/preview/chunk.KLAEKRCA.js +0 -1
  179. package/dist/preview/chunk.LUL6PFIQ.js +0 -1
  180. package/dist/preview/chunk.NBJ4C33P.js +0 -1
  181. package/dist/preview/chunk.OKHEZJBX.js +0 -1
  182. package/dist/preview/chunk.OL5D7YTW.js +0 -1
  183. package/dist/preview/chunk.OTF3NNTI.js +0 -1
  184. package/dist/preview/chunk.P2AC6JRL.js +0 -88
  185. package/dist/preview/chunk.PFEKS3KO.js +0 -5
  186. package/dist/preview/chunk.PFR3FQBR.js +0 -1
  187. package/dist/preview/chunk.Q4KNNJFL.js +0 -1
  188. package/dist/preview/chunk.QPNFWP4Z.js +0 -1
  189. package/dist/preview/chunk.QQRLUBWQ.js +0 -1
  190. package/dist/preview/chunk.R5IRHCLZ.js +0 -1
  191. package/dist/preview/chunk.SGJSJGSR.js +0 -1
  192. package/dist/preview/chunk.SPZVEQC5.js +0 -1
  193. package/dist/preview/chunk.SR2345SW.js +0 -1
  194. package/dist/preview/chunk.ST4JHXPS.js +0 -1
  195. package/dist/preview/chunk.TM6JVVGW.js +0 -25
  196. package/dist/preview/chunk.UT6642FC.js +0 -1
  197. package/dist/preview/chunk.UTRIPGW6.js +0 -1
  198. package/dist/preview/chunk.VV3PNZPI.js +0 -1
  199. package/dist/preview/chunk.W6CGAPNQ.js +0 -1
  200. package/dist/preview/chunk.XJ7YGW6Y.js +0 -1
  201. package/dist/preview/chunk.XXZFWZ4C.js +0 -1
  202. package/dist/preview/chunk.YSFNPYCD.js +0 -2
  203. package/dist/preview/chunk.YXOJKGRC.js +0 -1
  204. package/dist/preview/chunk.ZBL47SFK.js +0 -1
  205. /package/dist/preview/{chunk.4HUB3N7I.js → chunk.KHRS2SKB.js} +0 -0
@@ -1 +1 @@
1
- import{a as v,c as h}from"./chunk.KDTNKKOY.js";import{L as b,N as S}from"./chunk.PFEKS3KO.js";var P=Symbol.for("@graview/core:file"),T=Symbol.for("@graview/core:node-ref"),p=e=>typeof e=="object"&&e!==null?e._zod?.def:void 0;function w(e){let i=p(e);return i?.[P]??(i?.innerType?w(i.innerType):void 0)}function x(e){let i=w(e);if(i)return{as:i,list:!1};let n=p(e);for(;n?.innerType;)n=p(n.innerType);let s=n?.type==="array"?w(n.element):void 0;return s?{as:s,list:!0}:void 0}function A(e){if(typeof e!="object"||e===null)return;let i=e[T];if(i)return i;let n=p(e);return n?.[T]??(n?.innerType?A(n.innerType):void 0)}function H(e){let i=e?.shape??{};return Object.entries(i).flatMap(([n,s])=>{let r=A(s);return r?[{name:n,kinds:r}]:[]})}var K=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.href=="string"&&typeof e.name=="string"&&typeof e.type=="string"&&typeof e.bytes=="number",W=e=>(Array.isArray(e)?e:[e]).filter(K);function I(e,i,n){let r=e.schema.tryDefinition(i)?.fields?.shape?.[n];return r===void 0?void 0:x(r)}function N(e,i){if(e===void 0)return[];if(!Array.isArray(e))return[`The view's accepts is a list of { "kind": <a kind>, "field": <its image, video or file field> }.`];let n=[],s=new Set(i.schema.kinds);for(let r of e){let{kind:l,field:a}=r??{};typeof l!="string"||typeof a!="string"?n.push(`Each of the view's accepts is { "kind": <a kind>, "field": <its image, video or file field> }.`):s.has(l)?I(i,l,a)?i.allMutations().some(o=>(o.creates??[]).includes(l)&&Object.hasOwn(o.input?.shape??{},a))||n.push(`No act of this app makes a "${l}" with its "${a}", so a file dropped could become nothing.`):n.push(`The view accepts files into ${l}'s "${a}", which holds no picture, video or file.`):n.push(`The view accepts files for "${l}", which is no kind of this app.`)}return n}function D(e){if(e===void 0||e===!0)return[];if(typeof e!="object"||e===null||Array.isArray(e))return[`The view's pictures is true, or { "width": <the widest it draws a picture, in pixels> }.`];let{width:i,...n}=e,s=[];return Object.keys(n).length>0&&s.push(`The view's pictures says ${Object.keys(n).map(r=>`"${r}"`).join(", ")}: only "width" is read.`),i!==void 0&&!(Number.isInteger(i)&&i>=16&&i<=4096)&&s.push("The view's pictures width is a whole number of pixels from 16 to 4096."),s}function E(e){if(e===void 0)return[];if(typeof e!="object"||e===null||Array.isArray(e))return[`The view's scene is { "maxHeight": <the tallest its preview on the Scene is drawn, in pixels> }.`];let{maxHeight:i,...n}=e,s=[];return Object.keys(n).length>0&&s.push(`The view's scene says ${Object.keys(n).map(r=>`"${r}"`).join(", ")}: only "maxHeight" is read.`),i!==void 0&&!(Number.isInteger(i)&&i>=80&&i<=4e3)&&s.push("The view's scene maxHeight is a whole number of pixels from 80 to 4000."),s}function F(e){return(e.acts??[]).map(i=>typeof i=="string"?{act:i}:i)}function B(e,i){let n=[],s=new Set(i.schema.kinds),r=new Set(i.schema.edgeKinds),l=new Set(i.allMutations().map(o=>o.name));(typeof e.name!="string"||!/^[a-z0-9][a-z0-9-]{0,62}$/.test(e.name))&&n.push(`The view's name "${String(e.name)}" is not lower-case letters, digits and hyphens.`),e.title!==void 0&&(typeof e.title!="string"||e.title.trim()===""||e.title.length>80)&&n.push("The view's title is empty or longer than 80 characters."),e.attach!=="home"&&!s.has(e.attach)&&n.push(`The view attaches to "${e.attach}", which is no kind of this app.`),e.cardinality!=="one"&&e.cardinality!=="many"&&n.push(`The view's cardinality is "${String(e.cardinality)}", not one or many.`),e.attach==="home"&&e.cardinality!=="many"&&n.push("A view of the home draws many records: its cardinality is many."),e.replaces!==void 0&&e.replaces!=="page"?n.push(`The view's replaces is "${String(e.replaces)}": the one thing a view replaces is "page", or leave it out to draw the view above the record's own fields.`):e.replaces==="page"&&(e.attach==="home"||e.cardinality!=="one")&&n.push('Only a view of one record replaces its page: replaces "page" needs cardinality one on a kind.'),e.gestures!==void 0&&typeof e.gestures!="boolean"&&n.push(`The view's gestures is "${String(e.gestures)}": it is true, or left out.`),e.bleed!==void 0&&typeof e.bleed!="boolean"&&n.push(`The view's bleed is "${String(e.bleed)}": it is true, or left out.`),e.flows!==void 0&&typeof e.flows!="boolean"?n.push(`The view's flows is "${String(e.flows)}": it is false for a view that keeps its place's frame, or left out.`):e.flows===!1&&(e.attach==="home"||e.cardinality!=="many"||e.title===void 0)&&n.push("Only a view that is a place keeps a frame: flows false needs a title and cardinality many on a kind."),n.push(...E(e.scene)),e.scene!==void 0&&(e.attach==="home"||e.cardinality!=="many")&&n.push("Only a view of a kind's members is drawn on the Scene as a card: scene needs cardinality many on a kind."),n.push(...D(e.pictures)),n.push(...N(e.accepts,i));for(let o of e.reads?.kinds??[])s.has(o)||n.push(`The view reads "${o}", which is no kind of this app.`);for(let o of e.reads?.edges??[])r.has(o)||n.push(`The view reads the edge "${o}", which no kind of this app declares.`);let a=new Set;for(let o of F(e)){l.has(o.act)||n.push(`The view asks for the act "${o.act}", which this app does not declare.`);let c=o.as??o.act;a.has(c)&&n.push(`Two of the view's acts are called "${c}".`),a.add(c)}return n}function L(e,i,n){let{manifest:s}=n,r=n.input??{},a=e.seenBy(i).graph,o=s.attach==="home"?void 0:s.attach,c=o&&s.cardinality==="one"&&r.node?a.getNode(r.node.id):void 0,f=c&&c.kind===o?[c]:[],g=o&&s.cardinality==="many"?r.nodes?r.nodes.flatMap(t=>{let d=a.getNode(t.id);return d&&d.kind===o?[d]:[]}):a.nodesOfKind(o):[],$=new Set([...f,...g].map(t=>t.id)),m=v(a,$,{kinds:(s.reads?.kinds??[]).filter(t=>t!==o||s.cardinality==="one"),edges:s.reads?.edges??[]}),u=new Map;for(let t of[...g,...m.nodes])f.some(d=>d.id===t.id)||u.set(t.id,t);let j=new Set([...f.map(t=>t.id),...u.keys()]),O=[...m.edges],M=new Set(F(s).map(t=>t.act)),V=e.permittedMutations(i).filter(t=>M.has(t.name)).map(t=>({name:t.name,title:t.title??t.name,...t.description!==void 0?{description:t.description}:{},...t.subject?{subject:{kinds:t.subject.kinds,arg:t.subject.arg}}:{}})),k=t=>t?.filter(d=>j.has(d));return{view:s.name,...f[0]?{node:h(e,f[0])}:{},nodes:[...u.values()].map(t=>h(e,t)),edges:O,...s.title!==void 0?{label:s.title}:r.label!==void 0?{label:r.label}:{},cardinality:s.cardinality,...r.fidelity!==void 0?{fidelity:r.fidelity}:{},...r.mode!==void 0?{mode:r.mode}:{},...r.selected!==void 0?{selected:r.selected}:{},...r.implicated?{implicated:k(r.implicated)}:{},...r.flagged?{flagged:k(r.flagged)}:{},acts:V,...n.theme?{theme:n.theme}:{},locale:b(),timeZone:S(),...n.places?{places:n.places.filter((t,d,y)=>y.findIndex(G=>G.as===t.as)===d).map(({as:t,title:d,kind:y})=>({as:t,title:d,kind:y}))}:{}}}export{H as a,K as b,W as c,I as d,F as e,B as f,L as g};
1
+ import{a as v,c as h}from"./chunk.2W2YVB6X.js";import{L as b,N as S}from"./chunk.P4CLT32V.js";var P=Symbol.for("@graview/core:file"),T=Symbol.for("@graview/core:node-ref"),p=e=>typeof e=="object"&&e!==null?e._zod?.def:void 0;function w(e){let i=p(e);return i?.[P]??(i?.innerType?w(i.innerType):void 0)}function x(e){let i=w(e);if(i)return{as:i,list:!1};let n=p(e);for(;n?.innerType;)n=p(n.innerType);let s=n?.type==="array"?w(n.element):void 0;return s?{as:s,list:!0}:void 0}function A(e){if(typeof e!="object"||e===null)return;let i=e[T];if(i)return i;let n=p(e);return n?.[T]??(n?.innerType?A(n.innerType):void 0)}function H(e){let i=e?.shape??{};return Object.entries(i).flatMap(([n,s])=>{let r=A(s);return r?[{name:n,kinds:r}]:[]})}var K=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.href=="string"&&typeof e.name=="string"&&typeof e.type=="string"&&typeof e.bytes=="number",W=e=>(Array.isArray(e)?e:[e]).filter(K);function I(e,i,n){let r=e.schema.tryDefinition(i)?.fields?.shape?.[n];return r===void 0?void 0:x(r)}function N(e,i){if(e===void 0)return[];if(!Array.isArray(e))return[`The view's accepts is a list of { "kind": <a kind>, "field": <its image, video or file field> }.`];let n=[],s=new Set(i.schema.kinds);for(let r of e){let{kind:l,field:a}=r??{};typeof l!="string"||typeof a!="string"?n.push(`Each of the view's accepts is { "kind": <a kind>, "field": <its image, video or file field> }.`):s.has(l)?I(i,l,a)?i.allMutations().some(o=>(o.creates??[]).includes(l)&&Object.hasOwn(o.input?.shape??{},a))||n.push(`No act of this app makes a "${l}" with its "${a}", so a file dropped could become nothing.`):n.push(`The view accepts files into ${l}'s "${a}", which holds no picture, video or file.`):n.push(`The view accepts files for "${l}", which is no kind of this app.`)}return n}function D(e){if(e===void 0||e===!0)return[];if(typeof e!="object"||e===null||Array.isArray(e))return[`The view's pictures is true, or { "width": <the widest it draws a picture, in pixels> }.`];let{width:i,...n}=e,s=[];return Object.keys(n).length>0&&s.push(`The view's pictures says ${Object.keys(n).map(r=>`"${r}"`).join(", ")}: only "width" is read.`),i!==void 0&&!(Number.isInteger(i)&&i>=16&&i<=4096)&&s.push("The view's pictures width is a whole number of pixels from 16 to 4096."),s}function E(e){if(e===void 0)return[];if(typeof e!="object"||e===null||Array.isArray(e))return[`The view's scene is { "maxHeight": <the tallest its preview on the Scene is drawn, in pixels> }.`];let{maxHeight:i,...n}=e,s=[];return Object.keys(n).length>0&&s.push(`The view's scene says ${Object.keys(n).map(r=>`"${r}"`).join(", ")}: only "maxHeight" is read.`),i!==void 0&&!(Number.isInteger(i)&&i>=80&&i<=4e3)&&s.push("The view's scene maxHeight is a whole number of pixels from 80 to 4000."),s}function F(e){return(e.acts??[]).map(i=>typeof i=="string"?{act:i}:i)}function B(e,i){let n=[],s=new Set(i.schema.kinds),r=new Set(i.schema.edgeKinds),l=new Set(i.allMutations().map(o=>o.name));(typeof e.name!="string"||!/^[a-z0-9][a-z0-9-]{0,62}$/.test(e.name))&&n.push(`The view's name "${String(e.name)}" is not lower-case letters, digits and hyphens.`),e.title!==void 0&&(typeof e.title!="string"||e.title.trim()===""||e.title.length>80)&&n.push("The view's title is empty or longer than 80 characters."),e.attach!=="home"&&!s.has(e.attach)&&n.push(`The view attaches to "${e.attach}", which is no kind of this app.`),e.cardinality!=="one"&&e.cardinality!=="many"&&n.push(`The view's cardinality is "${String(e.cardinality)}", not one or many.`),e.attach==="home"&&e.cardinality!=="many"&&n.push("A view of the home draws many records: its cardinality is many."),e.replaces!==void 0&&e.replaces!=="page"?n.push(`The view's replaces is "${String(e.replaces)}": the one thing a view replaces is "page", or leave it out to draw the view above the record's own fields.`):e.replaces==="page"&&(e.attach==="home"||e.cardinality!=="one")&&n.push('Only a view of one record replaces its page: replaces "page" needs cardinality one on a kind.'),e.gestures!==void 0&&typeof e.gestures!="boolean"&&n.push(`The view's gestures is "${String(e.gestures)}": it is true, or left out.`),e.bleed!==void 0&&typeof e.bleed!="boolean"&&n.push(`The view's bleed is "${String(e.bleed)}": it is true, or left out.`),e.flows!==void 0&&typeof e.flows!="boolean"?n.push(`The view's flows is "${String(e.flows)}": it is false for a view that keeps its place's frame, or left out.`):e.flows===!1&&(e.attach==="home"||e.cardinality!=="many"||e.title===void 0)&&n.push("Only a view that is a place keeps a frame: flows false needs a title and cardinality many on a kind."),n.push(...E(e.scene)),e.scene!==void 0&&(e.attach==="home"||e.cardinality!=="many")&&n.push("Only a view of a kind's members is drawn on the Scene as a card: scene needs cardinality many on a kind."),n.push(...D(e.pictures)),n.push(...N(e.accepts,i));for(let o of e.reads?.kinds??[])s.has(o)||n.push(`The view reads "${o}", which is no kind of this app.`);for(let o of e.reads?.edges??[])r.has(o)||n.push(`The view reads the edge "${o}", which no kind of this app declares.`);let a=new Set;for(let o of F(e)){l.has(o.act)||n.push(`The view asks for the act "${o.act}", which this app does not declare.`);let c=o.as??o.act;a.has(c)&&n.push(`Two of the view's acts are called "${c}".`),a.add(c)}return n}function L(e,i,n){let{manifest:s}=n,r=n.input??{},a=e.seenBy(i).graph,o=s.attach==="home"?void 0:s.attach,c=o&&s.cardinality==="one"&&r.node?a.getNode(r.node.id):void 0,f=c&&c.kind===o?[c]:[],g=o&&s.cardinality==="many"?r.nodes?r.nodes.flatMap(t=>{let d=a.getNode(t.id);return d&&d.kind===o?[d]:[]}):a.nodesOfKind(o):[],$=new Set([...f,...g].map(t=>t.id)),m=v(a,$,{kinds:(s.reads?.kinds??[]).filter(t=>t!==o||s.cardinality==="one"),edges:s.reads?.edges??[]}),u=new Map;for(let t of[...g,...m.nodes])f.some(d=>d.id===t.id)||u.set(t.id,t);let j=new Set([...f.map(t=>t.id),...u.keys()]),O=[...m.edges],M=new Set(F(s).map(t=>t.act)),V=e.permittedMutations(i).filter(t=>M.has(t.name)).map(t=>({name:t.name,title:t.title??t.name,...t.description!==void 0?{description:t.description}:{},...t.subject?{subject:{kinds:t.subject.kinds,arg:t.subject.arg}}:{}})),k=t=>t?.filter(d=>j.has(d));return{view:s.name,...f[0]?{node:h(e,f[0])}:{},nodes:[...u.values()].map(t=>h(e,t)),edges:O,...s.title!==void 0?{label:s.title}:r.label!==void 0?{label:r.label}:{},cardinality:s.cardinality,...r.fidelity!==void 0?{fidelity:r.fidelity}:{},...r.mode!==void 0?{mode:r.mode}:{},...r.selected!==void 0?{selected:r.selected}:{},...r.implicated?{implicated:k(r.implicated)}:{},...r.flagged?{flagged:k(r.flagged)}:{},acts:V,...n.theme?{theme:n.theme}:{},locale:b(),timeZone:S(),...n.places?{places:n.places.filter((t,d,y)=>y.findIndex(G=>G.as===t.as)===d).map(({as:t,title:d,kind:y})=>({as:t,title:d,kind:y}))}:{}}}export{H as a,K as b,W as c,I as d,F as e,B as f,L as g};
@@ -1,4 +1,4 @@
1
- import{a as Bt,b as It,c as Wt,d as Wn}from"./chunk.2OXXGN7C.js";import{a as zt}from"./chunk.Q4KNNJFL.js";import{a as Bn,b as Et,c as In,d as Mt,e as Lt,f as Tt}from"./chunk.WQN7EFW3.js";import{c as Ht,g as Vt,h as Gt,i as jt}from"./chunk.BH365UJ5.js";import{e as $t}from"./chunk.7JW5SHRR.js";import{a as Pt,b as tn,c as Nt,d as Dt}from"./chunk.EYSQPXVE.js";import{b as vt,c as pe,d as ke,e as ze}from"./chunk.AP22NNIM.js";import{m as At}from"./chunk.EM5CGFNB.js";import{a as Ot,b as Rt}from"./chunk.N2S45SSL.js";import{f as kt,h as Ct}from"./chunk.AGVFW6WC.js";import{e as St}from"./chunk.SIVMZNHZ.js";import{e as bt}from"./chunk.NQDGUIUQ.js";import{l as xt,m as zn}from"./chunk.FOYVTN5B.js";import{f as Nn,g as Dn}from"./chunk.A7HMVWMG.js";import{k as Fe,m as wt}from"./chunk.423SZS7C.js";import{G as De,Ka as yt,La as nn,R as te,T as ft,_ as oe,aa as ht,l as en}from"./chunk.TM6JVVGW.js";import{Ac as Ze,Bc as mt,Gc as Le,Pa as lt,Ta as dt,Tc as Pn,U as dn,Ua as ct,V as rt,Va as ut,W as at,Wb as gt,X as Mn,Y as it,Z as Xe,ca as Ve,da as Se,ga as qe,ha as cn,ia as ot,ka as Ln,kc as be,la as st,ma as un,od as pt,pb as Tn}from"./chunk.PFEKS3KO.js";import{b as U}from"./chunk.AJZBJBMO.js";var Dr=U(De(),1);var Hn=U(te(),1);function Be(e,t,n){let r=e.nodes?.length??0;if(e.total===void 0||e.total<=r)return n;let a=e.nodes?.[0]?.kind,i=a?cn(t,a).toLowerCase():"more";return(0,Hn.jsxs)("div",{style:{display:"grid",gridTemplateRows:"minmax(0, 1fr) auto",height:"100%",minHeight:0},children:[n,(0,Hn.jsxs)("p",{"data-testid":"lens-more",style:{margin:"4px 0 0",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["+",e.total-r," more ",i]})]})}var qt=U(te(),1),Br=(e,t)=>{if(e===!1||t===!1)return!1;let n=e===void 0||e===!0?{}:e,r=t===void 0||t===!0?{}:t;return{sort:n.sort!==!1&&r.sort!==!1,filter:n.filter!==!1&&r.filter!==!1,group:n.group!==!1&&r.group!==!1}},Ir=["sort","filter","group","q","archived"];function Te(e,t={}){let{store:n}=oe(),{view:r,go:a}=nn(),s=Ir.some(M=>r.within?.[M]!==void 0)?Ot(r):t.arrangedBy??{},m=e.nodes??[],u=t.kind??m[0]?.kind??e.node?.kind,b=s.archived!==void 0&&s.archived!==!1&&u!==void 0&&!t.subject?n.graph.nodesOfKind(u,{archived:s.archived}):m,l=t.subject??(t.only?b.filter(t.only):b),y=t.subject?[]:t.only?b.filter(M=>!t.only(M)):[],p=t.kind??l[0]?.kind,o=Br(t.allow,t.lensAllows),d=p?St(n.schema,String(p)):void 0,k=d?kt(s,d).arrangement:{},c=Ct(l,o===!1?{}:k,{schema:n.schema,graph:n.graph,flagged:new Set(e.flagged??[]),...t.search?{searchIn:t.search}:{}}),x=e.retired!==void 0&&e.retired>0&&(m[0]?.kind??p)===p?e.retired:0,R=p&&o!==!1&&e.fidelity==="full"&&e.budget===void 0&&(l.length>1||x>0)?(0,qt.jsx)(At,{schema:n.schema,graph:n.graph,kind:String(p),arrangement:k,allow:o,query:t.query!==!1,...t.filters?{filters:t.filters,chips:{nodes:l,flagged:new Set(e.flagged??[])}}:{},onChange:M=>a(Rt(r,M)),kept:{shown:c.nodes.length,of:l.length},...x>0?{past:{count:x,widen:()=>a($t(r,!0))}}:{}}):null;return{nodes:[...y,...c.nodes],arranged:c,arrangement:k,bar:R}}function _e(e,t,n){let r=new Set((n??[]).map(i=>i.kind)),a=new Set((n??[]).map(i=>i.id));return e.allNodes().filter(i=>r.has(i.kind)?a.has(i.id):Ve(t.tryDefinition(i.kind),i))}var Ie=U(De(),1);var j=U(te(),1),Wr=["slots","x","y","fill"],gn=class extends Error{constructor(n,r){super(`${n}
1
+ import{a as Bt,b as It,c as Wt,d as Wn}from"./chunk.OJ64WTLW.js";import{a as zt}from"./chunk.GMAXA5GV.js";import{a as Bn,b as Et,c as In,d as Mt,e as Lt,f as Tt}from"./chunk.Y5AMZBHA.js";import{c as Ht,g as Vt,h as Gt,i as jt}from"./chunk.IBJBCZKG.js";import{e as $t}from"./chunk.SPU3BVAO.js";import{m as At}from"./chunk.OPCBZNKF.js";import{a as Ot,b as Rt}from"./chunk.UK5F3S2N.js";import{f as kt,h as Ct}from"./chunk.2VJ52LGS.js";import{e as St}from"./chunk.JI2UVZUU.js";import{a as Pt,b as tn,c as Nt,d as Dt}from"./chunk.W2DKFQ6R.js";import{b as vt,c as pe,d as ke,e as ze}from"./chunk.TBSPEO2L.js";import{e as bt}from"./chunk.GLTWLQ6L.js";import{l as xt,m as zn}from"./chunk.OW72XZF4.js";import{f as Nn,g as Dn}from"./chunk.VICCAWAN.js";import{k as Fe,m as wt}from"./chunk.GYTVL6GR.js";import{G as De,Ma as yt,Na as nn,T as te,V as ft,aa as oe,ca as ht,l as en}from"./chunk.TMYGLXR6.js";import{$c as Pn,Hc as Ze,Ic as mt,Nc as Le,Pa as lt,Ta as dt,U as dn,Ua as ct,V as rt,Va as ut,W as at,X as Mn,Y as it,Z as Xe,_b as gt,ca as Ve,da as Se,ga as qe,ha as cn,ia as ot,ka as Ln,la as st,ma as un,rc as be,tb as Tn,wd as pt}from"./chunk.P4CLT32V.js";import{b as U}from"./chunk.AJZBJBMO.js";var Dr=U(De(),1);var Hn=U(te(),1);function Be(e,t,n){let r=e.nodes?.length??0;if(e.total===void 0||e.total<=r)return n;let a=e.nodes?.[0]?.kind,i=a?cn(t,a).toLowerCase():"more";return(0,Hn.jsxs)("div",{style:{display:"grid",gridTemplateRows:"minmax(0, 1fr) auto",height:"100%",minHeight:0},children:[n,(0,Hn.jsxs)("p",{"data-testid":"lens-more",style:{margin:"4px 0 0",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["+",e.total-r," more ",i]})]})}var qt=U(te(),1),Br=(e,t)=>{if(e===!1||t===!1)return!1;let n=e===void 0||e===!0?{}:e,r=t===void 0||t===!0?{}:t;return{sort:n.sort!==!1&&r.sort!==!1,filter:n.filter!==!1&&r.filter!==!1,group:n.group!==!1&&r.group!==!1}},Ir=["sort","filter","group","q","archived"];function Te(e,t={}){let{store:n}=oe(),{view:r,go:a}=nn(),s=Ir.some(M=>r.within?.[M]!==void 0)?Ot(r):t.arrangedBy??{},m=e.nodes??[],u=t.kind??m[0]?.kind??e.node?.kind,b=s.archived!==void 0&&s.archived!==!1&&u!==void 0&&!t.subject?n.graph.nodesOfKind(u,{archived:s.archived}):m,l=t.subject??(t.only?b.filter(t.only):b),y=t.subject?[]:t.only?b.filter(M=>!t.only(M)):[],p=t.kind??l[0]?.kind,o=Br(t.allow,t.lensAllows),d=p?St(n.schema,String(p)):void 0,k=d?kt(s,d).arrangement:{},c=Ct(l,o===!1?{}:k,{schema:n.schema,graph:n.graph,flagged:new Set(e.flagged??[]),...t.search?{searchIn:t.search}:{}}),x=e.retired!==void 0&&e.retired>0&&(m[0]?.kind??p)===p?e.retired:0,R=p&&o!==!1&&e.fidelity==="full"&&e.budget===void 0&&(l.length>1||x>0)?(0,qt.jsx)(At,{schema:n.schema,graph:n.graph,kind:String(p),arrangement:k,allow:o,query:t.query!==!1,...t.filters?{filters:t.filters,chips:{nodes:l,flagged:new Set(e.flagged??[])}}:{},onChange:M=>a(Rt(r,M)),kept:{shown:c.nodes.length,of:l.length},...x>0?{past:{count:x,widen:()=>a($t(r,!0))}}:{}}):null;return{nodes:[...y,...c.nodes],arranged:c,arrangement:k,bar:R}}function _e(e,t,n){let r=new Set((n??[]).map(i=>i.kind)),a=new Set((n??[]).map(i=>i.id));return e.allNodes().filter(i=>r.has(i.kind)?a.has(i.id):Ve(t.tryDefinition(i.kind),i))}var Ie=U(De(),1);var j=U(te(),1),Wr=["slots","x","y","fill"],gn=class extends Error{constructor(n,r){super(`${n}
2
2
  ${r}`);this.hint=r;this.name="BoardBindingError"}},Ft=e=>Math.max(0,Math.min(1,e));function Vn(e,t,n,r){let a=d=>d,i=d=>r?Se(r.tryDefinition(d.kind),d):String(a(d).label??d.id);if(r&&r.tryDefinition(n.slots)===void 0)throw new gn(`No kind is declared for "${n.slots}".`,'Check the lens bindings: { slots: "<kind>", x: "<field>", y: "<field>", fill: "<edge kind>" }');let s=e.filter(d=>d.kind===n.slots);if(!r&&s.length===0)throw new gn(`Nothing to arrange: no "${n.slots}" nodes.`,'Check the lens bindings: { slots: "<kind>", x: "<field>", y: "<field>", fill: "<edge kind>" }');let m=t.filter(d=>d.kind===n.fill),u=new Map(e.map(d=>[d.id,d])),b=new Map(e.map((d,k)=>[d.id,k])),l=s.map(d=>{let k=a(d),c=n.fillFrom==="occupant",x=m.filter(R=>(c?R.to:R.from)===d.id).map(R=>u.get(c?R.from:R.to)).filter(R=>R!==void 0).sort((R,M)=>(b.get(R.id)??0)-(b.get(M.id)??0)).map(R=>({id:R.id,label:i(R)}));return{id:d.id,code:String(k[n.slotCode??""]??"").trim()||i(d),label:i(d),x:Ft(Number(k[n.x]??.5)),y:Ft(Number(k[n.y]??.5)),occupants:x}}).sort((d,k)=>d.y-k.y||d.x-k.x),y=new Set(l.flatMap(d=>d.occupants.map(k=>k.id))),p=new Set([...y].map(d=>u.get(d)?.kind).filter(d=>d!==void 0)),o=e.filter(d=>p.has(d.kind)&&!y.has(d.id)).map(d=>({id:d.id,label:i(d)})).sort((d,k)=>d.label<k.label?-1:d.label>k.label?1:0);return{slots:l,empty:l.filter(d=>d.occupants.length===0).map(d=>d.id),spare:o}}function Hr({nodes:e,occupants:t,label:n,fidelity:r,mode:a,options:i,schema:s,implicated:m=[],flagged:u=[]}){let{store:b}=oe(),l=_e(b.graph,b.schema,e),y=t?[...l.filter(f=>f.kind===i.slots),...t.map(f=>b.graph.getNode(f)).filter(f=>f!==void 0)]:l,p=Vn(y,b.graph.allEdges(),i,s),o=new Set(m),d=new Set(u),k=yt(),c=new Map;for(let f of k)for(let v of f.nodeIds)c.set(v,[...c.get(v)??[],f.message]);let x=f=>f?c.get(f)??[]:[];if(r==="glyph")return(0,j.jsx)(ke,{label:`${n??"Board"} \xB7 ${p.slots.length-p.empty.length}/${p.slots.length}`,hue:be("board")});if(r==="summary"){let f=p.slots.filter(v=>p.empty.includes(v.id));return(0,j.jsx)(pe,{title:n??"Board",meta:`${p.slots.length-p.empty.length}/${p.slots.length}`,tone:f.length>0?"warning":"muted",fit:!0,children:f.length>0?(0,j.jsx)(ze,{pick:!0,max:5,items:f.map(v=>({id:v.id,label:v.code}))}):(0,j.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"Every slot filled."})})}let R=i.aspect??.68,M=(0,Ie.useRef)(null),[P,w]=(0,Ie.useState)(!1),[O,g]=(0,Ie.useState)(null),L=160,[N,G]=(0,Ie.useState)(!1);(0,Ie.useEffect)(()=>{let f=M.current;if(!f||typeof ResizeObserver>"u")return;let v=new ResizeObserver(S=>{let A=S[0]?.contentRect;if(!A)return;let h=A.height<L;G(h),w(!h&&R<1&&A.width/A.height>1.3),g(h?null:A.height)});return v.observe(f),()=>v.disconnect()},[R]);let C=(f,v)=>P?{x:1-v,y:f}:{x:f,y:v},q=(()=>{let f=new Map,v=(S,A,h)=>{let $=f.get(h)??{ids:[],codes:[]};$.ids.includes(S)||($.ids.push(S),$.codes.includes(A)||$.codes.push(A)),f.set(h,$)};for(let S of p.slots){for(let A of x(S.id))v(S.id,S.code,A);for(let A of S.occupants)for(let h of x(A.id))v(A.id,A.label,h)}return[...f.entries()].map(([S,A])=>({id:A.ids[0],code:A.codes.join(", "),text:S}))})(),W=a==="fullscreen",ce=q.length===0?null:(0,j.jsxs)("ul",{"data-graview-primitive":"board-key",style:{margin:"2px 0 0",padding:0,listStyle:"none",display:"grid",gap:3,flex:"0 0 auto"},children:[q.slice(0,W?6:2).map(f=>(0,j.jsxs)("li",{"data-graview-pick":f.id,"data-graview-emphasis":o.size===0?"plain":o.has(f.id)?"lit":"dimmed",title:f.text,style:{display:W?"grid":"flex",gap:W?1:7,alignItems:W?"start":"baseline",fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)",minHeight:24,width:"fit-content",maxWidth:"100%",padding:W?"2px 0":"3px 6px",marginLeft:W?0:-6,borderRadius:7,cursor:"pointer"},children:[(0,j.jsxs)("span",{style:{flex:"0 0 auto",fontWeight:600,color:"var(--graview-warn)",letterSpacing:"0.02em"},children:["\u26A0 ",f.code]}),(0,j.jsx)("span",{style:{minWidth:0,...W?{}:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},children:f.text})]},f.id)),q.length>(W?6:2)?(0,j.jsxs)("li",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:["+",q.length-(W?6:2)," more"]}):null]}),ae=i.arrange==="shelf",ne=p.slots.every(f=>f.code.length<=3&&!/\s/.test(f.code)),D=(f,v)=>{let S=f.occupants.length===0,A=o.size>0&&!o.has(f.id)&&!f.occupants.some(J=>o.has(J.id)),h=d.has(f.id),$=f.occupants.some(J=>d.has(J.id)),T=h,Z=[...x(f.id),...f.occupants.flatMap(J=>x(J.id))],H=f.occupants.length===1?f.occupants[0]:null,K=i.pickTarget==="slot"?f.id:H?H.id:f.id,Y=J=>H?{}:{"data-graview-pick":J.id,"data-graview-emphasis":o.size===0?"plain":A?"dimmed":"lit"},le=J=>d.has(J.id)?"var(--graview-warn)":"var(--graview-ink-muted)",ge=i.emptyLabel??"empty";return(0,j.jsxs)("div",{"data-graview-pick":K,"data-graview-slot":f.id,"data-graview-mark":ne?"disc":"token","data-graview-flagged":h&&$?"both":h?"slot":$?"occupant":void 0,"data-graview-emphasis":o.size===0?"plain":A?"dimmed":"lit",title:[S?`${f.label} \u2014 nobody in it`:`${f.occupants.map(J=>J.label).join(", ")} at ${f.label}`,...Z].join(`
3
3
  `),style:{...v,display:"grid",justifyItems:ne?"center":"start",gap:3,opacity:A?.5:1,transition:"opacity 160ms ease"},children:[ne?(0,j.jsxs)("span",{style:{position:"relative",width:34,height:34,borderRadius:999,display:"grid",placeItems:"center",fontSize:"0.75rem",letterSpacing:"0.02em",border:S?"1.5px dashed var(--graview-warn)":`1px solid ${T?"var(--graview-warn)":"var(--graview-edge-bright)"}`,background:S?"transparent":T?"var(--graview-panel-warning)":"var(--graview-panel)",color:S||T?"var(--graview-warn)":"var(--graview-ink)",boxShadow:S?void 0:"var(--graview-lift-low)"},children:[f.code,h&&!S?(0,j.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",top:-3,right:-3,fontSize:"0.6875rem",lineHeight:1,color:"var(--graview-warn)"},children:"\u26A0"}):null]}):(0,j.jsxs)("span",{style:{display:"grid",gap:1,minWidth:0,maxWidth:180,padding:"5px 10px 6px",borderRadius:8,border:S?"1.5px dashed var(--graview-warn)":`1px solid ${T?"var(--graview-warn)":"var(--graview-edge-bright)"}`,background:S?"transparent":T?"var(--graview-panel-warning)":"var(--graview-panel)",boxShadow:S?void 0:"var(--graview-lift-low)"},children:[(0,j.jsxs)("span",{style:{fontSize:"0.8125rem",fontWeight:550,lineHeight:1.25,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:S||T?"var(--graview-warn)":"var(--graview-ink)"},children:[f.code,h&&!S?" \u26A0":null]}),S?(0,j.jsx)("span",{style:{fontSize:"0.75rem",lineHeight:1.3,color:"var(--graview-warn)"},children:ge}):(0,j.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:"0 8px",fontSize:"0.75rem",lineHeight:1.3},children:f.occupants.map(J=>(0,j.jsxs)("span",{...Y(J),style:{whiteSpace:"nowrap",color:le(J)},children:[J.label,d.has(J.id)?" \u26A0":""]},J.id))})]}),ne?S?(0,j.jsx)("span",{style:{fontSize:"0.75rem",whiteSpace:"nowrap",color:"var(--graview-warn)"},children:ge}):f.occupants.map(J=>(0,j.jsxs)("span",{...Y(J),style:{fontSize:"0.75rem",whiteSpace:"nowrap",color:le(J)},children:[J.label,d.has(J.id)?" \u26A0":""]},J.id)):null]},f.id)},Q=i.zones??[],ue=Q.map((f,v)=>({label:f.label,slots:p.slots.filter(S=>S.y>=f.from&&(S.y<f.to||v===Q.length-1&&S.y<=f.to))})),I=new Set(ue.flatMap(f=>f.slots.map(v=>v.id))),E=p.slots.filter(f=>!I.has(f.id));(E.length>0||ue.length===0)&&ue.push({label:"",slots:E});let _={boxSizing:"border-box",borderRadius:12,border:"1px solid var(--graview-edge)",background:"linear-gradient(var(--graview-panel-muted), var(--graview-panel-muted)), var(--graview-panel)",overflow:"hidden"};return(0,j.jsxs)(pe,{title:n??"Board",meta:p.slots.length===0?void 0:p.empty.length===0?`all ${p.slots.length} filled`:`${p.empty.length} unfilled`,...W?{style:{flex:"1 1 auto",minHeight:0,height:"100%"}}:{},children:[(0,j.jsxs)("div",{ref:M,style:{display:"flex",gap:28,alignItems:"stretch",justifyContent:"center",flex:"1 1 auto",minHeight:0},children:[W&&ce?(0,j.jsxs)("div",{style:{width:260,flex:"0 0 auto",alignSelf:"center",display:"grid",gap:8},children:[(0,j.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"What is marked"}),ce]}):null,ae?(0,j.jsx)("div",{"data-graview-primitive":"board","data-graview-arrange":"shelf",style:{..._,overflow:"auto",flex:"1 1 auto",minWidth:0,alignSelf:"stretch",display:"grid",alignContent:"start"},children:ue.map((f,v)=>(0,j.jsxs)("section",{"data-graview-zone":f.label||void 0,style:{display:"grid",gap:8,padding:"10px 14px 14px",...v>0?{borderTop:"1px dashed var(--graview-edge)"}:{}},children:[f.label?(0,j.jsx)("span",{style:{fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:f.label}):null,f.slots.length>0?(0,j.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"10px 12px",alignItems:"flex-start"},children:f.slots.map(S=>D(S,{}))}):(0,j.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"nothing here"})]},f.label||`band-${v}`))}):(0,j.jsxs)("div",{style:{display:"flex",gap:5,alignItems:"stretch",minWidth:0,...N?{flex:"1 1 auto",alignSelf:"flex-start"}:{}},children:[!P&&Q.length>0?(0,j.jsx)("div",{"aria-hidden":"true",style:{position:"relative",width:15,flex:"0 0 auto",alignSelf:"stretch"},children:Q.map(f=>(0,j.jsx)("span",{title:f.label,style:{position:"absolute",top:`${f.from*100}%`,height:`${(f.to-f.from)*100}%`,right:0,writingMode:"vertical-rl",transform:"rotate(180deg)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--graview-ink-faint)"},children:f.label},f.label))}):null,(0,j.jsxs)("div",{"data-graview-primitive":"board","data-graview-arrange":"exact",style:{..._,position:"relative",aspectRatio:`${P?1/R:R}`,...N?{width:"100%",height:"auto",flex:"1 1 auto",minWidth:0,alignSelf:"flex-start"}:{height:"100%",flex:"0 1 auto",...O!==null?{width:Math.round(O*(P?1/R:R))}:{}},maxWidth:"100%"},children:[Q.map(f=>(0,j.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",...P?{top:0,bottom:0,left:`${(1-f.to)*100}%`,width:`${(f.to-f.from)*100}%`,borderLeft:"1px dashed var(--graview-edge)"}:{left:0,right:0,top:`${f.from*100}%`,height:`${(f.to-f.from)*100}%`,borderBottom:"1px dashed var(--graview-edge)"}}},f.label)),P?Q.map(f=>(0,j.jsx)("span",{"aria-hidden":"true",title:f.label,style:{position:"absolute",bottom:3,left:`${(1-f.to)*100}%`,width:`${(f.to-f.from)*100}%`,textAlign:"center",fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--graview-ink-faint)"},children:f.label},`label-${f.label}`)):null,p.slots.map(f=>D(f,{position:"absolute",left:`${C(f.x,f.y).x*100}%`,top:`${C(f.x,f.y).y*100}%`,transform:"translate(-50%, -50%)",width:"max-content",maxWidth:"100%"}))]})]}),p.spare.length>0?(0,j.jsxs)("div",{style:{display:"grid",gap:6,alignContent:"start",minWidth:0},children:[(0,j.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"Not in"}),(0,j.jsx)(ze,{pick:!0,max:10,items:p.spare.map(f=>({...f,emphasis:o.size===0?"plain":o.has(f.id)?"lit":"dimmed"}))})]}):null]}),W?null:ce]})}function _t(e){function t(n){let{store:r}=oe(),a=Vn(_e(r.graph,r.schema,n.nodes),r.graph.allEdges(),e,r.schema),s=[...a.slots.flatMap(l=>l.occupants.map(y=>y.id)),...a.spare.map(l=>l.id)].map(l=>r.graph.getNode(l)).filter(l=>l!==void 0),{arranged:m,bar:u}=Te(n,{...e.arranging!==void 0?{allow:e.arranging}:{},lensAllows:{group:!1},...e.arrangedBy?{arrangedBy:e.arrangedBy}:{},subject:s}),b=(0,j.jsx)(Hr,{schema:r.schema,...n,options:e,...e.arranging===!1?{}:{occupants:m.nodes.map(l=>l.id)}});return Be(n,r.schema,u?(0,j.jsxs)("div",{style:{display:"grid",gap:6,height:"100%",minHeight:0,gridTemplateRows:"auto 1fr"},children:[u,b]}):b)}return{name:"board",requiredRoles:[...Wr],options:e,View:t,build(n,r,a){return Vn(n,r,e,a)}}}var xn=U(De(),1);var Ut=864e5;function Gn(e){if(typeof e!="string")return null;if(Nn(e))return Dn(e)?.day??null;let t=/^(\d{4}-\d{2}-\d{2})/.exec(e);return t?t[1]:null}function pn(e){if(typeof e!="string")return null;if(Nn(e))return Dn(e)?.minutes??null;let t=/^\d{4}-\d{2}-\d{2}[T ](\d{2}):(\d{2})/.exec(e);return t?Number(t[1])*60+Number(t[2]):null}var mn=e=>Date.UTC(Number(e.slice(0,4)),Number(e.slice(5,7))-1,Number(e.slice(8,10))),fn=e=>new Date(e).toISOString().slice(0,10);function Re(e,t){return fn(mn(e)+t*Ut)}function Ge(e,t){let n=Number(e.slice(0,4)),r=Number(e.slice(5,7))-1+t,a=Number(e.slice(8,10)),i=new Date(Date.UTC(n,r+1,0)).getUTCDate();return fn(Date.UTC(n,r,Math.min(a,i)))}var jn=e=>new Date(mn(e)).getUTCDay();function Ue(e,t=1){let n=(jn(e)-t+7)%7;return Re(e,-n)}var qn=e=>`${e.slice(0,7)}-01`;function we(e,t){return Math.round((mn(t)-mn(e))/Ut)}function Ke(e,t){return Array.from({length:t},(n,r)=>Re(e,r))}var Kt=e=>it(e,"short"),Pe=e=>rt(e,{weekday:"short"}),Fn=e=>Xe(e);function je(e,t){let n=t?.fieldRoles?.when;return e&&!e.start&&n?{...e,start:n}:e}function Yt(e,t){return t===void 0?!1:typeof t=="string"?e[t]===!0:t.is.includes(e[t.field])}var hn=["start"],Vr=["day","week","month","quarter","year","agenda"];function yn(e){return e.horizon?["day","week","month","quarter","year","years","agenda"]:Vr}function Qt(e,t){return e==="years"?t?.title??"Years":`The ${e}`}function Jt(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var _n=class extends Error{constructor(n,r){super(`The calendar lens has no binding for ${r.map(a=>`"${a}"`).join(", ")} on "${n}". Bind them in the lens declaration: bindings: { ${n}: { start: "<field>" } }.`);this.kind=n;this.missing=r;this.name="CalendarBindingError"}};function wn(e,t,n){let r=je(t[e.kind],n?.tryDefinition(e.kind));if(!r)return null;let a=e,i=n?.tryDefinition(e.kind)?.fields.shape,s=hn.filter(y=>{let p=r[y];return p?i?!(p in i):!(p in a):!0});if(s.length>0)throw new _n(e.kind,s);let m=Gn(a[r.start]);if(m===null)return null;let u=(r.end?Gn(a[r.end]):null)??m,b=pn(a[r.start]),l=r.label?a[r.label]:void 0;return{id:e.id,kind:e.kind,label:typeof l=="string"&&l.length>0?l:Se(n?.tryDefinition(e.kind),e),from:m,to:we(m,u)<0?m:u,at:r.allDay&&a[r.allDay]===!0?null:b,allDay:r.allDay&&a[r.allDay]===!0||b===null,done:Yt(a,r.done)}}function Xt(e,t,n,r){let a=wn(e,t,n);if(!a)return[];let i=je(t[e.kind],n?.tryDefinition(e.kind)).start,s=e,m=s[i],u=s[lt(i)];if(typeof m!="string"||!dt(u))return[a];let b=we(a.from,a.to);return("next"in r?[ut(m,u,r.next)]:ct(m,u,{from:Re(r.from,-b),to:r.to,limit:400})).map(y=>({...a,from:y.slice(0,10),to:Re(y.slice(0,10),b),repeats:!0}))}function vn(e,t){return e.filter(n=>we(n.from,t)>=0&&we(t,n.to)>=0).sort((n,r)=>n.allDay!==r.allDay?n.allDay?-1:1:n.at!==r.at?(n.at??0)-(r.at??0):n.label.localeCompare(r.label))}function Zt(e,t,n){let r=gt(e.schema,e.allMutations()).get(t)?.get(n)??[],a=new Map(e.allMutations().map(s=>[s.name,s]));for(let s of r){let m=a.get(s),u=m?.subject;if(!m||!u)continue;let b=m.input?.shape??{};if(n in b)return{name:m.name,arg:u.arg}}let i=e.allMutations().find(s=>s.derived?.act==="edit"&&s.derived.kind===t);return i?.subject?{name:i.name,arg:i.subject.arg}:null}var er=(e,t)=>({from:qn(e),to:nr(e),label:Mn(e,{short:!0,year:t})});function nr(e){return fn(Date.UTC(Number(e.slice(0,4)),Number(e.slice(5,7)),0))}function Gr(e){let t=Math.floor((Number(e.slice(5,7))-1)/3);return`${e.slice(0,4)}-${String(t*3+1).padStart(2,"0")}-01`}function tr(e,t,n={}){let r=n.weekStartsOn??1,a=(u,b)=>({from:u,to:u,label:String(Number(u.slice(8,10))),...b?{outside:!0}:{}});if(e==="day")return{title:Pe(t),grain:"day",columns:1,cells:[a(t)]};if(e==="week"){let u=Ue(t,r);return{title:`${Pe(u)} \u2013 ${Pe(Re(u,6))}`,grain:"day",columns:7,cells:Ke(u,7).map(b=>a(b))}}if(e==="agenda")return{title:`From ${Pe(t)}`,grain:"day",columns:1,cells:Ke(t,42).map(u=>a(u))};if(e==="quarter"){let u=Gr(t),b=nr(Ge(u,2)),l=[];for(let y=Ue(u,r);we(y,b)>=0;y=Re(y,7))l.push({from:y,to:Re(y,6),label:at(y),...we(y,u)>0&&we(Re(y,6),u)>0?{outside:!0}:{}});return{title:`Q${Math.floor((Number(t.slice(5,7))-1)/3)+1} ${t.slice(0,4)}`,grain:"week",columns:4,cells:l}}if(e==="year"){let u=t.slice(0,4);return{title:u,grain:"month",columns:4,cells:Array.from({length:12},(b,l)=>er(`${u}-${String(l+1).padStart(2,"0")}-01`,!1))}}if(e==="years"){let u=Number(t.slice(0,4)),b=u+Math.max(1,n.horizon?.years??1)-1,l=n.horizon?.from!==void 0||n.horizon?.to!==void 0,y=l?n.horizon?.from??u:Math.min(u,n.fit?.first??u),o=(l?Math.max(y,n.horizon?.to??y+Math.max(1,n.horizon?.years??1)-1):Math.max(b,n.fit?.last??b))-y+1,d=Array.from({length:o},(k,c)=>String(y+c));return o>jr?{title:`${n.horizon?.title??"Years"} \xB7 ${d[0]}\u2013${d[d.length-1]}`,grain:"year",columns:5,years:d,cells:d.map(k=>({from:`${k}-01-01`,to:`${k}-12-31`,label:k}))}:{title:`${n.horizon?.title??"Years"} \xB7 ${d[0]}\u2013${d[d.length-1]}`,grain:"month",columns:4,years:d,cells:d.flatMap(k=>Array.from({length:12},(c,x)=>er(`${k}-${String(x+1).padStart(2,"0")}-01`,!0)))}}let i=qn(t),s=Ue(i,r),m=t.slice(0,7);return{title:Mn(t),grain:"day",columns:7,cells:Ke(s,42).map(u=>a(u,u.slice(0,7)!==m))}}function rr(e,t,n){return e.filter(r=>we(r.from,n)>=0&&we(t,r.to)>=0).sort((r,a)=>r.allDay!==a.allDay?r.allDay?-1:1:r.from!==a.from?r.from.localeCompare(a.from):r.at!==a.at?(r.at??0)-(a.at??0):r.label.localeCompare(a.label))}var jr=10;function ar(e){return e==="year"?"year":e==="month"?"month":e==="week"?"week":"day"}var ir=U(De(),1);var ie=U(te(),1);function Un({label:e,glyph:t,onPress:n}){return(0,ie.jsx)("button",{type:"button","aria-label":e,title:e,onClick:n,style:Ye,children:t})}var Ye={minHeight:24,minWidth:24,padding:"2px 9px",borderRadius:6,fontSize:"0.8125rem",borderWidth:1,borderStyle:"solid",borderColor:"transparent",color:"var(--graview-ink-muted)",background:"transparent"},or={day:12,week:4,month:3,year:5};function sr({span:e,weekStartsOn:t,entries:n,today:r,perCell:a,emphasisOf:i,broken:s,hue:m,onOpen:u,onMove:b}){let l=(0,ir.useRef)(null),y=Fe(l),p=y===null?e.columns:Math.max(1,Math.floor(y/44)),o=p<e.columns,d=o?p:e.columns,k=!o&&e.grain==="day"&&e.columns===7?Ke(Ue(e.cells[0]?.from??r,t),7):e.grain==="day"&&e.columns===1?e.cells.map(c=>c.from):null;return o&&e.grain==="day"&&e.columns>1?(0,ie.jsx)("div",{ref:l,"data-calendar-shape":"agenda",style:{display:"grid",minHeight:0,flex:1},children:(0,ie.jsx)(bn,{days:e.cells.map(c=>c.from),entries:n,today:r,emphasisOf:i,broken:s,hue:m,onMove:(c,x)=>b(c,{from:x,to:x,label:x},"day")})}):(0,ie.jsxs)("div",{ref:l,"data-calendar-shape":o?"wrapped":"grid",style:{display:"grid",gap:4,gridTemplateRows:k?"auto 1fr":"1fr",minHeight:0,flex:1},children:[k?(0,ie.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${d}, minmax(0, 1fr))`,gap:4},children:k.map(c=>(0,ie.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:"var(--graview-ink-muted)",textAlign:"center"},children:e.columns===7?Kt(jn(c)):Pe(c)},c))}):null,(0,ie.jsx)("div",{tabIndex:0,"aria-label":`The days of ${e.title}`,style:{display:"grid",gridTemplateColumns:`repeat(${d}, minmax(0, 1fr))`,gridAutoRows:"max-content",gap:4,minHeight:0,overflow:"auto"},children:e.cells.map((c,x)=>{let R=rr(n,c.from,c.to),M=R.slice(0,a),P=R.slice(a),w=P.filter(g=>s.has(g.id)).length,O=we(c.from,r)>=0&&we(r,c.to)>=0;return(0,ie.jsxs)("div",{"data-calendar-day":e.grain==="day"?c.from:void 0,"data-calendar-cell":c.from,"data-calendar-grain":e.grain,"data-calendar-count":R.length,"data-calendar-outside":c.outside||void 0,onDragOver:g=>{g.dataTransfer.types.includes("text/graview-node")&&(g.preventDefault(),g.dataTransfer.dropEffect="move")},onDrop:g=>{let L=g.dataTransfer.getData("text/graview-node");L&&(g.preventDefault(),g.stopPropagation(),b(L,c,e.grain))},style:{minHeight:62,display:"flex",flexDirection:"column",gap:2,padding:4,borderRadius:7,border:"1px solid var(--graview-edge)",background:O?"var(--graview-panel)":c.outside?"var(--graview-panel-muted)":"transparent"},children:[(0,ie.jsxs)("span",{style:{display:"flex",alignItems:"baseline",gap:4},children:[(0,ie.jsx)("span",{style:{fontSize:"0.75rem",fontVariantNumeric:"tabular-nums",color:O?"var(--graview-accent)":"var(--graview-ink-faint)"},children:c.label}),e.grain!=="day"&&R.length>0?(0,ie.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",marginLeft:"auto"},children:R.length}):null]}),M.map(g=>(0,ie.jsx)(lr,{entry:g,cell:c,rowStart:x%d===0,emphasis:i(g.id),flagged:s.has(g.id),hue:m(g)},`${g.id}:${g.from}:${c.from}`)),P.length>0?(0,ie.jsxs)("button",{type:"button","data-testid":`calendar-more-${c.from}`,onClick:()=>u(c),title:`Open ${c.label}`,style:{minHeight:24,padding:"1px 5px",fontSize:"0.75rem",borderRadius:5,border:"1px dashed var(--graview-edge)",background:"transparent",color:w>0?"var(--graview-warn)":"var(--graview-ink-muted)",textAlign:"left"},children:["+",P.length," more",w>0?` \xB7 ${w} flagged`:""]}):null]},c.from)})})]})}function bn({days:e,entries:t,today:n,emphasisOf:r,broken:a,hue:i,onMove:s}){let m=e.map(u=>({day:u,here:vn(t,u)})).filter(({here:u})=>u.length>0);return m.length===0?(0,ie.jsx)("p",{"data-testid":"calendar-empty",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:"Nothing is scheduled in the next six weeks."}):(0,ie.jsx)("ol",{tabIndex:0,"aria-label":"What is scheduled",style:{margin:0,padding:0,listStyle:"none",display:"grid",alignContent:"start",gap:10,overflow:"auto",minHeight:0},children:m.map(({day:u,here:b})=>(0,ie.jsxs)("li",{"data-calendar-day":u,onDragOver:l=>{l.dataTransfer.types.includes("text/graview-node")&&(l.preventDefault(),l.dataTransfer.dropEffect="move")},onDrop:l=>{let y=l.dataTransfer.getData("text/graview-node");y&&(l.preventDefault(),l.stopPropagation(),s(y,u))},style:{display:"grid",gap:4},children:[(0,ie.jsxs)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:u===n?"var(--graview-accent)":"var(--graview-ink-muted)"},children:[Pe(u),u===n?" \xB7 today":""]}),b.map(l=>(0,ie.jsx)(lr,{entry:l,cell:{from:u,to:u,label:u},emphasis:r(l.id),flagged:a.has(l.id),hue:i(l)},`${l.id}:${l.from}:${u}`))]},u))})}function lr({entry:e,cell:t,emphasis:n,flagged:r,hue:a,rowStart:i=!1}){let s=we(t.from,e.from)>=0,m=we(e.to,t.to)>=0,u=!(s&&m),b=e.at!==null&&s&&e.from===t.from?`${Fn(e.at)} ${e.label}`:e.label;return(0,ie.jsx)("span",{"data-graview-pick":e.id,"data-calendar-entry":e.id,"data-calendar-repeat":e.repeats?e.from:void 0,draggable:!e.repeats,onDragStart:l=>{l.dataTransfer.setData("text/graview-node",e.id),l.dataTransfer.effectAllowed="move"},"data-graview-emphasis":n,"data-calendar-part":u?s?"opens":m?"closes":"through":void 0,"data-calendar-in":t.from,title:u?`${e.label} \xB7 ${e.from} \u2013 ${e.to}`:`${e.label}${e.at===null?" \xB7 all day":` \xB7 ${Fn(e.at)}`}${e.repeats?" \xB7 repeats":""}`,style:{display:"block",minHeight:24,boxSizing:"border-box",padding:"3px 6px",fontSize:"0.75rem",lineHeight:1.35,borderRadius:u?s?"5px 0 0 5px":m?"0 5px 5px 0":0:5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:e.done?"line-through":"none",opacity:n==="dimmed"?.35:e.done?.6:1,background:`color-mix(in oklab, hsl(${Math.round(a)} 70% 55%) ${n==="lit"?38:20}%, transparent)`,color:"var(--graview-ink)",...n==="lit"?{outline:"1px solid var(--graview-accent)"}:{},...r?{borderLeft:"3px solid var(--graview-warn)",paddingLeft:4}:{}},children:s||i?e.repeats?(0,ie.jsxs)(ie.Fragment,{children:[(0,ie.jsx)("span",{"aria-hidden":"true",children:"\u21BB "}),b]}):b:" "})}var ee=U(te(),1);function qr(e){let t=1/0,n=-1/0;for(let r of e)r&&(t=Math.min(t,Number(r.from.slice(0,4))),n=Math.max(n,Number(r.to.slice(0,4))));return Number.isFinite(t)&&Number.isFinite(n)?{first:t,last:n}:void 0}function dr(e){let t=n=>function(a){let{store:i}=oe(),{view:s}=nn(),m=n?{...e,range:n}:e,u=s.within?.range??m.range??"month",b=Object.keys(e.bindings),{nodes:l,arranged:y,arrangement:p,bar:o}=Te(a,{...e.arranging!==void 0?{allow:e.arranging}:{},lensAllows:{sort:!1,group:u==="agenda"},...e.arrangedBy?{arrangedBy:e.arrangedBy}:{},...e.search?{search:e.search}:{},...e.filters?{filters:e.filters}:{},...b[0]?{kind:(a.nodes??[]).find(R=>b.includes(String(R.kind)))?.kind??b[0]}:{}}),d=u==="agenda"&&y.grouped&&p.group?y.groups.map(R=>({label:R.label,ids:new Set(R.nodes.map(M=>M.id))})):void 0,k=new Set((a.nodes??[]).map(R=>String(R.kind))),c=b.filter(R=>!k.has(R)&&i.schema.tryDefinition(R)!==void 0).flatMap(R=>{let M=i.schema.tryDefinition(R);return i.graph.nodesOfKind(R).filter(P=>s.past===!0||Ve(M,P))}),x=c.length===0?l:[...l,...a.budget!==void 0?c.slice(0,a.budget):c];return Be(a,i.schema,(0,ee.jsx)(Fr,{schema:i.schema,...a,nodes:x,options:{...m,today:m.today??i.today()??Jt()},...o?{bar:o}:{},...d?{groups:d}:{}}))};return{name:"calendar",requiredRoles:[...hn],bindings:e.bindings,options:e,View:t(),at:n=>t(n),ranges:()=>yn(e).map(n=>({range:n,title:Qt(n,e.horizon)})),place:(n,r)=>n.map(a=>wn(a,e.bindings,r)).filter(a=>a!==null)}}function Fr({nodes:e,label:t,fidelity:n,mode:r,options:a,schema:i,selectedIds:s=[],implicated:m=[],flagged:u=[],bar:b,groups:l}){let{view:y,go:p}=nn(),{store:o,principal:d}=oe(),k=y.within?.at??a.today,c=y.within?.range??a.range??"month",x=a.weekStartsOn??1,R=new Set([...m,...s]),M=E=>R.size===0?"plain":R.has(E)?"lit":"dimmed",P=new Set(u),w=c==="years"&&y.within?.at===void 0?qr((e??[]).map(E=>wn(E,a.bindings,i))):void 0,O=tr(c,k,{weekStartsOn:x,...a.horizon?{horizon:a.horizon}:{},...w?{fit:w}:{}}),L=n==="glyph"||n==="summary"?{next:a.today}:{from:O.cells[0]?.from??k,to:O.cells[O.cells.length-1]?.to??k},N=(e??[]).flatMap(E=>Xt(E,a.bindings,i,L)),G=a.hueOf??(E=>be(E.kind));if(n==="glyph")return(0,ee.jsx)(ke,{label:`${t??"Calendar"} \xB7 ${N.length}`,hue:be("calendar")});if(n==="summary"){let E=vn(N,a.today);return(0,ee.jsx)(pe,{title:t??"Calendar",meta:`${N.length} dated`,tone:"muted",children:(0,ee.jsx)(ze,{max:6,items:E.length>0?E.map(_=>({id:_.id,label:_.label,hue:G(_)})):N.filter(_=>we(a.today,_.from)>=0).sort((_,f)=>_.from.localeCompare(f.from)).slice(0,6).map(_=>({id:_.id,label:`${_.from.slice(5)} ${_.label}`,hue:G(_)}))})})}let C=r==="fullscreen",[q,W]=(0,xn.useState)(null),ce=(E,_,f)=>{let v=o.graph.getNode(E);if(!v)return;let S=je(a.bindings[v.kind],o.schema.tryDefinition(v.kind));if(!S)return;let A=Zt(o,v.kind,S.start);if(!A){W({text:`Nothing declared writes the ${Ln(o.schema.definitions.find(Y=>Y.kind===v.kind),S.start).toLowerCase()}, so this cannot be moved from here.`,tone:"refused"});return}let h=_.from,$=v[S.start],Z=pn($)===null?h:`${h}${String($).slice(10)}`,H={name:A.name,args:{[A.arg]:E,[S.start]:Z}},K=o.permits(H,d);if(!K.ok){W({text:K.refusal.message,tone:"refused"});return}try{o.apply(H,{author:d}),W(f==="day"?null:{text:`Moved to ${Pe(h)} \u2014 a ${f} is coarser than the ${Ln(o.schema.definitions.find(Y=>Y.kind===v.kind),S.start).toLowerCase()} holds, so it takes the first day of the cell. Undo puts it back.`,tone:"rounded"})}catch(Y){W({text:Y instanceof Error?Y.message:String(Y),tone:"refused"})}},ae=E=>{let _=c==="years"?Ge(`${O.years?.[0]??k.slice(0,4)}${k.slice(4)}`,E*12*Math.max(1,O.years?.length??a.horizon?.years??1)):c==="year"?Ge(k,E*12):c==="quarter"?Ge(k,E*3):c==="month"?Ge(k,E):c==="week"?Re(k,E*7):Re(k,E);p(en(y,"at",_))},ne=(E,_)=>{let f=en(y,"range",E);_!==void 0&&(f=en(f,"at",_)),p(f)},D=(0,xn.useRef)(null),Q=Fe(D),ue=Q!==null&&Q<420,I=E=>E==="years"?a.horizon?.title??"years":E.charAt(0).toUpperCase()+E.slice(1);return(0,ee.jsx)(pe,{title:t??"Calendar",meta:O.title,style:{gap:10,...C?{flex:"1 1 auto",minHeight:0,height:"100%"}:{}},children:(0,ee.jsxs)("div",{ref:D,"data-testid":"calendar","data-calendar-range":c,"data-calendar-at":k,style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,gap:8},children:[(0,ee.jsxs)("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6},children:[(0,ee.jsxs)("nav",{"aria-label":"When",style:{display:"flex",gap:4},children:[(0,ee.jsx)(Un,{label:"Previous",glyph:"\u2039",onPress:()=>ae(-1)}),(0,ee.jsx)("button",{type:"button","data-testid":"calendar-today",onClick:()=>p(en(y,"at",a.today)),style:Ye,children:"Today"}),(0,ee.jsx)(Un,{label:"Next",glyph:"\u203A",onPress:()=>ae(1)})]}),ue?(0,ee.jsx)("select",{"aria-label":"Range","data-testid":"calendar-ranges",value:c,onChange:E=>ne(E.target.value),style:{...Ye,borderRadius:999,borderColor:"var(--graview-edge)",background:void 0,backgroundColor:"transparent",marginLeft:"auto",maxWidth:"50%",paddingRight:24,appearance:"none",WebkitAppearance:"none",backgroundImage:"linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%)",backgroundPosition:"calc(100% - 13px) 55%, calc(100% - 9px) 55%",backgroundSize:"4px 4px, 4px 4px",backgroundRepeat:"no-repeat"},children:yn(a).map(E=>(0,ee.jsx)("option",{value:E,children:I(E)},E))}):(0,ee.jsx)("div",{role:"group","aria-label":"Range","data-testid":"calendar-ranges",style:{display:"flex",flexWrap:"wrap",gap:4,marginLeft:"auto"},children:yn(a).map(E=>(0,ee.jsx)("button",{type:"button","aria-pressed":E===c,"data-testid":`calendar-range-${E}`,onClick:()=>ne(E),style:{...Ye,borderRadius:999,borderColor:"var(--graview-edge)",...E==="years"?{}:{textTransform:"capitalize"},...E===c?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)",background:"var(--graview-panel)"}:{}},children:E==="years"?a.horizon?.title??"years":E},E))})]}),q?(0,ee.jsx)("p",{"data-testid":q.tone==="refused"?"calendar-refused":"calendar-rounded",role:"status",style:{margin:0,fontSize:"0.8125rem",color:q.tone==="refused"?"var(--graview-warn)":"var(--graview-ink-muted)"},children:q.text}):null,O.years?(0,ee.jsx)("nav",{"aria-label":"Years","data-testid":"calendar-years",style:{display:"flex",flexWrap:"wrap",gap:4},children:O.years.map(E=>(0,ee.jsx)("button",{type:"button","data-testid":`calendar-year-${E}`,onClick:()=>ne("year",`${E}-01-01`),style:Ye,children:E},E))}):null,b,c==="agenda"&&l?(0,ee.jsx)("div",{"data-testid":"calendar-groups",style:{display:"grid",gap:10,minHeight:0,overflow:"auto"},children:l.map(E=>(0,ee.jsxs)("section",{"data-testid":"calendar-group",style:{display:"grid",gap:4},children:[(0,ee.jsxs)("h3",{style:{margin:0,fontSize:"0.8125rem",letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},children:[E.label," ",(0,ee.jsx)("span",{style:{fontWeight:400},children:E.ids.size})]}),(0,ee.jsx)(bn,{days:O.cells.map(_=>_.from),entries:N.filter(_=>E.ids.has(_.id)),today:a.today,emphasisOf:M,broken:P,hue:G,onMove:(_,f)=>ce(_,{from:f,to:f,label:f},"day")})]},E.label))}):c==="agenda"?(0,ee.jsx)(bn,{days:O.cells.map(E=>E.from),entries:N,today:a.today,emphasisOf:M,broken:P,hue:G,onMove:(E,_)=>ce(E,{from:_,to:_,label:_},"day")}):(0,ee.jsx)(sr,{span:O,weekStartsOn:x,entries:N,today:a.today,perCell:a.perCell??or[O.grain],emphasisOf:M,broken:P,hue:G,onOpen:E=>ne(ar(O.grain),E.from),onMove:ce})]})})}var re=U(De(),1);var Qe=U(De(),1),Ae=U(te(),1),Sn={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"};function cr({choices:e,close:t}){let[n,r]=(0,Qe.useState)(!1),a=(0,Qe.useRef)(null);return(0,Qe.useLayoutEffect)(()=>{n&&a.current?.querySelector("button:not([disabled])")?.focus()},[n]),(0,Ae.jsxs)("div",{children:[(0,Ae.jsxs)("button",{type:"button","data-menu-item":"move-to","aria-expanded":n,onClick:()=>r(i=>!i),style:Sn,children:["Move to ",(0,Ae.jsx)("span",{"aria-hidden":"true",children:"\u203A"})]}),n?(0,Ae.jsx)("ul",{ref:a,"aria-label":"Move to","data-testid":"move-to",style:{margin:"2px 0 0 12px",padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:e.map(i=>i.run?(0,Ae.jsx)("li",{children:(0,Ae.jsx)("button",{type:"button","data-move-to":i.to,onClick:()=>{t(),i.run()},style:Sn,children:i.label})},i.to):(0,Ae.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,Ae.jsx)("button",{type:"button",disabled:!0,"data-move-to":i.to,"data-withheld":"",style:{...Sn,borderStyle:"dashed"},children:(0,Ae.jsx)("s",{children:i.label})}),(0,Ae.jsx)("span",{"data-testid":"move-to-why",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-ink-muted)",padding:"0 10px"},children:i.why})]},i.to))}):null]})}function ur({choose:e,close:t}){return(0,Ae.jsx)("button",{type:"button","data-menu-item":"choose-several",onClick:()=>{t(),e()},style:Sn,children:"Choose several"})}var z=U(te(),1),_r=`
4
4
  .graview-columns { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
@@ -1 +1 @@
1
- import{e as $}from"./chunk.EYSQPXVE.js";import{a as C}from"./chunk.3NEALGMI.js";import{l as M}from"./chunk.GRLPNTUW.js";import{da as k,ea as v,ga as j,xb as x}from"./chunk.PFEKS3KO.js";function N(a,s){let c=a.tryDefinition(s),r=Object.keys(c?.fields?.shape??{}),m=[c?.lifecycle?.field,...r.filter(l=>/^(status|stage|state|phase)$/i.test(l))].filter(l=>l!==void 0&&r.includes(l));return[...new Set(m)].slice(0,1)}function P(a,s){return a.tryDefinition(s)?.fieldRoles?.title??"label"}function V(a,s,c={}){let r=s.map(e=>a.graph.getNode(e)).filter(e=>e!==void 0);if(r.length===0)return{acts:[],withheld:[]};let u=c.principal??{kind:"human"},m=C(a,r.map(e=>e.id),{...c.derive,principal:u,...c.context?{context:c.context}:{}}),l=new Map(a.allMutations().map(e=>[e.name,e])),g=[...new Set(r.map(e=>e.kind))],p=new Set(g.map(e=>P(a.schema,e))),h=new Set(m.affordances.filter(e=>e.provider==="schema").map(e=>e.mutation)),o=e=>{let n=l.get(e.mutation);if(!n?.subject)return;let t=r.length===1&&e.provider==="invariant"&&!h.has(e.mutation)&&e.args[n.subject.arg]===r[0].id;if(!(e.provider!=="schema"&&!t)&&!(r.length>1&&e.batch?.length!==r.length)&&n.derived?.act!=="edit"&&!e.open.some(i=>p.has(i.name)))return n},y=[],b=new Set;for(let e of m.affordances){let n=o(e);if(!n||b.has(n.name))continue;b.add(n.name);let{[n.subject.arg]:t,...i}=e.args;y.push({id:e.id,label:v(n),mutation:n.name,subject:n.subject.arg,args:i,open:e.open,...e.destructive||e.setsAside?{more:!0}:{},...e.destructive?{destructive:!0}:{},affordance:{...e,label:v(n)}})}if(g.length===1){let e=g[0];for(let n of N(a.schema,e))for(let t of $(a.schema,[...l.values()],e,n)){if(t.by==="none"||r.every(d=>d[n]===t.value))continue;let i=r.find(d=>d[n]!==t.value),f=t.acts.find(d=>{let D=t.by==="step"?{[d.subject.arg]:i.id}:{[d.subject.arg]:i.id,[n]:t.value};return a.permits({name:d.name,args:D},u).ok});if(!f)continue;let w=t.by==="step"?{}:{[n]:t.value};if(t.by==="step"&&y.some(d=>d.mutation===f.name))continue;let R=t.by==="step"?v(f):`Move to ${t.label}`,O=`set:${n}:${t.value}`;y.push({id:O,label:R,mutation:f.name,subject:f.subject.arg,args:w,open:[],affordance:{id:O,label:R,provider:"schema",mutation:f.name,args:{[f.subject.arg]:i.id,...w},open:[],score:0,why:`every one is ${e}`,nodeIds:r.map(d=>d.id)}})}}let S=[...y.filter(e=>!e.more),...y.filter(e=>e.more)],A=m.withheld.filter(e=>{let n=l.get(e.mutation);return n?.subject!==void 0&&n.derived?.act!=="edit"&&(r.length===1||e.batch?.length===r.length)}).map(e=>({label:v(l.get(e.mutation)),message:e.refusal.message}));return{acts:S,withheld:A}}function _(a,s,c,r={}){let u=r.author,m=a.allMutations().find(e=>e.name===s.mutation),l=e=>M(a.schema,a.allMutations(),e),g=e=>{let n=a.graph.getNode(e);return n?k(a.schema.tryDefinition(n.kind),n):e},p=[],h=[],o=[];for(let e of[...new Set(c)]){let n={name:s.mutation,args:{...s.args,[s.subject]:e}};if(!m){p.push({id:e,label:g(e),message:`There is no act \u201C${s.mutation}\u201D.`,reason:"invalid"});continue}let t=a.permits(n,u);if(!t.ok){p.push({id:e,label:g(e),message:t.refusal.message,reason:"forbidden"});continue}if(!a.wouldChange(n,u)){h.push(e);continue}o.push({id:e,call:n})}let y=e=>a.previewAll(e,{...u?{author:u}:{},...r.context?{context:r.context}:{}});for(let e=0;o.length>0;e+=1)try{y(o.map(n=>n.call));break}catch(n){let t=[];for(let i of o)try{y([i.call]),t.push(i)}catch(f){p.push({id:i.id,label:g(i.id),message:l(f),reason:x(f).reason})}if(t.length===o.length||e>o.length){for(let i of t)p.push({id:i.id,label:g(i.id),message:l(n),reason:x(n).reason});o=[];break}o=t}if(o.length===0)return{applied:[],unchanged:h,refused:p};let b=s.label??(m?v(m):s.mutation),S=[...new Set(o.map(e=>a.graph.getNode(e.id)?.kind))],A=`${b} \u2014 ${S.length===1&&S[0]?j(a.schema,S[0],o.length):`${o.length} records`}`;try{let e=a.applyAll(o.map(n=>n.call),{intent:A,...u?{author:u}:{},...r.via?{via:r.via}:{}});return{batch:e.batch,intent:A,applied:o.map(n=>n.id),unchanged:h,refused:p,result:e}}catch(e){let n=l(e),t=x(e).reason;return{applied:[],unchanged:h,refused:[...p,...o.map(i=>({id:i.id,label:g(i.id),message:n,reason:t}))],allOrNothing:!0}}}export{V as a,_ as b};
1
+ import{e as $}from"./chunk.W2DKFQ6R.js";import{a as C}from"./chunk.3TVAE7LE.js";import{l as M}from"./chunk.OU5TRY4N.js";import{Bb as x,da as k,ea as v,ga as j}from"./chunk.P4CLT32V.js";function N(a,s){let c=a.tryDefinition(s),r=Object.keys(c?.fields?.shape??{}),m=[c?.lifecycle?.field,...r.filter(l=>/^(status|stage|state|phase)$/i.test(l))].filter(l=>l!==void 0&&r.includes(l));return[...new Set(m)].slice(0,1)}function P(a,s){return a.tryDefinition(s)?.fieldRoles?.title??"label"}function V(a,s,c={}){let r=s.map(e=>a.graph.getNode(e)).filter(e=>e!==void 0);if(r.length===0)return{acts:[],withheld:[]};let u=c.principal??{kind:"human"},m=C(a,r.map(e=>e.id),{...c.derive,principal:u,...c.context?{context:c.context}:{}}),l=new Map(a.allMutations().map(e=>[e.name,e])),g=[...new Set(r.map(e=>e.kind))],p=new Set(g.map(e=>P(a.schema,e))),h=new Set(m.affordances.filter(e=>e.provider==="schema").map(e=>e.mutation)),o=e=>{let n=l.get(e.mutation);if(!n?.subject)return;let t=r.length===1&&e.provider==="invariant"&&!h.has(e.mutation)&&e.args[n.subject.arg]===r[0].id;if(!(e.provider!=="schema"&&!t)&&!(r.length>1&&e.batch?.length!==r.length)&&n.derived?.act!=="edit"&&!e.open.some(i=>p.has(i.name)))return n},y=[],b=new Set;for(let e of m.affordances){let n=o(e);if(!n||b.has(n.name))continue;b.add(n.name);let{[n.subject.arg]:t,...i}=e.args;y.push({id:e.id,label:v(n),mutation:n.name,subject:n.subject.arg,args:i,open:e.open,...e.destructive||e.setsAside?{more:!0}:{},...e.destructive?{destructive:!0}:{},affordance:{...e,label:v(n)}})}if(g.length===1){let e=g[0];for(let n of N(a.schema,e))for(let t of $(a.schema,[...l.values()],e,n)){if(t.by==="none"||r.every(d=>d[n]===t.value))continue;let i=r.find(d=>d[n]!==t.value),f=t.acts.find(d=>{let D=t.by==="step"?{[d.subject.arg]:i.id}:{[d.subject.arg]:i.id,[n]:t.value};return a.permits({name:d.name,args:D},u).ok});if(!f)continue;let w=t.by==="step"?{}:{[n]:t.value};if(t.by==="step"&&y.some(d=>d.mutation===f.name))continue;let R=t.by==="step"?v(f):`Move to ${t.label}`,O=`set:${n}:${t.value}`;y.push({id:O,label:R,mutation:f.name,subject:f.subject.arg,args:w,open:[],affordance:{id:O,label:R,provider:"schema",mutation:f.name,args:{[f.subject.arg]:i.id,...w},open:[],score:0,why:`every one is ${e}`,nodeIds:r.map(d=>d.id)}})}}let S=[...y.filter(e=>!e.more),...y.filter(e=>e.more)],A=m.withheld.filter(e=>{let n=l.get(e.mutation);return n?.subject!==void 0&&n.derived?.act!=="edit"&&(r.length===1||e.batch?.length===r.length)}).map(e=>({label:v(l.get(e.mutation)),message:e.refusal.message}));return{acts:S,withheld:A}}function _(a,s,c,r={}){let u=r.author,m=a.allMutations().find(e=>e.name===s.mutation),l=e=>M(a.schema,a.allMutations(),e),g=e=>{let n=a.graph.getNode(e);return n?k(a.schema.tryDefinition(n.kind),n):e},p=[],h=[],o=[];for(let e of[...new Set(c)]){let n={name:s.mutation,args:{...s.args,[s.subject]:e}};if(!m){p.push({id:e,label:g(e),message:`There is no act \u201C${s.mutation}\u201D.`,reason:"invalid"});continue}let t=a.permits(n,u);if(!t.ok){p.push({id:e,label:g(e),message:t.refusal.message,reason:"forbidden"});continue}if(!a.wouldChange(n,u)){h.push(e);continue}o.push({id:e,call:n})}let y=e=>a.previewAll(e,{...u?{author:u}:{},...r.context?{context:r.context}:{}});for(let e=0;o.length>0;e+=1)try{y(o.map(n=>n.call));break}catch(n){let t=[];for(let i of o)try{y([i.call]),t.push(i)}catch(f){p.push({id:i.id,label:g(i.id),message:l(f),reason:x(f).reason})}if(t.length===o.length||e>o.length){for(let i of t)p.push({id:i.id,label:g(i.id),message:l(n),reason:x(n).reason});o=[];break}o=t}if(o.length===0)return{applied:[],unchanged:h,refused:p};let b=s.label??(m?v(m):s.mutation),S=[...new Set(o.map(e=>a.graph.getNode(e.id)?.kind))],A=`${b} \u2014 ${S.length===1&&S[0]?j(a.schema,S[0],o.length):`${o.length} records`}`;try{let e=a.applyAll(o.map(n=>n.call),{intent:A,...u?{author:u}:{},...r.via?{via:r.via}:{}});return{batch:e.batch,intent:A,applied:o.map(n=>n.id),unchanged:h,refused:p,result:e}}catch(e){let n=l(e),t=x(e).reason;return{applied:[],unchanged:h,refused:[...p,...o.map(i=>({id:i.id,label:g(i.id),message:n,reason:t}))],allOrNothing:!0}}}export{V as a,_ as b};
@@ -1 +1 @@
1
- import{a as c,b as d,c as e,d as f,e as g,f as h,g as i,h as j,i as k,j as l,k as m,l as n,m as o,n as p}from"./chunk.EM5CGFNB.js";import{a,b}from"./chunk.N2S45SSL.js";import"./chunk.AGVFW6WC.js";import"./chunk.SIVMZNHZ.js";import"./chunk.A7HMVWMG.js";import"./chunk.GRLPNTUW.js";import"./chunk.EJAVIZ7Y.js";import"./chunk.423SZS7C.js";import"./chunk.TM6JVVGW.js";import"./chunk.SDO3U72B.js";import"./chunk.PFEKS3KO.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";export{j as ARRANGE_NARROW,o as ArrangeBar,e as CHIP_FIELDS,d as MANY_AT_THE_FAR_END,c as TYPED_FROM,p as arrangementCaption,a as arrangementOf,i as chipOffers,m as directionWords,g as farCount,f as farCounts,l as inSentence,h as offeredFilters,n as preloadArrangeLists,k as sayCondition,b as withArrangement};
1
+ import{a as c,b as d,c as e,d as f,e as g,f as h,g as i,h as j,i as k,j as l,k as m,l as n,m as o,n as p}from"./chunk.OPCBZNKF.js";import{a,b}from"./chunk.UK5F3S2N.js";import"./chunk.2VJ52LGS.js";import"./chunk.JI2UVZUU.js";import"./chunk.VICCAWAN.js";import"./chunk.OU5TRY4N.js";import"./chunk.CQPNDJAC.js";import"./chunk.GYTVL6GR.js";import"./chunk.TMYGLXR6.js";import"./chunk.SDO3U72B.js";import"./chunk.P4CLT32V.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";export{j as ARRANGE_NARROW,o as ArrangeBar,e as CHIP_FIELDS,d as MANY_AT_THE_FAR_END,c as TYPED_FROM,p as arrangementCaption,a as arrangementOf,i as chipOffers,m as directionWords,g as farCount,f as farCounts,l as inSentence,h as offeredFilters,n as preloadArrangeLists,k as sayCondition,b as withArrangement};
@@ -1 +1 @@
1
- var o=new Set(["tell","me","about","what","how","show","describe","the","a","an","and","please"]),k=new Set([...o,"where","is","are","was","find","any","anything","something","things","called","named","which","who","of","for","with","to","in","on","i","my","do","does","have","has","can","you","it","that","this","there","we","our","got","be"]);function S(t){return t.flatMap(e=>{let n=e.repairs.find(s=>!s.missing?.length);return n?[{mutation:n.mutation,args:{...n.args},why:e.message}]:[]})}export{S as a};
1
+ var o=new Set(["tell","me","about","what","how","show","describe","the","a","an","and","please"]),R=new Set([...o,"where","is","are","was","find","any","anything","something","things","called","named","which","who","of","for","with","to","in","on","i","my","do","does","have","has","can","you","it","that","this","there","we","our","got","be"]);function v(t){return t.flatMap(e=>{let n=e.repairs.find(s=>!s.missing?.length);return n?[{mutation:n.mutation,args:{...n.args},why:e.message}]:[]})}export{v as a};
@@ -1 +1 @@
1
- import{g as a}from"./chunk.LD6S2FL5.js";import{c as p}from"./chunk.TABIRLQS.js";import{Ga as d}from"./chunk.PFEKS3KO.js";function v(n){let r=new Map;for(let i of n.kinds){let e=n.tryDefinition(i),o=a(e),s=d(e);r.set(i,{fields:new Set(Object.keys(e?.fields?.shape??{})),edges:new Map(Object.entries(e?.edges??{}).map(([l,h])=>[l,h.cardinality??"many"])),...o?{computed:o}:{},...s.size>0?{linked:s}:{}})}let t=a(n);return t&&r.set(p,{computed:t}),r}export{v as a};
1
+ import{g as a}from"./chunk.NVRK6A7T.js";import{c as p}from"./chunk.FKJ3HIA5.js";import{Ga as d}from"./chunk.P4CLT32V.js";function v(n){let r=new Map;for(let i of n.kinds){let e=n.tryDefinition(i),o=a(e),s=d(e);r.set(i,{fields:new Set(Object.keys(e?.fields?.shape??{})),edges:new Map(Object.entries(e?.edges??{}).map(([l,h])=>[l,h.cardinality??"many"])),...o?{computed:o}:{},...s.size>0?{linked:s}:{}})}let t=a(n);return t&&r.set(p,{computed:t}),r}export{v as a};
@@ -0,0 +1 @@
1
+ import{a as O,b}from"./chunk.BYY7YXBI.js";import"./chunk.XWXYC3BJ.js";import"./chunk.MY5OXSS7.js";import"./chunk.NVRK6A7T.js";import"./chunk.FKJ3HIA5.js";import"./chunk.GYTVL6GR.js";import{G as z,T as M,aa as S}from"./chunk.TMYGLXR6.js";import"./chunk.SDO3U72B.js";import{Zc as A}from"./chunk.P4CLT32V.js";import"./chunk.SLBWPVIY.js";import{b as v}from"./chunk.AJZBJBMO.js";var o=v(z(),1);var t=v(M(),1);function G(i){for(let d of i)for(let[r,s]of Object.entries(d))if(s===!1)return`${r} == true`;return""}var w={margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function j({ask:i,close:d}){let{store:r,principal:s,subscriptions:h,app:f}=S(),c=(0,o.useRef)(null),p=(0,o.useId)(),[n,u]=(0,o.useState)(0),[l,y]=(0,o.useState)(!0),[m,P]=(0,o.useState)(()=>{let e=i.choices.find(g=>g.on==="reaches");if(!e)return"";let a=e.record!==void 0?r.graph.getNode(e.record):void 0;return G(a?[a]:r.graph.nodesOfKind(e.kind).slice(0,5))}),[C,x]=(0,o.useState)(null),[W,k]=(0,o.useState)(!1);(0,o.useEffect)(()=>{let e=c.current;e&&!e.open&&e.showModal()},[]);let T=()=>{let e=i.returnTo;d(),requestAnimationFrame(()=>{e?.isConnected?e.focus():document.querySelector("[data-graview-page-title], main h1, [data-testid='activity-button']")?.focus()})},N=e=>e.on==="reaches"?{...e,condition:m}:e,E=e=>b(r,{when:N(e),alsoMine:!l}),L=async()=>{let e=N(i.choices[n]),a=O(r,e);if(a){x(a);return}k(!0);try{await h.add({who:A(s),app:f?.name??"app",when:e,...l?{}:{alsoMine:!0}}),T()}catch(g){k(!1),x(g instanceof Error?g.message:String(g))}};return(0,t.jsx)("dialog",{ref:c,"aria-labelledby":p,"data-testid":"notify-sheet",onClose:T,onClick:e=>{e.target===e.currentTarget&&e.currentTarget.close()},style:{width:"min(92vw, 420px)",padding:0,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)"},children:(0,t.jsxs)("form",{method:"dialog",onSubmit:e=>{e.preventDefault(),L()},style:{display:"grid",gap:12,padding:18},children:[(0,t.jsx)("h2",{id:p,style:{margin:0,fontSize:"1.0625rem"},children:"Notify me"}),(0,t.jsxs)("fieldset",{style:{margin:0,padding:0,border:0,display:"grid",gap:6},children:[(0,t.jsx)("legend",{style:{...w,marginBottom:6},children:"Tell me"}),i.choices.map((e,a)=>(0,t.jsxs)("label",{style:{display:"flex",gap:8,alignItems:"baseline",cursor:"pointer"},children:[(0,t.jsx)("input",{type:"radio",name:`${p}-when`,checked:n===a,onChange:()=>u(a),"data-notify-choice":e.on}),(0,t.jsx)("span",{children:e.on==="reaches"?`When ${e.record!==void 0?"it":"one"} reaches a condition`:E(e)})]},a))]}),i.choices[n]?.on==="reaches"?(0,t.jsxs)("label",{style:{display:"grid",gap:4},children:[(0,t.jsx)("span",{style:w,children:"The condition, in the app's own words (done == true, amount > 100)"}),(0,t.jsx)("input",{value:m,onChange:e=>P(e.target.value),"data-testid":"notify-condition",autoComplete:"off",spellCheck:!1})]}):null,(0,t.jsxs)("label",{style:{display:"flex",gap:8,alignItems:"center"},children:[(0,t.jsx)("input",{type:"checkbox",checked:l,onChange:e=>y(e.target.checked),"data-testid":"notify-others-only"}),"Only when someone else does it"]}),(0,t.jsxs)("p",{style:w,"data-testid":"notify-said",children:[E(i.choices[n]),"."]}),C?(0,t.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-danger, var(--graview-ink))"},children:C}):null,(0,t.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[(0,t.jsx)("button",{type:"button",onClick:()=>c.current?.close(),children:"Cancel"}),(0,t.jsx)("button",{type:"submit",autoFocus:!0,disabled:W,"data-testid":"notify-keep",style:{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"},children:"Notify me"})]})]})})}function B({style:i}){let{store:d,principal:r,subscriptions:s,app:h}=S(),f=(r.onBehalfOf??r).id,[c,p]=(0,o.useState)([]);return(0,o.useEffect)(()=>{if(f===void 0)return;let n=!0,u=()=>void Promise.resolve(s.list(f)).then(y=>n&&p(y.filter(m=>m.app===(h?.name??"app"))),()=>n&&p([]));u();let l=s.onChange?.(u);return()=>{n=!1,l?.()}},[s,f,h]),c.length===0?null:(0,t.jsxs)("section",{"aria-label":"What you are told of","data-testid":"notified",style:{display:"grid",gap:6,...i},children:[(0,t.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"You are told"}),(0,t.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:c.map(n=>(0,t.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"baseline",justifyContent:"space-between"},"data-subscription":n.id,children:[(0,t.jsx)("span",{style:{fontSize:"0.8125rem"},children:b(d,n)}),(0,t.jsx)("button",{type:"button","data-testid":"notify-stop","aria-label":`Stop: ${b(d,n)}`,onClick:u=>{let l=u.currentTarget.closest("li"),y=(l?.nextElementSibling??l?.previousElementSibling)?.querySelector("button");Promise.resolve(s.remove(n.id)).then(()=>(y??document.querySelector("[data-testid='activity-button']"))?.focus())},style:{padding:"1px 8px",fontSize:"0.8125rem"},children:"Stop"})]},n.id))})]})}export{B as NotifiedList,j as NotifySheet};
@@ -0,0 +1 @@
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as ne}from"./chunk.GJQF7I22.js";import{o as be,p as te,s as V,t as Me}from"./chunk.OW72XZF4.js";import{m as X,n as we,o as ke,p as Z,q as ee}from"./chunk.OJGHDWI6.js";import{c as Se}from"./chunk.CQPNDJAC.js";import{b as pe,c as ve,d as j,e as J,g as ye,o as Ae}from"./chunk.GYTVL6GR.js";import{D as q,Da as ge,Ea as he,F as K,Fa as T,G as O,J as me,La as F,Na as Q,O as fe,T as M,aa as A,ba as B,ca as _,m as ce,v as ue,z as de}from"./chunk.TMYGLXR6.js";import{a as E}from"./chunk.SDO3U72B.js";import{Jc as ae,Oc as se,ia as z,jd as le}from"./chunk.P4CLT32V.js";import{b as y}from"./chunk.AJZBJBMO.js";var P=y(O(),1),D=y(M(),1),re=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.SRFZKDQ6.js")))),De=re.part(t=>(0,D.jsx)(t.HoverChipDoor,{}),{quiet:!0}),xe="A",$=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.KHRS2SKB.js","./chunk.MX3Y3LPH.js","./chunk.B6LKLV32.js","./chunk.Y5AMZBHA.js","./chunk.SPU3BVAO.js","./chunk.2VJ52LGS.js","./chunk.JI2UVZUU.js","./chunk.HJCQ6I3S.js","./chunk.7GAC7U34.js","./chunk.T3RTFTOZ.js","./chunk.MN6WHE4B.js","./chunk.W2DKFQ6R.js","./chunk.LYIHPVDZ.js","./chunk.FU4YSVWX.js","./chunk.TNL2BVCH.js","./chunk.TBSPEO2L.js","./chunk.3SBTQ66X.js","./chunk.3H7YIKKC.js","./chunk.ET3XJDPX.js","./chunk.3TVAE7LE.js","./chunk.JX2C3HVD.js","./chunk.3MU37W5D.js","./chunk.XOZU4OFA.js","./chunk.Z7N3MJ36.js","./chunk.ZJXUWOG3.js","./chunk.TI4OSTQV.js","./chunk.HVX7LFWR.js","./chunk.GLTWLQ6L.js","./chunk.ACB4TD4W.js","./chunk.XCQ7ZPR5.js","./chunk.MY5OXSS7.js","./chunk.NVRK6A7T.js","./chunk.FKJ3HIA5.js","./chunk.OW72XZF4.js","./chunk.OJGHDWI6.js","./chunk.KRODTMGR.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.OHDJYGH7.js"))));var Ce=$.part((t,e)=>(0,D.jsx)(t.InspectorPane,{...e}),{what:"This card's acts"});function Le(t){let e=()=>{(typeof navigator>"u"||navigator.onLine!==!1)&&t()},n=globalThis;if(n.requestIdleCallback){let c=n.requestIdleCallback(e,{timeout:5e3});return()=>n.cancelIdleCallback?.(c)}let o=setTimeout(e,2500);return()=>clearTimeout(o)}var Oe=150,Ne="[data-graview-pick], [data-graview-view], [data-graview-record], [data-graview-act], [data-graview-field], a[href]";function Re(t){if(t.closest("[data-graview-face='pages'], [data-graview-popover]"))return null;let e=t.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??t.closest("[data-graview-view]")?.getAttribute("data-graview-view");return e?{face:"scene",on:e,about:[e]}:null}function We(t){let{store:e,principal:n,providers:o,ai:c}=A(),u=Me(),v=K(c),r=(0,P.useRef)({aimAt:t,store:e,principal:n,providers:o,prepareSections:u,chipsOn:v});r.current={aimAt:t,store:e,principal:n,providers:o,prepareSections:u,chipsOn:v},(0,P.useEffect)(()=>{if(typeof document>"u")return;let i=null,w=null,k=null,f=h=>{let d=r.current,b=d.chipsOn?d.aimAt(h):null;b&&(k=h,re.load().then(H=>{k===h&&H.restOn(b,h)},()=>{}))},l=()=>{i&&clearTimeout(i.timer),i=null},p=h=>{let d=r.current,b=d.aimAt(h);if(!b)return;let H=JSON.stringify([b.face,b.on,b.about,b.field,b.place,b.act,d.store.log.length]);H!==w&&(w=H,d.prepareSections(b),$.load().then(Pe=>Pe.prepareActs(d.store,b,{principal:d.principal,providers:d.providers}),()=>{}))},a=h=>h.target instanceof Element?h.target.closest(Ne):null,m=h=>{if(h.pointerType==="touch")return;let d=a(h);d!==null&&d===i?.element||(l(),d!==null&&(i={element:d,timer:setTimeout(()=>{i=null,p(d),f(d)},Oe)}))},g=h=>{let d=h.relatedTarget;k!==null&&!(d instanceof Node&&k.contains(d))&&(k=null,re.current?.leaveRest()),i!==null&&(d instanceof Node&&i.element.contains(d)||l())},S=h=>{if(h.pointerType==="mouse")return;let d=a(h);d&&p(d)},I=h=>{if(!ge())return;let d=a(h);d&&p(d)};return document.addEventListener("pointerover",m,{passive:!0}),document.addEventListener("pointerout",g,{passive:!0}),document.addEventListener("pointerdown",S,{capture:!0,passive:!0}),document.addEventListener("focusin",I),()=>{l(),document.removeEventListener("pointerover",m),document.removeEventListener("pointerout",g),document.removeEventListener("pointerdown",S,{capture:!0}),document.removeEventListener("focusin",I)}},[])}function ot({placement:t="float",openActs:e,aimAt:n}={}){let{menuAt:o,setMenuAt:c,registerActsDoor:u,ai:v}=A(),{selection:r}=F();We(n??Re),(0,P.useEffect)(()=>{if($.current)return;let l=()=>{g(),$.prefetch()},p=()=>{},a=he(()=>void(p=Le(l))),m=["pointerdown","keydown"];for(let S of m)document.addEventListener(S,l,{capture:!0,passive:!0});function g(){a(),p();for(let S of m)document.removeEventListener(S,l,{capture:!0})}return g},[]),(0,P.useEffect)(()=>{if(t==="menu")return u({key:xe,open:e??(l=>{let p=l.getBoundingClientRect(),a=l.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??l.closest("[data-graview-view]")?.getAttribute("data-graview-view")??void 0;c({x:Math.round(p.left+Math.min(16,p.width/2)),y:Math.round(Math.min(p.bottom,p.top+36)),...a?{on:a}:{}})})}),()=>u(null)},[t,u,c,e]);let i=o!==null||r.length>0&&e===void 0,[w,k]=(0,P.useState)(i);(0,P.useEffect)(()=>{i&&k(!0)},[i]);let f=K(v)?(0,D.jsx)(P.Suspense,{fallback:null,children:(0,D.jsx)(De,{})}):null;return!w&&!i?f:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(P.Suspense,{fallback:null,children:(0,D.jsx)(Ce,{placement:t,chosen:e===void 0})}),f]})}var U=y(O(),1),Y=y(M(),1),Ge=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.25VJPUDH.js","./chunk.KHRS2SKB.js","./chunk.MX3Y3LPH.js","./chunk.B6LKLV32.js","./chunk.ESK3UZRC.js","./chunk.MMVCZOEX.js","./chunk.OJ64WTLW.js","./chunk.GMAXA5GV.js","./chunk.Y5AMZBHA.js","./chunk.IBJBCZKG.js","./chunk.NQ26KMSQ.js","./chunk.GJQF7I22.js","./chunk.SPU3BVAO.js","./chunk.OPCBZNKF.js","./chunk.UK5F3S2N.js","./chunk.2VJ52LGS.js","./chunk.JI2UVZUU.js","./chunk.HJCQ6I3S.js","./chunk.7GAC7U34.js","./chunk.T3RTFTOZ.js","./chunk.MN6WHE4B.js","./chunk.W2DKFQ6R.js","./chunk.LYIHPVDZ.js","./chunk.FU4YSVWX.js","./chunk.TNL2BVCH.js","./chunk.NZDHXREL.js","./chunk.TBSPEO2L.js","./chunk.5ON3JSAK.js","./chunk.3SBTQ66X.js","./chunk.SSAY4ITS.js","./chunk.3H7YIKKC.js","./chunk.ET3XJDPX.js","./chunk.3TVAE7LE.js","./chunk.JX2C3HVD.js","./chunk.3MU37W5D.js","./chunk.XOZU4OFA.js","./chunk.Z7N3MJ36.js","./chunk.ZJXUWOG3.js","./chunk.TI4OSTQV.js","./chunk.HVX7LFWR.js","./chunk.WVUJXDXZ.js","./chunk.GLTWLQ6L.js","./chunk.ACB4TD4W.js","./chunk.XCQ7ZPR5.js","./chunk.MY5OXSS7.js","./chunk.NVRK6A7T.js","./chunk.FKJ3HIA5.js","./chunk.GZHZLJBF.js","./chunk.OW72XZF4.js","./chunk.OJGHDWI6.js","./chunk.KRODTMGR.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.HASVT7IC.js")))),He=Ge.part((t,e)=>{let n=t.DraftFrame;return(0,Y.jsx)(n,{...e})},{what:"The view"});function lt(t){let{seatTalk:e}=A();return(0,U.useSyncExternalStore)(e.subscribe,()=>e.get().draft!==null,()=>!1)?(0,Y.jsx)(U.Suspense,{fallback:null,children:(0,Y.jsx)(He,{...t})}):null}var C=y(O(),1),x=y(M(),1),Ee=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.JI2UVZUU.js","./chunk.R5R7CLOU.js","./chunk.3TVAE7LE.js","./chunk.JX2C3HVD.js","./chunk.3MU37W5D.js","./chunk.XOZU4OFA.js","./chunk.Z7N3MJ36.js","./chunk.6KYWJXZR.js","./chunk.TI4OSTQV.js","./chunk.ACB4TD4W.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.IFL2MYTQ.js")))),ze=Ee.part((t,e)=>{let n=t.QuickAskCard;return(0,x.jsx)(n,{...e})},{what:"The quick ask"});function ft({face:t,on:e=!0}){let{ai:n,aiDesk:o,selection:c,view:u}=A(),v=fe()?.open??!1,r=e&&q(n)&&!v,i=ye(o),w=(0,C.useRef)(null),k=(0,C.useRef)({selection:c,place:u.within?.view});return k.current={selection:c,place:u.within?.view},(0,C.useEffect)(()=>{if(!r)return;let f=ve(o);return f.drawn+=1,j(f),()=>{f.drawn=Math.max(0,f.drawn-1),f.drawn===0&&(f.open=null),j(f)}},[r,o]),(0,C.useEffect)(()=>{if(!r)return;let f=l=>{if(l.defaultPrevented||l.key.toLowerCase()!=="k"||!(l.metaKey||l.ctrlKey)||l.altKey||l.shiftKey)return;let p=w.current?.closest("[data-graview-embed]"),a=l.target,m=!(a instanceof Node)||a===document.body||a===document.documentElement;if(p&&!(m||a instanceof Node&&p.contains(a)))return;l.preventDefault(),Ee.prefetch();let g=document.activeElement,{selection:S,place:I}=k.current;J(o,{pointed:{...S[0]!==void 0?{on:S[0]}:{},about:S,...I?{place:I}:{}},returnTo:g instanceof HTMLElement&&g!==document.body?g:null})};return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[r,o]),r?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("span",{ref:w,hidden:!0,"data-graview-quick-ask":t}),i?(0,x.jsx)(C.Suspense,{fallback:null,children:(0,x.jsx)(ze,{face:t,opening:i,close:()=>J(o,null)},i.at)}):null]}):null}var R=y(O(),1),L=y(M(),1),oe=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.R5R7CLOU.js","./chunk.3TVAE7LE.js","./chunk.JX2C3HVD.js","./chunk.3MU37W5D.js","./chunk.XOZU4OFA.js","./chunk.Z7N3MJ36.js","./chunk.6KYWJXZR.js","./chunk.TI4OSTQV.js","./chunk.ACB4TD4W.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.QPAJCRFB.js")))),qe=oe.part((t,e)=>{let n=t.InlineAiMenu;return(0,L.jsx)(n,{...e})},{what:"The AI's suggestions"}),Be=oe.part((t,e)=>{let n=t.GhostTray;return(0,L.jsx)(n,{...e})},{quiet:!0});function _e(){let{ai:t}=A(),e=q(t);return(0,R.useMemo)(()=>e?n=>({id:"inline-ai",heading:"AI",render:o=>(0,L.jsx)(R.Suspense,{fallback:null,children:(0,L.jsx)(qe,{target:n,close:o})}),prepare:()=>oe.prefetch()}):null,[e])}var Fe=[];function kt({children:t}){let e=_e(),n=(0,R.useMemo)(()=>e?[e]:Fe,[e]);return(0,L.jsx)(V,{sections:n,children:t})}function St(t){let{ai:e,aiDesk:n}=A(),{ghost:o}=me(n);return o===null||o.onCard||e.off?null:(0,L.jsx)(R.Suspense,{fallback:null,children:(0,L.jsx)(Be,{...t})})}var N=y(O(),1);var Te=y(M(),1),W=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.WESWDXRW.js"))));function Ve(t){let e=t.about[0];if(t.about.length!==1||!e?.startsWith("aggregate:"))return;let n=e.slice(10).split("+");return n.length===1?n[0]:void 0}function $e(t,e){return t.filter(n=>n.as!==e.as&&!n.hidden&&(n.kind===e.kind||n.over?.includes(e.kind)===!0)).at(-1)}function Ye(t){let e=B(),n=e?.keptViews,o=e?.views,c=(0,N.useContext)(Ae);return(0,N.useMemo)(()=>!n||!o?null:u=>{let v=n.current(),r=Ve(u);if(u.place===void 0){if(u.face!=="pages"||r===void 0||u.on!==void 0||!v.may.lenses||!n.lens)return null;let l=o.arrangement?.()?.hide?.includes(r)===!0,p=m=>void W.load().then(g=>g.setListHidden(r,z(e.store.schema,r),n,m,c),String);return{id:"tidy-view",items:[l?{id:"show-list",label:"Show",hint:"Back in the places, for everyone",run:()=>p(!1)}:{id:"hide-list",label:"Hide",hint:"Off the places, for everyone; still at its address",run:()=>p(!0)}],prepare:()=>W.prefetch()}}let i=o.places().find(l=>l.as===u.place&&(r===void 0||l.kind===r||l.over?.includes(r)===!0));if(!i)return null;let w=le(i,v,n);if(!w)return null;let k=l=>void W.load().then(p=>p.setHidden(i,w,n,l,c),String);return{id:"tidy-view",items:[i.hidden?{id:"show-view",label:"Show",hint:"Back in the places, for everyone",run:()=>k(!1)}:{id:"hide-view",label:"Hide",hint:"Off the places and the scene, for everyone",run:()=>k(!0)},{id:"delete-view",label:"Delete",hint:`Kept ${30} days under Recently deleted`,run:()=>{let l=$e(o.places(),i);W.load().then(p=>p.remove(i,w,n,c).then(a=>a&&t?.(i,l)),String)}}],prepare:()=>W.prefetch()}},[n,o,c,t])}var Ue=[];function Dt({children:t}){let{view:e,go:n}=Q(),o=(0,N.useCallback)((v,r)=>{let i=e.within?.view;e.focusId===ue(v.kind)&&(i===void 0||i===v.as)&&n(r?de(e,r.kind,r.as):ce(e,!0))},[e,n]),c=Ye(o),u=(0,N.useMemo)(()=>c?[c]:Ue,[c]);return(0,Te.jsx)(V,{sections:u,children:t})}function Ot(t={}){return t.scope===void 0?ne:pe(ne,t.scope)}var G=y(O(),1),s=y(M(),1);function qt({inside:t=!1,widthOf:e}={}){let{store:n,view:o,emphasis:c,setEmphasis:u}=A(),v=be(),{selection:r,set:i}=F(),{show:w}=Q(),k=_(),f=(0,G.useMemo)(()=>{let a=new Map;for(let m of n.graph.allEdges()){let g=a.get(m.kind)??{count:0,ends:new Set};g.count+=1;for(let S of[m.from,m.to]){let I=n.graph.getNode(S);I&&g.ends.add(`kind:${I.kind}`)}a.set(m.kind,g)}return[...a.entries()].sort(([m],[g])=>m.localeCompare(g)).map(([m,g])=>({kind:m,count:g.count,ends:[...g.ends]}))},[n,k]),l=Math.max(0,...f.map(a=>a.count));if((0,G.useEffect)(()=>()=>u(null),[u]),!o.overview&&!t||f.length===0)return null;let p=new Set;for(let a of r){if(a.startsWith("kind:")){p.add(a);continue}let m=n.graph.getNode(a);m&&p.add(`kind:${m.kind}`)}return(0,s.jsxs)("section",{"aria-label":"What the lines mean",role:t?"group":void 0,"data-testid":"relation-key",style:t?{display:"grid",gap:1}:{position:"absolute",left:16,top:14,zIndex:se("rail"),display:"grid",gap:1,padding:"8px 10px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",maxWidth:Ke,animation:"graview-settle 380ms 280ms ease backwards"},children:[t?null:(0,s.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:"var(--graview-ink-faint)",paddingBottom:2},children:f.length===1?"1 relation":`${f.length} relations`}),e?(0,s.jsx)(Je,{aloft:o.overview===!0}):null,f.map(({kind:a,count:m,ends:g})=>{let{connector:S,style:I}=te(v,a),h=je(n.schema,a),d=c!==null?c===a:p.size===0||g.some(b=>p.has(b));return(0,s.jsxs)("button",{type:"button",title:n.schema.edge(a)?.description===void 0?`${m} of these`:h.words,onMouseEnter:()=>u(a),onMouseLeave:()=>u(null),onFocus:()=>u(a),onBlur:()=>u(null),onClick:()=>{i(g),w(null)},style:{all:"unset",outline:"revert-layer",cursor:"pointer",display:"grid",gridTemplateColumns:"30px 1fr auto",alignItems:"center",gap:8,minHeight:23,padding:"2px 4px",borderRadius:6,opacity:d?1:.4},children:[(0,s.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",style:{display:"block",opacity:S.visible?1:.35},children:o.overview&&e?(0,s.jsx)("path",{d:"M 1 5 L 29 5",fill:"none",className:"graview-key-ribbon",stroke:"var(--graview-ink)",strokeOpacity:.35,strokeWidth:e(m,l)}):(0,s.jsx)("path",{d:"M 1 5 L 29 5",fill:"none",stroke:Z(I),strokeWidth:ee(I,!0),strokeDasharray:X[I.pattern],strokeLinecap:"round"})}),(0,s.jsxs)("span",{style:{display:"grid",minWidth:0},"data-graview-relation-words":a,children:[(0,s.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink)"},children:h.words}),(0,s.jsx)("span",{style:{fontSize:"0.6875rem",color:"var(--graview-ink-faint)"},children:h.ends})]}),S.visible?null:(0,s.jsx)("span",{"data-graview-quiet":a,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontStyle:"italic"},children:"not drawn"}),(0,s.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontVariantNumeric:"tabular-nums"},children:m})]},a)})]})}var Ke="min(280px, calc(100% - 28px))";function je(t,e,n){let o=t.edge(e)?.from??[],c=new Map;for(let r of n!==void 0&&o.includes(n)?[n]:o.length>0?o:[""]){let i=Se(t,r,e,"out");c.set(i,[...c.get(i)??[],r])}let u=r=>r==="*"?"anything":z(t,r),v=[...c].map(([r,i])=>{let w=i.flatMap(f=>t.tryDefinition(f)?.edges[e]?.to??[]),k=i[0]&&w.length>0?`${i.map(u).join(", ")} \u2192 ${(w.includes("*")?["*"]:[...new Set(w)]).map(u).join(", ")}`:"";return[r.charAt(0).toUpperCase()+r.slice(1),k]});return{words:v.map(([r])=>r).join(" \xB7 "),ends:v.flatMap(([,r])=>r?[r]:[]).join(" \xB7 ")}}function Bt({edgeKind:t,kit:e,width:n=30}){let o=B(),c=(0,G.useMemo)(()=>ae(e??o?.brand?.kit),[e,o?.brand?.kit]),{connector:u,style:v}=te(c,t);return(0,s.jsx)("svg",{width:n,height:"8","aria-hidden":"true","data-testid":"relation-mark","data-graview-relation":t,style:{display:"inline-block",verticalAlign:"middle",opacity:u.visible?1:.35},children:(0,s.jsx)("path",{d:`M 1 4 L ${n-1} 4`,fill:"none",stroke:Z(v),strokeWidth:ee(v,!0),strokeDasharray:X[v.pattern],strokeLinecap:"round"})})}function Je({aloft:t}){let e={display:"grid",gridTemplateColumns:"30px 1fr",alignItems:"center",gap:8,minHeight:23,padding:"2px 4px"},n={fontSize:"0.75rem",color:"var(--graview-ink-muted)"};return(0,s.jsxs)("div",{role:"group","aria-label":"The lines","data-testid":"line-manners",style:{display:"grid",gap:1,paddingBottom:6,marginBottom:4,borderBottom:"1px solid var(--graview-edge)"},children:[t?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{style:e,"data-graview-manner":"ribbon",children:[(0,s.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-ink)",strokeOpacity:.35,strokeWidth:6})}),(0,s.jsx)("span",{style:n,children:"A relation between two districts, as wide as the links along it \u2014 point at one for its words"})]}),(0,s.jsxs)("div",{style:e,"data-graview-manner":"record",children:[(0,s.jsxs)("svg",{width:"30",height:"10","aria-hidden":"true",children:[(0,s.jsx)("path",{d:"M 1 5 L 25 5",stroke:"var(--graview-accent)",strokeWidth:1.8,strokeLinecap:"round"}),(0,s.jsx)("circle",{cx:26,cy:5,r:3,fill:"var(--graview-accent)"})]}),(0,s.jsx)("span",{style:n,children:"A chosen record's link to another record, labeled with the relation"})]}),(0,s.jsxs)("div",{style:e,"data-graview-manner":"district",children:[(0,s.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-accent)",strokeWidth:1.8,strokeDasharray:"5 4"})}),(0,s.jsx)("span",{style:n,children:"A chosen record's links into a district, with how many"})]})]}):null,(0,s.jsxs)("div",{style:e,"data-graview-manner":"unsure",children:[(0,s.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-accent)",strokeOpacity:ke,strokeWidth:1.8,strokeDasharray:we,strokeLinecap:"round"})}),(0,s.jsx)("span",{style:n,children:"Unsure: a link its maker was less than sure of, until a person keeps it \u2014 point at its words for what it was based on"})]})]})}var Ie=y(O(),1),ie=y(M(),1),Xe=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.25VJPUDH.js","./chunk.LYIHPVDZ.js","./chunk.FU4YSVWX.js","./chunk.TNL2BVCH.js","./chunk.TBSPEO2L.js","./chunk.3SBTQ66X.js","./chunk.JX2C3HVD.js","./chunk.TI4OSTQV.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.32BOL7OL.js")))),Ze=Xe.part(t=>(0,ie.jsx)(t.SuggestedTray,{}),{quiet:!0});function Vt(){let{store:t,whileAway:e}=A(),n=_();return(0,Ie.useMemo)(()=>t.log.all().some(c=>c.suggests!==void 0&&!c.withheld),[t,n])||e?.tidied?(0,ie.jsx)(Ze,{}):null}export{ot as a,lt as b,ft as c,qt as d,Ke as e,Bt as f,_e as g,kt as h,St as i,Ye as j,Dt as k,Ot as l,Vt as m};
@@ -1 +1 @@
1
- import{Ja as y,La as k,R as w,j as c,l as h,m as b,r as f}from"./chunk.TM6JVVGW.js";import{U as i}from"./chunk.PFEKS3KO.js";import{b as g}from"./chunk.AJZBJBMO.js";var s=null,a=new Set,v=e=>{s={kind:e,n:(s?.n??0)+1};for(let t of a)t()},A=()=>s,C=e=>(a.add(e),()=>a.delete(e)),V=()=>{s=null};var d=g(w(),1);function T(e,t){if(e.length===0||t.length===0)return[];let o=new Set(t.map(n=>n.id));return e.filter(n=>n.nodeIds.some(l=>o.has(l)))}var x=(e,t)=>`${i(e)} ${e===1?"problem":"problems"} in ${t}`;function q({kind:e,plural:t,problems:o,flag:n,listed:l=!1}){let{view:p,go:P}=k(),{set:$}=y();if(o.length===0)return null;let u=x(o.length,t),m=o.length===1?"it":"them";return(0,d.jsx)("button",{type:"button",className:"graview-district-problems","data-testid":`district-problems-${e}`,"data-graview-problems":o.length,"aria-expanded":l,"aria-label":u,title:`${u} \u2014 ${o[0].message}${o.length>1?` (and ${i(o.length-1)} more)`:""}. Press to see ${m} and how to fix ${m}.`,onClick:r=>{r.stopPropagation(),p.overview||P(h(c(b(p,!0),null),"view",null)),$([f(e)]),v(e)},onDoubleClick:r=>r.stopPropagation(),onPointerDown:r=>r.stopPropagation(),children:(0,d.jsx)("span",{"aria-hidden":"true",children:`${n} ${i(o.length)}`})})}export{A as a,C as b,V as c,T as d,x as e,q as f};
1
+ import{La as y,Na as k,T as w,j as c,l as h,m as b,r as f}from"./chunk.TMYGLXR6.js";import{U as i}from"./chunk.P4CLT32V.js";import{b as g}from"./chunk.AJZBJBMO.js";var s=null,a=new Set,v=e=>{s={kind:e,n:(s?.n??0)+1};for(let t of a)t()},A=()=>s,C=e=>(a.add(e),()=>a.delete(e)),V=()=>{s=null};var d=g(w(),1);function T(e,t){if(e.length===0||t.length===0)return[];let o=new Set(t.map(n=>n.id));return e.filter(n=>n.nodeIds.some(l=>o.has(l)))}var x=(e,t)=>`${i(e)} ${e===1?"problem":"problems"} in ${t}`;function q({kind:e,plural:t,problems:o,flag:n,listed:l=!1}){let{view:p,go:P}=k(),{set:$}=y();if(o.length===0)return null;let u=x(o.length,t),m=o.length===1?"it":"them";return(0,d.jsx)("button",{type:"button",className:"graview-district-problems","data-testid":`district-problems-${e}`,"data-graview-problems":o.length,"aria-expanded":l,"aria-label":u,title:`${u} \u2014 ${o[0].message}${o.length>1?` (and ${i(o.length-1)} more)`:""}. Press to see ${m} and how to fix ${m}.`,onClick:r=>{r.stopPropagation(),p.overview||P(h(c(b(p,!0),null),"view",null)),$([f(e)]),v(e)},onDoubleClick:r=>r.stopPropagation(),onPointerDown:r=>r.stopPropagation(),children:(0,d.jsx)("span",{"aria-hidden":"true",children:`${n} ${i(o.length)}`})})}export{A as a,C as b,V as c,T as d,x as e,q as f};
@@ -1,2 +1,2 @@
1
- import{g as F,l as b}from"./chunk.TABIRLQS.js";function L(t,o){return o===1&&["every","some","sum","min","max","sort"].includes(t.fn)}function M(t){let o=new Set,e=new Set,r=[],s=[],a=new Set(F),i=(l,f)=>{switch(l.t){case"lit":return;case"ident":f||o.add(l.name);return;case"list":l.items.forEach(c=>i(c,f));return;case"member":i(l.object,f);return;case"unary":i(l.operand,f);return;case"binary":i(l.left,f),i(l.right,f);return;case"where":i(l.set,f),i(l.filter,!0);return;case"call":{e.add(l.fn);let c=(l.fn==="out"||l.fn==="in")&&l.args.length===2?l.args[1]:l.args[0],m=c?.t==="lit"&&typeof c.value=="string"?c.value:void 0;l.fn==="all"&&m&&r.push(m),(l.fn==="out"||l.fn==="in")&&m&&s.push(m),l.args.forEach((v,k)=>i(v,f||L(l,k)));return}}};return i(t,!1),{names:o,functions:e,unknownFunctions:[...e].filter(l=>!a.has(l)),sweeps:r,edges:s}}var p=class extends Error{constructor(e,r,s){super(`${e} (at character ${r+1} of "${s}")`);this.sentence=e;this.at=r;this.source=s}},D=["||","&&","==","!=","<=",">=","<",">","!","|","&","+","-","*","/","%","(",")","[","]",",","."],j={and:"&&",or:"||",not:"!"},T=2e3;function H(t){let o=[],e=0;for(;e<t.length;){let r=t[e];if(r===" "||r===" "||r===`
1
+ import{g as F,l as b}from"./chunk.FKJ3HIA5.js";function L(t,o){return o===1&&["every","some","sum","min","max","sort"].includes(t.fn)}function M(t){let o=new Set,e=new Set,r=[],s=[],a=new Set(F),i=(l,f)=>{switch(l.t){case"lit":return;case"ident":f||o.add(l.name);return;case"list":l.items.forEach(c=>i(c,f));return;case"member":i(l.object,f);return;case"unary":i(l.operand,f);return;case"binary":i(l.left,f),i(l.right,f);return;case"where":i(l.set,f),i(l.filter,!0);return;case"call":{e.add(l.fn);let c=(l.fn==="out"||l.fn==="in")&&l.args.length===2?l.args[1]:l.args[0],m=c?.t==="lit"&&typeof c.value=="string"?c.value:void 0;l.fn==="all"&&m&&r.push(m),(l.fn==="out"||l.fn==="in")&&m&&s.push(m),l.args.forEach((v,k)=>i(v,f||L(l,k)));return}}};return i(t,!1),{names:o,functions:e,unknownFunctions:[...e].filter(l=>!a.has(l)),sweeps:r,edges:s}}var p=class extends Error{constructor(e,r,s){super(`${e} (at character ${r+1} of "${s}")`);this.sentence=e;this.at=r;this.source=s}},D=["||","&&","==","!=","<=",">=","<",">","!","|","&","+","-","*","/","%","(",")","[","]",",","."],j={and:"&&",or:"||",not:"!"},T=2e3;function H(t){let o=[],e=0;for(;e<t.length;){let r=t[e];if(r===" "||r===" "||r===`
2
2
  `||r==="\r"){e++;continue}if(r>="0"&&r<="9"){let a=e;for(;e<t.length&&/[0-9.]/.test(t[e]);)e++;let i=t.slice(a,e),l=Number(i);if(!Number.isFinite(l)||i.split(".").length>2)throw new p(`"${i}" is not a number`,a,t);o.push({k:"num",v:l,at:a});continue}if(r==="'"||r==='"'){let a=e++,i="";for(;e<t.length&&t[e]!==r;)t[e]==="\\"&&e+1<t.length&&e++,i+=t[e++];if(e>=t.length)throw new p("a quoted word is never closed",a,t);e++,o.push({k:"str",v:i,at:a});continue}if(/[A-Za-z_]/.test(r)){let a=e;for(;e<t.length&&/[A-Za-z0-9_]/.test(t[e]);)e++;let i=t.slice(a,e),l=Object.hasOwn(j,i)?j[i]:void 0;o.push(l?{k:"op",v:l,at:a}:{k:"id",v:i,at:a});continue}let s=D.find(a=>t.startsWith(a,e));if(!s)throw new p(`"${r}" is not part of the rule language`,e,t);o.push({k:"op",v:s,at:e}),e+=s.length}return o.push({k:"end",at:t.length}),o}function w(t){if(t.length>T)throw new p(`an expression may be at most ${T} characters`,0,t.slice(0,40));let o=H(t),e=0,r=()=>o[e],s=n=>{let d=r();return d.k==="op"&&d.v===n},a=n=>{let d=r();return d.k==="id"&&d.v===n},i=(n,d)=>{if(!s(n))throw new p(`expected ${d}`,r().at,t);e++},l=0,f=(n,d)=>{if(++l>64)throw new p("the expression nests too deeply",n,t);try{return d()}finally{l--}},c=(n,d)=>()=>{let g=d();for(;;){let y=r(),S=y.k==="op"?n.find(q=>q===y.v):y.k==="id"&&y.v==="in"&&n.includes("in")?"in":void 0;if(!S)return g;e++,g={t:"binary",op:S,left:g,right:d(),at:y.at}}},m=()=>{let n=r();if(n.k==="num")return e++,{t:"lit",value:n.v,at:n.at};if(n.k==="str")return e++,{t:"lit",value:n.v,at:n.at};if(n.k==="id"){if(e++,n.v==="true"||n.v==="false")return{t:"lit",value:n.v==="true",at:n.at};if(n.v==="null")return{t:"lit",value:null,at:n.at};if(s("(")){e++;let d=[];if(!s(")"))for(;;){if(d.push(h()),s(",")){e++;continue}break}return i(")",`")" to close ${n.v}(\u2026)`),{t:"call",fn:n.v,args:d,at:n.at}}return{t:"ident",name:n.v,at:n.at}}if(n.k==="op"&&n.v==="("){e++;let d=f(n.at,h);return i(")",'a ")"'),d}if(n.k==="op"&&n.v==="["){e++;let d=[];if(!s("]"))for(;;){if(d.push(h()),s(",")){e++;continue}break}return i("]",'a "]" to close the list'),{t:"list",items:d,at:n.at}}throw n.k==="end"?new p("the expression ends too soon",n.at,t):new p(`"${n.k==="op"?n.v:""}" cannot start a value here`,n.at,t)},v=()=>{let n=m();for(;;){if(s(".")){let d=r();e++;let g=r();if(g.k!=="id")throw new p('expected a field name after "."',g.at,t);e++,n={t:"member",object:n,name:g.v,at:d.at};continue}if(a("where")){let d=r().at;e++,n={t:"where",set:n,filter:f(d,h),at:d};continue}return n}},k=()=>{let n=r();return n.k==="op"&&(n.v==="!"||n.v==="-")?(e++,{t:"unary",op:n.v,operand:f(n.at,k),at:n.at}):v()},P=c(["*","/","%"],k),z=c(["+","-"],P),N=c(["&"],z),R=c(["|"],N),_=()=>{let n=R(),d=r(),g=d.k==="op"&&["==","!=","<","<=",">",">="].includes(d.v)?d.v:d.k==="id"&&d.v==="in"?"in":void 0;return g?(e++,{t:"binary",op:g,left:n,right:R(),at:d.at}):n},O=()=>{let n=r();return n.k==="op"&&n.v==="!"?(e++,{t:"unary",op:"!",operand:f(n.at,O),at:n.at}):_()},B=c(["&&"],O),I=c(["||"],B);function h(){return I()}let K=h();if(r().k!=="end")throw new p("there is more after the end of the expression",r().at,t);return K}function E(t){let o,e=-1,r=0;for(let s=0;s<t.length;s++){let a=t[s];if(o){a==="\\"?s++:a===o&&(o=void 0);continue}a==="'"||a==='"'?o=a:a==="("||a==="["?r++:a===")"||a==="]"?r--:a==="|"&&r===0&&(t[s+1]==="|"?s++:e=s)}if(e>0&&t.slice(e+1).trim()===x){let s=E(t.slice(0,e));if(s>=0)return s}return e}var x="capital",$=/\s*(?:'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)")\s*(,|$)/y;function U(t){let o=E(t);if(o>=0){if(t.slice(o+1).trim()!==x)throw new u('only "capital" may follow another formatter, like {n | words | capital}');let e=t.slice(0,o);if(e.trim()===x)throw new u('"capital" is said once');return{...C(e),capital:!0}}return t.trim()===x?{args:[],capital:!0}:C(t)}function C(t){let o=t.indexOf(":"),e=(o>=0?t.slice(0,o):t).trim();if(!b.includes(e))throw new u(`"${e}" is not a formatter; use one of ${[...b,x].join(", ")}`);let r=[];if(o>=0&&e==="excerpt"){let s=t.slice(o+1).trim();if(!/^\d+$/.test(s)||Number(s)<20||Number(s)>1e3)throw new u("excerpt is told at most how many characters, 20 to 1000: {summary | excerpt: 80}");r.push(s)}else if(o>=0){let s=t.slice(o+1),a=0;for(;a<s.length;){$.lastIndex=a;let i=$.exec(s);if(!i)throw new u(`"${e}" is told quoted words, like ${e}: 'offer'`);if(r.push((i[1]??i[2]??"").replace(/\\(.)/g,"$1")),a=$.lastIndex,i[3]==="")break}}if(e==="plural"&&(r.length<1||r.length>2))throw new u("plural is told its noun, like {count | plural: 'offer'}, and its plural where English does not make it: plural: 'person', 'people'");if(e!=="plural"&&e!=="excerpt"&&r.length>0)throw new u(`"${e}" takes nothing after it`);return{format:e,args:r}}var u=class extends Error{constructor(e){super(e);this.sentence=e}};function Y(t){let o=[],e=0;for(;e<t.length;){let r=t.indexOf("{",e);if(r<0){o.push({text:t.slice(e)});break}r>e&&o.push({text:t.slice(e,r)});let s=t.indexOf("}",r);if(s<0)throw new u(`a "{" at character ${r+1} is never closed`);let a=t.slice(r+1,s),i=E(a),l=(i>=0?a.slice(0,i):a).trim(),f=i>=0?U(a.slice(i+1)):void 0,c=E(l);if(c>=0&&b.includes(l.slice(c+1).split(":")[0].trim()))throw new u('only "capital" may follow another formatter, like {n | words | capital}');o.push({expr:w(l),source:l,...f?.format?{format:f.format}:{},...f&&f.args.length>0?{formatArgs:f.args}:{},...f?.capital?{capital:!0}:{}}),e=s+1}return o}function A(t){let o=new Map;for(let[e,r]of Object.entries(t?.computed??{}))o.set(e,typeof r=="string"?{expr:r}:r);return o}function re(t){let o=A(t);if(o.size===0)return;let e=new Map;for(let[r,s]of o)try{e.set(r,w(s.expr))}catch(a){if(!(a instanceof p))throw a}return e}function Z(t,o,e=new Set){let r=A(t).get(o);if(!r||e.has(o))return!1;let s;try{s=w(r.expr)}catch{return!1}let a=M(s);if(a.edges.length>0||a.sweeps.length>0||[...a.functions].some(c=>c==="out"||c==="in"||c==="all"))return!1;let i=t.fields,l=c=>i instanceof Set?i.has(c):Object.hasOwn(i,c),f=new Set([...e,o]);return[...a.names].every(c=>l(c)||Z(t,c,f))}export{M as a,p as b,w as c,u as d,Y as e,A as f,re as g,Z as h};
@@ -1 +1 @@
1
- import{h as p}from"./chunk.423SZS7C.js";import{R as c}from"./chunk.TM6JVVGW.js";import{kc as u}from"./chunk.PFEKS3KO.js";import{b as h}from"./chunk.AJZBJBMO.js";var s={person:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><circle cx="11.6" cy="5.4" r="2.5"/><path d="M7.9 12.4c0-2.1 1.7-3.8 3.7-3.8s3.7 1.7 3.7 3.8v3.2H7.9z"/><path d="M8 12.6 6.4 17.2"/><path d="M15.2 12.6 16.8 17.2"/><path d="M9.8 15.6v5"/><path d="M13.4 15.6v5"/></svg>',plot:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.6 9.4 12 4.6l9.4 4.8-9.4 4.8z"/><path d="M2.6 9.4v4.4l9.4 4.8 9.4-4.8V9.4"/><path d="M12 14.2v4.4"/><path d="M7 11.9v3"/><path d="M17 11.9v3"/></svg>',box:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.4 7.9 12 3.6l8.6 4.3-8.6 4.3z"/><path d="M3.4 7.9v8.2L12 20.4l8.6-4.3V7.9"/><path d="M12 12.2v8.2"/></svg>',task:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M4.4 6.6 12 2.9l7.6 3.7v9.5L12 19.8 4.4 16.1z"/><path d="M12 12.4v7.4"/><path d="M4.4 6.6 12 10.3l7.6-3.7"/><path d="M8 9.6l2.4 2.4L16 8.4"/></svg>',shift:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.2 8.2 12 4l8.8 4.2-8.8 4.2z"/><path d="M3.2 8.2v7.2L12 19.6l8.8-4.2V8.2"/><path d="M12 12.4v7.2"/><path d="M6.6 10.8v3.4"/><path d="M9.3 12v3.4"/></svg>',list:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 10.4 12 6l9.2 4.4-9.2 4.4z"/><path d="M2.8 10.4v3.2L12 18l9.2-4.4v-3.2"/><path d="M6.6 8.6 15.8 13"/><path d="M9.4 7.2 18.6 11.6"/></svg>',vehicle:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 14.2 5 9.4l8.6-1.6 5.4 3-1 3.6z"/><path d="M2.8 14.2v2.2h2.4"/><path d="M18 16.4h1.9l.1-2.2"/><circle cx="7.6" cy="16.6" r="1.9"/><circle cx="16.1" cy="16.6" r="1.9"/><path d="M8.6 8.2 9.8 12l7.2-1"/></svg>',rule:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M5.4 19.4V6.6l12 12.8z"/><path d="M5.4 6.6 7.6 5.5l12 12.8-2.2 1.1"/><path d="M5.4 19.4 7.6 18.3h12"/><path d="M5.4 10.1h1.7"/><path d="M5.4 13.3h1.7"/><path d="M5.4 16.5h1.7"/></svg>',note:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M6.2 6.2 14.8 10.5v9L6.2 15.2z"/><path d="M12.4 9.3 14.8 10.5l-.6 2.3"/><path d="M8.2 10.6 12.8 12.9"/><path d="M8.2 13.2 11.4 14.8"/></svg>'},v=Object.keys(s);function i(e){if(e)return s[e]??(e.trimStart().startsWith("<svg")?e:void 0)}var a=h(c(),1);function A({kind:e,schema:o,brand:n,size:r=16,title:t}){let f=o?.tryDefinition?.(e)?.figure,d=i(n?.figures?.[e]??f),l=Math.round(u(e,n?.accents)),g=p(d);return d?(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"figure",dangerouslySetInnerHTML:g,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:r,height:r,flex:"0 0 auto",color:`hsl(${l} 55% 52%)`,"--graview-figure-size":`${r}px`}}):(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"dot",style:{display:"inline-block",width:Math.round(r*.8),height:Math.round(r*.5),flex:"0 0 auto",background:`hsl(${l} 55% 52%)`,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)"}})}function C(e,o,n){return i(n?.figures?.[e]??o?.tryDefinition?.(e)?.figure)!==void 0}export{A as a,C as b};
1
+ import{h as p}from"./chunk.GYTVL6GR.js";import{T as c}from"./chunk.TMYGLXR6.js";import{rc as u}from"./chunk.P4CLT32V.js";import{b as h}from"./chunk.AJZBJBMO.js";var s={person:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><circle cx="11.6" cy="5.4" r="2.5"/><path d="M7.9 12.4c0-2.1 1.7-3.8 3.7-3.8s3.7 1.7 3.7 3.8v3.2H7.9z"/><path d="M8 12.6 6.4 17.2"/><path d="M15.2 12.6 16.8 17.2"/><path d="M9.8 15.6v5"/><path d="M13.4 15.6v5"/></svg>',plot:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.6 9.4 12 4.6l9.4 4.8-9.4 4.8z"/><path d="M2.6 9.4v4.4l9.4 4.8 9.4-4.8V9.4"/><path d="M12 14.2v4.4"/><path d="M7 11.9v3"/><path d="M17 11.9v3"/></svg>',box:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.4 7.9 12 3.6l8.6 4.3-8.6 4.3z"/><path d="M3.4 7.9v8.2L12 20.4l8.6-4.3V7.9"/><path d="M12 12.2v8.2"/></svg>',task:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M4.4 6.6 12 2.9l7.6 3.7v9.5L12 19.8 4.4 16.1z"/><path d="M12 12.4v7.4"/><path d="M4.4 6.6 12 10.3l7.6-3.7"/><path d="M8 9.6l2.4 2.4L16 8.4"/></svg>',shift:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.2 8.2 12 4l8.8 4.2-8.8 4.2z"/><path d="M3.2 8.2v7.2L12 19.6l8.8-4.2V8.2"/><path d="M12 12.4v7.2"/><path d="M6.6 10.8v3.4"/><path d="M9.3 12v3.4"/></svg>',list:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 10.4 12 6l9.2 4.4-9.2 4.4z"/><path d="M2.8 10.4v3.2L12 18l9.2-4.4v-3.2"/><path d="M6.6 8.6 15.8 13"/><path d="M9.4 7.2 18.6 11.6"/></svg>',vehicle:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 14.2 5 9.4l8.6-1.6 5.4 3-1 3.6z"/><path d="M2.8 14.2v2.2h2.4"/><path d="M18 16.4h1.9l.1-2.2"/><circle cx="7.6" cy="16.6" r="1.9"/><circle cx="16.1" cy="16.6" r="1.9"/><path d="M8.6 8.2 9.8 12l7.2-1"/></svg>',rule:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M5.4 19.4V6.6l12 12.8z"/><path d="M5.4 6.6 7.6 5.5l12 12.8-2.2 1.1"/><path d="M5.4 19.4 7.6 18.3h12"/><path d="M5.4 10.1h1.7"/><path d="M5.4 13.3h1.7"/><path d="M5.4 16.5h1.7"/></svg>',note:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M6.2 6.2 14.8 10.5v9L6.2 15.2z"/><path d="M12.4 9.3 14.8 10.5l-.6 2.3"/><path d="M8.2 10.6 12.8 12.9"/><path d="M8.2 13.2 11.4 14.8"/></svg>'},v=Object.keys(s);function i(e){if(e)return s[e]??(e.trimStart().startsWith("<svg")?e:void 0)}var a=h(c(),1);function A({kind:e,schema:o,brand:n,size:r=16,title:t}){let f=o?.tryDefinition?.(e)?.figure,d=i(n?.figures?.[e]??f),l=Math.round(u(e,n?.accents)),g=p(d);return d?(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"figure",dangerouslySetInnerHTML:g,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:r,height:r,flex:"0 0 auto",color:`hsl(${l} 55% 52%)`,"--graview-figure-size":`${r}px`}}):(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"dot",style:{display:"inline-block",width:Math.round(r*.8),height:Math.round(r*.5),flex:"0 0 auto",background:`hsl(${l} 55% 52%)`,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)"}})}function C(e,o,n){return i(n?.figures?.[e]??o?.tryDefinition?.(e)?.figure)!==void 0}export{A as a,C as b};
@@ -0,0 +1,2 @@
1
+ import{a as Z,b as qe}from"./chunk.KHRS2SKB.js";import"./chunk.MX3Y3LPH.js";import"./chunk.B6LKLV32.js";import{i as De,j as Ne,k as Oe}from"./chunk.Y5AMZBHA.js";import"./chunk.SPU3BVAO.js";import"./chunk.2VJ52LGS.js";import"./chunk.JI2UVZUU.js";import"./chunk.HJCQ6I3S.js";import"./chunk.7GAC7U34.js";import"./chunk.T3RTFTOZ.js";import"./chunk.MN6WHE4B.js";import"./chunk.W2DKFQ6R.js";import"./chunk.LYIHPVDZ.js";import{a as We,b as S}from"./chunk.FU4YSVWX.js";import{a as X,b as $e}from"./chunk.TNL2BVCH.js";import"./chunk.TBSPEO2L.js";import"./chunk.3SBTQ66X.js";import"./chunk.3H7YIKKC.js";import"./chunk.ET3XJDPX.js";import"./chunk.3TVAE7LE.js";import{b as Pe,c as Le}from"./chunk.JX2C3HVD.js";import"./chunk.3MU37W5D.js";import"./chunk.XOZU4OFA.js";import"./chunk.Z7N3MJ36.js";import"./chunk.ZJXUWOG3.js";import"./chunk.TI4OSTQV.js";import"./chunk.HVX7LFWR.js";import"./chunk.GLTWLQ6L.js";import"./chunk.ACB4TD4W.js";import"./chunk.XCQ7ZPR5.js";import"./chunk.MY5OXSS7.js";import"./chunk.NVRK6A7T.js";import"./chunk.FKJ3HIA5.js";import{u as Re}from"./chunk.OW72XZF4.js";import"./chunk.OJGHDWI6.js";import"./chunk.KRODTMGR.js";import"./chunk.VICCAWAN.js";import{l as ze}from"./chunk.OU5TRY4N.js";import{c as Ce}from"./chunk.CQPNDJAC.js";import{m as Ie}from"./chunk.GYTVL6GR.js";import{G as ot,La as J,Qa as He,T as Me,Ua as Ee,aa as O,h as Ae,u as Te}from"./chunk.TMYGLXR6.js";import"./chunk.SDO3U72B.js";import{Cb as be,Oc as Se,la as Q,ma as N,oc as xe,qc as ke}from"./chunk.P4CLT32V.js";import"./chunk.SLBWPVIY.js";import{b as Y}from"./chunk.AJZBJBMO.js";var a=Y(ot(),1);var t=Y(Me(),1);function bt(u,r,o){let c=r.on??r.about[r.about.length-1];De(u,r.about,{...o,pins:Z(),...c===void 0?{}:{focus:c}})}function xt({placement:u="float",chosen:r=!0}={}){let{menuAt:o}=O();return u==="menu"&&o===null?r?(0,t.jsx)(at,{}):null:(0,t.jsx)(lt,{placement:u})}function at(){let{store:u,setMenuAt:r,view:o}=O(),{selection:c}=J(),h=(0,a.useRef)(null),[E,y]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let b=h.current?.offsetParent??h.current?.parentElement;if(!b)return;let m=Math.round(b.getBoundingClientRect().width);m!==E&&y(m)});let v=c.length===1&&!o.overview?u.graph.getNode(c[0]):void 0;return!v||E===null||E>=Be?(0,t.jsx)("span",{ref:h,hidden:!0}):(0,t.jsx)("button",{type:"button",ref:h,"data-testid":"chosen-acts","aria-label":`What can be done with ${S(u,v.id)}`,"aria-haspopup":"menu",onClick:b=>{let m=b.currentTarget.getBoundingClientRect();r({x:Math.round(m.right),y:Math.round(m.bottom+4),on:v.id})},style:{position:"absolute",right:"calc(14px + var(--graview-dock, 0px))",top:98,zIndex:"var(--graview-layer-overview, 10)",minHeight:30,padding:"0 12px",borderRadius:8,fontSize:"0.8125rem",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Acts\u2026"})}var Be=564;function lt({placement:u}){let{store:r,menuAt:o,setMenuAt:c,view:h,signIn:E}=O(),y=(0,a.useRef)(null),v=(0,a.useRef)(null),b=(0,a.useRef)(null),m=(0,a.useRef)(null);o?.returnTo&&(m.current=o.returnTo);let Ke=e=>{let i=e.closest("[data-graview-asking]")?.getAttribute("data-graview-asking"),n=e.getAttribute("data-pin-for"),d=i??e.getAttribute("data-affordance")??(n===null?null:`pin:${n}`)??e.getAttribute("data-menu-item");v.current=d===null?null:{key:d,element:e}};(0,a.useEffect)(()=>{let e=y.current,i=v.current;if(i===null||document.activeElement!==document.body||i.element.isConnected)return;let n=i.key;if(!e){v.current=null;let k=m.current;m.current=null,(k?.isConnected?k:b.current)?.focus();return}((n.startsWith("pin:")?e.querySelector(`[data-pin-for="${CSS.escape(n.slice(4))}"]`):null)??e.querySelector(`[data-affordance="${CSS.escape(n)}"]:not([disabled])`)??e).focus()});let[_e,je]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let e=y.current?.offsetParent??y.current?.parentElement;if(e instanceof HTMLElement&&(b.current=e),!e)return;let i=e.getBoundingClientRect();je(n=>n&&n.left===i.left&&n.top===i.top&&n.width===i.width&&n.height===i.height?n:{left:i.left,top:i.top,width:i.width,height:i.height})});let{selection:Ue,set:Ve,clear:Ge}=J(),s=o?.about??Ue,[q,Ye]=(0,a.useState)(()=>Z()),F=o?.on??s[s.length-1],B=o?.about,Qe=(0,a.useMemo)(()=>({pins:q,...F===void 0?{}:{focus:F},...B?{about:B}:{}}),[q,F,B]),Je=(0,a.useMemo)(()=>new Set(r.allMutations().filter(e=>e.pinned).map(e=>e.name)),[r]),{affordances:g,withheld:ee,observations:te}=Ne(Qe),I=ke(ee,E),f=I?st:ee,Xe=o===null?null:{face:o.face??"scene",on:o.on,about:s,field:o.field,place:o.place,href:o.href,act:o.act,element:o.returnTo},ne=Re(Xe),ie=te.some(e=>e.id.startsWith("schema:waits:")),{apply:Ze,preview:et}=Oe(),[C,z]=(0,a.useState)(null),[tt,re]=(0,a.useState)(!1),[oe,ae]=(0,a.useState)(!1),[L,R]=(0,a.useState)(""),nt=$e({letters:!0}),[le,K]=(0,a.useState)(null),_=(0,a.useRef)([]),j=(e,i)=>{try{return et(e,i),Ze(e,i),K(null),c(null),_.current=[],!0}catch(n){return K(ze(r.schema,r.allMutations(),n)),_.current=n instanceof be?n.issues.map(d=>String(d.path[0]??"")).filter(Boolean):[],!1}},$=[...new Set(s.flatMap(e=>{let i=r.graph.getNode(e);return i?[i.kind]:[]}))],x=$.length>0?$:[...new Set(s.flatMap(e=>Te(e)))],p=s.length===1?Ae(s[0]):null,U=p?{from:r.graph.getNode(p.from),to:r.graph.getNode(p.to)}:null,se=p?Le(r,p):void 0,de=se?.provisional?se:void 0,ue=p?(()=>{let e=r.schema.tryDefinition(r.graph.getNode(p.from)?.kind??"")?.edges?.[p.kind],i=r.graph.getNode(p.to);return e?.inverse&&i?`From ${S(r,i.id)}: ${e.inverse}`:null})():null;(0,a.useEffect)(()=>{z(null),re(!1),ae(!1),K(null),R("")},[s,o?.about]);let l=o!==null,it=u==="menu"&&!l,A=(0,a.useRef)(o);A.current=o;let pe=Ee("acts",{open:l&&u==="menu",onOpenChange:e=>{e||c(null)},at:()=>A.current?{x:A.current.x,y:A.current.y}:null,returnTo:()=>{let e=A.current?.returnTo;if(e?.isConnected)return e;let i=A.current?.on;return i?document.querySelector(`[data-graview-view="${CSS.escape(i)}"]`):null},align:"start"}),ce=(_e?.width??Number.POSITIVE_INFINITY)<Be;if((0,a.useLayoutEffect)(()=>{let e=y.current?.offsetParent;if(!e||!ce||l)return;let i=y.current?.getBoundingClientRect().height??0,n=`${Math.round(i)+20}px`;if(e.style.paddingBottom===n)return;let d=e.style.paddingBottom;return e.style.paddingBottom=n,()=>{e.style.paddingBottom=d}}),s.length===0&&!l)return null;let ge=o?.title!==void 0||s.length>0&&!(s.length===1&&s[0]===h.focusId),he=Math.max(1,Math.min(9,g.length)),T=[...g.filter(e=>e.provider==="invariant"&&!e.destructive),...g.filter(e=>e.pinned&&e.provider!=="invariant"&&!e.destructive),...g.filter(e=>!e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...g.filter(e=>e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...g.filter(e=>e.destructive)],me=T.length>he&&!l,fe=L.trim().toLowerCase(),w=me&&fe.length>0?T.filter(e=>`${e.label} ${e.why}`.toLowerCase().includes(fe)):null,V=w??(tt||l?T:T.slice(0,he)),ye=w?0:T.length-V.length,W=[];for(let e of V){let i=!l&&e.provider==="invariant",n=!l&&!i&&e.pinned!==void 0&&!e.destructive,d=!l&&!i&&!n&&e.ties===!0&&!e.destructive,k=i?e.why:n?"pinned":d?"its ties":null,D=i?"violation":n||d?"ties":null,H=W[W.length-1];H&&H.heading===k?H.items.push(e):W.push({heading:k,tone:D,items:[e]})}let G=g.find(e=>e.id===C),P=s.length===1?S(r,s[0]):null,ve=e=>{if(!P)return e;let i=e.startsWith(`"${P}"`)?e.slice(P.length+2):e.startsWith(P)?e.slice(P.length):null;if(i===null)return e;let n=i.trimStart();return n.length===0?e:n[0].toUpperCase()+n.slice(1)},rt=new Set(l?[]:V.filter(e=>e.provider==="invariant").map(e=>e.why)),M=te.filter(e=>!rt.has(e.text)).map(e=>({...e,text:ve(e.text)}));return it?null:(0,t.jsxs)("section",{...l?pe.pane:{},ref:e=>{y.current=e,l&&pe.pane.ref(e)},"aria-label":"Inspector","data-graview-offstage":"","data-testid":l?"context-menu":"inspector-strip",tabIndex:-1,onFocus:e=>Ke(e.target),onBlur:e=>{e.relatedTarget!==null&&(v.current=null)},onMouseDown:e=>e.stopPropagation(),style:{...l?He:{position:"absolute",zIndex:Se("rail")},boxSizing:"border-box",display:"flex",flexDirection:"column",gap:7,padding:"9px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",...l?{width:300,maxHeight:"min(52cqh, 420px)",overflow:"auto"}:ce?{left:10,right:10,width:"auto",bottom:10,maxHeight:"min(42cqh, 300px)",overflow:"auto"}:{left:14,top:h.overview?"min(296px, 38cqh)":44,width:236,maxHeight:h.overview?"calc(100cqh - min(296px, 38cqh) - 20px)":"calc(68cqh - 94px)",overflow:"auto"}},children:[(0,t.jsx)("h2",{style:{...Ie,margin:0},children:"Inspector"}),(0,t.jsxs)("div",{style:{display:ge||!l?"flex":"none",alignItems:"baseline",flexWrap:"wrap",gap:"2px 8px",minWidth:0,paddingRight:l?0:24},children:[ge?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("strong",{style:{fontSize:"0.9375rem",whiteSpace:"nowrap"},children:o?.title??(s.length===1?S(r,s[0]):`${s.length} selected`)}),$.length>0||p?(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:p?"relation":$.map(e=>N(r.schema.tryDefinition(e),e)).join(" \xB7 ")}):null,s.length===1&&!p&&o?.face!=="pages"?(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:h.expanded.includes(s[0])?"\xB7 double-click closes":"\xB7 double-click opens"}):null]}):null,(0,t.jsx)("span",{style:{flex:"1 1 auto"}})]}),l?null:(0,t.jsx)("button",{type:"button",onClick:()=>{c(null),Ge()},"aria-label":"Clear selection",title:"Clear selection",style:{position:"absolute",top:6,right:6,flex:"0 0 auto",width:24,height:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.875rem",lineHeight:1,borderRadius:7},children:"\xD7"}),p&&U?(0,t.jsxs)("div",{style:{display:"grid",gap:6},children:[ue?(0,t.jsx)("p",{"data-testid":"edge-said",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:ue}):null,de?(0,t.jsx)("p",{"data-testid":"edge-provisional",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:Pe(de)}):null,(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[["from",U.from],["to",U.to]].map(([e,i],n)=>(0,t.jsxs)(a.Fragment,{children:[n===1?(0,t.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-ink-faint)"},children:"\u2192"}):null,i?(0,t.jsx)("button",{type:"button","data-testid":`edge-${e}`,onClick:()=>Ve([i.id]),title:`Select ${S(r,i.id)}`,style:{fontSize:"0.8125rem",padding:"3px 9px",borderRadius:6},children:S(r,i.id)}):(0,t.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"gone"})]},e))})]}):null,!p&&s.length===1&&xe(r,s[0])?(0,t.jsx)("p",{"data-testid":"left-alone",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:"Left alone: nothing automated changes it."}):null,M.length>0?(0,t.jsx)("div",{"data-testid":"observations",title:M.map(e=>e.text).join(`
2
+ `),style:{display:"grid",gap:3},children:M.slice(0,2).map(e=>(0,t.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[e.text,e===M[1]&&M.length>2?(0,t.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" +",M.length-2]}):null]},e.id))}):null,l?ne.start.map(e=>(0,t.jsx)(Fe,{section:e,close:()=>c(null)},e.id)):null,le?(0,t.jsx)("p",{"data-testid":"refused",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-warn)"},children:le}):null,me?(0,t.jsx)("input",{"data-testid":"action-filter",value:L,onChange:e=>R(e.target.value),placeholder:`Filter ${T.length} actions\u2026`,"aria-label":"Filter actions",onKeyDown:e=>{if(e.key==="Escape"){e.stopPropagation(),L.length>0?R(""):e.currentTarget.blur();return}if(e.key==="Enter"&&w?.length===1){let i=w[0];if(i.destructive)return;i.open.length>0?z(i.id):j(i)&&R("")}},style:{font:"inherit",fontSize:"0.875rem",padding:"5px 9px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):null,w!==null&&w.length===0?(0,t.jsxs)("p",{"data-testid":"no-matches",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:["Nothing offered here matches \u201C",L.trim(),"\u201D."]}):null,I&&g.length===0||g.length===0&&!ie&&s.length===0?null:g.length===0&&!ie?(0,t.jsx)("p",{"data-testid":"no-affordances",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:f.length>0?`Nothing you may do with ${p?"this relation":x.length===1?Q(N(r.schema.tryDefinition(x[0]),x[0])):"this mix of kinds"} \u2014 ${f.length} action${f.length===1?"":"s"} withheld.`:p?`Nothing can be done with this line yet \u2014 nothing this app declares makes or breaks \u201C${Ce(r.schema,r.graph.getNode(p.from)?.kind??"",p.kind,"out")}\u201D.`:`Nothing can be done with ${x.length===1?Q(N(r.schema.tryDefinition(x[0]),x[0])):"this mix of kinds"} yet \u2014 nothing this app declares acts on ${x.length===1?"it":"them"}.`}):(0,t.jsxs)("ol",{...nt,"data-testid":"affordances",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[W.map((e,i)=>(0,t.jsxs)(a.Fragment,{children:[e.heading?(0,t.jsxs)("li",{"data-graview-heading":e.tone,style:{fontSize:"0.75rem",lineHeight:1.4,color:e.tone==="violation"?"var(--graview-warn)":"var(--graview-ink-faint)",...e.tone!=="violation"?{letterSpacing:"0.12em",textTransform:"uppercase",fontSize:"0.75rem"}:{},padding:"2px 2px 1px",marginTop:i>0?6:0},children:[e.tone==="violation"?"\u26A0 ":"",e.tone==="violation"?ve(e.heading):e.heading]}):i>0?(0,t.jsx)("li",{"aria-hidden":"true",style:{borderTop:"1px solid var(--graview-edge)",margin:"6px 0 3px"}}):null,e.items.map(n=>(0,t.jsxs)("li",{style:{display:"flex",gap:2,alignItems:"stretch"},onKeyDown:d=>{if(d.metaKey||d.ctrlKey||d.altKey)return;let k=d.currentTarget.querySelector("[data-affordance]"),D=d.currentTarget.querySelector("[data-pin-for]"),H=d.target===D,we=d.key==="ArrowRight"&&!H?D:H&&["ArrowLeft","ArrowUp","ArrowDown"].includes(d.key)?k:null;we&&(d.preventDefault(),d.stopPropagation(),we.focus())},children:[(0,t.jsxs)("button",{type:"button",[X]:"","data-affordance":n.id,"data-rank":n.rank,"data-graview-destructive":n.destructive||void 0,"aria-pressed":C===n.id,title:n.why,style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:C===n.id?"var(--graview-accent)":l?"transparent":"var(--graview-edge)",background:l?"none":"var(--graview-panel)",boxShadow:"none",...n.destructive?{color:"var(--graview-warn)"}:{},...C===n.id?{color:"var(--graview-accent)"}:{}},onClick:()=>{if(n.open.length>0){z(C===n.id?null:n.id);return}j(n)},children:[n.label,n.open.length>0?(0,t.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:" \u2026"}):null,w?.length===1&&w[0]?.id===n.id&&!n.destructive?(0,t.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}):null]}),(0,t.jsx)("button",{type:"button","data-testid":"pin-toggle",tabIndex:-1,"data-pin-for":n.mutation,"aria-pressed":n.pinned!==void 0,"aria-label":n.pinned!==void 0?`Unpin ${n.label}`:`Pin ${n.label}`,title:n.pinned==="declared"?"Pinned by the app \u2014 unpin it for yourself":n.pinned==="user"?"Unpin":"Pin to the top",onClick:()=>Ye(qe(q,n.mutation,Je.has(n.mutation))),style:{flex:"0 0 auto",width:24,minHeight:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.75rem",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7,color:n.pinned==="user"?"var(--graview-accent)":n.pinned==="declared"?"var(--graview-ink-muted)":"var(--graview-ink-faint)"},children:n.pinned!==void 0?"\u2605":"\u2606"})]},n.id))]},`${e.heading??"plain"}-${i}`)),ye>0?(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button",[X]:"",onClick:()=>re(!0),title:`Show all ${g.length} actions`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",ye," more"]})}):null]}),I?(0,t.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>{c(null),I.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left"},children:I.label}):null,f.length>0?(0,t.jsxs)("ul",{"data-testid":"withheld",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[f.slice(0,l||oe?f.length:3).map(e=>(0,t.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,t.jsx)("button",{type:"button",disabled:!0,"data-affordance":e.id,"data-rank":e.rank,"data-withheld":e.refusal.wouldNeed.join(",")||"nobody",style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8,borderStyle:"dashed",width:"100%",textAlign:"left",background:"none"},children:(0,t.jsx)("s",{children:e.label})}),(0,t.jsx)("span",{"data-testid":"withheld-why",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-ink-muted)",padding:"0 10px"},children:e.refusal.message})]},e.id)),!l&&!oe&&f.length>3?(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button","data-testid":"withheld-more",onClick:()=>ae(!0),title:`Show all ${f.length} actions this seat may not take`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",f.length-3," more withheld"]})}):null]}):null,l?ne.end.map(e=>(0,t.jsx)(Fe,{section:e,close:()=>c(null)},e.id)):null,G?(0,t.jsx)(We,{affordance:G,onApply:e=>{if(j(G,e))z(null);else return _.current},onCancel:()=>z(null)}):null]})}var st=[];function Fe({section:u,close:r}){return(0,t.jsxs)("div",{"data-menu-section":u.id,...u.heading?{role:"group","aria-label":u.heading}:{},style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5},children:[u.heading?(0,t.jsx)("p",{"aria-hidden":"true",style:{margin:0,padding:"2px 2px 1px",fontSize:"0.75rem",lineHeight:1.4,letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:u.heading}):null,u.items&&u.items.length>0?(0,t.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:u.items.map(o=>(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button","data-menu-item":o.id,onClick:()=>{r(),o.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},children:[o.label,o.hint?(0,t.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",o.hint]}):null]})},o.id))}):null,u.render?.(r)]})}export{xt as InspectorPane,bt as prepareActs};
@@ -1,6 +1,6 @@
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{Da as K,G as C,R as k}from"./chunk.TM6JVVGW.js";import{a as H}from"./chunk.SDO3U72B.js";import{b}from"./chunk.AJZBJBMO.js";var n=b(C(),1),N=450,_=10,O=t=>t instanceof HTMLInputElement?t.dataset.graviewChooseBox??void 0:void 0,q={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:-1/0,End:1/0},S=t=>t instanceof Element?t.closest("[data-graview-choose]"):null,G=t=>t instanceof HTMLElement&&(t.isContentEditable||t instanceof HTMLInputElement&&t.type!=="checkbox"||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement);function Y(t){let[i,d]=(0,n.useState)(()=>new Set),l=(0,n.useRef)(null),x=(0,n.useRef)(null),[E,P]=(0,n.useState)(null),R=E!==null&&t.includes(E)?E:t[0],L=(0,n.useMemo)(()=>t.filter(e=>i.has(e)),[t,i]),M=(0,n.useMemo)(()=>new Set(t),[t]);(0,n.useEffect)(()=>{[...i].some(e=>!M.has(e))&&d(e=>new Set([...e].filter(o=>M.has(o))))},[M,i]);let u=(0,n.useCallback)((e,o=!1)=>{let a=l.current;d(s=>{let r=new Set(s),f=a===null?-1:t.indexOf(a),y=t.indexOf(e);if(o&&f>=0&&y>=0){let T=s.has(a);for(let p of t.slice(Math.min(f,y),Math.max(f,y)+1))T?r.add(p):r.delete(p)}else r.has(e)?r.delete(e):r.add(e);return r}),l.current=e},[t]),v=(0,n.useCallback)(e=>d(new Set(e)),[]),A=(0,n.useCallback)(()=>{l.current=null,d(new Set)},[]),c=(0,n.useRef)(null),g=(0,n.useRef)(!1),m=L.length>0,h=()=>{c.current&&clearTimeout(c.current.timer),c.current=null};(0,n.useEffect)(()=>h,[]);let B={ref:x,onKeyDown:e=>{if(G(e.target))return;let o=O(e.target);if(e.key==="Tab"&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&o!==void 0&&m){let s=document.querySelector('[data-testid="several-bar"]'),r=s?.querySelector("[data-mutation]:not([disabled])")??s?.querySelector("button:not([disabled])");if(r){e.preventDefault(),e.stopPropagation(),r.focus();return}}let a=q[e.key];if(o!==void 0&&a!==void 0&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let s=t.indexOf(o),r=t[Math.max(0,Math.min(t.length-1,s+(Number.isFinite(a)?a:a>0?t.length:-t.length)))];if(e.preventDefault(),e.stopPropagation(),r===void 0||r===o)return;if(e.shiftKey){let f=l.current!==null&&t.includes(l.current)?l.current:o,[y,T]=[t.indexOf(f),t.indexOf(r)].sort((p,F)=>p-F);d(p=>new Set([...p,...t.slice(y,T+1)])),l.current=f}P(r),x.current?.querySelector(`[data-graview-choose-box="${CSS.escape(r)}"]`)?.focus();return}if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="a"){e.preventDefault(),e.stopPropagation(),v(t);return}if(e.key===" "&&!e.metaKey&&!e.ctrlKey){let s=S(e.target),r=e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement&&e.target.type==="checkbox";if(!s||r)return;e.preventDefault(),u(s.dataset.graviewChoose,e.shiftKey)}},onFocus:e=>{let o=O(e.target);o!==void 0&&P(o)},onPointerDown:e=>{if(g.current=!1,e.pointerType==="mouse"||e.button>0)return;let o=S(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox")return;let a=o.dataset.graviewChoose;h(),c.current={id:a,x:e.clientX,y:e.clientY,timer:setTimeout(()=>{c.current=null,g.current=!0,u(a)},N)}},onPointerMove:e=>{let o=c.current;o&&Math.hypot(e.clientX-o.x,e.clientY-o.y)>_&&h()},onPointerUp:h,onPointerCancel:h,onClickCapture:e=>{let o=S(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox"&&e.target.hasAttribute("data-graview-choose-box"))return;if(g.current){g.current=!1,e.preventDefault(),e.stopPropagation();return}let s=o.dataset.graviewChoose;if(e.shiftKey&&(m||l.current!==null)){e.preventDefault(),e.stopPropagation(),u(s,!0);return}m&&matchMedia?.("(pointer: coarse)").matches&&(e.preventDefault(),e.stopPropagation(),u(s))},onContextMenu:e=>{(g.current||c.current)&&(e.preventDefault(),e.stopPropagation())},...m?{"data-graview-choosing":""}:{}},j=(0,n.useCallback)(e=>i.has(e),[i]);return{chosen:L,has:j,toggle:u,choose:v,clear:A,listProps:B,boxProps:(e,o)=>({type:"checkbox",className:"graview-choose-box","data-graview-choose-box":e,"aria-label":`Choose ${o}`,tabIndex:e===R?0:-1,checked:i.has(e),onChange:()=>{},onClick:a=>{a.stopPropagation(),u(e,a.shiftKey)}}),list:x}}var $=`
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{Fa as K,G as C,T as k}from"./chunk.TMYGLXR6.js";import{a as H}from"./chunk.SDO3U72B.js";import{b}from"./chunk.AJZBJBMO.js";var n=b(C(),1),N=450,_=10,O=t=>t instanceof HTMLInputElement?t.dataset.graviewChooseBox??void 0:void 0,q={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:-1/0,End:1/0},S=t=>t instanceof Element?t.closest("[data-graview-choose]"):null,G=t=>t instanceof HTMLElement&&(t.isContentEditable||t instanceof HTMLInputElement&&t.type!=="checkbox"||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement);function Y(t){let[i,d]=(0,n.useState)(()=>new Set),l=(0,n.useRef)(null),x=(0,n.useRef)(null),[E,P]=(0,n.useState)(null),R=E!==null&&t.includes(E)?E:t[0],L=(0,n.useMemo)(()=>t.filter(e=>i.has(e)),[t,i]),M=(0,n.useMemo)(()=>new Set(t),[t]);(0,n.useEffect)(()=>{[...i].some(e=>!M.has(e))&&d(e=>new Set([...e].filter(o=>M.has(o))))},[M,i]);let u=(0,n.useCallback)((e,o=!1)=>{let a=l.current;d(s=>{let r=new Set(s),f=a===null?-1:t.indexOf(a),y=t.indexOf(e);if(o&&f>=0&&y>=0){let T=s.has(a);for(let p of t.slice(Math.min(f,y),Math.max(f,y)+1))T?r.add(p):r.delete(p)}else r.has(e)?r.delete(e):r.add(e);return r}),l.current=e},[t]),v=(0,n.useCallback)(e=>d(new Set(e)),[]),A=(0,n.useCallback)(()=>{l.current=null,d(new Set)},[]),c=(0,n.useRef)(null),g=(0,n.useRef)(!1),m=L.length>0,h=()=>{c.current&&clearTimeout(c.current.timer),c.current=null};(0,n.useEffect)(()=>h,[]);let B={ref:x,onKeyDown:e=>{if(G(e.target))return;let o=O(e.target);if(e.key==="Tab"&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&o!==void 0&&m){let s=document.querySelector('[data-testid="several-bar"]'),r=s?.querySelector("[data-mutation]:not([disabled])")??s?.querySelector("button:not([disabled])");if(r){e.preventDefault(),e.stopPropagation(),r.focus();return}}let a=q[e.key];if(o!==void 0&&a!==void 0&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let s=t.indexOf(o),r=t[Math.max(0,Math.min(t.length-1,s+(Number.isFinite(a)?a:a>0?t.length:-t.length)))];if(e.preventDefault(),e.stopPropagation(),r===void 0||r===o)return;if(e.shiftKey){let f=l.current!==null&&t.includes(l.current)?l.current:o,[y,T]=[t.indexOf(f),t.indexOf(r)].sort((p,F)=>p-F);d(p=>new Set([...p,...t.slice(y,T+1)])),l.current=f}P(r),x.current?.querySelector(`[data-graview-choose-box="${CSS.escape(r)}"]`)?.focus();return}if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="a"){e.preventDefault(),e.stopPropagation(),v(t);return}if(e.key===" "&&!e.metaKey&&!e.ctrlKey){let s=S(e.target),r=e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement&&e.target.type==="checkbox";if(!s||r)return;e.preventDefault(),u(s.dataset.graviewChoose,e.shiftKey)}},onFocus:e=>{let o=O(e.target);o!==void 0&&P(o)},onPointerDown:e=>{if(g.current=!1,e.pointerType==="mouse"||e.button>0)return;let o=S(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox")return;let a=o.dataset.graviewChoose;h(),c.current={id:a,x:e.clientX,y:e.clientY,timer:setTimeout(()=>{c.current=null,g.current=!0,u(a)},N)}},onPointerMove:e=>{let o=c.current;o&&Math.hypot(e.clientX-o.x,e.clientY-o.y)>_&&h()},onPointerUp:h,onPointerCancel:h,onClickCapture:e=>{let o=S(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox"&&e.target.hasAttribute("data-graview-choose-box"))return;if(g.current){g.current=!1,e.preventDefault(),e.stopPropagation();return}let s=o.dataset.graviewChoose;if(e.shiftKey&&(m||l.current!==null)){e.preventDefault(),e.stopPropagation(),u(s,!0);return}m&&matchMedia?.("(pointer: coarse)").matches&&(e.preventDefault(),e.stopPropagation(),u(s))},onContextMenu:e=>{(g.current||c.current)&&(e.preventDefault(),e.stopPropagation())},...m?{"data-graview-choosing":""}:{}},j=(0,n.useCallback)(e=>i.has(e),[i]);return{chosen:L,has:j,toggle:u,choose:v,clear:A,listProps:B,boxProps:(e,o)=>({type:"checkbox",className:"graview-choose-box","data-graview-choose-box":e,"aria-label":`Choose ${o}`,tabIndex:e===R?0:-1,checked:i.has(e),onChange:()=>{},onClick:a=>{a.stopPropagation(),u(e,a.shiftKey)}}),list:x}}var $=`
2
2
  .graview-choose-box{width:24px;height:24px;margin:0;accent-color:var(--graview-accent);cursor:pointer;opacity:0}
3
3
  [data-graview-choose]:hover .graview-choose-box,[data-graview-choose]:focus-within .graview-choose-box,.graview-choose-box:focus-visible,.graview-choose-box:checked,[data-graview-choosing] .graview-choose-box{opacity:1}
4
4
  [data-graview-choose]{-webkit-touch-callout:none}
5
5
  [data-graview-choosing] [data-graview-choose]{-webkit-user-select:none;user-select:none}
6
- `;var D=b(C(),1),w=b(k(),1),I=K(H(()=>(__graviewPreload(import.meta.url,["./chunk.FIS27KW4.js","./chunk.EYSQPXVE.js","./chunk.7C4IR4S7.js","./chunk.D53IGR45.js","./chunk.FNK2ZZ5E.js","./chunk.AOEXSQDG.js","./chunk.3NEALGMI.js","./chunk.UT6642FC.js","./chunk.35FUGOSG.js","./chunk.MB7LKKUD.js","./chunk.NQDGUIUQ.js","./chunk.DTRNDSMS.js","./chunk.3EW6L5DY.js","./chunk.AVDXG57A.js","./chunk.LD6S2FL5.js","./chunk.TABIRLQS.js","./chunk.A7HMVWMG.js","./chunk.GRLPNTUW.js","./chunk.EJAVIZ7Y.js","./chunk.423SZS7C.js","./chunk.TM6JVVGW.js","./chunk.SDO3U72B.js","./chunk.PFEKS3KO.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.7SGQ3HFG.js")))),U=I.part((t,i)=>(0,w.jsx)(t.SeveralBar,{...i}),{what:"The selection bar"});function Q(t){return t.chosen.length===0?null:(0,w.jsx)(D.Suspense,{fallback:null,children:(0,w.jsx)(U,{...t})})}var W=()=>I.prefetch();export{Y as a,$ as b,Q as c,W as d};
6
+ `;var D=b(C(),1),w=b(k(),1),I=K(H(()=>(__graviewPreload(import.meta.url,["./chunk.MN6WHE4B.js","./chunk.W2DKFQ6R.js","./chunk.FU4YSVWX.js","./chunk.TNL2BVCH.js","./chunk.3SBTQ66X.js","./chunk.ET3XJDPX.js","./chunk.3TVAE7LE.js","./chunk.JX2C3HVD.js","./chunk.Z7N3MJ36.js","./chunk.MB7LKKUD.js","./chunk.GLTWLQ6L.js","./chunk.ACB4TD4W.js","./chunk.XCQ7ZPR5.js","./chunk.MY5OXSS7.js","./chunk.NVRK6A7T.js","./chunk.FKJ3HIA5.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.7RIFDWDF.js")))),U=I.part((t,i)=>(0,w.jsx)(t.SeveralBar,{...i}),{what:"The selection bar"});function Q(t){return t.chosen.length===0?null:(0,w.jsx)(D.Suspense,{fallback:null,children:(0,w.jsx)(U,{...t})})}var W=()=>I.prefetch();export{Y as a,$ as b,Q as c,W as d};
@@ -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{d as C,e as re}from"./chunk.AGVFW6WC.js";import{e as ee}from"./chunk.SIVMZNHZ.js";import{b as S}from"./chunk.EJAVIZ7Y.js";import{m as X}from"./chunk.423SZS7C.js";import{Da as V,G as se,Oa as J,R as Z,Sa as Q}from"./chunk.TM6JVVGW.js";import{a as K}from"./chunk.SDO3U72B.js";import{O as Y,U as M,da as U}from"./chunk.PFEKS3KO.js";import{b as D}from"./chunk.AJZBJBMO.js";var h=D(se(),1);var n=D(Z(),1),Re=9,le=40,ge=2;function de(e){let r=new Map;for(let i of e.allNodes())r.set(i.kind,(r.get(i.kind)??0)+1);return r}var ue=(e,r)=>(e.far??[]).reduce((i,a)=>i+(r.get(a)??0),0);function ce(e,r,i){if(i)return i.flatMap(s=>e.filters.filter(u=>u.key===s));let a=de(r),o=new Set(e.filters.filter(s=>s.about==="edge"&&ue(s,a)>le).map(s=>s.key));return e.filters.filter(s=>s.about==="edge"?!o.has(s.key):s.about==="via"?o.has(s.key.split(".")[0]):!0)}function pe(e,r){let i=e.filter(a=>a.about==="field"&&a.type==="choice"&&(a.options?.length??0)>0);return r?i:i.slice(0,ge)}var fe=520;function ye(e,r,i,a){let o=i.filters.find(s=>s.key===a.key);if(!o)return`${a.key}: ${a.value}`;if(o.about==="is")return a.value.charAt(0).toUpperCase()+a.value.slice(1);if(o.about==="via")return`${o.label}: ${S(e.tryDefinition(o.far?.[0]??""),o.key.split(".")[1],a.value)}`;if(o.about==="edge"){if(a.value==="*")return`${o.label}: anything`;if(a.value==="none")return`${o.label}: nothing`;let s=r.getNode(a.value);return`${o.label}: ${s?U(e.tryDefinition(s.kind),s):a.value}`}if(o.type==="date"){let[s,u]=a.value.split(":");return`${o.label} ${s} ${u?Y(u):""}`.trim()}if(o.type==="boolean")return`${o.label}: ${a.value==="true"?"yes":"no"}`;if(o.type==="number"){let s=a.value.lastIndexOf(":"),u=a.value.slice(0,Math.max(0,s));if(u==="at-most"||u==="at-least")return`${o.label}: ${u==="at-most"?"at most":"at least"} ${S(e.tryDefinition(i.kind),o.key,Number(a.value.slice(s+1)))}`}return o.type==="text"?`${o.label}: ${a.value}`:`${o.label}: ${S(e.tryDefinition(i.kind),o.key,a.value)}`}var P=e=>/^[A-Z][a-z]/.test(e)?e.charAt(0).toLowerCase()+e.slice(1):e;function me(e){return e?.type==="date"?{asc:"Earliest first",desc:"Latest first"}:e?.type==="number"?{asc:"Lowest first",desc:"Highest first"}:e?.type==="boolean"?{asc:"No first",desc:"Yes first"}:e?.type==="choice"?{asc:"In their order",desc:"In reverse order"}:{asc:"A to Z",desc:"Z to A"}}var x=V(K(()=>(__graviewPreload(import.meta.url,["./chunk.EM5CGFNB.js","./chunk.N2S45SSL.js","./chunk.AGVFW6WC.js","./chunk.SIVMZNHZ.js","./chunk.A7HMVWMG.js","./chunk.GRLPNTUW.js","./chunk.EJAVIZ7Y.js","./chunk.423SZS7C.js","./chunk.TM6JVVGW.js","./chunk.SDO3U72B.js","./chunk.PFEKS3KO.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.XMOIMPUC.js")))),N=x.part((e,r)=>(0,n.jsx)(e.ArrangeLists,{...r}),{what:"This list",quiet:!0}),he=x.part((e,r)=>(0,n.jsx)(e.ArrangeChips,{...r}),{what:"This list",quiet:!0}),Te=()=>x.load(),q=new Map;function Ie(e){let{schema:r,graph:i,kind:a,arrangement:o,onChange:s}=e,u=e.offers??ee(r,a),g=e.testId??"arrange",y=C(e.allow,"sort")&&u.sorts.length>1,m=C(e.allow,"group")&&u.groups.length>0,F=C(e.allow,"filter")?ce(u,i,e.filters):[],L=e.chips?pe(F,e.filters):[],H=F.filter(t=>!L.includes(t)),G=H.length>0,_=e.query!==!1&&e.allow!==!1,w=we(e.noun,e.kept),v=e.past&&e.past.count>0?e.past:null;if(!y&&!m&&!G&&!_&&!w&&!v)return null;let z=t=>JSON.stringify(re(t)),O=`${g}|${a}`,p={current:q.get(O)??{words:new Set,latest:null,at:0}};q.set(O,p.current),p.current.latest&&Date.now()-p.current.at>1500&&!p.current.words.has(z(o))&&(p.current={words:new Set,latest:null,at:0},q.set(O,p.current));let d=p.current.latest??o,b=t=>{let l={...p.current.latest??o,...t};for(let c of Object.keys(l))l[c]===void 0&&delete l[c];p.current.latest=l,p.current.at=Date.now(),p.current.words.add(z(l)),s(l)},f=d.filter??[],R=t=>{let l=f.filter((c,I)=>I!==t);b({filter:l.length>0?l:void 0})},A=t=>f.some(l=>l.key===t.key&&l.value===t.value),te=t=>A(t)?R(f.findIndex(l=>l.key===t.key&&l.value===t.value)):b({filter:[...f,t]}),T=d.sort?u.sorts.find(t=>t.key===d.sort.by):void 0,j=d.group?u.groups.find(t=>t.key===d.group.by):void 0,ne=me(T),k={schema:r,graph:i,offers:{...u,filters:H},arrangement:d,set:b,toggle:te,has:A,testId:g},ae=(t,l)=>A({key:t,value:l})?R(f.findIndex(c=>c.key===t&&c.value===l)):b({filter:[...f.filter(c=>c.key!==t),{key:t,value:l}]}),oe=d.sort?(0,n.jsxs)(n.Fragment,{children:["Sorted by ",P(T?.label??d.sort.by),(0,n.jsx)("span",{"aria-hidden":"true",children:d.sort.direction==="desc"?" \u2193":" \u2191"})]}):"Sort",ie=d.group?.bucket&&j?.buckets?`, a ${d.group.bucket} each`:"",B=d.group?`Grouped by ${P(j?.label??d.group.by)}${ie}`:"Group";return(0,n.jsxs)("div",{"data-testid":`${g}-bar`,role:"group","aria-label":"Arrange",className:"graview-arrange",style:e.style,onPointerEnter:x.prefetch,onFocus:x.prefetch,children:[(0,n.jsx)("style",{children:xe}),(0,n.jsxs)("div",{className:"graview-arrange-line",children:[w?(0,n.jsxs)("span",{className:"graview-arrange-count","data-testid":`${g}-count`,children:[w.kept?(0,n.jsx)("span",{"data-testid":`${g}-kept`,children:w.kept}):null,w.words]}):null,v?(0,n.jsxs)("button",{type:"button",className:"graview-arrange-open","data-testid":`${g}-past`,title:`${M(v.count)} more behind the horizon \u2014 press to widen the view to the past`,onClick:t=>{let l=t.currentTarget.closest("[data-graview-view]"),c=t.currentTarget;v.widen();let I=0,W=()=>{if(document.activeElement!==c&&document.activeElement!==document.body&&c.isConnected)return;let $=l?.querySelector('[role="group"][aria-label="Arrange"] :is(button, input)');if($&&$!==c&&$.isConnected)return $.focus({preventScroll:!0});++I<120&&requestAnimationFrame(W)};requestAnimationFrame(W)},children:["+",M(v.count)," past"]}):null,f.map((t,l)=>{let c=ye(r,i,u,t);return(0,n.jsxs)("span",{className:"graview-arrange-token","data-testid":`${g}-condition`,children:[c,(0,n.jsx)("button",{type:"button","aria-label":`Remove: ${c}`,title:"Remove",onClick:()=>R(l),children:"\xD7"})]},`${t.key}:${t.value}`)}),y?(0,n.jsx)("span",{className:"graview-arrange-part graview-arrange-one",children:(0,n.jsx)(E,{testId:`${g}-sort`,value:d.sort?.by??"",set:d.sort!==void 0,label:"Sort",name:d.sort?`Sorted by ${P(T?.label??d.sort.by)}, ${ne[d.sort.direction].toLowerCase()}`:"Sort",list:t=>(0,n.jsx)(N,{which:"sort",done:t,...k}),children:oe})}):null,m?(0,n.jsx)("span",{className:"graview-arrange-part graview-arrange-one",children:(0,n.jsx)(E,{testId:`${g}-group`,value:d.group?.by??"",set:d.group!==void 0,label:"Group",name:B,list:t=>(0,n.jsx)(N,{which:"group",done:t,...k}),children:B})}):null,G?(0,n.jsx)("span",{className:"graview-arrange-part",children:(0,n.jsx)(E,{testId:`${g}-add`,value:"",set:!1,label:"Filter",name:f.length>0?`Filter \u2014 ${f.length} on`:"Filter",list:t=>(0,n.jsx)(N,{which:"filter",done:t,...k}),children:"Filter"})}):null,y||m?(0,n.jsx)("span",{className:"graview-arrange-part graview-arrange-all",children:(0,n.jsx)(E,{testId:`${g}-all`,value:"",set:!1,label:"Arrange",name:"Arrange: sort and group",list:t=>(0,n.jsx)(N,{which:"all",done:t,parts:{sort:y,group:m,filter:!1},...k}),children:"Arrange"})}):null,_?(0,n.jsxs)("label",{className:"graview-arrange-words-at",children:[(0,n.jsx)("span",{style:X,children:"Find"}),(0,n.jsx)("input",{type:"search",className:"graview-arrange-words","data-testid":`${g}-query`,value:d.query??"",placeholder:"Find\u2026",onChange:t=>b({query:t.target.value.length>0?t.target.value:void 0})})]}):null,L.length>0&&e.chips?(0,n.jsx)(h.Suspense,{fallback:null,children:(0,n.jsx)(he,{offers:L,chips:e.chips,schema:r,graph:i,kind:a,arrangement:d,has:A,choose:ae,testId:g})}):null]})]})}function we(e,r){if(!r)return null;let i=r.shown!==r.of;if(!e)return i?{words:"",kept:`${r.shown} of ${r.of}`}:null;let a=r.of===1?e.one:e.many;return i?{words:` ${a}`,kept:`${r.shown} of ${r.of}`}:{words:`${r.of} ${a}`}}function E({testId:e,value:r,set:i,label:a,name:o,list:s,children:u}){let g=Q("arrange",{align:"start"}),y=(0,h.useRef)(null);return(0,h.useEffect)(()=>{g.open&&y.current?.querySelector('[aria-pressed="true"]')?.focus({preventScroll:!0})},[g.open]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{type:"button",className:"graview-arrange-open","data-testid":e,"data-set":i?"":void 0,value:r,"aria-label":o,...g.trigger,onClick:g.toggle,children:[u,(0,n.jsx)(be,{})]}),g.open?(0,n.jsx)("div",{...g.pane,ref:m=>{g.pane.ref(m),y.current=m},role:"group","aria-label":a,"data-testid":"arrange-list","data-arrange":e,className:"graview-arrange-list",style:J,onKeyDown:ve,children:s(()=>g.setOpen(!1))}):null]})}function ve(e){if(!["ArrowDown","ArrowUp","Home","End"].includes(e.key))return;let r=[...e.currentTarget.querySelectorAll("button:not([disabled]), input")];if(r.length===0)return;let i=r.indexOf(document.activeElement);if(document.activeElement instanceof HTMLInputElement&&document.activeElement.type==="date"&&(e.key==="ArrowUp"||e.key==="ArrowDown"))return;e.preventDefault();let a=e.key==="Home"?0:e.key==="End"?r.length-1:e.key==="ArrowDown"?(i+1)%r.length:(i-1+r.length)%r.length;r[a].focus()}function be(){return(0,n.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 10 10","aria-hidden":"true",focusable:"false",style:{flex:"0 0 auto",opacity:.7},children:(0,n.jsx)("path",{d:"M2 3.5 L5 6.5 L8 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}var xe=`
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{d as C,e as re}from"./chunk.2VJ52LGS.js";import{e as ee}from"./chunk.JI2UVZUU.js";import{b as S}from"./chunk.CQPNDJAC.js";import{m as X}from"./chunk.GYTVL6GR.js";import{Fa as V,G as se,Qa as J,T as Z,Ua as Q}from"./chunk.TMYGLXR6.js";import{a as K}from"./chunk.SDO3U72B.js";import{O as Y,U as M,da as U}from"./chunk.P4CLT32V.js";import{b as D}from"./chunk.AJZBJBMO.js";var h=D(se(),1);var n=D(Z(),1),Re=9,le=40,ge=2;function de(e){let r=new Map;for(let i of e.allNodes())r.set(i.kind,(r.get(i.kind)??0)+1);return r}var ue=(e,r)=>(e.far??[]).reduce((i,a)=>i+(r.get(a)??0),0);function ce(e,r,i){if(i)return i.flatMap(s=>e.filters.filter(u=>u.key===s));let a=de(r),o=new Set(e.filters.filter(s=>s.about==="edge"&&ue(s,a)>le).map(s=>s.key));return e.filters.filter(s=>s.about==="edge"?!o.has(s.key):s.about==="via"?o.has(s.key.split(".")[0]):!0)}function pe(e,r){let i=e.filter(a=>a.about==="field"&&a.type==="choice"&&(a.options?.length??0)>0);return r?i:i.slice(0,ge)}var fe=520;function ye(e,r,i,a){let o=i.filters.find(s=>s.key===a.key);if(!o)return`${a.key}: ${a.value}`;if(o.about==="is")return a.value.charAt(0).toUpperCase()+a.value.slice(1);if(o.about==="via")return`${o.label}: ${S(e.tryDefinition(o.far?.[0]??""),o.key.split(".")[1],a.value)}`;if(o.about==="edge"){if(a.value==="*")return`${o.label}: anything`;if(a.value==="none")return`${o.label}: nothing`;let s=r.getNode(a.value);return`${o.label}: ${s?U(e.tryDefinition(s.kind),s):a.value}`}if(o.type==="date"){let[s,u]=a.value.split(":");return`${o.label} ${s} ${u?Y(u):""}`.trim()}if(o.type==="boolean")return`${o.label}: ${a.value==="true"?"yes":"no"}`;if(o.type==="number"){let s=a.value.lastIndexOf(":"),u=a.value.slice(0,Math.max(0,s));if(u==="at-most"||u==="at-least")return`${o.label}: ${u==="at-most"?"at most":"at least"} ${S(e.tryDefinition(i.kind),o.key,Number(a.value.slice(s+1)))}`}return o.type==="text"?`${o.label}: ${a.value}`:`${o.label}: ${S(e.tryDefinition(i.kind),o.key,a.value)}`}var P=e=>/^[A-Z][a-z]/.test(e)?e.charAt(0).toLowerCase()+e.slice(1):e;function me(e){return e?.type==="date"?{asc:"Earliest first",desc:"Latest first"}:e?.type==="number"?{asc:"Lowest first",desc:"Highest first"}:e?.type==="boolean"?{asc:"No first",desc:"Yes first"}:e?.type==="choice"?{asc:"In their order",desc:"In reverse order"}:{asc:"A to Z",desc:"Z to A"}}var x=V(K(()=>(__graviewPreload(import.meta.url,["./chunk.OPCBZNKF.js","./chunk.UK5F3S2N.js","./chunk.2VJ52LGS.js","./chunk.JI2UVZUU.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.FYDDFOSD.js")))),N=x.part((e,r)=>(0,n.jsx)(e.ArrangeLists,{...r}),{what:"This list",quiet:!0}),he=x.part((e,r)=>(0,n.jsx)(e.ArrangeChips,{...r}),{what:"This list",quiet:!0}),Te=()=>x.load(),q=new Map;function Ie(e){let{schema:r,graph:i,kind:a,arrangement:o,onChange:s}=e,u=e.offers??ee(r,a),g=e.testId??"arrange",y=C(e.allow,"sort")&&u.sorts.length>1,m=C(e.allow,"group")&&u.groups.length>0,F=C(e.allow,"filter")?ce(u,i,e.filters):[],L=e.chips?pe(F,e.filters):[],H=F.filter(t=>!L.includes(t)),G=H.length>0,_=e.query!==!1&&e.allow!==!1,w=we(e.noun,e.kept),v=e.past&&e.past.count>0?e.past:null;if(!y&&!m&&!G&&!_&&!w&&!v)return null;let z=t=>JSON.stringify(re(t)),O=`${g}|${a}`,p={current:q.get(O)??{words:new Set,latest:null,at:0}};q.set(O,p.current),p.current.latest&&Date.now()-p.current.at>1500&&!p.current.words.has(z(o))&&(p.current={words:new Set,latest:null,at:0},q.set(O,p.current));let d=p.current.latest??o,b=t=>{let l={...p.current.latest??o,...t};for(let c of Object.keys(l))l[c]===void 0&&delete l[c];p.current.latest=l,p.current.at=Date.now(),p.current.words.add(z(l)),s(l)},f=d.filter??[],R=t=>{let l=f.filter((c,I)=>I!==t);b({filter:l.length>0?l:void 0})},A=t=>f.some(l=>l.key===t.key&&l.value===t.value),te=t=>A(t)?R(f.findIndex(l=>l.key===t.key&&l.value===t.value)):b({filter:[...f,t]}),T=d.sort?u.sorts.find(t=>t.key===d.sort.by):void 0,j=d.group?u.groups.find(t=>t.key===d.group.by):void 0,ne=me(T),k={schema:r,graph:i,offers:{...u,filters:H},arrangement:d,set:b,toggle:te,has:A,testId:g},ae=(t,l)=>A({key:t,value:l})?R(f.findIndex(c=>c.key===t&&c.value===l)):b({filter:[...f.filter(c=>c.key!==t),{key:t,value:l}]}),oe=d.sort?(0,n.jsxs)(n.Fragment,{children:["Sorted by ",P(T?.label??d.sort.by),(0,n.jsx)("span",{"aria-hidden":"true",children:d.sort.direction==="desc"?" \u2193":" \u2191"})]}):"Sort",ie=d.group?.bucket&&j?.buckets?`, a ${d.group.bucket} each`:"",B=d.group?`Grouped by ${P(j?.label??d.group.by)}${ie}`:"Group";return(0,n.jsxs)("div",{"data-testid":`${g}-bar`,role:"group","aria-label":"Arrange",className:"graview-arrange",style:e.style,onPointerEnter:x.prefetch,onFocus:x.prefetch,children:[(0,n.jsx)("style",{children:xe}),(0,n.jsxs)("div",{className:"graview-arrange-line",children:[w?(0,n.jsxs)("span",{className:"graview-arrange-count","data-testid":`${g}-count`,children:[w.kept?(0,n.jsx)("span",{"data-testid":`${g}-kept`,children:w.kept}):null,w.words]}):null,v?(0,n.jsxs)("button",{type:"button",className:"graview-arrange-open","data-testid":`${g}-past`,title:`${M(v.count)} more behind the horizon \u2014 press to widen the view to the past`,onClick:t=>{let l=t.currentTarget.closest("[data-graview-view]"),c=t.currentTarget;v.widen();let I=0,W=()=>{if(document.activeElement!==c&&document.activeElement!==document.body&&c.isConnected)return;let $=l?.querySelector('[role="group"][aria-label="Arrange"] :is(button, input)');if($&&$!==c&&$.isConnected)return $.focus({preventScroll:!0});++I<120&&requestAnimationFrame(W)};requestAnimationFrame(W)},children:["+",M(v.count)," past"]}):null,f.map((t,l)=>{let c=ye(r,i,u,t);return(0,n.jsxs)("span",{className:"graview-arrange-token","data-testid":`${g}-condition`,children:[c,(0,n.jsx)("button",{type:"button","aria-label":`Remove: ${c}`,title:"Remove",onClick:()=>R(l),children:"\xD7"})]},`${t.key}:${t.value}`)}),y?(0,n.jsx)("span",{className:"graview-arrange-part graview-arrange-one",children:(0,n.jsx)(E,{testId:`${g}-sort`,value:d.sort?.by??"",set:d.sort!==void 0,label:"Sort",name:d.sort?`Sorted by ${P(T?.label??d.sort.by)}, ${ne[d.sort.direction].toLowerCase()}`:"Sort",list:t=>(0,n.jsx)(N,{which:"sort",done:t,...k}),children:oe})}):null,m?(0,n.jsx)("span",{className:"graview-arrange-part graview-arrange-one",children:(0,n.jsx)(E,{testId:`${g}-group`,value:d.group?.by??"",set:d.group!==void 0,label:"Group",name:B,list:t=>(0,n.jsx)(N,{which:"group",done:t,...k}),children:B})}):null,G?(0,n.jsx)("span",{className:"graview-arrange-part",children:(0,n.jsx)(E,{testId:`${g}-add`,value:"",set:!1,label:"Filter",name:f.length>0?`Filter \u2014 ${f.length} on`:"Filter",list:t=>(0,n.jsx)(N,{which:"filter",done:t,...k}),children:"Filter"})}):null,y||m?(0,n.jsx)("span",{className:"graview-arrange-part graview-arrange-all",children:(0,n.jsx)(E,{testId:`${g}-all`,value:"",set:!1,label:"Arrange",name:"Arrange: sort and group",list:t=>(0,n.jsx)(N,{which:"all",done:t,parts:{sort:y,group:m,filter:!1},...k}),children:"Arrange"})}):null,_?(0,n.jsxs)("label",{className:"graview-arrange-words-at",children:[(0,n.jsx)("span",{style:X,children:"Find"}),(0,n.jsx)("input",{type:"search",className:"graview-arrange-words","data-testid":`${g}-query`,value:d.query??"",placeholder:"Find\u2026",onChange:t=>b({query:t.target.value.length>0?t.target.value:void 0})})]}):null,L.length>0&&e.chips?(0,n.jsx)(h.Suspense,{fallback:null,children:(0,n.jsx)(he,{offers:L,chips:e.chips,schema:r,graph:i,kind:a,arrangement:d,has:A,choose:ae,testId:g})}):null]})]})}function we(e,r){if(!r)return null;let i=r.shown!==r.of;if(!e)return i?{words:"",kept:`${r.shown} of ${r.of}`}:null;let a=r.of===1?e.one:e.many;return i?{words:` ${a}`,kept:`${r.shown} of ${r.of}`}:{words:`${r.of} ${a}`}}function E({testId:e,value:r,set:i,label:a,name:o,list:s,children:u}){let g=Q("arrange",{align:"start"}),y=(0,h.useRef)(null);return(0,h.useEffect)(()=>{g.open&&y.current?.querySelector('[aria-pressed="true"]')?.focus({preventScroll:!0})},[g.open]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{type:"button",className:"graview-arrange-open","data-testid":e,"data-set":i?"":void 0,value:r,"aria-label":o,...g.trigger,onClick:g.toggle,children:[u,(0,n.jsx)(be,{})]}),g.open?(0,n.jsx)("div",{...g.pane,ref:m=>{g.pane.ref(m),y.current=m},role:"group","aria-label":a,"data-testid":"arrange-list","data-arrange":e,className:"graview-arrange-list",style:J,onKeyDown:ve,children:s(()=>g.setOpen(!1))}):null]})}function ve(e){if(!["ArrowDown","ArrowUp","Home","End"].includes(e.key))return;let r=[...e.currentTarget.querySelectorAll("button:not([disabled]), input")];if(r.length===0)return;let i=r.indexOf(document.activeElement);if(document.activeElement instanceof HTMLInputElement&&document.activeElement.type==="date"&&(e.key==="ArrowUp"||e.key==="ArrowDown"))return;e.preventDefault();let a=e.key==="Home"?0:e.key==="End"?r.length-1:e.key==="ArrowDown"?(i+1)%r.length:(i-1+r.length)%r.length;r[a].focus()}function be(){return(0,n.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 10 10","aria-hidden":"true",focusable:"false",style:{flex:"0 0 auto",opacity:.7},children:(0,n.jsx)("path",{d:"M2 3.5 L5 6.5 L8 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}var xe=`
2
2
  .graview-arrange{container-type:inline-size;box-sizing:border-box;width:100%;min-width:0;max-width:100%}
3
3
  .graview-arrange-line{display:flex;flex-wrap:wrap;align-items:center;gap:2px 6px;min-width:0;font-size:.875rem;line-height:1.35;color:var(--graview-ink-muted)}
4
4
  .graview-arrange-count{margin-right:2px;color:var(--graview-ink-muted)}
@@ -1,2 +1,2 @@
1
- import{a as le,b as I,d as ue,g as ye,h as me,i as pe}from"./chunk.EJAVIZ7Y.js";import{$ as q,C as T,Da as re,Eb as v,F as Z,Fa as ie,G as O,Gb as ce,H as B,Hb as C,I as V,Na as W,O as x,R as X,Ra as se,S as Y,Ta as de,Va as ae,W as j,Y as H,da as M,fa as L,ka as _,ma as J,sa as Q,ta as ee,ua as ne,va as te,ya as oe,yb as fe}from"./chunk.PFEKS3KO.js";var $e=t=>`${t}${t%100>=11&&t%100<=13?"th":["th","st","nd","rd"][t%10]??"th"}`,Re={day:"day",week:"week",month:"month",year:"year"},F=t=>t.length<2?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`;function xe(t,e,n){let o=e.interval??1,i=Re[e.every],s=t.slice(0,10),l=o===1?`Every ${i}`:o===2?`Every other ${i}`:`Every ${o} ${i}s`,d;if(e.every==="week"){let y=(e.on?.length?e.on:[W[new Date(`${s}T00:00:00Z`).getUTCDay()]]).map(r=>H(W.indexOf(r),"long",n));d=o===1?`Every ${F(y)}`:o===2?`Every other ${F(y)}`:`${l} on ${F(y)}`}else if(e.every==="month"){let y=(e.on?.length?e.on:[+s.slice(8,10)]).map(r=>r===-1?"the last day":`the ${$e(Number(r))}`);d=`${l} on ${F(y)}`}else e.every==="year"?d=`${l} on ${j(s,n)}`:d=l;return O.test(t)&&(d+=` at ${Y(t,n)}`),e.until&&(d+=`, until ${x(e.until,n)}`),e.count&&(d+=`, ${e.count===1?"once":`${e.count} times`}`),d}function ge(t,e,n={}){if(!de(e)||typeof t!="string")return;let o=n.today??V(),i=ae(t,e,o),s=xe(t,e,n.locale),l=i.slice(0,4)===o.slice(0,4)?j(i.slice(0,10),n.locale):x(i.slice(0,10),n.locale);return i.slice(0,10)<o?`${s}, last ${l}`:`${s}, next ${l}`}function on(t,e){let n=new Map,o=new Map;for(let i of t){let s=M(e(i.kind),i).trim().toLowerCase();o.set(s,[...o.get(s)??[],i])}for(let i of o.values()){if(i.length<2)continue;let s=new Map;for(let l of i)s.set(l.kind,[...s.get(l.kind)??[],l]);for(let[l,d]of s){if(d.length===1){n.set(d[0].id,J(e(l),l));continue}let y=d.map(f=>new Map(Se(f,e(f.kind)).map(m=>[m.key,m.alone]))),r=[...new Set(y.flatMap(f=>[...f.keys()]))],u=f=>y.every(m=>!/\d/.test(m.get(f)??"")),h=[...r.filter(u),...r.filter(f=>!u(f))],b=(f,m)=>m.map(p=>y[f].get(p)??"").filter(Boolean).join(" \xB7 "),S=f=>new Set(d.map((m,p)=>b(p,f))).size===d.length&&d.every((m,p)=>b(p,f)!==""),c=h.find(f=>S([f])),a=c?void 0:h.flatMap((f,m)=>h.slice(m+1).map(p=>[f,p])).find(f=>S(f));d.forEach((f,m)=>{if(c||a)return void n.set(f.id,b(m,c?[c]:a));let p=h.find($=>{let w=y[m].get($);return w!==void 0&&w!==""&&y.every((R,k)=>k===m||R.get($)!==w)});n.set(f.id,p?y[m].get(p):`${m+1} of ${d.length}`)})}}return n}function rn(t,e){return t?.describe?t.describe(e):`${e.kind} ${M(t,e)}`}var _e=new Set(["id","kind","label"]);function ve(t,e){if(e.length===0)return!1;let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[\\s\xB7,(/])${n}($|[\\s\xB7,)/])`).test(t)}function Se(t,e,n={}){let o=e?.display,i=new Set([..._e,...o?.hide??[]]);typeof t.label=="string"&&e?.label&&!M(e,t).includes(t.label)&&i.delete("label");let s=(n.said??[]).filter(c=>!!c),l=s.filter(c=>c.endsWith("\u2026")).map(c=>c.replace(/…$/,"").trim()).filter(c=>c.length>12),d=[],y=e?.fields?.shape,r=e?.fieldRoles,u=n.glance?o?.glance??[r?.who,r?.when].filter(c=>!!c):he(o?.page),h=n.glance&&o?.glance!==void 0,S=[...new Set(h?u:[...u,...Ne(e),...Object.keys(t)])].filter(c=>Object.hasOwn(t,c)).map(c=>[c,t[c]]);for(let[c,a]of S){if(i.has(c)||a===void 0||a===null)continue;let f=o?.format?.[c],m=f?[]:ne(a);if(m[0]&&n.glance)continue;let p=e?.fields?.shape?.[c],$=!f&&typeof a=="string"&&oe(p)?a:void 0,w=!f&&typeof a=="string"&&le(p);if($&&n.glance)continue;let R=f?void 0:ie(p),k=R?{relation:R,refs:re(a,R)}:void 0;if(k&&(n.glance||k.refs.length===0)||!m[0]&&typeof a=="object"&&(!Array.isArray(a)||a.some(g=>typeof g=="object"&&g!==null))&&f===void 0)continue;let U=typeof a=="string"&&!f?ge(a,t[`${c}Repeat`],{locale:n.locale}):void 0,N=m[0]?m.map(g=>`${g.caption?`${g.name} \u2014 ${g.caption}`:g.name}${Q(g)?` (${ee(g)})`:""}`).join(", "):Array.isArray(a)?a.join(", "):typeof a=="boolean"?a?"Yes":"No":String(a),E=f?void 0:ye(e,c),G=pe(E,a),K=!f&&!E&&typeof a=="number"?v(e?.fields?.shape?.[c]):void 0,z=k?k.refs.length>1?`${k.refs.length} linked records`:"linked record":f?f(a):K?ce(a,K):me(E,a,n.locale)??(Array.isArray(a)||typeof a=="boolean"?N:typeof a=="string"&&U!==void 0?U:typeof a=="string"&&Z.test(a)?x(a,n.locale):typeof a=="string"&&O.test(a)?X(a,n.locale,n.timeZone):typeof a=="string"&&Fe(e,c)?I(e,c,a):N),P=typeof a=="string"&&Te(e,c,z),A=(n.glance||n.excerpt)&&!f&&(P||w)?ue(z,{markdown:w}):z;if(s.includes(A)||l.some(g=>A.startsWith(g))||n.glance&&(typeof a=="string"||typeof a=="number")&&s.some(g=>ve(g,A)))continue;let D=_(e,c),Ae=typeof a=="number"?`${D} ${A}`:typeof a=="boolean"&&!f?`${D}: ${A.toLowerCase()}`:A;if(d.push({key:c,label:D,value:A,stored:N,alone:Ae,long:P,...w?{markdown:!0}:{},...m[0]?{files:m}:{},...$?{app:$}:{},...k?{linked:k}:{},...G?{href:G}:{},...se(y?.[`${c}Repeat`])?{repeats:!0}:{}}),n.limit!==void 0&&d.length>=n.limit)break}return Oe(d,e)}function Oe(t,e){let n=new Map;for(let o of t){let i=Me(e,o.key);i&&n.set(o.key,new Set(i.map(s=>I(e,o.key,s).toLowerCase())))}return n.size<2?t:t.map(o=>{let i=n.get(o.key);return i!==void 0&&[...n].some(([l,d])=>l!==o.key&&[...i].some(y=>d.has(y)))?{...o,alone:`${o.label}: ${o.value.toLowerCase()}`}:o})}function Me(t,e){let n=t?.fields?.shape?.[e];for(let o=0;o<6&&n?._zod?.def?.innerType!==void 0;o++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"&&n._zod.def.entries?Object.values(n._zod.def.entries).map(String):void 0}function Fe(t,e){let n=t?.fields?.shape?.[e];for(let o=0;o<6&&n?._zod?.def?.innerType!==void 0;o++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"}function Ne(t){let e=t?.fields?.shape;return[...Object.keys(e??{}),...Object.keys(t?.computed??{})]}function he(t){return[...t?.fields??[],...(t?.groups??[]).flatMap(e=>e.fields)]}var Ee=500,ze=160;function De(t){let e=t;for(let n=0;n<6&&e?._zod?.def?.innerType!==void 0;n++)e=e._zod.def.innerType;return e?._zod?.def?.type==="string"?e._zod.def:void 0}function Te(t,e,n){return De(t?.fields?.shape?.[e])?.checks?.some(i=>i._zod?.def?.check==="max_length"&&(i._zod.def.maximum??0)>Ee)?!0:typeof n=="string"&&(n.includes(`
1
+ import{a as le,b as I,d as ue,g as ye,h as me,i as pe}from"./chunk.CQPNDJAC.js";import{$ as q,C as T,Cb as fe,Da as re,F as Z,Fa as ie,G as O,H as B,I as V,Ib as v,Kb as ce,Lb as C,Na as W,O as x,R as X,Ra as se,S as Y,Ta as de,Va as ae,W as j,Y as H,da as M,fa as L,ka as _,ma as J,sa as Q,ta as ee,ua as ne,va as te,ya as oe}from"./chunk.P4CLT32V.js";var $e=t=>`${t}${t%100>=11&&t%100<=13?"th":["th","st","nd","rd"][t%10]??"th"}`,Re={day:"day",week:"week",month:"month",year:"year"},F=t=>t.length<2?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`;function xe(t,e,n){let o=e.interval??1,i=Re[e.every],s=t.slice(0,10),l=o===1?`Every ${i}`:o===2?`Every other ${i}`:`Every ${o} ${i}s`,d;if(e.every==="week"){let y=(e.on?.length?e.on:[W[new Date(`${s}T00:00:00Z`).getUTCDay()]]).map(r=>H(W.indexOf(r),"long",n));d=o===1?`Every ${F(y)}`:o===2?`Every other ${F(y)}`:`${l} on ${F(y)}`}else if(e.every==="month"){let y=(e.on?.length?e.on:[+s.slice(8,10)]).map(r=>r===-1?"the last day":`the ${$e(Number(r))}`);d=`${l} on ${F(y)}`}else e.every==="year"?d=`${l} on ${j(s,n)}`:d=l;return O.test(t)&&(d+=` at ${Y(t,n)}`),e.until&&(d+=`, until ${x(e.until,n)}`),e.count&&(d+=`, ${e.count===1?"once":`${e.count} times`}`),d}function ge(t,e,n={}){if(!de(e)||typeof t!="string")return;let o=n.today??V(),i=ae(t,e,o),s=xe(t,e,n.locale),l=i.slice(0,4)===o.slice(0,4)?j(i.slice(0,10),n.locale):x(i.slice(0,10),n.locale);return i.slice(0,10)<o?`${s}, last ${l}`:`${s}, next ${l}`}function on(t,e){let n=new Map,o=new Map;for(let i of t){let s=M(e(i.kind),i).trim().toLowerCase();o.set(s,[...o.get(s)??[],i])}for(let i of o.values()){if(i.length<2)continue;let s=new Map;for(let l of i)s.set(l.kind,[...s.get(l.kind)??[],l]);for(let[l,d]of s){if(d.length===1){n.set(d[0].id,J(e(l),l));continue}let y=d.map(f=>new Map(Se(f,e(f.kind)).map(m=>[m.key,m.alone]))),r=[...new Set(y.flatMap(f=>[...f.keys()]))],u=f=>y.every(m=>!/\d/.test(m.get(f)??"")),h=[...r.filter(u),...r.filter(f=>!u(f))],b=(f,m)=>m.map(p=>y[f].get(p)??"").filter(Boolean).join(" \xB7 "),S=f=>new Set(d.map((m,p)=>b(p,f))).size===d.length&&d.every((m,p)=>b(p,f)!==""),c=h.find(f=>S([f])),a=c?void 0:h.flatMap((f,m)=>h.slice(m+1).map(p=>[f,p])).find(f=>S(f));d.forEach((f,m)=>{if(c||a)return void n.set(f.id,b(m,c?[c]:a));let p=h.find($=>{let w=y[m].get($);return w!==void 0&&w!==""&&y.every((R,k)=>k===m||R.get($)!==w)});n.set(f.id,p?y[m].get(p):`${m+1} of ${d.length}`)})}}return n}function rn(t,e){return t?.describe?t.describe(e):`${e.kind} ${M(t,e)}`}var _e=new Set(["id","kind","label"]);function ve(t,e){if(e.length===0)return!1;let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[\\s\xB7,(/])${n}($|[\\s\xB7,)/])`).test(t)}function Se(t,e,n={}){let o=e?.display,i=new Set([..._e,...o?.hide??[]]);typeof t.label=="string"&&e?.label&&!M(e,t).includes(t.label)&&i.delete("label");let s=(n.said??[]).filter(c=>!!c),l=s.filter(c=>c.endsWith("\u2026")).map(c=>c.replace(/…$/,"").trim()).filter(c=>c.length>12),d=[],y=e?.fields?.shape,r=e?.fieldRoles,u=n.glance?o?.glance??[r?.who,r?.when].filter(c=>!!c):he(o?.page),h=n.glance&&o?.glance!==void 0,S=[...new Set(h?u:[...u,...Ne(e),...Object.keys(t)])].filter(c=>Object.hasOwn(t,c)).map(c=>[c,t[c]]);for(let[c,a]of S){if(i.has(c)||a===void 0||a===null)continue;let f=o?.format?.[c],m=f?[]:ne(a);if(m[0]&&n.glance)continue;let p=e?.fields?.shape?.[c],$=!f&&typeof a=="string"&&oe(p)?a:void 0,w=!f&&typeof a=="string"&&le(p);if($&&n.glance)continue;let R=f?void 0:ie(p),k=R?{relation:R,refs:re(a,R)}:void 0;if(k&&(n.glance||k.refs.length===0)||!m[0]&&typeof a=="object"&&(!Array.isArray(a)||a.some(g=>typeof g=="object"&&g!==null))&&f===void 0)continue;let U=typeof a=="string"&&!f?ge(a,t[`${c}Repeat`],{locale:n.locale}):void 0,N=m[0]?m.map(g=>`${g.caption?`${g.name} \u2014 ${g.caption}`:g.name}${Q(g)?` (${ee(g)})`:""}`).join(", "):Array.isArray(a)?a.join(", "):typeof a=="boolean"?a?"Yes":"No":String(a),E=f?void 0:ye(e,c),G=pe(E,a),K=!f&&!E&&typeof a=="number"?v(e?.fields?.shape?.[c]):void 0,z=k?k.refs.length>1?`${k.refs.length} linked records`:"linked record":f?f(a):K?ce(a,K):me(E,a,n.locale)??(Array.isArray(a)||typeof a=="boolean"?N:typeof a=="string"&&U!==void 0?U:typeof a=="string"&&Z.test(a)?x(a,n.locale):typeof a=="string"&&O.test(a)?X(a,n.locale,n.timeZone):typeof a=="string"&&Fe(e,c)?I(e,c,a):N),P=typeof a=="string"&&Te(e,c,z),A=(n.glance||n.excerpt)&&!f&&(P||w)?ue(z,{markdown:w}):z;if(s.includes(A)||l.some(g=>A.startsWith(g))||n.glance&&(typeof a=="string"||typeof a=="number")&&s.some(g=>ve(g,A)))continue;let D=_(e,c),Ae=typeof a=="number"?`${D} ${A}`:typeof a=="boolean"&&!f?`${D}: ${A.toLowerCase()}`:A;if(d.push({key:c,label:D,value:A,stored:N,alone:Ae,long:P,...w?{markdown:!0}:{},...m[0]?{files:m}:{},...$?{app:$}:{},...k?{linked:k}:{},...G?{href:G}:{},...se(y?.[`${c}Repeat`])?{repeats:!0}:{}}),n.limit!==void 0&&d.length>=n.limit)break}return Oe(d,e)}function Oe(t,e){let n=new Map;for(let o of t){let i=Me(e,o.key);i&&n.set(o.key,new Set(i.map(s=>I(e,o.key,s).toLowerCase())))}return n.size<2?t:t.map(o=>{let i=n.get(o.key);return i!==void 0&&[...n].some(([l,d])=>l!==o.key&&[...i].some(y=>d.has(y)))?{...o,alone:`${o.label}: ${o.value.toLowerCase()}`}:o})}function Me(t,e){let n=t?.fields?.shape?.[e];for(let o=0;o<6&&n?._zod?.def?.innerType!==void 0;o++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"&&n._zod.def.entries?Object.values(n._zod.def.entries).map(String):void 0}function Fe(t,e){let n=t?.fields?.shape?.[e];for(let o=0;o<6&&n?._zod?.def?.innerType!==void 0;o++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"}function Ne(t){let e=t?.fields?.shape;return[...Object.keys(e??{}),...Object.keys(t?.computed??{})]}function he(t){return[...t?.fields??[],...(t?.groups??[]).flatMap(e=>e.fields)]}var Ee=500,ze=160;function De(t){let e=t;for(let n=0;n<6&&e?._zod?.def?.innerType!==void 0;n++)e=e._zod.def.innerType;return e?._zod?.def?.type==="string"?e._zod.def:void 0}function Te(t,e,n){return De(t?.fields?.shape?.[e])?.checks?.some(i=>i._zod?.def?.check==="max_length"&&(i._zod.def.maximum??0)>Ee)?!0:typeof n=="string"&&(n.includes(`
2
2
  `)||n.length>ze)}function sn(t,e){let n=t?.display?.page,o=n?.groups??[],i=new Map(e.map(r=>[r.key,r])),s=new Set(he(n)),l=r=>r.flatMap(u=>i.has(u)?[i.get(u)]:[]),d=e.filter(r=>!s.has(r.key));return[{fields:[...l(n?.fields??[]),...o.length>0?[]:d]},...o.map(r=>({title:r.title,fields:l(r.fields)})),...o.length>0?[{title:"Details",fields:d}]:[]].filter(r=>r.fields.length>0)}function je(t,e,n){let o=[...e?.creates??[],...e?.subject&&e.subject.kinds!=="*"?e.subject.kinds:[]];for(let i of o){let s=t.tryDefinition(i),l=s?.fields?.shape??{};if(!s||!(n in l))continue;let d=s.display?.format?.[n];return{label:s.display?.labels?.[n]??_(s,n),option:r=>d?d(r):L(r)}}return{label:_(void 0,n),option:i=>L(i)}}function cn(t,e,n){if(n instanceof fe){let o=e.find(s=>s.name===n.mutation);return`Not yet: ${n.issues.map(s=>{let l=s.path.length>0?je(t,o,String(s.path[0])).label:void 0;return l?`${l} \u2014 ${q(s.message)}`:s.message}).join("; ")}.`}return n instanceof Error?n.message:String(n)}var Le=t=>/^[A-Z]{3}$/.test(t??"");function ke(t){let{format:e,unit:n,currency:o,locale:i}=t,s=Le(n),l=e==="money"||!e&&s,d=l?s?n:o:void 0;return{...l?{format:"money"}:e?{format:e}:{},...n&&!(l&&s)?{unit:n}:{},...d?{currency:d}:{},...i?{locale:i}:{}}}function yn(t){switch(t.format){case"money":return t.currency?`An amount of money in ${t.currency}: a plain number, 1250.5 for 1,250.50 ${t.currency}.`:"An amount of money, in no named currency: a plain number.";case"percent":return"A fraction said as a percent: 0.15 is 15%.";default:return t.unit?`A number of ${t.unit}.`:"A number."}}function be(t){let e=T(t)?.innerType;return e===void 0?t:be(e)}var We={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]},Ce=t=>(t?._zod?.def?.checks??[]).map(e=>e._zod?.def).filter(e=>e!==void 0);function we(t){let e=be(t),n=T(e),o=n?.type,i=Ce(e);if(o==="enum")return{type:"choice",options:Object.keys(n?.entries??{})};let s=te(e);if(s)return s==="image"?{type:"file",image:!0}:s==="video"?{type:"file",video:!0}:{type:"file"};if(o==="boolean")return{type:"boolean"};if(o==="array"){let l=we(n?.element);return l.type==="unknown"?{type:"unknown"}:{type:"several",of:l}}if(o==="number"){let l,d,y;for(let r of i){r.check==="multiple_of"&&typeof r.value=="number"?y=r.value:r.check==="number_format"&&(r.format==="safeint"||r.format==="int32"||r.format==="uint32")&&(y??=1);let u=r.check==="number_format"&&r.format?We[r.format]:void 0,h=u?u[0]:r.check==="greater_than"&&r.inclusive&&typeof r.value=="number"?r.value:void 0,b=u?u[1]:r.check==="less_than"&&r.inclusive&&typeof r.value=="number"?r.value:void 0;h!==void 0&&(l=l===void 0?h:Math.max(l,h)),b!==void 0&&(d=d===void 0?b:Math.min(d,b))}return{type:"number",...l===void 0?{}:{min:l},...d===void 0?{}:{max:d},...y===void 0?{}:{step:y},...C(e)==="duration"?{duration:!0}:{},...v(t)?{amount:ke(v(t))}:{}}}if(o==="string"){if(i.some(u=>u.fn===B||u.format==="datetime")||n?.format==="datetime")return{type:"date",time:!0,instant:!0};let d=[n?.pattern,...i.map(u=>u.pattern)].filter(u=>u instanceof RegExp).map(u=>u.source);if(d.some(u=>u.includes("\\d{4}")))return d.some(u=>u.includes("\\d{2}:\\d{2}"))?{type:"date",time:!0}:{type:"date"};let y=i.some(u=>u.check==="max_length"&&typeof u.maximum=="number"&&u.maximum>500),r=C(e);return y?{type:"text",long:!0}:r==="phone"||r==="place"?{type:"text",holds:r}:{type:"text"}}return{type:"unknown"}}function An(t,e){let n=t?.shape;return!n||!(e in n)?{type:"unknown"}:we(n[e])}export{xe as a,on as b,rn as c,Se as d,sn as e,ke as f,yn as g,be as h,we as i,An as j,je as k,cn as l};