graview 0.1.50 → 0.1.51
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/preview/{chunk.V5IWJ3ZV.js → chunk.2534FLZZ.js} +1 -1
- package/dist/preview/{chunk.QSZLY62B.js → chunk.2VJ52LGS.js} +1 -1
- package/dist/preview/{chunk.U2M4SGUU.js → chunk.2W2YVB6X.js} +1 -1
- package/dist/preview/{chunk.ECSWXLBI.js → chunk.2W45NM7Q.js} +2 -2
- package/dist/preview/chunk.32BOL7OL.js +1 -0
- package/dist/preview/chunk.34HGT7HQ.js +1 -0
- package/dist/preview/{chunk.YUV7HZYG.js → chunk.353CGK6C.js} +1 -1
- package/dist/preview/{chunk.64TFAR5Z.js → chunk.3H7YIKKC.js} +1 -1
- package/dist/preview/{chunk.Q7RI4SI4.js → chunk.3MU37W5D.js} +1 -1
- package/dist/preview/chunk.3SBTQ66X.js +1 -0
- package/dist/preview/{chunk.L5MDUZLQ.js → chunk.3TVAE7LE.js} +1 -1
- package/dist/preview/{chunk.ETX4QMM2.js → chunk.4EZFOZBA.js} +1 -1
- package/dist/preview/chunk.4N5R4K6O.js +1 -0
- package/dist/preview/{chunk.KGGWFL54.js → chunk.4T67XS2D.js} +1 -1
- package/dist/preview/chunk.5ON3JSAK.js +1 -0
- package/dist/preview/{chunk.YEKHDZ45.js → chunk.5ZAK57JA.js} +2 -2
- package/dist/preview/chunk.6KYWJXZR.js +1 -0
- package/dist/preview/{chunk.BJAQRV2R.js → chunk.76QSPWSJ.js} +1 -1
- package/dist/preview/{chunk.3SY6WWWQ.js → chunk.7G4M2PX3.js} +2 -2
- package/dist/preview/{chunk.XWLGHTH6.js → chunk.7GAC7U34.js} +1 -1
- package/dist/preview/{chunk.GDYI5QDS.js → chunk.7NQROWHU.js} +1 -1
- package/dist/preview/{chunk.LGHMUUTG.js → chunk.7RIFDWDF.js} +1 -1
- package/dist/preview/{chunk.MQISKON2.js → chunk.ACB4TD4W.js} +1 -1
- package/dist/preview/chunk.AJAMTRZ3.js +1 -0
- package/dist/preview/chunk.AL45OI4A.js +1 -0
- package/dist/preview/{chunk.WGRF6EHC.js → chunk.AL7LFNOS.js} +1 -1
- package/dist/preview/{chunk.ZBBCUK2K.js → chunk.ALCH5H7U.js} +1 -1
- package/dist/preview/{chunk.UOC3SIYT.js → chunk.APFRPN5S.js} +1 -1
- package/dist/preview/{chunk.ODHCSYXX.js → chunk.AZOW57MT.js} +1 -1
- package/dist/preview/chunk.B4PUI3GO.js +1 -0
- package/dist/preview/chunk.B6LKLV32.js +1 -0
- package/dist/preview/{chunk.UDTBFAS5.js → chunk.B7LBG4UP.js} +1 -1
- package/dist/preview/{chunk.YCJ74LZS.js → chunk.BV6HKTHK.js} +1 -1
- package/dist/preview/{chunk.UN2OB6OD.js → chunk.BYY7YXBI.js} +1 -1
- package/dist/preview/{chunk.7QW6JYGP.js → chunk.CI4DEKPX.js} +1 -1
- package/dist/preview/{chunk.ZOQ3OKKI.js → chunk.CMEETACI.js} +1 -1
- package/dist/preview/{chunk.O6SKKF4V.js → chunk.CQPNDJAC.js} +1 -1
- package/dist/preview/{chunk.FFPG4PHX.js → chunk.CTOBNZLM.js} +1 -1
- package/dist/preview/chunk.CUB4IAUJ.js +1 -0
- package/dist/preview/chunk.CUN4VN42.js +1 -0
- package/dist/preview/chunk.CV55N3Y6.js +1 -0
- package/dist/preview/{chunk.M55U47A6.js → chunk.CXC5FOIO.js} +1 -1
- package/dist/preview/{chunk.DUJUJN35.js → chunk.DEH6O3K4.js} +1 -1
- package/dist/preview/chunk.DQNN5FE5.js +1 -0
- package/dist/preview/{chunk.4SHSEIHT.js → chunk.DUY27OJV.js} +1 -1
- package/dist/preview/chunk.E2R6VFZX.js +1 -0
- package/dist/preview/{chunk.KZ3UPV2L.js → chunk.EA2NMVRE.js} +1 -1
- package/dist/preview/chunk.ESK3UZRC.js +1 -0
- package/dist/preview/{chunk.IMFAPZ6J.js → chunk.ESSENNHM.js} +2 -2
- package/dist/preview/{chunk.5DZR46YG.js → chunk.ET3XJDPX.js} +1 -1
- package/dist/preview/chunk.FEIJ7ETK.js +1 -0
- package/dist/preview/{chunk.4XOSDCCE.js → chunk.FFCUZPTC.js} +1 -1
- package/dist/preview/chunk.FG5ZFYYL.js +1 -0
- package/dist/preview/{chunk.KFHXTHIY.js → chunk.FKJ3HIA5.js} +1 -1
- package/dist/preview/chunk.FTBH7CPZ.js +1 -0
- package/dist/preview/{chunk.LDE5HLTM.js → chunk.FU4YSVWX.js} +1 -1
- package/dist/preview/{chunk.A53G42QO.js → chunk.FYDDFOSD.js} +1 -1
- package/dist/preview/{chunk.ETWREHXF.js → chunk.GJQF7I22.js} +1 -1
- package/dist/preview/{chunk.6SHF6IL5.js → chunk.GLTWLQ6L.js} +1 -1
- package/dist/preview/chunk.GMAXA5GV.js +1 -0
- package/dist/preview/{chunk.SRU2YDTJ.js → chunk.GRYS6VSF.js} +1 -1
- package/dist/preview/{chunk.ZK446PSX.js → chunk.GYTVL6GR.js} +3 -3
- package/dist/preview/chunk.HASVT7IC.js +1 -0
- package/dist/preview/{chunk.RK6BK5FD.js → chunk.HFKGND5Q.js} +1 -1
- package/dist/preview/{chunk.JJP5OL5E.js → chunk.HVX7LFWR.js} +1 -1
- package/dist/preview/chunk.IBJBCZKG.js +1 -0
- package/dist/preview/{chunk.CDZVUCEK.js → chunk.IE4ZJQV3.js} +1 -1
- package/dist/preview/chunk.IFL2MYTQ.js +1 -0
- package/dist/preview/{chunk.F7AFJRPP.js → chunk.IUIDDNN3.js} +1 -1
- package/dist/preview/{chunk.RXJBYP7B.js → chunk.JBR66TUP.js} +1 -1
- package/dist/preview/chunk.JG2FGZF2.js +18 -0
- package/dist/preview/{chunk.7VX6TBNY.js → chunk.JI2UVZUU.js} +1 -1
- package/dist/preview/{chunk.OB7XLVK6.js → chunk.JMDKAP23.js} +1 -1
- package/dist/preview/{chunk.IDQHSAAQ.js → chunk.JX2C3HVD.js} +1 -1
- package/dist/preview/{chunk.FKUVIG6D.js → chunk.K7ECYKZL.js} +1 -1
- package/dist/preview/{chunk.UGJ32SEL.js → chunk.K7RKWB2K.js} +1 -1
- package/dist/preview/{chunk.S64LCR23.js → chunk.KK46XLGU.js} +1 -1
- package/dist/preview/chunk.KOBCLWPC.js +1 -0
- package/dist/preview/chunk.KRODTMGR.js +1 -0
- package/dist/preview/chunk.KYKHZZT7.js +1 -0
- package/dist/preview/chunk.LYIHPVDZ.js +1 -0
- package/dist/preview/{chunk.JLPBXG4P.js → chunk.MG3DMURZ.js} +1 -1
- package/dist/preview/{chunk.YG3BLY67.js → chunk.MMVCZOEX.js} +1 -1
- package/dist/preview/{chunk.BBNF52IB.js → chunk.MN6WHE4B.js} +1 -1
- package/dist/preview/{chunk.UJTRKSCK.js → chunk.MRXQBEPQ.js} +1 -1
- package/dist/preview/{chunk.NB6WN4DO.js → chunk.MX3Y3LPH.js} +1 -1
- package/dist/preview/{chunk.LJXAZ5TF.js → chunk.MY5OXSS7.js} +1 -1
- package/dist/preview/chunk.N5XONWU2.js +1 -0
- package/dist/preview/chunk.NNUUD26E.js +1 -0
- package/dist/preview/{chunk.ZITDUHX3.js → chunk.NQ26KMSQ.js} +1 -1
- package/dist/preview/{chunk.QFI4L2HK.js → chunk.NVRK6A7T.js} +1 -1
- package/dist/preview/{chunk.DUIKIJKC.js → chunk.NZDHXREL.js} +1 -1
- package/dist/preview/chunk.OHDJYGH7.js +2 -0
- package/dist/preview/{chunk.GZEZMU2T.js → chunk.OJ64WTLW.js} +2 -2
- package/dist/preview/{chunk.OUNLAMBA.js → chunk.OPCBZNKF.js} +1 -1
- package/dist/preview/{chunk.UCS3CBT4.js → chunk.OU5TRY4N.js} +1 -1
- package/dist/preview/chunk.OW72XZF4.js +1 -0
- package/dist/preview/chunk.P4CLT32V.js +5 -0
- package/dist/preview/chunk.PFXGWY3P.js +1 -0
- package/dist/preview/{chunk.GPJFNLEJ.js → chunk.PMV6XVVZ.js} +1 -1
- package/dist/preview/{chunk.2P66HH5Y.js → chunk.PPZ2TOB5.js} +1 -1
- package/dist/preview/{chunk.JC5NXMG3.js → chunk.PYRJDTVS.js} +1 -1
- package/dist/preview/chunk.QEQQXWYU.js +1 -0
- package/dist/preview/chunk.QPAJCRFB.js +1 -0
- package/dist/preview/chunk.R5R7CLOU.js +1 -0
- package/dist/preview/{chunk.SWLDDQJS.js → chunk.RMMJQYJJ.js} +1 -1
- package/dist/preview/{chunk.FDFVGHQE.js → chunk.RNOBACJ6.js} +1 -1
- package/dist/preview/{chunk.4BQNG3W3.js → chunk.S32AGJ3W.js} +1 -1
- package/dist/preview/chunk.S4CKKT3C.js +1 -0
- package/dist/preview/{chunk.KOPRZLJH.js → chunk.SJKHVIHA.js} +2 -2
- package/dist/preview/chunk.SJYQ72EC.js +1 -0
- package/dist/preview/chunk.SKG4IHT5.js +88 -0
- package/dist/preview/chunk.SLBWPVIY.js +1 -0
- package/dist/preview/{chunk.YZ6UKKEL.js → chunk.SPU3BVAO.js} +1 -1
- package/dist/preview/{chunk.VVRI7DNK.js → chunk.SRFZKDQ6.js} +1 -1
- package/dist/preview/{chunk.MRUDTYOL.js → chunk.SSAY4ITS.js} +2 -2
- package/dist/preview/{chunk.TY6VILZB.js → chunk.T3RTFTOZ.js} +1 -1
- package/dist/preview/{chunk.73BJYIYS.js → chunk.TBSPEO2L.js} +1 -1
- package/dist/preview/chunk.TMYGLXR6.js +25 -0
- package/dist/preview/{chunk.GTUBIJTP.js → chunk.TNL2BVCH.js} +1 -1
- package/dist/preview/{chunk.QAUZDLDA.js → chunk.TVWN5I4M.js} +1 -1
- package/dist/preview/{chunk.MCPLU2U4.js → chunk.U7SNDY3F.js} +1 -1
- package/dist/preview/chunk.UCUWEYKM.js +1 -0
- package/dist/preview/{chunk.T4UYLB3Y.js → chunk.UIWI4GKW.js} +1 -1
- package/dist/preview/{chunk.HGP3Q7QX.js → chunk.UK5F3S2N.js} +1 -1
- package/dist/preview/{chunk.ZKDJQDKX.js → chunk.UVAWWCFW.js} +1 -1
- package/dist/preview/{chunk.L2AV6JRA.js → chunk.UWFEXEY3.js} +1 -1
- package/dist/preview/chunk.V4GAOZAW.js +1 -0
- package/dist/preview/{chunk.TT6QBWRA.js → chunk.VICCAWAN.js} +1 -1
- package/dist/preview/{chunk.AXMC6XVT.js → chunk.W2DKFQ6R.js} +1 -1
- package/dist/preview/{chunk.53BGPCM6.js → chunk.WESWDXRW.js} +1 -1
- package/dist/preview/{chunk.QZMBEG4E.js → chunk.WFHFWJ6E.js} +1 -1
- package/dist/preview/{chunk.AXCRFJDL.js → chunk.WQLAIEWJ.js} +1 -1
- package/dist/preview/{chunk.JYJNRCK5.js → chunk.XCCBUWMC.js} +1 -1
- package/dist/preview/{chunk.GQX57JIE.js → chunk.XCQ7ZPR5.js} +1 -1
- package/dist/preview/chunk.XWXYC3BJ.js +1 -0
- package/dist/preview/chunk.XZVPVAIS.js +1 -0
- package/dist/preview/chunk.Y2ZBVWII.js +1 -0
- package/dist/preview/chunk.Y3LTHEN7.js +1 -0
- package/dist/preview/{chunk.TL7UGUY4.js → chunk.Y5AMZBHA.js} +2 -2
- package/dist/preview/{chunk.CR5MQMOL.js → chunk.Z7N3MJ36.js} +1 -1
- package/dist/preview/{chunk.SVH3OMU2.js → chunk.ZJXUWOG3.js} +1 -1
- package/dist/preview/{chunk.BORCUDGS.js → chunk.ZZODDJYK.js} +1 -1
- package/dist/preview/index.html +51 -51
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.24MUPV4Y.js +0 -1
- package/dist/preview/chunk.2VZSC2MB.js +0 -1
- package/dist/preview/chunk.3L5USMQD.js +0 -1
- package/dist/preview/chunk.3O3H37WD.js +0 -1
- package/dist/preview/chunk.4VJARLJ5.js +0 -1
- package/dist/preview/chunk.5RNB6IC5.js +0 -1
- package/dist/preview/chunk.6BMCZPT6.js +0 -1
- package/dist/preview/chunk.6VA5XFRR.js +0 -1
- package/dist/preview/chunk.7PJVMADH.js +0 -2
- package/dist/preview/chunk.ATWNWPME.js +0 -1
- package/dist/preview/chunk.AVCW7C6V.js +0 -1
- package/dist/preview/chunk.BLS2G3CD.js +0 -5
- package/dist/preview/chunk.BNQL37AC.js +0 -88
- package/dist/preview/chunk.CBJHYNNT.js +0 -1
- package/dist/preview/chunk.EF3UB7US.js +0 -1
- package/dist/preview/chunk.EJUZGIQ5.js +0 -1
- package/dist/preview/chunk.F5FJHKWV.js +0 -1
- package/dist/preview/chunk.GQI53L5P.js +0 -1
- package/dist/preview/chunk.HG34MT7C.js +0 -1
- package/dist/preview/chunk.IATLUWAD.js +0 -1
- package/dist/preview/chunk.JLR74UFP.js +0 -1
- package/dist/preview/chunk.K4ITS63T.js +0 -1
- package/dist/preview/chunk.KT2LXHSI.js +0 -1
- package/dist/preview/chunk.M5RHVUZ6.js +0 -1
- package/dist/preview/chunk.MBZ6N5SO.js +0 -1
- package/dist/preview/chunk.N7FIUTVY.js +0 -1
- package/dist/preview/chunk.NPU4WYRB.js +0 -1
- package/dist/preview/chunk.OHAWUOUN.js +0 -1
- package/dist/preview/chunk.OKQ4JXTW.js +0 -1
- package/dist/preview/chunk.OYQ6ZA6T.js +0 -1
- package/dist/preview/chunk.Q7UQ5OXA.js +0 -1
- package/dist/preview/chunk.ROJZLOKZ.js +0 -1
- package/dist/preview/chunk.S7OFTGBQ.js +0 -18
- package/dist/preview/chunk.SGMVLKZO.js +0 -25
- package/dist/preview/chunk.SJRXBTGP.js +0 -1
- package/dist/preview/chunk.THTHNY4N.js +0 -1
- package/dist/preview/chunk.U6FGWVGB.js +0 -1
- package/dist/preview/chunk.UEL7FLL7.js +0 -1
- package/dist/preview/chunk.VM43YREJ.js +0 -1
- package/dist/preview/chunk.YAS6LXQ7.js +0 -1
- package/dist/preview/chunk.YEMNR4WU.js +0 -1
- package/dist/preview/chunk.YYS45ZGQ.js +0 -1
- package/dist/preview/chunk.ZI66HRES.js +0 -1
- package/dist/preview/chunk.ZVETGRUM.js +0 -1
- package/dist/preview/chunk.ZVOP2HHI.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ot}from"./chunk.NB6WN4DO.js";import"./chunk.QSZLY62B.js";import{e as V,l as ue,m as G,q as st}from"./chunk.7VX6TBNY.js";import{a as ee}from"./chunk.G4JJXA63.js";import"./chunk.64TFAR5Z.js";import{b as nt}from"./chunk.5DZR46YG.js";import{d as tt}from"./chunk.Q7RI4SI4.js";import"./chunk.XOZU4OFA.js";import"./chunk.CR5MQMOL.js";import"./chunk.JJP5OL5E.js";import"./chunk.TT6QBWRA.js";import{d as et}from"./chunk.UCS3CBT4.js";import{c as Ze}from"./chunk.O6SKKF4V.js";import{I as ze,V as Je,da as Ye,ha as qe,id as Ne,jd as Xe,kb as Ve,la as Ae,lb as Qe,ma as F}from"./chunk.BLS2G3CD.js";import"./chunk.EJUZGIQ5.js";import"./chunk.AJZBJBMO.js";var At="Nothing by that name here.",$=o=>o.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[’']/g,"'").replace(/[^\p{L}\p{N}' ]+/gu," ").replace(/\s+/g," ").trim(),Nt=/^(?:(?:can you |could you |please )?(?:go|take me|bring me|head|jump|navigate|switch|get me)(?: back)? to|(?:please )?(?:open|show(?: me)?|bring up|let me see|view)) (.+)$/,St=/^(?:(?:can you |could you |please )?tell me (?:about|of)|what(?: is|'s| are) (?:in |on )?|describe|explain|who(?: is|'s)) (.+)$/,Ot=/^(?:what(?: is|'s| am i looking at| do i see)(?: (?:here|this|on (?:this|the) (?:page|screen)|in view|this place|this page))?|where am i|describe (?:this|here|this place|this page)|tell me about (?:this|here|this place|this page))$/,rt=new Set(["here","this","this place","this page","on this page","on the page","on this screen","in view"]),Ct=/^(?:date|day|when|on|at|the date|the day)$/,jt=/^(?:what(?: is|'s) (?:wrong|broken|the (?:problem|matter|trouble))|what needs (?:fixing|attention|doing)|any (?:problems|issues|trouble)|(?:show(?: me)? |go to |open )?(?:the )?(?:problems|issues|trouble|standing|what's wrong)|is (?:anything|something) (?:wrong|broken)|are there (?:any )?(?:problems|issues))(?: (?:with|about|on|in) (.+))?$/,z=o=>o.replace(/^(?:the|a|an|my|our) /,""),te=new Set(["the","a","an","my","our","all","any","of","that","which","who","are","is","be","what","whats","what's","with","me","show","list","every","there","do","i","have","we","due","for","please","were","was","by","from","in","on"]),ft=864e5,he=o=>Date.UTC(Number(o.slice(0,4)),Number(o.slice(5,7))-1,Number(o.slice(8,10))),xe=o=>new Date(o).toISOString().slice(0,10),C=(o,i)=>xe(he(o)+i*ft),xt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Mt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Wt="(monday|tuesday|tues|wednesday|thursday|thurs|friday|saturday|sunday)",it="(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sept|sep|oct|nov|dec)",at="(\\d{1,2})(?:st|nd|rd|th)?",Dt=o=>xt.findIndex(i=>i.startsWith(o.slice(0,3))),dt=o=>Mt.findIndex(i=>o.startsWith(i.toLowerCase()));function Rt(o,i){return Je(o,{year:o.slice(0,4)!==i.slice(0,4)})}function Se(o,i,y){if(o<0||i<1||i>31)return;let f=Number(y.slice(0,4)),c=k=>{let j=Date.UTC(k,o,i);return new Date(j).getUTCMonth()===o?xe(j):void 0},p=c(f);if(p)return he(p)<he(y)-183*ft?c(f+1):p}function Oe(o,i,y){let f=new Date(he(i)).getUTCDay(),c=u=>{let S=(f-y+7)%7,w=C(i,-S+u*7);return{from:w,to:C(w,6)}},p=()=>{let u=`${i.slice(0,8)}01`,S=new Date(Date.UTC(Number(i.slice(0,4)),Number(i.slice(5,7)),1));return{from:u,to:C(xe(S.getTime()),-1)}},k=u=>u?{from:u,to:u,day:Rt(u,i)}:void 0,j=(u,S)=>{let w=Dt(S);return k(u==="this"||u==="next"?C(c(u==="next"?1:0).from,(w-y+7)%7):u==="last"?C(i,-((f-w+6)%7+1)):C(i,(w-f+7)%7))},J=u=>{let S=C(i,f===0?-1:6-f);return{from:C(S,u*7),to:C(S,u*7+1)}},B="\\b(?:(?:due |for |on |by )(?:the )?)?",P=[[/\b(?:overdue|past due|late)\b/,()=>({overdue:!0,to:C(i,-1)})],[/\b(?:due |for |on )?today\b/,()=>({from:i,to:i})],[/\b(?:due |for |on )?tomorrow\b/,()=>k(C(i,1))],[/\b(?:due |for |on )?yesterday\b/,()=>k(C(i,-1))],[/\b(?:due |for |on )?this week\b/,()=>c(0)],[/\b(?:due |for |on )?next week\b/,()=>c(1)],[/\b(?:due |for |on )?(?:last|previous) week\b/,()=>c(-1)],[/\b(?:due |for |on )?next weekend\b/,()=>J(1)],[/\b(?:due |for |on )?(?:this |the )?weekend\b/,()=>J(0)],[/\b(?:due |for |on )?this month\b/,()=>p()],[new RegExp(`${B}(\\d{4}) (\\d{2}) (\\d{2})\\b`),u=>k(Se(Number(u[2])-1,Number(u[3]),`${u[1]}-01-01`))],[new RegExp(`${B}${at} (?:of )?${it}\\b`),u=>k(Se(dt(u[2]),Number(u[1]),i))],[new RegExp(`${B}${it} (?:the )?${at}\\b`),u=>k(Se(dt(u[1]),Number(u[2]),i))],[new RegExp(`${B}(?:(this|next|last|coming) )?${Wt}\\b`),u=>j(u[1],u[2])]];for(let[u,S]of P){let w=o.match(u);if(!w)continue;let N=S(w);if(N)return{ask:{words:w[0],...N},rest:o.replace(w[0]," ").replace(/\s+/g," ").trim()}}}function ht(o,i,y={}){let f=y.principal??{kind:"human"},c=o.seenBy(f),p=c.schema,k=y.today??o.today?.()??ze(),j=y.weekStartsOn??1,J=o.kindsKeptFrom(f),B=o.modules.disabledKinds,P=p.kinds.filter(e=>!J.has(e)&&!B.has(e)),u=new Set(P),S=(y.places??[]).filter(e=>e.kind===null||u.has(e.kind)),w=c.graph,N=$(i).replace(/[?.!]+$/,"").trim();if(N.length===0)return{unresolved:!0};let M=e=>p.tryDefinition(e),H=e=>Ye(M(e.kind),e),I=e=>qe(p,e),se=e=>S.find(t=>t.kind===e&&t.address===Ne(p,e))?.address??Ne(p,e),ge=e=>Xe(p,e.kind,e.id),Me=e=>({to:"record",id:e.id,kind:e.kind,label:H(e),address:ge(e),said:`Went to ${H(e)}.`}),We=e=>{let t=`Went to ${e.title}.`;return e.kind===null?{to:"place",slug:e.slug,title:e.title,address:e.address,...e.slug==="overview"?{face:"scene"}:{},said:t}:e.lens||e.address.startsWith("/places/")?{to:"picture",kind:e.kind,as:e.slug,title:e.title,address:e.address,said:t}:{to:"kind",kind:e.kind,title:e.title,address:e.address,said:t}},De=()=>({unresolved:!0,say:At}),oe=e=>{let t=M(e.kind),s=et(e,t,{limit:3,excerpt:!0}).map(r=>r.alone.startsWith(r.label)?r.alone:`${r.label.toLowerCase()} ${r.alone}`).join(", "),n=c.violations().filter(r=>r.nodeIds.includes(e.id));return[`${H(e)} \u2014 ${Ae(F(t,e.kind))}${s?` (${s})`:""}.`,n.length>0?`Trouble: ${n.map(r=>r.message).join("; ")}.`:""].filter(Boolean).join(" ")},re=e=>{let t=new Set([G(e),G(z(e))]);for(let n of[" page"," view"," lens"," place"," picture"," list"])e.endsWith(n)&&(t.add(G(e.slice(0,-n.length))),t.add(G(z(e.slice(0,-n.length)))));t.delete("");let s=n=>t.has(G(n.title))||t.has(G(z($(n.title))))||t.has(G(n.slug));return S.find(n=>n.kind!==null&&n.address.startsWith("/places/")&&s(n))??S.find(s)},pe=e=>{let t=st(o,e,{principal:f,today:k,limit:6,near:!1,...y.selection?{from:y.selection}:{}}),s=t.hits.filter(r=>r.about==="node"&&u.has(r.kind)&&w.getNode(r.id)!==void 0),n=s.filter(r=>r.why.field==="label"&&r.why.strength==="exact");return n.length===1?{one:w.getNode(n[0].id),picks:s}:n.length>1?{picks:n}:s.length===1&&t.total===1?{one:w.getNode(s[0].id),picks:s}:{picks:s}},Re=e=>{let t=e.map(s=>`${s.label} (${F(M(s.kind),s.kind)})`);return`${e.length===1?"One thing matches":`${e.length} things match`}: ${t.join("; ")}.`},Ee=(e,t)=>{if(rt.has(e))return Le();let s=t?pe(z(e)||e):void 0,n=s?.one&&$(H(s.one))===$(z(e)||e)?void 0:re(e);if(n){let l=We(n);return{about:"place",say:t?`${l.said} ${me(n)}`:l.said,moves:[l],subject:n.slug}}let r=pe(z(e)||e);if(r.one){let l=Me(r.one);return{about:t?"describe":"record",say:t?`${l.said} ${oe(r.one)}`:l.said,moves:[l],subject:r.one.id}}if(r.picks.length>0)return{about:"picks",say:Re(r.picks),moves:[],picks:r.picks};let h=ae(e);if(h)return h;let d=Pe(e);if(d){if(d.rest.split(" ").every(l=>l===""||te.has(l))){let l=I(d.kind),v={to:"kind",kind:d.kind,title:l,address:se(d.kind),said:`Went to the ${l.toLowerCase()}.`};return{about:"kind",say:v.said,moves:[v]}}return{unresolved:!0}}return De()},me=e=>{if(e.kind===null){let h=P.map(l=>({kind:l,count:w.nodesOfKind(l).length})).filter(l=>l.count>0).map(l=>`${l.count} ${(l.count===1?F(M(l.kind),l.kind):I(l.kind)).toLowerCase()}`),d=c.violations().length;return[h.length>0?`It holds ${fe(h)}.`:"It holds nothing yet.",d>0?`${d===1?"One problem":`${d} problems`} to see to.`:""].filter(Boolean).join(" ")}let t=w.nodesOfKind(e.kind).length,s=I(e.kind).toLowerCase(),n=new Set(c.violations().flatMap(h=>h.nodeIds)),r=w.nodesOfKind(e.kind).filter(h=>n.has(h.id)).length;return[e.lens?`It draws the ${s} as ${Ae(e.lens)}${t>0?` \u2014 ${t} of them`:""}.`:`${t===0?"No":t} ${t===1?F(M(e.kind),e.kind):s} ${t===1?"is":"are"} here.`,r>0?`${r} ${r===1?"has":"have"} a problem.`:""].filter(Boolean).join(" ")},Le=()=>{let e=(y.selection??[]).map(s=>w.getNode(s)).find(s=>s!==void 0);if(e)return{about:"here",say:oe(e),moves:[],subject:e.id};let t=S.find(s=>s.slug===y.place)??S.find(s=>s.slug==="home");return t?{about:"here",say:`${t.title}. ${me(t)}`,moves:[],subject:t.slug}:{about:"here",say:me({slug:"home",title:"Home",kind:null,cardinality:"many",address:"/",stop:"#"}),moves:[]}},Pe=e=>{let t=P.flatMap(s=>[I(s),F(M(s),s),s].map(n=>({kind:s,name:$(n)}))).filter(s=>s.name.length>0).sort((s,n)=>n.name.length-s.name.length);for(let{kind:s,name:n}of t)if(!(` ${e} `.indexOf(` ${n} `)<0))return{kind:s,rest:` ${e} `.replace(` ${n} `," ").replace(/\s+/g," ").trim()}},ie=(e,t)=>{let s=V(p,e).filters.filter(d=>d.about==="field"&&d.type==="date");if(s.length===0)return;let n=s.find(d=>t.some(l=>$(d.key)===l||$(d.label)===l));if(n)return n;let r=M(e)?.fieldRoles??{};for(let d of["due","deadline","date","when","start","end"]){let l=r[d],v=l?s.find(x=>x.key===l):void 0;if(v)return v}return s.find(d=>["due","deadline","date","when","on","at"].includes(d.key.toLowerCase()))??(s.length===1?s[0]:void 0)},He=e=>{let t=M(e),s=V(p,e).filters;if(t?.lifecycle)return{conditions:[{key:"is",value:"current"}],holds:d=>ue(be,d,{key:"is",value:"current"})};let r=s.find(d=>d.about==="field"&&d.type==="boolean"&&ne.has($(d.key)));if(r)return{conditions:[{key:r.key,value:"false"}],holds:d=>d[r.key]!==!0};let h=s.find(d=>d.about==="field"&&d.type==="choice"&&(d.options??[]).some(l=>ne.has($(l))));if(h){let d=new Set((h.options??[]).filter(v=>ne.has($(v)))),l=(h.options??[]).filter(v=>!d.has(v));return l.length===1?{conditions:[{key:h.key,value:l[0]}],holds:v=>v[h.key]===l[0]}:"unsayable"}return{conditions:[],holds:()=>!0}},Ie=(e,t)=>{let s=e.words.startsWith("due")||$(t.key)==="due",n=Ct.test($(t.label));if(e.day)return s?`due ${e.day}`:n?`on ${e.day}`:`${t.label.toLowerCase()} on ${e.day}`;let r=e.words.replace(/^(?:due|for|on|by) (?:the )?/,"");return s?`due ${r}`:n?r:`${t.label.toLowerCase()} ${r}`},ye=new Set(c.violations().flatMap(e=>e.nodeIds)),be={schema:p,graph:c.graph,flagged:ye,today:k},ae=e=>{let t=Oe(e,k,j),s=Pe(t?.rest??e),n=s?.kind,r=(s?.rest??t?.rest??e).split(" ").filter(Boolean);if(!n&&t){let g=e.split(" "),m=P.filter(L=>ie(L,g)!==void 0),E=m.filter(L=>{let b=ie(L,g);return g.some(O=>$(b.key)===O||$(b.label)===O)}),U=m.length===1?m:E;if(U.length!==1)return;n=U[0]}if(!n)return;let h=V(p,n).filters,d=[],l=[],v=[],x=[],q=!1,de=[];for(let g=0;g<r.length;g++){let m=r[g],E=g>0&&(r[g-1]==="not"||r[g-1]==="un"),U=h.find(b=>b.about==="field"&&b.type==="choice"&&(b.options??[]).some(O=>$(O)===m));if(U&&!E){let b=(U.options??[]).find(O=>$(O)===m);d.push({key:U.key,value:b}),l.push(b);continue}let L=h.find(b=>b.about==="field"&&b.type==="boolean"&&[$(b.key),$(b.label)].some(O=>O===m||O===m.replace(/^un/,"")));if(L){let b=!E&&!(m.startsWith("un")&&!$(L.key).startsWith("un"));d.push({key:L.key,value:String(b)}),l.push(b?m:`not ${m.replace(/^un/,"")}`);continue}if(Pt.has(m)&&!E){let b=He(n);b==="unsayable"?(q=!0,x.push(O=>!ut(p,O))):(d.push(...b.conditions),x.push(b.holds)),l.push(m);continue}m==="not"||m==="un"||t&&h.some(b=>b.type==="date"&&($(b.key)===m||$(b.label)===m))||de.push(m)}if(r=de,r.some(g=>!te.has(g))||!t&&d.length===0&&x.length===0)return;let T=I(n).toLowerCase(),Q=I(n);if(t){let g=ie(n,e.split(" "));if(!g){let m={to:"kind",kind:n,title:Q,address:se(n),said:`Went to the ${T}.`};return{about:"kind",say:`${ee(Q)} carry no date, so I can't tell which are ${/^(?:due|for|on|overdue|past due|late)\b/.test(t.ask.words)?t.ask.words:`due ${t.ask.words}`}. ${m.said}`,moves:[m]}}if(t.ask.from&&d.push({key:g.key,value:`after:${C(t.ask.from,-1)}`}),t.ask.to&&d.push({key:g.key,value:`before:${C(t.ask.to,1)}`}),t.ask.overdue){let m=He(n);m==="unsayable"?(q=!0,x.push(E=>!ut(p,E))):(d.push(...m.conditions),x.push(m.holds))}t.ask.overdue?l.push("overdue"):v.push(Ie(t.ask,g))}let R=w.nodesOfKind(n).filter(g=>d.every(m=>ue(be,g,m))&&x.every(m=>m(g))),K=[...l,...v].join(" and "),Y=[...l,T,...v].join(" "),W=R.slice(0,6).map(g=>({about:"node",id:g.id,kind:n,label:H(g),why:{field:d[0]?.key??"label",reading:d[0]?.key??"Name",fragment:K,strength:"field"},current:!0,flagged:ye.has(g.id),address:ge(g)})),X=R.length===0?`No ${T} are ${K}.`:`${R.length===1?`One ${F(M(n),n)} is`:`${R.length} ${T} are`} ${K}: ${fe(R.slice(0,6).map(H))}${R.length>6?`, and ${R.length-6} more`:""}.`;if(q)return{about:"kind",say:X,moves:[],picks:W,offer:{draft:Y,label:"Show as a view"}};let Z=d.map(g=>`${g.key}:${g.value}`).join(","),we=`${se(n)}?${new URLSearchParams({filter:Z}).toString()}`,_={to:"kind",kind:n,title:ee(Y),filter:Z,address:we,said:`Went to the ${Y}.`};return{about:"kind",say:`${_.said} ${X}`,moves:[_],picks:W}},Te=e=>M(e)?.figure==="person"?!0:[e,F(M(e),e),I(e)].some(s=>$(s).split(" ").some(n=>Et.has(n))),pt=e=>{let t=[],s=n=>M(n)?.edges??{};for(let[n,r]of Object.entries(s(e)))for(let h of r.to??[])u.has(h)&&t.push({key:n,direction:"out",far:h,words:ct(`${r.description??""} ${n}`)});for(let n of P)for(let[r,h]of Object.entries(s(n)))(h.to??[]).includes(e)&&t.push({key:r,direction:"in",far:n,words:ct(`${h.inverse??""} ${r}`)});return t},mt=e=>{let t=e.match(/^(who|which|what)\b/)?.[1];if(!t)return;let s=Oe(e,k,j);if(!s||s.ask.overdue)return;let n=s.rest.split(" ").filter(Boolean),r=P.flatMap(a=>[I(a),F(M(a),a),a].map(A=>({kind:a,name:$(A)}))).filter(a=>a.name.length>0).sort((a,A)=>A.name.length-a.name.length),h=` ${n.join(" ")} `,d=[];for(let{kind:a,name:A}of r)h.includes(` ${A} `)&&(h=h.replace(` ${A} `," "),d.includes(a)||d.push(a));let l=h.match(/\b(?:is|are|was|were)\b|'s\b/)?.[0],v=h.replace(/'s\b/g," ").split(" ").filter(a=>a.length>0&&!te.has(a)&&!Ce.has(a)),x=t==="who"?d.find(Te):d[0];if(!x&&t!=="who")return;let q=d.find(a=>a!==x),de=v.flatMap(a=>[je(a),...lt.has(je(a))?[...lt]:[]]),T=P.filter(a=>q?a===q:a!==x).flatMap(a=>{let A=ie(a,e.split(" "))??V(p,a).filters.find(D=>D.about==="field"&&D.type==="date");return A?pt(a).filter(D=>(x?D.far===x:Te(D.far))&&D.far!==a).map(D=>({kind:a,field:A,relation:D,said:v.length===0||de.some(ve=>D.words.some(vt=>Lt(vt,ve)))})):[]}).filter(a=>a.said);if(T.length===0)return;let Q=T.filter(a=>n.some(A=>$(a.field.key)===A||$(a.field.label)===A)),R=T.length===1?T[0]:Q.length===1?Q[0]:void 0;if(!R)return;let{kind:K,field:Y,relation:W}=R,X=[...s.ask.from?[{key:Y.key,value:`after:${C(s.ask.from,-1)}`}]:[],...s.ask.to?[{key:Y.key,value:`before:${C(s.ask.to,1)}`}]:[]],Z=w.nodesOfKind(K).filter(a=>X.every(A=>ue(be,a,A))),we=a=>(W.direction==="out"?c.graph.out(a.id,W.key):c.graph.in(a.id,W.key)).filter(A=>A.kind===W.far&&u.has(W.far)),_=[],g=[];for(let a of Z){let A=we(a);A.length===0&&g.push(a);for(let D of A)_.some(ve=>ve.id===D.id)||_.push(D)}let m=Ie(s.ask,Y),E=s.ask.day?`On ${s.ask.day}`:ee(s.ask.words.replace(/^(?:due|for|on|by) (?:the )?/,"")),U=I(K).toLowerCase(),L=X.map(a=>`${a.key}:${a.value}`).join(","),b=`${U} ${m}`,O={to:"kind",kind:K,title:ee(b),filter:L,address:`${se(K)}?${new URLSearchParams({filter:L}).toString()}`,said:`Went to the ${b}.`};if(Z.length===0)return{about:"related",say:`No ${b}. ${O.said}`,moves:[O]};let le=v.join(" "),yt=l==="was"||l==="were",Ge=a=>yt?a===1?"was":"were":a===1?"is":"are",ce=_.map(H),bt=ce.length>8?[...ce.slice(0,8),`${ce.length-8} more`]:ce,kt=_.length===0?`${E}: nobody ${Ge(1)}${le?` ${le}`:""}.`:`${E}: ${fe(bt)}${le?` ${Ge(_.length)} ${le}`:""}.`,$t=t==="who"&&g.length>0?`${fe(g.slice(0,4).map(H))}${g.length>4?` and ${g.length-4} more`:""} ${g.length===1?"has":"have"} nobody.`:"",wt=_.slice(0,8).map(a=>({about:"node",id:a.id,kind:a.kind,label:H(a),why:{field:W.key,reading:Ze(p,W.direction==="out"?K:W.far,W.key,W.direction==="out"?"out":"in"),fragment:m,strength:"field"},current:!0,flagged:ye.has(a.id),address:ge(a)}));return{about:"related",say:[kt,$t,O.said].filter(Boolean).join(" "),moves:[O],picks:wt}},Ke=N.match(jt);if(Ke){let e=Ke[1];if(e&&!rt.has(e)&&!/^(?:it|this|that)$/.test(e)){let n=re(e),r=n?void 0:pe(z(e)||e);if(r?.one){let h=Me(r.one);return{about:"describe",say:`${h.said} ${oe(r.one)}`,moves:[h],subject:r.one.id}}if(!n)return r&&r.picks.length>0?{about:"picks",say:Re(r.picks),moves:[],picks:r.picks}:De()}if(e&&/^(?:it|this|that)$|^(?:here|this place|this page)$/.test(e)){let n=(y.selection??[]).map(r=>w.getNode(r)).find(r=>r!==void 0);if(n)return{about:"describe",say:oe(n),moves:[],subject:n.id}}let t=c.violations();if(t.length===0)return{about:"problems",say:"Nothing is wrong \u2014 every rule holds.",moves:[]};let s={to:"problems",address:"/problems",said:"Went to the problems."};return{about:"problems",say:`${s.said} ${Qe(t)}: ${t.slice(0,4).map(n=>n.message).join("; ")}${t.length>4?"\u2026":"."}`,moves:[s]}}if(Ot.test(N))return Le();let _e=mt(N);if(_e)return _e;let ke=Oe(N,k,j);if(ke&&!re(z(ke.ask.words))&&ke.rest.replace(/'s\b/g,"").split(" ").every(e=>e===""||te.has(e)||Ce.has(e))){let e=ae(N);if(e)return e}if(/^open /.test(N)){let e=ae(N);if(e)return e}let Fe=N.match(Nt)??N.match(/^(?:go|take me|head|get me)(?: back)? (home)$/);if(Fe)return Ee(Fe[1].trim(),!1);let Be=N.match(St);if(Be){let e=Ee(Be[1].trim(),!0);return"unresolved"in e&&e.unresolved&&!/^tell me|^describe/.test(N)?{unresolved:!0}:e}let $e=re(N);if($e){let e=We($e);return{about:"place",say:e.said,moves:[e],subject:$e.slug}}let Ue=ae(N);return Ue||{unresolved:!0}}var Ce=new Set(["who","whom","whose","which","what","whats","what's","who's"]),Et=new Set(["person","people","user","users","member","members","volunteer","volunteers","gardener","gardeners","player","players","staff","worker","workers","employee","employees","owner","owners","assignee","assignees","helper","helpers","student","students","teacher","teachers","customer","customers","client","clients","contact","contacts","author","authors"]),lt=new Set(["work","cover","staff","assign","do","run","schedul","roster","book","duty","serv","help"]);function je(o){let i=o.toLowerCase().replace(/'s$/,"");for(let y of["ing","ed","es","s"])if(i.length>y.length+2&&i.endsWith(y)){let f=i.slice(0,-y.length);return f.length>3&&f[f.length-1]===f[f.length-2]?f.slice(0,-1):f}return i}function ct(o){return o.toLowerCase().split(/[^a-z']+/).filter(i=>i.length>1&&!te.has(i)&&!Ce.has(i)&&!["it","they","them","their","its","this","here","to","at"].includes(i)).map(je)}var Lt=(o,i)=>o===i||o.length>=4&&i.length>=4&&(o.startsWith(i)||i.startsWith(o)),ne=new Set(["done","finished","complete","completed","closed","resolved","agreed","canceled","archived","shipped","delivered"]),Pt=new Set(["open","unfinished","outstanding","pending","remaining","undone","incomplete"]);function ut(o,i){return V(o,i.kind).filters.some(f=>f.about==="field"&&(f.type==="boolean"&&ne.has(f.key.toLowerCase())&&i[f.key]===!0||f.type==="choice"&&typeof i[f.key]=="string"&&ne.has(String(i[f.key]).toLowerCase())))}function fe(o){return o.length<=1?o[0]??"":`${o.slice(0,-1).join(", ")} and ${o[o.length-1]}`}function zt(o,i,y={}){let f=y.scene!==void 0?{...y.pages,scene:y.scene}:y.pages;return[...nt(o,i,f?{pages:f}:{})].map(({first:c,hidden:p,lens:k,...j})=>j)}function gt(o,i){return{...o.principal?{principal:o.principal}:{},...o.places?{places:o.places}:{},...o.selection?{selection:o.selection}:{},...o.place?{place:o.place}:{},...i??o.today?{today:i??o.today}:{},...o.weekStartsOn!==void 0?{weekStartsOn:o.weekStartsOn}:{}}}function Jt(o,i,y,f){let c=ht(o,i,gt(y,f));if(c.unresolved)return c.say?{reply:{say:c.say,proposals:[],grounded:!0}}:{};if(c.about==="picks")return{};let p=c.moves.length>0?{moves:c.moves}:{},k=c.subject?o.graph.getNode(c.subject):void 0;if(c.about==="problems")return{...p,problems:!0};if(k&&(c.about==="describe"||c.about==="here"))return{...p,told:k.id};let j=k?tt(o,ot(Ve(o.violations(),[k.id])).slice(0,3)):[];return{reply:{say:c.say,proposals:j,grounded:!0,...p,...c.picks&&c.picks.length>0?{picks:c.picks}:{},...c.offer?{offer:c.offer}:{}}}}function Yt(o,i,y={}){let f=gt(y),c=[];for(let p of i){let k=typeof p=="string"?p:typeof p=="object"&&p!==null&&typeof p.to=="string"?p.to:void 0;if(!k||k.trim().length===0)continue;let j=ht(o,/^(?:go|take me|open|show)\b/i.test(k.trim())?k:`go to ${k}`,f);if("moves"in j)for(let J of j.moves)c.some(B=>B.address===J.address)||c.push(J)}return c}export{At as NOTHING_BY_THAT_NAME,gt as askContextOf,Jt as goingFrom,Yt as movesFromNames,zt as placesFromViews,ht as resolveAsk};
|
|
1
|
+
import{a as ot}from"./chunk.MX3Y3LPH.js";import"./chunk.2VJ52LGS.js";import{e as V,l as ue,m as G,q as st}from"./chunk.JI2UVZUU.js";import{a as ee}from"./chunk.G4JJXA63.js";import"./chunk.3H7YIKKC.js";import{b as nt}from"./chunk.ET3XJDPX.js";import{d as tt}from"./chunk.3MU37W5D.js";import"./chunk.XOZU4OFA.js";import"./chunk.Z7N3MJ36.js";import"./chunk.HVX7LFWR.js";import"./chunk.VICCAWAN.js";import{d as et}from"./chunk.OU5TRY4N.js";import{c as Ze}from"./chunk.CQPNDJAC.js";import{I as ze,V as Je,da as Ye,ha as qe,la as Ae,lb as Ve,ma as F,mb as Qe,od as Ne,pd as Xe}from"./chunk.P4CLT32V.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";var At="Nothing by that name here.",$=o=>o.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[’']/g,"'").replace(/[^\p{L}\p{N}' ]+/gu," ").replace(/\s+/g," ").trim(),Nt=/^(?:(?:can you |could you |please )?(?:go|take me|bring me|head|jump|navigate|switch|get me)(?: back)? to|(?:please )?(?:open|show(?: me)?|bring up|let me see|view)) (.+)$/,St=/^(?:(?:can you |could you |please )?tell me (?:about|of)|what(?: is|'s| are) (?:in |on )?|describe|explain|who(?: is|'s)) (.+)$/,Ot=/^(?:what(?: is|'s| am i looking at| do i see)(?: (?:here|this|on (?:this|the) (?:page|screen)|in view|this place|this page))?|where am i|describe (?:this|here|this place|this page)|tell me about (?:this|here|this place|this page))$/,rt=new Set(["here","this","this place","this page","on this page","on the page","on this screen","in view"]),Ct=/^(?:date|day|when|on|at|the date|the day)$/,jt=/^(?:what(?: is|'s) (?:wrong|broken|the (?:problem|matter|trouble))|what needs (?:fixing|attention|doing)|any (?:problems|issues|trouble)|(?:show(?: me)? |go to |open )?(?:the )?(?:problems|issues|trouble|standing|what's wrong)|is (?:anything|something) (?:wrong|broken)|are there (?:any )?(?:problems|issues))(?: (?:with|about|on|in) (.+))?$/,z=o=>o.replace(/^(?:the|a|an|my|our) /,""),te=new Set(["the","a","an","my","our","all","any","of","that","which","who","are","is","be","what","whats","what's","with","me","show","list","every","there","do","i","have","we","due","for","please","were","was","by","from","in","on"]),ft=864e5,he=o=>Date.UTC(Number(o.slice(0,4)),Number(o.slice(5,7))-1,Number(o.slice(8,10))),xe=o=>new Date(o).toISOString().slice(0,10),C=(o,i)=>xe(he(o)+i*ft),xt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Mt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Wt="(monday|tuesday|tues|wednesday|thursday|thurs|friday|saturday|sunday)",it="(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sept|sep|oct|nov|dec)",at="(\\d{1,2})(?:st|nd|rd|th)?",Dt=o=>xt.findIndex(i=>i.startsWith(o.slice(0,3))),dt=o=>Mt.findIndex(i=>o.startsWith(i.toLowerCase()));function Rt(o,i){return Je(o,{year:o.slice(0,4)!==i.slice(0,4)})}function Se(o,i,y){if(o<0||i<1||i>31)return;let f=Number(y.slice(0,4)),c=k=>{let j=Date.UTC(k,o,i);return new Date(j).getUTCMonth()===o?xe(j):void 0},p=c(f);if(p)return he(p)<he(y)-183*ft?c(f+1):p}function Oe(o,i,y){let f=new Date(he(i)).getUTCDay(),c=u=>{let S=(f-y+7)%7,w=C(i,-S+u*7);return{from:w,to:C(w,6)}},p=()=>{let u=`${i.slice(0,8)}01`,S=new Date(Date.UTC(Number(i.slice(0,4)),Number(i.slice(5,7)),1));return{from:u,to:C(xe(S.getTime()),-1)}},k=u=>u?{from:u,to:u,day:Rt(u,i)}:void 0,j=(u,S)=>{let w=Dt(S);return k(u==="this"||u==="next"?C(c(u==="next"?1:0).from,(w-y+7)%7):u==="last"?C(i,-((f-w+6)%7+1)):C(i,(w-f+7)%7))},J=u=>{let S=C(i,f===0?-1:6-f);return{from:C(S,u*7),to:C(S,u*7+1)}},B="\\b(?:(?:due |for |on |by )(?:the )?)?",P=[[/\b(?:overdue|past due|late)\b/,()=>({overdue:!0,to:C(i,-1)})],[/\b(?:due |for |on )?today\b/,()=>({from:i,to:i})],[/\b(?:due |for |on )?tomorrow\b/,()=>k(C(i,1))],[/\b(?:due |for |on )?yesterday\b/,()=>k(C(i,-1))],[/\b(?:due |for |on )?this week\b/,()=>c(0)],[/\b(?:due |for |on )?next week\b/,()=>c(1)],[/\b(?:due |for |on )?(?:last|previous) week\b/,()=>c(-1)],[/\b(?:due |for |on )?next weekend\b/,()=>J(1)],[/\b(?:due |for |on )?(?:this |the )?weekend\b/,()=>J(0)],[/\b(?:due |for |on )?this month\b/,()=>p()],[new RegExp(`${B}(\\d{4}) (\\d{2}) (\\d{2})\\b`),u=>k(Se(Number(u[2])-1,Number(u[3]),`${u[1]}-01-01`))],[new RegExp(`${B}${at} (?:of )?${it}\\b`),u=>k(Se(dt(u[2]),Number(u[1]),i))],[new RegExp(`${B}${it} (?:the )?${at}\\b`),u=>k(Se(dt(u[1]),Number(u[2]),i))],[new RegExp(`${B}(?:(this|next|last|coming) )?${Wt}\\b`),u=>j(u[1],u[2])]];for(let[u,S]of P){let w=o.match(u);if(!w)continue;let N=S(w);if(N)return{ask:{words:w[0],...N},rest:o.replace(w[0]," ").replace(/\s+/g," ").trim()}}}function ht(o,i,y={}){let f=y.principal??{kind:"human"},c=o.seenBy(f),p=c.schema,k=y.today??o.today?.()??ze(),j=y.weekStartsOn??1,J=o.kindsKeptFrom(f),B=o.modules.disabledKinds,P=p.kinds.filter(e=>!J.has(e)&&!B.has(e)),u=new Set(P),S=(y.places??[]).filter(e=>e.kind===null||u.has(e.kind)),w=c.graph,N=$(i).replace(/[?.!]+$/,"").trim();if(N.length===0)return{unresolved:!0};let M=e=>p.tryDefinition(e),H=e=>Ye(M(e.kind),e),I=e=>qe(p,e),se=e=>S.find(t=>t.kind===e&&t.address===Ne(p,e))?.address??Ne(p,e),ge=e=>Xe(p,e.kind,e.id),Me=e=>({to:"record",id:e.id,kind:e.kind,label:H(e),address:ge(e),said:`Went to ${H(e)}.`}),We=e=>{let t=`Went to ${e.title}.`;return e.kind===null?{to:"place",slug:e.slug,title:e.title,address:e.address,...e.slug==="overview"?{face:"scene"}:{},said:t}:e.lens||e.address.startsWith("/places/")?{to:"picture",kind:e.kind,as:e.slug,title:e.title,address:e.address,said:t}:{to:"kind",kind:e.kind,title:e.title,address:e.address,said:t}},De=()=>({unresolved:!0,say:At}),oe=e=>{let t=M(e.kind),s=et(e,t,{limit:3,excerpt:!0}).map(r=>r.alone.startsWith(r.label)?r.alone:`${r.label.toLowerCase()} ${r.alone}`).join(", "),n=c.violations().filter(r=>r.nodeIds.includes(e.id));return[`${H(e)} \u2014 ${Ae(F(t,e.kind))}${s?` (${s})`:""}.`,n.length>0?`Trouble: ${n.map(r=>r.message).join("; ")}.`:""].filter(Boolean).join(" ")},re=e=>{let t=new Set([G(e),G(z(e))]);for(let n of[" page"," view"," lens"," place"," picture"," list"])e.endsWith(n)&&(t.add(G(e.slice(0,-n.length))),t.add(G(z(e.slice(0,-n.length)))));t.delete("");let s=n=>t.has(G(n.title))||t.has(G(z($(n.title))))||t.has(G(n.slug));return S.find(n=>n.kind!==null&&n.address.startsWith("/places/")&&s(n))??S.find(s)},pe=e=>{let t=st(o,e,{principal:f,today:k,limit:6,near:!1,...y.selection?{from:y.selection}:{}}),s=t.hits.filter(r=>r.about==="node"&&u.has(r.kind)&&w.getNode(r.id)!==void 0),n=s.filter(r=>r.why.field==="label"&&r.why.strength==="exact");return n.length===1?{one:w.getNode(n[0].id),picks:s}:n.length>1?{picks:n}:s.length===1&&t.total===1?{one:w.getNode(s[0].id),picks:s}:{picks:s}},Re=e=>{let t=e.map(s=>`${s.label} (${F(M(s.kind),s.kind)})`);return`${e.length===1?"One thing matches":`${e.length} things match`}: ${t.join("; ")}.`},Ee=(e,t)=>{if(rt.has(e))return Le();let s=t?pe(z(e)||e):void 0,n=s?.one&&$(H(s.one))===$(z(e)||e)?void 0:re(e);if(n){let l=We(n);return{about:"place",say:t?`${l.said} ${me(n)}`:l.said,moves:[l],subject:n.slug}}let r=pe(z(e)||e);if(r.one){let l=Me(r.one);return{about:t?"describe":"record",say:t?`${l.said} ${oe(r.one)}`:l.said,moves:[l],subject:r.one.id}}if(r.picks.length>0)return{about:"picks",say:Re(r.picks),moves:[],picks:r.picks};let h=ae(e);if(h)return h;let d=Pe(e);if(d){if(d.rest.split(" ").every(l=>l===""||te.has(l))){let l=I(d.kind),v={to:"kind",kind:d.kind,title:l,address:se(d.kind),said:`Went to the ${l.toLowerCase()}.`};return{about:"kind",say:v.said,moves:[v]}}return{unresolved:!0}}return De()},me=e=>{if(e.kind===null){let h=P.map(l=>({kind:l,count:w.nodesOfKind(l).length})).filter(l=>l.count>0).map(l=>`${l.count} ${(l.count===1?F(M(l.kind),l.kind):I(l.kind)).toLowerCase()}`),d=c.violations().length;return[h.length>0?`It holds ${fe(h)}.`:"It holds nothing yet.",d>0?`${d===1?"One problem":`${d} problems`} to see to.`:""].filter(Boolean).join(" ")}let t=w.nodesOfKind(e.kind).length,s=I(e.kind).toLowerCase(),n=new Set(c.violations().flatMap(h=>h.nodeIds)),r=w.nodesOfKind(e.kind).filter(h=>n.has(h.id)).length;return[e.lens?`It draws the ${s} as ${Ae(e.lens)}${t>0?` \u2014 ${t} of them`:""}.`:`${t===0?"No":t} ${t===1?F(M(e.kind),e.kind):s} ${t===1?"is":"are"} here.`,r>0?`${r} ${r===1?"has":"have"} a problem.`:""].filter(Boolean).join(" ")},Le=()=>{let e=(y.selection??[]).map(s=>w.getNode(s)).find(s=>s!==void 0);if(e)return{about:"here",say:oe(e),moves:[],subject:e.id};let t=S.find(s=>s.slug===y.place)??S.find(s=>s.slug==="home");return t?{about:"here",say:`${t.title}. ${me(t)}`,moves:[],subject:t.slug}:{about:"here",say:me({slug:"home",title:"Home",kind:null,cardinality:"many",address:"/",stop:"#"}),moves:[]}},Pe=e=>{let t=P.flatMap(s=>[I(s),F(M(s),s),s].map(n=>({kind:s,name:$(n)}))).filter(s=>s.name.length>0).sort((s,n)=>n.name.length-s.name.length);for(let{kind:s,name:n}of t)if(!(` ${e} `.indexOf(` ${n} `)<0))return{kind:s,rest:` ${e} `.replace(` ${n} `," ").replace(/\s+/g," ").trim()}},ie=(e,t)=>{let s=V(p,e).filters.filter(d=>d.about==="field"&&d.type==="date");if(s.length===0)return;let n=s.find(d=>t.some(l=>$(d.key)===l||$(d.label)===l));if(n)return n;let r=M(e)?.fieldRoles??{};for(let d of["due","deadline","date","when","start","end"]){let l=r[d],v=l?s.find(x=>x.key===l):void 0;if(v)return v}return s.find(d=>["due","deadline","date","when","on","at"].includes(d.key.toLowerCase()))??(s.length===1?s[0]:void 0)},He=e=>{let t=M(e),s=V(p,e).filters;if(t?.lifecycle)return{conditions:[{key:"is",value:"current"}],holds:d=>ue(be,d,{key:"is",value:"current"})};let r=s.find(d=>d.about==="field"&&d.type==="boolean"&&ne.has($(d.key)));if(r)return{conditions:[{key:r.key,value:"false"}],holds:d=>d[r.key]!==!0};let h=s.find(d=>d.about==="field"&&d.type==="choice"&&(d.options??[]).some(l=>ne.has($(l))));if(h){let d=new Set((h.options??[]).filter(v=>ne.has($(v)))),l=(h.options??[]).filter(v=>!d.has(v));return l.length===1?{conditions:[{key:h.key,value:l[0]}],holds:v=>v[h.key]===l[0]}:"unsayable"}return{conditions:[],holds:()=>!0}},Ie=(e,t)=>{let s=e.words.startsWith("due")||$(t.key)==="due",n=Ct.test($(t.label));if(e.day)return s?`due ${e.day}`:n?`on ${e.day}`:`${t.label.toLowerCase()} on ${e.day}`;let r=e.words.replace(/^(?:due|for|on|by) (?:the )?/,"");return s?`due ${r}`:n?r:`${t.label.toLowerCase()} ${r}`},ye=new Set(c.violations().flatMap(e=>e.nodeIds)),be={schema:p,graph:c.graph,flagged:ye,today:k},ae=e=>{let t=Oe(e,k,j),s=Pe(t?.rest??e),n=s?.kind,r=(s?.rest??t?.rest??e).split(" ").filter(Boolean);if(!n&&t){let g=e.split(" "),m=P.filter(L=>ie(L,g)!==void 0),E=m.filter(L=>{let b=ie(L,g);return g.some(O=>$(b.key)===O||$(b.label)===O)}),U=m.length===1?m:E;if(U.length!==1)return;n=U[0]}if(!n)return;let h=V(p,n).filters,d=[],l=[],v=[],x=[],q=!1,de=[];for(let g=0;g<r.length;g++){let m=r[g],E=g>0&&(r[g-1]==="not"||r[g-1]==="un"),U=h.find(b=>b.about==="field"&&b.type==="choice"&&(b.options??[]).some(O=>$(O)===m));if(U&&!E){let b=(U.options??[]).find(O=>$(O)===m);d.push({key:U.key,value:b}),l.push(b);continue}let L=h.find(b=>b.about==="field"&&b.type==="boolean"&&[$(b.key),$(b.label)].some(O=>O===m||O===m.replace(/^un/,"")));if(L){let b=!E&&!(m.startsWith("un")&&!$(L.key).startsWith("un"));d.push({key:L.key,value:String(b)}),l.push(b?m:`not ${m.replace(/^un/,"")}`);continue}if(Pt.has(m)&&!E){let b=He(n);b==="unsayable"?(q=!0,x.push(O=>!ut(p,O))):(d.push(...b.conditions),x.push(b.holds)),l.push(m);continue}m==="not"||m==="un"||t&&h.some(b=>b.type==="date"&&($(b.key)===m||$(b.label)===m))||de.push(m)}if(r=de,r.some(g=>!te.has(g))||!t&&d.length===0&&x.length===0)return;let T=I(n).toLowerCase(),Q=I(n);if(t){let g=ie(n,e.split(" "));if(!g){let m={to:"kind",kind:n,title:Q,address:se(n),said:`Went to the ${T}.`};return{about:"kind",say:`${ee(Q)} carry no date, so I can't tell which are ${/^(?:due|for|on|overdue|past due|late)\b/.test(t.ask.words)?t.ask.words:`due ${t.ask.words}`}. ${m.said}`,moves:[m]}}if(t.ask.from&&d.push({key:g.key,value:`after:${C(t.ask.from,-1)}`}),t.ask.to&&d.push({key:g.key,value:`before:${C(t.ask.to,1)}`}),t.ask.overdue){let m=He(n);m==="unsayable"?(q=!0,x.push(E=>!ut(p,E))):(d.push(...m.conditions),x.push(m.holds))}t.ask.overdue?l.push("overdue"):v.push(Ie(t.ask,g))}let R=w.nodesOfKind(n).filter(g=>d.every(m=>ue(be,g,m))&&x.every(m=>m(g))),K=[...l,...v].join(" and "),Y=[...l,T,...v].join(" "),W=R.slice(0,6).map(g=>({about:"node",id:g.id,kind:n,label:H(g),why:{field:d[0]?.key??"label",reading:d[0]?.key??"Name",fragment:K,strength:"field"},current:!0,flagged:ye.has(g.id),address:ge(g)})),X=R.length===0?`No ${T} are ${K}.`:`${R.length===1?`One ${F(M(n),n)} is`:`${R.length} ${T} are`} ${K}: ${fe(R.slice(0,6).map(H))}${R.length>6?`, and ${R.length-6} more`:""}.`;if(q)return{about:"kind",say:X,moves:[],picks:W,offer:{draft:Y,label:"Show as a view"}};let Z=d.map(g=>`${g.key}:${g.value}`).join(","),we=`${se(n)}?${new URLSearchParams({filter:Z}).toString()}`,_={to:"kind",kind:n,title:ee(Y),filter:Z,address:we,said:`Went to the ${Y}.`};return{about:"kind",say:`${_.said} ${X}`,moves:[_],picks:W}},Te=e=>M(e)?.figure==="person"?!0:[e,F(M(e),e),I(e)].some(s=>$(s).split(" ").some(n=>Et.has(n))),pt=e=>{let t=[],s=n=>M(n)?.edges??{};for(let[n,r]of Object.entries(s(e)))for(let h of r.to??[])u.has(h)&&t.push({key:n,direction:"out",far:h,words:ct(`${r.description??""} ${n}`)});for(let n of P)for(let[r,h]of Object.entries(s(n)))(h.to??[]).includes(e)&&t.push({key:r,direction:"in",far:n,words:ct(`${h.inverse??""} ${r}`)});return t},mt=e=>{let t=e.match(/^(who|which|what)\b/)?.[1];if(!t)return;let s=Oe(e,k,j);if(!s||s.ask.overdue)return;let n=s.rest.split(" ").filter(Boolean),r=P.flatMap(a=>[I(a),F(M(a),a),a].map(A=>({kind:a,name:$(A)}))).filter(a=>a.name.length>0).sort((a,A)=>A.name.length-a.name.length),h=` ${n.join(" ")} `,d=[];for(let{kind:a,name:A}of r)h.includes(` ${A} `)&&(h=h.replace(` ${A} `," "),d.includes(a)||d.push(a));let l=h.match(/\b(?:is|are|was|were)\b|'s\b/)?.[0],v=h.replace(/'s\b/g," ").split(" ").filter(a=>a.length>0&&!te.has(a)&&!Ce.has(a)),x=t==="who"?d.find(Te):d[0];if(!x&&t!=="who")return;let q=d.find(a=>a!==x),de=v.flatMap(a=>[je(a),...lt.has(je(a))?[...lt]:[]]),T=P.filter(a=>q?a===q:a!==x).flatMap(a=>{let A=ie(a,e.split(" "))??V(p,a).filters.find(D=>D.about==="field"&&D.type==="date");return A?pt(a).filter(D=>(x?D.far===x:Te(D.far))&&D.far!==a).map(D=>({kind:a,field:A,relation:D,said:v.length===0||de.some(ve=>D.words.some(vt=>Lt(vt,ve)))})):[]}).filter(a=>a.said);if(T.length===0)return;let Q=T.filter(a=>n.some(A=>$(a.field.key)===A||$(a.field.label)===A)),R=T.length===1?T[0]:Q.length===1?Q[0]:void 0;if(!R)return;let{kind:K,field:Y,relation:W}=R,X=[...s.ask.from?[{key:Y.key,value:`after:${C(s.ask.from,-1)}`}]:[],...s.ask.to?[{key:Y.key,value:`before:${C(s.ask.to,1)}`}]:[]],Z=w.nodesOfKind(K).filter(a=>X.every(A=>ue(be,a,A))),we=a=>(W.direction==="out"?c.graph.out(a.id,W.key):c.graph.in(a.id,W.key)).filter(A=>A.kind===W.far&&u.has(W.far)),_=[],g=[];for(let a of Z){let A=we(a);A.length===0&&g.push(a);for(let D of A)_.some(ve=>ve.id===D.id)||_.push(D)}let m=Ie(s.ask,Y),E=s.ask.day?`On ${s.ask.day}`:ee(s.ask.words.replace(/^(?:due|for|on|by) (?:the )?/,"")),U=I(K).toLowerCase(),L=X.map(a=>`${a.key}:${a.value}`).join(","),b=`${U} ${m}`,O={to:"kind",kind:K,title:ee(b),filter:L,address:`${se(K)}?${new URLSearchParams({filter:L}).toString()}`,said:`Went to the ${b}.`};if(Z.length===0)return{about:"related",say:`No ${b}. ${O.said}`,moves:[O]};let le=v.join(" "),yt=l==="was"||l==="were",Ge=a=>yt?a===1?"was":"were":a===1?"is":"are",ce=_.map(H),bt=ce.length>8?[...ce.slice(0,8),`${ce.length-8} more`]:ce,kt=_.length===0?`${E}: nobody ${Ge(1)}${le?` ${le}`:""}.`:`${E}: ${fe(bt)}${le?` ${Ge(_.length)} ${le}`:""}.`,$t=t==="who"&&g.length>0?`${fe(g.slice(0,4).map(H))}${g.length>4?` and ${g.length-4} more`:""} ${g.length===1?"has":"have"} nobody.`:"",wt=_.slice(0,8).map(a=>({about:"node",id:a.id,kind:a.kind,label:H(a),why:{field:W.key,reading:Ze(p,W.direction==="out"?K:W.far,W.key,W.direction==="out"?"out":"in"),fragment:m,strength:"field"},current:!0,flagged:ye.has(a.id),address:ge(a)}));return{about:"related",say:[kt,$t,O.said].filter(Boolean).join(" "),moves:[O],picks:wt}},Ke=N.match(jt);if(Ke){let e=Ke[1];if(e&&!rt.has(e)&&!/^(?:it|this|that)$/.test(e)){let n=re(e),r=n?void 0:pe(z(e)||e);if(r?.one){let h=Me(r.one);return{about:"describe",say:`${h.said} ${oe(r.one)}`,moves:[h],subject:r.one.id}}if(!n)return r&&r.picks.length>0?{about:"picks",say:Re(r.picks),moves:[],picks:r.picks}:De()}if(e&&/^(?:it|this|that)$|^(?:here|this place|this page)$/.test(e)){let n=(y.selection??[]).map(r=>w.getNode(r)).find(r=>r!==void 0);if(n)return{about:"describe",say:oe(n),moves:[],subject:n.id}}let t=c.violations();if(t.length===0)return{about:"problems",say:"Nothing is wrong \u2014 every rule holds.",moves:[]};let s={to:"problems",address:"/problems",said:"Went to the problems."};return{about:"problems",say:`${s.said} ${Qe(t)}: ${t.slice(0,4).map(n=>n.message).join("; ")}${t.length>4?"\u2026":"."}`,moves:[s]}}if(Ot.test(N))return Le();let _e=mt(N);if(_e)return _e;let ke=Oe(N,k,j);if(ke&&!re(z(ke.ask.words))&&ke.rest.replace(/'s\b/g,"").split(" ").every(e=>e===""||te.has(e)||Ce.has(e))){let e=ae(N);if(e)return e}if(/^open /.test(N)){let e=ae(N);if(e)return e}let Fe=N.match(Nt)??N.match(/^(?:go|take me|head|get me)(?: back)? (home)$/);if(Fe)return Ee(Fe[1].trim(),!1);let Be=N.match(St);if(Be){let e=Ee(Be[1].trim(),!0);return"unresolved"in e&&e.unresolved&&!/^tell me|^describe/.test(N)?{unresolved:!0}:e}let $e=re(N);if($e){let e=We($e);return{about:"place",say:e.said,moves:[e],subject:$e.slug}}let Ue=ae(N);return Ue||{unresolved:!0}}var Ce=new Set(["who","whom","whose","which","what","whats","what's","who's"]),Et=new Set(["person","people","user","users","member","members","volunteer","volunteers","gardener","gardeners","player","players","staff","worker","workers","employee","employees","owner","owners","assignee","assignees","helper","helpers","student","students","teacher","teachers","customer","customers","client","clients","contact","contacts","author","authors"]),lt=new Set(["work","cover","staff","assign","do","run","schedul","roster","book","duty","serv","help"]);function je(o){let i=o.toLowerCase().replace(/'s$/,"");for(let y of["ing","ed","es","s"])if(i.length>y.length+2&&i.endsWith(y)){let f=i.slice(0,-y.length);return f.length>3&&f[f.length-1]===f[f.length-2]?f.slice(0,-1):f}return i}function ct(o){return o.toLowerCase().split(/[^a-z']+/).filter(i=>i.length>1&&!te.has(i)&&!Ce.has(i)&&!["it","they","them","their","its","this","here","to","at"].includes(i)).map(je)}var Lt=(o,i)=>o===i||o.length>=4&&i.length>=4&&(o.startsWith(i)||i.startsWith(o)),ne=new Set(["done","finished","complete","completed","closed","resolved","agreed","canceled","archived","shipped","delivered"]),Pt=new Set(["open","unfinished","outstanding","pending","remaining","undone","incomplete"]);function ut(o,i){return V(o,i.kind).filters.some(f=>f.about==="field"&&(f.type==="boolean"&&ne.has(f.key.toLowerCase())&&i[f.key]===!0||f.type==="choice"&&typeof i[f.key]=="string"&&ne.has(String(i[f.key]).toLowerCase())))}function fe(o){return o.length<=1?o[0]??"":`${o.slice(0,-1).join(", ")} and ${o[o.length-1]}`}function zt(o,i,y={}){let f=y.scene!==void 0?{...y.pages,scene:y.scene}:y.pages;return[...nt(o,i,f?{pages:f}:{})].map(({first:c,hidden:p,lens:k,...j})=>j)}function gt(o,i){return{...o.principal?{principal:o.principal}:{},...o.places?{places:o.places}:{},...o.selection?{selection:o.selection}:{},...o.place?{place:o.place}:{},...i??o.today?{today:i??o.today}:{},...o.weekStartsOn!==void 0?{weekStartsOn:o.weekStartsOn}:{}}}function Jt(o,i,y,f){let c=ht(o,i,gt(y,f));if(c.unresolved)return c.say?{reply:{say:c.say,proposals:[],grounded:!0}}:{};if(c.about==="picks")return{};let p=c.moves.length>0?{moves:c.moves}:{},k=c.subject?o.graph.getNode(c.subject):void 0;if(c.about==="problems")return{...p,problems:!0};if(k&&(c.about==="describe"||c.about==="here"))return{...p,told:k.id};let j=k?tt(o,ot(Ve(o.violations(),[k.id])).slice(0,3)):[];return{reply:{say:c.say,proposals:j,grounded:!0,...p,...c.picks&&c.picks.length>0?{picks:c.picks}:{},...c.offer?{offer:c.offer}:{}}}}function Yt(o,i,y={}){let f=gt(y),c=[];for(let p of i){let k=typeof p=="string"?p:typeof p=="object"&&p!==null&&typeof p.to=="string"?p.to:void 0;if(!k||k.trim().length===0)continue;let j=ht(o,/^(?:go|take me|open|show)\b/i.test(k.trim())?k:`go to ${k}`,f);if("moves"in j)for(let J of j.moves)c.some(B=>B.address===J.address)||c.push(J)}return c}export{At as NOTHING_BY_THAT_NAME,gt as askContextOf,Jt as goingFrom,Yt as movesFromNames,zt as placesFromViews,ht as resolveAsk};
|
package/dist/preview/index.html
CHANGED
|
@@ -5,67 +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.
|
|
8
|
+
<link rel="modulepreload" href="/chunk.353CGK6C.js">
|
|
9
|
+
<link rel="modulepreload" href="/chunk.WQLAIEWJ.js">
|
|
10
|
+
<link rel="modulepreload" href="/chunk.4N5R4K6O.js">
|
|
11
|
+
<link rel="modulepreload" href="/chunk.KK46XLGU.js">
|
|
12
12
|
<link rel="modulepreload" href="/chunk.Q5WEOX3Q.js">
|
|
13
|
-
<link rel="modulepreload" href="/chunk.
|
|
14
|
-
<link rel="modulepreload" href="/chunk.
|
|
15
|
-
<link rel="modulepreload" href="/chunk.
|
|
16
|
-
<link rel="modulepreload" href="/chunk.
|
|
13
|
+
<link rel="modulepreload" href="/chunk.76QSPWSJ.js">
|
|
14
|
+
<link rel="modulepreload" href="/chunk.FKJ3HIA5.js">
|
|
15
|
+
<link rel="modulepreload" href="/chunk.GYTVL6GR.js">
|
|
16
|
+
<link rel="modulepreload" href="/chunk.TMYGLXR6.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.P4CLT32V.js">
|
|
19
|
+
<link rel="modulepreload" href="/chunk.SLBWPVIY.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.
|
|
26
|
-
<link rel="modulepreload" href="/chunk.
|
|
21
|
+
<link rel="modulepreload" href="/chunk.Y2ZBVWII.js">
|
|
22
|
+
<link rel="modulepreload" href="/chunk.JG2FGZF2.js">
|
|
23
|
+
<link rel="modulepreload" href="/chunk.IE4ZJQV3.js">
|
|
24
|
+
<link rel="modulepreload" href="/chunk.TVWN5I4M.js">
|
|
25
|
+
<link rel="modulepreload" href="/chunk.B7LBG4UP.js">
|
|
26
|
+
<link rel="modulepreload" href="/chunk.7G4M2PX3.js">
|
|
27
27
|
<link rel="modulepreload" href="/chunk.UGFDSE37.js">
|
|
28
|
-
<link rel="modulepreload" href="/chunk.
|
|
29
|
-
<link rel="modulepreload" href="/chunk.GZEZMU2T.js">
|
|
30
|
-
<link rel="modulepreload" href="/chunk.4VJARLJ5.js">
|
|
31
|
-
<link rel="modulepreload" href="/chunk.5RNB6IC5.js">
|
|
32
|
-
<link rel="modulepreload" href="/chunk.ZITDUHX3.js">
|
|
33
|
-
<link rel="modulepreload" href="/chunk.ETWREHXF.js">
|
|
34
|
-
<link rel="modulepreload" href="/chunk.YZ6UKKEL.js">
|
|
28
|
+
<link rel="modulepreload" href="/chunk.NNUUD26E.js">
|
|
35
29
|
<link rel="modulepreload" href="/chunk.PXQVXBNG.js">
|
|
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.
|
|
49
|
-
<link rel="modulepreload" href="/chunk.
|
|
30
|
+
<link rel="modulepreload" href="/chunk.OJ64WTLW.js">
|
|
31
|
+
<link rel="modulepreload" href="/chunk.GMAXA5GV.js">
|
|
32
|
+
<link rel="modulepreload" href="/chunk.IBJBCZKG.js">
|
|
33
|
+
<link rel="modulepreload" href="/chunk.NQ26KMSQ.js">
|
|
34
|
+
<link rel="modulepreload" href="/chunk.GJQF7I22.js">
|
|
35
|
+
<link rel="modulepreload" href="/chunk.SPU3BVAO.js">
|
|
36
|
+
<link rel="modulepreload" href="/chunk.OPCBZNKF.js">
|
|
37
|
+
<link rel="modulepreload" href="/chunk.UK5F3S2N.js">
|
|
38
|
+
<link rel="modulepreload" href="/chunk.2VJ52LGS.js">
|
|
39
|
+
<link rel="modulepreload" href="/chunk.JI2UVZUU.js">
|
|
40
|
+
<link rel="modulepreload" href="/chunk.CTOBNZLM.js">
|
|
41
|
+
<link rel="modulepreload" href="/chunk.34HGT7HQ.js">
|
|
42
|
+
<link rel="modulepreload" href="/chunk.TNL2BVCH.js">
|
|
43
|
+
<link rel="modulepreload" href="/chunk.NZDHXREL.js">
|
|
44
|
+
<link rel="modulepreload" href="/chunk.TBSPEO2L.js">
|
|
45
|
+
<link rel="modulepreload" href="/chunk.5ON3JSAK.js">
|
|
46
|
+
<link rel="modulepreload" href="/chunk.3SBTQ66X.js">
|
|
47
|
+
<link rel="modulepreload" href="/chunk.SSAY4ITS.js">
|
|
48
|
+
<link rel="modulepreload" href="/chunk.3TVAE7LE.js">
|
|
49
|
+
<link rel="modulepreload" href="/chunk.JX2C3HVD.js">
|
|
50
50
|
<link rel="modulepreload" href="/chunk.XOZU4OFA.js">
|
|
51
|
-
<link rel="modulepreload" href="/chunk.
|
|
51
|
+
<link rel="modulepreload" href="/chunk.Z7N3MJ36.js">
|
|
52
52
|
<link rel="modulepreload" href="/chunk.MB7LKKUD.js">
|
|
53
53
|
<link rel="modulepreload" href="/chunk.WVUJXDXZ.js">
|
|
54
|
-
<link rel="modulepreload" href="/chunk.
|
|
55
|
-
<link rel="modulepreload" href="/chunk.
|
|
56
|
-
<link rel="modulepreload" href="/chunk.
|
|
57
|
-
<link rel="modulepreload" href="/chunk.
|
|
58
|
-
<link rel="modulepreload" href="/chunk.
|
|
54
|
+
<link rel="modulepreload" href="/chunk.GLTWLQ6L.js">
|
|
55
|
+
<link rel="modulepreload" href="/chunk.ACB4TD4W.js">
|
|
56
|
+
<link rel="modulepreload" href="/chunk.XCQ7ZPR5.js">
|
|
57
|
+
<link rel="modulepreload" href="/chunk.MY5OXSS7.js">
|
|
58
|
+
<link rel="modulepreload" href="/chunk.NVRK6A7T.js">
|
|
59
59
|
<link rel="modulepreload" href="/chunk.GZHZLJBF.js">
|
|
60
|
-
<link rel="modulepreload" href="/chunk.
|
|
60
|
+
<link rel="modulepreload" href="/chunk.OW72XZF4.js">
|
|
61
61
|
<link rel="modulepreload" href="/chunk.OJGHDWI6.js">
|
|
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
|
-
<link rel="modulepreload" href="/chunk.
|
|
68
|
-
<script>(()=>{const later=["/chunk.
|
|
62
|
+
<link rel="modulepreload" href="/chunk.KRODTMGR.js">
|
|
63
|
+
<link rel="modulepreload" href="/chunk.VICCAWAN.js">
|
|
64
|
+
<link rel="modulepreload" href="/chunk.OU5TRY4N.js">
|
|
65
|
+
<link rel="modulepreload" href="/chunk.CQPNDJAC.js">
|
|
66
|
+
<link rel="modulepreload" href="/chunk.CUB4IAUJ.js">
|
|
67
|
+
<link rel="modulepreload" href="/chunk.BV6HKTHK.js">
|
|
68
|
+
<script>(()=>{const later=["/chunk.AL45OI4A.js","/chunk.MMVCZOEX.js","/chunk.Y5AMZBHA.js","/chunk.HJCQ6I3S.js","/chunk.7GAC7U34.js","/chunk.T3RTFTOZ.js","/chunk.W2DKFQ6R.js","/chunk.3H7YIKKC.js","/chunk.ET3XJDPX.js","/chunk.HVX7LFWR.js","/chunk.Y3LTHEN7.js","/chunk.FYDDFOSD.js","/chunk.2W45NM7Q.js","/chunk.FEIJ7ETK.js","/chunk.LYIHPVDZ.js","/chunk.FU4YSVWX.js","/chunk.TI4OSTQV.js","/chunk.PPZ2TOB5.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>
|
|
69
69
|
<style>html,body{margin:0;height:100%}#graview-app{min-height:100dvh}</style>
|
|
70
70
|
</head>
|
|
71
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 Vt,b as Kn,c as Jn,d as Yn,e as Qn,f as Dt,g as Zn,h as Bt}from"./chunk.YUV7HZYG.js";import{a as Gr}from"./chunk.AXCRFJDL.js";import{a as Wt,b as er,c as tr,d as nr,e as Nt,f as rr,g as or,h as ar,i as ir,j as sr,k as dr,l as cr,m as lr,n as _e}from"./chunk.UEL7FLL7.js";import{b as Xn}from"./chunk.S64LCR23.js";import{a as Et}from"./chunk.Q5WEOX3Q.js";import{a as At,g as Pn}from"./chunk.BJAQRV2R.js";import{k as tt}from"./chunk.KFHXTHIY.js";import{C as qn,H as zn,L as Gn,M as Un,j as zr,k as $n,n as ot,o as In,q as _n,u as jn,z as at}from"./chunk.ZK446PSX.js";import{Aa as Vn,Ba as Dn,Da as Bn,Ea as Ht,G as Mt,Ia as Wn,Ja as Nn,Ma as rt,S as An,X as Rn,a as kn,b as Ct,c as nt,ea as xn,fa as Tn,j as En,m as Lt,ta as Fn,ua as On,va as Cn,wa as Ln,xa as Mn,ya as Hn}from"./chunk.SGMVLKZO.js";import{a as Pe}from"./chunk.SDO3U72B.js";import{$c as gn,Ad as bn,Fd as xt,Gd as Tt,Hd as Ft,Kc as hn,Kd as Sn,Ld as Ot,Zc as yn,ac as Rt,ad as wn,bc as mn,cb as Ie,cd as et,mb as Xe,yb as pn,yd as Se,zd as vn}from"./chunk.BLS2G3CD.js";import"./chunk.EJUZGIQ5.js";import{b as Oe}from"./chunk.AJZBJBMO.js";async function it(e,n={}){let o=e.compiled===void 0||!Kr(e.compiled,e.document)?void 0:Pn(e.compiled,n);if(o?.ok)return o;let{compileDocumentWithoutCheck:a}=await Ur();return a(e.document,n)}var ur,Ur=()=>ur??=(__graviewPreload(import.meta.url,["./chunk.RXJBYP7B.js","./chunk.BJAQRV2R.js","./chunk.GQX57JIE.js","./chunk.QFI4L2HK.js","./chunk.KFHXTHIY.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.6BMCZPT6.js")).catch(e=>{throw ur=void 0,e});function Kr(e,n){let o=typeof e=="object"&&e!==null?e.document:void 0,a=n;if(typeof a=="string")try{a=JSON.parse(a)}catch{return!1}return o!==void 0&&Et(At(o).document)===Et(At(a).document)}var c=Oe(Mt(),1);var dt=Oe(Mt(),1),$t="data-graview-drawn",Jr=200,fr=50,Yr=1e4,st=()=>typeof performance<"u"?performance.now():Date.now();function Qr(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 Zr(e,n){if(e.ownerDocument.fonts?.status==="loading"||On()>0||Hn(n)>0||e.querySelector('[aria-busy="true"]')||Qr(e).some(a=>!a.complete&&a.loading!=="lazy"))return!1;for(let a of e.querySelectorAll("[data-worker-view-place]"))if(!a.querySelector("[data-worker-view][data-worker-view-drawn], [data-worker-view][data-worker-view-failed]"))return!1;return!0}function pr(e){let n=e.querySelector("[data-embed-content]"),o=[...e.querySelectorAll("[data-worker-view]")].map(a=>`${a.offsetWidth}x${a.offsetHeight}`);return`${e.scrollWidth}x${e.scrollHeight}|${n?`${n.scrollWidth}x${n.scrollHeight}`:""}|${o.join(",")}`}function Xr(e,n,o,a){e.removeAttribute($t);let d=e.ownerDocument.defaultView;if(!d)return()=>{};let l=st(),b=l,p=pr(e),w=!1,A,T=typeof MutationObserver>"u"?void 0:new MutationObserver(S=>{S.some($=>!($.target===e&&$.attributeName===$t))&&(b=st())});T?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let v=()=>{w=!0,T?.disconnect(),A!==void 0&&clearTimeout(A)},P=S=>{let $=!1,ne=()=>{$||($=!0,S())};typeof d.requestAnimationFrame=="function"&&d.requestAnimationFrame(()=>setTimeout(ne,0)),setTimeout(ne,100)},L=()=>{if(w)return;let S=pr(e);S!==p&&(p=S,b=st());let $=st();if(Zr(e,a)&&$-b>=Jr||$-l>=Yr){P(()=>{w||(v(),e.setAttribute($t,n),Dn(),o())});return}A=setTimeout(L,fr)};return A=setTimeout(L,fr),v}function mr(e,n,o,a,d){Vn();let l=(0,dt.useRef)({place:o,onDrawn:a});l.current={place:o,onDrawn:a},(0,dt.useLayoutEffect)(()=>{d&&Mn(d);let b=A=>Xr(A,l.current.place.path,()=>l.current.onDrawn?.(l.current.place),d);if(e.current)return b(e.current);let p,w=!1;return queueMicrotask(()=>{!w&&e.current&&(p=b(e.current))}),()=>{w=!0,p?.()}},[n,e,d])}var ge=Oe(Mt(),1),je,eo=Pe(()=>(__graviewPreload(import.meta.url,["./chunk.JYJNRCK5.js","./chunk.KVEDMKUN.js","./chunk.4XOSDCCE.js","./chunk.JLPBXG4P.js","./chunk.U2M4SGUU.js","./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.4SHSEIHT.js"))),hr=()=>eo().then(e=>void(je=e),()=>new Promise(e=>setTimeout(e,2e3)).then(hr)),It=Fn(hr),yr=e=>!!e&&je===void 0;function _t({onReady:e,fetch:n}){return(0,ge.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var to=0;function gr(e){let[n,o]=(0,ge.useState)(()=>je);(0,ge.useEffect)(()=>{if(!e||n)return;let l=!1;return It().then(()=>{l||o(je)}),()=>{l=!0}},[e,n]);let a=(0,ge.useMemo)(()=>to+=1,[e]);return{over:(0,ge.useMemo)(()=>{let l=n??je;if(!e||!l)return;let{source:b,worker:p,...w}=e,A={...w,worker:p??{source:b},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:T=>l.registerWorkerView(T,A)}},[e,n]),n:a}}var br=Oe(Gr(),1),j=Oe(zr(),1);var h=Oe(An(),1);function ct(e,n={}){let o=Ht(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 zt=e=>Promise.all([e,Gn()]).then(([n])=>n),Sr=Pe(()=>(__graviewPreload(import.meta.url,["./chunk.ATWNWPME.js","./chunk.4VJARLJ5.js","./chunk.TL7UGUY4.js","./chunk.ETWREHXF.js","./chunk.YZ6UKKEL.js","./chunk.HJCQ6I3S.js","./chunk.XWLGHTH6.js","./chunk.TY6VILZB.js","./chunk.F5FJHKWV.js","./chunk.3L5USMQD.js","./chunk.GQI53L5P.js","./chunk.LDE5HLTM.js","./chunk.GTUBIJTP.js","./chunk.73BJYIYS.js","./chunk.M5RHVUZ6.js","./chunk.QSZLY62B.js","./chunk.7VX6TBNY.js","./chunk.64TFAR5Z.js","./chunk.5DZR46YG.js","./chunk.L5MDUZLQ.js","./chunk.IDQHSAAQ.js","./chunk.UEL7FLL7.js","./chunk.S64LCR23.js","./chunk.TI4OSTQV.js","./chunk.JJP5OL5E.js","./chunk.GZHZLJBF.js","./chunk.JLR74UFP.js","./chunk.OJGHDWI6.js","./chunk.HG34MT7C.js","./chunk.TT6QBWRA.js","./chunk.UCS3CBT4.js","./chunk.O6SKKF4V.js","./chunk.ZK446PSX.js","./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.KOPRZLJH.js"))),no=Pe(()=>(__graviewPreload(import.meta.url,["./chunk.S7OFTGBQ.js","./chunk.CDZVUCEK.js","./chunk.UDTBFAS5.js","./chunk.QAUZDLDA.js","./chunk.3SY6WWWQ.js","./chunk.UGFDSE37.js","./chunk.ATWNWPME.js","./chunk.GZEZMU2T.js","./chunk.4VJARLJ5.js","./chunk.5RNB6IC5.js","./chunk.ZITDUHX3.js","./chunk.ETWREHXF.js","./chunk.YZ6UKKEL.js","./chunk.PXQVXBNG.js","./chunk.FFPG4PHX.js","./chunk.3L5USMQD.js","./chunk.GTUBIJTP.js","./chunk.DUIKIJKC.js","./chunk.73BJYIYS.js","./chunk.OKQ4JXTW.js","./chunk.M5RHVUZ6.js","./chunk.MRUDTYOL.js","./chunk.OUNLAMBA.js","./chunk.HGP3Q7QX.js","./chunk.QSZLY62B.js","./chunk.7VX6TBNY.js","./chunk.L5MDUZLQ.js","./chunk.IDQHSAAQ.js","./chunk.XOZU4OFA.js","./chunk.CR5MQMOL.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.6SHF6IL5.js","./chunk.MQISKON2.js","./chunk.GQX57JIE.js","./chunk.LJXAZ5TF.js","./chunk.QFI4L2HK.js","./chunk.KFHXTHIY.js","./chunk.GZHZLJBF.js","./chunk.JLR74UFP.js","./chunk.OJGHDWI6.js","./chunk.HG34MT7C.js","./chunk.TT6QBWRA.js","./chunk.UCS3CBT4.js","./chunk.O6SKKF4V.js","./chunk.ZK446PSX.js","./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.Q7UQ5OXA.js"))),ro=Pe(()=>(__graviewPreload(import.meta.url,["./chunk.S7OFTGBQ.js","./chunk.CDZVUCEK.js","./chunk.UDTBFAS5.js","./chunk.QAUZDLDA.js","./chunk.3SY6WWWQ.js","./chunk.UGFDSE37.js","./chunk.ATWNWPME.js","./chunk.GZEZMU2T.js","./chunk.4VJARLJ5.js","./chunk.5RNB6IC5.js","./chunk.ZITDUHX3.js","./chunk.ETWREHXF.js","./chunk.YZ6UKKEL.js","./chunk.PXQVXBNG.js","./chunk.FFPG4PHX.js","./chunk.3L5USMQD.js","./chunk.GTUBIJTP.js","./chunk.DUIKIJKC.js","./chunk.73BJYIYS.js","./chunk.OKQ4JXTW.js","./chunk.M5RHVUZ6.js","./chunk.MRUDTYOL.js","./chunk.OUNLAMBA.js","./chunk.HGP3Q7QX.js","./chunk.QSZLY62B.js","./chunk.7VX6TBNY.js","./chunk.L5MDUZLQ.js","./chunk.IDQHSAAQ.js","./chunk.XOZU4OFA.js","./chunk.CR5MQMOL.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.6SHF6IL5.js","./chunk.MQISKON2.js","./chunk.GQX57JIE.js","./chunk.LJXAZ5TF.js","./chunk.QFI4L2HK.js","./chunk.KFHXTHIY.js","./chunk.GZHZLJBF.js","./chunk.JLR74UFP.js","./chunk.OJGHDWI6.js","./chunk.HG34MT7C.js","./chunk.TT6QBWRA.js","./chunk.UCS3CBT4.js","./chunk.O6SKKF4V.js","./chunk.ZK446PSX.js","./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.OHAWUOUN.js"))),Pr=ct(()=>zt(Sr().then(e=>e.SceneFace)),{what:"This view"}),kr=ct(()=>Sr().then(e=>e.SceneKeeping),{quiet:!0}),Er=ct(()=>zt(no().then(e=>e.PagesContent)),{what:"This page"}),Ar=ct(()=>zt(ro().then(e=>e.PictureFace)),{what:"This picture"}),oo=Pr.Face,ao=kr.Face,io=Er.Face,so=Ar.Face;function Ce(...e){let n=e.length>0?e:["scene","pages","picture"],o=new Set(n.flatMap(Rr));return Promise.all([...[...o].map(a=>a.fetch()),_n()]).then(()=>{},()=>{})}var Rr=e=>e==="pages"?[Er]:e==="picture"?[Ar]:[Pr,kr],xr=e=>Rr(e).every(n=>n.here()),co=150,jt=0;function wr(e,n){if(xr(e))return n();let o=++jt,a=()=>{o===jt&&(jt+=1,n())};Ce(e).then(a),setTimeout(a,co)}var lo=768;function uo(e,n){let o=n!==null&&n>=lo;(0,c.useEffect)(()=>{if(!o||e==="picture")return;let a=e==="pages"?"scene":"pages";if(xr(a))return;let d=globalThis,l=()=>void Ce(a),b=()=>{},p=Bn(()=>{if(d.requestIdleCallback&&d.cancelIdleCallback){let w=d.requestIdleCallback(l,{timeout:4e3});b=()=>d.cancelIdleCallback?.(w)}else{let w=setTimeout(l,1500);b=()=>clearTimeout(w)}});return()=>(p(),b())},[e,o])}function fo({asked:e,shown:n,onDrawn:o}){return(0,c.useLayoutEffect)(()=>o(e,n),[e,n,o]),null}function po({auto:e,scene:n}){return(0,h.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${Nt}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var mo=Ht(Pe(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,h.jsx)(e.StudioPlace,{...n}),{quiet:!0});function Tr(e,n,o,a,d){return Dt(e,Qn(n?nt(n):d??kn,a),o)}function Gt(e){return e&&nt(e).overview?"graview":"scene"}function vr(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 Fr(e){let[,n]=(0,c.useState)(!1),o=(0,c.useCallback)(()=>n(!0),[]),a=(0,c.useRef)(!1);return e.at&&!lt?(0,h.jsx)(_t,{onReady:o,fetch:Ut}):!a.current&&yr(e.draftView)?(0,h.jsx)(_t,{onReady:o,fetch:It}):(a.current=!0,(0,h.jsx)(ho,{...e}))}function ho(e){let{app:n,stop:o,bar:a=!0,standing:d="Everything is in order",principal:l,heading:b=2}=e,{rootRef:p,scope:w,css:A,scheme:T,store:v,presence:P,brand:L,auto:S,height:$}=rr(e),ne=gr(e.draftView),V=tr(e,Un,ne.over),[Z]=(0,c.useState)(Ln),u=e.basePath===void 0?{}:{basePath:e.basePath},[D]=(0,c.useState)(ot),q=e.notices??D,K=m=>xt(m,u),F={...e.routing?{routing:e.routing}:{},...u},[de]=(0,c.useState)(()=>{let m=e.at?.face;if(m)return m;let C=o===void 0&&vr(n,V)?"pages":Gt(o),he=Vt({...F,face:C});return e.face===void 0&&e.onOpening?.(he),he}),[B,O]=(0,c.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&o===void 0&&Kn(F)&&vr(n,V)),Ee=(0,c.useRef)(e.onFace);Ee.current=e.onFace,(0,c.useLayoutEffect)(()=>{B&&(Ee.current?.("pages"),O(!1))},[B]);let k=B?"pages":e.face??de,te=n.schema.kinds,R=e.routing==="address",J=(0,c.useMemo)(()=>e.at?lt.settleAt(e,v.seenBy(l??{kind:"human"}),V.places()):void 0,[]),W=(0,c.useMemo)(()=>Tn(V,n.schema),[V,n.schema]),ce=(0,c.useMemo)(()=>{let m=J?.stop??(R?Jn(e.basePath):void 0)??o;return k==="scene"&&m===void 0&&W===void 0&&(e.path===void 0||qt(e.path))?Bt(void 0):Tr(k,m,te,V.places(),W)},[]),[ve]=(0,c.useState)(k);(0,c.useEffect)(()=>{ve!=="pages"&&xn(V)},[ve,V]);let N=(0,c.useRef)(void 0),z=m=>m===void 0||qt(m)?"/":m;N.current??={path:z(J?.path??(R?k==="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 le=(0,c.useCallback)((m,C)=>{N.current.path=m,I.current?.(m,C)},[]),{at:M,setAt:Ae,steering:Y,steer:X}=dr(N.current.path),H=(0,c.useContext)(Or);H&&(H.pages=()=>N.current.path);let ue=(0,c.useRef)(void 0),fe=(0,c.useCallback)(m=>void(N.current.path=m),[]),re=$n(p),[Q,ze]=(0,c.useState)(!1),Re=e.pagesBelow!==void 0&&re!==null&&re<e.pagesBelow&&(k==="scene"||k==="graview")&&!Q,E=Re?"pages":k,xe=(0,c.useRef)(!1);xe.current=Q&&e.pagesBelow!==void 0&&re!==null&&re<e.pagesBelow&&(k==="scene"||k==="graview"),H&&(H.shown=E);let pe=(0,c.useRef)(k==="graview"?"graview":"scene");(E==="scene"||E==="graview")&&(pe.current=E),(0,c.useState)(()=>{if(!R||typeof window>"u"||E==="pages"||E==="picture")return;let{pathname:m,search:C,hash:he}=window.location;Tt(m,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${K(Se)}${C}${he}`)}),nr(p,E,e.onIntrinsicHeight),uo(E,re);let oe=cr(e.onError,E),Be=lr(e.onReady,E),Te=(0,c.useRef)(e.onFaceDrawn);Te.current=e.onFaceDrawn;let mt=(0,c.useCallback)((m,C)=>{Be(C),Te.current?.(m)},[Be]),[ht,yt]=(0,c.useState)(null),G=V.places(),ee=(0,c.useRef)({shown:E,onFace:e.onFace});ee.current={shown:E,onFace:e.onFace};let U=(0,c.useCallback)((m,C,he)=>{if(R){ue.current?.(m,C,he);return}ee.current.onFace?.(m),I.current?.(m==="pages"?C??N.current.path:Se,"push")},[R]),[We,me]=(0,c.useState)(void 0);(0,c.useEffect)(()=>{E==="pages"&&me(void 0)},[E]);let Ge=(0,c.useRef)(o);(0,c.useEffect)(()=>{Ge.current!==o&&(Ge.current=o,me(void 0))},[o]);let Ne=(0,c.useCallback)(m=>{if(ee.current.shown==="pages"){if(ze(!0),me(m),k==="scene"||k==="graview"){wr(k,()=>{R?window.history.pushState(null,"",`${K(Se)}${m??""}`):I.current?.(Se,"push")});return}wr(pe.current,()=>U(pe.current,void 0,m))}},[R,k,e.basePath,U]),ae=(0,c.useCallback)(m=>{if(ee.current.shown==="pages"){Y.go.current||(N.current.path=m),X(m);return}if(N.current.path=m,Ae(m),xe.current){ze(!1),R?window.history.pushState(null,"",K(m)):I.current?.(m,"push");return}U("pages",m)},[Y,X,Ae,U,R,e.basePath]),Me=V.arrangement?.(),Fe=E==="pages",_=e.hrefOf,ie=_??(R?K:void 0),Ue=(0,c.useMemo)(()=>({open:ae,..._?{href:_}:R?{href:m=>xt(m,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[ae,R,e.basePath,_]);return(0,h.jsxs)("section",{ref:p,className:w,"aria-label":e.label??n.name,"data-graview-embed":E,"data-graview-scheme":T,...Re?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:$,minHeight:S?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,h.jsx)("style",{children:A}),(0,h.jsxs)(Nn.Provider,{value:oe,children:[(0,h.jsx)(or,{rootRef:p,board:q}),(0,h.jsx)(er,{rootRef:p,firstLook:e.firstLook,app:qn(L??{name:n.name},n.schema)}),(0,h.jsx)(_e,{module:"@graview/react",report:oe,content:!0,children:(0,h.jsx)(Cn.Provider,{value:Z,children:(0,h.jsx)(Rn,{store:v,views:V,initialView:ce,scheme:T,...ar(e,P,L),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,h.jsxs)(In.Provider,{value:q,children:[(0,h.jsx)(vo,{face:E,stop:We??o,kinds:te,places:G,opens:W}),H?(0,h.jsx)(yo,{into:H}):null,(0,h.jsx)(go,{rootRef:p,face:k,shown:E,path:M,stop:o,draft:ne.n,onDrawn:e.onDrawn,parts:Z}),R?(0,h.jsx)(Yn,{pagesWere:J?.path,basePath:e.basePath,shown:E,onFace:e.onFace,toggle:ue,kinds:te,places:G,opens:W,landed:fe}):null,a&&E!=="picture"?(0,h.jsx)(_e,{module:"@graview/embed",report:oe,children:(0,h.jsx)(ir,{name:L?.name??n.name,heading:b,named:Wt(a).name!==!1,faces:Wt(a).faces===!1?void 0:{scene:{label:vn(Me),current:!Fe,go:()=>Ne(),reach:()=>void Ce(pe.current)},pages:{label:bn(Me),current:Fe,go:()=>ae(N.current.path),reach:()=>void Ce("pages")}},at:Fe?M:null,without:e.pages?.without(),home:{...ie?.("/")!==void 0?{href:ie("/")}:{},go:()=>ae("/"),current:Fe&&M.split("?")[0]==="/"},reach:{...ie?{href:ie}:{},go:m=>ae(m.path)},standing:d,hostActions:e.hostActions,keeping:Fe?void 0:(0,h.jsx)(bo,{app:n,studio:e.studio,report:oe}),onFind:yt,switch:e.switch})}):null,(0,h.jsx)(jn.Provider,{value:ht,children:(0,h.jsx)(_e,{module:E==="pages"||E==="picture"?"@graview/pages":"@graview/react",report:oe,content:!0,children:(0,h.jsxs)(c.Suspense,{fallback:(0,h.jsx)(po,{auto:S,scene:E!=="pages"&&E!=="picture"}),children:[E==="picture"?(0,h.jsx)(so,{scope:w,store:v,views:V,as:(o?nt(o).within?.view:void 0)??""}):E==="pages"?(0,h.jsx)(io,{store:v,views:V,presence:P,auto:S,brand:L,steering:Y,overview:Ne,scope:w,titleLevel:sr(b),quickAsk:at(e.quickAsk),props:{...e,onNavigate:le,...R?{}:{path:N.current.path}}}):(0,h.jsx)(Wn.Provider,{value:Ue,children:(0,h.jsx)(oo,{address:R,auto:S,scheme:T,scope:w,quickAsk:at(e.quickAsk)})}),(0,h.jsx)(fo,{asked:k,shown:E,onDrawn:mt})]})},E)})]})})})})]})]})}var qt=e=>e.split(/[?#]/)[0]===Se,Or=(0,c.createContext)(null);function yo({into:e}){return e.view=rt().view,null}function go({rootRef:e,face:n,shown:o,path:a,stop:d,draft:l,onDrawn:b,parts:p}){let{view:w}=rt(),A=o==="scene"||o==="graview",T=Ct(w),v={face:n,path:A?Se:o==="picture"?d??"#":a,stop:T};return mr(e,`${o} ${A?T:v.path} ${l}`,v,b,p),null}var lt,wo=Pe(()=>(__graviewPreload(import.meta.url,["./chunk.YUV7HZYG.js","./chunk.ZK446PSX.js","./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.7QW6JYGP.js"))),Ut=()=>wo().then(e=>void(lt=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(o),e()},o=setTimeout(n,1e4);window.addEventListener("online",n)}).then(Ut));function vo({face:e,stop:n,kinds:o,places:a,opens:d}){let{view:l,go:b}=rt(),p=(0,c.useRef)({face:e,stop:n});return(0,c.useLayoutEffect)(()=>{let w=p.current.stop!==n,A=p.current.face!==e,T=p.current.face==="pages";if(p.current={face:e,stop:n},!w&&!A||e==="pages"||e==="picture")return;let v=(w||T)&&n!==void 0?Tr(e,n,o,a):T&&Zn(l)?Dt(e,Bt(d),o):e==="graview"?Lt(l,!0):l.overview?En(Lt(l,!1),zn(l,o)):l;b(v)},[e,n,o,l,b,d]),null}function bo({app:e,studio:n,report:o}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c.Suspense,{fallback:null,children:(0,h.jsx)(ao,{})}),n!==!1?(0,h.jsx)(_e,{module:"@graview/studio",report:o,children:(0,h.jsx)(So,{app:e,studio:n})}):null]})}function So({app:e,studio:n}){let o={app:e,within:"box",...n?{onApply:n.onApply}:{},...n?.landmark?{landmark:n.landmark}:{},...n?.offered!==void 0?{offered:n.offered}:{}},a=n?.place;return a?(0,h.jsx)(a,{...o}):(0,h.jsx)(c.Suspense,{fallback:null,children:(0,h.jsx)(mo,{...o})})}function Po({path:e,stop:n,...o},a){return{...o,app:a.app,at:a.at,...a.remote.presence?{presence:a.remote.presence}:{}}}function Kt(e,n){let o=n.store??n.remote?.store??Xn(n.app,n.seed),a=n.notices??ot(),d=null,l={},b=0,p=n.label,w=n.app,A=Promise.resolve(),T=n.at?.face??n.face,v=T===void 0?void 0:Vt({...n,face:T}),P=v??Gt(n.stop),L=null,S=[],$=u=>{if(L=u,u!==P)return;let D=S;S=[];for(let q of D)q()};function ne(){let[u,D]=(0,c.useState)(v),[q,K]=(0,c.useState)(n.stop),[F,de]=(0,c.useState)(n.path),[B,O]=(0,c.useState)(n.scheme??"auto"),[Ee,k]=(0,c.useState)(n.principal),[te,R]=(0,c.useState)(n.seats),[J,W]=(0,c.useState)(n.quickAsk),[ce,ve]=(0,c.useState)(n.people),[N,z]=(0,c.useState)(n.hostContext),[I,le]=(0,c.useState)(n.brand),[M,Ae]=(0,c.useState)(n.label),[Y,X]=(0,c.useState)(n.hostActions),[H,ue]=(0,c.useState)(void 0),[fe,re]=(0,c.useState)(n.draftView);return d={app:Q=>{ue(Q),de(void 0),K(void 0)},face:D,stop:K,path:de,scheme:O,seat:k,seats:R,quickAsk:W,people:ve,hostContext:z,brand:le,label:Ae,hostActions:X,draft:re},(0,h.jsx)(Or.Provider,{value:l,children:(0,h.jsx)(Fr,{...H?Po(n,H):n,store:o,notices:a,...u!==void 0?{face:u}:{},onOpening:Q=>{P=Q},...q!==void 0?{stop:q}:{},...F!==void 0?{path:F}:{},...Ee?{principal:Ee}:{},...te?{seats:te}:{},...J!==void 0?{quickAsk:J}:{},...ce?{people:ce}:{},...N?{hostContext:N}:{},...I?{brand:I}:{},label:M,hostActions:Y,draftView:fe,scheme:B,onFace:Q=>{P=Q,D(Q)},onSeat:k,onFaceDrawn:$},H?.n??0)})}let V=()=>{let u=l.view?.focusId,D=u?o.graph.getNode(u)?.kind:void 0,q=(l.shown??P)==="scene"||(l.shown??P)==="graview";return{face:P,path:q?Se:l.pages?.()??n.path??"/",stop:l.view?Ct(l.view):n.stop??"#",...D?{kind:D}:{}}},Z=(0,br.createRoot)(e);return(0,j.flushSync)(()=>Z.render((0,h.jsx)(ne,{}))),{get store(){return o},where:V,setApp:(u,D,q)=>{let K="graph"in D?{store:D}:D,F=()=>{let de=V();o=K.store,p=q?.label??(p===w.name?u.name:p),w=u,(0,j.flushSync)(()=>{d?.label(p),d?.app({app:u,remote:K,at:de,n:++b})})};lt?F():A=A.then(Ut).then(F)},setFace:u=>{P=u,(0,j.flushSync)(()=>d?.face(u))},setStop:u=>(0,j.flushSync)(()=>d?.stop(u)),setPath:u=>(0,j.flushSync)(()=>{if(qt(u)){(P==="pages"||P==="picture")&&(P="scene",d?.face("scene"));return}d?.path(u),P!=="pages"&&(P="pages",d?.face("pages"))}),setScheme:u=>(0,j.flushSync)(()=>d?.scheme(u)),setSeat:u=>(0,j.flushSync)(()=>d?.seat(u)),setSeats:u=>(0,j.flushSync)(()=>d?.seats(u)),setQuickAsk:u=>(0,j.flushSync)(()=>d?.quickAsk(u)),setPeople:u=>(0,j.flushSync)(()=>d?.people(u)),setHostContext:u=>(0,j.flushSync)(()=>d?.hostContext(u)),setBrand:u=>(0,j.flushSync)(()=>d?.brand(u)),setDraftView:u=>(0,j.flushSync)(()=>d?.draft(u)),setLabel:u=>{p=u,(0,j.flushSync)(()=>d?.label(u))},setHostActions:u=>(0,j.flushSync)(()=>d?.hostActions(u)),drawn:()=>A.then(()=>L===P?void 0:new Promise(u=>S.push(u))),notify:u=>{let D;return(0,j.flushSync)(()=>{D=a.notify(u)}),D},unmount:()=>Z.unmount()}}var ut=e=>`s${(e+1).toString(36)}`;var Cr="/graview/live",Jt="graview.ship",Yt=`${Jt}.${Xe}`;var we={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 Ve=class extends Error{constructor(n){super(n),this.name="Superseded"}},ke=e=>e?.lineage?{lineage:e.lineage}:{},ko=(e,n)=>`${e.calls.map(o=>o.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
|
|
2
|
-
`)[0]??"":String(n)})`;function Eo(e){if(!e)return[];try{let n=e.storage.getItem(e.key);if(n===null)return[];e.storage.removeItem(e.key);let o=JSON.parse(n);return Array.isArray(o)?o.filter(a=>!!a&&Array.isArray(a.calls)):[]}catch{return[]}}var De=class extends Error{constructor(o){super(o.sentence);this.refusal=o;this.name="RemoteRefusedError"}},Ao={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},Le=class extends Error{constructor(o,a){super(o);this.conflicts=a;this.name="StaleWrite"}},qe=class extends Error{constructor(n){super(n),this.name="Unreached"}},Ro=new Set([502,503,504]);async function xo(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function To(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var Fo=1,Oo=()=>({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 ft(e){return(await Lr(e,Eo(e.carry),"This app was updated while your changes were on the way.",Oo())).remote}async function Lr(e,n,o,a){let d=e.fetch??fetch,l={"content-type":"application/json",...e.headers??{}},b={...pt(e.principal),[we.via]:e.via??"web"};Object.assign(l,b);let p=e.live===!0,w=e.presenceEveryMs,A=e.visible??Mo,T="connecting",v=a.statuses,P=a.tally,L=[],S,$=[],ne=()=>T==="online"&&S!==void 0?"held":T,V=()=>{let t=ne();if(a.told!==t){a.told=t;for(let r of[...v])r(t)}},Z=t=>{if(!(t===T||se)&&(T==="offline"&&t==="online"&&P.reconnects++,T=t,V(),t==="online"))for(let r of L.splice(0))r.again()},u=t=>{if(se)return;let r=typeof t=="string"&&t.length>0?t:void 0,s=r!==S;if(S=r,D(),!!s&&(V(),r===void 0)){for(let i of $.splice(0))i();C&&clearTimeout(C),he()}},D=()=>{if(a.toldHeld!==S){a.toldHeld=S;for(let t of[...a.helds])t(S??null)}},q=async(t,r)=>{let s;try{s=await d(t,r)}catch(i){throw _()||Z("offline"),new qe(i instanceof Error?i.message:String(i))}if(s.status===503&&await xo(s))return Z("online"),s;if(Ro.has(s.status))throw _()||Z("offline"),new qe(`The server is away (${s.status})`);return Z("online"),s},K=async(t=!1)=>{let r=`${e.url}/graview/state?opFormat=${Ie.op}`,s=t?await d(r,{headers:l}):await q(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 K(!0);p||(T="online"),S=typeof F.held=="string"&&F.held.length>0?F.held:void 0,D();let de=F.enabledModules??e.enabledModules,B=e.localApp?e.localApp(e.app):e.app,O=new wn({schema:B.schema,mutations:B.mutations??[],invariants:B.invariants??[],...B.policy?{policy:B.policy}:{},...B.publishing?{publishing:B.publishing}:{},...B.modules?{modules:B.modules}:{},...de?{enabledModules:de}:{},...B.intelligence?{intelligence:B.intelligence}:{},...B.brand?.timeZone?{timeZone:B.brand.timeZone}:{},snapshot:F.snapshot,log:F.log,...F.horizon!==void 0?{horizon:F.horizon}:{},ids:To(),...e.storeOptions??{}});hn.served.add(O);let Ee=yn(O),k=F.log.at(-1)?.seq??(F.horizon??0)-1,te=Rt.of(F.log,{horizon:F.horizon??0}),R=null,J,W=new Map,ce=a.who,ve=!1,N=t=>{if(se)return;ve=!0;let r=Sn(new Map,t,Date.now(),Ft,R?.participant);J!==void 0&&r.delete(J);let s=r.size!==W.size;if(!s)for(let[i,f]of r)Ot(f,W.get(i))||(s=!0);if(W=r,!!s)for(let i of[...ce])i([...W.values()])},z=[],I=new Set,le=t=>{let r=z.indexOf(t);r>=0&&z.splice(r,1)},M=new Map,Ae=(t,r)=>{let s=M.get(t);s&&(M.delete(t),s.resolve({ops:r.filter(i=>i.batch===t),batch:t}))},Y,X=[],H=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(Y)return X.push({ops:t,drop:r}),[];let s=Math.min(...t.filter(g=>g.seq>k).map(g=>g.seq));if(Number.isFinite(s)&&s>k+1)return X.push({ops:t,drop:r}),ue(),[];let i=z.filter(g=>t.some(be=>be.batch===g)),f=[...new Set([...r,...i])].filter(g=>I.has(g)),y,x=z.filter(g=>!i.includes(g));try{y=O.rebase({confirmed:t,pending:x,drop:f}).confirmed}catch(g){if(!(g instanceof gn))throw g;return X.push({ops:t,drop:r}),ue(),[]}for(let g of i)le(g);t.some(g=>g.seq>k)&&x.some(g=>!f.includes(g))&&P.rebases++,t.length>0&&(k=Math.max(k,...t.map(g=>g.seq)),te.note(t));for(let g of f)I.delete(g);for(let g of i)Ae(g,t);return y},ue=()=>{Y||(Y=oe(K().then(t=>{if(fe(t)){X=[];return}let r=new Set(t.log.map(f=>f.batch)),s=z.filter(f=>r.has(f));for(let f of s)le(f);let i=O.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[...z],drop:[...I].filter(f=>!z.includes(f))});I.clear();for(let f of i.pending)I.add(f.batch);k=t.log.at(-1)?.seq??(t.horizon??0)-1,te=Rt.of(t.log,{horizon:t.horizon??0}),P.resyncs++;for(let f of s)Ae(f,t.log)}).then(()=>{Y=void 0;let t=X;X=[];for(let{ops:r,drop:s}of t)H(r,s)},()=>{Y=void 0,X=[]})))},fe=t=>(typeof t.build=="string"&&nn(t.build),typeof t.version=="number"&&u(t.held),typeof t.version!="number"||t.version===F.version?!1:(bt(t.version),!0)),re=async t=>{let s=await(await q(`${e.url}/graview/since?seq=${ut(t)}&opFormat=${Ie.op}`,{headers:l})).json();return fe(s)?[]:s.reset===!0?(ue(),[]):s.ops??[]},Q=async()=>{let t=await ze();return Y&&await Y,t},ze=async()=>{if(R&&!_()&&A()){let r=await(await q(`${e.url}/graview/here`,{method:"POST",headers:l,body:JSON.stringify({presence:R,seq:ut(k)})})).json();return fe(r)?[]:(typeof r.participant=="string"&&(J=r.participant),N(r.who??[]),H(r.ops??[]))}return H(await re(k))},Re=new Map,E=new Map,xe=new Map,pe=new Set,oe=t=>(pe.add(t),t.finally(()=>pe.delete(t)).catch(()=>{}),t),Be=Promise.resolve(),Te=0,mt=(t,r)=>{let s=Be.then(()=>yt(t,r));return Be=s.catch(()=>{}),s},ht=()=>new Promise((t,r)=>L.push({again:t,give:r})),yt=async(t,r)=>{let s,i;for(;;){try{s=await q(`${e.url}/graview/ops`,{method:"POST",headers:l,body:JSON.stringify({...t,opFormat:Ie.op})})}catch(g){if(!(g instanceof qe)||U)throw g;if(await ht(),_())return Ke(t,r);continue}if(i=await s.json().catch(()=>({})),s.status===503&&i.reason==="unavailable"&&typeof i.held=="string"&&!U){if(typeof i.version=="number"?fe(i):(u(i.held),!1))break;if(S!==void 0&&(kt>0||p)){if(await new Promise(g=>$.push(g)),U)throw new Ve("The client closed.");if(_())return Ke(t,r);continue}}let x;if(s.status===503&&i.reason==="unavailable"&&!U)x=Qt(e.backoff,Te++);else{if(Te=0,s.status!==429||U)break;x=Co(s.headers.get("retry-after"),i.retryAfter)}if(await new Promise(g=>setTimeout(g,x)),_())return Ke(t,r)}if(se||fe(i))throw new Ve("The app was changed.");if(!s.ok){let x=i.error??`The server refused (${s.status})`;throw i.conflict?new Le(x,i.conflicts??[]):new De({reason:i.reason??Ao[s.status]??"invalid",sentence:x,...i.wouldNeed?.length?{wouldNeed:i.wouldNeed}:{}})}let f=i.ops??[],y=f[0]?.seq;return y!==void 0&&y>k+1&&(f=await re(k)),r!==void 0&&(i.batch&&Re.set(r,i.batch),le(r)),H(f,r!==void 0?[r]:[]),{ops:i.ops??[],...i.batch?{batch:i.batch}:{}}},G,ee=!1,U=!1,We=0,me,Ge=0,Ne=0,ae=null,Me=()=>{},Fe=new Promise(t=>{Me=t}),_=()=>p&&ee&&G?.readyState===Fo,ie=t=>{if(!_())return!1;try{return G.send(JSON.stringify(t)),!0}catch{return!1}},Ue=(t=!1)=>{!R||!_()||!A()||!t&&ae&&Ot(R,ae)&&(w===void 0||Date.now()-Ne<w)||ie({t:"here",presence:R})&&(ae=R,Ne=Date.now())},m=new Set,C,he=()=>{if(C=void 0,S!==void 0)return;let t=[...M.entries()].filter(([r])=>m.has(r));m.clear();for(let[,r]of t)ie(r.message)},tn=(t,r)=>{M.has(t)&&(m.add(t),C&&clearTimeout(C),C=setTimeout(he,Math.max(0,r)))},Vr=t=>{M.has(t)&&m.add(t)},Ke=(t,r)=>new Promise((s,i)=>{let f=r??`send-${++Ge}`,y=t.undo?{t:"undo",cid:f,batches:t.undo,...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.via?{via:t.via}:{},...ke(t)}:{t:"call",cid:f,calls:t.calls??[],...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.base?.length?{base:t.base}:{},...t.via?{via:t.via}:{},...ke(t)};if(M.set(f,{message:y,...r!==void 0?{mine:r}:{},resolve:s,reject:i}),m.size>0||S!==void 0){m.add(f);return}ie(y)}),gt=(t,r)=>_()?Ke(t,r):mt(t,r),Dr=t=>{switch(t.t){case"welcome":{if(nn(t.build),typeof t.version=="number"&&t.version!==F.version){bt(t.version);return}if(ee=!0,We=0,typeof t.participant=="string"&&(J=t.participant),u(t.held),t.state?ue():H(t.ops??[]),m.clear(),C&&clearTimeout(C),C=void 0,S!==void 0)for(let r of M.keys())m.add(r);else for(let r of M.values())ie(r.message);Ue(!0),Z("online"),Me();return}case"ops":H(t.ops??[]);return;case"ack":{let r=M.get(t.cid);if(!r){H(t.ops??[]);return}M.delete(t.cid),Te=0,r.mine!==void 0&&(Re.set(r.mine,t.batch),le(r.mine)),H(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=M.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){S!==void 0?Vr(t.cid):tn(t.cid,Qt(e.backoff,Te++));return}M.delete(t.cid),r.reject(t.t==="conflict"?new Le(t.sentence,t.conflicts??[]):new De({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&tn(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":N(t.who??[]);return;case"held":u(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==F.version&&bt(t.version);return;case"reload":sn(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&G){let r=G;cn(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},se=!1,wt=a.declarations,vt=a.builds,nn=t=>{if(!(se||a.otherBuild!==void 0||!e.build||typeof t!="string"||t.length===0||t===e.build)){a.otherBuild=t;for(let r of[...vt])r(t)}},rn=()=>{let t=[],r=0;for(let s of z){let i=xe.get(s);i?t.push({calls:i.calls,...i.intent?{intent:i.intent}:{},...i.via?{via:i.via}:{},...ke(i),batch:s}):r++}return{carried:t,undos:r}},on=(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.`,an=t=>{se=!0,R=null;let r=new Ve(t);for(let i of M.values())i.reject(r);M.clear(),Qe&&clearInterval(Qe),U=!0,me&&clearTimeout(me),C&&clearTimeout(C),ye&&clearTimeout(ye);for(let i of L.splice(0))i.give(r);for(let i of $.splice(0))i();let s=G;G=void 0,ee=!1;try{s?.close(1e3,t)}catch{}Me()};async function bt(t){if(se)return;if(!e.resolveApp){sn(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:s}=rn(),i=e.resolveApp,f=R;an("The app was changed.");try{let y=await i(t),{state:x,...g}=e,be=await Lr({...g,app:y},r,"The app was changed while your changes were on the way.",a);f&&be.remote.presence.here(f);for(let Ze of[...wt])Ze(be.remote,t);let jr=[...s>0?[Je(on(s,"The app was changed"))]:[],...be.unheard()];for(let Ze of jr)for(let qr of He)qr(Ze.sentence,Ze)}catch(y){let x=`The app was changed, but the new version could not be opened: ${y instanceof Error?y.message:String(y)}`;for(let g of He)g(x,Je(x))}}function sn(t){if(se)return;let{carried:r,undos:s}=rn();an(t);let i=!1;if(e.carry&&r.length>0)try{e.carry.storage.setItem(e.carry.key,JSON.stringify(r)),i=!0}catch{}let f=[];!i&&r.length>0&&f.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&&f.push(on(s,"This app was updated"));for(let y of f)for(let x of He)x(y,Je(y));(e.reloadPage??Lo)()}let dn=()=>{if(U||!p)return;let t=`${e.url.replace(/^http/,"ws").replace(/\/$/,"")}${Cr}`,{"content-type":r,...s}=l,i;try{i=e.socket?e.socket(t,s,[Yt]):_r(t,s)}catch{return ln()}G=i,ee=!1,i.onopen=()=>{G===i&&i.send(JSON.stringify({t:"hello",seq:ut(k),protocol:Xe,wire:Jt,opFormat:Ie.op,...e.build?{build:e.build.slice(0,64)}:{},...e.hostProtocol!==void 0?{hostProtocol:e.hostProtocol}:{}}))},i.onmessage=f=>{if(G!==i)return;let y;try{y=JSON.parse(String(f.data))}catch{return}Dr(y)},i.onclose=()=>cn(i),i.onerror=()=>{}},ye,Br=()=>{ve=!1,ye&&clearTimeout(ye),ye=setTimeout(()=>{if(ye=void 0,ve||U)return;let t=new Map([...W].filter(([,r])=>r.held!=="socket"));if(t.size!==W.size){W=t;for(let r of ce)r([...W.values()])}},Ft),ye.unref?.()};function cn(t){if(G!==t)return;let r=ee;G=void 0,ee=!1,ae=null,r&&(Z("offline"),Br()),ln()}let ln=()=>{if(U)return;let t=Qt(e.backoff,We);We++,me=setTimeout(dn,t)},Wr=O.applyAll.bind(O),Nr=O.undo.bind(O),$r=O.previewAll.bind(O);O.previewAll=(t,r)=>$r(t,{...e.principal?{author:e.principal}:{},...r});let He=a.refusals,$e=[],Je=t=>({reason:"invalid",sentence:t}),Ye=a.conflicts,St=!1,un=async(t,r)=>{if(r instanceof Ve||se)return;let s=r instanceof De?r.refusal:pn(r),i=s.sentence;le(t);try{H([],[t])}catch{}let f=xe.get(t);if(xe.delete(t),r instanceof Le&&P.conflicts++,r instanceof Le&&!_()&&await Q().catch(()=>[]),r instanceof Le&&Ye.size>0){let y=!1,x={sentence:i,conflicts:r.conflicts,keepTheirs(){y=!0},useMine(){if(!(y||!f)){y=!0,St=!0;try{O.applyAll(f.calls,{...f.intent?{intent:f.intent}:{},...f.via?{via:f.via}:{},...ke(f)})}finally{St=!1}}}};for(let g of Ye)g(x);return}for(let y of He)y(i,s)};O.applyAll=(t,r)=>{let s=mn(O.log.all().filter(x=>I.has(x.batch))),i=Wr(t,{...e.principal?{author:e.principal}:{},...r}),f=t.map((x,g)=>{let be=i.minted?.[g];return be===void 0||x.args?.id!==void 0?x:{...x,mintedHint:be}});z.push(i.batch),I.add(i.batch),xe.set(i.batch,{calls:f,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...ke(r)});let y=St?[]:te.baseFor(i.ops,s,(x,g)=>O.collaborative(x,g));return E.set(i.batch,oe(gt({calls:f,...r?.intent?{intent:r.intent}:{},batch:i.batch,...y.length>0?{base:y}:{},...r?.via?{via:r.via}:{},...ke(r)},i.batch).catch(x=>un(i.batch,x)))),i},O.apply=(t,r)=>O.applyAll([t],r),O.undo=(t,r)=>{let s=typeof t=="string"?[t]:t,i=Nr(s.map(y=>Re.get(y)??y),{...e.principal?{author:e.principal}:{},...r});z.push(i.batch),I.add(i.batch);let f=Promise.allSettled(s.map(y=>E.get(y)));return E.set(i.batch,oe(f.then(()=>gt({undo:s.map(y=>Re.get(y)??y),...r?.intent?{intent:r.intent}:{},batch:i.batch,...r?.via?{via:r.via}:{},...ke(r)},i.batch)).catch(y=>un(i.batch,y)))),i};let Ir=async(t,r={})=>{Pt++;try{return(await oe(gt({calls:t,...r}))).ops}finally{Pt--}},Pt=0,fn={here(t){R=t,Ue()},onWho(t){return ce.add(t),W.size>0&&t([...W.values()]),()=>{ce.delete(t)}},leave(){if(!R)return;let t=JSON.stringify({participant:J??R.participant});if(R=null,ie({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,Qe=kt>0&&typeof setInterval=="function"?setInterval(()=>{_()||Q().catch(()=>{})},kt):null;if(p){dn();let t;await Promise.race([Fe,new Promise(r=>t=setTimeout(r,e.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!se){let t=[],r=new Set(O.log.all().map(s=>s.batch));for(let s of n)if(!(s.batch!==void 0&&r.has(s.batch)))try{O.applyAll(s.calls,{...s.intent?{intent:s.intent}:{},...s.batch?{batch:s.batch}:{},...s.via?{via:s.via}:{},...ke(s)})}catch(i){t.push(ko(s,i))}t.length>0&&$e.push(Je(`${o} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}return{remote:{store:O,version:F.version,migrated:F.migrated??[],send:Ir,pull:Q,onRefusal(t){He.add(t);let r=$e;$e=[];for(let s of r)t(s.sentence,s);return()=>He.delete(t)},onDeclaration(t){return wt.add(t),()=>wt.delete(t)},onBuild(t){return vt.add(t),a.otherBuild!==void 0&&t(a.otherBuild),()=>vt.delete(t)},onConflict(t){return Ye.add(t),()=>Ye.delete(t)},revision:(t,r)=>te.of(t,r),seq:()=>k,participant:()=>J,transport:()=>_()?"socket":"poll",status:ne,onStatus(t){return v.add(t),()=>v.delete(t)},held:()=>S,onHeld(t){return a.helds.add(t),S!==void 0&&t(S),()=>a.helds.delete(t)},counters:()=>({...P}),who:()=>[...W.values()],pending:()=>z.length+Pt,async settled(){for(;pe.size>0;)await Promise.allSettled([...pe])},presence:fn,close(){Qe&&clearInterval(Qe),Ee(),fn.leave(),U=!0,me&&clearTimeout(me),C&&clearTimeout(C),ye&&clearTimeout(ye);for(let r of L.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of $.splice(0))r();let t=G;G=void 0,ee=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=$e;return $e=[],t}};function _r(t,r){let s=globalThis.WebSocket;if(!s)throw new Error("This runtime has no WebSocket; the client polls instead.");let i=typeof globalThis.document<"u",f=e.subprotocol?[Yt]:[];if(!i)try{return new s(t,{headers:r,...f.length>0?{protocols:f}:{}})}catch{}let y=new URL(t);for(let[x,g]of Object.entries(b))y.searchParams.set(x,g);return f.length>0?new s(y.toString(),f):new s(y.toString())}}function Co(e,n,o=Date.now()){let a,d=e?.trim();if(d)if(/^\d+(\.\d+)?$/.test(d))a=Number(d)*1e3;else{let p=Date.parse(d);Number.isFinite(p)&&(a=Math.max(0,p-o))}let l=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,b=l!==void 0&&l<50&&a!==void 0&&Math.abs(l*1e3-a)<1e3;return l!==void 0&&!b?l:a??1e3}function Lo(){globalThis.location?.reload?.()}function Mo(){return globalThis.document?.visibilityState!=="hidden"}function Qt(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:o=250,max:a=1e4,factor:d=2}=e??{};return Math.min(a,o*d**n)*(.75+Math.random()*.5)}function pt(e){let n={};if(!e)return n;e.id&&(n[we.seat]=e.id),e.roles?.length&&(n[we.roles]=e.roles.join(",")),e.kind!=="human"&&(n[we.kind]=e.kind),e.name&&(n[we.name]=encodeURIComponent(e.name));let o=e.onBehalfOf;return o?.id&&(n[we.for]=o.id),o?.roles?.length&&(n[we.forRoles]=o.roles.join(",")),o?.name&&(n[we.forName]=encodeURIComponent(o.name)),n}var Mr="/graview/views";function Zt(e){let n=e.fetch??fetch,o=e.url.replace(/\/$/,""),a={"content-type":"application/json",...e.principal?pt(e.principal):{},...e.headers??{}},d=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??et.may}:et,l=new Set,b=v=>{if(JSON.stringify(v)!==JSON.stringify(d)){d=v;for(let P of l)P()}},p=async(v,P)=>{let L=await n(`${o}${e.path??Mr}`,{method:v,headers:a,...P!==void 0?{body:JSON.stringify(P)}:{}}),S=await L.json();if(!L.ok)throw new Error(S.error??`The store answered ${L.status}.`);b({hidden:S.hidden??[],removed:S.removed??[],may:S.may??et.may})},w=()=>p("GET"),A=e.state?Promise.resolve():w().catch(()=>{}),T=e.pollMs?setInterval(()=>void w().catch(()=>{}),e.pollMs):void 0;return{ready:A,refresh:w,close:()=>clearInterval(T),current:()=>d,onChange(v){return l.add(v),()=>void l.delete(v)},hide:v=>p("POST",{hide:v}),show:v=>p("POST",{show:v}),remove:(v,P)=>p("POST",{remove:v,...P?{about:P}:{}}),async restore(v){let P=d.removed.find(L=>L.name===v)?.lens;await p("POST",{restore:v}),P&&await e.onDeclaration?.()},async lens(v){await p("POST",{lens:v}),await e.onDeclaration?.()}}}var en=document.getElementById("graview-app"),Xt=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),Hr=Xt?(__graviewPreload(import.meta.url,["./chunk.UDTBFAS5.js","./chunk.3SY6WWWQ.js","./chunk.UGFDSE37.js","./chunk.ATWNWPME.js","./chunk.GZEZMU2T.js","./chunk.4VJARLJ5.js","./chunk.5RNB6IC5.js","./chunk.ZITDUHX3.js","./chunk.ETWREHXF.js","./chunk.YZ6UKKEL.js","./chunk.FFPG4PHX.js","./chunk.3L5USMQD.js","./chunk.GTUBIJTP.js","./chunk.DUIKIJKC.js","./chunk.73BJYIYS.js","./chunk.OKQ4JXTW.js","./chunk.M5RHVUZ6.js","./chunk.MRUDTYOL.js","./chunk.OUNLAMBA.js","./chunk.HGP3Q7QX.js","./chunk.QSZLY62B.js","./chunk.7VX6TBNY.js","./chunk.XOZU4OFA.js","./chunk.CR5MQMOL.js","./chunk.MB7LKKUD.js","./chunk.AXCRFJDL.js","./chunk.S64LCR23.js","./chunk.WVUJXDXZ.js","./chunk.6SHF6IL5.js","./chunk.MQISKON2.js","./chunk.GQX57JIE.js","./chunk.LJXAZ5TF.js","./chunk.QFI4L2HK.js","./chunk.KFHXTHIY.js","./chunk.GZHZLJBF.js","./chunk.JLR74UFP.js","./chunk.OJGHDWI6.js","./chunk.HG34MT7C.js","./chunk.TT6QBWRA.js","./chunk.UCS3CBT4.js","./chunk.O6SKKF4V.js","./chunk.ZK446PSX.js","./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.UOC3SIYT.js")):Ce("pages");try{Xt?await Ho(decodeURIComponent(Xt[1])):await Vo()}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),en.replaceChildren(n),window.__graviewFailed=n.textContent}async function Ho(e){let n=await fetch(`/graview/document?form=${encodeURIComponent(e)}`),o=await n.json();if(!n.ok)throw new Error(o.error??`The preview server did not hand over the form (${n.status}).`);let a=await it(o);if(!a.ok)throw new Error(tt(a.findings));let d=a.app,l=o.principal,b=await ft({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 Hr;window.__graview=p(en,{app:d,form:e,principal:l,remote:b,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function Vo(){let e=await fetch("/graview/document");if(!e.ok)throw new Error(`The preview server did not hand over the document (${e.status}).`);let n=await e.json(),a=await(async w=>{if(typeof w.module=="string")return(await import(w.module)).app;let A=await it(w);if(!A.ok)throw new Error(tt(A.findings));return A.app})(n);if(!a||typeof a!="object"||!("schema"in a))throw new Error("The app module the preview server handed does not export an app.");let d=n.principal,l=await ft({app:a,url:location.origin,principal:d,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=a.name;let b,p=Zt({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 A=await it(w);A.ok&&b?.setApp(A.app,l)}});await Promise.all([Hr,p.ready]),b=Kt(en,{app:a,remote:l,principal:d,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:a.name,heading:1,keptViews:p,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=b,b.drawn().then(()=>{window.__graviewReady=!0})}
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Dt,b as Xn,c as er,d as tr,e as nr,f as Bt,g as rr,h as Wt}from"./chunk.353CGK6C.js";import{a as Zr}from"./chunk.WQLAIEWJ.js";import{a as $t,b as ar,c as ir,d as sr,e as Nt,f as dr,g as cr,h as lr,i as ur,j as fr,k as pr,l as mr,m as hr,n as je}from"./chunk.4N5R4K6O.js";import{b as or}from"./chunk.KK46XLGU.js";import{a as At}from"./chunk.Q5WEOX3Q.js";import{a as Rt,g as Tn}from"./chunk.76QSPWSJ.js";import{k as rt}from"./chunk.FKJ3HIA5.js";import{C as Jn,H as Yn,L as Qn,M as Zn,j as Qr,k as zn,n as it,o as Gn,q as Un,u as Kn,z as st}from"./chunk.GYTVL6GR.js";import{Ba as Nn,Ca as In,Ea as _n,Fa as Vt,G as Ht,Ja as jn,Ka as qn,Na as at,T as Fn,Y as Cn,a as xn,b as Lt,c as ot,fa as Ln,ga as Mn,j as On,m as Mt,ua as Hn,va as Vn,wa as Dn,xa as Bn,ya as Wn,za as $n}from"./chunk.TMYGLXR6.js";import{a as Ee}from"./chunk.SDO3U72B.js";import{Bb as wn,Ed as ke,Fd as En,Gd as An,Ld as xt,Md as Ot,Nd as Ft,Qc as bn,Qd as Rn,Rd as Ct,cb as _e,dd as Sn,ec as Tt,fc as vn,fd as Pn,gd as kn,id as nt,nb as tt,ob as gn}from"./chunk.P4CLT32V.js";import"./chunk.SLBWPVIY.js";import{b as Le}from"./chunk.AJZBJBMO.js";async function dt(e,n={}){let a=e.compiled===void 0||!eo(e.compiled,e.document)?void 0:Tn(e.compiled,n);if(a?.ok)return a;let{compileDocumentWithoutCheck:s}=await Xr();return s(e.document,n)}var yr,Xr=()=>yr??=(__graviewPreload(import.meta.url,["./chunk.JBR66TUP.js","./chunk.76QSPWSJ.js","./chunk.XCQ7ZPR5.js","./chunk.NVRK6A7T.js","./chunk.FKJ3HIA5.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.AJAMTRZ3.js")).catch(e=>{throw yr=void 0,e});function eo(e,n){let a=typeof e=="object"&&e!==null?e.document:void 0,s=n;if(typeof s=="string")try{s=JSON.parse(s)}catch{return!1}return a!==void 0&&At(Rt(a).document)===At(Rt(s).document)}var c=Le(Ht(),1);var lt=Le(Ht(),1),It="data-graview-drawn",to=200,gr=50,no=1e4,ct=()=>typeof performance<"u"?performance.now():Date.now();function ro(e){let n=[...e.querySelectorAll("img")];for(let a of e.querySelectorAll("[data-worker-view]"))a.shadowRoot&&n.push(...a.shadowRoot.querySelectorAll("img"));return n}function oo(e,n){if(e.ownerDocument.fonts?.status==="loading"||Vn()>0||$n(n)>0||e.querySelector('[aria-busy="true"]')||ro(e).some(s=>!s.complete&&s.loading!=="lazy"))return!1;for(let s of e.querySelectorAll("[data-worker-view-place]"))if(!s.querySelector("[data-worker-view][data-worker-view-drawn], [data-worker-view][data-worker-view-failed]"))return!1;return!0}function wr(e){let n=e.querySelector("[data-embed-content]"),a=[...e.querySelectorAll("[data-worker-view]")].map(s=>`${s.offsetWidth}x${s.offsetHeight}`);return`${e.scrollWidth}x${e.scrollHeight}|${n?`${n.scrollWidth}x${n.scrollHeight}`:""}|${a.join(",")}`}function ao(e,n,a,s){e.removeAttribute(It);let d=e.ownerDocument.defaultView;if(!d)return()=>{};let l=ct(),S=l,p=wr(e),w=!1,R,O=typeof MutationObserver>"u"?void 0:new MutationObserver(P=>{P.some(j=>!(j.target===e&&j.attributeName===It))&&(S=ct())});O?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let v=()=>{w=!0,O?.disconnect(),R!==void 0&&clearTimeout(R)},E=P=>{let j=!1,se=()=>{j||(j=!0,P())};typeof d.requestAnimationFrame=="function"&&d.requestAnimationFrame(()=>setTimeout(se,0)),setTimeout(se,100)},L=()=>{if(w)return;let P=wr(e);P!==p&&(p=P,S=ct());let j=ct();if(oo(e,s)&&j-S>=to||j-l>=no){E(()=>{w||(v(),e.setAttribute(It,n),In(),a())});return}R=setTimeout(L,gr)};return R=setTimeout(L,gr),v}function vr(e,n,a,s,d){Nn();let l=(0,lt.useRef)({place:a,onDrawn:s});l.current={place:a,onDrawn:s},(0,lt.useLayoutEffect)(()=>{d&&Wn(d);let S=R=>ao(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(Ht(),1),qe,io=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.KVEDMKUN.js","./chunk.XCCBUWMC.js","./chunk.FFCUZPTC.js","./chunk.MG3DMURZ.js","./chunk.2W2YVB6X.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.DUY27OJV.js"))),br=()=>io().then(e=>void(qe=e),()=>new Promise(e=>setTimeout(e,2e3)).then(br)),_t=Hn(br),Sr=e=>!!e&&qe===void 0;function jt({onReady:e,fetch:n}){return(0,ye.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var so=0;function Pr(e){let[n,a]=(0,ye.useState)(()=>qe);(0,ye.useEffect)(()=>{if(!e||n)return;let l=!1;return _t().then(()=>{l||a(qe)}),()=>{l=!0}},[e,n]);let s=(0,ye.useMemo)(()=>so+=1,[e]);return{over:(0,ye.useMemo)(()=>{let l=n??qe;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:s}}var Ar=Le(Zr(),1),G=Le(Qr(),1);var h=Le(Fn(),1);function ut(e,n={}){let a=Vt(e);return{Face:a.part((d,l)=>(0,c.createElement)(d,l),n),fetch:()=>a.load().then(()=>{}),here:()=>a.current!==void 0||a.failed}}var Gt=e=>Promise.all([e,Qn()]).then(([n])=>n),Rr=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.NNUUD26E.js","./chunk.GMAXA5GV.js","./chunk.Y5AMZBHA.js","./chunk.GJQF7I22.js","./chunk.SPU3BVAO.js","./chunk.2VJ52LGS.js","./chunk.JI2UVZUU.js","./chunk.HJCQ6I3S.js","./chunk.7GAC7U34.js","./chunk.T3RTFTOZ.js","./chunk.FEIJ7ETK.js","./chunk.34HGT7HQ.js","./chunk.LYIHPVDZ.js","./chunk.FU4YSVWX.js","./chunk.TNL2BVCH.js","./chunk.TBSPEO2L.js","./chunk.3SBTQ66X.js","./chunk.3H7YIKKC.js","./chunk.ET3XJDPX.js","./chunk.3TVAE7LE.js","./chunk.JX2C3HVD.js","./chunk.4N5R4K6O.js","./chunk.KK46XLGU.js","./chunk.TI4OSTQV.js","./chunk.HVX7LFWR.js","./chunk.GZHZLJBF.js","./chunk.OW72XZF4.js","./chunk.OJGHDWI6.js","./chunk.KRODTMGR.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.SJKHVIHA.js"))),co=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.JG2FGZF2.js","./chunk.IE4ZJQV3.js","./chunk.TVWN5I4M.js","./chunk.B7LBG4UP.js","./chunk.7G4M2PX3.js","./chunk.UGFDSE37.js","./chunk.NNUUD26E.js","./chunk.PXQVXBNG.js","./chunk.OJ64WTLW.js","./chunk.GMAXA5GV.js","./chunk.IBJBCZKG.js","./chunk.NQ26KMSQ.js","./chunk.GJQF7I22.js","./chunk.SPU3BVAO.js","./chunk.OPCBZNKF.js","./chunk.UK5F3S2N.js","./chunk.2VJ52LGS.js","./chunk.JI2UVZUU.js","./chunk.CTOBNZLM.js","./chunk.34HGT7HQ.js","./chunk.TNL2BVCH.js","./chunk.NZDHXREL.js","./chunk.TBSPEO2L.js","./chunk.5ON3JSAK.js","./chunk.3SBTQ66X.js","./chunk.SSAY4ITS.js","./chunk.3TVAE7LE.js","./chunk.JX2C3HVD.js","./chunk.XOZU4OFA.js","./chunk.Z7N3MJ36.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.GLTWLQ6L.js","./chunk.ACB4TD4W.js","./chunk.XCQ7ZPR5.js","./chunk.MY5OXSS7.js","./chunk.NVRK6A7T.js","./chunk.FKJ3HIA5.js","./chunk.GZHZLJBF.js","./chunk.OW72XZF4.js","./chunk.OJGHDWI6.js","./chunk.KRODTMGR.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.Y2ZBVWII.js"))),lo=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.JG2FGZF2.js","./chunk.IE4ZJQV3.js","./chunk.TVWN5I4M.js","./chunk.B7LBG4UP.js","./chunk.7G4M2PX3.js","./chunk.UGFDSE37.js","./chunk.NNUUD26E.js","./chunk.PXQVXBNG.js","./chunk.OJ64WTLW.js","./chunk.GMAXA5GV.js","./chunk.IBJBCZKG.js","./chunk.NQ26KMSQ.js","./chunk.GJQF7I22.js","./chunk.SPU3BVAO.js","./chunk.OPCBZNKF.js","./chunk.UK5F3S2N.js","./chunk.2VJ52LGS.js","./chunk.JI2UVZUU.js","./chunk.CTOBNZLM.js","./chunk.34HGT7HQ.js","./chunk.TNL2BVCH.js","./chunk.NZDHXREL.js","./chunk.TBSPEO2L.js","./chunk.5ON3JSAK.js","./chunk.3SBTQ66X.js","./chunk.SSAY4ITS.js","./chunk.3TVAE7LE.js","./chunk.JX2C3HVD.js","./chunk.XOZU4OFA.js","./chunk.Z7N3MJ36.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.GLTWLQ6L.js","./chunk.ACB4TD4W.js","./chunk.XCQ7ZPR5.js","./chunk.MY5OXSS7.js","./chunk.NVRK6A7T.js","./chunk.FKJ3HIA5.js","./chunk.GZHZLJBF.js","./chunk.OW72XZF4.js","./chunk.OJGHDWI6.js","./chunk.KRODTMGR.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.QEQQXWYU.js"))),Tr=ut(()=>Gt(Rr().then(e=>e.SceneFace)),{what:"This view"}),xr=ut(()=>Rr().then(e=>e.SceneKeeping),{quiet:!0}),Or=ut(()=>Gt(co().then(e=>e.PagesContent)),{what:"This page"}),Fr=ut(()=>Gt(lo().then(e=>e.PictureFace)),{what:"This picture"}),uo=Tr.Face,fo=xr.Face,po=Or.Face,mo=Fr.Face;function Me(...e){let n=e.length>0?e:["scene","pages","picture"],a=new Set(n.flatMap(Cr));return Promise.all([...[...a].map(s=>s.fetch()),Un()]).then(()=>{},()=>{})}var Cr=e=>e==="pages"?[Or]:e==="picture"?[Fr]:[Tr,xr],Lr=e=>Cr(e).every(n=>n.here()),ho=150,qt=0;function kr(e,n){if(Lr(e))return n();let a=++qt,s=()=>{a===qt&&(qt+=1,n())};Me(e).then(s),setTimeout(s,ho)}var yo=768;function go(e,n){let a=n!==null&&n>=yo;(0,c.useEffect)(()=>{if(!a||e==="picture")return;let s=e==="pages"?"scene":"pages";if(Lr(s))return;let d=globalThis,l=()=>void Me(s),S=()=>{},p=_n(()=>{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,a])}function wo({asked:e,shown:n,onDrawn:a}){return(0,c.useLayoutEffect)(()=>a(e,n),[e,n,a]),null}function vo({auto:e,scene:n}){return(0,h.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${Nt}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var bo=Vt(Ee(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,h.jsx)(e.StudioPlace,{...n}),{quiet:!0});function Mr(e,n,a,s,d){return Bt(e,nr(n?ot(n):d??xn,s),a)}function Ut(e){return e&&ot(e).overview?"graview":"scene"}function Er(e,n){if(n.homeView?.()===void 0)return!1;let a=e.pages?.first?.trim();return a===void 0||a===""||a==="/"||a.toLowerCase()==="home"}function Hr(e){let[,n]=(0,c.useState)(!1),a=(0,c.useCallback)(()=>n(!0),[]),s=(0,c.useRef)(!1);return e.at&&!ft?(0,h.jsx)(jt,{onReady:a,fetch:Kt}):!s.current&&Sr(e.draftView)?(0,h.jsx)(jt,{onReady:a,fetch:_t}):(s.current=!0,(0,h.jsx)(So,{...e}))}function So(e){let{app:n,stop:a,bar:s=!0,standing:d="Everything is in order",principal:l,heading:S=2}=e,{rootRef:p,scope:w,css:R,scheme:O,store:v,presence:E,brand:L,auto:P,height:j}=dr(e),se=Pr(e.draftView),D=ir(e,Zn,se.over),[ee]=(0,c.useState)(Bn),f=e.basePath===void 0?{}:{basePath:e.basePath},[B]=(0,c.useState)(it),U=e.notices??B,Y=y=>xt(y,f),F={...e.routing?{routing:e.routing}:{},...f},[le]=(0,c.useState)(()=>{let y=e.at?.face;if(y)return y;let H=a===void 0&&Er(n,D)?"pages":Ut(a),V=Dt({...F,face:H});return e.face===void 0&&e.onOpening?.(V),V}),[W,x]=(0,c.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&a===void 0&&Xn(F)&&Er(n,D)),Re=(0,c.useRef)(e.onFace);Re.current=e.onFace,(0,c.useLayoutEffect)(()=>{W&&(Re.current?.("pages"),x(!1))},[W]);let k=W?"pages":e.face??le,oe=n.schema.kinds,T=e.routing==="address",Q=(0,c.useMemo)(()=>e.at?ft.settleAt(e,v.seenBy(l??{kind:"human"}),D.places()):void 0,[]),$=(0,c.useMemo)(()=>Mn(D,n.schema),[D,n.schema]),ue=(0,c.useMemo)(()=>{let y=Q?.stop??(T?er(e.basePath):void 0)??a;return k==="scene"&&y===void 0&&$===void 0&&(e.path===void 0||zt(e.path))?Wt(void 0):Mr(k,y,oe,D.places(),$)},[]),[ve]=(0,c.useState)(k);(0,c.useEffect)(()=>{ve!=="pages"&&Ln(D)},[ve,D]);let N=(0,c.useRef)(void 0),q=y=>y===void 0||zt(y)?"/":y;N.current??={path:q(Q?.path??(T?k==="pages"?(Ot(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==N.current.asked&&(N.current={path:q(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:M,setAt:Te,steering:K,steer:te}=pr(N.current.path),C=(0,c.useContext)(Vr);C&&(C.pages=()=>N.current.path);let fe=(0,c.useRef)(void 0),pe=(0,c.useCallback)(y=>void(N.current.path=y),[]),de=zn(p),[Z,Ge]=(0,c.useState)(!1),xe=e.pagesBelow!==void 0&&de!==null&&de<e.pagesBelow&&(k==="scene"||k==="graview")&&!Z,A=xe?"pages":k,$e=(0,c.useRef)(!1);$e.current=Z&&e.pagesBelow!==void 0&&de!==null&&de<e.pagesBelow&&(k==="scene"||k==="graview"),C&&(C.shown=A);let ne=(0,c.useRef)(k==="graview"?"graview":"scene");(A==="scene"||A==="graview")&&(ne.current=A),(0,c.useState)(()=>{if(!T||typeof window>"u"||A==="pages"||A==="picture")return;let{pathname:y,search:H,hash:V}=window.location;Ot(y,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${Y(ke)}${H}${V}`)}),sr(p,A,e.onIntrinsicHeight),go(A,de);let ce=mr(e.onError,A),be=hr(e.onReady,A),Ne=(0,c.useRef)(e.onFaceDrawn);Ne.current=e.onFaceDrawn;let He=(0,c.useCallback)((y,H)=>{be(H),Ne.current?.(y)},[be]),[yt,gt]=(0,c.useState)(null),Ue=D.places(),_=(0,c.useRef)({shown:A,onFace:e.onFace});_.current={shown:A,onFace:e.onFace};let re=(0,c.useCallback)((y,H,V)=>{if(T){fe.current?.(y,H,V);return}_.current.onFace?.(y),I.current?.(y==="pages"?H??N.current.path:ke,"push")},[T]),[X,Oe]=(0,c.useState)(void 0);(0,c.useEffect)(()=>{A==="pages"&&Oe(void 0)},[A]);let Se=(0,c.useRef)(a);(0,c.useEffect)(()=>{Se.current!==a&&(Se.current=a,Oe(void 0))},[a]);let Ke=(0,c.useCallback)(y=>{if(_.current.shown==="pages"){if(Ge(!0),Oe(y),k==="scene"||k==="graview"){kr(k,()=>{T?window.history.pushState(null,"",`${Y(ke)}${y??""}`):I.current?.(ke,"push")});return}kr(ne.current,()=>re(ne.current,void 0,y))}},[T,k,e.basePath,re]),Pe=(0,c.useCallback)(y=>{if(_.current.shown==="pages"){K.go.current||(N.current.path=y),te(y);return}if(N.current.path=y,Te(y),$e.current){Ge(!1),T?window.history.pushState(null,"",Y(y)):I.current?.(y,"push");return}re("pages",y)},[K,te,Te,re,T,e.basePath]),Fe=D.arrangement?.(),me=A==="pages",Ve=e.hrefOf,z=Ve??(T?Y:void 0),Ce=(0,c.useMemo)(()=>({open:Pe,...Ve?{href:Ve}:T?{href:y=>xt(y,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[Pe,T,e.basePath,Ve]);return(0,h.jsxs)("section",{ref:p,className:w,"aria-label":e.label??n.name,"data-graview-embed":A,"data-graview-scheme":O,...xe?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:j,minHeight:P?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,h.jsx)("style",{children:R}),(0,h.jsxs)(qn.Provider,{value:ce,children:[(0,h.jsx)(cr,{rootRef:p,board:U}),(0,h.jsx)(ar,{rootRef:p,firstLook:e.firstLook,app:Jn(L??{name:n.name},n.schema)}),(0,h.jsx)(je,{module:"@graview/react",report:ce,content:!0,children:(0,h.jsx)(Dn.Provider,{value:ee,children:(0,h.jsx)(Cn,{store:v,views:D,initialView:ue,scheme:O,...lr(e,E,L),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,h.jsxs)(Gn.Provider,{value:U,children:[(0,h.jsx)(Ao,{face:A,stop:X??a,kinds:oe,places:Ue,opens:$}),C?(0,h.jsx)(Po,{into:C}):null,(0,h.jsx)(ko,{rootRef:p,face:k,shown:A,path:M,stop:a,draft:se.n,onDrawn:e.onDrawn,parts:ee}),T?(0,h.jsx)(tr,{pagesWere:Q?.path,basePath:e.basePath,shown:A,onFace:e.onFace,toggle:fe,kinds:oe,places:Ue,opens:$,landed:pe}):null,s&&A!=="picture"?(0,h.jsx)(je,{module:"@graview/embed",report:ce,children:(0,h.jsx)(ur,{name:L?.name??n.name,heading:S,named:$t(s).name!==!1,faces:$t(s).faces===!1?void 0:{scene:{label:En(Fe),current:!me,go:()=>Ke(),reach:()=>void Me(ne.current)},pages:{label:An(Fe),current:me,go:()=>Pe(N.current.path),reach:()=>void Me("pages")}},at:me?M:null,without:e.pages?.without(),home:{...z?.("/")!==void 0?{href:z("/")}:{},go:()=>Pe("/"),current:me&&M.split("?")[0]==="/"},reach:{...z?{href:z}:{},go:y=>Pe(y.path)},standing:d,hostActions:e.hostActions,keeping:me?void 0:(0,h.jsx)(Ro,{app:n,studio:e.studio,report:ce}),onFind:gt,switch:e.switch})}):null,(0,h.jsx)(Kn.Provider,{value:yt,children:(0,h.jsx)(je,{module:A==="pages"||A==="picture"?"@graview/pages":"@graview/react",report:ce,content:!0,children:(0,h.jsxs)(c.Suspense,{fallback:(0,h.jsx)(vo,{auto:P,scene:A!=="pages"&&A!=="picture"}),children:[A==="picture"?(0,h.jsx)(mo,{scope:w,store:v,views:D,as:(a?ot(a).within?.view:void 0)??""}):A==="pages"?(0,h.jsx)(po,{store:v,views:D,presence:E,auto:P,brand:L,steering:K,overview:Ke,scope:w,titleLevel:fr(S),quickAsk:st(e.quickAsk),props:{...e,onNavigate:ae,...T?{}:{path:N.current.path}}}):(0,h.jsx)(jn.Provider,{value:Ce,children:(0,h.jsx)(uo,{address:T,auto:P,scheme:O,scope:w,quickAsk:st(e.quickAsk)})}),(0,h.jsx)(wo,{asked:k,shown:A,onDrawn:He})]})},A)})]})})})})]})]})}var zt=e=>e.split(/[?#]/)[0]===ke,Vr=(0,c.createContext)(null);function Po({into:e}){return e.view=at().view,null}function ko({rootRef:e,face:n,shown:a,path:s,stop:d,draft:l,onDrawn:S,parts:p}){let{view:w}=at(),R=a==="scene"||a==="graview",O=Lt(w),v={face:n,path:R?ke:a==="picture"?d??"#":s,stop:O};return vr(e,`${a} ${R?O:v.path} ${l}`,v,S,p),null}var ft,Eo=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.353CGK6C.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.CI4DEKPX.js"))),Kt=()=>Eo().then(e=>void(ft=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(a),e()},a=setTimeout(n,1e4);window.addEventListener("online",n)}).then(Kt));function Ao({face:e,stop:n,kinds:a,places:s,opens:d}){let{view:l,go:S}=at(),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 v=(w||O)&&n!==void 0?Mr(e,n,a,s):O&&rr(l)?Bt(e,Wt(d),a):e==="graview"?Mt(l,!0):l.overview?On(Mt(l,!1),Yn(l,a)):l;S(v)},[e,n,a,l,S,d]),null}function Ro({app:e,studio:n,report:a}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c.Suspense,{fallback:null,children:(0,h.jsx)(fo,{})}),n!==!1?(0,h.jsx)(je,{module:"@graview/studio",report:a,children:(0,h.jsx)(To,{app:e,studio:n})}):null]})}function To({app:e,studio:n}){let a={app:e,within:"box",...n?{onApply:n.onApply}:{},...n?.landmark?{landmark:n.landmark}:{},...n?.offered!==void 0?{offered:n.offered}:{}},s=n?.place;return s?(0,h.jsx)(s,{...a}):(0,h.jsx)(c.Suspense,{fallback:null,children:(0,h.jsx)(bo,{...a})})}function xo({path:e,stop:n,...a},s){return{...a,app:s.app,at:s.at,remote:s.remote,...s.remote.presence?{presence:s.remote.presence}:{}}}function Jt(e,n){let a=n.store??n.remote?.store??or(n.app,n.seed),s=n.notices??it(),d=null,l={},S=0,p=n.label,w=n.app,R=Promise.resolve(),O=n.at?.face??n.face,v=O===void 0?void 0:Dt({...n,face:O}),E=v??Ut(n.stop),L=null,P=[],j=f=>{if(L=f,f!==E)return;let B=P;P=[];for(let U of B)U()};function se(){let[f,B]=(0,c.useState)(v),[U,Y]=(0,c.useState)(n.stop),[F,le]=(0,c.useState)(n.path),[W,x]=(0,c.useState)(n.scheme??"auto"),[Re,k]=(0,c.useState)(n.principal),[oe,T]=(0,c.useState)(n.seats),[Q,$]=(0,c.useState)(n.quickAsk),[ue,ve]=(0,c.useState)(n.people),[N,q]=(0,c.useState)(n.hostContext),[I,ae]=(0,c.useState)(n.brand),[M,Te]=(0,c.useState)(n.label),[K,te]=(0,c.useState)(n.hostActions),[C,fe]=(0,c.useState)(void 0),[pe,de]=(0,c.useState)(n.draftView);return d={app:Z=>{fe(Z),le(void 0),Y(void 0)},face:B,stop:Y,path:le,scheme:x,seat:k,seats:T,quickAsk:$,people:ve,hostContext:q,brand:ae,label:Te,hostActions:te,draft:de},(0,h.jsx)(Vr.Provider,{value:l,children:(0,h.jsx)(Hr,{...C?xo(n,C):n,store:a,notices:s,...f!==void 0?{face:f}:{},onOpening:Z=>{E=Z},...U!==void 0?{stop:U}:{},...F!==void 0?{path:F}:{},...Re?{principal:Re}:{},...oe?{seats:oe}:{},...Q!==void 0?{quickAsk:Q}:{},...ue?{people:ue}:{},...N?{hostContext:N}:{},...I?{brand:I}:{},label:M,hostActions:K,draftView:pe,scheme:W,onFace:Z=>{E=Z,B(Z)},onSeat:k,onFaceDrawn:j},C?.n??0)})}let D=()=>{let f=l.view?.focusId,B=f?a.graph.getNode(f)?.kind:void 0,U=(l.shown??E)==="scene"||(l.shown??E)==="graview";return{face:E,path:U?ke:l.pages?.()??n.path??"/",stop:l.view?Lt(l.view):n.stop??"#",...B?{kind:B}:{}}},ee=(0,Ar.createRoot)(e);return(0,G.flushSync)(()=>ee.render((0,h.jsx)(se,{}))),{get store(){return a},where:D,setApp:(f,B,U)=>{let Y="graph"in B?{store:B}:B,F=()=>{let le=D();a=Y.store,p=U?.label??(p===w.name?f.name:p),w=f,(0,G.flushSync)(()=>{d?.label(p),d?.app({app:f,remote:Y,at:le,n:++S})})};ft?F():R=R.then(Kt).then(F)},setFace:f=>{E=f,(0,G.flushSync)(()=>d?.face(f))},setStop:f=>(0,G.flushSync)(()=>d?.stop(f)),setPath:f=>(0,G.flushSync)(()=>{if(zt(f)){(E==="pages"||E==="picture")&&(E="scene",d?.face("scene"));return}d?.path(f),E!=="pages"&&(E="pages",d?.face("pages"))}),setScheme:f=>(0,G.flushSync)(()=>d?.scheme(f)),setSeat:f=>(0,G.flushSync)(()=>d?.seat(f)),setSeats:f=>(0,G.flushSync)(()=>d?.seats(f)),setQuickAsk:f=>(0,G.flushSync)(()=>d?.quickAsk(f)),setPeople:f=>(0,G.flushSync)(()=>d?.people(f)),setHostContext:f=>(0,G.flushSync)(()=>d?.hostContext(f)),setBrand:f=>(0,G.flushSync)(()=>d?.brand(f)),setDraftView:f=>(0,G.flushSync)(()=>d?.draft(f)),setLabel:f=>{p=f,(0,G.flushSync)(()=>d?.label(f))},setHostActions:f=>(0,G.flushSync)(()=>d?.hostActions(f)),drawn:()=>R.then(()=>L===E?void 0:new Promise(f=>P.push(f))),notify:f=>{let B;return(0,G.flushSync)(()=>{B=s.notify(f)}),B},unmount:()=>ee.unmount()}}var pt=e=>`s${(e+1).toString(36)}`;var Dr="/graview/live",Yt="graview.ship",Qt=`${Yt}.${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 Be=class extends Error{constructor(n){super(n),this.name="Superseded"}},Ae=e=>e?.lineage?{lineage:e.lineage}:{},Oo=(e,n)=>`${e.calls.map(a=>a.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
|
|
2
|
+
`)[0]??"":String(n)})`;function Fo(e){if(!e)return[];try{let n=e.storage.getItem(e.key);if(n===null)return[];e.storage.removeItem(e.key);let a=JSON.parse(n);return Array.isArray(a)?a.filter(s=>!!s&&Array.isArray(s.calls)):[]}catch{return[]}}var We=class extends Error{constructor(a){super(a.sentence);this.refusal=a;this.name="RemoteRefusedError"}},Co={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},we=class extends Error{constructor(a,s){super(a);this.conflicts=s;this.name="StaleWrite"}},ze=class extends Error{constructor(n){super(n),this.name="Unreached"}},Lo=new Set([502,503,504]);async function Mo(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function Ho(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var Vo=1,Do=()=>({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 mt(e){return(await Br(e,Fo(e.carry),"This app was updated while your changes were on the way.",Do())).remote}async function Br(e,n,a,s){let d=e.fetch??fetch,l={"content-type":"application/json",...e.headers??{}},S={...ht(e.principal),[ge.via]:e.via??"web"};Object.assign(l,S);let p=e.live===!0,w=e.presenceEveryMs,R=e.visible??$o,O="connecting",v=s.statuses,E=s.tally,L=[],P,j=[],se=()=>O==="online"&&P!==void 0?"held":O,D=()=>{let t=se();if(s.told!==t){s.told=t;for(let r of[...v])r(t)}},ee=t=>{if(!(t===O||ie)&&(O==="offline"&&t==="online"&&E.reconnects++,O=t,D(),t==="online"))for(let r of L.splice(0))r.again()},f=t=>{if(ie)return;let r=typeof t=="string"&&t.length>0?t:void 0,i=r!==P;if(P=r,B(),!!i&&(D(),r===void 0)){for(let o of j.splice(0))o();V&&clearTimeout(V),nn()}},B=()=>{if(s.toldHeld!==P){s.toldHeld=P;for(let t of[...s.helds])t(P??null)}},U=async(t,r)=>{let i;try{i=await d(t,r)}catch(o){throw z()||ee("offline"),new ze(o instanceof Error?o.message:String(o))}if(i.status===503&&await Mo(i))return ee("online"),i;if(Lo.has(i.status))throw z()||ee("offline"),new ze(`The server is away (${i.status})`);return ee("online"),i},Y=async(t=!1)=>{let r=`${e.url}/graview/state?opFormat=${_e.op}`,i=t?await d(r,{headers:l}):await U(r,{headers:l});if(!i.ok)throw new Error((await i.json().catch(()=>({}))).error??`The server refused (${i.status})`);return await i.json()},F=e.state??await Y(!0);p||(O="online"),P=typeof F.held=="string"&&F.held.length>0?F.held:void 0,B();let le=F.enabledModules??e.enabledModules,W=e.localApp?e.localApp(e.app):e.app,x=new kn({schema:W.schema,mutations:W.mutations??[],invariants:W.invariants??[],...W.policy?{policy:W.policy}:{},...W.publishing?{publishing:W.publishing}:{},...W.modules?{modules:W.modules}:{},...le?{enabledModules:le}:{},...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:Ho(),...e.storeOptions??{}});bn.served.add(x);let Re=Sn(x),k=F.log.at(-1)?.seq??(F.horizon??0)-1,oe=Tt.of(F.log,{horizon:F.horizon??0}),T=null,Q,$=new Map,ue=s.who,ve=!1,N=t=>{if(ie)return;ve=!0;let r=Rn(new Map,t,Date.now(),Ft,T?.participant);Q!==void 0&&r.delete(Q);let i=r.size!==$.size;if(!i)for(let[o,u]of r)Ct(u,$.get(o))||(i=!0);if($=r,!!i)for(let o of[...ue])o([...$.values()])},q=[],I=new Set,ae=t=>{let r=q.indexOf(t);r>=0&&q.splice(r,1)},M=new Map,Te=(t,r)=>{let i=M.get(t);i&&(M.delete(t),i.resolve({ops:r.filter(o=>o.batch===t),batch:t}))},K,te=[],C=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(K)return te.push({ops:t,drop:r}),[];let i=Math.min(...t.filter(g=>g.seq>k).map(g=>g.seq));if(Number.isFinite(i)&&i>k+1)return te.push({ops:t,drop:r}),fe(),[];let o=q.filter(g=>t.some(J=>J.batch===g)),u=[...new Set([...r,...o])].filter(g=>I.has(g)),m,b=q.filter(g=>!o.includes(g));try{m=x.rebase({confirmed:t,pending:b,drop:u}).confirmed}catch(g){if(!(g instanceof Pn))throw g;return te.push({ops:t,drop:r}),fe(),[]}for(let g of o)ae(g);t.some(g=>g.seq>k)&&b.some(g=>!u.includes(g))&&E.rebases++,t.length>0&&(k=Math.max(k,...t.map(g=>g.seq)),oe.note(t));for(let g of u)I.delete(g);for(let g of o)Te(g,t);return m},fe=()=>{K||(K=be(Y().then(t=>{if(pe(t)){te=[];return}let r=new Set(t.log.map(u=>u.batch)),i=q.filter(u=>r.has(u));for(let u of i)ae(u);let o=x.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[...q],drop:[...I].filter(u=>!q.includes(u))});I.clear();for(let u of o.pending)I.add(u.batch);k=t.log.at(-1)?.seq??(t.horizon??0)-1,oe=Tt.of(t.log,{horizon:t.horizon??0}),E.resyncs++;for(let u of i)Te(u,t.log)}).then(()=>{K=void 0;let t=te;te=[];for(let{ops:r,drop:i}of t)C(r,i)},()=>{K=void 0,te=[]})))},pe=t=>(typeof t.build=="string"&&on(t.build),typeof t.version=="number"&&f(t.held),typeof t.version!="number"||t.version===F.version?!1:(bt(t.version),!0)),de=async t=>{let i=await(await U(`${e.url}/graview/since?seq=${pt(t)}&opFormat=${_e.op}`,{headers:l})).json();return pe(i)?[]:i.reset===!0?(fe(),[]):i.ops??[]},Z=async()=>{let t=await Ge();return K&&await K,t},Ge=async()=>{if(T&&!z()&&R()){let r=await(await U(`${e.url}/graview/here`,{method:"POST",headers:l,body:JSON.stringify({presence:T,seq:pt(k)})})).json();return pe(r)?[]:(typeof r.participant=="string"&&(Q=r.participant),N(r.who??[]),C(r.ops??[]))}return C(await de(k))},xe=new Map,A=new Map,$e=new Set,ne=new Map,ce=new Set,be=t=>(ce.add(t),t.finally(()=>ce.delete(t)).catch(()=>{}),t),Ne=Promise.resolve(),He=0,yt=(t,r)=>{let i=Ne.then(()=>Ue(t,r));return Ne=i.catch(()=>{}),i},gt=()=>new Promise((t,r)=>L.push({again:t,give:r})),Ue=async(t,r)=>{let i,o;for(;;){try{i=await U(`${e.url}/graview/ops`,{method:"POST",headers:l,body:JSON.stringify({...t,opFormat:_e.op})})}catch(g){if(!(g instanceof ze)||X)throw g;if(await gt(),z())return Je(t,r);continue}if(o=await i.json().catch(()=>({})),i.status===503&&o.reason==="unavailable"&&typeof o.held=="string"&&!X){if(typeof o.version=="number"?pe(o):(f(o.held),!1))break;if(P!==void 0&&(Et>0||p)){if(await new Promise(g=>j.push(g)),X)throw new Be("The client closed.");if(z())return Je(t,r);continue}}let b;if(i.status===503&&o.reason==="unavailable"&&!X)b=Zt(e.backoff,He++);else{if(He=0,i.status!==429||X)break;b=Bo(i.headers.get("retry-after"),o.retryAfter)}if(await new Promise(g=>setTimeout(g,b)),z())return Je(t,r)}if(ie||pe(o))throw new Be("The app was changed.");if(!i.ok){let b=o.error??`The server refused (${i.status})`;throw o.conflict?new we(b,o.conflicts??[]):new We({reason:o.reason??Co[i.status]??"invalid",sentence:b,...o.wouldNeed?.length?{wouldNeed:o.wouldNeed}:{}})}let u=o.ops??[],m=u[0]?.seq;return m!==void 0&&m>k+1&&(u=await de(k)),r!==void 0&&(o.batch&&xe.set(r,o.batch),ae(r)),C(u,r!==void 0?[r]:[]),{ops:o.ops??[],...o.batch?{batch:o.batch}:{}}},_,re=!1,X=!1,Oe=0,Se,Ke=0,Pe=0,Fe=null,me=()=>{},Ve=new Promise(t=>{me=t}),z=()=>p&&re&&_?.readyState===Vo,Ce=t=>{if(!z())return!1;try{return _.send(JSON.stringify(t)),!0}catch{return!1}},y=(t=!1)=>{!T||!z()||!R()||!t&&Fe&&Ct(T,Fe)&&(w===void 0||Date.now()-Pe<w)||Ce({t:"here",presence:T})&&(Fe=T,Pe=Date.now())},H=new Set,V,nn=()=>{if(V=void 0,P!==void 0)return;let t=[...M.entries()].filter(([r])=>H.has(r));H.clear();for(let[,r]of t)Ce(r.message)},rn=(t,r)=>{M.has(t)&&(H.add(t),V&&clearTimeout(V),V=setTimeout(nn,Math.max(0,r)))},Nr=t=>{M.has(t)&&H.add(t)},Je=(t,r)=>new Promise((i,o)=>{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}:{},...Ae(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}:{},...Ae(t)};if(M.set(u,{message:m,...r!==void 0?{mine:r}:{},resolve:i,reject:o}),H.size>0||P!==void 0){H.add(u);return}Ce(m)}),Ye=(t,r)=>z()?Je(t,r):yt(t,r),Ir=t=>{switch(t.t){case"welcome":{if(on(t.build),typeof t.version=="number"&&t.version!==F.version){bt(t.version);return}if(re=!0,Oe=0,typeof t.participant=="string"&&(Q=t.participant),f(t.held),t.state?fe():C(t.ops??[]),H.clear(),V&&clearTimeout(V),V=void 0,P!==void 0)for(let r of M.keys())H.add(r);else for(let r of M.values())Ce(r.message);y(!0),ee("online"),me();return}case"ops":C(t.ops??[]);return;case"ack":{let r=M.get(t.cid);if(!r){C(t.ops??[]);return}M.delete(t.cid),He=0,r.mine!==void 0&&(xe.set(r.mine,t.batch),ae(r.mine)),C(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=M.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){P!==void 0?Nr(t.cid):rn(t.cid,Zt(e.backoff,He++));return}M.delete(t.cid),r.reject(t.t==="conflict"?new we(t.sentence,t.conflicts??[]):new We({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&rn(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&&bt(t.version);return;case"reload":cn(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&_){let r=_;un(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},ie=!1,wt=s.declarations,vt=s.builds,on=t=>{if(!(ie||s.otherBuild!==void 0||!e.build||typeof t!="string"||t.length===0||t===e.build)){s.otherBuild=t;for(let r of[...vt])r(t)}},an=()=>{let t=[],r=0;for(let i of q){let o=ne.get(i);o?t.push({calls:o.calls,...o.intent?{intent:o.intent}:{},...o.via?{via:o.via}:{},...Ae(o),batch:i}):r++}return{carried:t,undos:r}},sn=(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.`,dn=t=>{ie=!0,T=null;let r=new Be(t);for(let o of M.values())o.reject(r);M.clear(),Xe&&clearInterval(Xe),X=!0,Se&&clearTimeout(Se),V&&clearTimeout(V),he&&clearTimeout(he);for(let o of L.splice(0))o.give(r);for(let o of j.splice(0))o();let i=_;_=void 0,re=!1;try{i?.close(1e3,t)}catch{}me()};async function bt(t){if(ie)return;if(!e.resolveApp){cn(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:i}=an(),o=e.resolveApp,u=T;dn("The app was changed.");try{let m=await o(t),{state:b,...g}=e,J=await Br({...g,app:m},r,"The app was changed while your changes were on the way.",s);u&&J.remote.presence.here(u);for(let et of[...wt])et(J.remote,t);let Jr=[...i>0?[Qe(sn(i,"The app was changed"))]:[],...J.unheard()];for(let et of Jr)for(let Yr of De)Yr(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 De)g(b,Qe(b))}}function cn(t){if(ie)return;let{carried:r,undos:i}=an();dn(t);let o=!1;if(e.carry&&r.length>0)try{e.carry.storage.setItem(e.carry.key,JSON.stringify(r)),o=!0}catch{}let u=[];!o&&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.`),i>0&&u.push(sn(i,"This app was updated"));for(let m of u)for(let b of De)b(m,Qe(m));(e.reloadPage??Wo)()}let ln=()=>{if(X||!p)return;let t=`${e.url.replace(/^http/,"ws").replace(/\/$/,"")}${Dr}`,{"content-type":r,...i}=l,o;try{o=e.socket?e.socket(t,i,[Qt]):Kr(t,i)}catch{return fn()}_=o,re=!1,o.onopen=()=>{_===o&&o.send(JSON.stringify({t:"hello",seq:pt(k),protocol:tt,wire:Yt,opFormat:_e.op,...e.build?{build:e.build.slice(0,64)}:{},...e.hostProtocol!==void 0?{hostProtocol:e.hostProtocol}:{}}))},o.onmessage=u=>{if(_!==o)return;let m;try{m=JSON.parse(String(u.data))}catch{return}Ir(m)},o.onclose=()=>un(o),o.onerror=()=>{}},he,_r=()=>{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 ue)r([...$.values()])}},Ft),he.unref?.()};function un(t){if(_!==t)return;let r=re;_=void 0,re=!1,Fe=null,r&&(ee("offline"),_r()),fn()}let fn=()=>{if(X)return;let t=Zt(e.backoff,Oe);Oe++,Se=setTimeout(ln,t)},pn=x.applyAll.bind(x),jr=x.undo.bind(x),qr=x.previewAll.bind(x);x.previewAll=(t,r)=>qr(t,{...e.principal?{author:e.principal}:{},...r});let De=s.refusals,Ie=[],Qe=t=>({reason:"invalid",sentence:t}),Ze=s.conflicts,St=!1,mn,Pt=async(t,r)=>{if(r instanceof Be||ie)return;let i=r instanceof We?r.refusal:wn(r),o=i.sentence,u=r instanceof we?mn?.yoursOf(x,ne.get(t)?.calls??[]):void 0;ae(t);try{C([],[t])}catch{}let m=ne.get(t);if(ne.delete(t),r instanceof we&&E.conflicts++,r instanceof we&&!z()&&await Z().catch(()=>[]),r instanceof we&&K&&await K,r instanceof we&&Ze.size>0){let b=!1,g={sentence:o,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,St=!0;try{x.applyAll(u?[u.over(k)]:m.calls,{...m.intent?{intent:m.intent}:{},...m.via?{via:m.via}:{},...Ae(m)})}finally{St=!1}}}};for(let J of Ze)J(g);return}for(let b of De)b(o,i)},zr=(t,r)=>t.flatMap(i=>i.mutation?.name===gn?[]:i.primitives.flatMap(o=>o.op==="splice-text"&&!r.has(o.id)&&!r.has(`${o.id}\0${o.field}`)?[{node:o.id,field:o.field,rev:k}]:[]));x.applyAll=(t,r)=>{let i=vn(x.log.all().filter(b=>I.has(b.batch))),o=pn(t,{...e.principal?{author:e.principal}:{},...r}),u=t.map((b,g)=>{let J=o.minted?.[g];return J===void 0||b.args?.id!==void 0?b:{...b,mintedHint:J}});q.push(o.batch),I.add(o.batch),ne.set(o.batch,{calls:u,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...Ae(r)});let m=St?[]:[...oe.baseFor(o.ops,i,(b,g)=>x.collaborative(b,g)),...zr(o.ops,i)];return A.set(o.batch,be(Ye({calls:u,...r?.intent?{intent:r.intent}:{},batch:o.batch,...m.length>0?{base:m}:{},...r?.via?{via:r.via}:{},...Ae(r)},o.batch).catch(b=>Pt(o.batch,b)))),o},x.apply=(t,r)=>x.applyAll([t],r),x.undo=(t,r)=>{let i=typeof t=="string"?[t]:t,o=jr(i.map(m=>xe.get(m)??m),{...e.principal?{author:e.principal}:{},...r});q.push(o.batch),I.add(o.batch);let u=Promise.allSettled(i.map(m=>A.get(m)));return A.set(o.batch,be(u.then(()=>{let m=i.filter(b=>!$e.has(b));if(m.length===0){ae(o.batch),ne.delete(o.batch),C([],[o.batch]);return}return Ye({undo:m.map(b=>xe.get(b)??b),...r?.intent?{intent:r.intent}:{},batch:o.batch,...r?.via?{via:r.via}:{},...Ae(r)},o.batch)}).catch(m=>Pt(o.batch,m)))),o};let Gr=async(t,r={})=>{kt++;try{return(await be(Ye({calls:t,...r}))).ops}finally{kt--}},kt=0,hn={here(t){T=t,y()},onWho(t){return ue.add(t),$.size>0&&t([...$.values()]),()=>{ue.delete(t)}},leave(){if(!T)return;let t=JSON.stringify({participant:Q??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(()=>{})}},Et=e.pollMs??800,Xe=Et>0&&typeof setInterval=="function"?setInterval(()=>{z()||Z().catch(()=>{})},Et):null;if(p){ln();let t;await Promise.race([Ve,new Promise(r=>t=setTimeout(r,e.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!ie){let t=[],r=new Set(x.log.all().map(i=>i.batch));for(let i of n)if(!(i.batch!==void 0&&r.has(i.batch)))try{x.applyAll(i.calls,{...i.intent?{intent:i.intent}:{},...i.batch?{batch:i.batch}:{},...i.via?{via:i.via}:{},...Ae(i)})}catch(o){t.push(Oo(i,o))}t.length>0&&Ie.push(Qe(`${a} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}let yn=new Map,Ur=()=>({store:x,author:e.principal,appliedAll:pn,pending:q,provisional:I,asked:ne,answers:A,letGo:$e,sent:(t,r)=>be(Ye({calls:r,batch:t},t).catch(i=>Pt(t,i))),settle:ae,land:C,seen:()=>k,gone:()=>X||ie});return{remote:{store:x,typing(t,r){let i=`${t}\0${r}`,o=yn.get(i);return o||(o=(__graviewPreload(import.meta.url,["./chunk.XWXYC3BJ.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.DQNN5FE5.js")).then(u=>(mn=u,u.typingOf(t,r,u.wireOf(Ur())))),yn.set(i,o)),o},version:F.version,migrated:F.migrated??[],send:Gr,pull:Z,onRefusal(t){De.add(t);let r=Ie;Ie=[];for(let i of r)t(i.sentence,i);return()=>De.delete(t)},onDeclaration(t){return wt.add(t),()=>wt.delete(t)},onBuild(t){return vt.add(t),s.otherBuild!==void 0&&t(s.otherBuild),()=>vt.delete(t)},onConflict(t){return Ze.add(t),()=>Ze.delete(t)},revision:(t,r)=>oe.of(t,r),seq:()=>k,participant:()=>Q,transport:()=>z()?"socket":"poll",status:se,onStatus(t){return v.add(t),()=>v.delete(t)},held:()=>P,onHeld(t){return s.helds.add(t),P!==void 0&&t(P),()=>s.helds.delete(t)},counters:()=>({...E}),who:()=>[...$.values()],pending:()=>q.length+kt,async settled(){for(;ce.size>0;)await Promise.allSettled([...ce])},presence:hn,close(){Xe&&clearInterval(Xe),Re(),hn.leave(),X=!0,Se&&clearTimeout(Se),V&&clearTimeout(V),he&&clearTimeout(he);for(let r of L.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of j.splice(0))r();let t=_;_=void 0,re=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=Ie;return Ie=[],t}};function Kr(t,r){let i=globalThis.WebSocket;if(!i)throw new Error("This runtime has no WebSocket; the client polls instead.");let o=typeof globalThis.document<"u",u=e.subprotocol?[Qt]:[];if(!o)try{return new i(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 i(m.toString(),u):new i(m.toString())}}function Bo(e,n,a=Date.now()){let s,d=e?.trim();if(d)if(/^\d+(\.\d+)?$/.test(d))s=Number(d)*1e3;else{let p=Date.parse(d);Number.isFinite(p)&&(s=Math.max(0,p-a))}let l=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,S=l!==void 0&&l<50&&s!==void 0&&Math.abs(l*1e3-s)<1e3;return l!==void 0&&!S?l:s??1e3}function Wo(){globalThis.location?.reload?.()}function $o(){return globalThis.document?.visibilityState!=="hidden"}function Zt(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:a=250,max:s=1e4,factor:d=2}=e??{};return Math.min(s,a*d**n)*(.75+Math.random()*.5)}function ht(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 a=e.onBehalfOf;return a?.id&&(n[ge.for]=a.id),a?.roles?.length&&(n[ge.forRoles]=a.roles.join(",")),a?.name&&(n[ge.forName]=encodeURIComponent(a.name)),n}var Wr="/graview/views";function Xt(e){let n=e.fetch??fetch,a=e.url.replace(/\/$/,""),s={"content-type":"application/json",...e.principal?ht(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=v=>{if(JSON.stringify(v)!==JSON.stringify(d)){d=v;for(let E of l)E()}},p=async(v,E)=>{let L=await n(`${a}${e.path??Wr}`,{method:v,headers:s,...E!==void 0?{body:JSON.stringify(E)}:{}}),P=await L.json();if(!L.ok)throw new Error(P.error??`The store answered ${L.status}.`);S({hidden:P.hidden??[],removed:P.removed??[],may:P.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(v){return l.add(v),()=>void l.delete(v)},hide:v=>p("POST",{hide:v}),show:v=>p("POST",{show:v}),remove:(v,E)=>p("POST",{remove:v,...E?{about:E}:{}}),async restore(v){let E=d.removed.find(L=>L.name===v)?.lens;await p("POST",{restore:v}),E&&await e.onDeclaration?.()},async lens(v){await p("POST",{lens:v}),await e.onDeclaration?.()}}}var tn=document.getElementById("graview-app"),en=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),$r=en?(__graviewPreload(import.meta.url,["./chunk.B7LBG4UP.js","./chunk.7G4M2PX3.js","./chunk.UGFDSE37.js","./chunk.NNUUD26E.js","./chunk.OJ64WTLW.js","./chunk.GMAXA5GV.js","./chunk.IBJBCZKG.js","./chunk.NQ26KMSQ.js","./chunk.GJQF7I22.js","./chunk.SPU3BVAO.js","./chunk.OPCBZNKF.js","./chunk.UK5F3S2N.js","./chunk.2VJ52LGS.js","./chunk.JI2UVZUU.js","./chunk.CTOBNZLM.js","./chunk.34HGT7HQ.js","./chunk.TNL2BVCH.js","./chunk.NZDHXREL.js","./chunk.TBSPEO2L.js","./chunk.5ON3JSAK.js","./chunk.3SBTQ66X.js","./chunk.SSAY4ITS.js","./chunk.XOZU4OFA.js","./chunk.Z7N3MJ36.js","./chunk.MB7LKKUD.js","./chunk.WQLAIEWJ.js","./chunk.KK46XLGU.js","./chunk.WVUJXDXZ.js","./chunk.GLTWLQ6L.js","./chunk.ACB4TD4W.js","./chunk.XCQ7ZPR5.js","./chunk.MY5OXSS7.js","./chunk.NVRK6A7T.js","./chunk.FKJ3HIA5.js","./chunk.GZHZLJBF.js","./chunk.OW72XZF4.js","./chunk.OJGHDWI6.js","./chunk.KRODTMGR.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.APFRPN5S.js")):Me("pages");try{en?await No(decodeURIComponent(en[1])):await Io()}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),tn.replaceChildren(n),window.__graviewFailed=n.textContent}async function No(e){let n=await fetch(`/graview/document?form=${encodeURIComponent(e)}`),a=await n.json();if(!n.ok)throw new Error(a.error??`The preview server did not hand over the form (${n.status}).`);let s=await dt(a);if(!s.ok)throw new Error(rt(s.findings));let d=s.app,l=a.principal,S=await mt({app:d,url:location.origin,principal:l,...a.state?{state:a.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=d.forms?.[e]?.title??d.name;let{mount:p}=await $r;window.__graview=p(tn,{app:d,form:e,principal:l,remote:S,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function Io(){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(),s=await(async w=>{if(typeof w.module=="string")return(await import(w.module)).app;let R=await dt(w);if(!R.ok)throw new Error(rt(R.findings));return R.app})(n);if(!s||typeof s!="object"||!("schema"in s))throw new Error("The app module the preview server handed does not export an app.");let d=n.principal,l=await mt({app:s,url:location.origin,principal:d,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=s.name;let S,p=Xt({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 dt(w);R.ok&&S?.setApp(R.app,l)}});await Promise.all([$r,p.ready]),S=Jt(tn,{app:s,remote:l,principal:d,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:s.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.51",
|
|
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/
|
|
34
|
-
"@graview/
|
|
35
|
-
"@graview/
|
|
36
|
-
"@graview/tools": "0.1.
|
|
32
|
+
"@graview/core": "0.1.51",
|
|
33
|
+
"@graview/ship": "0.1.51",
|
|
34
|
+
"@graview/skills": "0.1.51",
|
|
35
|
+
"@graview/guest": "0.1.51",
|
|
36
|
+
"@graview/tools": "0.1.51"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=22"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{G as l,N as p,U as k,W as y,c}from"./chunk.CDZVUCEK.js";import"./chunk.QAUZDLDA.js";import"./chunk.3SY6WWWQ.js";import"./chunk.UGFDSE37.js";import{b as m}from"./chunk.ATWNWPME.js";import"./chunk.GZEZMU2T.js";import"./chunk.4VJARLJ5.js";import"./chunk.5RNB6IC5.js";import"./chunk.ZITDUHX3.js";import"./chunk.ETWREHXF.js";import"./chunk.YZ6UKKEL.js";import"./chunk.FFPG4PHX.js";import"./chunk.3L5USMQD.js";import"./chunk.GTUBIJTP.js";import"./chunk.DUIKIJKC.js";import"./chunk.73BJYIYS.js";import"./chunk.OKQ4JXTW.js";import"./chunk.M5RHVUZ6.js";import"./chunk.MRUDTYOL.js";import"./chunk.OUNLAMBA.js";import"./chunk.HGP3Q7QX.js";import"./chunk.QSZLY62B.js";import"./chunk.7VX6TBNY.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.6SHF6IL5.js";import"./chunk.MQISKON2.js";import"./chunk.GQX57JIE.js";import"./chunk.LJXAZ5TF.js";import"./chunk.QFI4L2HK.js";import"./chunk.KFHXTHIY.js";import"./chunk.GZHZLJBF.js";import"./chunk.JLR74UFP.js";import"./chunk.OJGHDWI6.js";import"./chunk.HG34MT7C.js";import"./chunk.TT6QBWRA.js";import"./chunk.UCS3CBT4.js";import"./chunk.O6SKKF4V.js";import"./chunk.ZK446PSX.js";import{G as S,H as s,I as d,S as f,aa as g}from"./chunk.SGMVLKZO.js";import"./chunk.SDO3U72B.js";import"./chunk.BLS2G3CD.js";import"./chunk.EJUZGIQ5.js";import{b as n}from"./chunk.AJZBJBMO.js";var u=n(S(),1);var t=n(f(),1);function D({context:a}){let r=l(),h=g(),[w]=(0,u.useState)(()=>s(null)),o=d(h?.seatTalk??w),P=()=>{(window.history.state?.idx??0)>0?r(-1):r("/")};return(0,t.jsxs)(k,{context:a,"data-testid":"draft-page",children:[(0,t.jsx)(y,{context:a,...o.draft?{"data-testid":"draft-title"}:{},children:o.draft?o.draft.title:"Nothing drawn"}),o.draft?(0,t.jsx)(m,{page:!0,go:e=>r(e.address),onPick:e=>{let i=a.store.graph.getNode(e);i&&r(c(a.store.schema,i.kind,e))},onDiscard:P}):(0,t.jsxs)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:["Ask for a way of seeing \u2014 \u201Ca board of tasks by status\u201D \u2014 and it is drawn here."," ",(0,t.jsx)(p,{to:"/",style:{color:"var(--graview-accent)"},children:"Home \u2192"})]})]})}export{D as DraftPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./chunk.GZHZLJBF.js";import{n as P}from"./chunk.JLR74UFP.js";import"./chunk.OJGHDWI6.js";import"./chunk.HG34MT7C.js";import"./chunk.TT6QBWRA.js";import"./chunk.UCS3CBT4.js";import"./chunk.O6SKKF4V.js";import"./chunk.ZK446PSX.js";import{G as A,S,aa as b}from"./chunk.SGMVLKZO.js";import"./chunk.SDO3U72B.js";import{Ba as w,Hc as x,oa as L}from"./chunk.BLS2G3CD.js";import"./chunk.EJUZGIQ5.js";import{b as R}from"./chunk.AJZBJBMO.js";var u=R(A(),1);var n=R(S(),1),C={kind:"human"},p={color:"var(--graview-ink-muted)"};function I(e){if(e){if(/^https?:\/\//i.test(e))try{return new URL(e).href}catch{return}return L(e)?e:void 0}}function z(e){let o=b(),t=o?.linkedReads,[i,a]=(0,u.useState)(()=>t?t.answered(e)??"asking":null);return(0,u.useEffect)(()=>{if(!t){a(o?.linkedRecords?"asking":null);return}let d=t.answered(e);if(a(d===void 0?"asking":d),d!==void 0)return;let s=!0;return t.ask(e).then(l=>s&&a(l)),()=>{s=!1}},[t,o?.linkedRecords,e.address,e.kind,e.id]),i}function V({reference:e,as:o}){let t=b(),i=z(e),a={position:"relative",zIndex:x.raised,overflowWrap:"anywhere",minWidth:0,maxWidth:"100%"};if(i==="asking")return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"asking","aria-busy":"true",style:{...p,...a},children:"Linked record"});if(i&&"denied"in i)return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"denied",style:{...p,fontStyle:"italic",...a},children:"linked record (no access)"});if(!i)return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"missing",style:{...p,fontStyle:"italic",...a},children:"linked record (not found)"});let d=I(i.href),s=t?.linkedRecords,l=t?.principal??C,g=s?.open?c=>{c.metaKey||c.ctrlKey||(c.preventDefault(),s.open(e,l))}:void 0,k=(0,n.jsx)("a",{"data-graview-linked-title":"",...d?{href:d}:{role:"link",tabIndex:0},...g?{onClick:g,onKeyDown:c=>!d&&(c.key==="Enter"||c.key===" ")?g(c):void 0}:{},style:{fontWeight:600,color:"inherit",textUnderlineOffset:3,cursor:d||g?"pointer":"default"},children:i.label});return o==="chip"?(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"found",title:i.describe,style:{display:"inline-flex",alignItems:"center",minHeight:24,...a},children:k}):(0,n.jsx)(D,{record:i,title:k,base:a})}function D({record:e,title:o,base:t}){return(0,n.jsxs)("span",{"data-graview-linked":"","data-graview-linked-state":"found",style:{display:"grid",gap:2,padding:"8px 10px",border:"1px solid var(--graview-line)",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-surface)",...t},children:[(0,n.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"2px 8px"},children:[o,e.app?(0,n.jsxs)("span",{"data-graview-linked-app":"",style:{...p,fontSize:"0.75rem"},children:["in ",e.app]}):null]}),e.describe?(0,n.jsx)("span",{"data-graview-linked-describe":"",style:{...p,fontSize:"0.8125rem"},children:e.describe}):null,e.card&&e.card.length>0?(0,n.jsx)("span",{"data-graview-linked-card":"",style:{display:"flex",flexWrap:"wrap",gap:"2px 12px",fontSize:"0.8125rem"},children:e.card.map(i=>(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{style:p,children:i.label})," ",i.text]},i.label))}):null]})}function H({relation:e,refs:o,as:t="record",nodeId:i,field:a,style:d}){let s=(0,n.jsx)("span",{"data-graview-linked-list":"",style:{display:"grid",gap:6,minWidth:0,...d},children:o.map(l=>(0,n.jsx)(V,{reference:l,as:t},w(l)))});return i&&a?(0,n.jsx)(K,{nodeId:i,field:a,relation:e,refs:o,drawn:s}):s}function K({nodeId:e,field:o,relation:t,refs:i,drawn:a}){let{fields:d,commit:s}=P(e),l=d.find(f=>f.field===o),[g,k]=(0,u.useState)(!1);if(!l)return a;let c=t.cardinality==="one"?i[0]?w(i[0]):void 0:i.map(w);return(0,n.jsxs)("span",{style:{display:"grid",gap:6,minWidth:0},children:[a,g?(0,n.jsx)(N,{relation:t,value:c,label:"Link another record",onChange:f=>{s(l,f),k(!1)},onCancel:()=>k(!1)}):(0,n.jsx)("button",{type:"button","data-graview-linked-change":"",onClick:()=>k(!0),style:{justifySelf:"start",font:"inherit",fontSize:"0.8125rem",background:"none",border:0,padding:"4px 0",color:"var(--graview-accent)",cursor:"pointer",minHeight:24},children:"Change"})]})}function N({relation:e,value:o,onChange:t,onCancel:i,label:a}){let d=b(),s=d?.linkedRecords,l=d?.principal??C,g=(0,u.useId)(),[k,c]=(0,u.useState)(""),[f,m]=(0,u.useState)("asking");(0,u.useEffect)(()=>{if(!s)return;let r=!0;m("asking");let y=setTimeout(()=>{Promise.resolve().then(()=>s.find({address:e.address,kinds:e.kinds,query:k,limit:20},l)).then(h=>r&&m(Array.isArray(h)?h:"denied"),()=>r&&m([]))},150);return()=>{r=!1,clearTimeout(y)}},[s,e.address,e.kinds.join(","),k,l.kind,l.id]);let v=new Set([o].flat().filter(r=>typeof r=="string")),W=r=>{let y=w(r);if(e.cardinality==="one")return t(y);t(v.has(y)?[...v].filter(h=>h!==y):[...v,y])};return s?(0,n.jsxs)("span",{"data-graview-linked-picker":"",style:{display:"grid",gap:6,minWidth:0},children:[(0,n.jsx)("label",{htmlFor:g,style:{...p,fontSize:"0.8125rem"},children:a}),(0,n.jsx)("input",{id:g,type:"search",value:k,placeholder:`Find one in ${e.address}`,onChange:r=>c(r.target.value),style:{font:"inherit",minHeight:32,padding:"4px 8px",border:"1px solid var(--graview-line)",borderRadius:6,background:"var(--graview-surface)",color:"inherit",minWidth:0}}),f==="asking"?(0,n.jsx)("span",{"aria-busy":"true",style:p,children:"Looking\u2026"}):f==="denied"?(0,n.jsx)("span",{"data-graview-linked-state":"denied",style:{...p,fontStyle:"italic"},children:"linked record (no access)"}):f.length===0?(0,n.jsx)("span",{style:p,children:"Nothing there matches."}):(0,n.jsx)("ul",{role:"list",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:4},children:f.map(r=>{let y=v.has(w(r));return(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button","data-graview-linked-candidate":w(r),"aria-pressed":y,onClick:()=>W(r),style:{display:"grid",gap:2,width:"100%",textAlign:"start",font:"inherit",padding:"6px 8px",minHeight:32,border:"1px solid var(--graview-line)",borderRadius:6,background:y?"var(--graview-accent-soft, var(--graview-surface))":"var(--graview-surface)",color:"inherit",cursor:"pointer"},children:[(0,n.jsx)("span",{style:{fontWeight:600},children:r.label}),r.describe?(0,n.jsx)("span",{style:{...p,fontSize:"0.8125rem"},children:r.describe}):null]})},w(r))})}),i?(0,n.jsx)("button",{type:"button",onClick:i,style:{justifySelf:"start",font:"inherit",fontSize:"0.8125rem",background:"none",border:0,padding:"4px 0",color:"var(--graview-ink-muted)",cursor:"pointer",minHeight:24},children:"Keep it as it is"}):null]}):(0,n.jsxs)("span",{"data-graview-linked-picker":"","data-graview-linked-state":"no-host",style:p,children:["This page cannot read ",e.address,", so nothing there can be linked here."]})}var U=e=>(0,n.jsx)(H,{...e}),j=e=>(0,n.jsx)(N,{...e});export{N as LinkedPicker,H as LinkedRecordView,j as drawLinkedPicker,U as drawLinkedRecord};
|
|
@@ -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{s as P}from"./chunk.JLR74UFP.js";import{$ as m,Ea as S,G as M,O as w,S as y,aa as I,s as b,w as T,x as A}from"./chunk.SGMVLKZO.js";import{a as p}from"./chunk.SDO3U72B.js";import{b as f}from"./chunk.AJZBJBMO.js";var C=f(M(),1),h=f(y(),1),x=S(p(()=>(__graviewPreload(import.meta.url,["./chunk.ZK446PSX.js","./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.U6FGWVGB.js")))),O=x.part((e,n)=>(0,h.jsx)(e.Timeline,{...n}),{what:"The timeline"}),q=()=>x.prefetch();function K({face:e}){return w()?.open?(0,h.jsx)(C.Suspense,{fallback:null,children:(0,h.jsx)(O,{face:e})}):null}var i=f(M(),1),u=f(y(),1),v=new WeakMap,D=e=>{let n=v.get(e);return n||v.set(e,n={ask:null,doors:[],listeners:new Set}),n},k=e=>{for(let n of e.listeners)n()};function g(e,n){let t=D(e);t.ask=n,k(t)}var N=S(p(()=>(__graviewPreload(import.meta.url,["./chunk.UN2OB6OD.js","./chunk.LJXAZ5TF.js","./chunk.QFI4L2HK.js","./chunk.KFHXTHIY.js","./chunk.ZK446PSX.js","./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.CBJHYNNT.js")))),B=N.part((e,n)=>{let t=e.NotifySheet;return(0,u.jsx)(t,{...n})},{what:"Notify me"}),W=N.part((e,n)=>{let t=e.NotifiedList;return(0,u.jsx)(t,{...n})},{quiet:!0}),E=(e,n)=>n===void 0&&(e.onBehalfOf??e).id!==void 0;function F(e,n,t){let c=d=>t.tryDefinition(d)?.noun??d.replace(/[-_]+/g," "),o=e.on!==void 0?e.on:e.about.length===1?e.about[0]:void 0;if(e.act!==void 0){let d=o!==void 0&&n(o)!==void 0?o:void 0;return{label:"Notify me when someone does this\u2026",choices:[{on:"act",act:e.act,...d!==void 0?{record:d}:{}},...d!==void 0?[{on:"act",act:e.act}]:[]]}}if(o===void 0)return null;let s=n(o);if(s!==void 0)return{label:"Notify me when this changes\u2026",choices:[{on:"changed",record:o},{on:"act",record:o},{on:"reaches",kind:s,condition:"",record:o}]};let r=b(o)!==null?[b(o)]:T(o)?A(o):[];if(r.length!==1||!t.kinds.includes(r[0]))return null;let l=r[0],a=c(l);return{label:`Notify me when ${/^[aeiou]/i.test(a)?"an":"a"} ${a} is added\u2026`,choices:[{on:"created",kind:l},{on:"changed",kind:l},{on:"reaches",kind:l,condition:""}]}}function L(){let{store:e,principal:n,subscriptions:t,signIn:c}=m(),o=E(n,c);return(0,i.useMemo)(()=>o?s=>{let r=F(s,a=>e.graph.getNode(a)?.kind,e.schema);return r?{id:"notify",items:[{id:"notify-me",label:r.label,run:()=>g(t,{choices:r.choices,returnTo:s.element??null})}],prepare:()=>N.prefetch()}:null}:null,[o,e,t])}var z=[];function U({children:e}){let n=L(),t=(0,i.useMemo)(()=>n?[n]:z,[n]);return(0,u.jsx)(P,{sections:t,children:e})}function V(){let{subscriptions:e}=m(),n=(0,i.useId)(),t=D(e);(0,i.useEffect)(()=>(t.doors.push(n),k(t),()=>{t.doors.splice(t.doors.indexOf(n),1),k(t)}),[t,n]);let c=(0,i.useMemo)(()=>r=>(t.listeners.add(r),()=>void t.listeners.delete(r)),[t]),o=(0,i.useSyncExternalStore)(c,()=>t.ask,()=>null),s=(0,i.useSyncExternalStore)(c,()=>t.doors[0]===n,()=>!1);return!o||!s?null:(0,u.jsx)(i.Suspense,{fallback:null,children:(0,u.jsx)(B,{ask:o,close:()=>g(e,null)})})}function X({choices:e,label:n="Notify me",style:t,className:c,testId:o="notify-me"}){let{principal:s,subscriptions:r,signIn:l}=m();return E(s,l)?(0,u.jsx)("button",{type:"button","data-testid":o,className:c,onClick:a=>g(r,{choices:e,returnTo:a.currentTarget}),style:t,children:n}):null}function G(){let e=I(),n=e?.subscriptions,t=e?(e.principal.onBehalfOf??e.principal).id:void 0,[c,o]=(0,i.useState)(0);return(0,i.useEffect)(()=>{if(t===void 0||!n)return;let s=!0,r=()=>void Promise.resolve(n.list(t)).then(a=>s&&o(a.length),()=>s&&o(0));r();let l=n.onChange?.(r);return()=>{s=!1,l?.()}},[n,t]),c}function Y({style:e}){return G()===0?null:(0,u.jsx)(i.Suspense,{fallback:null,children:(0,u.jsx)(W,{...e?{style:e}:{}})})}export{q as a,K as b,L as c,U as d,V as e,X as f,G as g,Y as h};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./chunk.ROJZLOKZ.js";import"./chunk.VM43YREJ.js";import"./chunk.ZK446PSX.js";import"./chunk.SGMVLKZO.js";import"./chunk.SDO3U72B.js";import"./chunk.BLS2G3CD.js";import"./chunk.EJUZGIQ5.js";import"./chunk.AJZBJBMO.js";export{a as ActivityFilter,b as InteractionRow};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a}from"./chunk.JLR74UFP.js";import{$ as l,G as f,S as s}from"./chunk.SGMVLKZO.js";import{b as i}from"./chunk.AJZBJBMO.js";var d=i(f(),1),p=i(s(),1),c=new Set;function B(e){return c.add(e),()=>void c.delete(e)}function S(){let{store:e,principal:o}=l();return(0,d.useMemo)(()=>n=>{let t=n.on===void 0?void 0:e.graph.getNode(n.on);if(!t)return null;let u=[...c].filter(r=>r.store===e&&r.kind===t.kind);return(n.element?u.find(r=>r.root()?.contains(n.element)??!1):u[0])?.section(t.id,o)??null},[e,o])}function v({children:e}){let o=S(),n=(0,d.useMemo)(()=>[o],[o]);return(0,p.jsx)(a,{sections:n,children:e})}export{B as a,S as b,v as c};
|