playermap_graph 0.2.1 → 0.2.2
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/index.es.js +2 -2
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -3827,7 +3827,7 @@ const uP = (r, e, n) => r.document ? r : {
|
|
|
3827
3827
|
displayName: "Intuition Testnet"
|
|
3828
3828
|
},
|
|
3829
3829
|
base: {
|
|
3830
|
-
url: "https://
|
|
3830
|
+
url: "https://proxy.agent-bossfighters.com/graphql",
|
|
3831
3831
|
displayName: "Intuition Mainnet"
|
|
3832
3832
|
}
|
|
3833
3833
|
}, bc = (r) => new rv(pM[r].url), zf = (r) => ({
|
|
@@ -4333,7 +4333,7 @@ const uP = (r, e, n) => r.document ? r : {
|
|
|
4333
4333
|
module: ub
|
|
4334
4334
|
},
|
|
4335
4335
|
base: {
|
|
4336
|
-
url: "https://
|
|
4336
|
+
url: "https://proxy.agent-bossfighters.com/graphql",
|
|
4337
4337
|
displayName: "Intuition Mainnet",
|
|
4338
4338
|
module: ub
|
|
4339
4339
|
}
|
package/dist/index.umd.js
CHANGED
|
@@ -169,7 +169,7 @@ ${String(r)}`)}catch(e){return e}},gb=r=>{if(typeof r!="object"||r===null)throw
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
`,s={_and:[]};r.subject&&s._and.push({subject:{label:{_ilike:`%${r.subject}%`}}}),r.predicate&&s._and.push({predicate:{label:{_ilike:`%${r.predicate}%`}}}),r.object&&s._and.push({object:{label:{_ilike:`%${r.object}%`}}});const o={where:s._and.length>0?s:{}};try{return(await n.request(i,o)).triples}catch(a){throw console.error("Error executing search query:",a),a}}},Symbol.toStringTag,{value:"Module"})),bb={baseSepolia:{url:"https://testnet.intuition.sh/v1/graphql",displayName:"Intuition Testnet"},base:{url:"https://
|
|
172
|
+
`,s={_and:[]};r.subject&&s._and.push({subject:{label:{_ilike:`%${r.subject}%`}}}),r.predicate&&s._and.push({predicate:{label:{_ilike:`%${r.predicate}%`}}}),r.object&&s._and.push({object:{label:{_ilike:`%${r.object}%`}}});const o={where:s._and.length>0?s:{}};try{return(await n.request(i,o)).triples}catch(a){throw console.error("Error executing search query:",a),a}}},Symbol.toStringTag,{value:"Module"})),bb={baseSepolia:{url:"https://testnet.intuition.sh/v1/graphql",displayName:"Intuition Testnet"},base:{url:"https://proxy.agent-bossfighters.com/graphql",displayName:"Intuition Mainnet"}},Ga=r=>new Rm(bb[r].url),zh=r=>({id:r.term_id,subject:{id:r.subject.term_id,label:r.subject.label,type:r.subject.type,image:r.subject.image},predicate:{id:r.predicate.term_id,label:r.predicate.label,type:r.predicate.type},object:{id:r.object.term_id,label:r.object.label,type:r.object.type,image:r.object.image}}),aP=async(r,e="base")=>{const n=Ga(e);let i;i=Fn`
|
|
173
173
|
query GetAtom($atomId: String!) {
|
|
174
174
|
atoms(where: { term_id: { _eq: $atomId } }) {
|
|
175
175
|
term_id
|
|
@@ -351,7 +351,7 @@ ${String(r)}`)}catch(e){return e}},gb=r=>{if(typeof r!="object"||r===null)throw
|
|
|
351
351
|
image
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
|
-
`,A=await i.request(E,{predicateIds:S,objectIds:w}),M=new Map((A.predicates||[]).map(P=>[P.term_id,P])),T=new Map((A.objects||[]).map(P=>[P.term_id,P])),R=v.map(P=>({term_id:P.term_id,subject:p.get(P.subject_id)||{term_id:P.subject_id,label:"",type:"",image:null},predicate:M.get(P.predicate_id)||{term_id:P.predicate_id,label:"",type:"",image:null},object:T.get(P.object_id)||{term_id:P.object_id,label:"",type:"",image:null}}));return[...y,...R].map(zh)}}}return y.map(zh)}catch(s){return console.error("Error fetching agent-specific triples:",s),[]}},Tb=Object.freeze(Object.defineProperty({__proto__:null,ENDPOINTS:bb,createClient:Ga,fetchAtomDetails:aP,fetchTriples:lP,fetchTriplesForAgent:Sb,fetchTriplesForNode:cP,searchTriples:uP},Symbol.toStringTag,{value:"Module"})),Va={railsMockApi:{url:"https://api-i7n.thp-lab.org/api/v1/graph",displayName:"[OffChain] Playground API",module:oP},baseSepolia:{url:"https://testnet.intuition.sh/v1/graphql",displayName:"Base Testnet",module:Tb},base:{url:"https://
|
|
354
|
+
`,A=await i.request(E,{predicateIds:S,objectIds:w}),M=new Map((A.predicates||[]).map(P=>[P.term_id,P])),T=new Map((A.objects||[]).map(P=>[P.term_id,P])),R=v.map(P=>({term_id:P.term_id,subject:p.get(P.subject_id)||{term_id:P.subject_id,label:"",type:"",image:null},predicate:M.get(P.predicate_id)||{term_id:P.predicate_id,label:"",type:"",image:null},object:T.get(P.object_id)||{term_id:P.object_id,label:"",type:"",image:null}}));return[...y,...R].map(zh)}}}return y.map(zh)}catch(s){return console.error("Error fetching agent-specific triples:",s),[]}},Tb=Object.freeze(Object.defineProperty({__proto__:null,ENDPOINTS:bb,createClient:Ga,fetchAtomDetails:aP,fetchTriples:lP,fetchTriplesForAgent:Sb,fetchTriplesForNode:cP,searchTriples:uP},Symbol.toStringTag,{value:"Module"})),Va={railsMockApi:{url:"https://api-i7n.thp-lab.org/api/v1/graph",displayName:"[OffChain] Playground API",module:oP},baseSepolia:{url:"https://testnet.intuition.sh/v1/graphql",displayName:"Base Testnet",module:Tb},base:{url:"https://proxy.agent-bossfighters.com/graphql",displayName:"Intuition Mainnet",module:Tb}},hP=r=>{if(!Va[r])throw new Error(`Endpoint '${r}' is not defined.`);return new Rm(Va[r].url)},Gh=r=>{if(!Va[r]||!Va[r].module)throw new Error(`No module defined for endpoint '${r}'.`);return Va[r].module},Vh=async(r="base")=>{const e=Gh(r);try{return e.fetchTriples(r)}catch(n){throw console.error(`Error fetching triples for endpoint ${r}:`,n),n}},wb=async(r,e="base")=>{const n=Gh(e);try{return n.fetchTriplesForNode(r,e)}catch(i){throw console.error(`Error fetching triples for node ${r} with endpoint ${e}:`,i),i}},Mb=async(r,e="base")=>{const n=Gh(e);try{return n.fetchAtomDetails(r,e)}catch(i){throw console.error(`Error fetching atom details for ${r} with endpoint ${e}:`,i),i}},$o=async(r,e="base")=>{const n=Gh(e);try{return n.searchTriples(r,e)}catch(i){throw console.error(`Error searching triples with endpoint ${e}:`,i),i}},Eb=async(r,e="baseSepolia",n=1e3)=>Sb(r,e,n),$h=({triple:r,endpoint:e,onClose:n})=>{var m;const[i,s]=_e.useState(null),[o,a]=_e.useState(null),[l,c]=_e.useState(!1),[u,h]=_e.useState(null);_e.useEffect(()=>{if(!r)return;c(!0),h(null),a(null),(async()=>{try{const g=(await Vh(e)).filter(x=>{var b,v,S;return x.id===r.id||((b=x.subject)==null?void 0:b.id)===r.id||((v=x.predicate)==null?void 0:v.id)===r.id||((S=x.object)==null?void 0:S.id)===r.id});if(s(g),r.id){const x=await Mb(r.id,e);a(x)}}catch(y){console.error("Error fetching sidebar data:",y),h("Failed to fetch data")}finally{c(!1)}})()},[r,e]);const d=_=>`${(_/1e18).toFixed(4)} ETH`;if(!r)return null;const f=(_,y=4,g=4)=>!_||_.length<=y+g?_:`${_.slice(0,y)}...${_.slice(-g)}`,p=async _=>{try{await navigator.clipboard.writeText(_)}catch(y){console.error("Error copying ID:",y)}};return J.jsxs("div",{style:{background:"#18181b",borderRadius:"10px",border:"2px solid #ffd32a",padding:"24px",boxShadow:"0 8px 30px rgba(0, 0, 0, 0.5)",color:"#fff",maxWidth:"400px",width:"100%"},children:[J.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"24px"},children:[J.jsx("h2",{style:{margin:0,fontSize:"24px",color:"#ffd32a",fontWeight:"bold",letterSpacing:"0.5px"},children:r.label||"No Label"}),J.jsx("button",{onClick:n,style:{background:"none",border:"none",color:"#ffd32a",fontSize:"24px",cursor:"pointer",padding:"4px",lineHeight:1},children:"×"})]}),o&&o.image&&J.jsx("div",{style:{display:"flex",justifyContent:"center",margin:"24px 0"},children:J.jsx("img",{src:o.image,alt:o.label||"Node image",style:{width:"120px",height:"120px",borderRadius:"50%",objectFit:"cover",border:"3px solid #ffd32a",boxShadow:"0 4px 12px rgba(0,0,0,0.2)"}})}),l&&J.jsx("div",{style:{textAlign:"center",padding:"20px",color:"#ffd32a"},children:"Loading..."}),u&&J.jsx("div",{style:{color:"#ff4444",padding:"12px",background:"rgba(255,68,68,0.1)",borderRadius:"8px",marginBottom:"16px"},children:u}),o&&J.jsxs("div",{style:{background:"#232326",borderRadius:"8px",padding:"16px",marginBottom:"24px"},children:[J.jsx("h4",{style:{color:"#ffd32a",margin:"0 0 16px 0",fontSize:"18px",fontWeight:"bold"},children:"Atom Info"}),J.jsxs("div",{style:{display:"grid",gap:"12px"},children:[J.jsxs("div",{children:[J.jsx("span",{style:{color:"#ffd32a",fontWeight:"bold"},children:"ID:"})," ",J.jsx("span",{style:{cursor:"pointer",textDecoration:"underline",color:"#ffd32a"},onClick:()=>p(o.term_id),title:`Cliquer pour copier: ${o.term_id}`,children:f(o.term_id)})]}),J.jsxs("div",{children:[J.jsx("span",{style:{color:"#ffd32a",fontWeight:"bold"},children:"Label:"})," ",o.label]}),J.jsxs("div",{children:[J.jsx("span",{style:{color:"#ffd32a",fontWeight:"bold"},children:"Type:"})," ",o.type]}),J.jsxs("div",{children:[J.jsx("span",{style:{color:"#ffd32a",fontWeight:"bold"},children:"Creator:"})," ",J.jsx("span",{style:{cursor:"pointer",textDecoration:"underline",color:"#ffd32a"},onClick:()=>p(o.creator_id),title:`Cliquer pour copier: ${o.creator_id}`,children:f(o.creator_id)})]}),J.jsxs("div",{children:[J.jsx("span",{style:{color:"#ffd32a",fontWeight:"bold"},children:"Vault Shares:"})," ",d(((m=o.vault)==null?void 0:m.total_shares)||0)]})]})]}),i&&i.length>0&&J.jsxs("div",{style:{background:"#232326",borderRadius:"8px",padding:"16px"},children:[J.jsx("h4",{style:{color:"#ffd32a",margin:"0 0 16px 0",fontSize:"18px",fontWeight:"bold"},children:"Related Data"}),J.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:i.map(_=>{var y,g,x;return J.jsxs("div",{style:{padding:"12px",background:"#18181b",borderRadius:"6px",border:"1px solid #ffd32a33"},children:[J.jsxs("div",{children:[J.jsx("span",{style:{color:"#ffd32a",fontWeight:"bold"},children:"Subject:"})," ",(y=_.subject)==null?void 0:y.label]}),J.jsxs("div",{children:[J.jsx("span",{style:{color:"#ffd32a",fontWeight:"bold"},children:"Predicate:"})," ",(g=_.predicate)==null?void 0:g.label]}),J.jsxs("div",{children:[J.jsx("span",{style:{color:"#ffd32a",fontWeight:"bold"},children:"Object:"})," ",(x=_.object)==null?void 0:x.label]})]},_.id)})})]}),!l&&!(i!=null&&i.length)&&J.jsx("div",{style:{textAlign:"center",padding:"20px",color:"#888",background:"#232326",borderRadius:"8px"},children:"No additional related data found."})]})},Ab=({graphData:r,onNodeClick:e,onBack:n,onForward:i,selectedTriple:s,endpoint:o,disableNodeDetailsSidebar:a=!1})=>{const l=_e.useRef(),c=_e.useRef(),[u,h]=_e.useState({width:100,height:100});return _e.useEffect(()=>{const d=()=>{l.current&&h({width:l.current.clientWidth,height:l.current.clientHeight})};return d(),window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[]),_e.useEffect(()=>{if(c.current&&u.width>0&&u.height>0){const d=ko()(c.current);d.width(u.width).height(u.height).graphData(r).nodeLabel(f=>f.label||f.id).nodeAutoColorBy("group"),e&&d.onNodeClick(f=>{e(f)})}},[r,e,u]),J.jsxs("div",{ref:l,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},children:[J.jsx("div",{ref:c,style:{width:"100%",height:"100%"}}),J.jsxs("div",{style:{position:"absolute",bottom:20,left:20,zIndex:100},children:[J.jsx("button",{onClick:n,style:{background:"#ffd32a",color:"#18181b",border:"none",borderRadius:8,padding:"10px 20px",marginRight:10,cursor:"pointer",fontWeight:"bold"},children:"Back"}),J.jsx("button",{onClick:i,style:{background:"#ffd32a",color:"#18181b",border:"none",borderRadius:8,padding:"10px 20px",cursor:"pointer",fontWeight:"bold"},children:"Forward"})]}),s&&!a&&J.jsx("div",{style:{position:"absolute",top:80,right:30,width:350,zIndex:9999,maxHeight:"80vh",background:"#18181b",borderRadius:"10px",border:"3px solid #ffd32a",boxShadow:"0 8px 30px rgba(0, 0, 0, 0.5)",overflowY:"auto"},children:J.jsx($h,{triple:s,endpoint:o,onClose:()=>e(null)})})]})},Cb=()=>{const[r,e]=_e.useState([]),n=200;_e.useEffect(()=>{let s;const o=()=>{const a=Date.now()/1e3,l=[];for(let c=0;c<3;c++){const u=a*.8+c*2*Math.PI/3;l.push({x:Math.cos(u)*150+200,y:Math.sin(u)*150+200,color:"#00fff2"})}for(let c=0;c<3;c++){const u=-a*1.2+c*2*Math.PI/3;l.push({x:Math.cos(u)*100+200,y:Math.sin(u)*100+200,color:"#ff00ff"})}for(let c=0;c<3;c++){const u=a*1.5+c*2*Math.PI/3;l.push({x:Math.cos(u)*50+200,y:Math.sin(u)*50+200,color:"#ffff00"})}e(l),s=requestAnimationFrame(o)};return o(),()=>cancelAnimationFrame(s)},[]);const i=r.flatMap((s,o)=>r.slice(o+1).map((a,l)=>{const c=a.x-s.x,u=a.y-s.y,h=Math.sqrt(c*c+u*u);if(h<n){const d=1-h/n;return{x1:s.x,y1:s.y,x2:a.x,y2:a.y,opacity:d*.8,gradient:`link-gradient-${o}-${l}`,color1:s.color,color2:a.color}}return null}).filter(Boolean));return J.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",background:"rgba(0, 0, 0, 0.9)",zIndex:1e3,overflow:"hidden"},children:[J.jsxs("div",{style:{position:"relative",width:"400px",height:"400px",display:"flex",flexDirection:"column",alignItems:"center"},children:[J.jsxs("svg",{width:"400",height:"400",children:[J.jsx("defs",{children:i.map(s=>J.jsxs("linearGradient",{id:s.gradient,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[J.jsx("stop",{offset:"0%",stopColor:s.color1,stopOpacity:s.opacity}),J.jsx("stop",{offset:"100%",stopColor:s.color2,stopOpacity:s.opacity})]},s.gradient))}),i.map((s,o)=>J.jsx("line",{x1:s.x1,y1:s.y1,x2:s.x2,y2:s.y2,stroke:`url(#${s.gradient})`,strokeWidth:"3",style:{filter:"brightness(1.5) blur(1px)"}},o))]}),J.jsx("div",{style:{color:"#00fff2",fontSize:"40px",fontFamily:"sans-serif",letterSpacing:"-2px",textShadow:`
|
|
355
355
|
0 0 5px #00fff2,
|
|
356
356
|
0 0 10px #00fff2,
|
|
357
357
|
0 0 20px #00fff2,
|