(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,96243,e=>{"use strict";var t=e.i(27493),i=e.i(4),a=e.i(74133),l=e.i(97358);let r=(0,a.default)(()=>e.A(23531),{loadableGenerated:{modules:[23272]},ssr:!1});function n({memories:e,links:a,selectedMemory:n,onSelectMemory:s}){let c=(0,i.useRef)(null),o=(0,i.useRef)(null),[d,h]=(0,i.useState)({width:800,height:600});(0,i.useEffect)(()=>{let e=c.current;if(!e)return;let t=()=>{h({width:e.clientWidth,height:e.clientHeight})};t();let i=new ResizeObserver(t);return i.observe(e),()=>i.disconnect()},[]);let u=(0,i.useMemo)(()=>{let t=new Set(e.map(e=>e.id));return{nodes:e.map(e=>({id:e.id,name:e.title,category:e.category,type:e.type,salience:e.salience,decayedScore:e.decayedScore??e.salience,val:10*e.salience})),links:a.filter(e=>t.has(e.source_id)&&t.has(e.target_id)).map(e=>({source:e.source_id,target:e.target_id,strength:e.strength,relationship:e.relationship}))}},[e,a]),g=(0,i.useCallback)((e,t,i)=>{let a=e.x,r=e.y;if(null==a||null==r)return;let s=Math.max(3,8*e.salience),c=(0,l.getCategoryColor)(e.category),o=Math.max(.2,e.decayedScore),d=n?.id===e.id;if(t.beginPath(),t.arc(a,r,s,0,2*Math.PI),t.fillStyle=c+Math.round(255*o).toString(16).padStart(2,"0"),t.fill(),t.lineWidth=d?2:1,t.strokeStyle=d?"#ffffff":c,"short_term"===e.type?t.setLineDash([3,3]):"episodic"===e.type?t.setLineDash([1,2]):t.setLineDash([]),t.stroke(),t.setLineDash([]),i>3){let l=e.name.length>40?e.name.slice(0,40)+"…":e.name,n=Math.max(10,12/i);t.font=`${n}px Sans-Serif`,t.textAlign="center",t.textBaseline="top";let c=t.measureText(l).width,o=r+s+3;t.fillStyle="rgba(2, 6, 23, 0.85)",t.beginPath(),t.roundRect(a-c/2-2,o-2,c+4,n+4,3),t.fill(),t.fillStyle="#e2e8f0",t.fillText(l,a,o)}},[n]),f=(0,i.useCallback)((e,t)=>{let i=e.source,a=e.target;i?.x&&a?.x&&(t.beginPath(),t.moveTo(i.x,i.y),t.lineTo(a.x,a.y),t.strokeStyle="#334155",t.lineWidth=3*e.strength,t.stroke())},[]),y=(0,i.useRef)(1),m=(0,i.useCallback)(({k:e})=>{let t=o.current;if(!t||.2>Math.abs(e-y.current))return;y.current=e;let i=t.d3Force("charge");i&&(e>3?i.strength(-50*e):i.strength(-30),t.d3ReheatSimulation())},[]),b=(0,i.useCallback)(t=>{s(e.find(e=>e.id===t.id)??null)},[e,s]),p=(0,i.useCallback)(e=>`${e.name}
Category: ${e.category}
Salience: ${e.salience.toFixed(2)}`,[]);return(0,t.jsx)("div",{ref:c,style:{width:"100%",height:"100%"},children:d.width>0&&(0,t.jsx)(r,{ref:o,graphData:u,width:d.width,height:d.height,backgroundColor:"rgba(0,0,0,0)",nodeCanvasObject:g,nodeLabel:p,onNodeClick:b,onZoom:m,linkCanvasObject:f,linkDirectionalParticles:2,linkDirectionalParticleWidth:2,linkDirectionalParticleSpeed:.005,linkDirectionalParticleColor:()=>"#22d3ee",d3AlphaDecay:.02,d3VelocityDecay:.3,warmupTicks:100,cooldownTicks:200})})}e.s(["default",()=>n])},11570,e=>{e.n(e.i(96243))},23531,e=>{e.v(t=>Promise.all(["static/chunks/364656baa57adaa7.js"].map(t=>e.l(t))).then(()=>t(23272)))}]);