graview 0.1.45 → 0.1.46

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 (98) hide show
  1. package/dist/preview/{chunk.2YABX3SC.js → chunk.3MMLRSRC.js} +1 -1
  2. package/dist/preview/{chunk.FOFLD64U.js → chunk.3OSGN463.js} +1 -1
  3. package/dist/preview/{chunk.E37V2EJM.js → chunk.3VFYSXMQ.js} +1 -1
  4. package/dist/preview/chunk.4OGOTHRD.js +1 -0
  5. package/dist/preview/{chunk.W2RCWPLK.js → chunk.4Y6VGQVQ.js} +1 -1
  6. package/dist/preview/{chunk.JDMXZFSG.js → chunk.5ESCD57M.js} +1 -1
  7. package/dist/preview/{chunk.F6HMZL65.js → chunk.5K6KX3UC.js} +1 -1
  8. package/dist/preview/{chunk.L24FCXZ7.js → chunk.6BDM2XRX.js} +1 -1
  9. package/dist/preview/{chunk.JR7RDOEP.js → chunk.6OPI4WWO.js} +1 -1
  10. package/dist/preview/{chunk.FPASZ4RD.js → chunk.6QYJ2K6K.js} +1 -1
  11. package/dist/preview/{chunk.UY7IOVR6.js → chunk.6SOUQNXR.js} +1 -1
  12. package/dist/preview/{chunk.BGYY55VO.js → chunk.6WA6ASQB.js} +1 -1
  13. package/dist/preview/chunk.6YD2DLIC.js +1 -0
  14. package/dist/preview/{chunk.E4G6DXSB.js → chunk.A5VGTO3E.js} +1 -1
  15. package/dist/preview/{chunk.CBUSFM3E.js → chunk.AGIO2GRV.js} +29 -7
  16. package/dist/preview/{chunk.C2UFMFJ3.js → chunk.AQQZY6OY.js} +1 -1
  17. package/dist/preview/{chunk.EAUVEVVO.js → chunk.ATDU5Y7V.js} +1 -1
  18. package/dist/preview/{chunk.5EDA3JHU.js → chunk.AYA7SYIU.js} +1 -1
  19. package/dist/preview/{chunk.FTM64IDI.js → chunk.BAMPYMUE.js} +1 -1
  20. package/dist/preview/{chunk.ZJ2VS4M4.js → chunk.BCWPV4WR.js} +1 -1
  21. package/dist/preview/{chunk.4XOWRYRU.js → chunk.BFKV4GKP.js} +6 -6
  22. package/dist/preview/{chunk.W44VRHKS.js → chunk.CICGAEBW.js} +2 -2
  23. package/dist/preview/{chunk.DQHPEKWK.js → chunk.DEUTHHGI.js} +1 -1
  24. package/dist/preview/{chunk.KBHU54NM.js → chunk.EAJB2PJZ.js} +1 -1
  25. package/dist/preview/{chunk.LSLLKICK.js → chunk.EPUBSKKL.js} +1 -1
  26. package/dist/preview/{chunk.6USUVORO.js → chunk.F37DHXA2.js} +1 -1
  27. package/dist/preview/{chunk.BS2SJC2P.js → chunk.F5PBK4TF.js} +2 -2
  28. package/dist/preview/{chunk.EVW5YY3W.js → chunk.FGR7KCI6.js} +1 -1
  29. package/dist/preview/{chunk.6SWW6KEV.js → chunk.FO5BOBYV.js} +1 -1
  30. package/dist/preview/{chunk.II7VTGNC.js → chunk.FVOJCVRX.js} +1 -1
  31. package/dist/preview/{chunk.T7XH7FVJ.js → chunk.FXTBMW3S.js} +1 -1
  32. package/dist/preview/{chunk.7ZRFXI73.js → chunk.HBD7FBZS.js} +1 -1
  33. package/dist/preview/chunk.HZCA3UWJ.js +1 -0
  34. package/dist/preview/{chunk.6SJA4FSW.js → chunk.I3GP5JW7.js} +1 -1
  35. package/dist/preview/{chunk.L3FOLN3K.js → chunk.IJABD7SI.js} +1 -1
  36. package/dist/preview/{chunk.HWCHFQ7O.js → chunk.ITYQUSZI.js} +1 -1
  37. package/dist/preview/chunk.JF3GD4H5.js +50 -0
  38. package/dist/preview/{chunk.7KVWV577.js → chunk.JLIUUFK2.js} +1 -1
  39. package/dist/preview/{chunk.GER2XRD4.js → chunk.JNIGZEOF.js} +1 -1
  40. package/dist/preview/{chunk.CSDERNQV.js → chunk.JQLR6KO2.js} +1 -1
  41. package/dist/preview/{chunk.FHZBXMXR.js → chunk.JT3IZIU5.js} +1 -1
  42. package/dist/preview/{chunk.OF34OZ4V.js → chunk.KSXB4LDF.js} +1 -1
  43. package/dist/preview/{chunk.LEO2KWLZ.js → chunk.LETJC5TD.js} +1 -1
  44. package/dist/preview/{chunk.5O5IJVLN.js → chunk.LKN734RR.js} +1 -1
  45. package/dist/preview/{chunk.HGTPTRMM.js → chunk.LKVXSC5O.js} +1 -1
  46. package/dist/preview/{chunk.ICGNIK3Z.js → chunk.LUNATPAB.js} +2 -2
  47. package/dist/preview/{chunk.VSAPJAT3.js → chunk.LVEFQLGQ.js} +1 -1
  48. package/dist/preview/{chunk.KUUDW7VR.js → chunk.MWONSI3P.js} +1 -1
  49. package/dist/preview/{chunk.WPOTEXJZ.js → chunk.N7VNEUJR.js} +1 -1
  50. package/dist/preview/{chunk.FF6DBQMB.js → chunk.NGIPVTTE.js} +1 -1
  51. package/dist/preview/{chunk.2LKMNEWZ.js → chunk.NITU5H4J.js} +1 -1
  52. package/dist/preview/{chunk.DLFWBG33.js → chunk.NWA7Q6CI.js} +1 -1
  53. package/dist/preview/{chunk.L3FQZCWI.js → chunk.O24DD2VF.js} +1 -1
  54. package/dist/preview/{chunk.V5FIZIX2.js → chunk.OHSJQYJN.js} +1 -1
  55. package/dist/preview/chunk.ONEYVLC2.js +1 -0
  56. package/dist/preview/{chunk.URXSZQSF.js → chunk.P4O5DGLN.js} +1 -1
  57. package/dist/preview/{chunk.JSSFA3FC.js → chunk.PC6PID5X.js} +1 -1
  58. package/dist/preview/{chunk.5B2LH2SR.js → chunk.PLWVLW22.js} +1 -1
  59. package/dist/preview/{chunk.3NMINX5Z.js → chunk.R4OU7O6C.js} +1 -1
  60. package/dist/preview/{chunk.UM7GWXEW.js → chunk.RNBPDB37.js} +1 -1
  61. package/dist/preview/{chunk.ICCIZDTQ.js → chunk.RTI3FEDD.js} +1 -1
  62. package/dist/preview/{chunk.TBSNNOQU.js → chunk.RZXPBOGT.js} +1 -1
  63. package/dist/preview/{chunk.6KWFTSK4.js → chunk.SL2FZ54V.js} +1 -1
  64. package/dist/preview/{chunk.SDU76JU6.js → chunk.SS27NH5O.js} +1 -1
  65. package/dist/preview/{chunk.QPCSS322.js → chunk.T7O6K3IN.js} +1 -1
  66. package/dist/preview/{chunk.TOXWNEOQ.js → chunk.TFVFJFXC.js} +2 -2
  67. package/dist/preview/{chunk.2EFH63WS.js → chunk.TOZJZXWQ.js} +1 -1
  68. package/dist/preview/{chunk.ZEAH57AZ.js → chunk.UOXFALRL.js} +1 -1
  69. package/dist/preview/{chunk.K6KMLD2B.js → chunk.UPQZU7UO.js} +1 -1
  70. package/dist/preview/{chunk.ZBR2QY67.js → chunk.UR3XYOQ6.js} +1 -1
  71. package/dist/preview/{chunk.RPX35VYU.js → chunk.URO2EGY7.js} +1 -1
  72. package/dist/preview/{chunk.XMCFZD3A.js → chunk.UVNVDLV5.js} +1 -1
  73. package/dist/preview/chunk.V3QUTJR2.js +2 -0
  74. package/dist/preview/{chunk.SGKPGVBB.js → chunk.V5Z2OED6.js} +1 -1
  75. package/dist/preview/{chunk.FCAYURB4.js → chunk.VAFSSSSI.js} +1 -1
  76. package/dist/preview/{chunk.3HSPWSAI.js → chunk.VBPK6ARF.js} +1 -1
  77. package/dist/preview/{chunk.GIYFEGAP.js → chunk.VDVJCLGS.js} +1 -1
  78. package/dist/preview/{chunk.6X3G3PWL.js → chunk.W45NKVSV.js} +1 -1
  79. package/dist/preview/{chunk.66JF3UMG.js → chunk.WO3DDFFY.js} +1 -1
  80. package/dist/preview/{chunk.RYRTKIKB.js → chunk.WP5W44Y4.js} +1 -1
  81. package/dist/preview/{chunk.UJKT2G6M.js → chunk.WQONZBA3.js} +2 -2
  82. package/dist/preview/{chunk.GFLAGZSB.js → chunk.X233NILF.js} +1 -1
  83. package/dist/preview/{chunk.PRD3UNJX.js → chunk.X25KXCWI.js} +1 -1
  84. package/dist/preview/{chunk.6BJBPDF3.js → chunk.XSNAG4JT.js} +14 -4
  85. package/dist/preview/chunk.XXDBZQNY.js +18 -0
  86. package/dist/preview/{chunk.LNG3CQNI.js → chunk.Z5IGHCZX.js} +1 -1
  87. package/dist/preview/chunk.ZIEHF67C.js +1 -0
  88. package/dist/preview/index.html +27 -27
  89. package/dist/preview/page.js +2 -2
  90. package/package.json +6 -6
  91. package/dist/preview/chunk.B6KT6BTG.js +0 -49
  92. package/dist/preview/chunk.HZGVEHEN.js +0 -1
  93. package/dist/preview/chunk.J7G3AATY.js +0 -14
  94. package/dist/preview/chunk.K46YRA65.js +0 -1
  95. package/dist/preview/chunk.MGWMGLWE.js +0 -1
  96. package/dist/preview/chunk.OMZ3LDDN.js +0 -1
  97. package/dist/preview/chunk.OYHQSXNC.js +0 -1
  98. package/dist/preview/chunk.SZ34UAQ3.js +0 -2
