graview 0.1.32 → 0.1.34
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.7GKUVQVF.js → chunk.2UPGH6FT.js} +1 -1
- package/dist/preview/{chunk.I6FPNX43.js → chunk.2YCFK5HU.js} +1 -1
- package/dist/preview/{chunk.4HZ7QTXZ.js → chunk.2YGQVI6T.js} +1 -1
- package/dist/preview/{chunk.3K6YSVHC.js → chunk.34CYK2DF.js} +1 -1
- package/dist/preview/{chunk.3TVXGJTU.js → chunk.35KI7XYV.js} +1 -1
- package/dist/preview/{chunk.COQKECUH.js → chunk.3C4RJIJU.js} +1 -1
- package/dist/preview/{chunk.TAQ764IQ.js → chunk.3H4NVUWV.js} +1 -1
- package/dist/preview/{chunk.K5ME5GCG.js → chunk.3MWBWSYF.js} +1 -1
- package/dist/preview/{chunk.MAF7C3VM.js → chunk.4K5QCJFH.js} +1 -1
- package/dist/preview/{chunk.ULRW47RP.js → chunk.52QAIGCD.js} +1 -1
- package/dist/preview/{chunk.D75KC3LL.js → chunk.577PGFUT.js} +1 -1
- package/dist/preview/{chunk.EBGAYL32.js → chunk.5EAQDBBE.js} +1 -1
- package/dist/preview/{chunk.4MERAWS2.js → chunk.6A62UVAE.js} +1 -1
- package/dist/preview/{chunk.7T7NZZTC.js → chunk.6FBQP336.js} +1 -1
- package/dist/preview/{chunk.EF3XNU4O.js → chunk.6K2HASOH.js} +1 -1
- package/dist/preview/chunk.6P7P2AW7.js +1 -0
- package/dist/preview/{chunk.LXBOVRFI.js → chunk.6VRJII5M.js} +1 -1
- package/dist/preview/{chunk.VG3O4LWB.js → chunk.6XO4PECH.js} +1 -1
- package/dist/preview/{chunk.GYICGZMG.js → chunk.7HPPJVIV.js} +2 -2
- package/dist/preview/{chunk.PIP6Z563.js → chunk.7JNDZWD6.js} +1 -1
- package/dist/preview/{chunk.6UGEYZAC.js → chunk.7MTX33WD.js} +1 -1
- package/dist/preview/{chunk.ASCLIM2P.js → chunk.7VUPKOKC.js} +1 -1
- package/dist/preview/{chunk.LLLZEGRK.js → chunk.7WHWD5YJ.js} +1 -1
- package/dist/preview/{chunk.NM6MZYFN.js → chunk.7X2ZO5BD.js} +1 -1
- package/dist/preview/{chunk.XNJEFUF7.js → chunk.AHCI7ZDO.js} +1 -1
- package/dist/preview/{chunk.JFAOHHJJ.js → chunk.APNN6BKF.js} +1 -1
- package/dist/preview/{chunk.QGTSHKJL.js → chunk.B2WRXGFI.js} +1 -1
- package/dist/preview/{chunk.HLTRQU4Y.js → chunk.B6VI576I.js} +1 -1
- package/dist/preview/{chunk.NTF7FVB2.js → chunk.BU2DSZ2L.js} +1 -1
- package/dist/preview/{chunk.T5VG5A6V.js → chunk.CNMITOKP.js} +1 -1
- package/dist/preview/chunk.CPW465TM.js +1 -0
- package/dist/preview/{chunk.47STJVRV.js → chunk.CZRX2FDI.js} +1 -1
- package/dist/preview/{chunk.GV2CQVKV.js → chunk.DMNXYMLC.js} +1 -1
- package/dist/preview/{chunk.F6ZK7RMB.js → chunk.DNDHDDM6.js} +2 -2
- package/dist/preview/{chunk.MWGGV7DE.js → chunk.DUUARGPE.js} +1 -1
- package/dist/preview/chunk.E7EQ2VTE.js +1 -0
- package/dist/preview/{chunk.UHUGOTUU.js → chunk.ETWVQ3A2.js} +1 -1
- package/dist/preview/{chunk.BNV77BQZ.js → chunk.F6WYSDSI.js} +3 -3
- package/dist/preview/{chunk.FWTIUYXH.js → chunk.FBY5IUGU.js} +1 -1
- package/dist/preview/{chunk.UATVTXZY.js → chunk.FCRFQ7ZW.js} +1 -1
- package/dist/preview/chunk.FRS3S7DN.js +1 -0
- package/dist/preview/{chunk.UGFJKSHU.js → chunk.FSAHO3LV.js} +1 -1
- package/dist/preview/{chunk.JQU5GEU3.js → chunk.FUQVNXLB.js} +1 -1
- package/dist/preview/{chunk.JDUJDAGA.js → chunk.G64AREGA.js} +1 -1
- package/dist/preview/{chunk.CN3UEF5N.js → chunk.GMOTRAKJ.js} +1 -1
- package/dist/preview/chunk.GNSAKLP2.js +1 -0
- package/dist/preview/{chunk.RCKTBOY2.js → chunk.HCDKSDIS.js} +1 -1
- package/dist/preview/chunk.HH6P4BLT.js +1 -0
- package/dist/preview/{chunk.AOSMJKLH.js → chunk.HJ56Q6WB.js} +1 -1
- package/dist/preview/chunk.HP3ZEDCD.js +117 -0
- package/dist/preview/{chunk.G5NZVPJU.js → chunk.HPD5ZDZH.js} +1 -1
- package/dist/preview/chunk.HPEGQN6E.js +1 -0
- package/dist/preview/chunk.HUKAVTMX.js +1 -0
- package/dist/preview/chunk.HWITWOP3.js +3 -0
- package/dist/preview/{chunk.3TY5NFLY.js → chunk.IHFNLKXV.js} +1 -1
- package/dist/preview/{chunk.2NIOHEMX.js → chunk.JQDYGI6G.js} +1 -1
- package/dist/preview/chunk.JZBBGY4B.js +1 -0
- package/dist/preview/chunk.KA3KI4UA.js +1 -0
- package/dist/preview/{chunk.OF34OZ4V.js → chunk.KSXB4LDF.js} +1 -1
- package/dist/preview/{chunk.HAIG6NVX.js → chunk.LAF6GTBN.js} +1 -1
- package/dist/preview/{chunk.UNL2HIF2.js → chunk.LCFDM7XY.js} +1 -1
- package/dist/preview/{chunk.E2YEOMPH.js → chunk.LIIC25G6.js} +1 -1
- package/dist/preview/chunk.M5HADQPP.js +1 -0
- package/dist/preview/chunk.MWJUZG3C.js +6 -0
- package/dist/preview/chunk.OMMKD2NU.js +2 -0
- package/dist/preview/{chunk.JOOQUWLT.js → chunk.PNVR3CXR.js} +2 -2
- package/dist/preview/{chunk.PBSMLINK.js → chunk.PPUAPAWR.js} +1 -1
- package/dist/preview/{chunk.SYAEBGDC.js → chunk.PW7YH6JV.js} +1 -1
- package/dist/preview/{chunk.OC6IWRQ3.js → chunk.Q7TP4RFE.js} +1 -1
- package/dist/preview/{chunk.CIPS2OGR.js → chunk.QPAUQJON.js} +1 -1
- package/dist/preview/{chunk.UZGRRDHD.js → chunk.QU356VB2.js} +1 -1
- package/dist/preview/chunk.QVKKXMNK.js +1 -0
- package/dist/preview/{chunk.3AGY4QVS.js → chunk.QVUL2FSI.js} +1 -1
- package/dist/preview/chunk.RH45AW2W.js +1 -0
- package/dist/preview/{chunk.6YCBYL2Y.js → chunk.RIW7SQH4.js} +1 -1
- package/dist/preview/{chunk.H7EPE74C.js → chunk.RN3EZVV4.js} +1 -1
- package/dist/preview/{chunk.3HXN4BOY.js → chunk.RYEAMM73.js} +1 -1
- package/dist/preview/{chunk.YIR7PPF3.js → chunk.SIH6RCAI.js} +1 -1
- package/dist/preview/{chunk.NRAYZY3X.js → chunk.T2L4NPSB.js} +1 -1
- package/dist/preview/{chunk.DHIUSUCL.js → chunk.T3M4FALL.js} +5 -5
- package/dist/preview/{chunk.CX3KL2C5.js → chunk.TCSZZAYB.js} +1 -1
- package/dist/preview/chunk.TPX6AVJL.js +1 -0
- package/dist/preview/{chunk.5UL7YDUD.js → chunk.U5ACEYAN.js} +1 -1
- package/dist/preview/{chunk.5T5XGILP.js → chunk.UA5UYINM.js} +1 -1
- package/dist/preview/{chunk.GO4XBWJO.js → chunk.UCIQIPBQ.js} +1 -1
- package/dist/preview/{chunk.EKPRNDUV.js → chunk.UHQD3NTK.js} +1 -1
- package/dist/preview/{chunk.RIJUCHP4.js → chunk.VKH3ZPPQ.js} +1 -1
- package/dist/preview/{chunk.UBFNZMUX.js → chunk.VMGWYCXU.js} +1 -1
- package/dist/preview/chunk.VOFUIWAX.js +27 -0
- package/dist/preview/{chunk.DYSPCGXX.js → chunk.VSOB2QEK.js} +1 -1
- package/dist/preview/{chunk.R6K6GF5R.js → chunk.VZHV25JE.js} +1 -1
- package/dist/preview/chunk.WAB6ZS2V.js +1 -0
- package/dist/preview/chunk.WLBXBNNH.js +1 -0
- package/dist/preview/chunk.WPCGHGDA.js +1 -0
- package/dist/preview/{chunk.QYZNAUIR.js → chunk.WYEYYCBH.js} +1 -1
- package/dist/preview/{chunk.MNP4JI33.js → chunk.X7W27IRI.js} +4 -4
- package/dist/preview/{chunk.J25KOSNW.js → chunk.XK4FVT2X.js} +1 -1
- package/dist/preview/{chunk.CWHRDBOF.js → chunk.XXMYKBLT.js} +1 -1
- package/dist/preview/{chunk.CDP2XL66.js → chunk.XZYJRNRY.js} +1 -1
- package/dist/preview/chunk.YCIX53AR.js +1 -0
- package/dist/preview/chunk.YEYY273R.js +1 -0
- package/dist/preview/{chunk.EJPI3ST6.js → chunk.YJCT3DV2.js} +1 -1
- package/dist/preview/chunk.YT2CYCVT.js +1 -0
- package/dist/preview/{chunk.B2GLDIAS.js → chunk.Z7ZCR4LN.js} +1 -1
- package/dist/preview/{chunk.CAVBSL27.js → chunk.ZE4CTZQ3.js} +1 -1
- package/dist/preview/chunk.ZFWV4JAJ.js +1 -0
- package/dist/preview/{chunk.5H4VXLZF.js → chunk.ZJX6ZKKM.js} +1 -1
- package/dist/preview/chunk.ZPQKAJRI.js +1 -0
- package/dist/preview/{chunk.OKRNJXTV.js → chunk.ZSW74NVJ.js} +1 -1
- package/dist/preview/chunk.ZTD2CNC3.js +25 -0
- package/dist/preview/{chunk.QVVJRSRM.js → chunk.ZTFW7RKP.js} +1 -1
- package/dist/preview/index.html +42 -42
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.4HRAQNJO.js +0 -27
- package/dist/preview/chunk.52W7WYME.js +0 -1
- package/dist/preview/chunk.5TVB6BUY.js +0 -1
- package/dist/preview/chunk.63GXY2ME.js +0 -1
- package/dist/preview/chunk.6QWV5MVH.js +0 -25
- package/dist/preview/chunk.AKFKM4SW.js +0 -3
- package/dist/preview/chunk.BOO6WVM4.js +0 -117
- package/dist/preview/chunk.BQ3JHEHV.js +0 -1
- package/dist/preview/chunk.CJJLJ3KW.js +0 -2
- package/dist/preview/chunk.DAZ2VSRD.js +0 -1
- package/dist/preview/chunk.ERIT3R6N.js +0 -1
- package/dist/preview/chunk.EYTBDMTW.js +0 -1
- package/dist/preview/chunk.F6EH7HI2.js +0 -1
- package/dist/preview/chunk.FSTCX2AI.js +0 -1
- package/dist/preview/chunk.H7BST3XO.js +0 -1
- package/dist/preview/chunk.IDVAR5HM.js +0 -1
- package/dist/preview/chunk.K7PMDSOL.js +0 -1
- package/dist/preview/chunk.KSES5U5B.js +0 -1
- package/dist/preview/chunk.LR3VDXPI.js +0 -1
- package/dist/preview/chunk.N6OX4NEQ.js +0 -1
- package/dist/preview/chunk.PHKSMUIA.js +0 -1
- package/dist/preview/chunk.SHTJZ6UX.js +0 -1
- package/dist/preview/chunk.TCNBCTWO.js +0 -1
- package/dist/preview/chunk.WAZ7OGBD.js +0 -1
- package/dist/preview/chunk.XANVHJQ4.js +0 -1
- package/dist/preview/chunk.XKABS745.js +0 -1
- package/dist/preview/chunk.XMC7YDWT.js +0 -1
- package/dist/preview/chunk.Y6ZNFQK3.js +0 -6
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{q as re}from"./chunk.DAZ2VSRD.js";import{a as j,b as C,c as J,d as te,e as ne,f as R,g as ie,i as ae,l as oe}from"./chunk.AKFKM4SW.js";import{a as X,b as Z,c as ee}from"./chunk.XANVHJQ4.js";import"./chunk.OKRNJXTV.js";import"./chunk.CAVBSL27.js";import{a as _}from"./chunk.5UL7YDUD.js";import"./chunk.UT6642FC.js";import"./chunk.TI4OSTQV.js";import"./chunk.PBSMLINK.js";import"./chunk.B2GLDIAS.js";import"./chunk.6YCBYL2Y.js";import"./chunk.UGFJKSHU.js";import{m as V}from"./chunk.JOOQUWLT.js";import{F as ge,I as Q,Q as Y,Y as U}from"./chunk.6QWV5MVH.js";import{$ as N,ec as B}from"./chunk.MNP4JI33.js";import{b as L}from"./chunk.AJZBJBMO.js";var a=L(ge(),1);var l=L(Y(),1),fe=new Set(["show","go","to","open","the","a","an","me"]),de=o=>o.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,""),D=(o,c)=>{let r=de(o);return c.every(t=>r.includes(t))},se=o=>o&&`${o[0].toLowerCase()}${o.slice(1)}`,I={act:4,show:3,place:3,record:4},he=360,h=12;function Ie({face:o,opening:c,close:r}){let t=_(),{setMenuAt:y}=U(),i=(0,a.useMemo)(()=>c.target??j(c.pointed??{about:[]},e=>t.store.graph.has(e)),[c,t.store]),g=(0,a.useMemo)(()=>te(t.store,i,t.places),[t.store,i,t.places]),[p,v]=(0,a.useState)(""),[b,m]=(0,a.useState)(-1),[s,E]=(0,a.useState)(null),[A,P]=(0,a.useState)(null),T=(0,a.useRef)(null),O=(0,a.useRef)(null),M=(0,a.useId)(),W=(0,a.useRef)(!0),{ghost:z}=Q(t.desk);(0,a.useEffect)(()=>()=>{W.current=!1;let e=t.desk.get().ghost;e?.onCard&&t.desk.setGhost({...e,onCard:!1})},[t.desk]);let $=(0,a.useMemo)(()=>{let e=R(t,i);return J(t.store,i,{principal:t.principal,places:t.places,...e.acts?{acts:e.acts}:{}})},[t,i]),G=(0,a.useMemo)(()=>{let e=C(i);if(e.length===0)return[];let n=new Set($.candidates.flatMap(d=>d.type==="act"?[d.mutation]:[]));return X(t.store,e,{principal:t.principal,...e.length===1?{focus:e[0]}:{}}).affordances.filter(d=>!d.destructive&&n.has(d.mutation))},[t.store,t.principal,i,$]),q=(0,a.useCallback)(()=>{let e=c.returnTo,n=le(T.current,i,o);r(),requestAnimationFrame(()=>{if(e?.isConnected&&!e.closest("[inert]"))return e.focus({preventScroll:!0});let d=(n&&n.tabIndex>=0?n:null)??document.querySelector("[data-graview-page-title]")??document.querySelector("main");d&&d.tabIndex<0&&!d.hasAttribute("tabindex")&&d.setAttribute("tabindex","-1"),d?.focus({preventScroll:!0})})},[c.returnTo,i,o,r]),K=(0,a.useCallback)(e=>{if(e.open.length>0){let n=T.current?.getBoundingClientRect();r(),y({x:n?.left??0,y:n?.top??0,on:e.args.id??C(i)[0],about:C(i)});return}try{ee(t.store,e,{}),Z(t.store,e,{},{author:t.principal}),q()}catch(n){P(n instanceof Error?n.message:String(n))}},[t.store,t.principal,r,q,y,i]),H=(0,a.useCallback)(async e=>{let n=e.trim();if(!n)return;let d=s?.result?.answer?{said:s.said,answer:s.result.answer}:void 0;v(""),m(-1),P(null),E({said:n,result:null});let S=await ne(t.ai,{...R(t,i,n),said:n,...d?{follows:d}:{}});t.desk.record(S.interaction),S.ghost&&S.ghost.proposals.length>0&&t.desk.setGhost({ghost:S.ghost,onCard:!0}),W.current&&E({said:n,result:S})},[s,t,i]),F=(0,a.useRef)(c.asked);(0,a.useEffect)(()=>{let e=F.current;F.current=void 0,e&&H(e)},[]);let k=(0,a.useMemo)(()=>{let e=p.trim();if(!e&&s)return[];let n=de(e).split(/\s+/).filter(f=>f&&!fe.has(f)),d=/^show\b/i.test(e),S=/^(go|open)\b/i.test(e),x=[];if(!d&&!S)for(let f of G.filter(u=>D(u.label,n)).slice(0,I.act))x.push({id:`act:${f.id}`,kind:"act",label:f.label,hint:f.open.length>0?"asks more":"do it",take:()=>K(f)});if(!S){let f=$.candidates.filter(u=>u.type==="panel");for(let u of f.filter(ue=>D(`show ${ue.label}`,n)).slice(0,I.show))x.push({id:u.id,kind:"show",label:`Show ${se(u.label)}`,hint:"a panel",take:()=>{r(),ie(t,{title:u.label,recipe:{...u.panel,title:u.label}})}})}if(!d){for(let f of t.places.filter(u=>D(u.title,n)).slice(0,I.place))x.push({id:`place:${f.as}`,kind:"place",label:`Go to ${f.title}`,take:()=>(r(),t.goTo.place(f.as))});if(n.length>0){let f=re(t.store,e.replace(/^(go to|open)\s+/i,""),{principal:t.principal,from:C(i),limit:I.record}).hits;for(let u of f)u.about==="node"&&x.push({id:`record:${u.id}`,kind:"record",label:u.label,hint:N(t.store.schema,u.kind),take:()=>(r(),t.goTo.record(u.id))})}}return e&&x.push({id:"ask",kind:"ask",label:e,take:()=>void H(e)}),x},[p,G,$,t,i,K,H,r,s]);(0,a.useEffect)(()=>m(p.trim()?0:-1),[p]),(0,a.useLayoutEffect)(()=>{let e=T.current;if(!e)return;if(typeof e.showPopover=="function")try{e.showPopover()}catch{}O.current?.focus({preventScroll:!0});let n=0,d=()=>{me(e,le(e,i,o)),n=requestAnimationFrame(d)};return d(),()=>cancelAnimationFrame(n)},[i,o]),(0,a.useEffect)(()=>{if(s)return;let e=n=>{n.target instanceof Node&&T.current?.contains(n.target)||r()};return document.addEventListener("pointerdown",e,!0),()=>document.removeEventListener("pointerdown",e,!0)},[s,r]);let ce=e=>{if(e.key==="ArrowDown"&&k.length>0)e.preventDefault(),m(n=>Math.min(k.length-1,n+1));else if(e.key==="ArrowUp"&&k.length>0)e.preventDefault(),m(n=>Math.max(0,n-1));else if(e.key==="Enter"){e.preventDefault();let n=k[b];n?n.take():p.trim()&&H(p)}},w=s?.result??null,pe=k[b];return(0,l.jsxs)("section",{ref:T,popover:"manual",role:"region","aria-label":s?`Answer about ${g}`:`Ask about ${g}`,"data-testid":"quick-ask","data-quick-ask":s?"answer":"bar","data-quick-ask-face":o,"data-graview-offstage":"","data-graview-overlay":"",onKeyDown:e=>{e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),q())},onMouseDown:e=>e.stopPropagation(),style:ke,children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[(0,l.jsxs)("p",{"data-testid":"quick-ask-about",style:{margin:0,flex:"1 1 auto",minWidth:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)",overflowWrap:"anywhere"},children:["About ",g]}),(0,l.jsx)("button",{type:"button","data-testid":"quick-ask-close","aria-label":"Close",title:"Close",onClick:q,style:we,children:(0,l.jsx)("span",{"aria-hidden":"true",children:"\u2715"})})]}),s?(0,l.jsxs)("div",{"data-testid":"quick-answer",style:{display:"grid",gap:8},children:[(0,l.jsxs)("p",{"data-testid":"quick-answer-asked",style:{margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",fontStyle:"italic",overflowWrap:"anywhere"},children:["\u201C",s.said,"\u201D"]}),(0,l.jsx)("p",{"data-testid":"quick-answer-text","aria-live":"polite",style:{margin:0,fontSize:"0.9375rem",lineHeight:1.45,color:w?.interaction.outcome==="failed"?"var(--graview-warn)":"var(--graview-ink)",overflowWrap:"anywhere"},children:w===null?"Thinking\u2026":w.interaction.outcome==="failed"?w.interaction.failed??"The AI could not answer that here.":w.answer??""}),w&&w.offers.length>0?(0,l.jsx)("ul",{"aria-label":"What acts on it",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:6},children:w.offers.map(e=>(0,l.jsx)("li",{children:(0,l.jsx)("button",{type:"button","data-testid":"quick-answer-offer","data-ai-offer":e.id,"data-ai-offer-type":e.type,onClick:()=>{r(),ae(t,w,e)},style:ve,children:e.type==="panel"?`Show ${se(e.label)}`:e.type==="place"?`Go to ${e.label}`:e.label})},e.id))}):null,z?.onCard&&z.ghost.interaction===w?.interaction.id?(0,l.jsx)(oe,{placement:"card"}):null]}):null,(0,l.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,l.jsx)("input",{ref:O,type:"text",role:"combobox","data-testid":"quick-ask-input","aria-label":s?`Ask a follow-up about ${g}`:`Ask about ${g}, or go somewhere`,"aria-expanded":k.length>0,"aria-controls":M,"aria-autocomplete":"list",...pe?{"aria-activedescendant":`${M}-${b}`}:{},autoComplete:"off",enterKeyHint:"go",placeholder:s?"Ask a follow-up\u2026":"Ask, or go to\u2026",value:p,readOnly:s!==null&&w===null,"aria-busy":s!==null&&w===null,onChange:e=>v(e.target.value),onKeyDown:ce,style:be}),(0,l.jsx)("div",{id:M,role:"listbox","aria-label":p.trim()?`What \u201C${p.trim()}\u201D finds here`:"What can be done here",hidden:k.length===0,style:{display:k.length===0?"none":"grid",gap:1,maxHeight:280,overflowY:"auto"},children:k.map((e,n)=>(0,l.jsx)("div",{id:`${M}-${n}`,role:"option","aria-selected":n===b,"data-testid":"quick-ask-option","data-quick-ask-kind":e.kind,"data-quick-ask-row":e.id,onMouseEnter:()=>m(n),onMouseDown:d=>d.preventDefault(),onClick:e.take,style:{...ye,background:n===b?"var(--graview-panel-muted)":"transparent",...e.kind==="ask"?{borderTop:"1px solid var(--graview-edge)",marginTop:2}:{}},children:e.kind==="ask"?(0,l.jsxs)("span",{children:["Ask: ",(0,l.jsxs)("span",{style:{fontWeight:600},children:["\u2018",e.label,"\u2019"]})]}):(0,l.jsxs)("span",{children:[e.label,e.hint?(0,l.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",e.hint]}):null]})},e.id))})]}),A?(0,l.jsx)("p",{role:"alert","data-testid":"quick-ask-refused",style:{margin:0,fontSize:"0.8125rem",color:"var(--graview-warn)"},children:A}):null,(0,l.jsx)("span",{style:V,"aria-live":"polite",children:k.length>0&&p.trim()?`${k.length} ${k.length===1?"way":"ways"} to go on`:""})]})}function le(o,c,r){let t=o?.closest("[data-graview-embed]")??document,y=c.on==="list"?[`aggregate:${c.kind}`,`kind:${c.kind}`]:c.on==="lens"&&c.kind?[`aggregate:${c.kind}`]:C(c);for(let i of y)for(let g of t.querySelectorAll(`[data-graview-view="${CSS.escape(i)}"], [data-graview-pick="${CSS.escape(i)}"]`)){if(o?.contains(g))continue;let p=g.getBoundingClientRect();if(p.width>0&&p.height>0)return g}return r==="pages"?t.querySelector("main [data-graview-page-title]")??t.querySelector("main h1"):null}function me(o,c){let r={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},t=Math.min(he,r.width-2*h),y=o.getBoundingClientRect().height,i=c?.getBoundingClientRect(),g,p,v,b=A=>Math.max(h,Math.min(A,r.height-y-h));if(i&&i.width>0&&i.bottom>0&&i.top<r.height)if(i.right+h+t<=r.width-h)g=i.right+h,p=b(i.top),v="right";else if(i.left-h-t>=h)g=i.left-h-t,p=b(i.top),v="left";else{g=Math.max(h,Math.min(i.left,r.width-t-h));let A=i.bottom+h;p=A+y<=r.height-h?A:b(i.top-h-y),v=A+y<=r.height-h?"below":"above"}else g=(r.width-t)/2,p=b(72),v="top";let m=o.style,s={left:`${Math.round(g)}px`,top:`${Math.round(p)}px`,width:`${Math.round(t)}px`};m.left!==s.left&&(m.left=s.left),m.top!==s.top&&(m.top=s.top),m.width!==s.width&&(m.width=s.width);let E=c?.getAttribute("data-graview-view")??c?.getAttribute("data-graview-pick")??(c?"page":"");o.getAttribute("data-quick-ask-beside")!==E&&o.setAttribute("data-quick-ask-beside",E),o.getAttribute("data-quick-ask-side")!==v&&o.setAttribute("data-quick-ask-side",v)}var ke={position:"fixed",inset:"auto",margin:0,zIndex:B("popover"),boxSizing:"border-box",display:"grid",gap:10,padding:12,borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",maxHeight:"calc(100dvh - 24px)",overflowY:"auto",fontSize:"0.875rem"},we={display:"inline-grid",placeItems:"center",width:28,height:28,padding:0,font:"inherit",fontSize:"0.875rem",lineHeight:1,color:"var(--graview-ink-muted)",background:"transparent",border:"1px solid transparent",borderRadius:6,boxShadow:"none",cursor:"pointer"},be={boxSizing:"border-box",width:"100%",height:36,padding:"0 10px",font:"inherit",fontSize:"max(1rem,16px)",color:"var(--graview-ink)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:8},ye={display:"flex",alignItems:"center",minHeight:30,padding:"4px 8px",borderRadius:6,cursor:"pointer",overflowWrap:"anywhere"},ve={display:"inline-flex",alignItems:"center",minHeight:30,padding:"2px 10px",font:"inherit",fontSize:"0.8125rem",borderRadius:8};export{Ie as QuickAskCard};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as n}from"./chunk.NRAYZY3X.js";import"./chunk.RIJUCHP4.js";import"./chunk.TAQ764IQ.js";import"./chunk.YIR7PPF3.js";import"./chunk.3HXN4BOY.js";import"./chunk.GYICGZMG.js";import"./chunk.47STJVRV.js";import"./chunk.EBGAYL32.js";import"./chunk.DAZ2VSRD.js";import"./chunk.CWHRDBOF.js";import"./chunk.3K6YSVHC.js";import"./chunk.SHTJZ6UX.js";import"./chunk.WVUJXDXZ.js";import{d as p}from"./chunk.ULRW47RP.js";import"./chunk.PBSMLINK.js";import"./chunk.3TY5NFLY.js";import"./chunk.D75KC3LL.js";import"./chunk.FWTIUYXH.js";import"./chunk.MAF7C3VM.js";import"./chunk.GZHZLJBF.js";import"./chunk.XMC7YDWT.js";import"./chunk.6UGEYZAC.js";import"./chunk.OJGHDWI6.js";import"./chunk.B2GLDIAS.js";import"./chunk.6YCBYL2Y.js";import"./chunk.UGFJKSHU.js";import"./chunk.JOOQUWLT.js";import{Q as m}from"./chunk.6QWV5MVH.js";import"./chunk.MNP4JI33.js";import{b as t}from"./chunk.AJZBJBMO.js";var i=t(m(),1),a=new WeakMap;function s(o){let e=a.get(o);if(!e){let r=p(o);e=c=>c.mode==="fullscreen"?(0,i.jsx)(n,{blocks:r,slot:"home",heading:2,firstHeading:1}):(0,i.jsx)(n,{blocks:r,slot:"home",heading:3,firstHeading:2}),a.set(o,e)}return e}export{s as homeView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{F as k,Q as n,a as t,xa as o}from"./chunk.6QWV5MVH.js";import{b as p}from"./chunk.AJZBJBMO.js";var f=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.ULRW47RP.js","./chunk.PBSMLINK.js","./chunk.3TY5NFLY.js","./chunk.D75KC3LL.js","./chunk.FWTIUYXH.js","./chunk.MAF7C3VM.js","./chunk.GZHZLJBF.js","./chunk.XMC7YDWT.js","./chunk.6UGEYZAC.js","./chunk.OJGHDWI6.js","./chunk.B2GLDIAS.js","./chunk.6YCBYL2Y.js","./chunk.UGFJKSHU.js","./chunk.JOOQUWLT.js","./chunk.6QWV5MVH.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.CIPS2OGR.js")))),y=f.part((e,r)=>e.drawFiles(r),{quiet:!0});var d=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.GZHZLJBF.js","./chunk.XMC7YDWT.js","./chunk.6UGEYZAC.js","./chunk.OJGHDWI6.js","./chunk.B2GLDIAS.js","./chunk.6YCBYL2Y.js","./chunk.UGFJKSHU.js","./chunk.JOOQUWLT.js","./chunk.6QWV5MVH.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.LXBOVRFI.js")))),I=d.part((e,r)=>e.drawLinkedRecord(r),{quiet:!0}),w=d.part((e,r)=>e.drawLinkedPicker(r),{what:"Picking a linked record"});var s=p(n(),1),m=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.GZHZLJBF.js","./chunk.XMC7YDWT.js","./chunk.6UGEYZAC.js","./chunk.OJGHDWI6.js","./chunk.B2GLDIAS.js","./chunk.6YCBYL2Y.js","./chunk.UGFJKSHU.js","./chunk.JOOQUWLT.js","./chunk.6QWV5MVH.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.4MERAWS2.js")))),E=m.part((e,r)=>(0,s.jsx)(e.RepeatPicker,{...r}),{quiet:!0}),W=m.part((e,r)=>(0,s.jsx)(e.RepeatEditor,{...r}),{quiet:!0});var a=p(k(),1),i=p(n(),1),c=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.B2GLDIAS.js","./chunk.6YCBYL2Y.js","./chunk.UGFJKSHU.js","./chunk.JOOQUWLT.js","./chunk.6QWV5MVH.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.QVVJRSRM.js")))),l=c.part((e,r)=>(0,i.jsx)(e.WhenInput,{...r}),{quiet:!0});function M(e){return(0,i.jsx)(a.Suspense,{fallback:(0,i.jsx)("span",{"data-graview-when-arriving":"",style:{display:"inline-block",minHeight:24}}),children:(0,i.jsx)(l,{...e})})}var N=()=>c.load().then(()=>{},()=>{});export{y as a,I as b,w as c,E as d,W as e,M as f,N as g};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as l,K as p,R as k,S as y,c}from"./chunk.NM6MZYFN.js";import"./chunk.63GXY2ME.js";import"./chunk.UGFDSE37.js";import{b as m}from"./chunk.FSTCX2AI.js";import"./chunk.Y6ZNFQK3.js";import"./chunk.NRAYZY3X.js";import"./chunk.RIJUCHP4.js";import"./chunk.TAQ764IQ.js";import"./chunk.YIR7PPF3.js";import"./chunk.3HXN4BOY.js";import"./chunk.GYICGZMG.js";import"./chunk.UHUGOTUU.js";import"./chunk.47STJVRV.js";import"./chunk.EBGAYL32.js";import"./chunk.DAZ2VSRD.js";import"./chunk.J25KOSNW.js";import"./chunk.LR3VDXPI.js";import"./chunk.CWHRDBOF.js";import"./chunk.3K6YSVHC.js";import"./chunk.SHTJZ6UX.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.ULRW47RP.js";import"./chunk.PBSMLINK.js";import"./chunk.3TY5NFLY.js";import"./chunk.D75KC3LL.js";import"./chunk.FWTIUYXH.js";import"./chunk.MAF7C3VM.js";import"./chunk.GZHZLJBF.js";import"./chunk.XMC7YDWT.js";import"./chunk.6UGEYZAC.js";import"./chunk.OJGHDWI6.js";import"./chunk.B2GLDIAS.js";import"./chunk.6YCBYL2Y.js";import"./chunk.UGFJKSHU.js";import"./chunk.JOOQUWLT.js";import{F as S,G as s,H as d,Q as f,Z as g}from"./chunk.6QWV5MVH.js";import"./chunk.MNP4JI33.js";import{b as n}from"./chunk.AJZBJBMO.js";var u=n(S(),1);var t=n(f(),1);function D({context:a}){let r=l(),h=g(),[w]=(0,u.useState)(()=>s(null)),o=d(h?.seatTalk??w),P=()=>{(window.history.state?.idx??0)>0?r(-1):r("/")};return(0,t.jsxs)(k,{context:a,"data-testid":"draft-page",children:[(0,t.jsx)(y,{context:a,...o.draft?{"data-testid":"draft-title"}:{},children:o.draft?o.draft.title:"Nothing drawn"}),o.draft?(0,t.jsx)(m,{page:!0,go:e=>r(e.address),onPick:e=>{let i=a.store.graph.getNode(e);i&&r(c(a.store.schema,i.kind,e))},onDiscard:P}):(0,t.jsxs)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:["Ask for a way of seeing \u2014 \u201Ca board of tasks by status\u201D \u2014 and it is drawn here."," ",(0,t.jsx)(p,{to:"/",style:{color:"var(--graview-accent)"},children:"Home \u2192"})]})]})}export{D as DraftPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as c,b as d,c as e,d as f,e as g,f as h,g as i,h as j,i as k,j as l,k as m,l as n,m as o,n as p}from"./chunk.UHUGOTUU.js";import{a,b}from"./chunk.47STJVRV.js";import"./chunk.EBGAYL32.js";import"./chunk.DAZ2VSRD.js";import"./chunk.B2GLDIAS.js";import"./chunk.6YCBYL2Y.js";import"./chunk.UGFJKSHU.js";import"./chunk.JOOQUWLT.js";import"./chunk.6QWV5MVH.js";import"./chunk.MNP4JI33.js";import"./chunk.AJZBJBMO.js";export{j as ARRANGE_NARROW,o as ArrangeBar,e as CHIP_FIELDS,d as MANY_AT_THE_FAR_END,c as TYPED_FROM,p as arrangementCaption,a as arrangementOf,i as chipOffers,m as directionWords,g as farCount,f as farCounts,l as inSentence,h as offeredFilters,n as preloadArrangeLists,k as sayCondition,b as withArrangement};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as sn,c as on}from"./chunk.UT6642FC.js";import{e as j}from"./chunk.B2GLDIAS.js";import{c as J}from"./chunk.UGFJKSHU.js";import{$ as nn,Gb as G,Jb as q,Ma as B,X as D,Y as M,Z as z,_ as Y,ca as en,da as F,ea as _,vb as tn,wb as R}from"./chunk.MNP4JI33.js";function rn(){return{name:"insight",derive({store:n,nodes:i,kindSelection:t}){let g=[],b=l=>D(n.schema.tryDefinition(l.kind),l);for(let l of i){if([...n.schema.edgeKinds].reduce((y,c)=>y+n.graph.out(l.id,c).length+n.graph.in(l.id,c).length,0)===0){g.push({id:`insight:island:${l.id}`,text:`${b(l)} is connected to nothing yet`,nodeIds:[l.id]});continue}for(let y of n.schema.edgeKinds){let c=n.graph.in(l.id,y).length;if(c<3)continue;let r=[...n.graph.allEdges()].filter(s=>s.kind===y),e=r.length;e>=4&&c/e>.6&&g.push({id:`insight:load:${l.id}:${y}`,text:`${b(l)} ${mn(n,r,y,c)}`,nodeIds:[l.id]})}}for(let l of t){if(n.graph.nodesOfKind(l).length>0)continue;let A=n.schema.definitions.filter(y=>y.kind!==l).filter(y=>Object.values(y.edges).some(c=>c.to!=="*"&&c.to.includes(l))).map(y=>y.plural??`${y.kind}s`);A.length>0&&g.push({id:`insight:gap:${l}`,text:`Nothing here yet, though ${A.join(" and ")} expect to connect to these`,nodeIds:[]})}return{observations:g}}}}function mn(n,i,t,g){let b=new Set(i.map(r=>n.graph.getNode(r.from)?.kind).filter(r=>r!==void 0)),l=b.size===1?[...b][0]:void 0,A=i.length,y=J(n.schema,l??[...b][0]??"",t,"in"),c=r=>l?Y(n.schema,l,r):String(r);return g===A?`${y}: all ${c(g)}`:`${y}: ${g} of the ${c(A)}`}function an(n){let i=new Map;if(n.length===0)return i;let t=n.slice(-512),g=new Set;for(let l of t)l.undoes&&g.add(l.undoes);let b=n[n.length-1].seq;for(let l of t){if(!l.mutation||g.has(l.id))continue;let A=Math.pow(.5,(b-l.seq)/64);i.set(l.mutation.name,(i.get(l.mutation.name)??0)+A)}return i}function dn(n){return 8*(n/(n+1))}var pn=100;function cn(){return{name:"invariant",derive({store:n,selection:i,nodes:t,violations:g}){let b=r=>D(n.schema.tryDefinition(r.kind),r),l=new Set(i),A=g.filter(r=>r.nodeIds.some(e=>l.has(e))||r.subjectId!==void 0&&l.has(r.subjectId)),y=[],c=[];A.forEach((r,e)=>{c.push({id:`violation:${r.invariant}:${e}`,text:r.message,nodeIds:r.nodeIds}),r.repairs.forEach((s,f)=>{y.push({id:`invariant:${r.invariant}:${e}:${f}`,label:s.label,provider:"invariant",mutation:s.mutation,args:s.args??{},open:(s.missing??[]).map(v=>{let u=n.allMutations().find(p=>p.name===s.mutation);if(!u)return{name:v};let a=R(u.input).find(p=>p.name===v),m=a?a.kinds.includes("*")?n.graph.allNodes().map(p=>p.id):a.kinds.flatMap(p=>n.graph.nodesOfKind(p).map($=>$.id)):void 0;return{name:v,shape:j(u.input,v),...a?{kinds:a.kinds}:{},...m?{candidates:m}:{}}}),score:pn-f-(s.missing?.length??0),why:r.message,nodeIds:r.nodeIds,...r.subjectId===void 0?{}:{subjectId:r.subjectId}})})});for(let r of t){let e=n.allInvariants().filter(s=>{if(s.scope==="graph")return!1;let f=s.scope;return f.kind!==r.kind?!1:f.match?f.match(r):!0});e.length!==0&&(A.some(s=>s.subjectId===r.id||s.nodeIds.includes(r.id))||c.push({id:`holds:${r.id}`,text:`${b(r)} holds \u2014 nothing currently breaks ${e.length===1?"it":`any of its ${e.length} rules`}`,nodeIds:[r.id]}))}return{affordances:y,observations:c}}}}var H=40;function un(){return{name:"schema",derive({store:n,selection:i,nodes:t,kindSelection:g,edgeSelection:b,principal:l}){let A=(e,s)=>l!==void 0&&!n.permits({name:e,args:s},l).ok,y=[];if(t.length===0&&b.length>0){for(let e of b){let s=n.graph.getNode(e.from),f=n.graph.getNode(e.to);if(!s||!f)continue;let v=on(n,e);v?.provisional&&y.push({id:`schema:edge:${G}:${e.kind}:${e.from}:${e.to}`,label:"Keep this link",provider:"schema",mutation:G,args:{kind:e.kind,from:e.from,to:e.to},open:[],score:64,why:sn(v),nodeIds:[e.from,e.to]});for(let u of n.allMutations()){let a=(u.connects??[]).includes(e.kind),m=(u.severs??[]).includes(e.kind);if(!a&&!m)continue;let p={},$=[],I=R(u.input);for(let d of I){let S=d.kinds.includes("*")||d.kinds.includes(s.kind),O=d.kinds.includes("*")||d.kinds.includes(f.kind),k=S&&!I.some(P=>P!==d&&(P.kinds.includes(s.kind)||P.kinds.includes("*")));S&&!O?p[d.name]=e.from:O&&!S?p[d.name]=e.to:S&&O&&k?p[d.name]=e.from:$.push({name:d.name,kinds:d.kinds,candidates:[e.from,e.to],shape:j(u.input,d.name)})}for(let d of T(u.input,""))d in p||$.some(S=>S.name===d)||$.push({name:d,shape:j(u.input,d)});$.every(d=>d.optional===!0?!0:d.kinds!==void 0?(d.candidates?.length??0)>0:(d.candidates?.length??0)>0||d.shape!==void 0&&d.shape.type!=="unknown")&&(a&&!m&&$.length===0||y.push({id:`schema:edge:${u.name}:${e.kind}:${e.from}:${e.to}`,label:M(u),provider:"schema",mutation:u.name,args:p,open:$,...u.destructive?{destructive:!0}:{},score:(m?62:58)-$.length,why:`this line is "${J(n.schema,n.graph.getNode(e.from)?.kind??"",e.kind,"out")}"`,nodeIds:[e.from,e.to]}))}}return{affordances:y}}if(t.length===0&&g.length>0){let e=new Set(g),s=[];for(let f of n.allMutations()){if(!(f.creates??[]).some(a=>e.has(a)))continue;let v=[];for(let a of R(f.input)){let m=a.kinds.includes("*")?n.graph.allNodes().map(p=>p.id):a.kinds.flatMap(p=>n.graph.nodesOfKind(p).map($=>$.id));v.push({name:a.name,kinds:a.kinds,candidates:m,shape:j(f.input,a.name),...a.optional?{optional:!0}:{}})}for(let a of T(f.input,""))v.some(m=>m.name===a)||v.push({name:a,shape:j(f.input,a)});if(!v.every(a=>a.optional===!0?!0:a.kinds!==void 0?(a.candidates?.length??0)>0:(a.candidates?.length??0)>0||a.shape!==void 0&&a.shape.type!=="unknown")&&!A(f.name,{})){let a=v.filter(m=>m.optional!==!0&&m.kinds!==void 0&&!m.kinds.includes("*")&&(m.candidates?.length??0)===0);if(a.length>0){let m=[...new Set(a.flatMap(p=>p.kinds??[]))].map(p=>F(_(n.schema.tryDefinition(p),p)));s.push({id:`schema:waits:${f.name}`,text:`"${f.title??f.name}" cannot begin until there is ${m.length===1?m[0]:`${m.slice(0,-1).join(", ")} and ${m[m.length-1]}`}.`,nodeIds:[]})}continue}y.push({id:`schema:add:${f.name}`,label:M(f),provider:"schema",mutation:f.name,args:{},open:v,score:H-v.length,why:`this makes ${(f.creates??[]).filter(a=>e.has(a)).map(a=>F(_(n.schema.tryDefinition(a),a))).join(", ")}`,nodeIds:[]})}return{affordances:y,observations:s}}if(t.length===0)return{};let c=new Set(t.map(e=>e.kind)),r=(e,s,f)=>{let v=[];for(let u of n.graph.allEdges()){if(!s.includes(u.kind))continue;let a=u.from===e?u.to:u.to===e?u.from:null;if(!a)continue;let m=n.graph.getNode(a);m&&(!f.includes("*")&&!f.includes(m.kind)||v.includes(a)||v.push(a))}return v};for(let e of n.allMutations()){let s=e.subject;if(!s||!(s.kinds==="*"?!0:[...c].every(h=>s.kinds.includes(h))))continue;let v=e.derived?.act;if((v==="archive"||v==="merge")&&t.some(h=>B(h))||v==="unarchive"&&!t.some(h=>B(h))||v==="leave-alone"&&t.every(h=>q(n,h.id))||v==="allow-tidying"&&!t.some(h=>q(n,h.id)))continue;let u=t.length===1?t[0].id:null,a=e.severs??[],m=e.connects??[];if(u&&a.length>0&&m.length===0&&r(u,a,["*"]).length===0)continue;let p=[];for(let h of R(e.input)){if(h.name===s.arg)continue;let d=h.kinds.includes("*")?n.graph.allNodes().map(S=>S.id):h.kinds.flatMap(S=>n.graph.nodesOfKind(S).map(O=>O.id));if(u&&m.length>0){let S=new Set(r(u,m,h.kinds));d=d.filter(O=>!S.has(O))}else u&&a.length>0&&(d=r(u,a,h.kinds));p.push({name:h.name,kinds:h.kinds,candidates:d.filter(S=>!i.includes(S)),shape:j(e.input,h.name),...h.optional?{optional:!0}:{}})}for(let h of T(e.input,s.arg))p.some(d=>d.name===h)||p.push({name:h,shape:j(e.input,h)});if(p.length===0&&u){let h=kn(e.input,s.arg);if(h.length>0&&!yn(n,e.name,{[s.arg]:u}))for(let d of h){let S=R(e.input).find(O=>O.name===d);p.push({name:d,optional:!0,...S?{kinds:S.kinds}:{},shape:j(e.input,d)})}}if(!p.every(h=>h.optional===!0?!0:h.kinds!==void 0?(h.candidates?.length??0)>0:(h.candidates?.length??0)>0||h.shape!==void 0&&h.shape.type!=="unknown")&&!A(e.name,u?{[s.arg]:u}:{}))continue;let I=t.map(h=>({[s.arg]:h.id}));p.length===0&&!I.some(h=>n.wouldChange({name:e.name,args:h}))||y.push({id:`schema:${e.name}`,label:t.length>1?`${M(e)} (${t.length})`:M(e),provider:"schema",mutation:e.name,args:I[0]??{},open:p,...e.destructive?{destructive:!0}:{},...e.derived?.act==="archive"||e.derived?.act==="merge"||e.derived?.act==="leave-alone"||e.derived?.act==="allow-tidying"?{setsAside:!0}:{},...a.length>0||m.length>0?{ties:!0}:{},...t.length>1?{batch:I}:{},score:H-p.length,why:t.length>1?`all ${t.length} selected nodes are ${[...c].map(h=>nn(n.schema,h).toLowerCase()).join(" or ")}`:`this is ${F(_(n.schema.tryDefinition(t[0].kind),t[0].kind))}`,nodeIds:t.map(h=>h.id)})}if(t.length===1){let e=t[0];for(let s of n.allMutations()){let f=s.subject,v=s.severs??[],u=s.connects??[];if(!f||v.length===0&&u.length===0)continue;let a=f.kinds==="*"?"*":f.kinds;if(a==="*"||a.includes(e.kind))continue;let m=R(s.input),p=m.find(k=>k.name!==f.arg&&(k.kinds.includes("*")||k.kinds.includes(e.kind)));if(!p)continue;let $=a,I=$.includes("*")?n.graph.allNodes().map(k=>k.id):$.flatMap(k=>n.graph.nodesOfKind(k).map(P=>P.id)),h=new Set(r(e.id,u.length>0?u:v,$)),d=u.length>0?I.filter(k=>!h.has(k)):I.filter(k=>h.has(k));if(d.length===0)continue;let S=[{name:f.arg,kinds:$,candidates:d,shape:j(s.input,f.arg)}];for(let k of m){if(k.name===p.name||k.name===f.arg)continue;let P=k.kinds.includes("*")?n.graph.allNodes().map(N=>N.id):k.kinds.flatMap(N=>n.graph.nodesOfKind(N).map(E=>E.id));S.push({name:k.name,kinds:k.kinds,candidates:P,shape:j(s.input,k.name),...k.optional?{optional:!0}:{}})}for(let k of T(s.input,p.name))k===f.arg||S.some(P=>P.name===k)||S.push({name:k,shape:j(s.input,k)});S.every(k=>k.optional===!0?!0:k.kinds!==void 0?(k.candidates?.length??0)>0:(k.candidates?.length??0)>0||k.shape!==void 0&&k.shape.type!=="unknown")&&y.push({id:`schema:tie:${s.name}:${e.id}`,label:s.fromTheOtherEnd??M(s),provider:"schema",mutation:s.name,args:{[p.name]:e.id},open:S,ties:!0,...s.destructive?{destructive:!0}:{},score:H-S.length+2,why:`${v.length>0?"this one is on":"this one could join"} ${S[0].candidates.length===1?"it":"one of these"}`,nodeIds:[e.id]})}}return{affordances:y}}}}function kn(n,i){let t=n.shape;return t?Object.entries(t).filter(([g,b])=>g!==i&&b.safeParse(void 0).success).map(([g])=>g):[]}function yn(n,i,t){try{return n.preview({name:i,args:t}),!0}catch{return!1}}function T(n,i){let t=n.shape;return t?Object.entries(t).filter(([g,b])=>g!==i&&!b.safeParse(void 0).success).map(([g])=>g):[]}var vn=70,bn=80,Sn=new Set(["id","kind"]);function fn(){return{name:"structure",derive({store:n,nodes:i}){let t=c=>D(n.schema.tryDefinition(c.kind),c);if(i.length<2)return{};let g=[],b=[],l=i.map(c=>c.id);for(let c of n.schema.edgeKinds){let r=wn(i.map(s=>new Set([...n.graph.out(s.id,c).map(f=>f.id),...n.graph.in(s.id,c).map(f=>f.id)])));for(let s of r){let f=n.graph.getNode(s);f&&g.push({id:`shared:${c}:${s}`,text:`all ${i.length} share "${t(f)}" (${z(c).toLowerCase()})`,nodeIds:[...l,s]})}let e=new Map;for(let s of i)for(let f of[...n.graph.out(s.id,c),...n.graph.in(s.id,c)])e.set(f.id,(e.get(f.id)??0)+1);for(let[s,f]of e){if(f!==i.length-1||i.length<3)continue;let v=n.graph.getNode(s);if(!v)continue;let u=i.find(a=>![...n.graph.out(a.id,c),...n.graph.in(a.id,c)].some(m=>m.id===s));if(u){g.push({id:`near-shared:${c}:${s}`,text:`all but "${t(u)}" share "${t(v)}" (${z(c).toLowerCase()})`,nodeIds:[...l,s]});for(let a of n.allMutations()){let m=a.subject;if(!m||m.kinds!=="*"&&!m.kinds.includes(u.kind))continue;let p=An(a.input,v.kind);p&&b.push({id:`structure:join:${a.name}:${u.id}:${s}`,label:`${M(a)}: bring "${t(u)}" in line with the others`,provider:"structure",mutation:a.name,args:{[m.arg]:u.id,[p]:s},open:[],score:vn,why:`every other selected node is connected to "${t(v)}"`,nodeIds:[u.id,s]})}}}}let A=new Set;for(let c of i)for(let r of Object.keys(c))Sn.has(r)||A.add(r);let y=c=>n.schema.definitions.find(r=>r.kind===c);for(let c of[...A].sort()){let r=y(i[0].kind),e=en(r,c).toLowerCase(),s=r?.display?.format?.[c],f=d=>{if(!s)return d;try{return String(s(JSON.parse(d)))}catch{return d}},v=i.map(d=>d[c]),u=new Map;if(v.forEach((d,S)=>{let O=JSON.stringify(d??null),k=u.get(O);k?k.push(i[S]):u.set(O,[i[S]])}),u.size===1){let d=[...u.keys()][0];if(d==="null")continue;g.push({id:`agree:${c}`,text:`all ${i.length} share the ${e} ${f(d)}`,nodeIds:l});continue}if(i.length<3||u.size!==2)continue;let a=[...u.entries()].sort((d,S)=>S[1].length-d[1].length),[m,p]=a[0],[,$]=a[1];if($.length!==1||m==="null")continue;let I=$[0],h=JSON.parse(m);g.push({id:`odd-one-out:${c}`,text:`${p.length} share the ${e} ${f(m)}; "${t(I)}" does not`,nodeIds:l});for(let d of n.allMutations()){let S=d.subject;if(!S||S.kinds!=="*"&&!S.kinds.includes(I.kind))continue;let O=ln(d.input);if(!O||!(c in O))continue;let k={[S.arg]:I.id,[c]:h},P=!0;for(let[N,E]of Object.entries(O)){if(N in k||E.safeParse(void 0).success)continue;let K=I[N];if(K===void 0){P=!1;break}k[N]=K}P&&b.push({id:`structure:align:${d.name}:${c}:${I.id}`,label:`Align the ${e} of "${t(I)}" with the other ${p.length}`,provider:"structure",mutation:d.name,args:k,open:[],score:bn,why:`${p.length} of ${i.length} share the ${e} ${f(m)}`,nodeIds:l})}}return{affordances:b,observations:g}}}}function wn(n){if(n.length===0)return[];let[i,...t]=n;return[...i].filter(g=>t.every(b=>b.has(g))).sort()}function ln(n){return n.shape??null}function An(n,i){let t=ln(n);if(!t)return null;for(let[g]of Object.entries(t)){let b=tn(t[g]);if(b&&(b.includes("*")||b.includes(i)))return g}return null}function $n(){return[cn(),fn(),un(),rn()]}function Zn(n,i,t={}){let g=hn(),b=t.providers??$n(),l=i.map(o=>n.graph.getNode(o)).filter(o=>o!==void 0),A={store:n,selection:i,nodes:l,kindSelection:t.kindSelection??[],edgeSelection:t.edgeSelection??[],violations:n.violations(t.context),context:t.context??{},principal:t.principal??{kind:"human"}},y=[],c=[];for(let o of b){let w=o.derive(A);y.push(...w.affordances??[]),c.push(...w.observations??[])}let r=new Set(n.allMutations().filter(o=>o.pinned).map(o=>o.name)),e=new Set(t.pins?.pinned??[]),s=new Set(t.pins?.unpinned??[]),f=o=>e.has(o.mutation)?"user":r.has(o.mutation)&&!s.has(o.mutation)?"declared":void 0,v=o=>{let w=f(o);return w?{...o,pinned:w}:o},u=new Map;for(let[o,w]of an(n.log.all()))u.set(o,dn(w));let a=o=>o.pinned==="user"?0:o.pinned==="declared"?1:2,m=o=>o.score+(u.get(o.mutation)??0),p=new Map(n.allMutations().map(o=>[o.name,o])),$=new Map,I=o=>{let w=p.get(o.mutation);if(!w)return[];let x=$.get(o.mutation);x||(x=R(w.input).map(L=>L.name),$.set(o.mutation,x));let C=[];for(let L of o.batch??[o.args])for(let U of x){let X=L[U]??o.args[U];typeof X=="string"&&C.push(X)}return C},h=t.focus,d=4,S=o=>o.open.length>0?1:0,O=o=>{if(h===void 0)return d;let w=I(o);return w.length>0?w.includes(h)?k(o,0):d:o.nodeIds.includes(h)||o.subjectId===h?k(o,1):d},k=(o,w)=>o.provider==="invariant"?w:2+S(o),P=o=>o.setsAside?1:0,N=On(y).map(v),E=new Map(N.map((o,w)=>[o,w])),K=N.sort((o,w)=>{let x=Number(o.destructive??!1)-Number(w.destructive??!1);if(x!==0)return x;let C=P(o)-P(w);if(C!==0)return C;let L=O(o)-O(w);return L!==0?L:O(o)<2?E.get(o)-E.get(w):+(w.provider==="invariant")-+(o.provider==="invariant")||a(o)-a(w)||m(w)-m(o)||o.id.localeCompare(w.id)}),Z=t.principal??{kind:"human"},W=[],V=[];for(let o of K){let w=n.permits({name:o.mutation,args:{...o.args,...o.batch?.[0]??{}}},Z);if(w.ok)W.push(o);else{let x=Pn(n,o,Z);if(x==="done")continue;x?W.push(x):V.push({...o,refusal:w.refusal})}}let Q=W.map((o,w)=>({...o,rank:w})),gn=V.map((o,w)=>({...o,rank:W.length+w}));return{affordances:t.limit===void 0?Q:Q.slice(0,t.limit),withheld:gn,observations:In(c),ms:hn()-g}}function On(n){let i=new Map;for(let t of n){let g=[t.mutation,JSON.stringify(t.args),JSON.stringify(t.batch??null)].join("|"),b=i.get(g);(!b||t.score>b.score)&&i.set(g,t)}return[...i.values()]}function In(n){let i=new Map;for(let t of n)i.set(t.text,t);return[...i.values()]}function hn(){return typeof performance<"u"?performance.now():Date.now()}function Vn(n,i,t={},g={}){let b=(i.batch??[i.args]).map(A=>({name:i.mutation,args:{...i.args,...A,...t}})),l=n.allMutations().find(A=>A.name===i.mutation);return n.applyAll(b,{...l?.describe?{}:{intent:i.label},...g.author?{author:g.author}:{}})}function Qn(n,i,t={}){return n.preview({name:i.mutation,args:{...i.args,...t}})}function Pn(n,i,t){let g=n.allMutations().find(r=>r.name===i.mutation)?.subject,b=g!==void 0&&i.args[g.arg]===void 0,l=b?i.open.find(r=>r.name===g.arg):i.open.find(r=>r.name!==g?.arg&&r.candidates);if(!l?.candidates)return;let A=r=>n.permits({name:i.mutation,args:{...i.args,...i.batch?.[0]??{},[l.name]:r}},t).ok,y=l.candidates.filter(A),c=t.id===void 0?void 0:n.graph.getNode(t.id);if(y.length===0){let r=b?g.kinds:"*";return c!==void 0&&(r==="*"||r.includes(c.kind))&&A(c.id)?"done":void 0}return y.length===1&&y[0]===t.id?{...i,args:{...i.args,[l.name]:t.id},open:i.open.filter(r=>r!==l)}:{...i,open:i.open.map(r=>r===l?{...r,candidates:y}:r)}}export{Zn as a,Vn as b,Qn as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}from"./chunk.UBFNZMUX.js";import"./chunk.G4JJXA63.js";import"./chunk.HAIG6NVX.js";import"./chunk.UZGRRDHD.js";import"./chunk.OKRNJXTV.js";import"./chunk.CAVBSL27.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.GV2CQVKV.js";import"./chunk.4HZ7QTXZ.js";import"./chunk.G5NZVPJU.js";import"./chunk.WVUJXDXZ.js";import"./chunk.ULRW47RP.js";import"./chunk.PBSMLINK.js";import"./chunk.3TY5NFLY.js";import"./chunk.D75KC3LL.js";import"./chunk.FWTIUYXH.js";import"./chunk.MAF7C3VM.js";import"./chunk.B2GLDIAS.js";import"./chunk.6YCBYL2Y.js";import"./chunk.UGFJKSHU.js";import"./chunk.MNP4JI33.js";import"./chunk.AJZBJBMO.js";export{i as draftAnswer,h as draftFromLens,b as draftSight,l as draftView,a as isDraftFailure,c as judgeLens,d as lensEditOf,f as lensFromSpec,j as recipeDraft,g as recipeOfLens,m as refineDraft,o as runDraftTool,e as takeBackEditOf,k as templateDraft,n as withReaderLenses};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{l as P}from"./chunk.OJGHDWI6.js";import{e as C}from"./chunk.B2GLDIAS.js";import{F as x,Q as k,Y as w,Z as B,_ as W,d as I,ma as G,y as V}from"./chunk.6QWV5MVH.js";import{$b as _,Ab as N,B as D,ac as L,gc as j,wb as F}from"./chunk.MNP4JI33.js";import{b as m}from"./chunk.AJZBJBMO.js";function H(n,e){let t=n.graph.getNode(e);if(!t)return[];let i=t.kind,a=n.schema.tryDefinition(i);if(!a)return[];let d=n.seenFor,c=d?j.keptFrom?.(n,d)?.(t):void 0,o=new Map;for(let r of n.allMutations()){let s=r.subject;if(!s||!(s.kinds==="*"||s.kinds.includes(i)))continue;let u=r.input.shape??{};for(let l of N(r,a)){if(c?.(l))continue;let b=l in u,M=[];for(let y of Object.keys(u)){if(y===s.arg||y===l||J(u[y]))continue;let v=F(r.input).find(S=>S.name===y);M.push({name:y,...v?{kinds:v.kinds}:{},...v?{candidates:v.kinds.includes("*")?n.graph.allNodes().map(S=>S.id):v.kinds.flatMap(S=>n.graph.nodesOfKind(S).map(Q=>Q.id))}:{},shape:C(r.input,y)})}let Y={field:l,mutation:r.name,title:r.title??r.name,shape:b?C(r.input,l):{type:"unknown"},takesValue:b,alternatives:[],open:M,call:y=>({name:r.name,args:b?{[s.arg]:e,[l]:y}:{[s.arg]:e}})};o.set(l,[...o.get(l)??[],Y])}}return[...o.values()].map(r=>{let s=[...r.filter(l=>l.takesValue),...r.filter(l=>!l.takesValue)],[f,...u]=s;return{...f,alternatives:u}})}function J(n){let e=D(n)?.type;return e==="optional"||e==="default"||e==="nullable"}var R=m(x(),1);function we(n){let{store:e,principal:t}=w(),i=W(),a=(0,R.useMemo)(()=>n===null?[]:H(e,n),[e,n,i]),d=(0,R.useCallback)((c,o,r={})=>{let s=c.call(o);e.apply({name:s.name,args:{...s.args,...r}},{author:t})},[e,t]);return{fields:a,commit:d}}var K=m(x(),1);function Ye(){let{brand:n}=w(),e=n?.kit;return(0,K.useMemo)(()=>_(e),[e])}function Qe(n,e){let t=L(n,e),i={...t.color!==void 0?{color:t.color}:{},...t.pattern!==void 0?{pattern:t.pattern}:{},...t.width!==void 0?{width:t.width}:{},...t.cap!==void 0?{cap:t.cap}:{},...t.opacity!==void 0?{opacity:t.opacity}:{}};return{connector:t,style:P(e,{[e]:i})}}var $=m(x(),1);var g=m(k(),1);function X(n){let e=n?.hint;return typeof e=="string"&&e.length>0?e:void 0}function Z(n){if(n instanceof Error&&n.message)return n.message;let e=String(n);return e==="[object Object]"?"The view threw without a message.":e}var U=class extends $.Component{static contextType=G;state={};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[graview] the ${this.props.view??"view"} of ${this.props.kind} threw while rendering`,e,t.componentStack),this.context?.(e,{module:"@graview/react"})}render(){let{error:e}=this.state;if(!e)return this.props.children;let t=X(e);return(0,g.jsxs)("div",{role:"alert","data-graview-view-error":this.props.kind,style:{display:"flex",flexDirection:"column",gap:"0.375rem",padding:"var(--graview-pad, 12px)",height:"100%",overflow:"auto",boxSizing:"border-box",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)",font:"var(--graview-font-body, 13px/1.45 system-ui)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,g.jsx)("strong",{style:{color:"var(--graview-warn, #b4462a)"},children:this.props.view?`${this.props.view} could not draw`:"This view could not draw"}),(0,g.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:this.props.kind}),(0,g.jsx)("span",{children:Z(e)}),t?(0,g.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:t}):null]})}};var h=m(x(),1);var z=m(k(),1),A=(0,h.createContext)([]);function nn({sections:n,children:e}){let t=(0,h.useContext)(A),i=(0,h.useMemo)(()=>[...t,...n.filter(a=>!t.includes(a))],[t,n]);return(0,z.jsx)(A.Provider,{value:i,children:e})}function tn(n){let e=(0,h.useContext)(A),t=B()?.menuSections,i=t?[...e,...t.filter(d=>!e.includes(d))]:e;if(n===null||i.length===0)return{start:[],end:[]};let a=i.flatMap(d=>{try{let c=d(n);return c&&((c.items?.length??0)>0||c.render)?[c]:[]}catch{return[]}});return{start:a.filter(d=>d.at==="start"),end:a.filter(d=>d.at!=="start")}}var ee=m(x(),1);function an(){return w().activity}var O=(n,e)=>n.length*e*.58;var ne=156,te=2,E=ne-18,re=7.1,oe=16;function ie(n,e){let t=0,i=E;for(let a of n.split(" ")){let d=e(a),c=i+e(" ")+d;if(c<=E)i=c;else{let o=Math.ceil(d/E)||1;t+=o,i=d-(o-1)*E}}return t}var ae=16.25,q=27,se=(n,e)=>{let t=Math.ceil(n.length*re/E);return e?Math.max(q,Math.ceil(Math.max(t,ie(n,e))*ae)+6):Math.max(q,t*oe+6)};function cn(n,e,t){return n.length===0?0:10+n.reduce((i,a)=>i+se(a,t),0)+(n.length-1)*te}var de=27,ce=8,ln=4,le=64,un=n=>Math.max(1,Math.min(ce,n)),pn=n=>n*de+le;var p=m(x(),1);function gn(n,{units:e,target:t=0,legibleAt:i=260}){let[a,d]=(0,p.useState)(e);(0,p.useEffect)(()=>{let o=n.current;if(o===null||typeof ResizeObserver>"u")return;let r=new ResizeObserver(([s])=>{let f=s?.contentRect.width??0;f>0&&d(f)});return r.observe(o),()=>r.disconnect()},[n]);let c=a/e;return{scale:c,width:a,touchable:c*t>=24,legible:a>=i}}function hn(n="--graview-font-body",e="sans-serif"){let t=(0,p.useRef)(void 0),i=(0,p.useMemo)(()=>{if(typeof getComputedStyle!="function"||typeof document>"u")return e;let a=getComputedStyle(document.documentElement).getPropertyValue(n).trim();return a.length>0?a:e},[n,e]);return(0,p.useMemo)(()=>{t.current===void 0&&(t.current=typeof document>"u"?null:document.createElement("canvas").getContext("2d")??null);let a=t.current;return a===null?O:(d,c)=>{a.font=`${c}px ${i}`;let o=a.measureText(d).width;return o>0?o:O(d,c)}},[i])}var xn=(0,p.createContext)(void 0);var T=3;function ue(n){let e=I(n),t=e.focusId;if(!t)return null;if(e.within?.view){let[a]=V(t);if(a)return{at:`screen:${a}`,audience:!0}}return{at:t,audience:!1}}var pe=102,fe=32;function vn(n,e,t){let i=[],a=new Map,d=new Map,c=0;for(let o of n){let r=ue(o.stop),s=r?e(r.at):null;if(!r||!s){o.name&&i.push({kind:"edge",presence:o,point:{x:t-8,y:pe+c++*fe}});continue}if(!o.name){let M=d.get(r.at);d.set(r.at,{n:(M?.n??0)+1,box:s});continue}let f=a.get(r.at)??[];if(f.push(o),a.set(r.at,f),f.length>T)continue;let u=s,l=f.length-1,b=r.audience?{x:u.x+u.width*.5+(l-1)*26,y:u.y+Math.min(u.height,24)}:{x:u.x+u.width*.5-26-l*26,y:u.y+u.height-4};i.push({kind:"person",presence:o,point:b,at:r.at,index:l,of:f.length,audience:r.audience})}for(let[o,r]of a){if(r.length<=T)continue;let s=e(o);s&&i.push({kind:"count",at:o,point:{x:s.x+s.width*.5+2*26+18,y:s.y+s.height-4},n:r.length-T})}for(let[o,{n:r,box:s}]of d)i.push({kind:"count",at:o,point:{x:s.x+s.width*.5+40,y:s.y+s.height-4},n:r});for(let o of n)if(o.name){if(o.robot?.at&&o.robot.mode!=="docked"){let r=e(o.robot.at);r&&i.push({kind:"robot",presence:o,point:{x:r.x+r.width/2+22,y:r.y+r.height-4},mode:o.robot.mode})}if(o.over){let r=e(o.over);r&&i.push({kind:"over",presence:o,box:r})}}return i}export{an as a,O as b,ne as c,te as d,q as e,cn as f,de as g,ln as h,le as i,un as j,pn as k,gn as l,hn as m,we as n,Ye as o,Qe as p,vn as q,U as r,nn as s,tn as t};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{F as H,Q as k,a as C,xa as K}from"./chunk.6QWV5MVH.js";import{b as m}from"./chunk.AJZBJBMO.js";var n=m(H(),1),N=450,_=10,O=t=>t instanceof HTMLInputElement?t.dataset.graviewChooseBox??void 0:void 0,G={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:-1/0,End:1/0},T=t=>t instanceof Element?t.closest("[data-graview-choose]"):null,U=t=>t instanceof HTMLElement&&(t.isContentEditable||t instanceof HTMLInputElement&&t.type!=="checkbox"||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement);function $(t){let[i,g]=(0,n.useState)(()=>new Set),l=(0,n.useRef)(null),b=(0,n.useRef)(null),[x,P]=(0,n.useState)(null),R=x!==null&&t.includes(x)?x:t[0],S=(0,n.useMemo)(()=>t.filter(e=>i.has(e)),[t,i]),E=(0,n.useMemo)(()=>new Set(t),[t]);(0,n.useEffect)(()=>{[...i].some(e=>!E.has(e))&&g(e=>new Set([...e].filter(o=>E.has(o))))},[E,i]);let u=(0,n.useCallback)((e,o=!1)=>{let r=l.current;g(s=>{let a=new Set(s),f=r===null?-1:t.indexOf(r),y=t.indexOf(e);if(o&&f>=0&&y>=0){let v=s.has(r);for(let p of t.slice(Math.min(f,y),Math.max(f,y)+1))v?a.add(p):a.delete(p)}else a.has(e)?a.delete(e):a.add(e);return a}),l.current=e},[t]),L=(0,n.useCallback)(e=>g(new Set(e)),[]),A=(0,n.useCallback)(()=>{l.current=null,g(new Set)},[]),c=(0,n.useRef)(null),h=(0,n.useRef)(!1),M=S.length>0,d=()=>{c.current&&clearTimeout(c.current.timer),c.current=null};(0,n.useEffect)(()=>d,[]);let B={ref:b,onKeyDown:e=>{if(U(e.target))return;let o=O(e.target),r=G[e.key];if(o!==void 0&&r!==void 0&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let s=t.indexOf(o),a=t[Math.max(0,Math.min(t.length-1,s+(Number.isFinite(r)?r:r>0?t.length:-t.length)))];if(e.preventDefault(),e.stopPropagation(),a===void 0||a===o)return;if(e.shiftKey){let f=l.current!==null&&t.includes(l.current)?l.current:o,[y,v]=[t.indexOf(f),t.indexOf(a)].sort((p,F)=>p-F);g(p=>new Set([...p,...t.slice(y,v+1)])),l.current=f}P(a),b.current?.querySelector(`[data-graview-choose-box="${CSS.escape(a)}"]`)?.focus();return}if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="a"){e.preventDefault(),e.stopPropagation(),L(t);return}if(e.key===" "&&!e.metaKey&&!e.ctrlKey){let s=T(e.target),a=e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement&&e.target.type==="checkbox";if(!s||a)return;e.preventDefault(),u(s.dataset.graviewChoose,e.shiftKey)}},onFocus:e=>{let o=O(e.target);o!==void 0&&P(o)},onPointerDown:e=>{if(h.current=!1,e.pointerType==="mouse"||e.button>0)return;let o=T(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox")return;let r=o.dataset.graviewChoose;d(),c.current={id:r,x:e.clientX,y:e.clientY,timer:setTimeout(()=>{c.current=null,h.current=!0,u(r)},N)}},onPointerMove:e=>{let o=c.current;o&&Math.hypot(e.clientX-o.x,e.clientY-o.y)>_&&d()},onPointerUp:d,onPointerCancel:d,onClickCapture:e=>{let o=T(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox"&&e.target.hasAttribute("data-graview-choose-box"))return;if(h.current){h.current=!1,e.preventDefault(),e.stopPropagation();return}let s=o.dataset.graviewChoose;if(e.shiftKey&&(M||l.current!==null)){e.preventDefault(),e.stopPropagation(),u(s,!0);return}M&&matchMedia?.("(pointer: coarse)").matches&&(e.preventDefault(),e.stopPropagation(),u(s))},onContextMenu:e=>{(h.current||c.current)&&(e.preventDefault(),e.stopPropagation())},...M?{"data-graview-choosing":""}:{}},j=(0,n.useCallback)(e=>i.has(e),[i]);return{chosen:S,has:j,toggle:u,choose:L,clear:A,listProps:B,boxProps:(e,o)=>({type:"checkbox",className:"graview-choose-box","data-graview-choose-box":e,"aria-label":`Choose ${o}`,tabIndex:e===R?0:-1,checked:i.has(e),onChange:()=>{},onClick:r=>{r.stopPropagation(),u(e,r.shiftKey)}}),list:b}}var q=`
|
|
2
|
-
.graview-choose-box{width:24px;height:24px;margin:0;accent-color:var(--graview-accent);cursor:pointer;opacity:0}
|
|
3
|
-
[data-graview-choose]:hover .graview-choose-box,[data-graview-choose]:focus-within .graview-choose-box,.graview-choose-box:focus-visible,.graview-choose-box:checked,[data-graview-choosing] .graview-choose-box{opacity:1}
|
|
4
|
-
[data-graview-choose]{-webkit-touch-callout:none}
|
|
5
|
-
[data-graview-choosing] [data-graview-choose]{-webkit-user-select:none;user-select:none}
|
|
6
|
-
`;var I=m(H(),1),w=m(k(),1),D=K(C(()=>(__graviewPreload(import.meta.url,["./chunk.3AGY4QVS.js","./chunk.SYAEBGDC.js","./chunk.UZGRRDHD.js","./chunk.XANVHJQ4.js","./chunk.EJPI3ST6.js","./chunk.SHTJZ6UX.js","./chunk.UT6642FC.js","./chunk.MB7LKKUD.js","./chunk.ULRW47RP.js","./chunk.PBSMLINK.js","./chunk.3TY5NFLY.js","./chunk.D75KC3LL.js","./chunk.FWTIUYXH.js","./chunk.MAF7C3VM.js","./chunk.B2GLDIAS.js","./chunk.6YCBYL2Y.js","./chunk.UGFJKSHU.js","./chunk.JOOQUWLT.js","./chunk.6QWV5MVH.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.ASCLIM2P.js")))),X=D.part((t,i)=>(0,w.jsx)(t.SeveralBar,{...i}),{what:"The selection bar"});function Q(t){return t.chosen.length===0?null:(0,w.jsx)(I.Suspense,{fallback:null,children:(0,w.jsx)(X,{...t})})}var W=()=>D.prefetch();export{$ as a,q as b,Q as c,W as d};
|