sessiongraph 0.1.9 → 1.0.1

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.
@@ -1,49 +0,0 @@
1
- import{M as j,C as B,S as $,a as x,W as ie,A as se,O as oe,b as ne,H as re,E as ae,R as he,U as le,V as z,c as ce,d as de,e as fe,P as pe,G as F,f as me,g as R,h as ue,i as m,j as ve,k as T,B as C,F as k,l as U,m as ge,n as ye,I as Me,o as I,D as L,p as X,q as W,r as D,s as O,t as H,u as N,v as we,L as be,w as q,x as xe,y as ke,z as Se,J as Pe}from"./three-B4kj4iLH.js";import{d as P,h as A,T as Ee,S as Ae,F as Y,c as Ce,D as Be,m as Ge,a as Z,t as K,b as J}from"./index-0ZTrNFWY.js";const ze=["svg",P,[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"}],["path",{d:"M10 12h4"}]]];const Fe=["svg",P,[["path",{d:"M12 8V4H8"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}],["path",{d:"M2 14h2"}],["path",{d:"M20 14h2"}],["path",{d:"M15 13v2"}],["path",{d:"M9 13v2"}]]];const Ie=["svg",P,[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18"}]]];const Re=["svg",P,[["path",{d:"M18 6 7 17l-5-5"}],["path",{d:"m22 10-7.5 7.5L13 16"}]]];const Te=["svg",P,[["circle",{cx:"12",cy:"12",r:"10"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16"}]]];const _=["svg",P,[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z"}]]];const Ue=["svg",P,[["circle",{cx:"12",cy:"8",r:"5"}],["path",{d:"M20 21a8 8 0 0 0-16 0"}]]];const Le=["svg",P,[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"}]]],ee=`
2
- attribute float nodeIndex;
3
- uniform float uSelected;
4
- uniform float uHovered;
5
- uniform float uFocus;
6
- varying float vNodeEmphasis;
7
- float nodeEmphasis() {
8
- if (abs(nodeIndex - uSelected) < .5) return 1.12;
9
- if (abs(nodeIndex - uHovered) < .5) return 1.2;
10
- return mix(1.0, .46, uFocus);
11
- }
12
- `;function V(y){const e=new B(y.color),t=e.getHSL({h:0,s:0,l:0},$),i=y.session.id;return e.setHSL(t.h+(A(`${i}:hue`)-.5)*.09,x.clamp(t.s+A(`${i}:saturation`)*.12,.4,.72),.63+A(`${i}:lightness`)*.11,$)}function De(y){const e=new j;return e.onBeforeCompile=t=>{Object.assign(t.uniforms,y),t.vertexShader=`${ee}
13
- varying vec3 vSphereNormal; varying vec3 vSphereView;
14
- ${t.vertexShader}`.replace("#include <project_vertex>",`
15
- #include <project_vertex>
16
- // Instances only translate/uniformly scale. Keep the original sphere
17
- // normals when the graph's depth is flattened, retaining depth cues in 2D.
18
- vSphereNormal = mat3(viewMatrix) * normal;
19
- vSphereView = -mvPosition.xyz;
20
- vNodeEmphasis = nodeEmphasis();
21
- `),t.fragmentShader=`varying vec3 vSphereNormal; varying vec3 vSphereView; varying float vNodeEmphasis;
22
- ${t.fragmentShader}`.replace("#include <color_fragment>",`
23
- #include <color_fragment>
24
- vec3 n = normalize(vSphereNormal);
25
- float facing = max(dot(n, normalize(vSphereView)), 0.0);
26
- float light = .8 + .4 * max(dot(n, normalize(vec3(-.5, .65, 1.0))), 0.0);
27
- // Luminous colored centers bloom; a soft rim still separates overlaps.
28
- float rim = mix(.35, 1.0, smoothstep(0.0, .28, facing));
29
- diffuseColor.rgb = mix(diffuseColor.rgb, vec3(1.0), .07 * facing);
30
- diffuseColor.rgb *= 1.4 * light * rim * vNodeEmphasis;
31
- `)},e}class Q{constructor(e=48){this.cellSize=e}cellSize;cells=new Map;clear(){this.cells.clear()}add(e,t,i,s,o,n){if(![t,i,s].every(Number.isFinite)||t+s<0||i+s<0||t-s>o||i-s>n)return;const a=Math.floor(Math.max(0,t-s)/this.cellSize),r=Math.floor(Math.min(o,t+s)/this.cellSize),h=Math.floor(Math.max(0,i-s)/this.cellSize),l=Math.floor(Math.min(n,i+s)/this.cellSize);for(let p=h;p<=l;p++)for(let c=a;c<=r;c++){const u=`${c}:${p}`,d=this.cells.get(u);d?d.push(e):this.cells.set(u,[e])}}at(e,t){return this.cells.get(`${Math.floor(e/this.cellSize)}:${Math.floor(t/this.cellSize)}`)||[]}}function Oe(y){let e=_;return y.kind==="message"?e=y.role==="user"?Ue:y.role==="assistant"?Fe:_:y.kind==="tool_call"?e=/shell|bash|terminal|exec/i.test(y.name)?Ee:/search|grep|glob|find/i.test(y.name)?Ae:/edit|write|patch/i.test(y.name)?Y:Le:e={tool_result:Re,reasoning:Ie,file_change:Y,compaction:ze,error:Te,event:_}[y.kind],Ce([e[0],{...e[1],"aria-hidden":"true","stroke-width":1.4},e[2]])}function E(y){y.traverse(e=>{const t=e;e instanceof I&&e.dispose(),t.geometry?.dispose(),t.material&&(Array.isArray(t.material)?t.material:[t.material]).forEach(s=>s.dispose())}),y.clear()}class _e{constructor(e,t){this.container=e,this.onSelect=t.onSelect,this.onHover=t.onHover,this.onEvent=t.onEvent,this.onEventHover=t.onEventHover,this.renderer=new ie({antialias:!0,alpha:!0,powerPreference:"high-performance"}),this.renderer.setPixelRatio(Math.min(Math.max(devicePixelRatio,1.5),2)),this.renderer.localClippingEnabled=!0,this.renderer.setClearColor(new B().setRGB(.001,.0017,.0024),1),this.renderer.toneMapping=se,this.renderer.toneMappingExposure=1.05,this.renderer.domElement.setAttribute("aria-label","Interactive 3D session timeline. Drag to orbit, scroll to zoom. Sessions are also available in the list."),this.renderer.domElement.tabIndex=0,e.append(this.renderer.domElement),this.labelLayer=document.createElement("div"),this.labelLayer.className="scene-labels",this.labelLayer.dataset.motion=String(this.motion),e.append(this.labelLayer),this.controls=new oe(this.camera,this.renderer.domElement),this.controls.enableDamping=!0,this.controls.dampingFactor=.065,this.controls.rotateSpeed=.5,this.controls.zoomSpeed=.8,this.controls.minDistance=15,this.controls.maxDistance=1200,this.controls.addEventListener("start",()=>{this.targetPosition=void 0,this.targetLook=void 0,this.focusedSession=null,this.playing&&t.onPlaybackInterrupt()}),this.camera.position.set(20,70,320),this.scene.add(this.graphGroup,this.selectionGroup,this.filesGroup);const i=new ne(1,1,{type:re,samples:Math.min(4,this.renderer.capabilities.maxSamples)});this.composer=new ae(this.renderer,i),this.composer.addPass(new he(this.scene,this.camera)),this.bloom=new le(new z(1,1),.23,.4,.9),this.composer.addPass(this.bloom),this.smaa=new ce,this.composer.addPass(this.smaa),this.composer.addPass(new de);const s=this.smaa;for(const o of[s._areaTexture??s.areaTexture,s._searchTexture??s.searchTexture])o?.image?.addEventListener("load",()=>{this.dirty=!0},{once:!0});this.addStars(),this.resizeObserver=new ResizeObserver(()=>this.resize()),this.resizeObserver.observe(e),this.renderer.domElement.addEventListener("pointermove",this.pointerMove),this.renderer.domElement.addEventListener("pointerdown",this.pointerStart),this.renderer.domElement.addEventListener("pointerup",this.pointerEnd),this.renderer.domElement.addEventListener("pointerleave",this.pointerLeave),this.renderer.domElement.addEventListener("webglcontextlost",this.contextLost),this.resize(),this.animate()}container;renderer;scene=new fe;camera=new pe(45,1,.1,2500);controls;composer;bloom;smaa;dirty=!0;graphGroup=new F;selectionGroup=new F;filesGroup=new F;labels=[];labelLayer;graph={nodes:[],edges:[],lanes:[],start:0,end:0};nodeMesh;nodeByID=new Map;nodeIndices=new Map;focusUniforms={uSelected:{value:-1},uHovered:{value:-1},uFocus:{value:0}};raycaster=new me;nodeGrid=new Q;markerGrid=new Q;pickingDirty=!0;pickingView=new R;pickingProjection=new R;pickMesh;pickMatrix=new R;pickHits=[];width=1;height=1;pointer=new z;pointerDown=new z;selected=null;hovered=null;cutoff=1;clipPlane=new ue(new m(-1,0,0),151);flat=!1;motion=!matchMedia("(prefers-reduced-motion: reduce)").matches;suspended=!1;frame=0;resizeObserver;targetPosition;targetLook;playing=!1;playbackPath;playbackRadii=[];playbackSphere=new ve;playbackFocus=new m;playbackOffset=new m;glowMaterial;time=0;previousFrame=performance.now();nodeReveal=new Float32Array;revealAttribute;revealsActive=!1;graphBorn=0;fileMesh;eventMarkers=[];selectedEvent=null;focusedEvent;focusedSession=null;eventIcons=[];iconPoint=new m;markerUniforms={uPixelRatio:{value:1},uSelected:{value:-1},uHovered:{value:-1}};fileOffsets=[];fileOrigin=new m;fileBorn=0;fileUniforms={uTime:{value:0},uBorn:{value:0},uMotion:{value:1},uOrigin:{value:new m}};lineUniforms={uCutoff:{value:160},uReveal:{value:1}};preferences={...Be};trailUniforms={uTrailTime:{value:0},uTrailFlow:{value:0},uTrailSpeed:{value:.5},uTrailOpacity:{value:1}};stars;transform=new T;onSelect;onHover;onEvent;onEventHover;contextLost=e=>{e.preventDefault(),this.container.dispatchEvent(new CustomEvent("scene-error",{detail:"The graphics context was lost. Reload to restore the 3D view; the session list is still available."}))};addStars(){const e=[];for(let i=0;i<280;i++)e.push((A(`sx${i}`)-.5)*1100,(A(`sy${i}`)-.5)*700,-120-A(`sz${i}`)*500);const t=new C;t.setAttribute("position",new k(e,3)),this.stars=new U(t,new ge({color:"#7b9fa9",size:.4,transparent:!0,opacity:.18,sizeAttenuation:!0})),this.scene.add(this.stars)}applyPreferences(e){const t=this.preferences;this.preferences={...e};const i=Ge(e,matchMedia("(prefers-reduced-motion: reduce)").matches);if(i!==this.motion&&this.setMotion(i),e.view==="2d"!==this.flat&&this.setFlat(e.view==="2d"),e.quality!==t.quality){const o=e.quality==="performance"?1:e.quality==="high"?Math.min(Math.max(devicePixelRatio,2),2.5):Math.min(Math.max(devicePixelRatio,1.5),2),n=e.quality==="performance"?0:Math.min(4,this.renderer.capabilities.maxSamples);for(const a of[this.composer.renderTarget1,this.composer.renderTarget2])a.samples=n,a.dispose();this.smaa.enabled=e.quality!=="performance",this.renderer.setPixelRatio(o),this.composer.setPixelRatio(o),this.resize()}this.bloom.strength=e.bloom/100,this.bloom.enabled=e.quality!=="performance"&&e.bloom>0,this.stars&&(this.stars.visible=e.stars),this.labelLayer.hidden=!e.labels,this.trailUniforms.uTrailOpacity.value=e.trailOpacity/42,this.trailUniforms.uTrailSpeed.value=e.trailSpeed/100;for(const o of[this.graphGroup,this.selectionGroup])for(const n of o.children)n.userData.kind==="lifetime"&&(n.visible=e.trails==="all"||e.trails==="selected"&&o===this.selectionGroup),n.userData.kind==="relationship"&&(n.visible=e.relationships);const s=this.selectionGroup.getObjectByName("event-markers");s&&(s.visible=e.messageDots),this.nodeMesh&&t.nodeScale!==e.nodeScale&&(this.nodeMesh.boundingSphere=null,this.revealsActive=!0),this.dirty=!0}setGraph(e,t=!1){if(this.pickingDirty=!0,this.dirty=!0,E(this.graphGroup),E(this.selectionGroup),E(this.filesGroup),this.eventMarkers=[],this.eventIcons=[],this.fileMesh=void 0,this.fileOffsets=[],this.labels=[],this.labelLayer.replaceChildren(),this.graph=e,this.playbackPath=void 0,this.playbackRadii=[],this.nodeByID=new Map(e.nodes.map(f=>[f.session.id,f])),this.nodeIndices=new Map(e.nodes.map((f,v)=>[f.session.id,v])),this.focusUniforms.uSelected.value=this.selected?this.nodeIndices.get(this.selected)??-1:-1,this.focusUniforms.uHovered.value=-1,this.hovered=null,this.nodeMesh=void 0,this.pickMesh=void 0,this.glowMaterial=void 0,this.graphBorn=this.time,this.nodeReveal=new Float32Array(e.nodes.length).fill(this.motion?0:1),this.revealsActive=this.motion&&e.nodes.length>0,!e.nodes.length)return;const i=new ye(1,32,20),s=Float32Array.from(e.nodes,(f,v)=>v);i.setAttribute("nodeIndex",new Me(s,1));const o=new I(i,De(this.focusUniforms),e.nodes.length);o.scale.z=this.flat?1e3:1,o.instanceMatrix.setUsage(L);const n=new T,a=[],r=[],h=[];e.nodes.forEach((f,v)=>{n.position.fromArray(f.position),this.flat&&(n.position.z*=.001),n.scale.setScalar(f.radius*this.preferences.nodeScale/100),n.updateMatrix(),o.setMatrixAt(v,n.matrix);const M=V(f);o.setColorAt(v,M),a.push(...f.position),r.push(...M.toArray()),h.push(f.radius*11)}),o.instanceMatrix.needsUpdate=!0,o.computeBoundingSphere(),this.nodeMesh=o,this.pickMesh=new X(i,o.material),this.graphGroup.add(o);const l=new C;l.setAttribute("position",new k(a,3)),l.setAttribute("color",new k(r,3)),l.setAttribute("size",new k(h,1)),l.setAttribute("nodeIndex",new W(s,1)),this.revealAttribute=new W(this.nodeReveal,1).setUsage(L),l.setAttribute("reveal",this.revealAttribute),this.glowMaterial=new D({uniforms:{...this.focusUniforms,uCutoff:{value:151},uScale:{value:this.container.clientHeight*this.renderer.getPixelRatio()*.9}},vertexShader:`${ee}
32
- attribute float size; attribute float reveal; varying vec3 vColor; varying float vVisible; uniform float uScale; uniform float uCutoff;
33
- void main() { vColor = color; vVisible = reveal; vNodeEmphasis = nodeEmphasis(); vec4 mv = modelViewMatrix * vec4(position, 1.0);
34
- gl_PointSize = clamp(size * (1.0 + sin(reveal * 3.14159) * .45) * uScale / -mv.z, 2.0, 100.0); gl_Position = projectionMatrix * mv; }`,fragmentShader:`varying vec3 vColor; varying float vVisible; varying float vNodeEmphasis;
35
- void main() { float d = length(gl_PointCoord - .5) * 2.0; if (d > 1.0) discard;
36
- float a = pow(1.0 - d, 3.1) * .34 * vVisible * vNodeEmphasis; gl_FragColor = vec4(vColor * 1.15, a); }`,vertexColors:!0,transparent:!0,depthWrite:!1,blending:O}),this.graphGroup.add(new U(l,this.glowMaterial));const p=[],c=[];for(const f of e.nodes)this.appendSegments([new m(...f.startPosition),new m(...f.position)],V(f),p,c);this.addLines(p,c,.42,this.graphGroup,"lifetime"),e.lanes.forEach((f,v)=>{const M=Math.min(...f.nodes.map(w=>w.startPosition[0]));v<12&&this.addLabel(f.label,new m(M-4,f.y+8,f.z),f.color)});const u=[],d=[];for(const f of e.edges){const v=this.nodeByID.get(f.from),M=this.nodeByID.get(f.to),w=this.edgeCurve(...Z(v,M));this.appendSegments(w.getPoints(22),new B(f.kind==="fork"?"#edbc8d":"#bda6ef"),u,d)}this.addLines(u,d,.7,this.graphGroup,"relationship");const b=[],g=[];for(let f=0;f<=8;f++){const v=-150+f*37.5;this.appendSegments([new m(v,-105,-70),new m(v,-105,70)],new B("#314149"),b,g)}this.addLines(b,g,.23),this.setCutoff(this.cutoff),this.selected&&this.select(this.selected),t&&this.reset()}appendSegments(e,t,i,s){for(let o=1;o<e.length;o++)i.push(...e[o-1].toArray(),...e[o].toArray()),s.push(t.r,t.g,t.b,t.r,t.g,t.b)}buildPlaybackPath(){if(this.playbackPath=void 0,this.playbackRadii=[],!this.graph.nodes.length)return;const e=this.graph.nodes.map(s=>new m(...s.position)),t=new H().setFromPoints(e).getBoundingSphere(new N),i=[];for(let s=0;s<=100;s++){const o=s/100,n=o*300-150,a=new m,r=new H;let h=0;for(const u of e){const d=u.x-n,b=Math.exp(-(((d+6)/24)**2));a.addScaledVector(u,b),h+=b,d>=-38&&d<=12&&r.expandByPoint(u)}a.divideScalar(h);const l=r.isEmpty()?new N(a,0):r.getBoundingSphere(new N),p=Math.max(65,l.radius+l.center.distanceTo(a)),c=x.smoothstep(o,.86,1);a.lerp(t.center,c*.65),i.push(a),this.playbackRadii.push(x.lerp(p,t.radius+20,c))}this.playbackPath=new we(i)}setPlaying(e){this.playing!==e&&(this.playing=e,e&&(this.focusedSession=null,this.camera.clearViewOffset()),e&&this.motion&&(this.playbackPath||this.buildPlaybackPath(),this.targetPosition=void 0,this.targetLook=void 0,this.playbackSphere.setFromVector3(this.camera.position.clone().sub(this.controls.target))),this.dirty=!0)}animatePlaybackCamera(e){if(!this.playing||!this.motion||!this.playbackPath)return!1;this.playbackPath.getPoint(this.cutoff,this.playbackFocus),this.flat&&(this.playbackFocus.z=0);const t=this.cutoff*(this.playbackRadii.length-1),i=Math.floor(t),s=Math.min(i+1,this.playbackRadii.length-1),o=x.lerp(this.playbackRadii[i],this.playbackRadii[s],t-i),n=x.degToRad(this.camera.fov)/2,a=Math.min(n,Math.atan(Math.tan(n)*this.camera.aspect)),r=x.clamp(o/Math.sin(a)*1.08,160,1100),h=this.flat?0:-.3+this.cutoff*Math.PI,l=this.flat?0:.16+Math.sin(this.cutoff*Math.PI)*.12,p=Math.atan2(Math.sin(h-this.playbackSphere.theta),Math.cos(h-this.playbackSphere.theta));return this.playbackSphere.theta+=p*(1-Math.exp(-3*e)),this.playbackSphere.phi=x.damp(this.playbackSphere.phi,Math.PI/2-l,1.5,e),this.playbackSphere.radius=x.damp(this.playbackSphere.radius,r,1.25,e),this.controls.target.lerp(this.playbackFocus,1-Math.exp(-2.1*e)),this.camera.position.copy(this.controls.target).add(this.playbackOffset.setFromSpherical(this.playbackSphere)),!0}addLines(e,t,i,s=this.graphGroup,o="grid"){if(!e.length)return;const n=new C;n.setAttribute("position",new k(e,3)),n.setAttribute("color",new k(t,3));const a=new be({vertexColors:!0,transparent:!0,opacity:i,depthWrite:!1,blending:O,clippingPlanes:s!==this.filesGroup?[this.clipPlane]:[]});s!==this.filesGroup&&(a.onBeforeCompile=h=>{h.uniforms.uTimelineCutoff=this.lineUniforms.uCutoff,h.uniforms.uGraphReveal=this.lineUniforms.uReveal,h.uniforms.uContextFocus=s===this.graphGroup?this.focusUniforms.uFocus:{value:0},Object.assign(h.uniforms,this.trailUniforms),h.vertexShader=`varying float vTimelineX;
37
- ${h.vertexShader}`.replace("#include <begin_vertex>",`#include <begin_vertex>
38
- vTimelineX = position.x;`),h.fragmentShader=`varying float vTimelineX; uniform float uTimelineCutoff; uniform float uGraphReveal; uniform float uContextFocus;
39
- ${h.fragmentShader}`.replace("#include <color_fragment>",`#include <color_fragment>
40
- diffuseColor.a *= smoothstep(0.0, 4.0, uTimelineCutoff - vTimelineX) * uGraphReveal * mix(1.0, .45, uContextFocus);`),o==="lifetime"&&(h.fragmentShader=`uniform float uTrailTime; uniform float uTrailFlow; uniform float uTrailSpeed; uniform float uTrailOpacity;
41
- ${h.fragmentShader}`.replace("#include <color_fragment>",`#include <color_fragment>
42
- diffuseColor.a *= uTrailOpacity * mix(1.0, .84 + .16 * pow(.5 + .5 * sin(vTimelineX * .28 - uTrailTime * uTrailSpeed * 2.2), 4.0), uTrailFlow);`))}),a.customProgramCacheKey=()=>o;const r=new q(n,a);r.userData.kind=o,r.visible=o==="lifetime"?this.preferences.trails==="all"||this.preferences.trails==="selected"&&s===this.selectionGroup:o!=="relationship"||this.preferences.relationships,s.add(r)}edgeCurve(e,t){const i=new m(...e),s=new m(...t),o=(e[0]+t[0])/2,n=Math.abs(e[1]-t[1])<8?9:0;return new xe(i,new m(o,e[1]+n,e[2]),new m(o,t[1]+n,t[2]),s)}addLabel(e,t,i,s=!1){const o=document.createElement("div");o.className=s?"scene-label selected-label":"scene-label",o.textContent=e,o.style.setProperty("--label-color",i),this.labelLayer.append(o);const n={element:o,point:t,priority:s};s?this.labels.unshift(n):this.labels.push(n)}select(e){this.pickingDirty=!0,this.dirty=!0,this.selected!==e&&(this.selectedEvent=null,this.focusedEvent=void 0),this.selected=e,this.focusUniforms.uSelected.value=e?this.nodeIndices.get(e)??-1:-1,E(this.selectionGroup),E(this.filesGroup),this.eventMarkers=[],this.clearEventIcons(),this.fileMesh=void 0,this.fileOffsets=[],this.labels=this.labels.filter(r=>(r.priority&&r.element.remove(),!r.priority));const t=e?this.nodeByID.get(e):void 0;if(!t)return;const i=new X(new ke(t.radius*2.1,t.radius*2.35,96),new j({color:"#e1fff4",side:Se,transparent:!0,opacity:.9,depthTest:!1}));i.position.fromArray(t.position),i.name="selection-ring",this.selectionGroup.add(i);const s=[],o=[],n=[],a=[];this.appendSegments([new m(...t.startPosition),new m(...t.position)],V(t).multiplyScalar(1.4),n,a),this.addLines(n,a,1,this.selectionGroup,"lifetime");for(const r of this.graph.edges.filter(h=>h.from===e||h.to===e)){const h=this.nodeByID.get(r.from),l=this.nodeByID.get(r.to);this.appendSegments(this.edgeCurve(...Z(h,l)).getPoints(30),new B("#f3dfbd").multiplyScalar(1.8),s,o)}this.addLines(s,o,1,this.selectionGroup,"relationship"),this.addLabel(t.session.title.slice(0,52),new m(...t.position).add(new m(0,6,0)),"#e6f3ef",!0),this.setCutoff(this.cutoff)}setEvents(e){this.pickingDirty=!0;const t=this.selectionGroup.getObjectByName("event-markers");t&&(E(t),t.removeFromParent()),this.eventMarkers=[],this.clearEventIcons(),this.dirty=!0;const i=this.selected?this.nodeByID.get(this.selected):void 0;if(!i)return;const s=[],o=e.slice(-2e3);this.focusedEvent&&!o.some(c=>c.id===this.focusedEvent.id)&&o.push(this.focusedEvent);for(const c of o){if(c.time===null||c.kind==="message"&&c.time===i.session.activity?.lastMessageAt)continue;const u=K(c.time,this.graph);if(!Number.isFinite(u)||u<i.startPosition[0]||u>i.position[0])continue;const d=new m(...J(i,u));this.eventMarkers.push({item:c,position:d}),s.push(...d.toArray())}if(!s.length)return;const n=new C;n.setAttribute("position",new k(s,3)),n.setAttribute("markerIndex",new k(this.eventMarkers.map((c,u)=>u),1)),this.markerUniforms.uPixelRatio.value=this.renderer.getPixelRatio(),this.markerUniforms.uHovered.value=-1,this.selectEvent(this.selectedEvent);const a=new D({uniforms:{uCutoff:this.lineUniforms.uCutoff,...this.markerUniforms},transparent:!0,depthWrite:!1,depthTest:!1,vertexShader:`uniform float uPixelRatio; uniform float uSelected; uniform float uHovered; attribute float markerIndex; varying float vTimeX; varying float vActive;
43
- void main() { vTimeX = position.x; vActive = float(abs(markerIndex-uSelected)<.1 || abs(markerIndex-uHovered)<.1); gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); gl_PointSize = mix(6.5,10.0,vActive) * uPixelRatio; }`,fragmentShader:`uniform float uCutoff; varying float vTimeX; varying float vActive;
44
- void main() { float d = length(gl_PointCoord - .5) * 2.0; if (d > 1.0 || vTimeX > uCutoff) discard;
45
- gl_FragColor = vec4(vec3(1.3 + vActive * .2), 1.0 - smoothstep(.5, 1.0, d)); }`}),r=new F;r.name="event-markers",r.visible=this.preferences.messageDots;const h=new U(n,a);h.renderOrder=10,r.add(h),this.selectionGroup.add(r);const l=this.eventMarkers.length-1,p=new Set;for(let c=l;c>=Math.max(0,l-31);c--)p.add(c);for(let c=0;c<32&&l>31;c++)p.add(Math.floor(c*(l-32)/31));for(const c of[...p].sort((u,d)=>d-u)){const u=document.createElement("div");u.className="event-marker-icon",u.setAttribute("aria-hidden","true"),u.append(Oe(this.eventMarkers[c].item)),this.labelLayer.append(u),this.eventIcons.push({element:u,marker:c,visible:!1,transform:""})}this.focusedSession===this.selected&&this.selected&&this.focus(this.selected)}clearEventIcons(){for(const e of this.eventIcons)e.element.remove();this.eventIcons=[]}selectEvent(e){this.selectedEvent=e,e||(this.focusedEvent=void 0),this.markerUniforms.uSelected.value=this.eventMarkers.findIndex(t=>t.item.id===e),this.dirty=!0}focusEvent(e){this.focusedSession=null;const t=this.selected?this.nodeByID.get(this.selected):void 0;if(!t||e.time===null)return;const i=K(e.time,this.graph);!Number.isFinite(i)||i<t.startPosition[0]||i>t.position[0]||(this.focusedEvent={...e,preview:"preview"in e?e.preview:(e.text||e.input||e.output||"").slice(0,180)},this.eventMarkers.some(s=>s.item.id===e.id)||this.setEvents(this.eventMarkers.map(s=>s.item)),this.selectEvent(e.id),this.focusPoint(new m(...J(t,i)),100))}setFiles(e){this.dirty=!0,E(this.filesGroup),this.fileMesh=void 0,this.fileOffsets=[];const t=this.selected?this.nodeByID.get(this.selected):void 0;if(!t)return;const i=[],s=[],o=e.slice(0,80);if(!o.length)return;const n=new Pe(.55),a=new j({color:"#edc899"}),r=new I(n,a,o.length);r.instanceMatrix.setUsage(L),r.frustumCulled=!1,this.fileMesh=r,this.fileBorn=this.time,this.fileOrigin.fromArray(t.position),this.fileUniforms.uOrigin.value.copy(this.fileOrigin),this.fileUniforms.uBorn.value=this.fileBorn;const h=new T;if(o.forEach((l,p)=>{const c=p*2.399963,u=9+Math.sqrt(p)*2.5,d=[t.position[0]+Math.cos(c)*u,t.position[1]+Math.sin(c)*u,t.position[2]+6+A(l.path)*8];this.fileOffsets.push(new m(...d).sub(this.fileOrigin)),h.position.fromArray(d),h.scale.setScalar(this.motion?0:1),h.updateMatrix(),r.setMatrixAt(p,h.matrix);const b=this.edgeCurve(t.position,d).getPoints(24);for(let g=1;g<b.length;g++)i.push(...b[g-1].toArray(),...b[g].toArray()),s.push(p*.018,p*.018)}),r.instanceMatrix.needsUpdate=!0,this.filesGroup.add(r),i.length){const l=new C;l.setAttribute("position",new k(i,3)),l.setAttribute("delay",new k(s,1));const p=new D({uniforms:this.fileUniforms,transparent:!0,depthWrite:!1,blending:O,vertexShader:`attribute float delay; uniform vec3 uOrigin; uniform float uTime; uniform float uBorn; uniform float uMotion; varying float vAlpha;
46
- void main() { float t = uMotion > .5 ? clamp((uTime-uBorn-delay)/.85,0.0,1.0) : 1.0; float p = 1.0-pow(1.0-t,3.0);
47
- vec3 offset = (position-uOrigin)*p; float a = uMotion > .5 ? sin(uTime*.22)*.035 : 0.0;
48
- offset.xy = mat2(cos(a),sin(a),-sin(a),cos(a))*offset.xy;
49
- vAlpha = smoothstep(0.0,.3,t)*.34; gl_Position = projectionMatrix*modelViewMatrix*vec4(uOrigin+offset,1.0); }`,fragmentShader:"varying float vAlpha; void main(){gl_FragColor=vec4(.78,.57,.32,vAlpha);}"});this.filesGroup.add(new q(l,p))}}focus(e){const t=this.nodeByID.get(e);if(!t)return;this.selected!==e&&this.select(e),this.focusedSession=e;const i=this.eventMarkers.filter(h=>h.item.kind==="message").slice(-12),s=t.position[0]-t.startPosition[0],o=Math.min(s,60,Math.max(8,i.length?t.position[0]-i[0].position.x:Math.min(40,s*.3))),n=new m(...t.position);n.x-=o/2;const a=this.focusArea(),r=Math.max(85,(o+18)*this.height/Math.max(160,a.width)/(2*Math.tan(Math.PI/8)));this.focusPoint(n,Math.min(r,220))}focusPoint(e,t){this.flat&&(e.z=0),this.frameFocus(),this.targetLook=e,this.targetPosition=e.clone().add(new m(0,this.flat?0:20,t)),this.dirty=!0}focusArea(){const e=this.container.clientWidth,t=this.container.clientHeight;let i=16,s=e-16,o=e>=760?92:72,n=t-24;const a=document.getElementById("inspector"),r=document.getElementById("explorer");if(e>=760)i=r&&!r.hidden?r.getBoundingClientRect().right+24:i,s=a&&!a.hidden?a.getBoundingClientRect().left-24:s,s-i<160&&(i=16,s=e-16);else if(a&&!a.hidden){const l=a.getBoundingClientRect();l.top>160&&(n=Math.min(n,l.top-20))}const h=document.getElementById("timeline");if(h&&!h.hidden){const l=h.getBoundingClientRect();l.top>o+160&&(n=Math.min(n,l.top-24))}return{x:(i+s)/2,y:(o+n)/2,width:s-i,height:n-o}}frameFocus(){const e=this.container.clientWidth,t=this.container.clientHeight,{x:i,y:s}=this.focusArea();this.camera.setViewOffset(e,t,e/2-i,t/2-s,e,t)}reset(){if(this.focusedSession=null,this.camera.clearViewOffset(),!this.graph.nodes.length)return;const e=new H().setFromPoints(this.graph.nodes.flatMap(r=>[new m(...r.startPosition),new m(...r.position)])),t=e.getSize(new m),i=e.getCenter(new m);this.flat&&(i.z=0);const s=2*Math.tan(x.degToRad(22.5)),o=(t.y+30)/s,n=(t.x+50)/(s*this.camera.aspect),a=Math.max(o,n,100)+(this.flat?0:t.z/2+20);this.targetLook=i,this.targetPosition=i.clone().add(new m(this.flat?0:18,this.flat?0:45,a))}setFlat(e){this.dirty=!0,this.flat=e,this.controls.enableRotate=!e;for(const t of[this.graphGroup,this.selectionGroup,this.filesGroup])t.scale.z=e?.001:1;this.nodeMesh&&(this.nodeMesh.scale.z=e?1e3:1,this.nodeMesh.boundingSphere=null),this.revealsActive=!0,(!this.playing||!this.motion)&&this.reset()}setMotion(e){this.motion=e,e&&this.playing&&!this.playbackPath&&this.buildPlaybackPath(),e&&this.playing&&this.playbackSphere.setFromVector3(this.camera.position.clone().sub(this.controls.target)),this.labelLayer.dataset.motion=String(e),this.revealsActive=this.graph.nodes.length>0,this.dirty=!0}setSuspended(e){this.suspended=e,this.previousFrame=performance.now(),this.dirty=!0}diagnostics(){return{camera:this.camera.position.toArray(),target:this.controls.target.toArray(),nodes:this.graph.nodes.length,edges:this.graph.edges.length,xRange:[Math.min(...this.graph.nodes.map(e=>e.position[0])),Math.max(...this.graph.nodes.map(e=>e.position[0]))],yRange:[Math.min(...this.graph.nodes.map(e=>e.position[1])),Math.max(...this.graph.nodes.map(e=>e.position[1]))],calls:this.renderer.info.render.calls,geometries:this.renderer.info.memory.geometries,msaaSamples:this.composer.renderTarget1.samples,smaa:this.smaa.enabled,pixelRatio:this.renderer.getPixelRatio(),cutoff:this.cutoff,selectedVisible:this.selectionGroup.visible,selectedNode:this.selected,selectedPosition:this.selected?this.nodeByID.get(this.selected)?.position:void 0,focusDimming:this.focusUniforms.uFocus.value,nodeSegments:this.nodeMesh?.geometry.parameters.widthSegments,eventMarkers:this.eventMarkers.length,eventIcons:this.eventIcons.filter(e=>e.visible).length,focusArea:this.focusArea(),selectedScreen:this.selected&&this.nodeByID.has(this.selected)?(()=>{const e=new m(...this.nodeByID.get(this.selected).position);return this.flat&&(e.z=0),e.project(this.camera),[(e.x+1)/2*this.width,(1-e.y)/2*this.height]})():void 0,selectedEvent:this.selectedEvent,selectedEventPosition:this.eventMarkers.find(e=>e.item.id===this.selectedEvent)?.position.toArray(),markerSamples:this.eventMarkers.slice(0,30).map(({item:e,position:t})=>{const i=t.clone();return this.flat&&(i.z*=.001),i.project(this.camera),{id:e.id,kind:e.kind,x:(i.x+1)/2*this.container.clientWidth,y:(1-i.y)/2*this.container.clientHeight}}),sessionTrails:this.graph.nodes.filter(e=>e.position[0]>e.startPosition[0]).length,renderedFrames:this.renderer.info.render.frame,revealingNodes:this.revealsActive,revealedNodes:this.nodeReveal.filter(e=>e>.95).length,fileSatellites:this.fileOffsets.length,fileRevealProgress:this.motion?Math.min(1,(this.time-this.fileBorn)/(.85+this.fileOffsets.length*.018)):1,motion:this.motion,suspended:this.suspended,playbackFollowing:this.playing&&this.motion&&!!this.playbackPath,playbackFocus:this.playbackFocus.toArray(),flat:this.flat,preferences:{...this.preferences}}}setCutoff(e){if(this.dirty=!0,this.cutoff=x.clamp(e,0,1),!this.nodeMesh)return;const t=e*300-150+.001;this.clipPlane.constant=t,this.lineUniforms.uCutoff.value=e>=1?160:t,this.revealsActive=!0;const i=this.selected?this.nodeByID.get(this.selected):void 0;i&&i.position[0]<=t&&!this.filesGroup.visible&&(this.fileBorn=this.time,this.fileUniforms.uBorn.value=this.fileBorn),this.selectionGroup.visible=!i||i.startPosition[0]<=t,this.filesGroup.visible=!i||i.position[0]<=t;const s=this.selectionGroup.getObjectByName("selection-ring");s&&(s.visible=!i||i.position[0]<=t),this.glowMaterial&&(this.glowMaterial.uniforms.uCutoff.value=t)}animateNodes(e){if(!this.nodeMesh||!this.revealsActive)return;this.pickingDirty=!0;let t=!1;for(let i=0;i<this.graph.nodes.length;i++){const s=this.graph.nodes[i],o=(s.position[0]+150)/300*.45,n=s.position[0]<=this.clipPlane.constant&&(!this.motion||this.time-this.graphBorn>=o)?1:0,a=this.nodeReveal[i];let r=this.motion?x.damp(a,n,n?9:14,e):n;Math.abs(r-n)<.002&&(r=n),(r!==n||this.motion&&this.time-this.graphBorn<.46)&&(t=!0),this.nodeReveal[i]=r,this.transform.position.fromArray(s.position),this.flat&&(this.transform.position.z*=.001),this.transform.scale.setScalar(s.radius*this.preferences.nodeScale/100*r*(1+Math.sin(r*Math.PI)*.12)),this.transform.updateMatrix(),this.nodeMesh.setMatrixAt(i,this.transform.matrix)}this.nodeMesh.instanceMatrix.needsUpdate=!0,this.revealAttribute&&(this.revealAttribute.needsUpdate=!0),this.revealsActive=t}animateFiles(){if(this.fileUniforms.uTime.value=this.time,this.fileUniforms.uMotion.value=Number(this.motion),!this.fileMesh)return;const e=this.motion?Math.sin(this.time*.22)*.035:0,t=Math.cos(e),i=Math.sin(e);this.fileOffsets.forEach((s,o)=>{const a=1-(1-(this.motion?x.clamp((this.time-this.fileBorn-o*.018)/.85,0,1):1))**3;this.transform.position.set((s.x*t-s.y*i)*a,(s.x*i+s.y*t)*a,s.z*a).add(this.fileOrigin),this.transform.scale.setScalar(a),this.transform.rotation.set(this.motion?this.time*.18+o:0,this.motion?this.time*.24+o:0,Math.PI/4),this.transform.updateMatrix(),this.fileMesh.setMatrixAt(o,this.transform.matrix)}),this.fileMesh.instanceMatrix.needsUpdate=!0,this.transform.rotation.set(0,0,0)}updatePicking(){if(!this.pickingDirty&&this.pickingView.equals(this.camera.matrixWorldInverse)&&this.pickingProjection.equals(this.camera.projectionMatrix))return;this.pickingView.copy(this.camera.matrixWorldInverse),this.pickingProjection.copy(this.camera.projectionMatrix),this.nodeGrid.clear(),this.markerGrid.clear();const e=new m,t=new m;this.graph.nodes.forEach((i,s)=>{if(e.fromArray(i.position),this.flat&&(e.z*=.001),t.copy(e).applyMatrix4(this.camera.matrixWorldInverse),e.project(this.camera),e.z<-1||e.z>1)return;const o=this.nodeReveal[s],n=i.radius*this.preferences.nodeScale/100*o*(1+Math.sin(o*Math.PI)*.12),a=-t.z,r=Math.max(.001,a-n),h=this.width/2*Math.abs(this.camera.projectionMatrix.elements[0])*n*(1+Math.abs(t.x)/a)/r,l=this.height/2*Math.abs(this.camera.projectionMatrix.elements[5])*n*(1+Math.abs(t.y)/a)/r,p=(e.x+1)/2*this.width,c=(1-e.y)/2*this.height;this.nodeGrid.add({index:s,x:p,y:c},p,c,Math.max(12,h,l),this.width,this.height)}),this.eventMarkers.forEach(({position:i},s)=>{if(e.copy(i),this.flat&&(e.z*=.001),e.project(this.camera),e.z<-1||e.z>1)return;const o=(e.x+1)/2*this.width,n=(1-e.y)/2*this.height;this.markerGrid.add({index:s,x:o,y:n},o,n,22,this.width,this.height)}),this.pickingDirty=!1}pick(e){if(!this.nodeMesh||!this.pickMesh)return null;this.updatePicking();const t=this.renderer.domElement.getBoundingClientRect(),i=e.clientX-t.left,s=e.clientY-t.top;this.pointer.set(i/this.width*2-1,-s/this.height*2+1),this.raycaster.setFromCamera(this.pointer,this.camera);let o=null,n=1/0,a=null,r=e.pointerType==="touch"?12:6;for(const h of this.nodeGrid.at(i,s)){const l=this.graph.nodes[h.index];if(l.position[0]>this.clipPlane.constant)continue;this.nodeMesh.getMatrixAt(h.index,this.pickMatrix),this.pickMesh.matrixWorld.multiplyMatrices(this.nodeMesh.matrixWorld,this.pickMatrix),this.pickHits.length=0,this.pickMesh.raycast(this.raycaster,this.pickHits);for(const c of this.pickHits)c.distance<n&&(n=c.distance,o=l);const p=Math.hypot(h.x-i,h.y-s);p<r&&(a=l,r=p)}return o||a}pointerStart=e=>{this.pointerDown.set(e.clientX,e.clientY),this.onHover(null,0,0)};pickEvent(e){if(!this.preferences.messageDots||!this.selectionGroup.visible)return null;this.updatePicking();const t=this.renderer.domElement.getBoundingClientRect(),i=e.clientX-t.left,s=e.clientY-t.top;let o=1/0,n=-1,a=0;for(const r of this.markerGrid.at(i,s)){if(this.eventMarkers[r.index].position.x>this.lineUniforms.uCutoff.value)continue;const h=Math.hypot(r.x-i,r.y-s);h>(e.pointerType==="touch"?22:10)||(a++,h<o&&(o=h,n=r.index))}return n>=0?{index:n,item:this.eventMarkers[n].item,count:a}:null}pointerEnd=e=>{if(e.button!==0||this.pointerDown.distanceTo(new z(e.clientX,e.clientY))>5)return;const t=this.pickEvent(e);if(t){this.selectEvent(t.item.id),this.onEvent(t.item.id),this.focusEvent(t.item);return}const i=this.pick(e);i&&this.onSelect(i.session.id)};pointerMove=e=>{if(e.buttons)return;const t=this.pickEvent(e);this.markerUniforms.uHovered.value!==(t?.index??-1)&&(this.markerUniforms.uHovered.value=t?.index??-1,this.dirty=!0);const i=t?null:this.pick(e),s=i?.session.id||null;s!==this.hovered&&(this.hovered=s,this.focusUniforms.uHovered.value=s?this.nodeIndices.get(s)??-1:-1,this.dirty=!0),this.renderer.domElement.style.cursor=i||t?"pointer":"grab";const o=this.container.getBoundingClientRect();t?this.onEventHover(t.item,t.count,e.clientX-o.left,e.clientY-o.top):this.onHover(i,e.clientX-o.left,e.clientY-o.top)};pointerLeave=()=>{this.hovered=null,this.focusUniforms.uHovered.value=-1,this.markerUniforms.uHovered.value=-1,this.dirty=!0,this.onHover(null,0,0)};resize(){this.dirty=!0,this.pickingDirty=!0;const e=this.container.clientWidth,t=this.container.clientHeight;!e||!t||(this.width=e,this.height=t,this.camera.aspect=e/t,this.camera.view?.enabled&&this.frameFocus(),this.camera.updateProjectionMatrix(),this.renderer.setSize(e,t),this.composer.setSize(e,t),this.markerUniforms.uPixelRatio.value=this.renderer.getPixelRatio(),this.glowMaterial&&(this.glowMaterial.uniforms.uScale.value=t*this.renderer.getPixelRatio()*.9))}animate=()=>{this.frame=requestAnimationFrame(this.animate);const e=performance.now(),t=this.suspended?0:Math.min(.05,(e-this.previousFrame)/1e3);if(this.previousFrame=e,document.hidden||this.suspended&&!this.dirty)return;this.time+=t;const s=this.animatePlaybackCamera(t)||!!this.targetPosition;if(this.targetPosition&&this.targetLook){const d=this.motion&&!this.suspended?1-Math.exp(-4.7*t):1;this.camera.position.lerp(this.targetPosition,d),this.controls.target.lerp(this.targetLook,d),this.camera.position.distanceTo(this.targetPosition)<.05&&(this.targetPosition=void 0,this.targetLook=void 0)}const o=this.controls.update();this.camera.updateMatrixWorld();const n=this.selected?this.nodeByID.get(this.selected):void 0,a=this.preferences.focusDimming&&n&&n.position[0]<=this.clipPlane.constant?1:0,r=Math.abs(this.focusUniforms.uFocus.value-a)>.001;this.focusUniforms.uFocus.value=r&&this.motion&&!this.suspended?x.damp(this.focusUniforms.uFocus.value,a,10,t):a;const h=this.motion&&this.preferences.trailFlow&&this.preferences.trails!=="off";if(this.trailUniforms.uTrailTime.value=this.time,this.trailUniforms.uTrailFlow.value=Number(h),!this.dirty&&!o&&!s&&!r&&!this.revealsActive&&!h&&!(this.motion&&this.selected&&this.selectionGroup.visible))return;this.animateNodes(t),this.animateFiles(),this.lineUniforms.uReveal.value=this.motion?x.smoothstep(this.time-this.graphBorn,0,.9):1;const l=this.selectionGroup.getObjectByName("selection-ring");l&&(l.quaternion.copy(this.camera.quaternion),l.scale.setScalar(this.preferences.nodeScale/100*(this.motion?1+Math.sin(this.time*2)*.07:1)));const p=this.width,c=this.height,u=[];for(const d of this.labels){const b=d.point.clone();this.flat&&(b.z=0);const g=b.project(this.camera),f=d.priority?Math.min(260,p-24):155,v=(g.x*.5+.5)*p,M=d.priority?x.clamp(v-f/2,12,p-f-12):v,w=(-g.y*.5+.5)*c-(d.priority?24:0),te=u.some(S=>M<S.x+S.width+8&&M+f+8>S.x&&Math.abs(w-S.y)<26),G=(p>600||d.priority)&&!te&&M+f<=p-12&&d.point.x<=this.clipPlane.constant&&g.z<1&&g.z>-1&&Math.abs(g.x)<.95&&Math.abs(g.y)<.9;if(d.visible!==G&&(d.element.classList.toggle("visible",G),d.visible=G),G){const S=`translate(${M}px, ${w}px)`;d.transform!==S&&(d.element.style.transform=S,d.transform=S),u.push({x:M,y:w,width:f})}}for(const d of this.eventIcons){const b=this.eventMarkers[d.marker],g=this.iconPoint.copy(b.position);this.flat&&(g.z=0),g.project(this.camera);const f=(g.x+1)/2*p-6,v=(1-g.y)/2*c-25,M=this.preferences.messageDots&&this.selectionGroup.visible&&b.position.x<=this.clipPlane.constant&&g.z>-1&&g.z<1&&f>12&&f<p-24&&v>12&&v<c-30&&!u.some(w=>f<w.x+w.width+12&&f+24>w.x&&Math.abs(v-w.y)<24);if(M!==d.visible&&(d.element.classList.toggle("visible",M),d.visible=M),M){const w=`translate(${Math.round(f)}px, ${Math.round(v)}px)`;w!==d.transform&&(d.element.style.transform=w,d.transform=w),u.push({x:f,y:v,width:12})}}this.composer.render(),this.dirty=!1};dispose(){cancelAnimationFrame(this.frame),this.resizeObserver.disconnect(),this.controls.dispose(),this.scene.traverse(e=>{const t=e;e instanceof I&&e.dispose(),t.geometry?.dispose(),t.material&&(Array.isArray(t.material)?t.material:[t.material]).forEach(i=>i.dispose())});for(const e of this.composer.passes)e.dispose();this.composer.dispose(),this.renderer.dispose(),this.renderer.domElement.remove(),this.labelLayer.remove()}}export{_e as TimelineScene};