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.js CHANGED
@@ -10238,8 +10238,7 @@ var PhysicsWorkerManagerImpl = class {
10238
10238
  this.workerUrl = URL.createObjectURL(blob);
10239
10239
  this.worker = new Worker(this.workerUrl);
10240
10240
  this.setupWorkerEventListeners();
10241
- } catch (error) {
10242
- console.warn("Physics Worker initialization failed:", error);
10241
+ } catch {
10243
10242
  this.worker = null;
10244
10243
  }
10245
10244
  }
@@ -10253,11 +10252,18 @@ var PhysicsWorkerManagerImpl = class {
10253
10252
  * Runs D3 force simulation in a dedicated worker thread for consistent timing
10254
10253
  */
10255
10254
 
10256
- // Import D3 dependencies for force simulation
10257
- importScripts('https://cdn.jsdelivr.net/npm/d3-dispatch@3/dist/d3-dispatch.min.js');
10258
- importScripts('https://cdn.jsdelivr.net/npm/d3-quadtree@3/dist/d3-quadtree.min.js');
10259
- importScripts('https://cdn.jsdelivr.net/npm/d3-timer@3/dist/d3-timer.min.js');
10260
- importScripts('https://cdn.jsdelivr.net/npm/d3-force@3/dist/d3-force.min.js');
10255
+ // D3 modules embedded locally to avoid CDN dependency
10256
+ // D3 Dispatch v3.0.1
10257
+ !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})}))
10258
+
10259
+ // D3 Quadtree v3.0.1
10260
+ !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})}))
10261
+
10262
+ // D3 Timer v3.0.1
10263
+ !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})}))
10264
+
10265
+ // D3 Force v3.0.0
10266
+ !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})}))
10261
10267
 
10262
10268
  class PhysicsWorker {
10263
10269
  constructor() {
@@ -10499,7 +10505,6 @@ self.onmessage = function(event) {
10499
10505
  }
10500
10506
  };
10501
10507
  this.worker.onerror = (error) => {
10502
- console.error("Physics Worker error:", error);
10503
10508
  this.rejectPromise(new Error(`Worker error: ${error.message}`));
10504
10509
  };
10505
10510
  }
@@ -10560,7 +10565,6 @@ self.onmessage = function(event) {
10560
10565
  */
10561
10566
  async initialize(config) {
10562
10567
  if (!this.worker) {
10563
- console.warn("Physics Worker not available, falling back to main thread");
10564
10568
  return false;
10565
10569
  }
10566
10570
  try {
@@ -10569,8 +10573,7 @@ self.onmessage = function(event) {
10569
10573
  data: config
10570
10574
  });
10571
10575
  return response.success;
10572
- } catch (error) {
10573
- console.error("Failed to initialize physics simulation:", error);
10576
+ } catch {
10574
10577
  return false;
10575
10578
  }
10576
10579
  }
@@ -10581,31 +10584,26 @@ self.onmessage = function(event) {
10581
10584
  if (!this.worker) {
10582
10585
  throw new Error("Physics Worker not available");
10583
10586
  }
10584
- try {
10585
- await this.sendMessage({
10586
- type: "run"
10587
- });
10588
- return new Promise((resolve, reject) => {
10589
- if (!this.worker) {
10590
- reject(new Error("Physics Worker not available"));
10591
- return;
10587
+ await this.sendMessage({
10588
+ type: "run"
10589
+ });
10590
+ return new Promise((resolve, reject) => {
10591
+ if (!this.worker) {
10592
+ reject(new Error("Physics Worker not available"));
10593
+ return;
10594
+ }
10595
+ const handleMessage = (event) => {
10596
+ const { type, data } = event.data;
10597
+ if (type === "simulation_complete") {
10598
+ this.worker?.removeEventListener("message", handleMessage);
10599
+ resolve(data.nodes);
10600
+ } else if (type === "error") {
10601
+ this.worker?.removeEventListener("message", handleMessage);
10602
+ reject(new Error(data.message));
10592
10603
  }
10593
- const handleMessage = (event) => {
10594
- const { type, data } = event.data;
10595
- if (type === "simulation_complete") {
10596
- this.worker?.removeEventListener("message", handleMessage);
10597
- resolve(data.nodes);
10598
- } else if (type === "error") {
10599
- this.worker?.removeEventListener("message", handleMessage);
10600
- reject(new Error(data.message));
10601
- }
10602
- };
10603
- this.worker.addEventListener("message", handleMessage);
10604
- });
10605
- } catch (error) {
10606
- console.error("Physics simulation failed:", error);
10607
- throw error;
10608
- }
10604
+ };
10605
+ this.worker.addEventListener("message", handleMessage);
10606
+ });
10609
10607
  }
10610
10608
  /**
10611
10609
  * Stop the current simulation
@@ -10748,20 +10746,6 @@ var PerformanceMonitor = class {
10748
10746
  * Log performance summary to console
10749
10747
  */
10750
10748
  logSummary() {
10751
- const summary = this.getSummary();
10752
- console.group("\u{1F680} Force-Graph Wrapper Performance Summary");
10753
- console.log("\u{1F4CA} Averages:", summary.averages);
10754
- console.log("\u26A1 Peaks:", summary.peaks);
10755
- console.log("\u{1F4C8} Node Scaling:", summary.nodeScaling);
10756
- console.log("\u{1F4BE} Memory Usage:", `${this.metrics["memoryUsage"].toFixed(2)} MB`);
10757
- console.log("\u{1F4CF} Graph Size:", `${this.metrics["nodeCount"]} nodes, ${this.metrics["linkCount"]} links`);
10758
- if (summary.warnings.length > 0) {
10759
- console.warn("\u26A0\uFE0F Performance Warnings:");
10760
- summary.warnings.forEach((warning) => console.warn(` \u2022 ${warning}`));
10761
- } else {
10762
- console.log("\u2705 No performance warnings");
10763
- }
10764
- console.groupEnd();
10765
10749
  }
10766
10750
  };
10767
10751
  var globalPerformanceMonitor = new PerformanceMonitor();
