polly-graph 0.2.6 → 0.2.7

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.cjs CHANGED
@@ -10308,8 +10308,7 @@ var PhysicsWorkerManagerImpl = class {
10308
10308
  this.workerUrl = URL.createObjectURL(blob);
10309
10309
  this.worker = new Worker(this.workerUrl);
10310
10310
  this.setupWorkerEventListeners();
10311
- } catch (error) {
10312
- console.warn("Physics Worker initialization failed:", error);
10311
+ } catch {
10313
10312
  this.worker = null;
10314
10313
  }
10315
10314
  }
@@ -10323,11 +10322,18 @@ var PhysicsWorkerManagerImpl = class {
10323
10322
  * Runs D3 force simulation in a dedicated worker thread for consistent timing
10324
10323
  */
10325
10324
 
10326
- // Import D3 dependencies for force simulation
10327
- importScripts('https://cdn.jsdelivr.net/npm/d3-dispatch@3/dist/d3-dispatch.min.js');
10328
- importScripts('https://cdn.jsdelivr.net/npm/d3-quadtree@3/dist/d3-quadtree.min.js');
10329
- importScripts('https://cdn.jsdelivr.net/npm/d3-timer@3/dist/d3-timer.min.js');
10330
- importScripts('https://cdn.jsdelivr.net/npm/d3-force@3/dist/d3-force.min.js');
10325
+ // D3 modules embedded locally to avoid CDN dependency
10326
+ // D3 Dispatch v3.0.1
10327
+ !function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).d3=n.d3||{})}(this,(function(n){"use strict";var e={value:()=>{}};function t(){for(var n,e=0,t=arguments.length,o={};e<t;++e){if(!(n=arguments[e]+"")||n in o||/[\\s.]/.test(n))throw new Error("illegal type: "+n);o[n]=[]}return new r(o)}function r(n){this._=n}function o(n,e){return n.trim().split(/^|\\s+/).map((function(n){var t="",r=n.indexOf(".");if(r>=0&&(t=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:t}}))}function i(n,e){for(var t,r=0,o=n.length;r<o;++r)if((t=n[r]).name===e)return t.value}function f(n,t,r){for(var o=0,i=n.length;o<i;++o)if(n[o].name===t){n[o]=e,n=n.slice(0,o).concat(n.slice(o+1));break}return null!=r&&n.push({name:t,value:r}),n}r.prototype=t.prototype={constructor:r,on:function(n,e){var t,r=this._,l=o(n+"",r),a=-1,u=l.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<u;)if(t=(n=l[a]).type)r[t]=f(r[t],n.name,e);else if(null==e)for(t in r)r[t]=f(r[t],n.name,null);return this}for(;++a<u;)if((t=(n=l[a]).type)&&(t=i(r[t],n.name)))return t},copy:function(){var n={},e=this._;for(var t in e)n[t]=e[t].slice();return new r(n)},call:function(n,e){if((t=arguments.length-2)>0)for(var t,r,o=new Array(t),i=0;i<t;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(i=0,t=(r=this._[n]).length;i<t;++i)r[i].value.apply(e,o)},apply:function(n,e,t){if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(var r=this._[n],o=0,i=r.length;o<i;++o)r[o].value.apply(e,t)}},n.dispatch=t,Object.defineProperty(n,"__esModule",{value:!0})}))
10328
+
10329
+ // D3 Quadtree v3.0.1
10330
+ !function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).d3=t.d3||{})}(this,(function(t){"use strict";function i(t,i,e,n){if(isNaN(i)||isNaN(e))return t;var r,s,h,o,a,u,l,_,f,c=t._root,x={data:n},y=t._x0,d=t._y0,p=t._x1,v=t._y1;if(!c)return t._root=x,t;for(;c.length;)if((u=i>=(s=(y+p)/2))?y=s:p=s,(l=e>=(h=(d+v)/2))?d=h:v=h,r=c,!(c=c[_=l<<1|u]))return r[_]=x,t;if(o=+t._x.call(null,c.data),a=+t._y.call(null,c.data),i===o&&e===a)return x.next=c,r?r[_]=x:t._root=x,t;do{r=r?r[_]=new Array(4):t._root=new Array(4),(u=i>=(s=(y+p)/2))?y=s:p=s,(l=e>=(h=(d+v)/2))?d=h:v=h}while((_=l<<1|u)==(f=(a>=h)<<1|o>=s));return r[f]=c,r[_]=x,t}function e(t,i,e,n,r){this.node=t,this.x0=i,this.y0=e,this.x1=n,this.y1=r}function n(t){return t[0]}function r(t){return t[1]}function s(t,i,e){var s=new h(null==i?n:i,null==e?r:e,NaN,NaN,NaN,NaN);return null==t?s:s.addAll(t)}function h(t,i,e,n,r,s){this._x=t,this._y=i,this._x0=e,this._y0=n,this._x1=r,this._y1=s,this._root=void 0}function o(t){for(var i={data:t.data},e=i;t=t.next;)e=e.next={data:t.data};return i}var a=s.prototype=h.prototype;a.copy=function(){var t,i,e=new h(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return e;if(!n.length)return e._root=o(n),e;for(t=[{source:n,target:e._root=new Array(4)}];n=t.pop();)for(var r=0;r<4;++r)(i=n.source[r])&&(i.length?t.push({source:i,target:n.target[r]=new Array(4)}):n.target[r]=o(i));return e},a.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return i(this.cover(e,n),e,n,t)},a.addAll=function(t){var e,n,r,s,h=t.length,o=new Array(h),a=new Array(h),u=1/0,l=1/0,_=-1/0,f=-1/0;for(n=0;n<h;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(s=+this._y.call(null,e))||(o[n]=r,a[n]=s,r<u&&(u=r),r>_&&(_=r),s<l&&(l=s),s>f&&(f=s));if(u>_||l>f)return this;for(this.cover(u,l).cover(_,f),n=0;n<h;++n)i(this,o[n],a[n],t[n]);return this},a.cover=function(t,i){if(isNaN(t=+t)||isNaN(i=+i))return this;var e=this._x0,n=this._y0,r=this._x1,s=this._y1;if(isNaN(e))r=(e=Math.floor(t))+1,s=(n=Math.floor(i))+1;else{for(var h,o,a=r-e||1,u=this._root;e>t||t>=r||n>i||i>=s;)switch(o=(i<n)<<1|t<e,(h=new Array(4))[o]=u,u=h,a*=2,o){case 0:r=e+a,s=n+a;break;case 1:e=r-a,s=n+a;break;case 2:r=e+a,n=s-a;break;case 3:e=r-a,n=s-a}this._root&&this._root.length&&(this._root=u)}return this._x0=e,this._y0=n,this._x1=r,this._y1=s,this},a.data=function(){var t=[];return this.visit((function(i){if(!i.length)do{t.push(i.data)}while(i=i.next)})),t},a.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},a.find=function(t,i,n){var r,s,h,o,a,u,l,_=this._x0,f=this._y0,c=this._x1,x=this._y1,y=[],d=this._root;for(d&&y.push(new e(d,_,f,c,x)),null==n?n=1/0:(_=t-n,f=i-n,c=t+n,x=i+n,n*=n);u=y.pop();)if(!(!(d=u.node)||(s=u.x0)>c||(h=u.y0)>x||(o=u.x1)<_||(a=u.y1)<f))if(d.length){var p=(s+o)/2,v=(h+a)/2;y.push(new e(d[3],p,v,o,a),new e(d[2],s,v,p,a),new e(d[1],p,h,o,v),new e(d[0],s,h,p,v)),(l=(i>=v)<<1|t>=p)&&(u=y[y.length-1],y[y.length-1]=y[y.length-1-l],y[y.length-1-l]=u)}else{var w=t-+this._x.call(null,d.data),N=i-+this._y.call(null,d.data),g=w*w+N*N;if(g<n){var A=Math.sqrt(n=g);_=t-A,f=i-A,c=t+A,x=i+A,r=d.data}}return r},a.remove=function(t){if(isNaN(s=+this._x.call(null,t))||isNaN(h=+this._y.call(null,t)))return this;var i,e,n,r,s,h,o,a,u,l,_,f,c=this._root,x=this._x0,y=this._y0,d=this._x1,p=this._y1;if(!c)return this;if(c.length)for(;;){if((u=s>=(o=(x+d)/2))?x=o:d=o,(l=h>=(a=(y+p)/2))?y=a:p=a,i=c,!(c=c[_=l<<1|u]))return this;if(!c.length)break;(i[_+1&3]||i[_+2&3]||i[_+3&3])&&(e=i,f=_)}for(;c.data!==t;)if(n=c,!(c=c.next))return this;return(r=c.next)&&delete c.next,n?(r?n.next=r:delete n.next,this):i?(r?i[_]=r:delete i[_],(c=i[0]||i[1]||i[2]||i[3])&&c===(i[3]||i[2]||i[1]||i[0])&&!c.length&&(e?e[f]=c:this._root=c),this):(this._root=r,this)},a.removeAll=function(t){for(var i=0,e=t.length;i<e;++i)this.remove(t[i]);return this},a.root=function(){return this._root},a.size=function(){var t=0;return this.visit((function(i){if(!i.length)do{++t}while(i=i.next)})),t},a.visit=function(t){var i,n,r,s,h,o,a=[],u=this._root;for(u&&a.push(new e(u,this._x0,this._y0,this._x1,this._y1));i=a.pop();)if(!t(u=i.node,r=i.x0,s=i.y0,h=i.x1,o=i.y1)&&u.length){var l=(r+h)/2,_=(s+o)/2;(n=u[3])&&a.push(new e(n,l,_,h,o)),(n=u[2])&&a.push(new e(n,r,_,l,o)),(n=u[1])&&a.push(new e(n,l,s,h,_)),(n=u[0])&&a.push(new e(n,r,s,l,_))}return this},a.visitAfter=function(t){var i,n=[],r=[];for(this._root&&n.push(new e(this._root,this._x0,this._y0,this._x1,this._y1));i=n.pop();){var s=i.node;if(s.length){var h,o=i.x0,a=i.y0,u=i.x1,l=i.y1,_=(o+u)/2,f=(a+l)/2;(h=s[0])&&n.push(new e(h,o,a,_,f)),(h=s[1])&&n.push(new e(h,_,a,u,f)),(h=s[2])&&n.push(new e(h,o,f,_,l)),(h=s[3])&&n.push(new e(h,_,f,u,l))}r.push(i)}for(;i=r.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this},a.x=function(t){return arguments.length?(this._x=t,this):this._x},a.y=function(t){return arguments.length?(this._y=t,this):this._y},t.quadtree=s,Object.defineProperty(t,"__esModule",{value:!0})}))
10331
+
10332
+ // D3 Timer v3.0.1
10333
+ !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).d3=t.d3||{})}(this,(function(t){"use strict";var n,e,o=0,i=0,r=0,l=0,u=0,a=0,s="object"==typeof performance&&performance.now?performance:Date,c="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function f(){return u||(c(_),u=s.now()+a)}function _(){u=0}function m(){this._call=this._time=this._next=null}function p(t,n,e){var o=new m;return o.restart(t,n,e),o}function w(){f(),++o;for(var t,e=n;e;)(t=u-e._time)>=0&&e._call.call(void 0,t),e=e._next;--o}function d(){u=(l=s.now())+a,o=i=0;try{w()}finally{o=0,function(){var t,o,i=n,r=1/0;for(;i;)i._call?(r>i._time&&(r=i._time),t=i,i=i._next):(o=i._next,i._next=null,i=t?t._next=o:n=o);e=t,y(r)}(),u=0}}function h(){var t=s.now(),n=t-l;n>1e3&&(a-=n,l=t)}function y(t){o||(i&&(i=clearTimeout(i)),t-u>24?(t<1/0&&(i=setTimeout(d,t-s.now()-a)),r&&(r=clearInterval(r))):(r||(l=s.now(),r=setInterval(h,1e3)),o=1,c(d)))}m.prototype=p.prototype={constructor:m,restart:function(t,o,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?f():+i)+(null==o?0:+o),this._next||e===this||(e?e._next=this:n=this,e=this),this._call=t,this._time=i,y()},stop:function(){this._call&&(this._call=null,this._time=1/0,y())}},t.interval=function(t,n,e){var o=new m,i=n;return null==n?(o.restart(t,n,e),o):(o._restart=o.restart,o.restart=function(t,n,e){n=+n,e=null==e?f():+e,o._restart((function r(l){l+=i,o._restart(r,i+=n,e),t(l)}),n,e)},o.restart(t,n,e),o)},t.now=f,t.timeout=function(t,n,e){var o=new m;return n=null==n?0:+n,o.restart((e=>{o.stop(),t(e+n)}),n,e),o},t.timer=p,t.timerFlush=w,Object.defineProperty(t,"__esModule",{value:!0})}))
10334
+
10335
+ // D3 Force v3.0.0
10336
+ !function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-quadtree"),require("d3-dispatch"),require("d3-timer")):"function"==typeof define&&define.amd?define(["exports","d3-quadtree","d3-dispatch","d3-timer"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).d3=n.d3||{},n.d3,n.d3,n.d3)}(this,(function(n,t,e,r){"use strict";function i(n){return function(){return n}}function u(n){return 1e-6*(n()-.5)}function o(n){return n.x+n.vx}function f(n){return n.y+n.vy}function a(n){return n.index}function c(n,t){var e=n.get(t);if(!e)throw new Error("node not found: "+t);return e}const l=4294967296;function h(n){return n.x}function v(n){return n.y}var y=Math.PI*(3-Math.sqrt(5));n.forceCenter=function(n,t){var e,r=1;function i(){var i,u,o=e.length,f=0,a=0;for(i=0;i<o;++i)f+=(u=e[i]).x,a+=u.y;for(f=(f/o-n)*r,a=(a/o-t)*r,i=0;i<o;++i)(u=e[i]).x-=f,u.y-=a}return null==n&&(n=0),null==t&&(t=0),i.initialize=function(n){e=n},i.x=function(t){return arguments.length?(n=+t,i):n},i.y=function(n){return arguments.length?(t=+n,i):t},i.strength=function(n){return arguments.length?(r=+n,i):r},i},n.forceCollide=function(n){var e,r,a,c,l=1,h=1;function v(){for(var n,i,h,y,d,g,x,s=e.length,p=0;p<h;++p)for(i=t.quadtree(e,o,f).visitAfter(y),n=0;n<s;++n)h=e[n],g=r[h.index],x=g*g,y=h.x+h.vx,d=h.y+h.vy,i.visit(M);function M(n,t,e,r,i){var o=n.data,f=n.r,l=g+f;if(!o)return t>y+l||r<y-l||e>d+l||i<d-l;if(o.index>h.index){var v=y-o.x-o.vx,s=d-o.y-o.vy,p=v*v+s*s;p<l*l&&(0===v&&(p+=(v=u(a))*v),0===s&&(p+=(s=u(a))*s),p=(l-(p=Math.sqrt(p)))/p*c,h.vx+=(v*=p)*(l=(f*=f)/(x+f)),h.vy+=(s*=p)*l,o.vx-=v*(l=1-l),o.vy-=s*l)}}}function y(n){if(n.data)return n.r=r[n.data.index];for(var t=n.r=0;t<4;++t)n[t]&&n[t].r>n.r&&(n.r=n[t].r)}function d(){if(e){var t,i,u=e.length;for(r=new Array(u),t=0;t<u;++t)i=e[t],r[i.index]=+n(i,t,e)}}return"function"!=typeof n&&(n=i(null==n?1:+n)),v.initialize=function(n,t){e=n,a=t,d()},v.iterations=function(n){return arguments.length?(h=+n,v):h},v.strength=function(n){return arguments.length?(c=+n,v):c},v.radius=function(t){return arguments.length?(n="function"==typeof t?t:i(+t),d(),v):n},v},n.forceLink=function(n){var t,e,r,o,f,l,h=a,v=function(n){return 1/Math.min(o[n.source.index],o[n.target.index])},y=i(30),d=1;function g(r){for(var i=0,o=n.length;i<d;++i)for(var a,c,h,v,y,g,x,s=0;s<o;++s)c=(a=n[s]).source,v=(h=a.target).x+h.vx-c.x-c.vx||u(l),y=h.y+h.vy-c.y-c.vy||u(l),v*=g=((g=Math.sqrt(v*v+y*y))-e[s])/g*r*t[s],y*=g,h.vx-=v*(x=f[s]),h.vy-=y*x,c.vx+=v*(x=1-x),c.vy+=y*x}function x(){if(r){var i,u,a=r.length,l=n.length,v=new Map(r.map(((n,t)=>[h(n,t,r),n])));for(i=0,o=new Array(a);i<l;++i)(u=n[i]).index=i,"object"!=typeof u.source&&(u.source=c(v,u.source)),"object"!=typeof u.target&&(u.target=c(v,u.target)),o[u.source.index]=(o[u.source.index]||0)+1,o[u.target.index]=(o[u.target.index]||0)+1;for(i=0,f=new Array(l);i<l;++i)u=n[i],f[i]=o[u.source.index]/(o[u.source.index]+o[u.target.index]);t=new Array(l),s(),e=new Array(l),p()}}function s(){if(r)for(var e=0,i=n.length;e<i;++e)t[e]=+v(n[e],e,n)}function p(){if(r)for(var t=0,i=n.length;t<i;++t)e[t]=+y(n[t],t,n)}return null==n&&(n=[]),g.initialize=function(n,t){r=n,l=t,x()},g.links=function(t){return arguments.length?(n=t,x(),g):n},g.id=function(n){return arguments.length?(h=n,g):h},g.iterations=function(n){return arguments.length?(d=+n,g):d},g.strength=function(n){return arguments.length?(v="function"==typeof n?n:i(+n),s(),g):v},g.distance=function(n){return arguments.length?(y="function"==typeof n?n:i(+n),p(),g):y},g},n.forceManyBody=function(){var n,e,r,o,f,a=i(-30),c=1,l=1/0,y=.81;function d(r){var i,u=n.length,f=t.quadtree(n,h,v).visitAfter(x);for(o=r,i=0;i<u;++i)e=n[i],f.visit(s)}function g(){if(n){var t,e,r=n.length;for(f=new Array(r),t=0;t<r;++t)e=n[t],f[e.index]=+a(e,t,n)}}function x(n){var t,e,r,i,u,o=0,a=0;if(n.length){for(r=i=u=0;u<4;++u)(t=n[u])&&(e=Math.abs(t.value))&&(o+=t.value,a+=e,r+=e*t.x,i+=e*t.y);n.x=r/a,n.y=i/a}else{(t=n).x=t.data.x,t.y=t.data.y;do{o+=f[t.data.index]}while(t=t.next)}n.value=o}function s(n,t,i,a){if(!n.value)return!0;var h=n.x-e.x,v=n.y-e.y,d=a-t,g=h*h+v*v;if(d*d/y<g)return g<l&&(0===h&&(g+=(h=u(r))*h),0===v&&(g+=(v=u(r))*v),g<c&&(g=Math.sqrt(c*g)),e.vx+=h*n.value*o/g,e.vy+=v*n.value*o/g),!0;if(!(n.length||g>=l)){(n.data!==e||n.next)&&(0===h&&(g+=(h=u(r))*h),0===v&&(g+=(v=u(r))*v),g<c&&(g=Math.sqrt(c*g)));do{n.data!==e&&(d=f[n.data.index]*o/g,e.vx+=h*d,e.vy+=v*d)}while(n=n.next)}}return d.initialize=function(t,e){n=t,r=e,g()},d.strength=function(n){return arguments.length?(a="function"==typeof n?n:i(+n),g(),d):a},d.distanceMin=function(n){return arguments.length?(c=n*n,d):Math.sqrt(c)},d.distanceMax=function(n){return arguments.length?(l=n*n,d):Math.sqrt(l)},d.theta=function(n){return arguments.length?(y=n*n,d):Math.sqrt(y)},d},n.forceRadial=function(n,t,e){var r,u,o,f=i(.1);function a(n){for(var i=0,f=r.length;i<f;++i){var a=r[i],c=a.x-t||1e-6,l=a.y-e||1e-6,h=Math.sqrt(c*c+l*l),v=(o[i]-h)*u[i]*n/h;a.vx+=c*v,a.vy+=l*v}}function c(){if(r){var t,e=r.length;for(u=new Array(e),o=new Array(e),t=0;t<e;++t)o[t]=+n(r[t],t,r),u[t]=isNaN(o[t])?0:+f(r[t],t,r)}}return"function"!=typeof n&&(n=i(+n)),null==t&&(t=0),null==e&&(e=0),a.initialize=function(n){r=n,c()},a.strength=function(n){return arguments.length?(f="function"==typeof n?n:i(+n),c(),a):f},a.radius=function(t){return arguments.length?(n="function"==typeof t?t:i(+t),c(),a):n},a.x=function(n){return arguments.length?(t=+n,a):t},a.y=function(n){return arguments.length?(e=+n,a):e},a},n.forceSimulation=function(n){var t,i=1,u=.001,o=1-Math.pow(u,1/300),f=0,a=.6,c=new Map,h=r.timer(g),v=e.dispatch("tick","end"),d=function(){let n=1;return()=>(n=(1664525*n+1013904223)%l)/l}();function g(){x(),v.call("tick",t),i<u&&(h.stop(),v.call("end",t))}function x(e){var r,u,l=n.length;void 0===e&&(e=1);for(var h=0;h<e;++h)for(i+=(f-i)*o,c.forEach((function(n){n(i)})),r=0;r<l;++r)null==(u=n[r]).fx?u.x+=u.vx*=a:(u.x=u.fx,u.vx=0),null==u.fy?u.y+=u.vy*=a:(u.y=u.fy,u.vy=0);return t}function s(){for(var t,e=0,r=n.length;e<r;++e){if((t=n[e]).index=e,null!=t.fx&&(t.x=t.fx),null!=t.fy&&(t.y=t.fy),isNaN(t.x)||isNaN(t.y)){var i=10*Math.sqrt(.5+e),u=e*y;t.x=i*Math.cos(u),t.y=i*Math.sin(u)}(isNaN(t.vx)||isNaN(t.vy))&&(t.vx=t.vy=0)}}function p(t){return t.initialize&&t.initialize(n,d),t}return null==n&&(n=[]),s(),t={tick:x,restart:function(){return h.restart(g),t},stop:function(){return h.stop(),t},nodes:function(e){return arguments.length?(n=e,s(),c.forEach(p),t):n},alpha:function(n){return arguments.length?(i=+n,t):i},alphaMin:function(n){return arguments.length?(u=+n,t):u},alphaDecay:function(n){return arguments.length?(o=+n,t):+o},alphaTarget:function(n){return arguments.length?(f=+n,t):f},velocityDecay:function(n){return arguments.length?(a=1-n,t):1-a},randomSource:function(n){return arguments.length?(d=n,c.forEach(p),t):d},force:function(n,e){return arguments.length>1?(null==e?c.delete(n):c.set(n,p(e)),t):c.get(n)},find:function(t,e,r){var i,u,o,f,a,c=0,l=n.length;for(null==r?r=1/0:r*=r,c=0;c<l;++c)(o=(i=t-(f=n[c]).x)*i+(u=e-f.y)*u)<r&&(a=f,r=o);return a},on:function(n,e){return arguments.length>1?(v.on(n,e),t):v.on(n)}}},n.forceX=function(n){var t,e,r,u=i(.1);function o(n){for(var i,u=0,o=t.length;u<o;++u)(i=t[u]).vx+=(r[u]-i.x)*e[u]*n}function f(){if(t){var i,o=t.length;for(e=new Array(o),r=new Array(o),i=0;i<o;++i)e[i]=isNaN(r[i]=+n(t[i],i,t))?0:+u(t[i],i,t)}}return"function"!=typeof n&&(n=i(null==n?0:+n)),o.initialize=function(n){t=n,f()},o.strength=function(n){return arguments.length?(u="function"==typeof n?n:i(+n),f(),o):u},o.x=function(t){return arguments.length?(n="function"==typeof t?t:i(+t),f(),o):n},o},n.forceY=function(n){var t,e,r,u=i(.1);function o(n){for(var i,u=0,o=t.length;u<o;++u)(i=t[u]).vy+=(r[u]-i.y)*e[u]*n}function f(){if(t){var i,o=t.length;for(e=new Array(o),r=new Array(o),i=0;i<o;++i)e[i]=isNaN(r[i]=+n(t[i],i,t))?0:+u(t[i],i,t)}}return"function"!=typeof n&&(n=i(null==n?0:+n)),o.initialize=function(n){t=n,f()},o.strength=function(n){return arguments.length?(u="function"==typeof n?n:i(+n),f(),o):u},o.y=function(t){return arguments.length?(n="function"==typeof t?t:i(+t),f(),o):n},o},Object.defineProperty(n,"__esModule",{value:!0})}))
10331
10337
 
10332
10338
  class PhysicsWorker {
10333
10339
  constructor() {
@@ -10569,7 +10575,6 @@ self.onmessage = function(event) {
10569
10575
  }
10570
10576
  };
10571
10577
  this.worker.onerror = (error) => {
10572
- console.error("Physics Worker error:", error);
10573
10578
  this.rejectPromise(new Error(`Worker error: ${error.message}`));
10574
10579
  };
10575
10580
  }
@@ -10630,7 +10635,6 @@ self.onmessage = function(event) {
10630
10635
  */
10631
10636
  async initialize(config) {
10632
10637
  if (!this.worker) {
10633
- console.warn("Physics Worker not available, falling back to main thread");
10634
10638
  return false;
10635
10639
  }
10636
10640
  try {
@@ -10639,8 +10643,7 @@ self.onmessage = function(event) {
10639
10643
  data: config
10640
10644
  });
10641
10645
  return response.success;
10642
- } catch (error) {
10643
- console.error("Failed to initialize physics simulation:", error);
10646
+ } catch {
10644
10647
  return false;
10645
10648
  }
10646
10649
  }
@@ -10651,31 +10654,26 @@ self.onmessage = function(event) {
10651
10654
  if (!this.worker) {
10652
10655
  throw new Error("Physics Worker not available");
10653
10656
  }
10654
- try {
10655
- await this.sendMessage({
10656
- type: "run"
10657
- });
10658
- return new Promise((resolve, reject) => {
10659
- if (!this.worker) {
10660
- reject(new Error("Physics Worker not available"));
10661
- return;
10657
+ await this.sendMessage({
10658
+ type: "run"
10659
+ });
10660
+ return new Promise((resolve, reject) => {
10661
+ if (!this.worker) {
10662
+ reject(new Error("Physics Worker not available"));
10663
+ return;
10664
+ }
10665
+ const handleMessage = (event) => {
10666
+ const { type, data } = event.data;
10667
+ if (type === "simulation_complete") {
10668
+ this.worker?.removeEventListener("message", handleMessage);
10669
+ resolve(data.nodes);
10670
+ } else if (type === "error") {
10671
+ this.worker?.removeEventListener("message", handleMessage);
10672
+ reject(new Error(data.message));
10662
10673
  }
10663
- const handleMessage = (event) => {
10664
- const { type, data } = event.data;
10665
- if (type === "simulation_complete") {
10666
- this.worker?.removeEventListener("message", handleMessage);
10667
- resolve(data.nodes);
10668
- } else if (type === "error") {
10669
- this.worker?.removeEventListener("message", handleMessage);
10670
- reject(new Error(data.message));
10671
- }
10672
- };
10673
- this.worker.addEventListener("message", handleMessage);
10674
- });
10675
- } catch (error) {
10676
- console.error("Physics simulation failed:", error);
10677
- throw error;
10678
- }
10674
+ };
10675
+ this.worker.addEventListener("message", handleMessage);
10676
+ });
10679
10677
  }
10680
10678
  /**
10681
10679
  * Stop the current simulation
@@ -10818,20 +10816,6 @@ var PerformanceMonitor = class {
10818
10816
  * Log performance summary to console
10819
10817
  */
10820
10818
  logSummary() {
10821
- const summary = this.getSummary();
10822
- console.group("\u{1F680} Force-Graph Wrapper Performance Summary");
10823
- console.log("\u{1F4CA} Averages:", summary.averages);
10824
- console.log("\u26A1 Peaks:", summary.peaks);
10825
- console.log("\u{1F4C8} Node Scaling:", summary.nodeScaling);
10826
- console.log("\u{1F4BE} Memory Usage:", `${this.metrics["memoryUsage"].toFixed(2)} MB`);
10827
- console.log("\u{1F4CF} Graph Size:", `${this.metrics["nodeCount"]} nodes, ${this.metrics["linkCount"]} links`);
10828
- if (summary.warnings.length > 0) {
10829
- console.warn("\u26A0\uFE0F Performance Warnings:");
10830
- summary.warnings.forEach((warning) => console.warn(` \u2022 ${warning}`));
10831
- } else {
10832
- console.log("\u2705 No performance warnings");
10833
- }
10834
- console.groupEnd();
10835
10819
  }
10836
10820
  };
10837
10821
  var globalPerformanceMonitor = new PerformanceMonitor();
@@ -11109,14 +11093,12 @@ var CanvasOptimizer = class {
11109
11093
  * Clean up all cached data and references
11110
11094
  */
11111
11095
  destroy() {
11112
- console.log("\u{1F9F9} Cleaning up CanvasOptimizer...");
11113
11096
  this.imageDataCache.clear();
11114
11097
  this.pathCache.clear();
11115
11098
  this.renderQueue.length = 0;
11116
11099
  this.canvas = null;
11117
11100
  this.context = null;
11118
11101
  this.isOptimizing = false;
11119
- console.log("\u2705 CanvasOptimizer cleanup completed");
11120
11102
  }
11121
11103
  /**
11122
11104
  * Update viewport information for culling calculations
@@ -11365,6 +11347,10 @@ var ForceGraphWrapper = class {
11365
11347
  canvasClickHandler = null;
11366
11348
  // Export animation timeout for cleanup
11367
11349
  exportTimeoutId = null;
11350
+ // Visibility change timeouts for cleanup
11351
+ visibilityTimeoutId = null;
11352
+ intersectionTimeoutId = null;
11353
+ kapsuleTimeoutId = null;
11368
11354
  // Graph controls UI
11369
11355
  controlsInstance = null;
11370
11356
  // Graph legends UI
@@ -11447,18 +11433,16 @@ var ForceGraphWrapper = class {
11447
11433
  this.visibilityChangeHandler = () => {
11448
11434
  if (!document.hidden && this.isInitialized) {
11449
11435
  if (this.wasInitializedHidden) {
11450
- if (this.enableVerboseLogging) {
11451
- console.log("\u{1F504} Restarting simulation due to visibility change for layout consistency");
11452
- }
11453
11436
  this.getGraphInstance().d3ReheatSimulation();
11454
11437
  this.wasInitializedHidden = false;
11455
11438
  }
11456
11439
  if (this.pendingFitView) {
11457
- setTimeout(() => {
11458
- if (this.enableVerboseLogging) {
11459
- console.log("\u{1F3AF} Executing deferred fitView after visibility change");
11460
- }
11440
+ if (this.visibilityTimeoutId) {
11441
+ clearTimeout(this.visibilityTimeoutId);
11442
+ }
11443
+ this.visibilityTimeoutId = setTimeout(() => {
11461
11444
  this.zoomToFit(40, 300);
11445
+ this.visibilityTimeoutId = null;
11462
11446
  }, 100);
11463
11447
  }
11464
11448
  }
@@ -11484,30 +11468,12 @@ var ForceGraphWrapper = class {
11484
11468
  }
11485
11469
  const isInViewport = this.isElementInViewport(this.container);
11486
11470
  this.wasInitializedOutOfView = !isInViewport;
11487
- if (this.enableVerboseLogging) {
11488
- const rect = this.container.getBoundingClientRect();
11489
- console.log(`\u{1F4CD} Graph initialized:`, {
11490
- wasInitializedOutOfView: this.wasInitializedOutOfView,
11491
- isInViewport,
11492
- containerDimensions: `${this.container.clientWidth}x${this.container.clientHeight}`,
11493
- boundingRect: {
11494
- top: rect.top,
11495
- bottom: rect.bottom,
11496
- left: rect.left,
11497
- right: rect.right
11498
- },
11499
- windowSize: `${window.innerWidth}x${window.innerHeight}`
11500
- });
11501
- }
11502
11471
  if (typeof IntersectionObserver !== "undefined") {
11503
11472
  const scrollableParent = this.findScrollableParent(this.container);
11504
11473
  this.intersectionObserver = new IntersectionObserver((entries) => {
11505
11474
  entries.forEach((entry) => {
11506
11475
  if (entry.isIntersecting && this.isInitialized) {
11507
11476
  if (this.wasInitializedOutOfView) {
11508
- if (this.enableVerboseLogging) {
11509
- console.log("\u{1F504} Element entered viewport - ensuring consistent physics");
11510
- }
11511
11477
  if (this.physicsTimeoutId) {
11512
11478
  window.clearTimeout(this.physicsTimeoutId);
11513
11479
  this.physicsTimeoutId = void 0;
@@ -11518,13 +11484,14 @@ var ForceGraphWrapper = class {
11518
11484
  this.wasInitializedOutOfView = false;
11519
11485
  }
11520
11486
  if (this.pendingFitView) {
11521
- setTimeout(() => {
11487
+ if (this.intersectionTimeoutId) {
11488
+ clearTimeout(this.intersectionTimeoutId);
11489
+ }
11490
+ this.intersectionTimeoutId = setTimeout(() => {
11522
11491
  if (this.pendingFitView) {
11523
- if (this.enableVerboseLogging) {
11524
- console.log("\u{1F3AF} Executing deferred fitView after entering viewport");
11525
- }
11526
11492
  this.zoomToFit(40, 300);
11527
11493
  }
11494
+ this.intersectionTimeoutId = null;
11528
11495
  }, 100);
11529
11496
  }
11530
11497
  }
@@ -11550,16 +11517,10 @@ var ForceGraphWrapper = class {
11550
11517
  const style = window.getComputedStyle(current);
11551
11518
  const overflow = style.overflow + style.overflowY + style.overflowX;
11552
11519
  if (/(auto|scroll)/.test(overflow) && (current.scrollHeight > current.clientHeight || current.scrollWidth > current.clientWidth)) {
11553
- if (this.enableVerboseLogging) {
11554
- console.log("\u{1F4CD} Found scrollable parent:", current.className || current.tagName);
11555
- }
11556
11520
  return current;
11557
11521
  }
11558
11522
  current = current.parentElement;
11559
11523
  }
11560
- if (this.enableVerboseLogging) {
11561
- console.log("\u{1F4CD} No scrollable parent found, using viewport as root");
11562
- }
11563
11524
  return null;
11564
11525
  }
11565
11526
  /**
@@ -11570,15 +11531,9 @@ var ForceGraphWrapper = class {
11570
11531
  if (this.intersectionObserver || !this.container || !this.deferredFitViewParams) {
11571
11532
  return;
11572
11533
  }
11573
- if (this.enableVerboseLogging) {
11574
- console.log("\u{1F3AF} Setting up library-level deferred fitView");
11575
- }
11576
11534
  this.intersectionObserver = new IntersectionObserver((entries) => {
11577
11535
  entries.forEach((entry) => {
11578
11536
  if (entry.isIntersecting && this.pendingFitView && this.deferredFitViewParams) {
11579
- if (this.enableVerboseLogging) {
11580
- console.log("\u{1F3AF} Library executing deferred fitView (now visible)");
11581
- }
11582
11537
  const { padding, duration } = this.deferredFitViewParams;
11583
11538
  this.pendingFitView = false;
11584
11539
  this.deferredFitViewParams = null;
@@ -11606,9 +11561,6 @@ var ForceGraphWrapper = class {
11606
11561
  const containerWidth = this.container.clientWidth;
11607
11562
  const containerHeight = this.container.clientHeight;
11608
11563
  if (containerWidth === 0 || containerHeight === 0) {
11609
- if (this.enableVerboseLogging) {
11610
- console.warn("\u26A0\uFE0F Still no valid dimensions for deferred fitView");
11611
- }
11612
11564
  return;
11613
11565
  }
11614
11566
  this.cacheContainerDimensions();
@@ -11623,9 +11575,6 @@ var ForceGraphWrapper = class {
11623
11575
  const scale = Math.min(viewportWidth / width, viewportHeight / height);
11624
11576
  this.getGraphInstance().centerAt(centerX, centerY, duration);
11625
11577
  this.getGraphInstance().zoom(scale, duration);
11626
- if (this.enableVerboseLogging) {
11627
- console.log("\u2705 Library deferred fitView executed successfully");
11628
- }
11629
11578
  }
11630
11579
  }
11631
11580
  /**
@@ -11657,6 +11606,23 @@ var ForceGraphWrapper = class {
11657
11606
  this.exportTimeoutId = null;
11658
11607
  }
11659
11608
  }
11609
+ /**
11610
+ * Cleanup visibility-related timeouts
11611
+ */
11612
+ cleanupVisibilityTimeouts() {
11613
+ if (this.visibilityTimeoutId) {
11614
+ clearTimeout(this.visibilityTimeoutId);
11615
+ this.visibilityTimeoutId = null;
11616
+ }
11617
+ if (this.intersectionTimeoutId) {
11618
+ clearTimeout(this.intersectionTimeoutId);
11619
+ this.intersectionTimeoutId = null;
11620
+ }
11621
+ if (this.kapsuleTimeoutId) {
11622
+ clearTimeout(this.kapsuleTimeoutId);
11623
+ this.kapsuleTimeoutId = null;
11624
+ }
11625
+ }
11660
11626
  /**
11661
11627
  * Cleanup canvas event listeners
11662
11628
  */
@@ -11689,9 +11655,6 @@ var ForceGraphWrapper = class {
11689
11655
  const height = this.container.clientHeight;
11690
11656
  if (width > 0 && height > 0) {
11691
11657
  this.lastKnownDimensions = { width, height };
11692
- if (this.enableVerboseLogging) {
11693
- console.log("\u{1F4D0} Cached container dimensions:", this.lastKnownDimensions);
11694
- }
11695
11658
  }
11696
11659
  }
11697
11660
  /**
@@ -11719,9 +11682,6 @@ var ForceGraphWrapper = class {
11719
11682
  }
11720
11683
  try {
11721
11684
  if (!physicsWorkerManager.isAvailable()) {
11722
- if (this.enableVerboseLogging) {
11723
- console.warn("\u26A0\uFE0F Web Worker not available, using main thread physics");
11724
- }
11725
11685
  return;
11726
11686
  }
11727
11687
  const containerWidth = this.container.clientWidth || this.config.width || 800;
@@ -11740,16 +11700,6 @@ var ForceGraphWrapper = class {
11740
11700
  forces: {}
11741
11701
  // Let worker use force-graph defaults
11742
11702
  };
11743
- if (this.enableVerboseLogging) {
11744
- console.log("\u{1F3AF} Web Worker physics config:", {
11745
- containerDimensions: `${containerWidth}x${containerHeight}`,
11746
- configDimensions: `${this.config.width || "auto"}x${this.config.height || "auto"}`,
11747
- nodeCount: nodes.length
11748
- });
11749
- }
11750
- if (this.enableVerboseLogging) {
11751
- console.log("\u{1F504} Running Web Worker physics for ALL graphs (visible & hidden)...");
11752
- }
11753
11703
  const initialized = await physicsWorkerManager.initialize(config);
11754
11704
  if (!initialized) {
11755
11705
  throw new Error("Failed to initialize Web Worker physics");
@@ -11757,13 +11707,7 @@ var ForceGraphWrapper = class {
11757
11707
  const finalNodes = await physicsWorkerManager.runSimulation();
11758
11708
  this.applyWebWorkerResults(finalNodes);
11759
11709
  this.webWorkerPhysicsCompleted = true;
11760
- if (this.enableVerboseLogging) {
11761
- console.log(`\u2705 Web Worker physics completed for ALL graphs with ${finalNodes.length} nodes`);
11762
- }
11763
- } catch (error) {
11764
- if (this.enableVerboseLogging) {
11765
- console.warn("\u26A0\uFE0F Web Worker physics failed:", error);
11766
- }
11710
+ } catch {
11767
11711
  }
11768
11712
  }
11769
11713
  /**
@@ -11789,9 +11733,6 @@ var ForceGraphWrapper = class {
11789
11733
  }
11790
11734
  }
11791
11735
  this.triggerKapsuleUpdate();
11792
- if (this.enableVerboseLogging) {
11793
- console.log("\u2705 Applied Web Worker results without disrupting interactions");
11794
- }
11795
11736
  }
11796
11737
  /**
11797
11738
  * Cleanup deterministic physics handling
@@ -11974,57 +11915,33 @@ var ForceGraphWrapper = class {
11974
11915
  if (this.forceGraph) {
11975
11916
  this.getGraphInstance().d3ReheatSimulation();
11976
11917
  }
11977
- if (this.enableVerboseLogging) {
11978
- console.log("\u2705 d3ReheatSimulation called");
11979
- }
11980
11918
  }
11981
11919
  stopAnimation() {
11982
11920
  if (!this.isInitialized) return;
11983
- const start2 = performance.now();
11984
11921
  if (this.forceGraph) {
11985
11922
  this.getGraphInstance().pauseAnimation();
11986
11923
  }
11987
- const duration = performance.now() - start2;
11988
- if (this.config.enablePerformanceMonitoring) {
11989
- console.log(`\u2705 stopAnimation completed in ${duration.toFixed(3)}ms`);
11990
- }
11991
11924
  }
11992
11925
  pauseAnimation() {
11993
11926
  if (!this.isInitialized) return;
11994
- const start2 = performance.now();
11995
11927
  if (this.forceGraph) {
11996
11928
  this.getGraphInstance().pauseAnimation();
11997
11929
  }
11998
- const duration = performance.now() - start2;
11999
- if (this.config.enablePerformanceMonitoring) {
12000
- console.log(`\u2705 pauseAnimation completed in ${duration.toFixed(3)}ms`);
12001
- }
12002
11930
  }
12003
11931
  resumeAnimation() {
12004
11932
  if (!this.isInitialized) return;
12005
- const start2 = performance.now();
12006
11933
  if (this.forceGraph) {
12007
11934
  this.getGraphInstance().resumeAnimation();
12008
11935
  }
12009
- const duration = performance.now() - start2;
12010
- if (this.config.enablePerformanceMonitoring) {
12011
- console.log(`\u2705 resumeAnimation completed in ${duration.toFixed(3)}ms`);
12012
- }
12013
11936
  }
12014
11937
  centerAt(x3, y3, duration) {
12015
11938
  if (!this.isInitialized) this.initializeForceGraph();
12016
- const start2 = performance.now();
12017
11939
  if (this.forceGraph) {
12018
11940
  this.getGraphInstance().centerAt(x3, y3, duration);
12019
11941
  }
12020
- const callDuration = performance.now() - start2;
12021
- if (this.config.enablePerformanceMonitoring) {
12022
- console.log(`\u2705 centerAt(${x3}, ${y3}) completed in ${callDuration.toFixed(3)}ms`);
12023
- }
12024
11942
  }
12025
11943
  zoom(scale, duration) {
12026
11944
  if (!this.isInitialized) this.initializeForceGraph();
12027
- const start2 = performance.now();
12028
11945
  let result = void 0;
12029
11946
  if (this.forceGraph) {
12030
11947
  if (scale === void 0) {
@@ -12036,19 +11953,10 @@ var ForceGraphWrapper = class {
12036
11953
  } else if (scale === void 0) {
12037
11954
  result = 1;
12038
11955
  }
12039
- const callDuration = performance.now() - start2;
12040
- if (this.config.enablePerformanceMonitoring) {
12041
- if (scale === void 0) {
12042
- console.log(`\u2705 zoom() getter completed in ${callDuration.toFixed(3)}ms`);
12043
- } else {
12044
- console.log(`\u2705 zoom(${scale}) setter completed in ${callDuration.toFixed(3)}ms`);
12045
- }
12046
- }
12047
11956
  return result;
12048
11957
  }
12049
11958
  zoomToFit(padding, duration) {
12050
11959
  if (!this.isInitialized) this.initializeForceGraph();
12051
- const start2 = performance.now();
12052
11960
  const containerWidth = this.container.clientWidth;
12053
11961
  const containerHeight = this.container.clientHeight;
12054
11962
  const isInViewport = this.container ? this.isElementInViewport(this.container) : false;
@@ -12059,26 +11967,9 @@ var ForceGraphWrapper = class {
12059
11967
  const bbox = this.getGraphInstance().getGraphBbox();
12060
11968
  bboxValid = bbox && bbox.x[1] - bbox.x[0] > 0 && bbox.y[1] - bbox.y[0] > 0;
12061
11969
  }
12062
- if (this.enableVerboseLogging) {
12063
- console.log("\u{1F3AF} Library zoomToFit called:", {
12064
- containerDimensions: `${containerWidth}x${containerHeight}`,
12065
- isInViewport,
12066
- isVisible,
12067
- hasValidDimensions,
12068
- bboxValid,
12069
- documentHidden: document.hidden,
12070
- padding: padding || 40,
12071
- duration: duration || 300
12072
- });
12073
- }
12074
11970
  if (!isVisible || !hasValidDimensions || !bboxValid) {
12075
11971
  this.deferredFitViewParams = { padding: padding || 40, duration: duration || 300 };
12076
11972
  this.pendingFitView = true;
12077
- if (this.enableVerboseLogging) {
12078
- console.log("\u{1F3AF} Library DEFERRING fitView:", {
12079
- reason: !isVisible ? "not visible" : !hasValidDimensions ? "invalid dimensions" : "invalid bbox"
12080
- });
12081
- }
12082
11973
  this.setupDeferredFitView();
12083
11974
  return;
12084
11975
  }
@@ -12093,112 +11984,54 @@ var ForceGraphWrapper = class {
12093
11984
  const viewportWidth = containerWidth - paddingValue;
12094
11985
  const viewportHeight = containerHeight - paddingValue;
12095
11986
  const scale = Math.min(viewportWidth / width, viewportHeight / height);
12096
- if (this.enableVerboseLogging) {
12097
- console.log("\u{1F3AF} zoomToFit calculations:", {
12098
- bbox: { width, height, centerX, centerY },
12099
- container: {
12100
- clientWidth: containerWidth,
12101
- clientHeight: containerHeight,
12102
- viewportWidth,
12103
- viewportHeight
12104
- },
12105
- scale,
12106
- willApply: width > 0 && height > 0
12107
- });
12108
- }
12109
11987
  if (width > 0 && height > 0) {
12110
11988
  this.getGraphInstance().centerAt(centerX, centerY);
12111
11989
  this.getGraphInstance().zoom(scale, duration || 300);
12112
11990
  this.pendingFitView = false;
12113
- if (this.enableVerboseLogging) {
12114
- console.log("\u2705 zoomToFit applied successfully");
12115
- }
12116
- } else if (this.enableVerboseLogging) {
12117
- console.warn("\u26A0\uFE0F zoomToFit skipped - invalid bbox:", {
12118
- bboxValid: width > 0 && height > 0
12119
- });
12120
11991
  }
12121
11992
  }
12122
- const callDuration = performance.now() - start2;
12123
- if (this.config.enablePerformanceMonitoring) {
12124
- console.log(`\u2705 zoomToFit() completed in ${callDuration.toFixed(3)}ms`);
12125
- }
12126
11993
  }
12127
11994
  screen2GraphCoords(screenX, screenY) {
12128
11995
  if (!this.isInitialized) this.initializeForceGraph();
12129
- const start2 = performance.now();
12130
11996
  let result = { x: 0, y: 0 };
12131
11997
  if (this.forceGraph) {
12132
11998
  result = this.getGraphInstance().screen2GraphCoords(screenX, screenY) || { x: 0, y: 0 };
12133
11999
  }
12134
- const callDuration = performance.now() - start2;
12135
- if (this.config.enablePerformanceMonitoring) {
12136
- console.log(`\u2705 screen2GraphCoords(${screenX}, ${screenY}) completed in ${callDuration.toFixed(3)}ms`);
12137
- }
12138
12000
  return result;
12139
12001
  }
12140
12002
  graph2ScreenCoords(graphX, graphY) {
12141
12003
  if (!this.isInitialized) this.initializeForceGraph();
12142
- const start2 = performance.now();
12143
12004
  let result = { x: 0, y: 0 };
12144
12005
  if (this.forceGraph) {
12145
12006
  result = this.getGraphInstance().graph2ScreenCoords(graphX, graphY) || { x: 0, y: 0 };
12146
12007
  }
12147
- const callDuration = performance.now() - start2;
12148
- if (this.config.enablePerformanceMonitoring) {
12149
- console.log(`\u2705 graph2ScreenCoords(${graphX}, ${graphY}) completed in ${callDuration.toFixed(3)}ms`);
12150
- }
12151
12008
  return result;
12152
12009
  }
12153
12010
  getGraphBbox(nodes) {
12154
12011
  if (!this.isInitialized) this.initializeForceGraph();
12155
- const start2 = performance.now();
12156
12012
  let result = { x: [0, 0], y: [0, 0] };
12157
12013
  if (this.forceGraph) {
12158
12014
  result = this.getGraphInstance().getGraphBbox(nodes) || { x: [0, 0], y: [0, 0] };
12159
12015
  }
12160
- const callDuration = performance.now() - start2;
12161
- if (this.config.enablePerformanceMonitoring) {
12162
- console.log(`\u2705 getGraphBbox() completed in ${callDuration.toFixed(3)}ms`);
12163
- }
12164
12016
  return result;
12165
12017
  }
12166
12018
  emitParticle(link) {
12167
12019
  if (!this.isInitialized) this.initializeForceGraph();
12168
- const start2 = performance.now();
12169
12020
  if (this.forceGraph) {
12170
12021
  this.getGraphInstance().emitParticle(link);
12171
12022
  }
12172
- const callDuration = performance.now() - start2;
12173
- if (this.config.enablePerformanceMonitoring) {
12174
- console.log(`\u2705 emitParticle() completed in ${callDuration.toFixed(3)}ms`);
12175
- }
12176
12023
  }
12177
12024
  d3Force(forceName, forceImpl) {
12178
12025
  if (!this.isInitialized) this.initializeForceGraph();
12179
- const start2 = performance.now();
12180
12026
  if (this.forceGraph) {
12181
12027
  if (forceImpl !== void 0) {
12182
12028
  this.getGraphInstance().d3Force(forceName, forceImpl);
12183
- const callDuration2 = performance.now() - start2;
12184
- if (this.config.enablePerformanceMonitoring) {
12185
- console.log(`\u2705 d3Force(set ${forceName}) completed in ${callDuration2.toFixed(3)}ms`);
12186
- }
12187
12029
  return this;
12188
12030
  } else {
12189
12031
  const result = this.getGraphInstance().d3Force(forceName);
12190
- const callDuration2 = performance.now() - start2;
12191
- if (this.config.enablePerformanceMonitoring) {
12192
- console.log(`\u2705 d3Force(get ${forceName}) completed in ${callDuration2.toFixed(3)}ms`);
12193
- }
12194
12032
  return result;
12195
12033
  }
12196
12034
  }
12197
- const callDuration = performance.now() - start2;
12198
- if (this.config.enablePerformanceMonitoring) {
12199
- const action = forceImpl !== void 0 ? "set" : "get";
12200
- console.log(`\u2705 d3Force(${action} ${forceName}) completed in ${callDuration.toFixed(3)}ms`);
12201
- }
12202
12035
  return forceImpl !== void 0 ? this : null;
12203
12036
  }
12204
12037
  graphData(data) {
@@ -12225,27 +12058,12 @@ var ForceGraphWrapper = class {
12225
12058
  }
12226
12059
  this.updateLegends();
12227
12060
  }
12228
- if (this.enableVerboseLogging) {
12229
- console.log(`\u{1F50D} Web Worker trigger check:`, {
12230
- deterministicLayout: this.config.deterministicLayout !== false,
12231
- wasInitializedOutOfView: this.wasInitializedOutOfView,
12232
- hasNodes: data?.nodes?.length > 0,
12233
- webWorkerCompleted: this.webWorkerPhysicsCompleted,
12234
- nodeCount: data?.nodes?.length || 0
12235
- });
12236
- }
12237
12061
  if (this.config.deterministicLayout !== false && this.wasInitializedOutOfView && data?.nodes?.length > 0 && !this.webWorkerPhysicsCompleted) {
12238
- if (this.enableVerboseLogging) {
12239
- console.log(`\u{1F3AF} Triggering Web Worker physics for off-screen graph with ${data.nodes.length} nodes`);
12240
- }
12241
12062
  if (this.physicsTimeoutId) {
12242
12063
  window.clearTimeout(this.physicsTimeoutId);
12243
12064
  }
12244
12065
  this.physicsTimeoutId = window.setTimeout(() => {
12245
- this.runWebWorkerPhysics().catch((error) => {
12246
- if (this.enableVerboseLogging) {
12247
- console.warn("\u26A0\uFE0F Web Worker physics failed:", error);
12248
- }
12066
+ this.runWebWorkerPhysics().catch(() => {
12249
12067
  });
12250
12068
  }, 200);
12251
12069
  }
@@ -12255,445 +12073,275 @@ var ForceGraphWrapper = class {
12255
12073
  if (width === void 0) {
12256
12074
  return this.config.width ?? 400;
12257
12075
  }
12258
- const start2 = performance.now();
12259
12076
  this.config.width = width;
12260
12077
  if (this.isInitialized && this.forceGraph) {
12261
12078
  this.getGraphInstance().width(width);
12262
12079
  }
12263
- const callDuration = performance.now() - start2;
12264
- if (this.config.enablePerformanceMonitoring) {
12265
- console.log(`\u2705 width(${width}) completed in ${callDuration.toFixed(3)}ms`);
12266
- }
12267
12080
  return this;
12268
12081
  }
12269
12082
  height(height) {
12270
12083
  if (height === void 0) {
12271
12084
  return this.config.height ?? 300;
12272
12085
  }
12273
- const start2 = performance.now();
12274
12086
  this.config.height = height;
12275
12087
  if (this.isInitialized && this.forceGraph) {
12276
12088
  this.getGraphInstance().height(height);
12277
12089
  }
12278
- const callDuration = performance.now() - start2;
12279
- if (this.config.enablePerformanceMonitoring) {
12280
- console.log(`\u2705 height(${height}) completed in ${callDuration.toFixed(3)}ms`);
12281
- }
12282
12090
  return this;
12283
12091
  }
12284
12092
  backgroundColor(color2) {
12285
12093
  if (color2 === void 0) {
12286
12094
  return this.config.backgroundColor ?? "#ffffff";
12287
12095
  }
12288
- const start2 = performance.now();
12289
12096
  this.config.backgroundColor = color2;
12290
12097
  if (this.isInitialized && this.forceGraph) {
12291
12098
  this.getGraphInstance().backgroundColor(color2);
12292
12099
  }
12293
- const callDuration = performance.now() - start2;
12294
- if (this.config.enablePerformanceMonitoring) {
12295
- console.log(`\u2705 backgroundColor(${color2}) completed in ${callDuration.toFixed(3)}ms`);
12296
- }
12297
12100
  return this;
12298
12101
  }
12299
12102
  nodeColor(color2) {
12300
12103
  if (color2 === void 0) return this.config.nodeColor ?? "#999999";
12301
- const start2 = performance.now();
12302
12104
  this.config.nodeColor = color2;
12303
12105
  if (this.isInitialized && this.forceGraph) {
12304
12106
  this.getGraphInstance().nodeColor(color2);
12305
12107
  }
12306
- const callDuration = performance.now() - start2;
12307
- if (this.config.enablePerformanceMonitoring) {
12308
- console.log(`\u2705 nodeColor() completed in ${callDuration.toFixed(3)}ms`);
12309
- }
12310
12108
  return this;
12311
12109
  }
12312
12110
  nodeVal(val) {
12313
12111
  if (val === void 0) return this.config.nodeVal ?? 1;
12314
- const start2 = performance.now();
12315
12112
  this.config.nodeVal = val;
12316
12113
  if (this.isInitialized && this.forceGraph) {
12317
12114
  this.getGraphInstance().nodeVal(val);
12318
12115
  }
12319
- const callDuration = performance.now() - start2;
12320
- if (this.config.enablePerformanceMonitoring) {
12321
- console.log(`\u2705 nodeVal() completed in ${callDuration.toFixed(3)}ms`);
12322
- }
12323
12116
  return this;
12324
12117
  }
12325
12118
  nodeRelSize(size) {
12326
12119
  if (size === void 0) return this.config.nodeRelSize ?? 4;
12327
- const start2 = performance.now();
12328
12120
  this.config.nodeRelSize = size;
12329
12121
  if (this.isInitialized && this.forceGraph) {
12330
12122
  this.getGraphInstance().nodeRelSize(size);
12331
12123
  }
12332
- const callDuration = performance.now() - start2;
12333
- if (this.config.enablePerformanceMonitoring) {
12334
- console.log(`\u2705 nodeRelSize(${size}) completed in ${callDuration.toFixed(3)}ms`);
12335
- }
12336
12124
  return this;
12337
12125
  }
12338
12126
  nodeLabel(label) {
12339
12127
  if (label === void 0) return this.config.nodeLabel ?? "";
12340
- const start2 = performance.now();
12341
12128
  this.config.nodeLabel = label;
12342
12129
  if (this.isInitialized && this.forceGraph) {
12343
12130
  this.getGraphInstance().nodeLabel(label);
12344
12131
  }
12345
- const callDuration = performance.now() - start2;
12346
- if (this.config.enablePerformanceMonitoring) {
12347
- console.log(`\u2705 nodeLabel() completed in ${callDuration.toFixed(3)}ms`);
12348
- }
12349
12132
  return this;
12350
12133
  }
12351
12134
  nodeVisibility(visibility) {
12352
12135
  if (visibility === void 0) return this.config.nodeVisibility ?? true;
12353
- const start2 = performance.now();
12354
12136
  this.config.nodeVisibility = visibility;
12355
12137
  if (this.isInitialized && this.forceGraph) {
12356
12138
  this.getGraphInstance().nodeVisibility(visibility);
12357
12139
  }
12358
- const callDuration = performance.now() - start2;
12359
- if (this.config.enablePerformanceMonitoring) {
12360
- console.log(`\u2705 nodeVisibility() completed in ${callDuration.toFixed(3)}ms`);
12361
- }
12362
12140
  return this;
12363
12141
  }
12364
12142
  nodeCanvasObjectMode(mode) {
12365
12143
  if (mode === void 0) return this.config.nodeCanvasObjectMode ?? "replace";
12366
- const start2 = performance.now();
12367
12144
  this.config.nodeCanvasObjectMode = mode;
12368
12145
  if (this.isInitialized && this.forceGraph) {
12369
12146
  this.getGraphInstance().nodeCanvasObjectMode(mode);
12370
12147
  }
12371
- const callDuration = performance.now() - start2;
12372
- if (this.config.enablePerformanceMonitoring) {
12373
- console.log(`\u2705 nodeCanvasObjectMode() completed in ${callDuration.toFixed(3)}ms`);
12374
- }
12375
12148
  return this;
12376
12149
  }
12377
12150
  linkColor(color2) {
12378
12151
  if (color2 === void 0) return this.config.linkColor ?? "#999999";
12379
- const start2 = performance.now();
12380
12152
  this.config.linkColor = color2;
12381
12153
  if (this.isInitialized && this.forceGraph) {
12382
12154
  this.getGraphInstance().linkColor(color2);
12383
12155
  }
12384
- const callDuration = performance.now() - start2;
12385
- if (this.config.enablePerformanceMonitoring) {
12386
- console.log(`\u2705 linkColor() completed in ${callDuration.toFixed(3)}ms`);
12387
- }
12388
12156
  return this;
12389
12157
  }
12390
12158
  linkWidth(width) {
12391
12159
  if (width === void 0) return this.config.linkWidth ?? 1;
12392
- const start2 = performance.now();
12393
12160
  this.config.linkWidth = width;
12394
12161
  if (this.isInitialized && this.forceGraph) {
12395
12162
  this.getGraphInstance().linkWidth(width);
12396
12163
  }
12397
- const callDuration = performance.now() - start2;
12398
- if (this.config.enablePerformanceMonitoring) {
12399
- console.log(`\u2705 linkWidth() completed in ${callDuration.toFixed(3)}ms`);
12400
- }
12401
12164
  return this;
12402
12165
  }
12403
12166
  linkLabel(label) {
12404
12167
  if (label === void 0) return this.config.linkLabel ?? "";
12405
- const start2 = performance.now();
12406
12168
  this.config.linkLabel = label;
12407
12169
  if (this.isInitialized && this.forceGraph) {
12408
12170
  this.getGraphInstance().linkLabel(label);
12409
12171
  }
12410
- const callDuration = performance.now() - start2;
12411
- if (this.config.enablePerformanceMonitoring) {
12412
- console.log(`\u2705 linkLabel() completed in ${callDuration.toFixed(3)}ms`);
12413
- }
12414
12172
  return this;
12415
12173
  }
12416
12174
  linkVisibility(visibility) {
12417
12175
  if (visibility === void 0) return this.config.linkVisibility ?? true;
12418
- const start2 = performance.now();
12419
12176
  this.config.linkVisibility = visibility;
12420
12177
  if (this.isInitialized && this.forceGraph) {
12421
12178
  this.getGraphInstance().linkVisibility(visibility);
12422
12179
  }
12423
- const callDuration = performance.now() - start2;
12424
- if (this.config.enablePerformanceMonitoring) {
12425
- console.log(`\u2705 linkVisibility() completed in ${callDuration.toFixed(3)}ms`);
12426
- }
12427
12180
  return this;
12428
12181
  }
12429
12182
  linkDirectionalArrowLength(length) {
12430
12183
  if (length === void 0) return this.config.linkDirectionalArrowLength ?? 0;
12431
- const start2 = performance.now();
12432
12184
  this.config.linkDirectionalArrowLength = length;
12433
12185
  if (this.isInitialized && this.forceGraph) {
12434
12186
  this.getGraphInstance().linkDirectionalArrowLength(length);
12435
12187
  }
12436
- const callDuration = performance.now() - start2;
12437
- if (this.config.enablePerformanceMonitoring) {
12438
- console.log(`\u2705 linkDirectionalArrowLength() completed in ${callDuration.toFixed(3)}ms`);
12439
- }
12440
12188
  return this;
12441
12189
  }
12442
12190
  linkDirectionalParticles(particles) {
12443
12191
  if (particles === void 0) return this.config.linkDirectionalParticles ?? 0;
12444
- const start2 = performance.now();
12445
12192
  this.config.linkDirectionalParticles = particles;
12446
12193
  if (this.isInitialized && this.forceGraph) {
12447
12194
  this.getGraphInstance().linkDirectionalParticles(particles);
12448
12195
  }
12449
- const callDuration = performance.now() - start2;
12450
- if (this.config.enablePerformanceMonitoring) {
12451
- console.log(`\u2705 linkDirectionalParticles() completed in ${callDuration.toFixed(3)}ms`);
12452
- }
12453
12196
  return this;
12454
12197
  }
12455
12198
  linkDirectionalArrowColor(color2) {
12456
12199
  if (color2 === void 0) return this.config.linkDirectionalArrowColor ?? "#999999";
12457
- const start2 = performance.now();
12458
12200
  this.config.linkDirectionalArrowColor = color2;
12459
12201
  if (this.isInitialized && this.forceGraph) {
12460
12202
  this.getGraphInstance().linkDirectionalArrowColor(color2);
12461
12203
  }
12462
- const callDuration = performance.now() - start2;
12463
- if (this.config.enablePerformanceMonitoring) {
12464
- console.log(`\u2705 linkDirectionalArrowColor() completed in ${callDuration.toFixed(3)}ms`);
12465
- }
12466
12204
  return this;
12467
12205
  }
12468
12206
  linkDirectionalArrowRelPos(position) {
12469
12207
  if (position === void 0) return this.config.linkDirectionalArrowRelPos ?? 0.5;
12470
- const start2 = performance.now();
12471
12208
  this.config.linkDirectionalArrowRelPos = position;
12472
12209
  if (this.isInitialized && this.forceGraph) {
12473
12210
  this.getGraphInstance().linkDirectionalArrowRelPos(position);
12474
12211
  }
12475
- const callDuration = performance.now() - start2;
12476
- if (this.config.enablePerformanceMonitoring) {
12477
- console.log(`\u2705 linkDirectionalArrowRelPos(${position}) completed in ${callDuration.toFixed(3)}ms`);
12478
- }
12479
12212
  return this;
12480
12213
  }
12481
12214
  linkDirectionalParticleSpeed(speed) {
12482
12215
  if (speed === void 0) return this.config.linkDirectionalParticleSpeed ?? 1;
12483
- const start2 = performance.now();
12484
12216
  this.config.linkDirectionalParticleSpeed = speed;
12485
12217
  if (this.isInitialized && this.forceGraph) {
12486
12218
  this.getGraphInstance().linkDirectionalParticleSpeed(speed);
12487
12219
  }
12488
- const callDuration = performance.now() - start2;
12489
- if (this.config.enablePerformanceMonitoring) {
12490
- console.log(`\u2705 linkDirectionalParticleSpeed(${speed}) completed in ${callDuration.toFixed(3)}ms`);
12491
- }
12492
12220
  return this;
12493
12221
  }
12494
12222
  linkDirectionalParticleWidth(width) {
12495
12223
  if (width === void 0) return this.config.linkDirectionalParticleWidth ?? 4;
12496
- const start2 = performance.now();
12497
12224
  this.config.linkDirectionalParticleWidth = width;
12498
12225
  if (this.isInitialized && this.forceGraph) {
12499
12226
  this.getGraphInstance().linkDirectionalParticleWidth(width);
12500
12227
  }
12501
- const callDuration = performance.now() - start2;
12502
- if (this.config.enablePerformanceMonitoring) {
12503
- console.log(`\u2705 linkDirectionalParticleWidth(${width}) completed in ${callDuration.toFixed(3)}ms`);
12504
- }
12505
12228
  return this;
12506
12229
  }
12507
12230
  linkDirectionalParticleColor(color2) {
12508
12231
  if (color2 === void 0) return this.config.linkDirectionalParticleColor ?? "#999999";
12509
- const start2 = performance.now();
12510
12232
  this.config.linkDirectionalParticleColor = color2;
12511
12233
  if (this.isInitialized && this.forceGraph) {
12512
12234
  this.getGraphInstance().linkDirectionalParticleColor(color2);
12513
12235
  }
12514
- const callDuration = performance.now() - start2;
12515
- if (this.config.enablePerformanceMonitoring) {
12516
- console.log(`\u2705 linkDirectionalParticleColor() completed in ${callDuration.toFixed(3)}ms`);
12517
- }
12518
12236
  return this;
12519
12237
  }
12520
12238
  linkCurvature(curvature) {
12521
12239
  if (curvature === void 0) return this.config.linkCurvature ?? 0;
12522
- const start2 = performance.now();
12523
12240
  this.config.linkCurvature = curvature;
12524
12241
  if (this.isInitialized && this.forceGraph) {
12525
12242
  this.getGraphInstance().linkCurvature(curvature);
12526
12243
  }
12527
- const callDuration = performance.now() - start2;
12528
- if (this.config.enablePerformanceMonitoring) {
12529
- console.log(`\u2705 linkCurvature(${curvature}) completed in ${callDuration.toFixed(3)}ms`);
12530
- }
12531
12244
  return this;
12532
12245
  }
12533
12246
  linkCanvasObjectMode(mode) {
12534
12247
  if (mode === void 0) return this.config.linkCanvasObjectMode ?? "replace";
12535
- const start2 = performance.now();
12536
12248
  this.config.linkCanvasObjectMode = mode;
12537
12249
  if (this.isInitialized && this.forceGraph) {
12538
12250
  this.getGraphInstance().linkCanvasObjectMode(mode);
12539
12251
  }
12540
- const callDuration = performance.now() - start2;
12541
- if (this.config.enablePerformanceMonitoring) {
12542
- console.log(`\u2705 linkCanvasObjectMode() completed in ${callDuration.toFixed(3)}ms`);
12543
- }
12544
12252
  return this;
12545
12253
  }
12546
12254
  onNodeClick(handler) {
12547
12255
  if (handler === void 0) return this.config.onNodeClick ?? null;
12548
- const start2 = performance.now();
12549
12256
  this.config.onNodeClick = handler || void 0;
12550
12257
  if (this.isInitialized && this.forceGraph) {
12551
12258
  this.getGraphInstance().onNodeClick(handler);
12552
12259
  }
12553
- const callDuration = performance.now() - start2;
12554
- if (this.config.enablePerformanceMonitoring) {
12555
- console.log(`\u2705 onNodeClick() completed in ${callDuration.toFixed(3)}ms`);
12556
- }
12557
12260
  return this;
12558
12261
  }
12559
12262
  onNodeDoubleClick(handler) {
12560
12263
  if (handler === void 0) return this.config.onNodeDoubleClick ?? null;
12561
- const start2 = performance.now();
12562
12264
  this.config.onNodeDoubleClick = handler || void 0;
12563
- const callDuration = performance.now() - start2;
12564
- if (this.config.enablePerformanceMonitoring) {
12565
- console.log(`\u2705 onNodeDoubleClick() completed in ${callDuration.toFixed(3)}ms`);
12566
- }
12567
12265
  return this;
12568
12266
  }
12569
12267
  onNodeHover(handler) {
12570
12268
  if (handler === void 0) return this.config.onNodeHover ?? null;
12571
- const start2 = performance.now();
12572
12269
  this.config.onNodeHover = handler || void 0;
12573
12270
  if (this.isInitialized && this.forceGraph) {
12574
12271
  this.getGraphInstance().onNodeHover(handler);
12575
12272
  }
12576
- const callDuration = performance.now() - start2;
12577
- if (this.config.enablePerformanceMonitoring) {
12578
- console.log(`\u2705 onNodeHover() completed in ${callDuration.toFixed(3)}ms`);
12579
- }
12580
12273
  return this;
12581
12274
  }
12582
12275
  onLinkClick(handler) {
12583
12276
  if (handler === void 0) return this.config.onLinkClick ?? null;
12584
- const start2 = performance.now();
12585
12277
  this.config.onLinkClick = handler || void 0;
12586
12278
  if (this.isInitialized && this.forceGraph) {
12587
12279
  this.getGraphInstance().onLinkClick(handler);
12588
12280
  }
12589
- const callDuration = performance.now() - start2;
12590
- if (this.config.enablePerformanceMonitoring) {
12591
- console.log(`\u2705 onLinkClick() completed in ${callDuration.toFixed(3)}ms`);
12592
- }
12593
12281
  return this;
12594
12282
  }
12595
12283
  onLinkHover(handler) {
12596
12284
  if (handler === void 0) return this.config.onLinkHover ?? null;
12597
- const start2 = performance.now();
12598
12285
  this.config.onLinkHover = handler || void 0;
12599
12286
  if (this.isInitialized && this.forceGraph) {
12600
12287
  this.getGraphInstance().onLinkHover(handler);
12601
12288
  }
12602
- const callDuration = performance.now() - start2;
12603
- if (this.config.enablePerformanceMonitoring) {
12604
- console.log(`\u2705 onLinkHover() completed in ${callDuration.toFixed(3)}ms`);
12605
- }
12606
12289
  return this;
12607
12290
  }
12608
12291
  onRenderFramePre(handler) {
12609
12292
  if (handler === void 0) return this.config.onRenderFramePre ?? null;
12610
- const start2 = performance.now();
12611
12293
  this.config.onRenderFramePre = handler || void 0;
12612
12294
  if (this.isInitialized && this.forceGraph) {
12613
12295
  this.getGraphInstance().onRenderFramePre(handler);
12614
12296
  }
12615
- const callDuration = performance.now() - start2;
12616
- if (this.config.enablePerformanceMonitoring) {
12617
- console.log(`\u2705 onRenderFramePre() completed in ${callDuration.toFixed(3)}ms`);
12618
- }
12619
12297
  return this;
12620
12298
  }
12621
12299
  onRenderFramePost(handler) {
12622
12300
  if (handler === void 0) return this.config.onRenderFramePost ?? null;
12623
- const start2 = performance.now();
12624
12301
  this.config.onRenderFramePost = handler || void 0;
12625
12302
  if (this.isInitialized && this.forceGraph) {
12626
12303
  this.getGraphInstance().onRenderFramePost(handler);
12627
12304
  }
12628
- const callDuration = performance.now() - start2;
12629
- if (this.config.enablePerformanceMonitoring) {
12630
- console.log(`\u2705 onRenderFramePost() completed in ${callDuration.toFixed(3)}ms`);
12631
- }
12632
12305
  return this;
12633
12306
  }
12634
12307
  cooldownTime(time) {
12635
12308
  if (time === void 0) return this.config.cooldownTime ?? 15e3;
12636
- const start2 = performance.now();
12637
12309
  this.config.cooldownTime = time;
12638
12310
  if (this.isInitialized && this.forceGraph) {
12639
12311
  this.getGraphInstance().cooldownTime(time);
12640
12312
  }
12641
- const callDuration = performance.now() - start2;
12642
- if (this.config.enablePerformanceMonitoring) {
12643
- console.log(`\u2705 cooldownTime(${time}) completed in ${callDuration.toFixed(3)}ms`);
12644
- }
12645
12313
  return this;
12646
12314
  }
12647
12315
  d3AlphaDecay(decay) {
12648
12316
  if (decay === void 0) return this.config.d3AlphaDecay ?? 0.0228;
12649
- const start2 = performance.now();
12650
12317
  this.config.d3AlphaDecay = decay;
12651
12318
  if (this.isInitialized && this.forceGraph) {
12652
12319
  this.getGraphInstance().d3AlphaDecay(decay);
12653
12320
  }
12654
- const callDuration = performance.now() - start2;
12655
- if (this.config.enablePerformanceMonitoring) {
12656
- console.log(`\u2705 d3AlphaDecay(${decay}) completed in ${callDuration.toFixed(3)}ms`);
12657
- }
12658
12321
  return this;
12659
12322
  }
12660
12323
  d3VelocityDecay(decay) {
12661
12324
  if (decay === void 0) return this.config.d3VelocityDecay ?? 0.4;
12662
- const start2 = performance.now();
12663
12325
  this.config.d3VelocityDecay = decay;
12664
12326
  if (this.isInitialized && this.forceGraph) {
12665
12327
  this.getGraphInstance().d3VelocityDecay(decay);
12666
12328
  }
12667
- const callDuration = performance.now() - start2;
12668
- if (this.config.enablePerformanceMonitoring) {
12669
- console.log(`\u2705 d3VelocityDecay(${decay}) completed in ${callDuration.toFixed(3)}ms`);
12670
- }
12671
12329
  return this;
12672
12330
  }
12673
12331
  onEngineStop(handler) {
12674
12332
  if (handler === void 0) return this.config.onEngineStop;
12675
- const start2 = performance.now();
12676
12333
  this.config.onEngineStop = handler;
12677
12334
  if (this.isInitialized && this.forceGraph) {
12678
12335
  this.getGraphInstance().onEngineStop(handler);
12679
12336
  }
12680
- const callDuration = performance.now() - start2;
12681
- if (this.config.enablePerformanceMonitoring) {
12682
- console.log(`\u2705 onEngineStop() completed in ${callDuration.toFixed(3)}ms`);
12683
- }
12684
12337
  return this;
12685
12338
  }
12686
12339
  onEngineTick(handler) {
12687
12340
  if (handler === void 0) return this.config.onEngineTick;
12688
- const start2 = performance.now();
12689
12341
  this.config.onEngineTick = handler;
12690
12342
  if (this.isInitialized && this.forceGraph) {
12691
12343
  this.getGraphInstance().onEngineTick(handler);
12692
12344
  }
12693
- const callDuration = performance.now() - start2;
12694
- if (this.config.enablePerformanceMonitoring) {
12695
- console.log(`\u2705 onEngineTick() completed in ${callDuration.toFixed(3)}ms`);
12696
- }
12697
12345
  return this;
12698
12346
  }
12699
12347
  // =============================================================================
@@ -12758,9 +12406,6 @@ var ForceGraphWrapper = class {
12758
12406
  if (!this.renderingMonitor) return;
12759
12407
  this.renderingMonitor.startMonitoring();
12760
12408
  this.isRenderingOptimized = true;
12761
- if (this.enableVerboseLogging) {
12762
- console.log("\u{1F3AC} Started rendering performance monitoring");
12763
- }
12764
12409
  }
12765
12410
  /**
12766
12411
  * Stop rendering performance monitoring
@@ -12769,10 +12414,6 @@ var ForceGraphWrapper = class {
12769
12414
  if (!this.renderingMonitor) return;
12770
12415
  this.renderingMonitor.stopMonitoring();
12771
12416
  this.isRenderingOptimized = false;
12772
- if (this.enableVerboseLogging) {
12773
- const metrics = this.renderingMonitor.getMetrics();
12774
- console.log(`\u{1F3AC} Rendering performance: ${metrics.averageFps.toFixed(1)}fps, efficiency: ${(metrics.renderingEfficiency * 100).toFixed(1)}%`);
12775
- }
12776
12417
  }
12777
12418
  /**
12778
12419
  * Get current rendering performance metrics
@@ -12836,7 +12477,6 @@ var ForceGraphWrapper = class {
12836
12477
  */
12837
12478
  optimizeForDataset(nodeCount) {
12838
12479
  if (!this.forceGraph) {
12839
- console.warn("Cannot optimize: graph not initialized");
12840
12480
  return;
12841
12481
  }
12842
12482
  if (nodeCount > 5e3) {
@@ -12912,86 +12552,53 @@ var ForceGraphWrapper = class {
12912
12552
  this.initializeControls();
12913
12553
  this.initializeLegends();
12914
12554
  this.setupDoubleClickHandling();
12915
- if (this.config.enablePerformanceMonitoring) {
12916
- console.log(`\u2705 First render completed in ${renderTime.toFixed(2)}ms`);
12917
- }
12918
12555
  }
12919
12556
  cooldownTicks(ticks) {
12920
12557
  if (ticks === void 0) return this.config.cooldownTicks ?? 100;
12921
- const start2 = performance.now();
12922
12558
  this.config.cooldownTicks = ticks;
12923
12559
  if (this.isInitialized && this.forceGraph) {
12924
12560
  this.getGraphInstance().cooldownTicks(ticks);
12925
12561
  }
12926
- const callDuration = performance.now() - start2;
12927
- if (this.config.enablePerformanceMonitoring) {
12928
- console.log(`\u2705 cooldownTicks(${ticks}) completed in ${callDuration.toFixed(3)}ms`);
12929
- }
12930
12562
  return this;
12931
12563
  }
12932
12564
  d3AlphaMin(min) {
12933
12565
  if (min === void 0) return this.config.d3AlphaMin ?? 1e-3;
12934
- const start2 = performance.now();
12935
12566
  this.config.d3AlphaMin = min;
12936
12567
  if (this.isInitialized && this.forceGraph) {
12937
12568
  this.getGraphInstance().d3AlphaMin(min);
12938
12569
  }
12939
- const callDuration = performance.now() - start2;
12940
- if (this.config.enablePerformanceMonitoring) {
12941
- console.log(`\u2705 d3AlphaMin(${min}) completed in ${callDuration.toFixed(3)}ms`);
12942
- }
12943
12570
  return this;
12944
12571
  }
12945
12572
  enableNodeDrag(enable) {
12946
12573
  if (enable === void 0) return this.config.enableNodeDrag ?? true;
12947
- const start2 = performance.now();
12948
12574
  this.config.enableNodeDrag = enable;
12949
12575
  if (this.isInitialized && this.forceGraph) {
12950
12576
  this.getGraphInstance().enableNodeDrag(enable);
12951
12577
  }
12952
- const callDuration = performance.now() - start2;
12953
- if (this.config.enablePerformanceMonitoring) {
12954
- console.log(`\u2705 enableNodeDrag(${enable}) completed in ${callDuration.toFixed(3)}ms`);
12955
- }
12956
12578
  return this;
12957
12579
  }
12958
12580
  nodeCanvasObject(paintFunction) {
12959
12581
  if (paintFunction === void 0) return this.config.nodeCanvasObject ?? null;
12960
- const start2 = performance.now();
12961
12582
  this.config.nodeCanvasObject = paintFunction || void 0;
12962
12583
  if (this.isInitialized && this.forceGraph) {
12963
12584
  this.getGraphInstance().nodeCanvasObject(paintFunction);
12964
12585
  }
12965
- const callDuration = performance.now() - start2;
12966
- if (this.config.enablePerformanceMonitoring) {
12967
- console.log(`\u2705 nodeCanvasObject() completed in ${callDuration.toFixed(3)}ms`);
12968
- }
12969
12586
  return this;
12970
12587
  }
12971
12588
  linkCanvasObject(paintFunction) {
12972
12589
  if (paintFunction === void 0) return this.config.linkCanvasObject ?? null;
12973
- const start2 = performance.now();
12974
12590
  this.config.linkCanvasObject = paintFunction || void 0;
12975
12591
  if (this.isInitialized && this.forceGraph) {
12976
12592
  this.getGraphInstance().linkCanvasObject(paintFunction);
12977
12593
  }
12978
- const callDuration = performance.now() - start2;
12979
- if (this.config.enablePerformanceMonitoring) {
12980
- console.log(`\u2705 linkCanvasObject() completed in ${callDuration.toFixed(3)}ms`);
12981
- }
12982
12594
  return this;
12983
12595
  }
12984
12596
  autoPauseRedraw(enable) {
12985
12597
  if (enable === void 0) return this.config.autoPauseRedraw ?? true;
12986
- const start2 = performance.now();
12987
12598
  this.config.autoPauseRedraw = enable;
12988
12599
  if (this.isInitialized && this.forceGraph) {
12989
12600
  this.getGraphInstance().autoPauseRedraw(enable);
12990
12601
  }
12991
- const callDuration = performance.now() - start2;
12992
- if (this.config.enablePerformanceMonitoring) {
12993
- console.log(`\u2705 autoPauseRedraw(${enable}) completed in ${callDuration.toFixed(3)}ms`);
12994
- }
12995
12602
  return this;
12996
12603
  }
12997
12604
  enableZoomInteraction(enable) {
@@ -12999,15 +12606,10 @@ var ForceGraphWrapper = class {
12999
12606
  const configValue = this.config.enableZoomInteraction ?? true;
13000
12607
  return typeof configValue === "function" ? true : configValue;
13001
12608
  }
13002
- const start2 = performance.now();
13003
12609
  this.config.enableZoomInteraction = enable;
13004
12610
  if (this.isInitialized && this.forceGraph) {
13005
12611
  this.getGraphInstance().enableZoomInteraction(enable);
13006
12612
  }
13007
- const callDuration = performance.now() - start2;
13008
- if (this.config.enablePerformanceMonitoring) {
13009
- console.log(`\u2705 enableZoomInteraction(${enable}) completed in ${callDuration.toFixed(3)}ms`);
13010
- }
13011
12613
  return this;
13012
12614
  }
13013
12615
  enablePanInteraction(enable) {
@@ -13015,15 +12617,10 @@ var ForceGraphWrapper = class {
13015
12617
  const configValue = this.config.enablePanInteraction ?? true;
13016
12618
  return typeof configValue === "function" ? true : configValue;
13017
12619
  }
13018
- const start2 = performance.now();
13019
12620
  this.config.enablePanInteraction = enable;
13020
12621
  if (this.isInitialized && this.forceGraph) {
13021
12622
  this.getGraphInstance().enablePanInteraction(enable);
13022
12623
  }
13023
- const callDuration = performance.now() - start2;
13024
- if (this.config.enablePerformanceMonitoring) {
13025
- console.log(`\u2705 enablePanInteraction(${enable}) completed in ${callDuration.toFixed(3)}ms`);
13026
- }
13027
12624
  return this;
13028
12625
  }
13029
12626
  // =============================================================================
@@ -13050,9 +12647,6 @@ var ForceGraphWrapper = class {
13050
12647
  try {
13051
12648
  this.controlsInstance = createGraphControls(this.container, controlActions, controlsConfig);
13052
12649
  this.controlsInstance.mount();
13053
- if (this.config.enablePerformanceMonitoring) {
13054
- console.log("\u2705 Graph controls initialized");
13055
- }
13056
12650
  } catch {
13057
12651
  }
13058
12652
  }
@@ -13110,9 +12704,6 @@ var ForceGraphWrapper = class {
13110
12704
  this.legendsInstance = createGraphLegends(this.container, legendsConfig);
13111
12705
  this.legendsInstance.mount();
13112
12706
  this.updateLegends();
13113
- if (this.config.enablePerformanceMonitoring) {
13114
- console.log("\u2705 Graph legends initialized");
13115
- }
13116
12707
  } catch {
13117
12708
  }
13118
12709
  }
@@ -13310,7 +12901,6 @@ var ForceGraphWrapper = class {
13310
12901
  if (!this.isInitialized) {
13311
12902
  throw new Error("Graph not initialized");
13312
12903
  }
13313
- const start2 = performance.now();
13314
12904
  try {
13315
12905
  const defaultFileName = `polly-graph-export-${Date.now()}.png`;
13316
12906
  const finalFileName = fileName || defaultFileName;
@@ -13366,10 +12956,6 @@ var ForceGraphWrapper = class {
13366
12956
  elementsToHide.forEach(({ element, originalDisplay }) => {
13367
12957
  element.style.display = originalDisplay;
13368
12958
  });
13369
- const duration = performance.now() - start2;
13370
- if (this.config.enablePerformanceMonitoring) {
13371
- console.log(`\u2705 exportGraph completed in ${duration.toFixed(3)}ms`);
13372
- }
13373
12959
  } catch (error) {
13374
12960
  const controls = this.container.querySelectorAll(".fg-controls");
13375
12961
  controls.forEach((control) => {
@@ -13381,10 +12967,6 @@ var ForceGraphWrapper = class {
13381
12967
  const element = legend;
13382
12968
  element.style.display = "";
13383
12969
  });
13384
- const duration = performance.now() - start2;
13385
- if (this.config.enablePerformanceMonitoring) {
13386
- console.log(`\u274C exportGraph failed in ${duration.toFixed(3)}ms`);
13387
- }
13388
12970
  throw error;
13389
12971
  }
13390
12972
  }
@@ -13475,8 +13057,12 @@ var ForceGraphWrapper = class {
13475
13057
  const viewportHeight = this.container.clientHeight - paddingValue;
13476
13058
  const targetZoom = Math.min(viewportWidth / width, viewportHeight / height);
13477
13059
  this.getGraphInstance().centerAt(centerX, centerY, duration / 2);
13478
- setTimeout(() => {
13060
+ if (this.kapsuleTimeoutId) {
13061
+ clearTimeout(this.kapsuleTimeoutId);
13062
+ }
13063
+ this.kapsuleTimeoutId = setTimeout(() => {
13479
13064
  this.zoom(targetZoom, duration / 2);
13065
+ this.kapsuleTimeoutId = null;
13480
13066
  }, duration / 2);
13481
13067
  }
13482
13068
  }
@@ -13502,10 +13088,7 @@ var ForceGraphWrapper = class {
13502
13088
  }
13503
13089
  }
13504
13090
  }
13505
- } catch (error) {
13506
- if (this.config.enablePerformanceMonitoring) {
13507
- console.log("Kapsule update fallback used:", error);
13508
- }
13091
+ } catch {
13509
13092
  }
13510
13093
  }
13511
13094
  /**
@@ -13536,6 +13119,7 @@ var ForceGraphWrapper = class {
13536
13119
  this.cleanupDeferredFitView();
13537
13120
  this.cleanupPerformanceTest();
13538
13121
  this.cleanupExportTimeout();
13122
+ this.cleanupVisibilityTimeouts();
13539
13123
  this.cleanupCanvasEventListeners();
13540
13124
  physicsWorkerManager.terminate();
13541
13125
  this.stopRenderingMonitoring();