graview 0.1.54 → 0.1.56

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 (197) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +6 -6
  3. package/dist/index.js.map +1 -1
  4. package/dist/preview/{chunk.XTT6ERI3.js → chunk.22MIRLL6.js} +1 -1
  5. package/dist/preview/chunk.2BLRCT3E.js +1 -0
  6. package/dist/preview/chunk.2DETYEJM.js +1 -0
  7. package/dist/preview/{chunk.AN5QCSVK.js → chunk.2E6EWVWR.js} +1 -1
  8. package/dist/preview/{chunk.RBYRT2I2.js → chunk.2HZGUVB2.js} +1 -1
  9. package/dist/preview/{chunk.ZBHFCSKO.js → chunk.2OX4YI46.js} +1 -1
  10. package/dist/preview/{chunk.E5JX5LWY.js → chunk.2YNZVNCA.js} +1 -1
  11. package/dist/preview/chunk.3V2WH6F7.js +1 -0
  12. package/dist/preview/chunk.3X3GLNWQ.js +1 -0
  13. package/dist/preview/chunk.45VIF2SX.js +5 -0
  14. package/dist/preview/{chunk.VGOWGOGD.js → chunk.4EUH6TLG.js} +2 -2
  15. package/dist/preview/chunk.4EY6WPSM.js +2 -0
  16. package/dist/preview/{chunk.Y2DFDMT6.js → chunk.4KMY24YC.js} +1 -1
  17. package/dist/preview/chunk.4YI6656P.js +1 -0
  18. package/dist/preview/{chunk.D2PJG5N7.js → chunk.5B4HNQGR.js} +1 -1
  19. package/dist/preview/chunk.5MS2TQFX.js +1 -0
  20. package/dist/preview/chunk.5MSWUTDB.js +1 -0
  21. package/dist/preview/{chunk.BOMYLOCX.js → chunk.64IKLRUS.js} +1 -1
  22. package/dist/preview/{chunk.VYKEIKY5.js → chunk.65Q5MKDW.js} +1 -1
  23. package/dist/preview/{chunk.3IEJQAK7.js → chunk.6HLKAUWF.js} +1 -1
  24. package/dist/preview/chunk.6Q6BW4QT.js +2 -0
  25. package/dist/preview/chunk.7ECBGIUK.js +1 -0
  26. package/dist/preview/{chunk.J2Z6WLCH.js → chunk.7NP2I2UP.js} +1 -1
  27. package/dist/preview/{chunk.5C43AM3X.js → chunk.7O6Z3BFR.js} +1 -1
  28. package/dist/preview/chunk.7RJGEU3Y.js +1 -0
  29. package/dist/preview/{chunk.TUNHUTQ5.js → chunk.7U2JO7ET.js} +1 -1
  30. package/dist/preview/chunk.7Z2PRPYE.js +1 -0
  31. package/dist/preview/{chunk.3JMZHCB4.js → chunk.7Z4USR3Y.js} +1 -1
  32. package/dist/preview/chunk.AGTFYPXY.js +1 -0
  33. package/dist/preview/{chunk.XZJ6XX5I.js → chunk.AIK3Z25Y.js} +1 -1
  34. package/dist/preview/{chunk.ZDDWXRPK.js → chunk.AKVBU5K5.js} +1 -1
  35. package/dist/preview/chunk.AKW6NR3X.js +1 -0
  36. package/dist/preview/{chunk.2DFWOLL2.js → chunk.AM2YRNOQ.js} +1 -1
  37. package/dist/preview/{chunk.2WSRJGW2.js → chunk.APXYWI3L.js} +1 -1
  38. package/dist/preview/{chunk.7SCENHVG.js → chunk.AQCU6TPV.js} +1 -1
  39. package/dist/preview/{chunk.B2X6DA2Q.js → chunk.AZUTYY2S.js} +1 -1
  40. package/dist/preview/chunk.BJUUSIQY.js +1 -0
  41. package/dist/preview/{chunk.FRZQSSGE.js → chunk.BNEOLRQG.js} +1 -1
  42. package/dist/preview/chunk.BT7RLFPO.js +1 -0
  43. package/dist/preview/{chunk.4GHXAWIE.js → chunk.C2VFDBSG.js} +1 -1
  44. package/dist/preview/{chunk.C3AHDHX7.js → chunk.CGM7OER2.js} +1 -1
  45. package/dist/preview/{chunk.4F5M5XZG.js → chunk.CKV2QCH5.js} +1 -1
  46. package/dist/preview/{chunk.4KTHJY5N.js → chunk.CU2NQ5WF.js} +1 -1
  47. package/dist/preview/{chunk.ARRLAAG6.js → chunk.D4LN33J2.js} +1 -1
  48. package/dist/preview/{chunk.W6NCLU5Y.js → chunk.D6BMAGPR.js} +1 -1
  49. package/dist/preview/{chunk.RCFAHV5N.js → chunk.D6KF72MZ.js} +1 -1
  50. package/dist/preview/{chunk.L7MFTL5S.js → chunk.DH7M57SE.js} +1 -1
  51. package/dist/preview/chunk.DPPT6WAJ.js +2 -0
  52. package/dist/preview/{chunk.45HTFSWD.js → chunk.DTSTUC2W.js} +1 -1
  53. package/dist/preview/{chunk.VTO6UWUP.js → chunk.DWMAFMYZ.js} +1 -1
  54. package/dist/preview/chunk.DZYLH5IM.js +1 -0
  55. package/dist/preview/{chunk.PZ4G5QA5.js → chunk.E33EJU3Q.js} +1 -1
  56. package/dist/preview/{chunk.33YC5RCB.js → chunk.E4EN4X5F.js} +1 -1
  57. package/dist/preview/{chunk.DF7IPT7V.js → chunk.E4HSSGF7.js} +1 -1
  58. package/dist/preview/{chunk.PZWJUQAO.js → chunk.E5XNQTEU.js} +1 -1
  59. package/dist/preview/{chunk.FWKNR7XF.js → chunk.EC5IWN74.js} +2 -2
  60. package/dist/preview/chunk.FBR4HJ2Q.js +1 -0
  61. package/dist/preview/{chunk.AKLVSZ5A.js → chunk.FCUDBMGC.js} +1 -1
  62. package/dist/preview/chunk.FOQENWF5.js +1 -0
  63. package/dist/preview/{chunk.SLBWPVIY.js → chunk.FQLNBIQ5.js} +1 -1
  64. package/dist/preview/{chunk.562IVJHX.js → chunk.G3ORIU7C.js} +1 -1
  65. package/dist/preview/chunk.GNQW4JOG.js +18 -0
  66. package/dist/preview/chunk.GUP7LC5O.js +21 -0
  67. package/dist/preview/{chunk.FWZF7X6A.js → chunk.HFVMGTNL.js} +2 -2
  68. package/dist/preview/chunk.HVN2DVP3.js +1 -0
  69. package/dist/preview/{chunk.4WH4N4V7.js → chunk.I2C5LPB5.js} +1 -1
  70. package/dist/preview/{chunk.BPWSQVEN.js → chunk.IF4FCQPG.js} +1 -1
  71. package/dist/preview/{chunk.U7GN6UPR.js → chunk.ILSK2E3R.js} +1 -1
  72. package/dist/preview/{chunk.2LMB5E6N.js → chunk.IRMO4FUC.js} +1 -1
  73. package/dist/preview/chunk.IT763BYH.js +1 -0
  74. package/dist/preview/chunk.IUQOSPQX.js +1 -0
  75. package/dist/preview/{chunk.Y36WSKL5.js → chunk.J3YBEZKE.js} +1 -1
  76. package/dist/preview/{chunk.4V64RBCK.js → chunk.JHFHIG4P.js} +1 -1
  77. package/dist/preview/chunk.JL4DGITZ.js +1 -0
  78. package/dist/preview/{chunk.463PGKOL.js → chunk.JQY2UKU6.js} +1 -1
  79. package/dist/preview/{chunk.IDYPQ45A.js → chunk.JZDKHWRL.js} +1 -1
  80. package/dist/preview/{chunk.6BBB7SJL.js → chunk.K2JE3PD7.js} +1 -1
  81. package/dist/preview/chunk.K4MO22RM.js +1 -0
  82. package/dist/preview/{chunk.NEJSKMJV.js → chunk.K5YLQAFW.js} +1 -1
  83. package/dist/preview/{chunk.IMHUKSPM.js → chunk.KBL4Y4UN.js} +1 -1
  84. package/dist/preview/chunk.KMEKMCKG.js +3 -0
  85. package/dist/preview/{chunk.3ZONBC6L.js → chunk.LKK7VQBA.js} +1 -1
  86. package/dist/preview/chunk.LLOZKUCA.js +1 -0
  87. package/dist/preview/{chunk.YXRKZMS5.js → chunk.LP3SHWJG.js} +1 -1
  88. package/dist/preview/chunk.LVOVPU64.js +1 -0
  89. package/dist/preview/chunk.MEJUAV3Y.js +1 -0
  90. package/dist/preview/{chunk.7JCUSYS5.js → chunk.MFDSWA2W.js} +1 -1
  91. package/dist/preview/{chunk.JTOAZ2IR.js → chunk.MJMVGW6Z.js} +1 -1
  92. package/dist/preview/{chunk.SDO3DD77.js → chunk.MLRPCZVS.js} +1 -1
  93. package/dist/preview/{chunk.OCV46AFN.js → chunk.MORMTKVR.js} +1 -1
  94. package/dist/preview/{chunk.FMP6NDRZ.js → chunk.N3Q5CPVA.js} +1 -1
  95. package/dist/preview/{chunk.VW6X53E7.js → chunk.N7EEPFYV.js} +1 -1
  96. package/dist/preview/{chunk.NGWHV4G6.js → chunk.NBLMANHT.js} +1 -1
  97. package/dist/preview/{chunk.5RH6FO3K.js → chunk.NFU4UM6F.js} +1 -1
  98. package/dist/preview/chunk.NPAWTPLQ.js +25 -0
  99. package/dist/preview/{chunk.B6PKKEY3.js → chunk.NQ4VGKEC.js} +1 -1
  100. package/dist/preview/{chunk.MNW2ZBQ6.js → chunk.NUE5VG4G.js} +1 -1
  101. package/dist/preview/{chunk.XBDFXFWM.js → chunk.O6LDZWLR.js} +1 -1
  102. package/dist/preview/chunk.OBUKZQCZ.js +1 -0
  103. package/dist/preview/{chunk.GKLDSHHH.js → chunk.ONGZ3YQF.js} +1 -1
  104. package/dist/preview/chunk.OYGPNO7A.js +1 -0
  105. package/dist/preview/chunk.PJCVFYFU.js +1 -0
  106. package/dist/preview/{chunk.IYYP6QUH.js → chunk.PMPDLE56.js} +1 -1
  107. package/dist/preview/{chunk.PR2TSHE7.js → chunk.PRV3KYT6.js} +2 -2
  108. package/dist/preview/chunk.Q7X2IVLH.js +1 -0
  109. package/dist/preview/chunk.QAIYYIZQ.js +1 -0
  110. package/dist/preview/chunk.QNNRSPIJ.js +2 -0
  111. package/dist/preview/{chunk.KI6M3EWZ.js → chunk.QSO5BP2H.js} +1 -1
  112. package/dist/preview/{chunk.WICMCZ27.js → chunk.QW3QLE53.js} +1 -1
  113. package/dist/preview/{chunk.WHGEDJB2.js → chunk.QYFZ7AZS.js} +2 -2
  114. package/dist/preview/{chunk.Q6RUTFU3.js → chunk.RDL6652E.js} +1 -1
  115. package/dist/preview/{chunk.MDWCX3YU.js → chunk.RR2IFETZ.js} +1 -1
  116. package/dist/preview/{chunk.R7RDUW37.js → chunk.RXYE2DAJ.js} +1 -1
  117. package/dist/preview/chunk.SDLUWRGI.js +1 -0
  118. package/dist/preview/chunk.SOTB6C5A.js +1 -0
  119. package/dist/preview/{chunk.3SOJJAMY.js → chunk.SRC37GNP.js} +1 -1
  120. package/dist/preview/{chunk.CB7IUKY7.js → chunk.SVAQGVS4.js} +1 -1
  121. package/dist/preview/chunk.T2RME6XF.js +1 -0
  122. package/dist/preview/{chunk.COWJTVZV.js → chunk.T6HG2XIP.js} +1 -1
  123. package/dist/preview/{chunk.6TILXTP6.js → chunk.TAIYNHSW.js} +1 -1
  124. package/dist/preview/chunk.TAJ2R44N.js +1 -0
  125. package/dist/preview/{chunk.BUDEUNBN.js → chunk.TQCRFZ53.js} +1 -1
  126. package/dist/preview/{chunk.ZYW7Q5EN.js → chunk.TXWCTHMI.js} +1 -1
  127. package/dist/preview/chunk.UE5YS3GN.js +1 -0
  128. package/dist/preview/{chunk.C6HBYRGJ.js → chunk.UQQAGT3R.js} +1 -1
  129. package/dist/preview/chunk.USB6B6L3.js +104 -0
  130. package/dist/preview/{chunk.KRVEAIKW.js → chunk.USQNSNIA.js} +1 -1
  131. package/dist/preview/{chunk.AZGXBTOQ.js → chunk.V3NPUAPB.js} +1 -1
  132. package/dist/preview/{chunk.NDI5OWIB.js → chunk.VDD3RHLB.js} +1 -1
  133. package/dist/preview/{chunk.ULSN3ASK.js → chunk.VEOS25PQ.js} +1 -1
  134. package/dist/preview/chunk.VIQ6EF2O.js +1 -0
  135. package/dist/preview/{chunk.OZ4EJ5M6.js → chunk.VLBY66PB.js} +2 -2
  136. package/dist/preview/chunk.VSM72NVF.js +1 -0
  137. package/dist/preview/{chunk.GVUJCOKD.js → chunk.VYW7DSUW.js} +2 -2
  138. package/dist/preview/{chunk.DTJ4FIHM.js → chunk.WMB2NNBD.js} +1 -1
  139. package/dist/preview/{chunk.KJGNLWU3.js → chunk.WPJVMVAL.js} +1 -1
  140. package/dist/preview/{chunk.CB5DGKR5.js → chunk.XGCOWCA2.js} +1 -1
  141. package/dist/preview/chunk.XJFAUOJS.js +1 -0
  142. package/dist/preview/{chunk.7TMWMW4W.js → chunk.XY5EVI22.js} +1 -1
  143. package/dist/preview/chunk.YEJ4LNUP.js +5 -0
  144. package/dist/preview/{chunk.FCZ7UFJI.js → chunk.YL5ZCRHQ.js} +1 -1
  145. package/dist/preview/{chunk.MAWP27FD.js → chunk.YLMOGGEP.js} +1 -1
  146. package/dist/preview/{chunk.WVWXNW74.js → chunk.ZFXHZZHW.js} +1 -1
  147. package/dist/preview/index.html +52 -51
  148. package/dist/preview/page.js +2 -2
  149. package/package.json +6 -6
  150. package/dist/preview/chunk.25P5SDNR.js +0 -1
  151. package/dist/preview/chunk.27O4LIDU.js +0 -1
  152. package/dist/preview/chunk.3G5DEGFA.js +0 -1
  153. package/dist/preview/chunk.3MZIWKNG.js +0 -5
  154. package/dist/preview/chunk.3V2WXZU3.js +0 -1
  155. package/dist/preview/chunk.4BX3KLAA.js +0 -1
  156. package/dist/preview/chunk.4TGQ6Z6E.js +0 -1
  157. package/dist/preview/chunk.57VTD3CU.js +0 -1
  158. package/dist/preview/chunk.5M62CMLA.js +0 -1
  159. package/dist/preview/chunk.5VF2RT4H.js +0 -1
  160. package/dist/preview/chunk.5XAIP3BS.js +0 -1
  161. package/dist/preview/chunk.5ZWE72VJ.js +0 -1
  162. package/dist/preview/chunk.6SPORDJC.js +0 -1
  163. package/dist/preview/chunk.7UD2JR6J.js +0 -1
  164. package/dist/preview/chunk.AG7CUSSV.js +0 -1
  165. package/dist/preview/chunk.C6HI3LRB.js +0 -1
  166. package/dist/preview/chunk.D6ACCKYJ.js +0 -1
  167. package/dist/preview/chunk.EC7I33WI.js +0 -1
  168. package/dist/preview/chunk.GHPCSNM6.js +0 -21
  169. package/dist/preview/chunk.HLDMTKUP.js +0 -1
  170. package/dist/preview/chunk.J3OX474P.js +0 -1
  171. package/dist/preview/chunk.JCFYZEMY.js +0 -1
  172. package/dist/preview/chunk.JLB4QP6Q.js +0 -1
  173. package/dist/preview/chunk.JXGDVJ4N.js +0 -1
  174. package/dist/preview/chunk.K2J26XMB.js +0 -104
  175. package/dist/preview/chunk.KLJDBYAZ.js +0 -1
  176. package/dist/preview/chunk.LNOWO3IY.js +0 -2
  177. package/dist/preview/chunk.LOUICR7K.js +0 -1
  178. package/dist/preview/chunk.LU3B3SZH.js +0 -1
  179. package/dist/preview/chunk.LVOL2LEC.js +0 -1
  180. package/dist/preview/chunk.LYFEGG6E.js +0 -1
  181. package/dist/preview/chunk.MPMROUZA.js +0 -1
  182. package/dist/preview/chunk.MVRNEC3Y.js +0 -2
  183. package/dist/preview/chunk.OLKFEHWB.js +0 -1
  184. package/dist/preview/chunk.PCNEM3WE.js +0 -1
  185. package/dist/preview/chunk.QB7RYJ67.js +0 -5
  186. package/dist/preview/chunk.RLO3RDYH.js +0 -2
  187. package/dist/preview/chunk.RYMSHMLM.js +0 -1
  188. package/dist/preview/chunk.SF4BYBH6.js +0 -25
  189. package/dist/preview/chunk.SG7YVKH4.js +0 -1
  190. package/dist/preview/chunk.T42H5RXN.js +0 -1
  191. package/dist/preview/chunk.TI4OSTQV.js +0 -1
  192. package/dist/preview/chunk.VFMC45E7.js +0 -1
  193. package/dist/preview/chunk.VWQ57LTT.js +0 -18
  194. package/dist/preview/chunk.Y36MLVMT.js +0 -1
  195. package/dist/preview/chunk.Z6O7RUSR.js +0 -1
  196. package/dist/preview/chunk.ZAGP3OKY.js +0 -1
  197. package/dist/preview/chunk.ZUBC3UFG.js +0 -2
