graview 0.1.57 → 0.1.59

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 (175) hide show
  1. package/dist/preview/{chunk.N33WUCAN.js → chunk.2FOIJ5ID.js} +1 -1
  2. package/dist/preview/{chunk.JNNBHD4Z.js → chunk.2FP4KEEG.js} +1 -1
  3. package/dist/preview/{chunk.NF72Z2HG.js → chunk.2MFXP3FB.js} +1 -1
  4. package/dist/preview/{chunk.RALAID6N.js → chunk.2NJDT47T.js} +1 -1
  5. package/dist/preview/{chunk.I636CZE4.js → chunk.2QESVWUW.js} +1 -1
  6. package/dist/preview/{chunk.UWQ3I5OW.js → chunk.2XTCDFWU.js} +1 -1
  7. package/dist/preview/{chunk.CUKRUQQ2.js → chunk.3UTRR5YM.js} +1 -1
  8. package/dist/preview/{chunk.I5PSHASU.js → chunk.3XIIJHQ6.js} +1 -1
  9. package/dist/preview/chunk.3XLOFZRM.js +1 -0
  10. package/dist/preview/{chunk.66LWZIY5.js → chunk.4OMOP77U.js} +1 -1
  11. package/dist/preview/{chunk.547FQPYG.js → chunk.4QWTSI7V.js} +1 -1
  12. package/dist/preview/{chunk.534TBZJ3.js → chunk.4T5QIZKB.js} +2 -2
  13. package/dist/preview/chunk.6BLNFVB4.js +1 -0
  14. package/dist/preview/{chunk.LWRXCO2Z.js → chunk.6E36I2GC.js} +1 -1
  15. package/dist/preview/{chunk.JQFIZRAZ.js → chunk.6IUEGPCZ.js} +2 -2
  16. package/dist/preview/{chunk.33PZEW5A.js → chunk.6N7LNTB6.js} +1 -1
  17. package/dist/preview/chunk.6O3YPUW3.js +1 -0
  18. package/dist/preview/{chunk.LE2KAR25.js → chunk.6VNKGTLF.js} +1 -1
  19. package/dist/preview/{chunk.BUSFJM6P.js → chunk.7AMBLGVB.js} +1 -1
  20. package/dist/preview/{chunk.5GTOF5D5.js → chunk.7JOG6XFC.js} +1 -1
  21. package/dist/preview/chunk.7XSDXX5Z.js +1 -0
  22. package/dist/preview/{chunk.PQMMISCQ.js → chunk.ATSKKTUO.js} +1 -1
  23. package/dist/preview/{chunk.7IXTNST2.js → chunk.ATVPAYS6.js} +1 -1
  24. package/dist/preview/{chunk.FPGU43SC.js → chunk.AXXYJCSW.js} +1 -1
  25. package/dist/preview/{chunk.4UQBMFJZ.js → chunk.B5HLA45D.js} +1 -1
  26. package/dist/preview/{chunk.VDS3IOTK.js → chunk.BDBLGGFJ.js} +1 -1
  27. package/dist/preview/{chunk.DWLKJGVT.js → chunk.BFN6B4C4.js} +1 -1
  28. package/dist/preview/{chunk.4K6VAC2S.js → chunk.BPC4XQFZ.js} +2 -2
  29. package/dist/preview/{chunk.DM5X3JBH.js → chunk.CIB65YO6.js} +1 -1
  30. package/dist/preview/chunk.CJUIJ6TL.js +1 -0
  31. package/dist/preview/{chunk.4XKRCAJZ.js → chunk.CLR6KAA3.js} +1 -1
  32. package/dist/preview/{chunk.LKJ6FD6Y.js → chunk.CUJX3IVA.js} +4 -2
  33. package/dist/preview/{chunk.HFSG3F5Z.js → chunk.CYUMQPMH.js} +1 -1
  34. package/dist/preview/{chunk.XVN3CQKH.js → chunk.CZH27V2R.js} +1 -1
  35. package/dist/preview/chunk.D3AISGQH.js +1 -0
  36. package/dist/preview/{chunk.NGK6IRV3.js → chunk.DGM3Y2FB.js} +1 -1
  37. package/dist/preview/{chunk.4NPXMYA5.js → chunk.DO45KXLM.js} +1 -1
  38. package/dist/preview/{chunk.FLVE6IBM.js → chunk.DWHPZBPZ.js} +1 -1
  39. package/dist/preview/{chunk.47T3KUAA.js → chunk.E22DDEQI.js} +1 -1
  40. package/dist/preview/chunk.E2REVMAG.js +6 -0
  41. package/dist/preview/{chunk.MAZFQIL5.js → chunk.E4SYOBGB.js} +1 -1
  42. package/dist/preview/{chunk.QS6YW7UY.js → chunk.EGJUFZD5.js} +1 -1
  43. package/dist/preview/chunk.EZ3CRUBU.js +21 -0
  44. package/dist/preview/{chunk.C5EFUODO.js → chunk.F6P3WSMW.js} +1 -1
  45. package/dist/preview/{chunk.EZ4NUZWX.js → chunk.FJTVY6AE.js} +1 -1
  46. package/dist/preview/chunk.G2TCFWYX.js +1 -0
  47. package/dist/preview/{chunk.M72JKVHP.js → chunk.G7HIAUEA.js} +1 -1
  48. package/dist/preview/{chunk.YR75TWDV.js → chunk.GDUM2UOM.js} +1 -1
  49. package/dist/preview/chunk.GQHFLOTZ.js +5 -0
  50. package/dist/preview/{chunk.YPP7FSEZ.js → chunk.GR2B7SKI.js} +1 -1
  51. package/dist/preview/{chunk.DSLGMCB6.js → chunk.HF5SNUTK.js} +1 -1
  52. package/dist/preview/{chunk.3DPTDMJ7.js → chunk.HJOVOA52.js} +1 -1
  53. package/dist/preview/{chunk.BZEJM2PY.js → chunk.HKINU7VO.js} +1 -1
  54. package/dist/preview/{chunk.4HFCOMR3.js → chunk.HVUUJQRE.js} +1 -1
  55. package/dist/preview/{chunk.LHIT3EZD.js → chunk.IIESMHXY.js} +2 -2
  56. package/dist/preview/{chunk.FJTWAU7N.js → chunk.IPPZEGBX.js} +1 -1
  57. package/dist/preview/{chunk.SAJLIA5M.js → chunk.IZ2ZTNEV.js} +1 -1
  58. package/dist/preview/{chunk.VW4JAQCH.js → chunk.J4HTSXUA.js} +1 -1
  59. package/dist/preview/{chunk.NL3AJZ3N.js → chunk.JPNBQFJ3.js} +1 -1
  60. package/dist/preview/{chunk.ZNXRHOUI.js → chunk.KE6ZRUMP.js} +1 -1
  61. package/dist/preview/{chunk.QPL3OXW3.js → chunk.KHZA5F7A.js} +1 -1
  62. package/dist/preview/{chunk.4JDHBNEA.js → chunk.KKQXGN5U.js} +1 -1
  63. package/dist/preview/{chunk.WASWMHND.js → chunk.KOGUYWHG.js} +1 -1
  64. package/dist/preview/{chunk.FRERJWZJ.js → chunk.KSVJHSRH.js} +1 -1
  65. package/dist/preview/{chunk.Q6OZLBNL.js → chunk.L3K25NCS.js} +1 -1
  66. package/dist/preview/chunk.LDLTQNJ2.js +1 -0
  67. package/dist/preview/{chunk.C7EJPV2N.js → chunk.LDYOQCY7.js} +1 -1
  68. package/dist/preview/{chunk.VHPGGC2P.js → chunk.LHJWII6C.js} +1 -1
  69. package/dist/preview/{chunk.72IHABM5.js → chunk.LKE2FBXL.js} +1 -1
  70. package/dist/preview/{chunk.KPIDJYIU.js → chunk.M3JIIF32.js} +1 -1
  71. package/dist/preview/{chunk.5NZDFT6R.js → chunk.MHILFBK6.js} +1 -1
  72. package/dist/preview/chunk.MMWLLWFS.js +1 -0
  73. package/dist/preview/{chunk.JD5HSAMC.js → chunk.MOAUE3N2.js} +3 -3
  74. package/dist/preview/{chunk.EZ4TZUMM.js → chunk.MRYN42EQ.js} +1 -1
  75. package/dist/preview/{chunk.EXZLG3HK.js → chunk.MZJ3KTEU.js} +1 -1
  76. package/dist/preview/{chunk.V6FUYRZI.js → chunk.N4LOI3YA.js} +1 -1
  77. package/dist/preview/{chunk.4W5GCPAP.js → chunk.NIFQDN6R.js} +1 -1
  78. package/dist/preview/chunk.NOLGJFA4.js +2 -0
  79. package/dist/preview/{chunk.RQX4CQJN.js → chunk.NSGQXCH6.js} +1 -1
  80. package/dist/preview/{chunk.NZDWXX6H.js → chunk.OLW44AP5.js} +1 -1
  81. package/dist/preview/{chunk.DJ4A76SX.js → chunk.OVSZXILB.js} +1 -1
  82. package/dist/preview/{chunk.4BRM5SGO.js → chunk.P3CUCDHO.js} +1 -1
  83. package/dist/preview/{chunk.6SD7YZ4U.js → chunk.P52UTBNO.js} +2 -2
  84. package/dist/preview/{chunk.53U6E5LD.js → chunk.P6CHNBRR.js} +1 -1
  85. package/dist/preview/chunk.PCVPH5KM.js +1 -0
  86. package/dist/preview/{chunk.MRHPOUA4.js → chunk.PS5SEND3.js} +1 -1
  87. package/dist/preview/chunk.Q355UPFG.js +1 -0
  88. package/dist/preview/chunk.Q3Y5EV5A.js +1133 -0
  89. package/dist/preview/{chunk.7INWDFNG.js → chunk.Q6LLURRM.js} +1 -1
  90. package/dist/preview/{chunk.G3BDQ6EA.js → chunk.QC4YXFF7.js} +1 -1
  91. package/dist/preview/chunk.QDZAITMN.js +1 -0
  92. package/dist/preview/chunk.QHU3KUZZ.js +1 -0
  93. package/dist/preview/{chunk.SDLUWRGI.js → chunk.QL555VQ2.js} +1 -1
  94. package/dist/preview/{chunk.JBSW7ZNH.js → chunk.QLTHHWBA.js} +1 -1
  95. package/dist/preview/{chunk.57BKS5KD.js → chunk.QT6UV7HN.js} +1 -1
  96. package/dist/preview/{chunk.O47MN7E5.js → chunk.QXMQUIQZ.js} +1 -1
  97. package/dist/preview/{chunk.KYOI7BG3.js → chunk.R4YDAJRL.js} +1 -1
  98. package/dist/preview/{chunk.5BPRGXIW.js → chunk.RKZ4J3H2.js} +1 -1
  99. package/dist/preview/{chunk.NX7CR4AE.js → chunk.ROHSF4WM.js} +1 -1
  100. package/dist/preview/{chunk.KTV24HY7.js → chunk.S6VON4LU.js} +1 -1
  101. package/dist/preview/{chunk.IX63LTRQ.js → chunk.S7ZLGODY.js} +1 -1
  102. package/dist/preview/{chunk.2PWVDUOU.js → chunk.SU6WKQ73.js} +1 -1
  103. package/dist/preview/{chunk.LUIRQ5UF.js → chunk.SZG6HJWH.js} +1 -1
  104. package/dist/preview/{chunk.VSGTNYM2.js → chunk.T227XQIO.js} +1 -1
  105. package/dist/preview/{chunk.7UBABS2T.js → chunk.TCPTVTFU.js} +1 -1
  106. package/dist/preview/chunk.U37WZMUO.js +1 -0
  107. package/dist/preview/chunk.U5JFW2YM.js +1 -0
  108. package/dist/preview/{chunk.4L4F47QP.js → chunk.U5PX2ECA.js} +1 -1
  109. package/dist/preview/{chunk.MWWOI5PW.js → chunk.U7G56KXT.js} +1 -1
  110. package/dist/preview/{chunk.D3LQJXVP.js → chunk.UFTAGUTU.js} +1 -1
  111. package/dist/preview/{chunk.TBRXNU6T.js → chunk.UHUBQ4EX.js} +1 -1
  112. package/dist/preview/{chunk.MBLFZF5R.js → chunk.UITZ74YJ.js} +1 -1
  113. package/dist/preview/{chunk.TVURUMU4.js → chunk.UM5H2VVR.js} +1 -1
  114. package/dist/preview/chunk.V5MOMBZG.js +1 -0
  115. package/dist/preview/{chunk.7VIFAN3O.js → chunk.V6EEDYYW.js} +1 -1
  116. package/dist/preview/{chunk.Z5UVYOGC.js → chunk.VDGMFX5C.js} +1 -1
  117. package/dist/preview/{chunk.7ML2BWSP.js → chunk.VFRURRNI.js} +1 -1
  118. package/dist/preview/{chunk.4HPP35XQ.js → chunk.VGHZQEHS.js} +1 -1
  119. package/dist/preview/{chunk.D4EP7FEC.js → chunk.VNBEAF62.js} +1 -1
  120. package/dist/preview/chunk.VNJKGSGZ.js +25 -0
  121. package/dist/preview/{chunk.EQAAKYLA.js → chunk.VS25R6R2.js} +1 -1
  122. package/dist/preview/chunk.VUSJ7HPC.js +1 -0
  123. package/dist/preview/chunk.VXRECLX6.js +1 -0
  124. package/dist/preview/{chunk.IRQOJATD.js → chunk.W2VOD6SD.js} +1 -1
  125. package/dist/preview/chunk.W66VMALY.js +1 -0
  126. package/dist/preview/{chunk.UV3U4FRT.js → chunk.WEGPDJTB.js} +1 -1
  127. package/dist/preview/{chunk.JETT6ELP.js → chunk.WGTBQHHE.js} +1 -1
  128. package/dist/preview/chunk.WGVIJDV5.js +1 -0
  129. package/dist/preview/{chunk.Y3EOGXRS.js → chunk.WTUB7W2D.js} +1 -1
  130. package/dist/preview/{chunk.BCE6LIDR.js → chunk.X2G4ZRB2.js} +1 -1
  131. package/dist/preview/chunk.X3MMJ3QC.js +5 -0
  132. package/dist/preview/chunk.X5YRNNHU.js +1 -0
  133. package/dist/preview/{chunk.FLMNWVSY.js → chunk.XOTES3PI.js} +2 -2
  134. package/dist/preview/{chunk.CMLNBJZG.js → chunk.YGZCESXY.js} +1 -1
  135. package/dist/preview/chunk.YMC2T2HN.js +1 -0
  136. package/dist/preview/{chunk.UGOKORIF.js → chunk.YMRVKG6W.js} +1 -1
  137. package/dist/preview/chunk.YN6BXZHO.js +1 -0
  138. package/dist/preview/{chunk.AD3EC5DU.js → chunk.Z4CJJ4QP.js} +1 -1
  139. package/dist/preview/{chunk.XTBS64IT.js → chunk.ZFH4SCCF.js} +1 -1
  140. package/dist/preview/{chunk.N5MQARN6.js → chunk.ZLMI2NHC.js} +1 -1
  141. package/dist/preview/{chunk.S5ECRIG5.js → chunk.ZT3NEAFI.js} +1 -1
  142. package/dist/preview/{chunk.H5CRRBNU.js → chunk.ZUKYMU6C.js} +1 -1
  143. package/dist/preview/index.html +51 -51
  144. package/dist/preview/page.js +2 -2
  145. package/package.json +6 -6
  146. package/dist/preview/chunk.4OP4IEEY.js +0 -1
  147. package/dist/preview/chunk.4SBYXHCQ.js +0 -1
  148. package/dist/preview/chunk.57KRCHQT.js +0 -1
  149. package/dist/preview/chunk.6AH26OL7.js +0 -1132
  150. package/dist/preview/chunk.7ECBGIUK.js +0 -1
  151. package/dist/preview/chunk.7VZA34T4.js +0 -1
  152. package/dist/preview/chunk.BPEUHOKH.js +0 -1
  153. package/dist/preview/chunk.CXB4BSI4.js +0 -1
  154. package/dist/preview/chunk.DBMZ3AQB.js +0 -25
  155. package/dist/preview/chunk.DIFR37EZ.js +0 -5
  156. package/dist/preview/chunk.DQUISKTC.js +0 -1
  157. package/dist/preview/chunk.DSWMXM57.js +0 -1
  158. package/dist/preview/chunk.GBAUQXXD.js +0 -1
  159. package/dist/preview/chunk.I2NI7CT7.js +0 -1
  160. package/dist/preview/chunk.I6H3HRWT.js +0 -1
  161. package/dist/preview/chunk.IV7AUO53.js +0 -1
  162. package/dist/preview/chunk.KO7IOFNY.js +0 -1
  163. package/dist/preview/chunk.N2DM42SG.js +0 -2
  164. package/dist/preview/chunk.NUS5K56R.js +0 -21
  165. package/dist/preview/chunk.OYUDK3LK.js +0 -1
  166. package/dist/preview/chunk.PF5P5YVD.js +0 -1
  167. package/dist/preview/chunk.QMYHXMRV.js +0 -1
  168. package/dist/preview/chunk.RVR6FWAF.js +0 -6
  169. package/dist/preview/chunk.UBNZDSS7.js +0 -1
  170. package/dist/preview/chunk.UGFDSE37.js +0 -1
  171. package/dist/preview/chunk.WYPL2QUA.js +0 -1
  172. package/dist/preview/chunk.Y4KNR76Z.js +0 -1
  173. package/dist/preview/chunk.YDTXCVBU.js +0 -1
  174. package/dist/preview/chunk.YQXA4WAM.js +0 -5
  175. package/dist/preview/chunk.YS5U3DUX.js +0 -1
