graview 0.1.56 → 0.1.58
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.27CW6SCT.js +3 -0
- package/dist/preview/{chunk.UQQAGT3R.js → chunk.2EDC63RI.js} +1 -1
- package/dist/preview/chunk.2VYNNWW5.js +18 -0
- package/dist/preview/chunk.32FMOHZK.js +1 -0
- package/dist/preview/{chunk.VLBY66PB.js → chunk.34TW32TB.js} +2 -2
- package/dist/preview/{chunk.AM2YRNOQ.js → chunk.3FCOFEGW.js} +1 -1
- package/dist/preview/{chunk.LKK7VQBA.js → chunk.3OYGXYQY.js} +1 -1
- package/dist/preview/{chunk.XJFAUOJS.js → chunk.3YZHZGTM.js} +1 -1
- package/dist/preview/{chunk.AIK3Z25Y.js → chunk.43OKZU73.js} +1 -1
- package/dist/preview/{chunk.QSO5BP2H.js → chunk.4444RPWW.js} +1 -1
- package/dist/preview/{chunk.4EY6WPSM.js → chunk.47JQPYXL.js} +2 -2
- package/dist/preview/{chunk.N3Q5CPVA.js → chunk.4AFFPYOK.js} +1 -1
- package/dist/preview/chunk.4GGPPCMM.js +1 -0
- package/dist/preview/{chunk.PRV3KYT6.js → chunk.4HSH2UIK.js} +2 -2
- package/dist/preview/{chunk.7Z4USR3Y.js → chunk.4KC35UNR.js} +1 -1
- package/dist/preview/{chunk.LP3SHWJG.js → chunk.4Y2JTY6Q.js} +1 -1
- package/dist/preview/{chunk.6HLKAUWF.js → chunk.5ICIMQE6.js} +1 -1
- package/dist/preview/{chunk.KY7QD22S.js → chunk.5IEFTFKQ.js} +1 -1
- package/dist/preview/{chunk.JHFHIG4P.js → chunk.64R3K2OE.js} +1 -1
- package/dist/preview/chunk.6K7EN2YI.js +1 -0
- package/dist/preview/{chunk.45VIF2SX.js → chunk.6VC6AGYV.js} +2 -2
- package/dist/preview/{chunk.PMPDLE56.js → chunk.6W7O5YLL.js} +1 -1
- package/dist/preview/chunk.7BBGRTXM.js +5 -0
- package/dist/preview/{chunk.CGM7OER2.js → chunk.7MSFDD7J.js} +1 -1
- package/dist/preview/chunk.7SQAKSJD.js +2 -0
- package/dist/preview/{chunk.VEOS25PQ.js → chunk.7V23SXGJ.js} +1 -1
- package/dist/preview/{chunk.C2VFDBSG.js → chunk.A6C4AGJJ.js} +1 -1
- package/dist/preview/chunk.ACYDJQRC.js +1 -0
- package/dist/preview/{chunk.NBLMANHT.js → chunk.ARWBIBSI.js} +1 -1
- package/dist/preview/{chunk.KBL4Y4UN.js → chunk.B2GVJD6H.js} +1 -1
- package/dist/preview/{chunk.2DETYEJM.js → chunk.B3WZHPM3.js} +1 -1
- package/dist/preview/{chunk.IT763BYH.js → chunk.BB33TI4S.js} +1 -1
- package/dist/preview/{chunk.3X3GLNWQ.js → chunk.BKVBX2YB.js} +1 -1
- package/dist/preview/{chunk.VYW7DSUW.js → chunk.BTVBZ6KE.js} +2 -2
- package/dist/preview/{chunk.JZDKHWRL.js → chunk.CCWPF5PK.js} +1 -1
- package/dist/preview/{chunk.QAIYYIZQ.js → chunk.D5KTGX7F.js} +1 -1
- package/dist/preview/{chunk.YLMOGGEP.js → chunk.DBZHRYBK.js} +1 -1
- package/dist/preview/{chunk.GUP7LC5O.js → chunk.DM767F2Q.js} +2 -2
- package/dist/preview/{chunk.65Q5MKDW.js → chunk.E34OQVSR.js} +1 -1
- package/dist/preview/{chunk.N7EEPFYV.js → chunk.E5MSFXL6.js} +1 -1
- package/dist/preview/{chunk.DTSTUC2W.js → chunk.EB4NVTJL.js} +1 -1
- package/dist/preview/{chunk.5MS2TQFX.js → chunk.ELAMMS2V.js} +1 -1
- package/dist/preview/chunk.ELERUERU.js +1 -0
- package/dist/preview/{chunk.XGCOWCA2.js → chunk.EPPXZZPK.js} +1 -1
- package/dist/preview/chunk.EQTSV7BK.js +2 -0
- package/dist/preview/{chunk.QNNRSPIJ.js → chunk.ETBFD76E.js} +1 -1
- package/dist/preview/{chunk.OBUKZQCZ.js → chunk.F7SF6EP2.js} +1 -1
- package/dist/preview/chunk.GCBZ3WE2.js +1 -0
- package/dist/preview/{chunk.ONGZ3YQF.js → chunk.GDOTG7YA.js} +1 -1
- package/dist/preview/{chunk.SVAQGVS4.js → chunk.GEB2DFBU.js} +1 -1
- package/dist/preview/chunk.GKSUTAIX.js +1 -0
- package/dist/preview/{chunk.VDD3RHLB.js → chunk.GP7F3PEF.js} +1 -1
- package/dist/preview/{chunk.AKW6NR3X.js → chunk.GQBJVCSM.js} +1 -1
- package/dist/preview/chunk.GUEHKCWN.js +1 -0
- package/dist/preview/{chunk.NQ4VGKEC.js → chunk.GZB6A6KF.js} +1 -1
- package/dist/preview/{chunk.2E6EWVWR.js → chunk.H3BFHI3G.js} +1 -1
- package/dist/preview/{chunk.7RJGEU3Y.js → chunk.HEWVPXRE.js} +1 -1
- package/dist/preview/{chunk.J3YBEZKE.js → chunk.HMFJT4KO.js} +1 -1
- package/dist/preview/{chunk.NFU4UM6F.js → chunk.HS3GHAUR.js} +1 -1
- package/dist/preview/{chunk.NPAWTPLQ.js → chunk.HT2BEOEV.js} +1 -1
- package/dist/preview/{chunk.7O6Z3BFR.js → chunk.HXRV3WVJ.js} +1 -1
- package/dist/preview/{chunk.MJMVGW6Z.js → chunk.HZB5F476.js} +1 -1
- package/dist/preview/{chunk.WPJVMVAL.js → chunk.I3WWCPQ2.js} +1 -1
- package/dist/preview/{chunk.IUQOSPQX.js → chunk.IDJPBWL2.js} +1 -1
- package/dist/preview/{chunk.4KMY24YC.js → chunk.ILRCNTGT.js} +1 -1
- package/dist/preview/{chunk.T6HG2XIP.js → chunk.INZQ6WZM.js} +1 -1
- package/dist/preview/{chunk.ILSK2E3R.js → chunk.IULQRCEE.js} +1 -1
- package/dist/preview/{chunk.IF4FCQPG.js → chunk.JB7TTJXQ.js} +1 -1
- package/dist/preview/{chunk.E4HSSGF7.js → chunk.JES77WXG.js} +1 -1
- package/dist/preview/{chunk.SRC37GNP.js → chunk.JGKA5QBX.js} +1 -1
- package/dist/preview/chunk.JOAN54PN.js +1 -0
- package/dist/preview/{chunk.2YNZVNCA.js → chunk.JUNMJYH5.js} +1 -1
- package/dist/preview/{chunk.MORMTKVR.js → chunk.KFQSYCY3.js} +1 -1
- package/dist/preview/{chunk.TXWCTHMI.js → chunk.KJ264E6K.js} +1 -1
- package/dist/preview/{chunk.NUE5VG4G.js → chunk.KJHPDL4N.js} +1 -1
- package/dist/preview/{chunk.SOTB6C5A.js → chunk.KKNDX4JT.js} +1 -1
- package/dist/preview/chunk.KNYLY7MH.js +1 -0
- package/dist/preview/{chunk.YL5ZCRHQ.js → chunk.KWJWAIQJ.js} +1 -1
- package/dist/preview/{chunk.V3NPUAPB.js → chunk.KXPRILAO.js} +1 -1
- package/dist/preview/chunk.L7V24JPO.js +1 -0
- package/dist/preview/chunk.LA4CPZ2N.js +1 -0
- package/dist/preview/{chunk.E33EJU3Q.js → chunk.LCPGZK7G.js} +1 -1
- package/dist/preview/chunk.LDAYDCUO.js +1 -0
- package/dist/preview/{chunk.64IKLRUS.js → chunk.LL2MLSPH.js} +1 -1
- package/dist/preview/{chunk.22MIRLL6.js → chunk.LMN4TSAP.js} +1 -1
- package/dist/preview/{chunk.IRMO4FUC.js → chunk.LO3U3P55.js} +1 -1
- package/dist/preview/{chunk.DH7M57SE.js → chunk.LRUNFSHP.js} +1 -1
- package/dist/preview/{chunk.MLRPCZVS.js → chunk.LY3YOWKV.js} +1 -1
- package/dist/preview/{chunk.DWMAFMYZ.js → chunk.M34CS7DI.js} +1 -1
- package/dist/preview/{chunk.I2C5LPB5.js → chunk.MQ5HBUBL.js} +1 -1
- package/dist/preview/chunk.MV3AJ7JH.js +1 -0
- package/dist/preview/chunk.MYNQWWCL.js +1 -0
- package/dist/preview/{chunk.E4EN4X5F.js → chunk.NFX24NUI.js} +1 -1
- package/dist/preview/{chunk.PJCVFYFU.js → chunk.NKC3JILT.js} +1 -1
- package/dist/preview/{chunk.MFDSWA2W.js → chunk.NOFWGDOT.js} +1 -1
- package/dist/preview/{chunk.QW3QLE53.js → chunk.O4CVKTPJ.js} +1 -1
- package/dist/preview/{chunk.TAIYNHSW.js → chunk.OASYYMG5.js} +1 -1
- package/dist/preview/{chunk.G3ORIU7C.js → chunk.OHQ3JH65.js} +1 -1
- package/dist/preview/{chunk.2OX4YI46.js → chunk.PBCNOFQH.js} +1 -1
- package/dist/preview/{chunk.V6X3U3JF.js → chunk.PHC2MI4C.js} +1 -1
- package/dist/preview/chunk.PM3SYXKB.js +1 -0
- package/dist/preview/{chunk.K2JE3PD7.js → chunk.POBMGM3X.js} +1 -1
- package/dist/preview/{chunk.LLOZKUCA.js → chunk.PZG3B7F4.js} +1 -1
- package/dist/preview/chunk.QB25SMP6.js +1 -0
- package/dist/preview/{chunk.FCUDBMGC.js → chunk.QGV7H7RQ.js} +1 -1
- package/dist/preview/chunk.QPXXY2DL.js +1133 -0
- package/dist/preview/chunk.QUJS63OJ.js +13 -0
- package/dist/preview/{chunk.Q7X2IVLH.js → chunk.R7LFO7KI.js} +1 -1
- package/dist/preview/{chunk.7NP2I2UP.js → chunk.RE7DELSR.js} +1 -1
- package/dist/preview/{chunk.XY5EVI22.js → chunk.RRKYJYZJ.js} +1 -1
- package/dist/preview/{chunk.APXYWI3L.js → chunk.S2H7B6RG.js} +1 -1
- package/dist/preview/chunk.S5MGE2U5.js +1 -0
- package/dist/preview/{chunk.D6KF72MZ.js → chunk.SDVPJYVF.js} +1 -1
- package/dist/preview/{chunk.FBR4HJ2Q.js → chunk.SPXRLO5K.js} +1 -1
- package/dist/preview/chunk.TBW7CU4G.js +1 -0
- package/dist/preview/{chunk.USB6B6L3.js → chunk.TF5I4VHX.js} +1 -1
- package/dist/preview/{chunk.4EUH6TLG.js → chunk.TJ647W6J.js} +2 -2
- package/dist/preview/{chunk.ZFXHZZHW.js → chunk.TJOXNEFU.js} +1 -1
- package/dist/preview/{chunk.WMB2NNBD.js → chunk.TUUVVO5U.js} +1 -1
- package/dist/preview/{chunk.AZUTYY2S.js → chunk.TWKXSLYY.js} +4 -4
- package/dist/preview/chunk.TXGNPW76.js +1 -0
- package/dist/preview/{chunk.VSM72NVF.js → chunk.U6O3MMQR.js} +1 -1
- package/dist/preview/{chunk.EC5IWN74.js → chunk.UAP5M3CD.js} +2 -2
- package/dist/preview/chunk.UDCDK7XJ.js +4 -0
- package/dist/preview/chunk.UKMVJV6Q.js +1 -0
- package/dist/preview/chunk.UUG3BYVN.js +1 -0
- package/dist/preview/{chunk.RDL6652E.js → chunk.VG7OWV2H.js} +1 -1
- package/dist/preview/{chunk.BNEOLRQG.js → chunk.VHSWBFXB.js} +1 -1
- package/dist/preview/{chunk.D4LN33J2.js → chunk.VUPLFUUS.js} +1 -1
- package/dist/preview/chunk.WJFQIE3Y.js +1 -0
- package/dist/preview/{chunk.AQCU6TPV.js → chunk.WNQFHMNR.js} +1 -1
- package/dist/preview/{chunk.CKV2QCH5.js → chunk.WNSC3RWD.js} +1 -1
- package/dist/preview/{chunk.CU2NQ5WF.js → chunk.WQOI6BLM.js} +1 -1
- package/dist/preview/{chunk.RXYE2DAJ.js → chunk.WXIEQZLY.js} +1 -1
- package/dist/preview/{chunk.2HZGUVB2.js → chunk.XN2RVXOI.js} +1 -1
- package/dist/preview/{chunk.USQNSNIA.js → chunk.XU34T2H4.js} +1 -1
- package/dist/preview/{chunk.HFVMGTNL.js → chunk.YD3TKV6P.js} +2 -2
- package/dist/preview/{chunk.K5YLQAFW.js → chunk.YHTE34RN.js} +1 -1
- package/dist/preview/chunk.YIA2EDVF.js +3 -0
- package/dist/preview/{chunk.JQY2UKU6.js → chunk.YP2F5UGY.js} +1 -1
- package/dist/preview/{chunk.D6BMAGPR.js → chunk.YS6GVLIP.js} +1 -1
- package/dist/preview/{chunk.O6LDZWLR.js → chunk.YZZONE4M.js} +1 -1
- package/dist/preview/{chunk.5B4HNQGR.js → chunk.ZN5HTWSI.js} +1 -1
- package/dist/preview/{chunk.AKVBU5K5.js → chunk.ZOHMWSHD.js} +1 -1
- package/dist/preview/index.html +50 -50
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.2BLRCT3E.js +0 -1
- package/dist/preview/chunk.3V2WH6F7.js +0 -1
- package/dist/preview/chunk.4YI6656P.js +0 -1
- package/dist/preview/chunk.5MSWUTDB.js +0 -1
- package/dist/preview/chunk.6Q6BW4QT.js +0 -2
- package/dist/preview/chunk.7U2JO7ET.js +0 -3
- package/dist/preview/chunk.7Z2PRPYE.js +0 -1
- package/dist/preview/chunk.AGTFYPXY.js +0 -1
- package/dist/preview/chunk.BT7RLFPO.js +0 -1
- package/dist/preview/chunk.DPPT6WAJ.js +0 -2
- package/dist/preview/chunk.DVG47BK3.js +0 -1
- package/dist/preview/chunk.DZYLH5IM.js +0 -1
- package/dist/preview/chunk.E5XNQTEU.js +0 -1
- package/dist/preview/chunk.F5RN6YXG.js +0 -4
- package/dist/preview/chunk.FOQENWF5.js +0 -1
- package/dist/preview/chunk.GNQW4JOG.js +0 -18
- package/dist/preview/chunk.HVN2DVP3.js +0 -1
- package/dist/preview/chunk.JL4DGITZ.js +0 -1
- package/dist/preview/chunk.K4MO22RM.js +0 -1
- package/dist/preview/chunk.KMEKMCKG.js +0 -3
- package/dist/preview/chunk.LVOVPU64.js +0 -1
- package/dist/preview/chunk.MEJUAV3Y.js +0 -1
- package/dist/preview/chunk.OYGPNO7A.js +0 -1
- package/dist/preview/chunk.QYFZ7AZS.js +0 -1132
- package/dist/preview/chunk.RR2IFETZ.js +0 -1
- package/dist/preview/chunk.T2RME6XF.js +0 -1
- package/dist/preview/chunk.TAJ2R44N.js +0 -1
- package/dist/preview/chunk.TQCRFZ53.js +0 -1
- package/dist/preview/chunk.UE5YS3GN.js +0 -1
- package/dist/preview/chunk.VIQ6EF2O.js +0 -1
- package/dist/preview/chunk.XE72DFBV.js +0 -13
- package/dist/preview/chunk.YEJ4LNUP.js +0 -5
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Ge}from"./chunk.BJUUSIQY.js";import{a as Ke}from"./chunk.
|
|
2
|
-
`),unknownWords:r,questions:c,toolMistakes:d}}var Sn=e=>/^(?:aggregate|kind):([^,]+)$/.exec(e)?.[1];function Xe(e,n){let t=e.about??[];if(e.field!==void 0&&e.on!==void 0&&n(e.on))return{on:"field",id:e.on,field:e.field};let i=t.filter(n);if(i.length>1)return{on:"selection",ids:i};if(e.on!==void 0&&n(e.on))return{on:"record",id:e.on};if(i.length===1)return{on:"record",id:i[0]};let o=[e.on,...t].map(r=>r===void 0?void 0:Sn(r)).find(r=>r!==void 0);return e.place!==void 0?{on:"lens",place:e.place,...o?{kind:o}:{}}:o!==void 0?{on:"list",kind:o}:{on:"place",place:"home"}}var Y=e=>e.on==="record"||e.on==="field"?[e.id]:e.on==="selection"?e.ids:e.on==="act"&&e.id!==void 0?[e.id]:[],ye=(e,n)=>e.tryDefinition(n)?.fields?.shape??{},V=(e,n)=>e.tryDefinition(n)?.edges??{},ge=(e,n)=>new Set(e.tryDefinition(n)?.display?.hide??[]),L=(e,n)=>le(e.tryDefinition(n.kind),n),$e=(e,n,t)=>Ne(e.tryDefinition(n),t)||B(t),Ce=e=>typeof e=="boolean"?e?"yes":"no":String(e);function me(e,n){let t=e.kindsKeptFrom(n);return new Set(e.schema.kinds.filter(i=>!t.has(i)))}function Re(e,n,t,i){if(!e.permits(n,t).ok)return!1;if(!i)return!0;try{return e.previewAll([n],{author:t}).ops.length>0}catch{return!1}}function he(e,n,t){let i=e,{principal:o}=t,r=t.each??8,c=Z(i)?.store??i,d=c.seenBy(o),s=c.schema,f=me(c,o),a=l=>{let m=d.graph.getNode(l);return m&&f.has(m.kind)?m:void 0},p=c.allMutations(),h=new Map(p.map(l=>[l.name,l])),b=[],C=new Set,A=l=>{C.has(l.id)||(C.add(l.id),b.push(l))},g=l=>l.slice(0,r),x=Y(n).filter(l=>a(l)!==void 0);if(Y(n).length>0&&x.length===0)return{target:n,candidates:[]};let O=x.length===1?a(x[0]):void 0,k=O?.kind??(n.on==="list"?n.kind:n.on==="lens"?n.kind??t.places?.find(l=>l.as===n.place)?.kind:void 0)??(n.on==="selection"?a(x[0])?.kind:void 0);if(k!==void 0&&!f.has(k))return{target:n,candidates:[]};let u=(l,m)=>`act:${l}${Object.keys(m).length>0?`:${Object.values(m).map(R=>String(R)).join(",")}`:""}`,w=(l,m,R,E,$)=>{l.destructive||Object.values(m).some(y=>typeof y=="string"&&c.graph.has(y)&&a(y)===void 0)||Re(c,{name:l.name,args:{...m}},o,E.length===0)&&A({type:"act",id:u(l.name,m),label:R,description:$??l.description??R,mutation:l.name,args:m,asks:E})};if(n.on!=="place"||t.acts)if(t.acts)for(let l of t.acts){let m=h.get(l.mutation);!m||l.destructive||n.on==="act"&&l.mutation!==n.act||w(m,l.args,l.label,(l.open??[]).filter(R=>!R.optional).map(R=>R.name),l.why)}else{let l=O?[O]:[];for(let m of p){if(n.on==="act"&&m.name!==n.act)continue;let R=m.input.shape??{},E=$=>Object.entries(R).filter(([y,v])=>y!==$&&v.safeParse?.(void 0).success===!1).map(([y])=>y);if(m.subject)for(let $ of l)ce(s,m).includes($.kind)&&w(m,{[m.subject.arg]:$.id},`${m.title??B(m.name)}: ${L(s,$)}`,E(m.subject.arg));else k!==void 0&&(m.creates??[]).includes(k)&&w(m,{},m.title??B(m.name),E(void 0))}}let T=b.filter(l=>l.type==="act");b.splice(0,b.length,...g(T));let F=(l,m)=>{let R=Le(s,p).get(l.kind),E=ye(s,l.kind),$=ge(s,l.kind),y=[];for(let[v,j]of Object.entries(E)){if(m!==void 0?v!==m:$.has(v)||l[v]!==void 0)continue;let D=ue(j),J=D?.type==="enum"?D.options??[]:D?.type==="boolean"?[!0,!1]:[];if(J.length===0)continue;let _=(R?.get(v)??[]).map(N=>h.get(N)).find(N=>N?.subject!==void 0&&Re(c,{name:N.name,args:{[N.subject.arg]:l.id,[v]:J.find(Se=>Se!==l[v])??J[0]}},o,!0));if(_?.subject)for(let N of J)l[v]!==N&&y.push({type:"fill",id:`fill:${l.id}:${v}:${Ce(N)}`,label:`${$e(s,l.kind,v)}: ${Ce(N)}`,description:`Set ${$e(s,l.kind,v).toLowerCase()} of ${L(s,l)} to ${Ce(N)}`,record:l.id,field:v,value:N,call:{name:_.name,args:{[_.subject.arg]:l.id,[v]:N}}})}for(let[v,j]of Object.entries(V(s,l.kind))){if(m!==void 0&&v!==m)continue;let D=j.to==="*"?[...f]:j.to.filter(I=>f.has(I)),J=new Set(d.graph.out(l.id,v).map(I=>I.id)),_=p.find(I=>(I.connects??[]).includes(v)&&I.subject!==void 0&&ce(s,I).includes(l.kind));if(!_?.subject)continue;let N=De(_.input).find(I=>I.name!==_.subject.arg);if(!N)continue;let Se=D.flatMap(I=>N.kinds.length===0||N.kinds.includes(I)?d.graph.nodesOfKind(I):[]).filter(I=>I.id!==l.id&&!J.has(I.id)&&a(I.id)!==void 0);for(let I of g(Se)){let Me={name:_.name,args:{[_.subject.arg]:l.id,[N.name]:I.id}};Re(c,Me,o,!0)&&y.push({type:"fill",id:`fill:${l.id}:${v}:${I.id}`,label:`${B(v)}: ${L(s,I)}`,description:`Link ${L(s,l)} to ${L(s,I)}${j.description?` as ${j.description}`:""}`,record:l.id,field:v,value:I.id,call:Me})}}return y};if(n.on==="field"&&O)for(let l of F(O,n.field))A(l);else if(O&&n.on==="record")for(let l of g(F(O)))A(l);let q=l=>{let m=W(s,l).toLowerCase(),R=[{type:"panel",id:`panel:${l}:list`,label:`A list of ${m}`,description:`Every ${G(s.tryDefinition(l),l).toLowerCase()} this viewer may see, as a list`,panel:{lens:"blocks",kind:l}}],E=ge(s,l);for(let[$,y]of Object.entries(ye(s,l))){if(E.has($))continue;let v=ue(y),j=$e(s,l,$).toLowerCase();if(v?.type==="enum")R.push({type:"panel",id:`panel:${l}:group:${$}`,label:`${K(m)} by ${j}`,description:`A list of ${m} grouped by ${j}`,panel:{lens:"blocks",kind:l,group:$}}),R.push({type:"panel",id:`panel:${l}:columns:${$}`,label:`Columns of ${m} by ${j}`,description:`${K(m)} in a column for each ${j}`,panel:{lens:"columns",kind:l,column:$}});else if(v?.type==="number"||v?.type==="integer"||v?.type==="date"||v?.type==="datetime"){let D=v.type==="date"||v.type==="datetime";R.push({type:"panel",id:`panel:${l}:sort:${$}`,label:`${K(m)} by ${j}`,description:`A list of ${m}, the ${D?"latest":"highest"} ${j} first`,panel:{lens:"blocks",kind:l,sort:{by:$,direction:"desc"}}}),D&&R.push({type:"panel",id:`panel:${l}:calendar:${$}`,label:`A calendar of ${m}`,description:`${K(m)} on a calendar by ${j}`,panel:{lens:"calendar",kind:l,start:$}})}}return R},H=n.on==="place"?[...f]:k!==void 0?[k]:[];for(let l of H)for(let m of g(q(l)))A(m);for(let l of g((t.places??[]).filter(m=>m.kind===void 0?n.on==="place":f.has(m.kind)&&(n.on==="place"||m.kind===k))))n.on==="lens"&&l.as===n.place||A({type:"place",id:`place:${l.as}`,label:l.title,description:`Go to ${l.title}`,place:l.as});if(O){let l=[];for(let[m,R]of Object.entries(V(s,O.kind)))for(let E of d.graph.out(O.id,m))a(E.id)&&l.push({type:"record",id:`record:${E.id}`,label:L(s,E),description:`${K(R.description??B(m))}: ${L(s,E)}`,record:E.id,relation:m});for(let m of s.kinds)for(let[R,E]of Object.entries(V(s,m)))if(!(E.to!=="*"&&!E.to.includes(O.kind)))for(let $ of d.graph.in(O.id,R))$.kind===m&&a($.id)&&l.push({type:"record",id:`record:${$.id}`,label:L(s,$),description:`${K(E.inverse??B(R))}: ${L(s,$)}`,record:$.id,relation:R});for(let m of g(l))A(m)}else if(n.on==="list"||n.on==="lens")for(let l of g(k!==void 0?d.graph.nodesOfKind(k):[]))a(l.id)&&A({type:"record",id:`record:${l.id}`,label:L(s,l),description:`Open ${L(s,l)}`,record:l.id});else if(n.on==="selection")for(let l of x){let m=a(l);A({type:"record",id:`record:${l}`,label:L(s,m),description:`Open ${L(s,m)}`,record:l})}return{target:n,candidates:b}}var K=e=>e&&`${e[0].toUpperCase()}${e.slice(1)}`,xn={columns:["board","kanban","column","lane","pipeline","stage","funnel"],board:["board","map","floor","layout","seat","slot"],calendar:["calendar","schedule","date","due","month","week","agenda","deadline","day"],timeline:["timeline","gantt","schedule","roadmap","span"],coverage:["coverage","matrix","grid","gap"],plan:["plan","floor","map","region","area"],blocks:["list","table","summary","overview","dashboard","card"]},On=new Set(["a","an","the","of","for","my","our","me","us","to","with","and","in","on","by","that","which","i","we","want","need","show","open","go","draw","make","new","view","views","panel","panels","page","lens","please","all","every","some","see","can","could","would","like","one","what","is","are","do","does","here","there","how","it","this","these","those"]),ne=e=>e.length>3&&e.endsWith("ies")?`${e.slice(0,-3)}y`:e.length>3&&e.endsWith("s")&&!e.endsWith("ss")?e.slice(0,-1):e,Te=e=>e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").split(/[^a-z0-9]+/).filter(Boolean);function Ze(e,n,t){let i=e,o=Z(i)?.store??i,r=o.schema,c=me(o,t.principal),d=o.seenBy(t.principal),s=Y(n),f=new Set;for(let u of s){let w=d.graph.getNode(u)?.kind;w!==void 0&&c.has(w)&&f.add(w)}if(s.length>0&&f.size===0)return[];if(n.on==="list"&&f.add(n.kind),n.on==="lens"){let u=n.kind??t.places.find(w=>w.as===n.place)?.kind;u!==void 0&&f.add(u)}let a=new Map;for(let u of r.kinds){if(!c.has(u))continue;let w=r.tryDefinition(u);for(let T of[u,G(w,u),W(r,u)])for(let F of Te(T))a.set(ne(F),u)}let p=Te(t.said??"").filter(u=>!On.has(u)),h=new Set,b=[];for(let u of p){let w=a.get(ne(u));w!==void 0?h.add(w):b.push(ne(u))}let C=h.size>0?h:f;if((t.said??"").trim()!==""&&p.length===0)return[];if(C.size===0&&p.length===0)return[];let A=[];t.places.forEach((u,w)=>{if(u.hidden||n.on==="lens"&&u.as===n.place)return;let T=u.over??(u.kind!==void 0?[u.kind]:[]);if(T.length>0&&!T.some(H=>c.has(H)))return;let F=T.some(H=>C.has(H)),q=!F&&(u.reads??[]).some(H=>C.has(H));C.size>0&&!F&&!q||A.push({place:u,own:F,reads:q,at:w})});let g=u=>new Set(Te(u.title).map(ne)),x=new Set(b.filter(u=>A.some(({place:w})=>g(w).has(u)))),O=[];for(let{place:u,own:w,reads:T,at:F}of A){let q=g(u),H=new Set((xn[u.lens??""]??[]).map(ne)),l=b.filter($=>q.has($)||H.has($)&&!x.has($)).length,m=b.length-l;if(b.length>0&&l===0)continue;let R=!T&&m===0?"full":"partial",E=(w?4:T?2:1)+l*2-m+(R==="full"?1:0);O.push({view:{place:u.as,title:u.title,...u.kind!==void 0?{kind:u.kind}:{},fit:R},score:E,at:F})}return O.filter((u,w)=>!O.slice(0,w).some(T=>T.view.place===u.view.place&&T.view.title===u.view.title)).sort((u,w)=>w.score-u.score||u.at-w.at).slice(0,t.most??3).map(u=>u.view)}var Ee=new WeakMap;function vn(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619)>>>0;return n.toString(36)}function $n(e,n){let t=e,i=Z(t)?.store??t,o=i.schema,r=me(i,n),d=i.allMutations().filter(A=>!A.destructive&&i.permits({name:A.name,args:{}},n).ok!==!1),s=`${[...r].join(",")}|${d.map(A=>A.name).join(",")}`,f=Ee.get(o)?.get(s);if(f)return f;let a=[...r].map(A=>{let g=ge(o,A),x={};for(let[w,T]of Object.entries(ye(o,A))){if(g.has(w))continue;let F=ue(T);F&&(x[w]=F.type==="enum"?`enum:${(F.options??[]).join("|")}`:F.type)}let O={};for(let[w,T]of Object.entries(V(o,A)))O[w]=T.to==="*"?[...r]:T.to.filter(F=>r.has(F));let k=o.tryDefinition(A),u=Object.entries(k?.fieldAliases??{}).filter(([w,T])=>w in x&&T.length>0);return{kind:A,noun:G(o.tryDefinition(A),A),plural:W(o,A),fields:x,relations:O,...k?.aliases&&k.aliases.length>0?{aliases:k.aliases}:{},...u.length>0?{fieldAliases:Object.fromEntries(u)}:{}}}),p=d.map(A=>({name:A.name,title:A.title??B(A.name),...A.subject?{on:ce(o,A).filter(g=>r.has(g))}:{}})),h={kinds:a,acts:p},b={version:vn(JSON.stringify(h)),...h},C=Ee.get(o)??new Map;return C.set(s,b),Ee.set(o,C),b}var Cn=e=>e.name??e.id??e.kind;function en(e,n,t){let i=e,{principal:o}=t,r=Z(i)?.store??i,c=r.seenBy(o),d=r.schema,s=me(r,o),f=u=>{let w=c.graph.getNode(u);return w&&s.has(w.kind)?w:void 0},a=u=>({id:u.id,kind:u.kind,label:L(d,u)}),p=Y(n),h=p.length===1?f(p[0]):void 0,b=h?Object.fromEntries(Object.keys(ye(d,h.kind)).filter(u=>!ge(d,h.kind).has(u)&&h[u]!==void 0&&u!=="label").map(u=>[u,h[u]])):{},C={on:n.on,...h?{record:{...a(h),fields:b}}:{},...n.on==="field"&&h?{field:n.field}:{},...n.on==="list"&&s.has(n.kind)?{kind:n.kind}:{},...n.on==="lens"?{place:n.place,...n.kind&&s.has(n.kind)?{kind:n.kind}:{}}:{},...n.on==="place"?{place:n.place}:{},...n.on==="act"?{act:n.act}:{}},A=[...new Set([...n.on==="selection"?n.ids:[],...t.selection??[]])].flatMap(u=>{let w=f(u);return w?[a(w)]:[]}),g=[];if(h){for(let u of Object.keys(V(d,h.kind)))for(let w of c.graph.out(h.id,u))f(w.id)&&g.push({...a(w),relation:u,direction:"out"});for(let u of d.kinds)for(let w of Object.keys(V(d,u)))for(let T of c.graph.in(h.id,w))T.kind===u&&f(T.id)&&g.push({...a(T),relation:w,direction:"in"})}let x=c.batches().filter(u=>!u.ops.every(je)).slice(-(t.recent??6)).reverse().map(u=>({intent:u.intent,at:u.at,by:Cn(u.author)})),O=(t.purpose?.jobs??[]).filter(u=>Ge(u,o.roles)&&s.has(u.kind)).map(u=>({name:u.name,ask:u.ask,kind:u.kind})),k=t.purpose&&(t.purpose.for!==void 0||O.length>0)?{...t.purpose.for!==void 0?{for:t.purpose.for}:{},jobs:O}:void 0;return{...t.place!==void 0?{place:t.place}:{},target:C,selection:A,neighbors:g.slice(0,24),recent:x,schema:$n(r,o),...k?{purpose:k}:{},...t.friction?{friction:Qe(t.friction,d)}:{}}}function te(e){if(!e.off)return e.fast??(e.decide?{model:e.name??"decide",decide:e.decide}:void 0)}function U(e){if(e.off)return;if(e.thinking)return e.thinking;let n=e.name??"model";if(e.complete){let t=e.complete;return{model:n,think:({system:i,prompt:o})=>t({prompt:o,system:i})}}if(e.turn){let t=e.turn;return{model:n,think:async({system:i,prompt:o})=>({text:await t({system:i,messages:[{role:"user",content:o}],tools:[],call:async()=>({error:"No tools here."})})})}}}var Pe=(e,n,t)=>e?n/1e6*(e.inputPerMillion??0)+t/1e6*(e.outputPerMillion??0):void 0,Ie=()=>`ai-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;function Rn(e,n,t=[]){let i=o=>{let r=e.graph.getNode(o);return r?le(e.schema.tryDefinition(r.kind),r):"a record"};switch(n.on){case"record":return i(n.id);case"field":return`${i(n.id)} \xB7 ${n.field}`;case"selection":return`${n.ids.length} records`;case"list":return e.schema.tryDefinition(n.kind)?W(e.schema,n.kind):n.kind;case"lens":case"place":return t.find(o=>o.as===n.place)?.title??(n.place==="home"?"Home":n.place);case"act":return n.act}}var nn=e=>e.type!=="act"||e.asks.length===0,be=(e,n)=>({id:e.id,type:e.type,label:e.label,...n!==void 0?{confidence:n}:{}});function Q(e,n){let t=n.interaction??Ie(),i=he(n.store,n.target,{principal:n.principal,...n.acts?{acts:n.acts}:{},...n.places?{places:n.places}:{}}),o=en(n.store,n.target,{principal:n.principal,...n.place?{place:n.place}:{},...n.selection?{selection:n.selection}:{},...n.purpose?{purpose:n.purpose}:{}}),r=[];return{id:t,catalog:i,state:o,entry:{id:t,at:new Date().toISOString(),by:n.by??n.principal,target:n.target,targetLabel:Rn(n.store,n.target,n.places)},usage:r,meter:c=>{r.push(c),e.meter?.({...c,interaction:t})}}}async function ie(e,n,t,i){let o=await e.decide(n,t),{inputTokens:r,outputTokens:c}=o.usage,d=Pe(e.price,r,c);return i({tier:"fast",model:e.model,inputTokens:r,outputTokens:c,...d!==void 0?{costUsd:d}:{}}),o.answers}async function oe(e,n,t,i,o){let r=await e.think({system:n,prompt:t,state:i.state,catalog:i.catalog}),c=r.usage?.inputTokens,d=r.usage?.outputTokens,s=r.usage?.costUsd??(c!==void 0?Pe(e.price,c,d??0):void 0);return o({tier:"thinking",model:e.model,...c!==void 0?{inputTokens:c}:{},...d!==void 0?{outputTokens:d}:{},...s!==void 0?{costUsd:s}:{}}),Ve(r.text)}function re(e,n){let t=new Map(e.map((i,o)=>[`c${o+1}`,i]));return{question:{type:"choice",instructions:n,criteria:Object.fromEntries([...t].map(([i,o])=>[i,`${o.label} \u2014 ${o.description}`]))},of:i=>t.get(i)}}function se(e,n,t){if(e?.type!=="choice")return[];let i=e,o=Object.entries(i.probabilities).sort((r,c)=>c[1]-r[1]);return o.some(([r])=>r===i.choice)||o.unshift([i.choice,i.confidence]),o.flatMap(([r,c])=>{let d=n(r);return d?[{candidate:d,confidence:c}]:[]}).slice(0,t)}var M=(e,n,t,i)=>({interaction:{...e.entry,ask:{kind:t,said:n??""},offered:[],outcome:"failed",failed:i,usage:[...e.usage]},offers:[]}),X="AI isn't on here.";async function tn(e,n,t=3){let i=Q(e,n),o=n.said??"Suggest",r=i.catalog.candidates.filter(nn).slice(0,24);if(r.length===0)return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:[],outcome:"offered",usage:[]},offers:[]};let c=te(e),d=U(e),s=[];try{if(c){let{question:f,of:a}=re(r,"Which of these would the person most likely want to do next, here?"),p=await ie(c,{...i.state,candidates:r.map(h=>({id:h.id,type:h.type,says:h.description}))},{next:f},i.meter);s=se(p.next,a,t)}else if(d){let f=await oe(d,'You suggest what a person most likely wants to do next in an app. Answer only JSON: {"pick": [candidate ids, best first]}. Pick only ids from the candidates.',JSON.stringify({state:i.state,candidates:r.map(p=>({id:p.id,says:p.description}))}),i,i.meter);s=(Array.isArray(f?.pick)?f.pick.filter(p=>typeof p=="string"):[]).flatMap(p=>r.filter(h=>h.id===p)).slice(0,t).map(p=>({candidate:p}))}else return M(i,o,"suggest",X)}catch(f){return M(i,o,"suggest",f instanceof Error?f.message:String(f))}return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:s.map(({candidate:f,confidence:a})=>be(f,a)),outcome:"offered",usage:[...i.usage]},offers:s.map(({candidate:f})=>f)}}var Tn=e=>`several:${e}`;async function it(e,n,t=2){let i=Q(e,{...n,acts:[]}),o=n.said??"Suggest for the chosen",r=n.target.on==="selection"?n.target.ids.length:1,d=[...n.shared.map(a=>({type:"act",id:Tn(a.id),label:a.label,description:`${a.label}, for all ${r} chosen`,mutation:a.mutation,args:a.args,asks:[]})),...i.catalog.candidates.filter(a=>a.type==="panel"||a.type==="place")].slice(0,24),s=te(e);if(!s)return M(i,o,"suggest",X);if(d.length===0)return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:[],outcome:"offered",usage:[]},offers:[]};let f;try{let{question:a,of:p}=re(d,`Which of these would the person most likely want to do next with the ${r} records they chose together?`),h=await ie(s,{...i.state,candidates:d.map(b=>({id:b.id,type:b.type,says:b.description}))},{next:a},i.meter);f=se(h.next,p,t).filter((b,C)=>C===0||b.confidence>=En)}catch(a){return M(i,o,"suggest",a instanceof Error?a.message:String(a))}return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:f.map(({candidate:a,confidence:p})=>be(a,p)),outcome:"offered",usage:[...i.usage]},offers:f.map(({candidate:a})=>a)}}var En=.25;async function on(e,n){let t=Q(e,n),i=n.said??"Fill in",o=t.catalog.candidates.filter(p=>p.type==="fill"),r=new Map;for(let p of o)r.set(p.field,[...r.get(p.field)??[],p]);if(r.size===0)return{interaction:{...t.entry,ask:{kind:"fill",said:i},offered:[],outcome:"offered",usage:[]},offers:[]};let c=te(e),d=U(e),s=[];try{if(c){let p=[...r].map(([b,C],A)=>({key:`f${A+1}`,field:b,...re(C,`Which value fits "${b}" best for this record?`)})),h=await ie(c,t.state,Object.fromEntries(p.map(b=>[b.key,b.question])),t.meter);for(let b of p){let C=!Pn(n.store,n.target,b.field)&&In(n.store,n.target,b.field)!=="one";s.push(...se(h[b.key],b.of,C?3:1).filter((A,g)=>g===0||A.confidence>=.4))}}else if(d){let p=await oe(d,`You fill in a record's fields in an app. Answer only JSON: {"fills": [candidate ids]}, at most one per field, only ids from the candidates.`,JSON.stringify({state:t.state,candidates:o.map(C=>({id:C.id,says:C.description}))}),t,t.meter),h=Array.isArray(p?.fills)?p.fills.filter(C=>typeof C=="string"):[],b=new Set;for(let C of h){let A=o.find(g=>g.id===C);A?.type==="fill"&&!b.has(A.field)&&(b.add(A.field),s.push({candidate:A}))}}else return M(t,i,"fill",X)}catch(p){return M(t,i,"fill",p instanceof Error?p.message:String(p))}let f=t.usage.at(-1)?.model,a=ae(n.store,{interaction:t.id,target:n.target,basis:i,...f?{model:f}:{},proposals:s.flatMap(({candidate:p,confidence:h})=>p.type==="fill"?[{id:p.id,label:p.label,said:p.description,call:p.call,record:p.record,field:p.field,...h!==void 0?{confidence:h}:{}}]:[])},n.principal);return{interaction:{...t.entry,ask:{kind:"fill",said:i},offered:a.proposals.map(p=>({id:p.id,type:"fill",label:p.label,...p.confidence!==void 0?{confidence:p.confidence}:{}})),outcome:"offered",usage:[...t.usage]},offers:[],...a.proposals.length>0?{ghost:a}:{}}}function Pn(e,n,t){let i=n.on==="record"||n.on==="field"?n.id:void 0,o=i?e.graph.getNode(i)?.kind:void 0,r=(o?e.schema.tryDefinition(o)?.fields?.shape:void 0)??{};return t in r}function In(e,n,t){let i=n.on==="record"||n.on==="field"?n.id:void 0,o=i?e.graph.getNode(i)?.kind:void 0;return o?e.schema.tryDefinition(o)?.edges?.[t]?.cardinality:void 0}async function rn(e,n){let t=Q(e,n),i=n.said??"Add one",o=new Set(n.store.allMutations().filter(a=>(a.creates??[]).length>0).map(a=>a.name)),r=t.catalog.candidates.filter(a=>a.type==="act"&&a.asks.length>0&&o.has(a.mutation));if(r.length===0)return M(t,i,"record","Nothing here makes a record.");let c=U(e);if(!c)return M(t,i,"record",X);let d;try{let a=await oe(c,'You propose one new record for an app by filling in an act. Answer only JSON: {"act": a candidate id, "args": {argument: value}}. Use only the candidates, and fill every argument the act asks for with a value that fits the state.',JSON.stringify({ask:i,state:t.state,candidates:r.map(b=>({id:b.id,says:b.description,asks:b.asks}))}),t,t.meter),p=r.find(b=>b.id===a?.act),h=typeof a?.args=="object"&&a.args!==null?a.args:{};p&&(d={act:p,args:Object.fromEntries(Object.entries(h).filter(([b])=>p.asks.includes(b)))})}catch(a){return M(t,i,"record",a instanceof Error?a.message:String(a))}if(!d)return M(t,i,"record","The model named no act this app has here.");let s=t.usage.at(-1)?.model,f=ae(n.store,{interaction:t.id,target:n.target,basis:i,...s?{model:s}:{},proposals:[{id:d.act.id,label:d.act.label,said:d.act.description,call:{name:d.act.mutation,args:{...d.act.args,...d.args}}}]},n.principal);return f.proposals.length===0?M(t,i,"record","What the model proposed could not be made here."):{interaction:{...t.entry,ask:{kind:"record",said:i},offered:f.proposals.map(a=>({id:a.id,type:"act",label:a.said})),outcome:"offered",usage:[...t.usage]},offers:[d.act],ghost:f}}async function sn(e,n){let t=Q(e,n),i=n.said??"Make a panel",o=t.catalog.candidates.filter(a=>a.type==="panel");if(o.length===0)return M(t,i,"panel","Nothing here can be drawn as a panel.");let r=te(e),c=U(e),d;try{if(c){let a=await oe(c,'You choose a panel to draw in an app. Answer only JSON: {"panel": a candidate id, "title": a short title}. Choose only among the candidates.',JSON.stringify({ask:i,state:t.state,candidates:o.map(h=>({id:h.id,says:h.description}))}),t,t.meter),p=o.find(h=>h.id===a?.panel);p&&(d={panel:p,...typeof a?.title=="string"&&a.title.trim()?{title:a.title.trim().slice(0,60)}:{}})}else if(r){let{question:a,of:p}=re(o,`Which panel answers this best: ${i}`),h=se((await ie(r,t.state,{panel:a},t.meter)).panel,p,1)[0];h?.candidate.type==="panel"&&(d={panel:h.candidate,confidence:h.confidence})}else return M(t,i,"panel",X)}catch(a){return M(t,i,"panel",a instanceof Error?a.message:String(a))}if(!d)return M(t,i,"panel","The model named no panel this app can draw.");let s=d.title??d.panel.label,f={title:s,recipe:{...d.panel.panel,title:s}};return{interaction:{...t.entry,ask:{kind:"panel",said:i},offered:[be(d.panel,d.confidence)],outcome:"drawn",panel:f,usage:[...t.usage]},offers:[d.panel],panel:f}}function Fn(e){return e.off?void 0:e.answer}var Mn=`You answer a person's question about what they are looking at in an app, from the state given and nothing else. Answer only JSON: {"answer": one to three short sentences, "pick": [candidate ids that act on the answer, best first, at most three]}. Pick only ids from the candidates, and none when nothing fits. Never say an id to the person.`;async function ot(e,n){let t=Q(e,n),i=n.said.trim(),o=t.catalog.candidates.filter(g=>nn(g)||g.type==="panel"||g.type==="place"||g.type==="record").slice(0,32),r=Fn(e),c=U(e),d=te(e),s="",f=[],a=g=>g.flatMap(x=>o.filter(O=>O.id===x)).slice(0,3).map(x=>({candidate:x}));try{if(r){let g=await r.answer({said:i,target:n.target,targetLabel:t.entry.targetLabel,state:t.state,catalog:{target:t.catalog.target,candidates:o},...n.follows?{follows:n.follows}:{}}),x=g.usage?.inputTokens,O=g.usage?.outputTokens,k=g.usage?.costUsd??(x!==void 0?Pe(r.price,x,O??0):void 0);t.meter({tier:"thinking",model:r.model,...x!==void 0?{inputTokens:x}:{},...O!==void 0?{outputTokens:O}:{},...k!==void 0?{costUsd:k}:{}}),s=typeof g.text=="string"?g.text.trim():"",f=a(g.pick??[])}else if(c){let g=await oe(c,Mn,JSON.stringify({ask:i,about:t.entry.targetLabel,...n.follows?{follows:n.follows}:{},state:t.state,candidates:o.map(x=>({id:x.id,says:x.description}))}),t,t.meter);s=typeof g?.answer=="string"?g.answer.trim():"",f=a(Array.isArray(g?.pick)?g.pick:[])}else if(d&&o.length>0){let{question:g,of:x}=re(o,`Which of these best answers, or acts on: ${i}`),O=await ie(d,{...t.state,asked:i,candidates:o.map(k=>({id:k.id,type:k.type,says:k.description}))},{answer:g},t.meter);f=se(O.answer,x,3),s=f.length>0?`These fit \u201C${i}\u201D.`:""}else return M(t,i,"ask",X)}catch(g){return M(t,i,"ask",g instanceof Error?g.message:String(g))}if(!s&&f.length===0){let g=n.target.on==="place"||n.target.on==="lens"?n.target.place:void 0,x=n.target.on==="list"||n.target.on==="lens"?n.target.kind:void 0;return Be(n.store,{type:"unanswered",question:i,...g?{place:g}:{},...x?{kind:x}:{}},n.principal),M(t,i,"ask","The AI had no answer to that here.")}let p=t.usage.at(-1)?.model,h=f.flatMap(({candidate:g,confidence:x})=>{let O=ke(g);return O?[{...O,...x!==void 0?{confidence:x}:{}}]:[]}),b=h.length>0?ae(n.store,{interaction:t.id,target:n.target,basis:i,...p?{model:p}:{},proposals:h},n.principal):void 0,C=f.map(({candidate:g})=>g).filter(g=>ke(g)===void 0),A=[...C.map(g=>be(g,f.find(x=>x.candidate===g)?.confidence)),...(b?.proposals??[]).map(g=>({id:g.id,type:g.field!==void 0?"fill":"act",label:g.label,...g.confidence!==void 0?{confidence:g.confidence}:{}}))];return{interaction:{...t.entry,ask:{kind:"ask",said:i},offered:A,outcome:"offered",...s?{answer:s}:{},usage:[...t.usage]},offers:C,...b&&b.proposals.length>0?{ghost:b}:{},...s?{answer:s}:{}}}function ae(e,n,t){let i=n.proposals.flatMap(o=>{try{let r=e.previewAll([o.call],{author:t}),c=r.ops.map(d=>d.intent).join("; ");return r.ops.length>0?[{...o,said:c||o.said}]:[]}catch{return[]}});return{...n,proposals:i}}function ke(e){if(e.type==="fill")return{id:e.id,label:e.label,said:e.description,call:e.call,record:e.record,field:e.field};if(e.type==="act"&&e.asks.length===0)return{id:e.id,label:e.label,said:e.description,call:{name:e.mutation,args:{...e.args}}}}function an(e,n,t){let i=n.proposals.filter(r=>t.ids===void 0||t.ids.includes(r.id));if(i.length===0)return{ok:!1,refused:"Nothing was chosen."};let o=i.flatMap(r=>r.confidence===void 0?[]:[r.confidence]);try{let c=e.applyAll(i.map(d=>d.call),{author:t.author,via:`ai:${n.interaction}`,intent:n.basis,lineage:{basis:`Asked \u201C${n.basis}\u201D`,...n.model?{model:n.model}:{},...o.length>0?{confidence:Math.min(...o)}:{},interaction:n.interaction}}).ops[0]?.batch;return c?{ok:!0,batch:c,accepted:i.map(d=>d.id)}:{ok:!1,refused:"That changes nothing now."}}catch(r){return{ok:!1,refused:r instanceof Error?r.message:String(r)}}}function dn(e,n,t){let i=e.ask.kind==="suggest"?n.length>0:e.offered.length>0&&e.offered.every(o=>n.includes(o.id));return{...e,outcome:i?"accepted":"partly",accepted:n,batches:[...e.batches??[],t]}}var ln=e=>({...e,outcome:"dismissed"});var P=xe(hn(),1);var S=xe(Ue(),1);function fn(e,n,t){let i=n.on==="selection"?n.ids:n.on==="record"||n.on==="field"?[n.id]:[],o=i.length>0?Ke(e.store,i,{principal:e.principal,...i.length===1?{focus:i[0]}:{}}).affordances.map(r=>({mutation:r.mutation,label:r.label,args:r.args,open:r.open,why:r.why,...r.destructive?{destructive:!0}:{}})):void 0;return{store:e.store,target:n,principal:e.principal,interaction:Ie(),places:e.places,selection:e.selection,...o?{acts:o}:{},...e.place?{place:e.place}:{},...t?{said:t}:{},...e.app.purpose?{purpose:e.app.purpose}:{}}}async function un(e,n,t){let i=await (__graviewPreload(import.meta.url,["./chunk.MLRPCZVS.js","./chunk.G4JJXA63.js","./chunk.64IKLRUS.js","./chunk.DTSTUC2W.js","./chunk.USQNSNIA.js","./chunk.XOZU4OFA.js","./chunk.IT763BYH.js","./chunk.UQQAGT3R.js","./chunk.WVUJXDXZ.js","./chunk.T2RME6XF.js","./chunk.SOTB6C5A.js","./chunk.TQCRFZ53.js","./chunk.6HLKAUWF.js","./chunk.FCUDBMGC.js","./chunk.KMEKMCKG.js","./chunk.XJFAUOJS.js","./chunk.DPPT6WAJ.js","./chunk.7U2JO7ET.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.UE5YS3GN.js")),o=i.recipeDraft(n.recipe,{app:e.app,sight:i.draftSight(e.app,e.principal)});if(i.isDraftFailure(o))return o.failed;t?.(),e.seatTalk.setDraft(o,null),e.goTo.draft?.(),pn()}function pn(e=180){if(typeof document>"u")return;let n=document.querySelector('[data-testid="draft-keep"]'),t=document.activeElement,i=!t||t===document.body||t.closest?.("[inert]")!==null;if(n){i&&n.focus();return}e>0&&requestAnimationFrame(()=>pn(e-1))}async function de(e,n,t,i,o){let r=fn(e,t,i),c=n==="suggest"?await tn(e.ai,r):n==="fill"?await on(e.ai,r):n==="record"?await rn(e.ai,r):await sn(e.ai,r);if(c.interaction.outcome==="failed")return n!=="suggest"&&e.desk.record(c.interaction),c;let d=s=>{let f={...c.interaction,outcome:"failed",failed:s};return e.desk.record(f),{...c,interaction:f}};if(n==="fill"||n==="record"){if(!c.ghost||c.ghost.proposals.length===0)return d("Nothing here could be filled in.");o?.(),e.desk.setGhost({ghost:c.ghost}),e.desk.record(c.interaction)}if(n==="panel"&&c.panel){let s=await un(e,c.panel,o);if(s)return d(s);e.desk.record(c.interaction)}return c}var Fe=new WeakMap,Nn=64,cn=new WeakMap;function jn(e){let n=cn.get(e);if(!n){let t=n={n:0};cn.set(e,t),e.subscribe(()=>void(t.n+=1))}return n.n}var yn=(e,n)=>{let t=Y(n);return t.length>0?t.map(i=>e.graph.getNode(i)):[jn(e)]},gn=(e,n,t)=>JSON.stringify({target:n,seat:e.principal,by:t}),mn=(e,n,t)=>{let i=yn(e.store,n);return t.schema===e.store.schema&&t.ai===e.ai&&i.length===t.depends.length&&i.every((o,r)=>o===t.depends[r])};function Dn(e,n,t="menu"){let i=Fe.get(e.store)?.get(gn(e,n,t));return i?.result!==void 0&&mn(e,n,i)?i.result:void 0}function Ln(e,n,t){let i=Fe.get(e.store);i||Fe.set(e.store,i=new Map);let o=gn(e,n,t?.by??"menu"),r=i.get(o);if(r&&mn(e,n,r))return r.result?Promise.resolve(r.result):r.asked;let c=t?t.ask():de(e,"suggest",n),d={schema:e.store.schema,ai:e.ai,depends:yn(e.store,n),asked:c};i.delete(o),i.set(o,d),i.size>Nn&&i.delete(i.keys().next().value);let s=i;return c.then(f=>{f.interaction.outcome!=="failed"?d.result=f:s.get(o)===d&&s.delete(o)}),c}async function Hn(e,n,t,i){let o=n.interaction,r=ke(t);if(r){let c=o.usage?.at(-1)?.model,d=o.offered.find(f=>f.id===t.id)?.confidence,s=ae(e.store,{interaction:o.id,target:o.target,basis:`${o.ask.said}: ${t.label}`,...c?{model:c}:{},proposals:[{...r,...d!==void 0?{confidence:d}:{}}]},e.principal);if(s.proposals.length===0){let f="That can't be done now.";return e.desk.record({...o,outcome:"failed",failed:f}),f}i?.(),e.desk.setGhost({ghost:s}),e.desk.record(o);return}if(t.type==="panel"){let c=t.label,d={title:c,recipe:{...t.panel,title:c}},s=await un(e,d,i);return e.desk.record(s?{...o,outcome:"failed",failed:s}:{...o,outcome:"drawn",accepted:[t.id],panel:d}),s}i?.(),t.type==="place"?e.goTo.place(t.place):t.type==="record"&&e.goTo.record(t.record),e.desk.record({...o,outcome:"accepted",accepted:[t.id]})}async function yt(e,n){if(n.ask.kind==="ask")return fe(e.desk,{target:n.target,asked:n.ask.said}),null;let t=n.ask.kind==="panel"||n.ask.kind==="record"?n.ask.kind:"fill";return de(e,t,n.target,n.ask.said)}var z={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},we={margin:0,padding:"4px 10px",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function gt({target:e,close:n}){let t=Je(),i=(0,P.useMemo)(()=>Xe(e,y=>t.store.graph.has(y)),[e,t.store]),o=(0,P.useMemo)(()=>{let y=fn(t,i);return he(t.store,i,{principal:t.principal,places:t.places,...y.acts?{acts:y.acts}:{}})},[t,i]),r=o.candidates.some(y=>y.type==="fill"),c=o.candidates.some(y=>y.type==="panel"),d=(0,P.useMemo)(()=>c?Ze(t.store,i,{principal:t.principal,places:t.places,most:1}):[],[c,t,i]),s=(0,P.useMemo)(()=>new Set(t.store.allMutations().filter(y=>(y.creates??[]).length>0).map(y=>y.name)),[t.store]),f=U(t.ai)!==void 0&&o.candidates.some(y=>y.type==="act"&&y.asks.length>0&&s.has(y.mutation)),a=Oe(t.ai),p=Dn(t,i),h=JSON.stringify(i),[b,C]=(0,P.useState)(!1),[A,g]=(0,P.useState)(null),[x,O]=(0,P.useState)(a&&p===void 0);(0,P.useEffect)(()=>{if(p!==void 0||!(a||b))return;let y=!0;return O(!0),Ln(t,i).then(v=>{y&&(g(v),O(!1))}),()=>{y=!1}},[h,b]);let k=p??A,u=(k?.offers??[]).filter(y=>!(y.type==="place"&&d.some(v=>v.place===y.place))).slice(0,Math.max(0,3-d.length)),w=k?.interaction.outcome==="failed"?k.interaction.failed??"The AI could not suggest anything here.":null,T=(0,P.useRef)(!1),F=(0,P.useRef)(null);(0,P.useLayoutEffect)(()=>{k===null||!T.current||(T.current=!1,F.current?.querySelector("button")?.focus())},[k]);let q=(0,P.useRef)(!0);(0,P.useEffect)(()=>()=>{q.current=!1},[]);let[H,l]=(0,P.useState)(!1),[m,R]=(0,P.useState)(null),E=y=>{if(H)return;l(!0),R(null);let v=!1;y(()=>{v=!0,n()}).then(D=>{q.current&&(l(!1),D?R(D):v||n())},D=>{q.current&&(l(!1),R(D instanceof Error?D.message:String(D)))})},$=y=>y.interaction.outcome==="failed"?y.interaction.failed??"The AI could not do that here.":void 0;return(0,S.jsxs)("div",{ref:F,"data-testid":"inline-ai",style:{display:"grid",gap:2},children:[x&&!b?(0,S.jsx)("p",{role:"status","data-testid":"inline-ai-thinking",style:we,children:"Thinking\u2026"}):H?(0,S.jsx)("p",{role:"status","data-testid":"inline-ai-asking",style:we,children:"Asking\u2026"}):m?(0,S.jsx)("p",{role:"alert","data-testid":"inline-ai-failed",style:{...we,color:"var(--graview-warn)"},children:m}):w?(0,S.jsx)("p",{role:"status",style:we,children:w}):null,(0,S.jsxs)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[u.map(y=>(0,S.jsx)("li",{children:(0,S.jsxs)("button",{type:"button","data-menu-item":`ai-offer:${y.id}`,"data-ai-offer":y.id,"data-ai-offer-type":y.type,onClick:()=>E(v=>Hn(t,k,y,v)),style:z,children:[y.label,(0,S.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",y.type==="panel"?"a panel":y.type==="place"?"go there":y.type==="record"?"open it":"suggested"]})]})},y.id)),!a&&k===null?(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":"ai-suggest","aria-disabled":b||void 0,onClick:y=>{b||(T.current=document.activeElement===y.currentTarget,C(!0))},style:z,children:b?"Thinking\u2026":"Suggest\u2026"})}):null,r?(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":"ai-fill",onClick:()=>E(async y=>$(await de(t,"fill",i,"Fill in",y))),style:z,children:"Fill in with AI"})}):null,f?(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":"ai-record",onClick:()=>E(async y=>$(await de(t,"record",i,"Add one",y))),style:z,children:"Add one with AI"})}):null,d.map(y=>(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":`ai-open:${y.place}`,"data-ai-existing":y.fit,onClick:()=>{n(),t.goTo.place(y.place),y.fit==="partial"&&fe(t.desk,{target:{on:"lens",place:y.place,...y.kind?{kind:y.kind}:{}}})},style:z,children:y.fit==="full"?`Open ${y.title}`:`Open and adjust ${y.title}`})},y.place)),c?(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":"ai-panel",onClick:()=>E(async y=>$(await de(t,"panel",i,"Draw a panel",y))),style:z,children:d.length>0?"Draw a new view":"Draw a panel"})}):null,(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":"ai-ask",onClick:()=>{let y=document.activeElement;n(),fe(t.desk,{target:i,returnTo:y instanceof HTMLElement&&y!==document.body?y:null})},style:z,children:"Ask about this\u2026"})})]})]})}var Ae={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 10px",fontSize:"0.8125rem",borderRadius:8};function mt({placement:e="picture"}){let{store:n,principal:t,aiDesk:i}=ze(),o=We(n,t),{ghost:r,entries:c}=_e(i),[d,s]=(0,P.useState)(new Set);(0,P.useEffect)(()=>s(new Set),[r?.ghost.interaction]);let f=(0,P.useRef)(null),a=(0,P.useRef)(null),p=r?.batch;if((0,P.useEffect)(()=>{p!==void 0&&a.current?.focus()},[p]),!r)return null;let{ghost:h}=r,b=c.find(k=>k.id===h.interaction),C=()=>{let k=h.target.on==="record"||h.target.on==="field"?h.target.id:void 0,u=f.current?.closest("[data-graview-face], main")?.parentElement??document,w=(k?u.querySelector(`[data-graview-view="${CSS.escape(k)}"][tabindex]`):null)??document.querySelector("[data-graview-page-title]")??f.current?.closest("main")??document.querySelector("main");w&&!w.hasAttribute("tabindex")&&w.setAttribute("tabindex","-1"),w?.focus({preventScroll:!0}),i.setGhost(null)},A=h.proposals.filter(k=>!d.has(k.id)).map(k=>k.id),g=()=>{let k=an(o,h,{author:t,ids:A});if(!k.ok){i.setGhost({...r,refused:k.refused});return}b&&i.record(dn(b,k.accepted,k.batch)),i.setGhost({ghost:h,batch:k.batch,took:k.accepted.length,...r.onCard?{onCard:!0}:{}})},x=()=>{b&&r.batch===void 0&&i.record(ln(b)),C()},O=()=>{if(r.batch!==void 0)try{o.undo(r.batch,{author:t}),C()}catch(k){i.setGhost({...r,refused:k instanceof Error?k.message:String(k)})}};return(0,S.jsxs)("section",{ref:f,"data-testid":"ai-ghost","data-interaction":h.interaction,"aria-label":"Proposed by AI",style:{...e==="card"?{position:"static"}:{position:e==="page"?"fixed":"absolute",insetInline:"max(12px, calc(50% - 220px))",bottom:"calc(var(--graview-foot-room, 0px) + 72px)",zIndex:He("toast"),boxShadow:"var(--graview-lift-high)"},display:"grid",gap:8,padding:12,borderRadius:12,border:"1px dashed var(--graview-accent)",background:"var(--graview-float)",fontSize:"0.875rem"},children:[(0,S.jsx)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:r.batch!==void 0?`Done: ${r.took===1?"one change":`${r.took} changes`}, as one.`:`Proposed by AI \xB7 ${h.basis}`}),r.batch===void 0?(0,S.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:h.proposals.map(k=>(0,S.jsx)("li",{"data-ghost-proposal":k.id,children:(0,S.jsxs)("label",{style:{display:"flex",alignItems:"baseline",gap:8,cursor:"pointer"},children:[(0,S.jsx)("input",{type:"checkbox",checked:!d.has(k.id),onChange:u=>{let w=new Set(d);u.target.checked?w.delete(k.id):w.add(k.id),s(w)}}),(0,S.jsx)("span",{style:{fontStyle:"italic",color:"var(--graview-ink)"},children:k.said}),k.confidence!==void 0?(0,S.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[Math.round(k.confidence*100),"% sure"]}):null]})},k.id))}):null,r.refused?(0,S.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-warn)"},children:r.refused}):null,(0,S.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:r.batch===void 0?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("button",{type:"button","data-testid":"ghost-accept",disabled:A.length===0,onClick:g,style:Ae,children:A.length===h.proposals.length?"Accept":`Accept ${A.length} of ${h.proposals.length}`}),(0,S.jsx)("button",{type:"button","data-testid":"ghost-dismiss",onClick:x,style:Ae,children:"Dismiss"})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("button",{type:"button",ref:a,"data-testid":"ghost-undo",onClick:O,style:Ae,children:"Undo"}),(0,S.jsx)("button",{type:"button","data-testid":"ghost-close",onClick:C,style:Ae,children:"Close"})]})})]})}export{Xe as a,Y as b,he as c,Ze as d,te as e,Ie as f,Rn as g,Tn as h,it as i,ot as j,fn as k,un as l,de as m,Dn as n,Ln as o,Hn as p,yt as q,gt as r,mt as s};
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Ge}from"./chunk.BJUUSIQY.js";import{a as Ke}from"./chunk.VG7OWV2H.js";import{a as Ve}from"./chunk.XU34T2H4.js";import{a as Je}from"./chunk.CCWPF5PK.js";import{a as ue}from"./chunk.KKNDX4JT.js";import{c as fe}from"./chunk.YD3TKV6P.js";import{E as Oe,G as hn,J as _e,P as We,T as Ue,ba as ze}from"./chunk.HT2BEOEV.js";import{$b as ce,Rb as De,Vc as He,bc as Le,da as B,ga as le,gd as qe,id as Be,ja as W,ma as Ne,oa as G,zb as je}from"./chunk.7BBGRTXM.js";import{j as Z}from"./chunk.FQLNBIQ5.js";import{b as xe}from"./chunk.AJZBJBMO.js";var kn=["search-miss","unanswered","refused","tool-invalid"];var _n=new RegExp("[\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2066-\\u2069]","g");var pe=e=>e.onBehalfOf?pe(e.onBehalfOf):e.id!==void 0?`${e.kind}:${e.id}`:`${e.kind}:?`,ve=e=>e.toLowerCase().replace(/\s+/g," ").replace(/^[\s\p{P}]+|[\s\p{P}]+$/gu,"");var bn=new Set("a an and are at be by can do does for from has have how i in is it me my of on or our the their there this to was we what when where which who why will with you your".split(" "));function ee(e,n,t,i,o){let r=new Map;for(let c of e){let d=n(c);if(d===void 0)continue;let s=r.get(d)??{first:c,people:new Set,times:0,last:c};s.people.add(pe(c.by)),s.times+=1,s.last=c,r.set(d,s)}return[...r.entries()].filter(([,c])=>c.people.size>=i).sort(([c,d],[s,f])=>f.people.size-d.people.size||f.times-d.times||c.localeCompare(s)).slice(0,o).map(([c,d])=>({...t(d.last,c),people:d.people.size,times:d.times}))}function wn(e,n={}){let t=Math.max(1,n.minPeople??2),i=n.most??12,o=e.filter(s=>!qe(s.by)),r=Object.fromEntries(kn.map(s=>{let f=o.filter(a=>a.type===s);return[s,{events:f.length,people:new Set(f.map(a=>pe(a.by))).size}]})),c=[],d=new Map;for(let s of o){let f=s.type==="search-miss"?s.words:s.type==="unanswered"?s.question:void 0;if(f!==void 0)for(let a of new Set(ve(f).split(/[^\p{L}\p{N}]+/u))){if(a.length<3||bn.has(a))continue;let p={...s,id:`${s.id}:${a}`};c.push(p),d.set(p,a)}}return{events:o.length,people:new Set(o.map(s=>pe(s.by))).size,byType:r,searches:ee(o,s=>s.type==="search-miss"&&ve(s.words)||void 0,(s,f)=>({words:f}),t,i),questions:ee(o,s=>s.type==="unanswered"&&ve(s.question)||void 0,(s,f)=>({question:f}),t,i),words:ee(c,s=>d.get(s),(s,f)=>({word:f}),t,i),refusals:ee(o,s=>s.type==="refused"?`${s.act}|${s.code}`:void 0,s=>({act:s.act,code:s.code}),t,i),tools:ee(o,s=>s.type==="tool-invalid"?`${s.tool}|${s.act??""}`:void 0,s=>{let f=s;return{tool:f.tool,...f.act?{act:f.act}:{},...f.then?{then:f.then}:{}}},1,i)}}var Ye=e=>e.length>3&&e.endsWith("s")&&!e.endsWith("ss")?e.slice(0,-1):e;function An(e){let n=new Set,t=i=>{for(let o of i.toLowerCase().split(/[^\p{L}\p{N}]+/u))o.length>0&&n.add(Ye(o))};for(let i of e.kinds){let o=e.tryDefinition(i);t(i),t(G(o,i)),t(W(e,i));for(let r of[...o?.aliases??[],...Object.values(o?.fieldAliases??{}).flat()])t(r);for(let r of Object.keys(o?.fields?.shape??{}))t(r),t(B(r))}return n}function Qe(e,n,t={}){let i=wn(e,{most:8,...t}),o=An(n),r=i.searches.filter(a=>!a.words.split(/[^\p{L}\p{N}]+/u).some(p=>p.length>0&&o.has(Ye(p)))).map(a=>({words:a.words,people:a.people})),c=i.questions.map(a=>({question:a.question,people:a.people})),d=i.tools.map(a=>({tool:a.tool,...a.act?{act:a.act}:{},...a.then?{then:a.then}:{},times:a.times})),s=a=>`${a} ${a===1?"person":"people"}`;return{said:[...r.length>0?[`Searched for, found nothing, and nothing here is called it: ${r.map(a=>`\u201C${a.words}\u201D (${s(a.people)})`).join(", ")}.`]:[],...c.length>0?[`Asked and not answered: ${c.map(a=>`\u201C${a.question}\u201D (${s(a.people)})`).join(", ")}.`]:[],...d.length>0?[`Tool calls refused as invalid: ${d.map(a=>`${a.tool}${a.act?` (${a.act})`:""} ${a.times===1?"once":`${a.times} times`}${a.then?`, then worked as ${a.then}`:""}`).join("; ")}.`]:[]].join(`
|
|
2
|
+
`),unknownWords:r,questions:c,toolMistakes:d}}var Sn=e=>/^(?:aggregate|kind):([^,]+)$/.exec(e)?.[1];function Xe(e,n){let t=e.about??[];if(e.field!==void 0&&e.on!==void 0&&n(e.on))return{on:"field",id:e.on,field:e.field};let i=t.filter(n);if(i.length>1)return{on:"selection",ids:i};if(e.on!==void 0&&n(e.on))return{on:"record",id:e.on};if(i.length===1)return{on:"record",id:i[0]};let o=[e.on,...t].map(r=>r===void 0?void 0:Sn(r)).find(r=>r!==void 0);return e.place!==void 0?{on:"lens",place:e.place,...o?{kind:o}:{}}:o!==void 0?{on:"list",kind:o}:{on:"place",place:"home"}}var Y=e=>e.on==="record"||e.on==="field"?[e.id]:e.on==="selection"?e.ids:e.on==="act"&&e.id!==void 0?[e.id]:[],ye=(e,n)=>e.tryDefinition(n)?.fields?.shape??{},V=(e,n)=>e.tryDefinition(n)?.edges??{},ge=(e,n)=>new Set(e.tryDefinition(n)?.display?.hide??[]),L=(e,n)=>le(e.tryDefinition(n.kind),n),$e=(e,n,t)=>Ne(e.tryDefinition(n),t)||B(t),Ce=e=>typeof e=="boolean"?e?"yes":"no":String(e);function me(e,n){let t=e.kindsKeptFrom(n);return new Set(e.schema.kinds.filter(i=>!t.has(i)))}function Re(e,n,t,i){if(!e.permits(n,t).ok)return!1;if(!i)return!0;try{return e.previewAll([n],{author:t}).ops.length>0}catch{return!1}}function he(e,n,t){let i=e,{principal:o}=t,r=t.each??8,c=Z(i)?.store??i,d=c.seenBy(o),s=c.schema,f=me(c,o),a=l=>{let m=d.graph.getNode(l);return m&&f.has(m.kind)?m:void 0},p=c.allMutations(),h=new Map(p.map(l=>[l.name,l])),b=[],C=new Set,A=l=>{C.has(l.id)||(C.add(l.id),b.push(l))},g=l=>l.slice(0,r),x=Y(n).filter(l=>a(l)!==void 0);if(Y(n).length>0&&x.length===0)return{target:n,candidates:[]};let O=x.length===1?a(x[0]):void 0,k=O?.kind??(n.on==="list"?n.kind:n.on==="lens"?n.kind??t.places?.find(l=>l.as===n.place)?.kind:void 0)??(n.on==="selection"?a(x[0])?.kind:void 0);if(k!==void 0&&!f.has(k))return{target:n,candidates:[]};let u=(l,m)=>`act:${l}${Object.keys(m).length>0?`:${Object.values(m).map(R=>String(R)).join(",")}`:""}`,w=(l,m,R,E,$)=>{l.destructive||Object.values(m).some(y=>typeof y=="string"&&c.graph.has(y)&&a(y)===void 0)||Re(c,{name:l.name,args:{...m}},o,E.length===0)&&A({type:"act",id:u(l.name,m),label:R,description:$??l.description??R,mutation:l.name,args:m,asks:E})};if(n.on!=="place"||t.acts)if(t.acts)for(let l of t.acts){let m=h.get(l.mutation);!m||l.destructive||n.on==="act"&&l.mutation!==n.act||w(m,l.args,l.label,(l.open??[]).filter(R=>!R.optional).map(R=>R.name),l.why)}else{let l=O?[O]:[];for(let m of p){if(n.on==="act"&&m.name!==n.act)continue;let R=m.input.shape??{},E=$=>Object.entries(R).filter(([y,v])=>y!==$&&v.safeParse?.(void 0).success===!1).map(([y])=>y);if(m.subject)for(let $ of l)ce(s,m).includes($.kind)&&w(m,{[m.subject.arg]:$.id},`${m.title??B(m.name)}: ${L(s,$)}`,E(m.subject.arg));else k!==void 0&&(m.creates??[]).includes(k)&&w(m,{},m.title??B(m.name),E(void 0))}}let T=b.filter(l=>l.type==="act");b.splice(0,b.length,...g(T));let F=(l,m)=>{let R=Le(s,p).get(l.kind),E=ye(s,l.kind),$=ge(s,l.kind),y=[];for(let[v,j]of Object.entries(E)){if(m!==void 0?v!==m:$.has(v)||l[v]!==void 0)continue;let D=ue(j),J=D?.type==="enum"?D.options??[]:D?.type==="boolean"?[!0,!1]:[];if(J.length===0)continue;let _=(R?.get(v)??[]).map(N=>h.get(N)).find(N=>N?.subject!==void 0&&Re(c,{name:N.name,args:{[N.subject.arg]:l.id,[v]:J.find(Se=>Se!==l[v])??J[0]}},o,!0));if(_?.subject)for(let N of J)l[v]!==N&&y.push({type:"fill",id:`fill:${l.id}:${v}:${Ce(N)}`,label:`${$e(s,l.kind,v)}: ${Ce(N)}`,description:`Set ${$e(s,l.kind,v).toLowerCase()} of ${L(s,l)} to ${Ce(N)}`,record:l.id,field:v,value:N,call:{name:_.name,args:{[_.subject.arg]:l.id,[v]:N}}})}for(let[v,j]of Object.entries(V(s,l.kind))){if(m!==void 0&&v!==m)continue;let D=j.to==="*"?[...f]:j.to.filter(I=>f.has(I)),J=new Set(d.graph.out(l.id,v).map(I=>I.id)),_=p.find(I=>(I.connects??[]).includes(v)&&I.subject!==void 0&&ce(s,I).includes(l.kind));if(!_?.subject)continue;let N=De(_.input).find(I=>I.name!==_.subject.arg);if(!N)continue;let Se=D.flatMap(I=>N.kinds.length===0||N.kinds.includes(I)?d.graph.nodesOfKind(I):[]).filter(I=>I.id!==l.id&&!J.has(I.id)&&a(I.id)!==void 0);for(let I of g(Se)){let Me={name:_.name,args:{[_.subject.arg]:l.id,[N.name]:I.id}};Re(c,Me,o,!0)&&y.push({type:"fill",id:`fill:${l.id}:${v}:${I.id}`,label:`${B(v)}: ${L(s,I)}`,description:`Link ${L(s,l)} to ${L(s,I)}${j.description?` as ${j.description}`:""}`,record:l.id,field:v,value:I.id,call:Me})}}return y};if(n.on==="field"&&O)for(let l of F(O,n.field))A(l);else if(O&&n.on==="record")for(let l of g(F(O)))A(l);let q=l=>{let m=W(s,l).toLowerCase(),R=[{type:"panel",id:`panel:${l}:list`,label:`A list of ${m}`,description:`Every ${G(s.tryDefinition(l),l).toLowerCase()} this viewer may see, as a list`,panel:{lens:"blocks",kind:l}}],E=ge(s,l);for(let[$,y]of Object.entries(ye(s,l))){if(E.has($))continue;let v=ue(y),j=$e(s,l,$).toLowerCase();if(v?.type==="enum")R.push({type:"panel",id:`panel:${l}:group:${$}`,label:`${K(m)} by ${j}`,description:`A list of ${m} grouped by ${j}`,panel:{lens:"blocks",kind:l,group:$}}),R.push({type:"panel",id:`panel:${l}:columns:${$}`,label:`Columns of ${m} by ${j}`,description:`${K(m)} in a column for each ${j}`,panel:{lens:"columns",kind:l,column:$}});else if(v?.type==="number"||v?.type==="integer"||v?.type==="date"||v?.type==="datetime"){let D=v.type==="date"||v.type==="datetime";R.push({type:"panel",id:`panel:${l}:sort:${$}`,label:`${K(m)} by ${j}`,description:`A list of ${m}, the ${D?"latest":"highest"} ${j} first`,panel:{lens:"blocks",kind:l,sort:{by:$,direction:"desc"}}}),D&&R.push({type:"panel",id:`panel:${l}:calendar:${$}`,label:`A calendar of ${m}`,description:`${K(m)} on a calendar by ${j}`,panel:{lens:"calendar",kind:l,start:$}})}}return R},H=n.on==="place"?[...f]:k!==void 0?[k]:[];for(let l of H)for(let m of g(q(l)))A(m);for(let l of g((t.places??[]).filter(m=>m.kind===void 0?n.on==="place":f.has(m.kind)&&(n.on==="place"||m.kind===k))))n.on==="lens"&&l.as===n.place||A({type:"place",id:`place:${l.as}`,label:l.title,description:`Go to ${l.title}`,place:l.as});if(O){let l=[];for(let[m,R]of Object.entries(V(s,O.kind)))for(let E of d.graph.out(O.id,m))a(E.id)&&l.push({type:"record",id:`record:${E.id}`,label:L(s,E),description:`${K(R.description??B(m))}: ${L(s,E)}`,record:E.id,relation:m});for(let m of s.kinds)for(let[R,E]of Object.entries(V(s,m)))if(!(E.to!=="*"&&!E.to.includes(O.kind)))for(let $ of d.graph.in(O.id,R))$.kind===m&&a($.id)&&l.push({type:"record",id:`record:${$.id}`,label:L(s,$),description:`${K(E.inverse??B(R))}: ${L(s,$)}`,record:$.id,relation:R});for(let m of g(l))A(m)}else if(n.on==="list"||n.on==="lens")for(let l of g(k!==void 0?d.graph.nodesOfKind(k):[]))a(l.id)&&A({type:"record",id:`record:${l.id}`,label:L(s,l),description:`Open ${L(s,l)}`,record:l.id});else if(n.on==="selection")for(let l of x){let m=a(l);A({type:"record",id:`record:${l}`,label:L(s,m),description:`Open ${L(s,m)}`,record:l})}return{target:n,candidates:b}}var K=e=>e&&`${e[0].toUpperCase()}${e.slice(1)}`,xn={columns:["board","kanban","column","lane","pipeline","stage","funnel"],board:["board","map","floor","layout","seat","slot"],calendar:["calendar","schedule","date","due","month","week","agenda","deadline","day"],timeline:["timeline","gantt","schedule","roadmap","span"],coverage:["coverage","matrix","grid","gap"],plan:["plan","floor","map","region","area"],blocks:["list","table","summary","overview","dashboard","card"]},On=new Set(["a","an","the","of","for","my","our","me","us","to","with","and","in","on","by","that","which","i","we","want","need","show","open","go","draw","make","new","view","views","panel","panels","page","lens","please","all","every","some","see","can","could","would","like","one","what","is","are","do","does","here","there","how","it","this","these","those"]),ne=e=>e.length>3&&e.endsWith("ies")?`${e.slice(0,-3)}y`:e.length>3&&e.endsWith("s")&&!e.endsWith("ss")?e.slice(0,-1):e,Te=e=>e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").split(/[^a-z0-9]+/).filter(Boolean);function Ze(e,n,t){let i=e,o=Z(i)?.store??i,r=o.schema,c=me(o,t.principal),d=o.seenBy(t.principal),s=Y(n),f=new Set;for(let u of s){let w=d.graph.getNode(u)?.kind;w!==void 0&&c.has(w)&&f.add(w)}if(s.length>0&&f.size===0)return[];if(n.on==="list"&&f.add(n.kind),n.on==="lens"){let u=n.kind??t.places.find(w=>w.as===n.place)?.kind;u!==void 0&&f.add(u)}let a=new Map;for(let u of r.kinds){if(!c.has(u))continue;let w=r.tryDefinition(u);for(let T of[u,G(w,u),W(r,u)])for(let F of Te(T))a.set(ne(F),u)}let p=Te(t.said??"").filter(u=>!On.has(u)),h=new Set,b=[];for(let u of p){let w=a.get(ne(u));w!==void 0?h.add(w):b.push(ne(u))}let C=h.size>0?h:f;if((t.said??"").trim()!==""&&p.length===0)return[];if(C.size===0&&p.length===0)return[];let A=[];t.places.forEach((u,w)=>{if(u.hidden||n.on==="lens"&&u.as===n.place)return;let T=u.over??(u.kind!==void 0?[u.kind]:[]);if(T.length>0&&!T.some(H=>c.has(H)))return;let F=T.some(H=>C.has(H)),q=!F&&(u.reads??[]).some(H=>C.has(H));C.size>0&&!F&&!q||A.push({place:u,own:F,reads:q,at:w})});let g=u=>new Set(Te(u.title).map(ne)),x=new Set(b.filter(u=>A.some(({place:w})=>g(w).has(u)))),O=[];for(let{place:u,own:w,reads:T,at:F}of A){let q=g(u),H=new Set((xn[u.lens??""]??[]).map(ne)),l=b.filter($=>q.has($)||H.has($)&&!x.has($)).length,m=b.length-l;if(b.length>0&&l===0)continue;let R=!T&&m===0?"full":"partial",E=(w?4:T?2:1)+l*2-m+(R==="full"?1:0);O.push({view:{place:u.as,title:u.title,...u.kind!==void 0?{kind:u.kind}:{},fit:R},score:E,at:F})}return O.filter((u,w)=>!O.slice(0,w).some(T=>T.view.place===u.view.place&&T.view.title===u.view.title)).sort((u,w)=>w.score-u.score||u.at-w.at).slice(0,t.most??3).map(u=>u.view)}var Ee=new WeakMap;function vn(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619)>>>0;return n.toString(36)}function $n(e,n){let t=e,i=Z(t)?.store??t,o=i.schema,r=me(i,n),d=i.allMutations().filter(A=>!A.destructive&&i.permits({name:A.name,args:{}},n).ok!==!1),s=`${[...r].join(",")}|${d.map(A=>A.name).join(",")}`,f=Ee.get(o)?.get(s);if(f)return f;let a=[...r].map(A=>{let g=ge(o,A),x={};for(let[w,T]of Object.entries(ye(o,A))){if(g.has(w))continue;let F=ue(T);F&&(x[w]=F.type==="enum"?`enum:${(F.options??[]).join("|")}`:F.type)}let O={};for(let[w,T]of Object.entries(V(o,A)))O[w]=T.to==="*"?[...r]:T.to.filter(F=>r.has(F));let k=o.tryDefinition(A),u=Object.entries(k?.fieldAliases??{}).filter(([w,T])=>w in x&&T.length>0);return{kind:A,noun:G(o.tryDefinition(A),A),plural:W(o,A),fields:x,relations:O,...k?.aliases&&k.aliases.length>0?{aliases:k.aliases}:{},...u.length>0?{fieldAliases:Object.fromEntries(u)}:{}}}),p=d.map(A=>({name:A.name,title:A.title??B(A.name),...A.subject?{on:ce(o,A).filter(g=>r.has(g))}:{}})),h={kinds:a,acts:p},b={version:vn(JSON.stringify(h)),...h},C=Ee.get(o)??new Map;return C.set(s,b),Ee.set(o,C),b}var Cn=e=>e.name??e.id??e.kind;function en(e,n,t){let i=e,{principal:o}=t,r=Z(i)?.store??i,c=r.seenBy(o),d=r.schema,s=me(r,o),f=u=>{let w=c.graph.getNode(u);return w&&s.has(w.kind)?w:void 0},a=u=>({id:u.id,kind:u.kind,label:L(d,u)}),p=Y(n),h=p.length===1?f(p[0]):void 0,b=h?Object.fromEntries(Object.keys(ye(d,h.kind)).filter(u=>!ge(d,h.kind).has(u)&&h[u]!==void 0&&u!=="label").map(u=>[u,h[u]])):{},C={on:n.on,...h?{record:{...a(h),fields:b}}:{},...n.on==="field"&&h?{field:n.field}:{},...n.on==="list"&&s.has(n.kind)?{kind:n.kind}:{},...n.on==="lens"?{place:n.place,...n.kind&&s.has(n.kind)?{kind:n.kind}:{}}:{},...n.on==="place"?{place:n.place}:{},...n.on==="act"?{act:n.act}:{}},A=[...new Set([...n.on==="selection"?n.ids:[],...t.selection??[]])].flatMap(u=>{let w=f(u);return w?[a(w)]:[]}),g=[];if(h){for(let u of Object.keys(V(d,h.kind)))for(let w of c.graph.out(h.id,u))f(w.id)&&g.push({...a(w),relation:u,direction:"out"});for(let u of d.kinds)for(let w of Object.keys(V(d,u)))for(let T of c.graph.in(h.id,w))T.kind===u&&f(T.id)&&g.push({...a(T),relation:w,direction:"in"})}let x=c.batches().filter(u=>!u.ops.every(je)).slice(-(t.recent??6)).reverse().map(u=>({intent:u.intent,at:u.at,by:Cn(u.author)})),O=(t.purpose?.jobs??[]).filter(u=>Ge(u,o.roles)&&s.has(u.kind)).map(u=>({name:u.name,ask:u.ask,kind:u.kind})),k=t.purpose&&(t.purpose.for!==void 0||O.length>0)?{...t.purpose.for!==void 0?{for:t.purpose.for}:{},jobs:O}:void 0;return{...t.place!==void 0?{place:t.place}:{},target:C,selection:A,neighbors:g.slice(0,24),recent:x,schema:$n(r,o),...k?{purpose:k}:{},...t.friction?{friction:Qe(t.friction,d)}:{}}}function te(e){if(!e.off)return e.fast??(e.decide?{model:e.name??"decide",decide:e.decide}:void 0)}function U(e){if(e.off)return;if(e.thinking)return e.thinking;let n=e.name??"model";if(e.complete){let t=e.complete;return{model:n,think:({system:i,prompt:o})=>t({prompt:o,system:i})}}if(e.turn){let t=e.turn;return{model:n,think:async({system:i,prompt:o})=>({text:await t({system:i,messages:[{role:"user",content:o}],tools:[],call:async()=>({error:"No tools here."})})})}}}var Pe=(e,n,t)=>e?n/1e6*(e.inputPerMillion??0)+t/1e6*(e.outputPerMillion??0):void 0,Ie=()=>`ai-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;function Rn(e,n,t=[]){let i=o=>{let r=e.graph.getNode(o);return r?le(e.schema.tryDefinition(r.kind),r):"a record"};switch(n.on){case"record":return i(n.id);case"field":return`${i(n.id)} \xB7 ${n.field}`;case"selection":return`${n.ids.length} records`;case"list":return e.schema.tryDefinition(n.kind)?W(e.schema,n.kind):n.kind;case"lens":case"place":return t.find(o=>o.as===n.place)?.title??(n.place==="home"?"Home":n.place);case"act":return n.act}}var nn=e=>e.type!=="act"||e.asks.length===0,be=(e,n)=>({id:e.id,type:e.type,label:e.label,...n!==void 0?{confidence:n}:{}});function Q(e,n){let t=n.interaction??Ie(),i=he(n.store,n.target,{principal:n.principal,...n.acts?{acts:n.acts}:{},...n.places?{places:n.places}:{}}),o=en(n.store,n.target,{principal:n.principal,...n.place?{place:n.place}:{},...n.selection?{selection:n.selection}:{},...n.purpose?{purpose:n.purpose}:{}}),r=[];return{id:t,catalog:i,state:o,entry:{id:t,at:new Date().toISOString(),by:n.by??n.principal,target:n.target,targetLabel:Rn(n.store,n.target,n.places)},usage:r,meter:c=>{r.push(c),e.meter?.({...c,interaction:t})}}}async function ie(e,n,t,i){let o=await e.decide(n,t),{inputTokens:r,outputTokens:c}=o.usage,d=Pe(e.price,r,c);return i({tier:"fast",model:e.model,inputTokens:r,outputTokens:c,...d!==void 0?{costUsd:d}:{}}),o.answers}async function oe(e,n,t,i,o){let r=await e.think({system:n,prompt:t,state:i.state,catalog:i.catalog}),c=r.usage?.inputTokens,d=r.usage?.outputTokens,s=r.usage?.costUsd??(c!==void 0?Pe(e.price,c,d??0):void 0);return o({tier:"thinking",model:e.model,...c!==void 0?{inputTokens:c}:{},...d!==void 0?{outputTokens:d}:{},...s!==void 0?{costUsd:s}:{}}),Ve(r.text)}function re(e,n){let t=new Map(e.map((i,o)=>[`c${o+1}`,i]));return{question:{type:"choice",instructions:n,criteria:Object.fromEntries([...t].map(([i,o])=>[i,`${o.label} \u2014 ${o.description}`]))},of:i=>t.get(i)}}function se(e,n,t){if(e?.type!=="choice")return[];let i=e,o=Object.entries(i.probabilities).sort((r,c)=>c[1]-r[1]);return o.some(([r])=>r===i.choice)||o.unshift([i.choice,i.confidence]),o.flatMap(([r,c])=>{let d=n(r);return d?[{candidate:d,confidence:c}]:[]}).slice(0,t)}var M=(e,n,t,i)=>({interaction:{...e.entry,ask:{kind:t,said:n??""},offered:[],outcome:"failed",failed:i,usage:[...e.usage]},offers:[]}),X="AI isn't on here.";async function tn(e,n,t=3){let i=Q(e,n),o=n.said??"Suggest",r=i.catalog.candidates.filter(nn).slice(0,24);if(r.length===0)return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:[],outcome:"offered",usage:[]},offers:[]};let c=te(e),d=U(e),s=[];try{if(c){let{question:f,of:a}=re(r,"Which of these would the person most likely want to do next, here?"),p=await ie(c,{...i.state,candidates:r.map(h=>({id:h.id,type:h.type,says:h.description}))},{next:f},i.meter);s=se(p.next,a,t)}else if(d){let f=await oe(d,'You suggest what a person most likely wants to do next in an app. Answer only JSON: {"pick": [candidate ids, best first]}. Pick only ids from the candidates.',JSON.stringify({state:i.state,candidates:r.map(p=>({id:p.id,says:p.description}))}),i,i.meter);s=(Array.isArray(f?.pick)?f.pick.filter(p=>typeof p=="string"):[]).flatMap(p=>r.filter(h=>h.id===p)).slice(0,t).map(p=>({candidate:p}))}else return M(i,o,"suggest",X)}catch(f){return M(i,o,"suggest",f instanceof Error?f.message:String(f))}return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:s.map(({candidate:f,confidence:a})=>be(f,a)),outcome:"offered",usage:[...i.usage]},offers:s.map(({candidate:f})=>f)}}var Tn=e=>`several:${e}`;async function it(e,n,t=2){let i=Q(e,{...n,acts:[]}),o=n.said??"Suggest for the chosen",r=n.target.on==="selection"?n.target.ids.length:1,d=[...n.shared.map(a=>({type:"act",id:Tn(a.id),label:a.label,description:`${a.label}, for all ${r} chosen`,mutation:a.mutation,args:a.args,asks:[]})),...i.catalog.candidates.filter(a=>a.type==="panel"||a.type==="place")].slice(0,24),s=te(e);if(!s)return M(i,o,"suggest",X);if(d.length===0)return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:[],outcome:"offered",usage:[]},offers:[]};let f;try{let{question:a,of:p}=re(d,`Which of these would the person most likely want to do next with the ${r} records they chose together?`),h=await ie(s,{...i.state,candidates:d.map(b=>({id:b.id,type:b.type,says:b.description}))},{next:a},i.meter);f=se(h.next,p,t).filter((b,C)=>C===0||b.confidence>=En)}catch(a){return M(i,o,"suggest",a instanceof Error?a.message:String(a))}return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:f.map(({candidate:a,confidence:p})=>be(a,p)),outcome:"offered",usage:[...i.usage]},offers:f.map(({candidate:a})=>a)}}var En=.25;async function on(e,n){let t=Q(e,n),i=n.said??"Fill in",o=t.catalog.candidates.filter(p=>p.type==="fill"),r=new Map;for(let p of o)r.set(p.field,[...r.get(p.field)??[],p]);if(r.size===0)return{interaction:{...t.entry,ask:{kind:"fill",said:i},offered:[],outcome:"offered",usage:[]},offers:[]};let c=te(e),d=U(e),s=[];try{if(c){let p=[...r].map(([b,C],A)=>({key:`f${A+1}`,field:b,...re(C,`Which value fits "${b}" best for this record?`)})),h=await ie(c,t.state,Object.fromEntries(p.map(b=>[b.key,b.question])),t.meter);for(let b of p){let C=!Pn(n.store,n.target,b.field)&&In(n.store,n.target,b.field)!=="one";s.push(...se(h[b.key],b.of,C?3:1).filter((A,g)=>g===0||A.confidence>=.4))}}else if(d){let p=await oe(d,`You fill in a record's fields in an app. Answer only JSON: {"fills": [candidate ids]}, at most one per field, only ids from the candidates.`,JSON.stringify({state:t.state,candidates:o.map(C=>({id:C.id,says:C.description}))}),t,t.meter),h=Array.isArray(p?.fills)?p.fills.filter(C=>typeof C=="string"):[],b=new Set;for(let C of h){let A=o.find(g=>g.id===C);A?.type==="fill"&&!b.has(A.field)&&(b.add(A.field),s.push({candidate:A}))}}else return M(t,i,"fill",X)}catch(p){return M(t,i,"fill",p instanceof Error?p.message:String(p))}let f=t.usage.at(-1)?.model,a=ae(n.store,{interaction:t.id,target:n.target,basis:i,...f?{model:f}:{},proposals:s.flatMap(({candidate:p,confidence:h})=>p.type==="fill"?[{id:p.id,label:p.label,said:p.description,call:p.call,record:p.record,field:p.field,...h!==void 0?{confidence:h}:{}}]:[])},n.principal);return{interaction:{...t.entry,ask:{kind:"fill",said:i},offered:a.proposals.map(p=>({id:p.id,type:"fill",label:p.label,...p.confidence!==void 0?{confidence:p.confidence}:{}})),outcome:"offered",usage:[...t.usage]},offers:[],...a.proposals.length>0?{ghost:a}:{}}}function Pn(e,n,t){let i=n.on==="record"||n.on==="field"?n.id:void 0,o=i?e.graph.getNode(i)?.kind:void 0,r=(o?e.schema.tryDefinition(o)?.fields?.shape:void 0)??{};return t in r}function In(e,n,t){let i=n.on==="record"||n.on==="field"?n.id:void 0,o=i?e.graph.getNode(i)?.kind:void 0;return o?e.schema.tryDefinition(o)?.edges?.[t]?.cardinality:void 0}async function rn(e,n){let t=Q(e,n),i=n.said??"Add one",o=new Set(n.store.allMutations().filter(a=>(a.creates??[]).length>0).map(a=>a.name)),r=t.catalog.candidates.filter(a=>a.type==="act"&&a.asks.length>0&&o.has(a.mutation));if(r.length===0)return M(t,i,"record","Nothing here makes a record.");let c=U(e);if(!c)return M(t,i,"record",X);let d;try{let a=await oe(c,'You propose one new record for an app by filling in an act. Answer only JSON: {"act": a candidate id, "args": {argument: value}}. Use only the candidates, and fill every argument the act asks for with a value that fits the state.',JSON.stringify({ask:i,state:t.state,candidates:r.map(b=>({id:b.id,says:b.description,asks:b.asks}))}),t,t.meter),p=r.find(b=>b.id===a?.act),h=typeof a?.args=="object"&&a.args!==null?a.args:{};p&&(d={act:p,args:Object.fromEntries(Object.entries(h).filter(([b])=>p.asks.includes(b)))})}catch(a){return M(t,i,"record",a instanceof Error?a.message:String(a))}if(!d)return M(t,i,"record","The model named no act this app has here.");let s=t.usage.at(-1)?.model,f=ae(n.store,{interaction:t.id,target:n.target,basis:i,...s?{model:s}:{},proposals:[{id:d.act.id,label:d.act.label,said:d.act.description,call:{name:d.act.mutation,args:{...d.act.args,...d.args}}}]},n.principal);return f.proposals.length===0?M(t,i,"record","What the model proposed could not be made here."):{interaction:{...t.entry,ask:{kind:"record",said:i},offered:f.proposals.map(a=>({id:a.id,type:"act",label:a.said})),outcome:"offered",usage:[...t.usage]},offers:[d.act],ghost:f}}async function sn(e,n){let t=Q(e,n),i=n.said??"Make a panel",o=t.catalog.candidates.filter(a=>a.type==="panel");if(o.length===0)return M(t,i,"panel","Nothing here can be drawn as a panel.");let r=te(e),c=U(e),d;try{if(c){let a=await oe(c,'You choose a panel to draw in an app. Answer only JSON: {"panel": a candidate id, "title": a short title}. Choose only among the candidates.',JSON.stringify({ask:i,state:t.state,candidates:o.map(h=>({id:h.id,says:h.description}))}),t,t.meter),p=o.find(h=>h.id===a?.panel);p&&(d={panel:p,...typeof a?.title=="string"&&a.title.trim()?{title:a.title.trim().slice(0,60)}:{}})}else if(r){let{question:a,of:p}=re(o,`Which panel answers this best: ${i}`),h=se((await ie(r,t.state,{panel:a},t.meter)).panel,p,1)[0];h?.candidate.type==="panel"&&(d={panel:h.candidate,confidence:h.confidence})}else return M(t,i,"panel",X)}catch(a){return M(t,i,"panel",a instanceof Error?a.message:String(a))}if(!d)return M(t,i,"panel","The model named no panel this app can draw.");let s=d.title??d.panel.label,f={title:s,recipe:{...d.panel.panel,title:s}};return{interaction:{...t.entry,ask:{kind:"panel",said:i},offered:[be(d.panel,d.confidence)],outcome:"drawn",panel:f,usage:[...t.usage]},offers:[d.panel],panel:f}}function Fn(e){return e.off?void 0:e.answer}var Mn=`You answer a person's question about what they are looking at in an app, from the state given and nothing else. Answer only JSON: {"answer": one to three short sentences, "pick": [candidate ids that act on the answer, best first, at most three]}. Pick only ids from the candidates, and none when nothing fits. Never say an id to the person.`;async function ot(e,n){let t=Q(e,n),i=n.said.trim(),o=t.catalog.candidates.filter(g=>nn(g)||g.type==="panel"||g.type==="place"||g.type==="record").slice(0,32),r=Fn(e),c=U(e),d=te(e),s="",f=[],a=g=>g.flatMap(x=>o.filter(O=>O.id===x)).slice(0,3).map(x=>({candidate:x}));try{if(r){let g=await r.answer({said:i,target:n.target,targetLabel:t.entry.targetLabel,state:t.state,catalog:{target:t.catalog.target,candidates:o},...n.follows?{follows:n.follows}:{}}),x=g.usage?.inputTokens,O=g.usage?.outputTokens,k=g.usage?.costUsd??(x!==void 0?Pe(r.price,x,O??0):void 0);t.meter({tier:"thinking",model:r.model,...x!==void 0?{inputTokens:x}:{},...O!==void 0?{outputTokens:O}:{},...k!==void 0?{costUsd:k}:{}}),s=typeof g.text=="string"?g.text.trim():"",f=a(g.pick??[])}else if(c){let g=await oe(c,Mn,JSON.stringify({ask:i,about:t.entry.targetLabel,...n.follows?{follows:n.follows}:{},state:t.state,candidates:o.map(x=>({id:x.id,says:x.description}))}),t,t.meter);s=typeof g?.answer=="string"?g.answer.trim():"",f=a(Array.isArray(g?.pick)?g.pick:[])}else if(d&&o.length>0){let{question:g,of:x}=re(o,`Which of these best answers, or acts on: ${i}`),O=await ie(d,{...t.state,asked:i,candidates:o.map(k=>({id:k.id,type:k.type,says:k.description}))},{answer:g},t.meter);f=se(O.answer,x,3),s=f.length>0?`These fit \u201C${i}\u201D.`:""}else return M(t,i,"ask",X)}catch(g){return M(t,i,"ask",g instanceof Error?g.message:String(g))}if(!s&&f.length===0){let g=n.target.on==="place"||n.target.on==="lens"?n.target.place:void 0,x=n.target.on==="list"||n.target.on==="lens"?n.target.kind:void 0;return Be(n.store,{type:"unanswered",question:i,...g?{place:g}:{},...x?{kind:x}:{}},n.principal),M(t,i,"ask","The AI had no answer to that here.")}let p=t.usage.at(-1)?.model,h=f.flatMap(({candidate:g,confidence:x})=>{let O=ke(g);return O?[{...O,...x!==void 0?{confidence:x}:{}}]:[]}),b=h.length>0?ae(n.store,{interaction:t.id,target:n.target,basis:i,...p?{model:p}:{},proposals:h},n.principal):void 0,C=f.map(({candidate:g})=>g).filter(g=>ke(g)===void 0),A=[...C.map(g=>be(g,f.find(x=>x.candidate===g)?.confidence)),...(b?.proposals??[]).map(g=>({id:g.id,type:g.field!==void 0?"fill":"act",label:g.label,...g.confidence!==void 0?{confidence:g.confidence}:{}}))];return{interaction:{...t.entry,ask:{kind:"ask",said:i},offered:A,outcome:"offered",...s?{answer:s}:{},usage:[...t.usage]},offers:C,...b&&b.proposals.length>0?{ghost:b}:{},...s?{answer:s}:{}}}function ae(e,n,t){let i=n.proposals.flatMap(o=>{try{let r=e.previewAll([o.call],{author:t}),c=r.ops.map(d=>d.intent).join("; ");return r.ops.length>0?[{...o,said:c||o.said}]:[]}catch{return[]}});return{...n,proposals:i}}function ke(e){if(e.type==="fill")return{id:e.id,label:e.label,said:e.description,call:e.call,record:e.record,field:e.field};if(e.type==="act"&&e.asks.length===0)return{id:e.id,label:e.label,said:e.description,call:{name:e.mutation,args:{...e.args}}}}function an(e,n,t){let i=n.proposals.filter(r=>t.ids===void 0||t.ids.includes(r.id));if(i.length===0)return{ok:!1,refused:"Nothing was chosen."};let o=i.flatMap(r=>r.confidence===void 0?[]:[r.confidence]);try{let c=e.applyAll(i.map(d=>d.call),{author:t.author,via:`ai:${n.interaction}`,intent:n.basis,lineage:{basis:`Asked \u201C${n.basis}\u201D`,...n.model?{model:n.model}:{},...o.length>0?{confidence:Math.min(...o)}:{},interaction:n.interaction}}).ops[0]?.batch;return c?{ok:!0,batch:c,accepted:i.map(d=>d.id)}:{ok:!1,refused:"That changes nothing now."}}catch(r){return{ok:!1,refused:r instanceof Error?r.message:String(r)}}}function dn(e,n,t){let i=e.ask.kind==="suggest"?n.length>0:e.offered.length>0&&e.offered.every(o=>n.includes(o.id));return{...e,outcome:i?"accepted":"partly",accepted:n,batches:[...e.batches??[],t]}}var ln=e=>({...e,outcome:"dismissed"});var P=xe(hn(),1);var S=xe(Ue(),1);function fn(e,n,t){let i=n.on==="selection"?n.ids:n.on==="record"||n.on==="field"?[n.id]:[],o=i.length>0?Ke(e.store,i,{principal:e.principal,...i.length===1?{focus:i[0]}:{}}).affordances.map(r=>({mutation:r.mutation,label:r.label,args:r.args,open:r.open,why:r.why,...r.destructive?{destructive:!0}:{}})):void 0;return{store:e.store,target:n,principal:e.principal,interaction:Ie(),places:e.places,selection:e.selection,...o?{acts:o}:{},...e.place?{place:e.place}:{},...t?{said:t}:{},...e.app.purpose?{purpose:e.app.purpose}:{}}}async function un(e,n,t){let i=await (__graviewPreload(import.meta.url,["./chunk.LY3YOWKV.js","./chunk.G4JJXA63.js","./chunk.LL2MLSPH.js","./chunk.EB4NVTJL.js","./chunk.XU34T2H4.js","./chunk.XOZU4OFA.js","./chunk.BB33TI4S.js","./chunk.2EDC63RI.js","./chunk.WVUJXDXZ.js","./chunk.LDAYDCUO.js","./chunk.KKNDX4JT.js","./chunk.GKSUTAIX.js","./chunk.5ICIMQE6.js","./chunk.QGV7H7RQ.js","./chunk.YIA2EDVF.js","./chunk.3YZHZGTM.js","./chunk.EQTSV7BK.js","./chunk.27CW6SCT.js","./chunk.7BBGRTXM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.L7V24JPO.js")),o=i.recipeDraft(n.recipe,{app:e.app,sight:i.draftSight(e.app,e.principal)});if(i.isDraftFailure(o))return o.failed;t?.(),e.seatTalk.setDraft(o,null),e.goTo.draft?.(),pn()}function pn(e=180){if(typeof document>"u")return;let n=document.querySelector('[data-testid="draft-keep"]'),t=document.activeElement,i=!t||t===document.body||t.closest?.("[inert]")!==null;if(n){i&&n.focus();return}e>0&&requestAnimationFrame(()=>pn(e-1))}async function de(e,n,t,i,o){let r=fn(e,t,i),c=n==="suggest"?await tn(e.ai,r):n==="fill"?await on(e.ai,r):n==="record"?await rn(e.ai,r):await sn(e.ai,r);if(c.interaction.outcome==="failed")return n!=="suggest"&&e.desk.record(c.interaction),c;let d=s=>{let f={...c.interaction,outcome:"failed",failed:s};return e.desk.record(f),{...c,interaction:f}};if(n==="fill"||n==="record"){if(!c.ghost||c.ghost.proposals.length===0)return d("Nothing here could be filled in.");o?.(),e.desk.setGhost({ghost:c.ghost}),e.desk.record(c.interaction)}if(n==="panel"&&c.panel){let s=await un(e,c.panel,o);if(s)return d(s);e.desk.record(c.interaction)}return c}var Fe=new WeakMap,Nn=64,cn=new WeakMap;function jn(e){let n=cn.get(e);if(!n){let t=n={n:0};cn.set(e,t),e.subscribe(()=>void(t.n+=1))}return n.n}var yn=(e,n)=>{let t=Y(n);return t.length>0?t.map(i=>e.graph.getNode(i)):[jn(e)]},gn=(e,n,t)=>JSON.stringify({target:n,seat:e.principal,by:t}),mn=(e,n,t)=>{let i=yn(e.store,n);return t.schema===e.store.schema&&t.ai===e.ai&&i.length===t.depends.length&&i.every((o,r)=>o===t.depends[r])};function Dn(e,n,t="menu"){let i=Fe.get(e.store)?.get(gn(e,n,t));return i?.result!==void 0&&mn(e,n,i)?i.result:void 0}function Ln(e,n,t){let i=Fe.get(e.store);i||Fe.set(e.store,i=new Map);let o=gn(e,n,t?.by??"menu"),r=i.get(o);if(r&&mn(e,n,r))return r.result?Promise.resolve(r.result):r.asked;let c=t?t.ask():de(e,"suggest",n),d={schema:e.store.schema,ai:e.ai,depends:yn(e.store,n),asked:c};i.delete(o),i.set(o,d),i.size>Nn&&i.delete(i.keys().next().value);let s=i;return c.then(f=>{f.interaction.outcome!=="failed"?d.result=f:s.get(o)===d&&s.delete(o)}),c}async function Hn(e,n,t,i){let o=n.interaction,r=ke(t);if(r){let c=o.usage?.at(-1)?.model,d=o.offered.find(f=>f.id===t.id)?.confidence,s=ae(e.store,{interaction:o.id,target:o.target,basis:`${o.ask.said}: ${t.label}`,...c?{model:c}:{},proposals:[{...r,...d!==void 0?{confidence:d}:{}}]},e.principal);if(s.proposals.length===0){let f="That can't be done now.";return e.desk.record({...o,outcome:"failed",failed:f}),f}i?.(),e.desk.setGhost({ghost:s}),e.desk.record(o);return}if(t.type==="panel"){let c=t.label,d={title:c,recipe:{...t.panel,title:c}},s=await un(e,d,i);return e.desk.record(s?{...o,outcome:"failed",failed:s}:{...o,outcome:"drawn",accepted:[t.id],panel:d}),s}i?.(),t.type==="place"?e.goTo.place(t.place):t.type==="record"&&e.goTo.record(t.record),e.desk.record({...o,outcome:"accepted",accepted:[t.id]})}async function yt(e,n){if(n.ask.kind==="ask")return fe(e.desk,{target:n.target,asked:n.ask.said}),null;let t=n.ask.kind==="panel"||n.ask.kind==="record"?n.ask.kind:"fill";return de(e,t,n.target,n.ask.said)}var z={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},we={margin:0,padding:"4px 10px",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function gt({target:e,close:n}){let t=Je(),i=(0,P.useMemo)(()=>Xe(e,y=>t.store.graph.has(y)),[e,t.store]),o=(0,P.useMemo)(()=>{let y=fn(t,i);return he(t.store,i,{principal:t.principal,places:t.places,...y.acts?{acts:y.acts}:{}})},[t,i]),r=o.candidates.some(y=>y.type==="fill"),c=o.candidates.some(y=>y.type==="panel"),d=(0,P.useMemo)(()=>c?Ze(t.store,i,{principal:t.principal,places:t.places,most:1}):[],[c,t,i]),s=(0,P.useMemo)(()=>new Set(t.store.allMutations().filter(y=>(y.creates??[]).length>0).map(y=>y.name)),[t.store]),f=U(t.ai)!==void 0&&o.candidates.some(y=>y.type==="act"&&y.asks.length>0&&s.has(y.mutation)),a=Oe(t.ai),p=Dn(t,i),h=JSON.stringify(i),[b,C]=(0,P.useState)(!1),[A,g]=(0,P.useState)(null),[x,O]=(0,P.useState)(a&&p===void 0);(0,P.useEffect)(()=>{if(p!==void 0||!(a||b))return;let y=!0;return O(!0),Ln(t,i).then(v=>{y&&(g(v),O(!1))}),()=>{y=!1}},[h,b]);let k=p??A,u=(k?.offers??[]).filter(y=>!(y.type==="place"&&d.some(v=>v.place===y.place))).slice(0,Math.max(0,3-d.length)),w=k?.interaction.outcome==="failed"?k.interaction.failed??"The AI could not suggest anything here.":null,T=(0,P.useRef)(!1),F=(0,P.useRef)(null);(0,P.useLayoutEffect)(()=>{k===null||!T.current||(T.current=!1,F.current?.querySelector("button")?.focus())},[k]);let q=(0,P.useRef)(!0);(0,P.useEffect)(()=>()=>{q.current=!1},[]);let[H,l]=(0,P.useState)(!1),[m,R]=(0,P.useState)(null),E=y=>{if(H)return;l(!0),R(null);let v=!1;y(()=>{v=!0,n()}).then(D=>{q.current&&(l(!1),D?R(D):v||n())},D=>{q.current&&(l(!1),R(D instanceof Error?D.message:String(D)))})},$=y=>y.interaction.outcome==="failed"?y.interaction.failed??"The AI could not do that here.":void 0;return(0,S.jsxs)("div",{ref:F,"data-testid":"inline-ai",style:{display:"grid",gap:2},children:[x&&!b?(0,S.jsx)("p",{role:"status","data-testid":"inline-ai-thinking",style:we,children:"Thinking\u2026"}):H?(0,S.jsx)("p",{role:"status","data-testid":"inline-ai-asking",style:we,children:"Asking\u2026"}):m?(0,S.jsx)("p",{role:"alert","data-testid":"inline-ai-failed",style:{...we,color:"var(--graview-warn)"},children:m}):w?(0,S.jsx)("p",{role:"status",style:we,children:w}):null,(0,S.jsxs)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[u.map(y=>(0,S.jsx)("li",{children:(0,S.jsxs)("button",{type:"button","data-menu-item":`ai-offer:${y.id}`,"data-ai-offer":y.id,"data-ai-offer-type":y.type,onClick:()=>E(v=>Hn(t,k,y,v)),style:z,children:[y.label,(0,S.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",y.type==="panel"?"a panel":y.type==="place"?"go there":y.type==="record"?"open it":"suggested"]})]})},y.id)),!a&&k===null?(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":"ai-suggest","aria-disabled":b||void 0,onClick:y=>{b||(T.current=document.activeElement===y.currentTarget,C(!0))},style:z,children:b?"Thinking\u2026":"Suggest\u2026"})}):null,r?(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":"ai-fill",onClick:()=>E(async y=>$(await de(t,"fill",i,"Fill in",y))),style:z,children:"Fill in with AI"})}):null,f?(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":"ai-record",onClick:()=>E(async y=>$(await de(t,"record",i,"Add one",y))),style:z,children:"Add one with AI"})}):null,d.map(y=>(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":`ai-open:${y.place}`,"data-ai-existing":y.fit,onClick:()=>{n(),t.goTo.place(y.place),y.fit==="partial"&&fe(t.desk,{target:{on:"lens",place:y.place,...y.kind?{kind:y.kind}:{}}})},style:z,children:y.fit==="full"?`Open ${y.title}`:`Open and adjust ${y.title}`})},y.place)),c?(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":"ai-panel",onClick:()=>E(async y=>$(await de(t,"panel",i,"Draw a panel",y))),style:z,children:d.length>0?"Draw a new view":"Draw a panel"})}):null,(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":"ai-ask",onClick:()=>{let y=document.activeElement;n(),fe(t.desk,{target:i,returnTo:y instanceof HTMLElement&&y!==document.body?y:null})},style:z,children:"Ask about this\u2026"})})]})]})}var Ae={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 10px",fontSize:"0.8125rem",borderRadius:8};function mt({placement:e="picture"}){let{store:n,principal:t,aiDesk:i}=ze(),o=We(n,t),{ghost:r,entries:c}=_e(i),[d,s]=(0,P.useState)(new Set);(0,P.useEffect)(()=>s(new Set),[r?.ghost.interaction]);let f=(0,P.useRef)(null),a=(0,P.useRef)(null),p=r?.batch;if((0,P.useEffect)(()=>{p!==void 0&&a.current?.focus()},[p]),!r)return null;let{ghost:h}=r,b=c.find(k=>k.id===h.interaction),C=()=>{let k=h.target.on==="record"||h.target.on==="field"?h.target.id:void 0,u=f.current?.closest("[data-graview-face], main")?.parentElement??document,w=(k?u.querySelector(`[data-graview-view="${CSS.escape(k)}"][tabindex]`):null)??document.querySelector("[data-graview-page-title]")??f.current?.closest("main")??document.querySelector("main");w&&!w.hasAttribute("tabindex")&&w.setAttribute("tabindex","-1"),w?.focus({preventScroll:!0}),i.setGhost(null)},A=h.proposals.filter(k=>!d.has(k.id)).map(k=>k.id),g=()=>{let k=an(o,h,{author:t,ids:A});if(!k.ok){i.setGhost({...r,refused:k.refused});return}b&&i.record(dn(b,k.accepted,k.batch)),i.setGhost({ghost:h,batch:k.batch,took:k.accepted.length,...r.onCard?{onCard:!0}:{}})},x=()=>{b&&r.batch===void 0&&i.record(ln(b)),C()},O=()=>{if(r.batch!==void 0)try{o.undo(r.batch,{author:t}),C()}catch(k){i.setGhost({...r,refused:k instanceof Error?k.message:String(k)})}};return(0,S.jsxs)("section",{ref:f,"data-testid":"ai-ghost","data-interaction":h.interaction,"aria-label":"Proposed by AI",style:{...e==="card"?{position:"static"}:{position:e==="page"?"fixed":"absolute",insetInline:"max(12px, calc(50% - 220px))",bottom:"calc(var(--graview-foot-room, 0px) + 72px)",zIndex:He("toast"),boxShadow:"var(--graview-lift-high)"},display:"grid",gap:8,padding:12,borderRadius:12,border:"1px dashed var(--graview-accent)",background:"var(--graview-float)",fontSize:"0.875rem"},children:[(0,S.jsx)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:r.batch!==void 0?`Done: ${r.took===1?"one change":`${r.took} changes`}, as one.`:`Proposed by AI \xB7 ${h.basis}`}),r.batch===void 0?(0,S.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:h.proposals.map(k=>(0,S.jsx)("li",{"data-ghost-proposal":k.id,children:(0,S.jsxs)("label",{style:{display:"flex",alignItems:"baseline",gap:8,cursor:"pointer"},children:[(0,S.jsx)("input",{type:"checkbox",checked:!d.has(k.id),onChange:u=>{let w=new Set(d);u.target.checked?w.delete(k.id):w.add(k.id),s(w)}}),(0,S.jsx)("span",{style:{fontStyle:"italic",color:"var(--graview-ink)"},children:k.said}),k.confidence!==void 0?(0,S.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[Math.round(k.confidence*100),"% sure"]}):null]})},k.id))}):null,r.refused?(0,S.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-warn)"},children:r.refused}):null,(0,S.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:r.batch===void 0?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("button",{type:"button","data-testid":"ghost-accept",disabled:A.length===0,onClick:g,style:Ae,children:A.length===h.proposals.length?"Accept":`Accept ${A.length} of ${h.proposals.length}`}),(0,S.jsx)("button",{type:"button","data-testid":"ghost-dismiss",onClick:x,style:Ae,children:"Dismiss"})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("button",{type:"button",ref:a,"data-testid":"ghost-undo",onClick:O,style:Ae,children:"Undo"}),(0,S.jsx)("button",{type:"button","data-testid":"ghost-close",onClick:C,style:Ae,children:"Close"})]})})]})}export{Xe as a,Y as b,he as c,Ze as d,te as e,Ie as f,Rn as g,Tn as h,it as i,ot as j,fn as k,un as l,de as m,Dn as n,Ln as o,Hn as p,yt as q,gt as r,mt as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{b as v}from"./chunk.
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{b as v}from"./chunk.34TW32TB.js";import"./chunk.YD3TKV6P.js";import"./chunk.4KC35UNR.js";import{G as S,S as y,T as b}from"./chunk.HT2BEOEV.js";import"./chunk.SDO3U72B.js";import"./chunk.7BBGRTXM.js";import"./chunk.FQLNBIQ5.js";import{b as u}from"./chunk.AJZBJBMO.js";var r=u(S(),1);var t=u(b(),1);function E(o){let a=(0,r.useContext)(y),l=(0,t.jsx)(C,{...o});return!a||o.nodeId===void 0?l:(0,t.jsx)(P,{nodeId:o.nodeId,field:o.field,label:o.label,...o.markdown?{markdown:!0}:{},live:a,onDone:d=>o.onDone?o.onDone(d):o.onCancel(),writtenWhole:l})}var P=(0,r.lazy)(()=>(__graviewPreload(import.meta.url,["./chunk.34TW32TB.js","./chunk.YD3TKV6P.js","./chunk.4KC35UNR.js","./chunk.HT2BEOEV.js","./chunk.SDO3U72B.js","./chunk.7BBGRTXM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.4Y2JTY6Q.js")));function C({field:o,label:a,value:l,markdown:d,onSave:s,onCancel:c}){let[i,h]=(0,r.useState)(l),[n,w]=(0,r.useState)(!1),f=(0,r.useRef)(null);return(0,r.useEffect)(()=>f.current?.focus(),[n]),(0,r.useLayoutEffect)(()=>{let e=f.current;if(!e||n||typeof CSS<"u"&&CSS.supports?.("field-sizing","content"))return;let p=()=>{e.style.height="auto";let m=getComputedStyle(e);e.style.height=`${e.scrollHeight+parseFloat(m.borderTopWidth)+parseFloat(m.borderBottomWidth)}px`};p();let x=requestAnimationFrame(p);return()=>cancelAnimationFrame(x)},[i,n]),(0,t.jsxs)("form",{style:{display:"grid",gap:8,minWidth:0},onSubmit:e=>{e.preventDefault(),s(i,!1)},children:[n?(0,t.jsx)("div",{"data-graview-preview":o,"aria-label":`${a}, as it will read`,role:"region",style:k,children:(0,t.jsx)(v,{text:i,markdown:!0})}):(0,t.jsx)("textarea",{ref:f,"aria-label":a,"data-graview-field":o,value:i,rows:3,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key==="Escape"?(e.preventDefault(),c()):e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),s(i,!1))},onBlur:e=>{e.relatedTarget instanceof Node&&e.currentTarget.form?.contains(e.relatedTarget)||s(i,!0)},style:T}),(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,t.jsx)("button",{type:"submit",style:g,children:"Save"}),(0,t.jsx)("button",{type:"button",onClick:c,style:g,children:"Cancel"}),d?(0,t.jsx)("button",{type:"button","aria-pressed":n,onClick:()=>w(!n),style:g,children:n?"Write":"Preview"}):null,(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"Ctrl or \u2318 Enter saves \xB7 Esc puts it back"})]})]})}var k={minHeight:"7.5em",padding:"8px 10px",border:"1px dashed var(--graview-edge-bright)",borderRadius:6,lineHeight:1.6,minWidth:0},g={font:"inherit",fontSize:"0.8125rem",minHeight:28,padding:"2px 12px"},T={font:"inherit",lineHeight:1.5,width:"100%",boxSizing:"border-box",minHeight:"7.5em",padding:"8px 10px",resize:"vertical",fieldSizing:"content",color:"var(--graview-ink)",background:"var(--graview-panel, transparent)",border:"1px solid var(--graview-edge-bright)",borderRadius:6};export{E as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk.E34OQVSR.js";import"./chunk.CCWPF5PK.js";import"./chunk.YD3TKV6P.js";import"./chunk.4KC35UNR.js";import"./chunk.HT2BEOEV.js";import"./chunk.SDO3U72B.js";import"./chunk.7BBGRTXM.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{a as ActivityFilter,b as InteractionRow};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{b as ie}from"./chunk.
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{b as ie}from"./chunk.R7LFO7KI.js";import{a as X,c as H,d as J,e as Q}from"./chunk.LMN4TSAP.js";import"./chunk.HS3GHAUR.js";import"./chunk.ZOHMWSHD.js";import"./chunk.PZG3B7F4.js";import"./chunk.LRUNFSHP.js";import"./chunk.43OKZU73.js";import"./chunk.WNSC3RWD.js";import"./chunk.S5MGE2U5.js";import"./chunk.KXPRILAO.js";import"./chunk.GZHZLJBF.js";import"./chunk.ELERUERU.js";import"./chunk.OJGHDWI6.js";import"./chunk.YHTE34RN.js";import"./chunk.3YZHZGTM.js";import"./chunk.EQTSV7BK.js";import"./chunk.27CW6SCT.js";import"./chunk.YD3TKV6P.js";import"./chunk.4KC35UNR.js";import{F as K,G as q,Ga as z,Ra as U,T as x,U as F,Va as Y,ba as b,c as j,x as V}from"./chunk.HT2BEOEV.js";import{a as N}from"./chunk.SDO3U72B.js";import{Za as _,_a as D,da as I,ga as G,ka as B,zb as W}from"./chunk.7BBGRTXM.js";import"./chunk.FQLNBIQ5.js";import{b as w}from"./chunk.AJZBJBMO.js";var ae=w(q(),1);function P(e){return{minHeight:24,padding:"3px 10px",borderRadius:6,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:e?"transparent":"var(--graview-edge)",color:e?"var(--graview-ink)":"var(--graview-ink-muted)",fontWeight:e?600:400,background:e?"color-mix(in srgb, var(--graview-accent) 16%, transparent)":"transparent"}}var M=w(x(),1);function Z(){let{seats:e,principal:t,takeSeat:i}=b();return e.length<2?null:(0,M.jsxs)("div",{role:"group","aria-label":"Seat","data-testid":"seats",style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6,rowGap:4},children:[(0,M.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"As"}),e.map(a=>{let l=oe(t,a.principal);return(0,M.jsx)("button",{type:"button","aria-pressed":l,"data-testid":`seat-${a.principal.id??a.label}`,title:`Sit down as ${a.label}: the acts, the kinds and the pages narrow to what this seat may do`,onClick:()=>i(a.principal),style:{...P(l),whiteSpace:"nowrap"},children:a.label},a.principal.id??a.label)})]})}function oe(e,t){return e.kind===t.kind&&e.id===t.id}var E=w(q(),1),c=w(x(),1),se=`
|
|
2
2
|
.graview-here{display:flex;flex:none}
|
|
3
3
|
.graview-here>button{display:inline-flex;align-items:center;gap:4px;height:30px;margin:0;padding:0 4px;border:1px solid transparent;border-radius:8px;background:none;box-shadow:none;font:inherit;font-size:.75rem;color:var(--graview-ink-muted);cursor:pointer}
|
|
4
4
|
.graview-here-mark{display:inline-flex;align-items:center;justify-content:center;flex:none;box-sizing:border-box;width:24px;height:24px;border-radius:50%;border:1.5px solid hsl(var(--graview-hue) 50% 48%);background:var(--graview-panel-muted);color:var(--graview-ink);font-size:.75rem;font-weight:600;box-shadow:0 0 0 2px var(--graview-bar)}
|
|
@@ -6,4 +6,4 @@ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=gl
|
|
|
6
6
|
.graview-here-mark[data-agent]{border-radius:5px}
|
|
7
7
|
.graview-here-mark[data-counted]{--graview-hue:0;border-color:var(--graview-edge)}
|
|
8
8
|
.graview-here small{display:block;font-size:.75rem;color:var(--graview-ink-muted)}
|
|
9
|
-
.graview-bar[data-finding] .graview-here{display:none}`,le={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"};function de(e,t){let i=t.id===void 0?null:`${t.kind}:${t.id}`,a=new Map;for(let l of e.values()){let d=l.participant.slice(0,l.participant.lastIndexOf(":"));if(d===i)continue;let s=d.endsWith(":")?l.participant:d,o=a.get(s);(!o||o.at<l.at)&&a.set(s,l)}return[...a.values()]}var ee=e=>e.name&&e.onBehalfOfName?`${e.name}, for ${e.onBehalfOfName}`:e.name??"",te=e=>e===1?"1 viewer":`${e} viewers`;function pe(e){let t=e.map(ee).filter(Boolean),i=t.length<e.length?[...t,te(e.length-t.length)]:t,a=i.pop();return`${i.length>0?`${i.join(", ")} and ${a}`:a} ${e.length===1?"is":"are"} here`}function ce(e,t){let{store:i,hidden:a,pictures:l}=t,d=j(e),s=i.kindsKeptFrom(t.principal),o=u=>!a.has(u)&&!s.has(u)&&!i.modules.disabledKinds.has(u),g=l.find(u=>u.as===d.within?.view&&o(u.kind));if(g)return g.title;if(!d.focusId)return d.overview?"the whole thing":null;let p=V(d.focusId);if(p.length>0)return p.every(o)?p.map(u=>B(i.schema,u)).join(" and "):null;let h=i.graph.getNode(d.focusId);return h&&o(h.kind)?G(i.schema.tryDefinition(h.kind),h):null}function ue(e,t){let i=o=>o.id!==void 0&&(o.id===t.principal.id||o.onBehalfOf?.id===t.principal.id),a=e.filter(o=>!W(o)&&_(o.author)!=="system"&&!i(o.author)),l=a[0];if(!l)return null;let d=D(l.author,{graph:t.store.graph,schema:t.store.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}}),s=[...new Set(a.map(o=>o.intent))].join("; ");return`${d}: ${s}`}function ge(e,t,i){let a=ue(e,t);a&&(i(""),setTimeout(()=>i(a),50))}function he({scene:e,compact:t}){let{who:i,principal:a,store:l,views:d,hiddenKinds:s,follow:o}=b(),g=Y("here"),p=de(i,a),h=p.length===0?"":pe(p),[u,S]=(0,E.useState)("");if((0,E.useEffect)(()=>S(h),[h]),p.length===0)return null;let f=p.filter(r=>r.name),y=f.slice(0,t?2:3),m=p.length-y.length,k=p.length-f.length,T=d.places();return(0,c.jsxs)("div",{className:"graview-here","data-testid":"here",children:[(0,c.jsx)("style",{children:se}),(0,c.jsx)("span",{role:"status","aria-live":"polite",style:le,children:u}),(0,c.jsxs)("button",{type:"button","data-testid":"here-open",...g.trigger,onClick:g.toggle,"aria-label":`${h} \u2014 who and where`,title:h,children:[y.length>0?(0,c.jsx)("span",{style:{display:"flex"},children:y.map(r=>(0,c.jsx)(O,{one:r},r.participant))}):(0,c.jsx)(O,{count:m}),y.length>0&&m>0?(0,c.jsxs)("span",{"aria-hidden":"true",children:["+",m]}):null]}),(0,c.jsxs)("ul",{...g.pane,"aria-label":"Who is here","data-testid":"here-list",hidden:!g.open,className:"graview-bar-list",style:U,children:[f.map(r=>{let v=ce(r.stop,{store:l,principal:a,hidden:s,pictures:T}),A=ee(r);return(0,c.jsx)("li",{children:(0,c.jsxs)(e?"button":"span",{className:"graview-bar-item","data-testid":"here-one",...e?{type:"button",title:`Go where ${A} is`,onClick:()=>{g.setOpen(!1),o(r.participant)}}:{style:{cursor:"default"}},children:[(0,c.jsx)(O,{one:r}),(0,c.jsxs)("span",{children:[A,v?(0,c.jsxs)("small",{children:["On ",v]}):null]})]})},r.participant)}),k>0?(0,c.jsx)("li",{children:(0,c.jsxs)("span",{className:"graview-bar-item","data-testid":"here-viewers",style:{cursor:"default"},children:[(0,c.jsx)(O,{count:k}),(0,c.jsxs)("span",{children:[te(k),(0,c.jsx)("small",{children:"Not signed in"})]})]})}):null]})]})}function O({one:e,count:t}){return(0,c.jsx)("span",{className:"graview-here-mark","aria-hidden":"true",...e?{style:{"--graview-hue":Math.round(e.hue)}}:{"data-counted":""},...e?.kind==="agent"?{"data-agent":""}:{},children:e?(e.name??"").trim().charAt(0).toUpperCase():t})}function me(e){let t=/^(?:place|scene):([^:]+):(.+)$/.exec(e.key);return t?{place:t[2],about:[`aggregate:${t[1]}`],title:e.label}:{about:e.group==="lists"&&e.kind?[`aggregate:${e.kind}`]:[],title:e.label}}function L(e,t,i,a,l,d){let s=me(t),o=e.getBoundingClientRect(),g={...s,face:i?"scene":"pages",x:Math.round(l??o.left+Math.min(16,o.width/2)),y:Math.round(d??Math.min(o.bottom,o.top+36)),returnTo:e},p=i?null:e.closest("[data-graview-embed], [data-graview-shell]")?.querySelector("[data-graview-face='pages']")??document.querySelector("[data-graview-face='pages']");p?p.dispatchEvent(new CustomEvent(F,{detail:g})):a(g)}var R={on:null,at:0},ne=500,ye=10;function fe(e,t,i,a,l,d,s){let o=t.getAttribute("data-testid")??"",g=o==="app-places-open"?a:o.slice(10),p=i.find(m=>m.key===g);if(!p)return;if(e.type==="keydown")return R={on:t,at:Date.now()},L(t,p,l,d);let{clientX:h,clientY:u}=e;if(e.type==="contextmenu")return R.on===t&&Date.now()-R.at<700?void 0:h===0&&u===0?L(t,p,l,d):L(t,p,l,d,h,u);let S=Date.now()-Math.max(0,performance.now()-e.timeStamp),f=!1,y=m=>{Math.hypot(m.clientX-h,m.clientY-u)>ye&&(f=!0)};document.addEventListener("pointermove",y),setTimeout(()=>{document.removeEventListener("pointermove",y),!(f||s.at!==0&&s.at-S<ne)&&(R={on:t,at:Date.now()},t.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation()},{capture:!0,once:!0}),L(t,p,l,d,h,u))},Math.max(0,ne-(Date.now()-S)))}var n=w(x(),1),Ge=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.HFVMGTNL.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.BNEOLRQG.js")))).part((e,t)=>(0,n.jsx)(e.TidyGroups,{...t}),{quiet:!0}),ve=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.2YNZVNCA.js")))).part((e,t)=>(0,n.jsx)(e.HoverChipsSwitch,{...t}),{quiet:!0});function Be({violations:e,pick:t}){let{store:i,brand:a,setMenuAt:l}=b(),d=X(i,e);return(0,n.jsx)(n.Fragment,{children:d.map((s,o)=>{let g=Q(s),p=s.repairs.length>0?`${s.repairs.length} ${s.repairs.length===1?"way":"ways"} to fix`:"";return(0,n.jsx)("li",{style:{borderTop:o===0?"none":"1px solid var(--graview-edge)"},children:(0,n.jsxs)("button",{type:"button",onClick:h=>{let u=h.currentTarget.closest("ol").getBoundingClientRect();t(s),l({x:u.left,y:u.top,on:s.subjectId})},...H(s)!==void 0?{title:H(s)}:{},style:{width:"100%",textAlign:"left",fontSize:"0.8125rem",lineHeight:1.4,padding:"7px 8px",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7},children:[s.line?(0,n.jsx)(J,{line:s.line,schema:i.schema,...a?{brand:a}:{},stacked:!0,style:{display:"block",color:"var(--graview-ink)"}}):(0,n.jsx)("span",{style:{display:"block",color:"var(--graview-ink)"},children:s.message}),g||p?(0,n.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:[g,p].filter(Boolean).join(" \xB7 ")}):null]})},`${s.invariant}:${o}`)})})}function _e({name:e,me:t,scheme:i,onScheme:a,profileHref:l,hostActions:d,close:s,part:o,signature:g=!1}){let{principal:p,seats:h,settings:u,settingValues:S,chooseSetting:f,sharing:y,ai:m}=b(),k=p.roles??[],T={setOpen:r=>s()};return(0,n.jsx)(n.Fragment,{children:o==="top"?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{style:{display:"grid",gap:3},children:[(0,n.jsx)("span",{style:$,children:"Signed in as"}),(0,n.jsx)("strong",{style:{fontSize:"1rem",fontWeight:550},children:e}),(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:k.length>0?k.map(r=>I(r)).join(", "):t===void 0?"This app has no sign-in; everything here is yours.":"No role in particular"}),t!==void 0&&l!==void 0?(0,n.jsx)("a",{href:l(t.id),"data-testid":"profile-record",style:{display:"inline-flex",alignItems:"center",minHeight:24,justifySelf:"start",fontSize:"0.875rem",color:"var(--graview-accent)"},children:"Your record \u2197"}):null,y?(0,n.jsxs)("span",{"data-testid":"profile-seen-as",style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["Seen by others as ",y.name]}):null]}),d.length>0?(0,n.jsx)("ul",{role:"list","aria-label":"From the host","data-testid":"host-actions",style:{...C,margin:0,paddingLeft:0,listStyle:"none",display:"grid",gap:2},children:d.map(r=>(0,n.jsx)("li",{children:r.href!==void 0?(0,n.jsx)("a",{href:r.href,"data-testid":"host-action",className:"graview-host-action",...r.target?{target:r.target,rel:"noopener"}:{},onClick:()=>{r.onSelect?.(),T.setOpen(!1)},style:re,children:r.label}):(0,n.jsx)("button",{type:"button","data-testid":"host-action",className:"graview-host-action",onClick:()=>{T.setOpen(!1),r.onSelect?.()},style:{...re,width:"100%",textAlign:"left",border:"none",background:"none",boxShadow:"none",font:"inherit",cursor:"pointer"},children:r.label})},r.label))}):null]}):(0,n.jsxs)(n.Fragment,{children:[h.length>1?(0,n.jsxs)("div",{style:{display:"grid",gap:6,...C},children:[(0,n.jsx)("span",{style:$,children:"Sit as somebody else"}),(0,n.jsx)(Z,{})]}):null,u.length>0?(0,n.jsx)("div",{style:{display:"grid",gap:10,...C},children:u.map(r=>(0,n.jsxs)("fieldset",{"data-testid":`setting-${r.name}`,style:{border:0,margin:0,padding:0,display:"grid",gap:5},children:[(0,n.jsx)("legend",{style:{...$,padding:0},children:r.title}),r.description?(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:r.description}):null,(0,n.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:r.options.map(v=>{let A=(S[r.name]??r.initial)===v.value;return(0,n.jsx)("button",{type:"button","aria-pressed":A,"data-testid":`setting-${r.name}-${v.value}`,onClick:()=>f(r.name,v.value),style:P(A),children:v.label},v.value)})})]},r.name))}):null,K(m)?(0,n.jsx)(ae.Suspense,{fallback:null,children:(0,n.jsx)(ve,{legend:$,style:C,choice:P})}):null,i!==void 0&&a!==void 0?(0,n.jsxs)("div",{style:{display:"grid",gap:5,...C},children:[(0,n.jsx)("span",{style:$,children:"Scheme"}),(0,n.jsx)("div",{style:{display:"flex",gap:4},children:["light","dark"].map(r=>(0,n.jsx)("button",{type:"button","aria-pressed":i===r,"data-testid":`profile-scheme-${r}`,onClick:()=>a(r),style:P(i===r),children:r==="light"?"\u2600 Light":"\u263E Dark"},r))})]}):null,g?(0,n.jsxs)("p",{"data-testid":"graview-signature",style:{...C,margin:0,display:"flex",alignItems:"center",gap:6,fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["Built with",(0,n.jsxs)("a",{href:"https://graview.dev",target:"_blank",rel:"noopener",style:{display:"inline-flex",alignItems:"center",gap:4,minHeight:24,color:"var(--graview-ink-muted)",fontWeight:600,textDecoration:"none"},children:[(0,n.jsx)("span",{"data-testid":"graview-mark",style:{display:"inline-flex",lineHeight:0},dangerouslySetInnerHTML:{__html:we}}),"Graview"]})]}):null]})})}var we='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="14" height="14" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="2.4" stroke-linejoin="round"><path d="M13 11 L3 8 L14 3 H29 L21 9"/><path d="M10 18 L3 23 L16.5 28 L29 21 L22 19"/><path d="M16.5 18.5 V23.5" stroke-linecap="round"/></g><circle cx="16.5" cy="13.5" r="2" fill="var(--graview-mark-point, currentColor)"/></svg>',re={display:"flex",alignItems:"center",minHeight:28,padding:"2px 8px",borderRadius:7,fontSize:"0.875rem",color:"var(--graview-ink)",textDecoration:"none"},$={fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},C={paddingTop:10,borderTop:"1px solid var(--graview-edge)"};export{ie as ActivityRail,he as Here,Be as ProblemRows,_e as ProfilePane,Ge as TidyFoot,fe as placeGesture,ge as sayTheirChange};
|
|
9
|
+
.graview-bar[data-finding] .graview-here{display:none}`,le={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"};function de(e,t){let i=t.id===void 0?null:`${t.kind}:${t.id}`,a=new Map;for(let l of e.values()){let d=l.participant.slice(0,l.participant.lastIndexOf(":"));if(d===i)continue;let s=d.endsWith(":")?l.participant:d,o=a.get(s);(!o||o.at<l.at)&&a.set(s,l)}return[...a.values()]}var ee=e=>e.name&&e.onBehalfOfName?`${e.name}, for ${e.onBehalfOfName}`:e.name??"",te=e=>e===1?"1 viewer":`${e} viewers`;function pe(e){let t=e.map(ee).filter(Boolean),i=t.length<e.length?[...t,te(e.length-t.length)]:t,a=i.pop();return`${i.length>0?`${i.join(", ")} and ${a}`:a} ${e.length===1?"is":"are"} here`}function ce(e,t){let{store:i,hidden:a,pictures:l}=t,d=j(e),s=i.kindsKeptFrom(t.principal),o=u=>!a.has(u)&&!s.has(u)&&!i.modules.disabledKinds.has(u),g=l.find(u=>u.as===d.within?.view&&o(u.kind));if(g)return g.title;if(!d.focusId)return d.overview?"the whole thing":null;let p=V(d.focusId);if(p.length>0)return p.every(o)?p.map(u=>B(i.schema,u)).join(" and "):null;let h=i.graph.getNode(d.focusId);return h&&o(h.kind)?G(i.schema.tryDefinition(h.kind),h):null}function ue(e,t){let i=o=>o.id!==void 0&&(o.id===t.principal.id||o.onBehalfOf?.id===t.principal.id),a=e.filter(o=>!W(o)&&_(o.author)!=="system"&&!i(o.author)),l=a[0];if(!l)return null;let d=D(l.author,{graph:t.store.graph,schema:t.store.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}}),s=[...new Set(a.map(o=>o.intent))].join("; ");return`${d}: ${s}`}function ge(e,t,i){let a=ue(e,t);a&&(i(""),setTimeout(()=>i(a),50))}function he({scene:e,compact:t}){let{who:i,principal:a,store:l,views:d,hiddenKinds:s,follow:o}=b(),g=Y("here"),p=de(i,a),h=p.length===0?"":pe(p),[u,S]=(0,E.useState)("");if((0,E.useEffect)(()=>S(h),[h]),p.length===0)return null;let f=p.filter(r=>r.name),y=f.slice(0,t?2:3),m=p.length-y.length,k=p.length-f.length,T=d.places();return(0,c.jsxs)("div",{className:"graview-here","data-testid":"here",children:[(0,c.jsx)("style",{children:se}),(0,c.jsx)("span",{role:"status","aria-live":"polite",style:le,children:u}),(0,c.jsxs)("button",{type:"button","data-testid":"here-open",...g.trigger,onClick:g.toggle,"aria-label":`${h} \u2014 who and where`,title:h,children:[y.length>0?(0,c.jsx)("span",{style:{display:"flex"},children:y.map(r=>(0,c.jsx)(O,{one:r},r.participant))}):(0,c.jsx)(O,{count:m}),y.length>0&&m>0?(0,c.jsxs)("span",{"aria-hidden":"true",children:["+",m]}):null]}),(0,c.jsxs)("ul",{...g.pane,"aria-label":"Who is here","data-testid":"here-list",hidden:!g.open,className:"graview-bar-list",style:U,children:[f.map(r=>{let v=ce(r.stop,{store:l,principal:a,hidden:s,pictures:T}),A=ee(r);return(0,c.jsx)("li",{children:(0,c.jsxs)(e?"button":"span",{className:"graview-bar-item","data-testid":"here-one",...e?{type:"button",title:`Go where ${A} is`,onClick:()=>{g.setOpen(!1),o(r.participant)}}:{style:{cursor:"default"}},children:[(0,c.jsx)(O,{one:r}),(0,c.jsxs)("span",{children:[A,v?(0,c.jsxs)("small",{children:["On ",v]}):null]})]})},r.participant)}),k>0?(0,c.jsx)("li",{children:(0,c.jsxs)("span",{className:"graview-bar-item","data-testid":"here-viewers",style:{cursor:"default"},children:[(0,c.jsx)(O,{count:k}),(0,c.jsxs)("span",{children:[te(k),(0,c.jsx)("small",{children:"Not signed in"})]})]})}):null]})]})}function O({one:e,count:t}){return(0,c.jsx)("span",{className:"graview-here-mark","aria-hidden":"true",...e?{style:{"--graview-hue":Math.round(e.hue)}}:{"data-counted":""},...e?.kind==="agent"?{"data-agent":""}:{},children:e?(e.name??"").trim().charAt(0).toUpperCase():t})}function me(e){let t=/^(?:place|scene):([^:]+):(.+)$/.exec(e.key);return t?{place:t[2],about:[`aggregate:${t[1]}`],title:e.label}:{about:e.group==="lists"&&e.kind?[`aggregate:${e.kind}`]:[],title:e.label}}function L(e,t,i,a,l,d){let s=me(t),o=e.getBoundingClientRect(),g={...s,face:i?"scene":"pages",x:Math.round(l??o.left+Math.min(16,o.width/2)),y:Math.round(d??Math.min(o.bottom,o.top+36)),returnTo:e},p=i?null:e.closest("[data-graview-embed], [data-graview-shell]")?.querySelector("[data-graview-face='pages']")??document.querySelector("[data-graview-face='pages']");p?p.dispatchEvent(new CustomEvent(F,{detail:g})):a(g)}var R={on:null,at:0},ne=500,ye=10;function fe(e,t,i,a,l,d,s){let o=t.getAttribute("data-testid")??"",g=o==="app-places-open"?a:o.slice(10),p=i.find(m=>m.key===g);if(!p)return;if(e.type==="keydown")return R={on:t,at:Date.now()},L(t,p,l,d);let{clientX:h,clientY:u}=e;if(e.type==="contextmenu")return R.on===t&&Date.now()-R.at<700?void 0:h===0&&u===0?L(t,p,l,d):L(t,p,l,d,h,u);let S=Date.now()-Math.max(0,performance.now()-e.timeStamp),f=!1,y=m=>{Math.hypot(m.clientX-h,m.clientY-u)>ye&&(f=!0)};document.addEventListener("pointermove",y),setTimeout(()=>{document.removeEventListener("pointermove",y),!(f||s.at!==0&&s.at-S<ne)&&(R={on:t,at:Date.now()},t.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation()},{capture:!0,once:!0}),L(t,p,l,d,h,u))},Math.max(0,ne-(Date.now()-S)))}var n=w(x(),1),Ge=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.YD3TKV6P.js","./chunk.4KC35UNR.js","./chunk.HT2BEOEV.js","./chunk.SDO3U72B.js","./chunk.7BBGRTXM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.VHSWBFXB.js")))).part((e,t)=>(0,n.jsx)(e.TidyGroups,{...t}),{quiet:!0}),ve=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.HT2BEOEV.js","./chunk.SDO3U72B.js","./chunk.7BBGRTXM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.JUNMJYH5.js")))).part((e,t)=>(0,n.jsx)(e.HoverChipsSwitch,{...t}),{quiet:!0});function Be({violations:e,pick:t}){let{store:i,brand:a,setMenuAt:l}=b(),d=X(i,e);return(0,n.jsx)(n.Fragment,{children:d.map((s,o)=>{let g=Q(s),p=s.repairs.length>0?`${s.repairs.length} ${s.repairs.length===1?"way":"ways"} to fix`:"";return(0,n.jsx)("li",{style:{borderTop:o===0?"none":"1px solid var(--graview-edge)"},children:(0,n.jsxs)("button",{type:"button",onClick:h=>{let u=h.currentTarget.closest("ol").getBoundingClientRect();t(s),l({x:u.left,y:u.top,on:s.subjectId})},...H(s)!==void 0?{title:H(s)}:{},style:{width:"100%",textAlign:"left",fontSize:"0.8125rem",lineHeight:1.4,padding:"7px 8px",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7},children:[s.line?(0,n.jsx)(J,{line:s.line,schema:i.schema,...a?{brand:a}:{},stacked:!0,style:{display:"block",color:"var(--graview-ink)"}}):(0,n.jsx)("span",{style:{display:"block",color:"var(--graview-ink)"},children:s.message}),g||p?(0,n.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:[g,p].filter(Boolean).join(" \xB7 ")}):null]})},`${s.invariant}:${o}`)})})}function _e({name:e,me:t,scheme:i,onScheme:a,profileHref:l,hostActions:d,close:s,part:o,signature:g=!1}){let{principal:p,seats:h,settings:u,settingValues:S,chooseSetting:f,sharing:y,ai:m}=b(),k=p.roles??[],T={setOpen:r=>s()};return(0,n.jsx)(n.Fragment,{children:o==="top"?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{style:{display:"grid",gap:3},children:[(0,n.jsx)("span",{style:$,children:"Signed in as"}),(0,n.jsx)("strong",{style:{fontSize:"1rem",fontWeight:550},children:e}),(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:k.length>0?k.map(r=>I(r)).join(", "):t===void 0?"This app has no sign-in; everything here is yours.":"No role in particular"}),t!==void 0&&l!==void 0?(0,n.jsx)("a",{href:l(t.id),"data-testid":"profile-record",style:{display:"inline-flex",alignItems:"center",minHeight:24,justifySelf:"start",fontSize:"0.875rem",color:"var(--graview-accent)"},children:"Your record \u2197"}):null,y?(0,n.jsxs)("span",{"data-testid":"profile-seen-as",style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["Seen by others as ",y.name]}):null]}),d.length>0?(0,n.jsx)("ul",{role:"list","aria-label":"From the host","data-testid":"host-actions",style:{...C,margin:0,paddingLeft:0,listStyle:"none",display:"grid",gap:2},children:d.map(r=>(0,n.jsx)("li",{children:r.href!==void 0?(0,n.jsx)("a",{href:r.href,"data-testid":"host-action",className:"graview-host-action",...r.target?{target:r.target,rel:"noopener"}:{},onClick:()=>{r.onSelect?.(),T.setOpen(!1)},style:re,children:r.label}):(0,n.jsx)("button",{type:"button","data-testid":"host-action",className:"graview-host-action",onClick:()=>{T.setOpen(!1),r.onSelect?.()},style:{...re,width:"100%",textAlign:"left",border:"none",background:"none",boxShadow:"none",font:"inherit",cursor:"pointer"},children:r.label})},r.label))}):null]}):(0,n.jsxs)(n.Fragment,{children:[h.length>1?(0,n.jsxs)("div",{style:{display:"grid",gap:6,...C},children:[(0,n.jsx)("span",{style:$,children:"Sit as somebody else"}),(0,n.jsx)(Z,{})]}):null,u.length>0?(0,n.jsx)("div",{style:{display:"grid",gap:10,...C},children:u.map(r=>(0,n.jsxs)("fieldset",{"data-testid":`setting-${r.name}`,style:{border:0,margin:0,padding:0,display:"grid",gap:5},children:[(0,n.jsx)("legend",{style:{...$,padding:0},children:r.title}),r.description?(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:r.description}):null,(0,n.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:r.options.map(v=>{let A=(S[r.name]??r.initial)===v.value;return(0,n.jsx)("button",{type:"button","aria-pressed":A,"data-testid":`setting-${r.name}-${v.value}`,onClick:()=>f(r.name,v.value),style:P(A),children:v.label},v.value)})})]},r.name))}):null,K(m)?(0,n.jsx)(ae.Suspense,{fallback:null,children:(0,n.jsx)(ve,{legend:$,style:C,choice:P})}):null,i!==void 0&&a!==void 0?(0,n.jsxs)("div",{style:{display:"grid",gap:5,...C},children:[(0,n.jsx)("span",{style:$,children:"Scheme"}),(0,n.jsx)("div",{style:{display:"flex",gap:4},children:["light","dark"].map(r=>(0,n.jsx)("button",{type:"button","aria-pressed":i===r,"data-testid":`profile-scheme-${r}`,onClick:()=>a(r),style:P(i===r),children:r==="light"?"\u2600 Light":"\u263E Dark"},r))})]}):null,g?(0,n.jsxs)("p",{"data-testid":"graview-signature",style:{...C,margin:0,display:"flex",alignItems:"center",gap:6,fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["Built with",(0,n.jsxs)("a",{href:"https://graview.dev",target:"_blank",rel:"noopener",style:{display:"inline-flex",alignItems:"center",gap:4,minHeight:24,color:"var(--graview-ink-muted)",fontWeight:600,textDecoration:"none"},children:[(0,n.jsx)("span",{"data-testid":"graview-mark",style:{display:"inline-flex",lineHeight:0},dangerouslySetInnerHTML:{__html:we}}),"Graview"]})]}):null]})})}var we='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="14" height="14" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="2.4" stroke-linejoin="round"><path d="M13 11 L3 8 L14 3 H29 L21 9"/><path d="M10 18 L3 23 L16.5 28 L29 21 L22 19"/><path d="M16.5 18.5 V23.5" stroke-linecap="round"/></g><circle cx="16.5" cy="13.5" r="2" fill="var(--graview-mark-point, currentColor)"/></svg>',re={display:"flex",alignItems:"center",minHeight:28,padding:"2px 8px",borderRadius:7,fontSize:"0.875rem",color:"var(--graview-ink)",textDecoration:"none"},$={fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},C={paddingTop:10,borderTop:"1px solid var(--graview-edge)"};export{ie as ActivityRail,he as Here,Be as ProblemRows,_e as ProfilePane,Ge as TidyFoot,fe as placeGesture,ge as sayTheirChange};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{G as P}from"./chunk.
|
|
1
|
+
import{G as P}from"./chunk.HT2BEOEV.js";import{Ac as _,Qc as O,Sc as S,Vc as T,Wc as E,wc as b,xc as $,yc as y,zc as k}from"./chunk.7BBGRTXM.js";import{a as x}from"./chunk.AJZBJBMO.js";var D=x(l=>{"use strict";var U=P();function C(r){var e="https://react.dev/errors/"+r;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)e+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function d(){}var s={d:{f:d,r:function(){throw Error(C(522))},D:d,C:d,L:d,m:d,X:d,S:d,M:d},p:0,findDOMNode:null},V=Symbol.for("react.portal");function j(r,e,a){var t=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:V,key:t==null?null:""+t,children:r,containerInfo:e,implementation:a}}var u=U.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(r,e){if(r==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s;l.createPortal=function(r,e){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(C(299));return j(r,e,null,a)};l.flushSync=function(r){var e=u.T,a=s.p;try{if(u.T=null,s.p=2,r)return r()}finally{u.T=e,s.p=a,s.d.f()}};l.preconnect=function(r,e){typeof r=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,s.d.C(r,e))};l.prefetchDNS=function(r){typeof r=="string"&&s.d.D(r)};l.preinit=function(r,e){if(typeof r=="string"&&e&&typeof e.as=="string"){var a=e.as,t=h(a,e.crossOrigin),n=typeof e.integrity=="string"?e.integrity:void 0,i=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;a==="style"?s.d.S(r,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:t,integrity:n,fetchPriority:i}):a==="script"&&s.d.X(r,{crossOrigin:t,integrity:n,fetchPriority:i,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};l.preinitModule=function(r,e){if(typeof r=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var a=h(e.as,e.crossOrigin);s.d.M(r,{crossOrigin:a,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&s.d.M(r)};l.preload=function(r,e){if(typeof r=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var a=e.as,t=h(a,e.crossOrigin);s.d.L(r,a,{crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};l.preloadModule=function(r,e){if(typeof r=="string")if(e){var a=h(e.as,e.crossOrigin);s.d.m(r,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:a,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else s.d.m(r)};l.requestFormReset=function(r){s.d.r(r)};l.unstable_batchedUpdates=function(r,e){return r(e)};l.useFormState=function(r,e,a){return u.H.useFormState(r,e,a)};l.useFormStatus=function(){return u.H.useHostTransitionStatus()};l.version="19.2.8"});var W=x((X,L)=>{"use strict";function N(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(N)}catch(r){console.error(r)}}N(),L.exports=D()});var I={name:"Graview",typography:{body:y.body,mono:y.mono},schemes:$},R={ground:"--graview-ground",groundDeep:"--graview-ground-deep",wash:"--graview-wash",panel:"--graview-panel",panelMuted:"--graview-panel-muted",panelWarning:"--graview-panel-warning",edge:"--graview-edge",edgeBright:"--graview-edge-bright",ink:"--graview-ink",inkMuted:"--graview-ink-muted",inkFaint:"--graview-ink-faint",accent:"--graview-accent",accentDim:"--graview-accent-dim",accentInk:"--graview-accent-ink",warn:"--graview-warn",good:"--graview-good",bad:"--graview-bad",glow:"--graview-glow",bar:"--graview-bar",float:"--graview-float",liftLow:"--graview-lift-low",liftHigh:"--graview-lift-high",tintAlpha:"--graview-tint-alpha",tintLightness:"--graview-tint-lightness",gridAlpha:"--graview-grid-alpha"};function B(r){return Object.keys(R).map(e=>` ${R[e]}: ${r[e]};`).join(`
|
|
2
2
|
`)}function A(r,e){let a=r===e?r:`${r} ${e}`;return` ${a} [data-graview-view] { transition: none; }
|
|
3
3
|
${a} [data-graview-touched] > * { animation: none; }
|
|
4
4
|
${a} [data-graview-view][data-graview-wrote] > *,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as _}from"./chunk.
|
|
1
|
+
import{b as _}from"./chunk.34TW32TB.js";import"./chunk.YD3TKV6P.js";import"./chunk.4KC35UNR.js";import{G as se,T as U,ba as H,ea as Y}from"./chunk.HT2BEOEV.js";import"./chunk.SDO3U72B.js";import{Zd as $,rb as z}from"./chunk.7BBGRTXM.js";import"./chunk.FQLNBIQ5.js";import{b as D}from"./chunk.AJZBJBMO.js";var u=D(se(),1);function L(e,t,s=!1){if(e<t.at||e===t.at&&s)return e;let i=t.at+t.removed.length;return e>=i?e+t.inserted.length-t.removed.length:s?t.at:t.at+t.inserted.length}var X=e=>e>=55296&&e<=56319,G=e=>e>=56320&&e<=57343;function V(e,t,s){let i=Math.min(e.length,t.length),n=0,l=Math.max(0,Math.min(i,t.length-s));for(;n<l&&e.charCodeAt(e.length-1-n)===t.charCodeAt(t.length-1-n);)n++;let r=0;for(;r<i-n&&e.charCodeAt(r)===t.charCodeAt(r);)r++;return r>0&&X(e.charCodeAt(r-1))&&r--,n>0&&G(e.charCodeAt(e.length-n))&&n--,{at:r,removed:e.slice(r,e.length-n),inserted:t.slice(r,t.length-n)}}function M(e,t){let s=Math.min(e.length,t.length),i=0;for(;i<s&&e.charCodeAt(i)===t.charCodeAt(i);)i++;i>0&&X(e.charCodeAt(i-1))&&i--;let n=0;for(;n<s-i&&e.charCodeAt(e.length-1-n)===t.charCodeAt(t.length-1-n);)n++;return n>0&&G(e.charCodeAt(e.length-n))&&n--,{at:i,removed:e.slice(i,e.length-n),inserted:t.slice(i,t.length-n)}}function q(e,t){let s=c=>c.at+c.removed.length;if(s(e)<t.at)return e;if(e.at>s(t))return{...e,at:e.at+t.inserted.length-t.removed.length};let i=Math.min(e.at,t.at),n=s(e)-s(t),l=e.removed.slice(0,t.at-i)+t.inserted+(n>0?e.removed.slice(e.removed.length-n):""),r=t.at<=e.at?t.inserted+e.inserted:e.inserted+t.inserted,d=M(l,r);return{...d,at:i+d.at}}function I(e,t){let s=L(e.start,t,!0),i=e.end===e.start?s:L(e.end,t);return{start:s,end:Math.max(s,i)}}function ce(e,t){let{kind:s,id:i,session:n}=e.author,l=`${s}:${i??""}:`;return t.startsWith(l)&&(!n||t.slice(l.length)===n)}function Z(e,t,s,i){let n=e.anchor,l=e.head;for(let d of s)if(!(d.seq<e.rev||ce(d,t)))for(let c of d.primitives)c.op!=="splice-text"||c.id!==e.node||c.field!==e.field||(n=L(n,c),l=L(l,c));let r=d=>Math.max(0,Math.min(i,d));return{start:r(n),end:r(l)}}var O=(e,t,s)=>e.ops.length>0&&e.ops.every(i=>{let n=i.mutation?.args;return i.mutation?.name===z&&n?.node===t&&n.field===s}),le=(e,t,s,i)=>t.ops.length>0&&t.ops.every(n=>n.undoes!==void 0)&&e.batches().some(n=>t.ops.some(l=>l.undoes===n.id||l.undoes===n.ops[0]?.id)&&O(n,s,i)),J=(e,t)=>e.author.kind==="human"&&(t?.id===void 0||e.author.id===void 0||e.author.id===t.id);function Q(e,t,s,i){let n=e.batches();for(let l=n.length-1;l>=0;l--){let r=n[l];if(!(!J(r,t)||r.undone||!O(r,s,i))&&e.canUndo(r.id).ok)return r.id}}function j(e,t,s,i){let n=e.batches();for(let l=n.length-1;l>=0;l--){let r=n[l];if(J(r,t)){if(O(r,s,i))return;if(le(e,r,s,i))return r.undone?void 0:r.id}}}var p=D(U(),1);function de(e){let{store:t}=H(),{live:s,nodeId:i,field:n}=e,[l,r]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let d=!0;return s.typing(i,n).then(c=>d&&r(c)),()=>{d=!1}},[i,n]),l&&!t.collaborative(i,n)?(0,p.jsx)(p.Fragment,{children:e.writtenWhole}):(0,p.jsx)(ue,{...e,typing:l})}function ue({nodeId:e,field:t,label:s,markdown:i,live:n,onDone:l,typing:r}){let{store:d,principal:c}=H(),m=Y(e),f=te(m?.[t]),[x,oe]=(0,u.useState)(!1),y=(0,u.useRef)(null),R=(0,u.useRef)(f),E=(0,u.useRef)(!1),B=(0,u.useRef)(n);B.current=n;let N=()=>te(d.graph.getNode(e)?.[t]);(0,u.useEffect)(()=>y.current?.focus(),[x,r]);let b=(0,u.useRef)(void 0),C=()=>{b.current===void 0&&(b.current=setTimeout(()=>{b.current=void 0;let o=y.current;if(!o||o.ownerDocument.activeElement!==o)return;let a=o.selectionDirection==="backward";B.current.sayCaret({node:e,field:t,anchor:a?o.selectionEnd:o.selectionStart,head:a?o.selectionStart:o.selectionEnd,rev:d.log.length})},fe))};(0,u.useEffect)(()=>()=>{clearTimeout(b.current),B.current.sayCaret(null)},[]);let W=o=>{let a=y.current;if(a){if(a.value!==o){let h=I({start:a.selectionStart,end:a.selectionEnd},M(a.value,o)),g=a.selectionDirection??"none";a.value=o,a.setSelectionRange(h.start,h.end,g)}R.current=o}},K=()=>{let o=y.current;if(!o||!r||E.current)return;let a=R.current,h=N(),g=V(a,o.value,o.selectionEnd);if(g.removed===""&&g.inserted==="")return W(h);let v=a===h?g:q(g,M(a,h));try{r.splice(v.at,v.removed.length,v.inserted)}catch{}let w=N();if(o.value!==w){o.value=w;let S=Math.min(w.length,v.at+v.inserted.length);o.setSelectionRange(S,S)}R.current=w,C()};(0,u.useLayoutEffect)(()=>{E.current||W(f)},[f]);let ie=async o=>{if(!r)return;r.flush();for(let h=0;r.waiting()>0&&h<100;h++)await new Promise(g=>setTimeout(g,30));let a=o?j(d,c,e,t):Q(d,c,e,t);if(a)try{o?d.redo(a,{author:c}):d.undo(a,{author:c})}catch{}},T=o=>{r?.flush(),n.sayCaret(null),l(o)},k=(0,u.useRef)(void 0);(0,u.useEffect)(()=>()=>k.current?.(),[]);let ae=o=>{k.current?.();let a=o.ownerDocument,h=y.current?.closest("[data-graview-live]"),g=A=>{let P=A.target;if(P instanceof Node&&h?.contains(P))return S();P instanceof Element&&P.closest(ee)||(S(),T(!0))},v=()=>{let A=a.activeElement;A!==null&&A!==a.body||o.isConnected&&he(o)||(S(),y.current?.focus({preventScroll:!0}))},w=new MutationObserver(v);w.observe(a.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["open","hidden"]}),a.addEventListener("focusin",g),a.addEventListener("toggle",v,!0);let S=()=>{k.current=void 0,w.disconnect(),a.removeEventListener("focusin",g),a.removeEventListener("toggle",v,!0)};k.current=S},F=[...n.who.values()].filter(o=>o.caret?.node===e&&o.caret.field===t);return(0,p.jsxs)("div",{style:{display:"grid",gap:8,minWidth:0},"data-graview-live":t,children:[x?(0,p.jsx)("div",{"data-graview-preview":t,"aria-label":`${s}, as it will read`,role:"region",style:me,children:(0,p.jsx)(_,{text:f,markdown:!0})}):(0,p.jsxs)("div",{style:{position:"relative",minWidth:0},children:[(0,p.jsx)("textarea",{ref:y,"aria-label":s,"data-graview-field":t,defaultValue:f,readOnly:!r,rows:3,onInput:K,onCompositionStart:()=>{E.current=!0},onCompositionEnd:()=>{E.current=!1,K()},onSelect:C,onFocus:C,onPointerDown:()=>r?.flush(),onKeyDown:o=>{let a=o.key;a==="Escape"?(o.preventDefault(),T(!1)):(o.metaKey||o.ctrlKey)&&!o.altKey&&a.toLowerCase()==="z"?(o.preventDefault(),ie(o.shiftKey)):(o.metaKey||o.ctrlKey)&&a==="Enter"?(o.preventDefault(),T(!1)):(a==="Enter"||ge.has(a))&&r?.flush()},onKeyUp:C,onBlur:o=>{r?.flush(),n.sayCaret(null);let a=o.relatedTarget;if(a instanceof Node&&o.currentTarget.closest("[data-graview-live]")?.contains(a))return;let h=a instanceof Element?a.closest(ee):null;if(h)return ae(h);T(!0)},style:ve}),F.length>0?(0,p.jsx)(pe,{text:f,others:F,area:y,log:d.log.all()}):null]}),(0,p.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,p.jsx)("button",{type:"button",onClick:()=>T(!1),style:ne,children:"Done"}),i?(0,p.jsx)("button",{type:"button","aria-pressed":x,onClick:()=>oe(!x),style:ne,children:x?"Write":"Preview"}):null,(0,p.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"Saved as you type \xB7 Ctrl or \u2318 Z takes back your typing"})]})]})}function pe({text:e,others:t,area:s,log:i}){let n=(0,u.useRef)(null);(0,u.useLayoutEffect)(()=>{let c=s.current,m=n.current;if(!c||!m)return;let f=()=>{m.scrollTop=c.scrollTop};return f(),c.addEventListener("scroll",f),()=>c.removeEventListener("scroll",f)});let l=t.map(c=>({one:c,at:Z(c.caret,c.participant,i,e.length).end})).sort((c,m)=>c.at-m.at),r=[],d=0;for(let{one:c,at:m}of l){r.push(e.slice(d,m)),d=m;let f=$(c)||"Somebody";r.push((0,p.jsx)("span",{"data-graview-caret":c.participant,title:`${f} is typing here`,style:{borderLeft:`2px solid hsl(${Math.round(c.hue)} 55% 52%)`,marginLeft:-1,marginRight:-1,pointerEvents:"auto"}},c.participant))}return r.push(`${e.slice(d)}\u200B`),(0,p.jsx)("div",{ref:n,"aria-hidden":"true",style:ye,children:r})}var ee='[data-graview-overlay], dialog, [role="dialog"], [role="alertdialog"], [popover]',he=e=>{if(e.hasAttribute("hidden")||e instanceof HTMLDialogElement&&!e.open)return!1;if(e.hasAttribute("popover"))try{return e.matches(":popover-open")}catch{}return!0},fe=120,te=e=>typeof e=="string"?e:"",ge=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"]),me={minHeight:"7.5em",padding:"8px 10px",border:"1px dashed var(--graview-edge-bright)",borderRadius:6,lineHeight:1.6,minWidth:0},ne={font:"inherit",fontSize:"0.8125rem",minHeight:28,padding:"2px 12px"},re={font:"inherit",lineHeight:1.5,width:"100%",boxSizing:"border-box",minHeight:"7.5em",padding:"8px 10px",borderRadius:6},ve={...re,resize:"vertical",fieldSizing:"content",color:"var(--graview-ink)",background:"var(--graview-panel, transparent)",border:"1px solid var(--graview-edge-bright)"},ye={...re,position:"absolute",inset:0,height:"100%",border:"1px solid transparent",color:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word",overflow:"hidden",pointerEvents:"none"};export{de as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as a}from"./chunk.
|
|
1
|
+
import{g as a}from"./chunk.QGV7H7RQ.js";import{c as p}from"./chunk.YIA2EDVF.js";import{Ia as d}from"./chunk.7BBGRTXM.js";function k(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{k as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};function s(e){let t=[];return typeof e!="string"?["A view's source is text."]:(/\bimport\b/.test(e)&&t.push("It says import: a view loads nothing, so the word may not appear in it at all, even in a string or a comment."),/\bimportScripts\b/.test(e)&&t.push("It names importScripts: a view loads nothing."),/^\s*export\b/m.test(e)&&t.push("It exports something: a view is a plain script that draws through the graview global, not a module."),/\brequire\s*\(/.test(e)&&t.push("It calls require(): a view has no modules to require."),t)}var i,n=()=>i??=(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};function s(e){let t=[];return typeof e!="string"?["A view's source is text."]:(/\bimport\b/.test(e)&&t.push("It says import: a view loads nothing, so the word may not appear in it at all, even in a string or a comment."),/\bimportScripts\b/.test(e)&&t.push("It names importScripts: a view loads nothing."),/^\s*export\b/m.test(e)&&t.push("It exports something: a view is a plain script that draws through the graview global, not a module."),/\brequire\s*\(/.test(e)&&t.push("It calls require(): a view has no modules to require."),t)}var i,n=()=>i??=(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.PHC2MI4C.js")).catch(e=>{throw i=void 0,e});async function p(e){let{VIEW_RUNTIME:t}=await n();return`${t}
|
|
2
2
|
;(function () {
|
|
3
3
|
"use strict";
|
|
4
4
|
${e}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ot}from"./chunk.644FUGSX.js";import"./chunk.PJCVFYFU.js";import{e as V,l as ue,m as G,q as st}from"./chunk.7RJGEU3Y.js";import{a as ee}from"./chunk.G4JJXA63.js";import"./chunk.64IKLRUS.js";import{b as nt}from"./chunk.DTSTUC2W.js";import{d as tt}from"./chunk.USQNSNIA.js";import"./chunk.XOZU4OFA.js";import"./chunk.IT763BYH.js";import"./chunk.UQQAGT3R.js";import"./chunk.XJFAUOJS.js";import{d as et}from"./chunk.DPPT6WAJ.js";import{c as Ze}from"./chunk.7U2JO7ET.js";import{Ad as Xe,K as ze,X as Je,ga as Ye,ja as qe,na as Ae,oa as F,ob as Ve,pb as Qe,zd as Ne}from"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var At="Nothing by that name here.",$=o=>o.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[’']/g,"'").replace(/[^\p{L}\p{N}' ]+/gu," ").replace(/\s+/g," ").trim(),Nt=/^(?:(?:can you |could you |please )?(?:go|take me|bring me|head|jump|navigate|switch|get me)(?: back)? to|(?:please )?(?:open|show(?: me)?|bring up|let me see|view)) (.+)$/,St=/^(?:(?:can you |could you |please )?tell me (?:about|of)|what(?: is|'s| are) (?:in |on )?|describe|explain|who(?: is|'s)) (.+)$/,Ot=/^(?:what(?: is|'s| am i looking at| do i see)(?: (?:here|this|on (?:this|the) (?:page|screen)|in view|this place|this page))?|where am i|describe (?:this|here|this place|this page)|tell me about (?:this|here|this place|this page))$/,rt=new Set(["here","this","this place","this page","on this page","on the page","on this screen","in view"]),Ct=/^(?:date|day|when|on|at|the date|the day)$/,jt=/^(?:what(?: is|'s) (?:wrong|broken|the (?:problem|matter|trouble))|what needs (?:fixing|attention|doing)|any (?:problems|issues|trouble)|(?:show(?: me)? |go to |open )?(?:the )?(?:problems|issues|trouble|standing|what's wrong)|is (?:anything|something) (?:wrong|broken)|are there (?:any )?(?:problems|issues))(?: (?:with|about|on|in) (.+))?$/,z=o=>o.replace(/^(?:the|a|an|my|our) /,""),te=new Set(["the","a","an","my","our","all","any","of","that","which","who","are","is","be","what","whats","what's","with","me","show","list","every","there","do","i","have","we","due","for","please","were","was","by","from","in","on"]),ft=864e5,he=o=>Date.UTC(Number(o.slice(0,4)),Number(o.slice(5,7))-1,Number(o.slice(8,10))),xe=o=>new Date(o).toISOString().slice(0,10),C=(o,i)=>xe(he(o)+i*ft),xt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Mt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Wt="(monday|tuesday|tues|wednesday|thursday|thurs|friday|saturday|sunday)",it="(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sept|sep|oct|nov|dec)",at="(\\d{1,2})(?:st|nd|rd|th)?",Dt=o=>xt.findIndex(i=>i.startsWith(o.slice(0,3))),dt=o=>Mt.findIndex(i=>o.startsWith(i.toLowerCase()));function Rt(o,i){return Je(o,{year:o.slice(0,4)!==i.slice(0,4)})}function Se(o,i,y){if(o<0||i<1||i>31)return;let f=Number(y.slice(0,4)),c=k=>{let j=Date.UTC(k,o,i);return new Date(j).getUTCMonth()===o?xe(j):void 0},p=c(f);if(p)return he(p)<he(y)-183*ft?c(f+1):p}function Oe(o,i,y){let f=new Date(he(i)).getUTCDay(),c=u=>{let S=(f-y+7)%7,w=C(i,-S+u*7);return{from:w,to:C(w,6)}},p=()=>{let u=`${i.slice(0,8)}01`,S=new Date(Date.UTC(Number(i.slice(0,4)),Number(i.slice(5,7)),1));return{from:u,to:C(xe(S.getTime()),-1)}},k=u=>u?{from:u,to:u,day:Rt(u,i)}:void 0,j=(u,S)=>{let w=Dt(S);return k(u==="this"||u==="next"?C(c(u==="next"?1:0).from,(w-y+7)%7):u==="last"?C(i,-((f-w+6)%7+1)):C(i,(w-f+7)%7))},J=u=>{let S=C(i,f===0?-1:6-f);return{from:C(S,u*7),to:C(S,u*7+1)}},B="\\b(?:(?:due |for |on |by )(?:the )?)?",P=[[/\b(?:overdue|past due|late)\b/,()=>({overdue:!0,to:C(i,-1)})],[/\b(?:due |for |on )?today\b/,()=>({from:i,to:i})],[/\b(?:due |for |on )?tomorrow\b/,()=>k(C(i,1))],[/\b(?:due |for |on )?yesterday\b/,()=>k(C(i,-1))],[/\b(?:due |for |on )?this week\b/,()=>c(0)],[/\b(?:due |for |on )?next week\b/,()=>c(1)],[/\b(?:due |for |on )?(?:last|previous) week\b/,()=>c(-1)],[/\b(?:due |for |on )?next weekend\b/,()=>J(1)],[/\b(?:due |for |on )?(?:this |the )?weekend\b/,()=>J(0)],[/\b(?:due |for |on )?this month\b/,()=>p()],[new RegExp(`${B}(\\d{4}) (\\d{2}) (\\d{2})\\b`),u=>k(Se(Number(u[2])-1,Number(u[3]),`${u[1]}-01-01`))],[new RegExp(`${B}${at} (?:of )?${it}\\b`),u=>k(Se(dt(u[2]),Number(u[1]),i))],[new RegExp(`${B}${it} (?:the )?${at}\\b`),u=>k(Se(dt(u[1]),Number(u[2]),i))],[new RegExp(`${B}(?:(this|next|last|coming) )?${Wt}\\b`),u=>j(u[1],u[2])]];for(let[u,S]of P){let w=o.match(u);if(!w)continue;let N=S(w);if(N)return{ask:{words:w[0],...N},rest:o.replace(w[0]," ").replace(/\s+/g," ").trim()}}}function ht(o,i,y={}){let f=y.principal??{kind:"human"},c=o.seenBy(f),p=c.schema,k=y.today??o.today?.()??ze(),j=y.weekStartsOn??1,J=o.kindsKeptFrom(f),B=o.modules.disabledKinds,P=p.kinds.filter(e=>!J.has(e)&&!B.has(e)),u=new Set(P),S=(y.places??[]).filter(e=>e.kind===null||u.has(e.kind)),w=c.graph,N=$(i).replace(/[?.!]+$/,"").trim();if(N.length===0)return{unresolved:!0};let M=e=>p.tryDefinition(e),H=e=>Ye(M(e.kind),e),I=e=>qe(p,e),se=e=>S.find(t=>t.kind===e&&t.address===Ne(p,e))?.address??Ne(p,e),ge=e=>Xe(p,e.kind,e.id),Me=e=>({to:"record",id:e.id,kind:e.kind,label:H(e),address:ge(e),said:`Went to ${H(e)}.`}),We=e=>{let t=`Went to ${e.title}.`;return e.kind===null?{to:"place",slug:e.slug,title:e.title,address:e.address,...e.slug==="overview"?{face:"scene"}:{},said:t}:e.lens||e.address.startsWith("/places/")?{to:"picture",kind:e.kind,as:e.slug,title:e.title,address:e.address,said:t}:{to:"kind",kind:e.kind,title:e.title,address:e.address,said:t}},De=()=>({unresolved:!0,say:At}),oe=e=>{let t=M(e.kind),s=et(e,t,{limit:3,excerpt:!0}).map(r=>r.alone.startsWith(r.label)?r.alone:`${r.label.toLowerCase()} ${r.alone}`).join(", "),n=c.violations().filter(r=>r.nodeIds.includes(e.id));return[`${H(e)} \u2014 ${Ae(F(t,e.kind))}${s?` (${s})`:""}.`,n.length>0?`Trouble: ${n.map(r=>r.message).join("; ")}.`:""].filter(Boolean).join(" ")},re=e=>{let t=new Set([G(e),G(z(e))]);for(let n of[" page"," view"," lens"," place"," picture"," list"])e.endsWith(n)&&(t.add(G(e.slice(0,-n.length))),t.add(G(z(e.slice(0,-n.length)))));t.delete("");let s=n=>t.has(G(n.title))||t.has(G(z($(n.title))))||t.has(G(n.slug));return S.find(n=>n.kind!==null&&n.address.startsWith("/places/")&&s(n))??S.find(s)},pe=e=>{let t=st(o,e,{principal:f,today:k,limit:6,near:!1,...y.selection?{from:y.selection}:{}}),s=t.hits.filter(r=>r.about==="node"&&u.has(r.kind)&&w.getNode(r.id)!==void 0),n=s.filter(r=>r.why.field==="label"&&r.why.strength==="exact");return n.length===1?{one:w.getNode(n[0].id),picks:s}:n.length>1?{picks:n}:s.length===1&&t.total===1?{one:w.getNode(s[0].id),picks:s}:{picks:s}},Re=e=>{let t=e.map(s=>`${s.label} (${F(M(s.kind),s.kind)})`);return`${e.length===1?"One thing matches":`${e.length} things match`}: ${t.join("; ")}.`},Ee=(e,t)=>{if(rt.has(e))return Le();let s=t?pe(z(e)||e):void 0,n=s?.one&&$(H(s.one))===$(z(e)||e)?void 0:re(e);if(n){let l=We(n);return{about:"place",say:t?`${l.said} ${me(n)}`:l.said,moves:[l],subject:n.slug}}let r=pe(z(e)||e);if(r.one){let l=Me(r.one);return{about:t?"describe":"record",say:t?`${l.said} ${oe(r.one)}`:l.said,moves:[l],subject:r.one.id}}if(r.picks.length>0)return{about:"picks",say:Re(r.picks),moves:[],picks:r.picks};let h=ae(e);if(h)return h;let d=Pe(e);if(d){if(d.rest.split(" ").every(l=>l===""||te.has(l))){let l=I(d.kind),v={to:"kind",kind:d.kind,title:l,address:se(d.kind),said:`Went to the ${l.toLowerCase()}.`};return{about:"kind",say:v.said,moves:[v]}}return{unresolved:!0}}return De()},me=e=>{if(e.kind===null){let h=P.map(l=>({kind:l,count:w.nodesOfKind(l).length})).filter(l=>l.count>0).map(l=>`${l.count} ${(l.count===1?F(M(l.kind),l.kind):I(l.kind)).toLowerCase()}`),d=c.violations().length;return[h.length>0?`It holds ${fe(h)}.`:"It holds nothing yet.",d>0?`${d===1?"One problem":`${d} problems`} to see to.`:""].filter(Boolean).join(" ")}let t=w.nodesOfKind(e.kind).length,s=I(e.kind).toLowerCase(),n=new Set(c.violations().flatMap(h=>h.nodeIds)),r=w.nodesOfKind(e.kind).filter(h=>n.has(h.id)).length;return[e.lens?`It draws the ${s} as ${Ae(e.lens)}${t>0?` \u2014 ${t} of them`:""}.`:`${t===0?"No":t} ${t===1?F(M(e.kind),e.kind):s} ${t===1?"is":"are"} here.`,r>0?`${r} ${r===1?"has":"have"} a problem.`:""].filter(Boolean).join(" ")},Le=()=>{let e=(y.selection??[]).map(s=>w.getNode(s)).find(s=>s!==void 0);if(e)return{about:"here",say:oe(e),moves:[],subject:e.id};let t=S.find(s=>s.slug===y.place)??S.find(s=>s.slug==="home");return t?{about:"here",say:`${t.title}. ${me(t)}`,moves:[],subject:t.slug}:{about:"here",say:me({slug:"home",title:"Home",kind:null,cardinality:"many",address:"/",stop:"#"}),moves:[]}},Pe=e=>{let t=P.flatMap(s=>[I(s),F(M(s),s),s].map(n=>({kind:s,name:$(n)}))).filter(s=>s.name.length>0).sort((s,n)=>n.name.length-s.name.length);for(let{kind:s,name:n}of t)if(!(` ${e} `.indexOf(` ${n} `)<0))return{kind:s,rest:` ${e} `.replace(` ${n} `," ").replace(/\s+/g," ").trim()}},ie=(e,t)=>{let s=V(p,e).filters.filter(d=>d.about==="field"&&d.type==="date");if(s.length===0)return;let n=s.find(d=>t.some(l=>$(d.key)===l||$(d.label)===l));if(n)return n;let r=M(e)?.fieldRoles??{};for(let d of["due","deadline","date","when","start","end"]){let l=r[d],v=l?s.find(x=>x.key===l):void 0;if(v)return v}return s.find(d=>["due","deadline","date","when","on","at"].includes(d.key.toLowerCase()))??(s.length===1?s[0]:void 0)},He=e=>{let t=M(e),s=V(p,e).filters;if(t?.lifecycle)return{conditions:[{key:"is",value:"current"}],holds:d=>ue(be,d,{key:"is",value:"current"})};let r=s.find(d=>d.about==="field"&&d.type==="boolean"&&ne.has($(d.key)));if(r)return{conditions:[{key:r.key,value:"false"}],holds:d=>d[r.key]!==!0};let h=s.find(d=>d.about==="field"&&d.type==="choice"&&(d.options??[]).some(l=>ne.has($(l))));if(h){let d=new Set((h.options??[]).filter(v=>ne.has($(v)))),l=(h.options??[]).filter(v=>!d.has(v));return l.length===1?{conditions:[{key:h.key,value:l[0]}],holds:v=>v[h.key]===l[0]}:"unsayable"}return{conditions:[],holds:()=>!0}},Ie=(e,t)=>{let s=e.words.startsWith("due")||$(t.key)==="due",n=Ct.test($(t.label));if(e.day)return s?`due ${e.day}`:n?`on ${e.day}`:`${t.label.toLowerCase()} on ${e.day}`;let r=e.words.replace(/^(?:due|for|on|by) (?:the )?/,"");return s?`due ${r}`:n?r:`${t.label.toLowerCase()} ${r}`},ye=new Set(c.violations().flatMap(e=>e.nodeIds)),be={schema:p,graph:c.graph,flagged:ye,today:k},ae=e=>{let t=Oe(e,k,j),s=Pe(t?.rest??e),n=s?.kind,r=(s?.rest??t?.rest??e).split(" ").filter(Boolean);if(!n&&t){let g=e.split(" "),m=P.filter(L=>ie(L,g)!==void 0),E=m.filter(L=>{let b=ie(L,g);return g.some(O=>$(b.key)===O||$(b.label)===O)}),U=m.length===1?m:E;if(U.length!==1)return;n=U[0]}if(!n)return;let h=V(p,n).filters,d=[],l=[],v=[],x=[],q=!1,de=[];for(let g=0;g<r.length;g++){let m=r[g],E=g>0&&(r[g-1]==="not"||r[g-1]==="un"),U=h.find(b=>b.about==="field"&&b.type==="choice"&&(b.options??[]).some(O=>$(O)===m));if(U&&!E){let b=(U.options??[]).find(O=>$(O)===m);d.push({key:U.key,value:b}),l.push(b);continue}let L=h.find(b=>b.about==="field"&&b.type==="boolean"&&[$(b.key),$(b.label)].some(O=>O===m||O===m.replace(/^un/,"")));if(L){let b=!E&&!(m.startsWith("un")&&!$(L.key).startsWith("un"));d.push({key:L.key,value:String(b)}),l.push(b?m:`not ${m.replace(/^un/,"")}`);continue}if(Pt.has(m)&&!E){let b=He(n);b==="unsayable"?(q=!0,x.push(O=>!ut(p,O))):(d.push(...b.conditions),x.push(b.holds)),l.push(m);continue}m==="not"||m==="un"||t&&h.some(b=>b.type==="date"&&($(b.key)===m||$(b.label)===m))||de.push(m)}if(r=de,r.some(g=>!te.has(g))||!t&&d.length===0&&x.length===0)return;let T=I(n).toLowerCase(),Q=I(n);if(t){let g=ie(n,e.split(" "));if(!g){let m={to:"kind",kind:n,title:Q,address:se(n),said:`Went to the ${T}.`};return{about:"kind",say:`${ee(Q)} carry no date, so I can't tell which are ${/^(?:due|for|on|overdue|past due|late)\b/.test(t.ask.words)?t.ask.words:`due ${t.ask.words}`}. ${m.said}`,moves:[m]}}if(t.ask.from&&d.push({key:g.key,value:`after:${C(t.ask.from,-1)}`}),t.ask.to&&d.push({key:g.key,value:`before:${C(t.ask.to,1)}`}),t.ask.overdue){let m=He(n);m==="unsayable"?(q=!0,x.push(E=>!ut(p,E))):(d.push(...m.conditions),x.push(m.holds))}t.ask.overdue?l.push("overdue"):v.push(Ie(t.ask,g))}let R=w.nodesOfKind(n).filter(g=>d.every(m=>ue(be,g,m))&&x.every(m=>m(g))),K=[...l,...v].join(" and "),Y=[...l,T,...v].join(" "),W=R.slice(0,6).map(g=>({about:"node",id:g.id,kind:n,label:H(g),why:{field:d[0]?.key??"label",reading:d[0]?.key??"Name",fragment:K,strength:"field"},current:!0,flagged:ye.has(g.id),address:ge(g)})),X=R.length===0?`No ${T} are ${K}.`:`${R.length===1?`One ${F(M(n),n)} is`:`${R.length} ${T} are`} ${K}: ${fe(R.slice(0,6).map(H))}${R.length>6?`, and ${R.length-6} more`:""}.`;if(q)return{about:"kind",say:X,moves:[],picks:W,offer:{draft:Y,label:"Show as a view"}};let Z=d.map(g=>`${g.key}:${g.value}`).join(","),we=`${se(n)}?${new URLSearchParams({filter:Z}).toString()}`,_={to:"kind",kind:n,title:ee(Y),filter:Z,address:we,said:`Went to the ${Y}.`};return{about:"kind",say:`${_.said} ${X}`,moves:[_],picks:W}},Te=e=>M(e)?.figure==="person"?!0:[e,F(M(e),e),I(e)].some(s=>$(s).split(" ").some(n=>Et.has(n))),pt=e=>{let t=[],s=n=>M(n)?.edges??{};for(let[n,r]of Object.entries(s(e)))for(let h of r.to??[])u.has(h)&&t.push({key:n,direction:"out",far:h,words:ct(`${r.description??""} ${n}`)});for(let n of P)for(let[r,h]of Object.entries(s(n)))(h.to??[]).includes(e)&&t.push({key:r,direction:"in",far:n,words:ct(`${h.inverse??""} ${r}`)});return t},mt=e=>{let t=e.match(/^(who|which|what)\b/)?.[1];if(!t)return;let s=Oe(e,k,j);if(!s||s.ask.overdue)return;let n=s.rest.split(" ").filter(Boolean),r=P.flatMap(a=>[I(a),F(M(a),a),a].map(A=>({kind:a,name:$(A)}))).filter(a=>a.name.length>0).sort((a,A)=>A.name.length-a.name.length),h=` ${n.join(" ")} `,d=[];for(let{kind:a,name:A}of r)h.includes(` ${A} `)&&(h=h.replace(` ${A} `," "),d.includes(a)||d.push(a));let l=h.match(/\b(?:is|are|was|were)\b|'s\b/)?.[0],v=h.replace(/'s\b/g," ").split(" ").filter(a=>a.length>0&&!te.has(a)&&!Ce.has(a)),x=t==="who"?d.find(Te):d[0];if(!x&&t!=="who")return;let q=d.find(a=>a!==x),de=v.flatMap(a=>[je(a),...lt.has(je(a))?[...lt]:[]]),T=P.filter(a=>q?a===q:a!==x).flatMap(a=>{let A=ie(a,e.split(" "))??V(p,a).filters.find(D=>D.about==="field"&&D.type==="date");return A?pt(a).filter(D=>(x?D.far===x:Te(D.far))&&D.far!==a).map(D=>({kind:a,field:A,relation:D,said:v.length===0||de.some(ve=>D.words.some(vt=>Lt(vt,ve)))})):[]}).filter(a=>a.said);if(T.length===0)return;let Q=T.filter(a=>n.some(A=>$(a.field.key)===A||$(a.field.label)===A)),R=T.length===1?T[0]:Q.length===1?Q[0]:void 0;if(!R)return;let{kind:K,field:Y,relation:W}=R,X=[...s.ask.from?[{key:Y.key,value:`after:${C(s.ask.from,-1)}`}]:[],...s.ask.to?[{key:Y.key,value:`before:${C(s.ask.to,1)}`}]:[]],Z=w.nodesOfKind(K).filter(a=>X.every(A=>ue(be,a,A))),we=a=>(W.direction==="out"?c.graph.out(a.id,W.key):c.graph.in(a.id,W.key)).filter(A=>A.kind===W.far&&u.has(W.far)),_=[],g=[];for(let a of Z){let A=we(a);A.length===0&&g.push(a);for(let D of A)_.some(ve=>ve.id===D.id)||_.push(D)}let m=Ie(s.ask,Y),E=s.ask.day?`On ${s.ask.day}`:ee(s.ask.words.replace(/^(?:due|for|on|by) (?:the )?/,"")),U=I(K).toLowerCase(),L=X.map(a=>`${a.key}:${a.value}`).join(","),b=`${U} ${m}`,O={to:"kind",kind:K,title:ee(b),filter:L,address:`${se(K)}?${new URLSearchParams({filter:L}).toString()}`,said:`Went to the ${b}.`};if(Z.length===0)return{about:"related",say:`No ${b}. ${O.said}`,moves:[O]};let le=v.join(" "),yt=l==="was"||l==="were",Ge=a=>yt?a===1?"was":"were":a===1?"is":"are",ce=_.map(H),bt=ce.length>8?[...ce.slice(0,8),`${ce.length-8} more`]:ce,kt=_.length===0?`${E}: nobody ${Ge(1)}${le?` ${le}`:""}.`:`${E}: ${fe(bt)}${le?` ${Ge(_.length)} ${le}`:""}.`,$t=t==="who"&&g.length>0?`${fe(g.slice(0,4).map(H))}${g.length>4?` and ${g.length-4} more`:""} ${g.length===1?"has":"have"} nobody.`:"",wt=_.slice(0,8).map(a=>({about:"node",id:a.id,kind:a.kind,label:H(a),why:{field:W.key,reading:Ze(p,W.direction==="out"?K:W.far,W.key,W.direction==="out"?"out":"in"),fragment:m,strength:"field"},current:!0,flagged:ye.has(a.id),address:ge(a)}));return{about:"related",say:[kt,$t,O.said].filter(Boolean).join(" "),moves:[O],picks:wt}},Ke=N.match(jt);if(Ke){let e=Ke[1];if(e&&!rt.has(e)&&!/^(?:it|this|that)$/.test(e)){let n=re(e),r=n?void 0:pe(z(e)||e);if(r?.one){let h=Me(r.one);return{about:"describe",say:`${h.said} ${oe(r.one)}`,moves:[h],subject:r.one.id}}if(!n)return r&&r.picks.length>0?{about:"picks",say:Re(r.picks),moves:[],picks:r.picks}:De()}if(e&&/^(?:it|this|that)$|^(?:here|this place|this page)$/.test(e)){let n=(y.selection??[]).map(r=>w.getNode(r)).find(r=>r!==void 0);if(n)return{about:"describe",say:oe(n),moves:[],subject:n.id}}let t=c.violations();if(t.length===0)return{about:"problems",say:"Nothing is wrong \u2014 every rule holds.",moves:[]};let s={to:"problems",address:"/problems",said:"Went to the problems."};return{about:"problems",say:`${s.said} ${Qe(t)}: ${t.slice(0,4).map(n=>n.message).join("; ")}${t.length>4?"\u2026":"."}`,moves:[s]}}if(Ot.test(N))return Le();let _e=mt(N);if(_e)return _e;let ke=Oe(N,k,j);if(ke&&!re(z(ke.ask.words))&&ke.rest.replace(/'s\b/g,"").split(" ").every(e=>e===""||te.has(e)||Ce.has(e))){let e=ae(N);if(e)return e}if(/^open /.test(N)){let e=ae(N);if(e)return e}let Fe=N.match(Nt)??N.match(/^(?:go|take me|head|get me)(?: back)? (home)$/);if(Fe)return Ee(Fe[1].trim(),!1);let Be=N.match(St);if(Be){let e=Ee(Be[1].trim(),!0);return"unresolved"in e&&e.unresolved&&!/^tell me|^describe/.test(N)?{unresolved:!0}:e}let $e=re(N);if($e){let e=We($e);return{about:"place",say:e.said,moves:[e],subject:$e.slug}}let Ue=ae(N);return Ue||{unresolved:!0}}var Ce=new Set(["who","whom","whose","which","what","whats","what's","who's"]),Et=new Set(["person","people","user","users","member","members","volunteer","volunteers","gardener","gardeners","player","players","staff","worker","workers","employee","employees","owner","owners","assignee","assignees","helper","helpers","student","students","teacher","teachers","customer","customers","client","clients","contact","contacts","author","authors"]),lt=new Set(["work","cover","staff","assign","do","run","schedul","roster","book","duty","serv","help"]);function je(o){let i=o.toLowerCase().replace(/'s$/,"");for(let y of["ing","ed","es","s"])if(i.length>y.length+2&&i.endsWith(y)){let f=i.slice(0,-y.length);return f.length>3&&f[f.length-1]===f[f.length-2]?f.slice(0,-1):f}return i}function ct(o){return o.toLowerCase().split(/[^a-z']+/).filter(i=>i.length>1&&!te.has(i)&&!Ce.has(i)&&!["it","they","them","their","its","this","here","to","at"].includes(i)).map(je)}var Lt=(o,i)=>o===i||o.length>=4&&i.length>=4&&(o.startsWith(i)||i.startsWith(o)),ne=new Set(["done","finished","complete","completed","closed","resolved","agreed","canceled","archived","shipped","delivered"]),Pt=new Set(["open","unfinished","outstanding","pending","remaining","undone","incomplete"]);function ut(o,i){return V(o,i.kind).filters.some(f=>f.about==="field"&&(f.type==="boolean"&&ne.has(f.key.toLowerCase())&&i[f.key]===!0||f.type==="choice"&&typeof i[f.key]=="string"&&ne.has(String(i[f.key]).toLowerCase())))}function fe(o){return o.length<=1?o[0]??"":`${o.slice(0,-1).join(", ")} and ${o[o.length-1]}`}function zt(o,i,y={}){let f=y.scene!==void 0?{...y.pages,scene:y.scene}:y.pages;return[...nt(o,i,f?{pages:f}:{})].map(({first:c,hidden:p,lens:k,...j})=>j)}function gt(o,i){return{...o.principal?{principal:o.principal}:{},...o.places?{places:o.places}:{},...o.selection?{selection:o.selection}:{},...o.place?{place:o.place}:{},...i??o.today?{today:i??o.today}:{},...o.weekStartsOn!==void 0?{weekStartsOn:o.weekStartsOn}:{}}}function Jt(o,i,y,f){let c=ht(o,i,gt(y,f));if(c.unresolved)return c.say?{reply:{say:c.say,proposals:[],grounded:!0}}:{};if(c.about==="picks")return{};let p=c.moves.length>0?{moves:c.moves}:{},k=c.subject?o.graph.getNode(c.subject):void 0;if(c.about==="problems")return{...p,problems:!0};if(k&&(c.about==="describe"||c.about==="here"))return{...p,told:k.id};let j=k?tt(o,ot(Ve(o.violations(),[k.id])).slice(0,3)):[];return{reply:{say:c.say,proposals:j,grounded:!0,...p,...c.picks&&c.picks.length>0?{picks:c.picks}:{},...c.offer?{offer:c.offer}:{}}}}function Yt(o,i,y={}){let f=gt(y),c=[];for(let p of i){let k=typeof p=="string"?p:typeof p=="object"&&p!==null&&typeof p.to=="string"?p.to:void 0;if(!k||k.trim().length===0)continue;let j=ht(o,/^(?:go|take me|open|show)\b/i.test(k.trim())?k:`go to ${k}`,f);if("moves"in j)for(let J of j.moves)c.some(B=>B.address===J.address)||c.push(J)}return c}export{At as NOTHING_BY_THAT_NAME,gt as askContextOf,Jt as goingFrom,Yt as movesFromNames,zt as placesFromViews,ht as resolveAsk};
|
|
1
|
+
import{a as ot}from"./chunk.644FUGSX.js";import"./chunk.NKC3JILT.js";import{e as V,l as ue,n as G,r as st}from"./chunk.HEWVPXRE.js";import{a as ee}from"./chunk.G4JJXA63.js";import"./chunk.LL2MLSPH.js";import{b as nt}from"./chunk.EB4NVTJL.js";import{d as tt}from"./chunk.XU34T2H4.js";import"./chunk.XOZU4OFA.js";import"./chunk.BB33TI4S.js";import"./chunk.2EDC63RI.js";import"./chunk.3YZHZGTM.js";import{d as et}from"./chunk.EQTSV7BK.js";import{c as Ze}from"./chunk.27CW6SCT.js";import{Ad as Xe,K as ze,X as Je,ga as Ye,ja as qe,na as Ae,oa as F,ob as Ve,pb as Qe,zd as Ne}from"./chunk.7BBGRTXM.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var At="Nothing by that name here.",$=o=>o.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[’']/g,"'").replace(/[^\p{L}\p{N}' ]+/gu," ").replace(/\s+/g," ").trim(),Nt=/^(?:(?:can you |could you |please )?(?:go|take me|bring me|head|jump|navigate|switch|get me)(?: back)? to|(?:please )?(?:open|show(?: me)?|bring up|let me see|view)) (.+)$/,St=/^(?:(?:can you |could you |please )?tell me (?:about|of)|what(?: is|'s| are) (?:in |on )?|describe|explain|who(?: is|'s)) (.+)$/,Ot=/^(?:what(?: is|'s| am i looking at| do i see)(?: (?:here|this|on (?:this|the) (?:page|screen)|in view|this place|this page))?|where am i|describe (?:this|here|this place|this page)|tell me about (?:this|here|this place|this page))$/,rt=new Set(["here","this","this place","this page","on this page","on the page","on this screen","in view"]),Ct=/^(?:date|day|when|on|at|the date|the day)$/,jt=/^(?:what(?: is|'s) (?:wrong|broken|the (?:problem|matter|trouble))|what needs (?:fixing|attention|doing)|any (?:problems|issues|trouble)|(?:show(?: me)? |go to |open )?(?:the )?(?:problems|issues|trouble|standing|what's wrong)|is (?:anything|something) (?:wrong|broken)|are there (?:any )?(?:problems|issues))(?: (?:with|about|on|in) (.+))?$/,z=o=>o.replace(/^(?:the|a|an|my|our) /,""),te=new Set(["the","a","an","my","our","all","any","of","that","which","who","are","is","be","what","whats","what's","with","me","show","list","every","there","do","i","have","we","due","for","please","were","was","by","from","in","on"]),ft=864e5,he=o=>Date.UTC(Number(o.slice(0,4)),Number(o.slice(5,7))-1,Number(o.slice(8,10))),xe=o=>new Date(o).toISOString().slice(0,10),C=(o,i)=>xe(he(o)+i*ft),xt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Mt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Wt="(monday|tuesday|tues|wednesday|thursday|thurs|friday|saturday|sunday)",it="(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sept|sep|oct|nov|dec)",at="(\\d{1,2})(?:st|nd|rd|th)?",Dt=o=>xt.findIndex(i=>i.startsWith(o.slice(0,3))),dt=o=>Mt.findIndex(i=>o.startsWith(i.toLowerCase()));function Rt(o,i){return Je(o,{year:o.slice(0,4)!==i.slice(0,4)})}function Se(o,i,y){if(o<0||i<1||i>31)return;let f=Number(y.slice(0,4)),c=k=>{let j=Date.UTC(k,o,i);return new Date(j).getUTCMonth()===o?xe(j):void 0},p=c(f);if(p)return he(p)<he(y)-183*ft?c(f+1):p}function Oe(o,i,y){let f=new Date(he(i)).getUTCDay(),c=u=>{let S=(f-y+7)%7,w=C(i,-S+u*7);return{from:w,to:C(w,6)}},p=()=>{let u=`${i.slice(0,8)}01`,S=new Date(Date.UTC(Number(i.slice(0,4)),Number(i.slice(5,7)),1));return{from:u,to:C(xe(S.getTime()),-1)}},k=u=>u?{from:u,to:u,day:Rt(u,i)}:void 0,j=(u,S)=>{let w=Dt(S);return k(u==="this"||u==="next"?C(c(u==="next"?1:0).from,(w-y+7)%7):u==="last"?C(i,-((f-w+6)%7+1)):C(i,(w-f+7)%7))},J=u=>{let S=C(i,f===0?-1:6-f);return{from:C(S,u*7),to:C(S,u*7+1)}},B="\\b(?:(?:due |for |on |by )(?:the )?)?",P=[[/\b(?:overdue|past due|late)\b/,()=>({overdue:!0,to:C(i,-1)})],[/\b(?:due |for |on )?today\b/,()=>({from:i,to:i})],[/\b(?:due |for |on )?tomorrow\b/,()=>k(C(i,1))],[/\b(?:due |for |on )?yesterday\b/,()=>k(C(i,-1))],[/\b(?:due |for |on )?this week\b/,()=>c(0)],[/\b(?:due |for |on )?next week\b/,()=>c(1)],[/\b(?:due |for |on )?(?:last|previous) week\b/,()=>c(-1)],[/\b(?:due |for |on )?next weekend\b/,()=>J(1)],[/\b(?:due |for |on )?(?:this |the )?weekend\b/,()=>J(0)],[/\b(?:due |for |on )?this month\b/,()=>p()],[new RegExp(`${B}(\\d{4}) (\\d{2}) (\\d{2})\\b`),u=>k(Se(Number(u[2])-1,Number(u[3]),`${u[1]}-01-01`))],[new RegExp(`${B}${at} (?:of )?${it}\\b`),u=>k(Se(dt(u[2]),Number(u[1]),i))],[new RegExp(`${B}${it} (?:the )?${at}\\b`),u=>k(Se(dt(u[1]),Number(u[2]),i))],[new RegExp(`${B}(?:(this|next|last|coming) )?${Wt}\\b`),u=>j(u[1],u[2])]];for(let[u,S]of P){let w=o.match(u);if(!w)continue;let N=S(w);if(N)return{ask:{words:w[0],...N},rest:o.replace(w[0]," ").replace(/\s+/g," ").trim()}}}function ht(o,i,y={}){let f=y.principal??{kind:"human"},c=o.seenBy(f),p=c.schema,k=y.today??o.today?.()??ze(),j=y.weekStartsOn??1,J=o.kindsKeptFrom(f),B=o.modules.disabledKinds,P=p.kinds.filter(e=>!J.has(e)&&!B.has(e)),u=new Set(P),S=(y.places??[]).filter(e=>e.kind===null||u.has(e.kind)),w=c.graph,N=$(i).replace(/[?.!]+$/,"").trim();if(N.length===0)return{unresolved:!0};let M=e=>p.tryDefinition(e),H=e=>Ye(M(e.kind),e),I=e=>qe(p,e),se=e=>S.find(t=>t.kind===e&&t.address===Ne(p,e))?.address??Ne(p,e),ge=e=>Xe(p,e.kind,e.id),Me=e=>({to:"record",id:e.id,kind:e.kind,label:H(e),address:ge(e),said:`Went to ${H(e)}.`}),We=e=>{let t=`Went to ${e.title}.`;return e.kind===null?{to:"place",slug:e.slug,title:e.title,address:e.address,...e.slug==="overview"?{face:"scene"}:{},said:t}:e.lens||e.address.startsWith("/places/")?{to:"picture",kind:e.kind,as:e.slug,title:e.title,address:e.address,said:t}:{to:"kind",kind:e.kind,title:e.title,address:e.address,said:t}},De=()=>({unresolved:!0,say:At}),oe=e=>{let t=M(e.kind),s=et(e,t,{limit:3,excerpt:!0}).map(r=>r.alone.startsWith(r.label)?r.alone:`${r.label.toLowerCase()} ${r.alone}`).join(", "),n=c.violations().filter(r=>r.nodeIds.includes(e.id));return[`${H(e)} \u2014 ${Ae(F(t,e.kind))}${s?` (${s})`:""}.`,n.length>0?`Trouble: ${n.map(r=>r.message).join("; ")}.`:""].filter(Boolean).join(" ")},re=e=>{let t=new Set([G(e),G(z(e))]);for(let n of[" page"," view"," lens"," place"," picture"," list"])e.endsWith(n)&&(t.add(G(e.slice(0,-n.length))),t.add(G(z(e.slice(0,-n.length)))));t.delete("");let s=n=>t.has(G(n.title))||t.has(G(z($(n.title))))||t.has(G(n.slug));return S.find(n=>n.kind!==null&&n.address.startsWith("/places/")&&s(n))??S.find(s)},pe=e=>{let t=st(o,e,{principal:f,today:k,limit:6,near:!1,...y.selection?{from:y.selection}:{}}),s=t.hits.filter(r=>r.about==="node"&&u.has(r.kind)&&w.getNode(r.id)!==void 0),n=s.filter(r=>r.why.field==="label"&&r.why.strength==="exact");return n.length===1?{one:w.getNode(n[0].id),picks:s}:n.length>1?{picks:n}:s.length===1&&t.total===1?{one:w.getNode(s[0].id),picks:s}:{picks:s}},Re=e=>{let t=e.map(s=>`${s.label} (${F(M(s.kind),s.kind)})`);return`${e.length===1?"One thing matches":`${e.length} things match`}: ${t.join("; ")}.`},Ee=(e,t)=>{if(rt.has(e))return Le();let s=t?pe(z(e)||e):void 0,n=s?.one&&$(H(s.one))===$(z(e)||e)?void 0:re(e);if(n){let l=We(n);return{about:"place",say:t?`${l.said} ${me(n)}`:l.said,moves:[l],subject:n.slug}}let r=pe(z(e)||e);if(r.one){let l=Me(r.one);return{about:t?"describe":"record",say:t?`${l.said} ${oe(r.one)}`:l.said,moves:[l],subject:r.one.id}}if(r.picks.length>0)return{about:"picks",say:Re(r.picks),moves:[],picks:r.picks};let h=ae(e);if(h)return h;let d=Pe(e);if(d){if(d.rest.split(" ").every(l=>l===""||te.has(l))){let l=I(d.kind),v={to:"kind",kind:d.kind,title:l,address:se(d.kind),said:`Went to the ${l.toLowerCase()}.`};return{about:"kind",say:v.said,moves:[v]}}return{unresolved:!0}}return De()},me=e=>{if(e.kind===null){let h=P.map(l=>({kind:l,count:w.nodesOfKind(l).length})).filter(l=>l.count>0).map(l=>`${l.count} ${(l.count===1?F(M(l.kind),l.kind):I(l.kind)).toLowerCase()}`),d=c.violations().length;return[h.length>0?`It holds ${fe(h)}.`:"It holds nothing yet.",d>0?`${d===1?"One problem":`${d} problems`} to see to.`:""].filter(Boolean).join(" ")}let t=w.nodesOfKind(e.kind).length,s=I(e.kind).toLowerCase(),n=new Set(c.violations().flatMap(h=>h.nodeIds)),r=w.nodesOfKind(e.kind).filter(h=>n.has(h.id)).length;return[e.lens?`It draws the ${s} as ${Ae(e.lens)}${t>0?` \u2014 ${t} of them`:""}.`:`${t===0?"No":t} ${t===1?F(M(e.kind),e.kind):s} ${t===1?"is":"are"} here.`,r>0?`${r} ${r===1?"has":"have"} a problem.`:""].filter(Boolean).join(" ")},Le=()=>{let e=(y.selection??[]).map(s=>w.getNode(s)).find(s=>s!==void 0);if(e)return{about:"here",say:oe(e),moves:[],subject:e.id};let t=S.find(s=>s.slug===y.place)??S.find(s=>s.slug==="home");return t?{about:"here",say:`${t.title}. ${me(t)}`,moves:[],subject:t.slug}:{about:"here",say:me({slug:"home",title:"Home",kind:null,cardinality:"many",address:"/",stop:"#"}),moves:[]}},Pe=e=>{let t=P.flatMap(s=>[I(s),F(M(s),s),s].map(n=>({kind:s,name:$(n)}))).filter(s=>s.name.length>0).sort((s,n)=>n.name.length-s.name.length);for(let{kind:s,name:n}of t)if(!(` ${e} `.indexOf(` ${n} `)<0))return{kind:s,rest:` ${e} `.replace(` ${n} `," ").replace(/\s+/g," ").trim()}},ie=(e,t)=>{let s=V(p,e).filters.filter(d=>d.about==="field"&&d.type==="date");if(s.length===0)return;let n=s.find(d=>t.some(l=>$(d.key)===l||$(d.label)===l));if(n)return n;let r=M(e)?.fieldRoles??{};for(let d of["due","deadline","date","when","start","end"]){let l=r[d],v=l?s.find(x=>x.key===l):void 0;if(v)return v}return s.find(d=>["due","deadline","date","when","on","at"].includes(d.key.toLowerCase()))??(s.length===1?s[0]:void 0)},He=e=>{let t=M(e),s=V(p,e).filters;if(t?.lifecycle)return{conditions:[{key:"is",value:"current"}],holds:d=>ue(be,d,{key:"is",value:"current"})};let r=s.find(d=>d.about==="field"&&d.type==="boolean"&&ne.has($(d.key)));if(r)return{conditions:[{key:r.key,value:"false"}],holds:d=>d[r.key]!==!0};let h=s.find(d=>d.about==="field"&&d.type==="choice"&&(d.options??[]).some(l=>ne.has($(l))));if(h){let d=new Set((h.options??[]).filter(v=>ne.has($(v)))),l=(h.options??[]).filter(v=>!d.has(v));return l.length===1?{conditions:[{key:h.key,value:l[0]}],holds:v=>v[h.key]===l[0]}:"unsayable"}return{conditions:[],holds:()=>!0}},Ie=(e,t)=>{let s=e.words.startsWith("due")||$(t.key)==="due",n=Ct.test($(t.label));if(e.day)return s?`due ${e.day}`:n?`on ${e.day}`:`${t.label.toLowerCase()} on ${e.day}`;let r=e.words.replace(/^(?:due|for|on|by) (?:the )?/,"");return s?`due ${r}`:n?r:`${t.label.toLowerCase()} ${r}`},ye=new Set(c.violations().flatMap(e=>e.nodeIds)),be={schema:p,graph:c.graph,flagged:ye,today:k},ae=e=>{let t=Oe(e,k,j),s=Pe(t?.rest??e),n=s?.kind,r=(s?.rest??t?.rest??e).split(" ").filter(Boolean);if(!n&&t){let g=e.split(" "),m=P.filter(L=>ie(L,g)!==void 0),E=m.filter(L=>{let b=ie(L,g);return g.some(O=>$(b.key)===O||$(b.label)===O)}),U=m.length===1?m:E;if(U.length!==1)return;n=U[0]}if(!n)return;let h=V(p,n).filters,d=[],l=[],v=[],x=[],q=!1,de=[];for(let g=0;g<r.length;g++){let m=r[g],E=g>0&&(r[g-1]==="not"||r[g-1]==="un"),U=h.find(b=>b.about==="field"&&b.type==="choice"&&(b.options??[]).some(O=>$(O)===m));if(U&&!E){let b=(U.options??[]).find(O=>$(O)===m);d.push({key:U.key,value:b}),l.push(b);continue}let L=h.find(b=>b.about==="field"&&b.type==="boolean"&&[$(b.key),$(b.label)].some(O=>O===m||O===m.replace(/^un/,"")));if(L){let b=!E&&!(m.startsWith("un")&&!$(L.key).startsWith("un"));d.push({key:L.key,value:String(b)}),l.push(b?m:`not ${m.replace(/^un/,"")}`);continue}if(Pt.has(m)&&!E){let b=He(n);b==="unsayable"?(q=!0,x.push(O=>!ut(p,O))):(d.push(...b.conditions),x.push(b.holds)),l.push(m);continue}m==="not"||m==="un"||t&&h.some(b=>b.type==="date"&&($(b.key)===m||$(b.label)===m))||de.push(m)}if(r=de,r.some(g=>!te.has(g))||!t&&d.length===0&&x.length===0)return;let T=I(n).toLowerCase(),Q=I(n);if(t){let g=ie(n,e.split(" "));if(!g){let m={to:"kind",kind:n,title:Q,address:se(n),said:`Went to the ${T}.`};return{about:"kind",say:`${ee(Q)} carry no date, so I can't tell which are ${/^(?:due|for|on|overdue|past due|late)\b/.test(t.ask.words)?t.ask.words:`due ${t.ask.words}`}. ${m.said}`,moves:[m]}}if(t.ask.from&&d.push({key:g.key,value:`after:${C(t.ask.from,-1)}`}),t.ask.to&&d.push({key:g.key,value:`before:${C(t.ask.to,1)}`}),t.ask.overdue){let m=He(n);m==="unsayable"?(q=!0,x.push(E=>!ut(p,E))):(d.push(...m.conditions),x.push(m.holds))}t.ask.overdue?l.push("overdue"):v.push(Ie(t.ask,g))}let R=w.nodesOfKind(n).filter(g=>d.every(m=>ue(be,g,m))&&x.every(m=>m(g))),K=[...l,...v].join(" and "),Y=[...l,T,...v].join(" "),W=R.slice(0,6).map(g=>({about:"node",id:g.id,kind:n,label:H(g),why:{field:d[0]?.key??"label",reading:d[0]?.key??"Name",fragment:K,strength:"field"},current:!0,flagged:ye.has(g.id),address:ge(g)})),X=R.length===0?`No ${T} are ${K}.`:`${R.length===1?`One ${F(M(n),n)} is`:`${R.length} ${T} are`} ${K}: ${fe(R.slice(0,6).map(H))}${R.length>6?`, and ${R.length-6} more`:""}.`;if(q)return{about:"kind",say:X,moves:[],picks:W,offer:{draft:Y,label:"Show as a view"}};let Z=d.map(g=>`${g.key}:${g.value}`).join(","),we=`${se(n)}?${new URLSearchParams({filter:Z}).toString()}`,_={to:"kind",kind:n,title:ee(Y),filter:Z,address:we,said:`Went to the ${Y}.`};return{about:"kind",say:`${_.said} ${X}`,moves:[_],picks:W}},Te=e=>M(e)?.figure==="person"?!0:[e,F(M(e),e),I(e)].some(s=>$(s).split(" ").some(n=>Et.has(n))),pt=e=>{let t=[],s=n=>M(n)?.edges??{};for(let[n,r]of Object.entries(s(e)))for(let h of r.to??[])u.has(h)&&t.push({key:n,direction:"out",far:h,words:ct(`${r.description??""} ${n}`)});for(let n of P)for(let[r,h]of Object.entries(s(n)))(h.to??[]).includes(e)&&t.push({key:r,direction:"in",far:n,words:ct(`${h.inverse??""} ${r}`)});return t},mt=e=>{let t=e.match(/^(who|which|what)\b/)?.[1];if(!t)return;let s=Oe(e,k,j);if(!s||s.ask.overdue)return;let n=s.rest.split(" ").filter(Boolean),r=P.flatMap(a=>[I(a),F(M(a),a),a].map(A=>({kind:a,name:$(A)}))).filter(a=>a.name.length>0).sort((a,A)=>A.name.length-a.name.length),h=` ${n.join(" ")} `,d=[];for(let{kind:a,name:A}of r)h.includes(` ${A} `)&&(h=h.replace(` ${A} `," "),d.includes(a)||d.push(a));let l=h.match(/\b(?:is|are|was|were)\b|'s\b/)?.[0],v=h.replace(/'s\b/g," ").split(" ").filter(a=>a.length>0&&!te.has(a)&&!Ce.has(a)),x=t==="who"?d.find(Te):d[0];if(!x&&t!=="who")return;let q=d.find(a=>a!==x),de=v.flatMap(a=>[je(a),...lt.has(je(a))?[...lt]:[]]),T=P.filter(a=>q?a===q:a!==x).flatMap(a=>{let A=ie(a,e.split(" "))??V(p,a).filters.find(D=>D.about==="field"&&D.type==="date");return A?pt(a).filter(D=>(x?D.far===x:Te(D.far))&&D.far!==a).map(D=>({kind:a,field:A,relation:D,said:v.length===0||de.some(ve=>D.words.some(vt=>Lt(vt,ve)))})):[]}).filter(a=>a.said);if(T.length===0)return;let Q=T.filter(a=>n.some(A=>$(a.field.key)===A||$(a.field.label)===A)),R=T.length===1?T[0]:Q.length===1?Q[0]:void 0;if(!R)return;let{kind:K,field:Y,relation:W}=R,X=[...s.ask.from?[{key:Y.key,value:`after:${C(s.ask.from,-1)}`}]:[],...s.ask.to?[{key:Y.key,value:`before:${C(s.ask.to,1)}`}]:[]],Z=w.nodesOfKind(K).filter(a=>X.every(A=>ue(be,a,A))),we=a=>(W.direction==="out"?c.graph.out(a.id,W.key):c.graph.in(a.id,W.key)).filter(A=>A.kind===W.far&&u.has(W.far)),_=[],g=[];for(let a of Z){let A=we(a);A.length===0&&g.push(a);for(let D of A)_.some(ve=>ve.id===D.id)||_.push(D)}let m=Ie(s.ask,Y),E=s.ask.day?`On ${s.ask.day}`:ee(s.ask.words.replace(/^(?:due|for|on|by) (?:the )?/,"")),U=I(K).toLowerCase(),L=X.map(a=>`${a.key}:${a.value}`).join(","),b=`${U} ${m}`,O={to:"kind",kind:K,title:ee(b),filter:L,address:`${se(K)}?${new URLSearchParams({filter:L}).toString()}`,said:`Went to the ${b}.`};if(Z.length===0)return{about:"related",say:`No ${b}. ${O.said}`,moves:[O]};let le=v.join(" "),yt=l==="was"||l==="were",Ge=a=>yt?a===1?"was":"were":a===1?"is":"are",ce=_.map(H),bt=ce.length>8?[...ce.slice(0,8),`${ce.length-8} more`]:ce,kt=_.length===0?`${E}: nobody ${Ge(1)}${le?` ${le}`:""}.`:`${E}: ${fe(bt)}${le?` ${Ge(_.length)} ${le}`:""}.`,$t=t==="who"&&g.length>0?`${fe(g.slice(0,4).map(H))}${g.length>4?` and ${g.length-4} more`:""} ${g.length===1?"has":"have"} nobody.`:"",wt=_.slice(0,8).map(a=>({about:"node",id:a.id,kind:a.kind,label:H(a),why:{field:W.key,reading:Ze(p,W.direction==="out"?K:W.far,W.key,W.direction==="out"?"out":"in"),fragment:m,strength:"field"},current:!0,flagged:ye.has(a.id),address:ge(a)}));return{about:"related",say:[kt,$t,O.said].filter(Boolean).join(" "),moves:[O],picks:wt}},Ke=N.match(jt);if(Ke){let e=Ke[1];if(e&&!rt.has(e)&&!/^(?:it|this|that)$/.test(e)){let n=re(e),r=n?void 0:pe(z(e)||e);if(r?.one){let h=Me(r.one);return{about:"describe",say:`${h.said} ${oe(r.one)}`,moves:[h],subject:r.one.id}}if(!n)return r&&r.picks.length>0?{about:"picks",say:Re(r.picks),moves:[],picks:r.picks}:De()}if(e&&/^(?:it|this|that)$|^(?:here|this place|this page)$/.test(e)){let n=(y.selection??[]).map(r=>w.getNode(r)).find(r=>r!==void 0);if(n)return{about:"describe",say:oe(n),moves:[],subject:n.id}}let t=c.violations();if(t.length===0)return{about:"problems",say:"Nothing is wrong \u2014 every rule holds.",moves:[]};let s={to:"problems",address:"/problems",said:"Went to the problems."};return{about:"problems",say:`${s.said} ${Qe(t)}: ${t.slice(0,4).map(n=>n.message).join("; ")}${t.length>4?"\u2026":"."}`,moves:[s]}}if(Ot.test(N))return Le();let _e=mt(N);if(_e)return _e;let ke=Oe(N,k,j);if(ke&&!re(z(ke.ask.words))&&ke.rest.replace(/'s\b/g,"").split(" ").every(e=>e===""||te.has(e)||Ce.has(e))){let e=ae(N);if(e)return e}if(/^open /.test(N)){let e=ae(N);if(e)return e}let Fe=N.match(Nt)??N.match(/^(?:go|take me|head|get me)(?: back)? (home)$/);if(Fe)return Ee(Fe[1].trim(),!1);let Be=N.match(St);if(Be){let e=Ee(Be[1].trim(),!0);return"unresolved"in e&&e.unresolved&&!/^tell me|^describe/.test(N)?{unresolved:!0}:e}let $e=re(N);if($e){let e=We($e);return{about:"place",say:e.said,moves:[e],subject:$e.slug}}let Ue=ae(N);return Ue||{unresolved:!0}}var Ce=new Set(["who","whom","whose","which","what","whats","what's","who's"]),Et=new Set(["person","people","user","users","member","members","volunteer","volunteers","gardener","gardeners","player","players","staff","worker","workers","employee","employees","owner","owners","assignee","assignees","helper","helpers","student","students","teacher","teachers","customer","customers","client","clients","contact","contacts","author","authors"]),lt=new Set(["work","cover","staff","assign","do","run","schedul","roster","book","duty","serv","help"]);function je(o){let i=o.toLowerCase().replace(/'s$/,"");for(let y of["ing","ed","es","s"])if(i.length>y.length+2&&i.endsWith(y)){let f=i.slice(0,-y.length);return f.length>3&&f[f.length-1]===f[f.length-2]?f.slice(0,-1):f}return i}function ct(o){return o.toLowerCase().split(/[^a-z']+/).filter(i=>i.length>1&&!te.has(i)&&!Ce.has(i)&&!["it","they","them","their","its","this","here","to","at"].includes(i)).map(je)}var Lt=(o,i)=>o===i||o.length>=4&&i.length>=4&&(o.startsWith(i)||i.startsWith(o)),ne=new Set(["done","finished","complete","completed","closed","resolved","agreed","canceled","archived","shipped","delivered"]),Pt=new Set(["open","unfinished","outstanding","pending","remaining","undone","incomplete"]);function ut(o,i){return V(o,i.kind).filters.some(f=>f.about==="field"&&(f.type==="boolean"&&ne.has(f.key.toLowerCase())&&i[f.key]===!0||f.type==="choice"&&typeof i[f.key]=="string"&&ne.has(String(i[f.key]).toLowerCase())))}function fe(o){return o.length<=1?o[0]??"":`${o.slice(0,-1).join(", ")} and ${o[o.length-1]}`}function zt(o,i,y={}){let f=y.scene!==void 0?{...y.pages,scene:y.scene}:y.pages;return[...nt(o,i,f?{pages:f}:{})].map(({first:c,hidden:p,lens:k,...j})=>j)}function gt(o,i){return{...o.principal?{principal:o.principal}:{},...o.places?{places:o.places}:{},...o.selection?{selection:o.selection}:{},...o.place?{place:o.place}:{},...i??o.today?{today:i??o.today}:{},...o.weekStartsOn!==void 0?{weekStartsOn:o.weekStartsOn}:{}}}function Jt(o,i,y,f){let c=ht(o,i,gt(y,f));if(c.unresolved)return c.say?{reply:{say:c.say,proposals:[],grounded:!0}}:{};if(c.about==="picks")return{};let p=c.moves.length>0?{moves:c.moves}:{},k=c.subject?o.graph.getNode(c.subject):void 0;if(c.about==="problems")return{...p,problems:!0};if(k&&(c.about==="describe"||c.about==="here"))return{...p,told:k.id};let j=k?tt(o,ot(Ve(o.violations(),[k.id])).slice(0,3)):[];return{reply:{say:c.say,proposals:j,grounded:!0,...p,...c.picks&&c.picks.length>0?{picks:c.picks}:{},...c.offer?{offer:c.offer}:{}}}}function Yt(o,i,y={}){let f=gt(y),c=[];for(let p of i){let k=typeof p=="string"?p:typeof p=="object"&&p!==null&&typeof p.to=="string"?p.to:void 0;if(!k||k.trim().length===0)continue;let j=ht(o,/^(?:go|take me|open|show)\b/i.test(k.trim())?k:`go to ${k}`,f);if("moves"in j)for(let J of j.moves)c.some(B=>B.address===J.address)||c.push(J)}return c}export{At as NOTHING_BY_THAT_NAME,gt as askContextOf,Jt as goingFrom,Yt as movesFromNames,zt as placesFromViews,ht as resolveAsk};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{k as a,l as o}from"./chunk.GCBZ3WE2.js";import"./chunk.GDOTG7YA.js";import"./chunk.EPPXZZPK.js";import"./chunk.KFQSYCY3.js";import"./chunk.LCPGZK7G.js";import"./chunk.NKC3JILT.js";import"./chunk.HEWVPXRE.js";import"./chunk.43OKZU73.js";import"./chunk.WNSC3RWD.js";import"./chunk.ACYDJQRC.js";import"./chunk.S5MGE2U5.js";import"./chunk.34TW32TB.js";import"./chunk.WVUJXDXZ.js";import"./chunk.LDAYDCUO.js";import"./chunk.KKNDX4JT.js";import"./chunk.GKSUTAIX.js";import"./chunk.5ICIMQE6.js";import"./chunk.QGV7H7RQ.js";import"./chunk.YIA2EDVF.js";import"./chunk.GZHZLJBF.js";import"./chunk.ELERUERU.js";import"./chunk.OJGHDWI6.js";import"./chunk.YHTE34RN.js";import"./chunk.3YZHZGTM.js";import"./chunk.EQTSV7BK.js";import"./chunk.27CW6SCT.js";import"./chunk.YD3TKV6P.js";import"./chunk.4KC35UNR.js";import{ta as n}from"./chunk.HT2BEOEV.js";import"./chunk.SDO3U72B.js";import"./chunk.7BBGRTXM.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var w=new WeakMap;function p(e,i){let t=w.get(e);t||w.set(e,t=new Map);let r=t.get(i);return r||t.set(i,r=a(o(e,n(e)),e,i)),r}export{p as frameworkViews};
|