graview 0.1.67 → 0.1.68
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.YCD4JSXD.js → chunk.2BMZPALF.js} +1 -1
- package/dist/preview/{chunk.SNHKYH72.js → chunk.2KCDLCB2.js} +1 -1
- package/dist/preview/{chunk.O2OL6RQQ.js → chunk.2ME4DVBI.js} +1 -1
- package/dist/preview/chunk.2TUEBU7X.js +8 -0
- package/dist/preview/{chunk.LYEGRY77.js → chunk.2U6HB4XU.js} +1 -1
- package/dist/preview/{chunk.7S6ZRMW4.js → chunk.32JE2WS7.js} +1 -1
- package/dist/preview/{chunk.RG5G6YQD.js → chunk.3DEWQDP7.js} +1 -1
- package/dist/preview/{chunk.GVT4UUQA.js → chunk.3JMQKANL.js} +1 -1
- package/dist/preview/{chunk.A5PSEU3W.js → chunk.3VEZ5MOC.js} +1 -1
- package/dist/preview/chunk.3WPCS6KP.js +1 -0
- package/dist/preview/{chunk.5R744JGZ.js → chunk.42C3FIKK.js} +1 -1
- package/dist/preview/{chunk.IAEGJDF3.js → chunk.42KHFGN6.js} +1 -1
- package/dist/preview/{chunk.DZMIYEHQ.js → chunk.4DXPPM6T.js} +1 -1
- package/dist/preview/chunk.4GVKKBQL.js +1 -0
- package/dist/preview/{chunk.KX5ZBHMA.js → chunk.4TT3ZHSJ.js} +1 -1
- package/dist/preview/{chunk.QXLJGHMC.js → chunk.4YAO3A5Q.js} +3 -3
- package/dist/preview/{chunk.Z4TY44CD.js → chunk.5JKUT2OM.js} +1 -1
- package/dist/preview/chunk.5L4ADKTW.js +1 -0
- package/dist/preview/{chunk.BKYZSV2Y.js → chunk.64LCHHZB.js} +1 -1
- package/dist/preview/{chunk.ZEZUKRC6.js → chunk.6AANHELP.js} +1 -1
- package/dist/preview/{chunk.ZAQ4IDX6.js → chunk.6DMCEBSO.js} +1 -1
- package/dist/preview/{chunk.NKLPL7QD.js → chunk.6IR5LBJU.js} +1 -1
- package/dist/preview/{chunk.X226YATK.js → chunk.6WB2TYK7.js} +1 -1
- package/dist/preview/chunk.6ZENHSTQ.js +1 -0
- package/dist/preview/{chunk.EJ2EZL2G.js → chunk.7K2V5FUB.js} +1 -1
- package/dist/preview/chunk.7OL6H4LF.js +1 -0
- package/dist/preview/{chunk.4W57E7AX.js → chunk.7TDML5YU.js} +1 -1
- package/dist/preview/{chunk.AJMVRFYX.js → chunk.7WPVLEX2.js} +2 -2
- package/dist/preview/{chunk.XSWSBTUO.js → chunk.7ZTGB4O7.js} +1 -1
- package/dist/preview/{chunk.FRQSLWP4.js → chunk.ACNOP2IU.js} +1 -1
- package/dist/preview/{chunk.N4ZKZ4GM.js → chunk.AENP662H.js} +1 -1
- package/dist/preview/{chunk.SFBHPYRD.js → chunk.AQ2PI6MR.js} +1 -1
- package/dist/preview/chunk.ARS4HJD2.js +1 -0
- package/dist/preview/{chunk.STPA7HBK.js → chunk.AWV57UBJ.js} +1 -1
- package/dist/preview/{chunk.D7NWMXSX.js → chunk.AYZL3LCR.js} +3 -3
- package/dist/preview/{chunk.URQTF5SY.js → chunk.BHJRT57H.js} +1 -1
- package/dist/preview/{chunk.7UHPHEH5.js → chunk.BPNW5KCP.js} +1 -1
- package/dist/preview/{chunk.TTSGCNPT.js → chunk.BQAFFEOA.js} +1 -1
- package/dist/preview/chunk.C2QKA6XY.js +1 -0
- package/dist/preview/{chunk.6KJGRM7A.js → chunk.CE3NKAF7.js} +1 -1
- package/dist/preview/{chunk.QRQ5WPZI.js → chunk.CFE3MHWZ.js} +1 -1
- package/dist/preview/{chunk.H6KIEDZN.js → chunk.CGBOPPNL.js} +1 -1
- package/dist/preview/{chunk.LP2ZMAT2.js → chunk.CNN32262.js} +1 -1
- package/dist/preview/{chunk.HJUZMOW2.js → chunk.DCLF4WWZ.js} +1 -1
- package/dist/preview/{chunk.GMLONS5L.js → chunk.DGDW54KE.js} +1 -1
- package/dist/preview/{chunk.3GNT5MKP.js → chunk.DLSS56EU.js} +1 -1
- package/dist/preview/{chunk.QAM76AXV.js → chunk.DMZRFXH7.js} +1 -1
- package/dist/preview/{chunk.Z2XUVJAL.js → chunk.DPHH5ZVL.js} +1 -1
- package/dist/preview/{chunk.Z27NSSYL.js → chunk.DZ6UDZOB.js} +2 -2
- package/dist/preview/{chunk.6W6XMLSF.js → chunk.E423JCOS.js} +1 -1
- package/dist/preview/{chunk.35KMZHB7.js → chunk.EB7PZJEO.js} +1 -1
- package/dist/preview/{chunk.V7H4BUEB.js → chunk.ECNGVD25.js} +1 -1
- package/dist/preview/{chunk.B7KZBT27.js → chunk.EGSOHTZZ.js} +1 -1
- package/dist/preview/{chunk.OCXY5DCD.js → chunk.EGVM24ND.js} +1 -1
- package/dist/preview/{chunk.UDHPMVC4.js → chunk.ENLIIZF2.js} +1 -1
- package/dist/preview/{chunk.H3EGBDW2.js → chunk.EP5JS7ZH.js} +1 -1
- package/dist/preview/{chunk.TI5FR2QQ.js → chunk.F5GNNVSQ.js} +1 -1
- package/dist/preview/chunk.FHQ25SWY.js +1 -0
- package/dist/preview/{chunk.F464JKHZ.js → chunk.FSW535EA.js} +1 -1
- package/dist/preview/{chunk.G5GVT6JY.js → chunk.FZELUSK5.js} +1 -1
- package/dist/preview/{chunk.UWS4RMM3.js → chunk.G2BDEWJC.js} +1 -1
- package/dist/preview/chunk.GF3ZCX46.js +2 -0
- package/dist/preview/{chunk.UW52CMGJ.js → chunk.GJTEV6CK.js} +1 -1
- package/dist/preview/{chunk.A7GVTE5Y.js → chunk.GKTQ5CZA.js} +2 -2
- package/dist/preview/{chunk.ZG5VGP5U.js → chunk.GONZB3J3.js} +1 -1
- package/dist/preview/{chunk.FLJXYESX.js → chunk.GRBWXTST.js} +1 -1
- package/dist/preview/{chunk.Z3O2VZAJ.js → chunk.GRTBEA7O.js} +1 -1
- package/dist/preview/{chunk.QNP5OR3P.js → chunk.H3IGXHZR.js} +2 -2
- package/dist/preview/{chunk.ILJDLBPJ.js → chunk.H3W5C3XQ.js} +1 -1
- package/dist/preview/{chunk.O5VFKVZS.js → chunk.H4VNIAHN.js} +1 -1
- package/dist/preview/{chunk.7ARRVNUR.js → chunk.HH4D3JEI.js} +1 -1
- package/dist/preview/{chunk.MUSMNKE4.js → chunk.HWFJQ42Y.js} +1 -1
- package/dist/preview/{chunk.37RFCHSS.js → chunk.HXTKBISQ.js} +1 -1
- package/dist/preview/{chunk.J2OPIS3H.js → chunk.I34BWUB4.js} +1 -1
- package/dist/preview/{chunk.ZAPS4J6G.js → chunk.I63462I3.js} +1 -1
- package/dist/preview/{chunk.6UQFV53C.js → chunk.IKKKHHRN.js} +1 -1
- package/dist/preview/{chunk.GRFD42WM.js → chunk.IPGLITWA.js} +1 -1
- package/dist/preview/{chunk.3NSV3WKM.js → chunk.IT5DVKXY.js} +2 -2
- package/dist/preview/{chunk.JQ2WNKDW.js → chunk.IXMIU4D4.js} +1 -1
- package/dist/preview/{chunk.JVB5KDSG.js → chunk.JCETQQ7J.js} +1 -1
- package/dist/preview/{chunk.M7KXQGQL.js → chunk.JGRSUTPJ.js} +1 -1
- package/dist/preview/{chunk.KFT7JIEH.js → chunk.JLDJZET2.js} +1 -1
- package/dist/preview/{chunk.JQ63N4MZ.js → chunk.JULD4XFB.js} +1 -1
- package/dist/preview/{chunk.LVOTLGJB.js → chunk.JV432T4Q.js} +1 -1
- package/dist/preview/{chunk.6SJEZWH3.js → chunk.KAM73WVF.js} +1 -1
- package/dist/preview/{chunk.AKJS2NUM.js → chunk.KUCBNMIY.js} +1 -1
- package/dist/preview/{chunk.DWM7AR5Y.js → chunk.L7XKYGV7.js} +1 -1
- package/dist/preview/{chunk.EP6Q32WT.js → chunk.LFFJB6D3.js} +1 -1
- package/dist/preview/{chunk.264PB572.js → chunk.LMTG5NPG.js} +1 -1
- package/dist/preview/{chunk.EGPCVMDU.js → chunk.LOKGUALC.js} +1 -1
- package/dist/preview/{chunk.FPHRAO3R.js → chunk.LZ6MSQ5O.js} +1 -1
- package/dist/preview/chunk.MBTEOF4R.js +1 -0
- package/dist/preview/{chunk.RJY7VJBH.js → chunk.MIOLBZBS.js} +1 -1
- package/dist/preview/{chunk.G3GFDVO2.js → chunk.MK5RPEB2.js} +1 -1
- package/dist/preview/{chunk.NSOPYIT4.js → chunk.MKL4THIV.js} +1 -1
- package/dist/preview/{chunk.FVQKSN33.js → chunk.MPWLDQOG.js} +1 -1
- package/dist/preview/chunk.MSUZAJ2K.js +4 -0
- package/dist/preview/{chunk.MSAYU25L.js → chunk.N5Z34V7U.js} +1 -1
- package/dist/preview/chunk.N64RVSH3.js +1 -0
- package/dist/preview/{chunk.HAOB6O72.js → chunk.ND3DEDWB.js} +1 -1
- package/dist/preview/{chunk.GFLH7RCI.js → chunk.NFTPJAMJ.js} +1 -1
- package/dist/preview/{chunk.QZQCQWQG.js → chunk.NRCWMYLH.js} +1 -1
- package/dist/preview/{chunk.47XEJZ3O.js → chunk.O2VXTYUJ.js} +1 -1
- package/dist/preview/{chunk.6N4PE3U5.js → chunk.O32F6LGK.js} +1 -1
- package/dist/preview/{chunk.PZ7KY6XH.js → chunk.O5FTWXA2.js} +1 -1
- package/dist/preview/{chunk.T2OUHRAA.js → chunk.ODYJEDIW.js} +1 -1
- package/dist/preview/{chunk.DKEIEH2D.js → chunk.OQ4ZO3YY.js} +1 -1
- package/dist/preview/chunk.PI4RFOBU.js +1 -0
- package/dist/preview/{chunk.E5PYNAYT.js → chunk.PIMAG4WT.js} +2 -2
- package/dist/preview/{chunk.EFVSZKB5.js → chunk.PLIV3IQK.js} +1 -1
- package/dist/preview/{chunk.77C556NM.js → chunk.PPCDPYYU.js} +1 -1
- package/dist/preview/{chunk.MW7R5G3C.js → chunk.PZQ5P6WK.js} +1 -1
- package/dist/preview/chunk.Q42R2KW4.js +1 -0
- package/dist/preview/{chunk.WEMUKZKH.js → chunk.Q4VFLLUT.js} +1 -1
- package/dist/preview/{chunk.SY5ID44D.js → chunk.Q6H5HESF.js} +1 -1
- package/dist/preview/chunk.QM54TGU6.js +3 -0
- package/dist/preview/{chunk.HN4ZJ4B4.js → chunk.QOQ26NXM.js} +1 -1
- package/dist/preview/{chunk.SJQPTDAT.js → chunk.QUETLFBJ.js} +1 -1
- package/dist/preview/{chunk.P2EKKKK2.js → chunk.QWLK3GKG.js} +1 -1
- package/dist/preview/{chunk.JEC5FDKX.js → chunk.QYPU444Y.js} +1 -1
- package/dist/preview/{chunk.TXZQEJ5T.js → chunk.QZP3ARLH.js} +1 -1
- package/dist/preview/{chunk.WALVW3KJ.js → chunk.R3GE37OI.js} +1 -1
- package/dist/preview/chunk.R66ZVMWB.js +1 -0
- package/dist/preview/{chunk.YZPESGCP.js → chunk.RQG672MJ.js} +1 -1
- package/dist/preview/chunk.RYA7A4NA.js +1 -0
- package/dist/preview/{chunk.LRNFE3UK.js → chunk.SADR3MQI.js} +1 -1
- package/dist/preview/{chunk.MJY4SLWA.js → chunk.SS6KL5NT.js} +1 -1
- package/dist/preview/chunk.SUG6LIOX.js +1 -0
- package/dist/preview/{chunk.SO6NT5K7.js → chunk.TFJA4QV4.js} +1 -1
- package/dist/preview/{chunk.D4WJ7OM5.js → chunk.TOUSIUJF.js} +1 -1
- package/dist/preview/{chunk.ARWO4WOV.js → chunk.TR4YFVZN.js} +1 -1
- package/dist/preview/{chunk.XFLGSUYO.js → chunk.TRNJKHIA.js} +1 -1
- package/dist/preview/{chunk.5AKZROMR.js → chunk.TVWK3SGD.js} +1 -1
- package/dist/preview/chunk.U7PAFLUM.js +1 -0
- package/dist/preview/{chunk.NKYWIGC7.js → chunk.UAMPR4MD.js} +1 -1
- package/dist/preview/{chunk.UGQYMN4J.js → chunk.UD7VLXPM.js} +1 -1
- package/dist/preview/{chunk.UQIPEMJ5.js → chunk.UFURYU4R.js} +1 -1
- package/dist/preview/{chunk.R6JBA7UK.js → chunk.UODTUBQ7.js} +1 -1
- package/dist/preview/{chunk.NRURQGXV.js → chunk.VES4XMZX.js} +1 -1
- package/dist/preview/{chunk.QWGWOEBZ.js → chunk.VLXLBGMY.js} +1 -1
- package/dist/preview/{chunk.IDALEKIW.js → chunk.VTDOWXCP.js} +1 -1
- package/dist/preview/{chunk.4EMKCKDB.js → chunk.VV5JAM5W.js} +1 -1
- package/dist/preview/{chunk.JU6UFWS3.js → chunk.VW632VNJ.js} +1 -1
- package/dist/preview/{chunk.25QFDTCU.js → chunk.WC5WE34A.js} +1 -1
- package/dist/preview/chunk.WN7SAAH6.js +1 -0
- package/dist/preview/{chunk.4UUJHLHR.js → chunk.WV45KLXC.js} +1 -1
- package/dist/preview/{chunk.NAXOXBOF.js → chunk.XDZDNZ7B.js} +1 -1
- package/dist/preview/{chunk.MAKCZ6B6.js → chunk.XFH6GHBQ.js} +1 -1
- package/dist/preview/{chunk.2VUX54XH.js → chunk.XRE7SHLD.js} +1 -1
- package/dist/preview/{chunk.J6HF7IRQ.js → chunk.XXCHO2A5.js} +1 -1
- package/dist/preview/{chunk.A4EZAGG7.js → chunk.Y7OGJOPA.js} +1 -1
- package/dist/preview/{chunk.6NG76MDA.js → chunk.YBQ5GVAX.js} +2 -2
- package/dist/preview/{chunk.QF5QB5YR.js → chunk.YL2RBZFE.js} +1 -1
- package/dist/preview/{chunk.RSQ432QN.js → chunk.YM6SWEUI.js} +1 -1
- package/dist/preview/{chunk.7BJRHPE3.js → chunk.Z2X7BFCB.js} +2 -2
- package/dist/preview/{chunk.VBLQJVQ5.js → chunk.Z67LBSQO.js} +1 -1
- package/dist/preview/{chunk.OHAO6KKH.js → chunk.ZKXIZBCN.js} +1 -1
- package/dist/preview/{chunk.BDNQMKDG.js → chunk.ZLEBOR5T.js} +1 -1
- package/dist/preview/{chunk.CKDCTFLU.js → chunk.ZLNUZ6LR.js} +1 -1
- package/dist/preview/chunk.ZMADWPJO.js +1 -0
- package/dist/preview/chunk.ZO6VMEPP.js +1 -0
- package/dist/preview/chunk.ZUG7U7AT.js +1 -0
- package/dist/preview/index.html +55 -55
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.2FHIINXG.js +0 -2
- package/dist/preview/chunk.3ENPWZBG.js +0 -1
- package/dist/preview/chunk.3ZODN6BW.js +0 -1
- package/dist/preview/chunk.55G4IPOO.js +0 -1
- package/dist/preview/chunk.5J6DVR7S.js +0 -1
- package/dist/preview/chunk.7WHQWLL6.js +0 -1
- package/dist/preview/chunk.B5SJMCTT.js +0 -7
- package/dist/preview/chunk.CTUJZ3IV.js +0 -1
- package/dist/preview/chunk.CY7FFKEZ.js +0 -1
- package/dist/preview/chunk.DEKRFTRN.js +0 -4
- package/dist/preview/chunk.EBKH3ILT.js +0 -1
- package/dist/preview/chunk.FOUBDGL3.js +0 -1
- package/dist/preview/chunk.HB5NWHFP.js +0 -3
- package/dist/preview/chunk.HVBKI5ZO.js +0 -1
- package/dist/preview/chunk.I3SDKMQS.js +0 -1
- package/dist/preview/chunk.J5OLYVZ4.js +0 -1
- package/dist/preview/chunk.JKFVNQY7.js +0 -1
- package/dist/preview/chunk.KGMSSXZL.js +0 -1
- package/dist/preview/chunk.NXZL5CA2.js +0 -1
- package/dist/preview/chunk.PSNMZBVS.js +0 -1
- package/dist/preview/chunk.R7CRBRD4.js +0 -1
- package/dist/preview/chunk.RR25BGWP.js +0 -1
- package/dist/preview/chunk.T27QKVKP.js +0 -1
- package/dist/preview/chunk.T3WCRS6M.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{c as st}from"./chunk.OCXY5DCD.js";import{a as Ye}from"./chunk.CEQQIW7Z.js";import{a as B,b as He,c as G,d as q,e as ae,g as me,h as Se,i as Fe,j as X}from"./chunk.H6KIEDZN.js";import"./chunk.264PB572.js";import{a as Ke,b as Je,c as Xe,d as Qe}from"./chunk.32SHA3EY.js";import{h as Be}from"./chunk.GG47EIKO.js";import{a as Me,b as Le}from"./chunk.NYLKG25K.js";import{h as J,i as et,k as tt}from"./chunk.EFVSZKB5.js";import{e as Ze}from"./chunk.G3GFDVO2.js";import{b as ye,c as We,f as Ge,g as qe}from"./chunk.D4WJ7OM5.js";import{d as ze}from"./chunk.QDVGHI7R.js";import{f as _e,g as Ve}from"./chunk.AKJS2NUM.js";import{a as ie,c as ne,d as he,e as Ue,h as le,j as ge}from"./chunk.M5FP4Y4Q.js";import{d as rt,k as nt}from"./chunk.RSMCTI2N.js";import"./chunk.URQTF5SY.js";import{a as xe,b as je,c as De}from"./chunk.LP2ZMAT2.js";import"./chunk.B7KZBT27.js";import"./chunk.MUSMNKE4.js";import{Mb as pe,Pb as fe,Qd as Pe,la as Ie,me as Ce,ne as Re}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var It="http://www.w3.org/1999/xhtml",se=class{constructor(t){this.ownerDocument=t}parentNode=null;childNodes=[];get firstChild(){return this.childNodes[0]??null}get parentElement(){return this.parentNode instanceof F?this.parentNode:null}get textContent(){return this.childNodes.map(t=>t.textContent).join("")}insertBefore(t,n){t.parentNode&&t.parentNode.removeChild(t);let s=n?this.childNodes.indexOf(n):-1;return s<0?this.childNodes.push(t):this.childNodes.splice(s,0,t),t.parentNode=this,t}appendChild(t){return this.insertBefore(t,null)}removeChild(t){let n=this.childNodes.indexOf(t);return n>=0&&this.childNodes.splice(n,1),t.parentNode=null,t}},Q=class extends se{constructor(n,s){super(n);this.data=s}nodeType=3;get textContent(){return this.data}},$e=class extends se{nodeType=8;get textContent(){return""}},F=class extends se{constructor(n,s,a){super(n);this.namespaceURI=s;this.localName=a}nodeType=1;attributes=new Map;value="";checked=!1;selected=!1;setAttribute(n,s){this.attributes.set(n,String(s))}removeAttribute(n){this.attributes.delete(n)}getAttribute(n){return this.attributes.get(n)??null}hasAttribute(n){return this.attributes.has(n)}closest(n){for(let s=this;s;s=s.parentElement)if(s.localName===n)return s;return null}},Ae=class extends se{nodeType=9;constructor(){super(null)}createElementNS(t,n){return new F(this,t,n)}createElement(t){return new F(this,It,t)}createTextNode(t){return new Q(this,t)}createComment(t){return new $e(this)}};function ot(){let e=new Ae,t=e.createElement("div");return t.setAttribute("data-graview-view-root",""),e.appendChild(t),{document:e,root:t}}var de=function*(e){for(let t of e.childNodes)t instanceof F&&(yield t,yield*de(t))},be=(e,t,n)=>{for(let s=e;s&&s!==t;s=s.parentElement)if(n(s))return s},at=e=>{let t=["id","class","data-record","data-place","data-act","role","name"].flatMap(n=>e.getAttribute(n)===null?[]:[` ${n}="${e.getAttribute(n).slice(0,80)}"`]);return`<${e.localName}${t.join("")}>`},it=e=>e.childNodes.map(t=>t instanceof F?it(t):t.nodeType===3?t.textContent:"").join("");function Te(e,t,n){let s=n.typed??{},a=[],l=[...de(e)].filter(u=>u.getAttribute("data-act")!==null).map(u=>u.getAttribute("data-act"));for(let u of de(e)){let i=u.getAttribute("name");if(!i||!["input","select","textarea"].includes(u.localName))continue;let f=(u.getAttribute("type")??"text").toLowerCase(),m=Object.hasOwn(s,i);if(f==="radio"){let b=u.getAttribute("value")??"on";if(m?String(s[i])!==b:!u.checked)continue;a.push({name:i,value:b,typed:m,empty:!1,chosen:!0})}else if(u.localName==="select"){let b=[...de(u)].filter(T=>T.localName==="option"),o=b.find(T=>T.selected||T.getAttribute("selected")!==null)??b[0],N=m?String(s[i]):o?o.getAttribute("value")??it(o).trim():"";a.push({name:i,value:N,typed:m,empty:N===""&&!m,chosen:!0})}else if(f==="checkbox"){let b=m?s[i]===!0||s[i]==="true"||s[i]==="on":u.checked;a.push({name:i,value:b,typed:m,empty:!b&&!m})}else{let b=be(u,e,k=>k.getAttribute("data-record")!==null)?.getAttribute("data-record")??t,o=u.value===""&&u.getAttribute("data-prefill")===i&&b?tt(n.store,n.principal,n.manifest,n.shown,{record:b,field:i,acts:l}):void 0,N=o!==void 0?{record:b,field:i,value:o}:void 0,T=m?s[i]:o??u.value,y=(f==="number"||f==="range")&&T!==""&&Number.isFinite(Number(T))?Number(T):typeof T=="boolean"?String(T):T;a.push({name:i,value:y,typed:m||N!==void 0,empty:y===""&&!m&&!N,...N?{from:N}:{}})}}return a}function lt(e,t,n,s){let a=n.asked.slice(e.asked),l=n.went.slice(e.went),u=n.renders.length>e.renders,i=e.target!==void 0?t.elementOf(e.target):void 0,f=[...a.map(y=>`its code asked for "${y.name}"`),...l.map(y=>`its code asked to go to "${"record"in y?y.record:y.place}"`),...u?["it drew again"]:[]],m=f.length>0?` When the view heard the click, ${f.join(", ")}.`:"";if(!i)return{selector:e.selector,asked:a,went:l,redrew:u,says:`"${e.selector}" matches nothing the view drew: there is nothing there to press.`};let b=t.root,o={},N=[],T=ge(i,b,y=>le(y,[...de(y)].some(ie)));if(T){let y=T.getAttribute("data-filter"),k=T.getAttribute("data-section"),v=T.getAttribute("data-record"),$={...y?{where:me(y)}:{},...k?{section:k}:{}},c=v?{record:v,...$}:{place:T.getAttribute("data-place")??"",...$},h=X(c,{sees:r=>s.shown.has(r),places:s.places,lists:s.lists,schema:s.store.schema});if(h.ok){o.opens=h.arrival;let r=h.arrival,d="filter"in r&&r.filter?`, narrowed to ${r.filter}`:"";N.push(`It opens ${"record"in r?`the record "${r.record}"`:"place"in r?`the place "${r.place}"`:`the list of ${r.list}`}${d}${r.section?`, at "${r.section}"`:""}.`)}else{let r="place"in c?c.place:c.record,d=!("record"in c&&s.shown.has(c.record))&&!B(s.places,r)&&!s.lists.some(g=>g.slug===r||g.kind===r);o.lost=s.placesUnsure&&d?`${h.says}${q}`:h.says,N.push(`It lands in a link that goes nowhere: ${o.lost}`)}}let p=be(i,b,y=>y.getAttribute("data-act")!==null);if(p){let y=p.getAttribute("data-act"),k=ne(p);if(k)N.push(`It is bound to "${y}", and is never pressed: ${k}`);else if(he(p)){let v=be(p,b,d=>d.getAttribute("data-record")!==null)?.getAttribute("data-record")??void 0,$=be(p,b,d=>d.localName==="fieldset"||d.getAttribute("role")==="group")??b,c={as:y,...v!==void 0?{record:v}:{},fields:Te($,v,s)},h=J(s.store,s.manifest,s.shown,c);if(!h.ok)o.act={as:y,ok:!1,reason:h.reason,message:h.message};else try{let d=s.store.previewAll([{name:h.name,args:h.args}],{author:s.principal,via:`view:${s.manifest.name}`});o.act={as:y,ok:!0,name:h.name,args:h.args,intent:d.intent,changes:d.ops.length>0}}catch(d){o.act=d instanceof pe?{as:y,ok:!1,reason:"refused",message:d.refusal.message}:d instanceof fe?{as:y,ok:!1,reason:"failed",message:_e(d)}:{as:y,ok:!1,reason:"failed",message:"The act could not be applied."}}let r=o.act;N.push(r.ok?`It asks for "${r.name}" with ${JSON.stringify(r.args)}: ${r.changes?`\u201C${r.intent}\u201D, applied for this seat, were it pressed.`:"applied for this seat, it would change nothing."}`:`It asks for "${y}", which the host refuses (${r.reason}): ${r.message}`)}}return N.length===0&&N.push(`It is bound to no act and lands in no link: the host does nothing there${f.length>0?"":", and the view's code does nothing either"}.`),{selector:e.selector,element:at(i),...o,asked:a,went:l,redrew:u,says:`A press on ${at(i)}: ${N.join(" ")}${m}`}}var ce=function*(e){for(let t of e.childNodes)t instanceof F&&(yield t,yield*ce(t))},we=(e,t,n)=>{for(let s=e;s&&s!==t;s=s.parentElement)if(n(s))return s},pt=e=>e.childNodes.map(t=>t instanceof F?t.getAttribute("aria-hidden")==="true"?"":pt(t):t.nodeType===3?t.textContent:"").join(""),ft=e=>{let t=["id","class","data-record","data-place","data-act","data-file","href","role","name"].flatMap(n=>e.getAttribute(n)===null?[]:[` ${n}="${e.getAttribute(n).slice(0,80)}"`]);return`<${e.localName}${t.join("")}>`},P=e=>{let t=(e.getAttribute("aria-label")??pt(e)).replace(/\s+/g," ").trim()||e.getAttribute("title")||e.getAttribute("name")||"";return t?`\u201C${t.length>60?`${t.slice(0,59)}\u2026`:t}\u201D`:ft(e)},dt={number:"1",range:"1",date:"2026-01-15","datetime-local":"2026-01-15T09:00",time:"09:00",month:"2026-01",week:"2026-W03",email:"someone@example.com",url:"https://example.com",tel:"+1 555 0100",text:"A test",search:"A test",textarea:"A test"},ct=e=>e.localName==="textarea"?dt.textarea:dt[(e.getAttribute("type")??"text").toLowerCase()],ut=new Set(["input","textarea","select"]),Pt=e=>e.localName==="button"&&e.namespaceURI==="http://www.w3.org/1999/xhtml"||Ue(e)||["link","menuitem","menuitemcheckbox","menuitemradio","option"].includes(e.getAttribute("role")??"")||e.localName==="a"&&!e.hasAttribute("href")&&!e.hasAttribute("data-record")&&!e.hasAttribute("data-place")&&!e.hasAttribute("data-file"),Ct=e=>e.localName==="summary"||e.hasAttribute("data-lightbox")||e.hasAttribute("data-drop")||e.localName==="graview-video";async function mt(e){let{drawn:t,store:n,principal:s,manifest:a}=e,l=t.root,u=[...ce(l)],i=new Set(e.clicks),f=r=>we(r,l,d=>i.has(t.idOf(d)??""))!==void 0,m=new Set(u.flatMap(r=>r.getAttribute("id")?[r.getAttribute("id")]:[])),b=[],o=(r,d,g,w)=>b.push({control:P(r),element:ft(r),does:d,ok:g,says:w}),N=`view:${a.name}`,T=(r,d)=>{try{return{ok:!0,intent:n.previewAll([{name:r,args:d}],{author:s,via:N}).intent}}catch(g){return g instanceof pe?{ok:!1,message:`this seat may not: ${g.refusal.message}`,missing:!1}:g instanceof fe?{ok:!1,message:Ve(g),missing:g.issues.some(w=>/required|received undefined/i.test(w.message))}:{ok:!1,message:`the act threw: ${g instanceof Error?g.message.slice(0,200):String(g)}`,missing:!1}}},p=(r,d)=>{let g=we(r,l,O=>O.getAttribute("data-record")!==null)?.getAttribute("data-record")??void 0,w=we(r,l,O=>O.localName==="fieldset"||O.getAttribute("role")==="group")??l;return{as:r.getAttribute("data-act"),...g!==void 0?{record:g}:{},fields:Te(w,g,{store:n,principal:s,manifest:a,shown:e.shown,places:e.places,lists:e.lists,typed:d})}},y=(r,d)=>{let g=p(r,d),w=J(n,a,e.shown,g);if(!w.ok)return{ok:!1,message:w.message,missing:!1,press:g};let O=T(w.name,w.args);return O.ok?{ok:!0,intent:O.intent,args:w.args,press:g}:{...O,press:g}},k=(r,d)=>{let g=P(r),w=r.getAttribute("data-act"),O=we(r,l,x=>x.localName==="fieldset"||x.getAttribute("role")==="group")??l,Y=[...ce(O)].filter(x=>ut.has(x.localName)&&x.getAttribute("name")),E=y(r,{}),K=!1,H=Y.filter(x=>x.value===""&&!E.press.fields.find(M=>M.name===x.getAttribute("name"))?.from&&ct(x)!==void 0),A=Object.fromEntries(H.map(x=>[x.getAttribute("name"),ct(x)]));if(H.length>0){let x=y(r,A);x.ok?[E,K]=[x,!E.ok]:(E.ok||E.missing)&&(E=x)}if(!E.ok)return o(r,d,!1,`${g} is refused: ${E.message.replace(/\.$/,"")}.`);let D=n.allMutations().find(x=>x.name===J(n,a,e.shown,E.press).name)?.input?.shape??{},V=E.press.fields.filter(x=>x.from&&Object.hasOwn(D,x.name)&&et(D[x.name],void 0)).map(x=>x.name);if(V.length>0){let x={...K?A:{},...Object.fromEntries(V.map(j=>[j,""]))},M=y(r,x);if(!M.ok)return o(r,d,!1,`${g} is refused when ${V.map(j=>`\u201C${j}\u201D`).join(" and ")} ${V.length===1?"is":"are"} emptied: ${M.message.replace(/\.$/,"")}.`)}return o(r,d,!0,`${g} asks for \u201C${w}\u201D${K?" once its fields are filled":""}${E.intent?`: \u201C${E.intent}\u201D`:", which changes nothing as it is drawn"}.`)},v=0,$=e.maxRuns??24;for(let r of u){if(Ct(r))continue;if(r.hasAttribute("data-act")){let A=ne(r);if(ut.has(r.localName)&&r.hasAttribute("data-save")){let I=r.getAttribute("data-save");I!=="input"&&I!=="change"?o(r,"save",!1,`${P(r)} saves nothing: data-save is "input" or "change", not "${I}".`):k(r,"save")}else A?o(r,"act",!1,`${P(r)} is bound to \u201C${r.getAttribute("data-act")}\u201D and is never pressed: ${A}`):he(r)&&k(r,"act");continue}if(r.localName==="a"&&(r.getAttribute("href")??"").startsWith("#")){let A=r.getAttribute("href").slice(1);o(r,"jump",m.has(A),m.has(A)?`${P(r)} jumps to #${A}.`:`${P(r)} jumps to #${A}, and the view drew no element with that id.`);continue}if(r.hasAttribute("data-file")){let A=r.getAttribute("data-file")??"",I=r.getAttribute("data-field")??"",D=e.shown.has(A)?n.seenBy(s).graph.getNode(A):void 0,V=D&&I?ze(D[I]):[],x=Number(r.getAttribute("data-index")??"0"),M=V[Number.isInteger(x)&&x>=0?x:0];r.localName!=="a"?o(r,"file",!1,`${P(r)} is a file link on a <${r.localName}>: a file link is an <a data-file>.`):D?M?o(r,"file",!0,`${P(r)} ${r.hasAttribute("data-download")?"downloads":"opens"} \u201C${M.name??"the file"}\u201D.`):o(r,"file",!1,`${P(r)} links to the file in "${I||"(no data-field)"}" of "${A}", which holds none.`):o(r,"file",!1,`${P(r)} links to a file of "${A}", which is no record this view was shown.`);continue}if(le(r,[...ce(r)].some(ie))){let A=r.getAttribute("data-filter"),I=r.getAttribute("data-section"),D=r.getAttribute("data-record"),V={...A?{where:me(A)}:{},...I?{section:I}:{}},x=D?{record:D,...V}:{place:r.getAttribute("data-place")??"",...V},M=X(x,{sees:j=>e.shown.has(j),places:e.places,lists:e.lists,schema:n.schema});if(M.ok){let j=M.arrival;o(r,"link",!0,`${P(r)} opens ${"record"in j?`the record "${j.record}"`:"place"in j?`the place "${j.place}"`:`the list of ${j.list}`}.`)}else{let j="place"in x?x.place:x.record,oe="place"in x&&!B(e.places,j)&&!e.lists.some(re=>re.slug===j||re.kind===j);e.placesUnsure&&oe?o(r,"link",!0,`${P(r)} may go nowhere: ${M.says}${q}`):o(r,"link",!1,`${P(r)} goes nowhere: ${M.says}`)}continue}let d=t.idOf(r),g=i.has(d??"");if(!Pt(r)&&!g||!g&&ge(r,l,A=>le(A,[...ce(A)].some(ie))))continue;if(!f(r)){o(r,"nothing",!1,`${P(r)} does nothing: it is bound to no act (data-act), goes nowhere (data-record, data-place), and the view hears no click on it.`);continue}if(d===void 0)continue;if(v>=$){o(r,"code",!0,`${P(r)} was not pressed: the check presses ${$} controls the view's code hears, and this is past them.`);continue}v+=1;let w=await e.rerun(d);if(!w.ok){o(r,"code",!1,w.reason==="error"?`${P(r)} throws when pressed: ${w.detail.replace(/^It threw: /,"")}`:`${P(r)}, pressed, stopped the view (${w.reason}): ${w.detail}`);continue}let O=w.transcript.pressed;if(!O||O.target===void 0){o(r,"code",!1,`${P(r)} could not be pressed in a run of its own: it was not drawn there the same way.`);continue}let Y=w.transcript.asked.slice(O.asked),E=w.transcript.went.slice(O.went),K=w.transcript.renders.length>O.renders,H=[];for(let A of Y){let I=Ze(n,a,A.name,A.args??{},{shown:e.shown,file:()=>{},dropped:()=>{}});if(!I.ok)H.push(`it asks for \u201C${A.name}\u201D from its code, which is refused: ${I.message}${I.reason==="press-only"?` Bind the button to it instead: data-act="${A.name}".`:""}`);else{let D=T(I.name,I.args);D.ok||H.push(`it asks for \u201C${A.name}\u201D, which is refused: ${D.message}`)}}for(let A of E){let I=X(A,{sees:D=>e.shown.has(D),places:e.places,lists:e.lists,schema:n.schema});I.ok||H.push(`it asks to go nowhere: ${I.says}`)}H.length>0?o(r,"code",!1,`${P(r)}, pressed: ${H.join("; ")}`):Y.length===0&&E.length===0&&!K?o(r,"code",!1,`${P(r)} does nothing when pressed: the view hears the click, and asks for no act, goes nowhere and draws nothing new.`):o(r,"code",!0,`${P(r)}, pressed, ${[...Y.length>0?[`asks for ${Y.map(A=>`\u201C${A.name}\u201D`).join(", ")}`]:[],...E.length>0?["goes where it says"]:[],...K?["draws again"]:[]].join(" and ")}.`)}let c=b.filter(r=>!r.ok),h=[`Presses: ${b.length} control${b.length===1?"":"s"} pressed, ${c.length===0?"every one does what it says":`${c.length} ${c.length===1?"fails":"fail"}`}.`];for(let r of b)h.push(` ${r.ok?"ok ":"FAILS"} ${r.says}`);return{ok:c.length===0,controls:b,problems:c,text:`${h.join(`
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{c as st}from"./chunk.EGVM24ND.js";import{a as Ye}from"./chunk.CEQQIW7Z.js";import{a as B,b as He,c as G,d as q,e as ae,g as me,h as Se,i as Fe,j as X}from"./chunk.CGBOPPNL.js";import"./chunk.LMTG5NPG.js";import{a as Ke,b as Je,c as Xe,d as Qe}from"./chunk.32SHA3EY.js";import{h as Be}from"./chunk.GG47EIKO.js";import{a as Me,b as Le}from"./chunk.NYLKG25K.js";import{h as J,i as et,k as tt}from"./chunk.PLIV3IQK.js";import{e as Ze}from"./chunk.MK5RPEB2.js";import{b as ye,c as We,f as Ge,g as qe}from"./chunk.TOUSIUJF.js";import{d as ze}from"./chunk.QDVGHI7R.js";import{f as _e,g as Ve}from"./chunk.KUCBNMIY.js";import{a as ie,c as ne,d as he,e as Ue,h as le,j as ge}from"./chunk.M5FP4Y4Q.js";import{d as rt,k as nt}from"./chunk.RSMCTI2N.js";import"./chunk.BHJRT57H.js";import{a as xe,b as je,c as De}from"./chunk.CNN32262.js";import"./chunk.EGSOHTZZ.js";import"./chunk.HWFJQ42Y.js";import{Mb as pe,Pb as fe,Qd as Pe,la as Ie,me as Ce,ne as Re}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var It="http://www.w3.org/1999/xhtml",se=class{constructor(t){this.ownerDocument=t}parentNode=null;childNodes=[];get firstChild(){return this.childNodes[0]??null}get parentElement(){return this.parentNode instanceof F?this.parentNode:null}get textContent(){return this.childNodes.map(t=>t.textContent).join("")}insertBefore(t,n){t.parentNode&&t.parentNode.removeChild(t);let s=n?this.childNodes.indexOf(n):-1;return s<0?this.childNodes.push(t):this.childNodes.splice(s,0,t),t.parentNode=this,t}appendChild(t){return this.insertBefore(t,null)}removeChild(t){let n=this.childNodes.indexOf(t);return n>=0&&this.childNodes.splice(n,1),t.parentNode=null,t}},Q=class extends se{constructor(n,s){super(n);this.data=s}nodeType=3;get textContent(){return this.data}},$e=class extends se{nodeType=8;get textContent(){return""}},F=class extends se{constructor(n,s,a){super(n);this.namespaceURI=s;this.localName=a}nodeType=1;attributes=new Map;value="";checked=!1;selected=!1;setAttribute(n,s){this.attributes.set(n,String(s))}removeAttribute(n){this.attributes.delete(n)}getAttribute(n){return this.attributes.get(n)??null}hasAttribute(n){return this.attributes.has(n)}closest(n){for(let s=this;s;s=s.parentElement)if(s.localName===n)return s;return null}},Ae=class extends se{nodeType=9;constructor(){super(null)}createElementNS(t,n){return new F(this,t,n)}createElement(t){return new F(this,It,t)}createTextNode(t){return new Q(this,t)}createComment(t){return new $e(this)}};function ot(){let e=new Ae,t=e.createElement("div");return t.setAttribute("data-graview-view-root",""),e.appendChild(t),{document:e,root:t}}var de=function*(e){for(let t of e.childNodes)t instanceof F&&(yield t,yield*de(t))},be=(e,t,n)=>{for(let s=e;s&&s!==t;s=s.parentElement)if(n(s))return s},at=e=>{let t=["id","class","data-record","data-place","data-act","role","name"].flatMap(n=>e.getAttribute(n)===null?[]:[` ${n}="${e.getAttribute(n).slice(0,80)}"`]);return`<${e.localName}${t.join("")}>`},it=e=>e.childNodes.map(t=>t instanceof F?it(t):t.nodeType===3?t.textContent:"").join("");function Te(e,t,n){let s=n.typed??{},a=[],l=[...de(e)].filter(u=>u.getAttribute("data-act")!==null).map(u=>u.getAttribute("data-act"));for(let u of de(e)){let i=u.getAttribute("name");if(!i||!["input","select","textarea"].includes(u.localName))continue;let f=(u.getAttribute("type")??"text").toLowerCase(),m=Object.hasOwn(s,i);if(f==="radio"){let b=u.getAttribute("value")??"on";if(m?String(s[i])!==b:!u.checked)continue;a.push({name:i,value:b,typed:m,empty:!1,chosen:!0})}else if(u.localName==="select"){let b=[...de(u)].filter(T=>T.localName==="option"),o=b.find(T=>T.selected||T.getAttribute("selected")!==null)??b[0],N=m?String(s[i]):o?o.getAttribute("value")??it(o).trim():"";a.push({name:i,value:N,typed:m,empty:N===""&&!m,chosen:!0})}else if(f==="checkbox"){let b=m?s[i]===!0||s[i]==="true"||s[i]==="on":u.checked;a.push({name:i,value:b,typed:m,empty:!b&&!m})}else{let b=be(u,e,k=>k.getAttribute("data-record")!==null)?.getAttribute("data-record")??t,o=u.value===""&&u.getAttribute("data-prefill")===i&&b?tt(n.store,n.principal,n.manifest,n.shown,{record:b,field:i,acts:l}):void 0,N=o!==void 0?{record:b,field:i,value:o}:void 0,T=m?s[i]:o??u.value,y=(f==="number"||f==="range")&&T!==""&&Number.isFinite(Number(T))?Number(T):typeof T=="boolean"?String(T):T;a.push({name:i,value:y,typed:m||N!==void 0,empty:y===""&&!m&&!N,...N?{from:N}:{}})}}return a}function lt(e,t,n,s){let a=n.asked.slice(e.asked),l=n.went.slice(e.went),u=n.renders.length>e.renders,i=e.target!==void 0?t.elementOf(e.target):void 0,f=[...a.map(y=>`its code asked for "${y.name}"`),...l.map(y=>`its code asked to go to "${"record"in y?y.record:y.place}"`),...u?["it drew again"]:[]],m=f.length>0?` When the view heard the click, ${f.join(", ")}.`:"";if(!i)return{selector:e.selector,asked:a,went:l,redrew:u,says:`"${e.selector}" matches nothing the view drew: there is nothing there to press.`};let b=t.root,o={},N=[],T=ge(i,b,y=>le(y,[...de(y)].some(ie)));if(T){let y=T.getAttribute("data-filter"),k=T.getAttribute("data-section"),v=T.getAttribute("data-record"),$={...y?{where:me(y)}:{},...k?{section:k}:{}},c=v?{record:v,...$}:{place:T.getAttribute("data-place")??"",...$},h=X(c,{sees:r=>s.shown.has(r),places:s.places,lists:s.lists,schema:s.store.schema});if(h.ok){o.opens=h.arrival;let r=h.arrival,d="filter"in r&&r.filter?`, narrowed to ${r.filter}`:"";N.push(`It opens ${"record"in r?`the record "${r.record}"`:"place"in r?`the place "${r.place}"`:`the list of ${r.list}`}${d}${r.section?`, at "${r.section}"`:""}.`)}else{let r="place"in c?c.place:c.record,d=!("record"in c&&s.shown.has(c.record))&&!B(s.places,r)&&!s.lists.some(g=>g.slug===r||g.kind===r);o.lost=s.placesUnsure&&d?`${h.says}${q}`:h.says,N.push(`It lands in a link that goes nowhere: ${o.lost}`)}}let p=be(i,b,y=>y.getAttribute("data-act")!==null);if(p){let y=p.getAttribute("data-act"),k=ne(p);if(k)N.push(`It is bound to "${y}", and is never pressed: ${k}`);else if(he(p)){let v=be(p,b,d=>d.getAttribute("data-record")!==null)?.getAttribute("data-record")??void 0,$=be(p,b,d=>d.localName==="fieldset"||d.getAttribute("role")==="group")??b,c={as:y,...v!==void 0?{record:v}:{},fields:Te($,v,s)},h=J(s.store,s.manifest,s.shown,c);if(!h.ok)o.act={as:y,ok:!1,reason:h.reason,message:h.message};else try{let d=s.store.previewAll([{name:h.name,args:h.args}],{author:s.principal,via:`view:${s.manifest.name}`});o.act={as:y,ok:!0,name:h.name,args:h.args,intent:d.intent,changes:d.ops.length>0}}catch(d){o.act=d instanceof pe?{as:y,ok:!1,reason:"refused",message:d.refusal.message}:d instanceof fe?{as:y,ok:!1,reason:"failed",message:_e(d)}:{as:y,ok:!1,reason:"failed",message:"The act could not be applied."}}let r=o.act;N.push(r.ok?`It asks for "${r.name}" with ${JSON.stringify(r.args)}: ${r.changes?`\u201C${r.intent}\u201D, applied for this seat, were it pressed.`:"applied for this seat, it would change nothing."}`:`It asks for "${y}", which the host refuses (${r.reason}): ${r.message}`)}}return N.length===0&&N.push(`It is bound to no act and lands in no link: the host does nothing there${f.length>0?"":", and the view's code does nothing either"}.`),{selector:e.selector,element:at(i),...o,asked:a,went:l,redrew:u,says:`A press on ${at(i)}: ${N.join(" ")}${m}`}}var ce=function*(e){for(let t of e.childNodes)t instanceof F&&(yield t,yield*ce(t))},we=(e,t,n)=>{for(let s=e;s&&s!==t;s=s.parentElement)if(n(s))return s},pt=e=>e.childNodes.map(t=>t instanceof F?t.getAttribute("aria-hidden")==="true"?"":pt(t):t.nodeType===3?t.textContent:"").join(""),ft=e=>{let t=["id","class","data-record","data-place","data-act","data-file","href","role","name"].flatMap(n=>e.getAttribute(n)===null?[]:[` ${n}="${e.getAttribute(n).slice(0,80)}"`]);return`<${e.localName}${t.join("")}>`},P=e=>{let t=(e.getAttribute("aria-label")??pt(e)).replace(/\s+/g," ").trim()||e.getAttribute("title")||e.getAttribute("name")||"";return t?`\u201C${t.length>60?`${t.slice(0,59)}\u2026`:t}\u201D`:ft(e)},dt={number:"1",range:"1",date:"2026-01-15","datetime-local":"2026-01-15T09:00",time:"09:00",month:"2026-01",week:"2026-W03",email:"someone@example.com",url:"https://example.com",tel:"+1 555 0100",text:"A test",search:"A test",textarea:"A test"},ct=e=>e.localName==="textarea"?dt.textarea:dt[(e.getAttribute("type")??"text").toLowerCase()],ut=new Set(["input","textarea","select"]),Pt=e=>e.localName==="button"&&e.namespaceURI==="http://www.w3.org/1999/xhtml"||Ue(e)||["link","menuitem","menuitemcheckbox","menuitemradio","option"].includes(e.getAttribute("role")??"")||e.localName==="a"&&!e.hasAttribute("href")&&!e.hasAttribute("data-record")&&!e.hasAttribute("data-place")&&!e.hasAttribute("data-file"),Ct=e=>e.localName==="summary"||e.hasAttribute("data-lightbox")||e.hasAttribute("data-drop")||e.localName==="graview-video";async function mt(e){let{drawn:t,store:n,principal:s,manifest:a}=e,l=t.root,u=[...ce(l)],i=new Set(e.clicks),f=r=>we(r,l,d=>i.has(t.idOf(d)??""))!==void 0,m=new Set(u.flatMap(r=>r.getAttribute("id")?[r.getAttribute("id")]:[])),b=[],o=(r,d,g,w)=>b.push({control:P(r),element:ft(r),does:d,ok:g,says:w}),N=`view:${a.name}`,T=(r,d)=>{try{return{ok:!0,intent:n.previewAll([{name:r,args:d}],{author:s,via:N}).intent}}catch(g){return g instanceof pe?{ok:!1,message:`this seat may not: ${g.refusal.message}`,missing:!1}:g instanceof fe?{ok:!1,message:Ve(g),missing:g.issues.some(w=>/required|received undefined/i.test(w.message))}:{ok:!1,message:`the act threw: ${g instanceof Error?g.message.slice(0,200):String(g)}`,missing:!1}}},p=(r,d)=>{let g=we(r,l,O=>O.getAttribute("data-record")!==null)?.getAttribute("data-record")??void 0,w=we(r,l,O=>O.localName==="fieldset"||O.getAttribute("role")==="group")??l;return{as:r.getAttribute("data-act"),...g!==void 0?{record:g}:{},fields:Te(w,g,{store:n,principal:s,manifest:a,shown:e.shown,places:e.places,lists:e.lists,typed:d})}},y=(r,d)=>{let g=p(r,d),w=J(n,a,e.shown,g);if(!w.ok)return{ok:!1,message:w.message,missing:!1,press:g};let O=T(w.name,w.args);return O.ok?{ok:!0,intent:O.intent,args:w.args,press:g}:{...O,press:g}},k=(r,d)=>{let g=P(r),w=r.getAttribute("data-act"),O=we(r,l,x=>x.localName==="fieldset"||x.getAttribute("role")==="group")??l,Y=[...ce(O)].filter(x=>ut.has(x.localName)&&x.getAttribute("name")),E=y(r,{}),K=!1,H=Y.filter(x=>x.value===""&&!E.press.fields.find(M=>M.name===x.getAttribute("name"))?.from&&ct(x)!==void 0),A=Object.fromEntries(H.map(x=>[x.getAttribute("name"),ct(x)]));if(H.length>0){let x=y(r,A);x.ok?[E,K]=[x,!E.ok]:(E.ok||E.missing)&&(E=x)}if(!E.ok)return o(r,d,!1,`${g} is refused: ${E.message.replace(/\.$/,"")}.`);let D=n.allMutations().find(x=>x.name===J(n,a,e.shown,E.press).name)?.input?.shape??{},V=E.press.fields.filter(x=>x.from&&Object.hasOwn(D,x.name)&&et(D[x.name],void 0)).map(x=>x.name);if(V.length>0){let x={...K?A:{},...Object.fromEntries(V.map(j=>[j,""]))},M=y(r,x);if(!M.ok)return o(r,d,!1,`${g} is refused when ${V.map(j=>`\u201C${j}\u201D`).join(" and ")} ${V.length===1?"is":"are"} emptied: ${M.message.replace(/\.$/,"")}.`)}return o(r,d,!0,`${g} asks for \u201C${w}\u201D${K?" once its fields are filled":""}${E.intent?`: \u201C${E.intent}\u201D`:", which changes nothing as it is drawn"}.`)},v=0,$=e.maxRuns??24;for(let r of u){if(Ct(r))continue;if(r.hasAttribute("data-act")){let A=ne(r);if(ut.has(r.localName)&&r.hasAttribute("data-save")){let I=r.getAttribute("data-save");I!=="input"&&I!=="change"?o(r,"save",!1,`${P(r)} saves nothing: data-save is "input" or "change", not "${I}".`):k(r,"save")}else A?o(r,"act",!1,`${P(r)} is bound to \u201C${r.getAttribute("data-act")}\u201D and is never pressed: ${A}`):he(r)&&k(r,"act");continue}if(r.localName==="a"&&(r.getAttribute("href")??"").startsWith("#")){let A=r.getAttribute("href").slice(1);o(r,"jump",m.has(A),m.has(A)?`${P(r)} jumps to #${A}.`:`${P(r)} jumps to #${A}, and the view drew no element with that id.`);continue}if(r.hasAttribute("data-file")){let A=r.getAttribute("data-file")??"",I=r.getAttribute("data-field")??"",D=e.shown.has(A)?n.seenBy(s).graph.getNode(A):void 0,V=D&&I?ze(D[I]):[],x=Number(r.getAttribute("data-index")??"0"),M=V[Number.isInteger(x)&&x>=0?x:0];r.localName!=="a"?o(r,"file",!1,`${P(r)} is a file link on a <${r.localName}>: a file link is an <a data-file>.`):D?M?o(r,"file",!0,`${P(r)} ${r.hasAttribute("data-download")?"downloads":"opens"} \u201C${M.name??"the file"}\u201D.`):o(r,"file",!1,`${P(r)} links to the file in "${I||"(no data-field)"}" of "${A}", which holds none.`):o(r,"file",!1,`${P(r)} links to a file of "${A}", which is no record this view was shown.`);continue}if(le(r,[...ce(r)].some(ie))){let A=r.getAttribute("data-filter"),I=r.getAttribute("data-section"),D=r.getAttribute("data-record"),V={...A?{where:me(A)}:{},...I?{section:I}:{}},x=D?{record:D,...V}:{place:r.getAttribute("data-place")??"",...V},M=X(x,{sees:j=>e.shown.has(j),places:e.places,lists:e.lists,schema:n.schema});if(M.ok){let j=M.arrival;o(r,"link",!0,`${P(r)} opens ${"record"in j?`the record "${j.record}"`:"place"in j?`the place "${j.place}"`:`the list of ${j.list}`}.`)}else{let j="place"in x?x.place:x.record,oe="place"in x&&!B(e.places,j)&&!e.lists.some(re=>re.slug===j||re.kind===j);e.placesUnsure&&oe?o(r,"link",!0,`${P(r)} may go nowhere: ${M.says}${q}`):o(r,"link",!1,`${P(r)} goes nowhere: ${M.says}`)}continue}let d=t.idOf(r),g=i.has(d??"");if(!Pt(r)&&!g||!g&&ge(r,l,A=>le(A,[...ce(A)].some(ie))))continue;if(!f(r)){o(r,"nothing",!1,`${P(r)} does nothing: it is bound to no act (data-act), goes nowhere (data-record, data-place), and the view hears no click on it.`);continue}if(d===void 0)continue;if(v>=$){o(r,"code",!0,`${P(r)} was not pressed: the check presses ${$} controls the view's code hears, and this is past them.`);continue}v+=1;let w=await e.rerun(d);if(!w.ok){o(r,"code",!1,w.reason==="error"?`${P(r)} throws when pressed: ${w.detail.replace(/^It threw: /,"")}`:`${P(r)}, pressed, stopped the view (${w.reason}): ${w.detail}`);continue}let O=w.transcript.pressed;if(!O||O.target===void 0){o(r,"code",!1,`${P(r)} could not be pressed in a run of its own: it was not drawn there the same way.`);continue}let Y=w.transcript.asked.slice(O.asked),E=w.transcript.went.slice(O.went),K=w.transcript.renders.length>O.renders,H=[];for(let A of Y){let I=Ze(n,a,A.name,A.args??{},{shown:e.shown,file:()=>{},dropped:()=>{}});if(!I.ok)H.push(`it asks for \u201C${A.name}\u201D from its code, which is refused: ${I.message}${I.reason==="press-only"?` Bind the button to it instead: data-act="${A.name}".`:""}`);else{let D=T(I.name,I.args);D.ok||H.push(`it asks for \u201C${A.name}\u201D, which is refused: ${D.message}`)}}for(let A of E){let I=X(A,{sees:D=>e.shown.has(D),places:e.places,lists:e.lists,schema:n.schema});I.ok||H.push(`it asks to go nowhere: ${I.says}`)}H.length>0?o(r,"code",!1,`${P(r)}, pressed: ${H.join("; ")}`):Y.length===0&&E.length===0&&!K?o(r,"code",!1,`${P(r)} does nothing when pressed: the view hears the click, and asks for no act, goes nowhere and draws nothing new.`):o(r,"code",!0,`${P(r)}, pressed, ${[...Y.length>0?[`asks for ${Y.map(A=>`\u201C${A.name}\u201D`).join(", ")}`]:[],...E.length>0?["goes where it says"]:[],...K?["draws again"]:[]].join(" and ")}.`)}let c=b.filter(r=>!r.ok),h=[`Presses: ${b.length} control${b.length===1?"":"s"} pressed, ${c.length===0?"every one does what it says":`${c.length} ${c.length===1?"fails":"fail"}`}.`];for(let r of b)h.push(` ${r.ok?"ok ":"FAILS"} ${r.says}`);return{ok:c.length===0,controls:b,problems:c,text:`${h.join(`
|
|
2
2
|
`)}
|
|
3
3
|
`}}var Rt=e=>`
|
|
4
4
|
;(function () {
|
|
@@ -18,5 +18,5 @@ ${i}`:f||i;return{root:s,refused:u,size:l.size,over:a,css:m,elementOf:b=>l.eleme
|
|
|
18
18
|
"use strict";
|
|
19
19
|
${e}
|
|
20
20
|
});
|
|
21
|
-
`}var Bt={scheme:"light",accent:"#2f7d8c",ground:"#f6f8f9",panel:"#ffffff",ink:"#14212b",inkMuted:"#4f6470",edge:"rgba(20, 33, 43, 0.14)",fontBody:"system-ui, sans-serif",fontDisplay:"system-ui, sans-serif",fontMono:"ui-monospace, monospace",radius:"12px"},z=(e,t,n)=>({ok:!1,reason:e,detail:t,...n?{transcript:n}:{}}),te=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),zt=["manifest","source","refused","error","silent","nodes","flood","slow","act","isolate"];function Wt(e){if(!te(e))return;let{renders:t,sheets:n,asked:s,went:a,ms:l,logs:u,messages:i,gestures:f,pressed:m,clicks:b}=e;if(!(!Array.isArray(t)||!t.every(Array.isArray)||!Array.isArray(s)||!Array.isArray(a)||!Array.isArray(u))&&!(typeof l!="number"||typeof i!="number"||n!==void 0&&!(Array.isArray(n)&&n.every(o=>typeof o=="string"))))return{renders:t,...Array.isArray(n)?{sheets:n}:{},asked:s.filter(te).map(o=>({name:String(o.name),args:o.args})),went:a.filter(te).flatMap(o=>{let N=typeof o.section=="string"?{section:o.section}:{},T=o.where!==void 0?{where:o.where}:{};return typeof o.record=="string"?[{record:o.record,...T,...N}]:typeof o.place=="string"?[{place:o.place,...T,...N}]:[]}),ms:l,logs:u.map(String).slice(0,50),messages:i,...Array.isArray(b)?{clicks:b.filter(o=>typeof o=="string").slice(0,2e3)}:{},...Array.isArray(f)?{gestures:f.filter(te).slice(0,32).map(o=>({event:String(o.event),selector:String(o.selector)}))}:{},...te(m)&&typeof m.selector=="string"&&[m.asked,m.went,m.renders].every(o=>typeof o=="number")?{pressed:{selector:m.selector,...typeof m.target=="string"?{target:m.target}:{},asked:m.asked,went:m.went,renders:m.renders}}:{}}}function Gt(e,t){let n=t.gestures??[];return n.length>0&&e.gestures!==!0?[{at:"gestures",says:`It listens for ${n.map(a=>`${a.event} on "${a.selector}"`).join(", ")}, and its manifest does not say "gestures": true: the host forwards no wheel, drag or pinch, and the page scrolls under it. Say "gestures": true in the manifest.`}]:n.length===0&&e.gestures===!0?[{at:"gestures",says:'Its manifest says "gestures": true, and it listens for no wheel, drag or pinch: graview.on("wheel" | "drag" | "pinch", selector, \u2026) is where the host sends one.'}]:[]}var qt=e=>e.kind==="system"?"the system":(e.roles??[]).length>0?(e.roles??[]).join(", "):e.kind,Zt=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");async function Yt(e,t){let n=f=>typeof f=="object"&&f!==null&&!(typeof f.kind=="string"&&f.kind.length>0),s=f=>{let{as:m,slug:b}=f;return typeof m=="string"&&m.length>0?m:typeof b=="string"&&b.length>0?b:void 0},a=e.filter(f=>n(f)&&![void 0,Ce,Re].includes(s(f)));if(a.length===0)return e;let l=t.app?je(t.app,{views:t.views}):De(t.schema,t.views.flatMap(f=>xe(f)??[])),u=f=>l.find(m=>m.slug===s(f)&&m.kind!==null),i=a.filter(f=>!u(f)).map(f=>`"${s(f)}"`);if(i.length>0){let f=i.length===1?"that slug":"those slugs",m=t.app?`the app declares no place by ${f}`:`no kind's list or view the run holds is at ${f}, and the app, which would say its lenses, was not handed (\`app\`)`;throw new TypeError(`runWorkerViewHeadless was handed the place${i.length===1?"":"s"} ${i.join(", ")} without ${i.length===1?"its kind":"their kinds"}, and ${m}: hand each place's \`kind\` as \`placesOf(app)\` lists it, or the app.`)}return e.map(f=>{if(!a.includes(f))return f;let m=u(f);return{...f,kind:m.kind,...m.over?{over:m.over}:{}}})}async function Oe(e){if(typeof e.run!="function")throw new TypeError("runWorkerViewHeadless runs a view only in an isolate the host supplies (`run`); it never runs one in the host's own context.");let{manifest:t,source:n,store:s,principal:a}=e,l={maxSourceBytes:e.limits?.maxSourceBytes??256e3,maxNodes:e.limits?.maxNodes??5e3,messages:e.limits?.messages??120,pushMs:e.limits?.pushMs??1e3,runMs:e.limits?.runMs??5e3},u=We(t,s);if(u.length>0)return z("manifest",u.join(" "));if(typeof n!="string")return z("source","A view's source is text.");if(new TextEncoder().encode(n).length>l.maxSourceBytes)return z("source",`Its code is longer than the ${l.maxSourceBytes.toLocaleString("en-US")} bytes a view may be.`);let i=Ye(n);if(i.length>0)return z("source",i.join(" "));let f=[...e.views??[],t].flatMap(S=>xe(S)??[]).map(S=>({as:S.as,title:S.title,kind:S.kind})),m=new Set([...s.kindsKeptFrom(a),...s.modules.disabledKinds]),b=await Yt(e.places??[],{schema:s.schema,...e.app?{app:e.app}:{},views:[...e.views??[],t]}),o=Fe(s.schema,[...b,...f],{kept:m}),N=e.views===void 0,T=Ge(s,t)?(await (__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.DWM7AR5Y.js","./chunk.6KJGRM7A.js","./chunk.WALVW3KJ.js","./chunk.SNHKYH72.js","./chunk.UGQYMN4J.js","./chunk.RG5G6YQD.js","./chunk.JQ63N4MZ.js","./chunk.Z3O2VZAJ.js","./chunk.ZEZUKRC6.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.7WHQWLL6.js"))).computedOn(s.schema):void 0,p=qe(s,a,{manifest:t,...e.input?{input:e.input}:{},theme:e.theme??Bt,places:He(o),...T?{computed:T}:{}}),y=t.pictures?nt(p,{view:`"${t.title??t.name}"`,pictures:t.pictures,standIn:rt,limits:{...e.limits?.pictureBytes!==void 0?{pictureBytes:e.limits.pictureBytes}:{},...e.limits?.picturesBytes!==void 0?{picturesBytes:e.limits.picturesBytes}:{}}}):{props:p,left:[]},k=y.props,v={props:k,acts:ye(t).map(S=>S.as??S.act),...t.accepts?{accepts:t.accepts.map(({kind:S,field:U})=>({kind:S,field:U}))}:{},places:o.map(S=>({as:S.as,title:S.title})),...N?{placesUnsure:!0}:{},...e.images?{imageOrigins:[...e.images.origins]}:{},...e.links?{linkOrigins:[...e.links.origins]}:{},...e.asset?{assets:!0}:{},...e.origin?{origin:e.origin}:{},lists:Se(s.schema,new Set([...s.kindsKeptFrom(a),...s.modules.disabledKinds])).flatMap(S=>[S.slug,S.kind]),limits:{maxNodes:l.maxNodes,messages:l.messages,pushMs:l.pushMs},...e.press!==void 0?{press:{selector:typeof e.press=="string"?e.press:e.press.selector}}:{}},$=async S=>{let U,W;try{let Z=e.run({script:Vt(n),entry:xt,input:JSON.stringify(S),timeoutMs:l.runMs}),Et=new Promise((tr,Ot)=>{W=setTimeout(()=>Ot(Object.assign(new Error("past runMs"),{reason:"slow"})),l.runMs+1e3)});U=await Promise.race([Z,Et])}catch(Z){return te(Z)&&Z.reason==="slow"?z("slow",`It ran longer than the ${l.runMs.toLocaleString("en-US")} ms a headless run may take.`):z("isolate",`The isolate could not run it: ${Z instanceof Error?Z.message:String(Z)}`)}finally{W!==void 0&&clearTimeout(W)}let L;try{L=JSON.parse(String(U))}catch{return z("isolate","The isolate answered with something that is not an outcome.")}if(!te(L))return z("isolate","The isolate answered with something that is not an outcome.");let Ne=Wt(L.transcript);if(L.ok!==!0){let Z=zt.includes(L.reason)?L.reason:"isolate";return z(Z,typeof L.detail=="string"?L.detail.slice(0,2e3):"It failed, and the isolate did not say why.",Ne)}return Ne?{ok:!0,transcript:Ne}:z("isolate","The isolate answered without what the view sent.")},c=await $(v);if(!c.ok)return c;let h=c.transcript,r=e.press!==void 0?h.pressed:void 0,d=Nt(r?{...h,renders:h.renders.slice(0,r.renders)}:h,v,e.brand?.views?.css?{theme:e.brand.views.css}:{});if(!d.ok)return z(d.reason,d.detail,h);let g=new Set([...k.node?[k.node.id]:[],...(k.nodes??[]).map(S=>S.id)]),w=Se(s.schema,new Set([...s.kindsKeptFrom(a),...s.modules.disabledKinds])),O=[];for(let S of h.went){if(!("where"in S)&&!("section"in S))continue;let U=X(S,{sees:L=>g.has(L),places:o,lists:w,schema:s.schema}),W="place"in S?B(v.places,S.place)!==void 0||(v.lists??[]).includes(S.place):!0;!U.ok&&W&&O.push({at:"navigate",says:U.says})}let Y=typeof e.press=="object"&&e.press.typed?{typed:e.press.typed}:{},E=r?lt(r,d.drawn,h,{store:s,principal:a,manifest:t,shown:g,places:o,lists:w,...N?{placesUnsure:!0}:{},...Y}):void 0,K=E&&(!E.element||E.lost)?[{at:`press "${E.selector}"`,says:E.lost??E.says}]:[],H;if(e.presses){let S=d.drawn;H=await(typeof e.presses=="function"?e.presses:e.presses.check)({store:s,principal:a,manifest:t,shown:g,places:o,lists:w,...N?{placesUnsure:!0}:{},drawn:S,clicks:h.clicks??[],...typeof e.presses=="object"&&e.presses.maxRuns!==void 0?{maxRuns:e.presses.maxRuns}:{},rerun:async W=>{let L=await $({...v,press:{selector:`[data-graview-check="${W}"]`,target:W}});return L.ok?L:{ok:!1,reason:L.reason,detail:L.detail}}})}let A=t.title??t.name,I=k.today?st(n,{today:k.today,title:t.attach==="home"?"Home":A,...k.locale?{locale:k.locale}:{}}):[],D=[...y.left.map(S=>({at:"pictures",says:S})),...d.problems,...O,...Gt(t,h),...K,...(H?.problems??[]).map(S=>({at:`press ${S.control}`,says:S.says})),...I.map(({at:S,says:U})=>({at:S,says:U}))],V=t.title?Zt(t.title):t.name,x=t.attach==="home"?null:t.attach,M={place:{slug:t.attach==="home"?"home":V,title:A,kind:x,address:t.attach==="home"?"/":`/places/${encodeURIComponent(V)}`},seat:qt(a),width:e.width??1440,variant:(e.width??1440)<640?"phone":"wide",drawnBy:`view:${t.name}`,parts:d.parts,...d.videos.length>0?{videos:d.videos}:{},problems:D},{placeText:j}=await (__graviewPreload(import.meta.url,["./chunk.BKYZSV2Y.js","./chunk.LP2ZMAT2.js","./chunk.H3EGBDW2.js","./chunk.DWM7AR5Y.js","./chunk.6KJGRM7A.js","./chunk.WALVW3KJ.js","./chunk.SNHKYH72.js","./chunk.UGQYMN4J.js","./chunk.RG5G6YQD.js","./chunk.SJQPTDAT.js","./chunk.JQ63N4MZ.js","./chunk.Z3O2VZAJ.js","./chunk.ZEZUKRC6.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.R7CRBRD4.js")),oe,re;if(e.audit===!0){let{auditView:S}=await (__graviewPreload(import.meta.url,["./chunk.JO2X52D4.js","./chunk.M5FP4Y4Q.js","./chunk.ZEZUKRC6.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.UWS4RMM3.js")),U=(h.clicks??[]).flatMap(W=>d.drawn.elementOf(W)??[]);oe=S(d.drawn.root,{host:"pending",clicked:U}),e.drawing===!0&&(re={root:d.drawn.root,clicked:U})}return{ok:!0,description:{...M,text:j(M)},props:k,transcript:h,css:d.drawn.css,...E?{pressed:E}:{},...oe?{audit:oe}:{},...re?{drawing:re}:{},...H?{presses:H}:{}}}var Kt=6,ke=function*(e){for(let t of e.childNodes)t.nodeType===1&&(yield t,yield*ke(t))},Jt=(e,t)=>{for(let n=t;n;n=n.parentElement)if(n===e)return!0;return!1};function At(e,t){let n=[...ke(e)].filter(i=>i.getAttribute("data-record")===t);if(n.length===0)return null;let s=n[0];for(;s&&!n.every(i=>Jt(s,i));)s=s.parentElement;let a=s??e,l=[a,...ke(a)].flatMap(i=>i.getAttribute("data-act")?[i.getAttribute("data-act")]:[]),u=[a,...ke(a)].flatMap(i=>i.getAttribute("aria-pressed")||i.getAttribute("aria-checked")?[`${i.getAttribute("aria-pressed")??""}${i.getAttribute("aria-checked")??""}`]:[]);return`${a.textContent.replace(/\s+/g," ").trim()}|${l.join(",")}|${u.join(",")}`}var Tt=(e,t)=>new RegExp(`\\s${t}="([^"]*)"`).exec(e)?.[1];function Xt(e){return new Pe({schema:e.schema,mutations:e.allMutations(),invariants:e.allInvariants(),...e.policy?{policy:e.policy}:{},snapshot:e.graph.snapshot()})}var Qt=e=>JSON.stringify(Object.entries(e??{}).filter(([,t])=>typeof t=="boolean").sort(([t],[n])=>t.localeCompare(n)));async function sn(e){let t=ht(),n=await Oe({...e,run:t,presses:mt,audit:!0,drawing:!0});if(!n.ok||!n.presses||!n.drawing)return n;let s=await er(e,n.presses,n.drawing.root,t);if(s.length===0)return n;let a=[...n.presses.problems,...s];return{...n,presses:{...n.presses,ok:!1,controls:[...n.presses.controls,...s],problems:a,text:`${n.presses.text}${s.map(l=>` FAILS ${l.says}
|
|
21
|
+
`}var Bt={scheme:"light",accent:"#2f7d8c",ground:"#f6f8f9",panel:"#ffffff",ink:"#14212b",inkMuted:"#4f6470",edge:"rgba(20, 33, 43, 0.14)",fontBody:"system-ui, sans-serif",fontDisplay:"system-ui, sans-serif",fontMono:"ui-monospace, monospace",radius:"12px"},z=(e,t,n)=>({ok:!1,reason:e,detail:t,...n?{transcript:n}:{}}),te=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),zt=["manifest","source","refused","error","silent","nodes","flood","slow","act","isolate"];function Wt(e){if(!te(e))return;let{renders:t,sheets:n,asked:s,went:a,ms:l,logs:u,messages:i,gestures:f,pressed:m,clicks:b}=e;if(!(!Array.isArray(t)||!t.every(Array.isArray)||!Array.isArray(s)||!Array.isArray(a)||!Array.isArray(u))&&!(typeof l!="number"||typeof i!="number"||n!==void 0&&!(Array.isArray(n)&&n.every(o=>typeof o=="string"))))return{renders:t,...Array.isArray(n)?{sheets:n}:{},asked:s.filter(te).map(o=>({name:String(o.name),args:o.args})),went:a.filter(te).flatMap(o=>{let N=typeof o.section=="string"?{section:o.section}:{},T=o.where!==void 0?{where:o.where}:{};return typeof o.record=="string"?[{record:o.record,...T,...N}]:typeof o.place=="string"?[{place:o.place,...T,...N}]:[]}),ms:l,logs:u.map(String).slice(0,50),messages:i,...Array.isArray(b)?{clicks:b.filter(o=>typeof o=="string").slice(0,2e3)}:{},...Array.isArray(f)?{gestures:f.filter(te).slice(0,32).map(o=>({event:String(o.event),selector:String(o.selector)}))}:{},...te(m)&&typeof m.selector=="string"&&[m.asked,m.went,m.renders].every(o=>typeof o=="number")?{pressed:{selector:m.selector,...typeof m.target=="string"?{target:m.target}:{},asked:m.asked,went:m.went,renders:m.renders}}:{}}}function Gt(e,t){let n=t.gestures??[];return n.length>0&&e.gestures!==!0?[{at:"gestures",says:`It listens for ${n.map(a=>`${a.event} on "${a.selector}"`).join(", ")}, and its manifest does not say "gestures": true: the host forwards no wheel, drag or pinch, and the page scrolls under it. Say "gestures": true in the manifest.`}]:n.length===0&&e.gestures===!0?[{at:"gestures",says:'Its manifest says "gestures": true, and it listens for no wheel, drag or pinch: graview.on("wheel" | "drag" | "pinch", selector, \u2026) is where the host sends one.'}]:[]}var qt=e=>e.kind==="system"?"the system":(e.roles??[]).length>0?(e.roles??[]).join(", "):e.kind,Zt=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");async function Yt(e,t){let n=f=>typeof f=="object"&&f!==null&&!(typeof f.kind=="string"&&f.kind.length>0),s=f=>{let{as:m,slug:b}=f;return typeof m=="string"&&m.length>0?m:typeof b=="string"&&b.length>0?b:void 0},a=e.filter(f=>n(f)&&![void 0,Ce,Re].includes(s(f)));if(a.length===0)return e;let l=t.app?je(t.app,{views:t.views}):De(t.schema,t.views.flatMap(f=>xe(f)??[])),u=f=>l.find(m=>m.slug===s(f)&&m.kind!==null),i=a.filter(f=>!u(f)).map(f=>`"${s(f)}"`);if(i.length>0){let f=i.length===1?"that slug":"those slugs",m=t.app?`the app declares no place by ${f}`:`no kind's list or view the run holds is at ${f}, and the app, which would say its lenses, was not handed (\`app\`)`;throw new TypeError(`runWorkerViewHeadless was handed the place${i.length===1?"":"s"} ${i.join(", ")} without ${i.length===1?"its kind":"their kinds"}, and ${m}: hand each place's \`kind\` as \`placesOf(app)\` lists it, or the app.`)}return e.map(f=>{if(!a.includes(f))return f;let m=u(f);return{...f,kind:m.kind,...m.over?{over:m.over}:{}}})}async function Oe(e){if(typeof e.run!="function")throw new TypeError("runWorkerViewHeadless runs a view only in an isolate the host supplies (`run`); it never runs one in the host's own context.");let{manifest:t,source:n,store:s,principal:a}=e,l={maxSourceBytes:e.limits?.maxSourceBytes??256e3,maxNodes:e.limits?.maxNodes??5e3,messages:e.limits?.messages??120,pushMs:e.limits?.pushMs??1e3,runMs:e.limits?.runMs??5e3},u=We(t,s);if(u.length>0)return z("manifest",u.join(" "));if(typeof n!="string")return z("source","A view's source is text.");if(new TextEncoder().encode(n).length>l.maxSourceBytes)return z("source",`Its code is longer than the ${l.maxSourceBytes.toLocaleString("en-US")} bytes a view may be.`);let i=Ye(n);if(i.length>0)return z("source",i.join(" "));let f=[...e.views??[],t].flatMap(S=>xe(S)??[]).map(S=>({as:S.as,title:S.title,kind:S.kind})),m=new Set([...s.kindsKeptFrom(a),...s.modules.disabledKinds]),b=await Yt(e.places??[],{schema:s.schema,...e.app?{app:e.app}:{},views:[...e.views??[],t]}),o=Fe(s.schema,[...b,...f],{kept:m}),N=e.views===void 0,T=Ge(s,t)?(await (__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.L7XKYGV7.js","./chunk.CE3NKAF7.js","./chunk.R3GE37OI.js","./chunk.2KCDLCB2.js","./chunk.UD7VLXPM.js","./chunk.3DEWQDP7.js","./chunk.JULD4XFB.js","./chunk.GRTBEA7O.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ARS4HJD2.js"))).computedOn(s.schema):void 0,p=qe(s,a,{manifest:t,...e.input?{input:e.input}:{},theme:e.theme??Bt,places:He(o),...T?{computed:T}:{}}),y=t.pictures?nt(p,{view:`"${t.title??t.name}"`,pictures:t.pictures,standIn:rt,limits:{...e.limits?.pictureBytes!==void 0?{pictureBytes:e.limits.pictureBytes}:{},...e.limits?.picturesBytes!==void 0?{picturesBytes:e.limits.picturesBytes}:{}}}):{props:p,left:[]},k=y.props,v={props:k,acts:ye(t).map(S=>S.as??S.act),...t.accepts?{accepts:t.accepts.map(({kind:S,field:U})=>({kind:S,field:U}))}:{},places:o.map(S=>({as:S.as,title:S.title})),...N?{placesUnsure:!0}:{},...e.images?{imageOrigins:[...e.images.origins]}:{},...e.links?{linkOrigins:[...e.links.origins]}:{},...e.asset?{assets:!0}:{},...e.origin?{origin:e.origin}:{},lists:Se(s.schema,new Set([...s.kindsKeptFrom(a),...s.modules.disabledKinds])).flatMap(S=>[S.slug,S.kind]),limits:{maxNodes:l.maxNodes,messages:l.messages,pushMs:l.pushMs},...e.press!==void 0?{press:{selector:typeof e.press=="string"?e.press:e.press.selector}}:{}},$=async S=>{let U,W;try{let Z=e.run({script:Vt(n),entry:xt,input:JSON.stringify(S),timeoutMs:l.runMs}),Et=new Promise((tr,Ot)=>{W=setTimeout(()=>Ot(Object.assign(new Error("past runMs"),{reason:"slow"})),l.runMs+1e3)});U=await Promise.race([Z,Et])}catch(Z){return te(Z)&&Z.reason==="slow"?z("slow",`It ran longer than the ${l.runMs.toLocaleString("en-US")} ms a headless run may take.`):z("isolate",`The isolate could not run it: ${Z instanceof Error?Z.message:String(Z)}`)}finally{W!==void 0&&clearTimeout(W)}let L;try{L=JSON.parse(String(U))}catch{return z("isolate","The isolate answered with something that is not an outcome.")}if(!te(L))return z("isolate","The isolate answered with something that is not an outcome.");let Ne=Wt(L.transcript);if(L.ok!==!0){let Z=zt.includes(L.reason)?L.reason:"isolate";return z(Z,typeof L.detail=="string"?L.detail.slice(0,2e3):"It failed, and the isolate did not say why.",Ne)}return Ne?{ok:!0,transcript:Ne}:z("isolate","The isolate answered without what the view sent.")},c=await $(v);if(!c.ok)return c;let h=c.transcript,r=e.press!==void 0?h.pressed:void 0,d=Nt(r?{...h,renders:h.renders.slice(0,r.renders)}:h,v,e.brand?.views?.css?{theme:e.brand.views.css}:{});if(!d.ok)return z(d.reason,d.detail,h);let g=new Set([...k.node?[k.node.id]:[],...(k.nodes??[]).map(S=>S.id)]),w=Se(s.schema,new Set([...s.kindsKeptFrom(a),...s.modules.disabledKinds])),O=[];for(let S of h.went){if(!("where"in S)&&!("section"in S))continue;let U=X(S,{sees:L=>g.has(L),places:o,lists:w,schema:s.schema}),W="place"in S?B(v.places,S.place)!==void 0||(v.lists??[]).includes(S.place):!0;!U.ok&&W&&O.push({at:"navigate",says:U.says})}let Y=typeof e.press=="object"&&e.press.typed?{typed:e.press.typed}:{},E=r?lt(r,d.drawn,h,{store:s,principal:a,manifest:t,shown:g,places:o,lists:w,...N?{placesUnsure:!0}:{},...Y}):void 0,K=E&&(!E.element||E.lost)?[{at:`press "${E.selector}"`,says:E.lost??E.says}]:[],H;if(e.presses){let S=d.drawn;H=await(typeof e.presses=="function"?e.presses:e.presses.check)({store:s,principal:a,manifest:t,shown:g,places:o,lists:w,...N?{placesUnsure:!0}:{},drawn:S,clicks:h.clicks??[],...typeof e.presses=="object"&&e.presses.maxRuns!==void 0?{maxRuns:e.presses.maxRuns}:{},rerun:async W=>{let L=await $({...v,press:{selector:`[data-graview-check="${W}"]`,target:W}});return L.ok?L:{ok:!1,reason:L.reason,detail:L.detail}}})}let A=t.title??t.name,I=k.today?st(n,{today:k.today,title:t.attach==="home"?"Home":A,...k.locale?{locale:k.locale}:{}}):[],D=[...y.left.map(S=>({at:"pictures",says:S})),...d.problems,...O,...Gt(t,h),...K,...(H?.problems??[]).map(S=>({at:`press ${S.control}`,says:S.says})),...I.map(({at:S,says:U})=>({at:S,says:U}))],V=t.title?Zt(t.title):t.name,x=t.attach==="home"?null:t.attach,M={place:{slug:t.attach==="home"?"home":V,title:A,kind:x,address:t.attach==="home"?"/":`/places/${encodeURIComponent(V)}`},seat:qt(a),width:e.width??1440,variant:(e.width??1440)<640?"phone":"wide",drawnBy:`view:${t.name}`,parts:d.parts,...d.videos.length>0?{videos:d.videos}:{},problems:D},{placeText:j}=await (__graviewPreload(import.meta.url,["./chunk.64LCHHZB.js","./chunk.CNN32262.js","./chunk.EP5JS7ZH.js","./chunk.L7XKYGV7.js","./chunk.CE3NKAF7.js","./chunk.R3GE37OI.js","./chunk.2KCDLCB2.js","./chunk.UD7VLXPM.js","./chunk.3DEWQDP7.js","./chunk.QUETLFBJ.js","./chunk.JULD4XFB.js","./chunk.GRTBEA7O.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.3WPCS6KP.js")),oe,re;if(e.audit===!0){let{auditView:S}=await (__graviewPreload(import.meta.url,["./chunk.JO2X52D4.js","./chunk.M5FP4Y4Q.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.G2BDEWJC.js")),U=(h.clicks??[]).flatMap(W=>d.drawn.elementOf(W)??[]);oe=S(d.drawn.root,{host:"pending",clicked:U}),e.drawing===!0&&(re={root:d.drawn.root,clicked:U})}return{ok:!0,description:{...M,text:j(M)},props:k,transcript:h,css:d.drawn.css,...E?{pressed:E}:{},...oe?{audit:oe}:{},...re?{drawing:re}:{},...H?{presses:H}:{}}}var Kt=6,ke=function*(e){for(let t of e.childNodes)t.nodeType===1&&(yield t,yield*ke(t))},Jt=(e,t)=>{for(let n=t;n;n=n.parentElement)if(n===e)return!0;return!1};function At(e,t){let n=[...ke(e)].filter(i=>i.getAttribute("data-record")===t);if(n.length===0)return null;let s=n[0];for(;s&&!n.every(i=>Jt(s,i));)s=s.parentElement;let a=s??e,l=[a,...ke(a)].flatMap(i=>i.getAttribute("data-act")?[i.getAttribute("data-act")]:[]),u=[a,...ke(a)].flatMap(i=>i.getAttribute("aria-pressed")||i.getAttribute("aria-checked")?[`${i.getAttribute("aria-pressed")??""}${i.getAttribute("aria-checked")??""}`]:[]);return`${a.textContent.replace(/\s+/g," ").trim()}|${l.join(",")}|${u.join(",")}`}var Tt=(e,t)=>new RegExp(`\\s${t}="([^"]*)"`).exec(e)?.[1];function Xt(e){return new Pe({schema:e.schema,mutations:e.allMutations(),invariants:e.allInvariants(),...e.policy?{policy:e.policy}:{},snapshot:e.graph.snapshot()})}var Qt=e=>JSON.stringify(Object.entries(e??{}).filter(([,t])=>typeof t=="boolean").sort(([t],[n])=>t.localeCompare(n)));async function sn(e){let t=ht(),n=await Oe({...e,run:t,presses:mt,audit:!0,drawing:!0});if(!n.ok||!n.presses||!n.drawing)return n;let s=await er(e,n.presses,n.drawing.root,t);if(s.length===0)return n;let a=[...n.presses.problems,...s];return{...n,presses:{...n.presses,ok:!1,controls:[...n.presses.controls,...s],problems:a,text:`${n.presses.text}${s.map(l=>` FAILS ${l.says}
|
|
22
22
|
`).join("")}`}}}async function er(e,t,n,s){let{store:a,principal:l,manifest:u}=e,i=new Set(a.graph.allNodes().map(b=>b.id)),f=new Set,m=[];for(let b of t.controls){if(f.size>=Kt)break;if(b.does!=="act"||!b.ok)continue;let o=Tt(b.element,"data-act"),N=Tt(b.element,"data-record");if(!o||!N)continue;let T=a.graph.getNode(N),p=`${o}|${Qt(T)}`;if(f.has(p))continue;f.add(p);let y=J(a,u,i,{as:o,record:N,fields:[]});if(!y.ok)continue;let k={name:y.name,args:y.args},v=T?`\u201C${Ie(a.schema.tryDefinition(T.kind),T)}\u201D`:`\u201C${N}\u201D`;if(!a.wouldChange(k,l)){let h=g=>new Set(a.allMutations().find(w=>w.name===g)?.writes??[]),r=h(y.name),d=ye(u).filter(g=>g.act!==y.name&&r.size>0&&[...h(g.act)].some(w=>r.has(w))).filter(g=>{let w=J(a,u,i,{as:g.as??g.act,record:N,fields:[]});return w.ok&&a.wouldChange({name:w.name,args:w.args},l)}).map(g=>`\u201C${g.as??g.act}\u201D`);m.push({control:b.control,element:b.element,does:"act",ok:!1,says:`On ${v} it asks for \u201C${o}\u201D, which changes nothing there: it is so already.${d.length>0?` Bind its press there to ${d.join(" or ")} instead, as the page did, so a person can take it back.`:""}`});continue}let $=Xt(a);try{$.apply(k,{author:l})}catch{continue}let c=await Oe({...e,store:$,run:s,audit:!0,drawing:!0});!c.ok||!c.drawing||At(c.drawing.root,N)===At(n,N)&&m.push({control:b.control,element:b.element,does:"act",ok:!1,says:`Pressed on ${v}, it lands, and the design draws ${v} just as before it: show what it changed \u2014 its words or its control (a finished task says so and offers the act that takes it back).`})}return m}export{At as drawnRecord,sn as pressedHere};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Ry}from"./chunk.
|
|
1
|
+
import{c as Ry}from"./chunk.7TDML5YU.js";import{G as Cy}from"./chunk.3VEZ5MOC.js";import{a as an}from"./chunk.AJZBJBMO.js";var Ti=an(J=>{"use strict";function Gf(l,a){var t=l.length;l.push(a);l:for(;0<t;){var u=t-1>>>1,n=l[u];if(0<tn(n,a))l[u]=a,l[t]=n,t=u;else break l}}function Ll(l){return l.length===0?null:l[0]}function nn(l){if(l.length===0)return null;var a=l[0],t=l.pop();if(t!==a){l[0]=t;l:for(var u=0,n=l.length,f=n>>>1;u<f;){var e=2*(u+1)-1,c=l[e],i=e+1,m=l[i];if(0>tn(c,t))i<n&&0>tn(m,c)?(l[u]=m,l[i]=t,u=i):(l[u]=c,l[e]=t,u=e);else if(i<n&&0>tn(m,t))l[u]=m,l[i]=t,u=i;else break l}}return a}function tn(l,a){var t=l.sortIndex-a.sortIndex;return t!==0?t:l.id-a.id}J.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(yi=performance,J.unstable_now=function(){return yi.now()}):(Yf=Date,mi=Yf.now(),J.unstable_now=function(){return Yf.now()-mi});var yi,Yf,mi,Il=[],Aa=[],jy=1,Bl=null,ml=3,Zf=!1,au=!1,tu=!1,Cf=!1,Si=typeof setTimeout=="function"?setTimeout:null,gi=typeof clearTimeout=="function"?clearTimeout:null,hi=typeof setImmediate<"u"?setImmediate:null;function un(l){for(var a=Ll(Aa);a!==null;){if(a.callback===null)nn(Aa);else if(a.startTime<=l)nn(Aa),a.sortIndex=a.expirationTime,Gf(Il,a);else break;a=Ll(Aa)}}function Rf(l){if(tu=!1,un(l),!au)if(Ll(Il)!==null)au=!0,ht||(ht=!0,mt());else{var a=Ll(Aa);a!==null&&jf(Rf,a.startTime-l)}}var ht=!1,uu=-1,bi=5,zi=-1;function Ai(){return Cf?!0:!(J.unstable_now()-zi<bi)}function Qf(){if(Cf=!1,ht){var l=J.unstable_now();zi=l;var a=!0;try{l:{au=!1,tu&&(tu=!1,gi(uu),uu=-1),Zf=!0;var t=ml;try{a:{for(un(l),Bl=Ll(Il);Bl!==null&&!(Bl.expirationTime>l&&Ai());){var u=Bl.callback;if(typeof u=="function"){Bl.callback=null,ml=Bl.priorityLevel;var n=u(Bl.expirationTime<=l);if(l=J.unstable_now(),typeof n=="function"){Bl.callback=n,un(l),a=!0;break a}Bl===Ll(Il)&&nn(Il),un(l)}else nn(Il);Bl=Ll(Il)}if(Bl!==null)a=!0;else{var f=Ll(Aa);f!==null&&jf(Rf,f.startTime-l),a=!1}}break l}finally{Bl=null,ml=t,Zf=!1}a=void 0}}finally{a?mt():ht=!1}}}var mt;typeof hi=="function"?mt=function(){hi(Qf)}:typeof MessageChannel<"u"?(Xf=new MessageChannel,di=Xf.port2,Xf.port1.onmessage=Qf,mt=function(){di.postMessage(null)}):mt=function(){Si(Qf,0)};var Xf,di;function jf(l,a){uu=Si(function(){l(J.unstable_now())},a)}J.unstable_IdlePriority=5;J.unstable_ImmediatePriority=1;J.unstable_LowPriority=4;J.unstable_NormalPriority=3;J.unstable_Profiling=null;J.unstable_UserBlockingPriority=2;J.unstable_cancelCallback=function(l){l.callback=null};J.unstable_forceFrameRate=function(l){0>l||125<l?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):bi=0<l?Math.floor(1e3/l):5};J.unstable_getCurrentPriorityLevel=function(){return ml};J.unstable_next=function(l){switch(ml){case 1:case 2:case 3:var a=3;break;default:a=ml}var t=ml;ml=a;try{return l()}finally{ml=t}};J.unstable_requestPaint=function(){Cf=!0};J.unstable_runWithPriority=function(l,a){switch(l){case 1:case 2:case 3:case 4:case 5:break;default:l=3}var t=ml;ml=l;try{return a()}finally{ml=t}};J.unstable_scheduleCallback=function(l,a,t){var u=J.unstable_now();switch(typeof t=="object"&&t!==null?(t=t.delay,t=typeof t=="number"&&0<t?u+t:u):t=u,l){case 1:var n=-1;break;case 2:n=250;break;case 5:n=1073741823;break;case 4:n=1e4;break;default:n=5e3}return n=t+n,l={id:jy++,callback:a,priorityLevel:l,startTime:t,expirationTime:n,sortIndex:-1},t>u?(l.sortIndex=t,Gf(Aa,l),Ll(Il)===null&&l===Ll(Aa)&&(tu?(gi(uu),uu=-1):tu=!0,jf(Rf,t-u))):(l.sortIndex=n,Gf(Il,l),au||Zf||(au=!0,ht||(ht=!0,mt()))),l};J.unstable_shouldYield=Ai;J.unstable_wrapCallback=function(l){var a=ml;return function(){var t=ml;ml=a;try{return l.apply(this,arguments)}finally{ml=t}}}});var Mi=an((dd,Ei)=>{"use strict";Ei.exports=Ti()});var Qy=an(qf=>{"use strict";var tl=Mi(),w0=Cy(),Vy=Ry();function A(l){var a="https://react.dev/errors/"+l;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)a+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+l+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function F0(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}function Ku(l){var a=l,t=l;if(l.alternate)for(;a.return;)a=a.return;else{l=a;do a=l,(a.flags&4098)!==0&&(t=a.return),l=a.return;while(l)}return a.tag===3?t:null}function $0(l){if(l.tag===13){var a=l.memoizedState;if(a===null&&(l=l.alternate,l!==null&&(a=l.memoizedState)),a!==null)return a.dehydrated}return null}function k0(l){if(l.tag===31){var a=l.memoizedState;if(a===null&&(l=l.alternate,l!==null&&(a=l.memoizedState)),a!==null)return a.dehydrated}return null}function Oi(l){if(Ku(l)!==l)throw Error(A(188))}function xy(l){var a=l.alternate;if(!a){if(a=Ku(l),a===null)throw Error(A(188));return a!==l?null:l}for(var t=l,u=a;;){var n=t.return;if(n===null)break;var f=n.alternate;if(f===null){if(u=n.return,u!==null){t=u;continue}break}if(n.child===f.child){for(f=n.child;f;){if(f===t)return Oi(n),l;if(f===u)return Oi(n),a;f=f.sibling}throw Error(A(188))}if(t.return!==u.return)t=n,u=f;else{for(var e=!1,c=n.child;c;){if(c===t){e=!0,t=n,u=f;break}if(c===u){e=!0,u=n,t=f;break}c=c.sibling}if(!e){for(c=f.child;c;){if(c===t){e=!0,t=f,u=n;break}if(c===u){e=!0,u=f,t=n;break}c=c.sibling}if(!e)throw Error(A(189))}}if(t.alternate!==u)throw Error(A(190))}if(t.tag!==3)throw Error(A(188));return t.stateNode.current===t?l:a}function I0(l){var a=l.tag;if(a===5||a===26||a===27||a===6)return l;for(l=l.child;l!==null;){if(a=I0(l),a!==null)return a;l=l.sibling}return null}var L=Object.assign,py=Symbol.for("react.element"),fn=Symbol.for("react.transitional.element"),mu=Symbol.for("react.portal"),At=Symbol.for("react.fragment"),r0=Symbol.for("react.strict_mode"),Te=Symbol.for("react.profiler"),P0=Symbol.for("react.consumer"),fa=Symbol.for("react.context"),Sc=Symbol.for("react.forward_ref"),Ee=Symbol.for("react.suspense"),Me=Symbol.for("react.suspense_list"),gc=Symbol.for("react.memo"),Ta=Symbol.for("react.lazy");Symbol.for("react.scope");var Oe=Symbol.for("react.activity");Symbol.for("react.legacy_hidden");Symbol.for("react.tracing_marker");var Ky=Symbol.for("react.memo_cache_sentinel");Symbol.for("react.view_transition");var Di=Symbol.iterator;function nu(l){return l===null||typeof l!="object"?null:(l=Di&&l[Di]||l["@@iterator"],typeof l=="function"?l:null)}var Ly=Symbol.for("react.client.reference");function De(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===Ly?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case At:return"Fragment";case Te:return"Profiler";case r0:return"StrictMode";case Ee:return"Suspense";case Me:return"SuspenseList";case Oe:return"Activity"}if(typeof l=="object")switch(l.$$typeof){case mu:return"Portal";case fa:return l.displayName||"Context";case P0:return(l._context.displayName||"Context")+".Consumer";case Sc:var a=l.render;return l=l.displayName,l||(l=a.displayName||a.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case gc:return a=l.displayName||null,a!==null?a:De(l.type)||"Memo";case Ta:a=l._payload,l=l._init;try{return De(l(a))}catch{}}return null}var hu=Array.isArray,D=w0.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=Vy.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ka={pending:!1,data:null,method:null,action:null},Ue=[],Tt=-1;function $l(l){return{current:l}}function fl(l){0>Tt||(l.current=Ue[Tt],Ue[Tt]=null,Tt--)}function x(l,a){Tt++,Ue[Tt]=l.current,l.current=a}var Fl=$l(null),Nu=$l(null),Ba=$l(null),jn=$l(null);function Vn(l,a){switch(x(Ba,a),x(Nu,l),x(Fl,null),a.nodeType){case 9:case 11:l=(l=a.documentElement)&&(l=l.namespaceURI)?B0(l):0;break;default:if(l=a.tagName,a=a.namespaceURI)a=B0(a),l=Ty(a,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}fl(Fl),x(Fl,l)}function Ct(){fl(Fl),fl(Nu),fl(Ba)}function se(l){l.memoizedState!==null&&x(jn,l);var a=Fl.current,t=Ty(a,l.type);a!==t&&(x(Nu,l),x(Fl,t))}function xn(l){Nu.current===l&&(fl(Fl),fl(Nu)),jn.current===l&&(fl(jn),Vu._currentValue=ka)}var Vf,Ui;function Wa(l){if(Vf===void 0)try{throw Error()}catch(t){var a=t.stack.trim().match(/\n( *(at )?)/);Vf=a&&a[1]||"",Ui=-1<t.stack.indexOf(`
|
|
2
2
|
at`)?" (<anonymous>)":-1<t.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
3
|
`+Vf+l+Ui}var xf=!1;function pf(l,a){if(!l||xf)return"";xf=!0;var t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(a){var z=function(){throw Error()};if(Object.defineProperty(z.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(z,[])}catch(S){var d=S}Reflect.construct(l,[],z)}else{try{z.call()}catch(S){d=S}l.call(z.prototype)}}else{try{throw Error()}catch(S){d=S}(z=l())&&typeof z.catch=="function"&&z.catch(function(){})}}catch(S){if(S&&d&&typeof S.stack=="string")return[S.stack,d.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var n=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");n&&n.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=u.DetermineComponentFrameRoot(),e=f[0],c=f[1];if(e&&c){var i=e.split(`
|
|
4
4
|
`),m=c.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as H,e as R,f as k}from"./chunk.
|
|
1
|
+
import{d as H,e as R,f as k}from"./chunk.AQ2PI6MR.js";import{b as L}from"./chunk.H3W5C3XQ.js";import{b as C}from"./chunk.6WB2TYK7.js";import"./chunk.BJUUSIQY.js";import"./chunk.N5Z34V7U.js";import{a as S}from"./chunk.YL2RBZFE.js";import"./chunk.LOKGUALC.js";import"./chunk.JGRSUTPJ.js";import"./chunk.XOZU4OFA.js";import"./chunk.EP5JS7ZH.js";import"./chunk.CE3NKAF7.js";import"./chunk.TFJA4QV4.js";import"./chunk.HWFJQ42Y.js";import"./chunk.QUETLFBJ.js";import"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{G as T,Va as E,W as b}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import{td as x}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as g}from"./chunk.AJZBJBMO.js";var t=g(T(),1);var c=g(b(),1);function N(n){if(!n||n.interaction.outcome==="failed")return null;let s=n.offers[0],o=s?n.interaction.offered.find(i=>i.id===s.id)?.confidence:void 0;return s&&o!==void 0&&o>=.6?{offer:s,confidence:o}:null}function V({rest:n,hold:s,leave:o}){let i=S(),u=(0,t.useMemo)(()=>C(n.target,e=>i.store.graph.has(e)),[n.target,i.store]),l=u.on==="record"&&L(i.ai)!==void 0,m=l?H(i,u):void 0,p=JSON.stringify(u),[y,I]=(0,t.useState)(null);(0,t.useEffect)(()=>{if(!l||m!==void 0)return;let e=!0;return R(i,u).then(r=>{e&&I({key:p,result:r})}),()=>{e=!1}},[p,l]);let w=m??(y?.key===p?y.result:void 0),f=l?N(w):null,v=f?.offer.id??null,h=(0,t.useRef)(null);if((0,t.useEffect)(()=>{if(v===null)return;let e=r=>{r.target instanceof Node&&h.current?.contains(r.target)||o(!0)};return document.addEventListener("pointerdown",e,{capture:!0,passive:!0}),document.addEventListener("contextmenu",e,{capture:!0,passive:!0}),addEventListener("scroll",e,{capture:!0,passive:!0}),addEventListener("resize",e,{passive:!0}),()=>{document.removeEventListener("pointerdown",e,{capture:!0}),document.removeEventListener("contextmenu",e,{capture:!0}),removeEventListener("scroll",e,{capture:!0}),removeEventListener("resize",e)}},[v,o]),(0,t.useLayoutEffect)(()=>{let e=h.current;if(!e)return;if(typeof e.showPopover=="function"&&!E(e))try{e.showPopover()}catch{}let r=n.element.getBoundingClientRect(),d=e.getBoundingClientRect(),O=r.top-d.height-4>=4?r.top-d.height-4:Math.min(innerHeight-d.height-4,r.top+4),A=Math.max(4,Math.min(innerWidth-d.width-4,r.right-d.width));e.style.top=`${Math.round(O)}px`,e.style.left=`${Math.round(A)}px`},[v,n.element]),!f)return null;let{offer:a,confidence:P}=f,M=a.type==="panel"?"a panel":a.type==="place"?"go there":a.type==="record"?"open it":"suggested";return(0,c.jsxs)("button",{ref:h,type:"button",popover:"manual","data-testid":"hover-chip","data-ai-offer":a.id,"data-ai-offer-type":a.type,"data-graview-overlay":"","data-graview-popover":"","aria-label":`Suggested by AI: ${a.label}`,title:`Suggested by AI, ${Math.round(P*100)}% sure`,onPointerEnter:s,onPointerLeave:()=>o(),onClick:()=>{n.element.closest("[tabindex], a[href], button")?.focus({preventScroll:!0}),o(!0),k(i,w,a)},style:$,children:[(0,c.jsxs)("span",{"aria-hidden":"true",style:{color:"var(--graview-accent)"},children:["\u2726"," "]}),a.label,(0,c.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",M]})]})}var $={position:"fixed",inset:"auto",top:0,left:0,margin:0,zIndex:x("toast"),boxSizing:"border-box",width:"max-content",maxWidth:"min(320px, calc(100vw - 8px))",height:"auto",minHeight:24,padding:"2px 10px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",borderRadius:999,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",font:"inherit",fontSize:"0.75rem",cursor:"pointer"};export{V as HoverChip};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as f}from"./chunk.
|
|
1
|
+
import{a as f}from"./chunk.EP5JS7ZH.js";import{la as d}from"./chunk.6AANHELP.js";function S(e){let o=e.indexOf("{"),a=e.indexOf("["),t=a!==-1&&(o===-1||a<o)?a:o;if(t===-1)return;let n=e[t],r=n==="["?"]":"}",i=0,u=!1,l=!1;for(let s=t;s<e.length;s++){let c=e[s];if(u){l?l=!1:c==="\\"?l=!0:c==='"'&&(u=!1);continue}if(c==='"')u=!0;else if(c===n)i+=1;else if(c===r&&(i-=1,i===0))try{return JSON.parse(e.slice(t,s+1))}catch{return}}}function w(e,o){let a;try{a=e.mutation(o.mutation)}catch{return o}let t={...o.args},n=!1;for(let r of f(a.input)){if(r.control!=="node")continue;let i=t[r.name];if(typeof i!="string"||i.length===0||e.graph.getNode(i))continue;let u=i.trim().toLowerCase(),l=[...e.graph.allNodes()].filter(s=>(r.kinds.includes("*")||r.kinds.includes(s.kind))&&d(e.schema.tryDefinition(s.kind),s).trim().toLowerCase()===u);l.length===1&&(t[r.name]=l[0].id,n=!0)}return n?{...o,args:t}:o}function x(e,o,a){let t=a===void 0?null:new Set(a),n=[];for(let r of o){if(typeof r.mutation!="string")continue;let i=!0;try{e.mutation(r.mutation)}catch{i=!1}i?t&&!t.has(r.mutation)&&n.push({proposal:r,why:"not-allowed"}):n.push({proposal:r,why:"unknown"})}return n}function v(e,o,a){let t=a===void 0?null:new Set(a);return o.filter(n=>{if(typeof n.mutation!="string"||t&&!t.has(n.mutation))return!1;try{e.mutation(n.mutation)}catch{return!1}return n.args!==null&&typeof n.args=="object"})}export{S as a,w as b,x as c,v as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{sd as d}from"./chunk.
|
|
1
|
+
import{sd as d}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var m="data-graview-refused-note",u=`position:absolute;z-index:${d.over};box-sizing:border-box;margin:0;padding:4px 8px;max-width:min(40ch,calc(100% - 8px));border-radius:6px;font:inherit;font-size:0.8125rem;line-height:1.35;color:var(--graview-ink,CanvasText);background:var(--graview-panel,Canvas);border:1px solid var(--graview-danger,#b42318);box-shadow:0 2px 8px rgb(0 0 0 / 0.12);pointer-events:none;overflow-wrap:anywhere`;function v(s){let n=new Map,p=0,a=(t,o)=>{let e=s.host.getBoundingClientRect(),r=t.getBoundingClientRect(),f=o.offsetWidth,i=o.offsetHeight,g=Math.max(4,Math.min(r.left-e.left,e.width-f-4)),c=r.bottom-e.top+4,h=c+i<=e.height||r.top-e.top-i-4<0?c:r.top-e.top-i-4;o.style.left=`${Math.round(g)}px`,o.style.top=`${Math.round(h)}px`},l={say(t,o){l.clear(t);let e=s.ownerDocument.createElement("p");e.setAttribute(m,""),e.setAttribute("role","status"),e.id=`graview-refused-${p+=1}`,e.setAttribute("style",u),e.textContent=o,s.appendChild(e),n.set(t,e),a(t,e)},clear(t){let o=n.get(t);o&&(o.remove(),n.delete(t))},refresh(){for(let[t,o]of n)t.isConnected?a(t,o):(o.remove(),n.delete(t))}};return l}export{v as createRefusalNotes};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{P as b,Z as g,cc as x,ga as h,gc as k,ha as $}from"./chunk.
|
|
1
|
+
import{P as b,Z as g,cc as x,ga as h,gc as k,ha as $}from"./chunk.6AANHELP.js";function z(t,n,e){let r=t?.display?.format?.[n];return r?r(e):typeof e=="string"?$(e):String(e)}function B(t,n,e,r){let s=t.tryDefinition(n)?.edges,i=s&&Object.hasOwn(s,e)?s[e]:void 0;return(r==="out"?i?.description:i?.inverse)??h(e).toLowerCase()}var w=/^ {0,3}#{1,6}(?:[ \t]+|$)/,m=/^[ \t]*(?:[-*+•]|\d{1,9}[.)])[ \t]+(?:\[[ xX]\][ \t]+)?/,R=/^ {0,3}(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/,O=/^ {0,3}(?:`{3,}|~{3,})/,S=/^ {0,3}(?:>[ \t]?)+/,F=/^\|?\s*:?-{2,}:?\s*(?:\|\s*:?-{2,}:?\s*)*\|?$/,T={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'",nbsp:" "};function _(t){return t.replace(/!?\[([^\]\n]{0,500})\]\([^)\n]{0,500}\)/g,"$1").replace(/<((?:https?:|mailto:)[^>\s]*)>/gi,"$1").replace(/<\/?[A-Za-z][^<>\n]*>/g,"").replace(/`+([^`\n]*)`+/g,"$1").replace(/(\*\*|__|~~)(?=\S)([^\n]{0,500}?\S)\1/g,"$2").replace(/(^|[^\w*])\*(?=\S)([^*\n]{0,500}?\S)\*(?![\w*])/g,"$1$2").replace(/(^|\W)_(?=\S)([^_\n]{0,500}?\S)_(?!\w)/g,"$1$2").replace(/\\([\\`*_{}[\]()#+\-.!>|~])/g,"$1").replace(/&(amp|lt|gt|quot|#39|nbsp);/g,(n,e)=>T[e]??"")}function N(t,n,e){let r=t.replace(/\r\n?/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`),s=[],i=[],u=0,d=!1,a=()=>{let o=i.join(" ").replace(/\s+/g," ").trim();o&&(s.push(o),u+=o.length),i=[]},c=0;for(;c<r.length&&u<=e;){let o=r[c++];if(n&&O.test(o)){d=!d,d||a();continue}if(!d&&(o.trim().length===0||n&&(R.test(o)||F.test(o.trim())))){a();continue}let f=!d&&n&&w.test(o),l=!d&&m.test(o);if((f||l)&&a(),n&&!d?(o=o.replace(S,""),f&&(o=o.replace(w,"").replace(/[ \t]+#+[ \t]*$/,"")),l&&(o=o.replace(m,"")),o.includes("|")&&(o=o.replace(/^[ \t]*\||\|[ \t]*$/g,"").split("|").map(p=>p.trim()).filter(Boolean).join(" \xB7 ")),o=_(Number.isFinite(e)?o.slice(0,e*2+200):o)):l&&(o=o.replace(m,"")),i.push(o),f&&a(),i.reduce((p,A)=>p+A.length,0)>e)break}return a(),{blocks:s,more:r.slice(c).some(o=>o.trim().length>0&&!(n&&(O.test(o)||R.test(o))))}}function E(t,n){return`${(t.slice(0,n+1).replace(/\s+\S*$/,"")||t.slice(0,n)).replace(/[\s,;:.—-]+$/,"")}\u2026`}function Q(t,n={}){let e=n.most??160,{blocks:r,more:s}=N(t,n.markdown===!0,e),i=r[0]??"";if(i.length<=e)return(s||r.length>1)&&i.length>0&&!/[.!?…:]$/.test(i)?`${i}\u2026`:i;let u=k(i);return u&&u.length<=e?u:E(i,e)}var X=t=>N(t,!0,Number.POSITIVE_INFINITY).blocks.join(" ");var j={d:1440,h:60,m:1};function K(t){if(typeof t=="number")return Number.isFinite(t)&&t>=0?Math.round(t):void 0;if(typeof t!="string")return;let n=t.trim().toLowerCase();if(/^\d+$/.test(n))return Number(n);let e=/^(\d+):([0-5]\d)(?::([0-5]\d))?$/.exec(n);if(e)return Number(e[1])*60+Number(e[2])+Math.round(Number(e[3]??0)/60);let r=0,s=!1,i=n.replace(/(\d*[.,]?\d+) *(days?|d|hours?|hrs?|hr|h|minutes?|mins?|min|m)(?![a-z])/g,(u,d,a)=>(s=!0,r+=Number(d.replace(",","."))*j[a[0]]," "));return s&&/^[\s,+]*(?:and[\s,+]*)*$/.test(i)?Math.round(r):void 0}function I(t,n){if(!Number.isFinite(t))return String(t);let e=Math.round(Math.abs(t)),r=Math.floor(e/60),s=e%60,i=[r?`${g(r,n)} h`:"",s||!r?`${g(s,n)} min`:""].filter(Boolean).join(" ");return t<0?`\u2212${i}`:i}var M=/^(\+?1[ .-]?)?\(?([2-9]\d\d)\)?[ .-]?(\d{3})[ .-]?(\d{4})(?: *(?:ext\.?|x|#) *(\d+))?$/i;function W(t,n){let e=t.trim(),r=/[-_](US|CA)\b/i.test(b(n))?M.exec(e):null;if(!r)return e;let[,s,i,u,d,a]=r;return`${s?.startsWith("+")?"+1 ":""}(${i}) ${u}-${d}${a?` ext. ${a}`:""}`}function D(t){let[,n="",e]=/^(.*?)(?: *(?:ext\.?|x|#) *(\d+))?$/i.exec(t.trim())??[],r=n.replace(/\D/g,"");return r.length<3?void 0:`tel:${n.startsWith("+")?"+":""}${r}${e?`;ext=${e}`:""}`}var P=()=>/Mac|iPhone|iPad|iPod/.test(globalThis.navigator?.userAgent??"");function L(t,n=P()){let e=encodeURIComponent(t.trim());return n?`https://maps.apple.com/?q=${e}`:`https://www.google.com/maps/search/?api=1&query=${e}`}var q=t=>t?.fields?.shape??{},C=(t,n)=>{let e=q(t);return Object.hasOwn(e,n)?x(e[n]):void 0},y=(t,n)=>{let e=t?.computed,r=e&&Object.hasOwn(e,n)?e[n]:void 0;return typeof r=="object"?r:void 0},H=(t,n)=>{let e=y(t,n);return e?.as??(e?.format==="duration"?"duration":void 0)};function v(t,n){let e=y(t,n);if(!e)return;if(e.amount)return e.amount;let r=e.format==="money"||e.format==="percent"?e.format:void 0;return r||!e.format&&e.unit?{...r?{format:r}:{},...e.unit?{unit:e.unit}:{}}:void 0}function ee(t,n){return y(t,n)?.hidden===!0}function ne(t,n){return C(t,n)??(t&&H(t,n)==="duration"?"duration":void 0)}function te(t,n,e){return t==="duration"?typeof n=="number"?I(n,e):void 0:t==="phone"?typeof n=="string"?W(n,e):void 0:t==="place"&&typeof n=="string"?n.trim():void 0}function re(t,n){if(!(typeof n!="string"||!n.trim()))return t==="phone"?D(n):t==="place"?L(n):void 0}export{z as a,B as b,Q as c,X as d,K as e,v as f,ee as g,ne as h,te as i,re as j};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as h}from"./chunk.
|
|
1
|
+
import{G as h}from"./chunk.3VEZ5MOC.js";import{Qd as u,Sc as a,ed as m}from"./chunk.6AANHELP.js";import{b as l}from"./chunk.AJZBJBMO.js";function f(e){let t=[e?.typography?.body,e?.typography?.display,e?.typography?.mono],o=[];for(let i of t){let n=i?.split(",")[0]?.trim().replace(/^["']|["']$/g,"");!n||m(n)||n.toLowerCase()!==a.toLowerCase()&&(o.includes(n)||o.push(n))}return o}function g(e){let t=f(e);return t.length===0?null:`https://fonts.googleapis.com/css2?${t.map(i=>`family=${encodeURIComponent(i).replace(/%20/g,"+")}:wght@400;500;600;700`).join("&")}&display=swap`}var r=l(h(),1);function k(e,t){return new u({schema:e.schema,mutations:e.mutations??[],invariants:e.invariants??[],...t?{snapshot:t}:{},...e.policy?{policy:e.policy}:{},...e.publishing?{publishing:e.publishing}:{},...e.tidying?{tidying:e.tidying}:{},...e.intelligence?{intelligence:e.intelligence}:{},...e.brand?.timeZone?{timeZone:e.brand.timeZone}:{}})}function d(e){if(typeof document>"u")return e==="dark"?"dark":"light";let t=document.documentElement.dataset.theme;return t==="dark"||t==="light"?t:e==="dark"||e==="light"?e:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function v(e,t){let[o,i]=(0,r.useState)(()=>d(t));return(0,r.useEffect)(()=>{if(!e||typeof document>"u")return;let n=()=>i(d(t));n();let s=new MutationObserver(n);s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});let c=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):null;return c?.addEventListener?.("change",n),()=>{s.disconnect(),c?.removeEventListener?.("change",n)}},[e,t]),o}export{g as a,k as b,v as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as fe,b as Ne,d as Ze,e as He,f as he,g as F,h as ke,j as We}from"./chunk.6N4PE3U5.js";import{h as Je,i as Xe,j as Qe}from"./chunk.WALVW3KJ.js";import{a as ae,b as ce,c as J,d as Ye,e as ee,g as se,h as en}from"./chunk.UGQYMN4J.js";import{c as Be,h as k,i as Ue,j as ze,t as ye}from"./chunk.RG5G6YQD.js";import{A as re,Ia as Ie,Ld as qe,Md as Ve,Pa as Ke,Qa as Q,Ra as me,b as Z,c as U,e as ue,f as Me,g as P,h as O,ic as Pe,jc as ge,k as L,kc as Le,l as X,lc as Ge,m as _,mc as Ce,n as _e,o as H,p as I,r as $,s as oe,t as R,u as j,v as G,w as T,x as n,y as N,z as Y}from"./chunk.ZEZUKRC6.js";var be=e=>Object.entries(e).map(([s,i])=>[s,Object.keys(Q(i?.edges))]),we=(e,s)=>Le(e,be(s));function nn(e){return[...Object.keys(e.acts??{}),...Object.keys(e.kinds).flatMap(s=>Pe(s)),...Ge(be(e.kinds))]}var B=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function tn(e){if(!B(e)||!B(e.kinds))return e;let s;try{let f=Object.fromEntries(Object.entries(e.kinds).map(([g,l])=>[g,B(l)&&B(l.edges)?{edges:l.edges}:{}]));s=nn({acts:B(e.acts)?e.acts:{},kinds:f})}catch{return e}let i=new Set(s),t=!1,o=f=>{if(typeof f!="string"||i.has(f))return f;let g=qe(f,s);return g===void 0?f:(t=!0,g)},a=B(e.policy)&&Array.isArray(e.policy.grants)?{...e.policy,grants:e.policy.grants.map(f=>B(f)&&Array.isArray(f.mutations)?{...f,mutations:f.mutations.map(o)}:f)}:void 0,u=B(e.rules)?Object.fromEntries(Object.entries(e.rules).map(([f,g])=>[f,B(g)&&Array.isArray(g.repairs)?{...g,repairs:g.repairs.map(l=>B(l)?{...l,act:o(l.act)}:l)}:g])):void 0;return t?{...e,...a?{policy:a}:{},...u?{rules:u}:{}}:e}function $e(e,s){let i=Ve(e,nn(s));return i&&i!==e?`did you mean "${i}"?`:void 0}var Oe="graview-document",je=1,xe=256*1024,ne=64*1024,vn=["plain","editorial","shader","ascii"];var Se=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ve=/^[a-z][A-Za-z0-9]*$/,On=/^[a-z0-9\u00df-\u00ff'-]+( [a-z0-9\u00df-\u00ff'-]+){0,2}$/,on=12,sn=60,jn=new Set(["id","kind"]),xn=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,An=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"];function En(){let e=h=>h in Object.prototype,s=Y(h=>!e(h),"every object already has this name \u2014 choose another"),i=(h,D)=>[...h===void 0?[]:[Me(h)],...D===void 0?[]:[ue(D)]],t=(h,D)=>O().check(...i(h,D)),o=(h,D,te)=>I(h).check(...i(D,te)),a=h=>O().check(P(Se,`${h} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),u=O().check(P(xn,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),s),f=O().check(P(ve,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),Y(h=>!jn.has(h),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),s),g=t(1,500),l=O().check(ue(40),P(On,'an alias is up to three lower-case words, like "supplier"')),r=t(1,2e3),p=t(1,300),y=$({type:G(An),required:n(_()),description:n(g),label:n(t(1,60)),aliases:n(o(l,1,on)),options:n(o(t(1,80),1,100)),multiple:n(_()),optionLabels:n(j(t(1,80),t(1,80))),of:n(G(["string","number","date","image","video","file"])),default:n(H()),unit:n(t(void 0,12)),format:n(G(["money","percent","duration","markdown"])),places:n(T(0)),min:n(L()),max:n(L()),step:n(L()),renamedFrom:n(O().check(P(ve))),repeats:n(_()),collaborative:n(_())}).check(re((h,D)=>{h.type==="enum"&&!h.options&&D.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),h.type!=="enum"&&h.options&&D.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]}),h.type!=="enum"&&h.multiple!==void 0&&D.addIssue({code:"custom",message:'"multiple" belongs only on an enum field: a choice that takes several of its options',path:["multiple"]});for(let te of Object.keys(h.optionLabels??{}))h.options?.includes(te)||D.addIssue({code:"custom",message:`"${te}" is labeled, and is none of the field's options`,path:["optionLabels",te]});h.type!=="list"&&h.of&&D.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),h.places!==void 0&&!(h.format==="money"||!h.format&&/^[A-Z]{3}$/.test(h.unit??""))&&D.addIssue({code:"custom",message:'"places" belongs only on money: a number field with "format": "money"',path:["places"]}),h.repeats&&h.type!=="date"&&h.type!=="datetime"&&D.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),m=O().check(P(new RegExp(`${Se.source}|${Ie.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),d=$({to:R([o(m,1),T("*")]),cardinality:n(G(["one","many"])),description:n(g),inverse:n(t(1,80)),appendOnly:n(_()),renamedFrom:n(O()),tidying:n(T("never"))}),c=R([r,$({expr:r,label:n(t(1,60)),description:n(g),format:n(G(["money","percent","duration"])),unit:n(t(1,12)),places:n(T(0)),hidden:n(_())})]),S=R([O(),L(),_(),_e(),I(H()),$({expr:r})]),b=$({noun:n(t(1,40)),plural:n(t(1,40)),aliases:n(o(l,1,on)),description:n(g),fields:j(f,y).check(Y(h=>Object.keys(h).length>0,"a kind has at least one field")),label:n(p),describe:n(p),lifecycle:n($({field:f,retired:o(R([O(),L(),_()]),1)})),figure:n(t(void 0,2e4)),glance:n(o(f,1,20)),page:n($({fields:n(o(f,1,40)),groups:n(o($({title:t(1,60),fields:o(f,1,40)}),1,12))})),edges:n(j(u,d)),computed:n(j(O(),c).check(Y(h=>Object.keys(h).length<=sn,`a kind works out at most ${sn} computed fields`))),fieldRoles:n(j(O(),O())),renamedFrom:n(O().check(P(Se))),people:n(_()),archives:n(T(!1)),tidying:n(G(["never","no-links"])),derives:n($({from:a("kind"),via:u,set:j(f,S)}))}),v=O().check(P(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),x=R([$({create:a("kind"),as:n(O().check(P(ve))),set:n(j(f,S))}),$({set:j(f,S),target:n(v)}),$({connect:u,from:v,to:v}),$({sever:u,from:v,to:v}),$({remove:v})]),A=$({title:n(t(1,80)),description:n(g),fromTheOtherEnd:n(t(1,80)),on:n(R([a("kind"),o(a("kind"),1)])),creates:n(a("kind")),sets:n(j(f,S)),writes:n(o(f,1)),connects:n(u),severs:n(u),setsOther:n(j(f,S)),setsLinked:n(j(u,j(f,S))),replaces:n(R([T(!0),o(u,1,10)])),removes:n(T(!0)),args:n(j(f,y)),effects:n(o(x,1,20)),allowedWhen:n(r),refusal:n(p),destructive:n(_())}),w=$({act:a("act"),label:n(t(1,80)),args:n(j(O(),S))}),C=$({every:a("kind"),through:u,via:n(u)}),q=$({title:n(t(1,120)),description:n(g),over:R([T("graph"),a("kind")]),when:n(r),require:n(r),covers:n(C),says:n(p),repairs:n(o(w,void 0,10))}).check(re((h,D)=>{!h.require&&!h.covers&&D.addIssue({code:"custom",message:'a rule says what must hold in "require", or what each record must be linked to in "covers"',path:["require"]}),h.require&&h.covers&&D.addIssue({code:"custom",message:'a rule is judged by "require" or by "covers", not both',path:["covers"]}),h.covers&&h.over==="graph"&&D.addIssue({code:"custom",message:'a coverage rule is over a kind, whose records it follows through their links; name the kind in "over"',path:["over"]})})),z=$({roles:R([o(a("role"),1),T("*")]),mutations:R([o(a("act")),T("*")]),kinds:n(R([I(a("kind")),T("*")])),describe:n(g),self:n(_()),ownEnd:n(_()),propose:n(R([o(a("act"),1),T("*")]))}).check(re((h,D)=>{Array.isArray(h.mutations)&&h.mutations.length===0&&h.propose===void 0&&D.addIssue({code:"custom",message:'a grant names at least one act in "mutations", or the acts it lets these roles propose in "propose"',path:["mutations"]})})),E=n(o(f,1)),M=$({roles:R([o(a("role"),1),T("*")]),kinds:o(a("kind"),1),own:n(_()),via:n(u),fields:E,hide:E}),ie=$({grants:I(z),sees:n(I(M))}),W=$({accent:n(O().check(P(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),ground:n(R([O().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"')),$({light:n(O().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"'))),dark:n(O().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#101826"')))})])),name:n(t(1,60)),currency:n(O().check(P(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:n(t(2,35)),timeZone:n(t(1,64)),logo:n(R([t(1,ne),$({src:t(1,ne),alt:n(t(1,120))}),$({light:t(1,ne),dark:n(t(1,ne)),alt:n(t(1,120)),darkFallback:n(T("invert"))})])),favicon:n(R([t(1,ne),$({emoji:O()})])),typography:n($({display:n(t(1,200)),body:n(t(1,200)),mono:n(t(1,200))})),shape:n($({radius:n(L().check(U(0),Z(32))),density:n(L().check(U(.75),Z(1.5)))})),accents:n(j(O(),L().check(U(0),Z(360)))),scheme:n(G(["light","dark","auto"])),subtitle:n(T(!1)),splash:n($({style:G(vn),image:n(t(1,ne)),title:n(t(1,80)),kicker:n(t(1,80)),shader:n(t(1,40)),scheme:n(G(["light","dark","device"]))})),views:n($({css:n(t(1)),motion:n(G(["none","fade"]))}))}),V=j(O(),H()),Fe=R([t(1,120),$({by:t(1,120),direction:n(G(["asc","desc"]))})]),De=L().check(X(),U(1),Z(9999)),hn=oe({create:n(_()),options:n(oe({sort:n(Fe),columnSort:n(Fe),search:n(o(t(1,120),void 0,40)),filters:n(o(t(1,120),void 0,40)),horizon:n(R([L().check(X(),U(1),Z(200)),oe({years:L().check(X(),U(1),Z(200)),title:t(1,80),from:n(De),to:n(De)})]))}))}),kn=$({card:n(I(H())),row:n(I(H())),page:n(I(H()))}),bn=()=>{let h=n(G(["asc","desc"]));return R([t(1,120),$({by:t(1,120),direction:h,then:n(R([t(1,120),$({by:t(1,120),direction:h})]))})])},wn=()=>R([t(1,120),$({by:t(1,120),order:n(o(t(1,80),void 0,40)),closed:n(o(t(1,80),void 0,40))})]),Te=oe({order:n(I(O())),hide:n(I(O())),first:n(O()),primary:n(o(t(1,80),void 0,40)),scene:n(t(1,40)),pages:n(t(1,40)),lists:n(j(O(),$({filters:n(o(t(1,120),void 0,40)),sort:n(bn()),group:n(wn()),export:n(_())})))}),$n=$({act:a("act"),title:n(t(1,80)),intro:n(g),fields:n(o(f,1,40)),say:n(g),submit:n(t(1,80)),role:n(a("role"))}),Sn=$({$schema:n(O()),format:T(Oe),formatVersion:T(je),name:t(1,80),description:n(g),version:n(L().check(X(),U(1))),kinds:j(a("kind"),b).check(Y(h=>Object.keys(h).length>0,"a document declares at least one kind"),Y(h=>Object.keys(h).length<=40,"a document declares at most 40 kinds")),computed:n(j(O(),c)),acts:n(j(a("act"),A)),rules:n(j(a("rule"),q)),roles:n(I(a("role"))),policy:n(ie),modules:n(V),lenses:n(I(hn)),pages:n(Te),views:n(j(O(),R([kn,I(H())]))),brand:n(W),settings:n(I(V)),migrations:n(I(V)),connections:n(j(a("connection"),V)),purpose:n(V),workflows:n(j(a("workflow"),V)),forms:n(j(a("form"),$n)),publishing:n($({mode:G(["live","on-publish"]),working:o(a("role"),void 0,40),publishers:n(o(a("role"),1,40))})),tidying:n($({autoAcceptAt:n(L().check(X(),U(1),Z(1e4)))}))});return{FieldSpec:y,EdgeSpec:d,ComputedSpec:c,KindSpec:b,ValueSpec:S,EffectSpec:x,ActSpec:A,RepairSpec:w,CoverSpec:C,RuleSpec:q,GrantSpec:z,SightSpec:M,PolicySpec:ie,BrandSpec:W,PagesSpec:Te,DocumentSpec:Sn}}var Rn,K=()=>Rn??=En(),Xn=N(()=>K().FieldSpec),Qn=N(()=>K().EdgeSpec),et=N(()=>K().ComputedSpec),nt=N(()=>K().KindSpec),tt=N(()=>K().ValueSpec),ot=N(()=>K().EffectSpec),st=N(()=>K().ActSpec),it=N(()=>K().RepairSpec),rt=N(()=>K().CoverSpec),at=N(()=>K().RuleSpec),ct=N(()=>K().GrantSpec),lt=N(()=>K().SightSpec),dt=N(()=>K().PolicySpec),pt=N(()=>K().BrandSpec),ft=N(()=>K().PagesSpec),rn=N(()=>K().DocumentSpec);var Fn={};function an(e,s=Fn,i=je){let{document:t,respelled:o}=Ne(e),a=o.length>0?{respelled:o}:{};if(!t||typeof t!="object"||Array.isArray(t))return{document:t};let u=t;if(u.format!==Oe||typeof u.formatVersion!="number"||u.formatVersion>=i)return{document:t,...a};let f=u.formatVersion,g=structuredClone(u);for(let l=f;l<i;l++){let r=s[l];if(!r)throw new Error(`there is no upgrade from format ${l} to ${l+1}`);g={...r(g),formatVersion:l+1}}return{document:g,from:f,...a}}function Ae(e,s,i){let t=Object.keys(e).filter(f=>e[f].edges?.[s]!==void 0);if(t.length===0)return;let o=t.map(f=>e[f].edges[s].to),a=o.some(f=>f==="*")?"*":[...new Set(o.flatMap(f=>f))];if(i.length===0||i.some(f=>t.includes(f)))return{reversed:!1,kinds:a};let u=t.filter(f=>{let g=e[f].edges[s].to;return g==="*"||i.every(l=>g.includes(l))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:a}}var dn=(e,s)=>{let i=e?.fields[s];return i!==void 0&&(i.type==="duration"||(i.type==="number"||i.type==="integer")&&i.format==="duration")};function cn(e,s,i,t){if(t==="out"){let o=e[s]?.edges?.[i]?.to;return o===void 0?[]:o==="*"?Object.keys(e):o}return Object.entries(e).filter(([,o])=>{let a=o.edges?.[i]?.to;return a!==void 0&&(a==="*"||a.includes(s))}).map(([o])=>o)}function Ee(e,s,i){if(i.t==="ident")return e[s]?.edges?.[i.name]?cn(e,s,i.name,"out"):void 0;if(i.t==="where")return Ee(e,s,i.set);if(i.t==="call"&&(i.fn==="out"||i.fn==="in")&&i.args[0]?.t==="lit"&&typeof i.args[0].value=="string")return cn(e,s,i.args[0].value,i.fn)}var ln=(e,s,i)=>{let t=s.filter(o=>e[o]?.fields[i]!==void 0);return t.length>0&&t.every(o=>dn(e[o],i))};function pn(e,s,i){let t=e.kinds,o=t[s],a=new Map(i),u=new Map,f=(l,r)=>{if(r>8)return!1;switch(l.t){case"ident":return dn(o,l.name)||g(l.name,r+1);case"member":{let p=Ee(t,s,l.object);return p!==void 0&&ln(t,p,l.name)}case"call":{if(l.fn!=="sum"&&l.fn!=="min"&&l.fn!=="max")return!1;let[p,y]=l.args,m=p&&Ee(t,s,p);return m!==void 0&&y?.t==="ident"&&ln(t,m,y.name)}case"binary":return(l.op==="+"||l.op==="-")&&f(l.left,r)&&f(l.right,r);case"unary":return l.op==="-"&&f(l.operand,r);default:return!1}},g=(l,r)=>{if(o?.computed?.[l]===void 0)return!1;if(u.has(l))return u.get(l);u.set(l,!1);let p=a.get(l),y=p!==void 0&&f(p,r);return u.set(l,y),y};return i.map(([l])=>l).filter(l=>g(l,0))}var Dn="several choices";var Tn={title:["string","text"],rich_text:["string","text"],number:["number","integer"],select:["enum","string"],status:["enum","string"],multi_select:["list",Dn],date:["date","datetime"],checkbox:["boolean"],url:["url","string"],email:["email","string"],phone_number:["phone","string"],people:["string","text","list"]};var fn=new Set(Object.values(Tn).flat());function un(e,s){let i=new Map;if(!e||typeof e!="object")return new Map;let t=Object.values(e).flatMap(o=>o&&typeof o=="object"&&o.system==="notion"&&Array.isArray(o.sources)?o.sources.filter(a=>a&&typeof a=="object").map(a=>({system:"notion",kind:a.kind,properties:a.properties})):[o]);for(let o of t){if(!o||typeof o!="object"||typeof o.kind!="string")continue;let a=s[o.kind]?.fields;if(!a)continue;let u=[];o.system==="google-calendar"&&o.fields&&typeof o.fields=="object"?u=Object.values(o.fields).filter(g=>typeof g=="string"):o.system==="notion"&&(u=o.properties&&typeof o.properties=="object"?Object.keys(o.properties):Object.keys(a).filter(g=>fn.has(a[g].type)));let f=i.get(o.kind)??new Set;for(let g of u)Object.hasOwn(a,g)&&f.add(g);i.set(o.kind,f)}return new Map([...i].filter(([,o])=>o.size>0).map(([o,a])=>[o,Object.keys(s[o].fields).filter(u=>a.has(u))]))}function mn(e,s,i=`kinds.${e}.page`){let t=s.page;if(!t)return[];let o=[],a=[...Object.keys(s.fields),...Object.keys(s.computed??{})],u=new Set,f=(l,r)=>{a.includes(l)?u.has(l)&&o.push(k("page-field-twice",r,`"${l}" is on ${e}'s page twice; name each field once`)):o.push(k("page-field",r,`${e}'s page is to show "${l}", and ${e} has no field or computed field called that`,`use one of: ${a.join(", ")}`)),u.add(l)};(t.fields??[]).forEach((l,r)=>f(l,`${i}.fields.${r}`));let g=new Set;return(t.groups??[]).forEach((l,r)=>{let p=l.title.trim().toLowerCase();g.has(p)&&o.push(k("page-group-twice",`${i}.groups.${r}.title`,`${e}'s page has two groups called "${l.title}"; give each its own title`)),g.add(p),l.fields.forEach((y,m)=>f(y,`${i}.groups.${r}.fields.${m}`))}),o}function gn(e,s=[]){return Ce({declared:Object.keys(e.fields),paged:[...e.page?.fields??[],...(e.page?.groups??[]).flatMap(i=>i.fields)],must:i=>!!e.fields[i].required&&e.fields[i].default===void 0,naming:s})}var Nn=new Set(["subject","now","today","me"]);function Mn(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>xe)return{findings:[k("too-large","",`a document may be at most ${xe/1024} KB`)]};if(typeof e=="string")try{e=JSON.parse(e)}catch(t){return{findings:[k("not-json","",`this is not JSON: ${t.message}`)]}}try{e=an(e).document}catch(t){return{findings:[k("format","formatVersion",t.message)]}}e=tn(e);let s=rn.safeParse(e);if(!s.success)return{findings:s.error.issues.map(t=>{let o=t.path.map(String).join(".");if(t.code==="unrecognized_keys")return k("unknown-key",o,`${t.keys.map(a=>`"${a}"`).join(", ")} ${t.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(t.code==="invalid_union"&&/\.effects\.\d+$/.test(o))return k("effect-shape",o,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(t.code==="invalid_key"){let a=t.issues?.[0]?.message;return k("shape",o,`the name "${String(t.path.at(-1))}" is not allowed here${a?`: ${a}`:""}`)}return k("shape",o,t.message)})};let i=s.data;return{document:i,findings:_n(i)}}var pe=e=>[e??[]].flat();function zn(e){let s=new Map;for(let[i,t]of Object.entries(e.kinds))for(let[o,a]of Object.entries(Q(t.edges))){let u=s.get(o);s.set(o,{name:o,from:[...u?.from??[],i],to:a.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...a.to])],cardinality:a.cardinality??"many"})}return s}function Ht(e){let s=new Map;for(let[t,o]of Object.entries(e.kinds)){let a=se(o),u=me(o.edges);s.set(t,{fields:new Set([...Object.keys(o.fields),...u.keys()]),edges:new Map(Object.entries(Q(o.edges)).map(([f,g])=>[f,g.cardinality??"many"])),...a?{computed:a}:{},...u.size>0?{linked:u}:{}})}let i=se(e);return i&&s.set(Be,{computed:i}),s}function yn(e,s){let i=[],t=pe(e.on),o=(a,u)=>{let f=Ae(s.kinds,a,t)?.reversed===!0,[g,l]=f?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:a,from:g,to:l}:{sever:a,from:g,to:l}};if(e.creates){let a=s.kinds[e.creates],u={};for(let f of Object.keys(a?.fields??{}))u[f]=`$${f}`;for(let f of e.effects??[])"set"in f&&!("create"in f)&&F(f.target)==="new"&&Object.assign(u,f.set);i.push({create:e.creates,as:"new",set:u})}if(e.sets&&i.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&i.push({set:Object.fromEntries(e.writes.map(a=>[a,`$${a}`]))}),e.connects&&(e.replaces&&i.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),i.push(o(e.connects,"connect"))),e.severs&&i.push(o(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&i.push({set:e.setsOther,target:"$to"}),e.setsLinked&&t.length>0)for(let[a,u]of Object.entries(e.setsLinked))i.push({set:u,through:a});return e.removes&&i.push({remove:"$subject"}),e.effects&&i.push(...e.effects.filter(a=>!(e.creates&&"set"in a&&!("create"in a)&&F(a.target)==="new"))),i}function le(e,s,i){try{let t=J(e),o=ae(t);for(let a of o.unknownFunctions)i.push(k("unknown-function",s,`"${a}" is not a function the rule language knows`,"see the rule language in the graview-invariant skill"));return t}catch(t){if(t instanceof ce){i.push(k("expression",s,t.sentence+` (at character ${t.at+1})`));return}throw t}}function Re(e,s,i){try{return ee(e)}catch(t){if(t instanceof Ye||t instanceof ce){i.push(k("template",s,(t instanceof ce,t.sentence)));return}throw t}}function _n(e){let s=[],i=new Set(Object.keys(e.kinds)),t=zn(e),o=e.acts??{},a=new Set(e.roles??[]),u=(l,r)=>me(e.kinds[l]?.edges).has(r),f=l=>Object.keys(e.kinds).some(r=>u(r,l));for(let[l,r]of Object.entries(e.kinds)){let p=`kinds.${l}`;for(let[m,d]of Object.entries(r.edges??{})){if(!Ke(d)&&d.to!=="*")for(let c of d.to)i.has(c)||s.push(k("edge-target",`${p}.edges.${m}.to`,`"${c}" is not a kind this document declares`));r.fields[m]&&s.push(k("edge-field-clash",`${p}.edges.${m}`,`"${m}" is both a field and a relation of ${l}`,"rename one of them"))}r.lifecycle&&!r.fields[r.lifecycle.field]&&s.push(k("lifecycle-field",`${p}.lifecycle.field`,`${l} has no field "${r.lifecycle.field}"`));let y=m=>r.computed!==void 0&&Object.hasOwn(r.computed,m);for(let m of r.glance??[])!r.fields[m]&&!y(m)&&s.push(k("glance-field",`${p}.glance`,`a glance at ${l} is to say "${m}", and ${l} has no field or computed field called that`,`use one of: ${[...Object.keys(r.fields),...Object.keys(r.computed??{})].join(", ")}`));s.push(...mn(l,r));for(let m of["label","describe"]){let d=r[m];if(!d)continue;let c=Re(d,`${p}.${m}`,s);for(let S of c??[])if(S.expr){for(let b of ae(S.expr).names)if(!r.fields[b]){if(y(b)){en(r,b)||s.push(k("template-field",`${p}.${m}`,`${l}'s ${b} is worked out from beyond the record, and a ${m} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${l}'s own fields`));continue}s.push(k("template-field",`${p}.${m}`,`${l} has no field "${b}" for its ${m} to show`,m==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[m,d]of Object.entries(r.derives?.set??{}))fe(d)&&"expr"in d&&le(String(d.expr),`${p}.derives.set.${m}`,s);for(let[m,d]of Object.entries(r.fields)){if(d.default!==void 0&&d.type==="enum"){let b=(d.multiple?Array.isArray(d.default)?d.default:[d.default]:[d.default]).find(v=>!d.options?.includes(String(v)));(b!==void 0||!d.multiple&&Array.isArray(d.default))&&s.push(k("default-option",`${p}.fields.${m}.default`,`"${String(b??d.default)}" is not one of ${m}'s options`))}let c=`${m}Repeat`;d.repeats&&(r.fields[c]||r.edges?.[c]||r.computed?.[c])&&s.push(k("repeat-clash",`${p}.fields.${m}.repeats`,`${l} already has "${c}", where how ${m} repeats is kept`))}}for(let[l,r]of Object.entries(o)){let p=`acts.${l}`;for(let c of pe(r.on))i.has(c)||s.push(k("act-kind",`${p}.on`,`"${c}" is not a kind this document declares`));let y=pe(r.on),m=yn(r,e);if(r.creates&&r.on===void 0&&r.writes&&i.has(r.creates)){for(let c of r.writes)if(!e.kinds[r.creates].fields[c])if(e.kinds[r.creates].computed?.[c]!==void 0)s.push(k("computed-written",`${p}.writes`,`${r.creates}'s ${c} is worked out, not written: no act can set it`,"write the stored fields it is worked out from"));else{if(u(r.creates,c))continue;s.push(k("act-field",`${p}.writes`,`${r.creates} has no field "${c}"`))}}m.length===0&&s.push(k("act-empty",p,`"${l}" does nothing`,"give it effects or a shorthand such as sets or creates"));let d=new Map;m.forEach((c,S)=>{let b=m.length-(r.effects?.length??0),v=r.effects&&S>=b?`${p}.effects.${S-b}`:p;if("create"in c){if(!i.has(c.create))s.push(k("act-kind",`${v}.create`,`"${c.create}" is not a kind this document declares`));else for(let w of Object.keys(c.set??{}))e.kinds[c.create].fields[w]||(e.kinds[c.create].computed?.[w]!==void 0?s.push(k("computed-written",`${v}.set.${w}`,`${c.create}'s ${w} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):s.push(k("act-field",`${v}.set.${w}`,`${c.create} has no field "${w}"`)));c.as&&d.set(c.as,c.create)}else if("connect"in c||"sever"in c){let w="connect"in c?c.connect:c.sever;!t.has(w)&&!f(w)&&s.push(k("act-edge",`${v}.${"connect"in c?"connect":"sever"}`,`"${w}" is not a relation any kind declares`)),F(c.from)==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${l}" acts on "$subject" but does not say which kinds it is "on"`))}else if(!("through"in c))if("set"in c){let w=F(c.target??"$subject"),C=w==="subject"?y:d.has(w??"")?[d.get(w)]:[];w==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${l}" changes "$subject" but does not say which kinds it is "on"`));for(let q of Object.keys(c.set))for(let z of C)if(!(!i.has(z)||e.kinds[z].fields[q]))if(e.kinds[z].computed?.[q]!==void 0)s.push(k("computed-written",`${v}.set.${q}`,`${z}'s ${q} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(z,q))continue;s.push(k("act-field",`${v}.set.${q}`,`${z} has no field "${q}"`))}}else"remove"in c&&F(c.remove)==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${l}" removes "$subject" but does not say which kinds it is "on"`));let x="set"in c&&c.set?Object.values(c.set):[],A="through"in c?`${p}.setsLinked.${c.through}`:`${v}.set`;x.forEach(w=>{w&&typeof w=="object"&&!Array.isArray(w)&&"expr"in w&&le(w.expr,A,s)})}),r.allowedWhen&&le(r.allowedWhen,`${p}.allowedWhen`,s),r.refusal&&Re(r.refusal,`${p}.refusal`,s)}for(let[l,r]of Object.entries(e.rules??{})){let p=`rules.${l}`;r.over!=="graph"&&!i.has(r.over)&&s.push(k("rule-kind",`${p}.over`,`"${r.over}" is not a kind this document declares`));let y=r.over==="graph"?void 0:e.kinds[r.over];if(r.covers&&y){let m=ye(r.over,r.covers,d=>t.get(d),d=>i.has(d));if("problem"in m){let{key:d,message:c,fix:S}=m.problem;d==="every"?s.push(k("rule-kind",`${p}.covers.every`,c,S)):s.push(k("rule-covers-relation",`${p}.covers.${d}`,c,S))}}for(let m of["when","require"]){let d=r[m];if(!d)continue;let c=le(d,`${p}.${m}`,s);if(!c)continue;let S=ae(c);for(let b of S.names)if(r.over==="graph")s.push(k("rule-name",`${p}.${m}`,`"${b}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(y&&!y.fields[b]&&!y.edges?.[b]&&y.computed?.[b]===void 0){let v=Object.keys(y.edges??{}).find(x=>x.includes("-")&&x.split("-").includes(b));s.push(k("rule-name",`${p}.${m}`,`${r.over} has no field or relation called "${b}"`,v?`"${v}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${v.replace(/-([a-z0-9])/g,(x,A)=>A.toUpperCase())}"`:void 0))}for(let b of S.edges)!t.has(b)&&!f(b)&&s.push(k("rule-edge",`${p}.${m}`,`"${b}" is not a relation any kind declares`));for(let b of S.sweeps)i.has(b)?r.over!=="graph"&&s.push(Ue("rule-cost",`${p}.${m}`,`this rule looks at every ${b} for every ${r.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):s.push(k("rule-kind",`${p}.${m}`,`"${b}" is not a kind this document declares`))}r.says&&Re(r.says,`${p}.says`,s),(r.repairs??[]).forEach((m,d)=>{!o[m.act]&&!ge(m.act)&&!we(m.act,e.kinds)&&s.push(k("repair-act",`${p}.repairs.${d}.act`,`"${m.act}" is not an act this document declares`,$e(m.act,e)))})}let g=e.policy;return g&&(g.grants.forEach((l,r)=>{if(l.roles!=="*"&&a.size>0)for(let p of l.roles)a.has(p)||s.push(k("grant-role",`policy.grants.${r}.roles`,`"${p}" is not one of the document's roles`));for(let p of["mutations","propose"]){let y=l[p];if(y!==void 0&&y!=="*")for(let m of y)!o[m]&&!ge(m)&&!we(m,e.kinds)&&s.push(k("grant-act",`policy.grants.${r}.${p}`,`"${m}" is not an act this document declares`,$e(m,e)))}}),(g.sees??[]).forEach((l,r)=>{for(let p of l.kinds)i.has(p)||s.push(k("sight-kind",`policy.sees.${r}.kinds`,`"${p}" is not a kind this document declares`));if(l.roles!=="*"&&a.size>0)for(let p of l.roles)a.has(p)||s.push(k("sight-role",`policy.sees.${r}.roles`,`"${p}" is not one of the document's roles`))})),s.push(...Qe(e)),s}function In(e){return e.label?[...e.label.matchAll(/\{\s*([A-Za-z_][A-Za-z0-9_]*)/g)].map(s=>s[1]):[ke(e)??[]].flat()}function Kn(e,s,i,t){let o=new Map,a=pe(e.on),u=new Map,f=new Map;(a.length>0||s.some(d=>"remove"in d&&F(d.remove)==="subject"||"from"in d&&(F(d.from)==="subject"||F(d.to)==="subject")||"set"in d&&!("create"in d)&&!("through"in d)&&F(d.target??"$subject")==="subject"||"through"in d))&&o.set(he,{ref:a.length>0?a:"*",required:!0});let l=e.args??{},r=e.writes?.length===1,p=(d,c)=>c&&d.type===c.type&&d.min===void 0&&d.max===void 0&&d.step===void 0?{...d,...c.min===void 0?{}:{min:c.min},...c.max===void 0?{}:{max:c.max},...c.step===void 0?{}:{step:c.step}}:d,y=(d,c)=>c&&d.type===c.type&&d.format===void 0&&d.unit===void 0?{...p(d,c),...c.format?{format:c.format}:{},...c.unit?{unit:c.unit}:{}}:p(d,c),m=(d,c,S)=>{if(d===he||Nn.has(d)||u.has(d)||o.has(d))return;let b=l[d]?y(l[d],S):void 0;o.set(d,b?{field:b,optional:!b.required,required:!!b.required}:c())};for(let d of s)if("create"in d){let c=i.kinds[d.create],S=c?gn(c,In(c)):[],b=v=>S.includes(v)?S.indexOf(v):S.length;for(let[v,x]of Object.entries(d.set??{}).sort(([A],[w])=>b(A)-b(w))){let A=F(x),w=c?.fields[v];if(A&&w){let C=!!w.required&&w.default===void 0;m(A,()=>({field:w,optional:!C,required:C}),w)}}d.as&&u.set(d.as,d.create)}else if("connect"in d||"sever"in d){let c="connect"in d?d.connect:d.sever,S=t.get(c),b=F(d.from)==="subject"&&a.length>0?a.map(x=>Q(i.kinds[x]?.edges)[c]?.to):[],v=b.length>0&&b.every(Boolean)?b.includes("*")?"*":[...new Set(b.flat())]:void 0;for(let[x,A]of[["from",d.from],["to",d.to]]){let w=F(A);if(!w)continue;let C=x==="to"?v??S?.to??"*":S?.from??"*";C!=="*"&&!f.has(w)&&f.set(w,C),m(w,()=>({ref:C,required:!0}))}}else if("through"in d){let c=Ae(i.kinds,d.through,a),S=c&&c.kinds!=="*"?c.kinds[0]:void 0;for(let[b,v]of Object.entries(d.set)){let x=F(v);if(!x||x==="to")continue;let A=S?i.kinds[S]?.fields[b]:void 0;m(x,()=>A?{field:A,optional:!0,required:!1}:{any:!0,required:!1},A)}}else if("set"in d){let c=F(d.target??"$subject"),S=c==="subject"?a[0]:u.get(c??"")??f.get(c??"")?.[0];c&&c!=="subject"&&!u.has(c)&&m(c,()=>({ref:"*",required:!0}));for(let[b,v]of Object.entries(d.set)){let x=F(v);if(!x)continue;let A=S?i.kinds[S]?.fields[b]:void 0;m(x,()=>A?{field:A,optional:!r,required:r}:{any:!0,required:!1},A)}}else if("remove"in d){let c=F(d.remove);c&&m(c,()=>({ref:"*",required:!0}))}for(let[d,c]of Object.entries(l))o.has(d)||o.set(d,{field:c,optional:!c.required,required:!!c.required});return o}function Wt(e,s={}){let i=Mn(e);if(!i.document||ze(i.findings))return{ok:!1,findings:i.findings};let t=i.document,o=[...i.findings];s.previous&&o.push(...Gn(t,s.previous));let a=Ln(t,o);return ze(a.findings)?{ok:!1,findings:a.findings}:We(a,s)}function de(e,s,i){return e.map(t=>{if(t.format||t.expr?.t!=="ident")return t;let o=t.expr.name,a=i?.[o],u=s?.[o]??(typeof a=="object"?a:void 0),f=u?.format;return f==="money"||f==="percent"?{...t,format:f,...f==="money"&&u?.places===0?{formatArgs:["0"]}:{}}:t})}function Pn(e,s,i){let t=i.kinds[e]?.edges?.[s.via]!==void 0?"to":"from",o=i.kinds[s.from],a=[],u={};for(let[f,g]of Object.entries(s.set))if(fe(g)&&"expr"in g){let l=J(g.expr);a.push([f,{expr:l}]),l.t==="ident"&&o?.fields[l.name]&&(u[f]=l.name)}else a.push([f,{value:typeof g=="string"&&g.startsWith("$$")?g.slice(1):g}]);return{from:s.from,via:s.via,sourceEnd:t,set:a,back:u}}function Ln(e,s){let i=zn(e),t={},o=un(e.connections,e.kinds);for(let[r,p]of Object.entries(e.kinds)){let y=ke(p),m=p.label??(y?`{${y}}`:void 0),d=se(p),c=d?pn(e,r,[...d]):[];t[r]={...m?{label:de(ee(m),p.fields,p.computed)}:{},...p.describe?{describe:de(ee(p.describe),p.fields,p.computed)}:{},...d?{computed:[...d]}:{},...c.length>0?{durations:c}:{},...o.has(r)?{keptInStep:o.get(r)}:{},...p.derives?{derives:Pn(r,p.derives,e)}:{}}}let a={};for(let[r,p]of Object.entries(e.acts??{})){let y=yn(p,e),m=Kn(p,y,e,i),d=p.destructive??y.some(z=>"remove"in z||"sever"in z||"replace"in z),c=[...new Set(y.flatMap(z=>"create"in z?[z.create]:[]))],S=[...new Set(y.flatMap(z=>"connect"in z?[z.connect]:[]))],b=[...new Set(y.flatMap(z=>"sever"in z?[z.sever]:"replace"in z?z.replace:[]))],v=[...new Set(y.flatMap(z=>"set"in z&&!("create"in z)&&!("through"in z)&&F(z.target??"$subject")==="subject"?Object.keys(z.set):[]))],x=new Map;for(let z of y){if(!("connect"in z)&&!("sever"in z))continue;let E=i.get("connect"in z?z.connect:z.sever);for(let[M,ie]of[["from",z.from],["to",z.to]]){let W=F(ie),V=M==="to"?E?.to:E?.from;W&&W!=="subject"&&V&&V!=="*"&&x.set(W,[...new Set([...x.get(W)??[],...V])])}}let A={};for(let z of y){if(!("set"in z)||"create"in z||"through"in z)continue;let E=F(z.target??"$subject");for(let M of E&&E!=="subject"&&x.get(E)||[])A[M]=[...new Set([...A[M]??[],...Object.keys(z.set)])]}let w={};for(let z of y)if(!(!("set"in z)||"create"in z||"through"in z||F(z.target??"$subject")!=="subject"))for(let[E,M]of Object.entries(z.set??{}))typeof M=="string"&&F(M)===void 0||typeof M=="number"||typeof M=="boolean"?w[E]=typeof M=="string"&&M.startsWith("$$")?M.slice(1):M:delete w[E];let C=c.length===0&&y.every(z=>!("set"in z)||!z.set||Object.values(z.set).every(E=>!(E&&typeof E=="object"&&!Array.isArray(E)&&"expr"in E))),q=new Map;for(let z of y)if(!(!("set"in z)||!z.set))for(let E of Object.values(z.set))E&&typeof E=="object"&&!Array.isArray(E)&&"expr"in E&&q.set(E.expr,J(E.expr));a[r]={title:p.title??r.replace(/-/g," "),effects:y,args:[...m],...p.allowedWhen?{guard:J(p.allowedWhen)}:{},...p.refusal?{refusal:de(ee(p.refusal),e.kinds[[p.on??[]].flat()[0]??""]?.fields)}:{},exprs:[...q],destructive:d,idempotent:C,creates:c,connects:S,severs:b,writes:v,writesOther:A,sets:w}}let u={};for(let[r,p]of Object.entries(e.rules??{})){let y=p.covers&&p.over!=="graph"?ye(p.over,p.covers,m=>i.get(m),m=>m in e.kinds):void 0;u[r]={title:p.title??r.replace(/-/g," "),...p.require?{require:J(p.require)}:{},...y&&"plan"in y?{covers:y.plan}:{},...p.when?{when:J(p.when)}:{},...p.says?{says:de(ee(p.says),e.kinds[p.over]?.fields)}:{}}}let f=Ze(e,s),g=Je(e),l=Xe(e);return{format:He,document:e,findings:s,kinds:t,...e.computed?{facts:[...se(e)??[]]}:{},edges:[...i].map(([r,{from:p,to:y,cardinality:m}])=>[r,{from:p,to:y,cardinality:m}]),acts:a,rules:u,brand:f,...Object.keys(g).length>0?{viewSpecs:g}:{},...l?{home:l}:{}}}function Yt(e,s,i){let t=/^defineNode\("([^"]+)"\)/.exec(s)?.[1],o=t?i.kinds[t]:void 0;if(!t||!o)return e;let a=Object.keys(o.fields).filter(u=>u!=="label").slice(0,3);return{...e,path:`kinds.${t}.glance`,fix:`Say which: "glance": [${a.map(u=>`"${u}"`).join(", ")}] on kinds.${t} \u2014 the facts a person compares one by, at a glance.`}}function Gn(e,s){let i=[],t=new Set(Object.values(s.kinds).flatMap(o=>Object.keys(o.edges??{})));for(let[o,a]of Object.entries(e.kinds)){let u=a.renamedFrom;u&&!s.kinds[u]&&i.push(k("renamed-from-nothing",`kinds.${o}.renamedFrom`,`${o} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let f=s.kinds[u??o];for(let[g,l]of Object.entries(a.fields)){let r=l.renamedFrom;r&&!f?.fields[r]&&i.push(k("renamed-from-nothing",`kinds.${o}.fields.${g}.renamedFrom`,`${g} says it was ${r}, and the previous ${u??o} has no field called ${r}`,"name the field it was, or drop renamedFrom"))}for(let[g,l]of Object.entries(a.edges??{})){let r=l.renamedFrom;r&&!t.has(r)&&i.push(k("renamed-from-nothing",`kinds.${o}.edges.${g}.renamedFrom`,`${g} says it was ${r}, and the previous version has no relation called ${r}`,"name the relation it was, or drop renamedFrom"))}}return i}export{Mn as a,Ht as b,yn as c,Wt as d,Yt as e};
|
|
1
|
+
import{a as fe,b as Ne,d as Ze,e as He,f as he,g as F,h as ke,j as We}from"./chunk.O32F6LGK.js";import{h as Je,i as Xe,j as Qe}from"./chunk.R3GE37OI.js";import{a as ae,b as ce,c as J,d as Ye,e as ee,g as se,h as en}from"./chunk.UD7VLXPM.js";import{c as Be,h as k,i as Ue,j as ze,t as ye}from"./chunk.3DEWQDP7.js";import{A as re,Ia as Ie,Ld as qe,Md as Ve,Pa as Ke,Qa as Q,Ra as me,b as Z,c as U,e as ue,f as Me,g as P,h as O,ic as Pe,jc as ge,k as L,kc as Le,l as X,lc as Ge,m as _,mc as Ce,n as _e,o as H,p as I,r as $,s as oe,t as R,u as j,v as G,w as T,x as n,y as N,z as Y}from"./chunk.6AANHELP.js";var be=e=>Object.entries(e).map(([s,i])=>[s,Object.keys(Q(i?.edges))]),we=(e,s)=>Le(e,be(s));function nn(e){return[...Object.keys(e.acts??{}),...Object.keys(e.kinds).flatMap(s=>Pe(s)),...Ge(be(e.kinds))]}var B=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function tn(e){if(!B(e)||!B(e.kinds))return e;let s;try{let f=Object.fromEntries(Object.entries(e.kinds).map(([g,l])=>[g,B(l)&&B(l.edges)?{edges:l.edges}:{}]));s=nn({acts:B(e.acts)?e.acts:{},kinds:f})}catch{return e}let i=new Set(s),t=!1,o=f=>{if(typeof f!="string"||i.has(f))return f;let g=qe(f,s);return g===void 0?f:(t=!0,g)},a=B(e.policy)&&Array.isArray(e.policy.grants)?{...e.policy,grants:e.policy.grants.map(f=>B(f)&&Array.isArray(f.mutations)?{...f,mutations:f.mutations.map(o)}:f)}:void 0,u=B(e.rules)?Object.fromEntries(Object.entries(e.rules).map(([f,g])=>[f,B(g)&&Array.isArray(g.repairs)?{...g,repairs:g.repairs.map(l=>B(l)?{...l,act:o(l.act)}:l)}:g])):void 0;return t?{...e,...a?{policy:a}:{},...u?{rules:u}:{}}:e}function $e(e,s){let i=Ve(e,nn(s));return i&&i!==e?`did you mean "${i}"?`:void 0}var Oe="graview-document",je=1,xe=256*1024,ne=64*1024,vn=["plain","editorial","shader","ascii"];var Se=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ve=/^[a-z][A-Za-z0-9]*$/,On=/^[a-z0-9\u00df-\u00ff'-]+( [a-z0-9\u00df-\u00ff'-]+){0,2}$/,on=12,sn=60,jn=new Set(["id","kind"]),xn=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,An=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"];function En(){let e=h=>h in Object.prototype,s=Y(h=>!e(h),"every object already has this name \u2014 choose another"),i=(h,D)=>[...h===void 0?[]:[Me(h)],...D===void 0?[]:[ue(D)]],t=(h,D)=>O().check(...i(h,D)),o=(h,D,te)=>I(h).check(...i(D,te)),a=h=>O().check(P(Se,`${h} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),u=O().check(P(xn,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),s),f=O().check(P(ve,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),Y(h=>!jn.has(h),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),s),g=t(1,500),l=O().check(ue(40),P(On,'an alias is up to three lower-case words, like "supplier"')),r=t(1,2e3),p=t(1,300),y=$({type:G(An),required:n(_()),description:n(g),label:n(t(1,60)),aliases:n(o(l,1,on)),options:n(o(t(1,80),1,100)),multiple:n(_()),optionLabels:n(j(t(1,80),t(1,80))),of:n(G(["string","number","date","image","video","file"])),default:n(H()),unit:n(t(void 0,12)),format:n(G(["money","percent","duration","markdown"])),places:n(T(0)),min:n(L()),max:n(L()),step:n(L()),renamedFrom:n(O().check(P(ve))),repeats:n(_()),collaborative:n(_())}).check(re((h,D)=>{h.type==="enum"&&!h.options&&D.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),h.type!=="enum"&&h.options&&D.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]}),h.type!=="enum"&&h.multiple!==void 0&&D.addIssue({code:"custom",message:'"multiple" belongs only on an enum field: a choice that takes several of its options',path:["multiple"]});for(let te of Object.keys(h.optionLabels??{}))h.options?.includes(te)||D.addIssue({code:"custom",message:`"${te}" is labeled, and is none of the field's options`,path:["optionLabels",te]});h.type!=="list"&&h.of&&D.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),h.places!==void 0&&!(h.format==="money"||!h.format&&/^[A-Z]{3}$/.test(h.unit??""))&&D.addIssue({code:"custom",message:'"places" belongs only on money: a number field with "format": "money"',path:["places"]}),h.repeats&&h.type!=="date"&&h.type!=="datetime"&&D.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),m=O().check(P(new RegExp(`${Se.source}|${Ie.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),d=$({to:R([o(m,1),T("*")]),cardinality:n(G(["one","many"])),description:n(g),inverse:n(t(1,80)),appendOnly:n(_()),renamedFrom:n(O()),tidying:n(T("never"))}),c=R([r,$({expr:r,label:n(t(1,60)),description:n(g),format:n(G(["money","percent","duration"])),unit:n(t(1,12)),places:n(T(0)),hidden:n(_())})]),S=R([O(),L(),_(),_e(),I(H()),$({expr:r})]),b=$({noun:n(t(1,40)),plural:n(t(1,40)),aliases:n(o(l,1,on)),description:n(g),fields:j(f,y).check(Y(h=>Object.keys(h).length>0,"a kind has at least one field")),label:n(p),describe:n(p),lifecycle:n($({field:f,retired:o(R([O(),L(),_()]),1)})),figure:n(t(void 0,2e4)),glance:n(o(f,1,20)),page:n($({fields:n(o(f,1,40)),groups:n(o($({title:t(1,60),fields:o(f,1,40)}),1,12))})),edges:n(j(u,d)),computed:n(j(O(),c).check(Y(h=>Object.keys(h).length<=sn,`a kind works out at most ${sn} computed fields`))),fieldRoles:n(j(O(),O())),renamedFrom:n(O().check(P(Se))),people:n(_()),archives:n(T(!1)),tidying:n(G(["never","no-links"])),derives:n($({from:a("kind"),via:u,set:j(f,S)}))}),v=O().check(P(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),x=R([$({create:a("kind"),as:n(O().check(P(ve))),set:n(j(f,S))}),$({set:j(f,S),target:n(v)}),$({connect:u,from:v,to:v}),$({sever:u,from:v,to:v}),$({remove:v})]),A=$({title:n(t(1,80)),description:n(g),fromTheOtherEnd:n(t(1,80)),on:n(R([a("kind"),o(a("kind"),1)])),creates:n(a("kind")),sets:n(j(f,S)),writes:n(o(f,1)),connects:n(u),severs:n(u),setsOther:n(j(f,S)),setsLinked:n(j(u,j(f,S))),replaces:n(R([T(!0),o(u,1,10)])),removes:n(T(!0)),args:n(j(f,y)),effects:n(o(x,1,20)),allowedWhen:n(r),refusal:n(p),destructive:n(_())}),w=$({act:a("act"),label:n(t(1,80)),args:n(j(O(),S))}),C=$({every:a("kind"),through:u,via:n(u)}),q=$({title:n(t(1,120)),description:n(g),over:R([T("graph"),a("kind")]),when:n(r),require:n(r),covers:n(C),says:n(p),repairs:n(o(w,void 0,10))}).check(re((h,D)=>{!h.require&&!h.covers&&D.addIssue({code:"custom",message:'a rule says what must hold in "require", or what each record must be linked to in "covers"',path:["require"]}),h.require&&h.covers&&D.addIssue({code:"custom",message:'a rule is judged by "require" or by "covers", not both',path:["covers"]}),h.covers&&h.over==="graph"&&D.addIssue({code:"custom",message:'a coverage rule is over a kind, whose records it follows through their links; name the kind in "over"',path:["over"]})})),z=$({roles:R([o(a("role"),1),T("*")]),mutations:R([o(a("act")),T("*")]),kinds:n(R([I(a("kind")),T("*")])),describe:n(g),self:n(_()),ownEnd:n(_()),propose:n(R([o(a("act"),1),T("*")]))}).check(re((h,D)=>{Array.isArray(h.mutations)&&h.mutations.length===0&&h.propose===void 0&&D.addIssue({code:"custom",message:'a grant names at least one act in "mutations", or the acts it lets these roles propose in "propose"',path:["mutations"]})})),E=n(o(f,1)),M=$({roles:R([o(a("role"),1),T("*")]),kinds:o(a("kind"),1),own:n(_()),via:n(u),fields:E,hide:E}),ie=$({grants:I(z),sees:n(I(M))}),W=$({accent:n(O().check(P(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),ground:n(R([O().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"')),$({light:n(O().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"'))),dark:n(O().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#101826"')))})])),name:n(t(1,60)),currency:n(O().check(P(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:n(t(2,35)),timeZone:n(t(1,64)),logo:n(R([t(1,ne),$({src:t(1,ne),alt:n(t(1,120))}),$({light:t(1,ne),dark:n(t(1,ne)),alt:n(t(1,120)),darkFallback:n(T("invert"))})])),favicon:n(R([t(1,ne),$({emoji:O()})])),typography:n($({display:n(t(1,200)),body:n(t(1,200)),mono:n(t(1,200))})),shape:n($({radius:n(L().check(U(0),Z(32))),density:n(L().check(U(.75),Z(1.5)))})),accents:n(j(O(),L().check(U(0),Z(360)))),scheme:n(G(["light","dark","auto"])),subtitle:n(T(!1)),splash:n($({style:G(vn),image:n(t(1,ne)),title:n(t(1,80)),kicker:n(t(1,80)),shader:n(t(1,40)),scheme:n(G(["light","dark","device"]))})),views:n($({css:n(t(1)),motion:n(G(["none","fade"]))}))}),V=j(O(),H()),Fe=R([t(1,120),$({by:t(1,120),direction:n(G(["asc","desc"]))})]),De=L().check(X(),U(1),Z(9999)),hn=oe({create:n(_()),options:n(oe({sort:n(Fe),columnSort:n(Fe),search:n(o(t(1,120),void 0,40)),filters:n(o(t(1,120),void 0,40)),horizon:n(R([L().check(X(),U(1),Z(200)),oe({years:L().check(X(),U(1),Z(200)),title:t(1,80),from:n(De),to:n(De)})]))}))}),kn=$({card:n(I(H())),row:n(I(H())),page:n(I(H()))}),bn=()=>{let h=n(G(["asc","desc"]));return R([t(1,120),$({by:t(1,120),direction:h,then:n(R([t(1,120),$({by:t(1,120),direction:h})]))})])},wn=()=>R([t(1,120),$({by:t(1,120),order:n(o(t(1,80),void 0,40)),closed:n(o(t(1,80),void 0,40))})]),Te=oe({order:n(I(O())),hide:n(I(O())),first:n(O()),primary:n(o(t(1,80),void 0,40)),scene:n(t(1,40)),pages:n(t(1,40)),lists:n(j(O(),$({filters:n(o(t(1,120),void 0,40)),sort:n(bn()),group:n(wn()),export:n(_())})))}),$n=$({act:a("act"),title:n(t(1,80)),intro:n(g),fields:n(o(f,1,40)),say:n(g),submit:n(t(1,80)),role:n(a("role"))}),Sn=$({$schema:n(O()),format:T(Oe),formatVersion:T(je),name:t(1,80),description:n(g),version:n(L().check(X(),U(1))),kinds:j(a("kind"),b).check(Y(h=>Object.keys(h).length>0,"a document declares at least one kind"),Y(h=>Object.keys(h).length<=40,"a document declares at most 40 kinds")),computed:n(j(O(),c)),acts:n(j(a("act"),A)),rules:n(j(a("rule"),q)),roles:n(I(a("role"))),policy:n(ie),modules:n(V),lenses:n(I(hn)),pages:n(Te),views:n(j(O(),R([kn,I(H())]))),brand:n(W),settings:n(I(V)),migrations:n(I(V)),connections:n(j(a("connection"),V)),purpose:n(V),workflows:n(j(a("workflow"),V)),forms:n(j(a("form"),$n)),publishing:n($({mode:G(["live","on-publish"]),working:o(a("role"),void 0,40),publishers:n(o(a("role"),1,40))})),tidying:n($({autoAcceptAt:n(L().check(X(),U(1),Z(1e4)))}))});return{FieldSpec:y,EdgeSpec:d,ComputedSpec:c,KindSpec:b,ValueSpec:S,EffectSpec:x,ActSpec:A,RepairSpec:w,CoverSpec:C,RuleSpec:q,GrantSpec:z,SightSpec:M,PolicySpec:ie,BrandSpec:W,PagesSpec:Te,DocumentSpec:Sn}}var Rn,K=()=>Rn??=En(),Xn=N(()=>K().FieldSpec),Qn=N(()=>K().EdgeSpec),et=N(()=>K().ComputedSpec),nt=N(()=>K().KindSpec),tt=N(()=>K().ValueSpec),ot=N(()=>K().EffectSpec),st=N(()=>K().ActSpec),it=N(()=>K().RepairSpec),rt=N(()=>K().CoverSpec),at=N(()=>K().RuleSpec),ct=N(()=>K().GrantSpec),lt=N(()=>K().SightSpec),dt=N(()=>K().PolicySpec),pt=N(()=>K().BrandSpec),ft=N(()=>K().PagesSpec),rn=N(()=>K().DocumentSpec);var Fn={};function an(e,s=Fn,i=je){let{document:t,respelled:o}=Ne(e),a=o.length>0?{respelled:o}:{};if(!t||typeof t!="object"||Array.isArray(t))return{document:t};let u=t;if(u.format!==Oe||typeof u.formatVersion!="number"||u.formatVersion>=i)return{document:t,...a};let f=u.formatVersion,g=structuredClone(u);for(let l=f;l<i;l++){let r=s[l];if(!r)throw new Error(`there is no upgrade from format ${l} to ${l+1}`);g={...r(g),formatVersion:l+1}}return{document:g,from:f,...a}}function Ae(e,s,i){let t=Object.keys(e).filter(f=>e[f].edges?.[s]!==void 0);if(t.length===0)return;let o=t.map(f=>e[f].edges[s].to),a=o.some(f=>f==="*")?"*":[...new Set(o.flatMap(f=>f))];if(i.length===0||i.some(f=>t.includes(f)))return{reversed:!1,kinds:a};let u=t.filter(f=>{let g=e[f].edges[s].to;return g==="*"||i.every(l=>g.includes(l))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:a}}var dn=(e,s)=>{let i=e?.fields[s];return i!==void 0&&(i.type==="duration"||(i.type==="number"||i.type==="integer")&&i.format==="duration")};function cn(e,s,i,t){if(t==="out"){let o=e[s]?.edges?.[i]?.to;return o===void 0?[]:o==="*"?Object.keys(e):o}return Object.entries(e).filter(([,o])=>{let a=o.edges?.[i]?.to;return a!==void 0&&(a==="*"||a.includes(s))}).map(([o])=>o)}function Ee(e,s,i){if(i.t==="ident")return e[s]?.edges?.[i.name]?cn(e,s,i.name,"out"):void 0;if(i.t==="where")return Ee(e,s,i.set);if(i.t==="call"&&(i.fn==="out"||i.fn==="in")&&i.args[0]?.t==="lit"&&typeof i.args[0].value=="string")return cn(e,s,i.args[0].value,i.fn)}var ln=(e,s,i)=>{let t=s.filter(o=>e[o]?.fields[i]!==void 0);return t.length>0&&t.every(o=>dn(e[o],i))};function pn(e,s,i){let t=e.kinds,o=t[s],a=new Map(i),u=new Map,f=(l,r)=>{if(r>8)return!1;switch(l.t){case"ident":return dn(o,l.name)||g(l.name,r+1);case"member":{let p=Ee(t,s,l.object);return p!==void 0&&ln(t,p,l.name)}case"call":{if(l.fn!=="sum"&&l.fn!=="min"&&l.fn!=="max")return!1;let[p,y]=l.args,m=p&&Ee(t,s,p);return m!==void 0&&y?.t==="ident"&&ln(t,m,y.name)}case"binary":return(l.op==="+"||l.op==="-")&&f(l.left,r)&&f(l.right,r);case"unary":return l.op==="-"&&f(l.operand,r);default:return!1}},g=(l,r)=>{if(o?.computed?.[l]===void 0)return!1;if(u.has(l))return u.get(l);u.set(l,!1);let p=a.get(l),y=p!==void 0&&f(p,r);return u.set(l,y),y};return i.map(([l])=>l).filter(l=>g(l,0))}var Dn="several choices";var Tn={title:["string","text"],rich_text:["string","text"],number:["number","integer"],select:["enum","string"],status:["enum","string"],multi_select:["list",Dn],date:["date","datetime"],checkbox:["boolean"],url:["url","string"],email:["email","string"],phone_number:["phone","string"],people:["string","text","list"]};var fn=new Set(Object.values(Tn).flat());function un(e,s){let i=new Map;if(!e||typeof e!="object")return new Map;let t=Object.values(e).flatMap(o=>o&&typeof o=="object"&&o.system==="notion"&&Array.isArray(o.sources)?o.sources.filter(a=>a&&typeof a=="object").map(a=>({system:"notion",kind:a.kind,properties:a.properties})):[o]);for(let o of t){if(!o||typeof o!="object"||typeof o.kind!="string")continue;let a=s[o.kind]?.fields;if(!a)continue;let u=[];o.system==="google-calendar"&&o.fields&&typeof o.fields=="object"?u=Object.values(o.fields).filter(g=>typeof g=="string"):o.system==="notion"&&(u=o.properties&&typeof o.properties=="object"?Object.keys(o.properties):Object.keys(a).filter(g=>fn.has(a[g].type)));let f=i.get(o.kind)??new Set;for(let g of u)Object.hasOwn(a,g)&&f.add(g);i.set(o.kind,f)}return new Map([...i].filter(([,o])=>o.size>0).map(([o,a])=>[o,Object.keys(s[o].fields).filter(u=>a.has(u))]))}function mn(e,s,i=`kinds.${e}.page`){let t=s.page;if(!t)return[];let o=[],a=[...Object.keys(s.fields),...Object.keys(s.computed??{})],u=new Set,f=(l,r)=>{a.includes(l)?u.has(l)&&o.push(k("page-field-twice",r,`"${l}" is on ${e}'s page twice; name each field once`)):o.push(k("page-field",r,`${e}'s page is to show "${l}", and ${e} has no field or computed field called that`,`use one of: ${a.join(", ")}`)),u.add(l)};(t.fields??[]).forEach((l,r)=>f(l,`${i}.fields.${r}`));let g=new Set;return(t.groups??[]).forEach((l,r)=>{let p=l.title.trim().toLowerCase();g.has(p)&&o.push(k("page-group-twice",`${i}.groups.${r}.title`,`${e}'s page has two groups called "${l.title}"; give each its own title`)),g.add(p),l.fields.forEach((y,m)=>f(y,`${i}.groups.${r}.fields.${m}`))}),o}function gn(e,s=[]){return Ce({declared:Object.keys(e.fields),paged:[...e.page?.fields??[],...(e.page?.groups??[]).flatMap(i=>i.fields)],must:i=>!!e.fields[i].required&&e.fields[i].default===void 0,naming:s})}var Nn=new Set(["subject","now","today","me"]);function Mn(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>xe)return{findings:[k("too-large","",`a document may be at most ${xe/1024} KB`)]};if(typeof e=="string")try{e=JSON.parse(e)}catch(t){return{findings:[k("not-json","",`this is not JSON: ${t.message}`)]}}try{e=an(e).document}catch(t){return{findings:[k("format","formatVersion",t.message)]}}e=tn(e);let s=rn.safeParse(e);if(!s.success)return{findings:s.error.issues.map(t=>{let o=t.path.map(String).join(".");if(t.code==="unrecognized_keys")return k("unknown-key",o,`${t.keys.map(a=>`"${a}"`).join(", ")} ${t.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(t.code==="invalid_union"&&/\.effects\.\d+$/.test(o))return k("effect-shape",o,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(t.code==="invalid_key"){let a=t.issues?.[0]?.message;return k("shape",o,`the name "${String(t.path.at(-1))}" is not allowed here${a?`: ${a}`:""}`)}return k("shape",o,t.message)})};let i=s.data;return{document:i,findings:_n(i)}}var pe=e=>[e??[]].flat();function zn(e){let s=new Map;for(let[i,t]of Object.entries(e.kinds))for(let[o,a]of Object.entries(Q(t.edges))){let u=s.get(o);s.set(o,{name:o,from:[...u?.from??[],i],to:a.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...a.to])],cardinality:a.cardinality??"many"})}return s}function Ht(e){let s=new Map;for(let[t,o]of Object.entries(e.kinds)){let a=se(o),u=me(o.edges);s.set(t,{fields:new Set([...Object.keys(o.fields),...u.keys()]),edges:new Map(Object.entries(Q(o.edges)).map(([f,g])=>[f,g.cardinality??"many"])),...a?{computed:a}:{},...u.size>0?{linked:u}:{}})}let i=se(e);return i&&s.set(Be,{computed:i}),s}function yn(e,s){let i=[],t=pe(e.on),o=(a,u)=>{let f=Ae(s.kinds,a,t)?.reversed===!0,[g,l]=f?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:a,from:g,to:l}:{sever:a,from:g,to:l}};if(e.creates){let a=s.kinds[e.creates],u={};for(let f of Object.keys(a?.fields??{}))u[f]=`$${f}`;for(let f of e.effects??[])"set"in f&&!("create"in f)&&F(f.target)==="new"&&Object.assign(u,f.set);i.push({create:e.creates,as:"new",set:u})}if(e.sets&&i.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&i.push({set:Object.fromEntries(e.writes.map(a=>[a,`$${a}`]))}),e.connects&&(e.replaces&&i.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),i.push(o(e.connects,"connect"))),e.severs&&i.push(o(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&i.push({set:e.setsOther,target:"$to"}),e.setsLinked&&t.length>0)for(let[a,u]of Object.entries(e.setsLinked))i.push({set:u,through:a});return e.removes&&i.push({remove:"$subject"}),e.effects&&i.push(...e.effects.filter(a=>!(e.creates&&"set"in a&&!("create"in a)&&F(a.target)==="new"))),i}function le(e,s,i){try{let t=J(e),o=ae(t);for(let a of o.unknownFunctions)i.push(k("unknown-function",s,`"${a}" is not a function the rule language knows`,"see the rule language in the graview-invariant skill"));return t}catch(t){if(t instanceof ce){i.push(k("expression",s,t.sentence+` (at character ${t.at+1})`));return}throw t}}function Re(e,s,i){try{return ee(e)}catch(t){if(t instanceof Ye||t instanceof ce){i.push(k("template",s,(t instanceof ce,t.sentence)));return}throw t}}function _n(e){let s=[],i=new Set(Object.keys(e.kinds)),t=zn(e),o=e.acts??{},a=new Set(e.roles??[]),u=(l,r)=>me(e.kinds[l]?.edges).has(r),f=l=>Object.keys(e.kinds).some(r=>u(r,l));for(let[l,r]of Object.entries(e.kinds)){let p=`kinds.${l}`;for(let[m,d]of Object.entries(r.edges??{})){if(!Ke(d)&&d.to!=="*")for(let c of d.to)i.has(c)||s.push(k("edge-target",`${p}.edges.${m}.to`,`"${c}" is not a kind this document declares`));r.fields[m]&&s.push(k("edge-field-clash",`${p}.edges.${m}`,`"${m}" is both a field and a relation of ${l}`,"rename one of them"))}r.lifecycle&&!r.fields[r.lifecycle.field]&&s.push(k("lifecycle-field",`${p}.lifecycle.field`,`${l} has no field "${r.lifecycle.field}"`));let y=m=>r.computed!==void 0&&Object.hasOwn(r.computed,m);for(let m of r.glance??[])!r.fields[m]&&!y(m)&&s.push(k("glance-field",`${p}.glance`,`a glance at ${l} is to say "${m}", and ${l} has no field or computed field called that`,`use one of: ${[...Object.keys(r.fields),...Object.keys(r.computed??{})].join(", ")}`));s.push(...mn(l,r));for(let m of["label","describe"]){let d=r[m];if(!d)continue;let c=Re(d,`${p}.${m}`,s);for(let S of c??[])if(S.expr){for(let b of ae(S.expr).names)if(!r.fields[b]){if(y(b)){en(r,b)||s.push(k("template-field",`${p}.${m}`,`${l}'s ${b} is worked out from beyond the record, and a ${m} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${l}'s own fields`));continue}s.push(k("template-field",`${p}.${m}`,`${l} has no field "${b}" for its ${m} to show`,m==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[m,d]of Object.entries(r.derives?.set??{}))fe(d)&&"expr"in d&&le(String(d.expr),`${p}.derives.set.${m}`,s);for(let[m,d]of Object.entries(r.fields)){if(d.default!==void 0&&d.type==="enum"){let b=(d.multiple?Array.isArray(d.default)?d.default:[d.default]:[d.default]).find(v=>!d.options?.includes(String(v)));(b!==void 0||!d.multiple&&Array.isArray(d.default))&&s.push(k("default-option",`${p}.fields.${m}.default`,`"${String(b??d.default)}" is not one of ${m}'s options`))}let c=`${m}Repeat`;d.repeats&&(r.fields[c]||r.edges?.[c]||r.computed?.[c])&&s.push(k("repeat-clash",`${p}.fields.${m}.repeats`,`${l} already has "${c}", where how ${m} repeats is kept`))}}for(let[l,r]of Object.entries(o)){let p=`acts.${l}`;for(let c of pe(r.on))i.has(c)||s.push(k("act-kind",`${p}.on`,`"${c}" is not a kind this document declares`));let y=pe(r.on),m=yn(r,e);if(r.creates&&r.on===void 0&&r.writes&&i.has(r.creates)){for(let c of r.writes)if(!e.kinds[r.creates].fields[c])if(e.kinds[r.creates].computed?.[c]!==void 0)s.push(k("computed-written",`${p}.writes`,`${r.creates}'s ${c} is worked out, not written: no act can set it`,"write the stored fields it is worked out from"));else{if(u(r.creates,c))continue;s.push(k("act-field",`${p}.writes`,`${r.creates} has no field "${c}"`))}}m.length===0&&s.push(k("act-empty",p,`"${l}" does nothing`,"give it effects or a shorthand such as sets or creates"));let d=new Map;m.forEach((c,S)=>{let b=m.length-(r.effects?.length??0),v=r.effects&&S>=b?`${p}.effects.${S-b}`:p;if("create"in c){if(!i.has(c.create))s.push(k("act-kind",`${v}.create`,`"${c.create}" is not a kind this document declares`));else for(let w of Object.keys(c.set??{}))e.kinds[c.create].fields[w]||(e.kinds[c.create].computed?.[w]!==void 0?s.push(k("computed-written",`${v}.set.${w}`,`${c.create}'s ${w} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):s.push(k("act-field",`${v}.set.${w}`,`${c.create} has no field "${w}"`)));c.as&&d.set(c.as,c.create)}else if("connect"in c||"sever"in c){let w="connect"in c?c.connect:c.sever;!t.has(w)&&!f(w)&&s.push(k("act-edge",`${v}.${"connect"in c?"connect":"sever"}`,`"${w}" is not a relation any kind declares`)),F(c.from)==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${l}" acts on "$subject" but does not say which kinds it is "on"`))}else if(!("through"in c))if("set"in c){let w=F(c.target??"$subject"),C=w==="subject"?y:d.has(w??"")?[d.get(w)]:[];w==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${l}" changes "$subject" but does not say which kinds it is "on"`));for(let q of Object.keys(c.set))for(let z of C)if(!(!i.has(z)||e.kinds[z].fields[q]))if(e.kinds[z].computed?.[q]!==void 0)s.push(k("computed-written",`${v}.set.${q}`,`${z}'s ${q} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(z,q))continue;s.push(k("act-field",`${v}.set.${q}`,`${z} has no field "${q}"`))}}else"remove"in c&&F(c.remove)==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${l}" removes "$subject" but does not say which kinds it is "on"`));let x="set"in c&&c.set?Object.values(c.set):[],A="through"in c?`${p}.setsLinked.${c.through}`:`${v}.set`;x.forEach(w=>{w&&typeof w=="object"&&!Array.isArray(w)&&"expr"in w&&le(w.expr,A,s)})}),r.allowedWhen&&le(r.allowedWhen,`${p}.allowedWhen`,s),r.refusal&&Re(r.refusal,`${p}.refusal`,s)}for(let[l,r]of Object.entries(e.rules??{})){let p=`rules.${l}`;r.over!=="graph"&&!i.has(r.over)&&s.push(k("rule-kind",`${p}.over`,`"${r.over}" is not a kind this document declares`));let y=r.over==="graph"?void 0:e.kinds[r.over];if(r.covers&&y){let m=ye(r.over,r.covers,d=>t.get(d),d=>i.has(d));if("problem"in m){let{key:d,message:c,fix:S}=m.problem;d==="every"?s.push(k("rule-kind",`${p}.covers.every`,c,S)):s.push(k("rule-covers-relation",`${p}.covers.${d}`,c,S))}}for(let m of["when","require"]){let d=r[m];if(!d)continue;let c=le(d,`${p}.${m}`,s);if(!c)continue;let S=ae(c);for(let b of S.names)if(r.over==="graph")s.push(k("rule-name",`${p}.${m}`,`"${b}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(y&&!y.fields[b]&&!y.edges?.[b]&&y.computed?.[b]===void 0){let v=Object.keys(y.edges??{}).find(x=>x.includes("-")&&x.split("-").includes(b));s.push(k("rule-name",`${p}.${m}`,`${r.over} has no field or relation called "${b}"`,v?`"${v}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${v.replace(/-([a-z0-9])/g,(x,A)=>A.toUpperCase())}"`:void 0))}for(let b of S.edges)!t.has(b)&&!f(b)&&s.push(k("rule-edge",`${p}.${m}`,`"${b}" is not a relation any kind declares`));for(let b of S.sweeps)i.has(b)?r.over!=="graph"&&s.push(Ue("rule-cost",`${p}.${m}`,`this rule looks at every ${b} for every ${r.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):s.push(k("rule-kind",`${p}.${m}`,`"${b}" is not a kind this document declares`))}r.says&&Re(r.says,`${p}.says`,s),(r.repairs??[]).forEach((m,d)=>{!o[m.act]&&!ge(m.act)&&!we(m.act,e.kinds)&&s.push(k("repair-act",`${p}.repairs.${d}.act`,`"${m.act}" is not an act this document declares`,$e(m.act,e)))})}let g=e.policy;return g&&(g.grants.forEach((l,r)=>{if(l.roles!=="*"&&a.size>0)for(let p of l.roles)a.has(p)||s.push(k("grant-role",`policy.grants.${r}.roles`,`"${p}" is not one of the document's roles`));for(let p of["mutations","propose"]){let y=l[p];if(y!==void 0&&y!=="*")for(let m of y)!o[m]&&!ge(m)&&!we(m,e.kinds)&&s.push(k("grant-act",`policy.grants.${r}.${p}`,`"${m}" is not an act this document declares`,$e(m,e)))}}),(g.sees??[]).forEach((l,r)=>{for(let p of l.kinds)i.has(p)||s.push(k("sight-kind",`policy.sees.${r}.kinds`,`"${p}" is not a kind this document declares`));if(l.roles!=="*"&&a.size>0)for(let p of l.roles)a.has(p)||s.push(k("sight-role",`policy.sees.${r}.roles`,`"${p}" is not one of the document's roles`))})),s.push(...Qe(e)),s}function In(e){return e.label?[...e.label.matchAll(/\{\s*([A-Za-z_][A-Za-z0-9_]*)/g)].map(s=>s[1]):[ke(e)??[]].flat()}function Kn(e,s,i,t){let o=new Map,a=pe(e.on),u=new Map,f=new Map;(a.length>0||s.some(d=>"remove"in d&&F(d.remove)==="subject"||"from"in d&&(F(d.from)==="subject"||F(d.to)==="subject")||"set"in d&&!("create"in d)&&!("through"in d)&&F(d.target??"$subject")==="subject"||"through"in d))&&o.set(he,{ref:a.length>0?a:"*",required:!0});let l=e.args??{},r=e.writes?.length===1,p=(d,c)=>c&&d.type===c.type&&d.min===void 0&&d.max===void 0&&d.step===void 0?{...d,...c.min===void 0?{}:{min:c.min},...c.max===void 0?{}:{max:c.max},...c.step===void 0?{}:{step:c.step}}:d,y=(d,c)=>c&&d.type===c.type&&d.format===void 0&&d.unit===void 0?{...p(d,c),...c.format?{format:c.format}:{},...c.unit?{unit:c.unit}:{}}:p(d,c),m=(d,c,S)=>{if(d===he||Nn.has(d)||u.has(d)||o.has(d))return;let b=l[d]?y(l[d],S):void 0;o.set(d,b?{field:b,optional:!b.required,required:!!b.required}:c())};for(let d of s)if("create"in d){let c=i.kinds[d.create],S=c?gn(c,In(c)):[],b=v=>S.includes(v)?S.indexOf(v):S.length;for(let[v,x]of Object.entries(d.set??{}).sort(([A],[w])=>b(A)-b(w))){let A=F(x),w=c?.fields[v];if(A&&w){let C=!!w.required&&w.default===void 0;m(A,()=>({field:w,optional:!C,required:C}),w)}}d.as&&u.set(d.as,d.create)}else if("connect"in d||"sever"in d){let c="connect"in d?d.connect:d.sever,S=t.get(c),b=F(d.from)==="subject"&&a.length>0?a.map(x=>Q(i.kinds[x]?.edges)[c]?.to):[],v=b.length>0&&b.every(Boolean)?b.includes("*")?"*":[...new Set(b.flat())]:void 0;for(let[x,A]of[["from",d.from],["to",d.to]]){let w=F(A);if(!w)continue;let C=x==="to"?v??S?.to??"*":S?.from??"*";C!=="*"&&!f.has(w)&&f.set(w,C),m(w,()=>({ref:C,required:!0}))}}else if("through"in d){let c=Ae(i.kinds,d.through,a),S=c&&c.kinds!=="*"?c.kinds[0]:void 0;for(let[b,v]of Object.entries(d.set)){let x=F(v);if(!x||x==="to")continue;let A=S?i.kinds[S]?.fields[b]:void 0;m(x,()=>A?{field:A,optional:!0,required:!1}:{any:!0,required:!1},A)}}else if("set"in d){let c=F(d.target??"$subject"),S=c==="subject"?a[0]:u.get(c??"")??f.get(c??"")?.[0];c&&c!=="subject"&&!u.has(c)&&m(c,()=>({ref:"*",required:!0}));for(let[b,v]of Object.entries(d.set)){let x=F(v);if(!x)continue;let A=S?i.kinds[S]?.fields[b]:void 0;m(x,()=>A?{field:A,optional:!r,required:r}:{any:!0,required:!1},A)}}else if("remove"in d){let c=F(d.remove);c&&m(c,()=>({ref:"*",required:!0}))}for(let[d,c]of Object.entries(l))o.has(d)||o.set(d,{field:c,optional:!c.required,required:!!c.required});return o}function Wt(e,s={}){let i=Mn(e);if(!i.document||ze(i.findings))return{ok:!1,findings:i.findings};let t=i.document,o=[...i.findings];s.previous&&o.push(...Gn(t,s.previous));let a=Ln(t,o);return ze(a.findings)?{ok:!1,findings:a.findings}:We(a,s)}function de(e,s,i){return e.map(t=>{if(t.format||t.expr?.t!=="ident")return t;let o=t.expr.name,a=i?.[o],u=s?.[o]??(typeof a=="object"?a:void 0),f=u?.format;return f==="money"||f==="percent"?{...t,format:f,...f==="money"&&u?.places===0?{formatArgs:["0"]}:{}}:t})}function Pn(e,s,i){let t=i.kinds[e]?.edges?.[s.via]!==void 0?"to":"from",o=i.kinds[s.from],a=[],u={};for(let[f,g]of Object.entries(s.set))if(fe(g)&&"expr"in g){let l=J(g.expr);a.push([f,{expr:l}]),l.t==="ident"&&o?.fields[l.name]&&(u[f]=l.name)}else a.push([f,{value:typeof g=="string"&&g.startsWith("$$")?g.slice(1):g}]);return{from:s.from,via:s.via,sourceEnd:t,set:a,back:u}}function Ln(e,s){let i=zn(e),t={},o=un(e.connections,e.kinds);for(let[r,p]of Object.entries(e.kinds)){let y=ke(p),m=p.label??(y?`{${y}}`:void 0),d=se(p),c=d?pn(e,r,[...d]):[];t[r]={...m?{label:de(ee(m),p.fields,p.computed)}:{},...p.describe?{describe:de(ee(p.describe),p.fields,p.computed)}:{},...d?{computed:[...d]}:{},...c.length>0?{durations:c}:{},...o.has(r)?{keptInStep:o.get(r)}:{},...p.derives?{derives:Pn(r,p.derives,e)}:{}}}let a={};for(let[r,p]of Object.entries(e.acts??{})){let y=yn(p,e),m=Kn(p,y,e,i),d=p.destructive??y.some(z=>"remove"in z||"sever"in z||"replace"in z),c=[...new Set(y.flatMap(z=>"create"in z?[z.create]:[]))],S=[...new Set(y.flatMap(z=>"connect"in z?[z.connect]:[]))],b=[...new Set(y.flatMap(z=>"sever"in z?[z.sever]:"replace"in z?z.replace:[]))],v=[...new Set(y.flatMap(z=>"set"in z&&!("create"in z)&&!("through"in z)&&F(z.target??"$subject")==="subject"?Object.keys(z.set):[]))],x=new Map;for(let z of y){if(!("connect"in z)&&!("sever"in z))continue;let E=i.get("connect"in z?z.connect:z.sever);for(let[M,ie]of[["from",z.from],["to",z.to]]){let W=F(ie),V=M==="to"?E?.to:E?.from;W&&W!=="subject"&&V&&V!=="*"&&x.set(W,[...new Set([...x.get(W)??[],...V])])}}let A={};for(let z of y){if(!("set"in z)||"create"in z||"through"in z)continue;let E=F(z.target??"$subject");for(let M of E&&E!=="subject"&&x.get(E)||[])A[M]=[...new Set([...A[M]??[],...Object.keys(z.set)])]}let w={};for(let z of y)if(!(!("set"in z)||"create"in z||"through"in z||F(z.target??"$subject")!=="subject"))for(let[E,M]of Object.entries(z.set??{}))typeof M=="string"&&F(M)===void 0||typeof M=="number"||typeof M=="boolean"?w[E]=typeof M=="string"&&M.startsWith("$$")?M.slice(1):M:delete w[E];let C=c.length===0&&y.every(z=>!("set"in z)||!z.set||Object.values(z.set).every(E=>!(E&&typeof E=="object"&&!Array.isArray(E)&&"expr"in E))),q=new Map;for(let z of y)if(!(!("set"in z)||!z.set))for(let E of Object.values(z.set))E&&typeof E=="object"&&!Array.isArray(E)&&"expr"in E&&q.set(E.expr,J(E.expr));a[r]={title:p.title??r.replace(/-/g," "),effects:y,args:[...m],...p.allowedWhen?{guard:J(p.allowedWhen)}:{},...p.refusal?{refusal:de(ee(p.refusal),e.kinds[[p.on??[]].flat()[0]??""]?.fields)}:{},exprs:[...q],destructive:d,idempotent:C,creates:c,connects:S,severs:b,writes:v,writesOther:A,sets:w}}let u={};for(let[r,p]of Object.entries(e.rules??{})){let y=p.covers&&p.over!=="graph"?ye(p.over,p.covers,m=>i.get(m),m=>m in e.kinds):void 0;u[r]={title:p.title??r.replace(/-/g," "),...p.require?{require:J(p.require)}:{},...y&&"plan"in y?{covers:y.plan}:{},...p.when?{when:J(p.when)}:{},...p.says?{says:de(ee(p.says),e.kinds[p.over]?.fields)}:{}}}let f=Ze(e,s),g=Je(e),l=Xe(e);return{format:He,document:e,findings:s,kinds:t,...e.computed?{facts:[...se(e)??[]]}:{},edges:[...i].map(([r,{from:p,to:y,cardinality:m}])=>[r,{from:p,to:y,cardinality:m}]),acts:a,rules:u,brand:f,...Object.keys(g).length>0?{viewSpecs:g}:{},...l?{home:l}:{}}}function Yt(e,s,i){let t=/^defineNode\("([^"]+)"\)/.exec(s)?.[1],o=t?i.kinds[t]:void 0;if(!t||!o)return e;let a=Object.keys(o.fields).filter(u=>u!=="label").slice(0,3);return{...e,path:`kinds.${t}.glance`,fix:`Say which: "glance": [${a.map(u=>`"${u}"`).join(", ")}] on kinds.${t} \u2014 the facts a person compares one by, at a glance.`}}function Gn(e,s){let i=[],t=new Set(Object.values(s.kinds).flatMap(o=>Object.keys(o.edges??{})));for(let[o,a]of Object.entries(e.kinds)){let u=a.renamedFrom;u&&!s.kinds[u]&&i.push(k("renamed-from-nothing",`kinds.${o}.renamedFrom`,`${o} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let f=s.kinds[u??o];for(let[g,l]of Object.entries(a.fields)){let r=l.renamedFrom;r&&!f?.fields[r]&&i.push(k("renamed-from-nothing",`kinds.${o}.fields.${g}.renamedFrom`,`${g} says it was ${r}, and the previous ${u??o} has no field called ${r}`,"name the field it was, or drop renamedFrom"))}for(let[g,l]of Object.entries(a.edges??{})){let r=l.renamedFrom;r&&!t.has(r)&&i.push(k("renamed-from-nothing",`kinds.${o}.edges.${g}.renamedFrom`,`${g} says it was ${r}, and the previous version has no relation called ${r}`,"name the relation it was, or drop renamedFrom"))}}return i}export{Mn as a,Ht as b,yn as c,Wt as d,Yt as e};
|
|
@@ -1 +1 @@
|
|
|
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{L as $,Mb as L,P as j,Pb as N,S as H,nd as E}from"./chunk.
|
|
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{L as $,Mb as L,P as j,Pb as N,S as H,nd as E}from"./chunk.6AANHELP.js";var W=()=>(__graviewPreload(import.meta.url,["./chunk.CGBOPPNL.js","./chunk.LMTG5NPG.js","./chunk.M5FP4Y4Q.js","./chunk.CNN32262.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.XRE7SHLD.js"));function D(e,l,d){let i=new Map;for(let y of d?.kinds??[])for(let a of e.nodesOfKind(y))l.has(a.id)||i.set(a.id,a);let s=new Set([...l,...i.keys()]),p=new Set(d?.edges??[]),k=new Set;if(p.size>0&&l.size>0){for(let y of l)for(let a of e.outEdges(y))p.has(a.kind)&&i.has(a.to)&&k.add(a.to);for(let y of i.keys())e.outEdges(y).some(a=>p.has(a.kind)&&l.has(a.to))&&k.add(y)}let R=new Map([...[...i].filter(([y])=>k.has(y)),...[...i].filter(([y])=>!k.has(y))]),h=[];if(p.size>0)for(let y of s)for(let a of e.outEdges(y))p.has(a.kind)&&s.has(a.to)&&h.push({kind:a.kind,from:a.from,to:a.to});return{nodes:[...R.values()],edges:h}}function O(e,l,d){let i=[];return()=>{let s=d();for(;i.length>0&&i[0]<=s-l;)i.shift();return i.length>=e?!1:(i.push(s),!0)}}function I(e={},l=Date.now){return{act:O(e.acts??30,e.actWindowMs??6e4,l),message:O(e.messages??120,e.messageWindowMs??1e3,l)}}var v=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function J(e,l){let d=l.flatMap(s=>v(s)&&typeof s.kind=="string"?[s.kind]:[]),i=E(e,d);return Object.keys(i).length>0?{choices:i}:{}}function _(e,l){let d=structuredClone(l),i=e.schema.tryDefinition(d.kind),s=d.label;return{...d,label:i?.label?i.label(d):typeof s=="string"&&s.length>0?s:d.id}}function Q(e){let l=e.limiter??I(e.limits,e.now),d=e.limits?.maxHeight??4e3,i=`view:${e.view}`,s={applied:0,refused:0,dropped:0},p=()=>e.store.seenBy(e.principal),k=n=>_(e.store,n),R=()=>{if(e.props)return e.props();let n=p(),u=n.graph,r=e.input?.()??{},c=r.node?u.getNode(r.node.id):void 0,o=r.nodes?.flatMap(t=>{let m=u.getNode(t.id);return m?[m]:[]}),g=new Set([...c?[c.id]:[],...(o??[]).map(t=>t.id)]),f=[];for(let t of g)for(let m of u.outEdges(t))g.has(m.to)&&f.push({kind:m.kind,from:m.from,to:m.to});let G=D(u,g,e.reads),A=new Set(f.map(t=>`${t.kind} ${t.from} ${t.to}`));for(let t of G.edges)A.has(`${t.kind} ${t.from} ${t.to}`)||f.push(t);let w=G.nodes.length>0?[...o??[],...G.nodes]:o,S=t=>t?.filter(m=>u.has(m)),F=n.permittedMutations(e.principal).map(t=>({name:t.name,title:t.title??t.name,...t.description!==void 0?{description:t.description}:{},...t.subject?{subject:{kinds:t.subject.kinds,arg:t.subject.arg}}:{}}));return{view:e.view,...c?{node:k(c)}:{},...w?{nodes:w.map(k)}:{},edges:f,...r.label!==void 0?{label:r.label}:{},...r.fidelity!==void 0?{fidelity:r.fidelity}:{},...r.cardinality!==void 0?{cardinality:r.cardinality}:{},...r.mode!==void 0?{mode:r.mode}:{},...r.selected!==void 0?{selected:r.selected}:{},...r.implicated?{implicated:S(r.implicated)}:{},...r.flagged?{flagged:S(r.flagged)}:{},acts:F,...e.theme?{theme:e.theme()}:{},locale:j(),timeZone:H(),today:e.store.today()??$(),...J(e.store.schema,[...c?[c]:[],...w??[]]),...e.placesShown?{places:e.placesShown().map(({as:t,title:m,kind:K})=>({as:t,title:m,kind:K}))}:{}}},h=!1,y=0,a=new Set,M=()=>{if(h)return;y+=1,a.add(y),a.size>100&&a.delete(a.values().next().value);let n=R();e.send({type:"props",props:e.hand?e.hand(n):n,push:y})},x=!1,T=e.store.subscribe(()=>{x||(x=!0,queueMicrotask(()=>{x=!1,M()}))}),b=(n,u)=>(s.refused+=1,{ok:!1,reason:n,message:u}),z=(n,u,r)=>P([{name:n,args:u}],r),P=(n,u,r)=>{if(!l.act())return b("rate-limited","Too many acts asked for at once; this one was not applied.");let c=[];for(let{name:o,args:g}of n){if(u){let f=u(o,g);if(!f.ok)return b(f.reason,f.message);o=f.name,g=f.args}if(!e.store.allMutations().some(f=>f.name===o))return b("unknown-act","There is no act by that name here.");c.push({name:o,args:g})}try{let o=e.store.applyAll(c,{author:e.principal,via:i,...r?{intent:r}:{}});return s.applied+=1,{ok:!0,intent:o.intent}}catch(o){return o instanceof L?b("refused",o.refusal.message):o instanceof N?b("failed",Z(o)):b("failed","The act could not be applied.")}},C=(n,u,r)=>{let c=Array.isArray(r);if(typeof u!="string"||(c?r.length===0||r.length>100||!r.every(v):!v(r)))return s.refused+=1,e.send({type:"answer",id:n,ok:!1,reason:"malformed",message:"An act is asked for by name, with its arguments as an object, or a list of 1 to 100 of them for several as one change."});let o=P((c?r:[r]).map(g=>({name:u,args:g})),e.judgeAct);e.send(o.ok?{type:"answer",id:n,ok:!0,intent:o.intent}:{type:"answer",id:n,ok:!1,reason:o.reason,message:o.message})};return{receive(n){if(h)return;if(!(v(n)&&n.nonce===e.nonce&&n.type==="pushed"&&typeof n.push=="number"&&a.delete(n.push))&&!l.message()){s.dropped+=1,e.onFlood?.();return}if(!v(n)||n.nonce!==e.nonce){s.dropped+=1;return}if(n.type==="act"&&(typeof n.id=="string"||typeof n.id=="number"))return C(n.id,n.name,n.args);if(n.type==="navigate"&&e.onArrive&&(typeof n.place=="string"||typeof n.to=="string")){let r={...n.where!==void 0?{where:n.where}:{},...n.section!==void 0?{section:n.section}:{}},c=typeof n.place=="string"?{place:n.place,...r}:{record:n.to,...r},o=e.onArrive;W().then(({judgeDestination:g,listsOf:f,placeVocabulary:G})=>{if(h)return;let A=new Set([...e.store.kindsKeptFrom(e.principal),...e.store.modules.disabledKinds]),w=g(c,{sees:S=>p().graph.has(S),places:G(e.store.schema,e.placesShown?.()??[],{kept:A}),lists:f(e.store.schema,A),schema:e.store.schema});w.ok?o(w.arrival):(s.dropped+=1,e.onLost?.(w.says))});return}if(n.type==="navigate"&&typeof n.place=="string"){e.places?.().includes(n.place)?e.onNavigatePlace?.(n.place):s.dropped+=1;return}if(n.type==="navigate"&&typeof n.to=="string"){p().graph.has(n.to)?e.onNavigate?.(n.to):s.dropped+=1;return}if(n.type==="render"&&Array.isArray(n.records)&&e.onRender){e.onRender(n.records);return}if(n.type==="style"&&Array.isArray(n.sheets)&&n.sheets.every(r=>typeof r=="string")&&e.onStyle){e.onStyle(n.sheets);return}if(n.type==="hears"&&Array.isArray(n.events)&&e.onHears){e.onHears(n.events.filter(r=>typeof r=="string").slice(0,20));return}if(n.type==="clicks"&&Array.isArray(n.selectors)){let r=c=>(Array.isArray(c)?c:[]).filter(o=>typeof o=="string"&&o.length<=500).slice(0,200);e.onClicks?.(r(n.selectors),r(n.acted));return}if(n.type==="gestures"&&Array.isArray(n.bound)&&e.onGestures){e.onGestures(n.bound.slice(0,32));return}if(n.type==="pushed"&&typeof n.push=="number"&&typeof n.ms=="number"&&e.onPushed){e.onPushed(n.push,n.ms);return}if(n.type==="size"&&typeof n.height=="number"&&Number.isFinite(n.height)){e.onSize?.(Math.max(0,Math.min(d,Math.round(n.height))));return}s.dropped+=1},push:M,pressed(n){return h?{ok:!1,reason:"refused",message:"The view has gone."}:n.ok?z(n.name,n.args):(s.refused+=1,n)},change(n,u){return h?{ok:!1,reason:"refused",message:"The view has gone."}:P(n,void 0,u)},get stats(){return s},dispose(){h=!0,T()}}}var V=e=>({number:"a number",string:"text",boolean:"yes or no",date:"a date",array:"a list",object:"a set of values"})[e.toLowerCase()]??`a ${e}`;function Z(e){return`Not applied: ${q(e)}.`}function q(e){return e.issues.slice(0,4).map(d=>{let i=d.path.map(String).join("."),s=/expected (\w+)/i.exec(d.message)?.[1];return i?s&&/^invalid (input|type)/i.test(d.message)?`\u201C${i}\u201D expects ${V(s)}`:`\u201C${i}\u201D: ${d.message.charAt(0).toLowerCase()}${d.message.slice(1)}`:d.message}).join("; ")||"its arguments did not fit"}export{D as a,I as b,J as c,_ as d,Q as e,Z as f,q as g};
|