graview 0.1.37 → 0.1.38
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.YFW5BF6J.js → chunk.2EJAIT33.js} +1 -1
- package/dist/preview/chunk.2HFRVWWM.js +1 -0
- package/dist/preview/chunk.2VIGF4FO.js +1 -0
- package/dist/preview/chunk.33GN2NUT.js +1 -0
- package/dist/preview/{chunk.5CLFTXP3.js → chunk.36SQJMEE.js} +1 -1
- package/dist/preview/{chunk.NOZEHLWG.js → chunk.3D5T3XIE.js} +1 -1
- package/dist/preview/chunk.3FW4QNGV.js +1 -0
- package/dist/preview/chunk.3RT2GUZ5.js +1 -0
- package/dist/preview/chunk.3ZRHHB7X.js +1 -0
- package/dist/preview/{chunk.YW2BZ2LH.js → chunk.4DEUD66C.js} +2 -2
- package/dist/preview/{chunk.VW6WGFL6.js → chunk.4EQSP7I3.js} +1 -1
- package/dist/preview/chunk.4Y6BCHV2.js +1 -0
- package/dist/preview/{chunk.UPBUF7KR.js → chunk.5MSO3KRO.js} +1 -1
- package/dist/preview/chunk.5VBBQ6Z3.js +1 -0
- package/dist/preview/chunk.5XJEGXDO.js +3 -0
- package/dist/preview/{chunk.BXWO6ILK.js → chunk.67WL7BGF.js} +1 -1
- package/dist/preview/{chunk.NWHFFOXW.js → chunk.6CKBIY7L.js} +1 -1
- package/dist/preview/{chunk.WNMLA4YW.js → chunk.6IHXTT6Z.js} +1 -1
- package/dist/preview/{chunk.QJYALCIW.js → chunk.6ONRWFA6.js} +1 -1
- package/dist/preview/{chunk.TSI4O3GH.js → chunk.6UCRL4OF.js} +1 -1
- package/dist/preview/{chunk.ENJKCSNX.js → chunk.6XJP7F3I.js} +1 -1
- package/dist/preview/{chunk.JDRM6XXD.js → chunk.74RMHUCX.js} +1 -1
- package/dist/preview/{chunk.YAXOIJVH.js → chunk.7H5KVW2F.js} +1 -1
- package/dist/preview/chunk.7RSZMIAL.js +1 -0
- package/dist/preview/{chunk.7MMNMZLF.js → chunk.AFY35RJP.js} +1 -1
- package/dist/preview/{chunk.SNKOPWAD.js → chunk.AZCFXPEL.js} +1 -1
- package/dist/preview/{chunk.JBRXGPPM.js → chunk.B5ILKGEF.js} +1 -1
- package/dist/preview/{chunk.BRBY5WJT.js → chunk.BRHRAVU2.js} +2 -2
- package/dist/preview/chunk.BUVAMSOZ.js +3 -0
- package/dist/preview/{chunk.ENEOGGFM.js → chunk.DFVVS6C5.js} +1 -1
- package/dist/preview/{chunk.YNJOLOFG.js → chunk.DL637Q3W.js} +1 -1
- package/dist/preview/chunk.DQJAEU4V.js +1 -0
- package/dist/preview/chunk.ESSQAMPM.js +1 -0
- package/dist/preview/{chunk.QYWBQ5NX.js → chunk.EUGWV3S6.js} +1 -1
- package/dist/preview/chunk.EV553KRT.js +1 -0
- package/dist/preview/{chunk.EHT4HBH5.js → chunk.EZP4FHDX.js} +1 -1
- package/dist/preview/chunk.F6PIK2J2.js +1 -0
- package/dist/preview/{chunk.AWRS6TUN.js → chunk.FMVWXSQ7.js} +1 -1
- package/dist/preview/{chunk.NZJZIYDK.js → chunk.FTJBW25J.js} +1 -1
- package/dist/preview/chunk.FUJM7GDV.js +1 -0
- package/dist/preview/{chunk.AZ333RB3.js → chunk.FYIQZMVF.js} +1 -1
- package/dist/preview/{chunk.UVLPVHID.js → chunk.GR5Q4HTW.js} +1 -1
- package/dist/preview/{chunk.KAWP4RNR.js → chunk.GZ3IXNA4.js} +1 -1
- package/dist/preview/chunk.HUSFMFXH.js +1 -0
- package/dist/preview/chunk.HVTGPEVW.js +1 -0
- package/dist/preview/chunk.I3SQJ2L2.js +1 -0
- package/dist/preview/{chunk.GMZAQGH7.js → chunk.IEDXW36H.js} +1 -1
- package/dist/preview/chunk.IM7LXLIB.js +2 -0
- package/dist/preview/chunk.IU6ISXXC.js +1 -0
- package/dist/preview/{chunk.XS3SAH6U.js → chunk.JWJQ2VXS.js} +1 -1
- package/dist/preview/chunk.K5KEECHL.js +88 -0
- package/dist/preview/{chunk.UR5TT4JH.js → chunk.KNJZ2YNJ.js} +1 -1
- package/dist/preview/chunk.L34FY7QQ.js +1 -0
- package/dist/preview/{chunk.HYAKRLPT.js → chunk.L73VUBXN.js} +3 -3
- package/dist/preview/{chunk.QOXTBRKE.js → chunk.L7JKEEMM.js} +1 -1
- package/dist/preview/chunk.LAW5PQEM.js +1 -0
- package/dist/preview/chunk.LDD3QX7G.js +1 -0
- package/dist/preview/chunk.LF7PU77M.js +7 -0
- package/dist/preview/chunk.LHO7L3CS.js +1 -0
- package/dist/preview/chunk.LU5LSXSW.js +1 -0
- package/dist/preview/{chunk.3V2M3S4U.js → chunk.MCVY6RRS.js} +1 -1
- package/dist/preview/chunk.MQ7FNHXG.js +25 -0
- package/dist/preview/{chunk.YX354FRV.js → chunk.MVNUWK5Y.js} +1 -1
- package/dist/preview/{chunk.7OLVQ2FZ.js → chunk.MWZK3HVG.js} +1 -1
- package/dist/preview/{chunk.QNGFBJWP.js → chunk.NH5TDAB2.js} +1 -1
- package/dist/preview/{chunk.7UQOXYJX.js → chunk.NORRCKGN.js} +1 -1
- package/dist/preview/{chunk.LJE5J3JK.js → chunk.NPX7SPXM.js} +1 -1
- package/dist/preview/chunk.NQQHOSOK.js +1 -0
- package/dist/preview/chunk.NWWMUOZM.js +1 -0
- package/dist/preview/{chunk.X2OLXTRL.js → chunk.OE4QOBJF.js} +1 -1
- package/dist/preview/chunk.OEF3GPRM.js +1 -0
- package/dist/preview/{chunk.LYJXX6BU.js → chunk.OS3L4ZOF.js} +1 -1
- package/dist/preview/chunk.OTL3Z345.js +1 -0
- package/dist/preview/{chunk.3KJQXYCA.js → chunk.P3UPCI23.js} +1 -1
- package/dist/preview/chunk.PGKIEDYV.js +9 -0
- package/dist/preview/{chunk.H4LFJPDV.js → chunk.PKUWET2F.js} +1 -1
- package/dist/preview/chunk.POHEWJKZ.js +1 -0
- package/dist/preview/chunk.PUBG2L6F.js +117 -0
- package/dist/preview/chunk.QT4XGC5Z.js +344 -0
- package/dist/preview/chunk.QTTBZJ6W.js +1 -0
- package/dist/preview/{chunk.FGYCYLUS.js → chunk.QYRPELLU.js} +1 -1
- package/dist/preview/chunk.RJDZOF2L.js +1 -0
- package/dist/preview/{chunk.MJLUAGEV.js → chunk.ROGYDMES.js} +1 -1
- package/dist/preview/{chunk.UCVZG7S4.js → chunk.RVJYEOFN.js} +1 -1
- package/dist/preview/{chunk.EKUAI5YL.js → chunk.RZVZG2BQ.js} +1 -1
- package/dist/preview/{chunk.CV4CBHFT.js → chunk.SGB6IMWN.js} +1 -1
- package/dist/preview/chunk.SGLJTSTD.js +1 -0
- package/dist/preview/{chunk.G7S7GLDK.js → chunk.SITFEJES.js} +1 -1
- package/dist/preview/{chunk.WVEKYJSI.js → chunk.SZWX56WR.js} +6 -6
- package/dist/preview/{chunk.5JPRRV47.js → chunk.TKSGC6XH.js} +1 -1
- package/dist/preview/chunk.TOWYHWPB.js +17 -0
- package/dist/preview/{chunk.TXS4I326.js → chunk.UF3L6FJO.js} +1 -1
- package/dist/preview/chunk.UXIFQIHA.js +2 -0
- package/dist/preview/{chunk.SZMWJHU2.js → chunk.V2NBJDAX.js} +1 -1
- package/dist/preview/{chunk.CGQLE7JW.js → chunk.V5ZT5NSJ.js} +1 -1
- package/dist/preview/chunk.VKHKYK5L.js +1 -0
- package/dist/preview/{chunk.TN4GY6LW.js → chunk.VNBR4DHD.js} +1 -1
- package/dist/preview/chunk.VSYHU5MA.js +1 -0
- package/dist/preview/{chunk.ELY2RMGE.js → chunk.VTWFVPKD.js} +1 -1
- package/dist/preview/chunk.VV4BPOIK.js +1 -0
- package/dist/preview/chunk.W2HCJQVK.js +32 -0
- package/dist/preview/{chunk.BA3REPV5.js → chunk.WERYQENC.js} +1 -1
- package/dist/preview/{chunk.6DYZBDWT.js → chunk.WG5NIR23.js} +1 -1
- package/dist/preview/{chunk.HBBVVALN.js → chunk.WLPTY4BF.js} +5 -5
- package/dist/preview/chunk.XHWL7QBF.js +1 -0
- package/dist/preview/chunk.XM3NPZLP.js +1 -0
- package/dist/preview/chunk.YAXZNQY6.js +1 -0
- package/dist/preview/chunk.YG423NEB.js +1 -0
- package/dist/preview/{chunk.74DXEKUV.js → chunk.YPY5BOEI.js} +1 -1
- package/dist/preview/{chunk.RPOYSIVQ.js → chunk.YUJG5SN5.js} +1 -1
- package/dist/preview/chunk.YVR3ZMTV.js +1 -0
- package/dist/preview/chunk.YXH3IWNR.js +1 -0
- package/dist/preview/{chunk.4NCXMVPY.js → chunk.Z3ZKYSPN.js} +1 -1
- package/dist/preview/{chunk.TRLVFHFT.js → chunk.ZLXPIEUC.js} +2 -2
- package/dist/preview/{chunk.UV2TSAB4.js → chunk.ZRQI5VJF.js} +1 -1
- package/dist/preview/chunk.ZYCNEOAQ.js +1 -0
- package/dist/preview/index.html +43 -42
- package/dist/preview/page.js +7 -7
- package/package.json +6 -6
- package/dist/preview/chunk.24E4R4ZH.js +0 -1
- package/dist/preview/chunk.2JF254FO.js +0 -9
- package/dist/preview/chunk.2TDB4D6Y.js +0 -1
- package/dist/preview/chunk.3IVVXVG7.js +0 -1
- package/dist/preview/chunk.57XTDW57.js +0 -1
- package/dist/preview/chunk.5EXYDBAL.js +0 -88
- package/dist/preview/chunk.67PVRVAC.js +0 -1
- package/dist/preview/chunk.6SK2K72G.js +0 -1
- package/dist/preview/chunk.76QUEWYD.js +0 -1
- package/dist/preview/chunk.AHC4EXLW.js +0 -3
- package/dist/preview/chunk.CYPTJNES.js +0 -1
- package/dist/preview/chunk.D2ILIAND.js +0 -1
- package/dist/preview/chunk.DLCFCMKX.js +0 -1
- package/dist/preview/chunk.DMUUYZ37.js +0 -1
- package/dist/preview/chunk.DNNL7F3P.js +0 -25
- package/dist/preview/chunk.FEPYKPZE.js +0 -1
- package/dist/preview/chunk.FFW6XWHB.js +0 -17
- package/dist/preview/chunk.GXPBRYSR.js +0 -1
- package/dist/preview/chunk.HCK4Y6C5.js +0 -1
- package/dist/preview/chunk.HSRGYZOR.js +0 -1
- package/dist/preview/chunk.IHBIRAC4.js +0 -2
- package/dist/preview/chunk.IWK5QL6P.js +0 -1
- package/dist/preview/chunk.J2HQEUYA.js +0 -1
- package/dist/preview/chunk.JFLUVZNW.js +0 -1
- package/dist/preview/chunk.LPJY6V5D.js +0 -1
- package/dist/preview/chunk.LVLAS5GL.js +0 -1
- package/dist/preview/chunk.LVNAB2BW.js +0 -27
- package/dist/preview/chunk.MKPJKZAP.js +0 -1
- package/dist/preview/chunk.MMBMVHIG.js +0 -1
- package/dist/preview/chunk.NNNVB6RV.js +0 -1
- package/dist/preview/chunk.NV6IZJKA.js +0 -1
- package/dist/preview/chunk.O6KNGFWH.js +0 -1
- package/dist/preview/chunk.PMK73A53.js +0 -1
- package/dist/preview/chunk.PQPZZ7ZW.js +0 -117
- package/dist/preview/chunk.QMZUKAPJ.js +0 -1
- package/dist/preview/chunk.QXARGANF.js +0 -341
- package/dist/preview/chunk.TX5QIZEP.js +0 -1
- package/dist/preview/chunk.U4URQDC5.js +0 -1
- package/dist/preview/chunk.VUKHDZNI.js +0 -1
- package/dist/preview/chunk.VX7MGVP5.js +0 -1
- package/dist/preview/chunk.WLV2QYTS.js +0 -1
- package/dist/preview/chunk.WNKRXL3O.js +0 -1
- package/dist/preview/chunk.XWJ2MRQF.js +0 -1
- package/dist/preview/chunk.Y44TR4WG.js +0 -1
- package/dist/preview/chunk.ZB7GV3IT.js +0 -1
- package/dist/preview/chunk.ZOT4V66Q.js +0 -3
- package/dist/preview/chunk.ZYPCE2LZ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O,b}from"./chunk.
|
|
1
|
+
import{a as O,b}from"./chunk.SGB6IMWN.js";import"./chunk.NPX7SPXM.js";import"./chunk.OE4QOBJF.js";import"./chunk.74RMHUCX.js";import"./chunk.QT4XGC5Z.js";import{$ as S,H as z,S as M}from"./chunk.MQ7FNHXG.js";import{Ac as A}from"./chunk.WLPTY4BF.js";import{b as v}from"./chunk.AJZBJBMO.js";var o=v(z(),1);var t=v(M(),1);function G(i){for(let d of i)for(let[r,s]of Object.entries(d))if(s===!1)return`${r} == true`;return""}var w={margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function j({ask:i,close:d}){let{store:r,principal:s,subscriptions:h,app:f}=S(),c=(0,o.useRef)(null),p=(0,o.useId)(),[n,u]=(0,o.useState)(0),[l,y]=(0,o.useState)(!0),[m,P]=(0,o.useState)(()=>{let e=i.choices.find(g=>g.on==="reaches");if(!e)return"";let a=e.record!==void 0?r.graph.getNode(e.record):void 0;return G(a?[a]:r.graph.nodesOfKind(e.kind).slice(0,5))}),[C,x]=(0,o.useState)(null),[W,k]=(0,o.useState)(!1);(0,o.useEffect)(()=>{let e=c.current;e&&!e.open&&e.showModal()},[]);let T=()=>{let e=i.returnTo;d(),requestAnimationFrame(()=>{e?.isConnected?e.focus():document.querySelector("[data-graview-page-title], main h1, [data-testid='activity-button']")?.focus()})},N=e=>e.on==="reaches"?{...e,condition:m}:e,E=e=>b(r,{when:N(e),alsoMine:!l}),L=async()=>{let e=N(i.choices[n]),a=O(r,e);if(a){x(a);return}k(!0);try{await h.add({who:A(s),app:f?.name??"app",when:e,...l?{}:{alsoMine:!0}}),T()}catch(g){k(!1),x(g instanceof Error?g.message:String(g))}};return(0,t.jsx)("dialog",{ref:c,"aria-labelledby":p,"data-testid":"notify-sheet",onClose:T,onClick:e=>{e.target===e.currentTarget&&e.currentTarget.close()},style:{width:"min(92vw, 420px)",padding:0,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)"},children:(0,t.jsxs)("form",{method:"dialog",onSubmit:e=>{e.preventDefault(),L()},style:{display:"grid",gap:12,padding:18},children:[(0,t.jsx)("h2",{id:p,style:{margin:0,fontSize:"1.0625rem"},children:"Notify me"}),(0,t.jsxs)("fieldset",{style:{margin:0,padding:0,border:0,display:"grid",gap:6},children:[(0,t.jsx)("legend",{style:{...w,marginBottom:6},children:"Tell me"}),i.choices.map((e,a)=>(0,t.jsxs)("label",{style:{display:"flex",gap:8,alignItems:"baseline",cursor:"pointer"},children:[(0,t.jsx)("input",{type:"radio",name:`${p}-when`,checked:n===a,onChange:()=>u(a),"data-notify-choice":e.on}),(0,t.jsx)("span",{children:e.on==="reaches"?`When ${e.record!==void 0?"it":"one"} reaches a condition`:E(e)})]},a))]}),i.choices[n]?.on==="reaches"?(0,t.jsxs)("label",{style:{display:"grid",gap:4},children:[(0,t.jsx)("span",{style:w,children:"The condition, in the app's own words (done == true, amount > 100)"}),(0,t.jsx)("input",{value:m,onChange:e=>P(e.target.value),"data-testid":"notify-condition",autoComplete:"off",spellCheck:!1})]}):null,(0,t.jsxs)("label",{style:{display:"flex",gap:8,alignItems:"center"},children:[(0,t.jsx)("input",{type:"checkbox",checked:l,onChange:e=>y(e.target.checked),"data-testid":"notify-others-only"}),"Only when someone else does it"]}),(0,t.jsxs)("p",{style:w,"data-testid":"notify-said",children:[E(i.choices[n]),"."]}),C?(0,t.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-danger, var(--graview-ink))"},children:C}):null,(0,t.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[(0,t.jsx)("button",{type:"button",onClick:()=>c.current?.close(),children:"Cancel"}),(0,t.jsx)("button",{type:"submit",autoFocus:!0,disabled:W,"data-testid":"notify-keep",style:{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"},children:"Notify me"})]})]})})}function B({style:i}){let{store:d,principal:r,subscriptions:s,app:h}=S(),f=(r.onBehalfOf??r).id,[c,p]=(0,o.useState)([]);return(0,o.useEffect)(()=>{if(f===void 0)return;let n=!0,u=()=>void Promise.resolve(s.list(f)).then(y=>n&&p(y.filter(m=>m.app===(h?.name??"app"))),()=>n&&p([]));u();let l=s.onChange?.(u);return()=>{n=!1,l?.()}},[s,f,h]),c.length===0?null:(0,t.jsxs)("section",{"aria-label":"What you are told of","data-testid":"notified",style:{display:"grid",gap:6,...i},children:[(0,t.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"You are told"}),(0,t.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:c.map(n=>(0,t.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"baseline",justifyContent:"space-between"},"data-subscription":n.id,children:[(0,t.jsx)("span",{style:{fontSize:"0.8125rem"},children:b(d,n)}),(0,t.jsx)("button",{type:"button","data-testid":"notify-stop","aria-label":`Stop: ${b(d,n)}`,onClick:u=>{let l=u.currentTarget.closest("li"),y=(l?.nextElementSibling??l?.previousElementSibling)?.querySelector("button");Promise.resolve(s.remove(n.id)).then(()=>(y??document.querySelector("[data-testid='activity-button']"))?.focus())},style:{padding:"1px 8px",fontSize:"0.8125rem"},children:"Stop"})]},n.id))})]})}export{B as NotifiedList,j as NotifySheet};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk.QT4XGC5Z.js";import{H as K,P as E,Q as j,S as C,aa as W}from"./chunk.MQ7FNHXG.js";import{Q as R,Ua as T,qc as P}from"./chunk.WLPTY4BF.js";import{b as x}from"./chunk.AJZBJBMO.js";function N(a,t){return a.kind==="agent"?"agent":a.kind!=="human"?"app":a.onBehalfOf!==void 0?"person":a.id===void 0||t?.id===void 0||a.id===t.id?"you":"person"}var Y=a=>a.ops.filter(t=>t.withheld!==!0);function z(a,t={}){let r=a.batches().map(e=>{let s=e.ops[0],l=e.ops.at(-1),c=Y(e).length===0;return{seq:l.seq+1,from:s.seq,at:l.at,batch:e.id,maker:c?"person":N(e.author,t.me),author:c?void 0:e.author,said:e.intent,declaration:!1,withheld:c}}),i=[...a.log.epochs().filter(e=>e.change!==void 0).map(e=>({seq:e.seq,sentence:e.change,...e.at?{at:e.at}:{}})),...t.declarations??[]];for(let e of i){if(e.seq<a.log.horizon||e.seq>a.log.length)continue;let s=r.findIndex(l=>l.seq===e.seq);if(s>=0&&!r[s].withheld){r[s]={...r[s],declaration:!0,said:e.sentence};continue}r.push({seq:e.seq,from:e.seq,at:e.at,batch:void 0,maker:e.author?N(e.author,t.me):"app",author:e.author,said:e.sentence,declaration:!0,withheld:!1})}return r.sort((e,s)=>e.seq-s.seq||+(e.batch!==void 0)-+(s.batch!==void 0))}function I(a,t){let r=a.log.all(),i=new Map(r.map(e=>[e.id,e.seq]));return a.batches().filter(e=>!e.undone&&e.ops[0].seq>=t).filter(e=>!e.ops.every(s=>s.undoes!==void 0&&(i.get(s.undoes)??-1)>=t)).map(e=>e.id)}function B(a,t){return a.withheld?"Someone":a.maker==="you"?"you":a.author?T(a.author,t):"the app"}var d=x(K(),1);var o=x(C(),1),_={kind:"human"},G=[1,2,4,8],U=900,q={you:"You",person:"A person",agent:"An agent",app:"The app"},H={you:"var(--graview-accent)",person:"var(--graview-ink-muted)",agent:"var(--graview-activity, var(--graview-good))",app:"var(--graview-edge-bright)"};function X(a,t){return[...new Set([t,...a.map(r=>r.seq)])].sort((r,i)=>r-i)}function J(a,t){let r=0;for(let i=0;i<a.length;i++)a[i]<=t&&(r=i);return r}function Q(a,t,r){let i=I(a,t);if(i.length===0)return null;let e=a.canUndo(i);if(!e.ok)return null;let s=new Set(a.permittedMutations(r).map(l=>l.name));return e.ops.every(l=>l.mutation!==null&&s.has(l.mutation.name))?i:null}function oe({face:a}){let t=E(),r=W(),i=r?.principal??_,e=j(t.live,i),s=e.log.length,l=(0,d.useMemo)(()=>z(e,{me:i,...t.host?.declarations?{declarations:t.host.declarations}:{}}),[e,i,t.host,s]),c=(0,d.useMemo)(()=>X(l,e.log.horizon),[l,e]),f=t.past?.seq??s,h=J(c,f),y=c.length-1,k=[...l].reverse().find(n=>n.seq<=f&&n.seq>(c[h-1]??-1))??[...l].reverse().find(n=>n.seq<=f),[g,v]=(0,d.useState)(!1),[w,L]=(0,d.useState)(1),[A,$]=(0,d.useState)(null);(0,d.useEffect)(()=>{if(!g)return;if(h>=y){v(!1);return}let n=setTimeout(()=>t.show(c[h+1]),U/w);return()=>clearTimeout(n)},[g,h,y,w,c,t]);let D=(0,d.useMemo)(()=>t.past?Q(e,f,i):null,[t.past,e,f,i,s]),M=n=>B(n,{graph:e.graph,schema:e.schema,...r?.seats?{seats:r.seats}:{},...r?.people?{people:r.people}:{}}),u=t.past?t.past.at?R(t.past.at,r?.locale):"the start":null,S=k?`${M(k)==="you"?"You":M(k)}: ${k.said}`:"Nothing had happened yet",O=(0,d.useRef)(null);(0,d.useLayoutEffect)(()=>{let n=O.current,m=n?.parentElement;if(a!=="scene"||!n||!m)return;let p=()=>m.style.setProperty("--graview-sheet",`${Math.ceil(n.getBoundingClientRect().height)+24}px`);p();let b=typeof ResizeObserver>"u"?null:new ResizeObserver(p);return b?.observe(n),()=>{b?.disconnect(),m.style.removeProperty("--graview-sheet")}},[a]);let V=a==="scene"?{position:"absolute",left:"50%",bottom:12,transform:"translateX(-50%)",width:"min(720px, calc(100% - 32px))",zIndex:P("rail")}:{position:"sticky",top:0,zIndex:P("rail"),margin:"0 auto 12px",maxWidth:960,width:"100%"};return(0,o.jsxs)("section",{ref:O,"aria-label":"Timeline","data-testid":"timeline","data-graview-past":t.past?String(t.past.seq):"now","data-graview-offstage":"",style:{...V,boxSizing:"border-box",display:"grid",gap:8,padding:"10px 12px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontSize:"0.8125rem"},children:[(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px"},children:[(0,o.jsx)("strong",{"data-testid":"as-of",role:"status",style:{fontWeight:600},children:u?`As of ${u}`:"Now"}),(0,o.jsx)("span",{"data-testid":"timeline-caption",style:{color:"var(--graview-ink-muted)",minWidth:0,overflowWrap:"anywhere"},children:S}),u?(0,o.jsx)("span",{style:{color:"var(--graview-ink-faint)"},"data-testid":"past-read-only",children:"Nothing changes while you look back."}):null]}),(0,o.jsx)("div",{style:{position:"relative",height:22},"aria-hidden":"true",children:c.slice(1).map((n,m)=>{let p=[...l].reverse().find(F=>F.seq===n),b=y===0?0:(m+1)/y*100;return(0,o.jsx)("span",{"data-graview-tick":n,"data-maker":p.maker,...p.declaration?{"data-declaration":""}:{},title:`${q[p.maker]}: ${p.said}`,style:{position:"absolute",left:`calc(${b}% - 1px)`,bottom:0,width:p.declaration?4:2,height:p.declaration?22:12,borderRadius:2,background:p.declaration?"var(--graview-ink)":H[p.maker],opacity:n<=f?1:.45}},`${n}:${p.batch??"declaration"}`)})}),(0,o.jsx)("input",{type:"range","data-testid":"scrubber","aria-label":"Moment",min:0,max:y,step:1,value:h,"aria-valuetext":u?`As of ${u}. ${S}`:`Now. ${S}`,onChange:n=>{v(!1),t.show(c[Number(n.currentTarget.value)]??s)},style:{width:"100%",margin:0,accentColor:"var(--graview-accent)"}}),(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,o.jsx)("button",{type:"button","data-testid":"play","aria-pressed":g,onClick:()=>{!g&&h>=y&&t.show(c[0]),v(!g)},style:{minHeight:28,minWidth:64},children:g?"Pause":"Play"}),(0,o.jsxs)("label",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--graview-ink-muted)"},children:["Speed",(0,o.jsx)("select",{"data-testid":"speed",value:w,onChange:n=>L(Number(n.currentTarget.value)),style:{minHeight:28},children:G.map(n=>(0,o.jsxs)("option",{value:n,children:[n,"\xD7"]},n))})]}),(0,o.jsx)("span",{"aria-hidden":"true",style:{display:"inline-flex",gap:10,color:"var(--graview-ink-faint)",flexWrap:"wrap"},children:Object.keys(q).filter(n=>l.some(m=>m.maker===n)).map(n=>(0,o.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[(0,o.jsx)("span",{style:{width:8,height:8,borderRadius:2,background:H[n]}}),q[n]]},n))}),(0,o.jsxs)("span",{style:{marginLeft:"auto",display:"inline-flex",gap:8},children:[D?(0,o.jsx)("button",{type:"button","data-testid":"restore-here",title:"Take back every change since, as one change you can undo",onClick:()=>{$(null);try{e.undo([...D],{author:i,intent:u?`Restore to ${u}`:"Restore"}),t.show(null)}catch(n){$(n instanceof Error?n.message:String(n))}},style:{minHeight:28},children:"Restore to here"}):null,(0,o.jsx)("button",{type:"button","data-testid":"back-to-now",onClick:()=>t.show(null),style:{minHeight:28},children:"Back to now"})]})]}),A?(0,o.jsx)("span",{role:"alert","data-testid":"restore-refused",style:{color:"var(--graview-warn)"},children:A}):null]})}export{oe as Timeline};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as C,e as L,n as H,o as R,p as k}from"./chunk.BUVAMSOZ.js";import"./chunk.FTJBW25J.js";import"./chunk.UT6642FC.js";import"./chunk.MCVY6RRS.js";import"./chunk.RZVZG2BQ.js";import{a as S}from"./chunk.VKHKYK5L.js";import"./chunk.TI4OSTQV.js";import"./chunk.EUGWV3S6.js";import"./chunk.MWZK3HVG.js";import"./chunk.3D5T3XIE.js";import"./chunk.GR5Q4HTW.js";import"./chunk.QT4XGC5Z.js";import{H as T,S as b,ya as E}from"./chunk.MQ7FNHXG.js";import{qc as x}from"./chunk.WLPTY4BF.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 j({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{j as HoverChip};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{o as N}from"./chunk.QT4XGC5Z.js";import{$ as h,H as $,S as f,aa as x}from"./chunk.MQ7FNHXG.js";import{Jc as w,Kc as p,Lc as g,Sc as b}from"./chunk.WLPTY4BF.js";import{b as c}from"./chunk.AJZBJBMO.js";var s=c($(),1);var i=c(f(),1),P=()=>()=>{};function S(e){let n=(0,s.useMemo)(()=>e?.onChange?o=>e.onChange(o):P,[e]),t=()=>e?.current()??p;return(0,s.useSyncExternalStore)(n,t,t)}var R=(e,n)=>e.lens?n.may.lenses:n.may.views;async function v(e,n,t){try{return await n(),!0}catch(o){return e?.notify({kind:"toast",tone:"bad",sentence:o instanceof Error&&o.message?o.message:t}),!1}}function B(e,n,t,o,d){let a=e.name;return v(d,()=>n==="view"&&a!==void 0?o?t.hide(a):t.show(a):t.lens?.({op:"set-lens-hidden",title:e.title,on:e.kind,hidden:o}),o?`\u201C${e.title}\u201D could not be hidden.`:`\u201C${e.title}\u201D could not be shown.`)}function k(e,n,t){return v(t,()=>n.restore(e.name),`\u201C${e.title}\u201D could not be restored.`)}async function H(e,n,t,o){let d=n==="view"&&e.name!==void 0?e.name:w(e.title),a=await v(o,()=>n==="view"&&e.name!==void 0?t.remove(e.name,{title:e.title,kind:e.kind}):t.lens?.({op:"remove-lens",title:e.title,on:e.kind}),`\u201C${e.title}\u201D could not be deleted.`);return a&&o?.notify({kind:"toast",id:`deleted-view-${d}`,sentence:`Deleted \u201C${e.title}\u201D. It is under Recently deleted in the places for ${30} days.`,action:{label:"Restore",onSelect:()=>void k({name:d,title:e.title},t,o)}}),a}function E(){let e=x(),n=e?.keptViews,t=S(n),o=e?.views;return(0,s.useMemo)(()=>{if(!n||!o)return null;let d=r=>g(r,t,n),a=new Set,u=o.places().filter(r=>{if(!r.hidden||d(r)===null)return!1;let m=`${r.name??""}|${r.title}`;return a.has(m)?!1:(a.add(m),!0)});return{keeper:n,hidden:u,removed:t.removed.filter(r=>R(r,t)),how:d}},[n,t,o])}function C(e,n){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(n??"en-US",{month:"short",day:"numeric"})}var D=`.graview-bar-list li.graview-bar-tidied{display:flex;align-items:flex-start;gap:8px;padding:0 0 0 2px}
|
|
2
|
+
.graview-bar-tidied>.graview-bar-item,.graview-bar-gone{flex:1 1 auto;min-width:0}
|
|
3
|
+
.graview-bar-gone{display:grid;gap:1px;padding:7px 8px;font-size:.875rem;line-height:1.3;overflow-wrap:anywhere;color:var(--graview-ink-muted)}
|
|
4
|
+
.graview-bar-gone small{font-size:.75rem}
|
|
5
|
+
.graview-bar-tidy{flex:0 0 auto;margin:3px 2px;padding:4px 10px;border:1px solid var(--graview-edge);border-radius:6px;background:none;font:inherit;font-size:.8125rem;color:var(--graview-ink);cursor:pointer}
|
|
6
|
+
.graview-bar-tidy:hover{background:color-mix(in srgb,var(--graview-ink) 7%,transparent)}
|
|
7
|
+
.graview-bar-tidy:focus-visible{outline:2px solid var(--graview-accent);outline-offset:1px}`;function G({place:e,scene:n,reach:t,done:o}){if(n)return(0,i.jsx)("span",{className:"graview-bar-gone",children:e.title});let d={key:`place:${e.kind}:${e.as}`,label:e.title,path:b(e.as),group:"pictures",kind:e.kind},a=t.href?.(d.path);return(0,i.jsx)(a!==void 0?"a":"button",{className:"graview-bar-item","data-testid":"app-view-hidden-place",...a!==void 0?{href:a}:{type:"button"},onClick:r=>{o(),!(!t.go||a!==void 0&&(r.button!==0||r.metaKey||r.ctrlKey||r.shiftKey||r.altKey))&&(r.preventDefault(),t.go(d))},children:e.title})}function O({id:e,scene:n,reach:t,done:o}){let d=E(),{locale:a}=h(),u=(0,s.useContext)(N);if(!d||d.hidden.length===0&&d.removed.length===0)return null;let{keeper:r,hidden:m,removed:y,how:K}=d;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("style",{children:D}),m.length>0?(0,i.jsxs)("div",{role:"group","aria-labelledby":`${e}-hidden`,"data-place-group":"hidden",children:[(0,i.jsx)("p",{id:`${e}-hidden`,children:"Hidden"}),(0,i.jsx)("ul",{children:m.map(l=>(0,i.jsxs)("li",{className:"graview-bar-tidied",children:[(0,i.jsx)(G,{place:l,scene:n,reach:t,done:o}),(0,i.jsx)("button",{type:"button",className:"graview-bar-tidy","data-testid":"app-view-show","data-view":l.name??l.title,"aria-label":`Show \u201C${l.title}\u201D`,onClick:()=>void B(l,K(l),r,!1,u),children:"Show"})]},`${l.kind}:${l.as}`))})]}):null,y.length>0?(0,i.jsxs)("div",{role:"group","aria-labelledby":`${e}-removed`,"data-place-group":"removed",children:[(0,i.jsx)("p",{id:`${e}-removed`,children:"Recently deleted"}),(0,i.jsx)("ul",{children:y.map(l=>(0,i.jsxs)("li",{className:"graview-bar-tidied",children:[(0,i.jsxs)("span",{className:"graview-bar-gone",children:[(0,i.jsx)("span",{children:l.title}),(0,i.jsxs)("small",{children:["until ",C(l.until,a)]})]}),(0,i.jsx)("button",{type:"button",className:"graview-bar-tidy","data-testid":"app-view-restore","data-view":l.name,"aria-label":`Restore \u201C${l.title}\u201D`,onClick:()=>void k(l,r,u),children:"Restore"})]},l.name))})]}):null]})}export{O as TidyGroups,H as remove,k as restore,B as setHidden,S as useKeptViewsState,E as useTidied};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as a}from"./chunk.I3SQJ2L2.js";import{$ as l,H as f,S as s}from"./chunk.MQ7FNHXG.js";import{b as i}from"./chunk.AJZBJBMO.js";var d=i(f(),1),p=i(s(),1),c=new Set;function B(e){return c.add(e),()=>void c.delete(e)}function S(){let{store:e,principal:o}=l();return(0,d.useMemo)(()=>n=>{let t=n.on===void 0?void 0:e.graph.getNode(n.on);if(!t)return null;let u=[...c].filter(r=>r.store===e&&r.kind===t.kind);return(n.element?u.find(r=>r.root()?.contains(n.element)??!1):u[0])?.section(t.id,o)??null},[e,o])}function v({children:e}){let o=S(),n=(0,d.useMemo)(()=>[o],[o]);return(0,p.jsx)(a,{sections:n,children:e})}export{B as a,S as b,v as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk.YPY5BOEI.js";import"./chunk.VKHKYK5L.js";import"./chunk.QT4XGC5Z.js";import"./chunk.MQ7FNHXG.js";import"./chunk.WLPTY4BF.js";import"./chunk.AJZBJBMO.js";export{a as ActivityFilter,b as InteractionRow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as f}from"./chunk.
|
|
1
|
+
import{a as f}from"./chunk.RZVZG2BQ.js";import{ba as d}from"./chunk.WLPTY4BF.js";function w(n){let o=n.indexOf("{"),r=n.indexOf("["),t=r!==-1&&(o===-1||r<o)?r:o;if(t===-1)return;let e=n[t],a=e==="["?"]":"}",i=0,c=!1,l=!1;for(let s=t;s<n.length;s++){let u=n[s];if(c){l?l=!1:u==="\\"?l=!0:u==='"'&&(c=!1);continue}if(u==='"')c=!0;else if(u===e)i+=1;else if(u===a&&(i-=1,i===0))try{return JSON.parse(n.slice(t,s+1))}catch{return}}}function v(n,o){let r;try{r=n.mutation(o.mutation)}catch{return o}let t={...o.args},e=!1;for(let a of f(r.input)){if(a.control!=="node")continue;let i=t[a.name];if(typeof i!="string"||i.length===0||n.graph.getNode(i))continue;let c=i.trim().toLowerCase(),l=[...n.graph.allNodes()].filter(s=>(a.kinds.includes("*")||a.kinds.includes(s.kind))&&d(n.schema.tryDefinition(s.kind),s).trim().toLowerCase()===c);l.length===1&&(t[a.name]=l[0].id,e=!0)}return e?{...o,args:t}:o}function P(n,o,r){let t=r===void 0?null:new Set(r),e=[];for(let a of o){if(typeof a.mutation!="string")continue;let i=!0;try{n.mutation(a.mutation)}catch{i=!1}i?t&&!t.has(a.mutation)&&e.push({proposal:a,why:"not-allowed"}):e.push({proposal:a,why:"unknown"})}return e}function x(n,o,r){let t=r===void 0?null:new Set(r);return o.filter(e=>{if(typeof e.mutation!="string"||t&&!t.has(e.mutation))return!1;try{n.mutation(e.mutation)}catch{return!1}return e.args!==null&&typeof e.args=="object"})}export{w as a,v as b,P as c,x as d};
|
|
@@ -0,0 +1,25 @@
|
|
|
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{Bc as Dn,Da as In,Dc as Nn,Gc as jn,Ha as ft,I as Vn,Ja as Cn,Ua as _n,Vc as Gn,Wb as Ln,id as Wn,nd as Fe,od as pt,qc as Hn}from"./chunk.WLPTY4BF.js";import{a as We,b as C}from"./chunk.AJZBJBMO.js";var ao=We(w=>{"use strict";var bt=Symbol.for("react.transitional.element"),Ar=Symbol.for("react.portal"),kr=Symbol.for("react.fragment"),Pr=Symbol.for("react.strict_mode"),Rr=Symbol.for("react.profiler"),Tr=Symbol.for("react.consumer"),Mr=Symbol.for("react.context"),Or=Symbol.for("react.forward_ref"),Vr=Symbol.for("react.suspense"),Ir=Symbol.for("react.memo"),to=Symbol.for("react.lazy"),Cr=Symbol.for("react.activity"),Xn=Symbol.iterator;function _r(e){return e===null||typeof e!="object"?null:(e=Xn&&e[Xn]||e["@@iterator"],typeof e=="function"?e:null)}var no={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},oo=Object.assign,ro={};function ge(e,t,n){this.props=e,this.context=t,this.refs=ro,this.updater=n||no}ge.prototype.isReactComponent={};ge.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ge.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function io(){}io.prototype=ge.prototype;function xt(e,t,n){this.props=e,this.context=t,this.refs=ro,this.updater=n||no}var Et=xt.prototype=new io;Et.constructor=xt;oo(Et,ge.prototype);Et.isPureReactComponent=!0;var Jn=Array.isArray;function vt(){}var O={H:null,A:null,T:null,S:null},so=Object.prototype.hasOwnProperty;function At(e,t,n){var o=n.ref;return{$$typeof:bt,type:e,key:t,ref:o!==void 0?o:null,props:n}}function Lr(e,t){return At(e.type,t,e.props)}function kt(e){return typeof e=="object"&&e!==null&&e.$$typeof===bt}function Hr(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Qn=/\/+/g;function wt(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Hr(""+e.key):t.toString(36)}function Dr(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(vt,vt):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function me(e,t,n,o,r){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(i){case"bigint":case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case bt:case Ar:s=!0;break;case to:return s=e._init,me(s(e._payload),t,n,o,r)}}if(s)return r=r(e),s=o===""?"."+wt(e,0):o,Jn(r)?(n="",s!=null&&(n=s.replace(Qn,"$&/")+"/"),me(r,t,n,"",function(u){return u})):r!=null&&(kt(r)&&(r=Lr(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(Qn,"$&/")+"/")+s)),t.push(r)),1;s=0;var d=o===""?".":o+":";if(Jn(e))for(var a=0;a<e.length;a++)o=e[a],i=d+wt(o,a),s+=me(o,t,n,i,r);else if(a=_r(e),typeof a=="function")for(e=a.call(e),a=0;!(o=e.next()).done;)o=o.value,i=d+wt(o,a++),s+=me(o,t,n,i,r);else if(i==="object"){if(typeof e.then=="function")return me(Dr(e),t,n,o,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return s}function Xe(e,t,n){if(e==null)return e;var o=[],r=0;return me(e,o,"","",function(i){return t.call(n,i,r++)}),o}function Nr(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var eo=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},jr={map:Xe,forEach:function(e,t,n){Xe(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Xe(e,function(){t++}),t},toArray:function(e){return Xe(e,function(t){return t})||[]},only:function(e){if(!kt(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};w.Activity=Cr;w.Children=jr;w.Component=ge;w.Fragment=kr;w.Profiler=Rr;w.PureComponent=xt;w.StrictMode=Pr;w.Suspense=Vr;w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O;w.__COMPILER_RUNTIME={__proto__:null,c:function(e){return O.H.useMemoCache(e)}};w.cache=function(e){return function(){return e.apply(null,arguments)}};w.cacheSignal=function(){return null};w.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var o=oo({},e.props),r=e.key;if(t!=null)for(i in t.key!==void 0&&(r=""+t.key),t)!so.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(o[i]=t[i]);var i=arguments.length-2;if(i===1)o.children=n;else if(1<i){for(var s=Array(i),d=0;d<i;d++)s[d]=arguments[d+2];o.children=s}return At(e.type,r,o)};w.createContext=function(e){return e={$$typeof:Mr,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Tr,_context:e},e};w.createElement=function(e,t,n){var o,r={},i=null;if(t!=null)for(o in t.key!==void 0&&(i=""+t.key),t)so.call(t,o)&&o!=="key"&&o!=="__self"&&o!=="__source"&&(r[o]=t[o]);var s=arguments.length-2;if(s===1)r.children=n;else if(1<s){for(var d=Array(s),a=0;a<s;a++)d[a]=arguments[a+2];r.children=d}if(e&&e.defaultProps)for(o in s=e.defaultProps,s)r[o]===void 0&&(r[o]=s[o]);return At(e,i,r)};w.createRef=function(){return{current:null}};w.forwardRef=function(e){return{$$typeof:Or,render:e}};w.isValidElement=kt;w.lazy=function(e){return{$$typeof:to,_payload:{_status:-1,_result:e},_init:Nr}};w.memo=function(e,t){return{$$typeof:Ir,type:e,compare:t===void 0?null:t}};w.startTransition=function(e){var t=O.T,n={};O.T=n;try{var o=e(),r=O.S;r!==null&&r(n,o),typeof o=="object"&&o!==null&&typeof o.then=="function"&&o.then(vt,eo)}catch(i){eo(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),O.T=t}};w.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()};w.use=function(e){return O.H.use(e)};w.useActionState=function(e,t,n){return O.H.useActionState(e,t,n)};w.useCallback=function(e,t){return O.H.useCallback(e,t)};w.useContext=function(e){return O.H.useContext(e)};w.useDebugValue=function(){};w.useDeferredValue=function(e,t){return O.H.useDeferredValue(e,t)};w.useEffect=function(e,t){return O.H.useEffect(e,t)};w.useEffectEvent=function(e){return O.H.useEffectEvent(e)};w.useId=function(){return O.H.useId()};w.useImperativeHandle=function(e,t,n){return O.H.useImperativeHandle(e,t,n)};w.useInsertionEffect=function(e,t){return O.H.useInsertionEffect(e,t)};w.useLayoutEffect=function(e,t){return O.H.useLayoutEffect(e,t)};w.useMemo=function(e,t){return O.H.useMemo(e,t)};w.useOptimistic=function(e,t){return O.H.useOptimistic(e,t)};w.useReducer=function(e,t,n){return O.H.useReducer(e,t,n)};w.useRef=function(e){return O.H.useRef(e)};w.useState=function(e){return O.H.useState(e)};w.useSyncExternalStore=function(e,t,n){return O.H.useSyncExternalStore(e,t,n)};w.useTransition=function(){return O.H.useTransition()};w.version="19.2.8"});var N=We((gs,lo)=>{"use strict";lo.exports=ao()});var So=We(et=>{"use strict";var Zr=Symbol.for("react.transitional.element"),Xr=Symbol.for("react.fragment");function ho(e,t,n){var o=null;if(n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:Zr,type:e,key:o,ref:t!==void 0?t:null,props:n}}et.Fragment=Xr;et.jsx=ho;et.jsxs=ho});var Ce=We((As,wo)=>{"use strict";wo.exports=So()});function Ke(e){let t,n=!1,o,r,i=0;return()=>{if(n)return Promise.resolve(t);if(o)return o;let s=i>0&&r!==void 0?gr(r):e();i+=1;let d=s.then(a=>(t=a,n=!0,o=void 0,a),a=>{throw o=void 0,r??=hr(a),a});return o=d,d}}var Fn=0;function gr(e){return Fn+=1,import(`${e}${e.includes("?")?"&":"?"}retry=${Fn}`)}function hr(e,t=import.meta.url){let n=e instanceof Error?e.message:typeof e=="string"?e:"",o=/^(?:Failed to fetch|error loading) dynamically imported module: ([a-z]+:\/\/[^\s"'<>]+)/.exec(n)?.[1]?.replace(/[.,;:)\]]+$/,""),r=i=>i.split("/",3).join("/");return o&&r(o)===r(t)?o:void 0}var fe={focusId:null,relation:null,expanded:[],pins:{}},Be=e=>{let t=Number(e);return Number.isFinite(t)?t:null};function te(e){let t=new URLSearchParams;e.focusId&&t.set("focus",e.focusId),e.relation&&t.set("relation",e.relation),e.overview&&t.set("overview","1"),e.zoom&&t.set("zoom","1"),e.past&&t.set("past","1"),e.shown&&e.shown.length>0&&t.set("show",[...e.shown].sort().join(",")),e.selection!==void 0&&e.selection.length>0&&t.set("sel",[...e.selection].sort().join(",")),e.expanded.length>0&&t.set("expand",[...e.expanded].sort().join(","));for(let o of Object.keys(e.pins).sort()){let r=e.pins[o];t.set(`pin.${o}`,`${$e(r.x)},${$e(r.y)}`)}e.pan&&(e.pan.x!==0||e.pan.y!==0)&&t.set("pan",`${$e(e.pan.x)},${$e(e.pan.y)}`);for(let o of Object.keys(e.within??{}).sort()){let r=e.within[o];r.length>0&&t.set(`in.${o}`,r)}e.q&&e.q.trim().length>0&&t.set("q",e.q);let n=t.toString();return n?`#${n}`:"#"}function Sr(e){return e&&e.startsWith("agg:")?`aggregate:${e.slice(4)}`:e}function qe(e){let t=e.includes("#")?e.slice(e.indexOf("#")+1):e,n=new URLSearchParams(t),o=Object.create(null);for(let[h,p]of n){if(!h.startsWith("pin."))continue;let[g,b]=p.split(","),A=g===void 0?null:Be(g),m=b===void 0?null:Be(b);A===null||m===null||(o[h.slice(4)]={x:A,y:m})}let r=Object.create(null);for(let[h,p]of n)!h.startsWith("in.")||p.length===0||(r[h.slice(3)]=p);let i=n.get("view");i&&i.length>0&&r.view===void 0&&(r.view=i);let s=n.get("pan")?.split(",")??[],d=s[0]===void 0?null:Be(s[0]),a=s[1]===void 0?null:Be(s[1]),u=(n.get("sel")??"").split(",").filter(h=>h.length>0).sort(),f=n.get("overview")==="1";return{...u.length>0?{selection:u}:{},...f?{overview:!0}:{},...n.get("zoom")==="1"?{zoom:!0}:{},...n.get("past")==="1"?{past:!0}:{},...n.get("show")?{shown:[...new Set(n.get("show").split(",").filter(Boolean))].sort()}:{},...d!==null&&a!==null?{pan:{x:d,y:a}}:{},...Object.keys(r).length>0?{within:r}:{},...n.get("q")?.trim()?{q:n.get("q")}:{},focusId:Sr(n.get("focus")),relation:n.get("relation"),expanded:(n.get("expand")??"").split(",").filter(h=>h.length>0&&(f||!h.startsWith("kind:"))).sort(),pins:o}}function Qi(e){let t=qe(e);return te(t)==="#"?{...t,overview:!0}:t}function es(e){let t=te(e);return t==="#overview=1"?"":t}function $e(e){return Math.round(e*100)/100}function Bn(e,t){return te(e)===te(t)}var Kn="edge:";function $n(e){if(!e.startsWith(Kn))return null;let t=e.slice(Kn.length).split(":");if(t.length!==3)return null;let[n,o,r]=t;if(!n||!o||!r)return null;try{return{kind:decodeURIComponent(n),from:decodeURIComponent(o),to:decodeURIComponent(r)}}catch{return null}}function yt(e){let{pan:t,...n}=e;return{...n,pins:{}}}function $(e,t){if(t===e.focusId)return{...e,focusId:t};let n=yt(e);return{...n.within?.q!==void 0?se(n,"q",null):n,focusId:t}}function qn(e,t){return{...e,relation:t}}function se(e,t,n){let o={...e.within??{}};if(n===null?delete o[t]:o[t]=n,Object.keys(o).length===0){let{within:r,...i}=e;return i}return{...e,within:o}}function pe(e,t){if(t!==e.overview&&(e=yt(e)),!t){let n=e.expanded.filter(o=>!o.startsWith("kind:"));return{...e,overview:!1,expanded:n}}return{...e,overview:t}}function ze(e,t){if(t.length===0){let{selection:n,...o}=e;return o}return{...e,selection:[...t]}}function Ve(e,t){if(t!==(e.zoom===!0)&&(e=yt(e)),!t){let{zoom:n,...o}=e;return o}return{...e,zoom:!0}}function Ue(e,t){let n=new Set(e.expanded);return n.has(t)?n.delete(t):n.add(t),{...e,expanded:[...n].sort()}}var Ze="aggregate:",Ye="kind:";function mt(e){return`${Ye}${e}`}function ye(e){return e.startsWith(Ye)?e.slice(Ye.length):null}var os="kinds:beyond";function wr(e){let t=ye(e);return t?[t]:ae(e)}function ne(...e){return`${Ze}${[...e].sort().join("+")}`}function zn(e){return e.startsWith(Ze)}function ae(e){return!zn(e)||e.includes("|")?[]:e.slice(Ze.length).split("+").filter(Boolean)}function Un(e,t,n={}){let o=ye(t);if(o!==null&&e.overview&&n.ownPicture!==!0)return Ue(e,t);let r=o!==null?ne(o):t;if(e.zoom&&e.focusId===r&&!(o!==null&&n.carry))return Ve(e,!1);if(o!==null&&n.carry){let i=pe({...$(e,r),relation:null},!1);return se(Ve(i,!0),"q",n.carry)}return Ve({...$(e,r),relation:null},!0)}function vr(e,t,n){return se(pe($(e,ne(t)),!1),"view",n)}function rs(e,t){return e.id<t.id?-1:e.id>t.id?1:0}var Yn="aggregate:";function gt(e){return e.startsWith(Yn)&&e.includes("|")}var ht=e=>e?.off===!0,br=e=>e!==void 0&&!ht(e)&&(e.fast!==void 0||e.thinking!==void 0||e.answer!==void 0||e.decide!==void 0||e.complete!==void 0||e.turn!==void 0),Zn=e=>e!==void 0&&!ht(e)&&(e.fast!==void 0||e.decide!==void 0),xr=e=>e?.suggestOnOpen!==!1&&Zn(e),Er=e=>e?.hoverChips===!0&&Zn(e);var St={};var uo=C(N(),1),Gr={turns:[],outcomes:new Map,busy:!1,pending:null,draft:null,draftNote:null},co=e=>`graview:seat:${e}`;function Wr(e){if(!e)return{};try{let t=sessionStorage.getItem(e);if(!t)return{};let n=JSON.parse(t);return{...Array.isArray(n.turns)?{turns:n.turns}:{},...Array.isArray(n.outcomes)?{outcomes:new Map(n.outcomes)}:{},...n.draft?.drawn?{draft:n.draft}:{}}}catch{return{}}}function Fr(e,t){if(e)try{sessionStorage.setItem(e,JSON.stringify({turns:t.turns.slice(-40),outcomes:[...t.outcomes],draft:t.draft}))}catch{}}function Pt(e){let t=e===null?null:co(e),n={...Gr,...Wr(t)},o=new Set,r=(i,s=!0)=>{n=i,s&&Fr(t,n);for(let d of[...o])d()};return{get:()=>n,subscribe(i){return o.add(i),()=>void o.delete(i)},setTurns:i=>r({...n,turns:i(n.turns)}),settle:(i,s)=>r({...n,outcomes:new Map(n.outcomes).set(i,s)}),setBusy:i=>r({...n,busy:i},!1),ask:i=>r({...n,pending:i.trim()||null}),takePending(){let i=n.pending;return i!==null&&r({...n,pending:null},!1),i},setDraft:(i,s=null)=>r({...n,draft:i,draftNote:s})}}function Kr(e){return(0,uo.useSyncExternalStore)(e.subscribe,e.get,e.get)}var po=C(N(),1),Br={entries:[],ghost:null,loaded:!1};function fo(e,t){let n=new Map(e.map(o=>[o.id,o]));for(let o of t)n.set(o.id,{...n.get(o.id),...o});return[...n.values()].sort((o,r)=>o.at<r.at?1:o.at>r.at?-1:0)}function Rt(e){let t=Br,n=new Set,o=r=>{t=r;for(let i of[...n])i()};return{get:()=>t,subscribe:r=>(n.add(r),()=>n.delete(r)),record:r=>{o({...t,entries:fo(t.entries,[r])}),Promise.resolve(e()?.keep?.(r)).catch(i=>{console.warn("The host did not keep an AI interaction:",i)})},setGhost:r=>o({...t,ghost:r}),load:()=>{if(t.loaded)return;o({...t,loaded:!0});let r=e()?.load;r&&Promise.resolve(r()).then(i=>o({...t,entries:fo(t.entries,i)})).catch(i=>{console.warn("The host's AI interactions could not be read:",i)})}}}function $r(e){return(0,po.useSyncExternalStore)(e.subscribe,e.get,e.get)}function yo(e){return e?.closest?.("[data-graview-pick]")?.getAttribute("data-graview-pick")??null}var Je=C(N(),1),Qe=(0,Je.createContext)(void 0),qr=()=>(0,Je.useContext)(Qe);var k=C(N(),1),Ie=(0,k.createContext)(null);function go(){return(0,k.useContext)(Ie)}function zr(e,t){let n=go(),o=(0,k.useMemo)(()=>n?n.live.seenBy(t):e,[n,e,t]),r=(0,k.useRef)(0),i=(0,k.useCallback)(s=>o.subscribe(()=>{r.current+=1,s()}),[o]);return(0,k.useSyncExternalStore)(i,()=>r.current,()=>0),o}var Ur=Ke(()=>(__graviewPreload(import.meta.url,["./chunk.TI4OSTQV.js","./chunk.AJZBJBMO.js"]),import("./chunk.J2CR4RRH.js"))),mo,Yr=400;function Tt(e,t,n){let o=(0,k.useContext)(Ie),r=o!==null&&o.owns(e,t),[i,s]=(0,k.useState)(null),[d,a]=(0,k.useState)(mo);(0,k.useEffect)(()=>{if(d||r||i===null)return;let E=!0;return Ur().then(R=>{mo=R,E&&a(R)},()=>{}),()=>{E=!1}},[d,r,i]);let[u,f]=(0,k.useState)(0),h=(0,k.useMemo)(()=>r||i===null||i>=e.log.length||!d?void 0:d.askDeclaration(n,i),[r,e,i,n,d,u]),p=h&&"waiting"in h?h.waiting:void 0,[g,b]=(0,k.useState)(void 0);(0,k.useEffect)(()=>{if(!p)return;let E=!0,R=setTimeout(()=>E&&b(p),Yr);return p.then(()=>E&&f(I=>I+1)),()=>{E=!1,clearTimeout(R)}},[p]);let A=p!==void 0&&g!==p,m=(0,k.useMemo)(()=>{if(r||i===null||i>=e.log.length||!d||A)return null;try{let E=d.pastAt(e,i,n);return{seq:i,at:E.past?.at,store:E}}catch{return null}},[r,e,i,n,d,A,u]),v=(0,k.useRef)(null),y=A?v.current:m;(0,k.useEffect)(()=>{v.current=y},[y]);let x=(0,k.useCallback)(E=>s(E===null?null:E>=e.log.length?Number.POSITIVE_INFINITY:E),[e]),P=(0,k.useCallback)((E,R)=>[e,y?.store].some(I=>I!==void 0&&(I===E||I.seenBy(R)===E)),[e,y]),D=i!==null,L=(0,k.useMemo)(()=>({past:y,open:D,show:x,live:e,host:n,owns:P}),[y,D,x,e,n,P]);return r?o:L}var vo=e=>`graview:setting:${e}`;function bo(){return localStorage}function xo(e,t){try{let n=(t??bo()).getItem(vo(e.name));if(n!==null&&e.options.some(o=>o.value===n))return n}catch{}return e.initial}function Eo(e,t,n){try{(n??bo()).setItem(vo(e.name),t)}catch{}}function Ao(e,t){if(typeof document>"u")return;let n=document.documentElement;if(e.honored==="root-font-size"){n.style.fontSize=t===e.initial?"":t;return}let o=`graview${e.name.replace(/-([a-z0-9])/g,(r,i)=>i.toUpperCase()).replace(/^[a-z]/,r=>r.toUpperCase())}`;t===e.initial?delete n.dataset[o]:n.dataset[o]=t}var _=C(N(),1);function Mt(e){return Fe(e)}var Jr=12,Qr=4;function ei(e,t,n){let o=Mt(t);return e.get(o)??{participant:o,who:t.id??t.kind,at:null,mode:"docked",since:n,trail:[]}}var tt=(e,t)=>t===null||e[e.length-1]===t?e:[...e,t].slice(-Jr);function ko(e,t){let n=e.filter(r=>r.length>0);if(n.length===0)return null;if(n.length<=Qr)return n[0];let o=new Set(n.map(r=>t(r)).filter(r=>r!==void 0));return o.size===1?mt([...o][0]):n[0]}function Ot(e,t,n){let o=new Map(e);if(t.type==="rest"){for(let[s,d]of e)d.mode!=="asking"&&d.mode!=="docked"&&t.at-d.since>=t.holdMs&&o.set(s,{...d,mode:"docked",at:null,trail:[],say:void 0,confidence:void 0});return o}if(t.author.kind!=="agent")return o;let r=ei(e,t.author,t.at),i=s=>o.set(r.participant,{...r,...s,since:t.at});switch(t.type){case"read":{let s=ko(t.ids,n);return i({at:s,mode:"reading",trail:tt(r.trail,s)}),o}case"about-to-write":case"write":{let s=ko(t.ids,n);return i({at:s,mode:"writing",trail:tt(r.trail,s),say:void 0,confidence:void 0}),o}case"refused":return i({at:t.where,mode:"refused",say:t.say,confidence:void 0,trail:tt(r.trail,t.where)}),o;case"asking":return i({at:t.where??r.at,mode:"asking",say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},trail:tt(r.trail,t.where)}),o;case"said":return i({say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},...t.caption?{caption:t.caption}:{}}),o;case"over":return i({over:t.over}),o;case"home":return i({at:null,mode:"docked",trail:[],say:void 0,confidence:void 0,over:null}),o;default:return o}}var Po="graview:session";function Ro(e){let t=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);try{let n=e??sessionStorage,o=n.getItem(Po);if(o)return o;let r=t();return n.setItem(Po,r),r}catch{return t()}}var Vt={name:"share-where",title:"Where you are",description:"Whether the others here see which stop you are on.",honored:"root-attribute",options:[{value:"shared",label:"Shown"},{value:"private",label:"Hidden"}],initial:"shared"},It={name:"share-over",title:"What you point at",description:"Whether the others see the thing under your pointer, outlined in your color.",honored:"root-attribute",options:[{value:"private",label:"Kept to yourself"},{value:"shared",label:"Outlined for others"}],initial:"private"},To=[Vt,It],ni=800;function Mo(e){let{channel:t,store:n,view:o,principal:r,session:i,robots:s,seatWho:d,settingValues:a,setView:u,ttlMs:f=1e4,people:h,seats:p}=e,[g,b]=(0,_.useState)(()=>new Map),[A,m]=(0,_.useState)(null),[v,y]=(0,_.useState)(null),[x,P]=(0,_.useState)(null),D=typeof r.id=="string"&&r.id.length>0,L=D&&(a[Vt.name]??Vt.initial)==="shared",E=L&&(a[It.name]??It.initial)==="shared",R=Mt({kind:r.kind,...r.id?{id:r.id}:{},session:i}),I=D?_n(r,{graph:n.graph,schema:n.schema,...p?{seats:p}:{},...h?{people:h}:{}}):"",G=d?s.get(`agent:${d}:${i}`):void 0,W=(0,_.useMemo)(()=>!t||!L?null:{participant:R,kind:r.kind,name:I,...r.onBehalfOf?.id?{onBehalfOf:r.onBehalfOf.id,...r.onBehalfOf.name?{onBehalfOfName:r.onBehalfOf.name}:{}}:{},hue:Ln(r.id??"nobody"),stop:x??te(o),...E?{over:A}:{},...G?{robot:{at:G.at,mode:G.mode}}:{},at:new Date().toISOString()},[t,L,E,R,I,r.id,r.kind,r.onBehalfOf?.id,r.onBehalfOf?.name,o,x,A,G?.at,G?.mode]);(0,_.useEffect)(()=>{if(!t||!W)return;t.here(W);let V=setInterval(()=>t.here({...W,at:new Date().toISOString()}),ni);return()=>clearInterval(V)},[t,W]),(0,_.useEffect)(()=>t?t.onWho(K=>b(pt(new Map,K,Date.now(),f))):void 0,[t,f]);let Z=g.size>0;(0,_.useEffect)(()=>{if(!Z)return;let V=setInterval(()=>{b(K=>{let Q=pt(K,[],Date.now(),f);return Q.size===K.size?K:Q})},Math.max(250,Math.min(1e3,f/4)));return()=>clearInterval(V)},[Z,f]),(0,_.useEffect)(()=>{if(!t||typeof window>"u")return;let V=()=>t.leave();return window.addEventListener("pagehide",V),()=>window.removeEventListener("pagehide",V)},[t]),(0,_.useEffect)(()=>{if(!E||typeof document>"u")return;let V=null,K=Q=>{let Ee=yo(Q.target);Ee!==V&&(V=Ee,m(Ee))};return document.addEventListener("pointermove",K,{passive:!0}),()=>document.removeEventListener("pointermove",K)},[E]);let X=(0,_.useRef)(null),q=v?g.get(v)??null:null,de=(0,_.useCallback)(V=>{X.current=null,y(V)},[]);return(0,_.useEffect)(()=>{if(v){if(!q){y(null);return}q.stop!==X.current?.stop&&(X.current={stop:q.stop,at:Date.now()},u(qe(q.stop)))}},[v,q,u]),(0,_.useEffect)(()=>{let V=X.current;!v||V===null||Date.now()-V.at<400||Bn(o,qe(V.stop))||y(null)},[o,v]),(0,_.useEffect)(()=>{if(!v||typeof document>"u")return;let V=K=>{K.key==="Escape"&&y(null)};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[v]),(0,_.useMemo)(()=>({who:g,sharing:W?{participant:R,name:I}:null,following:q,follow:de,sayWhere:P}),[g,W,R,I,q,de])}var U=C(N(),1);function Oo(e){return Fe(e.author)}function oi(e,t){return e.length>1?"co-edited":t==="rule"?"rule":t==="agent"?"autonomous":"directed"}function Vo(e,t,n,o,r){let i=new Map;for(let[a,u]of e)o-u.at<r&&i.set(a,u);let s=new Set(n.flatMap(a=>a.nodeIds)),d=(a,u,f)=>{let h=i.get(a),p=h?.participants.includes(Oo(u))?h.participants:[...h?.participants??[],Oo(u)];i.set(a,{at:o,manner:oi(p,u.author.kind),intent:u.intent,wrote:(h?.wrote??!1)||(f.wrote??!1),read:(h?.read??!1)||(f.read??!1),broke:(h?.broke??!1)||s.has(a),participants:p})};for(let a of t){for(let u of a.writes)d(u,a,{wrote:!0});for(let u of a.reads)a.writes.includes(u)||d(u,a,{read:!0})}for(let a of n)for(let u of a.nodeIds){let f=i.get(u);i.set(u,{at:o,manner:f?.manner??"rule",intent:f?.intent??a.message,wrote:f?.wrote??!1,read:f?.read??!1,broke:!0,participants:f?.participants??["rule::"]})}return i}var ri=2600;function Io(e,t=ri){let[n,o]=(0,U.useState)(()=>new Map),r=(0,U.useRef)(n);r.current=n;let i=(0,U.useRef)(null),s=(0,U.useCallback)(a=>{r.current=a,o(a),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{r.current=new Map,o(new Map)},t)},[t]);(0,U.useEffect)(()=>{let a=e.violations(),u=e.subscribe((f,h)=>{let p=e.violations(),g=jn(e.allInvariants(),a,p).introduces;a=p,s(Vo(r.current,h,g.map(b=>({nodeIds:b.nodeIds,message:b.message})),Date.now(),t))});return()=>{u(),i.current&&clearTimeout(i.current)}},[e,t,s]);let d=(0,U.useCallback)(a=>{a.reads.length!==0&&s(Vo(r.current,[ii(a)],[],Date.now(),t))},[t,s]);return{activity:n,noteAttention:d}}function ii(e){return{id:`attention:${e.intent}`,seq:-1,batch:"attention",author:e.author,intent:e.intent,mutation:null,primitives:[],inverse:[],reads:e.reads,writes:[],at:new Date().toISOString()}}var l=C(N(),1);function Co(){let e=null,t=new Set,n=new Set,o=r=>{for(let i of n)i(r)};return{subscribe(r){return t.add(r),t.size===1&&o(!0),()=>{t.delete(r),t.size===0&&(e=null,o(!1))}},snapshot:()=>e,set(r){if(!(e===r||e&&r&&e.x===r.x&&e.y===r.y)){e=r;for(let i of t)i()}},get listeners(){return t.size},onActive(r){return n.add(r),()=>void n.delete(r)}}}var nt=C(N(),1),si=e=>e.definitions.some(t=>In(t).size>0);function _o(e,t,n){let[o,r]=(0,nt.useState)(void 0),i=(n.roles??[]).join("\0");return(0,nt.useEffect)(()=>{if(!t||!si(e.schema)){r(void 0);return}let s=!0,d=!1,a=e.graph,u=()=>{d||(d=!0,queueMicrotask(()=>{d=!1,s&&e.reread()}))},f=Cn(t,{kind:n.kind,...n.id===void 0?{}:{id:n.id},...n.roles?{roles:n.roles}:{}},u);return ft(a,f.read),r(f),e.reread(),()=>{s=!1,ft(a,void 0)}},[e,t,n.kind,n.id,i]),o}function Lo(){let e=!1,t=new Set;return{moving:()=>e,set(n){if(n!==e){e=n;for(let o of t)o()}},subscribe(n){return t.add(n),()=>t.delete(n)}}}var le=C(Ce(),1),ai="graview:place-menu",_e=(0,l.createContext)(null),jo=(0,l.createContext)("scene");function li({mode:e,children:t}){return(0,le.jsx)(jo.Provider,{value:e,children:t})}function di(){return(0,l.useContext)(jo)}var Go={kind:"human"},ui=[],ci=[],fi=[],Ct=[];function Wo(e,t){let n=(0,l.useId)();(0,l.useEffect)(()=>{if(!globalThis.__graviewWatch)return;let o=t??Go,r=()=>Nn(e,o,n);r();let i,s=e.subscribe(()=>{clearTimeout(i),i=setTimeout(r,250)});return()=>{clearTimeout(i),s(),globalThis.__graviewWatch?.unseen?.({words:[],from:n,gone:!0})}},[e,t,n])}var pi={off:!0};function yi({store:e,views:t,initialView:n,scheme:o="dark",initialSelection:r,principal:i,seats:s=ui,onSeat:d,people:a=ci,memory:u,presenceTtlMs:f,app:h,settings:p=h?.settings??fi,presence:g,brand:b,locale:A,timeZone:m,onKeepLens:v,providers:y,ai:x,files:P,resolveApp:D,history:L,linkedRecords:E,menuSections:R,keptViews:I,subscriptions:G,signIn:W,view:Z,onViewChange:X,children:q}){let de=(0,l.useContext)(_e),V=R??de?.menuSections,K=W??de?.signIn,Q=I??de?.keptViews,[Ee,or]=(0,l.useState)(null),ue=Ee??i??s[0]?.principal??Go,He=Tt(e,ue,L),Yt=He.past&&He.live===e?He.past.store:e,H=(0,l.useMemo)(()=>Yt.seenBy(ue),[Yt,ue]);Wo(e,ue);let[re]=(0,l.useState)(()=>Ro(u)),[Zt,rr]=(0,l.useState)(!1),Xt=(0,l.useCallback)(()=>rr(!0),[]),ie=(0,l.useMemo)(()=>g?[...p,...To]:p,[p,g]),[at]=(0,l.useState)(()=>n??Dt(t,e.schema)),[ir,Jt]=(0,l.useState)(()=>ze(at??fe,r??at?.selection??[])),Ae=(0,l.useRef)(at??fe).current,[Qt,sr]=(0,l.useState)(null),[en,ar]=(0,l.useState)(null),J=(0,l.useContext)(_e),[tn]=(0,l.useState)(()=>J?.seatTalk??Pt(b?.name??e.schema.kinds.join(","))),lt=x??J?.ai??St,De=(0,l.useMemo)(()=>lt.off?pi:lt,[lt]),nn=(0,l.useRef)(De.interactions);nn.current=De.interactions;let[on]=(0,l.useState)(()=>J?.aiDesk??Rt(()=>nn.current)),[lr]=(0,l.useState)(()=>J?.subscriptions??Dn()),rn=G??J?.subscriptions??lr,dt=v??J?.onKeepLens,Ne=h??J?.app,je=A??J?.locale,dr=b?.locale??Ne?.brand?.locale,Ge=m??J?.timeZone;Vn({reader:je,app:dr,readerTimeZone:Ge,appTimeZone:b?.timeZone??Ne?.brand?.timeZone});let sn=(0,l.useRef)(null),an=(0,l.useCallback)(c=>{sn.current=c},[]),ln=(0,l.useCallback)(c=>sn.current?.whereIs(c)??null,[]),[dn]=(0,l.useState)(()=>Co()),[un]=(0,l.useState)(()=>Lo()),[ut,ur]=(0,l.useState)(null),[ke,cn]=(0,l.useState)(()=>new Map),Pe=(0,l.useRef)(ke);Pe.current=ke;let Re=(0,l.useRef)(null),ct=(0,l.useCallback)(c=>H.graph.getNode(c)?.kind,[H]),ee=(0,l.useCallback)(c=>{let S=Ot(Pe.current,c,ct);Pe.current=S,cn(S),Re.current&&clearTimeout(Re.current),[...S.values()].some(M=>M.mode!=="docked"&&M.mode!=="asking")&&(Re.current=setTimeout(()=>{let M=Ot(Pe.current,{type:"rest",at:Date.now(),holdMs:Ht},ct);Pe.current=M,cn(M)},Ht+20))},[ct]),fn=(0,l.useCallback)(c=>ee({...c,at:c.at??Date.now()}),[ee]),pn=(0,l.useCallback)(c=>{ur(c),c&&ee({type:"home",author:{kind:"agent",id:c,session:re},at:Date.now()})},[ee,re]);(0,l.useEffect)(()=>H.subscribe((c,S)=>{for(let T of S)T.author.kind==="agent"&&ee({type:"write",author:T.author,ids:T.writes,at:Date.now()})}),[H,ee]),(0,l.useEffect)(()=>()=>{Re.current&&clearTimeout(Re.current)},[]);let z=(0,l.useMemo)(()=>({...ue,session:re}),[ue,re]),yn=_o(H,E,z),mn=(0,l.useCallback)(c=>{or(c),d?.(c)},[d]),[Te,cr]=(0,l.useState)(()=>Object.fromEntries(ie.map(c=>[c.name,xo(c,u)])));(0,l.useEffect)(()=>{for(let c of ie)Ao(c,Te[c.name]??c.initial)},[ie,Te]);let gn=(0,l.useCallback)((c,S)=>{let T=ie.find(M=>M.name===c);!T||!T.options.some(M=>M.value===S)||(Eo(T,S,u),cr(M=>({...M,[c]:S})))},[ie,u]),[hn,fr]=(0,l.useState)(null),{activity:Sn,noteAttention:wn}=Io(H),vn=(0,l.useCallback)(c=>{wn(c),ee({type:"read",author:c.author,ids:c.reads,at:Date.now()})},[wn,ee]),ce=(0,l.useCallback)(c=>{if(ye(c)!==null||ae(c).length>0||gt(c))return!0;let S=$n(c);return S?H.graph.allEdges().some(T=>T.kind===S.kind&&T.from===S.from&&T.to===S.to):H.graph.getNode(c)!==void 0},[H]),bn=(0,l.useCallback)(c=>{let S=c.selection??Ct,T=S.filter(ce),M=T.length===S.length?c:ze(c,T);return M.focusId!==null&&!ce(M.focusId)&&(M=$(M,null)),M},[ce]),Me=(0,l.useCallback)(c=>{let S=bn(c),T=No(H,z,S.shown);if(S.focusId!==null&&T.size>0){let M=ae(S.focusId),On=H.graph.getNode(S.focusId);(M.length>0?M.every(mr=>T.has(mr)):On?T.has(On.kind):!1)&&(S={...S,focusId:null})}if(!S.overview&&S.focusId===null){let M=Ae.focusId!==null&&!ce(Ae.focusId)?Dt(t,e.schema)??{...fe,overview:!0}:Ae;M.focusId!==null&&ce(M.focusId)?S={...S,focusId:M.focusId}:M.overview===!0&&(S={...S,overview:!0})}return S},[bn,ce,H,Ae,z,t,e.schema]),B=Me(Z??ir),xn=(0,l.useMemo)(()=>No(H,z,B.shown),[H,z,B.shown]),En=(0,l.useMemo)(()=>[...H.modules.administered.entries()].map(([c,S])=>{let T=H.mayAdminister(c,z);return{name:c,...S.description?{description:S.description}:{},kinds:S.kinds??[],canShow:T,shown:T&&(B.shown??[]).includes(c)}}),[H,z,B.shown]),Oe=(0,l.useCallback)(c=>{let S=T=>Me(typeof c=="function"?c(T):c);if(Z!==void 0){X?.(S(Z));return}X&&X(S(B)),Jt(T=>S(T))},[B,X,Z,Me]);(0,l.useEffect)(()=>{Z===void 0&&Jt(c=>{let S=Me(c);return S===c?c:S})},[B,Z,Me]);let An=B.selection??Ct,kn=(0,l.useCallback)(c=>{Oe(S=>ze(S,typeof c=="function"?c(S.selection??Ct):c))},[Oe]),{who:Pn,following:Rn,follow:Tn,sayWhere:pr,sharing:Mn}=Mo({channel:g,store:H,view:B,principal:z,session:re,robots:ke,seatWho:ut,settingValues:Te,setView:Oe,seats:s,people:a,...f!==void 0?{ttlMs:f}:{}}),yr=(0,l.useMemo)(()=>({store:H,scheme:o,views:t,view:B,setView:Oe,homeView:Ae,selection:An,setSelection:kn,menuAt:Qt,setMenuAt:sr,whereIs:ln,pointer:dn,motion:un,registerScene:an,robots:ke,noteSeat:fn,seatWho:ut,registerSeatWho:pn,actsDoor:en,registerActsDoor:ar,seatTalk:tn,aiDesk:on,...u?{memory:u}:{},who:Pn,following:Rn,follow:Tn,sayWhere:pr,sharing:Mn,session:re,ai:De,resolveApp:D,linkedRecords:E,menuSections:V,...Q?{keptViews:Q}:{},subscriptions:rn,signIn:K,linkedReads:yn,movedByHand:Zt,noteMoved:Xt,emphasis:hn,setEmphasis:fr,activity:Sn,noteAttention:vn,principal:z,seats:s,people:a,takeSeat:mn,settings:ie,settingValues:Te,chooseSetting:gn,hiddenKinds:xn,administered:En,...y?{providers:y}:{},...b?{brand:b}:{},...dt?{onKeepLens:dt}:{},app:Ne,...je?{locale:je}:{},...Ge?{timeZone:Ge}:{}}),[H,o,t,B,Oe,An,kn,Qt,ln,dn,un,an,ke,fn,ut,pn,en,tn,on,u,Pn,Rn,Tn,Mn,re,De,D,E,V,Q,rn,K,yn,Zt,Xt,hn,Sn,vn,z,s,a,mn,ie,Te,gn,xn,En,y,b,dt,Ne,je,Ge]);return(0,le.jsx)(_e.Provider,{value:yr,children:(0,le.jsx)(Ie.Provider,{value:He,children:(0,le.jsx)(wi,{children:P?(0,le.jsx)(Qe.Provider,{value:P,children:q}):q})})})}var Fo=(0,l.createContext)(null),_t,Lt=new Set,mi=e=>(Lt.add(e),()=>void Lt.delete(e)),Ho=()=>_t;function gi(e){if(!_t){_t=e;for(let t of[...Lt])t()}}var hi=300;function Si(e){let t=0;return async(n,o)=>{let r=++t;return await new Promise(i=>setTimeout(i,hi)),r===t?e(n,o):[]}}function wi({children:e}){let{store:t,view:n,views:o,principal:r,hiddenKinds:i,selection:s,ai:d}=oe(),a=ot(),u=n.q,f=n.focusId,h=!!(u&&u.trim().length>0),p=(0,l.useSyncExternalStore)(mi,Ho,Ho),g=(0,l.useMemo)(()=>h&&p?{flagged:new Set(t.violations().flatMap(x=>x.nodeIds)),touched:p.touchWeights(t.log.all())}:null,[t,a,h,p]),b=f?t.graph.getNode(f)?.kind??ye(f)??(ae(f).length===1?ae(f)[0]:void 0):void 0,A=(0,l.useMemo)(()=>d.near&&Si(d.near),[d.near]),m=(0,l.useMemo)(()=>!u||!g||!p?null:p.search(t,u,{...b?{inKind:b}:{},principal:r,places:o.places(),kinds:t.schema.kinds.filter(x=>!i.has(x)),from:[...s,...f&&t.graph.has(f)?[f]:[]],flagged:g.flagged,touched:g.touched,limit:200,rank:A}),[t,u,r,o,i,s,f,b,g,A]),[v,y]=(0,l.useState)();return(0,l.useEffect)(()=>void m?.later?.then(x=>y([m,x])),[m]),(0,le.jsx)(Fo.Provider,{value:v?.[0]===m?v[1]:m,children:e})}var Do=new WeakMap;function ea(e){let t=Do.get(e);return t||Do.set(e,t=new Set(e.matched)),t}function vi(){return(0,l.useContext)(Fo)}function oe(){let e=(0,l.useContext)(_e);if(!e)throw new Error("useGraview must be used inside a <GraviewProvider>.");return e}function Nt(){return(0,l.useContext)(_e)??null}function ot(){let{store:e}=oe(),t=(0,l.useRef)(null),n=(0,l.useRef)(null),o=(0,l.useCallback)(()=>(n.current!==e&&(n.current=e,t.current=null),t.current??=e.graph.allNodes(),t.current),[e]),r=(0,l.useCallback)(i=>e.subscribe(()=>{t.current=null,i()}),[e]);return(0,l.useSyncExternalStore)(r,o,o)}function bi(e){let{store:t}=oe(),n=(0,l.useCallback)(r=>t.subscribe(r),[t]),o=(0,l.useCallback)(()=>e===null?void 0:t.graph.getNode(e),[t,e]);return(0,l.useSyncExternalStore)(n,o,o)}function No(e,t,n){let o=new Set(e.modules.disabledKinds);for(let r of e.kindsKeptFrom(t))o.add(r);for(let[r,i]of e.modules.administered)if(!(e.mayAdminister(r,t)&&(n??[]).includes(r)))for(let s of i.kinds??[])o.add(s);return o}var Ht=2600;var Ko=new WeakSet,xi=e=>Ko.has(e),Ei=e=>void Ko.add(e);function Dt(e,t){let n=Wn(e.arrangement?.()?.first,t,e.places());if(!(!n||n.to==="home"))return n.to==="place"?{...fe,focusId:ne(n.place.kind),within:{view:n.place.as}}:{...fe,focusId:ne(n.kind)}}var Bo=C(N(),1),Ai=(0,Bo.createContext)(!1);var rt=Symbol.for("graview.default-view");function $o(e){return Object.defineProperty(e,rt,{value:!0,enumerable:!1}),e}function qo(e){return typeof e=="function"&&e[rt]===!0}var jt=Symbol.for("graview.replaces-page");function zo(e){return typeof e=="function"&&e[jt]===!0}function Pi(e){return Gn(e)}function Ri(e,t){if(t===e)return e;for(let r of t.registrations())e.register(r.kind,r,r.view,r);let n=t.arrangement?.();n&&e.arrange?.(n);let o=t.homeView?.();return o&&e.home?.(o),e}var F=C(N(),1),Y=C(Ce(),1),Gt=new Set,Uo=!1;function Wt(){for(let e of[...Gt])e()}function Ti(){Uo||typeof window>"u"||(Uo=!0,window.addEventListener("online",Wt))}function Ft(e){let t,n=!1,o=!1,r,i=0,s=new Set,d=()=>{i+=1;for(let p of[...s])p()},a=p=>(s.add(p),()=>void s.delete(p)),u=()=>i,f=()=>void h().catch(()=>{});function h(){if(n)return Promise.resolve(t);if(r)return r;let p=e().then(g=>(t=g,n=!0,o=!1,r=void 0,Gt.delete(f),d(),g),g=>{throw r=void 0,o=!0,Gt.add(f),Ti(),d(),g});return p.catch(()=>{}),r=p,p}return{load:h,prefetch:f,get current(){return t},get failed(){return o},part(p,g={}){let b=g.what??"This part";function A(y){(0,F.useSyncExternalStore)(a,u,u);let x=(0,F.useRef)(null),P=(0,F.useRef)(null),D=(0,F.useRef)(!1);return(0,F.useEffect)(()=>{o&&r===void 0&&f()},[]),n&&typeof document<"u"&&x.current!==null&&document.activeElement===x.current&&(D.current=!0),(0,F.useLayoutEffect)(()=>{if(!(!n||!D.current)){D.current=!1;for(let L=P.current?.nextElementSibling??null;L!==null;L=L.nextElementSibling){let E=L.matches(Yo)?L:L.querySelector(Yo);if(E instanceof HTMLElement){E.focus();return}}}}),n?(0,Y.jsxs)(Y.Fragment,{children:[D.current?(0,Y.jsx)("span",{ref:P,hidden:!0}):null,p(t,y)]}):g.quiet?null:(0,Y.jsx)(Mi,{what:b,button:x,...g.as?{as:g.as}:{}})}let m=(0,F.lazy)(()=>h().then(()=>({default:A}),()=>({default:A})));function v(y){let[x]=(0,F.useState)(()=>n||o);return(0,F.createElement)(x?A:m,y)}return v}}}var Yo="button,a[href],input,select,textarea,[tabindex]:not([tabindex='-1'])";function Mi({what:e,button:t,as:n="p"}){let r=typeof navigator<"u"&&navigator.onLine===!1?`${e} will load when you're back online.`:`${e} didn't load.`;return(0,Y.jsxs)(n,{"data-testid":"lazy-part-missing",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:[(0,Y.jsx)("span",{role:"status",children:r})," ",(0,Y.jsx)("button",{ref:t,type:"button","data-testid":"lazy-part-retry",onClick:Wt,style:{font:"inherit",fontWeight:600,color:"var(--graview-ink)",background:"none",border:"1px solid var(--graview-edge)",borderRadius:6,padding:"2px 10px"},children:"Try again"})]})}var Se=C(N(),1);function Oi(){let{selection:e,setSelection:t}=oe();return(0,Se.useMemo)(()=>({selection:e,set:n=>t(n),clear:()=>t([]),toggle:n=>t(o=>o.includes(n)?o.filter(r=>r!==n):[...o,n]),isSelected:n=>e.includes(n)}),[e,t])}function Vi(){let{store:e}=oe(),t=ot();return(0,Se.useMemo)(()=>Ii(e),[e,t])}var Zo=new WeakMap;function Ii(e){let t=Zo.get(e);if(!t){let n={violations:null};e.subscribe(()=>{n.violations=null}),Zo.set(e,n),t=n}return t.violations??=e.violations(),t.violations}function Ci(){let{view:e,setView:t}=oe();return(0,Se.useMemo)(()=>({view:e,url:te(e),focus:n=>t(o=>$(o,n)),show:n=>t(o=>qn(o,n)),toggle:n=>t(o=>Ue(o,n)),go:n=>t(n)}),[e,t])}var he={at:0,depth:0,listeners:new Set,tell(){for(let e of this.listeners)e()}};typeof window<"u"&&window.addEventListener("popstate",e=>{let t=e.state;he.at=typeof t?.graview=="number"?t.graview:0,he.at>he.depth&&(he.depth=he.at),he.tell()});var j=C(N(),1),Bt={profile:{trigger:"profile-button",pane:"profile",opens:"press",focus:"into",drawn:["shell","embed"]},problems:{trigger:"standing",pane:"problems",opens:"press",focus:"into",drawn:["shell","embed"]},places:{trigger:"app-places-open",pane:"app-places",opens:"press",focus:"into",drawn:["embed"]},here:{trigger:"here-open",pane:"here-list",opens:"press",focus:"into",drawn:["shell","embed","pages"]},suggested:{trigger:"suggested-button",pane:"suggested",opens:"press",focus:"into",drawn:["shell","embed","pages"]},activity:{trigger:"activity-button",pane:"activity",opens:"press",focus:"into",drawn:["shell","embed","pages"]},find:{trigger:"find-box",pane:"find-strip",opens:"typing",focus:"stays",drawn:["shell"]},districts:{trigger:"beyond-more",pane:"beyond-list",opens:"press",focus:"into",drawn:["shell","embed"]},acts:{trigger:null,pane:"context-menu",opens:"context-menu",focus:"into",drawn:["shell","embed","pages"]},arrange:{trigger:"arrange-add",pane:"arrange-list",opens:"press",focus:"into",drawn:["pages"]},"studio-ask":{trigger:"studio-agent",pane:"studio-agent-panel",opens:"press",focus:"into",drawn:["studio"]}},_i={position:"fixed",inset:"auto",margin:0,zIndex:Hn("popover"),boxSizing:"border-box"},it=6,we=8,Li=e=>typeof e.showPopover=="function";function st(e){try{return e.matches(":popover-open")}catch{return!1}}function Hi(e){if(typeof e=="function"){let o=e();return o?{left:o.x,right:o.x,top:o.y,bottom:o.y}:null}let t=e.current;if(!t||!t.isConnected)return null;let n=t.getBoundingClientRect();return{left:n.left,right:n.right,top:n.top,bottom:n.bottom}}function $t(e,t,n={}){let o=Hi(t);if(!o)return;let r={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},i=e.dataset.graviewDesignedHeight??=e.style.maxHeight;e.style.maxHeight=i;let s=e.getBoundingClientRect(),d=r.height-o.bottom-it-we,a=o.top-it-we,u=s.height<=d||d>=a,f=Math.max(96,Math.floor(u?d:a)),h=Math.min(s.height,f);s.height>f&&(e.style.maxHeight=i?`min(${i}, ${f}px)`:`${f}px`);let p=s.width,g=n.align==="start"?o.left:o.right-p,b=typeof t=="function"?null:t.current?.closest("[data-graview-embed]")?.getBoundingClientRect();b&&p<=b.right-b.left&&(g<b.left?g=o.left+p<=b.right?o.left:b.left:g+p>b.right&&(g=o.right-p>=b.left?o.right-p:b.right-p));let A=p>=r.width-2*we?Math.max(0,(r.width-p)/2):Math.max(we,Math.min(g,r.width-we-p)),m=u?o.bottom+it:Math.max(we,o.top-it-h);e.style.left=`${Math.round(A)}px`,e.style.top=`${Math.round(m)}px`}function Xo(e,t,n,o={}){let r=o.align??"end";(0,j.useLayoutEffect)(()=>{let i=e.current;if(!t||!i)return;if(Li(i)&&!st(i))try{i.showPopover(),Ni()}catch{}let s=0,d=u=>{u?.target instanceof Node&&i.contains(u.target)||(cancelAnimationFrame(s),s=requestAnimationFrame(()=>$t(i,n,{align:r})))};$t(i,n,{align:r}),addEventListener("resize",d),addEventListener("scroll",d,!0);let a=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>d());return a?.observe(i),()=>{if(cancelAnimationFrame(s),removeEventListener("resize",d),removeEventListener("scroll",d,!0),a?.disconnect(),i.isConnected&&st(i))try{i.hidePopover()}catch{}}},[t,e,r])}var qt=new Set;function Di(e){return qt.add(e),()=>qt.delete(e)}function Ni(){for(let e of qt)if(!(!e.isConnected||!st(e)))try{e.hidePopover(),e.showPopover()}catch{}}var ve=null,ji='button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])';function Gi(e){for(let t of e.querySelectorAll(ji))if(t.closest("[hidden]")===null&&getComputedStyle(t).visibility!=="hidden")return t;return e}var Kt=()=>{let e=document.activeElement;return e===null||e===document.body};function Wi(e,t={}){let{at:n,returnTo:o,onOpenChange:r}=t,i=t.popover!==!1,[s,d]=(0,j.useState)(!1),a=t.open??s,u=(0,j.useRef)(null),f=(0,j.useRef)(null),h=(0,j.useCallback)(y=>{u.current=y},[]),p=(0,j.useCallback)(y=>{f.current=y},[]),g=`graview-popover-${(0,j.useId)().replace(/:/g,"")}`,b=(0,j.useRef)({onOpenChange:r,returnTo:o,controlled:t.open!==void 0});b.current={onOpenChange:r,returnTo:o,controlled:t.open!==void 0};let A=(0,j.useCallback)(y=>{b.current.controlled||d(y),b.current.onOpenChange?.(y)},[]),m=(0,j.useCallback)(()=>{(document.querySelector(`[aria-controls="${g}"]`)??u.current??b.current.returnTo?.()??null)?.focus({preventScroll:!0})},[g]),v=(0,j.useCallback)(y=>{let x=f.current,P=typeof document>"u"?null:document.activeElement,D=P===null||P===document.body||x!==null&&x.contains(P);A(!1),!(!y||!D)&&(m(),requestAnimationFrame(()=>{Kt()&&m()}))},[A,m]);return Xo(f,i&&a,n??u,t.align?{align:t.align}:{}),(0,j.useEffect)(()=>{if(!i||!a)return;let y={name:e,close:()=>v(!1)};if(ve&&ve.close!==y.close&&ve.close(),ve=y,Bt[e].focus==="into"){let R=f.current;R&&!R.contains(document.activeElement)&&Gi(R).focus({preventScroll:!0})}let x=R=>{R.key==="Escape"&&v(!0)},P=R=>{let I=R.target;if(!(I instanceof Node))return;let G=f.current;if(G?.contains(I)||u.current?.contains(I))return;let W=I instanceof Element?I.closest('[role="dialog"], [role="alertdialog"]'):null;W&&!(G&&W.contains(G))||(v(!1),Bt[e].focus==="into"&&requestAnimationFrame(()=>{(Kt()||G!==null&&G.contains(document.activeElement))&&m()}))},D=null,L=null,E=R=>{let I=R.target;if(!(I instanceof Element))return;let G=f.current,W=I.closest('[role="dialog"], [role="alertdialog"]');!W||G&&(G.contains(W)||W.contains(G))||(D=W,v(!1))};return document.addEventListener("keydown",x),document.addEventListener("pointerdown",P,!0),document.addEventListener("focusin",E),()=>{document.removeEventListener("keydown",x),document.removeEventListener("pointerdown",P,!0),document.removeEventListener("focusin",E);let R=D;R&&typeof MutationObserver<"u"&&(L?.disconnect(),L=new MutationObserver(()=>{R.isConnected||(L?.disconnect(),requestAnimationFrame(()=>{(Kt()||document.activeElement.closest("[hidden]")!==null)&&m()}))}),L.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>L?.disconnect(),10*6e4)),ve?.close===y.close&&(ve=null)}},[i,a,e,v,m]),{open:a,setOpen:y=>y?A(!0):v(!0),toggle:()=>a?v(!0):A(!0),trigger:{ref:h,"aria-expanded":a,"aria-controls":g,"data-graview-popover-trigger":e},pane:{ref:p,id:g,popover:"manual",tabIndex:-1,"data-graview-popover":e,"data-graview-overlay":""}}}var be=C(N(),1);var Jo=(0,be.createContext)(null);function Fi(){let e=(0,be.useContext)(Jo),t=Nt(),n=(o,r,i)=>t?.setView(s=>se(se(pe($(s,ne(o)),!1),"view",r),"filter",i?.filter??null));return(0,be.useMemo)(()=>e??{record:o=>{t&&(t.setView(r=>$(pe(r,!1),o)),t.setSelection([o]))},place:(o,r)=>{let i=t?.views.places().find(s=>s.as===o);i&&n(i.kind,i.as,r)},list:(o,r)=>n(o,null,r)},[e,t])}var xe=C(N(),1);var Ki=Ft(Ke(()=>(__graviewPreload(import.meta.url,["./chunk.MQ7FNHXG.js","./chunk.WLPTY4BF.js","./chunk.AJZBJBMO.js"]),import("./chunk.YAXZNQY6.js"))));function Bi(e,t,n){let o,r=!1,i=()=>{let{hidden:d,removed:a}=t.current();o||r||d.length+a.length===0||(o=()=>{},Ki.load().then(u=>{r||(o=u.watchTidied(e,t,n))},String))};i();let s=t.onChange?.(i);return()=>{r=!0,s?.(),o?.()}}function $i(e,t){let[n,o]=(0,xe.useState)();return(0,xe.useEffect)(()=>t?Bi(e,t,r=>o([e,r])):void 0,[e,t]),n?.[0]===e?n[1]:e}var Qo=C(N(),1),qi=(0,Qo.createContext)(!1);var er=C(N(),1),zi=(0,er.createContext)(null);var tr=C(N(),1),zt='button:not([disabled]), a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])',Ut=e=>e instanceof HTMLElement&&(e.matches(zt)||e.hasAttribute("tabindex")),Le=e=>typeof e.checkVisibility=="function"?e.checkVisibility():e.getClientRects().length>0;function Ui(e,t){let n=a=>a.replace(/["\\]/g,"\\$&"),o=t.getAttribute("data-testid"),r=t.getAttribute("data-graview-pick"),i=t.getAttribute("aria-label"),s=o?`[data-testid="${n(o)}"]`:r?`[data-graview-pick="${n(r)}"]`:i?`${t.tagName.toLowerCase()}[aria-label="${n(i)}"]`:null;if(!s)return null;let d=e.querySelector(s);return d&&Ut(d)&&Le(d)?d:null}var Yi=e=>e.isConnected&&Ut(e)&&!e.matches(":disabled")&&e instanceof HTMLElement&&Le(e);function nr(e,t){let n=t?Ui(e,t):null;if(n)return n;let o=e.querySelector("[data-graview-view][tabindex]");if(o&&Le(o))return o;for(let r of e.querySelectorAll(zt))if(Le(r))return r;return Ut(e)&&Le(e)?e:null}function Zi(e){(0,tr.useEffect)(()=>{let t=e.current;if(!t||typeof MutationObserver>"u")return;let n=[],o=m=>{let v=m.target;if(v instanceof Element){n=[];for(let y=v;y&&y!==t.parentElement;y=y.parentElement)n.push(y)}},r=!1,i=!1,s=t.ownerDocument,d=()=>!i&&s.defaultView!==null,a=(m,v)=>void setTimeout(()=>d()&&v(),m),u=m=>void requestAnimationFrame(()=>d()&&m()),f=m=>{if(r=!1,i)return;let v=s.activeElement;if(!(!(v===null||v===s.body||v===s.documentElement)||n.length===0)){if(Yi(n[0])){m&&n[0]instanceof HTMLElement&&n[0].focus({preventScroll:!0});return}for(let x of n.slice(1)){if(!x.isConnected)continue;let P=nr(x,n[0]);if(P){P.focus({preventScroll:!0}),n=[];return}}}},h=(m,v=Date.now()+2500)=>{a(100,()=>{f(m);let y=s.activeElement;(y===null||y===s.body||y===s.documentElement)&&n.length>0&&Date.now()<v&&h(m,v)})},p=()=>{r||n.length===0||(r=!0,a(60,()=>u(()=>{f(!1),h(!1)})))},g=m=>{if(!(m instanceof KeyboardEvent&&!["Enter"," ","Escape"].includes(m.key))){if(!(m instanceof KeyboardEvent)){let v=m.target instanceof Element?m.target.closest(zt):null,y=s.activeElement,x=y===null||y===s.body||y===s.documentElement;if(v&&x&&t.contains(v)){n=[];for(let P=v;P&&P!==t.parentElement;P=P.parentElement)n.push(P);a(150,()=>u(()=>{f(!1),h(!1)}));return}}!(m instanceof KeyboardEvent)&&!(m.target instanceof Node&&n[0]?.contains(m.target))||a(150,()=>u(()=>{f(!0),h(!0)}))}},b=new MutationObserver(()=>{n.length>0&&!n[0].isConnected&&p()}),A=m=>{m.relatedTarget===null&&p()};return t.addEventListener("focusin",o),t.addEventListener("focusout",A),t.addEventListener("click",g),t.addEventListener("keydown",g),b.observe(t,{childList:!0,subtree:!0}),()=>{i=!0,t.removeEventListener("focusin",o),t.removeEventListener("focusout",A),t.removeEventListener("click",g),t.removeEventListener("keydown",g),b.disconnect()}},[e])}export{Ke as a,fe as b,te as c,qe as d,Qi as e,es as f,Bn as g,Kn as h,$n as i,yt as j,$ as k,qn as l,se as m,pe as n,ze as o,Ve as p,Ue as q,Ze as r,mt as s,ye as t,os as u,wr as v,ne as w,zn as x,ae as y,Un as z,vr as A,rs as B,Yn as C,gt as D,br as E,xr as F,Er as G,N as H,Pt as I,Kr as J,$r as K,yo as L,Qe as M,qr as N,Ie as O,go as P,zr as Q,Tt as R,Ce as S,ai as T,li as U,di as V,Wo as W,yi as X,gi as Y,ea as Z,vi as _,oe as $,Nt as aa,ot as ba,bi as ca,xi as da,Ei as ea,Dt as fa,Jo as ga,Fi as ha,Ai as ia,$o as ja,qo as ka,zo as la,Pi as ma,Ri as na,Ft as oa,$i as pa,qi as qa,zi as ra,Oi as sa,Vi as ta,Ci as ua,he as va,Zi as wa,_i as xa,st as ya,Xo as za,Di as Aa,Wi as Ba};
|
|
2
|
+
/*! Bundled license information:
|
|
3
|
+
|
|
4
|
+
react/cjs/react.production.js:
|
|
5
|
+
(**
|
|
6
|
+
* @license React
|
|
7
|
+
* react.production.js
|
|
8
|
+
*
|
|
9
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
10
|
+
*
|
|
11
|
+
* This source code is licensed under the MIT license found in the
|
|
12
|
+
* LICENSE file in the root directory of this source tree.
|
|
13
|
+
*)
|
|
14
|
+
|
|
15
|
+
react/cjs/react-jsx-runtime.production.js:
|
|
16
|
+
(**
|
|
17
|
+
* @license React
|
|
18
|
+
* react-jsx-runtime.production.js
|
|
19
|
+
*
|
|
20
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
21
|
+
*
|
|
22
|
+
* This source code is licensed under the MIT license found in the
|
|
23
|
+
* LICENSE file in the root directory of this source tree.
|
|
24
|
+
*)
|
|
25
|
+
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk.WVUJXDXZ.js";import{i as x}from"./chunk.
|
|
1
|
+
import"./chunk.WVUJXDXZ.js";import{i as x}from"./chunk.2EJAIT33.js";import"./chunk.EUGWV3S6.js";import"./chunk.6XJP7F3I.js";import"./chunk.NPX7SPXM.js";import"./chunk.OE4QOBJF.js";import"./chunk.74RMHUCX.js";import"./chunk.GR5Q4HTW.js";import{Va as f,Xa as N,ba as S}from"./chunk.WLPTY4BF.js";import"./chunk.AJZBJBMO.js";var k=(n,r,t)=>({untrusted:!0,authoredBy:t.say(r),text:n});function O(n,r){let t;for(let[a,e]of Object.entries(n)){if(typeof e!="string"||a==="id"||a==="kind")continue;let o=r.fieldBy(n.id,a);o&&(t??={...n},t[a]=k(e,o,r))}return t??n}function L(n,r,t){let a=e=>{if(Array.isArray(e))return e.map(a);if(e!==null&&typeof e=="object"&&"id"in e&&"label"in e){let o=e,i=t.recordBy(o.id);return i?{...o,label:k(o.label,i,t)}:o}if(typeof e=="string"){let o=t.recordBy(n);return o?k(e,o,t):e}return e};return Object.fromEntries(Object.entries(r).map(([e,o])=>[e,a(o)]))}function $(n,r){return n.map(t=>{let a=r.recordBy(t.id);return a?{...t,label:k(t.label,a,r)}:t})}function D(n,r){return{...n,nodes:n.nodes.map(t=>O(t,r))}}var E=n=>(JSON.stringify(n)??"null").length,R=n=>typeof n=="number"&&Number.isFinite(n)&&n>0?Math.floor(n):0;function w(n,r,t,a,e,o=""){let i=n-r-t;return i>0?`and ${i} more ${e}: call ${a} with ${o}offset ${r+t} for the next page.`:void 0}var j=({line:n,...r})=>r;function T(n){let r;for(let[t,a]of Object.entries(n))typeof a!="string"||a.length<=600||(r??={...n},r[t]=`${a.slice(0,600)}\u2026 (cut at ${600} of ${a.length} characters)`);return r??n}function B(n,r,t,a){let e=Math.min(t,Math.max(0,n.length-r)),o=n.slice(r,r+e),i=a(o);for(;e>1&&E(i)>8e3;)e=Math.max(1,Math.floor(e*.75)),o=n.slice(r,r+e),i=a(o);return{page:o,answer:i}}function C(n,r){let t=JSON.stringify(r)??"null";if(t.length<=8e3)return r;let a=`This answer was ${t.length} characters, more than the ${8e3} one read answers, so it is cut. Ask ${n} for less, or use search_graph and get_node to read one thing.`;for(let e=8e3-a.length-40;;){let o={cut:a,partial:t.slice(0,e)},i=E(o)-8e3;if(i<=0)return o;e=Math.max(0,e-i-8)}}function I(n,r){let{matched:t,later:a,...e}=r,o=n.hits.filter(i=>i.about==="node").length;return n.total>o?{...e,more:`and ${n.total-o} more records match: narrow the words, or add kind:<kind>.`}:e}function P(n,r,t){let a=N(t.archived),e={nodes:n.graph.allNodes({archived:a}),edges:n.graph.allEdges({archived:"all"})},o=R(t.offset),i=e.nodes.length,{page:h,answer:u}=B(e.nodes,o,25,d=>{let g=new Set(d.map(s=>s.id)),l=new Set(d.map(s=>s.id)),c=w(i,o,d.length,"get_graph","nodes"),p=s=>l.has(s)||(a==="all"?n.graph.has(s):n.graph.has(s)&&f(n.graph.getNode(s))===a);return{...D({nodes:d.map(T),edges:e.edges.filter(s=>g.has(s.from)&&p(s.to))},r),total:i,...c?{more:c}:{}}});return{data:u,reads:h.map(d=>d.id)}}function U(n,r,t,a){let e=n.graph.getNode(t),o=R(a.offset),i=n.graph.outEdges(t),h=n.graph.inEdges(t),u=i.slice(o,o+20),d=h.slice(o,o+20),g=(s,A)=>{let m=n.graph.getNode(A);return{kind:s,id:A,label:m?S(n.schema.tryDefinition(m.kind),m):A,...f(m)?{archived:!0}:{}}},l=x(n.schema,n.graph,e),c=n.violations().filter(s=>s.nodeIds.includes(t)),p=[w(i.length,o,u.length,"get_node","links out",`id "${t}" and `),w(h.length,o,d.length,"get_node","links in",`id "${t}" and `),c.length>20?`and ${c.length-20} more problems: get_violations lists them.`:void 0].filter(Boolean);return{data:{node:O(T(e),r),...f(e)?{archived:!0}:{},...Object.keys(l.values).length>0?{computed:L(t,l.values,r)}:{},...Object.keys(l.refused).length>0?{uncomputed:l.refused}:{},out:$(u.map(s=>g(s.kind,s.to)),r),in:$(d.map(s=>g(s.kind,s.from)),r),violations:c.slice(0,20).map(j),...p.length>0?{more:p.join(" ")}:{}},reads:[t,...u.map(s=>s.to),...d.map(s=>s.from)]}}function F(n,r){let t=R(r.offset),{page:a,answer:e}=B(n,t,20,o=>{let i=w(n.length,t,o.length,"get_violations","problems");return{violations:o.map(j),total:n.length,...i?{more:i}:{}}});return{data:e,reads:[...new Set(a.flatMap(o=>o.nodeIds))]}}export{P as graphRead,U as nodeRead,I as searchRead,F as violationsRead,C as withinReadChars};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as $,Cb as M,D as h,G as E,K as N,L as S,M as W,O as R,P as I,T as p,da as D,ia as T,sa as j,tb as v,zb as O}from"./chunk.HBBVVALN.js";function z(e,n,t){let o=[...n?.creates??[],...n?.subject&&n.subject.kinds!=="*"?n.subject.kinds:[]];for(let r of o){let i=e.tryDefinition(r),u=i?.fields?.shape??{};if(!i||!(t in u))continue;let a=i.display?.format?.[t];return{label:i.display?.labels?.[t]??T(i,t),option:d=>a?a(d):D(d)}}return{label:T(void 0,t),option:r=>D(r)}}function K(e,n,t){if(t instanceof v){let o=n.find(i=>i.name===t.mutation);return`Not yet: ${t.issues.map(i=>{let u=i.path.length>0?z(e,o,String(i.path[0])).label:void 0;return u?`${u} \u2014 ${i.message.replace(/^./,a=>a.toLowerCase())}`:i.message}).join("; ")}.`}return t instanceof Error?t.message:String(t)}var x=864e5,X=/^(\d{4})-(\d{2})-(\d{2})/,g=e=>String(e).padStart(2,"0"),_=e=>new Date(e).toISOString().slice(0,10),m=e=>Date.UTC(+e.slice(0,4),+e.slice(5,7)-1,+e.slice(8,10)),b=(e,n)=>_(m(e)+n*x),C=e=>new Date(m(e)).getUTCDay();function l(e,n,t){if(!(n>=1&&n<=12&&t>=1&&t<=31))return;let o=`${String(e).padStart(4,"0")}-${g(n)}-${g(t)}`;return _(m(o))===o?o:void 0}function L(e=new Date){let n=S();return n?R(e.getTime(),n):{day:`${e.getFullYear()}-${g(e.getMonth()+1)}-${g(e.getDate())}`,minutes:e.getHours()*60+e.getMinutes()}}var w=e=>/T\d\d:\d\d(:[\d.]+)?(Z|[+-]\d\d:?\d\d)$/.test(e);function y(e){if(typeof e!="string")return;if(w(e)){let o=new Date(e);return Number.isNaN(o.getTime())?void 0:L(o)}let n=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!n||!l(Number(n[1]),Number(n[2]),Number(n[3])))return;let t=e.slice(0,10);return n[4]===void 0?{day:t}:{day:t,minutes:Number(n[4])*60+Number(n[5])}}function F(e,n){if(!n.time)return e.day;let t=e.minutes??9*60;if(!n.instant)return`${e.day}T${g(Math.floor(t/60))}:${g(t%60)}`;let o=S(),[,r,i,u]=X.exec(e.day);return(o?new Date(I(e.day,t,o)):new Date(Number(r),Number(i)-1,Number(u),Math.floor(t/60),t%60)).toISOString().replace(/\.\d{3}Z$/,"Z")}function V(e,n=new Date){let t=W(),o=t;try{o=new Intl.DateTimeFormat(e??h,{timeZoneName:"short",timeZone:t}).formatToParts(n).find(r=>r.type==="timeZoneName")?.value??t}catch{o=t}return{zone:t,short:o}}function q(e,n,t,o){let r=y(n);if(!r)return t;let i=e===void 0?void 0:y(e),u=t===void 0?void 0:y(t),a=d=>m(d.day)+(d.minutes??0)*6e4,c=(d,s)=>{let f=a(d)+s;return{day:_(f),...o.time?{minutes:Math.round(f%x/6e4)}:{}}};return i&&u?F(c(u,a(r)-a(i)),o):u&&a(u)>=a(r)?t:o.time?F(c(r,36e5),o):t}var J=/^(start|starts|startsAt|startsOn|startAt|begins|from|opens|checkIn)$/i,Q=/^(end|ends|endsAt|endsOn|endAt|until|to|finish|finishes|closes|through|checkOut)$/i;function ee(e,n={}){let t=(n.start&&e.includes(n.start)?n.start:void 0)??e.find(r=>J.test(r)),o=(n.end&&e.includes(n.end)?n.end:void 0)??e.find(r=>r!==t&&Q.test(r));return t&&o?{start:t,end:o}:void 0}var ne=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],te=["sun","mon","tue","wed","thu","fri","sat"],B="(jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|june?|july?|aug(?:ust)?|sept?(?:ember)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?)",U="(sun(?:day)?|mon(?:day)?|tue(?:s|sday)?|wed(?:nesday)?|thu(?:r|rs|rsday)?|fri(?:day)?|sat(?:urday)?)",re=e=>ne.indexOf(e.slice(0,3))+1,Y=e=>e===void 0?void 0:e.length===2?2e3+Number(e):Number(e);function oe(e){try{let n=new Intl.DateTimeFormat(e,{month:"numeric",day:"numeric"}).formatToParts(0).map(t=>t.type);return n.indexOf("month")<n.indexOf("day")}catch{return!0}}function ie(e){let n=(r,i)=>({minutes:i,rest:`${e.slice(0,r.index)} ${e.slice(r.index+r[0].length)}`}),t=/\b(noon|midday)\b/.exec(e);if(t)return n(t,12*60);if(t=/\bmidnight\b/.exec(e),t)return n(t,0);if(t=/\b(\d{1,2})(?::(\d{2}))?\s*([ap])\.?m?\.?(?=\s|$)/.exec(e),t){let r=Number(t[1]),i=Number(t[2]??0);return r<1||r>12||i>59?{rest:e,bad:!0}:n(t,(r%12+(t[3]==="p"?12:0))*60+i)}if(t=/\b(\d{1,2}):(\d{2})\b/.exec(e),t){let r=Number(t[1]),i=Number(t[2]);return r>23||i>59?{rest:e,bad:!0}:n(t,r*60+i)}if(t=/\bat\s+(\d{1,2})\b/.exec(e),t){let r=Number(t[1]);return r>23?{rest:e,bad:!0}:n(t,(r>=1&&r<=7?r+12:r)*60)}let o=/\b(morning|afternoon|evening|tonight)\b/.exec(e);return o?{minutes:{morning:9,afternoon:15,evening:18,tonight:20}[o[1]]*60,rest:o[1]==="tonight"?`${e.slice(0,o.index)} today ${e.slice(o.index+o[0].length)}`:`${e.slice(0,o.index)} ${e.slice(o.index+o[0].length)}`}:{rest:e}}function ue(e,n,t){let o=e.replace(/\b(on|at|the|of|this)\b/g," ").replace(/\s+/g," ").trim();if(o==="")return null;if(o==="today"||o==="now")return n;if(o==="tomorrow"||o==="tmrw"||o==="tmr")return b(n,1);if(o==="yesterday")return b(n,-1);if(o==="next week")return b(n,7);let r=/^in (\d{1,3}) (day|days|week|weeks)$/.exec(o);if(r)return b(n,Number(r[1])*(r[2].startsWith("week")?7:1));if(r=new RegExp(`^(next )?${U}$`).exec(o),r){let d=(te.indexOf(r[2].slice(0,3))-C(n)+7)%7;return b(n,r[1]&&d===0?7:d)}if(r=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(o),r)return l(Number(r[1]),Number(r[2]),Number(r[3]));let i=o.replace(new RegExp(`^${U} `),"");r=new RegExp(`^(\\d{1,2})(?:st|nd|rd|th)? ${B}(?: (\\d{4}))?$`).exec(i);let u=r?{date:r[1],month:r[2],year:r[3]}:void 0;r=new RegExp(`^${B} (\\d{1,2})(?:st|nd|rd|th)?(?: (\\d{4}))?$`).exec(i);let a=u??(r?{date:r[2],month:r[1],year:r[3]}:void 0);if(a)return Z(n,Y(a.year),re(a.month),Number(a.date));if(r=/^(\d{1,2})[/.-](\d{1,2})(?:[/.-](\d{2}|\d{4}))?$/.exec(i),r){let[c,d]=[Number(r[1]),Number(r[2])],[s,f]=oe(t)?[c,d]:[d,c];return Z(n,Y(r[3]),s,f)}}function Z(e,n,t,o){if(n!==void 0)return l(n,t,o);let r=Number(e.slice(0,4)),i=l(r,t,o);return i===void 0?l(r+1,t,o):m(e)-m(i)>183*x?l(r+1,t,o):i}function de(e,n){let t=e.trim();if(w(t)){let a=y(t);if(a)return n.time?a:{day:a.day}}let o=e.toLowerCase().replace(/,/g," ").replace(/(\d{4}-\d{2}-\d{2})t(\d\d:\d\d)(:\d\d(\.\d+)?)?/,"$1 $2").replace(/\s+/g," ").trim();if(o==="")return;let r=ie(o);if(r.bad)return;let i=ue(r.rest,n.today,n.locale??h);if(i===void 0||i===null&&r.minutes===void 0)return;let u=i??n.base?.day??n.today;return n.time?{day:u,minutes:r.minutes??n.base?.minutes??9*60}:{day:u}}var ae=e=>/^[A-Z]{3}$/.test(e??"");function P(e){let{format:n,unit:t,currency:o,locale:r}=e,i=ae(t),u=n==="money"||!n&&i,a=u?i?t:o:void 0;return{...u?{format:"money"}:n?{format:n}:{},...t&&!(u&&i)?{unit:t}:{},...a?{currency:a}:{},...r?{locale:r}:{}}}function Te(e){switch(e.format){case"money":return e.currency?`An amount of money in ${e.currency}: a plain number, 1250.5 for 1,250.50 ${e.currency}.`:"An amount of money, in no named currency: a plain number.";case"percent":return"A fraction said as a percent: 0.15 is 15%.";default:return e.unit?`A number of ${e.unit}.`:"A number."}}function H(e){let n=$(e)?.innerType;return n===void 0?e:H(n)}var se={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ce=e=>(e?._zod?.def?.checks??[]).map(n=>n._zod?.def).filter(n=>n!==void 0);function k(e){let n=H(e),t=$(n),o=t?.type,r=ce(n);if(o==="enum")return{type:"choice",options:Object.keys(t?.entries??{})};let i=j(n);if(i)return i==="image"?{type:"file",image:!0}:i==="video"?{type:"file",video:!0}:{type:"file"};if(o==="boolean")return{type:"boolean"};if(o==="array"){let u=k(t?.element);return u.type==="unknown"?{type:"unknown"}:{type:"several",of:u}}if(o==="number"){let u,a,c;for(let d of r){d.check==="multiple_of"&&typeof d.value=="number"?c=d.value:d.check==="number_format"&&(d.format==="safeint"||d.format==="int32"||d.format==="uint32")&&(c??=1);let s=d.check==="number_format"&&d.format?se[d.format]:void 0,f=s?s[0]:d.check==="greater_than"&&d.inclusive&&typeof d.value=="number"?d.value:void 0,A=s?s[1]:d.check==="less_than"&&d.inclusive&&typeof d.value=="number"?d.value:void 0;f!==void 0&&(u=u===void 0?f:Math.max(u,f)),A!==void 0&&(a=a===void 0?A:Math.min(a,A))}return{type:"number",...u===void 0?{}:{min:u},...a===void 0?{}:{max:a},...c===void 0?{}:{step:c},...M(n)==="duration"?{duration:!0}:{},...O(e)?{amount:P(O(e))}:{}}}if(o==="string"){if(r.some(s=>s.fn===E||s.format==="datetime")||t?.format==="datetime")return{type:"date",time:!0,instant:!0};let a=[t?.pattern,...r.map(s=>s.pattern)].filter(s=>s instanceof RegExp).map(s=>s.source);if(a.some(s=>s.includes("\\d{4}")))return a.some(s=>s.includes("\\d{2}:\\d{2}"))?{type:"date",time:!0}:{type:"date"};let c=r.some(s=>s.check==="max_length"&&typeof s.maximum=="number"&&s.maximum>500),d=M(n);return c?{type:"text",long:!0}:d==="phone"||d==="place"?{type:"text",holds:d}:{type:"text"}}return{type:"unknown"}}function fe(e,n){let t=e?.shape;return!t||!(n in t)?{type:"unknown"}:k(t[n])}function me(e){if(e===void 0||e==="web"||e.startsWith("ai:")||e.startsWith("app:"))return;if(e==="api")return"via the API";if(e==="cli")return"via the command line";let[n,...t]=e.split(":"),o=t.join(":");return(n==="mcp"||n==="view")&&o?`via ${o}`:n==="mcp"?"via an agent's tools":`via ${e}`}var G=e=>{if(!e.currency)return{before:!0};try{let n=N(e.locale),t=new Intl.NumberFormat(n,{style:"currency",currency:e.currency}).formatToParts(1),o=t.findIndex(u=>u.type==="currency"),r=t.findIndex(u=>u.type==="integer"),i;try{i=new Intl.DisplayNames([n],{type:"currency"}).of(e.currency)}catch{}return{...o>=0?{symbol:t[o].value}:{},before:o<r,...i?{name:i}:{}}}catch{return{symbol:e.currency,before:!0}}};function le(e){let n=e.locale;if(e.format==="money"){let{symbol:t,before:o,name:r}=G(e),i=p(1250,n,{minimumFractionDigits:2,maximumFractionDigits:2});return{...t?o?{prefix:t}:{suffix:t}:{},placeholder:i,hint:r?`in ${r}`:e.currency?`in ${e.currency}`:"an amount of money"}}return e.format==="percent"?{suffix:"%",placeholder:p(15,n),hint:"as a percent"}:{...e.unit?{suffix:e.unit}:{},placeholder:"",hint:e.unit?`in ${e.unit}`:"a number"}}function pe(e,n){return e===void 0||!Number.isFinite(e)?"":n.format==="money"?p(e,n.locale,Number.isInteger(e)?{maximumFractionDigits:0}:{minimumFractionDigits:2,maximumFractionDigits:2}):n.format==="percent"?p(e*100,n.locale,{maximumFractionDigits:4}):p(e,n.locale,{maximumFractionDigits:6})}function ye(e){try{let n=new Intl.NumberFormat(N(e)).formatToParts(12345.6);return{group:n.find(t=>t.type==="group")?.value??",",decimal:n.find(t=>t.type==="decimal")?.value??"."}}catch{return{group:",",decimal:"."}}}function ge(e,n){let{group:t,decimal:o}=ye(n),r=e.replace(/[\s ']/g,"").replace(/[−–]/g,"-");if(o!=="."&&!r.includes(o)&&/^-?\d+\.\d{1,2}$/.test(r))return Number(r);if(t&&(r=r.split(t).join("")),o!=="."&&(r=r.replace(o,".")),!/^-?(\d+\.?\d*|\.\d+)$/.test(r))return;let i=Number(r);return Number.isFinite(i)?i:void 0}function be(e,n){let t=e.trim();if(t==="")return;let o=n?.format==="money"&&n.currency?G(n).symbol:void 0,r=t;o&&(r=r.split(o).join("")),n?.currency&&(r=r.replace(new RegExp(n.currency,"gi"),"")),r=r.replace(/^[$€£¥₹]|[$€£¥₹]$/g,""),/%\s*$/.test(r)&&(r=r.replace(/%\s*$/,"")),n?.unit&&n.format!=="money"&&(r=r.replace(new RegExp(`\\s*${n.unit.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*$`),""));let u=ge(r,n?.locale);if(u!==void 0)return n?.format==="percent"?u/100:u}export{P as a,Te as b,H as c,k as d,fe as e,z as f,K as g,me as h,le as i,pe as j,be as k,L as l,w as m,y as n,F as o,V as p,q,ee as r,de as s};
|
|
1
|
+
import{B as $,Cb as M,D as h,G as E,K as N,L as S,M as W,O as R,P as I,T as p,da as D,ia as T,sa as j,tb as v,zb as O}from"./chunk.WLPTY4BF.js";function z(e,n,t){let o=[...n?.creates??[],...n?.subject&&n.subject.kinds!=="*"?n.subject.kinds:[]];for(let r of o){let i=e.tryDefinition(r),u=i?.fields?.shape??{};if(!i||!(t in u))continue;let a=i.display?.format?.[t];return{label:i.display?.labels?.[t]??T(i,t),option:d=>a?a(d):D(d)}}return{label:T(void 0,t),option:r=>D(r)}}function K(e,n,t){if(t instanceof v){let o=n.find(i=>i.name===t.mutation);return`Not yet: ${t.issues.map(i=>{let u=i.path.length>0?z(e,o,String(i.path[0])).label:void 0;return u?`${u} \u2014 ${i.message.replace(/^./,a=>a.toLowerCase())}`:i.message}).join("; ")}.`}return t instanceof Error?t.message:String(t)}var x=864e5,X=/^(\d{4})-(\d{2})-(\d{2})/,g=e=>String(e).padStart(2,"0"),_=e=>new Date(e).toISOString().slice(0,10),m=e=>Date.UTC(+e.slice(0,4),+e.slice(5,7)-1,+e.slice(8,10)),b=(e,n)=>_(m(e)+n*x),C=e=>new Date(m(e)).getUTCDay();function l(e,n,t){if(!(n>=1&&n<=12&&t>=1&&t<=31))return;let o=`${String(e).padStart(4,"0")}-${g(n)}-${g(t)}`;return _(m(o))===o?o:void 0}function L(e=new Date){let n=S();return n?R(e.getTime(),n):{day:`${e.getFullYear()}-${g(e.getMonth()+1)}-${g(e.getDate())}`,minutes:e.getHours()*60+e.getMinutes()}}var w=e=>/T\d\d:\d\d(:[\d.]+)?(Z|[+-]\d\d:?\d\d)$/.test(e);function y(e){if(typeof e!="string")return;if(w(e)){let o=new Date(e);return Number.isNaN(o.getTime())?void 0:L(o)}let n=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!n||!l(Number(n[1]),Number(n[2]),Number(n[3])))return;let t=e.slice(0,10);return n[4]===void 0?{day:t}:{day:t,minutes:Number(n[4])*60+Number(n[5])}}function F(e,n){if(!n.time)return e.day;let t=e.minutes??9*60;if(!n.instant)return`${e.day}T${g(Math.floor(t/60))}:${g(t%60)}`;let o=S(),[,r,i,u]=X.exec(e.day);return(o?new Date(I(e.day,t,o)):new Date(Number(r),Number(i)-1,Number(u),Math.floor(t/60),t%60)).toISOString().replace(/\.\d{3}Z$/,"Z")}function V(e,n=new Date){let t=W(),o=t;try{o=new Intl.DateTimeFormat(e??h,{timeZoneName:"short",timeZone:t}).formatToParts(n).find(r=>r.type==="timeZoneName")?.value??t}catch{o=t}return{zone:t,short:o}}function q(e,n,t,o){let r=y(n);if(!r)return t;let i=e===void 0?void 0:y(e),u=t===void 0?void 0:y(t),a=d=>m(d.day)+(d.minutes??0)*6e4,c=(d,s)=>{let f=a(d)+s;return{day:_(f),...o.time?{minutes:Math.round(f%x/6e4)}:{}}};return i&&u?F(c(u,a(r)-a(i)),o):u&&a(u)>=a(r)?t:o.time?F(c(r,36e5),o):t}var J=/^(start|starts|startsAt|startsOn|startAt|begins|from|opens|checkIn)$/i,Q=/^(end|ends|endsAt|endsOn|endAt|until|to|finish|finishes|closes|through|checkOut)$/i;function ee(e,n={}){let t=(n.start&&e.includes(n.start)?n.start:void 0)??e.find(r=>J.test(r)),o=(n.end&&e.includes(n.end)?n.end:void 0)??e.find(r=>r!==t&&Q.test(r));return t&&o?{start:t,end:o}:void 0}var ne=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],te=["sun","mon","tue","wed","thu","fri","sat"],B="(jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|june?|july?|aug(?:ust)?|sept?(?:ember)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?)",U="(sun(?:day)?|mon(?:day)?|tue(?:s|sday)?|wed(?:nesday)?|thu(?:r|rs|rsday)?|fri(?:day)?|sat(?:urday)?)",re=e=>ne.indexOf(e.slice(0,3))+1,Y=e=>e===void 0?void 0:e.length===2?2e3+Number(e):Number(e);function oe(e){try{let n=new Intl.DateTimeFormat(e,{month:"numeric",day:"numeric"}).formatToParts(0).map(t=>t.type);return n.indexOf("month")<n.indexOf("day")}catch{return!0}}function ie(e){let n=(r,i)=>({minutes:i,rest:`${e.slice(0,r.index)} ${e.slice(r.index+r[0].length)}`}),t=/\b(noon|midday)\b/.exec(e);if(t)return n(t,12*60);if(t=/\bmidnight\b/.exec(e),t)return n(t,0);if(t=/\b(\d{1,2})(?::(\d{2}))?\s*([ap])\.?m?\.?(?=\s|$)/.exec(e),t){let r=Number(t[1]),i=Number(t[2]??0);return r<1||r>12||i>59?{rest:e,bad:!0}:n(t,(r%12+(t[3]==="p"?12:0))*60+i)}if(t=/\b(\d{1,2}):(\d{2})\b/.exec(e),t){let r=Number(t[1]),i=Number(t[2]);return r>23||i>59?{rest:e,bad:!0}:n(t,r*60+i)}if(t=/\bat\s+(\d{1,2})\b/.exec(e),t){let r=Number(t[1]);return r>23?{rest:e,bad:!0}:n(t,(r>=1&&r<=7?r+12:r)*60)}let o=/\b(morning|afternoon|evening|tonight)\b/.exec(e);return o?{minutes:{morning:9,afternoon:15,evening:18,tonight:20}[o[1]]*60,rest:o[1]==="tonight"?`${e.slice(0,o.index)} today ${e.slice(o.index+o[0].length)}`:`${e.slice(0,o.index)} ${e.slice(o.index+o[0].length)}`}:{rest:e}}function ue(e,n,t){let o=e.replace(/\b(on|at|the|of|this)\b/g," ").replace(/\s+/g," ").trim();if(o==="")return null;if(o==="today"||o==="now")return n;if(o==="tomorrow"||o==="tmrw"||o==="tmr")return b(n,1);if(o==="yesterday")return b(n,-1);if(o==="next week")return b(n,7);let r=/^in (\d{1,3}) (day|days|week|weeks)$/.exec(o);if(r)return b(n,Number(r[1])*(r[2].startsWith("week")?7:1));if(r=new RegExp(`^(next )?${U}$`).exec(o),r){let d=(te.indexOf(r[2].slice(0,3))-C(n)+7)%7;return b(n,r[1]&&d===0?7:d)}if(r=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(o),r)return l(Number(r[1]),Number(r[2]),Number(r[3]));let i=o.replace(new RegExp(`^${U} `),"");r=new RegExp(`^(\\d{1,2})(?:st|nd|rd|th)? ${B}(?: (\\d{4}))?$`).exec(i);let u=r?{date:r[1],month:r[2],year:r[3]}:void 0;r=new RegExp(`^${B} (\\d{1,2})(?:st|nd|rd|th)?(?: (\\d{4}))?$`).exec(i);let a=u??(r?{date:r[2],month:r[1],year:r[3]}:void 0);if(a)return Z(n,Y(a.year),re(a.month),Number(a.date));if(r=/^(\d{1,2})[/.-](\d{1,2})(?:[/.-](\d{2}|\d{4}))?$/.exec(i),r){let[c,d]=[Number(r[1]),Number(r[2])],[s,f]=oe(t)?[c,d]:[d,c];return Z(n,Y(r[3]),s,f)}}function Z(e,n,t,o){if(n!==void 0)return l(n,t,o);let r=Number(e.slice(0,4)),i=l(r,t,o);return i===void 0?l(r+1,t,o):m(e)-m(i)>183*x?l(r+1,t,o):i}function de(e,n){let t=e.trim();if(w(t)){let a=y(t);if(a)return n.time?a:{day:a.day}}let o=e.toLowerCase().replace(/,/g," ").replace(/(\d{4}-\d{2}-\d{2})t(\d\d:\d\d)(:\d\d(\.\d+)?)?/,"$1 $2").replace(/\s+/g," ").trim();if(o==="")return;let r=ie(o);if(r.bad)return;let i=ue(r.rest,n.today,n.locale??h);if(i===void 0||i===null&&r.minutes===void 0)return;let u=i??n.base?.day??n.today;return n.time?{day:u,minutes:r.minutes??n.base?.minutes??9*60}:{day:u}}var ae=e=>/^[A-Z]{3}$/.test(e??"");function P(e){let{format:n,unit:t,currency:o,locale:r}=e,i=ae(t),u=n==="money"||!n&&i,a=u?i?t:o:void 0;return{...u?{format:"money"}:n?{format:n}:{},...t&&!(u&&i)?{unit:t}:{},...a?{currency:a}:{},...r?{locale:r}:{}}}function Te(e){switch(e.format){case"money":return e.currency?`An amount of money in ${e.currency}: a plain number, 1250.5 for 1,250.50 ${e.currency}.`:"An amount of money, in no named currency: a plain number.";case"percent":return"A fraction said as a percent: 0.15 is 15%.";default:return e.unit?`A number of ${e.unit}.`:"A number."}}function H(e){let n=$(e)?.innerType;return n===void 0?e:H(n)}var se={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ce=e=>(e?._zod?.def?.checks??[]).map(n=>n._zod?.def).filter(n=>n!==void 0);function k(e){let n=H(e),t=$(n),o=t?.type,r=ce(n);if(o==="enum")return{type:"choice",options:Object.keys(t?.entries??{})};let i=j(n);if(i)return i==="image"?{type:"file",image:!0}:i==="video"?{type:"file",video:!0}:{type:"file"};if(o==="boolean")return{type:"boolean"};if(o==="array"){let u=k(t?.element);return u.type==="unknown"?{type:"unknown"}:{type:"several",of:u}}if(o==="number"){let u,a,c;for(let d of r){d.check==="multiple_of"&&typeof d.value=="number"?c=d.value:d.check==="number_format"&&(d.format==="safeint"||d.format==="int32"||d.format==="uint32")&&(c??=1);let s=d.check==="number_format"&&d.format?se[d.format]:void 0,f=s?s[0]:d.check==="greater_than"&&d.inclusive&&typeof d.value=="number"?d.value:void 0,A=s?s[1]:d.check==="less_than"&&d.inclusive&&typeof d.value=="number"?d.value:void 0;f!==void 0&&(u=u===void 0?f:Math.max(u,f)),A!==void 0&&(a=a===void 0?A:Math.min(a,A))}return{type:"number",...u===void 0?{}:{min:u},...a===void 0?{}:{max:a},...c===void 0?{}:{step:c},...M(n)==="duration"?{duration:!0}:{},...O(e)?{amount:P(O(e))}:{}}}if(o==="string"){if(r.some(s=>s.fn===E||s.format==="datetime")||t?.format==="datetime")return{type:"date",time:!0,instant:!0};let a=[t?.pattern,...r.map(s=>s.pattern)].filter(s=>s instanceof RegExp).map(s=>s.source);if(a.some(s=>s.includes("\\d{4}")))return a.some(s=>s.includes("\\d{2}:\\d{2}"))?{type:"date",time:!0}:{type:"date"};let c=r.some(s=>s.check==="max_length"&&typeof s.maximum=="number"&&s.maximum>500),d=M(n);return c?{type:"text",long:!0}:d==="phone"||d==="place"?{type:"text",holds:d}:{type:"text"}}return{type:"unknown"}}function fe(e,n){let t=e?.shape;return!t||!(n in t)?{type:"unknown"}:k(t[n])}function me(e){if(e===void 0||e==="web"||e.startsWith("ai:")||e.startsWith("app:"))return;if(e==="api")return"via the API";if(e==="cli")return"via the command line";let[n,...t]=e.split(":"),o=t.join(":");return(n==="mcp"||n==="view")&&o?`via ${o}`:n==="mcp"?"via an agent's tools":`via ${e}`}var G=e=>{if(!e.currency)return{before:!0};try{let n=N(e.locale),t=new Intl.NumberFormat(n,{style:"currency",currency:e.currency}).formatToParts(1),o=t.findIndex(u=>u.type==="currency"),r=t.findIndex(u=>u.type==="integer"),i;try{i=new Intl.DisplayNames([n],{type:"currency"}).of(e.currency)}catch{}return{...o>=0?{symbol:t[o].value}:{},before:o<r,...i?{name:i}:{}}}catch{return{symbol:e.currency,before:!0}}};function le(e){let n=e.locale;if(e.format==="money"){let{symbol:t,before:o,name:r}=G(e),i=p(1250,n,{minimumFractionDigits:2,maximumFractionDigits:2});return{...t?o?{prefix:t}:{suffix:t}:{},placeholder:i,hint:r?`in ${r}`:e.currency?`in ${e.currency}`:"an amount of money"}}return e.format==="percent"?{suffix:"%",placeholder:p(15,n),hint:"as a percent"}:{...e.unit?{suffix:e.unit}:{},placeholder:"",hint:e.unit?`in ${e.unit}`:"a number"}}function pe(e,n){return e===void 0||!Number.isFinite(e)?"":n.format==="money"?p(e,n.locale,Number.isInteger(e)?{maximumFractionDigits:0}:{minimumFractionDigits:2,maximumFractionDigits:2}):n.format==="percent"?p(e*100,n.locale,{maximumFractionDigits:4}):p(e,n.locale,{maximumFractionDigits:6})}function ye(e){try{let n=new Intl.NumberFormat(N(e)).formatToParts(12345.6);return{group:n.find(t=>t.type==="group")?.value??",",decimal:n.find(t=>t.type==="decimal")?.value??"."}}catch{return{group:",",decimal:"."}}}function ge(e,n){let{group:t,decimal:o}=ye(n),r=e.replace(/[\s ']/g,"").replace(/[−–]/g,"-");if(o!=="."&&!r.includes(o)&&/^-?\d+\.\d{1,2}$/.test(r))return Number(r);if(t&&(r=r.split(t).join("")),o!=="."&&(r=r.replace(o,".")),!/^-?(\d+\.?\d*|\.\d+)$/.test(r))return;let i=Number(r);return Number.isFinite(i)?i:void 0}function be(e,n){let t=e.trim();if(t==="")return;let o=n?.format==="money"&&n.currency?G(n).symbol:void 0,r=t;o&&(r=r.split(o).join("")),n?.currency&&(r=r.replace(new RegExp(n.currency,"gi"),"")),r=r.replace(/^[$€£¥₹]|[$€£¥₹]$/g,""),/%\s*$/.test(r)&&(r=r.replace(/%\s*$/,"")),n?.unit&&n.format!=="money"&&(r=r.replace(new RegExp(`\\s*${n.unit.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*$`),""));let u=ge(r,n?.locale);if(u!==void 0)return n?.format==="percent"?u/100:u}export{P as a,Te as b,H as c,k as d,fe as e,z as f,K as g,me as h,le as i,pe as j,be as k,L as l,w as m,y as n,F as o,V as p,q,ee as r,de as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk.
|
|
1
|
+
import"./chunk.QT4XGC5Z.js";import{H as W,S as x}from"./chunk.MQ7FNHXG.js";import"./chunk.WLPTY4BF.js";import{b as D}from"./chunk.AJZBJBMO.js";var g=D(W(),1);var o=D(x(),1),v=864e5,l=t=>Date.UTC(+t.slice(0,4),+t.slice(5,7)-1,+t.slice(8,10)),I=t=>new Date(t).toISOString().slice(0,10),s=(t,i)=>I(l(t)+i*v),m=(t,i)=>{let a=new Date(l(t)),u=a.getUTCMonth()+i,d=Date.UTC(a.getUTCFullYear(),u,1),w=new Date(Date.UTC(a.getUTCFullYear(),u+1,0)).getUTCDate();return I(d+(Math.min(a.getUTCDate(),w)-1)*v)};function p(t,i,a){try{return new Intl.DateTimeFormat(t??"en-US",{...i,timeZone:"UTC"}).format(a)}catch{return new Intl.DateTimeFormat("en-US",{...i,timeZone:"UTC"}).format(a)}}function F(t){try{let i=new Intl.Locale(t??"en-US"),a=i.getWeekInfo?.().firstDay??i.weekInfo?.firstDay;if(a!==void 0)return a%7}catch{return 0}return/^en-US|^en$|-(US|CA|JP|BR|IL|MX|PH)$/.test(t??"en-US")?0:1}function L({id:t,label:i,selected:a,today:u,locale:d,onPick:w,onClose:T}){let[r,f]=(0,g.useState)(a??u),U=(0,g.useRef)(null),y=F(d),b=`${r.slice(0,7)}-01`,M=(new Date(l(b)).getUTCDay()-y+7)%7,P=s(b,-M),A=Array.from({length:6},(e,n)=>Array.from({length:7},(S,c)=>s(P,n*7+c))),$=p(d,{month:"long",year:"numeric"},l(b)),h=(0,g.useRef)(!0);(0,g.useEffect)(()=>{h.current&&U.current?.querySelector(`[data-day="${r}"]`)?.focus(),h.current=!1},[r]);let E=e=>{let n={ArrowLeft:()=>s(r,-1),ArrowRight:()=>s(r,1),ArrowUp:()=>s(r,-7),ArrowDown:()=>s(r,7),PageUp:()=>m(r,e.shiftKey?-12:-1),PageDown:()=>m(r,e.shiftKey?12:1),Home:()=>s(r,-((new Date(l(r)).getUTCDay()-y+7)%7)),End:()=>s(r,6-(new Date(l(r)).getUTCDay()-y+7)%7)};n[e.key]?(e.preventDefault(),h.current=!0,f(n[e.key]())):e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),T())},R=Array.from({length:7},(e,n)=>l("1970-01-04")+(y+n)%7*v),C={minWidth:32,minHeight:32,padding:"0 8px",borderRadius:6};return(0,o.jsxs)("div",{id:t,role:"group","aria-label":`Pick a date for ${i}`,"data-graview-part":"when-month",onKeyDown:e=>{e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),T())},style:{flexBasis:"100%",width:"min(100%, 20rem)",boxSizing:"border-box",padding:8,border:"1px solid var(--graview-edge)",borderRadius:8,background:"var(--graview-panel)",color:"var(--graview-ink)"},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:6,marginBottom:6},children:[(0,o.jsx)("button",{type:"button","aria-label":"Previous month",onClick:()=>f(m(r,-1)),style:C,children:"\u2039"}),(0,o.jsx)("span",{id:`${t}-title`,"aria-live":"polite",style:{fontWeight:600,fontSize:"0.875rem"},children:$}),(0,o.jsx)("button",{type:"button","aria-label":"Next month",onClick:()=>f(m(r,1)),style:C,children:"\u203A"})]}),(0,o.jsxs)("table",{ref:U,role:"grid","aria-labelledby":`${t}-title`,onKeyDown:E,style:{width:"100%",borderCollapse:"collapse",tableLayout:"fixed",fontSize:"0.8125rem"},children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:R.map(e=>(0,o.jsx)("th",{scope:"col",abbr:p(d,{weekday:"long"},e),style:{fontWeight:500,color:"var(--graview-ink-faint)",padding:"2px 0"},children:p(d,{weekday:"narrow"},e)},e))})}),(0,o.jsx)("tbody",{children:A.map(e=>(0,o.jsx)("tr",{children:e.map(n=>{let S=n.slice(0,7)===b.slice(0,7),c=n===a,k=n===u;return(0,o.jsx)("td",{role:"gridcell","aria-selected":c||void 0,style:{padding:1,textAlign:"center"},children:(0,o.jsx)("button",{type:"button","data-day":n,tabIndex:n===r?0:-1,"aria-label":`${p(d,{weekday:"long",year:"numeric",month:"long",day:"numeric"},l(n))}${k?", today":""}${c?", selected":""}`,...k?{"aria-current":"date"}:{},onClick:()=>w(n),onFocus:()=>n!==r&&f(n),style:{width:"100%",minHeight:36,padding:0,borderRadius:6,border:k?"1px solid var(--graview-accent)":"1px solid transparent",background:c?"var(--graview-accent)":"transparent",color:c?"var(--graview-accent-ink)":S?"var(--graview-ink)":"var(--graview-ink-faint)",fontWeight:c?600:400},children:Number(n.slice(8,10))})},n)})},e[0]))})]})]})}export{L as WhenMonth};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as v,b as m,c as h}from"./chunk.MB7LKKUD.js";import"./chunk.
|
|
1
|
+
import{a as v,b as m,c as h}from"./chunk.MB7LKKUD.js";import"./chunk.QT4XGC5Z.js";import{Aa as b,H as N,S as u,ya as p}from"./chunk.MQ7FNHXG.js";import{qc as f}from"./chunk.WLPTY4BF.js";import{b as c}from"./chunk.AJZBJBMO.js";var l=c(N(),1);var o=c(u(),1);function z({notices:r,anchor:n,board:a}){return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(w,{notices:r.filter(i=>i.kind==="banner"),at:"top",anchor:n,board:a}),(0,o.jsx)(w,{notices:r.filter(i=>i.kind==="toast"),at:"foot",anchor:n,board:a})]})}var y={info:"var(--graview-accent)",good:"var(--graview-good)",warn:"var(--graview-warn)",bad:"var(--graview-bad)"};function w({notices:r,at:n,anchor:a,board:i}){let s=(0,l.useRef)(null),t=r.length>0;return(0,l.useLayoutEffect)(()=>{let e=s.current;if(!t||!e)return;if(typeof e.showPopover=="function"&&!p(e))try{e.showPopover()}catch{}let d=()=>(n==="top"?h:m)(e,a());d(),n==="foot"&&i.hold?.(()=>e.matches(":hover, :focus-within"));let S=b(e);addEventListener("resize",d),addEventListener("scroll",d,!0),n==="foot"&&addEventListener(v,d);let g=typeof ResizeObserver=="function"?new ResizeObserver(d):null;return g?.observe(e),()=>{if(S(),g?.disconnect(),removeEventListener("resize",d),removeEventListener("scroll",d,!0),removeEventListener(v,d),e.isConnected&&p(e))try{e.hidePopover()}catch{}}},[t,n,a,i]),t?(0,o.jsx)("div",{ref:s,popover:"manual",role:"region","aria-label":n==="top"?"Notices":"Messages","data-testid":n==="top"?"notices-banners":"notices-toasts","data-graview-offstage":"",style:{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:f("toast"),width:"max-content",height:"auto",maxWidth:"min(560px, calc(100vw - 32px))",display:"grid",gap:8,color:"var(--graview-ink)"},children:r.map(e=>(0,o.jsx)(T,{notice:e,board:i},e.id))}):null}function T({notice:r,board:n}){let a=r.tone??"info",i=[...r.action?[r.action]:[],...r.actions??[]],s=()=>n.dismiss(r.id);return(0,o.jsxs)("div",{"data-testid":"notice","data-kind":r.kind,"data-tone":a,style:{boxSizing:"border-box",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px 12px",padding:r.kind==="banner"?"8px 10px 8px 14px":"10px 12px 10px 14px",borderRadius:"var(--graview-radius, 12px)",borderTop:"1px solid var(--graview-edge)",borderRight:"1px solid var(--graview-edge)",borderBottom:"1px solid var(--graview-edge)",borderLeft:`3px solid ${y[a]}`,background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,o.jsx)("span",{"aria-hidden":"true",style:{width:7,height:7,borderRadius:999,flex:"0 0 auto",background:y[a]}}),(0,o.jsx)("span",{style:{flex:"1 1 16rem",minWidth:0},children:r.sentence}),i.length>0?(0,o.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:6},children:i.map((t,e)=>t.href!==void 0?(0,o.jsx)("a",{href:t.href,...t.target?{target:t.target,rel:"noopener"}:{},"data-testid":"notice-action",onClick:()=>{t.onSelect?.(),s()},style:{...x,...e===0?k:{}},children:t.label},t.label):(0,o.jsx)("button",{type:"button","data-testid":"notice-action",onClick:()=>{s(),t.onSelect?.()},style:{...x,...e===0?k:{}},children:t.label},t.label))}):null,(0,o.jsx)("button",{type:"button","data-testid":"notice-dismiss","aria-label":`Dismiss: ${r.sentence}`,title:"Dismiss",onClick:s,style:E,children:"\xD7"})]})}var x={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 12px",borderRadius:9,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",font:"inherit",fontWeight:500,textDecoration:"none",cursor:"pointer"},k={background:"var(--graview-accent)",borderColor:"var(--graview-accent)",color:"var(--graview-accent-ink)"},E={minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",fontSize:"1rem",cursor:"pointer"};export{z as NoticeStacks};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as a}from"./chunk.
|
|
1
|
+
import{g as a}from"./chunk.OE4QOBJF.js";import{c as p}from"./chunk.74RMHUCX.js";import{Da as d}from"./chunk.WLPTY4BF.js";function v(n){let r=new Map;for(let i of n.kinds){let e=n.tryDefinition(i),o=a(e),s=d(e);r.set(i,{fields:new Set(Object.keys(e?.fields?.shape??{})),edges:new Map(Object.entries(e?.edges??{}).map(([l,h])=>[l,h.cardinality??"many"])),...o?{computed:o}:{},...s.size>0?{linked:s}:{}})}let t=a(n);return t&&r.set(p,{computed:t}),r}export{v as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{k as a,l as b,m as c,n as d,o as e,p as f,q as g,r as h,s as i}from"./chunk.BUVAMSOZ.js";import"./chunk.FTJBW25J.js";import"./chunk.UT6642FC.js";import"./chunk.MCVY6RRS.js";import"./chunk.RZVZG2BQ.js";import"./chunk.VKHKYK5L.js";import"./chunk.TI4OSTQV.js";import"./chunk.EUGWV3S6.js";import"./chunk.MWZK3HVG.js";import"./chunk.3D5T3XIE.js";import"./chunk.GR5Q4HTW.js";import"./chunk.QT4XGC5Z.js";import"./chunk.MQ7FNHXG.js";import"./chunk.WLPTY4BF.js";import"./chunk.AJZBJBMO.js";export{i as GhostTray,h as InlineAiMenu,g as askAgain,c as askInline,a as askOf,b as drawPanel,d as heldSuggestion,e as suggestOnce,f as takeOffer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk.WVUJXDXZ.js";import{a as k,b as q,c as he}from"./chunk.2EJAIT33.js";import"./chunk.EUGWV3S6.js";import"./chunk.6XJP7F3I.js";import"./chunk.NPX7SPXM.js";import"./chunk.OE4QOBJF.js";import"./chunk.74RMHUCX.js";import"./chunk.GZHZLJBF.js";import{n as pe}from"./chunk.I3SQJ2L2.js";import"./chunk.OJGHDWI6.js";import"./chunk.FUJM7GDV.js";import"./chunk.MWZK3HVG.js";import"./chunk.3D5T3XIE.js";import"./chunk.GR5Q4HTW.js";import"./chunk.QT4XGC5Z.js";import{$ as ce,H as He,N as S,P as de,S as ue,ca as ge}from"./chunk.MQ7FNHXG.js";import{ia as re,la as w,na as oe,oa as E,pa as x,pc as se,qa as le,ra as Y}from"./chunk.WLPTY4BF.js";import{b as U}from"./chunk.AJZBJBMO.js";var h=U(He(),1);async function me(e,n){let i=await createImageBitmap(e);try{let r=Math.min(1,n/Math.max(i.width,i.height)),a=document.createElement("canvas");a.width=Math.max(1,Math.round(i.width*r)),a.height=Math.max(1,Math.round(i.height*r));let l=a.getContext("2d");if(l===null)throw new Error("This browser will not give us a canvas to resize with.");return l.drawImage(i,0,0,a.width,a.height),a}finally{i.close()}}var t=U(ue(),1),Le=2048,Ve=.85;function _(e){return e<1e3?`${e} bytes`:e<1e6?`${Math.round(e/1e3)} KB`:`${(e/1e6).toFixed(e<1e7?1:0)} MB`}function z(e){if(e.type==="application/pdf")return"PDF";let n=/\.([a-z0-9]{2,5})$/i.exec(e.name??"")?.[1];return n?n.toUpperCase():(e.type.split("/")[1]??e.type).replace(/^x-|^vnd\./,"").split(/[.+-]/)[0].toUpperCase()}function we(e){let n=[...new Set(e.map(i=>i==="image/*"?"pictures":i==="video/*"?"videos":i==="*/*"||i==="*"?"any file":`${z({type:i})} files`))];return n.length<=1?n[0]??"no files":`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`}function ke(e,n){if(e.length===0)return!0;let i=`${n.split("/")[0]}/*`;return e.some(r=>r==="*"||r==="*/*"||r===n||r===i)}var ye=/^image\/hei[cf]$|\.hei[cf]$/i,fe=e=>ye.test(e.type)||ye.test(e.name),Ie={mov:"video/quicktime",mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",ogv:"video/ogg"},De=e=>Ie[/\.([a-z0-9]{2,4})$/i.exec(e)?.[1]?.toLowerCase()??""];async function Be(e,n,i){let r=e.name||(i.camera?"photo.jpg":"file"),a=e.type||(fe({type:"",name:r})?"image/heic":De(r)??"application/octet-stream"),l=fe({type:a,name:r}),u=a.startsWith("image/")||l;if(i.image&&!u)return{refused:`\u201C${r}\u201D isn\u2019t a picture.`};if(i.video)return a.startsWith("video/")?K({blob:e,name:r,type:a},n):{refused:`\u201C${r}\u201D isn\u2019t a video.`};if(l||u&&/^image\/(jpeg|webp)$/.test(a)&&(i.camera||e.size>n.maxBytes||e.size>15e5))try{let c=await me(e,Le),b=await new Promise(p=>c.toBlob(p,"image/jpeg",Ve));if(b)return K({blob:b,name:l?r.replace(/\.hei[cf]$/i,"")+".jpg":r,type:"image/jpeg",width:c.width,height:c.height},n)}catch{if(l&&!ke(n.kinds,a))return{refused:`\u201C${r}\u201D is a HEIC photo, which this browser can\u2019t turn into a JPEG and this host doesn\u2019t take. Save it as a JPEG and try again.`}}let y={};if(u&&!l)try{let c=await createImageBitmap(e);y={width:c.width,height:c.height},c.close()}catch{}return K({blob:e,name:r,type:a,...y},n)}function K(e,n){return ke(n.kinds,e.type)?e.blob.size>n.maxBytes?{refused:`\u201C${e.name}\u201D is ${_(e.blob.size)}; this host takes files up to ${_(n.maxBytes)}.`}:e:{refused:`\u201C${e.name}\u201D is a ${z(e)} file; this host takes ${we(n.kinds)}.`}}async function je(e,n,i,r=!1){let a;try{a=await n.upload(e.blob,e.name)}catch(u){let s=u instanceof Error&&u.message.trim()?u.message.trim():"the host refused it";return{refused:`\u201C${e.name}\u201D wasn\u2019t kept: ${s}`}}return oe(a)?i&&!E(a)?{refused:`\u201C${e.name}\u201D isn\u2019t a picture.`}:r&&!x(a)?{refused:`The host kept \u201C${e.name}\u201D as ${z(a)}, not as a video.`}:{...a,...a.width===void 0&&e.width?{width:e.width}:{},...a.height===void 0&&e.height?{height:e.height}:{}}:{refused:`The host\u2019s answer for \u201C${e.name}\u201D isn\u2019t a file a record can keep.`}}var F="var(--graview-radius, 8px)",P={color:"var(--graview-ink-muted)",fontSize:"0.8125rem"};function Z(e){let n=S(),i=de()?.past!=null,[r,a]=(0,h.useState)(!1),l=n?.kept?_e(n,e.href):!0,[,u]=(0,h.useState)(0);return(0,h.useEffect)(()=>{if(typeof l!="object")return;let s=!0;return l.then(()=>s&&u(y=>y+1)),()=>void(s=!1)},[l]),[l===!1||i&&r,()=>a(!0)]}var J=new WeakMap;function _e(e,n){let i=J.get(e)?.get(n);if(i!==void 0)return i;let r;try{r=e.kept(n)}catch{return!0}if(typeof r=="boolean")return r;let a=J.get(e)??new Map;J.set(e,a);let l=Promise.resolve(r).then(u=>u!==!1,()=>!0);return a.set(n,l),l.then(u=>a.set(n,u)),l}function ee({file:e,style:n}){return(0,t.jsx)("span",{role:"img","aria-label":`${k(e)}, removed later`,"data-graview-removed-later":e.href,style:{display:"grid",placeItems:"center",textAlign:"center",padding:4,boxSizing:"border-box",fontSize:"0.6875rem",lineHeight:1.2,color:"var(--graview-ink-muted)",border:"1px dashed var(--graview-edge-bright)",borderRadius:F,...n},children:"removed later"})}function Q({file:e,size:n=56,style:i}){let r=S(),[a,l]=Z(e);return a?(0,t.jsx)(ee,{file:e,style:{width:n,height:n,flex:"none",...i}}):x(e)?(0,t.jsx)(Oe,{file:e,size:n,...i?{style:i}:{},onError:l}):(0,t.jsx)("img",{onError:l,src:w(r,e.href),alt:k(e),width:n,height:n,loading:"lazy",decoding:"async","data-graview-thumb":e.href,style:{width:n,height:n,objectFit:"cover",borderRadius:F,display:"block",flex:"none",background:"var(--graview-edge)",...i}})}function Fe(e){let[n,i]=(0,h.useState)({}),r=e.duration??n.duration;return[{...r!==void 0?{duration:r}:{},width:e.width??n.width,height:e.height??n.height},u=>{let s=u.currentTarget;i({...Number.isFinite(s.duration)&&s.duration>0?{duration:s.duration}:{},...s.videoWidth>0&&s.videoHeight>0?{width:s.videoWidth,height:s.videoHeight}:{}})}]}var ze=320,$e=(e,n)=>`${k(e)}, ${le({...n!==void 0?{duration:n}:{}})}`,Ne=(0,t.jsx)("span",{"data-graview-play-glyph":"","aria-hidden":"true",style:{position:"absolute",inset:0,display:"grid",placeItems:"center",pointerEvents:"none"},children:(0,t.jsxs)("svg",{viewBox:"0 0 24 24",width:"40%",height:"40%",style:{maxWidth:40,maxHeight:40,filter:"drop-shadow(0 1px 2px rgb(0 0 0 / 0.5))"},children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"11",fill:"rgb(0 0 0 / 0.55)"}),(0,t.jsx)("path",{d:"M9.5 7.5v9l7-4.5z",fill:"#fff"})]})});function Oe({file:e,size:n,style:i,onError:r}){let a=S(),[l,u]=Fe(e),s={width:n,height:n,objectFit:"cover",display:"block",borderRadius:F,background:"var(--graview-edge)"};return(0,t.jsxs)("span",{role:"img","aria-label":$e(e,l.duration),"data-graview-thumb":e.href,"data-graview-video-thumb":"",style:{position:"relative",display:"block",width:n,height:n,flex:"none",...i},children:[e.poster?(0,t.jsx)("img",{src:w(a,e.poster),alt:"",width:n,height:n,loading:"lazy",decoding:"async",onError:r,style:s}):(0,t.jsx)("video",{src:w(a,e.href),preload:"metadata",muted:!0,playsInline:!0,"aria-hidden":"true",tabIndex:-1,width:n,height:n,onLoadedMetadata:u,onError:r,style:s}),Ne,l.duration!==void 0?(0,t.jsx)("span",{"data-graview-video-clock":"","aria-hidden":"true",style:{position:"absolute",right:3,bottom:3,padding:"0 4px",borderRadius:4,background:"rgb(0 0 0 / 0.65)",color:"#fff",fontSize:"0.6875rem",lineHeight:"16px",fontVariantNumeric:"tabular-nums"},children:q(l.duration)}):null]})}function Ae({file:e}){let n=S(),[i,r]=Z(e),[a,l]=Fe(e);if(i)return(0,t.jsx)(ee,{file:e,style:{width:"100%",aspectRatio:"16 / 9"}});let u=a.width!==void 0&&a.height!==void 0;return(0,t.jsxs)("figure",{"data-graview-video-figure":e.href,style:{margin:0,display:"grid",gap:4,minWidth:0},children:[(0,t.jsx)("video",{"data-graview-video":e.href,src:w(n,e.href),...e.poster?{poster:w(n,e.poster)}:{},controls:!0,preload:"metadata",playsInline:!0,...u?{width:a.width,height:a.height}:{},"aria-label":$e(e,a.duration),onLoadedMetadata:l,onError:r,style:{display:"block",width:"100%",maxWidth:u?Math.max(a.width,ze):"100%",height:"auto",maxHeight:"80vh",aspectRatio:u?`${a.width} / ${a.height}`:"16 / 9",borderRadius:F,background:"#000"},children:e.captions?(0,t.jsx)("track",{kind:"captions",src:w(n,e.captions),srcLang:"en",label:"Captions",default:!0}):null}),(0,t.jsx)("figcaption",{"data-graview-video-said":"",style:P,children:[e.caption??e.name,...a.duration!==void 0?[q(a.duration)]:[]].join(" \xB7 ")})]})}function Ge({file:e,onOpen:n}){let i=S(),[r,a]=Z(e);return r?(0,t.jsx)(ee,{file:e,style:{width:"100%",aspectRatio:"1"}}):(0,t.jsx)("button",{type:"button","aria-label":`Open ${k(e)} full size`,onClick:l=>n(l.currentTarget),style:{padding:0,border:0,background:"none",cursor:"zoom-in",display:"block",width:"100%",borderRadius:F},children:(0,t.jsx)("img",{src:w(i,e.href),alt:k(e),loading:"lazy",decoding:"async",onError:a,style:{width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:F,display:"block",background:"var(--graview-edge)"}})})}function X({files:e,label:n}){let i=S(),r=d=>w(i,d.href),a=e.filter(E),l=e.filter(x),u=e.filter(d=>!E(d)&&!x(d)),[s,y]=(0,h.useState)(null),c=(0,h.useRef)(null),b=(0,h.useRef)(null);(0,h.useEffect)(()=>{let d=c.current;s!==null&&d&&!d.open&&d.showModal?.()},[s]);let p=s===null?void 0:a[s];return(0,t.jsxs)("div",{style:{display:"grid",gap:10,minWidth:0},children:[a.length>0?(0,t.jsx)("ul",{"data-graview-gallery":"","aria-label":n,style:{listStyle:"none",margin:0,padding:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(96px, 1fr))",gap:8},children:a.map((d,T)=>(0,t.jsx)("li",{style:{minWidth:0},children:(0,t.jsx)(Ge,{file:d,onOpen:R=>{b.current=R,y(T)}})},d.href))}):null,l.length>0?(0,t.jsx)("ul",{"data-graview-videos":"","aria-label":n,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:12},children:l.map(d=>(0,t.jsx)("li",{style:{minWidth:0},children:(0,t.jsx)(Ae,{file:d})},d.href))}):null,u.length>0?(0,t.jsx)("ul",{"data-graview-documents":"",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:10},children:u.map(d=>(0,t.jsxs)("li",{"data-graview-document":d.type,style:{display:"grid",gap:6,minWidth:0},children:[d.type==="application/pdf"?(0,t.jsx)("object",{data:r(d),type:"application/pdf","aria-label":k(d),style:{width:"100%",height:420,border:"1px solid var(--graview-edge)",borderRadius:F},children:(0,t.jsxs)("p",{style:{margin:0,padding:12},children:["This browser shows no PDF here: ",(0,t.jsxs)("a",{href:r(d),download:d.name,children:["download ",d.name]}),"."]})}):null,(0,t.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",gap:"2px 10px",alignItems:"baseline",minWidth:0,overflowWrap:"anywhere"},children:[(0,t.jsx)("a",{href:r(d),download:d.name,...d.type==="application/pdf"?{target:"_blank",rel:"noopener"}:{},children:d.name}),(0,t.jsxs)("span",{style:P,children:[z(d)," \xB7 ",_(d.bytes)]})]}),d.caption?(0,t.jsx)("span",{style:P,children:d.caption}):null]},d.href))}):null,p?(0,t.jsx)("dialog",{ref:c,"data-graview-full":p.href,"aria-label":k(p),onClose:()=>{y(null),b.current?.focus()},onClick:d=>{d.target===d.currentTarget&&d.currentTarget.close()},style:{padding:0,border:0,borderRadius:F,maxWidth:"min(96vw, 1600px)",maxHeight:"94vh",background:"var(--graview-panel)",color:"var(--graview-ink)"},children:(0,t.jsxs)("figure",{style:{margin:0,display:"grid",gap:8,padding:10},children:[(0,t.jsx)("img",{src:r(p),alt:k(p),style:{maxWidth:"100%",maxHeight:"80vh",objectFit:"contain",display:"block",margin:"0 auto"}}),(0,t.jsxs)("figcaption",{style:{display:"flex",gap:12,alignItems:"center",justifyContent:"space-between"},children:[(0,t.jsx)("span",{children:p.caption??p.name}),(0,t.jsx)("form",{method:"dialog",style:{margin:0},children:(0,t.jsx)("button",{type:"submit",autoFocus:!0,children:"Close"})})]})]})}):null]})}function xe({value:e,onChange:n,several:i,image:r,video:a=!1,label:l,thumbs:u=!0}){let s=S(),y=(0,h.useId)(),c=(0,h.useRef)(null),b=(0,h.useRef)(null),[p,d]=(0,h.useState)(null),[T,R]=(0,h.useState)(null),[te,H]=(0,h.useState)([]),[N,O]=(0,h.useState)(!1),W=r?"image/":a?"video/":void 0,C=s?W?s.kinds.filter(o=>o.startsWith(W)||o==="*"||o==="*/*"):s.kinds:[],Ce=s?s.kinds.length===0||C.length>0:!1,Pe=!a&&(s?s.kinds.length===0||(r?C:s.kinds).some(o=>o.startsWith("image/")||o.startsWith("*")):!1),L=!!s&&(!W||Ce),V=r?"picture":a?"video":"file",ne=i?`${V}s`:`a ${V}`,ae=W?C.length>0?C.join(","):`${W}*`:s?.kinds.join(",")||void 0,Re=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,A=(0,h.useRef)(e);A.current=e;let ie=(0,h.useRef)(null),I=(0,h.useRef)(null);(0,h.useEffect)(()=>{let o=I.current;if(!o||o.from===e)return;I.current=null;let g=ie.current?.children,f=g?.[Math.min(o.at,g.length-1)];((o.what==="move"?f?.querySelector("[data-graview-file-move]"):null)??f?.querySelector("[data-graview-file-remove]")??c.current?.parentElement?.querySelector("[data-graview-file-choose]"))?.focus()});let D=async(o,g)=>{if(!s||o.length===0)return;let f=i?o:o.slice(0,1),m=[],$=[];f.length<o.length&&$.push(`${l} holds one ${V}, so ${o.slice(1).map(v=>`\u201C${v.name||"the photo"}\u201D`).join(", ")} ${o.length>2?"were":"was"} left out.`),H([]),R(null);for(let v of f){d(`Sending ${v.name||"the photo"}\u2026`);let G=await Be(v,s,{image:r,video:a,camera:g==="camera"});if("refused"in G){$.push(G.refused);continue}let M=await je(G,s,r,a);"refused"in M?$.push(M.refused):[...i?A.current:[],...m].some(Te=>Te.href===M.href)?$.push(`\u201C${M.name}\u201D is already here.`):m.push(M)}if(d(null),H($),m.length!==0)try{n(i?[...A.current,...m]:m.slice(-1)),R(`Added ${m.map(v=>v.name).join(", ")}.`)}catch(v){H([...$,v instanceof Error?v.message:String(v)])}},B=(o,g,f)=>{try{I.current=f?{...f,from:e}:null,n(o),R(g)}catch(m){I.current=null,H([m instanceof Error?m.message:String(m)])}},j=o=>o?Array.from(o):[],We=o=>{let g=j(o.clipboardData?.files);!L||g.length===0||(o.preventDefault(),D(g,"pasted"))},Me=o=>{O(!1),L&&(o.preventDefault(),D(j(o.dataTransfer?.files),"dropped"))};return(0,t.jsxs)("div",{role:"group","aria-labelledby":`${y}-label`,"data-graview-file-editor":"","data-graview-dropping":N?"":void 0,onPaste:We,onDragOver:o=>{L&&(o.preventDefault(),O(!0))},onDragLeave:()=>O(!1),onDrop:Me,style:{display:"grid",gap:8,minWidth:0,padding:N?6:0,outline:N?"2px dashed var(--graview-accent)":"none",borderRadius:F},children:[(0,t.jsx)("span",{id:`${y}-label`,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap"},children:l}),e.length>0&&(i||e.length>1)?(0,t.jsx)("ul",{ref:ie,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:6},children:e.map((o,g)=>(0,t.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",minWidth:0},children:[u&&(E(o)||x(o))?(0,t.jsx)(Q,{file:o,size:40}):null,(0,t.jsx)("span",{style:{flex:"1 1 8rem",minWidth:0,overflowWrap:"anywhere"},children:o.name}),(0,t.jsx)(ve,{file:o,onCaption:f=>B(e.map((m,$)=>$===g?be(m,f):m),f?`${o.name} now says \u201C${f}\u201D.`:`${o.name} says its name again.`)}),i&&g>0?(0,t.jsx)("button",{type:"button","data-graview-file-move":"","aria-label":`Move ${o.name} earlier`,onClick:()=>B(e.map((f,m)=>m===g-1?o:m===g?e[g-1]:f),`Moved ${o.name} earlier.`,{at:g-1,what:"move"}),children:"\u2191"}):null,i?(0,t.jsx)("button",{type:"button","data-graview-file-remove":"","aria-label":`Remove ${o.name}`,onClick:()=>B(e.filter((f,m)=>m!==g),`Removed ${o.name}.`,{at:g,what:"remove"}),children:"Remove"}):null]},`${g}:${o.href}`))}):e.length===1?(0,t.jsx)(ve,{file:e[0],onCaption:o=>B([be(e[0],o)],o?`${e[0].name} now says \u201C${o}\u201D.`:`${e[0].name} says its name again.`)}):null,L?(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center"},children:[(0,t.jsx)("input",{ref:c,type:"file",hidden:!0,multiple:i,...ae?{accept:ae}:{},"data-graview-file-input":"","aria-label":`Choose ${ne}`,onChange:o=>{let g=j(o.currentTarget.files);o.currentTarget.value="",D(g,"picked")}}),(0,t.jsx)("button",{type:"button",disabled:p!==null,onClick:()=>c.current?.click(),"data-graview-file-choose":"",children:e.length>0&&!i?`Replace the ${V}`:`Choose ${ne}`}),Pe?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:b,type:"file",hidden:!0,accept:"image/*",capture:"environment","data-graview-photo-input":"","aria-label":"Take a photo",onChange:o=>{let g=j(o.currentTarget.files);o.currentTarget.value="",D(g,"camera")}}),Re?(0,t.jsx)("button",{type:"button",disabled:p!==null,onClick:()=>b.current?.click(),children:"Take a photo"}):null]}):null,(0,t.jsxs)("span",{style:P,"data-graview-file-takes":"",children:["or drop or paste ",i?"them":"it"," here \xB7 ",s.kinds.length>0?we(C.length>0?C:s.kinds):"any file",", up to ",_(s.maxBytes)]})]}):(0,t.jsx)("p",{style:{...P,margin:0},"data-graview-file-none":"",children:s?`This host doesn\u2019t take ${a?"videos":"pictures"}, so none can be added here.`:"This host doesn\u2019t take files, so none can be added here."}),(0,t.jsx)("p",{"aria-live":"polite",style:{...P,margin:0,minHeight:p||T?void 0:0},"data-graview-file-status":"",children:p??T??""}),te.length>0?(0,t.jsx)("div",{role:"alert","data-graview-file-refused":"",style:{color:"var(--graview-warn)",fontSize:"0.875rem",display:"grid",gap:2},children:te.map((o,g)=>(0,t.jsx)("p",{style:{margin:0},children:o},g))}):null]})}var be=(e,n)=>{let{caption:i,...r}=e;return n?{...r,caption:n}:r};function ve({file:e,onCaption:n}){let[i,r]=(0,h.useState)(e.caption??"");(0,h.useEffect)(()=>r(e.caption??""),[e.caption]);let a=()=>{let l=i.trim().slice(0,500);l!==(e.caption??"")&&n(l)};return(0,t.jsx)("input",{type:"text",value:i,placeholder:E(e)||x(e)?"What it shows":"What it is","aria-label":`What ${e.name} ${E(e)||x(e)?"shows":"is"}`,"data-graview-file-caption":e.href,onChange:l=>r(l.target.value),onBlur:a,onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),a())},style:{flex:"1 1 10rem",minWidth:0,font:"inherit",fontSize:"0.875rem",minHeight:24}})}function Se({field:e,label:n,labelStyle:i,valueStyle:r,style:a,children:l}){return(0,t.jsxs)("div",{"data-graview-files":e,style:{display:"grid",gap:6,minWidth:0,gridColumn:"1 / -1",...a},children:[(0,t.jsx)("dt",{style:i,children:n}),(0,t.jsx)("dd",{style:{margin:0,minWidth:0,display:"grid",gap:10,...r},children:l})]})}function Ee(e){let{nodeId:n,field:i,label:r,files:a}=e,{fields:l,commit:u}=pe(n),s=l.find(p=>p.field===i&&p.takesValue),y=s?.shape,c=y?.type==="several"?y.of:y,b=y?.type==="several";return a.length===0&&c?.type!=="file"?null:(0,t.jsxs)(Se,{...e,children:[(0,t.jsx)(X,{files:a,label:r}),s&&c?.type==="file"?(0,t.jsx)(xe,{value:a,thumbs:!1,several:b,image:c.image===!0,video:c.video===!0,label:r,onChange:p=>{let d=b?p:p[p.length-1];d!==void 0&&u(s,d)}}):null]})}function et(e){switch(e.as){case"field":return e.read?e.files.length>0?(0,t.jsx)(Se,{...e,children:(0,t.jsx)(X,{files:e.files,label:e.label})}):null:(0,t.jsx)(Ee,{...e});case"unfilled":return(0,t.jsx)(Ue,{...e});case"thumb":return(0,t.jsx)(Q,{...e});case"block":return e.files.length>0?(0,t.jsx)("span",{className:"graview-spec-image","data-graview-field":e.field,"data-graview-image":e.view,style:{display:"block",minWidth:0,...e.view==="gallery"?{position:"relative",zIndex:se.raised}:{}},children:e.view==="thumb"?(0,t.jsx)(Q,{file:e.files[0],size:72}):(0,t.jsx)(X,{files:e.files,label:e.label})}):null;case"control":{let n=(0,t.jsx)(xe,{value:Y(e.value),several:e.several,image:e.image,video:e.video===!0,label:e.label,onChange:i=>e.onChange(e.several?i:i[i.length-1])});return e.title===void 0?n:(0,t.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.several?"files":"file",children:[(0,t.jsx)("legend",{"data-graview-part":"label",children:e.title}),n]})}}}function Ue({nodeId:e,skip:n,labels:i,labelStyle:r,style:a}){let{store:l}=ce(),u=ge(e),s=u?l.schema.tryDefinition(u.kind):void 0,y=he(s).filter(c=>!n.includes(c)&&!(s?.display?.hide??[]).includes(c)&&Y(u?.[c]).length===0);return y.length===0?null:(0,t.jsx)("dl",{style:{margin:0,display:"grid",gap:14,minWidth:0},children:y.map(c=>(0,t.jsx)(Ee,{nodeId:e,field:c,label:i?.[c]??re(s,c),files:[],...r?{labelStyle:r}:{},...a?{style:a}:{}},c))})}export{xe as FilesEditor,Le as SEND_EDGE,et as drawFiles,we as kindsWords,Be as prepare,je as send,_ as sizeWords,ke as takes,z as typeWords};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as F,l as b}from"./chunk.
|
|
1
|
+
import{g as F,l as b}from"./chunk.74RMHUCX.js";function L(t,o){return o===1&&["every","some","sum","min","max","sort"].includes(t.fn)}function M(t){let o=new Set,e=new Set,r=[],s=[],a=new Set(F),i=(l,f)=>{switch(l.t){case"lit":return;case"ident":f||o.add(l.name);return;case"list":l.items.forEach(c=>i(c,f));return;case"member":i(l.object,f);return;case"unary":i(l.operand,f);return;case"binary":i(l.left,f),i(l.right,f);return;case"where":i(l.set,f),i(l.filter,!0);return;case"call":{e.add(l.fn);let c=(l.fn==="out"||l.fn==="in")&&l.args.length===2?l.args[1]:l.args[0],m=c?.t==="lit"&&typeof c.value=="string"?c.value:void 0;l.fn==="all"&&m&&r.push(m),(l.fn==="out"||l.fn==="in")&&m&&s.push(m),l.args.forEach((v,k)=>i(v,f||L(l,k)));return}}};return i(t,!1),{names:o,functions:e,unknownFunctions:[...e].filter(l=>!a.has(l)),sweeps:r,edges:s}}var p=class extends Error{constructor(e,r,s){super(`${e} (at character ${r+1} of "${s}")`);this.sentence=e;this.at=r;this.source=s}},D=["||","&&","==","!=","<=",">=","<",">","!","|","&","+","-","*","/","%","(",")","[","]",",","."],j={and:"&&",or:"||",not:"!"},T=2e3;function H(t){let o=[],e=0;for(;e<t.length;){let r=t[e];if(r===" "||r===" "||r===`
|
|
2
2
|
`||r==="\r"){e++;continue}if(r>="0"&&r<="9"){let a=e;for(;e<t.length&&/[0-9.]/.test(t[e]);)e++;let i=t.slice(a,e),l=Number(i);if(!Number.isFinite(l)||i.split(".").length>2)throw new p(`"${i}" is not a number`,a,t);o.push({k:"num",v:l,at:a});continue}if(r==="'"||r==='"'){let a=e++,i="";for(;e<t.length&&t[e]!==r;)t[e]==="\\"&&e+1<t.length&&e++,i+=t[e++];if(e>=t.length)throw new p("a quoted word is never closed",a,t);e++,o.push({k:"str",v:i,at:a});continue}if(/[A-Za-z_]/.test(r)){let a=e;for(;e<t.length&&/[A-Za-z0-9_]/.test(t[e]);)e++;let i=t.slice(a,e),l=Object.hasOwn(j,i)?j[i]:void 0;o.push(l?{k:"op",v:l,at:a}:{k:"id",v:i,at:a});continue}let s=D.find(a=>t.startsWith(a,e));if(!s)throw new p(`"${r}" is not part of the rule language`,e,t);o.push({k:"op",v:s,at:e}),e+=s.length}return o.push({k:"end",at:t.length}),o}function w(t){if(t.length>T)throw new p(`an expression may be at most ${T} characters`,0,t.slice(0,40));let o=H(t),e=0,r=()=>o[e],s=n=>{let d=r();return d.k==="op"&&d.v===n},a=n=>{let d=r();return d.k==="id"&&d.v===n},i=(n,d)=>{if(!s(n))throw new p(`expected ${d}`,r().at,t);e++},l=0,f=(n,d)=>{if(++l>64)throw new p("the expression nests too deeply",n,t);try{return d()}finally{l--}},c=(n,d)=>()=>{let g=d();for(;;){let y=r(),S=y.k==="op"?n.find(q=>q===y.v):y.k==="id"&&y.v==="in"&&n.includes("in")?"in":void 0;if(!S)return g;e++,g={t:"binary",op:S,left:g,right:d(),at:y.at}}},m=()=>{let n=r();if(n.k==="num")return e++,{t:"lit",value:n.v,at:n.at};if(n.k==="str")return e++,{t:"lit",value:n.v,at:n.at};if(n.k==="id"){if(e++,n.v==="true"||n.v==="false")return{t:"lit",value:n.v==="true",at:n.at};if(n.v==="null")return{t:"lit",value:null,at:n.at};if(s("(")){e++;let d=[];if(!s(")"))for(;;){if(d.push(h()),s(",")){e++;continue}break}return i(")",`")" to close ${n.v}(\u2026)`),{t:"call",fn:n.v,args:d,at:n.at}}return{t:"ident",name:n.v,at:n.at}}if(n.k==="op"&&n.v==="("){e++;let d=f(n.at,h);return i(")",'a ")"'),d}if(n.k==="op"&&n.v==="["){e++;let d=[];if(!s("]"))for(;;){if(d.push(h()),s(",")){e++;continue}break}return i("]",'a "]" to close the list'),{t:"list",items:d,at:n.at}}throw n.k==="end"?new p("the expression ends too soon",n.at,t):new p(`"${n.k==="op"?n.v:""}" cannot start a value here`,n.at,t)},v=()=>{let n=m();for(;;){if(s(".")){let d=r();e++;let g=r();if(g.k!=="id")throw new p('expected a field name after "."',g.at,t);e++,n={t:"member",object:n,name:g.v,at:d.at};continue}if(a("where")){let d=r().at;e++,n={t:"where",set:n,filter:f(d,h),at:d};continue}return n}},k=()=>{let n=r();return n.k==="op"&&(n.v==="!"||n.v==="-")?(e++,{t:"unary",op:n.v,operand:f(n.at,k),at:n.at}):v()},P=c(["*","/","%"],k),z=c(["+","-"],P),N=c(["&"],z),R=c(["|"],N),_=()=>{let n=R(),d=r(),g=d.k==="op"&&["==","!=","<","<=",">",">="].includes(d.v)?d.v:d.k==="id"&&d.v==="in"?"in":void 0;return g?(e++,{t:"binary",op:g,left:n,right:R(),at:d.at}):n},O=()=>{let n=r();return n.k==="op"&&n.v==="!"?(e++,{t:"unary",op:"!",operand:f(n.at,O),at:n.at}):_()},B=c(["&&"],O),I=c(["||"],B);function h(){return I()}let K=h();if(r().k!=="end")throw new p("there is more after the end of the expression",r().at,t);return K}function E(t){let o,e=-1,r=0;for(let s=0;s<t.length;s++){let a=t[s];if(o){a==="\\"?s++:a===o&&(o=void 0);continue}a==="'"||a==='"'?o=a:a==="("||a==="["?r++:a===")"||a==="]"?r--:a==="|"&&r===0&&(t[s+1]==="|"?s++:e=s)}if(e>0&&t.slice(e+1).trim()===x){let s=E(t.slice(0,e));if(s>=0)return s}return e}var x="capital",$=/\s*(?:'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)")\s*(,|$)/y;function U(t){let o=E(t);if(o>=0){if(t.slice(o+1).trim()!==x)throw new u('only "capital" may follow another formatter, like {n | words | capital}');let e=t.slice(0,o);if(e.trim()===x)throw new u('"capital" is said once');return{...C(e),capital:!0}}return t.trim()===x?{args:[],capital:!0}:C(t)}function C(t){let o=t.indexOf(":"),e=(o>=0?t.slice(0,o):t).trim();if(!b.includes(e))throw new u(`"${e}" is not a formatter; use one of ${[...b,x].join(", ")}`);let r=[];if(o>=0&&e==="excerpt"){let s=t.slice(o+1).trim();if(!/^\d+$/.test(s)||Number(s)<20||Number(s)>1e3)throw new u("excerpt is told at most how many characters, 20 to 1000: {summary | excerpt: 80}");r.push(s)}else if(o>=0){let s=t.slice(o+1),a=0;for(;a<s.length;){$.lastIndex=a;let i=$.exec(s);if(!i)throw new u(`"${e}" is told quoted words, like ${e}: 'offer'`);if(r.push((i[1]??i[2]??"").replace(/\\(.)/g,"$1")),a=$.lastIndex,i[3]==="")break}}if(e==="plural"&&(r.length<1||r.length>2))throw new u("plural is told its noun, like {count | plural: 'offer'}, and its plural where English does not make it: plural: 'person', 'people'");if(e!=="plural"&&e!=="excerpt"&&r.length>0)throw new u(`"${e}" takes nothing after it`);return{format:e,args:r}}var u=class extends Error{constructor(e){super(e);this.sentence=e}};function Y(t){let o=[],e=0;for(;e<t.length;){let r=t.indexOf("{",e);if(r<0){o.push({text:t.slice(e)});break}r>e&&o.push({text:t.slice(e,r)});let s=t.indexOf("}",r);if(s<0)throw new u(`a "{" at character ${r+1} is never closed`);let a=t.slice(r+1,s),i=E(a),l=(i>=0?a.slice(0,i):a).trim(),f=i>=0?U(a.slice(i+1)):void 0,c=E(l);if(c>=0&&b.includes(l.slice(c+1).split(":")[0].trim()))throw new u('only "capital" may follow another formatter, like {n | words | capital}');o.push({expr:w(l),source:l,...f?.format?{format:f.format}:{},...f&&f.args.length>0?{formatArgs:f.args}:{},...f?.capital?{capital:!0}:{}}),e=s+1}return o}function A(t){let o=new Map;for(let[e,r]of Object.entries(t?.computed??{}))o.set(e,typeof r=="string"?{expr:r}:r);return o}function re(t){let o=A(t);if(o.size===0)return;let e=new Map;for(let[r,s]of o)try{e.set(r,w(s.expr))}catch(a){if(!(a instanceof p))throw a}return e}function Z(t,o,e=new Set){let r=A(t).get(o);if(!r||e.has(o))return!1;let s;try{s=w(r.expr)}catch{return!1}let a=M(s);if(a.edges.length>0||a.sweeps.length>0||[...a.functions].some(c=>c==="out"||c==="in"||c==="all"))return!1;let i=t.fields,l=c=>i instanceof Set?i.has(c):Object.hasOwn(i,c),f=new Set([...e,o]);return[...a.names].every(c=>l(c)||Z(t,c,f))}export{M as a,p as b,w as c,u as d,Y as e,A as f,re as g,Z as h};
|
|
@@ -0,0 +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{H as k,S as n,a as t,oa as o}from"./chunk.MQ7FNHXG.js";import{b as p}from"./chunk.AJZBJBMO.js";var f=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.2EJAIT33.js","./chunk.EUGWV3S6.js","./chunk.6XJP7F3I.js","./chunk.NPX7SPXM.js","./chunk.OE4QOBJF.js","./chunk.74RMHUCX.js","./chunk.GZHZLJBF.js","./chunk.I3SQJ2L2.js","./chunk.OJGHDWI6.js","./chunk.FUJM7GDV.js","./chunk.MWZK3HVG.js","./chunk.3D5T3XIE.js","./chunk.GR5Q4HTW.js","./chunk.QT4XGC5Z.js","./chunk.MQ7FNHXG.js","./chunk.WLPTY4BF.js","./chunk.AJZBJBMO.js"]),import("./chunk.NWWMUOZM.js")))),y=f.part((e,r)=>e.drawFiles(r),{quiet:!0});var d=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.GZHZLJBF.js","./chunk.I3SQJ2L2.js","./chunk.OJGHDWI6.js","./chunk.FUJM7GDV.js","./chunk.MWZK3HVG.js","./chunk.3D5T3XIE.js","./chunk.GR5Q4HTW.js","./chunk.QT4XGC5Z.js","./chunk.MQ7FNHXG.js","./chunk.WLPTY4BF.js","./chunk.AJZBJBMO.js"]),import("./chunk.HVTGPEVW.js")))),I=d.part((e,r)=>e.drawLinkedRecord(r),{quiet:!0}),w=d.part((e,r)=>e.drawLinkedPicker(r),{what:"Picking a linked record"});var s=p(n(),1),m=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.GZHZLJBF.js","./chunk.I3SQJ2L2.js","./chunk.OJGHDWI6.js","./chunk.FUJM7GDV.js","./chunk.MWZK3HVG.js","./chunk.3D5T3XIE.js","./chunk.GR5Q4HTW.js","./chunk.QT4XGC5Z.js","./chunk.MQ7FNHXG.js","./chunk.WLPTY4BF.js","./chunk.AJZBJBMO.js"]),import("./chunk.SITFEJES.js")))),E=m.part((e,r)=>(0,s.jsx)(e.RepeatPicker,{...r}),{quiet:!0}),W=m.part((e,r)=>(0,s.jsx)(e.RepeatEditor,{...r}),{quiet:!0});var a=p(k(),1),i=p(n(),1),c=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.MWZK3HVG.js","./chunk.3D5T3XIE.js","./chunk.GR5Q4HTW.js","./chunk.QT4XGC5Z.js","./chunk.MQ7FNHXG.js","./chunk.WLPTY4BF.js","./chunk.AJZBJBMO.js"]),import("./chunk.DFVVS6C5.js")))),l=c.part((e,r)=>(0,i.jsx)(e.WhenInput,{...r}),{quiet:!0});function M(e){return(0,i.jsx)(a.Suspense,{fallback:(0,i.jsx)("span",{"data-graview-when-arriving":"",style:{display:"inline-block",minHeight:24}}),children:(0,i.jsx)(l,{...e})})}var N=()=>c.load().then(()=>{},()=>{});export{y as a,I as b,w as c,E as d,W as e,M as f,N as g};
|