graview 0.1.45 → 0.1.47

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 (145) hide show
  1. package/dist/preview/{chunk.L2PI7V4R.js → chunk.24OZGU7J.js} +1 -1
  2. package/dist/preview/{chunk.EVW5YY3W.js → chunk.2CLANQHZ.js} +1 -1
  3. package/dist/preview/{chunk.URXSZQSF.js → chunk.2L3VFGHX.js} +1 -1
  4. package/dist/preview/chunk.2MCZ4CU5.js +1 -0
  5. package/dist/preview/{chunk.R2AG4NHQ.js → chunk.2W22AWSL.js} +1 -1
  6. package/dist/preview/chunk.3LDYUO77.js +1 -0
  7. package/dist/preview/{chunk.JR7RDOEP.js → chunk.47RTA6M3.js} +1 -1
  8. package/dist/preview/chunk.4OGOTHRD.js +1 -0
  9. package/dist/preview/{chunk.WPOTEXJZ.js → chunk.4YS7547F.js} +1 -1
  10. package/dist/preview/{chunk.6X3G3PWL.js → chunk.4YXJPKXD.js} +1 -1
  11. package/dist/preview/{chunk.UNCS63AM.js → chunk.52VGZBO3.js} +1 -1
  12. package/dist/preview/{chunk.PRD3UNJX.js → chunk.57ZSMK3R.js} +1 -1
  13. package/dist/preview/{chunk.6MADC6DM.js → chunk.5AGW4NRZ.js} +1 -1
  14. package/dist/preview/chunk.5G53VDOC.js +1 -0
  15. package/dist/preview/chunk.5M4TMZXC.js +1 -0
  16. package/dist/preview/{chunk.GEPNIMXW.js → chunk.5TM5VA2H.js} +1 -1
  17. package/dist/preview/{chunk.Y5ARSVH4.js → chunk.63MS2LOP.js} +1 -1
  18. package/dist/preview/{chunk.HGTPTRMM.js → chunk.6QVXXQCW.js} +1 -1
  19. package/dist/preview/{chunk.UM7GWXEW.js → chunk.6TIEX67B.js} +1 -1
  20. package/dist/preview/chunk.6YD2DLIC.js +1 -0
  21. package/dist/preview/chunk.76GF5US2.js +50 -0
  22. package/dist/preview/{chunk.55D33E5A.js → chunk.7ELB37JU.js} +1 -1
  23. package/dist/preview/chunk.7N2GXZYI.js +3 -0
  24. package/dist/preview/{chunk.EAUVEVVO.js → chunk.7NNI7YH4.js} +1 -1
  25. package/dist/preview/{chunk.KUUDW7VR.js → chunk.A3RNSSUQ.js} +1 -1
  26. package/dist/preview/{chunk.W44VRHKS.js → chunk.A7RKTSOH.js} +2 -2
  27. package/dist/preview/{chunk.CBUSFM3E.js → chunk.AGIO2GRV.js} +29 -7
  28. package/dist/preview/{chunk.QPCSS322.js → chunk.AWXDZUKH.js} +1 -1
  29. package/dist/preview/{chunk.5EDA3JHU.js → chunk.AYA7SYIU.js} +1 -1
  30. package/dist/preview/{chunk.T7XH7FVJ.js → chunk.BBS5C2BY.js} +1 -1
  31. package/dist/preview/{chunk.L3FOLN3K.js → chunk.C3NHNYA6.js} +1 -1
  32. package/dist/preview/{chunk.S5MQVPLF.js → chunk.C44MC5X3.js} +1 -1
  33. package/dist/preview/{chunk.L3FQZCWI.js → chunk.CMOXKRWT.js} +1 -1
  34. package/dist/preview/{chunk.7ZRFXI73.js → chunk.COYLGLTI.js} +1 -1
  35. package/dist/preview/{chunk.UY7IOVR6.js → chunk.CTQULC5F.js} +1 -1
  36. package/dist/preview/{chunk.5B2LH2SR.js → chunk.DNROW6LX.js} +1 -1
  37. package/dist/preview/{chunk.JLEC3USG.js → chunk.DQS7D2W2.js} +1 -1
  38. package/dist/preview/{chunk.ZBR2QY67.js → chunk.ETPKXUAN.js} +1 -1
  39. package/dist/preview/{chunk.XXEYRHRG.js → chunk.ETR6AV47.js} +1 -1
  40. package/dist/preview/{chunk.FPASZ4RD.js → chunk.EUPSAYEI.js} +1 -1
  41. package/dist/preview/{chunk.6SJA4FSW.js → chunk.EYI3Y2DY.js} +1 -1
  42. package/dist/preview/chunk.F2VMMCVK.js +1 -0
  43. package/dist/preview/{chunk.SDU76JU6.js → chunk.F67F6QZ6.js} +1 -1
  44. package/dist/preview/chunk.FOJDVK2Q.js +1 -0
  45. package/dist/preview/{chunk.VC3BX2ZF.js → chunk.FOQ27RAR.js} +1 -1
  46. package/dist/preview/{chunk.LSLLKICK.js → chunk.FWSCBHZ5.js} +1 -1
  47. package/dist/preview/chunk.G446PWV6.js +1 -0
  48. package/dist/preview/{chunk.RYRTKIKB.js → chunk.GCKZ2YRJ.js} +2 -2
  49. package/dist/preview/{chunk.66JF3UMG.js → chunk.GQHAAKJG.js} +1 -1
  50. package/dist/preview/chunk.I6JLOEJU.js +1 -0
  51. package/dist/preview/chunk.IJNOT4S4.js +4 -0
  52. package/dist/preview/chunk.IPAZOKMQ.js +1 -0
  53. package/dist/preview/{chunk.JDMXZFSG.js → chunk.IQ2HKGJS.js} +1 -1
  54. package/dist/preview/{chunk.DQHPEKWK.js → chunk.IROYMLER.js} +1 -1
  55. package/dist/preview/chunk.ISNEX772.js +1 -0
  56. package/dist/preview/{chunk.3NMINX5Z.js → chunk.IXOQQBJE.js} +1 -1
  57. package/dist/preview/{chunk.DLFWBG33.js → chunk.IYIN6VSN.js} +1 -1
  58. package/dist/preview/chunk.JUWWRRHA.js +1 -0
  59. package/dist/preview/{chunk.GER2XRD4.js → chunk.K2NCGPCL.js} +1 -1
  60. package/dist/preview/{chunk.4KNEBLB7.js → chunk.KSM6NVAT.js} +1 -1
  61. package/dist/preview/{chunk.OF34OZ4V.js → chunk.KSXB4LDF.js} +1 -1
  62. package/dist/preview/{chunk.4XOWRYRU.js → chunk.L4YNDNX7.js} +6 -6
  63. package/dist/preview/{chunk.E4G6DXSB.js → chunk.MBETS27C.js} +1 -1
  64. package/dist/preview/{chunk.FOFLD64U.js → chunk.MCB26YCQ.js} +1 -1
  65. package/dist/preview/chunk.MCCUVGTE.js +1 -0
  66. package/dist/preview/{chunk.ZJ2VS4M4.js → chunk.MF73YBJL.js} +1 -1
  67. package/dist/preview/{chunk.ZEAH57AZ.js → chunk.N7JT6MG2.js} +1 -1
  68. package/dist/preview/{chunk.SGKPGVBB.js → chunk.NDWW5EER.js} +1 -1
  69. package/dist/preview/{chunk.VSAPJAT3.js → chunk.NEEOVRB7.js} +1 -1
  70. package/dist/preview/{chunk.NMIXBH37.js → chunk.NFIGGSMJ.js} +1 -1
  71. package/dist/preview/{chunk.JBW3DI7E.js → chunk.O2WWYZI7.js} +1 -1
  72. package/dist/preview/{chunk.6BJBPDF3.js → chunk.O4WEJ47H.js} +14 -4
  73. package/dist/preview/{chunk.ICGNIK3Z.js → chunk.OCTOGZVJ.js} +2 -2
  74. package/dist/preview/{chunk.FTM64IDI.js → chunk.OJGUIWDD.js} +1 -1
  75. package/dist/preview/{chunk.GIYFEGAP.js → chunk.OONCUAOH.js} +1 -1
  76. package/dist/preview/{chunk.3HSPWSAI.js → chunk.P4KCZRIG.js} +1 -1
  77. package/dist/preview/{chunk.W2RCWPLK.js → chunk.PBKO5CKD.js} +1 -1
  78. package/dist/preview/{chunk.JSSFA3FC.js → chunk.PC6PID5X.js} +1 -1
  79. package/dist/preview/{chunk.JLYNMAME.js → chunk.PYE3WZM7.js} +1 -1
  80. package/dist/preview/{chunk.BS2SJC2P.js → chunk.QGG6ZRJ5.js} +2 -2
  81. package/dist/preview/{chunk.LEO2KWLZ.js → chunk.QZEZHCOI.js} +1 -1
  82. package/dist/preview/{chunk.DQOCBKC3.js → chunk.R6V37SR7.js} +1 -1
  83. package/dist/preview/{chunk.FF6DBQMB.js → chunk.RBJAPOZ3.js} +1 -1
  84. package/dist/preview/{chunk.TBSNNOQU.js → chunk.RG6WNOBW.js} +1 -1
  85. package/dist/preview/{chunk.5O5IJVLN.js → chunk.RUPRZDN3.js} +1 -1
  86. package/dist/preview/{chunk.S6WHA4CW.js → chunk.RVJXO5GG.js} +1 -1
  87. package/dist/preview/chunk.RX2M4C5W.js +2 -0
  88. package/dist/preview/{chunk.KBHU54NM.js → chunk.RZF3QM4E.js} +1 -1
  89. package/dist/preview/{chunk.7KVWV577.js → chunk.S5IQFZ5Z.js} +1 -1
  90. package/dist/preview/{chunk.2EFH63WS.js → chunk.SD6N4DGF.js} +1 -1
  91. package/dist/preview/{chunk.RPX35VYU.js → chunk.SGKK4UKP.js} +1 -1
  92. package/dist/preview/{chunk.V5FIZIX2.js → chunk.SWWAEOZ7.js} +1 -1
  93. package/dist/preview/chunk.SZR3Z43B.js +1 -0
  94. package/dist/preview/{chunk.ICCIZDTQ.js → chunk.T42S2WMB.js} +1 -1
  95. package/dist/preview/chunk.T7RJCEJB.js +18 -0
  96. package/dist/preview/{chunk.2YABX3SC.js → chunk.TCXKPILZ.js} +1 -1
  97. package/dist/preview/{chunk.TOXWNEOQ.js → chunk.TJEV5ZAM.js} +3 -3
  98. package/dist/preview/{chunk.LNG3CQNI.js → chunk.UV3YU64Z.js} +1 -1
  99. package/dist/preview/{chunk.UJKT2G6M.js → chunk.V7XHNRQM.js} +2 -2
  100. package/dist/preview/{chunk.FCAYURB4.js → chunk.VAFSSSSI.js} +1 -1
  101. package/dist/preview/{chunk.M5GJHVWZ.js → chunk.VC3UGFHY.js} +1 -1
  102. package/dist/preview/{chunk.NIVTK2W5.js → chunk.VSNHCGKC.js} +1 -1
  103. package/dist/preview/{chunk.XMCFZD3A.js → chunk.VXVWUIGO.js} +1 -1
  104. package/dist/preview/chunk.W6COSBO2.js +21 -0
  105. package/dist/preview/{chunk.E37V2EJM.js → chunk.WHEUTAXA.js} +1 -1
  106. package/dist/preview/{chunk.HWCHFQ7O.js → chunk.WJS6P7GI.js} +1 -1
  107. package/dist/preview/chunk.X5G7FOPY.js +12 -0
  108. package/dist/preview/{chunk.BGYY55VO.js → chunk.XYEFZ2OO.js} +1 -1
  109. package/dist/preview/chunk.Y4ZUJUUT.js +25 -0
  110. package/dist/preview/chunk.YHH4TWZ2.js +1 -0
  111. package/dist/preview/{chunk.4RJZVTW7.js → chunk.YVONXFKE.js} +1 -1
  112. package/dist/preview/{chunk.5R2R364Q.js → chunk.Z4UM4CMT.js} +1 -1
  113. package/dist/preview/{chunk.4HYJHGI4.js → chunk.ZCYGUP3I.js} +1 -1
  114. package/dist/preview/chunk.ZIEHF67C.js +1 -0
  115. package/dist/preview/{chunk.II7VTGNC.js → chunk.ZL7ZBJUU.js} +1 -1
  116. package/dist/preview/{chunk.FHZBXMXR.js → chunk.ZQY6ODXC.js} +1 -1
  117. package/dist/preview/{chunk.6KWFTSK4.js → chunk.ZWVN75EY.js} +1 -1
  118. package/dist/preview/index.html +36 -36
  119. package/dist/preview/page.js +2 -2
  120. package/package.json +6 -6
  121. package/dist/preview/chunk.2JJYGYT2.js +0 -1
  122. package/dist/preview/chunk.2LKMNEWZ.js +0 -1
  123. package/dist/preview/chunk.6SWW6KEV.js +0 -1
  124. package/dist/preview/chunk.6UIW664O.js +0 -6
  125. package/dist/preview/chunk.6USUVORO.js +0 -1
  126. package/dist/preview/chunk.B6KT6BTG.js +0 -49
  127. package/dist/preview/chunk.C2UFMFJ3.js +0 -3
  128. package/dist/preview/chunk.CSDERNQV.js +0 -1
  129. package/dist/preview/chunk.F6HMZL65.js +0 -1
  130. package/dist/preview/chunk.GFLAGZSB.js +0 -1
  131. package/dist/preview/chunk.GVY5UQTJ.js +0 -1
  132. package/dist/preview/chunk.HZGVEHEN.js +0 -1
  133. package/dist/preview/chunk.J7G3AATY.js +0 -14
  134. package/dist/preview/chunk.JHIUG25Q.js +0 -1
  135. package/dist/preview/chunk.K46YRA65.js +0 -1
  136. package/dist/preview/chunk.K6KMLD2B.js +0 -21
  137. package/dist/preview/chunk.L24FCXZ7.js +0 -1
  138. package/dist/preview/chunk.MGWMGLWE.js +0 -1
  139. package/dist/preview/chunk.OMZ3LDDN.js +0 -1
  140. package/dist/preview/chunk.OYHQSXNC.js +0 -1
  141. package/dist/preview/chunk.SZ34UAQ3.js +0 -2
  142. package/dist/preview/chunk.WM2LWHTJ.js +0 -1
  143. package/dist/preview/chunk.WSTBCWW7.js +0 -4
  144. package/dist/preview/chunk.XWAMQPUM.js +0 -25
  145. package/dist/preview/chunk.ZTIF23VF.js +0 -1