@@ -1,2 +1,2 @@
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 Ct,b as _n,c as Wn,d as jn,e as qn,f as Lt,g as zn,h as Mt}from"./chunk.E37V2EJM.js";import{a as Ir}from"./chunk.FHZBXMXR.js";import{a as Vt,b as Un,c as Kn,d as Jn,e as Bt,f as Yn,g as Qn,h as Zn,i as Xn,j as er,k as tr,l as nr,m as rr,n as We}from"./chunk.F6HMZL65.js";import{b as Gn}from"./chunk.S5MQVPLF.js";import{a as kt}from"./chunk.Q5WEOX3Q.js";import{a as Et,g as bn}from"./chunk.MGWMGLWE.js";import{k as tt}from"./chunk.KWQ7QOHD.js";import{C as Dn,H as Nn,L as $n,M as In,j as $r,k as Mn,n as ot,o as Vn,q as Bn,u as Hn,z as at}from"./chunk.6BJBPDF3.js";import{Ca as rt,G as Ft,R as En,W as Pn,a as Sn,b as Tt,c as nt,da as An,ea as Rn,j as kn,m as xt,qa as Tn,ra as xn,sa as Fn,ta as On,va as Cn,wa as Ot,za as Ln}from"./chunk.XWAMQPUM.js";import{a as be}from"./chunk.SDO3U72B.js";import{Mc as pn,Oc as mn,Pc as hn,Rc as et,Ub as Pt,Vb as un,ib as _e,jb as Xe,ld as ve,md as yn,nd as gn,sd as wn,td as At,vb as ln,wd as vn,xd as Rt,yc as fn}from"./chunk.AS4CQBOQ.js";import"./chunk.2AZTW66C.js";import{b as Te}from"./chunk.AJZBJBMO.js";async function it(e,n={}){let o=e.compiled===void 0||!Wr(e.compiled,e.document)?void 0:bn(e.compiled,n);if(o?.ok)return o;let{compileDocumentWithoutCheck:a}=await _r();return a(e.document,n)}var or,_r=()=>or??=(__graviewPreload(import.meta.url,["./chunk.OMZ3LDDN.js","./chunk.MGWMGLWE.js","./chunk.IKX4VDTW.js","./chunk.TBQOSI4J.js","./chunk.KWQ7QOHD.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.5EDA3JHU.js")).catch(e=>{throw or=void 0,e});function Wr(e,n){let o=typeof e=="object"&&e!==null?e.document:void 0,a=n;if(typeof a=="string")try{a=JSON.parse(a)}catch{return!1}return o!==void 0&&kt(Et(o).document)===kt(Et(a).document)}var c=Te(Ft(),1);var dt=Te(Ft(),1),Ht="data-graview-drawn",jr=200,ar=50,qr=1e4,st=()=>typeof performance<"u"?performance.now():Date.now();function zr(e){let n=[...e.querySelectorAll("img")];for(let o of e.querySelectorAll("[data-worker-view]"))o.shadowRoot&&n.push(...o.shadowRoot.querySelectorAll("img"));return n}function Gr(e){if(e.ownerDocument.fonts?.status==="loading"||xn()>0||e.querySelector('[aria-busy="true"]')||zr(e).some(o=>!o.complete&&o.loading!=="lazy"))return!1;for(let o of e.querySelectorAll("[data-worker-view-place]"))if(!o.querySelector("[data-worker-view][data-worker-view-drawn], [data-worker-view][data-worker-view-failed]"))return!1;return!0}function ir(e){let n=e.querySelector("[data-embed-content]"),o=[...e.querySelectorAll("[data-worker-view]")].map(a=>`${a.offsetWidth}x${a.offsetHeight}`);return`${e.scrollWidth}x${e.scrollHeight}|${n?`${n.scrollWidth}x${n.scrollHeight}`:""}|${o.join(",")}`}function Ur(e,n,o){e.removeAttribute(Ht);let a=e.ownerDocument.defaultView;if(!a)return()=>{};let d=st(),l=d,b=ir(e),p=!1,g,P=typeof MutationObserver>"u"?void 0:new MutationObserver(R=>{R.some(v=>!(v.target===e&&v.attributeName===Ht))&&(l=st())});P?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let A=()=>{p=!0,P?.disconnect(),g!==void 0&&clearTimeout(g)},k=R=>{let v=!1,ne=()=>{v||(v=!0,R())};typeof a.requestAnimationFrame=="function"&&a.requestAnimationFrame(()=>setTimeout(ne,0)),setTimeout(ne,100)},S=()=>{if(p)return;let R=ir(e);R!==b&&(b=R,l=st());let v=st();if(Gr(e)&&v-l>=jr||v-d>=qr){k(()=>{p||(A(),e.setAttribute(Ht,n),On(),o())});return}g=setTimeout(S,ar)};return g=setTimeout(S,ar),A}function sr(e,n,o,a){Fn();let d=(0,dt.useRef)({place:o,onDrawn:a});d.current={place:o,onDrawn:a},(0,dt.useLayoutEffect)(()=>{let l=g=>Ur(g,d.current.place.path,()=>d.current.onDrawn?.(d.current.place));if(e.current)return l(e.current);let b,p=!1;return queueMicrotask(()=>{!p&&e.current&&(b=l(e.current))}),()=>{p=!0,b?.()}},[n,e])}var pe=Te(Ft(),1),je,Kr=be(()=>(__graviewPreload(import.meta.url,["./chunk.3NMINX5Z.js","./chunk.XXEYRHRG.js","./chunk.55D33E5A.js","./chunk.2JJYGYT2.js","./chunk.NMIXBH37.js","./chunk.XWAMQPUM.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.2LKMNEWZ.js"))),dr=()=>Kr().then(e=>void(je=e),()=>new Promise(e=>setTimeout(e,2e3)).then(dr)),Dt=Tn(dr),cr=e=>!!e&&je===void 0;function Nt({onReady:e,fetch:n}){return(0,pe.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var Jr=0;function lr(e){let[n,o]=(0,pe.useState)(()=>je);(0,pe.useEffect)(()=>{if(!e||n)return;let l=!1;return Dt().then(()=>{l||o(je)}),()=>{l=!0}},[e,n]);let a=(0,pe.useMemo)(()=>Jr+=1,[e]);return{over:(0,pe.useMemo)(()=>{let l=n??je;if(!e||!l)return;let{source:b,worker:p,...g}=e,P={...g,worker:p??{source:b},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:A=>l.registerWorkerView(A,P)}},[e,n]),n:a}}var pr=Te(Ir(),1),W=Te($r(),1);var y=Te(En(),1);function ct(e,n={}){let o=Ot(e);return{Face:o.part((d,l)=>(0,c.createElement)(d,l),n),fetch:()=>o.load().then(()=>{}),here:()=>o.current!==void 0||o.failed}}var _t=e=>Promise.all([e,$n()]).then(([n])=>n),mr=be(()=>(__graviewPreload(import.meta.url,["./chunk.DLFWBG33.js","./chunk.M5GJHVWZ.js","./chunk.WSTBCWW7.js","./chunk.CBUSFM3E.js","./chunk.NIVTK2W5.js","./chunk.HJCQ6I3S.js","./chunk.BNPQUI3F.js","./chunk.6RY6OSE6.js","./chunk.UY7IOVR6.js","./chunk.2YABX3SC.js","./chunk.64WM4IBI.js","./chunk.JDMXZFSG.js","./chunk.DQOCBKC3.js","./chunk.DQHPEKWK.js","./chunk.EAUVEVVO.js","./chunk.PKUDIWIF.js","./chunk.VW2VCPJX.js","./chunk.WBHM5I3I.js","./chunk.VC3BX2ZF.js","./chunk.UKAPFIPJ.js","./chunk.UT6642FC.js","./chunk.F6HMZL65.js","./chunk.S5MQVPLF.js","./chunk.TI4OSTQV.js","./chunk.Q7RQC3F7.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.TOXWNEOQ.js"))),Yr=be(()=>(__graviewPreload(import.meta.url,["./chunk.J7G3AATY.js","./chunk.B6KT6BTG.js","./chunk.ZBR2QY67.js","./chunk.K46YRA65.js","./chunk.UJKT2G6M.js","./chunk.UGFDSE37.js","./chunk.DLFWBG33.js","./chunk.RYRTKIKB.js","./chunk.M5GJHVWZ.js","./chunk.HZGVEHEN.js","./chunk.JBW3DI7E.js","./chunk.CBUSFM3E.js","./chunk.NIVTK2W5.js","./chunk.PXQVXBNG.js","./chunk.FPASZ4RD.js","./chunk.2YABX3SC.js","./chunk.DQOCBKC3.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.UKAPFIPJ.js","./chunk.UT6642FC.js","./chunk.IW7YFPGG.js","./chunk.MB7LKKUD.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.CSDERNQV.js"))),Qr=be(()=>(__graviewPreload(import.meta.url,["./chunk.J7G3AATY.js","./chunk.B6KT6BTG.js","./chunk.ZBR2QY67.js","./chunk.K46YRA65.js","./chunk.UJKT2G6M.js","./chunk.UGFDSE37.js","./chunk.DLFWBG33.js","./chunk.RYRTKIKB.js","./chunk.M5GJHVWZ.js","./chunk.HZGVEHEN.js","./chunk.JBW3DI7E.js","./chunk.CBUSFM3E.js","./chunk.NIVTK2W5.js","./chunk.PXQVXBNG.js","./chunk.FPASZ4RD.js","./chunk.2YABX3SC.js","./chunk.DQOCBKC3.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.UKAPFIPJ.js","./chunk.UT6642FC.js","./chunk.IW7YFPGG.js","./chunk.MB7LKKUD.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.6SWW6KEV.js"))),hr=ct(()=>_t(mr().then(e=>e.SceneFace)),{what:"This view"}),yr=ct(()=>mr().then(e=>e.SceneKeeping),{quiet:!0}),gr=ct(()=>_t(Yr().then(e=>e.PagesContent)),{what:"This page"}),wr=ct(()=>_t(Qr().then(e=>e.PictureFace)),{what:"This picture"}),Zr=hr.Face,Xr=yr.Face,eo=gr.Face,to=wr.Face;function xe(...e){let n=e.length>0?e:["scene","pages","picture"],o=new Set(n.flatMap(vr));return Promise.all([...[...o].map(a=>a.fetch()),Bn()]).then(()=>{},()=>{})}var vr=e=>e==="pages"?[gr]:e==="picture"?[wr]:[hr,yr],br=e=>vr(e).every(n=>n.here()),no=150,$t=0;function ur(e,n){if(br(e))return n();let o=++$t,a=()=>{o===$t&&($t+=1,n())};xe(e).then(a),setTimeout(a,no)}var ro=768;function oo(e,n){let o=n!==null&&n>=ro;(0,c.useEffect)(()=>{if(!o||e==="picture")return;let a=e==="pages"?"scene":"pages";if(br(a))return;let d=globalThis,l=()=>void xe(a),b=()=>{},p=Cn(()=>{if(d.requestIdleCallback&&d.cancelIdleCallback){let g=d.requestIdleCallback(l,{timeout:4e3});b=()=>d.cancelIdleCallback?.(g)}else{let g=setTimeout(l,1500);b=()=>clearTimeout(g)}});return()=>(p(),b())},[e,o])}function ao({asked:e,shown:n,onDrawn:o}){return(0,c.useLayoutEffect)(()=>o(e,n),[e,n,o]),null}function io({auto:e,scene:n}){return(0,y.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${Bt}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var so=Ot(be(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,y.jsx)(e.StudioPlace,{...n}),{quiet:!0});function Sr(e,n,o,a,d){return Lt(e,qn(n?nt(n):d??Sn,a),o)}function Wt(e){return e&&nt(e).overview?"graview":"scene"}function fr(e,n){if(n.homeView?.()===void 0)return!1;let o=e.pages?.first?.trim();return o===void 0||o===""||o==="/"||o.toLowerCase()==="home"}function kr(e){let[,n]=(0,c.useState)(!1),o=(0,c.useCallback)(()=>n(!0),[]),a=(0,c.useRef)(!1);return e.at&&!lt?(0,y.jsx)(Nt,{onReady:o,fetch:jt}):!a.current&&cr(e.draftView)?(0,y.jsx)(Nt,{onReady:o,fetch:Dt}):(a.current=!0,(0,y.jsx)(co,{...e}))}function co(e){let{app:n,stop:o,bar:a=!0,standing:d="Everything is in order",principal:l,heading:b=2}=e,{rootRef:p,scope:g,css:P,scheme:A,store:k,presence:S,brand:R,auto:v,height:ne}=Yn(e),ke=lr(e.draftView),L=Kn(e,In,ke.over),Z=e.basePath===void 0?{}:{basePath:e.basePath},[f]=(0,c.useState)(ot),C=e.notices??f,N=m=>wn(m,Z),re={...e.routing?{routing:e.routing}:{},...Z},[T]=(0,c.useState)(()=>{let m=e.at?.face;if(m)return m;let _=o===void 0&&fr(n,L)?"pages":Wt(o),ue=Ct({...re,face:_});return e.face===void 0&&e.onOpening?.(ue),ue}),[oe,z]=(0,c.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&o===void 0&&_n(re)&&fr(n,L)),x=(0,c.useRef)(e.onFace);x.current=e.onFace,(0,c.useLayoutEffect)(()=>{oe&&(x.current?.("pages"),z(!1))},[oe]);let F=oe?"pages":e.face??T,M=n.schema.kinds,O=e.routing==="address",V=(0,c.useMemo)(()=>e.at?lt.settleAt(e,k.seenBy(l??{kind:"human"}),L.places()):void 0,[]),U=(0,c.useMemo)(()=>Rn(L,n.schema),[L,n.schema]),G=(0,c.useMemo)(()=>{let m=V?.stop??(O?Wn(e.basePath):void 0)??o;return F==="scene"&&m===void 0&&U===void 0&&(e.path===void 0||It(e.path))?Mt(void 0):Sr(F,m,M,L.places(),U)},[]),[ie]=(0,c.useState)(F);(0,c.useEffect)(()=>{ie!=="pages"&&An(L)},[ie,L]);let $=(0,c.useRef)(void 0),he=m=>m===void 0||It(m)?"/":m;$.current??={path:he(V?.path??(O?F==="pages"?(At(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==$.current.asked&&($.current={path:he(e.path),asked:e.path});let B=(0,c.useRef)(e.onNavigate);B.current=e.onNavigate;let K=(0,c.useCallback)((m,_)=>{$.current.path=m,B.current?.(m,_)},[]),{at:ae,setAt:H,steering:ye,steer:X}=tr($.current.path),j=(0,c.useContext)(Er);j&&(j.pages=()=>$.current.path);let q=(0,c.useRef)(void 0),Oe=(0,c.useCallback)(m=>void($.current.path=m),[]),J=Mn(p),[Ee,Y]=(0,c.useState)(!1),ze=e.pagesBelow!==void 0&&J!==null&&J<e.pagesBelow&&(F==="scene"||F==="graview")&&!Ee,E=ze?"pages":F,Ce=(0,c.useRef)(!1);Ce.current=Ee&&e.pagesBelow!==void 0&&J!==null&&J<e.pagesBelow&&(F==="scene"||F==="graview"),j&&(j.shown=E);let ce=(0,c.useRef)(F==="graview"?"graview":"scene");(E==="scene"||E==="graview")&&(ce.current=E),(0,c.useState)(()=>{if(!O||typeof window>"u"||E==="pages"||E==="picture")return;let{pathname:m,search:_,hash:ue}=window.location;At(m,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${N(ve)}${_}${ue}`)}),Jn(p,E,e.onIntrinsicHeight),oo(E,J);let se=nr(e.onError,E),Pe=rr(e.onReady,E),Ne=(0,c.useRef)(e.onFaceDrawn);Ne.current=e.onFaceDrawn;let Le=(0,c.useCallback)((m,_)=>{Pe(_),Ne.current?.(m)},[Pe]),[pt,mt]=(0,c.useState)(null),Ge=L.places(),I=(0,c.useRef)({shown:E,onFace:e.onFace});I.current={shown:E,onFace:e.onFace};let ee=(0,c.useCallback)((m,_,ue)=>{if(O){q.current?.(m,_,ue);return}I.current.onFace?.(m),B.current?.(m==="pages"?_??$.current.path:ve,"push")},[O]),[te,Ae]=(0,c.useState)(void 0);(0,c.useEffect)(()=>{E==="pages"&&Ae(void 0)},[E]);let ge=(0,c.useRef)(o);(0,c.useEffect)(()=>{ge.current!==o&&(ge.current=o,Ae(void 0))},[o]);let Ue=(0,c.useCallback)(m=>{if(I.current.shown==="pages"){if(Y(!0),Ae(m),F==="scene"||F==="graview"){ur(F,()=>{O?window.history.pushState(null,"",`${N(ve)}${m??""}`):B.current?.(ve,"push")});return}ur(ce.current,()=>ee(ce.current,void 0,m))}},[O,F,e.basePath,ee]),Me=(0,c.useCallback)(m=>{if(I.current.shown==="pages"){ye.go.current||($.current.path=m),X(m);return}if($.current.path=m,H(m),Ce.current){Y(!1),O?window.history.pushState(null,"",N(m)):B.current?.(m,"push");return}ee("pages",m)},[ye,X,H,ee,O,e.basePath]),Re=L.arrangement?.(),le=E==="pages",Ve=O?N:void 0;return(0,y.jsxs)("section",{ref:p,className:g,"aria-label":e.label??n.name,"data-graview-embed":E,"data-graview-scheme":A,...ze?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:ne,minHeight:v?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,y.jsx)("style",{children:P}),(0,y.jsxs)(Ln.Provider,{value:se,children:[(0,y.jsx)(Qn,{rootRef:p,board:C}),(0,y.jsx)(Un,{rootRef:p,firstLook:e.firstLook,app:Dn(R??{name:n.name},n.schema)}),(0,y.jsx)(We,{module:"@graview/react",report:se,content:!0,children:(0,y.jsx)(Pn,{store:k,views:L,initialView:G,scheme:A,...Zn(e,S,R),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,y.jsxs)(Vn.Provider,{value:C,children:[(0,y.jsx)(po,{face:E,stop:te??o,kinds:M,places:Ge,opens:U}),j?(0,y.jsx)(lo,{into:j}):null,(0,y.jsx)(uo,{rootRef:p,face:F,shown:E,path:ae,stop:o,draft:ke.n,onDrawn:e.onDrawn}),O?(0,y.jsx)(jn,{pagesWere:V?.path,basePath:e.basePath,shown:E,onFace:e.onFace,toggle:q,kinds:M,places:Ge,opens:U,landed:Oe}):null,a&&E!=="picture"?(0,y.jsx)(We,{module:"@graview/embed",report:se,children:(0,y.jsx)(Xn,{name:R?.name??n.name,heading:b,named:Vt(a).name!==!1,faces:Vt(a).faces===!1?void 0:{scene:{label:yn(Re),current:!le,go:()=>Ue(),reach:()=>void xe(ce.current)},pages:{label:gn(Re),current:le,go:()=>Me($.current.path),reach:()=>void xe("pages")}},at:le?ae:null,without:e.pages?.without(),home:{...Ve?{href:Ve("/")}:{},go:()=>Me("/"),current:le&&ae.split("?")[0]==="/"},reach:{...Ve?{href:Ve}:{},go:m=>Me(m.path)},standing:d,hostActions:e.hostActions,keeping:le?void 0:(0,y.jsx)(mo,{app:n,studio:e.studio,report:se}),onFind:mt,switch:e.switch})}):null,(0,y.jsx)(Hn.Provider,{value:pt,children:(0,y.jsx)(We,{module:E==="pages"||E==="picture"?"@graview/pages":"@graview/react",report:se,content:!0,children:(0,y.jsxs)(c.Suspense,{fallback:(0,y.jsx)(io,{auto:v,scene:E!=="pages"&&E!=="picture"}),children:[E==="picture"?(0,y.jsx)(to,{scope:g,store:k,views:L,as:(o?nt(o).within?.view:void 0)??""}):E==="pages"?(0,y.jsx)(eo,{store:k,views:L,presence:S,auto:v,brand:R,steering:ye,overview:Ue,scope:g,titleLevel:er(b),quickAsk:at(e.quickAsk),props:{...e,onNavigate:K,...O?{}:{path:$.current.path}}}):(0,y.jsx)(Zr,{address:O,auto:v,scheme:A,scope:g,quickAsk:at(e.quickAsk)}),(0,y.jsx)(ao,{asked:F,shown:E,onDrawn:Le})]})},E)})]})})})]})]})}var It=e=>e.split(/[?#]/)[0]===ve,Er=(0,c.createContext)(null);function lo({into:e}){return e.view=rt().view,null}function uo({rootRef:e,face:n,shown:o,path:a,stop:d,draft:l,onDrawn:b}){let{view:p}=rt(),g=o==="scene"||o==="graview",P=Tt(p),A={face:n,path:g?ve:o==="picture"?d??"#":a,stop:P};return sr(e,`${o} ${g?P:A.path} ${l}`,A,b),null}var lt,fo=be(()=>(__graviewPreload(import.meta.url,["./chunk.E37V2EJM.js","./chunk.6BJBPDF3.js","./chunk.XWAMQPUM.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.LNG3CQNI.js"))),jt=()=>fo().then(e=>void(lt=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(o),e()},o=setTimeout(n,1e4);window.addEventListener("online",n)}).then(jt));function po({face:e,stop:n,kinds:o,places:a,opens:d}){let{view:l,go:b}=rt(),p=(0,c.useRef)({face:e,stop:n});return(0,c.useLayoutEffect)(()=>{let g=p.current.stop!==n,P=p.current.face!==e,A=p.current.face==="pages";if(p.current={face:e,stop:n},!g&&!P||e==="pages"||e==="picture")return;let k=(g||A)&&n!==void 0?Sr(e,n,o,a):A&&zn(l)?Lt(e,Mt(d),o):e==="graview"?xt(l,!0):l.overview?kn(xt(l,!1),Nn(l,o)):l;b(k)},[e,n,o,l,b,d]),null}function mo({app:e,studio:n,report:o}){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.Suspense,{fallback:null,children:(0,y.jsx)(Xr,{})}),n!==!1?(0,y.jsx)(We,{module:"@graview/studio",report:o,children:(0,y.jsx)(ho,{app:e,studio:n})}):null]})}function ho({app:e,studio:n}){let o={app:e,within:"box",...n?{onApply:n.onApply}:{},...n?.landmark?{landmark:n.landmark}:{},...n?.offered!==void 0?{offered:n.offered}:{}},a=n?.place;return a?(0,y.jsx)(a,{...o}):(0,y.jsx)(c.Suspense,{fallback:null,children:(0,y.jsx)(so,{...o})})}function yo({path:e,stop:n,...o},a){return{...o,app:a.app,at:a.at,...a.remote.presence?{presence:a.remote.presence}:{}}}function qt(e,n){let o=n.store??n.remote?.store??Gn(n.app,n.seed),a=n.notices??ot(),d=null,l={},b=0,p=n.label,g=n.app,P=Promise.resolve(),A=n.at?.face??n.face,k=A===void 0?void 0:Ct({...n,face:A}),S=k??Wt(n.stop),R=null,v=[],ne=f=>{if(R=f,f!==S)return;let C=v;v=[];for(let N of C)N()};function ke(){let[f,C]=(0,c.useState)(k),[N,re]=(0,c.useState)(n.stop),[T,oe]=(0,c.useState)(n.path),[z,x]=(0,c.useState)(n.scheme??"auto"),[F,M]=(0,c.useState)(n.principal),[O,V]=(0,c.useState)(n.seats),[U,G]=(0,c.useState)(n.quickAsk),[ie,$]=(0,c.useState)(n.people),[he,B]=(0,c.useState)(n.hostContext),[K,ae]=(0,c.useState)(n.brand),[H,ye]=(0,c.useState)(n.label),[X,j]=(0,c.useState)(n.hostActions),[q,Oe]=(0,c.useState)(void 0),[J,Ee]=(0,c.useState)(n.draftView);return d={app:Y=>{Oe(Y),oe(void 0),re(void 0)},face:C,stop:re,path:oe,scheme:x,seat:M,seats:V,quickAsk:G,people:$,hostContext:B,brand:ae,label:ye,hostActions:j,draft:Ee},(0,y.jsx)(Er.Provider,{value:l,children:(0,y.jsx)(kr,{...q?yo(n,q):n,store:o,notices:a,...f!==void 0?{face:f}:{},onOpening:Y=>{S=Y},...N!==void 0?{stop:N}:{},...T!==void 0?{path:T}:{},...F?{principal:F}:{},...O?{seats:O}:{},...U!==void 0?{quickAsk:U}:{},...ie?{people:ie}:{},...he?{hostContext:he}:{},...K?{brand:K}:{},label:H,hostActions:X,draftView:J,scheme:z,onFace:Y=>{S=Y,C(Y)},onSeat:M,onFaceDrawn:ne},q?.n??0)})}let L=()=>{let f=l.view?.focusId,C=f?o.graph.getNode(f)?.kind:void 0,N=(l.shown??S)==="scene"||(l.shown??S)==="graview";return{face:S,path:N?ve:l.pages?.()??n.path??"/",stop:l.view?Tt(l.view):n.stop??"#",...C?{kind:C}:{}}},Z=(0,pr.createRoot)(e);return(0,W.flushSync)(()=>Z.render((0,y.jsx)(ke,{}))),{get store(){return o},where:L,setApp:(f,C,N)=>{let re="graph"in C?{store:C}:C,T=()=>{let oe=L();o=re.store,p=N?.label??(p===g.name?f.name:p),g=f,(0,W.flushSync)(()=>{d?.label(p),d?.app({app:f,remote:re,at:oe,n:++b})})};lt?T():P=P.then(jt).then(T)},setFace:f=>{S=f,(0,W.flushSync)(()=>d?.face(f))},setStop:f=>(0,W.flushSync)(()=>d?.stop(f)),setPath:f=>(0,W.flushSync)(()=>{if(It(f)){(S==="pages"||S==="picture")&&(S="scene",d?.face("scene"));return}d?.path(f),S!=="pages"&&(S="pages",d?.face("pages"))}),setScheme:f=>(0,W.flushSync)(()=>d?.scheme(f)),setSeat:f=>(0,W.flushSync)(()=>d?.seat(f)),setSeats:f=>(0,W.flushSync)(()=>d?.seats(f)),setQuickAsk:f=>(0,W.flushSync)(()=>d?.quickAsk(f)),setPeople:f=>(0,W.flushSync)(()=>d?.people(f)),setHostContext:f=>(0,W.flushSync)(()=>d?.hostContext(f)),setBrand:f=>(0,W.flushSync)(()=>d?.brand(f)),setDraftView:f=>(0,W.flushSync)(()=>d?.draft(f)),setLabel:f=>{p=f,(0,W.flushSync)(()=>d?.label(f))},setHostActions:f=>(0,W.flushSync)(()=>d?.hostActions(f)),drawn:()=>P.then(()=>R===S?void 0:new Promise(f=>v.push(f))),notify:f=>{let C;return(0,W.flushSync)(()=>{C=a.notify(f)}),C},unmount:()=>Z.unmount()}}var Pr="/graview/live",zt="graview.ship",Gt=`${zt}.${Xe}`;var me={seat:"x-graview-seat",roles:"x-graview-roles",kind:"x-graview-kind",name:"x-graview-name",for:"x-graview-for",forRoles:"x-graview-for-roles",forName:"x-graview-for-name",via:"x-graview-via"};var He=class extends Error{constructor(n){super(n),this.name="Superseded"}},Se=e=>e?.lineage?{lineage:e.lineage}:{},go=(e,n)=>`${e.calls.map(o=>o.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
2
- `)[0]??"":String(n)})`;function wo(e){if(!e)return[];try{let n=e.storage.getItem(e.key);if(n===null)return[];e.storage.removeItem(e.key);let o=JSON.parse(n);return Array.isArray(o)?o.filter(a=>!!a&&Array.isArray(a.calls)):[]}catch{return[]}}var De=class extends Error{constructor(o){super(o.sentence);this.refusal=o;this.name="RemoteRefusedError"}},vo={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},Fe=class extends Error{constructor(o,a){super(o);this.conflicts=a;this.name="StaleWrite"}},qe=class extends Error{constructor(n){super(n),this.name="Unreached"}},bo=new Set([502,503,504]);async function So(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function ko(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var Eo=1,Po=()=>({refusals:new Set,conflicts:new Set,statuses:new Set,helds:new Set,builds:new Set,who:new Set,declarations:new Set,tally:{reconnects:0,rebases:0,conflicts:0,resyncs:0}});async function ut(e){return(await Rr(e,wo(e.carry),"This app was updated while your changes were on the way.",Po())).remote}async function Rr(e,n,o,a){let d=e.fetch??fetch,l={"content-type":"application/json",...e.headers??{}},b={...ft(e.principal),[me.via]:e.via??"web"};Object.assign(l,b);let p=e.live===!0,g=e.presenceEveryMs,P=e.visible??To,A="connecting",k=a.statuses,S=a.tally,R=[],v,ne=[],ke=()=>A==="online"&&v!==void 0?"held":A,L=()=>{let t=ke();if(a.told!==t){a.told=t;for(let r of[...k])r(t)}},Z=t=>{if(!(t===A||de)&&(A==="offline"&&t==="online"&&S.reconnects++,A=t,L(),t==="online"))for(let r of R.splice(0))r.again()},f=t=>{if(de)return;let r=typeof t=="string"&&t.length>0?t:void 0,s=r!==v;if(v=r,C(),!!s&&(L(),r===void 0)){for(let i of ne.splice(0))i();Q&&clearTimeout(Q),Qt()}},C=()=>{if(a.toldHeld!==v){a.toldHeld=v;for(let t of[...a.helds])t(v??null)}},N=async(t,r)=>{let s;try{s=await d(t,r)}catch(i){throw m()||Z("offline"),new qe(i instanceof Error?i.message:String(i))}if(s.status===503&&await So(s))return Z("online"),s;if(bo.has(s.status))throw m()||Z("offline"),new qe(`The server is away (${s.status})`);return Z("online"),s},re=async(t=!1)=>{let r=`${e.url}/graview/state?opFormat=${_e.op}`,s=t?await d(r,{headers:l}):await N(r,{headers:l});if(!s.ok)throw new Error((await s.json().catch(()=>({}))).error??`The server refused (${s.status})`);return await s.json()},T=e.state??await re(!0);p||(A="online"),v=typeof T.held=="string"&&T.held.length>0?T.held:void 0,C();let oe=T.enabledModules??e.enabledModules,z=e.localApp?e.localApp(e.app):e.app,x=new hn({schema:z.schema,mutations:z.mutations??[],invariants:z.invariants??[],...z.policy?{policy:z.policy}:{},...z.modules?{modules:z.modules}:{},...oe?{enabledModules:oe}:{},...z.intelligence?{intelligence:z.intelligence}:{},...z.brand?.timeZone?{timeZone:z.brand.timeZone}:{},snapshot:T.snapshot,log:T.log,...T.horizon!==void 0?{horizon:T.horizon}:{},ids:ko(),...e.storeOptions??{}});fn.served.add(x);let F=pn(x),M=T.log.at(-1)?.seq??(T.horizon??0)-1,O=Pt.of(T.log,{horizon:T.horizon??0}),V=null,U,G=new Map,ie=a.who,$=!1,he=t=>{if(de)return;$=!0;let r=vn(new Map,t,Date.now(),1e4,V?.participant);U!==void 0&&r.delete(U);let s=r.size!==G.size;if(!s)for(let[i,u]of r)Rt(u,G.get(i))||(s=!0);if(G=r,!!s)for(let i of[...ie])i([...G.values()])},B=[],K=new Set,ae=t=>{let r=B.indexOf(t);r>=0&&B.splice(r,1)},H=new Map,ye=(t,r)=>{let s=H.get(t);s&&(H.delete(t),s.resolve({ops:r.filter(i=>i.batch===t),batch:t}))},X,j=[],q=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(X)return j.push({ops:t,drop:r}),[];let s=Math.min(...t.filter(w=>w.seq>M).map(w=>w.seq));if(Number.isFinite(s)&&s>M+1)return j.push({ops:t,drop:r}),Oe(),[];let i=B.filter(w=>t.some(Ie=>Ie.batch===w)),u=[...new Set([...r,...i])].filter(w=>K.has(w)),h,D=B.filter(w=>!i.includes(w));try{h=x.rebase({confirmed:t,pending:D,drop:u}).confirmed}catch(w){if(!(w instanceof mn))throw w;return j.push({ops:t,drop:r}),Oe(),[]}for(let w of i)ae(w);t.some(w=>w.seq>M)&&D.some(w=>!u.includes(w))&&S.rebases++,t.length>0&&(M=Math.max(M,...t.map(w=>w.seq)),O.note(t));for(let w of u)K.delete(w);for(let w of i)ye(w,t);return h},Oe=()=>{X||(X=Pe(re().then(t=>{if(J(t)){j=[];return}let r=new Set(t.log.map(u=>u.batch)),s=B.filter(u=>r.has(u));for(let u of s)ae(u);let i=x.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[...B],drop:[...K].filter(u=>!B.includes(u))});K.clear();for(let u of i.pending)K.add(u.batch);M=t.log.at(-1)?.seq??(t.horizon??0)-1,O=Pt.of(t.log,{horizon:t.horizon??0}),S.resyncs++;for(let u of s)ye(u,t.log)}).then(()=>{X=void 0;let t=j;j=[];for(let{ops:r,drop:s}of t)q(r,s)},()=>{X=void 0,j=[]})))},J=t=>(typeof t.build=="string"&&Xt(t.build),typeof t.version=="number"&&f(t.held),typeof t.version!="number"||t.version===T.version?!1:(wt(t.version),!0)),Ee=async t=>{let s=await(await N(`${e.url}/graview/since?seq=${t}&opFormat=${_e.op}`,{headers:l})).json();return J(s)?[]:s.ops??[]},Y=async()=>{let t=await ze();return X&&await X,t},ze=async()=>{if(V&&!m()&&P()){let r=await(await N(`${e.url}/graview/here`,{method:"POST",headers:l,body:JSON.stringify({presence:V,seq:M})})).json();return J(r)?[]:(typeof r.participant=="string"&&(U=r.participant),he(r.who??[]),q(r.ops??[]))}return q(await Ee(M))},E=new Map,Ce=new Map,ce=new Map,se=new Set,Pe=t=>(se.add(t),t.finally(()=>se.delete(t)).catch(()=>{}),t),Ne=Promise.resolve(),Le=0,pt=(t,r)=>{let s=Ne.then(()=>Ge(t,r));return Ne=s.catch(()=>{}),s},mt=()=>new Promise((t,r)=>R.push({again:t,give:r})),Ge=async(t,r)=>{let s,i;for(;;){try{s=await N(`${e.url}/graview/ops`,{method:"POST",headers:l,body:JSON.stringify({...t,opFormat:_e.op})})}catch(w){if(!(w instanceof qe)||te)throw w;if(await mt(),m())return Ke(t,r);continue}if(i=await s.json().catch(()=>({})),s.status===503&&i.reason==="unavailable"&&typeof i.held=="string"&&!te){if(typeof i.version=="number"?J(i):(f(i.held),!1))break;if(v!==void 0&&(St>0||p)){if(await new Promise(w=>ne.push(w)),te)throw new He("The client closed.");if(m())return Ke(t,r);continue}}let D;if(s.status===503&&i.reason==="unavailable"&&!te)D=Ut(e.backoff,Le++);else{if(Le=0,s.status!==429||te)break;D=Ao(s.headers.get("retry-after"),i.retryAfter)}if(await new Promise(w=>setTimeout(w,D)),m())return Ke(t,r)}if(de||J(i))throw new He("The app was changed.");if(!s.ok){let D=i.error??`The server refused (${s.status})`;throw i.conflict?new Fe(D,i.conflicts??[]):new De({reason:i.reason??vo[s.status]??"invalid",sentence:D,...i.wouldNeed?.length?{wouldNeed:i.wouldNeed}:{}})}let u=i.ops??[],h=u[0]?.seq;return h!==void 0&&h>M+1&&(u=await Ee(M)),r!==void 0&&(i.batch&&E.set(r,i.batch),ae(r)),q(u,r!==void 0?[r]:[]),{ops:i.ops??[],...i.batch?{batch:i.batch}:{}}},I,ee=!1,te=!1,Ae=0,ge,Ue=0,Me=0,Re=null,le=()=>{},Ve=new Promise(t=>{le=t}),m=()=>p&&ee&&I?.readyState===Eo,_=t=>{if(!m())return!1;try{return I.send(JSON.stringify(t)),!0}catch{return!1}},ue=(t=!1)=>{!V||!m()||!P()||!t&&Re&&Rt(V,Re)&&(g===void 0||Date.now()-Me<g)||_({t:"here",presence:V})&&(Re=V,Me=Date.now())},we=new Set,Q,Qt=()=>{if(Q=void 0,v!==void 0)return;let t=[...H.entries()].filter(([r])=>we.has(r));we.clear();for(let[,r]of t)_(r.message)},Zt=(t,r)=>{H.has(t)&&(we.add(t),Q&&clearTimeout(Q),Q=setTimeout(Qt,Math.max(0,r)))},Fr=t=>{H.has(t)&&we.add(t)},Ke=(t,r)=>new Promise((s,i)=>{let u=r??`send-${++Ue}`,h=t.undo?{t:"undo",cid:u,batches:t.undo,...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.via?{via:t.via}:{},...Se(t)}:{t:"call",cid:u,calls:t.calls??[],...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.base?.length?{base:t.base}:{},...t.via?{via:t.via}:{},...Se(t)};if(H.set(u,{message:h,...r!==void 0?{mine:r}:{},resolve:s,reject:i}),we.size>0||v!==void 0){we.add(u);return}_(h)}),ht=(t,r)=>m()?Ke(t,r):pt(t,r),Or=t=>{switch(t.t){case"welcome":{if(Xt(t.build),typeof t.version=="number"&&t.version!==T.version){wt(t.version);return}if(ee=!0,Ae=0,typeof t.participant=="string"&&(U=t.participant),f(t.held),q(t.ops??[]),we.clear(),Q&&clearTimeout(Q),Q=void 0,v!==void 0)for(let r of H.keys())we.add(r);else for(let r of H.values())_(r.message);ue(!0),Z("online"),le();return}case"ops":q(t.ops??[]);return;case"ack":{let r=H.get(t.cid);if(!r){q(t.ops??[]);return}H.delete(t.cid),Le=0,r.mine!==void 0&&(E.set(r.mine,t.batch),ae(r.mine)),q(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=H.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){v!==void 0?Fr(t.cid):Zt(t.cid,Ut(e.backoff,Le++));return}H.delete(t.cid),r.reject(t.t==="conflict"?new Fe(t.sentence,t.conflicts??[]):new De({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&Zt(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":he(t.who??[]);return;case"held":f(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==T.version&&wt(t.version);return;case"reload":rn(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&I){let r=I;an(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},de=!1,yt=a.declarations,gt=a.builds,Xt=t=>{if(!(de||a.otherBuild!==void 0||!e.build||typeof t!="string"||t.length===0||t===e.build)){a.otherBuild=t;for(let r of[...gt])r(t)}},en=()=>{let t=[],r=0;for(let s of B){let i=ce.get(s);i?t.push({calls:i.calls,...i.intent?{intent:i.intent}:{},...i.via?{via:i.via}:{},...Se(i),batch:s}):r++}return{carried:t,undos:r}},tn=(t,r)=>`${r} while ${t===1?"an undo of yours was":"undos of yours were"} on the way; ${t===1?"it was":"they were"} not made.`,nn=t=>{de=!0,V=null;let r=new He(t);for(let i of H.values())i.reject(r);H.clear(),Qe&&clearInterval(Qe),te=!0,ge&&clearTimeout(ge),Q&&clearTimeout(Q),fe&&clearTimeout(fe);for(let i of R.splice(0))i.give(r);for(let i of ne.splice(0))i();let s=I;I=void 0,ee=!1;try{s?.close(1e3,t)}catch{}le()};async function wt(t){if(de)return;if(!e.resolveApp){rn(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:s}=en(),i=e.resolveApp,u=V;nn("The app was changed.");try{let h=await i(t),{state:D,...w}=e,Ie=await Rr({...w,app:h},r,"The app was changed while your changes were on the way.",a);u&&Ie.remote.presence.here(u);for(let Ze of[...yt])Ze(Ie.remote,t);let Dr=[...s>0?[Je(tn(s,"The app was changed"))]:[],...Ie.unheard()];for(let Ze of Dr)for(let Nr of Be)Nr(Ze.sentence,Ze)}catch(h){let D=`The app was changed, but the new version could not be opened: ${h instanceof Error?h.message:String(h)}`;for(let w of Be)w(D,Je(D))}}function rn(t){if(de)return;let{carried:r,undos:s}=en();nn(t);let i=!1;if(e.carry&&r.length>0)try{e.carry.storage.setItem(e.carry.key,JSON.stringify(r)),i=!0}catch{}let u=[];!i&&r.length>0&&u.push(`${t} ${r.length===1?"A change of yours was":`${r.length} changes of yours were`} not sent; make ${r.length===1?"it":"them"} again after the page reloads.`),s>0&&u.push(tn(s,"This app was updated"));for(let h of u)for(let D of Be)D(h,Je(h));(e.reloadPage??Ro)()}let on=()=>{if(te||!p)return;let t=`${e.url.replace(/^http/,"ws").replace(/\/$/,"")}${Pr}`,{"content-type":r,...s}=l,i;try{i=e.socket?e.socket(t,s,[Gt]):Hr(t,s)}catch{return sn()}I=i,ee=!1,i.onopen=()=>{I===i&&i.send(JSON.stringify({t:"hello",seq:M,protocol:Xe,wire:zt,opFormat:_e.op,...e.build?{build:e.build.slice(0,64)}:{},...e.hostProtocol!==void 0?{hostProtocol:e.hostProtocol}:{}}))},i.onmessage=u=>{if(I!==i)return;let h;try{h=JSON.parse(String(u.data))}catch{return}Or(h)},i.onclose=()=>an(i),i.onerror=()=>{}},fe,Cr=()=>{$=!1,fe&&clearTimeout(fe),fe=setTimeout(()=>{if(fe=void 0,$||te)return;let t=new Map([...G].filter(([,r])=>r.held!=="socket"));if(t.size!==G.size){G=t;for(let r of ie)r([...G.values()])}},1e4),fe.unref?.()};function an(t){if(I!==t)return;let r=ee;I=void 0,ee=!1,Re=null,r&&(Z("offline"),Cr()),sn()}let sn=()=>{if(te)return;let t=Ut(e.backoff,Ae);Ae++,ge=setTimeout(on,t)},Lr=x.applyAll.bind(x),Mr=x.undo.bind(x),Vr=x.previewAll.bind(x);x.previewAll=(t,r)=>Vr(t,{...e.principal?{author:e.principal}:{},...r});let Be=a.refusals,$e=[],Je=t=>({reason:"invalid",sentence:t}),Ye=a.conflicts,vt=!1,dn=async(t,r)=>{if(r instanceof He||de)return;let s=r instanceof De?r.refusal:ln(r),i=s.sentence;ae(t);try{q([],[t])}catch{}let u=ce.get(t);if(ce.delete(t),r instanceof Fe&&S.conflicts++,r instanceof Fe&&!m()&&await Y().catch(()=>[]),r instanceof Fe&&Ye.size>0){let h=!1,D={sentence:i,conflicts:r.conflicts,keepTheirs(){h=!0},useMine(){if(!(h||!u)){h=!0,vt=!0;try{x.applyAll(u.calls,{...u.intent?{intent:u.intent}:{},...u.via?{via:u.via}:{},...Se(u)})}finally{vt=!1}}}};for(let w of Ye)w(D);return}for(let h of Be)h(i,s)};x.applyAll=(t,r)=>{let s=un(x.log.all().filter(h=>K.has(h.batch))),i=Lr(t,{...e.principal?{author:e.principal}:{},...r});B.push(i.batch),K.add(i.batch),ce.set(i.batch,{calls:t,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...Se(r)});let u=vt?[]:O.baseFor(i.ops,s);return Ce.set(i.batch,Pe(ht({calls:t,...r?.intent?{intent:r.intent}:{},batch:i.batch,...u.length>0?{base:u}:{},...r?.via?{via:r.via}:{},...Se(r)},i.batch).catch(h=>dn(i.batch,h)))),i},x.apply=(t,r)=>x.applyAll([t],r),x.undo=(t,r)=>{let s=typeof t=="string"?[t]:t,i=Mr(s.map(h=>E.get(h)??h),{...e.principal?{author:e.principal}:{},...r});B.push(i.batch),K.add(i.batch);let u=Promise.allSettled(s.map(h=>Ce.get(h)));return Ce.set(i.batch,Pe(u.then(()=>ht({undo:s.map(h=>E.get(h)??h),...r?.intent?{intent:r.intent}:{},batch:i.batch,...r?.via?{via:r.via}:{},...Se(r)},i.batch)).catch(h=>dn(i.batch,h)))),i};let Br=async(t,r={})=>{bt++;try{return(await Pe(ht({calls:t,...r}))).ops}finally{bt--}},bt=0,cn={here(t){V=t,ue()},onWho(t){return ie.add(t),G.size>0&&t([...G.values()]),()=>{ie.delete(t)}},leave(){if(!V)return;let t=JSON.stringify({participant:U??V.participant});if(V=null,_({t:"bye"}))return;let r=globalThis.navigator?.sendBeacon;r?r.call(globalThis.navigator,`${e.url}/graview/leave`,t):d(`${e.url}/graview/leave`,{method:"POST",headers:l,body:t}).catch(()=>{})}},St=e.pollMs??800,Qe=St>0&&typeof setInterval=="function"?setInterval(()=>{m()||Y().catch(()=>{})},St):null;if(p){on();let t;await Promise.race([Ve,new Promise(r=>t=setTimeout(r,e.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!de){let t=[],r=new Set(x.log.all().map(s=>s.batch));for(let s of n)if(!(s.batch!==void 0&&r.has(s.batch)))try{x.applyAll(s.calls,{...s.intent?{intent:s.intent}:{},...s.batch?{batch:s.batch}:{},...s.via?{via:s.via}:{},...Se(s)})}catch(i){t.push(go(s,i))}t.length>0&&$e.push(Je(`${o} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}return{remote:{store:x,version:T.version,migrated:T.migrated??[],send:Br,pull:Y,onRefusal(t){Be.add(t);let r=$e;$e=[];for(let s of r)t(s.sentence,s);return()=>Be.delete(t)},onDeclaration(t){return yt.add(t),()=>yt.delete(t)},onBuild(t){return gt.add(t),a.otherBuild!==void 0&&t(a.otherBuild),()=>gt.delete(t)},onConflict(t){return Ye.add(t),()=>Ye.delete(t)},revision:(t,r)=>O.of(t,r),seq:()=>M,participant:()=>U,transport:()=>m()?"socket":"poll",status:ke,onStatus(t){return k.add(t),()=>k.delete(t)},held:()=>v,onHeld(t){return a.helds.add(t),v!==void 0&&t(v),()=>a.helds.delete(t)},counters:()=>({...S}),who:()=>[...G.values()],pending:()=>B.length+bt,async settled(){for(;se.size>0;)await Promise.allSettled([...se])},presence:cn,close(){Qe&&clearInterval(Qe),F(),cn.leave(),te=!0,ge&&clearTimeout(ge),Q&&clearTimeout(Q),fe&&clearTimeout(fe);for(let r of R.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of ne.splice(0))r();let t=I;I=void 0,ee=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=$e;return $e=[],t}};function Hr(t,r){let s=globalThis.WebSocket;if(!s)throw new Error("This runtime has no WebSocket; the client polls instead.");let i=typeof globalThis.document<"u",u=e.subprotocol?[Gt]:[];if(!i)try{return new s(t,{headers:r,...u.length>0?{protocols:u}:{}})}catch{}let h=new URL(t);for(let[D,w]of Object.entries(b))h.searchParams.set(D,w);return u.length>0?new s(h.toString(),u):new s(h.toString())}}function Ao(e,n,o=Date.now()){let a,d=e?.trim();if(d)if(/^\d+(\.\d+)?$/.test(d))a=Number(d)*1e3;else{let p=Date.parse(d);Number.isFinite(p)&&(a=Math.max(0,p-o))}let l=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,b=l!==void 0&&l<50&&a!==void 0&&Math.abs(l*1e3-a)<1e3;return l!==void 0&&!b?l:a??1e3}function Ro(){globalThis.location?.reload?.()}function To(){return globalThis.document?.visibilityState!=="hidden"}function Ut(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:o=250,max:a=1e4,factor:d=2}=e??{};return Math.min(a,o*d**n)*(.75+Math.random()*.5)}function ft(e){let n={};if(!e)return n;e.id&&(n[me.seat]=e.id),e.roles?.length&&(n[me.roles]=e.roles.join(",")),e.kind!=="human"&&(n[me.kind]=e.kind),e.name&&(n[me.name]=encodeURIComponent(e.name));let o=e.onBehalfOf;return o?.id&&(n[me.for]=o.id),o?.roles?.length&&(n[me.forRoles]=o.roles.join(",")),o?.name&&(n[me.forName]=encodeURIComponent(o.name)),n}var Tr="/graview/views";function Kt(e){let n=e.fetch??fetch,o=e.url.replace(/\/$/,""),a={"content-type":"application/json",...e.principal?ft(e.principal):{},...e.headers??{}},d=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??et.may}:et,l=new Set,b=k=>{if(JSON.stringify(k)!==JSON.stringify(d)){d=k;for(let S of l)S()}},p=async(k,S)=>{let R=await n(`${o}${e.path??Tr}`,{method:k,headers:a,...S!==void 0?{body:JSON.stringify(S)}:{}}),v=await R.json();if(!R.ok)throw new Error(v.error??`The store answered ${R.status}.`);b({hidden:v.hidden??[],removed:v.removed??[],may:v.may??et.may})},g=()=>p("GET"),P=e.state?Promise.resolve():g().catch(()=>{}),A=e.pollMs?setInterval(()=>void g().catch(()=>{}),e.pollMs):void 0;return{ready:P,refresh:g,close:()=>clearInterval(A),current:()=>d,onChange(k){return l.add(k),()=>void l.delete(k)},hide:k=>p("POST",{hide:k}),show:k=>p("POST",{show:k}),remove:(k,S)=>p("POST",{remove:k,...S?{about:S}:{}}),async restore(k){let S=d.removed.find(R=>R.name===k)?.lens;await p("POST",{restore:k}),S&&await e.onDeclaration?.()},async lens(k){await p("POST",{lens:k}),await e.onDeclaration?.()}}}var Yt=document.getElementById("graview-app"),Jt=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),xr=Jt?(__graviewPreload(import.meta.url,["./chunk.ZBR2QY67.js","./chunk.UJKT2G6M.js","./chunk.UGFDSE37.js","./chunk.DLFWBG33.js","./chunk.RYRTKIKB.js","./chunk.M5GJHVWZ.js","./chunk.HZGVEHEN.js","./chunk.JBW3DI7E.js","./chunk.CBUSFM3E.js","./chunk.NIVTK2W5.js","./chunk.FPASZ4RD.js","./chunk.2YABX3SC.js","./chunk.DQOCBKC3.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.IW7YFPGG.js","./chunk.MB7LKKUD.js","./chunk.FHZBXMXR.js","./chunk.S5MQVPLF.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.QPCSS322.js")):xe("pages");try{Jt?await xo(decodeURIComponent(Jt[1])):await Fo()}catch(e){let n=document.createElement("pre");n.setAttribute("role","alert"),n.style.cssText="margin:2rem;font:14px/1.5 ui-monospace,monospace;white-space:pre-wrap",n.textContent=e instanceof Error?e.message:String(e),Yt.replaceChildren(n),window.__graviewFailed=n.textContent}async function xo(e){let n=await fetch(`/graview/document?form=${encodeURIComponent(e)}`),o=await n.json();if(!n.ok)throw new Error(o.error??`The preview server did not hand over the form (${n.status}).`);let a=await it(o);if(!a.ok)throw new Error(tt(a.findings));let d=a.app,l=o.principal,b=await ut({app:d,url:location.origin,principal:l,...o.state?{state:o.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=d.forms?.[e]?.title??d.name;let{mount:p}=await xr;window.__graview=p(Yt,{app:d,form:e,principal:l,remote:b,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function Fo(){let e=await fetch("/graview/document");if(!e.ok)throw new Error(`The preview server did not hand over the document (${e.status}).`);let n=await e.json(),a=await(async g=>{if(typeof g.module=="string")return(await import(g.module)).app;let P=await it(g);if(!P.ok)throw new Error(tt(P.findings));return P.app})(n);if(!a||typeof a!="object"||!("schema"in a))throw new Error("The app module the preview server handed does not export an app.");let d=n.principal,l=await ut({app:a,url:location.origin,principal:d,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=a.name;let b,p=Kt({url:location.origin,principal:d,...n.views?{state:n.views}:{},onDeclaration:async()=>{let g=await(await fetch("/graview/document")).json();if(typeof g.module=="string")return;let P=await it(g);P.ok&&b?.setApp(P.app,l)}});await Promise.all([xr,p.ready]),b=qt(Yt,{app:a,remote:l,principal:d,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:a.name,heading:1,keptViews:p,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=b,b.drawn().then(()=>{window.__graviewReady=!0})}
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Ct,b as _n,c as Wn,d as jn,e as qn,f as Lt,g as zn,h as Mt}from"./chunk.3VFYSXMQ.js";import{a as Ir}from"./chunk.JT3IZIU5.js";import{a as Vt,b as Un,c as Kn,d as Jn,e as Bt,f as Yn,g as Qn,h as Zn,i as Xn,j as er,k as tr,l as nr,m as rr,n as We}from"./chunk.5K6KX3UC.js";import{b as Gn}from"./chunk.S5MQVPLF.js";import{a as kt}from"./chunk.Q5WEOX3Q.js";import{a as Et,g as bn}from"./chunk.6YD2DLIC.js";import{k as tt}from"./chunk.KWQ7QOHD.js";import{C as Dn,H as Nn,L as $n,M as In,j as $r,k as Mn,n as ot,o as Vn,q as Bn,u as Hn,z as at}from"./chunk.XSNAG4JT.js";import{Ca as rt,G as Ft,R as En,W as Pn,a as Sn,b as Tt,c as nt,da as An,ea as Rn,j as kn,m as xt,qa as Tn,ra as xn,sa as Fn,ta as On,va as Cn,wa as Ot,za as Ln}from"./chunk.XWAMQPUM.js";import{a as be}from"./chunk.SDO3U72B.js";import{Mc as pn,Oc as mn,Pc as hn,Rc as et,Ub as Pt,Vb as un,ib as _e,jb as Xe,ld as ve,md as yn,nd as gn,sd as wn,td as At,vb as ln,wd as vn,xd as Rt,yc as fn}from"./chunk.AS4CQBOQ.js";import"./chunk.2AZTW66C.js";import{b as Te}from"./chunk.AJZBJBMO.js";async function it(e,n={}){let o=e.compiled===void 0||!Wr(e.compiled,e.document)?void 0:bn(e.compiled,n);if(o?.ok)return o;let{compileDocumentWithoutCheck:a}=await _r();return a(e.document,n)}var or,_r=()=>or??=(__graviewPreload(import.meta.url,["./chunk.4OGOTHRD.js","./chunk.6YD2DLIC.js","./chunk.IKX4VDTW.js","./chunk.TBQOSI4J.js","./chunk.KWQ7QOHD.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.AYA7SYIU.js")).catch(e=>{throw or=void 0,e});function Wr(e,n){let o=typeof e=="object"&&e!==null?e.document:void 0,a=n;if(typeof a=="string")try{a=JSON.parse(a)}catch{return!1}return o!==void 0&&kt(Et(o).document)===kt(Et(a).document)}var c=Te(Ft(),1);var dt=Te(Ft(),1),Ht="data-graview-drawn",jr=200,ar=50,qr=1e4,st=()=>typeof performance<"u"?performance.now():Date.now();function zr(e){let n=[...e.querySelectorAll("img")];for(let o of e.querySelectorAll("[data-worker-view]"))o.shadowRoot&&n.push(...o.shadowRoot.querySelectorAll("img"));return n}function Gr(e){if(e.ownerDocument.fonts?.status==="loading"||xn()>0||e.querySelector('[aria-busy="true"]')||zr(e).some(o=>!o.complete&&o.loading!=="lazy"))return!1;for(let o of e.querySelectorAll("[data-worker-view-place]"))if(!o.querySelector("[data-worker-view][data-worker-view-drawn], [data-worker-view][data-worker-view-failed]"))return!1;return!0}function ir(e){let n=e.querySelector("[data-embed-content]"),o=[...e.querySelectorAll("[data-worker-view]")].map(a=>`${a.offsetWidth}x${a.offsetHeight}`);return`${e.scrollWidth}x${e.scrollHeight}|${n?`${n.scrollWidth}x${n.scrollHeight}`:""}|${o.join(",")}`}function Ur(e,n,o){e.removeAttribute(Ht);let a=e.ownerDocument.defaultView;if(!a)return()=>{};let d=st(),l=d,b=ir(e),p=!1,g,P=typeof MutationObserver>"u"?void 0:new MutationObserver(R=>{R.some(v=>!(v.target===e&&v.attributeName===Ht))&&(l=st())});P?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let A=()=>{p=!0,P?.disconnect(),g!==void 0&&clearTimeout(g)},k=R=>{let v=!1,ne=()=>{v||(v=!0,R())};typeof a.requestAnimationFrame=="function"&&a.requestAnimationFrame(()=>setTimeout(ne,0)),setTimeout(ne,100)},S=()=>{if(p)return;let R=ir(e);R!==b&&(b=R,l=st());let v=st();if(Gr(e)&&v-l>=jr||v-d>=qr){k(()=>{p||(A(),e.setAttribute(Ht,n),On(),o())});return}g=setTimeout(S,ar)};return g=setTimeout(S,ar),A}function sr(e,n,o,a){Fn();let d=(0,dt.useRef)({place:o,onDrawn:a});d.current={place:o,onDrawn:a},(0,dt.useLayoutEffect)(()=>{let l=g=>Ur(g,d.current.place.path,()=>d.current.onDrawn?.(d.current.place));if(e.current)return l(e.current);let b,p=!1;return queueMicrotask(()=>{!p&&e.current&&(b=l(e.current))}),()=>{p=!0,b?.()}},[n,e])}var pe=Te(Ft(),1),je,Kr=be(()=>(__graviewPreload(import.meta.url,["./chunk.R4OU7O6C.js","./chunk.XXEYRHRG.js","./chunk.55D33E5A.js","./chunk.2JJYGYT2.js","./chunk.NMIXBH37.js","./chunk.XWAMQPUM.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.NITU5H4J.js"))),dr=()=>Kr().then(e=>void(je=e),()=>new Promise(e=>setTimeout(e,2e3)).then(dr)),Dt=Tn(dr),cr=e=>!!e&&je===void 0;function Nt({onReady:e,fetch:n}){return(0,pe.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var Jr=0;function lr(e){let[n,o]=(0,pe.useState)(()=>je);(0,pe.useEffect)(()=>{if(!e||n)return;let l=!1;return Dt().then(()=>{l||o(je)}),()=>{l=!0}},[e,n]);let a=(0,pe.useMemo)(()=>Jr+=1,[e]);return{over:(0,pe.useMemo)(()=>{let l=n??je;if(!e||!l)return;let{source:b,worker:p,...g}=e,P={...g,worker:p??{source:b},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:A=>l.registerWorkerView(A,P)}},[e,n]),n:a}}var pr=Te(Ir(),1),W=Te($r(),1);var y=Te(En(),1);function ct(e,n={}){let o=Ot(e);return{Face:o.part((d,l)=>(0,c.createElement)(d,l),n),fetch:()=>o.load().then(()=>{}),here:()=>o.current!==void 0||o.failed}}var _t=e=>Promise.all([e,$n()]).then(([n])=>n),mr=be(()=>(__graviewPreload(import.meta.url,["./chunk.NWA7Q6CI.js","./chunk.M5GJHVWZ.js","./chunk.WSTBCWW7.js","./chunk.AGIO2GRV.js","./chunk.NIVTK2W5.js","./chunk.HJCQ6I3S.js","./chunk.BNPQUI3F.js","./chunk.6RY6OSE6.js","./chunk.6SOUQNXR.js","./chunk.3MMLRSRC.js","./chunk.64WM4IBI.js","./chunk.5ESCD57M.js","./chunk.DQOCBKC3.js","./chunk.DEUTHHGI.js","./chunk.ATDU5Y7V.js","./chunk.PKUDIWIF.js","./chunk.VW2VCPJX.js","./chunk.WBHM5I3I.js","./chunk.VC3BX2ZF.js","./chunk.UKAPFIPJ.js","./chunk.UT6642FC.js","./chunk.5K6KX3UC.js","./chunk.S5MQVPLF.js","./chunk.TI4OSTQV.js","./chunk.Q7RQC3F7.js","./chunk.GZHZLJBF.js","./chunk.6MADC6DM.js","./chunk.OJGHDWI6.js","./chunk.JLEC3USG.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.XSNAG4JT.js","./chunk.XWAMQPUM.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.TFVFJFXC.js"))),Yr=be(()=>(__graviewPreload(import.meta.url,["./chunk.XXDBZQNY.js","./chunk.JF3GD4H5.js","./chunk.UR3XYOQ6.js","./chunk.ONEYVLC2.js","./chunk.WQONZBA3.js","./chunk.UGFDSE37.js","./chunk.NWA7Q6CI.js","./chunk.WP5W44Y4.js","./chunk.M5GJHVWZ.js","./chunk.HZCA3UWJ.js","./chunk.JBW3DI7E.js","./chunk.AGIO2GRV.js","./chunk.NIVTK2W5.js","./chunk.PXQVXBNG.js","./chunk.6QYJ2K6K.js","./chunk.3MMLRSRC.js","./chunk.DQOCBKC3.js","./chunk.OHSJQYJN.js","./chunk.DEUTHHGI.js","./chunk.EPUBSKKL.js","./chunk.ATDU5Y7V.js","./chunk.AQQZY6OY.js","./chunk.BCWPV4WR.js","./chunk.Y5ARSVH4.js","./chunk.PKUDIWIF.js","./chunk.VW2VCPJX.js","./chunk.UKAPFIPJ.js","./chunk.UT6642FC.js","./chunk.IW7YFPGG.js","./chunk.MB7LKKUD.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.6MADC6DM.js","./chunk.OJGHDWI6.js","./chunk.JLEC3USG.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.XSNAG4JT.js","./chunk.XWAMQPUM.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.JQLR6KO2.js"))),Qr=be(()=>(__graviewPreload(import.meta.url,["./chunk.XXDBZQNY.js","./chunk.JF3GD4H5.js","./chunk.UR3XYOQ6.js","./chunk.ONEYVLC2.js","./chunk.WQONZBA3.js","./chunk.UGFDSE37.js","./chunk.NWA7Q6CI.js","./chunk.WP5W44Y4.js","./chunk.M5GJHVWZ.js","./chunk.HZCA3UWJ.js","./chunk.JBW3DI7E.js","./chunk.AGIO2GRV.js","./chunk.NIVTK2W5.js","./chunk.PXQVXBNG.js","./chunk.6QYJ2K6K.js","./chunk.3MMLRSRC.js","./chunk.DQOCBKC3.js","./chunk.OHSJQYJN.js","./chunk.DEUTHHGI.js","./chunk.EPUBSKKL.js","./chunk.ATDU5Y7V.js","./chunk.AQQZY6OY.js","./chunk.BCWPV4WR.js","./chunk.Y5ARSVH4.js","./chunk.PKUDIWIF.js","./chunk.VW2VCPJX.js","./chunk.UKAPFIPJ.js","./chunk.UT6642FC.js","./chunk.IW7YFPGG.js","./chunk.MB7LKKUD.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.6MADC6DM.js","./chunk.OJGHDWI6.js","./chunk.JLEC3USG.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.XSNAG4JT.js","./chunk.XWAMQPUM.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.FO5BOBYV.js"))),hr=ct(()=>_t(mr().then(e=>e.SceneFace)),{what:"This view"}),yr=ct(()=>mr().then(e=>e.SceneKeeping),{quiet:!0}),gr=ct(()=>_t(Yr().then(e=>e.PagesContent)),{what:"This page"}),wr=ct(()=>_t(Qr().then(e=>e.PictureFace)),{what:"This picture"}),Zr=hr.Face,Xr=yr.Face,eo=gr.Face,to=wr.Face;function xe(...e){let n=e.length>0?e:["scene","pages","picture"],o=new Set(n.flatMap(vr));return Promise.all([...[...o].map(a=>a.fetch()),Bn()]).then(()=>{},()=>{})}var vr=e=>e==="pages"?[gr]:e==="picture"?[wr]:[hr,yr],br=e=>vr(e).every(n=>n.here()),no=150,$t=0;function ur(e,n){if(br(e))return n();let o=++$t,a=()=>{o===$t&&($t+=1,n())};xe(e).then(a),setTimeout(a,no)}var ro=768;function oo(e,n){let o=n!==null&&n>=ro;(0,c.useEffect)(()=>{if(!o||e==="picture")return;let a=e==="pages"?"scene":"pages";if(br(a))return;let d=globalThis,l=()=>void xe(a),b=()=>{},p=Cn(()=>{if(d.requestIdleCallback&&d.cancelIdleCallback){let g=d.requestIdleCallback(l,{timeout:4e3});b=()=>d.cancelIdleCallback?.(g)}else{let g=setTimeout(l,1500);b=()=>clearTimeout(g)}});return()=>(p(),b())},[e,o])}function ao({asked:e,shown:n,onDrawn:o}){return(0,c.useLayoutEffect)(()=>o(e,n),[e,n,o]),null}function io({auto:e,scene:n}){return(0,y.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${Bt}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var so=Ot(be(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,y.jsx)(e.StudioPlace,{...n}),{quiet:!0});function Sr(e,n,o,a,d){return Lt(e,qn(n?nt(n):d??Sn,a),o)}function Wt(e){return e&&nt(e).overview?"graview":"scene"}function fr(e,n){if(n.homeView?.()===void 0)return!1;let o=e.pages?.first?.trim();return o===void 0||o===""||o==="/"||o.toLowerCase()==="home"}function kr(e){let[,n]=(0,c.useState)(!1),o=(0,c.useCallback)(()=>n(!0),[]),a=(0,c.useRef)(!1);return e.at&&!lt?(0,y.jsx)(Nt,{onReady:o,fetch:jt}):!a.current&&cr(e.draftView)?(0,y.jsx)(Nt,{onReady:o,fetch:Dt}):(a.current=!0,(0,y.jsx)(co,{...e}))}function co(e){let{app:n,stop:o,bar:a=!0,standing:d="Everything is in order",principal:l,heading:b=2}=e,{rootRef:p,scope:g,css:P,scheme:A,store:k,presence:S,brand:R,auto:v,height:ne}=Yn(e),ke=lr(e.draftView),L=Kn(e,In,ke.over),Z=e.basePath===void 0?{}:{basePath:e.basePath},[f]=(0,c.useState)(ot),C=e.notices??f,N=m=>wn(m,Z),re={...e.routing?{routing:e.routing}:{},...Z},[T]=(0,c.useState)(()=>{let m=e.at?.face;if(m)return m;let _=o===void 0&&fr(n,L)?"pages":Wt(o),ue=Ct({...re,face:_});return e.face===void 0&&e.onOpening?.(ue),ue}),[oe,z]=(0,c.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&o===void 0&&_n(re)&&fr(n,L)),x=(0,c.useRef)(e.onFace);x.current=e.onFace,(0,c.useLayoutEffect)(()=>{oe&&(x.current?.("pages"),z(!1))},[oe]);let F=oe?"pages":e.face??T,M=n.schema.kinds,O=e.routing==="address",V=(0,c.useMemo)(()=>e.at?lt.settleAt(e,k.seenBy(l??{kind:"human"}),L.places()):void 0,[]),U=(0,c.useMemo)(()=>Rn(L,n.schema),[L,n.schema]),G=(0,c.useMemo)(()=>{let m=V?.stop??(O?Wn(e.basePath):void 0)??o;return F==="scene"&&m===void 0&&U===void 0&&(e.path===void 0||It(e.path))?Mt(void 0):Sr(F,m,M,L.places(),U)},[]),[ie]=(0,c.useState)(F);(0,c.useEffect)(()=>{ie!=="pages"&&An(L)},[ie,L]);let $=(0,c.useRef)(void 0),he=m=>m===void 0||It(m)?"/":m;$.current??={path:he(V?.path??(O?F==="pages"?(At(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==$.current.asked&&($.current={path:he(e.path),asked:e.path});let B=(0,c.useRef)(e.onNavigate);B.current=e.onNavigate;let K=(0,c.useCallback)((m,_)=>{$.current.path=m,B.current?.(m,_)},[]),{at:ae,setAt:H,steering:ye,steer:X}=tr($.current.path),j=(0,c.useContext)(Er);j&&(j.pages=()=>$.current.path);let q=(0,c.useRef)(void 0),Oe=(0,c.useCallback)(m=>void($.current.path=m),[]),J=Mn(p),[Ee,Y]=(0,c.useState)(!1),ze=e.pagesBelow!==void 0&&J!==null&&J<e.pagesBelow&&(F==="scene"||F==="graview")&&!Ee,E=ze?"pages":F,Ce=(0,c.useRef)(!1);Ce.current=Ee&&e.pagesBelow!==void 0&&J!==null&&J<e.pagesBelow&&(F==="scene"||F==="graview"),j&&(j.shown=E);let ce=(0,c.useRef)(F==="graview"?"graview":"scene");(E==="scene"||E==="graview")&&(ce.current=E),(0,c.useState)(()=>{if(!O||typeof window>"u"||E==="pages"||E==="picture")return;let{pathname:m,search:_,hash:ue}=window.location;At(m,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${N(ve)}${_}${ue}`)}),Jn(p,E,e.onIntrinsicHeight),oo(E,J);let se=nr(e.onError,E),Pe=rr(e.onReady,E),Ne=(0,c.useRef)(e.onFaceDrawn);Ne.current=e.onFaceDrawn;let Le=(0,c.useCallback)((m,_)=>{Pe(_),Ne.current?.(m)},[Pe]),[pt,mt]=(0,c.useState)(null),Ge=L.places(),I=(0,c.useRef)({shown:E,onFace:e.onFace});I.current={shown:E,onFace:e.onFace};let ee=(0,c.useCallback)((m,_,ue)=>{if(O){q.current?.(m,_,ue);return}I.current.onFace?.(m),B.current?.(m==="pages"?_??$.current.path:ve,"push")},[O]),[te,Ae]=(0,c.useState)(void 0);(0,c.useEffect)(()=>{E==="pages"&&Ae(void 0)},[E]);let ge=(0,c.useRef)(o);(0,c.useEffect)(()=>{ge.current!==o&&(ge.current=o,Ae(void 0))},[o]);let Ue=(0,c.useCallback)(m=>{if(I.current.shown==="pages"){if(Y(!0),Ae(m),F==="scene"||F==="graview"){ur(F,()=>{O?window.history.pushState(null,"",`${N(ve)}${m??""}`):B.current?.(ve,"push")});return}ur(ce.current,()=>ee(ce.current,void 0,m))}},[O,F,e.basePath,ee]),Me=(0,c.useCallback)(m=>{if(I.current.shown==="pages"){ye.go.current||($.current.path=m),X(m);return}if($.current.path=m,H(m),Ce.current){Y(!1),O?window.history.pushState(null,"",N(m)):B.current?.(m,"push");return}ee("pages",m)},[ye,X,H,ee,O,e.basePath]),Re=L.arrangement?.(),le=E==="pages",Ve=O?N:void 0;return(0,y.jsxs)("section",{ref:p,className:g,"aria-label":e.label??n.name,"data-graview-embed":E,"data-graview-scheme":A,...ze?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:ne,minHeight:v?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,y.jsx)("style",{children:P}),(0,y.jsxs)(Ln.Provider,{value:se,children:[(0,y.jsx)(Qn,{rootRef:p,board:C}),(0,y.jsx)(Un,{rootRef:p,firstLook:e.firstLook,app:Dn(R??{name:n.name},n.schema)}),(0,y.jsx)(We,{module:"@graview/react",report:se,content:!0,children:(0,y.jsx)(Pn,{store:k,views:L,initialView:G,scheme:A,...Zn(e,S,R),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,y.jsxs)(Vn.Provider,{value:C,children:[(0,y.jsx)(po,{face:E,stop:te??o,kinds:M,places:Ge,opens:U}),j?(0,y.jsx)(lo,{into:j}):null,(0,y.jsx)(uo,{rootRef:p,face:F,shown:E,path:ae,stop:o,draft:ke.n,onDrawn:e.onDrawn}),O?(0,y.jsx)(jn,{pagesWere:V?.path,basePath:e.basePath,shown:E,onFace:e.onFace,toggle:q,kinds:M,places:Ge,opens:U,landed:Oe}):null,a&&E!=="picture"?(0,y.jsx)(We,{module:"@graview/embed",report:se,children:(0,y.jsx)(Xn,{name:R?.name??n.name,heading:b,named:Vt(a).name!==!1,faces:Vt(a).faces===!1?void 0:{scene:{label:yn(Re),current:!le,go:()=>Ue(),reach:()=>void xe(ce.current)},pages:{label:gn(Re),current:le,go:()=>Me($.current.path),reach:()=>void xe("pages")}},at:le?ae:null,without:e.pages?.without(),home:{...Ve?{href:Ve("/")}:{},go:()=>Me("/"),current:le&&ae.split("?")[0]==="/"},reach:{...Ve?{href:Ve}:{},go:m=>Me(m.path)},standing:d,hostActions:e.hostActions,keeping:le?void 0:(0,y.jsx)(mo,{app:n,studio:e.studio,report:se}),onFind:mt,switch:e.switch})}):null,(0,y.jsx)(Hn.Provider,{value:pt,children:(0,y.jsx)(We,{module:E==="pages"||E==="picture"?"@graview/pages":"@graview/react",report:se,content:!0,children:(0,y.jsxs)(c.Suspense,{fallback:(0,y.jsx)(io,{auto:v,scene:E!=="pages"&&E!=="picture"}),children:[E==="picture"?(0,y.jsx)(to,{scope:g,store:k,views:L,as:(o?nt(o).within?.view:void 0)??""}):E==="pages"?(0,y.jsx)(eo,{store:k,views:L,presence:S,auto:v,brand:R,steering:ye,overview:Ue,scope:g,titleLevel:er(b),quickAsk:at(e.quickAsk),props:{...e,onNavigate:K,...O?{}:{path:$.current.path}}}):(0,y.jsx)(Zr,{address:O,auto:v,scheme:A,scope:g,quickAsk:at(e.quickAsk)}),(0,y.jsx)(ao,{asked:F,shown:E,onDrawn:Le})]})},E)})]})})})]})]})}var It=e=>e.split(/[?#]/)[0]===ve,Er=(0,c.createContext)(null);function lo({into:e}){return e.view=rt().view,null}function uo({rootRef:e,face:n,shown:o,path:a,stop:d,draft:l,onDrawn:b}){let{view:p}=rt(),g=o==="scene"||o==="graview",P=Tt(p),A={face:n,path:g?ve:o==="picture"?d??"#":a,stop:P};return sr(e,`${o} ${g?P:A.path} ${l}`,A,b),null}var lt,fo=be(()=>(__graviewPreload(import.meta.url,["./chunk.3VFYSXMQ.js","./chunk.XSNAG4JT.js","./chunk.XWAMQPUM.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.Z5IGHCZX.js"))),jt=()=>fo().then(e=>void(lt=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(o),e()},o=setTimeout(n,1e4);window.addEventListener("online",n)}).then(jt));function po({face:e,stop:n,kinds:o,places:a,opens:d}){let{view:l,go:b}=rt(),p=(0,c.useRef)({face:e,stop:n});return(0,c.useLayoutEffect)(()=>{let g=p.current.stop!==n,P=p.current.face!==e,A=p.current.face==="pages";if(p.current={face:e,stop:n},!g&&!P||e==="pages"||e==="picture")return;let k=(g||A)&&n!==void 0?Sr(e,n,o,a):A&&zn(l)?Lt(e,Mt(d),o):e==="graview"?xt(l,!0):l.overview?kn(xt(l,!1),Nn(l,o)):l;b(k)},[e,n,o,l,b,d]),null}function mo({app:e,studio:n,report:o}){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.Suspense,{fallback:null,children:(0,y.jsx)(Xr,{})}),n!==!1?(0,y.jsx)(We,{module:"@graview/studio",report:o,children:(0,y.jsx)(ho,{app:e,studio:n})}):null]})}function ho({app:e,studio:n}){let o={app:e,within:"box",...n?{onApply:n.onApply}:{},...n?.landmark?{landmark:n.landmark}:{},...n?.offered!==void 0?{offered:n.offered}:{}},a=n?.place;return a?(0,y.jsx)(a,{...o}):(0,y.jsx)(c.Suspense,{fallback:null,children:(0,y.jsx)(so,{...o})})}function yo({path:e,stop:n,...o},a){return{...o,app:a.app,at:a.at,...a.remote.presence?{presence:a.remote.presence}:{}}}function qt(e,n){let o=n.store??n.remote?.store??Gn(n.app,n.seed),a=n.notices??ot(),d=null,l={},b=0,p=n.label,g=n.app,P=Promise.resolve(),A=n.at?.face??n.face,k=A===void 0?void 0:Ct({...n,face:A}),S=k??Wt(n.stop),R=null,v=[],ne=f=>{if(R=f,f!==S)return;let C=v;v=[];for(let N of C)N()};function ke(){let[f,C]=(0,c.useState)(k),[N,re]=(0,c.useState)(n.stop),[T,oe]=(0,c.useState)(n.path),[z,x]=(0,c.useState)(n.scheme??"auto"),[F,M]=(0,c.useState)(n.principal),[O,V]=(0,c.useState)(n.seats),[U,G]=(0,c.useState)(n.quickAsk),[ie,$]=(0,c.useState)(n.people),[he,B]=(0,c.useState)(n.hostContext),[K,ae]=(0,c.useState)(n.brand),[H,ye]=(0,c.useState)(n.label),[X,j]=(0,c.useState)(n.hostActions),[q,Oe]=(0,c.useState)(void 0),[J,Ee]=(0,c.useState)(n.draftView);return d={app:Y=>{Oe(Y),oe(void 0),re(void 0)},face:C,stop:re,path:oe,scheme:x,seat:M,seats:V,quickAsk:G,people:$,hostContext:B,brand:ae,label:ye,hostActions:j,draft:Ee},(0,y.jsx)(Er.Provider,{value:l,children:(0,y.jsx)(kr,{...q?yo(n,q):n,store:o,notices:a,...f!==void 0?{face:f}:{},onOpening:Y=>{S=Y},...N!==void 0?{stop:N}:{},...T!==void 0?{path:T}:{},...F?{principal:F}:{},...O?{seats:O}:{},...U!==void 0?{quickAsk:U}:{},...ie?{people:ie}:{},...he?{hostContext:he}:{},...K?{brand:K}:{},label:H,hostActions:X,draftView:J,scheme:z,onFace:Y=>{S=Y,C(Y)},onSeat:M,onFaceDrawn:ne},q?.n??0)})}let L=()=>{let f=l.view?.focusId,C=f?o.graph.getNode(f)?.kind:void 0,N=(l.shown??S)==="scene"||(l.shown??S)==="graview";return{face:S,path:N?ve:l.pages?.()??n.path??"/",stop:l.view?Tt(l.view):n.stop??"#",...C?{kind:C}:{}}},Z=(0,pr.createRoot)(e);return(0,W.flushSync)(()=>Z.render((0,y.jsx)(ke,{}))),{get store(){return o},where:L,setApp:(f,C,N)=>{let re="graph"in C?{store:C}:C,T=()=>{let oe=L();o=re.store,p=N?.label??(p===g.name?f.name:p),g=f,(0,W.flushSync)(()=>{d?.label(p),d?.app({app:f,remote:re,at:oe,n:++b})})};lt?T():P=P.then(jt).then(T)},setFace:f=>{S=f,(0,W.flushSync)(()=>d?.face(f))},setStop:f=>(0,W.flushSync)(()=>d?.stop(f)),setPath:f=>(0,W.flushSync)(()=>{if(It(f)){(S==="pages"||S==="picture")&&(S="scene",d?.face("scene"));return}d?.path(f),S!=="pages"&&(S="pages",d?.face("pages"))}),setScheme:f=>(0,W.flushSync)(()=>d?.scheme(f)),setSeat:f=>(0,W.flushSync)(()=>d?.seat(f)),setSeats:f=>(0,W.flushSync)(()=>d?.seats(f)),setQuickAsk:f=>(0,W.flushSync)(()=>d?.quickAsk(f)),setPeople:f=>(0,W.flushSync)(()=>d?.people(f)),setHostContext:f=>(0,W.flushSync)(()=>d?.hostContext(f)),setBrand:f=>(0,W.flushSync)(()=>d?.brand(f)),setDraftView:f=>(0,W.flushSync)(()=>d?.draft(f)),setLabel:f=>{p=f,(0,W.flushSync)(()=>d?.label(f))},setHostActions:f=>(0,W.flushSync)(()=>d?.hostActions(f)),drawn:()=>P.then(()=>R===S?void 0:new Promise(f=>v.push(f))),notify:f=>{let C;return(0,W.flushSync)(()=>{C=a.notify(f)}),C},unmount:()=>Z.unmount()}}var Pr="/graview/live",zt="graview.ship",Gt=`${zt}.${Xe}`;var me={seat:"x-graview-seat",roles:"x-graview-roles",kind:"x-graview-kind",name:"x-graview-name",for:"x-graview-for",forRoles:"x-graview-for-roles",forName:"x-graview-for-name",via:"x-graview-via"};var He=class extends Error{constructor(n){super(n),this.name="Superseded"}},Se=e=>e?.lineage?{lineage:e.lineage}:{},go=(e,n)=>`${e.calls.map(o=>o.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
2
+ `)[0]??"":String(n)})`;function wo(e){if(!e)return[];try{let n=e.storage.getItem(e.key);if(n===null)return[];e.storage.removeItem(e.key);let o=JSON.parse(n);return Array.isArray(o)?o.filter(a=>!!a&&Array.isArray(a.calls)):[]}catch{return[]}}var De=class extends Error{constructor(o){super(o.sentence);this.refusal=o;this.name="RemoteRefusedError"}},vo={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},Fe=class extends Error{constructor(o,a){super(o);this.conflicts=a;this.name="StaleWrite"}},qe=class extends Error{constructor(n){super(n),this.name="Unreached"}},bo=new Set([502,503,504]);async function So(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function ko(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var Eo=1,Po=()=>({refusals:new Set,conflicts:new Set,statuses:new Set,helds:new Set,builds:new Set,who:new Set,declarations:new Set,tally:{reconnects:0,rebases:0,conflicts:0,resyncs:0}});async function ut(e){return(await Rr(e,wo(e.carry),"This app was updated while your changes were on the way.",Po())).remote}async function Rr(e,n,o,a){let d=e.fetch??fetch,l={"content-type":"application/json",...e.headers??{}},b={...ft(e.principal),[me.via]:e.via??"web"};Object.assign(l,b);let p=e.live===!0,g=e.presenceEveryMs,P=e.visible??To,A="connecting",k=a.statuses,S=a.tally,R=[],v,ne=[],ke=()=>A==="online"&&v!==void 0?"held":A,L=()=>{let t=ke();if(a.told!==t){a.told=t;for(let r of[...k])r(t)}},Z=t=>{if(!(t===A||de)&&(A==="offline"&&t==="online"&&S.reconnects++,A=t,L(),t==="online"))for(let r of R.splice(0))r.again()},f=t=>{if(de)return;let r=typeof t=="string"&&t.length>0?t:void 0,s=r!==v;if(v=r,C(),!!s&&(L(),r===void 0)){for(let i of ne.splice(0))i();Q&&clearTimeout(Q),Qt()}},C=()=>{if(a.toldHeld!==v){a.toldHeld=v;for(let t of[...a.helds])t(v??null)}},N=async(t,r)=>{let s;try{s=await d(t,r)}catch(i){throw m()||Z("offline"),new qe(i instanceof Error?i.message:String(i))}if(s.status===503&&await So(s))return Z("online"),s;if(bo.has(s.status))throw m()||Z("offline"),new qe(`The server is away (${s.status})`);return Z("online"),s},re=async(t=!1)=>{let r=`${e.url}/graview/state?opFormat=${_e.op}`,s=t?await d(r,{headers:l}):await N(r,{headers:l});if(!s.ok)throw new Error((await s.json().catch(()=>({}))).error??`The server refused (${s.status})`);return await s.json()},T=e.state??await re(!0);p||(A="online"),v=typeof T.held=="string"&&T.held.length>0?T.held:void 0,C();let oe=T.enabledModules??e.enabledModules,z=e.localApp?e.localApp(e.app):e.app,x=new hn({schema:z.schema,mutations:z.mutations??[],invariants:z.invariants??[],...z.policy?{policy:z.policy}:{},...z.modules?{modules:z.modules}:{},...oe?{enabledModules:oe}:{},...z.intelligence?{intelligence:z.intelligence}:{},...z.brand?.timeZone?{timeZone:z.brand.timeZone}:{},snapshot:T.snapshot,log:T.log,...T.horizon!==void 0?{horizon:T.horizon}:{},ids:ko(),...e.storeOptions??{}});fn.served.add(x);let F=pn(x),M=T.log.at(-1)?.seq??(T.horizon??0)-1,O=Pt.of(T.log,{horizon:T.horizon??0}),V=null,U,G=new Map,ie=a.who,$=!1,he=t=>{if(de)return;$=!0;let r=vn(new Map,t,Date.now(),1e4,V?.participant);U!==void 0&&r.delete(U);let s=r.size!==G.size;if(!s)for(let[i,u]of r)Rt(u,G.get(i))||(s=!0);if(G=r,!!s)for(let i of[...ie])i([...G.values()])},B=[],K=new Set,ae=t=>{let r=B.indexOf(t);r>=0&&B.splice(r,1)},H=new Map,ye=(t,r)=>{let s=H.get(t);s&&(H.delete(t),s.resolve({ops:r.filter(i=>i.batch===t),batch:t}))},X,j=[],q=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(X)return j.push({ops:t,drop:r}),[];let s=Math.min(...t.filter(w=>w.seq>M).map(w=>w.seq));if(Number.isFinite(s)&&s>M+1)return j.push({ops:t,drop:r}),Oe(),[];let i=B.filter(w=>t.some(Ie=>Ie.batch===w)),u=[...new Set([...r,...i])].filter(w=>K.has(w)),h,D=B.filter(w=>!i.includes(w));try{h=x.rebase({confirmed:t,pending:D,drop:u}).confirmed}catch(w){if(!(w instanceof mn))throw w;return j.push({ops:t,drop:r}),Oe(),[]}for(let w of i)ae(w);t.some(w=>w.seq>M)&&D.some(w=>!u.includes(w))&&S.rebases++,t.length>0&&(M=Math.max(M,...t.map(w=>w.seq)),O.note(t));for(let w of u)K.delete(w);for(let w of i)ye(w,t);return h},Oe=()=>{X||(X=Pe(re().then(t=>{if(J(t)){j=[];return}let r=new Set(t.log.map(u=>u.batch)),s=B.filter(u=>r.has(u));for(let u of s)ae(u);let i=x.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[...B],drop:[...K].filter(u=>!B.includes(u))});K.clear();for(let u of i.pending)K.add(u.batch);M=t.log.at(-1)?.seq??(t.horizon??0)-1,O=Pt.of(t.log,{horizon:t.horizon??0}),S.resyncs++;for(let u of s)ye(u,t.log)}).then(()=>{X=void 0;let t=j;j=[];for(let{ops:r,drop:s}of t)q(r,s)},()=>{X=void 0,j=[]})))},J=t=>(typeof t.build=="string"&&Xt(t.build),typeof t.version=="number"&&f(t.held),typeof t.version!="number"||t.version===T.version?!1:(wt(t.version),!0)),Ee=async t=>{let s=await(await N(`${e.url}/graview/since?seq=${t}&opFormat=${_e.op}`,{headers:l})).json();return J(s)?[]:s.ops??[]},Y=async()=>{let t=await ze();return X&&await X,t},ze=async()=>{if(V&&!m()&&P()){let r=await(await N(`${e.url}/graview/here`,{method:"POST",headers:l,body:JSON.stringify({presence:V,seq:M})})).json();return J(r)?[]:(typeof r.participant=="string"&&(U=r.participant),he(r.who??[]),q(r.ops??[]))}return q(await Ee(M))},E=new Map,Ce=new Map,ce=new Map,se=new Set,Pe=t=>(se.add(t),t.finally(()=>se.delete(t)).catch(()=>{}),t),Ne=Promise.resolve(),Le=0,pt=(t,r)=>{let s=Ne.then(()=>Ge(t,r));return Ne=s.catch(()=>{}),s},mt=()=>new Promise((t,r)=>R.push({again:t,give:r})),Ge=async(t,r)=>{let s,i;for(;;){try{s=await N(`${e.url}/graview/ops`,{method:"POST",headers:l,body:JSON.stringify({...t,opFormat:_e.op})})}catch(w){if(!(w instanceof qe)||te)throw w;if(await mt(),m())return Ke(t,r);continue}if(i=await s.json().catch(()=>({})),s.status===503&&i.reason==="unavailable"&&typeof i.held=="string"&&!te){if(typeof i.version=="number"?J(i):(f(i.held),!1))break;if(v!==void 0&&(St>0||p)){if(await new Promise(w=>ne.push(w)),te)throw new He("The client closed.");if(m())return Ke(t,r);continue}}let D;if(s.status===503&&i.reason==="unavailable"&&!te)D=Ut(e.backoff,Le++);else{if(Le=0,s.status!==429||te)break;D=Ao(s.headers.get("retry-after"),i.retryAfter)}if(await new Promise(w=>setTimeout(w,D)),m())return Ke(t,r)}if(de||J(i))throw new He("The app was changed.");if(!s.ok){let D=i.error??`The server refused (${s.status})`;throw i.conflict?new Fe(D,i.conflicts??[]):new De({reason:i.reason??vo[s.status]??"invalid",sentence:D,...i.wouldNeed?.length?{wouldNeed:i.wouldNeed}:{}})}let u=i.ops??[],h=u[0]?.seq;return h!==void 0&&h>M+1&&(u=await Ee(M)),r!==void 0&&(i.batch&&E.set(r,i.batch),ae(r)),q(u,r!==void 0?[r]:[]),{ops:i.ops??[],...i.batch?{batch:i.batch}:{}}},I,ee=!1,te=!1,Ae=0,ge,Ue=0,Me=0,Re=null,le=()=>{},Ve=new Promise(t=>{le=t}),m=()=>p&&ee&&I?.readyState===Eo,_=t=>{if(!m())return!1;try{return I.send(JSON.stringify(t)),!0}catch{return!1}},ue=(t=!1)=>{!V||!m()||!P()||!t&&Re&&Rt(V,Re)&&(g===void 0||Date.now()-Me<g)||_({t:"here",presence:V})&&(Re=V,Me=Date.now())},we=new Set,Q,Qt=()=>{if(Q=void 0,v!==void 0)return;let t=[...H.entries()].filter(([r])=>we.has(r));we.clear();for(let[,r]of t)_(r.message)},Zt=(t,r)=>{H.has(t)&&(we.add(t),Q&&clearTimeout(Q),Q=setTimeout(Qt,Math.max(0,r)))},Fr=t=>{H.has(t)&&we.add(t)},Ke=(t,r)=>new Promise((s,i)=>{let u=r??`send-${++Ue}`,h=t.undo?{t:"undo",cid:u,batches:t.undo,...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.via?{via:t.via}:{},...Se(t)}:{t:"call",cid:u,calls:t.calls??[],...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.base?.length?{base:t.base}:{},...t.via?{via:t.via}:{},...Se(t)};if(H.set(u,{message:h,...r!==void 0?{mine:r}:{},resolve:s,reject:i}),we.size>0||v!==void 0){we.add(u);return}_(h)}),ht=(t,r)=>m()?Ke(t,r):pt(t,r),Or=t=>{switch(t.t){case"welcome":{if(Xt(t.build),typeof t.version=="number"&&t.version!==T.version){wt(t.version);return}if(ee=!0,Ae=0,typeof t.participant=="string"&&(U=t.participant),f(t.held),q(t.ops??[]),we.clear(),Q&&clearTimeout(Q),Q=void 0,v!==void 0)for(let r of H.keys())we.add(r);else for(let r of H.values())_(r.message);ue(!0),Z("online"),le();return}case"ops":q(t.ops??[]);return;case"ack":{let r=H.get(t.cid);if(!r){q(t.ops??[]);return}H.delete(t.cid),Le=0,r.mine!==void 0&&(E.set(r.mine,t.batch),ae(r.mine)),q(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=H.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){v!==void 0?Fr(t.cid):Zt(t.cid,Ut(e.backoff,Le++));return}H.delete(t.cid),r.reject(t.t==="conflict"?new Fe(t.sentence,t.conflicts??[]):new De({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&Zt(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":he(t.who??[]);return;case"held":f(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==T.version&&wt(t.version);return;case"reload":rn(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&I){let r=I;an(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},de=!1,yt=a.declarations,gt=a.builds,Xt=t=>{if(!(de||a.otherBuild!==void 0||!e.build||typeof t!="string"||t.length===0||t===e.build)){a.otherBuild=t;for(let r of[...gt])r(t)}},en=()=>{let t=[],r=0;for(let s of B){let i=ce.get(s);i?t.push({calls:i.calls,...i.intent?{intent:i.intent}:{},...i.via?{via:i.via}:{},...Se(i),batch:s}):r++}return{carried:t,undos:r}},tn=(t,r)=>`${r} while ${t===1?"an undo of yours was":"undos of yours were"} on the way; ${t===1?"it was":"they were"} not made.`,nn=t=>{de=!0,V=null;let r=new He(t);for(let i of H.values())i.reject(r);H.clear(),Qe&&clearInterval(Qe),te=!0,ge&&clearTimeout(ge),Q&&clearTimeout(Q),fe&&clearTimeout(fe);for(let i of R.splice(0))i.give(r);for(let i of ne.splice(0))i();let s=I;I=void 0,ee=!1;try{s?.close(1e3,t)}catch{}le()};async function wt(t){if(de)return;if(!e.resolveApp){rn(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:s}=en(),i=e.resolveApp,u=V;nn("The app was changed.");try{let h=await i(t),{state:D,...w}=e,Ie=await Rr({...w,app:h},r,"The app was changed while your changes were on the way.",a);u&&Ie.remote.presence.here(u);for(let Ze of[...yt])Ze(Ie.remote,t);let Dr=[...s>0?[Je(tn(s,"The app was changed"))]:[],...Ie.unheard()];for(let Ze of Dr)for(let Nr of Be)Nr(Ze.sentence,Ze)}catch(h){let D=`The app was changed, but the new version could not be opened: ${h instanceof Error?h.message:String(h)}`;for(let w of Be)w(D,Je(D))}}function rn(t){if(de)return;let{carried:r,undos:s}=en();nn(t);let i=!1;if(e.carry&&r.length>0)try{e.carry.storage.setItem(e.carry.key,JSON.stringify(r)),i=!0}catch{}let u=[];!i&&r.length>0&&u.push(`${t} ${r.length===1?"A change of yours was":`${r.length} changes of yours were`} not sent; make ${r.length===1?"it":"them"} again after the page reloads.`),s>0&&u.push(tn(s,"This app was updated"));for(let h of u)for(let D of Be)D(h,Je(h));(e.reloadPage??Ro)()}let on=()=>{if(te||!p)return;let t=`${e.url.replace(/^http/,"ws").replace(/\/$/,"")}${Pr}`,{"content-type":r,...s}=l,i;try{i=e.socket?e.socket(t,s,[Gt]):Hr(t,s)}catch{return sn()}I=i,ee=!1,i.onopen=()=>{I===i&&i.send(JSON.stringify({t:"hello",seq:M,protocol:Xe,wire:zt,opFormat:_e.op,...e.build?{build:e.build.slice(0,64)}:{},...e.hostProtocol!==void 0?{hostProtocol:e.hostProtocol}:{}}))},i.onmessage=u=>{if(I!==i)return;let h;try{h=JSON.parse(String(u.data))}catch{return}Or(h)},i.onclose=()=>an(i),i.onerror=()=>{}},fe,Cr=()=>{$=!1,fe&&clearTimeout(fe),fe=setTimeout(()=>{if(fe=void 0,$||te)return;let t=new Map([...G].filter(([,r])=>r.held!=="socket"));if(t.size!==G.size){G=t;for(let r of ie)r([...G.values()])}},1e4),fe.unref?.()};function an(t){if(I!==t)return;let r=ee;I=void 0,ee=!1,Re=null,r&&(Z("offline"),Cr()),sn()}let sn=()=>{if(te)return;let t=Ut(e.backoff,Ae);Ae++,ge=setTimeout(on,t)},Lr=x.applyAll.bind(x),Mr=x.undo.bind(x),Vr=x.previewAll.bind(x);x.previewAll=(t,r)=>Vr(t,{...e.principal?{author:e.principal}:{},...r});let Be=a.refusals,$e=[],Je=t=>({reason:"invalid",sentence:t}),Ye=a.conflicts,vt=!1,dn=async(t,r)=>{if(r instanceof He||de)return;let s=r instanceof De?r.refusal:ln(r),i=s.sentence;ae(t);try{q([],[t])}catch{}let u=ce.get(t);if(ce.delete(t),r instanceof Fe&&S.conflicts++,r instanceof Fe&&!m()&&await Y().catch(()=>[]),r instanceof Fe&&Ye.size>0){let h=!1,D={sentence:i,conflicts:r.conflicts,keepTheirs(){h=!0},useMine(){if(!(h||!u)){h=!0,vt=!0;try{x.applyAll(u.calls,{...u.intent?{intent:u.intent}:{},...u.via?{via:u.via}:{},...Se(u)})}finally{vt=!1}}}};for(let w of Ye)w(D);return}for(let h of Be)h(i,s)};x.applyAll=(t,r)=>{let s=un(x.log.all().filter(h=>K.has(h.batch))),i=Lr(t,{...e.principal?{author:e.principal}:{},...r});B.push(i.batch),K.add(i.batch),ce.set(i.batch,{calls:t,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...Se(r)});let u=vt?[]:O.baseFor(i.ops,s);return Ce.set(i.batch,Pe(ht({calls:t,...r?.intent?{intent:r.intent}:{},batch:i.batch,...u.length>0?{base:u}:{},...r?.via?{via:r.via}:{},...Se(r)},i.batch).catch(h=>dn(i.batch,h)))),i},x.apply=(t,r)=>x.applyAll([t],r),x.undo=(t,r)=>{let s=typeof t=="string"?[t]:t,i=Mr(s.map(h=>E.get(h)??h),{...e.principal?{author:e.principal}:{},...r});B.push(i.batch),K.add(i.batch);let u=Promise.allSettled(s.map(h=>Ce.get(h)));return Ce.set(i.batch,Pe(u.then(()=>ht({undo:s.map(h=>E.get(h)??h),...r?.intent?{intent:r.intent}:{},batch:i.batch,...r?.via?{via:r.via}:{},...Se(r)},i.batch)).catch(h=>dn(i.batch,h)))),i};let Br=async(t,r={})=>{bt++;try{return(await Pe(ht({calls:t,...r}))).ops}finally{bt--}},bt=0,cn={here(t){V=t,ue()},onWho(t){return ie.add(t),G.size>0&&t([...G.values()]),()=>{ie.delete(t)}},leave(){if(!V)return;let t=JSON.stringify({participant:U??V.participant});if(V=null,_({t:"bye"}))return;let r=globalThis.navigator?.sendBeacon;r?r.call(globalThis.navigator,`${e.url}/graview/leave`,t):d(`${e.url}/graview/leave`,{method:"POST",headers:l,body:t}).catch(()=>{})}},St=e.pollMs??800,Qe=St>0&&typeof setInterval=="function"?setInterval(()=>{m()||Y().catch(()=>{})},St):null;if(p){on();let t;await Promise.race([Ve,new Promise(r=>t=setTimeout(r,e.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!de){let t=[],r=new Set(x.log.all().map(s=>s.batch));for(let s of n)if(!(s.batch!==void 0&&r.has(s.batch)))try{x.applyAll(s.calls,{...s.intent?{intent:s.intent}:{},...s.batch?{batch:s.batch}:{},...s.via?{via:s.via}:{},...Se(s)})}catch(i){t.push(go(s,i))}t.length>0&&$e.push(Je(`${o} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}return{remote:{store:x,version:T.version,migrated:T.migrated??[],send:Br,pull:Y,onRefusal(t){Be.add(t);let r=$e;$e=[];for(let s of r)t(s.sentence,s);return()=>Be.delete(t)},onDeclaration(t){return yt.add(t),()=>yt.delete(t)},onBuild(t){return gt.add(t),a.otherBuild!==void 0&&t(a.otherBuild),()=>gt.delete(t)},onConflict(t){return Ye.add(t),()=>Ye.delete(t)},revision:(t,r)=>O.of(t,r),seq:()=>M,participant:()=>U,transport:()=>m()?"socket":"poll",status:ke,onStatus(t){return k.add(t),()=>k.delete(t)},held:()=>v,onHeld(t){return a.helds.add(t),v!==void 0&&t(v),()=>a.helds.delete(t)},counters:()=>({...S}),who:()=>[...G.values()],pending:()=>B.length+bt,async settled(){for(;se.size>0;)await Promise.allSettled([...se])},presence:cn,close(){Qe&&clearInterval(Qe),F(),cn.leave(),te=!0,ge&&clearTimeout(ge),Q&&clearTimeout(Q),fe&&clearTimeout(fe);for(let r of R.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of ne.splice(0))r();let t=I;I=void 0,ee=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=$e;return $e=[],t}};function Hr(t,r){let s=globalThis.WebSocket;if(!s)throw new Error("This runtime has no WebSocket; the client polls instead.");let i=typeof globalThis.document<"u",u=e.subprotocol?[Gt]:[];if(!i)try{return new s(t,{headers:r,...u.length>0?{protocols:u}:{}})}catch{}let h=new URL(t);for(let[D,w]of Object.entries(b))h.searchParams.set(D,w);return u.length>0?new s(h.toString(),u):new s(h.toString())}}function Ao(e,n,o=Date.now()){let a,d=e?.trim();if(d)if(/^\d+(\.\d+)?$/.test(d))a=Number(d)*1e3;else{let p=Date.parse(d);Number.isFinite(p)&&(a=Math.max(0,p-o))}let l=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,b=l!==void 0&&l<50&&a!==void 0&&Math.abs(l*1e3-a)<1e3;return l!==void 0&&!b?l:a??1e3}function Ro(){globalThis.location?.reload?.()}function To(){return globalThis.document?.visibilityState!=="hidden"}function Ut(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:o=250,max:a=1e4,factor:d=2}=e??{};return Math.min(a,o*d**n)*(.75+Math.random()*.5)}function ft(e){let n={};if(!e)return n;e.id&&(n[me.seat]=e.id),e.roles?.length&&(n[me.roles]=e.roles.join(",")),e.kind!=="human"&&(n[me.kind]=e.kind),e.name&&(n[me.name]=encodeURIComponent(e.name));let o=e.onBehalfOf;return o?.id&&(n[me.for]=o.id),o?.roles?.length&&(n[me.forRoles]=o.roles.join(",")),o?.name&&(n[me.forName]=encodeURIComponent(o.name)),n}var Tr="/graview/views";function Kt(e){let n=e.fetch??fetch,o=e.url.replace(/\/$/,""),a={"content-type":"application/json",...e.principal?ft(e.principal):{},...e.headers??{}},d=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??et.may}:et,l=new Set,b=k=>{if(JSON.stringify(k)!==JSON.stringify(d)){d=k;for(let S of l)S()}},p=async(k,S)=>{let R=await n(`${o}${e.path??Tr}`,{method:k,headers:a,...S!==void 0?{body:JSON.stringify(S)}:{}}),v=await R.json();if(!R.ok)throw new Error(v.error??`The store answered ${R.status}.`);b({hidden:v.hidden??[],removed:v.removed??[],may:v.may??et.may})},g=()=>p("GET"),P=e.state?Promise.resolve():g().catch(()=>{}),A=e.pollMs?setInterval(()=>void g().catch(()=>{}),e.pollMs):void 0;return{ready:P,refresh:g,close:()=>clearInterval(A),current:()=>d,onChange(k){return l.add(k),()=>void l.delete(k)},hide:k=>p("POST",{hide:k}),show:k=>p("POST",{show:k}),remove:(k,S)=>p("POST",{remove:k,...S?{about:S}:{}}),async restore(k){let S=d.removed.find(R=>R.name===k)?.lens;await p("POST",{restore:k}),S&&await e.onDeclaration?.()},async lens(k){await p("POST",{lens:k}),await e.onDeclaration?.()}}}var Yt=document.getElementById("graview-app"),Jt=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),xr=Jt?(__graviewPreload(import.meta.url,["./chunk.UR3XYOQ6.js","./chunk.WQONZBA3.js","./chunk.UGFDSE37.js","./chunk.NWA7Q6CI.js","./chunk.WP5W44Y4.js","./chunk.M5GJHVWZ.js","./chunk.HZCA3UWJ.js","./chunk.JBW3DI7E.js","./chunk.AGIO2GRV.js","./chunk.NIVTK2W5.js","./chunk.6QYJ2K6K.js","./chunk.3MMLRSRC.js","./chunk.DQOCBKC3.js","./chunk.OHSJQYJN.js","./chunk.DEUTHHGI.js","./chunk.EPUBSKKL.js","./chunk.ATDU5Y7V.js","./chunk.AQQZY6OY.js","./chunk.BCWPV4WR.js","./chunk.Y5ARSVH4.js","./chunk.PKUDIWIF.js","./chunk.VW2VCPJX.js","./chunk.IW7YFPGG.js","./chunk.MB7LKKUD.js","./chunk.JT3IZIU5.js","./chunk.S5MQVPLF.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.6MADC6DM.js","./chunk.OJGHDWI6.js","./chunk.JLEC3USG.js","./chunk.HDRD33II.js","./chunk.DX357TZ3.js","./chunk.H7KCWCB4.js","./chunk.XSNAG4JT.js","./chunk.XWAMQPUM.js","./chunk.SDO3U72B.js","./chunk.AS4CQBOQ.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.T7O6K3IN.js")):xe("pages");try{Jt?await xo(decodeURIComponent(Jt[1])):await Fo()}catch(e){let n=document.createElement("pre");n.setAttribute("role","alert"),n.style.cssText="margin:2rem;font:14px/1.5 ui-monospace,monospace;white-space:pre-wrap",n.textContent=e instanceof Error?e.message:String(e),Yt.replaceChildren(n),window.__graviewFailed=n.textContent}async function xo(e){let n=await fetch(`/graview/document?form=${encodeURIComponent(e)}`),o=await n.json();if(!n.ok)throw new Error(o.error??`The preview server did not hand over the form (${n.status}).`);let a=await it(o);if(!a.ok)throw new Error(tt(a.findings));let d=a.app,l=o.principal,b=await ut({app:d,url:location.origin,principal:l,...o.state?{state:o.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=d.forms?.[e]?.title??d.name;let{mount:p}=await xr;window.__graview=p(Yt,{app:d,form:e,principal:l,remote:b,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function Fo(){let e=await fetch("/graview/document");if(!e.ok)throw new Error(`The preview server did not hand over the document (${e.status}).`);let n=await e.json(),a=await(async g=>{if(typeof g.module=="string")return(await import(g.module)).app;let P=await it(g);if(!P.ok)throw new Error(tt(P.findings));return P.app})(n);if(!a||typeof a!="object"||!("schema"in a))throw new Error("The app module the preview server handed does not export an app.");let d=n.principal,l=await ut({app:a,url:location.origin,principal:d,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=a.name;let b,p=Kt({url:location.origin,principal:d,...n.views?{state:n.views}:{},onDeclaration:async()=>{let g=await(await fetch("/graview/document")).json();if(typeof g.module=="string")return;let P=await it(g);P.ok&&b?.setApp(P.app,l)}});await Promise.all([xr,p.ready]),b=qt(Yt,{app:a,remote:l,principal:d,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:a.name,heading:1,keptViews:p,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=b,b.drawn().then(()=>{window.__graviewReady=!0})}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graview",
3
- "version": "0.1.45",
3
+ "version": "0.1.46",
4
4
  "type": "module",
5
5
  "description": "The Graview command line: start a product, check its declaration, write its agent docs, serve its store, preview a document with no product and photograph its places, say whether a product is on one release, host it for an agent over MCP, apply an act to it, sync its seed, install the authoring skills. The tool; @graview/* is the framework.",
6
6
  "keywords": [
@@ -29,11 +29,11 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@graview/core": "0.1.45",
33
- "@graview/ship": "0.1.45",
34
- "@graview/tools": "0.1.45",
35
- "@graview/skills": "0.1.45",
36
- "@graview/guest": "0.1.45"
32
+ "@graview/core": "0.1.46",
33
+ "@graview/guest": "0.1.46",
34
+ "@graview/tools": "0.1.46",
35
+ "@graview/ship": "0.1.46",
36
+ "@graview/skills": "0.1.46"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=22"
@@ -1,49 +0,0 @@
1
- import{b as Dt,c as ae,d as kt,e as Ft}from"./chunk.K46YRA65.js";import{a as Ct,b as Ce,c as Lt}from"./chunk.UJKT2G6M.js";import{m as Pt}from"./chunk.DLFWBG33.js";import{g as gt}from"./chunk.2YABX3SC.js";import{a as mt}from"./chunk.V5FIZIX2.js";import{d as yt}from"./chunk.DX357TZ3.js";import{d as pt}from"./chunk.H7KCWCB4.js";import{F as Et,G as xt,i as ht,j as Tr,s as vt,t as Rt,w as wt,x as St,y as bt}from"./chunk.6BJBPDF3.js";import{$ as ft,G as A,O as dt,R as Z}from"./chunk.XWAMQPUM.js";import{Wa as rt,Xc as ot,Yc as it,Zc as lt,ea as Pe,ha as ce,jc as at,md as st,nd as ut,od as ct,vc as nt}from"./chunk.AS4CQBOQ.js";import{b as D}from"./chunk.AJZBJBMO.js";function Nr(e,t){return ot(e,t).slice(1)}function de(e,t){return e.kinds.find(r=>Nr(e,r)===t)}function Pn(e,t,r){return it(e,t,r)}function Cn(e,t){return lt(e,t)}var _=D(A(),1),g=D(A(),1),x=D(A(),1),Ye=D(A(),1),fr=D(A(),1),S=D(A(),1),en=D(A(),1),tn=D(A(),1),rn=D(A(),1),v=D(A(),1),xr=D(A(),1);var Oe=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Ht=/^[\\/]{2}/;function Mr(e,t){return t+e.replace(/\\/g,"/")}var Tt="popstate";function ye(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function Ut(e={}){let{initialEntries:t=["/"],initialIndex:r,v5Compat:a=!1}=e,n;n=t.map((h,y)=>c(h,typeof h=="string"?null:h.state,y===0?"default":void 0,typeof h=="string"?void 0:h.mask));let o=s(r??n.length-1),i="POP",l=null;function s(h){return Math.min(Math.max(h,0),n.length-1)}function u(){return n[o]}function c(h,y=null,p,f){let R=ge(n?u().pathname:"/",h,y,p,f);return M(R.pathname.charAt(0)==="/",`relative pathnames are not supported in memory history: ${JSON.stringify(h)}`),R}function d(h){return typeof h=="string"?h:B(h)}return{get index(){return o},get action(){return i},get location(){return u()},createHref:d,createURL(h){return new URL(d(h),"http://localhost")},encodeLocation(h){let y=typeof h=="string"?Y(h):h;return{pathname:y.pathname||"",search:y.search||"",hash:y.hash||""}},push(h,y){i="PUSH";let p=ye(h)?h:c(h,y);o+=1,n.splice(o,n.length,p),a&&l&&l({action:i,location:p,delta:1})},replace(h,y){i="REPLACE";let p=ye(h)?h:c(h,y);n[o]=p,a&&l&&l({action:i,location:p,delta:0})},go(h){i="POP";let y=s(o+h),p=n[y];o=y,l&&l({action:i,location:p,delta:h})},listen(h){return l=h,()=>{l=null}}}}function jt(e={}){function t(a,n){let o=n.state?.masked,{pathname:i,search:l,hash:s}=o||a.location;return ge("",{pathname:i,search:l,hash:s},n.state&&n.state.usr||null,n.state&&n.state.key||"default",o?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function r(a,n){return typeof n=="string"?n:B(n)}return Ar(t,r,null,e)}function L(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function M(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Or(){return Math.random().toString(36).substring(2,10)}function Nt(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function ge(e,t,r=null,a,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Y(t):t,state:r,key:t&&t.key||a||Or(),mask:n}}function B({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Y(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function Ar(e,t,r,a={}){let{window:n=document.defaultView,v5Compat:o=!1}=a,i=n.history,l="POP",s=null,u=c();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function c(){return(i.state||{idx:null}).idx}function d(){l="POP";let f=c(),R=f==null?null:f-u;u=f,s&&s({action:l,location:p.location,delta:R})}function m(f,R){l="PUSH";let w=ye(f)?f:ge(p.location,f,R);r&&r(w,f),u=c()+1;let b=Nt(w,u),P=p.createHref(w.mask||w);try{i.pushState(b,"",P)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;n.location.assign(P)}o&&s&&s({action:l,location:p.location,delta:1})}function h(f,R){l="REPLACE";let w=ye(f)?f:ge(p.location,f,R);r&&r(w,f),u=c();let b=Nt(w,u),P=p.createHref(w.mask||w);i.replaceState(b,"",P),o&&s&&s({action:l,location:p.location,delta:0})}function y(f){return _r(n,f)}let p={get action(){return l},get location(){return e(n,i)},listen(f){if(s)throw new Error("A history only accepts one active listener");return n.addEventListener(Tt,d),s=f,()=>{n.removeEventListener(Tt,d),s=null}},createHref(f){return t(n,f)},createURL:y,encodeLocation(f){let R=y(f);return{pathname:R.pathname,search:R.search,hash:R.hash}},push:m,replace:h,go(f){return i.go(f)}};return p}function _r(e,t,r=!1){let a="http://localhost";e&&(a=e.location.origin!=="null"?e.location.origin:e.location.href),L(a,"No window.location.(origin|href) available to create URL");let n=typeof t=="string"?t:B(t);return n=n.replace(/ $/,"%20"),!r&&Ht.test(n)&&(n=a+n),new URL(n,a)}var $r;$r=new WeakMap;function Ae(e,t,r="/"){return Ir(e,t,r,!1)}function Ir(e,t,r,a,n){let o=typeof t=="string"?Y(t):t,i=U(o.pathname||"/",r);if(i==null)return null;let l=n??Ur(e),s=null,u=Qr(i);for(let c=0;s==null&&c<l.length;++c)s=Xr(l[c],u,a);return s}function Hr(e,t){let{route:r,pathname:a,params:n}=e;return{id:r.id,pathname:a,params:n,data:t[r.id],loaderData:t[r.id],handle:r.handle}}function Ur(e){let t=zt(e);return jr(t),t}function zt(e,t=[],r=[],a="",n=!1){let o=(i,l,s=n,u)=>{let c={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(c.relativePath.startsWith("/")){if(!c.relativePath.startsWith(a)&&s)return;L(c.relativePath.startsWith(a),`Absolute route path "${c.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(a.length)}let d=H([a,c.relativePath]),m=r.concat(c);i.children&&i.children.length>0&&(L(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),zt(i.children,t,m,d,s)),!(i.path==null&&!i.index)&&t.push({path:d,score:Kr(d,i.index),routesMeta:m.map((h,y)=>{let[p,f]=Yt(h.relativePath,h.caseSensitive,y===m.length-1);return{...h,matcher:p,compiledParams:f}})})};return e.forEach((i,l)=>{if(i.path===""||!i.path?.includes("?"))o(i,l);else for(let s of Bt(i.path))o(i,l,!0,s)}),t}function Bt(e){let t=e.split("/");if(t.length===0)return[];let[r,...a]=t,n=r.endsWith("?"),o=r.replace(/\?$/,"");if(a.length===0)return n?[o,""]:[o];let i=Bt(a.join("/")),l=[];return l.push(...i.map(s=>s===""?o:[o,s].join("/"))),n&&l.push(...i),l.map(s=>e.startsWith("/")&&s===""?"/":s)}function jr(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Gr(t.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var zr=/^:[\w-]+$/,Br=3,Wr=2,Yr=1,Vr=10,Jr=-2,Mt=e=>e==="*";function Kr(e,t){let r=e.split("/"),a=r.length;return r.some(Mt)&&(a+=Jr),t&&(a+=Wr),r.filter(n=>!Mt(n)).reduce((n,o)=>n+(zr.test(o)?Br:o===""?Yr:Vr),a)}function Gr(e,t){return e.length===t.length&&e.slice(0,-1).every((a,n)=>a===t[n])?e[e.length-1]-t[t.length-1]:0}function Xr(e,t,r=!1){let{routesMeta:a}=e,n={},o="/",i=[];for(let l=0;l<a.length;++l){let s=a[l],u=l===a.length-1,c=o==="/"?t:t.slice(o.length)||"/",d={path:s.relativePath,caseSensitive:s.caseSensitive,end:u},m=s.matcher&&s.compiledParams?Wt(d,c,s.matcher,s.compiledParams):oe(d,c),h=s.route;if(!m&&u&&r&&!a[a.length-1].route.index&&(m=oe({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},c)),!m)return null;Object.assign(n,m.params),i.push({params:n,pathname:H([o,m.pathname]),pathnameBase:Zr(H([o,m.pathnameBase])),route:h}),m.pathnameBase!=="/"&&(o=H([o,m.pathnameBase]))}return i}function oe(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=Yt(e.path,e.caseSensitive,e.end);return Wt(e,t,r,a)}function Wt(e,t,r,a){let n=t.match(r);if(!n)return null;let o=n[0],i=ee(o,1),l=n.slice(1);return{params:a.reduce((u,{paramName:c,isOptional:d},m)=>{if(c==="*"){let y=l[m]||"";i=ee(o.slice(0,o.length-y.length),1)}let h=l[m];return d&&!h?u[c]=void 0:u[c]=(h||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function Yt(e,t=!1,r=!0){M(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,s,u,c)=>{if(a.push({paramName:l,isOptional:s!=null}),s){let d=c.charAt(u+i.length);return d&&d!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,t?void 0:"i"),a]}function Qr(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return M(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function U(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function Vt(e,t="/"){let{pathname:r,search:a="",hash:n=""}=typeof e=="string"?Y(e):e,o;return r?(r=Jt(r),r.startsWith("/")||r.startsWith("\\")?o=Ot(r.substring(1),"/"):o=Ot(r,t)):o=t,{pathname:o,search:ea(a),hash:ta(n)}}function Ot(e,t){let r=ee(t).split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function Le(e,t,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function qr(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function _e(e){let t=qr(e);return t.map((r,a)=>a===t.length-1?r.pathname:r.pathnameBase)}function we(e,t,r,a=!1){let n;typeof e=="string"?n=Y(e):(n={...e},L(!n.pathname||!n.pathname.includes("?"),Le("?","pathname","search",n)),L(!n.pathname||!n.pathname.includes("#"),Le("#","pathname","hash",n)),L(!n.search||!n.search.includes("#"),Le("#","search","hash",n)));let o=e===""||n.pathname==="",i=o?"/":n.pathname,l;if(i==null)l=r;else{let d=t.length-1;if(!a&&i.startsWith("..")){let m=i.split("/");for(;m[0]==="..";)m.shift(),d-=1;n.pathname=m.join("/")}l=d>=0?t[d]:"/"}let s=Vt(n,l),u=i&&i!=="/"&&i.endsWith("/"),c=(o||i===".")&&r.endsWith("/");return!s.pathname.endsWith("/")&&(u||c)&&(s.pathname+="/"),s}var Jt=e=>e.replace(/[\\/]{2,}/g,"/"),H=e=>Jt(e.join("/"));function ee(e,t=0){let r=e.length;for(;r>t&&e.charCodeAt(r-1)===47;)r--;return r===e.length?e:e.slice(0,r)}var Zr=e=>ee(e).replace(/^\/*/,"/"),ea=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ta=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;var Kt=class{constructor(e,t,r,a=!1){this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Gt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function ra(e){let t=e.map(r=>r.route.path).filter(Boolean);return H(t)||"/"}var Xt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Qt(e,t){let r=e;if(typeof r!="string"||!Oe.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,n=!1;if(Xt)try{let o=new URL(window.location.href),i=Ht.test(r)?new URL(Mr(r,o.protocol)):new URL(r),l=U(i.pathname,t);i.origin===o.origin&&l!=null?r=l+i.search+i.hash:n=!0}catch{M(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:n,to:r}}var Dn=Symbol("Uninstrumented");var kn=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var At=new URL("http://localhost");function $e(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),At)}catch{return At}}function De(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}function aa(e,t){if(e.startsWith("//"))return!0;let r=t.protocol.toLowerCase();return e.toLowerCase().startsWith(r)?t.host===""||e.slice(r.length).startsWith("//"):!1}function Ie(e,t,r,a){let n=null;try{n=e==null?null:new URL(e,r)}catch{}let o=new URL(t,r),i=n!=null&&!De(n,r),l=!De(o,r);if(a==="reject"){if(i||l)throw new Error("External navigation is not allowed")}else if(l&&(n==null||!aa(e,n)||!De(n,o)))throw new Error("External navigation is not allowed")}var qt=["POST","PUT","PATCH","DELETE"],Fn=new Set(qt),na=["GET",...qt],Tn=new Set(na);var Nn=Symbol("ResetLoaderData"),oa,ia,la,sa;oa=new WeakMap;ia=new WeakMap;la=new WeakMap;sa=new WeakMap;var ua=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function ca(e){try{return ua.includes(new URL(e).protocol)}catch{return!1}}var K=_.createContext(null);K.displayName="DataRouter";var te=_.createContext(null);te.displayName="DataRouterState";var Zt=_.createContext(!1);function da(){return _.useContext(Zt)}var He=_.createContext({isTransitioning:!1});He.displayName="ViewTransition";var er=_.createContext(new Map);er.displayName="Fetchers";var fa=_.createContext(null);fa.displayName="Await";var N=_.createContext(null);N.displayName="Navigation";var G=_.createContext(null);G.displayName="Location";var I=_.createContext({outlet:null,matches:[],isDataRoute:!1});I.displayName="Route";var Ue=_.createContext(null);Ue.displayName="RouteError";var Te=!0,tr="REACT_ROUTER_ERROR",ha="REDIRECT",ma="ROUTE_ERROR_RESPONSE";function pa(e){if(e.startsWith(`${tr}:${ha}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function ya(e){if(e.startsWith(`${tr}:${ma}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Kt(t.status,t.statusText,t.data)}catch{}}function Se(e,{relative:t}={}){L(X(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=g.useContext(N),{hash:n,pathname:o,search:i}=re(e,{relative:t}),l=o;return r!=="/"&&(l=o==="/"?r:H([r,o])),a.createHref({pathname:l,search:i,hash:n})}function X(){return g.useContext(G)!=null}function T(){return L(X(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(G).location}function ga(){return g.useContext(G).navigationType}var rr="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function ar(e){g.useContext(N).static||g.useLayoutEffect(e)}function Q(){let{isDataRoute:e}=g.useContext(I);return e?Da():va()}function va(){L(X(),"useNavigate() may be used only in the context of a <Router> component.");let e=g.useContext(K),{basename:t,navigator:r}=g.useContext(N),{matches:a}=g.useContext(I),{pathname:n}=T(),o=JSON.stringify(_e(a)),i=g.useRef(!1);return ar(()=>{i.current=!0}),g.useCallback((s,u={})=>{if(M(i.current,rr),!i.current)return;if(typeof s=="number"){r.go(s);return}let c=we(s,JSON.parse(o),n,u.relative==="path");e==null&&t!=="/"&&(c.pathname=c.pathname==="/"?t:H([t,c.pathname])),Ie(typeof s=="string"?s:B(s),r.createHref(c),$e(r),"reject"),(u.replace?r.replace:r.push)(c,u.state,u)},[t,r,o,n,e])}var Mn=g.createContext(null);function Ra(){let{matches:e}=g.useContext(I);return e[e.length-1]?.params??{}}function re(e,{relative:t}={}){let{matches:r}=g.useContext(I),{pathname:a}=T(),n=JSON.stringify(_e(r));return g.useMemo(()=>we(e,JSON.parse(n),a,t==="path"),[e,n,a,t])}function nr(e,t){return or(e,t)}function or(e,t,r){L(X(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=g.useContext(N),{matches:n}=g.useContext(I),o=n[n.length-1],i=o?o.params:{},l=o?o.pathname:"/",s=o?o.pathnameBase:"/",u=o&&o.route;if(Te){let f=u&&u.path||"";ur(l,!u||f.endsWith("*")||f.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${f}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
2
-
3
- Please change the parent <Route path="${f}"> to <Route path="${f==="/"?"*":`${f}/*`}">.`)}let c=T(),d;if(t){let f=typeof t=="string"?Y(t):t;L(s==="/"||f.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${f.pathname}" was given in the \`location\` prop.`),d=f}else d=c;let m=d.pathname||"/",h=m;if(s!=="/"){let f=s.replace(/^\//,"").split("/");h="/"+m.replace(/^\//,"").split("/").slice(f.length).join("/")}let y=r&&r.state.matches.length?r.state.matches.map(f=>Object.assign(f,{route:r.manifest[f.route.id]||f.route})):Ae(e,{pathname:h});Te&&(M(u||y!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),M(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`));let p=xa(y&&y.map(f=>Object.assign({},f,{params:Object.assign({},i,f.params),pathname:H([s,a.encodeLocation?a.encodeLocation(f.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:f.pathname]),pathnameBase:f.pathnameBase==="/"?s:H([s,a.encodeLocation?a.encodeLocation(f.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:f.pathnameBase])})),n,r);return t&&p?g.createElement(G.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...d},navigationType:"POP"}},p):p}function wa(){let e=sr(),t=Gt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",n={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},i=null;return Te&&(console.error("Error handled by React Router default ErrorBoundary:",e),i=g.createElement(g.Fragment,null,g.createElement("p",null,"\u{1F4BF} Hey developer \u{1F44B}"),g.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",g.createElement("code",{style:o},"ErrorBoundary")," or"," ",g.createElement("code",{style:o},"errorElement")," prop on your route."))),g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),r?g.createElement("pre",{style:n},r):null,i)}var Sa=g.createElement(wa,null),ir=class extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=ya(e.digest);r&&(e=r)}let t=e!==void 0?g.createElement(I.Provider,{value:this.props.routeContext},g.createElement(Ue.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?g.createElement(ba,{error:e},t):t}};ir.contextType=Zt;var ke=new WeakMap;function ba({children:e,error:t}){let{basename:r,navigator:a}=g.useContext(N);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let n=pa(t.digest);if(n){let o=ke.get(t);if(o)throw o;let i=Qt(n.location,r),l=i.absoluteURL||i.to;if(Ie(n.location,l,$e(a),"allow-explicit"),ca(l))throw new Error("Invalid redirect location");if(Xt&&!ke.get(t))if(i.isExternal||n.reloadDocument)window.location.href=l;else{let s=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:n.replace}));throw ke.set(t,s),s}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l}`})}}return e}function Ea({routeContext:e,match:t,children:r}){let a=g.useContext(K);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(I.Provider,{value:e},r)}function xa(e,t=[],r){let a=r?.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let n=e,o=a?.errors;if(o!=null){let c=n.findIndex(d=>d.route.id&&o?.[d.route.id]!==void 0);L(c>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),n=n.slice(0,Math.min(n.length,c+1))}let i=!1,l=-1;if(r&&a){i=a.renderFallback;for(let c=0;c<n.length;c++){let d=n[c];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(l=c),d.route.id){let{loaderData:m,errors:h}=a,y=d.route.loader&&!m.hasOwnProperty(d.route.id)&&(!h||h[d.route.id]===void 0);if(d.route.lazy||y){r.isStatic&&(i=!0),l>=0?n=n.slice(0,l+1):n=[n[0]];break}}}}let s=r?.onError,u=a&&s?(c,d)=>{s(c,{location:a.location,params:a.matches?.[0]?.params??{},pattern:ra(a.matches),errorInfo:d})}:void 0;return n.reduceRight((c,d,m)=>{let h,y=!1,p=null,f=null;a&&(h=o&&d.route.id?o[d.route.id]:void 0,p=d.route.errorElement||Sa,i&&(l<0&&m===0?(ur("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,f=null):l===m&&(y=!0,f=d.route.hydrateFallbackElement||null)));let R=t.concat(n.slice(0,m+1)),w=()=>{let b;return h?b=p:y?b=f:d.route.Component?b=g.createElement(d.route.Component,null):d.route.element?b=d.route.element:b=c,g.createElement(Ea,{match:d,routeContext:{outlet:c,matches:R,isDataRoute:a!=null},children:b})};return a&&(d.route.ErrorBoundary||d.route.errorElement||m===0)?g.createElement(ir,{location:a.location,revalidation:a.revalidation,component:p,error:h,children:w(),routeContext:{outlet:null,matches:R,isDataRoute:!0},onError:u}):w()},null)}function je(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Pa(e){let t=g.useContext(K);return L(t,je(e)),t}function ze(e){let t=g.useContext(te);return L(t,je(e)),t}function Ca(e){let t=g.useContext(I);return L(t,je(e)),t}function Be(e){let t=Ca(e),r=t.matches[t.matches.length-1];return L(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function La(){return Be("useRouteId")}function lr(){let e=ze("useNavigation");return g.useMemo(()=>{let{matches:t,historyAction:r,...a}=e.navigation;return a},[e.navigation])}function We(){let{matches:e,loaderData:t}=ze("useMatches");return g.useMemo(()=>e.map(r=>Hr(r,t)),[e,t])}function sr(){let e=g.useContext(Ue),t=ze("useRouteError"),r=Be("useRouteError");return e!==void 0?e:t.errors?.[r]}function Da(){let{router:e}=Pa("useNavigate"),t=Be("useNavigate"),r=g.useRef(!1);return ar(()=>{r.current=!0}),g.useCallback(async(n,o={})=>{M(r.current,rr),r.current&&(typeof n=="number"?await e.navigate(n):await e.navigate(n,{fromRouteId:t,...o}))},[e,t])}var _t={};function ur(e,t,r){!t&&!_t[e]&&(_t[e]=!0,M(!1,r))}var ka="useOptimistic",On=x[ka];var An=x.memo(Fa);function Fa({routes:e,manifest:t,future:r,state:a,isStatic:n,onError:o}){return or(e,void 0,{manifest:t,state:a,isStatic:n,onError:o,future:r})}function Ta({basename:e,children:t,initialEntries:r,initialIndex:a,useTransitions:n}){let o=x.useRef();o.current==null&&(o.current=Ut({initialEntries:r,initialIndex:a,v5Compat:!0}));let i=o.current,[l,s]=x.useState({action:i.action,location:i.location}),u=x.useCallback(c=>{n===!1?s(c):x.startTransition(()=>s(c))},[n]);return x.useLayoutEffect(()=>i.listen(u),[i,u]),x.createElement(be,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:i,useTransitions:n})}function Na({to:e,replace:t,state:r,relative:a}){L(X(),"<Navigate> may be used only in the context of a <Router> component.");let{static:n,navigator:o}=x.useContext(N);M(!n,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=x.useContext(I),{pathname:l}=T(),s=Q(),u=we(e,_e(i),l,a==="path");Ie(typeof e=="string"?e:B(e),o.createHref(u),$e(o),"reject");let c=JSON.stringify(u);return x.useEffect(()=>{s(JSON.parse(c),{replace:t,state:r,relative:a})},[s,c,a,t,r]),null}function cr(e){L(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function be({basename:e="/",children:t=null,location:r,navigationType:a="POP",navigator:n,static:o=!1,useTransitions:i}){L(!X(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),s=x.useMemo(()=>({basename:l,navigator:n,static:o,useTransitions:i,future:{}}),[l,n,o,i]);typeof r=="string"&&(r=Y(r));let{pathname:u="/",search:c="",hash:d="",state:m=null,key:h="default",mask:y}=r,p=x.useMemo(()=>{let f=U(u,l);return f==null?null:{location:{pathname:f,search:c,hash:d,state:m,key:h,mask:y},navigationType:a}},[l,u,c,d,m,h,a,y]);return M(p!=null,`<Router basename="${l}"> is not able to match the URL "${u}${c}${d}" because it does not start with the basename, so the <Router> won't render anything.`),p==null?null:x.createElement(N.Provider,{value:s},x.createElement(G.Provider,{children:t,value:p}))}function Ma({children:e,location:t}){return nr(ve(e),t)}function ve(e,t=[]){let r=[];return x.Children.forEach(e,(a,n)=>{if(!x.isValidElement(a))return;let o=[...t,n];if(a.type===x.Fragment){r.push.apply(r,ve(a.props.children,o));return}L(a.type===cr,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),L(!a.props.index||!a.props.children,"An index route cannot have child routes.");let i={id:a.props.id||o.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(i.children=ve(a.props.children,o)),r.push(i)}),r}var me="get",pe="application/x-www-form-urlencoded";function Ee(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Oa(e){return Ee(e)&&e.tagName.toLowerCase()==="button"}function Aa(e){return Ee(e)&&e.tagName.toLowerCase()==="form"}function _a(e){return Ee(e)&&e.tagName.toLowerCase()==="input"}function $a(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ia(e,t){return e.button===0&&(!t||t==="_self")&&!$a(e)}function Re(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let a=e[r];return t.concat(Array.isArray(a)?a.map(n=>[r,n]):[[r,a]])},[]))}function Ha(e,t){let r=Re(e);return t&&t.forEach((a,n)=>{r.has(n)||t.getAll(n).forEach(o=>{r.append(n,o)})}),r}var fe=null;function Ua(){if(fe===null)try{new FormData(document.createElement("form"),0),fe=!1}catch{fe=!0}return fe}var ja=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Fe(e){return e!=null&&!ja.has(e)?(M(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${pe}"`),null):e}function za(e,t){let r,a,n,o,i;if(Aa(e)){let l=e.getAttribute("action");a=l?U(l,t):null,r=e.getAttribute("method")||me,n=Fe(e.getAttribute("enctype"))||pe,o=new FormData(e)}else if(Oa(e)||_a(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||l.getAttribute("action");if(a=s?U(s,t):null,r=e.getAttribute("formmethod")||l.getAttribute("method")||me,n=Fe(e.getAttribute("formenctype"))||Fe(l.getAttribute("enctype"))||pe,o=new FormData(l,e),!Ua()){let{name:u,type:c,value:d}=e;if(c==="image"){let m=u?`${u}.`:"";o.append(`${m}x`,"0"),o.append(`${m}y`,"0")}else u&&o.append(u,d)}}else{if(Ee(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=me,a=null,n=pe,i=e}return o&&n==="text/plain"&&(i=o,o=void 0),{action:a,method:r.toLowerCase(),encType:n,formData:o,body:i}}var _n=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Ba={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},Wa=/[&><\u2028\u2029]/g;function $t(e){return e.replace(Wa,t=>Ba[t])}function Ve(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}var Ya=Symbol("SingleFetchRedirect");function dr(e,t,r,a){let n=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?n.pathname.endsWith("/")?n.pathname=`${n.pathname}_.${a}`:n.pathname=`${n.pathname}.${a}`:n.pathname==="/"?n.pathname=`_root.${a}`:t&&U(n.pathname,t)==="/"?n.pathname=`${ee(t)}/_root.${a}`:n.pathname=`${ee(n.pathname)}.${a}`,n}async function Va(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){if(console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode&&import.meta.hot)throw r;return window.location.reload(),new Promise(()=>{})}}function Ja(e){return e!=null&&typeof e.page=="string"}function Ka(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Ga(e,t,r){let a=await Promise.all(e.map(async n=>{let o=t.routes[n.route.id];if(o){let i=await Va(o,r);return i.links?i.links():[]}return[]}));return Za(a.flat(1).filter(Ka).filter(n=>n.rel==="stylesheet"||n.rel==="preload").map(n=>n.rel==="stylesheet"?{...n,rel:"prefetch",as:"style"}:{...n,rel:"prefetch"}))}function It(e,t,r,a,n,o){let i=(s,u)=>r[u]?s.route.id!==r[u].route.id:!0,l=(s,u)=>r[u].pathname!==s.pathname||r[u].route.path?.endsWith("*")&&r[u].params["*"]!==s.params["*"];return o==="assets"?t.filter((s,u)=>i(s,u)||l(s,u)):o==="data"?t.filter((s,u)=>{let c=a.routes[s.route.id];if(!c||!c.hasLoader)return!1;if(i(s,u)||l(s,u))return!0;if(s.route.shouldRevalidate){let d=s.route.shouldRevalidate({currentUrl:new URL(n.pathname+n.search+n.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:s.params,defaultShouldRevalidate:!0});if(typeof d=="boolean")return d}return!0}):[]}function Xa(e,t,{includeHydrateFallback:r}={}){return Qa(e.map(a=>{let n=t.routes[a.route.id];if(!n)return[];let o=[n.module];return n.clientActionModule&&(o=o.concat(n.clientActionModule)),n.clientLoaderModule&&(o=o.concat(n.clientLoaderModule)),r&&n.hydrateFallbackModule&&(o=o.concat(n.hydrateFallbackModule)),n.imports&&(o=o.concat(n.imports)),o}).flat(1))}function Qa(e){return[...new Set(e)]}function qa(e){let t={},r=Object.keys(e).sort();for(let a of r)t[a]=e[a];return t}function Za(e,t){let r=new Set,a=new Set(t);return e.reduce((n,o)=>{if(t&&!Ja(o)&&o.as==="script"&&o.href&&a.has(o.href))return n;let l=JSON.stringify(qa(o));return r.has(l)||(r.add(l),n.push({key:l,link:o})),n},[])}function Je(){let e=S.useContext(K);return Ve(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function an(){let e=S.useContext(te);return Ve(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var ie=S.createContext(void 0);ie.displayName="FrameworkContext";function xe(){let e=S.useContext(ie);return Ve(e,"You must render this element inside a <HydratedRouter> element"),e}function nn(e,t){let r=S.useContext(ie),[a,n]=S.useState(!1),[o,i]=S.useState(!1),{onFocus:l,onBlur:s,onMouseEnter:u,onMouseLeave:c,onTouchStart:d}=t,m=S.useRef(null);S.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let p=R=>{R.forEach(w=>{i(w.isIntersecting)})},f=new IntersectionObserver(p,{threshold:.5});return m.current&&f.observe(m.current),()=>{f.disconnect()}}},[e]),S.useEffect(()=>{if(a){let p=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(p)}}},[a]);let h=()=>{n(!0)},y=()=>{n(!1),i(!1)};return r?e!=="intent"?[o,m,{}]:[o,m,{onFocus:ne(l,h),onBlur:ne(s,y),onMouseEnter:ne(u,h),onMouseLeave:ne(c,y),onTouchStart:ne(d,h)}]:[!1,m,{}]}function ne(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function hr({page:e,...t}){let r=da(),{nonce:a}=xe(),{router:n}=Je(),o=S.useMemo(()=>Ae(n.routes,e,n.basename),[n.routes,e,n.basename]);return o?(t.nonce==null&&a&&(t={...t,nonce:a}),r?S.createElement(ln,{page:e,matches:o,...t}):S.createElement(sn,{page:e,matches:o,...t})):null}function on(e){let{manifest:t,routeModules:r}=xe(),[a,n]=S.useState([]);return S.useEffect(()=>{let o=!1;return Ga(e,t,r).then(i=>{o||n(i)}),()=>{o=!0}},[e,t,r]),a}function ln({page:e,matches:t,...r}){let a=T(),{future:n}=xe(),{basename:o}=Je(),i=S.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let l=dr(e,o,n.v8_trailingSlashAwareDataRequests,"rsc"),s=!1,u=[];for(let c of t)typeof c.route.shouldRevalidate=="function"?s=!0:u.push(c.route.id);return s&&u.length>0&&l.searchParams.set("_routes",u.join(",")),[l.pathname+l.search]},[o,n.v8_trailingSlashAwareDataRequests,e,a,t]);return S.createElement(S.Fragment,null,i.map(l=>S.createElement("link",{key:l,rel:"prefetch",as:"fetch",href:l,...r})))}function sn({page:e,matches:t,...r}){let a=T(),{future:n,manifest:o,routeModules:i}=xe(),{basename:l}=Je(),{loaderData:s,matches:u}=an(),c=S.useMemo(()=>It(e,t,u,o,a,"data"),[e,t,u,o,a]),d=S.useMemo(()=>It(e,t,u,o,a,"assets"),[e,t,u,o,a]),m=S.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let p=new Set,f=!1;if(t.forEach(w=>{let b=o.routes[w.route.id];!b||!b.hasLoader||(!c.some(P=>P.route.id===w.route.id)&&w.route.id in s&&i[w.route.id]?.shouldRevalidate||b.hasClientLoader?f=!0:p.add(w.route.id))}),p.size===0)return[];let R=dr(e,l,n.v8_trailingSlashAwareDataRequests,"data");return f&&p.size>0&&R.searchParams.set("_routes",t.filter(w=>p.has(w.route.id)).map(w=>w.route.id).join(",")),[R.pathname+R.search]},[l,n.v8_trailingSlashAwareDataRequests,s,a,o,c,t,e,i]),h=S.useMemo(()=>Xa(d,o),[d,o]),y=on(d);return S.createElement(S.Fragment,null,m.map(p=>S.createElement("link",{key:p,rel:"prefetch",as:"fetch",href:p,...r})),h.map(p=>S.createElement("link",{key:p,rel:"modulepreload",href:p,...r})),y.map(({key:p,link:f})=>S.createElement("link",{key:p,nonce:r.nonce,...f,crossOrigin:f.crossOrigin??r.crossOrigin})))}function un(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var cn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{cn&&(window.__reactRouterVersion="7.18.3")}catch{}function dn({basename:e,children:t,useTransitions:r,window:a}){let n=v.useRef();n.current==null&&(n.current=jt({window:a,v5Compat:!0}));let o=n.current,[i,l]=v.useState({action:o.action,location:o.location}),s=v.useCallback(u=>{r===!1?l(u):v.startTransition(()=>l(u))},[r]);return v.useLayoutEffect(()=>o.listen(s),[o,s]),v.createElement(be,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:o,useTransitions:r})}function mr({basename:e,children:t,history:r,useTransitions:a}){let[n,o]=v.useState({action:r.action,location:r.location}),i=v.useCallback(l=>{a===!1?o(l):v.startTransition(()=>o(l))},[a]);return v.useLayoutEffect(()=>r.listen(i),[r,i]),v.createElement(be,{basename:e,children:t,location:n.location,navigationType:n.action,navigator:r,useTransitions:a})}mr.displayName="unstable_HistoryRouter";var le=v.forwardRef(function({onClick:t,discover:r="render",prefetch:a="none",relative:n,reloadDocument:o,replace:i,mask:l,state:s,target:u,to:c,preventScrollReset:d,viewTransition:m,defaultShouldRevalidate:h,...y},p){let{basename:f,navigator:R,useTransitions:w}=v.useContext(N),b=typeof c=="string"&&Oe.test(c),P=Qt(c,f);c=P.to;let E=Se(c,{relative:n}),F=T(),k=null;if(l){let W=we(l,[],F.mask?F.mask.pathname:"/",!0);f!=="/"&&(W.pathname=W.pathname==="/"?f:H([f,W.pathname])),k=R.createHref(W)}let[$,J,z]=nn(a,y),se=Rr(c,{replace:i,mask:l,state:s,target:u,preventScrollReset:d,relative:n,viewTransition:m,defaultShouldRevalidate:h,useTransitions:w});function q(W){t&&t(W),W.defaultPrevented||se(W)}let ue=!(P.isExternal||o),tt=v.createElement("a",{...y,...z,href:(ue?k:void 0)||P.absoluteURL||E,onClick:ue?q:t,ref:un(p,J),target:u,"data-discover":!b&&r==="render"?"true":void 0});return $&&!b?v.createElement(v.Fragment,null,tt,v.createElement(hr,{page:E})):tt});le.displayName="Link";var pr=v.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:a="",end:n=!1,style:o,to:i,viewTransition:l,children:s,...u},c){let d=re(i,{relative:u.relative}),m=T(),h=v.useContext(te),{navigator:y,basename:p}=v.useContext(N),f=h!=null&&Er(d)&&l===!0,R=y.encodeLocation?y.encodeLocation(d).pathname:d.pathname,w=m.pathname,b=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;r||(w=w.toLowerCase(),b=b?b.toLowerCase():null,R=R.toLowerCase()),b&&p&&(b=U(b,p)||b);let P=R!=="/"&&R.endsWith("/")?R.length-1:R.length,E=w===R||!n&&w.startsWith(R)&&w.charAt(P)==="/",F=b!=null&&(b===R||!n&&b.startsWith(R)&&b.charAt(R.length)==="/"),k={isActive:E,isPending:F,isTransitioning:f},$=E?t:void 0,J;typeof a=="function"?J=a(k):J=[a,E?"active":null,F?"pending":null,f?"transitioning":null].filter(Boolean).join(" ");let z=typeof o=="function"?o(k):o;return v.createElement(le,{...u,"aria-current":$,className:J,ref:c,style:z,to:i,viewTransition:l},typeof s=="function"?s(k):s)});pr.displayName="NavLink";var yr=v.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:a,replace:n,state:o,method:i=me,action:l,onSubmit:s,relative:u,preventScrollReset:c,viewTransition:d,defaultShouldRevalidate:m,...h},y)=>{let{useTransitions:p}=v.useContext(N),f=wr(),R=Sr(l,{relative:u}),w=i.toLowerCase()==="get"?"get":"post",b=typeof l=="string"&&Oe.test(l);return v.createElement("form",{ref:y,method:w,action:R,onSubmit:a?s:E=>{if(s&&s(E),E.defaultPrevented)return;E.preventDefault();let F=E.nativeEvent.submitter,k=F?.getAttribute("formmethod")||i,$=()=>f(F||E.currentTarget,{fetcherKey:t,method:k,navigate:r,replace:n,state:o,relative:u,preventScrollReset:c,viewTransition:d,defaultShouldRevalidate:m});p&&r!==!1?v.startTransition(()=>$()):$()},...h,"data-discover":!b&&e==="render"?"true":void 0})});yr.displayName="Form";function gr({getKey:e,storageKey:t,...r}){let a=v.useContext(ie),{basename:n}=v.useContext(N),o=T(),i=We();br({getKey:e,storageKey:t});let l=v.useMemo(()=>{if(!a||!e)return null;let u=Me(o,i,n,e);return u!==o.key?u:null},[]);if(!a||a.isSpaMode)return null;let s=((u,c)=>{if(!window.history.state||!window.history.state.key){let d=Math.random().toString(32).slice(2);window.history.replaceState({key:d},"")}try{let m=JSON.parse(sessionStorage.getItem(u)||"{}")[c||window.history.state.key];typeof m=="number"&&window.scrollTo(0,m)}catch(d){console.error(d),sessionStorage.removeItem(u)}}).toString();return r.nonce==null&&a?.nonce&&(r.nonce=a.nonce),v.createElement("script",{...r,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${s})(${$t(JSON.stringify(t||Ne))}, ${$t(JSON.stringify(l))})`}})}gr.displayName="ScrollRestoration";function vr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ke(e){let t=v.useContext(K);return L(t,vr(e)),t}function fn(e){let t=v.useContext(te);return L(t,vr(e)),t}function Rr(e,{target:t,replace:r,mask:a,state:n,preventScrollReset:o,relative:i,viewTransition:l,defaultShouldRevalidate:s,useTransitions:u}={}){let c=Q(),d=T(),m=re(e,{relative:i});return v.useCallback(h=>{if(Ia(h,t)){h.preventDefault();let y=r!==void 0?r:B(d)===B(m),p=()=>c(e,{replace:y,mask:a,state:n,preventScrollReset:o,relative:i,viewTransition:l,defaultShouldRevalidate:s});u?v.startTransition(()=>p()):p()}},[d,c,m,r,a,n,t,e,o,i,l,s,u])}function Ge(e){M(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=v.useRef(Re(e)),r=v.useRef(!1),a=T(),n=v.useMemo(()=>Ha(a.search,r.current?null:t.current),[a.search]),o=Q(),i=v.useCallback((l,s)=>{let u=Re(typeof l=="function"?l(new URLSearchParams(n)):l);r.current=!0,o("?"+u,s)},[o,n]);return[n,i]}var hn=0,mn=()=>`__${String(++hn)}__`;function wr(){let{router:e}=Ke("useSubmit"),{basename:t}=v.useContext(N),r=La(),a=e.fetch,n=e.navigate;return v.useCallback(async(o,i={})=>{let{action:l,method:s,encType:u,formData:c,body:d}=za(o,t);if(i.navigate===!1){let m=i.fetcherKey||mn();await a(m,r,i.action||l,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:c,body:d,formMethod:i.method||s,formEncType:i.encType||u,flushSync:i.flushSync})}else await n(i.action||l,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:c,body:d,formMethod:i.method||s,formEncType:i.encType||u,replace:i.replace,state:i.state,fromRouteId:r,flushSync:i.flushSync,viewTransition:i.viewTransition})},[a,n,t,r])}function Sr(e,{relative:t}={}){let{basename:r}=v.useContext(N),a=v.useContext(I);L(a,"useFormAction must be used inside a RouteContext");let[n]=a.matches.slice(-1),o={...re(e||".",{relative:t})},i=T();if(e==null){o.search=i.search;let l=new URLSearchParams(o.search),s=l.getAll("index");if(s.some(c=>c==="")){l.delete("index"),s.filter(d=>d).forEach(d=>l.append("index",d));let c=l.toString();o.search=c?`?${c}`:""}}return(!e||e===".")&&n.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:H([r,o.pathname])),B(o)}var Ne="react-router-scroll-positions",he={};function Me(e,t,r,a){let n=null;return a&&(r!=="/"?n=a({...e,pathname:U(e.pathname,r)||e.pathname},t):n=a(e,t)),n==null&&(n=e.key),n}function br({getKey:e,storageKey:t}={}){let{router:r}=Ke("useScrollRestoration"),{restoreScrollPosition:a,preventScrollReset:n}=fn("useScrollRestoration"),{basename:o}=v.useContext(N),i=T(),l=We(),s=lr();v.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),pn(v.useCallback(()=>{if(s.state==="idle"){let u=Me(i,l,o,e);he[u]=window.scrollY}try{sessionStorage.setItem(t||Ne,JSON.stringify(he))}catch(u){M(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${u}).`)}window.history.scrollRestoration="auto"},[s.state,e,o,i,l,t])),typeof document<"u"&&(v.useLayoutEffect(()=>{try{let u=sessionStorage.getItem(t||Ne);u&&(he=JSON.parse(u))}catch{}},[t]),v.useLayoutEffect(()=>{let u=r?.enableScrollRestoration(he,()=>window.scrollY,e?(c,d)=>Me(c,d,o,e):void 0);return()=>u&&u()},[r,o,e]),v.useLayoutEffect(()=>{if(a!==!1){if(typeof a=="number"){window.scrollTo(0,a);return}try{if(i.hash){let u=document.getElementById(decodeURIComponent(i.hash.slice(1)));if(u){u.scrollIntoView();return}}}catch{M(!1,`"${i.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}n!==!0&&window.scrollTo(0,0)}},[i,a,n]))}function pn(e,t){let{capture:r}=t||{};v.useEffect(()=>{let a=r!=null?{capture:r}:void 0;return window.addEventListener("pagehide",e,a),()=>{window.removeEventListener("pagehide",e,a)}},[e,r])}function Er(e,{relative:t}={}){let r=v.useContext(He);L(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=Ke("useViewTransitionState"),n=re(e,{relative:t});if(!r.isTransitioning)return!1;let o=U(r.currentLocation.pathname,a)||r.currentLocation.pathname,i=U(r.nextLocation.pathname,a)||r.nextLocation.pathname;return oe(n.pathname,i)!=null||oe(n.pathname,o)!=null}var Xe=D(A(),1),Pr=D(Tr(),1);var j=D(Z(),1);function Cr({context:e,own:t}){ae(e.store);let r=ft(),a=dt()?.live??e.store;ae(a);let n=gt();if(!r||a.batches().length===0&&n===0)return null;let o=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Xe.Suspense,{fallback:null,children:(0,j.jsx)(Pt,{})}),(0,j.jsx)(Xe.Suspense,{fallback:null,children:(0,j.jsx)(Ct,{})})]});return t?(0,Pr.createPortal)(o,t):(0,j.jsx)("div",{className:"graview-bar-own",children:o})}var O=D(A(),1);var V=D(A(),1),yn=(0,V.createContext)(null);function ti(){let e=new Map,t=new Set,r=()=>{for(let a of t)a()};return{count:a=>e.get(a)??0,place(a){return e.set(a,(e.get(a)??0)+1),r(),()=>{e.set(a,(e.get(a)??1)-1),r()}},subscribe(a){return t.add(a),()=>t.delete(a)}}}function Lr(e){let t=(0,V.useContext)(yn);(0,V.useLayoutEffect)(()=>t?.place(e),[t,e])}function ri(e,t){return(0,V.useSyncExternalStore)(e.subscribe,()=>e.count(t)>0,()=>!1)}var Fr=D(Z(),1),Qe="var(--graview-text-small)",qe="var(--graview-text-body)",si="var(--graview-font-display, var(--graview-font-body, system-ui))",Ze={maxWidth:760,margin:"0 auto",padding:"40px var(--graview-page-gutter, 20px) max(96px, calc(var(--graview-foot-room, 0px) + env(safe-area-inset-bottom, 0px)))",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40},et=1160,ui={...Ze,maxWidth:et},Dr={margin:0,fontSize:"var(--graview-text-title)",lineHeight:1.2,letterSpacing:"-0.012em",overflowWrap:"anywhere",textWrap:"balance"},ci={margin:0,fontSize:"var(--graview-text-heading)",lineHeight:1.3,textWrap:"balance"},di={margin:0,fontSize:Qe,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},fi={margin:0,fontSize:qe,color:"var(--graview-ink-muted)",maxWidth:"60ch"},kr={color:"var(--graview-ink-muted)",fontSize:Qe},hi={borderTop:"1px solid var(--graview-edge)",paddingTop:24},mi={color:"var(--graview-accent)",textDecorationColor:"color-mix(in srgb, currentColor 50%, transparent)",textDecorationThickness:1,textUnderlineOffset:"0.2em",display:"inline-flex",alignItems:"center",minHeight:24},pi={color:"inherit",textDecoration:"none",display:"inline-flex",alignItems:"center",minHeight:24},yi=`.graview-list{container-type:inline-size}
4
- .graview-rows{display:grid;grid-template-columns:minmax(0,1fr);column-gap:1.5rem;margin:0;padding:0;list-style:none;border-top:1px solid var(--graview-edge)}
5
- .graview-row{grid-column:1/-1;display:grid;grid-template-columns:subgrid;align-items:baseline;align-content:center;position:relative;box-sizing:border-box;min-height:2.75rem;padding:.5rem 0;border-bottom:1px solid var(--graview-edge);overflow-wrap:anywhere}
6
- .graview-row-title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;min-height:24px;color:inherit;text-decoration:none;font-size:var(--graview-text-body);font-weight:500;line-height:1.3;text-wrap:pretty;hyphens:manual}
7
- .graview-row-title::after{content:"";position:absolute;inset:0}
8
- .graview-row-title:focus-visible{outline:0}
9
- .graview-row-title:focus-visible::after{outline:2px solid var(--graview-accent);outline-offset:-2px;border-radius:var(--graview-radius-sm)}
10
- .graview-row:hover .graview-row-title{text-decoration:underline 1px color-mix(in srgb,currentColor 50%,transparent);text-underline-offset:.2em}
11
- .graview-row:active .graview-row-title{color:var(--graview-accent)}
12
- .graview-row :is(a,button):not(.graview-row-title){position:relative}
13
- .graview-row-glance,.graview-row>[data-testid=search-why]{font-size:var(--graview-text-small);line-height:1.5;color:var(--graview-ink-muted)}
14
- .graview-row>[data-testid=search-why]{grid-column:1/-1}
15
- .graview-row-glance{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
16
- .graview-group-head{display:flex;gap:.5em;align-items:baseline;margin:0;padding:.375rem 0;font-family:var(--graview-font-body);font-size:var(--graview-text-small);font-weight:var(--graview-weight-label);line-height:1.3;letter-spacing:.02em;scroll-margin-top:4rem}
17
- .graview-group-head>span{color:var(--graview-ink-muted);font-weight:var(--graview-weight-body)}
18
- .graview-group-toggle{display:inline-flex;gap:.5em;align-items:center;min-height:2.75rem;margin:-.375rem 0;padding:0 .5rem 0 0;border:0;background:none;color:inherit;font:inherit;letter-spacing:inherit;text-align:start;cursor:pointer;border-radius:var(--graview-radius-sm)}
19
- .graview-group-toggle:focus-visible{outline:2px solid var(--graview-accent);outline-offset:2px}
20
- .graview-group-toggle>span{color:var(--graview-ink-muted);font-weight:var(--graview-weight-body)}
21
- @container (min-width:36rem){.graview-rows{grid-template-columns:minmax(0,1fr) fit-content(40%)}.graview-group-head:has(+.graview-rows){position:sticky;top:0;z-index:${nt.raised};background:var(--graview-ground)}}`,gi={font:"inherit",fontSize:Qe,padding:"8px 14px",borderRadius:"var(--graview-radius-sm, 8px)",border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)",color:"var(--graview-ink)",cursor:"pointer"};function vi({kind:e,brand:t,size:r=10,schema:a}){return(0,Fr.jsx)(mt,{kind:e,...a?{schema:a}:{},...t?{brand:t}:{},size:Math.round(r*1.6)})}function Ri(e,t){let a=[...new Set(t.targets.map(n=>n.kind))].map(n=>e.schema.tryDefinition(n)?.plural??Pe(n));return a.length>0?a.join(" and "):Pe(t.edgeKind)}function wi(e,t,r){return e.author.kind==="human"&&(e.author.id===void 0||t?.id===void 0||e.author.id===t.id)?"you":r?rt(e.author,r):e.author.kind==="agent"?e.author.id??"an agent":e.author.id??e.author.kind}function Si(e,t,r){return yt(e,t,{limit:3,said:[r],glance:!0}).map(a=>a.long?pt(a.stored,{markdown:a.markdown,most:100}):a.alone).join(" \xB7 ")}var bi=(e,t)=>ce(e.schema,t),gn=(e,t)=>{let r=e.kindsKeptFrom(t);return e.schema.kinds.filter(a=>!e.modules.disabledKinds.has(a)&&!r.has(a))},vn=e=>ct(gn(e.store,e.principal),e.views?.arrangement?.()?.order),Ei=e=>{let t=new Set(e.views?.arrangement?.()?.hide??[]);return vn(e).filter(r=>!t.has(r))},xi=e=>e.charAt(0).toUpperCase()+e.slice(1);var C=D(Z(),1);function Ai({context:e,children:t}){let{store:r,brand:a}=e;return ae(r),ht(e.embedded?void 0:at(a)),(0,C.jsxs)("div",{style:{...e.embedded?{}:{minHeight:"100vh"},display:"flex",flexDirection:"column",background:"var(--graview-ground)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)",fontSize:qe,lineHeight:1.5},children:[e.embedded?null:(0,C.jsx)(wn,{context:e}),(0,C.jsx)("div",{style:{flex:1},children:t}),e.remembers?(0,C.jsx)("footer",{style:{borderTop:"1px solid var(--graview-edge)",padding:"14px 20px max(20px, calc(var(--graview-foot-room, 0px) + env(safe-area-inset-bottom, 0px)))",...kr},children:(0,C.jsx)("div",{style:{maxWidth:et,margin:"0 auto",display:"flex",gap:14,flexWrap:"wrap",alignItems:"center",justifyContent:"flex-end"},children:(0,C.jsxs)("span",{"data-testid":"remembered",children:["Remembered in this browser \xB7 ",(0,C.jsx)(Dt,{})]})})}):null]})}var Rn=(0,O.createContext)(null);function wn({context:e}){let{store:t,brand:r,sceneHref:a="/",invariantContext:n}=e,o=T(),i=Q(),l=Se("/").replace(/\/$/,""),s=(0,O.useContext)(Rn),u=s?.places===!1?[]:vt({store:t,principal:e.principal,views:e.views}),c=e.views?.arrangement?.(),d=`${o.pathname}${o.search}`,m=t.violations(n),h=m.length,y=Et(m,"All rules hold"),p=o.pathname.split("/").filter(Boolean),f=p.length===2&&de(t.schema,p[0])!==void 0&&t.graph.getNode(decodeURIComponent(p[1]))!==void 0;return(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(St,{brand:r,name:r?.name??"Graview",description:r?.subtitle,home:{href:`${l}/`,go:()=>i("/"),current:o.pathname==="/"},faces:{scene:{label:st(c),current:!1,go:()=>window.location.assign(a)},pages:{label:ut(c),current:!0,go:()=>{}}},places:u,current:Rt(u,d),reach:{href:R=>`${l}${R}`,go:R=>i(R.path)},...s?{onFind:s.onFind,find:s.find}:{findBox:(0,C.jsx)(bn,{context:e})},skips:(0,C.jsx)(Lt,{to:[{label:"Skip to the content",testid:"content",go:()=>{let R=document.querySelector("[data-graview-skip-target]");Ce(R?.querySelector('[data-graview-choose-box][tabindex="0"]')??R??document.querySelector("main"))}},...f?[{label:"Skip to what can be done",testid:"acts",go:()=>void Ce(document.querySelector("main [data-affordance]:not([disabled]):not([tabindex='-1'])")??document.querySelector("main [data-affordance]:not([disabled])")??document.querySelector("main"))}]:[]]}),tools:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(le,{to:"/problems","data-testid":"standing-link","aria-label":y,title:y,style:{...wt,padding:h===0?0:"0 8px",textDecoration:"none",fontWeight:600,fontVariantNumeric:"tabular-nums",color:h===0?"var(--graview-ink-muted)":"var(--graview-warn)"},children:[(0,C.jsx)(xt,{tone:h===0?"var(--graview-good)":"var(--graview-warn)"}),h>0?(0,C.jsx)("span",{"aria-hidden":"true",children:h}):null]}),s?null:(0,C.jsx)(Cr,{context:e}),e.views?(0,C.jsx)(bt,{...e.signature?{signature:!0}:{}}):null]})})})}function _i({context:e,style:t,children:r,...a}){let n=e.embedded||e.framed?"section":"main";return(0,C.jsx)(n,{style:{...Ze,...t},"data-graview-page-main":"",...a,children:r})}function $i({when:e,children:t}){return e?(0,C.jsxs)("div",{"data-graview-bleed":"",style:{display:"grid",minWidth:0},children:[(0,C.jsx)("style",{children:Sn}),t]}):(0,C.jsx)(C.Fragment,{children:t})}var Sn="@media (max-width:680px){[data-graview-bleed]{margin-inline:min(0px,calc(env(safe-area-inset-left,0px) - var(--graview-page-gutter,20px))) min(0px,calc(env(safe-area-inset-right,0px) - var(--graview-page-gutter,20px)))}}";function Ii({context:e,children:t,...r}){let a=`h${e.titleLevel??(e.framed&&!e.barAbove?1:2)}`;return(0,C.jsx)(a,{style:Dr,"data-graview-page-title":"",...r,children:t})}function bn({context:e,narrowsLists:t=!0,className:r,size:a}){Lr("find");let n=T(),o=Q(),[i,l]=Ge(),s=n.pathname.split("/").filter(Boolean),u=t&&s.length===1&&de(e.store.schema,s[0])!==void 0,c=n.pathname==="/search",d=u||c?i.get("q")??"":"",m=u?`Narrow ${ce(e.store.schema,de(e.store.schema,s[0])).toLowerCase()}\u2026`:"",[h,y]=(0,O.useState)(!0);(0,O.useLayoutEffect)(()=>{let P=R.current;if(!P||!m||typeof ResizeObserver>"u")return;let E=()=>{let k=getComputedStyle(P),$=document.createElement("canvas").getContext("2d");$&&($.font=`${k.fontWeight} ${k.fontSize} ${k.fontFamily}`,y($.measureText(m).width<=P.clientWidth-parseFloat(k.paddingLeft)-parseFloat(k.paddingRight)))};E();let F=new ResizeObserver(E);return F.observe(P),()=>F.disconnect()},[m]);let[p,f]=(0,O.useState)(d),R=(0,O.useRef)(null);(0,O.useEffect)(()=>{let P=E=>{if(E.defaultPrevented||E.altKey)return;let F=!E.shiftKey&&(E.metaKey||E.ctrlKey)&&E.key.toLowerCase()==="k",k=document.activeElement,$=k instanceof HTMLInputElement||k instanceof HTMLTextAreaElement||k instanceof HTMLSelectElement||k instanceof HTMLElement&&k.isContentEditable,J=E.key==="/"&&!E.metaKey&&!E.ctrlKey&&!$;if(!F&&!J)return;let z=R.current,se=z?.closest("[data-graview-embed]"),q=E.target,ue=q===document.body||q===document.documentElement;!z||!(ue||!se||q instanceof Node&&se.contains(q))||(E.preventDefault(),z.closest("[data-graview-app-bar]")?.querySelector('[data-testid="app-find-open"]')?.click(),requestAnimationFrame(()=>{z.focus(),z.select()}))};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[]);let w=(0,O.useRef)(new Set([d]));(0,O.useEffect)(()=>{w.current.has(d)||(w.current=new Set([d]),f(d))},[d]);let b=P=>{if(f(P),w.current.add(P),u){let F=new URLSearchParams(i);P.trim()?F.set("q",P):F.delete("q"),l(F,{replace:!0});return}let E=P.trim()?`/search?${new URLSearchParams({q:P}).toString()}`:"/search";o(E,{replace:c})};return(0,C.jsxs)("form",{role:"search","aria-label":u?"Narrow this list":"Find anything",className:Ft("graview-find",r),...kt(a),onSubmit:P=>{P.preventDefault(),u&&p.trim()&&o(`/search?${new URLSearchParams({q:p}).toString()}`)},children:[(0,C.jsx)("input",{ref:R,type:"search","data-testid":"nav-find",value:p,onChange:P=>b(P.target.value),placeholder:u?h?m:"Narrow\u2026":"Find\u2026","aria-keyshortcuts":"/ Meta+K Control+K","aria-label":u?"Narrow this list":"Find anything",className:"graview-find-box"}),(0,C.jsx)("style",{children:En})]})}var En=`:where(.graview-find){display:flex;min-width:0;flex:1 1 auto}
22
- :where(.graview-find[data-size=md]){--graview-control-height:36px}
23
- :where(.graview-find-box){box-sizing:border-box;width:100%;min-width:0;height:var(--graview-control-height,30px);padding:0 var(--graview-bar-find-end,10px) 0 10px;font:inherit;font-size:.875rem;color:var(--graview-ink);background:var(--graview-ground);border:1px solid var(--graview-edge);border-radius:8px}`;export{Nr as a,de as b,Pn as c,Cn as d,Qe as e,si as f,ui as g,ci as h,di as i,fi as j,kr as k,hi as l,mi as m,pi as n,yi as o,gi as p,vi as q,Ri as r,wi as s,Si as t,bi as u,gn as v,vn as w,Ei as x,xi as y,Cr as z,Se as A,T as B,ga as C,Q as D,Ra as E,Ta as F,Na as G,cr as H,Ma as I,dn as J,le as K,Ge as L,yn as M,ti as N,ri as O,Ai as P,Rn as Q,_i as R,$i as S,Ii as T,bn as U};
24
- /*! Bundled license information:
25
-
26
- react-router/dist/development/chunk-BV7QT456.mjs:
27
- (**
28
- * react-router v7.18.3
29
- *
30
- * Copyright (c) Remix Software Inc.
31
- *
32
- * This source code is licensed under the MIT license found in the
33
- * LICENSE.md file in the root directory of this source tree.
34
- *
35
- * @license MIT
36
- *)
37
-
38
- react-router/dist/development/index.mjs:
39
- (**
40
- * react-router v7.18.3
41
- *
42
- * Copyright (c) Remix Software Inc.
43
- *
44
- * This source code is licensed under the MIT license found in the
45
- * LICENSE.md file in the root directory of this source tree.
46
- *
47
- * @license MIT
48
- *)
49
- */
@@ -1 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{d as Se,f as be}from"./chunk.JBW3DI7E.js";import{e as pt}from"./chunk.NIVTK2W5.js";import{a as ae,b as tt}from"./chunk.V5FIZIX2.js";import{b as Pe,c as U,d as X,e as it,f as rt}from"./chunk.DQHPEKWK.js";import{a as yt,d as wt,f as vt}from"./chunk.LSLLKICK.js";import{a as ve,b as gt}from"./chunk.EAUVEVVO.js";import{a as Ce,b as ft}from"./chunk.C2UFMFJ3.js";import{a as mt,b as ht}from"./chunk.Y5ARSVH4.js";import{h as ut}from"./chunk.PKUDIWIF.js";import{d as ot,e as ie,f as J,g as ye,h as st,j as lt,k as re}from"./chunk.OYHQSXNC.js";import{j as dt,o as we}from"./chunk.6MADC6DM.js";import{c as ct}from"./chunk.JLEC3USG.js";import{c as at,d as Re}from"./chunk.DX357TZ3.js";import{c as nt}from"./chunk.H7KCWCB4.js";import{Aa as xe,Ba as fe,Ca as Ne,G as q,R as I,T as Ye,Z as Ze,_ as V,aa as ue,ha as Qe,ia as _,j as _e,ja as pe,l as je,m as qe,oa as me,r as ne,v as Ue,wa as he,y as Xe,ya as et,z as Je}from"./chunk.XWAMQPUM.js";import{a as ge}from"./chunk.SDO3U72B.js";import{$b as te,U as Q,ca as $,ea as ee,gb as Ke,la as H}from"./chunk.AS4CQBOQ.js";import{b as L}from"./chunk.AJZBJBMO.js";var v=L(q(),1);var St=L(q(),1);function bt(e){(0,St.useLayoutEffect)(()=>{let n=e.current,t=n?.parentElement;if(!n||!t)return;let a=n.style.bottom,o=()=>{let g=t.querySelector(zt);if(!g){n.style.bottom=a;return}let u=t.getBoundingClientRect(),m=g.getBoundingClientRect(),c=u.height>0?t.offsetHeight/u.height:1;n.style.bottom=`${Math.max(0,Math.round((u.bottom-m.top)*c))}px`};if(o(),typeof ResizeObserver>"u")return;let l=new ResizeObserver(o);return l.observe(t),()=>l.disconnect()},[e])}var zt=".graview-spec-listing";var $e=L(q(),1);var P=L(q(),1);var kt=L(q(),1);var B=L(I(),1);function xt({id:e,max:n=8,empty:t,hide:a}){let{store:o}=V();ue();let l=Kt(o,e,o.violations()),[g,u]=(0,kt.useState)(()=>new Set),m=a?l.flatMap(c=>{let f=c.ids.filter(r=>!a.has(r));return f.length>0?[{...c,ids:f}]:[]}):l;return m.length===0?t&&l.length===0?(0,B.jsx)("p",{style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-faint)"},children:t}):null:(0,B.jsx)("div",{"data-graview-primitive":"connections",style:{display:"flex",flexDirection:"column",gap:12},children:m.map(c=>{let f=g.has(c.key),r=c.ids.length>n,d=f?c.ids:c.ids.slice(0,n),y=c.ids.length-Math.min(n,c.ids.length),k=`graview-more-${e}-${c.key}`.replace(/[^A-Za-z0-9_-]/g,"-");return(0,B.jsxs)("section",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,B.jsx)("h2",{...c.said?{"aria-label":c.said}:{},style:{margin:0,fontSize:"0.75rem",fontWeight:600,letterSpacing:"0.09em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:c.label}),(0,B.jsxs)("div",{id:k,style:{display:"flex",flexWrap:"wrap",gap:6},children:[d.map(h=>{let w=o.graph.getNode(h);return w?(0,B.jsx)(X,{pickId:h,hue:te(w.kind),title:`Go to the ${H(o.schema.tryDefinition(w.kind),w.kind)}`,label:$(o.schema.tryDefinition(w.kind),w)},h):null}),r?(0,B.jsx)("button",{type:"button","data-graview-more":c.key,"aria-expanded":f,"aria-controls":k,...f?{}:{"aria-label":`${y} more: ${c.said??c.label}`},onClick:h=>{h.stopPropagation(),u(w=>{let S=new Set(w);return S.has(c.key)?S.delete(c.key):S.add(c.key),S})},style:Ft,children:f?"Show fewer":`+${y} more`}):null]})]},c.key)})})}var Ft={display:"inline-flex",alignItems:"center",alignSelf:"flex-start",minHeight:24,boxSizing:"border-box",padding:"3px 9px",borderRadius:6,border:"1px solid var(--graview-edge)",background:"var(--graview-panel-muted)",color:"var(--graview-accent)",font:"inherit",fontSize:"0.8125rem",lineHeight:1.5,whiteSpace:"nowrap",cursor:"pointer"};function Kt(e,n,t=[]){let a=e.graph.getNode(n);if(!a)return[];let o=new Map,l=[];for(let g of t)if(g.subjectId===n)for(let u of g.nodeIds)u!==n&&!l.includes(u)&&e.graph.has(u)&&l.push(u);l.length>0&&o.set("judges",{key:"judges",label:"what it finds wrong",ids:l});for(let g of e.graph.allEdges()){let u=g.from===n?g.to:g.to===n?g.from:null;if(u===null||u===n)continue;let m=e.graph.getNode(u);if(!m)continue;let c=g.from===n?"out":"in",f=c==="out"?a.kind:m.kind,r=_t(e.schema,f,g.kind,c),d=`${g.kind}:${c}:${r.label}`,y=o.get(d)??{key:d,...r,ids:[]};y.ids.includes(u)||y.ids.push(u),o.set(d,y)}for(let g of o.values())g.ids.sort();return[...o.values()].sort((g,u)=>g.key<u.key?-1:g.key>u.key?1:0)}function _t(e,n,t,a){let o=nt(e,n,t,a),l=ee(t).toLowerCase();return o.trim().toLowerCase()!==l?{label:o}:a==="out"?{label:`\u2192 ${l}`,said:l}:{label:`\u2190 ${l}`,said:`${l}, pointing here`}}var Nt=L(q(),1),oe=(0,Nt.createContext)(null);var s=L(I(),1),jt=he(ge(()=>(__graviewPreload(import.meta.url,["./chunk.ZJ2VS4M4.js","./chunk.Y5ARSVH4.js","./chunk.PKUDIWIF.js","./chunk.VW2VCPJX.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.E4G6DXSB.js")))).part((e,n)=>(0,s.jsx)(e.ArrangeBar,{...n}),{what:"Arranging this list"}),qt=he(ge(()=>(__graviewPreload(import.meta.url,["./chunk.FF6DBQMB.js","./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.JDMXZFSG.js","./chunk.DQOCBKC3.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.4RJZVTW7.js","./chunk.G4JJXA63.js","./chunk.WBHM5I3I.js","./chunk.VC3BX2ZF.js","./chunk.UKAPFIPJ.js","./chunk.UT6642FC.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.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.FTM64IDI.js")))).part((e,n)=>(0,s.jsx)(e.KindStop,{...n}),{what:"This list"});function Ae(e){let{brand:n}=V();return te(e,n?.accents)}function Ut(e,n){if(!n.endsWith("\u2026")&&!n.endsWith("..."))return;let t=n.replace(/[…]|\.\.\.$/g,"").trim();if(!(t.length<12)){for(let a of Object.values(e))if(typeof a=="string"&&a.length>t.length&&a.startsWith(t))return a}}function Xt(e,n){let a=Math.max(0,...e.slice(0,n*2).map(l=>l.length))*7.5+28<=212/2?2:1,o=n*a;return{columns:a,shown:Math.min(e.length,o)}}var Jt=8,Rt=500,Yt=12;function Ct(e){return{x:e.clientX,y:e.clientY,pointerType:e.pointerType??""}}function Zt(e,n,t){let a=performance.now()+Rt,o=["pointerdown","pointerup","mousedown","mouseup","dblclick"],l=r=>{if(performance.now()>a||!(r instanceof MouseEvent))return!1;let d=Ct(r);return n.pointerType&&d.pointerType&&n.pointerType!==d.pointerType?!1:Math.hypot(d.x-n.x,d.y-n.y)<=Yt},g=r=>{if(!l(r))return c();r.stopPropagation()},u=r=>{if(!l(r))return c();r.stopPropagation(),r.preventDefault(),e.removeEventListener("click",u,!0),setTimeout(c,50),t()},m=!1,c=()=>{if(!m){m=!0,clearTimeout(f),e.removeEventListener("click",u,!0);for(let r of o)e.removeEventListener(r,g,!0)}};for(let r of o)e.addEventListener(r,g,!0);e.addEventListener("click",u,!0);let f=setTimeout(c,Rt)}function Qt({View:e,members:n,mode:t,flagged:a}){let{isSelected:o}=xe(),l=n.slice(0,Jt);return(0,s.jsxs)("div",{"data-graview-rows":"",style:{display:"grid",gap:4,minWidth:0},children:[l.map(g=>(0,s.jsx)("div",{"data-graview-pick":g.id,style:{minWidth:0,cursor:"pointer"},children:(0,s.jsx)(e,{node:g,cardinality:"one",fidelity:"glyph",mode:t,selected:o(g.id),...a?.includes(g.id)?{flagged:[g.id]}:{}})},g.id)),n.length>l.length?(0,s.jsx)(X,{label:`+${n.length-l.length} more`}):null]})}var en=11/15,tn=he(ge(()=>(__graviewPreload(import.meta.url,["./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.2EFH63WS.js")))).part((e,n)=>(0,s.jsx)(e.StatesBar,{...n}),{quiet:!0});function nn({text:e,accent:n}){let t=(0,P.useRef)(null),a=(0,P.useRef)(null),[o,l]=(0,P.useState)(1),[g,u]=(0,P.useState)(!1),m=o<1?`${o}em`:void 0;return(0,P.useLayoutEffect)(()=>{let c=t.current,f=a.current;if(!c||!f)return;let r=()=>{let y=c.clientWidth,k=f.offsetWidth;if(y<=0||k<=0)return;let h=parseFloat(getComputedStyle(f).fontSize)/parseFloat(getComputedStyle(c).fontSize)||1,w=k/h,S=Math.max(en,Math.min(1,Math.floor(y/w*100)/100));l(x=>Math.abs(x-S)<.01?x:S),u(w*S>y+.5)};if(r(),typeof ResizeObserver>"u")return;let d=new ResizeObserver(r);return d.observe(c),()=>d.disconnect()},[e]),(0,s.jsx)("span",{ref:t,"data-graview-district-name":"",...o<1?{"data-graview-fitted":""}:{},...g?{title:e}:{},style:{display:"block",minWidth:0,fontSize:"0.9375rem",lineHeight:1.25,letterSpacing:"0.05em",textTransform:"uppercase",color:n?"var(--graview-accent)":"var(--graview-ink-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:(0,s.jsx)("span",{ref:a,style:{fontSize:m},children:e})})}function Pt(e,n){return!!e?.display?.page?.groups?.length||Re(n,e).some(t=>t.long)}function At(e,n=me(e)){for(let t of e.kinds){let a=e.tryDefinition(t),o=a?.plural??`${String(t)}s`,l=r=>{let d=r.node,y=fe(),k=(0,P.useContext)(oe);if(!d)return null;let h=k?.nodeId===d.id?k:null,w=$(a,d),S=r.mode==="fullscreen"?Ut(d,w)??w:w,x=Ke(y,[d.id]);return(0,s.jsxs)(U,{title:(0,s.jsx)(vt,{nodeId:d.id,children:h?.title??S}),...h?{}:{subtitle:a?.describe?at(a,d):a?.description??String(t)},selected:r.selected,...r.flagged?.includes(d.id)?{tone:"warning"}:{},fit:!0,children:[h?(0,s.jsx)(oe.Provider,{value:null,children:h.body}):null,(0,s.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"22px 34px",alignItems:"flex-start"},children:[(0,s.jsx)("div",{style:{flex:Pt(a,d)?"1 1 100%":"1 1 0",minWidth:"min(200px, 100%)"},children:(0,s.jsx)(wt,{id:d.id,shown:[S,w,a?.description,h?.title],...h?{hide:[...h.fields]}:{}})}),(0,s.jsx)("div",{style:{flex:Pt(a,d)?"1 1 100%":"1.4 1 0",minWidth:"min(220px, 100%)"},children:(0,s.jsx)(xt,{id:d.id,empty:`Nothing is connected to this ${H(a,String(t))} yet.`,...h?{hide:h.records}:{}})})]}),x.length>0?(0,s.jsx)("p",{"data-graview-broken":"",style:{margin:"14px 0 0",paddingTop:12,borderTop:"1px solid var(--graview-edge)",fontSize:"0.875rem",color:"var(--graview-warn)"},children:x.map(b=>b.message).join(" \xB7 ")}):null]})},g=r=>{let d=r.node;if(!d)return null;let{store:y}=V(),k=a?.computed?lt(y.schema,y.graph,d):d,h=Re(k,a,{limit:3,said:[$(a,d)],glance:!0}),w=Ae(t),S=h.filter(N=>!N.long&&!N.markdown),x=h.find(N=>N.long||N.markdown),b=ot(d,a);return(0,s.jsxs)(U,{title:$(a,d),selected:r.selected,tone:r.flagged?.includes(d.id)?"warning":"muted",fit:!0,children:[b?(0,s.jsx)(ve,{as:"thumb",file:b,size:64,style:{marginBottom:6}}):null,(0,s.jsx)(it,{items:S.map(N=>({id:N.key,label:N.alone,hue:w})),max:3}),x?(0,s.jsx)("p",{"data-graview-excerpt":x.key,title:x.value,style:{margin:S.length>0?"6px 0 0":0,fontSize:"0.8125rem",lineHeight:1.35,color:"var(--graview-ink-muted)",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:x.value}):null]})},u=r=>{let d=r.node,y=Ae(t),k=we().marks.flag;if(!d)return null;let h=r.flagged?.includes(d.id)??!1;return(0,s.jsx)(X,{label:h?`${$(a,d)} ${k}`:$(a,d),hue:y,selected:r.selected,title:h?`${ee(H(a,String(t)))} \u2014 implicated in a problem`:ee(H(a,String(t)))})},m=r=>r.fidelity==="full"?(0,s.jsx)(P.Suspense,{fallback:(0,s.jsx)(c,{...r}),children:(0,s.jsx)(qt,{kind:String(t),members:r.nodes??[],...r.flagged?{flagged:r.flagged}:{},...r.label?{label:r.label}:{},...r.retired?{retired:r.retired}:{}})}):(0,s.jsx)(c,{...r}),c=r=>{let{brand:d,store:y,views:k}=V(),{view:h,go:w}=Ne(),S=r.nodes??[],x=k.lookup(String(t),{cardinality:"one",fidelity:"glyph"}),b=x!==void 0&&!pe(x)?x:void 0,N=mt(h),C=ut(S,N,{schema:e,graph:y.graph,flagged:new Set(r.flagged??[])}),M=R=>({id:R.id,label:$(e.tryDefinition(R.kind),R),hue:te(R.kind,d?.accents)}),W=r.fidelity==="full"&&S.length>1?(0,s.jsx)(P.Suspense,{fallback:null,children:(0,s.jsx)(jt,{schema:e,graph:y.graph,kind:String(t),arrangement:N,onChange:R=>w(ht(h,R)),kept:{shown:C.nodes.length,of:S.length},style:{marginBottom:8}})}):null,se=R=>R.some(A=>r.flagged?.includes(A.id)),le=fe(),Y=we().marks.flag,z=(R,A,de)=>b?(0,s.jsx)(U,{title:R,meta:(0,s.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[(0,s.jsx)(be,{kind:String(t),plural:o,problems:Se(le,A),flag:Y}),(0,s.jsx)("span",{title:`${Q(A.length)} ${A.length===1?H(a,String(t)):o.toLowerCase()}`,children:Q(A.length)})]}),tone:se(A)?"warning":"muted",children:(0,s.jsx)(Qt,{View:b,members:A,mode:r.mode,...r.flagged?{flagged:r.flagged}:{}})},de):(0,s.jsx)(rt,{label:R,count:A.length,flagged:se(A),items:A.map(M),problems:(0,s.jsx)(be,{kind:String(t),plural:o,problems:Se(le,A),flag:Y})},de);return C.grouped?(0,s.jsxs)("div",{style:{display:"grid",gap:8},"data-graview-grouped":N.group?.by,children:[W,C.groups.map(R=>z(`${r.label??o} \xB7 ${R.label}`,R.nodes,R.key||"-"))]}):(0,s.jsxs)("div",{style:{display:"grid",gap:4},children:[W,z(r.label??o,C.nodes)]})},f=r=>{let d=r.nodes??[],y=Xt(d.map(p=>$(a,p)),r.openedRows??dt(d.length)),k=Ae(t),{brand:h}=V(),w=tt(String(t),e,h),S=we().marks.flag,{selection:x,set:b,clear:N}=xe(),{toggle:C,view:M,go:W}=Ne(),{views:se,hiddenKinds:le}=V(),Y=(0,P.useContext)(Qe),z=M.overview&&!le.has(String(t))?se.places().filter(p=>p.kind===String(t)):[],R=r.focused?M.within?.view??z[0]?.as:void 0,A=d.filter(p=>r.flagged?.includes(p.id)).length,de=A>0,Ot=fe(),Ht=Se(Ot,d),F=(M.overview??!1)&&r.nestedUnder===void 0,G=r.focused||r.raised,He=r.rank==="secondary"&&!G,E=r.nestedUnder!==void 0,Ie=new Set(x),K=Y?x.length===1&&x[0]===ne(String(t)):r.opened??!1,It=ct(),O=G||F?0:d.filter(p=>It.includes(p.id)&&!Ie.has(p.id)).length,ke=O>0&&!de,ce=Ze(),j=ce&&!E?ce.byKind[String(t)]??0:0,We=(0,P.useRef)(null),ze=(0,P.useRef)(null);(0,P.useLayoutEffect)(()=>{let p=ze.current,T=We.current;if(!p||!T||!F)return;let D=()=>T.style.setProperty("--graview-plate-h",`${p.offsetHeight}px`);if(D(),typeof ResizeObserver>"u")return;let Z=new ResizeObserver(D);return Z.observe(p,{box:"border-box"}),()=>Z.disconnect()},[F]);let Wt=E?8:Math.min(46,10+Math.round(Math.sqrt(d.length)*8)),Fe=E?(0,s.jsx)("span",{style:{fontSize:"0.75rem",lineHeight:1.25,letterSpacing:"0.05em",textTransform:"uppercase",color:G?"var(--graview-accent)":"var(--graview-ink-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r.label??o}):(0,s.jsx)(nn,{text:r.label??o,accent:!!G});return(0,s.jsxs)("div",{ref:We,className:"graview-kind-card","data-graview-rank":r.rank,"data-graview-landmark":w||void 0,"data-graview-nested":E||void 0,"data-graview-tied":O||void 0,"data-graview-hits":ce&&!E?j:void 0,"data-graview-emphasis":ce&&!E?j>0?"lit":"dimmed":void 0,...a?.description||E?{title:E?[r.label??o,a?.description].filter(Boolean).join(" \u2014 "):a.description}:{},style:{position:"relative",height:"100%","--graview-hue":Math.round(k)},children:[w?(0,s.jsx)("span",{className:"graview-kind-block graview-kind-landmark","data-graview-opened":r.opened||void 0,"aria-hidden":"true",style:{"--graview-rise":Wt},children:(0,s.jsx)(ae,{kind:String(t),schema:e,...h?{brand:h}:{},size:96})}):null,(0,s.jsxs)("div",{ref:ze,className:"graview-kind-face","data-graview-opened":r.opened||void 0,"data-graview-nameplate":F?r.nameplate??"full":void 0,style:{display:"flex",flexDirection:"column",gap:E?1:3,padding:E?"5px 7px":"7px 10px",borderRadius:"var(--graview-radius-sm, 9px)",justifyContent:"center",position:"relative",height:"100%",overflow:"hidden",boxSizing:"border-box",border:G?"1px solid var(--graview-accent)":O>0?"1px solid var(--graview-accent-dim)":`1px solid hsl(${Math.round(k)} 55% var(--graview-tint-lightness) / 0.34)`,backgroundColor:"var(--graview-panel)",backgroundImage:`linear-gradient(hsl(${Math.round(k)} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * ${G?1.1:He?.28:.5})), hsl(${Math.round(k)} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * ${G?1.1:He?.28:.5})))`,boxShadow:G?"0 0 0 1px var(--graview-accent-dim)":void 0},children:[!E&&!F&&d.length>0?(0,s.jsx)("div",{"data-graview-tally":d.length,"data-graview-broken":A||void 0,"aria-hidden":"true",style:{position:"absolute",left:0,right:0,top:0,display:"flex",height:3,background:`hsl(${Math.round(k)} 55% var(--graview-tint-lightness) / 0.4)`},children:A>0?(0,s.jsx)("span",{style:{width:`${Math.max(6,Math.round(A/d.length*100))}%`,background:"var(--graview-warn)"}}):null}):null,w?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:E?4:6},children:[(0,s.jsx)(ae,{kind:String(t),schema:e,...h?{brand:h}:{},size:E?14:18}),Fe]}):Fe,(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:5,fontSize:"0.875rem"},children:[(0,s.jsx)("span",{title:d.length>0?`${Q(d.length)} ${d.length===1?H(a,String(t)):o.toLowerCase()}`:void 0,style:{fontVariantNumeric:"tabular-nums",color:ke?"var(--graview-accent)":"var(--graview-ink-faint)"},children:d.length===0?"none yet":ke?O===d.length?`${O} tied`:`${O} of ${d.length} tied`:Q(d.length)}),(0,s.jsx)(be,{kind:String(t),plural:o,problems:Ht,flag:S,listed:K}),(r.retired??0)>0?(0,s.jsxs)("button",{type:"button",className:"graview-kind-past","data-graview-retired":r.retired,title:`${r.retired} retired ${o.toLowerCase()} \u2014 press to widen the view to the past`,onClick:p=>{p.stopPropagation(),W(pt(M,!0))},onDoubleClick:p=>p.stopPropagation(),onPointerDown:p=>p.stopPropagation(),children:["+",r.retired," past"]}):null,j>0?(0,s.jsxs)("button",{type:"button",className:"graview-kind-hits","data-testid":`hits-${String(t)}`,title:`${j} ${j===1?"match":"matches"} for \u201C${M.q??""}\u201D \u2014 press to go in, narrowed`,onClick:p=>{p.stopPropagation(),W(Xe(M,ne(String(t)),{ownPicture:!0,...M.q?{carry:M.q}:{}}))},onDoubleClick:p=>p.stopPropagation(),onPointerDown:p=>p.stopPropagation(),children:[j," match"]}):null,O>0&&!ke?(0,s.jsxs)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-accent)"},children:[O," tied"]}):null,r.hasOwnView&&!F?(0,s.jsx)("span",{title:`${o} has a view of its own`,"aria-label":"has its own view",style:{fontSize:"0.6875rem",color:"var(--graview-accent)"},children:"\u25C6"}):null,!E&&d.length>0&&!r.focused?(0,s.jsxs)("button",{type:"button",className:"graview-kind-open","data-testid":`open-${String(t)}`,"aria-expanded":K,"aria-label":K?`Close up the ${o}`:`See the ${o} in here`,title:K?"Close it up":`See the ${o} in here`,onClick:p=>{p.stopPropagation(),Y?K?N():b([ne(String(t))]):C(ne(String(t)))},onDoubleClick:p=>p.stopPropagation(),onPointerDown:p=>p.stopPropagation(),children:[(0,s.jsx)("span",{className:"graview-kind-open-word",children:K?"close":"open"})," ",(0,s.jsx)("span",{"aria-hidden":"true",children:K?"\u25B4":"\u25BE"})]}):null]}),F&&r.states?(0,s.jsx)(P.Suspense,{fallback:null,children:(0,s.jsx)(tn,{states:r.states,definition:a})}):null,r.opened?(0,s.jsxs)("div",{className:"graview-kind-members","data-graview-buildings":r.plot?.side??1,style:{display:"grid",gridTemplateColumns:`repeat(${y.columns}, minmax(0, 1fr))`,gap:3},children:[d.slice(0,y.shown).map(p=>{let T=r.flagged?.includes(p.id)??!1,D=$(a,p);return(0,s.jsx)(X,{pickId:p.id,label:T?`${D} ${S}`:D,title:T?`${D} \u2014 implicated in a problem`:void 0,hue:k,selected:Ie.has(p.id)},p.id)}),d.length>y.shown?(0,s.jsxs)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",padding:"2px 4px",gridColumn:"1 / -1"},children:["+",d.length-y.shown," more \u2014 double-click to go in"]}):null]}):null]}),!E&&z.length>0?(0,s.jsx)("div",{className:"graview-drive-in","data-testid":`drive-in-${String(t)}`,"data-graview-showing":R,onPointerDown:p=>p.stopPropagation(),onDoubleClick:p=>p.stopPropagation(),children:(0,s.jsx)("div",{className:"graview-drive-in-marquee",role:"group","aria-label":`${o}: pictures`,"data-graview-thumbs":z.length===1?"one":"two",children:z.map(p=>{let T=R===p.as;return(0,s.jsxs)("div",{className:"graview-drive-in-thumb","data-graview-pressed":T||void 0,children:[(0,s.jsx)("span",{className:"graview-drive-in-thumb-title","aria-hidden":"true",children:p.title}),(0,s.jsx)("button",{type:"button",className:"graview-drive-in-thumb-press","data-testid":`showing-${p.as}`,"aria-label":`${o}: ${p.title}`,"aria-pressed":T,title:T?`${p.title} is showing \u2014 press again to open it`:`Show ${p.title} on the billboard \u2014 double-click to open it`,onClick:D=>{D.stopPropagation();let Z=()=>W(Je(M,String(t),p.as));if(D.detail>=2||T&&r.focused){Z();return}W(je(_e(qe(M,!0),Ue(String(t))),"view",p.as)),D.detail===1&&Zt(D.currentTarget.ownerDocument,Ct(D.nativeEvent),Z)}})]},p.as)})})}):null]})};m.generic=!0,f.generic=!0,n.register(t,{cardinality:"one",fidelity:"full"},_(l)).register(t,{cardinality:"one",fidelity:"summary"},_(g)).register(t,{cardinality:"one",fidelity:"glyph"},_(u)).register(t,{cardinality:"many",fidelity:"full"},_(m)).register(t,{cardinality:"many",fidelity:"summary"},_(m)).register(t,{cardinality:"many",fidelity:"glyph"},_(f))}return n}var Ee=L(I(),1),$t=new WeakMap;function an(e){let n=$t.get(e);return n||$t.set(e,n=At(e,me(e))),n}var Ve=et;function Vt(){return(0,$e.useContext)(Ve)}function jn({children:e}){return(0,Ee.jsx)(Ve.Provider,{value:!0,children:e})}function Et(e){let n=(0,$e.useContext)(Ve),{store:t}=V();if(n)return null;let a=e.kind??e.node?.kind??e.nodes?.[0]?.kind;if(!a)return null;let o=an(t.schema).lookup(a,{cardinality:e.cardinality,fidelity:e.fidelity});return o?(0,Ee.jsx)(o,{...e}):null}var i=L(I(),1),rn=90,Dt=(0,v.createContext)(null),Lt=(e,n)=>e.trim().toLowerCase().replace(/[_-]+/g," ")===n.trim().toLowerCase().replace(/[_-]+/g," "),on=(0,v.createContext)(null),Be=(0,v.createContext)(null);function Mt({block:e}){let n=(0,v.useContext)(Be),t=n?.slots?.[e.key],a=(0,i.jsx)(sn,{block:e});return t?(0,i.jsx)(v.Suspense,{fallback:a,children:(0,i.jsx)(t,{block:e,node:n.node,drawn:a})}):a}function sn({block:e}){let n=(0,v.useContext)(Dt),t=(0,v.useContext)(dn),a=(0,v.useContext)(De),o=(0,v.useContext)(Pe);if(n&&e.t==="badge"&&n.values.some(l=>Lt(l,e.text))||n&&e.t==="field"&&n.field!==void 0&&e.field===n.field||e.t==="badge"&&/^0(?:\s+\p{L}+)?$/u.test(e.text.trim()))return null;switch(e.t){case"title":return(0,i.jsx)("strong",{className:"graview-spec-title",...o!==null&&Lt(o,e.text)?{"aria-hidden":!0}:{},children:e.text});case"text":return e.markdown||Ce(e.text)?(0,i.jsx)("div",{className:"graview-spec-text",...e.tone?{"data-graview-tone":e.tone}:{},children:(0,i.jsx)(ft,{text:e.text,markdown:e.markdown})}):(0,i.jsx)("p",{className:"graview-spec-text",...e.tone?{"data-graview-tone":e.tone}:{},children:e.text});case"badge":return(0,i.jsx)("span",{className:"graview-spec-badge","data-graview-tone":e.tone,children:e.text});case"field":return(0,i.jsxs)("span",{className:"graview-spec-field","data-graview-field":e.field,children:[(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,i.jsx)("span",{className:"graview-spec-value",...Ce(e.text)?{style:{whiteSpace:"pre-line"}}:{},children:e.linked?(0,i.jsx)(gt,{relation:e.linked.relation,refs:e.linked.refs,as:"chip"}):e.app?(0,i.jsx)(yt,{address:e.app}):e.href?(0,i.jsx)("a",{className:"graview-spec-link",href:e.href,...e.href.startsWith("tel:")?{}:{rel:"noopener noreferrer",target:"_blank"},children:e.text}):e.text})]});case"image":return(0,i.jsx)(ve,{as:"block",field:e.field,files:e.files,label:e.label,view:e.as});case"progress":return e.value===void 0||e.max===void 0?(0,i.jsxs)("span",{className:"graview-spec-progress",children:[(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,i.jsx)("span",{className:"graview-spec-value",children:e.text})]}):(0,i.jsxs)("span",{className:"graview-spec-progress",children:[(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}),(0,i.jsx)("span",{className:"graview-spec-track",role:"progressbar","aria-label":e.label,"aria-valuemin":0,"aria-valuemax":e.max,"aria-valuenow":Math.max(0,Math.min(e.value,e.max)),"aria-valuetext":e.text,children:(0,i.jsx)("span",{className:"graview-spec-fill",style:{width:`${Math.round(Math.max(0,Math.min(e.value,e.max))/e.max*100)}%`}})}),(0,i.jsx)("span",{className:"graview-spec-value",children:e.text})]});case"group":return(0,i.jsx)("span",{className:"graview-spec-group","data-direction":e.direction,children:(0,i.jsx)(Le,{blocks:e.blocks})});case"when":return e.shown?(0,i.jsx)(Le,{blocks:e.blocks}):null;case"divider":return(0,i.jsx)("hr",{className:"graview-spec-divider"});case"figure":return(0,i.jsx)(ln,{});case"headline":{let l=`h${Math.min(6,e.level+t)}`,g=(0,i.jsx)(l,{className:"graview-spec-headline","data-level":e.level,"data-long":e.text.length>rn?"":void 0,children:e.text});return a!==null&&e.level===1?(0,i.jsxs)(i.Fragment,{children:[g,a]}):g}case"number":return(0,i.jsxs)("span",{className:"graview-spec-number",...e.emphasis?{"data-emphasis":e.emphasis}:{},children:[(0,i.jsx)("span",{className:"graview-spec-number-value",children:e.text}),e.label?(0,i.jsx)("span",{className:"graview-spec-label",children:e.label}):null]});case"list":return(0,i.jsx)(gn,{list:e})}}function ln(){let e=(0,v.useContext)(Be)?.figure;return e?(0,i.jsx)("span",{className:"graview-spec-figure","aria-hidden":"true",children:e()}):null}function Le({blocks:e}){let n=[];for(let t=0;t<e.length;t++){let a=t;for(;e[a]?.t==="badge"&&e[a+1]?.t==="badge";)a++;if(a===t){n.push((0,i.jsx)(Mt,{block:e[t]},t));continue}n.push((0,i.jsx)("span",{className:"graview-spec-badges",children:e.slice(t,a+1).map((o,l)=>(0,i.jsx)(Mt,{block:o},l))},t)),t=a}return n}function Tt({blocks:e,ctx:n,view:t}){let a=(0,v.useContext)(on)?.[t];return(0,i.jsx)(Be.Provider,{value:{figure:n.figure,slots:a,node:n.node},children:(0,i.jsx)(Le,{blocks:e})})}function Ge({blocks:e,ctx:n,view:t}){return(0,i.jsx)(Tt,{blocks:J(e,n),ctx:n,view:t})}var Me=3,Bt=(0,v.createContext)(0),Gt=(0,v.createContext)(null),dn=(0,v.createContext)(0),De=(0,v.createContext)(null);function cn({node:e,as:n,depth:t,said:a=null}){let{store:o,views:l}=V(),g=$(o.schema.tryDefinition(e.kind),e),u=l.lookup(e.kind,{cardinality:"one",fidelity:n==="card"?"summary":"glyph"});return n==="row"&&t<=Me&&(!u||pe(u))?(0,i.jsxs)("li",{className:"graview-spec-item","data-graview-listed":e.id,"data-as":n,children:[(0,i.jsx)(Te,{node:e,label:g}),(0,i.jsx)("div",{className:"graview-spec graview-spec-row","data-graview-spec":"row","data-graview-kind":e.kind,"aria-hidden":"true",children:(0,i.jsx)("strong",{className:"graview-spec-title",children:g})})]}):(0,i.jsxs)("li",{className:"graview-spec-item","data-graview-listed":e.id,"data-as":n,children:[(0,i.jsx)(Te,{node:e,label:g}),t<=Me&&u?(0,i.jsx)(Ye,{mode:"scene",children:(0,i.jsx)(Bt.Provider,{value:t,children:(0,i.jsx)(Dt.Provider,{value:a,children:(0,i.jsx)(Pe.Provider,{value:g,children:(0,i.jsx)(u,{node:e,cardinality:"one",fidelity:n==="card"?"summary":"glyph",mode:"scene",selected:!1})})})})}):(0,i.jsx)("span",{className:"graview-spec-item-name","aria-hidden":"true",children:g})]})}function Te({node:e,label:n,describedBy:t}){let a=(0,v.useContext)(Gt),o=(0,v.useRef)(null);return bt(o),a?(0,i.jsx)("a",{ref:o,className:"graview-spec-item-link",href:a.href(e),"aria-label":n,...t?{"aria-describedby":t}:{},onClick:l=>{l.metaKey||l.ctrlKey||l.shiftKey||l.button!==0||(l.preventDefault(),l.stopPropagation(),a.go(e))}}):(0,i.jsx)("button",{ref:o,type:"button",className:"graview-spec-item-link","data-graview-pick":e.id,"aria-label":n,...t?{"aria-describedby":t}:{}})}function gn({list:e}){let n=(0,v.useContext)(Bt)+1,{store:t}=V(),a=(0,v.useContext)(Gt),[o,l]=(0,v.useState)(e.members.length);if(e.failed)return(0,i.jsx)("p",{className:"graview-spec-text",children:"\u2014"});if(e.members.length===0)return e.empty?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-empty",children:e.empty}):null;let g=(b,N=null)=>n>Me?(0,i.jsx)("ul",{className:"graview-spec-list","data-as":"names",children:b.map(C=>(0,i.jsxs)("li",{className:"graview-spec-item","data-graview-listed":C.id,"data-as":"name",children:[(0,i.jsx)(Te,{node:C,label:$(t.schema.tryDefinition(C.kind),C)}),(0,i.jsx)("span",{className:"graview-spec-item-name","aria-hidden":"true",children:$(t.schema.tryDefinition(C.kind),C)})]},C.id))}):(0,i.jsx)("ul",{className:"graview-spec-list","data-as":e.as,children:b.map(C=>(0,i.jsx)(cn,{node:C,as:e.as,depth:n,said:N},C.id))}),u=e.rest??[],m=Math.min(o,e.members.length+u.length),c=m>e.members.length?[...e.members,...u].slice(0,m):e.members,f=e.members.length+u.length-m,r=Math.max(1,e.members.length),d=f>0?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-more",children:(0,i.jsx)("button",{type:"button",className:"graview-spec-show-more","data-graview-show-more":f,onClick:()=>l(m+r),children:`Show ${Math.min(r,f)} more`})}):null,y=e.total??e.members.length+e.more,k=e.more-u.length,h=d??(a?.more&&y>c.length?a.more({members:c,total:y}):k>0?(0,i.jsx)("p",{className:"graview-spec-text graview-spec-more",children:`and ${k} more`}):null);if(!e.groups)return(0,i.jsxs)("div",{className:"graview-spec-listing",children:[g(c),h]});let w=`h${e.headingLevel}`,S=m,x=m>e.members.length&&e.everyGroup?e.everyGroup.flatMap(b=>{if(S<=0)return[];let N=b.members.slice(0,S);return S-=N.length,[{...b,members:N}]}):e.groups;return(0,i.jsxs)("div",{className:"graview-spec-listing",children:[x.map(b=>(0,i.jsxs)("section",{className:"graview-spec-list-group","data-graview-group":b.value??"",children:[b.heading?(0,i.jsx)(w,{className:"graview-spec-list-heading",children:b.heading}):null,g(b.members,b.value!==null?{values:[b.value,...b.heading?[b.heading]:[]]}:null)]},b.value??"")),h]})}function la({blocks:e,heading:n=2,firstHeading:t,slot:a,view:o=a}){let{store:l,brand:g}=V();ue();let u=re(l,null,null,{heading:n,firstHeading:t,money:g}),m=(0,v.useContext)(De),c=e.some(f=>f.t==="headline");return(0,i.jsxs)("div",{className:`graview-spec graview-spec-${a}`,"data-graview-spec":a,children:[m!==null&&!c?m:null,(0,i.jsx)(De.Provider,{value:c?m:null,children:(0,i.jsx)(Ge,{blocks:e,ctx:u,view:o})})]})}function Oe(e,n="card"){let{store:t,brand:a}=V(),o=t.schema;return{...re(t,null,e,{slot:n,money:a}),figure:()=>(0,i.jsx)(ae,{kind:e.kind,schema:o,...a?{brand:a}:{},size:22})}}function un({slot:e,blocks:n,node:t,selected:a}){let o=Oe(t,e);return(0,i.jsx)("div",{className:`graview-spec graview-spec-${e}`,"data-graview-spec":e,"data-graview-kind":t.kind,...e==="row"&&n.some(st)?{"data-graview-tall":""}:{},...a?{"data-selected":""}:{},children:(0,i.jsx)(Ge,{blocks:n,ctx:o,view:`${t.kind}.${e}`})})}function pn({blocks:e,node:n,selected:t,flagged:a}){let o=Oe(n),[l,...g]=e,u=l?.t==="title";return(0,i.jsx)(U,{...u?{title:J([l],o)[0].text}:{},selected:t,tone:a?"warning":"muted",fit:!0,children:(0,i.jsx)("div",{className:"graview-spec graview-spec-card","data-graview-spec":"card","data-graview-kind":n.kind,children:(0,i.jsx)(Ge,{blocks:u?g:e,ctx:o,view:`${n.kind}.card`})})})}function mn({blocks:e,props:n}){let t=n.node,a=Oe(t,"page"),o=Vt(),l=J(e,a),g=ye(e,l),u=g.title!==void 0&&(!o||g.title===$(a.schema?.tryDefinition(t.kind),t)),m=(0,i.jsx)("div",{className:"graview-spec graview-spec-page","data-graview-spec":"page","data-graview-kind":t.kind,children:(0,i.jsx)(Tt,{blocks:u?l.slice(1):l,ctx:a,view:`${t.kind}.page`})});return o?m:(0,i.jsx)(oe.Provider,{value:{nodeId:t.id,...g.title!==void 0?{title:g.title}:{},body:m,fields:g.fields,records:g.records},children:(0,i.jsx)(Et,{...n})})}function da(e,n,t){return typeof e=="function"?e.says?.(n,t):void 0}function hn({blocks:e,node:n,selected:t}){let{store:a}=V();return(0,i.jsx)("div",{title:$(a.schema.tryDefinition(n.kind),n),style:{minWidth:0,maxWidth:"100%"},children:(0,i.jsx)(un,{slot:"row",blocks:e,node:n,selected:t})})}function ca(e,n,t){if(!t)return e;let a=new Set(n.kinds);for(let[o,l]of Object.entries(t)){if(!a.has(o)||!l)continue;let g=o;if(l.card){let u=ie(l.card),m=c=>c.node?(0,i.jsx)(pn,{blocks:u,node:c.node,selected:c.selected,flagged:c.flagged?.includes(c.node.id)??!1}):null;e.register(g,{cardinality:"one",fidelity:"summary"},m)}if(l.row){let u=ie(l.row),m=c=>c.node?(0,i.jsx)(hn,{blocks:u,node:c.node,selected:c.selected}):null;m.says=(c,f)=>ye(u,J(u,re({graph:f,schema:n},null,c,{slot:"row"}))),e.register(g,{cardinality:"one",fidelity:"glyph"},m)}if(l.page){let u=ie(l.page),m=c=>c.node?(0,i.jsx)(mn,{blocks:u,props:c}):null;m.says=(c,f)=>ye(u,J(u,re({graph:f,schema:n},null,c))),e.register(g,{cardinality:"one",fidelity:"full"},m)}}return e}export{bt as a,jn as b,Dt as c,Gt as d,dn as e,De as f,Te as g,la as h,da as i,ca as j,At as k};