graview 0.1.54 → 0.1.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/preview/{chunk.XTT6ERI3.js → chunk.22MIRLL6.js} +1 -1
- package/dist/preview/chunk.2BLRCT3E.js +1 -0
- package/dist/preview/chunk.2DETYEJM.js +1 -0
- package/dist/preview/{chunk.AN5QCSVK.js → chunk.2E6EWVWR.js} +1 -1
- package/dist/preview/{chunk.RBYRT2I2.js → chunk.2HZGUVB2.js} +1 -1
- package/dist/preview/{chunk.ZBHFCSKO.js → chunk.2OX4YI46.js} +1 -1
- package/dist/preview/{chunk.E5JX5LWY.js → chunk.2YNZVNCA.js} +1 -1
- package/dist/preview/chunk.3V2WH6F7.js +1 -0
- package/dist/preview/chunk.3X3GLNWQ.js +1 -0
- package/dist/preview/chunk.45VIF2SX.js +5 -0
- package/dist/preview/{chunk.VGOWGOGD.js → chunk.4EUH6TLG.js} +2 -2
- package/dist/preview/chunk.4EY6WPSM.js +2 -0
- package/dist/preview/{chunk.Y2DFDMT6.js → chunk.4KMY24YC.js} +1 -1
- package/dist/preview/chunk.4YI6656P.js +1 -0
- package/dist/preview/{chunk.D2PJG5N7.js → chunk.5B4HNQGR.js} +1 -1
- package/dist/preview/chunk.5MS2TQFX.js +1 -0
- package/dist/preview/chunk.5MSWUTDB.js +1 -0
- package/dist/preview/{chunk.BOMYLOCX.js → chunk.64IKLRUS.js} +1 -1
- package/dist/preview/{chunk.VYKEIKY5.js → chunk.65Q5MKDW.js} +1 -1
- package/dist/preview/{chunk.3IEJQAK7.js → chunk.6HLKAUWF.js} +1 -1
- package/dist/preview/chunk.6Q6BW4QT.js +2 -0
- package/dist/preview/chunk.7ECBGIUK.js +1 -0
- package/dist/preview/{chunk.J2Z6WLCH.js → chunk.7NP2I2UP.js} +1 -1
- package/dist/preview/{chunk.5C43AM3X.js → chunk.7O6Z3BFR.js} +1 -1
- package/dist/preview/chunk.7RJGEU3Y.js +1 -0
- package/dist/preview/{chunk.TUNHUTQ5.js → chunk.7U2JO7ET.js} +1 -1
- package/dist/preview/chunk.7Z2PRPYE.js +1 -0
- package/dist/preview/{chunk.3JMZHCB4.js → chunk.7Z4USR3Y.js} +1 -1
- package/dist/preview/chunk.AGTFYPXY.js +1 -0
- package/dist/preview/{chunk.XZJ6XX5I.js → chunk.AIK3Z25Y.js} +1 -1
- package/dist/preview/{chunk.ZDDWXRPK.js → chunk.AKVBU5K5.js} +1 -1
- package/dist/preview/chunk.AKW6NR3X.js +1 -0
- package/dist/preview/{chunk.2DFWOLL2.js → chunk.AM2YRNOQ.js} +1 -1
- package/dist/preview/{chunk.2WSRJGW2.js → chunk.APXYWI3L.js} +1 -1
- package/dist/preview/{chunk.7SCENHVG.js → chunk.AQCU6TPV.js} +1 -1
- package/dist/preview/{chunk.B2X6DA2Q.js → chunk.AZUTYY2S.js} +1 -1
- package/dist/preview/chunk.BJUUSIQY.js +1 -0
- package/dist/preview/{chunk.FRZQSSGE.js → chunk.BNEOLRQG.js} +1 -1
- package/dist/preview/chunk.BT7RLFPO.js +1 -0
- package/dist/preview/{chunk.4GHXAWIE.js → chunk.C2VFDBSG.js} +1 -1
- package/dist/preview/{chunk.C3AHDHX7.js → chunk.CGM7OER2.js} +1 -1
- package/dist/preview/{chunk.4F5M5XZG.js → chunk.CKV2QCH5.js} +1 -1
- package/dist/preview/{chunk.4KTHJY5N.js → chunk.CU2NQ5WF.js} +1 -1
- package/dist/preview/{chunk.ARRLAAG6.js → chunk.D4LN33J2.js} +1 -1
- package/dist/preview/{chunk.W6NCLU5Y.js → chunk.D6BMAGPR.js} +1 -1
- package/dist/preview/{chunk.RCFAHV5N.js → chunk.D6KF72MZ.js} +1 -1
- package/dist/preview/{chunk.L7MFTL5S.js → chunk.DH7M57SE.js} +1 -1
- package/dist/preview/chunk.DPPT6WAJ.js +2 -0
- package/dist/preview/{chunk.45HTFSWD.js → chunk.DTSTUC2W.js} +1 -1
- package/dist/preview/{chunk.VTO6UWUP.js → chunk.DWMAFMYZ.js} +1 -1
- package/dist/preview/chunk.DZYLH5IM.js +1 -0
- package/dist/preview/{chunk.PZ4G5QA5.js → chunk.E33EJU3Q.js} +1 -1
- package/dist/preview/{chunk.33YC5RCB.js → chunk.E4EN4X5F.js} +1 -1
- package/dist/preview/{chunk.DF7IPT7V.js → chunk.E4HSSGF7.js} +1 -1
- package/dist/preview/{chunk.PZWJUQAO.js → chunk.E5XNQTEU.js} +1 -1
- package/dist/preview/{chunk.FWKNR7XF.js → chunk.EC5IWN74.js} +2 -2
- package/dist/preview/chunk.FBR4HJ2Q.js +1 -0
- package/dist/preview/{chunk.AKLVSZ5A.js → chunk.FCUDBMGC.js} +1 -1
- package/dist/preview/chunk.FOQENWF5.js +1 -0
- package/dist/preview/{chunk.SLBWPVIY.js → chunk.FQLNBIQ5.js} +1 -1
- package/dist/preview/{chunk.562IVJHX.js → chunk.G3ORIU7C.js} +1 -1
- package/dist/preview/chunk.GNQW4JOG.js +18 -0
- package/dist/preview/chunk.GUP7LC5O.js +21 -0
- package/dist/preview/{chunk.FWZF7X6A.js → chunk.HFVMGTNL.js} +2 -2
- package/dist/preview/chunk.HVN2DVP3.js +1 -0
- package/dist/preview/{chunk.4WH4N4V7.js → chunk.I2C5LPB5.js} +1 -1
- package/dist/preview/{chunk.BPWSQVEN.js → chunk.IF4FCQPG.js} +1 -1
- package/dist/preview/{chunk.U7GN6UPR.js → chunk.ILSK2E3R.js} +1 -1
- package/dist/preview/{chunk.2LMB5E6N.js → chunk.IRMO4FUC.js} +1 -1
- package/dist/preview/chunk.IT763BYH.js +1 -0
- package/dist/preview/chunk.IUQOSPQX.js +1 -0
- package/dist/preview/{chunk.Y36WSKL5.js → chunk.J3YBEZKE.js} +1 -1
- package/dist/preview/{chunk.4V64RBCK.js → chunk.JHFHIG4P.js} +1 -1
- package/dist/preview/chunk.JL4DGITZ.js +1 -0
- package/dist/preview/{chunk.463PGKOL.js → chunk.JQY2UKU6.js} +1 -1
- package/dist/preview/{chunk.IDYPQ45A.js → chunk.JZDKHWRL.js} +1 -1
- package/dist/preview/{chunk.6BBB7SJL.js → chunk.K2JE3PD7.js} +1 -1
- package/dist/preview/chunk.K4MO22RM.js +1 -0
- package/dist/preview/{chunk.NEJSKMJV.js → chunk.K5YLQAFW.js} +1 -1
- package/dist/preview/{chunk.IMHUKSPM.js → chunk.KBL4Y4UN.js} +1 -1
- package/dist/preview/chunk.KMEKMCKG.js +3 -0
- package/dist/preview/{chunk.3ZONBC6L.js → chunk.LKK7VQBA.js} +1 -1
- package/dist/preview/chunk.LLOZKUCA.js +1 -0
- package/dist/preview/{chunk.YXRKZMS5.js → chunk.LP3SHWJG.js} +1 -1
- package/dist/preview/chunk.LVOVPU64.js +1 -0
- package/dist/preview/chunk.MEJUAV3Y.js +1 -0
- package/dist/preview/{chunk.7JCUSYS5.js → chunk.MFDSWA2W.js} +1 -1
- package/dist/preview/{chunk.JTOAZ2IR.js → chunk.MJMVGW6Z.js} +1 -1
- package/dist/preview/{chunk.SDO3DD77.js → chunk.MLRPCZVS.js} +1 -1
- package/dist/preview/{chunk.OCV46AFN.js → chunk.MORMTKVR.js} +1 -1
- package/dist/preview/{chunk.FMP6NDRZ.js → chunk.N3Q5CPVA.js} +1 -1
- package/dist/preview/{chunk.VW6X53E7.js → chunk.N7EEPFYV.js} +1 -1
- package/dist/preview/{chunk.NGWHV4G6.js → chunk.NBLMANHT.js} +1 -1
- package/dist/preview/{chunk.5RH6FO3K.js → chunk.NFU4UM6F.js} +1 -1
- package/dist/preview/chunk.NPAWTPLQ.js +25 -0
- package/dist/preview/{chunk.B6PKKEY3.js → chunk.NQ4VGKEC.js} +1 -1
- package/dist/preview/{chunk.MNW2ZBQ6.js → chunk.NUE5VG4G.js} +1 -1
- package/dist/preview/{chunk.XBDFXFWM.js → chunk.O6LDZWLR.js} +1 -1
- package/dist/preview/chunk.OBUKZQCZ.js +1 -0
- package/dist/preview/{chunk.GKLDSHHH.js → chunk.ONGZ3YQF.js} +1 -1
- package/dist/preview/chunk.OYGPNO7A.js +1 -0
- package/dist/preview/chunk.PJCVFYFU.js +1 -0
- package/dist/preview/{chunk.IYYP6QUH.js → chunk.PMPDLE56.js} +1 -1
- package/dist/preview/{chunk.PR2TSHE7.js → chunk.PRV3KYT6.js} +2 -2
- package/dist/preview/chunk.Q7X2IVLH.js +1 -0
- package/dist/preview/chunk.QAIYYIZQ.js +1 -0
- package/dist/preview/chunk.QNNRSPIJ.js +2 -0
- package/dist/preview/{chunk.KI6M3EWZ.js → chunk.QSO5BP2H.js} +1 -1
- package/dist/preview/{chunk.WICMCZ27.js → chunk.QW3QLE53.js} +1 -1
- package/dist/preview/{chunk.WHGEDJB2.js → chunk.QYFZ7AZS.js} +2 -2
- package/dist/preview/{chunk.Q6RUTFU3.js → chunk.RDL6652E.js} +1 -1
- package/dist/preview/{chunk.MDWCX3YU.js → chunk.RR2IFETZ.js} +1 -1
- package/dist/preview/{chunk.R7RDUW37.js → chunk.RXYE2DAJ.js} +1 -1
- package/dist/preview/chunk.SDLUWRGI.js +1 -0
- package/dist/preview/chunk.SOTB6C5A.js +1 -0
- package/dist/preview/{chunk.3SOJJAMY.js → chunk.SRC37GNP.js} +1 -1
- package/dist/preview/{chunk.CB7IUKY7.js → chunk.SVAQGVS4.js} +1 -1
- package/dist/preview/chunk.T2RME6XF.js +1 -0
- package/dist/preview/{chunk.COWJTVZV.js → chunk.T6HG2XIP.js} +1 -1
- package/dist/preview/{chunk.6TILXTP6.js → chunk.TAIYNHSW.js} +1 -1
- package/dist/preview/chunk.TAJ2R44N.js +1 -0
- package/dist/preview/{chunk.BUDEUNBN.js → chunk.TQCRFZ53.js} +1 -1
- package/dist/preview/{chunk.ZYW7Q5EN.js → chunk.TXWCTHMI.js} +1 -1
- package/dist/preview/chunk.UE5YS3GN.js +1 -0
- package/dist/preview/{chunk.C6HBYRGJ.js → chunk.UQQAGT3R.js} +1 -1
- package/dist/preview/chunk.USB6B6L3.js +104 -0
- package/dist/preview/{chunk.KRVEAIKW.js → chunk.USQNSNIA.js} +1 -1
- package/dist/preview/{chunk.AZGXBTOQ.js → chunk.V3NPUAPB.js} +1 -1
- package/dist/preview/{chunk.NDI5OWIB.js → chunk.VDD3RHLB.js} +1 -1
- package/dist/preview/{chunk.ULSN3ASK.js → chunk.VEOS25PQ.js} +1 -1
- package/dist/preview/chunk.VIQ6EF2O.js +1 -0
- package/dist/preview/{chunk.OZ4EJ5M6.js → chunk.VLBY66PB.js} +2 -2
- package/dist/preview/chunk.VSM72NVF.js +1 -0
- package/dist/preview/{chunk.GVUJCOKD.js → chunk.VYW7DSUW.js} +2 -2
- package/dist/preview/{chunk.DTJ4FIHM.js → chunk.WMB2NNBD.js} +1 -1
- package/dist/preview/{chunk.KJGNLWU3.js → chunk.WPJVMVAL.js} +1 -1
- package/dist/preview/{chunk.CB5DGKR5.js → chunk.XGCOWCA2.js} +1 -1
- package/dist/preview/chunk.XJFAUOJS.js +1 -0
- package/dist/preview/{chunk.7TMWMW4W.js → chunk.XY5EVI22.js} +1 -1
- package/dist/preview/chunk.YEJ4LNUP.js +5 -0
- package/dist/preview/{chunk.FCZ7UFJI.js → chunk.YL5ZCRHQ.js} +1 -1
- package/dist/preview/{chunk.MAWP27FD.js → chunk.YLMOGGEP.js} +1 -1
- package/dist/preview/{chunk.WVWXNW74.js → chunk.ZFXHZZHW.js} +1 -1
- package/dist/preview/index.html +52 -51
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.25P5SDNR.js +0 -1
- package/dist/preview/chunk.27O4LIDU.js +0 -1
- package/dist/preview/chunk.3G5DEGFA.js +0 -1
- package/dist/preview/chunk.3MZIWKNG.js +0 -5
- package/dist/preview/chunk.3V2WXZU3.js +0 -1
- package/dist/preview/chunk.4BX3KLAA.js +0 -1
- package/dist/preview/chunk.4TGQ6Z6E.js +0 -1
- package/dist/preview/chunk.57VTD3CU.js +0 -1
- package/dist/preview/chunk.5M62CMLA.js +0 -1
- package/dist/preview/chunk.5VF2RT4H.js +0 -1
- package/dist/preview/chunk.5XAIP3BS.js +0 -1
- package/dist/preview/chunk.5ZWE72VJ.js +0 -1
- package/dist/preview/chunk.6SPORDJC.js +0 -1
- package/dist/preview/chunk.7UD2JR6J.js +0 -1
- package/dist/preview/chunk.AG7CUSSV.js +0 -1
- package/dist/preview/chunk.C6HI3LRB.js +0 -1
- package/dist/preview/chunk.D6ACCKYJ.js +0 -1
- package/dist/preview/chunk.EC7I33WI.js +0 -1
- package/dist/preview/chunk.GHPCSNM6.js +0 -21
- package/dist/preview/chunk.HLDMTKUP.js +0 -1
- package/dist/preview/chunk.J3OX474P.js +0 -1
- package/dist/preview/chunk.JCFYZEMY.js +0 -1
- package/dist/preview/chunk.JLB4QP6Q.js +0 -1
- package/dist/preview/chunk.JXGDVJ4N.js +0 -1
- package/dist/preview/chunk.K2J26XMB.js +0 -104
- package/dist/preview/chunk.KLJDBYAZ.js +0 -1
- package/dist/preview/chunk.LNOWO3IY.js +0 -2
- package/dist/preview/chunk.LOUICR7K.js +0 -1
- package/dist/preview/chunk.LU3B3SZH.js +0 -1
- package/dist/preview/chunk.LVOL2LEC.js +0 -1
- package/dist/preview/chunk.LYFEGG6E.js +0 -1
- package/dist/preview/chunk.MPMROUZA.js +0 -1
- package/dist/preview/chunk.MVRNEC3Y.js +0 -2
- package/dist/preview/chunk.OLKFEHWB.js +0 -1
- package/dist/preview/chunk.PCNEM3WE.js +0 -1
- package/dist/preview/chunk.QB7RYJ67.js +0 -5
- package/dist/preview/chunk.RLO3RDYH.js +0 -2
- package/dist/preview/chunk.RYMSHMLM.js +0 -1
- package/dist/preview/chunk.SF4BYBH6.js +0 -25
- package/dist/preview/chunk.SG7YVKH4.js +0 -1
- package/dist/preview/chunk.T42H5RXN.js +0 -1
- package/dist/preview/chunk.TI4OSTQV.js +0 -1
- package/dist/preview/chunk.VFMC45E7.js +0 -1
- package/dist/preview/chunk.VWQ57LTT.js +0 -18
- package/dist/preview/chunk.Y36MLVMT.js +0 -1
- package/dist/preview/chunk.Z6O7RUSR.js +0 -1
- package/dist/preview/chunk.ZAGP3OKY.js +0 -1
- package/dist/preview/chunk.ZUBC3UFG.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{f as k,h,i as b,n as S,o as w,p as I}from"./chunk.
|
|
1
|
+
import{f as k,h,i as b,n as S,o as w,p as I}from"./chunk.4EY6WPSM.js";import"./chunk.BJUUSIQY.js";import"./chunk.RDL6652E.js";import"./chunk.V3NPUAPB.js";import"./chunk.USQNSNIA.js";import"./chunk.XOZU4OFA.js";import"./chunk.IT763BYH.js";import{a as A}from"./chunk.JZDKHWRL.js";import"./chunk.SOTB6C5A.js";import"./chunk.XJFAUOJS.js";import"./chunk.DPPT6WAJ.js";import"./chunk.7U2JO7ET.js";import"./chunk.HFVMGTNL.js";import"./chunk.7Z4USR3Y.js";import{G as M,T as f}from"./chunk.NPAWTPLQ.js";import"./chunk.SDO3U72B.js";import"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import{b as d}from"./chunk.AJZBJBMO.js";var n=d(M(),1);var r=d(f(),1),C="several";function T({chosen:c,acts:p,onAct:N}){let t=A(),u=(0,n.useMemo)(()=>[...c].sort(),[c]),i=u.join(`
|
|
2
2
|
`),o=(0,n.useMemo)(()=>({on:"selection",ids:u}),[i]),l=(0,n.useMemo)(()=>p.filter(e=>e.open.length===0&&!e.more&&!e.destructive),[p]),g=(0,n.useMemo)(()=>new Map(l.map(e=>[h(e.id),e])),[l]),v=S(t,o,C),[y,x]=(0,n.useState)(null);(0,n.useEffect)(()=>{if(v!==void 0)return;let e=!0;return w(t,o,{by:C,ask:()=>b(t.ai,{store:t.store,target:o,principal:t.principal,interaction:k(),places:t.places,selection:t.selection,...t.place?{place:t.place}:{},shared:l.map(a=>({id:a.id,label:a.label,mutation:a.mutation,args:a.args}))})}).then(a=>{e&&x({key:i,result:a})}),()=>{e=!1}},[i]);let s=v??(y?.key===i?y.result:void 0);if(s===void 0)return(0,r.jsx)("span",{role:"status",className:"graview-several-quiet","data-testid":"several-ai-thinking",style:{textDecoration:"none"},children:"AI: thinking\u2026"});let m=s.offers.filter(e=>e.type!=="act"||g.has(e.id));if(m.length===0)return null;let E=e=>{let a=g.get(e.id);if(a){t.desk.record({...s.interaction,outcome:"accepted",accepted:[e.id]}),N(a);return}I(t,s,e)};return(0,r.jsx)("div",{role:"group","aria-label":"Suggested by AI",className:"graview-several-acts","data-testid":"several-ai",children:m.map(e=>(0,r.jsxs)("button",{type:"button",className:"graview-several-act","data-testid":"several-ai-offer","data-ai-offer":e.id,"data-ai-offer-type":e.type,onClick:()=>E(e),children:[e.label,(0,r.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontWeight:400},children:" \xB7 suggested"})]},e.id))})}export{T as SeveralAi};
|
package/dist/preview/index.html
CHANGED
|
@@ -5,66 +5,67 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
6
|
<title>Graview preview</title>
|
|
7
7
|
<link rel="preload" href="/graview/document" as="fetch" crossorigin="anonymous">
|
|
8
|
-
<link rel="modulepreload" href="/chunk.
|
|
9
|
-
<link rel="modulepreload" href="/chunk.
|
|
10
|
-
<link rel="modulepreload" href="/chunk.
|
|
11
|
-
<link rel="modulepreload" href="/chunk.
|
|
12
|
-
<link rel="modulepreload" href="/chunk.
|
|
13
|
-
<link rel="modulepreload" href="/chunk.
|
|
14
|
-
<link rel="modulepreload" href="/chunk.
|
|
15
|
-
<link rel="modulepreload" href="/chunk.
|
|
16
|
-
<link rel="modulepreload" href="/chunk.
|
|
8
|
+
<link rel="modulepreload" href="/chunk.2OX4YI46.js">
|
|
9
|
+
<link rel="modulepreload" href="/chunk.APXYWI3L.js">
|
|
10
|
+
<link rel="modulepreload" href="/chunk.XY5EVI22.js">
|
|
11
|
+
<link rel="modulepreload" href="/chunk.MFDSWA2W.js">
|
|
12
|
+
<link rel="modulepreload" href="/chunk.K4MO22RM.js">
|
|
13
|
+
<link rel="modulepreload" href="/chunk.KMEKMCKG.js">
|
|
14
|
+
<link rel="modulepreload" href="/chunk.HFVMGTNL.js">
|
|
15
|
+
<link rel="modulepreload" href="/chunk.7Z4USR3Y.js">
|
|
16
|
+
<link rel="modulepreload" href="/chunk.NPAWTPLQ.js">
|
|
17
17
|
<link rel="modulepreload" href="/chunk.SDO3U72B.js">
|
|
18
|
-
<link rel="modulepreload" href="/chunk.
|
|
19
|
-
<link rel="modulepreload" href="/chunk.
|
|
18
|
+
<link rel="modulepreload" href="/chunk.YEJ4LNUP.js">
|
|
19
|
+
<link rel="modulepreload" href="/chunk.FQLNBIQ5.js">
|
|
20
20
|
<link rel="modulepreload" href="/chunk.AJZBJBMO.js">
|
|
21
|
-
<link rel="modulepreload" href="/chunk.
|
|
22
|
-
<link rel="modulepreload" href="/chunk.
|
|
23
|
-
<link rel="modulepreload" href="/chunk.
|
|
24
|
-
<link rel="modulepreload" href="/chunk.
|
|
25
|
-
<link rel="modulepreload" href="/chunk.
|
|
21
|
+
<link rel="modulepreload" href="/chunk.2BLRCT3E.js">
|
|
22
|
+
<link rel="modulepreload" href="/chunk.GNQW4JOG.js">
|
|
23
|
+
<link rel="modulepreload" href="/chunk.USB6B6L3.js">
|
|
24
|
+
<link rel="modulepreload" href="/chunk.AZUTYY2S.js">
|
|
25
|
+
<link rel="modulepreload" href="/chunk.45VIF2SX.js">
|
|
26
|
+
<link rel="modulepreload" href="/chunk.IUQOSPQX.js">
|
|
26
27
|
<link rel="modulepreload" href="/chunk.UGFDSE37.js">
|
|
27
|
-
<link rel="modulepreload" href="/chunk.EC7I33WI.js">
|
|
28
28
|
<link rel="modulepreload" href="/chunk.PXQVXBNG.js">
|
|
29
|
-
<link rel="modulepreload" href="/chunk.
|
|
30
|
-
<link rel="modulepreload" href="/chunk.
|
|
31
|
-
<link rel="modulepreload" href="/chunk.
|
|
32
|
-
<link rel="modulepreload" href="/chunk.
|
|
33
|
-
<link rel="modulepreload" href="/chunk.
|
|
34
|
-
<link rel="modulepreload" href="/chunk.
|
|
35
|
-
<link rel="modulepreload" href="/chunk.
|
|
36
|
-
<link rel="modulepreload" href="/chunk.
|
|
37
|
-
<link rel="modulepreload" href="/chunk.
|
|
38
|
-
<link rel="modulepreload" href="/chunk.
|
|
39
|
-
<link rel="modulepreload" href="/chunk.
|
|
40
|
-
<link rel="modulepreload" href="/chunk.
|
|
41
|
-
<link rel="modulepreload" href="/chunk.
|
|
42
|
-
<link rel="modulepreload" href="/chunk.
|
|
43
|
-
<link rel="modulepreload" href="/chunk.
|
|
44
|
-
<link rel="modulepreload" href="/chunk.
|
|
45
|
-
<link rel="modulepreload" href="/chunk.
|
|
46
|
-
<link rel="modulepreload" href="/chunk.
|
|
47
|
-
<link rel="modulepreload" href="/chunk.
|
|
48
|
-
<link rel="modulepreload" href="/chunk.
|
|
29
|
+
<link rel="modulepreload" href="/chunk.VYW7DSUW.js">
|
|
30
|
+
<link rel="modulepreload" href="/chunk.LKK7VQBA.js">
|
|
31
|
+
<link rel="modulepreload" href="/chunk.RR2IFETZ.js">
|
|
32
|
+
<link rel="modulepreload" href="/chunk.ONGZ3YQF.js">
|
|
33
|
+
<link rel="modulepreload" href="/chunk.XGCOWCA2.js">
|
|
34
|
+
<link rel="modulepreload" href="/chunk.MORMTKVR.js">
|
|
35
|
+
<link rel="modulepreload" href="/chunk.CU2NQ5WF.js">
|
|
36
|
+
<link rel="modulepreload" href="/chunk.E33EJU3Q.js">
|
|
37
|
+
<link rel="modulepreload" href="/chunk.PJCVFYFU.js">
|
|
38
|
+
<link rel="modulepreload" href="/chunk.7RJGEU3Y.js">
|
|
39
|
+
<link rel="modulepreload" href="/chunk.22MIRLL6.js">
|
|
40
|
+
<link rel="modulepreload" href="/chunk.NFU4UM6F.js">
|
|
41
|
+
<link rel="modulepreload" href="/chunk.DH7M57SE.js">
|
|
42
|
+
<link rel="modulepreload" href="/chunk.AIK3Z25Y.js">
|
|
43
|
+
<link rel="modulepreload" href="/chunk.CKV2QCH5.js">
|
|
44
|
+
<link rel="modulepreload" href="/chunk.BT7RLFPO.js">
|
|
45
|
+
<link rel="modulepreload" href="/chunk.TAJ2R44N.js">
|
|
46
|
+
<link rel="modulepreload" href="/chunk.VLBY66PB.js">
|
|
47
|
+
<link rel="modulepreload" href="/chunk.BJUUSIQY.js">
|
|
48
|
+
<link rel="modulepreload" href="/chunk.RDL6652E.js">
|
|
49
|
+
<link rel="modulepreload" href="/chunk.V3NPUAPB.js">
|
|
49
50
|
<link rel="modulepreload" href="/chunk.XOZU4OFA.js">
|
|
50
|
-
<link rel="modulepreload" href="/chunk.
|
|
51
|
+
<link rel="modulepreload" href="/chunk.IT763BYH.js">
|
|
51
52
|
<link rel="modulepreload" href="/chunk.MB7LKKUD.js">
|
|
52
53
|
<link rel="modulepreload" href="/chunk.WVUJXDXZ.js">
|
|
53
|
-
<link rel="modulepreload" href="/chunk.
|
|
54
|
-
<link rel="modulepreload" href="/chunk.
|
|
55
|
-
<link rel="modulepreload" href="/chunk.
|
|
56
|
-
<link rel="modulepreload" href="/chunk.
|
|
57
|
-
<link rel="modulepreload" href="/chunk.
|
|
54
|
+
<link rel="modulepreload" href="/chunk.T2RME6XF.js">
|
|
55
|
+
<link rel="modulepreload" href="/chunk.SOTB6C5A.js">
|
|
56
|
+
<link rel="modulepreload" href="/chunk.TQCRFZ53.js">
|
|
57
|
+
<link rel="modulepreload" href="/chunk.6HLKAUWF.js">
|
|
58
|
+
<link rel="modulepreload" href="/chunk.FCUDBMGC.js">
|
|
58
59
|
<link rel="modulepreload" href="/chunk.GZHZLJBF.js">
|
|
59
|
-
<link rel="modulepreload" href="/chunk.
|
|
60
|
+
<link rel="modulepreload" href="/chunk.E5XNQTEU.js">
|
|
60
61
|
<link rel="modulepreload" href="/chunk.OJGHDWI6.js">
|
|
61
|
-
<link rel="modulepreload" href="/chunk.
|
|
62
|
-
<link rel="modulepreload" href="/chunk.
|
|
63
|
-
<link rel="modulepreload" href="/chunk.
|
|
64
|
-
<link rel="modulepreload" href="/chunk.
|
|
65
|
-
<link rel="modulepreload" href="/chunk.
|
|
66
|
-
<link rel="modulepreload" href="/chunk.
|
|
67
|
-
<script>(()=>{const later=["/chunk.
|
|
62
|
+
<link rel="modulepreload" href="/chunk.K5YLQAFW.js">
|
|
63
|
+
<link rel="modulepreload" href="/chunk.XJFAUOJS.js">
|
|
64
|
+
<link rel="modulepreload" href="/chunk.DPPT6WAJ.js">
|
|
65
|
+
<link rel="modulepreload" href="/chunk.7U2JO7ET.js">
|
|
66
|
+
<link rel="modulepreload" href="/chunk.HVN2DVP3.js">
|
|
67
|
+
<link rel="modulepreload" href="/chunk.YL5ZCRHQ.js">
|
|
68
|
+
<script>(()=>{const later=["/chunk.3V2WH6F7.js","/chunk.WPJVMVAL.js","/chunk.EC5IWN74.js","/chunk.HJCQ6I3S.js","/chunk.7O6Z3BFR.js","/chunk.I2C5LPB5.js","/chunk.6Q6BW4QT.js","/chunk.64IKLRUS.js","/chunk.DTSTUC2W.js","/chunk.UQQAGT3R.js","/chunk.JL4DGITZ.js","/chunk.JQY2UKU6.js","/chunk.PRV3KYT6.js","/chunk.Q7X2IVLH.js","/chunk.AKVBU5K5.js","/chunk.LLOZKUCA.js","/chunk.2DETYEJM.js"],first=[...document.querySelectorAll('link[rel="modulepreload"]')];let left=first.length;const go=()=>{for(const href of later){const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};if(left===0)return go();const one=()=>{if(--left===0)go()};for(const link of first){link.addEventListener("load",one,{once:true});link.addEventListener("error",one,{once:true})}})()</script>
|
|
68
69
|
<style>html,body{margin:0;height:100%}#graview-app{min-height:100dvh}</style>
|
|
69
70
|
</head>
|
|
70
71
|
<body>
|
package/dist/preview/page.js
CHANGED
|
@@ -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 Xr}from"./chunk.ZBHFCSKO.js";import{a as Dt,b as er,c as tr,d as nr,e as rr,f as Vt,g as or,h as Bt}from"./chunk.7JCUSYS5.js";import{a as Wt,b as ir,c as sr,d as dr,e as $t,f as cr,g as lr,h as ur,i as fr,j as pr,k as mr,l as hr,m as yr,n as qe}from"./chunk.2WSRJGW2.js";import{b as ar}from"./chunk.7TMWMW4W.js";import{a as At,g as xn}from"./chunk.JCFYZEMY.js";import{k as rt}from"./chunk.ZUBC3UFG.js";import{E as Qn,I as Zn,J as Xn,h as Gn,k as Mt,l as Un,n as Kn,r as Jn,w as Ht,z as Yn}from"./chunk.FWZF7X6A.js";import{c as Zr}from"./chunk.3JMZHCB4.js";import{Aa as Nn,Ca as In,Da as _n,Fa as jn,G as Ct,Ga as Lt,Ka as qn,La as zn,Oa as it,T as Cn,Z as Ln,a as On,b as ot,c as at,ga as Mn,ha as Hn,j as Fn,m as Ft,va as Dn,wa as Vn,xa as Bn,ya as Wn,za as $n}from"./chunk.SF4BYBH6.js";import{a as Ee}from"./chunk.SDO3U72B.js";import{Bb as vn,Hd as Ae,Id as En,Jd as Rn,Od as Rt,Pd as Tt,Qd as xt,Sc as Sn,Td as Tn,Ud as Ot,cb as We,ec as Et,fc as bn,fd as Pn,hd as kn,id as An,kd as nt,nb as tt,ob as wn}from"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as Le}from"./chunk.AJZBJBMO.js";function Nt(e){if(Array.isArray(e))return e.map(Nt);if(e&&typeof e=="object"){let n={};for(let o of Object.keys(e).sort()){let i=e[o];i!==void 0&&(n[o]=Nt(i))}return n}return e}function It(e){return JSON.stringify(Nt(e))??"undefined"}async function st(e,n={}){let o=e.compiled===void 0||!to(e.compiled,e.document)?void 0:xn(e.compiled,n);if(o?.ok)return o;let{compileDocumentWithoutCheck:i}=await eo();return i(e.document,n)}var gr,eo=()=>gr??=(__graviewPreload(import.meta.url,["./chunk.JCFYZEMY.js","./chunk.BUDEUNBN.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.T42H5RXN.js")).catch(e=>{throw gr=void 0,e});function to(e,n){let o=typeof e=="object"&&e!==null?e.document:void 0,i=n;if(typeof i=="string")try{i=JSON.parse(i)}catch{return!1}return o!==void 0&&It(At(o).document)===It(At(i).document)}var c=Le(Ct(),1);var ct=Le(Ct(),1),_t="data-graview-drawn",no=200,wr=50,ro=1e4,dt=()=>typeof performance<"u"?performance.now():Date.now();function oo(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 ao(e,n){if(e.ownerDocument.fonts?.status==="loading"||Vn()>0||Nn(n)>0||e.querySelector('[aria-busy="true"]')||oo(e).some(i=>!i.complete&&i.loading!=="lazy"))return!1;for(let i of e.querySelectorAll("[data-worker-view-place]"))if(!i.querySelector("[data-worker-view][data-worker-view-drawn], [data-worker-view][data-worker-view-failed]"))return!1;return!0}function vr(e){let n=e.querySelector("[data-embed-content]"),o=[...e.querySelectorAll("[data-worker-view]")].map(i=>`${i.offsetWidth}x${i.offsetHeight}`);return`${e.scrollWidth}x${e.scrollHeight}|${n?`${n.scrollWidth}x${n.scrollHeight}`:""}|${o.join(",")}`}function io(e,n,o,i){e.removeAttribute(_t);let d=e.ownerDocument.defaultView;if(!d)return()=>{};let l=dt(),S=l,p=vr(e),w=!1,R,O=typeof MutationObserver>"u"?void 0:new MutationObserver(v=>{v.some(q=>!(q.target===e&&q.attributeName===_t))&&(S=dt())});O?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let P=()=>{w=!0,O?.disconnect(),R!==void 0&&clearTimeout(R)},k=v=>{let q=!1,de=()=>{q||(q=!0,v())};typeof d.requestAnimationFrame=="function"&&d.requestAnimationFrame(()=>setTimeout(de,0)),setTimeout(de,100)},C=()=>{if(w)return;let v=vr(e);v!==p&&(p=v,S=dt());let q=dt();if(ao(e,i)&&q-S>=no||q-l>=ro){k(()=>{w||(P(),e.setAttribute(_t,n),_n(),o())});return}R=setTimeout(C,wr)};return R=setTimeout(C,wr),P}function br(e,n,o,i,d){In();let l=(0,ct.useRef)({place:o,onDrawn:i});l.current={place:o,onDrawn:i},(0,ct.useLayoutEffect)(()=>{d&&$n(d);let S=R=>io(R,l.current.place.path,()=>l.current.onDrawn?.(l.current.place),d);if(e.current)return S(e.current);let p,w=!1;return queueMicrotask(()=>{!w&&e.current&&(p=S(e.current))}),()=>{w=!0,p?.()}},[n,e,d])}var ye=Le(Ct(),1),ze,so=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.KY7QD22S.js","./chunk.WICMCZ27.js","./chunk.2DFWOLL2.js","./chunk.LU3B3SZH.js","./chunk.HLDMTKUP.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.C6HI3LRB.js"))),Sr=()=>so().then(e=>void(ze=e),()=>new Promise(e=>setTimeout(e,2e3)).then(Sr)),jt=Dn(Sr),Pr=e=>!!e&&ze===void 0;function qt({onReady:e,fetch:n}){return(0,ye.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var co=0;function kr(e){let[n,o]=(0,ye.useState)(()=>ze);(0,ye.useEffect)(()=>{if(!e||n)return;let l=!1;return jt().then(()=>{l||o(ze)}),()=>{l=!0}},[e,n]);let i=(0,ye.useMemo)(()=>co+=1,[e]);return{over:(0,ye.useMemo)(()=>{let l=n??ze;if(!e||!l)return;let{source:S,worker:p,...w}=e,R={...w,worker:p??{source:S},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:O=>l.registerWorkerView(O,R)}},[e,n]),n:i}}var Rr=Le(Xr(),1),j=Le(Zr(),1);var h=Le(Cn(),1);function lt(e,n={}){let o=Lt(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 Ut=e=>Promise.all([e,Zn()]).then(([n])=>n),Tr=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.EC7I33WI.js","./chunk.3ZONBC6L.js","./chunk.FWKNR7XF.js","./chunk.GKLDSHHH.js","./chunk.OCV46AFN.js","./chunk.Y36MLVMT.js","./chunk.MPMROUZA.js","./chunk.HJCQ6I3S.js","./chunk.5C43AM3X.js","./chunk.4WH4N4V7.js","./chunk.5VF2RT4H.js","./chunk.5RH6FO3K.js","./chunk.ZDDWXRPK.js","./chunk.LOUICR7K.js","./chunk.L7MFTL5S.js","./chunk.4F5M5XZG.js","./chunk.3G5DEGFA.js","./chunk.BOMYLOCX.js","./chunk.45HTFSWD.js","./chunk.Q6RUTFU3.js","./chunk.AZGXBTOQ.js","./chunk.2WSRJGW2.js","./chunk.7TMWMW4W.js","./chunk.TI4OSTQV.js","./chunk.C6HBYRGJ.js","./chunk.GZHZLJBF.js","./chunk.PZWJUQAO.js","./chunk.OJGHDWI6.js","./chunk.NEJSKMJV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.WHGEDJB2.js"))),lo=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.VWQ57LTT.js","./chunk.K2J26XMB.js","./chunk.B2X6DA2Q.js","./chunk.QB7RYJ67.js","./chunk.UGFDSE37.js","./chunk.EC7I33WI.js","./chunk.PXQVXBNG.js","./chunk.GVUJCOKD.js","./chunk.3ZONBC6L.js","./chunk.MDWCX3YU.js","./chunk.CB5DGKR5.js","./chunk.GKLDSHHH.js","./chunk.OCV46AFN.js","./chunk.4KTHJY5N.js","./chunk.PZ4G5QA5.js","./chunk.Y36MLVMT.js","./chunk.MPMROUZA.js","./chunk.XTT6ERI3.js","./chunk.5RH6FO3K.js","./chunk.L7MFTL5S.js","./chunk.XZJ6XX5I.js","./chunk.4F5M5XZG.js","./chunk.LVOL2LEC.js","./chunk.3G5DEGFA.js","./chunk.OZ4EJ5M6.js","./chunk.Q6RUTFU3.js","./chunk.AZGXBTOQ.js","./chunk.XOZU4OFA.js","./chunk.AG7CUSSV.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.GZHZLJBF.js","./chunk.PZWJUQAO.js","./chunk.OJGHDWI6.js","./chunk.NEJSKMJV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.57VTD3CU.js"))),uo=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.VWQ57LTT.js","./chunk.K2J26XMB.js","./chunk.B2X6DA2Q.js","./chunk.QB7RYJ67.js","./chunk.UGFDSE37.js","./chunk.EC7I33WI.js","./chunk.PXQVXBNG.js","./chunk.GVUJCOKD.js","./chunk.3ZONBC6L.js","./chunk.MDWCX3YU.js","./chunk.CB5DGKR5.js","./chunk.GKLDSHHH.js","./chunk.OCV46AFN.js","./chunk.4KTHJY5N.js","./chunk.PZ4G5QA5.js","./chunk.Y36MLVMT.js","./chunk.MPMROUZA.js","./chunk.XTT6ERI3.js","./chunk.5RH6FO3K.js","./chunk.L7MFTL5S.js","./chunk.XZJ6XX5I.js","./chunk.4F5M5XZG.js","./chunk.LVOL2LEC.js","./chunk.3G5DEGFA.js","./chunk.OZ4EJ5M6.js","./chunk.Q6RUTFU3.js","./chunk.AZGXBTOQ.js","./chunk.XOZU4OFA.js","./chunk.AG7CUSSV.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.GZHZLJBF.js","./chunk.PZWJUQAO.js","./chunk.OJGHDWI6.js","./chunk.NEJSKMJV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.KLJDBYAZ.js"))),xr=lt(()=>Ut(Tr().then(e=>e.SceneFace)),{what:"This view"}),Or=lt(()=>Tr().then(e=>e.SceneKeeping),{quiet:!0}),Fr=lt(()=>Ut(lo().then(e=>e.PagesContent)),{what:"This page"}),Cr=lt(()=>Ut(uo().then(e=>e.PictureFace)),{what:"This picture"}),fo=xr.Face,po=Or.Face,mo=Fr.Face,ho=Cr.Face;function Me(...e){let n=e.length>0?e:["scene","pages","picture"],o=new Set(n.flatMap(Lr));return Promise.all([...[...o].map(i=>i.fetch()),Kn()]).then(()=>{},()=>{})}var Lr=e=>e==="pages"?[Fr]:e==="picture"?[Cr]:[xr,Or],Mr=e=>Lr(e).every(n=>n.here()),yo=150,zt=0;function Ar(e,n){if(Mr(e))return n();let o=++zt,i=()=>{o===zt&&(zt+=1,n())};Me(e).then(i),setTimeout(i,yo)}var go=768;function wo(e,n){let o=n!==null&&n>=go;(0,c.useEffect)(()=>{if(!o||e==="picture")return;let i=e==="pages"?"scene":"pages";if(Mr(i))return;let d=globalThis,l=()=>void Me(i),S=()=>{},p=jn(()=>{if(d.requestIdleCallback&&d.cancelIdleCallback){let w=d.requestIdleCallback(l,{timeout:4e3});S=()=>d.cancelIdleCallback?.(w)}else{let w=setTimeout(l,1500);S=()=>clearTimeout(w)}});return()=>(p(),S())},[e,o])}function vo({asked:e,shown:n,onDrawn:o}){return(0,c.useLayoutEffect)(()=>o(e,n),[e,n,o]),null}function bo({auto:e,scene:n}){return(0,h.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${$t}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var So=Lt(Ee(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,h.jsx)(e.StudioPlace,{...n}),{quiet:!0});function Hr(e,n,o,i,d){return Vt(e,rr(n?at(n):d??On,i),o)}function Kt(e){return e&&at(e).overview?"graview":"scene"}function Er(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 Dr(e){let[,n]=(0,c.useState)(!1),o=(0,c.useCallback)(()=>n(!0),[]),i=(0,c.useRef)(!1);return e.at&&!ut?(0,h.jsx)(qt,{onReady:o,fetch:Jt}):!i.current&&Pr(e.draftView)?(0,h.jsx)(qt,{onReady:o,fetch:jt}):(i.current=!0,(0,h.jsx)(Po,{...e}))}function Po(e){let{app:n,stop:o,bar:i=!0,standing:d="Everything is in order",principal:l,heading:S=2}=e,{rootRef:p,scope:w,css:R,scheme:O,store:P,presence:k,brand:C,auto:v,height:q}=cr(e),de=kr(e.draftView),V=sr(e,Xn,de.over),[ee]=(0,c.useState)(Wn),f=e.basePath===void 0?{}:{basePath:e.basePath},[B]=(0,c.useState)(Mt),U=e.notices??B,Q=y=>Rt(y,f),F={...e.routing?{routing:e.routing}:{},...f},[ue]=(0,c.useState)(()=>{let y=e.at?.face;if(y)return y;let H=o===void 0&&Er(n,V)?"pages":Kt(o),D=Dt({...F,face:H});return e.face===void 0&&e.onOpening?.(D),D}),[W,x]=(0,c.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&o===void 0&&er(F)&&Er(n,V)),Te=(0,c.useRef)(e.onFace);Te.current=e.onFace,(0,c.useLayoutEffect)(()=>{W&&(Te.current?.("pages"),x(!1))},[W]);let A=W?"pages":e.face??ue,oe=n.schema.kinds,T=e.routing==="address",Z=(0,c.useMemo)(()=>e.at?ut.settleAt(e,P.seenBy(l??{kind:"human"}),V.places()):void 0,[]),$=(0,c.useMemo)(()=>Hn(V,n.schema),[V,n.schema]),fe=(0,c.useMemo)(()=>{let y=Z?.stop??(T?tr(e.basePath):void 0)??o;return A==="scene"&&y===void 0&&$===void 0&&(e.path===void 0||Gt(e.path))?Bt(void 0):Hr(A,y,oe,V.places(),$)},[]),[ve]=(0,c.useState)(A);(0,c.useEffect)(()=>{ve!=="pages"&&Mn(V)},[ve,V]);let N=(0,c.useRef)(void 0),z=y=>y===void 0||Gt(y)?"/":y;N.current??={path:z(Z?.path??(T?A==="pages"?(Tt(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==N.current.asked&&(N.current={path:z(e.path),asked:e.path});let I=(0,c.useRef)(e.onNavigate);I.current=e.onNavigate;let ae=(0,c.useCallback)((y,H)=>{N.current.path=y,I.current?.(y,H)},[]),{at:L,setAt:xe,steering:K,steer:te}=mr(N.current.path),M=(0,c.useContext)(Vr);M&&(M.pages=()=>N.current.path);let pe=(0,c.useRef)(void 0),ie=(0,c.useCallback)(y=>void(N.current.path=y),[]),ce=Gn(p),[be,He]=(0,c.useState)(!1),Y=e.pagesBelow!==void 0&&ce!==null&&ce<e.pagesBelow&&(A==="scene"||A==="graview")&&!be,E=Y?"pages":A,Ie=(0,c.useRef)(!1);Ie.current=be&&e.pagesBelow!==void 0&&ce!==null&&ce<e.pagesBelow&&(A==="scene"||A==="graview"),M&&(M.shown=E);let ne=(0,c.useRef)(A==="graview"?"graview":"scene");(E==="scene"||E==="graview")&&(ne.current=E),(0,c.useState)(()=>{if(!T||typeof window>"u"||E==="pages"||E==="picture")return;let{pathname:y,search:H,hash:D}=window.location;Tt(y,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${Q(Ae)}${H}${D}`)}),dr(p,E,e.onIntrinsicHeight),wo(E,ce);let le=hr(e.onError,E),Se=yr(e.onReady,E),_e=(0,c.useRef)(e.onFaceDrawn);_e.current=e.onFaceDrawn;let De=(0,c.useCallback)((y,H)=>{Se(H),_e.current?.(y)},[Se]),[ht,yt]=(0,c.useState)(null),Ue=V.places(),_=(0,c.useRef)({shown:E,onFace:e.onFace});_.current={shown:E,onFace:e.onFace};let re=(0,c.useCallback)((y,H,D)=>{if(T){pe.current?.(y,H,D);return}_.current.onFace?.(y),I.current?.(y==="pages"?H??N.current.path:Ae,"push")},[T]),[X,Oe]=(0,c.useState)(void 0);(0,c.useEffect)(()=>{E==="pages"&&Oe(void 0)},[E]);let Pe=(0,c.useRef)(o);(0,c.useEffect)(()=>{Pe.current!==o&&(Pe.current=o,Oe(void 0))},[o]);let Ke=(0,c.useCallback)(y=>{if(_.current.shown==="pages"){if(He(!0),Oe(y),A==="scene"||A==="graview"){Ar(A,()=>{T?window.history.pushState(null,"",`${Q(Ae)}${y??""}`):I.current?.(Ae,"push")});return}Ar(ne.current,()=>re(ne.current,void 0,y))}},[T,A,e.basePath,re]),ke=(0,c.useCallback)(y=>{if(_.current.shown==="pages"){K.go.current||(N.current.path=y),te(y);return}if(N.current.path=y,xe(y),Ie.current){He(!1),T?window.history.pushState(null,"",Q(y)):I.current?.(y,"push");return}re("pages",y)},[K,te,xe,re,T,e.basePath]),Fe=V.arrangement?.(),me=E==="pages",Ve=e.hrefOf,G=Ve??(T?Q:void 0),Ce=(0,c.useMemo)(()=>({open:ke,...Ve?{href:Ve}:T?{href:y=>Rt(y,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[ke,T,e.basePath,Ve]);return(0,h.jsxs)("section",{ref:p,className:w,"aria-label":e.label??n.name,"data-graview-embed":E,"data-graview-scheme":O,...Y?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:q,minHeight:v?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,h.jsx)("style",{children:R}),(0,h.jsxs)(zn.Provider,{value:le,children:[(0,h.jsx)(lr,{rootRef:p,board:U}),(0,h.jsx)(ir,{rootRef:p,firstLook:e.firstLook,app:Yn(C??{name:n.name},n.schema)}),(0,h.jsx)(qe,{module:"@graview/react",report:le,content:!0,children:(0,h.jsx)(Bn.Provider,{value:ee,children:(0,h.jsx)(Ln,{store:P,views:V,initialView:fe,scheme:O,...ur(e,k,C),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,h.jsxs)(Un.Provider,{value:U,children:[(0,h.jsx)(Ro,{face:E,stop:X??o,kinds:oe,places:Ue,opens:$}),M?(0,h.jsx)(ko,{into:M}):null,(0,h.jsx)(Ao,{rootRef:p,face:A,shown:E,path:L,stop:o,draft:de.n,onDrawn:e.onDrawn,parts:ee}),T?(0,h.jsx)(nr,{pagesWere:Z?.path,basePath:e.basePath,shown:E,onFace:e.onFace,toggle:pe,kinds:oe,places:Ue,opens:$,landed:ie}):null,i&&E!=="picture"?(0,h.jsx)(qe,{module:"@graview/embed",report:le,children:(0,h.jsx)(fr,{name:C?.name??n.name,heading:S,named:Wt(i).name!==!1,faces:Wt(i).faces===!1?void 0:{scene:{label:En(Fe),current:!me,go:()=>Ke(),reach:()=>void Me(ne.current)},pages:{label:Rn(Fe),current:me,go:()=>ke(N.current.path),reach:()=>void Me("pages")}},at:me?L:null,without:e.pages?.without(),home:{...G?.("/")!==void 0?{href:G("/")}:{},go:()=>ke("/"),current:me&&L.split("?")[0]==="/"},reach:{...G?{href:G}:{},go:y=>ke(y.path)},standing:d,hostActions:e.hostActions,keeping:me?void 0:(0,h.jsx)(To,{app:n,studio:e.studio,report:le}),onFind:yt,switch:e.switch})}):null,(0,h.jsx)(Jn.Provider,{value:ht,children:(0,h.jsx)(qe,{module:E==="pages"||E==="picture"?"@graview/pages":"@graview/react",report:le,content:!0,children:(0,h.jsxs)(c.Suspense,{fallback:(0,h.jsx)(bo,{auto:v,scene:E!=="pages"&&E!=="picture"}),children:[E==="picture"?(0,h.jsx)(ho,{scope:w,store:P,views:V,as:(o?at(o).within?.view:void 0)??""}):E==="pages"?(0,h.jsx)(mo,{store:P,views:V,presence:k,auto:v,brand:C,steering:K,overview:Ke,scope:w,titleLevel:pr(S),quickAsk:Ht(e.quickAsk),props:{...e,onNavigate:ae,...T?{}:{path:N.current.path}}}):(0,h.jsx)(qn.Provider,{value:Ce,children:(0,h.jsx)(fo,{address:T,auto:v,scheme:O,scope:w,quickAsk:Ht(e.quickAsk)})}),(0,h.jsx)(vo,{asked:A,shown:E,onDrawn:De})]})},E)})]})})})})]})]})}var Gt=e=>e.split(/[?#]/)[0]===Ae,Vr=(0,c.createContext)(null);function ko({into:e}){return e.view=it().view,null}function Ao({rootRef:e,face:n,shown:o,path:i,stop:d,draft:l,onDrawn:S,parts:p}){let{view:w}=it(),R=o==="scene"||o==="graview",O=ot(w),{pan:P,...k}=w,C=w.pan?ot(k):O,v={face:n,path:R?Ae:o==="picture"?d??"#":i,stop:O};return br(e,`${o} ${R?C:v.path} ${l}`,v,S,p),null}var ut,Eo=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.7JCUSYS5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.Y36WSKL5.js"))),Jt=()=>Eo().then(e=>void(ut=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(o),e()},o=setTimeout(n,1e4);window.addEventListener("online",n)}).then(Jt));function Ro({face:e,stop:n,kinds:o,places:i,opens:d}){let{view:l,go:S}=it(),p=(0,c.useRef)({face:e,stop:n});return(0,c.useLayoutEffect)(()=>{let w=p.current.stop!==n,R=p.current.face!==e,O=p.current.face==="pages";if(p.current={face:e,stop:n},!w&&!R||e==="pages"||e==="picture")return;let P=(w||O)&&n!==void 0?Hr(e,n,o,i):O&&or(l)?Vt(e,Bt(d),o):e==="graview"?Ft(l,!0):l.overview?Fn(Ft(l,!1),Qn(l,o)):l;S(P)},[e,n,o,l,S,d]),null}function To({app:e,studio:n,report:o}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c.Suspense,{fallback:null,children:(0,h.jsx)(po,{})}),n!==!1?(0,h.jsx)(qe,{module:"@graview/studio",report:o,children:(0,h.jsx)(xo,{app:e,studio:n})}):null]})}function xo({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}:{}},i=n?.place;return i?(0,h.jsx)(i,{...o}):(0,h.jsx)(c.Suspense,{fallback:null,children:(0,h.jsx)(So,{...o})})}function Oo({path:e,stop:n,...o},i){return{...o,app:i.app,at:i.at,remote:i.remote,...i.remote.presence?{presence:i.remote.presence}:{}}}function Yt(e,n){let o=n.store??n.remote?.store??ar(n.app,n.seed),i=n.notices??Mt(),d=null,l={},S=0,p=n.label,w=n.app,R=Promise.resolve(),O=n.at?.face??n.face,P=O===void 0?void 0:Dt({...n,face:O}),k=P??Kt(n.stop),C=null,v=[],q=f=>{if(C=f,f!==k)return;let B=v;v=[];for(let U of B)U()};function de(){let[f,B]=(0,c.useState)(P),[U,Q]=(0,c.useState)(n.stop),[F,ue]=(0,c.useState)(n.path),[W,x]=(0,c.useState)(n.scheme??"auto"),[Te,A]=(0,c.useState)(n.principal),[oe,T]=(0,c.useState)(n.seats),[Z,$]=(0,c.useState)(n.quickAsk),[fe,ve]=(0,c.useState)(n.people),[N,z]=(0,c.useState)(n.hostContext),[I,ae]=(0,c.useState)(n.brand),[L,xe]=(0,c.useState)(n.whileAway),[K,te]=(0,c.useState)(n.label),[M,pe]=(0,c.useState)(n.hostActions),[ie,ce]=(0,c.useState)(void 0),[be,He]=(0,c.useState)(n.draftView);return d={app:Y=>{ce(Y),ue(void 0),Q(void 0)},face:B,stop:Q,path:ue,scheme:x,seat:A,seats:T,quickAsk:$,people:ve,hostContext:z,brand:ae,whileAway:xe,label:te,hostActions:pe,draft:He},(0,h.jsx)(Vr.Provider,{value:l,children:(0,h.jsx)(Dr,{...ie?Oo(n,ie):n,store:o,notices:i,...f!==void 0?{face:f}:{},onOpening:Y=>{k=Y},...U!==void 0?{stop:U}:{},...F!==void 0?{path:F}:{},...Te?{principal:Te}:{},...oe?{seats:oe}:{},...Z!==void 0?{quickAsk:Z}:{},...fe?{people:fe}:{},...N?{hostContext:N}:{},...I?{brand:I}:{},whileAway:L,label:K,hostActions:M,draftView:be,scheme:W,onFace:Y=>{k=Y,B(Y)},onSeat:A,onFaceDrawn:q},ie?.n??0)})}let V=()=>{let f=l.view?.focusId,B=f?o.graph.getNode(f)?.kind:void 0,U=(l.shown??k)==="scene"||(l.shown??k)==="graview";return{face:k,path:U?Ae:l.pages?.()??n.path??"/",stop:l.view?ot(l.view):n.stop??"#",...B?{kind:B}:{}}},ee=(0,Rr.createRoot)(e);return(0,j.flushSync)(()=>ee.render((0,h.jsx)(de,{}))),{get store(){return o},where:V,setApp:(f,B,U)=>{let Q="graph"in B?{store:B}:B,F=()=>{let ue=V();o=Q.store,p=U?.label??(p===w.name?f.name:p),w=f,(0,j.flushSync)(()=>{d?.label(p),d?.app({app:f,remote:Q,at:ue,n:++S})})};ut?F():R=R.then(Jt).then(F)},setFace:f=>{k=f,(0,j.flushSync)(()=>d?.face(f))},setStop:f=>(0,j.flushSync)(()=>d?.stop(f)),setPath:f=>(0,j.flushSync)(()=>{if(Gt(f)){(k==="pages"||k==="picture")&&(k="scene",d?.face("scene"));return}d?.path(f),k!=="pages"&&(k="pages",d?.face("pages"))}),setScheme:f=>(0,j.flushSync)(()=>d?.scheme(f)),setSeat:f=>(0,j.flushSync)(()=>d?.seat(f)),setSeats:f=>(0,j.flushSync)(()=>d?.seats(f)),setQuickAsk:f=>(0,j.flushSync)(()=>d?.quickAsk(f)),setPeople:f=>(0,j.flushSync)(()=>d?.people(f)),setHostContext:f=>(0,j.flushSync)(()=>d?.hostContext(f)),setBrand:f=>(0,j.flushSync)(()=>d?.brand(f)),setWhileAway:f=>(0,j.flushSync)(()=>d?.whileAway(f)),setDraftView:f=>(0,j.flushSync)(()=>d?.draft(f)),setLabel:f=>{p=f,(0,j.flushSync)(()=>d?.label(f))},setHostActions:f=>(0,j.flushSync)(()=>d?.hostActions(f)),drawn:()=>R.then(()=>C===k?void 0:new Promise(f=>v.push(f))),notify:f=>{let B;return(0,j.flushSync)(()=>{B=i.notify(f)}),B},unmount:()=>ee.unmount()}}var ft=e=>`s${(e+1).toString(36)}`;var Br="/graview/live",Qt="graview.ship",Zt=`${Qt}.${tt}`;var ge={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 $e=class extends Error{constructor(n){super(n),this.name="Superseded"}},Re=e=>e?.lineage?{lineage:e.lineage}:{},Fo=(e,n)=>`${e.calls.map(o=>o.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
|
|
2
|
-
`)[0]??"":String(n)})`;function Co(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(i=>!!i&&Array.isArray(i.calls)):[]}catch{return[]}}var Ne=class extends Error{constructor(o){super(o.sentence);this.refusal=o;this.name="RemoteRefusedError"}},Lo={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},we=class extends Error{constructor(o,i){super(o);this.conflicts=i;this.name="StaleWrite"}},Ge=class extends Error{constructor(n){super(n),this.name="Unreached"}},Mo=new Set([502,503,504]);async function Ho(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function Do(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var Vo=1,Bo=()=>({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 pt(e){return(await Wr(e,Co(e.carry),"This app was updated while your changes were on the way.",Bo())).remote}async function Wr(e,n,o,i){let d=e.fetch??fetch,l={"content-type":"application/json",...e.headers??{}},S={...mt(e.principal),[ge.via]:e.via??"web"};Object.assign(l,S);let p=e.live===!0,w=e.presenceEveryMs,R=e.visible??No,O="connecting",P=i.statuses,k=i.tally,C=[],v,q=[],de=()=>O==="online"&&v!==void 0?"held":O,V=()=>{let t=de();if(i.told!==t){i.told=t;for(let r of[...P])r(t)}},ee=t=>{if(!(t===O||se)&&(O==="offline"&&t==="online"&&k.reconnects++,O=t,V(),t==="online"))for(let r of C.splice(0))r.again()},f=t=>{if(se)return;let r=typeof t=="string"&&t.length>0?t:void 0,s=r!==v;if(v=r,B(),!!s&&(V(),r===void 0)){for(let a of q.splice(0))a();D&&clearTimeout(D),rn()}},B=()=>{if(i.toldHeld!==v){i.toldHeld=v;for(let t of[...i.helds])t(v??null)}},U=async(t,r)=>{let s;try{s=await d(t,r)}catch(a){throw G()||ee("offline"),new Ge(a instanceof Error?a.message:String(a))}if(s.status===503&&await Ho(s))return ee("online"),s;if(Mo.has(s.status))throw G()||ee("offline"),new Ge(`The server is away (${s.status})`);return ee("online"),s},Q=async(t=!1)=>{let r=`${e.url}/graview/state?opFormat=${We.op}`,s=t?await d(r,{headers:l}):await U(r,{headers:l});if(!s.ok)throw new Error((await s.json().catch(()=>({}))).error??`The server refused (${s.status})`);return await s.json()},F=e.state??await Q(!0);p||(O="online"),v=typeof F.held=="string"&&F.held.length>0?F.held:void 0,B();let ue=F.enabledModules??e.enabledModules,W=e.localApp?e.localApp(e.app):e.app,x=new An({schema:W.schema,mutations:W.mutations??[],invariants:W.invariants??[],...W.policy?{policy:W.policy}:{},...W.publishing?{publishing:W.publishing}:{},...W.modules?{modules:W.modules}:{},...ue?{enabledModules:ue}:{},...W.intelligence?{intelligence:W.intelligence}:{},...W.brand?.timeZone?{timeZone:W.brand.timeZone}:{},snapshot:F.snapshot,log:F.log,...F.horizon!==void 0?{horizon:F.horizon}:{},ids:Do(),...e.storeOptions??{}});Sn.served.add(x);let Te=Pn(x),A=F.log.at(-1)?.seq??(F.horizon??0)-1,oe=Et.of(F.log,{horizon:F.horizon??0}),T=null,Z,$=new Map,fe=i.who,ve=!1,N=t=>{if(se)return;ve=!0;let r=Tn(new Map,t,Date.now(),xt,T?.participant);Z!==void 0&&r.delete(Z);let s=r.size!==$.size;if(!s)for(let[a,u]of r)Ot(u,$.get(a))||(s=!0);if($=r,!!s)for(let a of[...fe])a([...$.values()])},z=[],I=new Set,ae=t=>{let r=z.indexOf(t);r>=0&&z.splice(r,1)},L=new Map,xe=(t,r)=>{let s=L.get(t);s&&(L.delete(t),s.resolve({ops:r.filter(a=>a.batch===t),batch:t}))},K,te=[],M=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(K)return te.push({ops:t,drop:r}),[];let s=Math.min(...t.filter(g=>g.seq>A).map(g=>g.seq));if(Number.isFinite(s)&&s>A+1)return te.push({ops:t,drop:r}),pe(),[];let a=z.filter(g=>t.some(J=>J.batch===g)),u=[...new Set([...r,...a])].filter(g=>I.has(g)),m,b=z.filter(g=>!a.includes(g));try{m=x.rebase({confirmed:t,pending:b,drop:u}).confirmed}catch(g){if(!(g instanceof kn))throw g;return te.push({ops:t,drop:r}),pe(),[]}for(let g of a)ae(g);t.some(g=>g.seq>A)&&b.some(g=>!u.includes(g))&&k.rebases++,t.length>0&&(A=Math.max(A,...t.map(g=>g.seq)),oe.note(t));for(let g of u)I.delete(g);for(let g of a)xe(g,t);return m},pe=()=>{K||(K=Se(Q().then(t=>{if(ie(t)){te=[];return}let r=new Set(t.log.map(u=>u.batch)),s=z.filter(u=>r.has(u));for(let u of s)ae(u);let a=x.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[...z],drop:[...I].filter(u=>!z.includes(u))});I.clear();for(let u of a.pending)I.add(u.batch);A=t.log.at(-1)?.seq??(t.horizon??0)-1,oe=Et.of(t.log,{horizon:t.horizon??0}),k.resyncs++;for(let u of s)xe(u,t.log)}).then(()=>{K=void 0;let t=te;te=[];for(let{ops:r,drop:s}of t)M(r,s)},()=>{K=void 0,te=[]})))},ie=t=>(typeof t.build=="string"&&an(t.build),typeof t.version=="number"&&f(t.held),typeof t.version!="number"||t.version===F.version?!1:(vt(t.version),!0)),ce=async t=>{let s=await(await U(`${e.url}/graview/since?seq=${ft(t)}&opFormat=${We.op}`,{headers:l})).json();return ie(s)?[]:s.reset===!0?(pe(),[]):s.ops??[]},be=async()=>{let t=await He();return K&&await K,t},He=async()=>{if(T&&!G()&&R()){let r=await(await U(`${e.url}/graview/here?opFormat=${We.op}`,{method:"POST",headers:l,body:JSON.stringify({presence:T,seq:ft(A)})})).json();return ie(r)?[]:(typeof r.participant=="string"&&(Z=r.participant),N(r.who??[]),M(r.ops??[]))}return M(await ce(A))},Y=new Map,E=new Map,Ie=new Set,ne=new Map,le=new Set,Se=t=>(le.add(t),t.finally(()=>le.delete(t)).catch(()=>{}),t),_e=Promise.resolve(),De=0,ht=(t,r)=>{let s=_e.then(()=>Ue(t,r));return _e=s.catch(()=>{}),s},yt=()=>new Promise((t,r)=>C.push({again:t,give:r})),Ue=async(t,r)=>{let s,a;for(;;){try{s=await U(`${e.url}/graview/ops`,{method:"POST",headers:l,body:JSON.stringify({...t,opFormat:We.op})})}catch(g){if(!(g instanceof Ge)||X)throw g;if(await yt(),G())return Je(t,r);continue}if(a=await s.json().catch(()=>({})),s.status===503&&a.reason==="unavailable"&&typeof a.held=="string"&&!X){if(typeof a.version=="number"?ie(a):(f(a.held),!1))break;if(v!==void 0&&(kt>0||p)){if(await new Promise(g=>q.push(g)),X)throw new $e("The client closed.");if(G())return Je(t,r);continue}}let b;if(s.status===503&&a.reason==="unavailable"&&!X)b=Xt(e.backoff,De++);else{if(De=0,s.status!==429||X)break;b=Wo(s.headers.get("retry-after"),a.retryAfter)}if(await new Promise(g=>setTimeout(g,b)),G())return Je(t,r)}if(se||ie(a))throw new $e("The app was changed.");if(!s.ok){let b=a.error??`The server refused (${s.status})`;throw a.conflict?new we(b,a.conflicts??[]):new Ne({reason:a.reason??Lo[s.status]??"invalid",sentence:b,...a.wouldNeed?.length?{wouldNeed:a.wouldNeed}:{}})}let u=a.ops??[],m=u[0]?.seq;return m!==void 0&&m>A+1&&(u=await ce(A)),r!==void 0&&(a.batch&&Y.set(r,a.batch),ae(r)),M(u,r!==void 0?[r]:[]),{ops:a.ops??[],...a.batch?{batch:a.batch}:{}}},_,re=!1,X=!1,Oe=0,Pe,Ke=0,ke=0,Fe=null,me=()=>{},Ve=new Promise(t=>{me=t}),G=()=>p&&re&&_?.readyState===Vo,Ce=t=>{if(!G())return!1;try{return _.send(JSON.stringify(t)),!0}catch{return!1}},y=(t=!1)=>{!T||!G()||!R()||!t&&Fe&&Ot(T,Fe)&&(w===void 0||Date.now()-ke<w)||Ce({t:"here",presence:T})&&(Fe=T,ke=Date.now())},H=new Set,D,rn=()=>{if(D=void 0,v!==void 0)return;let t=[...L.entries()].filter(([r])=>H.has(r));H.clear();for(let[,r]of t)Ce(r.message)},on=(t,r)=>{L.has(t)&&(H.add(t),D&&clearTimeout(D),D=setTimeout(rn,Math.max(0,r)))},Ir=t=>{L.has(t)&&H.add(t)},Je=(t,r)=>new Promise((s,a)=>{let u=r??`send-${++Ke}`,m=t.undo?{t:"undo",cid:u,batches:t.undo,...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.via?{via:t.via}:{},...Re(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}:{},...Re(t)};if(L.set(u,{message:m,...r!==void 0?{mine:r}:{},resolve:s,reject:a}),H.size>0||v!==void 0){H.add(u);return}Ce(m)}),Ye=(t,r)=>G()?Je(t,r):ht(t,r),_r=t=>{switch(t.t){case"welcome":{if(an(t.build),typeof t.version=="number"&&t.version!==F.version){vt(t.version);return}if(re=!0,Oe=0,typeof t.participant=="string"&&(Z=t.participant),f(t.held),t.state?pe():M(t.ops??[]),H.clear(),D&&clearTimeout(D),D=void 0,v!==void 0)for(let r of L.keys())H.add(r);else for(let r of L.values())Ce(r.message);y(!0),ee("online"),me();return}case"ops":M(t.ops??[]);return;case"ack":{let r=L.get(t.cid);if(!r){M(t.ops??[]);return}L.delete(t.cid),De=0,r.mine!==void 0&&(Y.set(r.mine,t.batch),ae(r.mine)),M(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=L.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){v!==void 0?Ir(t.cid):on(t.cid,Xt(e.backoff,De++));return}L.delete(t.cid),r.reject(t.t==="conflict"?new we(t.sentence,t.conflicts??[]):new Ne({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&on(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":N(t.who??[]);return;case"held":f(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==F.version&&vt(t.version);return;case"reload":ln(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&_){let r=_;fn(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},se=!1,gt=i.declarations,wt=i.builds,an=t=>{if(!(se||i.otherBuild!==void 0||!e.build||typeof t!="string"||t.length===0||t===e.build)){i.otherBuild=t;for(let r of[...wt])r(t)}},sn=()=>{let t=[],r=0;for(let s of z){let a=ne.get(s);a?t.push({calls:a.calls,...a.intent?{intent:a.intent}:{},...a.via?{via:a.via}:{},...Re(a),batch:s}):r++}return{carried:t,undos:r}},dn=(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.`,cn=t=>{se=!0,T=null;let r=new $e(t);for(let a of L.values())a.reject(r);L.clear(),Xe&&clearInterval(Xe),X=!0,Pe&&clearTimeout(Pe),D&&clearTimeout(D),he&&clearTimeout(he);for(let a of C.splice(0))a.give(r);for(let a of q.splice(0))a();let s=_;_=void 0,re=!1;try{s?.close(1e3,t)}catch{}me()};async function vt(t){if(se)return;if(!e.resolveApp){ln(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:s}=sn(),a=e.resolveApp,u=T;cn("The app was changed.");try{let m=await a(t),{state:b,...g}=e,J=await Wr({...g,app:m},r,"The app was changed while your changes were on the way.",i);u&&J.remote.presence.here(u);for(let et of[...gt])et(J.remote,t);let Yr=[...s>0?[Qe(dn(s,"The app was changed"))]:[],...J.unheard()];for(let et of Yr)for(let Qr of Be)Qr(et.sentence,et)}catch(m){let b=`The app was changed, but the new version could not be opened: ${m instanceof Error?m.message:String(m)}`;for(let g of Be)g(b,Qe(b))}}function ln(t){if(se)return;let{carried:r,undos:s}=sn();cn(t);let a=!1;if(e.carry&&r.length>0)try{e.carry.storage.setItem(e.carry.key,JSON.stringify(r)),a=!0}catch{}let u=[];!a&&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(dn(s,"This app was updated"));for(let m of u)for(let b of Be)b(m,Qe(m));(e.reloadPage??$o)()}let un=()=>{if(X||!p)return;let t=`${e.url.replace(/^http/,"ws").replace(/\/$/,"")}${Br}`,{"content-type":r,...s}=l,a;try{a=e.socket?e.socket(t,s,[Zt]):Jr(t,s)}catch{return pn()}_=a,re=!1,a.onopen=()=>{_===a&&a.send(JSON.stringify({t:"hello",seq:ft(A),protocol:tt,wire:Qt,opFormat:We.op,...e.build?{build:e.build.slice(0,64)}:{},...e.hostProtocol!==void 0?{hostProtocol:e.hostProtocol}:{}}))},a.onmessage=u=>{if(_!==a)return;let m;try{m=JSON.parse(String(u.data))}catch{return}_r(m)},a.onclose=()=>fn(a),a.onerror=()=>{}},he,jr=()=>{ve=!1,he&&clearTimeout(he),he=setTimeout(()=>{if(he=void 0,ve||X)return;let t=new Map([...$].filter(([,r])=>r.held!=="socket"));if(t.size!==$.size){$=t;for(let r of fe)r([...$.values()])}},xt),he.unref?.()};function fn(t){if(_!==t)return;let r=re;_=void 0,re=!1,Fe=null,r&&(ee("offline"),jr()),pn()}let pn=()=>{if(X)return;let t=Xt(e.backoff,Oe);Oe++,Pe=setTimeout(un,t)},mn=x.applyAll.bind(x),qr=x.undo.bind(x),zr=x.previewAll.bind(x);x.previewAll=(t,r)=>zr(t,{...e.principal?{author:e.principal}:{},...r});let Be=i.refusals,je=[],Qe=t=>({reason:"invalid",sentence:t}),Ze=i.conflicts,bt=!1,hn,St=async(t,r)=>{if(r instanceof $e||se)return;let s=r instanceof Ne?r.refusal:vn(r),a=s.sentence,u=r instanceof we?hn?.yoursOf(x,ne.get(t)?.calls??[]):void 0;ae(t);try{M([],[t])}catch{}let m=ne.get(t);if(ne.delete(t),r instanceof we&&k.conflicts++,r instanceof we&&!G()&&await be().catch(()=>[]),r instanceof we&&K&&await K,r instanceof we&&Ze.size>0){let b=!1,g={sentence:a,conflicts:u?r.conflicts.map(J=>J.node===u.node&&J.field===u.field?{...J,yours:u.yours}:J):r.conflicts,keepTheirs(){b=!0},useMine(){if(!(b||!m)){b=!0,bt=!0;try{x.applyAll(u?[u.over(A)]:m.calls,{...m.intent?{intent:m.intent}:{},...m.via?{via:m.via}:{},...Re(m)})}finally{bt=!1}}}};for(let J of Ze)J(g);return}for(let b of Be)b(a,s)},Gr=(t,r)=>t.flatMap(s=>s.mutation?.name===wn?[]:s.primitives.flatMap(a=>a.op==="splice-text"&&!r.has(a.id)&&!r.has(`${a.id}\0${a.field}`)?[{node:a.id,field:a.field,rev:A}]:[]));x.applyAll=(t,r)=>{let s=bn(x.log.all().filter(b=>I.has(b.batch))),a=mn(t,{...e.principal?{author:e.principal}:{},...r}),u=t.map((b,g)=>{let J=a.minted?.[g];return J===void 0||b.args?.id!==void 0?b:{...b,mintedHint:J}});z.push(a.batch),I.add(a.batch),ne.set(a.batch,{calls:u,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...Re(r)});let m=bt?[]:[...oe.baseFor(a.ops,s,(b,g)=>x.collaborative(b,g)),...Gr(a.ops,s)];return E.set(a.batch,Se(Ye({calls:u,...r?.intent?{intent:r.intent}:{},batch:a.batch,...m.length>0?{base:m}:{},...r?.via?{via:r.via}:{},...Re(r)},a.batch).catch(b=>St(a.batch,b)))),a},x.apply=(t,r)=>x.applyAll([t],r),x.undo=(t,r)=>{let s=typeof t=="string"?[t]:t,a=qr(s.map(m=>Y.get(m)??m),{...e.principal?{author:e.principal}:{},...r});z.push(a.batch),I.add(a.batch);let u=Promise.allSettled(s.map(m=>E.get(m)));return E.set(a.batch,Se(u.then(()=>{let m=s.filter(b=>!Ie.has(b));if(m.length===0){ae(a.batch),ne.delete(a.batch),M([],[a.batch]);return}return Ye({undo:m.map(b=>Y.get(b)??b),...r?.intent?{intent:r.intent}:{},batch:a.batch,...r?.via?{via:r.via}:{},...Re(r)},a.batch)}).catch(m=>St(a.batch,m)))),a};let Ur=async(t,r={})=>{Pt++;try{return(await Se(Ye({calls:t,...r}))).ops}finally{Pt--}},Pt=0,yn={here(t){T=t,y()},onWho(t){return fe.add(t),$.size>0&&t([...$.values()]),()=>{fe.delete(t)}},leave(){if(!T)return;let t=JSON.stringify({participant:Z??T.participant});if(T=null,Ce({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(()=>{})}},kt=e.pollMs??800,Xe=kt>0&&typeof setInterval=="function"?setInterval(()=>{G()||be().catch(()=>{})},kt):null;if(p){un();let t;await Promise.race([Ve,new Promise(r=>t=setTimeout(r,e.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!se){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}:{},...Re(s)})}catch(a){t.push(Fo(s,a))}t.length>0&&je.push(Qe(`${o} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}let gn=new Map,Kr=()=>({store:x,author:e.principal,appliedAll:mn,pending:z,provisional:I,asked:ne,answers:E,letGo:Ie,sent:(t,r)=>Se(Ye({calls:r,batch:t},t).catch(s=>St(t,s))),settle:ae,land:M,seen:()=>A,gone:()=>X||se});return{remote:{store:x,typing(t,r){let s=`${t}\0${r}`,a=gn.get(s);return a||(a=(__graviewPreload(import.meta.url,["./chunk.JTOAZ2IR.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.6TILXTP6.js")).then(u=>(hn=u,u.typingOf(t,r,u.wireOf(Kr())))),gn.set(s,a)),a},version:F.version,migrated:F.migrated??[],send:Ur,pull:be,onRefusal(t){Be.add(t);let r=je;je=[];for(let s of r)t(s.sentence,s);return()=>Be.delete(t)},onDeclaration(t){return gt.add(t),()=>gt.delete(t)},onBuild(t){return wt.add(t),i.otherBuild!==void 0&&t(i.otherBuild),()=>wt.delete(t)},onConflict(t){return Ze.add(t),()=>Ze.delete(t)},revision:(t,r)=>oe.of(t,r),seq:()=>A,participant:()=>Z,transport:()=>G()?"socket":"poll",status:de,onStatus(t){return P.add(t),()=>P.delete(t)},held:()=>v,onHeld(t){return i.helds.add(t),v!==void 0&&t(v),()=>i.helds.delete(t)},counters:()=>({...k}),who:()=>[...$.values()],pending:()=>z.length+Pt,async settled(){for(;le.size>0;)await Promise.allSettled([...le])},presence:yn,close(){Xe&&clearInterval(Xe),Te(),yn.leave(),X=!0,Pe&&clearTimeout(Pe),D&&clearTimeout(D),he&&clearTimeout(he);for(let r of C.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of q.splice(0))r();let t=_;_=void 0,re=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=je;return je=[],t}};function Jr(t,r){let s=globalThis.WebSocket;if(!s)throw new Error("This runtime has no WebSocket; the client polls instead.");let a=typeof globalThis.document<"u",u=e.subprotocol?[Zt]:[];if(!a)try{return new s(t,{headers:r,...u.length>0?{protocols:u}:{}})}catch{}let m=new URL(t);for(let[b,g]of Object.entries(S))m.searchParams.set(b,g);return u.length>0?new s(m.toString(),u):new s(m.toString())}}function Wo(e,n,o=Date.now()){let i,d=e?.trim();if(d)if(/^\d+(\.\d+)?$/.test(d))i=Number(d)*1e3;else{let p=Date.parse(d);Number.isFinite(p)&&(i=Math.max(0,p-o))}let l=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,S=l!==void 0&&l<50&&i!==void 0&&Math.abs(l*1e3-i)<1e3;return l!==void 0&&!S?l:i??1e3}function $o(){globalThis.location?.reload?.()}function No(){return globalThis.document?.visibilityState!=="hidden"}function Xt(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:o=250,max:i=1e4,factor:d=2}=e??{};return Math.min(i,o*d**n)*(.75+Math.random()*.5)}function mt(e){let n={};if(!e)return n;e.id&&(n[ge.seat]=e.id),e.roles?.length&&(n[ge.roles]=e.roles.join(",")),e.kind!=="human"&&(n[ge.kind]=e.kind),e.name&&(n[ge.name]=encodeURIComponent(e.name));let o=e.onBehalfOf;return o?.id&&(n[ge.for]=o.id),o?.roles?.length&&(n[ge.forRoles]=o.roles.join(",")),o?.name&&(n[ge.forName]=encodeURIComponent(o.name)),n}var $r="/graview/views";function en(e){let n=e.fetch??fetch,o=e.url.replace(/\/$/,""),i={"content-type":"application/json",...e.principal?mt(e.principal):{},...e.headers??{}},d=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??nt.may}:nt,l=new Set,S=P=>{if(JSON.stringify(P)!==JSON.stringify(d)){d=P;for(let k of l)k()}},p=async(P,k)=>{let C=await n(`${o}${e.path??$r}`,{method:P,headers:i,...k!==void 0?{body:JSON.stringify(k)}:{}}),v=await C.json();if(!C.ok)throw new Error(v.error??`The store answered ${C.status}.`);S({hidden:v.hidden??[],removed:v.removed??[],may:v.may??nt.may})},w=()=>p("GET"),R=e.state?Promise.resolve():w().catch(()=>{}),O=e.pollMs?setInterval(()=>void w().catch(()=>{}),e.pollMs):void 0;return{ready:R,refresh:w,close:()=>clearInterval(O),current:()=>d,onChange(P){return l.add(P),()=>void l.delete(P)},hide:P=>p("POST",{hide:P}),show:P=>p("POST",{show:P}),remove:(P,k)=>p("POST",{remove:P,...k?{about:k}:{}}),async restore(P){let k=d.removed.find(C=>C.name===P)?.lens;await p("POST",{restore:P}),k&&await e.onDeclaration?.()},async lens(P){await p("POST",{lens:P}),await e.onDeclaration?.()}}}var nn=document.getElementById("graview-app"),tn=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),Nr=tn?(__graviewPreload(import.meta.url,["./chunk.K2J26XMB.js","./chunk.3G5DEGFA.js","./chunk.XOZU4OFA.js","./chunk.AG7CUSSV.js","./chunk.ZBHFCSKO.js","./chunk.7TMWMW4W.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.3SOJJAMY.js")):Me("pages");try{tn?await Io(decodeURIComponent(tn[1])):await _o()}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),nn.replaceChildren(n),window.__graviewFailed=n.textContent}async function Io(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 i=await st(o);if(!i.ok)throw new Error(rt(i.findings));let d=i.app,l=o.principal,S=await pt({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 Nr;window.__graview=p(nn,{app:d,form:e,principal:l,remote:S,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function _o(){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(),i=await(async w=>{if(typeof w.module=="string")return(await import(w.module)).app;let R=await st(w);if(!R.ok)throw new Error(rt(R.findings));return R.app})(n);if(!i||typeof i!="object"||!("schema"in i))throw new Error("The app module the preview server handed does not export an app.");let d=n.principal,l=await pt({app:i,url:location.origin,principal:d,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=i.name;let S,p=en({url:location.origin,principal:d,...n.views?{state:n.views}:{},onDeclaration:async()=>{let w=await(await fetch("/graview/document")).json();if(typeof w.module=="string")return;let R=await st(w);R.ok&&S?.setApp(R.app,l)}});await Promise.all([Nr,p.ready]),S=Yt(nn,{app:i,remote:l,principal:d,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:i.name,heading:1,keptViews:p,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=S,S.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 ro}from"./chunk.2OX4YI46.js";import{a as Wt,b as lr,c as ur,d as fr,e as It,f as pr,g as mr,h as hr,i as yr,j as gr,k as wr,l as vr,m as br,n as Ue}from"./chunk.APXYWI3L.js";import{b as dr}from"./chunk.XY5EVI22.js";import{a as Bt,b as or,c as ar,d as ir,e as sr,f as $t,g as cr,h as Nt}from"./chunk.MFDSWA2W.js";import{a as Rt,g as Ln}from"./chunk.K4MO22RM.js";import{k as it}from"./chunk.KMEKMCKG.js";import{E as tr,I as nr,J as rr,h as Yn,k as Dt,l as Qn,n as Zn,r as Xn,w as Vt,z as er}from"./chunk.HFVMGTNL.js";import{c as no}from"./chunk.7Z4USR3Y.js";import{Aa as qn,Ca as zn,Da as Gn,Fa as Un,G as Mt,Ga as Ht,Ka as Kn,La as Jn,Oa as dt,T as Dn,Z as Vn,a as Mn,b as st,c as ct,ga as Bn,ha as $n,j as Hn,m as Lt,va as Nn,wa as Wn,xa as In,ya as _n,za as jn}from"./chunk.NPAWTPLQ.js";import{a as Te}from"./chunk.SDO3U72B.js";import{$d as Cn,Eb as Sn,Pd as Re,Qd as Fn,Rd as On,Wd as xt,Xc as kn,Xd as Ft,Yd as Ot,ae as Ct,fb as _e,hc as Tt,hd as An,ic as Pn,id as En,nd as Rn,pd as Tn,qb as ot,qd as xn,rb as bn,sd as at}from"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import{b as De}from"./chunk.AJZBJBMO.js";function _t(e){if(Array.isArray(e))return e.map(_t);if(e&&typeof e=="object"){let n={};for(let o of Object.keys(e).sort()){let i=e[o];i!==void 0&&(n[o]=_t(i))}return n}return e}function jt(e){return JSON.stringify(_t(e))??"undefined"}async function lt(e,n={}){let o=e.compiled===void 0||!ao(e.compiled,e.document)?void 0:Ln(e.compiled,n);if(o?.ok)return o;let{compileDocumentWithoutCheck:i}=await oo();return i(e.document,n)}var Sr,oo=()=>Sr??=(__graviewPreload(import.meta.url,["./chunk.K4MO22RM.js","./chunk.TQCRFZ53.js","./chunk.FCUDBMGC.js","./chunk.KMEKMCKG.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.5MSWUTDB.js")).catch(e=>{throw Sr=void 0,e});function ao(e,n){let o=typeof e=="object"&&e!==null?e.document:void 0,i=n;if(typeof i=="string")try{i=JSON.parse(i)}catch{return!1}return o!==void 0&&jt(Rt(o).document)===jt(Rt(i).document)}var d=De(Mt(),1);var ft=De(Mt(),1),qt="data-graview-drawn",io=200,Pr=50,so=1e4,ut=()=>typeof performance<"u"?performance.now():Date.now();function co(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 lo(e,n){if(e.ownerDocument.fonts?.status==="loading"||Wn()>0||qn(n)>0||e.querySelector('[aria-busy="true"]')||co(e).some(i=>!i.complete&&i.loading!=="lazy"))return!1;for(let i of e.querySelectorAll("[data-worker-view-place]"))if(!i.querySelector("[data-worker-view][data-worker-view-drawn], [data-worker-view][data-worker-view-failed]"))return!1;return!0}function kr(e){let n=e.querySelector("[data-embed-content]"),o=[...e.querySelectorAll("[data-worker-view]")].map(i=>`${i.offsetWidth}x${i.offsetHeight}`);return`${e.scrollWidth}x${e.scrollHeight}|${n?`${n.scrollWidth}x${n.scrollHeight}`:""}|${o.join(",")}`}function uo(e,n,o,i){e.removeAttribute(qt);let c=e.ownerDocument.defaultView;if(!c)return()=>{};let l=ut(),S=l,p=kr(e),w=!1,E,T=typeof MutationObserver>"u"?void 0:new MutationObserver(v=>{v.some(_=>!(_.target===e&&_.attributeName===qt))&&(S=ut())});T?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let P=()=>{w=!0,T?.disconnect(),E!==void 0&&clearTimeout(E)},k=v=>{let _=!1,de=()=>{_||(_=!0,v())};typeof c.requestAnimationFrame=="function"&&c.requestAnimationFrame(()=>setTimeout(de,0)),setTimeout(de,100)},F=()=>{if(w)return;let v=kr(e);v!==p&&(p=v,S=ut());let _=ut();if(lo(e,i)&&_-S>=io||_-l>=so){k(()=>{w||(P(),e.setAttribute(qt,n),Gn(),o())});return}E=setTimeout(F,Pr)};return E=setTimeout(F,Pr),P}function Ar(e,n,o,i,c){zn();let l=(0,ft.useRef)({place:o,onDrawn:i});l.current={place:o,onDrawn:i},(0,ft.useLayoutEffect)(()=>{c&&jn(c);let S=E=>uo(E,l.current.place.path,()=>l.current.onDrawn?.(l.current.place),c);if(e.current)return S(e.current);let p,w=!1;return queueMicrotask(()=>{!w&&e.current&&(p=S(e.current))}),()=>{w=!0,p?.()}},[n,e,c])}var ve=De(Mt(),1),Ke,fo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.KY7QD22S.js","./chunk.QW3QLE53.js","./chunk.AM2YRNOQ.js","./chunk.AGTFYPXY.js","./chunk.FBR4HJ2Q.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.AKW6NR3X.js"))),Er=()=>fo().then(e=>void(Ke=e),()=>new Promise(e=>setTimeout(e,2e3)).then(Er)),zt=Nn(Er),Rr=e=>!!e&&Ke===void 0;function Gt({onReady:e,fetch:n}){return(0,ve.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var po=0;function Tr(e){let[n,o]=(0,ve.useState)(()=>Ke);(0,ve.useEffect)(()=>{if(!e||n)return;let l=!1;return zt().then(()=>{l||o(Ke)}),()=>{l=!0}},[e,n]);let i=(0,ve.useMemo)(()=>po+=1,[e]);return{over:(0,ve.useMemo)(()=>{let l=n??Ke;if(!e||!l)return;let{source:S,worker:p,...w}=e,E={...w,worker:p??{source:S},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:T=>l.registerWorkerView(T,E)}},[e,n]),n:i}}var Or=De(ro(),1),I=De(no(),1);var g=De(Dn(),1);function pt(e,n={}){let o=Ht(e);return{Face:o.part((c,l)=>(0,d.createElement)(c,l),n),fetch:()=>o.load().then(()=>{}),here:()=>o.current!==void 0||o.failed}}var Jt=e=>Promise.all([e,nr()]).then(([n])=>n),Cr=Te(()=>(__graviewPreload(import.meta.url,["./chunk.IUQOSPQX.js","./chunk.LKK7VQBA.js","./chunk.EC5IWN74.js","./chunk.ONGZ3YQF.js","./chunk.MORMTKVR.js","./chunk.PJCVFYFU.js","./chunk.7RJGEU3Y.js","./chunk.HJCQ6I3S.js","./chunk.7O6Z3BFR.js","./chunk.I2C5LPB5.js","./chunk.Q7X2IVLH.js","./chunk.NFU4UM6F.js","./chunk.AKVBU5K5.js","./chunk.LLOZKUCA.js","./chunk.DH7M57SE.js","./chunk.CKV2QCH5.js","./chunk.TAJ2R44N.js","./chunk.64IKLRUS.js","./chunk.DTSTUC2W.js","./chunk.RDL6652E.js","./chunk.V3NPUAPB.js","./chunk.APXYWI3L.js","./chunk.XY5EVI22.js","./chunk.UQQAGT3R.js","./chunk.GZHZLJBF.js","./chunk.E5XNQTEU.js","./chunk.OJGHDWI6.js","./chunk.K5YLQAFW.js","./chunk.XJFAUOJS.js","./chunk.DPPT6WAJ.js","./chunk.7U2JO7ET.js","./chunk.HFVMGTNL.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.QYFZ7AZS.js"))),mo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.GNQW4JOG.js","./chunk.USB6B6L3.js","./chunk.AZUTYY2S.js","./chunk.45VIF2SX.js","./chunk.IUQOSPQX.js","./chunk.UGFDSE37.js","./chunk.PXQVXBNG.js","./chunk.VYW7DSUW.js","./chunk.LKK7VQBA.js","./chunk.RR2IFETZ.js","./chunk.ONGZ3YQF.js","./chunk.XGCOWCA2.js","./chunk.MORMTKVR.js","./chunk.CU2NQ5WF.js","./chunk.E33EJU3Q.js","./chunk.PJCVFYFU.js","./chunk.7RJGEU3Y.js","./chunk.22MIRLL6.js","./chunk.NFU4UM6F.js","./chunk.DH7M57SE.js","./chunk.AIK3Z25Y.js","./chunk.CKV2QCH5.js","./chunk.BT7RLFPO.js","./chunk.TAJ2R44N.js","./chunk.VLBY66PB.js","./chunk.BJUUSIQY.js","./chunk.RDL6652E.js","./chunk.V3NPUAPB.js","./chunk.XOZU4OFA.js","./chunk.IT763BYH.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.T2RME6XF.js","./chunk.SOTB6C5A.js","./chunk.TQCRFZ53.js","./chunk.6HLKAUWF.js","./chunk.FCUDBMGC.js","./chunk.KMEKMCKG.js","./chunk.GZHZLJBF.js","./chunk.E5XNQTEU.js","./chunk.OJGHDWI6.js","./chunk.K5YLQAFW.js","./chunk.XJFAUOJS.js","./chunk.DPPT6WAJ.js","./chunk.7U2JO7ET.js","./chunk.HFVMGTNL.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.2BLRCT3E.js"))),ho=Te(()=>(__graviewPreload(import.meta.url,["./chunk.GNQW4JOG.js","./chunk.USB6B6L3.js","./chunk.AZUTYY2S.js","./chunk.45VIF2SX.js","./chunk.IUQOSPQX.js","./chunk.UGFDSE37.js","./chunk.PXQVXBNG.js","./chunk.VYW7DSUW.js","./chunk.LKK7VQBA.js","./chunk.RR2IFETZ.js","./chunk.ONGZ3YQF.js","./chunk.XGCOWCA2.js","./chunk.MORMTKVR.js","./chunk.CU2NQ5WF.js","./chunk.E33EJU3Q.js","./chunk.PJCVFYFU.js","./chunk.7RJGEU3Y.js","./chunk.22MIRLL6.js","./chunk.NFU4UM6F.js","./chunk.DH7M57SE.js","./chunk.AIK3Z25Y.js","./chunk.CKV2QCH5.js","./chunk.BT7RLFPO.js","./chunk.TAJ2R44N.js","./chunk.VLBY66PB.js","./chunk.BJUUSIQY.js","./chunk.RDL6652E.js","./chunk.V3NPUAPB.js","./chunk.XOZU4OFA.js","./chunk.IT763BYH.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.T2RME6XF.js","./chunk.SOTB6C5A.js","./chunk.TQCRFZ53.js","./chunk.6HLKAUWF.js","./chunk.FCUDBMGC.js","./chunk.KMEKMCKG.js","./chunk.GZHZLJBF.js","./chunk.E5XNQTEU.js","./chunk.OJGHDWI6.js","./chunk.K5YLQAFW.js","./chunk.XJFAUOJS.js","./chunk.DPPT6WAJ.js","./chunk.7U2JO7ET.js","./chunk.HFVMGTNL.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.DZYLH5IM.js"))),Lr=pt(()=>Jt(Cr().then(e=>e.SceneFace)),{what:"This view"}),Mr=pt(()=>Cr().then(e=>e.SceneKeeping),{quiet:!0}),Hr=pt(()=>Jt(mo().then(e=>e.PagesContent)),{what:"This page"}),Dr=pt(()=>Jt(ho().then(e=>e.PictureFace)),{what:"This picture"}),yo=Lr.Face,go=Mr.Face,wo=Hr.Face,vo=Dr.Face;function Ve(...e){let n=e.length>0?e:["scene","pages","picture"],o=new Set(n.flatMap(Vr));return Promise.all([...[...o].map(i=>i.fetch()),Zn()]).then(()=>{},()=>{})}var Vr=e=>e==="pages"?[Hr]:e==="picture"?[Dr]:[Lr,Mr],Br=e=>Vr(e).every(n=>n.here()),bo=150,Ut=0;function xr(e,n){if(Br(e))return n();let o=++Ut,i=()=>{o===Ut&&(Ut+=1,n())};Ve(e).then(i),setTimeout(i,bo)}var So=768;function Po(e,n){let o=n!==null&&n>=So;(0,d.useEffect)(()=>{if(!o||e==="picture")return;let i=e==="pages"?"scene":"pages";if(Br(i))return;let c=globalThis,l=()=>void Ve(i),S=()=>{},p=Un(()=>{if(c.requestIdleCallback&&c.cancelIdleCallback){let w=c.requestIdleCallback(l,{timeout:4e3});S=()=>c.cancelIdleCallback?.(w)}else{let w=setTimeout(l,1500);S=()=>clearTimeout(w)}});return()=>(p(),S())},[e,o])}function ko({asked:e,shown:n,onDrawn:o}){return(0,d.useLayoutEffect)(()=>o(e,n),[e,n,o]),null}function Ao({auto:e,scene:n}){return(0,g.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${It}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var Eo=Ht(Te(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,g.jsx)(e.StudioPlace,{...n}),{quiet:!0});function $r(e,n,o,i,c){return $t(e,sr(n?ct(n):c??Mn,i),o)}function Yt(e){return e&&ct(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 Nr(e){let[,n]=(0,d.useState)(!1),o=(0,d.useCallback)(()=>n(!0),[]),i=(0,d.useRef)(!1);return e.at&&!mt?(0,g.jsx)(Gt,{onReady:o,fetch:Qt}):!i.current&&Rr(e.draftView)?(0,g.jsx)(Gt,{onReady:o,fetch:zt}):(i.current=!0,(0,g.jsx)(Ro,{...e}))}function Ro(e){let{app:n,stop:o,bar:i=!0,standing:c="Everything is in order",principal:l,heading:S=2}=e,{rootRef:p,scope:w,css:E,scheme:T,store:P,presence:k,brand:F,auto:v,height:_}=pr(e),de=Tr(e.draftView),D=ur(e,rr,de.over),[ie]=(0,d.useState)(_n),f=e.basePath===void 0?{}:{basePath:e.basePath},[V]=(0,d.useState)(Dt),j=e.notices??V,Z=h=>xt(h,f),x={...e.routing?{routing:e.routing}:{},...f},[me]=(0,d.useState)(()=>{let h=e.at?.face;if(h)return h;let Q=o===void 0&&Fr(n,D)?"pages":Yt(o),K=Bt({...x,face:Q});return e.face===void 0&&e.onOpening?.(K),K}),[B,R]=(0,d.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&o===void 0&&or(x)&&Fr(n,D)),he=(0,d.useRef)(e.onFace);he.current=e.onFace,(0,d.useLayoutEffect)(()=>{B&&(he.current?.("pages"),R(!1))},[B]);let L=B?"pages":e.face??me,O=n.schema.kinds,C=e.routing==="address",H=(0,d.useMemo)(()=>e.at?mt.settleAt(e,P.seenBy(l??{kind:"human"}),D.places()):void 0,[]),X=(0,d.useMemo)(()=>$n(D,n.schema),[D,n.schema]),q=(0,d.useMemo)(()=>{let h=H?.stop??(C?ar(e.basePath):void 0)??o;return L==="scene"&&h===void 0&&X===void 0&&(e.path===void 0||Kt(e.path))?Nt(void 0):$r(L,h,O,D.places(),X)},[]),[ye]=(0,d.useState)(L);(0,d.useEffect)(()=>{ye!=="pages"&&Bn(D)},[ye,D]);let $=(0,d.useRef)(void 0),Fe=h=>h===void 0||Kt(h)?"/":h;$.current??={path:Fe(H?.path??(C?L==="pages"?(Ft(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==$.current.asked&&($.current={path:Fe(e.path),asked:e.path});let M=(0,d.useRef)(e.onNavigate);M.current=e.onNavigate;let ee=(0,d.useCallback)((h,Q)=>{$.current.path=h,M.current?.(h,Q)},[]),{at:te,setAt:N,steering:Se,steer:J}=wr($.current.path),z=(0,d.useContext)(Wr);z&&(z.pages=()=>$.current.path);let G=(0,d.useRef)(void 0),le=(0,d.useCallback)(h=>void($.current.path=h),[]),ne=Yn(p),[Oe,Pe]=(0,d.useState)(!1),se=e.pagesBelow!==void 0&&ne!==null&&ne<e.pagesBelow&&(L==="scene"||L==="graview")&&!Oe,A=se?"pages":L,Ce=(0,d.useRef)(!1);Ce.current=Oe&&e.pagesBelow!==void 0&&ne!==null&&ne<e.pagesBelow&&(L==="scene"||L==="graview"),z&&(z.shown=A);let Le=(0,d.useRef)(L==="graview"?"graview":"scene");(A==="scene"||A==="graview")&&(Le.current=A),(0,d.useState)(()=>{if(!C||typeof window>"u"||A==="pages"||A==="picture")return;let{pathname:h,search:Q,hash:K}=window.location;Ft(h,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${Z(Re)}${Q}${K}`)}),fr(p,A,e.onIntrinsicHeight),Po(A,ne);let re=vr(e.onError,A),Me=br(e.onReady,A),ke=(0,d.useRef)(e.onFaceDrawn);ke.current=e.onFaceDrawn;let Ye=(0,d.useCallback)((h,Q)=>{Me(Q),ke.current?.(h)},[Me]),[Be,wt]=(0,d.useState)(null),Qe=D.places(),$e=(0,d.useRef)({shown:A,onFace:e.onFace});$e.current={shown:A,onFace:e.onFace};let W=(0,d.useCallback)((h,Q,K)=>{if(C){G.current?.(h,Q,K);return}$e.current.onFace?.(h),M.current?.(h==="pages"?Q??$.current.path:Re,"push")},[C]),[ge,U]=(0,d.useState)(void 0);(0,d.useEffect)(()=>{A==="pages"&&U(void 0)},[A]);let Ne=(0,d.useRef)(o);(0,d.useEffect)(()=>{Ne.current!==o&&(Ne.current=o,U(void 0))},[o]);let Ae=(0,d.useCallback)(h=>{if($e.current.shown==="pages"){if(Pe(!0),U(h),L==="scene"||L==="graview"){xr(L,()=>{C?window.history.pushState(null,"",`${Z(Re)}${h??""}`):M.current?.(Re,"push")});return}xr(Le.current,()=>W(Le.current,void 0,h))}},[C,L,e.basePath,W]),He=(0,d.useCallback)(h=>{if($e.current.shown==="pages"){Se.go.current||($.current.path=h),J(h);return}if($.current.path=h,N(h),Ce.current){Pe(!1),C?window.history.pushState(null,"",Z(h)):M.current?.(h,"push");return}W("pages",h)},[Se,J,N,W,C,e.basePath]),ze=D.arrangement?.(),ue=A==="pages",Ee=e.hrefOf,We=Ee??(C?Z:void 0),Y=(0,d.useMemo)(()=>({open:He,...Ee?{href:Ee}:C?{href:h=>xt(h,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[He,C,e.basePath,Ee]);return(0,g.jsxs)("section",{ref:p,className:w,"aria-label":e.label??n.name,"data-graview-embed":A,"data-graview-scheme":T,...se?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:_,minHeight:v?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,g.jsx)("style",{children:E}),(0,g.jsxs)(Jn.Provider,{value:re,children:[(0,g.jsx)(mr,{rootRef:p,board:j}),(0,g.jsx)(lr,{rootRef:p,firstLook:e.firstLook,app:er(F??{name:n.name},n.schema)}),(0,g.jsx)(Ue,{module:"@graview/react",report:re,content:!0,children:(0,g.jsx)(In.Provider,{value:ie,children:(0,g.jsx)(Vn,{store:P,views:D,initialView:q,scheme:T,...hr(e,k,F),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,g.jsxs)(Qn.Provider,{value:j,children:[(0,g.jsx)(Oo,{face:A,stop:ge??o,kinds:O,places:Qe,opens:X}),z?(0,g.jsx)(To,{into:z}):null,(0,g.jsx)(xo,{rootRef:p,face:L,shown:A,path:te,stop:o,draft:de.n,onDrawn:e.onDrawn,parts:ie}),C?(0,g.jsx)(ir,{pagesWere:H?.path,basePath:e.basePath,shown:A,onFace:e.onFace,toggle:G,kinds:O,places:Qe,opens:X,landed:le}):null,i&&A!=="picture"?(0,g.jsx)(Ue,{module:"@graview/embed",report:re,children:(0,g.jsx)(yr,{name:F?.name??n.name,heading:S,named:Wt(i).name!==!1,faces:Wt(i).faces===!1?void 0:{scene:{label:Fn(ze),current:!ue,go:()=>Ae(),reach:()=>void Ve(Le.current)},pages:{label:On(ze),current:ue,go:()=>He($.current.path),reach:()=>void Ve("pages")}},at:ue?te:null,without:e.pages?.without(),home:{...We?.("/")!==void 0?{href:We("/")}:{},go:()=>He("/"),current:ue&&te.split("?")[0]==="/"},reach:{...We?{href:We}:{},go:h=>He(h.path)},standing:c,hostActions:e.hostActions,keeping:ue?void 0:(0,g.jsx)(Co,{app:n,studio:e.studio,report:re}),onFind:wt,switch:e.switch})}):null,(0,g.jsx)(Xn.Provider,{value:Be,children:(0,g.jsx)(Ue,{module:A==="pages"||A==="picture"?"@graview/pages":"@graview/react",report:re,content:!0,children:(0,g.jsxs)(d.Suspense,{fallback:(0,g.jsx)(Ao,{auto:v,scene:A!=="pages"&&A!=="picture"}),children:[A==="picture"?(0,g.jsx)(vo,{scope:w,store:P,views:D,as:(o?ct(o).within?.view:void 0)??""}):A==="pages"?(0,g.jsx)(wo,{store:P,views:D,presence:k,auto:v,brand:F,steering:Se,overview:Ae,scope:w,titleLevel:gr(S),quickAsk:Vt(e.quickAsk),props:{...e,onNavigate:ee,...C?{}:{path:$.current.path}}}):(0,g.jsx)(Kn.Provider,{value:Y,children:(0,g.jsx)(yo,{address:C,auto:v,scheme:T,scope:w,quickAsk:Vt(e.quickAsk)})}),(0,g.jsx)(ko,{asked:L,shown:A,onDrawn:Ye})]})},A)})]})})})})]})]})}var Kt=e=>e.split(/[?#]/)[0]===Re,Wr=(0,d.createContext)(null);function To({into:e}){return e.view=dt().view,null}function xo({rootRef:e,face:n,shown:o,path:i,stop:c,draft:l,onDrawn:S,parts:p}){let{view:w}=dt(),E=o==="scene"||o==="graview",T=st(w),{pan:P,...k}=w,F=w.pan?st(k):T,v={face:n,path:E?Re:o==="picture"?c??"#":i,stop:T};return Ar(e,`${o} ${E?F:v.path} ${l}`,v,S,p),null}var mt,Fo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.MFDSWA2W.js","./chunk.HFVMGTNL.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.J3YBEZKE.js"))),Qt=()=>Fo().then(e=>void(mt=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(o),e()},o=setTimeout(n,1e4);window.addEventListener("online",n)}).then(Qt));function Oo({face:e,stop:n,kinds:o,places:i,opens:c}){let{view:l,go:S}=dt(),p=(0,d.useRef)({face:e,stop:n});return(0,d.useLayoutEffect)(()=>{let w=p.current.stop!==n,E=p.current.face!==e,T=p.current.face==="pages";if(p.current={face:e,stop:n},!w&&!E||e==="pages"||e==="picture")return;let P=(w||T)&&n!==void 0?$r(e,n,o,i):T&&cr(l)?$t(e,Nt(c),o):e==="graview"?Lt(l,!0):l.overview?Hn(Lt(l,!1),tr(l,o)):l;S(P)},[e,n,o,l,S,c]),null}function Co({app:e,studio:n,report:o}){return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Suspense,{fallback:null,children:(0,g.jsx)(go,{})}),n!==!1?(0,g.jsx)(Ue,{module:"@graview/studio",report:o,children:(0,g.jsx)(Lo,{app:e,studio:n})}):null]})}function Lo({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}:{}},i=n?.place;return i?(0,g.jsx)(i,{...o}):(0,g.jsx)(d.Suspense,{fallback:null,children:(0,g.jsx)(Eo,{...o})})}function Mo({path:e,stop:n,...o},i){return{...o,app:i.app,at:i.at,remote:i.remote,...i.remote.presence?{presence:i.remote.presence}:{}}}function Zt(e,n){let o=n.store??n.remote?.store??dr(n.app,n.seed),i=n.notices??Dt(),c=null,l={},S=0,p=n.label,w=n.app,E=Promise.resolve(),T=n.at?.face??n.face,P=T===void 0?void 0:Bt({...n,face:T}),k=P??Yt(n.stop),F=null,v=[],_=f=>{if(F=f,f!==k)return;let V=v;v=[];for(let j of V)j()};function de(){let[f,V]=(0,d.useState)(P),[j,Z]=(0,d.useState)(n.stop),[x,me]=(0,d.useState)(n.path),[B,R]=(0,d.useState)(n.scheme??"auto"),[he,L]=(0,d.useState)(n.principal),[O,C]=(0,d.useState)(n.seats),[H,X]=(0,d.useState)(n.quickAsk),[q,ye]=(0,d.useState)(n.people),[$,Fe]=(0,d.useState)(n.hostContext),[M,ee]=(0,d.useState)(n.brand),[te,N]=(0,d.useState)(n.whileAway),[Se,J]=(0,d.useState)(n.label),[z,G]=(0,d.useState)(n.hostActions),[le,ne]=(0,d.useState)(void 0),[Oe,Pe]=(0,d.useState)(n.draftView);return c={app:se=>{ne(se),me(void 0),Z(void 0)},face:V,stop:Z,path:me,scheme:R,seat:L,seats:C,quickAsk:X,people:ye,hostContext:Fe,brand:ee,whileAway:N,label:J,hostActions:G,draft:Pe},(0,g.jsx)(Wr.Provider,{value:l,children:(0,g.jsx)(Nr,{...le?Mo(n,le):n,store:o,notices:i,...f!==void 0?{face:f}:{},onOpening:se=>{k=se},...j!==void 0?{stop:j}:{},...x!==void 0?{path:x}:{},...he?{principal:he}:{},...O?{seats:O}:{},...H!==void 0?{quickAsk:H}:{},...q?{people:q}:{},...$?{hostContext:$}:{},...M?{brand:M}:{},whileAway:te,label:Se,hostActions:z,draftView:Oe,scheme:B,onFace:se=>{k=se,V(se)},onSeat:L,onFaceDrawn:_},le?.n??0)})}let D=()=>{let f=l.view?.focusId,V=f?o.graph.getNode(f)?.kind:void 0,j=(l.shown??k)==="scene"||(l.shown??k)==="graview";return{face:k,path:j?Re:l.pages?.()??n.path??"/",stop:l.view?st(l.view):n.stop??"#",...V?{kind:V}:{}}},ie=(0,Or.createRoot)(e);return(0,I.flushSync)(()=>ie.render((0,g.jsx)(de,{}))),{get store(){return o},where:D,setApp:(f,V,j)=>{let Z="graph"in V?{store:V}:V,x=()=>{let me=D();o=Z.store,p=j?.label??(p===w.name?f.name:p),w=f,(0,I.flushSync)(()=>{c?.label(p),c?.app({app:f,remote:Z,at:me,n:++S})})};mt?x():E=E.then(Qt).then(x)},setFace:f=>{k=f,(0,I.flushSync)(()=>c?.face(f))},setStop:f=>(0,I.flushSync)(()=>c?.stop(f)),setPath:f=>(0,I.flushSync)(()=>{if(Kt(f)){(k==="pages"||k==="picture")&&(k="scene",c?.face("scene"));return}c?.path(f),k!=="pages"&&(k="pages",c?.face("pages"))}),setScheme:f=>(0,I.flushSync)(()=>c?.scheme(f)),setSeat:f=>(0,I.flushSync)(()=>c?.seat(f)),setSeats:f=>(0,I.flushSync)(()=>c?.seats(f)),setQuickAsk:f=>(0,I.flushSync)(()=>c?.quickAsk(f)),setPeople:f=>(0,I.flushSync)(()=>c?.people(f)),setHostContext:f=>(0,I.flushSync)(()=>c?.hostContext(f)),setBrand:f=>(0,I.flushSync)(()=>c?.brand(f)),setWhileAway:f=>(0,I.flushSync)(()=>c?.whileAway(f)),setDraftView:f=>(0,I.flushSync)(()=>c?.draft(f)),setLabel:f=>{p=f,(0,I.flushSync)(()=>c?.label(f))},setHostActions:f=>(0,I.flushSync)(()=>c?.hostActions(f)),drawn:()=>E.then(()=>F===k?void 0:new Promise(f=>v.push(f))),notify:f=>{let V;return(0,I.flushSync)(()=>{V=i.notify(f)}),V},unmount:()=>ie.unmount()}}var ht=e=>`s${(e+1).toString(36)}`;var Ir="/graview/friction";var _r="/graview/live",Xt="graview.ship",en=`${Xt}.${ot}`;var be={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 je=class extends Error{constructor(n){super(n),this.name="Superseded"}},xe=e=>e?.lineage?{lineage:e.lineage}:{},Ho=(e,n)=>`${e.calls.map(o=>o.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
|
|
2
|
+
`)[0]??"":String(n)})`;function Do(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(i=>!!i&&Array.isArray(i.calls)):[]}catch{return[]}}var qe=class extends Error{constructor(o){super(o.sentence);this.refusal=o;this.name="RemoteRefusedError"}},Vo={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},pe=class extends Error{constructor(o,i){super(o);this.conflicts=i;this.name="StaleWrite"}},Je=class extends Error{constructor(n){super(n),this.name="Unreached"}},Bo=new Set([502,503,504]);async function $o(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function No(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var Wo=1,Io=()=>({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 yt(e){return(await jr(e,Do(e.carry),"This app was updated while your changes were on the way.",Io())).remote}async function jr(e,n,o,i){let c=e.fetch??fetch,l={"content-type":"application/json",...e.headers??{}},S={...gt(e.principal),[be.via]:e.via??"web"};Object.assign(l,S);let p=e.live===!0,w=e.presenceEveryMs,E=e.visible??qo,T="connecting",P=i.statuses,k=i.tally,F=[],v,_=[],de=()=>T==="online"&&v!==void 0?"held":T,D=()=>{let t=de();if(i.told!==t){i.told=t;for(let r of[...P])r(t)}},ie=t=>{if(!(t===T||ce)&&(T==="offline"&&t==="online"&&k.reconnects++,T=t,D(),t==="online"))for(let r of F.splice(0))r.again()},f=t=>{if(ce)return;let r=typeof t=="string"&&t.length>0?t:void 0,s=r!==v;if(v=r,V(),!!s&&(D(),r===void 0)){for(let a of _.splice(0))a();oe&&clearTimeout(oe),an()}},V=()=>{if(i.toldHeld!==v){i.toldHeld=v;for(let t of[...i.helds])t(v??null)}},j=async(t,r)=>{let s;try{s=await c(t,r)}catch(a){throw Y()||ie("offline"),new Je(a instanceof Error?a.message:String(a))}if(s.status===503&&await $o(s))return ie("online"),s;if(Bo.has(s.status))throw Y()||ie("offline"),new Je(`The server is away (${s.status})`);return ie("online"),s},Z=async(t=!1)=>{let r=`${e.url}/graview/state?opFormat=${_e.op}`,s=t?await c(r,{headers:l}):await j(r,{headers:l});if(!s.ok)throw new Error((await s.json().catch(()=>({}))).error??`The server refused (${s.status})`);return await s.json()},x=e.state??await Z(!0);p||(T="online"),v=typeof x.held=="string"&&x.held.length>0?x.held:void 0,V();let me=x.enabledModules??e.enabledModules,B=e.localApp?e.localApp(e.app):e.app,R=new xn({schema:B.schema,mutations:B.mutations??[],invariants:B.invariants??[],...B.policy?{policy:B.policy}:{},...B.publishing?{publishing:B.publishing}:{},...B.modules?{modules:B.modules}:{},...me?{enabledModules:me}:{},...B.intelligence?{intelligence:B.intelligence}:{},...B.brand?.timeZone?{timeZone:B.brand.timeZone}:{},snapshot:x.snapshot,log:x.log,...x.horizon!==void 0?{horizon:x.horizon}:{},ids:No(),...e.storeOptions??{}});kn.served.add(R);let he=e.friction!==!1&&e.principal?.kind!=="visitor";he&&An(R,t=>{he&&c(`${e.url}${Ir}`,{method:"POST",headers:l,body:JSON.stringify({event:t})}).then(r=>void(he=r.status!==404&&r.status!==410),()=>{})});let L=Rn(R),O=x.log.at(-1)?.seq??(x.horizon??0)-1,C=Tt.of(x.log,{horizon:x.horizon??0}),H=null,X,q=new Map,ye=i.who,$=!1,Fe=t=>{if(ce)return;$=!0;let r=Cn(new Map,t,Date.now(),Ot,H?.participant);X!==void 0&&r.delete(X);let s=r.size!==q.size;if(!s)for(let[a,u]of r)Ct(u,q.get(a))||(s=!0);if(q=r,!!s)for(let a of[...ye])a([...q.values()])},M=[],ee=new Set,te=t=>{let r=M.indexOf(t);r>=0&&M.splice(r,1)},N=new Map,Se=(t,r)=>{let s=N.get(t);s&&(N.delete(t),s.resolve({ops:r.filter(a=>a.batch===t),batch:t}))},J,z=[],G=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(J)return z.push({ops:t,drop:r}),[];let s=Math.min(...t.filter(m=>m.seq>O).map(m=>m.seq));if(Number.isFinite(s)&&s>O+1)return z.push({ops:t,drop:r}),le(),[];let a=M.filter(m=>t.some(ae=>ae.batch===m)),u=[...new Set([...r,...a])].filter(m=>ee.has(m)),y,b=M.filter(m=>!a.includes(m));try{y=R.rebase({confirmed:t,pending:b,drop:u}).confirmed}catch(m){if(!(m instanceof Tn))throw m;return z.push({ops:t,drop:r}),le(),[]}for(let m of a)te(m);t.some(m=>m.seq>O)&&b.some(m=>!u.includes(m))&&k.rebases++,t.length>0&&(O=Math.max(O,...t.map(m=>m.seq)),C.note(t));for(let m of u)ee.delete(m);for(let m of a)Se(m,t);return y},le=()=>{J||(J=ke(Z().then(t=>{if(ne(t)){z=[];return}let r=new Set(t.log.map(u=>u.batch)),s=M.filter(u=>r.has(u));for(let u of s)te(u);let a=R.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[...M],drop:[...ee].filter(u=>!M.includes(u))});ee.clear();for(let u of a.pending)ee.add(u.batch);O=t.log.at(-1)?.seq??(t.horizon??0)-1,C=Tt.of(t.log,{horizon:t.horizon??0}),k.resyncs++;for(let u of s)Se(u,t.log)}).then(()=>{J=void 0;let t=z;z=[];for(let{ops:r,drop:s}of t)G(r,s)},()=>{J=void 0,z=[]})))},ne=t=>(typeof t.build=="string"&&cn(t.build),typeof t.version=="number"&&f(t.held),typeof t.version!="number"||t.version===x.version?!1:(St(t.version),!0)),Oe=async t=>{let s=await(await j(`${e.url}/graview/since?seq=${ht(t)}&opFormat=${_e.op}`,{headers:l})).json();return ne(s)?[]:s.reset===!0?(le(),[]):s.ops??[]},Pe=async()=>{let t=await se();return J&&await J,t},se=async()=>{if(H&&!Y()&&E()){let r=await(await j(`${e.url}/graview/here?opFormat=${_e.op}`,{method:"POST",headers:l,body:JSON.stringify({presence:H,seq:ht(O)})})).json();return ne(r)?[]:(typeof r.participant=="string"&&(X=r.participant),Fe(r.who??[]),G(r.ops??[]))}return G(await Oe(O))},A=new Map,Ce=new Map,Le=new Set,re=new Map,Me=new Set,ke=t=>(Me.add(t),t.finally(()=>Me.delete(t)).catch(()=>{}),t),Ye=Promise.resolve(),Be=0,wt=(t,r)=>{let s=Ye.then(()=>$e(t,r));return Ye=s.catch(()=>{}),s},Qe=()=>new Promise((t,r)=>F.push({again:t,give:r})),$e=async(t,r)=>{let s,a;for(;;){try{s=await j(`${e.url}/graview/ops`,{method:"POST",headers:l,body:JSON.stringify({...t,opFormat:_e.op})})}catch(m){if(!(m instanceof Je)||U)throw m;if(await Qe(),Y())return Ze(t,r);continue}if(a=await s.json().catch(()=>({})),s.status===503&&a.reason==="unavailable"&&typeof a.held=="string"&&!U){if(typeof a.version=="number"?ne(a):(f(a.held),!1))break;if(v!==void 0&&(Et>0||p)){if(await new Promise(m=>_.push(m)),U)throw new je("The client closed.");if(Y())return Ze(t,r);continue}}let b;if(s.status===503&&a.reason==="unavailable"&&!U)b=tn(e.backoff,Be++);else{if(Be=0,s.status!==429||U)break;b=_o(s.headers.get("retry-after"),a.retryAfter)}if(await new Promise(m=>setTimeout(m,b)),Y())return Ze(t,r)}if(ce||ne(a))throw new je("The app was changed.");if(!s.ok){let b=a.error??`The server refused (${s.status})`;throw a.conflict?new pe(b,a.conflicts??[]):new qe({reason:a.reason??Vo[s.status]??"invalid",sentence:b,...a.wouldNeed?.length?{wouldNeed:a.wouldNeed}:{}})}let u=a.ops??[],y=u[0]?.seq;return y!==void 0&&y>O+1&&(u=await Oe(O)),r!==void 0&&(a.batch&&A.set(r,a.batch),te(r)),G(u,r!==void 0?[r]:[]),{ops:a.ops??[],...a.batch?{batch:a.batch}:{}}},W,ge=!1,U=!1,Ne=0,Ae,He=0,ze=0,ue=null,Ee=()=>{},We=new Promise(t=>{Ee=t}),Y=()=>p&&ge&&W?.readyState===Wo,h=t=>{if(!Y())return!1;try{return W.send(JSON.stringify(t)),!0}catch{return!1}},Q=(t=!1)=>{!H||!Y()||!E()||!t&&ue&&Ct(H,ue)&&(w===void 0||Date.now()-ze<w)||h({t:"here",presence:H})&&(ue=H,ze=Date.now())},K=new Set,oe,an=()=>{if(oe=void 0,v!==void 0)return;let t=[...N.entries()].filter(([r])=>K.has(r));K.clear();for(let[,r]of t)h(r.message)},sn=(t,r)=>{N.has(t)&&(K.add(t),oe&&clearTimeout(oe),oe=setTimeout(an,Math.max(0,r)))},Gr=t=>{N.has(t)&&K.add(t)},Ze=(t,r)=>new Promise((s,a)=>{let u=r??`send-${++He}`,y=t.undo?{t:"undo",cid:u,batches:t.undo,...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.via?{via:t.via}:{},...xe(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}:{},...xe(t)};if(N.set(u,{message:y,...r!==void 0?{mine:r}:{},resolve:s,reject:a}),K.size>0||v!==void 0){K.add(u);return}h(y)}),Xe=(t,r)=>Y()?Ze(t,r):wt(t,r),Ur=t=>{switch(t.t){case"welcome":{if(cn(t.build),typeof t.version=="number"&&t.version!==x.version){St(t.version);return}if(ge=!0,Ne=0,typeof t.participant=="string"&&(X=t.participant),f(t.held),t.state?le():G(t.ops??[]),K.clear(),oe&&clearTimeout(oe),oe=void 0,v!==void 0)for(let r of N.keys())K.add(r);else for(let r of N.values())h(r.message);Q(!0),ie("online"),Ee();return}case"ops":G(t.ops??[]);return;case"ack":{let r=N.get(t.cid);if(!r){G(t.ops??[]);return}N.delete(t.cid),Be=0,r.mine!==void 0&&(A.set(r.mine,t.batch),te(r.mine)),G(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=N.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){v!==void 0?Gr(t.cid):sn(t.cid,tn(e.backoff,Be++));return}N.delete(t.cid),r.reject(t.t==="conflict"?new pe(t.sentence,t.conflicts??[]):new qe({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&sn(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":Fe(t.who??[]);return;case"held":f(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==x.version&&St(t.version);return;case"reload":fn(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&W){let r=W;mn(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},ce=!1,vt=i.declarations,bt=i.builds,cn=t=>{if(!(ce||i.otherBuild!==void 0||!e.build||typeof t!="string"||t.length===0||t===e.build)){i.otherBuild=t;for(let r of[...bt])r(t)}},dn=()=>{let t=[],r=0;for(let s of M){let a=re.get(s);a?t.push({calls:a.calls,...a.intent?{intent:a.intent}:{},...a.via?{via:a.via}:{},...xe(a),batch:s}):r++}return{carried:t,undos:r}},ln=(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.`,un=t=>{ce=!0,H=null;let r=new je(t);for(let a of N.values())a.reject(r);N.clear(),nt&&clearInterval(nt),U=!0,Ae&&clearTimeout(Ae),oe&&clearTimeout(oe),we&&clearTimeout(we);for(let a of F.splice(0))a.give(r);for(let a of _.splice(0))a();let s=W;W=void 0,ge=!1;try{s?.close(1e3,t)}catch{}Ee()};async function St(t){if(ce)return;if(!e.resolveApp){fn(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:s}=dn(),a=e.resolveApp,u=H;un("The app was changed.");try{let y=await a(t),{state:b,...m}=e,ae=await jr({...m,app:y},r,"The app was changed while your changes were on the way.",i);u&&ae.remote.presence.here(u);for(let rt of[...vt])rt(ae.remote,t);let fe=[...s>0?[et(ln(s,"The app was changed"))]:[],...ae.unheard()];for(let rt of fe)for(let to of Ie)to(rt.sentence,rt)}catch(y){let b=`The app was changed, but the new version could not be opened: ${y instanceof Error?y.message:String(y)}`;for(let m of Ie)m(b,et(b))}}function fn(t){if(ce)return;let{carried:r,undos:s}=dn();un(t);let a=!1;if(e.carry&&r.length>0)try{e.carry.storage.setItem(e.carry.key,JSON.stringify(r)),a=!0}catch{}let u=[];!a&&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(ln(s,"This app was updated"));for(let y of u)for(let b of Ie)b(y,et(y));(e.reloadPage??jo)()}let pn=()=>{if(U||!p)return;let t=`${e.url.replace(/^http/,"ws").replace(/\/$/,"")}${_r}`,{"content-type":r,...s}=l,a;try{a=e.socket?e.socket(t,s,[en]):eo(t,s)}catch{return hn()}W=a,ge=!1,a.onopen=()=>{W===a&&a.send(JSON.stringify({t:"hello",seq:ht(O),protocol:ot,wire:Xt,opFormat:_e.op,...e.build?{build:e.build.slice(0,64)}:{},...e.hostProtocol!==void 0?{hostProtocol:e.hostProtocol}:{}}))},a.onmessage=u=>{if(W!==a)return;let y;try{y=JSON.parse(String(u.data))}catch{return}Ur(y)},a.onclose=()=>mn(a),a.onerror=()=>{}},we,Kr=()=>{$=!1,we&&clearTimeout(we),we=setTimeout(()=>{if(we=void 0,$||U)return;let t=new Map([...q].filter(([,r])=>r.held!=="socket"));if(t.size!==q.size){q=t;for(let r of ye)r([...q.values()])}},Ot),we.unref?.()};function mn(t){if(W!==t)return;let r=ge;W=void 0,ge=!1,ue=null,r&&(ie("offline"),Kr()),hn()}let hn=()=>{if(U)return;let t=tn(e.backoff,Ne);Ne++,Ae=setTimeout(pn,t)},yn=R.applyAll.bind(R),Jr=R.undo.bind(R),Yr=R.previewAll.bind(R);R.previewAll=(t,r)=>Yr(t,{...e.principal?{author:e.principal}:{},...r});let Ie=i.refusals,Ge=[],et=t=>({reason:"invalid",sentence:t}),tt=i.conflicts,Pt=!1,gn,kt=async(t,r)=>{if(r instanceof je||ce)return;let s=r instanceof qe?r.refusal:Sn(r),a=s.sentence,u=r instanceof pe?gn?.yoursOf(R,re.get(t)?.calls??[]):void 0;te(t);try{G([],[t])}catch{}let y=re.get(t);re.delete(t);let b=y?.calls[0];if(b&&!(r instanceof pe)){let m=R.allMutations().find(fe=>fe.name===b.name)?.subject?.arg,ae=m&&R.graph.getNode(b.args[m])?.kind;En(R,{type:"refused",act:b.name,code:s.reason,...ae?{kind:ae}:{}},e.principal)}if(r instanceof pe&&k.conflicts++,r instanceof pe&&!Y()&&await Pe().catch(()=>[]),r instanceof pe&&J&&await J,r instanceof pe&&tt.size>0){let m=!1,ae={sentence:a,conflicts:u?r.conflicts.map(fe=>fe.node===u.node&&fe.field===u.field?{...fe,yours:u.yours}:fe):r.conflicts,keepTheirs(){m=!0},useMine(){if(!(m||!y)){m=!0,Pt=!0;try{R.applyAll(u?[u.over(O)]:y.calls,{...y.intent?{intent:y.intent}:{},...y.via?{via:y.via}:{},...xe(y)})}finally{Pt=!1}}}};for(let fe of tt)fe(ae);return}for(let m of Ie)m(a,s)},Qr=(t,r)=>t.flatMap(s=>s.mutation?.name===bn?[]:s.primitives.flatMap(a=>a.op==="splice-text"&&!r.has(a.id)&&!r.has(`${a.id}\0${a.field}`)?[{node:a.id,field:a.field,rev:O}]:[]));R.applyAll=(t,r)=>{let s=Pn(R.log.all().filter(b=>ee.has(b.batch))),a=yn(t,{...e.principal?{author:e.principal}:{},...r}),u=t.map((b,m)=>{let ae=a.minted?.[m];return ae===void 0||b.args?.id!==void 0?b:{...b,mintedHint:ae}});M.push(a.batch),ee.add(a.batch),re.set(a.batch,{calls:u,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...xe(r)});let y=Pt?[]:[...C.baseFor(a.ops,s,(b,m)=>R.collaborative(b,m)),...Qr(a.ops,s)];return Ce.set(a.batch,ke(Xe({calls:u,...r?.intent?{intent:r.intent}:{},batch:a.batch,...y.length>0?{base:y}:{},...r?.via?{via:r.via}:{},...xe(r)},a.batch).catch(b=>kt(a.batch,b)))),a},R.apply=(t,r)=>R.applyAll([t],r),R.undo=(t,r)=>{let s=typeof t=="string"?[t]:t,a=Jr(s.map(y=>A.get(y)??y),{...e.principal?{author:e.principal}:{},...r});M.push(a.batch),ee.add(a.batch);let u=Promise.allSettled(s.map(y=>Ce.get(y)));return Ce.set(a.batch,ke(u.then(()=>{let y=s.filter(b=>!Le.has(b));if(y.length===0){te(a.batch),re.delete(a.batch),G([],[a.batch]);return}return Xe({undo:y.map(b=>A.get(b)??b),...r?.intent?{intent:r.intent}:{},batch:a.batch,...r?.via?{via:r.via}:{},...xe(r)},a.batch)}).catch(y=>kt(a.batch,y)))),a};let Zr=async(t,r={})=>{At++;try{return(await ke(Xe({calls:t,...r}))).ops}finally{At--}},At=0,wn={here(t){H=t,Q()},onWho(t){return ye.add(t),q.size>0&&t([...q.values()]),()=>{ye.delete(t)}},leave(){if(!H)return;let t=JSON.stringify({participant:X??H.participant});if(H=null,h({t:"bye"}))return;let r=globalThis.navigator?.sendBeacon;r?r.call(globalThis.navigator,`${e.url}/graview/leave`,t):c(`${e.url}/graview/leave`,{method:"POST",headers:l,body:t}).catch(()=>{})}},Et=e.pollMs??800,nt=Et>0&&typeof setInterval=="function"?setInterval(()=>{Y()||Pe().catch(()=>{})},Et):null;if(p){pn();let t;await Promise.race([We,new Promise(r=>t=setTimeout(r,e.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!ce){let t=[],r=new Set(R.log.all().map(s=>s.batch));for(let s of n)if(!(s.batch!==void 0&&r.has(s.batch)))try{R.applyAll(s.calls,{...s.intent?{intent:s.intent}:{},...s.batch?{batch:s.batch}:{},...s.via?{via:s.via}:{},...xe(s)})}catch(a){t.push(Ho(s,a))}t.length>0&&Ge.push(et(`${o} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}let vn=new Map,Xr=()=>({store:R,author:e.principal,appliedAll:yn,pending:M,provisional:ee,asked:re,answers:Ce,letGo:Le,sent:(t,r)=>ke(Xe({calls:r,batch:t},t).catch(s=>kt(t,s))),settle:te,land:G,seen:()=>O,gone:()=>U||ce});return{remote:{store:R,typing(t,r){let s=`${t}\0${r}`,a=vn.get(s);return a||(a=(__graviewPreload(import.meta.url,["./chunk.MJMVGW6Z.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.TAIYNHSW.js")).then(u=>(gn=u,u.typingOf(t,r,u.wireOf(Xr())))),vn.set(s,a)),a},version:x.version,migrated:x.migrated??[],send:Zr,pull:Pe,onRefusal(t){Ie.add(t);let r=Ge;Ge=[];for(let s of r)t(s.sentence,s);return()=>Ie.delete(t)},onDeclaration(t){return vt.add(t),()=>vt.delete(t)},onBuild(t){return bt.add(t),i.otherBuild!==void 0&&t(i.otherBuild),()=>bt.delete(t)},onConflict(t){return tt.add(t),()=>tt.delete(t)},revision:(t,r)=>C.of(t,r),seq:()=>O,participant:()=>X,transport:()=>Y()?"socket":"poll",status:de,onStatus(t){return P.add(t),()=>P.delete(t)},held:()=>v,onHeld(t){return i.helds.add(t),v!==void 0&&t(v),()=>i.helds.delete(t)},counters:()=>({...k}),who:()=>[...q.values()],pending:()=>M.length+At,async settled(){for(;Me.size>0;)await Promise.allSettled([...Me])},presence:wn,close(){nt&&clearInterval(nt),L(),wn.leave(),U=!0,Ae&&clearTimeout(Ae),oe&&clearTimeout(oe),we&&clearTimeout(we);for(let r of F.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of _.splice(0))r();let t=W;W=void 0,ge=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=Ge;return Ge=[],t}};function eo(t,r){let s=globalThis.WebSocket;if(!s)throw new Error("This runtime has no WebSocket; the client polls instead.");let a=typeof globalThis.document<"u",u=e.subprotocol?[en]:[];if(!a)try{return new s(t,{headers:r,...u.length>0?{protocols:u}:{}})}catch{}let y=new URL(t);for(let[b,m]of Object.entries(S))y.searchParams.set(b,m);return u.length>0?new s(y.toString(),u):new s(y.toString())}}function _o(e,n,o=Date.now()){let i,c=e?.trim();if(c)if(/^\d+(\.\d+)?$/.test(c))i=Number(c)*1e3;else{let p=Date.parse(c);Number.isFinite(p)&&(i=Math.max(0,p-o))}let l=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,S=l!==void 0&&l<50&&i!==void 0&&Math.abs(l*1e3-i)<1e3;return l!==void 0&&!S?l:i??1e3}function jo(){globalThis.location?.reload?.()}function qo(){return globalThis.document?.visibilityState!=="hidden"}function tn(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:o=250,max:i=1e4,factor:c=2}=e??{};return Math.min(i,o*c**n)*(.75+Math.random()*.5)}function gt(e){let n={};if(!e)return n;e.id&&(n[be.seat]=e.id),e.roles?.length&&(n[be.roles]=e.roles.join(",")),e.kind!=="human"&&(n[be.kind]=e.kind),e.name&&(n[be.name]=encodeURIComponent(e.name));let o=e.onBehalfOf;return o?.id&&(n[be.for]=o.id),o?.roles?.length&&(n[be.forRoles]=o.roles.join(",")),o?.name&&(n[be.forName]=encodeURIComponent(o.name)),n}var qr="/graview/views";function nn(e){let n=e.fetch??fetch,o=e.url.replace(/\/$/,""),i={"content-type":"application/json",...e.principal?gt(e.principal):{},...e.headers??{}},c=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??at.may}:at,l=new Set,S=P=>{if(JSON.stringify(P)!==JSON.stringify(c)){c=P;for(let k of l)k()}},p=async(P,k)=>{let F=await n(`${o}${e.path??qr}`,{method:P,headers:i,...k!==void 0?{body:JSON.stringify(k)}:{}}),v=await F.json();if(!F.ok)throw new Error(v.error??`The store answered ${F.status}.`);S({hidden:v.hidden??[],removed:v.removed??[],may:v.may??at.may})},w=()=>p("GET"),E=e.state?Promise.resolve():w().catch(()=>{}),T=e.pollMs?setInterval(()=>void w().catch(()=>{}),e.pollMs):void 0;return{ready:E,refresh:w,close:()=>clearInterval(T),current:()=>c,onChange(P){return l.add(P),()=>void l.delete(P)},hide:P=>p("POST",{hide:P}),show:P=>p("POST",{show:P}),remove:(P,k)=>p("POST",{remove:P,...k?{about:k}:{}}),async restore(P){let k=c.removed.find(F=>F.name===P)?.lens;await p("POST",{restore:P}),k&&await e.onDeclaration?.()},async lens(P){await p("POST",{lens:P}),await e.onDeclaration?.()}}}var on=document.getElementById("graview-app"),rn=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),zr=rn?(__graviewPreload(import.meta.url,["./chunk.USB6B6L3.js","./chunk.TAJ2R44N.js","./chunk.XOZU4OFA.js","./chunk.IT763BYH.js","./chunk.2OX4YI46.js","./chunk.XY5EVI22.js","./chunk.XJFAUOJS.js","./chunk.DPPT6WAJ.js","./chunk.7U2JO7ET.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.SRC37GNP.js")):Ve("pages");try{rn?await zo(decodeURIComponent(rn[1])):await Go()}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),on.replaceChildren(n),window.__graviewFailed=n.textContent}async function zo(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 i=await lt(o);if(!i.ok)throw new Error(it(i.findings));let c=i.app,l=o.principal,S=await yt({app:c,url:location.origin,principal:l,...o.state?{state:o.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=c.forms?.[e]?.title??c.name;let{mount:p}=await zr;window.__graview=p(on,{app:c,form:e,principal:l,remote:S,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function Go(){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(),i=await(async w=>{if(typeof w.module=="string")return(await import(w.module)).app;let E=await lt(w);if(!E.ok)throw new Error(it(E.findings));return E.app})(n);if(!i||typeof i!="object"||!("schema"in i))throw new Error("The app module the preview server handed does not export an app.");let c=n.principal,l=await yt({app:i,url:location.origin,principal:c,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=i.name;let S,p=nn({url:location.origin,principal:c,...n.views?{state:n.views}:{},onDeclaration:async()=>{let w=await(await fetch("/graview/document")).json();if(typeof w.module=="string")return;let E=await lt(w);E.ok&&S?.setApp(E.app,l)}});await Promise.all([zr,p.ready]),S=Zt(on,{app:i,remote:l,principal:c,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:i.name,heading:1,keptViews:p,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=S,S.drawn().then(()=>{window.__graviewReady=!0})}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graview",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.56",
|
|
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.
|
|
33
|
-
"@graview/guest": "0.1.
|
|
34
|
-
"@graview/
|
|
35
|
-
"@graview/
|
|
36
|
-
"@graview/
|
|
32
|
+
"@graview/core": "0.1.56",
|
|
33
|
+
"@graview/guest": "0.1.56",
|
|
34
|
+
"@graview/ship": "0.1.56",
|
|
35
|
+
"@graview/skills": "0.1.56",
|
|
36
|
+
"@graview/tools": "0.1.56"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=22"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g}from"./chunk.RYMSHMLM.js";import"./chunk.TI4OSTQV.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";export{e as askArchived,b as askDeclaration,a as declarationAt,f as keptOf,g as pastAt,d as pastOf,c as seqAt};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./chunk.VYKEIKY5.js";import"./chunk.IDYPQ45A.js";import"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";export{a as ActivityFilter,b as InteractionRow};
|
|
@@ -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{G as k,Ga as o,T as n}from"./chunk.SF4BYBH6.js";import{a as t}from"./chunk.SDO3U72B.js";import{b as p}from"./chunk.AJZBJBMO.js";var f=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.GZHZLJBF.js","./chunk.PZWJUQAO.js","./chunk.OJGHDWI6.js","./chunk.NEJSKMJV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.XBDFXFWM.js")))),y=f.part((e,r)=>e.drawFiles(r),{quiet:!0});var d=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.GZHZLJBF.js","./chunk.PZWJUQAO.js","./chunk.OJGHDWI6.js","./chunk.NEJSKMJV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.AN5QCSVK.js")))),I=d.part((e,r)=>e.drawLinkedRecord(r),{quiet:!0}),w=d.part((e,r)=>e.drawLinkedPicker(r),{what:"Picking a linked record"});var s=p(n(),1),m=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.GZHZLJBF.js","./chunk.PZWJUQAO.js","./chunk.OJGHDWI6.js","./chunk.NEJSKMJV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.ARRLAAG6.js")))),E=m.part((e,r)=>(0,s.jsx)(e.RepeatPicker,{...r}),{quiet:!0}),W=m.part((e,r)=>(0,s.jsx)(e.RepeatEditor,{...r}),{quiet:!0});var a=p(k(),1),i=p(n(),1),c=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.JLB4QP6Q.js")))),l=c.part((e,r)=>(0,i.jsx)(e.WhenInput,{...r}),{quiet:!0});function M(e){return(0,i.jsx)(a.Suspense,{fallback:(0,i.jsx)("span",{"data-graview-when-arriving":"",style:{display:"inline-block",minHeight:24}}),children:(0,i.jsx)(l,{...e})})}var N=()=>c.load().then(()=>{},()=>{});export{y as a,I as b,w as c,E as d,W as e,M as f,N as g};
|