@@ -0,0 +1 @@
1
+ import{b as fn,c as pn,d as ie,e as un,f as ne,h as Se,i as Ae,n as mn,r as ae}from"./chunk.YGZCESXY.js";import{B as me,Ba as Ue,C as oe,Db as W,Ea as We,F as Ve,Ga as Je,Gb as tn,H as Ze,Ic as sn,J as qe,Jc as dn,K as Be,Ka as we,Kb as rn,Kc as xe,La as ve,Lc as cn,Mc as Re,Pb as on,Ra as Ye,Ua as Qe,_c as ln,b as $e,c as Ge,d as Pe,da as ke,e as V,ea as _e,eb as Xe,g as le,gb as en,h as F,i as Me,j as Fe,k as fe,l as Ne,lb as Oe,m as Ce,mb as nn,na as He,o as Ie,p as pe,q as he,v as Ke,x as re,xc as an,ya as be,z as ue}from"./chunk.X3MMJ3QC.js";function gn(e){if(typeof e=="string")return{form:"string",light:e};if(typeof e!="object"||e===null)return;let a=e,n=w=>typeof a[w]=="string"?a[w]:void 0,t=n("light")??n("src");if(t===void 0)return;let[i,f,u]=[n("dark"),n("alt"),n("darkFallback")];return{form:n("light")!==void 0?"light":"src",light:t,...i!==void 0?{dark:i}:{},...f!==void 0?{alt:f}:{},...u!==void 0?{darkFallback:u}:{}}}function Vn(e,a){let n=e.brand??{},t=n.ground,i=n.accent?Re(n.accent,t):void 0;t&&cn(i?.ok?i.schemes:xe(t),n.accent)&&(a.push(Ae("brand","brand.ground","words would not read on that page background, so the app keeps Graview's","pick a lighter ground for the light scheme, a darker one for the dark")),t=void 0,i=n.accent?Re(n.accent):void 0),i&&!i.ok&&a.push(Ae("brand","brand.accent",`that accent cannot make a readable brand, so the app keeps Graview's colors: ${i.why}`,"pick a color further from orange-red, or a darker one"));let f=gn(n.logo),u=n.name??e.name,w=n.typography?Object.fromEntries(Object.entries(n.typography).filter(([,z])=>typeof z=="string"&&dn(z)===null).map(([z,T])=>[z,sn(T)])):void 0;return{name:u,schemes:i?.ok?i.schemes:t?xe(t):an,...n.currency?{currency:n.currency}:{},...n.locale?{locale:n.locale}:{},...n.timeZone?{timeZone:n.timeZone}:{},...f?{logo:f.dark||f.darkFallback==="invert"?{light:f.light,...f.dark?{dark:f.dark}:{darkFallback:"invert"}}:f.light,logoAlt:f.alt??u}:{},...n.favicon?{favicon:n.favicon}:{},...e.description?{subtitle:e.description}:{},...n.subtitle===!1?{subtitleDrawn:!1}:{},...w?{typography:w}:{},...n.shape?{shape:n.shape}:{},...n.accents?{accents:n.accents}:{},...n.scheme?{scheme:n.scheme}:{}}}function yn(e){let{currency:a,locale:n,timeZone:t}=e.brand??{};return{...a?{currency:a}:{},...n?{locale:n}:{},...t?{timeZone:t}:{}}}var An=Symbol.for("@graview/core:typed-field"),hn=(e,a)=>(/^(phone|place|duration)$/.test(a)&&(oe(e)[An]=a),e),kn=/^(?=(?:\D*\d){3})\+?[\d ()./-]+(?: *(?:ext\.?|x|#) *\d+)?$/i;function bn(e){let a=F().check(V(300),ue(t=>We(t,e)!==void 0,`a record of ${e.kinds.join(" or ")} in ${e.address}, as "<kind>:<id>"`)),n=e.cardinality==="one"?a:pe(a).check(V(200));return Je(e.description?n.check(me(e.description)):n,e)}var zn=new WeakMap;function wn(e,a){zn.set(e,a)}var En=[{where:"settings[]",was:"honoured",now:"honored",since:"0.1.16"},{where:"pages",was:"overview",now:"scene",since:"0.1.17"}],Z=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function vn(e,a=En){if(!Z(e))return{document:e,respelled:[]};let n=[],t=e;for(let i of a)t=je(t,i.where.split("."),i,"",n);return{document:t,respelled:n}}function je(e,a,n,t,i){if(a.length===0){if(!Z(e)||!Object.hasOwn(e,n.was))return e;i.push(`${t}${n.was}`);let{[n.was]:G,...N}=e;return Object.hasOwn(e,n.now)?N:{...N,[n.now]:G}}if(!Z(e))return e;let[f,...u]=a,w=f.endsWith("[]"),z=w?f.slice(0,-2):f,T=e[z],B=T;if(!w)B=je(T,u,n,`${t}${z}.`,i);else if(Array.isArray(T)){let G=T.map((N,J)=>je(N,u,n,`${t}${z}.${J}.`,i));B=G.some((N,J)=>N!==T[J])?G:T}return B===T?e:{...e,[z]:B}}var On="graview-compiled@1";function Dn(e,a){return e.find(([n,t])=>n!==q&&"ref"in t&&(t.ref==="*"||t.ref.includes(a)))?.[0]}var q="id",ge=e=>typeof e=="string"&&/^\$[A-Za-z][A-Za-z0-9]*$/.test(e)?e.slice(1):void 0;function xn(e){let a=Object.entries(e.fields),n=t=>["name","title","label"].find(i=>t.some(([f])=>f===i))??t[0]?.[0];return n(a.filter(([,t])=>t.required&&(t.type==="string"||t.type==="text")))??n(a.filter(([,t])=>t.type==="string"))}function Rn(e,a,n){let t;switch(e.type){case"string":case"place":t=F().check(V(500));break;case"phone":t=F().check(V(40),le(kn,"a phone number"));break;case"text":t=F().check(V(2e4)),e.format&&(oe(t)[Symbol.for("@graview/core:markdown")]=1);break;case"number":case"integer":case"duration":{let f=e.min??(e.type==="duration"?0:void 0),u=[...e.type==="number"?[]:[Ne()],...f===void 0?[]:[Ge(f)],...e.max===void 0?[]:[$e(e.max)],...e.step===void 0?[]:[Pe(e.step)]];t=u.length>0?fe().check(...u):fe();break}case"boolean":t=Ce();break;case"date":t=F().check(le(Ze,"a date like 2026-10-02, or a month (2016-05) or a year (2006) alone"));break;case"datetime":t=F().check(ue(qe,"a date and time like 2026-10-02T14:30:00Z"));break;case"enum":t=Ke(e.options);break;case"list":t=pe(e.of==="number"?fe():e.of==="date"?F().check(le(Ve)):e.of==="image"||e.of==="video"||e.of==="file"?be(e.of):F().check(V(500))).check(V(200));break;case"image":case"video":case"file":t=be(e.type);break;case"app-link":t=Ue();break;case"url":t=Fe();break;case"email":t=Me();break}let i=e.type==="number"||e.type==="integer";return hn(t,i&&e.format==="duration"?"duration":e.type),e.collaborative!==void 0&&(e.type==="text"||e.type==="string")&&(oe(t)[Symbol.for("@graview/core:collaborative")]=e.collaborative?1:0),e.description&&(t=t.check(me(e.description))),i&&(e.format==="money"||e.format==="percent"||!e.format&&e.unit)&&rn(t,{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{}}),a?re(t):t}var se=e=>{throw new W(`there is no record "${e}"`,"invalid")},Tn=(e,a)=>"field"in e?Rn(e.field,e.optional,a):"ref"in e?on(e.ref):re(Ie()),Ln=new WeakMap;var ze=(e,a)=>Z(a)&&Object.keys(e??{}).length===Object.keys(a).length&&Object.keys(e??{}).every(n=>Object.hasOwn(a,n));function mt(e,a={}){let n=Z(e)?e.format:void 0;if(n!==On)return{ok:!1,findings:[Se("compiled-format","format",n===void 0?"this is not a compiled Graview app":`this compiled app is ${JSON.stringify(n)}, and this build reads ${On}`,"compile the document instead")]};let t=e,i=vn(t.document).document,f=i===t.document?t:{...t,document:i},u=Z(i)&&typeof i.name=="string"&&Z(i.kinds)&&ze(i.kinds,f.kinds)&&ze(i.acts,f.acts)&&ze(i.rules,f.rules)&&Array.isArray(f.edges)&&Array.isArray(f.findings),w={ok:!1,findings:[Se("compiled-shape","","this compiled app's parts do not match its document","compile the document instead")]};if(!u)return w;try{return $n(f,a)}catch{return w}}function $n(e,a={}){let{document:n}=e,t=n.brand?.timeZone,i=a.today??(()=>Be(t)),f=new Map(e.edges.map(([y,o])=>[y,o])),u=new Map;for(let[y,o]of Object.entries(n.kinds)){let S=e.kinds[y]?.computed,x=ve(o.edges);u.set(y,{fields:new Set([...Object.keys(o.fields),...x.keys()]),edges:new Map(Object.entries(we(o.edges)).map(([L,E])=>[L,E.cardinality??"many"])),...S?{computed:new Map(S)}:{},...x.size>0?{linked:x}:{}})}e.facts&&u.set(pn,{computed:new Map(e.facts)});let w=yn(n),z=new Map,T=Object.entries(n.kinds).map(([y,o])=>{let S={};for(let[r,d]of Object.entries(o.fields))S[r]=Rn(d,!d.required,w),d.repeats&&(S[Ye(r)]=re(Qe()));for(let[r,d]of ve(o.edges))S[r]=re(bn(d));let{label:x,describe:L,durations:E}=e.kinds[y]??{},P=Object.entries(o.computed??{}).map(([r,d])=>[r,typeof d=="string"?{expr:d}:d]),Y=Object.hasOwn(o.fields,"label")&&!o.fields.label.label&&!/\{\s*label\b/.test(o.label??`{${xn(o)??""}}`),_=Object.fromEntries([...Y?[["label","Label"]]:[],...Object.entries(o.fields).filter(([,r])=>r.label).map(([r,d])=>[r,d.label]),...P.filter(([,r])=>r.label).map(([r,d])=>[r,d.label])]),A=Object.keys(_).length>0,h=Object.entries(o.fields).filter(([,r])=>r.type==="enum"&&r.optionLabels&&Object.keys(r.optionLabels).length>0),$=Object.fromEntries(h.map(([r,d])=>[r,R=>typeof R=="string"&&Object.hasOwn(d.optionLabels,R)?d.optionLabels[R]:ke(String(R))])),C=h.length>0,M=Object.fromEntries(Object.entries(o.fields).filter(([,r])=>r.default!==void 0).map(([r,d])=>[r,d.default]));z.set(y,M);let H=Object.fromEntries(Object.entries(we(o.edges)).map(([r,{renamedFrom:d,...R}])=>[r,R])),I=Object.entries(o.fields).flatMap(([r,d])=>d.aliases?[[r,d.aliases]]:[]),j=r=>o[r]?{[r]:o[r]}:{};return _e(y,{fields:he(S),edges:H,...j("plural"),...j("noun"),...j("aliases"),...I.length>0?{fieldAliases:Object.fromEntries(I)}:{},...j("description"),...x?{label:r=>ae(x,{node:r,kinds:u,today:i(),money:w})||r.id}:{},...L?{describe:r=>ae(L,{node:r,kinds:u,today:i(),money:w})}:{},...j("lifecycle"),...j("figure"),...j("fieldRoles"),...j("people"),archives:o.archives,...o.tidying?{tidying:o.tidying}:{},...P.length>0?{computed:Object.fromEntries(P.map(([r,d])=>[r,Gn(d,E?.includes(r)??!1,w)??o.computed[r]]))}:{},...A||C||o.glance||o.page?{display:{...A?{labels:_}:{},...C?{format:$}:{},...o.glance?{glance:[...o.glance]}:{},...o.page?{page:o.page}:{}}}:{},...Object.keys(M).length>0?{defaults:M}:{},...e.kinds[y]?.keptInStep?{keptInStep:e.kinds[y].keptInStep}:{}})}),B=Xe(T,n.computed);function G(y){return B.tryDefinition(y.kind)?.label?.(y)??y.id}let N=y=>({id:"",kind:y,...z.get(y)}),J=[];for(let[y,o]of Object.entries(n.acts??{})){let S=e.acts[y],{title:x,effects:L,guard:E,refusal:P,destructive:Y,idempotent:_,creates:A,connects:h,severs:$,writes:C,writesOther:M,sets:H}=S,I=new Map(S.args),j={};for(let[c,b]of I)j[c]=Tn(b,w);let r=[o.on??[]].flat(),d=new Map(S.exprs),R=L.find(c=>"create"in c),Q=(c,b,p,v=null)=>{if(Z(c)&&"expr"in c)return ne(d.get(c.expr),{graph:p,subject:v,kinds:u,bindings:b,today:i()});let k=ge(c);return k===void 0?typeof c=="string"&&c.startsWith("$$")?c.slice(1):c:k==="now"?new Date().toISOString():k==="today"?i():b[k]},Te=(c,b)=>{if(!R)return"";let p=n.kinds[R.create].fields,v=N(R.create),k=[];for(let[O,te]of Object.entries(R.set??{})){try{v[O]=Q(te,c,b)??v[O]}catch{}let X=ge(te);X&&c[X]!==void 0&&k.push(O)}let K=G(v).trim(),U=k.filter(O=>v[O]!==!1&&p[O].type!=="text"&&!(/[^]{41}/.test(v[O])||/ .*[.!?]$/.test(v[O])&&!/[ .][A-Z]\w{0,3}\.$/.test(v[O]))&&G({...v,[O]:void 0}).trim()===K).map(O=>v[O]===!0?p[O].label??ke(O):mn(v[O],p[O].format,i(),[],w));return K&&U.length>0?`${K} (${U.join(", ")})`:K};J.push(tn(y,{input:he(j),title:x,...o.description?{description:o.description}:{},...o.fromTheOtherEnd?{fromTheOtherEnd:o.fromTheOtherEnd}:{},...I.has(q)?{subject:{kinds:r.length>0?r:"*",arg:q}}:{},...Y?{destructive:!0}:{},..._?{idempotent:!0}:{},...A.length>0?{creates:A}:{},...h.length>0?{connects:h}:{},...$.length>0?{severs:$}:{},writes:C,...Object.keys(M).length>0?{writesOther:M}:{},...Object.keys(H).length>0?{sets:H}:{},...E?{allowedOn:(c,b)=>{let p=c.getNode(b);if(!p||r.length>0&&!r.includes(p.kind))return!1;try{return ne(E,{graph:c,subject:p,kinds:u,bindings:{},today:i()})===!0}catch{return!1}}}:{},describe:(c,b)=>{let p=typeof c[q]=="string"?b.getNode(c[q]):void 0,v=p?G(p):Te(c,b);return v?`${x}: ${v}`:x},apply(c,b){let p=c.graph,v=typeof b[q]=="string"?b[q]:void 0,k=v?p.getNode(v):void 0;if(v&&!k&&se(v),k&&r.length>0&&!r.includes(k.kind))throw new W(`"${x}" acts on ${r.join(" or ")}, not on ${He(k.kind)}`,"invalid");let K={};for(let[s,l]of Object.entries(b))l!==void 0&&(K[s]=l);if(E&&k){let s;try{s=ne(E,{graph:p,subject:k,kinds:u,bindings:K,today:i()})}catch(l){throw l instanceof ie?new W(`"${x}" could not be judged: ${l.sentence}`):l}if(s!==!0)throw new W(P?ae(P,{node:k,kinds:u,graph:p,bindings:K,today:i(),money:w}):`"${x}" is not allowed for ${G(k)} right now`)}let U=new Map,O=s=>p.has(s)||[...U.values()].includes(s),te=new Set,X=s=>{let l=en(s);te.has(l)||(te.add(l),c.removeEdge(s))},ee=(s,l)=>{let m=ge(s);if(m==="subject")return v;if(m==="me"){let g=c.me;if(g&&n.kinds[p.getNode(g)?.kind]?.people)return g;throw new W(`"${x}" is done as you, and you have no record here`)}if(U.has(m))return U.get(m);try{return Q(s,K,p,l??k??null)}catch(g){throw g instanceof ie?new W(`"${x}" could not work out a value: ${g.sentence}`):g}};for(let s of L)if("create"in s){let l=n.kinds[s.create],m=N(s.create);for(let[ce,Sn]of Object.entries(s.set??{})){let Le=ee(Sn,void 0);Le!==void 0&&(m[ce]=Le)}let g=xn(l),D=g!==void 0&&ln(n.policy?.sees,s.create,g),de=c.freshId(D?s.create:String((g&&m[g])??s.create),s.create);c.addNode({...m,id:de}),s.as&&U.set(s.as,de)}else if("connect"in s||"sever"in s){let l="connect"in s?s.connect:s.sever,m=String(ee(s.from,void 0)??""),g=String(ee(s.to,void 0)??"");if(O(m)||se(m),O(g)||se(g),"connect"in s){if(f.get(l)?.cardinality==="one")for(let D of p.out(m,l))D.id!==g&&X({kind:l,from:m,to:D.id});p.out(m,l).some(D=>D.id===g)||c.addEdge({kind:l,from:m,to:g})}else X({kind:l,from:m,to:g})}else if("set"in s){let l=String(ee(s.target??"$subject",void 0)??""),m=p.getNode(l);!m&&!O(l)&&se(l);let g={};for(let[D,de]of Object.entries(s.set)){let ce=ee(de,m);ce!==void 0&&(g[D]=ce)}Object.keys(g).length>0&&c.patchNode(l,g)}else if("remove"in s){let l=String(ee(s.remove,void 0)??"");p.has(l)||se(l),c.removeNode(l)}else if("replace"in s&&k){let l=b.to;for(let m of s.replace){let g=f.get(m)?.from.includes(k.kind)??!0;for(let D of g?p.out(k.id,m):p.in(k.id,m))m===s.keep&&D.id===l||X(g?{kind:m,from:k.id,to:D.id}:{kind:m,from:D.id,to:k.id})}}}}))}let Ee=[];for(let[y,o]of Object.entries(n.rules??{})){let{title:S,require:x,when:L,says:E}=e.rules[y],P=o.repairs??[],Y=(A,h,$=i(),C)=>{let M=[],H={graph:A,subject:h,kinds:u,today:$,...C?{linked:C}:{},onUnread:r=>M.push(r)},I;try{if(L&&ne(L,H)!==!0)return[];if(I=ne(x,H)===!0,!I&&M.length>0)throw new ie(`it reads ${fn(M[0])}`,0)}catch(r){throw r instanceof un?new nn(r.sentence):r instanceof ie?new Error(r.sentence):r}if(I)return[];let j=P.flatMap(r=>{let d=n.acts?.[r.act],R={},Q=h&&d?.on&&d.fromTheOtherEnd&&![d.on].flat().includes(h.kind)?Dn(e.acts[r.act].args,h.kind):void 0;Q?R[Q]=h.id:h&&(d?.on||/^(edit|remove|archive|unarchive|merge|skip|detach|split)-/.test(r.act))&&(R[q]=h.id);for(let[b,p]of Object.entries(r.args??{}))R[b]=ge(p)==="subject"?h?.id:p;let c=(d?e.acts[r.act].args:[]).filter(([b,p])=>p.required&&R[b]===void 0).map(([b])=>b);return[{mutation:r.act,label:r.label??(Q?d.fromTheOtherEnd:d?.title)??r.act.replace(/-/g," "),args:R,...c.length>0?{missing:c}:{}}]});return[{invariant:y,...h?{subjectId:h.id}:{},label:S,message:E?ae(E,{node:h,kinds:u,graph:A,today:$,money:w}):h?`${G(h)}: ${S}`:S,nodeIds:h?[h.id]:[],repairs:j}]},_={label:S,shape:{over:o.over,require:x,when:L,says:E,declared:n.kinds,money:w,kinds:u,today:i},judgment:{require:o.require,...o.when?{when:o.when}:{},...o.says?{says:o.says}:{}},...o.description?{description:o.description}:{},...P.length>0?{repairs:P.map(A=>A.act)}:{}};Ee.push(o.over==="graph"?Oe(y,{scope:"graph",..._,evaluate:({graph:A,today:h,context:$})=>Y(A,null,h,$?.linked)}):Oe(y,{scope:{kind:o.over},..._,evaluate:({graph:A,subject:h,today:$,context:C})=>Y(A,h,$,C?.linked)}))}let De=n.policy&&{...n.policy,...n.roles?{roles:n.roles}:{}},ye={name:n.name,schema:B,mutations:J,invariants:Ee,...De?{policy:De}:{},...e.brand?{brand:e.brand}:{},...n.modules?{modules:n.modules}:{},...n.lenses?{lenses:n.lenses}:{},...n.pages?{pages:n.pages}:{},...n.settings?{settings:n.settings}:{},...n.connections?{connections:n.connections}:{},...n.forms?{forms:n.forms}:{},...n.publishing?{publishing:n.publishing}:{},...n.purpose?{purpose:n.purpose}:{},...e.viewSpecs?{viewSpecs:e.viewSpecs}:{},...e.home?{home:e.home}:{},version:n.version??1};return wn(ye,n),Ln.set(ye,e),{ok:!0,app:ye,document:n,findings:e.findings,sights:n.policy?.sees,kinds:u}}function Gn(e,a,n){let t=a||e.format==="duration",i=e.format==="money"||e.format==="percent"||!e.format&&e.unit!==void 0;if(!(!t&&!i))return{...e,...t?{as:"duration"}:{},...i?{amount:{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{}}}:{}}}export{vn as a,Vn as b,On as c,q as d,ge as e,xn as f,mt as g,$n as h};
@@ -1,2 +1,2 @@
1
- import{a as Z,b as qe}from"./chunk.KHRS2SKB.js";import"./chunk.UBNZDSS7.js";import"./chunk.644FUGSX.js";import"./chunk.547FQPYG.js";import{j as De,k as Ne,l as Oe}from"./chunk.6SD7YZ4U.js";import"./chunk.TVURUMU4.js";import"./chunk.47T3KUAA.js";import"./chunk.NZDWXX6H.js";import"./chunk.HJCQ6I3S.js";import"./chunk.7IXTNST2.js";import"./chunk.D4EP7FEC.js";import"./chunk.XVN3CQKH.js";import"./chunk.4BRM5SGO.js";import{a as We,b as S}from"./chunk.DJ4A76SX.js";import{a as X,b as $e}from"./chunk.VDS3IOTK.js";import"./chunk.SAJLIA5M.js";import"./chunk.I2NI7CT7.js";import"./chunk.C7EJPV2N.js";import"./chunk.7ML2BWSP.js";import"./chunk.BCE6LIDR.js";import{b as Pe,c as Le}from"./chunk.MBLFZF5R.js";import"./chunk.RALAID6N.js";import"./chunk.XOZU4OFA.js";import"./chunk.5NZDFT6R.js";import"./chunk.7ECBGIUK.js";import"./chunk.XTBS64IT.js";import"./chunk.7INWDFNG.js";import"./chunk.FPGU43SC.js";import"./chunk.V6FUYRZI.js";import"./chunk.5BPRGXIW.js";import"./chunk.BZEJM2PY.js";import"./chunk.CMLNBJZG.js";import{u as Re}from"./chunk.QPL3OXW3.js";import"./chunk.OJGHDWI6.js";import"./chunk.FRERJWZJ.js";import"./chunk.RQX4CQJN.js";import{l as ze}from"./chunk.LUIRQ5UF.js";import{c as Ce}from"./chunk.N33WUCAN.js";import{j as Ie}from"./chunk.JQFIZRAZ.js";import"./chunk.LKJ6FD6Y.js";import{G as ot,Ma as J,Ra as He,T as Me,Va as Ee,ba as O,h as Ae,u as Te}from"./chunk.DBMZ3AQB.js";import"./chunk.SDO3U72B.js";import{Fb as be,Vc as Se,na as Q,oa as N,rc as xe,tc as ke}from"./chunk.DIFR37EZ.js";import"./chunk.FQLNBIQ5.js";import{b as Y}from"./chunk.AJZBJBMO.js";var a=Y(ot(),1);var t=Y(Me(),1);function wt(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 bt({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(`
1
+ import{a as Z,b as qe}from"./chunk.KHRS2SKB.js";import"./chunk.7XSDXX5Z.js";import"./chunk.644FUGSX.js";import"./chunk.4QWTSI7V.js";import{j as De,k as Ne,l as Oe}from"./chunk.P52UTBNO.js";import"./chunk.UM5H2VVR.js";import"./chunk.E22DDEQI.js";import"./chunk.OLW44AP5.js";import"./chunk.HJCQ6I3S.js";import"./chunk.ATVPAYS6.js";import"./chunk.VNBEAF62.js";import"./chunk.CZH27V2R.js";import"./chunk.P3CUCDHO.js";import{a as We,b as S}from"./chunk.OVSZXILB.js";import{a as X,b as $e}from"./chunk.BDBLGGFJ.js";import"./chunk.IZ2ZTNEV.js";import"./chunk.CJUIJ6TL.js";import"./chunk.LDYOQCY7.js";import"./chunk.VFRURRNI.js";import"./chunk.X2G4ZRB2.js";import{b as Pe,c as Le}from"./chunk.UITZ74YJ.js";import"./chunk.2NJDT47T.js";import"./chunk.XOZU4OFA.js";import"./chunk.MHILFBK6.js";import"./chunk.LDLTQNJ2.js";import"./chunk.ZFH4SCCF.js";import"./chunk.Q6LLURRM.js";import"./chunk.AXXYJCSW.js";import"./chunk.N4LOI3YA.js";import"./chunk.RKZ4J3H2.js";import"./chunk.HKINU7VO.js";import"./chunk.YGZCESXY.js";import{u as Re}from"./chunk.KHZA5F7A.js";import"./chunk.OJGHDWI6.js";import"./chunk.KSVJHSRH.js";import"./chunk.NSGQXCH6.js";import{l as ze}from"./chunk.SZG6HJWH.js";import{c as Ce}from"./chunk.2FOIJ5ID.js";import{j as Ie}from"./chunk.6IUEGPCZ.js";import"./chunk.CUJX3IVA.js";import{G as ot,Ma as J,Ra as He,T as Me,Va as Ee,ba as O,h as Ae,u as Te}from"./chunk.VNJKGSGZ.js";import"./chunk.SDO3U72B.js";import{Fb as be,Wc as Se,na as Q,oa as N,rc as xe,tc as ke}from"./chunk.X3MMJ3QC.js";import"./chunk.FQLNBIQ5.js";import{b as Y}from"./chunk.AJZBJBMO.js";var a=Y(ot(),1);var t=Y(Me(),1);function wt(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 bt({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
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{bt as InspectorPane,wt as prepareActs};
@@ -0,0 +1 @@
1
+ function r(e,n){if(e.past)return;let a=e.batches();for(let i=a.length-1;i>=0;i--){let t=a[i];if(t.undone||t.ops.length===0||t.ops.every(d=>d.undoes!==void 0))continue;let o=t.author;if(o.kind==="human"&&(n?.id===void 0||o.id===void 0||o.id===n.id)&&e.mayUndo(t.id,n).ok)return{batch:t.id,intent:t.intent}}}function s(e,n,a){let i=r(e,n);return i&&e.batches().slice(a).some(t=>t.id===i.batch)?i:void 0}var u=e=>`Take back \u201C${e.intent}\u201D`;function f(e,n){let a=r(e,n);return a&&e.undo(a.batch,n?{author:n}:{}),a}function h(e){let n=e.target;return!e.defaultPrevented&&!e.altKey&&!e.shiftKey&&(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()==="z"&&!(n instanceof HTMLElement&&(n.isContentEditable||n.matches("input, textarea, select")))}export{r as a,s as b,u as c,f as d,h as e};