@@ -1,4 +1,4 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{$ as X,Aa as $r,Ba as Or,Ca as Nr,Fa as Z,G as B,Ja as J,R as S,_ as fe,a as $e,e as Oe,ia as Tr,l as Sr,m as Pr,oa as Ar,s as Lr,v as ae,wa as M,z as Er}from"./chunk.XWAMQPUM.js";import{a as R}from"./chunk.SDO3U72B.js";import{$b as nr,$c as Q,Uc as ge,Vc as ne,Wa as rr,Xc as Te,Zc as mr,_c as wr,bc as ar,ca as Ze,cc as ue,dc as Ee,ec as ir,fc as or,gc as U,gd as vr,ha as Je,hb as tr,hc as sr,hd as yr,ia as er,ic as lr,id as hr,jd as br,kc as dr,kd as kr,lc as cr,ld as Ae,pd as xr,rc as pr,tc as ur,wc as gr,xc as fr}from"./chunk.AS4CQBOQ.js";import{a as Xe,b as h}from"./chunk.AJZBJBMO.js";var Vr=Xe(L=>{"use strict";var Ft=B();function Fr(r){var e="https://react.dev/errors/"+r;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function W(){}var P={d:{f:W,r:function(){throw Error(Fr(522))},D:W,C:W,L:W,m:W,X:W,S:W,M:W},p:0,findDOMNode:null},Vt=Symbol.for("react.portal");function It(r,e,t){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Vt,key:n==null?null:""+n,children:r,containerInfo:e,implementation:t}}var ie=Ft.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function we(r,e){if(r==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}L.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P;L.createPortal=function(r,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(Fr(299));return It(r,e,null,t)};L.flushSync=function(r){var e=ie.T,t=P.p;try{if(ie.T=null,P.p=2,r)return r()}finally{ie.T=e,P.p=t,P.d.f()}};L.preconnect=function(r,e){typeof r=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,P.d.C(r,e))};L.prefetchDNS=function(r){typeof r=="string"&&P.d.D(r)};L.preinit=function(r,e){if(typeof r=="string"&&e&&typeof e.as=="string"){var t=e.as,n=we(t,e.crossOrigin),i=typeof e.integrity=="string"?e.integrity:void 0,a=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;t==="style"?P.d.S(r,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:n,integrity:i,fetchPriority:a}):t==="script"&&P.d.X(r,{crossOrigin:n,integrity:i,fetchPriority:a,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};L.preinitModule=function(r,e){if(typeof r=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var t=we(e.as,e.crossOrigin);P.d.M(r,{crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&P.d.M(r)};L.preload=function(r,e){if(typeof r=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var t=e.as,n=we(t,e.crossOrigin);P.d.L(r,t,{crossOrigin:n,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};L.preloadModule=function(r,e){if(typeof r=="string")if(e){var t=we(e.as,e.crossOrigin);P.d.m(r,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else P.d.m(r)};L.requestFormReset=function(r){P.d.r(r)};L.unstable_batchedUpdates=function(r,e){return r(e)};L.useFormState=function(r,e,t){return ie.H.useFormState(r,e,t)};L.useFormStatus=function(){return ie.H.useHostTransitionStatus()};L.version="19.2.8"});var Kr=Xe((oa,Wr)=>{"use strict";function Ir(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Ir)}catch(r){console.error(r)}}Ir(),Wr.exports=Vr()});var Cr={name:"Graview",typography:{body:Ee.body,mono:Ee.mono},schemes:ue},Hr={ground:"--graview-ground",groundDeep:"--graview-ground-deep",wash:"--graview-wash",panel:"--graview-panel",panelMuted:"--graview-panel-muted",panelWarning:"--graview-panel-warning",edge:"--graview-edge",edgeBright:"--graview-edge-bright",ink:"--graview-ink",inkMuted:"--graview-ink-muted",inkFaint:"--graview-ink-faint",accent:"--graview-accent",accentDim:"--graview-accent-dim",accentInk:"--graview-accent-ink",warn:"--graview-warn",good:"--graview-good",bad:"--graview-bad",glow:"--graview-glow",bar:"--graview-bar",float:"--graview-float",liftLow:"--graview-lift-low",liftHigh:"--graview-lift-high",tintAlpha:"--graview-tint-alpha",tintLightness:"--graview-tint-lightness",gridAlpha:"--graview-grid-alpha"};function Rr(r){return Object.keys(Hr).map(e=>` ${Hr[e]}: ${r[e]};`).join(`
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{$ as X,Da as M,G as B,Ja as $r,Ka as Or,La as Nr,Oa as Z,R as S,Sa as J,_ as fe,a as $e,e as Oe,ia as Tr,l as Sr,m as Pr,qa as Ar,s as Lr,v as ae,z as Er}from"./chunk.Y4ZUJUUT.js";import{a as R}from"./chunk.SDO3U72B.js";import{$b as nr,$c as Q,Uc as ge,Vc as ne,Wa as rr,Xc as Te,Zc as mr,_c as wr,bc as ar,ca as Ze,cc as ue,dc as Ee,ec as ir,fc as or,gc as U,gd as vr,ha as Je,hb as tr,hc as sr,hd as yr,ia as er,ic as lr,id as hr,jd as br,kc as dr,kd as xr,lc as cr,ld as Ae,pd as kr,rc as pr,tc as ur,wc as gr,xc as fr}from"./chunk.AS4CQBOQ.js";import{a as Xe,b as h}from"./chunk.AJZBJBMO.js";var Vr=Xe(L=>{"use strict";var Ft=B();function Fr(r){var e="https://react.dev/errors/"+r;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function W(){}var P={d:{f:W,r:function(){throw Error(Fr(522))},D:W,C:W,L:W,m:W,X:W,S:W,M:W},p:0,findDOMNode:null},Vt=Symbol.for("react.portal");function It(r,e,t){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Vt,key:n==null?null:""+n,children:r,containerInfo:e,implementation:t}}var ie=Ft.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function we(r,e){if(r==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}L.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P;L.createPortal=function(r,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(Fr(299));return It(r,e,null,t)};L.flushSync=function(r){var e=ie.T,t=P.p;try{if(ie.T=null,P.p=2,r)return r()}finally{ie.T=e,P.p=t,P.d.f()}};L.preconnect=function(r,e){typeof r=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,P.d.C(r,e))};L.prefetchDNS=function(r){typeof r=="string"&&P.d.D(r)};L.preinit=function(r,e){if(typeof r=="string"&&e&&typeof e.as=="string"){var t=e.as,n=we(t,e.crossOrigin),i=typeof e.integrity=="string"?e.integrity:void 0,a=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;t==="style"?P.d.S(r,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:n,integrity:i,fetchPriority:a}):t==="script"&&P.d.X(r,{crossOrigin:n,integrity:i,fetchPriority:a,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};L.preinitModule=function(r,e){if(typeof r=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var t=we(e.as,e.crossOrigin);P.d.M(r,{crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&P.d.M(r)};L.preload=function(r,e){if(typeof r=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var t=e.as,n=we(t,e.crossOrigin);P.d.L(r,t,{crossOrigin:n,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};L.preloadModule=function(r,e){if(typeof r=="string")if(e){var t=we(e.as,e.crossOrigin);P.d.m(r,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else P.d.m(r)};L.requestFormReset=function(r){P.d.r(r)};L.unstable_batchedUpdates=function(r,e){return r(e)};L.useFormState=function(r,e,t){return ie.H.useFormState(r,e,t)};L.useFormStatus=function(){return ie.H.useHostTransitionStatus()};L.version="19.2.8"});var Kr=Xe((oa,Wr)=>{"use strict";function Ir(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Ir)}catch(r){console.error(r)}}Ir(),Wr.exports=Vr()});var Cr={name:"Graview",typography:{body:Ee.body,mono:Ee.mono},schemes:ue},Hr={ground:"--graview-ground",groundDeep:"--graview-ground-deep",wash:"--graview-wash",panel:"--graview-panel",panelMuted:"--graview-panel-muted",panelWarning:"--graview-panel-warning",edge:"--graview-edge",edgeBright:"--graview-edge-bright",ink:"--graview-ink",inkMuted:"--graview-ink-muted",inkFaint:"--graview-ink-faint",accent:"--graview-accent",accentDim:"--graview-accent-dim",accentInk:"--graview-accent-ink",warn:"--graview-warn",good:"--graview-good",bad:"--graview-bad",glow:"--graview-glow",bar:"--graview-bar",float:"--graview-float",liftLow:"--graview-lift-low",liftHigh:"--graview-lift-high",tintAlpha:"--graview-tint-alpha",tintLightness:"--graview-tint-lightness",gridAlpha:"--graview-grid-alpha"};function Rr(r){return Object.keys(Hr).map(e=>` ${Hr[e]}: ${r[e]};`).join(`
2
2
  `)}function Br(r,e){let t=r===e?r:`${r} ${e}`;return` ${t} [data-graview-view] { transition: none; }
3
3
  ${t} [data-graview-touched] > * { animation: none; }
4
4
  ${t} [data-graview-view][data-graview-wrote] > *,
@@ -25,6 +25,14 @@ ${fr()}
25
25
  --graview-text-heading: 1.2rem;
26
26
  --graview-text-title: 1.728rem;
27
27
 
28
+ --graview-space-1: 4px;
29
+ --graview-space-2: 8px;
30
+ --graview-space-3: 12px;
31
+ --graview-space-4: 16px;
32
+ --graview-space-5: 24px;
33
+ --graview-space-6: 32px;
34
+ --graview-space-7: 48px;
35
+
28
36
  --graview-radius: ${p.radius}px;
29
37
  --graview-radius-sm: ${p.radiusSmall}px;
30
38
  --graview-pad: ${p.pad}px;
@@ -33,6 +41,8 @@ ${fr()}
33
41
  color-scheme: ${r};
34
42
  }
35
43
 
44
+ @media (max-width: 480px) { ${i} { --graview-text-title: 1.44rem; } }
45
+
36
46
  ${a} {
37
47
  margin: 0;
38
48
  background: var(--graview-ground-deep);
@@ -267,7 +277,7 @@ code { color: var(--graview-ink-muted); font-size: 0.8125rem; letter-spacing: 0.
267
277
  @media (prefers-reduced-motion: reduce) {
268
278
  ${Br(`${l}:not([data-graview-motion='full'])`,o)}
269
279
  }
270
- ${Br(`${l}[data-graview-motion='reduce']`,o)}`}var Ne=h(B(),1),Mr=new WeakMap,me=r=>{let e=Mr.get(r);return e||Mr.set(r,e={open:null,drawn:0,listeners:new Set}),e},Mt=r=>{for(let e of[...r.listeners])e()},_t=0;function ta(r,e){let t=me(r);t.open=e?{...e,at:++_t}:null,Mt(t)}var _r=r=>e=>{let t=me(r);return t.listeners.add(e),()=>void t.listeners.delete(e)};function Dr(r){let e=()=>r?me(r).drawn>0:!1;return(0,Ne.useSyncExternalStore)(r?_r(r):Dt,e,e)}var Dt=()=>()=>{};function na(r){let e=()=>me(r).open;return(0,Ne.useSyncExternalStore)(_r(r),e,e)}var D=h(B(),1),Gr=h(Kr(),1);function Wt(r){let[e,t]=(0,D.useState)(null),[n,i]=(0,D.useState)(null);return(0,D.useLayoutEffect)(()=>{r.current!==n&&i(r.current)}),(0,D.useLayoutEffect)(()=>{if(!n||typeof ResizeObserver>"u")return;let a=()=>Math.round(n.getBoundingClientRect().width),o=a();t(o);let l=new ResizeObserver(()=>{let p=a();p!==o&&(o=p,(0,Gr.flushSync)(()=>t(p)))});return l.observe(n),()=>l.disconnect()},[n]),e}function Kt(r=!0){let[e,t]=(0,D.useState)();return(0,D.useEffect)(()=>{if(!r)return t(void 0);let n=0,i=()=>t(innerHeight),a=()=>{i(),clearTimeout(n),n=window.setTimeout(i,300)},o=l=>{for(let[p,s]of[[window,"resize"],[window,"orientationchange"],[window.visualViewport,"resize"]])p?.[l](s,a)};return o("addEventListener"),i(),()=>{clearTimeout(n),o("removeEventListener")}},[r]),e}var ve={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap"};var E=h(B(),1);var O=h(S(),1),zr=6e3;function Gt(){let r=[],e=0,t=new Set,n=new Map,i,a=()=>{for(let s of[...t])s()},o=s=>{if(clearTimeout(n.get(s.id)),n.delete(s.id),s.kind!=="toast")return;let u=(s.actions?.length??0)+(s.action?1:0),c=s.timeout??(u>0?!1:zr);c!==!1&&n.set(s.id,setTimeout(()=>i?.()?o(s):l(s.id),c))},l=s=>{clearTimeout(n.get(s)),n.delete(s),r.some(u=>u.id===s)&&(r=r.filter(u=>u.id!==s),a())},p=s=>{r=r.some(u=>u.id===s.id)?r.map(u=>u.id===s.id?s:u):[...r,s],o(s),a()};return{notify(s){let u=s.id??`notice-${++e}`;return p({...s,id:u,said:++e}),{id:u,dismiss:()=>l(u),update:c=>{let g=r.find(w=>w.id===u);g&&p({...g,...c,id:u,kind:g.kind,said:c.sentence!==void 0&&c.sentence!==g.sentence?++e:g.said})}}},dismiss:l,hold(s){i=s},list:()=>r,subscribe(s){return t.add(s),()=>t.delete(s)}}}function zt({notices:r}){let e=r.reduce((l,p)=>!l||p.said>l.said?p:l,void 0),[t,n]=(0,E.useState)(""),[i,a]=(0,E.useState)(""),o=(0,E.useRef)(0);return(0,E.useEffect)(()=>{if(!e||e.said===o.current)return;o.current=e.said;let l=e.tone==="bad";(l?a:n)("");let p=setTimeout(()=>(l?a:n)(e.sentence),50);return()=>clearTimeout(p)},[e]),(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("div",{role:"status","aria-live":"polite","data-testid":"notices-said",style:ve,children:t}),(0,O.jsx)("div",{role:"alert","data-testid":"notices-alarm",style:ve,children:i})]})}var qt=(0,E.createContext)(null);function jt({board:r,anchor:e}){let t=(0,E.useSyncExternalStore)(r.subscribe,r.list,r.list);return(0,E.useEffect)(()=>Qt(He.prefetch),[]),(0,O.jsxs)(O.Fragment,{children:[t.length>0?(0,O.jsx)(E.Suspense,{fallback:null,children:(0,O.jsx)(Ut,{notices:t,anchor:e,board:r})}):null,(0,O.jsx)(zt,{notices:t})]})}var He=M(R(()=>(__graviewPreload(import.meta.url,["./chunk.MB7LKKUD.js","./chunk.6BJBPDF3.js","./chunk.XWAMQPUM.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZEAH57AZ.js")))),Yt=()=>He.load().then(()=>{},()=>{}),Ut=He.part((r,e)=>(0,O.jsx)(r.NoticeStacks,{...e}),{quiet:!0});function Qt(r){let e=()=>{(typeof navigator>"u"||navigator.onLine!==!1)&&r()},t=globalThis;if(t.requestIdleCallback){let i=t.requestIdleCallback(e,{timeout:5e3});return()=>t.cancelIdleCallback?.(i)}let n=setTimeout(e,2500);return()=>clearTimeout(n)}var C=M(R(()=>(__graviewPreload(import.meta.url,["./chunk.UY7IOVR6.js","./chunk.FPASZ4RD.js","./chunk.2YABX3SC.js","./chunk.64WM4IBI.js","./chunk.JDMXZFSG.js","./chunk.DQOCBKC3.js","./chunk.V5FIZIX2.js","./chunk.DQHPEKWK.js","./chunk.EAUVEVVO.js","./chunk.UT6642FC.js","./chunk.TI4OSTQV.js","./chunk.GZHZLJBF.js","./chunk.6MADC6DM.js","./chunk.OJGHDWI6.js","./chunk.JLEC3USG.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.6BJBPDF3.js","./chunk.XWAMQPUM.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.BS2SJC2P.js"))));var v=h(B(),1);var Yr=h(B(),1);var qr=h(B(),1);function Be(r){return(0,qr.useMemo)(()=>r===void 0||r===""?void 0:{__html:r},[r])}var K=h(S(),1);function Ce({brand:r,size:e=22}){let t=dr(r),n=jr(t?.light),i=n?jr(t?.dark):void 0,a=Be(n!==void 0&&U(n)?n:void 0),o=Be(i!==void 0&&U(i)?i:void 0),l={display:"inline-flex",flex:"0 0 auto",height:e,color:"var(--graview-accent)"},p=cr(r);if(p)return(0,K.jsx)("span",{className:"graview-logo graview-emoji-mark","data-testid":"app-mark","aria-hidden":!0,style:{...l,alignItems:"center",fontSize:`${e*.86/16}rem`,lineHeight:1},children:p});if(!n)return null;let s=r?.logoAlt??r?.name??"",u=s!==""&&s!==r?.name,c=u?{role:"img","aria-label":s}:{"aria-hidden":!0};if(i){let w=(y,b,N)=>U(y)?(0,K.jsx)("span",{className:"graview-logo-face","data-graview-scheme-only":N,dangerouslySetInnerHTML:b}):(0,K.jsx)("img",{className:"graview-logo-face","data-graview-scheme-only":N,src:y,alt:""});return(0,K.jsxs)("span",{className:"graview-logo","data-testid":"app-mark",style:l,...c,children:[w(n,a,"light"),w(i,o,"dark")]})}let g=t?.darkFallback==="invert"?{"data-graview-logo-fallback":"invert"}:{};return U(n)?(0,K.jsx)("span",{className:"graview-logo","data-testid":"app-mark",style:l,...g,...c,dangerouslySetInnerHTML:a}):(0,K.jsx)("img",{className:"graview-logo","data-testid":"app-mark",src:n,alt:u?s:"",...g,style:{...l,width:"auto"}})}function jr(r){if(!(!r||!lr(r)))return U(r)&&sr(r)!==null?void 0:r}function Xt(r){(0,Yr.useEffect)(()=>{if(!r||typeof document>"u")return;let e=[...document.querySelectorAll('link[rel~="icon"]')],t=e.map(i=>i.getAttribute("href")),n;e.length===0&&(n=document.createElement("link"),n.rel="icon",n.setAttribute("data-graview-favicon",""),document.head.appendChild(n),e.push(n));for(let i of e)i.href=r;return()=>{n&&n.remove(),e.forEach((i,a)=>{i!==n&&t[a]!==null&&t[a]!==void 0&&i.setAttribute("href",t[a])})}},[r])}var d=h(S(),1),Zt=C.part((r,e)=>(0,d.jsx)(r.TidyFoot,{...e}),{quiet:!0}),Jt=C.part((r,e)=>(0,d.jsx)(r.Here,{...e}),{quiet:!0});function en(){let r=X(),[e,t]=(0,v.useState)("");return(0,v.useEffect)(()=>r?.store.subscribe((n,i)=>{i.some(a=>a.author.id!==r.principal.id)&&C.load().then(a=>a.sayTheirChange(i,r,t),String)}),[r]),(0,d.jsx)("span",{role:"status",className:"graview-bar-said",children:e})}var Ur="home",Qr="/",j="scene:whole";function rn(r){let{store:e,principal:t,views:n}=r,i=e.kindsKeptFrom(t),a=e.schema.kinds.filter(f=>!e.modules.disabledKinds.has(f)&&!i.has(f)),o=n?.arrangement?.(),l=n?.places()??[],p=br(o,e.schema,l),s=hr(e.schema,o,[...e.modules.administered.values()].flatMap(f=>f.kinds??[])),u=(f,k)=>(!e.graph.size.nodes||e.graph.count(f)>0)&&(p?k?p.places.has(`${f}|${k}`):p.kinds.has(f):!s.has(f)),c=[{key:Ur,label:"Home",path:Qr,group:"home",primary:!0}],g=l.filter(f=>a.includes(f.kind)&&f.as!==kr&&!f.hidden),w=new Set(ne(g).map(f=>Q(f,l,e.schema).toLowerCase())),y=f=>mr(f.as,wr(f,l)?Te(e.schema,f.kind).slice(1):void 0),b=new Set(o?.hide??[]),N=xr(a,o?.order,g);for(let{kind:f,view:k}of N){if(k){c.push({key:`place:${k.kind}:${k.as}`,label:Q(k,l,e.schema),path:y(k),group:"lists",kind:f,primary:p?p.places.has(`${f}|${k.as}`):!0});continue}let Y=Je(e.schema,f),A=w.has(Y.toLowerCase());c.push({key:`kind:${f}`,label:A?er(e.schema,f):Y,path:Te(e.schema,f),group:"lists",kind:f,primary:A||b.has(f)?!1:u(f),...b.has(f)?{hidden:!0}:{}})}for(let f of ne(g)){if(N.some(A=>A.view&&ge(A.view,f)))continue;let k=y(f),Y=[f.kind,...f.over??[]].some(A=>a.includes(A)&&u(A,f.as));c.some(A=>A.path===k)||c.push({key:`place:${f.kind}:${f.as}`,label:Q(f,l,e.schema),path:k,group:"pictures",kind:f.kind,primary:Y})}return a.some(f=>Object.keys(e.schema.tryDefinition(f)?.edges??{}).length>0)&&c.push({key:"connections",label:"Connections",path:"/map",group:"pictures",primary:!1}),c}function tn(r,e){let[t="/",n=""]=e.split("?"),i=r.find(o=>o.path===(n?`${t}?${n}`:t))??r.find(o=>o.path===t);if(i)return i.key;let a=`/${t.split("/").filter(Boolean)[0]??""}`;return r.find(o=>o.group==="lists"&&o.path===a)?.key??null}var Xr=(0,v.createContext)(null),nn=()=>(0,v.useContext)(Xr),ee=30,Zr=48,oe=640,_e=4,Re=2;function Jr(r){let{widths:e,current:t,room:n,more:i,gap:a=_e,primary:o,most:l=yr}=r;if(e.length===0||!(n>0)||!(i>0)||e.some(c=>!(c>0)))return null;let p=(c,g)=>c.reduce((w,y)=>w+e[y],0)+a*Math.max(0,c.length-1)+(g?a+i:0),s=(c,g)=>t<0||!c.includes(t)||c.slice(0,g).includes(t)?c.slice(0,g):[...c.filter(w=>w!==t).slice(0,g-1),t].sort((w,y)=>w-y),u=s(e.map((c,g)=>g).filter(c=>o?.[c]!==!1||c===t),l);if(p(u,u.length<e.length)<=n)return u.length>=Re?u:null;for(let c=u.length-1;c>=Re;c--){let g=s(u,c);if(p(g,!0)<=n)return g}return null}var an=`
280
+ ${Br(`${l}[data-graview-motion='reduce']`,o)}`}var Ne=h(B(),1),Mr=new WeakMap,me=r=>{let e=Mr.get(r);return e||Mr.set(r,e={open:null,drawn:0,listeners:new Set}),e},Mt=r=>{for(let e of[...r.listeners])e()},_t=0;function ta(r,e){let t=me(r);t.open=e?{...e,at:++_t}:null,Mt(t)}var _r=r=>e=>{let t=me(r);return t.listeners.add(e),()=>void t.listeners.delete(e)};function Dr(r){let e=()=>r?me(r).drawn>0:!1;return(0,Ne.useSyncExternalStore)(r?_r(r):Dt,e,e)}var Dt=()=>()=>{};function na(r){let e=()=>me(r).open;return(0,Ne.useSyncExternalStore)(_r(r),e,e)}var D=h(B(),1),Gr=h(Kr(),1);function Wt(r){let[e,t]=(0,D.useState)(null),[n,i]=(0,D.useState)(null);return(0,D.useLayoutEffect)(()=>{r.current!==n&&i(r.current)}),(0,D.useLayoutEffect)(()=>{if(!n||typeof ResizeObserver>"u")return;let a=()=>Math.round(n.getBoundingClientRect().width),o=a();t(o);let l=new ResizeObserver(()=>{let p=a();p!==o&&(o=p,(0,Gr.flushSync)(()=>t(p)))});return l.observe(n),()=>l.disconnect()},[n]),e}function Kt(r=!0){let[e,t]=(0,D.useState)();return(0,D.useEffect)(()=>{if(!r)return t(void 0);let n=0,i=()=>t(innerHeight),a=()=>{i(),clearTimeout(n),n=window.setTimeout(i,300)},o=l=>{for(let[p,s]of[[window,"resize"],[window,"orientationchange"],[window.visualViewport,"resize"]])p?.[l](s,a)};return o("addEventListener"),i(),()=>{clearTimeout(n),o("removeEventListener")}},[r]),e}var ve={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap"};var E=h(B(),1);var O=h(S(),1),zr=6e3;function Gt(){let r=[],e=0,t=new Set,n=new Map,i,a=()=>{for(let s of[...t])s()},o=s=>{if(clearTimeout(n.get(s.id)),n.delete(s.id),s.kind!=="toast")return;let u=(s.actions?.length??0)+(s.action?1:0),c=s.timeout??(u>0?!1:zr);c!==!1&&n.set(s.id,setTimeout(()=>i?.()?o(s):l(s.id),c))},l=s=>{clearTimeout(n.get(s)),n.delete(s),r.some(u=>u.id===s)&&(r=r.filter(u=>u.id!==s),a())},p=s=>{r=r.some(u=>u.id===s.id)?r.map(u=>u.id===s.id?s:u):[...r,s],o(s),a()};return{notify(s){let u=s.id??`notice-${++e}`;return p({...s,id:u,said:++e}),{id:u,dismiss:()=>l(u),update:c=>{let g=r.find(w=>w.id===u);g&&p({...g,...c,id:u,kind:g.kind,said:c.sentence!==void 0&&c.sentence!==g.sentence?++e:g.said})}}},dismiss:l,hold(s){i=s},list:()=>r,subscribe(s){return t.add(s),()=>t.delete(s)}}}function zt({notices:r}){let e=r.reduce((l,p)=>!l||p.said>l.said?p:l,void 0),[t,n]=(0,E.useState)(""),[i,a]=(0,E.useState)(""),o=(0,E.useRef)(0);return(0,E.useEffect)(()=>{if(!e||e.said===o.current)return;o.current=e.said;let l=e.tone==="bad";(l?a:n)("");let p=setTimeout(()=>(l?a:n)(e.sentence),50);return()=>clearTimeout(p)},[e]),(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("div",{role:"status","aria-live":"polite","data-testid":"notices-said",style:ve,children:t}),(0,O.jsx)("div",{role:"alert","data-testid":"notices-alarm",style:ve,children:i})]})}var qt=(0,E.createContext)(null);function jt({board:r,anchor:e}){let t=(0,E.useSyncExternalStore)(r.subscribe,r.list,r.list);return(0,E.useEffect)(()=>Qt(He.prefetch),[]),(0,O.jsxs)(O.Fragment,{children:[t.length>0?(0,O.jsx)(E.Suspense,{fallback:null,children:(0,O.jsx)(Ut,{notices:t,anchor:e,board:r})}):null,(0,O.jsx)(zt,{notices:t})]})}var He=M(R(()=>(__graviewPreload(import.meta.url,["./chunk.MB7LKKUD.js","./chunk.O4WEJ47H.js","./chunk.Y4ZUJUUT.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.N7JT6MG2.js")))),Yt=()=>He.load().then(()=>{},()=>{}),Ut=He.part((r,e)=>(0,O.jsx)(r.NoticeStacks,{...e}),{quiet:!0});function Qt(r){let e=()=>{(typeof navigator>"u"||navigator.onLine!==!1)&&r()},t=globalThis;if(t.requestIdleCallback){let i=t.requestIdleCallback(e,{timeout:5e3});return()=>t.cancelIdleCallback?.(i)}let n=setTimeout(e,2500);return()=>clearTimeout(n)}var C=M(R(()=>(__graviewPreload(import.meta.url,["./chunk.CTQULC5F.js","./chunk.EUPSAYEI.js","./chunk.TCXKPILZ.js","./chunk.64WM4IBI.js","./chunk.IQ2HKGJS.js","./chunk.R6V37SR7.js","./chunk.SWWAEOZ7.js","./chunk.IROYMLER.js","./chunk.7NNI7YH4.js","./chunk.UT6642FC.js","./chunk.TI4OSTQV.js","./chunk.GZHZLJBF.js","./chunk.5AGW4NRZ.js","./chunk.OJGHDWI6.js","./chunk.DQS7D2W2.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.O4WEJ47H.js","./chunk.Y4ZUJUUT.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.QGG6ZRJ5.js"))));var v=h(B(),1);var Yr=h(B(),1);var qr=h(B(),1);function Be(r){return(0,qr.useMemo)(()=>r===void 0||r===""?void 0:{__html:r},[r])}var K=h(S(),1);function Ce({brand:r,size:e=22}){let t=dr(r),n=jr(t?.light),i=n?jr(t?.dark):void 0,a=Be(n!==void 0&&U(n)?n:void 0),o=Be(i!==void 0&&U(i)?i:void 0),l={display:"inline-flex",flex:"0 0 auto",height:e,color:"var(--graview-accent)"},p=cr(r);if(p)return(0,K.jsx)("span",{className:"graview-logo graview-emoji-mark","data-testid":"app-mark","aria-hidden":!0,style:{...l,alignItems:"center",fontSize:`${e*.86/16}rem`,lineHeight:1},children:p});if(!n)return null;let s=r?.logoAlt??r?.name??"",u=s!==""&&s!==r?.name,c=u?{role:"img","aria-label":s}:{"aria-hidden":!0};if(i){let w=(y,b,N)=>U(y)?(0,K.jsx)("span",{className:"graview-logo-face","data-graview-scheme-only":N,dangerouslySetInnerHTML:b}):(0,K.jsx)("img",{className:"graview-logo-face","data-graview-scheme-only":N,src:y,alt:""});return(0,K.jsxs)("span",{className:"graview-logo","data-testid":"app-mark",style:l,...c,children:[w(n,a,"light"),w(i,o,"dark")]})}let g=t?.darkFallback==="invert"?{"data-graview-logo-fallback":"invert"}:{};return U(n)?(0,K.jsx)("span",{className:"graview-logo","data-testid":"app-mark",style:l,...g,...c,dangerouslySetInnerHTML:a}):(0,K.jsx)("img",{className:"graview-logo","data-testid":"app-mark",src:n,alt:u?s:"",...g,style:{...l,width:"auto"}})}function jr(r){if(!(!r||!lr(r)))return U(r)&&sr(r)!==null?void 0:r}function Xt(r){(0,Yr.useEffect)(()=>{if(!r||typeof document>"u")return;let e=[...document.querySelectorAll('link[rel~="icon"]')],t=e.map(i=>i.getAttribute("href")),n;e.length===0&&(n=document.createElement("link"),n.rel="icon",n.setAttribute("data-graview-favicon",""),document.head.appendChild(n),e.push(n));for(let i of e)i.href=r;return()=>{n&&n.remove(),e.forEach((i,a)=>{i!==n&&t[a]!==null&&t[a]!==void 0&&i.setAttribute("href",t[a])})}},[r])}var d=h(S(),1),Zt=C.part((r,e)=>(0,d.jsx)(r.TidyFoot,{...e}),{quiet:!0}),Jt=C.part((r,e)=>(0,d.jsx)(r.Here,{...e}),{quiet:!0});function en(){let r=X(),[e,t]=(0,v.useState)("");return(0,v.useEffect)(()=>r?.store.subscribe((n,i)=>{i.some(a=>a.author.id!==r.principal.id)&&C.load().then(a=>a.sayTheirChange(i,r,t),String)}),[r]),(0,d.jsx)("span",{role:"status",className:"graview-bar-said",children:e})}var Ur="home",Qr="/",j="scene:whole";function rn(r){let{store:e,principal:t,views:n}=r,i=e.kindsKeptFrom(t),a=e.schema.kinds.filter(f=>!e.modules.disabledKinds.has(f)&&!i.has(f)),o=n?.arrangement?.(),l=n?.places()??[],p=br(o,e.schema,l),s=hr(e.schema,o,[...e.modules.administered.values()].flatMap(f=>f.kinds??[])),u=(f,x)=>(!e.graph.size.nodes||e.graph.count(f)>0)&&(p?x?p.places.has(`${f}|${x}`):p.kinds.has(f):!s.has(f)),c=[{key:Ur,label:"Home",path:Qr,group:"home",primary:!0}],g=l.filter(f=>a.includes(f.kind)&&f.as!==xr&&!f.hidden),w=new Set(ne(g).map(f=>Q(f,l,e.schema).toLowerCase())),y=f=>mr(f.as,wr(f,l)?Te(e.schema,f.kind).slice(1):void 0),b=new Set(o?.hide??[]),N=kr(a,o?.order,g);for(let{kind:f,view:x}of N){if(x){c.push({key:`place:${x.kind}:${x.as}`,label:Q(x,l,e.schema),path:y(x),group:"lists",kind:f,primary:p?p.places.has(`${f}|${x.as}`):!0});continue}let Y=Je(e.schema,f),A=w.has(Y.toLowerCase());c.push({key:`kind:${f}`,label:A?er(e.schema,f):Y,path:Te(e.schema,f),group:"lists",kind:f,primary:A||b.has(f)?!1:u(f),...b.has(f)?{hidden:!0}:{}})}for(let f of ne(g)){if(N.some(A=>A.view&&ge(A.view,f)))continue;let x=y(f),Y=[f.kind,...f.over??[]].some(A=>a.includes(A)&&u(A,f.as));c.some(A=>A.path===x)||c.push({key:`place:${f.kind}:${f.as}`,label:Q(f,l,e.schema),path:x,group:"pictures",kind:f.kind,primary:Y})}return a.some(f=>Object.keys(e.schema.tryDefinition(f)?.edges??{}).length>0)&&c.push({key:"connections",label:"Connections",path:"/map",group:"pictures",primary:!1}),c}function tn(r,e){let[t="/",n=""]=e.split("?"),i=r.find(o=>o.path===(n?`${t}?${n}`:t))??r.find(o=>o.path===t);if(i)return i.key;let a=`/${t.split("/").filter(Boolean)[0]??""}`;return r.find(o=>o.group==="lists"&&o.path===a)?.key??null}var Xr=(0,v.createContext)(null),nn=()=>(0,v.useContext)(Xr),ee=30,Zr=48,oe=640,_e=4,Re=2;function Jr(r){let{widths:e,current:t,room:n,more:i,gap:a=_e,primary:o,most:l=yr}=r;if(e.length===0||!(n>0)||!(i>0)||e.some(c=>!(c>0)))return null;let p=(c,g)=>c.reduce((w,y)=>w+e[y],0)+a*Math.max(0,c.length-1)+(g?a+i:0),s=(c,g)=>t<0||!c.includes(t)||c.slice(0,g).includes(t)?c.slice(0,g):[...c.filter(w=>w!==t).slice(0,g-1),t].sort((w,y)=>w-y),u=s(e.map((c,g)=>g).filter(c=>o?.[c]!==!1||c===t),l);if(p(u,u.length<e.length)<=n)return u.length>=Re?u:null;for(let c=u.length-1;c>=Re;c--){let g=s(u,c);if(p(g,!0)<=n)return g}return null}var an=`
271
281
  .graview-bar{display:block;margin:0;padding:0;container:graview-bar/inline-size;flex:0 0 auto;position:relative;background:var(--graview-bar);border-bottom:1px solid var(--graview-edge);color:var(--graview-ink);font-family:var(--graview-font-body,system-ui)}
272
282
  .graview-bar-row{display:flex;flex-wrap:nowrap;align-items:center;gap:16px;height:${Zr-1}px;margin:0;padding:0 16px}
273
283
  .graview-bar-home,.graview-bar-face,.graview-bar-place,.graview-bar-item,.graview-bar-at{display:inline-flex;align-items:center;box-sizing:border-box;min-width:0;margin:0;border:0;background:none;box-shadow:none;font:inherit;letter-spacing:normal;text-transform:none;text-decoration:none;color:var(--graview-ink);cursor:pointer;text-align:left}
@@ -332,8 +342,8 @@ ${Br(`${l}[data-graview-motion='reduce']`,o)}`}var Ne=h(B(),1),Mr=new WeakMap,me
332
342
  }
333
343
  @container graview-bar (max-width: 300px){
334
344
  .graview-bar-row{gap:4px;padding:0 10px}
335
- }`,re={display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,minWidth:ee,height:ee,padding:0,borderRadius:8,border:"1px solid transparent",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"0.875rem",cursor:"pointer",flex:"0 0 auto"};function on({brand:r,name:e,heading:t=1,home:n,faces:i,places:a,current:o,reach:l,tools:p,find:s=!0,description:u,findBox:c,onFind:g,switch:w="words",scenePlaces:y,skips:b,named:N=!0}){let V=(0,v.useRef)(null),f=X()?.who.size,[k,Y]=(0,v.useState)(null),[A,mt]=(0,v.useState)(null),[$,wt]=(0,v.useState)(!1),[vt,Ke]=(0,v.useState)(!1),[yt,ht]=(0,v.useState)(!0),[Ge,bt]=(0,v.useState)(null),le=i?i.pages.current:!y,kt=(0,v.useMemo)(()=>a.some(m=>m.hidden&&m.key!==o)?a.filter(m=>!m.hidden||m.key===o):a,[a,o]),Se=le?{places:kt,current:o,reach:l}:y,x=Se&&Se.places.length>0?Se:null,ze=x?x.places.findIndex(m=>m.key===x.current):-1,qe=!!i&&w==="words",je=x?x.places.map(m=>m.primary===!1?"0":"1").join(""):"",I=(0,v.useCallback)(()=>{let m=V.current;if(!m)return;let H=yn(m,ze,qe,je);H!==void 0&&bt(H);let q=H?!0:ln(m);q!==null&&ht(q)},[ze,qe,je]);(0,v.useLayoutEffect)(()=>{let m=V.current;if(!m)return;let H=()=>{let pe=m.getBoundingClientRect().width;wt(pe<oe),m.style.setProperty("--graview-bar-width",`${Math.round(pe)}px`),I()};H();let q=typeof document>"u"?void 0:document.fonts;if(q?.ready.then(I),q?.addEventListener?.("loadingdone",I),typeof ResizeObserver>"u")return()=>q?.removeEventListener?.("loadingdone",I);let Le=new ResizeObserver(H);Le.observe(m);for(let pe of m.querySelectorAll(".graview-bar-tools > *"))Le.observe(pe);return()=>{Le.disconnect(),q?.removeEventListener?.("loadingdone",I)}},[I]);let Pe=(0,v.useRef)(g);Pe.current=g,(0,v.useLayoutEffect)(()=>{Pe.current?.(s&&k?{slot:k,compact:$,own:A}:null)},[s,k,$,A]),(0,v.useLayoutEffect)(()=>()=>Pe.current?.(null),[]);let xt=(0,v.useCallback)(()=>{Ke(!0),requestAnimationFrame(()=>k?.querySelector("input")?.focus())},[k]),Ye=(0,v.useRef)(null),de=(0,v.useRef)(!1),Ue=(0,v.useCallback)(()=>{Ke(!1),de.current&&(de.current=!1,requestAnimationFrame(()=>Ye.current?.focus()))},[]),St=t===!1?"span":`h${t}`,Pt=n.href!==void 0?"a":"button",Lt=m=>H=>{!m||!rt(H)||(H.preventDefault(),m())},Et=!le,Qe=x&&!$&&Ge!==null?Ge.split(",").map(Number).filter(m=>m<x.places.length):null,ce=x?(0,d.jsx)(wn,{places:x.places,current:x.current,reach:x.reach,scene:Et,stands:Qe}):null,Tt=x?x.places.map(m=>m.label).join(`
336
- `):"";(0,v.useLayoutEffect)(I,[I,e,r,Tt,x?.current,le,$,w,s]);let At=w==="icons"||!yt||$?"icons":"words";return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("header",{ref:V,className:"graview-bar","data-testid":"app-bar","data-graview-app-bar":"",...vt&&$?{"data-finding":""}:{},children:[(0,d.jsx)("style",{children:an}),b,(0,d.jsxs)("div",{className:"graview-bar-row",children:[N?(0,d.jsx)("div",{className:"graview-bar-app",children:(0,d.jsx)(St,{className:"graview-bar-name",children:(0,d.jsxs)(Pt,{...n.href!==void 0?{href:n.href,onClick:Lt(n.go)}:{type:"button",onClick:n.go},"data-testid":"app-home",...n.current?{"aria-current":"page"}:{},title:u?`${e} \u2014 ${u}`:`${e} \u2014 home`,className:"graview-bar-home",children:[(0,d.jsx)(Ce,{brand:r,size:20}),(0,d.jsx)("span",{className:"graview-bar-app-name","data-testid":"app-name",children:e})]})})}):null,i?(0,d.jsx)(sn,{faces:i,form:w,drawn:At}):null,(0,d.jsx)("div",{className:"graview-bar-mid",...Qe?{"data-places":"standing"}:!$&&ce?{"data-place":""}:{},children:$?null:ce}),!$&&x&&x.places.length>1?(0,d.jsxs)("span",{className:"graview-bar-ruler","aria-hidden":"true","data-graview-bar-ruler":"",children:[x.places.map(m=>(0,d.jsx)("span",{className:"graview-bar-at",children:m.label},m.key)),(0,d.jsxs)("span",{className:"graview-bar-at",children:[Me,(0,d.jsx)(nt,{})]})]}):null,N?(0,d.jsx)("span",{className:"graview-bar-ruler","aria-hidden":"true",children:(0,d.jsx)("span",{className:"graview-bar-name",children:e})}):null,(0,d.jsxs)("div",{className:"graview-bar-tools",children:[s?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{type:"button",className:"graview-bar-find-open",ref:Ye,"data-testid":"app-find-open","aria-label":"Find",title:"Find",onClick:xt,style:{...re,display:void 0},children:(0,d.jsx)(un,{})}),(0,d.jsxs)("div",{className:"graview-bar-find","data-testid":"app-find",onBlur:m=>{let H=m.relatedTarget;H instanceof Node&&m.currentTarget.contains(H)||m.currentTarget.querySelector("input")?.value||Ue()},onKeyDownCapture:m=>{m.key==="Escape"&&$&&(de.current=!0)},onKeyDown:m=>{m.key!=="Escape"||!$||(!m.defaultPrevented||!m.currentTarget.querySelector("input")?.value?Ue():de.current=!1)},children:[(0,d.jsx)("div",{ref:Y,className:"graview-bar-find-slot",children:c}),(0,d.jsx)(cn,{})]})]}):null,(0,d.jsx)("div",{ref:mt,className:"graview-bar-own","data-graview-bar-own":""}),f?(0,d.jsx)(v.Suspense,{fallback:null,children:(0,d.jsx)(Jt,{scene:!le,compact:$})}):null,(0,d.jsx)(en,{}),p]})]})]}),$&&ce?(0,d.jsx)("div",{className:"graview-bar-line","data-graview-place-line":"","data-testid":"app-place-line",children:ce}):null]})}function sn({faces:r,form:e,drawn:t}){let n=i=>{let a=r[i];return(0,d.jsxs)("button",{type:"button",className:"graview-bar-face","data-testid":`app-face-${i}`,"aria-pressed":a.current,title:a.label,...a.reach&&!a.current?{onPointerEnter:a.reach,onPointerDown:a.reach,onFocus:a.reach}:{},onClick:()=>{a.current||a.go()},children:[i==="scene"?(0,d.jsx)(tt,{}):(0,d.jsx)(pn,{}),(0,d.jsx)("span",{children:a.label})]})};return(0,d.jsxs)("div",{className:"graview-bar-faces",role:"group","aria-label":`${r.scene.label} or ${r.pages.label}`,"data-testid":"app-faces","data-switch":e,"data-switch-drawn":t,children:[n("scene"),n("pages")]})}function ln(r){let e=r.querySelector(".graview-bar-faces"),t=r.querySelector(".graview-bar-mid"),n=r.querySelector(".graview-bar-find");if(!e||!t||n?.matches(":focus-within")||r.getBoundingClientRect().width<oe)return null;let a=it(e),o=t.querySelector(".graview-bar-place-words"),l=o?parseFloat(getComputedStyle(o).fontSize)||14:0,p=o?Math.min(o.scrollWidth+34,14*l):0,s=et(r);if(s===null)return!1;let u=t.getBoundingClientRect().width-p-s;if(n&&n.getBoundingClientRect().width>0){let c=parseFloat(getComputedStyle(n).flexBasis);isFinite(c)&&(u-=Math.max(0,c-n.getBoundingClientRect().width))}return e.getAttribute("data-switch-drawn")==="icons"?u>=a+2:u>=-1}function et(r){let e=r.querySelector(".graview-bar-app"),t=r.querySelector(".graview-bar-ruler>.graview-bar-name");if(!e||!t)return 0;let n=o=>o?.getBoundingClientRect().width??0,i=n(e.firstElementChild)-n(r.querySelector(".graview-bar-app-name"))+n(t)+2,a=parseFloat(getComputedStyle(e).maxWidth)/100*(e.parentElement.clientWidth-2*e.offsetLeft)||1/0;return i>a+.5?null:Math.max(0,i-n(e))}var rt=r=>r.button===0&&!(r.metaKey||r.ctrlKey||r.shiftKey||r.altKey);function dn(){let r=globalThis.navigator?.platform??"";return/Mac|iPhone|iPad|iPod/.test(r)?"\u2318K":"Ctrl K"}function cn(){let r=Dr(X()?.aiDesk);return(0,d.jsx)("span",{className:"graview-bar-find-keys","data-testid":"app-find-keys","aria-hidden":"true",children:r?"/":dn()})}function se({size:r,box:e=r,children:t}){return(0,d.jsx)("svg",{width:r,height:r,viewBox:`0 0 ${e} ${e}`,"aria-hidden":"true",focusable:"false",style:{flex:"0 0 auto"},children:t})}function tt(){return(0,d.jsxs)(se,{size:14,children:[(0,d.jsx)("path",{d:"M7 1.5 L12.5 4.5 L7 7.5 L1.5 4.5 Z",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"}),(0,d.jsx)("path",{d:"M1.5 7.5 L7 10.5 L12.5 7.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round",strokeLinecap:"round"})]})}function pn(){return(0,d.jsxs)(se,{size:14,children:[(0,d.jsx)("rect",{x:"2.25",y:"1.75",width:"9.5",height:"10.5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),(0,d.jsx)("path",{d:"M4.5 5 H9.5 M4.5 7.25 H9.5 M4.5 9.5 H7.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function nt(){return(0,d.jsx)(se,{size:10,children:(0,d.jsx)("path",{d:"M2 3.5 L5 6.5 L8 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function un(){return(0,d.jsxs)(se,{size:16,children:[(0,d.jsx)("circle",{cx:"7",cy:"7",r:"4.75",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),(0,d.jsx)("path",{d:"M10.5 10.5 L14 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function gn({place:r}){if(r.key===j)return(0,d.jsx)(tt,{});if(r.group==="home")return(0,d.jsx)(se,{size:13,box:14,children:(0,d.jsx)("path",{d:"M2 6.5 L7 2 L12 6.5 V12 H2 Z",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})});let e=r.kind?`hsl(${Math.round(nr(r.kind))} 55% 52%`:"rgb(128 128 128";return(0,d.jsx)("span",{"aria-hidden":"true",style:{display:"inline-block",width:12,height:8,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",background:r.group==="lists"?`${e})`:`linear-gradient(${e}), ${e})) center / 6px 4px no-repeat, ${e} / 0.35)`}})}var fn=[{group:"home"},{group:"lists",heading:"Lists"},{group:"pictures",heading:"Pictures"}],Me="More";function at({place:r,current:e,reach:t,standing:n,done:i}){let a=r.key===e,o=t.href?.(r.path);return(0,d.jsxs)(o!==void 0?"a":"button",{className:n?"graview-bar-at":"graview-bar-item","data-testid":`app-place-${r.key}`,"data-place-path":r.path,...a?{"aria-current":"page"}:{},...o!==void 0?{href:o}:{type:"button"},onClick:p=>{i(),t.go&&(o!==void 0&&!rt(p)||(p.preventDefault(),t.go(r)))},children:[n?null:(0,d.jsx)("span",{className:"graview-bar-mark",children:(0,d.jsx)(gn,{place:r})}),n&&a?(0,d.jsx)("span",{"data-testid":"app-place-current",children:r.label}):(0,d.jsx)("span",{children:r.label})]})}function mn({places:r,current:e,reach:t,id:n,done:i}){return(0,d.jsx)(d.Fragment,{children:fn.map(({group:a,heading:o})=>{let l=r.filter(s=>s.group===a);if(l.length===0)return null;let p=`${n}-${a}`;return(0,d.jsxs)("div",{role:"group",...o?{"aria-labelledby":p}:{"aria-label":l[0].label},"data-place-group":a,children:[o?(0,d.jsx)("p",{id:p,children:o}):null,(0,d.jsx)("ul",{children:l.map(s=>(0,d.jsx)("li",{children:(0,d.jsx)(at,{place:s,current:e,reach:t,standing:!1,done:i})},s.key))})]},a)})})}function wn({places:r,current:e,reach:t,scene:n,stands:i}){let a=J("places"),o=(0,v.useRef)(i);a.open||(o.current=i);let l=o.current,s=r.find(b=>b.key===e)?.label??"Places",u=l?r.filter((b,N)=>!l.includes(N)):r,c=vn(r,e,n),g=X(),w=g?.keptViews?.current(),y=!!(w&&(w.removed.length>0||g.views.places().some(b=>b.hidden)||w.may.lenses&&(g.views.arrangement?.()?.hide?.length??0)>0));return(0,d.jsxs)("nav",{className:l?"graview-bar-places":"graview-bar-place-at","aria-label":n?"What the scene shows":"The app\u2019s places",...l?{"data-testid":"app-places-standing"}:{},...c,children:[l?.map(b=>(0,d.jsx)(at,{place:r[b],current:e,reach:t,standing:!0,done:()=>{}},r[b].key)),u.length>0||y?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{type:"button",className:l?"graview-bar-at":"graview-bar-place","data-testid":"app-places-open",...a.trigger,onClick:a.toggle,"aria-label":l?`${Me} \u2014 ${u.length} more ${n?"pictures":"places"}`:`${s} \u2014 ${n?"everything the scene shows":"every place"}`,title:l?u.map(b=>b.label).join(", "):s,children:[l?Me:(0,d.jsx)("span",{className:"graview-bar-place-words","data-testid":"app-place-current",children:s}),(0,d.jsx)(nt,{})]}),(0,d.jsxs)("div",{...a.pane,"data-testid":"app-places",hidden:!a.open,className:"graview-bar-list",style:Z,children:[(0,d.jsx)(mn,{places:u,current:e,reach:t,id:a.pane.id,done:()=>a.setOpen(!1)}),y&&a.open?(0,d.jsx)(v.Suspense,{fallback:null,children:(0,d.jsx)(Zt,{id:a.pane.id,scene:n,reach:t,done:()=>a.setOpen(!1)})}):null]})]}):null]})}function vn(r,e,t){let n=X()?.setMenuAt,i=a=>{let o=a.target.closest?.("[data-place-path],[data-testid=app-places-open]");if(!o||!n)return;let l={at:0};a.type==="pointerdown"?document.addEventListener("pointerup",()=>l.at||=Date.now(),{once:!0}):a.preventDefault();let p=a.nativeEvent;C.load().then(s=>s.placeGesture(p,o,r,e,t,n,l),String)};return{onContextMenu:a=>a.shiftKey||i(a),onKeyDown:a=>(a.key==="ContextMenu"||a.key==="F10"&&a.shiftKey)&&i(a),onPointerDown:a=>a.pointerType!=="mouse"&&a.isPrimary&&i(a)}}function yn(r,e,t,n){let i=r.querySelector("[data-graview-bar-ruler]"),a=r.querySelector(".graview-bar-mid");if(!i||!a)return null;let o=r.querySelector(".graview-bar-find");if(o?.matches(":focus-within"))return;if(r.getBoundingClientRect().width<oe)return null;let l=et(r);if(l===null)return null;let p=[...i.children].map(V=>V.getBoundingClientRect().width),s=p.pop()??0,u=r.querySelector(".graview-bar-faces"),c=u&&t?it(u):0,g=u?.getAttribute("data-switch-drawn")==="words"?c:0,w=a.getBoundingClientRect().left+l,y=o?.getBoundingClientRect(),b=y&&y.width>0?y.right-w-(parseFloat(getComputedStyle(o).minWidth)||0)-16:a.getBoundingClientRect().width-l,N=[...n].map(V=>V!=="0");return Jr({widths:p,current:e,room:Math.floor(b+g-c),more:s,primary:N})?.join(",")??null}function it(r){return[...r.querySelectorAll(".graview-bar-face span")].reduce((e,t)=>e+t.scrollWidth+10,0)}var hn=r=>`graview:lenses:${r}`,bn=(r,e)=>r?.name??e.kinds.join(",");function De(r){try{let e=JSON.parse(localStorage.getItem(hn(r))??"[]");return Array.isArray(e)?e.filter(t=>typeof t?.title=="string"&&typeof t.lens=="string"):[]}catch{return[]}}var G=h(B(),1);var T=h(S(),1);function kn({scheme:r,onScheme:e,profileHref:t,keeping:n,hostActions:i=xn,signature:a=!1}){let{store:o,principal:l,seats:p,people:s}=fe(),u=J("profile"),c=u.open,[g,w]=(0,G.useState)(!1);(0,G.useEffect)(()=>Ln(ye),[]),c&&!g&&w(!0),(0,G.useEffect)(()=>{c&&ye()},[c]);let y=l.id===void 0?void 0:o.graph.getNode(l.id),b=y===void 0?l.id===void 0?"Nobody in particular":rr(l,{graph:o.graph,schema:o.schema,seats:p,people:s}):Ze(o.schema.tryDefinition(y.kind),y);return(0,T.jsxs)("div",{style:{position:"relative"},children:[(0,T.jsx)("button",{type:"button","data-testid":"profile-button",...u.trigger,onClick:u.toggle,onPointerEnter:ye,onFocus:ye,"aria-label":`${b} \u2014 you, your seat and your settings`,title:`${b} \u2014 you, your seat and your settings`,style:{...re,borderRadius:999},children:(0,T.jsx)("span",{"aria-hidden":"true","data-testid":"profile-mark",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:ee-4,height:ee-4,borderRadius:999,fontSize:"0.8125rem",fontWeight:600,background:"var(--graview-panel-muted)",color:"var(--graview-ink)",border:"1px solid var(--graview-edge)"},children:En(b)})}),(0,T.jsxs)("section",{...u.pane,"aria-label":"Profile","data-testid":"profile","data-graview-offstage":"",hidden:!c,style:{...Z,width:280,maxWidth:"calc(100vw - 32px)",maxHeight:"min(62cqh, 520px)",overflowY:"auto",overflowX:"hidden",display:c?"grid":"none",gap:12,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[g?(0,T.jsx)(G.Suspense,{fallback:null,children:(0,T.jsx)(Sn,{part:"top",name:b,me:y,profileHref:t,hostActions:i,close:()=>u.setOpen(!1)})}):null,(0,T.jsxs)("div",{className:"graview-profile-keeping","data-testid":"profile-keeping",style:An,children:[(0,T.jsx)("span",{style:Tn,children:"Keeping this app"}),n]}),g?(0,T.jsx)(G.Suspense,{fallback:null,children:(0,T.jsx)(Pn,{part:"rest",name:b,me:y,scheme:r,onScheme:e,hostActions:i,signature:a,close:()=>u.setOpen(!1)})}):null]})]})}var xn=[],ye=()=>C.prefetch(),Sn=C.part((r,e)=>(0,T.jsx)(r.ProfilePane,{...e}),{what:"The rest of your menu"}),Pn=C.part((r,e)=>(0,T.jsx)(r.ProfilePane,{...e}),{quiet:!0});function Ln(r){let e=()=>{(typeof navigator>"u"||navigator.onLine!==!1)&&r()},t=globalThis;if(t.requestIdleCallback){let i=t.requestIdleCallback(e,{timeout:5e3});return()=>t.cancelIdleCallback?.(i)}let n=setTimeout(e,2500);return()=>clearTimeout(n)}function En(r){return(r.trim()[0]??"?").toUpperCase()}var Tn={fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},An={paddingTop:10,borderTop:"1px solid var(--graview-edge)"};function $n(r){return!(r==="hidden"||r===!1)}var Fe=h(B(),1);var ot="The whole thing",he=r=>`scene:${r.kind}:${r.as}`;function st(r){let{view:e}=r,t=r.places.filter(c=>!r.hidden.has(c.kind)),n=ne(t),i=(c,g)=>{if(c===j)return Sr(Pr(g,!0),"view",null);let w=n.find(y=>he(y)===c);return w?Er(g,w.over?.find(y=>g.focusId===ae(y))??w.kind,w.as):null},a=e.within?.view,o=c=>e.focusId===ae(c.kind)&&(a===void 0?t.filter(g=>g.kind===c.kind).at(-1)===c:a===c.as),l=t.find(c=>o(c)&&(a!==void 0||!e.overview)),p=l?n.find(c=>ge(c,l)):void 0,s=n.filter(c=>!c.hidden||c===p);return{places:[{key:j,label:ot,path:`${Ae}${Oe(i(j,$e))}`,group:"home"},...s.map(c=>({key:he(c),label:Q(c,t,r.schema),path:`${Ae}${Oe(i(he(c),$e))}`,group:"pictures",kind:c.kind}))],current:p?he(p):j,to:i}}function On(){let{store:r,views:e,hiddenKinds:t}=fe(),{view:n,go:i}=Nr(),a=e.places(),o=(0,Fe.useMemo)(()=>st({places:a,hidden:t,view:n,schema:r.schema}),[a,t,n,r.schema]),l=(0,Fe.useMemo)(()=>({go:p=>{let s=o.to(p.key,n);s&&i(s)}}),[o,n,i]);return{places:o.places,current:o.current,reach:l}}var te=h(B(),1);var _=h(S(),1),Nn=C.part((r,e)=>(0,_.jsx)(r.ProblemRows,{...e}),{what:"The problems",as:"li"}),Ve=()=>C.prefetch();function Hn({clean:r="All rules hold"}){let e=Or(),{set:t}=$r(),n=e.length,[i,a]=(0,te.useState)(!1),o=J("problems",{open:i&&n>0,onOpenChange:a}),l=o.open,p=dt(e,r);return(0,te.useEffect)(()=>{if(n===0)return;let s=setTimeout(Ve,1500);return()=>clearTimeout(s)},[n>0]),(0,_.jsxs)("div",{style:{position:"relative",display:"inline-flex"},children:[(0,_.jsxs)("button",{type:"button","data-testid":"standing",...o.trigger,"aria-disabled":n===0?!0:void 0,"aria-label":p,onClick:n===0?void 0:o.toggle,onPointerEnter:n===0?void 0:Ve,onFocus:n===0?void 0:Ve,title:p,style:{...re,padding:n===0?0:"0 8px",cursor:n===0?"default":"pointer",color:n===0?"var(--graview-ink-muted)":lt(e),fontVariantNumeric:"tabular-nums",fontWeight:600},children:[(0,_.jsx)(ct,{tone:n===0?"var(--graview-good)":lt(e)}),n>0?(0,_.jsx)("span",{"aria-hidden":"true",children:n}):null]}),l?(0,_.jsx)("ol",{...o.pane,"data-testid":"problems",style:{...Z,width:300,maxHeight:"min(48cqh, 420px)",overflow:"auto",margin:0,padding:4,listStyle:"none",display:"grid",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:(0,_.jsx)(te.Suspense,{fallback:null,children:(0,_.jsx)(Nn,{violations:e,pick:s=>{t(s.nodeIds),o.setOpen(!1)}})})}):null]})}function dt(r,e){return r.length===0?e:`${tr(r)} \u2014 open what is broken, and what would fix it`}var lt=r=>r.some(e=>e.status==="could-not-judge"||e.status==="over-budget")?"var(--graview-bad)":"var(--graview-warn)";function ct({tone:r}){return(0,_.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:999,flex:"0 0 auto",background:r}})}function Bn(r,e,t=[]){if(r.focusId)return r.focusId;let i=(r.selection??[]).map(Lr).find(a=>a!==null)??t.find(a=>e.includes(a))??e[0]??null;return i===null?null:ae(i)}var ke=h(S(),1),be=M(R(()=>(__graviewPreload(import.meta.url,["./chunk.HZGVEHEN.js","./chunk.JBW3DI7E.js","./chunk.CBUSFM3E.js","./chunk.NIVTK2W5.js","./chunk.V5FIZIX2.js","./chunk.DQHPEKWK.js","./chunk.LSLLKICK.js","./chunk.EAUVEVVO.js","./chunk.C2UFMFJ3.js","./chunk.Y5ARSVH4.js","./chunk.PKUDIWIF.js","./chunk.VW2VCPJX.js","./chunk.WVUJXDXZ.js","./chunk.OYHQSXNC.js","./chunk.UHX4WTM7.js","./chunk.IKX4VDTW.js","./chunk.RNEJYIQ7.js","./chunk.TBQOSI4J.js","./chunk.KWQ7QOHD.js","./chunk.GZHZLJBF.js","./chunk.6MADC6DM.js","./chunk.OJGHDWI6.js","./chunk.JLEC3USG.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.6BJBPDF3.js","./chunk.XWAMQPUM.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.L24FCXZ7.js"))));function Cn(){return be.load().then(()=>{})}var Rn=[{cardinality:"one",fidelity:"full",slot:"page"},{cardinality:"one",fidelity:"summary",slot:"card"},{cardinality:"one",fidelity:"glyph",slot:"row"},{cardinality:"many",fidelity:"full"},{cardinality:"many",fidelity:"summary"},{cardinality:"many",fidelity:"glyph"}];function Mn({schema:r,specs:e,kind:t,view:n}){let i=be.current.frameworkViews(r,e).lookup(t,{cardinality:n.cardinality,fidelity:n.fidelity});return i?(0,ke.jsx)(i,{...n}):null}var _n=be.part((r,e)=>(0,ke.jsx)(Mn,{...e}),{what:"This view"});function pt(r,e,t){for(let n of e.kinds){let i=t?.[n];for(let a of Rn){let o=p=>(0,ke.jsx)(_n,{schema:e,specs:t,kind:n,view:p}),l=a.slot!==void 0&&i?.[a.slot]!==void 0;l&&(o.says=(p,s)=>be.current?.frameworkViews(e,t).lookup(n,{cardinality:a.cardinality,fidelity:a.fidelity})?.says?.(p,s)),r.register(n,{cardinality:a.cardinality,fidelity:a.fidelity},l?o:Tr(o))}}return r}function Dn(r,e){return pt(Ar(r),r,e)}var Ie=h(B(),1);var F=h(S(),1),ut=M(R(()=>(__graviewPreload(import.meta.url,["./chunk.4XOWRYRU.js","./chunk.RYRTKIKB.js","./chunk.M5GJHVWZ.js","./chunk.WSTBCWW7.js","./chunk.HZGVEHEN.js","./chunk.JBW3DI7E.js","./chunk.CBUSFM3E.js","./chunk.NIVTK2W5.js","./chunk.HJCQ6I3S.js","./chunk.BNPQUI3F.js","./chunk.6RY6OSE6.js","./chunk.SZ34UAQ3.js","./chunk.V5FIZIX2.js","./chunk.DQHPEKWK.js","./chunk.LSLLKICK.js","./chunk.EAUVEVVO.js","./chunk.C2UFMFJ3.js","./chunk.ZJ2VS4M4.js","./chunk.Y5ARSVH4.js","./chunk.PKUDIWIF.js","./chunk.VW2VCPJX.js","./chunk.WBHM5I3I.js","./chunk.VC3BX2ZF.js","./chunk.UKAPFIPJ.js","./chunk.UT6642FC.js","./chunk.Q7RQC3F7.js","./chunk.WVUJXDXZ.js","./chunk.OYHQSXNC.js","./chunk.UHX4WTM7.js","./chunk.IKX4VDTW.js","./chunk.RNEJYIQ7.js","./chunk.TBQOSI4J.js","./chunk.KWQ7QOHD.js","./chunk.GZHZLJBF.js","./chunk.6MADC6DM.js","./chunk.OJGHDWI6.js","./chunk.JLEC3USG.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.6BJBPDF3.js","./chunk.XWAMQPUM.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.GFLAGZSB.js"))));function Fn({lens:r,view:e}){let t=ut.current.declaredLensView(r);return(0,F.jsx)(t,{...e})}var Vn=ut.part((r,e)=>(0,F.jsx)(Fn,{...e}),{what:"This picture"});function In(r){let e=t=>(0,F.jsx)(Ie.Suspense,{fallback:null,children:(0,F.jsx)(Vn,{lens:r,view:t})});return r.lens==="blocks"&&(e.flows=!0),r.create===!1&&(e.creates=!1),e}var gt=M(R(()=>(__graviewPreload(import.meta.url,["./chunk.HZGVEHEN.js","./chunk.JBW3DI7E.js","./chunk.CBUSFM3E.js","./chunk.NIVTK2W5.js","./chunk.V5FIZIX2.js","./chunk.DQHPEKWK.js","./chunk.LSLLKICK.js","./chunk.EAUVEVVO.js","./chunk.C2UFMFJ3.js","./chunk.Y5ARSVH4.js","./chunk.PKUDIWIF.js","./chunk.VW2VCPJX.js","./chunk.WVUJXDXZ.js","./chunk.OYHQSXNC.js","./chunk.UHX4WTM7.js","./chunk.IKX4VDTW.js","./chunk.RNEJYIQ7.js","./chunk.TBQOSI4J.js","./chunk.KWQ7QOHD.js","./chunk.GZHZLJBF.js","./chunk.6MADC6DM.js","./chunk.OJGHDWI6.js","./chunk.JLEC3USG.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.6BJBPDF3.js","./chunk.XWAMQPUM.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.6USUVORO.js"))));function Wn({blocks:r,view:e}){let t=gt.current.homeView(r);return(0,F.jsx)(t,{...e})}var Kn=gt.part((r,e)=>(0,F.jsx)(Wn,{...e}),{what:"The home"});function Gn(r){let e=t=>(0,F.jsx)(Ie.Suspense,{fallback:null,children:(0,F.jsx)(Kn,{blocks:r,view:t})});return Object.defineProperty(e,Symbol.for("graview.home-blocks"),{value:!0}),e}function zn(r,e){return e.home&&e.home.length>0&&r.home?.(Gn(e.home)),ft(r,e),r.arrange?.(e.pages),r}function ft(r,e,t){for(let n of vr(e).drawn){if(t&&r.places().some(o=>o.title===n.title))continue;let i=In(n),a={title:n.title,lens:n.lens,...n.across?{across:n.across}:{},...t?{beside:t}:{},...n.hidden?{hidden:!0}:{},over:n.kinds,...t?{}:{declared:!0}};for(let o of n.kinds)r.register(o,{cardinality:"many",fidelity:"full"},i,a),r.register(o,{cardinality:"many",fidelity:"summary"},i,a)}}function qn(r,e,t){t.length>0&&ft(r,{schema:e,lenses:t.map(({lens:n,...i})=>({...i,name:n}))},!0)}function jn(r,e,t){qn(r,e,De(t))}var z=h(B(),1),xe=h(S(),1);var We=r=>`graview:first-look:${r}`;function Yn(r,e){if(r.seen!==void 0)try{return typeof r.seen=="function"?r.seen():r.seen}catch{return!0}try{return window.localStorage.getItem(We(e))!==null}catch{return!1}}function Un(r,e){if(r.seen===void 0)try{window.localStorage.setItem(We(e),"seen")}catch{}}var Qn=M(R(()=>(__graviewPreload(import.meta.url,["./chunk.XWAMQPUM.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.UNCS63AM.js")))),Xn=Qn.part((r,e)=>{let t=r.FirstLookHints;return(0,xe.jsx)(t,{...e})},{quiet:!0});function Zn({firstLook:r,root:e,app:t}){let n=(0,z.useRef)(null);n.current=r===!0?{}:r||null;let[i,a]=(0,z.useState)(()=>n.current!==null&&typeof window<"u"&&!Yn(n.current,t)),o=(0,z.useCallback)(l=>{if(a(!1),l===null)return;let p=n.current??{};Un(p,t),p.onDone?.(l)},[t]);return!i||n.current===null?null:(0,xe.jsx)(z.Suspense,{fallback:null,children:(0,xe.jsx)(Xn,{root:e,steps:n.current.steps??[],onEnd:o})})}export{Nt as a,Ht as b,me as c,Mt as d,ta as e,Dr as f,na as g,Be as h,Xt as i,Kr as j,Wt as k,Kt as l,ve as m,Gt as n,qt as o,jt as p,Yt as q,C as r,rn as s,tn as t,Xr as u,nn as v,re as w,on as x,kn as y,$n as z,On as A,hn as B,bn as C,De as D,Hn as E,dt as F,ct as G,Bn as H,zn as I,qn as J,jn as K,Cn as L,Dn as M,Zn as N};
345
+ }`,re={display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,minWidth:ee,height:ee,padding:0,borderRadius:8,border:"1px solid transparent",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"0.875rem",cursor:"pointer",flex:"0 0 auto"};function on({brand:r,name:e,heading:t=1,home:n,faces:i,places:a,current:o,reach:l,tools:p,find:s=!0,description:u,findBox:c,onFind:g,switch:w="words",scenePlaces:y,skips:b,named:N=!0}){let V=(0,v.useRef)(null),f=X()?.who.size,[x,Y]=(0,v.useState)(null),[A,mt]=(0,v.useState)(null),[$,wt]=(0,v.useState)(!1),[vt,Ke]=(0,v.useState)(!1),[yt,ht]=(0,v.useState)(!0),[Ge,bt]=(0,v.useState)(null),le=i?i.pages.current:!y,xt=(0,v.useMemo)(()=>a.some(m=>m.hidden&&m.key!==o)?a.filter(m=>!m.hidden||m.key===o):a,[a,o]),Se=le?{places:xt,current:o,reach:l}:y,k=Se&&Se.places.length>0?Se:null,ze=k?k.places.findIndex(m=>m.key===k.current):-1,qe=!!i&&w==="words",je=k?k.places.map(m=>m.primary===!1?"0":"1").join(""):"",I=(0,v.useCallback)(()=>{let m=V.current;if(!m)return;let H=yn(m,ze,qe,je);H!==void 0&&bt(H);let q=H?!0:ln(m);q!==null&&ht(q)},[ze,qe,je]);(0,v.useLayoutEffect)(()=>{let m=V.current;if(!m)return;let H=()=>{let pe=m.getBoundingClientRect().width;wt(pe<oe),m.style.setProperty("--graview-bar-width",`${Math.round(pe)}px`),I()};H();let q=typeof document>"u"?void 0:document.fonts;if(q?.ready.then(I),q?.addEventListener?.("loadingdone",I),typeof ResizeObserver>"u")return()=>q?.removeEventListener?.("loadingdone",I);let Le=new ResizeObserver(H);Le.observe(m);for(let pe of m.querySelectorAll(".graview-bar-tools > *"))Le.observe(pe);return()=>{Le.disconnect(),q?.removeEventListener?.("loadingdone",I)}},[I]);let Pe=(0,v.useRef)(g);Pe.current=g,(0,v.useLayoutEffect)(()=>{Pe.current?.(s&&x?{slot:x,compact:$,own:A}:null)},[s,x,$,A]),(0,v.useLayoutEffect)(()=>()=>Pe.current?.(null),[]);let kt=(0,v.useCallback)(()=>{Ke(!0),requestAnimationFrame(()=>x?.querySelector("input")?.focus())},[x]),Ye=(0,v.useRef)(null),de=(0,v.useRef)(!1),Ue=(0,v.useCallback)(()=>{Ke(!1),de.current&&(de.current=!1,requestAnimationFrame(()=>Ye.current?.focus()))},[]),St=t===!1?"span":`h${t}`,Pt=n.href!==void 0?"a":"button",Lt=m=>H=>{!m||!rt(H)||(H.preventDefault(),m())},Et=!le,Qe=k&&!$&&Ge!==null?Ge.split(",").map(Number).filter(m=>m<k.places.length):null,ce=k?(0,d.jsx)(wn,{places:k.places,current:k.current,reach:k.reach,scene:Et,stands:Qe}):null,Tt=k?k.places.map(m=>m.label).join(`
346
+ `):"";(0,v.useLayoutEffect)(I,[I,e,r,Tt,k?.current,le,$,w,s]);let At=w==="icons"||!yt||$?"icons":"words";return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("header",{ref:V,className:"graview-bar","data-testid":"app-bar","data-graview-app-bar":"",...vt&&$?{"data-finding":""}:{},children:[(0,d.jsx)("style",{children:an}),b,(0,d.jsxs)("div",{className:"graview-bar-row",children:[N?(0,d.jsx)("div",{className:"graview-bar-app",children:(0,d.jsx)(St,{className:"graview-bar-name",children:(0,d.jsxs)(Pt,{...n.href!==void 0?{href:n.href,onClick:Lt(n.go)}:{type:"button",onClick:n.go},"data-testid":"app-home",...n.current?{"aria-current":"page"}:{},title:u?`${e} \u2014 ${u}`:`${e} \u2014 home`,className:"graview-bar-home",children:[(0,d.jsx)(Ce,{brand:r,size:20}),(0,d.jsx)("span",{className:"graview-bar-app-name","data-testid":"app-name",children:e})]})})}):null,i?(0,d.jsx)(sn,{faces:i,form:w,drawn:At}):null,(0,d.jsx)("div",{className:"graview-bar-mid",...Qe?{"data-places":"standing"}:!$&&ce?{"data-place":""}:{},children:$?null:ce}),!$&&k&&k.places.length>1?(0,d.jsxs)("span",{className:"graview-bar-ruler","aria-hidden":"true","data-graview-bar-ruler":"",children:[k.places.map(m=>(0,d.jsx)("span",{className:"graview-bar-at",children:m.label},m.key)),(0,d.jsxs)("span",{className:"graview-bar-at",children:[Me,(0,d.jsx)(nt,{})]})]}):null,N?(0,d.jsx)("span",{className:"graview-bar-ruler","aria-hidden":"true",children:(0,d.jsx)("span",{className:"graview-bar-name",children:e})}):null,(0,d.jsxs)("div",{className:"graview-bar-tools",children:[s?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{type:"button",className:"graview-bar-find-open",ref:Ye,"data-testid":"app-find-open","aria-label":"Find",title:"Find",onClick:kt,style:{...re,display:void 0},children:(0,d.jsx)(un,{})}),(0,d.jsxs)("div",{className:"graview-bar-find","data-testid":"app-find",onBlur:m=>{let H=m.relatedTarget;H instanceof Node&&m.currentTarget.contains(H)||m.currentTarget.querySelector("input")?.value||Ue()},onKeyDownCapture:m=>{m.key==="Escape"&&$&&(de.current=!0)},onKeyDown:m=>{m.key!=="Escape"||!$||(!m.defaultPrevented||!m.currentTarget.querySelector("input")?.value?Ue():de.current=!1)},children:[(0,d.jsx)("div",{ref:Y,className:"graview-bar-find-slot",children:c}),(0,d.jsx)(cn,{})]})]}):null,(0,d.jsx)("div",{ref:mt,className:"graview-bar-own","data-graview-bar-own":""}),f?(0,d.jsx)(v.Suspense,{fallback:null,children:(0,d.jsx)(Jt,{scene:!le,compact:$})}):null,(0,d.jsx)(en,{}),p]})]})]}),$&&ce?(0,d.jsx)("div",{className:"graview-bar-line","data-graview-place-line":"","data-testid":"app-place-line",children:ce}):null]})}function sn({faces:r,form:e,drawn:t}){let n=i=>{let a=r[i];return(0,d.jsxs)("button",{type:"button",className:"graview-bar-face","data-testid":`app-face-${i}`,"aria-pressed":a.current,title:a.label,...a.reach&&!a.current?{onPointerEnter:a.reach,onPointerDown:a.reach,onFocus:a.reach}:{},onClick:()=>{a.current||a.go()},children:[i==="scene"?(0,d.jsx)(tt,{}):(0,d.jsx)(pn,{}),(0,d.jsx)("span",{children:a.label})]})};return(0,d.jsxs)("div",{className:"graview-bar-faces",role:"group","aria-label":`${r.scene.label} or ${r.pages.label}`,"data-testid":"app-faces","data-switch":e,"data-switch-drawn":t,children:[n("scene"),n("pages")]})}function ln(r){let e=r.querySelector(".graview-bar-faces"),t=r.querySelector(".graview-bar-mid"),n=r.querySelector(".graview-bar-find");if(!e||!t||n?.matches(":focus-within")||r.getBoundingClientRect().width<oe)return null;let a=it(e),o=t.querySelector(".graview-bar-place-words"),l=o?parseFloat(getComputedStyle(o).fontSize)||14:0,p=o?Math.min(o.scrollWidth+34,14*l):0,s=et(r);if(s===null)return!1;let u=t.getBoundingClientRect().width-p-s;if(n&&n.getBoundingClientRect().width>0){let c=parseFloat(getComputedStyle(n).flexBasis);isFinite(c)&&(u-=Math.max(0,c-n.getBoundingClientRect().width))}return e.getAttribute("data-switch-drawn")==="icons"?u>=a+2:u>=-1}function et(r){let e=r.querySelector(".graview-bar-app"),t=r.querySelector(".graview-bar-ruler>.graview-bar-name");if(!e||!t)return 0;let n=o=>o?.getBoundingClientRect().width??0,i=n(e.firstElementChild)-n(r.querySelector(".graview-bar-app-name"))+n(t)+2,a=parseFloat(getComputedStyle(e).maxWidth)/100*(e.parentElement.clientWidth-2*e.offsetLeft)||1/0;return i>a+.5?null:Math.max(0,i-n(e))}var rt=r=>r.button===0&&!(r.metaKey||r.ctrlKey||r.shiftKey||r.altKey);function dn(){let r=globalThis.navigator?.platform??"";return/Mac|iPhone|iPad|iPod/.test(r)?"\u2318K":"Ctrl K"}function cn(){let r=Dr(X()?.aiDesk);return(0,d.jsx)("span",{className:"graview-bar-find-keys","data-testid":"app-find-keys","aria-hidden":"true",children:r?"/":dn()})}function se({size:r,box:e=r,children:t}){return(0,d.jsx)("svg",{width:r,height:r,viewBox:`0 0 ${e} ${e}`,"aria-hidden":"true",focusable:"false",style:{flex:"0 0 auto"},children:t})}function tt(){return(0,d.jsxs)(se,{size:14,children:[(0,d.jsx)("path",{d:"M7 1.5 L12.5 4.5 L7 7.5 L1.5 4.5 Z",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"}),(0,d.jsx)("path",{d:"M1.5 7.5 L7 10.5 L12.5 7.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round",strokeLinecap:"round"})]})}function pn(){return(0,d.jsxs)(se,{size:14,children:[(0,d.jsx)("rect",{x:"2.25",y:"1.75",width:"9.5",height:"10.5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),(0,d.jsx)("path",{d:"M4.5 5 H9.5 M4.5 7.25 H9.5 M4.5 9.5 H7.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function nt(){return(0,d.jsx)(se,{size:10,children:(0,d.jsx)("path",{d:"M2 3.5 L5 6.5 L8 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function un(){return(0,d.jsxs)(se,{size:16,children:[(0,d.jsx)("circle",{cx:"7",cy:"7",r:"4.75",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),(0,d.jsx)("path",{d:"M10.5 10.5 L14 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function gn({place:r}){if(r.key===j)return(0,d.jsx)(tt,{});if(r.group==="home")return(0,d.jsx)(se,{size:13,box:14,children:(0,d.jsx)("path",{d:"M2 6.5 L7 2 L12 6.5 V12 H2 Z",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})});let e=r.kind?`hsl(${Math.round(nr(r.kind))} 55% 52%`:"rgb(128 128 128";return(0,d.jsx)("span",{"aria-hidden":"true",style:{display:"inline-block",width:12,height:8,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",background:r.group==="lists"?`${e})`:`linear-gradient(${e}), ${e})) center / 6px 4px no-repeat, ${e} / 0.35)`}})}var fn=[{group:"home"},{group:"lists",heading:"Lists"},{group:"pictures",heading:"Pictures"}],Me="More";function at({place:r,current:e,reach:t,standing:n,done:i}){let a=r.key===e,o=t.href?.(r.path);return(0,d.jsxs)(o!==void 0?"a":"button",{className:n?"graview-bar-at":"graview-bar-item","data-testid":`app-place-${r.key}`,"data-place-path":r.path,...a?{"aria-current":"page"}:{},...o!==void 0?{href:o}:{type:"button"},onClick:p=>{i(),t.go&&(o!==void 0&&!rt(p)||(p.preventDefault(),t.go(r)))},children:[n?null:(0,d.jsx)("span",{className:"graview-bar-mark",children:(0,d.jsx)(gn,{place:r})}),n&&a?(0,d.jsx)("span",{"data-testid":"app-place-current",children:r.label}):(0,d.jsx)("span",{children:r.label})]})}function mn({places:r,current:e,reach:t,id:n,done:i}){return(0,d.jsx)(d.Fragment,{children:fn.map(({group:a,heading:o})=>{let l=r.filter(s=>s.group===a);if(l.length===0)return null;let p=`${n}-${a}`;return(0,d.jsxs)("div",{role:"group",...o?{"aria-labelledby":p}:{"aria-label":l[0].label},"data-place-group":a,children:[o?(0,d.jsx)("p",{id:p,children:o}):null,(0,d.jsx)("ul",{children:l.map(s=>(0,d.jsx)("li",{children:(0,d.jsx)(at,{place:s,current:e,reach:t,standing:!1,done:i})},s.key))})]},a)})})}function wn({places:r,current:e,reach:t,scene:n,stands:i}){let a=J("places"),o=(0,v.useRef)(i);a.open||(o.current=i);let l=o.current,s=r.find(b=>b.key===e)?.label??"Places",u=l?r.filter((b,N)=>!l.includes(N)):r,c=vn(r,e,n),g=X(),w=g?.keptViews?.current(),y=!!(w&&(w.removed.length>0||g.views.places().some(b=>b.hidden)||w.may.lenses&&(g.views.arrangement?.()?.hide?.length??0)>0));return(0,d.jsxs)("nav",{className:l?"graview-bar-places":"graview-bar-place-at","aria-label":n?"What the scene shows":"The app\u2019s places",...l?{"data-testid":"app-places-standing"}:{},...c,children:[l?.map(b=>(0,d.jsx)(at,{place:r[b],current:e,reach:t,standing:!0,done:()=>{}},r[b].key)),u.length>0||y?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{type:"button",className:l?"graview-bar-at":"graview-bar-place","data-testid":"app-places-open",...a.trigger,onClick:a.toggle,"aria-label":l?`${Me} \u2014 ${u.length} more ${n?"pictures":"places"}`:`${s} \u2014 ${n?"everything the scene shows":"every place"}`,title:l?u.map(b=>b.label).join(", "):s,children:[l?Me:(0,d.jsx)("span",{className:"graview-bar-place-words","data-testid":"app-place-current",children:s}),(0,d.jsx)(nt,{})]}),(0,d.jsxs)("div",{...a.pane,"data-testid":"app-places",hidden:!a.open,className:"graview-bar-list",style:Z,children:[(0,d.jsx)(mn,{places:u,current:e,reach:t,id:a.pane.id,done:()=>a.setOpen(!1)}),y&&a.open?(0,d.jsx)(v.Suspense,{fallback:null,children:(0,d.jsx)(Zt,{id:a.pane.id,scene:n,reach:t,done:()=>a.setOpen(!1)})}):null]})]}):null]})}function vn(r,e,t){let n=X()?.setMenuAt,i=a=>{let o=a.target.closest?.("[data-place-path],[data-testid=app-places-open]");if(!o||!n)return;let l={at:0};a.type==="pointerdown"?document.addEventListener("pointerup",()=>l.at||=Date.now(),{once:!0}):a.preventDefault();let p=a.nativeEvent;C.load().then(s=>s.placeGesture(p,o,r,e,t,n,l),String)};return{onContextMenu:a=>a.shiftKey||i(a),onKeyDown:a=>(a.key==="ContextMenu"||a.key==="F10"&&a.shiftKey)&&i(a),onPointerDown:a=>a.pointerType!=="mouse"&&a.isPrimary&&i(a)}}function yn(r,e,t,n){let i=r.querySelector("[data-graview-bar-ruler]"),a=r.querySelector(".graview-bar-mid");if(!i||!a)return null;let o=r.querySelector(".graview-bar-find");if(o?.matches(":focus-within"))return;if(r.getBoundingClientRect().width<oe)return null;let l=et(r);if(l===null)return null;let p=[...i.children].map(V=>V.getBoundingClientRect().width),s=p.pop()??0,u=r.querySelector(".graview-bar-faces"),c=u&&t?it(u):0,g=u?.getAttribute("data-switch-drawn")==="words"?c:0,w=a.getBoundingClientRect().left+l,y=o?.getBoundingClientRect(),b=y&&y.width>0?y.right-w-(parseFloat(getComputedStyle(o).minWidth)||0)-16:a.getBoundingClientRect().width-l,N=[...n].map(V=>V!=="0");return Jr({widths:p,current:e,room:Math.floor(b+g-c),more:s,primary:N})?.join(",")??null}function it(r){return[...r.querySelectorAll(".graview-bar-face span")].reduce((e,t)=>e+t.scrollWidth+10,0)}var hn=r=>`graview:lenses:${r}`,bn=(r,e)=>r?.name??e.kinds.join(",");function De(r){try{let e=JSON.parse(localStorage.getItem(hn(r))??"[]");return Array.isArray(e)?e.filter(t=>typeof t?.title=="string"&&typeof t.lens=="string"):[]}catch{return[]}}var G=h(B(),1);var T=h(S(),1);function xn({scheme:r,onScheme:e,profileHref:t,keeping:n,hostActions:i=kn,signature:a=!1}){let{store:o,principal:l,seats:p,people:s}=fe(),u=J("profile"),c=u.open,[g,w]=(0,G.useState)(!1);(0,G.useEffect)(()=>Ln(ye),[]),c&&!g&&w(!0),(0,G.useEffect)(()=>{c&&ye()},[c]);let y=l.id===void 0?void 0:o.graph.getNode(l.id),b=y===void 0?l.id===void 0?"Nobody in particular":rr(l,{graph:o.graph,schema:o.schema,seats:p,people:s}):Ze(o.schema.tryDefinition(y.kind),y);return(0,T.jsxs)("div",{style:{position:"relative"},children:[(0,T.jsx)("button",{type:"button","data-testid":"profile-button",...u.trigger,onClick:u.toggle,onPointerEnter:ye,onFocus:ye,"aria-label":`${b} \u2014 you, your seat and your settings`,title:`${b} \u2014 you, your seat and your settings`,style:{...re,borderRadius:999},children:(0,T.jsx)("span",{"aria-hidden":"true","data-testid":"profile-mark",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:ee-4,height:ee-4,borderRadius:999,fontSize:"0.8125rem",fontWeight:600,background:"var(--graview-panel-muted)",color:"var(--graview-ink)",border:"1px solid var(--graview-edge)"},children:En(b)})}),(0,T.jsxs)("section",{...u.pane,"aria-label":"Profile","data-testid":"profile","data-graview-offstage":"",hidden:!c,style:{...Z,width:280,maxWidth:"calc(100vw - 32px)",maxHeight:"min(62cqh, 520px)",overflowY:"auto",overflowX:"hidden",display:c?"grid":"none",gap:12,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[g?(0,T.jsx)(G.Suspense,{fallback:null,children:(0,T.jsx)(Sn,{part:"top",name:b,me:y,profileHref:t,hostActions:i,close:()=>u.setOpen(!1)})}):null,(0,T.jsxs)("div",{className:"graview-profile-keeping","data-testid":"profile-keeping",style:An,children:[(0,T.jsx)("span",{style:Tn,children:"Keeping this app"}),n]}),g?(0,T.jsx)(G.Suspense,{fallback:null,children:(0,T.jsx)(Pn,{part:"rest",name:b,me:y,scheme:r,onScheme:e,hostActions:i,signature:a,close:()=>u.setOpen(!1)})}):null]})]})}var kn=[],ye=()=>C.prefetch(),Sn=C.part((r,e)=>(0,T.jsx)(r.ProfilePane,{...e}),{what:"The rest of your menu"}),Pn=C.part((r,e)=>(0,T.jsx)(r.ProfilePane,{...e}),{quiet:!0});function Ln(r){let e=()=>{(typeof navigator>"u"||navigator.onLine!==!1)&&r()},t=globalThis;if(t.requestIdleCallback){let i=t.requestIdleCallback(e,{timeout:5e3});return()=>t.cancelIdleCallback?.(i)}let n=setTimeout(e,2500);return()=>clearTimeout(n)}function En(r){return(r.trim()[0]??"?").toUpperCase()}var Tn={fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},An={paddingTop:10,borderTop:"1px solid var(--graview-edge)"};function $n(r){return!(r==="hidden"||r===!1)}var Fe=h(B(),1);var ot="The whole thing",he=r=>`scene:${r.kind}:${r.as}`;function st(r){let{view:e}=r,t=r.places.filter(c=>!r.hidden.has(c.kind)),n=ne(t),i=(c,g)=>{if(c===j)return Sr(Pr(g,!0),"view",null);let w=n.find(y=>he(y)===c);return w?Er(g,w.over?.find(y=>g.focusId===ae(y))??w.kind,w.as):null},a=e.within?.view,o=c=>e.focusId===ae(c.kind)&&(a===void 0?t.filter(g=>g.kind===c.kind).at(-1)===c:a===c.as),l=t.find(c=>o(c)&&(a!==void 0||!e.overview)),p=l?n.find(c=>ge(c,l)):void 0,s=n.filter(c=>!c.hidden||c===p);return{places:[{key:j,label:ot,path:`${Ae}${Oe(i(j,$e))}`,group:"home"},...s.map(c=>({key:he(c),label:Q(c,t,r.schema),path:`${Ae}${Oe(i(he(c),$e))}`,group:"pictures",kind:c.kind}))],current:p?he(p):j,to:i}}function On(){let{store:r,views:e,hiddenKinds:t}=fe(),{view:n,go:i}=Nr(),a=e.places(),o=(0,Fe.useMemo)(()=>st({places:a,hidden:t,view:n,schema:r.schema}),[a,t,n,r.schema]),l=(0,Fe.useMemo)(()=>({go:p=>{let s=o.to(p.key,n);s&&i(s)}}),[o,n,i]);return{places:o.places,current:o.current,reach:l}}var te=h(B(),1);var _=h(S(),1),Nn=C.part((r,e)=>(0,_.jsx)(r.ProblemRows,{...e}),{what:"The problems",as:"li"}),Ve=()=>C.prefetch();function Hn({clean:r="All rules hold"}){let e=Or(),{set:t}=$r(),n=e.length,[i,a]=(0,te.useState)(!1),o=J("problems",{open:i&&n>0,onOpenChange:a}),l=o.open,p=dt(e,r);return(0,te.useEffect)(()=>{if(n===0)return;let s=setTimeout(Ve,1500);return()=>clearTimeout(s)},[n>0]),(0,_.jsxs)("div",{style:{position:"relative",display:"inline-flex"},children:[(0,_.jsxs)("button",{type:"button","data-testid":"standing",...o.trigger,"aria-disabled":n===0?!0:void 0,"aria-label":p,onClick:n===0?void 0:o.toggle,onPointerEnter:n===0?void 0:Ve,onFocus:n===0?void 0:Ve,title:p,style:{...re,padding:n===0?0:"0 8px",cursor:n===0?"default":"pointer",color:n===0?"var(--graview-ink-muted)":lt(e),fontVariantNumeric:"tabular-nums",fontWeight:600},children:[(0,_.jsx)(ct,{tone:n===0?"var(--graview-good)":lt(e)}),n>0?(0,_.jsx)("span",{"aria-hidden":"true",children:n}):null]}),l?(0,_.jsx)("ol",{...o.pane,"data-testid":"problems",style:{...Z,width:300,maxHeight:"min(48cqh, 420px)",overflow:"auto",margin:0,padding:4,listStyle:"none",display:"grid",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:(0,_.jsx)(te.Suspense,{fallback:null,children:(0,_.jsx)(Nn,{violations:e,pick:s=>{t(s.nodeIds),o.setOpen(!1)}})})}):null]})}function dt(r,e){return r.length===0?e:`${tr(r)} \u2014 open what is broken, and what would fix it`}var lt=r=>r.some(e=>e.status==="could-not-judge"||e.status==="over-budget")?"var(--graview-bad)":"var(--graview-warn)";function ct({tone:r}){return(0,_.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:999,flex:"0 0 auto",background:r}})}function Bn(r,e,t=[]){if(r.focusId)return r.focusId;let i=(r.selection??[]).map(Lr).find(a=>a!==null)??t.find(a=>e.includes(a))??e[0]??null;return i===null?null:ae(i)}var xe=h(S(),1),be=M(R(()=>(__graviewPreload(import.meta.url,["./chunk.YHH4TWZ2.js","./chunk.O2WWYZI7.js","./chunk.AGIO2GRV.js","./chunk.VSNHCGKC.js","./chunk.SWWAEOZ7.js","./chunk.IROYMLER.js","./chunk.FWSCBHZ5.js","./chunk.7NNI7YH4.js","./chunk.7N2GXZYI.js","./chunk.63MS2LOP.js","./chunk.PKUDIWIF.js","./chunk.VW2VCPJX.js","./chunk.WVUJXDXZ.js","./chunk.ZIEHF67C.js","./chunk.UHX4WTM7.js","./chunk.IKX4VDTW.js","./chunk.RNEJYIQ7.js","./chunk.TBQOSI4J.js","./chunk.KWQ7QOHD.js","./chunk.GZHZLJBF.js","./chunk.5AGW4NRZ.js","./chunk.OJGHDWI6.js","./chunk.DQS7D2W2.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.O4WEJ47H.js","./chunk.Y4ZUJUUT.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.ISNEX772.js"))));function Cn(){return be.load().then(()=>{})}var Rn=[{cardinality:"one",fidelity:"full",slot:"page"},{cardinality:"one",fidelity:"summary",slot:"card"},{cardinality:"one",fidelity:"glyph",slot:"row"},{cardinality:"many",fidelity:"full"},{cardinality:"many",fidelity:"summary"},{cardinality:"many",fidelity:"glyph"}];function Mn({schema:r,specs:e,kind:t,view:n}){let i=be.current.frameworkViews(r,e).lookup(t,{cardinality:n.cardinality,fidelity:n.fidelity});return i?(0,xe.jsx)(i,{...n}):null}var _n=be.part((r,e)=>(0,xe.jsx)(Mn,{...e}),{what:"This view"});function pt(r,e,t){for(let n of e.kinds){let i=t?.[n];for(let a of Rn){let o=p=>(0,xe.jsx)(_n,{schema:e,specs:t,kind:n,view:p}),l=a.slot!==void 0&&i?.[a.slot]!==void 0;l&&(o.says=(p,s)=>be.current?.frameworkViews(e,t).lookup(n,{cardinality:a.cardinality,fidelity:a.fidelity})?.says?.(p,s)),r.register(n,{cardinality:a.cardinality,fidelity:a.fidelity},l?o:Tr(o))}}return r}function Dn(r,e){return pt(Ar(r),r,e)}var Ie=h(B(),1);var F=h(S(),1),ut=M(R(()=>(__graviewPreload(import.meta.url,["./chunk.L4YNDNX7.js","./chunk.GCKZ2YRJ.js","./chunk.VC3UGFHY.js","./chunk.IJNOT4S4.js","./chunk.YHH4TWZ2.js","./chunk.O2WWYZI7.js","./chunk.AGIO2GRV.js","./chunk.VSNHCGKC.js","./chunk.HJCQ6I3S.js","./chunk.BNPQUI3F.js","./chunk.6RY6OSE6.js","./chunk.RX2M4C5W.js","./chunk.SWWAEOZ7.js","./chunk.IROYMLER.js","./chunk.FWSCBHZ5.js","./chunk.7NNI7YH4.js","./chunk.7N2GXZYI.js","./chunk.MF73YBJL.js","./chunk.63MS2LOP.js","./chunk.PKUDIWIF.js","./chunk.VW2VCPJX.js","./chunk.WBHM5I3I.js","./chunk.FOQ27RAR.js","./chunk.UKAPFIPJ.js","./chunk.UT6642FC.js","./chunk.Q7RQC3F7.js","./chunk.WVUJXDXZ.js","./chunk.ZIEHF67C.js","./chunk.UHX4WTM7.js","./chunk.IKX4VDTW.js","./chunk.RNEJYIQ7.js","./chunk.TBQOSI4J.js","./chunk.KWQ7QOHD.js","./chunk.GZHZLJBF.js","./chunk.5AGW4NRZ.js","./chunk.OJGHDWI6.js","./chunk.DQS7D2W2.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.O4WEJ47H.js","./chunk.Y4ZUJUUT.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.5G53VDOC.js"))));function Fn({lens:r,view:e}){let t=ut.current.declaredLensView(r);return(0,F.jsx)(t,{...e})}var Vn=ut.part((r,e)=>(0,F.jsx)(Fn,{...e}),{what:"This picture"});function In(r){let e=n=>(0,F.jsx)(Ie.Suspense,{fallback:null,children:(0,F.jsx)(Vn,{lens:r,view:n})});r.lens==="blocks"&&(e.flows=!0);let t=r.lens==="blocks"?r.options.blocks?.[0]:void 0;return typeof t?.headline=="string"&&(e.lede=t),r.create===!1&&(e.creates=!1),e}var gt=M(R(()=>(__graviewPreload(import.meta.url,["./chunk.YHH4TWZ2.js","./chunk.O2WWYZI7.js","./chunk.AGIO2GRV.js","./chunk.VSNHCGKC.js","./chunk.SWWAEOZ7.js","./chunk.IROYMLER.js","./chunk.FWSCBHZ5.js","./chunk.7NNI7YH4.js","./chunk.7N2GXZYI.js","./chunk.63MS2LOP.js","./chunk.PKUDIWIF.js","./chunk.VW2VCPJX.js","./chunk.WVUJXDXZ.js","./chunk.ZIEHF67C.js","./chunk.UHX4WTM7.js","./chunk.IKX4VDTW.js","./chunk.RNEJYIQ7.js","./chunk.TBQOSI4J.js","./chunk.KWQ7QOHD.js","./chunk.GZHZLJBF.js","./chunk.5AGW4NRZ.js","./chunk.OJGHDWI6.js","./chunk.DQS7D2W2.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.O4WEJ47H.js","./chunk.Y4ZUJUUT.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.I6JLOEJU.js"))));function Wn({blocks:r,view:e}){let t=gt.current.homeView(r);return(0,F.jsx)(t,{...e})}var Kn=gt.part((r,e)=>(0,F.jsx)(Wn,{...e}),{what:"The home"});function Gn(r){let e=t=>(0,F.jsx)(Ie.Suspense,{fallback:null,children:(0,F.jsx)(Kn,{blocks:r,view:t})});return Object.defineProperty(e,Symbol.for("graview.home-blocks"),{value:!0}),e}function zn(r,e){return e.home&&e.home.length>0&&r.home?.(Gn(e.home)),ft(r,e),r.arrange?.(e.pages),r}function ft(r,e,t){for(let n of vr(e).drawn){if(t&&r.places().some(o=>o.title===n.title))continue;let i=In(n),a={title:n.title,lens:n.lens,...n.across?{across:n.across}:{},...t?{beside:t}:{},...n.hidden?{hidden:!0}:{},over:n.kinds,...t?{}:{declared:!0}};for(let o of n.kinds)r.register(o,{cardinality:"many",fidelity:"full"},i,a),r.register(o,{cardinality:"many",fidelity:"summary"},i,a)}}function qn(r,e,t){t.length>0&&ft(r,{schema:e,lenses:t.map(({lens:n,...i})=>({...i,name:n}))},!0)}function jn(r,e,t){qn(r,e,De(t))}var z=h(B(),1),ke=h(S(),1);var We=r=>`graview:first-look:${r}`;function Yn(r,e){if(r.seen!==void 0)try{return typeof r.seen=="function"?r.seen():r.seen}catch{return!0}try{return window.localStorage.getItem(We(e))!==null}catch{return!1}}function Un(r,e){if(r.seen===void 0)try{window.localStorage.setItem(We(e),"seen")}catch{}}var Qn=M(R(()=>(__graviewPreload(import.meta.url,["./chunk.Y4ZUJUUT.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.52VGZBO3.js")))),Xn=Qn.part((r,e)=>{let t=r.FirstLookHints;return(0,ke.jsx)(t,{...e})},{quiet:!0});function Zn({firstLook:r,root:e,app:t}){let n=(0,z.useRef)(null);n.current=r===!0?{}:r||null;let[i,a]=(0,z.useState)(()=>n.current!==null&&typeof window<"u"&&!Yn(n.current,t)),o=(0,z.useCallback)(l=>{if(a(!1),l===null)return;let p=n.current??{};Un(p,t),p.onDone?.(l)},[t]);return!i||n.current===null?null:(0,ke.jsx)(z.Suspense,{fallback:null,children:(0,ke.jsx)(Xn,{root:e,steps:n.current.steps??[],onEnd:o})})}export{Nt as a,Ht as b,me as c,Mt as d,ta as e,Dr as f,na as g,Be as h,Xt as i,Kr as j,Wt as k,Kt as l,ve as m,Gt as n,qt as o,jt as p,Yt as q,C as r,rn as s,tn as t,Xr as u,nn as v,re as w,on as x,xn as y,$n as z,On as A,hn as B,bn as C,De as D,Hn as E,dt as F,ct as G,Bn as H,zn as I,qn as J,jn as K,Cn as L,Dn as M,Zn as N};
337
347
  /*! Bundled license information:
338
348
 
339
349
  react-dom/cjs/react-dom.production.js:
@@ -1,3 +1,3 @@
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 Ue}from"./chunk.UKAPFIPJ.js";import{a as Be}from"./chunk.WAB7UDHU.js";import{a as We}from"./chunk.R2AG4NHQ.js";import{a as X}from"./chunk.TI4OSTQV.js";import{a as fe}from"./chunk.UHX4WTM7.js";import{e as ce}from"./chunk.6BJBPDF3.js";import{E as we,G as ln,J as He,P as Le,R as Fe,_ as Je}from"./chunk.XWAMQPUM.js";import{Ib as Ne,Nb as le,Pb as je,ca as ae,ea as U,ga as q,ja as Ee,la as de,qb as Me,wc as De}from"./chunk.AS4CQBOQ.js";import{b as Se}from"./chunk.AJZBJBMO.js";var cn=e=>/^(?:aggregate|kind):([^,]+)$/.exec(e)?.[1];function Ge(e,n){let t=e.about??[];if(e.field!==void 0&&e.on!==void 0&&n(e.on))return{on:"field",id:e.on,field:e.field};let i=t.filter(n);if(i.length>1)return{on:"selection",ids:i};if(e.on!==void 0&&n(e.on))return{on:"record",id:e.on};if(i.length===1)return{on:"record",id:i[0]};let o=[e.on,...t].map(s=>s===void 0?void 0:cn(s)).find(s=>s!==void 0);return e.place!==void 0?{on:"lens",place:e.place,...o?{kind:o}:{}}:o!==void 0?{on:"list",kind:o}:{on:"place",place:"home"}}var V=e=>e.on==="record"||e.on==="field"?[e.id]:e.on==="selection"?e.ids:e.on==="act"&&e.id!==void 0?[e.id]:[],ue=(e,n)=>e.tryDefinition(n)?.fields?.shape??{},K=(e,n)=>e.tryDefinition(n)?.edges??{},pe=(e,n)=>new Set(e.tryDefinition(n)?.display?.hide??[]),H=(e,n)=>ae(e.tryDefinition(n.kind),n),xe=(e,n,t)=>Ee(e.tryDefinition(n),t)||U(t),Oe=e=>typeof e=="boolean"?e?"yes":"no":String(e);function ge(e,n){let t=e.kindsKeptFrom(n);return new Set(e.schema.kinds.filter(i=>!t.has(i)))}function Ce(e,n,t,i){if(!e.permits(n,t).ok)return!1;if(!i)return!0;try{return e.previewAll([n],{author:t}).ops.length>0}catch{return!1}}function ye(e,n,t){let i=e,{principal:o}=t,s=t.each??8,c=X(i)?.store??i,d=c.seenBy(o),l=c.schema,p=ge(c,o),a=r=>{let y=d.graph.getNode(r);return y&&p.has(y.kind)?y:void 0},f=c.allMutations(),h=new Map(f.map(r=>[r.name,r])),b=[],P=new Set,S=r=>{P.has(r.id)||(P.add(r.id),b.push(r))},m=r=>r.slice(0,s),C=V(n).filter(r=>a(r)!==void 0);if(V(n).length>0&&C.length===0)return{target:n,candidates:[]};let k=C.length===1?a(C[0]):void 0,g=k?.kind??(n.on==="list"?n.kind:n.on==="lens"?n.kind??t.places?.find(r=>r.as===n.place)?.kind:void 0)??(n.on==="selection"?a(C[0])?.kind:void 0);if(g!==void 0&&!p.has(g))return{target:n,candidates:[]};let A=(r,y)=>`act:${r}${Object.keys(y).length>0?`:${Object.values(y).map(T=>String(T)).join(",")}`:""}`,w=(r,y,T,v,$)=>{r.destructive||Object.values(y).some(u=>typeof u=="string"&&c.graph.has(u)&&a(u)===void 0)||Ce(c,{name:r.name,args:{...y}},o,v.length===0)&&S({type:"act",id:A(r.name,y),label:T,description:$??r.description??T,mutation:r.name,args:y,asks:v})};if(n.on!=="place"||t.acts)if(t.acts)for(let r of t.acts){let y=h.get(r.mutation);!y||r.destructive||n.on==="act"&&r.mutation!==n.act||w(y,r.args,r.label,(r.open??[]).filter(T=>!T.optional).map(T=>T.name),r.why)}else{let r=k?[k]:[];for(let y of f){if(n.on==="act"&&y.name!==n.act)continue;let T=y.input.shape??{},v=$=>Object.entries(T).filter(([u,O])=>u!==$&&O.safeParse?.(void 0).success===!1).map(([u])=>u);if(y.subject)for(let $ of r)le(l,y).includes($.kind)&&w(y,{[y.subject.arg]:$.id},`${y.title??U(y.name)}: ${H(l,$)}`,v(y.subject.arg));else g!==void 0&&(y.creates??[]).includes(g)&&w(y,{},y.title??U(y.name),v(void 0))}}let M=b.filter(r=>r.type==="act");b.splice(0,b.length,...m(M));let L=(r,y)=>{let T=je(l,f).get(r.kind),v=ue(l,r.kind),$=pe(l,r.kind),u=[];for(let[O,j]of Object.entries(v)){if(y!==void 0?O!==y:$.has(O)||r[O]!==void 0)continue;let D=fe(j),z=D?.type==="enum"?D.options??[]:D?.type==="boolean"?[!0,!1]:[];if(z.length===0)continue;let W=(T?.get(O)??[]).map(N=>h.get(N)).find(N=>N?.subject!==void 0&&Ce(c,{name:N.name,args:{[N.subject.arg]:r.id,[O]:z.find(Ae=>Ae!==r[O])??z[0]}},o,!0));if(W?.subject)for(let N of z)r[O]!==N&&u.push({type:"fill",id:`fill:${r.id}:${O}:${Oe(N)}`,label:`${xe(l,r.kind,O)}: ${Oe(N)}`,description:`Set ${xe(l,r.kind,O).toLowerCase()} of ${H(l,r)} to ${Oe(N)}`,record:r.id,field:O,value:N,call:{name:W.name,args:{[W.subject.arg]:r.id,[O]:N}}})}for(let[O,j]of Object.entries(K(l,r.kind))){if(y!==void 0&&O!==y)continue;let D=j.to==="*"?[...p]:j.to.filter(R=>p.has(R)),z=new Set(d.graph.out(r.id,O).map(R=>R.id)),W=f.find(R=>(R.connects??[]).includes(O)&&R.subject!==void 0&&le(l,R).includes(r.kind));if(!W?.subject)continue;let N=Ne(W.input).find(R=>R.name!==W.subject.arg);if(!N)continue;let Ae=D.flatMap(R=>N.kinds.length===0||N.kinds.includes(R)?d.graph.nodesOfKind(R):[]).filter(R=>R.id!==r.id&&!z.has(R.id)&&a(R.id)!==void 0);for(let R of m(Ae)){let Re={name:W.name,args:{[W.subject.arg]:r.id,[N.name]:R.id}};Ce(c,Re,o,!0)&&u.push({type:"fill",id:`fill:${r.id}:${O}:${R.id}`,label:`${U(O)}: ${H(l,R)}`,description:`Link ${H(l,r)} to ${H(l,R)}${j.description?` as ${j.description}`:""}`,record:r.id,field:O,value:R.id,call:Re})}}return u};if(n.on==="field"&&k)for(let r of L(k,n.field))S(r);else if(k&&n.on==="record")for(let r of m(L(k)))S(r);let J=r=>{let y=q(l,r).toLowerCase(),T=[{type:"panel",id:`panel:${r}:list`,label:`A list of ${y}`,description:`Every ${de(l.tryDefinition(r),r).toLowerCase()} this viewer may see, as a list`,panel:{lens:"blocks",kind:r}}],v=pe(l,r);for(let[$,u]of Object.entries(ue(l,r))){if(v.has($))continue;let O=fe(u),j=xe(l,r,$).toLowerCase();if(O?.type==="enum")T.push({type:"panel",id:`panel:${r}:group:${$}`,label:`${_(y)} by ${j}`,description:`A list of ${y} grouped by ${j}`,panel:{lens:"blocks",kind:r,group:$}}),T.push({type:"panel",id:`panel:${r}:columns:${$}`,label:`Columns of ${y} by ${j}`,description:`${_(y)} in a column for each ${j}`,panel:{lens:"columns",kind:r,column:$}});else if(O?.type==="number"||O?.type==="integer"||O?.type==="date"||O?.type==="datetime"){let D=O.type==="date"||O.type==="datetime";T.push({type:"panel",id:`panel:${r}:sort:${$}`,label:`${_(y)} by ${j}`,description:`A list of ${y}, the ${D?"latest":"highest"} ${j} first`,panel:{lens:"blocks",kind:r,sort:{by:$,direction:"desc"}}}),D&&T.push({type:"panel",id:`panel:${r}:calendar:${$}`,label:`A calendar of ${y}`,description:`${_(y)} on a calendar by ${j}`,panel:{lens:"calendar",kind:r,start:$}})}}return T},F=n.on==="place"?[...p]:g!==void 0?[g]:[];for(let r of F)for(let y of m(J(r)))S(y);for(let r of m((t.places??[]).filter(y=>y.kind===void 0?n.on==="place":p.has(y.kind)&&(n.on==="place"||y.kind===g))))n.on==="lens"&&r.as===n.place||S({type:"place",id:`place:${r.as}`,label:r.title,description:`Go to ${r.title}`,place:r.as});if(k){let r=[];for(let[y,T]of Object.entries(K(l,k.kind)))for(let v of d.graph.out(k.id,y))a(v.id)&&r.push({type:"record",id:`record:${v.id}`,label:H(l,v),description:`${_(T.description??U(y))}: ${H(l,v)}`,record:v.id,relation:y});for(let y of l.kinds)for(let[T,v]of Object.entries(K(l,y)))if(!(v.to!=="*"&&!v.to.includes(k.kind)))for(let $ of d.graph.in(k.id,T))$.kind===y&&a($.id)&&r.push({type:"record",id:`record:${$.id}`,label:H(l,$),description:`${_(v.inverse??U(T))}: ${H(l,$)}`,record:$.id,relation:T});for(let y of m(r))S(y)}else if(n.on==="list"||n.on==="lens")for(let r of m(g!==void 0?d.graph.nodesOfKind(g):[]))a(r.id)&&S({type:"record",id:`record:${r.id}`,label:H(l,r),description:`Open ${H(l,r)}`,record:r.id});else if(n.on==="selection")for(let r of C){let y=a(r);S({type:"record",id:`record:${r}`,label:H(l,y),description:`Open ${H(l,y)}`,record:r})}return{target:n,candidates:b}}var _=e=>e&&`${e[0].toUpperCase()}${e.slice(1)}`,fn={columns:["board","kanban","column","lane","pipeline","stage","funnel"],board:["board","map","floor","layout","seat","slot"],calendar:["calendar","schedule","date","due","month","week","agenda","deadline","day"],timeline:["timeline","gantt","schedule","roadmap","span"],coverage:["coverage","matrix","grid","gap"],plan:["plan","floor","map","region","area"],blocks:["list","table","summary","overview","dashboard","card"]},un=new Set(["a","an","the","of","for","my","our","me","us","to","with","and","in","on","by","that","which","i","we","want","need","show","open","go","draw","make","new","view","views","panel","panels","page","lens","please","all","every","some","see","can","could","would","like","one","what","is","are","do","does","here","there","how","it","this","these","those"]),Z=e=>e.length>3&&e.endsWith("ies")?`${e.slice(0,-3)}y`:e.length>3&&e.endsWith("s")&&!e.endsWith("ss")?e.slice(0,-1):e,$e=e=>e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").split(/[^a-z0-9]+/).filter(Boolean);function ze(e,n,t){let i=e,o=X(i)?.store??i,s=o.schema,c=ge(o,t.principal),d=o.seenBy(t.principal),l=V(n),p=new Set;for(let A of l){let w=d.graph.getNode(A)?.kind;w!==void 0&&c.has(w)&&p.add(w)}if(l.length>0&&p.size===0)return[];if(n.on==="list"&&p.add(n.kind),n.on==="lens"){let A=n.kind??t.places.find(w=>w.as===n.place)?.kind;A!==void 0&&p.add(A)}let a=new Map;for(let A of s.kinds){if(!c.has(A))continue;let w=s.tryDefinition(A);for(let M of[A,de(w,A),q(s,A)])for(let L of $e(M))a.set(Z(L),A)}let f=$e(t.said??"").filter(A=>!un.has(A)),h=new Set,b=[];for(let A of f){let w=a.get(Z(A));w!==void 0?h.add(w):b.push(Z(A))}let P=h.size>0?h:p;if((t.said??"").trim()!==""&&f.length===0)return[];if(P.size===0&&f.length===0)return[];let S=[];t.places.forEach((A,w)=>{if(A.hidden||n.on==="lens"&&A.as===n.place)return;let M=A.over??(A.kind!==void 0?[A.kind]:[]);if(M.length>0&&!M.some(F=>c.has(F)))return;let L=M.some(F=>P.has(F)),J=!L&&(A.reads??[]).some(F=>P.has(F));P.size>0&&!L&&!J||S.push({place:A,own:L,reads:J,at:w})});let m=A=>new Set($e(A.title).map(Z)),C=new Set(b.filter(A=>S.some(({place:w})=>m(w).has(A)))),k=[];for(let{place:A,own:w,reads:M,at:L}of S){let J=m(A),F=new Set((fn[A.lens??""]??[]).map(Z)),r=b.filter($=>J.has($)||F.has($)&&!C.has($)).length,y=b.length-r;if(b.length>0&&r===0)continue;let T=!M&&y===0?"full":"partial",v=(w?4:M?2:1)+r*2-y+(T==="full"?1:0);k.push({view:{place:A.as,title:A.title,...A.kind!==void 0?{kind:A.kind}:{},fit:T},score:v,at:L})}return k.filter((A,w)=>!k.slice(0,w).some(M=>M.view.place===A.view.place&&M.view.title===A.view.title)).sort((A,w)=>w.score-A.score||A.at-w.at).slice(0,t.most??3).map(A=>A.view)}var Pe=new WeakMap;function pn(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619)>>>0;return n.toString(36)}function gn(e,n){let t=e,i=X(t)?.store??t,o=i.schema,s=ge(i,n),d=i.allMutations().filter(S=>!S.destructive&&i.permits({name:S.name,args:{}},n).ok!==!1),l=`${[...s].join(",")}|${d.map(S=>S.name).join(",")}`,p=Pe.get(o)?.get(l);if(p)return p;let a=[...s].map(S=>{let m=pe(o,S),C={};for(let[g,A]of Object.entries(ue(o,S))){if(m.has(g))continue;let w=fe(A);w&&(C[g]=w.type==="enum"?`enum:${(w.options??[]).join("|")}`:w.type)}let k={};for(let[g,A]of Object.entries(K(o,S)))k[g]=A.to==="*"?[...s]:A.to.filter(w=>s.has(w));return{kind:S,noun:de(o.tryDefinition(S),S),plural:q(o,S),fields:C,relations:k}}),f=d.map(S=>({name:S.name,title:S.title??U(S.name),...S.subject?{on:le(o,S).filter(m=>s.has(m))}:{}})),h={kinds:a,acts:f},b={version:pn(JSON.stringify(h)),...h},P=Pe.get(o)??new Map;return P.set(l,b),Pe.set(o,P),b}var yn=e=>e.name??e.id??e.kind;function qe(e,n,t){let i=e,{principal:o}=t,s=X(i)?.store??i,c=s.seenBy(o),d=s.schema,l=ge(s,o),p=k=>{let g=c.graph.getNode(k);return g&&l.has(g.kind)?g:void 0},a=k=>({id:k.id,kind:k.kind,label:H(d,k)}),f=V(n),h=f.length===1?p(f[0]):void 0,b=h?Object.fromEntries(Object.keys(ue(d,h.kind)).filter(k=>!pe(d,h.kind).has(k)&&h[k]!==void 0&&k!=="label").map(k=>[k,h[k]])):{},P={on:n.on,...h?{record:{...a(h),fields:b}}:{},...n.on==="field"&&h?{field:n.field}:{},...n.on==="list"&&l.has(n.kind)?{kind:n.kind}:{},...n.on==="lens"?{place:n.place,...n.kind&&l.has(n.kind)?{kind:n.kind}:{}}:{},...n.on==="place"?{place:n.place}:{},...n.on==="act"?{act:n.act}:{}},S=[...new Set([...n.on==="selection"?n.ids:[],...t.selection??[]])].flatMap(k=>{let g=p(k);return g?[a(g)]:[]}),m=[];if(h){for(let k of Object.keys(K(d,h.kind)))for(let g of c.graph.out(h.id,k))p(g.id)&&m.push({...a(g),relation:k,direction:"out"});for(let k of d.kinds)for(let g of Object.keys(K(d,k)))for(let A of c.graph.in(h.id,g))A.kind===k&&p(A.id)&&m.push({...a(A),relation:g,direction:"in"})}let C=c.batches().filter(k=>!k.ops.every(Me)).slice(-(t.recent??6)).reverse().map(k=>({intent:k.intent,at:k.at,by:yn(k.author)}));return{...t.place!==void 0?{place:t.place}:{},target:P,selection:S,neighbors:m.slice(0,24),recent:C,schema:gn(s,o)}}function ee(e){if(!e.off)return e.fast??(e.decide?{model:e.name??"decide",decide:e.decide}:void 0)}function B(e){if(e.off)return;if(e.thinking)return e.thinking;let n=e.name??"model";if(e.complete){let t=e.complete;return{model:n,think:async({system:i,prompt:o})=>({text:await t(`${i}
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 Ue}from"./chunk.UKAPFIPJ.js";import{a as Be}from"./chunk.WAB7UDHU.js";import{a as We}from"./chunk.2W22AWSL.js";import{a as X}from"./chunk.TI4OSTQV.js";import{a as fe}from"./chunk.UHX4WTM7.js";import{e as ce}from"./chunk.O4WEJ47H.js";import{E as we,G as ln,J as He,P as Le,R as Fe,_ as Je}from"./chunk.Y4ZUJUUT.js";import{Ib as Ne,Nb as le,Pb as je,ca as ae,ea as U,ga as q,ja as Ee,la as de,qb as Me,wc as De}from"./chunk.AS4CQBOQ.js";import{b as Se}from"./chunk.AJZBJBMO.js";var cn=e=>/^(?:aggregate|kind):([^,]+)$/.exec(e)?.[1];function Ge(e,n){let t=e.about??[];if(e.field!==void 0&&e.on!==void 0&&n(e.on))return{on:"field",id:e.on,field:e.field};let i=t.filter(n);if(i.length>1)return{on:"selection",ids:i};if(e.on!==void 0&&n(e.on))return{on:"record",id:e.on};if(i.length===1)return{on:"record",id:i[0]};let o=[e.on,...t].map(s=>s===void 0?void 0:cn(s)).find(s=>s!==void 0);return e.place!==void 0?{on:"lens",place:e.place,...o?{kind:o}:{}}:o!==void 0?{on:"list",kind:o}:{on:"place",place:"home"}}var V=e=>e.on==="record"||e.on==="field"?[e.id]:e.on==="selection"?e.ids:e.on==="act"&&e.id!==void 0?[e.id]:[],ue=(e,n)=>e.tryDefinition(n)?.fields?.shape??{},K=(e,n)=>e.tryDefinition(n)?.edges??{},pe=(e,n)=>new Set(e.tryDefinition(n)?.display?.hide??[]),H=(e,n)=>ae(e.tryDefinition(n.kind),n),xe=(e,n,t)=>Ee(e.tryDefinition(n),t)||U(t),Oe=e=>typeof e=="boolean"?e?"yes":"no":String(e);function ge(e,n){let t=e.kindsKeptFrom(n);return new Set(e.schema.kinds.filter(i=>!t.has(i)))}function Ce(e,n,t,i){if(!e.permits(n,t).ok)return!1;if(!i)return!0;try{return e.previewAll([n],{author:t}).ops.length>0}catch{return!1}}function ye(e,n,t){let i=e,{principal:o}=t,s=t.each??8,c=X(i)?.store??i,d=c.seenBy(o),l=c.schema,p=ge(c,o),a=r=>{let y=d.graph.getNode(r);return y&&p.has(y.kind)?y:void 0},f=c.allMutations(),h=new Map(f.map(r=>[r.name,r])),b=[],P=new Set,S=r=>{P.has(r.id)||(P.add(r.id),b.push(r))},m=r=>r.slice(0,s),C=V(n).filter(r=>a(r)!==void 0);if(V(n).length>0&&C.length===0)return{target:n,candidates:[]};let k=C.length===1?a(C[0]):void 0,g=k?.kind??(n.on==="list"?n.kind:n.on==="lens"?n.kind??t.places?.find(r=>r.as===n.place)?.kind:void 0)??(n.on==="selection"?a(C[0])?.kind:void 0);if(g!==void 0&&!p.has(g))return{target:n,candidates:[]};let A=(r,y)=>`act:${r}${Object.keys(y).length>0?`:${Object.values(y).map(T=>String(T)).join(",")}`:""}`,w=(r,y,T,v,$)=>{r.destructive||Object.values(y).some(u=>typeof u=="string"&&c.graph.has(u)&&a(u)===void 0)||Ce(c,{name:r.name,args:{...y}},o,v.length===0)&&S({type:"act",id:A(r.name,y),label:T,description:$??r.description??T,mutation:r.name,args:y,asks:v})};if(n.on!=="place"||t.acts)if(t.acts)for(let r of t.acts){let y=h.get(r.mutation);!y||r.destructive||n.on==="act"&&r.mutation!==n.act||w(y,r.args,r.label,(r.open??[]).filter(T=>!T.optional).map(T=>T.name),r.why)}else{let r=k?[k]:[];for(let y of f){if(n.on==="act"&&y.name!==n.act)continue;let T=y.input.shape??{},v=$=>Object.entries(T).filter(([u,O])=>u!==$&&O.safeParse?.(void 0).success===!1).map(([u])=>u);if(y.subject)for(let $ of r)le(l,y).includes($.kind)&&w(y,{[y.subject.arg]:$.id},`${y.title??U(y.name)}: ${H(l,$)}`,v(y.subject.arg));else g!==void 0&&(y.creates??[]).includes(g)&&w(y,{},y.title??U(y.name),v(void 0))}}let M=b.filter(r=>r.type==="act");b.splice(0,b.length,...m(M));let L=(r,y)=>{let T=je(l,f).get(r.kind),v=ue(l,r.kind),$=pe(l,r.kind),u=[];for(let[O,j]of Object.entries(v)){if(y!==void 0?O!==y:$.has(O)||r[O]!==void 0)continue;let D=fe(j),z=D?.type==="enum"?D.options??[]:D?.type==="boolean"?[!0,!1]:[];if(z.length===0)continue;let W=(T?.get(O)??[]).map(N=>h.get(N)).find(N=>N?.subject!==void 0&&Ce(c,{name:N.name,args:{[N.subject.arg]:r.id,[O]:z.find(Ae=>Ae!==r[O])??z[0]}},o,!0));if(W?.subject)for(let N of z)r[O]!==N&&u.push({type:"fill",id:`fill:${r.id}:${O}:${Oe(N)}`,label:`${xe(l,r.kind,O)}: ${Oe(N)}`,description:`Set ${xe(l,r.kind,O).toLowerCase()} of ${H(l,r)} to ${Oe(N)}`,record:r.id,field:O,value:N,call:{name:W.name,args:{[W.subject.arg]:r.id,[O]:N}}})}for(let[O,j]of Object.entries(K(l,r.kind))){if(y!==void 0&&O!==y)continue;let D=j.to==="*"?[...p]:j.to.filter(R=>p.has(R)),z=new Set(d.graph.out(r.id,O).map(R=>R.id)),W=f.find(R=>(R.connects??[]).includes(O)&&R.subject!==void 0&&le(l,R).includes(r.kind));if(!W?.subject)continue;let N=Ne(W.input).find(R=>R.name!==W.subject.arg);if(!N)continue;let Ae=D.flatMap(R=>N.kinds.length===0||N.kinds.includes(R)?d.graph.nodesOfKind(R):[]).filter(R=>R.id!==r.id&&!z.has(R.id)&&a(R.id)!==void 0);for(let R of m(Ae)){let Re={name:W.name,args:{[W.subject.arg]:r.id,[N.name]:R.id}};Ce(c,Re,o,!0)&&u.push({type:"fill",id:`fill:${r.id}:${O}:${R.id}`,label:`${U(O)}: ${H(l,R)}`,description:`Link ${H(l,r)} to ${H(l,R)}${j.description?` as ${j.description}`:""}`,record:r.id,field:O,value:R.id,call:Re})}}return u};if(n.on==="field"&&k)for(let r of L(k,n.field))S(r);else if(k&&n.on==="record")for(let r of m(L(k)))S(r);let J=r=>{let y=q(l,r).toLowerCase(),T=[{type:"panel",id:`panel:${r}:list`,label:`A list of ${y}`,description:`Every ${de(l.tryDefinition(r),r).toLowerCase()} this viewer may see, as a list`,panel:{lens:"blocks",kind:r}}],v=pe(l,r);for(let[$,u]of Object.entries(ue(l,r))){if(v.has($))continue;let O=fe(u),j=xe(l,r,$).toLowerCase();if(O?.type==="enum")T.push({type:"panel",id:`panel:${r}:group:${$}`,label:`${_(y)} by ${j}`,description:`A list of ${y} grouped by ${j}`,panel:{lens:"blocks",kind:r,group:$}}),T.push({type:"panel",id:`panel:${r}:columns:${$}`,label:`Columns of ${y} by ${j}`,description:`${_(y)} in a column for each ${j}`,panel:{lens:"columns",kind:r,column:$}});else if(O?.type==="number"||O?.type==="integer"||O?.type==="date"||O?.type==="datetime"){let D=O.type==="date"||O.type==="datetime";T.push({type:"panel",id:`panel:${r}:sort:${$}`,label:`${_(y)} by ${j}`,description:`A list of ${y}, the ${D?"latest":"highest"} ${j} first`,panel:{lens:"blocks",kind:r,sort:{by:$,direction:"desc"}}}),D&&T.push({type:"panel",id:`panel:${r}:calendar:${$}`,label:`A calendar of ${y}`,description:`${_(y)} on a calendar by ${j}`,panel:{lens:"calendar",kind:r,start:$}})}}return T},F=n.on==="place"?[...p]:g!==void 0?[g]:[];for(let r of F)for(let y of m(J(r)))S(y);for(let r of m((t.places??[]).filter(y=>y.kind===void 0?n.on==="place":p.has(y.kind)&&(n.on==="place"||y.kind===g))))n.on==="lens"&&r.as===n.place||S({type:"place",id:`place:${r.as}`,label:r.title,description:`Go to ${r.title}`,place:r.as});if(k){let r=[];for(let[y,T]of Object.entries(K(l,k.kind)))for(let v of d.graph.out(k.id,y))a(v.id)&&r.push({type:"record",id:`record:${v.id}`,label:H(l,v),description:`${_(T.description??U(y))}: ${H(l,v)}`,record:v.id,relation:y});for(let y of l.kinds)for(let[T,v]of Object.entries(K(l,y)))if(!(v.to!=="*"&&!v.to.includes(k.kind)))for(let $ of d.graph.in(k.id,T))$.kind===y&&a($.id)&&r.push({type:"record",id:`record:${$.id}`,label:H(l,$),description:`${_(v.inverse??U(T))}: ${H(l,$)}`,record:$.id,relation:T});for(let y of m(r))S(y)}else if(n.on==="list"||n.on==="lens")for(let r of m(g!==void 0?d.graph.nodesOfKind(g):[]))a(r.id)&&S({type:"record",id:`record:${r.id}`,label:H(l,r),description:`Open ${H(l,r)}`,record:r.id});else if(n.on==="selection")for(let r of C){let y=a(r);S({type:"record",id:`record:${r}`,label:H(l,y),description:`Open ${H(l,y)}`,record:r})}return{target:n,candidates:b}}var _=e=>e&&`${e[0].toUpperCase()}${e.slice(1)}`,fn={columns:["board","kanban","column","lane","pipeline","stage","funnel"],board:["board","map","floor","layout","seat","slot"],calendar:["calendar","schedule","date","due","month","week","agenda","deadline","day"],timeline:["timeline","gantt","schedule","roadmap","span"],coverage:["coverage","matrix","grid","gap"],plan:["plan","floor","map","region","area"],blocks:["list","table","summary","overview","dashboard","card"]},un=new Set(["a","an","the","of","for","my","our","me","us","to","with","and","in","on","by","that","which","i","we","want","need","show","open","go","draw","make","new","view","views","panel","panels","page","lens","please","all","every","some","see","can","could","would","like","one","what","is","are","do","does","here","there","how","it","this","these","those"]),Z=e=>e.length>3&&e.endsWith("ies")?`${e.slice(0,-3)}y`:e.length>3&&e.endsWith("s")&&!e.endsWith("ss")?e.slice(0,-1):e,$e=e=>e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").split(/[^a-z0-9]+/).filter(Boolean);function ze(e,n,t){let i=e,o=X(i)?.store??i,s=o.schema,c=ge(o,t.principal),d=o.seenBy(t.principal),l=V(n),p=new Set;for(let A of l){let w=d.graph.getNode(A)?.kind;w!==void 0&&c.has(w)&&p.add(w)}if(l.length>0&&p.size===0)return[];if(n.on==="list"&&p.add(n.kind),n.on==="lens"){let A=n.kind??t.places.find(w=>w.as===n.place)?.kind;A!==void 0&&p.add(A)}let a=new Map;for(let A of s.kinds){if(!c.has(A))continue;let w=s.tryDefinition(A);for(let M of[A,de(w,A),q(s,A)])for(let L of $e(M))a.set(Z(L),A)}let f=$e(t.said??"").filter(A=>!un.has(A)),h=new Set,b=[];for(let A of f){let w=a.get(Z(A));w!==void 0?h.add(w):b.push(Z(A))}let P=h.size>0?h:p;if((t.said??"").trim()!==""&&f.length===0)return[];if(P.size===0&&f.length===0)return[];let S=[];t.places.forEach((A,w)=>{if(A.hidden||n.on==="lens"&&A.as===n.place)return;let M=A.over??(A.kind!==void 0?[A.kind]:[]);if(M.length>0&&!M.some(F=>c.has(F)))return;let L=M.some(F=>P.has(F)),J=!L&&(A.reads??[]).some(F=>P.has(F));P.size>0&&!L&&!J||S.push({place:A,own:L,reads:J,at:w})});let m=A=>new Set($e(A.title).map(Z)),C=new Set(b.filter(A=>S.some(({place:w})=>m(w).has(A)))),k=[];for(let{place:A,own:w,reads:M,at:L}of S){let J=m(A),F=new Set((fn[A.lens??""]??[]).map(Z)),r=b.filter($=>J.has($)||F.has($)&&!C.has($)).length,y=b.length-r;if(b.length>0&&r===0)continue;let T=!M&&y===0?"full":"partial",v=(w?4:M?2:1)+r*2-y+(T==="full"?1:0);k.push({view:{place:A.as,title:A.title,...A.kind!==void 0?{kind:A.kind}:{},fit:T},score:v,at:L})}return k.filter((A,w)=>!k.slice(0,w).some(M=>M.view.place===A.view.place&&M.view.title===A.view.title)).sort((A,w)=>w.score-A.score||A.at-w.at).slice(0,t.most??3).map(A=>A.view)}var Pe=new WeakMap;function pn(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619)>>>0;return n.toString(36)}function gn(e,n){let t=e,i=X(t)?.store??t,o=i.schema,s=ge(i,n),d=i.allMutations().filter(S=>!S.destructive&&i.permits({name:S.name,args:{}},n).ok!==!1),l=`${[...s].join(",")}|${d.map(S=>S.name).join(",")}`,p=Pe.get(o)?.get(l);if(p)return p;let a=[...s].map(S=>{let m=pe(o,S),C={};for(let[g,A]of Object.entries(ue(o,S))){if(m.has(g))continue;let w=fe(A);w&&(C[g]=w.type==="enum"?`enum:${(w.options??[]).join("|")}`:w.type)}let k={};for(let[g,A]of Object.entries(K(o,S)))k[g]=A.to==="*"?[...s]:A.to.filter(w=>s.has(w));return{kind:S,noun:de(o.tryDefinition(S),S),plural:q(o,S),fields:C,relations:k}}),f=d.map(S=>({name:S.name,title:S.title??U(S.name),...S.subject?{on:le(o,S).filter(m=>s.has(m))}:{}})),h={kinds:a,acts:f},b={version:pn(JSON.stringify(h)),...h},P=Pe.get(o)??new Map;return P.set(l,b),Pe.set(o,P),b}var yn=e=>e.name??e.id??e.kind;function qe(e,n,t){let i=e,{principal:o}=t,s=X(i)?.store??i,c=s.seenBy(o),d=s.schema,l=ge(s,o),p=k=>{let g=c.graph.getNode(k);return g&&l.has(g.kind)?g:void 0},a=k=>({id:k.id,kind:k.kind,label:H(d,k)}),f=V(n),h=f.length===1?p(f[0]):void 0,b=h?Object.fromEntries(Object.keys(ue(d,h.kind)).filter(k=>!pe(d,h.kind).has(k)&&h[k]!==void 0&&k!=="label").map(k=>[k,h[k]])):{},P={on:n.on,...h?{record:{...a(h),fields:b}}:{},...n.on==="field"&&h?{field:n.field}:{},...n.on==="list"&&l.has(n.kind)?{kind:n.kind}:{},...n.on==="lens"?{place:n.place,...n.kind&&l.has(n.kind)?{kind:n.kind}:{}}:{},...n.on==="place"?{place:n.place}:{},...n.on==="act"?{act:n.act}:{}},S=[...new Set([...n.on==="selection"?n.ids:[],...t.selection??[]])].flatMap(k=>{let g=p(k);return g?[a(g)]:[]}),m=[];if(h){for(let k of Object.keys(K(d,h.kind)))for(let g of c.graph.out(h.id,k))p(g.id)&&m.push({...a(g),relation:k,direction:"out"});for(let k of d.kinds)for(let g of Object.keys(K(d,k)))for(let A of c.graph.in(h.id,g))A.kind===k&&p(A.id)&&m.push({...a(A),relation:g,direction:"in"})}let C=c.batches().filter(k=>!k.ops.every(Me)).slice(-(t.recent??6)).reverse().map(k=>({intent:k.intent,at:k.at,by:yn(k.author)}));return{...t.place!==void 0?{place:t.place}:{},target:P,selection:S,neighbors:m.slice(0,24),recent:C,schema:gn(s,o)}}function ee(e){if(!e.off)return e.fast??(e.decide?{model:e.name??"decide",decide:e.decide}:void 0)}function B(e){if(e.off)return;if(e.thinking)return e.thinking;let n=e.name??"model";if(e.complete){let t=e.complete;return{model:n,think:async({system:i,prompt:o})=>({text:await t(`${i}
2
2
 
3
- ${o}`)})}}if(e.turn){let t=e.turn;return{model:n,think:async({system:i,prompt:o})=>({text:await t({system:i,messages:[{role:"user",content:o}],tools:[],call:async()=>({error:"No tools here."})})})}}}var Te=(e,n,t)=>e?n/1e6*(e.inputPerMillion??0)+t/1e6*(e.outputPerMillion??0):void 0,ve=()=>`ai-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;function hn(e,n,t=[]){let i=o=>{let s=e.graph.getNode(o);return s?ae(e.schema.tryDefinition(s.kind),s):"a record"};switch(n.on){case"record":return i(n.id);case"field":return`${i(n.id)} \xB7 ${n.field}`;case"selection":return`${n.ids.length} records`;case"list":return e.schema.tryDefinition(n.kind)?q(e.schema,n.kind):n.kind;case"lens":case"place":return t.find(o=>o.as===n.place)?.title??(n.place==="home"?"Home":n.place);case"act":return n.act}}var _e=e=>e.type!=="act"||e.asks.length===0,me=(e,n)=>({id:e.id,type:e.type,label:e.label,...n!==void 0?{confidence:n}:{}});function Q(e,n){let t=n.interaction??ve(),i=ye(n.store,n.target,{principal:n.principal,...n.acts?{acts:n.acts}:{},...n.places?{places:n.places}:{}}),o=qe(n.store,n.target,{principal:n.principal,...n.place?{place:n.place}:{},...n.selection?{selection:n.selection}:{}}),s=[];return{id:t,catalog:i,state:o,entry:{id:t,at:new Date().toISOString(),by:n.by??n.principal,target:n.target,targetLabel:hn(n.store,n.target,n.places)},usage:s,meter:c=>{s.push(c),e.meter?.({...c,interaction:t})}}}async function ne(e,n,t,i){let o=await e.decide(n,t),{inputTokens:s,outputTokens:c}=o.usage,d=Te(e.price,s,c);return i({tier:"fast",model:e.model,inputTokens:s,outputTokens:c,...d!==void 0?{costUsd:d}:{}}),o.answers}async function te(e,n,t,i,o){let s=await e.think({system:n,prompt:t,state:i.state,catalog:i.catalog}),c=s.usage?.inputTokens,d=s.usage?.outputTokens,l=s.usage?.costUsd??(c!==void 0?Te(e.price,c,d??0):void 0);return o({tier:"thinking",model:e.model,...c!==void 0?{inputTokens:c}:{},...d!==void 0?{outputTokens:d}:{},...l!==void 0?{costUsd:l}:{}}),Be(s.text)}function ie(e,n){let t=new Map(e.map((i,o)=>[`c${o+1}`,i]));return{question:{type:"choice",instructions:n,criteria:Object.fromEntries([...t].map(([i,o])=>[i,`${o.label} \u2014 ${o.description}`]))},of:i=>t.get(i)}}function oe(e,n,t){if(e?.type!=="choice")return[];let i=e,o=Object.entries(i.probabilities).sort((s,c)=>c[1]-s[1]);return o.some(([s])=>s===i.choice)||o.unshift([i.choice,i.confidence]),o.flatMap(([s,c])=>{let d=n(s);return d?[{candidate:d,confidence:c}]:[]}).slice(0,t)}var E=(e,n,t,i)=>({interaction:{...e.entry,ask:{kind:t,said:n??""},offered:[],outcome:"failed",failed:i,usage:[...e.usage]},offers:[]}),Y="AI isn't on here.";async function Ke(e,n,t=3){let i=Q(e,n),o=n.said??"Suggest",s=i.catalog.candidates.filter(_e).slice(0,24);if(s.length===0)return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:[],outcome:"offered",usage:[]},offers:[]};let c=ee(e),d=B(e),l=[];try{if(c){let{question:p,of:a}=ie(s,"Which of these would the person most likely want to do next, here?"),f=await ne(c,{...i.state,candidates:s.map(h=>({id:h.id,type:h.type,says:h.description}))},{next:p},i.meter);l=oe(f.next,a,t)}else if(d){let p=await te(d,'You suggest what a person most likely wants to do next in an app. Answer only JSON: {"pick": [candidate ids, best first]}. Pick only ids from the candidates.',JSON.stringify({state:i.state,candidates:s.map(f=>({id:f.id,says:f.description}))}),i,i.meter);l=(Array.isArray(p?.pick)?p.pick.filter(f=>typeof f=="string"):[]).flatMap(f=>s.filter(h=>h.id===f)).slice(0,t).map(f=>({candidate:f}))}else return E(i,o,"suggest",Y)}catch(p){return E(i,o,"suggest",p instanceof Error?p.message:String(p))}return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:l.map(({candidate:p,confidence:a})=>me(p,a)),outcome:"offered",usage:[...i.usage]},offers:l.map(({candidate:p})=>p)}}var mn=e=>`several:${e}`;async function Fn(e,n,t=2){let i=Q(e,{...n,acts:[]}),o=n.said??"Suggest for the chosen",s=n.target.on==="selection"?n.target.ids.length:1,d=[...n.shared.map(a=>({type:"act",id:mn(a.id),label:a.label,description:`${a.label}, for all ${s} chosen`,mutation:a.mutation,args:a.args,asks:[]})),...i.catalog.candidates.filter(a=>a.type==="panel"||a.type==="place")].slice(0,24),l=ee(e);if(!l)return E(i,o,"suggest",Y);if(d.length===0)return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:[],outcome:"offered",usage:[]},offers:[]};let p;try{let{question:a,of:f}=ie(d,`Which of these would the person most likely want to do next with the ${s} records they chose together?`),h=await ne(l,{...i.state,candidates:d.map(b=>({id:b.id,type:b.type,says:b.description}))},{next:a},i.meter);p=oe(h.next,f,t).filter((b,P)=>P===0||b.confidence>=kn)}catch(a){return E(i,o,"suggest",a instanceof Error?a.message:String(a))}return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:p.map(({candidate:a,confidence:f})=>me(a,f)),outcome:"offered",usage:[...i.usage]},offers:p.map(({candidate:a})=>a)}}var kn=.25;async function Ve(e,n){let t=Q(e,n),i=n.said??"Fill in",o=t.catalog.candidates.filter(f=>f.type==="fill"),s=new Map;for(let f of o)s.set(f.field,[...s.get(f.field)??[],f]);if(s.size===0)return{interaction:{...t.entry,ask:{kind:"fill",said:i},offered:[],outcome:"offered",usage:[]},offers:[]};let c=ee(e),d=B(e),l=[];try{if(c){let f=[...s].map(([b,P],S)=>({key:`f${S+1}`,field:b,...ie(P,`Which value fits "${b}" best for this record?`)})),h=await ne(c,t.state,Object.fromEntries(f.map(b=>[b.key,b.question])),t.meter);for(let b of f){let P=!bn(n.store,n.target,b.field)&&An(n.store,n.target,b.field)!=="one";l.push(...oe(h[b.key],b.of,P?3:1).filter((S,m)=>m===0||S.confidence>=.4))}}else if(d){let f=await te(d,`You fill in a record's fields in an app. Answer only JSON: {"fills": [candidate ids]}, at most one per field, only ids from the candidates.`,JSON.stringify({state:t.state,candidates:o.map(P=>({id:P.id,says:P.description}))}),t,t.meter),h=Array.isArray(f?.fills)?f.fills.filter(P=>typeof P=="string"):[],b=new Set;for(let P of h){let S=o.find(m=>m.id===P);S?.type==="fill"&&!b.has(S.field)&&(b.add(S.field),l.push({candidate:S}))}}else return E(t,i,"fill",Y)}catch(f){return E(t,i,"fill",f instanceof Error?f.message:String(f))}let p=t.usage.at(-1)?.model,a=se(n.store,{interaction:t.id,target:n.target,basis:i,...p?{model:p}:{},proposals:l.flatMap(({candidate:f,confidence:h})=>f.type==="fill"?[{id:f.id,label:f.label,said:f.description,call:f.call,record:f.record,field:f.field,...h!==void 0?{confidence:h}:{}}]:[])},n.principal);return{interaction:{...t.entry,ask:{kind:"fill",said:i},offered:a.proposals.map(f=>({id:f.id,type:"fill",label:f.label,...f.confidence!==void 0?{confidence:f.confidence}:{}})),outcome:"offered",usage:[...t.usage]},offers:[],...a.proposals.length>0?{ghost:a}:{}}}function bn(e,n,t){let i=n.on==="record"||n.on==="field"?n.id:void 0,o=i?e.graph.getNode(i)?.kind:void 0,s=(o?e.schema.tryDefinition(o)?.fields?.shape:void 0)??{};return t in s}function An(e,n,t){let i=n.on==="record"||n.on==="field"?n.id:void 0,o=i?e.graph.getNode(i)?.kind:void 0;return o?e.schema.tryDefinition(o)?.edges?.[t]?.cardinality:void 0}async function Qe(e,n){let t=Q(e,n),i=n.said??"Add one",o=new Set(n.store.allMutations().filter(a=>(a.creates??[]).length>0).map(a=>a.name)),s=t.catalog.candidates.filter(a=>a.type==="act"&&a.asks.length>0&&o.has(a.mutation));if(s.length===0)return E(t,i,"record","Nothing here makes a record.");let c=B(e);if(!c)return E(t,i,"record",Y);let d;try{let a=await te(c,'You propose one new record for an app by filling in an act. Answer only JSON: {"act": a candidate id, "args": {argument: value}}. Use only the candidates, and fill every argument the act asks for with a value that fits the state.',JSON.stringify({ask:i,state:t.state,candidates:s.map(b=>({id:b.id,says:b.description,asks:b.asks}))}),t,t.meter),f=s.find(b=>b.id===a?.act),h=typeof a?.args=="object"&&a.args!==null?a.args:{};f&&(d={act:f,args:Object.fromEntries(Object.entries(h).filter(([b])=>f.asks.includes(b)))})}catch(a){return E(t,i,"record",a instanceof Error?a.message:String(a))}if(!d)return E(t,i,"record","The model named no act this app has here.");let l=t.usage.at(-1)?.model,p=se(n.store,{interaction:t.id,target:n.target,basis:i,...l?{model:l}:{},proposals:[{id:d.act.id,label:d.act.label,said:d.act.description,call:{name:d.act.mutation,args:{...d.act.args,...d.args}}}]},n.principal);return p.proposals.length===0?E(t,i,"record","What the model proposed could not be made here."):{interaction:{...t.entry,ask:{kind:"record",said:i},offered:p.proposals.map(a=>({id:a.id,type:"act",label:a.said})),outcome:"offered",usage:[...t.usage]},offers:[d.act],ghost:p}}async function Ye(e,n){let t=Q(e,n),i=n.said??"Make a panel",o=t.catalog.candidates.filter(a=>a.type==="panel");if(o.length===0)return E(t,i,"panel","Nothing here can be drawn as a panel.");let s=ee(e),c=B(e),d;try{if(c){let a=await te(c,'You choose a panel to draw in an app. Answer only JSON: {"panel": a candidate id, "title": a short title}. Choose only among the candidates.',JSON.stringify({ask:i,state:t.state,candidates:o.map(h=>({id:h.id,says:h.description}))}),t,t.meter),f=o.find(h=>h.id===a?.panel);f&&(d={panel:f,...typeof a?.title=="string"&&a.title.trim()?{title:a.title.trim().slice(0,60)}:{}})}else if(s){let{question:a,of:f}=ie(o,`Which panel answers this best: ${i}`),h=oe((await ne(s,t.state,{panel:a},t.meter)).panel,f,1)[0];h?.candidate.type==="panel"&&(d={panel:h.candidate,confidence:h.confidence})}else return E(t,i,"panel",Y)}catch(a){return E(t,i,"panel",a instanceof Error?a.message:String(a))}if(!d)return E(t,i,"panel","The model named no panel this app can draw.");let l=d.title??d.panel.label,p={title:l,recipe:{...d.panel.panel,title:l}};return{interaction:{...t.entry,ask:{kind:"panel",said:i},offered:[me(d.panel,d.confidence)],outcome:"drawn",panel:p,usage:[...t.usage]},offers:[d.panel],panel:p}}function Sn(e){return e.off?void 0:e.answer}var wn=`You answer a person's question about what they are looking at in an app, from the state given and nothing else. Answer only JSON: {"answer": one to three short sentences, "pick": [candidate ids that act on the answer, best first, at most three]}. Pick only ids from the candidates, and none when nothing fits. Never say an id to the person.`;async function Jn(e,n){let t=Q(e,n),i=n.said.trim(),o=t.catalog.candidates.filter(m=>_e(m)||m.type==="panel"||m.type==="place"||m.type==="record").slice(0,32),s=Sn(e),c=B(e),d=ee(e),l="",p=[],a=m=>m.flatMap(C=>o.filter(k=>k.id===C)).slice(0,3).map(C=>({candidate:C}));try{if(s){let m=await s.answer({said:i,target:n.target,targetLabel:t.entry.targetLabel,state:t.state,catalog:{target:t.catalog.target,candidates:o},...n.follows?{follows:n.follows}:{}}),C=m.usage?.inputTokens,k=m.usage?.outputTokens,g=m.usage?.costUsd??(C!==void 0?Te(s.price,C,k??0):void 0);t.meter({tier:"thinking",model:s.model,...C!==void 0?{inputTokens:C}:{},...k!==void 0?{outputTokens:k}:{},...g!==void 0?{costUsd:g}:{}}),l=typeof m.text=="string"?m.text.trim():"",p=a(m.pick??[])}else if(c){let m=await te(c,wn,JSON.stringify({ask:i,about:t.entry.targetLabel,...n.follows?{follows:n.follows}:{},state:t.state,candidates:o.map(C=>({id:C.id,says:C.description}))}),t,t.meter);l=typeof m?.answer=="string"?m.answer.trim():"",p=a(Array.isArray(m?.pick)?m.pick:[])}else if(d&&o.length>0){let{question:m,of:C}=ie(o,`Which of these best answers, or acts on: ${i}`),k=await ne(d,{...t.state,asked:i,candidates:o.map(g=>({id:g.id,type:g.type,says:g.description}))},{answer:m},t.meter);p=oe(k.answer,C,3),l=p.length>0?`These fit \u201C${i}\u201D.`:""}else return E(t,i,"ask",Y)}catch(m){return E(t,i,"ask",m instanceof Error?m.message:String(m))}if(!l&&p.length===0)return E(t,i,"ask","The AI had no answer to that here.");let f=t.usage.at(-1)?.model,h=p.flatMap(({candidate:m,confidence:C})=>{let k=he(m);return k?[{...k,...C!==void 0?{confidence:C}:{}}]:[]}),b=h.length>0?se(n.store,{interaction:t.id,target:n.target,basis:i,...f?{model:f}:{},proposals:h},n.principal):void 0,P=p.map(({candidate:m})=>m).filter(m=>he(m)===void 0),S=[...P.map(m=>me(m,p.find(C=>C.candidate===m)?.confidence)),...(b?.proposals??[]).map(m=>({id:m.id,type:m.field!==void 0?"fill":"act",label:m.label,...m.confidence!==void 0?{confidence:m.confidence}:{}}))];return{interaction:{...t.entry,ask:{kind:"ask",said:i},offered:S,outcome:"offered",...l?{answer:l}:{},usage:[...t.usage]},offers:P,...b&&b.proposals.length>0?{ghost:b}:{},...l?{answer:l}:{}}}function se(e,n,t){let i=n.proposals.flatMap(o=>{try{let s=e.previewAll([o.call],{author:t}),c=s.ops.map(d=>d.intent).join("; ");return s.ops.length>0?[{...o,said:c||o.said}]:[]}catch{return[]}});return{...n,proposals:i}}function he(e){if(e.type==="fill")return{id:e.id,label:e.label,said:e.description,call:e.call,record:e.record,field:e.field};if(e.type==="act"&&e.asks.length===0)return{id:e.id,label:e.label,said:e.description,call:{name:e.mutation,args:{...e.args}}}}function Xe(e,n,t){let i=n.proposals.filter(s=>t.ids===void 0||t.ids.includes(s.id));if(i.length===0)return{ok:!1,refused:"Nothing was chosen."};let o=i.flatMap(s=>s.confidence===void 0?[]:[s.confidence]);try{let c=e.applyAll(i.map(d=>d.call),{author:t.author,via:`ai:${n.interaction}`,intent:n.basis,lineage:{basis:`Asked \u201C${n.basis}\u201D`,...n.model?{model:n.model}:{},...o.length>0?{confidence:Math.min(...o)}:{},interaction:n.interaction}}).ops[0]?.batch;return c?{ok:!0,batch:c,accepted:i.map(d=>d.id)}:{ok:!1,refused:"That changes nothing now."}}catch(s){return{ok:!1,refused:s instanceof Error?s.message:String(s)}}}function Ze(e,n,t){let i=e.ask.kind==="suggest"?n.length>0:e.offered.length>0&&e.offered.every(o=>n.includes(o.id));return{...e,outcome:i?"accepted":"partly",accepted:n,batches:[...e.batches??[],t]}}var en=e=>({...e,outcome:"dismissed"});var I=Se(ln(),1);var x=Se(Fe(),1);function tn(e,n,t){let i=n.on==="selection"?n.ids:n.on==="record"||n.on==="field"?[n.id]:[],o=i.length>0?Ue(e.store,i,{principal:e.principal,...i.length===1?{focus:i[0]}:{}}).affordances.map(s=>({mutation:s.mutation,label:s.label,args:s.args,open:s.open,why:s.why,...s.destructive?{destructive:!0}:{}})):void 0;return{store:e.store,target:n,principal:e.principal,interaction:ve(),places:e.places,selection:e.selection,...o?{acts:o}:{},...e.place?{place:e.place}:{},...t?{said:t}:{}}}async function on(e,n,t){let i=await (__graviewPreload(import.meta.url,["./chunk.4RJZVTW7.js","./chunk.G4JJXA63.js","./chunk.WBHM5I3I.js","./chunk.VC3BX2ZF.js","./chunk.WAB7UDHU.js","./chunk.IW7YFPGG.js","./chunk.Q5WEOX3Q.js","./chunk.OMZ3LDDN.js","./chunk.MGWMGLWE.js","./chunk.Q7RQC3F7.js","./chunk.WVUJXDXZ.js","./chunk.OYHQSXNC.js","./chunk.UHX4WTM7.js","./chunk.IKX4VDTW.js","./chunk.RNEJYIQ7.js","./chunk.TBQOSI4J.js","./chunk.KWQ7QOHD.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.66JF3UMG.js")),o=i.recipeDraft(n.recipe,{app:e.app,sight:i.draftSight(e.app,e.principal)});if(i.isDraftFailure(o))return o.failed;t?.(),e.seatTalk.setDraft(o,null),e.goTo.draft?.(),sn()}function sn(e=180){if(typeof document>"u")return;let n=document.querySelector('[data-testid="draft-keep"]'),t=document.activeElement,i=!t||t===document.body||t.closest?.("[inert]")!==null;if(n){i&&n.focus();return}e>0&&requestAnimationFrame(()=>sn(e-1))}async function re(e,n,t,i,o){let s=tn(e,t,i),c=n==="suggest"?await Ke(e.ai,s):n==="fill"?await Ve(e.ai,s):n==="record"?await Qe(e.ai,s):await Ye(e.ai,s);if(c.interaction.outcome==="failed")return n!=="suggest"&&e.desk.record(c.interaction),c;let d=l=>{let p={...c.interaction,outcome:"failed",failed:l};return e.desk.record(p),{...c,interaction:p}};if(n==="fill"||n==="record"){if(!c.ghost||c.ghost.proposals.length===0)return d("Nothing here could be filled in.");o?.(),e.desk.setGhost({ghost:c.ghost}),e.desk.record(c.interaction)}if(n==="panel"&&c.panel){let l=await on(e,c.panel,o);if(l)return d(l);e.desk.record(c.interaction)}return c}var Ie=new WeakMap,xn=64,nn=new WeakMap;function On(e){let n=nn.get(e);if(!n){let t=n={n:0};nn.set(e,t),e.subscribe(()=>void(t.n+=1))}return n.n}var rn=(e,n)=>{let t=V(n);return t.length>0?t.map(i=>e.graph.getNode(i)):[On(e)]},an=(e,n,t)=>JSON.stringify({target:n,seat:e.principal,by:t}),dn=(e,n,t)=>{let i=rn(e.store,n);return t.schema===e.store.schema&&t.ai===e.ai&&i.length===t.depends.length&&i.every((o,s)=>o===t.depends[s])};function Cn(e,n,t="menu"){let i=Ie.get(e.store)?.get(an(e,n,t));return i?.result!==void 0&&dn(e,n,i)?i.result:void 0}function $n(e,n,t){let i=Ie.get(e.store);i||Ie.set(e.store,i=new Map);let o=an(e,n,t?.by??"menu"),s=i.get(o);if(s&&dn(e,n,s))return s.result?Promise.resolve(s.result):s.asked;let c=t?t.ask():re(e,"suggest",n),d={schema:e.store.schema,ai:e.ai,depends:rn(e.store,n),asked:c};i.delete(o),i.set(o,d),i.size>xn&&i.delete(i.keys().next().value);let l=i;return c.then(p=>{p.interaction.outcome!=="failed"?d.result=p:l.get(o)===d&&l.delete(o)}),c}async function Pn(e,n,t,i){let o=n.interaction,s=he(t);if(s){let c=o.usage?.at(-1)?.model,d=o.offered.find(p=>p.id===t.id)?.confidence,l=se(e.store,{interaction:o.id,target:o.target,basis:`${o.ask.said}: ${t.label}`,...c?{model:c}:{},proposals:[{...s,...d!==void 0?{confidence:d}:{}}]},e.principal);if(l.proposals.length===0){let p="That can't be done now.";return e.desk.record({...o,outcome:"failed",failed:p}),p}i?.(),e.desk.setGhost({ghost:l}),e.desk.record(o);return}if(t.type==="panel"){let c=t.label,d={title:c,recipe:{...t.panel,title:c}},l=await on(e,d,i);return e.desk.record(l?{...o,outcome:"failed",failed:l}:{...o,outcome:"drawn",accepted:[t.id],panel:d}),l}i?.(),t.type==="place"?e.goTo.place(t.place):t.type==="record"&&e.goTo.record(t.record),e.desk.record({...o,outcome:"accepted",accepted:[t.id]})}async function Yn(e,n){if(n.ask.kind==="ask")return ce(e.desk,{target:n.target,asked:n.ask.said}),null;let t=n.ask.kind==="panel"||n.ask.kind==="record"?n.ask.kind:"fill";return re(e,t,n.target,n.ask.said)}var G={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},ke={margin:0,padding:"4px 10px",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function Xn({target:e,close:n}){let t=We(),i=(0,I.useMemo)(()=>Ge(e,u=>t.store.graph.has(u)),[e,t.store]),o=(0,I.useMemo)(()=>{let u=tn(t,i);return ye(t.store,i,{principal:t.principal,places:t.places,...u.acts?{acts:u.acts}:{}})},[t,i]),s=o.candidates.some(u=>u.type==="fill"),c=o.candidates.some(u=>u.type==="panel"),d=(0,I.useMemo)(()=>c?ze(t.store,i,{principal:t.principal,places:t.places,most:1}):[],[c,t,i]),l=(0,I.useMemo)(()=>new Set(t.store.allMutations().filter(u=>(u.creates??[]).length>0).map(u=>u.name)),[t.store]),p=B(t.ai)!==void 0&&o.candidates.some(u=>u.type==="act"&&u.asks.length>0&&l.has(u.mutation)),a=we(t.ai),f=Cn(t,i),h=JSON.stringify(i),[b,P]=(0,I.useState)(!1),[S,m]=(0,I.useState)(null),[C,k]=(0,I.useState)(a&&f===void 0);(0,I.useEffect)(()=>{if(f!==void 0||!(a||b))return;let u=!0;return k(!0),$n(t,i).then(O=>{u&&(m(O),k(!1))}),()=>{u=!1}},[h,b]);let g=f??S,A=(g?.offers??[]).filter(u=>!(u.type==="place"&&d.some(O=>O.place===u.place))).slice(0,Math.max(0,3-d.length)),w=g?.interaction.outcome==="failed"?g.interaction.failed??"The AI could not suggest anything here.":null,M=(0,I.useRef)(!1),L=(0,I.useRef)(null);(0,I.useLayoutEffect)(()=>{g===null||!M.current||(M.current=!1,L.current?.querySelector("button")?.focus())},[g]);let J=(0,I.useRef)(!0);(0,I.useEffect)(()=>()=>{J.current=!1},[]);let[F,r]=(0,I.useState)(!1),[y,T]=(0,I.useState)(null),v=u=>{if(F)return;r(!0),T(null);let O=!1;u(()=>{O=!0,n()}).then(D=>{J.current&&(r(!1),D?T(D):O||n())},D=>{J.current&&(r(!1),T(D instanceof Error?D.message:String(D)))})},$=u=>u.interaction.outcome==="failed"?u.interaction.failed??"The AI could not do that here.":void 0;return(0,x.jsxs)("div",{ref:L,"data-testid":"inline-ai",style:{display:"grid",gap:2},children:[C&&!b?(0,x.jsx)("p",{role:"status","data-testid":"inline-ai-thinking",style:ke,children:"Thinking\u2026"}):F?(0,x.jsx)("p",{role:"status","data-testid":"inline-ai-asking",style:ke,children:"Asking\u2026"}):y?(0,x.jsx)("p",{role:"alert","data-testid":"inline-ai-failed",style:{...ke,color:"var(--graview-warn)"},children:y}):w?(0,x.jsx)("p",{role:"status",style:ke,children:w}):null,(0,x.jsxs)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[A.map(u=>(0,x.jsx)("li",{children:(0,x.jsxs)("button",{type:"button","data-menu-item":`ai-offer:${u.id}`,"data-ai-offer":u.id,"data-ai-offer-type":u.type,onClick:()=>v(O=>Pn(t,g,u,O)),style:G,children:[u.label,(0,x.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",u.type==="panel"?"a panel":u.type==="place"?"go there":u.type==="record"?"open it":"suggested"]})]})},u.id)),!a&&g===null?(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":"ai-suggest","aria-disabled":b||void 0,onClick:u=>{b||(M.current=document.activeElement===u.currentTarget,P(!0))},style:G,children:b?"Thinking\u2026":"Suggest\u2026"})}):null,s?(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":"ai-fill",onClick:()=>v(async u=>$(await re(t,"fill",i,"Fill in",u))),style:G,children:"Fill in with AI"})}):null,p?(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":"ai-record",onClick:()=>v(async u=>$(await re(t,"record",i,"Add one",u))),style:G,children:"Add one with AI"})}):null,d.map(u=>(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":`ai-open:${u.place}`,"data-ai-existing":u.fit,onClick:()=>{n(),t.goTo.place(u.place),u.fit==="partial"&&ce(t.desk,{target:{on:"lens",place:u.place,...u.kind?{kind:u.kind}:{}}})},style:G,children:u.fit==="full"?`Open ${u.title}`:`Open and adjust ${u.title}`})},u.place)),c?(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":"ai-panel",onClick:()=>v(async u=>$(await re(t,"panel",i,"Draw a panel",u))),style:G,children:d.length>0?"Draw a new view":"Draw a panel"})}):null,(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":"ai-ask",onClick:()=>{let u=document.activeElement;n(),ce(t.desk,{target:i,returnTo:u instanceof HTMLElement&&u!==document.body?u:null})},style:G,children:"Ask about this\u2026"})})]})]})}var be={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 10px",fontSize:"0.8125rem",borderRadius:8};function Zn({placement:e="picture"}){let{store:n,principal:t,aiDesk:i}=Je(),o=Le(n,t),{ghost:s,entries:c}=He(i),[d,l]=(0,I.useState)(new Set);(0,I.useEffect)(()=>l(new Set),[s?.ghost.interaction]);let p=(0,I.useRef)(null),a=(0,I.useRef)(null),f=s?.batch;if((0,I.useEffect)(()=>{f!==void 0&&a.current?.focus()},[f]),!s)return null;let{ghost:h}=s,b=c.find(g=>g.id===h.interaction),P=()=>{let g=h.target.on==="record"||h.target.on==="field"?h.target.id:void 0,A=p.current?.closest("[data-graview-face], main")?.parentElement??document,w=(g?A.querySelector(`[data-graview-view="${CSS.escape(g)}"][tabindex]`):null)??document.querySelector("[data-graview-page-title]")??p.current?.closest("main")??document.querySelector("main");w&&!w.hasAttribute("tabindex")&&w.setAttribute("tabindex","-1"),w?.focus({preventScroll:!0}),i.setGhost(null)},S=h.proposals.filter(g=>!d.has(g.id)).map(g=>g.id),m=()=>{let g=Xe(o,h,{author:t,ids:S});if(!g.ok){i.setGhost({...s,refused:g.refused});return}b&&i.record(Ze(b,g.accepted,g.batch)),i.setGhost({ghost:h,batch:g.batch,took:g.accepted.length,...s.onCard?{onCard:!0}:{}})},C=()=>{b&&s.batch===void 0&&i.record(en(b)),P()},k=()=>{if(s.batch!==void 0)try{o.undo(s.batch,{author:t}),P()}catch(g){i.setGhost({...s,refused:g instanceof Error?g.message:String(g)})}};return(0,x.jsxs)("section",{ref:p,"data-testid":"ai-ghost","data-interaction":h.interaction,"aria-label":"Proposed by AI",style:{...e==="card"?{position:"static"}:{position:e==="page"?"fixed":"absolute",insetInline:"max(12px, calc(50% - 220px))",bottom:"calc(var(--graview-foot-room, 0px) + 72px)",zIndex:De("toast"),boxShadow:"var(--graview-lift-high)"},display:"grid",gap:8,padding:12,borderRadius:12,border:"1px dashed var(--graview-accent)",background:"var(--graview-float)",fontSize:"0.875rem"},children:[(0,x.jsx)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:s.batch!==void 0?`Done: ${s.took===1?"one change":`${s.took} changes`}, as one.`:`Proposed by AI \xB7 ${h.basis}`}),s.batch===void 0?(0,x.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:h.proposals.map(g=>(0,x.jsx)("li",{"data-ghost-proposal":g.id,children:(0,x.jsxs)("label",{style:{display:"flex",alignItems:"baseline",gap:8,cursor:"pointer"},children:[(0,x.jsx)("input",{type:"checkbox",checked:!d.has(g.id),onChange:A=>{let w=new Set(d);A.target.checked?w.delete(g.id):w.add(g.id),l(w)}}),(0,x.jsx)("span",{style:{fontStyle:"italic",color:"var(--graview-ink)"},children:g.said}),g.confidence!==void 0?(0,x.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[Math.round(g.confidence*100),"% sure"]}):null]})},g.id))}):null,s.refused?(0,x.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-warn)"},children:s.refused}):null,(0,x.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.batch===void 0?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("button",{type:"button","data-testid":"ghost-accept",disabled:S.length===0,onClick:m,style:be,children:S.length===h.proposals.length?"Accept":`Accept ${S.length} of ${h.proposals.length}`}),(0,x.jsx)("button",{type:"button","data-testid":"ghost-dismiss",onClick:C,style:be,children:"Dismiss"})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("button",{type:"button",ref:a,"data-testid":"ghost-undo",onClick:k,style:be,children:"Undo"}),(0,x.jsx)("button",{type:"button","data-testid":"ghost-close",onClick:P,style:be,children:"Close"})]})})]})}export{Ge as a,V as b,ye as c,ze as d,ee as e,ve as f,hn as g,mn as h,Fn as i,Jn as j,tn as k,on as l,re as m,Cn as n,$n as o,Pn as p,Yn as q,Xn as r,Zn as s};
3
+ ${o}`)})}}if(e.turn){let t=e.turn;return{model:n,think:async({system:i,prompt:o})=>({text:await t({system:i,messages:[{role:"user",content:o}],tools:[],call:async()=>({error:"No tools here."})})})}}}var Te=(e,n,t)=>e?n/1e6*(e.inputPerMillion??0)+t/1e6*(e.outputPerMillion??0):void 0,ve=()=>`ai-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;function hn(e,n,t=[]){let i=o=>{let s=e.graph.getNode(o);return s?ae(e.schema.tryDefinition(s.kind),s):"a record"};switch(n.on){case"record":return i(n.id);case"field":return`${i(n.id)} \xB7 ${n.field}`;case"selection":return`${n.ids.length} records`;case"list":return e.schema.tryDefinition(n.kind)?q(e.schema,n.kind):n.kind;case"lens":case"place":return t.find(o=>o.as===n.place)?.title??(n.place==="home"?"Home":n.place);case"act":return n.act}}var _e=e=>e.type!=="act"||e.asks.length===0,me=(e,n)=>({id:e.id,type:e.type,label:e.label,...n!==void 0?{confidence:n}:{}});function Q(e,n){let t=n.interaction??ve(),i=ye(n.store,n.target,{principal:n.principal,...n.acts?{acts:n.acts}:{},...n.places?{places:n.places}:{}}),o=qe(n.store,n.target,{principal:n.principal,...n.place?{place:n.place}:{},...n.selection?{selection:n.selection}:{}}),s=[];return{id:t,catalog:i,state:o,entry:{id:t,at:new Date().toISOString(),by:n.by??n.principal,target:n.target,targetLabel:hn(n.store,n.target,n.places)},usage:s,meter:c=>{s.push(c),e.meter?.({...c,interaction:t})}}}async function ne(e,n,t,i){let o=await e.decide(n,t),{inputTokens:s,outputTokens:c}=o.usage,d=Te(e.price,s,c);return i({tier:"fast",model:e.model,inputTokens:s,outputTokens:c,...d!==void 0?{costUsd:d}:{}}),o.answers}async function te(e,n,t,i,o){let s=await e.think({system:n,prompt:t,state:i.state,catalog:i.catalog}),c=s.usage?.inputTokens,d=s.usage?.outputTokens,l=s.usage?.costUsd??(c!==void 0?Te(e.price,c,d??0):void 0);return o({tier:"thinking",model:e.model,...c!==void 0?{inputTokens:c}:{},...d!==void 0?{outputTokens:d}:{},...l!==void 0?{costUsd:l}:{}}),Be(s.text)}function ie(e,n){let t=new Map(e.map((i,o)=>[`c${o+1}`,i]));return{question:{type:"choice",instructions:n,criteria:Object.fromEntries([...t].map(([i,o])=>[i,`${o.label} \u2014 ${o.description}`]))},of:i=>t.get(i)}}function oe(e,n,t){if(e?.type!=="choice")return[];let i=e,o=Object.entries(i.probabilities).sort((s,c)=>c[1]-s[1]);return o.some(([s])=>s===i.choice)||o.unshift([i.choice,i.confidence]),o.flatMap(([s,c])=>{let d=n(s);return d?[{candidate:d,confidence:c}]:[]}).slice(0,t)}var E=(e,n,t,i)=>({interaction:{...e.entry,ask:{kind:t,said:n??""},offered:[],outcome:"failed",failed:i,usage:[...e.usage]},offers:[]}),Y="AI isn't on here.";async function Ke(e,n,t=3){let i=Q(e,n),o=n.said??"Suggest",s=i.catalog.candidates.filter(_e).slice(0,24);if(s.length===0)return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:[],outcome:"offered",usage:[]},offers:[]};let c=ee(e),d=B(e),l=[];try{if(c){let{question:p,of:a}=ie(s,"Which of these would the person most likely want to do next, here?"),f=await ne(c,{...i.state,candidates:s.map(h=>({id:h.id,type:h.type,says:h.description}))},{next:p},i.meter);l=oe(f.next,a,t)}else if(d){let p=await te(d,'You suggest what a person most likely wants to do next in an app. Answer only JSON: {"pick": [candidate ids, best first]}. Pick only ids from the candidates.',JSON.stringify({state:i.state,candidates:s.map(f=>({id:f.id,says:f.description}))}),i,i.meter);l=(Array.isArray(p?.pick)?p.pick.filter(f=>typeof f=="string"):[]).flatMap(f=>s.filter(h=>h.id===f)).slice(0,t).map(f=>({candidate:f}))}else return E(i,o,"suggest",Y)}catch(p){return E(i,o,"suggest",p instanceof Error?p.message:String(p))}return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:l.map(({candidate:p,confidence:a})=>me(p,a)),outcome:"offered",usage:[...i.usage]},offers:l.map(({candidate:p})=>p)}}var mn=e=>`several:${e}`;async function Fn(e,n,t=2){let i=Q(e,{...n,acts:[]}),o=n.said??"Suggest for the chosen",s=n.target.on==="selection"?n.target.ids.length:1,d=[...n.shared.map(a=>({type:"act",id:mn(a.id),label:a.label,description:`${a.label}, for all ${s} chosen`,mutation:a.mutation,args:a.args,asks:[]})),...i.catalog.candidates.filter(a=>a.type==="panel"||a.type==="place")].slice(0,24),l=ee(e);if(!l)return E(i,o,"suggest",Y);if(d.length===0)return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:[],outcome:"offered",usage:[]},offers:[]};let p;try{let{question:a,of:f}=ie(d,`Which of these would the person most likely want to do next with the ${s} records they chose together?`),h=await ne(l,{...i.state,candidates:d.map(b=>({id:b.id,type:b.type,says:b.description}))},{next:a},i.meter);p=oe(h.next,f,t).filter((b,P)=>P===0||b.confidence>=kn)}catch(a){return E(i,o,"suggest",a instanceof Error?a.message:String(a))}return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:p.map(({candidate:a,confidence:f})=>me(a,f)),outcome:"offered",usage:[...i.usage]},offers:p.map(({candidate:a})=>a)}}var kn=.25;async function Ve(e,n){let t=Q(e,n),i=n.said??"Fill in",o=t.catalog.candidates.filter(f=>f.type==="fill"),s=new Map;for(let f of o)s.set(f.field,[...s.get(f.field)??[],f]);if(s.size===0)return{interaction:{...t.entry,ask:{kind:"fill",said:i},offered:[],outcome:"offered",usage:[]},offers:[]};let c=ee(e),d=B(e),l=[];try{if(c){let f=[...s].map(([b,P],S)=>({key:`f${S+1}`,field:b,...ie(P,`Which value fits "${b}" best for this record?`)})),h=await ne(c,t.state,Object.fromEntries(f.map(b=>[b.key,b.question])),t.meter);for(let b of f){let P=!bn(n.store,n.target,b.field)&&An(n.store,n.target,b.field)!=="one";l.push(...oe(h[b.key],b.of,P?3:1).filter((S,m)=>m===0||S.confidence>=.4))}}else if(d){let f=await te(d,`You fill in a record's fields in an app. Answer only JSON: {"fills": [candidate ids]}, at most one per field, only ids from the candidates.`,JSON.stringify({state:t.state,candidates:o.map(P=>({id:P.id,says:P.description}))}),t,t.meter),h=Array.isArray(f?.fills)?f.fills.filter(P=>typeof P=="string"):[],b=new Set;for(let P of h){let S=o.find(m=>m.id===P);S?.type==="fill"&&!b.has(S.field)&&(b.add(S.field),l.push({candidate:S}))}}else return E(t,i,"fill",Y)}catch(f){return E(t,i,"fill",f instanceof Error?f.message:String(f))}let p=t.usage.at(-1)?.model,a=se(n.store,{interaction:t.id,target:n.target,basis:i,...p?{model:p}:{},proposals:l.flatMap(({candidate:f,confidence:h})=>f.type==="fill"?[{id:f.id,label:f.label,said:f.description,call:f.call,record:f.record,field:f.field,...h!==void 0?{confidence:h}:{}}]:[])},n.principal);return{interaction:{...t.entry,ask:{kind:"fill",said:i},offered:a.proposals.map(f=>({id:f.id,type:"fill",label:f.label,...f.confidence!==void 0?{confidence:f.confidence}:{}})),outcome:"offered",usage:[...t.usage]},offers:[],...a.proposals.length>0?{ghost:a}:{}}}function bn(e,n,t){let i=n.on==="record"||n.on==="field"?n.id:void 0,o=i?e.graph.getNode(i)?.kind:void 0,s=(o?e.schema.tryDefinition(o)?.fields?.shape:void 0)??{};return t in s}function An(e,n,t){let i=n.on==="record"||n.on==="field"?n.id:void 0,o=i?e.graph.getNode(i)?.kind:void 0;return o?e.schema.tryDefinition(o)?.edges?.[t]?.cardinality:void 0}async function Qe(e,n){let t=Q(e,n),i=n.said??"Add one",o=new Set(n.store.allMutations().filter(a=>(a.creates??[]).length>0).map(a=>a.name)),s=t.catalog.candidates.filter(a=>a.type==="act"&&a.asks.length>0&&o.has(a.mutation));if(s.length===0)return E(t,i,"record","Nothing here makes a record.");let c=B(e);if(!c)return E(t,i,"record",Y);let d;try{let a=await te(c,'You propose one new record for an app by filling in an act. Answer only JSON: {"act": a candidate id, "args": {argument: value}}. Use only the candidates, and fill every argument the act asks for with a value that fits the state.',JSON.stringify({ask:i,state:t.state,candidates:s.map(b=>({id:b.id,says:b.description,asks:b.asks}))}),t,t.meter),f=s.find(b=>b.id===a?.act),h=typeof a?.args=="object"&&a.args!==null?a.args:{};f&&(d={act:f,args:Object.fromEntries(Object.entries(h).filter(([b])=>f.asks.includes(b)))})}catch(a){return E(t,i,"record",a instanceof Error?a.message:String(a))}if(!d)return E(t,i,"record","The model named no act this app has here.");let l=t.usage.at(-1)?.model,p=se(n.store,{interaction:t.id,target:n.target,basis:i,...l?{model:l}:{},proposals:[{id:d.act.id,label:d.act.label,said:d.act.description,call:{name:d.act.mutation,args:{...d.act.args,...d.args}}}]},n.principal);return p.proposals.length===0?E(t,i,"record","What the model proposed could not be made here."):{interaction:{...t.entry,ask:{kind:"record",said:i},offered:p.proposals.map(a=>({id:a.id,type:"act",label:a.said})),outcome:"offered",usage:[...t.usage]},offers:[d.act],ghost:p}}async function Ye(e,n){let t=Q(e,n),i=n.said??"Make a panel",o=t.catalog.candidates.filter(a=>a.type==="panel");if(o.length===0)return E(t,i,"panel","Nothing here can be drawn as a panel.");let s=ee(e),c=B(e),d;try{if(c){let a=await te(c,'You choose a panel to draw in an app. Answer only JSON: {"panel": a candidate id, "title": a short title}. Choose only among the candidates.',JSON.stringify({ask:i,state:t.state,candidates:o.map(h=>({id:h.id,says:h.description}))}),t,t.meter),f=o.find(h=>h.id===a?.panel);f&&(d={panel:f,...typeof a?.title=="string"&&a.title.trim()?{title:a.title.trim().slice(0,60)}:{}})}else if(s){let{question:a,of:f}=ie(o,`Which panel answers this best: ${i}`),h=oe((await ne(s,t.state,{panel:a},t.meter)).panel,f,1)[0];h?.candidate.type==="panel"&&(d={panel:h.candidate,confidence:h.confidence})}else return E(t,i,"panel",Y)}catch(a){return E(t,i,"panel",a instanceof Error?a.message:String(a))}if(!d)return E(t,i,"panel","The model named no panel this app can draw.");let l=d.title??d.panel.label,p={title:l,recipe:{...d.panel.panel,title:l}};return{interaction:{...t.entry,ask:{kind:"panel",said:i},offered:[me(d.panel,d.confidence)],outcome:"drawn",panel:p,usage:[...t.usage]},offers:[d.panel],panel:p}}function Sn(e){return e.off?void 0:e.answer}var wn=`You answer a person's question about what they are looking at in an app, from the state given and nothing else. Answer only JSON: {"answer": one to three short sentences, "pick": [candidate ids that act on the answer, best first, at most three]}. Pick only ids from the candidates, and none when nothing fits. Never say an id to the person.`;async function Jn(e,n){let t=Q(e,n),i=n.said.trim(),o=t.catalog.candidates.filter(m=>_e(m)||m.type==="panel"||m.type==="place"||m.type==="record").slice(0,32),s=Sn(e),c=B(e),d=ee(e),l="",p=[],a=m=>m.flatMap(C=>o.filter(k=>k.id===C)).slice(0,3).map(C=>({candidate:C}));try{if(s){let m=await s.answer({said:i,target:n.target,targetLabel:t.entry.targetLabel,state:t.state,catalog:{target:t.catalog.target,candidates:o},...n.follows?{follows:n.follows}:{}}),C=m.usage?.inputTokens,k=m.usage?.outputTokens,g=m.usage?.costUsd??(C!==void 0?Te(s.price,C,k??0):void 0);t.meter({tier:"thinking",model:s.model,...C!==void 0?{inputTokens:C}:{},...k!==void 0?{outputTokens:k}:{},...g!==void 0?{costUsd:g}:{}}),l=typeof m.text=="string"?m.text.trim():"",p=a(m.pick??[])}else if(c){let m=await te(c,wn,JSON.stringify({ask:i,about:t.entry.targetLabel,...n.follows?{follows:n.follows}:{},state:t.state,candidates:o.map(C=>({id:C.id,says:C.description}))}),t,t.meter);l=typeof m?.answer=="string"?m.answer.trim():"",p=a(Array.isArray(m?.pick)?m.pick:[])}else if(d&&o.length>0){let{question:m,of:C}=ie(o,`Which of these best answers, or acts on: ${i}`),k=await ne(d,{...t.state,asked:i,candidates:o.map(g=>({id:g.id,type:g.type,says:g.description}))},{answer:m},t.meter);p=oe(k.answer,C,3),l=p.length>0?`These fit \u201C${i}\u201D.`:""}else return E(t,i,"ask",Y)}catch(m){return E(t,i,"ask",m instanceof Error?m.message:String(m))}if(!l&&p.length===0)return E(t,i,"ask","The AI had no answer to that here.");let f=t.usage.at(-1)?.model,h=p.flatMap(({candidate:m,confidence:C})=>{let k=he(m);return k?[{...k,...C!==void 0?{confidence:C}:{}}]:[]}),b=h.length>0?se(n.store,{interaction:t.id,target:n.target,basis:i,...f?{model:f}:{},proposals:h},n.principal):void 0,P=p.map(({candidate:m})=>m).filter(m=>he(m)===void 0),S=[...P.map(m=>me(m,p.find(C=>C.candidate===m)?.confidence)),...(b?.proposals??[]).map(m=>({id:m.id,type:m.field!==void 0?"fill":"act",label:m.label,...m.confidence!==void 0?{confidence:m.confidence}:{}}))];return{interaction:{...t.entry,ask:{kind:"ask",said:i},offered:S,outcome:"offered",...l?{answer:l}:{},usage:[...t.usage]},offers:P,...b&&b.proposals.length>0?{ghost:b}:{},...l?{answer:l}:{}}}function se(e,n,t){let i=n.proposals.flatMap(o=>{try{let s=e.previewAll([o.call],{author:t}),c=s.ops.map(d=>d.intent).join("; ");return s.ops.length>0?[{...o,said:c||o.said}]:[]}catch{return[]}});return{...n,proposals:i}}function he(e){if(e.type==="fill")return{id:e.id,label:e.label,said:e.description,call:e.call,record:e.record,field:e.field};if(e.type==="act"&&e.asks.length===0)return{id:e.id,label:e.label,said:e.description,call:{name:e.mutation,args:{...e.args}}}}function Xe(e,n,t){let i=n.proposals.filter(s=>t.ids===void 0||t.ids.includes(s.id));if(i.length===0)return{ok:!1,refused:"Nothing was chosen."};let o=i.flatMap(s=>s.confidence===void 0?[]:[s.confidence]);try{let c=e.applyAll(i.map(d=>d.call),{author:t.author,via:`ai:${n.interaction}`,intent:n.basis,lineage:{basis:`Asked \u201C${n.basis}\u201D`,...n.model?{model:n.model}:{},...o.length>0?{confidence:Math.min(...o)}:{},interaction:n.interaction}}).ops[0]?.batch;return c?{ok:!0,batch:c,accepted:i.map(d=>d.id)}:{ok:!1,refused:"That changes nothing now."}}catch(s){return{ok:!1,refused:s instanceof Error?s.message:String(s)}}}function Ze(e,n,t){let i=e.ask.kind==="suggest"?n.length>0:e.offered.length>0&&e.offered.every(o=>n.includes(o.id));return{...e,outcome:i?"accepted":"partly",accepted:n,batches:[...e.batches??[],t]}}var en=e=>({...e,outcome:"dismissed"});var I=Se(ln(),1);var x=Se(Fe(),1);function tn(e,n,t){let i=n.on==="selection"?n.ids:n.on==="record"||n.on==="field"?[n.id]:[],o=i.length>0?Ue(e.store,i,{principal:e.principal,...i.length===1?{focus:i[0]}:{}}).affordances.map(s=>({mutation:s.mutation,label:s.label,args:s.args,open:s.open,why:s.why,...s.destructive?{destructive:!0}:{}})):void 0;return{store:e.store,target:n,principal:e.principal,interaction:ve(),places:e.places,selection:e.selection,...o?{acts:o}:{},...e.place?{place:e.place}:{},...t?{said:t}:{}}}async function on(e,n,t){let i=await (__graviewPreload(import.meta.url,["./chunk.YVONXFKE.js","./chunk.G4JJXA63.js","./chunk.WBHM5I3I.js","./chunk.FOQ27RAR.js","./chunk.WAB7UDHU.js","./chunk.IW7YFPGG.js","./chunk.Q5WEOX3Q.js","./chunk.4OGOTHRD.js","./chunk.6YD2DLIC.js","./chunk.Q7RQC3F7.js","./chunk.WVUJXDXZ.js","./chunk.ZIEHF67C.js","./chunk.UHX4WTM7.js","./chunk.IKX4VDTW.js","./chunk.RNEJYIQ7.js","./chunk.TBQOSI4J.js","./chunk.KWQ7QOHD.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.GQHAAKJG.js")),o=i.recipeDraft(n.recipe,{app:e.app,sight:i.draftSight(e.app,e.principal)});if(i.isDraftFailure(o))return o.failed;t?.(),e.seatTalk.setDraft(o,null),e.goTo.draft?.(),sn()}function sn(e=180){if(typeof document>"u")return;let n=document.querySelector('[data-testid="draft-keep"]'),t=document.activeElement,i=!t||t===document.body||t.closest?.("[inert]")!==null;if(n){i&&n.focus();return}e>0&&requestAnimationFrame(()=>sn(e-1))}async function re(e,n,t,i,o){let s=tn(e,t,i),c=n==="suggest"?await Ke(e.ai,s):n==="fill"?await Ve(e.ai,s):n==="record"?await Qe(e.ai,s):await Ye(e.ai,s);if(c.interaction.outcome==="failed")return n!=="suggest"&&e.desk.record(c.interaction),c;let d=l=>{let p={...c.interaction,outcome:"failed",failed:l};return e.desk.record(p),{...c,interaction:p}};if(n==="fill"||n==="record"){if(!c.ghost||c.ghost.proposals.length===0)return d("Nothing here could be filled in.");o?.(),e.desk.setGhost({ghost:c.ghost}),e.desk.record(c.interaction)}if(n==="panel"&&c.panel){let l=await on(e,c.panel,o);if(l)return d(l);e.desk.record(c.interaction)}return c}var Ie=new WeakMap,xn=64,nn=new WeakMap;function On(e){let n=nn.get(e);if(!n){let t=n={n:0};nn.set(e,t),e.subscribe(()=>void(t.n+=1))}return n.n}var rn=(e,n)=>{let t=V(n);return t.length>0?t.map(i=>e.graph.getNode(i)):[On(e)]},an=(e,n,t)=>JSON.stringify({target:n,seat:e.principal,by:t}),dn=(e,n,t)=>{let i=rn(e.store,n);return t.schema===e.store.schema&&t.ai===e.ai&&i.length===t.depends.length&&i.every((o,s)=>o===t.depends[s])};function Cn(e,n,t="menu"){let i=Ie.get(e.store)?.get(an(e,n,t));return i?.result!==void 0&&dn(e,n,i)?i.result:void 0}function $n(e,n,t){let i=Ie.get(e.store);i||Ie.set(e.store,i=new Map);let o=an(e,n,t?.by??"menu"),s=i.get(o);if(s&&dn(e,n,s))return s.result?Promise.resolve(s.result):s.asked;let c=t?t.ask():re(e,"suggest",n),d={schema:e.store.schema,ai:e.ai,depends:rn(e.store,n),asked:c};i.delete(o),i.set(o,d),i.size>xn&&i.delete(i.keys().next().value);let l=i;return c.then(p=>{p.interaction.outcome!=="failed"?d.result=p:l.get(o)===d&&l.delete(o)}),c}async function Pn(e,n,t,i){let o=n.interaction,s=he(t);if(s){let c=o.usage?.at(-1)?.model,d=o.offered.find(p=>p.id===t.id)?.confidence,l=se(e.store,{interaction:o.id,target:o.target,basis:`${o.ask.said}: ${t.label}`,...c?{model:c}:{},proposals:[{...s,...d!==void 0?{confidence:d}:{}}]},e.principal);if(l.proposals.length===0){let p="That can't be done now.";return e.desk.record({...o,outcome:"failed",failed:p}),p}i?.(),e.desk.setGhost({ghost:l}),e.desk.record(o);return}if(t.type==="panel"){let c=t.label,d={title:c,recipe:{...t.panel,title:c}},l=await on(e,d,i);return e.desk.record(l?{...o,outcome:"failed",failed:l}:{...o,outcome:"drawn",accepted:[t.id],panel:d}),l}i?.(),t.type==="place"?e.goTo.place(t.place):t.type==="record"&&e.goTo.record(t.record),e.desk.record({...o,outcome:"accepted",accepted:[t.id]})}async function Yn(e,n){if(n.ask.kind==="ask")return ce(e.desk,{target:n.target,asked:n.ask.said}),null;let t=n.ask.kind==="panel"||n.ask.kind==="record"?n.ask.kind:"fill";return re(e,t,n.target,n.ask.said)}var G={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},ke={margin:0,padding:"4px 10px",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function Xn({target:e,close:n}){let t=We(),i=(0,I.useMemo)(()=>Ge(e,u=>t.store.graph.has(u)),[e,t.store]),o=(0,I.useMemo)(()=>{let u=tn(t,i);return ye(t.store,i,{principal:t.principal,places:t.places,...u.acts?{acts:u.acts}:{}})},[t,i]),s=o.candidates.some(u=>u.type==="fill"),c=o.candidates.some(u=>u.type==="panel"),d=(0,I.useMemo)(()=>c?ze(t.store,i,{principal:t.principal,places:t.places,most:1}):[],[c,t,i]),l=(0,I.useMemo)(()=>new Set(t.store.allMutations().filter(u=>(u.creates??[]).length>0).map(u=>u.name)),[t.store]),p=B(t.ai)!==void 0&&o.candidates.some(u=>u.type==="act"&&u.asks.length>0&&l.has(u.mutation)),a=we(t.ai),f=Cn(t,i),h=JSON.stringify(i),[b,P]=(0,I.useState)(!1),[S,m]=(0,I.useState)(null),[C,k]=(0,I.useState)(a&&f===void 0);(0,I.useEffect)(()=>{if(f!==void 0||!(a||b))return;let u=!0;return k(!0),$n(t,i).then(O=>{u&&(m(O),k(!1))}),()=>{u=!1}},[h,b]);let g=f??S,A=(g?.offers??[]).filter(u=>!(u.type==="place"&&d.some(O=>O.place===u.place))).slice(0,Math.max(0,3-d.length)),w=g?.interaction.outcome==="failed"?g.interaction.failed??"The AI could not suggest anything here.":null,M=(0,I.useRef)(!1),L=(0,I.useRef)(null);(0,I.useLayoutEffect)(()=>{g===null||!M.current||(M.current=!1,L.current?.querySelector("button")?.focus())},[g]);let J=(0,I.useRef)(!0);(0,I.useEffect)(()=>()=>{J.current=!1},[]);let[F,r]=(0,I.useState)(!1),[y,T]=(0,I.useState)(null),v=u=>{if(F)return;r(!0),T(null);let O=!1;u(()=>{O=!0,n()}).then(D=>{J.current&&(r(!1),D?T(D):O||n())},D=>{J.current&&(r(!1),T(D instanceof Error?D.message:String(D)))})},$=u=>u.interaction.outcome==="failed"?u.interaction.failed??"The AI could not do that here.":void 0;return(0,x.jsxs)("div",{ref:L,"data-testid":"inline-ai",style:{display:"grid",gap:2},children:[C&&!b?(0,x.jsx)("p",{role:"status","data-testid":"inline-ai-thinking",style:ke,children:"Thinking\u2026"}):F?(0,x.jsx)("p",{role:"status","data-testid":"inline-ai-asking",style:ke,children:"Asking\u2026"}):y?(0,x.jsx)("p",{role:"alert","data-testid":"inline-ai-failed",style:{...ke,color:"var(--graview-warn)"},children:y}):w?(0,x.jsx)("p",{role:"status",style:ke,children:w}):null,(0,x.jsxs)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[A.map(u=>(0,x.jsx)("li",{children:(0,x.jsxs)("button",{type:"button","data-menu-item":`ai-offer:${u.id}`,"data-ai-offer":u.id,"data-ai-offer-type":u.type,onClick:()=>v(O=>Pn(t,g,u,O)),style:G,children:[u.label,(0,x.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",u.type==="panel"?"a panel":u.type==="place"?"go there":u.type==="record"?"open it":"suggested"]})]})},u.id)),!a&&g===null?(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":"ai-suggest","aria-disabled":b||void 0,onClick:u=>{b||(M.current=document.activeElement===u.currentTarget,P(!0))},style:G,children:b?"Thinking\u2026":"Suggest\u2026"})}):null,s?(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":"ai-fill",onClick:()=>v(async u=>$(await re(t,"fill",i,"Fill in",u))),style:G,children:"Fill in with AI"})}):null,p?(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":"ai-record",onClick:()=>v(async u=>$(await re(t,"record",i,"Add one",u))),style:G,children:"Add one with AI"})}):null,d.map(u=>(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":`ai-open:${u.place}`,"data-ai-existing":u.fit,onClick:()=>{n(),t.goTo.place(u.place),u.fit==="partial"&&ce(t.desk,{target:{on:"lens",place:u.place,...u.kind?{kind:u.kind}:{}}})},style:G,children:u.fit==="full"?`Open ${u.title}`:`Open and adjust ${u.title}`})},u.place)),c?(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":"ai-panel",onClick:()=>v(async u=>$(await re(t,"panel",i,"Draw a panel",u))),style:G,children:d.length>0?"Draw a new view":"Draw a panel"})}):null,(0,x.jsx)("li",{children:(0,x.jsx)("button",{type:"button","data-menu-item":"ai-ask",onClick:()=>{let u=document.activeElement;n(),ce(t.desk,{target:i,returnTo:u instanceof HTMLElement&&u!==document.body?u:null})},style:G,children:"Ask about this\u2026"})})]})]})}var be={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 10px",fontSize:"0.8125rem",borderRadius:8};function Zn({placement:e="picture"}){let{store:n,principal:t,aiDesk:i}=Je(),o=Le(n,t),{ghost:s,entries:c}=He(i),[d,l]=(0,I.useState)(new Set);(0,I.useEffect)(()=>l(new Set),[s?.ghost.interaction]);let p=(0,I.useRef)(null),a=(0,I.useRef)(null),f=s?.batch;if((0,I.useEffect)(()=>{f!==void 0&&a.current?.focus()},[f]),!s)return null;let{ghost:h}=s,b=c.find(g=>g.id===h.interaction),P=()=>{let g=h.target.on==="record"||h.target.on==="field"?h.target.id:void 0,A=p.current?.closest("[data-graview-face], main")?.parentElement??document,w=(g?A.querySelector(`[data-graview-view="${CSS.escape(g)}"][tabindex]`):null)??document.querySelector("[data-graview-page-title]")??p.current?.closest("main")??document.querySelector("main");w&&!w.hasAttribute("tabindex")&&w.setAttribute("tabindex","-1"),w?.focus({preventScroll:!0}),i.setGhost(null)},S=h.proposals.filter(g=>!d.has(g.id)).map(g=>g.id),m=()=>{let g=Xe(o,h,{author:t,ids:S});if(!g.ok){i.setGhost({...s,refused:g.refused});return}b&&i.record(Ze(b,g.accepted,g.batch)),i.setGhost({ghost:h,batch:g.batch,took:g.accepted.length,...s.onCard?{onCard:!0}:{}})},C=()=>{b&&s.batch===void 0&&i.record(en(b)),P()},k=()=>{if(s.batch!==void 0)try{o.undo(s.batch,{author:t}),P()}catch(g){i.setGhost({...s,refused:g instanceof Error?g.message:String(g)})}};return(0,x.jsxs)("section",{ref:p,"data-testid":"ai-ghost","data-interaction":h.interaction,"aria-label":"Proposed by AI",style:{...e==="card"?{position:"static"}:{position:e==="page"?"fixed":"absolute",insetInline:"max(12px, calc(50% - 220px))",bottom:"calc(var(--graview-foot-room, 0px) + 72px)",zIndex:De("toast"),boxShadow:"var(--graview-lift-high)"},display:"grid",gap:8,padding:12,borderRadius:12,border:"1px dashed var(--graview-accent)",background:"var(--graview-float)",fontSize:"0.875rem"},children:[(0,x.jsx)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:s.batch!==void 0?`Done: ${s.took===1?"one change":`${s.took} changes`}, as one.`:`Proposed by AI \xB7 ${h.basis}`}),s.batch===void 0?(0,x.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:h.proposals.map(g=>(0,x.jsx)("li",{"data-ghost-proposal":g.id,children:(0,x.jsxs)("label",{style:{display:"flex",alignItems:"baseline",gap:8,cursor:"pointer"},children:[(0,x.jsx)("input",{type:"checkbox",checked:!d.has(g.id),onChange:A=>{let w=new Set(d);A.target.checked?w.delete(g.id):w.add(g.id),l(w)}}),(0,x.jsx)("span",{style:{fontStyle:"italic",color:"var(--graview-ink)"},children:g.said}),g.confidence!==void 0?(0,x.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[Math.round(g.confidence*100),"% sure"]}):null]})},g.id))}):null,s.refused?(0,x.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-warn)"},children:s.refused}):null,(0,x.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.batch===void 0?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("button",{type:"button","data-testid":"ghost-accept",disabled:S.length===0,onClick:m,style:be,children:S.length===h.proposals.length?"Accept":`Accept ${S.length} of ${h.proposals.length}`}),(0,x.jsx)("button",{type:"button","data-testid":"ghost-dismiss",onClick:C,style:be,children:"Dismiss"})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("button",{type:"button",ref:a,"data-testid":"ghost-undo",onClick:k,style:be,children:"Undo"}),(0,x.jsx)("button",{type:"button","data-testid":"ghost-close",onClick:P,style:be,children:"Close"})]})})]})}export{Ge as a,V as b,ye as c,ze as d,ee as e,ve as f,hn as g,mn as h,Fn as i,Jn as j,tn as k,on as l,re as m,Cn as n,$n as o,Pn as p,Yn as q,Xn as r,Zn as s};