@@ -1,25 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Ye}from"./chunk.SDO3U72B.js";import{Ga as Xn,J as Zn,Ka as kt,Ma as Jn,Md as so,Qc as to,Qd as lo,Sd as Ue,Td as Rt,Ya as Qn,_c as no,ad as oo,dd as ro,gd as io,rc as eo,wd as ao}from"./chunk.3MZIWKNG.js";import{a as $e,b as H}from"./chunk.AJZBJBMO.js";var To=$e(w=>{"use strict";var _t=Symbol.for("react.transitional.element"),ti=Symbol.for("react.portal"),ni=Symbol.for("react.fragment"),oi=Symbol.for("react.strict_mode"),ri=Symbol.for("react.profiler"),ii=Symbol.for("react.consumer"),ai=Symbol.for("react.context"),si=Symbol.for("react.forward_ref"),li=Symbol.for("react.suspense"),di=Symbol.for("react.memo"),xo=Symbol.for("react.lazy"),ui=Symbol.for("react.activity"),So=Symbol.iterator;function ci(e){return e===null||typeof e!="object"?null:(e=So&&e[So]||e["@@iterator"],typeof e=="function"?e:null)}var Eo={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Po=Object.assign,Ao={};function he(e,t,n){this.props=e,this.context=t,this.refs=Ao,this.updater=n||Eo}he.prototype.isReactComponent={};he.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};he.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function ko(){}ko.prototype=he.prototype;function Ht(e,t,n){this.props=e,this.context=t,this.refs=Ao,this.updater=n||Eo}var Dt=Ht.prototype=new ko;Dt.constructor=Ht;Po(Dt,he.prototype);Dt.isPureReactComponent=!0;var wo=Array.isArray;function Lt(){}var O={H:null,A:null,T:null,S:null},Ro=Object.prototype.hasOwnProperty;function Nt(e,t,n){var o=n.ref;return{$$typeof:_t,type:e,key:t,ref:o!==void 0?o:null,props:n}}function pi(e,t){return Nt(e.type,t,e.props)}function jt(e){return typeof e=="object"&&e!==null&&e.$$typeof===_t}function fi(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var vo=/\/+/g;function It(e,t){return typeof e=="object"&&e!==null&&e.key!=null?fi(""+e.key):t.toString(36)}function yi(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Lt,Lt):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function ge(e,t,n,o,r){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case _t:case ti:a=!0;break;case xo:return a=e._init,ge(a(e._payload),t,n,o,r)}}if(a)return r=r(e),a=o===""?"."+It(e,0):o,wo(r)?(n="",a!=null&&(n=a.replace(vo,"$&/")+"/"),ge(r,t,n,"",function(c){return c})):r!=null&&(jt(r)&&(r=pi(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(vo,"$&/")+"/")+a)),t.push(r)),1;a=0;var s=o===""?".":o+":";if(wo(e))for(var l=0;l<e.length;l++)o=e[l],i=s+It(o,l),a+=ge(o,t,n,i,r);else if(l=ci(e),typeof l=="function")for(e=l.call(e),l=0;!(o=e.next()).done;)o=o.value,i=s+It(o,l++),a+=ge(o,t,n,i,r);else if(i==="object"){if(typeof e.then=="function")return ge(yi(e),t,n,o,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return a}function ot(e,t,n){if(e==null)return e;var o=[],r=0;return ge(e,o,"","",function(i){return t.call(n,i,r++)}),o}function mi(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var bo=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},gi={map:ot,forEach:function(e,t,n){ot(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ot(e,function(){t++}),t},toArray:function(e){return ot(e,function(t){return t})||[]},only:function(e){if(!jt(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};w.Activity=ui;w.Children=gi;w.Component=he;w.Fragment=ni;w.Profiler=ri;w.PureComponent=Ht;w.StrictMode=oi;w.Suspense=li;w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O;w.__COMPILER_RUNTIME={__proto__:null,c:function(e){return O.H.useMemoCache(e)}};w.cache=function(e){return function(){return e.apply(null,arguments)}};w.cacheSignal=function(){return null};w.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var o=Po({},e.props),r=e.key;if(t!=null)for(i in t.key!==void 0&&(r=""+t.key),t)!Ro.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(o[i]=t[i]);var i=arguments.length-2;if(i===1)o.children=n;else if(1<i){for(var a=Array(i),s=0;s<i;s++)a[s]=arguments[s+2];o.children=a}return Nt(e.type,r,o)};w.createContext=function(e){return e={$$typeof:ai,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:ii,_context:e},e};w.createElement=function(e,t,n){var o,r={},i=null;if(t!=null)for(o in t.key!==void 0&&(i=""+t.key),t)Ro.call(t,o)&&o!=="key"&&o!=="__self"&&o!=="__source"&&(r[o]=t[o]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var s=Array(a),l=0;l<a;l++)s[l]=arguments[l+2];r.children=s}if(e&&e.defaultProps)for(o in a=e.defaultProps,a)r[o]===void 0&&(r[o]=a[o]);return Nt(e,i,r)};w.createRef=function(){return{current:null}};w.forwardRef=function(e){return{$$typeof:si,render:e}};w.isValidElement=jt;w.lazy=function(e){return{$$typeof:xo,_payload:{_status:-1,_result:e},_init:mi}};w.memo=function(e,t){return{$$typeof:di,type:e,compare:t===void 0?null:t}};w.startTransition=function(e){var t=O.T,n={};O.T=n;try{var o=e(),r=O.S;r!==null&&r(n,o),typeof o=="object"&&o!==null&&typeof o.then=="function"&&o.then(Lt,bo)}catch(i){bo(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),O.T=t}};w.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()};w.use=function(e){return O.H.use(e)};w.useActionState=function(e,t,n){return O.H.useActionState(e,t,n)};w.useCallback=function(e,t){return O.H.useCallback(e,t)};w.useContext=function(e){return O.H.useContext(e)};w.useDebugValue=function(){};w.useDeferredValue=function(e,t){return O.H.useDeferredValue(e,t)};w.useEffect=function(e,t){return O.H.useEffect(e,t)};w.useEffectEvent=function(e){return O.H.useEffectEvent(e)};w.useId=function(){return O.H.useId()};w.useImperativeHandle=function(e,t,n){return O.H.useImperativeHandle(e,t,n)};w.useInsertionEffect=function(e,t){return O.H.useInsertionEffect(e,t)};w.useLayoutEffect=function(e,t){return O.H.useLayoutEffect(e,t)};w.useMemo=function(e,t){return O.H.useMemo(e,t)};w.useOptimistic=function(e,t){return O.H.useOptimistic(e,t)};w.useReducer=function(e,t,n){return O.H.useReducer(e,t,n)};w.useRef=function(e){return O.H.useRef(e)};w.useState=function(e){return O.H.useState(e)};w.useSyncExternalStore=function(e,t,n){return O.H.useSyncExternalStore(e,t,n)};w.useTransition=function(){return O.H.useTransition()};w.version="19.2.8"});var W=$e((es,Mo)=>{"use strict";Mo.exports=To()});var Wo=$e(at=>{"use strict";var ki=Symbol.for("react.transitional.element"),Ri=Symbol.for("react.fragment");function jo(e,t,n){var o=null;if(n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:ki,type:e,key:o,ref:t!==void 0?t:null,props:n}}at.Fragment=Ri;at.jsx=jo;at.jsxs=jo});var De=$e((us,Go)=>{"use strict";Go.exports=Wo()});var fe={focusId:null,relation:null,expanded:[],pins:{}},Ze=e=>{let t=Number(e);return Number.isFinite(t)?t:null};function Q(e){let t=new URLSearchParams;e.focusId&&t.set("focus",e.focusId),e.relation&&t.set("relation",e.relation),e.overview&&t.set("overview","1"),e.zoom&&t.set("zoom","1"),e.past&&t.set("past","1"),e.shown&&e.shown.length>0&&t.set("show",[...e.shown].sort().join(",")),e.selection!==void 0&&e.selection.length>0&&t.set("sel",[...e.selection].sort().join(",")),e.expanded.length>0&&t.set("expand",[...e.expanded].sort().join(","));for(let o of Object.keys(e.pins).sort()){let r=e.pins[o];t.set(`pin.${o}`,`${Xe(r.x)},${Xe(r.y)}`)}e.pan&&(e.pan.x!==0||e.pan.y!==0)&&t.set("pan",`${Xe(e.pan.x)},${Xe(e.pan.y)}`);for(let o of Object.keys(e.within??{}).sort()){let r=e.within[o];r.length>0&&t.set(`in.${o}`,r)}e.q&&e.q.trim().length>0&&t.set("q",e.q);let n=t.toString();return n?`#${n}`:"#"}function Yr(e){return e&&e.startsWith("agg:")?`aggregate:${e.slice(4)}`:e}function Je(e){let t=e.includes("#")?e.slice(e.indexOf("#")+1):e,n=new URLSearchParams(t),o=Object.create(null);for(let[g,y]of n){if(!g.startsWith("pin."))continue;let[m,b]=y.split(","),k=m===void 0?null:Ze(m),f=b===void 0?null:Ze(b);k===null||f===null||(o[g.slice(4)]={x:k,y:f})}let r=Object.create(null);for(let[g,y]of n)!g.startsWith("in.")||y.length===0||(r[g.slice(3)]=y);let i=n.get("view");i&&i.length>0&&r.view===void 0&&(r.view=i);let a=n.get("pan")?.split(",")??[],s=a[0]===void 0?null:Ze(a[0]),l=a[1]===void 0?null:Ze(a[1]),c=(n.get("sel")??"").split(",").filter(g=>g.length>0).sort(),u=n.get("overview")==="1";return{...c.length>0?{selection:c}:{},...u?{overview:!0}:{},...n.get("zoom")==="1"?{zoom:!0}:{},...n.get("past")==="1"?{past:!0}:{},...n.get("show")?{shown:[...new Set(n.get("show").split(",").filter(Boolean))].sort()}:{},...s!==null&&l!==null?{pan:{x:s,y:l}}:{},...Object.keys(r).length>0?{within:r}:{},...n.get("q")?.trim()?{q:n.get("q")}:{},focusId:Yr(n.get("focus")),relation:n.get("relation"),expanded:(n.get("expand")??"").split(",").filter(g=>g.length>0&&(u||!g.startsWith("kind:"))).sort(),pins:o}}function Da(e){let t=Je(e);return Q(t)==="#"?{...t,overview:!0}:t}function Na(e){let t=Q(e);return t==="#overview=1"?"":t}function Xe(e){return Math.round(e*100)/100}function co(e,t){return Q(e)===Q(t)}var uo="edge:";function po(e){if(!e.startsWith(uo))return null;let t=e.slice(uo.length).split(":");if(t.length!==3)return null;let[n,o,r]=t;if(!n||!o||!r)return null;try{return{kind:decodeURIComponent(n),from:decodeURIComponent(o),to:decodeURIComponent(r)}}catch{return null}}function Tt(e){let{pan:t,...n}=e;return{...n,pins:{}}}function z(e,t){if(t===e.focusId)return{...e,focusId:t};let n=Tt(e);return{...n.within?.q!==void 0?le(n,"q",null):n,focusId:t}}function fo(e,t){return{...e,relation:t}}function le(e,t,n){let o={...e.within??{}};if(n===null?delete o[t]:o[t]=n,Object.keys(o).length===0){let{within:r,...i}=e;return i}return{...e,within:o}}function ye(e,t){if(t!==e.overview&&(e=Tt(e)),!t){let n=e.expanded.filter(o=>!o.startsWith("kind:"));return{...e,overview:!1,expanded:n}}return{...e,overview:t}}function Qe(e,t){if(t.length===0){let{selection:n,...o}=e;return o}return{...e,selection:[...t]}}function _e(e,t){if(t!==(e.zoom===!0)&&(e=Tt(e)),!t){let{zoom:n,...o}=e;return o}return{...e,zoom:!0}}function et(e,t){let n=new Set(e.expanded);return n.has(t)?n.delete(t):n.add(t),{...e,expanded:[...n].sort()}}var nt="aggregate:",tt="kind:";function Mt(e){return`${tt}${e}`}function me(e){return e.startsWith(tt)?e.slice(tt.length):null}var Ga="kinds:beyond";function Zr(e){let t=me(e);return t?[t]:de(e)}function ee(...e){return`${nt}${[...e].sort().join("+")}`}function yo(e){return e.startsWith(nt)}function de(e){return!yo(e)||e.includes("|")?[]:e.slice(nt.length).split("+").filter(Boolean)}function mo(e,t,n={}){let o=me(t);if(o!==null&&e.overview&&n.ownPicture!==!0)return et(e,t);let r=o!==null?ee(o):t;if(e.zoom&&e.focusId===r&&!(o!==null&&n.carry))return _e(e,!1);if(o!==null&&n.carry){let i=ye({...z(e,r),relation:null},!1);return le(_e(i,!0),"q",n.carry)}return _e({...z(e,r),relation:null},!0)}function Xr(e,t,n){return le(ye(z(e,ee(t)),!1),"view",n)}function Fa(e,t){return e.id<t.id?-1:e.id>t.id?1:0}var go="aggregate:";function Ct(e){return e.startsWith(go)&&e.includes("|")}var Ot=e=>e?.off===!0,Jr=e=>e!==void 0&&!Ot(e)&&(e.fast!==void 0||e.thinking!==void 0||e.answer!==void 0||e.decide!==void 0||e.complete!==void 0||e.turn!==void 0),ho=e=>e!==void 0&&!Ot(e)&&(e.fast!==void 0||e.decide!==void 0),Qr=e=>e?.suggestOnOpen!==!1&&ho(e),ei=e=>e?.hoverChips===!0&&ho(e);var Vt={};var Co=H(W(),1),hi={turns:[],outcomes:new Map,busy:!1,pending:null,draft:null,draftNote:null},Oo=e=>`graview:seat:${e}`;function Si(e){if(!e)return{};try{let t=sessionStorage.getItem(e);if(!t)return{};let n=JSON.parse(t);return{...Array.isArray(n.turns)?{turns:n.turns}:{},...Array.isArray(n.outcomes)?{outcomes:new Map(n.outcomes)}:{},...n.draft?.drawn?{draft:n.draft}:{}}}catch{return{}}}function wi(e,t){if(e)try{sessionStorage.setItem(e,JSON.stringify({turns:t.turns.slice(-40),outcomes:[...t.outcomes],draft:t.draft}))}catch{}}function Wt(e){let t=e===null?null:Oo(e),n={...hi,...Si(t)},o=new Set,r=(i,a=!0)=>{n=i,a&&wi(t,n);for(let s of[...o])s()};return{get:()=>n,subscribe(i){return o.add(i),()=>void o.delete(i)},setTurns:i=>r({...n,turns:i(n.turns)}),settle:(i,a)=>r({...n,outcomes:new Map(n.outcomes).set(i,a)}),setBusy:i=>r({...n,busy:i},!1),ask:i=>r({...n,pending:i.trim()||null}),takePending(){let i=n.pending;return i!==null&&r({...n,pending:null},!1),i},setDraft:(i,a=null)=>r({...n,draft:i,draftNote:a})}}function vi(e){return(0,Co.useSyncExternalStore)(e.subscribe,e.get,e.get)}var Io=H(W(),1),bi={entries:[],ghost:null,loaded:!1};function Vo(e,t){let n=new Map(e.map(o=>[o.id,o]));for(let o of t)n.set(o.id,{...n.get(o.id),...o});return[...n.values()].sort((o,r)=>o.at<r.at?1:o.at>r.at?-1:0)}function Gt(e){let t=bi,n=new Set,o=r=>{t=r;for(let i of[...n])i()};return{get:()=>t,subscribe:r=>(n.add(r),()=>n.delete(r)),record:r=>{o({...t,entries:Vo(t.entries,[r])}),Promise.resolve(e()?.keep?.(r)).catch(i=>{console.warn("The host did not keep an AI interaction:",i)})},setGhost:r=>o({...t,ghost:r}),load:()=>{if(t.loaded)return;o({...t,loaded:!0});let r=e()?.load;r&&Promise.resolve(r()).then(i=>o({...t,entries:Vo(t.entries,i)})).catch(i=>{console.warn("The host's AI interactions could not be read:",i)})}}}function xi(e){return(0,Io.useSyncExternalStore)(e.subscribe,e.get,e.get)}function Lo(e){return e?.closest?.("[data-graview-pick]")?.getAttribute("data-graview-pick")??null}var rt=H(W(),1),it=(0,rt.createContext)(void 0),Ei=()=>(0,rt.useContext)(it);var P=H(W(),1),He=(0,P.createContext)(null);function Ho(){return(0,P.useContext)(He)}function Pi(e,t){let n=Ho(),o=(0,P.useMemo)(()=>n?n.live.seenBy(t):e,[n,e,t]),r=(0,P.useRef)(0),i=(0,P.useCallback)(a=>o.subscribe(()=>{r.current+=1,a()}),[o]);return(0,P.useSyncExternalStore)(i,()=>r.current,()=>0),o}var Do=Ye(()=>(__graviewPreload(import.meta.url,["./chunk.RYMSHMLM.js","./chunk.TI4OSTQV.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.25P5SDNR.js")));function Ft(e){let[,t]=(0,P.useReducer)(o=>o+1,0),n=e.publishing?.mode==="on-publish"&&!no();return(0,P.useEffect)(()=>{n&&Do().then(t,()=>{})},[n]),!n}var _o,Ai=400;function Kt(e,t,n){let o=(0,P.useContext)(He),r=o!==null&&o.owns(e,t),[i,a]=(0,P.useState)(null),[s,l]=(0,P.useState)(_o);(0,P.useEffect)(()=>{if(s||r||i===null)return;let E=!0;return Do().then(I=>{_o=I,E&&l(I)},()=>{}),()=>{E=!1}},[s,r,i]);let[c,u]=(0,P.useState)(0),[g,y]=(0,P.useMemo)(()=>r||i===null||!s?[]:[i>=e.log.length?void 0:s.askArchived(e,i,n)??s.askDeclaration(n,i),s.keptOf(e,n)],[r,e,i,n,s,c]),m=g&&"waiting"in g?g.waiting:void 0,b=g&&"seq"in g?g:null,[k,f]=(0,P.useState)(void 0);(0,P.useEffect)(()=>{if(!m)return;let E=!0,I=setTimeout(()=>E&&f(m),Ai);return m.then(()=>E&&u(_=>_+1)),()=>{E=!1,clearTimeout(I)}},[m]);let S=m!==void 0&&k!==m||b!==null,v=(0,P.useMemo)(()=>{if(r||i===null||i>=e.log.length||!s||S)return null;try{let E=s.pastAt(e,i,n);return{seq:i,at:E.past?.at,store:E}}catch{return null}},[r,e,i,n,s,S,c]),A=(0,P.useRef)(null),x=S?A.current:v;(0,P.useEffect)(()=>{A.current=x},[x]);let F=(0,P.useCallback)(E=>a(E===null?null:E>=e.log.length?Number.POSITIVE_INFINITY:E),[e]),D=(0,P.useCallback)((E,I)=>[e,x?.store].some(_=>_!==void 0&&(_===E||_.seenBy(I)===E)),[e,x]),N=i!==null,V=(0,P.useMemo)(()=>({past:x,open:N,show:F,live:e,host:n,owns:D,archive:b,kept:y}),[x,N,F,e,n,D,b,y]);return r?o:V}var No=H(W(),1),Bt=(0,No.createContext)(null);var Fo=e=>`graview:setting:${e}`;function Ko(){return localStorage}function Bo(e,t){try{let n=(t??Ko()).getItem(Fo(e.name));if(n!==null&&e.options.some(o=>o.value===n))return n}catch{}return e.initial}function qo(e,t,n){try{(n??Ko()).setItem(Fo(e.name),t)}catch{}}function zo(e,t){if(typeof document>"u")return;let n=document.documentElement;if(e.honored==="root-font-size"){n.style.fontSize=t===e.initial?"":t;return}let o=`graview${e.name.replace(/-([a-z0-9])/g,(r,i)=>i.toUpperCase()).replace(/^[a-z]/,r=>r.toUpperCase())}`;t===e.initial?delete n.dataset[o]:n.dataset[o]=t}var L=H(W(),1);function qt(e){return Ue(e)}var Ti=12,Mi=4;function Ci(e,t,n){let o=qt(t);return e.get(o)??{participant:o,who:t.id??t.kind,at:null,mode:"docked",since:n,trail:[]}}var st=(e,t)=>t===null||e[e.length-1]===t?e:[...e,t].slice(-Ti);function $o(e,t){let n=e.filter(r=>r.length>0);if(n.length===0)return null;if(n.length<=Mi)return n[0];let o=new Set(n.map(r=>t(r)).filter(r=>r!==void 0));return o.size===1?Mt([...o][0]):n[0]}function zt(e,t,n){let o=new Map(e);if(t.type==="rest"){for(let[a,s]of e)s.mode!=="asking"&&s.mode!=="docked"&&t.at-s.since>=t.holdMs&&o.set(a,{...s,mode:"docked",at:null,trail:[],say:void 0,confidence:void 0});return o}if(t.author.kind!=="agent")return o;let r=Ci(e,t.author,t.at),i=a=>o.set(r.participant,{...r,...a,since:t.at});switch(t.type){case"read":{let a=$o(t.ids,n);return i({at:a,mode:"reading",trail:st(r.trail,a)}),o}case"about-to-write":case"write":{let a=$o(t.ids,n);return i({at:a,mode:"writing",trail:st(r.trail,a),say:void 0,confidence:void 0}),o}case"refused":return i({at:t.where,mode:"refused",say:t.say,confidence:void 0,trail:st(r.trail,t.where)}),o;case"asking":return i({at:t.where??r.at,mode:"asking",say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},trail:st(r.trail,t.where)}),o;case"said":return i({say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},...t.caption?{caption:t.caption}:{}}),o;case"over":return i({over:t.over}),o;case"home":return i({at:null,mode:"docked",trail:[],say:void 0,confidence:void 0,over:null}),o;default:return o}}var Uo="graview:session";function Yo(e){let t=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);try{let n=e??sessionStorage,o=n.getItem(Uo);if(o)return o;let r=t();return n.setItem(Uo,r),r}catch{return t()}}var $t={name:"share-where",title:"Where you are",description:"Whether the others here see which stop you are on.",honored:"root-attribute",options:[{value:"shared",label:"Shown"},{value:"private",label:"Hidden"}],initial:"shared"},Ut={name:"share-over",title:"What you point at",description:"Whether the others see the thing under your pointer, outlined in your color.",honored:"root-attribute",options:[{value:"private",label:"Kept to yourself"},{value:"shared",label:"Outlined for others"}],initial:"private"},Zo=[$t,Ut],Oi=800;function Xo(e){let{channel:t,store:n,view:o,principal:r,session:i,robots:a,seatWho:s,settingValues:l,setView:c,ttlMs:u=lo,people:g,seats:y}=e,[m,b]=(0,L.useState)(()=>new Map),[k,f]=(0,L.useState)(null),[S,v]=(0,L.useState)(null),[A,x]=(0,L.useState)(null),F=typeof r.id=="string"&&r.id.length>0,D=F&&(l[$t.name]??$t.initial)==="shared",N=D&&(l[Ut.name]??Ut.initial)==="shared",V=qt({kind:r.kind,...r.id?{id:r.id}:{},session:i}),E=F?Qn(r,{graph:n.graph,schema:n.schema,...y?{seats:y}:{},...g?{people:g}:{}}):"",I=s?a.get(`agent:${s}:${i}`):void 0,_=(0,L.useMemo)(()=>!t||!D?null:{participant:V,kind:r.kind,name:E,...r.onBehalfOf?.id?{onBehalfOf:r.onBehalfOf.id,...r.onBehalfOf.name?{onBehalfOfName:r.onBehalfOf.name}:{}}:{},hue:eo(r.id??"nobody"),stop:A??Q(o),...N?{over:k}:{},...I?{robot:{at:I.at,mode:I.mode}}:{},at:new Date().toISOString()},[t,D,N,V,E,r.id,r.kind,r.onBehalfOf?.id,r.onBehalfOf?.name,o,A,k,I?.at,I?.mode]),We=(0,L.useRef)(null),Pe=R=>R&&t?.here({...R,caret:We.current??void 0,at:new Date().toISOString()}),Ae=(0,L.useCallback)(R=>{We.current=R,Pe(_)},[t,_]);(0,L.useEffect)(()=>{if(!_)return;Pe(_);let R=setInterval(()=>Pe(_),Oi);return()=>clearInterval(R)},[t,_]),(0,L.useEffect)(()=>t?t.onWho(B=>b(Rt(new Map,B,Date.now(),u))):void 0,[t,u]);let ke=m.size>0;(0,L.useEffect)(()=>{if(!ke)return;let R=setInterval(()=>{b(B=>{let X=Rt(B,[],Date.now(),u);return X.size===B.size?B:X})},Math.max(250,Math.min(1e3,u/4)));return()=>clearInterval(R)},[ke,u]),(0,L.useEffect)(()=>{if(!t||typeof window>"u")return;let R=()=>t.leave();return window.addEventListener("pagehide",R),()=>window.removeEventListener("pagehide",R)},[t]),(0,L.useEffect)(()=>{if(!N||typeof document>"u")return;let R=null,B=X=>{let ie=Lo(X.target);ie!==R&&(R=ie,f(ie))};return document.addEventListener("pointermove",B,{passive:!0}),()=>document.removeEventListener("pointermove",B)},[N]);let ue=(0,L.useRef)(null),K=S?m.get(S)??null:null,oe=(0,L.useCallback)(R=>{ue.current=null,v(R)},[]);(0,L.useEffect)(()=>{if(S){if(!K){v(null);return}K.stop!==ue.current?.stop&&(ue.current={stop:K.stop,at:Date.now()},c(Je(K.stop)))}},[S,K,c]),(0,L.useEffect)(()=>{let R=ue.current;!S||R===null||Date.now()-R.at<400||co(o,Je(R.stop))||v(null)},[o,S]),(0,L.useEffect)(()=>{if(!S||typeof document>"u")return;let R=B=>{B.key==="Escape"&&v(null)};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[S]);let Re=_!==null,re=(0,L.useMemo)(()=>Re?{participant:V,name:E}:null,[Re,V,E]);return(0,L.useMemo)(()=>({who:m,sharing:re,following:K,follow:oe,sayWhere:x,sayCaret:Ae}),[m,re,K,oe,Ae])}var U=H(W(),1);function Jo(e){return Ue(e.author)}function Vi(e,t){return e.length>1?"co-edited":t==="rule"?"rule":t==="agent"?"autonomous":"directed"}function Qo(e,t,n,o,r){let i=new Map;for(let[l,c]of e)o-c.at<r&&i.set(l,c);let a=new Set(n.flatMap(l=>l.nodeIds)),s=(l,c,u)=>{let g=i.get(l),y=g?.participants.includes(Jo(c))?g.participants:[...g?.participants??[],Jo(c)];i.set(l,{at:o,manner:Vi(y,c.author.kind),intent:c.intent,wrote:(g?.wrote??!1)||(u.wrote??!1),read:(g?.read??!1)||(u.read??!1),broke:(g?.broke??!1)||a.has(l),participants:y})};for(let l of t){for(let c of l.writes)s(c,l,{wrote:!0});for(let c of l.reads)l.writes.includes(c)||s(c,l,{read:!0})}for(let l of n)for(let c of l.nodeIds){let u=i.get(c);i.set(c,{at:o,manner:u?.manner??"rule",intent:u?.intent??l.message,wrote:u?.wrote??!1,read:u?.read??!1,broke:!0,participants:u?.participants??["rule::"]})}return i}var Ii=2600;function er(e,t=Ii){let[n,o]=(0,U.useState)(()=>new Map),r=(0,U.useRef)(n);r.current=n;let i=(0,U.useRef)(null),a=(0,U.useCallback)(l=>{r.current=l,o(l),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{r.current=new Map,o(new Map)},t)},[t]);(0,U.useEffect)(()=>{let l=e.violations(),c=e.subscribe((u,g)=>{let y=e.violations(),m=io(e.allInvariants(),l,y).introduces;l=y,a(Qo(r.current,g,m.map(b=>({nodeIds:b.nodeIds,message:b.message})),Date.now(),t))});return()=>{c(),i.current&&clearTimeout(i.current)}},[e,t,a]);let s=(0,U.useCallback)(l=>{l.reads.length!==0&&a(Qo(r.current,[Li(l)],[],Date.now(),t))},[t,a]);return{activity:n,noteAttention:s}}function Li(e){return{id:`attention:${e.intent}`,seq:-1,batch:"attention",author:e.author,intent:e.intent,mutation:null,primitives:[],reads:e.reads,writes:[],at:new Date().toISOString()}}var d=H(W(),1);function tr(){let e=null,t=new Set,n=new Set,o=r=>{for(let i of n)i(r)};return{subscribe(r){return t.add(r),t.size===1&&o(!0),()=>{t.delete(r),t.size===0&&(e=null,o(!1))}},snapshot:()=>e,set(r){if(!(e===r||e&&r&&e.x===r.x&&e.y===r.y)){e=r;for(let i of t)i()}},get listeners(){return t.size},onActive(r){return n.add(r),()=>void n.delete(r)}}}var lt=H(W(),1),_i=e=>e.definitions.some(t=>Xn(t).size>0);function nr(e,t,n){let[o,r]=(0,lt.useState)(void 0),i=(n.roles??[]).join("\0");return(0,lt.useEffect)(()=>{if(!t||!_i(e.schema)){r(void 0);return}let a=!0,s=!1,l=e.graph,c=()=>{s||(s=!0,queueMicrotask(()=>{s=!1,a&&e.reread()}))},u=Jn(t,{kind:n.kind,...n.id===void 0?{}:{id:n.id},...n.roles?{roles:n.roles}:{}},c);return kt(l,u.read),r(u),e.reread(),()=>{a=!1,kt(l,void 0)}},[e,t,n.kind,n.id,i]),o}function or(){let e=!1,t=new Set;return{moving:()=>e,set(n){if(n!==e){e=n;for(let o of t)o()}},subscribe(n){return t.add(n),()=>t.delete(n)}}}var te=H(De(),1),Hi="graview:place-menu",Ne=(0,d.createContext)(null),sr=(0,d.createContext)("scene");function Di({mode:e,children:t}){return(0,te.jsx)(sr.Provider,{value:e,children:t})}function Ni(){return(0,d.useContext)(sr)}var lr={kind:"human"},ji=[],Wi=[],Gi=[],Yt=[];function dr(e,t){let n=(0,d.useId)();(0,d.useEffect)(()=>{if(!globalThis.__graviewWatch)return;let o=t??lr,r=()=>ro(e,o,n);r();let i,a=e.subscribe(()=>{clearTimeout(i),i=setTimeout(r,250)});return()=>{clearTimeout(i),a(),globalThis.__graviewWatch?.unseen?.({words:[],from:n,gone:!0})}},[e,t,n])}var Fi=()=>{try{return typeof location<"u"&&new URLSearchParams(location.search).get("as")==="published"?"published":void 0}catch{return}},Ki={off:!0};function Bi({store:e,views:t,initialView:n,scheme:o="dark",initialSelection:r,principal:i,as:a,seats:s=ji,onSeat:l,people:c=Wi,memory:u,presenceTtlMs:g,app:y,settings:m=y?.settings??Gi,presence:b,typing:k,brand:f,locale:S,timeZone:v,onKeepLens:A,providers:x,ai:F,files:D,resolveApp:N,history:V,linkedRecords:E,menuSections:I,keptViews:_,onExport:We,subscriptions:Pe,dismissals:Ae,whileAway:ke,signIn:ue,view:K,onViewChange:oe,children:Re}){let re=(0,d.useContext)(Ne),R=I??re?.menuSections,B=ue??re?.signIn,X=_??re?.keptViews,ie=We??re?.onExport,[_r,Hr]=(0,d.useState)(null),ce=_r??i??s[0]?.principal??lr,Ge=Kt(e,ce,V),fn=Ge.past&&Ge.live===e?Ge.past.store:e,wt=a??Fi(),vt=!Ft(e),j=(0,d.useMemo)(()=>vt?e:fn.seenBy(ce,wt?{as:wt}:void 0),[vt,e,fn,ce,wt]);dr(e,ce);let[ae]=(0,d.useState)(()=>Yo(u)),[yn,Dr]=(0,d.useState)(!1),mn=(0,d.useCallback)(()=>Dr(!0),[]),se=(0,d.useMemo)(()=>b?[...m,...Zo]:m,[m,b]),[bt]=(0,d.useState)(()=>n??Qt(t,e.schema)),[Nr,gn]=(0,d.useState)(()=>Qe(bt??fe,r??bt?.selection??[])),Te=(0,d.useRef)(bt??fe).current,[hn,jr]=(0,d.useState)(null),[Sn,Wr]=(0,d.useState)(null),Z=(0,d.useContext)(Ne),[wn]=(0,d.useState)(()=>Z?.seatTalk??Wt(f?.name??e.schema.kinds.join(","))),xt=F??Z?.ai??Vt,Fe=(0,d.useMemo)(()=>xt.off?Ki:xt,[xt]),vn=(0,d.useRef)(Fe.interactions);vn.current=Fe.interactions;let[bn]=(0,d.useState)(()=>Z?.aiDesk??Gt(()=>vn.current)),[Gr]=(0,d.useState)(()=>Z?.subscriptions??oo()),xn=Pe??Z?.subscriptions??Gr,Et=A??Z?.onKeepLens,Ke=y??Z?.app,Be=S??Z?.locale,Fr=f?.locale??Ke?.brand?.locale,qe=v??Z?.timeZone;Zn({reader:Be,app:Fr,readerTimeZone:qe,appTimeZone:f?.timeZone??Ke?.brand?.timeZone});let En=(0,d.useRef)(null),Pn=(0,d.useCallback)(p=>{En.current=p},[]),An=(0,d.useCallback)(p=>En.current?.whereIs(p)??null,[]),[kn]=(0,d.useState)(()=>tr()),[Rn]=(0,d.useState)(()=>or()),[Pt,Kr]=(0,d.useState)(null),[Me,Tn]=(0,d.useState)(()=>new Map),Ce=(0,d.useRef)(Me);Ce.current=Me;let Oe=(0,d.useRef)(null),At=(0,d.useCallback)(p=>j.graph.getNode(p)?.kind,[j]),J=(0,d.useCallback)(p=>{let h=zt(Ce.current,p,At);Ce.current=h,Tn(h),Oe.current&&clearTimeout(Oe.current),[...h.values()].some(C=>C.mode!=="docked"&&C.mode!=="asking")&&(Oe.current=setTimeout(()=>{let C=zt(Ce.current,{type:"rest",at:Date.now(),holdMs:Jt},At);Ce.current=C,Tn(C)},Jt+20))},[At]),Mn=(0,d.useCallback)(p=>J({...p,at:p.at??Date.now()}),[J]),Cn=(0,d.useCallback)(p=>{Kr(p),p&&J({type:"home",author:{kind:"agent",id:p,session:ae},at:Date.now()})},[J,ae]);(0,d.useEffect)(()=>j.subscribe((p,h)=>{for(let T of h)T.author.kind==="agent"&&J({type:"write",author:T.author,ids:T.writes,at:Date.now()})}),[j,J]),(0,d.useEffect)(()=>()=>{Oe.current&&clearTimeout(Oe.current)},[]);let $=(0,d.useMemo)(()=>({...ce,session:ae}),[ce,ae]),On=nr(j,E,$),Vn=(0,d.useCallback)(p=>{Hr(p),l?.(p)},[l]),[Ve,Br]=(0,d.useState)(()=>Object.fromEntries(se.map(p=>[p.name,Bo(p,u)])));(0,d.useEffect)(()=>{for(let p of se)zo(p,Ve[p.name]??p.initial)},[se,Ve]);let In=(0,d.useCallback)((p,h)=>{let T=se.find(C=>C.name===p);!T||!T.options.some(C=>C.value===h)||(qo(T,h,u),Br(C=>({...C,[p]:h})))},[se,u]),[Ln,qr]=(0,d.useState)(null),{activity:_n,noteAttention:Hn}=er(j),Dn=(0,d.useCallback)(p=>{Hn(p),J({type:"read",author:p.author,ids:p.reads,at:Date.now()})},[Hn,J]),pe=(0,d.useCallback)(p=>{if(me(p)!==null||de(p).length>0||Ct(p))return!0;let h=po(p);return h?j.graph.allEdges().some(T=>T.kind===h.kind&&T.from===h.from&&T.to===h.to):j.graph.getNode(p)!==void 0},[j]),Nn=(0,d.useCallback)(p=>{let h=p.selection??Yt,T=h.filter(pe),C=T.length===h.length?p:Qe(p,T);return C.focusId!==null&&!pe(C.focusId)&&(C=z(C,null)),C},[pe]),Ie=(0,d.useCallback)(p=>{let h=Nn(p),T=ar(j,$,h.shown);if(h.focusId!==null&&T.size>0){let C=de(h.focusId),Yn=j.graph.getNode(h.focusId);(C.length>0?C.every(Ur=>T.has(Ur)):Yn?T.has(Yn.kind):!1)&&(h={...h,focusId:null})}if(!h.overview&&h.focusId===null){let C=Te.focusId!==null&&!pe(Te.focusId)?Qt(t,e.schema)??{...fe,overview:!0}:Te;C.focusId!==null&&pe(C.focusId)?h={...h,focusId:C.focusId}:C.overview===!0&&(h={...h,overview:!0})}return h},[Nn,pe,j,Te,$,t,e.schema]),q=Ie(K??Nr),jn=(0,d.useMemo)(()=>ar(j,$,q.shown),[j,$,q.shown]),Wn=(0,d.useMemo)(()=>[...j.modules.administered.entries()].map(([p,h])=>{let T=j.mayAdminister(p,$);return{name:p,...h.description?{description:h.description}:{},kinds:h.kinds??[],canShow:T,shown:T&&(q.shown??[]).includes(p)}}),[j,$,q.shown]),Le=(0,d.useCallback)(p=>{let h=T=>Ie(typeof p=="function"?p(T):p);if(K!==void 0){oe?.(h(K));return}oe&&oe(h(q)),gn(T=>h(T))},[q,oe,K,Ie]);(0,d.useEffect)(()=>{K===void 0&&gn(p=>{let h=Ie(p);return h===p?p:h})},[q,K,Ie]);let Gn=q.selection??Yt,Fn=(0,d.useCallback)(p=>{Le(h=>Qe(h,typeof p=="function"?p(h.selection??Yt):p))},[Le]),{who:ze,following:Kn,follow:Bn,sayWhere:zr,sayCaret:qn,sharing:zn}=Xo({channel:b,store:j,view:q,principal:$,session:ae,robots:Me,seatWho:Pt,settingValues:Ve,setView:Le,seats:s,people:c,...g!==void 0?{ttlMs:g}:{}}),$r=(0,d.useMemo)(()=>({store:j,scheme:o,views:t,view:q,setView:Le,homeView:Te,selection:Gn,setSelection:Fn,menuAt:hn,setMenuAt:jr,whereIs:An,pointer:kn,motion:Rn,registerScene:Pn,robots:Me,noteSeat:Mn,seatWho:Pt,registerSeatWho:Cn,actsDoor:Sn,registerActsDoor:Wr,seatTalk:wn,aiDesk:bn,...u?{memory:u}:{},who:ze,following:Kn,follow:Bn,sayWhere:zr,sharing:zn,session:ae,ai:Fe,resolveApp:N,linkedRecords:E,menuSections:R,...X?{keptViews:X}:{},...ie?{onExport:ie}:{},subscriptions:xn,dismissals:Ae,whileAway:ke,signIn:B,linkedReads:On,movedByHand:yn,noteMoved:mn,emphasis:Ln,setEmphasis:qr,activity:_n,noteAttention:Dn,principal:$,seats:s,people:c,takeSeat:Vn,settings:se,settingValues:Ve,chooseSetting:In,hiddenKinds:jn,administered:Wn,...x?{providers:x}:{},...f?{brand:f}:{},...Et?{onKeepLens:Et}:{},app:Ke,...Be?{locale:Be}:{},...qe?{timeZone:qe}:{}}),[j,o,t,q,Le,Gn,Fn,hn,An,kn,Rn,Pn,Me,Mn,Pt,Cn,Sn,wn,bn,u,ze,Kn,Bn,zn,ae,Fe,N,E,R,X,ie,xn,Ae,ke,B,On,yn,mn,Ln,_n,Dn,$,s,c,Vn,se,Ve,In,jn,Wn,x,f,Et,Ke,Be,qe]),$n=(0,d.useMemo)(()=>k?{typing:k,sayCaret:qn,who:ze}:null,[k,qn,ze]),Un=D?(0,te.jsx)(it.Provider,{value:D,children:Re}):Re;return(0,te.jsx)(Ne.Provider,{value:$r,children:(0,te.jsx)(He.Provider,{value:Ge,children:(0,te.jsx)(Yi,{children:vt?null:$n?(0,te.jsx)(Bt.Provider,{value:$n,children:Un}):Un})})})}var ur=(0,d.createContext)(null),Zt,Xt=new Set,qi=e=>(Xt.add(e),()=>void Xt.delete(e)),rr=()=>Zt;function zi(e){if(!Zt){Zt=e;for(let t of[...Xt])t()}}var $i=300;function Ui(e){let t=0;return async(n,o)=>{let r=++t;return await new Promise(i=>setTimeout(i,$i)),r===t?e(n,o):[]}}function Yi({children:e}){let{store:t,view:n,views:o,principal:r,hiddenKinds:i,selection:a,ai:s}=ne(),l=dt(),c=n.q,u=n.focusId,g=!!(c&&c.trim().length>0),y=(0,d.useSyncExternalStore)(qi,rr,rr),m=(0,d.useMemo)(()=>g&&y?{flagged:new Set(t.violations().flatMap(A=>A.nodeIds)),touched:y.touchWeights(t.log.all())}:null,[t,l,g,y]),b=u?t.graph.getNode(u)?.kind??me(u)??(de(u).length===1?de(u)[0]:void 0):void 0,k=(0,d.useMemo)(()=>s.near&&Ui(s.near),[s.near]),f=(0,d.useMemo)(()=>!c||!m||!y?null:y.search(t,c,{...b?{inKind:b}:{},principal:r,places:o.places(),kinds:t.schema.kinds.filter(A=>!i.has(A)),from:[...a,...u&&t.graph.has(u)?[u]:[]],flagged:m.flagged,touched:m.touched,limit:200,rank:k}),[t,c,r,o,i,a,u,b,m,k]),[S,v]=(0,d.useState)();return(0,d.useEffect)(()=>void f?.later?.then(A=>v([f,A])),[f]),(0,te.jsx)(ur.Provider,{value:S?.[0]===f?S[1]:f,children:e})}var ir=new WeakMap;function Gs(e){let t=ir.get(e);return t||ir.set(e,t=new Set(e.matched)),t}function Zi(){return(0,d.useContext)(ur)}function ne(){let e=(0,d.useContext)(Ne);if(!e)throw new Error("useGraview must be used inside a <GraviewProvider>.");return e}function en(){return(0,d.useContext)(Ne)??null}function dt(){let{store:e}=ne(),t=(0,d.useRef)(null),n=(0,d.useRef)(null),o=(0,d.useCallback)(()=>(n.current!==e&&(n.current=e,t.current=null),t.current??=e.graph.allNodes(),t.current),[e]),r=(0,d.useCallback)(i=>e.subscribe(()=>{t.current=null,i()}),[e]);return(0,d.useSyncExternalStore)(r,o,o)}function Xi(e){let{store:t}=ne(),n=(0,d.useCallback)(r=>t.subscribe(r),[t]),o=(0,d.useCallback)(()=>e===null?void 0:t.graph.getNode(e),[t,e]);return(0,d.useSyncExternalStore)(n,o,o)}function ar(e,t,n){let o=new Set(e.modules.disabledKinds);for(let r of e.kindsKeptFrom(t))o.add(r);for(let[r,i]of e.modules.administered)if(!(e.mayAdminister(r,t)&&(n??[]).includes(r)))for(let a of i.kinds??[])o.add(a);return o}var Jt=2600;var cr=new WeakSet,Ji=e=>cr.has(e),Qi=e=>void cr.add(e);function Qt(e,t){let n=so(e.arrangement?.()?.first,t,e.places());if(!(!n||n.to==="home"))return n.to==="place"?{...fe,focusId:ee(n.place.kind),within:{view:n.place.as}}:{...fe,focusId:ee(n.kind)}}var pr=H(W(),1),ea=(0,pr.createContext)(!1);var ut=Symbol.for("graview.default-view");function fr(e){return Object.defineProperty(e,ut,{value:!0,enumerable:!1}),e}function yr(e){return typeof e=="function"&&e[ut]===!0}var ct=Symbol.for("graview.replaces-page");function mr(e){return Object.defineProperty(e,ct,{value:!0,enumerable:!1}),e}function gr(e){return typeof e=="function"&&e[ct]===!0}var pt=Symbol.for("graview.bleeds");function hr(e){return Object.defineProperty(e,pt,{value:!0,enumerable:!1}),e}function Sr(e){return typeof e=="function"&&e[pt]===!0}var ft=Symbol.for("graview.previews");function wr(e,t={}){return Object.defineProperty(e,ft,{value:t,enumerable:!1}),e}function vr(e){return typeof e=="function"?e[ft]:void 0}function ta(e){return ao(e)}function na(e,t){if(t===e)return e;for(let r of t.registrations())e.register(r.kind,r,r.view,r);let n=t.arrangement?.();n&&e.arrange?.(n);let o=t.homes?.()??[];if(o.length>0)for(let r of o)e.home?.(r.view,r.name!==void 0?{name:r.name}:void 0);else{let r=t.homeView?.();r&&e.home?.(r)}return e}var M=H(W(),1),Y=H(De(),1),tn=new Set,yt=0;function nn(e){return()=>{yt+=1;let t=e();return t.then(()=>void(yt-=1),()=>void(yt-=1)),t}}var oa=()=>yt,gt=(0,M.createContext)(null);function ra(){return{waiting:new Map,at:0}}function ia(e){for(let[t,n]of e.waiting)n<e.at&&e.waiting.delete(t);e.at+=1}var aa=e=>e?.waiting.size??0;function Er(e,t){e?.waiting.set(t,e.at)}function Pr(e){let t=(0,M.useContext)(gt);(0,M.useLayoutEffect)(()=>{t?.waiting.delete(e)},[t,e])}function sa(e){let t={},n=!1,o=new Set,r=(0,M.lazy)(nn(()=>e().then(a=>{n=!0;let s=a.default;function l(c){return Pr(t),(0,M.createElement)(s,c)}return{default:l}},a=>{for(let s of o)s.waiting.delete(t);throw a})));function i(a){let s=(0,M.useContext)(gt);return!n&&s&&(o.add(s),Er(s,t)),(0,M.createElement)(r,a)}return i}var Ar=!1,kr=!1,mt=new Set;function la(){Ar=!0}function da(){kr=!0;for(let e of[...mt])e();mt.clear()}var Rr=()=>kr||!Ar;function ua(e){return Rr()?(e(),()=>{}):(mt.add(e),()=>void mt.delete(e))}var br=!1;function on(){for(let e of[...tn])e()}function ca(){br||typeof window>"u"||(br=!0,window.addEventListener("online",on))}function rn(e){let t,n=!1,o=!1,r,i=0,a=new Set,s=()=>{i+=1;for(let y of[...a])y()},l=y=>(a.add(y),()=>void a.delete(y)),c=()=>i,u=()=>void g().catch(()=>{});function g(){if(n)return Promise.resolve(t);if(r)return r;let y=e().then(m=>(t=m,n=!0,o=!1,r=void 0,tn.delete(u),s(),m),m=>{throw r=void 0,o=!0,tn.add(u),ca(),s(),m});return y.catch(()=>{}),r=y,y}return{load:g,prefetch:u,get current(){return t},get failed(){return o},part(y,m={}){let b=m.what??"This part",k={};function f(A){(0,M.useSyncExternalStore)(l,c,c),Pr(k);let x=(0,M.useRef)(null),F=(0,M.useRef)(null),D=(0,M.useRef)(!1);return(0,M.useEffect)(()=>{o&&r===void 0&&u()},[]),n&&typeof document<"u"&&x.current!==null&&document.activeElement===x.current&&(D.current=!0),(0,M.useLayoutEffect)(()=>{if(!(!n||!D.current)){D.current=!1;for(let N=F.current?.nextElementSibling??null;N!==null;N=N.nextElementSibling){let V=N.matches(xr)?N:N.querySelector(xr);if(V instanceof HTMLElement){V.focus();return}}}}),n?(0,Y.jsxs)(Y.Fragment,{children:[D.current?(0,Y.jsx)("span",{ref:F,hidden:!0}):null,y(t,A)]}):m.quiet?null:(0,Y.jsx)(pa,{what:b,button:x,...m.as?{as:m.as}:{}})}let S=(0,M.lazy)(nn(()=>g().then(()=>({default:f}),()=>({default:f}))));function v(A){let x=(0,M.useContext)(gt),[F]=(0,M.useState)(()=>n||o);return!n&&!o&&Er(x,k),(0,M.createElement)(F?f:S,A)}return v}}}var xr="button,a[href],input,select,textarea,[tabindex]:not([tabindex='-1'])";function pa({what:e,button:t,as:n="p"}){let r=typeof navigator<"u"&&navigator.onLine===!1?`${e} will load when you're back online.`:`${e} didn't load.`;return(0,Y.jsxs)(n,{"data-testid":"lazy-part-missing",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:[(0,Y.jsx)("span",{role:"status",children:r})," ",(0,Y.jsx)("button",{ref:t,type:"button","data-testid":"lazy-part-retry",onClick:on,style:{font:"inherit",fontWeight:600,color:"var(--graview-ink)",background:"none",border:"1px solid var(--graview-edge)",borderRadius:6,padding:"2px 10px"},children:"Try again"})]})}var we=H(W(),1);function fa(){let{selection:e,setSelection:t}=ne();return(0,we.useMemo)(()=>({selection:e,set:n=>t(n),clear:()=>t([]),toggle:n=>t(o=>o.includes(n)?o.filter(r=>r!==n):[...o,n]),isSelected:n=>e.includes(n)}),[e,t])}function ya(){let{store:e}=ne(),t=dt();return(0,we.useMemo)(()=>ma(e),[e,t])}var Tr=new WeakMap;function ma(e){let t=Tr.get(e);if(!t){let n={violations:null};e.subscribe(()=>{n.violations=null}),Tr.set(e,n),t=n}return t.violations??=e.violations(),t.violations}function ga(){let{view:e,setView:t}=ne();return(0,we.useMemo)(()=>({view:e,url:Q(e),focus:n=>t(o=>z(o,n)),show:n=>t(o=>fo(o,n)),toggle:n=>t(o=>et(o,n)),go:n=>t(n)}),[e,t])}var Se={at:0,depth:0,listeners:new Set,tell(){for(let e of this.listeners)e()}};typeof window<"u"&&window.addEventListener("popstate",e=>{let t=e.state;Se.at=typeof t?.graview=="number"?t.graview:0,Se.at>Se.depth&&(Se.depth=Se.at),Se.tell()});var G=H(W(),1),sn={profile:{trigger:"profile-button",pane:"profile",opens:"press",focus:"into",drawn:["shell","embed"]},problems:{trigger:"standing",pane:"problems",opens:"press",focus:"into",drawn:["shell","embed"]},places:{trigger:"app-places-open",pane:"app-places",opens:"press",focus:"into",drawn:["embed"]},here:{trigger:"here-open",pane:"here-list",opens:"press",focus:"into",drawn:["shell","embed","pages"]},suggested:{trigger:"suggested-button",pane:"suggested",opens:"press",focus:"into",drawn:["shell","embed","pages"]},activity:{trigger:"activity-button",pane:"activity",opens:"press",focus:"into",drawn:["shell","embed","pages"]},find:{trigger:"find-box",pane:"find-strip",opens:"typing",focus:"stays",drawn:["shell"]},districts:{trigger:"beyond-more",pane:"beyond-list",opens:"press",focus:"into",drawn:["shell","embed"]},acts:{trigger:null,pane:"context-menu",opens:"context-menu",focus:"into",drawn:["shell","embed","pages"]},arrange:{trigger:"arrange-add",pane:"arrange-list",opens:"press",focus:"into",drawn:["pages"]},"studio-ask":{trigger:"studio-agent",pane:"studio-agent-panel",opens:"press",focus:"into",drawn:["studio"]}},ha={position:"fixed",inset:"auto",margin:0,zIndex:to("popover"),boxSizing:"border-box"},ht=6,ve=8,Sa=e=>typeof e.showPopover=="function";function St(e){try{return e.matches(":popover-open")}catch{return!1}}function wa(e){if(typeof e=="function"){let o=e();return o?{left:o.x,right:o.x,top:o.y,bottom:o.y}:null}let t=e.current;if(!t||!t.isConnected)return null;let n=t.getBoundingClientRect();return{left:n.left,right:n.right,top:n.top,bottom:n.bottom}}function ln(e,t,n={}){let o=wa(t);if(!o)return;let r={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},i=e.dataset.graviewDesignedHeight??=e.style.maxHeight;e.style.maxHeight=i;let a=e.getBoundingClientRect(),s=r.height-o.bottom-ht-ve,l=o.top-ht-ve,c=a.height<=s||s>=l,u=Math.max(96,Math.floor(c?s:l)),g=Math.min(a.height,u);a.height>u&&(e.style.maxHeight=i?`min(${i}, ${u}px)`:`${u}px`);let y=a.width,m=n.align==="start"?o.left:o.right-y,b=typeof t=="function"?null:t.current?.closest("[data-graview-embed]")?.getBoundingClientRect();b&&y<=b.right-b.left&&(m<b.left?m=o.left+y<=b.right?o.left:b.left:m+y>b.right&&(m=o.right-y>=b.left?o.right-y:b.right-y));let k=y>=r.width-2*ve?Math.max(0,(r.width-y)/2):Math.max(ve,Math.min(m,r.width-ve-y)),f=c?o.bottom+ht:Math.max(ve,o.top-ht-g);e.style.left=`${Math.round(k)}px`,e.style.top=`${Math.round(f)}px`}function Mr(e,t,n,o={}){let r=o.align??"end";(0,G.useLayoutEffect)(()=>{let i=e.current;if(!t||!i)return;if(Sa(i)&&!St(i))try{i.showPopover(),ba()}catch{}let a=0,s=c=>{c?.target instanceof Node&&i.contains(c.target)||(cancelAnimationFrame(a),a=requestAnimationFrame(()=>ln(i,n,{align:r})))};ln(i,n,{align:r}),addEventListener("resize",s),addEventListener("scroll",s,!0);let l=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>s());return l?.observe(i),()=>{if(cancelAnimationFrame(a),removeEventListener("resize",s),removeEventListener("scroll",s,!0),l?.disconnect(),i.isConnected&&St(i))try{i.hidePopover()}catch{}}},[t,e,r])}var dn=new Set;function va(e){return dn.add(e),()=>dn.delete(e)}function ba(){for(let e of dn)if(!(!e.isConnected||!St(e)))try{e.hidePopover(),e.showPopover()}catch{}}var be=null,xa='button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])';function Ea(e){for(let t of e.querySelectorAll(xa))if(t.closest("[hidden]")===null&&getComputedStyle(t).visibility!=="hidden")return t;return e}var an=()=>{let e=document.activeElement;return e===null||e===document.body};function Pa(e,t={}){let{at:n,returnTo:o,onOpenChange:r}=t,i=t.popover!==!1,[a,s]=(0,G.useState)(!1),l=t.open??a,c=(0,G.useRef)(null),u=(0,G.useRef)(null),g=(0,G.useCallback)(v=>{c.current=v},[]),y=(0,G.useCallback)(v=>{u.current=v},[]),m=`graview-popover-${(0,G.useId)().replace(/:/g,"")}`,b=(0,G.useRef)({onOpenChange:r,returnTo:o,controlled:t.open!==void 0});b.current={onOpenChange:r,returnTo:o,controlled:t.open!==void 0};let k=(0,G.useCallback)(v=>{b.current.controlled||s(v),b.current.onOpenChange?.(v)},[]),f=(0,G.useCallback)(()=>{(document.querySelector(`[aria-controls="${m}"]`)??c.current??b.current.returnTo?.()??null)?.focus({preventScroll:!0})},[m]),S=(0,G.useCallback)(v=>{let A=u.current,x=typeof document>"u"?null:document.activeElement,F=x===null||x===document.body||A!==null&&A.contains(x);k(!1),!(!v||!F)&&(f(),requestAnimationFrame(()=>{an()&&f()}))},[k,f]);return Mr(u,i&&l,n??c,t.align?{align:t.align}:{}),(0,G.useEffect)(()=>{if(!i||!l)return;let v={name:e,close:()=>S(!1)};if(be&&be.close!==v.close&&be.close(),be=v,sn[e].focus==="into"){let V=u.current;V&&!V.contains(document.activeElement)&&Ea(V).focus({preventScroll:!0})}let A=V=>{V.key==="Escape"&&S(!0)},x=V=>{let E=V.target;if(!(E instanceof Node))return;let I=u.current;if(I?.contains(E)||c.current?.contains(E))return;let _=E instanceof Element?E.closest('[role="dialog"], [role="alertdialog"]'):null;_&&!(I&&_.contains(I))||(S(!1),sn[e].focus==="into"&&requestAnimationFrame(()=>{(an()||I!==null&&I.contains(document.activeElement))&&f()}))},F=null,D=null,N=V=>{let E=V.target;if(!(E instanceof Element))return;let I=u.current,_=E.closest('[role="dialog"], [role="alertdialog"]');!_||I&&(I.contains(_)||_.contains(I))||(F=_,S(!1))};return document.addEventListener("keydown",A),document.addEventListener("pointerdown",x,!0),document.addEventListener("focusin",N),()=>{document.removeEventListener("keydown",A),document.removeEventListener("pointerdown",x,!0),document.removeEventListener("focusin",N);let V=F;V&&typeof MutationObserver<"u"&&(D?.disconnect(),D=new MutationObserver(()=>{V.isConnected||(D?.disconnect(),requestAnimationFrame(()=>{(an()||document.activeElement.closest("[hidden]")!==null)&&f()}))}),D.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>D?.disconnect(),10*6e4)),be?.close===v.close&&(be=null)}},[i,l,e,S,f]),{open:l,setOpen:v=>v?k(!0):S(!0),toggle:()=>l?S(!0):k(!0),trigger:{ref:g,"aria-expanded":l,"aria-controls":m,"data-graview-popover-trigger":e},pane:{ref:y,id:m,popover:"manual",tabIndex:-1,"data-graview-popover":e,"data-graview-overlay":""}}}var xe=H(W(),1);var Cr=(0,xe.createContext)(null);function Aa(){let e=(0,xe.useContext)(Cr),t=en(),n=(o,r,i)=>t?.setView(a=>le(le(ye(z(a,ee(o)),!1),"view",r),"filter",i?.filter??null));return(0,xe.useMemo)(()=>e??{record:o=>{t&&(t.setView(r=>z(ye(r,!1),o)),t.setSelection([o]))},place:(o,r)=>{let i=t?.views.places().find(a=>a.as===o);i&&n(i.kind,i.as,r)},list:(o,r)=>n(o,null,r)},[e,t])}var Ee=H(W(),1);var ka=rn(Ye(()=>(__graviewPreload(import.meta.url,["./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.IYYP6QUH.js"))));function Ra(e,t,n){let o,r=!1,i=()=>{let{hidden:s,removed:l}=t.current();o||r||s.length+l.length===0||(o=()=>{},ka.load().then(c=>{r||(o=c.watchTidied(e,t,n))},String))};i();let a=t.onChange?.(i);return()=>{r=!0,a?.(),o?.()}}function Ta(e,t){let[n,o]=(0,Ee.useState)();return(0,Ee.useEffect)(()=>t?Ra(e,t,r=>o([e,r])):void 0,[e,t]),n?.[0]===e?n[1]:e}var Or=H(W(),1),Ma=(0,Or.createContext)(!1);var un=H(W(),1),Ca=(0,un.createContext)(null),Oa=(0,un.createContext)(null);var Vr=H(W(),1),Va=(0,Vr.createContext)(null);var Ir=H(W(),1),cn='button:not([disabled]), a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])',pn=e=>e instanceof HTMLElement&&(e.matches(cn)||e.hasAttribute("tabindex")),je=e=>typeof e.checkVisibility=="function"?e.checkVisibility():e.getClientRects().length>0;function Ia(e,t){let n=l=>l.replace(/["\\]/g,"\\$&"),o=t.getAttribute("data-testid"),r=t.getAttribute("data-graview-pick"),i=t.getAttribute("aria-label"),a=o?`[data-testid="${n(o)}"]`:r?`[data-graview-pick="${n(r)}"]`:i?`${t.tagName.toLowerCase()}[aria-label="${n(i)}"]`:null;if(!a)return null;let s=e.querySelector(a);return s&&pn(s)&&je(s)?s:null}var La=e=>e.isConnected&&pn(e)&&!e.matches(":disabled")&&e instanceof HTMLElement&&je(e);function Lr(e,t){let n=t?Ia(e,t):null;if(n)return n;let o=e.querySelector("[data-graview-view][tabindex]");if(o&&je(o))return o;for(let r of e.querySelectorAll(cn))if(je(r))return r;return pn(e)&&je(e)?e:null}function _a(e){(0,Ir.useEffect)(()=>{let t=e.current;if(!t||typeof MutationObserver>"u")return;let n=[],o=f=>{let S=f.target;if(S instanceof Element){n=[];for(let v=S;v&&v!==t.parentElement;v=v.parentElement)n.push(v)}},r=!1,i=!1,a=t.ownerDocument,s=()=>!i&&a.defaultView!==null,l=(f,S)=>void setTimeout(()=>s()&&S(),f),c=f=>void requestAnimationFrame(()=>s()&&f()),u=f=>{if(r=!1,i)return;let S=a.activeElement;if(!(!(S===null||S===a.body||S===a.documentElement)||n.length===0)){if(La(n[0])){f&&n[0]instanceof HTMLElement&&n[0].focus({preventScroll:!0});return}for(let A of n.slice(1)){if(!A.isConnected)continue;let x=Lr(A,n[0]);if(x){x.focus({preventScroll:!0}),n=[];return}}}},g=(f,S=Date.now()+2500)=>{l(100,()=>{u(f);let v=a.activeElement;(v===null||v===a.body||v===a.documentElement)&&n.length>0&&Date.now()<S&&g(f,S)})},y=()=>{r||n.length===0||(r=!0,l(60,()=>c(()=>{u(!1),g(!1)})))},m=f=>{if(!(f instanceof KeyboardEvent&&!["Enter"," ","Escape"].includes(f.key))){if(!(f instanceof KeyboardEvent)){let S=f.target instanceof Element?f.target.closest(cn):null,v=a.activeElement,A=v===null||v===a.body||v===a.documentElement;if(S&&A&&t.contains(S)){n=[];for(let x=S;x&&x!==t.parentElement;x=x.parentElement)n.push(x);l(150,()=>c(()=>{u(!1),g(!1)}));return}}!(f instanceof KeyboardEvent)&&!(f.target instanceof Node&&n[0]?.contains(f.target))||l(150,()=>c(()=>{u(!0),g(!0)}))}},b=new MutationObserver(()=>{n.length>0&&!n[0].isConnected&&y()}),k=f=>{f.relatedTarget===null&&y()};return t.addEventListener("focusin",o),t.addEventListener("focusout",k),t.addEventListener("click",m),t.addEventListener("keydown",m),b.observe(t,{childList:!0,subtree:!0}),()=>{i=!0,t.removeEventListener("focusin",o),t.removeEventListener("focusout",k),t.removeEventListener("click",m),t.removeEventListener("keydown",m),b.disconnect()}},[e])}export{fe as a,Q as b,Je as c,Da as d,Na as e,co as f,uo as g,po as h,Tt as i,z as j,fo as k,le as l,ye as m,Qe as n,_e as o,et as p,nt as q,Mt as r,me as s,Ga as t,Zr as u,ee as v,yo as w,de as x,mo as y,Xr as z,Fa as A,go as B,Ct as C,Jr as D,Qr as E,ei as F,W as G,Wt as H,vi as I,xi as J,Lo as K,it as L,Ei as M,He as N,Ho as O,Pi as P,Ft as Q,Kt as R,Bt as S,De as T,Hi as U,Ne as V,Di as W,Ni as X,dr as Y,Bi as Z,zi as _,Gs as $,Zi as aa,ne as ba,en as ca,dt as da,Xi as ea,Ji as fa,Qi as ga,Qt as ha,Cr as ia,Aa as ja,ea as ka,fr as la,yr as ma,mr as na,gr as oa,hr as pa,Sr as qa,wr as ra,vr as sa,ta,na as ua,nn as va,oa as wa,gt as xa,ra as ya,ia as za,aa as Aa,sa as Ba,la as Ca,da as Da,Rr as Ea,ua as Fa,rn as Ga,Ta as Ha,Ma as Ia,Ca as Ja,Oa as Ka,Va as La,fa as Ma,ya as Na,ga as Oa,Se as Pa,_a as Qa,ha as Ra,St as Sa,Mr as Ta,va as Ua,Pa as Va};
2
- /*! Bundled license information:
3
-
4
- react/cjs/react.production.js:
5
- (**
6
- * @license React
7
- * react.production.js
8
- *
9
- * Copyright (c) Meta Platforms, Inc. and affiliates.
10
- *
11
- * This source code is licensed under the MIT license found in the
12
- * LICENSE file in the root directory of this source tree.
13
- *)
14
-
15
- react/cjs/react-jsx-runtime.production.js:
16
- (**
17
- * @license React
18
- * react-jsx-runtime.production.js
19
- *
20
- * Copyright (c) Meta Platforms, Inc. and affiliates.
21
- *
22
- * This source code is licensed under the MIT license found in the
23
- * LICENSE file in the root directory of this source tree.
24
- *)
25
- */
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk.KJGNLWU3.js";import"./chunk.GVUJCOKD.js";import"./chunk.3ZONBC6L.js";import"./chunk.FWKNR7XF.js";import"./chunk.MDWCX3YU.js";import"./chunk.CB5DGKR5.js";import"./chunk.GKLDSHHH.js";import"./chunk.OCV46AFN.js";import"./chunk.4KTHJY5N.js";import"./chunk.PZ4G5QA5.js";import"./chunk.Y36MLVMT.js";import"./chunk.MPMROUZA.js";import"./chunk.HJCQ6I3S.js";import"./chunk.5C43AM3X.js";import"./chunk.4WH4N4V7.js";import"./chunk.MVRNEC3Y.js";import"./chunk.XZJ6XX5I.js";import"./chunk.4F5M5XZG.js";import"./chunk.LVOL2LEC.js";import"./chunk.3G5DEGFA.js";import"./chunk.OZ4EJ5M6.js";import"./chunk.BOMYLOCX.js";import"./chunk.45HTFSWD.js";import"./chunk.Q6RUTFU3.js";import"./chunk.AZGXBTOQ.js";import"./chunk.AG7CUSSV.js";import"./chunk.C6HBYRGJ.js";import"./chunk.WVUJXDXZ.js";import"./chunk.3V2WXZU3.js";import"./chunk.7UD2JR6J.js";import"./chunk.BUDEUNBN.js";import"./chunk.3IEJQAK7.js";import"./chunk.AKLVSZ5A.js";import"./chunk.ZUBC3UFG.js";import"./chunk.GZHZLJBF.js";import"./chunk.PZWJUQAO.js";import"./chunk.OJGHDWI6.js";import"./chunk.NEJSKMJV.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";export{b as declaredLensView,a as formatFor};
@@ -1 +0,0 @@
1
- import{a as ve,b as qe,c as Ie,d as pe,e as R,f as fe,h as Ve}from"./chunk.JCFYZEMY.js";import{h as Le,i as Ue,j as We}from"./chunk.BUDEUNBN.js";import{a as se,b as ie,c as H,d as Be,e as J,g as ne,h as Ze}from"./chunk.AKLVSZ5A.js";import{c as _e,h as y,i as Ne,j as le}from"./chunk.ZUBC3UFG.js";import{A as Re,Aa as Fe,Ab as zn,Ha as De,Ia as ee,Ja as ce,Rb as Ke,Sb as de,Tb as Me,Ub as Pe,Vb as Te,b as W,c as L,e as xe,f as Ae,g as C,h as S,k as N,kc as Ge,l as X,lc as Ce,m as _,n as Ee,o as U,p as K,r as k,s as Q,t as x,u as A,v as I,w as P,x as n,y as M,z as Z}from"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";var ue=e=>Object.entries(e).map(([s,r])=>[s,Object.keys(ee(r?.edges))]),me=(e,s)=>Me(e,ue(s));function Ye(e){return[...Object.keys(e.acts??{}),...Object.keys(e.kinds).flatMap(s=>Ke(s)),...Pe(ue(e.kinds))]}var V=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function He(e){if(!V(e)||!V(e.kinds))return e;let s;try{let f=Object.fromEntries(Object.entries(e.kinds).map(([z,i])=>[z,V(i)&&V(i.edges)?{edges:i.edges}:{}]));s=Ye({acts:V(e.acts)?e.acts:{},kinds:f})}catch{return e}let r=new Set(s),t=!1,a=f=>{if(typeof f!="string"||r.has(f))return f;let z=Ge(f,s);return z===void 0?f:(t=!0,z)},d=V(e.policy)&&Array.isArray(e.policy.grants)?{...e.policy,grants:e.policy.grants.map(f=>V(f)&&Array.isArray(f.mutations)?{...f,mutations:f.mutations.map(a)}:f)}:void 0,u=V(e.rules)?Object.fromEntries(Object.entries(e.rules).map(([f,z])=>[f,V(z)&&Array.isArray(z.repairs)?{...z,repairs:z.repairs.map(i=>V(i)?{...i,act:a(i.act)}:i)}:z])):void 0;return t?{...e,...d?{policy:d}:{},...u?{rules:u}:{}}:e}function ge(e,s){let r=Ce(e,Ye(s));return r&&r!==e?`did you mean "${r}"?`:void 0}var he="graview-document",be=1,ke=256*1024,te=64*1024,ze=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ye=/^[a-z][A-Za-z0-9]*$/,yn=new Set(["id","kind"]),hn=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,bn=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"];function kn(){let e=$=>$ in Object.prototype,s=Z($=>!e($),"every object already has this name \u2014 choose another"),r=($,q)=>[...$===void 0?[]:[Ae($)],...q===void 0?[]:[xe(q)]],t=($,q)=>S().check(...r($,q)),a=($,q,gn)=>K($).check(...r(q,gn)),d=$=>S().check(C(ze,`${$} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),u=S().check(C(hn,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),s),f=S().check(C(ye,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),Z($=>!yn.has($),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),s),z=t(1,500),i=t(1,2e3),o=t(1,300),p=k({type:I(bn),required:n(_()),description:n(z),label:n(t(1,60)),options:n(a(t(1,80),1,100)),of:n(I(["string","number","date","image","video","file"])),default:n(U()),unit:n(t(void 0,12)),format:n(I(["money","percent","duration","markdown"])),min:n(N()),max:n(N()),step:n(N()),renamedFrom:n(S().check(C(ye))),repeats:n(_()),collaborative:n(_())}).check(Re(($,q)=>{$.type==="enum"&&!$.options&&q.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),$.type!=="enum"&&$.options&&q.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]}),$.type!=="list"&&$.of&&q.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),$.repeats&&$.type!=="date"&&$.type!=="datetime"&&q.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),w=S().check(C(new RegExp(`${ze.source}|${Fe.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),m=k({to:x([a(w,1),P("*")]),cardinality:n(I(["one","many"])),description:n(z),inverse:n(t(1,80)),appendOnly:n(_()),renamedFrom:n(S()),tidying:n(P("never"))}),l=x([i,k({expr:i,label:n(t(1,60)),description:n(z)})]),c=k({noun:n(t(1,40)),plural:n(t(1,40)),description:n(z),fields:A(f,p).check(Z($=>Object.keys($).length>0,"a kind has at least one field")),label:n(o),describe:n(o),lifecycle:n(k({field:f,retired:a(x([S(),N(),_()]),1)})),figure:n(t(void 0,2e4)),glance:n(a(f,1,20)),page:n(k({fields:n(a(f,1,40)),groups:n(a(k({title:t(1,60),fields:a(f,1,40)}),1,12))})),edges:n(A(u,m)),computed:n(A(S(),l).check(Z($=>Object.keys($).length<=20,"a kind works out at most 20 computed fields"))),fieldRoles:n(A(S(),S())),renamedFrom:n(S().check(C(ze))),people:n(_()),archives:n(P(!1)),tidying:n(I(["never","no-links"]))}),O=x([S(),N(),_(),Ee(),K(U()),k({expr:i})]),h=S().check(C(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),j=x([k({create:d("kind"),as:n(S().check(C(ye))),set:n(A(f,O))}),k({set:A(f,O),target:n(h)}),k({connect:u,from:h,to:h}),k({sever:u,from:h,to:h}),k({remove:h})]),E=k({title:n(t(1,80)),description:n(z),fromTheOtherEnd:n(t(1,80)),on:n(x([d("kind"),a(d("kind"),1)])),creates:n(d("kind")),sets:n(A(f,O)),writes:n(a(f,1)),connects:n(u),severs:n(u),setsOther:n(A(f,O)),replaces:n(x([P(!0),a(u,1,10)])),removes:n(P(!0)),args:n(A(f,p)),effects:n(a(j,1,20)),allowedWhen:n(i),refusal:n(o),destructive:n(_())}),b=k({act:d("act"),label:n(t(1,80)),args:n(A(S(),O))}),G=k({title:n(t(1,120)),description:n(z),over:x([P("graph"),d("kind")]),when:n(i),require:i,says:n(o),repairs:n(a(b,void 0,10))}),F=k({roles:x([a(d("role"),1),P("*")]),mutations:x([a(d("act"),1),P("*")]),kinds:n(x([K(d("kind")),P("*")])),describe:n(z),self:n(_()),ownEnd:n(_())}),g=n(a(d("field"),1)),v=k({roles:x([a(d("role"),1),P("*")]),kinds:a(d("kind"),1),own:n(_()),via:n(u),fields:g,hide:g}),D=k({grants:K(F),sees:n(K(v))}),oe=k({accent:n(S().check(C(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),ground:n(x([S().check(C(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"')),k({light:n(S().check(C(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"'))),dark:n(S().check(C(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#101826"')))})])),name:n(t(1,60)),currency:n(S().check(C(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:n(t(2,35)),timeZone:n(t(1,64)),logo:n(x([t(1,te),k({src:t(1,te),alt:n(t(1,120))}),k({light:t(1,te),dark:n(t(1,te)),alt:n(t(1,120)),darkFallback:n(P("invert"))})])),favicon:n(x([t(1,te),k({emoji:S()})])),typography:n(k({display:n(t(1,200)),body:n(t(1,200)),mono:n(t(1,200))})),shape:n(k({radius:n(N().check(L(0),W(32))),density:n(N().check(L(.75),W(1.5)))})),accents:n(A(S(),N().check(L(0),W(360)))),scheme:n(I(["light","dark","auto"])),subtitle:n(P(!1))}),B=A(S(),U()),Y=x([t(1,120),k({by:t(1,120),direction:n(I(["asc","desc"]))})]),je=N().check(X(),L(1),W(9999)),dn=Q({create:n(_()),options:n(Q({sort:n(Y),columnSort:n(Y),search:n(a(t(1,120),void 0,40)),filters:n(a(t(1,120),void 0,40)),horizon:n(x([N().check(X(),L(1),W(200)),Q({years:N().check(X(),L(1),W(200)),title:t(1,80),from:n(je),to:n(je)})]))}))}),ln=k({card:n(K(U())),row:n(K(U())),page:n(K(U()))}),pn=()=>{let $=n(I(["asc","desc"]));return x([t(1,120),k({by:t(1,120),direction:$,then:n(x([t(1,120),k({by:t(1,120),direction:$})]))})])},fn=()=>x([t(1,120),k({by:t(1,120),order:n(a(t(1,80),void 0,40)),closed:n(a(t(1,80),void 0,40))})]),Oe=Q({order:n(K(S())),hide:n(K(S())),first:n(S()),primary:n(a(t(1,80),void 0,40)),scene:n(t(1,40)),pages:n(t(1,40)),lists:n(A(S(),k({filters:n(a(t(1,120),void 0,40)),sort:n(pn()),group:n(fn()),export:n(_())})))}),un=k({act:d("act"),title:n(t(1,80)),intro:n(z),fields:n(a(f,1,40)),say:n(z),submit:n(t(1,80)),role:n(d("role"))}),mn=k({$schema:n(S()),format:P(he),formatVersion:P(be),name:t(1,80),description:n(z),version:n(N().check(X(),L(1))),kinds:A(d("kind"),c).check(Z($=>Object.keys($).length>0,"a document declares at least one kind"),Z($=>Object.keys($).length<=40,"a document declares at most 40 kinds")),computed:n(A(S(),l)),acts:n(A(d("act"),E)),rules:n(A(d("rule"),G)),roles:n(K(d("role"))),policy:n(D),modules:n(B),lenses:n(K(dn)),pages:n(Oe),views:n(A(S(),x([ln,K(U())]))),brand:n(oe),settings:n(K(B)),migrations:n(K(B)),connections:n(A(d("connection"),B)),forms:n(A(d("form"),un)),publishing:n(k({mode:I(["live","on-publish"]),working:a(d("role"),void 0,40),publishers:n(a(d("role"),1,40))}))});return{FieldSpec:p,EdgeSpec:m,ComputedSpec:l,KindSpec:c,ValueSpec:O,EffectSpec:j,ActSpec:E,RepairSpec:b,RuleSpec:G,GrantSpec:F,SightSpec:v,PolicySpec:D,BrandSpec:oe,PagesSpec:Oe,DocumentSpec:mn}}var $n,T=()=>$n??=kn(),Nn=M(()=>T().FieldSpec),qn=M(()=>T().EdgeSpec),In=M(()=>T().ComputedSpec),Vn=M(()=>T().KindSpec),Bn=M(()=>T().ValueSpec),Ln=M(()=>T().EffectSpec),Un=M(()=>T().ActSpec),Wn=M(()=>T().RepairSpec),Zn=M(()=>T().RuleSpec),Yn=M(()=>T().GrantSpec),Hn=M(()=>T().SightSpec),Jn=M(()=>T().PolicySpec),Xn=M(()=>T().BrandSpec),Qn=M(()=>T().PagesSpec),Je=M(()=>T().DocumentSpec);var wn={};function Xe(e,s=wn,r=be){let{document:t,respelled:a}=ve(e),d=a.length>0?{respelled:a}:{};if(!t||typeof t!="object"||Array.isArray(t))return{document:t};let u=t;if(u.format!==he||typeof u.formatVersion!="number"||u.formatVersion>=r)return{document:t,...d};let f=u.formatVersion,z=structuredClone(u);for(let i=f;i<r;i++){let o=s[i];if(!o)throw new Error(`there is no upgrade from format ${i} to ${i+1}`);z={...o(z),formatVersion:i+1}}return{document:z,from:f,...d}}function Qe(e,s,r){let t=Object.keys(e).filter(f=>e[f].edges?.[s]!==void 0);if(t.length===0)return;let a=t.map(f=>e[f].edges[s].to),d=a.some(f=>f==="*")?"*":[...new Set(a.flatMap(f=>f))];if(r.length===0||r.some(f=>t.includes(f)))return{reversed:!1,kinds:d};let u=t.filter(f=>{let z=e[f].edges[s].to;return z==="*"||r.every(i=>z.includes(i))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:d}}var tn=(e,s)=>{let r=e?.fields[s];return r!==void 0&&(r.type==="duration"||(r.type==="number"||r.type==="integer")&&r.format==="duration")};function en(e,s,r,t){if(t==="out"){let a=e[s]?.edges?.[r]?.to;return a===void 0?[]:a==="*"?Object.keys(e):a}return Object.entries(e).filter(([,a])=>{let d=a.edges?.[r]?.to;return d!==void 0&&(d==="*"||d.includes(s))}).map(([a])=>a)}function $e(e,s,r){if(r.t==="ident")return e[s]?.edges?.[r.name]?en(e,s,r.name,"out"):void 0;if(r.t==="where")return $e(e,s,r.set);if(r.t==="call"&&(r.fn==="out"||r.fn==="in")&&r.args[0]?.t==="lit"&&typeof r.args[0].value=="string")return en(e,s,r.args[0].value,r.fn)}var nn=(e,s,r)=>{let t=s.filter(a=>e[a]?.fields[r]!==void 0);return t.length>0&&t.every(a=>tn(e[a],r))};function on(e,s,r){let t=e.kinds,a=t[s],d=new Map(r),u=new Map,f=(i,o)=>{if(o>8)return!1;switch(i.t){case"ident":return tn(a,i.name)||z(i.name,o+1);case"member":{let p=$e(t,s,i.object);return p!==void 0&&nn(t,p,i.name)}case"call":{if(i.fn!=="sum"&&i.fn!=="min"&&i.fn!=="max")return!1;let[p,w]=i.args,m=p&&$e(t,s,p);return m!==void 0&&w?.t==="ident"&&nn(t,m,w.name)}case"binary":return(i.op==="+"||i.op==="-")&&f(i.left,o)&&f(i.right,o);case"unary":return i.op==="-"&&f(i.operand,o);default:return!1}},z=(i,o)=>{if(a?.computed?.[i]===void 0)return!1;if(u.has(i))return u.get(i);u.set(i,!1);let p=d.get(i),w=p!==void 0&&f(p,o);return u.set(i,w),w};return r.map(([i])=>i).filter(i=>z(i,0))}function sn(e,s,r=`kinds.${e}.page`){let t=s.page;if(!t)return[];let a=[],d=[...Object.keys(s.fields),...Object.keys(s.computed??{})],u=new Set,f=(i,o)=>{d.includes(i)?u.has(i)&&a.push(y("page-field-twice",o,`"${i}" is on ${e}'s page twice; name each field once`)):a.push(y("page-field",o,`${e}'s page is to show "${i}", and ${e} has no field or computed field called that`,`use one of: ${d.join(", ")}`)),u.add(i)};(t.fields??[]).forEach((i,o)=>f(i,`${r}.fields.${o}`));let z=new Set;return(t.groups??[]).forEach((i,o)=>{let p=i.title.trim().toLowerCase();z.has(p)&&a.push(y("page-group-twice",`${r}.groups.${o}.title`,`${e}'s page has two groups called "${i.title}"; give each its own title`)),z.add(p),i.fields.forEach((w,m)=>f(w,`${r}.groups.${o}.fields.${m}`))}),a}function rn(e,s=[]){return Te({declared:Object.keys(e.fields),paged:[...e.page?.fields??[],...(e.page?.groups??[]).flatMap(r=>r.fields)],must:r=>!!e.fields[r].required&&e.fields[r].default===void 0,naming:s})}var Sn=new Set(["subject","now","today","me"]);function jn(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>ke)return{findings:[y("too-large","",`a document may be at most ${ke/1024} KB`)]};if(typeof e=="string")try{e=JSON.parse(e)}catch(t){return{findings:[y("not-json","",`this is not JSON: ${t.message}`)]}}try{e=Xe(e).document}catch(t){return{findings:[y("format","formatVersion",t.message)]}}e=He(e);let s=Je.safeParse(e);if(!s.success)return{findings:s.error.issues.map(t=>{let a=t.path.map(String).join(".");if(t.code==="unrecognized_keys")return y("unknown-key",a,`${t.keys.map(d=>`"${d}"`).join(", ")} ${t.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(t.code==="invalid_union"&&/\.effects\.\d+$/.test(a))return y("effect-shape",a,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(t.code==="invalid_key"){let d=t.issues?.[0]?.message;return y("shape",a,`the name "${String(t.path.at(-1))}" is not allowed here${d?`: ${d}`:""}`)}return y("shape",a,t.message)})};let r=s.data;return{document:r,findings:On(r)}}var ae=e=>[e??[]].flat();function an(e){let s=new Map;for(let[r,t]of Object.entries(e.kinds))for(let[a,d]of Object.entries(ee(t.edges))){let u=s.get(a);s.set(a,{name:a,from:[...u?.from??[],r],to:d.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...d.to])],cardinality:d.cardinality??"many"})}return s}function At(e){let s=new Map;for(let[t,a]of Object.entries(e.kinds)){let d=ne(a),u=ce(a.edges);s.set(t,{fields:new Set([...Object.keys(a.fields),...u.keys()]),edges:new Map(Object.entries(ee(a.edges)).map(([f,z])=>[f,z.cardinality??"many"])),...d?{computed:d}:{},...u.size>0?{linked:u}:{}})}let r=ne(e);return r&&s.set(_e,{computed:r}),s}function cn(e,s){let r=[],t=ae(e.on),a=(d,u)=>{let f=Qe(s.kinds,d,t)?.reversed===!0,[z,i]=f?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:d,from:z,to:i}:{sever:d,from:z,to:i}};if(e.creates){let d=s.kinds[e.creates],u={};for(let f of Object.keys(d?.fields??{}))u[f]=`$${f}`;for(let f of e.effects??[])"set"in f&&!("create"in f)&&R(f.target)==="new"&&Object.assign(u,f.set);r.push({create:e.creates,as:"new",set:u})}return e.sets&&r.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&r.push({set:Object.fromEntries(e.writes.map(d=>[d,`$${d}`]))}),e.connects&&(e.replaces&&r.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),r.push(a(e.connects,"connect"))),e.severs&&r.push(a(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&r.push({set:e.setsOther,target:"$to"}),e.removes&&r.push({remove:"$subject"}),e.effects&&r.push(...e.effects.filter(d=>!(e.creates&&"set"in d&&!("create"in d)&&R(d.target)==="new"))),r}function we(e,s,r){try{let t=H(e),a=se(t);for(let d of a.unknownFunctions)r.push(y("unknown-function",s,`"${d}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));return t}catch(t){if(t instanceof ie){r.push(y("expression",s,t.sentence+` (at character ${t.at+1})`));return}throw t}}function Se(e,s,r){try{return J(e)}catch(t){if(t instanceof Be||t instanceof ie){r.push(y("template",s,(t instanceof ie,t.sentence)));return}throw t}}function On(e){let s=[],r=new Set(Object.keys(e.kinds)),t=an(e),a=e.acts??{},d=new Set(e.roles??[]),u=(i,o)=>ce(e.kinds[i]?.edges).has(o),f=i=>Object.keys(e.kinds).some(o=>u(o,i));for(let[i,o]of Object.entries(e.kinds)){let p=`kinds.${i}`;for(let[m,l]of Object.entries(o.edges??{})){if(!De(l)&&l.to!=="*")for(let c of l.to)r.has(c)||s.push(y("edge-target",`${p}.edges.${m}.to`,`"${c}" is not a kind this document declares`));o.fields[m]&&s.push(y("edge-field-clash",`${p}.edges.${m}`,`"${m}" is both a field and a relation of ${i}`,"rename one of them"))}o.lifecycle&&!o.fields[o.lifecycle.field]&&s.push(y("lifecycle-field",`${p}.lifecycle.field`,`${i} has no field "${o.lifecycle.field}"`));let w=m=>o.computed!==void 0&&Object.hasOwn(o.computed,m);for(let m of o.glance??[])!o.fields[m]&&!w(m)&&s.push(y("glance-field",`${p}.glance`,`a glance at ${i} is to say "${m}", and ${i} has no field or computed field called that`,`use one of: ${[...Object.keys(o.fields),...Object.keys(o.computed??{})].join(", ")}`));s.push(...sn(i,o));for(let m of["label","describe"]){let l=o[m];if(!l)continue;let c=Se(l,`${p}.${m}`,s);for(let O of c??[])if(O.expr){for(let h of se(O.expr).names)if(!o.fields[h]){if(w(h)){Ze(o,h)||s.push(y("template-field",`${p}.${m}`,`${i}'s ${h} is worked out from beyond the record, and a ${m} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${i}'s own fields`));continue}s.push(y("template-field",`${p}.${m}`,`${i} has no field "${h}" for its ${m} to show`,m==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[m,l]of Object.entries(o.fields)){l.default!==void 0&&l.type==="enum"&&!l.options?.includes(String(l.default))&&s.push(y("default-option",`${p}.fields.${m}.default`,`"${String(l.default)}" is not one of ${m}'s options`));let c=`${m}Repeat`;l.repeats&&(o.fields[c]||o.edges?.[c]||o.computed?.[c])&&s.push(y("repeat-clash",`${p}.fields.${m}.repeats`,`${i} already has "${c}", where how ${m} repeats is kept`))}}for(let[i,o]of Object.entries(a)){let p=`acts.${i}`;for(let c of ae(o.on))r.has(c)||s.push(y("act-kind",`${p}.on`,`"${c}" is not a kind this document declares`));let w=ae(o.on),m=cn(o,e);if(o.creates&&o.on===void 0&&o.writes&&r.has(o.creates)){for(let c of o.writes)if(!e.kinds[o.creates].fields[c])if(e.kinds[o.creates].computed?.[c]!==void 0)s.push(y("computed-written",`${p}.writes`,`${o.creates}'s ${c} is worked out, not written: no act can set it`,"write the stored fields it is worked out from"));else{if(u(o.creates,c))continue;s.push(y("act-field",`${p}.writes`,`${o.creates} has no field "${c}"`))}}m.length===0&&s.push(y("act-empty",p,`"${i}" does nothing`,"give it effects or a shorthand such as sets or creates"));let l=new Map;m.forEach((c,O)=>{let h=m.length-(o.effects?.length??0),j=o.effects&&O>=h?`${p}.effects.${O-h}`:p;if("create"in c){if(!r.has(c.create))s.push(y("act-kind",`${j}.create`,`"${c.create}" is not a kind this document declares`));else for(let b of Object.keys(c.set??{}))e.kinds[c.create].fields[b]||(e.kinds[c.create].computed?.[b]!==void 0?s.push(y("computed-written",`${j}.set.${b}`,`${c.create}'s ${b} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):s.push(y("act-field",`${j}.set.${b}`,`${c.create} has no field "${b}"`)));c.as&&l.set(c.as,c.create)}else if("connect"in c||"sever"in c){let b="connect"in c?c.connect:c.sever;!t.has(b)&&!f(b)&&s.push(y("act-edge",`${j}.${"connect"in c?"connect":"sever"}`,`"${b}" is not a relation any kind declares`)),R(c.from)==="subject"&&w.length===0&&s.push(y("act-subject",`${p}.on`,`"${i}" acts on "$subject" but does not say which kinds it is "on"`))}else if("set"in c){let b=R(c.target??"$subject"),G=b==="subject"?w:l.has(b??"")?[l.get(b)]:[];b==="subject"&&w.length===0&&s.push(y("act-subject",`${p}.on`,`"${i}" changes "$subject" but does not say which kinds it is "on"`));for(let F of Object.keys(c.set))for(let g of G)if(!(!r.has(g)||e.kinds[g].fields[F]))if(e.kinds[g].computed?.[F]!==void 0)s.push(y("computed-written",`${j}.set.${F}`,`${g}'s ${F} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(g,F))continue;s.push(y("act-field",`${j}.set.${F}`,`${g} has no field "${F}"`))}}else"remove"in c&&R(c.remove)==="subject"&&w.length===0&&s.push(y("act-subject",`${p}.on`,`"${i}" removes "$subject" but does not say which kinds it is "on"`));("set"in c&&c.set?Object.values(c.set):[]).forEach(b=>{b&&typeof b=="object"&&!Array.isArray(b)&&"expr"in b&&we(b.expr,`${j}.set`,s)})}),o.allowedWhen&&we(o.allowedWhen,`${p}.allowedWhen`,s),o.refusal&&Se(o.refusal,`${p}.refusal`,s)}for(let[i,o]of Object.entries(e.rules??{})){let p=`rules.${i}`;o.over!=="graph"&&!r.has(o.over)&&s.push(y("rule-kind",`${p}.over`,`"${o.over}" is not a kind this document declares`));let w=o.over==="graph"?void 0:e.kinds[o.over];for(let m of["when","require"]){let l=o[m];if(!l)continue;let c=we(l,`${p}.${m}`,s);if(!c)continue;let O=se(c);for(let h of O.names)if(o.over==="graph")s.push(y("rule-name",`${p}.${m}`,`"${h}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(w&&!w.fields[h]&&!w.edges?.[h]&&w.computed?.[h]===void 0){let j=Object.keys(w.edges??{}).find(E=>E.includes("-")&&E.split("-").includes(h));s.push(y("rule-name",`${p}.${m}`,`${o.over} has no field or relation called "${h}"`,j?`"${j}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${j.replace(/-([a-z0-9])/g,(E,b)=>b.toUpperCase())}"`:void 0))}for(let h of O.edges)!t.has(h)&&!f(h)&&s.push(y("rule-edge",`${p}.${m}`,`"${h}" is not a relation any kind declares`));for(let h of O.sweeps)r.has(h)?o.over!=="graph"&&s.push(Ne("rule-cost",`${p}.${m}`,`this rule looks at every ${h} for every ${o.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):s.push(y("rule-kind",`${p}.${m}`,`"${h}" is not a kind this document declares`))}o.says&&Se(o.says,`${p}.says`,s),(o.repairs??[]).forEach((m,l)=>{!a[m.act]&&!de(m.act)&&!me(m.act,e.kinds)&&s.push(y("repair-act",`${p}.repairs.${l}.act`,`"${m.act}" is not an act this document declares`,ge(m.act,e)))})}let z=e.policy;return z&&(z.grants.forEach((i,o)=>{if(i.roles!=="*"&&d.size>0)for(let p of i.roles)d.has(p)||s.push(y("grant-role",`policy.grants.${o}.roles`,`"${p}" is not one of the document's roles`));if(i.mutations!=="*")for(let p of i.mutations)!a[p]&&!de(p)&&!me(p,e.kinds)&&s.push(y("grant-act",`policy.grants.${o}.mutations`,`"${p}" is not an act this document declares`,ge(p,e)))}),(z.sees??[]).forEach((i,o)=>{for(let p of i.kinds)r.has(p)||s.push(y("sight-kind",`policy.sees.${o}.kinds`,`"${p}" is not a kind this document declares`));if(i.roles!=="*"&&d.size>0)for(let p of i.roles)d.has(p)||s.push(y("sight-role",`policy.sees.${o}.roles`,`"${p}" is not one of the document's roles`))})),s.push(...We(e)),s}function vn(e){return e.label?[...e.label.matchAll(/\{\s*([A-Za-z_][A-Za-z0-9_]*)/g)].map(s=>s[1]):[fe(e)??[]].flat()}function xn(e,s,r,t){let a=new Map,d=ae(e.on),u=new Map,f=new Map;(d.length>0||s.some(l=>"remove"in l&&R(l.remove)==="subject"||"from"in l&&(R(l.from)==="subject"||R(l.to)==="subject")||"set"in l&&!("create"in l)&&R(l.target??"$subject")==="subject"))&&a.set(pe,{ref:d.length>0?d:"*",required:!0});let i=e.args??{},o=e.writes?.length===1,p=(l,c)=>c&&l.type===c.type&&l.min===void 0&&l.max===void 0&&l.step===void 0?{...l,...c.min===void 0?{}:{min:c.min},...c.max===void 0?{}:{max:c.max},...c.step===void 0?{}:{step:c.step}}:l,w=(l,c)=>c&&l.type===c.type&&l.format===void 0&&l.unit===void 0?{...p(l,c),...c.format?{format:c.format}:{},...c.unit?{unit:c.unit}:{}}:p(l,c),m=(l,c,O)=>{if(l===pe||Sn.has(l)||u.has(l)||a.has(l))return;let h=i[l]?w(i[l],O):void 0;a.set(l,h?{field:h,optional:!h.required,required:!!h.required}:c())};for(let l of s)if("create"in l){let c=r.kinds[l.create],O=c?rn(c,vn(c)):[],h=j=>O.includes(j)?O.indexOf(j):O.length;for(let[j,E]of Object.entries(l.set??{}).sort(([b],[G])=>h(b)-h(G))){let b=R(E),G=c?.fields[j];if(b&&G){let F=!!G.required&&G.default===void 0;m(b,()=>({field:G,optional:!F,required:F}),G)}}l.as&&u.set(l.as,l.create)}else if("connect"in l||"sever"in l){let c=t.get("connect"in l?l.connect:l.sever);for(let[O,h]of[["from",l.from],["to",l.to]]){let j=R(h);if(!j)continue;let E=O==="to"?c?.to??"*":c?.from??"*";E!=="*"&&!f.has(j)&&f.set(j,E),m(j,()=>({ref:E,required:!0}))}}else if("set"in l){let c=R(l.target??"$subject"),O=c==="subject"?d[0]:u.get(c??"")??f.get(c??"")?.[0];c&&c!=="subject"&&!u.has(c)&&m(c,()=>({ref:"*",required:!0}));for(let[h,j]of Object.entries(l.set)){let E=R(j);if(!E)continue;let b=O?r.kinds[O]?.fields[h]:void 0;m(E,()=>b?{field:b,optional:!o,required:o}:{any:!0,required:!1},b)}}else if("remove"in l){let c=R(l.remove);c&&m(c,()=>({ref:"*",required:!0}))}for(let[l,c]of Object.entries(i))a.has(l)||a.set(l,{field:c,optional:!c.required,required:!!c.required});return a}function Et(e,s={}){let r=jn(e);if(!r.document||le(r.findings))return{ok:!1,findings:r.findings};let t=r.document,a=[...r.findings];s.previous&&a.push(...En(t,s.previous));let d=An(t,a);return le(d.findings)?{ok:!1,findings:d.findings}:Ve(d,s)}function re(e,s){return e.map(r=>{let t=!r.format&&r.expr?.t==="ident"?s?.[r.expr.name]?.format:void 0;return t==="money"||t==="percent"?{...r,format:t}:r})}function An(e,s){let r=an(e),t={};for(let[i,o]of Object.entries(e.kinds)){let p=fe(o),w=o.label??(p?`{${p}}`:void 0),m=ne(o),l=m?on(e,i,[...m]):[];t[i]={...w?{label:re(J(w),o.fields)}:{},...o.describe?{describe:re(J(o.describe),o.fields)}:{},...m?{computed:[...m]}:{},...l.length>0?{durations:l}:{}}}let a={};for(let[i,o]of Object.entries(e.acts??{})){let p=cn(o,e),w=xn(o,p,e,r),m=o.destructive??p.some(g=>"remove"in g||"sever"in g||"replace"in g),l=[...new Set(p.flatMap(g=>"create"in g?[g.create]:[]))],c=[...new Set(p.flatMap(g=>"connect"in g?[g.connect]:[]))],O=[...new Set(p.flatMap(g=>"sever"in g?[g.sever]:"replace"in g?g.replace:[]))],h=[...new Set(p.flatMap(g=>"set"in g&&!("create"in g)&&R(g.target??"$subject")==="subject"?Object.keys(g.set):[]))],j=new Map;for(let g of p){if(!("connect"in g)&&!("sever"in g))continue;let v=r.get("connect"in g?g.connect:g.sever);for(let[D,oe]of[["from",g.from],["to",g.to]]){let B=R(oe),Y=D==="to"?v?.to:v?.from;B&&B!=="subject"&&Y&&Y!=="*"&&j.set(B,[...new Set([...j.get(B)??[],...Y])])}}let E={};for(let g of p){if(!("set"in g)||"create"in g)continue;let v=R(g.target??"$subject");for(let D of v&&v!=="subject"&&j.get(v)||[])E[D]=[...new Set([...E[D]??[],...Object.keys(g.set)])]}let b={};for(let g of p)if(!(!("set"in g)||"create"in g||R(g.target??"$subject")!=="subject"))for(let[v,D]of Object.entries(g.set??{}))typeof D=="string"&&R(D)===void 0||typeof D=="number"||typeof D=="boolean"?b[v]=typeof D=="string"&&D.startsWith("$$")?D.slice(1):D:delete b[v];let G=l.length===0&&p.every(g=>!("set"in g)||!g.set||Object.values(g.set).every(v=>!(v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v))),F=new Map;for(let g of p)if(!(!("set"in g)||!g.set))for(let v of Object.values(g.set))v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v&&F.set(v.expr,H(v.expr));a[i]={title:o.title??i.replace(/-/g," "),effects:p,args:[...w],...o.allowedWhen?{guard:H(o.allowedWhen)}:{},...o.refusal?{refusal:re(J(o.refusal),e.kinds[[o.on??[]].flat()[0]??""]?.fields)}:{},exprs:[...F],destructive:m,idempotent:G,creates:l,connects:c,severs:O,writes:h,writesOther:E,sets:b}}let d={};for(let[i,o]of Object.entries(e.rules??{}))d[i]={title:o.title??i.replace(/-/g," "),require:H(o.require),...o.when?{when:H(o.when)}:{},...o.says?{says:re(J(o.says),e.kinds[o.over]?.fields)}:{}};let u=qe(e,s),f=Le(e),z=Ue(e);return{format:Ie,document:e,findings:s,kinds:t,...e.computed?{facts:[...ne(e)??[]]}:{},edges:[...r].map(([i,{from:o,to:p,cardinality:w}])=>[i,{from:o,to:p,cardinality:w}]),acts:a,rules:d,brand:u,...Object.keys(f).length>0?{viewSpecs:f}:{},...z?{home:z}:{}}}function Rt(e,s,r){let t=/^defineNode\("([^"]+)"\)/.exec(s)?.[1],a=t?r.kinds[t]:void 0;if(!t||!a)return e;let d=Object.keys(a.fields).filter(u=>u!=="label").slice(0,3);return{...e,path:`kinds.${t}.glance`,fix:`Say which: "glance": [${d.map(u=>`"${u}"`).join(", ")}] on kinds.${t} \u2014 the facts a person compares one by, at a glance.`}}function En(e,s){let r=[],t=new Set(Object.values(s.kinds).flatMap(a=>Object.keys(a.edges??{})));for(let[a,d]of Object.entries(e.kinds)){let u=d.renamedFrom;u&&!s.kinds[u]&&r.push(y("renamed-from-nothing",`kinds.${a}.renamedFrom`,`${a} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let f=s.kinds[u??a];for(let[z,i]of Object.entries(d.fields)){let o=i.renamedFrom;o&&!f?.fields[o]&&r.push(y("renamed-from-nothing",`kinds.${a}.fields.${z}.renamedFrom`,`${z} says it was ${o}, and the previous ${u??a} has no field called ${o}`,"name the field it was, or drop renamedFrom"))}for(let[z,i]of Object.entries(d.edges??{})){let o=i.renamedFrom;o&&!t.has(o)&&r.push(y("renamed-from-nothing",`kinds.${a}.edges.${z}.renamedFrom`,`${z} says it was ${o}, and the previous version has no relation called ${o}`,"name the relation it was, or drop renamedFrom"))}}return r}export{zn as ActRefusal,Et as compileDocumentWithoutCheck,cn as effectsOf,Rt as inDocumentWords,At as kindShapes,jn as readDocument};
@@ -1 +0,0 @@
1
- var r=Symbol.for("@graview/core:seat"),o=e=>e[r];export{o as a};
@@ -1 +0,0 @@
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.4KTHJY5N.js";import{a,b}from"./chunk.PZ4G5QA5.js";import"./chunk.Y36MLVMT.js";import"./chunk.MPMROUZA.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";export{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,18 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Fe}from"./chunk.K2J26XMB.js";import{A as Zt,B as Ce,C as oo,D as Je,E as me,F as Kn,G as Ge,H as Ve,I as io,J as Bn,K as Re,L as so,M as lo,N as H,O as ut,P as St,Q as co,R as vt,S as Xt,T as po,U as oe,V as gt,W as le,X as qn,a as j,b as Se,c as Y,d as Yt,e as In,f as Fn,g as pt,h as ae,i as he,j as se,k as A,l as re,m as V,n as Ue,o as we,p as Qt,q as ve,r as ue,s as no,t as wt,u as ao,v as Dn,w as Wn,x as Q,y as De,z as ro}from"./chunk.B2X6DA2Q.js";import{b as Hn,c as eo,d as to,e as Xe,f as Gn,h as ee}from"./chunk.QB7RYJ67.js";import{a as Zr,d as Xr,e as Jr}from"./chunk.UGFDSE37.js";import{a as Vr,c as jr,f as _r,g as zr,i as Yr,j as Qr}from"./chunk.EC7I33WI.js";import{a as _t,b as zt}from"./chunk.PXQVXBNG.js";import{a as Hr,b as Ir,c as Fr,d as $n}from"./chunk.GVUJCOKD.js";import{b as $r}from"./chunk.3ZONBC6L.js";import{a as Dr,b as Wr,d as Vt,e as Gr,f as Kr,g as Br,j as jt}from"./chunk.MDWCX3YU.js";import{m as Or}from"./chunk.4KTHJY5N.js";import{a as Sr,b as vr,c as br,e as Er,f as On,h as Bt}from"./chunk.Y36MLVMT.js";import{d as Pr,e as Ar,f as Cr,g as Rr,n as Gt,o as Lr,q as Tr,s as Kt}from"./chunk.MPMROUZA.js";import{a as It,b as Za,c as Xa,d as Ft,e as Ja}from"./chunk.XTT6ERI3.js";import{b as or,c as yr,e as hr,f as En}from"./chunk.5RH6FO3K.js";import{a as Tn,b as fr}from"./chunk.L7MFTL5S.js";import{a as qt,b as Ut,c as Mr,e as Nr}from"./chunk.LVOL2LEC.js";import{a as ct,b as gr,e as mr}from"./chunk.3G5DEGFA.js";import{a as Mn}from"./chunk.Q6RUTFU3.js";import{a as Rn,b as ar,c as rr}from"./chunk.AZGXBTOQ.js";import{a as wr}from"./chunk.AG7CUSSV.js";import{c as sr,d as lr,e as dr,f as cr,k as Ze,l as pr}from"./chunk.3V2WXZU3.js";import{a as ir}from"./chunk.7UD2JR6J.js";import{r as Ln,s as ur}from"./chunk.PZWJUQAO.js";import{b as er,c as tr,d as Dt,e as nr,l as Wt}from"./chunk.RLO3RDYH.js";import{H as qr,K as Ur,c as Ya,d as Qa,r as kr,s as xr,z as Nn}from"./chunk.FWZF7X6A.js";import{c as ni}from"./chunk.3JMZHCB4.js";import{Ba as Ht,G as Ne,L as Da,N as Wa,Qa as za,R as Ga,T as U,U as Cn,Y as Ka,Z as Ba,ba as qa,ca as ie,fa as Ua,ga as Va,ia as ja,ma as lt,oa as _a,qa as dt,r as Fa,v as Ie}from"./chunk.SF4BYBH6.js";import{a as Ia}from"./chunk.SDO3U72B.js";import{$a as Ra,Gd as An,Hd as $a,J as ba,Md as Ha,Pc as Na,U as ht,Za as Ca,ca as st,da as pe,fa as Ye,ga as Mt,hc as Ta,ia as qe,ka,la as xa,lb as xn,ma as Qe,mb as La,oc as Ea,od as Pn,qc as Ma,ud as Ot,vd as Oa,wb as Nt,xa as Pa,xd as $t,ya as Aa}from"./chunk.3MZIWKNG.js";import{b as I}from"./chunk.AJZBJBMO.js";function uo(e,t,n={}){let a=e.graph.getNode(t);if(!a)return;let r=e.schema.tryDefinition(a.kind),o=i=>pe(e.schema.tryDefinition(i.kind),i),l=new Map;for(let i of e.graph.allEdges()){let s=i.from===t?"out":i.to===t?"in":null;if(!s)continue;let c=s==="out"?i.to:i.from,g=e.graph.getNode(c);if(!g)continue;let u=(s==="out"?r:e.schema.tryDefinition(g.kind))?.edges?.[i.kind],p=s==="in"?u?.inverse??u?.description:u?.description,x=`${i.kind}|${s}|${p??""}`;(l.get(x)??(()=>{let W={edgeKind:i.kind,direction:s,...p?{description:p}:{},targets:[]};return l.set(x,W),W})()).targets.push({id:g.id,kind:g.kind,label:o(g)})}return{id:t,kind:a.kind,label:o(a),fields:Dt(Ze(e.schema,e.graph,a),r),violations:xn(e.violations(n.context),[t]),actions:Mn(e,[t],{focus:t,...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}}),links:[...l.values()].map(i=>{let s=er(i.targets.flatMap(c=>{let g=e.graph.getNode(c.id);return g?[g]:[]}),c=>e.schema.tryDefinition(c));return{...i,targets:[...i.targets].map(c=>s.has(c.id)?{...c,apart:s.get(c.id)}:c).sort((c,g)=>c.label.localeCompare(g.label))}})}}function et(e,t,n={}){return{kind:t,members:e.graph.nodesOfKind(t),actions:Mn(e,[],{kindSelection:[t],...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}})}}function go(e,t){let n=(o,l)=>`${o}|${JSON.stringify(l)}`,a=new Map;for(let o of[...e.affordances,...e.withheld]){if(o.provider!=="invariant")continue;let l=n(o.mutation,o.args);a.has(l)||a.set(l,o.rank??Number.MAX_SAFE_INTEGER)}let r=Number.MAX_SAFE_INTEGER;return[...t].map((o,l)=>({repair:o,declared:l})).sort((o,l)=>(a.get(n(o.repair.mutation,o.repair.args??{}))??r)-(a.get(n(l.repair.mutation,l.repair.args??{}))??r)||o.declared-l.declared).map(o=>o.repair)}function tt(e){let t=e.schema.kinds.map(r=>({kind:r,plural:qe(e.schema,r),count:e.graph.nodesOfKind(r).length})),n=new Map;for(let r of e.graph.allEdges()){let o=e.graph.getNode(r.from),l=e.graph.getNode(r.to);if(!o||!l)continue;let i=`${r.kind}|${o.kind}|${l.kind}`;n.set(i,(n.get(i)??0)+1)}let a=[];for(let{kind:r}of t){let o=e.schema.tryDefinition(r)?.edges??{};for(let[l,i]of Object.entries(o)){let s=i.to==="*"||i.to===void 0?(()=>{let c=[...n.keys()].filter(g=>g.startsWith(`${l}|${r}|`)).map(g=>g.split("|")[2]);return c.length>0?c:["*"]})():i.to;for(let c of s)a.push({edgeKind:l,from:r,to:c,...i.description?{description:i.description}:{},...i.inverse?{inverse:i.inverse}:{},count:n.get(`${l}|${r}|${c}`)??0})}}return{kinds:t,relations:a}}var Ke=I(Ne(),1);var bt=I(Ne(),1);var Le=I(U(),1),ri={problems:"Problems",search:"Search",map:"Connections",places:"Pictures","~draft":"A view drawn"},oi=e=>{try{return decodeURIComponent(e)}catch{return e}};function ii(e,t,n={}){let{store:a}=e,r=a.schema,o=(n.base??"").replace(/\/$/,""),[l="/",i=""]=t.split("#")[0].split("?"),s=(P,E,b)=>({label:P,href:`${o}${E}`,path:E,...b?{current:b}:{}}),c=P=>{let E=n.registry?.sectionOf(P);return E?[E.path===void 0?{label:E.label}:s(E.label,E.path)]:[]},g=P=>n.registry?.sectionOf(P)?.label,k=P=>{let E=g(P);return E===void 0?{}:{section:E}},[u,p,...x]=l.split("/").filter(Boolean).map(oi);if(u===void 0)return{as:"home",label:"Home",trail:[s("Home","/",!0)]};if(u==="places"&&p!==void 0&&x.length===0){let P=new URLSearchParams(i).get("of"),E=new Set(De(a,e.principal)),b=e.views?.places()??[],G=b.find(L=>E.has(L.kind)&&L.as===p&&(!P||j(r,L.kind)===P));if(G){let L=Yt(G.as,Ot(G,b)?j(r,G.kind):void 0);return{as:"place",kind:G.kind,label:G.title,...k(G.kind),trail:[...c(G.kind),s(G.title,L,!0)]}}}let O=x.length===0?Se(r,u):void 0;if(O!==void 0){let P=s(qe(r,O),`/${j(r,O)}`);if(p===void 0)return{as:"list",kind:O,label:P.label,...k(O),trail:[...c(O),{...P,current:!0}]};let E=a.graph.getNode(p),b=E&&E.kind===O?pe(r.tryDefinition(O),E):"Nothing lives here";return{as:"record",kind:O,id:p,label:b,...k(O),trail:[...c(O),P,s(b,Y(r,O,p),!0)]}}let W=ri[u]??si((x.at(-1)??p??u).replace(/[-_]+/g," "));return{as:"page",label:W,trail:[s(W,l,!0)]}}var si=e=>e.charAt(0).toUpperCase()+e.slice(1),Un=(0,bt.createContext)(null);function li(e){let t=me(),n=Je("/");return ee(e.context.store),ii(e.context,`${t.pathname}${t.search}`,{registry:e.registry,base:n})}var di={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0},mo={display:"flex",alignItems:"center",gap:6,minWidth:0},fo={display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,lineHeight:"24px"};function mt({context:e,style:t}){let n=(0,bt.useContext)(Un),a=(0,bt.useContext)(St);return vt(a??pi,"trail")||n?.registry?.without().has("trail")?null:(0,Le.jsx)(ci,{root:n??{context:e,registry:void 0},context:e,...t?{style:t}:{}})}function ci({root:e,context:t,style:n}){let a=li(e);return a.trail.length<2?null:(0,Le.jsx)(ui,{here:a,mark:a.as==="record"?{kind:a.kind,context:t}:void 0,...n?{style:n}:{},"data-testid":"page-trail"})}var pi={count:()=>0,place:()=>()=>{},subscribe:()=>()=>{}};function ui({here:e,mark:t,style:n,...a}){let r=e.as==="record"?e.trail.length-2:-1;return(0,Le.jsx)("nav",{"aria-label":"You are here","data-graview-trail":"",style:{minWidth:0,...n},...a,children:(0,Le.jsx)("ol",{style:{...he,listStyle:"none",padding:0,display:"flex",alignItems:"center",gap:6,minWidth:0,overflow:"hidden"},children:e.trail.map((o,l)=>(0,Le.jsxs)("li",{style:o.current?di:{...mo,flexShrink:l===e.trail.length-2?0:1,maxWidth:"100%"},...o.current?{"aria-current":"page"}:{},children:[l>0&&!o.current?(0,Le.jsx)("span",{"aria-hidden":"true",children:"\u203A"}):null,o.current?o.label:o.path!==void 0?(0,Le.jsxs)(H,{to:o.path,style:{...we,...mo},...l===r?{"data-testid":"trail-list"}:{},children:[l===r&&t?(0,Le.jsx)(ue,{kind:t.kind,brand:t.context.brand,schema:t.context.store.schema,size:8}):null,(0,Le.jsx)("span",{style:fo,children:o.label})]}):(0,Le.jsx)("span",{style:fo,children:o.label})]},`${l}:${o.label}`))})})}var C=I(U(),1);function Oe(e){let t=e.views;if(!t)return[];let n=new Set(De(e.store,e.principal));return t.places().filter(a=>n.has(a.kind))}function Jt(e,t){if(!t.over)return[t.kind];let n=new Set(De(e.store,e.principal));return t.over.filter(a=>a===t.kind||n.has(a))}var nt=e=>`place:${e.kind}:${e.as}`;function fe(e,t){return Yt(t.as,Ot(t,e.views?.places()??[])?j(e.store.schema,t.kind):void 0)}function kt(e,t){let n=e.schema.tryDefinition(t);return e.graph.nodesOfKind(t).filter(a=>st(n,a))}function Vn(e,t,n){let a=(o,l)=>Mt(e.schema,l,o),r=(typeof t=="string"?[t]:t).map(o=>a(kt(e,o).length,o)).join(" and ");return n?`${r} across ${a(kt(e,n).length,n)}`:r}function jn({context:e,place:t,chosen:n,filter:a}){let{store:r,views:o,invariantContext:l}=e,s=o?.resolve(t.kind,{cardinality:"many",fidelity:"full"},t.as)?.view,c=[...new Set(r.violations(l).flatMap(u=>u.nodeIds))],g=Jt(e,t).flatMap(u=>kt(r,u));if(!s)return null;let k=gi(r,g,a,c);return(0,C.jsx)(Ln,{kind:t.kind,view:t.title,children:(0,C.jsx)(gt,{when:dt(s),children:(0,C.jsx)(s,{nodes:k,label:t.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...n&&n.length>0?{implicated:n}:{},...c.length>0?{flagged:c}:{}})})})}function gi(e,t,n,a){let r=n?$t({filter:n}).filter??[]:[];return r.length===0?t:Bt(t,{filter:r},{schema:e.schema,graph:e.graph,flagged:new Set(a)}).nodes}function mi({store:e,views:t,as:n,invariantContext:a}){ee(e);let r={store:e,views:t,...a?{invariantContext:a}:{}},o=t.places().find(l=>l.as===n);return o?(0,C.jsx)(jn,{context:r,place:o}):null}function fi({context:e,kind:t}){let{store:n,views:a,invariantContext:r}=e,o=kt(n,t),l=n.schema.tryDefinition(t),i=Q(n,t),c=a?.resolve(t,{cardinality:"many",fidelity:"full"})?.view,g=[...new Set(n.violations(r).flatMap(x=>x.nodeIds))];if(c&&!lt(c))return(0,C.jsx)(Ln,{kind:t,children:(0,C.jsx)(c,{nodes:o,label:i,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...g.length>0?{flagged:g}:{}})});let k=a?.resolve(t,{cardinality:"one",fidelity:"summary"})?.view,u=8,p=o.slice(0,u);return(0,C.jsxs)("div",{"data-testid":"kind-sheet",style:k?{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gridAutoRows:"max-content",alignContent:"center",gap:12,padding:24}:{display:"flex",flexWrap:"wrap",alignContent:"center",justifyContent:"center",gap:10,padding:24},children:[p.map(x=>k?(0,C.jsx)(k,{node:x,fidelity:"summary",cardinality:"one",mode:"fullscreen",selected:!1,...g.includes(x.id)?{flagged:[x.id]}:{}},x.id):(0,C.jsx)("span",{style:{padding:"8px 14px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:pe(l,x)},x.id)),o.length>u?(0,C.jsxs)("span",{style:{...A,alignSelf:"center",padding:"0 6px"},children:["+",o.length-u," more ",i.toLowerCase()]}):null]})}function _n(e){let{store:t}=e,n=ro(e),a=Oe(e),r=e.views?.arrangement?.()?.order??[],o=s=>{let c=s.name===void 0?-1:r.indexOf(`view:${s.name}`);return c>=0?c-r.length:n.indexOf(s.kind)},l=Pn([...a].sort((s,c)=>o(s)-o(c))).filter(s=>!s.hidden),i=new Set(l.flatMap(s=>s.over??[s.kind]));return[...l.map(s=>({key:nt(s),kind:s.kind,title:Oa(s,a,t.schema),to:fe(e,s),place:s})),...Zt(e).filter(s=>!i.has(s)).map(s=>({key:`kind:${s}`,kind:s,title:Q(t,s),to:`/${j(t.schema,s)}`}))]}var yo=.72,yi=540,ho=16/10;function hi(e){let t=(0,Ke.useRef)(null),[n,a]=(0,Ke.useState)(e);return(0,Ke.useLayoutEffect)(()=>{let r=t.current;if(!r||typeof ResizeObserver>"u")return;let o=()=>{let i=r.getBoundingClientRect().width;i>0&&a(s=>Math.abs(s-i)<.5?s:i)};o();let l=new ResizeObserver(o);return l.observe(r),()=>l.disconnect()},[]),{ref:t,width:n}}function wi(e){for(let t=e.parentElement;t;t=t.parentElement)if(/(auto|scroll)/.test(getComputedStyle(t).overflowY))return t;return null}function Si(e){let[t,n]=(0,Ke.useState)(()=>typeof IntersectionObserver>"u");return(0,Ke.useLayoutEffect)(()=>{let a=e.current;if(t||!a)return;let r=new IntersectionObserver(o=>{o.some(l=>l.isIntersecting)&&(r.disconnect(),n(!0))},{root:wi(a),rootMargin:"50% 0px"});return r.observe(a),()=>r.disconnect()},[t,e]),t}function zn({context:e,entry:t}){let{store:n,brand:a,principal:r}=e,{ref:o,width:l}=hi(yi),i=Si(o),s=l/yo,c=kt(n,t.kind),g=n.schema.tryDefinition(t.kind),k=c.length===0?et(n,t.kind,{...r?{principal:r}:{},...e.invariantContext?{context:e.invariantContext}:{}}).actions.affordances[0]:void 0,u=t.place!==void 0;return(0,C.jsxs)(H,{to:t.to,"data-testid":u?"place-card":"kind-card",className:"graview-gallery-card",style:{...we,display:"grid",gap:10,alignContent:"start",minWidth:0},children:[(0,C.jsxs)("span",{ref:o,"data-testid":u?"place-picture":"kind-picture","aria-hidden":"true",inert:!0,style:{display:"block",position:"relative",width:"100%",aspectRatio:`${ho}`,overflow:"hidden",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",pointerEvents:"none"},children:[(0,C.jsx)("span",{style:{position:"absolute",left:0,top:0,width:s,height:s/ho,display:"grid",gridTemplateRows:"minmax(0, 1fr)",transform:`scale(${yo})`,transformOrigin:"0 0"},children:i?(0,C.jsx)(Vt.Provider,{value:null,children:t.place?(0,C.jsx)(jn,{context:e,place:t.place}):(0,C.jsx)(fi,{context:e,kind:t.kind})}):null}),c.length===0?(0,C.jsx)("span",{"data-testid":"picture-empty",style:{position:"absolute",inset:0,display:"grid",placeContent:"center",justifyItems:"center",gap:2,padding:20,textAlign:"center"},children:(0,C.jsxs)("span",{style:{display:"grid",gap:2,padding:"10px 16px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:[(0,C.jsxs)("span",{style:{fontFamily:Fn,fontWeight:"var(--graview-weight-display)"},children:["No ",Q(n,t.kind).toLowerCase()," yet"]}),k?(0,C.jsxs)("span",{style:A,children:["Begin with \u201C",k.label,"\u201D"]}):null]})}):null]}),(0,C.jsxs)("span",{style:{display:"grid",gap:2,minWidth:0},children:[(0,C.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[u?null:(0,C.jsx)(ue,{kind:t.kind,brand:a,schema:n.schema,size:8}),(0,C.jsx)("span",{style:{fontFamily:Fn,fontSize:"var(--graview-text-heading)",fontWeight:"var(--graview-weight-display)",lineHeight:1.3,overflowWrap:"anywhere",textWrap:"balance"},children:t.title})]}),(0,C.jsxs)("span",{style:A,children:[t.place?Vn(n,Jt(e,t.place),t.place.across):Vn(n,t.kind),!u&&g?.description?` \xB7 ${g.description}`:null]})]})]})}var wo={display:"grid",gap:"32px 28px",gridTemplateColumns:"repeat(auto-fill, minmax(min(420px, 100%), 1fr))"},vi=`
2
- .graview-gallery-card > span:first-child { transition: border-color 160ms ease, box-shadow 160ms ease; }
3
- .graview-gallery-card:hover > span:first-child,
4
- .graview-gallery-card:focus-visible > span:first-child { border-color: var(--graview-edge-bright); box-shadow: 0 1px 0 var(--graview-edge), 0 10px 30px -18px var(--graview-ink); }
5
- `;function Yn({context:e}){ee(e.store);let t=_n(e);return t.length===0?null:(0,C.jsxs)("section",{style:wo,"data-testid":"gallery",children:[(0,C.jsx)("style",{children:vi}),t.map(n=>(0,C.jsx)(zn,{context:e,entry:n},n.key))]})}function Qn({context:e}){let{store:t}=e;ee(t);let n=Pn(Oe(e)).filter(r=>!r.hidden),a=_n(e);return(0,C.jsxs)(oe,{context:e,style:pt,children:[(0,C.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,C.jsx)("p",{style:he,children:n.length===0?"None of its own yet":`${n.length} ${n.length===1?"picture":"pictures"}`}),(0,C.jsx)(le,{context:e,children:"Pictures"}),(0,C.jsx)("p",{style:se,children:n.length===0?"Nothing here has a picture of its own yet, so each kind is drawn as the scene draws it. Title a group view and it appears here by name.":"The ways this installation looks at what it holds \u2014 each one the same picture the scene shows, here as a page."})]}),a.length>0?(0,C.jsx)("div",{style:wo,"data-testid":"places",children:a.map(r=>(0,C.jsx)(zn,{context:e,entry:r},r.key))}):null]})}var bi={lede:!0},ki={lede:!1},xi={...se,textWrap:"pretty"};function Pi(e,t){if(t===void 0)return;let[n]=cr(dr([t]),pr(e.store,null,null,e.brand?{money:e.brand}:{}));return n?.t==="headline"&&!n.problem&&n.text.trim()!==""?n.text:void 0}function Zn({context:e}){let{store:t,principal:n}=e;ee(t);let a=Ve(),r=Ge(),[o]=ut(),l=decodeURIComponent(a.as??""),[i,s]=(0,Ke.useState)(null),c=o.get("of"),g=o.get("filter"),u=Oe(e).find(L=>L.as===l&&(!c||j(t.schema,L.kind)===c));if(!u)return(0,C.jsxs)(oe,{context:e,children:[(0,C.jsx)(le,{context:e,children:"No picture is called that."}),(0,C.jsx)("p",{style:se,children:(0,C.jsx)(H,{to:"/places",style:Ue,children:(0,C.jsx)(Xe,{children:"The pictures there are"})})})]});let p=Q(t,u.kind),x=e.views?.resolve(u.kind,{cardinality:"many",fidelity:"full"},u.as)?.view,O=x?.flows===!0,W=x?.ownHeading===!0,P=x?.creates!==!1,E=Pi(e,x?.lede),b=et(t,u.kind,{...n?{principal:n}:{},...e.invariantContext?{context:e.invariantContext}:{}}),G=P?b.actions.affordances.map(L=>({affordance:L,mutation:t.allMutations().find(T=>T.name===L.mutation)})).filter(L=>L.mutation!==void 0):[];return(0,C.jsxs)(oe,{context:e,style:{...pt,gap:"var(--graview-space-6, 32px)"},children:[(0,C.jsxs)("header",{style:{display:"grid",gap:"var(--graview-space-2, 8px)"},children:[(0,C.jsx)(mt,{context:e}),(0,C.jsx)(le,{context:e,unseen:W,children:u.title}),W?null:(0,C.jsx)("p",{style:xi,"data-testid":"place-lede",...E!==void 0?{"data-graview-lede":"headline"}:{},children:E??`${Vn(t,Jt(e,u),u.across)}.`}),g&&!O?(0,C.jsxs)("p",{style:{...A,margin:0},"data-testid":"place-narrowed",children:[`Only those where ${g.split(",").map(L=>L.replace(":"," is ")).join(" and ")}. `,(0,C.jsx)(H,{to:`?${(()=>{let L=new URLSearchParams(o);return L.delete("filter"),L.toString()})()}`,style:{...V,...A},children:"Show all"})]}):null,(0,C.jsx)("p",{style:{...A,margin:0,display:"flex",flexWrap:"wrap",gap:"4px 16px"},children:Jt(e,u).map((L,T)=>(0,C.jsx)(H,{to:`/${j(t.schema,L)}`,style:{...Ue,...A},...T===0?{"data-testid":"place-as-list"}:{},children:(0,C.jsxs)(Xe,{children:["All ",(L===u.kind?p:Q(t,L)).toLowerCase()," as a list"]})},L))})]}),(0,C.jsx)("div",{"data-testid":"place-lens","data-flows":O?"":void 0,...O?{}:{role:"group","aria-label":u.title,tabIndex:0},style:O?{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",maxWidth:"100%"}:{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",maxWidth:"100%",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)"},onClick:L=>{let T=L.target?.closest("[data-graview-pick]"),ne=T?.getAttribute("data-graview-pick"),J=T?.getAttribute("data-graview-joins");if(J)try{let xe=JSON.parse(J);if(Array.isArray(xe)&&xe.every($e=>typeof $e=="string")){L.preventDefault(),s({at:nt(u),ids:xe});return}}catch{}if(!ne)return;let z=t.graph.getNode(ne);z&&(L.preventDefault(),r(Y(t.schema,z.kind,ne)))},children:(0,C.jsx)(Br.Provider,{value:E!==void 0?bi:ki,children:(0,C.jsx)(jn,{context:e,place:u,filter:g,...i?.at===nt(u)?{chosen:i.ids}:{}})})}),G.length>0?(0,C.jsx)("div",{style:{maxWidth:760,display:"grid",gap:40},"data-testid":"place-creators",children:G.map(({affordance:L,mutation:T})=>(0,C.jsxs)("section",{style:{...re,display:"grid",gap:14},children:[(0,C.jsx)("h2",{style:ae,children:T.title??T.name}),T.description?(0,C.jsx)("p",{style:{...A,margin:0,maxWidth:"58ch"},children:T.description}):null,(0,C.jsx)(Fe,{store:t,mutation:T,prefilled:L.args,open:L.open,label:L.label,...n?{principal:n}:{}})]},L.id))}):null]})}function Ai(e,t=document){let n=_t(e);if(!n)return null;let a=[t,...[...t.querySelectorAll("[data-worker-view]")].flatMap(r=>r.shadowRoot?[r.shadowRoot]:[])];for(let r of a)for(let o of r.querySelectorAll("[id], [data-section]")){let l=o.getAttribute("data-section")??o.id;if(l===e||_t(l)===n)return o}for(let r of a)for(let o of r.querySelectorAll("h1, h2, h3, h4, h5, h6, [role=heading]"))if(_t(o.textContent??"")===n)return o;return null}function So(e,t={}){if(typeof document>"u"||typeof requestAnimationFrame>"u")return()=>{};let n=t.frames??120,a=0,r=()=>{let o=Ai(e,t.root??document);if(o){o.hasAttribute("tabindex")||o.setAttribute("tabindex","-1"),o.scrollIntoView?.({block:"start"}),o.focus({preventScroll:!0});return}n-=1,n>0&&(a=requestAnimationFrame(r))};return a=requestAnimationFrame(()=>{a=requestAnimationFrame(r)}),()=>cancelAnimationFrame(a)}var q=I(Ne(),1);var en=I(Ne(),1);var at=I(U(),1);function vo({context:e}){return ie()?(0,at.jsxs)(at.Fragment,{children:[(0,at.jsx)(Ci,{context:e}),(0,at.jsx)(jr,{face:"pages",on:e.quickAsk??!0})]}):null}function Ci({context:e}){let{store:t}=e,n=ie(),{pathname:a}=me(),r=(0,en.useRef)(n?.setSelection);return r.current=n?.setSelection,(0,en.useEffect)(()=>{let o=r.current;if(!o)return;let[,l,i]=a.split("/"),s=(()=>{if(l==="places"){let g=e.views?.places().find(k=>k.as===decodeURIComponent(i??""));return g?[Ie(g.kind)]:[]}let c=l?Se(t.schema,l):void 0;return c&&i?[decodeURIComponent(i)]:c?[Fa(c)]:[]})();o(c=>c.length===s.length&&c.every((g,k)=>g===s[k])?c:s)},[a]),null}var be=I(Ne(),1);var ko=I(ni(),1);var ge=I(U(),1);var Ri=Ht(Ia(()=>(__graviewPreload(import.meta.url,["./chunk.QB7RYJ67.js","./chunk.UGFDSE37.js","./chunk.EC7I33WI.js","./chunk.GVUJCOKD.js","./chunk.3ZONBC6L.js","./chunk.MDWCX3YU.js","./chunk.CB5DGKR5.js","./chunk.GKLDSHHH.js","./chunk.OCV46AFN.js","./chunk.4KTHJY5N.js","./chunk.PZ4G5QA5.js","./chunk.Y36MLVMT.js","./chunk.MPMROUZA.js","./chunk.XTT6ERI3.js","./chunk.5RH6FO3K.js","./chunk.L7MFTL5S.js","./chunk.XZJ6XX5I.js","./chunk.4F5M5XZG.js","./chunk.LVOL2LEC.js","./chunk.3G5DEGFA.js","./chunk.OZ4EJ5M6.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.GZHZLJBF.js","./chunk.PZWJUQAO.js","./chunk.OJGHDWI6.js","./chunk.NEJSKMJV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.DTJ4FIHM.js")).then(e=>({default:e.TakeBack}))));function Li({context:e,docked:t,at:n,...a}){let{store:r}=e,o=ee(r),[l]=(0,be.useState)(()=>r.batches().length),i=(0,be.useRef)(!1);return i.current||=o>0||!t&&l>0,i.current?(0,ge.jsx)(be.Suspense,{fallback:null,children:(0,ge.jsx)(Ri,{context:e,docked:t,at:n,since:l,...a})}):null}function Ti(e,t,n){let{store:a,principal:r,embedded:o}=e;(0,be.useEffect)(()=>{if(!n)return;let l=i=>{if(!Jr(i))return;let s=i.target,c=s instanceof Node&&t.current?.contains(s),g=s===document.body||s===document.documentElement||s===document;if(!(!c&&!(g&&!o))&&Zr(a,r)){i.preventDefault();try{Xr(a,r)}catch{}}};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[a,r,o,t,n])}function xo({context:e,registry:t,root:n,children:a}){let r=(0,be.useMemo)(co,[]),o=t?.without()??new Set;return Ti(e,n,!o.has("undo")),(0,ge.jsxs)(St.Provider,{value:r,children:[(0,ge.jsx)(Ei,{context:e,placed:r,without:o}),a]})}function Ei({context:e,placed:t,without:n}){let[a,r]=(0,be.useState)(!1);(0,be.useLayoutEffect)(()=>r(!0),[]);let o=vt(t,"find"),l=vt(t,"undo"),i=me(),s=xr();if(!a)return null;let c=i.pathname.split("/").filter(Boolean),k=(c.length===1?Se(e.store.schema,c[0]):void 0)!==void 0;return(0,ge.jsxs)(ge.Fragment,{children:[!o&&!n.has("find")&&s?(0,ko.createPortal)((0,ge.jsx)(bo,{context:e,narrowsLists:k}),s.slot):null,!o&&!n.has("find")&&!s?(0,ge.jsx)("div",{"data-testid":"face-find-bar",style:{display:"flex",alignItems:"center",padding:"8px 16px",borderBottom:"1px solid var(--graview-edge)",background:"var(--graview-bar)",minWidth:0},children:(0,ge.jsx)(bo,{context:e,narrowsLists:k})}):null,!l&&!n.has("undo")?(0,ge.jsx)(Li,{context:e,docked:!0,at:i.pathname+i.search}):null,s?.own&&!n.has("undo")?(0,ge.jsx)(oo,{context:e,own:s.own}):null]})}function bo({context:e,narrowsLists:t}){return(0,ge.jsx)(St.Provider,{value:null,children:(0,ge.jsx)(qn,{context:e,narrowsLists:t})})}var te=I(Ne(),1);var ke=I(U(),1),Mi=500,Ni=10;function tn(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA"||e.tagName==="SELECT"?!0:e.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(e.type):!1}function Oi(e){let t=typeof getSelection=="function"?getSelection():null;return t!==null&&!t.isCollapsed&&t.containsNode(e,!0)}function Po(e){let t=e.closest('a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])');if(t)return t;let n=document.activeElement;return n instanceof HTMLElement&&n!==document.body?n:null}function Ao({context:e,root:t,children:n}){return ie()===null?(0,ke.jsx)(ke.Fragment,{children:n}):(0,ke.jsx)($i,{context:e,root:t,children:n})}function $i({context:e,root:t,children:n}){let{setMenuAt:a}=qa(),{store:r}=e,o=r.schema,l=Ge(),{pathname:i,search:s}=me(),c=Je("/").replace(/\/$/,""),g=(0,te.useCallback)((w,h)=>e.views?.places().find(R=>R.as===w&&(h===null||R.kind===h)),[e.views]),k=(0,te.useCallback)((w,h)=>{let[R="",$,Z]=w.split("/").filter(Boolean).map(m=>{try{return decodeURIComponent(m)}catch{return m}});if(Z!==void 0)return null;if(R==="places"&&$!==void 0){let m=g($,new URLSearchParams(h).get("of"));return m?{face:"pages",place:m.as,about:[Ie(m.kind)],title:m.title}:null}let X=Se(o,R);return X?$===void 0?{face:"pages",about:[Ie(X)],title:qe(o,X)}:r.graph.getNode($)?{face:"pages",on:$,about:[$]}:null:null},[o,r,g]),u=(0,te.useCallback)(w=>{let h=w.href;try{let R=new URL(h,location.href);if(R.origin===location.origin&&(c===""||R.pathname===c||R.pathname.startsWith(`${c}/`))){let $=k(R.pathname.slice(c.length),R.search);if($)return{...$,href:h}}}catch{}return{face:"pages",about:[],href:h}},[c,k]),p=(0,te.useCallback)(()=>k(i,s)??{face:"pages",about:[]},[k,i,s]),x=(0,te.useCallback)(w=>{let h=p(),R=w.closest("[data-graview-field]")?.getAttribute("data-graview-field");if(R&&h.on!==void 0&&w.closest("[data-graview-pick], a[href]")===null)return{...h,field:R};let $=w.closest("[data-graview-act]")?.getAttribute("data-graview-act");if($)return{...h,act:$};let Z=w.closest("a[href]"),X=w.closest("[data-graview-listed]"),m=[w.closest("[data-graview-pick]")?.getAttribute("data-graview-pick"),X&&(!Z||X.contains(Z)&&Z.classList.contains("graview-spec-item-link"))?X.getAttribute("data-graview-listed"):null].map(_=>_?r.graph.getNode(_):void 0).find(Boolean);if(m)return{face:"pages",on:m.id,about:[m.id],href:`${c}${Y(o,m.kind,m.id)}`};if(Z)return u(Z);let M=w.closest("[data-graview-record]")?.getAttribute("data-graview-record");return M&&r.graph.getNode(M)?{face:"pages",on:M,about:[M]}:h},[p,u,r,o,c]),O=(0,te.useCallback)(w=>{let h=t.current;if(h===null||!h.contains(w)||tn(w)||w.closest("[data-graview-popover]"))return null;let R=x(w);return{face:"pages",on:R.on,about:R.about??[],field:R.field,place:R.place,href:R.href,act:R.act,element:Po(w)}},[x,t]),W=(0,te.useCallback)((w,h,R)=>{let $=x(w);a({...$,x:Math.round(h),y:Math.round(R),returnTo:Po(w)})},[x,a]),P=(0,te.useCallback)(w=>{let h=w.getBoundingClientRect();W(w,h.left+Math.min(16,h.width/2),Math.min(h.bottom,h.top+36))},[W]),E=(0,te.useRef)(0),b=(0,te.useRef)(null),G=(0,te.useRef)(!1),L=()=>{b.current&&clearTimeout(b.current.timer),b.current=null};(0,te.useEffect)(()=>L,[]),(0,te.useEffect)(()=>{let w=h=>{if(h.defaultPrevented||!(h.key==="ContextMenu"||h.key==="F10"&&h.shiftKey))return;let R=t.current,$=h.target instanceof Element?h.target:null,Z=$===null||$===document.body||$===document.documentElement,X=R!==null&&$!==null&&R.contains($);if(!X&&!(Z&&document.querySelector("[data-graview-face='pages']")===R)||tn($)||$?.closest("[data-graview-popover]"))return;h.preventDefault(),E.current=Date.now();let m=X&&$ instanceof HTMLElement?$:R?.querySelector("[data-graview-page-title], main h1, main")??null;m&&P(m)};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[t,P]),(0,te.useEffect)(()=>{let w=t.current;if(!w)return;let h=R=>{let $=R.detail;$&&a({...$,face:"pages"})};return w.addEventListener(Cn,h),()=>w.removeEventListener(Cn,h)},[t,a]);let T=(0,te.useMemo)(()=>w=>{if(w.face!=="pages")return null;let h=[],R=w.on===void 0?void 0:r.graph.getNode(w.on),$=w.place===void 0?void 0:e.views?.places().find(de=>de.as===w.place),Z=R?void 0:w.about.length===1&&w.about[0].startsWith("aggregate:")&&!$?Hi(w.about[0]):void 0,X=R?Y(o,R.kind,R.id):$?fe(e,$):Z?`/${j(o,Z)}`:void 0,m=X!==void 0&&i===X.split("?")[0];X!==void 0&&!m&&h.push({id:"open",label:"Open",run:()=>l(X)});let M=X!==void 0?`${c}${X}`:w.href;M!==void 0&&h.push({id:"open-in-a-new-tab",label:"Open in a new tab",run:()=>void window.open(M,"_blank","noopener")});let _=R?`#focus=${encodeURIComponent(R.id)}`:$?`#focus=${encodeURIComponent(Ie($.kind))}&view=${encodeURIComponent($.as)}`:Z?`#focus=${encodeURIComponent(Ie(Z))}`:void 0;if(_!==void 0&&(e.overview||!e.embedded)){let de=e.overview;h.push({id:"in-the-scene",label:"Show in the scene",run:()=>de?de(_):location.assign(`${e.sceneHref??"/"}${_}`)})}return R===void 0&&w.href===void 0&&h.push({id:"find",label:"Find\u2026",run:()=>{let de=t.current?.querySelector('[data-testid="nav-find"]')??document.querySelector('[data-testid="nav-find"]');de&&de.offsetParent!==null?de.focus():l("/search")}}),h.length>0?{id:"pages",items:h}:null},[r,o,e,i,c,l,t]),ne=(0,te.useMemo)(()=>w=>{if(w.face!=="pages"||w.field===void 0||w.on===void 0)return null;let h=r.graph.getNode(w.on),R=w.element?.closest("[data-graview-field]")??t.current?.querySelector(`[data-graview-field="${CSS.escape(w.field)}"]`);return!h||!(R instanceof HTMLElement)||!R.hasAttribute("data-graview-editable")?null:{id:"field",at:"start",items:[{id:"change-field",label:`Change \u201C${ka(o.tryDefinition(h.kind),w.field)}\u201D`,run:()=>R.click()}]}},[r,o,t]),J=zr(),z=yr(),xe=$r(),$e=(0,te.useCallback)((w,h)=>{i===fe(e,w).split("?")[0]&&l(h?fe(e,h):"/")},[i,e,l]),Pe=Qr($e),Ae=(0,te.useMemo)(()=>[ne,xe,T,...Pe?[Pe]:[],...z?[z]:[],...J?[J]:[]],[ne,xe,T,Pe,z,J]);return(0,ke.jsxs)(ur,{sections:Ae,children:[(0,ke.jsx)("div",{"data-graview-menu-ground":"",style:{display:"contents"},onContextMenu:w=>{let h=w.target;w.shiftKey||tn(h)||Oi(h)||(w.preventDefault(),!h.closest("[data-graview-popover]")&&(Date.now()-E.current<700||(w.clientX===0&&w.clientY===0&&h instanceof HTMLElement?P(h):W(h,w.clientX,w.clientY))))},onPointerDown:w=>{if(G.current=!1,w.pointerType==="mouse"||!w.isPrimary)return;let h=w.target;if(tn(h)||h.closest("[data-graview-choose], [data-graview-popover]"))return;L();let{clientX:R,clientY:$}=w;b.current={x:R,y:$,timer:setTimeout(()=>{b.current=null,G.current=!0,E.current=Date.now(),W(h,R,$)},Mi)}},onPointerMove:w=>{let h=b.current;h&&Math.hypot(w.clientX-h.x,w.clientY-h.y)>Ni&&L()},onPointerUp:L,onPointerCancel:L,onClickCapture:w=>{G.current&&(G.current=!1,w.preventDefault(),w.stopPropagation())},children:n}),(0,ke.jsx)(Ii,{openAt:P,readyAt:O}),(0,ke.jsx)(Yr,{placement:"page"}),(0,ke.jsx)(hr,{})]})}function Hi(e){let t=e.slice(10).split("+");return t.length===1&&t[0]?t[0]:void 0}function Ii({openAt:e,readyAt:t}){return(0,ke.jsx)("span",{"data-graview-menu-home":"",tabIndex:-1,onFocus:n=>{if(n.target!==n.currentTarget)return;let a=n.currentTarget.closest("[data-graview-face]"),r=a?.querySelector("[data-graview-page-title]")??a?.querySelector("main h1, main")??null;r&&(r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),r.focus({preventScroll:!0}))},style:{position:"absolute",width:0,height:0,overflow:"hidden"},children:(0,ke.jsx)(Vr,{placement:"menu",openActs:e,aimAt:t})})}var K=I(U(),1);function Co(e,t){return t==="*"?{label:"anything",path:null}:{label:Q(e,t),path:`/${j(e.schema,t)}`}}function Fi({context:e,relation:t}){let{store:n}=e,a=Co(n,t.from),r=Co(n,t.to),o=l=>l.path?(0,K.jsx)(H,{to:l.path,style:{...we,fontWeight:550},children:l.label}):(0,K.jsx)("span",{children:l.label});return(0,K.jsxs)("li",{"data-testid":"relation","data-relation":t.edgeKind,style:{display:"grid",gridTemplateColumns:"30px minmax(0, 1fr) auto",gap:12,alignItems:"baseline"},children:[(0,K.jsx)(_r,{edgeKind:t.edgeKind,...e.brand?.kit?{kit:e.brand.kit}:{}}),(0,K.jsxs)("span",{style:{display:"grid",gap:1},children:[(0,K.jsxs)("span",{children:[o(a)," ",(0,K.jsxs)("span",{style:A,"data-graview-speaks-ids":"",children:[Ye(t.edgeKind)," \u2192"]})," ",o(r)]}),t.description||t.inverse?(0,K.jsxs)("span",{style:A,children:[t.description?Ce(t.description):null,t.description&&t.inverse?" \xB7 ":null,t.inverse?`from the other end, ${t.inverse}`:null]}):null]}),r.path?(0,K.jsx)(H,{to:`${r.path}?with=${encodeURIComponent(t.edgeKind)}`,style:{...V,...A,fontVariantNumeric:"tabular-nums",display:"inline-block",minWidth:24,minHeight:24,textAlign:"center"},title:`The ${r.label.toLowerCase()} that have this`,children:t.count}):(0,K.jsx)("span",{style:{...A,fontVariantNumeric:"tabular-nums"},children:t.count})]})}function Ro({context:e,heading:t=!0}){let{store:n}=e,a=new Set(De(n,e.principal)),r=tt(n).relations.filter(o=>a.has(o.from)&&(o.to==="*"||a.has(o.to)));return r.length===0?null:(0,K.jsxs)("section",{style:{...re,display:"grid",gap:12},"data-testid":"kind-map",children:[t?(0,K.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,K.jsx)("h2",{style:ae,children:(0,K.jsx)(H,{to:"/map",style:we,children:"Connections"})}),(0,K.jsx)("span",{style:A,children:r.length===1?"1 relation":`${r.length} relations`})]}):null,(0,K.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:r.map(o=>(0,K.jsx)(Fi,{context:e,relation:o},`${o.edgeKind}|${o.from}|${o.to}`))})]})}function Xn({context:e}){let{store:t}=e;ee(t);let n=new Set(De(t,e.principal)),a=tt(t),r=a.relations.filter(o=>n.has(o.from));return(0,K.jsxs)(oe,{context:e,children:[(0,K.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,K.jsx)("p",{style:he,children:r.length===0?"No relations":`${r.length} ${r.length===1?"relation":"relations"}`}),(0,K.jsx)(le,{context:e,children:"Connections"}),(0,K.jsx)("p",{style:se,children:r.length===0?"Nothing here is declared to relate to anything else yet.":"The kinds this installation holds, and the relations declared between them \u2014 each in the declaration's own words, with how many of it there are."})]}),(0,K.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},"data-testid":"map-kinds",children:a.kinds.filter(o=>n.has(o.kind)).map(o=>(0,K.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,K.jsx)(ue,{kind:o.kind,brand:e.brand,schema:t.schema,size:7}),(0,K.jsx)(H,{to:`/${j(t.schema,o.kind)}`,style:V,children:o.plural}),(0,K.jsx)("span",{style:A,children:o.count})]},o.kind))}),(0,K.jsx)(Ro,{context:e,heading:!1})]})}function Lo({context:e}){let n=[...ie()?.robots.values()??[]].filter(r=>r.mode==="asking"&&r.say);if(n.length===0)return null;let{store:a}=e;return(0,K.jsxs)("section",{style:{...re,display:"grid",gap:10},"data-testid":"seat-questions",children:[(0,K.jsx)("h2",{style:ae,children:n.length===1?"The seat asked something":`The seat asked ${n.length} things`}),(0,K.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8},children:n.map(r=>{let o=r.at?a.graph.getNode(r.at):void 0;return(0,K.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,K.jsx)("span",{children:r.say}),o?(0,K.jsxs)(H,{to:Y(a.schema,o.kind,o.id),style:{...V,...A},children:[pe(a.schema.tryDefinition(o.kind),o)," \u2192"]}):null]},r.participant)})})]})}var B=I(U(),1);function Jn({context:e}){let{principal:t}=e,{store:n,brand:a,invariantContext:r}=e;ee(n);let o=n.violations(r),l=`${o.length===1?"A rule is broken":"Rules are broken"} \u2014 see what, and what would fix it`,i=[...n.log.all()].slice(-5).reverse(),c=Zt(e).map(P=>({kind:P,members:n.graph.nodesOfKind(P).filter(E=>st(n.schema.tryDefinition(P),E))})),g=c.filter(P=>P.members.length>0),k=c.map(P=>({entry:P,creator:n.allMutations().find(E=>(E.creates??[]).includes(P.kind)&&n.permits({name:E.name,args:{}},e.principal).ok)})).find(P=>P.creator!==void 0),u=g.length===0?"Nothing here yet.":`${g.map(P=>Mt(n.schema,P.kind,P.members.length)).join(", ").replace(/, ([^,]*)$/," and $1")}.`,p=e.views?.homeView?.(),x=n.schema.kinds.some(P=>n.graph.nodesOfKind(P).length>0);if(p&&x){let P=a?.subtitle&&a.subtitleDrawn!==!1?(0,B.jsx)("p",{style:{...A,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,E=p[Symbol.for("graview.home-blocks")]===!0;return(0,B.jsx)(oe,{context:e,style:pt,children:(0,B.jsxs)("div",{style:{display:"grid",gap:12},"data-testid":"home-view",children:[E?null:P,o.length>0?(0,B.jsx)(H,{to:"/problems",style:{...V,color:"var(--graview-warn)"},children:l}):null,(0,B.jsx)(Kr.Provider,{value:E?P:null,children:(0,B.jsx)(gt,{when:dt(p),children:(0,B.jsx)(p,{cardinality:"many",fidelity:"full",mode:"fullscreen",selected:!1})})})]})})}let O=new Set(De(n,e.principal)),W=tt(n).relations.filter(P=>O.has(P.from)&&(P.to==="*"||O.has(P.to)));return(0,B.jsxs)(oe,{context:e,style:pt,children:[(0,B.jsxs)("header",{style:{display:"grid",gap:12},children:[a?.subtitle&&a.subtitleDrawn!==!1?(0,B.jsx)("p",{style:{...A,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,(0,B.jsx)(le,{context:e,"data-testid":"standing",children:u}),(0,B.jsxs)("p",{style:{...se,display:"grid",gap:4},"data-testid":"standing-card",children:[g.length===0&&k?(0,B.jsxs)("span",{children:["Begin with \u201C",k.creator?.title??k.creator?.name,"\u201D, under"," ",(0,B.jsx)(H,{to:`/${j(n.schema,k.entry.kind)}`,style:V,children:Q(n,k.entry.kind)}),"."]}):null,o.length===0?(0,B.jsx)("span",{children:"All rules hold."}):(0,B.jsx)(H,{to:"/problems",style:{...V,color:"var(--graview-warn)"},children:l})]})]}),(0,B.jsx)(Yn,{context:e}),(0,B.jsxs)("section",{style:{...re,display:"grid",gap:14},"data-testid":"kinds",children:[(0,B.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,B.jsx)("h2",{style:ae,children:"What is here"}),W.length>0?(0,B.jsx)(H,{to:"/map",style:{...Ue,...A,marginLeft:"auto"},"data-testid":"map-link",children:(0,B.jsxs)(Xe,{children:["Connections \xB7 ",W.length===1?"1 relation":`${W.length} relations`]})}):null]}),(0,B.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"8px 10px"},children:c.map(({kind:P,members:E})=>(0,B.jsx)("li",{style:{maxWidth:"100%"},children:(0,B.jsxs)(H,{to:`/${j(n.schema,P)}`,style:{...we,flexWrap:"wrap",gap:8,padding:"6px 14px 6px 10px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)"},children:[(0,B.jsx)(ue,{kind:P,brand:a,schema:n.schema,size:7}),(0,B.jsx)("span",{style:{fontWeight:550,overflowWrap:"anywhere"},children:Q(n,P)}),(0,B.jsx)("span",{style:{...A,fontVariantNumeric:"tabular-nums"},children:E.length===0?"none yet":ht(E.length)})]})},P))})]}),i.length>0?(0,B.jsxs)("section",{style:{...re,display:"grid",gap:10},children:[(0,B.jsx)("h2",{style:ae,children:"Recently"}),(0,B.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:i.map(P=>(0,B.jsxs)("li",{style:A,children:[(0,B.jsx)("span",{style:{color:"var(--graview-ink)"},children:P.intent})," \u2014 ",wt(P,t,{graph:n.graph,schema:n.schema,...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}})]},P.id))})]}):null]})}var To=I(Ne(),1);function Eo(e,t){(0,To.useEffect)(()=>{let n=globalThis[Symbol.for("graview.shown-lists")]??=new Map;return n.set(e,()=>t),()=>void n.delete(e)})}var ea=e=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.6YGRRXJB.js")).then(t=>t.saveShownList(e.read()));function Mo(e,t,n){let a={off:e,about:t,read:n,menu:(r,o,l)=>[...e?[]:[{id:"export-csv",label:"Export CSV",run:()=>void ea(a)}],...r&&o?[{id:e?"export-on":"export-off",label:e?"Turn on export":"Turn off export",run:()=>void (__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.6YGRRXJB.js")).then(i=>i.switchExport(a,o,e,l))}]:[]]};return a}function ta(e){let{schema:t,graph:n,kind:a,nodes:r,arrangement:o,offers:l,declaredGroup:i}=e,s=t.tryDefinition(a),c=Gt(o.query??""),g=[...o.filter??[],...c.conditions],k=g.some(T=>T.key==="is"&&(T.value==="past"||T.value==="any"))||Pr(s,g),u=k||!s?.lifecycle?o:{...o,filter:[...o.filter??[],{key:"is",value:"current"}]},p=new Map,x=Bt(r,u,{schema:t,graph:n,...e.flagged?{flagged:e.flagged}:{},...e.today!==void 0?{today:e.today}:{},read:(T,ne)=>{let J=p.get(T.id);return J||p.set(T.id,J=Ze(t,n,T)),J[ne]}}),O=x.grouped&&!!o.group?.by,W=i&&o.group?.by===i.by&&!o.group.bucket?l.groups.find(T=>T.key===i.by):void 0,P=i&&W&&(W.type==="choice"||W.type==="boolean")?br(x.groups,i,{type:W.type,...W.options?{options:W.options}:{}}):x.groups.map(T=>({...T,closed:!1})),E=!!o.query||(o.filter??[]).some(T=>T.key===i?.by),b=T=>W?.type==="boolean"?T==="1"?"true":"false":T,G=e.opened??new Set,L=P.map(T=>{let ne=b(T.key);return{...T,value:ne,shut:T.closed&&!E&&!G.has(ne)}});return{arrangement:u,showingPast:k,arranged:x,grouped:O,groups:L,nodes:O?L.flatMap(T=>T.shut?[]:T.nodes):x.nodes}}var Te=I(Ne(),1);var rt=I(U(),1);function nn({context:e,withheld:t,style:n,testId:a}){let r=ie(),o=Ma(t,e.signIn??r?.signIn);return o?(0,rt.jsx)("p",{style:{...n,margin:0},children:(0,rt.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>o.run(),style:ve,children:o.label})}):t.length===0?null:(0,rt.jsx)("ul",{style:{...n,margin:0,padding:0,listStyle:"none",display:"grid",gap:4},...a?{"data-testid":a}:{},children:t.map(l=>(0,rt.jsxs)("li",{style:A,children:[(0,rt.jsx)("s",{children:l.label})," \u2014 ",l.refusal.message]},l.id))})}var N=I(U(),1);function na({context:e}){let{store:t,brand:n,principal:a,invariantContext:r}=e;ee(t);let[o]=ut(),l=o.get("q")??"",i=typeof r?.today=="string"?r.today:void 0,s=Tr(t,l,{...a?{principal:a}:{},places:Oe(e),flagged:new Set(t.violations(r).flatMap(p=>p.nodeIds)),...i?{today:i}:{},limit:200}),c=s.hits.filter(p=>p.about==="node"),g=s.hits.filter(p=>p.about==="kind"||p.about==="place"||p.about==="rule"),k=[...new Set(c.map(p=>p.kind))],u=l.trim();return(0,N.jsxs)(oe,{context:e,children:[(0,N.jsx)("style",{children:Qt}),(0,N.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,N.jsx)("p",{style:he,children:"Search"}),(0,N.jsx)(le,{context:e,"data-testid":"search-heading",children:u.length===0?"Find anything by its name":s.hits.length===0?(0,N.jsxs)(N.Fragment,{children:["Nothing here is called \u201C",u,"\u201D."]}):(0,N.jsxs)(N.Fragment,{children:[Di(t,s.byKind)," for \u201C",u,"\u201D"]})}),u.length>0?(0,N.jsxs)("p",{style:{...A,margin:0},"data-testid":"search-searched",children:[Kt(t.schema,s.searched),s.conditions.filter(p=>p.key!=="is"&&p.admittedBy.length<s.searched.kinds.length).map(p=>(0,N.jsxs)("span",{children:[" ",p.key,":",p.value," narrows"," ",p.admittedBy.length===0?"nothing here":p.admittedBy.map(x=>Q(t,x).toLowerCase()).join(" and "),"."]},`${p.key}:${p.value}`))]}):(0,N.jsxs)("p",{style:se,children:["Type in the box above. Words find the start of words in names and in what each record says;"," ",(0,N.jsx)("code",{children:"done:false"})," and the like narrow as a list does, and ",(0,N.jsx)("code",{children:"is:any"})," includes what is past."]})]}),g.length>0?(0,N.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},"data-testid":"search-named",children:g.map(p=>(0,N.jsx)("li",{"data-testid":"search-hit","data-about":p.about,children:p.about==="kind"?(0,N.jsxs)(H,{to:`/${j(t.schema,p.kind)}`,style:V,children:[p.label,p.count>0?(0,N.jsxs)("span",{style:A,children:[" \xB7 ",p.count," match"]}):null]}):p.about==="place"?(0,N.jsxs)(H,{to:fe(e,p),style:V,children:["Go to ",p.title]}):p.about==="rule"?(0,N.jsxs)(H,{to:"/problems",style:V,children:["The rule \u201C",p.label,"\u201D"]}):null},`${p.about}:${p.about==="rule"?p.name:p.about==="place"?p.as:p.kind}`))}):null,k.map(p=>(0,N.jsxs)("section",{className:"graview-list",style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",minWidth:0},"data-testid":"search-group","data-kind":p,children:[(0,N.jsxs)("h2",{className:"graview-group-head",style:{alignItems:"center"},children:[(0,N.jsx)(ue,{kind:p,brand:n,schema:t.schema,size:8}),(0,N.jsx)(H,{to:`/${j(t.schema,p)}?${new URLSearchParams({q:u}).toString()}`,style:V,"data-testid":"search-kind-link",children:Q(t,p)}),(0,N.jsx)("span",{children:s.byKind[p]})]}),(0,N.jsx)("ul",{className:"graview-rows",children:c.filter(x=>x.kind===p).map(x=>(0,N.jsxs)("li",{"data-testid":"search-hit","data-about":"node",className:"graview-row",children:[(0,N.jsxs)(H,{to:Y(t.schema,p,x.id),className:"graview-row-title",...x.label.length>60?{title:x.label}:{},children:[x.flagged?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,x.label]}),x.apart||!x.current?(0,N.jsx)("span",{className:"graview-row-glance",children:[x.apart,x.current?"":"past"].filter(Boolean).join(" \xB7 ")}):null,(0,N.jsx)(an,{why:x.why})]},x.id))})]},p)),u.length>0?(0,N.jsx)(Wi,{asked:u}):null,u.length>0&&s.hits.length===0?(0,N.jsx)(Oo,{store:t,kinds:s.searched.kinds,words:s.words,...a?{principal:a}:{},...r?{invariantContext:r}:{}}):null]})}function an({why:e}){return e.strength==="near"?(0,N.jsxs)("span",{style:A,"data-testid":"search-why","data-near":"",children:["Near \u201C",e.asked,"\u201D",e.field==="label"?"":` \u2014 ${e.reading}: ${e.fragment}`]}):e.field==="label"?null:(0,N.jsxs)("span",{style:A,"data-testid":"search-why",children:[e.reading,": ",e.fragment]})}function Di(e,t){let n=Object.entries(t).map(([a,r])=>`${r} ${r===1?Qe(e.schema.tryDefinition(a),a):Q(e,a).toLowerCase()}`);return n.length===0?"Found":n.length===1?Ce(n[0]):Ce(`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`)}function No(e,t,n={}){let a=[];for(let r of t){let o=et(e,r,{...n.principal?{principal:n.principal}:{},...n.invariantContext?{context:n.invariantContext}:{}});for(let l of rn(e,r,o.actions.affordances))a.some(i=>i.mutation.name===l.mutation.name)||a.push(l)}return a}function rn(e,t,n){let a=e.schema.tryDefinition(t)?.fieldRoles?.label,r=[];for(let o of n){let l=e.allMutations().find(c=>c.name===o.mutation);if(!l||!l.creates?.includes(t)||r.some(c=>c.mutation.name===l.name))continue;let i=wr(l.input).map(c=>c.name),s=i.includes("label")?"label":a&&i.includes(a)?a:void 0;!s||o.args[s]!==void 0||r.push({kind:t,affordance:o,mutation:l,arg:s})}return r}function Oo({store:e,kinds:t,words:n,principal:a,invariantContext:r}){let o=No(e,t,{...a?{principal:a}:{},...r?{invariantContext:r}:{}});return o.length===0||n.trim().length===0?null:(0,N.jsx)("div",{style:{display:"grid",gap:24},"data-testid":"search-to-create",children:o.map(({kind:l,affordance:i,mutation:s,arg:c})=>(0,N.jsxs)("section",{style:{...re,display:"grid",gap:14},children:[(0,N.jsxs)("h2",{style:ae,children:[Ce(xa(Qe(e.schema.tryDefinition(l),l)))," called \u201C",n,"\u201D"]}),(0,N.jsx)(Fe,{store:e,mutation:s,prefilled:i.args,open:i.open,initial:{[c]:n},...a?{principal:a}:{}})]},`${i.id}|${n}`))})}function Wi({asked:e}){let t=ie();return t?(0,N.jsx)(Gi,{asked:e,desk:t.aiDesk}):null}function Gi({asked:e,desk:t}){return Qa(t)?(0,N.jsx)("p",{style:{margin:0},children:(0,N.jsxs)("button",{type:"button","data-testid":"search-ask",onClick:a=>Ya(t,{pointed:{about:[]},asked:e,returnTo:a.currentTarget}),style:{...V,font:"inherit",padding:0,border:0,background:"transparent",cursor:"pointer",textAlign:"start"},children:["Ask: \u2018",e,"\u2019"]})}):null}var f=I(U(),1),Ho=8,Io=40;function Ki(e,t){let n=t?.fields?.shape??{},a=Object.keys(n).find(r=>Aa(n[r])&&Pa(e[r]));return a===void 0?void 0:e[a]}function aa({context:e}){let t=Ve(),n=Se(e.store.schema,t.slug??"");return n?(0,f.jsx)(Fo,{context:e,kind:n}):(0,f.jsx)(oe,{context:e,children:(0,f.jsx)(le,{context:e,children:"No such kind of thing here."})})}function Fo({context:e,kind:t,opening:n,row:a,layout:r="list",description:o,bare:l}){let{store:i,brand:s,invariantContext:c}=e;ee(i);let[g,k]=ut(),u=`list-${(0,Te.useId)().replace(/:/g,"")}`,p=i.schema.tryDefinition(t),x=Ra(g.get("archived")),O=i.graph.nodesOfKind(t,{archived:x}),W=tt(i).relations.filter(d=>d.from===t||d.to===t),P=new Set(i.violations(c).flatMap(d=>d.nodeIds)),E=Rr(i.schema,Cr(i.schema,Ar(i.schema,t))),b=W.map(d=>d.edgeKind),G=_i(g,E,b),L=["sort","filter","group","q","by","with","past","archived",...b].some(d=>g.has(d)),T=O.length>=Io,ne=p?.fieldRoles?.when,J=e.views?.arrangement?.()?.lists?.[t],z=vr(J),xe=Sr(J?.group),$e=ji(T,ne),Pe=n??(z?{...$e,...z}:$e),Ae=L?G.arrangement:On(Pe,E).arrangement,w=z?.sort,h=Ae.sort&&w?.then&&Ae.sort.by===w.by&&Ae.sort.direction===w.direction?{...Ae,sort:w}:Ae,R=Gt(h.query??""),$=new Set((g.get("open")??"").split(",").filter(Boolean)),Z=ta({schema:i.schema,graph:i.graph,kind:t,nodes:O,arrangement:h,offers:E,declaredGroup:xe,flagged:P,...typeof c?.today=="string"?{today:c.today}:{},opened:$}),{showingPast:X,arranged:m}=Z,M=Z.groups,_=ie(),de=Mo(J?.export===!1,{kind:t},()=>({title:Q(i,t),schema:i.schema,graph:i.graph,kind:t,groups:Z.groups,grouped:Z.grouped,onExport:e.onExport??_?.onExport,words:{labelOf:pe,readableFields:Dt,withComputed:Ze}}));Eo(`list:${t}`,de);let Uo=d=>d.shut,Vo=d=>{let y=new URLSearchParams(g),F=new Set($);F.has(d)?F.delete(d):F.add(d),F.size>0?y.set("open",[...F].join(",")):y.delete("open"),k(y,{replace:!0})},Ee=m.nodes,_e=p?.lifecycle&&!X?O.filter(d=>st(p,d)):O,sa=O.length-_e.length,la=h.group?.by??null,jo=d=>{let y=new URLSearchParams(g);for(let ce of["sort","filter","group","q","by","with","past","archived",...W.map(Tt=>Tt.edgeKind)])y.delete(ce);let F=Er(d);for(let ce of["sort","filter","group","q","archived"])F[ce]&&y.set(ce,F[ce]);![...y.keys()].some(ce=>["sort","filter","group","q"].includes(ce))&&(n||z||T||ne)&&y.set("sort",""),k(y)},{principal:ot}=e,dn=et(i,t,{...ot?{principal:ot}:{},...e.invariantContext?{context:e.invariantContext}:{}}),We=dn.actions.affordances.map(d=>({affordance:d,mutation:i.allMutations().find(y=>y.name===d.mutation)})).filter(d=>d.mutation!==void 0),_o=dn.actions.withheld,cn=()=>new Set(Ee.length===0?We.map(({mutation:d})=>d.name):[]),[pn,da]=(0,Te.useState)(()=>({kind:t,open:cn()}));pn.kind!==t&&da({kind:t,open:cn()});let ca=d=>(pn.kind===t?pn.open:cn()).has(d),pa=(d,y)=>da(F=>{let ce=new Set(F.open);return y?ce.add(d):ce.delete(d),{kind:F.kind,open:ce}}),ua=`begin-${(0,Te.useId)().replace(/:/g,"")}`,ga=R.words&&Ee.length===0?Object.fromEntries(rn(i,t,dn.actions.affordances).map(d=>[d.mutation.name,d.arg])):{},ze=Q(i,t),Pt=e.views?.lookup(t,{cardinality:"one",fidelity:"glyph"}),un=Pt!==void 0&&!lt(Pt)?Pt:void 0,gn=(h.group?.bucket??"day")==="day"?h.group?.by:void 0,mn=(h.filter??[]).map(d=>d.key),zo=mn.filter(d=>mn.indexOf(d)===mn.lastIndexOf(d)&&/choice|boolean/.test(E.filters.find(y=>y.key===d)?.type??"")),fn=d=>{let y={...p?.computed?Ze(i.schema,i.graph,d):d};gn&&!String(y[gn]).includes("T")&&delete y[gn];for(let F of zo)delete y[F];return y},ma=d=>ir(p?.fields?.shape?.[d])?.type==="enum",At=d=>{let y=pe(p,d);if(a)return(0,f.jsxs)("li",{"data-testid":"record-row","data-graview-record":d.id,style:{minWidth:0},...bn(d.id),children:[vn(d,y),a(d,{label:y,href:Y(i.schema,t,d.id),flagged:P.has(d.id),glance:ao(fn(d),p,y)})]},d.id);if(un){let kn=jt(Pt,d,i.graph),ei=Object.fromEntries(Object.entries(fn(d)).filter(([ti])=>!kn?.fields.has(ti))),va=kn?Dn(ei,p,kn.title??y,ma):[];return(0,f.jsxs)("li",{"data-testid":"record-row","data-graview-record":d.id,style:{position:"relative",display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:16,rowGap:2,paddingBlock:10,borderTop:"1px solid var(--graview-edge)"},...bn(d.id),children:[vn(d,y),(0,f.jsx)("div",{style:{flex:"1 1 14rem",minWidth:0},children:(0,f.jsx)(un,{node:d,cardinality:"one",fidelity:"glyph",mode:"fullscreen",selected:!1,...P.has(d.id)?{flagged:[d.id]}:{}})}),va.length>0?(0,f.jsx)("span",{style:{...A,flex:"0 1 auto",minWidth:0,overflowWrap:"anywhere"},"data-testid":"record-glance",children:(0,f.jsx)(Wn,{runs:va})}):null,(0,f.jsx)(Qi,{to:Y(i.schema,t,d.id),label:P.has(d.id)?`${y} \u2014 implicated in a problem`:y})]},d.id)}let F=Dn(fn(d),p,y,ma),ce=F.length>0,Tt=R.words?Lr(p,d,R.words):void 0,wa=T?void 0:lr(d,p),Et=Ki(d,p),Sa=(0,f.jsxs)(H,{to:Y(i.schema,t,d.id),className:"graview-row-title",...y.length>60?{title:y}:{},children:[P.has(d.id)?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,y]});return(0,f.jsxs)("li",{className:"graview-row","data-graview-record":d.id,...bn(d.id),children:[vn(d,y),wa?(0,f.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:14,minWidth:0},children:[(0,f.jsx)(ct,{as:"thumb",file:wa}),Sa]}):Sa,ce||Et?(0,f.jsxs)("span",{className:"graview-row-glance",children:[(0,f.jsx)(Wn,{runs:F}),ce&&Et?" \xB7 ":null,Et?(0,f.jsx)(qt,{address:Et}):null]}):null,Tt?(0,f.jsx)(an,{why:Tt}):null]},d.id)},yn=Oe(e).filter(d=>d.kind===t&&!d.hidden),fa=J?.filters,Yo=(h.filter??[]).some(d=>d.key!=="is"||d.value!=="any"),Qo=!!(h.sort||h.group||h.query||Yo),Zo=_e.length>=Ho||L&&Qo,He=h.sort?E.sorts.find(d=>d.key===h.sort.by):void 0,hn=He?.type==="date"||He!==void 0&&He.key===ne,ya=T&&!m.grouped&&He&&(He.about==="label"||He.type==="text"||hn)?d=>{let y=He.about==="label"?pe(p,d):d[He.key];if(typeof y!="string"||y.length===0)return hn?"No date":"#";if(hn)return y.slice(0,4);let F=y.trim().charAt(0).toLocaleUpperCase();return/\p{L}/u.test(F)?F:"#"}:void 0,Ct=ya?Ee.reduce((d,y)=>{let F=ya(y);return d.at(-1)?.key===F?d.at(-1).nodes.push(y):d.push({key:F,nodes:[y]}),d},[]):void 0,ha=Z.nodes,wn=(0,Te.useMemo)(()=>ha.map(d=>d.id),[ha.map(d=>d.id).join(`
6
- `)]),Me=Hr(wn),Sn=(0,Te.useId)(),ft=(ot?i.permittedMutations(ot):i.permittedMutations()).some(d=>{let y=d.subject?.kinds;return y!==void 0&&(y==="*"||y.includes(t))}),vn=(d,y)=>ft?(0,f.jsx)("span",{className:"graview-choose-at",children:(0,f.jsx)("input",{...Me.boxProps(d.id,y),onPointerEnter:$n,onFocus:$n})}):null,bn=d=>ft?{"data-graview-choose":d}:{},Xo=(0,Te.useCallback)(d=>{Me.choose(d),requestAnimationFrame(()=>{let y=Me.list.current;((d[0]===void 0?null:y?.querySelector(`[data-graview-choose-box="${CSS.escape(d[0])}"]`))??y)?.focus({preventScroll:!0})})},[Me]),it=r==="grid"?{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 15rem), 1fr))",alignItems:"start",gap:12}:a||un?{margin:0,padding:0,listStyle:"none",display:"grid",gap:a&&r==="list"?6:0}:void 0,Rt=it?void 0:"graview-rows",yt=d=>`list-at-${d.replace(/[^\p{L}\p{N}]/gu,"_")}`,Lt=W.map(d=>{let y=d.from===t?d.to:d.from,F=d.from===t?d.description:d.inverse??d.description;return{relation:d,far:y,words:F}}),Jo=new Set(Lt.map(d=>(d.words??"").toLowerCase()).filter((d,y,F)=>d&&F.indexOf(d)!==y));return(0,f.jsxs)(l?Vi:oe,{context:e,children:[(0,f.jsxs)("div",{style:{display:"grid",gap:12},children:[(0,f.jsxs)("header",{style:{display:"grid",gap:4},children:[l?null:(0,f.jsx)(mt,{context:e}),(0,f.jsxs)("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",columnGap:10,rowGap:4,minWidth:0},children:[(0,f.jsx)(ue,{kind:t,brand:s,schema:i.schema,size:8}),(0,f.jsx)(le,{context:e,children:ze}),We.length>0?(0,f.jsx)("span",{style:{marginLeft:"auto",display:"flex",flexWrap:"wrap",columnGap:14,rowGap:8},"data-testid":"beginnings-open",children:We.map(({affordance:d,mutation:y})=>(0,f.jsx)(zi,{name:y.name,title:y.title??y.name,panel:`${ua}-${y.name}`,open:ca(y.name),onOpen:F=>pa(y.name,F)},d.id))}):null,!de.off&&_e.length>0?(0,f.jsxs)("button",{type:"button","data-testid":"list-export","aria-label":"Export CSV",title:"Export CSV",onClick:()=>void ea(de),style:{...we,minHeight:28,margin:"-4px 0",...We.length>0?{}:{marginLeft:"auto"},padding:"0 2px",border:0,background:"none",font:"inherit",color:"var(--graview-ink-muted)",cursor:"pointer"},children:[(0,f.jsx)("span",{"aria-hidden":"true",style:{marginRight:4},children:"\u2193"}),"CSV"]}):null]}),Ee.length>0?(0,f.jsx)(eo,{place:"here",to:[{label:`Skip to the ${Ee.length===1?Qe(p,t):`${Ee.length} ${ze.toLowerCase()}`}`,testid:"records",go:()=>{let d=document.querySelector(`[data-graview-skip-target="${CSS.escape(Sn)}"]`);Hn(d?.querySelector('[data-graview-choose-box][tabindex="0"]')??d)}},..._e.length>0?[{label:"Skip to arranging them",testid:"arranging",go:()=>{let d=document.querySelector(`[data-graview-skip-target="${CSS.escape(Sn)}"]`)?.parentElement?.querySelector('[role="group"][aria-label="Arrange"]');Hn(d?.querySelector('button[data-testid$="-add"], button[data-testid$="-all"]')??d)}}]:[]]}):null,o??p?.description?(0,f.jsx)("p",{style:se,children:o??p?.description}):null,Lt.length>0||yn.length>0?(0,f.jsxs)("p",{style:{...A,margin:0,display:"flex",flexWrap:"wrap",columnGap:18,rowGap:2},"data-testid":"kind-related",children:[Lt.length>0?(0,f.jsxs)("span",{"data-testid":"kind-relations",children:["Related:"," ",Lt.map(({relation:d,far:y,words:F},ce)=>(0,f.jsxs)("span",{"data-relation":d.edgeKind,children:[ce>0?(0,f.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,y==="*"?Ce(F??Ye(d.edgeKind)):(0,f.jsx)(H,{to:`/${j(i.schema,y)}`,style:V,title:Q(i,y),children:F&&Jo.has(F.toLowerCase())?`${Ce(F)}: ${Q(i,y).toLowerCase()}`:Ce(F??Q(i,y))})]},`${d.edgeKind}|${d.from}|${d.to}`))]}):null,yn.length>0?(0,f.jsxs)("span",{"data-testid":"kind-pictures",children:["Also as:"," ",yn.map((d,y)=>(0,f.jsxs)("span",{children:[y>0?(0,f.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,f.jsx)(H,{to:fe(e,d),style:V,children:d.title})]},nt(d)))]}):null]}):null]}),We.length>0?(0,f.jsx)("div",{style:{display:"contents"},"data-testid":"beginnings",children:We.map(({affordance:d,mutation:y})=>{let F=!!(ga[y.name]&&Ee.length===0);return(0,f.jsx)(Yi,{name:y.name,id:`${ua}-${y.name}`,description:y.description,open:ca(y.name),onClose:()=>pa(y.name,!1),children:(0,f.jsx)(Fe,{store:i,mutation:y,prefilled:d.args,open:d.open,...F?{initial:{[ga[y.name]]:R.words}}:{},...e.principal?{principal:e.principal}:{}},F?`${y.name}|${R.words}`:y.name)},d.id)})}):null,G.dropped.length>0?(0,f.jsxs)("p",{style:{...A,margin:0},"data-testid":"list-dropped",children:["This link asked for ",G.dropped.join(", "),", which ",ze.toLowerCase()," cannot be arranged by; the rest is shown."]}):null,_e.length>0?(0,f.jsx)(Or,{schema:i.schema,graph:i.graph,kind:t,arrangement:h,onChange:jo,kept:{shown:Ee.length,of:_e.length},noun:{one:Qe(p,t),many:ze.toLowerCase()},...Zo?{}:{allow:!1},...fa?{filters:fa}:{},offers:E,chips:{nodes:_e,flagged:P,...typeof c?.today=="string"?{today:c.today}:{}},query:e.framed===!0&&e.barAbove!==!0}):null,(0,f.jsx)("style",{children:Qt}),ft?(0,f.jsx)("style",{children:Ir+Ui}):null,(0,f.jsx)("div",{className:"graview-list","data-graview-skip-target":Sn,...ft?{...Me.listProps,ref:Me.list,tabIndex:-1,"data-graview-choosable":"","aria-label":Me.chosen.length>0?`${ze}, ${Me.chosen.length} chosen`:ze,role:"group"}:{},children:Ee.length===0&&R.words?(0,f.jsxs)("p",{style:se,"data-testid":"none-yet",children:["Nothing here is called \u201C",R.words,"\u201D."," ",(0,f.jsx)("span",{style:A,"data-testid":"list-searched",children:Kt(i.schema,{kinds:[t],past:X})})," ",(0,f.jsx)(H,{to:"?",style:V,children:"Show every one"})]}):Ee.length===0?(0,f.jsxs)("p",{style:se,"data-testid":"none-yet",children:[h.filter?.length||h.query?"None of them.":"None yet",!h.filter?.length&&!h.query&&We.length>0?` \u2014 the first one starts above, with \u201C${We[0]?.mutation.title??We[0]?.mutation.name}\u201D.`:!h.filter?.length&&!h.query?".":"",h.filter?.length||h.query?(0,f.jsxs)(f.Fragment,{children:[" ",(0,f.jsx)(H,{to:"?",style:V,children:"Show every one"})]}):null]}):m.grouped&&la?(0,f.jsx)("div",{style:{display:"grid",gap:"1rem"},"data-testid":"records","data-grouped":la,children:M.map(d=>{if(!d.closed)return(0,f.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group",children:[(0,f.jsxs)("h2",{className:"graview-group-head",children:[d.label," ",(0,f.jsx)("span",{children:d.nodes.length})]}),(0,f.jsx)("ul",{style:it,className:Rt,"data-graview-rows":"",children:d.nodes.map(At)})]},d.key||"-");let y=Uo(d),F=`${u}-${yt(d.key||"none")}`;return(0,f.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group","data-closed":y?"shut":"open",children:[(0,f.jsx)("h2",{className:"graview-group-head",children:(0,f.jsxs)("button",{type:"button",className:"graview-group-toggle","aria-expanded":!y,"aria-controls":F,"data-testid":"list-group-toggle",onClick:()=>Vo(d.value),children:[(0,f.jsx)("span",{"aria-hidden":"true",children:y?"\u25B8":"\u25BE"}),d.label," ",(0,f.jsxs)("span",{children:["\xB7 ",d.nodes.length]}),(0,f.jsxs)("span",{style:Bi,children:[" ",d.nodes.length===1?Qe(p,t):ze.toLowerCase()]})]})}),(0,f.jsx)("ul",{id:F,style:y?{...it,display:"none"}:it,className:Rt,"data-graview-rows":"",hidden:y,children:y?null:d.nodes.map(At)})]},d.key||"-")})}):Ct&&Ct.length>1?(0,f.jsxs)("div",{style:{display:"grid",gap:14},"data-testid":"records","data-sectioned":He?.type==="date"?"year":"letter",children:[(0,f.jsx)("nav",{"aria-label":"Jump to","data-testid":"list-index",style:{...A,display:"flex",flexWrap:"wrap",gap:He?.type==="date"?"0 10px":"0 4px",lineHeight:1.3},children:Ct.map(d=>(0,f.jsx)("a",{href:`#${yt(d.key)}`,onClick:y=>{y.preventDefault(),document.getElementById(yt(d.key))?.scrollIntoView({block:"start"})},style:{...we,minWidth:24,justifyContent:"center"},children:d.key},d.key))}),Ct.map(d=>(0,f.jsxs)("section",{"data-testid":"list-section","aria-labelledby":yt(d.key),style:{display:"grid",gap:0},children:[(0,f.jsx)("h2",{id:yt(d.key),className:"graview-group-head",children:d.key}),(0,f.jsx)("ul",{style:it,className:Rt,"data-graview-rows":"",children:d.nodes.map(At)})]},d.key))]}):(0,f.jsx)("ul",{style:it,className:Rt,"data-testid":"records","data-graview-rows":"",children:Ee.map(At)})}),ft?(0,f.jsx)(Fr,{store:i,chosen:Me.chosen,...ot?{principal:ot}:{},...c?{context:c}:{},anchor:qi,of:wn.length,onChooseAll:()=>Me.choose(wn),onClear:Me.clear,onActed:Xo}):null,sa>0?(0,f.jsxs)(H,{to:$o(g,"filter","is:any"),style:{...V,...A,justifySelf:"start"},"data-testid":"past-link",children:["+",sa," past"]}):null,x===!1&&i.graph.count(t,{archived:!0})>0?(0,f.jsxs)(H,{to:$o(g,"archived","true"),style:{...V,...A,justifySelf:"start"},"data-testid":"archived-link",children:["+",i.graph.count(t,{archived:!0})," archived"]}):null]}),(0,f.jsx)(nn,{context:e,withheld:_o,style:re,testId:"withheld"})]})}var Bi={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},qi=()=>document.querySelector("[data-graview-choosable]")?.closest("[data-embed-content]")??null,Ui=`
7
- .graview-list[data-graview-choosable]{outline:none}
8
- .graview-list [data-graview-choose]{position:relative;padding-left:34px}
9
- .graview-choose-at{position:absolute;left:2px;top:0;bottom:0;z-index:${Na.raised};display:flex;align-items:center}
10
- @media (min-width: 900px) and (pointer: fine){
11
- .graview-list [data-graview-choose]{padding-left:0}
12
- .graview-choose-at{left:-34px}
13
- }
14
- @media (pointer: coarse){
15
- .graview-list:not([data-graview-choosing]) [data-graview-choose]{padding-left:0}
16
- .graview-list:not([data-graview-choosing]) .graview-choose-at{display:none}
17
- }
18
- `;function Vi({children:e}){return(0,f.jsx)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40,minWidth:0},children:e})}var ji=(e,t)=>t?{sort:{by:t,direction:"desc"}}:e?{sort:{by:"label",direction:"asc"}}:{};function _i(e,t,n){let a=$t({...e.get("sort")?{sort:e.get("sort")}:{},...e.get("filter")?{filter:e.get("filter")}:{},...e.get("group")?{group:e.get("group")}:{},...e.get("q")?{q:e.get("q")}:{},...e.get("archived")?{archived:e.get("archived")}:{}}),r=[...a.filter??[]],o=e.get("by"),l=a.group??(o?{by:o}:void 0);for(let s of n){let c=e.get(s);c&&r.push({key:s,value:c})}let i=e.get("with");return i&&r.push({key:i,value:"*"}),e.get("past")==="1"&&!r.some(s=>s.key==="is")&&r.push({key:"is",value:"any"}),On({...a.sort?{sort:a.sort}:{},...a.query?{query:a.query}:{},...r.length>0?{filter:r}:{},...l?{group:l}:{},...a.archived!==void 0?{archived:a.archived}:{}},t)}function $o(e,t,n){let a=new URLSearchParams(e);return a.set(t,n),a.delete("past"),`?${a.toString()}`}function zi({name:e,title:t,panel:n,open:a,onOpen:r}){return(0,f.jsxs)("button",{type:"button","data-testid":`act-open-${e}`,"data-graview-act":e,"aria-expanded":a,"aria-controls":n,onClick:()=>{r(!a),a||requestAnimationFrame(()=>document.getElementById(n)?.querySelector("input, select, textarea, button")?.focus())},style:{...we,minHeight:28,margin:"-4px 0",padding:"0 2px",border:0,background:"none",font:"inherit",fontWeight:600,color:"var(--graview-ink)",cursor:"pointer"},children:[(0,f.jsx)("span",{"aria-hidden":"true",style:{marginRight:6},children:a?"\u2212":"+"}),t]})}function Yi({name:e,id:t,description:n,open:a,onClose:r,children:o}){return(0,f.jsxs)("div",{"data-testid":`act-${e}`,id:t,hidden:!a,onKeyDown:l=>{l.key==="Escape"&&(l.preventDefault(),r(),document.querySelector(`[aria-controls="${t}"]`)?.focus())},style:a?{display:"grid",gap:12,padding:"4px 0 12px"}:void 0,children:[n?(0,f.jsx)("p",{style:{...A,margin:0,maxWidth:"58ch"},children:n}):null,o]})}function Qi({to:e,label:t}){let n=(0,Te.useRef)(null);return Dr(n),(0,f.jsx)(H,{ref:n,to:e,"aria-label":t,style:{position:"absolute",inset:0,borderRadius:6}})}var Be=I(Ne(),1);var xt=I(Ne(),1);var D=I(U(),1);function ra({context:e}){let{store:t,brand:n,invariantContext:a,principal:r}=e;ee(t);let o=t.violations(a),l=t.allInvariants(),i=It(t,o),s=Za(t.schema,l);return(0,D.jsxs)(oe,{context:e,children:[(0,D.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,D.jsx)(le,{context:e,children:o.length===0?"All rules hold":"What is broken"}),(0,D.jsx)("p",{style:se,"data-testid":"problems-count",children:o.length===0?"Every declared rule is satisfied by what is here.":La(o)})]}),(0,D.jsx)(Lo,{context:e}),i.map((c,g)=>{let k=c.nodeIds[0],u=k?t.graph.getNode(k):void 0;return(0,D.jsxs)("section",{style:{display:"grid",gap:10,padding:"16px 18px",borderLeft:"3px solid var(--graview-warn)",background:"var(--graview-panel-warning)",borderRadius:"0 var(--graview-radius, 12px) var(--graview-radius, 12px) 0"},children:[c.line?null:(0,D.jsx)(on,{violation:c,schema:t.schema,...n?{brand:n}:{}}),u?(0,D.jsxs)("p",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[(0,D.jsx)(ue,{kind:u.kind,brand:n,schema:t.schema,size:7}),(0,D.jsx)(H,{to:Y(t.schema,u.kind,u.id),style:V,children:pe(t.schema.tryDefinition(u.kind),u)})]}):null,c.line?(0,D.jsx)(on,{violation:c,schema:t.schema,...n?{brand:n}:{}}):null,(0,D.jsx)(sn,{store:t,repairs:c.repairs,...r?{principal:r}:{}})]},g)}),l.length>0?(0,D.jsxs)("section",{style:{...re,display:"grid",gap:12},"data-testid":"rules",children:[(0,D.jsx)("h2",{style:ae,children:"The rules"}),(0,D.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:l.map(c=>{let g=o.filter(p=>p.invariant===c.name).length,k=s.get(c.name),u=c.label??c.name;return(0,D.jsxs)("li",{"data-graview-rule":c.name,style:{display:"grid",gap:2},children:[(0,D.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:12,rowGap:2},children:[k?(0,D.jsx)(Ft,{line:k,schema:t.schema,...n?{brand:n}:{},style:{flex:"1 1 18rem"}}):(0,D.jsx)("span",{style:{flex:"1 1 18rem",fontWeight:550},children:u}),(0,D.jsx)("span",{style:{...A,color:g>0?"var(--graview-warn)":"var(--graview-ink-faint)"},children:g===0?"holds":`broken in ${g} ${g===1?"place":"places"}`})]}),k&&u.trim().length>0?(0,D.jsx)("span",{style:A,children:u}):null]},c.name)})})]}):null]})}function on({violation:e,schema:t,brand:n}){if(!e.line)return(0,D.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},children:e.message});let a=Ja(e),r=Xa(e);return r?(0,D.jsxs)("div",{style:{display:"grid",gap:4},"data-testid":"problem-line",children:[(0,D.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},"data-testid":"problem-says",children:r}),a?(0,D.jsx)("span",{style:A,children:a}):null,(0,D.jsxs)("details",{"data-testid":"problem-judged",style:A,children:[(0,D.jsx)("summary",{style:{cursor:"pointer",width:"fit-content",minHeight:24},children:"How it is judged"}),(0,D.jsx)(Ft,{line:e.line,schema:t,...n?{brand:n}:{},lead:"none"})]})]}):(0,D.jsxs)("div",{style:{display:"grid",gap:2},"data-testid":"problem-line",children:[(0,D.jsx)(Ft,{line:e.line,schema:t,...n?{brand:n}:{},lead:"none",style:{color:"var(--graview-warn)"}}),a?(0,D.jsx)("span",{style:A,children:a}):null]})}function sn({store:e,repairs:t,principal:n}){let[a,r]=(0,xt.useState)(null),[o,l]=(0,xt.useState)(null),i=(0,xt.useRef)([]);if(t.length===0)return null;let s=a===null?null:t[a],c=s&&(s.missing??[]).length>0?e.allMutations().find(g=>g.name===s.mutation):void 0;return(0,D.jsxs)("div",{style:{display:"grid",gap:10},"data-testid":"repairs",children:[(0,D.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:t.map((g,k)=>{let u=(g.missing??[]).length>0,p=e.permits({name:g.mutation,args:{...g.args}},n);return p.ok?(0,D.jsx)("button",{ref:x=>{i.current[k]=x},type:"button","data-graview-repair":g.mutation,"data-graview-asks":u||void 0,"aria-expanded":u?a===k:void 0,onClick:()=>{if(l(null),u){r(a===k?null:k);return}r(null);try{e.apply({name:g.mutation,args:{...g.args}},n?{author:n}:{})}catch(x){l(Wt(e.schema,e.allMutations(),x))}},style:ve,children:u?`${g.label} \u2026`:g.label},k):(0,D.jsxs)("p",{"data-testid":"withheld","data-withheld":p.refusal.wouldNeed.join(",")||"nobody",style:{...A,margin:0},children:[(0,D.jsx)("s",{children:g.label})," \u2014 ",p.refusal.message]},k)})}),c&&s?(0,D.jsx)(Fe,{store:e,mutation:c,prefilled:{...s.args},only:s.missing??[],label:s.label,autoFocus:!0,onDone:()=>{let g=a;r(null),requestAnimationFrame(()=>{let k=g===null?null:i.current[g];if(k?.isConnected){k.focus();return}let u=document.querySelector("[data-graview-page-title]")??document.querySelector("main h1, main h2");u&&(u.hasAttribute("tabindex")||(u.tabIndex=-1),u.focus())})},...n?{principal:n}:{}}):null,s&&!c&&(s.missing??[]).length>0?(0,D.jsxs)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:In},children:["\u201C",s.label,"\u201D names ",s.mutation,", which this app does not declare."]}):null,o?(0,D.jsx)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:In},children:o}):null]})}var oa=I(Ne(),1);var je=I(U(),1);function Do({store:e,link:t,principal:n}){let[a,r]=(0,oa.useState)(!1),[o,l]=(0,oa.useState)(null),i=ar(t);return(0,je.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[(0,je.jsx)("button",{type:"button","data-graview-provisional":"",title:i,"aria-label":`Unsure link: ${i}`,"aria-expanded":a,onClick:()=>r(!a),style:{border:"1px dashed var(--graview-ink-muted)",borderRadius:999,background:"transparent",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"0.75rem",lineHeight:1,padding:"2px 6px",cursor:"pointer"},children:"unsure"}),a?(0,je.jsxs)("span",{style:{...A,display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,je.jsx)("span",{children:i}),(0,je.jsx)("button",{type:"button",style:{...ve,padding:"4px 10px"},onClick:()=>{try{e.apply({name:Ta,args:{kind:t.edge.kind,from:t.edge.from,to:t.edge.to}},n?{author:n}:{}),r(!1)}catch(s){l(Wt(e.schema,e.allMutations(),s))}},children:"Keep this link"}),o?(0,je.jsx)("span",{role:"alert",children:o}):null]}):null]})}var ye=I(U(),1);function Wo({nodeId:e,node:t,field:n,inPlace:a,labelStyle:r=he}){return n.files?(0,ye.jsx)(ct,{as:"field",read:!a,nodeId:e,field:n.key,label:n.label,files:n.files,labelStyle:r,style:{gap:4}}):n.long?(0,ye.jsx)(Nr,{nodeId:e,field:n.key,label:n.label,value:n.value,markdown:n.markdown,style:{gridColumn:"1 / -1",gap:4},labelStyle:r,valueStyle:{lineHeight:1.6}}):(0,ye.jsxs)("div",{style:{display:"grid",gap:2,minWidth:0,alignContent:"start"},children:[(0,ye.jsx)("dt",{style:r,children:n.label}),(0,ye.jsx)("dd",{style:{margin:0,overflowWrap:"anywhere",minWidth:0},children:n.linked?(0,ye.jsx)(gr,{relation:n.linked.relation,refs:n.linked.refs,...a?{nodeId:e,field:n.key}:{}}):n.app?(0,ye.jsx)(qt,{address:n.app,as:"record",...a?{nodeId:e,field:n.key}:{}}):n.href?(0,ye.jsx)(Mr,{href:n.href,field:n.key,value:n.value,stored:n.stored,...a?{nodeId:e}:{}}):a?(0,ye.jsxs)(ye.Fragment,{children:[(0,ye.jsx)(Ut,{nodeId:e,field:n.key,value:n.value,stored:n.stored}),n.repeats?(0,ye.jsx)(mr,{nodeId:e,field:n.key,start:t?.[n.key],value:t?.[`${n.key}Repeat`],label:`${n.label} repeats`}):null]}):n.value})]})}var S=I(U(),1),Zi=[];function ia({context:e}){let{store:t,brand:n,principal:a,invariantContext:r}=e;ee(t);let o=ie()!==null,l=Ve(),i=decodeURIComponent(l.id??""),s=uo(t,i,{...a?{principal:a}:{},...r?{context:r}:{}}),c=It(t,s?.violations??Zi),[g,k]=(0,Be.useState)(null),[u,p]=(0,Be.useState)(!1),[x,O]=(0,Be.useState)(null),W=(0,Be.useRef)(null),P=(0,Be.useRef)(null),E=fr({flow:"both",letters:!0}),b=m=>{(W.current?.parentElement?.querySelector(`[data-affordance="${m.replace(/["\\]/g,"\\$&")}"]`)??W.current)?.focus()};if(!s)return(0,S.jsx)(oe,{context:e,children:(0,S.jsx)(le,{context:e,children:"Nothing lives at this address."})});let G=t.graph.getNode(i),L=t.schema.tryDefinition(s.kind),T=L?.describe&&G?tr(L,G):null,ne=[...t.log.all()].filter(m=>!Nt(m)&&(m.writes.includes(i)||m.reads.includes(i))).slice(-8).reverse(),J=t.log.all().find(m=>!Nt(m)&&m.undoes===void 0&&m.primitives.some(M=>M.op==="add-node"&&M.node.id===i)),z=s.actions.affordances.filter(m=>m.provider!=="invariant"),xe=z.filter(m=>m.destructive||m.setsAside),$e=u||xe.length<2?z:z.filter(m=>!xe.includes(m)),Pe=e.views?.lookup(s.kind,{cardinality:"one",fidelity:"full"}),Ae=Pe!==void 0&&!lt(Pe)?Pe:void 0,w=Ae&&G?jt(Pe,G,t.graph):void 0,h=w?s.fields.filter(m=>!w.fields.has(m.key)):s.fields,R=w?s.links.flatMap(m=>{let M=m.targets.filter(_=>!w.records.has(_.id));return M.length>0?[{...m,targets:M}]:[]}):s.links,$=Ae!==void 0&&_a(Pe),Z=o&&sr(L).length>0,X=Oe(e).filter(m=>!m.hidden&&(m.kind===s.kind||m.across===s.kind));return(0,S.jsxs)(oe,{context:e,children:[(0,S.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,S.jsx)(mt,{context:e}),(0,S.jsx)(le,{context:e,children:o&&G?.label===s.label?(0,S.jsx)(Ut,{nodeId:i,field:"label",value:s.label,said:s.label}):s.label}),T&&T!==s.label?(0,S.jsx)("p",{style:se,children:T}):null,J?.lineage?(0,S.jsxs)("p",{style:{...A,margin:0},"data-testid":"record-lineage",children:["Made by ",wt(J,a,{graph:t.graph,schema:t.schema,...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}}),", ",Rn(J.lineage)]}):null,(0,S.jsx)(Gn,{context:e,stop:`#focus=${encodeURIComponent(i)}`,style:{...Ue,...A},"data-testid":"spatial-link"}),o&&G?(0,S.jsx)(En,{choices:[{on:"changed",record:i},{on:"act",record:i},{on:"reaches",kind:s.kind,condition:"",record:i}],label:"Notify me when this changes",testId:"record-notify",style:{...ve,...A,justifySelf:"start"}}):null,X.length>0?(0,S.jsx)(Xi,{context:e,places:X}):null]}),G&&Ca(G)?(0,S.jsx)(ts,{context:e,id:i,kind:s.kind}):null,G&&Ea(t,i)?(0,S.jsx)(es,{context:e,id:i,kind:s.kind}):null,Ae&&G?(0,S.jsx)("section",{"data-testid":"record-view",style:{display:"grid",minWidth:0},children:(0,S.jsx)(Wr,{children:(0,S.jsx)(gt,{when:dt(Pe),children:(0,S.jsx)(Ae,{node:G,cardinality:"one",fidelity:"full",mode:"fullscreen",selected:!1,...s.violations.length>0?{flagged:[i]}:{}})})})}):null,s.violations.length>0?(0,S.jsx)("section",{"data-testid":"record-violations",style:{display:"grid",gap:12,padding:"16px 18px",borderLeft:"3px solid var(--graview-warn)",background:"var(--graview-panel-warning)",borderRadius:"0 var(--graview-radius, 12px) var(--graview-radius, 12px) 0"},children:c.map((m,M)=>(0,S.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,S.jsx)(on,{violation:m,schema:t.schema,...n?{brand:n}:{}}),(0,S.jsx)(sn,{store:t,repairs:go(s.actions,m.repairs),...a?{principal:a}:{}})]},M))}):null,!$&&(h.length>0||Z)?(0,S.jsxs)("section",{style:{...re,display:"grid",gap:14},"data-testid":"record-fields",children:[(0,S.jsx)("h2",{style:ae,children:"The facts"}),nr(L,h).map((m,M)=>{let _=(0,S.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"14px 24px"},children:m.fields.map(de=>(0,S.jsx)(Wo,{nodeId:i,node:G,field:de,inPlace:o},de.key))});return m.title?(0,S.jsxs)("section",{style:{display:"grid",gap:10,minWidth:0},children:[(0,S.jsx)("h3",{"data-graview-field-group":m.title,style:{...ae,fontSize:"inherit"},children:m.title}),_]},M):(0,S.jsx)("div",{children:_},M)}),Z?(0,S.jsx)(ct,{as:"unfilled",nodeId:i,skip:[...w?.fields??[]],labelStyle:he,style:{gap:4}}):null]}):null,($?[]:R).map(m=>(0,S.jsxs)("section",{style:{...re,display:"grid",gap:10},children:[(0,S.jsx)("p",{style:he,children:no(t,m)}),m.description?(0,S.jsx)("h2",{style:ae,children:Ce(m.description)}):(0,S.jsxs)("h2",{style:ae,"aria-label":Ye(m.edgeKind),children:[m.direction==="in"?"\u2190 ":"\u2192 ",Ye(m.edgeKind)]}),(0,S.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},children:m.targets.map(M=>{let _=rr(t,m.direction==="in"?{kind:m.edgeKind,from:M.id,to:i}:{kind:m.edgeKind,from:i,to:M.id});return(0,S.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,S.jsx)(ue,{kind:M.kind,brand:n,schema:t.schema,size:7}),(0,S.jsxs)(H,{to:Y(t.schema,M.kind,M.id),style:V,children:[M.label,M.apart?(0,S.jsxs)("span",{style:A,children:[" \xB7 ",M.apart]}):null]}),_?.provisional?(0,S.jsx)(Do,{store:t,link:_,...a?{principal:a}:{}}):null]},M.id)})}),(m.direction==="out"&&t.schema.edge(m.edgeKind)?.cardinality==="one"?[]:[...new Set(m.targets.map(M=>M.kind))]).map(M=>(0,S.jsx)(H,{to:`/${j(t.schema,M)}?${encodeURIComponent(m.edgeKind)}=${encodeURIComponent(i)}`,style:{...Ue,...A},"data-testid":"related-all",children:(0,S.jsxs)(Xe,{children:["Sort and filter ",m.description??`these ${Q(t,M).toLowerCase()}`,m.targets.some(_=>_.kind!==M)?` (${Q(t,M).toLowerCase()})`:""]})},M))]},`${m.edgeKind}|${m.direction}|${m.description??""}`)),!$&&(z.length>0||s.actions.withheld.length>0)?(0,S.jsxs)("section",{style:{...re,display:"grid",gap:14},"data-testid":"record-actions",children:[(0,S.jsx)("h2",{style:ae,ref:W,tabIndex:-1,children:"What can be done"}),(0,S.jsxs)("div",{role:"toolbar","aria-label":"What can be done",...E,style:{display:"flex",flexWrap:"wrap",gap:8},children:[$e.map(m=>{let M=g===m.id;return(0,S.jsx)("button",{type:"button","data-affordance":m.id,"data-rank":m.rank,"data-graview-act":m.mutation,[Tn]:"",autoFocus:u&&m===xe[0],"aria-expanded":M,onClick:()=>k(M?null:m.id),style:{...ve,...M?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},children:m.label},m.id)}),$e.length<z.length?(0,S.jsxs)("button",{type:"button","aria-expanded":!1,onClick:()=>p(!0),style:{...ve,...A},"data-testid":"record-actions-more",[Tn]:"",children:["Show ",z.length-$e.length," more"]}):null]}),z.map(m=>{if(g!==m.id)return null;let M=t.allMutations().find(_=>_.name===m.mutation);return M?(0,S.jsxs)("div",{ref:P,onKeyDown:_=>{if(_.key!=="Escape"||_.defaultPrevented)return;_.preventDefault(),k(null);let de=m.id;requestAnimationFrame(()=>b(de))},style:{display:"grid",gap:10,padding:18,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,S.jsx)("h3",{style:ae,children:m.label}),M.description?(0,S.jsx)("p",{style:{...A,margin:0},children:M.description}):null,(0,S.jsx)(Fe,{store:t,mutation:M,prefilled:m.args,open:m.open,label:m.label,autoFocus:!0,onDone:()=>{k(null),O(m.mutation);let _=m.id;requestAnimationFrame(()=>b(_))},...a?{principal:a}:{}})]},m.id):null}),o&&x!==null&&g===null?(0,S.jsx)(En,{choices:[{on:"act",act:x,record:i},{on:"act",act:x}],label:"Notify me when someone else does this",testId:"notify-after-act",style:{...ve,...A,justifySelf:"start"}}):null,(0,S.jsx)(nn,{context:e,withheld:s.actions.withheld})]}):null,o?(0,S.jsx)(to,{id:i,style:re,headingStyle:ae}):null,ne.length>0?(0,S.jsxs)("section",{style:{...re,display:"grid",gap:10},"data-testid":"record-history",children:[(0,S.jsx)("h2",{style:ae,children:"What has happened"}),(0,S.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:ne.map(m=>(0,S.jsxs)("li",{style:A,children:[(0,S.jsx)("span",{style:{color:"var(--graview-ink)"},children:m.intent}),m.lineage?(0,S.jsxs)("span",{"data-graview-lineage":"",children:[" \xB7 ",Rn(m.lineage)]}):null," \u2014 ",wt(m,a,{graph:t.graph,schema:t.schema,...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}})]},m.id))})]}):null]})}function Xi({context:e,places:t}){let[n,a]=(0,Be.useState)(!1),r=(0,Be.useRef)(null),o=n||t.length<=ln+1?0:t.length-ln;return(0,S.jsxs)("p",{ref:r,style:{...A,margin:0},"data-testid":"seen-in",...n?{"data-open":""}:{},children:["Seen in:"," ",t.map((l,i)=>(0,S.jsxs)("span",{...o>0&&i>=ln?{"data-graview-later":""}:{},children:[i>0?(0,S.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,S.jsx)(H,{to:fe(e,l),style:V,children:l.title})]},nt(l))),o>0?(0,S.jsxs)(S.Fragment,{children:[" ",(0,S.jsxs)("button",{type:"button","data-graview-seen-more":"","aria-expanded":"false",style:{...V,...A,font:"inherit",background:"none",border:0,padding:0,cursor:"pointer"},onClick:()=>{a(!0),requestAnimationFrame(()=>r.current?.querySelectorAll("a")[ln]?.focus())},children:[o," more"]}),(0,S.jsx)("style",{children:Ji})]}):null]})}var ln=3,Ji="[data-graview-seen-more]{display:none!important}@media (max-width:680px){[data-graview-seen-more]{display:inline!important}[data-testid=seen-in] [data-graview-later]{display:none}}";function es({context:e,id:t,kind:n}){let{store:a,principal:r}=e,o={name:`allow-tidying-${n}`,args:{id:t}},l=a.allMutations().some(i=>i.name===o.name)&&a.permits(o,r).ok;return(0,S.jsxs)("section",{"data-testid":"record-left-alone",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,padding:"12px 16px",border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,S.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,S.jsx)("strong",{children:"Left alone."})," Nothing automated changes it; tidying passes it by."]}),l?(0,S.jsx)("button",{type:"button",style:ve,"data-testid":"allow-tidying",onClick:()=>a.apply(o,r?{author:r}:{}),children:"Allow tidying again"}):null]})}function ts({context:e,id:t,kind:n}){let{store:a,principal:r}=e,o={name:`unarchive-${n}`,args:{id:t}},l=a.allMutations().some(c=>c.name===o.name)&&a.permits(o,r).ok,i=[...a.log.all()].reverse().find(c=>!Nt(c)&&c.mergedInto!==void 0&&c.writes.includes(t)),s=i?.mergedInto!==void 0?a.graph.getNode(i.mergedInto):void 0;return(0,S.jsxs)("section",{"data-testid":"record-archived",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,padding:"12px 16px",border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,S.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,S.jsx)("strong",{children:"Archived."})," Kept with its ties and history, and out of lists, counts and rules.",s?(0,S.jsxs)(S.Fragment,{children:[" ","Merged into ",(0,S.jsx)(H,{to:Y(a.schema,s.kind,s.id),style:V,children:pe(a.schema.tryDefinition(s.kind),s)}),"."]}):null]}),l?(0,S.jsx)("button",{type:"button",style:ve,"data-testid":"bring-it-back",onClick:()=>a.apply(o,r?{author:r}:{}),children:"Bring it back"}):null]})}var v=I(U(),1),ns=Ht(()=>(__graviewPreload(import.meta.url,["./chunk.B2X6DA2Q.js","./chunk.QB7RYJ67.js","./chunk.UGFDSE37.js","./chunk.EC7I33WI.js","./chunk.GVUJCOKD.js","./chunk.3ZONBC6L.js","./chunk.MDWCX3YU.js","./chunk.CB5DGKR5.js","./chunk.GKLDSHHH.js","./chunk.OCV46AFN.js","./chunk.4KTHJY5N.js","./chunk.PZ4G5QA5.js","./chunk.Y36MLVMT.js","./chunk.MPMROUZA.js","./chunk.XTT6ERI3.js","./chunk.5RH6FO3K.js","./chunk.L7MFTL5S.js","./chunk.XZJ6XX5I.js","./chunk.4F5M5XZG.js","./chunk.LVOL2LEC.js","./chunk.3G5DEGFA.js","./chunk.OZ4EJ5M6.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.GZHZLJBF.js","./chunk.PZWJUQAO.js","./chunk.OJGHDWI6.js","./chunk.NEJSKMJV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.D6ACCKYJ.js")).then(e=>({default:e.DraftPage}))),as={kind:"human"};function rs({list:e,store:t}){let n=new Set(e.members.map(l=>l.kind)),a=e.total-e.members.length,r=n.size===1?[...n][0]:void 0;if(!r)return(0,v.jsx)("p",{className:"graview-spec-text graview-spec-more",children:`and ${a} more`});let o=qe(t.schema,r).toLowerCase();return(0,v.jsx)("p",{className:"graview-spec-text graview-spec-more",children:(0,v.jsx)(H,{to:`/${j(t.schema,r)}`,className:"graview-spec-link graview-spec-see-all","data-testid":"see-all",children:e.total===t.graph.nodesOfKind(r).length?`See all ${ht(e.total)} ${o}`:`${ht(a)} more \xB7 all ${o}`})})}function os({context:e,children:t}){let n=Ge(),a=e.store.schema,r=Je("/").replace(/\/$/,""),o=(0,q.useMemo)(()=>({href:l=>`${r}${Y(a,l.kind,l.id)}`,go:l=>n(Y(a,l.kind,l.id)),more:l=>(0,v.jsx)(rs,{list:l,store:e.store})}),[r,a,n,e.store]);return(0,v.jsx)(Vt.Provider,{value:o,children:(0,v.jsx)(Gr.Provider,{value:(e.titleLevel??(e.framed&&!e.barAbove?1:2))-1,children:t})})}var Ko=(0,q.createContext)(void 0);function is({steering:e}){let t=me(),n=Ge(),a=`${t.pathname}${t.search}`;return(0,q.useLayoutEffect)(()=>e.at(a),[a,e]),(0,q.useLayoutEffect)(()=>{let r=l=>{l!==a&&n(l)};e.go.current=r;let o=e.pending?.current;return o!==void 0&&(e.pending.current=void 0,r(o)),()=>{e.go.current===r&&(e.go.current=void 0)}},[a,n,e]),null}function ss({context:e,to:t}){let{pathname:n}=me(),a=ie(),r=(t??a)?.sayWhere,o=ls(e,n);return(0,q.useEffect)(()=>(r?.(o),()=>r?.(null)),[r,o]),null}function ls(e,t){let[n="",a,r]=t.split("/").filter(Boolean).map(l=>{try{return decodeURIComponent(l)}catch{return l}});if(r!==void 0)return"#";if(n==="places"&&a!==void 0){if(a===An)return"#overview=1";let l=e.views?.places().find(i=>i.as===a);return l?`#focus=${encodeURIComponent(Ie(l.kind))}&view=${encodeURIComponent(l.as)}`:"#"}let o=Se(e.store.schema,n);return o?`#focus=${encodeURIComponent(a??Ie(o))}`:"#"}function ds({onNavigate:e,path:t}){let n=me(),a=Kn(),r=Ge(),o=n.hash&&!n.hash.includes("=")?n.hash:"",l=`${n.pathname}${n.search}${o}`,i=(0,q.useRef)(e);i.current=e;let s=(0,q.useRef)(null);(0,q.useEffect)(()=>{let g=s.current;s.current=l,g!==null&&(l===g&&a!=="PUSH"||i.current?.(l,a==="POP"?"pop":a==="REPLACE"?"replace":"push"))},[n.key]);let c=(0,q.useRef)(t);return(0,q.useEffect)(()=>{t===void 0||t===c.current||(c.current=t,t!==l&&r(t))},[t]),null}function Go({context:e,registry:t,page:n}){let a=Ve(),r=Se(e.store.schema,a.slug??""),o=n==="list"?aa:ia,i=(r?t?.lookup(r,n):void 0)??o;return(0,v.jsx)(i,{context:e})}function cs({context:e,registry:t,children:n}){let a=(0,q.useRef)(null);return za(a),(0,v.jsx)("div",{ref:a,"data-graview-face":"pages",style:{display:"contents"},children:(0,v.jsx)(xo,{context:e,registry:t,root:a,children:(0,v.jsx)(Ao,{context:e,root:a,children:n})})})}function ps(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA"||e.tagName==="SELECT"?!0:e.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(e.type):!1}function us(){let{pathname:e}=me(),t=Kn(),n=(0,q.useRef)(null);(0,q.useLayoutEffect)(()=>{if(t!=="POP"){for(let o=n.current?.parentElement;o;o=o.parentElement){let{overflowY:l}=getComputedStyle(o);if((l==="auto"||l==="scroll")&&o.scrollHeight>o.clientHeight){o.scrollTop=0;return}}window.scrollTo(0,0)}},[e]);let a=(0,q.useRef)(e),r=(0,q.useRef)(!1);return(0,q.useEffect)(()=>{if(!r.current&&e===a.current)return;r.current=!0;let o=document.activeElement;if(ps(o))return;let l=n.current?.closest("main")??document.querySelector("main"),s=n.current?.closest("[data-graview-face]")?.querySelector("[data-graview-page-title]")??l?.querySelector("h1, h2")??null??l??null;s&&(s.hasAttribute("tabindex")||s.setAttribute("tabindex","-1"),s.focus({preventScroll:!0}))},[e]),(0,v.jsx)("span",{ref:n,hidden:!0,"data-graview-scroll-reset":""})}function Bo({context:e,children:t}){let n=Ge(),a=Je("/").replace(/\/$/,""),r=(0,q.useContext)(Ko),o=(0,q.useMemo)(()=>{let l=(s,c)=>{if("record"in s){let g=e.store.graph.getNode(s.record);return g?zt(Y(e.store.schema,g.kind,s.record),{section:c?.section}):void 0}if("place"in s){let g=e.views?.places().find(k=>k.as===s.place);return g?zt(fe(e,g),c):void 0}return e.store.schema.tryDefinition(s.list)?zt(`/${j(e.store.schema,s.list)}`,c):void 0},i=s=>{s!==void 0&&n(s)};return{record:(s,c)=>i(l({record:s},c)),place:(s,c)=>i(l({place:s},c)),list:(s,c)=>i(l({list:s},c)),draft:()=>n("/~draft"),href:(s,c)=>{let g=r===!1?void 0:l(s,c);if(g!==void 0)return r?r(g):`${a}${g}`}}},[e,n,a,r]);return(0,v.jsx)(ja.Provider,{value:o,children:t})}function gs(){let{pathname:e,search:t,hash:n}=me();return(0,q.useEffect)(()=>{let a=decodeURIComponent(n.replace(/^#/,""));if(!(!a||a.includes("=")))return So(a)},[e,t,n]),null}function ms({context:e,Home:t}){let n=me(),a=e.views,r=n.key==="default"&&!(a&&Ua(a));(0,q.useEffect)(()=>{a&&Va(a)},[a]);let o=r?Ha(e.views?.arrangement?.()?.first,e.store.schema,e.views?.places()??[]):void 0,l=o?.to==="place"?fe(e,o.place):o?.to==="kind"?`/${j(e.store.schema,o.kind)}`:void 0;return l?(0,v.jsx)(Bn,{to:l,replace:!0}):(0,v.jsx)(t,{context:e})}function qo({context:e,registry:t}){let n=t?.lookupSurface("shell"),a=n!==void 0,r=a&&(t?.without().has("bar")??!1),o=a&&!r&&!e.embedded?{...e,barAbove:!0}:e,l=O=>n===void 0?(0,v.jsx)(Xt,{context:e,children:O}):r?(0,v.jsx)(n,{context:e,children:O}):(0,v.jsx)(Xt,{context:e,children:(0,v.jsx)(n,{context:o,children:O})}),i=t?.lookupSurface("home")??Jn,s=t?.lookupSurface("problems")??ra,c=a?{...o,framed:!0}:e,[g,k]=(0,q.useState)(null),u=(0,q.useMemo)(()=>({context:c,registry:t}),[c,t]),p=(0,q.useMemo)(()=>({onFind:k,find:!(t?.without().has("find")??!1),places:!(t?.without().has("places")??!1)}),[t]),x=(0,v.jsx)(Un.Provider,{value:u,children:(0,v.jsx)(Bo,{context:e,children:(0,v.jsx)(cs,{context:e,registry:t,children:l((0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(or,{face:"pages"}),(0,v.jsxs)(os,{context:c,children:[(0,v.jsx)(us,{}),(0,v.jsx)(gs,{}),(0,v.jsxs)(so,{children:[(t?.routes()??[]).map(({path:O,component:W})=>(0,v.jsx)(Re,{path:O,element:(0,v.jsx)(W,{context:c})},O)),(0,v.jsx)(Re,{path:"/",element:(0,v.jsx)(ms,{context:c,Home:i})}),(0,v.jsx)(Re,{path:"/problems",element:(0,v.jsx)(s,{context:c})}),(0,v.jsx)(Re,{path:"/~draft",element:(0,v.jsx)(q.Suspense,{fallback:null,children:(0,v.jsx)(ns,{context:c})})}),(0,v.jsx)(Re,{path:"/search",element:(0,v.jsx)(na,{context:c})}),(0,v.jsx)(Re,{path:"/map",element:(0,v.jsx)(Xn,{context:c})}),(0,v.jsx)(Re,{path:"/places",element:(0,v.jsx)(Qn,{context:c})}),Oe(c).some(O=>O.as===An)?null:(0,v.jsx)(Re,{path:$a,element:(0,v.jsx)(Bn,{to:"/",replace:!0})}),(0,v.jsx)(Re,{path:"/places/:as",element:(0,v.jsx)(Zn,{context:c})}),(0,v.jsx)(Re,{path:"/:slug",element:(0,v.jsx)(Go,{context:c,registry:t,page:"list"})}),(0,v.jsx)(Re,{path:"/:slug/:id",element:(0,v.jsx)(Go,{context:c,registry:t,page:"record"})})]})]})]}))})})});return e.embedded||!a||r?x:(0,v.jsx)(po.Provider,{value:p,children:(0,v.jsx)(kr.Provider,{value:g,children:x})})}var fs=()=>typeof document>"u"?null:document.body;function ys({context:e,registry:t,basename:n,initialPath:a,onNavigate:r,path:o,steering:l,firstLook:i,hrefOf:s,typing:c}){let[g,k]=(0,q.useState)(void 0),u=g!==void 0&&g.from===e.principal?{...e,principal:g.seat}:e;(0,q.useState)(()=>u.views?qr(u.views,u.store.schema,Nn(u.brand,u.store.schema)):void 0);let p=ie(),x=c??u.typing;ba({reader:u.locale??p?.locale,app:u.brand?.locale??u.app?.brand?.locale,readerTimeZone:u.timeZone??p?.timeZone,appTimeZone:u.brand?.timeZone??u.app?.brand?.timeZone});let O=u.principal??as,W=Ga(u.store,O,u.history),E=(W.past&&W.live===u.store?W.past.store:u.store).seenBy(O),b=E===u.store?u:{...u,store:E};Ka(u.store,u.principal);let G=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(ds,{onNavigate:r,path:o}),l?(0,v.jsx)(is,{steering:l}):null,b.presence||p?(0,v.jsx)(ss,{context:b,to:p}):null,(0,v.jsx)(qo,{context:b,...t?{registry:t}:{}}),i?(0,v.jsx)(Ur,{firstLook:i,root:fs,app:Nn(u.brand,u.store.schema)}):null]}),L=b.views?(0,v.jsxs)(Ba,{store:b.store,views:b.views,...b.principal?{principal:b.principal}:{},...b.brand?{brand:b.brand}:{},...b.locale?{locale:b.locale}:{},...b.timeZone?{timeZone:b.timeZone}:{},...b.settings?{settings:b.settings}:{},...b.presence&&!p?{presence:b.presence}:{},...x?{typing:x}:{},...b.people?{people:b.people}:{},...b.seats?{seats:b.seats}:{},onSeat:z=>p?p.takeSeat(z):k({from:e.principal,seat:z}),...b.onKeepLens?{onKeepLens:b.onKeepLens}:{},...b.onExport?{onExport:b.onExport}:{},...b.ai?{ai:b.ai}:{},...b.subscriptions?{subscriptions:b.subscriptions}:{},dismissals:b.dismissals,whileAway:b.whileAway,...b.signIn?{signIn:b.signIn}:{},resolveApp:b.resolveApp??p?.resolveApp,linkedRecords:b.linkedRecords??p?.linkedRecords,...b.app?{app:b.app}:{},...b.menuSections?{menuSections:b.menuSections}:{},children:[G,(0,v.jsx)(Bo,{context:b,children:(0,v.jsx)(vo,{context:b})})]}):G,T=(0,v.jsx)(Wa.Provider,{value:W,children:L}),ne=b.files?(0,v.jsx)(Da.Provider,{value:b.files,children:T}):T,J=s===void 0?ne:(0,v.jsx)(Ko.Provider,{value:s,children:ne});if(a!==void 0){let z=n===void 0?a:`${n.replace(/\/$/,"")}${a}`;return(0,v.jsx)(io,{initialEntries:[z],...n===void 0?{}:{basename:n},children:J})}return(0,v.jsx)(lo,{...n===void 0?{}:{basename:n},children:J})}export{mi as a,ys as b};
@@ -1 +0,0 @@
1
- import{a as I,b as H,c as T,e as D,h as V,i as R,j as A,k,l as x,n as Y,o as Z}from"./chunk.MPMROUZA.js";import{b as U}from"./chunk.RLO3RDYH.js";import{I as C,O as G,Wa as F,X as M,_a as B,da as W,fa as j}from"./chunk.3MZIWKNG.js";function re(e,r){return e===void 0||e===!0?!0:e===!1?!1:e[r]!==!1}function te(e){let r={};return e.query&&e.query.trim().length>0&&(r.q=e.query),e.archived!==void 0&&e.archived!==!1&&(r.archived=String(e.archived)),e.sort&&(r.sort=e.sort.direction==="desc"?`${e.sort.by}:desc`:e.sort.by),e.filter?.length&&(r.filter=e.filter.map(n=>`${n.key}:${n.value}`).join(",")),e.group&&(r.group=e.group.bucket?`${e.group.by}:${e.group.bucket}`:e.group.by),r}function ne(e,r){let n=[],s={};if(e.query&&(s.query=e.query),e.archived!==void 0&&e.archived!==!1&&(s.archived=e.archived),e.sort&&(r.sorts.some(u=>u.key===e.sort.by)?s.sort=e.sort:n.push(`sort ${e.sort.by}`)),e.filter){let u=e.filter.filter(c=>r.filters.find(f=>f.key===c.key)?!0:(n.push(`filter ${c.key}`),!1));u.length>0&&(s.filter=u)}return e.group&&(r.groups.some(u=>u.key===e.group.by)?s.group=e.group:n.push(`group ${e.group.by}`)),{arrangement:s,dropped:n}}function S(e,r){return W(e.schema.tryDefinition(r.kind),A(r))}var oe=(e,r)=>e==null?r==null?0:1:r==null?-1:typeof e=="number"&&typeof r=="number"?e-r:typeof e=="boolean"&&typeof r=="boolean"?e===r?0:e?1:-1:String(e).localeCompare(String(r),void 0,{numeric:!0,sensitivity:"base"});function ie(e,r,n){if(n==="label")return S(e,r);let s=e.schema.tryDefinition(r.kind);return s&&n in(s.fields.shape??{})?F(R(r),n,e.today??C()):s?.computed?.[n]!==void 0?e.read?.(r,n):k(e.graph,r.id,n).map(c=>S(e,c)).sort()[0]}var se=/^(\d{4})-(\d{2})-(\d{2})/;function _(e,r){let n=se.exec(e);if(!n)return;let[,s,u,c]=n;if(r==="day")return`${s}-${u}-${c}`;if(r==="month")return`${s}-${u}-01`;if(r==="year")return`${s}-01-01`;if(r==="decade")return`${String(Number(s)-Number(s)%10).padStart(4,"0")}-01-01`;let a=new Date(Date.UTC(Number(s),Number(u)-1,Number(c))),f=(a.getUTCDay()+6)%7;return a.setUTCDate(a.getUTCDate()-f),a.toISOString().slice(0,10)}function de(e,r){return r==="month"?M(e):r==="week"?`Week of ${G(e)}`:r==="year"?e.slice(0,4):r==="decade"?`The ${e.slice(0,4)}s`:G(e)}function ue(e,r,n){return z(e,n)(r)}function z(e,r){let{words:n,conditions:s}=Y(r);if(n.length===0&&s.length===0)return()=>!0;let u=new Map,c=a=>{let f=u.get(a);return f||(f=new Set(D(e.schema,a).filters.map(d=>d.key)),u.set(a,f)),f};return a=>{let f=c(a.kind),d=s.filter(i=>f.has(i.key));return d.every(i=>x(e,a,i))?n.length>0?Z(e.schema.tryDefinition(a.kind),A(a),n,e.searchIn)!==void 0:d.length>0:!1}}function ae(e,r,n){let s=r.query?.trim(),u=r.archived===void 0?e:e.filter(t=>B(t,r.archived)),c=s?u.filter(z(n,s)):u,a=r.filter?.length?c.filter(t=>r.filter.every(l=>x(n,t,l))):[...c],f=[];for(let t=r.sort;t&&f.length<4;t=t.then)f.push(t);let d=f.length>0?a.map((t,l)=>({node:t,index:l,values:f.map(o=>ie(n,t,o.by))})).sort((t,l)=>{for(let[o,p]of f.entries()){let[h,K]=[t.values[o],l.values[o]],v=oe(h,K),E=p.direction==="desc"&&v!==0&&h!==void 0&&K!==void 0?-v:v;if(E!==0)return E}return t.index-l.index}).map(t=>t.node):a,i=r.group;if(!i)return{nodes:d,groups:[{key:"",label:"",nodes:d}],grouped:!1};let y=new Map,g=(t,l,o)=>{let p=y.get(t)??{label:l,nodes:[]};p.nodes.push(o),y.set(t,p)},N=d[0],m=N?n.schema.tryDefinition(N.kind):void 0,O=m?.fields.shape??{},J=m?I(m,i.by):j(i.by),$=i.by in O,b=$?H(O[i.by]):void 0,X=T(n.schema,N?.kind??"").find(t=>t.key===i.by)?.label,L=$?`No ${J.toLowerCase()}`:`Without ${(X??j(i.by)).toLowerCase()}`,q=$?new Map:U([...new Map(d.flatMap(t=>k(n.graph,t.id,i.by)).map(t=>[t.id,t])).values()].map(A),t=>n.schema.tryDefinition(t));for(let t of d){if($){let o=F(R(t),i.by,n.today??C());if(o==null||o==="")g("",L,t);else if(b==="date"){let p=i.bucket??"day",h=_(String(o),p);h?g(h,de(h,p),t):g("",L,t)}else if(b==="boolean")g(o?"1":"0",o?"Yes":"No",t);else{let p=m?.display?.format?.[i.by];g(String(o),p?p(o):String(o),t)}continue}let l=k(n.graph,t.id,i.by).map(o=>({id:o.id,label:q.has(o.id)?`${S(n,o)} \xB7 ${q.get(o.id)}`:S(n,o)})).sort((o,p)=>o.label.localeCompare(p.label));l.length===0?g("",L,t):g(l.map(o=>o.id).join(","),l.map(o=>o.label).join(", "),t)}let w=b==="choice"?V(O[i.by]):void 0,ee=[...y.entries()].sort(([t,l],[o,p])=>t===""?1:o===""?-1:w?w.indexOf(t)-w.indexOf(o):b==="boolean"?o.localeCompare(t):b==="date"?t.localeCompare(o):l.label.localeCompare(p.label)).map(([t,l])=>({key:t,label:l.label,nodes:l.nodes}));return{nodes:d,groups:ee,grouped:!0}}function P(e){if(e===void 0)return;if(typeof e=="string")return{by:e,direction:"asc"};let r=e.then===void 0?void 0:typeof e.then=="string"?{by:e.then,direction:"asc"}:{by:e.then.by,direction:e.then.direction??"asc"};return{by:e.by,direction:e.direction??"asc",...r?{then:r}:{}}}function Q(e){if(e!==void 0)return typeof e=="string"?{by:e}:e}function fe(e){let r=P(e?.sort),n=Q(e?.group);if(!(!r&&!n))return{...r?{sort:r}:{},...n?{group:{by:n.by}}:{}}}var le=(e,r)=>r?e==="1"?"true":"false":e;function ce(e,r,n){let s=n.type==="boolean",u=s?["true","false"]:n.options??[],c=[...new Set([...(r.order??[]).filter(d=>u.includes(d)),...u])],a=r.closed??[],f=d=>{if(d.key==="")return[1,0];let i=le(d.key,s);if(a.includes(i))return[2,a.indexOf(i)];let y=c.indexOf(i);return[0,y<0?c.length:y]};return e.map((d,i)=>({group:d,at:i,rank:f(d)})).sort((d,i)=>d.rank[0]-i.rank[0]||d.rank[1]-i.rank[1]||d.at-i.at).map(({group:d,rank:i})=>({...d,closed:i[0]===2}))}export{Q as a,fe as b,ce as c,re as d,te as e,ne as f,ue as g,ae as h};
@@ -1 +0,0 @@
1
- import"./chunk.KHRS2SKB.js";import"./chunk.25VJPUDH.js";import"./chunk.644FUGSX.js";import"./chunk.J3OX474P.js";import"./chunk.7SCENHVG.js";import{a as L,b as R,c as N}from"./chunk.2LMB5E6N.js";import{b as T}from"./chunk.KJGNLWU3.js";import"./chunk.GVUJCOKD.js";import"./chunk.3ZONBC6L.js";import"./chunk.FWKNR7XF.js";import"./chunk.MDWCX3YU.js";import"./chunk.CB5DGKR5.js";import"./chunk.GKLDSHHH.js";import"./chunk.OCV46AFN.js";import"./chunk.4KTHJY5N.js";import"./chunk.PZ4G5QA5.js";import"./chunk.Y36MLVMT.js";import"./chunk.MPMROUZA.js";import"./chunk.HJCQ6I3S.js";import"./chunk.5C43AM3X.js";import"./chunk.4WH4N4V7.js";import"./chunk.MVRNEC3Y.js";import"./chunk.ZDDWXRPK.js";import"./chunk.LOUICR7K.js";import"./chunk.L7MFTL5S.js";import"./chunk.XZJ6XX5I.js";import"./chunk.4F5M5XZG.js";import"./chunk.LVOL2LEC.js";import"./chunk.3G5DEGFA.js";import"./chunk.OZ4EJ5M6.js";import"./chunk.BOMYLOCX.js";import"./chunk.45HTFSWD.js";import"./chunk.Q6RUTFU3.js";import"./chunk.AZGXBTOQ.js";import"./chunk.KRVEAIKW.js";import"./chunk.XOZU4OFA.js";import"./chunk.AG7CUSSV.js";import"./chunk.RYMSHMLM.js";import"./chunk.TI4OSTQV.js";import"./chunk.C6HBYRGJ.js";import"./chunk.WVUJXDXZ.js";import"./chunk.3V2WXZU3.js";import"./chunk.7UD2JR6J.js";import"./chunk.BUDEUNBN.js";import"./chunk.3IEJQAK7.js";import"./chunk.AKLVSZ5A.js";import"./chunk.ZUBC3UFG.js";import"./chunk.GZHZLJBF.js";import{r as C}from"./chunk.PZWJUQAO.js";import"./chunk.OJGHDWI6.js";import"./chunk.NEJSKMJV.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import{G as S,I as $,T as p,ba as x,da as A}from"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import{Qc as k,ca as h}from"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as i}from"./chunk.AJZBJBMO.js";var r=i(S(),1);var l=i(S(),1);var g=i(p(),1);var m={font:"inherit",fontSize:"0.875rem",minHeight:24,padding:0,border:0,borderRadius:2,background:"transparent",boxShadow:"none",color:"var(--graview-accent)",textDecoration:"underline",textUnderlineOffset:3,textAlign:"start",cursor:"pointer"};var e=i(p(),1);function Q({page:n=!1,go:E,onPick:y,onDiscard:D}){let{store:d,seatTalk:c}=x(),u=$(c),M=N(),b=E??M,{keep:P}=L(b),[H,f]=(0,r.useState)(!1);A();let t=u.draft;(0,r.useEffect)(()=>f(!1),[t]),(0,r.useEffect)(()=>{n||R(!1)},[n]);let v=(0,r.useRef)(null),w=t!==null&&!n;if((0,r.useLayoutEffect)(()=>{let s=v.current;if(!w||!s?.parentElement)return;let o=[];for(let a=s.previousElementSibling;a;a=a.previousElementSibling)a instanceof HTMLElement&&!a.inert&&a.tagName!=="STYLE"&&(a.inert=!0,o.push(a));return()=>{for(let a of o)a.inert=!1}},[w]),!t)return null;let G=T(t.drawn),F=d.schema.tryDefinition(t.kind),q=d.graph.nodesOfKind(t.kind).filter(s=>h(F,s)),z=()=>{c.setDraft(null),D?.()};return(0,e.jsxs)("section",{ref:v,"data-testid":"draft-frame","data-graview-draft-frame":n?"page":"scene","aria-label":`Draft: ${t.title}`,style:n?{display:"grid",gap:12,minWidth:0}:{position:"absolute",inset:12,zIndex:k("rail"),display:"grid",gridTemplateRows:"auto auto minmax(0, 1fr)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:12,boxShadow:"var(--graview-lift-high)",overflow:"hidden",minHeight:0},children:[(0,e.jsxs)("p",{"data-testid":"draft-line",style:{...K,...n?{}:{padding:"10px 16px"}},children:[n?(0,e.jsx)("span",{children:"Draft"}):(0,e.jsxs)("span",{children:["Draft \u2014 ",(0,e.jsx)("span",{"data-testid":"draft-title",style:{color:"var(--graview-ink)",fontWeight:600},children:t.title})]}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-keep",disabled:H,title:`Keep \u201C${t.title}\u201D as a lens: a place of its own`,onClick:()=>{f(!0),P(t).finally(()=>f(!1))},style:m,children:"Keep as a lens"}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-discard",onClick:z,style:m,children:"Discard"})]}),u.draftNote?(0,e.jsx)("p",{"data-testid":"draft-note",role:"status",style:{margin:0,padding:n?0:"0 16px 8px",fontSize:"0.8125rem",color:"var(--graview-warn)"},children:u.draftNote}):(0,e.jsx)("span",{}),(0,e.jsx)("div",{"data-testid":"draft-lens","data-graview-draft":t.lens.name,role:"group","aria-label":t.title,tabIndex:0,style:n?{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",scrollbarGutter:"stable",border:"1px solid var(--graview-edge)",borderRadius:12,background:"var(--graview-panel)"}:{minHeight:0,overflow:"auto",scrollbarGutter:"stable",display:"grid",gridTemplateRows:"minmax(0, 1fr)"},onClick:s=>{let o=s.target?.closest("[data-graview-pick]")?.getAttribute("data-graview-pick");if(!o||!d.graph.getNode(o))return;s.preventDefault();let a=d.graph.getNode(o);y?(c.setDraft(null),y(o)):b({to:"record",id:o,kind:a.kind,label:o,address:"",said:""})},children:(0,e.jsx)(C,{kind:t.kind,view:t.title,children:(0,e.jsx)(G,{nodes:q,label:t.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1})})})]})}var K={margin:0,display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 8px",fontSize:"0.875rem",color:"var(--graview-ink-muted)",borderBottom:"1px solid var(--graview-edge)",paddingBottom:8};export{Q as DraftFrame};
@@ -1 +0,0 @@
1
- import{k as a,l as b,m as c,n as d,o as e,p as f,q as g,r as h,s as i}from"./chunk.OLKFEHWB.js";import"./chunk.Q6RUTFU3.js";import"./chunk.AZGXBTOQ.js";import"./chunk.KRVEAIKW.js";import"./chunk.XOZU4OFA.js";import"./chunk.AG7CUSSV.js";import"./chunk.IDYPQ45A.js";import"./chunk.TI4OSTQV.js";import"./chunk.7UD2JR6J.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";export{i as GhostTray,h as InlineAiMenu,g as askAgain,c as askInline,a as askOf,b as drawPanel,d as heldSuggestion,e as suggestOnce,f as takeOffer};