@@ -11039,14 +11023,12 @@ var CanvasOptimizer = class {
11039
11023
  * Clean up all cached data and references
11040
11024
  */
11041
11025
  destroy() {
11042
- console.log("\u{1F9F9} Cleaning up CanvasOptimizer...");
11043
11026
  this.imageDataCache.clear();
11044
11027
  this.pathCache.clear();
11045
11028
  this.renderQueue.length = 0;
11046
11029
  this.canvas = null;
11047
11030
  this.context = null;
11048
11031
  this.isOptimizing = false;
11049
- console.log("\u2705 CanvasOptimizer cleanup completed");
11050
11032
  }
11051
11033
  /**
11052
11034
  * Update viewport information for culling calculations
@@ -11295,6 +11277,10 @@ var ForceGraphWrapper = class {
11295
11277
  canvasClickHandler = null;
11296
11278
  // Export animation timeout for cleanup
11297
11279
  exportTimeoutId = null;
11280
+ // Visibility change timeouts for cleanup
11281
+ visibilityTimeoutId = null;
11282
+ intersectionTimeoutId = null;
11283
+ kapsuleTimeoutId = null;
11298
11284
  // Graph controls UI
11299
11285
  controlsInstance = null;
11300
11286
  // Graph legends UI
@@ -11377,18 +11363,16 @@ var ForceGraphWrapper = class {
11377
11363
  this.visibilityChangeHandler = () => {
11378
11364
  if (!document.hidden && this.isInitialized) {
11379
11365
  if (this.wasInitializedHidden) {
11380
- if (this.enableVerboseLogging) {
11381
- console.log("\u{1F504} Restarting simulation due to visibility change for layout consistency");
11382
- }
11383
11366
  this.getGraphInstance().d3ReheatSimulation();
11384
11367
  this.wasInitializedHidden = false;
11385
11368
  }
11386
11369
  if (this.pendingFitView) {
11387
- setTimeout(() => {
11388
- if (this.enableVerboseLogging) {
11389
- console.log("\u{1F3AF} Executing deferred fitView after visibility change");
11390
- }
11370
+ if (this.visibilityTimeoutId) {
11371
+ clearTimeout(this.visibilityTimeoutId);
11372
+ }
11373
+ this.visibilityTimeoutId = setTimeout(() => {
11391
11374
  this.zoomToFit(40, 300);
11375
+ this.visibilityTimeoutId = null;
11392
11376
  }, 100);
11393
11377
  }
11394
11378
  }
@@ -11414,30 +11398,12 @@ var ForceGraphWrapper = class {
11414
11398
  }
11415
11399
  const isInViewport = this.isElementInViewport(this.container);
11416
11400
  this.wasInitializedOutOfView = !isInViewport;
11417
- if (this.enableVerboseLogging) {
11418
- const rect = this.container.getBoundingClientRect();
11419
- console.log(`\u{1F4CD} Graph initialized:`, {
11420
- wasInitializedOutOfView: this.wasInitializedOutOfView,
11421
- isInViewport,
11422
- containerDimensions: `${this.container.clientWidth}x${this.container.clientHeight}`,
11423
- boundingRect: {
11424
- top: rect.top,
11425
- bottom: rect.bottom,
11426
- left: rect.left,
11427
- right: rect.right
11428
- },
11429
- windowSize: `${window.innerWidth}x${window.innerHeight}`
11430
- });
11431
- }
11432
11401
  if (typeof IntersectionObserver !== "undefined") {
11433
11402
  const scrollableParent = this.findScrollableParent(this.container);
11434
11403
  this.intersectionObserver = new IntersectionObserver((entries) => {
11435
11404
  entries.forEach((entry) => {
11436
11405
  if (entry.isIntersecting && this.isInitialized) {
11437
11406
  if (this.wasInitializedOutOfView) {
11438
- if (this.enableVerboseLogging) {
11439
- console.log("\u{1F504} Element entered viewport - ensuring consistent physics");
11440
- }
11441
11407
  if (this.physicsTimeoutId) {
11442
11408
  window.clearTimeout(this.physicsTimeoutId);
11443
11409
  this.physicsTimeoutId = void 0;
@@ -11448,13 +11414,14 @@ var ForceGraphWrapper = class {
11448
11414
  this.wasInitializedOutOfView = false;
11449
11415
  }
11450
11416
  if (this.pendingFitView) {
11451
- setTimeout(() => {
11417
+ if (this.intersectionTimeoutId) {
11418
+ clearTimeout(this.intersectionTimeoutId);
11419
+ }
11420
+ this.intersectionTimeoutId = setTimeout(() => {
11452
11421
  if (this.pendingFitView) {
11453
- if (this.enableVerboseLogging) {
11454
- console.log("\u{1F3AF} Executing deferred fitView after entering viewport");
11455
- }
11456
11422
  this.zoomToFit(40, 300);
11457
11423
  }
11424
+ this.intersectionTimeoutId = null;
11458
11425
  }, 100);
11459
11426
  }
11460
11427
  }
@@ -11480,16 +11447,10 @@ var ForceGraphWrapper = class {
11480
11447
  const style = window.getComputedStyle(current);
11481
11448
  const overflow = style.overflow + style.overflowY + style.overflowX;
11482
11449
  if (/(auto|scroll)/.test(overflow) && (current.scrollHeight > current.clientHeight || current.scrollWidth > current.clientWidth)) {
11483
- if (this.enableVerboseLogging) {
11484
- console.log("\u{1F4CD} Found scrollable parent:", current.className || current.tagName);
11485
- }
11486
11450
  return current;
11487
11451
  }
11488
11452
  current = current.parentElement;
11489
11453
  }
11490
- if (this.enableVerboseLogging) {
11491
- console.log("\u{1F4CD} No scrollable parent found, using viewport as root");
11492
- }
11493
11454
  return null;
11494
11455
  }
11495
11456
  /**
@@ -11500,15 +11461,9 @@ var ForceGraphWrapper = class {
11500
11461
  if (this.intersectionObserver || !this.container || !this.deferredFitViewParams) {
11501
11462
  return;
11502
11463
  }
11503
- if (this.enableVerboseLogging) {
11504
- console.log("\u{1F3AF} Setting up library-level deferred fitView");
11505
- }
11506
11464
  this.intersectionObserver = new IntersectionObserver((entries) => {
11507
11465
  entries.forEach((entry) => {
11508
11466
  if (entry.isIntersecting && this.pendingFitView && this.deferredFitViewParams) {
11509
- if (this.enableVerboseLogging) {
11510
- console.log("\u{1F3AF} Library executing deferred fitView (now visible)");
11511
- }
11512
11467
  const { padding, duration } = this.deferredFitViewParams;
11513
11468
  this.pendingFitView = false;
11514
11469
  this.deferredFitViewParams = null;
@@ -11536,9 +11491,6 @@ var ForceGraphWrapper = class {
11536
11491
  const containerWidth = this.container.clientWidth;
11537
11492
  const containerHeight = this.container.clientHeight;
11538
11493
  if (containerWidth === 0 || containerHeight === 0) {
11539
- if (this.enableVerboseLogging) {
11540
- console.warn("\u26A0\uFE0F Still no valid dimensions for deferred fitView");
11541
- }
11542
11494
  return;
11543
11495
  }
11544
11496
  this.cacheContainerDimensions();
@@ -11553,9 +11505,6 @@ var ForceGraphWrapper = class {
11553
11505
  const scale = Math.min(viewportWidth / width, viewportHeight / height);
11554
11506
  this.getGraphInstance().centerAt(centerX, centerY, duration);
11555
11507
  this.getGraphInstance().zoom(scale, duration);
11556
- if (this.enableVerboseLogging) {
11557
- console.log("\u2705 Library deferred fitView executed successfully");
11558
- }
11559
11508
  }
11560
11509
  }
11561
11510
  /**
@@ -11587,6 +11536,23 @@ var ForceGraphWrapper = class {
11587
11536
  this.exportTimeoutId = null;
11588
11537
  }
11589
11538
  }
11539
+ /**
11540
+ * Cleanup visibility-related timeouts
11541
+ */
11542
+ cleanupVisibilityTimeouts() {
11543
+ if (this.visibilityTimeoutId) {
11544
+ clearTimeout(this.visibilityTimeoutId);
11545
+ this.visibilityTimeoutId = null;
11546
+ }
11547
+ if (this.intersectionTimeoutId) {
11548
+ clearTimeout(this.intersectionTimeoutId);
11549
+ this.intersectionTimeoutId = null;
11550
+ }
11551
+ if (this.kapsuleTimeoutId) {
11552
+ clearTimeout(this.kapsuleTimeoutId);
11553
+ this.kapsuleTimeoutId = null;
11554
+ }
11555
+ }
11590
11556
  /**
11591
11557
  * Cleanup canvas event listeners
11592
11558
  */
@@ -11619,9 +11585,6 @@ var ForceGraphWrapper = class {
11619
11585
  const height = this.container.clientHeight;
11620
11586
  if (width > 0 && height > 0) {
11621
11587
  this.lastKnownDimensions = { width, height };
11622
- if (this.enableVerboseLogging) {
11623
- console.log("\u{1F4D0} Cached container dimensions:", this.lastKnownDimensions);
11624
- }
11625
11588
  }
11626
11589
  }
11627
11590
  /**
@@ -11649,9 +11612,6 @@ var ForceGraphWrapper = class {
11649
11612
  }
11650
11613
  try {
11651
11614
  if (!physicsWorkerManager.isAvailable()) {
11652
- if (this.enableVerboseLogging) {
11653
- console.warn("\u26A0\uFE0F Web Worker not available, using main thread physics");
11654
- }
11655
11615
  return;
11656
11616
  }
11657
11617
  const containerWidth = this.container.clientWidth || this.config.width || 800;
@@ -11670,16 +11630,6 @@ var ForceGraphWrapper = class {
11670
11630
  forces: {}
11671
11631
  // Let worker use force-graph defaults
11672
11632
  };
11673
- if (this.enableVerboseLogging) {
11674
- console.log("\u{1F3AF} Web Worker physics config:", {
11675
- containerDimensions: `${containerWidth}x${containerHeight}`,
11676
- configDimensions: `${this.config.width || "auto"}x${this.config.height || "auto"}`,
11677
- nodeCount: nodes.length
11678
- });
11679
- }
11680
- if (this.enableVerboseLogging) {
11681
- console.log("\u{1F504} Running Web Worker physics for ALL graphs (visible & hidden)...");
11682
- }
11683
11633
  const initialized = await physicsWorkerManager.initialize(config);
11684
11634
  if (!initialized) {
11685
11635
  throw new Error("Failed to initialize Web Worker physics");
@@ -11687,13 +11637,7 @@ var ForceGraphWrapper = class {
11687
11637
  const finalNodes = await physicsWorkerManager.runSimulation();
11688
11638
  this.applyWebWorkerResults(finalNodes);
11689
11639
  this.webWorkerPhysicsCompleted = true;
11690
- if (this.enableVerboseLogging) {
11691
- console.log(`\u2705 Web Worker physics completed for ALL graphs with ${finalNodes.length} nodes`);
11692
- }
11693
- } catch (error) {
11694
- if (this.enableVerboseLogging) {
11695
- console.warn("\u26A0\uFE0F Web Worker physics failed:", error);
11696
- }
11640
+ } catch {
11697
11641
  }
11698
11642
  }
11699
11643
  /**
@@ -11719,9 +11663,6 @@ var ForceGraphWrapper = class {
11719
11663
  }
11720
11664
  }
11721
11665
  this.triggerKapsuleUpdate();
11722
- if (this.enableVerboseLogging) {
11723
- console.log("\u2705 Applied Web Worker results without disrupting interactions");
11724
- }
11725
11666
  }
11726
11667
  /**
11727
11668
  * Cleanup deterministic physics handling
@@ -11904,57 +11845,33 @@ var ForceGraphWrapper = class {
11904
11845
  if (this.forceGraph) {
11905
11846
  this.getGraphInstance().d3ReheatSimulation();
11906
11847
  }
11907
- if (this.enableVerboseLogging) {
11908
- console.log("\u2705 d3ReheatSimulation called");
11909
- }
11910
11848
  }
11911
11849
  stopAnimation() {
11912
11850
  if (!this.isInitialized) return;
11913
- const start2 = performance.now();
11914
11851
  if (this.forceGraph) {
11915
11852
  this.getGraphInstance().pauseAnimation();
11916
11853
  }
11917
- const duration = performance.now() - start2;
11918
- if (this.config.enablePerformanceMonitoring) {
11919
- console.log(`\u2705 stopAnimation completed in ${duration.toFixed(3)}ms`);
11920
- }
11921
11854
  }
11922
11855
  pauseAnimation() {
11923
11856
  if (!this.isInitialized) return;
11924
- const start2 = performance.now();
11925
11857
  if (this.forceGraph) {
11926
11858
  this.getGraphInstance().pauseAnimation();
11927
11859
  }
11928
- const duration = performance.now() - start2;
11929
- if (this.config.enablePerformanceMonitoring) {
11930
- console.log(`\u2705 pauseAnimation completed in ${duration.toFixed(3)}ms`);
11931
- }
11932
11860
  }
11933
11861
  resumeAnimation() {
11934
11862
  if (!this.isInitialized) return;
11935
- const start2 = performance.now();
11936
11863
  if (this.forceGraph) {
11937
11864
  this.getGraphInstance().resumeAnimation();
11938
11865
  }
11939
- const duration = performance.now() - start2;
11940
- if (this.config.enablePerformanceMonitoring) {
11941
- console.log(`\u2705 resumeAnimation completed in ${duration.toFixed(3)}ms`);
11942
- }
11943
11866
  }
11944
11867
  centerAt(x3, y3, duration) {
11945
11868
  if (!this.isInitialized) this.initializeForceGraph();
11946
- const start2 = performance.now();
11947
11869
  if (this.forceGraph) {
11948
11870
  this.getGraphInstance().centerAt(x3, y3, duration);
11949
11871
  }
11950
- const callDuration = performance.now() - start2;
11951
- if (this.config.enablePerformanceMonitoring) {
11952
- console.log(`\u2705 centerAt(${x3}, ${y3}) completed in ${callDuration.toFixed(3)}ms`);
11953
- }
11954
11872
  }
11955
11873
  zoom(scale, duration) {
11956
11874
  if (!this.isInitialized) this.initializeForceGraph();
11957
- const start2 = performance.now();
11958
11875
  let result = void 0;
11959
11876
  if (this.forceGraph) {
11960
11877
  if (scale === void 0) {
@@ -11966,19 +11883,10 @@ var ForceGraphWrapper = class {
11966
11883
  } else if (scale === void 0) {
11967
11884
  result = 1;
11968
11885
  }
11969
- const callDuration = performance.now() - start2;
11970
- if (this.config.enablePerformanceMonitoring) {
11971
- if (scale === void 0) {
11972
- console.log(`\u2705 zoom() getter completed in ${callDuration.toFixed(3)}ms`);
11973
- } else {
11974
- console.log(`\u2705 zoom(${scale}) setter completed in ${callDuration.toFixed(3)}ms`);
11975
- }
11976
- }
11977
11886
  return result;
11978
11887
  }
11979
11888
  zoomToFit(padding, duration) {
11980
11889
  if (!this.isInitialized) this.initializeForceGraph();
11981
- const start2 = performance.now();
11982
11890
  const containerWidth = this.container.clientWidth;
11983
11891
  const containerHeight = this.container.clientHeight;
11984
11892
  const isInViewport = this.container ? this.isElementInViewport(this.container) : false;
@@ -11989,26 +11897,9 @@ var ForceGraphWrapper = class {
11989
11897
  const bbox = this.getGraphInstance().getGraphBbox();
11990
11898
  bboxValid = bbox && bbox.x[1] - bbox.x[0] > 0 && bbox.y[1] - bbox.y[0] > 0;
11991
11899
  }
11992
- if (this.enableVerboseLogging) {
11993
- console.log("\u{1F3AF} Library zoomToFit called:", {
11994
- containerDimensions: `${containerWidth}x${containerHeight}`,
11995
- isInViewport,
11996
- isVisible,
11997
- hasValidDimensions,
11998
- bboxValid,
11999
- documentHidden: document.hidden,
12000
- padding: padding || 40,
12001
- duration: duration || 300
12002
- });
12003
- }
12004
11900
  if (!isVisible || !hasValidDimensions || !bboxValid) {
12005
11901
  this.deferredFitViewParams = { padding: padding || 40, duration: duration || 300 };
12006
11902
  this.pendingFitView = true;
12007
- if (this.enableVerboseLogging) {
12008
- console.log("\u{1F3AF} Library DEFERRING fitView:", {
12009
- reason: !isVisible ? "not visible" : !hasValidDimensions ? "invalid dimensions" : "invalid bbox"
12010
- });
12011
- }
12012
11903
  this.setupDeferredFitView();
12013
11904
  return;
12014
11905
  }
@@ -12023,112 +11914,54 @@ var ForceGraphWrapper = class {
12023
11914
  const viewportWidth = containerWidth - paddingValue;
12024
11915
  const viewportHeight = containerHeight - paddingValue;
12025
11916
  const scale = Math.min(viewportWidth / width, viewportHeight / height);
12026
- if (this.enableVerboseLogging) {
12027
- console.log("\u{1F3AF} zoomToFit calculations:", {
12028
- bbox: { width, height, centerX, centerY },
12029
- container: {
12030
- clientWidth: containerWidth,
12031
- clientHeight: containerHeight,
12032
- viewportWidth,
12033
- viewportHeight
12034
- },
12035
- scale,
12036
- willApply: width > 0 && height > 0
12037
- });
12038
- }
12039
11917
  if (width > 0 && height > 0) {
12040
11918
  this.getGraphInstance().centerAt(centerX, centerY);
12041
11919
  this.getGraphInstance().zoom(scale, duration || 300);
12042
11920
  this.pendingFitView = false;
12043
- if (this.enableVerboseLogging) {
12044
- console.log("\u2705 zoomToFit applied successfully");
12045
- }
12046
- } else if (this.enableVerboseLogging) {
12047
- console.warn("\u26A0\uFE0F zoomToFit skipped - invalid bbox:", {
12048
- bboxValid: width > 0 && height > 0
12049
- });
12050
11921
  }
12051
11922
  }
12052
- const callDuration = performance.now() - start2;
12053
- if (this.config.enablePerformanceMonitoring) {
12054
- console.log(`\u2705 zoomToFit() completed in ${callDuration.toFixed(3)}ms`);
12055
- }
12056
11923
  }
12057
11924
  screen2GraphCoords(screenX, screenY) {
12058
11925
  if (!this.isInitialized) this.initializeForceGraph();
12059
- const start2 = performance.now();
12060
11926
  let result = { x: 0, y: 0 };
12061
11927
  if (this.forceGraph) {
12062
11928
  result = this.getGraphInstance().screen2GraphCoords(screenX, screenY) || { x: 0, y: 0 };
12063
11929
  }
12064
- const callDuration = performance.now() - start2;
12065
- if (this.config.enablePerformanceMonitoring) {
12066
- console.log(`\u2705 screen2GraphCoords(${screenX}, ${screenY}) completed in ${callDuration.toFixed(3)}ms`);
12067
- }
12068
11930
  return result;
12069
11931
  }
12070
11932
  graph2ScreenCoords(graphX, graphY) {
12071
11933
  if (!this.isInitialized) this.initializeForceGraph();
12072
- const start2 = performance.now();
12073
11934
  let result = { x: 0, y: 0 };
12074
11935
  if (this.forceGraph) {
12075
11936
  result = this.getGraphInstance().graph2ScreenCoords(graphX, graphY) || { x: 0, y: 0 };
12076
11937
  }
12077
- const callDuration = performance.now() - start2;
12078
- if (this.config.enablePerformanceMonitoring) {
12079
- console.log(`\u2705 graph2ScreenCoords(${graphX}, ${graphY}) completed in ${callDuration.toFixed(3)}ms`);
12080
- }
12081
11938
  return result;
12082
11939
  }
12083
11940
  getGraphBbox(nodes) {
12084
11941
  if (!this.isInitialized) this.initializeForceGraph();
12085
- const start2 = performance.now();
12086
11942
  let result = { x: [0, 0], y: [0, 0] };
12087
11943
  if (this.forceGraph) {
12088
11944
  result = this.getGraphInstance().getGraphBbox(nodes) || { x: [0, 0], y: [0, 0] };
12089
11945
  }
12090
- const callDuration = performance.now() - start2;
12091
- if (this.config.enablePerformanceMonitoring) {
12092
- console.log(`\u2705 getGraphBbox() completed in ${callDuration.toFixed(3)}ms`);
12093
- }
12094
11946
  return result;
12095
11947
  }
12096
11948
  emitParticle(link) {
12097
11949
  if (!this.isInitialized) this.initializeForceGraph();
12098
- const start2 = performance.now();
12099
11950
  if (this.forceGraph) {
12100
11951
  this.getGraphInstance().emitParticle(link);
12101
11952
  }
12102
- const callDuration = performance.now() - start2;
12103
- if (this.config.enablePerformanceMonitoring) {
12104
- console.log(`\u2705 emitParticle() completed in ${callDuration.toFixed(3)}ms`);
12105
- }
12106
11953
  }
12107
11954
  d3Force(forceName, forceImpl) {
12108
11955
  if (!this.isInitialized) this.initializeForceGraph();
12109
- const start2 = performance.now();
12110
11956
  if (this.forceGraph) {
12111
11957
  if (forceImpl !== void 0) {
12112
11958
  this.getGraphInstance().d3Force(forceName, forceImpl);
12113
- const callDuration2 = performance.now() - start2;
12114
- if (this.config.enablePerformanceMonitoring) {
12115
- console.log(`\u2705 d3Force(set ${forceName}) completed in ${callDuration2.toFixed(3)}ms`);
12116
- }
12117
11959
  return this;
12118
11960
  } else {
12119
11961
  const result = this.getGraphInstance().d3Force(forceName);
12120
- const callDuration2 = performance.now() - start2;
12121
- if (this.config.enablePerformanceMonitoring) {
12122
- console.log(`\u2705 d3Force(get ${forceName}) completed in ${callDuration2.toFixed(3)}ms`);
12123
- }
12124
11962
  return result;
12125
11963
  }
12126
11964
  }
12127
- const callDuration = performance.now() - start2;
12128
- if (this.config.enablePerformanceMonitoring) {
12129
- const action = forceImpl !== void 0 ? "set" : "get";
12130
- console.log(`\u2705 d3Force(${action} ${forceName}) completed in ${callDuration.toFixed(3)}ms`);
12131
- }
12132
11965
  return forceImpl !== void 0 ? this : null;
12133
11966
  }
12134
11967
  graphData(data) {
@@ -12155,27 +11988,12 @@ var ForceGraphWrapper = class {
12155
11988
  }
12156
11989
  this.updateLegends();
12157
11990
  }
12158
- if (this.enableVerboseLogging) {
12159
- console.log(`\u{1F50D} Web Worker trigger check:`, {
12160
- deterministicLayout: this.config.deterministicLayout !== false,
12161
- wasInitializedOutOfView: this.wasInitializedOutOfView,
12162
- hasNodes: data?.nodes?.length > 0,
12163
- webWorkerCompleted: this.webWorkerPhysicsCompleted,
12164
- nodeCount: data?.nodes?.length || 0
12165
- });
12166
- }
12167
11991
  if (this.config.deterministicLayout !== false && this.wasInitializedOutOfView && data?.nodes?.length > 0 && !this.webWorkerPhysicsCompleted) {
12168
- if (this.enableVerboseLogging) {
12169
- console.log(`\u{1F3AF} Triggering Web Worker physics for off-screen graph with ${data.nodes.length} nodes`);
12170
- }
12171
11992
  if (this.physicsTimeoutId) {
12172
11993
  window.clearTimeout(this.physicsTimeoutId);
12173
11994
  }
12174
11995
  this.physicsTimeoutId = window.setTimeout(() => {
12175
- this.runWebWorkerPhysics().catch((error) => {
12176
- if (this.enableVerboseLogging) {
12177
- console.warn("\u26A0\uFE0F Web Worker physics failed:", error);
12178
- }
11996
+ this.runWebWorkerPhysics().catch(() => {
12179
11997
  });
12180
11998
  }, 200);
12181
11999
  }
@@ -12185,445 +12003,275 @@ var ForceGraphWrapper = class {
12185
12003
  if (width === void 0) {
12186
12004
  return this.config.width ?? 400;
12187
12005
  }
12188
- const start2 = performance.now();
12189
12006
  this.config.width = width;
12190
12007
  if (this.isInitialized && this.forceGraph) {
12191
12008
  this.getGraphInstance().width(width);
12192
12009
  }
12193
- const callDuration = performance.now() - start2;
12194
- if (this.config.enablePerformanceMonitoring) {
12195
- console.log(`\u2705 width(${width}) completed in ${callDuration.toFixed(3)}ms`);
12196
- }
12197
12010
  return this;
12198
12011
  }
12199
12012
  height(height) {
12200
12013
  if (height === void 0) {
12201
12014
  return this.config.height ?? 300;
12202
12015
  }
12203
- const start2 = performance.now();
12204
12016
  this.config.height = height;
12205
12017
  if (this.isInitialized && this.forceGraph) {
12206
12018
  this.getGraphInstance().height(height);
12207
12019
  }
12208
- const callDuration = performance.now() - start2;
12209
- if (this.config.enablePerformanceMonitoring) {
12210
- console.log(`\u2705 height(${height}) completed in ${callDuration.toFixed(3)}ms`);
12211
- }
12212
12020
  return this;
12213
12021
  }
12214
12022
  backgroundColor(color2) {
12215
12023
  if (color2 === void 0) {
12216
12024
  return this.config.backgroundColor ?? "#ffffff";
12217
12025
  }
12218
- const start2 = performance.now();
12219
12026
  this.config.backgroundColor = color2;
12220
12027
  if (this.isInitialized && this.forceGraph) {
12221
12028
  this.getGraphInstance().backgroundColor(color2);
12222
12029
  }
12223
- const callDuration = performance.now() - start2;
12224
- if (this.config.enablePerformanceMonitoring) {
12225
- console.log(`\u2705 backgroundColor(${color2}) completed in ${callDuration.toFixed(3)}ms`);
12226
- }
12227
12030
  return this;
12228
12031
  }
12229
12032
  nodeColor(color2) {
12230
12033
  if (color2 === void 0) return this.config.nodeColor ?? "#999999";
12231
- const start2 = performance.now();
12232
12034
  this.config.nodeColor = color2;
12233
12035
  if (this.isInitialized && this.forceGraph) {
12234
12036
  this.getGraphInstance().nodeColor(color2);
12235
12037
  }
12236
- const callDuration = performance.now() - start2;
12237
- if (this.config.enablePerformanceMonitoring) {
12238
- console.log(`\u2705 nodeColor() completed in ${callDuration.toFixed(3)}ms`);
12239
- }
12240
12038
  return this;
12241
12039
  }
12242
12040
  nodeVal(val) {
12243
12041
  if (val === void 0) return this.config.nodeVal ?? 1;
12244
- const start2 = performance.now();
12245
12042
  this.config.nodeVal = val;
12246
12043
  if (this.isInitialized && this.forceGraph) {
12247
12044
  this.getGraphInstance().nodeVal(val);
12248
12045
  }
12249
- const callDuration = performance.now() - start2;
12250
- if (this.config.enablePerformanceMonitoring) {
12251
- console.log(`\u2705 nodeVal() completed in ${callDuration.toFixed(3)}ms`);
12252
- }
12253
12046
  return this;
12254
12047
  }
12255
12048
  nodeRelSize(size) {
12256
12049
  if (size === void 0) return this.config.nodeRelSize ?? 4;
12257
- const start2 = performance.now();
12258
12050
  this.config.nodeRelSize = size;
12259
12051
  if (this.isInitialized && this.forceGraph) {
12260
12052
  this.getGraphInstance().nodeRelSize(size);
12261
12053
  }
12262
- const callDuration = performance.now() - start2;
12263
- if (this.config.enablePerformanceMonitoring) {
12264
- console.log(`\u2705 nodeRelSize(${size}) completed in ${callDuration.toFixed(3)}ms`);
12265
- }
12266
12054
  return this;
12267
12055
  }
12268
12056
  nodeLabel(label) {
12269
12057
  if (label === void 0) return this.config.nodeLabel ?? "";
12270
- const start2 = performance.now();
12271
12058
  this.config.nodeLabel = label;
12272
12059
  if (this.isInitialized && this.forceGraph) {
12273
12060
  this.getGraphInstance().nodeLabel(label);
12274
12061
  }
12275
- const callDuration = performance.now() - start2;
12276
- if (this.config.enablePerformanceMonitoring) {
12277
- console.log(`\u2705 nodeLabel() completed in ${callDuration.toFixed(3)}ms`);
12278
- }
12279
12062
  return this;
12280
12063
  }
12281
12064
  nodeVisibility(visibility) {
12282
12065
  if (visibility === void 0) return this.config.nodeVisibility ?? true;
12283
- const start2 = performance.now();
12284
12066
  this.config.nodeVisibility = visibility;
12285
12067
  if (this.isInitialized && this.forceGraph) {
12286
12068
  this.getGraphInstance().nodeVisibility(visibility);
12287
12069
  }
12288
- const callDuration = performance.now() - start2;
12289
- if (this.config.enablePerformanceMonitoring) {
12290
- console.log(`\u2705 nodeVisibility() completed in ${callDuration.toFixed(3)}ms`);
12291
- }
12292
12070
  return this;
12293
12071
  }
12294
12072
  nodeCanvasObjectMode(mode) {
12295
12073
  if (mode === void 0) return this.config.nodeCanvasObjectMode ?? "replace";
12296
- const start2 = performance.now();
12297
12074
  this.config.nodeCanvasObjectMode = mode;
12298
12075
  if (this.isInitialized && this.forceGraph) {
12299
12076
  this.getGraphInstance().nodeCanvasObjectMode(mode);
12300
12077
  }
12301
- const callDuration = performance.now() - start2;
12302
- if (this.config.enablePerformanceMonitoring) {
12303
- console.log(`\u2705 nodeCanvasObjectMode() completed in ${callDuration.toFixed(3)}ms`);
12304
- }
12305
12078
  return this;
12306
12079
  }
12307
12080
  linkColor(color2) {
12308
12081
  if (color2 === void 0) return this.config.linkColor ?? "#999999";
12309
- const start2 = performance.now();
12310
12082
  this.config.linkColor = color2;
12311
12083
  if (this.isInitialized && this.forceGraph) {
12312
12084
  this.getGraphInstance().linkColor(color2);
12313
12085
  }
12314
- const callDuration = performance.now() - start2;
12315
- if (this.config.enablePerformanceMonitoring) {
12316
- console.log(`\u2705 linkColor() completed in ${callDuration.toFixed(3)}ms`);
12317
- }
12318
12086
  return this;
12319
12087
  }
12320
12088
  linkWidth(width) {
12321
12089
  if (width === void 0) return this.config.linkWidth ?? 1;
12322
- const start2 = performance.now();
12323
12090
  this.config.linkWidth = width;
12324
12091
  if (this.isInitialized && this.forceGraph) {
12325
12092
  this.getGraphInstance().linkWidth(width);
12326
12093
  }
12327
- const callDuration = performance.now() - start2;
12328
- if (this.config.enablePerformanceMonitoring) {
12329
- console.log(`\u2705 linkWidth() completed in ${callDuration.toFixed(3)}ms`);
12330
- }
12331
12094
  return this;
12332
12095
  }
12333
12096
  linkLabel(label) {
12334
12097
  if (label === void 0) return this.config.linkLabel ?? "";
12335
- const start2 = performance.now();
12336
12098
  this.config.linkLabel = label;
12337
12099
  if (this.isInitialized && this.forceGraph) {
12338
12100
  this.getGraphInstance().linkLabel(label);
12339
12101
  }
12340
- const callDuration = performance.now() - start2;
12341
- if (this.config.enablePerformanceMonitoring) {
12342
- console.log(`\u2705 linkLabel() completed in ${callDuration.toFixed(3)}ms`);
12343
- }
12344
12102
  return this;
12345
12103
  }
12346
12104
  linkVisibility(visibility) {
12347
12105
  if (visibility === void 0) return this.config.linkVisibility ?? true;
12348
- const start2 = performance.now();
12349
12106
  this.config.linkVisibility = visibility;
12350
12107
  if (this.isInitialized && this.forceGraph) {
12351
12108
  this.getGraphInstance().linkVisibility(visibility);
12352
12109
  }
12353
- const callDuration = performance.now() - start2;
12354
- if (this.config.enablePerformanceMonitoring) {
12355
- console.log(`\u2705 linkVisibility() completed in ${callDuration.toFixed(3)}ms`);
12356
- }
12357
12110
  return this;
12358
12111
  }
12359
12112
  linkDirectionalArrowLength(length) {
12360
12113
  if (length === void 0) return this.config.linkDirectionalArrowLength ?? 0;
12361
- const start2 = performance.now();
12362
12114
  this.config.linkDirectionalArrowLength = length;
12363
12115
  if (this.isInitialized && this.forceGraph) {
12364
12116
  this.getGraphInstance().linkDirectionalArrowLength(length);
12365
12117
  }
12366
- const callDuration = performance.now() - start2;
12367
- if (this.config.enablePerformanceMonitoring) {
12368
- console.log(`\u2705 linkDirectionalArrowLength() completed in ${callDuration.toFixed(3)}ms`);
12369
- }
12370
12118
  return this;
12371
12119
  }
12372
12120
  linkDirectionalParticles(particles) {
12373
12121
  if (particles === void 0) return this.config.linkDirectionalParticles ?? 0;
12374
- const start2 = performance.now();
12375
12122
  this.config.linkDirectionalParticles = particles;
12376
12123
  if (this.isInitialized && this.forceGraph) {
12377
12124
  this.getGraphInstance().linkDirectionalParticles(particles);
12378
12125
  }
12379
- const callDuration = performance.now() - start2;
12380
- if (this.config.enablePerformanceMonitoring) {
12381
- console.log(`\u2705 linkDirectionalParticles() completed in ${callDuration.toFixed(3)}ms`);
12382
- }
12383
12126
  return this;
12384
12127
  }
12385
12128
  linkDirectionalArrowColor(color2) {
12386
12129
  if (color2 === void 0) return this.config.linkDirectionalArrowColor ?? "#999999";
12387
- const start2 = performance.now();
12388
12130
  this.config.linkDirectionalArrowColor = color2;
12389
12131
  if (this.isInitialized && this.forceGraph) {
12390
12132
  this.getGraphInstance().linkDirectionalArrowColor(color2);
12391
12133
  }
12392
- const callDuration = performance.now() - start2;
12393
- if (this.config.enablePerformanceMonitoring) {
12394
- console.log(`\u2705 linkDirectionalArrowColor() completed in ${callDuration.toFixed(3)}ms`);
12395
- }
12396
12134
  return this;
12397
12135
  }
12398
12136
  linkDirectionalArrowRelPos(position) {
12399
12137
  if (position === void 0) return this.config.linkDirectionalArrowRelPos ?? 0.5;
12400
- const start2 = performance.now();
12401
12138
  this.config.linkDirectionalArrowRelPos = position;
12402
12139
  if (this.isInitialized && this.forceGraph) {
12403
12140
  this.getGraphInstance().linkDirectionalArrowRelPos(position);
12404
12141
  }
12405
- const callDuration = performance.now() - start2;
12406
- if (this.config.enablePerformanceMonitoring) {
12407
- console.log(`\u2705 linkDirectionalArrowRelPos(${position}) completed in ${callDuration.toFixed(3)}ms`);
12408
- }
12409
12142
  return this;
12410
12143
  }
12411
12144
  linkDirectionalParticleSpeed(speed) {
12412
12145
  if (speed === void 0) return this.config.linkDirectionalParticleSpeed ?? 1;
12413
- const start2 = performance.now();
12414
12146
  this.config.linkDirectionalParticleSpeed = speed;
12415
12147
  if (this.isInitialized && this.forceGraph) {
12416
12148
  this.getGraphInstance().linkDirectionalParticleSpeed(speed);
12417
12149
  }
12418
- const callDuration = performance.now() - start2;
12419
- if (this.config.enablePerformanceMonitoring) {
12420
- console.log(`\u2705 linkDirectionalParticleSpeed(${speed}) completed in ${callDuration.toFixed(3)}ms`);
12421
- }
12422
12150
  return this;
12423
12151
  }
12424
12152
  linkDirectionalParticleWidth(width) {
12425
12153
  if (width === void 0) return this.config.linkDirectionalParticleWidth ?? 4;
12426
- const start2 = performance.now();
12427
12154
  this.config.linkDirectionalParticleWidth = width;
12428
12155
  if (this.isInitialized && this.forceGraph) {
12429
12156
  this.getGraphInstance().linkDirectionalParticleWidth(width);
12430
12157
  }
12431
- const callDuration = performance.now() - start2;
12432
- if (this.config.enablePerformanceMonitoring) {
12433
- console.log(`\u2705 linkDirectionalParticleWidth(${width}) completed in ${callDuration.toFixed(3)}ms`);
12434
- }
12435
12158
  return this;
12436
12159
  }
12437
12160
  linkDirectionalParticleColor(color2) {
12438
12161
  if (color2 === void 0) return this.config.linkDirectionalParticleColor ?? "#999999";
12439
- const start2 = performance.now();
12440
12162
  this.config.linkDirectionalParticleColor = color2;
12441
12163
  if (this.isInitialized && this.forceGraph) {
12442
12164
  this.getGraphInstance().linkDirectionalParticleColor(color2);
12443
12165
  }
12444
- const callDuration = performance.now() - start2;
12445
- if (this.config.enablePerformanceMonitoring) {
12446
- console.log(`\u2705 linkDirectionalParticleColor() completed in ${callDuration.toFixed(3)}ms`);
12447
- }
12448
12166
  return this;
12449
12167
  }
12450
12168
  linkCurvature(curvature) {
12451
12169
  if (curvature === void 0) return this.config.linkCurvature ?? 0;
12452
- const start2 = performance.now();
12453
12170
  this.config.linkCurvature = curvature;
12454
12171
  if (this.isInitialized && this.forceGraph) {
12455
12172
  this.getGraphInstance().linkCurvature(curvature);
12456
12173
  }
12457
- const callDuration = performance.now() - start2;
12458
- if (this.config.enablePerformanceMonitoring) {
12459
- console.log(`\u2705 linkCurvature(${curvature}) completed in ${callDuration.toFixed(3)}ms`);
12460
- }
12461
12174
  return this;
12462
12175
  }
12463
12176
  linkCanvasObjectMode(mode) {
12464
12177
  if (mode === void 0) return this.config.linkCanvasObjectMode ?? "replace";
12465
- const start2 = performance.now();
12466
12178
  this.config.linkCanvasObjectMode = mode;
12467
12179
  if (this.isInitialized && this.forceGraph) {
12468
12180
  this.getGraphInstance().linkCanvasObjectMode(mode);
12469
12181
  }
12470
- const callDuration = performance.now() - start2;
12471
- if (this.config.enablePerformanceMonitoring) {
12472
- console.log(`\u2705 linkCanvasObjectMode() completed in ${callDuration.toFixed(3)}ms`);
12473
- }
12474
12182
  return this;
12475
12183
  }
12476
12184
  onNodeClick(handler) {
12477
12185
  if (handler === void 0) return this.config.onNodeClick ?? null;
12478
- const start2 = performance.now();
12479
12186
  this.config.onNodeClick = handler || void 0;
12480
12187
  if (this.isInitialized && this.forceGraph) {
12481
12188
  this.getGraphInstance().onNodeClick(handler);
12482
12189
  }
12483
- const callDuration = performance.now() - start2;
12484
- if (this.config.enablePerformanceMonitoring) {
12485
- console.log(`\u2705 onNodeClick() completed in ${callDuration.toFixed(3)}ms`);
12486
- }
12487
12190
  return this;
12488
12191
  }
12489
12192
  onNodeDoubleClick(handler) {
12490
12193
  if (handler === void 0) return this.config.onNodeDoubleClick ?? null;
12491
- const start2 = performance.now();
12492
12194
  this.config.onNodeDoubleClick = handler || void 0;
12493
- const callDuration = performance.now() - start2;
12494
- if (this.config.enablePerformanceMonitoring) {
12495
- console.log(`\u2705 onNodeDoubleClick() completed in ${callDuration.toFixed(3)}ms`);
12496
- }
12497
12195
  return this;
12498
12196
  }
12499
12197
  onNodeHover(handler) {
12500
12198
  if (handler === void 0) return this.config.onNodeHover ?? null;
12501
- const start2 = performance.now();
12502
12199
  this.config.onNodeHover = handler || void 0;
12503
12200
  if (this.isInitialized && this.forceGraph) {
12504
12201
  this.getGraphInstance().onNodeHover(handler);
12505
12202
  }
12506
- const callDuration = performance.now() - start2;
12507
- if (this.config.enablePerformanceMonitoring) {
12508
- console.log(`\u2705 onNodeHover() completed in ${callDuration.toFixed(3)}ms`);
12509
- }
12510
12203
  return this;
12511
12204
  }
12512
12205
  onLinkClick(handler) {
12513
12206
  if (handler === void 0) return this.config.onLinkClick ?? null;
12514
- const start2 = performance.now();
12515
12207
  this.config.onLinkClick = handler || void 0;
12516
12208
  if (this.isInitialized && this.forceGraph) {
12517
12209
  this.getGraphInstance().onLinkClick(handler);
12518
12210
  }
12519
- const callDuration = performance.now() - start2;
12520
- if (this.config.enablePerformanceMonitoring) {
12521
- console.log(`\u2705 onLinkClick() completed in ${callDuration.toFixed(3)}ms`);
12522
- }
12523
12211
  return this;
12524
12212
  }
12525
12213
  onLinkHover(handler) {
12526
12214
  if (handler === void 0) return this.config.onLinkHover ?? null;
12527
- const start2 = performance.now();
12528
12215
  this.config.onLinkHover = handler || void 0;
12529
12216
  if (this.isInitialized && this.forceGraph) {
12530
12217
  this.getGraphInstance().onLinkHover(handler);
12531
12218
  }
12532
- const callDuration = performance.now() - start2;
12533
- if (this.config.enablePerformanceMonitoring) {
12534
- console.log(`\u2705 onLinkHover() completed in ${callDuration.toFixed(3)}ms`);
12535
- }
12536
12219
  return this;
12537
12220
  }
12538
12221
  onRenderFramePre(handler) {
12539
12222
  if (handler === void 0) return this.config.onRenderFramePre ?? null;
12540
- const start2 = performance.now();
12541
12223
  this.config.onRenderFramePre = handler || void 0;
12542
12224
  if (this.isInitialized && this.forceGraph) {
12543
12225
  this.getGraphInstance().onRenderFramePre(handler);
12544
12226
  }
12545
- const callDuration = performance.now() - start2;
12546
- if (this.config.enablePerformanceMonitoring) {
12547
- console.log(`\u2705 onRenderFramePre() completed in ${callDuration.toFixed(3)}ms`);
12548
- }
12549
12227
  return this;
12550
12228
  }
12551
12229
  onRenderFramePost(handler) {
12552
12230
  if (handler === void 0) return this.config.onRenderFramePost ?? null;
12553
- const start2 = performance.now();
12554
12231
  this.config.onRenderFramePost = handler || void 0;
12555
12232
  if (this.isInitialized && this.forceGraph) {
12556
12233
  this.getGraphInstance().onRenderFramePost(handler);
12557
12234
  }
12558
- const callDuration = performance.now() - start2;
12559
- if (this.config.enablePerformanceMonitoring) {
12560
- console.log(`\u2705 onRenderFramePost() completed in ${callDuration.toFixed(3)}ms`);
12561
- }
12562
12235
  return this;
12563
12236
  }
12564
12237
  cooldownTime(time) {
12565
12238
  if (time === void 0) return this.config.cooldownTime ?? 15e3;
12566
- const start2 = performance.now();
12567
12239
  this.config.cooldownTime = time;
12568
12240
  if (this.isInitialized && this.forceGraph) {
12569
12241
  this.getGraphInstance().cooldownTime(time);
12570
12242
  }
12571
- const callDuration = performance.now() - start2;
12572
- if (this.config.enablePerformanceMonitoring) {
12573
- console.log(`\u2705 cooldownTime(${time}) completed in ${callDuration.toFixed(3)}ms`);
12574
- }
12575
12243
  return this;
12576
12244
  }
12577
12245
  d3AlphaDecay(decay) {
12578
12246
  if (decay === void 0) return this.config.d3AlphaDecay ?? 0.0228;
12579
- const start2 = performance.now();
12580
12247
  this.config.d3AlphaDecay = decay;
12581
12248
  if (this.isInitialized && this.forceGraph) {
12582
12249
  this.getGraphInstance().d3AlphaDecay(decay);
12583
12250
  }
12584
- const callDuration = performance.now() - start2;
12585
- if (this.config.enablePerformanceMonitoring) {
12586
- console.log(`\u2705 d3AlphaDecay(${decay}) completed in ${callDuration.toFixed(3)}ms`);
12587
- }
12588
12251
  return this;
12589
12252
  }
12590
12253
  d3VelocityDecay(decay) {
12591
12254
  if (decay === void 0) return this.config.d3VelocityDecay ?? 0.4;
12592
- const start2 = performance.now();
12593
12255
  this.config.d3VelocityDecay = decay;
12594
12256
  if (this.isInitialized && this.forceGraph) {
12595
12257
  this.getGraphInstance().d3VelocityDecay(decay);
12596
12258
  }
12597
- const callDuration = performance.now() - start2;
12598
- if (this.config.enablePerformanceMonitoring) {
12599
- console.log(`\u2705 d3VelocityDecay(${decay}) completed in ${callDuration.toFixed(3)}ms`);
12600
- }
12601
12259
  return this;
12602
12260
  }
12603
12261
  onEngineStop(handler) {
12604
12262
  if (handler === void 0) return this.config.onEngineStop;
12605
- const start2 = performance.now();
12606
12263
  this.config.onEngineStop = handler;
12607
12264
  if (this.isInitialized && this.forceGraph) {
12608
12265
  this.getGraphInstance().onEngineStop(handler);
12609
12266
  }
12610
- const callDuration = performance.now() - start2;
12611
- if (this.config.enablePerformanceMonitoring) {
12612
- console.log(`\u2705 onEngineStop() completed in ${callDuration.toFixed(3)}ms`);
12613
- }
12614
12267
  return this;
12615
12268
  }
12616
12269
  onEngineTick(handler) {
12617
12270
  if (handler === void 0) return this.config.onEngineTick;
12618
- const start2 = performance.now();
12619
12271
  this.config.onEngineTick = handler;
12620
12272
  if (this.isInitialized && this.forceGraph) {
12621
12273
  this.getGraphInstance().onEngineTick(handler);
12622
12274
  }
12623
- const callDuration = performance.now() - start2;
12624
- if (this.config.enablePerformanceMonitoring) {
12625
- console.log(`\u2705 onEngineTick() completed in ${callDuration.toFixed(3)}ms`);
12626
- }
12627
12275
  return this;
12628
12276
  }
12629
12277
  // =============================================================================
@@ -12688,9 +12336,6 @@ var ForceGraphWrapper = class {
12688
12336
  if (!this.renderingMonitor) return;
12689
12337
  this.renderingMonitor.startMonitoring();
12690
12338
  this.isRenderingOptimized = true;
12691
- if (this.enableVerboseLogging) {
12692
- console.log("\u{1F3AC} Started rendering performance monitoring");
12693
- }
12694
12339
  }
12695
12340
  /**
12696
12341
  * Stop rendering performance monitoring
@@ -12699,10 +12344,6 @@ var ForceGraphWrapper = class {
12699
12344
  if (!this.renderingMonitor) return;
12700
12345
  this.renderingMonitor.stopMonitoring();
12701
12346
  this.isRenderingOptimized = false;
12702
- if (this.enableVerboseLogging) {
12703
- const metrics = this.renderingMonitor.getMetrics();
12704
- console.log(`\u{1F3AC} Rendering performance: ${metrics.averageFps.toFixed(1)}fps, efficiency: ${(metrics.renderingEfficiency * 100).toFixed(1)}%`);
12705
- }
12706
12347
  }
12707
12348
  /**
12708
12349
  * Get current rendering performance metrics
@@ -12766,7 +12407,6 @@ var ForceGraphWrapper = class {
12766
12407
  */
12767
12408
  optimizeForDataset(nodeCount) {
12768
12409
  if (!this.forceGraph) {
12769
- console.warn("Cannot optimize: graph not initialized");
12770
12410
  return;
12771
12411
  }
12772
12412
  if (nodeCount > 5e3) {
@@ -12842,86 +12482,53 @@ var ForceGraphWrapper = class {
12842
12482
  this.initializeControls();
12843
12483
  this.initializeLegends();
12844
12484
  this.setupDoubleClickHandling();
12845
- if (this.config.enablePerformanceMonitoring) {
12846
- console.log(`\u2705 First render completed in ${renderTime.toFixed(2)}ms`);
12847
- }
12848
12485
  }
12849
12486
  cooldownTicks(ticks) {
12850
12487
  if (ticks === void 0) return this.config.cooldownTicks ?? 100;
12851
- const start2 = performance.now();
12852
12488
  this.config.cooldownTicks = ticks;
12853
12489
  if (this.isInitialized && this.forceGraph) {
12854
12490
  this.getGraphInstance().cooldownTicks(ticks);
12855
12491
  }
12856
- const callDuration = performance.now() - start2;
12857
- if (this.config.enablePerformanceMonitoring) {
12858
- console.log(`\u2705 cooldownTicks(${ticks}) completed in ${callDuration.toFixed(3)}ms`);
12859
- }
12860
12492
  return this;
12861
12493
  }
12862
12494
  d3AlphaMin(min) {
12863
12495
  if (min === void 0) return this.config.d3AlphaMin ?? 1e-3;
12864
- const start2 = performance.now();
12865
12496
  this.config.d3AlphaMin = min;
12866
12497
  if (this.isInitialized && this.forceGraph) {
12867
12498
  this.getGraphInstance().d3AlphaMin(min);
12868
12499
  }
12869
- const callDuration = performance.now() - start2;
12870
- if (this.config.enablePerformanceMonitoring) {
12871
- console.log(`\u2705 d3AlphaMin(${min}) completed in ${callDuration.toFixed(3)}ms`);
12872
- }
12873
12500
  return this;
12874
12501
  }
12875
12502
  enableNodeDrag(enable) {
12876
12503
  if (enable === void 0) return this.config.enableNodeDrag ?? true;
12877
- const start2 = performance.now();
12878
12504
  this.config.enableNodeDrag = enable;
12879
12505
  if (this.isInitialized && this.forceGraph) {
12880
12506
  this.getGraphInstance().enableNodeDrag(enable);
12881
12507
  }
12882
- const callDuration = performance.now() - start2;
12883
- if (this.config.enablePerformanceMonitoring) {
12884
- console.log(`\u2705 enableNodeDrag(${enable}) completed in ${callDuration.toFixed(3)}ms`);
12885
- }
12886
12508
  return this;
12887
12509
  }
12888
12510
  nodeCanvasObject(paintFunction) {
12889
12511
  if (paintFunction === void 0) return this.config.nodeCanvasObject ?? null;
12890
- const start2 = performance.now();
12891
12512
  this.config.nodeCanvasObject = paintFunction || void 0;
12892
12513
  if (this.isInitialized && this.forceGraph) {
12893
12514
  this.getGraphInstance().nodeCanvasObject(paintFunction);
12894
12515
  }
12895
- const callDuration = performance.now() - start2;
12896
- if (this.config.enablePerformanceMonitoring) {
12897
- console.log(`\u2705 nodeCanvasObject() completed in ${callDuration.toFixed(3)}ms`);
12898
- }
12899
12516
  return this;
12900
12517
  }
12901
12518
  linkCanvasObject(paintFunction) {
12902
12519
  if (paintFunction === void 0) return this.config.linkCanvasObject ?? null;
12903
- const start2 = performance.now();
12904
12520
  this.config.linkCanvasObject = paintFunction || void 0;
12905
12521
  if (this.isInitialized && this.forceGraph) {
12906
12522
  this.getGraphInstance().linkCanvasObject(paintFunction);
12907
12523
  }
12908
- const callDuration = performance.now() - start2;
12909
- if (this.config.enablePerformanceMonitoring) {
12910
- console.log(`\u2705 linkCanvasObject() completed in ${callDuration.toFixed(3)}ms`);
12911
- }
12912
12524
  return this;
12913
12525
  }
12914
12526
  autoPauseRedraw(enable) {
12915
12527
  if (enable === void 0) return this.config.autoPauseRedraw ?? true;
12916
- const start2 = performance.now();
12917
12528
  this.config.autoPauseRedraw = enable;
12918
12529
  if (this.isInitialized && this.forceGraph) {
12919
12530
  this.getGraphInstance().autoPauseRedraw(enable);
12920
12531
  }
12921
- const callDuration = performance.now() - start2;
12922
- if (this.config.enablePerformanceMonitoring) {
12923
- console.log(`\u2705 autoPauseRedraw(${enable}) completed in ${callDuration.toFixed(3)}ms`);
12924
- }
12925
12532
  return this;
12926
12533
  }
12927
12534
  enableZoomInteraction(enable) {
@@ -12929,15 +12536,10 @@ var ForceGraphWrapper = class {
12929
12536
  const configValue = this.config.enableZoomInteraction ?? true;
12930
12537
  return typeof configValue === "function" ? true : configValue;
12931
12538
  }
12932
- const start2 = performance.now();
12933
12539
  this.config.enableZoomInteraction = enable;
12934
12540
  if (this.isInitialized && this.forceGraph) {
12935
12541
  this.getGraphInstance().enableZoomInteraction(enable);
12936
12542
  }
12937
- const callDuration = performance.now() - start2;
12938
- if (this.config.enablePerformanceMonitoring) {
12939
- console.log(`\u2705 enableZoomInteraction(${enable}) completed in ${callDuration.toFixed(3)}ms`);
12940
- }
12941
12543
  return this;
12942
12544
  }
12943
12545
  enablePanInteraction(enable) {
@@ -12945,15 +12547,10 @@ var ForceGraphWrapper = class {
12945
12547
  const configValue = this.config.enablePanInteraction ?? true;
12946
12548
  return typeof configValue === "function" ? true : configValue;
12947
12549
  }
12948
- const start2 = performance.now();
12949
12550
  this.config.enablePanInteraction = enable;
12950
12551
  if (this.isInitialized && this.forceGraph) {
12951
12552
  this.getGraphInstance().enablePanInteraction(enable);
12952
12553
  }
12953
- const callDuration = performance.now() - start2;
12954
- if (this.config.enablePerformanceMonitoring) {
12955
- console.log(`\u2705 enablePanInteraction(${enable}) completed in ${callDuration.toFixed(3)}ms`);
12956
- }
12957
12554
  return this;
12958
12555
  }
12959
12556
  // =============================================================================
@@ -12980,9 +12577,6 @@ var ForceGraphWrapper = class {
12980
12577
  try {
12981
12578
  this.controlsInstance = createGraphControls(this.container, controlActions, controlsConfig);
12982
12579
  this.controlsInstance.mount();
12983
- if (this.config.enablePerformanceMonitoring) {
12984
- console.log("\u2705 Graph controls initialized");
12985
- }
12986
12580
  } catch {
12987
12581
  }
12988
12582
  }
@@ -13040,9 +12634,6 @@ var ForceGraphWrapper = class {
13040
12634
  this.legendsInstance = createGraphLegends(this.container, legendsConfig);
13041
12635
  this.legendsInstance.mount();
13042
12636
  this.updateLegends();
13043
- if (this.config.enablePerformanceMonitoring) {
13044
- console.log("\u2705 Graph legends initialized");
13045
- }
13046
12637
  } catch {
13047
12638
  }
13048
12639
  }
@@ -13240,7 +12831,6 @@ var ForceGraphWrapper = class {
13240
12831
  if (!this.isInitialized) {
13241
12832
  throw new Error("Graph not initialized");
13242
12833
  }
13243
- const start2 = performance.now();
13244
12834
  try {
13245
12835
  const defaultFileName = `polly-graph-export-${Date.now()}.png`;
13246
12836
  const finalFileName = fileName || defaultFileName;
@@ -13296,10 +12886,6 @@ var ForceGraphWrapper = class {
13296
12886
  elementsToHide.forEach(({ element, originalDisplay }) => {
13297
12887
  element.style.display = originalDisplay;
13298
12888
  });
13299
- const duration = performance.now() - start2;
13300
- if (this.config.enablePerformanceMonitoring) {
13301
- console.log(`\u2705 exportGraph completed in ${duration.toFixed(3)}ms`);
13302
- }
13303
12889
  } catch (error) {
13304
12890
  const controls = this.container.querySelectorAll(".fg-controls");
13305
12891
  controls.forEach((control) => {
@@ -13311,10 +12897,6 @@ var ForceGraphWrapper = class {
13311
12897
  const element = legend;
13312
12898
  element.style.display = "";
13313
12899
  });
13314
- const duration = performance.now() - start2;
13315
- if (this.config.enablePerformanceMonitoring) {
13316
- console.log(`\u274C exportGraph failed in ${duration.toFixed(3)}ms`);
13317
- }
13318
12900
  throw error;
13319
12901
  }
13320
12902
  }
@@ -13405,8 +12987,12 @@ var ForceGraphWrapper = class {
13405
12987
  const viewportHeight = this.container.clientHeight - paddingValue;
13406
12988
  const targetZoom = Math.min(viewportWidth / width, viewportHeight / height);
13407
12989
  this.getGraphInstance().centerAt(centerX, centerY, duration / 2);
13408
- setTimeout(() => {
12990
+ if (this.kapsuleTimeoutId) {
12991
+ clearTimeout(this.kapsuleTimeoutId);
12992
+ }
12993
+ this.kapsuleTimeoutId = setTimeout(() => {
13409
12994
  this.zoom(targetZoom, duration / 2);
12995
+ this.kapsuleTimeoutId = null;
13410
12996
  }, duration / 2);
13411
12997
  }
13412
12998
  }
@@ -13432,10 +13018,7 @@ var ForceGraphWrapper = class {
13432
13018
  }
13433
13019
  }
13434
13020
  }
13435
- } catch (error) {
13436
- if (this.config.enablePerformanceMonitoring) {
13437
- console.log("Kapsule update fallback used:", error);
13438
- }
13021
+ } catch {
13439
13022
  }
13440
13023
  }
13441
13024
  /**
@@ -13466,6 +13049,7 @@ var ForceGraphWrapper = class {
13466
13049
  this.cleanupDeferredFitView();
13467
13050
  this.cleanupPerformanceTest();
13468
13051
  this.cleanupExportTimeout();
13052
+ this.cleanupVisibilityTimeouts();
13469
13053
  this.cleanupCanvasEventListeners();
13470
13054
  physicsWorkerManager.terminate();
13471
13055
  this.stopRenderingMonitoring();