@antv/layout 1.2.14-beta.2 → 1.2.14-beta.3
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/{62953f7fd7012203b024.worker.js → cd2b54bd55e0306c6ba1.worker.js} +2 -2
- package/dist/cd2b54bd55e0306c6ba1.worker.js.map +1 -0
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/lib/d3-force/index.d.ts +3 -1
- package/lib/d3-force/index.js +21 -9
- package/lib/d3-force/index.js.map +1 -1
- package/lib/d3-force/types.d.ts +19 -19
- package/lib/d3-force-3d/types.d.ts +7 -8
- package/package.json +1 -1
- package/dist/62953f7fd7012203b024.worker.js.map +0 -1
package/dist/index.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Layout=e():t.Layout=e()}(this,(()=>(()=>{var t={4341:(t,e,r)=>{t.exports={graphlib:r(3374),layout:r(9407),debug:r(6978),util:{time:r(6573).time,notime:r(6573).notime},version:r(6661)}},9317:(t,e,r)=>{"use strict";var n=r(5076),o=r(3526);t.exports={run:function(t){var e="greedy"===t.graph().acyclicer?o(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],r={},o={};return n.forEach(t.nodes(),(function i(s){n.has(o,s)||(o[s]=!0,r[s]=!0,n.forEach(t.outEdges(s),(function(t){n.has(r,t.w)?e.push(t):i(t.w)})),delete r[s])})),e}(t);n.forEach(e,(function(e){var r=t.edge(e);t.removeEdge(e),r.forwardName=e.name,r.reversed=!0,t.setEdge(e.w,e.v,r,n.uniqueId("rev"))}))},undo:function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.reversed){t.removeEdge(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}}))}}},7840:(t,e,r)=>{var n=r(5076),o=r(6573);function i(t,e,r,n,i,s){var a={width:0,height:0,rank:s,borderType:e},u=i[e][s-1],h=o.addDummyNode(t,"border",a,r);i[e][s]=h,t.setParent(h,n),u&&t.setEdge(u,h,{weight:1})}t.exports=function(t){n.forEach(t.children(),(function e(r){var o=t.children(r),s=t.node(r);if(o.length&&n.forEach(o,e),n.has(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(var a=s.minRank,u=s.maxRank+1;a<u;++a)i(t,"borderLeft","_bl",r,s,a),i(t,"borderRight","_br",r,s,a)}}))}},5793:(t,e,r)=>{"use strict";var n=r(5076);function o(t){n.forEach(t.nodes(),(function(e){i(t.node(e))})),n.forEach(t.edges(),(function(e){i(t.edge(e))}))}function i(t){var e=t.width;t.width=t.height,t.height=e}function s(t){t.y=-t.y}function a(t){var e=t.x;t.x=t.y,t.y=e}t.exports={adjust:function(t){var e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||o(t)},undo:function(t){var e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){n.forEach(t.nodes(),(function(e){s(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.forEach(r.points,s),n.has(r,"y")&&s(r)}))}(t),"lr"!==e&&"rl"!==e||(function(t){n.forEach(t.nodes(),(function(e){a(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.forEach(r.points,a),n.has(r,"x")&&a(r)}))}(t),o(t))}}},5752:t=>{function e(){var t={};t._next=t._prev=t,this._sentinel=t}function r(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function n(t,e){if("_next"!==t&&"_prev"!==t)return e}t.exports=e,e.prototype.dequeue=function(){var t=this._sentinel,e=t._prev;if(e!==t)return r(e),e},e.prototype.enqueue=function(t){var e=this._sentinel;t._prev&&t._next&&r(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e},e.prototype.toString=function(){for(var t=[],e=this._sentinel,r=e._prev;r!==e;)t.push(JSON.stringify(r,n)),r=r._prev;return"["+t.join(", ")+"]"}},6978:(t,e,r)=>{var n=r(5076),o=r(6573),i=r(3374).Graph;t.exports={debugOrdering:function(t){var e=o.buildLayerMatrix(t),r=new i({compound:!0,multigraph:!0}).setGraph({});return n.forEach(t.nodes(),(function(e){r.setNode(e,{label:e}),r.setParent(e,"layer"+t.node(e).rank)})),n.forEach(t.edges(),(function(t){r.setEdge(t.v,t.w,{},t.name)})),n.forEach(e,(function(t,e){var o="layer"+e;r.setNode(o,{rank:"same"}),n.reduce(t,(function(t,e){return r.setEdge(t,e,{style:"invis"}),e}))})),r}}},3374:(t,e,r)=>{var n;try{n=r(7423)}catch(t){}n||(n=window.graphlib),t.exports=n},3526:(t,e,r)=>{var n=r(5076),o=r(3374).Graph,i=r(5752);t.exports=function(t,e){if(t.nodeCount()<=1)return[];var r=function(t,e){var r=new o,s=0,a=0;n.forEach(t.nodes(),(function(t){r.setNode(t,{v:t,in:0,out:0})})),n.forEach(t.edges(),(function(t){var n=r.edge(t.v,t.w)||0,o=e(t),i=n+o;r.setEdge(t.v,t.w,i),a=Math.max(a,r.node(t.v).out+=o),s=Math.max(s,r.node(t.w).in+=o)}));var h=n.range(a+s+3).map((function(){return new i})),d=s+1;return n.forEach(r.nodes(),(function(t){u(h,d,r.node(t))})),{graph:r,buckets:h,zeroIdx:d}}(t,e||s),h=function(t,e,r){for(var n,o=[],i=e[e.length-1],s=e[0];t.nodeCount();){for(;n=s.dequeue();)a(t,e,r,n);for(;n=i.dequeue();)a(t,e,r,n);if(t.nodeCount())for(var u=e.length-2;u>0;--u)if(n=e[u].dequeue()){o=o.concat(a(t,e,r,n,!0));break}}return o}(r.graph,r.buckets,r.zeroIdx);return n.flatten(n.map(h,(function(e){return t.outEdges(e.v,e.w)})),!0)};var s=n.constant(1);function a(t,e,r,o,i){var s=i?[]:void 0;return n.forEach(t.inEdges(o.v),(function(n){var o=t.edge(n),a=t.node(n.v);i&&s.push({v:n.v,w:n.w}),a.out-=o,u(e,r,a)})),n.forEach(t.outEdges(o.v),(function(n){var o=t.edge(n),i=n.w,s=t.node(i);s.in-=o,u(e,r,s)})),t.removeNode(o.v),s}function u(t,e,r){r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)}},9407:(t,e,r)=>{"use strict";var n=r(5076),o=r(9317),i=r(9934),s=r(9472),a=r(6573).normalizeRanks,u=r(9095),h=r(6573).removeEmptyRanks,d=r(9526),c=r(7840),l=r(5793),f=r(9186),g=r(9497),p=r(6573),v=r(3374).Graph;t.exports=function(t,e){var r=e&&e.debugTiming?p.time:p.notime;r("layout",(function(){var e=r(" buildLayoutGraph",(function(){return function(t){var e=new v({multigraph:!0,compound:!0}),r=k(t.graph());return e.setGraph(n.merge({},y,_(r,m),n.pick(r,w))),n.forEach(t.nodes(),(function(r){var o=k(t.node(r));e.setNode(r,n.defaults(_(o,x),b)),e.setParent(r,t.parent(r))})),n.forEach(t.edges(),(function(r){var o=k(t.edge(r));e.setEdge(r,n.merge({},N,_(o,E),n.pick(o,M)))})),e}(t)}));r(" runLayout",(function(){!function(t,e){e(" makeSpaceForEdgeLabels",(function(){!function(t){var e=t.graph();e.ranksep/=2,n.forEach(t.edges(),(function(r){var n=t.edge(r);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)}))}(t)})),e(" removeSelfEdges",(function(){!function(t){n.forEach(t.edges(),(function(e){if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}}))}(t)})),e(" acyclic",(function(){o.run(t)})),e(" nestingGraph.run",(function(){d.run(t)})),e(" rank",(function(){s(p.asNonCompoundGraph(t))})),e(" injectEdgeLabelProxies",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.width&&r.height){var n=t.node(e.v),o={rank:(t.node(e.w).rank-n.rank)/2+n.rank,e};p.addDummyNode(t,"edge-proxy",o,"_ep")}}))}(t)})),e(" removeEmptyRanks",(function(){h(t)})),e(" nestingGraph.cleanup",(function(){d.cleanup(t)})),e(" normalizeRanks",(function(){a(t)})),e(" assignRankMinMax",(function(){!function(t){var e=0;n.forEach(t.nodes(),(function(r){var o=t.node(r);o.borderTop&&(o.minRank=t.node(o.borderTop).rank,o.maxRank=t.node(o.borderBottom).rank,e=n.max(e,o.maxRank))})),t.graph().maxRank=e}(t)})),e(" removeEdgeLabelProxies",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);"edge-proxy"===r.dummy&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))}))}(t)})),e(" normalize.run",(function(){i.run(t)})),e(" parentDummyChains",(function(){u(t)})),e(" addBorderSegments",(function(){c(t)})),e(" order",(function(){f(t)})),e(" insertSelfEdges",(function(){!function(t){var e=p.buildLayerMatrix(t);n.forEach(e,(function(e){var r=0;n.forEach(e,(function(e,o){var i=t.node(e);i.order=o+r,n.forEach(i.selfEdges,(function(e){p.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:o+ ++r,e:e.e,label:e.label},"_se")})),delete i.selfEdges}))}))}(t)})),e(" adjustCoordinateSystem",(function(){l.adjust(t)})),e(" position",(function(){g(t)})),e(" positionSelfEdges",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),o=n.x+n.width/2,i=n.y,s=r.x-o,a=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{x:o+s,y:i},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.label.x=r.x,r.label.y=r.y}}))}(t)})),e(" removeBorderNodes",(function(){!function(t){n.forEach(t.nodes(),(function(e){if(t.children(e).length){var r=t.node(e),o=t.node(r.borderTop),i=t.node(r.borderBottom),s=t.node(n.last(r.borderLeft)),a=t.node(n.last(r.borderRight));r.width=Math.abs(a.x-s.x),r.height=Math.abs(i.y-o.y),r.x=s.x+r.width/2,r.y=o.y+r.height/2}})),n.forEach(t.nodes(),(function(e){"border"===t.node(e).dummy&&t.removeNode(e)}))}(t)})),e(" normalize.undo",(function(){i.undo(t)})),e(" fixupEdgeLabelCoords",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(n.has(r,"x"))switch("l"!==r.labelpos&&"r"!==r.labelpos||(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}}))}(t)})),e(" undoCoordinateSystem",(function(){l.undo(t)})),e(" translateGraph",(function(){!function(t){var e=Number.POSITIVE_INFINITY,r=0,o=Number.POSITIVE_INFINITY,i=0,s=t.graph(),a=s.marginx||0,u=s.marginy||0;function h(t){var n=t.x,s=t.y,a=t.width,u=t.height;e=Math.min(e,n-a/2),r=Math.max(r,n+a/2),o=Math.min(o,s-u/2),i=Math.max(i,s+u/2)}n.forEach(t.nodes(),(function(e){h(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.has(r,"x")&&h(r)})),e-=a,o-=u,n.forEach(t.nodes(),(function(r){var n=t.node(r);n.x-=e,n.y-=o})),n.forEach(t.edges(),(function(r){var i=t.edge(r);n.forEach(i.points,(function(t){t.x-=e,t.y-=o})),n.has(i,"x")&&(i.x-=e),n.has(i,"y")&&(i.y-=o)})),s.width=r-e+a,s.height=i-o+u}(t)})),e(" assignNodeIntersects",(function(){!function(t){n.forEach(t.edges(),(function(e){var r,n,o=t.edge(e),i=t.node(e.v),s=t.node(e.w);o.points?(r=o.points[0],n=o.points[o.points.length-1]):(o.points=[],r=s,n=i),o.points.unshift(p.intersectRect(i,r)),o.points.push(p.intersectRect(s,n))}))}(t)})),e(" reversePoints",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);r.reversed&&r.points.reverse()}))}(t)})),e(" acyclic.undo",(function(){o.undo(t)}))}(e,r)})),r(" updateInputGraph",(function(){!function(t,e){n.forEach(t.nodes(),(function(r){var n=t.node(r),o=e.node(r);n&&(n.x=o.x,n.y=o.y,e.children(r).length&&(n.width=o.width,n.height=o.height))})),n.forEach(t.edges(),(function(r){var o=t.edge(r),i=e.edge(r);o.points=i.points,n.has(i,"x")&&(o.x=i.x,o.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,e)}))}))};var m=["nodesep","edgesep","ranksep","marginx","marginy"],y={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},w=["acyclicer","ranker","rankdir","align"],x=["width","height"],b={width:0,height:0},E=["minlen","weight","width","height","labeloffset"],N={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},M=["labelpos"];function _(t,e){return n.mapValues(n.pick(t,e),Number)}function k(t){var e={};return n.forEach(t,(function(t,r){e[r.toLowerCase()]=t})),e}},5076:(t,e,r)=>{var n;try{n={cloneDeep:r(9136),constant:r(8295),defaults:r(9529),each:r(958),filter:r(9969),find:r(828),flatten:r(7469),forEach:r(1117),forIn:r(4519),has:r(4339),isUndefined:r(2895),last:r(5179),map:r(9629),mapValues:r(5551),max:r(4213),merge:r(2495),min:r(9903),minBy:r(3262),now:r(8835),pick:r(222),range:r(4978),reduce:r(9285),sortBy:r(5246),uniqueId:r(761),values:r(3005),zipObject:r(3679)}}catch(t){}n||(n=window._),t.exports=n},9526:(t,e,r)=>{var n=r(5076),o=r(6573);function i(t,e,r,s,a,u,h){var d=t.children(h);if(d.length){var c=o.addBorderNode(t,"_bt"),l=o.addBorderNode(t,"_bb"),f=t.node(h);t.setParent(c,h),f.borderTop=c,t.setParent(l,h),f.borderBottom=l,n.forEach(d,(function(n){i(t,e,r,s,a,u,n);var o=t.node(n),d=o.borderTop?o.borderTop:n,f=o.borderBottom?o.borderBottom:n,g=o.borderTop?s:2*s,p=d!==f?1:a-u[h]+1;t.setEdge(c,d,{weight:g,minlen:p,nestingEdge:!0}),t.setEdge(f,l,{weight:g,minlen:p,nestingEdge:!0})})),t.parent(h)||t.setEdge(e,c,{weight:0,minlen:a+u[h]})}else h!==e&&t.setEdge(e,h,{weight:0,minlen:r})}t.exports={run:function(t){var e=o.addDummyNode(t,"root",{},"_root"),r=function(t){var e={};function r(o,i){var s=t.children(o);s&&s.length&&n.forEach(s,(function(t){r(t,i+1)})),e[o]=i}return n.forEach(t.children(),(function(t){r(t,1)})),e}(t),s=n.max(n.values(r))-1,a=2*s+1;t.graph().nestingRoot=e,n.forEach(t.edges(),(function(e){t.edge(e).minlen*=a}));var u=function(t){return n.reduce(t.edges(),(function(e,r){return e+t.edge(r).weight}),0)}(t)+1;n.forEach(t.children(),(function(n){i(t,e,a,u,s,r,n)})),t.graph().nodeRankFactor=a},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,n.forEach(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}}},9934:(t,e,r)=>{"use strict";var n=r(5076),o=r(6573);t.exports={run:function(t){t.graph().dummyChains=[],n.forEach(t.edges(),(function(e){!function(t,e){var r,n,i,s=e.v,a=t.node(s).rank,u=e.w,h=t.node(u).rank,d=e.name,c=t.edge(e),l=c.labelRank;if(h!==a+1){for(t.removeEdge(e),i=0,++a;a<h;++i,++a)c.points=[],n={width:0,height:0,edgeLabel:c,edgeObj:e,rank:a},r=o.addDummyNode(t,"edge",n,"_d"),a===l&&(n.width=c.width,n.height=c.height,n.dummy="edge-label",n.labelpos=c.labelpos),t.setEdge(s,r,{weight:c.weight},d),0===i&&t.graph().dummyChains.push(r),s=r;t.setEdge(s,u,{weight:c.weight},d)}}(t,e)}))},undo:function(t){n.forEach(t.graph().dummyChains,(function(e){var r,n=t.node(e),o=n.edgeLabel;for(t.setEdge(n.edgeObj,o);n.dummy;)r=t.successors(e)[0],t.removeNode(e),o.points.push({x:n.x,y:n.y}),"edge-label"===n.dummy&&(o.x=n.x,o.y=n.y,o.width=n.width,o.height=n.height),e=r,n=t.node(e)}))}}},9841:(t,e,r)=>{var n=r(5076);t.exports=function(t,e,r){var o,i={};n.forEach(r,(function(r){for(var n,s,a=t.parent(r);a;){if((n=t.parent(a))?(s=i[n],i[n]=a):(s=o,o=a),s&&s!==a)return void e.setEdge(s,a);a=n}}))}},5458:(t,e,r)=>{var n=r(5076);t.exports=function(t,e){return n.map(e,(function(e){var r=t.inEdges(e);if(r.length){var o=n.reduce(r,(function(e,r){var n=t.edge(r),o=t.node(r.v);return{sum:e.sum+n.weight*o.order,weight:e.weight+n.weight}}),{sum:0,weight:0});return{v:e,barycenter:o.sum/o.weight,weight:o.weight}}return{v:e}}))}},6263:(t,e,r)=>{var n=r(5076),o=r(3374).Graph;t.exports=function(t,e,r){var i=function(t){for(var e;t.hasNode(e=n.uniqueId("_root")););return e}(t),s=new o({compound:!0}).setGraph({root:i}).setDefaultNodeLabel((function(e){return t.node(e)}));return n.forEach(t.nodes(),(function(o){var a=t.node(o),u=t.parent(o);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(s.setNode(o),s.setParent(o,u||i),n.forEach(t[r](o),(function(e){var r=e.v===o?e.w:e.v,i=s.edge(r,o),a=n.isUndefined(i)?0:i.weight;s.setEdge(r,o,{weight:t.edge(e).weight+a})})),n.has(a,"minRank")&&s.setNode(o,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))})),s}},6840:(t,e,r)=>{"use strict";var n=r(5076);function o(t,e,r){for(var o=n.zipObject(r,n.map(r,(function(t,e){return e}))),i=n.flatten(n.map(e,(function(e){return n.sortBy(n.map(t.outEdges(e),(function(e){return{pos:o[e.w],weight:t.edge(e).weight}})),"pos")})),!0),s=1;s<r.length;)s<<=1;var a=2*s-1;s-=1;var u=n.map(new Array(a),(function(){return 0})),h=0;return n.forEach(i.forEach((function(t){var e=t.pos+s;u[e]+=t.weight;for(var r=0;e>0;)e%2&&(r+=u[e+1]),u[e=e-1>>1]+=t.weight;h+=t.weight*r}))),h}t.exports=function(t,e){for(var r=0,n=1;n<e.length;++n)r+=o(t,e[n-1],e[n]);return r}},9186:(t,e,r)=>{"use strict";var n=r(5076),o=r(1879),i=r(6840),s=r(9387),a=r(6263),u=r(9841),h=r(3374).Graph,d=r(6573);function c(t,e,r){return n.map(e,(function(e){return a(t,e,r)}))}function l(t,e){var r=new h;n.forEach(t,(function(t){var o=t.graph().root,i=s(t,o,r,e);n.forEach(i.vs,(function(e,r){t.node(e).order=r})),u(t,r,i.vs)}))}function f(t,e){n.forEach(e,(function(e){n.forEach(e,(function(e,r){t.node(e).order=r}))}))}t.exports=function(t){var e=d.maxRank(t),r=c(t,n.range(1,e+1),"inEdges"),s=c(t,n.range(e-1,-1,-1),"outEdges"),a=o(t);f(t,a);for(var u,h=Number.POSITIVE_INFINITY,g=0,p=0;p<4;++g,++p){l(g%2?r:s,g%4>=2),a=d.buildLayerMatrix(t);var v=i(t,a);v<h&&(p=0,u=n.cloneDeep(a),h=v)}f(t,u)}},1879:(t,e,r)=>{"use strict";var n=r(5076);t.exports=function(t){var e={},r=n.filter(t.nodes(),(function(e){return!t.children(e).length})),o=n.max(n.map(r,(function(e){return t.node(e).rank}))),i=n.map(n.range(o+1),(function(){return[]})),s=n.sortBy(r,(function(e){return t.node(e).rank}));return n.forEach(s,(function r(o){if(!n.has(e,o)){e[o]=!0;var s=t.node(o);i[s.rank].push(o),n.forEach(t.successors(o),r)}})),i}},5912:(t,e,r)=>{"use strict";var n=r(5076);t.exports=function(t,e){var r={};return n.forEach(t,(function(t,e){var o=r[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};n.isUndefined(t.barycenter)||(o.barycenter=t.barycenter,o.weight=t.weight)})),n.forEach(e.edges(),(function(t){var e=r[t.v],o=r[t.w];n.isUndefined(e)||n.isUndefined(o)||(o.indegree++,e.out.push(r[t.w]))})),function(t){var e=[];function r(t){return function(e){var r,o,i,s;e.merged||(n.isUndefined(e.barycenter)||n.isUndefined(t.barycenter)||e.barycenter>=t.barycenter)&&(o=e,i=0,s=0,(r=t).weight&&(i+=r.barycenter*r.weight,s+=r.weight),o.weight&&(i+=o.barycenter*o.weight,s+=o.weight),r.vs=o.vs.concat(r.vs),r.barycenter=i/s,r.weight=s,r.i=Math.min(o.i,r.i),o.merged=!0)}}function o(e){return function(r){r.in.push(e),0==--r.indegree&&t.push(r)}}for(;t.length;){var i=t.pop();e.push(i),n.forEach(i.in.reverse(),r(i)),n.forEach(i.out,o(i))}return n.map(n.filter(e,(function(t){return!t.merged})),(function(t){return n.pick(t,["vs","i","barycenter","weight"])}))}(n.filter(r,(function(t){return!t.indegree})))}},9387:(t,e,r)=>{var n=r(5076),o=r(5458),i=r(5912),s=r(256);t.exports=function t(e,r,a,u){var h=e.children(r),d=e.node(r),c=d?d.borderLeft:void 0,l=d?d.borderRight:void 0,f={};c&&(h=n.filter(h,(function(t){return t!==c&&t!==l})));var g=o(e,h);n.forEach(g,(function(r){if(e.children(r.v).length){var o=t(e,r.v,a,u);f[r.v]=o,n.has(o,"barycenter")&&(i=r,s=o,n.isUndefined(i.barycenter)?(i.barycenter=s.barycenter,i.weight=s.weight):(i.barycenter=(i.barycenter*i.weight+s.barycenter*s.weight)/(i.weight+s.weight),i.weight+=s.weight))}var i,s}));var p=i(g,a);!function(t,e){n.forEach(t,(function(t){t.vs=n.flatten(t.vs.map((function(t){return e[t]?e[t].vs:t})),!0)}))}(p,f);var v=s(p,u);if(c&&(v.vs=n.flatten([c,v.vs,l],!0),e.predecessors(c).length)){var m=e.node(e.predecessors(c)[0]),y=e.node(e.predecessors(l)[0]);n.has(v,"barycenter")||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+m.order+y.order)/(v.weight+2),v.weight+=2}return v}},256:(t,e,r)=>{var n=r(5076),o=r(6573);function i(t,e,r){for(var o;e.length&&(o=n.last(e)).i<=r;)e.pop(),t.push(o.vs),r++;return r}t.exports=function(t,e){var r,s=o.partition(t,(function(t){return n.has(t,"barycenter")})),a=s.lhs,u=n.sortBy(s.rhs,(function(t){return-t.i})),h=[],d=0,c=0,l=0;a.sort((r=!!e,function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:r?e.i-t.i:t.i-e.i})),l=i(h,u,l),n.forEach(a,(function(t){l+=t.vs.length,h.push(t.vs),d+=t.barycenter*t.weight,c+=t.weight,l=i(h,u,l)}));var f={vs:n.flatten(h,!0)};return c&&(f.barycenter=d/c,f.weight=c),f}},9095:(t,e,r)=>{var n=r(5076);t.exports=function(t){var e=function(t){var e={},r=0;return n.forEach(t.children(),(function o(i){var s=r;n.forEach(t.children(i),o),e[i]={low:s,lim:r++}})),e}(t);n.forEach(t.graph().dummyChains,(function(r){for(var n=t.node(r),o=n.edgeObj,i=function(t,e,r,n){var o,i,s=[],a=[],u=Math.min(e[r].low,e[n].low),h=Math.max(e[r].lim,e[n].lim);o=r;do{o=t.parent(o),s.push(o)}while(o&&(e[o].low>u||h>e[o].lim));for(i=o,o=n;(o=t.parent(o))!==i;)a.push(o);return{path:s.concat(a.reverse()),lca:i}}(t,e,o.v,o.w),s=i.path,a=i.lca,u=0,h=s[u],d=!0;r!==o.w;){if(n=t.node(r),d){for(;(h=s[u])!==a&&t.node(h).maxRank<n.rank;)u++;h===a&&(d=!1)}if(!d){for(;u<s.length-1&&t.node(h=s[u+1]).minRank<=n.rank;)u++;h=s[u]}t.setParent(r,h),r=t.successors(r)[0]}}))}},2738:(t,e,r)=>{"use strict";var n=r(5076),o=r(3374).Graph,i=r(6573);function s(t,e){var r={};return n.reduce(e,(function(e,o){var i=0,s=0,a=e.length,h=n.last(o);return n.forEach(o,(function(e,d){var c=function(t,e){if(t.node(e).dummy)return n.find(t.predecessors(e),(function(e){return t.node(e).dummy}))}(t,e),l=c?t.node(c).order:a;(c||e===h)&&(n.forEach(o.slice(s,d+1),(function(e){n.forEach(t.predecessors(e),(function(n){var o=t.node(n),s=o.order;!(s<i||l<s)||o.dummy&&t.node(e).dummy||u(r,n,e)}))})),s=d+1,i=l)})),o})),r}function a(t,e){var r={};function o(e,o,i,s,a){var h;n.forEach(n.range(o,i),(function(o){h=e[o],t.node(h).dummy&&n.forEach(t.predecessors(h),(function(e){var n=t.node(e);n.dummy&&(n.order<s||n.order>a)&&u(r,e,h)}))}))}return n.reduce(e,(function(e,r){var i,s=-1,a=0;return n.forEach(r,(function(n,u){if("border"===t.node(n).dummy){var h=t.predecessors(n);h.length&&(i=t.node(h[0]).order,o(r,a,u,s,i),a=u,s=i)}o(r,a,r.length,i,e.length)})),r})),r}function u(t,e,r){if(e>r){var n=e;e=r,r=n}var o=t[e];o||(t[e]=o={}),o[r]=!0}function h(t,e,r){if(e>r){var o=e;e=r,r=o}return n.has(t[e],r)}function d(t,e,r,o){var i={},s={},a={};return n.forEach(e,(function(t){n.forEach(t,(function(t,e){i[t]=t,s[t]=t,a[t]=e}))})),n.forEach(e,(function(t){var e=-1;n.forEach(t,(function(t){var u=o(t);if(u.length){u=n.sortBy(u,(function(t){return a[t]}));for(var d=(u.length-1)/2,c=Math.floor(d),l=Math.ceil(d);c<=l;++c){var f=u[c];s[t]===t&&e<a[f]&&!h(r,t,f)&&(s[f]=t,s[t]=i[t]=i[f],e=a[f])}}}))})),{root:i,align:s}}function c(t,e,r,i,s){var a={},u=function(t,e,r,i){var s=new o,a=t.graph(),u=function(t,e,r){return function(o,i,s){var a,u=o.node(i),h=o.node(s),d=0;if(d+=u.width/2,n.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(d+=r?a:-a),a=0,d+=(u.dummy?e:t)/2,d+=(h.dummy?e:t)/2,d+=h.width/2,n.has(h,"labelpos"))switch(h.labelpos.toLowerCase()){case"l":a=h.width/2;break;case"r":a=-h.width/2}return a&&(d+=r?a:-a),a=0,d}}(a.nodesep,a.edgesep,i);return n.forEach(e,(function(e){var o;n.forEach(e,(function(e){var n=r[e];if(s.setNode(n),o){var i=r[o],a=s.edge(i,n);s.setEdge(i,n,Math.max(u(t,e,o),a||0))}o=e}))})),s}(t,e,r,s),h=s?"borderLeft":"borderRight";function d(t,e){for(var r=u.nodes(),n=r.pop(),o={};n;)o[n]?t(n):(o[n]=!0,r.push(n),r=r.concat(e(n))),n=r.pop()}return d((function(t){a[t]=u.inEdges(t).reduce((function(t,e){return Math.max(t,a[e.v]+u.edge(e))}),0)}),u.predecessors.bind(u)),d((function(e){var r=u.outEdges(e).reduce((function(t,e){return Math.min(t,a[e.w]-u.edge(e))}),Number.POSITIVE_INFINITY),n=t.node(e);r!==Number.POSITIVE_INFINITY&&n.borderType!==h&&(a[e]=Math.max(a[e],r))}),u.successors.bind(u)),n.forEach(i,(function(t){a[t]=a[r[t]]})),a}function l(t,e){return n.minBy(n.values(e),(function(e){var r=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return n.forIn(e,(function(e,n){var i=function(t,e){return t.node(e).width}(t,n)/2;r=Math.max(e+i,r),o=Math.min(e-i,o)})),r-o}))}function f(t,e){var r=n.values(e),o=n.min(r),i=n.max(r);n.forEach(["u","d"],(function(r){n.forEach(["l","r"],(function(s){var a,u=r+s,h=t[u];if(h!==e){var d=n.values(h);(a="l"===s?o-n.min(d):i-n.max(d))&&(t[u]=n.mapValues(h,(function(t){return t+a})))}}))}))}function g(t,e){return n.mapValues(t.ul,(function(r,o){if(e)return t[e.toLowerCase()][o];var i=n.sortBy(n.map(t,o));return(i[1]+i[2])/2}))}t.exports={positionX:function(t){var e,r=i.buildLayerMatrix(t),o=n.merge(s(t,r),a(t,r)),u={};n.forEach(["u","d"],(function(i){e="u"===i?r:n.values(r).reverse(),n.forEach(["l","r"],(function(r){"r"===r&&(e=n.map(e,(function(t){return n.values(t).reverse()})));var s=("u"===i?t.predecessors:t.successors).bind(t),a=d(0,e,o,s),h=c(t,e,a.root,a.align,"r"===r);"r"===r&&(h=n.mapValues(h,(function(t){return-t}))),u[i+r]=h}))}));var h=l(t,u);return f(u,h),g(u,t.graph().align)},findType1Conflicts:s,findType2Conflicts:a,addConflict:u,hasConflict:h,verticalAlignment:d,horizontalCompaction:c,alignCoordinates:f,findSmallestWidthAlignment:l,balance:g}},9497:(t,e,r)=>{"use strict";var n=r(5076),o=r(6573),i=r(2738).positionX;t.exports=function(t){(function(t){var e=o.buildLayerMatrix(t),r=t.graph().ranksep,i=0;n.forEach(e,(function(e){var o=n.max(n.map(e,(function(e){return t.node(e).height})));n.forEach(e,(function(e){t.node(e).y=i+o/2})),i+=o+r}))})(t=o.asNonCompoundGraph(t)),n.forEach(i(t),(function(e,r){t.node(r).x=e}))}},9996:(t,e,r)=>{"use strict";var n=r(5076),o=r(3374).Graph,i=r(8666).slack;function s(t,e){return n.forEach(t.nodes(),(function r(o){n.forEach(e.nodeEdges(o),(function(n){var s=n.v,a=o===s?n.w:s;t.hasNode(a)||i(e,n)||(t.setNode(a,{}),t.setEdge(o,a,{}),r(a))}))})),t.nodeCount()}function a(t,e){return n.minBy(e.edges(),(function(r){if(t.hasNode(r.v)!==t.hasNode(r.w))return i(e,r)}))}function u(t,e,r){n.forEach(t.nodes(),(function(t){e.node(t).rank+=r}))}t.exports=function(t){var e,r,n=new o({directed:!1}),h=t.nodes()[0],d=t.nodeCount();for(n.setNode(h,{});s(n,t)<d;)e=a(n,t),r=n.hasNode(e.v)?i(t,e):-i(t,e),u(n,t,r);return n}},9472:(t,e,r)=>{"use strict";var n=r(8666).longestPath,o=r(9996),i=r(4502);t.exports=function(t){switch(t.graph().ranker){case"network-simplex":default:!function(t){i(t)}(t);break;case"tight-tree":!function(t){n(t),o(t)}(t);break;case"longest-path":s(t)}};var s=n},4502:(t,e,r)=>{"use strict";var n=r(5076),o=r(9996),i=r(8666).slack,s=r(8666).longestPath,a=r(3374).alg.preorder,u=r(3374).alg.postorder,h=r(6573).simplify;function d(t){t=h(t),s(t);var e,r=o(t);for(f(r),c(r,t);e=p(r);)m(r,t,e,v(r,t,e))}function c(t,e){var r=u(t,t.nodes());r=r.slice(0,r.length-1),n.forEach(r,(function(r){!function(t,e,r){var n=t.node(r).parent;t.edge(r,n).cutvalue=l(t,e,r)}(t,e,r)}))}function l(t,e,r){var o=t.node(r).parent,i=!0,s=e.edge(r,o),a=0;return s||(i=!1,s=e.edge(o,r)),a=s.weight,n.forEach(e.nodeEdges(r),(function(n){var s,u,h=n.v===r,d=h?n.w:n.v;if(d!==o){var c=h===i,l=e.edge(n).weight;if(a+=c?l:-l,s=r,u=d,t.hasEdge(s,u)){var f=t.edge(r,d).cutvalue;a+=c?-f:f}}})),a}function f(t,e){arguments.length<2&&(e=t.nodes()[0]),g(t,{},1,e)}function g(t,e,r,o,i){var s=r,a=t.node(o);return e[o]=!0,n.forEach(t.neighbors(o),(function(i){n.has(e,i)||(r=g(t,e,r,i,o))})),a.low=s,a.lim=r++,i?a.parent=i:delete a.parent,r}function p(t){return n.find(t.edges(),(function(e){return t.edge(e).cutvalue<0}))}function v(t,e,r){var o=r.v,s=r.w;e.hasEdge(o,s)||(o=r.w,s=r.v);var a=t.node(o),u=t.node(s),h=a,d=!1;a.lim>u.lim&&(h=u,d=!0);var c=n.filter(e.edges(),(function(e){return d===y(0,t.node(e.v),h)&&d!==y(0,t.node(e.w),h)}));return n.minBy(c,(function(t){return i(e,t)}))}function m(t,e,r,o){var i=r.v,s=r.w;t.removeEdge(i,s),t.setEdge(o.v,o.w,{}),f(t),c(t,e),function(t,e){var r=n.find(t.nodes(),(function(t){return!e.node(t).parent})),o=a(t,r);o=o.slice(1),n.forEach(o,(function(r){var n=t.node(r).parent,o=e.edge(r,n),i=!1;o||(o=e.edge(n,r),i=!0),e.node(r).rank=e.node(n).rank+(i?o.minlen:-o.minlen)}))}(t,e)}function y(t,e,r){return r.low<=e.lim&&e.lim<=r.lim}t.exports=d,d.initLowLimValues=f,d.initCutValues=c,d.calcCutValue=l,d.leaveEdge=p,d.enterEdge=v,d.exchangeEdges=m},8666:(t,e,r)=>{"use strict";var n=r(5076);t.exports={longestPath:function(t){var e={};n.forEach(t.sources(),(function r(o){var i=t.node(o);if(n.has(e,o))return i.rank;e[o]=!0;var s=n.min(n.map(t.outEdges(o),(function(e){return r(e.w)-t.edge(e).minlen})));return s!==Number.POSITIVE_INFINITY&&null!=s||(s=0),i.rank=s}))},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}}},6573:(t,e,r)=>{"use strict";var n=r(5076),o=r(3374).Graph;function i(t,e,r,o){var i;do{i=n.uniqueId(o)}while(t.hasNode(i));return r.dummy=e,t.setNode(i,r),i}function s(t){return n.max(n.map(t.nodes(),(function(e){var r=t.node(e).rank;if(!n.isUndefined(r))return r})))}t.exports={addDummyNode:i,simplify:function(t){var e=(new o).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){var n=e.edge(r.v,r.w)||{weight:0,minlen:1},o=t.edge(r);e.setEdge(r.v,r.w,{weight:n.weight+o.weight,minlen:Math.max(n.minlen,o.minlen)})})),e},asNonCompoundGraph:function(t){var e=new o({multigraph:t.isMultigraph()}).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){t.children(r).length||e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){e.setEdge(r,t.edge(r))})),e},successorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.outEdges(e),(function(e){r[e.w]=(r[e.w]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.inEdges(e),(function(e){r[e.v]=(r[e.v]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},intersectRect:function(t,e){var r,n,o=t.x,i=t.y,s=e.x-o,a=e.y-i,u=t.width/2,h=t.height/2;if(!s&&!a)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(a)*u>Math.abs(s)*h?(a<0&&(h=-h),r=h*s/a,n=h):(s<0&&(u=-u),r=u,n=u*a/s),{x:o+r,y:i+n}},buildLayerMatrix:function(t){var e=n.map(n.range(s(t)+1),(function(){return[]}));return n.forEach(t.nodes(),(function(r){var o=t.node(r),i=o.rank;n.isUndefined(i)||(e[i][o.order]=r)})),e},normalizeRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank})));n.forEach(t.nodes(),(function(r){var o=t.node(r);n.has(o,"rank")&&(o.rank-=e)}))},removeEmptyRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank}))),r=[];n.forEach(t.nodes(),(function(n){var o=t.node(n).rank-e;r[o]||(r[o]=[]),r[o].push(n)}));var o=0,i=t.graph().nodeRankFactor;n.forEach(r,(function(e,r){n.isUndefined(e)&&r%i!=0?--o:o&&n.forEach(e,(function(e){t.node(e).rank+=o}))}))},addBorderNode:function(t,e,r,n){var o={width:0,height:0};return arguments.length>=4&&(o.rank=r,o.order=n),i(t,"border",o,e)},maxRank:s,partition:function(t,e){var r={lhs:[],rhs:[]};return n.forEach(t,(function(t){e(t)?r.lhs.push(t):r.rhs.push(t)})),r},time:function(t,e){var r=n.now();try{return e()}finally{console.log(t+" time: "+(n.now()-r)+"ms")}},notime:function(t,e){return e()}}},6661:t=>{t.exports="0.8.5"},7423:(t,e,r)=>{var n=r(783);t.exports={Graph:n.Graph,json:r(2350),alg:r(2638),version:n.version}},3536:(t,e,r)=>{var n=r(782);t.exports=function(t){var e,r={},o=[];function i(o){n.has(r,o)||(r[o]=!0,e.push(o),n.each(t.successors(o),i),n.each(t.predecessors(o),i))}return n.each(t.nodes(),(function(t){e=[],i(t),e.length&&o.push(e)})),o}},4933:(t,e,r)=>{var n=r(782);function o(t,e,r,i,s,a){n.has(i,e)||(i[e]=!0,r||a.push(e),n.each(s(e),(function(e){o(t,e,r,i,s,a)})),r&&a.push(e))}t.exports=function(t,e,r){n.isArray(e)||(e=[e]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),s=[],a={};return n.each(e,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);o(t,e,"post"===r,a,i,s)})),s}},9032:(t,e,r)=>{var n=r(4102),o=r(782);t.exports=function(t,e,r){return o.transform(t.nodes(),(function(o,i){o[i]=n(t,i,e,r)}),{})}},4102:(t,e,r)=>{var n=r(782),o=r(2468);t.exports=function(t,e,r,n){return function(t,e,r,n){var i,s,a={},u=new o,h=function(t){var e=t.v!==i?t.v:t.w,n=a[e],o=r(t),h=s.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+o);h<n.distance&&(n.distance=h,n.predecessor=i,u.decrease(e,h))};for(t.nodes().forEach((function(t){var r=t===e?0:Number.POSITIVE_INFINITY;a[t]={distance:r},u.add(t,r)}));u.size()>0&&(i=u.removeMin(),(s=a[i]).distance!==Number.POSITIVE_INFINITY);)n(i).forEach(h);return a}(t,String(e),r||i,n||function(e){return t.outEdges(e)})};var i=n.constant(1)},3983:(t,e,r)=>{var n=r(782),o=r(3952);t.exports=function(t){return n.filter(o(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}},2329:(t,e,r)=>{var n=r(782);t.exports=function(t,e,r){return function(t,e,r){var n={},o=t.nodes();return o.forEach((function(t){n[t]={},n[t][t]={distance:0},o.forEach((function(e){t!==e&&(n[t][e]={distance:Number.POSITIVE_INFINITY})})),r(t).forEach((function(r){var o=r.v===t?r.w:r.v,i=e(r);n[t][o]={distance:i,predecessor:t}}))})),o.forEach((function(t){var e=n[t];o.forEach((function(r){var i=n[r];o.forEach((function(r){var n=i[t],o=e[r],s=i[r],a=n.distance+o.distance;a<s.distance&&(s.distance=a,s.predecessor=o.predecessor)}))}))})),n}(t,e||o,r||function(e){return t.outEdges(e)})};var o=n.constant(1)},2638:(t,e,r)=>{t.exports={components:r(3536),dijkstra:r(4102),dijkstraAll:r(9032),findCycles:r(3983),floydWarshall:r(2329),isAcyclic:r(8345),postorder:r(1600),preorder:r(39),prim:r(6280),tarjan:r(3952),topsort:r(7849)}},8345:(t,e,r)=>{var n=r(7849);t.exports=function(t){try{n(t)}catch(t){if(t instanceof n.CycleException)return!1;throw t}return!0}},1600:(t,e,r)=>{var n=r(4933);t.exports=function(t,e){return n(t,e,"post")}},39:(t,e,r)=>{var n=r(4933);t.exports=function(t,e){return n(t,e,"pre")}},6280:(t,e,r)=>{var n=r(782),o=r(1943),i=r(2468);t.exports=function(t,e){var r,s=new o,a={},u=new i;function h(t){var n=t.v===r?t.w:t.v,o=u.priority(n);if(void 0!==o){var i=e(t);i<o&&(a[n]=r,u.decrease(n,i))}}if(0===t.nodeCount())return s;n.each(t.nodes(),(function(t){u.add(t,Number.POSITIVE_INFINITY),s.setNode(t)})),u.decrease(t.nodes()[0],0);for(var d=!1;u.size()>0;){if(r=u.removeMin(),n.has(a,r))s.setEdge(r,a[r]);else{if(d)throw new Error("Input graph is not connected: "+t);d=!0}t.nodeEdges(r).forEach(h)}return s}},3952:(t,e,r)=>{var n=r(782);t.exports=function(t){var e=0,r=[],o={},i=[];function s(a){var u=o[a]={onStack:!0,lowlink:e,index:e++};if(r.push(a),t.successors(a).forEach((function(t){n.has(o,t)?o[t].onStack&&(u.lowlink=Math.min(u.lowlink,o[t].index)):(s(t),u.lowlink=Math.min(u.lowlink,o[t].lowlink))})),u.lowlink===u.index){var h,d=[];do{h=r.pop(),o[h].onStack=!1,d.push(h)}while(a!==h);i.push(d)}}return t.nodes().forEach((function(t){n.has(o,t)||s(t)})),i}},7849:(t,e,r)=>{var n=r(782);function o(t){var e={},r={},o=[];if(n.each(t.sinks(),(function s(a){if(n.has(r,a))throw new i;n.has(e,a)||(r[a]=!0,e[a]=!0,n.each(t.predecessors(a),s),delete r[a],o.push(a))})),n.size(e)!==t.nodeCount())throw new i;return o}function i(){}t.exports=o,o.CycleException=i,i.prototype=new Error},2468:(t,e,r)=>{var n=r(782);function o(){this._arr=[],this._keyIndices={}}t.exports=o,o.prototype.size=function(){return this._arr.length},o.prototype.keys=function(){return this._arr.map((function(t){return t.key}))},o.prototype.has=function(t){return n.has(this._keyIndices,t)},o.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},o.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},o.prototype.add=function(t,e){var r=this._keyIndices;if(t=String(t),!n.has(r,t)){var o=this._arr,i=o.length;return r[t]=i,o.push({key:t,priority:e}),this._decrease(i),!0}return!1},o.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},o.prototype.decrease=function(t,e){var r=this._keyIndices[t];if(e>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[r].priority+" New: "+e);this._arr[r].priority=e,this._decrease(r)},o.prototype._heapify=function(t){var e=this._arr,r=2*t,n=r+1,o=t;r<e.length&&(o=e[r].priority<e[o].priority?r:o,n<e.length&&(o=e[n].priority<e[o].priority?n:o),o!==t&&(this._swap(t,o),this._heapify(o)))},o.prototype._decrease=function(t){for(var e,r=this._arr,n=r[t].priority;0!==t&&!(r[e=t>>1].priority<n);)this._swap(t,e),t=e},o.prototype._swap=function(t,e){var r=this._arr,n=this._keyIndices,o=r[t],i=r[e];r[t]=i,r[e]=o,n[i.key]=t,n[o.key]=e}},1943:(t,e,r)=>{"use strict";var n=r(782);t.exports=a;var o="\0",i="\0",s="";function a(t){this._isDirected=!n.has(t,"directed")||t.directed,this._isMultigraph=!!n.has(t,"multigraph")&&t.multigraph,this._isCompound=!!n.has(t,"compound")&&t.compound,this._label=void 0,this._defaultNodeLabelFn=n.constant(void 0),this._defaultEdgeLabelFn=n.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[i]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function u(t,e){t[e]?t[e]++:t[e]=1}function h(t,e){--t[e]||delete t[e]}function d(t,e,r,i){var a=""+e,u=""+r;if(!t&&a>u){var h=a;a=u,u=h}return a+s+u+s+(n.isUndefined(i)?o:i)}function c(t,e){return d(t,e.v,e.w,e.name)}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(t){return this._label=t,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultNodeLabelFn=t,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return n.keys(this._nodes)},a.prototype.sources=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._in[e])}))},a.prototype.sinks=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._out[e])}))},a.prototype.setNodes=function(t,e){var r=arguments,o=this;return n.each(t,(function(t){r.length>1?o.setNode(t,e):o.setNode(t)})),this},a.prototype.setNode=function(t,e){return n.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=i,this._children[t]={},this._children[i][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},a.prototype.node=function(t){return this._nodes[t]},a.prototype.hasNode=function(t){return n.has(this._nodes,t)},a.prototype.removeNode=function(t){var e=this;if(n.has(this._nodes,t)){var r=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],n.each(this.children(t),(function(t){e.setParent(t)})),delete this._children[t]),n.each(n.keys(this._in[t]),r),delete this._in[t],delete this._preds[t],n.each(n.keys(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},a.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n.isUndefined(e))e=i;else{for(var r=e+="";!n.isUndefined(r);r=this.parent(r))if(r===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},a.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},a.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if(e!==i)return e}},a.prototype.children=function(t){if(n.isUndefined(t)&&(t=i),this._isCompound){var e=this._children[t];if(e)return n.keys(e)}else{if(t===i)return this.nodes();if(this.hasNode(t))return[]}},a.prototype.predecessors=function(t){var e=this._preds[t];if(e)return n.keys(e)},a.prototype.successors=function(t){var e=this._sucs[t];if(e)return n.keys(e)},a.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return n.union(e,this.successors(t))},a.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},a.prototype.filterNodes=function(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var r=this;n.each(this._nodes,(function(r,n){t(n)&&e.setNode(n,r)})),n.each(this._edgeObjs,(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,r.edge(t))}));var o={};function i(t){var n=r.parent(t);return void 0===n||e.hasNode(n)?(o[t]=n,n):n in o?o[n]:i(n)}return this._isCompound&&n.each(e.nodes(),(function(t){e.setParent(t,i(t))})),e},a.prototype.setDefaultEdgeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultEdgeLabelFn=t,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return n.values(this._edgeObjs)},a.prototype.setPath=function(t,e){var r=this,o=arguments;return n.reduce(t,(function(t,n){return o.length>1?r.setEdge(t,n,e):r.setEdge(t,n),n})),this},a.prototype.setEdge=function(){var t,e,r,o,i=!1,s=arguments[0];"object"==typeof s&&null!==s&&"v"in s?(t=s.v,e=s.w,r=s.name,2===arguments.length&&(o=arguments[1],i=!0)):(t=s,e=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],i=!0)),t=""+t,e=""+e,n.isUndefined(r)||(r=""+r);var a=d(this._isDirected,t,e,r);if(n.has(this._edgeLabels,a))return i&&(this._edgeLabels[a]=o),this;if(!n.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[a]=i?o:this._defaultEdgeLabelFn(t,e,r);var h=function(t,e,r,n){var o=""+e,i=""+r;if(!t&&o>i){var s=o;o=i,i=s}var a={v:o,w:i};return n&&(a.name=n),a}(this._isDirected,t,e,r);return t=h.v,e=h.w,Object.freeze(h),this._edgeObjs[a]=h,u(this._preds[e],t),u(this._sucs[t],e),this._in[e][a]=h,this._out[t][a]=h,this._edgeCount++,this},a.prototype.edge=function(t,e,r){var n=1===arguments.length?c(this._isDirected,arguments[0]):d(this._isDirected,t,e,r);return this._edgeLabels[n]},a.prototype.hasEdge=function(t,e,r){var o=1===arguments.length?c(this._isDirected,arguments[0]):d(this._isDirected,t,e,r);return n.has(this._edgeLabels,o)},a.prototype.removeEdge=function(t,e,r){var n=1===arguments.length?c(this._isDirected,arguments[0]):d(this._isDirected,t,e,r),o=this._edgeObjs[n];return o&&(t=o.v,e=o.w,delete this._edgeLabels[n],delete this._edgeObjs[n],h(this._preds[e],t),h(this._sucs[t],e),delete this._in[e][n],delete this._out[t][n],this._edgeCount--),this},a.prototype.inEdges=function(t,e){var r=this._in[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.v===e})):o}},a.prototype.outEdges=function(t,e){var r=this._out[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.w===e})):o}},a.prototype.nodeEdges=function(t,e){var r=this.inEdges(t,e);if(r)return r.concat(this.outEdges(t,e))}},783:(t,e,r)=>{t.exports={Graph:r(1943),version:r(1471)}},2350:(t,e,r)=>{var n=r(782),o=r(1943);function i(t){return n.map(t.nodes(),(function(e){var r=t.node(e),o=t.parent(e),i={v:e};return n.isUndefined(r)||(i.value=r),n.isUndefined(o)||(i.parent=o),i}))}function s(t){return n.map(t.edges(),(function(e){var r=t.edge(e),o={v:e.v,w:e.w};return n.isUndefined(e.name)||(o.name=e.name),n.isUndefined(r)||(o.value=r),o}))}t.exports={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:i(t),edges:s(t)};return n.isUndefined(t.graph())||(e.value=n.clone(t.graph())),e},read:function(t){var e=new o(t.options).setGraph(t.value);return n.each(t.nodes,(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)})),n.each(t.edges,(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),e}}},782:(t,e,r)=>{var n;try{n={clone:r(5402),constant:r(8295),each:r(958),filter:r(9969),has:r(4339),isArray:r(5874),isEmpty:r(2046),isFunction:r(7787),isUndefined:r(2895),keys:r(3511),map:r(9629),reduce:r(9285),size:r(3910),transform:r(3279),union:r(3344),values:r(3005)}}catch(t){}n||(n=window._),t.exports=n},1471:t=>{t.exports="2.1.8"},5229:(t,e,r)=>{"use strict";r.r(e),r.d(e,{isAnyArray:()=>o});const n=Object.prototype.toString;function o(t){const e=n.call(t);return e.endsWith("Array]")&&!e.includes("Big")}},6171:(t,e,r)=>{var n=r(4671)(r(714),"DataView");t.exports=n},6766:(t,e,r)=>{var n=r(2405),o=r(8341),i=r(9644),s=r(3784),a=r(6264);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},1022:(t,e,r)=>{var n=r(6821),o=r(7221),i=r(1596),s=r(1992),a=r(552);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},5870:(t,e,r)=>{var n=r(4671)(r(714),"Map");t.exports=n},8910:(t,e,r)=>{var n=r(4069),o=r(7477),i=r(476),s=r(984),a=r(4136);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},4665:(t,e,r)=>{var n=r(4671)(r(714),"Promise");t.exports=n},9612:(t,e,r)=>{var n=r(4671)(r(714),"Set");t.exports=n},2312:(t,e,r)=>{var n=r(8910),o=r(1945),i=r(4874);function s(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new n;++e<r;)this.add(t[e])}s.prototype.add=s.prototype.push=o,s.prototype.has=i,t.exports=s},7216:(t,e,r)=>{var n=r(1022),o=r(5331),i=r(7063),s=r(134),a=r(9842),u=r(9850);function h(t){var e=this.__data__=new n(t);this.size=e.size}h.prototype.clear=o,h.prototype.delete=i,h.prototype.get=s,h.prototype.has=a,h.prototype.set=u,t.exports=h},9006:(t,e,r)=>{var n=r(714).Symbol;t.exports=n},8851:(t,e,r)=>{var n=r(714).Uint8Array;t.exports=n},8154:(t,e,r)=>{var n=r(4671)(r(714),"WeakMap");t.exports=n},7156:t=>{t.exports=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}},7012:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}},2995:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var s=t[r];e(s,r,t)&&(i[o++]=s)}return i}},128:(t,e,r)=>{var n=r(8506);t.exports=function(t,e){return!(null==t||!t.length)&&n(t,e,0)>-1}},6184:t=>{t.exports=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1}},9754:(t,e,r)=>{var n=r(9605),o=r(79),i=r(5874),s=r(3601),a=r(1908),u=r(9046),h=Object.prototype.hasOwnProperty;t.exports=function(t,e){var r=i(t),d=!r&&o(t),c=!r&&!d&&s(t),l=!r&&!d&&!c&&u(t),f=r||d||c||l,g=f?n(t.length,String):[],p=g.length;for(var v in t)!e&&!h.call(t,v)||f&&("length"==v||c&&("offset"==v||"parent"==v)||l&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||a(v,p))||g.push(v);return g}},2275:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}},2525:t=>{t.exports=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}},8663:t=>{t.exports=function(t,e,r,n){var o=-1,i=null==t?0:t.length;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}},3525:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}},446:(t,e,r)=>{var n=r(8494)("length");t.exports=n},2430:(t,e,r)=>{var n=r(3077),o=r(5097);t.exports=function(t,e,r){(void 0!==r&&!o(t[e],r)||void 0===r&&!(e in t))&&n(t,e,r)}},5802:(t,e,r)=>{var n=r(3077),o=r(5097),i=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){var s=t[e];i.call(t,e)&&o(s,r)&&(void 0!==r||e in t)||n(t,e,r)}},9438:(t,e,r)=>{var n=r(5097);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},6902:(t,e,r)=>{var n=r(5532),o=r(3511);t.exports=function(t,e){return t&&n(e,o(e),t)}},5873:(t,e,r)=>{var n=r(5532),o=r(2844);t.exports=function(t,e){return t&&n(e,o(e),t)}},3077:(t,e,r)=>{var n=r(4856);t.exports=function(t,e,r){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}},9018:(t,e,r)=>{var n=r(7216),o=r(7012),i=r(5802),s=r(6902),a=r(5873),u=r(6743),h=r(310),d=r(5590),c=r(2209),l=r(2573),f=r(3918),g=r(9778),p=r(5290),v=r(4028),m=r(9168),y=r(5874),w=r(3601),x=r(4725),b=r(9400),E=r(7363),N=r(3511),M=r(2844),_="[object Arguments]",k="[object Function]",A="[object Object]",j={};j[_]=j["[object Array]"]=j["[object ArrayBuffer]"]=j["[object DataView]"]=j["[object Boolean]"]=j["[object Date]"]=j["[object Float32Array]"]=j["[object Float64Array]"]=j["[object Int8Array]"]=j["[object Int16Array]"]=j["[object Int32Array]"]=j["[object Map]"]=j["[object Number]"]=j[A]=j["[object RegExp]"]=j["[object Set]"]=j["[object String]"]=j["[object Symbol]"]=j["[object Uint8Array]"]=j["[object Uint8ClampedArray]"]=j["[object Uint16Array]"]=j["[object Uint32Array]"]=!0,j["[object Error]"]=j[k]=j["[object WeakMap]"]=!1,t.exports=function t(e,r,S,O,z,R){var I,C=1&r,D=2&r,P=4&r;if(S&&(I=z?S(e,O,z,R):S(e)),void 0!==I)return I;if(!b(e))return e;var T=y(e);if(T){if(I=p(e),!C)return h(e,I)}else{var L=g(e),F=L==k||"[object GeneratorFunction]"==L;if(w(e))return u(e,C);if(L==A||L==_||F&&!z){if(I=D||F?{}:m(e),!C)return D?c(e,a(I,e)):d(e,s(I,e))}else{if(!j[L])return z?e:{};I=v(e,L,C)}}R||(R=new n);var q=R.get(e);if(q)return q;R.set(e,I),E(e)?e.forEach((function(n){I.add(t(n,r,S,n,e,R))})):x(e)&&e.forEach((function(n,o){I.set(o,t(n,r,S,o,e,R))}));var V=T?void 0:(P?D?f:l:D?M:N)(e);return o(V||e,(function(n,o){V&&(n=e[o=n]),i(I,o,t(n,r,S,o,e,R))})),I}},1095:(t,e,r)=>{var n=r(9400),o=Object.create,i=function(){function t(){}return function(e){if(!n(e))return{};if(o)return o(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();t.exports=i},830:(t,e,r)=>{var n=r(7702),o=r(8678)(n);t.exports=o},5816:(t,e,r)=>{var n=r(975);t.exports=function(t,e,r){for(var o=-1,i=t.length;++o<i;){var s=t[o],a=e(s);if(null!=a&&(void 0===u?a==a&&!n(a):r(a,u)))var u=a,h=s}return h}},1329:(t,e,r)=>{var n=r(830);t.exports=function(t,e){var r=[];return n(t,(function(t,n,o){e(t,n,o)&&r.push(t)})),r}},166:t=>{t.exports=function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1}},9821:(t,e,r)=>{var n=r(2525),o=r(3542);t.exports=function t(e,r,i,s,a){var u=-1,h=e.length;for(i||(i=o),a||(a=[]);++u<h;){var d=e[u];r>0&&i(d)?r>1?t(d,r-1,i,s,a):n(a,d):s||(a[a.length]=d)}return a}},9128:(t,e,r)=>{var n=r(3600)();t.exports=n},7702:(t,e,r)=>{var n=r(9128),o=r(3511);t.exports=function(t,e){return t&&n(t,e,o)}},1855:(t,e,r)=>{var n=r(330),o=r(9628);t.exports=function(t,e){for(var r=0,i=(e=n(e,t)).length;null!=t&&r<i;)t=t[o(e[r++])];return r&&r==i?t:void 0}},5920:(t,e,r)=>{var n=r(2525),o=r(5874);t.exports=function(t,e,r){var i=e(t);return o(t)?i:n(i,r(t))}},5271:(t,e,r)=>{var n=r(9006),o=r(9650),i=r(6881),s=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":s&&s in Object(t)?o(t):i(t)}},4116:t=>{t.exports=function(t,e){return t>e}},3091:t=>{var e=Object.prototype.hasOwnProperty;t.exports=function(t,r){return null!=t&&e.call(t,r)}},5088:t=>{t.exports=function(t,e){return null!=t&&e in Object(t)}},8506:(t,e,r)=>{var n=r(166),o=r(8306),i=r(638);t.exports=function(t,e,r){return e==e?i(t,e,r):n(t,o,r)}},4047:(t,e,r)=>{var n=r(5271),o=r(7583);t.exports=function(t){return o(t)&&"[object Arguments]"==n(t)}},3899:(t,e,r)=>{var n=r(8309),o=r(7583);t.exports=function t(e,r,i,s,a){return e===r||(null==e||null==r||!o(e)&&!o(r)?e!=e&&r!=r:n(e,r,i,s,t,a))}},8309:(t,e,r)=>{var n=r(7216),o=r(3522),i=r(9481),s=r(8370),a=r(9778),u=r(5874),h=r(3601),d=r(9046),c="[object Arguments]",l="[object Array]",f="[object Object]",g=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,p,v,m){var y=u(t),w=u(e),x=y?l:a(t),b=w?l:a(e),E=(x=x==c?f:x)==f,N=(b=b==c?f:b)==f,M=x==b;if(M&&h(t)){if(!h(e))return!1;y=!0,E=!1}if(M&&!E)return m||(m=new n),y||d(t)?o(t,e,r,p,v,m):i(t,e,x,r,p,v,m);if(!(1&r)){var _=E&&g.call(t,"__wrapped__"),k=N&&g.call(e,"__wrapped__");if(_||k){var A=_?t.value():t,j=k?e.value():e;return m||(m=new n),v(A,j,r,p,m)}}return!!M&&(m||(m=new n),s(t,e,r,p,v,m))}},4965:(t,e,r)=>{var n=r(9778),o=r(7583);t.exports=function(t){return o(t)&&"[object Map]"==n(t)}},4014:(t,e,r)=>{var n=r(7216),o=r(3899);t.exports=function(t,e,r,i){var s=r.length,a=s,u=!i;if(null==t)return!a;for(t=Object(t);s--;){var h=r[s];if(u&&h[2]?h[1]!==t[h[0]]:!(h[0]in t))return!1}for(;++s<a;){var d=(h=r[s])[0],c=t[d],l=h[1];if(u&&h[2]){if(void 0===c&&!(d in t))return!1}else{var f=new n;if(i)var g=i(c,l,d,t,e,f);if(!(void 0===g?o(l,c,3,i,f):g))return!1}}return!0}},8306:t=>{t.exports=function(t){return t!=t}},4228:(t,e,r)=>{var n=r(7787),o=r(7827),i=r(9400),s=r(462),a=/^\[object .+?Constructor\]$/,u=Function.prototype,h=Object.prototype,d=u.toString,c=h.hasOwnProperty,l=RegExp("^"+d.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!i(t)||o(t))&&(n(t)?l:a).test(s(t))}},6499:(t,e,r)=>{var n=r(9778),o=r(7583);t.exports=function(t){return o(t)&&"[object Set]"==n(t)}},550:(t,e,r)=>{var n=r(5271),o=r(4583),i=r(7583),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,t.exports=function(t){return i(t)&&o(t.length)&&!!s[n(t)]}},4506:(t,e,r)=>{var n=r(6330),o=r(2363),i=r(9169),s=r(5874),a=r(6830);t.exports=function(t){return"function"==typeof t?t:null==t?i:"object"==typeof t?s(t)?o(t[0],t[1]):n(t):a(t)}},5351:(t,e,r)=>{var n=r(7894),o=r(2325),i=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return o(t);var e=[];for(var r in Object(t))i.call(t,r)&&"constructor"!=r&&e.push(r);return e}},1500:(t,e,r)=>{var n=r(9400),o=r(7894),i=r(5382),s=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return i(t);var e=o(t),r=[];for(var a in t)("constructor"!=a||!e&&s.call(t,a))&&r.push(a);return r}},2795:t=>{t.exports=function(t,e){return t<e}},4733:(t,e,r)=>{var n=r(830),o=r(3069);t.exports=function(t,e){var r=-1,i=o(t)?Array(t.length):[];return n(t,(function(t,n,o){i[++r]=e(t,n,o)})),i}},6330:(t,e,r)=>{var n=r(4014),o=r(6539),i=r(7316);t.exports=function(t){var e=o(t);return 1==e.length&&e[0][2]?i(e[0][0],e[0][1]):function(r){return r===t||n(r,t,e)}}},2363:(t,e,r)=>{var n=r(3899),o=r(5887),i=r(4016),s=r(759),a=r(7223),u=r(7316),h=r(9628);t.exports=function(t,e){return s(t)&&a(e)?u(h(t),e):function(r){var s=o(r,t);return void 0===s&&s===e?i(r,t):n(e,s,3)}}},4479:(t,e,r)=>{var n=r(7216),o=r(2430),i=r(9128),s=r(3857),a=r(9400),u=r(2844),h=r(6127);t.exports=function t(e,r,d,c,l){e!==r&&i(r,(function(i,u){if(l||(l=new n),a(i))s(e,r,u,d,t,c,l);else{var f=c?c(h(e,u),i,u+"",e,r,l):void 0;void 0===f&&(f=i),o(e,u,f)}}),u)}},3857:(t,e,r)=>{var n=r(2430),o=r(6743),i=r(1532),s=r(310),a=r(9168),u=r(79),h=r(5874),d=r(6882),c=r(3601),l=r(7787),f=r(9400),g=r(4108),p=r(9046),v=r(6127),m=r(339);t.exports=function(t,e,r,y,w,x,b){var E=v(t,r),N=v(e,r),M=b.get(N);if(M)n(t,r,M);else{var _=x?x(E,N,r+"",t,e,b):void 0,k=void 0===_;if(k){var A=h(N),j=!A&&c(N),S=!A&&!j&&p(N);_=N,A||j||S?h(E)?_=E:d(E)?_=s(E):j?(k=!1,_=o(N,!0)):S?(k=!1,_=i(N,!0)):_=[]:g(N)||u(N)?(_=E,u(E)?_=m(E):f(E)&&!l(E)||(_=a(N))):k=!1}k&&(b.set(N,_),w(_,N,y,x,b),b.delete(N)),n(t,r,_)}}},9586:(t,e,r)=>{var n=r(2275),o=r(1855),i=r(4506),s=r(4733),a=r(7070),u=r(8232),h=r(6395),d=r(9169),c=r(5874);t.exports=function(t,e,r){e=e.length?n(e,(function(t){return c(t)?function(e){return o(e,1===t.length?t[0]:t)}:t})):[d];var l=-1;e=n(e,u(i));var f=s(t,(function(t,r,o){return{criteria:n(e,(function(e){return e(t)})),index:++l,value:t}}));return a(f,(function(t,e){return h(t,e,r)}))}},4286:(t,e,r)=>{var n=r(8499),o=r(4016);t.exports=function(t,e){return n(t,e,(function(e,r){return o(t,r)}))}},8499:(t,e,r)=>{var n=r(1855),o=r(9435),i=r(330);t.exports=function(t,e,r){for(var s=-1,a=e.length,u={};++s<a;){var h=e[s],d=n(t,h);r(d,h)&&o(u,i(h,t),d)}return u}},8494:t=>{t.exports=function(t){return function(e){return null==e?void 0:e[t]}}},3644:(t,e,r)=>{var n=r(1855);t.exports=function(t){return function(e){return n(e,t)}}},8514:t=>{var e=Math.ceil,r=Math.max;t.exports=function(t,n,o,i){for(var s=-1,a=r(e((n-t)/(o||1)),0),u=Array(a);a--;)u[i?a:++s]=t,t+=o;return u}},8421:t=>{t.exports=function(t,e,r,n,o){return o(t,(function(t,o,i){r=n?(n=!1,t):e(r,t,o,i)})),r}},6965:(t,e,r)=>{var n=r(9169),o=r(5390),i=r(3232);t.exports=function(t,e){return i(o(t,e,n),t+"")}},9435:(t,e,r)=>{var n=r(5802),o=r(330),i=r(1908),s=r(9400),a=r(9628);t.exports=function(t,e,r,u){if(!s(t))return t;for(var h=-1,d=(e=o(e,t)).length,c=d-1,l=t;null!=l&&++h<d;){var f=a(e[h]),g=r;if("__proto__"===f||"constructor"===f||"prototype"===f)return t;if(h!=c){var p=l[f];void 0===(g=u?u(p,f,l):void 0)&&(g=s(p)?p:i(e[h+1])?[]:{})}n(l,f,g),l=l[f]}return t}},3431:(t,e,r)=>{var n=r(8295),o=r(4856),i=r(9169),s=o?function(t,e){return o(t,"toString",{configurable:!0,enumerable:!1,value:n(e),writable:!0})}:i;t.exports=s},7070:t=>{t.exports=function(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}},9605:t=>{t.exports=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}},8071:(t,e,r)=>{var n=r(9006),o=r(2275),i=r(5874),s=r(975),a=n?n.prototype:void 0,u=a?a.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(i(e))return o(e,t)+"";if(s(e))return u?u.call(e):"";var r=e+"";return"0"==r&&1/e==-1/0?"-0":r}},5103:(t,e,r)=>{var n=r(4997),o=/^\s+/;t.exports=function(t){return t?t.slice(0,n(t)+1).replace(o,""):t}},8232:t=>{t.exports=function(t){return function(e){return t(e)}}},3434:(t,e,r)=>{var n=r(2312),o=r(128),i=r(6184),s=r(5420),a=r(2196),u=r(6968);t.exports=function(t,e,r){var h=-1,d=o,c=t.length,l=!0,f=[],g=f;if(r)l=!1,d=i;else if(c>=200){var p=e?null:a(t);if(p)return u(p);l=!1,d=s,g=new n}else g=e?[]:f;t:for(;++h<c;){var v=t[h],m=e?e(v):v;if(v=r||0!==v?v:0,l&&m==m){for(var y=g.length;y--;)if(g[y]===m)continue t;e&&g.push(m),f.push(v)}else d(g,m,r)||(g!==f&&g.push(m),f.push(v))}return f}},989:(t,e,r)=>{var n=r(2275);t.exports=function(t,e){return n(e,(function(e){return t[e]}))}},2543:t=>{t.exports=function(t,e,r){for(var n=-1,o=t.length,i=e.length,s={};++n<o;){var a=n<i?e[n]:void 0;r(s,t[n],a)}return s}},5420:t=>{t.exports=function(t,e){return t.has(e)}},4041:(t,e,r)=>{var n=r(9169);t.exports=function(t){return"function"==typeof t?t:n}},330:(t,e,r)=>{var n=r(5874),o=r(759),i=r(9505),s=r(983);t.exports=function(t,e){return n(t)?t:o(t,e)?[t]:i(s(t))}},9270:(t,e,r)=>{var n=r(8851);t.exports=function(t){var e=new t.constructor(t.byteLength);return new n(e).set(new n(t)),e}},6743:(t,e,r)=>{t=r.nmd(t);var n=r(714),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o?n.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=a?a(r):new t.constructor(r);return t.copy(n),n}},5940:(t,e,r)=>{var n=r(9270);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}},5320:t=>{var e=/\w*$/;t.exports=function(t){var r=new t.constructor(t.source,e.exec(t));return r.lastIndex=t.lastIndex,r}},4937:(t,e,r)=>{var n=r(9006),o=n?n.prototype:void 0,i=o?o.valueOf:void 0;t.exports=function(t){return i?Object(i.call(t)):{}}},1532:(t,e,r)=>{var n=r(9270);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}},1141:(t,e,r)=>{var n=r(975);t.exports=function(t,e){if(t!==e){var r=void 0!==t,o=null===t,i=t==t,s=n(t),a=void 0!==e,u=null===e,h=e==e,d=n(e);if(!u&&!d&&!s&&t>e||s&&a&&h&&!u&&!d||o&&a&&h||!r&&h||!i)return 1;if(!o&&!s&&!d&&t<e||d&&r&&i&&!o&&!s||u&&r&&i||!a&&i||!h)return-1}return 0}},6395:(t,e,r)=>{var n=r(1141);t.exports=function(t,e,r){for(var o=-1,i=t.criteria,s=e.criteria,a=i.length,u=r.length;++o<a;){var h=n(i[o],s[o]);if(h)return o>=u?h:h*("desc"==r[o]?-1:1)}return t.index-e.index}},310:t=>{t.exports=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}},5532:(t,e,r)=>{var n=r(5802),o=r(3077);t.exports=function(t,e,r,i){var s=!r;r||(r={});for(var a=-1,u=e.length;++a<u;){var h=e[a],d=i?i(r[h],t[h],h,r,t):void 0;void 0===d&&(d=t[h]),s?o(r,h,d):n(r,h,d)}return r}},5590:(t,e,r)=>{var n=r(5532),o=r(9183);t.exports=function(t,e){return n(t,o(t),e)}},2209:(t,e,r)=>{var n=r(5532),o=r(596);t.exports=function(t,e){return n(t,o(t),e)}},6450:(t,e,r)=>{var n=r(714)["__core-js_shared__"];t.exports=n},1292:(t,e,r)=>{var n=r(6965),o=r(8819);t.exports=function(t){return n((function(e,r){var n=-1,i=r.length,s=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(s=t.length>3&&"function"==typeof s?(i--,s):void 0,a&&o(r[0],r[1],a)&&(s=i<3?void 0:s,i=1),e=Object(e);++n<i;){var u=r[n];u&&t(e,u,n,s)}return e}))}},8678:(t,e,r)=>{var n=r(3069);t.exports=function(t,e){return function(r,o){if(null==r)return r;if(!n(r))return t(r,o);for(var i=r.length,s=e?i:-1,a=Object(r);(e?s--:++s<i)&&!1!==o(a[s],s,a););return r}}},3600:t=>{t.exports=function(t){return function(e,r,n){for(var o=-1,i=Object(e),s=n(e),a=s.length;a--;){var u=s[t?a:++o];if(!1===r(i[u],u,i))break}return e}}},6057:(t,e,r)=>{var n=r(4506),o=r(3069),i=r(3511);t.exports=function(t){return function(e,r,s){var a=Object(e);if(!o(e)){var u=n(r,3);e=i(e),r=function(t){return u(a[t],t,a)}}var h=t(e,r,s);return h>-1?a[u?e[h]:h]:void 0}}},4590:(t,e,r)=>{var n=r(8514),o=r(8819),i=r(8265);t.exports=function(t){return function(e,r,s){return s&&"number"!=typeof s&&o(e,r,s)&&(r=s=void 0),e=i(e),void 0===r?(r=e,e=0):r=i(r),s=void 0===s?e<r?1:-1:i(s),n(e,r,s,t)}}},2196:(t,e,r)=>{var n=r(9612),o=r(3883),i=r(6968),s=n&&1/i(new n([,-0]))[1]==1/0?function(t){return new n(t)}:o;t.exports=s},4856:(t,e,r)=>{var n=r(4671),o=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},3522:(t,e,r)=>{var n=r(2312),o=r(3525),i=r(5420);t.exports=function(t,e,r,s,a,u){var h=1&r,d=t.length,c=e.length;if(d!=c&&!(h&&c>d))return!1;var l=u.get(t),f=u.get(e);if(l&&f)return l==e&&f==t;var g=-1,p=!0,v=2&r?new n:void 0;for(u.set(t,e),u.set(e,t);++g<d;){var m=t[g],y=e[g];if(s)var w=h?s(y,m,g,e,t,u):s(m,y,g,t,e,u);if(void 0!==w){if(w)continue;p=!1;break}if(v){if(!o(e,(function(t,e){if(!i(v,e)&&(m===t||a(m,t,r,s,u)))return v.push(e)}))){p=!1;break}}else if(m!==y&&!a(m,y,r,s,u)){p=!1;break}}return u.delete(t),u.delete(e),p}},9481:(t,e,r)=>{var n=r(9006),o=r(8851),i=r(5097),s=r(3522),a=r(8866),u=r(6968),h=n?n.prototype:void 0,d=h?h.valueOf:void 0;t.exports=function(t,e,r,n,h,c,l){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!c(new o(t),new o(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var f=a;case"[object Set]":var g=1&n;if(f||(f=u),t.size!=e.size&&!g)return!1;var p=l.get(t);if(p)return p==e;n|=2,l.set(t,e);var v=s(f(t),f(e),n,h,c,l);return l.delete(t),v;case"[object Symbol]":if(d)return d.call(t)==d.call(e)}return!1}},8370:(t,e,r)=>{var n=r(2573),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,i,s,a){var u=1&r,h=n(t),d=h.length;if(d!=n(e).length&&!u)return!1;for(var c=d;c--;){var l=h[c];if(!(u?l in e:o.call(e,l)))return!1}var f=a.get(t),g=a.get(e);if(f&&g)return f==e&&g==t;var p=!0;a.set(t,e),a.set(e,t);for(var v=u;++c<d;){var m=t[l=h[c]],y=e[l];if(i)var w=u?i(y,m,l,e,t,a):i(m,y,l,t,e,a);if(!(void 0===w?m===y||s(m,y,r,i,a):w)){p=!1;break}v||(v="constructor"==l)}if(p&&!v){var x=t.constructor,b=e.constructor;x==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof x&&x instanceof x&&"function"==typeof b&&b instanceof b||(p=!1)}return a.delete(t),a.delete(e),p}},4139:(t,e,r)=>{var n=r(7469),o=r(5390),i=r(3232);t.exports=function(t){return i(o(t,void 0,n),t+"")}},1603:(t,e,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;t.exports=n},2573:(t,e,r)=>{var n=r(5920),o=r(9183),i=r(3511);t.exports=function(t){return n(t,i,o)}},3918:(t,e,r)=>{var n=r(5920),o=r(596),i=r(2844);t.exports=function(t){return n(t,i,o)}},1200:(t,e,r)=>{var n=r(95);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},6539:(t,e,r)=>{var n=r(7223),o=r(3511);t.exports=function(t){for(var e=o(t),r=e.length;r--;){var i=e[r],s=t[i];e[r]=[i,s,n(s)]}return e}},4671:(t,e,r)=>{var n=r(4228),o=r(7559);t.exports=function(t,e){var r=o(t,e);return n(r)?r:void 0}},7556:(t,e,r)=>{var n=r(8546)(Object.getPrototypeOf,Object);t.exports=n},9650:(t,e,r)=>{var n=r(9006),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,a=n?n.toStringTag:void 0;t.exports=function(t){var e=i.call(t,a),r=t[a];try{t[a]=void 0;var n=!0}catch(t){}var o=s.call(t);return n&&(e?t[a]=r:delete t[a]),o}},9183:(t,e,r)=>{var n=r(2995),o=r(2982),i=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,a=s?function(t){return null==t?[]:(t=Object(t),n(s(t),(function(e){return i.call(t,e)})))}:o;t.exports=a},596:(t,e,r)=>{var n=r(2525),o=r(7556),i=r(9183),s=r(2982),a=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)n(e,i(t)),t=o(t);return e}:s;t.exports=a},9778:(t,e,r)=>{var n=r(6171),o=r(5870),i=r(4665),s=r(9612),a=r(8154),u=r(5271),h=r(462),d="[object Map]",c="[object Promise]",l="[object Set]",f="[object WeakMap]",g="[object DataView]",p=h(n),v=h(o),m=h(i),y=h(s),w=h(a),x=u;(n&&x(new n(new ArrayBuffer(1)))!=g||o&&x(new o)!=d||i&&x(i.resolve())!=c||s&&x(new s)!=l||a&&x(new a)!=f)&&(x=function(t){var e=u(t),r="[object Object]"==e?t.constructor:void 0,n=r?h(r):"";if(n)switch(n){case p:return g;case v:return d;case m:return c;case y:return l;case w:return f}return e}),t.exports=x},7559:t=>{t.exports=function(t,e){return null==t?void 0:t[e]}},9663:(t,e,r)=>{var n=r(330),o=r(79),i=r(5874),s=r(1908),a=r(4583),u=r(9628);t.exports=function(t,e,r){for(var h=-1,d=(e=n(e,t)).length,c=!1;++h<d;){var l=u(e[h]);if(!(c=null!=t&&r(t,l)))break;t=t[l]}return c||++h!=d?c:!!(d=null==t?0:t.length)&&a(d)&&s(l,d)&&(i(t)||o(t))}},3493:t=>{var e=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");t.exports=function(t){return e.test(t)}},2405:(t,e,r)=>{var n=r(8637);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},8341:t=>{t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},9644:(t,e,r)=>{var n=r(8637),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return o.call(e,t)?e[t]:void 0}},3784:(t,e,r)=>{var n=r(8637),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:o.call(e,t)}},6264:(t,e,r)=>{var n=r(8637);t.exports=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},5290:t=>{var e=Object.prototype.hasOwnProperty;t.exports=function(t){var r=t.length,n=new t.constructor(r);return r&&"string"==typeof t[0]&&e.call(t,"index")&&(n.index=t.index,n.input=t.input),n}},4028:(t,e,r)=>{var n=r(9270),o=r(5940),i=r(5320),s=r(4937),a=r(1532);t.exports=function(t,e,r){var u=t.constructor;switch(e){case"[object ArrayBuffer]":return n(t);case"[object Boolean]":case"[object Date]":return new u(+t);case"[object DataView]":return o(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return a(t,r);case"[object Map]":case"[object Set]":return new u;case"[object Number]":case"[object String]":return new u(t);case"[object RegExp]":return i(t);case"[object Symbol]":return s(t)}}},9168:(t,e,r)=>{var n=r(1095),o=r(7556),i=r(7894);t.exports=function(t){return"function"!=typeof t.constructor||i(t)?{}:n(o(t))}},3542:(t,e,r)=>{var n=r(9006),o=r(79),i=r(5874),s=n?n.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(s&&t&&t[s])}},1908:t=>{var e=/^(?:0|[1-9]\d*)$/;t.exports=function(t,r){var n=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<r}},8819:(t,e,r)=>{var n=r(5097),o=r(3069),i=r(1908),s=r(9400);t.exports=function(t,e,r){if(!s(r))return!1;var a=typeof e;return!!("number"==a?o(r)&&i(e,r.length):"string"==a&&e in r)&&n(r[e],t)}},759:(t,e,r)=>{var n=r(5874),o=r(975),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;t.exports=function(t,e){if(n(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!o(t))||s.test(t)||!i.test(t)||null!=e&&t in Object(e)}},95:t=>{t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},7827:(t,e,r)=>{var n,o=r(6450),i=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!i&&i in t}},7894:t=>{var e=Object.prototype;t.exports=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}},7223:(t,e,r)=>{var n=r(9400);t.exports=function(t){return t==t&&!n(t)}},6821:t=>{t.exports=function(){this.__data__=[],this.size=0}},7221:(t,e,r)=>{var n=r(9438),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,r=n(e,t);return!(r<0||(r==e.length-1?e.pop():o.call(e,r,1),--this.size,0))}},1596:(t,e,r)=>{var n=r(9438);t.exports=function(t){var e=this.__data__,r=n(e,t);return r<0?void 0:e[r][1]}},1992:(t,e,r)=>{var n=r(9438);t.exports=function(t){return n(this.__data__,t)>-1}},552:(t,e,r)=>{var n=r(9438);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}},4069:(t,e,r)=>{var n=r(6766),o=r(1022),i=r(5870);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},7477:(t,e,r)=>{var n=r(1200);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},476:(t,e,r)=>{var n=r(1200);t.exports=function(t){return n(this,t).get(t)}},984:(t,e,r)=>{var n=r(1200);t.exports=function(t){return n(this,t).has(t)}},4136:(t,e,r)=>{var n=r(1200);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},8866:t=>{t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}},7316:t=>{t.exports=function(t,e){return function(r){return null!=r&&r[t]===e&&(void 0!==e||t in Object(r))}}},2121:(t,e,r)=>{var n=r(8487);t.exports=function(t){var e=n(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}},8637:(t,e,r)=>{var n=r(4671)(Object,"create");t.exports=n},2325:(t,e,r)=>{var n=r(8546)(Object.keys,Object);t.exports=n},5382:t=>{t.exports=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}},6574:(t,e,r)=>{t=r.nmd(t);var n=r(1603),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o&&n.process,a=function(){try{return i&&i.require&&i.require("util").types||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=a},6881:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},8546:t=>{t.exports=function(t,e){return function(r){return t(e(r))}}},5390:(t,e,r)=>{var n=r(7156),o=Math.max;t.exports=function(t,e,r){return e=o(void 0===e?t.length-1:e,0),function(){for(var i=arguments,s=-1,a=o(i.length-e,0),u=Array(a);++s<a;)u[s]=i[e+s];s=-1;for(var h=Array(e+1);++s<e;)h[s]=i[s];return h[e]=r(u),n(t,this,h)}}},714:(t,e,r)=>{var n=r(1603),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},6127:t=>{t.exports=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}},1945:t=>{t.exports=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}},4874:t=>{t.exports=function(t){return this.__data__.has(t)}},6968:t=>{t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}},3232:(t,e,r)=>{var n=r(3431),o=r(1824)(n);t.exports=o},1824:t=>{var e=Date.now;t.exports=function(t){var r=0,n=0;return function(){var o=e(),i=16-(o-n);if(n=o,i>0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}},5331:(t,e,r)=>{var n=r(1022);t.exports=function(){this.__data__=new n,this.size=0}},7063:t=>{t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},134:t=>{t.exports=function(t){return this.__data__.get(t)}},9842:t=>{t.exports=function(t){return this.__data__.has(t)}},9850:(t,e,r)=>{var n=r(1022),o=r(5870),i=r(8910);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var s=r.__data__;if(!o||s.length<199)return s.push([t,e]),this.size=++r.size,this;r=this.__data__=new i(s)}return r.set(t,e),this.size=r.size,this}},638:t=>{t.exports=function(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}},6742:(t,e,r)=>{var n=r(446),o=r(3493),i=r(3870);t.exports=function(t){return o(t)?i(t):n(t)}},9505:(t,e,r)=>{var n=r(2121),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,s=n((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(o,(function(t,r,n,o){e.push(n?o.replace(i,"$1"):r||t)})),e}));t.exports=s},9628:(t,e,r)=>{var n=r(975);t.exports=function(t){if("string"==typeof t||n(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}},462:t=>{var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},4997:t=>{var e=/\s/;t.exports=function(t){for(var r=t.length;r--&&e.test(t.charAt(r)););return r}},3870:t=>{var e="\\ud800-\\udfff",r="["+e+"]",n="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",o="\\ud83c[\\udffb-\\udfff]",i="[^"+e+"]",s="(?:\\ud83c[\\udde6-\\uddff]){2}",a="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:"+n+"|"+o+")?",h="[\\ufe0e\\ufe0f]?",d=h+u+"(?:\\u200d(?:"+[i,s,a].join("|")+")"+h+u+")*",c="(?:"+[i+n+"?",n,s,a,r].join("|")+")",l=RegExp(o+"(?="+o+")|"+c+d,"g");t.exports=function(t){for(var e=l.lastIndex=0;l.test(t);)++e;return e}},5402:(t,e,r)=>{var n=r(9018);t.exports=function(t){return n(t,4)}},9136:(t,e,r)=>{var n=r(9018);t.exports=function(t){return n(t,5)}},8295:t=>{t.exports=function(t){return function(){return t}}},9529:(t,e,r)=>{var n=r(6965),o=r(5097),i=r(8819),s=r(2844),a=Object.prototype,u=a.hasOwnProperty,h=n((function(t,e){t=Object(t);var r=-1,n=e.length,h=n>2?e[2]:void 0;for(h&&i(e[0],e[1],h)&&(n=1);++r<n;)for(var d=e[r],c=s(d),l=-1,f=c.length;++l<f;){var g=c[l],p=t[g];(void 0===p||o(p,a[g])&&!u.call(t,g))&&(t[g]=d[g])}return t}));t.exports=h},958:(t,e,r)=>{t.exports=r(1117)},5097:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},9969:(t,e,r)=>{var n=r(2995),o=r(1329),i=r(4506),s=r(5874);t.exports=function(t,e){return(s(t)?n:o)(t,i(e,3))}},828:(t,e,r)=>{var n=r(6057)(r(8550));t.exports=n},8550:(t,e,r)=>{var n=r(166),o=r(4506),i=r(3758),s=Math.max;t.exports=function(t,e,r){var a=null==t?0:t.length;if(!a)return-1;var u=null==r?0:i(r);return u<0&&(u=s(a+u,0)),n(t,o(e,3),u)}},7469:(t,e,r)=>{var n=r(9821);t.exports=function(t){return null!=t&&t.length?n(t,1):[]}},1117:(t,e,r)=>{var n=r(7012),o=r(830),i=r(4041),s=r(5874);t.exports=function(t,e){return(s(t)?n:o)(t,i(e))}},4519:(t,e,r)=>{var n=r(9128),o=r(4041),i=r(2844);t.exports=function(t,e){return null==t?t:n(t,o(e),i)}},5887:(t,e,r)=>{var n=r(1855);t.exports=function(t,e,r){var o=null==t?void 0:n(t,e);return void 0===o?r:o}},4339:(t,e,r)=>{var n=r(3091),o=r(9663);t.exports=function(t,e){return null!=t&&o(t,e,n)}},4016:(t,e,r)=>{var n=r(5088),o=r(9663);t.exports=function(t,e){return null!=t&&o(t,e,n)}},9169:t=>{t.exports=function(t){return t}},79:(t,e,r)=>{var n=r(4047),o=r(7583),i=Object.prototype,s=i.hasOwnProperty,a=i.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(t){return o(t)&&s.call(t,"callee")&&!a.call(t,"callee")};t.exports=u},5874:t=>{var e=Array.isArray;t.exports=e},3069:(t,e,r)=>{var n=r(7787),o=r(4583);t.exports=function(t){return null!=t&&o(t.length)&&!n(t)}},6882:(t,e,r)=>{var n=r(3069),o=r(7583);t.exports=function(t){return o(t)&&n(t)}},3601:(t,e,r)=>{t=r.nmd(t);var n=r(714),o=r(6408),i=e&&!e.nodeType&&e,s=i&&t&&!t.nodeType&&t,a=s&&s.exports===i?n.Buffer:void 0,u=(a?a.isBuffer:void 0)||o;t.exports=u},2046:(t,e,r)=>{var n=r(5351),o=r(9778),i=r(79),s=r(5874),a=r(3069),u=r(3601),h=r(7894),d=r(9046),c=Object.prototype.hasOwnProperty;t.exports=function(t){if(null==t)return!0;if(a(t)&&(s(t)||"string"==typeof t||"function"==typeof t.splice||u(t)||d(t)||i(t)))return!t.length;var e=o(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(h(t))return!n(t).length;for(var r in t)if(c.call(t,r))return!1;return!0}},7787:(t,e,r)=>{var n=r(5271),o=r(9400);t.exports=function(t){if(!o(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},4583:t=>{t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},4725:(t,e,r)=>{var n=r(4965),o=r(8232),i=r(6574),s=i&&i.isMap,a=s?o(s):n;t.exports=a},9400:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},7583:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},4108:(t,e,r)=>{var n=r(5271),o=r(7556),i=r(7583),s=Function.prototype,a=Object.prototype,u=s.toString,h=a.hasOwnProperty,d=u.call(Object);t.exports=function(t){if(!i(t)||"[object Object]"!=n(t))return!1;var e=o(t);if(null===e)return!0;var r=h.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&u.call(r)==d}},7363:(t,e,r)=>{var n=r(6499),o=r(8232),i=r(6574),s=i&&i.isSet,a=s?o(s):n;t.exports=a},7462:(t,e,r)=>{var n=r(5271),o=r(5874),i=r(7583);t.exports=function(t){return"string"==typeof t||!o(t)&&i(t)&&"[object String]"==n(t)}},975:(t,e,r)=>{var n=r(5271),o=r(7583);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==n(t)}},9046:(t,e,r)=>{var n=r(550),o=r(8232),i=r(6574),s=i&&i.isTypedArray,a=s?o(s):n;t.exports=a},2895:t=>{t.exports=function(t){return void 0===t}},3511:(t,e,r)=>{var n=r(9754),o=r(5351),i=r(3069);t.exports=function(t){return i(t)?n(t):o(t)}},2844:(t,e,r)=>{var n=r(9754),o=r(1500),i=r(3069);t.exports=function(t){return i(t)?n(t,!0):o(t)}},5179:t=>{t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},9629:(t,e,r)=>{var n=r(2275),o=r(4506),i=r(4733),s=r(5874);t.exports=function(t,e){return(s(t)?n:i)(t,o(e,3))}},5551:(t,e,r)=>{var n=r(3077),o=r(7702),i=r(4506);t.exports=function(t,e){var r={};return e=i(e,3),o(t,(function(t,o,i){n(r,o,e(t,o,i))})),r}},4213:(t,e,r)=>{var n=r(5816),o=r(4116),i=r(9169);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},8487:(t,e,r)=>{var n=r(8910);function o(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var s=t.apply(this,n);return r.cache=i.set(o,s)||i,s};return r.cache=new(o.Cache||n),r}o.Cache=n,t.exports=o},2495:(t,e,r)=>{var n=r(4479),o=r(1292)((function(t,e,r){n(t,e,r)}));t.exports=o},9903:(t,e,r)=>{var n=r(5816),o=r(2795),i=r(9169);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},3262:(t,e,r)=>{var n=r(5816),o=r(4506),i=r(2795);t.exports=function(t,e){return t&&t.length?n(t,o(e,2),i):void 0}},3883:t=>{t.exports=function(){}},8835:(t,e,r)=>{var n=r(714);t.exports=function(){return n.Date.now()}},222:(t,e,r)=>{var n=r(4286),o=r(4139)((function(t,e){return null==t?{}:n(t,e)}));t.exports=o},6830:(t,e,r)=>{var n=r(8494),o=r(3644),i=r(759),s=r(9628);t.exports=function(t){return i(t)?n(s(t)):o(t)}},4978:(t,e,r)=>{var n=r(4590)();t.exports=n},9285:(t,e,r)=>{var n=r(8663),o=r(830),i=r(4506),s=r(8421),a=r(5874);t.exports=function(t,e,r){var u=a(t)?n:s,h=arguments.length<3;return u(t,i(e,4),r,h,o)}},3910:(t,e,r)=>{var n=r(5351),o=r(9778),i=r(3069),s=r(7462),a=r(6742);t.exports=function(t){if(null==t)return 0;if(i(t))return s(t)?a(t):t.length;var e=o(t);return"[object Map]"==e||"[object Set]"==e?t.size:n(t).length}},5246:(t,e,r)=>{var n=r(9821),o=r(9586),i=r(6965),s=r(8819),a=i((function(t,e){if(null==t)return[];var r=e.length;return r>1&&s(t,e[0],e[1])?e=[]:r>2&&s(e[0],e[1],e[2])&&(e=[e[0]]),o(t,n(e,1),[])}));t.exports=a},2982:t=>{t.exports=function(){return[]}},6408:t=>{t.exports=function(){return!1}},8265:(t,e,r)=>{var n=r(7639),o=1/0;t.exports=function(t){return t?(t=n(t))===o||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}},3758:(t,e,r)=>{var n=r(8265);t.exports=function(t){var e=n(t),r=e%1;return e==e?r?e-r:e:0}},7639:(t,e,r)=>{var n=r(5103),o=r(9400),i=r(975),s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,h=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return NaN;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=n(t);var r=a.test(t);return r||u.test(t)?h(t.slice(2),r?2:8):s.test(t)?NaN:+t}},339:(t,e,r)=>{var n=r(5532),o=r(2844);t.exports=function(t){return n(t,o(t))}},983:(t,e,r)=>{var n=r(8071);t.exports=function(t){return null==t?"":n(t)}},3279:(t,e,r)=>{var n=r(7012),o=r(1095),i=r(7702),s=r(4506),a=r(7556),u=r(5874),h=r(3601),d=r(7787),c=r(9400),l=r(9046);t.exports=function(t,e,r){var f=u(t),g=f||h(t)||l(t);if(e=s(e,4),null==r){var p=t&&t.constructor;r=g?f?new p:[]:c(t)&&d(p)?o(a(t)):{}}return(g?n:i)(t,(function(t,n,o){return e(r,t,n,o)})),r}},3344:(t,e,r)=>{var n=r(9821),o=r(6965),i=r(3434),s=r(6882),a=o((function(t){return i(n(t,1,s,!0))}));t.exports=a},761:(t,e,r)=>{var n=r(983),o=0;t.exports=function(t){var e=++o;return n(t)+e}},3005:(t,e,r)=>{var n=r(989),o=r(3511);t.exports=function(t){return null==t?[]:n(t,o(t))}},3679:(t,e,r)=>{var n=r(5802),o=r(2543);t.exports=function(t,e){return o(t||[],e||[],n)}},412:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>o});var n=r(5229);function o(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==r.output){if(!(0,n.isAnyArray)(r.output))throw new TypeError("output option must be an array if specified");e=r.output}else e=new Array(t.length);var o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,o=void 0===r?0:r,i=e.toIndex,s=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=o||s>t.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[o],u=o+1;u<s;u++)t[u]<a&&(a=t[u]);return a}(t),i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,o=void 0===r?0:r,i=e.toIndex,s=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=o||s>t.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[o],u=o+1;u<s;u++)t[u]>a&&(a=t[u]);return a}(t);if(o===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var s=r.min,a=void 0===s?r.autoMinMax?o:0:s,u=r.max,h=void 0===u?r.autoMinMax?i:1:u;if(a>=h)throw new RangeError("min option must be smaller than max option");for(var d=(h-a)/(i-o),c=0;c<t.length;c++)e[c]=(t[c]-o)*d+a;return e}},8917:(t,e,r)=>{"use strict";var n=r(5229),o=r(412);const i=" ".repeat(2),s=" ".repeat(4);function a(t,e={}){const{maxRows:r=15,maxColumns:n=10,maxNumSize:o=8,padMinus:a="auto"}=e;return`${t.constructor.name} {\n${i}[\n${s}${function(t,e,r,n,o){const{rows:i,columns:a}=t,h=Math.min(i,e),d=Math.min(a,r),c=[];if("auto"===o){o=!1;t:for(let e=0;e<h;e++)for(let r=0;r<d;r++)if(t.get(e,r)<0){o=!0;break t}}for(let e=0;e<h;e++){let r=[];for(let i=0;i<d;i++)r.push(u(t.get(e,i),n,o));c.push(`${r.join(" ")}`)}return d!==a&&(c[c.length-1]+=` ... ${a-r} more columns`),h!==i&&c.push(`... ${i-e} more rows`),c.join(`\n${s}`)}(t,r,n,o,a)}\n${i}]\n${i}rows: ${t.rows}\n${i}columns: ${t.columns}\n}`}function u(t,e,r){return(t>=0&&r?` ${h(t,e-1)}`:h(t,e)).padEnd(e)}function h(t,e){let r=t.toString();if(r.length<=e)return r;let n=t.toFixed(e);if(n.length>e&&(n=t.toFixed(Math.max(0,e-(n.length-e)))),n.length<=e&&!n.startsWith("0.000")&&!n.startsWith("-0.000"))return n;let o=t.toExponential(e);return o.length>e&&(o=t.toExponential(Math.max(0,e-(o.length-e)))),o.slice(0)}function d(t,e,r){let n=r?t.rows:t.rows-1;if(e<0||e>n)throw new RangeError("Row index out of range")}function c(t,e,r){let n=r?t.columns:t.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function l(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function f(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function g(t,e){if(!n.isAnyArray(e))throw new TypeError("row indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.rows)throw new RangeError("row indices are out of range")}function p(t,e){if(!n.isAnyArray(e))throw new TypeError("column indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.columns)throw new RangeError("column indices are out of range")}function v(t,e,r,n,o){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(y("startRow",e),y("endRow",r),y("startColumn",n),y("endColumn",o),e>r||n>o||e<0||e>=t.rows||r<0||r>=t.rows||n<0||n>=t.columns||o<0||o>=t.columns)throw new RangeError("Submatrix indices are out of range")}function m(t,e=0){let r=[];for(let n=0;n<t;n++)r.push(e);return r}function y(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function w(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class x{static from1DArray(t,e,r){if(t*e!==r.length)throw new RangeError("data length does not match given dimensions");let n=new E(t,e);for(let o=0;o<t;o++)for(let t=0;t<e;t++)n.set(o,t,r[o*e+t]);return n}static rowVector(t){let e=new E(1,t.length);for(let r=0;r<t.length;r++)e.set(0,r,t[r]);return e}static columnVector(t){let e=new E(t.length,1);for(let r=0;r<t.length;r++)e.set(r,0,t[r]);return e}static zeros(t,e){return new E(t,e)}static ones(t,e){return new E(t,e).fill(1)}static rand(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{random:n=Math.random}=r;let o=new E(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)o.set(r,t,n());return o}static randInt(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{min:n=0,max:o=1e3,random:i=Math.random}=r;if(!Number.isInteger(n))throw new TypeError("min must be an integer");if(!Number.isInteger(o))throw new TypeError("max must be an integer");if(n>=o)throw new RangeError("min must be smaller than max");let s=o-n,a=new E(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++){let e=n+Math.round(i()*s);a.set(r,t,e)}return a}static eye(t,e,r){void 0===e&&(e=t),void 0===r&&(r=1);let n=Math.min(t,e),o=this.zeros(t,e);for(let t=0;t<n;t++)o.set(t,t,r);return o}static diag(t,e,r){let n=t.length;void 0===e&&(e=n),void 0===r&&(r=e);let o=Math.min(n,e,r),i=this.zeros(e,r);for(let e=0;e<o;e++)i.set(e,e,t[e]);return i}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new E(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.min(t.get(i,r),e.get(i,r)));return o}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new this(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.max(t.get(i,r),e.get(i,r)));return o}static checkMatrix(t){return x.isMatrix(t)?t:new E(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.call(this,e,r);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.push(this.get(e,r));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let r=0;r<this.columns;r++)t[e].push(this.get(e,r))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let t=0;t<this.rows;t++)if(0!==this.get(t,t))return!1;return!0}isEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);t++}return n}isReducedEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);for(let r=e+1;r<this.rows;r++)0!==this.get(t,r)&&(n=!1);t++}return n}echelonForm(){let t=this.clone(),e=0,r=0;for(;e<t.rows&&r<t.columns;){let n=e;for(let o=e;o<t.rows;o++)t.get(o,r)>t.get(n,r)&&(n=o);if(0===t.get(n,r))r++;else{t.swapRows(e,n);let o=t.get(e,r);for(let n=r;n<t.columns;n++)t.set(e,n,t.get(e,n)/o);for(let n=e+1;n<t.rows;n++){let o=t.get(n,r)/t.get(e,r);t.set(n,r,0);for(let i=r+1;i<t.columns;i++)t.set(n,i,t.get(n,i)-t.get(e,i)*o)}e++,r++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,r=t.rows,n=r-1;for(;n>=0;)if(0===t.maxRow(n))n--;else{let o=0,i=!1;for(;o<r&&!1===i;)1===t.get(n,o)?i=!0:o++;for(let r=0;r<n;r++){let i=t.get(r,o);for(let s=o;s<e;s++){let e=t.get(r,s)-i*t.get(n,s);t.set(r,s,e)}}n--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:r=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(r)||r<=0)throw new TypeError("columns must be a positive integer");let n=new E(this.rows*e,this.columns*r);for(let t=0;t<e;t++)for(let e=0;e<r;e++)n.setSubMatrix(this,this.rows*t,this.columns*e);return n}fill(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,t);return this}neg(){return this.mulS(-1)}getRow(t){d(this,t);let e=[];for(let r=0;r<this.columns;r++)e.push(this.get(t,r));return e}getRowVector(t){return E.rowVector(this.getRow(t))}setRow(t,e){d(this,t),e=l(this,e);for(let r=0;r<this.columns;r++)this.set(t,r,e[r]);return this}swapRows(t,e){d(this,t),d(this,e);for(let r=0;r<this.columns;r++){let n=this.get(t,r);this.set(t,r,this.get(e,r)),this.set(e,r,n)}return this}getColumn(t){c(this,t);let e=[];for(let r=0;r<this.rows;r++)e.push(this.get(r,t));return e}getColumnVector(t){return E.columnVector(this.getColumn(t))}setColumn(t,e){c(this,t),e=f(this,e);for(let r=0;r<this.rows;r++)this.set(r,t,e[r]);return this}swapColumns(t,e){c(this,t),c(this,e);for(let r=0;r<this.rows;r++){let n=this.get(r,t);this.set(r,t,this.get(r,e)),this.set(r,e,n)}return this}addRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[r]);return this}subRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[r]);return this}mulRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[r]);return this}divRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[r]);return this}addColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[e]);return this}subColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[e]);return this}mulColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[e]);return this}divColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[e]);return this}mulRow(t,e){d(this,t);for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e);return this}mulColumn(t,e){c(this,t);for(let r=0;r<this.rows;r++)this.set(r,t,this.get(r,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){w(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){w(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}maxRow(t){if(d(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r));return e}maxRowIndex(t){d(this,t),w(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n),r[1]=n);return r}minRow(t){if(d(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r));return e}minRowIndex(t){d(this,t),w(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n),r[1]=n);return r}maxColumn(t){if(c(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t));return e}maxColumnIndex(t){c(this,t),w(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t),r[0]=n);return r}minColumn(t){if(c(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t));return e}minColumnIndex(t){c(this,t),w(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t),r[0]=n);return r}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let r=0;r<t;r++)e.push(this.get(r,r));return e}norm(t="frobenius"){switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${t}`)}}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t+=this.get(e,r),this.set(e,r,t);return this}dot(t){x.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let r=0;for(let n=0;n<e.length;n++)r+=e[n]*t[n];return r}mmul(t){t=E.checkMatrix(t);let e=this.rows,r=this.columns,n=t.columns,o=new E(e,n),i=new Float64Array(r);for(let s=0;s<n;s++){for(let e=0;e<r;e++)i[e]=t.get(e,s);for(let t=0;t<e;t++){let e=0;for(let n=0;n<r;n++)e+=this.get(t,n)*i[n];o.set(t,s,e)}}return o}strassen2x2(t){t=E.checkMatrix(t);let e=new E(2,2);const r=this.get(0,0),n=t.get(0,0),o=this.get(0,1),i=t.get(0,1),s=this.get(1,0),a=t.get(1,0),u=this.get(1,1),h=t.get(1,1),d=(r+u)*(n+h),c=(s+u)*n,l=r*(i-h),f=u*(a-n),g=(r+o)*h,p=d+f-g+(o-u)*(a+h),v=l+g,m=c+f,y=d-c+l+(s-r)*(n+i);return e.set(0,0,p),e.set(0,1,v),e.set(1,0,m),e.set(1,1,y),e}strassen3x3(t){t=E.checkMatrix(t);let e=new E(3,3);const r=this.get(0,0),n=this.get(0,1),o=this.get(0,2),i=this.get(1,0),s=this.get(1,1),a=this.get(1,2),u=this.get(2,0),h=this.get(2,1),d=this.get(2,2),c=t.get(0,0),l=t.get(0,1),f=t.get(0,2),g=t.get(1,0),p=t.get(1,1),v=t.get(1,2),m=t.get(2,0),y=t.get(2,1),w=t.get(2,2),x=(r-i)*(-l+p),b=(-r+i+s)*(c-l+p),N=(i+s)*(-c+l),M=r*c,_=(-r+u+h)*(c-f+v),k=(-r+u)*(f-v),A=(u+h)*(-c+f),j=(-o+h+d)*(p+m-y),S=(o-d)*(p-y),O=o*m,z=(h+d)*(-m+y),R=(-o+s+a)*(v+m-w),I=(o-a)*(v-w),C=(s+a)*(-m+w),D=M+O+n*g,P=(r+n+o-i-s-h-d)*p+b+N+M+j+O+z,T=M+_+A+(r+n+o-s-a-u-h)*v+O+R+C,L=x+s*(-c+l+g-p-v-m+w)+b+M+O+R+I,F=x+b+N+M+a*y,q=O+R+I+C+i*f,V=M+_+k+h*(-c+f+g-p-v-m+y)+j+S+O,U=j+S+O+z+u*l,B=M+_+k+A+d*w;return e.set(0,0,D),e.set(0,1,P),e.set(0,2,T),e.set(1,0,L),e.set(1,1,F),e.set(1,2,q),e.set(2,0,V),e.set(2,1,U),e.set(2,2,B),e}mmulStrassen(t){t=E.checkMatrix(t);let e=this.clone(),r=e.rows,n=e.columns,o=t.rows,i=t.columns;function s(t,e,r){let n=t.rows,o=t.columns;if(n===e&&o===r)return t;{let n=x.zeros(e,r);return n=n.setSubMatrix(t,0,0),n}}n!==o&&console.warn(`Multiplying ${r} x ${n} and ${o} x ${i} matrix: dimensions do not match.`);let a=Math.max(r,o),u=Math.max(n,i);return e=s(e,a,u),function t(e,r,n,o){if(n<=512||o<=512)return e.mmul(r);n%2==1&&o%2==1?(e=s(e,n+1,o+1),r=s(r,n+1,o+1)):n%2==1?(e=s(e,n+1,o),r=s(r,n+1,o)):o%2==1&&(e=s(e,n,o+1),r=s(r,n,o+1));let i=parseInt(e.rows/2,10),a=parseInt(e.columns/2,10),u=e.subMatrix(0,i-1,0,a-1),h=r.subMatrix(0,i-1,0,a-1),d=e.subMatrix(0,i-1,a,e.columns-1),c=r.subMatrix(0,i-1,a,r.columns-1),l=e.subMatrix(i,e.rows-1,0,a-1),f=r.subMatrix(i,r.rows-1,0,a-1),g=e.subMatrix(i,e.rows-1,a,e.columns-1),p=r.subMatrix(i,r.rows-1,a,r.columns-1),v=t(x.add(u,g),x.add(h,p),i,a),m=t(x.add(l,g),h,i,a),y=t(u,x.sub(c,p),i,a),w=t(g,x.sub(f,h),i,a),b=t(x.add(u,d),p,i,a),E=t(x.sub(l,u),x.add(h,c),i,a),N=t(x.sub(d,g),x.add(f,p),i,a),M=x.add(v,w);M.sub(b),M.add(N);let _=x.add(y,b),k=x.add(m,w),A=x.sub(v,m);A.add(y),A.add(E);let j=x.zeros(2*M.rows,2*M.columns);return j=j.setSubMatrix(M,0,0),j=j.setSubMatrix(_,M.rows,0),j=j.setSubMatrix(k,0,M.columns),j=j.setSubMatrix(A,M.rows,M.columns),j.subMatrix(0,n-1,0,o-1)}(e,t=s(t,a,u),a,u)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new E(this.rows,this.columns);for(let t=0;t<this.rows;t++){const i=this.getRow(t);i.length>0&&o(i,{min:e,max:r,output:i}),n.setRow(t,i)}return n}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new E(this.rows,this.columns);for(let t=0;t<this.columns;t++){const i=this.getColumn(t);i.length&&o(i,{min:e,max:r,output:i}),n.setColumn(t,i)}return n}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let r=0;r<t;r++){let t=this.get(e,r),n=this.get(e,this.columns-1-r);this.set(e,r,n),this.set(e,this.columns-1-r,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let r=0;r<t;r++){let t=this.get(r,e),n=this.get(this.rows-1-r,e);this.set(r,e,n),this.set(this.rows-1-r,e,t)}return this}kroneckerProduct(t){t=E.checkMatrix(t);let e=this.rows,r=this.columns,n=t.rows,o=t.columns,i=new E(e*n,r*o);for(let s=0;s<e;s++)for(let e=0;e<r;e++)for(let r=0;r<n;r++)for(let a=0;a<o;a++)i.set(n*s+r,o*e+a,this.get(s,e)*t.get(r,a));return i}kroneckerSum(t){if(t=E.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,r=t.rows,n=this.kroneckerProduct(E.eye(r,r)),o=E.eye(e,e).kroneckerProduct(t);return n.add(o)}transpose(){let t=new E(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(r,e,this.get(e,r));return t}sortRows(t=b){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=b){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,r,n){v(this,t,e,r,n);let o=new E(e-t+1,n-r+1);for(let i=t;i<=e;i++)for(let e=r;e<=n;e++)o.set(i-t,e-r,this.get(i,e));return o}subMatrixRow(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.columns-1),e>r||e<0||e>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");let n=new E(t.length,r-e+1);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.rows)throw new RangeError(`Row index out of range: ${t[o]}`);n.set(o,i-e,this.get(t[o],i))}return n}subMatrixColumn(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.rows-1),e>r||e<0||e>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");let n=new E(r-e+1,t.length);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.columns)throw new RangeError(`Column index out of range: ${t[o]}`);n.set(i-e,o,this.get(i,t[o]))}return n}setSubMatrix(t,e,r){if((t=E.checkMatrix(t)).isEmpty())return this;v(this,e,e+t.rows-1,r,r+t.columns-1);for(let n=0;n<t.rows;n++)for(let o=0;o<t.columns;o++)this.set(e+n,r+o,t.get(n,o));return this}selection(t,e){g(this,t),p(this,e);let r=new E(t.length,e.length);for(let n=0;n<t.length;n++){let o=t[n];for(let t=0;t<e.length;t++){let i=e[t];r.set(n,t,this.get(o,i))}}return r}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let r=0;r<t;r++)e+=this.get(r,r);return e}clone(){return this.constructor.copy(this,new E(this.rows,this.columns))}static copy(t,e){for(const[r,n,o]of t.entries())e.set(r,n,o);return e}sum(t){switch(t){case"row":return function(t){let e=m(t.rows);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]+=t.get(r,n);return e}(this);case"column":return function(t){let e=m(t.columns);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]+=t.get(r,n);return e}(this);case void 0:return function(t){let e=0;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e+=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=m(t.rows,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]*=t.get(r,n);return e}(this);case"column":return function(t){let e=m(t.columns,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]*=t.get(r,n);return e}(this);case void 0:return function(t){let e=1;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e*=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{unbiased:r=!0,mean:o=this.mean(t)}=e;if("boolean"!=typeof r)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!n.isAnyArray(o))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let s=0;s<n;s++){let n=0,a=0,u=0;for(let e=0;e<o;e++)u=t.get(s,e)-r[s],n+=u,a+=u*u;e?i.push((a-n*n/o)/(o-1)):i.push((a-n*n/o)/o)}return i}(this,r,o);case"column":if(!n.isAnyArray(o))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let s=0;s<o;s++){let o=0,a=0,u=0;for(let e=0;e<n;e++)u=t.get(e,s)-r[s],o+=u,a+=u*u;e?i.push((a-o*o/n)/(n-1)):i.push((a-o*o/n)/n)}return i}(this,r,o);case void 0:if("number"!=typeof o)throw new TypeError("mean must be a number");return function(t,e,r){const n=t.rows,o=t.columns,i=n*o;let s=0,a=0,u=0;for(let e=0;e<n;e++)for(let n=0;n<o;n++)u=t.get(e,n)-r,s+=u,a+=u*u;return e?(a-s*s/i)/(i-1):(a-s*s/i)/i}(this,r,o);default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const r=this.variance(t,e);if(void 0===t)return Math.sqrt(r);for(let t=0;t<r.length;t++)r[t]=Math.sqrt(r[t]);return r}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{center:r=this.mean(t)}=e;switch(t){case"row":if(!n.isAnyArray(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[r])}(this,r),this;case"column":if(!n.isAnyArray(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[n])}(this,r),this;case void 0:if("number"!=typeof r)throw new TypeError("center must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");let r=e.scale;switch(t){case"row":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.rows;r++){let n=0;for(let e=0;e<t.columns;e++)n+=Math.pow(t.get(r,e),2)/(t.columns-1);e.push(Math.sqrt(n))}return e}(this);else if(!n.isAnyArray(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[r])}(this,r),this;case"column":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.columns;r++){let n=0;for(let e=0;e<t.rows;e++)n+=Math.pow(t.get(e,r),2)/(t.rows-1);e.push(Math.sqrt(n))}return e}(this);else if(!n.isAnyArray(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[n])}(this,r),this;case void 0:if(void 0===r)r=function(t){const e=t.size-1;let r=0;for(let n=0;n<t.columns;n++)for(let o=0;o<t.rows;o++)r+=Math.pow(t.get(o,n),2)/e;return Math.sqrt(r)}(this);else if("number"!=typeof r)throw new TypeError("scale must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}toString(t){return a(this,t)}[Symbol.iterator](){return this.entries()}*entries(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield[t,e,this.get(t,e)]}*values(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield this.get(t,e)}}function b(t,e){return t-e}x.prototype.klass="Matrix","undefined"!=typeof Symbol&&(x.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return a(this)}),x.random=x.rand,x.randomInt=x.randInt,x.diagonal=x.diag,x.prototype.diagonal=x.prototype.diag,x.identity=x.eye,x.prototype.negate=x.prototype.neg,x.prototype.tensorProduct=x.prototype.kroneckerProduct;class E extends x{data;#t(t,e){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let r=0;r<t;r++)this.data.push(new Float64Array(e));this.rows=t,this.columns=e}constructor(t,e){if(super(),E.isMatrix(t))this.#t(t.rows,t.columns),E.copy(t,this);else if(Number.isInteger(t)&&t>=0)this.#t(t,e);else{if(!n.isAnyArray(t))throw new TypeError("First argument must be a positive number or an array");{const r=t;if("number"!=typeof(e=(t=r.length)?r[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let n=0;n<t;n++){if(r[n].length!==e)throw new RangeError("Inconsistent array dimensions");if(!r[n].every((t=>"number"==typeof t)))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(r[n]))}this.rows=t,this.columns=e}}}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}removeRow(t){return d(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),d(this,t,!0),e=Float64Array.from(l(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){c(this,t);for(let e=0;e<this.rows;e++){const r=new Float64Array(this.columns-1);for(let n=0;n<t;n++)r[n]=this.data[e][n];for(let n=t+1;n<this.columns;n++)r[n-1]=this.data[e][n];this.data[e]=r}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),c(this,t,!0),e=f(this,e);for(let r=0;r<this.rows;r++){const n=new Float64Array(this.columns+1);let o=0;for(;o<t;o++)n[o]=this.data[r][o];for(n[o++]=e[r];o<this.columns+1;o++)n[o]=this.data[r][o-1];this.data[r]=n}return this.columns+=1,this}}!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t.get(e,r));return this},t.add=function(t,r){return new e(t).add(r)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t.get(e,r));return this},t.sub=function(t,r){return new e(t).sub(r)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t.get(e,r));return this},t.mul=function(t,r){return new e(t).mul(r)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t.get(e,r));return this},t.div=function(t,r){return new e(t).div(r)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t.get(e,r));return this},t.mod=function(t,r){return new e(t).mod(r)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t.get(e,r));return this},t.and=function(t,r){return new e(t).and(r)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t.get(e,r));return this},t.or=function(t,r){return new e(t).or(r)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t.get(e,r));return this},t.xor=function(t,r){return new e(t).xor(r)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t.get(e,r));return this},t.leftShift=function(t,r){return new e(t).leftShift(r)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t.get(e,r));return this},t.signPropagatingRightShift=function(t,r){return new e(t).signPropagatingRightShift(r)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t.get(e,r));return this},t.rightShift=function(t,r){return new e(t).rightShift(r)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,r){return new e(t).pow(r)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t));return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t.get(e,r)));return this}}(x,E);class N extends x{#e;get size(){return this.#e.size}get rows(){return this.#e.rows}get columns(){return this.#e.columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(t){return E.isMatrix(t)&&"SymmetricMatrix"===t.klassType}static zeros(t){return new this(t)}static ones(t){return new this(t).fill(1)}constructor(t){if(super(),E.isMatrix(t)){if(!t.isSymmetric())throw new TypeError("not symmetric data");this.#e=E.copy(t,new E(t.rows,t.rows))}else if(Number.isInteger(t)&&t>=0)this.#e=new E(t,t);else if(this.#e=new E(t),!this.isSymmetric())throw new TypeError("not symmetric data")}clone(){const t=new N(this.diagonalSize);for(const[e,r,n]of this.upperRightEntries())t.set(e,r,n);return t}toMatrix(){return new E(this)}get(t,e){return this.#e.get(t,e)}set(t,e,r){return this.#e.set(t,e,r),this.#e.set(e,t,r),this}removeCross(t){return this.#e.removeRow(t),this.#e.removeColumn(t),this}addCross(t,e){void 0===e&&(e=t,t=this.diagonalSize);const r=e.slice();return r.splice(t,1),this.#e.addRow(t,r),this.#e.addColumn(t,e),this}applyMask(t){if(t.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const e=[];for(const[r,n]of t.entries())n||e.push(r);e.reverse();for(const t of e)this.removeCross(t);return this}toCompact(){const{diagonalSize:t}=this,e=new Array(t*(t+1)/2);for(let r=0,n=0,o=0;o<e.length;o++)e[o]=this.get(n,r),++r>=t&&(r=++n);return e}static fromCompact(t){const e=t.length,r=(Math.sqrt(8*e+1)-1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(t)}`);const n=new N(r);for(let o=0,i=0,s=0;s<e;s++)n.set(o,i,t[s]),++o>=r&&(o=++i);return n}*upperRightEntries(){for(let t=0,e=0;t<this.diagonalSize;void 0){const r=this.get(t,e);yield[t,e,r],++e>=this.diagonalSize&&(e=++t)}}*upperRightValues(){for(let t=0,e=0;t<this.diagonalSize;void 0){const r=this.get(t,e);yield r,++e>=this.diagonalSize&&(e=++t)}}}N.prototype.klassType="SymmetricMatrix";class M extends N{static isDistanceMatrix(t){return N.isSymmetricMatrix(t)&&"DistanceMatrix"===t.klassSubType}constructor(t){if(super(t),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(t,e,r){return t===e&&(r=0),super.set(t,e,r)}addCross(t,e){return void 0===e&&(e=t,t=this.diagonalSize),(e=e.slice())[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new N(this)}clone(){const t=new M(this.diagonalSize);for(const[e,r,n]of this.upperRightEntries())e!==r&&t.set(e,r,n);return t}toCompact(){const{diagonalSize:t}=this,e=new Array((t-1)*t/2);for(let r=1,n=0,o=0;o<e.length;o++)e[o]=this.get(n,r),++r>=t&&(r=1+ ++n);return e}static fromCompact(t){const e=t.length,r=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(t)}`);const n=new this(r);for(let o=1,i=0,s=0;s<e;s++)n.set(o,i,t[s]),++o>=r&&(o=1+ ++i);return n}}M.prototype.klassSubType="DistanceMatrix";class _ extends x{constructor(t,e,r){super(),this.matrix=t,this.rows=e,this.columns=r}}class k extends _{constructor(t,e,r){g(t,e),p(t,r),super(t,e.length,r.length),this.rowIndices=e,this.columnIndices=r}set(t,e,r){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],r),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class A extends x{constructor(t,e={}){const{rows:r=1}=e;if(t.length%r!=0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=r,this.columns=t.length/r,this.data=t}set(t,e,r){let n=this._calculateIndex(t,e);return this.data[n]=r,this}get(t,e){let r=this._calculateIndex(t,e);return this.data[r]}_calculateIndex(t,e){return t*this.columns+e}}class j extends x{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}}class S{constructor(t){let e,r,n,o,i,s,a,u,h,d=(t=j.checkMatrix(t)).clone(),c=d.rows,l=d.columns,f=new Float64Array(c),g=1;for(e=0;e<c;e++)f[e]=e;for(u=new Float64Array(c),r=0;r<l;r++){for(e=0;e<c;e++)u[e]=d.get(e,r);for(e=0;e<c;e++){for(h=Math.min(e,r),i=0,n=0;n<h;n++)i+=d.get(e,n)*u[n];u[e]-=i,d.set(e,r,u[e])}for(o=r,e=r+1;e<c;e++)Math.abs(u[e])>Math.abs(u[o])&&(o=e);if(o!==r){for(n=0;n<l;n++)s=d.get(o,n),d.set(o,n,d.get(r,n)),d.set(r,n,s);a=f[o],f[o]=f[r],f[r]=a,g=-g}if(r<c&&0!==d.get(r,r))for(e=r+1;e<c;e++)d.set(e,r,d.get(e,r)/d.get(r,r))}this.LU=d,this.pivotVector=f,this.pivotSign=g}isSingular(){let t=this.LU,e=t.columns;for(let r=0;r<e;r++)if(0===t.get(r,r))return!0;return!1}solve(t){t=E.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let r,n,o,i=t.columns,s=t.subMatrixRow(this.pivotVector,0,i-1),a=e.columns;for(o=0;o<a;o++)for(r=o+1;r<a;r++)for(n=0;n<i;n++)s.set(r,n,s.get(r,n)-s.get(o,n)*e.get(r,o));for(o=a-1;o>=0;o--){for(n=0;n<i;n++)s.set(o,n,s.get(o,n)/e.get(o,o));for(r=0;r<o;r++)for(n=0;n<i;n++)s.set(r,n,s.get(r,n)-s.get(o,n)*e.get(r,o))}return s}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,r=t.columns;for(let n=0;n<r;n++)e*=t.get(n,n);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,n=new E(e,r);for(let o=0;o<e;o++)for(let e=0;e<r;e++)o>e?n.set(o,e,t.get(o,e)):o===e?n.set(o,e,1):n.set(o,e,0);return n}get upperTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,n=new E(e,r);for(let o=0;o<e;o++)for(let e=0;e<r;e++)o<=e?n.set(o,e,t.get(o,e)):n.set(o,e,0);return n}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function O(t,e){let r=0;return Math.abs(t)>Math.abs(e)?(r=e/t,Math.abs(t)*Math.sqrt(1+r*r)):0!==e?(r=t/e,Math.abs(e)*Math.sqrt(1+r*r)):0}class z{constructor(t){let e,r,n,o,i=(t=j.checkMatrix(t)).clone(),s=t.rows,a=t.columns,u=new Float64Array(a);for(n=0;n<a;n++){let t=0;for(e=n;e<s;e++)t=O(t,i.get(e,n));if(0!==t){for(i.get(n,n)<0&&(t=-t),e=n;e<s;e++)i.set(e,n,i.get(e,n)/t);for(i.set(n,n,i.get(n,n)+1),r=n+1;r<a;r++){for(o=0,e=n;e<s;e++)o+=i.get(e,n)*i.get(e,r);for(o=-o/i.get(n,n),e=n;e<s;e++)i.set(e,r,i.get(e,r)+o*i.get(e,n))}}u[n]=-t}this.QR=i,this.Rdiag=u}solve(t){t=E.checkMatrix(t);let e=this.QR,r=e.rows;if(t.rows!==r)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let n,o,i,s,a=t.columns,u=t.clone(),h=e.columns;for(i=0;i<h;i++)for(o=0;o<a;o++){for(s=0,n=i;n<r;n++)s+=e.get(n,i)*u.get(n,o);for(s=-s/e.get(i,i),n=i;n<r;n++)u.set(n,o,u.get(n,o)+s*e.get(n,i))}for(i=h-1;i>=0;i--){for(o=0;o<a;o++)u.set(i,o,u.get(i,o)/this.Rdiag[i]);for(n=0;n<i;n++)for(o=0;o<a;o++)u.set(n,o,u.get(n,o)-u.get(i,o)*e.get(n,i))}return u.subMatrix(0,h-1,0,a-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(0===this.Rdiag[e])return!1;return!0}get upperTriangularMatrix(){let t,e,r=this.QR,n=r.columns,o=new E(n,n);for(t=0;t<n;t++)for(e=0;e<n;e++)t<e?o.set(t,e,r.get(t,e)):t===e?o.set(t,e,this.Rdiag[t]):o.set(t,e,0);return o}get orthogonalMatrix(){let t,e,r,n,o=this.QR,i=o.rows,s=o.columns,a=new E(i,s);for(r=s-1;r>=0;r--){for(t=0;t<i;t++)a.set(t,r,0);for(a.set(r,r,1),e=r;e<s;e++)if(0!==o.get(r,r)){for(n=0,t=r;t<i;t++)n+=o.get(t,r)*a.get(t,e);for(n=-n/o.get(r,r),t=r;t<i;t++)a.set(t,e,a.get(t,e)+n*o.get(t,r))}}return a}}class R{constructor(t,e={}){if((t=j.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let r=t.rows,n=t.columns;const{computeLeftSingularVectors:o=!0,computeRightSingularVectors:i=!0,autoTranspose:s=!1}=e;let a,u=Boolean(o),h=Boolean(i),d=!1;if(r<n)if(s){a=t.transpose(),r=a.rows,n=a.columns,d=!0;let e=u;u=h,h=e}else a=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else a=t.clone();let c=Math.min(r,n),l=Math.min(r+1,n),f=new Float64Array(l),g=new E(r,c),p=new E(n,n),v=new Float64Array(n),m=new Float64Array(r),y=new Float64Array(l);for(let t=0;t<l;t++)y[t]=t;let w=Math.min(r-1,n),x=Math.max(0,Math.min(n-2,r)),b=Math.max(w,x);for(let t=0;t<b;t++){if(t<w){f[t]=0;for(let e=t;e<r;e++)f[t]=O(f[t],a.get(e,t));if(0!==f[t]){a.get(t,t)<0&&(f[t]=-f[t]);for(let e=t;e<r;e++)a.set(e,t,a.get(e,t)/f[t]);a.set(t,t,a.get(t,t)+1)}f[t]=-f[t]}for(let e=t+1;e<n;e++){if(t<w&&0!==f[t]){let n=0;for(let o=t;o<r;o++)n+=a.get(o,t)*a.get(o,e);n=-n/a.get(t,t);for(let o=t;o<r;o++)a.set(o,e,a.get(o,e)+n*a.get(o,t))}v[e]=a.get(t,e)}if(u&&t<w)for(let e=t;e<r;e++)g.set(e,t,a.get(e,t));if(t<x){v[t]=0;for(let e=t+1;e<n;e++)v[t]=O(v[t],v[e]);if(0!==v[t]){v[t+1]<0&&(v[t]=0-v[t]);for(let e=t+1;e<n;e++)v[e]/=v[t];v[t+1]+=1}if(v[t]=-v[t],t+1<r&&0!==v[t]){for(let e=t+1;e<r;e++)m[e]=0;for(let e=t+1;e<r;e++)for(let r=t+1;r<n;r++)m[e]+=v[r]*a.get(e,r);for(let e=t+1;e<n;e++){let n=-v[e]/v[t+1];for(let o=t+1;o<r;o++)a.set(o,e,a.get(o,e)+n*m[o])}}if(h)for(let e=t+1;e<n;e++)p.set(e,t,v[e])}}let N=Math.min(n,r+1);if(w<n&&(f[w]=a.get(w,w)),r<N&&(f[N-1]=0),x+1<N&&(v[x]=a.get(x,N-1)),v[N-1]=0,u){for(let t=w;t<c;t++){for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}for(let t=w-1;t>=0;t--)if(0!==f[t]){for(let e=t+1;e<c;e++){let n=0;for(let o=t;o<r;o++)n+=g.get(o,t)*g.get(o,e);n=-n/g.get(t,t);for(let o=t;o<r;o++)g.set(o,e,g.get(o,e)+n*g.get(o,t))}for(let e=t;e<r;e++)g.set(e,t,-g.get(e,t));g.set(t,t,1+g.get(t,t));for(let e=0;e<t-1;e++)g.set(e,t,0)}else{for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}}if(h)for(let t=n-1;t>=0;t--){if(t<x&&0!==v[t])for(let e=t+1;e<n;e++){let r=0;for(let o=t+1;o<n;o++)r+=p.get(o,t)*p.get(o,e);r=-r/p.get(t+1,t);for(let o=t+1;o<n;o++)p.set(o,e,p.get(o,e)+r*p.get(o,t))}for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}let M=N-1,_=Number.EPSILON;for(;N>0;){let t,e;for(t=N-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+_*Math.abs(f[t]+Math.abs(f[t+1]));if(Math.abs(v[t])<=e||Number.isNaN(v[t])){v[t]=0;break}}if(t===N-2)e=4;else{let r;for(r=N-1;r>=t&&r!==t;r--){let e=(r!==N?Math.abs(v[r]):0)+(r!==t+1?Math.abs(v[r-1]):0);if(Math.abs(f[r])<=_*e){f[r]=0;break}}r===t?e=3:r===N-1?e=1:(e=2,t=r)}switch(t++,e){case 1:{let e=v[N-2];v[N-2]=0;for(let r=N-2;r>=t;r--){let o=O(f[r],e),i=f[r]/o,s=e/o;if(f[r]=o,r!==t&&(e=-s*v[r-1],v[r-1]=i*v[r-1]),h)for(let t=0;t<n;t++)o=i*p.get(t,r)+s*p.get(t,N-1),p.set(t,N-1,-s*p.get(t,r)+i*p.get(t,N-1)),p.set(t,r,o)}break}case 2:{let e=v[t-1];v[t-1]=0;for(let n=t;n<N;n++){let o=O(f[n],e),i=f[n]/o,s=e/o;if(f[n]=o,e=-s*v[n],v[n]=i*v[n],u)for(let e=0;e<r;e++)o=i*g.get(e,n)+s*g.get(e,t-1),g.set(e,t-1,-s*g.get(e,n)+i*g.get(e,t-1)),g.set(e,n,o)}break}case 3:{const e=Math.max(Math.abs(f[N-1]),Math.abs(f[N-2]),Math.abs(v[N-2]),Math.abs(f[t]),Math.abs(v[t])),o=f[N-1]/e,i=f[N-2]/e,s=v[N-2]/e,a=f[t]/e,d=v[t]/e,c=((i+o)*(i-o)+s*s)/2,l=o*s*(o*s);let m=0;0===c&&0===l||(m=c<0?0-Math.sqrt(c*c+l):Math.sqrt(c*c+l),m=l/(c+m));let y=(a+o)*(a-o)+m,w=a*d;for(let e=t;e<N-1;e++){let o=O(y,w);0===o&&(o=Number.MIN_VALUE);let i=y/o,s=w/o;if(e!==t&&(v[e-1]=o),y=i*f[e]+s*v[e],v[e]=i*v[e]-s*f[e],w=s*f[e+1],f[e+1]=i*f[e+1],h)for(let t=0;t<n;t++)o=i*p.get(t,e)+s*p.get(t,e+1),p.set(t,e+1,-s*p.get(t,e)+i*p.get(t,e+1)),p.set(t,e,o);if(o=O(y,w),0===o&&(o=Number.MIN_VALUE),i=y/o,s=w/o,f[e]=o,y=i*v[e]+s*f[e+1],f[e+1]=-s*v[e]+i*f[e+1],w=s*v[e+1],v[e+1]=i*v[e+1],u&&e<r-1)for(let t=0;t<r;t++)o=i*g.get(t,e)+s*g.get(t,e+1),g.set(t,e+1,-s*g.get(t,e)+i*g.get(t,e+1)),g.set(t,e,o)}v[N-2]=y;break}case 4:if(f[t]<=0&&(f[t]=f[t]<0?-f[t]:0,h))for(let e=0;e<=M;e++)p.set(e,t,-p.get(e,t));for(;t<M&&!(f[t]>=f[t+1]);){let e=f[t];if(f[t]=f[t+1],f[t+1]=e,h&&t<n-1)for(let r=0;r<n;r++)e=p.get(r,t+1),p.set(r,t+1,p.get(r,t)),p.set(r,t,e);if(u&&t<r-1)for(let n=0;n<r;n++)e=g.get(n,t+1),g.set(n,t+1,g.get(n,t)),g.set(n,t,e);t++}N--}}if(d){let t=p;p=g,g=t}this.m=r,this.n=n,this.s=f,this.U=g,this.V=p}solve(t){let e=t,r=this.threshold,n=this.s.length,o=E.zeros(n,n);for(let t=0;t<n;t++)Math.abs(this.s[t])<=r?o.set(t,t,0):o.set(t,t,1/this.s[t]);let i=this.U,s=this.rightSingularVectors,a=s.mmul(o),u=s.rows,h=i.rows,d=E.zeros(u,h);for(let t=0;t<u;t++)for(let e=0;e<h;e++){let r=0;for(let o=0;o<n;o++)r+=a.get(t,o)*i.get(e,o);d.set(t,e,r)}return d.mmul(e)}solveForDiagonal(t){return this.solve(E.diag(t))}inverse(){let t=this.V,e=this.threshold,r=t.rows,n=t.columns,o=new E(r,this.s.length);for(let i=0;i<r;i++)for(let r=0;r<n;r++)Math.abs(this.s[r])>e&&o.set(i,r,t.get(i,r)/this.s[r]);let i=this.U,s=i.rows,a=i.columns,u=new E(r,s);for(let t=0;t<r;t++)for(let e=0;e<s;e++){let r=0;for(let n=0;n<a;n++)r+=o.get(t,n)*i.get(e,n);u.set(t,e,r)}return u}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,r=this.s;for(let n=0,o=r.length;n<o;n++)r[n]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return E.diag(this.s)}}function I(t,e,r=!1){return t=j.checkMatrix(t),e=j.checkMatrix(e),r?new R(t).solve(e):t.isSquare()?new S(t).solve(e):new z(t).solve(e)}function C(t,e){let r=[];for(let n=0;n<t;n++)n!==e&&r.push(n);return r}function D(t,e,r,n=1e-9,o=1e-9){if(t>o)return new Array(e.rows+1).fill(0);{let t=e.addRow(r,[0]);for(let e=0;e<t.rows;e++)Math.abs(t.get(e,0))<n&&t.set(e,0,0);return t.to1DArray()}}class P{constructor(t,e={}){const{assumeSymmetric:r=!1}=e;if(!(t=j.checkMatrix(t)).isSquare())throw new Error("Matrix is not a square matrix");if(t.isEmpty())throw new Error("Matrix must be non-empty");let n,o,i=t.columns,s=new E(i,i),a=new Float64Array(i),u=new Float64Array(i),h=t,d=!1;if(d=!!r||t.isSymmetric(),d){for(n=0;n<i;n++)for(o=0;o<i;o++)s.set(n,o,h.get(n,o));!function(t,e,r,n){let o,i,s,a,u,h,d,c;for(u=0;u<t;u++)r[u]=n.get(t-1,u);for(a=t-1;a>0;a--){for(c=0,s=0,h=0;h<a;h++)c+=Math.abs(r[h]);if(0===c)for(e[a]=r[a-1],u=0;u<a;u++)r[u]=n.get(a-1,u),n.set(a,u,0),n.set(u,a,0);else{for(h=0;h<a;h++)r[h]/=c,s+=r[h]*r[h];for(o=r[a-1],i=Math.sqrt(s),o>0&&(i=-i),e[a]=c*i,s-=o*i,r[a-1]=o-i,u=0;u<a;u++)e[u]=0;for(u=0;u<a;u++){for(o=r[u],n.set(u,a,o),i=e[u]+n.get(u,u)*o,h=u+1;h<=a-1;h++)i+=n.get(h,u)*r[h],e[h]+=n.get(h,u)*o;e[u]=i}for(o=0,u=0;u<a;u++)e[u]/=s,o+=e[u]*r[u];for(d=o/(s+s),u=0;u<a;u++)e[u]-=d*r[u];for(u=0;u<a;u++){for(o=r[u],i=e[u],h=u;h<=a-1;h++)n.set(h,u,n.get(h,u)-(o*e[h]+i*r[h]));r[u]=n.get(a-1,u),n.set(a,u,0)}}r[a]=s}for(a=0;a<t-1;a++){if(n.set(t-1,a,n.get(a,a)),n.set(a,a,1),s=r[a+1],0!==s){for(h=0;h<=a;h++)r[h]=n.get(h,a+1)/s;for(u=0;u<=a;u++){for(i=0,h=0;h<=a;h++)i+=n.get(h,a+1)*n.get(h,u);for(h=0;h<=a;h++)n.set(h,u,n.get(h,u)-i*r[h])}}for(h=0;h<=a;h++)n.set(h,a+1,0)}for(u=0;u<t;u++)r[u]=n.get(t-1,u),n.set(t-1,u,0);n.set(t-1,t-1,1),e[0]=0}(i,u,a,s),function(t,e,r,n){let o,i,s,a,u,h,d,c,l,f,g,p,v,m,y,w;for(s=1;s<t;s++)e[s-1]=e[s];e[t-1]=0;let x=0,b=0,E=Number.EPSILON;for(h=0;h<t;h++){for(b=Math.max(b,Math.abs(r[h])+Math.abs(e[h])),d=h;d<t&&!(Math.abs(e[d])<=E*b);)d++;if(d>h)do{for(o=r[h],c=(r[h+1]-o)/(2*e[h]),l=O(c,1),c<0&&(l=-l),r[h]=e[h]/(c+l),r[h+1]=e[h]*(c+l),f=r[h+1],i=o-r[h],s=h+2;s<t;s++)r[s]-=i;for(x+=i,c=r[d],g=1,p=g,v=g,m=e[h+1],y=0,w=0,s=d-1;s>=h;s--)for(v=p,p=g,w=y,o=g*e[s],i=g*c,l=O(c,e[s]),e[s+1]=y*l,y=e[s]/l,g=c/l,c=g*r[s]-y*o,r[s+1]=i+y*(g*o+y*r[s]),u=0;u<t;u++)i=n.get(u,s+1),n.set(u,s+1,y*n.get(u,s)+g*i),n.set(u,s,g*n.get(u,s)-y*i);c=-y*w*v*m*e[h]/f,e[h]=y*c,r[h]=g*c}while(Math.abs(e[h])>E*b);r[h]=r[h]+x,e[h]=0}for(s=0;s<t-1;s++){for(u=s,c=r[s],a=s+1;a<t;a++)r[a]<c&&(u=a,c=r[a]);if(u!==s)for(r[u]=r[s],r[s]=c,a=0;a<t;a++)c=n.get(a,s),n.set(a,s,n.get(a,u)),n.set(a,u,c)}}(i,u,a,s)}else{let t=new E(i,i),e=new Float64Array(i);for(o=0;o<i;o++)for(n=0;n<i;n++)t.set(n,o,h.get(n,o));!function(t,e,r,n){let o,i,s,a,u,h,d,c=t-1;for(h=1;h<=c-1;h++){for(d=0,a=h;a<=c;a++)d+=Math.abs(e.get(a,h-1));if(0!==d){for(s=0,a=c;a>=h;a--)r[a]=e.get(a,h-1)/d,s+=r[a]*r[a];for(i=Math.sqrt(s),r[h]>0&&(i=-i),s-=r[h]*i,r[h]=r[h]-i,u=h;u<t;u++){for(o=0,a=c;a>=h;a--)o+=r[a]*e.get(a,u);for(o/=s,a=h;a<=c;a++)e.set(a,u,e.get(a,u)-o*r[a])}for(a=0;a<=c;a++){for(o=0,u=c;u>=h;u--)o+=r[u]*e.get(a,u);for(o/=s,u=h;u<=c;u++)e.set(a,u,e.get(a,u)-o*r[u])}r[h]=d*r[h],e.set(h,h-1,d*i)}}for(a=0;a<t;a++)for(u=0;u<t;u++)n.set(a,u,a===u?1:0);for(h=c-1;h>=1;h--)if(0!==e.get(h,h-1)){for(a=h+1;a<=c;a++)r[a]=e.get(a,h-1);for(u=h;u<=c;u++){for(i=0,a=h;a<=c;a++)i+=r[a]*n.get(a,u);for(i=i/r[h]/e.get(h,h-1),a=h;a<=c;a++)n.set(a,u,n.get(a,u)+i*r[a])}}}(i,t,e,s),function(t,e,r,n,o){let i,s,a,u,h,d,c,l,f,g,p,v,m,y,w,x=t-1,b=t-1,E=Number.EPSILON,N=0,M=0,_=0,k=0,A=0,j=0,S=0,O=0;for(i=0;i<t;i++)for((i<0||i>b)&&(r[i]=o.get(i,i),e[i]=0),s=Math.max(i-1,0);s<t;s++)M+=Math.abs(o.get(i,s));for(;x>=0;){for(u=x;u>0&&(j=Math.abs(o.get(u-1,u-1))+Math.abs(o.get(u,u)),0===j&&(j=M),!(Math.abs(o.get(u,u-1))<E*j));)u--;if(u===x)o.set(x,x,o.get(x,x)+N),r[x]=o.get(x,x),e[x]=0,x--,O=0;else if(u===x-1){if(c=o.get(x,x-1)*o.get(x-1,x),_=(o.get(x-1,x-1)-o.get(x,x))/2,k=_*_+c,S=Math.sqrt(Math.abs(k)),o.set(x,x,o.get(x,x)+N),o.set(x-1,x-1,o.get(x-1,x-1)+N),l=o.get(x,x),k>=0){for(S=_>=0?_+S:_-S,r[x-1]=l+S,r[x]=r[x-1],0!==S&&(r[x]=l-c/S),e[x-1]=0,e[x]=0,l=o.get(x,x-1),j=Math.abs(l)+Math.abs(S),_=l/j,k=S/j,A=Math.sqrt(_*_+k*k),_/=A,k/=A,s=x-1;s<t;s++)S=o.get(x-1,s),o.set(x-1,s,k*S+_*o.get(x,s)),o.set(x,s,k*o.get(x,s)-_*S);for(i=0;i<=x;i++)S=o.get(i,x-1),o.set(i,x-1,k*S+_*o.get(i,x)),o.set(i,x,k*o.get(i,x)-_*S);for(i=0;i<=b;i++)S=n.get(i,x-1),n.set(i,x-1,k*S+_*n.get(i,x)),n.set(i,x,k*n.get(i,x)-_*S)}else r[x-1]=l+_,r[x]=l+_,e[x-1]=S,e[x]=-S;x-=2,O=0}else{if(l=o.get(x,x),f=0,c=0,u<x&&(f=o.get(x-1,x-1),c=o.get(x,x-1)*o.get(x-1,x)),10===O){for(N+=l,i=0;i<=x;i++)o.set(i,i,o.get(i,i)-l);j=Math.abs(o.get(x,x-1))+Math.abs(o.get(x-1,x-2)),l=f=.75*j,c=-.4375*j*j}if(30===O&&(j=(f-l)/2,j=j*j+c,j>0)){for(j=Math.sqrt(j),f<l&&(j=-j),j=l-c/((f-l)/2+j),i=0;i<=x;i++)o.set(i,i,o.get(i,i)-j);N+=j,l=f=c=.964}for(O+=1,h=x-2;h>=u&&(S=o.get(h,h),A=l-S,j=f-S,_=(A*j-c)/o.get(h+1,h)+o.get(h,h+1),k=o.get(h+1,h+1)-S-A-j,A=o.get(h+2,h+1),j=Math.abs(_)+Math.abs(k)+Math.abs(A),_/=j,k/=j,A/=j,h!==u)&&!(Math.abs(o.get(h,h-1))*(Math.abs(k)+Math.abs(A))<E*(Math.abs(_)*(Math.abs(o.get(h-1,h-1))+Math.abs(S)+Math.abs(o.get(h+1,h+1)))));)h--;for(i=h+2;i<=x;i++)o.set(i,i-2,0),i>h+2&&o.set(i,i-3,0);for(a=h;a<=x-1&&(y=a!==x-1,a!==h&&(_=o.get(a,a-1),k=o.get(a+1,a-1),A=y?o.get(a+2,a-1):0,l=Math.abs(_)+Math.abs(k)+Math.abs(A),0!==l&&(_/=l,k/=l,A/=l)),0!==l);a++)if(j=Math.sqrt(_*_+k*k+A*A),_<0&&(j=-j),0!==j){for(a!==h?o.set(a,a-1,-j*l):u!==h&&o.set(a,a-1,-o.get(a,a-1)),_+=j,l=_/j,f=k/j,S=A/j,k/=_,A/=_,s=a;s<t;s++)_=o.get(a,s)+k*o.get(a+1,s),y&&(_+=A*o.get(a+2,s),o.set(a+2,s,o.get(a+2,s)-_*S)),o.set(a,s,o.get(a,s)-_*l),o.set(a+1,s,o.get(a+1,s)-_*f);for(i=0;i<=Math.min(x,a+3);i++)_=l*o.get(i,a)+f*o.get(i,a+1),y&&(_+=S*o.get(i,a+2),o.set(i,a+2,o.get(i,a+2)-_*A)),o.set(i,a,o.get(i,a)-_),o.set(i,a+1,o.get(i,a+1)-_*k);for(i=0;i<=b;i++)_=l*n.get(i,a)+f*n.get(i,a+1),y&&(_+=S*n.get(i,a+2),n.set(i,a+2,n.get(i,a+2)-_*A)),n.set(i,a,n.get(i,a)-_),n.set(i,a+1,n.get(i,a+1)-_*k)}}}if(0!==M){for(x=t-1;x>=0;x--)if(_=r[x],k=e[x],0===k)for(u=x,o.set(x,x,1),i=x-1;i>=0;i--){for(c=o.get(i,i)-_,A=0,s=u;s<=x;s++)A+=o.get(i,s)*o.get(s,x);if(e[i]<0)S=c,j=A;else if(u=i,0===e[i]?o.set(i,x,0!==c?-A/c:-A/(E*M)):(l=o.get(i,i+1),f=o.get(i+1,i),k=(r[i]-_)*(r[i]-_)+e[i]*e[i],d=(l*j-S*A)/k,o.set(i,x,d),o.set(i+1,x,Math.abs(l)>Math.abs(S)?(-A-c*d)/l:(-j-f*d)/S)),d=Math.abs(o.get(i,x)),E*d*d>1)for(s=i;s<=x;s++)o.set(s,x,o.get(s,x)/d)}else if(k<0)for(u=x-1,Math.abs(o.get(x,x-1))>Math.abs(o.get(x-1,x))?(o.set(x-1,x-1,k/o.get(x,x-1)),o.set(x-1,x,-(o.get(x,x)-_)/o.get(x,x-1))):(w=T(0,-o.get(x-1,x),o.get(x-1,x-1)-_,k),o.set(x-1,x-1,w[0]),o.set(x-1,x,w[1])),o.set(x,x-1,0),o.set(x,x,1),i=x-2;i>=0;i--){for(g=0,p=0,s=u;s<=x;s++)g+=o.get(i,s)*o.get(s,x-1),p+=o.get(i,s)*o.get(s,x);if(c=o.get(i,i)-_,e[i]<0)S=c,A=g,j=p;else if(u=i,0===e[i]?(w=T(-g,-p,c,k),o.set(i,x-1,w[0]),o.set(i,x,w[1])):(l=o.get(i,i+1),f=o.get(i+1,i),v=(r[i]-_)*(r[i]-_)+e[i]*e[i]-k*k,m=2*(r[i]-_)*k,0===v&&0===m&&(v=E*M*(Math.abs(c)+Math.abs(k)+Math.abs(l)+Math.abs(f)+Math.abs(S))),w=T(l*A-S*g+k*p,l*j-S*p-k*g,v,m),o.set(i,x-1,w[0]),o.set(i,x,w[1]),Math.abs(l)>Math.abs(S)+Math.abs(k)?(o.set(i+1,x-1,(-g-c*o.get(i,x-1)+k*o.get(i,x))/l),o.set(i+1,x,(-p-c*o.get(i,x)-k*o.get(i,x-1))/l)):(w=T(-A-f*o.get(i,x-1),-j-f*o.get(i,x),S,k),o.set(i+1,x-1,w[0]),o.set(i+1,x,w[1]))),d=Math.max(Math.abs(o.get(i,x-1)),Math.abs(o.get(i,x))),E*d*d>1)for(s=i;s<=x;s++)o.set(s,x-1,o.get(s,x-1)/d),o.set(s,x,o.get(s,x)/d)}for(i=0;i<t;i++)if(i<0||i>b)for(s=i;s<t;s++)n.set(i,s,o.get(i,s));for(s=t-1;s>=0;s--)for(i=0;i<=b;i++){for(S=0,a=0;a<=Math.min(s,b);a++)S+=n.get(i,a)*o.get(a,s);n.set(i,s,S)}}}(i,u,a,s,t)}this.n=i,this.e=u,this.d=a,this.V=s}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let t,e,r=this.n,n=this.e,o=this.d,i=new E(r,r);for(t=0;t<r;t++){for(e=0;e<r;e++)i.set(t,e,0);i.set(t,t,o[t]),n[t]>0?i.set(t,t+1,n[t]):n[t]<0&&i.set(t,t-1,n[t])}return i}}function T(t,e,r,n){let o,i;return Math.abs(r)>Math.abs(n)?(o=n/r,i=r+o*n,[(t+o*e)/i,(e-o*t)/i]):(o=r/n,i=n+o*r,[(o*t+e)/i,(o*e-t)/i])}class L{constructor(t){if(!(t=j.checkMatrix(t)).isSymmetric())throw new Error("Matrix is not symmetric");let e,r,n,o=t,i=o.rows,s=new E(i,i),a=!0;for(r=0;r<i;r++){let t=0;for(n=0;n<r;n++){let i=0;for(e=0;e<n;e++)i+=s.get(n,e)*s.get(r,e);i=(o.get(r,n)-i)/s.get(n,n),s.set(r,n,i),t+=i*i}for(t=o.get(r,r)-t,a&=t>0,s.set(r,r,Math.sqrt(Math.max(t,0))),n=r+1;n<i;n++)s.set(r,n,0)}this.L=s,this.positiveDefinite=Boolean(a)}isPositiveDefinite(){return this.positiveDefinite}solve(t){t=j.checkMatrix(t);let e=this.L,r=e.rows;if(t.rows!==r)throw new Error("Matrix dimensions do not match");if(!1===this.isPositiveDefinite())throw new Error("Matrix is not positive definite");let n,o,i,s=t.columns,a=t.clone();for(i=0;i<r;i++)for(o=0;o<s;o++){for(n=0;n<i;n++)a.set(i,o,a.get(i,o)-a.get(n,o)*e.get(i,n));a.set(i,o,a.get(i,o)/e.get(i,i))}for(i=r-1;i>=0;i--)for(o=0;o<s;o++){for(n=i+1;n<r;n++)a.set(i,o,a.get(i,o)-a.get(n,o)*e.get(n,i));a.set(i,o,a.get(i,o)/e.get(i,i))}return a}get lowerTriangularMatrix(){return this.L}}class F{constructor(t,e={}){t=j.checkMatrix(t);let{Y:r}=e;const{scaleScores:o=!1,maxIterations:i=1e3,terminationCriteria:s=1e-10}=e;let a;if(r){if(r=n.isAnyArray(r)&&"number"==typeof r[0]?E.columnVector(r):j.checkMatrix(r),r.rows!==t.rows)throw new Error("Y should have the same number of rows as X");a=r.getColumnVector(0)}else a=t.getColumnVector(0);let u,h,d,c,l=1;for(let e=0;e<i&&l>s;e++)d=t.transpose().mmul(a).div(a.transpose().mmul(a).get(0,0)),d=d.div(d.norm()),u=t.mmul(d).div(d.transpose().mmul(d).get(0,0)),e>0&&(l=u.clone().sub(c).pow(2).sum()),c=u.clone(),r?(h=r.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),h=h.div(h.norm()),a=r.mmul(h).div(h.transpose().mmul(h).get(0,0))):a=u;if(r){let e=t.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0));e=e.div(e.norm());let n=t.clone().sub(u.clone().mmul(e.transpose())),o=a.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),i=r.clone().sub(u.clone().mulS(o.get(0,0)).mmul(h.transpose()));this.t=u,this.p=e.transpose(),this.w=d.transpose(),this.q=h,this.u=a,this.s=u.transpose().mmul(u),this.xResidual=n,this.yResidual=i,this.betas=o}else this.w=d.transpose(),this.s=u.transpose().mmul(u).sqrt(),this.t=o?u.clone().div(this.s.get(0,0)):u,this.xResidual=t.sub(u.mmul(d.transpose()))}}e.y3=x,e.jy=L,e.oN=L,e.Hc=M,e.cg=P,e.hj=P,e.LU=S,e.Tb=S,e.uq=E,e.Zm=class extends _{constructor(t,e){p(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,r){return this.matrix.set(t,this.columnIndices[e],r),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}},e.Dq=class extends _{constructor(t,e){c(t,e),super(t,t.rows,1),this.column=e}set(t,e,r){return this.matrix.set(t,this.column,r),this}get(t){return this.matrix.get(t,this.column)}},e.__=class extends _{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(t,this.columns-e-1,r),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}},e.q0=class extends _{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(this.rows-t-1,e,r),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}},e.lh=class extends _{constructor(t,e){g(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,r){return this.matrix.set(this.rowIndices[t],e,r),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}},e.pI=class extends _{constructor(t,e){d(t,e),super(t,1,t.columns),this.row=e}set(t,e,r){return this.matrix.set(this.row,e,r),this}get(t,e){return this.matrix.get(this.row,e)}},e.zC=k,e.zg=class extends _{constructor(t,e,r,n,o){v(t,e,r,n,o),super(t,r-e+1,o-n+1),this.startRow=e,this.startColumn=n}set(t,e,r){return this.matrix.set(this.startRow+t,this.startColumn+e,r),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}},e.g6=class extends _{constructor(t){super(t,t.columns,t.rows)}set(t,e,r){return this.matrix.set(e,t,r),this}get(t,e){return this.matrix.get(e,t)}},e.OL=F,e.ks=F,e.QR=z,e.jp=z,e.mk=R,e.W2=R,e.l=N,e.KY=A,e.dv=j,e.BR=function(t,e=t,r={}){t=new E(t);let o=!1;if("object"!=typeof e||E.isMatrix(e)||n.isAnyArray(e)?e=new E(e):(r=e,e=t,o=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0,scale:s=!0}=r;i&&(t.center("column"),o||e.center("column")),s&&(t.scale("column"),o||e.scale("column"));const a=t.standardDeviation("column",{unbiased:!0}),u=o?a:e.standardDeviation("column",{unbiased:!0}),h=t.transpose().mmul(e);for(let e=0;e<h.rows;e++)for(let r=0;r<h.columns;r++)h.set(e,r,h.get(e,r)*(1/(a[e]*u[r]))*(1/(t.rows-1)));return h},e.Wu=function(t,e=t,r={}){t=new E(t);let o=!1;if("object"!=typeof e||E.isMatrix(e)||n.isAnyArray(e)?e=new E(e):(r=e,e=t,o=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0}=r;i&&(t=t.center("column"),o||(e=e.center("column")));const s=t.transpose().mmul(e);for(let e=0;e<s.rows;e++)for(let r=0;r<s.columns;r++)s.set(e,r,s.get(e,r)*(1/(t.rows-1)));return s},e.a4=function t(e){if((e=E.checkMatrix(e)).isSquare()){if(0===e.columns)return 1;let r,n,o,i;if(2===e.columns)return r=e.get(0,0),n=e.get(0,1),o=e.get(1,0),i=e.get(1,1),r*i-n*o;if(3===e.columns){let i,s,a;return i=new k(e,[1,2],[1,2]),s=new k(e,[1,2],[0,2]),a=new k(e,[1,2],[0,1]),r=e.get(0,0),n=e.get(0,1),o=e.get(0,2),r*t(i)-n*t(s)+o*t(a)}return new S(e).determinant}throw Error("determinant can only be calculated for a square matrix")},e.DI=function(t,e=!1){return t=j.checkMatrix(t),e?new R(t).inverse():I(t,E.eye(t.rows))},e.Jo=function(t,e={}){const{thresholdValue:r=1e-9,thresholdError:n=1e-9}=e;let o=(t=E.checkMatrix(t)).rows,i=new E(o,o);for(let e=0;e<o;e++){let s=E.columnVector(t.getRow(e)),a=t.subMatrixRow(C(o,e)).transpose(),u=new R(a).solve(s),h=E.sub(s,a.mmul(u)).abs().max();i.setRow(e,D(h,u,e,r,n))}return i},e.Zi=function(t,e=Number.EPSILON){if((t=E.checkMatrix(t)).isEmpty())return t.transpose();let r=new R(t,{autoTranspose:!0}),n=r.leftSingularVectors,o=r.rightSingularVectors,i=r.diagonal;for(let t=0;t<i.length;t++)Math.abs(i[t])>e?i[t]=1/i[t]:i[t]=0;return o.mmul(E.diag(i).mmul(n.transpose()))},e.kH=I,e.LV=function(t,e){if(n.isAnyArray(t))return t[0]&&n.isAnyArray(t[0])?new j(t):new A(t,e);throw new Error("the argument is not an array")}},2583:(t,e,r)=>{var n=r(6135),o=["stopLayout","calculateLayout"];t.exports=function(){var t=new Worker(URL.createObjectURL(new Blob(['(()=>{var t={4341:(t,e,r)=>{t.exports={graphlib:r(3374),layout:r(9407),debug:r(6978),util:{time:r(6573).time,notime:r(6573).notime},version:r(6661)}},9317:(t,e,r)=>{"use strict";var n=r(5076),o=r(3526);t.exports={run:function(t){var e="greedy"===t.graph().acyclicer?o(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],r={},o={};return n.forEach(t.nodes(),(function i(s){n.has(o,s)||(o[s]=!0,r[s]=!0,n.forEach(t.outEdges(s),(function(t){n.has(r,t.w)?e.push(t):i(t.w)})),delete r[s])})),e}(t);n.forEach(e,(function(e){var r=t.edge(e);t.removeEdge(e),r.forwardName=e.name,r.reversed=!0,t.setEdge(e.w,e.v,r,n.uniqueId("rev"))}))},undo:function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.reversed){t.removeEdge(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}}))}}},7840:(t,e,r)=>{var n=r(5076),o=r(6573);function i(t,e,r,n,i,s){var a={width:0,height:0,rank:s,borderType:e},u=i[e][s-1],h=o.addDummyNode(t,"border",a,r);i[e][s]=h,t.setParent(h,n),u&&t.setEdge(u,h,{weight:1})}t.exports=function(t){n.forEach(t.children(),(function e(r){var o=t.children(r),s=t.node(r);if(o.length&&n.forEach(o,e),n.has(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(var a=s.minRank,u=s.maxRank+1;a<u;++a)i(t,"borderLeft","_bl",r,s,a),i(t,"borderRight","_br",r,s,a)}}))}},5793:(t,e,r)=>{"use strict";var n=r(5076);function o(t){n.forEach(t.nodes(),(function(e){i(t.node(e))})),n.forEach(t.edges(),(function(e){i(t.edge(e))}))}function i(t){var e=t.width;t.width=t.height,t.height=e}function s(t){t.y=-t.y}function a(t){var e=t.x;t.x=t.y,t.y=e}t.exports={adjust:function(t){var e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||o(t)},undo:function(t){var e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){n.forEach(t.nodes(),(function(e){s(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.forEach(r.points,s),n.has(r,"y")&&s(r)}))}(t),"lr"!==e&&"rl"!==e||(function(t){n.forEach(t.nodes(),(function(e){a(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.forEach(r.points,a),n.has(r,"x")&&a(r)}))}(t),o(t))}}},5752:t=>{function e(){var t={};t._next=t._prev=t,this._sentinel=t}function r(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function n(t,e){if("_next"!==t&&"_prev"!==t)return e}t.exports=e,e.prototype.dequeue=function(){var t=this._sentinel,e=t._prev;if(e!==t)return r(e),e},e.prototype.enqueue=function(t){var e=this._sentinel;t._prev&&t._next&&r(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e},e.prototype.toString=function(){for(var t=[],e=this._sentinel,r=e._prev;r!==e;)t.push(JSON.stringify(r,n)),r=r._prev;return"["+t.join(", ")+"]"}},6978:(t,e,r)=>{var n=r(5076),o=r(6573),i=r(3374).Graph;t.exports={debugOrdering:function(t){var e=o.buildLayerMatrix(t),r=new i({compound:!0,multigraph:!0}).setGraph({});return n.forEach(t.nodes(),(function(e){r.setNode(e,{label:e}),r.setParent(e,"layer"+t.node(e).rank)})),n.forEach(t.edges(),(function(t){r.setEdge(t.v,t.w,{},t.name)})),n.forEach(e,(function(t,e){var o="layer"+e;r.setNode(o,{rank:"same"}),n.reduce(t,(function(t,e){return r.setEdge(t,e,{style:"invis"}),e}))})),r}}},3374:(t,e,r)=>{var n;try{n=r(7423)}catch(t){}n||(n=window.graphlib),t.exports=n},3526:(t,e,r)=>{var n=r(5076),o=r(3374).Graph,i=r(5752);t.exports=function(t,e){if(t.nodeCount()<=1)return[];var r=function(t,e){var r=new o,s=0,a=0;n.forEach(t.nodes(),(function(t){r.setNode(t,{v:t,in:0,out:0})})),n.forEach(t.edges(),(function(t){var n=r.edge(t.v,t.w)||0,o=e(t),i=n+o;r.setEdge(t.v,t.w,i),a=Math.max(a,r.node(t.v).out+=o),s=Math.max(s,r.node(t.w).in+=o)}));var h=n.range(a+s+3).map((function(){return new i})),d=s+1;return n.forEach(r.nodes(),(function(t){u(h,d,r.node(t))})),{graph:r,buckets:h,zeroIdx:d}}(t,e||s),h=function(t,e,r){for(var n,o=[],i=e[e.length-1],s=e[0];t.nodeCount();){for(;n=s.dequeue();)a(t,e,r,n);for(;n=i.dequeue();)a(t,e,r,n);if(t.nodeCount())for(var u=e.length-2;u>0;--u)if(n=e[u].dequeue()){o=o.concat(a(t,e,r,n,!0));break}}return o}(r.graph,r.buckets,r.zeroIdx);return n.flatten(n.map(h,(function(e){return t.outEdges(e.v,e.w)})),!0)};var s=n.constant(1);function a(t,e,r,o,i){var s=i?[]:void 0;return n.forEach(t.inEdges(o.v),(function(n){var o=t.edge(n),a=t.node(n.v);i&&s.push({v:n.v,w:n.w}),a.out-=o,u(e,r,a)})),n.forEach(t.outEdges(o.v),(function(n){var o=t.edge(n),i=n.w,s=t.node(i);s.in-=o,u(e,r,s)})),t.removeNode(o.v),s}function u(t,e,r){r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)}},9407:(t,e,r)=>{"use strict";var n=r(5076),o=r(9317),i=r(9934),s=r(9472),a=r(6573).normalizeRanks,u=r(9095),h=r(6573).removeEmptyRanks,d=r(9526),c=r(7840),l=r(5793),f=r(9186),g=r(9497),p=r(6573),v=r(3374).Graph;t.exports=function(t,e){var r=e&&e.debugTiming?p.time:p.notime;r("layout",(function(){var e=r(" buildLayoutGraph",(function(){return function(t){var e=new v({multigraph:!0,compound:!0}),r=k(t.graph());return e.setGraph(n.merge({},y,_(r,m),n.pick(r,w))),n.forEach(t.nodes(),(function(r){var o=k(t.node(r));e.setNode(r,n.defaults(_(o,x),b)),e.setParent(r,t.parent(r))})),n.forEach(t.edges(),(function(r){var o=k(t.edge(r));e.setEdge(r,n.merge({},N,_(o,E),n.pick(o,M)))})),e}(t)}));r(" runLayout",(function(){!function(t,e){e(" makeSpaceForEdgeLabels",(function(){!function(t){var e=t.graph();e.ranksep/=2,n.forEach(t.edges(),(function(r){var n=t.edge(r);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)}))}(t)})),e(" removeSelfEdges",(function(){!function(t){n.forEach(t.edges(),(function(e){if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}}))}(t)})),e(" acyclic",(function(){o.run(t)})),e(" nestingGraph.run",(function(){d.run(t)})),e(" rank",(function(){s(p.asNonCompoundGraph(t))})),e(" injectEdgeLabelProxies",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.width&&r.height){var n=t.node(e.v),o={rank:(t.node(e.w).rank-n.rank)/2+n.rank,e};p.addDummyNode(t,"edge-proxy",o,"_ep")}}))}(t)})),e(" removeEmptyRanks",(function(){h(t)})),e(" nestingGraph.cleanup",(function(){d.cleanup(t)})),e(" normalizeRanks",(function(){a(t)})),e(" assignRankMinMax",(function(){!function(t){var e=0;n.forEach(t.nodes(),(function(r){var o=t.node(r);o.borderTop&&(o.minRank=t.node(o.borderTop).rank,o.maxRank=t.node(o.borderBottom).rank,e=n.max(e,o.maxRank))})),t.graph().maxRank=e}(t)})),e(" removeEdgeLabelProxies",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);"edge-proxy"===r.dummy&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))}))}(t)})),e(" normalize.run",(function(){i.run(t)})),e(" parentDummyChains",(function(){u(t)})),e(" addBorderSegments",(function(){c(t)})),e(" order",(function(){f(t)})),e(" insertSelfEdges",(function(){!function(t){var e=p.buildLayerMatrix(t);n.forEach(e,(function(e){var r=0;n.forEach(e,(function(e,o){var i=t.node(e);i.order=o+r,n.forEach(i.selfEdges,(function(e){p.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:o+ ++r,e:e.e,label:e.label},"_se")})),delete i.selfEdges}))}))}(t)})),e(" adjustCoordinateSystem",(function(){l.adjust(t)})),e(" position",(function(){g(t)})),e(" positionSelfEdges",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),o=n.x+n.width/2,i=n.y,s=r.x-o,a=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{x:o+s,y:i},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.label.x=r.x,r.label.y=r.y}}))}(t)})),e(" removeBorderNodes",(function(){!function(t){n.forEach(t.nodes(),(function(e){if(t.children(e).length){var r=t.node(e),o=t.node(r.borderTop),i=t.node(r.borderBottom),s=t.node(n.last(r.borderLeft)),a=t.node(n.last(r.borderRight));r.width=Math.abs(a.x-s.x),r.height=Math.abs(i.y-o.y),r.x=s.x+r.width/2,r.y=o.y+r.height/2}})),n.forEach(t.nodes(),(function(e){"border"===t.node(e).dummy&&t.removeNode(e)}))}(t)})),e(" normalize.undo",(function(){i.undo(t)})),e(" fixupEdgeLabelCoords",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(n.has(r,"x"))switch("l"!==r.labelpos&&"r"!==r.labelpos||(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}}))}(t)})),e(" undoCoordinateSystem",(function(){l.undo(t)})),e(" translateGraph",(function(){!function(t){var e=Number.POSITIVE_INFINITY,r=0,o=Number.POSITIVE_INFINITY,i=0,s=t.graph(),a=s.marginx||0,u=s.marginy||0;function h(t){var n=t.x,s=t.y,a=t.width,u=t.height;e=Math.min(e,n-a/2),r=Math.max(r,n+a/2),o=Math.min(o,s-u/2),i=Math.max(i,s+u/2)}n.forEach(t.nodes(),(function(e){h(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.has(r,"x")&&h(r)})),e-=a,o-=u,n.forEach(t.nodes(),(function(r){var n=t.node(r);n.x-=e,n.y-=o})),n.forEach(t.edges(),(function(r){var i=t.edge(r);n.forEach(i.points,(function(t){t.x-=e,t.y-=o})),n.has(i,"x")&&(i.x-=e),n.has(i,"y")&&(i.y-=o)})),s.width=r-e+a,s.height=i-o+u}(t)})),e(" assignNodeIntersects",(function(){!function(t){n.forEach(t.edges(),(function(e){var r,n,o=t.edge(e),i=t.node(e.v),s=t.node(e.w);o.points?(r=o.points[0],n=o.points[o.points.length-1]):(o.points=[],r=s,n=i),o.points.unshift(p.intersectRect(i,r)),o.points.push(p.intersectRect(s,n))}))}(t)})),e(" reversePoints",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);r.reversed&&r.points.reverse()}))}(t)})),e(" acyclic.undo",(function(){o.undo(t)}))}(e,r)})),r(" updateInputGraph",(function(){!function(t,e){n.forEach(t.nodes(),(function(r){var n=t.node(r),o=e.node(r);n&&(n.x=o.x,n.y=o.y,e.children(r).length&&(n.width=o.width,n.height=o.height))})),n.forEach(t.edges(),(function(r){var o=t.edge(r),i=e.edge(r);o.points=i.points,n.has(i,"x")&&(o.x=i.x,o.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,e)}))}))};var m=["nodesep","edgesep","ranksep","marginx","marginy"],y={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},w=["acyclicer","ranker","rankdir","align"],x=["width","height"],b={width:0,height:0},E=["minlen","weight","width","height","labeloffset"],N={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},M=["labelpos"];function _(t,e){return n.mapValues(n.pick(t,e),Number)}function k(t){var e={};return n.forEach(t,(function(t,r){e[r.toLowerCase()]=t})),e}},5076:(t,e,r)=>{var n;try{n={cloneDeep:r(9136),constant:r(8295),defaults:r(9529),each:r(958),filter:r(9969),find:r(828),flatten:r(7469),forEach:r(1117),forIn:r(4519),has:r(4339),isUndefined:r(2895),last:r(5179),map:r(9629),mapValues:r(5551),max:r(4213),merge:r(2495),min:r(9903),minBy:r(3262),now:r(8835),pick:r(222),range:r(4978),reduce:r(9285),sortBy:r(5246),uniqueId:r(761),values:r(3005),zipObject:r(3679)}}catch(t){}n||(n=window._),t.exports=n},9526:(t,e,r)=>{var n=r(5076),o=r(6573);function i(t,e,r,s,a,u,h){var d=t.children(h);if(d.length){var c=o.addBorderNode(t,"_bt"),l=o.addBorderNode(t,"_bb"),f=t.node(h);t.setParent(c,h),f.borderTop=c,t.setParent(l,h),f.borderBottom=l,n.forEach(d,(function(n){i(t,e,r,s,a,u,n);var o=t.node(n),d=o.borderTop?o.borderTop:n,f=o.borderBottom?o.borderBottom:n,g=o.borderTop?s:2*s,p=d!==f?1:a-u[h]+1;t.setEdge(c,d,{weight:g,minlen:p,nestingEdge:!0}),t.setEdge(f,l,{weight:g,minlen:p,nestingEdge:!0})})),t.parent(h)||t.setEdge(e,c,{weight:0,minlen:a+u[h]})}else h!==e&&t.setEdge(e,h,{weight:0,minlen:r})}t.exports={run:function(t){var e=o.addDummyNode(t,"root",{},"_root"),r=function(t){var e={};function r(o,i){var s=t.children(o);s&&s.length&&n.forEach(s,(function(t){r(t,i+1)})),e[o]=i}return n.forEach(t.children(),(function(t){r(t,1)})),e}(t),s=n.max(n.values(r))-1,a=2*s+1;t.graph().nestingRoot=e,n.forEach(t.edges(),(function(e){t.edge(e).minlen*=a}));var u=function(t){return n.reduce(t.edges(),(function(e,r){return e+t.edge(r).weight}),0)}(t)+1;n.forEach(t.children(),(function(n){i(t,e,a,u,s,r,n)})),t.graph().nodeRankFactor=a},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,n.forEach(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}}},9934:(t,e,r)=>{"use strict";var n=r(5076),o=r(6573);t.exports={run:function(t){t.graph().dummyChains=[],n.forEach(t.edges(),(function(e){!function(t,e){var r,n,i,s=e.v,a=t.node(s).rank,u=e.w,h=t.node(u).rank,d=e.name,c=t.edge(e),l=c.labelRank;if(h!==a+1){for(t.removeEdge(e),i=0,++a;a<h;++i,++a)c.points=[],n={width:0,height:0,edgeLabel:c,edgeObj:e,rank:a},r=o.addDummyNode(t,"edge",n,"_d"),a===l&&(n.width=c.width,n.height=c.height,n.dummy="edge-label",n.labelpos=c.labelpos),t.setEdge(s,r,{weight:c.weight},d),0===i&&t.graph().dummyChains.push(r),s=r;t.setEdge(s,u,{weight:c.weight},d)}}(t,e)}))},undo:function(t){n.forEach(t.graph().dummyChains,(function(e){var r,n=t.node(e),o=n.edgeLabel;for(t.setEdge(n.edgeObj,o);n.dummy;)r=t.successors(e)[0],t.removeNode(e),o.points.push({x:n.x,y:n.y}),"edge-label"===n.dummy&&(o.x=n.x,o.y=n.y,o.width=n.width,o.height=n.height),e=r,n=t.node(e)}))}}},9841:(t,e,r)=>{var n=r(5076);t.exports=function(t,e,r){var o,i={};n.forEach(r,(function(r){for(var n,s,a=t.parent(r);a;){if((n=t.parent(a))?(s=i[n],i[n]=a):(s=o,o=a),s&&s!==a)return void e.setEdge(s,a);a=n}}))}},5458:(t,e,r)=>{var n=r(5076);t.exports=function(t,e){return n.map(e,(function(e){var r=t.inEdges(e);if(r.length){var o=n.reduce(r,(function(e,r){var n=t.edge(r),o=t.node(r.v);return{sum:e.sum+n.weight*o.order,weight:e.weight+n.weight}}),{sum:0,weight:0});return{v:e,barycenter:o.sum/o.weight,weight:o.weight}}return{v:e}}))}},6263:(t,e,r)=>{var n=r(5076),o=r(3374).Graph;t.exports=function(t,e,r){var i=function(t){for(var e;t.hasNode(e=n.uniqueId("_root")););return e}(t),s=new o({compound:!0}).setGraph({root:i}).setDefaultNodeLabel((function(e){return t.node(e)}));return n.forEach(t.nodes(),(function(o){var a=t.node(o),u=t.parent(o);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(s.setNode(o),s.setParent(o,u||i),n.forEach(t[r](o),(function(e){var r=e.v===o?e.w:e.v,i=s.edge(r,o),a=n.isUndefined(i)?0:i.weight;s.setEdge(r,o,{weight:t.edge(e).weight+a})})),n.has(a,"minRank")&&s.setNode(o,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))})),s}},6840:(t,e,r)=>{"use strict";var n=r(5076);function o(t,e,r){for(var o=n.zipObject(r,n.map(r,(function(t,e){return e}))),i=n.flatten(n.map(e,(function(e){return n.sortBy(n.map(t.outEdges(e),(function(e){return{pos:o[e.w],weight:t.edge(e).weight}})),"pos")})),!0),s=1;s<r.length;)s<<=1;var a=2*s-1;s-=1;var u=n.map(new Array(a),(function(){return 0})),h=0;return n.forEach(i.forEach((function(t){var e=t.pos+s;u[e]+=t.weight;for(var r=0;e>0;)e%2&&(r+=u[e+1]),u[e=e-1>>1]+=t.weight;h+=t.weight*r}))),h}t.exports=function(t,e){for(var r=0,n=1;n<e.length;++n)r+=o(t,e[n-1],e[n]);return r}},9186:(t,e,r)=>{"use strict";var n=r(5076),o=r(1879),i=r(6840),s=r(9387),a=r(6263),u=r(9841),h=r(3374).Graph,d=r(6573);function c(t,e,r){return n.map(e,(function(e){return a(t,e,r)}))}function l(t,e){var r=new h;n.forEach(t,(function(t){var o=t.graph().root,i=s(t,o,r,e);n.forEach(i.vs,(function(e,r){t.node(e).order=r})),u(t,r,i.vs)}))}function f(t,e){n.forEach(e,(function(e){n.forEach(e,(function(e,r){t.node(e).order=r}))}))}t.exports=function(t){var e=d.maxRank(t),r=c(t,n.range(1,e+1),"inEdges"),s=c(t,n.range(e-1,-1,-1),"outEdges"),a=o(t);f(t,a);for(var u,h=Number.POSITIVE_INFINITY,g=0,p=0;p<4;++g,++p){l(g%2?r:s,g%4>=2),a=d.buildLayerMatrix(t);var v=i(t,a);v<h&&(p=0,u=n.cloneDeep(a),h=v)}f(t,u)}},1879:(t,e,r)=>{"use strict";var n=r(5076);t.exports=function(t){var e={},r=n.filter(t.nodes(),(function(e){return!t.children(e).length})),o=n.max(n.map(r,(function(e){return t.node(e).rank}))),i=n.map(n.range(o+1),(function(){return[]})),s=n.sortBy(r,(function(e){return t.node(e).rank}));return n.forEach(s,(function r(o){if(!n.has(e,o)){e[o]=!0;var s=t.node(o);i[s.rank].push(o),n.forEach(t.successors(o),r)}})),i}},5912:(t,e,r)=>{"use strict";var n=r(5076);t.exports=function(t,e){var r={};return n.forEach(t,(function(t,e){var o=r[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};n.isUndefined(t.barycenter)||(o.barycenter=t.barycenter,o.weight=t.weight)})),n.forEach(e.edges(),(function(t){var e=r[t.v],o=r[t.w];n.isUndefined(e)||n.isUndefined(o)||(o.indegree++,e.out.push(r[t.w]))})),function(t){var e=[];function r(t){return function(e){var r,o,i,s;e.merged||(n.isUndefined(e.barycenter)||n.isUndefined(t.barycenter)||e.barycenter>=t.barycenter)&&(o=e,i=0,s=0,(r=t).weight&&(i+=r.barycenter*r.weight,s+=r.weight),o.weight&&(i+=o.barycenter*o.weight,s+=o.weight),r.vs=o.vs.concat(r.vs),r.barycenter=i/s,r.weight=s,r.i=Math.min(o.i,r.i),o.merged=!0)}}function o(e){return function(r){r.in.push(e),0==--r.indegree&&t.push(r)}}for(;t.length;){var i=t.pop();e.push(i),n.forEach(i.in.reverse(),r(i)),n.forEach(i.out,o(i))}return n.map(n.filter(e,(function(t){return!t.merged})),(function(t){return n.pick(t,["vs","i","barycenter","weight"])}))}(n.filter(r,(function(t){return!t.indegree})))}},9387:(t,e,r)=>{var n=r(5076),o=r(5458),i=r(5912),s=r(256);t.exports=function t(e,r,a,u){var h=e.children(r),d=e.node(r),c=d?d.borderLeft:void 0,l=d?d.borderRight:void 0,f={};c&&(h=n.filter(h,(function(t){return t!==c&&t!==l})));var g=o(e,h);n.forEach(g,(function(r){if(e.children(r.v).length){var o=t(e,r.v,a,u);f[r.v]=o,n.has(o,"barycenter")&&(i=r,s=o,n.isUndefined(i.barycenter)?(i.barycenter=s.barycenter,i.weight=s.weight):(i.barycenter=(i.barycenter*i.weight+s.barycenter*s.weight)/(i.weight+s.weight),i.weight+=s.weight))}var i,s}));var p=i(g,a);!function(t,e){n.forEach(t,(function(t){t.vs=n.flatten(t.vs.map((function(t){return e[t]?e[t].vs:t})),!0)}))}(p,f);var v=s(p,u);if(c&&(v.vs=n.flatten([c,v.vs,l],!0),e.predecessors(c).length)){var m=e.node(e.predecessors(c)[0]),y=e.node(e.predecessors(l)[0]);n.has(v,"barycenter")||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+m.order+y.order)/(v.weight+2),v.weight+=2}return v}},256:(t,e,r)=>{var n=r(5076),o=r(6573);function i(t,e,r){for(var o;e.length&&(o=n.last(e)).i<=r;)e.pop(),t.push(o.vs),r++;return r}t.exports=function(t,e){var r,s=o.partition(t,(function(t){return n.has(t,"barycenter")})),a=s.lhs,u=n.sortBy(s.rhs,(function(t){return-t.i})),h=[],d=0,c=0,l=0;a.sort((r=!!e,function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:r?e.i-t.i:t.i-e.i})),l=i(h,u,l),n.forEach(a,(function(t){l+=t.vs.length,h.push(t.vs),d+=t.barycenter*t.weight,c+=t.weight,l=i(h,u,l)}));var f={vs:n.flatten(h,!0)};return c&&(f.barycenter=d/c,f.weight=c),f}},9095:(t,e,r)=>{var n=r(5076);t.exports=function(t){var e=function(t){var e={},r=0;return n.forEach(t.children(),(function o(i){var s=r;n.forEach(t.children(i),o),e[i]={low:s,lim:r++}})),e}(t);n.forEach(t.graph().dummyChains,(function(r){for(var n=t.node(r),o=n.edgeObj,i=function(t,e,r,n){var o,i,s=[],a=[],u=Math.min(e[r].low,e[n].low),h=Math.max(e[r].lim,e[n].lim);o=r;do{o=t.parent(o),s.push(o)}while(o&&(e[o].low>u||h>e[o].lim));for(i=o,o=n;(o=t.parent(o))!==i;)a.push(o);return{path:s.concat(a.reverse()),lca:i}}(t,e,o.v,o.w),s=i.path,a=i.lca,u=0,h=s[u],d=!0;r!==o.w;){if(n=t.node(r),d){for(;(h=s[u])!==a&&t.node(h).maxRank<n.rank;)u++;h===a&&(d=!1)}if(!d){for(;u<s.length-1&&t.node(h=s[u+1]).minRank<=n.rank;)u++;h=s[u]}t.setParent(r,h),r=t.successors(r)[0]}}))}},2738:(t,e,r)=>{"use strict";var n=r(5076),o=r(3374).Graph,i=r(6573);function s(t,e){var r={};return n.reduce(e,(function(e,o){var i=0,s=0,a=e.length,h=n.last(o);return n.forEach(o,(function(e,d){var c=function(t,e){if(t.node(e).dummy)return n.find(t.predecessors(e),(function(e){return t.node(e).dummy}))}(t,e),l=c?t.node(c).order:a;(c||e===h)&&(n.forEach(o.slice(s,d+1),(function(e){n.forEach(t.predecessors(e),(function(n){var o=t.node(n),s=o.order;!(s<i||l<s)||o.dummy&&t.node(e).dummy||u(r,n,e)}))})),s=d+1,i=l)})),o})),r}function a(t,e){var r={};function o(e,o,i,s,a){var h;n.forEach(n.range(o,i),(function(o){h=e[o],t.node(h).dummy&&n.forEach(t.predecessors(h),(function(e){var n=t.node(e);n.dummy&&(n.order<s||n.order>a)&&u(r,e,h)}))}))}return n.reduce(e,(function(e,r){var i,s=-1,a=0;return n.forEach(r,(function(n,u){if("border"===t.node(n).dummy){var h=t.predecessors(n);h.length&&(i=t.node(h[0]).order,o(r,a,u,s,i),a=u,s=i)}o(r,a,r.length,i,e.length)})),r})),r}function u(t,e,r){if(e>r){var n=e;e=r,r=n}var o=t[e];o||(t[e]=o={}),o[r]=!0}function h(t,e,r){if(e>r){var o=e;e=r,r=o}return n.has(t[e],r)}function d(t,e,r,o){var i={},s={},a={};return n.forEach(e,(function(t){n.forEach(t,(function(t,e){i[t]=t,s[t]=t,a[t]=e}))})),n.forEach(e,(function(t){var e=-1;n.forEach(t,(function(t){var u=o(t);if(u.length){u=n.sortBy(u,(function(t){return a[t]}));for(var d=(u.length-1)/2,c=Math.floor(d),l=Math.ceil(d);c<=l;++c){var f=u[c];s[t]===t&&e<a[f]&&!h(r,t,f)&&(s[f]=t,s[t]=i[t]=i[f],e=a[f])}}}))})),{root:i,align:s}}function c(t,e,r,i,s){var a={},u=function(t,e,r,i){var s=new o,a=t.graph(),u=function(t,e,r){return function(o,i,s){var a,u=o.node(i),h=o.node(s),d=0;if(d+=u.width/2,n.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(d+=r?a:-a),a=0,d+=(u.dummy?e:t)/2,d+=(h.dummy?e:t)/2,d+=h.width/2,n.has(h,"labelpos"))switch(h.labelpos.toLowerCase()){case"l":a=h.width/2;break;case"r":a=-h.width/2}return a&&(d+=r?a:-a),a=0,d}}(a.nodesep,a.edgesep,i);return n.forEach(e,(function(e){var o;n.forEach(e,(function(e){var n=r[e];if(s.setNode(n),o){var i=r[o],a=s.edge(i,n);s.setEdge(i,n,Math.max(u(t,e,o),a||0))}o=e}))})),s}(t,e,r,s),h=s?"borderLeft":"borderRight";function d(t,e){for(var r=u.nodes(),n=r.pop(),o={};n;)o[n]?t(n):(o[n]=!0,r.push(n),r=r.concat(e(n))),n=r.pop()}return d((function(t){a[t]=u.inEdges(t).reduce((function(t,e){return Math.max(t,a[e.v]+u.edge(e))}),0)}),u.predecessors.bind(u)),d((function(e){var r=u.outEdges(e).reduce((function(t,e){return Math.min(t,a[e.w]-u.edge(e))}),Number.POSITIVE_INFINITY),n=t.node(e);r!==Number.POSITIVE_INFINITY&&n.borderType!==h&&(a[e]=Math.max(a[e],r))}),u.successors.bind(u)),n.forEach(i,(function(t){a[t]=a[r[t]]})),a}function l(t,e){return n.minBy(n.values(e),(function(e){var r=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return n.forIn(e,(function(e,n){var i=function(t,e){return t.node(e).width}(t,n)/2;r=Math.max(e+i,r),o=Math.min(e-i,o)})),r-o}))}function f(t,e){var r=n.values(e),o=n.min(r),i=n.max(r);n.forEach(["u","d"],(function(r){n.forEach(["l","r"],(function(s){var a,u=r+s,h=t[u];if(h!==e){var d=n.values(h);(a="l"===s?o-n.min(d):i-n.max(d))&&(t[u]=n.mapValues(h,(function(t){return t+a})))}}))}))}function g(t,e){return n.mapValues(t.ul,(function(r,o){if(e)return t[e.toLowerCase()][o];var i=n.sortBy(n.map(t,o));return(i[1]+i[2])/2}))}t.exports={positionX:function(t){var e,r=i.buildLayerMatrix(t),o=n.merge(s(t,r),a(t,r)),u={};n.forEach(["u","d"],(function(i){e="u"===i?r:n.values(r).reverse(),n.forEach(["l","r"],(function(r){"r"===r&&(e=n.map(e,(function(t){return n.values(t).reverse()})));var s=("u"===i?t.predecessors:t.successors).bind(t),a=d(0,e,o,s),h=c(t,e,a.root,a.align,"r"===r);"r"===r&&(h=n.mapValues(h,(function(t){return-t}))),u[i+r]=h}))}));var h=l(t,u);return f(u,h),g(u,t.graph().align)},findType1Conflicts:s,findType2Conflicts:a,addConflict:u,hasConflict:h,verticalAlignment:d,horizontalCompaction:c,alignCoordinates:f,findSmallestWidthAlignment:l,balance:g}},9497:(t,e,r)=>{"use strict";var n=r(5076),o=r(6573),i=r(2738).positionX;t.exports=function(t){(function(t){var e=o.buildLayerMatrix(t),r=t.graph().ranksep,i=0;n.forEach(e,(function(e){var o=n.max(n.map(e,(function(e){return t.node(e).height})));n.forEach(e,(function(e){t.node(e).y=i+o/2})),i+=o+r}))})(t=o.asNonCompoundGraph(t)),n.forEach(i(t),(function(e,r){t.node(r).x=e}))}},9996:(t,e,r)=>{"use strict";var n=r(5076),o=r(3374).Graph,i=r(8666).slack;function s(t,e){return n.forEach(t.nodes(),(function r(o){n.forEach(e.nodeEdges(o),(function(n){var s=n.v,a=o===s?n.w:s;t.hasNode(a)||i(e,n)||(t.setNode(a,{}),t.setEdge(o,a,{}),r(a))}))})),t.nodeCount()}function a(t,e){return n.minBy(e.edges(),(function(r){if(t.hasNode(r.v)!==t.hasNode(r.w))return i(e,r)}))}function u(t,e,r){n.forEach(t.nodes(),(function(t){e.node(t).rank+=r}))}t.exports=function(t){var e,r,n=new o({directed:!1}),h=t.nodes()[0],d=t.nodeCount();for(n.setNode(h,{});s(n,t)<d;)e=a(n,t),r=n.hasNode(e.v)?i(t,e):-i(t,e),u(n,t,r);return n}},9472:(t,e,r)=>{"use strict";var n=r(8666).longestPath,o=r(9996),i=r(4502);t.exports=function(t){switch(t.graph().ranker){case"network-simplex":default:!function(t){i(t)}(t);break;case"tight-tree":!function(t){n(t),o(t)}(t);break;case"longest-path":s(t)}};var s=n},4502:(t,e,r)=>{"use strict";var n=r(5076),o=r(9996),i=r(8666).slack,s=r(8666).longestPath,a=r(3374).alg.preorder,u=r(3374).alg.postorder,h=r(6573).simplify;function d(t){t=h(t),s(t);var e,r=o(t);for(f(r),c(r,t);e=p(r);)m(r,t,e,v(r,t,e))}function c(t,e){var r=u(t,t.nodes());r=r.slice(0,r.length-1),n.forEach(r,(function(r){!function(t,e,r){var n=t.node(r).parent;t.edge(r,n).cutvalue=l(t,e,r)}(t,e,r)}))}function l(t,e,r){var o=t.node(r).parent,i=!0,s=e.edge(r,o),a=0;return s||(i=!1,s=e.edge(o,r)),a=s.weight,n.forEach(e.nodeEdges(r),(function(n){var s,u,h=n.v===r,d=h?n.w:n.v;if(d!==o){var c=h===i,l=e.edge(n).weight;if(a+=c?l:-l,s=r,u=d,t.hasEdge(s,u)){var f=t.edge(r,d).cutvalue;a+=c?-f:f}}})),a}function f(t,e){arguments.length<2&&(e=t.nodes()[0]),g(t,{},1,e)}function g(t,e,r,o,i){var s=r,a=t.node(o);return e[o]=!0,n.forEach(t.neighbors(o),(function(i){n.has(e,i)||(r=g(t,e,r,i,o))})),a.low=s,a.lim=r++,i?a.parent=i:delete a.parent,r}function p(t){return n.find(t.edges(),(function(e){return t.edge(e).cutvalue<0}))}function v(t,e,r){var o=r.v,s=r.w;e.hasEdge(o,s)||(o=r.w,s=r.v);var a=t.node(o),u=t.node(s),h=a,d=!1;a.lim>u.lim&&(h=u,d=!0);var c=n.filter(e.edges(),(function(e){return d===y(0,t.node(e.v),h)&&d!==y(0,t.node(e.w),h)}));return n.minBy(c,(function(t){return i(e,t)}))}function m(t,e,r,o){var i=r.v,s=r.w;t.removeEdge(i,s),t.setEdge(o.v,o.w,{}),f(t),c(t,e),function(t,e){var r=n.find(t.nodes(),(function(t){return!e.node(t).parent})),o=a(t,r);o=o.slice(1),n.forEach(o,(function(r){var n=t.node(r).parent,o=e.edge(r,n),i=!1;o||(o=e.edge(n,r),i=!0),e.node(r).rank=e.node(n).rank+(i?o.minlen:-o.minlen)}))}(t,e)}function y(t,e,r){return r.low<=e.lim&&e.lim<=r.lim}t.exports=d,d.initLowLimValues=f,d.initCutValues=c,d.calcCutValue=l,d.leaveEdge=p,d.enterEdge=v,d.exchangeEdges=m},8666:(t,e,r)=>{"use strict";var n=r(5076);t.exports={longestPath:function(t){var e={};n.forEach(t.sources(),(function r(o){var i=t.node(o);if(n.has(e,o))return i.rank;e[o]=!0;var s=n.min(n.map(t.outEdges(o),(function(e){return r(e.w)-t.edge(e).minlen})));return s!==Number.POSITIVE_INFINITY&&null!=s||(s=0),i.rank=s}))},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}}},6573:(t,e,r)=>{"use strict";var n=r(5076),o=r(3374).Graph;function i(t,e,r,o){var i;do{i=n.uniqueId(o)}while(t.hasNode(i));return r.dummy=e,t.setNode(i,r),i}function s(t){return n.max(n.map(t.nodes(),(function(e){var r=t.node(e).rank;if(!n.isUndefined(r))return r})))}t.exports={addDummyNode:i,simplify:function(t){var e=(new o).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){var n=e.edge(r.v,r.w)||{weight:0,minlen:1},o=t.edge(r);e.setEdge(r.v,r.w,{weight:n.weight+o.weight,minlen:Math.max(n.minlen,o.minlen)})})),e},asNonCompoundGraph:function(t){var e=new o({multigraph:t.isMultigraph()}).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){t.children(r).length||e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){e.setEdge(r,t.edge(r))})),e},successorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.outEdges(e),(function(e){r[e.w]=(r[e.w]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.inEdges(e),(function(e){r[e.v]=(r[e.v]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},intersectRect:function(t,e){var r,n,o=t.x,i=t.y,s=e.x-o,a=e.y-i,u=t.width/2,h=t.height/2;if(!s&&!a)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(a)*u>Math.abs(s)*h?(a<0&&(h=-h),r=h*s/a,n=h):(s<0&&(u=-u),r=u,n=u*a/s),{x:o+r,y:i+n}},buildLayerMatrix:function(t){var e=n.map(n.range(s(t)+1),(function(){return[]}));return n.forEach(t.nodes(),(function(r){var o=t.node(r),i=o.rank;n.isUndefined(i)||(e[i][o.order]=r)})),e},normalizeRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank})));n.forEach(t.nodes(),(function(r){var o=t.node(r);n.has(o,"rank")&&(o.rank-=e)}))},removeEmptyRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank}))),r=[];n.forEach(t.nodes(),(function(n){var o=t.node(n).rank-e;r[o]||(r[o]=[]),r[o].push(n)}));var o=0,i=t.graph().nodeRankFactor;n.forEach(r,(function(e,r){n.isUndefined(e)&&r%i!=0?--o:o&&n.forEach(e,(function(e){t.node(e).rank+=o}))}))},addBorderNode:function(t,e,r,n){var o={width:0,height:0};return arguments.length>=4&&(o.rank=r,o.order=n),i(t,"border",o,e)},maxRank:s,partition:function(t,e){var r={lhs:[],rhs:[]};return n.forEach(t,(function(t){e(t)?r.lhs.push(t):r.rhs.push(t)})),r},time:function(t,e){var r=n.now();try{return e()}finally{console.log(t+" time: "+(n.now()-r)+"ms")}},notime:function(t,e){return e()}}},6661:t=>{t.exports="0.8.5"},7423:(t,e,r)=>{var n=r(783);t.exports={Graph:n.Graph,json:r(2350),alg:r(2638),version:n.version}},3536:(t,e,r)=>{var n=r(782);t.exports=function(t){var e,r={},o=[];function i(o){n.has(r,o)||(r[o]=!0,e.push(o),n.each(t.successors(o),i),n.each(t.predecessors(o),i))}return n.each(t.nodes(),(function(t){e=[],i(t),e.length&&o.push(e)})),o}},4933:(t,e,r)=>{var n=r(782);function o(t,e,r,i,s,a){n.has(i,e)||(i[e]=!0,r||a.push(e),n.each(s(e),(function(e){o(t,e,r,i,s,a)})),r&&a.push(e))}t.exports=function(t,e,r){n.isArray(e)||(e=[e]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),s=[],a={};return n.each(e,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);o(t,e,"post"===r,a,i,s)})),s}},9032:(t,e,r)=>{var n=r(4102),o=r(782);t.exports=function(t,e,r){return o.transform(t.nodes(),(function(o,i){o[i]=n(t,i,e,r)}),{})}},4102:(t,e,r)=>{var n=r(782),o=r(2468);t.exports=function(t,e,r,n){return function(t,e,r,n){var i,s,a={},u=new o,h=function(t){var e=t.v!==i?t.v:t.w,n=a[e],o=r(t),h=s.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+o);h<n.distance&&(n.distance=h,n.predecessor=i,u.decrease(e,h))};for(t.nodes().forEach((function(t){var r=t===e?0:Number.POSITIVE_INFINITY;a[t]={distance:r},u.add(t,r)}));u.size()>0&&(i=u.removeMin(),(s=a[i]).distance!==Number.POSITIVE_INFINITY);)n(i).forEach(h);return a}(t,String(e),r||i,n||function(e){return t.outEdges(e)})};var i=n.constant(1)},3983:(t,e,r)=>{var n=r(782),o=r(3952);t.exports=function(t){return n.filter(o(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}},2329:(t,e,r)=>{var n=r(782);t.exports=function(t,e,r){return function(t,e,r){var n={},o=t.nodes();return o.forEach((function(t){n[t]={},n[t][t]={distance:0},o.forEach((function(e){t!==e&&(n[t][e]={distance:Number.POSITIVE_INFINITY})})),r(t).forEach((function(r){var o=r.v===t?r.w:r.v,i=e(r);n[t][o]={distance:i,predecessor:t}}))})),o.forEach((function(t){var e=n[t];o.forEach((function(r){var i=n[r];o.forEach((function(r){var n=i[t],o=e[r],s=i[r],a=n.distance+o.distance;a<s.distance&&(s.distance=a,s.predecessor=o.predecessor)}))}))})),n}(t,e||o,r||function(e){return t.outEdges(e)})};var o=n.constant(1)},2638:(t,e,r)=>{t.exports={components:r(3536),dijkstra:r(4102),dijkstraAll:r(9032),findCycles:r(3983),floydWarshall:r(2329),isAcyclic:r(8345),postorder:r(1600),preorder:r(39),prim:r(6280),tarjan:r(3952),topsort:r(7849)}},8345:(t,e,r)=>{var n=r(7849);t.exports=function(t){try{n(t)}catch(t){if(t instanceof n.CycleException)return!1;throw t}return!0}},1600:(t,e,r)=>{var n=r(4933);t.exports=function(t,e){return n(t,e,"post")}},39:(t,e,r)=>{var n=r(4933);t.exports=function(t,e){return n(t,e,"pre")}},6280:(t,e,r)=>{var n=r(782),o=r(1943),i=r(2468);t.exports=function(t,e){var r,s=new o,a={},u=new i;function h(t){var n=t.v===r?t.w:t.v,o=u.priority(n);if(void 0!==o){var i=e(t);i<o&&(a[n]=r,u.decrease(n,i))}}if(0===t.nodeCount())return s;n.each(t.nodes(),(function(t){u.add(t,Number.POSITIVE_INFINITY),s.setNode(t)})),u.decrease(t.nodes()[0],0);for(var d=!1;u.size()>0;){if(r=u.removeMin(),n.has(a,r))s.setEdge(r,a[r]);else{if(d)throw new Error("Input graph is not connected: "+t);d=!0}t.nodeEdges(r).forEach(h)}return s}},3952:(t,e,r)=>{var n=r(782);t.exports=function(t){var e=0,r=[],o={},i=[];function s(a){var u=o[a]={onStack:!0,lowlink:e,index:e++};if(r.push(a),t.successors(a).forEach((function(t){n.has(o,t)?o[t].onStack&&(u.lowlink=Math.min(u.lowlink,o[t].index)):(s(t),u.lowlink=Math.min(u.lowlink,o[t].lowlink))})),u.lowlink===u.index){var h,d=[];do{h=r.pop(),o[h].onStack=!1,d.push(h)}while(a!==h);i.push(d)}}return t.nodes().forEach((function(t){n.has(o,t)||s(t)})),i}},7849:(t,e,r)=>{var n=r(782);function o(t){var e={},r={},o=[];if(n.each(t.sinks(),(function s(a){if(n.has(r,a))throw new i;n.has(e,a)||(r[a]=!0,e[a]=!0,n.each(t.predecessors(a),s),delete r[a],o.push(a))})),n.size(e)!==t.nodeCount())throw new i;return o}function i(){}t.exports=o,o.CycleException=i,i.prototype=new Error},2468:(t,e,r)=>{var n=r(782);function o(){this._arr=[],this._keyIndices={}}t.exports=o,o.prototype.size=function(){return this._arr.length},o.prototype.keys=function(){return this._arr.map((function(t){return t.key}))},o.prototype.has=function(t){return n.has(this._keyIndices,t)},o.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},o.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},o.prototype.add=function(t,e){var r=this._keyIndices;if(t=String(t),!n.has(r,t)){var o=this._arr,i=o.length;return r[t]=i,o.push({key:t,priority:e}),this._decrease(i),!0}return!1},o.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},o.prototype.decrease=function(t,e){var r=this._keyIndices[t];if(e>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[r].priority+" New: "+e);this._arr[r].priority=e,this._decrease(r)},o.prototype._heapify=function(t){var e=this._arr,r=2*t,n=r+1,o=t;r<e.length&&(o=e[r].priority<e[o].priority?r:o,n<e.length&&(o=e[n].priority<e[o].priority?n:o),o!==t&&(this._swap(t,o),this._heapify(o)))},o.prototype._decrease=function(t){for(var e,r=this._arr,n=r[t].priority;0!==t&&!(r[e=t>>1].priority<n);)this._swap(t,e),t=e},o.prototype._swap=function(t,e){var r=this._arr,n=this._keyIndices,o=r[t],i=r[e];r[t]=i,r[e]=o,n[i.key]=t,n[o.key]=e}},1943:(t,e,r)=>{"use strict";var n=r(782);t.exports=a;var o="\\0",i="\\0",s="";function a(t){this._isDirected=!n.has(t,"directed")||t.directed,this._isMultigraph=!!n.has(t,"multigraph")&&t.multigraph,this._isCompound=!!n.has(t,"compound")&&t.compound,this._label=void 0,this._defaultNodeLabelFn=n.constant(void 0),this._defaultEdgeLabelFn=n.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[i]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function u(t,e){t[e]?t[e]++:t[e]=1}function h(t,e){--t[e]||delete t[e]}function d(t,e,r,i){var a=""+e,u=""+r;if(!t&&a>u){var h=a;a=u,u=h}return a+s+u+s+(n.isUndefined(i)?o:i)}function c(t,e){return d(t,e.v,e.w,e.name)}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(t){return this._label=t,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultNodeLabelFn=t,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return n.keys(this._nodes)},a.prototype.sources=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._in[e])}))},a.prototype.sinks=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._out[e])}))},a.prototype.setNodes=function(t,e){var r=arguments,o=this;return n.each(t,(function(t){r.length>1?o.setNode(t,e):o.setNode(t)})),this},a.prototype.setNode=function(t,e){return n.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=i,this._children[t]={},this._children[i][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},a.prototype.node=function(t){return this._nodes[t]},a.prototype.hasNode=function(t){return n.has(this._nodes,t)},a.prototype.removeNode=function(t){var e=this;if(n.has(this._nodes,t)){var r=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],n.each(this.children(t),(function(t){e.setParent(t)})),delete this._children[t]),n.each(n.keys(this._in[t]),r),delete this._in[t],delete this._preds[t],n.each(n.keys(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},a.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n.isUndefined(e))e=i;else{for(var r=e+="";!n.isUndefined(r);r=this.parent(r))if(r===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},a.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},a.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if(e!==i)return e}},a.prototype.children=function(t){if(n.isUndefined(t)&&(t=i),this._isCompound){var e=this._children[t];if(e)return n.keys(e)}else{if(t===i)return this.nodes();if(this.hasNode(t))return[]}},a.prototype.predecessors=function(t){var e=this._preds[t];if(e)return n.keys(e)},a.prototype.successors=function(t){var e=this._sucs[t];if(e)return n.keys(e)},a.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return n.union(e,this.successors(t))},a.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},a.prototype.filterNodes=function(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var r=this;n.each(this._nodes,(function(r,n){t(n)&&e.setNode(n,r)})),n.each(this._edgeObjs,(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,r.edge(t))}));var o={};function i(t){var n=r.parent(t);return void 0===n||e.hasNode(n)?(o[t]=n,n):n in o?o[n]:i(n)}return this._isCompound&&n.each(e.nodes(),(function(t){e.setParent(t,i(t))})),e},a.prototype.setDefaultEdgeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultEdgeLabelFn=t,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return n.values(this._edgeObjs)},a.prototype.setPath=function(t,e){var r=this,o=arguments;return n.reduce(t,(function(t,n){return o.length>1?r.setEdge(t,n,e):r.setEdge(t,n),n})),this},a.prototype.setEdge=function(){var t,e,r,o,i=!1,s=arguments[0];"object"==typeof s&&null!==s&&"v"in s?(t=s.v,e=s.w,r=s.name,2===arguments.length&&(o=arguments[1],i=!0)):(t=s,e=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],i=!0)),t=""+t,e=""+e,n.isUndefined(r)||(r=""+r);var a=d(this._isDirected,t,e,r);if(n.has(this._edgeLabels,a))return i&&(this._edgeLabels[a]=o),this;if(!n.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[a]=i?o:this._defaultEdgeLabelFn(t,e,r);var h=function(t,e,r,n){var o=""+e,i=""+r;if(!t&&o>i){var s=o;o=i,i=s}var a={v:o,w:i};return n&&(a.name=n),a}(this._isDirected,t,e,r);return t=h.v,e=h.w,Object.freeze(h),this._edgeObjs[a]=h,u(this._preds[e],t),u(this._sucs[t],e),this._in[e][a]=h,this._out[t][a]=h,this._edgeCount++,this},a.prototype.edge=function(t,e,r){var n=1===arguments.length?c(this._isDirected,arguments[0]):d(this._isDirected,t,e,r);return this._edgeLabels[n]},a.prototype.hasEdge=function(t,e,r){var o=1===arguments.length?c(this._isDirected,arguments[0]):d(this._isDirected,t,e,r);return n.has(this._edgeLabels,o)},a.prototype.removeEdge=function(t,e,r){var n=1===arguments.length?c(this._isDirected,arguments[0]):d(this._isDirected,t,e,r),o=this._edgeObjs[n];return o&&(t=o.v,e=o.w,delete this._edgeLabels[n],delete this._edgeObjs[n],h(this._preds[e],t),h(this._sucs[t],e),delete this._in[e][n],delete this._out[t][n],this._edgeCount--),this},a.prototype.inEdges=function(t,e){var r=this._in[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.v===e})):o}},a.prototype.outEdges=function(t,e){var r=this._out[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.w===e})):o}},a.prototype.nodeEdges=function(t,e){var r=this.inEdges(t,e);if(r)return r.concat(this.outEdges(t,e))}},783:(t,e,r)=>{t.exports={Graph:r(1943),version:r(1471)}},2350:(t,e,r)=>{var n=r(782),o=r(1943);function i(t){return n.map(t.nodes(),(function(e){var r=t.node(e),o=t.parent(e),i={v:e};return n.isUndefined(r)||(i.value=r),n.isUndefined(o)||(i.parent=o),i}))}function s(t){return n.map(t.edges(),(function(e){var r=t.edge(e),o={v:e.v,w:e.w};return n.isUndefined(e.name)||(o.name=e.name),n.isUndefined(r)||(o.value=r),o}))}t.exports={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:i(t),edges:s(t)};return n.isUndefined(t.graph())||(e.value=n.clone(t.graph())),e},read:function(t){var e=new o(t.options).setGraph(t.value);return n.each(t.nodes,(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)})),n.each(t.edges,(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),e}}},782:(t,e,r)=>{var n;try{n={clone:r(5402),constant:r(8295),each:r(958),filter:r(9969),has:r(4339),isArray:r(5874),isEmpty:r(2046),isFunction:r(7787),isUndefined:r(2895),keys:r(3511),map:r(9629),reduce:r(9285),size:r(3910),transform:r(3279),union:r(3344),values:r(3005)}}catch(t){}n||(n=window._),t.exports=n},1471:t=>{t.exports="2.1.8"},5229:(t,e,r)=>{"use strict";r.r(e),r.d(e,{isAnyArray:()=>o});const n=Object.prototype.toString;function o(t){const e=n.call(t);return e.endsWith("Array]")&&!e.includes("Big")}},6171:(t,e,r)=>{var n=r(4671)(r(714),"DataView");t.exports=n},6766:(t,e,r)=>{var n=r(2405),o=r(8341),i=r(9644),s=r(3784),a=r(6264);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},1022:(t,e,r)=>{var n=r(6821),o=r(7221),i=r(1596),s=r(1992),a=r(552);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},5870:(t,e,r)=>{var n=r(4671)(r(714),"Map");t.exports=n},8910:(t,e,r)=>{var n=r(4069),o=r(7477),i=r(476),s=r(984),a=r(4136);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},4665:(t,e,r)=>{var n=r(4671)(r(714),"Promise");t.exports=n},9612:(t,e,r)=>{var n=r(4671)(r(714),"Set");t.exports=n},2312:(t,e,r)=>{var n=r(8910),o=r(1945),i=r(4874);function s(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new n;++e<r;)this.add(t[e])}s.prototype.add=s.prototype.push=o,s.prototype.has=i,t.exports=s},7216:(t,e,r)=>{var n=r(1022),o=r(5331),i=r(7063),s=r(134),a=r(9842),u=r(9850);function h(t){var e=this.__data__=new n(t);this.size=e.size}h.prototype.clear=o,h.prototype.delete=i,h.prototype.get=s,h.prototype.has=a,h.prototype.set=u,t.exports=h},9006:(t,e,r)=>{var n=r(714).Symbol;t.exports=n},8851:(t,e,r)=>{var n=r(714).Uint8Array;t.exports=n},8154:(t,e,r)=>{var n=r(4671)(r(714),"WeakMap");t.exports=n},7156:t=>{t.exports=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}},7012:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}},2995:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var s=t[r];e(s,r,t)&&(i[o++]=s)}return i}},128:(t,e,r)=>{var n=r(8506);t.exports=function(t,e){return!(null==t||!t.length)&&n(t,e,0)>-1}},6184:t=>{t.exports=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1}},9754:(t,e,r)=>{var n=r(9605),o=r(79),i=r(5874),s=r(3601),a=r(1908),u=r(9046),h=Object.prototype.hasOwnProperty;t.exports=function(t,e){var r=i(t),d=!r&&o(t),c=!r&&!d&&s(t),l=!r&&!d&&!c&&u(t),f=r||d||c||l,g=f?n(t.length,String):[],p=g.length;for(var v in t)!e&&!h.call(t,v)||f&&("length"==v||c&&("offset"==v||"parent"==v)||l&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||a(v,p))||g.push(v);return g}},2275:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}},2525:t=>{t.exports=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}},8663:t=>{t.exports=function(t,e,r,n){var o=-1,i=null==t?0:t.length;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}},3525:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}},446:(t,e,r)=>{var n=r(8494)("length");t.exports=n},2430:(t,e,r)=>{var n=r(3077),o=r(5097);t.exports=function(t,e,r){(void 0!==r&&!o(t[e],r)||void 0===r&&!(e in t))&&n(t,e,r)}},5802:(t,e,r)=>{var n=r(3077),o=r(5097),i=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){var s=t[e];i.call(t,e)&&o(s,r)&&(void 0!==r||e in t)||n(t,e,r)}},9438:(t,e,r)=>{var n=r(5097);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},6902:(t,e,r)=>{var n=r(5532),o=r(3511);t.exports=function(t,e){return t&&n(e,o(e),t)}},5873:(t,e,r)=>{var n=r(5532),o=r(2844);t.exports=function(t,e){return t&&n(e,o(e),t)}},3077:(t,e,r)=>{var n=r(4856);t.exports=function(t,e,r){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}},9018:(t,e,r)=>{var n=r(7216),o=r(7012),i=r(5802),s=r(6902),a=r(5873),u=r(6743),h=r(310),d=r(5590),c=r(2209),l=r(2573),f=r(3918),g=r(9778),p=r(5290),v=r(4028),m=r(9168),y=r(5874),w=r(3601),x=r(4725),b=r(9400),E=r(7363),N=r(3511),M=r(2844),_="[object Arguments]",k="[object Function]",A="[object Object]",j={};j[_]=j["[object Array]"]=j["[object ArrayBuffer]"]=j["[object DataView]"]=j["[object Boolean]"]=j["[object Date]"]=j["[object Float32Array]"]=j["[object Float64Array]"]=j["[object Int8Array]"]=j["[object Int16Array]"]=j["[object Int32Array]"]=j["[object Map]"]=j["[object Number]"]=j[A]=j["[object RegExp]"]=j["[object Set]"]=j["[object String]"]=j["[object Symbol]"]=j["[object Uint8Array]"]=j["[object Uint8ClampedArray]"]=j["[object Uint16Array]"]=j["[object Uint32Array]"]=!0,j["[object Error]"]=j[k]=j["[object WeakMap]"]=!1,t.exports=function t(e,r,S,O,z,R){var I,C=1&r,D=2&r,P=4&r;if(S&&(I=z?S(e,O,z,R):S(e)),void 0!==I)return I;if(!b(e))return e;var T=y(e);if(T){if(I=p(e),!C)return h(e,I)}else{var L=g(e),F=L==k||"[object GeneratorFunction]"==L;if(w(e))return u(e,C);if(L==A||L==_||F&&!z){if(I=D||F?{}:m(e),!C)return D?c(e,a(I,e)):d(e,s(I,e))}else{if(!j[L])return z?e:{};I=v(e,L,C)}}R||(R=new n);var q=R.get(e);if(q)return q;R.set(e,I),E(e)?e.forEach((function(n){I.add(t(n,r,S,n,e,R))})):x(e)&&e.forEach((function(n,o){I.set(o,t(n,r,S,o,e,R))}));var V=T?void 0:(P?D?f:l:D?M:N)(e);return o(V||e,(function(n,o){V&&(n=e[o=n]),i(I,o,t(n,r,S,o,e,R))})),I}},1095:(t,e,r)=>{var n=r(9400),o=Object.create,i=function(){function t(){}return function(e){if(!n(e))return{};if(o)return o(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();t.exports=i},830:(t,e,r)=>{var n=r(7702),o=r(8678)(n);t.exports=o},5816:(t,e,r)=>{var n=r(975);t.exports=function(t,e,r){for(var o=-1,i=t.length;++o<i;){var s=t[o],a=e(s);if(null!=a&&(void 0===u?a==a&&!n(a):r(a,u)))var u=a,h=s}return h}},1329:(t,e,r)=>{var n=r(830);t.exports=function(t,e){var r=[];return n(t,(function(t,n,o){e(t,n,o)&&r.push(t)})),r}},166:t=>{t.exports=function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1}},9821:(t,e,r)=>{var n=r(2525),o=r(3542);t.exports=function t(e,r,i,s,a){var u=-1,h=e.length;for(i||(i=o),a||(a=[]);++u<h;){var d=e[u];r>0&&i(d)?r>1?t(d,r-1,i,s,a):n(a,d):s||(a[a.length]=d)}return a}},9128:(t,e,r)=>{var n=r(3600)();t.exports=n},7702:(t,e,r)=>{var n=r(9128),o=r(3511);t.exports=function(t,e){return t&&n(t,e,o)}},1855:(t,e,r)=>{var n=r(330),o=r(9628);t.exports=function(t,e){for(var r=0,i=(e=n(e,t)).length;null!=t&&r<i;)t=t[o(e[r++])];return r&&r==i?t:void 0}},5920:(t,e,r)=>{var n=r(2525),o=r(5874);t.exports=function(t,e,r){var i=e(t);return o(t)?i:n(i,r(t))}},5271:(t,e,r)=>{var n=r(9006),o=r(9650),i=r(6881),s=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":s&&s in Object(t)?o(t):i(t)}},4116:t=>{t.exports=function(t,e){return t>e}},3091:t=>{var e=Object.prototype.hasOwnProperty;t.exports=function(t,r){return null!=t&&e.call(t,r)}},5088:t=>{t.exports=function(t,e){return null!=t&&e in Object(t)}},8506:(t,e,r)=>{var n=r(166),o=r(8306),i=r(638);t.exports=function(t,e,r){return e==e?i(t,e,r):n(t,o,r)}},4047:(t,e,r)=>{var n=r(5271),o=r(7583);t.exports=function(t){return o(t)&&"[object Arguments]"==n(t)}},3899:(t,e,r)=>{var n=r(8309),o=r(7583);t.exports=function t(e,r,i,s,a){return e===r||(null==e||null==r||!o(e)&&!o(r)?e!=e&&r!=r:n(e,r,i,s,t,a))}},8309:(t,e,r)=>{var n=r(7216),o=r(3522),i=r(9481),s=r(8370),a=r(9778),u=r(5874),h=r(3601),d=r(9046),c="[object Arguments]",l="[object Array]",f="[object Object]",g=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,p,v,m){var y=u(t),w=u(e),x=y?l:a(t),b=w?l:a(e),E=(x=x==c?f:x)==f,N=(b=b==c?f:b)==f,M=x==b;if(M&&h(t)){if(!h(e))return!1;y=!0,E=!1}if(M&&!E)return m||(m=new n),y||d(t)?o(t,e,r,p,v,m):i(t,e,x,r,p,v,m);if(!(1&r)){var _=E&&g.call(t,"__wrapped__"),k=N&&g.call(e,"__wrapped__");if(_||k){var A=_?t.value():t,j=k?e.value():e;return m||(m=new n),v(A,j,r,p,m)}}return!!M&&(m||(m=new n),s(t,e,r,p,v,m))}},4965:(t,e,r)=>{var n=r(9778),o=r(7583);t.exports=function(t){return o(t)&&"[object Map]"==n(t)}},4014:(t,e,r)=>{var n=r(7216),o=r(3899);t.exports=function(t,e,r,i){var s=r.length,a=s,u=!i;if(null==t)return!a;for(t=Object(t);s--;){var h=r[s];if(u&&h[2]?h[1]!==t[h[0]]:!(h[0]in t))return!1}for(;++s<a;){var d=(h=r[s])[0],c=t[d],l=h[1];if(u&&h[2]){if(void 0===c&&!(d in t))return!1}else{var f=new n;if(i)var g=i(c,l,d,t,e,f);if(!(void 0===g?o(l,c,3,i,f):g))return!1}}return!0}},8306:t=>{t.exports=function(t){return t!=t}},4228:(t,e,r)=>{var n=r(7787),o=r(7827),i=r(9400),s=r(462),a=/^\\[object .+?Constructor\\]$/,u=Function.prototype,h=Object.prototype,d=u.toString,c=h.hasOwnProperty,l=RegExp("^"+d.call(c).replace(/[\\\\^$.*+?()[\\]{}|]/g,"\\\\$&").replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!i(t)||o(t))&&(n(t)?l:a).test(s(t))}},6499:(t,e,r)=>{var n=r(9778),o=r(7583);t.exports=function(t){return o(t)&&"[object Set]"==n(t)}},550:(t,e,r)=>{var n=r(5271),o=r(4583),i=r(7583),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,t.exports=function(t){return i(t)&&o(t.length)&&!!s[n(t)]}},4506:(t,e,r)=>{var n=r(6330),o=r(2363),i=r(9169),s=r(5874),a=r(6830);t.exports=function(t){return"function"==typeof t?t:null==t?i:"object"==typeof t?s(t)?o(t[0],t[1]):n(t):a(t)}},5351:(t,e,r)=>{var n=r(7894),o=r(2325),i=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return o(t);var e=[];for(var r in Object(t))i.call(t,r)&&"constructor"!=r&&e.push(r);return e}},1500:(t,e,r)=>{var n=r(9400),o=r(7894),i=r(5382),s=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return i(t);var e=o(t),r=[];for(var a in t)("constructor"!=a||!e&&s.call(t,a))&&r.push(a);return r}},2795:t=>{t.exports=function(t,e){return t<e}},4733:(t,e,r)=>{var n=r(830),o=r(3069);t.exports=function(t,e){var r=-1,i=o(t)?Array(t.length):[];return n(t,(function(t,n,o){i[++r]=e(t,n,o)})),i}},6330:(t,e,r)=>{var n=r(4014),o=r(6539),i=r(7316);t.exports=function(t){var e=o(t);return 1==e.length&&e[0][2]?i(e[0][0],e[0][1]):function(r){return r===t||n(r,t,e)}}},2363:(t,e,r)=>{var n=r(3899),o=r(5887),i=r(4016),s=r(759),a=r(7223),u=r(7316),h=r(9628);t.exports=function(t,e){return s(t)&&a(e)?u(h(t),e):function(r){var s=o(r,t);return void 0===s&&s===e?i(r,t):n(e,s,3)}}},4479:(t,e,r)=>{var n=r(7216),o=r(2430),i=r(9128),s=r(3857),a=r(9400),u=r(2844),h=r(6127);t.exports=function t(e,r,d,c,l){e!==r&&i(r,(function(i,u){if(l||(l=new n),a(i))s(e,r,u,d,t,c,l);else{var f=c?c(h(e,u),i,u+"",e,r,l):void 0;void 0===f&&(f=i),o(e,u,f)}}),u)}},3857:(t,e,r)=>{var n=r(2430),o=r(6743),i=r(1532),s=r(310),a=r(9168),u=r(79),h=r(5874),d=r(6882),c=r(3601),l=r(7787),f=r(9400),g=r(4108),p=r(9046),v=r(6127),m=r(339);t.exports=function(t,e,r,y,w,x,b){var E=v(t,r),N=v(e,r),M=b.get(N);if(M)n(t,r,M);else{var _=x?x(E,N,r+"",t,e,b):void 0,k=void 0===_;if(k){var A=h(N),j=!A&&c(N),S=!A&&!j&&p(N);_=N,A||j||S?h(E)?_=E:d(E)?_=s(E):j?(k=!1,_=o(N,!0)):S?(k=!1,_=i(N,!0)):_=[]:g(N)||u(N)?(_=E,u(E)?_=m(E):f(E)&&!l(E)||(_=a(N))):k=!1}k&&(b.set(N,_),w(_,N,y,x,b),b.delete(N)),n(t,r,_)}}},9586:(t,e,r)=>{var n=r(2275),o=r(1855),i=r(4506),s=r(4733),a=r(7070),u=r(8232),h=r(6395),d=r(9169),c=r(5874);t.exports=function(t,e,r){e=e.length?n(e,(function(t){return c(t)?function(e){return o(e,1===t.length?t[0]:t)}:t})):[d];var l=-1;e=n(e,u(i));var f=s(t,(function(t,r,o){return{criteria:n(e,(function(e){return e(t)})),index:++l,value:t}}));return a(f,(function(t,e){return h(t,e,r)}))}},4286:(t,e,r)=>{var n=r(8499),o=r(4016);t.exports=function(t,e){return n(t,e,(function(e,r){return o(t,r)}))}},8499:(t,e,r)=>{var n=r(1855),o=r(9435),i=r(330);t.exports=function(t,e,r){for(var s=-1,a=e.length,u={};++s<a;){var h=e[s],d=n(t,h);r(d,h)&&o(u,i(h,t),d)}return u}},8494:t=>{t.exports=function(t){return function(e){return null==e?void 0:e[t]}}},3644:(t,e,r)=>{var n=r(1855);t.exports=function(t){return function(e){return n(e,t)}}},8514:t=>{var e=Math.ceil,r=Math.max;t.exports=function(t,n,o,i){for(var s=-1,a=r(e((n-t)/(o||1)),0),u=Array(a);a--;)u[i?a:++s]=t,t+=o;return u}},8421:t=>{t.exports=function(t,e,r,n,o){return o(t,(function(t,o,i){r=n?(n=!1,t):e(r,t,o,i)})),r}},6965:(t,e,r)=>{var n=r(9169),o=r(5390),i=r(3232);t.exports=function(t,e){return i(o(t,e,n),t+"")}},9435:(t,e,r)=>{var n=r(5802),o=r(330),i=r(1908),s=r(9400),a=r(9628);t.exports=function(t,e,r,u){if(!s(t))return t;for(var h=-1,d=(e=o(e,t)).length,c=d-1,l=t;null!=l&&++h<d;){var f=a(e[h]),g=r;if("__proto__"===f||"constructor"===f||"prototype"===f)return t;if(h!=c){var p=l[f];void 0===(g=u?u(p,f,l):void 0)&&(g=s(p)?p:i(e[h+1])?[]:{})}n(l,f,g),l=l[f]}return t}},3431:(t,e,r)=>{var n=r(8295),o=r(4856),i=r(9169),s=o?function(t,e){return o(t,"toString",{configurable:!0,enumerable:!1,value:n(e),writable:!0})}:i;t.exports=s},7070:t=>{t.exports=function(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}},9605:t=>{t.exports=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}},8071:(t,e,r)=>{var n=r(9006),o=r(2275),i=r(5874),s=r(975),a=n?n.prototype:void 0,u=a?a.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(i(e))return o(e,t)+"";if(s(e))return u?u.call(e):"";var r=e+"";return"0"==r&&1/e==-1/0?"-0":r}},5103:(t,e,r)=>{var n=r(4997),o=/^\\s+/;t.exports=function(t){return t?t.slice(0,n(t)+1).replace(o,""):t}},8232:t=>{t.exports=function(t){return function(e){return t(e)}}},3434:(t,e,r)=>{var n=r(2312),o=r(128),i=r(6184),s=r(5420),a=r(2196),u=r(6968);t.exports=function(t,e,r){var h=-1,d=o,c=t.length,l=!0,f=[],g=f;if(r)l=!1,d=i;else if(c>=200){var p=e?null:a(t);if(p)return u(p);l=!1,d=s,g=new n}else g=e?[]:f;t:for(;++h<c;){var v=t[h],m=e?e(v):v;if(v=r||0!==v?v:0,l&&m==m){for(var y=g.length;y--;)if(g[y]===m)continue t;e&&g.push(m),f.push(v)}else d(g,m,r)||(g!==f&&g.push(m),f.push(v))}return f}},989:(t,e,r)=>{var n=r(2275);t.exports=function(t,e){return n(e,(function(e){return t[e]}))}},2543:t=>{t.exports=function(t,e,r){for(var n=-1,o=t.length,i=e.length,s={};++n<o;){var a=n<i?e[n]:void 0;r(s,t[n],a)}return s}},5420:t=>{t.exports=function(t,e){return t.has(e)}},4041:(t,e,r)=>{var n=r(9169);t.exports=function(t){return"function"==typeof t?t:n}},330:(t,e,r)=>{var n=r(5874),o=r(759),i=r(9505),s=r(983);t.exports=function(t,e){return n(t)?t:o(t,e)?[t]:i(s(t))}},9270:(t,e,r)=>{var n=r(8851);t.exports=function(t){var e=new t.constructor(t.byteLength);return new n(e).set(new n(t)),e}},6743:(t,e,r)=>{t=r.nmd(t);var n=r(714),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o?n.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=a?a(r):new t.constructor(r);return t.copy(n),n}},5940:(t,e,r)=>{var n=r(9270);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}},5320:t=>{var e=/\\w*$/;t.exports=function(t){var r=new t.constructor(t.source,e.exec(t));return r.lastIndex=t.lastIndex,r}},4937:(t,e,r)=>{var n=r(9006),o=n?n.prototype:void 0,i=o?o.valueOf:void 0;t.exports=function(t){return i?Object(i.call(t)):{}}},1532:(t,e,r)=>{var n=r(9270);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}},1141:(t,e,r)=>{var n=r(975);t.exports=function(t,e){if(t!==e){var r=void 0!==t,o=null===t,i=t==t,s=n(t),a=void 0!==e,u=null===e,h=e==e,d=n(e);if(!u&&!d&&!s&&t>e||s&&a&&h&&!u&&!d||o&&a&&h||!r&&h||!i)return 1;if(!o&&!s&&!d&&t<e||d&&r&&i&&!o&&!s||u&&r&&i||!a&&i||!h)return-1}return 0}},6395:(t,e,r)=>{var n=r(1141);t.exports=function(t,e,r){for(var o=-1,i=t.criteria,s=e.criteria,a=i.length,u=r.length;++o<a;){var h=n(i[o],s[o]);if(h)return o>=u?h:h*("desc"==r[o]?-1:1)}return t.index-e.index}},310:t=>{t.exports=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}},5532:(t,e,r)=>{var n=r(5802),o=r(3077);t.exports=function(t,e,r,i){var s=!r;r||(r={});for(var a=-1,u=e.length;++a<u;){var h=e[a],d=i?i(r[h],t[h],h,r,t):void 0;void 0===d&&(d=t[h]),s?o(r,h,d):n(r,h,d)}return r}},5590:(t,e,r)=>{var n=r(5532),o=r(9183);t.exports=function(t,e){return n(t,o(t),e)}},2209:(t,e,r)=>{var n=r(5532),o=r(596);t.exports=function(t,e){return n(t,o(t),e)}},6450:(t,e,r)=>{var n=r(714)["__core-js_shared__"];t.exports=n},1292:(t,e,r)=>{var n=r(6965),o=r(8819);t.exports=function(t){return n((function(e,r){var n=-1,i=r.length,s=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(s=t.length>3&&"function"==typeof s?(i--,s):void 0,a&&o(r[0],r[1],a)&&(s=i<3?void 0:s,i=1),e=Object(e);++n<i;){var u=r[n];u&&t(e,u,n,s)}return e}))}},8678:(t,e,r)=>{var n=r(3069);t.exports=function(t,e){return function(r,o){if(null==r)return r;if(!n(r))return t(r,o);for(var i=r.length,s=e?i:-1,a=Object(r);(e?s--:++s<i)&&!1!==o(a[s],s,a););return r}}},3600:t=>{t.exports=function(t){return function(e,r,n){for(var o=-1,i=Object(e),s=n(e),a=s.length;a--;){var u=s[t?a:++o];if(!1===r(i[u],u,i))break}return e}}},6057:(t,e,r)=>{var n=r(4506),o=r(3069),i=r(3511);t.exports=function(t){return function(e,r,s){var a=Object(e);if(!o(e)){var u=n(r,3);e=i(e),r=function(t){return u(a[t],t,a)}}var h=t(e,r,s);return h>-1?a[u?e[h]:h]:void 0}}},4590:(t,e,r)=>{var n=r(8514),o=r(8819),i=r(8265);t.exports=function(t){return function(e,r,s){return s&&"number"!=typeof s&&o(e,r,s)&&(r=s=void 0),e=i(e),void 0===r?(r=e,e=0):r=i(r),s=void 0===s?e<r?1:-1:i(s),n(e,r,s,t)}}},2196:(t,e,r)=>{var n=r(9612),o=r(3883),i=r(6968),s=n&&1/i(new n([,-0]))[1]==1/0?function(t){return new n(t)}:o;t.exports=s},4856:(t,e,r)=>{var n=r(4671),o=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},3522:(t,e,r)=>{var n=r(2312),o=r(3525),i=r(5420);t.exports=function(t,e,r,s,a,u){var h=1&r,d=t.length,c=e.length;if(d!=c&&!(h&&c>d))return!1;var l=u.get(t),f=u.get(e);if(l&&f)return l==e&&f==t;var g=-1,p=!0,v=2&r?new n:void 0;for(u.set(t,e),u.set(e,t);++g<d;){var m=t[g],y=e[g];if(s)var w=h?s(y,m,g,e,t,u):s(m,y,g,t,e,u);if(void 0!==w){if(w)continue;p=!1;break}if(v){if(!o(e,(function(t,e){if(!i(v,e)&&(m===t||a(m,t,r,s,u)))return v.push(e)}))){p=!1;break}}else if(m!==y&&!a(m,y,r,s,u)){p=!1;break}}return u.delete(t),u.delete(e),p}},9481:(t,e,r)=>{var n=r(9006),o=r(8851),i=r(5097),s=r(3522),a=r(8866),u=r(6968),h=n?n.prototype:void 0,d=h?h.valueOf:void 0;t.exports=function(t,e,r,n,h,c,l){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!c(new o(t),new o(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var f=a;case"[object Set]":var g=1&n;if(f||(f=u),t.size!=e.size&&!g)return!1;var p=l.get(t);if(p)return p==e;n|=2,l.set(t,e);var v=s(f(t),f(e),n,h,c,l);return l.delete(t),v;case"[object Symbol]":if(d)return d.call(t)==d.call(e)}return!1}},8370:(t,e,r)=>{var n=r(2573),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,i,s,a){var u=1&r,h=n(t),d=h.length;if(d!=n(e).length&&!u)return!1;for(var c=d;c--;){var l=h[c];if(!(u?l in e:o.call(e,l)))return!1}var f=a.get(t),g=a.get(e);if(f&&g)return f==e&&g==t;var p=!0;a.set(t,e),a.set(e,t);for(var v=u;++c<d;){var m=t[l=h[c]],y=e[l];if(i)var w=u?i(y,m,l,e,t,a):i(m,y,l,t,e,a);if(!(void 0===w?m===y||s(m,y,r,i,a):w)){p=!1;break}v||(v="constructor"==l)}if(p&&!v){var x=t.constructor,b=e.constructor;x==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof x&&x instanceof x&&"function"==typeof b&&b instanceof b||(p=!1)}return a.delete(t),a.delete(e),p}},4139:(t,e,r)=>{var n=r(7469),o=r(5390),i=r(3232);t.exports=function(t){return i(o(t,void 0,n),t+"")}},1603:(t,e,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;t.exports=n},2573:(t,e,r)=>{var n=r(5920),o=r(9183),i=r(3511);t.exports=function(t){return n(t,i,o)}},3918:(t,e,r)=>{var n=r(5920),o=r(596),i=r(2844);t.exports=function(t){return n(t,i,o)}},1200:(t,e,r)=>{var n=r(95);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},6539:(t,e,r)=>{var n=r(7223),o=r(3511);t.exports=function(t){for(var e=o(t),r=e.length;r--;){var i=e[r],s=t[i];e[r]=[i,s,n(s)]}return e}},4671:(t,e,r)=>{var n=r(4228),o=r(7559);t.exports=function(t,e){var r=o(t,e);return n(r)?r:void 0}},7556:(t,e,r)=>{var n=r(8546)(Object.getPrototypeOf,Object);t.exports=n},9650:(t,e,r)=>{var n=r(9006),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,a=n?n.toStringTag:void 0;t.exports=function(t){var e=i.call(t,a),r=t[a];try{t[a]=void 0;var n=!0}catch(t){}var o=s.call(t);return n&&(e?t[a]=r:delete t[a]),o}},9183:(t,e,r)=>{var n=r(2995),o=r(2982),i=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,a=s?function(t){return null==t?[]:(t=Object(t),n(s(t),(function(e){return i.call(t,e)})))}:o;t.exports=a},596:(t,e,r)=>{var n=r(2525),o=r(7556),i=r(9183),s=r(2982),a=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)n(e,i(t)),t=o(t);return e}:s;t.exports=a},9778:(t,e,r)=>{var n=r(6171),o=r(5870),i=r(4665),s=r(9612),a=r(8154),u=r(5271),h=r(462),d="[object Map]",c="[object Promise]",l="[object Set]",f="[object WeakMap]",g="[object DataView]",p=h(n),v=h(o),m=h(i),y=h(s),w=h(a),x=u;(n&&x(new n(new ArrayBuffer(1)))!=g||o&&x(new o)!=d||i&&x(i.resolve())!=c||s&&x(new s)!=l||a&&x(new a)!=f)&&(x=function(t){var e=u(t),r="[object Object]"==e?t.constructor:void 0,n=r?h(r):"";if(n)switch(n){case p:return g;case v:return d;case m:return c;case y:return l;case w:return f}return e}),t.exports=x},7559:t=>{t.exports=function(t,e){return null==t?void 0:t[e]}},9663:(t,e,r)=>{var n=r(330),o=r(79),i=r(5874),s=r(1908),a=r(4583),u=r(9628);t.exports=function(t,e,r){for(var h=-1,d=(e=n(e,t)).length,c=!1;++h<d;){var l=u(e[h]);if(!(c=null!=t&&r(t,l)))break;t=t[l]}return c||++h!=d?c:!!(d=null==t?0:t.length)&&a(d)&&s(l,d)&&(i(t)||o(t))}},3493:t=>{var e=RegExp("[\\\\u200d\\\\ud800-\\\\udfff\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe2f\\\\u20d0-\\\\u20ff\\\\ufe0e\\\\ufe0f]");t.exports=function(t){return e.test(t)}},2405:(t,e,r)=>{var n=r(8637);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},8341:t=>{t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},9644:(t,e,r)=>{var n=r(8637),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return o.call(e,t)?e[t]:void 0}},3784:(t,e,r)=>{var n=r(8637),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:o.call(e,t)}},6264:(t,e,r)=>{var n=r(8637);t.exports=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},5290:t=>{var e=Object.prototype.hasOwnProperty;t.exports=function(t){var r=t.length,n=new t.constructor(r);return r&&"string"==typeof t[0]&&e.call(t,"index")&&(n.index=t.index,n.input=t.input),n}},4028:(t,e,r)=>{var n=r(9270),o=r(5940),i=r(5320),s=r(4937),a=r(1532);t.exports=function(t,e,r){var u=t.constructor;switch(e){case"[object ArrayBuffer]":return n(t);case"[object Boolean]":case"[object Date]":return new u(+t);case"[object DataView]":return o(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return a(t,r);case"[object Map]":case"[object Set]":return new u;case"[object Number]":case"[object String]":return new u(t);case"[object RegExp]":return i(t);case"[object Symbol]":return s(t)}}},9168:(t,e,r)=>{var n=r(1095),o=r(7556),i=r(7894);t.exports=function(t){return"function"!=typeof t.constructor||i(t)?{}:n(o(t))}},3542:(t,e,r)=>{var n=r(9006),o=r(79),i=r(5874),s=n?n.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(s&&t&&t[s])}},1908:t=>{var e=/^(?:0|[1-9]\\d*)$/;t.exports=function(t,r){var n=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<r}},8819:(t,e,r)=>{var n=r(5097),o=r(3069),i=r(1908),s=r(9400);t.exports=function(t,e,r){if(!s(r))return!1;var a=typeof e;return!!("number"==a?o(r)&&i(e,r.length):"string"==a&&e in r)&&n(r[e],t)}},759:(t,e,r)=>{var n=r(5874),o=r(975),i=/\\.|\\[(?:[^[\\]]*|(["\'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,s=/^\\w*$/;t.exports=function(t,e){if(n(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!o(t))||s.test(t)||!i.test(t)||null!=e&&t in Object(e)}},95:t=>{t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},7827:(t,e,r)=>{var n,o=r(6450),i=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!i&&i in t}},7894:t=>{var e=Object.prototype;t.exports=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}},7223:(t,e,r)=>{var n=r(9400);t.exports=function(t){return t==t&&!n(t)}},6821:t=>{t.exports=function(){this.__data__=[],this.size=0}},7221:(t,e,r)=>{var n=r(9438),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,r=n(e,t);return!(r<0||(r==e.length-1?e.pop():o.call(e,r,1),--this.size,0))}},1596:(t,e,r)=>{var n=r(9438);t.exports=function(t){var e=this.__data__,r=n(e,t);return r<0?void 0:e[r][1]}},1992:(t,e,r)=>{var n=r(9438);t.exports=function(t){return n(this.__data__,t)>-1}},552:(t,e,r)=>{var n=r(9438);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}},4069:(t,e,r)=>{var n=r(6766),o=r(1022),i=r(5870);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},7477:(t,e,r)=>{var n=r(1200);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},476:(t,e,r)=>{var n=r(1200);t.exports=function(t){return n(this,t).get(t)}},984:(t,e,r)=>{var n=r(1200);t.exports=function(t){return n(this,t).has(t)}},4136:(t,e,r)=>{var n=r(1200);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},8866:t=>{t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}},7316:t=>{t.exports=function(t,e){return function(r){return null!=r&&r[t]===e&&(void 0!==e||t in Object(r))}}},2121:(t,e,r)=>{var n=r(8487);t.exports=function(t){var e=n(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}},8637:(t,e,r)=>{var n=r(4671)(Object,"create");t.exports=n},2325:(t,e,r)=>{var n=r(8546)(Object.keys,Object);t.exports=n},5382:t=>{t.exports=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}},6574:(t,e,r)=>{t=r.nmd(t);var n=r(1603),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o&&n.process,a=function(){try{return i&&i.require&&i.require("util").types||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=a},6881:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},8546:t=>{t.exports=function(t,e){return function(r){return t(e(r))}}},5390:(t,e,r)=>{var n=r(7156),o=Math.max;t.exports=function(t,e,r){return e=o(void 0===e?t.length-1:e,0),function(){for(var i=arguments,s=-1,a=o(i.length-e,0),u=Array(a);++s<a;)u[s]=i[e+s];s=-1;for(var h=Array(e+1);++s<e;)h[s]=i[s];return h[e]=r(u),n(t,this,h)}}},714:(t,e,r)=>{var n=r(1603),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},6127:t=>{t.exports=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}},1945:t=>{t.exports=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}},4874:t=>{t.exports=function(t){return this.__data__.has(t)}},6968:t=>{t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}},3232:(t,e,r)=>{var n=r(3431),o=r(1824)(n);t.exports=o},1824:t=>{var e=Date.now;t.exports=function(t){var r=0,n=0;return function(){var o=e(),i=16-(o-n);if(n=o,i>0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}},5331:(t,e,r)=>{var n=r(1022);t.exports=function(){this.__data__=new n,this.size=0}},7063:t=>{t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},134:t=>{t.exports=function(t){return this.__data__.get(t)}},9842:t=>{t.exports=function(t){return this.__data__.has(t)}},9850:(t,e,r)=>{var n=r(1022),o=r(5870),i=r(8910);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var s=r.__data__;if(!o||s.length<199)return s.push([t,e]),this.size=++r.size,this;r=this.__data__=new i(s)}return r.set(t,e),this.size=r.size,this}},638:t=>{t.exports=function(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}},6742:(t,e,r)=>{var n=r(446),o=r(3493),i=r(3870);t.exports=function(t){return o(t)?i(t):n(t)}},9505:(t,e,r)=>{var n=r(2121),o=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g,i=/\\\\(\\\\)?/g,s=n((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(o,(function(t,r,n,o){e.push(n?o.replace(i,"$1"):r||t)})),e}));t.exports=s},9628:(t,e,r)=>{var n=r(975);t.exports=function(t){if("string"==typeof t||n(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}},462:t=>{var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},4997:t=>{var e=/\\s/;t.exports=function(t){for(var r=t.length;r--&&e.test(t.charAt(r)););return r}},3870:t=>{var e="\\\\ud800-\\\\udfff",r="["+e+"]",n="[\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe2f\\\\u20d0-\\\\u20ff]",o="\\\\ud83c[\\\\udffb-\\\\udfff]",i="[^"+e+"]",s="(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}",a="[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]",u="(?:"+n+"|"+o+")?",h="[\\\\ufe0e\\\\ufe0f]?",d=h+u+"(?:\\\\u200d(?:"+[i,s,a].join("|")+")"+h+u+")*",c="(?:"+[i+n+"?",n,s,a,r].join("|")+")",l=RegExp(o+"(?="+o+")|"+c+d,"g");t.exports=function(t){for(var e=l.lastIndex=0;l.test(t);)++e;return e}},5402:(t,e,r)=>{var n=r(9018);t.exports=function(t){return n(t,4)}},9136:(t,e,r)=>{var n=r(9018);t.exports=function(t){return n(t,5)}},8295:t=>{t.exports=function(t){return function(){return t}}},9529:(t,e,r)=>{var n=r(6965),o=r(5097),i=r(8819),s=r(2844),a=Object.prototype,u=a.hasOwnProperty,h=n((function(t,e){t=Object(t);var r=-1,n=e.length,h=n>2?e[2]:void 0;for(h&&i(e[0],e[1],h)&&(n=1);++r<n;)for(var d=e[r],c=s(d),l=-1,f=c.length;++l<f;){var g=c[l],p=t[g];(void 0===p||o(p,a[g])&&!u.call(t,g))&&(t[g]=d[g])}return t}));t.exports=h},958:(t,e,r)=>{t.exports=r(1117)},5097:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},9969:(t,e,r)=>{var n=r(2995),o=r(1329),i=r(4506),s=r(5874);t.exports=function(t,e){return(s(t)?n:o)(t,i(e,3))}},828:(t,e,r)=>{var n=r(6057)(r(8550));t.exports=n},8550:(t,e,r)=>{var n=r(166),o=r(4506),i=r(3758),s=Math.max;t.exports=function(t,e,r){var a=null==t?0:t.length;if(!a)return-1;var u=null==r?0:i(r);return u<0&&(u=s(a+u,0)),n(t,o(e,3),u)}},7469:(t,e,r)=>{var n=r(9821);t.exports=function(t){return null!=t&&t.length?n(t,1):[]}},1117:(t,e,r)=>{var n=r(7012),o=r(830),i=r(4041),s=r(5874);t.exports=function(t,e){return(s(t)?n:o)(t,i(e))}},4519:(t,e,r)=>{var n=r(9128),o=r(4041),i=r(2844);t.exports=function(t,e){return null==t?t:n(t,o(e),i)}},5887:(t,e,r)=>{var n=r(1855);t.exports=function(t,e,r){var o=null==t?void 0:n(t,e);return void 0===o?r:o}},4339:(t,e,r)=>{var n=r(3091),o=r(9663);t.exports=function(t,e){return null!=t&&o(t,e,n)}},4016:(t,e,r)=>{var n=r(5088),o=r(9663);t.exports=function(t,e){return null!=t&&o(t,e,n)}},9169:t=>{t.exports=function(t){return t}},79:(t,e,r)=>{var n=r(4047),o=r(7583),i=Object.prototype,s=i.hasOwnProperty,a=i.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(t){return o(t)&&s.call(t,"callee")&&!a.call(t,"callee")};t.exports=u},5874:t=>{var e=Array.isArray;t.exports=e},3069:(t,e,r)=>{var n=r(7787),o=r(4583);t.exports=function(t){return null!=t&&o(t.length)&&!n(t)}},6882:(t,e,r)=>{var n=r(3069),o=r(7583);t.exports=function(t){return o(t)&&n(t)}},3601:(t,e,r)=>{t=r.nmd(t);var n=r(714),o=r(6408),i=e&&!e.nodeType&&e,s=i&&t&&!t.nodeType&&t,a=s&&s.exports===i?n.Buffer:void 0,u=(a?a.isBuffer:void 0)||o;t.exports=u},2046:(t,e,r)=>{var n=r(5351),o=r(9778),i=r(79),s=r(5874),a=r(3069),u=r(3601),h=r(7894),d=r(9046),c=Object.prototype.hasOwnProperty;t.exports=function(t){if(null==t)return!0;if(a(t)&&(s(t)||"string"==typeof t||"function"==typeof t.splice||u(t)||d(t)||i(t)))return!t.length;var e=o(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(h(t))return!n(t).length;for(var r in t)if(c.call(t,r))return!1;return!0}},7787:(t,e,r)=>{var n=r(5271),o=r(9400);t.exports=function(t){if(!o(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},4583:t=>{t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},4725:(t,e,r)=>{var n=r(4965),o=r(8232),i=r(6574),s=i&&i.isMap,a=s?o(s):n;t.exports=a},9400:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},7583:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},4108:(t,e,r)=>{var n=r(5271),o=r(7556),i=r(7583),s=Function.prototype,a=Object.prototype,u=s.toString,h=a.hasOwnProperty,d=u.call(Object);t.exports=function(t){if(!i(t)||"[object Object]"!=n(t))return!1;var e=o(t);if(null===e)return!0;var r=h.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&u.call(r)==d}},7363:(t,e,r)=>{var n=r(6499),o=r(8232),i=r(6574),s=i&&i.isSet,a=s?o(s):n;t.exports=a},7462:(t,e,r)=>{var n=r(5271),o=r(5874),i=r(7583);t.exports=function(t){return"string"==typeof t||!o(t)&&i(t)&&"[object String]"==n(t)}},975:(t,e,r)=>{var n=r(5271),o=r(7583);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==n(t)}},9046:(t,e,r)=>{var n=r(550),o=r(8232),i=r(6574),s=i&&i.isTypedArray,a=s?o(s):n;t.exports=a},2895:t=>{t.exports=function(t){return void 0===t}},3511:(t,e,r)=>{var n=r(9754),o=r(5351),i=r(3069);t.exports=function(t){return i(t)?n(t):o(t)}},2844:(t,e,r)=>{var n=r(9754),o=r(1500),i=r(3069);t.exports=function(t){return i(t)?n(t,!0):o(t)}},5179:t=>{t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},9629:(t,e,r)=>{var n=r(2275),o=r(4506),i=r(4733),s=r(5874);t.exports=function(t,e){return(s(t)?n:i)(t,o(e,3))}},5551:(t,e,r)=>{var n=r(3077),o=r(7702),i=r(4506);t.exports=function(t,e){var r={};return e=i(e,3),o(t,(function(t,o,i){n(r,o,e(t,o,i))})),r}},4213:(t,e,r)=>{var n=r(5816),o=r(4116),i=r(9169);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},8487:(t,e,r)=>{var n=r(8910);function o(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var s=t.apply(this,n);return r.cache=i.set(o,s)||i,s};return r.cache=new(o.Cache||n),r}o.Cache=n,t.exports=o},2495:(t,e,r)=>{var n=r(4479),o=r(1292)((function(t,e,r){n(t,e,r)}));t.exports=o},9903:(t,e,r)=>{var n=r(5816),o=r(2795),i=r(9169);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},3262:(t,e,r)=>{var n=r(5816),o=r(4506),i=r(2795);t.exports=function(t,e){return t&&t.length?n(t,o(e,2),i):void 0}},3883:t=>{t.exports=function(){}},8835:(t,e,r)=>{var n=r(714);t.exports=function(){return n.Date.now()}},222:(t,e,r)=>{var n=r(4286),o=r(4139)((function(t,e){return null==t?{}:n(t,e)}));t.exports=o},6830:(t,e,r)=>{var n=r(8494),o=r(3644),i=r(759),s=r(9628);t.exports=function(t){return i(t)?n(s(t)):o(t)}},4978:(t,e,r)=>{var n=r(4590)();t.exports=n},9285:(t,e,r)=>{var n=r(8663),o=r(830),i=r(4506),s=r(8421),a=r(5874);t.exports=function(t,e,r){var u=a(t)?n:s,h=arguments.length<3;return u(t,i(e,4),r,h,o)}},3910:(t,e,r)=>{var n=r(5351),o=r(9778),i=r(3069),s=r(7462),a=r(6742);t.exports=function(t){if(null==t)return 0;if(i(t))return s(t)?a(t):t.length;var e=o(t);return"[object Map]"==e||"[object Set]"==e?t.size:n(t).length}},5246:(t,e,r)=>{var n=r(9821),o=r(9586),i=r(6965),s=r(8819),a=i((function(t,e){if(null==t)return[];var r=e.length;return r>1&&s(t,e[0],e[1])?e=[]:r>2&&s(e[0],e[1],e[2])&&(e=[e[0]]),o(t,n(e,1),[])}));t.exports=a},2982:t=>{t.exports=function(){return[]}},6408:t=>{t.exports=function(){return!1}},8265:(t,e,r)=>{var n=r(7639),o=1/0;t.exports=function(t){return t?(t=n(t))===o||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}},3758:(t,e,r)=>{var n=r(8265);t.exports=function(t){var e=n(t),r=e%1;return e==e?r?e-r:e:0}},7639:(t,e,r)=>{var n=r(5103),o=r(9400),i=r(975),s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,h=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return NaN;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=n(t);var r=a.test(t);return r||u.test(t)?h(t.slice(2),r?2:8):s.test(t)?NaN:+t}},339:(t,e,r)=>{var n=r(5532),o=r(2844);t.exports=function(t){return n(t,o(t))}},983:(t,e,r)=>{var n=r(8071);t.exports=function(t){return null==t?"":n(t)}},3279:(t,e,r)=>{var n=r(7012),o=r(1095),i=r(7702),s=r(4506),a=r(7556),u=r(5874),h=r(3601),d=r(7787),c=r(9400),l=r(9046);t.exports=function(t,e,r){var f=u(t),g=f||h(t)||l(t);if(e=s(e,4),null==r){var p=t&&t.constructor;r=g?f?new p:[]:c(t)&&d(p)?o(a(t)):{}}return(g?n:i)(t,(function(t,n,o){return e(r,t,n,o)})),r}},3344:(t,e,r)=>{var n=r(9821),o=r(6965),i=r(3434),s=r(6882),a=o((function(t){return i(n(t,1,s,!0))}));t.exports=a},761:(t,e,r)=>{var n=r(983),o=0;t.exports=function(t){var e=++o;return n(t)+e}},3005:(t,e,r)=>{var n=r(989),o=r(3511);t.exports=function(t){return null==t?[]:n(t,o(t))}},3679:(t,e,r)=>{var n=r(5802),o=r(2543);t.exports=function(t,e){return o(t||[],e||[],n)}},412:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>o});var n=r(5229);function o(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==r.output){if(!(0,n.isAnyArray)(r.output))throw new TypeError("output option must be an array if specified");e=r.output}else e=new Array(t.length);var o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,o=void 0===r?0:r,i=e.toIndex,s=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=o||s>t.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[o],u=o+1;u<s;u++)t[u]<a&&(a=t[u]);return a}(t),i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,o=void 0===r?0:r,i=e.toIndex,s=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=o||s>t.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[o],u=o+1;u<s;u++)t[u]>a&&(a=t[u]);return a}(t);if(o===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var s=r.min,a=void 0===s?r.autoMinMax?o:0:s,u=r.max,h=void 0===u?r.autoMinMax?i:1:u;if(a>=h)throw new RangeError("min option must be smaller than max option");for(var d=(h-a)/(i-o),c=0;c<t.length;c++)e[c]=(t[c]-o)*d+a;return e}},8917:(t,e,r)=>{"use strict";var n=r(5229),o=r(412);const i=" ".repeat(2),s=" ".repeat(4);function a(t,e={}){const{maxRows:r=15,maxColumns:n=10,maxNumSize:o=8,padMinus:a="auto"}=e;return`${t.constructor.name} {\\n${i}[\\n${s}${function(t,e,r,n,o){const{rows:i,columns:a}=t,h=Math.min(i,e),d=Math.min(a,r),c=[];if("auto"===o){o=!1;t:for(let e=0;e<h;e++)for(let r=0;r<d;r++)if(t.get(e,r)<0){o=!0;break t}}for(let e=0;e<h;e++){let r=[];for(let i=0;i<d;i++)r.push(u(t.get(e,i),n,o));c.push(`${r.join(" ")}`)}return d!==a&&(c[c.length-1]+=` ... ${a-r} more columns`),h!==i&&c.push(`... ${i-e} more rows`),c.join(`\\n${s}`)}(t,r,n,o,a)}\\n${i}]\\n${i}rows: ${t.rows}\\n${i}columns: ${t.columns}\\n}`}function u(t,e,r){return(t>=0&&r?` ${h(t,e-1)}`:h(t,e)).padEnd(e)}function h(t,e){let r=t.toString();if(r.length<=e)return r;let n=t.toFixed(e);if(n.length>e&&(n=t.toFixed(Math.max(0,e-(n.length-e)))),n.length<=e&&!n.startsWith("0.000")&&!n.startsWith("-0.000"))return n;let o=t.toExponential(e);return o.length>e&&(o=t.toExponential(Math.max(0,e-(o.length-e)))),o.slice(0)}function d(t,e,r){let n=r?t.rows:t.rows-1;if(e<0||e>n)throw new RangeError("Row index out of range")}function c(t,e,r){let n=r?t.columns:t.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function l(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function f(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function g(t,e){if(!n.isAnyArray(e))throw new TypeError("row indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.rows)throw new RangeError("row indices are out of range")}function p(t,e){if(!n.isAnyArray(e))throw new TypeError("column indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.columns)throw new RangeError("column indices are out of range")}function v(t,e,r,n,o){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(y("startRow",e),y("endRow",r),y("startColumn",n),y("endColumn",o),e>r||n>o||e<0||e>=t.rows||r<0||r>=t.rows||n<0||n>=t.columns||o<0||o>=t.columns)throw new RangeError("Submatrix indices are out of range")}function m(t,e=0){let r=[];for(let n=0;n<t;n++)r.push(e);return r}function y(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function w(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class x{static from1DArray(t,e,r){if(t*e!==r.length)throw new RangeError("data length does not match given dimensions");let n=new E(t,e);for(let o=0;o<t;o++)for(let t=0;t<e;t++)n.set(o,t,r[o*e+t]);return n}static rowVector(t){let e=new E(1,t.length);for(let r=0;r<t.length;r++)e.set(0,r,t[r]);return e}static columnVector(t){let e=new E(t.length,1);for(let r=0;r<t.length;r++)e.set(r,0,t[r]);return e}static zeros(t,e){return new E(t,e)}static ones(t,e){return new E(t,e).fill(1)}static rand(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{random:n=Math.random}=r;let o=new E(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)o.set(r,t,n());return o}static randInt(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{min:n=0,max:o=1e3,random:i=Math.random}=r;if(!Number.isInteger(n))throw new TypeError("min must be an integer");if(!Number.isInteger(o))throw new TypeError("max must be an integer");if(n>=o)throw new RangeError("min must be smaller than max");let s=o-n,a=new E(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++){let e=n+Math.round(i()*s);a.set(r,t,e)}return a}static eye(t,e,r){void 0===e&&(e=t),void 0===r&&(r=1);let n=Math.min(t,e),o=this.zeros(t,e);for(let t=0;t<n;t++)o.set(t,t,r);return o}static diag(t,e,r){let n=t.length;void 0===e&&(e=n),void 0===r&&(r=e);let o=Math.min(n,e,r),i=this.zeros(e,r);for(let e=0;e<o;e++)i.set(e,e,t[e]);return i}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new E(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.min(t.get(i,r),e.get(i,r)));return o}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new this(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.max(t.get(i,r),e.get(i,r)));return o}static checkMatrix(t){return x.isMatrix(t)?t:new E(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.call(this,e,r);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.push(this.get(e,r));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let r=0;r<this.columns;r++)t[e].push(this.get(e,r))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let t=0;t<this.rows;t++)if(0!==this.get(t,t))return!1;return!0}isEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);t++}return n}isReducedEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);for(let r=e+1;r<this.rows;r++)0!==this.get(t,r)&&(n=!1);t++}return n}echelonForm(){let t=this.clone(),e=0,r=0;for(;e<t.rows&&r<t.columns;){let n=e;for(let o=e;o<t.rows;o++)t.get(o,r)>t.get(n,r)&&(n=o);if(0===t.get(n,r))r++;else{t.swapRows(e,n);let o=t.get(e,r);for(let n=r;n<t.columns;n++)t.set(e,n,t.get(e,n)/o);for(let n=e+1;n<t.rows;n++){let o=t.get(n,r)/t.get(e,r);t.set(n,r,0);for(let i=r+1;i<t.columns;i++)t.set(n,i,t.get(n,i)-t.get(e,i)*o)}e++,r++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,r=t.rows,n=r-1;for(;n>=0;)if(0===t.maxRow(n))n--;else{let o=0,i=!1;for(;o<r&&!1===i;)1===t.get(n,o)?i=!0:o++;for(let r=0;r<n;r++){let i=t.get(r,o);for(let s=o;s<e;s++){let e=t.get(r,s)-i*t.get(n,s);t.set(r,s,e)}}n--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:r=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(r)||r<=0)throw new TypeError("columns must be a positive integer");let n=new E(this.rows*e,this.columns*r);for(let t=0;t<e;t++)for(let e=0;e<r;e++)n.setSubMatrix(this,this.rows*t,this.columns*e);return n}fill(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,t);return this}neg(){return this.mulS(-1)}getRow(t){d(this,t);let e=[];for(let r=0;r<this.columns;r++)e.push(this.get(t,r));return e}getRowVector(t){return E.rowVector(this.getRow(t))}setRow(t,e){d(this,t),e=l(this,e);for(let r=0;r<this.columns;r++)this.set(t,r,e[r]);return this}swapRows(t,e){d(this,t),d(this,e);for(let r=0;r<this.columns;r++){let n=this.get(t,r);this.set(t,r,this.get(e,r)),this.set(e,r,n)}return this}getColumn(t){c(this,t);let e=[];for(let r=0;r<this.rows;r++)e.push(this.get(r,t));return e}getColumnVector(t){return E.columnVector(this.getColumn(t))}setColumn(t,e){c(this,t),e=f(this,e);for(let r=0;r<this.rows;r++)this.set(r,t,e[r]);return this}swapColumns(t,e){c(this,t),c(this,e);for(let r=0;r<this.rows;r++){let n=this.get(r,t);this.set(r,t,this.get(r,e)),this.set(r,e,n)}return this}addRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[r]);return this}subRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[r]);return this}mulRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[r]);return this}divRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[r]);return this}addColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[e]);return this}subColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[e]);return this}mulColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[e]);return this}divColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[e]);return this}mulRow(t,e){d(this,t);for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e);return this}mulColumn(t,e){c(this,t);for(let r=0;r<this.rows;r++)this.set(r,t,this.get(r,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){w(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){w(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}maxRow(t){if(d(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r));return e}maxRowIndex(t){d(this,t),w(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n),r[1]=n);return r}minRow(t){if(d(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r));return e}minRowIndex(t){d(this,t),w(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n),r[1]=n);return r}maxColumn(t){if(c(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t));return e}maxColumnIndex(t){c(this,t),w(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t),r[0]=n);return r}minColumn(t){if(c(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t));return e}minColumnIndex(t){c(this,t),w(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t),r[0]=n);return r}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let r=0;r<t;r++)e.push(this.get(r,r));return e}norm(t="frobenius"){switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${t}`)}}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t+=this.get(e,r),this.set(e,r,t);return this}dot(t){x.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let r=0;for(let n=0;n<e.length;n++)r+=e[n]*t[n];return r}mmul(t){t=E.checkMatrix(t);let e=this.rows,r=this.columns,n=t.columns,o=new E(e,n),i=new Float64Array(r);for(let s=0;s<n;s++){for(let e=0;e<r;e++)i[e]=t.get(e,s);for(let t=0;t<e;t++){let e=0;for(let n=0;n<r;n++)e+=this.get(t,n)*i[n];o.set(t,s,e)}}return o}strassen2x2(t){t=E.checkMatrix(t);let e=new E(2,2);const r=this.get(0,0),n=t.get(0,0),o=this.get(0,1),i=t.get(0,1),s=this.get(1,0),a=t.get(1,0),u=this.get(1,1),h=t.get(1,1),d=(r+u)*(n+h),c=(s+u)*n,l=r*(i-h),f=u*(a-n),g=(r+o)*h,p=d+f-g+(o-u)*(a+h),v=l+g,m=c+f,y=d-c+l+(s-r)*(n+i);return e.set(0,0,p),e.set(0,1,v),e.set(1,0,m),e.set(1,1,y),e}strassen3x3(t){t=E.checkMatrix(t);let e=new E(3,3);const r=this.get(0,0),n=this.get(0,1),o=this.get(0,2),i=this.get(1,0),s=this.get(1,1),a=this.get(1,2),u=this.get(2,0),h=this.get(2,1),d=this.get(2,2),c=t.get(0,0),l=t.get(0,1),f=t.get(0,2),g=t.get(1,0),p=t.get(1,1),v=t.get(1,2),m=t.get(2,0),y=t.get(2,1),w=t.get(2,2),x=(r-i)*(-l+p),b=(-r+i+s)*(c-l+p),N=(i+s)*(-c+l),M=r*c,_=(-r+u+h)*(c-f+v),k=(-r+u)*(f-v),A=(u+h)*(-c+f),j=(-o+h+d)*(p+m-y),S=(o-d)*(p-y),O=o*m,z=(h+d)*(-m+y),R=(-o+s+a)*(v+m-w),I=(o-a)*(v-w),C=(s+a)*(-m+w),D=M+O+n*g,P=(r+n+o-i-s-h-d)*p+b+N+M+j+O+z,T=M+_+A+(r+n+o-s-a-u-h)*v+O+R+C,L=x+s*(-c+l+g-p-v-m+w)+b+M+O+R+I,F=x+b+N+M+a*y,q=O+R+I+C+i*f,V=M+_+k+h*(-c+f+g-p-v-m+y)+j+S+O,B=j+S+O+z+u*l,$=M+_+k+A+d*w;return e.set(0,0,D),e.set(0,1,P),e.set(0,2,T),e.set(1,0,L),e.set(1,1,F),e.set(1,2,q),e.set(2,0,V),e.set(2,1,B),e.set(2,2,$),e}mmulStrassen(t){t=E.checkMatrix(t);let e=this.clone(),r=e.rows,n=e.columns,o=t.rows,i=t.columns;function s(t,e,r){let n=t.rows,o=t.columns;if(n===e&&o===r)return t;{let n=x.zeros(e,r);return n=n.setSubMatrix(t,0,0),n}}n!==o&&console.warn(`Multiplying ${r} x ${n} and ${o} x ${i} matrix: dimensions do not match.`);let a=Math.max(r,o),u=Math.max(n,i);return e=s(e,a,u),function t(e,r,n,o){if(n<=512||o<=512)return e.mmul(r);n%2==1&&o%2==1?(e=s(e,n+1,o+1),r=s(r,n+1,o+1)):n%2==1?(e=s(e,n+1,o),r=s(r,n+1,o)):o%2==1&&(e=s(e,n,o+1),r=s(r,n,o+1));let i=parseInt(e.rows/2,10),a=parseInt(e.columns/2,10),u=e.subMatrix(0,i-1,0,a-1),h=r.subMatrix(0,i-1,0,a-1),d=e.subMatrix(0,i-1,a,e.columns-1),c=r.subMatrix(0,i-1,a,r.columns-1),l=e.subMatrix(i,e.rows-1,0,a-1),f=r.subMatrix(i,r.rows-1,0,a-1),g=e.subMatrix(i,e.rows-1,a,e.columns-1),p=r.subMatrix(i,r.rows-1,a,r.columns-1),v=t(x.add(u,g),x.add(h,p),i,a),m=t(x.add(l,g),h,i,a),y=t(u,x.sub(c,p),i,a),w=t(g,x.sub(f,h),i,a),b=t(x.add(u,d),p,i,a),E=t(x.sub(l,u),x.add(h,c),i,a),N=t(x.sub(d,g),x.add(f,p),i,a),M=x.add(v,w);M.sub(b),M.add(N);let _=x.add(y,b),k=x.add(m,w),A=x.sub(v,m);A.add(y),A.add(E);let j=x.zeros(2*M.rows,2*M.columns);return j=j.setSubMatrix(M,0,0),j=j.setSubMatrix(_,M.rows,0),j=j.setSubMatrix(k,0,M.columns),j=j.setSubMatrix(A,M.rows,M.columns),j.subMatrix(0,n-1,0,o-1)}(e,t=s(t,a,u),a,u)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new E(this.rows,this.columns);for(let t=0;t<this.rows;t++){const i=this.getRow(t);i.length>0&&o(i,{min:e,max:r,output:i}),n.setRow(t,i)}return n}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new E(this.rows,this.columns);for(let t=0;t<this.columns;t++){const i=this.getColumn(t);i.length&&o(i,{min:e,max:r,output:i}),n.setColumn(t,i)}return n}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let r=0;r<t;r++){let t=this.get(e,r),n=this.get(e,this.columns-1-r);this.set(e,r,n),this.set(e,this.columns-1-r,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let r=0;r<t;r++){let t=this.get(r,e),n=this.get(this.rows-1-r,e);this.set(r,e,n),this.set(this.rows-1-r,e,t)}return this}kroneckerProduct(t){t=E.checkMatrix(t);let e=this.rows,r=this.columns,n=t.rows,o=t.columns,i=new E(e*n,r*o);for(let s=0;s<e;s++)for(let e=0;e<r;e++)for(let r=0;r<n;r++)for(let a=0;a<o;a++)i.set(n*s+r,o*e+a,this.get(s,e)*t.get(r,a));return i}kroneckerSum(t){if(t=E.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,r=t.rows,n=this.kroneckerProduct(E.eye(r,r)),o=E.eye(e,e).kroneckerProduct(t);return n.add(o)}transpose(){let t=new E(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(r,e,this.get(e,r));return t}sortRows(t=b){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=b){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,r,n){v(this,t,e,r,n);let o=new E(e-t+1,n-r+1);for(let i=t;i<=e;i++)for(let e=r;e<=n;e++)o.set(i-t,e-r,this.get(i,e));return o}subMatrixRow(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.columns-1),e>r||e<0||e>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");let n=new E(t.length,r-e+1);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.rows)throw new RangeError(`Row index out of range: ${t[o]}`);n.set(o,i-e,this.get(t[o],i))}return n}subMatrixColumn(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.rows-1),e>r||e<0||e>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");let n=new E(r-e+1,t.length);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.columns)throw new RangeError(`Column index out of range: ${t[o]}`);n.set(i-e,o,this.get(i,t[o]))}return n}setSubMatrix(t,e,r){if((t=E.checkMatrix(t)).isEmpty())return this;v(this,e,e+t.rows-1,r,r+t.columns-1);for(let n=0;n<t.rows;n++)for(let o=0;o<t.columns;o++)this.set(e+n,r+o,t.get(n,o));return this}selection(t,e){g(this,t),p(this,e);let r=new E(t.length,e.length);for(let n=0;n<t.length;n++){let o=t[n];for(let t=0;t<e.length;t++){let i=e[t];r.set(n,t,this.get(o,i))}}return r}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let r=0;r<t;r++)e+=this.get(r,r);return e}clone(){return this.constructor.copy(this,new E(this.rows,this.columns))}static copy(t,e){for(const[r,n,o]of t.entries())e.set(r,n,o);return e}sum(t){switch(t){case"row":return function(t){let e=m(t.rows);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]+=t.get(r,n);return e}(this);case"column":return function(t){let e=m(t.columns);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]+=t.get(r,n);return e}(this);case void 0:return function(t){let e=0;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e+=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=m(t.rows,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]*=t.get(r,n);return e}(this);case"column":return function(t){let e=m(t.columns,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]*=t.get(r,n);return e}(this);case void 0:return function(t){let e=1;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e*=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{unbiased:r=!0,mean:o=this.mean(t)}=e;if("boolean"!=typeof r)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!n.isAnyArray(o))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let s=0;s<n;s++){let n=0,a=0,u=0;for(let e=0;e<o;e++)u=t.get(s,e)-r[s],n+=u,a+=u*u;e?i.push((a-n*n/o)/(o-1)):i.push((a-n*n/o)/o)}return i}(this,r,o);case"column":if(!n.isAnyArray(o))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let s=0;s<o;s++){let o=0,a=0,u=0;for(let e=0;e<n;e++)u=t.get(e,s)-r[s],o+=u,a+=u*u;e?i.push((a-o*o/n)/(n-1)):i.push((a-o*o/n)/n)}return i}(this,r,o);case void 0:if("number"!=typeof o)throw new TypeError("mean must be a number");return function(t,e,r){const n=t.rows,o=t.columns,i=n*o;let s=0,a=0,u=0;for(let e=0;e<n;e++)for(let n=0;n<o;n++)u=t.get(e,n)-r,s+=u,a+=u*u;return e?(a-s*s/i)/(i-1):(a-s*s/i)/i}(this,r,o);default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const r=this.variance(t,e);if(void 0===t)return Math.sqrt(r);for(let t=0;t<r.length;t++)r[t]=Math.sqrt(r[t]);return r}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{center:r=this.mean(t)}=e;switch(t){case"row":if(!n.isAnyArray(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[r])}(this,r),this;case"column":if(!n.isAnyArray(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[n])}(this,r),this;case void 0:if("number"!=typeof r)throw new TypeError("center must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");let r=e.scale;switch(t){case"row":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.rows;r++){let n=0;for(let e=0;e<t.columns;e++)n+=Math.pow(t.get(r,e),2)/(t.columns-1);e.push(Math.sqrt(n))}return e}(this);else if(!n.isAnyArray(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[r])}(this,r),this;case"column":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.columns;r++){let n=0;for(let e=0;e<t.rows;e++)n+=Math.pow(t.get(e,r),2)/(t.rows-1);e.push(Math.sqrt(n))}return e}(this);else if(!n.isAnyArray(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[n])}(this,r),this;case void 0:if(void 0===r)r=function(t){const e=t.size-1;let r=0;for(let n=0;n<t.columns;n++)for(let o=0;o<t.rows;o++)r+=Math.pow(t.get(o,n),2)/e;return Math.sqrt(r)}(this);else if("number"!=typeof r)throw new TypeError("scale must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}toString(t){return a(this,t)}[Symbol.iterator](){return this.entries()}*entries(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield[t,e,this.get(t,e)]}*values(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield this.get(t,e)}}function b(t,e){return t-e}x.prototype.klass="Matrix","undefined"!=typeof Symbol&&(x.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return a(this)}),x.random=x.rand,x.randomInt=x.randInt,x.diagonal=x.diag,x.prototype.diagonal=x.prototype.diag,x.identity=x.eye,x.prototype.negate=x.prototype.neg,x.prototype.tensorProduct=x.prototype.kroneckerProduct;class E extends x{data;#t(t,e){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let r=0;r<t;r++)this.data.push(new Float64Array(e));this.rows=t,this.columns=e}constructor(t,e){if(super(),E.isMatrix(t))this.#t(t.rows,t.columns),E.copy(t,this);else if(Number.isInteger(t)&&t>=0)this.#t(t,e);else{if(!n.isAnyArray(t))throw new TypeError("First argument must be a positive number or an array");{const r=t;if("number"!=typeof(e=(t=r.length)?r[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let n=0;n<t;n++){if(r[n].length!==e)throw new RangeError("Inconsistent array dimensions");if(!r[n].every((t=>"number"==typeof t)))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(r[n]))}this.rows=t,this.columns=e}}}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}removeRow(t){return d(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),d(this,t,!0),e=Float64Array.from(l(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){c(this,t);for(let e=0;e<this.rows;e++){const r=new Float64Array(this.columns-1);for(let n=0;n<t;n++)r[n]=this.data[e][n];for(let n=t+1;n<this.columns;n++)r[n-1]=this.data[e][n];this.data[e]=r}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),c(this,t,!0),e=f(this,e);for(let r=0;r<this.rows;r++){const n=new Float64Array(this.columns+1);let o=0;for(;o<t;o++)n[o]=this.data[r][o];for(n[o++]=e[r];o<this.columns+1;o++)n[o]=this.data[r][o-1];this.data[r]=n}return this.columns+=1,this}}!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t.get(e,r));return this},t.add=function(t,r){return new e(t).add(r)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t.get(e,r));return this},t.sub=function(t,r){return new e(t).sub(r)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t.get(e,r));return this},t.mul=function(t,r){return new e(t).mul(r)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t.get(e,r));return this},t.div=function(t,r){return new e(t).div(r)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t.get(e,r));return this},t.mod=function(t,r){return new e(t).mod(r)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t.get(e,r));return this},t.and=function(t,r){return new e(t).and(r)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t.get(e,r));return this},t.or=function(t,r){return new e(t).or(r)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t.get(e,r));return this},t.xor=function(t,r){return new e(t).xor(r)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t.get(e,r));return this},t.leftShift=function(t,r){return new e(t).leftShift(r)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t.get(e,r));return this},t.signPropagatingRightShift=function(t,r){return new e(t).signPropagatingRightShift(r)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t.get(e,r));return this},t.rightShift=function(t,r){return new e(t).rightShift(r)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,r){return new e(t).pow(r)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t));return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t.get(e,r)));return this}}(x,E);class N extends x{#e;get size(){return this.#e.size}get rows(){return this.#e.rows}get columns(){return this.#e.columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(t){return E.isMatrix(t)&&"SymmetricMatrix"===t.klassType}static zeros(t){return new this(t)}static ones(t){return new this(t).fill(1)}constructor(t){if(super(),E.isMatrix(t)){if(!t.isSymmetric())throw new TypeError("not symmetric data");this.#e=E.copy(t,new E(t.rows,t.rows))}else if(Number.isInteger(t)&&t>=0)this.#e=new E(t,t);else if(this.#e=new E(t),!this.isSymmetric())throw new TypeError("not symmetric data")}clone(){const t=new N(this.diagonalSize);for(const[e,r,n]of this.upperRightEntries())t.set(e,r,n);return t}toMatrix(){return new E(this)}get(t,e){return this.#e.get(t,e)}set(t,e,r){return this.#e.set(t,e,r),this.#e.set(e,t,r),this}removeCross(t){return this.#e.removeRow(t),this.#e.removeColumn(t),this}addCross(t,e){void 0===e&&(e=t,t=this.diagonalSize);const r=e.slice();return r.splice(t,1),this.#e.addRow(t,r),this.#e.addColumn(t,e),this}applyMask(t){if(t.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const e=[];for(const[r,n]of t.entries())n||e.push(r);e.reverse();for(const t of e)this.removeCross(t);return this}toCompact(){const{diagonalSize:t}=this,e=new Array(t*(t+1)/2);for(let r=0,n=0,o=0;o<e.length;o++)e[o]=this.get(n,r),++r>=t&&(r=++n);return e}static fromCompact(t){const e=t.length,r=(Math.sqrt(8*e+1)-1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(t)}`);const n=new N(r);for(let o=0,i=0,s=0;s<e;s++)n.set(o,i,t[s]),++o>=r&&(o=++i);return n}*upperRightEntries(){for(let t=0,e=0;t<this.diagonalSize;void 0){const r=this.get(t,e);yield[t,e,r],++e>=this.diagonalSize&&(e=++t)}}*upperRightValues(){for(let t=0,e=0;t<this.diagonalSize;void 0){const r=this.get(t,e);yield r,++e>=this.diagonalSize&&(e=++t)}}}N.prototype.klassType="SymmetricMatrix";class M extends N{static isDistanceMatrix(t){return N.isSymmetricMatrix(t)&&"DistanceMatrix"===t.klassSubType}constructor(t){if(super(t),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(t,e,r){return t===e&&(r=0),super.set(t,e,r)}addCross(t,e){return void 0===e&&(e=t,t=this.diagonalSize),(e=e.slice())[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new N(this)}clone(){const t=new M(this.diagonalSize);for(const[e,r,n]of this.upperRightEntries())e!==r&&t.set(e,r,n);return t}toCompact(){const{diagonalSize:t}=this,e=new Array((t-1)*t/2);for(let r=1,n=0,o=0;o<e.length;o++)e[o]=this.get(n,r),++r>=t&&(r=1+ ++n);return e}static fromCompact(t){const e=t.length,r=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(t)}`);const n=new this(r);for(let o=1,i=0,s=0;s<e;s++)n.set(o,i,t[s]),++o>=r&&(o=1+ ++i);return n}}M.prototype.klassSubType="DistanceMatrix";class _ extends x{constructor(t,e,r){super(),this.matrix=t,this.rows=e,this.columns=r}}class k extends _{constructor(t,e,r){g(t,e),p(t,r),super(t,e.length,r.length),this.rowIndices=e,this.columnIndices=r}set(t,e,r){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],r),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class A extends x{constructor(t,e={}){const{rows:r=1}=e;if(t.length%r!=0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=r,this.columns=t.length/r,this.data=t}set(t,e,r){let n=this._calculateIndex(t,e);return this.data[n]=r,this}get(t,e){let r=this._calculateIndex(t,e);return this.data[r]}_calculateIndex(t,e){return t*this.columns+e}}class j extends x{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}}class S{constructor(t){let e,r,n,o,i,s,a,u,h,d=(t=j.checkMatrix(t)).clone(),c=d.rows,l=d.columns,f=new Float64Array(c),g=1;for(e=0;e<c;e++)f[e]=e;for(u=new Float64Array(c),r=0;r<l;r++){for(e=0;e<c;e++)u[e]=d.get(e,r);for(e=0;e<c;e++){for(h=Math.min(e,r),i=0,n=0;n<h;n++)i+=d.get(e,n)*u[n];u[e]-=i,d.set(e,r,u[e])}for(o=r,e=r+1;e<c;e++)Math.abs(u[e])>Math.abs(u[o])&&(o=e);if(o!==r){for(n=0;n<l;n++)s=d.get(o,n),d.set(o,n,d.get(r,n)),d.set(r,n,s);a=f[o],f[o]=f[r],f[r]=a,g=-g}if(r<c&&0!==d.get(r,r))for(e=r+1;e<c;e++)d.set(e,r,d.get(e,r)/d.get(r,r))}this.LU=d,this.pivotVector=f,this.pivotSign=g}isSingular(){let t=this.LU,e=t.columns;for(let r=0;r<e;r++)if(0===t.get(r,r))return!0;return!1}solve(t){t=E.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let r,n,o,i=t.columns,s=t.subMatrixRow(this.pivotVector,0,i-1),a=e.columns;for(o=0;o<a;o++)for(r=o+1;r<a;r++)for(n=0;n<i;n++)s.set(r,n,s.get(r,n)-s.get(o,n)*e.get(r,o));for(o=a-1;o>=0;o--){for(n=0;n<i;n++)s.set(o,n,s.get(o,n)/e.get(o,o));for(r=0;r<o;r++)for(n=0;n<i;n++)s.set(r,n,s.get(r,n)-s.get(o,n)*e.get(r,o))}return s}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,r=t.columns;for(let n=0;n<r;n++)e*=t.get(n,n);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,n=new E(e,r);for(let o=0;o<e;o++)for(let e=0;e<r;e++)o>e?n.set(o,e,t.get(o,e)):o===e?n.set(o,e,1):n.set(o,e,0);return n}get upperTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,n=new E(e,r);for(let o=0;o<e;o++)for(let e=0;e<r;e++)o<=e?n.set(o,e,t.get(o,e)):n.set(o,e,0);return n}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function O(t,e){let r=0;return Math.abs(t)>Math.abs(e)?(r=e/t,Math.abs(t)*Math.sqrt(1+r*r)):0!==e?(r=t/e,Math.abs(e)*Math.sqrt(1+r*r)):0}class z{constructor(t){let e,r,n,o,i=(t=j.checkMatrix(t)).clone(),s=t.rows,a=t.columns,u=new Float64Array(a);for(n=0;n<a;n++){let t=0;for(e=n;e<s;e++)t=O(t,i.get(e,n));if(0!==t){for(i.get(n,n)<0&&(t=-t),e=n;e<s;e++)i.set(e,n,i.get(e,n)/t);for(i.set(n,n,i.get(n,n)+1),r=n+1;r<a;r++){for(o=0,e=n;e<s;e++)o+=i.get(e,n)*i.get(e,r);for(o=-o/i.get(n,n),e=n;e<s;e++)i.set(e,r,i.get(e,r)+o*i.get(e,n))}}u[n]=-t}this.QR=i,this.Rdiag=u}solve(t){t=E.checkMatrix(t);let e=this.QR,r=e.rows;if(t.rows!==r)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let n,o,i,s,a=t.columns,u=t.clone(),h=e.columns;for(i=0;i<h;i++)for(o=0;o<a;o++){for(s=0,n=i;n<r;n++)s+=e.get(n,i)*u.get(n,o);for(s=-s/e.get(i,i),n=i;n<r;n++)u.set(n,o,u.get(n,o)+s*e.get(n,i))}for(i=h-1;i>=0;i--){for(o=0;o<a;o++)u.set(i,o,u.get(i,o)/this.Rdiag[i]);for(n=0;n<i;n++)for(o=0;o<a;o++)u.set(n,o,u.get(n,o)-u.get(i,o)*e.get(n,i))}return u.subMatrix(0,h-1,0,a-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(0===this.Rdiag[e])return!1;return!0}get upperTriangularMatrix(){let t,e,r=this.QR,n=r.columns,o=new E(n,n);for(t=0;t<n;t++)for(e=0;e<n;e++)t<e?o.set(t,e,r.get(t,e)):t===e?o.set(t,e,this.Rdiag[t]):o.set(t,e,0);return o}get orthogonalMatrix(){let t,e,r,n,o=this.QR,i=o.rows,s=o.columns,a=new E(i,s);for(r=s-1;r>=0;r--){for(t=0;t<i;t++)a.set(t,r,0);for(a.set(r,r,1),e=r;e<s;e++)if(0!==o.get(r,r)){for(n=0,t=r;t<i;t++)n+=o.get(t,r)*a.get(t,e);for(n=-n/o.get(r,r),t=r;t<i;t++)a.set(t,e,a.get(t,e)+n*o.get(t,r))}}return a}}class R{constructor(t,e={}){if((t=j.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let r=t.rows,n=t.columns;const{computeLeftSingularVectors:o=!0,computeRightSingularVectors:i=!0,autoTranspose:s=!1}=e;let a,u=Boolean(o),h=Boolean(i),d=!1;if(r<n)if(s){a=t.transpose(),r=a.rows,n=a.columns,d=!0;let e=u;u=h,h=e}else a=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else a=t.clone();let c=Math.min(r,n),l=Math.min(r+1,n),f=new Float64Array(l),g=new E(r,c),p=new E(n,n),v=new Float64Array(n),m=new Float64Array(r),y=new Float64Array(l);for(let t=0;t<l;t++)y[t]=t;let w=Math.min(r-1,n),x=Math.max(0,Math.min(n-2,r)),b=Math.max(w,x);for(let t=0;t<b;t++){if(t<w){f[t]=0;for(let e=t;e<r;e++)f[t]=O(f[t],a.get(e,t));if(0!==f[t]){a.get(t,t)<0&&(f[t]=-f[t]);for(let e=t;e<r;e++)a.set(e,t,a.get(e,t)/f[t]);a.set(t,t,a.get(t,t)+1)}f[t]=-f[t]}for(let e=t+1;e<n;e++){if(t<w&&0!==f[t]){let n=0;for(let o=t;o<r;o++)n+=a.get(o,t)*a.get(o,e);n=-n/a.get(t,t);for(let o=t;o<r;o++)a.set(o,e,a.get(o,e)+n*a.get(o,t))}v[e]=a.get(t,e)}if(u&&t<w)for(let e=t;e<r;e++)g.set(e,t,a.get(e,t));if(t<x){v[t]=0;for(let e=t+1;e<n;e++)v[t]=O(v[t],v[e]);if(0!==v[t]){v[t+1]<0&&(v[t]=0-v[t]);for(let e=t+1;e<n;e++)v[e]/=v[t];v[t+1]+=1}if(v[t]=-v[t],t+1<r&&0!==v[t]){for(let e=t+1;e<r;e++)m[e]=0;for(let e=t+1;e<r;e++)for(let r=t+1;r<n;r++)m[e]+=v[r]*a.get(e,r);for(let e=t+1;e<n;e++){let n=-v[e]/v[t+1];for(let o=t+1;o<r;o++)a.set(o,e,a.get(o,e)+n*m[o])}}if(h)for(let e=t+1;e<n;e++)p.set(e,t,v[e])}}let N=Math.min(n,r+1);if(w<n&&(f[w]=a.get(w,w)),r<N&&(f[N-1]=0),x+1<N&&(v[x]=a.get(x,N-1)),v[N-1]=0,u){for(let t=w;t<c;t++){for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}for(let t=w-1;t>=0;t--)if(0!==f[t]){for(let e=t+1;e<c;e++){let n=0;for(let o=t;o<r;o++)n+=g.get(o,t)*g.get(o,e);n=-n/g.get(t,t);for(let o=t;o<r;o++)g.set(o,e,g.get(o,e)+n*g.get(o,t))}for(let e=t;e<r;e++)g.set(e,t,-g.get(e,t));g.set(t,t,1+g.get(t,t));for(let e=0;e<t-1;e++)g.set(e,t,0)}else{for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}}if(h)for(let t=n-1;t>=0;t--){if(t<x&&0!==v[t])for(let e=t+1;e<n;e++){let r=0;for(let o=t+1;o<n;o++)r+=p.get(o,t)*p.get(o,e);r=-r/p.get(t+1,t);for(let o=t+1;o<n;o++)p.set(o,e,p.get(o,e)+r*p.get(o,t))}for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}let M=N-1,_=Number.EPSILON;for(;N>0;){let t,e;for(t=N-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+_*Math.abs(f[t]+Math.abs(f[t+1]));if(Math.abs(v[t])<=e||Number.isNaN(v[t])){v[t]=0;break}}if(t===N-2)e=4;else{let r;for(r=N-1;r>=t&&r!==t;r--){let e=(r!==N?Math.abs(v[r]):0)+(r!==t+1?Math.abs(v[r-1]):0);if(Math.abs(f[r])<=_*e){f[r]=0;break}}r===t?e=3:r===N-1?e=1:(e=2,t=r)}switch(t++,e){case 1:{let e=v[N-2];v[N-2]=0;for(let r=N-2;r>=t;r--){let o=O(f[r],e),i=f[r]/o,s=e/o;if(f[r]=o,r!==t&&(e=-s*v[r-1],v[r-1]=i*v[r-1]),h)for(let t=0;t<n;t++)o=i*p.get(t,r)+s*p.get(t,N-1),p.set(t,N-1,-s*p.get(t,r)+i*p.get(t,N-1)),p.set(t,r,o)}break}case 2:{let e=v[t-1];v[t-1]=0;for(let n=t;n<N;n++){let o=O(f[n],e),i=f[n]/o,s=e/o;if(f[n]=o,e=-s*v[n],v[n]=i*v[n],u)for(let e=0;e<r;e++)o=i*g.get(e,n)+s*g.get(e,t-1),g.set(e,t-1,-s*g.get(e,n)+i*g.get(e,t-1)),g.set(e,n,o)}break}case 3:{const e=Math.max(Math.abs(f[N-1]),Math.abs(f[N-2]),Math.abs(v[N-2]),Math.abs(f[t]),Math.abs(v[t])),o=f[N-1]/e,i=f[N-2]/e,s=v[N-2]/e,a=f[t]/e,d=v[t]/e,c=((i+o)*(i-o)+s*s)/2,l=o*s*(o*s);let m=0;0===c&&0===l||(m=c<0?0-Math.sqrt(c*c+l):Math.sqrt(c*c+l),m=l/(c+m));let y=(a+o)*(a-o)+m,w=a*d;for(let e=t;e<N-1;e++){let o=O(y,w);0===o&&(o=Number.MIN_VALUE);let i=y/o,s=w/o;if(e!==t&&(v[e-1]=o),y=i*f[e]+s*v[e],v[e]=i*v[e]-s*f[e],w=s*f[e+1],f[e+1]=i*f[e+1],h)for(let t=0;t<n;t++)o=i*p.get(t,e)+s*p.get(t,e+1),p.set(t,e+1,-s*p.get(t,e)+i*p.get(t,e+1)),p.set(t,e,o);if(o=O(y,w),0===o&&(o=Number.MIN_VALUE),i=y/o,s=w/o,f[e]=o,y=i*v[e]+s*f[e+1],f[e+1]=-s*v[e]+i*f[e+1],w=s*v[e+1],v[e+1]=i*v[e+1],u&&e<r-1)for(let t=0;t<r;t++)o=i*g.get(t,e)+s*g.get(t,e+1),g.set(t,e+1,-s*g.get(t,e)+i*g.get(t,e+1)),g.set(t,e,o)}v[N-2]=y;break}case 4:if(f[t]<=0&&(f[t]=f[t]<0?-f[t]:0,h))for(let e=0;e<=M;e++)p.set(e,t,-p.get(e,t));for(;t<M&&!(f[t]>=f[t+1]);){let e=f[t];if(f[t]=f[t+1],f[t+1]=e,h&&t<n-1)for(let r=0;r<n;r++)e=p.get(r,t+1),p.set(r,t+1,p.get(r,t)),p.set(r,t,e);if(u&&t<r-1)for(let n=0;n<r;n++)e=g.get(n,t+1),g.set(n,t+1,g.get(n,t)),g.set(n,t,e);t++}N--}}if(d){let t=p;p=g,g=t}this.m=r,this.n=n,this.s=f,this.U=g,this.V=p}solve(t){let e=t,r=this.threshold,n=this.s.length,o=E.zeros(n,n);for(let t=0;t<n;t++)Math.abs(this.s[t])<=r?o.set(t,t,0):o.set(t,t,1/this.s[t]);let i=this.U,s=this.rightSingularVectors,a=s.mmul(o),u=s.rows,h=i.rows,d=E.zeros(u,h);for(let t=0;t<u;t++)for(let e=0;e<h;e++){let r=0;for(let o=0;o<n;o++)r+=a.get(t,o)*i.get(e,o);d.set(t,e,r)}return d.mmul(e)}solveForDiagonal(t){return this.solve(E.diag(t))}inverse(){let t=this.V,e=this.threshold,r=t.rows,n=t.columns,o=new E(r,this.s.length);for(let i=0;i<r;i++)for(let r=0;r<n;r++)Math.abs(this.s[r])>e&&o.set(i,r,t.get(i,r)/this.s[r]);let i=this.U,s=i.rows,a=i.columns,u=new E(r,s);for(let t=0;t<r;t++)for(let e=0;e<s;e++){let r=0;for(let n=0;n<a;n++)r+=o.get(t,n)*i.get(e,n);u.set(t,e,r)}return u}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,r=this.s;for(let n=0,o=r.length;n<o;n++)r[n]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return E.diag(this.s)}}function I(t,e,r=!1){return t=j.checkMatrix(t),e=j.checkMatrix(e),r?new R(t).solve(e):t.isSquare()?new S(t).solve(e):new z(t).solve(e)}function C(t,e){let r=[];for(let n=0;n<t;n++)n!==e&&r.push(n);return r}function D(t,e,r,n=1e-9,o=1e-9){if(t>o)return new Array(e.rows+1).fill(0);{let t=e.addRow(r,[0]);for(let e=0;e<t.rows;e++)Math.abs(t.get(e,0))<n&&t.set(e,0,0);return t.to1DArray()}}class P{constructor(t,e={}){const{assumeSymmetric:r=!1}=e;if(!(t=j.checkMatrix(t)).isSquare())throw new Error("Matrix is not a square matrix");if(t.isEmpty())throw new Error("Matrix must be non-empty");let n,o,i=t.columns,s=new E(i,i),a=new Float64Array(i),u=new Float64Array(i),h=t,d=!1;if(d=!!r||t.isSymmetric(),d){for(n=0;n<i;n++)for(o=0;o<i;o++)s.set(n,o,h.get(n,o));!function(t,e,r,n){let o,i,s,a,u,h,d,c;for(u=0;u<t;u++)r[u]=n.get(t-1,u);for(a=t-1;a>0;a--){for(c=0,s=0,h=0;h<a;h++)c+=Math.abs(r[h]);if(0===c)for(e[a]=r[a-1],u=0;u<a;u++)r[u]=n.get(a-1,u),n.set(a,u,0),n.set(u,a,0);else{for(h=0;h<a;h++)r[h]/=c,s+=r[h]*r[h];for(o=r[a-1],i=Math.sqrt(s),o>0&&(i=-i),e[a]=c*i,s-=o*i,r[a-1]=o-i,u=0;u<a;u++)e[u]=0;for(u=0;u<a;u++){for(o=r[u],n.set(u,a,o),i=e[u]+n.get(u,u)*o,h=u+1;h<=a-1;h++)i+=n.get(h,u)*r[h],e[h]+=n.get(h,u)*o;e[u]=i}for(o=0,u=0;u<a;u++)e[u]/=s,o+=e[u]*r[u];for(d=o/(s+s),u=0;u<a;u++)e[u]-=d*r[u];for(u=0;u<a;u++){for(o=r[u],i=e[u],h=u;h<=a-1;h++)n.set(h,u,n.get(h,u)-(o*e[h]+i*r[h]));r[u]=n.get(a-1,u),n.set(a,u,0)}}r[a]=s}for(a=0;a<t-1;a++){if(n.set(t-1,a,n.get(a,a)),n.set(a,a,1),s=r[a+1],0!==s){for(h=0;h<=a;h++)r[h]=n.get(h,a+1)/s;for(u=0;u<=a;u++){for(i=0,h=0;h<=a;h++)i+=n.get(h,a+1)*n.get(h,u);for(h=0;h<=a;h++)n.set(h,u,n.get(h,u)-i*r[h])}}for(h=0;h<=a;h++)n.set(h,a+1,0)}for(u=0;u<t;u++)r[u]=n.get(t-1,u),n.set(t-1,u,0);n.set(t-1,t-1,1),e[0]=0}(i,u,a,s),function(t,e,r,n){let o,i,s,a,u,h,d,c,l,f,g,p,v,m,y,w;for(s=1;s<t;s++)e[s-1]=e[s];e[t-1]=0;let x=0,b=0,E=Number.EPSILON;for(h=0;h<t;h++){for(b=Math.max(b,Math.abs(r[h])+Math.abs(e[h])),d=h;d<t&&!(Math.abs(e[d])<=E*b);)d++;if(d>h)do{for(o=r[h],c=(r[h+1]-o)/(2*e[h]),l=O(c,1),c<0&&(l=-l),r[h]=e[h]/(c+l),r[h+1]=e[h]*(c+l),f=r[h+1],i=o-r[h],s=h+2;s<t;s++)r[s]-=i;for(x+=i,c=r[d],g=1,p=g,v=g,m=e[h+1],y=0,w=0,s=d-1;s>=h;s--)for(v=p,p=g,w=y,o=g*e[s],i=g*c,l=O(c,e[s]),e[s+1]=y*l,y=e[s]/l,g=c/l,c=g*r[s]-y*o,r[s+1]=i+y*(g*o+y*r[s]),u=0;u<t;u++)i=n.get(u,s+1),n.set(u,s+1,y*n.get(u,s)+g*i),n.set(u,s,g*n.get(u,s)-y*i);c=-y*w*v*m*e[h]/f,e[h]=y*c,r[h]=g*c}while(Math.abs(e[h])>E*b);r[h]=r[h]+x,e[h]=0}for(s=0;s<t-1;s++){for(u=s,c=r[s],a=s+1;a<t;a++)r[a]<c&&(u=a,c=r[a]);if(u!==s)for(r[u]=r[s],r[s]=c,a=0;a<t;a++)c=n.get(a,s),n.set(a,s,n.get(a,u)),n.set(a,u,c)}}(i,u,a,s)}else{let t=new E(i,i),e=new Float64Array(i);for(o=0;o<i;o++)for(n=0;n<i;n++)t.set(n,o,h.get(n,o));!function(t,e,r,n){let o,i,s,a,u,h,d,c=t-1;for(h=1;h<=c-1;h++){for(d=0,a=h;a<=c;a++)d+=Math.abs(e.get(a,h-1));if(0!==d){for(s=0,a=c;a>=h;a--)r[a]=e.get(a,h-1)/d,s+=r[a]*r[a];for(i=Math.sqrt(s),r[h]>0&&(i=-i),s-=r[h]*i,r[h]=r[h]-i,u=h;u<t;u++){for(o=0,a=c;a>=h;a--)o+=r[a]*e.get(a,u);for(o/=s,a=h;a<=c;a++)e.set(a,u,e.get(a,u)-o*r[a])}for(a=0;a<=c;a++){for(o=0,u=c;u>=h;u--)o+=r[u]*e.get(a,u);for(o/=s,u=h;u<=c;u++)e.set(a,u,e.get(a,u)-o*r[u])}r[h]=d*r[h],e.set(h,h-1,d*i)}}for(a=0;a<t;a++)for(u=0;u<t;u++)n.set(a,u,a===u?1:0);for(h=c-1;h>=1;h--)if(0!==e.get(h,h-1)){for(a=h+1;a<=c;a++)r[a]=e.get(a,h-1);for(u=h;u<=c;u++){for(i=0,a=h;a<=c;a++)i+=r[a]*n.get(a,u);for(i=i/r[h]/e.get(h,h-1),a=h;a<=c;a++)n.set(a,u,n.get(a,u)+i*r[a])}}}(i,t,e,s),function(t,e,r,n,o){let i,s,a,u,h,d,c,l,f,g,p,v,m,y,w,x=t-1,b=t-1,E=Number.EPSILON,N=0,M=0,_=0,k=0,A=0,j=0,S=0,O=0;for(i=0;i<t;i++)for((i<0||i>b)&&(r[i]=o.get(i,i),e[i]=0),s=Math.max(i-1,0);s<t;s++)M+=Math.abs(o.get(i,s));for(;x>=0;){for(u=x;u>0&&(j=Math.abs(o.get(u-1,u-1))+Math.abs(o.get(u,u)),0===j&&(j=M),!(Math.abs(o.get(u,u-1))<E*j));)u--;if(u===x)o.set(x,x,o.get(x,x)+N),r[x]=o.get(x,x),e[x]=0,x--,O=0;else if(u===x-1){if(c=o.get(x,x-1)*o.get(x-1,x),_=(o.get(x-1,x-1)-o.get(x,x))/2,k=_*_+c,S=Math.sqrt(Math.abs(k)),o.set(x,x,o.get(x,x)+N),o.set(x-1,x-1,o.get(x-1,x-1)+N),l=o.get(x,x),k>=0){for(S=_>=0?_+S:_-S,r[x-1]=l+S,r[x]=r[x-1],0!==S&&(r[x]=l-c/S),e[x-1]=0,e[x]=0,l=o.get(x,x-1),j=Math.abs(l)+Math.abs(S),_=l/j,k=S/j,A=Math.sqrt(_*_+k*k),_/=A,k/=A,s=x-1;s<t;s++)S=o.get(x-1,s),o.set(x-1,s,k*S+_*o.get(x,s)),o.set(x,s,k*o.get(x,s)-_*S);for(i=0;i<=x;i++)S=o.get(i,x-1),o.set(i,x-1,k*S+_*o.get(i,x)),o.set(i,x,k*o.get(i,x)-_*S);for(i=0;i<=b;i++)S=n.get(i,x-1),n.set(i,x-1,k*S+_*n.get(i,x)),n.set(i,x,k*n.get(i,x)-_*S)}else r[x-1]=l+_,r[x]=l+_,e[x-1]=S,e[x]=-S;x-=2,O=0}else{if(l=o.get(x,x),f=0,c=0,u<x&&(f=o.get(x-1,x-1),c=o.get(x,x-1)*o.get(x-1,x)),10===O){for(N+=l,i=0;i<=x;i++)o.set(i,i,o.get(i,i)-l);j=Math.abs(o.get(x,x-1))+Math.abs(o.get(x-1,x-2)),l=f=.75*j,c=-.4375*j*j}if(30===O&&(j=(f-l)/2,j=j*j+c,j>0)){for(j=Math.sqrt(j),f<l&&(j=-j),j=l-c/((f-l)/2+j),i=0;i<=x;i++)o.set(i,i,o.get(i,i)-j);N+=j,l=f=c=.964}for(O+=1,h=x-2;h>=u&&(S=o.get(h,h),A=l-S,j=f-S,_=(A*j-c)/o.get(h+1,h)+o.get(h,h+1),k=o.get(h+1,h+1)-S-A-j,A=o.get(h+2,h+1),j=Math.abs(_)+Math.abs(k)+Math.abs(A),_/=j,k/=j,A/=j,h!==u)&&!(Math.abs(o.get(h,h-1))*(Math.abs(k)+Math.abs(A))<E*(Math.abs(_)*(Math.abs(o.get(h-1,h-1))+Math.abs(S)+Math.abs(o.get(h+1,h+1)))));)h--;for(i=h+2;i<=x;i++)o.set(i,i-2,0),i>h+2&&o.set(i,i-3,0);for(a=h;a<=x-1&&(y=a!==x-1,a!==h&&(_=o.get(a,a-1),k=o.get(a+1,a-1),A=y?o.get(a+2,a-1):0,l=Math.abs(_)+Math.abs(k)+Math.abs(A),0!==l&&(_/=l,k/=l,A/=l)),0!==l);a++)if(j=Math.sqrt(_*_+k*k+A*A),_<0&&(j=-j),0!==j){for(a!==h?o.set(a,a-1,-j*l):u!==h&&o.set(a,a-1,-o.get(a,a-1)),_+=j,l=_/j,f=k/j,S=A/j,k/=_,A/=_,s=a;s<t;s++)_=o.get(a,s)+k*o.get(a+1,s),y&&(_+=A*o.get(a+2,s),o.set(a+2,s,o.get(a+2,s)-_*S)),o.set(a,s,o.get(a,s)-_*l),o.set(a+1,s,o.get(a+1,s)-_*f);for(i=0;i<=Math.min(x,a+3);i++)_=l*o.get(i,a)+f*o.get(i,a+1),y&&(_+=S*o.get(i,a+2),o.set(i,a+2,o.get(i,a+2)-_*A)),o.set(i,a,o.get(i,a)-_),o.set(i,a+1,o.get(i,a+1)-_*k);for(i=0;i<=b;i++)_=l*n.get(i,a)+f*n.get(i,a+1),y&&(_+=S*n.get(i,a+2),n.set(i,a+2,n.get(i,a+2)-_*A)),n.set(i,a,n.get(i,a)-_),n.set(i,a+1,n.get(i,a+1)-_*k)}}}if(0!==M){for(x=t-1;x>=0;x--)if(_=r[x],k=e[x],0===k)for(u=x,o.set(x,x,1),i=x-1;i>=0;i--){for(c=o.get(i,i)-_,A=0,s=u;s<=x;s++)A+=o.get(i,s)*o.get(s,x);if(e[i]<0)S=c,j=A;else if(u=i,0===e[i]?o.set(i,x,0!==c?-A/c:-A/(E*M)):(l=o.get(i,i+1),f=o.get(i+1,i),k=(r[i]-_)*(r[i]-_)+e[i]*e[i],d=(l*j-S*A)/k,o.set(i,x,d),o.set(i+1,x,Math.abs(l)>Math.abs(S)?(-A-c*d)/l:(-j-f*d)/S)),d=Math.abs(o.get(i,x)),E*d*d>1)for(s=i;s<=x;s++)o.set(s,x,o.get(s,x)/d)}else if(k<0)for(u=x-1,Math.abs(o.get(x,x-1))>Math.abs(o.get(x-1,x))?(o.set(x-1,x-1,k/o.get(x,x-1)),o.set(x-1,x,-(o.get(x,x)-_)/o.get(x,x-1))):(w=T(0,-o.get(x-1,x),o.get(x-1,x-1)-_,k),o.set(x-1,x-1,w[0]),o.set(x-1,x,w[1])),o.set(x,x-1,0),o.set(x,x,1),i=x-2;i>=0;i--){for(g=0,p=0,s=u;s<=x;s++)g+=o.get(i,s)*o.get(s,x-1),p+=o.get(i,s)*o.get(s,x);if(c=o.get(i,i)-_,e[i]<0)S=c,A=g,j=p;else if(u=i,0===e[i]?(w=T(-g,-p,c,k),o.set(i,x-1,w[0]),o.set(i,x,w[1])):(l=o.get(i,i+1),f=o.get(i+1,i),v=(r[i]-_)*(r[i]-_)+e[i]*e[i]-k*k,m=2*(r[i]-_)*k,0===v&&0===m&&(v=E*M*(Math.abs(c)+Math.abs(k)+Math.abs(l)+Math.abs(f)+Math.abs(S))),w=T(l*A-S*g+k*p,l*j-S*p-k*g,v,m),o.set(i,x-1,w[0]),o.set(i,x,w[1]),Math.abs(l)>Math.abs(S)+Math.abs(k)?(o.set(i+1,x-1,(-g-c*o.get(i,x-1)+k*o.get(i,x))/l),o.set(i+1,x,(-p-c*o.get(i,x)-k*o.get(i,x-1))/l)):(w=T(-A-f*o.get(i,x-1),-j-f*o.get(i,x),S,k),o.set(i+1,x-1,w[0]),o.set(i+1,x,w[1]))),d=Math.max(Math.abs(o.get(i,x-1)),Math.abs(o.get(i,x))),E*d*d>1)for(s=i;s<=x;s++)o.set(s,x-1,o.get(s,x-1)/d),o.set(s,x,o.get(s,x)/d)}for(i=0;i<t;i++)if(i<0||i>b)for(s=i;s<t;s++)n.set(i,s,o.get(i,s));for(s=t-1;s>=0;s--)for(i=0;i<=b;i++){for(S=0,a=0;a<=Math.min(s,b);a++)S+=n.get(i,a)*o.get(a,s);n.set(i,s,S)}}}(i,u,a,s,t)}this.n=i,this.e=u,this.d=a,this.V=s}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let t,e,r=this.n,n=this.e,o=this.d,i=new E(r,r);for(t=0;t<r;t++){for(e=0;e<r;e++)i.set(t,e,0);i.set(t,t,o[t]),n[t]>0?i.set(t,t+1,n[t]):n[t]<0&&i.set(t,t-1,n[t])}return i}}function T(t,e,r,n){let o,i;return Math.abs(r)>Math.abs(n)?(o=n/r,i=r+o*n,[(t+o*e)/i,(e-o*t)/i]):(o=r/n,i=n+o*r,[(o*t+e)/i,(o*e-t)/i])}class L{constructor(t){if(!(t=j.checkMatrix(t)).isSymmetric())throw new Error("Matrix is not symmetric");let e,r,n,o=t,i=o.rows,s=new E(i,i),a=!0;for(r=0;r<i;r++){let t=0;for(n=0;n<r;n++){let i=0;for(e=0;e<n;e++)i+=s.get(n,e)*s.get(r,e);i=(o.get(r,n)-i)/s.get(n,n),s.set(r,n,i),t+=i*i}for(t=o.get(r,r)-t,a&=t>0,s.set(r,r,Math.sqrt(Math.max(t,0))),n=r+1;n<i;n++)s.set(r,n,0)}this.L=s,this.positiveDefinite=Boolean(a)}isPositiveDefinite(){return this.positiveDefinite}solve(t){t=j.checkMatrix(t);let e=this.L,r=e.rows;if(t.rows!==r)throw new Error("Matrix dimensions do not match");if(!1===this.isPositiveDefinite())throw new Error("Matrix is not positive definite");let n,o,i,s=t.columns,a=t.clone();for(i=0;i<r;i++)for(o=0;o<s;o++){for(n=0;n<i;n++)a.set(i,o,a.get(i,o)-a.get(n,o)*e.get(i,n));a.set(i,o,a.get(i,o)/e.get(i,i))}for(i=r-1;i>=0;i--)for(o=0;o<s;o++){for(n=i+1;n<r;n++)a.set(i,o,a.get(i,o)-a.get(n,o)*e.get(n,i));a.set(i,o,a.get(i,o)/e.get(i,i))}return a}get lowerTriangularMatrix(){return this.L}}class F{constructor(t,e={}){t=j.checkMatrix(t);let{Y:r}=e;const{scaleScores:o=!1,maxIterations:i=1e3,terminationCriteria:s=1e-10}=e;let a;if(r){if(r=n.isAnyArray(r)&&"number"==typeof r[0]?E.columnVector(r):j.checkMatrix(r),r.rows!==t.rows)throw new Error("Y should have the same number of rows as X");a=r.getColumnVector(0)}else a=t.getColumnVector(0);let u,h,d,c,l=1;for(let e=0;e<i&&l>s;e++)d=t.transpose().mmul(a).div(a.transpose().mmul(a).get(0,0)),d=d.div(d.norm()),u=t.mmul(d).div(d.transpose().mmul(d).get(0,0)),e>0&&(l=u.clone().sub(c).pow(2).sum()),c=u.clone(),r?(h=r.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),h=h.div(h.norm()),a=r.mmul(h).div(h.transpose().mmul(h).get(0,0))):a=u;if(r){let e=t.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0));e=e.div(e.norm());let n=t.clone().sub(u.clone().mmul(e.transpose())),o=a.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),i=r.clone().sub(u.clone().mulS(o.get(0,0)).mmul(h.transpose()));this.t=u,this.p=e.transpose(),this.w=d.transpose(),this.q=h,this.u=a,this.s=u.transpose().mmul(u),this.xResidual=n,this.yResidual=i,this.betas=o}else this.w=d.transpose(),this.s=u.transpose().mmul(u).sqrt(),this.t=o?u.clone().div(this.s.get(0,0)):u,this.xResidual=t.sub(u.mmul(d.transpose()))}}e.y3=x,e.jy=L,e.oN=L,e.Hc=M,e.cg=P,e.hj=P,e.LU=S,e.Tb=S,e.uq=E,e.Zm=class extends _{constructor(t,e){p(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,r){return this.matrix.set(t,this.columnIndices[e],r),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}},e.Dq=class extends _{constructor(t,e){c(t,e),super(t,t.rows,1),this.column=e}set(t,e,r){return this.matrix.set(t,this.column,r),this}get(t){return this.matrix.get(t,this.column)}},e.__=class extends _{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(t,this.columns-e-1,r),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}},e.q0=class extends _{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(this.rows-t-1,e,r),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}},e.lh=class extends _{constructor(t,e){g(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,r){return this.matrix.set(this.rowIndices[t],e,r),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}},e.pI=class extends _{constructor(t,e){d(t,e),super(t,1,t.columns),this.row=e}set(t,e,r){return this.matrix.set(this.row,e,r),this}get(t,e){return this.matrix.get(this.row,e)}},e.zC=k,e.zg=class extends _{constructor(t,e,r,n,o){v(t,e,r,n,o),super(t,r-e+1,o-n+1),this.startRow=e,this.startColumn=n}set(t,e,r){return this.matrix.set(this.startRow+t,this.startColumn+e,r),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}},e.g6=class extends _{constructor(t){super(t,t.columns,t.rows)}set(t,e,r){return this.matrix.set(e,t,r),this}get(t,e){return this.matrix.get(e,t)}},e.OL=F,e.ks=F,e.QR=z,e.jp=z,e.mk=R,e.W2=R,e.l=N,e.KY=A,e.dv=j,e.BR=function(t,e=t,r={}){t=new E(t);let o=!1;if("object"!=typeof e||E.isMatrix(e)||n.isAnyArray(e)?e=new E(e):(r=e,e=t,o=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0,scale:s=!0}=r;i&&(t.center("column"),o||e.center("column")),s&&(t.scale("column"),o||e.scale("column"));const a=t.standardDeviation("column",{unbiased:!0}),u=o?a:e.standardDeviation("column",{unbiased:!0}),h=t.transpose().mmul(e);for(let e=0;e<h.rows;e++)for(let r=0;r<h.columns;r++)h.set(e,r,h.get(e,r)*(1/(a[e]*u[r]))*(1/(t.rows-1)));return h},e.Wu=function(t,e=t,r={}){t=new E(t);let o=!1;if("object"!=typeof e||E.isMatrix(e)||n.isAnyArray(e)?e=new E(e):(r=e,e=t,o=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0}=r;i&&(t=t.center("column"),o||(e=e.center("column")));const s=t.transpose().mmul(e);for(let e=0;e<s.rows;e++)for(let r=0;r<s.columns;r++)s.set(e,r,s.get(e,r)*(1/(t.rows-1)));return s},e.a4=function t(e){if((e=E.checkMatrix(e)).isSquare()){if(0===e.columns)return 1;let r,n,o,i;if(2===e.columns)return r=e.get(0,0),n=e.get(0,1),o=e.get(1,0),i=e.get(1,1),r*i-n*o;if(3===e.columns){let i,s,a;return i=new k(e,[1,2],[1,2]),s=new k(e,[1,2],[0,2]),a=new k(e,[1,2],[0,1]),r=e.get(0,0),n=e.get(0,1),o=e.get(0,2),r*t(i)-n*t(s)+o*t(a)}return new S(e).determinant}throw Error("determinant can only be calculated for a square matrix")},e.DI=function(t,e=!1){return t=j.checkMatrix(t),e?new R(t).inverse():I(t,E.eye(t.rows))},e.Jo=function(t,e={}){const{thresholdValue:r=1e-9,thresholdError:n=1e-9}=e;let o=(t=E.checkMatrix(t)).rows,i=new E(o,o);for(let e=0;e<o;e++){let s=E.columnVector(t.getRow(e)),a=t.subMatrixRow(C(o,e)).transpose(),u=new R(a).solve(s),h=E.sub(s,a.mmul(u)).abs().max();i.setRow(e,D(h,u,e,r,n))}return i},e.Zi=function(t,e=Number.EPSILON){if((t=E.checkMatrix(t)).isEmpty())return t.transpose();let r=new R(t,{autoTranspose:!0}),n=r.leftSingularVectors,o=r.rightSingularVectors,i=r.diagonal;for(let t=0;t<i.length;t++)Math.abs(i[t])>e?i[t]=1/i[t]:i[t]=0;return o.mmul(E.diag(i).mmul(n.transpose()))},e.kH=I,e.LV=function(t,e){if(n.isAnyArray(t))return t[0]&&n.isAnyArray(t[0])?new j(t):new A(t,e);throw new Error("the argument is not an array")}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={id:n,loaded:!1,exports:{}};return t[n](i,i.exports,r),i.loaded=!0,i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var n={};(()=>{"use strict";function t(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}function e(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}r.d(n,{calculateLayout:()=>Pn,stopLayout:()=>Dn}),Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;const o=function(){function t(){this._events={}}return t.prototype.on=function(t,e,r){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!r}),this},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.emit=function(t){for(var e=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=this._events[t]||[],i=this._events["*"]||[],s=function(n){for(var o=n.length,i=0;i<o;i++)if(n[i]){var s=n[i],a=s.callback;s.once&&(n.splice(i,1),0===n.length&&delete e._events[t],o--,i--),a.apply(e,r)}};s(o),s(i)},t.prototype.off=function(t,e){if(t)if(e){for(var r=this._events[t]||[],n=r.length,o=0;o<n;o++)r[o].callback===e&&(r.splice(o,1),n--,o--);0===r.length&&delete this._events[t]}else delete this._events[t];else this._events={};return this},t.prototype.getEvents=function(){return this._events},t}();function i(t,e,r,n){for(;t.length;){const o=t.shift();if(r(o))return!0;e.add(o.id),n(o.id).forEach((r=>{e.has(r.id)||(e.add(r.id),t.push(r))}))}return!1}function s(t,e,r,n){if(r(t))return!0;e.add(t.id);for(const o of n(t.id))if(!e.has(o.id)&&s(o,e,r,n))return!0;return!1}const a=()=>!0;class u{graph;nodeFilter;edgeFilter;cacheEnabled;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;allNodesMap=new Map;allEdgesMap=new Map;constructor(t){this.graph=t.graph;const e=t.nodeFilter||a,r=t.edgeFilter||a;this.nodeFilter=e,this.edgeFilter=t=>{const{source:n,target:o}=this.graph.getEdgeDetail(t.id);return!(!e(n)||!e(o))&&r(t,n,o)},"auto"===t.cache?(this.cacheEnabled=!0,this.startAutoCache()):"manual"===t.cache?this.cacheEnabled=!0:this.cacheEnabled=!1}clearCache=()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()};refreshCache=()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map((t=>t.id)))};updateCache=t=>{const e=new Set;t.forEach((t=>{const r=this.bothEdgesMap.get(t);if(r&&r.forEach((t=>e.add(t.id))),this.hasNode(t)){const r=this.graph.getRelatedEdges(t,"in").filter(this.edgeFilter),n=this.graph.getRelatedEdges(t,"out").filter(this.edgeFilter),o=Array.from(new Set([...r,...n]));o.forEach((t=>e.add(t.id))),this.inEdgesMap.set(t,r),this.outEdgesMap.set(t,n),this.bothEdgesMap.set(t,o),this.allNodesMap.set(t,this.graph.getNode(t))}else this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.bothEdgesMap.delete(t),this.allNodesMap.delete(t)})),e.forEach((t=>{this.hasEdge(t)?this.allEdgesMap.set(t,this.graph.getEdge(t)):this.allEdgesMap.delete(t)}))};startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}handleGraphChanged=t=>{const e=new Set;t.changes.forEach((r=>{switch(r.type){case"NodeAdded":case"NodeRemoved":e.add(r.value.id);break;case"NodeDataUpdated":e.add(r.id);break;case"EdgeAdded":case"EdgeRemoved":e.add(r.value.source),e.add(r.value.target);break;case"EdgeUpdated":"source"!==r.propertyName&&"target"!==r.propertyName||(e.add(r.oldValue),e.add(r.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(r.id)){const n=t.graph.getEdge(r.id);e.add(n.source),e.add(n.target)}}})),this.updateCache(e)};checkNodeExistence(t){this.getNode(t)}hasNode(t){if(!this.graph.hasNode(t))return!1;const e=this.graph.getNode(t);return this.nodeFilter(e)}areNeighbors(t,e){return this.checkNodeExistence(t),this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.graph.getNode(t);if(!this.nodeFilter(e))throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){return this.checkNodeExistence(t),this.cacheEnabled?"in"===e?this.inEdgesMap.get(t):"out"===e?this.outEdgesMap.get(t):this.bothEdgesMap.get(t):this.graph.getRelatedEdges(t,e).filter(this.edgeFilter)}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}hasEdge(t){if(!this.graph.hasEdge(t))return!1;const e=this.graph.getEdge(t);return this.edgeFilter(e)}getEdge(t){const e=this.graph.getEdge(t);if(!this.edgeFilter(e))throw new Error("Edge not found for id: "+t);return e}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}hasTreeStructure(t){return this.graph.hasTreeStructure(t)}getRoots(t){return this.graph.getRoots(t).filter(this.nodeFilter)}getChildren(t,e){return this.checkNodeExistence(t),this.graph.getChildren(t,e).filter(this.nodeFilter)}getParent(t,e){this.checkNodeExistence(t);const r=this.graph.getParent(t,e);return r&&this.nodeFilter(r)?r:null}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];i([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];s(this.getNode(t),new Set,e,n)}}class h extends o{nodeMap=new Map;edgeMap=new Map;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;treeIndices=new Map;changes=[];batchCount=0;onChanged=()=>{};constructor(t){super(),t&&(t.nodes&&this.addNodes(t.nodes),t.edges&&this.addEdges(t.edges),t.tree&&this.addTree(t.tree),t.onChanged&&(this.onChanged=t.onChanged))}batch=t=>{this.batchCount+=1,t(),this.batchCount-=1,this.batchCount||this.commit()};commit(){const t=this.changes;this.changes=[];const e={graph:this,changes:t};this.emit("changed",e),this.onChanged(e)}reduceChanges(t){let e=[];return t.forEach((t=>{switch(t.type){case"NodeRemoved":{let r=!1;e=e.filter((e=>{if("NodeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"NodeDataUpdated"===e.type?e.id!==t.value.id:"TreeStructureChanged"!==e.type||e.nodeId!==t.value.id})),r||e.push(t);break}case"EdgeRemoved":{let r=!1;e=e.filter((e=>{if("EdgeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"EdgeDataUpdated"!==e.type&&"EdgeUpdated"!==e.type||e.id!==t.value.id})),r||e.push(t);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const r=e.findIndex((e=>e.type===t.type&&e.id===t.id&&(void 0===t.propertyName||e.propertyName===t.propertyName))),n=e[r];n?void 0!==t.propertyName?n.newValue=t.newValue:(e.splice(r,1),e.push(t)):e.push(t);break}case"TreeStructureDetached":e=e.filter((e=>"TreeStructureAttached"===e.type?e.treeKey!==t.treeKey:"TreeStructureChanged"!==e.type||e.treeKey!==t.treeKey)),e.push(t);break;case"TreeStructureChanged":{const r=e.find((e=>"TreeStructureChanged"===e.type&&e.treeKey===t.treeKey&&e.nodeId===t.nodeId));r?r.newParentId=t.newParentId:e.push(t);break}default:e.push(t)}})),e}checkNodeExistence(t){this.getNode(t)}hasNode(t){return this.nodeMap.has(t)}areNeighbors(t,e){return this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.nodeMap.get(t);if(!e)throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),"in"===e){const e=this.inEdgesMap.get(t);return Array.from(e)}if("out"===e){const e=this.outEdgesMap.get(t);return Array.from(e)}{const e=this.bothEdgesMap.get(t);return Array.from(e)}}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}doAddNode(t){if(this.hasNode(t.id))throw new Error("Node already exists: "+t.id);this.nodeMap.set(t.id,t),this.inEdgesMap.set(t.id,new Set),this.outEdgesMap.set(t.id,new Set),this.bothEdgesMap.set(t.id,new Set),this.treeIndices.forEach((e=>{e.childrenMap.set(t.id,new Set)})),this.changes.push({type:"NodeAdded",value:t})}addNodes(t){this.batch((()=>{for(const e of t)this.doAddNode(e)}))}addNode(t){this.addNodes([t])}doRemoveNode(t){const e=this.getNode(t),r=this.bothEdgesMap.get(t);r?.forEach((t=>this.doRemoveEdge(t.id))),this.nodeMap.delete(t),this.treeIndices.forEach((e=>{e.childrenMap.get(t)?.forEach((t=>{e.parentMap.delete(t.id)})),e.parentMap.delete(t),e.childrenMap.delete(t)})),this.changes.push({type:"NodeRemoved",value:e})}removeNodes(t){this.batch((()=>{t.forEach((t=>this.doRemoveNode(t)))}))}removeNode(t){this.removeNodes([t])}updateNodeDataProperty(t,e,r){const n=this.getNode(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"NodeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}mergeNodeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateNodeDataProperty(t,e,r)}))}))}updateNodeData(...t){const e=t[0],r=this.getNode(e);if("string"==typeof t[1])return void this.updateNodeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"NodeDataUpdated",id:e,oldValue:t,newValue:o})}))}checkEdgeExistence(t){if(!this.hasEdge(t))throw new Error("Edge not found for id: "+t)}hasEdge(t){return this.edgeMap.has(t)}getEdge(t){return this.checkEdgeExistence(t),this.edgeMap.get(t)}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}doAddEdge(t){if(this.hasEdge(t.id))throw new Error("Edge already exists: "+t.id);this.checkNodeExistence(t.source),this.checkNodeExistence(t.target),this.edgeMap.set(t.id,t);const e=this.inEdgesMap.get(t.target),r=this.outEdgesMap.get(t.source),n=this.bothEdgesMap.get(t.source),o=this.bothEdgesMap.get(t.target);e.add(t),r.add(t),n.add(t),o.add(t),this.changes.push({type:"EdgeAdded",value:t})}addEdges(t){this.batch((()=>{for(const e of t)this.doAddEdge(e)}))}addEdge(t){this.addEdges([t])}doRemoveEdge(t){const e=this.getEdge(t),r=this.outEdgesMap.get(e.source),n=this.inEdgesMap.get(e.target),o=this.bothEdgesMap.get(e.source),i=this.bothEdgesMap.get(e.target);r.delete(e),n.delete(e),o.delete(e),i.delete(e),this.edgeMap.delete(t),this.changes.push({type:"EdgeRemoved",value:e})}removeEdges(t){this.batch((()=>{t.forEach((t=>this.doRemoveEdge(t)))}))}removeEdge(t){this.removeEdges([t])}updateEdgeSource(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.source,o=e;this.outEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.outEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.source=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"source",oldValue:n,newValue:o})}))}updateEdgeTarget(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.target,o=e;this.inEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.inEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.target=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"target",oldValue:n,newValue:o})}))}updateEdgeDataProperty(t,e,r){const n=this.getEdge(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"EdgeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}updateEdgeData(...t){const e=t[0],r=this.getEdge(e);if("string"==typeof t[1])return void this.updateEdgeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"EdgeDataUpdated",id:e,oldValue:t,newValue:o})}))}mergeEdgeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateEdgeDataProperty(t,e,r)}))}))}checkTreeExistence(t){if(!this.hasTreeStructure(t))throw new Error("Tree structure not found for treeKey: "+t)}hasTreeStructure(t){return this.treeIndices.has(t)}attachTreeStructure(t){this.treeIndices.has(t)||(this.treeIndices.set(t,{parentMap:new Map,childrenMap:new Map}),this.batch((()=>{this.changes.push({type:"TreeStructureAttached",treeKey:t})})))}detachTreeStructure(t){this.checkTreeExistence(t),this.treeIndices.delete(t),this.batch((()=>{this.changes.push({type:"TreeStructureDetached",treeKey:t})}))}addTree(t,e){this.batch((()=>{this.attachTreeStructure(e);const r=[],n=Array.isArray(t)?t:[t];for(;n.length;){const t=n.shift();r.push(t),t.children&&n.push(...t.children)}this.addNodes(r),r.forEach((t=>{t.children?.forEach((r=>{this.setParent(r.id,t.id,e)}))}))}))}getRoots(t){return this.checkTreeExistence(t),this.getAllNodes().filter((e=>!this.getParent(e.id,t)))}getChildren(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);const r=this.treeIndices.get(e).childrenMap.get(t);return Array.from(r||[])}getParent(t,e){return this.checkNodeExistence(t),this.checkTreeExistence(e),this.treeIndices.get(e).parentMap.get(t)||null}getAncestors(t,e){const r=[];let n,o=this.getNode(t);for(;n=this.getParent(o.id,e);)r.push(n),o=n;return r}setParent(t,e,r){this.checkTreeExistence(r);const n=this.treeIndices.get(r),o=this.getNode(t),i=n.parentMap.get(t);if(i?.id===e)return;if(void 0===e)return i&&n.childrenMap.get(i.id)?.delete(o),void n.parentMap.delete(t);const s=this.getNode(e);n.parentMap.set(t,s),i&&n.childrenMap.get(i.id)?.delete(o);let a=n.childrenMap.get(s.id);a||(a=new Set,n.childrenMap.set(s.id,a)),a.add(o),this.batch((()=>{this.changes.push({type:"TreeStructureChanged",treeKey:r,nodeId:t,oldParentId:i?.id,newParentId:s.id})}))}dfsTree(t,e,r){return s(this.getNode(t),new Set,e,(t=>this.getChildren(t,r)))}bfsTree(t,e,r){return i([this.getNode(t)],new Set,e,(t=>this.getChildren(t,r)))}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return i([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return s(this.getNode(t),new Set,e,n)}clone(){const t=this.getAllNodes().map((t=>({...t,data:{...t.data}}))),e=this.getAllEdges().map((t=>({...t,data:{...t.data}}))),r=new h({nodes:t,edges:e});return this.treeIndices.forEach((({parentMap:t,childrenMap:e},n)=>{const o=new Map;t.forEach(((t,e)=>{o.set(e,r.getNode(t.id))}));const i=new Map;e.forEach(((t,e)=>{i.set(e,new Set(Array.from(t).map((t=>r.getNode(t.id)))))})),r.treeIndices.set(n,{parentMap:o,childrenMap:i})})),r}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(t){return new u({graph:this,...t})}}var d={}.toString;const c=function(t,e){return d.call(t)==="[object "+e+"]"},l=function(t){return c(t,"Number")},f=(t,e)=>{if("next"!==t&&"prev"!==t)return e},g=t=>{t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev};class p{constructor(){const t={};t.prev=t,t.next=t.prev,this.shortcut=t}dequeue(){const t=this.shortcut,e=t.prev;if(e&&e!==t)return g(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&g(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e}toString(){const t=[],e=this.shortcut;let r=e.prev;for(;r!==e;)t.push(JSON.stringify(r,f)),r=null==r?void 0:r.prev;return`[${t.join(", ")}]`}}class v extends p{}const m=()=>1,y=(t,e,r,n,o)=>{var i,s;const a=[];return t.hasNode(n.v)&&(null===(i=t.getRelatedEdges(n.v,"in"))||void 0===i||i.forEach((n=>{const i=n.data.weight,s=t.getNode(n.source);o&&a.push({v:n.source,w:n.target,in:0,out:0}),void 0===s.data.out&&(s.data.out=0),s.data.out-=i,w(e,r,Object.assign({v:s.id},s.data))})),null===(s=t.getRelatedEdges(n.v,"out"))||void 0===s||s.forEach((n=>{const o=n.data.weight,i=n.target,s=t.getNode(i);void 0===s.data.in&&(s.data.in=0),s.data.in-=o,w(e,r,Object.assign({v:s.id},s.data))})),t.removeNode(n.v)),o?a:void 0},w=(t,e,r)=>{r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)},x=(t,e)=>{const r="greedy"===e?((t,e)=>{var r;if(t.getAllNodes().length<=1)return[];const n=((t,e)=>{const r=new h;let n=0,o=0;t.getAllNodes().forEach((t=>{r.addNode({id:t.id,data:{v:t.id,in:0,out:0}})})),t.getAllEdges().forEach((t=>{const i=r.getRelatedEdges(t.source,"out").find((e=>e.target===t.target)),s=(null==e?void 0:e(t))||1;i?r.updateEdgeData(null==i?void 0:i.id,Object.assign(Object.assign({},i.data),{weight:i.data.weight+s})):r.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:s}}),o=Math.max(o,r.getNode(t.source).data.out+=s),n=Math.max(n,r.getNode(t.target).data.in+=s)}));const i=[],s=o+n+3;for(let t=0;t<s;t++)i.push(new v);const a=n+1;return r.getAllNodes().forEach((t=>{w(i,a,Object.assign({v:t.id},r.getNode(t.id).data))})),{buckets:i,zeroIdx:a,graph:r}})(t,(t=>t.data.weight||1)||m);return null===(r=((t,e,r)=>{let n=[];const o=e[e.length-1],i=e[0];let s;for(;t.getAllNodes().length;){for(;s=i.dequeue();)y(t,e,r,s);for(;s=o.dequeue();)y(t,e,r,s);if(t.getAllNodes().length)for(let o=e.length-2;o>0;--o)if(s=e[o].dequeue(),s){n=n.concat(y(t,e,r,s,!0));break}}return n})(n.graph,n.buckets,n.zeroIdx).map((e=>t.getRelatedEdges(e.v,"out").filter((({target:t})=>t===e.w)))))||void 0===r?void 0:r.flat()})(t):b(t);null==r||r.forEach((e=>{const r=e.data;t.removeEdge(e.id),r.forwardName=e.data.name,r.reversed=!0,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign({},r)})}))},b=t=>{const e=[],r={},n={},o=i=>{n[i]||(n[i]=!0,r[i]=!0,t.getRelatedEdges(i,"out").forEach((t=>{r[t.target]?e.push(t):o(t.target)})),delete r[i])};return t.getAllNodes().forEach((t=>o(t.id))),e},E=(t,e,r,n)=>{let o;do{o=`${n}${Math.random()}`}while(t.hasNode(o));return r.dummy=e,t.addNode({id:o,data:r}),o},N=t=>{const e=new h;return t.getAllNodes().forEach((r=>{t.getChildren(r.id).length||e.addNode(Object.assign({},r))})),t.getAllEdges().forEach((t=>{e.addEdge(t)})),e},M=(t,e)=>{const r=Number(t.x),n=Number(t.y),o=Number(e.x)-r,i=Number(e.y)-n;let s,a,u=Number(t.width)/2,h=Number(t.height)/2;return o||i?(Math.abs(i)*u>Math.abs(o)*h?(i<0&&(h=-h),s=h*o/i,a=h):(o<0&&(u=-u),s=u,a=u*i/o),{x:r+s,y:n+a}):{x:0,y:0}},_=t=>{const e=[],r=A(t)+1;for(let t=0;t<r;t++)e.push([]);t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&e[r]&&e[r].push(t.id)}));for(let n=0;n<r;n++)e[n]=e[n].sort(((e,r)=>{return n=t.getNode(e).data.order,o=t.getNode(r).data.order,Number(n)-Number(o);var n,o}));return e},k=(t,e,r,n)=>{const o={width:0,height:0};return l(r)&&l(n)&&(o.rank=r,o.order=n),E(t,"border",o,e)},A=t=>{let e;return t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&(void 0===e||r>e)&&(e=r)})),e||(e=0),e},j=(t,e)=>t.reduce(((t,r)=>e(t)>e(r)?r:t)),S=(t,e,r,n,o,i)=>{n.includes(e.id)||(n.push(e.id),r||i.push(e.id),o(e.id).forEach((e=>S(t,e,r,n,o,i))),r&&i.push(e.id))},O=(t,e,r,n)=>{const o=Array.isArray(e)?e:[e],i=e=>n?t.getSuccessors(e):t.getNeighbors(e),s=[],a=[];return o.forEach((e=>{if(!t.hasNode(e.id))throw new Error(`Graph does not have node: ${e}`);S(t,e,"post"===r,a,i,s)})),s},z=(t,e,r,n,o,i)=>{const s={rank:i,borderType:e,width:0,height:0},a=o.data[e][i-1],u=E(t,"border",s,r);o.data[e][i]=u,t.setParent(u,n),a&&t.addEdge({id:`e${Math.random()}`,source:a,target:u,data:{weight:1}})},R=t=>{t.getAllNodes().forEach((t=>{I(t)})),t.getAllEdges().forEach((t=>{I(t)}))},I=t=>{const e=t.data.width;t.data.width=t.data.height,t.data.height=e},C=t=>{(null==t?void 0:t.y)&&(t.y=-t.y)},D=t=>{const e=t.x;t.x=t.y,t.y=e},P=(t,e,r,n,o,i,s)=>{const a=t.getChildren(s);if(!(null==a?void 0:a.length))return void(s!==e&&t.addEdge({id:`e${Math.random()}`,source:e,target:s,data:{weight:0,minlen:r}}));const u=k(t,"_bt"),h=k(t,"_bb"),d=t.getNode(s);t.setParent(u,s),d.data.borderTop=u,t.setParent(h,s),d.data.borderBottom=h,null==a||a.forEach((a=>{P(t,e,r,n,o,i,a.id);const d=a.data.borderTop?a.data.borderTop:a.id,c=a.data.borderBottom?a.data.borderBottom:a.id,l=a.data.borderTop?n:2*n,f=d!==c?1:o-i[s]+1;t.addEdge({id:`e${Math.random()}`,source:u,target:d,data:{minlen:f,weight:l,nestingEdge:!0}}),t.addEdge({id:`e${Math.random()}`,source:c,target:h,data:{minlen:f,weight:l,nestingEdge:!0}})})),t.getParent(s)||t.addEdge({id:`e${Math.random()}`,source:e,target:u,data:{weight:0,minlen:o+i[s]}})},T="edge-label",L=function(t){return Array.isArray?Array.isArray(t):c(t,"Array")};var F=function(t){if("object"!=typeof t||null===t)return t;var e;if(L(t)){e=[];for(var r=0,n=t.length;r<n;r++)"object"==typeof t[r]&&null!=t[r]?e[r]=F(t[r]):e[r]=t[r]}else for(var o in e={},t)"object"==typeof t[o]&&null!=t[o]?e[o]=F(t[o]):e[o]=t[o];return e};const q=F,V=(t,e,r)=>{const n=(s=r,a=r.map(((t,e)=>e)),null==s?void 0:s.reduce(((t,e,r)=>(t[e]=a[r],t)),{})),o=e.map((e=>{const r=t.getRelatedEdges(e,"out").map((t=>({pos:n[t.target]||0,weight:t.data.weight})));return null==r?void 0:r.sort(((t,e)=>t.pos-e.pos))})),i=o.flat().filter((t=>void 0!==t));var s,a;let u=1;for(;u<r.length;)u<<=1;const h=2*u-1;u-=1;const d=Array(h).fill(0,0,h);let c=0;return null==i||i.forEach((t=>{if(t){let e=t.pos+u;d[e]+=t.weight;let r=0;for(;e>0;)e%2&&(r+=d[e+1]),e=e-1>>1,d[e]+=t.weight;c+=t.weight*r}})),c},B=(t,e)=>{let r=0;for(let n=1;n<(null==e?void 0:e.length);n+=1)r+=V(t,e[n-1],e[n]);return r},$=t=>{const e={},r=t.getAllNodes(),n=r.map((t=>{var e;return null!==(e=t.data.rank)&&void 0!==e?e:-1/0})),o=Math.max(...n),i=[];for(let t=0;t<o+1;t++)i.push([]);const s=r.sort(((e,r)=>t.getNode(e.id).data.rank-t.getNode(r.id).data.rank)),a=s.filter((e=>void 0!==t.getNode(e.id).data.fixorder)).sort(((e,r)=>t.getNode(e.id).data.fixorder-t.getNode(r.id).data.fixorder));return null==a||a.forEach((r=>{isNaN(t.getNode(r.id).data.rank)||i[t.getNode(r.id).data.rank].push(r.id),e[r.id]=!0})),null==s||s.forEach((r=>t.dfsTree(r.id,(t=>{if(e.hasOwnProperty(t.id))return!0;e[t.id]=!0,isNaN(t.data.rank)||i[t.data.rank].push(t.id)})))),i},U=(t,e)=>{var r;let n=0,o=0;t.weight&&(n+=t.barycenter*t.weight,o+=t.weight),e.weight&&(n+=e.barycenter*e.weight,o+=e.weight),t.vs=null===(r=e.vs)||void 0===r?void 0:r.concat(t.vs),t.barycenter=n/o,t.weight=o,t.i=Math.min(e.i,t.i),e.merged=!0},G=(t,e)=>{var r,n,o;const i={};null==t||t.forEach(((t,e)=>{i[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};const r=i[t.v];void 0!==t.barycenter&&(r.barycenter=t.barycenter,r.weight=t.weight)})),null===(r=e.getAllEdges())||void 0===r||r.forEach((t=>{const e=i[t.source],r=i[t.target];void 0!==e&&void 0!==r&&(r.indegree++,e.out.push(i[t.target]))}));return(t=>{var e,r;const n=[];for(;null==t?void 0:t.length;){const o=t.pop();n.push(o),null===(e=o.in.reverse())||void 0===e||e.forEach((t=>{return(e=o,t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&U(e,t)})(t);var e})),null===(r=o.out)||void 0===r||r.forEach((e=>{return(r=o,e=>{e.in.push(r),0==--e.indegree&&t.push(e)})(e);var r}))}const o=n.filter((t=>!t.merged)),i=["vs","i","barycenter","weight"];return o.map((t=>{const e={};return null==i||i.forEach((r=>{void 0!==t[r]&&(e[r]=t[r])})),e}))})(null===(o=(n=Object.values(i)).filter)||void 0===o?void 0:o.call(n,(t=>!t.indegree)))},W=(t,e,r)=>{let n,o=r;for(;e.length&&(n=e[e.length-1]).i<=o;)e.pop(),null==t||t.push(n.vs),o++;return o},Y=(t,e,r,n,o,i)=>{var s,a,u,h;let d=t.getChildren(e).map((t=>t.id));const c=t.getNode(e),l=c?c.data.borderLeft:void 0,f=c?c.data.borderRight:void 0,g={};l&&(d=null==d?void 0:d.filter((t=>t!==l&&t!==f)));const p=((t,e)=>e.map((e=>{const r=t.getRelatedEdges(e,"in");if(!(null==r?void 0:r.length))return{v:e};const n={sum:0,weight:0};return null==r||r.forEach((e=>{const r=t.getNode(e.source);n.sum+=e.data.weight*r.data.order,n.weight+=e.data.weight})),{v:e,barycenter:n.sum/n.weight,weight:n.weight}})))(t,d||[]);null==p||p.forEach((e=>{var o;if(null===(o=t.getChildren(e.v))||void 0===o?void 0:o.length){const o=Y(t,e.v,r,n,i);g[e.v]=o,o.hasOwnProperty("barycenter")&&K(e,o)}}));const v=G(p,r);H(v,g),null===(s=v.filter((t=>t.vs.length>0)))||void 0===s||s.forEach((e=>{const r=t.getNode(e.vs[0]);r&&(e.fixorder=r.data.fixorder,e.order=r.data.order)}));const m=((t,e,r,n)=>{const o=((t,e)=>{const r={lhs:[],rhs:[]};return null==t||t.forEach((t=>{(t=>{const e=t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder);return n?!e&&t.hasOwnProperty("barycenter"):e||t.hasOwnProperty("barycenter")})(t)?r.lhs.push(t):r.rhs.push(t)})),r})(t),i=o.lhs,s=o.rhs.sort(((t,e)=>-t.i- -e.i)),a=[];let u=0,h=0,d=0;null==i||i.sort(((t,e)=>(r,n)=>{if(void 0!==r.fixorder&&void 0!==n.fixorder)return r.fixorder-n.fixorder;if(r.barycenter<n.barycenter)return-1;if(r.barycenter>n.barycenter)return 1;if(e&&void 0!==r.order&&void 0!==n.order){if(r.order<n.order)return-1;if(r.order>n.order)return 1}return t?n.i-r.i:r.i-n.i})(!!e,!!r)),d=W(a,s,d),null==i||i.forEach((t=>{var e;d+=null===(e=t.vs)||void 0===e?void 0:e.length,a.push(t.vs),u+=t.barycenter*t.weight,h+=t.weight,d=W(a,s,d)}));const c={vs:a.flat()};return h&&(c.barycenter=u/h,c.weight=h),c})(v,n,o,i);if(l&&(m.vs=[l,m.vs,f].flat(),null===(a=t.getPredecessors(l))||void 0===a?void 0:a.length)){const e=t.getNode((null===(u=t.getPredecessors(l))||void 0===u?void 0:u[0].id)||""),r=t.getNode((null===(h=t.getPredecessors(f))||void 0===h?void 0:h[0].id)||"");m.hasOwnProperty("barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+e.data.order+r.data.order)/(m.weight+2),m.weight+=2}return m},H=(t,e)=>{null==t||t.forEach((t=>{var r;const n=null===(r=t.vs)||void 0===r?void 0:r.map((t=>e[t]?e[t].vs:t));t.vs=n.flat()}))},K=(t,e)=>{void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)},J=(t,e,r)=>e.map((e=>((t,e,r)=>{const n=(t=>{let e;for(;t.hasNode(e=`_root${Math.random()}`););return e})(t),o=new h({tree:[{id:n,children:[],data:{}}]});return t.getAllNodes().forEach((i=>{const s=t.getParent(i.id);(i.data.rank===e||i.data.minRank<=e&&e<=i.data.maxRank)&&(o.hasNode(i.id)||o.addNode(Object.assign({},i)),(null==s?void 0:s.id)&&!o.hasNode(null==s?void 0:s.id)&&o.addNode(Object.assign({},s)),o.setParent(i.id,(null==s?void 0:s.id)||n),t.getRelatedEdges(i.id,r).forEach((e=>{const r=e.source===i.id?e.target:e.source;o.hasNode(r)||o.addNode(Object.assign({},t.getNode(r)));const n=o.getRelatedEdges(r,"out").find((({target:t})=>t===i.id)),s=void 0!==n?n.data.weight:0;n?o.updateEdgeData(n.id,Object.assign(Object.assign({},n.data),{weight:e.data.weight+s})):o.addEdge({id:e.id,source:r,target:i.id,data:{weight:e.data.weight+s}})})),i.data.hasOwnProperty("minRank")&&o.updateNodeData(i.id,Object.assign(Object.assign({},i.data),{borderLeft:i.data.borderLeft[e],borderRight:i.data.borderRight[e]})))})),o})(t,e,r))),Q=(t,e,r,n)=>{const o=new h;null==t||t.forEach((t=>{var i;const s=t.getRoots()[0].id,a=Y(t,s,o,e,r,n);for(let e=0;e<(null===(i=a.vs)||void 0===i?void 0:i.length);e++){const r=t.getNode(a.vs[e]);r&&(r.data.order=e)}((t,e,r)=>{const n={};let o;null==r||r.forEach((r=>{let i,s,a=t.getParent(r);for(;a;){if(i=t.getParent(a.id),i?(s=n[i.id],n[i.id]=a.id):(s=o,o=a.id),s&&s!==a.id)return e.hasNode(s)||e.addNode({id:s,data:{}}),e.hasNode(a.id)||e.addNode({id:a.id,data:{}}),void(e.hasEdge(`e${s}-${a.id}`)||e.addEdge({id:`e${s}-${a.id}`,source:s,target:a.id,data:{}}));a=i}}))})(t,o,a.vs)}))},X=(t,e)=>{null==e||e.forEach((e=>{null==e||e.forEach(((e,r)=>{t.getNode(e).data.order=r}))}))},Z=(t,e)=>{var r,n;if(null===(r=t.getNode(e))||void 0===r?void 0:r.data.dummy)return null===(n=t.getPredecessors(e))||void 0===n?void 0:n.find((e=>t.getNode(e.id).data.dummy))},tt=(t,e,r)=>{let n=e,o=r;if(n>o){const t=n;n=o,o=t}let i=t[n];i||(t[n]=i={}),i[o]=!0},et=(t,e,r)=>{let n=e,o=r;return n>r&&(n=r,o=e),!!t[n]},rt=(t,e,r,n,o,i)=>{const s=new h,a=nt(n,o,i);return null==e||e.forEach((e=>{let n;null==e||e.forEach((e=>{const o=r[e];if(s.hasNode(o)||s.addNode({id:o,data:{}}),n){const i=r[n],u=s.getRelatedEdges(i,"out").find((t=>t.target===o));u?s.updateEdgeData(u.id,Object.assign(Object.assign({},u.data),{weight:Math.max(a(t,e,n),u.data.weight||0)})):s.addEdge({id:`e${Math.random()}`,source:i,target:o,data:{weight:Math.max(a(t,e,n),0)}})}n=e}))})),s};const nt=(t,e,r)=>(n,o,i)=>{const s=n.getNode(o),a=n.getNode(i);let u=0,h=0;if(u+=s.data.width/2,s.data.hasOwnProperty("labelpos"))switch((s.data.labelpos||"").toLowerCase()){case"l":h=-s.data.width/2;break;case"r":h=s.data.width/2}if(h&&(u+=r?h:-h),h=0,u+=(s.data.dummy?e:t)/2,u+=(a.data.dummy?e:t)/2,u+=a.data.width/2,a.data.labelpos)switch((a.data.labelpos||"").toLowerCase()){case"l":h=a.data.width/2;break;case"r":h=-a.data.width/2}return h&&(u+=r?h:-h),h=0,u},ot=(t,e)=>t.getNode(e).data.width||0,it=(t,e)=>{var r;const n=N(t);((t,e)=>{const{ranksep:r=0}=e||{},n=_(t);let o=0;null==n||n.forEach((e=>{const n=e.map((e=>t.getNode(e).data.height)),i=Math.max(...n,0);null==e||e.forEach((e=>{t.getNode(e).data.y=o+i/2})),o+=i+r}))})(n,e);const o=((t,e)=>{const{align:r,nodesep:n=0,edgesep:o=0}=e||{},i=_(t),s=Object.assign(((t,e)=>{const r={};return(null==e?void 0:e.length)&&e.reduce(((e,n)=>{let o=0,i=0;const s=e.length,a=null==n?void 0:n[(null==n?void 0:n.length)-1];return null==n||n.forEach(((e,u)=>{var h;const d=Z(t,e),c=d?t.getNode(d.id).data.order:s;(d||e===a)&&(null===(h=n.slice(i,u+1))||void 0===h||h.forEach((e=>{var n;null===(n=t.getPredecessors(e))||void 0===n||n.forEach((n=>{var i;const s=t.getNode(n.id),a=s.data.order;!(a<o||c<a)||s.data.dummy&&(null===(i=t.getNode(e))||void 0===i?void 0:i.data.dummy)||tt(r,n.id,e)}))})),i=u+1,o=c)})),n})),r})(t,i),((t,e)=>{const r={};function n(e,n){const o=function(t){return JSON.stringify(t.slice(1))}(e);n.get(o)||(function(e,n,o,i,s){var a,u;let h;for(let d=n;d<o;d++)h=e[d],(null===(a=t.getNode(h))||void 0===a?void 0:a.data.dummy)&&(null===(u=t.getPredecessors(h))||void 0===u||u.forEach((e=>{const n=t.getNode(e.id);n.data.dummy&&(n.data.order<i||n.data.order>s)&&tt(r,e.id,h)})))}(...e),n.set(o,!0))}return(null==e?void 0:e.length)&&e.reduce(((e,r)=>{let o,i=-1,s=0;const a=new Map;return null==r||r.forEach(((u,h)=>{var d;if("border"===(null===(d=t.getNode(u))||void 0===d?void 0:d.data.dummy)){const e=t.getPredecessors(u)||[];e.length&&(o=t.getNode(e[0].id).data.order,n([r,s,h,i,o],a),s=h,i=o)}n([r,s,r.length,o,e.length],a)})),r})),r})(t,i)),a={};let u=[];["u","d"].forEach((e=>{u="u"===e?i:Object.values(i).reverse(),["l","r"].forEach((r=>{"r"===r&&(u=u.map((t=>Object.values(t).reverse())));const i=("u"===e?t.getPredecessors:t.getSuccessors).bind(t),h=((t,e,r,n)=>{const o={},i={},s={};return null==e||e.forEach((t=>{null==t||t.forEach(((t,e)=>{o[t]=t,i[t]=t,s[t]=e}))})),null==e||e.forEach((t=>{let e=-1;null==t||t.forEach((t=>{let a=n(t).map((t=>t.id));if(a.length){a=a.sort(((t,e)=>s[t]-s[e]));const n=(a.length-1)/2;for(let u=Math.floor(n),h=Math.ceil(n);u<=h;++u){const n=a[u];i[t]===t&&e<s[n]&&!et(r,t,n)&&(i[n]=t,i[t]=o[t]=o[n],e=s[n])}}}))})),{root:o,align:i}})(0,u,s,i),d=((t,e,r,n,o,i,s)=>{var a;const u={},h=rt(t,e,r,o,i,s),d=s?"borderLeft":"borderRight",c=(t,e)=>{let r=h.getAllNodes(),n=r.pop();const o={};for(;n;)o[n.id]?t(n.id):(o[n.id]=!0,r.push(n),r=r.concat(e(n.id))),n=r.pop()};return c((t=>{u[t]=(h.getRelatedEdges(t,"in")||[]).reduce(((t,e)=>Math.max(t,(u[e.source]||0)+e.data.weight)),0)}),h.getPredecessors.bind(h)),c((e=>{const r=(h.getRelatedEdges(e,"out")||[]).reduce(((t,e)=>Math.min(t,(u[e.target]||0)-e.data.weight)),Number.POSITIVE_INFINITY),n=t.getNode(e);r!==Number.POSITIVE_INFINITY&&n.data.borderType!==d&&(u[e]=Math.max(u[e],r))}),h.getSuccessors.bind(h)),null===(a=Object.values(n))||void 0===a||a.forEach((t=>{u[t]=u[r[t]]})),u})(t,u,h.root,h.align,n,o,"r"===r);"r"===r&&Object.keys(d).forEach((t=>d[t]=-d[t])),a[e+r]=d}))}));const h=((t,e)=>j(Object.values(e),(e=>{var r;let n=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return null===(r=Object.keys(e))||void 0===r||r.forEach((r=>{const i=e[r],s=ot(t,r)/2;n=Math.max(i+s,n),o=Math.min(i-s,o)})),n-o})))(t,a);return h&&function(t,e){const r=Object.values(e),n=Math.min(...r),o=Math.max(...r);["u","d"].forEach((r=>{["l","r"].forEach((i=>{const s=r+i,a=t[s];let u;if(a===e)return;const h=Object.values(a);u="l"===i?n-Math.min(...h):o-Math.max(...h),u&&(t[s]={},Object.keys(a).forEach((e=>{t[s][e]=a[e]+u})))}))}))}(a,h),((t,e)=>{const r={};return Object.keys(t.ul).forEach((n=>{if(e)r[n]=t[e.toLowerCase()][n];else{const e=Object.values(t).map((t=>t[n]));r[n]=(e[0]+e[1])/2}})),r})(a,r)})(n,e);null===(r=Object.keys(o))||void 0===r||r.forEach((t=>{n.getNode(t).data.x=o[t]}))},st=t=>{const e={},r=n=>{var o;const i=t.getNode(n);if(!i)return 0;if(e[n])return i.data.rank;let s;return e[n]=!0,null===(o=t.getRelatedEdges(n,"out"))||void 0===o||o.forEach((t=>{const e=r(t.target)-t.data.minlen;e&&(void 0===s||e<s)&&(s=e)})),s||(s=0),i.data.rank=s,s};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>r(t.id)))},at=(t,e)=>t.getNode(e.target).data.rank-t.getNode(e.source).data.rank-e.data.minlen,ut=(t,e)=>{const r=n=>{e.getRelatedEdges(n,"both").forEach((o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||at(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},ht=(t,e)=>{const r=n=>{var o;null===(o=e.getRelatedEdges(n,"both"))||void 0===o||o.forEach((o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||void 0===e.getNode(s).data.layer&&at(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},dt=(t,e)=>j(e.getAllEdges(),(r=>t.hasNode(r.source)!==t.hasNode(r.target)?at(e,r):1/0)),ct=(t,e,r)=>{t.getAllNodes().forEach((t=>{const n=e.getNode(t.id);n.data.rank||(n.data.rank=0),n.data.rank+=r}))},lt=(t,e)=>{let r=O(t,t.getAllNodes(),"post",!1);r=r.slice(0,(null==r?void 0:r.length)-1),r.forEach((r=>{ft(t,e,r)}))},ft=(t,e,r)=>{const n=t.getNode(r).data.parent;t.getRelatedEdges(r,"both").find((t=>t.target===n||t.source===n)).data.cutvalue=gt(t,e,r)},gt=(t,e,r)=>{const n=t.getNode(r).data.parent;let o=!0,i=e.getRelatedEdges(r,"out").find((t=>t.target===n)),s=0;return i||(o=!1,i=e.getRelatedEdges(n,"out").find((t=>t.target===r))),s=i.data.weight,e.getRelatedEdges(r,"both").forEach((e=>{const i=e.source===r,a=i?e.target:e.source;if(a!==n){const n=i===o,u=e.data.weight;if(s+=n?u:-u,bt(t,r,a)){const e=t.getRelatedEdges(r,"both").find((t=>t.source===a||t.target===a)).data.cutvalue;s+=n?-e:e}}})),s},pt=(t,e=t.getAllNodes()[0].id)=>{vt(t,{},1,e)},vt=(t,e,r,n,o)=>{var i;const s=r;let a=r;const u=t.getNode(n);return e[n]=!0,null===(i=t.getNeighbors(n))||void 0===i||i.forEach((r=>{e[r.id]||(a=vt(t,e,a,r.id,n))})),u.data.low=s,u.data.lim=a++,o?u.data.parent=o:delete u.data.parent,a},mt=t=>t.getAllEdges().find((t=>t.data.cutvalue<0)),yt=(t,e,r)=>{let n=r.source,o=r.target;e.getRelatedEdges(n,"out").find((t=>t.target===o))||(n=r.target,o=r.source);const i=t.getNode(n),s=t.getNode(o);let a=i,u=!1;i.data.lim>s.data.lim&&(a=s,u=!0);const h=e.getAllEdges().filter((e=>u===Et(t.getNode(e.source),a)&&u!==Et(t.getNode(e.target),a)));return j(h,(t=>at(e,t)))},wt=(t,e,r,n)=>{const o=t.getRelatedEdges(r.source,"both").find((t=>t.source===r.target||t.target===r.target));o&&t.removeEdge(o.id),t.addEdge({id:`e${Math.random()}`,source:n.source,target:n.target,data:{}}),pt(t),lt(t,e),xt(t,e)},xt=(t,e)=>{const r=t.getAllNodes().find((t=>!t.data.parent));let n=O(t,r,"pre",!1);n=n.slice(1),n.forEach((r=>{const n=t.getNode(r).data.parent;let o=e.getRelatedEdges(r,"out").find((t=>t.target===n)),i=!1;!o&&e.hasNode(n)&&(o=e.getRelatedEdges(n,"out").find((t=>t.target===r)),i=!0),e.getNode(r).data.rank=(e.hasNode(n)&&e.getNode(n).data.rank||0)+(i?null==o?void 0:o.data.minlen:-(null==o?void 0:o.data.minlen))}))},bt=(t,e,r)=>t.getRelatedEdges(e,"both").find((t=>t.source===r||t.target===r)),Et=(t,e)=>e.data.low<=t.data.lim&&t.data.lim<=e.data.lim,Nt=st,Mt=t=>{(t=>{const e=(t=>{const e=new h;return t.getAllNodes().forEach((t=>{e.addNode(Object.assign({},t))})),t.getAllEdges().forEach((t=>{const r=e.getRelatedEdges(t.source,"out").find((e=>e.target===t.target));r?e.updateEdgeData(null==r?void 0:r.id,Object.assign(Object.assign({},r.data),{weight:r.data.weight+t.data.weight||0,minlen:Math.max(r.data.minlen,t.data.minlen||1)})):e.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||0,minlen:t.data.minlen||1}})})),e})(t);st(e);const r=(t=>{const e=new h({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);ut(e,t)<n;)o=dt(e,t),i=e.hasNode(o.source)?at(t,o):-at(t,o),ct(e,t,i);return e})(e);let n,o;for(pt(r),lt(r,e);n=mt(r);)o=yt(r,e,n),wt(r,e,n,o)})(t)},_t=(t,e)=>{const{acyclicer:r,ranker:n,rankdir:o="tb",nodeOrder:i,keepNodeOrder:s,align:a,nodesep:u=50,edgesep:d=20,ranksep:c=50}=e;Ft(t),x(t,r);const{nestingRoot:l,nodeRankFactor:f}=(t=>{const e=E(t,"root",{},"_root"),r=(t=>{const e={},r=(n,o)=>{const i=t.getChildren(n);null==i||i.forEach((t=>r(t.id,o+1))),e[n]=o};return t.getRoots().forEach((t=>r(t.id,1))),e})(t);let n=Math.max(...Object.values(r));Math.abs(n)===1/0&&(n=1);const o=n-1,i=2*o+1;t.getAllEdges().forEach((t=>{t.data.minlen*=i}));const s=(t=>{let e=0;return t.getAllEdges().forEach((t=>{e+=t.data.weight})),e})(t)+1;return t.getRoots().forEach((n=>{P(t,e,i,s,o,r,n.id)})),{nestingRoot:e,nodeRankFactor:i}})(t);((t,e)=>{switch(e){case"network-simplex":Mt(t);break;case"tight-tree":default:(t=>{(t=>{const e={};let r;const n=o=>{var i;const s=t.getNode(o);if(!s)return 0;if(e[o])return s.data.rank;let a;return e[o]=!0,null===(i=t.getRelatedEdges(o,"out"))||void 0===i||i.forEach((t=>{const e=n(t.target)-t.data.minlen;e&&(void 0===a||e<a)&&(a=e)})),a||(a=0),(void 0===r||a<r)&&(r=a),s.data.rank=a,a};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>{t&&n(t.id)})),void 0===r&&(r=0);const o={},i=(e,r)=>{var n;const s=t.getNode(e),a=isNaN(s.data.layer)?r:s.data.layer;(void 0===s.data.rank||s.data.rank<a)&&(s.data.rank=a),o[e]||(o[e]=!0,null===(n=t.getRelatedEdges(e,"out"))||void 0===n||n.forEach((t=>{i(t.target,a+t.data.minlen)})))};t.getAllNodes().forEach((t=>{const e=t.data;e&&(isNaN(e.layer)?e.rank-=r:i(t.id,e.layer))}))})(t),(t=>{const e=new h({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);ht(e,t)<n;)o=dt(e,t),i=e.hasNode(o.source)?at(t,o):-at(t,o),ct(e,t,i)})(t)})(t);break;case"longest-path":Nt(t)}})(N(t),n),zt(t),((t,e=0)=>{const r=t.getAllNodes(),n=r.filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),o=Math.min(...n),i=[];r.forEach((t=>{const e=(t.data.rank||0)-o;i[e]||(i[e]=[]),i[e].push(t.id)}));let s=0;for(let r=0;r<i.length;r++){const n=i[r];void 0===n?r%e!=0&&(s-=1):s&&(null==n||n.forEach((e=>{const r=t.getNode(e);r&&(r.data.rank=r.data.rank||0,r.data.rank+=s)})))}})(t,f),((t,e)=>{e&&t.removeNode(e),t.getAllEdges().forEach((e=>{e.data.nestingEdge&&t.removeEdge(e.id)}))})(t,l),(t=>{const e=t.getAllNodes().filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),r=Math.min(...e);t.getAllNodes().forEach((t=>{t.data.hasOwnProperty("rank")&&r!==1/0&&(t.data.rank-=r)}))})(t),Rt(t),It(t);const g=[];((t,e)=>{t.getAllEdges().forEach((r=>((t,e,r)=>{let n=e.source,o=t.getNode(n).data.rank;const i=e.target,s=t.getNode(i).data.rank,a=e.data.labelRank;if(s===o+1)return;let u,h,d;for(t.removeEdge(e.id),d=0,++o;o<s;++d,++o)e.data.points=[],h={originalEdge:e,width:0,height:0,rank:o},u=E(t,"edge",h,"_d"),o===a&&(h.width=e.data.width,h.height=e.data.height,h.dummy=T,h.labelpos=e.data.labelpos),t.addEdge({id:`e${Math.random()}`,source:n,target:u,data:{weight:e.data.weight}}),0===d&&r.push(u),n=u;t.addEdge({id:`e${Math.random()}`,source:n,target:i,data:{weight:e.data.weight}})})(t,r,e)))})(t,g),((t,e)=>{const r=(t=>{const e={};let r=0;const n=o=>{const i=r;t.getChildren(o).forEach((t=>n(t.id))),e[o]={low:i,lim:r++}};return t.getRoots().forEach((t=>n(t.id))),e})(t);e.forEach((e=>{var n,o;let i=e,s=t.getNode(i);const a=s.data.originalEdge;if(!a)return;const u=((t,e,r,n)=>{var o,i;const s=[],a=[],u=Math.min(e[r].low,e[n].low),h=Math.max(e[r].lim,e[n].lim);let d,c;d=r;do{d=null===(o=t.getParent(d))||void 0===o?void 0:o.id,s.push(d)}while(d&&(e[d].low>u||h>e[d].lim));for(c=d,d=n;d&&d!==c;)a.push(d),d=null===(i=t.getParent(d))||void 0===i?void 0:i.id;return{lca:c,path:s.concat(a.reverse())}})(t,r,a.source,a.target),h=u.path,d=u.lca;let c=0,l=h[c],f=!0;for(;i!==a.target;){if(s=t.getNode(i),f){for(;l!==d&&(null===(n=t.getNode(l))||void 0===n?void 0:n.data.maxRank)<s.data.rank;)c++,l=h[c];l===d&&(f=!1)}if(!f){for(;c<h.length-1&&(null===(o=t.getNode(h[c+1]))||void 0===o?void 0:o.data.minRank)<=s.data.rank;)c++;l=h[c]}t.hasNode(l)&&t.setParent(i,l),i=t.getSuccessors(i)[0].id}}))})(t,g),(t=>{const e=r=>{const n=t.getChildren(r),o=t.getNode(r);if((null==n?void 0:n.length)&&n.forEach((t=>e(t.id))),o.data.hasOwnProperty("minRank")){o.data.borderLeft=[],o.data.borderRight=[];for(let e=o.data.minRank,n=o.data.maxRank+1;e<n;e+=1)z(t,"borderLeft","_bl",r,o,e),z(t,"borderRight","_br",r,o,e)}};t.getRoots().forEach((t=>e(t.id)))})(t),s&&((t,e)=>{const r=t.getAllNodes().filter((e=>{var r;return!(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length)})).map((t=>t.data.rank)),n=Math.max(...r),o=[];for(let t=0;t<n+1;t++)o[t]=[];null==e||e.forEach((e=>{const r=t.getNode(e);r&&!r.data.dummy&&(isNaN(r.data.rank)||(r.data.fixorder=o[r.data.rank].length,o[r.data.rank].push(e)))}))})(t,i),((t,e)=>{const r=A(t),n=[],o=[];for(let t=1;t<r+1;t++)n.push(t);for(let t=r-1;t>-1;t--)o.push(t);const i=J(t,n,"in"),s=J(t,o,"out");let a=$(t);X(t,a);let u,h=Number.POSITIVE_INFINITY;for(let r=0,n=0;n<4;++r,++n){Q(r%2?i:s,r%4>=2,!1,e),a=_(t);const o=B(t,a);o<h&&(n=0,u=q(a),h=o)}a=$(t),X(t,a);for(let r=0,n=0;n<4;++r,++n){Q(r%2?i:s,r%4>=2,!0,e),a=_(t);const o=B(t,a);o<h&&(n=0,u=q(a),h=o)}X(t,u)})(t,s),qt(t),((t,e)=>{const r=e.toLowerCase();"lr"!==r&&"rl"!==r||R(t)})(t,o),it(t,{align:a,nodesep:u,edgesep:d,ranksep:c}),Vt(t),Lt(t),((t,e)=>{e.forEach((e=>{let r=t.getNode(e);const{data:n}=r,o=n.originalEdge;let i;o&&t.addEdge(o);let s=e;for(;r.data.dummy;)i=t.getSuccessors(s)[0],t.removeNode(s),o.data.points.push({x:r.data.x,y:r.data.y}),r.data.dummy===T&&(o.data.x=r.data.x,o.data.y=r.data.y,o.data.width=r.data.width,o.data.height=r.data.height),s=i.id,r=t.getNode(s)}))})(t,g),Pt(t),((t,e)=>{const r=e.toLowerCase();"bt"!==r&&"rl"!==r||(t=>{t.getAllNodes().forEach((t=>{C(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>C(t))),t.data.hasOwnProperty("y")&&C(t.data)}))})(t),"lr"!==r&&"rl"!==r||((t=>{t.getAllNodes().forEach((t=>{D(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>D(t))),t.data.hasOwnProperty("x")&&D(t.data)}))})(t),R(t))})(t,o);const{width:p,height:v}=Ct(t);return Dt(t),Tt(t),(t=>{t.getAllEdges().forEach((e=>{const r=e.data;if(r.reversed){t.removeEdge(e.id);const n=r.forwardName;delete r.reversed,delete r.forwardName,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign(Object.assign({},r),{forwardName:n})})}}))})(t),{width:p,height:v}},kt=["width","height","layer","fixorder"],At={width:0,height:0},jt=["minlen","weight","width","height","labeloffset"],St={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ot=["labelpos"],zt=t=>{t.getAllEdges().forEach((e=>{if(e.data.width&&e.data.height){const r=t.getNode(e.source),n={e,rank:(t.getNode(e.target).data.rank-r.data.rank)/2+r.data.rank};E(t,"edge-proxy",n,"_ep")}}))},Rt=t=>{let e=0;return t.getAllNodes().forEach((r=>{var n,o;r.data.borderTop&&(r.data.minRank=null===(n=t.getNode(r.data.borderTop))||void 0===n?void 0:n.data.rank,r.data.maxRank=null===(o=t.getNode(r.data.borderBottom))||void 0===o?void 0:o.data.rank,e=Math.max(e,r.data.maxRank||-1/0))})),e},It=t=>{t.getAllNodes().forEach((e=>{"edge-proxy"===e.data.dummy&&(t.getEdge(e.data.e.id).data.labelRank=e.data.rank,t.removeNode(e.id))}))},Ct=(t,e)=>{let r,n,o=0,i=0;const{marginx:s=0,marginy:a=0}=e||{},u=t=>{if(!t.data)return;const e=t.data.x,s=t.data.y,a=t.data.width,u=t.data.height;isNaN(e)||isNaN(a)||(void 0===r&&(r=e-a/2),r=Math.min(r,e-a/2),o=Math.max(o,e+a/2)),isNaN(s)||isNaN(u)||(void 0===n&&(n=s-u/2),n=Math.min(n,s-u/2),i=Math.max(i,s+u/2))};return t.getAllNodes().forEach((t=>{u(t)})),t.getAllEdges().forEach((t=>{(null==t?void 0:t.data.hasOwnProperty("x"))&&u(t)})),r-=s,n-=a,t.getAllNodes().forEach((t=>{t.data.x-=r,t.data.y-=n})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>{t.x-=r,t.y-=n})),t.data.hasOwnProperty("x")&&(t.data.x-=r),t.data.hasOwnProperty("y")&&(t.data.y-=n)})),{width:o-r+s,height:i-n+a}},Dt=t=>{t.getAllEdges().forEach((e=>{const r=t.getNode(e.source),n=t.getNode(e.target);let o,i;e.data.points?(o=e.data.points[0],i=e.data.points[e.data.points.length-1]):(e.data.points=[],o={x:n.data.x,y:n.data.y},i={x:r.data.x,y:r.data.y}),e.data.points.unshift(M(r.data,o)),e.data.points.push(M(n.data,i))}))},Pt=t=>{t.getAllEdges().forEach((t=>{if(t.data.hasOwnProperty("x"))switch("l"!==t.data.labelpos&&"r"!==t.data.labelpos||(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset}}))},Tt=t=>{t.getAllEdges().forEach((t=>{var e;t.data.reversed&&(null===(e=t.data.points)||void 0===e||e.reverse())}))},Lt=t=>{t.getAllNodes().forEach((e=>{var r,n,o;if(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length){const r=t.getNode(e.id),i=t.getNode(r.data.borderTop),s=t.getNode(r.data.borderBottom),a=t.getNode(r.data.borderLeft[(null===(n=r.data.borderLeft)||void 0===n?void 0:n.length)-1]),u=t.getNode(r.data.borderRight[(null===(o=r.data.borderRight)||void 0===o?void 0:o.length)-1]);r.data.width=Math.abs((null==u?void 0:u.data.x)-(null==a?void 0:a.data.x))||10,r.data.height=Math.abs((null==s?void 0:s.data.y)-(null==i?void 0:i.data.y))||10,r.data.x=((null==a?void 0:a.data.x)||0)+r.data.width/2,r.data.y=((null==i?void 0:i.data.y)||0)+r.data.height/2}})),t.getAllNodes().forEach((e=>{"border"===e.data.dummy&&t.removeNode(e.id)}))},Ft=t=>{t.getAllEdges().forEach((e=>{if(e.source===e.target){const r=t.getNode(e.source);r.data.selfEdges||(r.data.selfEdges=[]),r.data.selfEdges.push(e),t.removeEdge(e.id)}}))},qt=t=>{const e=_(t);null==e||e.forEach((e=>{let r=0;null==e||e.forEach(((e,n)=>{var o;const i=t.getNode(e);i.data.order=n+r,null===(o=i.data.selfEdges)||void 0===o||o.forEach((e=>{E(t,"selfedge",{width:e.data.width,height:e.data.height,rank:i.data.rank,order:n+ ++r,e},"_se")})),delete i.data.selfEdges}))}))},Vt=t=>{t.getAllNodes().forEach((e=>{const r=t.getNode(e.id);if("selfedge"===r.data.dummy){const n=t.getNode(r.data.e.source),o=n.data.x+n.data.width/2,i=n.data.y,s=r.data.x-o,a=n.data.height/2;t.hasEdge(r.data.e.id)?t.updateEdgeData(r.data.e.id,r.data.e.data):t.addEdge({id:r.data.e.id,source:r.data.e.source,target:r.data.e.target,data:r.data.e.data}),t.removeNode(e.id),r.data.e.data.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{y:i,x:o+s},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.data.e.data.x=r.data.x,r.data.e.data.y=r.data.y}}))},Bt=(t,e)=>{const r={};return null==e||e.forEach((e=>{void 0!==t[e]&&(r[e]=+t[e])})),r},$t=(t={})=>{const e={};return Object.keys(t).forEach((r=>{e[r.toLowerCase()]=t[r]})),e},Ut=function(t){return"function"==typeof t},Gt=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};function Wt(t,e){let r;return r=Ut(e)?e:l(e)?()=>e:()=>t,r}function Yt(t,e,r=!0){return e||0===e?Ut(e)?e:l(e)?()=>e:Array.isArray(e)?()=>{if(r){const r=Math.max(...e);return isNaN(r)?t:r}return e}:Gt(e)?()=>{if(r){const r=Math.max(e.width,e.height);return isNaN(r)?t:r}return[e.width,e.height]}:()=>t:e=>{const{size:r}=e.data||{};return r?Array.isArray(r)?r[0]>r[1]?r[0]:r[1]:Gt(r)?r.width>r.height?r.width:r.height:r:t}}const Ht=(t,e)=>{let r,n;return n=l(e)?()=>e:Ut(e)?e:()=>0,r=t?Array.isArray(t)?e=>(t[0]>t[1]?t[0]:t[1])+n(e):Ut(t)?t:e=>t+n(e):t=>{var e,r;if(null===(e=t.data)||void 0===e?void 0:e.bboxSize)return Math.max(t.data.bboxSize[0],t.data.bboxSize[1])+n(t);if(null===(r=t.data)||void 0===r?void 0:r.size){if(Array.isArray(t.data.size))return Math.max(t.data.size[0],t.data.size[1])+n(t);const e=t.data.size;return Gt(e)?(e.width>e.height?e.width:e.height)+n(t):e+n(t)}return 10+n(t)},r},Kt=t=>{if(null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array){const e=[];return t.forEach((t=>{e.push(t)})),e.map((t=>Kt(t)))}if("object"==typeof t){const e={};return Object.keys(t).forEach((r=>{e[r]=Kt(t[r])})),e}return t},Jt=(t,e)=>{const r=Kt(t);return r.data=r.data||{},e&&(l(r.data.x)||(r.data.x=Math.random()*e[0]),l(r.data.y)||(r.data.y=Math.random()*e[1])),r},Qt={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null},Xt=(t,e,r)=>{const n=t.getAllNodes(),o=t.getAllEdges();return(null==n?void 0:n.length)?1===n.length?(e&&t.mergeNodeData(n[0].id,{x:r[0],y:r[1]}),{nodes:[Object.assign(Object.assign({},n[0]),{data:Object.assign(Object.assign({},n[0].data),{x:r[0],y:r[1]})})],edges:o}):void 0:{nodes:[],edges:o}},Zt={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1},te=(t,e,r=!1)=>{const n=[Jt(e[0])],o={},i=e.length;o[e[0].id]=!0;let s=0;return e.forEach(((a,u)=>{if(0!==u)if(u!==i-1&&t.getDegree(a.id,"both")===t.getDegree(e[u+1].id,"both")&&!t.areNeighbors(n[s].id,a.id)||o[a.id]){const u=r?t.getSuccessors(n[s].id):t.getNeighbors(n[s].id);let h=!1;for(let e=0;e<u.length;e++){const r=u[e];if(t.getDegree(r.id)===t.getDegree(a.id)&&!o[r.id]){n.push(Jt(r)),o[r.id]=!0,h=!0;break}}let d=0;for(;!h&&(o[e[d].id]||(n.push(Jt(e[d])),o[e[d].id]=!0,h=!0),d++,d!==i););}else n.push(Jt(a)),o[a.id]=!0,s++})),n},ee=function(t){return c(t,"String")},re=Array.isArray,ne={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class oe{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},ne),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericConcentricLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericConcentricLayout(!0,t,r)}))}genericConcentricLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{center:o,width:i,height:s,sortBy:a,maxLevelDiff:u,sweep:h,clockwise:d,equidistant:c,preventOverlap:f,startAngle:g=1.5*Math.PI,nodeSize:p,nodeSpacing:v}=e,m=r.getAllNodes(),y=r.getAllEdges(),w=i||"undefined"==typeof window?i:window.innerWidth,x=s||"undefined"==typeof window?s:window.innerHeight,b=o||[w/2,x/2];if(!(null==m?void 0:m.length)||1===m.length)return Xt(r,t,b);const E=[];let N,M=0;re(p)?N=Math.max(p[0],p[1]):Ut(p)?(N=-1/0,m.forEach((t=>{const e=p(t);e>N&&(N=e)}))):N=p,re(v)?M=Math.max(v[0],v[1]):l(v)&&(M=v),m.forEach((t=>{const e=Jt(t);E.push(e);let r=N;const{data:n}=e;re(n.size)?r=Math.max(n.size[0],n.size[1]):l(n.size)?r=n.size:Gt(n.size)&&(r=Math.max(n.size.width,n.size.height)),N=Math.max(N,r),Ut(v)&&(M=Math.max(v(t),M))}));const _={};E.forEach(((t,e)=>{_[t.id]=e}));let k=a;ee(k)&&void 0!==E[0].data[k]||(k="degree"),"degree"===k?E.sort(((t,e)=>r.getDegree(e.id,"both")-r.getDegree(t.id,"both"))):E.sort(((t,e)=>e.data[k]-t.data[k]));const A=E[0],j=(u||("degree"===k?r.getDegree(A.id,"both"):A.data[k]))/4,S=[{nodes:[]}];let O=S[0];E.forEach((t=>{if(O.nodes.length>0){const e="degree"===k?Math.abs(r.getDegree(O.nodes[0].id,"both")-r.getDegree(t.id,"both")):Math.abs(O.nodes[0].data[k]-t.data[k]);j&&e>=j&&(O={nodes:[]},S.push(O))}O.nodes.push(t)}));let z=N+M;if(!f){const t=S.length>0&&S[0].nodes.length>1,e=(Math.min(w,x)/2-z)/(S.length+(t?1:0));z=Math.min(z,e)}let R=0;if(S.forEach((t=>{const e=void 0===h?2*Math.PI-2*Math.PI/t.nodes.length:h;if(t.dTheta=e/Math.max(1,t.nodes.length-1),t.nodes.length>1&&f){const e=Math.cos(t.dTheta)-Math.cos(0),r=Math.sin(t.dTheta)-Math.sin(0),n=Math.sqrt(z*z/(e*e+r*r));R=Math.max(n,R)}t.r=R,R+=z})),c){let t=0,e=0;for(let r=0;r<S.length;r++){const n=(S[r].r||0)-e;t=Math.max(t,n)}e=0,S.forEach(((r,n)=>{0===n&&(e=r.r||0),r.r=e,e+=t}))}return S.forEach((t=>{const e=t.dTheta||0,r=t.r||0;t.nodes.forEach(((t,n)=>{const o=g+(d?1:-1)*e*n;t.data.x=b[0]+r*Math.cos(o),t.data.y=b[1]+r*Math.sin(o)}))})),t&&E.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:E,edges:y}}))}}function ie(t,e,r,n){if(isNaN(e)||isNaN(r))return t;var o,i,s,a,u,h,d,c,l,f=t._root,g={data:n},p=t._x0,v=t._y0,m=t._x1,y=t._y1;if(!f)return t._root=g,t;for(;f.length;)if((h=e>=(i=(p+m)/2))?p=i:m=i,(d=r>=(s=(v+y)/2))?v=s:y=s,o=f,!(f=f[c=d<<1|h]))return o[c]=g,t;if(a=+t._x.call(null,f.data),u=+t._y.call(null,f.data),e===a&&r===u)return g.next=f,o?o[c]=g:t._root=g,t;do{o=o?o[c]=new Array(4):t._root=new Array(4),(h=e>=(i=(p+m)/2))?p=i:m=i,(d=r>=(s=(v+y)/2))?v=s:y=s}while((c=d<<1|h)==(l=(u>=s)<<1|a>=i));return o[l]=f,o[c]=g,t}function se(t,e,r,n,o){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=o}function ae(t){return t[0]}function ue(t){return t[1]}function he(t,e,r){var n=new de(null==e?ae:e,null==r?ue:r,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function de(t,e,r,n,o,i){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=o,this._y1=i,this._root=void 0}function ce(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var le=he.prototype=de.prototype;function fe(t,e,r,n,o){if(isNaN(e)||isNaN(r)||isNaN(n))return t;var i,s,a,u,h,d,c,l,f,g,p,v,m=t._root,y={data:o},w=t._x0,x=t._y0,b=t._z0,E=t._x1,N=t._y1,M=t._z1;if(!m)return t._root=y,t;for(;m.length;)if((l=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+N)/2))?x=a:N=a,(g=n>=(u=(b+M)/2))?b=u:M=u,i=m,!(m=m[p=g<<2|f<<1|l]))return i[p]=y,t;if(h=+t._x.call(null,m.data),d=+t._y.call(null,m.data),c=+t._z.call(null,m.data),e===h&&r===d&&n===c)return y.next=m,i?i[p]=y:t._root=y,t;do{i=i?i[p]=new Array(8):t._root=new Array(8),(l=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+N)/2))?x=a:N=a,(g=n>=(u=(b+M)/2))?b=u:M=u}while((p=g<<2|f<<1|l)==(v=(c>=u)<<2|(d>=a)<<1|h>=s));return i[v]=m,i[p]=y,t}function ge(t,e,r,n,o,i,s){this.node=t,this.x0=e,this.y0=r,this.z0=n,this.x1=o,this.y1=i,this.z1=s}function pe(t){return t[0]}function ve(t){return t[1]}function me(t){return t[2]}function ye(t,e,r,n){var o=new we(null==e?pe:e,null==r?ve:r,null==n?me:n,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?o:o.addAll(t)}function we(t,e,r,n,o,i,s,a,u){this._x=t,this._y=e,this._z=r,this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this._root=void 0}function xe(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}le.copy=function(){var t,e,r=new de(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=ce(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var o=0;o<4;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(4)}):n.target[o]=ce(e));return r},le.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t);return ie(this.cover(e,r),e,r,t)},le.addAll=function(t){var e,r,n,o,i=t.length,s=new Array(i),a=new Array(i),u=1/0,h=1/0,d=-1/0,c=-1/0;for(r=0;r<i;++r)isNaN(n=+this._x.call(null,e=t[r]))||isNaN(o=+this._y.call(null,e))||(s[r]=n,a[r]=o,n<u&&(u=n),n>d&&(d=n),o<h&&(h=o),o>c&&(c=o));if(u>d||h>c)return this;for(this.cover(u,h).cover(d,c),r=0;r<i;++r)ie(this,s[r],a[r],t[r]);return this},le.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var r=this._x0,n=this._y0,o=this._x1,i=this._y1;if(isNaN(r))o=(r=Math.floor(t))+1,i=(n=Math.floor(e))+1;else{for(var s,a,u=o-r||1,h=this._root;r>t||t>=o||n>e||e>=i;)switch(a=(e<n)<<1|t<r,(s=new Array(4))[a]=h,h=s,u*=2,a){case 0:o=r+u,i=n+u;break;case 1:r=o-u,i=n+u;break;case 2:o=r+u,n=i-u;break;case 3:r=o-u,n=i-u}this._root&&this._root.length&&(this._root=h)}return this._x0=r,this._y0=n,this._x1=o,this._y1=i,this},le.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},le.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]]},le.find=function(t,e,r){var n,o,i,s,a,u,h,d=this._x0,c=this._y0,l=this._x1,f=this._y1,g=[],p=this._root;for(p&&g.push(new se(p,d,c,l,f)),null==r?r=1/0:(d=t-r,c=e-r,l=t+r,f=e+r,r*=r);u=g.pop();)if(!(!(p=u.node)||(o=u.x0)>l||(i=u.y0)>f||(s=u.x1)<d||(a=u.y1)<c))if(p.length){var v=(o+s)/2,m=(i+a)/2;g.push(new se(p[3],v,m,s,a),new se(p[2],o,m,v,a),new se(p[1],v,i,s,m),new se(p[0],o,i,v,m)),(h=(e>=m)<<1|t>=v)&&(u=g[g.length-1],g[g.length-1]=g[g.length-1-h],g[g.length-1-h]=u)}else{var y=t-+this._x.call(null,p.data),w=e-+this._y.call(null,p.data),x=y*y+w*w;if(x<r){var b=Math.sqrt(r=x);d=t-b,c=e-b,l=t+b,f=e+b,n=p.data}}return n},le.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t)))return this;var e,r,n,o,i,s,a,u,h,d,c,l,f=this._root,g=this._x0,p=this._y0,v=this._x1,m=this._y1;if(!f)return this;if(f.length)for(;;){if((h=i>=(a=(g+v)/2))?g=a:v=a,(d=s>=(u=(p+m)/2))?p=u:m=u,e=f,!(f=f[c=d<<1|h]))return this;if(!f.length)break;(e[c+1&3]||e[c+2&3]||e[c+3&3])&&(r=e,l=c)}for(;f.data!==t;)if(n=f,!(f=f.next))return this;return(o=f.next)&&delete f.next,n?(o?n.next=o:delete n.next,this):e?(o?e[c]=o:delete e[c],(f=e[0]||e[1]||e[2]||e[3])&&f===(e[3]||e[2]||e[1]||e[0])&&!f.length&&(r?r[l]=f:this._root=f),this):(this._root=o,this)},le.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},le.root=function(){return this._root},le.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},le.visit=function(t){var e,r,n,o,i,s,a=[],u=this._root;for(u&&a.push(new se(u,this._x0,this._y0,this._x1,this._y1));e=a.pop();)if(!t(u=e.node,n=e.x0,o=e.y0,i=e.x1,s=e.y1)&&u.length){var h=(n+i)/2,d=(o+s)/2;(r=u[3])&&a.push(new se(r,h,d,i,s)),(r=u[2])&&a.push(new se(r,n,d,h,s)),(r=u[1])&&a.push(new se(r,h,o,i,d)),(r=u[0])&&a.push(new se(r,n,o,h,d))}return this},le.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new se(this._root,this._x0,this._y0,this._x1,this._y1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.y0,u=e.x1,h=e.y1,d=(s+u)/2,c=(a+h)/2;(i=o[0])&&r.push(new se(i,s,a,d,c)),(i=o[1])&&r.push(new se(i,d,a,u,c)),(i=o[2])&&r.push(new se(i,s,c,d,h)),(i=o[3])&&r.push(new se(i,d,c,u,h))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},le.x=function(t){return arguments.length?(this._x=t,this):this._x},le.y=function(t){return arguments.length?(this._y=t,this):this._y};var be=ye.prototype=we.prototype;function Ee(t){let e=0,r=0,n=0,o=0,i=0;const s=t.length;if(s){for(let a=0;a<s;a++){const s=t[a];s&&s.weight&&(e+=s.weight,r+=s.x*s.weight,n+=s.y*s.weight,o+=s.z*s.weight,i+=s.size*s.weight)}t.x=r/e,t.y=n/e,t.z=o/e,t.size=i/e,t.weight=e}else{const e=t;t.x=e.data.x,t.y=e.data.y,t.z=e.data.z,t.size=e.data.size,t.weight=e.data.weight}}be.copy=function(){var t,e,r=new we(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root;if(!n)return r;if(!n.length)return r._root=xe(n),r;for(t=[{source:n,target:r._root=new Array(8)}];n=t.pop();)for(var o=0;o<8;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(8)}):n.target[o]=xe(e));return r},be.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t),n=+this._z.call(null,t);return fe(this.cover(e,r,n),e,r,n,t)},be.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e),n=new Float64Array(e),o=new Float64Array(e);let i=1/0,s=1/0,a=1/0,u=-1/0,h=-1/0,d=-1/0;for(let c,l,f,g,p=0;p<e;++p)isNaN(l=+this._x.call(null,c=t[p]))||isNaN(f=+this._y.call(null,c))||isNaN(g=+this._z.call(null,c))||(r[p]=l,n[p]=f,o[p]=g,l<i&&(i=l),l>u&&(u=l),f<s&&(s=f),f>h&&(h=f),g<a&&(a=g),g>d&&(d=g));if(i>u||s>h||a>d)return this;this.cover(i,s,a).cover(u,h,d);for(let i=0;i<e;++i)fe(this,r[i],n[i],o[i],t[i]);return this},be.cover=function(t,e,r){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(r=+r))return this;var n=this._x0,o=this._y0,i=this._z0,s=this._x1,a=this._y1,u=this._z1;if(isNaN(n))s=(n=Math.floor(t))+1,a=(o=Math.floor(e))+1,u=(i=Math.floor(r))+1;else{for(var h,d,c=s-n||1,l=this._root;n>t||t>=s||o>e||e>=a||i>r||r>=u;)switch(d=(r<i)<<2|(e<o)<<1|t<n,(h=new Array(8))[d]=l,l=h,c*=2,d){case 0:s=n+c,a=o+c,u=i+c;break;case 1:n=s-c,a=o+c,u=i+c;break;case 2:s=n+c,o=a-c,u=i+c;break;case 3:n=s-c,o=a-c,u=i+c;break;case 4:s=n+c,a=o+c,i=u-c;break;case 5:n=s-c,a=o+c,i=u-c;break;case 6:s=n+c,o=a-c,i=u-c;break;case 7:n=s-c,o=a-c,i=u-c}this._root&&this._root.length&&(this._root=l)}return this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this},be.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},be.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},be.find=function(t,e,r,n){var o,i,s,a,u,h,d,c,l,f=this._x0,g=this._y0,p=this._z0,v=this._x1,m=this._y1,y=this._z1,w=[],x=this._root;for(x&&w.push(new ge(x,f,g,p,v,m,y)),null==n?n=1/0:(f=t-n,g=e-n,p=r-n,v=t+n,m=e+n,y=r+n,n*=n);c=w.pop();)if(!(!(x=c.node)||(i=c.x0)>v||(s=c.y0)>m||(a=c.z0)>y||(u=c.x1)<f||(h=c.y1)<g||(d=c.z1)<p))if(x.length){var b=(i+u)/2,E=(s+h)/2,N=(a+d)/2;w.push(new ge(x[7],b,E,N,u,h,d),new ge(x[6],i,E,N,b,h,d),new ge(x[5],b,s,N,u,E,d),new ge(x[4],i,s,N,b,E,d),new ge(x[3],b,E,a,u,h,N),new ge(x[2],i,E,a,b,h,N),new ge(x[1],b,s,a,u,E,N),new ge(x[0],i,s,a,b,E,N)),(l=(r>=N)<<2|(e>=E)<<1|t>=b)&&(c=w[w.length-1],w[w.length-1]=w[w.length-1-l],w[w.length-1-l]=c)}else{var M=t-+this._x.call(null,x.data),_=e-+this._y.call(null,x.data),k=r-+this._z.call(null,x.data),A=M*M+_*_+k*k;if(A<n){var j=Math.sqrt(n=A);f=t-j,g=e-j,p=r-j,v=t+j,m=e+j,y=r+j,o=x.data}}return o},be.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t))||isNaN(a=+this._z.call(null,t)))return this;var e,r,n,o,i,s,a,u,h,d,c,l,f,g,p,v=this._root,m=this._x0,y=this._y0,w=this._z0,x=this._x1,b=this._y1,E=this._z1;if(!v)return this;if(v.length)for(;;){if((c=i>=(u=(m+x)/2))?m=u:x=u,(l=s>=(h=(y+b)/2))?y=h:b=h,(f=a>=(d=(w+E)/2))?w=d:E=d,e=v,!(v=v[g=f<<2|l<<1|c]))return this;if(!v.length)break;(e[g+1&7]||e[g+2&7]||e[g+3&7]||e[g+4&7]||e[g+5&7]||e[g+6&7]||e[g+7&7])&&(r=e,p=g)}for(;v.data!==t;)if(n=v,!(v=v.next))return this;return(o=v.next)&&delete v.next,n?(o?n.next=o:delete n.next,this):e?(o?e[g]=o:delete e[g],(v=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&v===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!v.length&&(r?r[p]=v:this._root=v),this):(this._root=o,this)},be.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},be.root=function(){return this._root},be.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},be.visit=function(t){var e,r,n,o,i,s,a,u,h=[],d=this._root;for(d&&h.push(new ge(d,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=h.pop();)if(!t(d=e.node,n=e.x0,o=e.y0,i=e.z0,s=e.x1,a=e.y1,u=e.z1)&&d.length){var c=(n+s)/2,l=(o+a)/2,f=(i+u)/2;(r=d[7])&&h.push(new ge(r,c,l,f,s,a,u)),(r=d[6])&&h.push(new ge(r,n,l,f,c,a,u)),(r=d[5])&&h.push(new ge(r,c,o,f,s,l,u)),(r=d[4])&&h.push(new ge(r,n,o,f,c,l,u)),(r=d[3])&&h.push(new ge(r,c,l,i,s,a,f)),(r=d[2])&&h.push(new ge(r,n,l,i,c,a,f)),(r=d[1])&&h.push(new ge(r,c,o,i,s,l,f)),(r=d[0])&&h.push(new ge(r,n,o,i,c,l,f))}return this},be.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new ge(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.y0,u=e.z0,h=e.x1,d=e.y1,c=e.z1,l=(s+h)/2,f=(a+d)/2,g=(u+c)/2;(i=o[0])&&r.push(new ge(i,s,a,u,l,f,g)),(i=o[1])&&r.push(new ge(i,l,a,u,h,f,g)),(i=o[2])&&r.push(new ge(i,s,f,u,l,d,g)),(i=o[3])&&r.push(new ge(i,l,f,u,h,d,g)),(i=o[4])&&r.push(new ge(i,s,a,g,l,f,c)),(i=o[5])&&r.push(new ge(i,l,a,g,h,f,c)),(i=o[6])&&r.push(new ge(i,s,f,g,l,d,c)),(i=o[7])&&r.push(new ge(i,l,f,g,h,d,c))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},be.x=function(t){return arguments.length?(this._x=t,this):this._x},be.y=function(t){return arguments.length?(this._y=t,this):this._y},be.z=function(t){return arguments.length?(this._z=t,this):this._z};const Ne=(t,e,r,n,o,i,s)=>{var a;if((null===(a=t.data)||void 0===a?void 0:a.id)===i.id)return;const u=[r,n,o][s-1],h=i.x-t.x||.1,d=i.y-t.y||.1,c=i.z-t.z||.1,l=[h,d,c],f=u-e;let g=0;for(let t=0;t<s;t++)g+=l[t]*l[t];const p=Math.sqrt(g)*g;if(f*f*.81<g){const e=t.weight/p;return i.vx+=h*e,i.vy+=d*e,i.vz+=c*e,!0}if(t.length)return!1;if(t.data!==i){const e=t.data.weight/p;i.vx+=h*e,i.vy+=d*e,i.vz+=c*e}},Me={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"};class _e{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},Me),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericForceLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericForceLayout(!0,t,r)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;(this.judgingDistance>this.lastOptions.minMovement||e<1)&&e<t;e++)this.runOneStep(this.lastCalcGraph,this.lastGraph,e,this.lastVelMap,this.lastOptions),this.updatePosition(this.lastGraph,this.lastCalcGraph,this.lastVelMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericForceLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),o=r.getAllNodes(),i=r.getAllEdges(),s=this.formatOptions(e,r),{dimensions:a,width:u,height:d,nodeSize:c,getMass:f,nodeStrength:g,edgeStrength:p,linkDistance:v}=s,m=o.map(((t,e)=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{x:l(t.data.x)?t.data.x:Math.random()*u,y:l(t.data.y)?t.data.y:Math.random()*d,z:l(t.data.z)?t.data.z:Math.random()*Math.sqrt(u*d),size:c(t)||30,mass:f(t),nodeStrength:g(t)})}))),y=i.map((t=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{edgeStrength:p(t),linkDistance:v(t,r.getNode(t.source),r.getNode(t.target))})})));if(!(null==o?void 0:o.length))return this.lastResult={nodes:[],edges:i},{nodes:[],edges:i};const w={};o.forEach(((t,e)=>{w[t.id]={x:0,y:0,z:0}}));const x=new h({nodes:m,edges:y});this.formatCentripetal(s,x);const{maxIteration:b,minMovement:E,onTick:N}=s;if(this.lastLayoutNodes=m,this.lastLayoutEdges=y,this.lastAssign=t,this.lastGraph=r,this.lastCalcGraph=x,this.lastOptions=s,this.lastVelMap=w,"undefined"==typeof window)return;let M=0;return new Promise((e=>{this.timeInterval=window.setInterval((()=>{o&&this.running||e({nodes:Oe(r,m),edges:i}),this.runOneStep(x,r,M,w,s),this.updatePosition(r,x,w,s),t&&m.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===a?t.data.z:void 0}))),null==N||N({nodes:Oe(r,m),edges:i}),M++,(M>=b||this.judgingDistance<E)&&(window.clearInterval(this.timeInterval),e({nodes:Oe(r,m),edges:i}))}),0),this.running=!0}))}))}formatOptions(t,e){const r=Object.assign({},t),{width:n,height:o,getMass:i,nodeSize:s}=t;r.width=n||"undefined"==typeof window?n:window.innerWidth,r.height=o||"undefined"==typeof window?o:window.innerHeight,t.center||(r.center=[r.width/2,r.height/2]),i||(r.getMass=t=>{let r=1;l(null==t?void 0:t.data.mass)&&(r=null==t?void 0:t.data.mass);const n=e.getDegree(t.id,"both");return!n||n<5?r:5*n*r});const a=Wt(0,t.nodeSpacing);let u;u=s?Ut(s)?t=>s(t)+a(t):re(s)?t=>{const e=s;return Math.max(e[0],e[1])+a(t)}:t=>s+a(t):t=>{const{size:e}=(null==t?void 0:t.data)||{};return e?re(e)?Math.max(e[0],e[1])+a(t):Gt(e)?Math.max(e.width,e.height)+a(t):e+a(t):10+a(t)},r.nodeSize=u;const h=t.linkDistance?Wt(1,t.linkDistance):t=>1+r.nodeSize(e.getNode(t.source))+r.nodeSize(e.getNode(t.target));return r.linkDistance=h,r.nodeStrength=Wt(1,t.nodeStrength),r.edgeStrength=Wt(1,t.edgeStrength),r}formatCentripetal(t,e){const{dimensions:r,centripetalOptions:n,center:o,clusterNodeStrength:i,leafCluster:s,clustering:a,nodeClusterBy:u}=t,h=e.getAllNodes(),d=n||{leaf:2,single:2,others:1,center:t=>({x:o[0],y:o[1],z:3===r?o[2]:void 0})};let c,l;if("function"!=typeof i&&(t.clusterNodeStrength=t=>i),s&&u&&(c=ke(e,u),l=Array.from(new Set(null==h?void 0:h.map((t=>t.data[u]))))||[],t.centripetalOptions=Object.assign(d,{single:100,leaf:e=>{const{siblingLeaves:r,sameTypeLeaves:n}=c[e.id]||{};return(null==n?void 0:n.length)===(null==r?void 0:r.length)||1===(null==l?void 0:l.length)?1:t.clusterNodeStrength(e)},others:1,center:t=>{const r=e.getDegree(t.id,"both");if(!r)return{x:100,y:100,z:0};let n;if(1===r){const{sameTypeLeaves:e=[]}=c[t.id]||{};1===e.length?n=void 0:e.length>1&&(n=Se(e))}else n=void 0;return{x:null==n?void 0:n.x,y:null==n?void 0:n.y,z:null==n?void 0:n.z}}})),a&&u){c||(c=ke(e,u)),l||(l=Array.from(new Set(h.map((t=>t.data[u]))))),l=l.filter((t=>void 0!==t));const r={};l.forEach((t=>{const n=h.filter((e=>e.data[u]===t)).map((t=>e.getNode(t.id)));r[t]=Se(n)})),t.centripetalOptions=Object.assign(d,{single:e=>t.clusterNodeStrength(e),leaf:e=>t.clusterNodeStrength(e),others:e=>t.clusterNodeStrength(e),center:t=>{const e=r[t.data[u]];return{x:null==e?void 0:e.x,y:null==e?void 0:e.y,z:null==e?void 0:e.z}}})}const{leaf:f,single:g,others:p}=t.centripetalOptions||{};f&&"function"!=typeof f&&(t.centripetalOptions.leaf=()=>f),g&&"function"!=typeof g&&(t.centripetalOptions.single=()=>g),p&&"function"!=typeof p&&(t.centripetalOptions.others=()=>p)}runOneStep(t,e,r,n,o){const i={},s=t.getAllNodes(),a=t.getAllEdges();if(!(null==s?void 0:s.length))return;const{monitor:u}=o;this.calRepulsive(t,i,o),a&&this.calAttractive(t,i,o),this.calGravity(t,e,i,o),this.updateVelocity(t,i,n,o),u&&u({energy:this.calTotalEnergy(i,s),nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:r})}calTotalEnergy(t,e){if(!(null==e?void 0:e.length))return 0;let r=0;return e.forEach(((e,n)=>{const o=t[e.id].x,i=t[e.id].y,s=3===this.options.dimensions?t[e.id].z:0,a=o*o+i*i+s*s,{mass:u=1}=e.data;r+=u*a*.5})),r}calRepulsive(t,e,r){const{dimensions:n,factor:o,coulombDisScale:i}=r;!function(t,e,r,n,o=2){const i=e/r,s=t.getAllNodes(),a=s.map(((t,e)=>{const{nodeStrength:r,x:n,y:o,z:s,size:a}=t.data;return{x:n,y:o,z:s,size:a,index:e,id:t.id,vx:0,vy:0,vz:0,weight:i*r}})),u=(2===o?he(a,(t=>t.x),(t=>t.y)):ye(a,(t=>t.x),(t=>t.y),(t=>t.z))).visitAfter(Ee),h=new Map;a.forEach((t=>{h.set(t.id,t),function(t,e,r){e.visit(((e,n,o,i,s)=>Ne(e,n,o,i,s,t,r)))}(t,u,o)})),a.map(((t,e)=>{const{id:r,data:o}=s[e],{mass:i=1}=o;n[r]={x:t.vx/i,y:t.vy/i,z:t.vz/i}}))}(t,o,i*i,e,n)}calAttractive(t,e,r){const{dimensions:n,nodeSize:o}=r;t.getAllEdges().forEach(((r,i)=>{const{source:s,target:a}=r,u=t.getNode(s),h=t.getNode(a);if(!u||!h)return;let d=h.data.x-u.data.x,c=h.data.y-u.data.y,l=3===n?h.data.z-u.data.z:0;d||c||(d=.01*Math.random(),c=.01*Math.random(),3!==n||l||(l=.01*Math.random()));const f=Math.sqrt(d*d+c*c+l*l);if(f<o(u)+o(h))return;const g=d/f,p=c/f,v=l/f,{linkDistance:m=200,edgeStrength:y=200}=r.data||{},w=(m-f)*y,x=1/(u.data.mass||1),b=1/(h.data.mass||1),E=g*w,N=p*w,M=v*w;e[s].x-=E*x,e[s].y-=N*x,e[s].z-=M*x,e[a].x+=E*b,e[a].y+=N*b,e[a].z+=M*b}))}calGravity(t,e,r,n){const{getCenter:o}=n,i=t.getAllNodes(),s=e.getAllNodes(),a=e.getAllEdges(),{width:u,height:h,center:d,gravity:c,centripetalOptions:f}=n;i&&i.forEach((n=>{const{id:i,data:g}=n,{mass:p,x:v,y:m,z:y}=g,w=e.getNode(i);let x=0,b=0,E=0,N=c;const M=t.getDegree(i,"in"),_=t.getDegree(i,"out"),k=t.getDegree(i,"both"),A=null==o?void 0:o(w,k);if(A){const[t,e,r]=A;x=v-t,b=m-e,N=r}else x=v-d[0],b=m-d[1],E=y-d[2];if(N&&(r[i].x-=N*x/p,r[i].y-=N*b/p,r[i].z-=N*E/p),f){const{leaf:t,single:e,others:n,center:o}=f,{x:d,y:c,z:g,centerStrength:x}=(null==o?void 0:o(w,s,a,u,h))||{x:0,y:0,z:0,centerStrength:0};if(!l(d)||!l(c))return;const b=(v-d)/p,E=(m-c)/p,N=(y-g)/p;if(x&&(r[i].x-=x*b,r[i].y-=x*E,r[i].z-=x*N),0===k){const t=e(w);if(!t)return;return r[i].x-=t*b,r[i].y-=t*E,void(r[i].z-=t*N)}if(0===M||0===_){const e=t(w,s,a);if(!e)return;return r[i].x-=e*b,r[i].y-=e*E,void(r[i].z-=e*N)}const A=n(w);if(!A)return;r[i].x-=A*b,r[i].y-=A*E,r[i].z-=A*N}}))}updateVelocity(t,e,r,n){const{damping:o,maxSpeed:i,interval:s,dimensions:a}=n,u=t.getAllNodes();(null==u?void 0:u.length)&&u.forEach((t=>{const{id:n}=t;let u=(r[n].x+e[n].x*s)*o||.01,h=(r[n].y+e[n].y*s)*o||.01,d=3===a?(r[n].z+e[n].z*s)*o||.01:0;const c=Math.sqrt(u*u+h*h+d*d);if(c>i){const t=i/c;u*=t,h*=t,d*=t}r[n]={x:u,y:h,z:d}}))}updatePosition(t,e,r,n){const{distanceThresholdMode:o,interval:i,dimensions:s}=n,a=e.getAllNodes();if(!(null==a?void 0:a.length))return void(this.judgingDistance=0);let u=0;"max"===o?this.judgingDistance=-1/0:"min"===o&&(this.judgingDistance=1/0),a.forEach((n=>{const{id:a}=n,h=t.getNode(a);if(l(h.data.fx)&&l(h.data.fy))return void e.mergeNodeData(a,{x:h.data.fx,y:h.data.fy,z:3===s?h.data.fz:void 0});const d=r[a].x*i,c=r[a].y*i,f=3===s?r[a].z*i:0;e.mergeNodeData(a,{x:n.data.x+d,y:n.data.y+c,z:n.data.z+f});const g=Math.sqrt(d*d+c*c+f*f);switch(o){case"max":this.judgingDistance<g&&(this.judgingDistance=g);break;case"min":this.judgingDistance>g&&(this.judgingDistance=g);break;default:u+=g}})),o&&"mean"!==o||(this.judgingDistance=u/a.length)}}const ke=(t,e)=>{const r=t.getAllNodes();if(!(null==r?void 0:r.length))return{};const n={};return r.forEach(((r,o)=>{1===t.getDegree(r.id,"both")&&(n[r.id]=Ae(t,"leaf",r,e))})),n},Ae=(t,e,r,n)=>{const o=t.getDegree(r.id,"in"),i=t.getDegree(r.id,"out");let s=r,a=[];return 0===o?(s=t.getSuccessors(r.id)[0],a=t.getNeighbors(s.id)):0===i&&(s=t.getPredecessors(r.id)[0],a=t.getNeighbors(s.id)),a=a.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out"))),{coreNode:s,siblingLeaves:a,sameTypeLeaves:je(t,e,n,r,a)}},je=(t,e,r,n,o)=>{const i=n.data[r]||"";let s=(null==o?void 0:o.filter((t=>t.data[r]===i)))||[];return"leaf"===e&&(s=s.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out")))),s},Se=t=>{const e={x:0,y:0};t.forEach((t=>{const{x:r,y:n}=t.data;e.x+=r||0,e.y+=n||0}));const r=t.length||1;return{x:e.x/r,y:e.y/r}},Oe=(t,e)=>e.map((e=>{const{id:r,data:n}=e,o=t.getNode(r);return Object.assign(Object.assign({},o),{data:Object.assign(Object.assign({},o.data),{x:n.x,y:n.y,z:n.z})})}));var ze=r(8917);ze.y3,ze.jy,ze.oN,ze.Hc,ze.cg,ze.hj,ze.LU,ze.Tb;const Re=ze.uq,Ie=(ze.Zm,ze.Dq,ze.__,ze.q0,ze.lh,ze.pI,ze.zC,ze.zg,ze.g6,ze.OL,ze.ks,ze.QR,ze.jp,ze.mk,ze.W2),Ce=(ze.l,ze.KY,ze.dv,ze.BR,ze.Wu,ze.uq,ze.uq,ze.a4,ze.DI,ze.Jo,ze.Zi,ze.kH,ze.LV,t=>{const e=[],r=t.length;for(let n=0;n<r;n+=1){e[n]=[];for(let o=0;o<r;o+=1)n===o?e[n][o]=0:0!==t[n][o]&&t[n][o]?e[n][o]=t[n][o]:e[n][o]=1/0}for(let t=0;t<r;t+=1)for(let n=0;n<r;n+=1)for(let o=0;o<r;o+=1)e[n][o]>e[n][t]+e[t][o]&&(e[n][o]=e[n][t]+e[t][o]);return e}),De=(t,e)=>{const{nodes:r,edges:n}=t,o=[],i={};if(!r)throw new Error("invalid nodes data!");return r&&r.forEach(((t,e)=>{i[t.id]=e,o.push([])})),null==n||n.forEach((t=>{const{source:r,target:n}=t,s=i[r],a=i[n];void 0!==s&&void 0!==a&&(o[s][a]=1,e||(o[a][s]=1))})),o},Pe=(t,e)=>Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)),Te=(t,e,r,n="TB",o,i={})=>{if(!(null==e?void 0:e.length))return;const{stopBranchFn:s,stopAllFn:a}=i;for(let u=0;u<e.length;u++){const h=e[u];if(t.hasNode(h.id)&&!(null==s?void 0:s(h))){if(null==a?void 0:a(h))return;"TB"===n&&r(h),Te(t,t.getChildren(h.id,o),r,n,o,i),"TB"!==n&&r(h)}}},Le={center:[0,0],linkDistance:50};class Fe{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},Le),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericMDSLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericMDSLayout(!0,t,r)}))}genericMDSLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{center:o=[0,0],linkDistance:i=50}=e,s=r.getAllNodes(),a=r.getAllEdges();if(!(null==s?void 0:s.length)||1===s.length)return Xt(r,t,o);const u=De({nodes:s,edges:a},!1),h=Ce(u);qe(h);const d=((t,e)=>{const r=[];return t.forEach((t=>{const n=[];t.forEach((t=>{n.push(t*e)})),r.push(n)})),r})(h,i),c=Ve(d),l=[];return c.forEach(((t,e)=>{const r=Jt(s[e]);r.data.x=t[0]+o[0],r.data.y=t[1]+o[1],l.push(r)})),t&&l.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:l,edges:a}}))}}const qe=t=>{let e=-999999;t.forEach((t=>{t.forEach((t=>{t!==1/0&&e<t&&(e=t)}))})),t.forEach(((r,n)=>{r.forEach(((r,o)=>{r===1/0&&(t[n][o]=e)}))}))},Ve=t=>{const e=Re.mul(Re.pow(t,2),-.5),r=e.mean("row"),n=e.mean("column"),o=e.mean();e.add(o).subRowVector(r).subColumnVector(n);const i=new Ie(e),s=Re.sqrt(i.diagonalMatrix).diagonal();return i.leftSingularVectors.toJSON().map((t=>Re.mul([t],[s]).toJSON()[0].splice(0,2)))},Be={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},$e={center:[0,0],comboPadding:10,treeKey:"combo"},Ue=function(t){if(!function(t){return"object"==typeof t&&null!==t}(t)||!c(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};function Ge(t,e){if(Object.hasOwn)return Object.hasOwn(t,e);if(null==t)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(t),e)}function We(t,e,r,n){for(var o in r=r||0,n=n||5,e)if(Ge(e,o)){var i=e[o];null!==i&&Ue(i)?(Ue(t[o])||(t[o]={}),r<n?We(t[o],i,r+1,n):t[o]=e[o]):L(i)?(t[o]=[],t[o]=t[o].concat(i)):void 0!==i&&(t[o]=i)}}var Ye=Object.prototype.hasOwnProperty;const He=function(t,e){if(null===t||!Ue(t))return{};var r={};return function(t,e){if(t)if(L(t))for(var r=0,n=t.length;r<n&&!1!==e(t[r],r);r++);else if(Gt(t))for(var o in t)if(t.hasOwnProperty(o)&&!1===e(t[o],o))break}(e,(function(e){Ye.call(t,e)&&(r[e]=t[e])})),r};function Ke(t){return function(){return t}}function Je(t){return 1e-6*(t()-.5)}function Qe(t){return t.index}function Xe(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function Ze(t){var e,r,n,o,i,s,a=Qe,u=function(t){return 1/Math.min(o[t.source.index],o[t.target.index])},h=Ke(30),d=1;function c(n){for(var o=0,a=t.length;o<d;++o)for(var u,h,c,l,f,g,p,v=0;v<a;++v)h=(u=t[v]).source,l=(c=u.target).x+c.vx-h.x-h.vx||Je(s),f=c.y+c.vy-h.y-h.vy||Je(s),l*=g=((g=Math.sqrt(l*l+f*f))-r[v])/g*n*e[v],f*=g,c.vx-=l*(p=i[v]),c.vy-=f*p,h.vx+=l*(p=1-p),h.vy+=f*p}function l(){if(n){var s,u,h=n.length,d=t.length,c=new Map(n.map(((t,e)=>[a(t,e,n),t])));for(s=0,o=new Array(h);s<d;++s)(u=t[s]).index=s,"object"!=typeof u.source&&(u.source=Xe(c,u.source)),"object"!=typeof u.target&&(u.target=Xe(c,u.target)),o[u.source.index]=(o[u.source.index]||0)+1,o[u.target.index]=(o[u.target.index]||0)+1;for(s=0,i=new Array(d);s<d;++s)u=t[s],i[s]=o[u.source.index]/(o[u.source.index]+o[u.target.index]);e=new Array(d),f(),r=new Array(d),g()}}function f(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+u(t[r],r,t)}function g(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+h(t[e],e,t)}return null==t&&(t=[]),c.initialize=function(t,e){n=t,s=e,l()},c.links=function(e){return arguments.length?(t=e,l(),c):t},c.id=function(t){return arguments.length?(a=t,c):a},c.iterations=function(t){return arguments.length?(d=+t,c):d},c.strength=function(t){return arguments.length?(u="function"==typeof t?t:Ke(+t),f(),c):u},c.distance=function(t){return arguments.length?(h="function"==typeof t?t:Ke(+t),g(),c):h},c}var tr={value:()=>{}};function er(){for(var t,e=0,r=arguments.length,n={};e<r;++e){if(!(t=arguments[e]+"")||t in n||/[\\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new rr(n)}function rr(t){this._=t}function nr(t,e){for(var r,n=0,o=t.length;n<o;++n)if((r=t[n]).name===e)return r.value}function or(t,e,r){for(var n=0,o=t.length;n<o;++n)if(t[n].name===e){t[n]=tr,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}rr.prototype=er.prototype={constructor:rr,on:function(t,e){var r,n,o=this._,i=(n=o,(t+"").trim().split(/^|\\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),s=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++s<a;)if(r=(t=i[s]).type)o[r]=or(o[r],t.name,e);else if(null==e)for(r in o)o[r]=or(o[r],t.name,null);return this}for(;++s<a;)if((r=(t=i[s]).type)&&(r=nr(o[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new rr(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,o=new Array(r),i=0;i<r;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,r=(n=this._[t]).length;i<r;++i)n[i].value.apply(e,o)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],o=0,i=n.length;o<i;++o)n[o].value.apply(e,r)}};const ir=er;var sr,ar,ur=0,hr=0,dr=0,cr=1e3,lr=0,fr=0,gr=0,pr="object"==typeof performance&&performance.now?performance:Date,vr="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function mr(){return fr||(vr(yr),fr=pr.now()+gr)}function yr(){fr=0}function wr(){this._call=this._time=this._next=null}function xr(t,e,r){var n=new wr;return n.restart(t,e,r),n}function br(){fr=(lr=pr.now())+gr,ur=hr=0;try{!function(){mr(),++ur;for(var t,e=sr;e;)(t=fr-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ur}()}finally{ur=0,function(){for(var t,e,r=sr,n=1/0;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:sr=e);ar=t,Nr(n)}(),fr=0}}function Er(){var t=pr.now(),e=t-lr;e>cr&&(gr-=e,lr=t)}function Nr(t){ur||(hr&&(hr=clearTimeout(hr)),t-fr>24?(t<1/0&&(hr=setTimeout(br,t-pr.now()-gr)),dr&&(dr=clearInterval(dr))):(dr||(lr=pr.now(),dr=setInterval(Er,cr)),ur=1,vr(br)))}wr.prototype=xr.prototype={constructor:wr,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?mr():+r)+(null==e?0:+e),this._next||ar===this||(ar?ar._next=this:sr=this,ar=this),this._call=t,this._time=r,Nr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Nr())}};const Mr=4294967296;function _r(t){return t.x}function kr(t){return t.y}var Ar=Math.PI*(3-Math.sqrt(5));function jr(){var t,e,r,n,o,i=Ke(-30),s=1,a=1/0,u=.81;function h(r){var o,i=t.length,s=he(t,_r,kr).visitAfter(c);for(n=r,o=0;o<i;++o)e=t[o],s.visit(l)}function d(){if(t){var e,r,n=t.length;for(o=new Array(n),e=0;e<n;++e)r=t[e],o[r.index]=+i(r,e,t)}}function c(t){var e,r,n,i,s,a=0,u=0;if(t.length){for(n=i=s=0;s<4;++s)(e=t[s])&&(r=Math.abs(e.value))&&(a+=e.value,u+=r,n+=r*e.x,i+=r*e.y);t.x=n/u,t.y=i/u}else{(e=t).x=e.data.x,e.y=e.data.y;do{a+=o[e.data.index]}while(e=e.next)}t.value=a}function l(t,i,h,d){if(!t.value)return!0;var c=t.x-e.x,l=t.y-e.y,f=d-i,g=c*c+l*l;if(f*f/u<g)return g<a&&(0===c&&(g+=(c=Je(r))*c),0===l&&(g+=(l=Je(r))*l),g<s&&(g=Math.sqrt(s*g)),e.vx+=c*t.value*n/g,e.vy+=l*t.value*n/g),!0;if(!(t.length||g>=a)){(t.data!==e||t.next)&&(0===c&&(g+=(c=Je(r))*c),0===l&&(g+=(l=Je(r))*l),g<s&&(g=Math.sqrt(s*g)));do{t.data!==e&&(f=o[t.data.index]*n/g,e.vx+=c*f,e.vy+=l*f)}while(t=t.next)}}return h.initialize=function(e,n){t=e,r=n,d()},h.strength=function(t){return arguments.length?(i="function"==typeof t?t:Ke(+t),d(),h):i},h.distanceMin=function(t){return arguments.length?(s=t*t,h):Math.sqrt(s)},h.distanceMax=function(t){return arguments.length?(a=t*t,h):Math.sqrt(a)},h.theta=function(t){return arguments.length?(u=t*t,h):Math.sqrt(u)},h}function Sr(t,e){var r,n=1;function o(){var o,i,s=r.length,a=0,u=0;for(o=0;o<s;++o)a+=(i=r[o]).x,u+=i.y;for(a=(a/s-t)*n,u=(u/s-e)*n,o=0;o<s;++o)(i=r[o]).x-=a,i.y-=u}return null==t&&(t=0),null==e&&(e=0),o.initialize=function(t){r=t},o.x=function(e){return arguments.length?(t=+e,o):t},o.y=function(t){return arguments.length?(e=+t,o):e},o.strength=function(t){return arguments.length?(n=+t,o):n},o}function Or(t){return t.x+t.vx}function zr(t){return t.y+t.vy}function Rr(t){var e,r,n,o=1,i=1;function s(){for(var t,s,u,h,d,c,l,f=e.length,g=0;g<i;++g)for(s=he(e,Or,zr).visitAfter(a),t=0;t<f;++t)u=e[t],c=r[u.index],l=c*c,h=u.x+u.vx,d=u.y+u.vy,s.visit(p);function p(t,e,r,i,s){var a=t.data,f=t.r,g=c+f;if(!a)return e>h+g||i<h-g||r>d+g||s<d-g;if(a.index>u.index){var p=h-a.x-a.vx,v=d-a.y-a.vy,m=p*p+v*v;m<g*g&&(0===p&&(m+=(p=Je(n))*p),0===v&&(m+=(v=Je(n))*v),m=(g-(m=Math.sqrt(m)))/m*o,u.vx+=(p*=m)*(g=(f*=f)/(l+f)),u.vy+=(v*=m)*g,a.vx-=p*(g=1-g),a.vy-=v*g)}}}function a(t){if(t.data)return t.r=r[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function u(){if(e){var n,o,i=e.length;for(r=new Array(i),n=0;n<i;++n)o=e[n],r[o.index]=+t(o,n,e)}}return"function"!=typeof t&&(t=Ke(null==t?1:+t)),s.initialize=function(t,r){e=t,n=r,u()},s.iterations=function(t){return arguments.length?(i=+t,s):i},s.strength=function(t){return arguments.length?(o=+t,s):o},s.radius=function(e){return arguments.length?(t="function"==typeof e?e:Ke(+e),u(),s):t},s}function Ir(t,e,r){var n,o,i,s=Ke(.1);function a(t){for(var s=0,a=n.length;s<a;++s){var u=n[s],h=u.x-e||1e-6,d=u.y-r||1e-6,c=Math.sqrt(h*h+d*d),l=(i[s]-c)*o[s]*t/c;u.vx+=h*l,u.vy+=d*l}}function u(){if(n){var e,r=n.length;for(o=new Array(r),i=new Array(r),e=0;e<r;++e)i[e]=+t(n[e],e,n),o[e]=isNaN(i[e])?0:+s(n[e],e,n)}}return"function"!=typeof t&&(t=Ke(+t)),null==e&&(e=0),null==r&&(r=0),a.initialize=function(t){n=t,u()},a.strength=function(t){return arguments.length?(s="function"==typeof t?t:Ke(+t),u(),a):s},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:Ke(+e),u(),a):t},a.x=function(t){return arguments.length?(e=+t,a):e},a.y=function(t){return arguments.length?(r=+t,a):r},a}function Cr(t){var e,r,n,o=Ke(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Ke(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Ke(+t),s(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:Ke(+e),s(),i):t},i}function Dr(t){var e,r,n,o=Ke(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Ke(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Ke(+t),s(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:Ke(+e),s(),i):t},i}class Pr{constructor(e={}){this.id="d3-force",this.config={inputNodeAttrs:["x","y","vx","vy","fx","fy"],outputNodeAttrs:["x","y","vx","vy"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource"]},this.forceMap={link:Ze,manyBody:jr,center:Sr,collide:Rr,radial:Ir,x:Cr,y:Dr},this.options={link:{id:t=>t.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]};const{forceSimulation:r}=e,n=t(e,["forceSimulation"]);(function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var n=0;n<e.length;n+=1)We(t,e[n])})(this.options,n),r&&(this.simulation=r)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericLayout(!0,t,r)}))}stop(){this.simulation.stop()}tick(t){return this.simulation.tick(t),this.getResult()}restart(){this.simulation.restart()}getOptions(t){var e,r;const n=Object.assign(Object.assign({},this.options),t);return void 0===(null===(e=n.collide)||void 0===e?void 0:e.radius)&&(n.collide=n.collide||{},n.collide.radius=null!==(r=n.nodeSize)&&void 0!==r?r:10),void 0===n.iterations&&(n.link&&void 0===n.link.iterations&&(n.iterations=n.link.iterations),n.collide&&void 0===n.collide.iterations&&(n.iterations=n.collide.iterations)),this.context.options=n,n}genericLayout(t,r,n){var o;return e(this,void 0,void 0,(function*(){const e=this.getOptions(n),i=r.getAllNodes().map((({id:t,data:e})=>Object.assign({id:t,data:e},He(e,this.config.inputNodeAttrs)))),s=r.getAllEdges().map((t=>Object.assign({},t)));Object.assign(this.context,{assign:t,nodes:i,edges:s,graph:r});const a=new Promise((t=>{this.resolver=t})),u=this.setSimulation(e);return u.nodes(i),null===(o=u.force("link"))||void 0===o||o.links(s),a}))}getResult(){const{assign:t,nodes:e,edges:r,graph:n}=this.context,o=e.map((t=>({id:t.id,data:Object.assign(Object.assign({},t.data),He(t,this.config.outputNodeAttrs))}))),i=r.map((({id:t,source:e,target:r,data:n})=>({id:t,source:"object"==typeof e?e.id:e,target:"object"==typeof r?r.id:r,data:n})));return t&&o.forEach((t=>n.mergeNodeData(t.id,t.data))),{nodes:o,edges:i}}initSimulation(){return function(t){var e,r=1,n=.001,o=1-Math.pow(n,1/300),i=0,s=.6,a=new Map,u=xr(c),h=ir("tick","end"),d=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Mr)/Mr}();function c(){l(),h.call("tick",e),r<n&&(u.stop(),h.call("end",e))}function l(n){var u,h,d=t.length;void 0===n&&(n=1);for(var c=0;c<n;++c)for(r+=(i-r)*o,a.forEach((function(t){t(r)})),u=0;u<d;++u)null==(h=t[u]).fx?h.x+=h.vx*=s:(h.x=h.fx,h.vx=0),null==h.fy?h.y+=h.vy*=s:(h.y=h.fy,h.vy=0);return e}function f(){for(var e,r=0,n=t.length;r<n;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var o=10*Math.sqrt(.5+r),i=r*Ar;e.x=o*Math.cos(i),e.y=o*Math.sin(i)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function g(e){return e.initialize&&e.initialize(t,d),e}return null==t&&(t=[]),f(),e={tick:l,restart:function(){return u.restart(c),e},stop:function(){return u.stop(),e},nodes:function(r){return arguments.length?(t=r,f(),a.forEach(g),e):t},alpha:function(t){return arguments.length?(r=+t,e):r},alphaMin:function(t){return arguments.length?(n=+t,e):n},alphaDecay:function(t){return arguments.length?(o=+t,e):+o},alphaTarget:function(t){return arguments.length?(i=+t,e):i},velocityDecay:function(t){return arguments.length?(s=1-t,e):1-s},randomSource:function(t){return arguments.length?(d=t,a.forEach(g),e):d},force:function(t,r){return arguments.length>1?(null==r?a.delete(t):a.set(t,g(r)),e):a.get(t)},find:function(e,r,n){var o,i,s,a,u,h=0,d=t.length;for(null==n?n=1/0:n*=n,h=0;h<d;++h)(s=(o=e-(a=t[h]).x)*o+(i=r-a.y)*i)<n&&(u=a,n=s);return u},on:function(t,r){return arguments.length>1?(h.on(t,r),e):h.on(t)}}}()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",(()=>{var e;return null===(e=t.onTick)||void 0===e?void 0:e.call(t,this.getResult())})).on("end",(()=>{var t;return null===(t=this.resolver)||void 0===t?void 0:t.call(this,this.getResult())}))),Tr(e,this.config.simulationAttrs.map((e=>[e,t[e]]))),Object.entries(this.forceMap).forEach((([r,n])=>{const o=r;if(r in t){let r=e.force(o);r||(r=n(),e.force(o,r)),Tr(r,Object.entries(t[o]))}else e.force(o,null)})),e}}const Tr=(t,e)=>e.reduce(((e,[r,n])=>e[r]&&void 0!==n?e[r].call(t,n):e),t);function Lr(t){return function(){return t}}function Fr(t){return 1e-6*(t()-.5)}function qr(t){return t.index}function Vr(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function Br(t){var e,r,n,o,i,s,a,u=qr,h=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},d=Lr(30),c=1;function l(n){for(var i=0,u=t.length;i<c;++i)for(var h,d,l,f,g,p=0,v=0,m=0,y=0;p<u;++p)d=(h=t[p]).source,v=(l=h.target).x+l.vx-d.x-d.vx||Fr(a),o>1&&(m=l.y+l.vy-d.y-d.vy||Fr(a)),o>2&&(y=l.z+l.vz-d.z-d.vz||Fr(a)),v*=f=((f=Math.sqrt(v*v+m*m+y*y))-r[p])/f*n*e[p],m*=f,y*=f,l.vx-=v*(g=s[p]),o>1&&(l.vy-=m*g),o>2&&(l.vz-=y*g),d.vx+=v*(g=1-g),o>1&&(d.vy+=m*g),o>2&&(d.vz+=y*g)}function f(){if(n){var o,a,h=n.length,d=t.length,c=new Map(n.map(((t,e)=>[u(t,e,n),t])));for(o=0,i=new Array(h);o<d;++o)(a=t[o]).index=o,"object"!=typeof a.source&&(a.source=Vr(c,a.source)),"object"!=typeof a.target&&(a.target=Vr(c,a.target)),i[a.source.index]=(i[a.source.index]||0)+1,i[a.target.index]=(i[a.target.index]||0)+1;for(o=0,s=new Array(d);o<d;++o)a=t[o],s[o]=i[a.source.index]/(i[a.source.index]+i[a.target.index]);e=new Array(d),g(),r=new Array(d),p()}}function g(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+h(t[r],r,t)}function p(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+d(t[e],e,t)}return null==t&&(t=[]),l.initialize=function(t,...e){n=t,a=e.find((t=>"function"==typeof t))||Math.random,o=e.find((t=>[1,2,3].includes(t)))||2,f()},l.links=function(e){return arguments.length?(t=e,f(),l):t},l.id=function(t){return arguments.length?(u=t,l):u},l.iterations=function(t){return arguments.length?(c=+t,l):c},l.strength=function(t){return arguments.length?(h="function"==typeof t?t:Lr(+t),g(),l):h},l.distance=function(t){return arguments.length?(d="function"==typeof t?t:Lr(+t),p(),l):d},l}function $r(t,e,r){if(isNaN(e))return t;var n,o,i,s,a,u,h=t._root,d={data:r},c=t._x0,l=t._x1;if(!h)return t._root=d,t;for(;h.length;)if((s=e>=(o=(c+l)/2))?c=o:l=o,n=h,!(h=h[a=+s]))return n[a]=d,t;if(e===(i=+t._x.call(null,h.data)))return d.next=h,n?n[a]=d:t._root=d,t;do{n=n?n[a]=new Array(2):t._root=new Array(2),(s=e>=(o=(c+l)/2))?c=o:l=o}while((a=+s)==(u=+(i>=o)));return n[u]=h,n[a]=d,t}function Ur(t,e,r){this.node=t,this.x0=e,this.x1=r}function Gr(t){return t[0]}function Wr(t,e){var r=new Yr(null==e?Gr:e,NaN,NaN);return null==t?r:r.addAll(t)}function Yr(t,e,r){this._x=t,this._x0=e,this._x1=r,this._root=void 0}function Hr(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var Kr=Wr.prototype=Yr.prototype;Kr.copy=function(){var t,e,r=new Yr(this._x,this._x0,this._x1),n=this._root;if(!n)return r;if(!n.length)return r._root=Hr(n),r;for(t=[{source:n,target:r._root=new Array(2)}];n=t.pop();)for(var o=0;o<2;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(2)}):n.target[o]=Hr(e));return r},Kr.add=function(t){const e=+this._x.call(null,t);return $r(this.cover(e),e,t)},Kr.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e);let n=1/0,o=-1/0;for(let i,s=0;s<e;++s)isNaN(i=+this._x.call(null,t[s]))||(r[s]=i,i<n&&(n=i),i>o&&(o=i));if(n>o)return this;this.cover(n).cover(o);for(let n=0;n<e;++n)$r(this,r[n],t[n]);return this},Kr.cover=function(t){if(isNaN(t=+t))return this;var e=this._x0,r=this._x1;if(isNaN(e))r=(e=Math.floor(t))+1;else{for(var n,o,i=r-e||1,s=this._root;e>t||t>=r;)switch(o=+(t<e),(n=new Array(2))[o]=s,s=n,i*=2,o){case 0:r=e+i;break;case 1:e=r-i}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._x1=r,this},Kr.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},Kr.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},Kr.find=function(t,e){var r,n,o,i,s,a=this._x0,u=this._x1,h=[],d=this._root;for(d&&h.push(new Ur(d,a,u)),null==e?e=1/0:(a=t-e,u=t+e);i=h.pop();)if(!(!(d=i.node)||(n=i.x0)>u||(o=i.x1)<a))if(d.length){var c=(n+o)/2;h.push(new Ur(d[1],c,o),new Ur(d[0],n,c)),(s=+(t>=c))&&(i=h[h.length-1],h[h.length-1]=h[h.length-1-s],h[h.length-1-s]=i)}else{var l=Math.abs(t-+this._x.call(null,d.data));l<e&&(e=l,a=t-l,u=t+l,r=d.data)}return r},Kr.remove=function(t){if(isNaN(i=+this._x.call(null,t)))return this;var e,r,n,o,i,s,a,u,h,d=this._root,c=this._x0,l=this._x1;if(!d)return this;if(d.length)for(;;){if((a=i>=(s=(c+l)/2))?c=s:l=s,e=d,!(d=d[u=+a]))return this;if(!d.length)break;e[u+1&1]&&(r=e,h=u)}for(;d.data!==t;)if(n=d,!(d=d.next))return this;return(o=d.next)&&delete d.next,n?(o?n.next=o:delete n.next,this):e?(o?e[u]=o:delete e[u],(d=e[0]||e[1])&&d===(e[1]||e[0])&&!d.length&&(r?r[h]=d:this._root=d),this):(this._root=o,this)},Kr.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},Kr.root=function(){return this._root},Kr.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},Kr.visit=function(t){var e,r,n,o,i=[],s=this._root;for(s&&i.push(new Ur(s,this._x0,this._x1));e=i.pop();)if(!t(s=e.node,n=e.x0,o=e.x1)&&s.length){var a=(n+o)/2;(r=s[1])&&i.push(new Ur(r,a,o)),(r=s[0])&&i.push(new Ur(r,n,a))}return this},Kr.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new Ur(this._root,this._x0,this._x1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.x1,u=(s+a)/2;(i=o[0])&&r.push(new Ur(i,s,u)),(i=o[1])&&r.push(new Ur(i,u,a))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.x1);return this},Kr.x=function(t){return arguments.length?(this._x=t,this):this._x};const Jr=4294967296;function Qr(t){return t.x}function Xr(t){return t.y}function Zr(t){return t.z}var tn=Math.PI*(3-Math.sqrt(5)),en=20*Math.PI/(9+Math.sqrt(221));function rn(){var t,e,r,n,o,i,s=Lr(-30),a=1,u=1/0,h=.81;function d(n){var i,s=t.length,a=(1===e?Wr(t,Qr):2===e?he(t,Qr,Xr):3===e?ye(t,Qr,Xr,Zr):null).visitAfter(l);for(o=n,i=0;i<s;++i)r=t[i],a.visit(f)}function c(){if(t){var e,r,n=t.length;for(i=new Array(n),e=0;e<n;++e)r=t[e],i[r.index]=+s(r,e,t)}}function l(t){var r,n,o,s,a,u,h=0,d=0,c=t.length;if(c){for(o=s=a=u=0;u<c;++u)(r=t[u])&&(n=Math.abs(r.value))&&(h+=r.value,d+=n,o+=n*(r.x||0),s+=n*(r.y||0),a+=n*(r.z||0));h*=Math.sqrt(4/c),t.x=o/d,e>1&&(t.y=s/d),e>2&&(t.z=a/d)}else{(r=t).x=r.data.x,e>1&&(r.y=r.data.y),e>2&&(r.z=r.data.z);do{h+=i[r.data.index]}while(r=r.next)}t.value=h}function f(t,s,d,c,l){if(!t.value)return!0;var f=[d,c,l][e-1],g=t.x-r.x,p=e>1?t.y-r.y:0,v=e>2?t.z-r.z:0,m=f-s,y=g*g+p*p+v*v;if(m*m/h<y)return y<u&&(0===g&&(y+=(g=Fr(n))*g),e>1&&0===p&&(y+=(p=Fr(n))*p),e>2&&0===v&&(y+=(v=Fr(n))*v),y<a&&(y=Math.sqrt(a*y)),r.vx+=g*t.value*o/y,e>1&&(r.vy+=p*t.value*o/y),e>2&&(r.vz+=v*t.value*o/y)),!0;if(!(t.length||y>=u)){(t.data!==r||t.next)&&(0===g&&(y+=(g=Fr(n))*g),e>1&&0===p&&(y+=(p=Fr(n))*p),e>2&&0===v&&(y+=(v=Fr(n))*v),y<a&&(y=Math.sqrt(a*y)));do{t.data!==r&&(m=i[t.data.index]*o/y,r.vx+=g*m,e>1&&(r.vy+=p*m),e>2&&(r.vz+=v*m))}while(t=t.next)}}return d.initialize=function(r,...o){t=r,n=o.find((t=>"function"==typeof t))||Math.random,e=o.find((t=>[1,2,3].includes(t)))||2,c()},d.strength=function(t){return arguments.length?(s="function"==typeof t?t:Lr(+t),c(),d):s},d.distanceMin=function(t){return arguments.length?(a=t*t,d):Math.sqrt(a)},d.distanceMax=function(t){return arguments.length?(u=t*t,d):Math.sqrt(u)},d.theta=function(t){return arguments.length?(h=t*t,d):Math.sqrt(h)},d}function nn(t,e,r){var n,o=1;function i(){var i,s,a=n.length,u=0,h=0,d=0;for(i=0;i<a;++i)u+=(s=n[i]).x||0,h+=s.y||0,d+=s.z||0;for(u=(u/a-t)*o,h=(h/a-e)*o,d=(d/a-r)*o,i=0;i<a;++i)s=n[i],u&&(s.x-=u),h&&(s.y-=h),d&&(s.z-=d)}return null==t&&(t=0),null==e&&(e=0),null==r&&(r=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.z=function(t){return arguments.length?(r=+t,i):r},i.strength=function(t){return arguments.length?(o=+t,i):o},i}function on(t){return t.x+t.vx}function sn(t){return t.y+t.vy}function an(t){return t.z+t.vz}function un(t){var e,r,n,o,i=1,s=1;function a(){for(var t,a,h,d,c,l,f,g,p=e.length,v=0;v<s;++v)for(a=(1===r?Wr(e,on):2===r?he(e,on,sn):3===r?ye(e,on,sn,an):null).visitAfter(u),t=0;t<p;++t)h=e[t],f=n[h.index],g=f*f,d=h.x+h.vx,r>1&&(c=h.y+h.vy),r>2&&(l=h.z+h.vz),a.visit(m);function m(t,e,n,s,a,u,p){var v=[e,n,s,a,u,p],m=v[0],y=v[1],w=v[2],x=v[r],b=v[r+1],E=v[r+2],N=t.data,M=t.r,_=f+M;if(!N)return m>d+_||x<d-_||r>1&&(y>c+_||b<c-_)||r>2&&(w>l+_||E<l-_);if(N.index>h.index){var k=d-N.x-N.vx,A=r>1?c-N.y-N.vy:0,j=r>2?l-N.z-N.vz:0,S=k*k+A*A+j*j;S<_*_&&(0===k&&(S+=(k=Fr(o))*k),r>1&&0===A&&(S+=(A=Fr(o))*A),r>2&&0===j&&(S+=(j=Fr(o))*j),S=(_-(S=Math.sqrt(S)))/S*i,h.vx+=(k*=S)*(_=(M*=M)/(g+M)),r>1&&(h.vy+=(A*=S)*_),r>2&&(h.vz+=(j*=S)*_),N.vx-=k*(_=1-_),r>1&&(N.vy-=A*_),r>2&&(N.vz-=j*_))}}}function u(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<Math.pow(2,r);++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function h(){if(e){var r,o,i=e.length;for(n=new Array(i),r=0;r<i;++r)o=e[r],n[o.index]=+t(o,r,e)}}return"function"!=typeof t&&(t=Lr(null==t?1:+t)),a.initialize=function(t,...n){e=t,o=n.find((t=>"function"==typeof t))||Math.random,r=n.find((t=>[1,2,3].includes(t)))||2,h()},a.iterations=function(t){return arguments.length?(s=+t,a):s},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:Lr(+e),h(),a):t},a}function hn(t,e,r,n){var o,i,s,a,u=Lr(.1);function h(t){for(var u=0,h=o.length;u<h;++u){var d=o[u],c=d.x-e||1e-6,l=(d.y||0)-r||1e-6,f=(d.z||0)-n||1e-6,g=Math.sqrt(c*c+l*l+f*f),p=(a[u]-g)*s[u]*t/g;d.vx+=c*p,i>1&&(d.vy+=l*p),i>2&&(d.vz+=f*p)}}function d(){if(o){var e,r=o.length;for(s=new Array(r),a=new Array(r),e=0;e<r;++e)a[e]=+t(o[e],e,o),s[e]=isNaN(a[e])?0:+u(o[e],e,o)}}return"function"!=typeof t&&(t=Lr(+t)),null==e&&(e=0),null==r&&(r=0),null==n&&(n=0),h.initialize=function(t,...e){o=t,i=e.find((t=>[1,2,3].includes(t)))||2,d()},h.strength=function(t){return arguments.length?(u="function"==typeof t?t:Lr(+t),d(),h):u},h.radius=function(e){return arguments.length?(t="function"==typeof e?e:Lr(+e),d(),h):t},h.x=function(t){return arguments.length?(e=+t,h):e},h.y=function(t){return arguments.length?(r=+t,h):r},h.z=function(t){return arguments.length?(n=+t,h):n},h}function dn(t){var e,r,n,o=Lr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Lr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Lr(+t),s(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:Lr(+e),s(),i):t},i}function cn(t){var e,r,n,o=Lr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Lr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Lr(+t),s(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:Lr(+e),s(),i):t},i}function ln(t){var e,r,n,o=Lr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vz+=(n[i]-o.z)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Lr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Lr(+t),s(),i):o},i.z=function(e){return arguments.length?(t="function"==typeof e?e:Lr(+e),s(),i):t},i}var fn=r(4341),gn=r.n(fn);class pn{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,pn.defaultOptions,t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,t,Object.assign(Object.assign({},this.options),r))}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,t,Object.assign(Object.assign({},this.options),r))}))}genericDagreLayout(r,n,o){return e(this,void 0,void 0,(function*(){const{nodeSize:e}=o,i=new fn.graphlib.Graph;i.setGraph(o),i.setDefaultEdgeLabel((()=>({}))),[...n.getAllNodes(),...n.getAllEdges()].some((({id:t})=>l(t)))&&console.error("Dagre layout only support string id, it will convert number to string."),n.getAllNodes().forEach((t=>{const{id:r}=t,n=Object.assign({},t.data);if(void 0!==e){const[r,o]=function(t){if(!t)return[0,0,0];if(l(t))return[t,t,t];if(0===t.length)return[0,0,0];const[e,r=e,n=e]=t;return[e,r,n]}(Ut(e)?e(t):e);Object.assign(n,{width:r,height:o})}i.setNode(r.toString(),n)})),n.getAllEdges().forEach((({id:t,source:e,target:r})=>{i.setEdge(e.toString(),r.toString(),{id:t})})),gn().layout(i);const s={nodes:[],edges:[]};return i.nodes().forEach((t=>{const e=i.node(t);s.nodes.push({id:t,data:e}),r&&n.mergeNodeData(t,e)})),i.edges().forEach((e=>{const o=i.edge(e),{id:a}=o,u=t(o,["id"]),{v:h,w:d}=e;s.edges.push({id:a,source:h,target:d,data:u}),r&&n.mergeEdgeData(a,u)})),s}))}}pn.defaultOptions={};class vn{constructor(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}distanceTo(t){const e=this.rx-t.rx,r=this.ry-t.ry;return Math.hypot(e,r)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,r=t.ry-this.ry;let n=Math.hypot(e,r);n=n<1e-4?1e-4:n;const o=this.g*(this.degree+1)*(t.degree+1)/n;this.fx+=o*e/n,this.fy+=o*r/n}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,r=(this.rx*this.mass+t.rx*t.mass)/e,n=(this.ry*this.mass+t.ry*t.mass)/e,o=this.degree+t.degree;return new vn({rx:r,ry:n,mass:e,degree:o})}}class mn{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const r=this.length/2;return t<=this.xmid+r&&t>=this.xmid-r&&e<=this.ymid+r&&e>=this.ymid-r}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new mn({xmid:t,ymid:e,length:r})}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new mn({xmid:t,ymid:e,length:r})}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new mn({xmid:t,ymid:e,length:r})}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new mn({xmid:t,ymid:e,length:r})}}class yn{constructor(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}insert(t){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new yn(this.quad.NW()),this.NE=new yn(this.quad.NE()),this.SW=new yn(this.quad.SW()),this.SE=new yn(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t)):this.body=t}_putBody(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))}_isExternal(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE}updateForce(t){null!=this.body&&t!==this.body&&(this._isExternal()||(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t)))}}const wn={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1},xn={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},bn={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300},En=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;return null==e?r=Math.min(n,o):Math.min(n,o)===t.rows?t.rows=e:t.cols=e,r},Nn=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;return null==e?r=Math.max(n,o):Math.max(n,o)===t.rows?t.rows=e:t.cols=e,r},Mn=(t,e)=>t[`c-${e.row}-${e.col}`]||!1,_n=(t,e)=>t[`c-${e.row}-${e.col}`]=!0,kn=(t,e)=>{const r=t.cols||5;e.col++,e.col>=r&&(e.col=0,e.row++)},An=(t,e,r,n,o,i,s,a)=>{let u,h;const d=o[t.id];if(d)u=d.col*r+r/2+e[0],h=d.row*n+n/2+e[1];else{for(;Mn(a,s);)kn(i,s);u=s.col*r+r/2+e[0],h=s.row*n+n/2+e[1],_n(a,s),kn(i,s)}t.data.x=u,t.data.y=h},jn={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},Sn=(t,e,r,n,o,i)=>{e.forEach(((s,a)=>{r[a]={x:0,y:0},e.forEach(((e,u)=>{if(a===u)return;if(o[a]!==o[u])return;let h=s.x-e.x,d=s.y-e.y,c=Math.sqrt(h*h+d*d);if(0===c){c=1;const t=a>u?1:-1;h=.01*t,d=.01*t}if(c<i(t[a])/2+i(t[u])/2){const t=n*n/c;r[a].x+=h/c*t,r[a].y+=d/c*t}}))}))},On=(t,e,r,n,o,i,s,a)=>{const u=i||s/10;return n&&e.forEach(((e,r)=>{const n=t[r].x-t[o].x,i=t[r].y-t[o].y,s=Math.sqrt(n*n+i*i);let a=i/s,u=-n/s;const h=Math.sqrt(e.x*e.x+e.y*e.y);let d=Math.acos((a*e.x+u*e.y)/h);d>Math.PI/2&&(d-=Math.PI/2,a*=-1,u*=-1);const c=Math.cos(d)*h;e.x=a*c,e.y=u*c})),t.forEach(((i,s)=>{if(s===o)return;const h=Math.sqrt(e[s].x*e[s].x+e[s].y*e[s].y);if(h>0&&s!==o){const d=Math.min(u*(r/800),h);if(i.x+=e[s].x/h*d,i.y+=e[s].y/h*d,n){let e=i.x-t[o].x,r=i.y-t[o].y;const n=Math.sqrt(e*e+r*r);e=e/n*a[s],r=r/n*a[s],i.x=t[o].x+e,i.y=t[o].y+r}}})),t},zn={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10},Rn={center:[0,0],width:300,height:300},In={circular:class{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},Zt),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericCircularLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericCircularLayout(!0,t,r)}))}genericCircularLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{width:o,height:i,center:s,divisions:a,startAngle:u=0,endAngle:h=2*Math.PI,angleRatio:d,ordering:c,clockwise:l,nodeSpacing:f,nodeSize:g}=e,p=r.getAllNodes(),v=r.getAllEdges(),[m,y,w]=((t,e,r)=>{let n=t,o=e,i=r;return n||"undefined"==typeof window||(n=window.innerWidth),o||"undefined"==typeof window||(o=window.innerHeight),i||(i=[n/2,o/2]),[n,o,i]})(o,i,s),x=null==p?void 0:p.length;if(!x||1===x)return Xt(r,t,w);const b=(h-u)/x;let{radius:E,startRadius:N,endRadius:M}=e;if(f){const t=Wt(10,f),e=Yt(10,g);let r=-1/0;p.forEach((t=>{const n=e(t);r<n&&(r=n)}));let n=0;p.forEach(((e,o)=>{n+=0===o?r||10:(t(e)||0)+(r||10)})),E=n/(2*Math.PI)}else E||N||M?!N&&M?N=M:N&&!M&&(M=N):E=Math.min(y,m)/2;const _=b*d;let k=[];k="topology"===c?te(r,p):"topology-directed"===c?te(r,p,!0):"degree"===c?function(t,e){const r=[];return e.forEach(((t,e)=>{r.push(Jt(t))})),r.sort(((e,r)=>t.getDegree(e.id,"both")-t.getDegree(r.id,"both"))),r}(r,p):p.map((t=>Jt(t)));const A=Math.ceil(x/a);for(let t=0;t<x;++t){let e=E;e||null===N||null===M||(e=N+t*(M-N)/(x-1)),e||(e=10+100*t/(x-1));let r=u+t%A*_+2*Math.PI/a*Math.floor(t/A);l||(r=h-t%A*_-2*Math.PI/a*Math.floor(t/A)),k[t].data.x=w[0]+Math.cos(r)*e,k[t].data.y=w[1]+Math.sin(r)*e}return t&&k.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),{nodes:k,edges:v}}))}},concentric:oe,mds:Fe,random:class{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},Rn),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericRandomLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericRandomLayout(!0,t,r)}))}genericRandomLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{center:o,width:i,height:s}=e,a=r.getAllNodes(),u=i||"undefined"==typeof window?i:window.innerWidth,h=s||"undefined"==typeof window?s:window.innerHeight,d=o||[u/2,h/2],c=[];return a&&a.forEach((t=>{c.push({id:t.id,data:{x:.9*(Math.random()-.5)*u+d[0],y:.9*(Math.random()-.5)*h+d[1]}})})),t&&c.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:c,edges:r.getAllEdges()}}))}},grid:class{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},bn),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericGridLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericGridLayout(!0,t,r)}))}genericGridLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{begin:o=[0,0],condense:i,preventOverlapPadding:s,preventOverlap:a,rows:u,cols:h,nodeSpacing:d,nodeSize:c,width:f,height:g,position:p}=e;let{sortBy:v}=e;const m=r.getAllNodes(),y=r.getAllEdges(),w=null==m?void 0:m.length;if(!w||1===w)return Xt(r,t,o);const x=m.map((t=>Jt(t)));"id"===v||ee(v)&&void 0!==x[0].data[v]||(v="degree"),"degree"===v?x.sort(((t,e)=>r.getDegree(e.id,"both")-r.getDegree(t.id,"both"))):"id"===v?x.sort(((t,e)=>l(e.id)&&l(t.id)?e.id-t.id:`${t.id}`.localeCompare(`${e.id}`))):x.sort(((t,e)=>e.data[v]-t.data[v]));const b=f||"undefined"==typeof window?f:window.innerWidth,E=g||"undefined"==typeof window?g:window.innerHeight,N=w,M={rows:u,cols:h};if(null!=u&&null!=h)M.rows=u,M.cols=h;else if(null!=u&&null==h)M.rows=u,M.cols=Math.ceil(N/M.rows);else if(null==u&&null!=h)M.cols=h,M.rows=Math.ceil(N/M.cols);else{const t=Math.sqrt(N*E/b);M.rows=Math.round(t),M.cols=Math.round(b/E*t)}if(M.rows=Math.max(M.rows,1),M.cols=Math.max(M.cols,1),M.cols*M.rows>N){const t=En(M),e=Nn(M);(t-1)*e>=N?En(M,t-1):(e-1)*t>=N&&Nn(M,e-1)}else for(;M.cols*M.rows<N;){const t=En(M),e=Nn(M);(e+1)*t>=N?Nn(M,e+1):En(M,t+1)}let _=i?0:b/M.cols,k=i?0:E/M.rows;if(a||d){const t=Wt(10,d),e=Yt(30,c,!1);x.forEach((n=>{n.data.x&&n.data.y||(n.data.x=0,n.data.y=0);const o=r.getNode(n.id),i=e(o)||30;let a,u;re(i)?(a=i[0],u=i[1]):(a=i,u=i);const h=void 0!==t?t(n):s,d=a+h,c=u+h;_=Math.max(_,d),k=Math.max(k,c)}))}const A={},j={row:0,col:0},S={};for(let t=0;t<x.length;t++){const e=x[t];let n;if(p&&(n=p(r.getNode(e.id))),n&&(void 0!==n.row||void 0!==n.col)){const t={row:n.row,col:n.col};if(void 0===t.col)for(t.col=0;Mn(A,t);)t.col++;else if(void 0===t.row)for(t.row=0;Mn(A,t);)t.row++;S[e.id]=t,_n(A,t)}An(e,o,_,k,S,M,j,A)}const O={nodes:x,edges:y};return t&&x.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),O}))}},radial:class{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},zn),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericRadialLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericRadialLayout(!0,t,r)}))}genericRadialLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{width:o,height:i,center:s,focusNode:a,unitRadius:u,nodeSize:h,nodeSpacing:d,strictRadial:c,preventOverlap:l,maxPreventOverlapIteration:f,sortBy:g,linkDistance:p=50,sortStrength:v=10,maxIteration:m=1e3}=e,y=r.getAllNodes(),w=r.getAllEdges(),x=o||"undefined"==typeof window?o:window.innerWidth,b=i||"undefined"==typeof window?i:window.innerHeight,E=s||[x/2,b/2];if(!(null==y?void 0:y.length)||1===y.length)return Xt(r,t,E);let N=y[0];if(ee(a)){for(let t=0;t<y.length;t++)if(y[t].id===a){N=y[t];break}}else N=a||y[0];const M=((t,e)=>{let r=-1;return t.forEach(((t,n)=>{t.id===e&&(r=n)})),Math.max(r,0)})(y,N.id),_=De({nodes:y,edges:w},!1),k=Ce(_),A=((t,e)=>{let r=0;for(let n=0;n<t[e].length;n++)t[e][n]!==1/0&&(r=t[e][n]>r?t[e][n]:r);return r})(k,M);((t,e,r)=>{const n=t.length;for(let o=0;o<n;o++)if(t[e][o]===1/0){t[e][o]=r,t[o][e]=r;for(let i=0;i<n;i++)t[o][i]!==1/0&&t[e][i]===1/0&&(t[e][i]=r+t[o][i],t[i][e]=r+t[o][i])}for(let r=0;r<n;r++)if(r!==e)for(let o=0;o<n;o++)if(t[r][o]===1/0){let n=Math.abs(t[e][r]-t[e][o]);n=0===n?1:n,t[r][o]=n}})(k,M,A+1);const j=k[M];let S=x-E[0]>E[0]?E[0]:x-E[0],O=b-E[1]>E[1]?E[1]:b-E[1];0===S&&(S=x/2),0===O&&(O=b/2);const z=Math.min(S,O),R=Math.max(...j),I=[],C=u||z/R;j.forEach(((t,e)=>{I[e]=t*C}));const D=((t,e,r,n,o,i,s)=>{if(!t)return[];const a=[];if(e){const u={};e.forEach(((e,h)=>{const d=[];e.forEach(((e,a)=>{var c,l;if(h===a)d.push(0);else if(n[h]===n[a])if("data"===i)d.push(e*(Math.abs(h-a)*s)/(n[h]/o));else if(i){let r,f;if(u[t[h].id])r=u[t[h].id];else{const e=("id"===i?t[h].id:null===(c=t[h].data)||void 0===c?void 0:c[i])||0;r=ee(e)?e.charCodeAt(0):e,u[t[h].id]=r}if(u[t[a].id])f=u[t[a].id];else{const e=("id"===i?t[a].id:null===(l=t[a].data)||void 0===l?void 0:l[i])||0;f=ee(e)?e.charCodeAt(0):e,u[t[a].id]=f}d.push(e*(Math.abs(r-f)*s)/(n[h]/o))}else d.push(e*r/(n[h]/o));else{const t=(r+o)/2;d.push(e*t)}})),a.push(d)}))}return a})(y,k,p,I,C,g,v),P=(t=>{const e=t.length,r=t[0].length,n=[];for(let o=0;o<e;o++){const e=[];for(let n=0;n<r;n++)0!==t[o][n]?e.push(1/(t[o][n]*t[o][n])):e.push(0);n.push(e)}return n})(D),T=((t,e,r)=>{try{const r=Re.mul(Re.pow(e,2),-.5),n=r.mean("row"),o=r.mean("column"),i=r.mean();r.add(i).subRowVector(n).subColumnVector(o);const s=new Ie(r),a=Re.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map((e=>Re.mul([e],[a]).toJSON()[0].splice(0,t)))}catch(t){const n=[];for(let t=0;t<e.length;t++){const t=Math.random()*r,e=Math.random()*r;n.push([t,e])}return n}})(p,D,p);let L,F=T.map((([t,e])=>({x:(isNaN(t)?Math.random()*p:t)-T[M][0],y:(isNaN(e)?Math.random()*p:e)-T[M][1]})));if(this.run(m,F,P,D,I,M),l){L=Ht(h,d);const t={nodes:y,nodeSizeFunc:L,positions:F,radii:I,height:b,width:x,strictRadial:Boolean(c),focusIdx:M,iterations:f||200,k:F.length/4.5};F=((t,e)=>{const r=Object.assign(Object.assign({},jn),e),{positions:n,iterations:o,width:i,k:s,speed:a=100,strictRadial:u,focusIdx:h,radii:d=[],nodeSizeFunc:c}=r,l=t.getAllNodes(),f=[],g=i/10;for(let t=0;t<o;t++)n.forEach(((t,e)=>{f[e]={x:0,y:0}})),Sn(l,n,f,s,d,c),On(n,f,a,u,h,g,i,d);return n})(r,t)}const q=[];return F.forEach(((t,e)=>{const r=Jt(y[e]);r.data.x=t.x+E[0],r.data.y=t.y+E[1],q.push(r)})),t&&q.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:q,edges:w}}))}run(t,e,r,n,o,i){for(let s=0;s<=t;s++){const a=s/t;this.oneIteration(a,e,o,n,r,i)}}oneIteration(t,e,r,n,o,i){const s=1-t;e.forEach(((a,u)=>{const h=Pe(a,{x:0,y:0}),d=0===h?0:1/h;if(u===i)return;let c=0,l=0,f=0;e.forEach(((t,e)=>{if(u===e)return;const r=Pe(a,t),i=0===r?0:1/r,s=n[e][u];f+=o[u][e],c+=o[u][e]*(t.x+s*(a.x-t.x)*i),l+=o[u][e]*(t.y+s*(a.y-t.y)*i)}));const g=0===r[u]?0:1/r[u];f*=s,f+=t*g*g,c*=s,c+=t*g*a.x*d,a.x=c/f,l*=s,l+=t*g*a.y*d,a.y=l/f}))}},force:_e,d3force:Pr,"d3-force-3d":class extends Pr{constructor(){super(...arguments),this.id="d3-force-3d",this.config={inputNodeAttrs:["x","y","z","vx","vy","vz","fx","fy","fz"],outputNodeAttrs:["x","y","z","vx","vy","vz"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource","numDimensions"]},this.forceMap={link:Br,manyBody:rn,center:nn,collide:un,radial:hn,x:dn,y:cn,z:ln},this.options={numDimensions:3,link:{id:t=>t.id},manyBody:{},center:{x:0,y:0,z:0}}}initSimulation(){return function(t,e){e=e||2;var r,n=Math.min(3,Math.max(1,Math.round(e))),o=1,i=.001,s=1-Math.pow(i,1/300),a=0,u=.6,h=new Map,d=xr(f),c=ir("tick","end"),l=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Jr)/Jr}();function f(){g(),c.call("tick",r),o<i&&(d.stop(),c.call("end",r))}function g(e){var i,d,c=t.length;void 0===e&&(e=1);for(var l=0;l<e;++l)for(o+=(a-o)*s,h.forEach((function(t){t(o)})),i=0;i<c;++i)null==(d=t[i]).fx?d.x+=d.vx*=u:(d.x=d.fx,d.vx=0),n>1&&(null==d.fy?d.y+=d.vy*=u:(d.y=d.fy,d.vy=0)),n>2&&(null==d.fz?d.z+=d.vz*=u:(d.z=d.fz,d.vz=0));return r}function p(){for(var e,r=0,o=t.length;r<o;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),null!=e.fz&&(e.z=e.fz),isNaN(e.x)||n>1&&isNaN(e.y)||n>2&&isNaN(e.z)){var i=10*(n>2?Math.cbrt(.5+r):n>1?Math.sqrt(.5+r):r),s=r*tn,a=r*en;1===n?e.x=i:2===n?(e.x=i*Math.cos(s),e.y=i*Math.sin(s)):(e.x=i*Math.sin(s)*Math.cos(a),e.y=i*Math.cos(s),e.z=i*Math.sin(s)*Math.sin(a))}(isNaN(e.vx)||n>1&&isNaN(e.vy)||n>2&&isNaN(e.vz))&&(e.vx=0,n>1&&(e.vy=0),n>2&&(e.vz=0))}}function v(e){return e.initialize&&e.initialize(t,l,n),e}return null==t&&(t=[]),p(),r={tick:g,restart:function(){return d.restart(f),r},stop:function(){return d.stop(),r},numDimensions:function(t){return arguments.length?(n=Math.min(3,Math.max(1,Math.round(t))),h.forEach(v),r):n},nodes:function(e){return arguments.length?(t=e,p(),h.forEach(v),r):t},alpha:function(t){return arguments.length?(o=+t,r):o},alphaMin:function(t){return arguments.length?(i=+t,r):i},alphaDecay:function(t){return arguments.length?(s=+t,r):+s},alphaTarget:function(t){return arguments.length?(a=+t,r):a},velocityDecay:function(t){return arguments.length?(u=1-t,r):1-u},randomSource:function(t){return arguments.length?(l=t,h.forEach(v),r):l},force:function(t,e){return arguments.length>1?(null==e?h.delete(t):h.set(t,v(e)),r):h.get(t)},find:function(){var e,r,o,i,s,a,u=Array.prototype.slice.call(arguments),h=u.shift()||0,d=(n>1?u.shift():null)||0,c=(n>2?u.shift():null)||0,l=u.shift()||1/0,f=0,g=t.length;for(l*=l,f=0;f<g;++f)(i=(e=h-(s=t[f]).x)*e+(r=d-(s.y||0))*r+(o=c-(s.z||0))*o)<l&&(a=s,l=i);return a},on:function(t,e){return arguments.length>1?(c.on(t,e),r):c.on(t)}}}()}},fruchterman:class{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},xn),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericFruchtermanLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericFruchtermanLayout(!0,t,r)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;e<t;e++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericFruchtermanLayout(t,r,n){return e(this,void 0,void 0,(function*(){if(this.running)return;const e=this.formatOptions(n),{dimensions:o,width:i,height:s,center:a,clustering:u,nodeClusterBy:d,maxIteration:c,onTick:l}=e,f=r.getAllNodes(),g=r.getAllEdges();if(!(null==f?void 0:f.length)){const t={nodes:[],edges:g};return this.lastResult=t,t}if(1===f.length){t&&r.mergeNodeData(f[0].id,{x:a[0],y:a[1],z:3===o?a[2]:void 0});const e={nodes:[Object.assign(Object.assign({},f[0]),{data:Object.assign(Object.assign({},f[0].data),{x:a[0],y:a[1],z:3===o?a[2]:void 0})})],edges:g};return this.lastResult=e,e}const p=f.map((t=>Jt(t,[i,s]))),v=new h({nodes:p,edges:g}),m={};if(u&&p.forEach((t=>{const e=t.data[d];m[e]||(m[e]={name:e,cx:0,cy:0,count:0})})),this.lastLayoutNodes=p,this.lastLayoutEdges=g,this.lastAssign=t,this.lastGraph=v,this.lastOptions=e,this.lastClusterMap=m,"undefined"==typeof window)return;let y=0;return new Promise((n=>{this.timeInterval=window.setInterval((()=>{this.running?(this.runOneStep(v,m,e),t&&p.forEach((({id:t,data:e})=>r.mergeNodeData(t,{x:e.x,y:e.y,z:3===o?e.z:void 0}))),null==l||l({nodes:p,edges:g}),y++,y>=c&&(window.clearInterval(this.timeInterval),n({nodes:p,edges:g}))):n({nodes:p,edges:g})}),0),this.running=!0}))}))}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:r,nodeClusterBy:n}=e,{center:o,width:i,height:s}=e;return e.width=i||"undefined"==typeof window?i:window.innerWidth,e.height=s||"undefined"==typeof window?s:window.innerHeight,e.center=o||[e.width/2,e.height/2],e.clustering=r&&!!n,e}runOneStep(t,e,r){const{dimensions:n,height:o,width:i,gravity:s,center:a,speed:u,clustering:h,nodeClusterBy:d,clusterGravity:c}=r,f=o*i,g=Math.sqrt(f)/10,p=t.getAllNodes(),v=f/(p.length+1),m=Math.sqrt(v),y={};if(this.applyCalculate(t,y,m,v),h){for(const t in e)e[t].cx=0,e[t].cy=0,e[t].count=0;p.forEach((t=>{const{data:r}=t,n=e[r[d]];l(r.x)&&(n.cx+=r.x),l(r.y)&&(n.cy+=r.y),n.count++}));for(const t in e)e[t].cx/=e[t].count,e[t].cy/=e[t].count;const t=c||s;p.forEach(((r,n)=>{const{id:o,data:i}=r;if(!l(i.x)||!l(i.y))return;const s=e[i[d]],a=Math.sqrt((i.x-s.cx)*(i.x-s.cx)+(i.y-s.cy)*(i.y-s.cy)),u=m*t;y[o].x-=u*(i.x-s.cx)/a,y[o].y-=u*(i.y-s.cy)/a}))}p.forEach(((t,e)=>{const{id:r,data:o}=t;if(!l(o.x)||!l(o.y))return;const i=.01*m*s;y[r].x-=i*(o.x-a[0]),y[r].y-=i*(o.y-a[1]),3===n&&(y[r].z-=i*(o.z-a[2]))})),p.forEach(((e,r)=>{const{id:o,data:i}=e;if(l(i.fx)&&l(i.fy))return i.x=i.fx,i.y=i.fy,void(3===n&&(i.z=i.fz));if(!l(i.x)||!l(i.y))return;const s=Math.sqrt(y[o].x*y[o].x+y[o].y*y[o].y+(3===n?y[o].z*y[o].z:0));if(s>0){const e=Math.min(g*(u/800),s);t.mergeNodeData(o,{x:i.x+y[o].x/s*e,y:i.y+y[o].y/s*e,z:3===n?i.z+y[o].z/s*e:void 0})}}))}applyCalculate(t,e,r,n){this.calRepulsive(t,e,n),this.calAttractive(t,e,r)}calRepulsive(t,e,r){const n=t.getAllNodes();n.forEach((({data:t,id:o},i)=>{e[o]={x:0,y:0,z:0},n.forEach((({data:n,id:s},a)=>{if(i<=a||!l(t.x)||!l(n.x)||!l(t.y)||!l(n.y))return;let u=t.x-n.x,h=t.y-n.y,d=3===this.options.dimensions?t.z-n.z:0,c=u*u+h*h+d*d;0===c&&(c=1,u=.01,h=.01,d=.01);const f=r/c,g=u*f,p=h*f,v=d*f;e[o].x+=g,e[o].y+=p,e[s].x-=g,e[s].y-=p,3===this.options.dimensions&&(e[o].z+=v,e[s].z-=v)}))}))}calAttractive(t,e,r){t.getAllEdges().forEach((n=>{const{source:o,target:i}=n;if(!o||!i||o===i)return;const{data:s}=t.getNode(o),{data:a}=t.getNode(i);if(!(l(a.x)&&l(s.x)&&l(a.y)&&l(s.y)))return;const u=a.x-s.x,h=a.y-s.y,d=3===this.options.dimensions?a.z-s.z:0,c=Math.sqrt(u*u+h*h+d*d)/r,f=u*c,g=h*c,p=d*c;e[o].x+=f,e[o].y+=g,e[i].x-=f,e[i].y-=g,3===this.options.dimensions&&(e[o].z+=p,e[i].z-=p)}))}},forceAtlas2:class{constructor(t={}){this.options=t,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},wn),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericForceAtlas2Layout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericForceAtlas2Layout(!0,t,r)}))}genericForceAtlas2Layout(t,r,n){return e(this,void 0,void 0,(function*(){const e=r.getAllEdges(),o=r.getAllNodes(),i=this.formatOptions(n,o.length),{width:s,height:a,prune:u,maxIteration:d,nodeSize:c,center:l}=i;if(!(null==o?void 0:o.length)||1===o.length)return Xt(r,t,l);const f=o.map((t=>Jt(t,[s,a]))),g=e.filter((t=>{const{source:e,target:r}=t;return e!==r})),p=new h({nodes:f,edges:g}),v=this.getSizes(p,r,c);if(this.run(p,r,d,v,t,i),u){for(let t=0;t<g.length;t+=1){const{source:e,target:r}=g[t],n=p.getDegree(e),o=p.getDegree(e);if(n<=1){const t=p.getNode(r);p.mergeNodeData(e,{x:t.data.x,y:t.data.y})}else if(o<=1){const t=p.getNode(e);p.mergeNodeData(r,{x:t.data.x,y:t.data.y})}}const e=Object.assign(Object.assign({},i),{prune:!1,barnesHut:!1});this.run(p,r,100,v,t,e)}return{nodes:f,edges:e}}))}getSizes(t,e,r){const n=t.getAllNodes(),o={};for(let t=0;t<n.length;t+=1){const{id:i,data:s}=n[t];if(o[i]=10,l(s.size))o[i]=s.size;else if(re(s.size))isNaN(s.size[0])||(o[i]=Math.max(s.size[0])),isNaN(s.size[1])||(o[i]=Math.max(s.size[1]));else if(Gt(s.size))o[i]=Math.max(s.size.width,s.size.height);else if(Ut(r)){const t=r(e.getNode(i));re(t)?o[i]=Math.max(...t):o[i]=t}else re(r)?o[i]=Math.max(...r):l(r)&&(o[i]=r)}return o}formatOptions(t={},e){const r=Object.assign(Object.assign({},this.options),t),{center:n,width:o,height:i,barnesHut:s,prune:a,maxIteration:u,kr:h,kg:d}=r;return r.width=o||"undefined"==typeof window?o:window.innerWidth,r.height=i||"undefined"==typeof window?i:window.innerHeight,r.center=n||[r.width/2,r.height/2],void 0===s&&e>250&&(r.barnesHut=!0),void 0===a&&e>100&&(r.prune=!0),0!==u||a?0===u&&a&&(r.maxIteration=100,e<=200&&e>100?r.maxIteration=500:e>200&&(r.maxIteration=950)):(r.maxIteration=250,e<=200&&e>100?r.maxIteration=1e3:e>200&&(r.maxIteration=1200)),h||(r.kr=50,e>100&&e<=500?r.kr=20:e>500&&(r.kr=1)),d||(r.kg=20,e>100&&e<=500?r.kg=10:e>500&&(r.kg=1)),r}run(t,e,r,n,o,i){const{kr:s,barnesHut:a,onTick:u}=i,h=t.getAllNodes();let d=0,c=r;const l={},f={},g={};for(let e=0;e<h.length;e+=1){const{data:r,id:n}=h[e];if(l[n]=[0,0],a){const o={id:e,rx:r.x,ry:r.y,mass:1,g:s,degree:t.getDegree(n)};g[n]=new vn(o)}}for(;c>0;)d=this.oneStep(t,{iter:c,preventOverlapIters:50,krPrime:100,sg:d,forces:l,preForces:f,bodies:g,sizes:n},i),c--,null==u||u({nodes:h,edges:e.getAllEdges()});return t}oneStep(t,e,r){const{iter:n,preventOverlapIters:o,krPrime:i,sg:s,preForces:a,bodies:u,sizes:h}=e;let{forces:d}=e;const{preventOverlap:c,barnesHut:l}=r,f=t.getAllNodes();for(let t=0;t<f.length;t+=1){const{id:e}=f[t];a[e]=[...d[e]],d[e]=[0,0]}return d=this.getAttrForces(t,n,o,h,d,r),d=l&&(c&&n>o||!c)?this.getOptRepGraForces(t,d,u,r):this.getRepGraForces(t,n,o,d,i,h,r),this.updatePos(t,d,a,s,r)}getAttrForces(t,e,r,n,o,i){const{preventOverlap:s,dissuadeHubs:a,mode:u,prune:h}=i,d=t.getAllEdges();for(let i=0;i<d.length;i+=1){const{source:c,target:l}=d[i],f=t.getNode(c),g=t.getNode(l),p=t.getDegree(c),v=t.getDegree(l);if(h&&(p<=1||v<=1))continue;const m=[g.data.x-f.data.x,g.data.y-f.data.y];let y=Math.hypot(m[0],m[1]);y=y<1e-4?1e-4:y,m[0]=m[0]/y,m[1]=m[1]/y,s&&e<r&&(y=y-n[c]-n[l]);let w=y,x=w;"linlog"===u&&(w=Math.log(1+y),x=w),a&&(w=y/p,x=y/v),s&&e<r&&y<=0?(w=0,x=0):s&&e<r&&y>0&&(w=y,x=y),o[c][0]+=w*m[0],o[l][0]-=x*m[0],o[c][1]+=w*m[1],o[l][1]-=x*m[1]}return o}getOptRepGraForces(t,e,r,n){const{kg:o,center:i,prune:s}=n,a=t.getAllNodes(),u=a.length;let h=9e10,d=-9e10,c=9e10,l=-9e10;for(let e=0;e<u;e+=1){const{id:n,data:o}=a[e];s&&t.getDegree(n)<=1||(r[n].setPos(o.x,o.y),o.x>=d&&(d=o.x),o.x<=h&&(h=o.x),o.y>=l&&(l=o.y),o.y<=c&&(c=o.y))}const f=Math.max(d-h,l-c),g=new mn({xmid:(d+h)/2,ymid:(l+c)/2,length:f,massCenter:i,mass:u}),p=new yn(g);for(let e=0;e<u;e+=1){const{id:n}=a[e];s&&t.getDegree(n)<=1||r[n].in(g)&&p.insert(r[n])}for(let n=0;n<u;n+=1){const{id:u,data:h}=a[n],d=t.getDegree(u);if(s&&d<=1)continue;r[u].resetForce(),p.updateForce(r[u]),e[u][0]-=r[u].fx,e[u][1]-=r[u].fy;const c=[h.x-i[0],h.y-i[1]];let l=Math.hypot(c[0],c[1]);l=l<1e-4?1e-4:l,c[0]=c[0]/l,c[1]=c[1]/l;const f=o*(d+1);e[u][0]-=f*c[0],e[u][1]-=f*c[1]}return e}getRepGraForces(t,e,r,n,o,i,s){const{preventOverlap:a,kr:u,kg:h,center:d,prune:c}=s,l=t.getAllNodes(),f=l.length;for(let s=0;s<f;s+=1){const g=l[s],p=t.getDegree(g.id);for(let h=s+1;h<f;h+=1){const s=l[h],d=t.getDegree(s.id);if(c&&(p<=1||d<=1))continue;const f=[s.data.x-g.data.x,s.data.y-g.data.y];let v=Math.hypot(f[0],f[1]);v=v<1e-4?1e-4:v,f[0]=f[0]/v,f[1]=f[1]/v,a&&e<r&&(v=v-i[g.id]-i[s.id]);let m=u*(p+1)*(d+1)/v;a&&e<r&&v<0?m=o*(p+1)*(d+1):a&&e<r&&0===v?m=0:a&&e<r&&v>0&&(m=u*(p+1)*(d+1)/v),n[g.id][0]-=m*f[0],n[s.id][0]+=m*f[0],n[g.id][1]-=m*f[1],n[s.id][1]+=m*f[1]}const v=[g.data.x-d[0],g.data.y-d[1]],m=Math.hypot(v[0],v[1]);v[0]=v[0]/m,v[1]=v[1]/m;const y=h*(p+1);n[g.id][0]-=y*v[0],n[g.id][1]-=y*v[1]}return n}updatePos(t,e,r,n,o){const{ks:i,tao:s,prune:a,ksmax:u}=o,h=t.getAllNodes(),d=h.length,c=[],f=[];let g=0,p=0,v=n;for(let n=0;n<d;n+=1){const{id:o}=h[n],i=t.getDegree(o);if(a&&i<=1)continue;const s=[e[o][0]-r[o][0],e[o][1]-r[o][1]],u=Math.hypot(s[0],s[1]),d=[e[o][0]+r[o][0],e[o][1]+r[o][1]],l=Math.hypot(d[0],d[1]);c[n]=u,f[n]=l/2,g+=(i+1)*c[n],p+=(i+1)*f[n]}const m=v;v=s*p/g,0!==m&&(v=v>1.5*m?1.5*m:v);for(let r=0;r<d;r+=1){const{id:n,data:o}=h[r],s=t.getDegree(n);if(a&&s<=1)continue;if(l(o.fx)&&l(o.fy))continue;let d=i*v/(1+v*Math.sqrt(c[r])),f=Math.hypot(e[n][0],e[n][1]);f=f<1e-4?1e-4:f;const g=u/f;d=d>g?g:d;const p=d*e[n][0],m=d*e[n][1];t.mergeNodeData(n,{x:o.x+p,y:o.y+m})}return v}},dagre:pn,antvDagre:class{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},Qt),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,t,r)}))}genericDagreLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{nodeSize:o,align:i,rankdir:s="TB",ranksep:a,nodesep:u,ranksepFunc:d,nodesepFunc:c,edgeLabelSpace:f,ranker:g,nodeOrder:p,begin:v,controlPoints:m,radial:y,sortByCombo:w,preset:x}=e,b=new h({tree:[]}),E=Wt(a||50,d),N=Wt(u||50,c);let M=N,_=E;"LR"!==s&&"RL"!==s||(M=E,_=N);const k=Ht(o,void 0),A=r.getAllNodes(),j=r.getAllEdges();let S;A.forEach((t=>{const e=k(t),r=_(t),n=e+2*M(t),o=e+2*r,i=t.data.layer;l(i)?b.addNode({id:t.id,data:{width:n,height:o,layer:i}}):b.addNode({id:t.id,data:{width:n,height:o}})})),w&&(b.attachTreeStructure("combo"),A.forEach((t=>{const{parentId:e}=t.data;void 0!==e&&b.hasNode(e)&&b.setParent(t.id,e,"combo")}))),j.forEach((t=>{b.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||1}})})),(null==x?void 0:x.length)&&(S=new h({nodes:x})),((t,e)=>{const{edgeLabelSpace:r,keepNodeOrder:n,prevGraph:o,rankdir:i,ranksep:s}=e;var a,u;!n&&o&&(u=o,(a=t).getAllNodes().forEach((t=>{const e=a.getNode(t.id);if(u.hasNode(t.id)){const r=u.getNode(t.id);e.data.fixorder=r.data._order,delete r.data._order}else delete e.data.fixorder})));const d=(t=>{const e=new h({tree:[]});return t.getAllNodes().forEach((r=>{const n=$t(t.getNode(r.id).data),o=Object.assign(Object.assign({},At),n),i=Bt(o,kt);e.hasNode(r.id)||e.addNode({id:r.id,data:Object.assign({},i)});const s=t.hasTreeStructure("combo")?t.getParent(r.id,"combo"):t.getParent(r.id);null==s||(e.hasNode(s.id)||e.addNode(Object.assign({},s)),e.setParent(r.id,s.id))})),t.getAllEdges().forEach((r=>{const n=$t(t.getEdge(r.id).data),o={};null==Ot||Ot.forEach((t=>{void 0!==n[t]&&(o[t]=n[t])})),e.addEdge({id:r.id,source:r.source,target:r.target,data:Object.assign({},St,Bt(n,jt),o)})})),e})(t);let c;r&&(e.ranksep=((t,e)=>{const{ranksep:r=0,rankdir:n}=e;return t.getAllNodes().forEach((t=>{isNaN(t.data.layer)||t.data.layer||(t.data.layer=0)})),t.getAllEdges().forEach((t=>{var e;t.data.minlen*=2,"c"!==(null===(e=t.data.labelpos)||void 0===e?void 0:e.toLowerCase())&&("TB"===n||"BT"===n?t.data.width+=t.data.labeloffset:t.data.height+=t.data.labeloffset)})),r/2})(d,{rankdir:i,ranksep:s}));try{c=_t(d,e)}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph\'s structure:\\n",t);throw t}((t,e)=>{t.getAllNodes().forEach((r=>{var n;const o=t.getNode(r.id);if(o){const t=e.getNode(r.id);o.data.x=t.data.x,o.data.y=t.data.y,o.data._order=t.data.order,o.data._rank=t.data.rank,(null===(n=e.getChildren(r.id))||void 0===n?void 0:n.length)&&(o.data.width=t.data.width,o.data.height=t.data.height)}})),t.getAllEdges().forEach((r=>{const n=t.getEdge(r.id),o=e.getEdge(r.id);n.data.points=o?o.data.points:[],o&&o.data.hasOwnProperty("x")&&(n.data.x=o.data.x,n.data.y=o.data.y)}))})(t,d)})(b,{prevGraph:S,edgeLabelSpace:f,keepNodeOrder:!!p,nodeOrder:p||[],acyclicer:"greedy",ranker:g,rankdir:s,nodesep:u,align:i});const O=[0,0];if(v){let t=1/0,e=1/0;b.getAllNodes().forEach((r=>{t>r.data.x&&(t=r.data.x),e>r.data.y&&(e=r.data.y)})),b.getAllEdges().forEach((r=>{var n;null===(n=r.data.points)||void 0===n||n.forEach((r=>{t>r.x&&(t=r.x),e>r.y&&(e=r.y)}))})),O[0]=v[0]-t,O[1]=v[1]-e}const z="LR"===s||"RL"===s;if(y);else{const t=new Set,e="BT"===s||"RL"===s?(t,e)=>e-t:(t,e)=>t-e;b.getAllNodes().forEach((e=>{e.data.x=e.data.x+O[0],e.data.y=e.data.y+O[1],t.add(z?e.data.x:e.data.y)}));const r=Array.from(t).sort(e),n=z?(t,e)=>t.x!==e.x:(t,e)=>t.y!==e.y,o=z?(t,e,r)=>{const n=Math.max(e.y,r.y),o=Math.min(e.y,r.y);return t.filter((t=>t.y<=n&&t.y>=o))}:(t,e,r)=>{const n=Math.max(e.x,r.x),o=Math.min(e.x,r.x);return t.filter((t=>t.x<=n&&t.x>=o))};b.getAllEdges().forEach(((t,e)=>{var i;f&&m&&"loop"!==t.data.type&&(t.data.controlPoints=((t,e,r,n,o,i,s)=>{let a=(null==t?void 0:t.slice(1,t.length-1))||[];if(e&&r){let{x:t,y:u}=e.data,{x:h,y:d}=r.data;if(o&&(t=e.data.y,u=e.data.x,h=r.data.y,d=r.data.x),d!==u&&t!==h){const c=n.indexOf(u),l=n[c+1];if(l){const t=a[0],e=o?{x:(u+l)/2,y:(null==t?void 0:t.y)||h}:{x:(null==t?void 0:t.x)||h,y:(u+l)/2};t&&!i(t,e)||a.unshift(e)}const f=n.indexOf(d),g=Math.abs(f-c);if(1===g)a=s(a,e.data,r.data),a.length||a.push(o?{x:(u+d)/2,y:t}:{x:t,y:(u+d)/2});else if(g>1){const e=n[f-1];if(e){const r=a[a.length-1],n=o?{x:(d+e)/2,y:(null==r?void 0:r.y)||h}:{x:(null==r?void 0:r.x)||t,y:(d+e)/2};r&&!i(r,n)||a.push(n)}}}}return a})(null===(i=t.data.points)||void 0===i?void 0:i.map((({x:t,y:e})=>({x:t+O[0],y:e+O[1]}))),b.getNode(t.source),b.getNode(t.target),r,z,n,o))}))}let R=[];R=b.getAllNodes().map((t=>Jt(t)));const I=b.getAllEdges();return t&&(R.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),I.forEach((t=>{r.mergeEdgeData(t.id,{controlPoints:t.data.controlPoints})}))),{nodes:R,edges:I}}))}},comboCombined:class{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},$e),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericComboCombinedLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericComboCombinedLayout(!0,t,r)}))}genericComboCombinedLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:o,treeKey:i,outerLayout:s}=e,a=r.getAllNodes().filter((t=>!t.data._isCombo)),u=r.getAllNodes().filter((t=>t.data._isCombo)),d=r.getAllEdges(),c=null==a?void 0:a.length;if(!c||1===c)return Xt(r,t,o);const l=[],f=new Map;a.forEach((t=>{f.set(t.id,t)}));const g=new Map;u.forEach((t=>{g.set(t.id,t)}));const p=new Map,v=this.getInnerGraphs(r,i,f,g,d,e,p);yield Promise.all(v);const m=new Map,y=[],w=new Map;let x=!0;r.getRoots(i).forEach((t=>{const e=p.get(t.id),n=g.get(t.id)||f.get(t.id),o={id:t.id,data:Object.assign(Object.assign({},t.data),{x:e.data.x||n.data.x,y:e.data.y||n.data.y,fx:e.data.fx||n.data.fx,fy:e.data.fy||n.data.fy,mass:e.data.mass||n.data.mass,size:e.data.size})};y.push(o),m.set(t.id,!0),isNaN(o.data.x)||0===o.data.x||isNaN(o.data.y)||0===o.data.y?(o.data.x=100*Math.random(),o.data.y=100*Math.random()):x=!1,Te(r,[t],(e=>{e.id!==t.id&&w.set(e.id,t.id)}),"TB",i)}));const b=[];let E;if(d.forEach((t=>{const e=w.get(t.source)||t.source,r=w.get(t.target)||t.target;e!==r&&m.has(e)&&m.has(r)&&b.push({id:t.id,source:e,target:r,data:{}})})),null==y?void 0:y.length){if(1===y.length)y[0].data.x=o[0],y[0].data.y=o[1];else{const t=new h({nodes:y,edges:b}),e=s||new _e;if(x&&Be[e.id]){const e=y.length<100?new Fe:new oe;yield e.assign(t)}E=yield e.execute(t,Object.assign({center:o,kg:5,preventOverlap:!0,animate:!1},"force"===e.id?{gravity:1,factor:4,linkDistance:(t,e,r)=>(Math.max(...e.data.size)||32)/2+(Math.max(...r.data.size)||32)/2+200}:{}))}p.forEach((t=>{var e;const r=E.nodes.find((e=>e.id===t.id));if(r){const{x:e,y:n}=r.data;t.data.visited=!0,t.data.x=e,t.data.y=n,l.push({id:t.id,data:{x:e,y:n}})}const{x:n,y:o}=t.data;null===(e=t.data.nodes)||void 0===e||e.forEach((t=>{l.push({id:t.id,data:{x:t.data.x+n,y:t.data.y+o}})}))})),p.forEach((({data:t})=>{const{x:e,y:r,visited:n,nodes:o}=t;null==o||o.forEach((t=>{if(!n){const n=l.find((e=>e.id===t.id));n.data.x+=e||0,n.data.y+=r||0}}))}))}return t&&l.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),{nodes:l,edges:d}}))}initVals(t){const e=Object.assign({},t),{nodeSize:r,spacing:n,comboPadding:o}=t;let i,s,a;if(s=l(n)?()=>n:Ut(n)?n:()=>0,e.spacing=s,r)if(Ut(r))i=t=>{const e=r(t),n=s(t);return re(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+n)/2:((e||32)+n)/2};else if(re(r)){const t=(r[0]>r[1]?r[0]:r[1])/2;i=e=>t+s(e)/2}else{const t=r/2;i=e=>t+s(e)/2}else i=t=>{const e=s(t);return t.size?re(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+e)/2:Gt(t.size)?((t.size.width>t.size.height?t.size.width:t.size.height)+e)/2:(t.size+e)/2:32+e/2};return e.nodeSize=i,a=l(o)?()=>o:re(o)?()=>Math.max.apply(null,o):Ut(o)?o:()=>0,e.comboPadding=a,e}getInnerGraphs(t,r,n,o,i,s,a){const{nodeSize:u,comboPadding:d,spacing:c,innerLayout:f}=s,g=f||new oe({}),p={center:[0,0],preventOverlap:!0,nodeSpacing:c},v=[],m=t=>{let e=(null==d?void 0:d(t))||10;return re(e)&&(e=Math.max(...e)),{size:e?[2*e,2*e]:[30,30],padding:e}};return t.getRoots(r).forEach((s=>{a.set(s.id,{id:s.id,data:{nodes:[],size:m(s).size}});let d=Promise.resolve();Te(t,[s],(s=>{var c;if(!s.data._isCombo)return;const{size:f,padding:v}=m(s);if(null===(c=t.getChildren(s.id,r))||void 0===c?void 0:c.length){const c=a.get(s.id);a.set(s.id,{id:s.id,data:Object.assign({nodes:[]},null==c?void 0:c.data)});const f=new Map,m=t.getChildren(s.id,r).map((t=>{if(t.data._isCombo)return a.has(t.id)||a.set(t.id,{id:t.id,data:Object.assign({},t.data)}),f.set(t.id,!0),a.get(t.id);const e=n.get(t.id)||o.get(t.id);return f.set(t.id,!0),{id:t.id,data:Object.assign(Object.assign({},e.data),t.data)}})),y={nodes:m,edges:i.filter((t=>f.has(t.source)&&f.has(t.target)))};let w=1/0;m.forEach((t=>{var e;let{size:r}=t.data;r||(r=(null===(e=a.get(t.id))||void 0===e?void 0:e.data.size)||(null==u?void 0:u(t))||[30,30]),l(r)&&(r=[r,r]);const[n,o]=r;w>n&&(w=n),w>o&&(w=o),t.data.size=r})),d=d.then((()=>e(this,void 0,void 0,(function*(){const t=new h(y),e=yield g.assign(t,p),{minX:r,minY:n,maxX:o,maxY:i}=(t=>{let e=1/0,r=1/0,n=-1/0,o=-1/0;return t.forEach((t=>{let i=t.data.size;re(i)?1===i.length&&(i=[i[0],i[0]]):l(i)?i=[i,i]:(void 0===i||isNaN(i))&&(i=[30,30]);const s=[i[0]/2,i[1]/2],a=t.data.x-s[0],u=t.data.x+s[0],h=t.data.y-s[1],d=t.data.y+s[1];e>a&&(e=a),r>h&&(r=h),n<u&&(n=u),o<d&&(o=d)})),{minX:e,minY:r,maxX:n,maxY:o}})(m),u=(o+r)/2,d=(i+n)/2;y.nodes.forEach((t=>{t.data.x-=u,t.data.y-=d}));const c=[Math.max(o-r,w)+2*v,Math.max(i-n,w)+2*v];return a.get(s.id).data.size=c,a.get(s.id).data.nodes=m,e}))))}else a.set(s.id,{id:s.id,data:Object.assign(Object.assign({},s.data),{size:f})});return!0}),"BT",r),v.push(d)})),v}}};let Cn;function Dn(){(null==Cn?void 0:Cn.stop)&&Cn.stop()}function Pn(t,r){return e(this,void 0,void 0,(function*(){const{layout:{id:e,options:n,iterations:o},nodes:i,edges:s}=t,a=new h({nodes:i,edges:s}),u=In[e];if(!u)throw new Error(`Unknown layout id: ${e}`);Cn=new u(n);let d=yield Cn.execute(a);return!!(c=Cn).tick&&!!c.stop&&(Cn.stop(),d=Cn.tick(o)),[d,r];var c}))}addEventListener("message",(function(t){var e,r=t.data,o=r.type,i=r.method,s=r.id,a=r.params;"RPC"===o&&i&&((e=n[i])?Promise.resolve().then((function(){return e.apply(n,a)})):Promise.reject("No such method")).then((function(t){postMessage({type:"RPC",id:s,result:t})})).catch((function(t){var e={message:t};t.stack&&(e.message=t.message,e.stack=t.stack,e.name=t.name),postMessage({type:"RPC",id:s,error:e})}))})),postMessage({type:"RPC",method:"ready"})})()})();\n//# sourceMappingURL=62953f7fd7012203b024.worker.js.map'])),{name:"[fullhash].worker.js"});return URL.revokeObjectURL(URL.createObjectURL(new Blob(['(()=>{var t={4341:(t,e,r)=>{t.exports={graphlib:r(3374),layout:r(9407),debug:r(6978),util:{time:r(6573).time,notime:r(6573).notime},version:r(6661)}},9317:(t,e,r)=>{"use strict";var n=r(5076),o=r(3526);t.exports={run:function(t){var e="greedy"===t.graph().acyclicer?o(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],r={},o={};return n.forEach(t.nodes(),(function i(s){n.has(o,s)||(o[s]=!0,r[s]=!0,n.forEach(t.outEdges(s),(function(t){n.has(r,t.w)?e.push(t):i(t.w)})),delete r[s])})),e}(t);n.forEach(e,(function(e){var r=t.edge(e);t.removeEdge(e),r.forwardName=e.name,r.reversed=!0,t.setEdge(e.w,e.v,r,n.uniqueId("rev"))}))},undo:function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.reversed){t.removeEdge(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}}))}}},7840:(t,e,r)=>{var n=r(5076),o=r(6573);function i(t,e,r,n,i,s){var a={width:0,height:0,rank:s,borderType:e},u=i[e][s-1],h=o.addDummyNode(t,"border",a,r);i[e][s]=h,t.setParent(h,n),u&&t.setEdge(u,h,{weight:1})}t.exports=function(t){n.forEach(t.children(),(function e(r){var o=t.children(r),s=t.node(r);if(o.length&&n.forEach(o,e),n.has(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(var a=s.minRank,u=s.maxRank+1;a<u;++a)i(t,"borderLeft","_bl",r,s,a),i(t,"borderRight","_br",r,s,a)}}))}},5793:(t,e,r)=>{"use strict";var n=r(5076);function o(t){n.forEach(t.nodes(),(function(e){i(t.node(e))})),n.forEach(t.edges(),(function(e){i(t.edge(e))}))}function i(t){var e=t.width;t.width=t.height,t.height=e}function s(t){t.y=-t.y}function a(t){var e=t.x;t.x=t.y,t.y=e}t.exports={adjust:function(t){var e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||o(t)},undo:function(t){var e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){n.forEach(t.nodes(),(function(e){s(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.forEach(r.points,s),n.has(r,"y")&&s(r)}))}(t),"lr"!==e&&"rl"!==e||(function(t){n.forEach(t.nodes(),(function(e){a(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.forEach(r.points,a),n.has(r,"x")&&a(r)}))}(t),o(t))}}},5752:t=>{function e(){var t={};t._next=t._prev=t,this._sentinel=t}function r(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function n(t,e){if("_next"!==t&&"_prev"!==t)return e}t.exports=e,e.prototype.dequeue=function(){var t=this._sentinel,e=t._prev;if(e!==t)return r(e),e},e.prototype.enqueue=function(t){var e=this._sentinel;t._prev&&t._next&&r(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e},e.prototype.toString=function(){for(var t=[],e=this._sentinel,r=e._prev;r!==e;)t.push(JSON.stringify(r,n)),r=r._prev;return"["+t.join(", ")+"]"}},6978:(t,e,r)=>{var n=r(5076),o=r(6573),i=r(3374).Graph;t.exports={debugOrdering:function(t){var e=o.buildLayerMatrix(t),r=new i({compound:!0,multigraph:!0}).setGraph({});return n.forEach(t.nodes(),(function(e){r.setNode(e,{label:e}),r.setParent(e,"layer"+t.node(e).rank)})),n.forEach(t.edges(),(function(t){r.setEdge(t.v,t.w,{},t.name)})),n.forEach(e,(function(t,e){var o="layer"+e;r.setNode(o,{rank:"same"}),n.reduce(t,(function(t,e){return r.setEdge(t,e,{style:"invis"}),e}))})),r}}},3374:(t,e,r)=>{var n;try{n=r(7423)}catch(t){}n||(n=window.graphlib),t.exports=n},3526:(t,e,r)=>{var n=r(5076),o=r(3374).Graph,i=r(5752);t.exports=function(t,e){if(t.nodeCount()<=1)return[];var r=function(t,e){var r=new o,s=0,a=0;n.forEach(t.nodes(),(function(t){r.setNode(t,{v:t,in:0,out:0})})),n.forEach(t.edges(),(function(t){var n=r.edge(t.v,t.w)||0,o=e(t),i=n+o;r.setEdge(t.v,t.w,i),a=Math.max(a,r.node(t.v).out+=o),s=Math.max(s,r.node(t.w).in+=o)}));var h=n.range(a+s+3).map((function(){return new i})),d=s+1;return n.forEach(r.nodes(),(function(t){u(h,d,r.node(t))})),{graph:r,buckets:h,zeroIdx:d}}(t,e||s),h=function(t,e,r){for(var n,o=[],i=e[e.length-1],s=e[0];t.nodeCount();){for(;n=s.dequeue();)a(t,e,r,n);for(;n=i.dequeue();)a(t,e,r,n);if(t.nodeCount())for(var u=e.length-2;u>0;--u)if(n=e[u].dequeue()){o=o.concat(a(t,e,r,n,!0));break}}return o}(r.graph,r.buckets,r.zeroIdx);return n.flatten(n.map(h,(function(e){return t.outEdges(e.v,e.w)})),!0)};var s=n.constant(1);function a(t,e,r,o,i){var s=i?[]:void 0;return n.forEach(t.inEdges(o.v),(function(n){var o=t.edge(n),a=t.node(n.v);i&&s.push({v:n.v,w:n.w}),a.out-=o,u(e,r,a)})),n.forEach(t.outEdges(o.v),(function(n){var o=t.edge(n),i=n.w,s=t.node(i);s.in-=o,u(e,r,s)})),t.removeNode(o.v),s}function u(t,e,r){r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)}},9407:(t,e,r)=>{"use strict";var n=r(5076),o=r(9317),i=r(9934),s=r(9472),a=r(6573).normalizeRanks,u=r(9095),h=r(6573).removeEmptyRanks,d=r(9526),c=r(7840),l=r(5793),f=r(9186),g=r(9497),p=r(6573),v=r(3374).Graph;t.exports=function(t,e){var r=e&&e.debugTiming?p.time:p.notime;r("layout",(function(){var e=r(" buildLayoutGraph",(function(){return function(t){var e=new v({multigraph:!0,compound:!0}),r=k(t.graph());return e.setGraph(n.merge({},y,_(r,m),n.pick(r,w))),n.forEach(t.nodes(),(function(r){var o=k(t.node(r));e.setNode(r,n.defaults(_(o,x),b)),e.setParent(r,t.parent(r))})),n.forEach(t.edges(),(function(r){var o=k(t.edge(r));e.setEdge(r,n.merge({},N,_(o,E),n.pick(o,M)))})),e}(t)}));r(" runLayout",(function(){!function(t,e){e(" makeSpaceForEdgeLabels",(function(){!function(t){var e=t.graph();e.ranksep/=2,n.forEach(t.edges(),(function(r){var n=t.edge(r);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)}))}(t)})),e(" removeSelfEdges",(function(){!function(t){n.forEach(t.edges(),(function(e){if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}}))}(t)})),e(" acyclic",(function(){o.run(t)})),e(" nestingGraph.run",(function(){d.run(t)})),e(" rank",(function(){s(p.asNonCompoundGraph(t))})),e(" injectEdgeLabelProxies",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.width&&r.height){var n=t.node(e.v),o={rank:(t.node(e.w).rank-n.rank)/2+n.rank,e};p.addDummyNode(t,"edge-proxy",o,"_ep")}}))}(t)})),e(" removeEmptyRanks",(function(){h(t)})),e(" nestingGraph.cleanup",(function(){d.cleanup(t)})),e(" normalizeRanks",(function(){a(t)})),e(" assignRankMinMax",(function(){!function(t){var e=0;n.forEach(t.nodes(),(function(r){var o=t.node(r);o.borderTop&&(o.minRank=t.node(o.borderTop).rank,o.maxRank=t.node(o.borderBottom).rank,e=n.max(e,o.maxRank))})),t.graph().maxRank=e}(t)})),e(" removeEdgeLabelProxies",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);"edge-proxy"===r.dummy&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))}))}(t)})),e(" normalize.run",(function(){i.run(t)})),e(" parentDummyChains",(function(){u(t)})),e(" addBorderSegments",(function(){c(t)})),e(" order",(function(){f(t)})),e(" insertSelfEdges",(function(){!function(t){var e=p.buildLayerMatrix(t);n.forEach(e,(function(e){var r=0;n.forEach(e,(function(e,o){var i=t.node(e);i.order=o+r,n.forEach(i.selfEdges,(function(e){p.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:o+ ++r,e:e.e,label:e.label},"_se")})),delete i.selfEdges}))}))}(t)})),e(" adjustCoordinateSystem",(function(){l.adjust(t)})),e(" position",(function(){g(t)})),e(" positionSelfEdges",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),o=n.x+n.width/2,i=n.y,s=r.x-o,a=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{x:o+s,y:i},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.label.x=r.x,r.label.y=r.y}}))}(t)})),e(" removeBorderNodes",(function(){!function(t){n.forEach(t.nodes(),(function(e){if(t.children(e).length){var r=t.node(e),o=t.node(r.borderTop),i=t.node(r.borderBottom),s=t.node(n.last(r.borderLeft)),a=t.node(n.last(r.borderRight));r.width=Math.abs(a.x-s.x),r.height=Math.abs(i.y-o.y),r.x=s.x+r.width/2,r.y=o.y+r.height/2}})),n.forEach(t.nodes(),(function(e){"border"===t.node(e).dummy&&t.removeNode(e)}))}(t)})),e(" normalize.undo",(function(){i.undo(t)})),e(" fixupEdgeLabelCoords",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(n.has(r,"x"))switch("l"!==r.labelpos&&"r"!==r.labelpos||(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}}))}(t)})),e(" undoCoordinateSystem",(function(){l.undo(t)})),e(" translateGraph",(function(){!function(t){var e=Number.POSITIVE_INFINITY,r=0,o=Number.POSITIVE_INFINITY,i=0,s=t.graph(),a=s.marginx||0,u=s.marginy||0;function h(t){var n=t.x,s=t.y,a=t.width,u=t.height;e=Math.min(e,n-a/2),r=Math.max(r,n+a/2),o=Math.min(o,s-u/2),i=Math.max(i,s+u/2)}n.forEach(t.nodes(),(function(e){h(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.has(r,"x")&&h(r)})),e-=a,o-=u,n.forEach(t.nodes(),(function(r){var n=t.node(r);n.x-=e,n.y-=o})),n.forEach(t.edges(),(function(r){var i=t.edge(r);n.forEach(i.points,(function(t){t.x-=e,t.y-=o})),n.has(i,"x")&&(i.x-=e),n.has(i,"y")&&(i.y-=o)})),s.width=r-e+a,s.height=i-o+u}(t)})),e(" assignNodeIntersects",(function(){!function(t){n.forEach(t.edges(),(function(e){var r,n,o=t.edge(e),i=t.node(e.v),s=t.node(e.w);o.points?(r=o.points[0],n=o.points[o.points.length-1]):(o.points=[],r=s,n=i),o.points.unshift(p.intersectRect(i,r)),o.points.push(p.intersectRect(s,n))}))}(t)})),e(" reversePoints",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);r.reversed&&r.points.reverse()}))}(t)})),e(" acyclic.undo",(function(){o.undo(t)}))}(e,r)})),r(" updateInputGraph",(function(){!function(t,e){n.forEach(t.nodes(),(function(r){var n=t.node(r),o=e.node(r);n&&(n.x=o.x,n.y=o.y,e.children(r).length&&(n.width=o.width,n.height=o.height))})),n.forEach(t.edges(),(function(r){var o=t.edge(r),i=e.edge(r);o.points=i.points,n.has(i,"x")&&(o.x=i.x,o.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,e)}))}))};var m=["nodesep","edgesep","ranksep","marginx","marginy"],y={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},w=["acyclicer","ranker","rankdir","align"],x=["width","height"],b={width:0,height:0},E=["minlen","weight","width","height","labeloffset"],N={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},M=["labelpos"];function _(t,e){return n.mapValues(n.pick(t,e),Number)}function k(t){var e={};return n.forEach(t,(function(t,r){e[r.toLowerCase()]=t})),e}},5076:(t,e,r)=>{var n;try{n={cloneDeep:r(9136),constant:r(8295),defaults:r(9529),each:r(958),filter:r(9969),find:r(828),flatten:r(7469),forEach:r(1117),forIn:r(4519),has:r(4339),isUndefined:r(2895),last:r(5179),map:r(9629),mapValues:r(5551),max:r(4213),merge:r(2495),min:r(9903),minBy:r(3262),now:r(8835),pick:r(222),range:r(4978),reduce:r(9285),sortBy:r(5246),uniqueId:r(761),values:r(3005),zipObject:r(3679)}}catch(t){}n||(n=window._),t.exports=n},9526:(t,e,r)=>{var n=r(5076),o=r(6573);function i(t,e,r,s,a,u,h){var d=t.children(h);if(d.length){var c=o.addBorderNode(t,"_bt"),l=o.addBorderNode(t,"_bb"),f=t.node(h);t.setParent(c,h),f.borderTop=c,t.setParent(l,h),f.borderBottom=l,n.forEach(d,(function(n){i(t,e,r,s,a,u,n);var o=t.node(n),d=o.borderTop?o.borderTop:n,f=o.borderBottom?o.borderBottom:n,g=o.borderTop?s:2*s,p=d!==f?1:a-u[h]+1;t.setEdge(c,d,{weight:g,minlen:p,nestingEdge:!0}),t.setEdge(f,l,{weight:g,minlen:p,nestingEdge:!0})})),t.parent(h)||t.setEdge(e,c,{weight:0,minlen:a+u[h]})}else h!==e&&t.setEdge(e,h,{weight:0,minlen:r})}t.exports={run:function(t){var e=o.addDummyNode(t,"root",{},"_root"),r=function(t){var e={};function r(o,i){var s=t.children(o);s&&s.length&&n.forEach(s,(function(t){r(t,i+1)})),e[o]=i}return n.forEach(t.children(),(function(t){r(t,1)})),e}(t),s=n.max(n.values(r))-1,a=2*s+1;t.graph().nestingRoot=e,n.forEach(t.edges(),(function(e){t.edge(e).minlen*=a}));var u=function(t){return n.reduce(t.edges(),(function(e,r){return e+t.edge(r).weight}),0)}(t)+1;n.forEach(t.children(),(function(n){i(t,e,a,u,s,r,n)})),t.graph().nodeRankFactor=a},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,n.forEach(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}}},9934:(t,e,r)=>{"use strict";var n=r(5076),o=r(6573);t.exports={run:function(t){t.graph().dummyChains=[],n.forEach(t.edges(),(function(e){!function(t,e){var r,n,i,s=e.v,a=t.node(s).rank,u=e.w,h=t.node(u).rank,d=e.name,c=t.edge(e),l=c.labelRank;if(h!==a+1){for(t.removeEdge(e),i=0,++a;a<h;++i,++a)c.points=[],n={width:0,height:0,edgeLabel:c,edgeObj:e,rank:a},r=o.addDummyNode(t,"edge",n,"_d"),a===l&&(n.width=c.width,n.height=c.height,n.dummy="edge-label",n.labelpos=c.labelpos),t.setEdge(s,r,{weight:c.weight},d),0===i&&t.graph().dummyChains.push(r),s=r;t.setEdge(s,u,{weight:c.weight},d)}}(t,e)}))},undo:function(t){n.forEach(t.graph().dummyChains,(function(e){var r,n=t.node(e),o=n.edgeLabel;for(t.setEdge(n.edgeObj,o);n.dummy;)r=t.successors(e)[0],t.removeNode(e),o.points.push({x:n.x,y:n.y}),"edge-label"===n.dummy&&(o.x=n.x,o.y=n.y,o.width=n.width,o.height=n.height),e=r,n=t.node(e)}))}}},9841:(t,e,r)=>{var n=r(5076);t.exports=function(t,e,r){var o,i={};n.forEach(r,(function(r){for(var n,s,a=t.parent(r);a;){if((n=t.parent(a))?(s=i[n],i[n]=a):(s=o,o=a),s&&s!==a)return void e.setEdge(s,a);a=n}}))}},5458:(t,e,r)=>{var n=r(5076);t.exports=function(t,e){return n.map(e,(function(e){var r=t.inEdges(e);if(r.length){var o=n.reduce(r,(function(e,r){var n=t.edge(r),o=t.node(r.v);return{sum:e.sum+n.weight*o.order,weight:e.weight+n.weight}}),{sum:0,weight:0});return{v:e,barycenter:o.sum/o.weight,weight:o.weight}}return{v:e}}))}},6263:(t,e,r)=>{var n=r(5076),o=r(3374).Graph;t.exports=function(t,e,r){var i=function(t){for(var e;t.hasNode(e=n.uniqueId("_root")););return e}(t),s=new o({compound:!0}).setGraph({root:i}).setDefaultNodeLabel((function(e){return t.node(e)}));return n.forEach(t.nodes(),(function(o){var a=t.node(o),u=t.parent(o);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(s.setNode(o),s.setParent(o,u||i),n.forEach(t[r](o),(function(e){var r=e.v===o?e.w:e.v,i=s.edge(r,o),a=n.isUndefined(i)?0:i.weight;s.setEdge(r,o,{weight:t.edge(e).weight+a})})),n.has(a,"minRank")&&s.setNode(o,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))})),s}},6840:(t,e,r)=>{"use strict";var n=r(5076);function o(t,e,r){for(var o=n.zipObject(r,n.map(r,(function(t,e){return e}))),i=n.flatten(n.map(e,(function(e){return n.sortBy(n.map(t.outEdges(e),(function(e){return{pos:o[e.w],weight:t.edge(e).weight}})),"pos")})),!0),s=1;s<r.length;)s<<=1;var a=2*s-1;s-=1;var u=n.map(new Array(a),(function(){return 0})),h=0;return n.forEach(i.forEach((function(t){var e=t.pos+s;u[e]+=t.weight;for(var r=0;e>0;)e%2&&(r+=u[e+1]),u[e=e-1>>1]+=t.weight;h+=t.weight*r}))),h}t.exports=function(t,e){for(var r=0,n=1;n<e.length;++n)r+=o(t,e[n-1],e[n]);return r}},9186:(t,e,r)=>{"use strict";var n=r(5076),o=r(1879),i=r(6840),s=r(9387),a=r(6263),u=r(9841),h=r(3374).Graph,d=r(6573);function c(t,e,r){return n.map(e,(function(e){return a(t,e,r)}))}function l(t,e){var r=new h;n.forEach(t,(function(t){var o=t.graph().root,i=s(t,o,r,e);n.forEach(i.vs,(function(e,r){t.node(e).order=r})),u(t,r,i.vs)}))}function f(t,e){n.forEach(e,(function(e){n.forEach(e,(function(e,r){t.node(e).order=r}))}))}t.exports=function(t){var e=d.maxRank(t),r=c(t,n.range(1,e+1),"inEdges"),s=c(t,n.range(e-1,-1,-1),"outEdges"),a=o(t);f(t,a);for(var u,h=Number.POSITIVE_INFINITY,g=0,p=0;p<4;++g,++p){l(g%2?r:s,g%4>=2),a=d.buildLayerMatrix(t);var v=i(t,a);v<h&&(p=0,u=n.cloneDeep(a),h=v)}f(t,u)}},1879:(t,e,r)=>{"use strict";var n=r(5076);t.exports=function(t){var e={},r=n.filter(t.nodes(),(function(e){return!t.children(e).length})),o=n.max(n.map(r,(function(e){return t.node(e).rank}))),i=n.map(n.range(o+1),(function(){return[]})),s=n.sortBy(r,(function(e){return t.node(e).rank}));return n.forEach(s,(function r(o){if(!n.has(e,o)){e[o]=!0;var s=t.node(o);i[s.rank].push(o),n.forEach(t.successors(o),r)}})),i}},5912:(t,e,r)=>{"use strict";var n=r(5076);t.exports=function(t,e){var r={};return n.forEach(t,(function(t,e){var o=r[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};n.isUndefined(t.barycenter)||(o.barycenter=t.barycenter,o.weight=t.weight)})),n.forEach(e.edges(),(function(t){var e=r[t.v],o=r[t.w];n.isUndefined(e)||n.isUndefined(o)||(o.indegree++,e.out.push(r[t.w]))})),function(t){var e=[];function r(t){return function(e){var r,o,i,s;e.merged||(n.isUndefined(e.barycenter)||n.isUndefined(t.barycenter)||e.barycenter>=t.barycenter)&&(o=e,i=0,s=0,(r=t).weight&&(i+=r.barycenter*r.weight,s+=r.weight),o.weight&&(i+=o.barycenter*o.weight,s+=o.weight),r.vs=o.vs.concat(r.vs),r.barycenter=i/s,r.weight=s,r.i=Math.min(o.i,r.i),o.merged=!0)}}function o(e){return function(r){r.in.push(e),0==--r.indegree&&t.push(r)}}for(;t.length;){var i=t.pop();e.push(i),n.forEach(i.in.reverse(),r(i)),n.forEach(i.out,o(i))}return n.map(n.filter(e,(function(t){return!t.merged})),(function(t){return n.pick(t,["vs","i","barycenter","weight"])}))}(n.filter(r,(function(t){return!t.indegree})))}},9387:(t,e,r)=>{var n=r(5076),o=r(5458),i=r(5912),s=r(256);t.exports=function t(e,r,a,u){var h=e.children(r),d=e.node(r),c=d?d.borderLeft:void 0,l=d?d.borderRight:void 0,f={};c&&(h=n.filter(h,(function(t){return t!==c&&t!==l})));var g=o(e,h);n.forEach(g,(function(r){if(e.children(r.v).length){var o=t(e,r.v,a,u);f[r.v]=o,n.has(o,"barycenter")&&(i=r,s=o,n.isUndefined(i.barycenter)?(i.barycenter=s.barycenter,i.weight=s.weight):(i.barycenter=(i.barycenter*i.weight+s.barycenter*s.weight)/(i.weight+s.weight),i.weight+=s.weight))}var i,s}));var p=i(g,a);!function(t,e){n.forEach(t,(function(t){t.vs=n.flatten(t.vs.map((function(t){return e[t]?e[t].vs:t})),!0)}))}(p,f);var v=s(p,u);if(c&&(v.vs=n.flatten([c,v.vs,l],!0),e.predecessors(c).length)){var m=e.node(e.predecessors(c)[0]),y=e.node(e.predecessors(l)[0]);n.has(v,"barycenter")||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+m.order+y.order)/(v.weight+2),v.weight+=2}return v}},256:(t,e,r)=>{var n=r(5076),o=r(6573);function i(t,e,r){for(var o;e.length&&(o=n.last(e)).i<=r;)e.pop(),t.push(o.vs),r++;return r}t.exports=function(t,e){var r,s=o.partition(t,(function(t){return n.has(t,"barycenter")})),a=s.lhs,u=n.sortBy(s.rhs,(function(t){return-t.i})),h=[],d=0,c=0,l=0;a.sort((r=!!e,function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:r?e.i-t.i:t.i-e.i})),l=i(h,u,l),n.forEach(a,(function(t){l+=t.vs.length,h.push(t.vs),d+=t.barycenter*t.weight,c+=t.weight,l=i(h,u,l)}));var f={vs:n.flatten(h,!0)};return c&&(f.barycenter=d/c,f.weight=c),f}},9095:(t,e,r)=>{var n=r(5076);t.exports=function(t){var e=function(t){var e={},r=0;return n.forEach(t.children(),(function o(i){var s=r;n.forEach(t.children(i),o),e[i]={low:s,lim:r++}})),e}(t);n.forEach(t.graph().dummyChains,(function(r){for(var n=t.node(r),o=n.edgeObj,i=function(t,e,r,n){var o,i,s=[],a=[],u=Math.min(e[r].low,e[n].low),h=Math.max(e[r].lim,e[n].lim);o=r;do{o=t.parent(o),s.push(o)}while(o&&(e[o].low>u||h>e[o].lim));for(i=o,o=n;(o=t.parent(o))!==i;)a.push(o);return{path:s.concat(a.reverse()),lca:i}}(t,e,o.v,o.w),s=i.path,a=i.lca,u=0,h=s[u],d=!0;r!==o.w;){if(n=t.node(r),d){for(;(h=s[u])!==a&&t.node(h).maxRank<n.rank;)u++;h===a&&(d=!1)}if(!d){for(;u<s.length-1&&t.node(h=s[u+1]).minRank<=n.rank;)u++;h=s[u]}t.setParent(r,h),r=t.successors(r)[0]}}))}},2738:(t,e,r)=>{"use strict";var n=r(5076),o=r(3374).Graph,i=r(6573);function s(t,e){var r={};return n.reduce(e,(function(e,o){var i=0,s=0,a=e.length,h=n.last(o);return n.forEach(o,(function(e,d){var c=function(t,e){if(t.node(e).dummy)return n.find(t.predecessors(e),(function(e){return t.node(e).dummy}))}(t,e),l=c?t.node(c).order:a;(c||e===h)&&(n.forEach(o.slice(s,d+1),(function(e){n.forEach(t.predecessors(e),(function(n){var o=t.node(n),s=o.order;!(s<i||l<s)||o.dummy&&t.node(e).dummy||u(r,n,e)}))})),s=d+1,i=l)})),o})),r}function a(t,e){var r={};function o(e,o,i,s,a){var h;n.forEach(n.range(o,i),(function(o){h=e[o],t.node(h).dummy&&n.forEach(t.predecessors(h),(function(e){var n=t.node(e);n.dummy&&(n.order<s||n.order>a)&&u(r,e,h)}))}))}return n.reduce(e,(function(e,r){var i,s=-1,a=0;return n.forEach(r,(function(n,u){if("border"===t.node(n).dummy){var h=t.predecessors(n);h.length&&(i=t.node(h[0]).order,o(r,a,u,s,i),a=u,s=i)}o(r,a,r.length,i,e.length)})),r})),r}function u(t,e,r){if(e>r){var n=e;e=r,r=n}var o=t[e];o||(t[e]=o={}),o[r]=!0}function h(t,e,r){if(e>r){var o=e;e=r,r=o}return n.has(t[e],r)}function d(t,e,r,o){var i={},s={},a={};return n.forEach(e,(function(t){n.forEach(t,(function(t,e){i[t]=t,s[t]=t,a[t]=e}))})),n.forEach(e,(function(t){var e=-1;n.forEach(t,(function(t){var u=o(t);if(u.length){u=n.sortBy(u,(function(t){return a[t]}));for(var d=(u.length-1)/2,c=Math.floor(d),l=Math.ceil(d);c<=l;++c){var f=u[c];s[t]===t&&e<a[f]&&!h(r,t,f)&&(s[f]=t,s[t]=i[t]=i[f],e=a[f])}}}))})),{root:i,align:s}}function c(t,e,r,i,s){var a={},u=function(t,e,r,i){var s=new o,a=t.graph(),u=function(t,e,r){return function(o,i,s){var a,u=o.node(i),h=o.node(s),d=0;if(d+=u.width/2,n.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(d+=r?a:-a),a=0,d+=(u.dummy?e:t)/2,d+=(h.dummy?e:t)/2,d+=h.width/2,n.has(h,"labelpos"))switch(h.labelpos.toLowerCase()){case"l":a=h.width/2;break;case"r":a=-h.width/2}return a&&(d+=r?a:-a),a=0,d}}(a.nodesep,a.edgesep,i);return n.forEach(e,(function(e){var o;n.forEach(e,(function(e){var n=r[e];if(s.setNode(n),o){var i=r[o],a=s.edge(i,n);s.setEdge(i,n,Math.max(u(t,e,o),a||0))}o=e}))})),s}(t,e,r,s),h=s?"borderLeft":"borderRight";function d(t,e){for(var r=u.nodes(),n=r.pop(),o={};n;)o[n]?t(n):(o[n]=!0,r.push(n),r=r.concat(e(n))),n=r.pop()}return d((function(t){a[t]=u.inEdges(t).reduce((function(t,e){return Math.max(t,a[e.v]+u.edge(e))}),0)}),u.predecessors.bind(u)),d((function(e){var r=u.outEdges(e).reduce((function(t,e){return Math.min(t,a[e.w]-u.edge(e))}),Number.POSITIVE_INFINITY),n=t.node(e);r!==Number.POSITIVE_INFINITY&&n.borderType!==h&&(a[e]=Math.max(a[e],r))}),u.successors.bind(u)),n.forEach(i,(function(t){a[t]=a[r[t]]})),a}function l(t,e){return n.minBy(n.values(e),(function(e){var r=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return n.forIn(e,(function(e,n){var i=function(t,e){return t.node(e).width}(t,n)/2;r=Math.max(e+i,r),o=Math.min(e-i,o)})),r-o}))}function f(t,e){var r=n.values(e),o=n.min(r),i=n.max(r);n.forEach(["u","d"],(function(r){n.forEach(["l","r"],(function(s){var a,u=r+s,h=t[u];if(h!==e){var d=n.values(h);(a="l"===s?o-n.min(d):i-n.max(d))&&(t[u]=n.mapValues(h,(function(t){return t+a})))}}))}))}function g(t,e){return n.mapValues(t.ul,(function(r,o){if(e)return t[e.toLowerCase()][o];var i=n.sortBy(n.map(t,o));return(i[1]+i[2])/2}))}t.exports={positionX:function(t){var e,r=i.buildLayerMatrix(t),o=n.merge(s(t,r),a(t,r)),u={};n.forEach(["u","d"],(function(i){e="u"===i?r:n.values(r).reverse(),n.forEach(["l","r"],(function(r){"r"===r&&(e=n.map(e,(function(t){return n.values(t).reverse()})));var s=("u"===i?t.predecessors:t.successors).bind(t),a=d(0,e,o,s),h=c(t,e,a.root,a.align,"r"===r);"r"===r&&(h=n.mapValues(h,(function(t){return-t}))),u[i+r]=h}))}));var h=l(t,u);return f(u,h),g(u,t.graph().align)},findType1Conflicts:s,findType2Conflicts:a,addConflict:u,hasConflict:h,verticalAlignment:d,horizontalCompaction:c,alignCoordinates:f,findSmallestWidthAlignment:l,balance:g}},9497:(t,e,r)=>{"use strict";var n=r(5076),o=r(6573),i=r(2738).positionX;t.exports=function(t){(function(t){var e=o.buildLayerMatrix(t),r=t.graph().ranksep,i=0;n.forEach(e,(function(e){var o=n.max(n.map(e,(function(e){return t.node(e).height})));n.forEach(e,(function(e){t.node(e).y=i+o/2})),i+=o+r}))})(t=o.asNonCompoundGraph(t)),n.forEach(i(t),(function(e,r){t.node(r).x=e}))}},9996:(t,e,r)=>{"use strict";var n=r(5076),o=r(3374).Graph,i=r(8666).slack;function s(t,e){return n.forEach(t.nodes(),(function r(o){n.forEach(e.nodeEdges(o),(function(n){var s=n.v,a=o===s?n.w:s;t.hasNode(a)||i(e,n)||(t.setNode(a,{}),t.setEdge(o,a,{}),r(a))}))})),t.nodeCount()}function a(t,e){return n.minBy(e.edges(),(function(r){if(t.hasNode(r.v)!==t.hasNode(r.w))return i(e,r)}))}function u(t,e,r){n.forEach(t.nodes(),(function(t){e.node(t).rank+=r}))}t.exports=function(t){var e,r,n=new o({directed:!1}),h=t.nodes()[0],d=t.nodeCount();for(n.setNode(h,{});s(n,t)<d;)e=a(n,t),r=n.hasNode(e.v)?i(t,e):-i(t,e),u(n,t,r);return n}},9472:(t,e,r)=>{"use strict";var n=r(8666).longestPath,o=r(9996),i=r(4502);t.exports=function(t){switch(t.graph().ranker){case"network-simplex":default:!function(t){i(t)}(t);break;case"tight-tree":!function(t){n(t),o(t)}(t);break;case"longest-path":s(t)}};var s=n},4502:(t,e,r)=>{"use strict";var n=r(5076),o=r(9996),i=r(8666).slack,s=r(8666).longestPath,a=r(3374).alg.preorder,u=r(3374).alg.postorder,h=r(6573).simplify;function d(t){t=h(t),s(t);var e,r=o(t);for(f(r),c(r,t);e=p(r);)m(r,t,e,v(r,t,e))}function c(t,e){var r=u(t,t.nodes());r=r.slice(0,r.length-1),n.forEach(r,(function(r){!function(t,e,r){var n=t.node(r).parent;t.edge(r,n).cutvalue=l(t,e,r)}(t,e,r)}))}function l(t,e,r){var o=t.node(r).parent,i=!0,s=e.edge(r,o),a=0;return s||(i=!1,s=e.edge(o,r)),a=s.weight,n.forEach(e.nodeEdges(r),(function(n){var s,u,h=n.v===r,d=h?n.w:n.v;if(d!==o){var c=h===i,l=e.edge(n).weight;if(a+=c?l:-l,s=r,u=d,t.hasEdge(s,u)){var f=t.edge(r,d).cutvalue;a+=c?-f:f}}})),a}function f(t,e){arguments.length<2&&(e=t.nodes()[0]),g(t,{},1,e)}function g(t,e,r,o,i){var s=r,a=t.node(o);return e[o]=!0,n.forEach(t.neighbors(o),(function(i){n.has(e,i)||(r=g(t,e,r,i,o))})),a.low=s,a.lim=r++,i?a.parent=i:delete a.parent,r}function p(t){return n.find(t.edges(),(function(e){return t.edge(e).cutvalue<0}))}function v(t,e,r){var o=r.v,s=r.w;e.hasEdge(o,s)||(o=r.w,s=r.v);var a=t.node(o),u=t.node(s),h=a,d=!1;a.lim>u.lim&&(h=u,d=!0);var c=n.filter(e.edges(),(function(e){return d===y(0,t.node(e.v),h)&&d!==y(0,t.node(e.w),h)}));return n.minBy(c,(function(t){return i(e,t)}))}function m(t,e,r,o){var i=r.v,s=r.w;t.removeEdge(i,s),t.setEdge(o.v,o.w,{}),f(t),c(t,e),function(t,e){var r=n.find(t.nodes(),(function(t){return!e.node(t).parent})),o=a(t,r);o=o.slice(1),n.forEach(o,(function(r){var n=t.node(r).parent,o=e.edge(r,n),i=!1;o||(o=e.edge(n,r),i=!0),e.node(r).rank=e.node(n).rank+(i?o.minlen:-o.minlen)}))}(t,e)}function y(t,e,r){return r.low<=e.lim&&e.lim<=r.lim}t.exports=d,d.initLowLimValues=f,d.initCutValues=c,d.calcCutValue=l,d.leaveEdge=p,d.enterEdge=v,d.exchangeEdges=m},8666:(t,e,r)=>{"use strict";var n=r(5076);t.exports={longestPath:function(t){var e={};n.forEach(t.sources(),(function r(o){var i=t.node(o);if(n.has(e,o))return i.rank;e[o]=!0;var s=n.min(n.map(t.outEdges(o),(function(e){return r(e.w)-t.edge(e).minlen})));return s!==Number.POSITIVE_INFINITY&&null!=s||(s=0),i.rank=s}))},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}}},6573:(t,e,r)=>{"use strict";var n=r(5076),o=r(3374).Graph;function i(t,e,r,o){var i;do{i=n.uniqueId(o)}while(t.hasNode(i));return r.dummy=e,t.setNode(i,r),i}function s(t){return n.max(n.map(t.nodes(),(function(e){var r=t.node(e).rank;if(!n.isUndefined(r))return r})))}t.exports={addDummyNode:i,simplify:function(t){var e=(new o).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){var n=e.edge(r.v,r.w)||{weight:0,minlen:1},o=t.edge(r);e.setEdge(r.v,r.w,{weight:n.weight+o.weight,minlen:Math.max(n.minlen,o.minlen)})})),e},asNonCompoundGraph:function(t){var e=new o({multigraph:t.isMultigraph()}).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){t.children(r).length||e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){e.setEdge(r,t.edge(r))})),e},successorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.outEdges(e),(function(e){r[e.w]=(r[e.w]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.inEdges(e),(function(e){r[e.v]=(r[e.v]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},intersectRect:function(t,e){var r,n,o=t.x,i=t.y,s=e.x-o,a=e.y-i,u=t.width/2,h=t.height/2;if(!s&&!a)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(a)*u>Math.abs(s)*h?(a<0&&(h=-h),r=h*s/a,n=h):(s<0&&(u=-u),r=u,n=u*a/s),{x:o+r,y:i+n}},buildLayerMatrix:function(t){var e=n.map(n.range(s(t)+1),(function(){return[]}));return n.forEach(t.nodes(),(function(r){var o=t.node(r),i=o.rank;n.isUndefined(i)||(e[i][o.order]=r)})),e},normalizeRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank})));n.forEach(t.nodes(),(function(r){var o=t.node(r);n.has(o,"rank")&&(o.rank-=e)}))},removeEmptyRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank}))),r=[];n.forEach(t.nodes(),(function(n){var o=t.node(n).rank-e;r[o]||(r[o]=[]),r[o].push(n)}));var o=0,i=t.graph().nodeRankFactor;n.forEach(r,(function(e,r){n.isUndefined(e)&&r%i!=0?--o:o&&n.forEach(e,(function(e){t.node(e).rank+=o}))}))},addBorderNode:function(t,e,r,n){var o={width:0,height:0};return arguments.length>=4&&(o.rank=r,o.order=n),i(t,"border",o,e)},maxRank:s,partition:function(t,e){var r={lhs:[],rhs:[]};return n.forEach(t,(function(t){e(t)?r.lhs.push(t):r.rhs.push(t)})),r},time:function(t,e){var r=n.now();try{return e()}finally{console.log(t+" time: "+(n.now()-r)+"ms")}},notime:function(t,e){return e()}}},6661:t=>{t.exports="0.8.5"},7423:(t,e,r)=>{var n=r(783);t.exports={Graph:n.Graph,json:r(2350),alg:r(2638),version:n.version}},3536:(t,e,r)=>{var n=r(782);t.exports=function(t){var e,r={},o=[];function i(o){n.has(r,o)||(r[o]=!0,e.push(o),n.each(t.successors(o),i),n.each(t.predecessors(o),i))}return n.each(t.nodes(),(function(t){e=[],i(t),e.length&&o.push(e)})),o}},4933:(t,e,r)=>{var n=r(782);function o(t,e,r,i,s,a){n.has(i,e)||(i[e]=!0,r||a.push(e),n.each(s(e),(function(e){o(t,e,r,i,s,a)})),r&&a.push(e))}t.exports=function(t,e,r){n.isArray(e)||(e=[e]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),s=[],a={};return n.each(e,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);o(t,e,"post"===r,a,i,s)})),s}},9032:(t,e,r)=>{var n=r(4102),o=r(782);t.exports=function(t,e,r){return o.transform(t.nodes(),(function(o,i){o[i]=n(t,i,e,r)}),{})}},4102:(t,e,r)=>{var n=r(782),o=r(2468);t.exports=function(t,e,r,n){return function(t,e,r,n){var i,s,a={},u=new o,h=function(t){var e=t.v!==i?t.v:t.w,n=a[e],o=r(t),h=s.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+o);h<n.distance&&(n.distance=h,n.predecessor=i,u.decrease(e,h))};for(t.nodes().forEach((function(t){var r=t===e?0:Number.POSITIVE_INFINITY;a[t]={distance:r},u.add(t,r)}));u.size()>0&&(i=u.removeMin(),(s=a[i]).distance!==Number.POSITIVE_INFINITY);)n(i).forEach(h);return a}(t,String(e),r||i,n||function(e){return t.outEdges(e)})};var i=n.constant(1)},3983:(t,e,r)=>{var n=r(782),o=r(3952);t.exports=function(t){return n.filter(o(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}},2329:(t,e,r)=>{var n=r(782);t.exports=function(t,e,r){return function(t,e,r){var n={},o=t.nodes();return o.forEach((function(t){n[t]={},n[t][t]={distance:0},o.forEach((function(e){t!==e&&(n[t][e]={distance:Number.POSITIVE_INFINITY})})),r(t).forEach((function(r){var o=r.v===t?r.w:r.v,i=e(r);n[t][o]={distance:i,predecessor:t}}))})),o.forEach((function(t){var e=n[t];o.forEach((function(r){var i=n[r];o.forEach((function(r){var n=i[t],o=e[r],s=i[r],a=n.distance+o.distance;a<s.distance&&(s.distance=a,s.predecessor=o.predecessor)}))}))})),n}(t,e||o,r||function(e){return t.outEdges(e)})};var o=n.constant(1)},2638:(t,e,r)=>{t.exports={components:r(3536),dijkstra:r(4102),dijkstraAll:r(9032),findCycles:r(3983),floydWarshall:r(2329),isAcyclic:r(8345),postorder:r(1600),preorder:r(39),prim:r(6280),tarjan:r(3952),topsort:r(7849)}},8345:(t,e,r)=>{var n=r(7849);t.exports=function(t){try{n(t)}catch(t){if(t instanceof n.CycleException)return!1;throw t}return!0}},1600:(t,e,r)=>{var n=r(4933);t.exports=function(t,e){return n(t,e,"post")}},39:(t,e,r)=>{var n=r(4933);t.exports=function(t,e){return n(t,e,"pre")}},6280:(t,e,r)=>{var n=r(782),o=r(1943),i=r(2468);t.exports=function(t,e){var r,s=new o,a={},u=new i;function h(t){var n=t.v===r?t.w:t.v,o=u.priority(n);if(void 0!==o){var i=e(t);i<o&&(a[n]=r,u.decrease(n,i))}}if(0===t.nodeCount())return s;n.each(t.nodes(),(function(t){u.add(t,Number.POSITIVE_INFINITY),s.setNode(t)})),u.decrease(t.nodes()[0],0);for(var d=!1;u.size()>0;){if(r=u.removeMin(),n.has(a,r))s.setEdge(r,a[r]);else{if(d)throw new Error("Input graph is not connected: "+t);d=!0}t.nodeEdges(r).forEach(h)}return s}},3952:(t,e,r)=>{var n=r(782);t.exports=function(t){var e=0,r=[],o={},i=[];function s(a){var u=o[a]={onStack:!0,lowlink:e,index:e++};if(r.push(a),t.successors(a).forEach((function(t){n.has(o,t)?o[t].onStack&&(u.lowlink=Math.min(u.lowlink,o[t].index)):(s(t),u.lowlink=Math.min(u.lowlink,o[t].lowlink))})),u.lowlink===u.index){var h,d=[];do{h=r.pop(),o[h].onStack=!1,d.push(h)}while(a!==h);i.push(d)}}return t.nodes().forEach((function(t){n.has(o,t)||s(t)})),i}},7849:(t,e,r)=>{var n=r(782);function o(t){var e={},r={},o=[];if(n.each(t.sinks(),(function s(a){if(n.has(r,a))throw new i;n.has(e,a)||(r[a]=!0,e[a]=!0,n.each(t.predecessors(a),s),delete r[a],o.push(a))})),n.size(e)!==t.nodeCount())throw new i;return o}function i(){}t.exports=o,o.CycleException=i,i.prototype=new Error},2468:(t,e,r)=>{var n=r(782);function o(){this._arr=[],this._keyIndices={}}t.exports=o,o.prototype.size=function(){return this._arr.length},o.prototype.keys=function(){return this._arr.map((function(t){return t.key}))},o.prototype.has=function(t){return n.has(this._keyIndices,t)},o.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},o.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},o.prototype.add=function(t,e){var r=this._keyIndices;if(t=String(t),!n.has(r,t)){var o=this._arr,i=o.length;return r[t]=i,o.push({key:t,priority:e}),this._decrease(i),!0}return!1},o.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},o.prototype.decrease=function(t,e){var r=this._keyIndices[t];if(e>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[r].priority+" New: "+e);this._arr[r].priority=e,this._decrease(r)},o.prototype._heapify=function(t){var e=this._arr,r=2*t,n=r+1,o=t;r<e.length&&(o=e[r].priority<e[o].priority?r:o,n<e.length&&(o=e[n].priority<e[o].priority?n:o),o!==t&&(this._swap(t,o),this._heapify(o)))},o.prototype._decrease=function(t){for(var e,r=this._arr,n=r[t].priority;0!==t&&!(r[e=t>>1].priority<n);)this._swap(t,e),t=e},o.prototype._swap=function(t,e){var r=this._arr,n=this._keyIndices,o=r[t],i=r[e];r[t]=i,r[e]=o,n[i.key]=t,n[o.key]=e}},1943:(t,e,r)=>{"use strict";var n=r(782);t.exports=a;var o="\\0",i="\\0",s="";function a(t){this._isDirected=!n.has(t,"directed")||t.directed,this._isMultigraph=!!n.has(t,"multigraph")&&t.multigraph,this._isCompound=!!n.has(t,"compound")&&t.compound,this._label=void 0,this._defaultNodeLabelFn=n.constant(void 0),this._defaultEdgeLabelFn=n.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[i]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function u(t,e){t[e]?t[e]++:t[e]=1}function h(t,e){--t[e]||delete t[e]}function d(t,e,r,i){var a=""+e,u=""+r;if(!t&&a>u){var h=a;a=u,u=h}return a+s+u+s+(n.isUndefined(i)?o:i)}function c(t,e){return d(t,e.v,e.w,e.name)}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(t){return this._label=t,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultNodeLabelFn=t,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return n.keys(this._nodes)},a.prototype.sources=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._in[e])}))},a.prototype.sinks=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._out[e])}))},a.prototype.setNodes=function(t,e){var r=arguments,o=this;return n.each(t,(function(t){r.length>1?o.setNode(t,e):o.setNode(t)})),this},a.prototype.setNode=function(t,e){return n.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=i,this._children[t]={},this._children[i][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},a.prototype.node=function(t){return this._nodes[t]},a.prototype.hasNode=function(t){return n.has(this._nodes,t)},a.prototype.removeNode=function(t){var e=this;if(n.has(this._nodes,t)){var r=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],n.each(this.children(t),(function(t){e.setParent(t)})),delete this._children[t]),n.each(n.keys(this._in[t]),r),delete this._in[t],delete this._preds[t],n.each(n.keys(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},a.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n.isUndefined(e))e=i;else{for(var r=e+="";!n.isUndefined(r);r=this.parent(r))if(r===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},a.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},a.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if(e!==i)return e}},a.prototype.children=function(t){if(n.isUndefined(t)&&(t=i),this._isCompound){var e=this._children[t];if(e)return n.keys(e)}else{if(t===i)return this.nodes();if(this.hasNode(t))return[]}},a.prototype.predecessors=function(t){var e=this._preds[t];if(e)return n.keys(e)},a.prototype.successors=function(t){var e=this._sucs[t];if(e)return n.keys(e)},a.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return n.union(e,this.successors(t))},a.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},a.prototype.filterNodes=function(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var r=this;n.each(this._nodes,(function(r,n){t(n)&&e.setNode(n,r)})),n.each(this._edgeObjs,(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,r.edge(t))}));var o={};function i(t){var n=r.parent(t);return void 0===n||e.hasNode(n)?(o[t]=n,n):n in o?o[n]:i(n)}return this._isCompound&&n.each(e.nodes(),(function(t){e.setParent(t,i(t))})),e},a.prototype.setDefaultEdgeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultEdgeLabelFn=t,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return n.values(this._edgeObjs)},a.prototype.setPath=function(t,e){var r=this,o=arguments;return n.reduce(t,(function(t,n){return o.length>1?r.setEdge(t,n,e):r.setEdge(t,n),n})),this},a.prototype.setEdge=function(){var t,e,r,o,i=!1,s=arguments[0];"object"==typeof s&&null!==s&&"v"in s?(t=s.v,e=s.w,r=s.name,2===arguments.length&&(o=arguments[1],i=!0)):(t=s,e=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],i=!0)),t=""+t,e=""+e,n.isUndefined(r)||(r=""+r);var a=d(this._isDirected,t,e,r);if(n.has(this._edgeLabels,a))return i&&(this._edgeLabels[a]=o),this;if(!n.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[a]=i?o:this._defaultEdgeLabelFn(t,e,r);var h=function(t,e,r,n){var o=""+e,i=""+r;if(!t&&o>i){var s=o;o=i,i=s}var a={v:o,w:i};return n&&(a.name=n),a}(this._isDirected,t,e,r);return t=h.v,e=h.w,Object.freeze(h),this._edgeObjs[a]=h,u(this._preds[e],t),u(this._sucs[t],e),this._in[e][a]=h,this._out[t][a]=h,this._edgeCount++,this},a.prototype.edge=function(t,e,r){var n=1===arguments.length?c(this._isDirected,arguments[0]):d(this._isDirected,t,e,r);return this._edgeLabels[n]},a.prototype.hasEdge=function(t,e,r){var o=1===arguments.length?c(this._isDirected,arguments[0]):d(this._isDirected,t,e,r);return n.has(this._edgeLabels,o)},a.prototype.removeEdge=function(t,e,r){var n=1===arguments.length?c(this._isDirected,arguments[0]):d(this._isDirected,t,e,r),o=this._edgeObjs[n];return o&&(t=o.v,e=o.w,delete this._edgeLabels[n],delete this._edgeObjs[n],h(this._preds[e],t),h(this._sucs[t],e),delete this._in[e][n],delete this._out[t][n],this._edgeCount--),this},a.prototype.inEdges=function(t,e){var r=this._in[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.v===e})):o}},a.prototype.outEdges=function(t,e){var r=this._out[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.w===e})):o}},a.prototype.nodeEdges=function(t,e){var r=this.inEdges(t,e);if(r)return r.concat(this.outEdges(t,e))}},783:(t,e,r)=>{t.exports={Graph:r(1943),version:r(1471)}},2350:(t,e,r)=>{var n=r(782),o=r(1943);function i(t){return n.map(t.nodes(),(function(e){var r=t.node(e),o=t.parent(e),i={v:e};return n.isUndefined(r)||(i.value=r),n.isUndefined(o)||(i.parent=o),i}))}function s(t){return n.map(t.edges(),(function(e){var r=t.edge(e),o={v:e.v,w:e.w};return n.isUndefined(e.name)||(o.name=e.name),n.isUndefined(r)||(o.value=r),o}))}t.exports={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:i(t),edges:s(t)};return n.isUndefined(t.graph())||(e.value=n.clone(t.graph())),e},read:function(t){var e=new o(t.options).setGraph(t.value);return n.each(t.nodes,(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)})),n.each(t.edges,(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),e}}},782:(t,e,r)=>{var n;try{n={clone:r(5402),constant:r(8295),each:r(958),filter:r(9969),has:r(4339),isArray:r(5874),isEmpty:r(2046),isFunction:r(7787),isUndefined:r(2895),keys:r(3511),map:r(9629),reduce:r(9285),size:r(3910),transform:r(3279),union:r(3344),values:r(3005)}}catch(t){}n||(n=window._),t.exports=n},1471:t=>{t.exports="2.1.8"},5229:(t,e,r)=>{"use strict";r.r(e),r.d(e,{isAnyArray:()=>o});const n=Object.prototype.toString;function o(t){const e=n.call(t);return e.endsWith("Array]")&&!e.includes("Big")}},6171:(t,e,r)=>{var n=r(4671)(r(714),"DataView");t.exports=n},6766:(t,e,r)=>{var n=r(2405),o=r(8341),i=r(9644),s=r(3784),a=r(6264);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},1022:(t,e,r)=>{var n=r(6821),o=r(7221),i=r(1596),s=r(1992),a=r(552);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},5870:(t,e,r)=>{var n=r(4671)(r(714),"Map");t.exports=n},8910:(t,e,r)=>{var n=r(4069),o=r(7477),i=r(476),s=r(984),a=r(4136);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},4665:(t,e,r)=>{var n=r(4671)(r(714),"Promise");t.exports=n},9612:(t,e,r)=>{var n=r(4671)(r(714),"Set");t.exports=n},2312:(t,e,r)=>{var n=r(8910),o=r(1945),i=r(4874);function s(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new n;++e<r;)this.add(t[e])}s.prototype.add=s.prototype.push=o,s.prototype.has=i,t.exports=s},7216:(t,e,r)=>{var n=r(1022),o=r(5331),i=r(7063),s=r(134),a=r(9842),u=r(9850);function h(t){var e=this.__data__=new n(t);this.size=e.size}h.prototype.clear=o,h.prototype.delete=i,h.prototype.get=s,h.prototype.has=a,h.prototype.set=u,t.exports=h},9006:(t,e,r)=>{var n=r(714).Symbol;t.exports=n},8851:(t,e,r)=>{var n=r(714).Uint8Array;t.exports=n},8154:(t,e,r)=>{var n=r(4671)(r(714),"WeakMap");t.exports=n},7156:t=>{t.exports=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}},7012:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}},2995:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var s=t[r];e(s,r,t)&&(i[o++]=s)}return i}},128:(t,e,r)=>{var n=r(8506);t.exports=function(t,e){return!(null==t||!t.length)&&n(t,e,0)>-1}},6184:t=>{t.exports=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1}},9754:(t,e,r)=>{var n=r(9605),o=r(79),i=r(5874),s=r(3601),a=r(1908),u=r(9046),h=Object.prototype.hasOwnProperty;t.exports=function(t,e){var r=i(t),d=!r&&o(t),c=!r&&!d&&s(t),l=!r&&!d&&!c&&u(t),f=r||d||c||l,g=f?n(t.length,String):[],p=g.length;for(var v in t)!e&&!h.call(t,v)||f&&("length"==v||c&&("offset"==v||"parent"==v)||l&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||a(v,p))||g.push(v);return g}},2275:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}},2525:t=>{t.exports=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}},8663:t=>{t.exports=function(t,e,r,n){var o=-1,i=null==t?0:t.length;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}},3525:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}},446:(t,e,r)=>{var n=r(8494)("length");t.exports=n},2430:(t,e,r)=>{var n=r(3077),o=r(5097);t.exports=function(t,e,r){(void 0!==r&&!o(t[e],r)||void 0===r&&!(e in t))&&n(t,e,r)}},5802:(t,e,r)=>{var n=r(3077),o=r(5097),i=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){var s=t[e];i.call(t,e)&&o(s,r)&&(void 0!==r||e in t)||n(t,e,r)}},9438:(t,e,r)=>{var n=r(5097);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},6902:(t,e,r)=>{var n=r(5532),o=r(3511);t.exports=function(t,e){return t&&n(e,o(e),t)}},5873:(t,e,r)=>{var n=r(5532),o=r(2844);t.exports=function(t,e){return t&&n(e,o(e),t)}},3077:(t,e,r)=>{var n=r(4856);t.exports=function(t,e,r){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}},9018:(t,e,r)=>{var n=r(7216),o=r(7012),i=r(5802),s=r(6902),a=r(5873),u=r(6743),h=r(310),d=r(5590),c=r(2209),l=r(2573),f=r(3918),g=r(9778),p=r(5290),v=r(4028),m=r(9168),y=r(5874),w=r(3601),x=r(4725),b=r(9400),E=r(7363),N=r(3511),M=r(2844),_="[object Arguments]",k="[object Function]",A="[object Object]",j={};j[_]=j["[object Array]"]=j["[object ArrayBuffer]"]=j["[object DataView]"]=j["[object Boolean]"]=j["[object Date]"]=j["[object Float32Array]"]=j["[object Float64Array]"]=j["[object Int8Array]"]=j["[object Int16Array]"]=j["[object Int32Array]"]=j["[object Map]"]=j["[object Number]"]=j[A]=j["[object RegExp]"]=j["[object Set]"]=j["[object String]"]=j["[object Symbol]"]=j["[object Uint8Array]"]=j["[object Uint8ClampedArray]"]=j["[object Uint16Array]"]=j["[object Uint32Array]"]=!0,j["[object Error]"]=j[k]=j["[object WeakMap]"]=!1,t.exports=function t(e,r,S,O,z,R){var I,C=1&r,D=2&r,P=4&r;if(S&&(I=z?S(e,O,z,R):S(e)),void 0!==I)return I;if(!b(e))return e;var T=y(e);if(T){if(I=p(e),!C)return h(e,I)}else{var L=g(e),F=L==k||"[object GeneratorFunction]"==L;if(w(e))return u(e,C);if(L==A||L==_||F&&!z){if(I=D||F?{}:m(e),!C)return D?c(e,a(I,e)):d(e,s(I,e))}else{if(!j[L])return z?e:{};I=v(e,L,C)}}R||(R=new n);var q=R.get(e);if(q)return q;R.set(e,I),E(e)?e.forEach((function(n){I.add(t(n,r,S,n,e,R))})):x(e)&&e.forEach((function(n,o){I.set(o,t(n,r,S,o,e,R))}));var V=T?void 0:(P?D?f:l:D?M:N)(e);return o(V||e,(function(n,o){V&&(n=e[o=n]),i(I,o,t(n,r,S,o,e,R))})),I}},1095:(t,e,r)=>{var n=r(9400),o=Object.create,i=function(){function t(){}return function(e){if(!n(e))return{};if(o)return o(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();t.exports=i},830:(t,e,r)=>{var n=r(7702),o=r(8678)(n);t.exports=o},5816:(t,e,r)=>{var n=r(975);t.exports=function(t,e,r){for(var o=-1,i=t.length;++o<i;){var s=t[o],a=e(s);if(null!=a&&(void 0===u?a==a&&!n(a):r(a,u)))var u=a,h=s}return h}},1329:(t,e,r)=>{var n=r(830);t.exports=function(t,e){var r=[];return n(t,(function(t,n,o){e(t,n,o)&&r.push(t)})),r}},166:t=>{t.exports=function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1}},9821:(t,e,r)=>{var n=r(2525),o=r(3542);t.exports=function t(e,r,i,s,a){var u=-1,h=e.length;for(i||(i=o),a||(a=[]);++u<h;){var d=e[u];r>0&&i(d)?r>1?t(d,r-1,i,s,a):n(a,d):s||(a[a.length]=d)}return a}},9128:(t,e,r)=>{var n=r(3600)();t.exports=n},7702:(t,e,r)=>{var n=r(9128),o=r(3511);t.exports=function(t,e){return t&&n(t,e,o)}},1855:(t,e,r)=>{var n=r(330),o=r(9628);t.exports=function(t,e){for(var r=0,i=(e=n(e,t)).length;null!=t&&r<i;)t=t[o(e[r++])];return r&&r==i?t:void 0}},5920:(t,e,r)=>{var n=r(2525),o=r(5874);t.exports=function(t,e,r){var i=e(t);return o(t)?i:n(i,r(t))}},5271:(t,e,r)=>{var n=r(9006),o=r(9650),i=r(6881),s=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":s&&s in Object(t)?o(t):i(t)}},4116:t=>{t.exports=function(t,e){return t>e}},3091:t=>{var e=Object.prototype.hasOwnProperty;t.exports=function(t,r){return null!=t&&e.call(t,r)}},5088:t=>{t.exports=function(t,e){return null!=t&&e in Object(t)}},8506:(t,e,r)=>{var n=r(166),o=r(8306),i=r(638);t.exports=function(t,e,r){return e==e?i(t,e,r):n(t,o,r)}},4047:(t,e,r)=>{var n=r(5271),o=r(7583);t.exports=function(t){return o(t)&&"[object Arguments]"==n(t)}},3899:(t,e,r)=>{var n=r(8309),o=r(7583);t.exports=function t(e,r,i,s,a){return e===r||(null==e||null==r||!o(e)&&!o(r)?e!=e&&r!=r:n(e,r,i,s,t,a))}},8309:(t,e,r)=>{var n=r(7216),o=r(3522),i=r(9481),s=r(8370),a=r(9778),u=r(5874),h=r(3601),d=r(9046),c="[object Arguments]",l="[object Array]",f="[object Object]",g=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,p,v,m){var y=u(t),w=u(e),x=y?l:a(t),b=w?l:a(e),E=(x=x==c?f:x)==f,N=(b=b==c?f:b)==f,M=x==b;if(M&&h(t)){if(!h(e))return!1;y=!0,E=!1}if(M&&!E)return m||(m=new n),y||d(t)?o(t,e,r,p,v,m):i(t,e,x,r,p,v,m);if(!(1&r)){var _=E&&g.call(t,"__wrapped__"),k=N&&g.call(e,"__wrapped__");if(_||k){var A=_?t.value():t,j=k?e.value():e;return m||(m=new n),v(A,j,r,p,m)}}return!!M&&(m||(m=new n),s(t,e,r,p,v,m))}},4965:(t,e,r)=>{var n=r(9778),o=r(7583);t.exports=function(t){return o(t)&&"[object Map]"==n(t)}},4014:(t,e,r)=>{var n=r(7216),o=r(3899);t.exports=function(t,e,r,i){var s=r.length,a=s,u=!i;if(null==t)return!a;for(t=Object(t);s--;){var h=r[s];if(u&&h[2]?h[1]!==t[h[0]]:!(h[0]in t))return!1}for(;++s<a;){var d=(h=r[s])[0],c=t[d],l=h[1];if(u&&h[2]){if(void 0===c&&!(d in t))return!1}else{var f=new n;if(i)var g=i(c,l,d,t,e,f);if(!(void 0===g?o(l,c,3,i,f):g))return!1}}return!0}},8306:t=>{t.exports=function(t){return t!=t}},4228:(t,e,r)=>{var n=r(7787),o=r(7827),i=r(9400),s=r(462),a=/^\\[object .+?Constructor\\]$/,u=Function.prototype,h=Object.prototype,d=u.toString,c=h.hasOwnProperty,l=RegExp("^"+d.call(c).replace(/[\\\\^$.*+?()[\\]{}|]/g,"\\\\$&").replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!i(t)||o(t))&&(n(t)?l:a).test(s(t))}},6499:(t,e,r)=>{var n=r(9778),o=r(7583);t.exports=function(t){return o(t)&&"[object Set]"==n(t)}},550:(t,e,r)=>{var n=r(5271),o=r(4583),i=r(7583),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,t.exports=function(t){return i(t)&&o(t.length)&&!!s[n(t)]}},4506:(t,e,r)=>{var n=r(6330),o=r(2363),i=r(9169),s=r(5874),a=r(6830);t.exports=function(t){return"function"==typeof t?t:null==t?i:"object"==typeof t?s(t)?o(t[0],t[1]):n(t):a(t)}},5351:(t,e,r)=>{var n=r(7894),o=r(2325),i=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return o(t);var e=[];for(var r in Object(t))i.call(t,r)&&"constructor"!=r&&e.push(r);return e}},1500:(t,e,r)=>{var n=r(9400),o=r(7894),i=r(5382),s=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return i(t);var e=o(t),r=[];for(var a in t)("constructor"!=a||!e&&s.call(t,a))&&r.push(a);return r}},2795:t=>{t.exports=function(t,e){return t<e}},4733:(t,e,r)=>{var n=r(830),o=r(3069);t.exports=function(t,e){var r=-1,i=o(t)?Array(t.length):[];return n(t,(function(t,n,o){i[++r]=e(t,n,o)})),i}},6330:(t,e,r)=>{var n=r(4014),o=r(6539),i=r(7316);t.exports=function(t){var e=o(t);return 1==e.length&&e[0][2]?i(e[0][0],e[0][1]):function(r){return r===t||n(r,t,e)}}},2363:(t,e,r)=>{var n=r(3899),o=r(5887),i=r(4016),s=r(759),a=r(7223),u=r(7316),h=r(9628);t.exports=function(t,e){return s(t)&&a(e)?u(h(t),e):function(r){var s=o(r,t);return void 0===s&&s===e?i(r,t):n(e,s,3)}}},4479:(t,e,r)=>{var n=r(7216),o=r(2430),i=r(9128),s=r(3857),a=r(9400),u=r(2844),h=r(6127);t.exports=function t(e,r,d,c,l){e!==r&&i(r,(function(i,u){if(l||(l=new n),a(i))s(e,r,u,d,t,c,l);else{var f=c?c(h(e,u),i,u+"",e,r,l):void 0;void 0===f&&(f=i),o(e,u,f)}}),u)}},3857:(t,e,r)=>{var n=r(2430),o=r(6743),i=r(1532),s=r(310),a=r(9168),u=r(79),h=r(5874),d=r(6882),c=r(3601),l=r(7787),f=r(9400),g=r(4108),p=r(9046),v=r(6127),m=r(339);t.exports=function(t,e,r,y,w,x,b){var E=v(t,r),N=v(e,r),M=b.get(N);if(M)n(t,r,M);else{var _=x?x(E,N,r+"",t,e,b):void 0,k=void 0===_;if(k){var A=h(N),j=!A&&c(N),S=!A&&!j&&p(N);_=N,A||j||S?h(E)?_=E:d(E)?_=s(E):j?(k=!1,_=o(N,!0)):S?(k=!1,_=i(N,!0)):_=[]:g(N)||u(N)?(_=E,u(E)?_=m(E):f(E)&&!l(E)||(_=a(N))):k=!1}k&&(b.set(N,_),w(_,N,y,x,b),b.delete(N)),n(t,r,_)}}},9586:(t,e,r)=>{var n=r(2275),o=r(1855),i=r(4506),s=r(4733),a=r(7070),u=r(8232),h=r(6395),d=r(9169),c=r(5874);t.exports=function(t,e,r){e=e.length?n(e,(function(t){return c(t)?function(e){return o(e,1===t.length?t[0]:t)}:t})):[d];var l=-1;e=n(e,u(i));var f=s(t,(function(t,r,o){return{criteria:n(e,(function(e){return e(t)})),index:++l,value:t}}));return a(f,(function(t,e){return h(t,e,r)}))}},4286:(t,e,r)=>{var n=r(8499),o=r(4016);t.exports=function(t,e){return n(t,e,(function(e,r){return o(t,r)}))}},8499:(t,e,r)=>{var n=r(1855),o=r(9435),i=r(330);t.exports=function(t,e,r){for(var s=-1,a=e.length,u={};++s<a;){var h=e[s],d=n(t,h);r(d,h)&&o(u,i(h,t),d)}return u}},8494:t=>{t.exports=function(t){return function(e){return null==e?void 0:e[t]}}},3644:(t,e,r)=>{var n=r(1855);t.exports=function(t){return function(e){return n(e,t)}}},8514:t=>{var e=Math.ceil,r=Math.max;t.exports=function(t,n,o,i){for(var s=-1,a=r(e((n-t)/(o||1)),0),u=Array(a);a--;)u[i?a:++s]=t,t+=o;return u}},8421:t=>{t.exports=function(t,e,r,n,o){return o(t,(function(t,o,i){r=n?(n=!1,t):e(r,t,o,i)})),r}},6965:(t,e,r)=>{var n=r(9169),o=r(5390),i=r(3232);t.exports=function(t,e){return i(o(t,e,n),t+"")}},9435:(t,e,r)=>{var n=r(5802),o=r(330),i=r(1908),s=r(9400),a=r(9628);t.exports=function(t,e,r,u){if(!s(t))return t;for(var h=-1,d=(e=o(e,t)).length,c=d-1,l=t;null!=l&&++h<d;){var f=a(e[h]),g=r;if("__proto__"===f||"constructor"===f||"prototype"===f)return t;if(h!=c){var p=l[f];void 0===(g=u?u(p,f,l):void 0)&&(g=s(p)?p:i(e[h+1])?[]:{})}n(l,f,g),l=l[f]}return t}},3431:(t,e,r)=>{var n=r(8295),o=r(4856),i=r(9169),s=o?function(t,e){return o(t,"toString",{configurable:!0,enumerable:!1,value:n(e),writable:!0})}:i;t.exports=s},7070:t=>{t.exports=function(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}},9605:t=>{t.exports=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}},8071:(t,e,r)=>{var n=r(9006),o=r(2275),i=r(5874),s=r(975),a=n?n.prototype:void 0,u=a?a.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(i(e))return o(e,t)+"";if(s(e))return u?u.call(e):"";var r=e+"";return"0"==r&&1/e==-1/0?"-0":r}},5103:(t,e,r)=>{var n=r(4997),o=/^\\s+/;t.exports=function(t){return t?t.slice(0,n(t)+1).replace(o,""):t}},8232:t=>{t.exports=function(t){return function(e){return t(e)}}},3434:(t,e,r)=>{var n=r(2312),o=r(128),i=r(6184),s=r(5420),a=r(2196),u=r(6968);t.exports=function(t,e,r){var h=-1,d=o,c=t.length,l=!0,f=[],g=f;if(r)l=!1,d=i;else if(c>=200){var p=e?null:a(t);if(p)return u(p);l=!1,d=s,g=new n}else g=e?[]:f;t:for(;++h<c;){var v=t[h],m=e?e(v):v;if(v=r||0!==v?v:0,l&&m==m){for(var y=g.length;y--;)if(g[y]===m)continue t;e&&g.push(m),f.push(v)}else d(g,m,r)||(g!==f&&g.push(m),f.push(v))}return f}},989:(t,e,r)=>{var n=r(2275);t.exports=function(t,e){return n(e,(function(e){return t[e]}))}},2543:t=>{t.exports=function(t,e,r){for(var n=-1,o=t.length,i=e.length,s={};++n<o;){var a=n<i?e[n]:void 0;r(s,t[n],a)}return s}},5420:t=>{t.exports=function(t,e){return t.has(e)}},4041:(t,e,r)=>{var n=r(9169);t.exports=function(t){return"function"==typeof t?t:n}},330:(t,e,r)=>{var n=r(5874),o=r(759),i=r(9505),s=r(983);t.exports=function(t,e){return n(t)?t:o(t,e)?[t]:i(s(t))}},9270:(t,e,r)=>{var n=r(8851);t.exports=function(t){var e=new t.constructor(t.byteLength);return new n(e).set(new n(t)),e}},6743:(t,e,r)=>{t=r.nmd(t);var n=r(714),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o?n.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=a?a(r):new t.constructor(r);return t.copy(n),n}},5940:(t,e,r)=>{var n=r(9270);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}},5320:t=>{var e=/\\w*$/;t.exports=function(t){var r=new t.constructor(t.source,e.exec(t));return r.lastIndex=t.lastIndex,r}},4937:(t,e,r)=>{var n=r(9006),o=n?n.prototype:void 0,i=o?o.valueOf:void 0;t.exports=function(t){return i?Object(i.call(t)):{}}},1532:(t,e,r)=>{var n=r(9270);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}},1141:(t,e,r)=>{var n=r(975);t.exports=function(t,e){if(t!==e){var r=void 0!==t,o=null===t,i=t==t,s=n(t),a=void 0!==e,u=null===e,h=e==e,d=n(e);if(!u&&!d&&!s&&t>e||s&&a&&h&&!u&&!d||o&&a&&h||!r&&h||!i)return 1;if(!o&&!s&&!d&&t<e||d&&r&&i&&!o&&!s||u&&r&&i||!a&&i||!h)return-1}return 0}},6395:(t,e,r)=>{var n=r(1141);t.exports=function(t,e,r){for(var o=-1,i=t.criteria,s=e.criteria,a=i.length,u=r.length;++o<a;){var h=n(i[o],s[o]);if(h)return o>=u?h:h*("desc"==r[o]?-1:1)}return t.index-e.index}},310:t=>{t.exports=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}},5532:(t,e,r)=>{var n=r(5802),o=r(3077);t.exports=function(t,e,r,i){var s=!r;r||(r={});for(var a=-1,u=e.length;++a<u;){var h=e[a],d=i?i(r[h],t[h],h,r,t):void 0;void 0===d&&(d=t[h]),s?o(r,h,d):n(r,h,d)}return r}},5590:(t,e,r)=>{var n=r(5532),o=r(9183);t.exports=function(t,e){return n(t,o(t),e)}},2209:(t,e,r)=>{var n=r(5532),o=r(596);t.exports=function(t,e){return n(t,o(t),e)}},6450:(t,e,r)=>{var n=r(714)["__core-js_shared__"];t.exports=n},1292:(t,e,r)=>{var n=r(6965),o=r(8819);t.exports=function(t){return n((function(e,r){var n=-1,i=r.length,s=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(s=t.length>3&&"function"==typeof s?(i--,s):void 0,a&&o(r[0],r[1],a)&&(s=i<3?void 0:s,i=1),e=Object(e);++n<i;){var u=r[n];u&&t(e,u,n,s)}return e}))}},8678:(t,e,r)=>{var n=r(3069);t.exports=function(t,e){return function(r,o){if(null==r)return r;if(!n(r))return t(r,o);for(var i=r.length,s=e?i:-1,a=Object(r);(e?s--:++s<i)&&!1!==o(a[s],s,a););return r}}},3600:t=>{t.exports=function(t){return function(e,r,n){for(var o=-1,i=Object(e),s=n(e),a=s.length;a--;){var u=s[t?a:++o];if(!1===r(i[u],u,i))break}return e}}},6057:(t,e,r)=>{var n=r(4506),o=r(3069),i=r(3511);t.exports=function(t){return function(e,r,s){var a=Object(e);if(!o(e)){var u=n(r,3);e=i(e),r=function(t){return u(a[t],t,a)}}var h=t(e,r,s);return h>-1?a[u?e[h]:h]:void 0}}},4590:(t,e,r)=>{var n=r(8514),o=r(8819),i=r(8265);t.exports=function(t){return function(e,r,s){return s&&"number"!=typeof s&&o(e,r,s)&&(r=s=void 0),e=i(e),void 0===r?(r=e,e=0):r=i(r),s=void 0===s?e<r?1:-1:i(s),n(e,r,s,t)}}},2196:(t,e,r)=>{var n=r(9612),o=r(3883),i=r(6968),s=n&&1/i(new n([,-0]))[1]==1/0?function(t){return new n(t)}:o;t.exports=s},4856:(t,e,r)=>{var n=r(4671),o=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},3522:(t,e,r)=>{var n=r(2312),o=r(3525),i=r(5420);t.exports=function(t,e,r,s,a,u){var h=1&r,d=t.length,c=e.length;if(d!=c&&!(h&&c>d))return!1;var l=u.get(t),f=u.get(e);if(l&&f)return l==e&&f==t;var g=-1,p=!0,v=2&r?new n:void 0;for(u.set(t,e),u.set(e,t);++g<d;){var m=t[g],y=e[g];if(s)var w=h?s(y,m,g,e,t,u):s(m,y,g,t,e,u);if(void 0!==w){if(w)continue;p=!1;break}if(v){if(!o(e,(function(t,e){if(!i(v,e)&&(m===t||a(m,t,r,s,u)))return v.push(e)}))){p=!1;break}}else if(m!==y&&!a(m,y,r,s,u)){p=!1;break}}return u.delete(t),u.delete(e),p}},9481:(t,e,r)=>{var n=r(9006),o=r(8851),i=r(5097),s=r(3522),a=r(8866),u=r(6968),h=n?n.prototype:void 0,d=h?h.valueOf:void 0;t.exports=function(t,e,r,n,h,c,l){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!c(new o(t),new o(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var f=a;case"[object Set]":var g=1&n;if(f||(f=u),t.size!=e.size&&!g)return!1;var p=l.get(t);if(p)return p==e;n|=2,l.set(t,e);var v=s(f(t),f(e),n,h,c,l);return l.delete(t),v;case"[object Symbol]":if(d)return d.call(t)==d.call(e)}return!1}},8370:(t,e,r)=>{var n=r(2573),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,i,s,a){var u=1&r,h=n(t),d=h.length;if(d!=n(e).length&&!u)return!1;for(var c=d;c--;){var l=h[c];if(!(u?l in e:o.call(e,l)))return!1}var f=a.get(t),g=a.get(e);if(f&&g)return f==e&&g==t;var p=!0;a.set(t,e),a.set(e,t);for(var v=u;++c<d;){var m=t[l=h[c]],y=e[l];if(i)var w=u?i(y,m,l,e,t,a):i(m,y,l,t,e,a);if(!(void 0===w?m===y||s(m,y,r,i,a):w)){p=!1;break}v||(v="constructor"==l)}if(p&&!v){var x=t.constructor,b=e.constructor;x==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof x&&x instanceof x&&"function"==typeof b&&b instanceof b||(p=!1)}return a.delete(t),a.delete(e),p}},4139:(t,e,r)=>{var n=r(7469),o=r(5390),i=r(3232);t.exports=function(t){return i(o(t,void 0,n),t+"")}},1603:(t,e,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;t.exports=n},2573:(t,e,r)=>{var n=r(5920),o=r(9183),i=r(3511);t.exports=function(t){return n(t,i,o)}},3918:(t,e,r)=>{var n=r(5920),o=r(596),i=r(2844);t.exports=function(t){return n(t,i,o)}},1200:(t,e,r)=>{var n=r(95);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},6539:(t,e,r)=>{var n=r(7223),o=r(3511);t.exports=function(t){for(var e=o(t),r=e.length;r--;){var i=e[r],s=t[i];e[r]=[i,s,n(s)]}return e}},4671:(t,e,r)=>{var n=r(4228),o=r(7559);t.exports=function(t,e){var r=o(t,e);return n(r)?r:void 0}},7556:(t,e,r)=>{var n=r(8546)(Object.getPrototypeOf,Object);t.exports=n},9650:(t,e,r)=>{var n=r(9006),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,a=n?n.toStringTag:void 0;t.exports=function(t){var e=i.call(t,a),r=t[a];try{t[a]=void 0;var n=!0}catch(t){}var o=s.call(t);return n&&(e?t[a]=r:delete t[a]),o}},9183:(t,e,r)=>{var n=r(2995),o=r(2982),i=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,a=s?function(t){return null==t?[]:(t=Object(t),n(s(t),(function(e){return i.call(t,e)})))}:o;t.exports=a},596:(t,e,r)=>{var n=r(2525),o=r(7556),i=r(9183),s=r(2982),a=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)n(e,i(t)),t=o(t);return e}:s;t.exports=a},9778:(t,e,r)=>{var n=r(6171),o=r(5870),i=r(4665),s=r(9612),a=r(8154),u=r(5271),h=r(462),d="[object Map]",c="[object Promise]",l="[object Set]",f="[object WeakMap]",g="[object DataView]",p=h(n),v=h(o),m=h(i),y=h(s),w=h(a),x=u;(n&&x(new n(new ArrayBuffer(1)))!=g||o&&x(new o)!=d||i&&x(i.resolve())!=c||s&&x(new s)!=l||a&&x(new a)!=f)&&(x=function(t){var e=u(t),r="[object Object]"==e?t.constructor:void 0,n=r?h(r):"";if(n)switch(n){case p:return g;case v:return d;case m:return c;case y:return l;case w:return f}return e}),t.exports=x},7559:t=>{t.exports=function(t,e){return null==t?void 0:t[e]}},9663:(t,e,r)=>{var n=r(330),o=r(79),i=r(5874),s=r(1908),a=r(4583),u=r(9628);t.exports=function(t,e,r){for(var h=-1,d=(e=n(e,t)).length,c=!1;++h<d;){var l=u(e[h]);if(!(c=null!=t&&r(t,l)))break;t=t[l]}return c||++h!=d?c:!!(d=null==t?0:t.length)&&a(d)&&s(l,d)&&(i(t)||o(t))}},3493:t=>{var e=RegExp("[\\\\u200d\\\\ud800-\\\\udfff\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe2f\\\\u20d0-\\\\u20ff\\\\ufe0e\\\\ufe0f]");t.exports=function(t){return e.test(t)}},2405:(t,e,r)=>{var n=r(8637);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},8341:t=>{t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},9644:(t,e,r)=>{var n=r(8637),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return o.call(e,t)?e[t]:void 0}},3784:(t,e,r)=>{var n=r(8637),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:o.call(e,t)}},6264:(t,e,r)=>{var n=r(8637);t.exports=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},5290:t=>{var e=Object.prototype.hasOwnProperty;t.exports=function(t){var r=t.length,n=new t.constructor(r);return r&&"string"==typeof t[0]&&e.call(t,"index")&&(n.index=t.index,n.input=t.input),n}},4028:(t,e,r)=>{var n=r(9270),o=r(5940),i=r(5320),s=r(4937),a=r(1532);t.exports=function(t,e,r){var u=t.constructor;switch(e){case"[object ArrayBuffer]":return n(t);case"[object Boolean]":case"[object Date]":return new u(+t);case"[object DataView]":return o(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return a(t,r);case"[object Map]":case"[object Set]":return new u;case"[object Number]":case"[object String]":return new u(t);case"[object RegExp]":return i(t);case"[object Symbol]":return s(t)}}},9168:(t,e,r)=>{var n=r(1095),o=r(7556),i=r(7894);t.exports=function(t){return"function"!=typeof t.constructor||i(t)?{}:n(o(t))}},3542:(t,e,r)=>{var n=r(9006),o=r(79),i=r(5874),s=n?n.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(s&&t&&t[s])}},1908:t=>{var e=/^(?:0|[1-9]\\d*)$/;t.exports=function(t,r){var n=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<r}},8819:(t,e,r)=>{var n=r(5097),o=r(3069),i=r(1908),s=r(9400);t.exports=function(t,e,r){if(!s(r))return!1;var a=typeof e;return!!("number"==a?o(r)&&i(e,r.length):"string"==a&&e in r)&&n(r[e],t)}},759:(t,e,r)=>{var n=r(5874),o=r(975),i=/\\.|\\[(?:[^[\\]]*|(["\'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,s=/^\\w*$/;t.exports=function(t,e){if(n(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!o(t))||s.test(t)||!i.test(t)||null!=e&&t in Object(e)}},95:t=>{t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},7827:(t,e,r)=>{var n,o=r(6450),i=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!i&&i in t}},7894:t=>{var e=Object.prototype;t.exports=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}},7223:(t,e,r)=>{var n=r(9400);t.exports=function(t){return t==t&&!n(t)}},6821:t=>{t.exports=function(){this.__data__=[],this.size=0}},7221:(t,e,r)=>{var n=r(9438),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,r=n(e,t);return!(r<0||(r==e.length-1?e.pop():o.call(e,r,1),--this.size,0))}},1596:(t,e,r)=>{var n=r(9438);t.exports=function(t){var e=this.__data__,r=n(e,t);return r<0?void 0:e[r][1]}},1992:(t,e,r)=>{var n=r(9438);t.exports=function(t){return n(this.__data__,t)>-1}},552:(t,e,r)=>{var n=r(9438);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}},4069:(t,e,r)=>{var n=r(6766),o=r(1022),i=r(5870);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},7477:(t,e,r)=>{var n=r(1200);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},476:(t,e,r)=>{var n=r(1200);t.exports=function(t){return n(this,t).get(t)}},984:(t,e,r)=>{var n=r(1200);t.exports=function(t){return n(this,t).has(t)}},4136:(t,e,r)=>{var n=r(1200);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},8866:t=>{t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}},7316:t=>{t.exports=function(t,e){return function(r){return null!=r&&r[t]===e&&(void 0!==e||t in Object(r))}}},2121:(t,e,r)=>{var n=r(8487);t.exports=function(t){var e=n(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}},8637:(t,e,r)=>{var n=r(4671)(Object,"create");t.exports=n},2325:(t,e,r)=>{var n=r(8546)(Object.keys,Object);t.exports=n},5382:t=>{t.exports=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}},6574:(t,e,r)=>{t=r.nmd(t);var n=r(1603),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o&&n.process,a=function(){try{return i&&i.require&&i.require("util").types||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=a},6881:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},8546:t=>{t.exports=function(t,e){return function(r){return t(e(r))}}},5390:(t,e,r)=>{var n=r(7156),o=Math.max;t.exports=function(t,e,r){return e=o(void 0===e?t.length-1:e,0),function(){for(var i=arguments,s=-1,a=o(i.length-e,0),u=Array(a);++s<a;)u[s]=i[e+s];s=-1;for(var h=Array(e+1);++s<e;)h[s]=i[s];return h[e]=r(u),n(t,this,h)}}},714:(t,e,r)=>{var n=r(1603),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},6127:t=>{t.exports=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}},1945:t=>{t.exports=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}},4874:t=>{t.exports=function(t){return this.__data__.has(t)}},6968:t=>{t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}},3232:(t,e,r)=>{var n=r(3431),o=r(1824)(n);t.exports=o},1824:t=>{var e=Date.now;t.exports=function(t){var r=0,n=0;return function(){var o=e(),i=16-(o-n);if(n=o,i>0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}},5331:(t,e,r)=>{var n=r(1022);t.exports=function(){this.__data__=new n,this.size=0}},7063:t=>{t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},134:t=>{t.exports=function(t){return this.__data__.get(t)}},9842:t=>{t.exports=function(t){return this.__data__.has(t)}},9850:(t,e,r)=>{var n=r(1022),o=r(5870),i=r(8910);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var s=r.__data__;if(!o||s.length<199)return s.push([t,e]),this.size=++r.size,this;r=this.__data__=new i(s)}return r.set(t,e),this.size=r.size,this}},638:t=>{t.exports=function(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}},6742:(t,e,r)=>{var n=r(446),o=r(3493),i=r(3870);t.exports=function(t){return o(t)?i(t):n(t)}},9505:(t,e,r)=>{var n=r(2121),o=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g,i=/\\\\(\\\\)?/g,s=n((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(o,(function(t,r,n,o){e.push(n?o.replace(i,"$1"):r||t)})),e}));t.exports=s},9628:(t,e,r)=>{var n=r(975);t.exports=function(t){if("string"==typeof t||n(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}},462:t=>{var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},4997:t=>{var e=/\\s/;t.exports=function(t){for(var r=t.length;r--&&e.test(t.charAt(r)););return r}},3870:t=>{var e="\\\\ud800-\\\\udfff",r="["+e+"]",n="[\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe2f\\\\u20d0-\\\\u20ff]",o="\\\\ud83c[\\\\udffb-\\\\udfff]",i="[^"+e+"]",s="(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}",a="[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]",u="(?:"+n+"|"+o+")?",h="[\\\\ufe0e\\\\ufe0f]?",d=h+u+"(?:\\\\u200d(?:"+[i,s,a].join("|")+")"+h+u+")*",c="(?:"+[i+n+"?",n,s,a,r].join("|")+")",l=RegExp(o+"(?="+o+")|"+c+d,"g");t.exports=function(t){for(var e=l.lastIndex=0;l.test(t);)++e;return e}},5402:(t,e,r)=>{var n=r(9018);t.exports=function(t){return n(t,4)}},9136:(t,e,r)=>{var n=r(9018);t.exports=function(t){return n(t,5)}},8295:t=>{t.exports=function(t){return function(){return t}}},9529:(t,e,r)=>{var n=r(6965),o=r(5097),i=r(8819),s=r(2844),a=Object.prototype,u=a.hasOwnProperty,h=n((function(t,e){t=Object(t);var r=-1,n=e.length,h=n>2?e[2]:void 0;for(h&&i(e[0],e[1],h)&&(n=1);++r<n;)for(var d=e[r],c=s(d),l=-1,f=c.length;++l<f;){var g=c[l],p=t[g];(void 0===p||o(p,a[g])&&!u.call(t,g))&&(t[g]=d[g])}return t}));t.exports=h},958:(t,e,r)=>{t.exports=r(1117)},5097:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},9969:(t,e,r)=>{var n=r(2995),o=r(1329),i=r(4506),s=r(5874);t.exports=function(t,e){return(s(t)?n:o)(t,i(e,3))}},828:(t,e,r)=>{var n=r(6057)(r(8550));t.exports=n},8550:(t,e,r)=>{var n=r(166),o=r(4506),i=r(3758),s=Math.max;t.exports=function(t,e,r){var a=null==t?0:t.length;if(!a)return-1;var u=null==r?0:i(r);return u<0&&(u=s(a+u,0)),n(t,o(e,3),u)}},7469:(t,e,r)=>{var n=r(9821);t.exports=function(t){return null!=t&&t.length?n(t,1):[]}},1117:(t,e,r)=>{var n=r(7012),o=r(830),i=r(4041),s=r(5874);t.exports=function(t,e){return(s(t)?n:o)(t,i(e))}},4519:(t,e,r)=>{var n=r(9128),o=r(4041),i=r(2844);t.exports=function(t,e){return null==t?t:n(t,o(e),i)}},5887:(t,e,r)=>{var n=r(1855);t.exports=function(t,e,r){var o=null==t?void 0:n(t,e);return void 0===o?r:o}},4339:(t,e,r)=>{var n=r(3091),o=r(9663);t.exports=function(t,e){return null!=t&&o(t,e,n)}},4016:(t,e,r)=>{var n=r(5088),o=r(9663);t.exports=function(t,e){return null!=t&&o(t,e,n)}},9169:t=>{t.exports=function(t){return t}},79:(t,e,r)=>{var n=r(4047),o=r(7583),i=Object.prototype,s=i.hasOwnProperty,a=i.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(t){return o(t)&&s.call(t,"callee")&&!a.call(t,"callee")};t.exports=u},5874:t=>{var e=Array.isArray;t.exports=e},3069:(t,e,r)=>{var n=r(7787),o=r(4583);t.exports=function(t){return null!=t&&o(t.length)&&!n(t)}},6882:(t,e,r)=>{var n=r(3069),o=r(7583);t.exports=function(t){return o(t)&&n(t)}},3601:(t,e,r)=>{t=r.nmd(t);var n=r(714),o=r(6408),i=e&&!e.nodeType&&e,s=i&&t&&!t.nodeType&&t,a=s&&s.exports===i?n.Buffer:void 0,u=(a?a.isBuffer:void 0)||o;t.exports=u},2046:(t,e,r)=>{var n=r(5351),o=r(9778),i=r(79),s=r(5874),a=r(3069),u=r(3601),h=r(7894),d=r(9046),c=Object.prototype.hasOwnProperty;t.exports=function(t){if(null==t)return!0;if(a(t)&&(s(t)||"string"==typeof t||"function"==typeof t.splice||u(t)||d(t)||i(t)))return!t.length;var e=o(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(h(t))return!n(t).length;for(var r in t)if(c.call(t,r))return!1;return!0}},7787:(t,e,r)=>{var n=r(5271),o=r(9400);t.exports=function(t){if(!o(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},4583:t=>{t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},4725:(t,e,r)=>{var n=r(4965),o=r(8232),i=r(6574),s=i&&i.isMap,a=s?o(s):n;t.exports=a},9400:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},7583:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},4108:(t,e,r)=>{var n=r(5271),o=r(7556),i=r(7583),s=Function.prototype,a=Object.prototype,u=s.toString,h=a.hasOwnProperty,d=u.call(Object);t.exports=function(t){if(!i(t)||"[object Object]"!=n(t))return!1;var e=o(t);if(null===e)return!0;var r=h.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&u.call(r)==d}},7363:(t,e,r)=>{var n=r(6499),o=r(8232),i=r(6574),s=i&&i.isSet,a=s?o(s):n;t.exports=a},7462:(t,e,r)=>{var n=r(5271),o=r(5874),i=r(7583);t.exports=function(t){return"string"==typeof t||!o(t)&&i(t)&&"[object String]"==n(t)}},975:(t,e,r)=>{var n=r(5271),o=r(7583);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==n(t)}},9046:(t,e,r)=>{var n=r(550),o=r(8232),i=r(6574),s=i&&i.isTypedArray,a=s?o(s):n;t.exports=a},2895:t=>{t.exports=function(t){return void 0===t}},3511:(t,e,r)=>{var n=r(9754),o=r(5351),i=r(3069);t.exports=function(t){return i(t)?n(t):o(t)}},2844:(t,e,r)=>{var n=r(9754),o=r(1500),i=r(3069);t.exports=function(t){return i(t)?n(t,!0):o(t)}},5179:t=>{t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},9629:(t,e,r)=>{var n=r(2275),o=r(4506),i=r(4733),s=r(5874);t.exports=function(t,e){return(s(t)?n:i)(t,o(e,3))}},5551:(t,e,r)=>{var n=r(3077),o=r(7702),i=r(4506);t.exports=function(t,e){var r={};return e=i(e,3),o(t,(function(t,o,i){n(r,o,e(t,o,i))})),r}},4213:(t,e,r)=>{var n=r(5816),o=r(4116),i=r(9169);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},8487:(t,e,r)=>{var n=r(8910);function o(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var s=t.apply(this,n);return r.cache=i.set(o,s)||i,s};return r.cache=new(o.Cache||n),r}o.Cache=n,t.exports=o},2495:(t,e,r)=>{var n=r(4479),o=r(1292)((function(t,e,r){n(t,e,r)}));t.exports=o},9903:(t,e,r)=>{var n=r(5816),o=r(2795),i=r(9169);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},3262:(t,e,r)=>{var n=r(5816),o=r(4506),i=r(2795);t.exports=function(t,e){return t&&t.length?n(t,o(e,2),i):void 0}},3883:t=>{t.exports=function(){}},8835:(t,e,r)=>{var n=r(714);t.exports=function(){return n.Date.now()}},222:(t,e,r)=>{var n=r(4286),o=r(4139)((function(t,e){return null==t?{}:n(t,e)}));t.exports=o},6830:(t,e,r)=>{var n=r(8494),o=r(3644),i=r(759),s=r(9628);t.exports=function(t){return i(t)?n(s(t)):o(t)}},4978:(t,e,r)=>{var n=r(4590)();t.exports=n},9285:(t,e,r)=>{var n=r(8663),o=r(830),i=r(4506),s=r(8421),a=r(5874);t.exports=function(t,e,r){var u=a(t)?n:s,h=arguments.length<3;return u(t,i(e,4),r,h,o)}},3910:(t,e,r)=>{var n=r(5351),o=r(9778),i=r(3069),s=r(7462),a=r(6742);t.exports=function(t){if(null==t)return 0;if(i(t))return s(t)?a(t):t.length;var e=o(t);return"[object Map]"==e||"[object Set]"==e?t.size:n(t).length}},5246:(t,e,r)=>{var n=r(9821),o=r(9586),i=r(6965),s=r(8819),a=i((function(t,e){if(null==t)return[];var r=e.length;return r>1&&s(t,e[0],e[1])?e=[]:r>2&&s(e[0],e[1],e[2])&&(e=[e[0]]),o(t,n(e,1),[])}));t.exports=a},2982:t=>{t.exports=function(){return[]}},6408:t=>{t.exports=function(){return!1}},8265:(t,e,r)=>{var n=r(7639),o=1/0;t.exports=function(t){return t?(t=n(t))===o||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}},3758:(t,e,r)=>{var n=r(8265);t.exports=function(t){var e=n(t),r=e%1;return e==e?r?e-r:e:0}},7639:(t,e,r)=>{var n=r(5103),o=r(9400),i=r(975),s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,h=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return NaN;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=n(t);var r=a.test(t);return r||u.test(t)?h(t.slice(2),r?2:8):s.test(t)?NaN:+t}},339:(t,e,r)=>{var n=r(5532),o=r(2844);t.exports=function(t){return n(t,o(t))}},983:(t,e,r)=>{var n=r(8071);t.exports=function(t){return null==t?"":n(t)}},3279:(t,e,r)=>{var n=r(7012),o=r(1095),i=r(7702),s=r(4506),a=r(7556),u=r(5874),h=r(3601),d=r(7787),c=r(9400),l=r(9046);t.exports=function(t,e,r){var f=u(t),g=f||h(t)||l(t);if(e=s(e,4),null==r){var p=t&&t.constructor;r=g?f?new p:[]:c(t)&&d(p)?o(a(t)):{}}return(g?n:i)(t,(function(t,n,o){return e(r,t,n,o)})),r}},3344:(t,e,r)=>{var n=r(9821),o=r(6965),i=r(3434),s=r(6882),a=o((function(t){return i(n(t,1,s,!0))}));t.exports=a},761:(t,e,r)=>{var n=r(983),o=0;t.exports=function(t){var e=++o;return n(t)+e}},3005:(t,e,r)=>{var n=r(989),o=r(3511);t.exports=function(t){return null==t?[]:n(t,o(t))}},3679:(t,e,r)=>{var n=r(5802),o=r(2543);t.exports=function(t,e){return o(t||[],e||[],n)}},412:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>o});var n=r(5229);function o(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==r.output){if(!(0,n.isAnyArray)(r.output))throw new TypeError("output option must be an array if specified");e=r.output}else e=new Array(t.length);var o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,o=void 0===r?0:r,i=e.toIndex,s=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=o||s>t.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[o],u=o+1;u<s;u++)t[u]<a&&(a=t[u]);return a}(t),i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,o=void 0===r?0:r,i=e.toIndex,s=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=o||s>t.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[o],u=o+1;u<s;u++)t[u]>a&&(a=t[u]);return a}(t);if(o===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var s=r.min,a=void 0===s?r.autoMinMax?o:0:s,u=r.max,h=void 0===u?r.autoMinMax?i:1:u;if(a>=h)throw new RangeError("min option must be smaller than max option");for(var d=(h-a)/(i-o),c=0;c<t.length;c++)e[c]=(t[c]-o)*d+a;return e}},8917:(t,e,r)=>{"use strict";var n=r(5229),o=r(412);const i=" ".repeat(2),s=" ".repeat(4);function a(t,e={}){const{maxRows:r=15,maxColumns:n=10,maxNumSize:o=8,padMinus:a="auto"}=e;return`${t.constructor.name} {\\n${i}[\\n${s}${function(t,e,r,n,o){const{rows:i,columns:a}=t,h=Math.min(i,e),d=Math.min(a,r),c=[];if("auto"===o){o=!1;t:for(let e=0;e<h;e++)for(let r=0;r<d;r++)if(t.get(e,r)<0){o=!0;break t}}for(let e=0;e<h;e++){let r=[];for(let i=0;i<d;i++)r.push(u(t.get(e,i),n,o));c.push(`${r.join(" ")}`)}return d!==a&&(c[c.length-1]+=` ... ${a-r} more columns`),h!==i&&c.push(`... ${i-e} more rows`),c.join(`\\n${s}`)}(t,r,n,o,a)}\\n${i}]\\n${i}rows: ${t.rows}\\n${i}columns: ${t.columns}\\n}`}function u(t,e,r){return(t>=0&&r?` ${h(t,e-1)}`:h(t,e)).padEnd(e)}function h(t,e){let r=t.toString();if(r.length<=e)return r;let n=t.toFixed(e);if(n.length>e&&(n=t.toFixed(Math.max(0,e-(n.length-e)))),n.length<=e&&!n.startsWith("0.000")&&!n.startsWith("-0.000"))return n;let o=t.toExponential(e);return o.length>e&&(o=t.toExponential(Math.max(0,e-(o.length-e)))),o.slice(0)}function d(t,e,r){let n=r?t.rows:t.rows-1;if(e<0||e>n)throw new RangeError("Row index out of range")}function c(t,e,r){let n=r?t.columns:t.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function l(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function f(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function g(t,e){if(!n.isAnyArray(e))throw new TypeError("row indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.rows)throw new RangeError("row indices are out of range")}function p(t,e){if(!n.isAnyArray(e))throw new TypeError("column indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.columns)throw new RangeError("column indices are out of range")}function v(t,e,r,n,o){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(y("startRow",e),y("endRow",r),y("startColumn",n),y("endColumn",o),e>r||n>o||e<0||e>=t.rows||r<0||r>=t.rows||n<0||n>=t.columns||o<0||o>=t.columns)throw new RangeError("Submatrix indices are out of range")}function m(t,e=0){let r=[];for(let n=0;n<t;n++)r.push(e);return r}function y(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function w(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class x{static from1DArray(t,e,r){if(t*e!==r.length)throw new RangeError("data length does not match given dimensions");let n=new E(t,e);for(let o=0;o<t;o++)for(let t=0;t<e;t++)n.set(o,t,r[o*e+t]);return n}static rowVector(t){let e=new E(1,t.length);for(let r=0;r<t.length;r++)e.set(0,r,t[r]);return e}static columnVector(t){let e=new E(t.length,1);for(let r=0;r<t.length;r++)e.set(r,0,t[r]);return e}static zeros(t,e){return new E(t,e)}static ones(t,e){return new E(t,e).fill(1)}static rand(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{random:n=Math.random}=r;let o=new E(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)o.set(r,t,n());return o}static randInt(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{min:n=0,max:o=1e3,random:i=Math.random}=r;if(!Number.isInteger(n))throw new TypeError("min must be an integer");if(!Number.isInteger(o))throw new TypeError("max must be an integer");if(n>=o)throw new RangeError("min must be smaller than max");let s=o-n,a=new E(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++){let e=n+Math.round(i()*s);a.set(r,t,e)}return a}static eye(t,e,r){void 0===e&&(e=t),void 0===r&&(r=1);let n=Math.min(t,e),o=this.zeros(t,e);for(let t=0;t<n;t++)o.set(t,t,r);return o}static diag(t,e,r){let n=t.length;void 0===e&&(e=n),void 0===r&&(r=e);let o=Math.min(n,e,r),i=this.zeros(e,r);for(let e=0;e<o;e++)i.set(e,e,t[e]);return i}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new E(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.min(t.get(i,r),e.get(i,r)));return o}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new this(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.max(t.get(i,r),e.get(i,r)));return o}static checkMatrix(t){return x.isMatrix(t)?t:new E(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.call(this,e,r);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.push(this.get(e,r));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let r=0;r<this.columns;r++)t[e].push(this.get(e,r))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let t=0;t<this.rows;t++)if(0!==this.get(t,t))return!1;return!0}isEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);t++}return n}isReducedEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);for(let r=e+1;r<this.rows;r++)0!==this.get(t,r)&&(n=!1);t++}return n}echelonForm(){let t=this.clone(),e=0,r=0;for(;e<t.rows&&r<t.columns;){let n=e;for(let o=e;o<t.rows;o++)t.get(o,r)>t.get(n,r)&&(n=o);if(0===t.get(n,r))r++;else{t.swapRows(e,n);let o=t.get(e,r);for(let n=r;n<t.columns;n++)t.set(e,n,t.get(e,n)/o);for(let n=e+1;n<t.rows;n++){let o=t.get(n,r)/t.get(e,r);t.set(n,r,0);for(let i=r+1;i<t.columns;i++)t.set(n,i,t.get(n,i)-t.get(e,i)*o)}e++,r++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,r=t.rows,n=r-1;for(;n>=0;)if(0===t.maxRow(n))n--;else{let o=0,i=!1;for(;o<r&&!1===i;)1===t.get(n,o)?i=!0:o++;for(let r=0;r<n;r++){let i=t.get(r,o);for(let s=o;s<e;s++){let e=t.get(r,s)-i*t.get(n,s);t.set(r,s,e)}}n--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:r=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(r)||r<=0)throw new TypeError("columns must be a positive integer");let n=new E(this.rows*e,this.columns*r);for(let t=0;t<e;t++)for(let e=0;e<r;e++)n.setSubMatrix(this,this.rows*t,this.columns*e);return n}fill(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,t);return this}neg(){return this.mulS(-1)}getRow(t){d(this,t);let e=[];for(let r=0;r<this.columns;r++)e.push(this.get(t,r));return e}getRowVector(t){return E.rowVector(this.getRow(t))}setRow(t,e){d(this,t),e=l(this,e);for(let r=0;r<this.columns;r++)this.set(t,r,e[r]);return this}swapRows(t,e){d(this,t),d(this,e);for(let r=0;r<this.columns;r++){let n=this.get(t,r);this.set(t,r,this.get(e,r)),this.set(e,r,n)}return this}getColumn(t){c(this,t);let e=[];for(let r=0;r<this.rows;r++)e.push(this.get(r,t));return e}getColumnVector(t){return E.columnVector(this.getColumn(t))}setColumn(t,e){c(this,t),e=f(this,e);for(let r=0;r<this.rows;r++)this.set(r,t,e[r]);return this}swapColumns(t,e){c(this,t),c(this,e);for(let r=0;r<this.rows;r++){let n=this.get(r,t);this.set(r,t,this.get(r,e)),this.set(r,e,n)}return this}addRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[r]);return this}subRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[r]);return this}mulRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[r]);return this}divRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[r]);return this}addColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[e]);return this}subColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[e]);return this}mulColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[e]);return this}divColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[e]);return this}mulRow(t,e){d(this,t);for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e);return this}mulColumn(t,e){c(this,t);for(let r=0;r<this.rows;r++)this.set(r,t,this.get(r,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){w(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){w(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}maxRow(t){if(d(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r));return e}maxRowIndex(t){d(this,t),w(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n),r[1]=n);return r}minRow(t){if(d(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r));return e}minRowIndex(t){d(this,t),w(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n),r[1]=n);return r}maxColumn(t){if(c(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t));return e}maxColumnIndex(t){c(this,t),w(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t),r[0]=n);return r}minColumn(t){if(c(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t));return e}minColumnIndex(t){c(this,t),w(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t),r[0]=n);return r}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let r=0;r<t;r++)e.push(this.get(r,r));return e}norm(t="frobenius"){switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${t}`)}}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t+=this.get(e,r),this.set(e,r,t);return this}dot(t){x.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let r=0;for(let n=0;n<e.length;n++)r+=e[n]*t[n];return r}mmul(t){t=E.checkMatrix(t);let e=this.rows,r=this.columns,n=t.columns,o=new E(e,n),i=new Float64Array(r);for(let s=0;s<n;s++){for(let e=0;e<r;e++)i[e]=t.get(e,s);for(let t=0;t<e;t++){let e=0;for(let n=0;n<r;n++)e+=this.get(t,n)*i[n];o.set(t,s,e)}}return o}strassen2x2(t){t=E.checkMatrix(t);let e=new E(2,2);const r=this.get(0,0),n=t.get(0,0),o=this.get(0,1),i=t.get(0,1),s=this.get(1,0),a=t.get(1,0),u=this.get(1,1),h=t.get(1,1),d=(r+u)*(n+h),c=(s+u)*n,l=r*(i-h),f=u*(a-n),g=(r+o)*h,p=d+f-g+(o-u)*(a+h),v=l+g,m=c+f,y=d-c+l+(s-r)*(n+i);return e.set(0,0,p),e.set(0,1,v),e.set(1,0,m),e.set(1,1,y),e}strassen3x3(t){t=E.checkMatrix(t);let e=new E(3,3);const r=this.get(0,0),n=this.get(0,1),o=this.get(0,2),i=this.get(1,0),s=this.get(1,1),a=this.get(1,2),u=this.get(2,0),h=this.get(2,1),d=this.get(2,2),c=t.get(0,0),l=t.get(0,1),f=t.get(0,2),g=t.get(1,0),p=t.get(1,1),v=t.get(1,2),m=t.get(2,0),y=t.get(2,1),w=t.get(2,2),x=(r-i)*(-l+p),b=(-r+i+s)*(c-l+p),N=(i+s)*(-c+l),M=r*c,_=(-r+u+h)*(c-f+v),k=(-r+u)*(f-v),A=(u+h)*(-c+f),j=(-o+h+d)*(p+m-y),S=(o-d)*(p-y),O=o*m,z=(h+d)*(-m+y),R=(-o+s+a)*(v+m-w),I=(o-a)*(v-w),C=(s+a)*(-m+w),D=M+O+n*g,P=(r+n+o-i-s-h-d)*p+b+N+M+j+O+z,T=M+_+A+(r+n+o-s-a-u-h)*v+O+R+C,L=x+s*(-c+l+g-p-v-m+w)+b+M+O+R+I,F=x+b+N+M+a*y,q=O+R+I+C+i*f,V=M+_+k+h*(-c+f+g-p-v-m+y)+j+S+O,B=j+S+O+z+u*l,$=M+_+k+A+d*w;return e.set(0,0,D),e.set(0,1,P),e.set(0,2,T),e.set(1,0,L),e.set(1,1,F),e.set(1,2,q),e.set(2,0,V),e.set(2,1,B),e.set(2,2,$),e}mmulStrassen(t){t=E.checkMatrix(t);let e=this.clone(),r=e.rows,n=e.columns,o=t.rows,i=t.columns;function s(t,e,r){let n=t.rows,o=t.columns;if(n===e&&o===r)return t;{let n=x.zeros(e,r);return n=n.setSubMatrix(t,0,0),n}}n!==o&&console.warn(`Multiplying ${r} x ${n} and ${o} x ${i} matrix: dimensions do not match.`);let a=Math.max(r,o),u=Math.max(n,i);return e=s(e,a,u),function t(e,r,n,o){if(n<=512||o<=512)return e.mmul(r);n%2==1&&o%2==1?(e=s(e,n+1,o+1),r=s(r,n+1,o+1)):n%2==1?(e=s(e,n+1,o),r=s(r,n+1,o)):o%2==1&&(e=s(e,n,o+1),r=s(r,n,o+1));let i=parseInt(e.rows/2,10),a=parseInt(e.columns/2,10),u=e.subMatrix(0,i-1,0,a-1),h=r.subMatrix(0,i-1,0,a-1),d=e.subMatrix(0,i-1,a,e.columns-1),c=r.subMatrix(0,i-1,a,r.columns-1),l=e.subMatrix(i,e.rows-1,0,a-1),f=r.subMatrix(i,r.rows-1,0,a-1),g=e.subMatrix(i,e.rows-1,a,e.columns-1),p=r.subMatrix(i,r.rows-1,a,r.columns-1),v=t(x.add(u,g),x.add(h,p),i,a),m=t(x.add(l,g),h,i,a),y=t(u,x.sub(c,p),i,a),w=t(g,x.sub(f,h),i,a),b=t(x.add(u,d),p,i,a),E=t(x.sub(l,u),x.add(h,c),i,a),N=t(x.sub(d,g),x.add(f,p),i,a),M=x.add(v,w);M.sub(b),M.add(N);let _=x.add(y,b),k=x.add(m,w),A=x.sub(v,m);A.add(y),A.add(E);let j=x.zeros(2*M.rows,2*M.columns);return j=j.setSubMatrix(M,0,0),j=j.setSubMatrix(_,M.rows,0),j=j.setSubMatrix(k,0,M.columns),j=j.setSubMatrix(A,M.rows,M.columns),j.subMatrix(0,n-1,0,o-1)}(e,t=s(t,a,u),a,u)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new E(this.rows,this.columns);for(let t=0;t<this.rows;t++){const i=this.getRow(t);i.length>0&&o(i,{min:e,max:r,output:i}),n.setRow(t,i)}return n}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new E(this.rows,this.columns);for(let t=0;t<this.columns;t++){const i=this.getColumn(t);i.length&&o(i,{min:e,max:r,output:i}),n.setColumn(t,i)}return n}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let r=0;r<t;r++){let t=this.get(e,r),n=this.get(e,this.columns-1-r);this.set(e,r,n),this.set(e,this.columns-1-r,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let r=0;r<t;r++){let t=this.get(r,e),n=this.get(this.rows-1-r,e);this.set(r,e,n),this.set(this.rows-1-r,e,t)}return this}kroneckerProduct(t){t=E.checkMatrix(t);let e=this.rows,r=this.columns,n=t.rows,o=t.columns,i=new E(e*n,r*o);for(let s=0;s<e;s++)for(let e=0;e<r;e++)for(let r=0;r<n;r++)for(let a=0;a<o;a++)i.set(n*s+r,o*e+a,this.get(s,e)*t.get(r,a));return i}kroneckerSum(t){if(t=E.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,r=t.rows,n=this.kroneckerProduct(E.eye(r,r)),o=E.eye(e,e).kroneckerProduct(t);return n.add(o)}transpose(){let t=new E(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(r,e,this.get(e,r));return t}sortRows(t=b){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=b){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,r,n){v(this,t,e,r,n);let o=new E(e-t+1,n-r+1);for(let i=t;i<=e;i++)for(let e=r;e<=n;e++)o.set(i-t,e-r,this.get(i,e));return o}subMatrixRow(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.columns-1),e>r||e<0||e>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");let n=new E(t.length,r-e+1);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.rows)throw new RangeError(`Row index out of range: ${t[o]}`);n.set(o,i-e,this.get(t[o],i))}return n}subMatrixColumn(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.rows-1),e>r||e<0||e>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");let n=new E(r-e+1,t.length);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.columns)throw new RangeError(`Column index out of range: ${t[o]}`);n.set(i-e,o,this.get(i,t[o]))}return n}setSubMatrix(t,e,r){if((t=E.checkMatrix(t)).isEmpty())return this;v(this,e,e+t.rows-1,r,r+t.columns-1);for(let n=0;n<t.rows;n++)for(let o=0;o<t.columns;o++)this.set(e+n,r+o,t.get(n,o));return this}selection(t,e){g(this,t),p(this,e);let r=new E(t.length,e.length);for(let n=0;n<t.length;n++){let o=t[n];for(let t=0;t<e.length;t++){let i=e[t];r.set(n,t,this.get(o,i))}}return r}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let r=0;r<t;r++)e+=this.get(r,r);return e}clone(){return this.constructor.copy(this,new E(this.rows,this.columns))}static copy(t,e){for(const[r,n,o]of t.entries())e.set(r,n,o);return e}sum(t){switch(t){case"row":return function(t){let e=m(t.rows);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]+=t.get(r,n);return e}(this);case"column":return function(t){let e=m(t.columns);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]+=t.get(r,n);return e}(this);case void 0:return function(t){let e=0;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e+=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=m(t.rows,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]*=t.get(r,n);return e}(this);case"column":return function(t){let e=m(t.columns,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]*=t.get(r,n);return e}(this);case void 0:return function(t){let e=1;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e*=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{unbiased:r=!0,mean:o=this.mean(t)}=e;if("boolean"!=typeof r)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!n.isAnyArray(o))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let s=0;s<n;s++){let n=0,a=0,u=0;for(let e=0;e<o;e++)u=t.get(s,e)-r[s],n+=u,a+=u*u;e?i.push((a-n*n/o)/(o-1)):i.push((a-n*n/o)/o)}return i}(this,r,o);case"column":if(!n.isAnyArray(o))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let s=0;s<o;s++){let o=0,a=0,u=0;for(let e=0;e<n;e++)u=t.get(e,s)-r[s],o+=u,a+=u*u;e?i.push((a-o*o/n)/(n-1)):i.push((a-o*o/n)/n)}return i}(this,r,o);case void 0:if("number"!=typeof o)throw new TypeError("mean must be a number");return function(t,e,r){const n=t.rows,o=t.columns,i=n*o;let s=0,a=0,u=0;for(let e=0;e<n;e++)for(let n=0;n<o;n++)u=t.get(e,n)-r,s+=u,a+=u*u;return e?(a-s*s/i)/(i-1):(a-s*s/i)/i}(this,r,o);default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const r=this.variance(t,e);if(void 0===t)return Math.sqrt(r);for(let t=0;t<r.length;t++)r[t]=Math.sqrt(r[t]);return r}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{center:r=this.mean(t)}=e;switch(t){case"row":if(!n.isAnyArray(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[r])}(this,r),this;case"column":if(!n.isAnyArray(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[n])}(this,r),this;case void 0:if("number"!=typeof r)throw new TypeError("center must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");let r=e.scale;switch(t){case"row":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.rows;r++){let n=0;for(let e=0;e<t.columns;e++)n+=Math.pow(t.get(r,e),2)/(t.columns-1);e.push(Math.sqrt(n))}return e}(this);else if(!n.isAnyArray(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[r])}(this,r),this;case"column":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.columns;r++){let n=0;for(let e=0;e<t.rows;e++)n+=Math.pow(t.get(e,r),2)/(t.rows-1);e.push(Math.sqrt(n))}return e}(this);else if(!n.isAnyArray(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[n])}(this,r),this;case void 0:if(void 0===r)r=function(t){const e=t.size-1;let r=0;for(let n=0;n<t.columns;n++)for(let o=0;o<t.rows;o++)r+=Math.pow(t.get(o,n),2)/e;return Math.sqrt(r)}(this);else if("number"!=typeof r)throw new TypeError("scale must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}toString(t){return a(this,t)}[Symbol.iterator](){return this.entries()}*entries(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield[t,e,this.get(t,e)]}*values(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield this.get(t,e)}}function b(t,e){return t-e}x.prototype.klass="Matrix","undefined"!=typeof Symbol&&(x.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return a(this)}),x.random=x.rand,x.randomInt=x.randInt,x.diagonal=x.diag,x.prototype.diagonal=x.prototype.diag,x.identity=x.eye,x.prototype.negate=x.prototype.neg,x.prototype.tensorProduct=x.prototype.kroneckerProduct;class E extends x{data;#t(t,e){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let r=0;r<t;r++)this.data.push(new Float64Array(e));this.rows=t,this.columns=e}constructor(t,e){if(super(),E.isMatrix(t))this.#t(t.rows,t.columns),E.copy(t,this);else if(Number.isInteger(t)&&t>=0)this.#t(t,e);else{if(!n.isAnyArray(t))throw new TypeError("First argument must be a positive number or an array");{const r=t;if("number"!=typeof(e=(t=r.length)?r[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let n=0;n<t;n++){if(r[n].length!==e)throw new RangeError("Inconsistent array dimensions");if(!r[n].every((t=>"number"==typeof t)))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(r[n]))}this.rows=t,this.columns=e}}}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}removeRow(t){return d(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),d(this,t,!0),e=Float64Array.from(l(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){c(this,t);for(let e=0;e<this.rows;e++){const r=new Float64Array(this.columns-1);for(let n=0;n<t;n++)r[n]=this.data[e][n];for(let n=t+1;n<this.columns;n++)r[n-1]=this.data[e][n];this.data[e]=r}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),c(this,t,!0),e=f(this,e);for(let r=0;r<this.rows;r++){const n=new Float64Array(this.columns+1);let o=0;for(;o<t;o++)n[o]=this.data[r][o];for(n[o++]=e[r];o<this.columns+1;o++)n[o]=this.data[r][o-1];this.data[r]=n}return this.columns+=1,this}}!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t.get(e,r));return this},t.add=function(t,r){return new e(t).add(r)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t.get(e,r));return this},t.sub=function(t,r){return new e(t).sub(r)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t.get(e,r));return this},t.mul=function(t,r){return new e(t).mul(r)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t.get(e,r));return this},t.div=function(t,r){return new e(t).div(r)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t.get(e,r));return this},t.mod=function(t,r){return new e(t).mod(r)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t.get(e,r));return this},t.and=function(t,r){return new e(t).and(r)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t.get(e,r));return this},t.or=function(t,r){return new e(t).or(r)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t.get(e,r));return this},t.xor=function(t,r){return new e(t).xor(r)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t.get(e,r));return this},t.leftShift=function(t,r){return new e(t).leftShift(r)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t.get(e,r));return this},t.signPropagatingRightShift=function(t,r){return new e(t).signPropagatingRightShift(r)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t.get(e,r));return this},t.rightShift=function(t,r){return new e(t).rightShift(r)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,r){return new e(t).pow(r)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t));return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t.get(e,r)));return this}}(x,E);class N extends x{#e;get size(){return this.#e.size}get rows(){return this.#e.rows}get columns(){return this.#e.columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(t){return E.isMatrix(t)&&"SymmetricMatrix"===t.klassType}static zeros(t){return new this(t)}static ones(t){return new this(t).fill(1)}constructor(t){if(super(),E.isMatrix(t)){if(!t.isSymmetric())throw new TypeError("not symmetric data");this.#e=E.copy(t,new E(t.rows,t.rows))}else if(Number.isInteger(t)&&t>=0)this.#e=new E(t,t);else if(this.#e=new E(t),!this.isSymmetric())throw new TypeError("not symmetric data")}clone(){const t=new N(this.diagonalSize);for(const[e,r,n]of this.upperRightEntries())t.set(e,r,n);return t}toMatrix(){return new E(this)}get(t,e){return this.#e.get(t,e)}set(t,e,r){return this.#e.set(t,e,r),this.#e.set(e,t,r),this}removeCross(t){return this.#e.removeRow(t),this.#e.removeColumn(t),this}addCross(t,e){void 0===e&&(e=t,t=this.diagonalSize);const r=e.slice();return r.splice(t,1),this.#e.addRow(t,r),this.#e.addColumn(t,e),this}applyMask(t){if(t.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const e=[];for(const[r,n]of t.entries())n||e.push(r);e.reverse();for(const t of e)this.removeCross(t);return this}toCompact(){const{diagonalSize:t}=this,e=new Array(t*(t+1)/2);for(let r=0,n=0,o=0;o<e.length;o++)e[o]=this.get(n,r),++r>=t&&(r=++n);return e}static fromCompact(t){const e=t.length,r=(Math.sqrt(8*e+1)-1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(t)}`);const n=new N(r);for(let o=0,i=0,s=0;s<e;s++)n.set(o,i,t[s]),++o>=r&&(o=++i);return n}*upperRightEntries(){for(let t=0,e=0;t<this.diagonalSize;void 0){const r=this.get(t,e);yield[t,e,r],++e>=this.diagonalSize&&(e=++t)}}*upperRightValues(){for(let t=0,e=0;t<this.diagonalSize;void 0){const r=this.get(t,e);yield r,++e>=this.diagonalSize&&(e=++t)}}}N.prototype.klassType="SymmetricMatrix";class M extends N{static isDistanceMatrix(t){return N.isSymmetricMatrix(t)&&"DistanceMatrix"===t.klassSubType}constructor(t){if(super(t),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(t,e,r){return t===e&&(r=0),super.set(t,e,r)}addCross(t,e){return void 0===e&&(e=t,t=this.diagonalSize),(e=e.slice())[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new N(this)}clone(){const t=new M(this.diagonalSize);for(const[e,r,n]of this.upperRightEntries())e!==r&&t.set(e,r,n);return t}toCompact(){const{diagonalSize:t}=this,e=new Array((t-1)*t/2);for(let r=1,n=0,o=0;o<e.length;o++)e[o]=this.get(n,r),++r>=t&&(r=1+ ++n);return e}static fromCompact(t){const e=t.length,r=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(t)}`);const n=new this(r);for(let o=1,i=0,s=0;s<e;s++)n.set(o,i,t[s]),++o>=r&&(o=1+ ++i);return n}}M.prototype.klassSubType="DistanceMatrix";class _ extends x{constructor(t,e,r){super(),this.matrix=t,this.rows=e,this.columns=r}}class k extends _{constructor(t,e,r){g(t,e),p(t,r),super(t,e.length,r.length),this.rowIndices=e,this.columnIndices=r}set(t,e,r){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],r),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class A extends x{constructor(t,e={}){const{rows:r=1}=e;if(t.length%r!=0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=r,this.columns=t.length/r,this.data=t}set(t,e,r){let n=this._calculateIndex(t,e);return this.data[n]=r,this}get(t,e){let r=this._calculateIndex(t,e);return this.data[r]}_calculateIndex(t,e){return t*this.columns+e}}class j extends x{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}}class S{constructor(t){let e,r,n,o,i,s,a,u,h,d=(t=j.checkMatrix(t)).clone(),c=d.rows,l=d.columns,f=new Float64Array(c),g=1;for(e=0;e<c;e++)f[e]=e;for(u=new Float64Array(c),r=0;r<l;r++){for(e=0;e<c;e++)u[e]=d.get(e,r);for(e=0;e<c;e++){for(h=Math.min(e,r),i=0,n=0;n<h;n++)i+=d.get(e,n)*u[n];u[e]-=i,d.set(e,r,u[e])}for(o=r,e=r+1;e<c;e++)Math.abs(u[e])>Math.abs(u[o])&&(o=e);if(o!==r){for(n=0;n<l;n++)s=d.get(o,n),d.set(o,n,d.get(r,n)),d.set(r,n,s);a=f[o],f[o]=f[r],f[r]=a,g=-g}if(r<c&&0!==d.get(r,r))for(e=r+1;e<c;e++)d.set(e,r,d.get(e,r)/d.get(r,r))}this.LU=d,this.pivotVector=f,this.pivotSign=g}isSingular(){let t=this.LU,e=t.columns;for(let r=0;r<e;r++)if(0===t.get(r,r))return!0;return!1}solve(t){t=E.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let r,n,o,i=t.columns,s=t.subMatrixRow(this.pivotVector,0,i-1),a=e.columns;for(o=0;o<a;o++)for(r=o+1;r<a;r++)for(n=0;n<i;n++)s.set(r,n,s.get(r,n)-s.get(o,n)*e.get(r,o));for(o=a-1;o>=0;o--){for(n=0;n<i;n++)s.set(o,n,s.get(o,n)/e.get(o,o));for(r=0;r<o;r++)for(n=0;n<i;n++)s.set(r,n,s.get(r,n)-s.get(o,n)*e.get(r,o))}return s}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,r=t.columns;for(let n=0;n<r;n++)e*=t.get(n,n);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,n=new E(e,r);for(let o=0;o<e;o++)for(let e=0;e<r;e++)o>e?n.set(o,e,t.get(o,e)):o===e?n.set(o,e,1):n.set(o,e,0);return n}get upperTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,n=new E(e,r);for(let o=0;o<e;o++)for(let e=0;e<r;e++)o<=e?n.set(o,e,t.get(o,e)):n.set(o,e,0);return n}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function O(t,e){let r=0;return Math.abs(t)>Math.abs(e)?(r=e/t,Math.abs(t)*Math.sqrt(1+r*r)):0!==e?(r=t/e,Math.abs(e)*Math.sqrt(1+r*r)):0}class z{constructor(t){let e,r,n,o,i=(t=j.checkMatrix(t)).clone(),s=t.rows,a=t.columns,u=new Float64Array(a);for(n=0;n<a;n++){let t=0;for(e=n;e<s;e++)t=O(t,i.get(e,n));if(0!==t){for(i.get(n,n)<0&&(t=-t),e=n;e<s;e++)i.set(e,n,i.get(e,n)/t);for(i.set(n,n,i.get(n,n)+1),r=n+1;r<a;r++){for(o=0,e=n;e<s;e++)o+=i.get(e,n)*i.get(e,r);for(o=-o/i.get(n,n),e=n;e<s;e++)i.set(e,r,i.get(e,r)+o*i.get(e,n))}}u[n]=-t}this.QR=i,this.Rdiag=u}solve(t){t=E.checkMatrix(t);let e=this.QR,r=e.rows;if(t.rows!==r)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let n,o,i,s,a=t.columns,u=t.clone(),h=e.columns;for(i=0;i<h;i++)for(o=0;o<a;o++){for(s=0,n=i;n<r;n++)s+=e.get(n,i)*u.get(n,o);for(s=-s/e.get(i,i),n=i;n<r;n++)u.set(n,o,u.get(n,o)+s*e.get(n,i))}for(i=h-1;i>=0;i--){for(o=0;o<a;o++)u.set(i,o,u.get(i,o)/this.Rdiag[i]);for(n=0;n<i;n++)for(o=0;o<a;o++)u.set(n,o,u.get(n,o)-u.get(i,o)*e.get(n,i))}return u.subMatrix(0,h-1,0,a-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(0===this.Rdiag[e])return!1;return!0}get upperTriangularMatrix(){let t,e,r=this.QR,n=r.columns,o=new E(n,n);for(t=0;t<n;t++)for(e=0;e<n;e++)t<e?o.set(t,e,r.get(t,e)):t===e?o.set(t,e,this.Rdiag[t]):o.set(t,e,0);return o}get orthogonalMatrix(){let t,e,r,n,o=this.QR,i=o.rows,s=o.columns,a=new E(i,s);for(r=s-1;r>=0;r--){for(t=0;t<i;t++)a.set(t,r,0);for(a.set(r,r,1),e=r;e<s;e++)if(0!==o.get(r,r)){for(n=0,t=r;t<i;t++)n+=o.get(t,r)*a.get(t,e);for(n=-n/o.get(r,r),t=r;t<i;t++)a.set(t,e,a.get(t,e)+n*o.get(t,r))}}return a}}class R{constructor(t,e={}){if((t=j.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let r=t.rows,n=t.columns;const{computeLeftSingularVectors:o=!0,computeRightSingularVectors:i=!0,autoTranspose:s=!1}=e;let a,u=Boolean(o),h=Boolean(i),d=!1;if(r<n)if(s){a=t.transpose(),r=a.rows,n=a.columns,d=!0;let e=u;u=h,h=e}else a=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else a=t.clone();let c=Math.min(r,n),l=Math.min(r+1,n),f=new Float64Array(l),g=new E(r,c),p=new E(n,n),v=new Float64Array(n),m=new Float64Array(r),y=new Float64Array(l);for(let t=0;t<l;t++)y[t]=t;let w=Math.min(r-1,n),x=Math.max(0,Math.min(n-2,r)),b=Math.max(w,x);for(let t=0;t<b;t++){if(t<w){f[t]=0;for(let e=t;e<r;e++)f[t]=O(f[t],a.get(e,t));if(0!==f[t]){a.get(t,t)<0&&(f[t]=-f[t]);for(let e=t;e<r;e++)a.set(e,t,a.get(e,t)/f[t]);a.set(t,t,a.get(t,t)+1)}f[t]=-f[t]}for(let e=t+1;e<n;e++){if(t<w&&0!==f[t]){let n=0;for(let o=t;o<r;o++)n+=a.get(o,t)*a.get(o,e);n=-n/a.get(t,t);for(let o=t;o<r;o++)a.set(o,e,a.get(o,e)+n*a.get(o,t))}v[e]=a.get(t,e)}if(u&&t<w)for(let e=t;e<r;e++)g.set(e,t,a.get(e,t));if(t<x){v[t]=0;for(let e=t+1;e<n;e++)v[t]=O(v[t],v[e]);if(0!==v[t]){v[t+1]<0&&(v[t]=0-v[t]);for(let e=t+1;e<n;e++)v[e]/=v[t];v[t+1]+=1}if(v[t]=-v[t],t+1<r&&0!==v[t]){for(let e=t+1;e<r;e++)m[e]=0;for(let e=t+1;e<r;e++)for(let r=t+1;r<n;r++)m[e]+=v[r]*a.get(e,r);for(let e=t+1;e<n;e++){let n=-v[e]/v[t+1];for(let o=t+1;o<r;o++)a.set(o,e,a.get(o,e)+n*m[o])}}if(h)for(let e=t+1;e<n;e++)p.set(e,t,v[e])}}let N=Math.min(n,r+1);if(w<n&&(f[w]=a.get(w,w)),r<N&&(f[N-1]=0),x+1<N&&(v[x]=a.get(x,N-1)),v[N-1]=0,u){for(let t=w;t<c;t++){for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}for(let t=w-1;t>=0;t--)if(0!==f[t]){for(let e=t+1;e<c;e++){let n=0;for(let o=t;o<r;o++)n+=g.get(o,t)*g.get(o,e);n=-n/g.get(t,t);for(let o=t;o<r;o++)g.set(o,e,g.get(o,e)+n*g.get(o,t))}for(let e=t;e<r;e++)g.set(e,t,-g.get(e,t));g.set(t,t,1+g.get(t,t));for(let e=0;e<t-1;e++)g.set(e,t,0)}else{for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}}if(h)for(let t=n-1;t>=0;t--){if(t<x&&0!==v[t])for(let e=t+1;e<n;e++){let r=0;for(let o=t+1;o<n;o++)r+=p.get(o,t)*p.get(o,e);r=-r/p.get(t+1,t);for(let o=t+1;o<n;o++)p.set(o,e,p.get(o,e)+r*p.get(o,t))}for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}let M=N-1,_=Number.EPSILON;for(;N>0;){let t,e;for(t=N-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+_*Math.abs(f[t]+Math.abs(f[t+1]));if(Math.abs(v[t])<=e||Number.isNaN(v[t])){v[t]=0;break}}if(t===N-2)e=4;else{let r;for(r=N-1;r>=t&&r!==t;r--){let e=(r!==N?Math.abs(v[r]):0)+(r!==t+1?Math.abs(v[r-1]):0);if(Math.abs(f[r])<=_*e){f[r]=0;break}}r===t?e=3:r===N-1?e=1:(e=2,t=r)}switch(t++,e){case 1:{let e=v[N-2];v[N-2]=0;for(let r=N-2;r>=t;r--){let o=O(f[r],e),i=f[r]/o,s=e/o;if(f[r]=o,r!==t&&(e=-s*v[r-1],v[r-1]=i*v[r-1]),h)for(let t=0;t<n;t++)o=i*p.get(t,r)+s*p.get(t,N-1),p.set(t,N-1,-s*p.get(t,r)+i*p.get(t,N-1)),p.set(t,r,o)}break}case 2:{let e=v[t-1];v[t-1]=0;for(let n=t;n<N;n++){let o=O(f[n],e),i=f[n]/o,s=e/o;if(f[n]=o,e=-s*v[n],v[n]=i*v[n],u)for(let e=0;e<r;e++)o=i*g.get(e,n)+s*g.get(e,t-1),g.set(e,t-1,-s*g.get(e,n)+i*g.get(e,t-1)),g.set(e,n,o)}break}case 3:{const e=Math.max(Math.abs(f[N-1]),Math.abs(f[N-2]),Math.abs(v[N-2]),Math.abs(f[t]),Math.abs(v[t])),o=f[N-1]/e,i=f[N-2]/e,s=v[N-2]/e,a=f[t]/e,d=v[t]/e,c=((i+o)*(i-o)+s*s)/2,l=o*s*(o*s);let m=0;0===c&&0===l||(m=c<0?0-Math.sqrt(c*c+l):Math.sqrt(c*c+l),m=l/(c+m));let y=(a+o)*(a-o)+m,w=a*d;for(let e=t;e<N-1;e++){let o=O(y,w);0===o&&(o=Number.MIN_VALUE);let i=y/o,s=w/o;if(e!==t&&(v[e-1]=o),y=i*f[e]+s*v[e],v[e]=i*v[e]-s*f[e],w=s*f[e+1],f[e+1]=i*f[e+1],h)for(let t=0;t<n;t++)o=i*p.get(t,e)+s*p.get(t,e+1),p.set(t,e+1,-s*p.get(t,e)+i*p.get(t,e+1)),p.set(t,e,o);if(o=O(y,w),0===o&&(o=Number.MIN_VALUE),i=y/o,s=w/o,f[e]=o,y=i*v[e]+s*f[e+1],f[e+1]=-s*v[e]+i*f[e+1],w=s*v[e+1],v[e+1]=i*v[e+1],u&&e<r-1)for(let t=0;t<r;t++)o=i*g.get(t,e)+s*g.get(t,e+1),g.set(t,e+1,-s*g.get(t,e)+i*g.get(t,e+1)),g.set(t,e,o)}v[N-2]=y;break}case 4:if(f[t]<=0&&(f[t]=f[t]<0?-f[t]:0,h))for(let e=0;e<=M;e++)p.set(e,t,-p.get(e,t));for(;t<M&&!(f[t]>=f[t+1]);){let e=f[t];if(f[t]=f[t+1],f[t+1]=e,h&&t<n-1)for(let r=0;r<n;r++)e=p.get(r,t+1),p.set(r,t+1,p.get(r,t)),p.set(r,t,e);if(u&&t<r-1)for(let n=0;n<r;n++)e=g.get(n,t+1),g.set(n,t+1,g.get(n,t)),g.set(n,t,e);t++}N--}}if(d){let t=p;p=g,g=t}this.m=r,this.n=n,this.s=f,this.U=g,this.V=p}solve(t){let e=t,r=this.threshold,n=this.s.length,o=E.zeros(n,n);for(let t=0;t<n;t++)Math.abs(this.s[t])<=r?o.set(t,t,0):o.set(t,t,1/this.s[t]);let i=this.U,s=this.rightSingularVectors,a=s.mmul(o),u=s.rows,h=i.rows,d=E.zeros(u,h);for(let t=0;t<u;t++)for(let e=0;e<h;e++){let r=0;for(let o=0;o<n;o++)r+=a.get(t,o)*i.get(e,o);d.set(t,e,r)}return d.mmul(e)}solveForDiagonal(t){return this.solve(E.diag(t))}inverse(){let t=this.V,e=this.threshold,r=t.rows,n=t.columns,o=new E(r,this.s.length);for(let i=0;i<r;i++)for(let r=0;r<n;r++)Math.abs(this.s[r])>e&&o.set(i,r,t.get(i,r)/this.s[r]);let i=this.U,s=i.rows,a=i.columns,u=new E(r,s);for(let t=0;t<r;t++)for(let e=0;e<s;e++){let r=0;for(let n=0;n<a;n++)r+=o.get(t,n)*i.get(e,n);u.set(t,e,r)}return u}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,r=this.s;for(let n=0,o=r.length;n<o;n++)r[n]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return E.diag(this.s)}}function I(t,e,r=!1){return t=j.checkMatrix(t),e=j.checkMatrix(e),r?new R(t).solve(e):t.isSquare()?new S(t).solve(e):new z(t).solve(e)}function C(t,e){let r=[];for(let n=0;n<t;n++)n!==e&&r.push(n);return r}function D(t,e,r,n=1e-9,o=1e-9){if(t>o)return new Array(e.rows+1).fill(0);{let t=e.addRow(r,[0]);for(let e=0;e<t.rows;e++)Math.abs(t.get(e,0))<n&&t.set(e,0,0);return t.to1DArray()}}class P{constructor(t,e={}){const{assumeSymmetric:r=!1}=e;if(!(t=j.checkMatrix(t)).isSquare())throw new Error("Matrix is not a square matrix");if(t.isEmpty())throw new Error("Matrix must be non-empty");let n,o,i=t.columns,s=new E(i,i),a=new Float64Array(i),u=new Float64Array(i),h=t,d=!1;if(d=!!r||t.isSymmetric(),d){for(n=0;n<i;n++)for(o=0;o<i;o++)s.set(n,o,h.get(n,o));!function(t,e,r,n){let o,i,s,a,u,h,d,c;for(u=0;u<t;u++)r[u]=n.get(t-1,u);for(a=t-1;a>0;a--){for(c=0,s=0,h=0;h<a;h++)c+=Math.abs(r[h]);if(0===c)for(e[a]=r[a-1],u=0;u<a;u++)r[u]=n.get(a-1,u),n.set(a,u,0),n.set(u,a,0);else{for(h=0;h<a;h++)r[h]/=c,s+=r[h]*r[h];for(o=r[a-1],i=Math.sqrt(s),o>0&&(i=-i),e[a]=c*i,s-=o*i,r[a-1]=o-i,u=0;u<a;u++)e[u]=0;for(u=0;u<a;u++){for(o=r[u],n.set(u,a,o),i=e[u]+n.get(u,u)*o,h=u+1;h<=a-1;h++)i+=n.get(h,u)*r[h],e[h]+=n.get(h,u)*o;e[u]=i}for(o=0,u=0;u<a;u++)e[u]/=s,o+=e[u]*r[u];for(d=o/(s+s),u=0;u<a;u++)e[u]-=d*r[u];for(u=0;u<a;u++){for(o=r[u],i=e[u],h=u;h<=a-1;h++)n.set(h,u,n.get(h,u)-(o*e[h]+i*r[h]));r[u]=n.get(a-1,u),n.set(a,u,0)}}r[a]=s}for(a=0;a<t-1;a++){if(n.set(t-1,a,n.get(a,a)),n.set(a,a,1),s=r[a+1],0!==s){for(h=0;h<=a;h++)r[h]=n.get(h,a+1)/s;for(u=0;u<=a;u++){for(i=0,h=0;h<=a;h++)i+=n.get(h,a+1)*n.get(h,u);for(h=0;h<=a;h++)n.set(h,u,n.get(h,u)-i*r[h])}}for(h=0;h<=a;h++)n.set(h,a+1,0)}for(u=0;u<t;u++)r[u]=n.get(t-1,u),n.set(t-1,u,0);n.set(t-1,t-1,1),e[0]=0}(i,u,a,s),function(t,e,r,n){let o,i,s,a,u,h,d,c,l,f,g,p,v,m,y,w;for(s=1;s<t;s++)e[s-1]=e[s];e[t-1]=0;let x=0,b=0,E=Number.EPSILON;for(h=0;h<t;h++){for(b=Math.max(b,Math.abs(r[h])+Math.abs(e[h])),d=h;d<t&&!(Math.abs(e[d])<=E*b);)d++;if(d>h)do{for(o=r[h],c=(r[h+1]-o)/(2*e[h]),l=O(c,1),c<0&&(l=-l),r[h]=e[h]/(c+l),r[h+1]=e[h]*(c+l),f=r[h+1],i=o-r[h],s=h+2;s<t;s++)r[s]-=i;for(x+=i,c=r[d],g=1,p=g,v=g,m=e[h+1],y=0,w=0,s=d-1;s>=h;s--)for(v=p,p=g,w=y,o=g*e[s],i=g*c,l=O(c,e[s]),e[s+1]=y*l,y=e[s]/l,g=c/l,c=g*r[s]-y*o,r[s+1]=i+y*(g*o+y*r[s]),u=0;u<t;u++)i=n.get(u,s+1),n.set(u,s+1,y*n.get(u,s)+g*i),n.set(u,s,g*n.get(u,s)-y*i);c=-y*w*v*m*e[h]/f,e[h]=y*c,r[h]=g*c}while(Math.abs(e[h])>E*b);r[h]=r[h]+x,e[h]=0}for(s=0;s<t-1;s++){for(u=s,c=r[s],a=s+1;a<t;a++)r[a]<c&&(u=a,c=r[a]);if(u!==s)for(r[u]=r[s],r[s]=c,a=0;a<t;a++)c=n.get(a,s),n.set(a,s,n.get(a,u)),n.set(a,u,c)}}(i,u,a,s)}else{let t=new E(i,i),e=new Float64Array(i);for(o=0;o<i;o++)for(n=0;n<i;n++)t.set(n,o,h.get(n,o));!function(t,e,r,n){let o,i,s,a,u,h,d,c=t-1;for(h=1;h<=c-1;h++){for(d=0,a=h;a<=c;a++)d+=Math.abs(e.get(a,h-1));if(0!==d){for(s=0,a=c;a>=h;a--)r[a]=e.get(a,h-1)/d,s+=r[a]*r[a];for(i=Math.sqrt(s),r[h]>0&&(i=-i),s-=r[h]*i,r[h]=r[h]-i,u=h;u<t;u++){for(o=0,a=c;a>=h;a--)o+=r[a]*e.get(a,u);for(o/=s,a=h;a<=c;a++)e.set(a,u,e.get(a,u)-o*r[a])}for(a=0;a<=c;a++){for(o=0,u=c;u>=h;u--)o+=r[u]*e.get(a,u);for(o/=s,u=h;u<=c;u++)e.set(a,u,e.get(a,u)-o*r[u])}r[h]=d*r[h],e.set(h,h-1,d*i)}}for(a=0;a<t;a++)for(u=0;u<t;u++)n.set(a,u,a===u?1:0);for(h=c-1;h>=1;h--)if(0!==e.get(h,h-1)){for(a=h+1;a<=c;a++)r[a]=e.get(a,h-1);for(u=h;u<=c;u++){for(i=0,a=h;a<=c;a++)i+=r[a]*n.get(a,u);for(i=i/r[h]/e.get(h,h-1),a=h;a<=c;a++)n.set(a,u,n.get(a,u)+i*r[a])}}}(i,t,e,s),function(t,e,r,n,o){let i,s,a,u,h,d,c,l,f,g,p,v,m,y,w,x=t-1,b=t-1,E=Number.EPSILON,N=0,M=0,_=0,k=0,A=0,j=0,S=0,O=0;for(i=0;i<t;i++)for((i<0||i>b)&&(r[i]=o.get(i,i),e[i]=0),s=Math.max(i-1,0);s<t;s++)M+=Math.abs(o.get(i,s));for(;x>=0;){for(u=x;u>0&&(j=Math.abs(o.get(u-1,u-1))+Math.abs(o.get(u,u)),0===j&&(j=M),!(Math.abs(o.get(u,u-1))<E*j));)u--;if(u===x)o.set(x,x,o.get(x,x)+N),r[x]=o.get(x,x),e[x]=0,x--,O=0;else if(u===x-1){if(c=o.get(x,x-1)*o.get(x-1,x),_=(o.get(x-1,x-1)-o.get(x,x))/2,k=_*_+c,S=Math.sqrt(Math.abs(k)),o.set(x,x,o.get(x,x)+N),o.set(x-1,x-1,o.get(x-1,x-1)+N),l=o.get(x,x),k>=0){for(S=_>=0?_+S:_-S,r[x-1]=l+S,r[x]=r[x-1],0!==S&&(r[x]=l-c/S),e[x-1]=0,e[x]=0,l=o.get(x,x-1),j=Math.abs(l)+Math.abs(S),_=l/j,k=S/j,A=Math.sqrt(_*_+k*k),_/=A,k/=A,s=x-1;s<t;s++)S=o.get(x-1,s),o.set(x-1,s,k*S+_*o.get(x,s)),o.set(x,s,k*o.get(x,s)-_*S);for(i=0;i<=x;i++)S=o.get(i,x-1),o.set(i,x-1,k*S+_*o.get(i,x)),o.set(i,x,k*o.get(i,x)-_*S);for(i=0;i<=b;i++)S=n.get(i,x-1),n.set(i,x-1,k*S+_*n.get(i,x)),n.set(i,x,k*n.get(i,x)-_*S)}else r[x-1]=l+_,r[x]=l+_,e[x-1]=S,e[x]=-S;x-=2,O=0}else{if(l=o.get(x,x),f=0,c=0,u<x&&(f=o.get(x-1,x-1),c=o.get(x,x-1)*o.get(x-1,x)),10===O){for(N+=l,i=0;i<=x;i++)o.set(i,i,o.get(i,i)-l);j=Math.abs(o.get(x,x-1))+Math.abs(o.get(x-1,x-2)),l=f=.75*j,c=-.4375*j*j}if(30===O&&(j=(f-l)/2,j=j*j+c,j>0)){for(j=Math.sqrt(j),f<l&&(j=-j),j=l-c/((f-l)/2+j),i=0;i<=x;i++)o.set(i,i,o.get(i,i)-j);N+=j,l=f=c=.964}for(O+=1,h=x-2;h>=u&&(S=o.get(h,h),A=l-S,j=f-S,_=(A*j-c)/o.get(h+1,h)+o.get(h,h+1),k=o.get(h+1,h+1)-S-A-j,A=o.get(h+2,h+1),j=Math.abs(_)+Math.abs(k)+Math.abs(A),_/=j,k/=j,A/=j,h!==u)&&!(Math.abs(o.get(h,h-1))*(Math.abs(k)+Math.abs(A))<E*(Math.abs(_)*(Math.abs(o.get(h-1,h-1))+Math.abs(S)+Math.abs(o.get(h+1,h+1)))));)h--;for(i=h+2;i<=x;i++)o.set(i,i-2,0),i>h+2&&o.set(i,i-3,0);for(a=h;a<=x-1&&(y=a!==x-1,a!==h&&(_=o.get(a,a-1),k=o.get(a+1,a-1),A=y?o.get(a+2,a-1):0,l=Math.abs(_)+Math.abs(k)+Math.abs(A),0!==l&&(_/=l,k/=l,A/=l)),0!==l);a++)if(j=Math.sqrt(_*_+k*k+A*A),_<0&&(j=-j),0!==j){for(a!==h?o.set(a,a-1,-j*l):u!==h&&o.set(a,a-1,-o.get(a,a-1)),_+=j,l=_/j,f=k/j,S=A/j,k/=_,A/=_,s=a;s<t;s++)_=o.get(a,s)+k*o.get(a+1,s),y&&(_+=A*o.get(a+2,s),o.set(a+2,s,o.get(a+2,s)-_*S)),o.set(a,s,o.get(a,s)-_*l),o.set(a+1,s,o.get(a+1,s)-_*f);for(i=0;i<=Math.min(x,a+3);i++)_=l*o.get(i,a)+f*o.get(i,a+1),y&&(_+=S*o.get(i,a+2),o.set(i,a+2,o.get(i,a+2)-_*A)),o.set(i,a,o.get(i,a)-_),o.set(i,a+1,o.get(i,a+1)-_*k);for(i=0;i<=b;i++)_=l*n.get(i,a)+f*n.get(i,a+1),y&&(_+=S*n.get(i,a+2),n.set(i,a+2,n.get(i,a+2)-_*A)),n.set(i,a,n.get(i,a)-_),n.set(i,a+1,n.get(i,a+1)-_*k)}}}if(0!==M){for(x=t-1;x>=0;x--)if(_=r[x],k=e[x],0===k)for(u=x,o.set(x,x,1),i=x-1;i>=0;i--){for(c=o.get(i,i)-_,A=0,s=u;s<=x;s++)A+=o.get(i,s)*o.get(s,x);if(e[i]<0)S=c,j=A;else if(u=i,0===e[i]?o.set(i,x,0!==c?-A/c:-A/(E*M)):(l=o.get(i,i+1),f=o.get(i+1,i),k=(r[i]-_)*(r[i]-_)+e[i]*e[i],d=(l*j-S*A)/k,o.set(i,x,d),o.set(i+1,x,Math.abs(l)>Math.abs(S)?(-A-c*d)/l:(-j-f*d)/S)),d=Math.abs(o.get(i,x)),E*d*d>1)for(s=i;s<=x;s++)o.set(s,x,o.get(s,x)/d)}else if(k<0)for(u=x-1,Math.abs(o.get(x,x-1))>Math.abs(o.get(x-1,x))?(o.set(x-1,x-1,k/o.get(x,x-1)),o.set(x-1,x,-(o.get(x,x)-_)/o.get(x,x-1))):(w=T(0,-o.get(x-1,x),o.get(x-1,x-1)-_,k),o.set(x-1,x-1,w[0]),o.set(x-1,x,w[1])),o.set(x,x-1,0),o.set(x,x,1),i=x-2;i>=0;i--){for(g=0,p=0,s=u;s<=x;s++)g+=o.get(i,s)*o.get(s,x-1),p+=o.get(i,s)*o.get(s,x);if(c=o.get(i,i)-_,e[i]<0)S=c,A=g,j=p;else if(u=i,0===e[i]?(w=T(-g,-p,c,k),o.set(i,x-1,w[0]),o.set(i,x,w[1])):(l=o.get(i,i+1),f=o.get(i+1,i),v=(r[i]-_)*(r[i]-_)+e[i]*e[i]-k*k,m=2*(r[i]-_)*k,0===v&&0===m&&(v=E*M*(Math.abs(c)+Math.abs(k)+Math.abs(l)+Math.abs(f)+Math.abs(S))),w=T(l*A-S*g+k*p,l*j-S*p-k*g,v,m),o.set(i,x-1,w[0]),o.set(i,x,w[1]),Math.abs(l)>Math.abs(S)+Math.abs(k)?(o.set(i+1,x-1,(-g-c*o.get(i,x-1)+k*o.get(i,x))/l),o.set(i+1,x,(-p-c*o.get(i,x)-k*o.get(i,x-1))/l)):(w=T(-A-f*o.get(i,x-1),-j-f*o.get(i,x),S,k),o.set(i+1,x-1,w[0]),o.set(i+1,x,w[1]))),d=Math.max(Math.abs(o.get(i,x-1)),Math.abs(o.get(i,x))),E*d*d>1)for(s=i;s<=x;s++)o.set(s,x-1,o.get(s,x-1)/d),o.set(s,x,o.get(s,x)/d)}for(i=0;i<t;i++)if(i<0||i>b)for(s=i;s<t;s++)n.set(i,s,o.get(i,s));for(s=t-1;s>=0;s--)for(i=0;i<=b;i++){for(S=0,a=0;a<=Math.min(s,b);a++)S+=n.get(i,a)*o.get(a,s);n.set(i,s,S)}}}(i,u,a,s,t)}this.n=i,this.e=u,this.d=a,this.V=s}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let t,e,r=this.n,n=this.e,o=this.d,i=new E(r,r);for(t=0;t<r;t++){for(e=0;e<r;e++)i.set(t,e,0);i.set(t,t,o[t]),n[t]>0?i.set(t,t+1,n[t]):n[t]<0&&i.set(t,t-1,n[t])}return i}}function T(t,e,r,n){let o,i;return Math.abs(r)>Math.abs(n)?(o=n/r,i=r+o*n,[(t+o*e)/i,(e-o*t)/i]):(o=r/n,i=n+o*r,[(o*t+e)/i,(o*e-t)/i])}class L{constructor(t){if(!(t=j.checkMatrix(t)).isSymmetric())throw new Error("Matrix is not symmetric");let e,r,n,o=t,i=o.rows,s=new E(i,i),a=!0;for(r=0;r<i;r++){let t=0;for(n=0;n<r;n++){let i=0;for(e=0;e<n;e++)i+=s.get(n,e)*s.get(r,e);i=(o.get(r,n)-i)/s.get(n,n),s.set(r,n,i),t+=i*i}for(t=o.get(r,r)-t,a&=t>0,s.set(r,r,Math.sqrt(Math.max(t,0))),n=r+1;n<i;n++)s.set(r,n,0)}this.L=s,this.positiveDefinite=Boolean(a)}isPositiveDefinite(){return this.positiveDefinite}solve(t){t=j.checkMatrix(t);let e=this.L,r=e.rows;if(t.rows!==r)throw new Error("Matrix dimensions do not match");if(!1===this.isPositiveDefinite())throw new Error("Matrix is not positive definite");let n,o,i,s=t.columns,a=t.clone();for(i=0;i<r;i++)for(o=0;o<s;o++){for(n=0;n<i;n++)a.set(i,o,a.get(i,o)-a.get(n,o)*e.get(i,n));a.set(i,o,a.get(i,o)/e.get(i,i))}for(i=r-1;i>=0;i--)for(o=0;o<s;o++){for(n=i+1;n<r;n++)a.set(i,o,a.get(i,o)-a.get(n,o)*e.get(n,i));a.set(i,o,a.get(i,o)/e.get(i,i))}return a}get lowerTriangularMatrix(){return this.L}}class F{constructor(t,e={}){t=j.checkMatrix(t);let{Y:r}=e;const{scaleScores:o=!1,maxIterations:i=1e3,terminationCriteria:s=1e-10}=e;let a;if(r){if(r=n.isAnyArray(r)&&"number"==typeof r[0]?E.columnVector(r):j.checkMatrix(r),r.rows!==t.rows)throw new Error("Y should have the same number of rows as X");a=r.getColumnVector(0)}else a=t.getColumnVector(0);let u,h,d,c,l=1;for(let e=0;e<i&&l>s;e++)d=t.transpose().mmul(a).div(a.transpose().mmul(a).get(0,0)),d=d.div(d.norm()),u=t.mmul(d).div(d.transpose().mmul(d).get(0,0)),e>0&&(l=u.clone().sub(c).pow(2).sum()),c=u.clone(),r?(h=r.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),h=h.div(h.norm()),a=r.mmul(h).div(h.transpose().mmul(h).get(0,0))):a=u;if(r){let e=t.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0));e=e.div(e.norm());let n=t.clone().sub(u.clone().mmul(e.transpose())),o=a.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),i=r.clone().sub(u.clone().mulS(o.get(0,0)).mmul(h.transpose()));this.t=u,this.p=e.transpose(),this.w=d.transpose(),this.q=h,this.u=a,this.s=u.transpose().mmul(u),this.xResidual=n,this.yResidual=i,this.betas=o}else this.w=d.transpose(),this.s=u.transpose().mmul(u).sqrt(),this.t=o?u.clone().div(this.s.get(0,0)):u,this.xResidual=t.sub(u.mmul(d.transpose()))}}e.y3=x,e.jy=L,e.oN=L,e.Hc=M,e.cg=P,e.hj=P,e.LU=S,e.Tb=S,e.uq=E,e.Zm=class extends _{constructor(t,e){p(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,r){return this.matrix.set(t,this.columnIndices[e],r),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}},e.Dq=class extends _{constructor(t,e){c(t,e),super(t,t.rows,1),this.column=e}set(t,e,r){return this.matrix.set(t,this.column,r),this}get(t){return this.matrix.get(t,this.column)}},e.__=class extends _{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(t,this.columns-e-1,r),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}},e.q0=class extends _{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(this.rows-t-1,e,r),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}},e.lh=class extends _{constructor(t,e){g(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,r){return this.matrix.set(this.rowIndices[t],e,r),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}},e.pI=class extends _{constructor(t,e){d(t,e),super(t,1,t.columns),this.row=e}set(t,e,r){return this.matrix.set(this.row,e,r),this}get(t,e){return this.matrix.get(this.row,e)}},e.zC=k,e.zg=class extends _{constructor(t,e,r,n,o){v(t,e,r,n,o),super(t,r-e+1,o-n+1),this.startRow=e,this.startColumn=n}set(t,e,r){return this.matrix.set(this.startRow+t,this.startColumn+e,r),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}},e.g6=class extends _{constructor(t){super(t,t.columns,t.rows)}set(t,e,r){return this.matrix.set(e,t,r),this}get(t,e){return this.matrix.get(e,t)}},e.OL=F,e.ks=F,e.QR=z,e.jp=z,e.mk=R,e.W2=R,e.l=N,e.KY=A,e.dv=j,e.BR=function(t,e=t,r={}){t=new E(t);let o=!1;if("object"!=typeof e||E.isMatrix(e)||n.isAnyArray(e)?e=new E(e):(r=e,e=t,o=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0,scale:s=!0}=r;i&&(t.center("column"),o||e.center("column")),s&&(t.scale("column"),o||e.scale("column"));const a=t.standardDeviation("column",{unbiased:!0}),u=o?a:e.standardDeviation("column",{unbiased:!0}),h=t.transpose().mmul(e);for(let e=0;e<h.rows;e++)for(let r=0;r<h.columns;r++)h.set(e,r,h.get(e,r)*(1/(a[e]*u[r]))*(1/(t.rows-1)));return h},e.Wu=function(t,e=t,r={}){t=new E(t);let o=!1;if("object"!=typeof e||E.isMatrix(e)||n.isAnyArray(e)?e=new E(e):(r=e,e=t,o=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0}=r;i&&(t=t.center("column"),o||(e=e.center("column")));const s=t.transpose().mmul(e);for(let e=0;e<s.rows;e++)for(let r=0;r<s.columns;r++)s.set(e,r,s.get(e,r)*(1/(t.rows-1)));return s},e.a4=function t(e){if((e=E.checkMatrix(e)).isSquare()){if(0===e.columns)return 1;let r,n,o,i;if(2===e.columns)return r=e.get(0,0),n=e.get(0,1),o=e.get(1,0),i=e.get(1,1),r*i-n*o;if(3===e.columns){let i,s,a;return i=new k(e,[1,2],[1,2]),s=new k(e,[1,2],[0,2]),a=new k(e,[1,2],[0,1]),r=e.get(0,0),n=e.get(0,1),o=e.get(0,2),r*t(i)-n*t(s)+o*t(a)}return new S(e).determinant}throw Error("determinant can only be calculated for a square matrix")},e.DI=function(t,e=!1){return t=j.checkMatrix(t),e?new R(t).inverse():I(t,E.eye(t.rows))},e.Jo=function(t,e={}){const{thresholdValue:r=1e-9,thresholdError:n=1e-9}=e;let o=(t=E.checkMatrix(t)).rows,i=new E(o,o);for(let e=0;e<o;e++){let s=E.columnVector(t.getRow(e)),a=t.subMatrixRow(C(o,e)).transpose(),u=new R(a).solve(s),h=E.sub(s,a.mmul(u)).abs().max();i.setRow(e,D(h,u,e,r,n))}return i},e.Zi=function(t,e=Number.EPSILON){if((t=E.checkMatrix(t)).isEmpty())return t.transpose();let r=new R(t,{autoTranspose:!0}),n=r.leftSingularVectors,o=r.rightSingularVectors,i=r.diagonal;for(let t=0;t<i.length;t++)Math.abs(i[t])>e?i[t]=1/i[t]:i[t]=0;return o.mmul(E.diag(i).mmul(n.transpose()))},e.kH=I,e.LV=function(t,e){if(n.isAnyArray(t))return t[0]&&n.isAnyArray(t[0])?new j(t):new A(t,e);throw new Error("the argument is not an array")}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={id:n,loaded:!1,exports:{}};return t[n](i,i.exports,r),i.loaded=!0,i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var n={};(()=>{"use strict";function t(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}function e(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}r.d(n,{calculateLayout:()=>Pn,stopLayout:()=>Dn}),Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;const o=function(){function t(){this._events={}}return t.prototype.on=function(t,e,r){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!r}),this},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.emit=function(t){for(var e=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=this._events[t]||[],i=this._events["*"]||[],s=function(n){for(var o=n.length,i=0;i<o;i++)if(n[i]){var s=n[i],a=s.callback;s.once&&(n.splice(i,1),0===n.length&&delete e._events[t],o--,i--),a.apply(e,r)}};s(o),s(i)},t.prototype.off=function(t,e){if(t)if(e){for(var r=this._events[t]||[],n=r.length,o=0;o<n;o++)r[o].callback===e&&(r.splice(o,1),n--,o--);0===r.length&&delete this._events[t]}else delete this._events[t];else this._events={};return this},t.prototype.getEvents=function(){return this._events},t}();function i(t,e,r,n){for(;t.length;){const o=t.shift();if(r(o))return!0;e.add(o.id),n(o.id).forEach((r=>{e.has(r.id)||(e.add(r.id),t.push(r))}))}return!1}function s(t,e,r,n){if(r(t))return!0;e.add(t.id);for(const o of n(t.id))if(!e.has(o.id)&&s(o,e,r,n))return!0;return!1}const a=()=>!0;class u{graph;nodeFilter;edgeFilter;cacheEnabled;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;allNodesMap=new Map;allEdgesMap=new Map;constructor(t){this.graph=t.graph;const e=t.nodeFilter||a,r=t.edgeFilter||a;this.nodeFilter=e,this.edgeFilter=t=>{const{source:n,target:o}=this.graph.getEdgeDetail(t.id);return!(!e(n)||!e(o))&&r(t,n,o)},"auto"===t.cache?(this.cacheEnabled=!0,this.startAutoCache()):"manual"===t.cache?this.cacheEnabled=!0:this.cacheEnabled=!1}clearCache=()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()};refreshCache=()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map((t=>t.id)))};updateCache=t=>{const e=new Set;t.forEach((t=>{const r=this.bothEdgesMap.get(t);if(r&&r.forEach((t=>e.add(t.id))),this.hasNode(t)){const r=this.graph.getRelatedEdges(t,"in").filter(this.edgeFilter),n=this.graph.getRelatedEdges(t,"out").filter(this.edgeFilter),o=Array.from(new Set([...r,...n]));o.forEach((t=>e.add(t.id))),this.inEdgesMap.set(t,r),this.outEdgesMap.set(t,n),this.bothEdgesMap.set(t,o),this.allNodesMap.set(t,this.graph.getNode(t))}else this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.bothEdgesMap.delete(t),this.allNodesMap.delete(t)})),e.forEach((t=>{this.hasEdge(t)?this.allEdgesMap.set(t,this.graph.getEdge(t)):this.allEdgesMap.delete(t)}))};startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}handleGraphChanged=t=>{const e=new Set;t.changes.forEach((r=>{switch(r.type){case"NodeAdded":case"NodeRemoved":e.add(r.value.id);break;case"NodeDataUpdated":e.add(r.id);break;case"EdgeAdded":case"EdgeRemoved":e.add(r.value.source),e.add(r.value.target);break;case"EdgeUpdated":"source"!==r.propertyName&&"target"!==r.propertyName||(e.add(r.oldValue),e.add(r.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(r.id)){const n=t.graph.getEdge(r.id);e.add(n.source),e.add(n.target)}}})),this.updateCache(e)};checkNodeExistence(t){this.getNode(t)}hasNode(t){if(!this.graph.hasNode(t))return!1;const e=this.graph.getNode(t);return this.nodeFilter(e)}areNeighbors(t,e){return this.checkNodeExistence(t),this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.graph.getNode(t);if(!this.nodeFilter(e))throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){return this.checkNodeExistence(t),this.cacheEnabled?"in"===e?this.inEdgesMap.get(t):"out"===e?this.outEdgesMap.get(t):this.bothEdgesMap.get(t):this.graph.getRelatedEdges(t,e).filter(this.edgeFilter)}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}hasEdge(t){if(!this.graph.hasEdge(t))return!1;const e=this.graph.getEdge(t);return this.edgeFilter(e)}getEdge(t){const e=this.graph.getEdge(t);if(!this.edgeFilter(e))throw new Error("Edge not found for id: "+t);return e}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}hasTreeStructure(t){return this.graph.hasTreeStructure(t)}getRoots(t){return this.graph.getRoots(t).filter(this.nodeFilter)}getChildren(t,e){return this.checkNodeExistence(t),this.graph.getChildren(t,e).filter(this.nodeFilter)}getParent(t,e){this.checkNodeExistence(t);const r=this.graph.getParent(t,e);return r&&this.nodeFilter(r)?r:null}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];i([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];s(this.getNode(t),new Set,e,n)}}class h extends o{nodeMap=new Map;edgeMap=new Map;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;treeIndices=new Map;changes=[];batchCount=0;onChanged=()=>{};constructor(t){super(),t&&(t.nodes&&this.addNodes(t.nodes),t.edges&&this.addEdges(t.edges),t.tree&&this.addTree(t.tree),t.onChanged&&(this.onChanged=t.onChanged))}batch=t=>{this.batchCount+=1,t(),this.batchCount-=1,this.batchCount||this.commit()};commit(){const t=this.changes;this.changes=[];const e={graph:this,changes:t};this.emit("changed",e),this.onChanged(e)}reduceChanges(t){let e=[];return t.forEach((t=>{switch(t.type){case"NodeRemoved":{let r=!1;e=e.filter((e=>{if("NodeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"NodeDataUpdated"===e.type?e.id!==t.value.id:"TreeStructureChanged"!==e.type||e.nodeId!==t.value.id})),r||e.push(t);break}case"EdgeRemoved":{let r=!1;e=e.filter((e=>{if("EdgeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"EdgeDataUpdated"!==e.type&&"EdgeUpdated"!==e.type||e.id!==t.value.id})),r||e.push(t);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const r=e.findIndex((e=>e.type===t.type&&e.id===t.id&&(void 0===t.propertyName||e.propertyName===t.propertyName))),n=e[r];n?void 0!==t.propertyName?n.newValue=t.newValue:(e.splice(r,1),e.push(t)):e.push(t);break}case"TreeStructureDetached":e=e.filter((e=>"TreeStructureAttached"===e.type?e.treeKey!==t.treeKey:"TreeStructureChanged"!==e.type||e.treeKey!==t.treeKey)),e.push(t);break;case"TreeStructureChanged":{const r=e.find((e=>"TreeStructureChanged"===e.type&&e.treeKey===t.treeKey&&e.nodeId===t.nodeId));r?r.newParentId=t.newParentId:e.push(t);break}default:e.push(t)}})),e}checkNodeExistence(t){this.getNode(t)}hasNode(t){return this.nodeMap.has(t)}areNeighbors(t,e){return this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.nodeMap.get(t);if(!e)throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),"in"===e){const e=this.inEdgesMap.get(t);return Array.from(e)}if("out"===e){const e=this.outEdgesMap.get(t);return Array.from(e)}{const e=this.bothEdgesMap.get(t);return Array.from(e)}}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}doAddNode(t){if(this.hasNode(t.id))throw new Error("Node already exists: "+t.id);this.nodeMap.set(t.id,t),this.inEdgesMap.set(t.id,new Set),this.outEdgesMap.set(t.id,new Set),this.bothEdgesMap.set(t.id,new Set),this.treeIndices.forEach((e=>{e.childrenMap.set(t.id,new Set)})),this.changes.push({type:"NodeAdded",value:t})}addNodes(t){this.batch((()=>{for(const e of t)this.doAddNode(e)}))}addNode(t){this.addNodes([t])}doRemoveNode(t){const e=this.getNode(t),r=this.bothEdgesMap.get(t);r?.forEach((t=>this.doRemoveEdge(t.id))),this.nodeMap.delete(t),this.treeIndices.forEach((e=>{e.childrenMap.get(t)?.forEach((t=>{e.parentMap.delete(t.id)})),e.parentMap.delete(t),e.childrenMap.delete(t)})),this.changes.push({type:"NodeRemoved",value:e})}removeNodes(t){this.batch((()=>{t.forEach((t=>this.doRemoveNode(t)))}))}removeNode(t){this.removeNodes([t])}updateNodeDataProperty(t,e,r){const n=this.getNode(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"NodeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}mergeNodeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateNodeDataProperty(t,e,r)}))}))}updateNodeData(...t){const e=t[0],r=this.getNode(e);if("string"==typeof t[1])return void this.updateNodeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"NodeDataUpdated",id:e,oldValue:t,newValue:o})}))}checkEdgeExistence(t){if(!this.hasEdge(t))throw new Error("Edge not found for id: "+t)}hasEdge(t){return this.edgeMap.has(t)}getEdge(t){return this.checkEdgeExistence(t),this.edgeMap.get(t)}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}doAddEdge(t){if(this.hasEdge(t.id))throw new Error("Edge already exists: "+t.id);this.checkNodeExistence(t.source),this.checkNodeExistence(t.target),this.edgeMap.set(t.id,t);const e=this.inEdgesMap.get(t.target),r=this.outEdgesMap.get(t.source),n=this.bothEdgesMap.get(t.source),o=this.bothEdgesMap.get(t.target);e.add(t),r.add(t),n.add(t),o.add(t),this.changes.push({type:"EdgeAdded",value:t})}addEdges(t){this.batch((()=>{for(const e of t)this.doAddEdge(e)}))}addEdge(t){this.addEdges([t])}doRemoveEdge(t){const e=this.getEdge(t),r=this.outEdgesMap.get(e.source),n=this.inEdgesMap.get(e.target),o=this.bothEdgesMap.get(e.source),i=this.bothEdgesMap.get(e.target);r.delete(e),n.delete(e),o.delete(e),i.delete(e),this.edgeMap.delete(t),this.changes.push({type:"EdgeRemoved",value:e})}removeEdges(t){this.batch((()=>{t.forEach((t=>this.doRemoveEdge(t)))}))}removeEdge(t){this.removeEdges([t])}updateEdgeSource(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.source,o=e;this.outEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.outEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.source=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"source",oldValue:n,newValue:o})}))}updateEdgeTarget(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.target,o=e;this.inEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.inEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.target=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"target",oldValue:n,newValue:o})}))}updateEdgeDataProperty(t,e,r){const n=this.getEdge(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"EdgeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}updateEdgeData(...t){const e=t[0],r=this.getEdge(e);if("string"==typeof t[1])return void this.updateEdgeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"EdgeDataUpdated",id:e,oldValue:t,newValue:o})}))}mergeEdgeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateEdgeDataProperty(t,e,r)}))}))}checkTreeExistence(t){if(!this.hasTreeStructure(t))throw new Error("Tree structure not found for treeKey: "+t)}hasTreeStructure(t){return this.treeIndices.has(t)}attachTreeStructure(t){this.treeIndices.has(t)||(this.treeIndices.set(t,{parentMap:new Map,childrenMap:new Map}),this.batch((()=>{this.changes.push({type:"TreeStructureAttached",treeKey:t})})))}detachTreeStructure(t){this.checkTreeExistence(t),this.treeIndices.delete(t),this.batch((()=>{this.changes.push({type:"TreeStructureDetached",treeKey:t})}))}addTree(t,e){this.batch((()=>{this.attachTreeStructure(e);const r=[],n=Array.isArray(t)?t:[t];for(;n.length;){const t=n.shift();r.push(t),t.children&&n.push(...t.children)}this.addNodes(r),r.forEach((t=>{t.children?.forEach((r=>{this.setParent(r.id,t.id,e)}))}))}))}getRoots(t){return this.checkTreeExistence(t),this.getAllNodes().filter((e=>!this.getParent(e.id,t)))}getChildren(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);const r=this.treeIndices.get(e).childrenMap.get(t);return Array.from(r||[])}getParent(t,e){return this.checkNodeExistence(t),this.checkTreeExistence(e),this.treeIndices.get(e).parentMap.get(t)||null}getAncestors(t,e){const r=[];let n,o=this.getNode(t);for(;n=this.getParent(o.id,e);)r.push(n),o=n;return r}setParent(t,e,r){this.checkTreeExistence(r);const n=this.treeIndices.get(r),o=this.getNode(t),i=n.parentMap.get(t);if(i?.id===e)return;if(void 0===e)return i&&n.childrenMap.get(i.id)?.delete(o),void n.parentMap.delete(t);const s=this.getNode(e);n.parentMap.set(t,s),i&&n.childrenMap.get(i.id)?.delete(o);let a=n.childrenMap.get(s.id);a||(a=new Set,n.childrenMap.set(s.id,a)),a.add(o),this.batch((()=>{this.changes.push({type:"TreeStructureChanged",treeKey:r,nodeId:t,oldParentId:i?.id,newParentId:s.id})}))}dfsTree(t,e,r){return s(this.getNode(t),new Set,e,(t=>this.getChildren(t,r)))}bfsTree(t,e,r){return i([this.getNode(t)],new Set,e,(t=>this.getChildren(t,r)))}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return i([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return s(this.getNode(t),new Set,e,n)}clone(){const t=this.getAllNodes().map((t=>({...t,data:{...t.data}}))),e=this.getAllEdges().map((t=>({...t,data:{...t.data}}))),r=new h({nodes:t,edges:e});return this.treeIndices.forEach((({parentMap:t,childrenMap:e},n)=>{const o=new Map;t.forEach(((t,e)=>{o.set(e,r.getNode(t.id))}));const i=new Map;e.forEach(((t,e)=>{i.set(e,new Set(Array.from(t).map((t=>r.getNode(t.id)))))})),r.treeIndices.set(n,{parentMap:o,childrenMap:i})})),r}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(t){return new u({graph:this,...t})}}var d={}.toString;const c=function(t,e){return d.call(t)==="[object "+e+"]"},l=function(t){return c(t,"Number")},f=(t,e)=>{if("next"!==t&&"prev"!==t)return e},g=t=>{t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev};class p{constructor(){const t={};t.prev=t,t.next=t.prev,this.shortcut=t}dequeue(){const t=this.shortcut,e=t.prev;if(e&&e!==t)return g(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&g(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e}toString(){const t=[],e=this.shortcut;let r=e.prev;for(;r!==e;)t.push(JSON.stringify(r,f)),r=null==r?void 0:r.prev;return`[${t.join(", ")}]`}}class v extends p{}const m=()=>1,y=(t,e,r,n,o)=>{var i,s;const a=[];return t.hasNode(n.v)&&(null===(i=t.getRelatedEdges(n.v,"in"))||void 0===i||i.forEach((n=>{const i=n.data.weight,s=t.getNode(n.source);o&&a.push({v:n.source,w:n.target,in:0,out:0}),void 0===s.data.out&&(s.data.out=0),s.data.out-=i,w(e,r,Object.assign({v:s.id},s.data))})),null===(s=t.getRelatedEdges(n.v,"out"))||void 0===s||s.forEach((n=>{const o=n.data.weight,i=n.target,s=t.getNode(i);void 0===s.data.in&&(s.data.in=0),s.data.in-=o,w(e,r,Object.assign({v:s.id},s.data))})),t.removeNode(n.v)),o?a:void 0},w=(t,e,r)=>{r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)},x=(t,e)=>{const r="greedy"===e?((t,e)=>{var r;if(t.getAllNodes().length<=1)return[];const n=((t,e)=>{const r=new h;let n=0,o=0;t.getAllNodes().forEach((t=>{r.addNode({id:t.id,data:{v:t.id,in:0,out:0}})})),t.getAllEdges().forEach((t=>{const i=r.getRelatedEdges(t.source,"out").find((e=>e.target===t.target)),s=(null==e?void 0:e(t))||1;i?r.updateEdgeData(null==i?void 0:i.id,Object.assign(Object.assign({},i.data),{weight:i.data.weight+s})):r.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:s}}),o=Math.max(o,r.getNode(t.source).data.out+=s),n=Math.max(n,r.getNode(t.target).data.in+=s)}));const i=[],s=o+n+3;for(let t=0;t<s;t++)i.push(new v);const a=n+1;return r.getAllNodes().forEach((t=>{w(i,a,Object.assign({v:t.id},r.getNode(t.id).data))})),{buckets:i,zeroIdx:a,graph:r}})(t,(t=>t.data.weight||1)||m);return null===(r=((t,e,r)=>{let n=[];const o=e[e.length-1],i=e[0];let s;for(;t.getAllNodes().length;){for(;s=i.dequeue();)y(t,e,r,s);for(;s=o.dequeue();)y(t,e,r,s);if(t.getAllNodes().length)for(let o=e.length-2;o>0;--o)if(s=e[o].dequeue(),s){n=n.concat(y(t,e,r,s,!0));break}}return n})(n.graph,n.buckets,n.zeroIdx).map((e=>t.getRelatedEdges(e.v,"out").filter((({target:t})=>t===e.w)))))||void 0===r?void 0:r.flat()})(t):b(t);null==r||r.forEach((e=>{const r=e.data;t.removeEdge(e.id),r.forwardName=e.data.name,r.reversed=!0,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign({},r)})}))},b=t=>{const e=[],r={},n={},o=i=>{n[i]||(n[i]=!0,r[i]=!0,t.getRelatedEdges(i,"out").forEach((t=>{r[t.target]?e.push(t):o(t.target)})),delete r[i])};return t.getAllNodes().forEach((t=>o(t.id))),e},E=(t,e,r,n)=>{let o;do{o=`${n}${Math.random()}`}while(t.hasNode(o));return r.dummy=e,t.addNode({id:o,data:r}),o},N=t=>{const e=new h;return t.getAllNodes().forEach((r=>{t.getChildren(r.id).length||e.addNode(Object.assign({},r))})),t.getAllEdges().forEach((t=>{e.addEdge(t)})),e},M=(t,e)=>{const r=Number(t.x),n=Number(t.y),o=Number(e.x)-r,i=Number(e.y)-n;let s,a,u=Number(t.width)/2,h=Number(t.height)/2;return o||i?(Math.abs(i)*u>Math.abs(o)*h?(i<0&&(h=-h),s=h*o/i,a=h):(o<0&&(u=-u),s=u,a=u*i/o),{x:r+s,y:n+a}):{x:0,y:0}},_=t=>{const e=[],r=A(t)+1;for(let t=0;t<r;t++)e.push([]);t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&e[r]&&e[r].push(t.id)}));for(let n=0;n<r;n++)e[n]=e[n].sort(((e,r)=>{return n=t.getNode(e).data.order,o=t.getNode(r).data.order,Number(n)-Number(o);var n,o}));return e},k=(t,e,r,n)=>{const o={width:0,height:0};return l(r)&&l(n)&&(o.rank=r,o.order=n),E(t,"border",o,e)},A=t=>{let e;return t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&(void 0===e||r>e)&&(e=r)})),e||(e=0),e},j=(t,e)=>t.reduce(((t,r)=>e(t)>e(r)?r:t)),S=(t,e,r,n,o,i)=>{n.includes(e.id)||(n.push(e.id),r||i.push(e.id),o(e.id).forEach((e=>S(t,e,r,n,o,i))),r&&i.push(e.id))},O=(t,e,r,n)=>{const o=Array.isArray(e)?e:[e],i=e=>n?t.getSuccessors(e):t.getNeighbors(e),s=[],a=[];return o.forEach((e=>{if(!t.hasNode(e.id))throw new Error(`Graph does not have node: ${e}`);S(t,e,"post"===r,a,i,s)})),s},z=(t,e,r,n,o,i)=>{const s={rank:i,borderType:e,width:0,height:0},a=o.data[e][i-1],u=E(t,"border",s,r);o.data[e][i]=u,t.setParent(u,n),a&&t.addEdge({id:`e${Math.random()}`,source:a,target:u,data:{weight:1}})},R=t=>{t.getAllNodes().forEach((t=>{I(t)})),t.getAllEdges().forEach((t=>{I(t)}))},I=t=>{const e=t.data.width;t.data.width=t.data.height,t.data.height=e},C=t=>{(null==t?void 0:t.y)&&(t.y=-t.y)},D=t=>{const e=t.x;t.x=t.y,t.y=e},P=(t,e,r,n,o,i,s)=>{const a=t.getChildren(s);if(!(null==a?void 0:a.length))return void(s!==e&&t.addEdge({id:`e${Math.random()}`,source:e,target:s,data:{weight:0,minlen:r}}));const u=k(t,"_bt"),h=k(t,"_bb"),d=t.getNode(s);t.setParent(u,s),d.data.borderTop=u,t.setParent(h,s),d.data.borderBottom=h,null==a||a.forEach((a=>{P(t,e,r,n,o,i,a.id);const d=a.data.borderTop?a.data.borderTop:a.id,c=a.data.borderBottom?a.data.borderBottom:a.id,l=a.data.borderTop?n:2*n,f=d!==c?1:o-i[s]+1;t.addEdge({id:`e${Math.random()}`,source:u,target:d,data:{minlen:f,weight:l,nestingEdge:!0}}),t.addEdge({id:`e${Math.random()}`,source:c,target:h,data:{minlen:f,weight:l,nestingEdge:!0}})})),t.getParent(s)||t.addEdge({id:`e${Math.random()}`,source:e,target:u,data:{weight:0,minlen:o+i[s]}})},T="edge-label",L=function(t){return Array.isArray?Array.isArray(t):c(t,"Array")};var F=function(t){if("object"!=typeof t||null===t)return t;var e;if(L(t)){e=[];for(var r=0,n=t.length;r<n;r++)"object"==typeof t[r]&&null!=t[r]?e[r]=F(t[r]):e[r]=t[r]}else for(var o in e={},t)"object"==typeof t[o]&&null!=t[o]?e[o]=F(t[o]):e[o]=t[o];return e};const q=F,V=(t,e,r)=>{const n=(s=r,a=r.map(((t,e)=>e)),null==s?void 0:s.reduce(((t,e,r)=>(t[e]=a[r],t)),{})),o=e.map((e=>{const r=t.getRelatedEdges(e,"out").map((t=>({pos:n[t.target]||0,weight:t.data.weight})));return null==r?void 0:r.sort(((t,e)=>t.pos-e.pos))})),i=o.flat().filter((t=>void 0!==t));var s,a;let u=1;for(;u<r.length;)u<<=1;const h=2*u-1;u-=1;const d=Array(h).fill(0,0,h);let c=0;return null==i||i.forEach((t=>{if(t){let e=t.pos+u;d[e]+=t.weight;let r=0;for(;e>0;)e%2&&(r+=d[e+1]),e=e-1>>1,d[e]+=t.weight;c+=t.weight*r}})),c},B=(t,e)=>{let r=0;for(let n=1;n<(null==e?void 0:e.length);n+=1)r+=V(t,e[n-1],e[n]);return r},$=t=>{const e={},r=t.getAllNodes(),n=r.map((t=>{var e;return null!==(e=t.data.rank)&&void 0!==e?e:-1/0})),o=Math.max(...n),i=[];for(let t=0;t<o+1;t++)i.push([]);const s=r.sort(((e,r)=>t.getNode(e.id).data.rank-t.getNode(r.id).data.rank)),a=s.filter((e=>void 0!==t.getNode(e.id).data.fixorder)).sort(((e,r)=>t.getNode(e.id).data.fixorder-t.getNode(r.id).data.fixorder));return null==a||a.forEach((r=>{isNaN(t.getNode(r.id).data.rank)||i[t.getNode(r.id).data.rank].push(r.id),e[r.id]=!0})),null==s||s.forEach((r=>t.dfsTree(r.id,(t=>{if(e.hasOwnProperty(t.id))return!0;e[t.id]=!0,isNaN(t.data.rank)||i[t.data.rank].push(t.id)})))),i},U=(t,e)=>{var r;let n=0,o=0;t.weight&&(n+=t.barycenter*t.weight,o+=t.weight),e.weight&&(n+=e.barycenter*e.weight,o+=e.weight),t.vs=null===(r=e.vs)||void 0===r?void 0:r.concat(t.vs),t.barycenter=n/o,t.weight=o,t.i=Math.min(e.i,t.i),e.merged=!0},G=(t,e)=>{var r,n,o;const i={};null==t||t.forEach(((t,e)=>{i[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};const r=i[t.v];void 0!==t.barycenter&&(r.barycenter=t.barycenter,r.weight=t.weight)})),null===(r=e.getAllEdges())||void 0===r||r.forEach((t=>{const e=i[t.source],r=i[t.target];void 0!==e&&void 0!==r&&(r.indegree++,e.out.push(i[t.target]))}));return(t=>{var e,r;const n=[];for(;null==t?void 0:t.length;){const o=t.pop();n.push(o),null===(e=o.in.reverse())||void 0===e||e.forEach((t=>{return(e=o,t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&U(e,t)})(t);var e})),null===(r=o.out)||void 0===r||r.forEach((e=>{return(r=o,e=>{e.in.push(r),0==--e.indegree&&t.push(e)})(e);var r}))}const o=n.filter((t=>!t.merged)),i=["vs","i","barycenter","weight"];return o.map((t=>{const e={};return null==i||i.forEach((r=>{void 0!==t[r]&&(e[r]=t[r])})),e}))})(null===(o=(n=Object.values(i)).filter)||void 0===o?void 0:o.call(n,(t=>!t.indegree)))},W=(t,e,r)=>{let n,o=r;for(;e.length&&(n=e[e.length-1]).i<=o;)e.pop(),null==t||t.push(n.vs),o++;return o},Y=(t,e,r,n,o,i)=>{var s,a,u,h;let d=t.getChildren(e).map((t=>t.id));const c=t.getNode(e),l=c?c.data.borderLeft:void 0,f=c?c.data.borderRight:void 0,g={};l&&(d=null==d?void 0:d.filter((t=>t!==l&&t!==f)));const p=((t,e)=>e.map((e=>{const r=t.getRelatedEdges(e,"in");if(!(null==r?void 0:r.length))return{v:e};const n={sum:0,weight:0};return null==r||r.forEach((e=>{const r=t.getNode(e.source);n.sum+=e.data.weight*r.data.order,n.weight+=e.data.weight})),{v:e,barycenter:n.sum/n.weight,weight:n.weight}})))(t,d||[]);null==p||p.forEach((e=>{var o;if(null===(o=t.getChildren(e.v))||void 0===o?void 0:o.length){const o=Y(t,e.v,r,n,i);g[e.v]=o,o.hasOwnProperty("barycenter")&&K(e,o)}}));const v=G(p,r);H(v,g),null===(s=v.filter((t=>t.vs.length>0)))||void 0===s||s.forEach((e=>{const r=t.getNode(e.vs[0]);r&&(e.fixorder=r.data.fixorder,e.order=r.data.order)}));const m=((t,e,r,n)=>{const o=((t,e)=>{const r={lhs:[],rhs:[]};return null==t||t.forEach((t=>{(t=>{const e=t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder);return n?!e&&t.hasOwnProperty("barycenter"):e||t.hasOwnProperty("barycenter")})(t)?r.lhs.push(t):r.rhs.push(t)})),r})(t),i=o.lhs,s=o.rhs.sort(((t,e)=>-t.i- -e.i)),a=[];let u=0,h=0,d=0;null==i||i.sort(((t,e)=>(r,n)=>{if(void 0!==r.fixorder&&void 0!==n.fixorder)return r.fixorder-n.fixorder;if(r.barycenter<n.barycenter)return-1;if(r.barycenter>n.barycenter)return 1;if(e&&void 0!==r.order&&void 0!==n.order){if(r.order<n.order)return-1;if(r.order>n.order)return 1}return t?n.i-r.i:r.i-n.i})(!!e,!!r)),d=W(a,s,d),null==i||i.forEach((t=>{var e;d+=null===(e=t.vs)||void 0===e?void 0:e.length,a.push(t.vs),u+=t.barycenter*t.weight,h+=t.weight,d=W(a,s,d)}));const c={vs:a.flat()};return h&&(c.barycenter=u/h,c.weight=h),c})(v,n,o,i);if(l&&(m.vs=[l,m.vs,f].flat(),null===(a=t.getPredecessors(l))||void 0===a?void 0:a.length)){const e=t.getNode((null===(u=t.getPredecessors(l))||void 0===u?void 0:u[0].id)||""),r=t.getNode((null===(h=t.getPredecessors(f))||void 0===h?void 0:h[0].id)||"");m.hasOwnProperty("barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+e.data.order+r.data.order)/(m.weight+2),m.weight+=2}return m},H=(t,e)=>{null==t||t.forEach((t=>{var r;const n=null===(r=t.vs)||void 0===r?void 0:r.map((t=>e[t]?e[t].vs:t));t.vs=n.flat()}))},K=(t,e)=>{void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)},J=(t,e,r)=>e.map((e=>((t,e,r)=>{const n=(t=>{let e;for(;t.hasNode(e=`_root${Math.random()}`););return e})(t),o=new h({tree:[{id:n,children:[],data:{}}]});return t.getAllNodes().forEach((i=>{const s=t.getParent(i.id);(i.data.rank===e||i.data.minRank<=e&&e<=i.data.maxRank)&&(o.hasNode(i.id)||o.addNode(Object.assign({},i)),(null==s?void 0:s.id)&&!o.hasNode(null==s?void 0:s.id)&&o.addNode(Object.assign({},s)),o.setParent(i.id,(null==s?void 0:s.id)||n),t.getRelatedEdges(i.id,r).forEach((e=>{const r=e.source===i.id?e.target:e.source;o.hasNode(r)||o.addNode(Object.assign({},t.getNode(r)));const n=o.getRelatedEdges(r,"out").find((({target:t})=>t===i.id)),s=void 0!==n?n.data.weight:0;n?o.updateEdgeData(n.id,Object.assign(Object.assign({},n.data),{weight:e.data.weight+s})):o.addEdge({id:e.id,source:r,target:i.id,data:{weight:e.data.weight+s}})})),i.data.hasOwnProperty("minRank")&&o.updateNodeData(i.id,Object.assign(Object.assign({},i.data),{borderLeft:i.data.borderLeft[e],borderRight:i.data.borderRight[e]})))})),o})(t,e,r))),Q=(t,e,r,n)=>{const o=new h;null==t||t.forEach((t=>{var i;const s=t.getRoots()[0].id,a=Y(t,s,o,e,r,n);for(let e=0;e<(null===(i=a.vs)||void 0===i?void 0:i.length);e++){const r=t.getNode(a.vs[e]);r&&(r.data.order=e)}((t,e,r)=>{const n={};let o;null==r||r.forEach((r=>{let i,s,a=t.getParent(r);for(;a;){if(i=t.getParent(a.id),i?(s=n[i.id],n[i.id]=a.id):(s=o,o=a.id),s&&s!==a.id)return e.hasNode(s)||e.addNode({id:s,data:{}}),e.hasNode(a.id)||e.addNode({id:a.id,data:{}}),void(e.hasEdge(`e${s}-${a.id}`)||e.addEdge({id:`e${s}-${a.id}`,source:s,target:a.id,data:{}}));a=i}}))})(t,o,a.vs)}))},X=(t,e)=>{null==e||e.forEach((e=>{null==e||e.forEach(((e,r)=>{t.getNode(e).data.order=r}))}))},Z=(t,e)=>{var r,n;if(null===(r=t.getNode(e))||void 0===r?void 0:r.data.dummy)return null===(n=t.getPredecessors(e))||void 0===n?void 0:n.find((e=>t.getNode(e.id).data.dummy))},tt=(t,e,r)=>{let n=e,o=r;if(n>o){const t=n;n=o,o=t}let i=t[n];i||(t[n]=i={}),i[o]=!0},et=(t,e,r)=>{let n=e,o=r;return n>r&&(n=r,o=e),!!t[n]},rt=(t,e,r,n,o,i)=>{const s=new h,a=nt(n,o,i);return null==e||e.forEach((e=>{let n;null==e||e.forEach((e=>{const o=r[e];if(s.hasNode(o)||s.addNode({id:o,data:{}}),n){const i=r[n],u=s.getRelatedEdges(i,"out").find((t=>t.target===o));u?s.updateEdgeData(u.id,Object.assign(Object.assign({},u.data),{weight:Math.max(a(t,e,n),u.data.weight||0)})):s.addEdge({id:`e${Math.random()}`,source:i,target:o,data:{weight:Math.max(a(t,e,n),0)}})}n=e}))})),s};const nt=(t,e,r)=>(n,o,i)=>{const s=n.getNode(o),a=n.getNode(i);let u=0,h=0;if(u+=s.data.width/2,s.data.hasOwnProperty("labelpos"))switch((s.data.labelpos||"").toLowerCase()){case"l":h=-s.data.width/2;break;case"r":h=s.data.width/2}if(h&&(u+=r?h:-h),h=0,u+=(s.data.dummy?e:t)/2,u+=(a.data.dummy?e:t)/2,u+=a.data.width/2,a.data.labelpos)switch((a.data.labelpos||"").toLowerCase()){case"l":h=a.data.width/2;break;case"r":h=-a.data.width/2}return h&&(u+=r?h:-h),h=0,u},ot=(t,e)=>t.getNode(e).data.width||0,it=(t,e)=>{var r;const n=N(t);((t,e)=>{const{ranksep:r=0}=e||{},n=_(t);let o=0;null==n||n.forEach((e=>{const n=e.map((e=>t.getNode(e).data.height)),i=Math.max(...n,0);null==e||e.forEach((e=>{t.getNode(e).data.y=o+i/2})),o+=i+r}))})(n,e);const o=((t,e)=>{const{align:r,nodesep:n=0,edgesep:o=0}=e||{},i=_(t),s=Object.assign(((t,e)=>{const r={};return(null==e?void 0:e.length)&&e.reduce(((e,n)=>{let o=0,i=0;const s=e.length,a=null==n?void 0:n[(null==n?void 0:n.length)-1];return null==n||n.forEach(((e,u)=>{var h;const d=Z(t,e),c=d?t.getNode(d.id).data.order:s;(d||e===a)&&(null===(h=n.slice(i,u+1))||void 0===h||h.forEach((e=>{var n;null===(n=t.getPredecessors(e))||void 0===n||n.forEach((n=>{var i;const s=t.getNode(n.id),a=s.data.order;!(a<o||c<a)||s.data.dummy&&(null===(i=t.getNode(e))||void 0===i?void 0:i.data.dummy)||tt(r,n.id,e)}))})),i=u+1,o=c)})),n})),r})(t,i),((t,e)=>{const r={};function n(e,n){const o=function(t){return JSON.stringify(t.slice(1))}(e);n.get(o)||(function(e,n,o,i,s){var a,u;let h;for(let d=n;d<o;d++)h=e[d],(null===(a=t.getNode(h))||void 0===a?void 0:a.data.dummy)&&(null===(u=t.getPredecessors(h))||void 0===u||u.forEach((e=>{const n=t.getNode(e.id);n.data.dummy&&(n.data.order<i||n.data.order>s)&&tt(r,e.id,h)})))}(...e),n.set(o,!0))}return(null==e?void 0:e.length)&&e.reduce(((e,r)=>{let o,i=-1,s=0;const a=new Map;return null==r||r.forEach(((u,h)=>{var d;if("border"===(null===(d=t.getNode(u))||void 0===d?void 0:d.data.dummy)){const e=t.getPredecessors(u)||[];e.length&&(o=t.getNode(e[0].id).data.order,n([r,s,h,i,o],a),s=h,i=o)}n([r,s,r.length,o,e.length],a)})),r})),r})(t,i)),a={};let u=[];["u","d"].forEach((e=>{u="u"===e?i:Object.values(i).reverse(),["l","r"].forEach((r=>{"r"===r&&(u=u.map((t=>Object.values(t).reverse())));const i=("u"===e?t.getPredecessors:t.getSuccessors).bind(t),h=((t,e,r,n)=>{const o={},i={},s={};return null==e||e.forEach((t=>{null==t||t.forEach(((t,e)=>{o[t]=t,i[t]=t,s[t]=e}))})),null==e||e.forEach((t=>{let e=-1;null==t||t.forEach((t=>{let a=n(t).map((t=>t.id));if(a.length){a=a.sort(((t,e)=>s[t]-s[e]));const n=(a.length-1)/2;for(let u=Math.floor(n),h=Math.ceil(n);u<=h;++u){const n=a[u];i[t]===t&&e<s[n]&&!et(r,t,n)&&(i[n]=t,i[t]=o[t]=o[n],e=s[n])}}}))})),{root:o,align:i}})(0,u,s,i),d=((t,e,r,n,o,i,s)=>{var a;const u={},h=rt(t,e,r,o,i,s),d=s?"borderLeft":"borderRight",c=(t,e)=>{let r=h.getAllNodes(),n=r.pop();const o={};for(;n;)o[n.id]?t(n.id):(o[n.id]=!0,r.push(n),r=r.concat(e(n.id))),n=r.pop()};return c((t=>{u[t]=(h.getRelatedEdges(t,"in")||[]).reduce(((t,e)=>Math.max(t,(u[e.source]||0)+e.data.weight)),0)}),h.getPredecessors.bind(h)),c((e=>{const r=(h.getRelatedEdges(e,"out")||[]).reduce(((t,e)=>Math.min(t,(u[e.target]||0)-e.data.weight)),Number.POSITIVE_INFINITY),n=t.getNode(e);r!==Number.POSITIVE_INFINITY&&n.data.borderType!==d&&(u[e]=Math.max(u[e],r))}),h.getSuccessors.bind(h)),null===(a=Object.values(n))||void 0===a||a.forEach((t=>{u[t]=u[r[t]]})),u})(t,u,h.root,h.align,n,o,"r"===r);"r"===r&&Object.keys(d).forEach((t=>d[t]=-d[t])),a[e+r]=d}))}));const h=((t,e)=>j(Object.values(e),(e=>{var r;let n=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return null===(r=Object.keys(e))||void 0===r||r.forEach((r=>{const i=e[r],s=ot(t,r)/2;n=Math.max(i+s,n),o=Math.min(i-s,o)})),n-o})))(t,a);return h&&function(t,e){const r=Object.values(e),n=Math.min(...r),o=Math.max(...r);["u","d"].forEach((r=>{["l","r"].forEach((i=>{const s=r+i,a=t[s];let u;if(a===e)return;const h=Object.values(a);u="l"===i?n-Math.min(...h):o-Math.max(...h),u&&(t[s]={},Object.keys(a).forEach((e=>{t[s][e]=a[e]+u})))}))}))}(a,h),((t,e)=>{const r={};return Object.keys(t.ul).forEach((n=>{if(e)r[n]=t[e.toLowerCase()][n];else{const e=Object.values(t).map((t=>t[n]));r[n]=(e[0]+e[1])/2}})),r})(a,r)})(n,e);null===(r=Object.keys(o))||void 0===r||r.forEach((t=>{n.getNode(t).data.x=o[t]}))},st=t=>{const e={},r=n=>{var o;const i=t.getNode(n);if(!i)return 0;if(e[n])return i.data.rank;let s;return e[n]=!0,null===(o=t.getRelatedEdges(n,"out"))||void 0===o||o.forEach((t=>{const e=r(t.target)-t.data.minlen;e&&(void 0===s||e<s)&&(s=e)})),s||(s=0),i.data.rank=s,s};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>r(t.id)))},at=(t,e)=>t.getNode(e.target).data.rank-t.getNode(e.source).data.rank-e.data.minlen,ut=(t,e)=>{const r=n=>{e.getRelatedEdges(n,"both").forEach((o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||at(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},ht=(t,e)=>{const r=n=>{var o;null===(o=e.getRelatedEdges(n,"both"))||void 0===o||o.forEach((o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||void 0===e.getNode(s).data.layer&&at(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},dt=(t,e)=>j(e.getAllEdges(),(r=>t.hasNode(r.source)!==t.hasNode(r.target)?at(e,r):1/0)),ct=(t,e,r)=>{t.getAllNodes().forEach((t=>{const n=e.getNode(t.id);n.data.rank||(n.data.rank=0),n.data.rank+=r}))},lt=(t,e)=>{let r=O(t,t.getAllNodes(),"post",!1);r=r.slice(0,(null==r?void 0:r.length)-1),r.forEach((r=>{ft(t,e,r)}))},ft=(t,e,r)=>{const n=t.getNode(r).data.parent;t.getRelatedEdges(r,"both").find((t=>t.target===n||t.source===n)).data.cutvalue=gt(t,e,r)},gt=(t,e,r)=>{const n=t.getNode(r).data.parent;let o=!0,i=e.getRelatedEdges(r,"out").find((t=>t.target===n)),s=0;return i||(o=!1,i=e.getRelatedEdges(n,"out").find((t=>t.target===r))),s=i.data.weight,e.getRelatedEdges(r,"both").forEach((e=>{const i=e.source===r,a=i?e.target:e.source;if(a!==n){const n=i===o,u=e.data.weight;if(s+=n?u:-u,bt(t,r,a)){const e=t.getRelatedEdges(r,"both").find((t=>t.source===a||t.target===a)).data.cutvalue;s+=n?-e:e}}})),s},pt=(t,e=t.getAllNodes()[0].id)=>{vt(t,{},1,e)},vt=(t,e,r,n,o)=>{var i;const s=r;let a=r;const u=t.getNode(n);return e[n]=!0,null===(i=t.getNeighbors(n))||void 0===i||i.forEach((r=>{e[r.id]||(a=vt(t,e,a,r.id,n))})),u.data.low=s,u.data.lim=a++,o?u.data.parent=o:delete u.data.parent,a},mt=t=>t.getAllEdges().find((t=>t.data.cutvalue<0)),yt=(t,e,r)=>{let n=r.source,o=r.target;e.getRelatedEdges(n,"out").find((t=>t.target===o))||(n=r.target,o=r.source);const i=t.getNode(n),s=t.getNode(o);let a=i,u=!1;i.data.lim>s.data.lim&&(a=s,u=!0);const h=e.getAllEdges().filter((e=>u===Et(t.getNode(e.source),a)&&u!==Et(t.getNode(e.target),a)));return j(h,(t=>at(e,t)))},wt=(t,e,r,n)=>{const o=t.getRelatedEdges(r.source,"both").find((t=>t.source===r.target||t.target===r.target));o&&t.removeEdge(o.id),t.addEdge({id:`e${Math.random()}`,source:n.source,target:n.target,data:{}}),pt(t),lt(t,e),xt(t,e)},xt=(t,e)=>{const r=t.getAllNodes().find((t=>!t.data.parent));let n=O(t,r,"pre",!1);n=n.slice(1),n.forEach((r=>{const n=t.getNode(r).data.parent;let o=e.getRelatedEdges(r,"out").find((t=>t.target===n)),i=!1;!o&&e.hasNode(n)&&(o=e.getRelatedEdges(n,"out").find((t=>t.target===r)),i=!0),e.getNode(r).data.rank=(e.hasNode(n)&&e.getNode(n).data.rank||0)+(i?null==o?void 0:o.data.minlen:-(null==o?void 0:o.data.minlen))}))},bt=(t,e,r)=>t.getRelatedEdges(e,"both").find((t=>t.source===r||t.target===r)),Et=(t,e)=>e.data.low<=t.data.lim&&t.data.lim<=e.data.lim,Nt=st,Mt=t=>{(t=>{const e=(t=>{const e=new h;return t.getAllNodes().forEach((t=>{e.addNode(Object.assign({},t))})),t.getAllEdges().forEach((t=>{const r=e.getRelatedEdges(t.source,"out").find((e=>e.target===t.target));r?e.updateEdgeData(null==r?void 0:r.id,Object.assign(Object.assign({},r.data),{weight:r.data.weight+t.data.weight||0,minlen:Math.max(r.data.minlen,t.data.minlen||1)})):e.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||0,minlen:t.data.minlen||1}})})),e})(t);st(e);const r=(t=>{const e=new h({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);ut(e,t)<n;)o=dt(e,t),i=e.hasNode(o.source)?at(t,o):-at(t,o),ct(e,t,i);return e})(e);let n,o;for(pt(r),lt(r,e);n=mt(r);)o=yt(r,e,n),wt(r,e,n,o)})(t)},_t=(t,e)=>{const{acyclicer:r,ranker:n,rankdir:o="tb",nodeOrder:i,keepNodeOrder:s,align:a,nodesep:u=50,edgesep:d=20,ranksep:c=50}=e;Ft(t),x(t,r);const{nestingRoot:l,nodeRankFactor:f}=(t=>{const e=E(t,"root",{},"_root"),r=(t=>{const e={},r=(n,o)=>{const i=t.getChildren(n);null==i||i.forEach((t=>r(t.id,o+1))),e[n]=o};return t.getRoots().forEach((t=>r(t.id,1))),e})(t);let n=Math.max(...Object.values(r));Math.abs(n)===1/0&&(n=1);const o=n-1,i=2*o+1;t.getAllEdges().forEach((t=>{t.data.minlen*=i}));const s=(t=>{let e=0;return t.getAllEdges().forEach((t=>{e+=t.data.weight})),e})(t)+1;return t.getRoots().forEach((n=>{P(t,e,i,s,o,r,n.id)})),{nestingRoot:e,nodeRankFactor:i}})(t);((t,e)=>{switch(e){case"network-simplex":Mt(t);break;case"tight-tree":default:(t=>{(t=>{const e={};let r;const n=o=>{var i;const s=t.getNode(o);if(!s)return 0;if(e[o])return s.data.rank;let a;return e[o]=!0,null===(i=t.getRelatedEdges(o,"out"))||void 0===i||i.forEach((t=>{const e=n(t.target)-t.data.minlen;e&&(void 0===a||e<a)&&(a=e)})),a||(a=0),(void 0===r||a<r)&&(r=a),s.data.rank=a,a};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>{t&&n(t.id)})),void 0===r&&(r=0);const o={},i=(e,r)=>{var n;const s=t.getNode(e),a=isNaN(s.data.layer)?r:s.data.layer;(void 0===s.data.rank||s.data.rank<a)&&(s.data.rank=a),o[e]||(o[e]=!0,null===(n=t.getRelatedEdges(e,"out"))||void 0===n||n.forEach((t=>{i(t.target,a+t.data.minlen)})))};t.getAllNodes().forEach((t=>{const e=t.data;e&&(isNaN(e.layer)?e.rank-=r:i(t.id,e.layer))}))})(t),(t=>{const e=new h({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);ht(e,t)<n;)o=dt(e,t),i=e.hasNode(o.source)?at(t,o):-at(t,o),ct(e,t,i)})(t)})(t);break;case"longest-path":Nt(t)}})(N(t),n),zt(t),((t,e=0)=>{const r=t.getAllNodes(),n=r.filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),o=Math.min(...n),i=[];r.forEach((t=>{const e=(t.data.rank||0)-o;i[e]||(i[e]=[]),i[e].push(t.id)}));let s=0;for(let r=0;r<i.length;r++){const n=i[r];void 0===n?r%e!=0&&(s-=1):s&&(null==n||n.forEach((e=>{const r=t.getNode(e);r&&(r.data.rank=r.data.rank||0,r.data.rank+=s)})))}})(t,f),((t,e)=>{e&&t.removeNode(e),t.getAllEdges().forEach((e=>{e.data.nestingEdge&&t.removeEdge(e.id)}))})(t,l),(t=>{const e=t.getAllNodes().filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),r=Math.min(...e);t.getAllNodes().forEach((t=>{t.data.hasOwnProperty("rank")&&r!==1/0&&(t.data.rank-=r)}))})(t),Rt(t),It(t);const g=[];((t,e)=>{t.getAllEdges().forEach((r=>((t,e,r)=>{let n=e.source,o=t.getNode(n).data.rank;const i=e.target,s=t.getNode(i).data.rank,a=e.data.labelRank;if(s===o+1)return;let u,h,d;for(t.removeEdge(e.id),d=0,++o;o<s;++d,++o)e.data.points=[],h={originalEdge:e,width:0,height:0,rank:o},u=E(t,"edge",h,"_d"),o===a&&(h.width=e.data.width,h.height=e.data.height,h.dummy=T,h.labelpos=e.data.labelpos),t.addEdge({id:`e${Math.random()}`,source:n,target:u,data:{weight:e.data.weight}}),0===d&&r.push(u),n=u;t.addEdge({id:`e${Math.random()}`,source:n,target:i,data:{weight:e.data.weight}})})(t,r,e)))})(t,g),((t,e)=>{const r=(t=>{const e={};let r=0;const n=o=>{const i=r;t.getChildren(o).forEach((t=>n(t.id))),e[o]={low:i,lim:r++}};return t.getRoots().forEach((t=>n(t.id))),e})(t);e.forEach((e=>{var n,o;let i=e,s=t.getNode(i);const a=s.data.originalEdge;if(!a)return;const u=((t,e,r,n)=>{var o,i;const s=[],a=[],u=Math.min(e[r].low,e[n].low),h=Math.max(e[r].lim,e[n].lim);let d,c;d=r;do{d=null===(o=t.getParent(d))||void 0===o?void 0:o.id,s.push(d)}while(d&&(e[d].low>u||h>e[d].lim));for(c=d,d=n;d&&d!==c;)a.push(d),d=null===(i=t.getParent(d))||void 0===i?void 0:i.id;return{lca:c,path:s.concat(a.reverse())}})(t,r,a.source,a.target),h=u.path,d=u.lca;let c=0,l=h[c],f=!0;for(;i!==a.target;){if(s=t.getNode(i),f){for(;l!==d&&(null===(n=t.getNode(l))||void 0===n?void 0:n.data.maxRank)<s.data.rank;)c++,l=h[c];l===d&&(f=!1)}if(!f){for(;c<h.length-1&&(null===(o=t.getNode(h[c+1]))||void 0===o?void 0:o.data.minRank)<=s.data.rank;)c++;l=h[c]}t.hasNode(l)&&t.setParent(i,l),i=t.getSuccessors(i)[0].id}}))})(t,g),(t=>{const e=r=>{const n=t.getChildren(r),o=t.getNode(r);if((null==n?void 0:n.length)&&n.forEach((t=>e(t.id))),o.data.hasOwnProperty("minRank")){o.data.borderLeft=[],o.data.borderRight=[];for(let e=o.data.minRank,n=o.data.maxRank+1;e<n;e+=1)z(t,"borderLeft","_bl",r,o,e),z(t,"borderRight","_br",r,o,e)}};t.getRoots().forEach((t=>e(t.id)))})(t),s&&((t,e)=>{const r=t.getAllNodes().filter((e=>{var r;return!(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length)})).map((t=>t.data.rank)),n=Math.max(...r),o=[];for(let t=0;t<n+1;t++)o[t]=[];null==e||e.forEach((e=>{const r=t.getNode(e);r&&!r.data.dummy&&(isNaN(r.data.rank)||(r.data.fixorder=o[r.data.rank].length,o[r.data.rank].push(e)))}))})(t,i),((t,e)=>{const r=A(t),n=[],o=[];for(let t=1;t<r+1;t++)n.push(t);for(let t=r-1;t>-1;t--)o.push(t);const i=J(t,n,"in"),s=J(t,o,"out");let a=$(t);X(t,a);let u,h=Number.POSITIVE_INFINITY;for(let r=0,n=0;n<4;++r,++n){Q(r%2?i:s,r%4>=2,!1,e),a=_(t);const o=B(t,a);o<h&&(n=0,u=q(a),h=o)}a=$(t),X(t,a);for(let r=0,n=0;n<4;++r,++n){Q(r%2?i:s,r%4>=2,!0,e),a=_(t);const o=B(t,a);o<h&&(n=0,u=q(a),h=o)}X(t,u)})(t,s),qt(t),((t,e)=>{const r=e.toLowerCase();"lr"!==r&&"rl"!==r||R(t)})(t,o),it(t,{align:a,nodesep:u,edgesep:d,ranksep:c}),Vt(t),Lt(t),((t,e)=>{e.forEach((e=>{let r=t.getNode(e);const{data:n}=r,o=n.originalEdge;let i;o&&t.addEdge(o);let s=e;for(;r.data.dummy;)i=t.getSuccessors(s)[0],t.removeNode(s),o.data.points.push({x:r.data.x,y:r.data.y}),r.data.dummy===T&&(o.data.x=r.data.x,o.data.y=r.data.y,o.data.width=r.data.width,o.data.height=r.data.height),s=i.id,r=t.getNode(s)}))})(t,g),Pt(t),((t,e)=>{const r=e.toLowerCase();"bt"!==r&&"rl"!==r||(t=>{t.getAllNodes().forEach((t=>{C(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>C(t))),t.data.hasOwnProperty("y")&&C(t.data)}))})(t),"lr"!==r&&"rl"!==r||((t=>{t.getAllNodes().forEach((t=>{D(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>D(t))),t.data.hasOwnProperty("x")&&D(t.data)}))})(t),R(t))})(t,o);const{width:p,height:v}=Ct(t);return Dt(t),Tt(t),(t=>{t.getAllEdges().forEach((e=>{const r=e.data;if(r.reversed){t.removeEdge(e.id);const n=r.forwardName;delete r.reversed,delete r.forwardName,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign(Object.assign({},r),{forwardName:n})})}}))})(t),{width:p,height:v}},kt=["width","height","layer","fixorder"],At={width:0,height:0},jt=["minlen","weight","width","height","labeloffset"],St={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ot=["labelpos"],zt=t=>{t.getAllEdges().forEach((e=>{if(e.data.width&&e.data.height){const r=t.getNode(e.source),n={e,rank:(t.getNode(e.target).data.rank-r.data.rank)/2+r.data.rank};E(t,"edge-proxy",n,"_ep")}}))},Rt=t=>{let e=0;return t.getAllNodes().forEach((r=>{var n,o;r.data.borderTop&&(r.data.minRank=null===(n=t.getNode(r.data.borderTop))||void 0===n?void 0:n.data.rank,r.data.maxRank=null===(o=t.getNode(r.data.borderBottom))||void 0===o?void 0:o.data.rank,e=Math.max(e,r.data.maxRank||-1/0))})),e},It=t=>{t.getAllNodes().forEach((e=>{"edge-proxy"===e.data.dummy&&(t.getEdge(e.data.e.id).data.labelRank=e.data.rank,t.removeNode(e.id))}))},Ct=(t,e)=>{let r,n,o=0,i=0;const{marginx:s=0,marginy:a=0}=e||{},u=t=>{if(!t.data)return;const e=t.data.x,s=t.data.y,a=t.data.width,u=t.data.height;isNaN(e)||isNaN(a)||(void 0===r&&(r=e-a/2),r=Math.min(r,e-a/2),o=Math.max(o,e+a/2)),isNaN(s)||isNaN(u)||(void 0===n&&(n=s-u/2),n=Math.min(n,s-u/2),i=Math.max(i,s+u/2))};return t.getAllNodes().forEach((t=>{u(t)})),t.getAllEdges().forEach((t=>{(null==t?void 0:t.data.hasOwnProperty("x"))&&u(t)})),r-=s,n-=a,t.getAllNodes().forEach((t=>{t.data.x-=r,t.data.y-=n})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>{t.x-=r,t.y-=n})),t.data.hasOwnProperty("x")&&(t.data.x-=r),t.data.hasOwnProperty("y")&&(t.data.y-=n)})),{width:o-r+s,height:i-n+a}},Dt=t=>{t.getAllEdges().forEach((e=>{const r=t.getNode(e.source),n=t.getNode(e.target);let o,i;e.data.points?(o=e.data.points[0],i=e.data.points[e.data.points.length-1]):(e.data.points=[],o={x:n.data.x,y:n.data.y},i={x:r.data.x,y:r.data.y}),e.data.points.unshift(M(r.data,o)),e.data.points.push(M(n.data,i))}))},Pt=t=>{t.getAllEdges().forEach((t=>{if(t.data.hasOwnProperty("x"))switch("l"!==t.data.labelpos&&"r"!==t.data.labelpos||(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset}}))},Tt=t=>{t.getAllEdges().forEach((t=>{var e;t.data.reversed&&(null===(e=t.data.points)||void 0===e||e.reverse())}))},Lt=t=>{t.getAllNodes().forEach((e=>{var r,n,o;if(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length){const r=t.getNode(e.id),i=t.getNode(r.data.borderTop),s=t.getNode(r.data.borderBottom),a=t.getNode(r.data.borderLeft[(null===(n=r.data.borderLeft)||void 0===n?void 0:n.length)-1]),u=t.getNode(r.data.borderRight[(null===(o=r.data.borderRight)||void 0===o?void 0:o.length)-1]);r.data.width=Math.abs((null==u?void 0:u.data.x)-(null==a?void 0:a.data.x))||10,r.data.height=Math.abs((null==s?void 0:s.data.y)-(null==i?void 0:i.data.y))||10,r.data.x=((null==a?void 0:a.data.x)||0)+r.data.width/2,r.data.y=((null==i?void 0:i.data.y)||0)+r.data.height/2}})),t.getAllNodes().forEach((e=>{"border"===e.data.dummy&&t.removeNode(e.id)}))},Ft=t=>{t.getAllEdges().forEach((e=>{if(e.source===e.target){const r=t.getNode(e.source);r.data.selfEdges||(r.data.selfEdges=[]),r.data.selfEdges.push(e),t.removeEdge(e.id)}}))},qt=t=>{const e=_(t);null==e||e.forEach((e=>{let r=0;null==e||e.forEach(((e,n)=>{var o;const i=t.getNode(e);i.data.order=n+r,null===(o=i.data.selfEdges)||void 0===o||o.forEach((e=>{E(t,"selfedge",{width:e.data.width,height:e.data.height,rank:i.data.rank,order:n+ ++r,e},"_se")})),delete i.data.selfEdges}))}))},Vt=t=>{t.getAllNodes().forEach((e=>{const r=t.getNode(e.id);if("selfedge"===r.data.dummy){const n=t.getNode(r.data.e.source),o=n.data.x+n.data.width/2,i=n.data.y,s=r.data.x-o,a=n.data.height/2;t.hasEdge(r.data.e.id)?t.updateEdgeData(r.data.e.id,r.data.e.data):t.addEdge({id:r.data.e.id,source:r.data.e.source,target:r.data.e.target,data:r.data.e.data}),t.removeNode(e.id),r.data.e.data.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{y:i,x:o+s},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.data.e.data.x=r.data.x,r.data.e.data.y=r.data.y}}))},Bt=(t,e)=>{const r={};return null==e||e.forEach((e=>{void 0!==t[e]&&(r[e]=+t[e])})),r},$t=(t={})=>{const e={};return Object.keys(t).forEach((r=>{e[r.toLowerCase()]=t[r]})),e},Ut=function(t){return"function"==typeof t},Gt=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};function Wt(t,e){let r;return r=Ut(e)?e:l(e)?()=>e:()=>t,r}function Yt(t,e,r=!0){return e||0===e?Ut(e)?e:l(e)?()=>e:Array.isArray(e)?()=>{if(r){const r=Math.max(...e);return isNaN(r)?t:r}return e}:Gt(e)?()=>{if(r){const r=Math.max(e.width,e.height);return isNaN(r)?t:r}return[e.width,e.height]}:()=>t:e=>{const{size:r}=e.data||{};return r?Array.isArray(r)?r[0]>r[1]?r[0]:r[1]:Gt(r)?r.width>r.height?r.width:r.height:r:t}}const Ht=(t,e)=>{let r,n;return n=l(e)?()=>e:Ut(e)?e:()=>0,r=t?Array.isArray(t)?e=>(t[0]>t[1]?t[0]:t[1])+n(e):Ut(t)?t:e=>t+n(e):t=>{var e,r;if(null===(e=t.data)||void 0===e?void 0:e.bboxSize)return Math.max(t.data.bboxSize[0],t.data.bboxSize[1])+n(t);if(null===(r=t.data)||void 0===r?void 0:r.size){if(Array.isArray(t.data.size))return Math.max(t.data.size[0],t.data.size[1])+n(t);const e=t.data.size;return Gt(e)?(e.width>e.height?e.width:e.height)+n(t):e+n(t)}return 10+n(t)},r},Kt=t=>{if(null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array){const e=[];return t.forEach((t=>{e.push(t)})),e.map((t=>Kt(t)))}if("object"==typeof t){const e={};return Object.keys(t).forEach((r=>{e[r]=Kt(t[r])})),e}return t},Jt=(t,e)=>{const r=Kt(t);return r.data=r.data||{},e&&(l(r.data.x)||(r.data.x=Math.random()*e[0]),l(r.data.y)||(r.data.y=Math.random()*e[1])),r},Qt={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null},Xt=(t,e,r)=>{const n=t.getAllNodes(),o=t.getAllEdges();return(null==n?void 0:n.length)?1===n.length?(e&&t.mergeNodeData(n[0].id,{x:r[0],y:r[1]}),{nodes:[Object.assign(Object.assign({},n[0]),{data:Object.assign(Object.assign({},n[0].data),{x:r[0],y:r[1]})})],edges:o}):void 0:{nodes:[],edges:o}},Zt={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1},te=(t,e,r=!1)=>{const n=[Jt(e[0])],o={},i=e.length;o[e[0].id]=!0;let s=0;return e.forEach(((a,u)=>{if(0!==u)if(u!==i-1&&t.getDegree(a.id,"both")===t.getDegree(e[u+1].id,"both")&&!t.areNeighbors(n[s].id,a.id)||o[a.id]){const u=r?t.getSuccessors(n[s].id):t.getNeighbors(n[s].id);let h=!1;for(let e=0;e<u.length;e++){const r=u[e];if(t.getDegree(r.id)===t.getDegree(a.id)&&!o[r.id]){n.push(Jt(r)),o[r.id]=!0,h=!0;break}}let d=0;for(;!h&&(o[e[d].id]||(n.push(Jt(e[d])),o[e[d].id]=!0,h=!0),d++,d!==i););}else n.push(Jt(a)),o[a.id]=!0,s++})),n},ee=function(t){return c(t,"String")},re=Array.isArray,ne={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class oe{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},ne),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericConcentricLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericConcentricLayout(!0,t,r)}))}genericConcentricLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{center:o,width:i,height:s,sortBy:a,maxLevelDiff:u,sweep:h,clockwise:d,equidistant:c,preventOverlap:f,startAngle:g=1.5*Math.PI,nodeSize:p,nodeSpacing:v}=e,m=r.getAllNodes(),y=r.getAllEdges(),w=i||"undefined"==typeof window?i:window.innerWidth,x=s||"undefined"==typeof window?s:window.innerHeight,b=o||[w/2,x/2];if(!(null==m?void 0:m.length)||1===m.length)return Xt(r,t,b);const E=[];let N,M=0;re(p)?N=Math.max(p[0],p[1]):Ut(p)?(N=-1/0,m.forEach((t=>{const e=p(t);e>N&&(N=e)}))):N=p,re(v)?M=Math.max(v[0],v[1]):l(v)&&(M=v),m.forEach((t=>{const e=Jt(t);E.push(e);let r=N;const{data:n}=e;re(n.size)?r=Math.max(n.size[0],n.size[1]):l(n.size)?r=n.size:Gt(n.size)&&(r=Math.max(n.size.width,n.size.height)),N=Math.max(N,r),Ut(v)&&(M=Math.max(v(t),M))}));const _={};E.forEach(((t,e)=>{_[t.id]=e}));let k=a;ee(k)&&void 0!==E[0].data[k]||(k="degree"),"degree"===k?E.sort(((t,e)=>r.getDegree(e.id,"both")-r.getDegree(t.id,"both"))):E.sort(((t,e)=>e.data[k]-t.data[k]));const A=E[0],j=(u||("degree"===k?r.getDegree(A.id,"both"):A.data[k]))/4,S=[{nodes:[]}];let O=S[0];E.forEach((t=>{if(O.nodes.length>0){const e="degree"===k?Math.abs(r.getDegree(O.nodes[0].id,"both")-r.getDegree(t.id,"both")):Math.abs(O.nodes[0].data[k]-t.data[k]);j&&e>=j&&(O={nodes:[]},S.push(O))}O.nodes.push(t)}));let z=N+M;if(!f){const t=S.length>0&&S[0].nodes.length>1,e=(Math.min(w,x)/2-z)/(S.length+(t?1:0));z=Math.min(z,e)}let R=0;if(S.forEach((t=>{const e=void 0===h?2*Math.PI-2*Math.PI/t.nodes.length:h;if(t.dTheta=e/Math.max(1,t.nodes.length-1),t.nodes.length>1&&f){const e=Math.cos(t.dTheta)-Math.cos(0),r=Math.sin(t.dTheta)-Math.sin(0),n=Math.sqrt(z*z/(e*e+r*r));R=Math.max(n,R)}t.r=R,R+=z})),c){let t=0,e=0;for(let r=0;r<S.length;r++){const n=(S[r].r||0)-e;t=Math.max(t,n)}e=0,S.forEach(((r,n)=>{0===n&&(e=r.r||0),r.r=e,e+=t}))}return S.forEach((t=>{const e=t.dTheta||0,r=t.r||0;t.nodes.forEach(((t,n)=>{const o=g+(d?1:-1)*e*n;t.data.x=b[0]+r*Math.cos(o),t.data.y=b[1]+r*Math.sin(o)}))})),t&&E.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:E,edges:y}}))}}function ie(t,e,r,n){if(isNaN(e)||isNaN(r))return t;var o,i,s,a,u,h,d,c,l,f=t._root,g={data:n},p=t._x0,v=t._y0,m=t._x1,y=t._y1;if(!f)return t._root=g,t;for(;f.length;)if((h=e>=(i=(p+m)/2))?p=i:m=i,(d=r>=(s=(v+y)/2))?v=s:y=s,o=f,!(f=f[c=d<<1|h]))return o[c]=g,t;if(a=+t._x.call(null,f.data),u=+t._y.call(null,f.data),e===a&&r===u)return g.next=f,o?o[c]=g:t._root=g,t;do{o=o?o[c]=new Array(4):t._root=new Array(4),(h=e>=(i=(p+m)/2))?p=i:m=i,(d=r>=(s=(v+y)/2))?v=s:y=s}while((c=d<<1|h)==(l=(u>=s)<<1|a>=i));return o[l]=f,o[c]=g,t}function se(t,e,r,n,o){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=o}function ae(t){return t[0]}function ue(t){return t[1]}function he(t,e,r){var n=new de(null==e?ae:e,null==r?ue:r,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function de(t,e,r,n,o,i){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=o,this._y1=i,this._root=void 0}function ce(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var le=he.prototype=de.prototype;function fe(t,e,r,n,o){if(isNaN(e)||isNaN(r)||isNaN(n))return t;var i,s,a,u,h,d,c,l,f,g,p,v,m=t._root,y={data:o},w=t._x0,x=t._y0,b=t._z0,E=t._x1,N=t._y1,M=t._z1;if(!m)return t._root=y,t;for(;m.length;)if((l=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+N)/2))?x=a:N=a,(g=n>=(u=(b+M)/2))?b=u:M=u,i=m,!(m=m[p=g<<2|f<<1|l]))return i[p]=y,t;if(h=+t._x.call(null,m.data),d=+t._y.call(null,m.data),c=+t._z.call(null,m.data),e===h&&r===d&&n===c)return y.next=m,i?i[p]=y:t._root=y,t;do{i=i?i[p]=new Array(8):t._root=new Array(8),(l=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+N)/2))?x=a:N=a,(g=n>=(u=(b+M)/2))?b=u:M=u}while((p=g<<2|f<<1|l)==(v=(c>=u)<<2|(d>=a)<<1|h>=s));return i[v]=m,i[p]=y,t}function ge(t,e,r,n,o,i,s){this.node=t,this.x0=e,this.y0=r,this.z0=n,this.x1=o,this.y1=i,this.z1=s}function pe(t){return t[0]}function ve(t){return t[1]}function me(t){return t[2]}function ye(t,e,r,n){var o=new we(null==e?pe:e,null==r?ve:r,null==n?me:n,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?o:o.addAll(t)}function we(t,e,r,n,o,i,s,a,u){this._x=t,this._y=e,this._z=r,this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this._root=void 0}function xe(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}le.copy=function(){var t,e,r=new de(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=ce(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var o=0;o<4;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(4)}):n.target[o]=ce(e));return r},le.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t);return ie(this.cover(e,r),e,r,t)},le.addAll=function(t){var e,r,n,o,i=t.length,s=new Array(i),a=new Array(i),u=1/0,h=1/0,d=-1/0,c=-1/0;for(r=0;r<i;++r)isNaN(n=+this._x.call(null,e=t[r]))||isNaN(o=+this._y.call(null,e))||(s[r]=n,a[r]=o,n<u&&(u=n),n>d&&(d=n),o<h&&(h=o),o>c&&(c=o));if(u>d||h>c)return this;for(this.cover(u,h).cover(d,c),r=0;r<i;++r)ie(this,s[r],a[r],t[r]);return this},le.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var r=this._x0,n=this._y0,o=this._x1,i=this._y1;if(isNaN(r))o=(r=Math.floor(t))+1,i=(n=Math.floor(e))+1;else{for(var s,a,u=o-r||1,h=this._root;r>t||t>=o||n>e||e>=i;)switch(a=(e<n)<<1|t<r,(s=new Array(4))[a]=h,h=s,u*=2,a){case 0:o=r+u,i=n+u;break;case 1:r=o-u,i=n+u;break;case 2:o=r+u,n=i-u;break;case 3:r=o-u,n=i-u}this._root&&this._root.length&&(this._root=h)}return this._x0=r,this._y0=n,this._x1=o,this._y1=i,this},le.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},le.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]]},le.find=function(t,e,r){var n,o,i,s,a,u,h,d=this._x0,c=this._y0,l=this._x1,f=this._y1,g=[],p=this._root;for(p&&g.push(new se(p,d,c,l,f)),null==r?r=1/0:(d=t-r,c=e-r,l=t+r,f=e+r,r*=r);u=g.pop();)if(!(!(p=u.node)||(o=u.x0)>l||(i=u.y0)>f||(s=u.x1)<d||(a=u.y1)<c))if(p.length){var v=(o+s)/2,m=(i+a)/2;g.push(new se(p[3],v,m,s,a),new se(p[2],o,m,v,a),new se(p[1],v,i,s,m),new se(p[0],o,i,v,m)),(h=(e>=m)<<1|t>=v)&&(u=g[g.length-1],g[g.length-1]=g[g.length-1-h],g[g.length-1-h]=u)}else{var y=t-+this._x.call(null,p.data),w=e-+this._y.call(null,p.data),x=y*y+w*w;if(x<r){var b=Math.sqrt(r=x);d=t-b,c=e-b,l=t+b,f=e+b,n=p.data}}return n},le.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t)))return this;var e,r,n,o,i,s,a,u,h,d,c,l,f=this._root,g=this._x0,p=this._y0,v=this._x1,m=this._y1;if(!f)return this;if(f.length)for(;;){if((h=i>=(a=(g+v)/2))?g=a:v=a,(d=s>=(u=(p+m)/2))?p=u:m=u,e=f,!(f=f[c=d<<1|h]))return this;if(!f.length)break;(e[c+1&3]||e[c+2&3]||e[c+3&3])&&(r=e,l=c)}for(;f.data!==t;)if(n=f,!(f=f.next))return this;return(o=f.next)&&delete f.next,n?(o?n.next=o:delete n.next,this):e?(o?e[c]=o:delete e[c],(f=e[0]||e[1]||e[2]||e[3])&&f===(e[3]||e[2]||e[1]||e[0])&&!f.length&&(r?r[l]=f:this._root=f),this):(this._root=o,this)},le.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},le.root=function(){return this._root},le.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},le.visit=function(t){var e,r,n,o,i,s,a=[],u=this._root;for(u&&a.push(new se(u,this._x0,this._y0,this._x1,this._y1));e=a.pop();)if(!t(u=e.node,n=e.x0,o=e.y0,i=e.x1,s=e.y1)&&u.length){var h=(n+i)/2,d=(o+s)/2;(r=u[3])&&a.push(new se(r,h,d,i,s)),(r=u[2])&&a.push(new se(r,n,d,h,s)),(r=u[1])&&a.push(new se(r,h,o,i,d)),(r=u[0])&&a.push(new se(r,n,o,h,d))}return this},le.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new se(this._root,this._x0,this._y0,this._x1,this._y1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.y0,u=e.x1,h=e.y1,d=(s+u)/2,c=(a+h)/2;(i=o[0])&&r.push(new se(i,s,a,d,c)),(i=o[1])&&r.push(new se(i,d,a,u,c)),(i=o[2])&&r.push(new se(i,s,c,d,h)),(i=o[3])&&r.push(new se(i,d,c,u,h))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},le.x=function(t){return arguments.length?(this._x=t,this):this._x},le.y=function(t){return arguments.length?(this._y=t,this):this._y};var be=ye.prototype=we.prototype;function Ee(t){let e=0,r=0,n=0,o=0,i=0;const s=t.length;if(s){for(let a=0;a<s;a++){const s=t[a];s&&s.weight&&(e+=s.weight,r+=s.x*s.weight,n+=s.y*s.weight,o+=s.z*s.weight,i+=s.size*s.weight)}t.x=r/e,t.y=n/e,t.z=o/e,t.size=i/e,t.weight=e}else{const e=t;t.x=e.data.x,t.y=e.data.y,t.z=e.data.z,t.size=e.data.size,t.weight=e.data.weight}}be.copy=function(){var t,e,r=new we(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root;if(!n)return r;if(!n.length)return r._root=xe(n),r;for(t=[{source:n,target:r._root=new Array(8)}];n=t.pop();)for(var o=0;o<8;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(8)}):n.target[o]=xe(e));return r},be.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t),n=+this._z.call(null,t);return fe(this.cover(e,r,n),e,r,n,t)},be.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e),n=new Float64Array(e),o=new Float64Array(e);let i=1/0,s=1/0,a=1/0,u=-1/0,h=-1/0,d=-1/0;for(let c,l,f,g,p=0;p<e;++p)isNaN(l=+this._x.call(null,c=t[p]))||isNaN(f=+this._y.call(null,c))||isNaN(g=+this._z.call(null,c))||(r[p]=l,n[p]=f,o[p]=g,l<i&&(i=l),l>u&&(u=l),f<s&&(s=f),f>h&&(h=f),g<a&&(a=g),g>d&&(d=g));if(i>u||s>h||a>d)return this;this.cover(i,s,a).cover(u,h,d);for(let i=0;i<e;++i)fe(this,r[i],n[i],o[i],t[i]);return this},be.cover=function(t,e,r){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(r=+r))return this;var n=this._x0,o=this._y0,i=this._z0,s=this._x1,a=this._y1,u=this._z1;if(isNaN(n))s=(n=Math.floor(t))+1,a=(o=Math.floor(e))+1,u=(i=Math.floor(r))+1;else{for(var h,d,c=s-n||1,l=this._root;n>t||t>=s||o>e||e>=a||i>r||r>=u;)switch(d=(r<i)<<2|(e<o)<<1|t<n,(h=new Array(8))[d]=l,l=h,c*=2,d){case 0:s=n+c,a=o+c,u=i+c;break;case 1:n=s-c,a=o+c,u=i+c;break;case 2:s=n+c,o=a-c,u=i+c;break;case 3:n=s-c,o=a-c,u=i+c;break;case 4:s=n+c,a=o+c,i=u-c;break;case 5:n=s-c,a=o+c,i=u-c;break;case 6:s=n+c,o=a-c,i=u-c;break;case 7:n=s-c,o=a-c,i=u-c}this._root&&this._root.length&&(this._root=l)}return this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this},be.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},be.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},be.find=function(t,e,r,n){var o,i,s,a,u,h,d,c,l,f=this._x0,g=this._y0,p=this._z0,v=this._x1,m=this._y1,y=this._z1,w=[],x=this._root;for(x&&w.push(new ge(x,f,g,p,v,m,y)),null==n?n=1/0:(f=t-n,g=e-n,p=r-n,v=t+n,m=e+n,y=r+n,n*=n);c=w.pop();)if(!(!(x=c.node)||(i=c.x0)>v||(s=c.y0)>m||(a=c.z0)>y||(u=c.x1)<f||(h=c.y1)<g||(d=c.z1)<p))if(x.length){var b=(i+u)/2,E=(s+h)/2,N=(a+d)/2;w.push(new ge(x[7],b,E,N,u,h,d),new ge(x[6],i,E,N,b,h,d),new ge(x[5],b,s,N,u,E,d),new ge(x[4],i,s,N,b,E,d),new ge(x[3],b,E,a,u,h,N),new ge(x[2],i,E,a,b,h,N),new ge(x[1],b,s,a,u,E,N),new ge(x[0],i,s,a,b,E,N)),(l=(r>=N)<<2|(e>=E)<<1|t>=b)&&(c=w[w.length-1],w[w.length-1]=w[w.length-1-l],w[w.length-1-l]=c)}else{var M=t-+this._x.call(null,x.data),_=e-+this._y.call(null,x.data),k=r-+this._z.call(null,x.data),A=M*M+_*_+k*k;if(A<n){var j=Math.sqrt(n=A);f=t-j,g=e-j,p=r-j,v=t+j,m=e+j,y=r+j,o=x.data}}return o},be.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t))||isNaN(a=+this._z.call(null,t)))return this;var e,r,n,o,i,s,a,u,h,d,c,l,f,g,p,v=this._root,m=this._x0,y=this._y0,w=this._z0,x=this._x1,b=this._y1,E=this._z1;if(!v)return this;if(v.length)for(;;){if((c=i>=(u=(m+x)/2))?m=u:x=u,(l=s>=(h=(y+b)/2))?y=h:b=h,(f=a>=(d=(w+E)/2))?w=d:E=d,e=v,!(v=v[g=f<<2|l<<1|c]))return this;if(!v.length)break;(e[g+1&7]||e[g+2&7]||e[g+3&7]||e[g+4&7]||e[g+5&7]||e[g+6&7]||e[g+7&7])&&(r=e,p=g)}for(;v.data!==t;)if(n=v,!(v=v.next))return this;return(o=v.next)&&delete v.next,n?(o?n.next=o:delete n.next,this):e?(o?e[g]=o:delete e[g],(v=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&v===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!v.length&&(r?r[p]=v:this._root=v),this):(this._root=o,this)},be.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},be.root=function(){return this._root},be.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},be.visit=function(t){var e,r,n,o,i,s,a,u,h=[],d=this._root;for(d&&h.push(new ge(d,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=h.pop();)if(!t(d=e.node,n=e.x0,o=e.y0,i=e.z0,s=e.x1,a=e.y1,u=e.z1)&&d.length){var c=(n+s)/2,l=(o+a)/2,f=(i+u)/2;(r=d[7])&&h.push(new ge(r,c,l,f,s,a,u)),(r=d[6])&&h.push(new ge(r,n,l,f,c,a,u)),(r=d[5])&&h.push(new ge(r,c,o,f,s,l,u)),(r=d[4])&&h.push(new ge(r,n,o,f,c,l,u)),(r=d[3])&&h.push(new ge(r,c,l,i,s,a,f)),(r=d[2])&&h.push(new ge(r,n,l,i,c,a,f)),(r=d[1])&&h.push(new ge(r,c,o,i,s,l,f)),(r=d[0])&&h.push(new ge(r,n,o,i,c,l,f))}return this},be.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new ge(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.y0,u=e.z0,h=e.x1,d=e.y1,c=e.z1,l=(s+h)/2,f=(a+d)/2,g=(u+c)/2;(i=o[0])&&r.push(new ge(i,s,a,u,l,f,g)),(i=o[1])&&r.push(new ge(i,l,a,u,h,f,g)),(i=o[2])&&r.push(new ge(i,s,f,u,l,d,g)),(i=o[3])&&r.push(new ge(i,l,f,u,h,d,g)),(i=o[4])&&r.push(new ge(i,s,a,g,l,f,c)),(i=o[5])&&r.push(new ge(i,l,a,g,h,f,c)),(i=o[6])&&r.push(new ge(i,s,f,g,l,d,c)),(i=o[7])&&r.push(new ge(i,l,f,g,h,d,c))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},be.x=function(t){return arguments.length?(this._x=t,this):this._x},be.y=function(t){return arguments.length?(this._y=t,this):this._y},be.z=function(t){return arguments.length?(this._z=t,this):this._z};const Ne=(t,e,r,n,o,i,s)=>{var a;if((null===(a=t.data)||void 0===a?void 0:a.id)===i.id)return;const u=[r,n,o][s-1],h=i.x-t.x||.1,d=i.y-t.y||.1,c=i.z-t.z||.1,l=[h,d,c],f=u-e;let g=0;for(let t=0;t<s;t++)g+=l[t]*l[t];const p=Math.sqrt(g)*g;if(f*f*.81<g){const e=t.weight/p;return i.vx+=h*e,i.vy+=d*e,i.vz+=c*e,!0}if(t.length)return!1;if(t.data!==i){const e=t.data.weight/p;i.vx+=h*e,i.vy+=d*e,i.vz+=c*e}},Me={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"};class _e{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},Me),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericForceLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericForceLayout(!0,t,r)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;(this.judgingDistance>this.lastOptions.minMovement||e<1)&&e<t;e++)this.runOneStep(this.lastCalcGraph,this.lastGraph,e,this.lastVelMap,this.lastOptions),this.updatePosition(this.lastGraph,this.lastCalcGraph,this.lastVelMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericForceLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),o=r.getAllNodes(),i=r.getAllEdges(),s=this.formatOptions(e,r),{dimensions:a,width:u,height:d,nodeSize:c,getMass:f,nodeStrength:g,edgeStrength:p,linkDistance:v}=s,m=o.map(((t,e)=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{x:l(t.data.x)?t.data.x:Math.random()*u,y:l(t.data.y)?t.data.y:Math.random()*d,z:l(t.data.z)?t.data.z:Math.random()*Math.sqrt(u*d),size:c(t)||30,mass:f(t),nodeStrength:g(t)})}))),y=i.map((t=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{edgeStrength:p(t),linkDistance:v(t,r.getNode(t.source),r.getNode(t.target))})})));if(!(null==o?void 0:o.length))return this.lastResult={nodes:[],edges:i},{nodes:[],edges:i};const w={};o.forEach(((t,e)=>{w[t.id]={x:0,y:0,z:0}}));const x=new h({nodes:m,edges:y});this.formatCentripetal(s,x);const{maxIteration:b,minMovement:E,onTick:N}=s;if(this.lastLayoutNodes=m,this.lastLayoutEdges=y,this.lastAssign=t,this.lastGraph=r,this.lastCalcGraph=x,this.lastOptions=s,this.lastVelMap=w,"undefined"==typeof window)return;let M=0;return new Promise((e=>{this.timeInterval=window.setInterval((()=>{o&&this.running||e({nodes:Oe(r,m),edges:i}),this.runOneStep(x,r,M,w,s),this.updatePosition(r,x,w,s),t&&m.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===a?t.data.z:void 0}))),null==N||N({nodes:Oe(r,m),edges:i}),M++,(M>=b||this.judgingDistance<E)&&(window.clearInterval(this.timeInterval),e({nodes:Oe(r,m),edges:i}))}),0),this.running=!0}))}))}formatOptions(t,e){const r=Object.assign({},t),{width:n,height:o,getMass:i,nodeSize:s}=t;r.width=n||"undefined"==typeof window?n:window.innerWidth,r.height=o||"undefined"==typeof window?o:window.innerHeight,t.center||(r.center=[r.width/2,r.height/2]),i||(r.getMass=t=>{let r=1;l(null==t?void 0:t.data.mass)&&(r=null==t?void 0:t.data.mass);const n=e.getDegree(t.id,"both");return!n||n<5?r:5*n*r});const a=Wt(0,t.nodeSpacing);let u;u=s?Ut(s)?t=>s(t)+a(t):re(s)?t=>{const e=s;return Math.max(e[0],e[1])+a(t)}:t=>s+a(t):t=>{const{size:e}=(null==t?void 0:t.data)||{};return e?re(e)?Math.max(e[0],e[1])+a(t):Gt(e)?Math.max(e.width,e.height)+a(t):e+a(t):10+a(t)},r.nodeSize=u;const h=t.linkDistance?Wt(1,t.linkDistance):t=>1+r.nodeSize(e.getNode(t.source))+r.nodeSize(e.getNode(t.target));return r.linkDistance=h,r.nodeStrength=Wt(1,t.nodeStrength),r.edgeStrength=Wt(1,t.edgeStrength),r}formatCentripetal(t,e){const{dimensions:r,centripetalOptions:n,center:o,clusterNodeStrength:i,leafCluster:s,clustering:a,nodeClusterBy:u}=t,h=e.getAllNodes(),d=n||{leaf:2,single:2,others:1,center:t=>({x:o[0],y:o[1],z:3===r?o[2]:void 0})};let c,l;if("function"!=typeof i&&(t.clusterNodeStrength=t=>i),s&&u&&(c=ke(e,u),l=Array.from(new Set(null==h?void 0:h.map((t=>t.data[u]))))||[],t.centripetalOptions=Object.assign(d,{single:100,leaf:e=>{const{siblingLeaves:r,sameTypeLeaves:n}=c[e.id]||{};return(null==n?void 0:n.length)===(null==r?void 0:r.length)||1===(null==l?void 0:l.length)?1:t.clusterNodeStrength(e)},others:1,center:t=>{const r=e.getDegree(t.id,"both");if(!r)return{x:100,y:100,z:0};let n;if(1===r){const{sameTypeLeaves:e=[]}=c[t.id]||{};1===e.length?n=void 0:e.length>1&&(n=Se(e))}else n=void 0;return{x:null==n?void 0:n.x,y:null==n?void 0:n.y,z:null==n?void 0:n.z}}})),a&&u){c||(c=ke(e,u)),l||(l=Array.from(new Set(h.map((t=>t.data[u]))))),l=l.filter((t=>void 0!==t));const r={};l.forEach((t=>{const n=h.filter((e=>e.data[u]===t)).map((t=>e.getNode(t.id)));r[t]=Se(n)})),t.centripetalOptions=Object.assign(d,{single:e=>t.clusterNodeStrength(e),leaf:e=>t.clusterNodeStrength(e),others:e=>t.clusterNodeStrength(e),center:t=>{const e=r[t.data[u]];return{x:null==e?void 0:e.x,y:null==e?void 0:e.y,z:null==e?void 0:e.z}}})}const{leaf:f,single:g,others:p}=t.centripetalOptions||{};f&&"function"!=typeof f&&(t.centripetalOptions.leaf=()=>f),g&&"function"!=typeof g&&(t.centripetalOptions.single=()=>g),p&&"function"!=typeof p&&(t.centripetalOptions.others=()=>p)}runOneStep(t,e,r,n,o){const i={},s=t.getAllNodes(),a=t.getAllEdges();if(!(null==s?void 0:s.length))return;const{monitor:u}=o;this.calRepulsive(t,i,o),a&&this.calAttractive(t,i,o),this.calGravity(t,e,i,o),this.updateVelocity(t,i,n,o),u&&u({energy:this.calTotalEnergy(i,s),nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:r})}calTotalEnergy(t,e){if(!(null==e?void 0:e.length))return 0;let r=0;return e.forEach(((e,n)=>{const o=t[e.id].x,i=t[e.id].y,s=3===this.options.dimensions?t[e.id].z:0,a=o*o+i*i+s*s,{mass:u=1}=e.data;r+=u*a*.5})),r}calRepulsive(t,e,r){const{dimensions:n,factor:o,coulombDisScale:i}=r;!function(t,e,r,n,o=2){const i=e/r,s=t.getAllNodes(),a=s.map(((t,e)=>{const{nodeStrength:r,x:n,y:o,z:s,size:a}=t.data;return{x:n,y:o,z:s,size:a,index:e,id:t.id,vx:0,vy:0,vz:0,weight:i*r}})),u=(2===o?he(a,(t=>t.x),(t=>t.y)):ye(a,(t=>t.x),(t=>t.y),(t=>t.z))).visitAfter(Ee),h=new Map;a.forEach((t=>{h.set(t.id,t),function(t,e,r){e.visit(((e,n,o,i,s)=>Ne(e,n,o,i,s,t,r)))}(t,u,o)})),a.map(((t,e)=>{const{id:r,data:o}=s[e],{mass:i=1}=o;n[r]={x:t.vx/i,y:t.vy/i,z:t.vz/i}}))}(t,o,i*i,e,n)}calAttractive(t,e,r){const{dimensions:n,nodeSize:o}=r;t.getAllEdges().forEach(((r,i)=>{const{source:s,target:a}=r,u=t.getNode(s),h=t.getNode(a);if(!u||!h)return;let d=h.data.x-u.data.x,c=h.data.y-u.data.y,l=3===n?h.data.z-u.data.z:0;d||c||(d=.01*Math.random(),c=.01*Math.random(),3!==n||l||(l=.01*Math.random()));const f=Math.sqrt(d*d+c*c+l*l);if(f<o(u)+o(h))return;const g=d/f,p=c/f,v=l/f,{linkDistance:m=200,edgeStrength:y=200}=r.data||{},w=(m-f)*y,x=1/(u.data.mass||1),b=1/(h.data.mass||1),E=g*w,N=p*w,M=v*w;e[s].x-=E*x,e[s].y-=N*x,e[s].z-=M*x,e[a].x+=E*b,e[a].y+=N*b,e[a].z+=M*b}))}calGravity(t,e,r,n){const{getCenter:o}=n,i=t.getAllNodes(),s=e.getAllNodes(),a=e.getAllEdges(),{width:u,height:h,center:d,gravity:c,centripetalOptions:f}=n;i&&i.forEach((n=>{const{id:i,data:g}=n,{mass:p,x:v,y:m,z:y}=g,w=e.getNode(i);let x=0,b=0,E=0,N=c;const M=t.getDegree(i,"in"),_=t.getDegree(i,"out"),k=t.getDegree(i,"both"),A=null==o?void 0:o(w,k);if(A){const[t,e,r]=A;x=v-t,b=m-e,N=r}else x=v-d[0],b=m-d[1],E=y-d[2];if(N&&(r[i].x-=N*x/p,r[i].y-=N*b/p,r[i].z-=N*E/p),f){const{leaf:t,single:e,others:n,center:o}=f,{x:d,y:c,z:g,centerStrength:x}=(null==o?void 0:o(w,s,a,u,h))||{x:0,y:0,z:0,centerStrength:0};if(!l(d)||!l(c))return;const b=(v-d)/p,E=(m-c)/p,N=(y-g)/p;if(x&&(r[i].x-=x*b,r[i].y-=x*E,r[i].z-=x*N),0===k){const t=e(w);if(!t)return;return r[i].x-=t*b,r[i].y-=t*E,void(r[i].z-=t*N)}if(0===M||0===_){const e=t(w,s,a);if(!e)return;return r[i].x-=e*b,r[i].y-=e*E,void(r[i].z-=e*N)}const A=n(w);if(!A)return;r[i].x-=A*b,r[i].y-=A*E,r[i].z-=A*N}}))}updateVelocity(t,e,r,n){const{damping:o,maxSpeed:i,interval:s,dimensions:a}=n,u=t.getAllNodes();(null==u?void 0:u.length)&&u.forEach((t=>{const{id:n}=t;let u=(r[n].x+e[n].x*s)*o||.01,h=(r[n].y+e[n].y*s)*o||.01,d=3===a?(r[n].z+e[n].z*s)*o||.01:0;const c=Math.sqrt(u*u+h*h+d*d);if(c>i){const t=i/c;u*=t,h*=t,d*=t}r[n]={x:u,y:h,z:d}}))}updatePosition(t,e,r,n){const{distanceThresholdMode:o,interval:i,dimensions:s}=n,a=e.getAllNodes();if(!(null==a?void 0:a.length))return void(this.judgingDistance=0);let u=0;"max"===o?this.judgingDistance=-1/0:"min"===o&&(this.judgingDistance=1/0),a.forEach((n=>{const{id:a}=n,h=t.getNode(a);if(l(h.data.fx)&&l(h.data.fy))return void e.mergeNodeData(a,{x:h.data.fx,y:h.data.fy,z:3===s?h.data.fz:void 0});const d=r[a].x*i,c=r[a].y*i,f=3===s?r[a].z*i:0;e.mergeNodeData(a,{x:n.data.x+d,y:n.data.y+c,z:n.data.z+f});const g=Math.sqrt(d*d+c*c+f*f);switch(o){case"max":this.judgingDistance<g&&(this.judgingDistance=g);break;case"min":this.judgingDistance>g&&(this.judgingDistance=g);break;default:u+=g}})),o&&"mean"!==o||(this.judgingDistance=u/a.length)}}const ke=(t,e)=>{const r=t.getAllNodes();if(!(null==r?void 0:r.length))return{};const n={};return r.forEach(((r,o)=>{1===t.getDegree(r.id,"both")&&(n[r.id]=Ae(t,"leaf",r,e))})),n},Ae=(t,e,r,n)=>{const o=t.getDegree(r.id,"in"),i=t.getDegree(r.id,"out");let s=r,a=[];return 0===o?(s=t.getSuccessors(r.id)[0],a=t.getNeighbors(s.id)):0===i&&(s=t.getPredecessors(r.id)[0],a=t.getNeighbors(s.id)),a=a.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out"))),{coreNode:s,siblingLeaves:a,sameTypeLeaves:je(t,e,n,r,a)}},je=(t,e,r,n,o)=>{const i=n.data[r]||"";let s=(null==o?void 0:o.filter((t=>t.data[r]===i)))||[];return"leaf"===e&&(s=s.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out")))),s},Se=t=>{const e={x:0,y:0};t.forEach((t=>{const{x:r,y:n}=t.data;e.x+=r||0,e.y+=n||0}));const r=t.length||1;return{x:e.x/r,y:e.y/r}},Oe=(t,e)=>e.map((e=>{const{id:r,data:n}=e,o=t.getNode(r);return Object.assign(Object.assign({},o),{data:Object.assign(Object.assign({},o.data),{x:n.x,y:n.y,z:n.z})})}));var ze=r(8917);ze.y3,ze.jy,ze.oN,ze.Hc,ze.cg,ze.hj,ze.LU,ze.Tb;const Re=ze.uq,Ie=(ze.Zm,ze.Dq,ze.__,ze.q0,ze.lh,ze.pI,ze.zC,ze.zg,ze.g6,ze.OL,ze.ks,ze.QR,ze.jp,ze.mk,ze.W2),Ce=(ze.l,ze.KY,ze.dv,ze.BR,ze.Wu,ze.uq,ze.uq,ze.a4,ze.DI,ze.Jo,ze.Zi,ze.kH,ze.LV,t=>{const e=[],r=t.length;for(let n=0;n<r;n+=1){e[n]=[];for(let o=0;o<r;o+=1)n===o?e[n][o]=0:0!==t[n][o]&&t[n][o]?e[n][o]=t[n][o]:e[n][o]=1/0}for(let t=0;t<r;t+=1)for(let n=0;n<r;n+=1)for(let o=0;o<r;o+=1)e[n][o]>e[n][t]+e[t][o]&&(e[n][o]=e[n][t]+e[t][o]);return e}),De=(t,e)=>{const{nodes:r,edges:n}=t,o=[],i={};if(!r)throw new Error("invalid nodes data!");return r&&r.forEach(((t,e)=>{i[t.id]=e,o.push([])})),null==n||n.forEach((t=>{const{source:r,target:n}=t,s=i[r],a=i[n];void 0!==s&&void 0!==a&&(o[s][a]=1,e||(o[a][s]=1))})),o},Pe=(t,e)=>Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)),Te=(t,e,r,n="TB",o,i={})=>{if(!(null==e?void 0:e.length))return;const{stopBranchFn:s,stopAllFn:a}=i;for(let u=0;u<e.length;u++){const h=e[u];if(t.hasNode(h.id)&&!(null==s?void 0:s(h))){if(null==a?void 0:a(h))return;"TB"===n&&r(h),Te(t,t.getChildren(h.id,o),r,n,o,i),"TB"!==n&&r(h)}}},Le={center:[0,0],linkDistance:50};class Fe{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},Le),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericMDSLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericMDSLayout(!0,t,r)}))}genericMDSLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{center:o=[0,0],linkDistance:i=50}=e,s=r.getAllNodes(),a=r.getAllEdges();if(!(null==s?void 0:s.length)||1===s.length)return Xt(r,t,o);const u=De({nodes:s,edges:a},!1),h=Ce(u);qe(h);const d=((t,e)=>{const r=[];return t.forEach((t=>{const n=[];t.forEach((t=>{n.push(t*e)})),r.push(n)})),r})(h,i),c=Ve(d),l=[];return c.forEach(((t,e)=>{const r=Jt(s[e]);r.data.x=t[0]+o[0],r.data.y=t[1]+o[1],l.push(r)})),t&&l.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:l,edges:a}}))}}const qe=t=>{let e=-999999;t.forEach((t=>{t.forEach((t=>{t!==1/0&&e<t&&(e=t)}))})),t.forEach(((r,n)=>{r.forEach(((r,o)=>{r===1/0&&(t[n][o]=e)}))}))},Ve=t=>{const e=Re.mul(Re.pow(t,2),-.5),r=e.mean("row"),n=e.mean("column"),o=e.mean();e.add(o).subRowVector(r).subColumnVector(n);const i=new Ie(e),s=Re.sqrt(i.diagonalMatrix).diagonal();return i.leftSingularVectors.toJSON().map((t=>Re.mul([t],[s]).toJSON()[0].splice(0,2)))},Be={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},$e={center:[0,0],comboPadding:10,treeKey:"combo"},Ue=function(t){if(!function(t){return"object"==typeof t&&null!==t}(t)||!c(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};function Ge(t,e){if(Object.hasOwn)return Object.hasOwn(t,e);if(null==t)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(t),e)}function We(t,e,r,n){for(var o in r=r||0,n=n||5,e)if(Ge(e,o)){var i=e[o];null!==i&&Ue(i)?(Ue(t[o])||(t[o]={}),r<n?We(t[o],i,r+1,n):t[o]=e[o]):L(i)?(t[o]=[],t[o]=t[o].concat(i)):void 0!==i&&(t[o]=i)}}var Ye=Object.prototype.hasOwnProperty;const He=function(t,e){if(null===t||!Ue(t))return{};var r={};return function(t,e){if(t)if(L(t))for(var r=0,n=t.length;r<n&&!1!==e(t[r],r);r++);else if(Gt(t))for(var o in t)if(t.hasOwnProperty(o)&&!1===e(t[o],o))break}(e,(function(e){Ye.call(t,e)&&(r[e]=t[e])})),r};function Ke(t){return function(){return t}}function Je(t){return 1e-6*(t()-.5)}function Qe(t){return t.index}function Xe(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function Ze(t){var e,r,n,o,i,s,a=Qe,u=function(t){return 1/Math.min(o[t.source.index],o[t.target.index])},h=Ke(30),d=1;function c(n){for(var o=0,a=t.length;o<d;++o)for(var u,h,c,l,f,g,p,v=0;v<a;++v)h=(u=t[v]).source,l=(c=u.target).x+c.vx-h.x-h.vx||Je(s),f=c.y+c.vy-h.y-h.vy||Je(s),l*=g=((g=Math.sqrt(l*l+f*f))-r[v])/g*n*e[v],f*=g,c.vx-=l*(p=i[v]),c.vy-=f*p,h.vx+=l*(p=1-p),h.vy+=f*p}function l(){if(n){var s,u,h=n.length,d=t.length,c=new Map(n.map(((t,e)=>[a(t,e,n),t])));for(s=0,o=new Array(h);s<d;++s)(u=t[s]).index=s,"object"!=typeof u.source&&(u.source=Xe(c,u.source)),"object"!=typeof u.target&&(u.target=Xe(c,u.target)),o[u.source.index]=(o[u.source.index]||0)+1,o[u.target.index]=(o[u.target.index]||0)+1;for(s=0,i=new Array(d);s<d;++s)u=t[s],i[s]=o[u.source.index]/(o[u.source.index]+o[u.target.index]);e=new Array(d),f(),r=new Array(d),g()}}function f(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+u(t[r],r,t)}function g(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+h(t[e],e,t)}return null==t&&(t=[]),c.initialize=function(t,e){n=t,s=e,l()},c.links=function(e){return arguments.length?(t=e,l(),c):t},c.id=function(t){return arguments.length?(a=t,c):a},c.iterations=function(t){return arguments.length?(d=+t,c):d},c.strength=function(t){return arguments.length?(u="function"==typeof t?t:Ke(+t),f(),c):u},c.distance=function(t){return arguments.length?(h="function"==typeof t?t:Ke(+t),g(),c):h},c}var tr={value:()=>{}};function er(){for(var t,e=0,r=arguments.length,n={};e<r;++e){if(!(t=arguments[e]+"")||t in n||/[\\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new rr(n)}function rr(t){this._=t}function nr(t,e){for(var r,n=0,o=t.length;n<o;++n)if((r=t[n]).name===e)return r.value}function or(t,e,r){for(var n=0,o=t.length;n<o;++n)if(t[n].name===e){t[n]=tr,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}rr.prototype=er.prototype={constructor:rr,on:function(t,e){var r,n,o=this._,i=(n=o,(t+"").trim().split(/^|\\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),s=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++s<a;)if(r=(t=i[s]).type)o[r]=or(o[r],t.name,e);else if(null==e)for(r in o)o[r]=or(o[r],t.name,null);return this}for(;++s<a;)if((r=(t=i[s]).type)&&(r=nr(o[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new rr(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,o=new Array(r),i=0;i<r;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,r=(n=this._[t]).length;i<r;++i)n[i].value.apply(e,o)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],o=0,i=n.length;o<i;++o)n[o].value.apply(e,r)}};const ir=er;var sr,ar,ur=0,hr=0,dr=0,cr=1e3,lr=0,fr=0,gr=0,pr="object"==typeof performance&&performance.now?performance:Date,vr="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function mr(){return fr||(vr(yr),fr=pr.now()+gr)}function yr(){fr=0}function wr(){this._call=this._time=this._next=null}function xr(t,e,r){var n=new wr;return n.restart(t,e,r),n}function br(){fr=(lr=pr.now())+gr,ur=hr=0;try{!function(){mr(),++ur;for(var t,e=sr;e;)(t=fr-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ur}()}finally{ur=0,function(){for(var t,e,r=sr,n=1/0;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:sr=e);ar=t,Nr(n)}(),fr=0}}function Er(){var t=pr.now(),e=t-lr;e>cr&&(gr-=e,lr=t)}function Nr(t){ur||(hr&&(hr=clearTimeout(hr)),t-fr>24?(t<1/0&&(hr=setTimeout(br,t-pr.now()-gr)),dr&&(dr=clearInterval(dr))):(dr||(lr=pr.now(),dr=setInterval(Er,cr)),ur=1,vr(br)))}wr.prototype=xr.prototype={constructor:wr,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?mr():+r)+(null==e?0:+e),this._next||ar===this||(ar?ar._next=this:sr=this,ar=this),this._call=t,this._time=r,Nr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Nr())}};const Mr=4294967296;function _r(t){return t.x}function kr(t){return t.y}var Ar=Math.PI*(3-Math.sqrt(5));function jr(){var t,e,r,n,o,i=Ke(-30),s=1,a=1/0,u=.81;function h(r){var o,i=t.length,s=he(t,_r,kr).visitAfter(c);for(n=r,o=0;o<i;++o)e=t[o],s.visit(l)}function d(){if(t){var e,r,n=t.length;for(o=new Array(n),e=0;e<n;++e)r=t[e],o[r.index]=+i(r,e,t)}}function c(t){var e,r,n,i,s,a=0,u=0;if(t.length){for(n=i=s=0;s<4;++s)(e=t[s])&&(r=Math.abs(e.value))&&(a+=e.value,u+=r,n+=r*e.x,i+=r*e.y);t.x=n/u,t.y=i/u}else{(e=t).x=e.data.x,e.y=e.data.y;do{a+=o[e.data.index]}while(e=e.next)}t.value=a}function l(t,i,h,d){if(!t.value)return!0;var c=t.x-e.x,l=t.y-e.y,f=d-i,g=c*c+l*l;if(f*f/u<g)return g<a&&(0===c&&(g+=(c=Je(r))*c),0===l&&(g+=(l=Je(r))*l),g<s&&(g=Math.sqrt(s*g)),e.vx+=c*t.value*n/g,e.vy+=l*t.value*n/g),!0;if(!(t.length||g>=a)){(t.data!==e||t.next)&&(0===c&&(g+=(c=Je(r))*c),0===l&&(g+=(l=Je(r))*l),g<s&&(g=Math.sqrt(s*g)));do{t.data!==e&&(f=o[t.data.index]*n/g,e.vx+=c*f,e.vy+=l*f)}while(t=t.next)}}return h.initialize=function(e,n){t=e,r=n,d()},h.strength=function(t){return arguments.length?(i="function"==typeof t?t:Ke(+t),d(),h):i},h.distanceMin=function(t){return arguments.length?(s=t*t,h):Math.sqrt(s)},h.distanceMax=function(t){return arguments.length?(a=t*t,h):Math.sqrt(a)},h.theta=function(t){return arguments.length?(u=t*t,h):Math.sqrt(u)},h}function Sr(t,e){var r,n=1;function o(){var o,i,s=r.length,a=0,u=0;for(o=0;o<s;++o)a+=(i=r[o]).x,u+=i.y;for(a=(a/s-t)*n,u=(u/s-e)*n,o=0;o<s;++o)(i=r[o]).x-=a,i.y-=u}return null==t&&(t=0),null==e&&(e=0),o.initialize=function(t){r=t},o.x=function(e){return arguments.length?(t=+e,o):t},o.y=function(t){return arguments.length?(e=+t,o):e},o.strength=function(t){return arguments.length?(n=+t,o):n},o}function Or(t){return t.x+t.vx}function zr(t){return t.y+t.vy}function Rr(t){var e,r,n,o=1,i=1;function s(){for(var t,s,u,h,d,c,l,f=e.length,g=0;g<i;++g)for(s=he(e,Or,zr).visitAfter(a),t=0;t<f;++t)u=e[t],c=r[u.index],l=c*c,h=u.x+u.vx,d=u.y+u.vy,s.visit(p);function p(t,e,r,i,s){var a=t.data,f=t.r,g=c+f;if(!a)return e>h+g||i<h-g||r>d+g||s<d-g;if(a.index>u.index){var p=h-a.x-a.vx,v=d-a.y-a.vy,m=p*p+v*v;m<g*g&&(0===p&&(m+=(p=Je(n))*p),0===v&&(m+=(v=Je(n))*v),m=(g-(m=Math.sqrt(m)))/m*o,u.vx+=(p*=m)*(g=(f*=f)/(l+f)),u.vy+=(v*=m)*g,a.vx-=p*(g=1-g),a.vy-=v*g)}}}function a(t){if(t.data)return t.r=r[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function u(){if(e){var n,o,i=e.length;for(r=new Array(i),n=0;n<i;++n)o=e[n],r[o.index]=+t(o,n,e)}}return"function"!=typeof t&&(t=Ke(null==t?1:+t)),s.initialize=function(t,r){e=t,n=r,u()},s.iterations=function(t){return arguments.length?(i=+t,s):i},s.strength=function(t){return arguments.length?(o=+t,s):o},s.radius=function(e){return arguments.length?(t="function"==typeof e?e:Ke(+e),u(),s):t},s}function Ir(t,e,r){var n,o,i,s=Ke(.1);function a(t){for(var s=0,a=n.length;s<a;++s){var u=n[s],h=u.x-e||1e-6,d=u.y-r||1e-6,c=Math.sqrt(h*h+d*d),l=(i[s]-c)*o[s]*t/c;u.vx+=h*l,u.vy+=d*l}}function u(){if(n){var e,r=n.length;for(o=new Array(r),i=new Array(r),e=0;e<r;++e)i[e]=+t(n[e],e,n),o[e]=isNaN(i[e])?0:+s(n[e],e,n)}}return"function"!=typeof t&&(t=Ke(+t)),null==e&&(e=0),null==r&&(r=0),a.initialize=function(t){n=t,u()},a.strength=function(t){return arguments.length?(s="function"==typeof t?t:Ke(+t),u(),a):s},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:Ke(+e),u(),a):t},a.x=function(t){return arguments.length?(e=+t,a):e},a.y=function(t){return arguments.length?(r=+t,a):r},a}function Cr(t){var e,r,n,o=Ke(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Ke(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Ke(+t),s(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:Ke(+e),s(),i):t},i}function Dr(t){var e,r,n,o=Ke(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Ke(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Ke(+t),s(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:Ke(+e),s(),i):t},i}class Pr{constructor(e={}){this.id="d3-force",this.config={inputNodeAttrs:["x","y","vx","vy","fx","fy"],outputNodeAttrs:["x","y","vx","vy"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource"]},this.forceMap={link:Ze,manyBody:jr,center:Sr,collide:Rr,radial:Ir,x:Cr,y:Dr},this.options={link:{id:t=>t.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]};const{forceSimulation:r}=e,n=t(e,["forceSimulation"]);(function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var n=0;n<e.length;n+=1)We(t,e[n])})(this.options,n),r&&(this.simulation=r)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericLayout(!0,t,r)}))}stop(){this.simulation.stop()}tick(t){return this.simulation.tick(t),this.getResult()}restart(){this.simulation.restart()}getOptions(t){var e,r;const n=Object.assign(Object.assign({},this.options),t);return void 0===(null===(e=n.collide)||void 0===e?void 0:e.radius)&&(n.collide=n.collide||{},n.collide.radius=null!==(r=n.nodeSize)&&void 0!==r?r:10),void 0===n.iterations&&(n.link&&void 0===n.link.iterations&&(n.iterations=n.link.iterations),n.collide&&void 0===n.collide.iterations&&(n.iterations=n.collide.iterations)),this.context.options=n,n}genericLayout(t,r,n){var o;return e(this,void 0,void 0,(function*(){const e=this.getOptions(n),i=r.getAllNodes().map((({id:t,data:e})=>Object.assign({id:t,data:e},He(e,this.config.inputNodeAttrs)))),s=r.getAllEdges().map((t=>Object.assign({},t)));Object.assign(this.context,{assign:t,nodes:i,edges:s,graph:r});const a=new Promise((t=>{this.resolver=t})),u=this.setSimulation(e);return u.nodes(i),null===(o=u.force("link"))||void 0===o||o.links(s),a}))}getResult(){const{assign:t,nodes:e,edges:r,graph:n}=this.context,o=e.map((t=>({id:t.id,data:Object.assign(Object.assign({},t.data),He(t,this.config.outputNodeAttrs))}))),i=r.map((({id:t,source:e,target:r,data:n})=>({id:t,source:"object"==typeof e?e.id:e,target:"object"==typeof r?r.id:r,data:n})));return t&&o.forEach((t=>n.mergeNodeData(t.id,t.data))),{nodes:o,edges:i}}initSimulation(){return function(t){var e,r=1,n=.001,o=1-Math.pow(n,1/300),i=0,s=.6,a=new Map,u=xr(c),h=ir("tick","end"),d=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Mr)/Mr}();function c(){l(),h.call("tick",e),r<n&&(u.stop(),h.call("end",e))}function l(n){var u,h,d=t.length;void 0===n&&(n=1);for(var c=0;c<n;++c)for(r+=(i-r)*o,a.forEach((function(t){t(r)})),u=0;u<d;++u)null==(h=t[u]).fx?h.x+=h.vx*=s:(h.x=h.fx,h.vx=0),null==h.fy?h.y+=h.vy*=s:(h.y=h.fy,h.vy=0);return e}function f(){for(var e,r=0,n=t.length;r<n;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var o=10*Math.sqrt(.5+r),i=r*Ar;e.x=o*Math.cos(i),e.y=o*Math.sin(i)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function g(e){return e.initialize&&e.initialize(t,d),e}return null==t&&(t=[]),f(),e={tick:l,restart:function(){return u.restart(c),e},stop:function(){return u.stop(),e},nodes:function(r){return arguments.length?(t=r,f(),a.forEach(g),e):t},alpha:function(t){return arguments.length?(r=+t,e):r},alphaMin:function(t){return arguments.length?(n=+t,e):n},alphaDecay:function(t){return arguments.length?(o=+t,e):+o},alphaTarget:function(t){return arguments.length?(i=+t,e):i},velocityDecay:function(t){return arguments.length?(s=1-t,e):1-s},randomSource:function(t){return arguments.length?(d=t,a.forEach(g),e):d},force:function(t,r){return arguments.length>1?(null==r?a.delete(t):a.set(t,g(r)),e):a.get(t)},find:function(e,r,n){var o,i,s,a,u,h=0,d=t.length;for(null==n?n=1/0:n*=n,h=0;h<d;++h)(s=(o=e-(a=t[h]).x)*o+(i=r-a.y)*i)<n&&(u=a,n=s);return u},on:function(t,r){return arguments.length>1?(h.on(t,r),e):h.on(t)}}}()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",(()=>{var e;return null===(e=t.onTick)||void 0===e?void 0:e.call(t,this.getResult())})).on("end",(()=>{var t;return null===(t=this.resolver)||void 0===t?void 0:t.call(this,this.getResult())}))),Tr(e,this.config.simulationAttrs.map((e=>[e,t[e]]))),Object.entries(this.forceMap).forEach((([r,n])=>{const o=r;if(r in t){let r=e.force(o);r||(r=n(),e.force(o,r)),Tr(r,Object.entries(t[o]))}else e.force(o,null)})),e}}const Tr=(t,e)=>e.reduce(((e,[r,n])=>e[r]&&void 0!==n?e[r].call(t,n):e),t);function Lr(t){return function(){return t}}function Fr(t){return 1e-6*(t()-.5)}function qr(t){return t.index}function Vr(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function Br(t){var e,r,n,o,i,s,a,u=qr,h=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},d=Lr(30),c=1;function l(n){for(var i=0,u=t.length;i<c;++i)for(var h,d,l,f,g,p=0,v=0,m=0,y=0;p<u;++p)d=(h=t[p]).source,v=(l=h.target).x+l.vx-d.x-d.vx||Fr(a),o>1&&(m=l.y+l.vy-d.y-d.vy||Fr(a)),o>2&&(y=l.z+l.vz-d.z-d.vz||Fr(a)),v*=f=((f=Math.sqrt(v*v+m*m+y*y))-r[p])/f*n*e[p],m*=f,y*=f,l.vx-=v*(g=s[p]),o>1&&(l.vy-=m*g),o>2&&(l.vz-=y*g),d.vx+=v*(g=1-g),o>1&&(d.vy+=m*g),o>2&&(d.vz+=y*g)}function f(){if(n){var o,a,h=n.length,d=t.length,c=new Map(n.map(((t,e)=>[u(t,e,n),t])));for(o=0,i=new Array(h);o<d;++o)(a=t[o]).index=o,"object"!=typeof a.source&&(a.source=Vr(c,a.source)),"object"!=typeof a.target&&(a.target=Vr(c,a.target)),i[a.source.index]=(i[a.source.index]||0)+1,i[a.target.index]=(i[a.target.index]||0)+1;for(o=0,s=new Array(d);o<d;++o)a=t[o],s[o]=i[a.source.index]/(i[a.source.index]+i[a.target.index]);e=new Array(d),g(),r=new Array(d),p()}}function g(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+h(t[r],r,t)}function p(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+d(t[e],e,t)}return null==t&&(t=[]),l.initialize=function(t,...e){n=t,a=e.find((t=>"function"==typeof t))||Math.random,o=e.find((t=>[1,2,3].includes(t)))||2,f()},l.links=function(e){return arguments.length?(t=e,f(),l):t},l.id=function(t){return arguments.length?(u=t,l):u},l.iterations=function(t){return arguments.length?(c=+t,l):c},l.strength=function(t){return arguments.length?(h="function"==typeof t?t:Lr(+t),g(),l):h},l.distance=function(t){return arguments.length?(d="function"==typeof t?t:Lr(+t),p(),l):d},l}function $r(t,e,r){if(isNaN(e))return t;var n,o,i,s,a,u,h=t._root,d={data:r},c=t._x0,l=t._x1;if(!h)return t._root=d,t;for(;h.length;)if((s=e>=(o=(c+l)/2))?c=o:l=o,n=h,!(h=h[a=+s]))return n[a]=d,t;if(e===(i=+t._x.call(null,h.data)))return d.next=h,n?n[a]=d:t._root=d,t;do{n=n?n[a]=new Array(2):t._root=new Array(2),(s=e>=(o=(c+l)/2))?c=o:l=o}while((a=+s)==(u=+(i>=o)));return n[u]=h,n[a]=d,t}function Ur(t,e,r){this.node=t,this.x0=e,this.x1=r}function Gr(t){return t[0]}function Wr(t,e){var r=new Yr(null==e?Gr:e,NaN,NaN);return null==t?r:r.addAll(t)}function Yr(t,e,r){this._x=t,this._x0=e,this._x1=r,this._root=void 0}function Hr(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var Kr=Wr.prototype=Yr.prototype;Kr.copy=function(){var t,e,r=new Yr(this._x,this._x0,this._x1),n=this._root;if(!n)return r;if(!n.length)return r._root=Hr(n),r;for(t=[{source:n,target:r._root=new Array(2)}];n=t.pop();)for(var o=0;o<2;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(2)}):n.target[o]=Hr(e));return r},Kr.add=function(t){const e=+this._x.call(null,t);return $r(this.cover(e),e,t)},Kr.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e);let n=1/0,o=-1/0;for(let i,s=0;s<e;++s)isNaN(i=+this._x.call(null,t[s]))||(r[s]=i,i<n&&(n=i),i>o&&(o=i));if(n>o)return this;this.cover(n).cover(o);for(let n=0;n<e;++n)$r(this,r[n],t[n]);return this},Kr.cover=function(t){if(isNaN(t=+t))return this;var e=this._x0,r=this._x1;if(isNaN(e))r=(e=Math.floor(t))+1;else{for(var n,o,i=r-e||1,s=this._root;e>t||t>=r;)switch(o=+(t<e),(n=new Array(2))[o]=s,s=n,i*=2,o){case 0:r=e+i;break;case 1:e=r-i}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._x1=r,this},Kr.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},Kr.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},Kr.find=function(t,e){var r,n,o,i,s,a=this._x0,u=this._x1,h=[],d=this._root;for(d&&h.push(new Ur(d,a,u)),null==e?e=1/0:(a=t-e,u=t+e);i=h.pop();)if(!(!(d=i.node)||(n=i.x0)>u||(o=i.x1)<a))if(d.length){var c=(n+o)/2;h.push(new Ur(d[1],c,o),new Ur(d[0],n,c)),(s=+(t>=c))&&(i=h[h.length-1],h[h.length-1]=h[h.length-1-s],h[h.length-1-s]=i)}else{var l=Math.abs(t-+this._x.call(null,d.data));l<e&&(e=l,a=t-l,u=t+l,r=d.data)}return r},Kr.remove=function(t){if(isNaN(i=+this._x.call(null,t)))return this;var e,r,n,o,i,s,a,u,h,d=this._root,c=this._x0,l=this._x1;if(!d)return this;if(d.length)for(;;){if((a=i>=(s=(c+l)/2))?c=s:l=s,e=d,!(d=d[u=+a]))return this;if(!d.length)break;e[u+1&1]&&(r=e,h=u)}for(;d.data!==t;)if(n=d,!(d=d.next))return this;return(o=d.next)&&delete d.next,n?(o?n.next=o:delete n.next,this):e?(o?e[u]=o:delete e[u],(d=e[0]||e[1])&&d===(e[1]||e[0])&&!d.length&&(r?r[h]=d:this._root=d),this):(this._root=o,this)},Kr.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},Kr.root=function(){return this._root},Kr.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},Kr.visit=function(t){var e,r,n,o,i=[],s=this._root;for(s&&i.push(new Ur(s,this._x0,this._x1));e=i.pop();)if(!t(s=e.node,n=e.x0,o=e.x1)&&s.length){var a=(n+o)/2;(r=s[1])&&i.push(new Ur(r,a,o)),(r=s[0])&&i.push(new Ur(r,n,a))}return this},Kr.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new Ur(this._root,this._x0,this._x1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.x1,u=(s+a)/2;(i=o[0])&&r.push(new Ur(i,s,u)),(i=o[1])&&r.push(new Ur(i,u,a))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.x1);return this},Kr.x=function(t){return arguments.length?(this._x=t,this):this._x};const Jr=4294967296;function Qr(t){return t.x}function Xr(t){return t.y}function Zr(t){return t.z}var tn=Math.PI*(3-Math.sqrt(5)),en=20*Math.PI/(9+Math.sqrt(221));function rn(){var t,e,r,n,o,i,s=Lr(-30),a=1,u=1/0,h=.81;function d(n){var i,s=t.length,a=(1===e?Wr(t,Qr):2===e?he(t,Qr,Xr):3===e?ye(t,Qr,Xr,Zr):null).visitAfter(l);for(o=n,i=0;i<s;++i)r=t[i],a.visit(f)}function c(){if(t){var e,r,n=t.length;for(i=new Array(n),e=0;e<n;++e)r=t[e],i[r.index]=+s(r,e,t)}}function l(t){var r,n,o,s,a,u,h=0,d=0,c=t.length;if(c){for(o=s=a=u=0;u<c;++u)(r=t[u])&&(n=Math.abs(r.value))&&(h+=r.value,d+=n,o+=n*(r.x||0),s+=n*(r.y||0),a+=n*(r.z||0));h*=Math.sqrt(4/c),t.x=o/d,e>1&&(t.y=s/d),e>2&&(t.z=a/d)}else{(r=t).x=r.data.x,e>1&&(r.y=r.data.y),e>2&&(r.z=r.data.z);do{h+=i[r.data.index]}while(r=r.next)}t.value=h}function f(t,s,d,c,l){if(!t.value)return!0;var f=[d,c,l][e-1],g=t.x-r.x,p=e>1?t.y-r.y:0,v=e>2?t.z-r.z:0,m=f-s,y=g*g+p*p+v*v;if(m*m/h<y)return y<u&&(0===g&&(y+=(g=Fr(n))*g),e>1&&0===p&&(y+=(p=Fr(n))*p),e>2&&0===v&&(y+=(v=Fr(n))*v),y<a&&(y=Math.sqrt(a*y)),r.vx+=g*t.value*o/y,e>1&&(r.vy+=p*t.value*o/y),e>2&&(r.vz+=v*t.value*o/y)),!0;if(!(t.length||y>=u)){(t.data!==r||t.next)&&(0===g&&(y+=(g=Fr(n))*g),e>1&&0===p&&(y+=(p=Fr(n))*p),e>2&&0===v&&(y+=(v=Fr(n))*v),y<a&&(y=Math.sqrt(a*y)));do{t.data!==r&&(m=i[t.data.index]*o/y,r.vx+=g*m,e>1&&(r.vy+=p*m),e>2&&(r.vz+=v*m))}while(t=t.next)}}return d.initialize=function(r,...o){t=r,n=o.find((t=>"function"==typeof t))||Math.random,e=o.find((t=>[1,2,3].includes(t)))||2,c()},d.strength=function(t){return arguments.length?(s="function"==typeof t?t:Lr(+t),c(),d):s},d.distanceMin=function(t){return arguments.length?(a=t*t,d):Math.sqrt(a)},d.distanceMax=function(t){return arguments.length?(u=t*t,d):Math.sqrt(u)},d.theta=function(t){return arguments.length?(h=t*t,d):Math.sqrt(h)},d}function nn(t,e,r){var n,o=1;function i(){var i,s,a=n.length,u=0,h=0,d=0;for(i=0;i<a;++i)u+=(s=n[i]).x||0,h+=s.y||0,d+=s.z||0;for(u=(u/a-t)*o,h=(h/a-e)*o,d=(d/a-r)*o,i=0;i<a;++i)s=n[i],u&&(s.x-=u),h&&(s.y-=h),d&&(s.z-=d)}return null==t&&(t=0),null==e&&(e=0),null==r&&(r=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.z=function(t){return arguments.length?(r=+t,i):r},i.strength=function(t){return arguments.length?(o=+t,i):o},i}function on(t){return t.x+t.vx}function sn(t){return t.y+t.vy}function an(t){return t.z+t.vz}function un(t){var e,r,n,o,i=1,s=1;function a(){for(var t,a,h,d,c,l,f,g,p=e.length,v=0;v<s;++v)for(a=(1===r?Wr(e,on):2===r?he(e,on,sn):3===r?ye(e,on,sn,an):null).visitAfter(u),t=0;t<p;++t)h=e[t],f=n[h.index],g=f*f,d=h.x+h.vx,r>1&&(c=h.y+h.vy),r>2&&(l=h.z+h.vz),a.visit(m);function m(t,e,n,s,a,u,p){var v=[e,n,s,a,u,p],m=v[0],y=v[1],w=v[2],x=v[r],b=v[r+1],E=v[r+2],N=t.data,M=t.r,_=f+M;if(!N)return m>d+_||x<d-_||r>1&&(y>c+_||b<c-_)||r>2&&(w>l+_||E<l-_);if(N.index>h.index){var k=d-N.x-N.vx,A=r>1?c-N.y-N.vy:0,j=r>2?l-N.z-N.vz:0,S=k*k+A*A+j*j;S<_*_&&(0===k&&(S+=(k=Fr(o))*k),r>1&&0===A&&(S+=(A=Fr(o))*A),r>2&&0===j&&(S+=(j=Fr(o))*j),S=(_-(S=Math.sqrt(S)))/S*i,h.vx+=(k*=S)*(_=(M*=M)/(g+M)),r>1&&(h.vy+=(A*=S)*_),r>2&&(h.vz+=(j*=S)*_),N.vx-=k*(_=1-_),r>1&&(N.vy-=A*_),r>2&&(N.vz-=j*_))}}}function u(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<Math.pow(2,r);++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function h(){if(e){var r,o,i=e.length;for(n=new Array(i),r=0;r<i;++r)o=e[r],n[o.index]=+t(o,r,e)}}return"function"!=typeof t&&(t=Lr(null==t?1:+t)),a.initialize=function(t,...n){e=t,o=n.find((t=>"function"==typeof t))||Math.random,r=n.find((t=>[1,2,3].includes(t)))||2,h()},a.iterations=function(t){return arguments.length?(s=+t,a):s},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:Lr(+e),h(),a):t},a}function hn(t,e,r,n){var o,i,s,a,u=Lr(.1);function h(t){for(var u=0,h=o.length;u<h;++u){var d=o[u],c=d.x-e||1e-6,l=(d.y||0)-r||1e-6,f=(d.z||0)-n||1e-6,g=Math.sqrt(c*c+l*l+f*f),p=(a[u]-g)*s[u]*t/g;d.vx+=c*p,i>1&&(d.vy+=l*p),i>2&&(d.vz+=f*p)}}function d(){if(o){var e,r=o.length;for(s=new Array(r),a=new Array(r),e=0;e<r;++e)a[e]=+t(o[e],e,o),s[e]=isNaN(a[e])?0:+u(o[e],e,o)}}return"function"!=typeof t&&(t=Lr(+t)),null==e&&(e=0),null==r&&(r=0),null==n&&(n=0),h.initialize=function(t,...e){o=t,i=e.find((t=>[1,2,3].includes(t)))||2,d()},h.strength=function(t){return arguments.length?(u="function"==typeof t?t:Lr(+t),d(),h):u},h.radius=function(e){return arguments.length?(t="function"==typeof e?e:Lr(+e),d(),h):t},h.x=function(t){return arguments.length?(e=+t,h):e},h.y=function(t){return arguments.length?(r=+t,h):r},h.z=function(t){return arguments.length?(n=+t,h):n},h}function dn(t){var e,r,n,o=Lr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Lr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Lr(+t),s(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:Lr(+e),s(),i):t},i}function cn(t){var e,r,n,o=Lr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Lr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Lr(+t),s(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:Lr(+e),s(),i):t},i}function ln(t){var e,r,n,o=Lr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vz+=(n[i]-o.z)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Lr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Lr(+t),s(),i):o},i.z=function(e){return arguments.length?(t="function"==typeof e?e:Lr(+e),s(),i):t},i}var fn=r(4341),gn=r.n(fn);class pn{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,pn.defaultOptions,t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,t,Object.assign(Object.assign({},this.options),r))}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,t,Object.assign(Object.assign({},this.options),r))}))}genericDagreLayout(r,n,o){return e(this,void 0,void 0,(function*(){const{nodeSize:e}=o,i=new fn.graphlib.Graph;i.setGraph(o),i.setDefaultEdgeLabel((()=>({}))),[...n.getAllNodes(),...n.getAllEdges()].some((({id:t})=>l(t)))&&console.error("Dagre layout only support string id, it will convert number to string."),n.getAllNodes().forEach((t=>{const{id:r}=t,n=Object.assign({},t.data);if(void 0!==e){const[r,o]=function(t){if(!t)return[0,0,0];if(l(t))return[t,t,t];if(0===t.length)return[0,0,0];const[e,r=e,n=e]=t;return[e,r,n]}(Ut(e)?e(t):e);Object.assign(n,{width:r,height:o})}i.setNode(r.toString(),n)})),n.getAllEdges().forEach((({id:t,source:e,target:r})=>{i.setEdge(e.toString(),r.toString(),{id:t})})),gn().layout(i);const s={nodes:[],edges:[]};return i.nodes().forEach((t=>{const e=i.node(t);s.nodes.push({id:t,data:e}),r&&n.mergeNodeData(t,e)})),i.edges().forEach((e=>{const o=i.edge(e),{id:a}=o,u=t(o,["id"]),{v:h,w:d}=e;s.edges.push({id:a,source:h,target:d,data:u}),r&&n.mergeEdgeData(a,u)})),s}))}}pn.defaultOptions={};class vn{constructor(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}distanceTo(t){const e=this.rx-t.rx,r=this.ry-t.ry;return Math.hypot(e,r)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,r=t.ry-this.ry;let n=Math.hypot(e,r);n=n<1e-4?1e-4:n;const o=this.g*(this.degree+1)*(t.degree+1)/n;this.fx+=o*e/n,this.fy+=o*r/n}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,r=(this.rx*this.mass+t.rx*t.mass)/e,n=(this.ry*this.mass+t.ry*t.mass)/e,o=this.degree+t.degree;return new vn({rx:r,ry:n,mass:e,degree:o})}}class mn{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const r=this.length/2;return t<=this.xmid+r&&t>=this.xmid-r&&e<=this.ymid+r&&e>=this.ymid-r}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new mn({xmid:t,ymid:e,length:r})}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new mn({xmid:t,ymid:e,length:r})}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new mn({xmid:t,ymid:e,length:r})}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new mn({xmid:t,ymid:e,length:r})}}class yn{constructor(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}insert(t){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new yn(this.quad.NW()),this.NE=new yn(this.quad.NE()),this.SW=new yn(this.quad.SW()),this.SE=new yn(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t)):this.body=t}_putBody(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))}_isExternal(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE}updateForce(t){null!=this.body&&t!==this.body&&(this._isExternal()||(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t)))}}const wn={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1},xn={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},bn={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300},En=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;return null==e?r=Math.min(n,o):Math.min(n,o)===t.rows?t.rows=e:t.cols=e,r},Nn=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;return null==e?r=Math.max(n,o):Math.max(n,o)===t.rows?t.rows=e:t.cols=e,r},Mn=(t,e)=>t[`c-${e.row}-${e.col}`]||!1,_n=(t,e)=>t[`c-${e.row}-${e.col}`]=!0,kn=(t,e)=>{const r=t.cols||5;e.col++,e.col>=r&&(e.col=0,e.row++)},An=(t,e,r,n,o,i,s,a)=>{let u,h;const d=o[t.id];if(d)u=d.col*r+r/2+e[0],h=d.row*n+n/2+e[1];else{for(;Mn(a,s);)kn(i,s);u=s.col*r+r/2+e[0],h=s.row*n+n/2+e[1],_n(a,s),kn(i,s)}t.data.x=u,t.data.y=h},jn={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},Sn=(t,e,r,n,o,i)=>{e.forEach(((s,a)=>{r[a]={x:0,y:0},e.forEach(((e,u)=>{if(a===u)return;if(o[a]!==o[u])return;let h=s.x-e.x,d=s.y-e.y,c=Math.sqrt(h*h+d*d);if(0===c){c=1;const t=a>u?1:-1;h=.01*t,d=.01*t}if(c<i(t[a])/2+i(t[u])/2){const t=n*n/c;r[a].x+=h/c*t,r[a].y+=d/c*t}}))}))},On=(t,e,r,n,o,i,s,a)=>{const u=i||s/10;return n&&e.forEach(((e,r)=>{const n=t[r].x-t[o].x,i=t[r].y-t[o].y,s=Math.sqrt(n*n+i*i);let a=i/s,u=-n/s;const h=Math.sqrt(e.x*e.x+e.y*e.y);let d=Math.acos((a*e.x+u*e.y)/h);d>Math.PI/2&&(d-=Math.PI/2,a*=-1,u*=-1);const c=Math.cos(d)*h;e.x=a*c,e.y=u*c})),t.forEach(((i,s)=>{if(s===o)return;const h=Math.sqrt(e[s].x*e[s].x+e[s].y*e[s].y);if(h>0&&s!==o){const d=Math.min(u*(r/800),h);if(i.x+=e[s].x/h*d,i.y+=e[s].y/h*d,n){let e=i.x-t[o].x,r=i.y-t[o].y;const n=Math.sqrt(e*e+r*r);e=e/n*a[s],r=r/n*a[s],i.x=t[o].x+e,i.y=t[o].y+r}}})),t},zn={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10},Rn={center:[0,0],width:300,height:300},In={circular:class{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},Zt),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericCircularLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericCircularLayout(!0,t,r)}))}genericCircularLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{width:o,height:i,center:s,divisions:a,startAngle:u=0,endAngle:h=2*Math.PI,angleRatio:d,ordering:c,clockwise:l,nodeSpacing:f,nodeSize:g}=e,p=r.getAllNodes(),v=r.getAllEdges(),[m,y,w]=((t,e,r)=>{let n=t,o=e,i=r;return n||"undefined"==typeof window||(n=window.innerWidth),o||"undefined"==typeof window||(o=window.innerHeight),i||(i=[n/2,o/2]),[n,o,i]})(o,i,s),x=null==p?void 0:p.length;if(!x||1===x)return Xt(r,t,w);const b=(h-u)/x;let{radius:E,startRadius:N,endRadius:M}=e;if(f){const t=Wt(10,f),e=Yt(10,g);let r=-1/0;p.forEach((t=>{const n=e(t);r<n&&(r=n)}));let n=0;p.forEach(((e,o)=>{n+=0===o?r||10:(t(e)||0)+(r||10)})),E=n/(2*Math.PI)}else E||N||M?!N&&M?N=M:N&&!M&&(M=N):E=Math.min(y,m)/2;const _=b*d;let k=[];k="topology"===c?te(r,p):"topology-directed"===c?te(r,p,!0):"degree"===c?function(t,e){const r=[];return e.forEach(((t,e)=>{r.push(Jt(t))})),r.sort(((e,r)=>t.getDegree(e.id,"both")-t.getDegree(r.id,"both"))),r}(r,p):p.map((t=>Jt(t)));const A=Math.ceil(x/a);for(let t=0;t<x;++t){let e=E;e||null===N||null===M||(e=N+t*(M-N)/(x-1)),e||(e=10+100*t/(x-1));let r=u+t%A*_+2*Math.PI/a*Math.floor(t/A);l||(r=h-t%A*_-2*Math.PI/a*Math.floor(t/A)),k[t].data.x=w[0]+Math.cos(r)*e,k[t].data.y=w[1]+Math.sin(r)*e}return t&&k.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),{nodes:k,edges:v}}))}},concentric:oe,mds:Fe,random:class{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},Rn),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericRandomLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericRandomLayout(!0,t,r)}))}genericRandomLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{center:o,width:i,height:s}=e,a=r.getAllNodes(),u=i||"undefined"==typeof window?i:window.innerWidth,h=s||"undefined"==typeof window?s:window.innerHeight,d=o||[u/2,h/2],c=[];return a&&a.forEach((t=>{c.push({id:t.id,data:{x:.9*(Math.random()-.5)*u+d[0],y:.9*(Math.random()-.5)*h+d[1]}})})),t&&c.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:c,edges:r.getAllEdges()}}))}},grid:class{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},bn),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericGridLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericGridLayout(!0,t,r)}))}genericGridLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{begin:o=[0,0],condense:i,preventOverlapPadding:s,preventOverlap:a,rows:u,cols:h,nodeSpacing:d,nodeSize:c,width:f,height:g,position:p}=e;let{sortBy:v}=e;const m=r.getAllNodes(),y=r.getAllEdges(),w=null==m?void 0:m.length;if(!w||1===w)return Xt(r,t,o);const x=m.map((t=>Jt(t)));"id"===v||ee(v)&&void 0!==x[0].data[v]||(v="degree"),"degree"===v?x.sort(((t,e)=>r.getDegree(e.id,"both")-r.getDegree(t.id,"both"))):"id"===v?x.sort(((t,e)=>l(e.id)&&l(t.id)?e.id-t.id:`${t.id}`.localeCompare(`${e.id}`))):x.sort(((t,e)=>e.data[v]-t.data[v]));const b=f||"undefined"==typeof window?f:window.innerWidth,E=g||"undefined"==typeof window?g:window.innerHeight,N=w,M={rows:u,cols:h};if(null!=u&&null!=h)M.rows=u,M.cols=h;else if(null!=u&&null==h)M.rows=u,M.cols=Math.ceil(N/M.rows);else if(null==u&&null!=h)M.cols=h,M.rows=Math.ceil(N/M.cols);else{const t=Math.sqrt(N*E/b);M.rows=Math.round(t),M.cols=Math.round(b/E*t)}if(M.rows=Math.max(M.rows,1),M.cols=Math.max(M.cols,1),M.cols*M.rows>N){const t=En(M),e=Nn(M);(t-1)*e>=N?En(M,t-1):(e-1)*t>=N&&Nn(M,e-1)}else for(;M.cols*M.rows<N;){const t=En(M),e=Nn(M);(e+1)*t>=N?Nn(M,e+1):En(M,t+1)}let _=i?0:b/M.cols,k=i?0:E/M.rows;if(a||d){const t=Wt(10,d),e=Yt(30,c,!1);x.forEach((n=>{n.data.x&&n.data.y||(n.data.x=0,n.data.y=0);const o=r.getNode(n.id),i=e(o)||30;let a,u;re(i)?(a=i[0],u=i[1]):(a=i,u=i);const h=void 0!==t?t(n):s,d=a+h,c=u+h;_=Math.max(_,d),k=Math.max(k,c)}))}const A={},j={row:0,col:0},S={};for(let t=0;t<x.length;t++){const e=x[t];let n;if(p&&(n=p(r.getNode(e.id))),n&&(void 0!==n.row||void 0!==n.col)){const t={row:n.row,col:n.col};if(void 0===t.col)for(t.col=0;Mn(A,t);)t.col++;else if(void 0===t.row)for(t.row=0;Mn(A,t);)t.row++;S[e.id]=t,_n(A,t)}An(e,o,_,k,S,M,j,A)}const O={nodes:x,edges:y};return t&&x.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),O}))}},radial:class{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},zn),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericRadialLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericRadialLayout(!0,t,r)}))}genericRadialLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{width:o,height:i,center:s,focusNode:a,unitRadius:u,nodeSize:h,nodeSpacing:d,strictRadial:c,preventOverlap:l,maxPreventOverlapIteration:f,sortBy:g,linkDistance:p=50,sortStrength:v=10,maxIteration:m=1e3}=e,y=r.getAllNodes(),w=r.getAllEdges(),x=o||"undefined"==typeof window?o:window.innerWidth,b=i||"undefined"==typeof window?i:window.innerHeight,E=s||[x/2,b/2];if(!(null==y?void 0:y.length)||1===y.length)return Xt(r,t,E);let N=y[0];if(ee(a)){for(let t=0;t<y.length;t++)if(y[t].id===a){N=y[t];break}}else N=a||y[0];const M=((t,e)=>{let r=-1;return t.forEach(((t,n)=>{t.id===e&&(r=n)})),Math.max(r,0)})(y,N.id),_=De({nodes:y,edges:w},!1),k=Ce(_),A=((t,e)=>{let r=0;for(let n=0;n<t[e].length;n++)t[e][n]!==1/0&&(r=t[e][n]>r?t[e][n]:r);return r})(k,M);((t,e,r)=>{const n=t.length;for(let o=0;o<n;o++)if(t[e][o]===1/0){t[e][o]=r,t[o][e]=r;for(let i=0;i<n;i++)t[o][i]!==1/0&&t[e][i]===1/0&&(t[e][i]=r+t[o][i],t[i][e]=r+t[o][i])}for(let r=0;r<n;r++)if(r!==e)for(let o=0;o<n;o++)if(t[r][o]===1/0){let n=Math.abs(t[e][r]-t[e][o]);n=0===n?1:n,t[r][o]=n}})(k,M,A+1);const j=k[M];let S=x-E[0]>E[0]?E[0]:x-E[0],O=b-E[1]>E[1]?E[1]:b-E[1];0===S&&(S=x/2),0===O&&(O=b/2);const z=Math.min(S,O),R=Math.max(...j),I=[],C=u||z/R;j.forEach(((t,e)=>{I[e]=t*C}));const D=((t,e,r,n,o,i,s)=>{if(!t)return[];const a=[];if(e){const u={};e.forEach(((e,h)=>{const d=[];e.forEach(((e,a)=>{var c,l;if(h===a)d.push(0);else if(n[h]===n[a])if("data"===i)d.push(e*(Math.abs(h-a)*s)/(n[h]/o));else if(i){let r,f;if(u[t[h].id])r=u[t[h].id];else{const e=("id"===i?t[h].id:null===(c=t[h].data)||void 0===c?void 0:c[i])||0;r=ee(e)?e.charCodeAt(0):e,u[t[h].id]=r}if(u[t[a].id])f=u[t[a].id];else{const e=("id"===i?t[a].id:null===(l=t[a].data)||void 0===l?void 0:l[i])||0;f=ee(e)?e.charCodeAt(0):e,u[t[a].id]=f}d.push(e*(Math.abs(r-f)*s)/(n[h]/o))}else d.push(e*r/(n[h]/o));else{const t=(r+o)/2;d.push(e*t)}})),a.push(d)}))}return a})(y,k,p,I,C,g,v),P=(t=>{const e=t.length,r=t[0].length,n=[];for(let o=0;o<e;o++){const e=[];for(let n=0;n<r;n++)0!==t[o][n]?e.push(1/(t[o][n]*t[o][n])):e.push(0);n.push(e)}return n})(D),T=((t,e,r)=>{try{const r=Re.mul(Re.pow(e,2),-.5),n=r.mean("row"),o=r.mean("column"),i=r.mean();r.add(i).subRowVector(n).subColumnVector(o);const s=new Ie(r),a=Re.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map((e=>Re.mul([e],[a]).toJSON()[0].splice(0,t)))}catch(t){const n=[];for(let t=0;t<e.length;t++){const t=Math.random()*r,e=Math.random()*r;n.push([t,e])}return n}})(p,D,p);let L,F=T.map((([t,e])=>({x:(isNaN(t)?Math.random()*p:t)-T[M][0],y:(isNaN(e)?Math.random()*p:e)-T[M][1]})));if(this.run(m,F,P,D,I,M),l){L=Ht(h,d);const t={nodes:y,nodeSizeFunc:L,positions:F,radii:I,height:b,width:x,strictRadial:Boolean(c),focusIdx:M,iterations:f||200,k:F.length/4.5};F=((t,e)=>{const r=Object.assign(Object.assign({},jn),e),{positions:n,iterations:o,width:i,k:s,speed:a=100,strictRadial:u,focusIdx:h,radii:d=[],nodeSizeFunc:c}=r,l=t.getAllNodes(),f=[],g=i/10;for(let t=0;t<o;t++)n.forEach(((t,e)=>{f[e]={x:0,y:0}})),Sn(l,n,f,s,d,c),On(n,f,a,u,h,g,i,d);return n})(r,t)}const q=[];return F.forEach(((t,e)=>{const r=Jt(y[e]);r.data.x=t.x+E[0],r.data.y=t.y+E[1],q.push(r)})),t&&q.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:q,edges:w}}))}run(t,e,r,n,o,i){for(let s=0;s<=t;s++){const a=s/t;this.oneIteration(a,e,o,n,r,i)}}oneIteration(t,e,r,n,o,i){const s=1-t;e.forEach(((a,u)=>{const h=Pe(a,{x:0,y:0}),d=0===h?0:1/h;if(u===i)return;let c=0,l=0,f=0;e.forEach(((t,e)=>{if(u===e)return;const r=Pe(a,t),i=0===r?0:1/r,s=n[e][u];f+=o[u][e],c+=o[u][e]*(t.x+s*(a.x-t.x)*i),l+=o[u][e]*(t.y+s*(a.y-t.y)*i)}));const g=0===r[u]?0:1/r[u];f*=s,f+=t*g*g,c*=s,c+=t*g*a.x*d,a.x=c/f,l*=s,l+=t*g*a.y*d,a.y=l/f}))}},force:_e,d3force:Pr,"d3-force-3d":class extends Pr{constructor(){super(...arguments),this.id="d3-force-3d",this.config={inputNodeAttrs:["x","y","z","vx","vy","vz","fx","fy","fz"],outputNodeAttrs:["x","y","z","vx","vy","vz"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource","numDimensions"]},this.forceMap={link:Br,manyBody:rn,center:nn,collide:un,radial:hn,x:dn,y:cn,z:ln},this.options={numDimensions:3,link:{id:t=>t.id},manyBody:{},center:{x:0,y:0,z:0}}}initSimulation(){return function(t,e){e=e||2;var r,n=Math.min(3,Math.max(1,Math.round(e))),o=1,i=.001,s=1-Math.pow(i,1/300),a=0,u=.6,h=new Map,d=xr(f),c=ir("tick","end"),l=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Jr)/Jr}();function f(){g(),c.call("tick",r),o<i&&(d.stop(),c.call("end",r))}function g(e){var i,d,c=t.length;void 0===e&&(e=1);for(var l=0;l<e;++l)for(o+=(a-o)*s,h.forEach((function(t){t(o)})),i=0;i<c;++i)null==(d=t[i]).fx?d.x+=d.vx*=u:(d.x=d.fx,d.vx=0),n>1&&(null==d.fy?d.y+=d.vy*=u:(d.y=d.fy,d.vy=0)),n>2&&(null==d.fz?d.z+=d.vz*=u:(d.z=d.fz,d.vz=0));return r}function p(){for(var e,r=0,o=t.length;r<o;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),null!=e.fz&&(e.z=e.fz),isNaN(e.x)||n>1&&isNaN(e.y)||n>2&&isNaN(e.z)){var i=10*(n>2?Math.cbrt(.5+r):n>1?Math.sqrt(.5+r):r),s=r*tn,a=r*en;1===n?e.x=i:2===n?(e.x=i*Math.cos(s),e.y=i*Math.sin(s)):(e.x=i*Math.sin(s)*Math.cos(a),e.y=i*Math.cos(s),e.z=i*Math.sin(s)*Math.sin(a))}(isNaN(e.vx)||n>1&&isNaN(e.vy)||n>2&&isNaN(e.vz))&&(e.vx=0,n>1&&(e.vy=0),n>2&&(e.vz=0))}}function v(e){return e.initialize&&e.initialize(t,l,n),e}return null==t&&(t=[]),p(),r={tick:g,restart:function(){return d.restart(f),r},stop:function(){return d.stop(),r},numDimensions:function(t){return arguments.length?(n=Math.min(3,Math.max(1,Math.round(t))),h.forEach(v),r):n},nodes:function(e){return arguments.length?(t=e,p(),h.forEach(v),r):t},alpha:function(t){return arguments.length?(o=+t,r):o},alphaMin:function(t){return arguments.length?(i=+t,r):i},alphaDecay:function(t){return arguments.length?(s=+t,r):+s},alphaTarget:function(t){return arguments.length?(a=+t,r):a},velocityDecay:function(t){return arguments.length?(u=1-t,r):1-u},randomSource:function(t){return arguments.length?(l=t,h.forEach(v),r):l},force:function(t,e){return arguments.length>1?(null==e?h.delete(t):h.set(t,v(e)),r):h.get(t)},find:function(){var e,r,o,i,s,a,u=Array.prototype.slice.call(arguments),h=u.shift()||0,d=(n>1?u.shift():null)||0,c=(n>2?u.shift():null)||0,l=u.shift()||1/0,f=0,g=t.length;for(l*=l,f=0;f<g;++f)(i=(e=h-(s=t[f]).x)*e+(r=d-(s.y||0))*r+(o=c-(s.z||0))*o)<l&&(a=s,l=i);return a},on:function(t,e){return arguments.length>1?(c.on(t,e),r):c.on(t)}}}()}},fruchterman:class{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},xn),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericFruchtermanLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericFruchtermanLayout(!0,t,r)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;e<t;e++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericFruchtermanLayout(t,r,n){return e(this,void 0,void 0,(function*(){if(this.running)return;const e=this.formatOptions(n),{dimensions:o,width:i,height:s,center:a,clustering:u,nodeClusterBy:d,maxIteration:c,onTick:l}=e,f=r.getAllNodes(),g=r.getAllEdges();if(!(null==f?void 0:f.length)){const t={nodes:[],edges:g};return this.lastResult=t,t}if(1===f.length){t&&r.mergeNodeData(f[0].id,{x:a[0],y:a[1],z:3===o?a[2]:void 0});const e={nodes:[Object.assign(Object.assign({},f[0]),{data:Object.assign(Object.assign({},f[0].data),{x:a[0],y:a[1],z:3===o?a[2]:void 0})})],edges:g};return this.lastResult=e,e}const p=f.map((t=>Jt(t,[i,s]))),v=new h({nodes:p,edges:g}),m={};if(u&&p.forEach((t=>{const e=t.data[d];m[e]||(m[e]={name:e,cx:0,cy:0,count:0})})),this.lastLayoutNodes=p,this.lastLayoutEdges=g,this.lastAssign=t,this.lastGraph=v,this.lastOptions=e,this.lastClusterMap=m,"undefined"==typeof window)return;let y=0;return new Promise((n=>{this.timeInterval=window.setInterval((()=>{this.running?(this.runOneStep(v,m,e),t&&p.forEach((({id:t,data:e})=>r.mergeNodeData(t,{x:e.x,y:e.y,z:3===o?e.z:void 0}))),null==l||l({nodes:p,edges:g}),y++,y>=c&&(window.clearInterval(this.timeInterval),n({nodes:p,edges:g}))):n({nodes:p,edges:g})}),0),this.running=!0}))}))}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:r,nodeClusterBy:n}=e,{center:o,width:i,height:s}=e;return e.width=i||"undefined"==typeof window?i:window.innerWidth,e.height=s||"undefined"==typeof window?s:window.innerHeight,e.center=o||[e.width/2,e.height/2],e.clustering=r&&!!n,e}runOneStep(t,e,r){const{dimensions:n,height:o,width:i,gravity:s,center:a,speed:u,clustering:h,nodeClusterBy:d,clusterGravity:c}=r,f=o*i,g=Math.sqrt(f)/10,p=t.getAllNodes(),v=f/(p.length+1),m=Math.sqrt(v),y={};if(this.applyCalculate(t,y,m,v),h){for(const t in e)e[t].cx=0,e[t].cy=0,e[t].count=0;p.forEach((t=>{const{data:r}=t,n=e[r[d]];l(r.x)&&(n.cx+=r.x),l(r.y)&&(n.cy+=r.y),n.count++}));for(const t in e)e[t].cx/=e[t].count,e[t].cy/=e[t].count;const t=c||s;p.forEach(((r,n)=>{const{id:o,data:i}=r;if(!l(i.x)||!l(i.y))return;const s=e[i[d]],a=Math.sqrt((i.x-s.cx)*(i.x-s.cx)+(i.y-s.cy)*(i.y-s.cy)),u=m*t;y[o].x-=u*(i.x-s.cx)/a,y[o].y-=u*(i.y-s.cy)/a}))}p.forEach(((t,e)=>{const{id:r,data:o}=t;if(!l(o.x)||!l(o.y))return;const i=.01*m*s;y[r].x-=i*(o.x-a[0]),y[r].y-=i*(o.y-a[1]),3===n&&(y[r].z-=i*(o.z-a[2]))})),p.forEach(((e,r)=>{const{id:o,data:i}=e;if(l(i.fx)&&l(i.fy))return i.x=i.fx,i.y=i.fy,void(3===n&&(i.z=i.fz));if(!l(i.x)||!l(i.y))return;const s=Math.sqrt(y[o].x*y[o].x+y[o].y*y[o].y+(3===n?y[o].z*y[o].z:0));if(s>0){const e=Math.min(g*(u/800),s);t.mergeNodeData(o,{x:i.x+y[o].x/s*e,y:i.y+y[o].y/s*e,z:3===n?i.z+y[o].z/s*e:void 0})}}))}applyCalculate(t,e,r,n){this.calRepulsive(t,e,n),this.calAttractive(t,e,r)}calRepulsive(t,e,r){const n=t.getAllNodes();n.forEach((({data:t,id:o},i)=>{e[o]={x:0,y:0,z:0},n.forEach((({data:n,id:s},a)=>{if(i<=a||!l(t.x)||!l(n.x)||!l(t.y)||!l(n.y))return;let u=t.x-n.x,h=t.y-n.y,d=3===this.options.dimensions?t.z-n.z:0,c=u*u+h*h+d*d;0===c&&(c=1,u=.01,h=.01,d=.01);const f=r/c,g=u*f,p=h*f,v=d*f;e[o].x+=g,e[o].y+=p,e[s].x-=g,e[s].y-=p,3===this.options.dimensions&&(e[o].z+=v,e[s].z-=v)}))}))}calAttractive(t,e,r){t.getAllEdges().forEach((n=>{const{source:o,target:i}=n;if(!o||!i||o===i)return;const{data:s}=t.getNode(o),{data:a}=t.getNode(i);if(!(l(a.x)&&l(s.x)&&l(a.y)&&l(s.y)))return;const u=a.x-s.x,h=a.y-s.y,d=3===this.options.dimensions?a.z-s.z:0,c=Math.sqrt(u*u+h*h+d*d)/r,f=u*c,g=h*c,p=d*c;e[o].x+=f,e[o].y+=g,e[i].x-=f,e[i].y-=g,3===this.options.dimensions&&(e[o].z+=p,e[i].z-=p)}))}},forceAtlas2:class{constructor(t={}){this.options=t,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},wn),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericForceAtlas2Layout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericForceAtlas2Layout(!0,t,r)}))}genericForceAtlas2Layout(t,r,n){return e(this,void 0,void 0,(function*(){const e=r.getAllEdges(),o=r.getAllNodes(),i=this.formatOptions(n,o.length),{width:s,height:a,prune:u,maxIteration:d,nodeSize:c,center:l}=i;if(!(null==o?void 0:o.length)||1===o.length)return Xt(r,t,l);const f=o.map((t=>Jt(t,[s,a]))),g=e.filter((t=>{const{source:e,target:r}=t;return e!==r})),p=new h({nodes:f,edges:g}),v=this.getSizes(p,r,c);if(this.run(p,r,d,v,t,i),u){for(let t=0;t<g.length;t+=1){const{source:e,target:r}=g[t],n=p.getDegree(e),o=p.getDegree(e);if(n<=1){const t=p.getNode(r);p.mergeNodeData(e,{x:t.data.x,y:t.data.y})}else if(o<=1){const t=p.getNode(e);p.mergeNodeData(r,{x:t.data.x,y:t.data.y})}}const e=Object.assign(Object.assign({},i),{prune:!1,barnesHut:!1});this.run(p,r,100,v,t,e)}return{nodes:f,edges:e}}))}getSizes(t,e,r){const n=t.getAllNodes(),o={};for(let t=0;t<n.length;t+=1){const{id:i,data:s}=n[t];if(o[i]=10,l(s.size))o[i]=s.size;else if(re(s.size))isNaN(s.size[0])||(o[i]=Math.max(s.size[0])),isNaN(s.size[1])||(o[i]=Math.max(s.size[1]));else if(Gt(s.size))o[i]=Math.max(s.size.width,s.size.height);else if(Ut(r)){const t=r(e.getNode(i));re(t)?o[i]=Math.max(...t):o[i]=t}else re(r)?o[i]=Math.max(...r):l(r)&&(o[i]=r)}return o}formatOptions(t={},e){const r=Object.assign(Object.assign({},this.options),t),{center:n,width:o,height:i,barnesHut:s,prune:a,maxIteration:u,kr:h,kg:d}=r;return r.width=o||"undefined"==typeof window?o:window.innerWidth,r.height=i||"undefined"==typeof window?i:window.innerHeight,r.center=n||[r.width/2,r.height/2],void 0===s&&e>250&&(r.barnesHut=!0),void 0===a&&e>100&&(r.prune=!0),0!==u||a?0===u&&a&&(r.maxIteration=100,e<=200&&e>100?r.maxIteration=500:e>200&&(r.maxIteration=950)):(r.maxIteration=250,e<=200&&e>100?r.maxIteration=1e3:e>200&&(r.maxIteration=1200)),h||(r.kr=50,e>100&&e<=500?r.kr=20:e>500&&(r.kr=1)),d||(r.kg=20,e>100&&e<=500?r.kg=10:e>500&&(r.kg=1)),r}run(t,e,r,n,o,i){const{kr:s,barnesHut:a,onTick:u}=i,h=t.getAllNodes();let d=0,c=r;const l={},f={},g={};for(let e=0;e<h.length;e+=1){const{data:r,id:n}=h[e];if(l[n]=[0,0],a){const o={id:e,rx:r.x,ry:r.y,mass:1,g:s,degree:t.getDegree(n)};g[n]=new vn(o)}}for(;c>0;)d=this.oneStep(t,{iter:c,preventOverlapIters:50,krPrime:100,sg:d,forces:l,preForces:f,bodies:g,sizes:n},i),c--,null==u||u({nodes:h,edges:e.getAllEdges()});return t}oneStep(t,e,r){const{iter:n,preventOverlapIters:o,krPrime:i,sg:s,preForces:a,bodies:u,sizes:h}=e;let{forces:d}=e;const{preventOverlap:c,barnesHut:l}=r,f=t.getAllNodes();for(let t=0;t<f.length;t+=1){const{id:e}=f[t];a[e]=[...d[e]],d[e]=[0,0]}return d=this.getAttrForces(t,n,o,h,d,r),d=l&&(c&&n>o||!c)?this.getOptRepGraForces(t,d,u,r):this.getRepGraForces(t,n,o,d,i,h,r),this.updatePos(t,d,a,s,r)}getAttrForces(t,e,r,n,o,i){const{preventOverlap:s,dissuadeHubs:a,mode:u,prune:h}=i,d=t.getAllEdges();for(let i=0;i<d.length;i+=1){const{source:c,target:l}=d[i],f=t.getNode(c),g=t.getNode(l),p=t.getDegree(c),v=t.getDegree(l);if(h&&(p<=1||v<=1))continue;const m=[g.data.x-f.data.x,g.data.y-f.data.y];let y=Math.hypot(m[0],m[1]);y=y<1e-4?1e-4:y,m[0]=m[0]/y,m[1]=m[1]/y,s&&e<r&&(y=y-n[c]-n[l]);let w=y,x=w;"linlog"===u&&(w=Math.log(1+y),x=w),a&&(w=y/p,x=y/v),s&&e<r&&y<=0?(w=0,x=0):s&&e<r&&y>0&&(w=y,x=y),o[c][0]+=w*m[0],o[l][0]-=x*m[0],o[c][1]+=w*m[1],o[l][1]-=x*m[1]}return o}getOptRepGraForces(t,e,r,n){const{kg:o,center:i,prune:s}=n,a=t.getAllNodes(),u=a.length;let h=9e10,d=-9e10,c=9e10,l=-9e10;for(let e=0;e<u;e+=1){const{id:n,data:o}=a[e];s&&t.getDegree(n)<=1||(r[n].setPos(o.x,o.y),o.x>=d&&(d=o.x),o.x<=h&&(h=o.x),o.y>=l&&(l=o.y),o.y<=c&&(c=o.y))}const f=Math.max(d-h,l-c),g=new mn({xmid:(d+h)/2,ymid:(l+c)/2,length:f,massCenter:i,mass:u}),p=new yn(g);for(let e=0;e<u;e+=1){const{id:n}=a[e];s&&t.getDegree(n)<=1||r[n].in(g)&&p.insert(r[n])}for(let n=0;n<u;n+=1){const{id:u,data:h}=a[n],d=t.getDegree(u);if(s&&d<=1)continue;r[u].resetForce(),p.updateForce(r[u]),e[u][0]-=r[u].fx,e[u][1]-=r[u].fy;const c=[h.x-i[0],h.y-i[1]];let l=Math.hypot(c[0],c[1]);l=l<1e-4?1e-4:l,c[0]=c[0]/l,c[1]=c[1]/l;const f=o*(d+1);e[u][0]-=f*c[0],e[u][1]-=f*c[1]}return e}getRepGraForces(t,e,r,n,o,i,s){const{preventOverlap:a,kr:u,kg:h,center:d,prune:c}=s,l=t.getAllNodes(),f=l.length;for(let s=0;s<f;s+=1){const g=l[s],p=t.getDegree(g.id);for(let h=s+1;h<f;h+=1){const s=l[h],d=t.getDegree(s.id);if(c&&(p<=1||d<=1))continue;const f=[s.data.x-g.data.x,s.data.y-g.data.y];let v=Math.hypot(f[0],f[1]);v=v<1e-4?1e-4:v,f[0]=f[0]/v,f[1]=f[1]/v,a&&e<r&&(v=v-i[g.id]-i[s.id]);let m=u*(p+1)*(d+1)/v;a&&e<r&&v<0?m=o*(p+1)*(d+1):a&&e<r&&0===v?m=0:a&&e<r&&v>0&&(m=u*(p+1)*(d+1)/v),n[g.id][0]-=m*f[0],n[s.id][0]+=m*f[0],n[g.id][1]-=m*f[1],n[s.id][1]+=m*f[1]}const v=[g.data.x-d[0],g.data.y-d[1]],m=Math.hypot(v[0],v[1]);v[0]=v[0]/m,v[1]=v[1]/m;const y=h*(p+1);n[g.id][0]-=y*v[0],n[g.id][1]-=y*v[1]}return n}updatePos(t,e,r,n,o){const{ks:i,tao:s,prune:a,ksmax:u}=o,h=t.getAllNodes(),d=h.length,c=[],f=[];let g=0,p=0,v=n;for(let n=0;n<d;n+=1){const{id:o}=h[n],i=t.getDegree(o);if(a&&i<=1)continue;const s=[e[o][0]-r[o][0],e[o][1]-r[o][1]],u=Math.hypot(s[0],s[1]),d=[e[o][0]+r[o][0],e[o][1]+r[o][1]],l=Math.hypot(d[0],d[1]);c[n]=u,f[n]=l/2,g+=(i+1)*c[n],p+=(i+1)*f[n]}const m=v;v=s*p/g,0!==m&&(v=v>1.5*m?1.5*m:v);for(let r=0;r<d;r+=1){const{id:n,data:o}=h[r],s=t.getDegree(n);if(a&&s<=1)continue;if(l(o.fx)&&l(o.fy))continue;let d=i*v/(1+v*Math.sqrt(c[r])),f=Math.hypot(e[n][0],e[n][1]);f=f<1e-4?1e-4:f;const g=u/f;d=d>g?g:d;const p=d*e[n][0],m=d*e[n][1];t.mergeNodeData(n,{x:o.x+p,y:o.y+m})}return v}},dagre:pn,antvDagre:class{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},Qt),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,t,r)}))}genericDagreLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{nodeSize:o,align:i,rankdir:s="TB",ranksep:a,nodesep:u,ranksepFunc:d,nodesepFunc:c,edgeLabelSpace:f,ranker:g,nodeOrder:p,begin:v,controlPoints:m,radial:y,sortByCombo:w,preset:x}=e,b=new h({tree:[]}),E=Wt(a||50,d),N=Wt(u||50,c);let M=N,_=E;"LR"!==s&&"RL"!==s||(M=E,_=N);const k=Ht(o,void 0),A=r.getAllNodes(),j=r.getAllEdges();let S;A.forEach((t=>{const e=k(t),r=_(t),n=e+2*M(t),o=e+2*r,i=t.data.layer;l(i)?b.addNode({id:t.id,data:{width:n,height:o,layer:i}}):b.addNode({id:t.id,data:{width:n,height:o}})})),w&&(b.attachTreeStructure("combo"),A.forEach((t=>{const{parentId:e}=t.data;void 0!==e&&b.hasNode(e)&&b.setParent(t.id,e,"combo")}))),j.forEach((t=>{b.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||1}})})),(null==x?void 0:x.length)&&(S=new h({nodes:x})),((t,e)=>{const{edgeLabelSpace:r,keepNodeOrder:n,prevGraph:o,rankdir:i,ranksep:s}=e;var a,u;!n&&o&&(u=o,(a=t).getAllNodes().forEach((t=>{const e=a.getNode(t.id);if(u.hasNode(t.id)){const r=u.getNode(t.id);e.data.fixorder=r.data._order,delete r.data._order}else delete e.data.fixorder})));const d=(t=>{const e=new h({tree:[]});return t.getAllNodes().forEach((r=>{const n=$t(t.getNode(r.id).data),o=Object.assign(Object.assign({},At),n),i=Bt(o,kt);e.hasNode(r.id)||e.addNode({id:r.id,data:Object.assign({},i)});const s=t.hasTreeStructure("combo")?t.getParent(r.id,"combo"):t.getParent(r.id);null==s||(e.hasNode(s.id)||e.addNode(Object.assign({},s)),e.setParent(r.id,s.id))})),t.getAllEdges().forEach((r=>{const n=$t(t.getEdge(r.id).data),o={};null==Ot||Ot.forEach((t=>{void 0!==n[t]&&(o[t]=n[t])})),e.addEdge({id:r.id,source:r.source,target:r.target,data:Object.assign({},St,Bt(n,jt),o)})})),e})(t);let c;r&&(e.ranksep=((t,e)=>{const{ranksep:r=0,rankdir:n}=e;return t.getAllNodes().forEach((t=>{isNaN(t.data.layer)||t.data.layer||(t.data.layer=0)})),t.getAllEdges().forEach((t=>{var e;t.data.minlen*=2,"c"!==(null===(e=t.data.labelpos)||void 0===e?void 0:e.toLowerCase())&&("TB"===n||"BT"===n?t.data.width+=t.data.labeloffset:t.data.height+=t.data.labeloffset)})),r/2})(d,{rankdir:i,ranksep:s}));try{c=_t(d,e)}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph\'s structure:\\n",t);throw t}((t,e)=>{t.getAllNodes().forEach((r=>{var n;const o=t.getNode(r.id);if(o){const t=e.getNode(r.id);o.data.x=t.data.x,o.data.y=t.data.y,o.data._order=t.data.order,o.data._rank=t.data.rank,(null===(n=e.getChildren(r.id))||void 0===n?void 0:n.length)&&(o.data.width=t.data.width,o.data.height=t.data.height)}})),t.getAllEdges().forEach((r=>{const n=t.getEdge(r.id),o=e.getEdge(r.id);n.data.points=o?o.data.points:[],o&&o.data.hasOwnProperty("x")&&(n.data.x=o.data.x,n.data.y=o.data.y)}))})(t,d)})(b,{prevGraph:S,edgeLabelSpace:f,keepNodeOrder:!!p,nodeOrder:p||[],acyclicer:"greedy",ranker:g,rankdir:s,nodesep:u,align:i});const O=[0,0];if(v){let t=1/0,e=1/0;b.getAllNodes().forEach((r=>{t>r.data.x&&(t=r.data.x),e>r.data.y&&(e=r.data.y)})),b.getAllEdges().forEach((r=>{var n;null===(n=r.data.points)||void 0===n||n.forEach((r=>{t>r.x&&(t=r.x),e>r.y&&(e=r.y)}))})),O[0]=v[0]-t,O[1]=v[1]-e}const z="LR"===s||"RL"===s;if(y);else{const t=new Set,e="BT"===s||"RL"===s?(t,e)=>e-t:(t,e)=>t-e;b.getAllNodes().forEach((e=>{e.data.x=e.data.x+O[0],e.data.y=e.data.y+O[1],t.add(z?e.data.x:e.data.y)}));const r=Array.from(t).sort(e),n=z?(t,e)=>t.x!==e.x:(t,e)=>t.y!==e.y,o=z?(t,e,r)=>{const n=Math.max(e.y,r.y),o=Math.min(e.y,r.y);return t.filter((t=>t.y<=n&&t.y>=o))}:(t,e,r)=>{const n=Math.max(e.x,r.x),o=Math.min(e.x,r.x);return t.filter((t=>t.x<=n&&t.x>=o))};b.getAllEdges().forEach(((t,e)=>{var i;f&&m&&"loop"!==t.data.type&&(t.data.controlPoints=((t,e,r,n,o,i,s)=>{let a=(null==t?void 0:t.slice(1,t.length-1))||[];if(e&&r){let{x:t,y:u}=e.data,{x:h,y:d}=r.data;if(o&&(t=e.data.y,u=e.data.x,h=r.data.y,d=r.data.x),d!==u&&t!==h){const c=n.indexOf(u),l=n[c+1];if(l){const t=a[0],e=o?{x:(u+l)/2,y:(null==t?void 0:t.y)||h}:{x:(null==t?void 0:t.x)||h,y:(u+l)/2};t&&!i(t,e)||a.unshift(e)}const f=n.indexOf(d),g=Math.abs(f-c);if(1===g)a=s(a,e.data,r.data),a.length||a.push(o?{x:(u+d)/2,y:t}:{x:t,y:(u+d)/2});else if(g>1){const e=n[f-1];if(e){const r=a[a.length-1],n=o?{x:(d+e)/2,y:(null==r?void 0:r.y)||h}:{x:(null==r?void 0:r.x)||t,y:(d+e)/2};r&&!i(r,n)||a.push(n)}}}}return a})(null===(i=t.data.points)||void 0===i?void 0:i.map((({x:t,y:e})=>({x:t+O[0],y:e+O[1]}))),b.getNode(t.source),b.getNode(t.target),r,z,n,o))}))}let R=[];R=b.getAllNodes().map((t=>Jt(t)));const I=b.getAllEdges();return t&&(R.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),I.forEach((t=>{r.mergeEdgeData(t.id,{controlPoints:t.data.controlPoints})}))),{nodes:R,edges:I}}))}},comboCombined:class{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},$e),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericComboCombinedLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericComboCombinedLayout(!0,t,r)}))}genericComboCombinedLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:o,treeKey:i,outerLayout:s}=e,a=r.getAllNodes().filter((t=>!t.data._isCombo)),u=r.getAllNodes().filter((t=>t.data._isCombo)),d=r.getAllEdges(),c=null==a?void 0:a.length;if(!c||1===c)return Xt(r,t,o);const l=[],f=new Map;a.forEach((t=>{f.set(t.id,t)}));const g=new Map;u.forEach((t=>{g.set(t.id,t)}));const p=new Map,v=this.getInnerGraphs(r,i,f,g,d,e,p);yield Promise.all(v);const m=new Map,y=[],w=new Map;let x=!0;r.getRoots(i).forEach((t=>{const e=p.get(t.id),n=g.get(t.id)||f.get(t.id),o={id:t.id,data:Object.assign(Object.assign({},t.data),{x:e.data.x||n.data.x,y:e.data.y||n.data.y,fx:e.data.fx||n.data.fx,fy:e.data.fy||n.data.fy,mass:e.data.mass||n.data.mass,size:e.data.size})};y.push(o),m.set(t.id,!0),isNaN(o.data.x)||0===o.data.x||isNaN(o.data.y)||0===o.data.y?(o.data.x=100*Math.random(),o.data.y=100*Math.random()):x=!1,Te(r,[t],(e=>{e.id!==t.id&&w.set(e.id,t.id)}),"TB",i)}));const b=[];let E;if(d.forEach((t=>{const e=w.get(t.source)||t.source,r=w.get(t.target)||t.target;e!==r&&m.has(e)&&m.has(r)&&b.push({id:t.id,source:e,target:r,data:{}})})),null==y?void 0:y.length){if(1===y.length)y[0].data.x=o[0],y[0].data.y=o[1];else{const t=new h({nodes:y,edges:b}),e=s||new _e;if(x&&Be[e.id]){const e=y.length<100?new Fe:new oe;yield e.assign(t)}E=yield e.execute(t,Object.assign({center:o,kg:5,preventOverlap:!0,animate:!1},"force"===e.id?{gravity:1,factor:4,linkDistance:(t,e,r)=>(Math.max(...e.data.size)||32)/2+(Math.max(...r.data.size)||32)/2+200}:{}))}p.forEach((t=>{var e;const r=E.nodes.find((e=>e.id===t.id));if(r){const{x:e,y:n}=r.data;t.data.visited=!0,t.data.x=e,t.data.y=n,l.push({id:t.id,data:{x:e,y:n}})}const{x:n,y:o}=t.data;null===(e=t.data.nodes)||void 0===e||e.forEach((t=>{l.push({id:t.id,data:{x:t.data.x+n,y:t.data.y+o}})}))})),p.forEach((({data:t})=>{const{x:e,y:r,visited:n,nodes:o}=t;null==o||o.forEach((t=>{if(!n){const n=l.find((e=>e.id===t.id));n.data.x+=e||0,n.data.y+=r||0}}))}))}return t&&l.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),{nodes:l,edges:d}}))}initVals(t){const e=Object.assign({},t),{nodeSize:r,spacing:n,comboPadding:o}=t;let i,s,a;if(s=l(n)?()=>n:Ut(n)?n:()=>0,e.spacing=s,r)if(Ut(r))i=t=>{const e=r(t),n=s(t);return re(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+n)/2:((e||32)+n)/2};else if(re(r)){const t=(r[0]>r[1]?r[0]:r[1])/2;i=e=>t+s(e)/2}else{const t=r/2;i=e=>t+s(e)/2}else i=t=>{const e=s(t);return t.size?re(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+e)/2:Gt(t.size)?((t.size.width>t.size.height?t.size.width:t.size.height)+e)/2:(t.size+e)/2:32+e/2};return e.nodeSize=i,a=l(o)?()=>o:re(o)?()=>Math.max.apply(null,o):Ut(o)?o:()=>0,e.comboPadding=a,e}getInnerGraphs(t,r,n,o,i,s,a){const{nodeSize:u,comboPadding:d,spacing:c,innerLayout:f}=s,g=f||new oe({}),p={center:[0,0],preventOverlap:!0,nodeSpacing:c},v=[],m=t=>{let e=(null==d?void 0:d(t))||10;return re(e)&&(e=Math.max(...e)),{size:e?[2*e,2*e]:[30,30],padding:e}};return t.getRoots(r).forEach((s=>{a.set(s.id,{id:s.id,data:{nodes:[],size:m(s).size}});let d=Promise.resolve();Te(t,[s],(s=>{var c;if(!s.data._isCombo)return;const{size:f,padding:v}=m(s);if(null===(c=t.getChildren(s.id,r))||void 0===c?void 0:c.length){const c=a.get(s.id);a.set(s.id,{id:s.id,data:Object.assign({nodes:[]},null==c?void 0:c.data)});const f=new Map,m=t.getChildren(s.id,r).map((t=>{if(t.data._isCombo)return a.has(t.id)||a.set(t.id,{id:t.id,data:Object.assign({},t.data)}),f.set(t.id,!0),a.get(t.id);const e=n.get(t.id)||o.get(t.id);return f.set(t.id,!0),{id:t.id,data:Object.assign(Object.assign({},e.data),t.data)}})),y={nodes:m,edges:i.filter((t=>f.has(t.source)&&f.has(t.target)))};let w=1/0;m.forEach((t=>{var e;let{size:r}=t.data;r||(r=(null===(e=a.get(t.id))||void 0===e?void 0:e.data.size)||(null==u?void 0:u(t))||[30,30]),l(r)&&(r=[r,r]);const[n,o]=r;w>n&&(w=n),w>o&&(w=o),t.data.size=r})),d=d.then((()=>e(this,void 0,void 0,(function*(){const t=new h(y),e=yield g.assign(t,p),{minX:r,minY:n,maxX:o,maxY:i}=(t=>{let e=1/0,r=1/0,n=-1/0,o=-1/0;return t.forEach((t=>{let i=t.data.size;re(i)?1===i.length&&(i=[i[0],i[0]]):l(i)?i=[i,i]:(void 0===i||isNaN(i))&&(i=[30,30]);const s=[i[0]/2,i[1]/2],a=t.data.x-s[0],u=t.data.x+s[0],h=t.data.y-s[1],d=t.data.y+s[1];e>a&&(e=a),r>h&&(r=h),n<u&&(n=u),o<d&&(o=d)})),{minX:e,minY:r,maxX:n,maxY:o}})(m),u=(o+r)/2,d=(i+n)/2;y.nodes.forEach((t=>{t.data.x-=u,t.data.y-=d}));const c=[Math.max(o-r,w)+2*v,Math.max(i-n,w)+2*v];return a.get(s.id).data.size=c,a.get(s.id).data.nodes=m,e}))))}else a.set(s.id,{id:s.id,data:Object.assign(Object.assign({},s.data),{size:f})});return!0}),"BT",r),v.push(d)})),v}}};let Cn;function Dn(){(null==Cn?void 0:Cn.stop)&&Cn.stop()}function Pn(t,r){return e(this,void 0,void 0,(function*(){const{layout:{id:e,options:n,iterations:o},nodes:i,edges:s}=t,a=new h({nodes:i,edges:s}),u=In[e];if(!u)throw new Error(`Unknown layout id: ${e}`);Cn=new u(n);let d=yield Cn.execute(a);return!!(c=Cn).tick&&!!c.stop&&(Cn.stop(),d=Cn.tick(o)),[d,r];var c}))}addEventListener("message",(function(t){var e,r=t.data,o=r.type,i=r.method,s=r.id,a=r.params;"RPC"===o&&i&&((e=n[i])?Promise.resolve().then((function(){return e.apply(n,a)})):Promise.reject("No such method")).then((function(t){postMessage({type:"RPC",id:s,result:t})})).catch((function(t){var e={message:t};t.stack&&(e.message=t.message,e.stack=t.stack,e.name=t.name),postMessage({type:"RPC",id:s,error:e})}))})),postMessage({type:"RPC",method:"ready"})})()})();\n//# sourceMappingURL=62953f7fd7012203b024.worker.js.map']))),n(t,o),t}},6135:t=>{t.exports=function(t,e){var r=0,n={};t.addEventListener("message",(function(e){var r=e.data;if("RPC"===r.type)if(r.id){var o=n[r.id];o&&(delete n[r.id],r.error?o[1](Object.assign(Error(r.error.message),r.error)):o[0](r.result))}else{var i=document.createEvent("Event");i.initEvent(r.method,!1,!1),i.data=r.params,t.dispatchEvent(i)}})),e.forEach((function(e){t[e]=function(){var o=arguments;return new Promise((function(i,s){var a=++r;n[a]=[i,s],t.postMessage({type:"RPC",id:a,method:e,params:[].slice.call(o)})}))}}))}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={id:n,loaded:!1,exports:{}};return t[n](i,i.exports,r),i.loaded=!0,i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var n={};return(()=>{"use strict";function t(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}function e(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}r.r(n),r.d(n,{AntVDagreLayout:()=>ee,CircularLayout:()=>ie,ComboCombinedLayout:()=>Ze,ConcentricLayout:()=>ce,D3Force3DLayout:()=>Nn,D3ForceLayout:()=>Wr,DagreLayout:()=>kn,ForceAtlas2Layout:()=>zn,ForceLayout:()=>Re,FruchtermanLayout:()=>In,GridLayout:()=>Dn,MDSLayout:()=>Ye,RadialLayout:()=>Wn,RandomLayout:()=>Zn,Supervisor:()=>a,clone:()=>Qt,cloneFormatData:()=>Zt,floydWarshall:()=>Ve,formatNodeSize:()=>Xt,formatNumberFn:()=>Jt,formatSizeFn:()=>Ht,getAdjMatrix:()=>Ue,getEuclideanDistance:()=>Ge,getLayoutBBox:()=>$e,graphTreeDfs:()=>We,isArray:()=>he,isLayoutWithIterations:()=>eo,registry:()=>to,scaleMatrix:()=>Be}),Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;const o=function(){function t(){this._events={}}return t.prototype.on=function(t,e,r){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!r}),this},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.emit=function(t){for(var e=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=this._events[t]||[],i=this._events["*"]||[],s=function(n){for(var o=n.length,i=0;i<o;i++)if(n[i]){var s=n[i],a=s.callback;s.once&&(n.splice(i,1),0===n.length&&delete e._events[t],o--,i--),a.apply(e,r)}};s(o),s(i)},t.prototype.off=function(t,e){if(t)if(e){for(var r=this._events[t]||[],n=r.length,o=0;o<n;o++)r[o].callback===e&&(r.splice(o,1),n--,o--);0===r.length&&delete this._events[t]}else delete this._events[t];else this._events={};return this},t.prototype.getEvents=function(){return this._events},t}();var i=r(2583),s=r.n(i);class a extends o{constructor(t,e,r){super(),this.graph=t,this.layout=e,this.options=r,this.spawnWorker()}spawnWorker(){this.worker&&this.worker.terminate(),this.worker=s()(),this.running&&(this.running=!1,this.execute())}execute(){var r;return e(this,void 0,void 0,(function*(){if(this.running)return this;this.running=!0;const e=this.layout.options,{onTick:n}=e,o=t(e,["onTick"]),i={layout:{id:this.layout.id,options:o,iterations:null===(r=this.options)||void 0===r?void 0:r.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},s=new Float32Array([0]),[a]=yield this.worker.calculateLayout(i,[s]);return a}))}stop(){return this.running=!1,this.worker.stopLayout(),this}kill(){this.worker&&this.worker.terminate()}isRunning(){return this.running}}function u(t,e,r,n){for(;t.length;){const o=t.shift();if(r(o))return!0;e.add(o.id),n(o.id).forEach((r=>{e.has(r.id)||(e.add(r.id),t.push(r))}))}return!1}function h(t,e,r,n){if(r(t))return!0;e.add(t.id);for(const o of n(t.id))if(!e.has(o.id)&&h(o,e,r,n))return!0;return!1}const d=()=>!0;class c{graph;nodeFilter;edgeFilter;cacheEnabled;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;allNodesMap=new Map;allEdgesMap=new Map;constructor(t){this.graph=t.graph;const e=t.nodeFilter||d,r=t.edgeFilter||d;this.nodeFilter=e,this.edgeFilter=t=>{const{source:n,target:o}=this.graph.getEdgeDetail(t.id);return!(!e(n)||!e(o))&&r(t,n,o)},"auto"===t.cache?(this.cacheEnabled=!0,this.startAutoCache()):"manual"===t.cache?this.cacheEnabled=!0:this.cacheEnabled=!1}clearCache=()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()};refreshCache=()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map((t=>t.id)))};updateCache=t=>{const e=new Set;t.forEach((t=>{const r=this.bothEdgesMap.get(t);if(r&&r.forEach((t=>e.add(t.id))),this.hasNode(t)){const r=this.graph.getRelatedEdges(t,"in").filter(this.edgeFilter),n=this.graph.getRelatedEdges(t,"out").filter(this.edgeFilter),o=Array.from(new Set([...r,...n]));o.forEach((t=>e.add(t.id))),this.inEdgesMap.set(t,r),this.outEdgesMap.set(t,n),this.bothEdgesMap.set(t,o),this.allNodesMap.set(t,this.graph.getNode(t))}else this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.bothEdgesMap.delete(t),this.allNodesMap.delete(t)})),e.forEach((t=>{this.hasEdge(t)?this.allEdgesMap.set(t,this.graph.getEdge(t)):this.allEdgesMap.delete(t)}))};startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}handleGraphChanged=t=>{const e=new Set;t.changes.forEach((r=>{switch(r.type){case"NodeAdded":case"NodeRemoved":e.add(r.value.id);break;case"NodeDataUpdated":e.add(r.id);break;case"EdgeAdded":case"EdgeRemoved":e.add(r.value.source),e.add(r.value.target);break;case"EdgeUpdated":"source"!==r.propertyName&&"target"!==r.propertyName||(e.add(r.oldValue),e.add(r.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(r.id)){const n=t.graph.getEdge(r.id);e.add(n.source),e.add(n.target)}}})),this.updateCache(e)};checkNodeExistence(t){this.getNode(t)}hasNode(t){if(!this.graph.hasNode(t))return!1;const e=this.graph.getNode(t);return this.nodeFilter(e)}areNeighbors(t,e){return this.checkNodeExistence(t),this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.graph.getNode(t);if(!this.nodeFilter(e))throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){return this.checkNodeExistence(t),this.cacheEnabled?"in"===e?this.inEdgesMap.get(t):"out"===e?this.outEdgesMap.get(t):this.bothEdgesMap.get(t):this.graph.getRelatedEdges(t,e).filter(this.edgeFilter)}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}hasEdge(t){if(!this.graph.hasEdge(t))return!1;const e=this.graph.getEdge(t);return this.edgeFilter(e)}getEdge(t){const e=this.graph.getEdge(t);if(!this.edgeFilter(e))throw new Error("Edge not found for id: "+t);return e}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}hasTreeStructure(t){return this.graph.hasTreeStructure(t)}getRoots(t){return this.graph.getRoots(t).filter(this.nodeFilter)}getChildren(t,e){return this.checkNodeExistence(t),this.graph.getChildren(t,e).filter(this.nodeFilter)}getParent(t,e){this.checkNodeExistence(t);const r=this.graph.getParent(t,e);return r&&this.nodeFilter(r)?r:null}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];u([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];h(this.getNode(t),new Set,e,n)}}class l extends o{nodeMap=new Map;edgeMap=new Map;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;treeIndices=new Map;changes=[];batchCount=0;onChanged=()=>{};constructor(t){super(),t&&(t.nodes&&this.addNodes(t.nodes),t.edges&&this.addEdges(t.edges),t.tree&&this.addTree(t.tree),t.onChanged&&(this.onChanged=t.onChanged))}batch=t=>{this.batchCount+=1,t(),this.batchCount-=1,this.batchCount||this.commit()};commit(){const t=this.changes;this.changes=[];const e={graph:this,changes:t};this.emit("changed",e),this.onChanged(e)}reduceChanges(t){let e=[];return t.forEach((t=>{switch(t.type){case"NodeRemoved":{let r=!1;e=e.filter((e=>{if("NodeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"NodeDataUpdated"===e.type?e.id!==t.value.id:"TreeStructureChanged"!==e.type||e.nodeId!==t.value.id})),r||e.push(t);break}case"EdgeRemoved":{let r=!1;e=e.filter((e=>{if("EdgeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"EdgeDataUpdated"!==e.type&&"EdgeUpdated"!==e.type||e.id!==t.value.id})),r||e.push(t);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const r=e.findIndex((e=>e.type===t.type&&e.id===t.id&&(void 0===t.propertyName||e.propertyName===t.propertyName))),n=e[r];n?void 0!==t.propertyName?n.newValue=t.newValue:(e.splice(r,1),e.push(t)):e.push(t);break}case"TreeStructureDetached":e=e.filter((e=>"TreeStructureAttached"===e.type?e.treeKey!==t.treeKey:"TreeStructureChanged"!==e.type||e.treeKey!==t.treeKey)),e.push(t);break;case"TreeStructureChanged":{const r=e.find((e=>"TreeStructureChanged"===e.type&&e.treeKey===t.treeKey&&e.nodeId===t.nodeId));r?r.newParentId=t.newParentId:e.push(t);break}default:e.push(t)}})),e}checkNodeExistence(t){this.getNode(t)}hasNode(t){return this.nodeMap.has(t)}areNeighbors(t,e){return this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.nodeMap.get(t);if(!e)throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),"in"===e){const e=this.inEdgesMap.get(t);return Array.from(e)}if("out"===e){const e=this.outEdgesMap.get(t);return Array.from(e)}{const e=this.bothEdgesMap.get(t);return Array.from(e)}}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}doAddNode(t){if(this.hasNode(t.id))throw new Error("Node already exists: "+t.id);this.nodeMap.set(t.id,t),this.inEdgesMap.set(t.id,new Set),this.outEdgesMap.set(t.id,new Set),this.bothEdgesMap.set(t.id,new Set),this.treeIndices.forEach((e=>{e.childrenMap.set(t.id,new Set)})),this.changes.push({type:"NodeAdded",value:t})}addNodes(t){this.batch((()=>{for(const e of t)this.doAddNode(e)}))}addNode(t){this.addNodes([t])}doRemoveNode(t){const e=this.getNode(t),r=this.bothEdgesMap.get(t);r?.forEach((t=>this.doRemoveEdge(t.id))),this.nodeMap.delete(t),this.treeIndices.forEach((e=>{e.childrenMap.get(t)?.forEach((t=>{e.parentMap.delete(t.id)})),e.parentMap.delete(t),e.childrenMap.delete(t)})),this.changes.push({type:"NodeRemoved",value:e})}removeNodes(t){this.batch((()=>{t.forEach((t=>this.doRemoveNode(t)))}))}removeNode(t){this.removeNodes([t])}updateNodeDataProperty(t,e,r){const n=this.getNode(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"NodeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}mergeNodeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateNodeDataProperty(t,e,r)}))}))}updateNodeData(...t){const e=t[0],r=this.getNode(e);if("string"==typeof t[1])return void this.updateNodeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"NodeDataUpdated",id:e,oldValue:t,newValue:o})}))}checkEdgeExistence(t){if(!this.hasEdge(t))throw new Error("Edge not found for id: "+t)}hasEdge(t){return this.edgeMap.has(t)}getEdge(t){return this.checkEdgeExistence(t),this.edgeMap.get(t)}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}doAddEdge(t){if(this.hasEdge(t.id))throw new Error("Edge already exists: "+t.id);this.checkNodeExistence(t.source),this.checkNodeExistence(t.target),this.edgeMap.set(t.id,t);const e=this.inEdgesMap.get(t.target),r=this.outEdgesMap.get(t.source),n=this.bothEdgesMap.get(t.source),o=this.bothEdgesMap.get(t.target);e.add(t),r.add(t),n.add(t),o.add(t),this.changes.push({type:"EdgeAdded",value:t})}addEdges(t){this.batch((()=>{for(const e of t)this.doAddEdge(e)}))}addEdge(t){this.addEdges([t])}doRemoveEdge(t){const e=this.getEdge(t),r=this.outEdgesMap.get(e.source),n=this.inEdgesMap.get(e.target),o=this.bothEdgesMap.get(e.source),i=this.bothEdgesMap.get(e.target);r.delete(e),n.delete(e),o.delete(e),i.delete(e),this.edgeMap.delete(t),this.changes.push({type:"EdgeRemoved",value:e})}removeEdges(t){this.batch((()=>{t.forEach((t=>this.doRemoveEdge(t)))}))}removeEdge(t){this.removeEdges([t])}updateEdgeSource(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.source,o=e;this.outEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.outEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.source=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"source",oldValue:n,newValue:o})}))}updateEdgeTarget(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.target,o=e;this.inEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.inEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.target=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"target",oldValue:n,newValue:o})}))}updateEdgeDataProperty(t,e,r){const n=this.getEdge(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"EdgeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}updateEdgeData(...t){const e=t[0],r=this.getEdge(e);if("string"==typeof t[1])return void this.updateEdgeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"EdgeDataUpdated",id:e,oldValue:t,newValue:o})}))}mergeEdgeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateEdgeDataProperty(t,e,r)}))}))}checkTreeExistence(t){if(!this.hasTreeStructure(t))throw new Error("Tree structure not found for treeKey: "+t)}hasTreeStructure(t){return this.treeIndices.has(t)}attachTreeStructure(t){this.treeIndices.has(t)||(this.treeIndices.set(t,{parentMap:new Map,childrenMap:new Map}),this.batch((()=>{this.changes.push({type:"TreeStructureAttached",treeKey:t})})))}detachTreeStructure(t){this.checkTreeExistence(t),this.treeIndices.delete(t),this.batch((()=>{this.changes.push({type:"TreeStructureDetached",treeKey:t})}))}addTree(t,e){this.batch((()=>{this.attachTreeStructure(e);const r=[],n=Array.isArray(t)?t:[t];for(;n.length;){const t=n.shift();r.push(t),t.children&&n.push(...t.children)}this.addNodes(r),r.forEach((t=>{t.children?.forEach((r=>{this.setParent(r.id,t.id,e)}))}))}))}getRoots(t){return this.checkTreeExistence(t),this.getAllNodes().filter((e=>!this.getParent(e.id,t)))}getChildren(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);const r=this.treeIndices.get(e).childrenMap.get(t);return Array.from(r||[])}getParent(t,e){return this.checkNodeExistence(t),this.checkTreeExistence(e),this.treeIndices.get(e).parentMap.get(t)||null}getAncestors(t,e){const r=[];let n,o=this.getNode(t);for(;n=this.getParent(o.id,e);)r.push(n),o=n;return r}setParent(t,e,r){this.checkTreeExistence(r);const n=this.treeIndices.get(r),o=this.getNode(t),i=n.parentMap.get(t);if(i?.id===e)return;if(void 0===e)return i&&n.childrenMap.get(i.id)?.delete(o),void n.parentMap.delete(t);const s=this.getNode(e);n.parentMap.set(t,s),i&&n.childrenMap.get(i.id)?.delete(o);let a=n.childrenMap.get(s.id);a||(a=new Set,n.childrenMap.set(s.id,a)),a.add(o),this.batch((()=>{this.changes.push({type:"TreeStructureChanged",treeKey:r,nodeId:t,oldParentId:i?.id,newParentId:s.id})}))}dfsTree(t,e,r){return h(this.getNode(t),new Set,e,(t=>this.getChildren(t,r)))}bfsTree(t,e,r){return u([this.getNode(t)],new Set,e,(t=>this.getChildren(t,r)))}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return u([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return h(this.getNode(t),new Set,e,n)}clone(){const t=this.getAllNodes().map((t=>({...t,data:{...t.data}}))),e=this.getAllEdges().map((t=>({...t,data:{...t.data}}))),r=new l({nodes:t,edges:e});return this.treeIndices.forEach((({parentMap:t,childrenMap:e},n)=>{const o=new Map;t.forEach(((t,e)=>{o.set(e,r.getNode(t.id))}));const i=new Map;e.forEach(((t,e)=>{i.set(e,new Set(Array.from(t).map((t=>r.getNode(t.id)))))})),r.treeIndices.set(n,{parentMap:o,childrenMap:i})})),r}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(t){return new c({graph:this,...t})}}var f={}.toString;const g=function(t,e){return f.call(t)==="[object "+e+"]"},p=function(t){return g(t,"Number")},v=(t,e)=>{if("next"!==t&&"prev"!==t)return e},m=t=>{t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev};class y{constructor(){const t={};t.prev=t,t.next=t.prev,this.shortcut=t}dequeue(){const t=this.shortcut,e=t.prev;if(e&&e!==t)return m(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&m(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e}toString(){const t=[],e=this.shortcut;let r=e.prev;for(;r!==e;)t.push(JSON.stringify(r,v)),r=null==r?void 0:r.prev;return`[${t.join(", ")}]`}}class w extends y{}const x=()=>1,b=(t,e,r,n,o)=>{var i,s;const a=[];return t.hasNode(n.v)&&(null===(i=t.getRelatedEdges(n.v,"in"))||void 0===i||i.forEach((n=>{const i=n.data.weight,s=t.getNode(n.source);o&&a.push({v:n.source,w:n.target,in:0,out:0}),void 0===s.data.out&&(s.data.out=0),s.data.out-=i,E(e,r,Object.assign({v:s.id},s.data))})),null===(s=t.getRelatedEdges(n.v,"out"))||void 0===s||s.forEach((n=>{const o=n.data.weight,i=n.target,s=t.getNode(i);void 0===s.data.in&&(s.data.in=0),s.data.in-=o,E(e,r,Object.assign({v:s.id},s.data))})),t.removeNode(n.v)),o?a:void 0},E=(t,e,r)=>{r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)},N=(t,e)=>{const r="greedy"===e?((t,e)=>{var r;if(t.getAllNodes().length<=1)return[];const n=((t,e)=>{const r=new l;let n=0,o=0;t.getAllNodes().forEach((t=>{r.addNode({id:t.id,data:{v:t.id,in:0,out:0}})})),t.getAllEdges().forEach((t=>{const i=r.getRelatedEdges(t.source,"out").find((e=>e.target===t.target)),s=(null==e?void 0:e(t))||1;i?r.updateEdgeData(null==i?void 0:i.id,Object.assign(Object.assign({},i.data),{weight:i.data.weight+s})):r.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:s}}),o=Math.max(o,r.getNode(t.source).data.out+=s),n=Math.max(n,r.getNode(t.target).data.in+=s)}));const i=[],s=o+n+3;for(let t=0;t<s;t++)i.push(new w);const a=n+1;return r.getAllNodes().forEach((t=>{E(i,a,Object.assign({v:t.id},r.getNode(t.id).data))})),{buckets:i,zeroIdx:a,graph:r}})(t,(t=>t.data.weight||1)||x);return null===(r=((t,e,r)=>{let n=[];const o=e[e.length-1],i=e[0];let s;for(;t.getAllNodes().length;){for(;s=i.dequeue();)b(t,e,r,s);for(;s=o.dequeue();)b(t,e,r,s);if(t.getAllNodes().length)for(let o=e.length-2;o>0;--o)if(s=e[o].dequeue(),s){n=n.concat(b(t,e,r,s,!0));break}}return n})(n.graph,n.buckets,n.zeroIdx).map((e=>t.getRelatedEdges(e.v,"out").filter((({target:t})=>t===e.w)))))||void 0===r?void 0:r.flat()})(t):M(t);null==r||r.forEach((e=>{const r=e.data;t.removeEdge(e.id),r.forwardName=e.data.name,r.reversed=!0,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign({},r)})}))},M=t=>{const e=[],r={},n={},o=i=>{n[i]||(n[i]=!0,r[i]=!0,t.getRelatedEdges(i,"out").forEach((t=>{r[t.target]?e.push(t):o(t.target)})),delete r[i])};return t.getAllNodes().forEach((t=>o(t.id))),e},_=(t,e,r,n)=>{let o;do{o=`${n}${Math.random()}`}while(t.hasNode(o));return r.dummy=e,t.addNode({id:o,data:r}),o},k=t=>{const e=new l;return t.getAllNodes().forEach((r=>{t.getChildren(r.id).length||e.addNode(Object.assign({},r))})),t.getAllEdges().forEach((t=>{e.addEdge(t)})),e},A=(t,e)=>{const r=Number(t.x),n=Number(t.y),o=Number(e.x)-r,i=Number(e.y)-n;let s,a,u=Number(t.width)/2,h=Number(t.height)/2;return o||i?(Math.abs(i)*u>Math.abs(o)*h?(i<0&&(h=-h),s=h*o/i,a=h):(o<0&&(u=-u),s=u,a=u*i/o),{x:r+s,y:n+a}):{x:0,y:0}},j=t=>{const e=[],r=O(t)+1;for(let t=0;t<r;t++)e.push([]);t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&e[r]&&e[r].push(t.id)}));for(let n=0;n<r;n++)e[n]=e[n].sort(((e,r)=>{return n=t.getNode(e).data.order,o=t.getNode(r).data.order,Number(n)-Number(o);var n,o}));return e},S=(t,e,r,n)=>{const o={width:0,height:0};return p(r)&&p(n)&&(o.rank=r,o.order=n),_(t,"border",o,e)},O=t=>{let e;return t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&(void 0===e||r>e)&&(e=r)})),e||(e=0),e},z=(t,e)=>t.reduce(((t,r)=>e(t)>e(r)?r:t)),R=(t,e,r,n,o,i)=>{n.includes(e.id)||(n.push(e.id),r||i.push(e.id),o(e.id).forEach((e=>R(t,e,r,n,o,i))),r&&i.push(e.id))},I=(t,e,r,n)=>{const o=Array.isArray(e)?e:[e],i=e=>n?t.getSuccessors(e):t.getNeighbors(e),s=[],a=[];return o.forEach((e=>{if(!t.hasNode(e.id))throw new Error(`Graph does not have node: ${e}`);R(t,e,"post"===r,a,i,s)})),s},C=(t,e,r,n,o,i)=>{const s={rank:i,borderType:e,width:0,height:0},a=o.data[e][i-1],u=_(t,"border",s,r);o.data[e][i]=u,t.setParent(u,n),a&&t.addEdge({id:`e${Math.random()}`,source:a,target:u,data:{weight:1}})},D=t=>{t.getAllNodes().forEach((t=>{P(t)})),t.getAllEdges().forEach((t=>{P(t)}))},P=t=>{const e=t.data.width;t.data.width=t.data.height,t.data.height=e},T=t=>{(null==t?void 0:t.y)&&(t.y=-t.y)},L=t=>{const e=t.x;t.x=t.y,t.y=e},F=(t,e,r,n,o,i,s)=>{const a=t.getChildren(s);if(!(null==a?void 0:a.length))return void(s!==e&&t.addEdge({id:`e${Math.random()}`,source:e,target:s,data:{weight:0,minlen:r}}));const u=S(t,"_bt"),h=S(t,"_bb"),d=t.getNode(s);t.setParent(u,s),d.data.borderTop=u,t.setParent(h,s),d.data.borderBottom=h,null==a||a.forEach((a=>{F(t,e,r,n,o,i,a.id);const d=a.data.borderTop?a.data.borderTop:a.id,c=a.data.borderBottom?a.data.borderBottom:a.id,l=a.data.borderTop?n:2*n,f=d!==c?1:o-i[s]+1;t.addEdge({id:`e${Math.random()}`,source:u,target:d,data:{minlen:f,weight:l,nestingEdge:!0}}),t.addEdge({id:`e${Math.random()}`,source:c,target:h,data:{minlen:f,weight:l,nestingEdge:!0}})})),t.getParent(s)||t.addEdge({id:`e${Math.random()}`,source:e,target:u,data:{weight:0,minlen:o+i[s]}})},q="edge-label",V=function(t){return Array.isArray?Array.isArray(t):g(t,"Array")};var U=function(t){if("object"!=typeof t||null===t)return t;var e;if(V(t)){e=[];for(var r=0,n=t.length;r<n;r++)"object"==typeof t[r]&&null!=t[r]?e[r]=U(t[r]):e[r]=t[r]}else for(var o in e={},t)"object"==typeof t[o]&&null!=t[o]?e[o]=U(t[o]):e[o]=t[o];return e};const B=U,$=(t,e,r)=>{const n=(s=r,a=r.map(((t,e)=>e)),null==s?void 0:s.reduce(((t,e,r)=>(t[e]=a[r],t)),{})),o=e.map((e=>{const r=t.getRelatedEdges(e,"out").map((t=>({pos:n[t.target]||0,weight:t.data.weight})));return null==r?void 0:r.sort(((t,e)=>t.pos-e.pos))})),i=o.flat().filter((t=>void 0!==t));var s,a;let u=1;for(;u<r.length;)u<<=1;const h=2*u-1;u-=1;const d=Array(h).fill(0,0,h);let c=0;return null==i||i.forEach((t=>{if(t){let e=t.pos+u;d[e]+=t.weight;let r=0;for(;e>0;)e%2&&(r+=d[e+1]),e=e-1>>1,d[e]+=t.weight;c+=t.weight*r}})),c},G=(t,e)=>{let r=0;for(let n=1;n<(null==e?void 0:e.length);n+=1)r+=$(t,e[n-1],e[n]);return r},W=t=>{const e={},r=t.getAllNodes(),n=r.map((t=>{var e;return null!==(e=t.data.rank)&&void 0!==e?e:-1/0})),o=Math.max(...n),i=[];for(let t=0;t<o+1;t++)i.push([]);const s=r.sort(((e,r)=>t.getNode(e.id).data.rank-t.getNode(r.id).data.rank)),a=s.filter((e=>void 0!==t.getNode(e.id).data.fixorder)).sort(((e,r)=>t.getNode(e.id).data.fixorder-t.getNode(r.id).data.fixorder));return null==a||a.forEach((r=>{isNaN(t.getNode(r.id).data.rank)||i[t.getNode(r.id).data.rank].push(r.id),e[r.id]=!0})),null==s||s.forEach((r=>t.dfsTree(r.id,(t=>{if(e.hasOwnProperty(t.id))return!0;e[t.id]=!0,isNaN(t.data.rank)||i[t.data.rank].push(t.id)})))),i},K=(t,e)=>{var r;let n=0,o=0;t.weight&&(n+=t.barycenter*t.weight,o+=t.weight),e.weight&&(n+=e.barycenter*e.weight,o+=e.weight),t.vs=null===(r=e.vs)||void 0===r?void 0:r.concat(t.vs),t.barycenter=n/o,t.weight=o,t.i=Math.min(e.i,t.i),e.merged=!0},Y=(t,e)=>{var r,n,o;const i={};null==t||t.forEach(((t,e)=>{i[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};const r=i[t.v];void 0!==t.barycenter&&(r.barycenter=t.barycenter,r.weight=t.weight)})),null===(r=e.getAllEdges())||void 0===r||r.forEach((t=>{const e=i[t.source],r=i[t.target];void 0!==e&&void 0!==r&&(r.indegree++,e.out.push(i[t.target]))}));return(t=>{var e,r;const n=[];for(;null==t?void 0:t.length;){const o=t.pop();n.push(o),null===(e=o.in.reverse())||void 0===e||e.forEach((t=>{return(e=o,t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&K(e,t)})(t);var e})),null===(r=o.out)||void 0===r||r.forEach((e=>{return(r=o,e=>{e.in.push(r),0==--e.indegree&&t.push(e)})(e);var r}))}const o=n.filter((t=>!t.merged)),i=["vs","i","barycenter","weight"];return o.map((t=>{const e={};return null==i||i.forEach((r=>{void 0!==t[r]&&(e[r]=t[r])})),e}))})(null===(o=(n=Object.values(i)).filter)||void 0===o?void 0:o.call(n,(t=>!t.indegree)))},J=(t,e,r)=>{let n,o=r;for(;e.length&&(n=e[e.length-1]).i<=o;)e.pop(),null==t||t.push(n.vs),o++;return o},H=(t,e,r,n,o,i)=>{var s,a,u,h;let d=t.getChildren(e).map((t=>t.id));const c=t.getNode(e),l=c?c.data.borderLeft:void 0,f=c?c.data.borderRight:void 0,g={};l&&(d=null==d?void 0:d.filter((t=>t!==l&&t!==f)));const p=((t,e)=>e.map((e=>{const r=t.getRelatedEdges(e,"in");if(!(null==r?void 0:r.length))return{v:e};const n={sum:0,weight:0};return null==r||r.forEach((e=>{const r=t.getNode(e.source);n.sum+=e.data.weight*r.data.order,n.weight+=e.data.weight})),{v:e,barycenter:n.sum/n.weight,weight:n.weight}})))(t,d||[]);null==p||p.forEach((e=>{var o;if(null===(o=t.getChildren(e.v))||void 0===o?void 0:o.length){const o=H(t,e.v,r,n,i);g[e.v]=o,o.hasOwnProperty("barycenter")&&Q(e,o)}}));const v=Y(p,r);X(v,g),null===(s=v.filter((t=>t.vs.length>0)))||void 0===s||s.forEach((e=>{const r=t.getNode(e.vs[0]);r&&(e.fixorder=r.data.fixorder,e.order=r.data.order)}));const m=((t,e,r,n)=>{const o=((t,e)=>{const r={lhs:[],rhs:[]};return null==t||t.forEach((t=>{(t=>{const e=t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder);return n?!e&&t.hasOwnProperty("barycenter"):e||t.hasOwnProperty("barycenter")})(t)?r.lhs.push(t):r.rhs.push(t)})),r})(t),i=o.lhs,s=o.rhs.sort(((t,e)=>-t.i- -e.i)),a=[];let u=0,h=0,d=0;null==i||i.sort(((t,e)=>(r,n)=>{if(void 0!==r.fixorder&&void 0!==n.fixorder)return r.fixorder-n.fixorder;if(r.barycenter<n.barycenter)return-1;if(r.barycenter>n.barycenter)return 1;if(e&&void 0!==r.order&&void 0!==n.order){if(r.order<n.order)return-1;if(r.order>n.order)return 1}return t?n.i-r.i:r.i-n.i})(!!e,!!r)),d=J(a,s,d),null==i||i.forEach((t=>{var e;d+=null===(e=t.vs)||void 0===e?void 0:e.length,a.push(t.vs),u+=t.barycenter*t.weight,h+=t.weight,d=J(a,s,d)}));const c={vs:a.flat()};return h&&(c.barycenter=u/h,c.weight=h),c})(v,n,o,i);if(l&&(m.vs=[l,m.vs,f].flat(),null===(a=t.getPredecessors(l))||void 0===a?void 0:a.length)){const e=t.getNode((null===(u=t.getPredecessors(l))||void 0===u?void 0:u[0].id)||""),r=t.getNode((null===(h=t.getPredecessors(f))||void 0===h?void 0:h[0].id)||"");m.hasOwnProperty("barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+e.data.order+r.data.order)/(m.weight+2),m.weight+=2}return m},X=(t,e)=>{null==t||t.forEach((t=>{var r;const n=null===(r=t.vs)||void 0===r?void 0:r.map((t=>e[t]?e[t].vs:t));t.vs=n.flat()}))},Q=(t,e)=>{void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)},Z=(t,e,r)=>e.map((e=>((t,e,r)=>{const n=(t=>{let e;for(;t.hasNode(e=`_root${Math.random()}`););return e})(t),o=new l({tree:[{id:n,children:[],data:{}}]});return t.getAllNodes().forEach((i=>{const s=t.getParent(i.id);(i.data.rank===e||i.data.minRank<=e&&e<=i.data.maxRank)&&(o.hasNode(i.id)||o.addNode(Object.assign({},i)),(null==s?void 0:s.id)&&!o.hasNode(null==s?void 0:s.id)&&o.addNode(Object.assign({},s)),o.setParent(i.id,(null==s?void 0:s.id)||n),t.getRelatedEdges(i.id,r).forEach((e=>{const r=e.source===i.id?e.target:e.source;o.hasNode(r)||o.addNode(Object.assign({},t.getNode(r)));const n=o.getRelatedEdges(r,"out").find((({target:t})=>t===i.id)),s=void 0!==n?n.data.weight:0;n?o.updateEdgeData(n.id,Object.assign(Object.assign({},n.data),{weight:e.data.weight+s})):o.addEdge({id:e.id,source:r,target:i.id,data:{weight:e.data.weight+s}})})),i.data.hasOwnProperty("minRank")&&o.updateNodeData(i.id,Object.assign(Object.assign({},i.data),{borderLeft:i.data.borderLeft[e],borderRight:i.data.borderRight[e]})))})),o})(t,e,r))),tt=(t,e,r,n)=>{const o=new l;null==t||t.forEach((t=>{var i;const s=t.getRoots()[0].id,a=H(t,s,o,e,r,n);for(let e=0;e<(null===(i=a.vs)||void 0===i?void 0:i.length);e++){const r=t.getNode(a.vs[e]);r&&(r.data.order=e)}((t,e,r)=>{const n={};let o;null==r||r.forEach((r=>{let i,s,a=t.getParent(r);for(;a;){if(i=t.getParent(a.id),i?(s=n[i.id],n[i.id]=a.id):(s=o,o=a.id),s&&s!==a.id)return e.hasNode(s)||e.addNode({id:s,data:{}}),e.hasNode(a.id)||e.addNode({id:a.id,data:{}}),void(e.hasEdge(`e${s}-${a.id}`)||e.addEdge({id:`e${s}-${a.id}`,source:s,target:a.id,data:{}}));a=i}}))})(t,o,a.vs)}))},et=(t,e)=>{null==e||e.forEach((e=>{null==e||e.forEach(((e,r)=>{t.getNode(e).data.order=r}))}))},rt=(t,e)=>{var r,n;if(null===(r=t.getNode(e))||void 0===r?void 0:r.data.dummy)return null===(n=t.getPredecessors(e))||void 0===n?void 0:n.find((e=>t.getNode(e.id).data.dummy))},nt=(t,e,r)=>{let n=e,o=r;if(n>o){const t=n;n=o,o=t}let i=t[n];i||(t[n]=i={}),i[o]=!0},ot=(t,e,r)=>{let n=e,o=r;return n>r&&(n=r,o=e),!!t[n]},it=(t,e,r,n,o,i)=>{const s=new l,a=st(n,o,i);return null==e||e.forEach((e=>{let n;null==e||e.forEach((e=>{const o=r[e];if(s.hasNode(o)||s.addNode({id:o,data:{}}),n){const i=r[n],u=s.getRelatedEdges(i,"out").find((t=>t.target===o));u?s.updateEdgeData(u.id,Object.assign(Object.assign({},u.data),{weight:Math.max(a(t,e,n),u.data.weight||0)})):s.addEdge({id:`e${Math.random()}`,source:i,target:o,data:{weight:Math.max(a(t,e,n),0)}})}n=e}))})),s};const st=(t,e,r)=>(n,o,i)=>{const s=n.getNode(o),a=n.getNode(i);let u=0,h=0;if(u+=s.data.width/2,s.data.hasOwnProperty("labelpos"))switch((s.data.labelpos||"").toLowerCase()){case"l":h=-s.data.width/2;break;case"r":h=s.data.width/2}if(h&&(u+=r?h:-h),h=0,u+=(s.data.dummy?e:t)/2,u+=(a.data.dummy?e:t)/2,u+=a.data.width/2,a.data.labelpos)switch((a.data.labelpos||"").toLowerCase()){case"l":h=a.data.width/2;break;case"r":h=-a.data.width/2}return h&&(u+=r?h:-h),h=0,u},at=(t,e)=>t.getNode(e).data.width||0,ut=(t,e)=>{var r;const n=k(t);((t,e)=>{const{ranksep:r=0}=e||{},n=j(t);let o=0;null==n||n.forEach((e=>{const n=e.map((e=>t.getNode(e).data.height)),i=Math.max(...n,0);null==e||e.forEach((e=>{t.getNode(e).data.y=o+i/2})),o+=i+r}))})(n,e);const o=((t,e)=>{const{align:r,nodesep:n=0,edgesep:o=0}=e||{},i=j(t),s=Object.assign(((t,e)=>{const r={};return(null==e?void 0:e.length)&&e.reduce(((e,n)=>{let o=0,i=0;const s=e.length,a=null==n?void 0:n[(null==n?void 0:n.length)-1];return null==n||n.forEach(((e,u)=>{var h;const d=rt(t,e),c=d?t.getNode(d.id).data.order:s;(d||e===a)&&(null===(h=n.slice(i,u+1))||void 0===h||h.forEach((e=>{var n;null===(n=t.getPredecessors(e))||void 0===n||n.forEach((n=>{var i;const s=t.getNode(n.id),a=s.data.order;!(a<o||c<a)||s.data.dummy&&(null===(i=t.getNode(e))||void 0===i?void 0:i.data.dummy)||nt(r,n.id,e)}))})),i=u+1,o=c)})),n})),r})(t,i),((t,e)=>{const r={};function n(e,n){const o=function(t){return JSON.stringify(t.slice(1))}(e);n.get(o)||(function(e,n,o,i,s){var a,u;let h;for(let d=n;d<o;d++)h=e[d],(null===(a=t.getNode(h))||void 0===a?void 0:a.data.dummy)&&(null===(u=t.getPredecessors(h))||void 0===u||u.forEach((e=>{const n=t.getNode(e.id);n.data.dummy&&(n.data.order<i||n.data.order>s)&&nt(r,e.id,h)})))}(...e),n.set(o,!0))}return(null==e?void 0:e.length)&&e.reduce(((e,r)=>{let o,i=-1,s=0;const a=new Map;return null==r||r.forEach(((u,h)=>{var d;if("border"===(null===(d=t.getNode(u))||void 0===d?void 0:d.data.dummy)){const e=t.getPredecessors(u)||[];e.length&&(o=t.getNode(e[0].id).data.order,n([r,s,h,i,o],a),s=h,i=o)}n([r,s,r.length,o,e.length],a)})),r})),r})(t,i)),a={};let u=[];["u","d"].forEach((e=>{u="u"===e?i:Object.values(i).reverse(),["l","r"].forEach((r=>{"r"===r&&(u=u.map((t=>Object.values(t).reverse())));const i=("u"===e?t.getPredecessors:t.getSuccessors).bind(t),h=((t,e,r,n)=>{const o={},i={},s={};return null==e||e.forEach((t=>{null==t||t.forEach(((t,e)=>{o[t]=t,i[t]=t,s[t]=e}))})),null==e||e.forEach((t=>{let e=-1;null==t||t.forEach((t=>{let a=n(t).map((t=>t.id));if(a.length){a=a.sort(((t,e)=>s[t]-s[e]));const n=(a.length-1)/2;for(let u=Math.floor(n),h=Math.ceil(n);u<=h;++u){const n=a[u];i[t]===t&&e<s[n]&&!ot(r,t,n)&&(i[n]=t,i[t]=o[t]=o[n],e=s[n])}}}))})),{root:o,align:i}})(0,u,s,i),d=((t,e,r,n,o,i,s)=>{var a;const u={},h=it(t,e,r,o,i,s),d=s?"borderLeft":"borderRight",c=(t,e)=>{let r=h.getAllNodes(),n=r.pop();const o={};for(;n;)o[n.id]?t(n.id):(o[n.id]=!0,r.push(n),r=r.concat(e(n.id))),n=r.pop()};return c((t=>{u[t]=(h.getRelatedEdges(t,"in")||[]).reduce(((t,e)=>Math.max(t,(u[e.source]||0)+e.data.weight)),0)}),h.getPredecessors.bind(h)),c((e=>{const r=(h.getRelatedEdges(e,"out")||[]).reduce(((t,e)=>Math.min(t,(u[e.target]||0)-e.data.weight)),Number.POSITIVE_INFINITY),n=t.getNode(e);r!==Number.POSITIVE_INFINITY&&n.data.borderType!==d&&(u[e]=Math.max(u[e],r))}),h.getSuccessors.bind(h)),null===(a=Object.values(n))||void 0===a||a.forEach((t=>{u[t]=u[r[t]]})),u})(t,u,h.root,h.align,n,o,"r"===r);"r"===r&&Object.keys(d).forEach((t=>d[t]=-d[t])),a[e+r]=d}))}));const h=((t,e)=>z(Object.values(e),(e=>{var r;let n=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return null===(r=Object.keys(e))||void 0===r||r.forEach((r=>{const i=e[r],s=at(t,r)/2;n=Math.max(i+s,n),o=Math.min(i-s,o)})),n-o})))(t,a);return h&&function(t,e){const r=Object.values(e),n=Math.min(...r),o=Math.max(...r);["u","d"].forEach((r=>{["l","r"].forEach((i=>{const s=r+i,a=t[s];let u;if(a===e)return;const h=Object.values(a);u="l"===i?n-Math.min(...h):o-Math.max(...h),u&&(t[s]={},Object.keys(a).forEach((e=>{t[s][e]=a[e]+u})))}))}))}(a,h),((t,e)=>{const r={};return Object.keys(t.ul).forEach((n=>{if(e)r[n]=t[e.toLowerCase()][n];else{const e=Object.values(t).map((t=>t[n]));r[n]=(e[0]+e[1])/2}})),r})(a,r)})(n,e);null===(r=Object.keys(o))||void 0===r||r.forEach((t=>{n.getNode(t).data.x=o[t]}))},ht=t=>{const e={},r=n=>{var o;const i=t.getNode(n);if(!i)return 0;if(e[n])return i.data.rank;let s;return e[n]=!0,null===(o=t.getRelatedEdges(n,"out"))||void 0===o||o.forEach((t=>{const e=r(t.target)-t.data.minlen;e&&(void 0===s||e<s)&&(s=e)})),s||(s=0),i.data.rank=s,s};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>r(t.id)))},dt=(t,e)=>t.getNode(e.target).data.rank-t.getNode(e.source).data.rank-e.data.minlen,ct=(t,e)=>{const r=n=>{e.getRelatedEdges(n,"both").forEach((o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||dt(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},lt=(t,e)=>{const r=n=>{var o;null===(o=e.getRelatedEdges(n,"both"))||void 0===o||o.forEach((o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||void 0===e.getNode(s).data.layer&&dt(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},ft=(t,e)=>z(e.getAllEdges(),(r=>t.hasNode(r.source)!==t.hasNode(r.target)?dt(e,r):1/0)),gt=(t,e,r)=>{t.getAllNodes().forEach((t=>{const n=e.getNode(t.id);n.data.rank||(n.data.rank=0),n.data.rank+=r}))},pt=(t,e)=>{let r=I(t,t.getAllNodes(),"post",!1);r=r.slice(0,(null==r?void 0:r.length)-1),r.forEach((r=>{vt(t,e,r)}))},vt=(t,e,r)=>{const n=t.getNode(r).data.parent;t.getRelatedEdges(r,"both").find((t=>t.target===n||t.source===n)).data.cutvalue=mt(t,e,r)},mt=(t,e,r)=>{const n=t.getNode(r).data.parent;let o=!0,i=e.getRelatedEdges(r,"out").find((t=>t.target===n)),s=0;return i||(o=!1,i=e.getRelatedEdges(n,"out").find((t=>t.target===r))),s=i.data.weight,e.getRelatedEdges(r,"both").forEach((e=>{const i=e.source===r,a=i?e.target:e.source;if(a!==n){const n=i===o,u=e.data.weight;if(s+=n?u:-u,Mt(t,r,a)){const e=t.getRelatedEdges(r,"both").find((t=>t.source===a||t.target===a)).data.cutvalue;s+=n?-e:e}}})),s},yt=(t,e=t.getAllNodes()[0].id)=>{wt(t,{},1,e)},wt=(t,e,r,n,o)=>{var i;const s=r;let a=r;const u=t.getNode(n);return e[n]=!0,null===(i=t.getNeighbors(n))||void 0===i||i.forEach((r=>{e[r.id]||(a=wt(t,e,a,r.id,n))})),u.data.low=s,u.data.lim=a++,o?u.data.parent=o:delete u.data.parent,a},xt=t=>t.getAllEdges().find((t=>t.data.cutvalue<0)),bt=(t,e,r)=>{let n=r.source,o=r.target;e.getRelatedEdges(n,"out").find((t=>t.target===o))||(n=r.target,o=r.source);const i=t.getNode(n),s=t.getNode(o);let a=i,u=!1;i.data.lim>s.data.lim&&(a=s,u=!0);const h=e.getAllEdges().filter((e=>u===_t(t.getNode(e.source),a)&&u!==_t(t.getNode(e.target),a)));return z(h,(t=>dt(e,t)))},Et=(t,e,r,n)=>{const o=t.getRelatedEdges(r.source,"both").find((t=>t.source===r.target||t.target===r.target));o&&t.removeEdge(o.id),t.addEdge({id:`e${Math.random()}`,source:n.source,target:n.target,data:{}}),yt(t),pt(t,e),Nt(t,e)},Nt=(t,e)=>{const r=t.getAllNodes().find((t=>!t.data.parent));let n=I(t,r,"pre",!1);n=n.slice(1),n.forEach((r=>{const n=t.getNode(r).data.parent;let o=e.getRelatedEdges(r,"out").find((t=>t.target===n)),i=!1;!o&&e.hasNode(n)&&(o=e.getRelatedEdges(n,"out").find((t=>t.target===r)),i=!0),e.getNode(r).data.rank=(e.hasNode(n)&&e.getNode(n).data.rank||0)+(i?null==o?void 0:o.data.minlen:-(null==o?void 0:o.data.minlen))}))},Mt=(t,e,r)=>t.getRelatedEdges(e,"both").find((t=>t.source===r||t.target===r)),_t=(t,e)=>e.data.low<=t.data.lim&&t.data.lim<=e.data.lim,kt=ht,At=t=>{(t=>{const e=(t=>{const e=new l;return t.getAllNodes().forEach((t=>{e.addNode(Object.assign({},t))})),t.getAllEdges().forEach((t=>{const r=e.getRelatedEdges(t.source,"out").find((e=>e.target===t.target));r?e.updateEdgeData(null==r?void 0:r.id,Object.assign(Object.assign({},r.data),{weight:r.data.weight+t.data.weight||0,minlen:Math.max(r.data.minlen,t.data.minlen||1)})):e.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||0,minlen:t.data.minlen||1}})})),e})(t);ht(e);const r=(t=>{const e=new l({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);ct(e,t)<n;)o=ft(e,t),i=e.hasNode(o.source)?dt(t,o):-dt(t,o),gt(e,t,i);return e})(e);let n,o;for(yt(r),pt(r,e);n=xt(r);)o=bt(r,e,n),Et(r,e,n,o)})(t)},jt=(t,e)=>{const{acyclicer:r,ranker:n,rankdir:o="tb",nodeOrder:i,keepNodeOrder:s,align:a,nodesep:u=50,edgesep:h=20,ranksep:d=50}=e;Ut(t),N(t,r);const{nestingRoot:c,nodeRankFactor:f}=(t=>{const e=_(t,"root",{},"_root"),r=(t=>{const e={},r=(n,o)=>{const i=t.getChildren(n);null==i||i.forEach((t=>r(t.id,o+1))),e[n]=o};return t.getRoots().forEach((t=>r(t.id,1))),e})(t);let n=Math.max(...Object.values(r));Math.abs(n)===1/0&&(n=1);const o=n-1,i=2*o+1;t.getAllEdges().forEach((t=>{t.data.minlen*=i}));const s=(t=>{let e=0;return t.getAllEdges().forEach((t=>{e+=t.data.weight})),e})(t)+1;return t.getRoots().forEach((n=>{F(t,e,i,s,o,r,n.id)})),{nestingRoot:e,nodeRankFactor:i}})(t);((t,e)=>{switch(e){case"network-simplex":At(t);break;case"tight-tree":default:(t=>{(t=>{const e={};let r;const n=o=>{var i;const s=t.getNode(o);if(!s)return 0;if(e[o])return s.data.rank;let a;return e[o]=!0,null===(i=t.getRelatedEdges(o,"out"))||void 0===i||i.forEach((t=>{const e=n(t.target)-t.data.minlen;e&&(void 0===a||e<a)&&(a=e)})),a||(a=0),(void 0===r||a<r)&&(r=a),s.data.rank=a,a};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>{t&&n(t.id)})),void 0===r&&(r=0);const o={},i=(e,r)=>{var n;const s=t.getNode(e),a=isNaN(s.data.layer)?r:s.data.layer;(void 0===s.data.rank||s.data.rank<a)&&(s.data.rank=a),o[e]||(o[e]=!0,null===(n=t.getRelatedEdges(e,"out"))||void 0===n||n.forEach((t=>{i(t.target,a+t.data.minlen)})))};t.getAllNodes().forEach((t=>{const e=t.data;e&&(isNaN(e.layer)?e.rank-=r:i(t.id,e.layer))}))})(t),(t=>{const e=new l({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);lt(e,t)<n;)o=ft(e,t),i=e.hasNode(o.source)?dt(t,o):-dt(t,o),gt(e,t,i)})(t)})(t);break;case"longest-path":kt(t)}})(k(t),n),Ct(t),((t,e=0)=>{const r=t.getAllNodes(),n=r.filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),o=Math.min(...n),i=[];r.forEach((t=>{const e=(t.data.rank||0)-o;i[e]||(i[e]=[]),i[e].push(t.id)}));let s=0;for(let r=0;r<i.length;r++){const n=i[r];void 0===n?r%e!=0&&(s-=1):s&&(null==n||n.forEach((e=>{const r=t.getNode(e);r&&(r.data.rank=r.data.rank||0,r.data.rank+=s)})))}})(t,f),((t,e)=>{e&&t.removeNode(e),t.getAllEdges().forEach((e=>{e.data.nestingEdge&&t.removeEdge(e.id)}))})(t,c),(t=>{const e=t.getAllNodes().filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),r=Math.min(...e);t.getAllNodes().forEach((t=>{t.data.hasOwnProperty("rank")&&r!==1/0&&(t.data.rank-=r)}))})(t),Dt(t),Pt(t);const g=[];((t,e)=>{t.getAllEdges().forEach((r=>((t,e,r)=>{let n=e.source,o=t.getNode(n).data.rank;const i=e.target,s=t.getNode(i).data.rank,a=e.data.labelRank;if(s===o+1)return;let u,h,d;for(t.removeEdge(e.id),d=0,++o;o<s;++d,++o)e.data.points=[],h={originalEdge:e,width:0,height:0,rank:o},u=_(t,"edge",h,"_d"),o===a&&(h.width=e.data.width,h.height=e.data.height,h.dummy=q,h.labelpos=e.data.labelpos),t.addEdge({id:`e${Math.random()}`,source:n,target:u,data:{weight:e.data.weight}}),0===d&&r.push(u),n=u;t.addEdge({id:`e${Math.random()}`,source:n,target:i,data:{weight:e.data.weight}})})(t,r,e)))})(t,g),((t,e)=>{const r=(t=>{const e={};let r=0;const n=o=>{const i=r;t.getChildren(o).forEach((t=>n(t.id))),e[o]={low:i,lim:r++}};return t.getRoots().forEach((t=>n(t.id))),e})(t);e.forEach((e=>{var n,o;let i=e,s=t.getNode(i);const a=s.data.originalEdge;if(!a)return;const u=((t,e,r,n)=>{var o,i;const s=[],a=[],u=Math.min(e[r].low,e[n].low),h=Math.max(e[r].lim,e[n].lim);let d,c;d=r;do{d=null===(o=t.getParent(d))||void 0===o?void 0:o.id,s.push(d)}while(d&&(e[d].low>u||h>e[d].lim));for(c=d,d=n;d&&d!==c;)a.push(d),d=null===(i=t.getParent(d))||void 0===i?void 0:i.id;return{lca:c,path:s.concat(a.reverse())}})(t,r,a.source,a.target),h=u.path,d=u.lca;let c=0,l=h[c],f=!0;for(;i!==a.target;){if(s=t.getNode(i),f){for(;l!==d&&(null===(n=t.getNode(l))||void 0===n?void 0:n.data.maxRank)<s.data.rank;)c++,l=h[c];l===d&&(f=!1)}if(!f){for(;c<h.length-1&&(null===(o=t.getNode(h[c+1]))||void 0===o?void 0:o.data.minRank)<=s.data.rank;)c++;l=h[c]}t.hasNode(l)&&t.setParent(i,l),i=t.getSuccessors(i)[0].id}}))})(t,g),(t=>{const e=r=>{const n=t.getChildren(r),o=t.getNode(r);if((null==n?void 0:n.length)&&n.forEach((t=>e(t.id))),o.data.hasOwnProperty("minRank")){o.data.borderLeft=[],o.data.borderRight=[];for(let e=o.data.minRank,n=o.data.maxRank+1;e<n;e+=1)C(t,"borderLeft","_bl",r,o,e),C(t,"borderRight","_br",r,o,e)}};t.getRoots().forEach((t=>e(t.id)))})(t),s&&((t,e)=>{const r=t.getAllNodes().filter((e=>{var r;return!(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length)})).map((t=>t.data.rank)),n=Math.max(...r),o=[];for(let t=0;t<n+1;t++)o[t]=[];null==e||e.forEach((e=>{const r=t.getNode(e);r&&!r.data.dummy&&(isNaN(r.data.rank)||(r.data.fixorder=o[r.data.rank].length,o[r.data.rank].push(e)))}))})(t,i),((t,e)=>{const r=O(t),n=[],o=[];for(let t=1;t<r+1;t++)n.push(t);for(let t=r-1;t>-1;t--)o.push(t);const i=Z(t,n,"in"),s=Z(t,o,"out");let a=W(t);et(t,a);let u,h=Number.POSITIVE_INFINITY;for(let r=0,n=0;n<4;++r,++n){tt(r%2?i:s,r%4>=2,!1,e),a=j(t);const o=G(t,a);o<h&&(n=0,u=B(a),h=o)}a=W(t),et(t,a);for(let r=0,n=0;n<4;++r,++n){tt(r%2?i:s,r%4>=2,!0,e),a=j(t);const o=G(t,a);o<h&&(n=0,u=B(a),h=o)}et(t,u)})(t,s),Bt(t),((t,e)=>{const r=e.toLowerCase();"lr"!==r&&"rl"!==r||D(t)})(t,o),ut(t,{align:a,nodesep:u,edgesep:h,ranksep:d}),$t(t),Vt(t),((t,e)=>{e.forEach((e=>{let r=t.getNode(e);const{data:n}=r,o=n.originalEdge;let i;o&&t.addEdge(o);let s=e;for(;r.data.dummy;)i=t.getSuccessors(s)[0],t.removeNode(s),o.data.points.push({x:r.data.x,y:r.data.y}),r.data.dummy===q&&(o.data.x=r.data.x,o.data.y=r.data.y,o.data.width=r.data.width,o.data.height=r.data.height),s=i.id,r=t.getNode(s)}))})(t,g),Ft(t),((t,e)=>{const r=e.toLowerCase();"bt"!==r&&"rl"!==r||(t=>{t.getAllNodes().forEach((t=>{T(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>T(t))),t.data.hasOwnProperty("y")&&T(t.data)}))})(t),"lr"!==r&&"rl"!==r||((t=>{t.getAllNodes().forEach((t=>{L(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>L(t))),t.data.hasOwnProperty("x")&&L(t.data)}))})(t),D(t))})(t,o);const{width:p,height:v}=Tt(t);return Lt(t),qt(t),(t=>{t.getAllEdges().forEach((e=>{const r=e.data;if(r.reversed){t.removeEdge(e.id);const n=r.forwardName;delete r.reversed,delete r.forwardName,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign(Object.assign({},r),{forwardName:n})})}}))})(t),{width:p,height:v}},St=["width","height","layer","fixorder"],Ot={width:0,height:0},zt=["minlen","weight","width","height","labeloffset"],Rt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},It=["labelpos"],Ct=t=>{t.getAllEdges().forEach((e=>{if(e.data.width&&e.data.height){const r=t.getNode(e.source),n={e,rank:(t.getNode(e.target).data.rank-r.data.rank)/2+r.data.rank};_(t,"edge-proxy",n,"_ep")}}))},Dt=t=>{let e=0;return t.getAllNodes().forEach((r=>{var n,o;r.data.borderTop&&(r.data.minRank=null===(n=t.getNode(r.data.borderTop))||void 0===n?void 0:n.data.rank,r.data.maxRank=null===(o=t.getNode(r.data.borderBottom))||void 0===o?void 0:o.data.rank,e=Math.max(e,r.data.maxRank||-1/0))})),e},Pt=t=>{t.getAllNodes().forEach((e=>{"edge-proxy"===e.data.dummy&&(t.getEdge(e.data.e.id).data.labelRank=e.data.rank,t.removeNode(e.id))}))},Tt=(t,e)=>{let r,n,o=0,i=0;const{marginx:s=0,marginy:a=0}=e||{},u=t=>{if(!t.data)return;const e=t.data.x,s=t.data.y,a=t.data.width,u=t.data.height;isNaN(e)||isNaN(a)||(void 0===r&&(r=e-a/2),r=Math.min(r,e-a/2),o=Math.max(o,e+a/2)),isNaN(s)||isNaN(u)||(void 0===n&&(n=s-u/2),n=Math.min(n,s-u/2),i=Math.max(i,s+u/2))};return t.getAllNodes().forEach((t=>{u(t)})),t.getAllEdges().forEach((t=>{(null==t?void 0:t.data.hasOwnProperty("x"))&&u(t)})),r-=s,n-=a,t.getAllNodes().forEach((t=>{t.data.x-=r,t.data.y-=n})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>{t.x-=r,t.y-=n})),t.data.hasOwnProperty("x")&&(t.data.x-=r),t.data.hasOwnProperty("y")&&(t.data.y-=n)})),{width:o-r+s,height:i-n+a}},Lt=t=>{t.getAllEdges().forEach((e=>{const r=t.getNode(e.source),n=t.getNode(e.target);let o,i;e.data.points?(o=e.data.points[0],i=e.data.points[e.data.points.length-1]):(e.data.points=[],o={x:n.data.x,y:n.data.y},i={x:r.data.x,y:r.data.y}),e.data.points.unshift(A(r.data,o)),e.data.points.push(A(n.data,i))}))},Ft=t=>{t.getAllEdges().forEach((t=>{if(t.data.hasOwnProperty("x"))switch("l"!==t.data.labelpos&&"r"!==t.data.labelpos||(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset}}))},qt=t=>{t.getAllEdges().forEach((t=>{var e;t.data.reversed&&(null===(e=t.data.points)||void 0===e||e.reverse())}))},Vt=t=>{t.getAllNodes().forEach((e=>{var r,n,o;if(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length){const r=t.getNode(e.id),i=t.getNode(r.data.borderTop),s=t.getNode(r.data.borderBottom),a=t.getNode(r.data.borderLeft[(null===(n=r.data.borderLeft)||void 0===n?void 0:n.length)-1]),u=t.getNode(r.data.borderRight[(null===(o=r.data.borderRight)||void 0===o?void 0:o.length)-1]);r.data.width=Math.abs((null==u?void 0:u.data.x)-(null==a?void 0:a.data.x))||10,r.data.height=Math.abs((null==s?void 0:s.data.y)-(null==i?void 0:i.data.y))||10,r.data.x=((null==a?void 0:a.data.x)||0)+r.data.width/2,r.data.y=((null==i?void 0:i.data.y)||0)+r.data.height/2}})),t.getAllNodes().forEach((e=>{"border"===e.data.dummy&&t.removeNode(e.id)}))},Ut=t=>{t.getAllEdges().forEach((e=>{if(e.source===e.target){const r=t.getNode(e.source);r.data.selfEdges||(r.data.selfEdges=[]),r.data.selfEdges.push(e),t.removeEdge(e.id)}}))},Bt=t=>{const e=j(t);null==e||e.forEach((e=>{let r=0;null==e||e.forEach(((e,n)=>{var o;const i=t.getNode(e);i.data.order=n+r,null===(o=i.data.selfEdges)||void 0===o||o.forEach((e=>{_(t,"selfedge",{width:e.data.width,height:e.data.height,rank:i.data.rank,order:n+ ++r,e},"_se")})),delete i.data.selfEdges}))}))},$t=t=>{t.getAllNodes().forEach((e=>{const r=t.getNode(e.id);if("selfedge"===r.data.dummy){const n=t.getNode(r.data.e.source),o=n.data.x+n.data.width/2,i=n.data.y,s=r.data.x-o,a=n.data.height/2;t.hasEdge(r.data.e.id)?t.updateEdgeData(r.data.e.id,r.data.e.data):t.addEdge({id:r.data.e.id,source:r.data.e.source,target:r.data.e.target,data:r.data.e.data}),t.removeNode(e.id),r.data.e.data.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{y:i,x:o+s},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.data.e.data.x=r.data.x,r.data.e.data.y=r.data.y}}))},Gt=(t,e)=>{const r={};return null==e||e.forEach((e=>{void 0!==t[e]&&(r[e]=+t[e])})),r},Wt=(t={})=>{const e={};return Object.keys(t).forEach((r=>{e[r.toLowerCase()]=t[r]})),e},Kt=function(t){return"function"==typeof t},Yt=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};function Jt(t,e){let r;return r=Kt(e)?e:p(e)?()=>e:()=>t,r}function Ht(t,e,r=!0){return e||0===e?Kt(e)?e:p(e)?()=>e:Array.isArray(e)?()=>{if(r){const r=Math.max(...e);return isNaN(r)?t:r}return e}:Yt(e)?()=>{if(r){const r=Math.max(e.width,e.height);return isNaN(r)?t:r}return[e.width,e.height]}:()=>t:e=>{const{size:r}=e.data||{};return r?Array.isArray(r)?r[0]>r[1]?r[0]:r[1]:Yt(r)?r.width>r.height?r.width:r.height:r:t}}const Xt=(t,e)=>{let r,n;return n=p(e)?()=>e:Kt(e)?e:()=>0,r=t?Array.isArray(t)?e=>(t[0]>t[1]?t[0]:t[1])+n(e):Kt(t)?t:e=>t+n(e):t=>{var e,r;if(null===(e=t.data)||void 0===e?void 0:e.bboxSize)return Math.max(t.data.bboxSize[0],t.data.bboxSize[1])+n(t);if(null===(r=t.data)||void 0===r?void 0:r.size){if(Array.isArray(t.data.size))return Math.max(t.data.size[0],t.data.size[1])+n(t);const e=t.data.size;return Yt(e)?(e.width>e.height?e.width:e.height)+n(t):e+n(t)}return 10+n(t)},r},Qt=t=>{if(null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array){const e=[];return t.forEach((t=>{e.push(t)})),e.map((t=>Qt(t)))}if("object"==typeof t){const e={};return Object.keys(t).forEach((r=>{e[r]=Qt(t[r])})),e}return t},Zt=(t,e)=>{const r=Qt(t);return r.data=r.data||{},e&&(p(r.data.x)||(r.data.x=Math.random()*e[0]),p(r.data.y)||(r.data.y=Math.random()*e[1])),r},te={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};class ee{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},te),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,t,r)}))}genericDagreLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{nodeSize:o,align:i,rankdir:s="TB",ranksep:a,nodesep:u,ranksepFunc:h,nodesepFunc:d,edgeLabelSpace:c,ranker:f,nodeOrder:g,begin:v,controlPoints:m,radial:y,sortByCombo:w,preset:x}=e,b=new l({tree:[]}),E=Jt(a||50,h),N=Jt(u||50,d);let M=N,_=E;"LR"!==s&&"RL"!==s||(M=E,_=N);const k=Xt(o,void 0),A=r.getAllNodes(),j=r.getAllEdges();let S;A.forEach((t=>{const e=k(t),r=_(t),n=e+2*M(t),o=e+2*r,i=t.data.layer;p(i)?b.addNode({id:t.id,data:{width:n,height:o,layer:i}}):b.addNode({id:t.id,data:{width:n,height:o}})})),w&&(b.attachTreeStructure("combo"),A.forEach((t=>{const{parentId:e}=t.data;void 0!==e&&b.hasNode(e)&&b.setParent(t.id,e,"combo")}))),j.forEach((t=>{b.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||1}})})),(null==x?void 0:x.length)&&(S=new l({nodes:x})),((t,e)=>{const{edgeLabelSpace:r,keepNodeOrder:n,prevGraph:o,rankdir:i,ranksep:s}=e;var a,u;!n&&o&&(u=o,(a=t).getAllNodes().forEach((t=>{const e=a.getNode(t.id);if(u.hasNode(t.id)){const r=u.getNode(t.id);e.data.fixorder=r.data._order,delete r.data._order}else delete e.data.fixorder})));const h=(t=>{const e=new l({tree:[]});return t.getAllNodes().forEach((r=>{const n=Wt(t.getNode(r.id).data),o=Object.assign(Object.assign({},Ot),n),i=Gt(o,St);e.hasNode(r.id)||e.addNode({id:r.id,data:Object.assign({},i)});const s=t.hasTreeStructure("combo")?t.getParent(r.id,"combo"):t.getParent(r.id);null==s||(e.hasNode(s.id)||e.addNode(Object.assign({},s)),e.setParent(r.id,s.id))})),t.getAllEdges().forEach((r=>{const n=Wt(t.getEdge(r.id).data),o={};null==It||It.forEach((t=>{void 0!==n[t]&&(o[t]=n[t])})),e.addEdge({id:r.id,source:r.source,target:r.target,data:Object.assign({},Rt,Gt(n,zt),o)})})),e})(t);let d;r&&(e.ranksep=((t,e)=>{const{ranksep:r=0,rankdir:n}=e;return t.getAllNodes().forEach((t=>{isNaN(t.data.layer)||t.data.layer||(t.data.layer=0)})),t.getAllEdges().forEach((t=>{var e;t.data.minlen*=2,"c"!==(null===(e=t.data.labelpos)||void 0===e?void 0:e.toLowerCase())&&("TB"===n||"BT"===n?t.data.width+=t.data.labeloffset:t.data.height+=t.data.labeloffset)})),r/2})(h,{rankdir:i,ranksep:s}));try{d=jt(h,e)}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:\n",t);throw t}((t,e)=>{t.getAllNodes().forEach((r=>{var n;const o=t.getNode(r.id);if(o){const t=e.getNode(r.id);o.data.x=t.data.x,o.data.y=t.data.y,o.data._order=t.data.order,o.data._rank=t.data.rank,(null===(n=e.getChildren(r.id))||void 0===n?void 0:n.length)&&(o.data.width=t.data.width,o.data.height=t.data.height)}})),t.getAllEdges().forEach((r=>{const n=t.getEdge(r.id),o=e.getEdge(r.id);n.data.points=o?o.data.points:[],o&&o.data.hasOwnProperty("x")&&(n.data.x=o.data.x,n.data.y=o.data.y)}))})(t,h)})(b,{prevGraph:S,edgeLabelSpace:c,keepNodeOrder:!!g,nodeOrder:g||[],acyclicer:"greedy",ranker:f,rankdir:s,nodesep:u,align:i});const O=[0,0];if(v){let t=1/0,e=1/0;b.getAllNodes().forEach((r=>{t>r.data.x&&(t=r.data.x),e>r.data.y&&(e=r.data.y)})),b.getAllEdges().forEach((r=>{var n;null===(n=r.data.points)||void 0===n||n.forEach((r=>{t>r.x&&(t=r.x),e>r.y&&(e=r.y)}))})),O[0]=v[0]-t,O[1]=v[1]-e}const z="LR"===s||"RL"===s;if(y);else{const t=new Set,e="BT"===s||"RL"===s?(t,e)=>e-t:(t,e)=>t-e;b.getAllNodes().forEach((e=>{e.data.x=e.data.x+O[0],e.data.y=e.data.y+O[1],t.add(z?e.data.x:e.data.y)}));const r=Array.from(t).sort(e),n=z?(t,e)=>t.x!==e.x:(t,e)=>t.y!==e.y,o=z?(t,e,r)=>{const n=Math.max(e.y,r.y),o=Math.min(e.y,r.y);return t.filter((t=>t.y<=n&&t.y>=o))}:(t,e,r)=>{const n=Math.max(e.x,r.x),o=Math.min(e.x,r.x);return t.filter((t=>t.x<=n&&t.x>=o))};b.getAllEdges().forEach(((t,e)=>{var i;c&&m&&"loop"!==t.data.type&&(t.data.controlPoints=re(null===(i=t.data.points)||void 0===i?void 0:i.map((({x:t,y:e})=>({x:t+O[0],y:e+O[1]}))),b.getNode(t.source),b.getNode(t.target),r,z,n,o))}))}let R=[];R=b.getAllNodes().map((t=>Zt(t)));const I=b.getAllEdges();return t&&(R.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),I.forEach((t=>{r.mergeEdgeData(t.id,{controlPoints:t.data.controlPoints})}))),{nodes:R,edges:I}}))}}const re=(t,e,r,n,o,i,s)=>{let a=(null==t?void 0:t.slice(1,t.length-1))||[];if(e&&r){let{x:t,y:u}=e.data,{x:h,y:d}=r.data;if(o&&(t=e.data.y,u=e.data.x,h=r.data.y,d=r.data.x),d!==u&&t!==h){const c=n.indexOf(u),l=n[c+1];if(l){const t=a[0],e=o?{x:(u+l)/2,y:(null==t?void 0:t.y)||h}:{x:(null==t?void 0:t.x)||h,y:(u+l)/2};t&&!i(t,e)||a.unshift(e)}const f=n.indexOf(d),g=Math.abs(f-c);if(1===g)a=s(a,e.data,r.data),a.length||a.push(o?{x:(u+d)/2,y:t}:{x:t,y:(u+d)/2});else if(g>1){const e=n[f-1];if(e){const r=a[a.length-1],n=o?{x:(d+e)/2,y:(null==r?void 0:r.y)||h}:{x:(null==r?void 0:r.x)||t,y:(d+e)/2};r&&!i(r,n)||a.push(n)}}}}return a},ne=(t,e,r)=>{const n=t.getAllNodes(),o=t.getAllEdges();return(null==n?void 0:n.length)?1===n.length?(e&&t.mergeNodeData(n[0].id,{x:r[0],y:r[1]}),{nodes:[Object.assign(Object.assign({},n[0]),{data:Object.assign(Object.assign({},n[0].data),{x:r[0],y:r[1]})})],edges:o}):void 0:{nodes:[],edges:o}},oe={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1};class ie{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},oe),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericCircularLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericCircularLayout(!0,t,r)}))}genericCircularLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{width:o,height:i,center:s,divisions:a,startAngle:u=0,endAngle:h=2*Math.PI,angleRatio:d,ordering:c,clockwise:l,nodeSpacing:f,nodeSize:g}=e,p=r.getAllNodes(),v=r.getAllEdges(),[m,y,w]=ae(o,i,s),x=null==p?void 0:p.length;if(!x||1===x)return ne(r,t,w);const b=(h-u)/x;let{radius:E,startRadius:N,endRadius:M}=e;if(f){const t=Jt(10,f),e=Ht(10,g);let r=-1/0;p.forEach((t=>{const n=e(t);r<n&&(r=n)}));let n=0;p.forEach(((e,o)=>{n+=0===o?r||10:(t(e)||0)+(r||10)})),E=n/(2*Math.PI)}else E||N||M?!N&&M?N=M:N&&!M&&(M=N):E=Math.min(y,m)/2;const _=b*d;let k=[];k="topology"===c?se(r,p):"topology-directed"===c?se(r,p,!0):"degree"===c?function(t,e){const r=[];return e.forEach(((t,e)=>{r.push(Zt(t))})),r.sort(((e,r)=>t.getDegree(e.id,"both")-t.getDegree(r.id,"both"))),r}(r,p):p.map((t=>Zt(t)));const A=Math.ceil(x/a);for(let t=0;t<x;++t){let e=E;e||null===N||null===M||(e=N+t*(M-N)/(x-1)),e||(e=10+100*t/(x-1));let r=u+t%A*_+2*Math.PI/a*Math.floor(t/A);l||(r=h-t%A*_-2*Math.PI/a*Math.floor(t/A)),k[t].data.x=w[0]+Math.cos(r)*e,k[t].data.y=w[1]+Math.sin(r)*e}return t&&k.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),{nodes:k,edges:v}}))}}const se=(t,e,r=!1)=>{const n=[Zt(e[0])],o={},i=e.length;o[e[0].id]=!0;let s=0;return e.forEach(((a,u)=>{if(0!==u)if(u!==i-1&&t.getDegree(a.id,"both")===t.getDegree(e[u+1].id,"both")&&!t.areNeighbors(n[s].id,a.id)||o[a.id]){const u=r?t.getSuccessors(n[s].id):t.getNeighbors(n[s].id);let h=!1;for(let e=0;e<u.length;e++){const r=u[e];if(t.getDegree(r.id)===t.getDegree(a.id)&&!o[r.id]){n.push(Zt(r)),o[r.id]=!0,h=!0;break}}let d=0;for(;!h&&(o[e[d].id]||(n.push(Zt(e[d])),o[e[d].id]=!0,h=!0),d++,d!==i););}else n.push(Zt(a)),o[a.id]=!0,s++})),n},ae=(t,e,r)=>{let n=t,o=e,i=r;return n||"undefined"==typeof window||(n=window.innerWidth),o||"undefined"==typeof window||(o=window.innerHeight),i||(i=[n/2,o/2]),[n,o,i]},ue=function(t){return g(t,"String")},he=Array.isArray,de={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class ce{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},de),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericConcentricLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericConcentricLayout(!0,t,r)}))}genericConcentricLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{center:o,width:i,height:s,sortBy:a,maxLevelDiff:u,sweep:h,clockwise:d,equidistant:c,preventOverlap:l,startAngle:f=1.5*Math.PI,nodeSize:g,nodeSpacing:v}=e,m=r.getAllNodes(),y=r.getAllEdges(),w=i||"undefined"==typeof window?i:window.innerWidth,x=s||"undefined"==typeof window?s:window.innerHeight,b=o||[w/2,x/2];if(!(null==m?void 0:m.length)||1===m.length)return ne(r,t,b);const E=[];let N,M=0;he(g)?N=Math.max(g[0],g[1]):Kt(g)?(N=-1/0,m.forEach((t=>{const e=g(t);e>N&&(N=e)}))):N=g,he(v)?M=Math.max(v[0],v[1]):p(v)&&(M=v),m.forEach((t=>{const e=Zt(t);E.push(e);let r=N;const{data:n}=e;he(n.size)?r=Math.max(n.size[0],n.size[1]):p(n.size)?r=n.size:Yt(n.size)&&(r=Math.max(n.size.width,n.size.height)),N=Math.max(N,r),Kt(v)&&(M=Math.max(v(t),M))}));const _={};E.forEach(((t,e)=>{_[t.id]=e}));let k=a;ue(k)&&void 0!==E[0].data[k]||(k="degree"),"degree"===k?E.sort(((t,e)=>r.getDegree(e.id,"both")-r.getDegree(t.id,"both"))):E.sort(((t,e)=>e.data[k]-t.data[k]));const A=E[0],j=(u||("degree"===k?r.getDegree(A.id,"both"):A.data[k]))/4,S=[{nodes:[]}];let O=S[0];E.forEach((t=>{if(O.nodes.length>0){const e="degree"===k?Math.abs(r.getDegree(O.nodes[0].id,"both")-r.getDegree(t.id,"both")):Math.abs(O.nodes[0].data[k]-t.data[k]);j&&e>=j&&(O={nodes:[]},S.push(O))}O.nodes.push(t)}));let z=N+M;if(!l){const t=S.length>0&&S[0].nodes.length>1,e=(Math.min(w,x)/2-z)/(S.length+(t?1:0));z=Math.min(z,e)}let R=0;if(S.forEach((t=>{const e=void 0===h?2*Math.PI-2*Math.PI/t.nodes.length:h;if(t.dTheta=e/Math.max(1,t.nodes.length-1),t.nodes.length>1&&l){const e=Math.cos(t.dTheta)-Math.cos(0),r=Math.sin(t.dTheta)-Math.sin(0),n=Math.sqrt(z*z/(e*e+r*r));R=Math.max(n,R)}t.r=R,R+=z})),c){let t=0,e=0;for(let r=0;r<S.length;r++){const n=(S[r].r||0)-e;t=Math.max(t,n)}e=0,S.forEach(((r,n)=>{0===n&&(e=r.r||0),r.r=e,e+=t}))}return S.forEach((t=>{const e=t.dTheta||0,r=t.r||0;t.nodes.forEach(((t,n)=>{const o=f+(d?1:-1)*e*n;t.data.x=b[0]+r*Math.cos(o),t.data.y=b[1]+r*Math.sin(o)}))})),t&&E.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:E,edges:y}}))}}function le(t,e,r,n){if(isNaN(e)||isNaN(r))return t;var o,i,s,a,u,h,d,c,l,f=t._root,g={data:n},p=t._x0,v=t._y0,m=t._x1,y=t._y1;if(!f)return t._root=g,t;for(;f.length;)if((h=e>=(i=(p+m)/2))?p=i:m=i,(d=r>=(s=(v+y)/2))?v=s:y=s,o=f,!(f=f[c=d<<1|h]))return o[c]=g,t;if(a=+t._x.call(null,f.data),u=+t._y.call(null,f.data),e===a&&r===u)return g.next=f,o?o[c]=g:t._root=g,t;do{o=o?o[c]=new Array(4):t._root=new Array(4),(h=e>=(i=(p+m)/2))?p=i:m=i,(d=r>=(s=(v+y)/2))?v=s:y=s}while((c=d<<1|h)==(l=(u>=s)<<1|a>=i));return o[l]=f,o[c]=g,t}function fe(t,e,r,n,o){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=o}function ge(t){return t[0]}function pe(t){return t[1]}function ve(t,e,r){var n=new me(null==e?ge:e,null==r?pe:r,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function me(t,e,r,n,o,i){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=o,this._y1=i,this._root=void 0}function ye(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var we=ve.prototype=me.prototype;function xe(t,e,r,n,o){if(isNaN(e)||isNaN(r)||isNaN(n))return t;var i,s,a,u,h,d,c,l,f,g,p,v,m=t._root,y={data:o},w=t._x0,x=t._y0,b=t._z0,E=t._x1,N=t._y1,M=t._z1;if(!m)return t._root=y,t;for(;m.length;)if((l=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+N)/2))?x=a:N=a,(g=n>=(u=(b+M)/2))?b=u:M=u,i=m,!(m=m[p=g<<2|f<<1|l]))return i[p]=y,t;if(h=+t._x.call(null,m.data),d=+t._y.call(null,m.data),c=+t._z.call(null,m.data),e===h&&r===d&&n===c)return y.next=m,i?i[p]=y:t._root=y,t;do{i=i?i[p]=new Array(8):t._root=new Array(8),(l=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+N)/2))?x=a:N=a,(g=n>=(u=(b+M)/2))?b=u:M=u}while((p=g<<2|f<<1|l)==(v=(c>=u)<<2|(d>=a)<<1|h>=s));return i[v]=m,i[p]=y,t}function be(t,e,r,n,o,i,s){this.node=t,this.x0=e,this.y0=r,this.z0=n,this.x1=o,this.y1=i,this.z1=s}function Ee(t){return t[0]}function Ne(t){return t[1]}function Me(t){return t[2]}function _e(t,e,r,n){var o=new ke(null==e?Ee:e,null==r?Ne:r,null==n?Me:n,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?o:o.addAll(t)}function ke(t,e,r,n,o,i,s,a,u){this._x=t,this._y=e,this._z=r,this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this._root=void 0}function Ae(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}we.copy=function(){var t,e,r=new me(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=ye(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var o=0;o<4;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(4)}):n.target[o]=ye(e));return r},we.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t);return le(this.cover(e,r),e,r,t)},we.addAll=function(t){var e,r,n,o,i=t.length,s=new Array(i),a=new Array(i),u=1/0,h=1/0,d=-1/0,c=-1/0;for(r=0;r<i;++r)isNaN(n=+this._x.call(null,e=t[r]))||isNaN(o=+this._y.call(null,e))||(s[r]=n,a[r]=o,n<u&&(u=n),n>d&&(d=n),o<h&&(h=o),o>c&&(c=o));if(u>d||h>c)return this;for(this.cover(u,h).cover(d,c),r=0;r<i;++r)le(this,s[r],a[r],t[r]);return this},we.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var r=this._x0,n=this._y0,o=this._x1,i=this._y1;if(isNaN(r))o=(r=Math.floor(t))+1,i=(n=Math.floor(e))+1;else{for(var s,a,u=o-r||1,h=this._root;r>t||t>=o||n>e||e>=i;)switch(a=(e<n)<<1|t<r,(s=new Array(4))[a]=h,h=s,u*=2,a){case 0:o=r+u,i=n+u;break;case 1:r=o-u,i=n+u;break;case 2:o=r+u,n=i-u;break;case 3:r=o-u,n=i-u}this._root&&this._root.length&&(this._root=h)}return this._x0=r,this._y0=n,this._x1=o,this._y1=i,this},we.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},we.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]]},we.find=function(t,e,r){var n,o,i,s,a,u,h,d=this._x0,c=this._y0,l=this._x1,f=this._y1,g=[],p=this._root;for(p&&g.push(new fe(p,d,c,l,f)),null==r?r=1/0:(d=t-r,c=e-r,l=t+r,f=e+r,r*=r);u=g.pop();)if(!(!(p=u.node)||(o=u.x0)>l||(i=u.y0)>f||(s=u.x1)<d||(a=u.y1)<c))if(p.length){var v=(o+s)/2,m=(i+a)/2;g.push(new fe(p[3],v,m,s,a),new fe(p[2],o,m,v,a),new fe(p[1],v,i,s,m),new fe(p[0],o,i,v,m)),(h=(e>=m)<<1|t>=v)&&(u=g[g.length-1],g[g.length-1]=g[g.length-1-h],g[g.length-1-h]=u)}else{var y=t-+this._x.call(null,p.data),w=e-+this._y.call(null,p.data),x=y*y+w*w;if(x<r){var b=Math.sqrt(r=x);d=t-b,c=e-b,l=t+b,f=e+b,n=p.data}}return n},we.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t)))return this;var e,r,n,o,i,s,a,u,h,d,c,l,f=this._root,g=this._x0,p=this._y0,v=this._x1,m=this._y1;if(!f)return this;if(f.length)for(;;){if((h=i>=(a=(g+v)/2))?g=a:v=a,(d=s>=(u=(p+m)/2))?p=u:m=u,e=f,!(f=f[c=d<<1|h]))return this;if(!f.length)break;(e[c+1&3]||e[c+2&3]||e[c+3&3])&&(r=e,l=c)}for(;f.data!==t;)if(n=f,!(f=f.next))return this;return(o=f.next)&&delete f.next,n?(o?n.next=o:delete n.next,this):e?(o?e[c]=o:delete e[c],(f=e[0]||e[1]||e[2]||e[3])&&f===(e[3]||e[2]||e[1]||e[0])&&!f.length&&(r?r[l]=f:this._root=f),this):(this._root=o,this)},we.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},we.root=function(){return this._root},we.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},we.visit=function(t){var e,r,n,o,i,s,a=[],u=this._root;for(u&&a.push(new fe(u,this._x0,this._y0,this._x1,this._y1));e=a.pop();)if(!t(u=e.node,n=e.x0,o=e.y0,i=e.x1,s=e.y1)&&u.length){var h=(n+i)/2,d=(o+s)/2;(r=u[3])&&a.push(new fe(r,h,d,i,s)),(r=u[2])&&a.push(new fe(r,n,d,h,s)),(r=u[1])&&a.push(new fe(r,h,o,i,d)),(r=u[0])&&a.push(new fe(r,n,o,h,d))}return this},we.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new fe(this._root,this._x0,this._y0,this._x1,this._y1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.y0,u=e.x1,h=e.y1,d=(s+u)/2,c=(a+h)/2;(i=o[0])&&r.push(new fe(i,s,a,d,c)),(i=o[1])&&r.push(new fe(i,d,a,u,c)),(i=o[2])&&r.push(new fe(i,s,c,d,h)),(i=o[3])&&r.push(new fe(i,d,c,u,h))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},we.x=function(t){return arguments.length?(this._x=t,this):this._x},we.y=function(t){return arguments.length?(this._y=t,this):this._y};var je=_e.prototype=ke.prototype;function Se(t){let e=0,r=0,n=0,o=0,i=0;const s=t.length;if(s){for(let a=0;a<s;a++){const s=t[a];s&&s.weight&&(e+=s.weight,r+=s.x*s.weight,n+=s.y*s.weight,o+=s.z*s.weight,i+=s.size*s.weight)}t.x=r/e,t.y=n/e,t.z=o/e,t.size=i/e,t.weight=e}else{const e=t;t.x=e.data.x,t.y=e.data.y,t.z=e.data.z,t.size=e.data.size,t.weight=e.data.weight}}je.copy=function(){var t,e,r=new ke(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root;if(!n)return r;if(!n.length)return r._root=Ae(n),r;for(t=[{source:n,target:r._root=new Array(8)}];n=t.pop();)for(var o=0;o<8;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(8)}):n.target[o]=Ae(e));return r},je.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t),n=+this._z.call(null,t);return xe(this.cover(e,r,n),e,r,n,t)},je.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e),n=new Float64Array(e),o=new Float64Array(e);let i=1/0,s=1/0,a=1/0,u=-1/0,h=-1/0,d=-1/0;for(let c,l,f,g,p=0;p<e;++p)isNaN(l=+this._x.call(null,c=t[p]))||isNaN(f=+this._y.call(null,c))||isNaN(g=+this._z.call(null,c))||(r[p]=l,n[p]=f,o[p]=g,l<i&&(i=l),l>u&&(u=l),f<s&&(s=f),f>h&&(h=f),g<a&&(a=g),g>d&&(d=g));if(i>u||s>h||a>d)return this;this.cover(i,s,a).cover(u,h,d);for(let i=0;i<e;++i)xe(this,r[i],n[i],o[i],t[i]);return this},je.cover=function(t,e,r){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(r=+r))return this;var n=this._x0,o=this._y0,i=this._z0,s=this._x1,a=this._y1,u=this._z1;if(isNaN(n))s=(n=Math.floor(t))+1,a=(o=Math.floor(e))+1,u=(i=Math.floor(r))+1;else{for(var h,d,c=s-n||1,l=this._root;n>t||t>=s||o>e||e>=a||i>r||r>=u;)switch(d=(r<i)<<2|(e<o)<<1|t<n,(h=new Array(8))[d]=l,l=h,c*=2,d){case 0:s=n+c,a=o+c,u=i+c;break;case 1:n=s-c,a=o+c,u=i+c;break;case 2:s=n+c,o=a-c,u=i+c;break;case 3:n=s-c,o=a-c,u=i+c;break;case 4:s=n+c,a=o+c,i=u-c;break;case 5:n=s-c,a=o+c,i=u-c;break;case 6:s=n+c,o=a-c,i=u-c;break;case 7:n=s-c,o=a-c,i=u-c}this._root&&this._root.length&&(this._root=l)}return this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this},je.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},je.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},je.find=function(t,e,r,n){var o,i,s,a,u,h,d,c,l,f=this._x0,g=this._y0,p=this._z0,v=this._x1,m=this._y1,y=this._z1,w=[],x=this._root;for(x&&w.push(new be(x,f,g,p,v,m,y)),null==n?n=1/0:(f=t-n,g=e-n,p=r-n,v=t+n,m=e+n,y=r+n,n*=n);c=w.pop();)if(!(!(x=c.node)||(i=c.x0)>v||(s=c.y0)>m||(a=c.z0)>y||(u=c.x1)<f||(h=c.y1)<g||(d=c.z1)<p))if(x.length){var b=(i+u)/2,E=(s+h)/2,N=(a+d)/2;w.push(new be(x[7],b,E,N,u,h,d),new be(x[6],i,E,N,b,h,d),new be(x[5],b,s,N,u,E,d),new be(x[4],i,s,N,b,E,d),new be(x[3],b,E,a,u,h,N),new be(x[2],i,E,a,b,h,N),new be(x[1],b,s,a,u,E,N),new be(x[0],i,s,a,b,E,N)),(l=(r>=N)<<2|(e>=E)<<1|t>=b)&&(c=w[w.length-1],w[w.length-1]=w[w.length-1-l],w[w.length-1-l]=c)}else{var M=t-+this._x.call(null,x.data),_=e-+this._y.call(null,x.data),k=r-+this._z.call(null,x.data),A=M*M+_*_+k*k;if(A<n){var j=Math.sqrt(n=A);f=t-j,g=e-j,p=r-j,v=t+j,m=e+j,y=r+j,o=x.data}}return o},je.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t))||isNaN(a=+this._z.call(null,t)))return this;var e,r,n,o,i,s,a,u,h,d,c,l,f,g,p,v=this._root,m=this._x0,y=this._y0,w=this._z0,x=this._x1,b=this._y1,E=this._z1;if(!v)return this;if(v.length)for(;;){if((c=i>=(u=(m+x)/2))?m=u:x=u,(l=s>=(h=(y+b)/2))?y=h:b=h,(f=a>=(d=(w+E)/2))?w=d:E=d,e=v,!(v=v[g=f<<2|l<<1|c]))return this;if(!v.length)break;(e[g+1&7]||e[g+2&7]||e[g+3&7]||e[g+4&7]||e[g+5&7]||e[g+6&7]||e[g+7&7])&&(r=e,p=g)}for(;v.data!==t;)if(n=v,!(v=v.next))return this;return(o=v.next)&&delete v.next,n?(o?n.next=o:delete n.next,this):e?(o?e[g]=o:delete e[g],(v=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&v===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!v.length&&(r?r[p]=v:this._root=v),this):(this._root=o,this)},je.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},je.root=function(){return this._root},je.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},je.visit=function(t){var e,r,n,o,i,s,a,u,h=[],d=this._root;for(d&&h.push(new be(d,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=h.pop();)if(!t(d=e.node,n=e.x0,o=e.y0,i=e.z0,s=e.x1,a=e.y1,u=e.z1)&&d.length){var c=(n+s)/2,l=(o+a)/2,f=(i+u)/2;(r=d[7])&&h.push(new be(r,c,l,f,s,a,u)),(r=d[6])&&h.push(new be(r,n,l,f,c,a,u)),(r=d[5])&&h.push(new be(r,c,o,f,s,l,u)),(r=d[4])&&h.push(new be(r,n,o,f,c,l,u)),(r=d[3])&&h.push(new be(r,c,l,i,s,a,f)),(r=d[2])&&h.push(new be(r,n,l,i,c,a,f)),(r=d[1])&&h.push(new be(r,c,o,i,s,l,f)),(r=d[0])&&h.push(new be(r,n,o,i,c,l,f))}return this},je.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new be(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.y0,u=e.z0,h=e.x1,d=e.y1,c=e.z1,l=(s+h)/2,f=(a+d)/2,g=(u+c)/2;(i=o[0])&&r.push(new be(i,s,a,u,l,f,g)),(i=o[1])&&r.push(new be(i,l,a,u,h,f,g)),(i=o[2])&&r.push(new be(i,s,f,u,l,d,g)),(i=o[3])&&r.push(new be(i,l,f,u,h,d,g)),(i=o[4])&&r.push(new be(i,s,a,g,l,f,c)),(i=o[5])&&r.push(new be(i,l,a,g,h,f,c)),(i=o[6])&&r.push(new be(i,s,f,g,l,d,c)),(i=o[7])&&r.push(new be(i,l,f,g,h,d,c))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},je.x=function(t){return arguments.length?(this._x=t,this):this._x},je.y=function(t){return arguments.length?(this._y=t,this):this._y},je.z=function(t){return arguments.length?(this._z=t,this):this._z};const Oe=(t,e,r,n,o,i,s)=>{var a;if((null===(a=t.data)||void 0===a?void 0:a.id)===i.id)return;const u=[r,n,o][s-1],h=i.x-t.x||.1,d=i.y-t.y||.1,c=i.z-t.z||.1,l=[h,d,c],f=u-e;let g=0;for(let t=0;t<s;t++)g+=l[t]*l[t];const p=Math.sqrt(g)*g;if(f*f*.81<g){const e=t.weight/p;return i.vx+=h*e,i.vy+=d*e,i.vz+=c*e,!0}if(t.length)return!1;if(t.data!==i){const e=t.data.weight/p;i.vx+=h*e,i.vy+=d*e,i.vz+=c*e}},ze={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"};class Re{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},ze),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericForceLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericForceLayout(!0,t,r)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;(this.judgingDistance>this.lastOptions.minMovement||e<1)&&e<t;e++)this.runOneStep(this.lastCalcGraph,this.lastGraph,e,this.lastVelMap,this.lastOptions),this.updatePosition(this.lastGraph,this.lastCalcGraph,this.lastVelMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericForceLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),o=r.getAllNodes(),i=r.getAllEdges(),s=this.formatOptions(e,r),{dimensions:a,width:u,height:h,nodeSize:d,getMass:c,nodeStrength:f,edgeStrength:g,linkDistance:v}=s,m=o.map(((t,e)=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{x:p(t.data.x)?t.data.x:Math.random()*u,y:p(t.data.y)?t.data.y:Math.random()*h,z:p(t.data.z)?t.data.z:Math.random()*Math.sqrt(u*h),size:d(t)||30,mass:c(t),nodeStrength:f(t)})}))),y=i.map((t=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{edgeStrength:g(t),linkDistance:v(t,r.getNode(t.source),r.getNode(t.target))})})));if(!(null==o?void 0:o.length))return this.lastResult={nodes:[],edges:i},{nodes:[],edges:i};const w={};o.forEach(((t,e)=>{w[t.id]={x:0,y:0,z:0}}));const x=new l({nodes:m,edges:y});this.formatCentripetal(s,x);const{maxIteration:b,minMovement:E,onTick:N}=s;if(this.lastLayoutNodes=m,this.lastLayoutEdges=y,this.lastAssign=t,this.lastGraph=r,this.lastCalcGraph=x,this.lastOptions=s,this.lastVelMap=w,"undefined"==typeof window)return;let M=0;return new Promise((e=>{this.timeInterval=window.setInterval((()=>{o&&this.running||e({nodes:Te(r,m),edges:i}),this.runOneStep(x,r,M,w,s),this.updatePosition(r,x,w,s),t&&m.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===a?t.data.z:void 0}))),null==N||N({nodes:Te(r,m),edges:i}),M++,(M>=b||this.judgingDistance<E)&&(window.clearInterval(this.timeInterval),e({nodes:Te(r,m),edges:i}))}),0),this.running=!0}))}))}formatOptions(t,e){const r=Object.assign({},t),{width:n,height:o,getMass:i,nodeSize:s}=t;r.width=n||"undefined"==typeof window?n:window.innerWidth,r.height=o||"undefined"==typeof window?o:window.innerHeight,t.center||(r.center=[r.width/2,r.height/2]),i||(r.getMass=t=>{let r=1;p(null==t?void 0:t.data.mass)&&(r=null==t?void 0:t.data.mass);const n=e.getDegree(t.id,"both");return!n||n<5?r:5*n*r});const a=Jt(0,t.nodeSpacing);let u;u=s?Kt(s)?t=>s(t)+a(t):he(s)?t=>{const e=s;return Math.max(e[0],e[1])+a(t)}:t=>s+a(t):t=>{const{size:e}=(null==t?void 0:t.data)||{};return e?he(e)?Math.max(e[0],e[1])+a(t):Yt(e)?Math.max(e.width,e.height)+a(t):e+a(t):10+a(t)},r.nodeSize=u;const h=t.linkDistance?Jt(1,t.linkDistance):t=>1+r.nodeSize(e.getNode(t.source))+r.nodeSize(e.getNode(t.target));return r.linkDistance=h,r.nodeStrength=Jt(1,t.nodeStrength),r.edgeStrength=Jt(1,t.edgeStrength),r}formatCentripetal(t,e){const{dimensions:r,centripetalOptions:n,center:o,clusterNodeStrength:i,leafCluster:s,clustering:a,nodeClusterBy:u}=t,h=e.getAllNodes(),d=n||{leaf:2,single:2,others:1,center:t=>({x:o[0],y:o[1],z:3===r?o[2]:void 0})};let c,l;if("function"!=typeof i&&(t.clusterNodeStrength=t=>i),s&&u&&(c=Ie(e,u),l=Array.from(new Set(null==h?void 0:h.map((t=>t.data[u]))))||[],t.centripetalOptions=Object.assign(d,{single:100,leaf:e=>{const{siblingLeaves:r,sameTypeLeaves:n}=c[e.id]||{};return(null==n?void 0:n.length)===(null==r?void 0:r.length)||1===(null==l?void 0:l.length)?1:t.clusterNodeStrength(e)},others:1,center:t=>{const r=e.getDegree(t.id,"both");if(!r)return{x:100,y:100,z:0};let n;if(1===r){const{sameTypeLeaves:e=[]}=c[t.id]||{};1===e.length?n=void 0:e.length>1&&(n=Pe(e))}else n=void 0;return{x:null==n?void 0:n.x,y:null==n?void 0:n.y,z:null==n?void 0:n.z}}})),a&&u){c||(c=Ie(e,u)),l||(l=Array.from(new Set(h.map((t=>t.data[u]))))),l=l.filter((t=>void 0!==t));const r={};l.forEach((t=>{const n=h.filter((e=>e.data[u]===t)).map((t=>e.getNode(t.id)));r[t]=Pe(n)})),t.centripetalOptions=Object.assign(d,{single:e=>t.clusterNodeStrength(e),leaf:e=>t.clusterNodeStrength(e),others:e=>t.clusterNodeStrength(e),center:t=>{const e=r[t.data[u]];return{x:null==e?void 0:e.x,y:null==e?void 0:e.y,z:null==e?void 0:e.z}}})}const{leaf:f,single:g,others:p}=t.centripetalOptions||{};f&&"function"!=typeof f&&(t.centripetalOptions.leaf=()=>f),g&&"function"!=typeof g&&(t.centripetalOptions.single=()=>g),p&&"function"!=typeof p&&(t.centripetalOptions.others=()=>p)}runOneStep(t,e,r,n,o){const i={},s=t.getAllNodes(),a=t.getAllEdges();if(!(null==s?void 0:s.length))return;const{monitor:u}=o;this.calRepulsive(t,i,o),a&&this.calAttractive(t,i,o),this.calGravity(t,e,i,o),this.updateVelocity(t,i,n,o),u&&u({energy:this.calTotalEnergy(i,s),nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:r})}calTotalEnergy(t,e){if(!(null==e?void 0:e.length))return 0;let r=0;return e.forEach(((e,n)=>{const o=t[e.id].x,i=t[e.id].y,s=3===this.options.dimensions?t[e.id].z:0,a=o*o+i*i+s*s,{mass:u=1}=e.data;r+=u*a*.5})),r}calRepulsive(t,e,r){const{dimensions:n,factor:o,coulombDisScale:i}=r;!function(t,e,r,n,o=2){const i=e/r,s=t.getAllNodes(),a=s.map(((t,e)=>{const{nodeStrength:r,x:n,y:o,z:s,size:a}=t.data;return{x:n,y:o,z:s,size:a,index:e,id:t.id,vx:0,vy:0,vz:0,weight:i*r}})),u=(2===o?ve(a,(t=>t.x),(t=>t.y)):_e(a,(t=>t.x),(t=>t.y),(t=>t.z))).visitAfter(Se),h=new Map;a.forEach((t=>{h.set(t.id,t),function(t,e,r){e.visit(((e,n,o,i,s)=>Oe(e,n,o,i,s,t,r)))}(t,u,o)})),a.map(((t,e)=>{const{id:r,data:o}=s[e],{mass:i=1}=o;n[r]={x:t.vx/i,y:t.vy/i,z:t.vz/i}}))}(t,o,i*i,e,n)}calAttractive(t,e,r){const{dimensions:n,nodeSize:o}=r;t.getAllEdges().forEach(((r,i)=>{const{source:s,target:a}=r,u=t.getNode(s),h=t.getNode(a);if(!u||!h)return;let d=h.data.x-u.data.x,c=h.data.y-u.data.y,l=3===n?h.data.z-u.data.z:0;d||c||(d=.01*Math.random(),c=.01*Math.random(),3!==n||l||(l=.01*Math.random()));const f=Math.sqrt(d*d+c*c+l*l);if(f<o(u)+o(h))return;const g=d/f,p=c/f,v=l/f,{linkDistance:m=200,edgeStrength:y=200}=r.data||{},w=(m-f)*y,x=1/(u.data.mass||1),b=1/(h.data.mass||1),E=g*w,N=p*w,M=v*w;e[s].x-=E*x,e[s].y-=N*x,e[s].z-=M*x,e[a].x+=E*b,e[a].y+=N*b,e[a].z+=M*b}))}calGravity(t,e,r,n){const{getCenter:o}=n,i=t.getAllNodes(),s=e.getAllNodes(),a=e.getAllEdges(),{width:u,height:h,center:d,gravity:c,centripetalOptions:l}=n;i&&i.forEach((n=>{const{id:i,data:f}=n,{mass:g,x:v,y:m,z:y}=f,w=e.getNode(i);let x=0,b=0,E=0,N=c;const M=t.getDegree(i,"in"),_=t.getDegree(i,"out"),k=t.getDegree(i,"both"),A=null==o?void 0:o(w,k);if(A){const[t,e,r]=A;x=v-t,b=m-e,N=r}else x=v-d[0],b=m-d[1],E=y-d[2];if(N&&(r[i].x-=N*x/g,r[i].y-=N*b/g,r[i].z-=N*E/g),l){const{leaf:t,single:e,others:n,center:o}=l,{x:d,y:c,z:f,centerStrength:x}=(null==o?void 0:o(w,s,a,u,h))||{x:0,y:0,z:0,centerStrength:0};if(!p(d)||!p(c))return;const b=(v-d)/g,E=(m-c)/g,N=(y-f)/g;if(x&&(r[i].x-=x*b,r[i].y-=x*E,r[i].z-=x*N),0===k){const t=e(w);if(!t)return;return r[i].x-=t*b,r[i].y-=t*E,void(r[i].z-=t*N)}if(0===M||0===_){const e=t(w,s,a);if(!e)return;return r[i].x-=e*b,r[i].y-=e*E,void(r[i].z-=e*N)}const A=n(w);if(!A)return;r[i].x-=A*b,r[i].y-=A*E,r[i].z-=A*N}}))}updateVelocity(t,e,r,n){const{damping:o,maxSpeed:i,interval:s,dimensions:a}=n,u=t.getAllNodes();(null==u?void 0:u.length)&&u.forEach((t=>{const{id:n}=t;let u=(r[n].x+e[n].x*s)*o||.01,h=(r[n].y+e[n].y*s)*o||.01,d=3===a?(r[n].z+e[n].z*s)*o||.01:0;const c=Math.sqrt(u*u+h*h+d*d);if(c>i){const t=i/c;u*=t,h*=t,d*=t}r[n]={x:u,y:h,z:d}}))}updatePosition(t,e,r,n){const{distanceThresholdMode:o,interval:i,dimensions:s}=n,a=e.getAllNodes();if(!(null==a?void 0:a.length))return void(this.judgingDistance=0);let u=0;"max"===o?this.judgingDistance=-1/0:"min"===o&&(this.judgingDistance=1/0),a.forEach((n=>{const{id:a}=n,h=t.getNode(a);if(p(h.data.fx)&&p(h.data.fy))return void e.mergeNodeData(a,{x:h.data.fx,y:h.data.fy,z:3===s?h.data.fz:void 0});const d=r[a].x*i,c=r[a].y*i,l=3===s?r[a].z*i:0;e.mergeNodeData(a,{x:n.data.x+d,y:n.data.y+c,z:n.data.z+l});const f=Math.sqrt(d*d+c*c+l*l);switch(o){case"max":this.judgingDistance<f&&(this.judgingDistance=f);break;case"min":this.judgingDistance>f&&(this.judgingDistance=f);break;default:u+=f}})),o&&"mean"!==o||(this.judgingDistance=u/a.length)}}const Ie=(t,e)=>{const r=t.getAllNodes();if(!(null==r?void 0:r.length))return{};const n={};return r.forEach(((r,o)=>{1===t.getDegree(r.id,"both")&&(n[r.id]=Ce(t,"leaf",r,e))})),n},Ce=(t,e,r,n)=>{const o=t.getDegree(r.id,"in"),i=t.getDegree(r.id,"out");let s=r,a=[];return 0===o?(s=t.getSuccessors(r.id)[0],a=t.getNeighbors(s.id)):0===i&&(s=t.getPredecessors(r.id)[0],a=t.getNeighbors(s.id)),a=a.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out"))),{coreNode:s,siblingLeaves:a,sameTypeLeaves:De(t,e,n,r,a)}},De=(t,e,r,n,o)=>{const i=n.data[r]||"";let s=(null==o?void 0:o.filter((t=>t.data[r]===i)))||[];return"leaf"===e&&(s=s.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out")))),s},Pe=t=>{const e={x:0,y:0};t.forEach((t=>{const{x:r,y:n}=t.data;e.x+=r||0,e.y+=n||0}));const r=t.length||1;return{x:e.x/r,y:e.y/r}},Te=(t,e)=>e.map((e=>{const{id:r,data:n}=e,o=t.getNode(r);return Object.assign(Object.assign({},o),{data:Object.assign(Object.assign({},o.data),{x:n.x,y:n.y,z:n.z})})}));var Le=r(8917);Le.y3,Le.jy,Le.oN,Le.Hc,Le.cg,Le.hj,Le.LU,Le.Tb;const Fe=Le.uq,qe=(Le.Zm,Le.Dq,Le.__,Le.q0,Le.lh,Le.pI,Le.zC,Le.zg,Le.g6,Le.OL,Le.ks,Le.QR,Le.jp,Le.mk,Le.W2),Ve=(Le.l,Le.KY,Le.dv,Le.BR,Le.Wu,Le.uq,Le.uq,Le.a4,Le.DI,Le.Jo,Le.Zi,Le.kH,Le.LV,t=>{const e=[],r=t.length;for(let n=0;n<r;n+=1){e[n]=[];for(let o=0;o<r;o+=1)n===o?e[n][o]=0:0!==t[n][o]&&t[n][o]?e[n][o]=t[n][o]:e[n][o]=1/0}for(let t=0;t<r;t+=1)for(let n=0;n<r;n+=1)for(let o=0;o<r;o+=1)e[n][o]>e[n][t]+e[t][o]&&(e[n][o]=e[n][t]+e[t][o]);return e}),Ue=(t,e)=>{const{nodes:r,edges:n}=t,o=[],i={};if(!r)throw new Error("invalid nodes data!");return r&&r.forEach(((t,e)=>{i[t.id]=e,o.push([])})),null==n||n.forEach((t=>{const{source:r,target:n}=t,s=i[r],a=i[n];void 0!==s&&void 0!==a&&(o[s][a]=1,e||(o[a][s]=1))})),o},Be=(t,e)=>{const r=[];return t.forEach((t=>{const n=[];t.forEach((t=>{n.push(t*e)})),r.push(n)})),r},$e=t=>{let e=1/0,r=1/0,n=-1/0,o=-1/0;return t.forEach((t=>{let i=t.data.size;he(i)?1===i.length&&(i=[i[0],i[0]]):p(i)?i=[i,i]:(void 0===i||isNaN(i))&&(i=[30,30]);const s=[i[0]/2,i[1]/2],a=t.data.x-s[0],u=t.data.x+s[0],h=t.data.y-s[1],d=t.data.y+s[1];e>a&&(e=a),r>h&&(r=h),n<u&&(n=u),o<d&&(o=d)})),{minX:e,minY:r,maxX:n,maxY:o}},Ge=(t,e)=>Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)),We=(t,e,r,n="TB",o,i={})=>{if(!(null==e?void 0:e.length))return;const{stopBranchFn:s,stopAllFn:a}=i;for(let u=0;u<e.length;u++){const h=e[u];if(t.hasNode(h.id)&&!(null==s?void 0:s(h))){if(null==a?void 0:a(h))return;"TB"===n&&r(h),We(t,t.getChildren(h.id,o),r,n,o,i),"TB"!==n&&r(h)}}},Ke={center:[0,0],linkDistance:50};class Ye{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},Ke),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericMDSLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericMDSLayout(!0,t,r)}))}genericMDSLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{center:o=[0,0],linkDistance:i=50}=e,s=r.getAllNodes(),a=r.getAllEdges();if(!(null==s?void 0:s.length)||1===s.length)return ne(r,t,o);const u=Ue({nodes:s,edges:a},!1),h=Ve(u);Je(h);const d=Be(h,i),c=He(d),l=[];return c.forEach(((t,e)=>{const r=Zt(s[e]);r.data.x=t[0]+o[0],r.data.y=t[1]+o[1],l.push(r)})),t&&l.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:l,edges:a}}))}}const Je=t=>{let e=-999999;t.forEach((t=>{t.forEach((t=>{t!==1/0&&e<t&&(e=t)}))})),t.forEach(((r,n)=>{r.forEach(((r,o)=>{r===1/0&&(t[n][o]=e)}))}))},He=t=>{const e=Fe.mul(Fe.pow(t,2),-.5),r=e.mean("row"),n=e.mean("column"),o=e.mean();e.add(o).subRowVector(r).subColumnVector(n);const i=new qe(e),s=Fe.sqrt(i.diagonalMatrix).diagonal();return i.leftSingularVectors.toJSON().map((t=>Fe.mul([t],[s]).toJSON()[0].splice(0,2)))},Xe={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},Qe={center:[0,0],comboPadding:10,treeKey:"combo"};class Ze{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},Qe),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericComboCombinedLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericComboCombinedLayout(!0,t,r)}))}genericComboCombinedLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:o,treeKey:i,outerLayout:s}=e,a=r.getAllNodes().filter((t=>!t.data._isCombo)),u=r.getAllNodes().filter((t=>t.data._isCombo)),h=r.getAllEdges(),d=null==a?void 0:a.length;if(!d||1===d)return ne(r,t,o);const c=[],f=new Map;a.forEach((t=>{f.set(t.id,t)}));const g=new Map;u.forEach((t=>{g.set(t.id,t)}));const p=new Map,v=this.getInnerGraphs(r,i,f,g,h,e,p);yield Promise.all(v);const m=new Map,y=[],w=new Map;let x=!0;r.getRoots(i).forEach((t=>{const e=p.get(t.id),n=g.get(t.id)||f.get(t.id),o={id:t.id,data:Object.assign(Object.assign({},t.data),{x:e.data.x||n.data.x,y:e.data.y||n.data.y,fx:e.data.fx||n.data.fx,fy:e.data.fy||n.data.fy,mass:e.data.mass||n.data.mass,size:e.data.size})};y.push(o),m.set(t.id,!0),isNaN(o.data.x)||0===o.data.x||isNaN(o.data.y)||0===o.data.y?(o.data.x=100*Math.random(),o.data.y=100*Math.random()):x=!1,We(r,[t],(e=>{e.id!==t.id&&w.set(e.id,t.id)}),"TB",i)}));const b=[];let E;if(h.forEach((t=>{const e=w.get(t.source)||t.source,r=w.get(t.target)||t.target;e!==r&&m.has(e)&&m.has(r)&&b.push({id:t.id,source:e,target:r,data:{}})})),null==y?void 0:y.length){if(1===y.length)y[0].data.x=o[0],y[0].data.y=o[1];else{const t=new l({nodes:y,edges:b}),e=s||new Re;if(x&&Xe[e.id]){const e=y.length<100?new Ye:new ce;yield e.assign(t)}E=yield e.execute(t,Object.assign({center:o,kg:5,preventOverlap:!0,animate:!1},"force"===e.id?{gravity:1,factor:4,linkDistance:(t,e,r)=>(Math.max(...e.data.size)||32)/2+(Math.max(...r.data.size)||32)/2+200}:{}))}p.forEach((t=>{var e;const r=E.nodes.find((e=>e.id===t.id));if(r){const{x:e,y:n}=r.data;t.data.visited=!0,t.data.x=e,t.data.y=n,c.push({id:t.id,data:{x:e,y:n}})}const{x:n,y:o}=t.data;null===(e=t.data.nodes)||void 0===e||e.forEach((t=>{c.push({id:t.id,data:{x:t.data.x+n,y:t.data.y+o}})}))})),p.forEach((({data:t})=>{const{x:e,y:r,visited:n,nodes:o}=t;null==o||o.forEach((t=>{if(!n){const n=c.find((e=>e.id===t.id));n.data.x+=e||0,n.data.y+=r||0}}))}))}return t&&c.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),{nodes:c,edges:h}}))}initVals(t){const e=Object.assign({},t),{nodeSize:r,spacing:n,comboPadding:o}=t;let i,s,a;if(s=p(n)?()=>n:Kt(n)?n:()=>0,e.spacing=s,r)if(Kt(r))i=t=>{const e=r(t),n=s(t);return he(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+n)/2:((e||32)+n)/2};else if(he(r)){const t=(r[0]>r[1]?r[0]:r[1])/2;i=e=>t+s(e)/2}else{const t=r/2;i=e=>t+s(e)/2}else i=t=>{const e=s(t);return t.size?he(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+e)/2:Yt(t.size)?((t.size.width>t.size.height?t.size.width:t.size.height)+e)/2:(t.size+e)/2:32+e/2};return e.nodeSize=i,a=p(o)?()=>o:he(o)?()=>Math.max.apply(null,o):Kt(o)?o:()=>0,e.comboPadding=a,e}getInnerGraphs(t,r,n,o,i,s,a){const{nodeSize:u,comboPadding:h,spacing:d,innerLayout:c}=s,f=c||new ce({}),g={center:[0,0],preventOverlap:!0,nodeSpacing:d},v=[],m=t=>{let e=(null==h?void 0:h(t))||10;return he(e)&&(e=Math.max(...e)),{size:e?[2*e,2*e]:[30,30],padding:e}};return t.getRoots(r).forEach((s=>{a.set(s.id,{id:s.id,data:{nodes:[],size:m(s).size}});let h=Promise.resolve();We(t,[s],(s=>{var d;if(!s.data._isCombo)return;const{size:c,padding:v}=m(s);if(null===(d=t.getChildren(s.id,r))||void 0===d?void 0:d.length){const d=a.get(s.id);a.set(s.id,{id:s.id,data:Object.assign({nodes:[]},null==d?void 0:d.data)});const c=new Map,m=t.getChildren(s.id,r).map((t=>{if(t.data._isCombo)return a.has(t.id)||a.set(t.id,{id:t.id,data:Object.assign({},t.data)}),c.set(t.id,!0),a.get(t.id);const e=n.get(t.id)||o.get(t.id);return c.set(t.id,!0),{id:t.id,data:Object.assign(Object.assign({},e.data),t.data)}})),y={nodes:m,edges:i.filter((t=>c.has(t.source)&&c.has(t.target)))};let w=1/0;m.forEach((t=>{var e;let{size:r}=t.data;r||(r=(null===(e=a.get(t.id))||void 0===e?void 0:e.data.size)||(null==u?void 0:u(t))||[30,30]),p(r)&&(r=[r,r]);const[n,o]=r;w>n&&(w=n),w>o&&(w=o),t.data.size=r})),h=h.then((()=>e(this,void 0,void 0,(function*(){const t=new l(y),e=yield f.assign(t,g),{minX:r,minY:n,maxX:o,maxY:i}=$e(m),u=(o+r)/2,h=(i+n)/2;y.nodes.forEach((t=>{t.data.x-=u,t.data.y-=h}));const d=[Math.max(o-r,w)+2*v,Math.max(i-n,w)+2*v];return a.get(s.id).data.size=d,a.get(s.id).data.nodes=m,e}))))}else a.set(s.id,{id:s.id,data:Object.assign(Object.assign({},s.data),{size:c})});return!0}),"BT",r),v.push(h)})),v}}const tr=function(t){if(!function(t){return"object"==typeof t&&null!==t}(t)||!g(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};function er(t,e){if(Object.hasOwn)return Object.hasOwn(t,e);if(null==t)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(t),e)}function rr(t,e,r,n){for(var o in r=r||0,n=n||5,e)if(er(e,o)){var i=e[o];null!==i&&tr(i)?(tr(t[o])||(t[o]={}),r<n?rr(t[o],i,r+1,n):t[o]=e[o]):V(i)?(t[o]=[],t[o]=t[o].concat(i)):void 0!==i&&(t[o]=i)}}var nr=Object.prototype.hasOwnProperty;const or=function(t,e){if(null===t||!tr(t))return{};var r={};return function(t,e){if(t)if(V(t))for(var r=0,n=t.length;r<n&&!1!==e(t[r],r);r++);else if(Yt(t))for(var o in t)if(t.hasOwnProperty(o)&&!1===e(t[o],o))break}(e,(function(e){nr.call(t,e)&&(r[e]=t[e])})),r};function ir(t){return function(){return t}}function sr(t){return 1e-6*(t()-.5)}function ar(t){return t.index}function ur(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function hr(t){var e,r,n,o,i,s,a=ar,u=function(t){return 1/Math.min(o[t.source.index],o[t.target.index])},h=ir(30),d=1;function c(n){for(var o=0,a=t.length;o<d;++o)for(var u,h,c,l,f,g,p,v=0;v<a;++v)h=(u=t[v]).source,l=(c=u.target).x+c.vx-h.x-h.vx||sr(s),f=c.y+c.vy-h.y-h.vy||sr(s),l*=g=((g=Math.sqrt(l*l+f*f))-r[v])/g*n*e[v],f*=g,c.vx-=l*(p=i[v]),c.vy-=f*p,h.vx+=l*(p=1-p),h.vy+=f*p}function l(){if(n){var s,u,h=n.length,d=t.length,c=new Map(n.map(((t,e)=>[a(t,e,n),t])));for(s=0,o=new Array(h);s<d;++s)(u=t[s]).index=s,"object"!=typeof u.source&&(u.source=ur(c,u.source)),"object"!=typeof u.target&&(u.target=ur(c,u.target)),o[u.source.index]=(o[u.source.index]||0)+1,o[u.target.index]=(o[u.target.index]||0)+1;for(s=0,i=new Array(d);s<d;++s)u=t[s],i[s]=o[u.source.index]/(o[u.source.index]+o[u.target.index]);e=new Array(d),f(),r=new Array(d),g()}}function f(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+u(t[r],r,t)}function g(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+h(t[e],e,t)}return null==t&&(t=[]),c.initialize=function(t,e){n=t,s=e,l()},c.links=function(e){return arguments.length?(t=e,l(),c):t},c.id=function(t){return arguments.length?(a=t,c):a},c.iterations=function(t){return arguments.length?(d=+t,c):d},c.strength=function(t){return arguments.length?(u="function"==typeof t?t:ir(+t),f(),c):u},c.distance=function(t){return arguments.length?(h="function"==typeof t?t:ir(+t),g(),c):h},c}var dr={value:()=>{}};function cr(){for(var t,e=0,r=arguments.length,n={};e<r;++e){if(!(t=arguments[e]+"")||t in n||/[\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new lr(n)}function lr(t){this._=t}function fr(t,e){for(var r,n=0,o=t.length;n<o;++n)if((r=t[n]).name===e)return r.value}function gr(t,e,r){for(var n=0,o=t.length;n<o;++n)if(t[n].name===e){t[n]=dr,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}lr.prototype=cr.prototype={constructor:lr,on:function(t,e){var r,n,o=this._,i=(n=o,(t+"").trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),s=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++s<a;)if(r=(t=i[s]).type)o[r]=gr(o[r],t.name,e);else if(null==e)for(r in o)o[r]=gr(o[r],t.name,null);return this}for(;++s<a;)if((r=(t=i[s]).type)&&(r=fr(o[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new lr(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,o=new Array(r),i=0;i<r;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,r=(n=this._[t]).length;i<r;++i)n[i].value.apply(e,o)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],o=0,i=n.length;o<i;++o)n[o].value.apply(e,r)}};const pr=cr;var vr,mr,yr=0,wr=0,xr=0,br=1e3,Er=0,Nr=0,Mr=0,_r="object"==typeof performance&&performance.now?performance:Date,kr="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Ar(){return Nr||(kr(jr),Nr=_r.now()+Mr)}function jr(){Nr=0}function Sr(){this._call=this._time=this._next=null}function Or(t,e,r){var n=new Sr;return n.restart(t,e,r),n}function zr(){Nr=(Er=_r.now())+Mr,yr=wr=0;try{!function(){Ar(),++yr;for(var t,e=vr;e;)(t=Nr-e._time)>=0&&e._call.call(void 0,t),e=e._next;--yr}()}finally{yr=0,function(){for(var t,e,r=vr,n=1/0;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:vr=e);mr=t,Ir(n)}(),Nr=0}}function Rr(){var t=_r.now(),e=t-Er;e>br&&(Mr-=e,Er=t)}function Ir(t){yr||(wr&&(wr=clearTimeout(wr)),t-Nr>24?(t<1/0&&(wr=setTimeout(zr,t-_r.now()-Mr)),xr&&(xr=clearInterval(xr))):(xr||(Er=_r.now(),xr=setInterval(Rr,br)),yr=1,kr(zr)))}Sr.prototype=Or.prototype={constructor:Sr,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?Ar():+r)+(null==e?0:+e),this._next||mr===this||(mr?mr._next=this:vr=this,mr=this),this._call=t,this._time=r,Ir()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ir())}};const Cr=4294967296;function Dr(t){return t.x}function Pr(t){return t.y}var Tr=Math.PI*(3-Math.sqrt(5));function Lr(){var t,e,r,n,o,i=ir(-30),s=1,a=1/0,u=.81;function h(r){var o,i=t.length,s=ve(t,Dr,Pr).visitAfter(c);for(n=r,o=0;o<i;++o)e=t[o],s.visit(l)}function d(){if(t){var e,r,n=t.length;for(o=new Array(n),e=0;e<n;++e)r=t[e],o[r.index]=+i(r,e,t)}}function c(t){var e,r,n,i,s,a=0,u=0;if(t.length){for(n=i=s=0;s<4;++s)(e=t[s])&&(r=Math.abs(e.value))&&(a+=e.value,u+=r,n+=r*e.x,i+=r*e.y);t.x=n/u,t.y=i/u}else{(e=t).x=e.data.x,e.y=e.data.y;do{a+=o[e.data.index]}while(e=e.next)}t.value=a}function l(t,i,h,d){if(!t.value)return!0;var c=t.x-e.x,l=t.y-e.y,f=d-i,g=c*c+l*l;if(f*f/u<g)return g<a&&(0===c&&(g+=(c=sr(r))*c),0===l&&(g+=(l=sr(r))*l),g<s&&(g=Math.sqrt(s*g)),e.vx+=c*t.value*n/g,e.vy+=l*t.value*n/g),!0;if(!(t.length||g>=a)){(t.data!==e||t.next)&&(0===c&&(g+=(c=sr(r))*c),0===l&&(g+=(l=sr(r))*l),g<s&&(g=Math.sqrt(s*g)));do{t.data!==e&&(f=o[t.data.index]*n/g,e.vx+=c*f,e.vy+=l*f)}while(t=t.next)}}return h.initialize=function(e,n){t=e,r=n,d()},h.strength=function(t){return arguments.length?(i="function"==typeof t?t:ir(+t),d(),h):i},h.distanceMin=function(t){return arguments.length?(s=t*t,h):Math.sqrt(s)},h.distanceMax=function(t){return arguments.length?(a=t*t,h):Math.sqrt(a)},h.theta=function(t){return arguments.length?(u=t*t,h):Math.sqrt(u)},h}function Fr(t,e){var r,n=1;function o(){var o,i,s=r.length,a=0,u=0;for(o=0;o<s;++o)a+=(i=r[o]).x,u+=i.y;for(a=(a/s-t)*n,u=(u/s-e)*n,o=0;o<s;++o)(i=r[o]).x-=a,i.y-=u}return null==t&&(t=0),null==e&&(e=0),o.initialize=function(t){r=t},o.x=function(e){return arguments.length?(t=+e,o):t},o.y=function(t){return arguments.length?(e=+t,o):e},o.strength=function(t){return arguments.length?(n=+t,o):n},o}function qr(t){return t.x+t.vx}function Vr(t){return t.y+t.vy}function Ur(t){var e,r,n,o=1,i=1;function s(){for(var t,s,u,h,d,c,l,f=e.length,g=0;g<i;++g)for(s=ve(e,qr,Vr).visitAfter(a),t=0;t<f;++t)u=e[t],c=r[u.index],l=c*c,h=u.x+u.vx,d=u.y+u.vy,s.visit(p);function p(t,e,r,i,s){var a=t.data,f=t.r,g=c+f;if(!a)return e>h+g||i<h-g||r>d+g||s<d-g;if(a.index>u.index){var p=h-a.x-a.vx,v=d-a.y-a.vy,m=p*p+v*v;m<g*g&&(0===p&&(m+=(p=sr(n))*p),0===v&&(m+=(v=sr(n))*v),m=(g-(m=Math.sqrt(m)))/m*o,u.vx+=(p*=m)*(g=(f*=f)/(l+f)),u.vy+=(v*=m)*g,a.vx-=p*(g=1-g),a.vy-=v*g)}}}function a(t){if(t.data)return t.r=r[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function u(){if(e){var n,o,i=e.length;for(r=new Array(i),n=0;n<i;++n)o=e[n],r[o.index]=+t(o,n,e)}}return"function"!=typeof t&&(t=ir(null==t?1:+t)),s.initialize=function(t,r){e=t,n=r,u()},s.iterations=function(t){return arguments.length?(i=+t,s):i},s.strength=function(t){return arguments.length?(o=+t,s):o},s.radius=function(e){return arguments.length?(t="function"==typeof e?e:ir(+e),u(),s):t},s}function Br(t,e,r){var n,o,i,s=ir(.1);function a(t){for(var s=0,a=n.length;s<a;++s){var u=n[s],h=u.x-e||1e-6,d=u.y-r||1e-6,c=Math.sqrt(h*h+d*d),l=(i[s]-c)*o[s]*t/c;u.vx+=h*l,u.vy+=d*l}}function u(){if(n){var e,r=n.length;for(o=new Array(r),i=new Array(r),e=0;e<r;++e)i[e]=+t(n[e],e,n),o[e]=isNaN(i[e])?0:+s(n[e],e,n)}}return"function"!=typeof t&&(t=ir(+t)),null==e&&(e=0),null==r&&(r=0),a.initialize=function(t){n=t,u()},a.strength=function(t){return arguments.length?(s="function"==typeof t?t:ir(+t),u(),a):s},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:ir(+e),u(),a):t},a.x=function(t){return arguments.length?(e=+t,a):e},a.y=function(t){return arguments.length?(r=+t,a):r},a}function $r(t){var e,r,n,o=ir(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=ir(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:ir(+t),s(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:ir(+e),s(),i):t},i}function Gr(t){var e,r,n,o=ir(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=ir(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:ir(+t),s(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:ir(+e),s(),i):t},i}class Wr{constructor(e={}){this.id="d3-force",this.config={inputNodeAttrs:["x","y","vx","vy","fx","fy"],outputNodeAttrs:["x","y","vx","vy"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource"]},this.forceMap={link:hr,manyBody:Lr,center:Fr,collide:Ur,radial:Br,x:$r,y:Gr},this.options={link:{id:t=>t.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]};const{forceSimulation:r}=e,n=t(e,["forceSimulation"]);(function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var n=0;n<e.length;n+=1)rr(t,e[n])})(this.options,n),r&&(this.simulation=r)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericLayout(!0,t,r)}))}stop(){this.simulation.stop()}tick(t){return this.simulation.tick(t),this.getResult()}restart(){this.simulation.restart()}getOptions(t){var e,r;const n=Object.assign(Object.assign({},this.options),t);return void 0===(null===(e=n.collide)||void 0===e?void 0:e.radius)&&(n.collide=n.collide||{},n.collide.radius=null!==(r=n.nodeSize)&&void 0!==r?r:10),void 0===n.iterations&&(n.link&&void 0===n.link.iterations&&(n.iterations=n.link.iterations),n.collide&&void 0===n.collide.iterations&&(n.iterations=n.collide.iterations)),this.context.options=n,n}genericLayout(t,r,n){var o;return e(this,void 0,void 0,(function*(){const e=this.getOptions(n),i=r.getAllNodes().map((({id:t,data:e})=>Object.assign({id:t,data:e},or(e,this.config.inputNodeAttrs)))),s=r.getAllEdges().map((t=>Object.assign({},t)));Object.assign(this.context,{assign:t,nodes:i,edges:s,graph:r});const a=new Promise((t=>{this.resolver=t})),u=this.setSimulation(e);return u.nodes(i),null===(o=u.force("link"))||void 0===o||o.links(s),a}))}getResult(){const{assign:t,nodes:e,edges:r,graph:n}=this.context,o=e.map((t=>({id:t.id,data:Object.assign(Object.assign({},t.data),or(t,this.config.outputNodeAttrs))}))),i=r.map((({id:t,source:e,target:r,data:n})=>({id:t,source:"object"==typeof e?e.id:e,target:"object"==typeof r?r.id:r,data:n})));return t&&o.forEach((t=>n.mergeNodeData(t.id,t.data))),{nodes:o,edges:i}}initSimulation(){return function(t){var e,r=1,n=.001,o=1-Math.pow(n,1/300),i=0,s=.6,a=new Map,u=Or(c),h=pr("tick","end"),d=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Cr)/Cr}();function c(){l(),h.call("tick",e),r<n&&(u.stop(),h.call("end",e))}function l(n){var u,h,d=t.length;void 0===n&&(n=1);for(var c=0;c<n;++c)for(r+=(i-r)*o,a.forEach((function(t){t(r)})),u=0;u<d;++u)null==(h=t[u]).fx?h.x+=h.vx*=s:(h.x=h.fx,h.vx=0),null==h.fy?h.y+=h.vy*=s:(h.y=h.fy,h.vy=0);return e}function f(){for(var e,r=0,n=t.length;r<n;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var o=10*Math.sqrt(.5+r),i=r*Tr;e.x=o*Math.cos(i),e.y=o*Math.sin(i)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function g(e){return e.initialize&&e.initialize(t,d),e}return null==t&&(t=[]),f(),e={tick:l,restart:function(){return u.restart(c),e},stop:function(){return u.stop(),e},nodes:function(r){return arguments.length?(t=r,f(),a.forEach(g),e):t},alpha:function(t){return arguments.length?(r=+t,e):r},alphaMin:function(t){return arguments.length?(n=+t,e):n},alphaDecay:function(t){return arguments.length?(o=+t,e):+o},alphaTarget:function(t){return arguments.length?(i=+t,e):i},velocityDecay:function(t){return arguments.length?(s=1-t,e):1-s},randomSource:function(t){return arguments.length?(d=t,a.forEach(g),e):d},force:function(t,r){return arguments.length>1?(null==r?a.delete(t):a.set(t,g(r)),e):a.get(t)},find:function(e,r,n){var o,i,s,a,u,h=0,d=t.length;for(null==n?n=1/0:n*=n,h=0;h<d;++h)(s=(o=e-(a=t[h]).x)*o+(i=r-a.y)*i)<n&&(u=a,n=s);return u},on:function(t,r){return arguments.length>1?(h.on(t,r),e):h.on(t)}}}()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",(()=>{var e;return null===(e=t.onTick)||void 0===e?void 0:e.call(t,this.getResult())})).on("end",(()=>{var t;return null===(t=this.resolver)||void 0===t?void 0:t.call(this,this.getResult())}))),Kr(e,this.config.simulationAttrs.map((e=>[e,t[e]]))),Object.entries(this.forceMap).forEach((([r,n])=>{const o=r;if(r in t){let r=e.force(o);r||(r=n(),e.force(o,r)),Kr(r,Object.entries(t[o]))}else e.force(o,null)})),e}}const Kr=(t,e)=>e.reduce(((e,[r,n])=>e[r]&&void 0!==n?e[r].call(t,n):e),t);function Yr(t){return function(){return t}}function Jr(t){return 1e-6*(t()-.5)}function Hr(t){return t.index}function Xr(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function Qr(t){var e,r,n,o,i,s,a,u=Hr,h=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},d=Yr(30),c=1;function l(n){for(var i=0,u=t.length;i<c;++i)for(var h,d,l,f,g,p=0,v=0,m=0,y=0;p<u;++p)d=(h=t[p]).source,v=(l=h.target).x+l.vx-d.x-d.vx||Jr(a),o>1&&(m=l.y+l.vy-d.y-d.vy||Jr(a)),o>2&&(y=l.z+l.vz-d.z-d.vz||Jr(a)),v*=f=((f=Math.sqrt(v*v+m*m+y*y))-r[p])/f*n*e[p],m*=f,y*=f,l.vx-=v*(g=s[p]),o>1&&(l.vy-=m*g),o>2&&(l.vz-=y*g),d.vx+=v*(g=1-g),o>1&&(d.vy+=m*g),o>2&&(d.vz+=y*g)}function f(){if(n){var o,a,h=n.length,d=t.length,c=new Map(n.map(((t,e)=>[u(t,e,n),t])));for(o=0,i=new Array(h);o<d;++o)(a=t[o]).index=o,"object"!=typeof a.source&&(a.source=Xr(c,a.source)),"object"!=typeof a.target&&(a.target=Xr(c,a.target)),i[a.source.index]=(i[a.source.index]||0)+1,i[a.target.index]=(i[a.target.index]||0)+1;for(o=0,s=new Array(d);o<d;++o)a=t[o],s[o]=i[a.source.index]/(i[a.source.index]+i[a.target.index]);e=new Array(d),g(),r=new Array(d),p()}}function g(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+h(t[r],r,t)}function p(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+d(t[e],e,t)}return null==t&&(t=[]),l.initialize=function(t,...e){n=t,a=e.find((t=>"function"==typeof t))||Math.random,o=e.find((t=>[1,2,3].includes(t)))||2,f()},l.links=function(e){return arguments.length?(t=e,f(),l):t},l.id=function(t){return arguments.length?(u=t,l):u},l.iterations=function(t){return arguments.length?(c=+t,l):c},l.strength=function(t){return arguments.length?(h="function"==typeof t?t:Yr(+t),g(),l):h},l.distance=function(t){return arguments.length?(d="function"==typeof t?t:Yr(+t),p(),l):d},l}function Zr(t,e,r){if(isNaN(e))return t;var n,o,i,s,a,u,h=t._root,d={data:r},c=t._x0,l=t._x1;if(!h)return t._root=d,t;for(;h.length;)if((s=e>=(o=(c+l)/2))?c=o:l=o,n=h,!(h=h[a=+s]))return n[a]=d,t;if(e===(i=+t._x.call(null,h.data)))return d.next=h,n?n[a]=d:t._root=d,t;do{n=n?n[a]=new Array(2):t._root=new Array(2),(s=e>=(o=(c+l)/2))?c=o:l=o}while((a=+s)==(u=+(i>=o)));return n[u]=h,n[a]=d,t}function tn(t,e,r){this.node=t,this.x0=e,this.x1=r}function en(t){return t[0]}function rn(t,e){var r=new nn(null==e?en:e,NaN,NaN);return null==t?r:r.addAll(t)}function nn(t,e,r){this._x=t,this._x0=e,this._x1=r,this._root=void 0}function on(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var sn=rn.prototype=nn.prototype;sn.copy=function(){var t,e,r=new nn(this._x,this._x0,this._x1),n=this._root;if(!n)return r;if(!n.length)return r._root=on(n),r;for(t=[{source:n,target:r._root=new Array(2)}];n=t.pop();)for(var o=0;o<2;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(2)}):n.target[o]=on(e));return r},sn.add=function(t){const e=+this._x.call(null,t);return Zr(this.cover(e),e,t)},sn.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e);let n=1/0,o=-1/0;for(let i,s=0;s<e;++s)isNaN(i=+this._x.call(null,t[s]))||(r[s]=i,i<n&&(n=i),i>o&&(o=i));if(n>o)return this;this.cover(n).cover(o);for(let n=0;n<e;++n)Zr(this,r[n],t[n]);return this},sn.cover=function(t){if(isNaN(t=+t))return this;var e=this._x0,r=this._x1;if(isNaN(e))r=(e=Math.floor(t))+1;else{for(var n,o,i=r-e||1,s=this._root;e>t||t>=r;)switch(o=+(t<e),(n=new Array(2))[o]=s,s=n,i*=2,o){case 0:r=e+i;break;case 1:e=r-i}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._x1=r,this},sn.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},sn.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},sn.find=function(t,e){var r,n,o,i,s,a=this._x0,u=this._x1,h=[],d=this._root;for(d&&h.push(new tn(d,a,u)),null==e?e=1/0:(a=t-e,u=t+e);i=h.pop();)if(!(!(d=i.node)||(n=i.x0)>u||(o=i.x1)<a))if(d.length){var c=(n+o)/2;h.push(new tn(d[1],c,o),new tn(d[0],n,c)),(s=+(t>=c))&&(i=h[h.length-1],h[h.length-1]=h[h.length-1-s],h[h.length-1-s]=i)}else{var l=Math.abs(t-+this._x.call(null,d.data));l<e&&(e=l,a=t-l,u=t+l,r=d.data)}return r},sn.remove=function(t){if(isNaN(i=+this._x.call(null,t)))return this;var e,r,n,o,i,s,a,u,h,d=this._root,c=this._x0,l=this._x1;if(!d)return this;if(d.length)for(;;){if((a=i>=(s=(c+l)/2))?c=s:l=s,e=d,!(d=d[u=+a]))return this;if(!d.length)break;e[u+1&1]&&(r=e,h=u)}for(;d.data!==t;)if(n=d,!(d=d.next))return this;return(o=d.next)&&delete d.next,n?(o?n.next=o:delete n.next,this):e?(o?e[u]=o:delete e[u],(d=e[0]||e[1])&&d===(e[1]||e[0])&&!d.length&&(r?r[h]=d:this._root=d),this):(this._root=o,this)},sn.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},sn.root=function(){return this._root},sn.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},sn.visit=function(t){var e,r,n,o,i=[],s=this._root;for(s&&i.push(new tn(s,this._x0,this._x1));e=i.pop();)if(!t(s=e.node,n=e.x0,o=e.x1)&&s.length){var a=(n+o)/2;(r=s[1])&&i.push(new tn(r,a,o)),(r=s[0])&&i.push(new tn(r,n,a))}return this},sn.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new tn(this._root,this._x0,this._x1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.x1,u=(s+a)/2;(i=o[0])&&r.push(new tn(i,s,u)),(i=o[1])&&r.push(new tn(i,u,a))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.x1);return this},sn.x=function(t){return arguments.length?(this._x=t,this):this._x};const an=4294967296;function un(t){return t.x}function hn(t){return t.y}function dn(t){return t.z}var cn=Math.PI*(3-Math.sqrt(5)),ln=20*Math.PI/(9+Math.sqrt(221));function fn(){var t,e,r,n,o,i,s=Yr(-30),a=1,u=1/0,h=.81;function d(n){var i,s=t.length,a=(1===e?rn(t,un):2===e?ve(t,un,hn):3===e?_e(t,un,hn,dn):null).visitAfter(l);for(o=n,i=0;i<s;++i)r=t[i],a.visit(f)}function c(){if(t){var e,r,n=t.length;for(i=new Array(n),e=0;e<n;++e)r=t[e],i[r.index]=+s(r,e,t)}}function l(t){var r,n,o,s,a,u,h=0,d=0,c=t.length;if(c){for(o=s=a=u=0;u<c;++u)(r=t[u])&&(n=Math.abs(r.value))&&(h+=r.value,d+=n,o+=n*(r.x||0),s+=n*(r.y||0),a+=n*(r.z||0));h*=Math.sqrt(4/c),t.x=o/d,e>1&&(t.y=s/d),e>2&&(t.z=a/d)}else{(r=t).x=r.data.x,e>1&&(r.y=r.data.y),e>2&&(r.z=r.data.z);do{h+=i[r.data.index]}while(r=r.next)}t.value=h}function f(t,s,d,c,l){if(!t.value)return!0;var f=[d,c,l][e-1],g=t.x-r.x,p=e>1?t.y-r.y:0,v=e>2?t.z-r.z:0,m=f-s,y=g*g+p*p+v*v;if(m*m/h<y)return y<u&&(0===g&&(y+=(g=Jr(n))*g),e>1&&0===p&&(y+=(p=Jr(n))*p),e>2&&0===v&&(y+=(v=Jr(n))*v),y<a&&(y=Math.sqrt(a*y)),r.vx+=g*t.value*o/y,e>1&&(r.vy+=p*t.value*o/y),e>2&&(r.vz+=v*t.value*o/y)),!0;if(!(t.length||y>=u)){(t.data!==r||t.next)&&(0===g&&(y+=(g=Jr(n))*g),e>1&&0===p&&(y+=(p=Jr(n))*p),e>2&&0===v&&(y+=(v=Jr(n))*v),y<a&&(y=Math.sqrt(a*y)));do{t.data!==r&&(m=i[t.data.index]*o/y,r.vx+=g*m,e>1&&(r.vy+=p*m),e>2&&(r.vz+=v*m))}while(t=t.next)}}return d.initialize=function(r,...o){t=r,n=o.find((t=>"function"==typeof t))||Math.random,e=o.find((t=>[1,2,3].includes(t)))||2,c()},d.strength=function(t){return arguments.length?(s="function"==typeof t?t:Yr(+t),c(),d):s},d.distanceMin=function(t){return arguments.length?(a=t*t,d):Math.sqrt(a)},d.distanceMax=function(t){return arguments.length?(u=t*t,d):Math.sqrt(u)},d.theta=function(t){return arguments.length?(h=t*t,d):Math.sqrt(h)},d}function gn(t,e,r){var n,o=1;function i(){var i,s,a=n.length,u=0,h=0,d=0;for(i=0;i<a;++i)u+=(s=n[i]).x||0,h+=s.y||0,d+=s.z||0;for(u=(u/a-t)*o,h=(h/a-e)*o,d=(d/a-r)*o,i=0;i<a;++i)s=n[i],u&&(s.x-=u),h&&(s.y-=h),d&&(s.z-=d)}return null==t&&(t=0),null==e&&(e=0),null==r&&(r=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.z=function(t){return arguments.length?(r=+t,i):r},i.strength=function(t){return arguments.length?(o=+t,i):o},i}function pn(t){return t.x+t.vx}function vn(t){return t.y+t.vy}function mn(t){return t.z+t.vz}function yn(t){var e,r,n,o,i=1,s=1;function a(){for(var t,a,h,d,c,l,f,g,p=e.length,v=0;v<s;++v)for(a=(1===r?rn(e,pn):2===r?ve(e,pn,vn):3===r?_e(e,pn,vn,mn):null).visitAfter(u),t=0;t<p;++t)h=e[t],f=n[h.index],g=f*f,d=h.x+h.vx,r>1&&(c=h.y+h.vy),r>2&&(l=h.z+h.vz),a.visit(m);function m(t,e,n,s,a,u,p){var v=[e,n,s,a,u,p],m=v[0],y=v[1],w=v[2],x=v[r],b=v[r+1],E=v[r+2],N=t.data,M=t.r,_=f+M;if(!N)return m>d+_||x<d-_||r>1&&(y>c+_||b<c-_)||r>2&&(w>l+_||E<l-_);if(N.index>h.index){var k=d-N.x-N.vx,A=r>1?c-N.y-N.vy:0,j=r>2?l-N.z-N.vz:0,S=k*k+A*A+j*j;S<_*_&&(0===k&&(S+=(k=Jr(o))*k),r>1&&0===A&&(S+=(A=Jr(o))*A),r>2&&0===j&&(S+=(j=Jr(o))*j),S=(_-(S=Math.sqrt(S)))/S*i,h.vx+=(k*=S)*(_=(M*=M)/(g+M)),r>1&&(h.vy+=(A*=S)*_),r>2&&(h.vz+=(j*=S)*_),N.vx-=k*(_=1-_),r>1&&(N.vy-=A*_),r>2&&(N.vz-=j*_))}}}function u(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<Math.pow(2,r);++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function h(){if(e){var r,o,i=e.length;for(n=new Array(i),r=0;r<i;++r)o=e[r],n[o.index]=+t(o,r,e)}}return"function"!=typeof t&&(t=Yr(null==t?1:+t)),a.initialize=function(t,...n){e=t,o=n.find((t=>"function"==typeof t))||Math.random,r=n.find((t=>[1,2,3].includes(t)))||2,h()},a.iterations=function(t){return arguments.length?(s=+t,a):s},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:Yr(+e),h(),a):t},a}function wn(t,e,r,n){var o,i,s,a,u=Yr(.1);function h(t){for(var u=0,h=o.length;u<h;++u){var d=o[u],c=d.x-e||1e-6,l=(d.y||0)-r||1e-6,f=(d.z||0)-n||1e-6,g=Math.sqrt(c*c+l*l+f*f),p=(a[u]-g)*s[u]*t/g;d.vx+=c*p,i>1&&(d.vy+=l*p),i>2&&(d.vz+=f*p)}}function d(){if(o){var e,r=o.length;for(s=new Array(r),a=new Array(r),e=0;e<r;++e)a[e]=+t(o[e],e,o),s[e]=isNaN(a[e])?0:+u(o[e],e,o)}}return"function"!=typeof t&&(t=Yr(+t)),null==e&&(e=0),null==r&&(r=0),null==n&&(n=0),h.initialize=function(t,...e){o=t,i=e.find((t=>[1,2,3].includes(t)))||2,d()},h.strength=function(t){return arguments.length?(u="function"==typeof t?t:Yr(+t),d(),h):u},h.radius=function(e){return arguments.length?(t="function"==typeof e?e:Yr(+e),d(),h):t},h.x=function(t){return arguments.length?(e=+t,h):e},h.y=function(t){return arguments.length?(r=+t,h):r},h.z=function(t){return arguments.length?(n=+t,h):n},h}function xn(t){var e,r,n,o=Yr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Yr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Yr(+t),s(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:Yr(+e),s(),i):t},i}function bn(t){var e,r,n,o=Yr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Yr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Yr(+t),s(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:Yr(+e),s(),i):t},i}function En(t){var e,r,n,o=Yr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vz+=(n[i]-o.z)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Yr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Yr(+t),s(),i):o},i.z=function(e){return arguments.length?(t="function"==typeof e?e:Yr(+e),s(),i):t},i}class Nn extends Wr{constructor(){super(...arguments),this.id="d3-force-3d",this.config={inputNodeAttrs:["x","y","z","vx","vy","vz","fx","fy","fz"],outputNodeAttrs:["x","y","z","vx","vy","vz"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource","numDimensions"]},this.forceMap={link:Qr,manyBody:fn,center:gn,collide:yn,radial:wn,x:xn,y:bn,z:En},this.options={numDimensions:3,link:{id:t=>t.id},manyBody:{},center:{x:0,y:0,z:0}}}initSimulation(){return function(t,e){e=e||2;var r,n=Math.min(3,Math.max(1,Math.round(e))),o=1,i=.001,s=1-Math.pow(i,1/300),a=0,u=.6,h=new Map,d=Or(f),c=pr("tick","end"),l=function(){let t=1;return()=>(t=(1664525*t+1013904223)%an)/an}();function f(){g(),c.call("tick",r),o<i&&(d.stop(),c.call("end",r))}function g(e){var i,d,c=t.length;void 0===e&&(e=1);for(var l=0;l<e;++l)for(o+=(a-o)*s,h.forEach((function(t){t(o)})),i=0;i<c;++i)null==(d=t[i]).fx?d.x+=d.vx*=u:(d.x=d.fx,d.vx=0),n>1&&(null==d.fy?d.y+=d.vy*=u:(d.y=d.fy,d.vy=0)),n>2&&(null==d.fz?d.z+=d.vz*=u:(d.z=d.fz,d.vz=0));return r}function p(){for(var e,r=0,o=t.length;r<o;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),null!=e.fz&&(e.z=e.fz),isNaN(e.x)||n>1&&isNaN(e.y)||n>2&&isNaN(e.z)){var i=10*(n>2?Math.cbrt(.5+r):n>1?Math.sqrt(.5+r):r),s=r*cn,a=r*ln;1===n?e.x=i:2===n?(e.x=i*Math.cos(s),e.y=i*Math.sin(s)):(e.x=i*Math.sin(s)*Math.cos(a),e.y=i*Math.cos(s),e.z=i*Math.sin(s)*Math.sin(a))}(isNaN(e.vx)||n>1&&isNaN(e.vy)||n>2&&isNaN(e.vz))&&(e.vx=0,n>1&&(e.vy=0),n>2&&(e.vz=0))}}function v(e){return e.initialize&&e.initialize(t,l,n),e}return null==t&&(t=[]),p(),r={tick:g,restart:function(){return d.restart(f),r},stop:function(){return d.stop(),r},numDimensions:function(t){return arguments.length?(n=Math.min(3,Math.max(1,Math.round(t))),h.forEach(v),r):n},nodes:function(e){return arguments.length?(t=e,p(),h.forEach(v),r):t},alpha:function(t){return arguments.length?(o=+t,r):o},alphaMin:function(t){return arguments.length?(i=+t,r):i},alphaDecay:function(t){return arguments.length?(s=+t,r):+s},alphaTarget:function(t){return arguments.length?(a=+t,r):a},velocityDecay:function(t){return arguments.length?(u=1-t,r):1-u},randomSource:function(t){return arguments.length?(l=t,h.forEach(v),r):l},force:function(t,e){return arguments.length>1?(null==e?h.delete(t):h.set(t,v(e)),r):h.get(t)},find:function(){var e,r,o,i,s,a,u=Array.prototype.slice.call(arguments),h=u.shift()||0,d=(n>1?u.shift():null)||0,c=(n>2?u.shift():null)||0,l=u.shift()||1/0,f=0,g=t.length;for(l*=l,f=0;f<g;++f)(i=(e=h-(s=t[f]).x)*e+(r=d-(s.y||0))*r+(o=c-(s.z||0))*o)<l&&(a=s,l=i);return a},on:function(t,e){return arguments.length>1?(c.on(t,e),r):c.on(t)}}}()}}var Mn=r(4341),_n=r.n(Mn);class kn{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,kn.defaultOptions,t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,t,Object.assign(Object.assign({},this.options),r))}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,t,Object.assign(Object.assign({},this.options),r))}))}genericDagreLayout(r,n,o){return e(this,void 0,void 0,(function*(){const{nodeSize:e}=o,i=new Mn.graphlib.Graph;i.setGraph(o),i.setDefaultEdgeLabel((()=>({}))),[...n.getAllNodes(),...n.getAllEdges()].some((({id:t})=>p(t)))&&console.error("Dagre layout only support string id, it will convert number to string."),n.getAllNodes().forEach((t=>{const{id:r}=t,n=Object.assign({},t.data);if(void 0!==e){const[r,o]=function(t){if(!t)return[0,0,0];if(p(t))return[t,t,t];if(0===t.length)return[0,0,0];const[e,r=e,n=e]=t;return[e,r,n]}(Kt(e)?e(t):e);Object.assign(n,{width:r,height:o})}i.setNode(r.toString(),n)})),n.getAllEdges().forEach((({id:t,source:e,target:r})=>{i.setEdge(e.toString(),r.toString(),{id:t})})),_n().layout(i);const s={nodes:[],edges:[]};return i.nodes().forEach((t=>{const e=i.node(t);s.nodes.push({id:t,data:e}),r&&n.mergeNodeData(t,e)})),i.edges().forEach((e=>{const o=i.edge(e),{id:a}=o,u=t(o,["id"]),{v:h,w:d}=e;s.edges.push({id:a,source:h,target:d,data:u}),r&&n.mergeEdgeData(a,u)})),s}))}}kn.defaultOptions={};class An{constructor(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}distanceTo(t){const e=this.rx-t.rx,r=this.ry-t.ry;return Math.hypot(e,r)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,r=t.ry-this.ry;let n=Math.hypot(e,r);n=n<1e-4?1e-4:n;const o=this.g*(this.degree+1)*(t.degree+1)/n;this.fx+=o*e/n,this.fy+=o*r/n}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,r=(this.rx*this.mass+t.rx*t.mass)/e,n=(this.ry*this.mass+t.ry*t.mass)/e,o=this.degree+t.degree;return new An({rx:r,ry:n,mass:e,degree:o})}}class jn{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const r=this.length/2;return t<=this.xmid+r&&t>=this.xmid-r&&e<=this.ymid+r&&e>=this.ymid-r}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new jn({xmid:t,ymid:e,length:r})}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new jn({xmid:t,ymid:e,length:r})}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new jn({xmid:t,ymid:e,length:r})}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new jn({xmid:t,ymid:e,length:r})}}class Sn{constructor(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}insert(t){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new Sn(this.quad.NW()),this.NE=new Sn(this.quad.NE()),this.SW=new Sn(this.quad.SW()),this.SE=new Sn(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t)):this.body=t}_putBody(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))}_isExternal(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE}updateForce(t){null!=this.body&&t!==this.body&&(this._isExternal()||(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t)))}}const On={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1};class zn{constructor(t={}){this.options=t,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},On),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericForceAtlas2Layout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericForceAtlas2Layout(!0,t,r)}))}genericForceAtlas2Layout(t,r,n){return e(this,void 0,void 0,(function*(){const e=r.getAllEdges(),o=r.getAllNodes(),i=this.formatOptions(n,o.length),{width:s,height:a,prune:u,maxIteration:h,nodeSize:d,center:c}=i;if(!(null==o?void 0:o.length)||1===o.length)return ne(r,t,c);const f=o.map((t=>Zt(t,[s,a]))),g=e.filter((t=>{const{source:e,target:r}=t;return e!==r})),p=new l({nodes:f,edges:g}),v=this.getSizes(p,r,d);if(this.run(p,r,h,v,t,i),u){for(let t=0;t<g.length;t+=1){const{source:e,target:r}=g[t],n=p.getDegree(e),o=p.getDegree(e);if(n<=1){const t=p.getNode(r);p.mergeNodeData(e,{x:t.data.x,y:t.data.y})}else if(o<=1){const t=p.getNode(e);p.mergeNodeData(r,{x:t.data.x,y:t.data.y})}}const e=Object.assign(Object.assign({},i),{prune:!1,barnesHut:!1});this.run(p,r,100,v,t,e)}return{nodes:f,edges:e}}))}getSizes(t,e,r){const n=t.getAllNodes(),o={};for(let t=0;t<n.length;t+=1){const{id:i,data:s}=n[t];if(o[i]=10,p(s.size))o[i]=s.size;else if(he(s.size))isNaN(s.size[0])||(o[i]=Math.max(s.size[0])),isNaN(s.size[1])||(o[i]=Math.max(s.size[1]));else if(Yt(s.size))o[i]=Math.max(s.size.width,s.size.height);else if(Kt(r)){const t=r(e.getNode(i));he(t)?o[i]=Math.max(...t):o[i]=t}else he(r)?o[i]=Math.max(...r):p(r)&&(o[i]=r)}return o}formatOptions(t={},e){const r=Object.assign(Object.assign({},this.options),t),{center:n,width:o,height:i,barnesHut:s,prune:a,maxIteration:u,kr:h,kg:d}=r;return r.width=o||"undefined"==typeof window?o:window.innerWidth,r.height=i||"undefined"==typeof window?i:window.innerHeight,r.center=n||[r.width/2,r.height/2],void 0===s&&e>250&&(r.barnesHut=!0),void 0===a&&e>100&&(r.prune=!0),0!==u||a?0===u&&a&&(r.maxIteration=100,e<=200&&e>100?r.maxIteration=500:e>200&&(r.maxIteration=950)):(r.maxIteration=250,e<=200&&e>100?r.maxIteration=1e3:e>200&&(r.maxIteration=1200)),h||(r.kr=50,e>100&&e<=500?r.kr=20:e>500&&(r.kr=1)),d||(r.kg=20,e>100&&e<=500?r.kg=10:e>500&&(r.kg=1)),r}run(t,e,r,n,o,i){const{kr:s,barnesHut:a,onTick:u}=i,h=t.getAllNodes();let d=0,c=r;const l={},f={},g={};for(let e=0;e<h.length;e+=1){const{data:r,id:n}=h[e];if(l[n]=[0,0],a){const o={id:e,rx:r.x,ry:r.y,mass:1,g:s,degree:t.getDegree(n)};g[n]=new An(o)}}for(;c>0;)d=this.oneStep(t,{iter:c,preventOverlapIters:50,krPrime:100,sg:d,forces:l,preForces:f,bodies:g,sizes:n},i),c--,null==u||u({nodes:h,edges:e.getAllEdges()});return t}oneStep(t,e,r){const{iter:n,preventOverlapIters:o,krPrime:i,sg:s,preForces:a,bodies:u,sizes:h}=e;let{forces:d}=e;const{preventOverlap:c,barnesHut:l}=r,f=t.getAllNodes();for(let t=0;t<f.length;t+=1){const{id:e}=f[t];a[e]=[...d[e]],d[e]=[0,0]}return d=this.getAttrForces(t,n,o,h,d,r),d=l&&(c&&n>o||!c)?this.getOptRepGraForces(t,d,u,r):this.getRepGraForces(t,n,o,d,i,h,r),this.updatePos(t,d,a,s,r)}getAttrForces(t,e,r,n,o,i){const{preventOverlap:s,dissuadeHubs:a,mode:u,prune:h}=i,d=t.getAllEdges();for(let i=0;i<d.length;i+=1){const{source:c,target:l}=d[i],f=t.getNode(c),g=t.getNode(l),p=t.getDegree(c),v=t.getDegree(l);if(h&&(p<=1||v<=1))continue;const m=[g.data.x-f.data.x,g.data.y-f.data.y];let y=Math.hypot(m[0],m[1]);y=y<1e-4?1e-4:y,m[0]=m[0]/y,m[1]=m[1]/y,s&&e<r&&(y=y-n[c]-n[l]);let w=y,x=w;"linlog"===u&&(w=Math.log(1+y),x=w),a&&(w=y/p,x=y/v),s&&e<r&&y<=0?(w=0,x=0):s&&e<r&&y>0&&(w=y,x=y),o[c][0]+=w*m[0],o[l][0]-=x*m[0],o[c][1]+=w*m[1],o[l][1]-=x*m[1]}return o}getOptRepGraForces(t,e,r,n){const{kg:o,center:i,prune:s}=n,a=t.getAllNodes(),u=a.length;let h=9e10,d=-9e10,c=9e10,l=-9e10;for(let e=0;e<u;e+=1){const{id:n,data:o}=a[e];s&&t.getDegree(n)<=1||(r[n].setPos(o.x,o.y),o.x>=d&&(d=o.x),o.x<=h&&(h=o.x),o.y>=l&&(l=o.y),o.y<=c&&(c=o.y))}const f=Math.max(d-h,l-c),g=new jn({xmid:(d+h)/2,ymid:(l+c)/2,length:f,massCenter:i,mass:u}),p=new Sn(g);for(let e=0;e<u;e+=1){const{id:n}=a[e];s&&t.getDegree(n)<=1||r[n].in(g)&&p.insert(r[n])}for(let n=0;n<u;n+=1){const{id:u,data:h}=a[n],d=t.getDegree(u);if(s&&d<=1)continue;r[u].resetForce(),p.updateForce(r[u]),e[u][0]-=r[u].fx,e[u][1]-=r[u].fy;const c=[h.x-i[0],h.y-i[1]];let l=Math.hypot(c[0],c[1]);l=l<1e-4?1e-4:l,c[0]=c[0]/l,c[1]=c[1]/l;const f=o*(d+1);e[u][0]-=f*c[0],e[u][1]-=f*c[1]}return e}getRepGraForces(t,e,r,n,o,i,s){const{preventOverlap:a,kr:u,kg:h,center:d,prune:c}=s,l=t.getAllNodes(),f=l.length;for(let s=0;s<f;s+=1){const g=l[s],p=t.getDegree(g.id);for(let h=s+1;h<f;h+=1){const s=l[h],d=t.getDegree(s.id);if(c&&(p<=1||d<=1))continue;const f=[s.data.x-g.data.x,s.data.y-g.data.y];let v=Math.hypot(f[0],f[1]);v=v<1e-4?1e-4:v,f[0]=f[0]/v,f[1]=f[1]/v,a&&e<r&&(v=v-i[g.id]-i[s.id]);let m=u*(p+1)*(d+1)/v;a&&e<r&&v<0?m=o*(p+1)*(d+1):a&&e<r&&0===v?m=0:a&&e<r&&v>0&&(m=u*(p+1)*(d+1)/v),n[g.id][0]-=m*f[0],n[s.id][0]+=m*f[0],n[g.id][1]-=m*f[1],n[s.id][1]+=m*f[1]}const v=[g.data.x-d[0],g.data.y-d[1]],m=Math.hypot(v[0],v[1]);v[0]=v[0]/m,v[1]=v[1]/m;const y=h*(p+1);n[g.id][0]-=y*v[0],n[g.id][1]-=y*v[1]}return n}updatePos(t,e,r,n,o){const{ks:i,tao:s,prune:a,ksmax:u}=o,h=t.getAllNodes(),d=h.length,c=[],l=[];let f=0,g=0,v=n;for(let n=0;n<d;n+=1){const{id:o}=h[n],i=t.getDegree(o);if(a&&i<=1)continue;const s=[e[o][0]-r[o][0],e[o][1]-r[o][1]],u=Math.hypot(s[0],s[1]),d=[e[o][0]+r[o][0],e[o][1]+r[o][1]],p=Math.hypot(d[0],d[1]);c[n]=u,l[n]=p/2,f+=(i+1)*c[n],g+=(i+1)*l[n]}const m=v;v=s*g/f,0!==m&&(v=v>1.5*m?1.5*m:v);for(let r=0;r<d;r+=1){const{id:n,data:o}=h[r],s=t.getDegree(n);if(a&&s<=1)continue;if(p(o.fx)&&p(o.fy))continue;let d=i*v/(1+v*Math.sqrt(c[r])),l=Math.hypot(e[n][0],e[n][1]);l=l<1e-4?1e-4:l;const f=u/l;d=d>f?f:d;const g=d*e[n][0],m=d*e[n][1];t.mergeNodeData(n,{x:o.x+g,y:o.y+m})}return v}}const Rn={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"};class In{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},Rn),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericFruchtermanLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericFruchtermanLayout(!0,t,r)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;e<t;e++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericFruchtermanLayout(t,r,n){return e(this,void 0,void 0,(function*(){if(this.running)return;const e=this.formatOptions(n),{dimensions:o,width:i,height:s,center:a,clustering:u,nodeClusterBy:h,maxIteration:d,onTick:c}=e,f=r.getAllNodes(),g=r.getAllEdges();if(!(null==f?void 0:f.length)){const t={nodes:[],edges:g};return this.lastResult=t,t}if(1===f.length){t&&r.mergeNodeData(f[0].id,{x:a[0],y:a[1],z:3===o?a[2]:void 0});const e={nodes:[Object.assign(Object.assign({},f[0]),{data:Object.assign(Object.assign({},f[0].data),{x:a[0],y:a[1],z:3===o?a[2]:void 0})})],edges:g};return this.lastResult=e,e}const p=f.map((t=>Zt(t,[i,s]))),v=new l({nodes:p,edges:g}),m={};if(u&&p.forEach((t=>{const e=t.data[h];m[e]||(m[e]={name:e,cx:0,cy:0,count:0})})),this.lastLayoutNodes=p,this.lastLayoutEdges=g,this.lastAssign=t,this.lastGraph=v,this.lastOptions=e,this.lastClusterMap=m,"undefined"==typeof window)return;let y=0;return new Promise((n=>{this.timeInterval=window.setInterval((()=>{this.running?(this.runOneStep(v,m,e),t&&p.forEach((({id:t,data:e})=>r.mergeNodeData(t,{x:e.x,y:e.y,z:3===o?e.z:void 0}))),null==c||c({nodes:p,edges:g}),y++,y>=d&&(window.clearInterval(this.timeInterval),n({nodes:p,edges:g}))):n({nodes:p,edges:g})}),0),this.running=!0}))}))}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:r,nodeClusterBy:n}=e,{center:o,width:i,height:s}=e;return e.width=i||"undefined"==typeof window?i:window.innerWidth,e.height=s||"undefined"==typeof window?s:window.innerHeight,e.center=o||[e.width/2,e.height/2],e.clustering=r&&!!n,e}runOneStep(t,e,r){const{dimensions:n,height:o,width:i,gravity:s,center:a,speed:u,clustering:h,nodeClusterBy:d,clusterGravity:c}=r,l=o*i,f=Math.sqrt(l)/10,g=t.getAllNodes(),v=l/(g.length+1),m=Math.sqrt(v),y={};if(this.applyCalculate(t,y,m,v),h){for(const t in e)e[t].cx=0,e[t].cy=0,e[t].count=0;g.forEach((t=>{const{data:r}=t,n=e[r[d]];p(r.x)&&(n.cx+=r.x),p(r.y)&&(n.cy+=r.y),n.count++}));for(const t in e)e[t].cx/=e[t].count,e[t].cy/=e[t].count;const t=c||s;g.forEach(((r,n)=>{const{id:o,data:i}=r;if(!p(i.x)||!p(i.y))return;const s=e[i[d]],a=Math.sqrt((i.x-s.cx)*(i.x-s.cx)+(i.y-s.cy)*(i.y-s.cy)),u=m*t;y[o].x-=u*(i.x-s.cx)/a,y[o].y-=u*(i.y-s.cy)/a}))}g.forEach(((t,e)=>{const{id:r,data:o}=t;if(!p(o.x)||!p(o.y))return;const i=.01*m*s;y[r].x-=i*(o.x-a[0]),y[r].y-=i*(o.y-a[1]),3===n&&(y[r].z-=i*(o.z-a[2]))})),g.forEach(((e,r)=>{const{id:o,data:i}=e;if(p(i.fx)&&p(i.fy))return i.x=i.fx,i.y=i.fy,void(3===n&&(i.z=i.fz));if(!p(i.x)||!p(i.y))return;const s=Math.sqrt(y[o].x*y[o].x+y[o].y*y[o].y+(3===n?y[o].z*y[o].z:0));if(s>0){const e=Math.min(f*(u/800),s);t.mergeNodeData(o,{x:i.x+y[o].x/s*e,y:i.y+y[o].y/s*e,z:3===n?i.z+y[o].z/s*e:void 0})}}))}applyCalculate(t,e,r,n){this.calRepulsive(t,e,n),this.calAttractive(t,e,r)}calRepulsive(t,e,r){const n=t.getAllNodes();n.forEach((({data:t,id:o},i)=>{e[o]={x:0,y:0,z:0},n.forEach((({data:n,id:s},a)=>{if(i<=a||!p(t.x)||!p(n.x)||!p(t.y)||!p(n.y))return;let u=t.x-n.x,h=t.y-n.y,d=3===this.options.dimensions?t.z-n.z:0,c=u*u+h*h+d*d;0===c&&(c=1,u=.01,h=.01,d=.01);const l=r/c,f=u*l,g=h*l,v=d*l;e[o].x+=f,e[o].y+=g,e[s].x-=f,e[s].y-=g,3===this.options.dimensions&&(e[o].z+=v,e[s].z-=v)}))}))}calAttractive(t,e,r){t.getAllEdges().forEach((n=>{const{source:o,target:i}=n;if(!o||!i||o===i)return;const{data:s}=t.getNode(o),{data:a}=t.getNode(i);if(!(p(a.x)&&p(s.x)&&p(a.y)&&p(s.y)))return;const u=a.x-s.x,h=a.y-s.y,d=3===this.options.dimensions?a.z-s.z:0,c=Math.sqrt(u*u+h*h+d*d)/r,l=u*c,f=h*c,g=d*c;e[o].x+=l,e[o].y+=f,e[i].x-=l,e[i].y-=f,3===this.options.dimensions&&(e[o].z+=g,e[i].z-=g)}))}}const Cn={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300};class Dn{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},Cn),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericGridLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericGridLayout(!0,t,r)}))}genericGridLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{begin:o=[0,0],condense:i,preventOverlapPadding:s,preventOverlap:a,rows:u,cols:h,nodeSpacing:d,nodeSize:c,width:l,height:f,position:g}=e;let{sortBy:v}=e;const m=r.getAllNodes(),y=r.getAllEdges(),w=null==m?void 0:m.length;if(!w||1===w)return ne(r,t,o);const x=m.map((t=>Zt(t)));"id"===v||ue(v)&&void 0!==x[0].data[v]||(v="degree"),"degree"===v?x.sort(((t,e)=>r.getDegree(e.id,"both")-r.getDegree(t.id,"both"))):"id"===v?x.sort(((t,e)=>p(e.id)&&p(t.id)?e.id-t.id:`${t.id}`.localeCompare(`${e.id}`))):x.sort(((t,e)=>e.data[v]-t.data[v]));const b=l||"undefined"==typeof window?l:window.innerWidth,E=f||"undefined"==typeof window?f:window.innerHeight,N=w,M={rows:u,cols:h};if(null!=u&&null!=h)M.rows=u,M.cols=h;else if(null!=u&&null==h)M.rows=u,M.cols=Math.ceil(N/M.rows);else if(null==u&&null!=h)M.cols=h,M.rows=Math.ceil(N/M.cols);else{const t=Math.sqrt(N*E/b);M.rows=Math.round(t),M.cols=Math.round(b/E*t)}if(M.rows=Math.max(M.rows,1),M.cols=Math.max(M.cols,1),M.cols*M.rows>N){const t=Pn(M),e=Tn(M);(t-1)*e>=N?Pn(M,t-1):(e-1)*t>=N&&Tn(M,e-1)}else for(;M.cols*M.rows<N;){const t=Pn(M),e=Tn(M);(e+1)*t>=N?Tn(M,e+1):Pn(M,t+1)}let _=i?0:b/M.cols,k=i?0:E/M.rows;if(a||d){const t=Jt(10,d),e=Ht(30,c,!1);x.forEach((n=>{n.data.x&&n.data.y||(n.data.x=0,n.data.y=0);const o=r.getNode(n.id),i=e(o)||30;let a,u;he(i)?(a=i[0],u=i[1]):(a=i,u=i);const h=void 0!==t?t(n):s,d=a+h,c=u+h;_=Math.max(_,d),k=Math.max(k,c)}))}const A={},j={row:0,col:0},S={};for(let t=0;t<x.length;t++){const e=x[t];let n;if(g&&(n=g(r.getNode(e.id))),n&&(void 0!==n.row||void 0!==n.col)){const t={row:n.row,col:n.col};if(void 0===t.col)for(t.col=0;Ln(A,t);)t.col++;else if(void 0===t.row)for(t.row=0;Ln(A,t);)t.row++;S[e.id]=t,Fn(A,t)}Vn(e,o,_,k,S,M,j,A)}const O={nodes:x,edges:y};return t&&x.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),O}))}}const Pn=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;return null==e?r=Math.min(n,o):Math.min(n,o)===t.rows?t.rows=e:t.cols=e,r},Tn=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;return null==e?r=Math.max(n,o):Math.max(n,o)===t.rows?t.rows=e:t.cols=e,r},Ln=(t,e)=>t[`c-${e.row}-${e.col}`]||!1,Fn=(t,e)=>t[`c-${e.row}-${e.col}`]=!0,qn=(t,e)=>{const r=t.cols||5;e.col++,e.col>=r&&(e.col=0,e.row++)},Vn=(t,e,r,n,o,i,s,a)=>{let u,h;const d=o[t.id];if(d)u=d.col*r+r/2+e[0],h=d.row*n+n/2+e[1];else{for(;Ln(a,s);)qn(i,s);u=s.col*r+r/2+e[0],h=s.row*n+n/2+e[1],Fn(a,s),qn(i,s)}t.data.x=u,t.data.y=h},Un={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},Bn=(t,e,r,n,o,i)=>{e.forEach(((s,a)=>{r[a]={x:0,y:0},e.forEach(((e,u)=>{if(a===u)return;if(o[a]!==o[u])return;let h=s.x-e.x,d=s.y-e.y,c=Math.sqrt(h*h+d*d);if(0===c){c=1;const t=a>u?1:-1;h=.01*t,d=.01*t}if(c<i(t[a])/2+i(t[u])/2){const t=n*n/c;r[a].x+=h/c*t,r[a].y+=d/c*t}}))}))},$n=(t,e,r,n,o,i,s,a)=>{const u=i||s/10;return n&&e.forEach(((e,r)=>{const n=t[r].x-t[o].x,i=t[r].y-t[o].y,s=Math.sqrt(n*n+i*i);let a=i/s,u=-n/s;const h=Math.sqrt(e.x*e.x+e.y*e.y);let d=Math.acos((a*e.x+u*e.y)/h);d>Math.PI/2&&(d-=Math.PI/2,a*=-1,u*=-1);const c=Math.cos(d)*h;e.x=a*c,e.y=u*c})),t.forEach(((i,s)=>{if(s===o)return;const h=Math.sqrt(e[s].x*e[s].x+e[s].y*e[s].y);if(h>0&&s!==o){const d=Math.min(u*(r/800),h);if(i.x+=e[s].x/h*d,i.y+=e[s].y/h*d,n){let e=i.x-t[o].x,r=i.y-t[o].y;const n=Math.sqrt(e*e+r*r);e=e/n*a[s],r=r/n*a[s],i.x=t[o].x+e,i.y=t[o].y+r}}})),t},Gn={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};class Wn{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},Gn),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericRadialLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericRadialLayout(!0,t,r)}))}genericRadialLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{width:o,height:i,center:s,focusNode:a,unitRadius:u,nodeSize:h,nodeSpacing:d,strictRadial:c,preventOverlap:l,maxPreventOverlapIteration:f,sortBy:g,linkDistance:p=50,sortStrength:v=10,maxIteration:m=1e3}=e,y=r.getAllNodes(),w=r.getAllEdges(),x=o||"undefined"==typeof window?o:window.innerWidth,b=i||"undefined"==typeof window?i:window.innerHeight,E=s||[x/2,b/2];if(!(null==y?void 0:y.length)||1===y.length)return ne(r,t,E);let N=y[0];if(ue(a)){for(let t=0;t<y.length;t++)if(y[t].id===a){N=y[t];break}}else N=a||y[0];const M=Jn(y,N.id),_=Ue({nodes:y,edges:w},!1),k=Ve(_),A=Xn(k,M);Hn(k,M,A+1);const j=k[M];let S=x-E[0]>E[0]?E[0]:x-E[0],O=b-E[1]>E[1]?E[1]:b-E[1];0===S&&(S=x/2),0===O&&(O=b/2);const z=Math.min(S,O),R=Math.max(...j),I=[],C=u||z/R;j.forEach(((t,e)=>{I[e]=t*C}));const D=Kn(y,k,p,I,C,g,v),P=Yn(D),T=((t,e,r)=>{try{const r=Fe.mul(Fe.pow(e,2),-.5),n=r.mean("row"),o=r.mean("column"),i=r.mean();r.add(i).subRowVector(n).subColumnVector(o);const s=new qe(r),a=Fe.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map((e=>Fe.mul([e],[a]).toJSON()[0].splice(0,t)))}catch(t){const n=[];for(let t=0;t<e.length;t++){const t=Math.random()*r,e=Math.random()*r;n.push([t,e])}return n}})(p,D,p);let L,F=T.map((([t,e])=>({x:(isNaN(t)?Math.random()*p:t)-T[M][0],y:(isNaN(e)?Math.random()*p:e)-T[M][1]})));if(this.run(m,F,P,D,I,M),l){L=Xt(h,d);const t={nodes:y,nodeSizeFunc:L,positions:F,radii:I,height:b,width:x,strictRadial:Boolean(c),focusIdx:M,iterations:f||200,k:F.length/4.5};F=((t,e)=>{const r=Object.assign(Object.assign({},Un),e),{positions:n,iterations:o,width:i,k:s,speed:a=100,strictRadial:u,focusIdx:h,radii:d=[],nodeSizeFunc:c}=r,l=t.getAllNodes(),f=[],g=i/10;for(let t=0;t<o;t++)n.forEach(((t,e)=>{f[e]={x:0,y:0}})),Bn(l,n,f,s,d,c),$n(n,f,a,u,h,g,i,d);return n})(r,t)}const q=[];return F.forEach(((t,e)=>{const r=Zt(y[e]);r.data.x=t.x+E[0],r.data.y=t.y+E[1],q.push(r)})),t&&q.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:q,edges:w}}))}run(t,e,r,n,o,i){for(let s=0;s<=t;s++){const a=s/t;this.oneIteration(a,e,o,n,r,i)}}oneIteration(t,e,r,n,o,i){const s=1-t;e.forEach(((a,u)=>{const h=Ge(a,{x:0,y:0}),d=0===h?0:1/h;if(u===i)return;let c=0,l=0,f=0;e.forEach(((t,e)=>{if(u===e)return;const r=Ge(a,t),i=0===r?0:1/r,s=n[e][u];f+=o[u][e],c+=o[u][e]*(t.x+s*(a.x-t.x)*i),l+=o[u][e]*(t.y+s*(a.y-t.y)*i)}));const g=0===r[u]?0:1/r[u];f*=s,f+=t*g*g,c*=s,c+=t*g*a.x*d,a.x=c/f,l*=s,l+=t*g*a.y*d,a.y=l/f}))}}const Kn=(t,e,r,n,o,i,s)=>{if(!t)return[];const a=[];if(e){const u={};e.forEach(((e,h)=>{const d=[];e.forEach(((e,a)=>{var c,l;if(h===a)d.push(0);else if(n[h]===n[a])if("data"===i)d.push(e*(Math.abs(h-a)*s)/(n[h]/o));else if(i){let r,f;if(u[t[h].id])r=u[t[h].id];else{const e=("id"===i?t[h].id:null===(c=t[h].data)||void 0===c?void 0:c[i])||0;r=ue(e)?e.charCodeAt(0):e,u[t[h].id]=r}if(u[t[a].id])f=u[t[a].id];else{const e=("id"===i?t[a].id:null===(l=t[a].data)||void 0===l?void 0:l[i])||0;f=ue(e)?e.charCodeAt(0):e,u[t[a].id]=f}d.push(e*(Math.abs(r-f)*s)/(n[h]/o))}else d.push(e*r/(n[h]/o));else{const t=(r+o)/2;d.push(e*t)}})),a.push(d)}))}return a},Yn=t=>{const e=t.length,r=t[0].length,n=[];for(let o=0;o<e;o++){const e=[];for(let n=0;n<r;n++)0!==t[o][n]?e.push(1/(t[o][n]*t[o][n])):e.push(0);n.push(e)}return n},Jn=(t,e)=>{let r=-1;return t.forEach(((t,n)=>{t.id===e&&(r=n)})),Math.max(r,0)},Hn=(t,e,r)=>{const n=t.length;for(let o=0;o<n;o++)if(t[e][o]===1/0){t[e][o]=r,t[o][e]=r;for(let i=0;i<n;i++)t[o][i]!==1/0&&t[e][i]===1/0&&(t[e][i]=r+t[o][i],t[i][e]=r+t[o][i])}for(let r=0;r<n;r++)if(r!==e)for(let o=0;o<n;o++)if(t[r][o]===1/0){let n=Math.abs(t[e][r]-t[e][o]);n=0===n?1:n,t[r][o]=n}},Xn=(t,e)=>{let r=0;for(let n=0;n<t[e].length;n++)t[e][n]!==1/0&&(r=t[e][n]>r?t[e][n]:r);return r},Qn={center:[0,0],width:300,height:300};class Zn{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},Qn),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericRandomLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericRandomLayout(!0,t,r)}))}genericRandomLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{center:o,width:i,height:s}=e,a=r.getAllNodes(),u=i||"undefined"==typeof window?i:window.innerWidth,h=s||"undefined"==typeof window?s:window.innerHeight,d=o||[u/2,h/2],c=[];return a&&a.forEach((t=>{c.push({id:t.id,data:{x:.9*(Math.random()-.5)*u+d[0],y:.9*(Math.random()-.5)*h+d[1]}})})),t&&c.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:c,edges:r.getAllEdges()}}))}}const to={circular:ie,concentric:ce,mds:Ye,random:Zn,grid:Dn,radial:Wn,force:Re,d3force:Wr,"d3-force-3d":Nn,fruchterman:In,forceAtlas2:zn,dagre:kn,antvDagre:ee,comboCombined:Ze};function eo(t){return!!t.tick&&!!t.stop}})(),n})()));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Layout=e():t.Layout=e()}(this,(()=>(()=>{var t={4341:(t,e,r)=>{t.exports={graphlib:r(3374),layout:r(9407),debug:r(6978),util:{time:r(6573).time,notime:r(6573).notime},version:r(6661)}},9317:(t,e,r)=>{"use strict";var n=r(5076),o=r(3526);t.exports={run:function(t){var e="greedy"===t.graph().acyclicer?o(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],r={},o={};return n.forEach(t.nodes(),(function i(s){n.has(o,s)||(o[s]=!0,r[s]=!0,n.forEach(t.outEdges(s),(function(t){n.has(r,t.w)?e.push(t):i(t.w)})),delete r[s])})),e}(t);n.forEach(e,(function(e){var r=t.edge(e);t.removeEdge(e),r.forwardName=e.name,r.reversed=!0,t.setEdge(e.w,e.v,r,n.uniqueId("rev"))}))},undo:function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.reversed){t.removeEdge(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}}))}}},7840:(t,e,r)=>{var n=r(5076),o=r(6573);function i(t,e,r,n,i,s){var a={width:0,height:0,rank:s,borderType:e},u=i[e][s-1],h=o.addDummyNode(t,"border",a,r);i[e][s]=h,t.setParent(h,n),u&&t.setEdge(u,h,{weight:1})}t.exports=function(t){n.forEach(t.children(),(function e(r){var o=t.children(r),s=t.node(r);if(o.length&&n.forEach(o,e),n.has(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(var a=s.minRank,u=s.maxRank+1;a<u;++a)i(t,"borderLeft","_bl",r,s,a),i(t,"borderRight","_br",r,s,a)}}))}},5793:(t,e,r)=>{"use strict";var n=r(5076);function o(t){n.forEach(t.nodes(),(function(e){i(t.node(e))})),n.forEach(t.edges(),(function(e){i(t.edge(e))}))}function i(t){var e=t.width;t.width=t.height,t.height=e}function s(t){t.y=-t.y}function a(t){var e=t.x;t.x=t.y,t.y=e}t.exports={adjust:function(t){var e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||o(t)},undo:function(t){var e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){n.forEach(t.nodes(),(function(e){s(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.forEach(r.points,s),n.has(r,"y")&&s(r)}))}(t),"lr"!==e&&"rl"!==e||(function(t){n.forEach(t.nodes(),(function(e){a(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.forEach(r.points,a),n.has(r,"x")&&a(r)}))}(t),o(t))}}},5752:t=>{function e(){var t={};t._next=t._prev=t,this._sentinel=t}function r(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function n(t,e){if("_next"!==t&&"_prev"!==t)return e}t.exports=e,e.prototype.dequeue=function(){var t=this._sentinel,e=t._prev;if(e!==t)return r(e),e},e.prototype.enqueue=function(t){var e=this._sentinel;t._prev&&t._next&&r(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e},e.prototype.toString=function(){for(var t=[],e=this._sentinel,r=e._prev;r!==e;)t.push(JSON.stringify(r,n)),r=r._prev;return"["+t.join(", ")+"]"}},6978:(t,e,r)=>{var n=r(5076),o=r(6573),i=r(3374).Graph;t.exports={debugOrdering:function(t){var e=o.buildLayerMatrix(t),r=new i({compound:!0,multigraph:!0}).setGraph({});return n.forEach(t.nodes(),(function(e){r.setNode(e,{label:e}),r.setParent(e,"layer"+t.node(e).rank)})),n.forEach(t.edges(),(function(t){r.setEdge(t.v,t.w,{},t.name)})),n.forEach(e,(function(t,e){var o="layer"+e;r.setNode(o,{rank:"same"}),n.reduce(t,(function(t,e){return r.setEdge(t,e,{style:"invis"}),e}))})),r}}},3374:(t,e,r)=>{var n;try{n=r(7423)}catch(t){}n||(n=window.graphlib),t.exports=n},3526:(t,e,r)=>{var n=r(5076),o=r(3374).Graph,i=r(5752);t.exports=function(t,e){if(t.nodeCount()<=1)return[];var r=function(t,e){var r=new o,s=0,a=0;n.forEach(t.nodes(),(function(t){r.setNode(t,{v:t,in:0,out:0})})),n.forEach(t.edges(),(function(t){var n=r.edge(t.v,t.w)||0,o=e(t),i=n+o;r.setEdge(t.v,t.w,i),a=Math.max(a,r.node(t.v).out+=o),s=Math.max(s,r.node(t.w).in+=o)}));var h=n.range(a+s+3).map((function(){return new i})),d=s+1;return n.forEach(r.nodes(),(function(t){u(h,d,r.node(t))})),{graph:r,buckets:h,zeroIdx:d}}(t,e||s),h=function(t,e,r){for(var n,o=[],i=e[e.length-1],s=e[0];t.nodeCount();){for(;n=s.dequeue();)a(t,e,r,n);for(;n=i.dequeue();)a(t,e,r,n);if(t.nodeCount())for(var u=e.length-2;u>0;--u)if(n=e[u].dequeue()){o=o.concat(a(t,e,r,n,!0));break}}return o}(r.graph,r.buckets,r.zeroIdx);return n.flatten(n.map(h,(function(e){return t.outEdges(e.v,e.w)})),!0)};var s=n.constant(1);function a(t,e,r,o,i){var s=i?[]:void 0;return n.forEach(t.inEdges(o.v),(function(n){var o=t.edge(n),a=t.node(n.v);i&&s.push({v:n.v,w:n.w}),a.out-=o,u(e,r,a)})),n.forEach(t.outEdges(o.v),(function(n){var o=t.edge(n),i=n.w,s=t.node(i);s.in-=o,u(e,r,s)})),t.removeNode(o.v),s}function u(t,e,r){r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)}},9407:(t,e,r)=>{"use strict";var n=r(5076),o=r(9317),i=r(9934),s=r(9472),a=r(6573).normalizeRanks,u=r(9095),h=r(6573).removeEmptyRanks,d=r(9526),c=r(7840),l=r(5793),f=r(9186),g=r(9497),p=r(6573),v=r(3374).Graph;t.exports=function(t,e){var r=e&&e.debugTiming?p.time:p.notime;r("layout",(function(){var e=r(" buildLayoutGraph",(function(){return function(t){var e=new v({multigraph:!0,compound:!0}),r=k(t.graph());return e.setGraph(n.merge({},y,_(r,m),n.pick(r,w))),n.forEach(t.nodes(),(function(r){var o=k(t.node(r));e.setNode(r,n.defaults(_(o,x),b)),e.setParent(r,t.parent(r))})),n.forEach(t.edges(),(function(r){var o=k(t.edge(r));e.setEdge(r,n.merge({},N,_(o,E),n.pick(o,M)))})),e}(t)}));r(" runLayout",(function(){!function(t,e){e(" makeSpaceForEdgeLabels",(function(){!function(t){var e=t.graph();e.ranksep/=2,n.forEach(t.edges(),(function(r){var n=t.edge(r);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)}))}(t)})),e(" removeSelfEdges",(function(){!function(t){n.forEach(t.edges(),(function(e){if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}}))}(t)})),e(" acyclic",(function(){o.run(t)})),e(" nestingGraph.run",(function(){d.run(t)})),e(" rank",(function(){s(p.asNonCompoundGraph(t))})),e(" injectEdgeLabelProxies",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.width&&r.height){var n=t.node(e.v),o={rank:(t.node(e.w).rank-n.rank)/2+n.rank,e};p.addDummyNode(t,"edge-proxy",o,"_ep")}}))}(t)})),e(" removeEmptyRanks",(function(){h(t)})),e(" nestingGraph.cleanup",(function(){d.cleanup(t)})),e(" normalizeRanks",(function(){a(t)})),e(" assignRankMinMax",(function(){!function(t){var e=0;n.forEach(t.nodes(),(function(r){var o=t.node(r);o.borderTop&&(o.minRank=t.node(o.borderTop).rank,o.maxRank=t.node(o.borderBottom).rank,e=n.max(e,o.maxRank))})),t.graph().maxRank=e}(t)})),e(" removeEdgeLabelProxies",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);"edge-proxy"===r.dummy&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))}))}(t)})),e(" normalize.run",(function(){i.run(t)})),e(" parentDummyChains",(function(){u(t)})),e(" addBorderSegments",(function(){c(t)})),e(" order",(function(){f(t)})),e(" insertSelfEdges",(function(){!function(t){var e=p.buildLayerMatrix(t);n.forEach(e,(function(e){var r=0;n.forEach(e,(function(e,o){var i=t.node(e);i.order=o+r,n.forEach(i.selfEdges,(function(e){p.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:o+ ++r,e:e.e,label:e.label},"_se")})),delete i.selfEdges}))}))}(t)})),e(" adjustCoordinateSystem",(function(){l.adjust(t)})),e(" position",(function(){g(t)})),e(" positionSelfEdges",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),o=n.x+n.width/2,i=n.y,s=r.x-o,a=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{x:o+s,y:i},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.label.x=r.x,r.label.y=r.y}}))}(t)})),e(" removeBorderNodes",(function(){!function(t){n.forEach(t.nodes(),(function(e){if(t.children(e).length){var r=t.node(e),o=t.node(r.borderTop),i=t.node(r.borderBottom),s=t.node(n.last(r.borderLeft)),a=t.node(n.last(r.borderRight));r.width=Math.abs(a.x-s.x),r.height=Math.abs(i.y-o.y),r.x=s.x+r.width/2,r.y=o.y+r.height/2}})),n.forEach(t.nodes(),(function(e){"border"===t.node(e).dummy&&t.removeNode(e)}))}(t)})),e(" normalize.undo",(function(){i.undo(t)})),e(" fixupEdgeLabelCoords",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(n.has(r,"x"))switch("l"!==r.labelpos&&"r"!==r.labelpos||(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}}))}(t)})),e(" undoCoordinateSystem",(function(){l.undo(t)})),e(" translateGraph",(function(){!function(t){var e=Number.POSITIVE_INFINITY,r=0,o=Number.POSITIVE_INFINITY,i=0,s=t.graph(),a=s.marginx||0,u=s.marginy||0;function h(t){var n=t.x,s=t.y,a=t.width,u=t.height;e=Math.min(e,n-a/2),r=Math.max(r,n+a/2),o=Math.min(o,s-u/2),i=Math.max(i,s+u/2)}n.forEach(t.nodes(),(function(e){h(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.has(r,"x")&&h(r)})),e-=a,o-=u,n.forEach(t.nodes(),(function(r){var n=t.node(r);n.x-=e,n.y-=o})),n.forEach(t.edges(),(function(r){var i=t.edge(r);n.forEach(i.points,(function(t){t.x-=e,t.y-=o})),n.has(i,"x")&&(i.x-=e),n.has(i,"y")&&(i.y-=o)})),s.width=r-e+a,s.height=i-o+u}(t)})),e(" assignNodeIntersects",(function(){!function(t){n.forEach(t.edges(),(function(e){var r,n,o=t.edge(e),i=t.node(e.v),s=t.node(e.w);o.points?(r=o.points[0],n=o.points[o.points.length-1]):(o.points=[],r=s,n=i),o.points.unshift(p.intersectRect(i,r)),o.points.push(p.intersectRect(s,n))}))}(t)})),e(" reversePoints",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);r.reversed&&r.points.reverse()}))}(t)})),e(" acyclic.undo",(function(){o.undo(t)}))}(e,r)})),r(" updateInputGraph",(function(){!function(t,e){n.forEach(t.nodes(),(function(r){var n=t.node(r),o=e.node(r);n&&(n.x=o.x,n.y=o.y,e.children(r).length&&(n.width=o.width,n.height=o.height))})),n.forEach(t.edges(),(function(r){var o=t.edge(r),i=e.edge(r);o.points=i.points,n.has(i,"x")&&(o.x=i.x,o.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,e)}))}))};var m=["nodesep","edgesep","ranksep","marginx","marginy"],y={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},w=["acyclicer","ranker","rankdir","align"],x=["width","height"],b={width:0,height:0},E=["minlen","weight","width","height","labeloffset"],N={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},M=["labelpos"];function _(t,e){return n.mapValues(n.pick(t,e),Number)}function k(t){var e={};return n.forEach(t,(function(t,r){e[r.toLowerCase()]=t})),e}},5076:(t,e,r)=>{var n;try{n={cloneDeep:r(9136),constant:r(8295),defaults:r(9529),each:r(958),filter:r(9969),find:r(828),flatten:r(7469),forEach:r(1117),forIn:r(4519),has:r(4339),isUndefined:r(2895),last:r(5179),map:r(9629),mapValues:r(5551),max:r(4213),merge:r(2495),min:r(9903),minBy:r(3262),now:r(8835),pick:r(222),range:r(4978),reduce:r(9285),sortBy:r(5246),uniqueId:r(761),values:r(3005),zipObject:r(3679)}}catch(t){}n||(n=window._),t.exports=n},9526:(t,e,r)=>{var n=r(5076),o=r(6573);function i(t,e,r,s,a,u,h){var d=t.children(h);if(d.length){var c=o.addBorderNode(t,"_bt"),l=o.addBorderNode(t,"_bb"),f=t.node(h);t.setParent(c,h),f.borderTop=c,t.setParent(l,h),f.borderBottom=l,n.forEach(d,(function(n){i(t,e,r,s,a,u,n);var o=t.node(n),d=o.borderTop?o.borderTop:n,f=o.borderBottom?o.borderBottom:n,g=o.borderTop?s:2*s,p=d!==f?1:a-u[h]+1;t.setEdge(c,d,{weight:g,minlen:p,nestingEdge:!0}),t.setEdge(f,l,{weight:g,minlen:p,nestingEdge:!0})})),t.parent(h)||t.setEdge(e,c,{weight:0,minlen:a+u[h]})}else h!==e&&t.setEdge(e,h,{weight:0,minlen:r})}t.exports={run:function(t){var e=o.addDummyNode(t,"root",{},"_root"),r=function(t){var e={};function r(o,i){var s=t.children(o);s&&s.length&&n.forEach(s,(function(t){r(t,i+1)})),e[o]=i}return n.forEach(t.children(),(function(t){r(t,1)})),e}(t),s=n.max(n.values(r))-1,a=2*s+1;t.graph().nestingRoot=e,n.forEach(t.edges(),(function(e){t.edge(e).minlen*=a}));var u=function(t){return n.reduce(t.edges(),(function(e,r){return e+t.edge(r).weight}),0)}(t)+1;n.forEach(t.children(),(function(n){i(t,e,a,u,s,r,n)})),t.graph().nodeRankFactor=a},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,n.forEach(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}}},9934:(t,e,r)=>{"use strict";var n=r(5076),o=r(6573);t.exports={run:function(t){t.graph().dummyChains=[],n.forEach(t.edges(),(function(e){!function(t,e){var r,n,i,s=e.v,a=t.node(s).rank,u=e.w,h=t.node(u).rank,d=e.name,c=t.edge(e),l=c.labelRank;if(h!==a+1){for(t.removeEdge(e),i=0,++a;a<h;++i,++a)c.points=[],n={width:0,height:0,edgeLabel:c,edgeObj:e,rank:a},r=o.addDummyNode(t,"edge",n,"_d"),a===l&&(n.width=c.width,n.height=c.height,n.dummy="edge-label",n.labelpos=c.labelpos),t.setEdge(s,r,{weight:c.weight},d),0===i&&t.graph().dummyChains.push(r),s=r;t.setEdge(s,u,{weight:c.weight},d)}}(t,e)}))},undo:function(t){n.forEach(t.graph().dummyChains,(function(e){var r,n=t.node(e),o=n.edgeLabel;for(t.setEdge(n.edgeObj,o);n.dummy;)r=t.successors(e)[0],t.removeNode(e),o.points.push({x:n.x,y:n.y}),"edge-label"===n.dummy&&(o.x=n.x,o.y=n.y,o.width=n.width,o.height=n.height),e=r,n=t.node(e)}))}}},9841:(t,e,r)=>{var n=r(5076);t.exports=function(t,e,r){var o,i={};n.forEach(r,(function(r){for(var n,s,a=t.parent(r);a;){if((n=t.parent(a))?(s=i[n],i[n]=a):(s=o,o=a),s&&s!==a)return void e.setEdge(s,a);a=n}}))}},5458:(t,e,r)=>{var n=r(5076);t.exports=function(t,e){return n.map(e,(function(e){var r=t.inEdges(e);if(r.length){var o=n.reduce(r,(function(e,r){var n=t.edge(r),o=t.node(r.v);return{sum:e.sum+n.weight*o.order,weight:e.weight+n.weight}}),{sum:0,weight:0});return{v:e,barycenter:o.sum/o.weight,weight:o.weight}}return{v:e}}))}},6263:(t,e,r)=>{var n=r(5076),o=r(3374).Graph;t.exports=function(t,e,r){var i=function(t){for(var e;t.hasNode(e=n.uniqueId("_root")););return e}(t),s=new o({compound:!0}).setGraph({root:i}).setDefaultNodeLabel((function(e){return t.node(e)}));return n.forEach(t.nodes(),(function(o){var a=t.node(o),u=t.parent(o);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(s.setNode(o),s.setParent(o,u||i),n.forEach(t[r](o),(function(e){var r=e.v===o?e.w:e.v,i=s.edge(r,o),a=n.isUndefined(i)?0:i.weight;s.setEdge(r,o,{weight:t.edge(e).weight+a})})),n.has(a,"minRank")&&s.setNode(o,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))})),s}},6840:(t,e,r)=>{"use strict";var n=r(5076);function o(t,e,r){for(var o=n.zipObject(r,n.map(r,(function(t,e){return e}))),i=n.flatten(n.map(e,(function(e){return n.sortBy(n.map(t.outEdges(e),(function(e){return{pos:o[e.w],weight:t.edge(e).weight}})),"pos")})),!0),s=1;s<r.length;)s<<=1;var a=2*s-1;s-=1;var u=n.map(new Array(a),(function(){return 0})),h=0;return n.forEach(i.forEach((function(t){var e=t.pos+s;u[e]+=t.weight;for(var r=0;e>0;)e%2&&(r+=u[e+1]),u[e=e-1>>1]+=t.weight;h+=t.weight*r}))),h}t.exports=function(t,e){for(var r=0,n=1;n<e.length;++n)r+=o(t,e[n-1],e[n]);return r}},9186:(t,e,r)=>{"use strict";var n=r(5076),o=r(1879),i=r(6840),s=r(9387),a=r(6263),u=r(9841),h=r(3374).Graph,d=r(6573);function c(t,e,r){return n.map(e,(function(e){return a(t,e,r)}))}function l(t,e){var r=new h;n.forEach(t,(function(t){var o=t.graph().root,i=s(t,o,r,e);n.forEach(i.vs,(function(e,r){t.node(e).order=r})),u(t,r,i.vs)}))}function f(t,e){n.forEach(e,(function(e){n.forEach(e,(function(e,r){t.node(e).order=r}))}))}t.exports=function(t){var e=d.maxRank(t),r=c(t,n.range(1,e+1),"inEdges"),s=c(t,n.range(e-1,-1,-1),"outEdges"),a=o(t);f(t,a);for(var u,h=Number.POSITIVE_INFINITY,g=0,p=0;p<4;++g,++p){l(g%2?r:s,g%4>=2),a=d.buildLayerMatrix(t);var v=i(t,a);v<h&&(p=0,u=n.cloneDeep(a),h=v)}f(t,u)}},1879:(t,e,r)=>{"use strict";var n=r(5076);t.exports=function(t){var e={},r=n.filter(t.nodes(),(function(e){return!t.children(e).length})),o=n.max(n.map(r,(function(e){return t.node(e).rank}))),i=n.map(n.range(o+1),(function(){return[]})),s=n.sortBy(r,(function(e){return t.node(e).rank}));return n.forEach(s,(function r(o){if(!n.has(e,o)){e[o]=!0;var s=t.node(o);i[s.rank].push(o),n.forEach(t.successors(o),r)}})),i}},5912:(t,e,r)=>{"use strict";var n=r(5076);t.exports=function(t,e){var r={};return n.forEach(t,(function(t,e){var o=r[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};n.isUndefined(t.barycenter)||(o.barycenter=t.barycenter,o.weight=t.weight)})),n.forEach(e.edges(),(function(t){var e=r[t.v],o=r[t.w];n.isUndefined(e)||n.isUndefined(o)||(o.indegree++,e.out.push(r[t.w]))})),function(t){var e=[];function r(t){return function(e){var r,o,i,s;e.merged||(n.isUndefined(e.barycenter)||n.isUndefined(t.barycenter)||e.barycenter>=t.barycenter)&&(o=e,i=0,s=0,(r=t).weight&&(i+=r.barycenter*r.weight,s+=r.weight),o.weight&&(i+=o.barycenter*o.weight,s+=o.weight),r.vs=o.vs.concat(r.vs),r.barycenter=i/s,r.weight=s,r.i=Math.min(o.i,r.i),o.merged=!0)}}function o(e){return function(r){r.in.push(e),0==--r.indegree&&t.push(r)}}for(;t.length;){var i=t.pop();e.push(i),n.forEach(i.in.reverse(),r(i)),n.forEach(i.out,o(i))}return n.map(n.filter(e,(function(t){return!t.merged})),(function(t){return n.pick(t,["vs","i","barycenter","weight"])}))}(n.filter(r,(function(t){return!t.indegree})))}},9387:(t,e,r)=>{var n=r(5076),o=r(5458),i=r(5912),s=r(256);t.exports=function t(e,r,a,u){var h=e.children(r),d=e.node(r),c=d?d.borderLeft:void 0,l=d?d.borderRight:void 0,f={};c&&(h=n.filter(h,(function(t){return t!==c&&t!==l})));var g=o(e,h);n.forEach(g,(function(r){if(e.children(r.v).length){var o=t(e,r.v,a,u);f[r.v]=o,n.has(o,"barycenter")&&(i=r,s=o,n.isUndefined(i.barycenter)?(i.barycenter=s.barycenter,i.weight=s.weight):(i.barycenter=(i.barycenter*i.weight+s.barycenter*s.weight)/(i.weight+s.weight),i.weight+=s.weight))}var i,s}));var p=i(g,a);!function(t,e){n.forEach(t,(function(t){t.vs=n.flatten(t.vs.map((function(t){return e[t]?e[t].vs:t})),!0)}))}(p,f);var v=s(p,u);if(c&&(v.vs=n.flatten([c,v.vs,l],!0),e.predecessors(c).length)){var m=e.node(e.predecessors(c)[0]),y=e.node(e.predecessors(l)[0]);n.has(v,"barycenter")||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+m.order+y.order)/(v.weight+2),v.weight+=2}return v}},256:(t,e,r)=>{var n=r(5076),o=r(6573);function i(t,e,r){for(var o;e.length&&(o=n.last(e)).i<=r;)e.pop(),t.push(o.vs),r++;return r}t.exports=function(t,e){var r,s=o.partition(t,(function(t){return n.has(t,"barycenter")})),a=s.lhs,u=n.sortBy(s.rhs,(function(t){return-t.i})),h=[],d=0,c=0,l=0;a.sort((r=!!e,function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:r?e.i-t.i:t.i-e.i})),l=i(h,u,l),n.forEach(a,(function(t){l+=t.vs.length,h.push(t.vs),d+=t.barycenter*t.weight,c+=t.weight,l=i(h,u,l)}));var f={vs:n.flatten(h,!0)};return c&&(f.barycenter=d/c,f.weight=c),f}},9095:(t,e,r)=>{var n=r(5076);t.exports=function(t){var e=function(t){var e={},r=0;return n.forEach(t.children(),(function o(i){var s=r;n.forEach(t.children(i),o),e[i]={low:s,lim:r++}})),e}(t);n.forEach(t.graph().dummyChains,(function(r){for(var n=t.node(r),o=n.edgeObj,i=function(t,e,r,n){var o,i,s=[],a=[],u=Math.min(e[r].low,e[n].low),h=Math.max(e[r].lim,e[n].lim);o=r;do{o=t.parent(o),s.push(o)}while(o&&(e[o].low>u||h>e[o].lim));for(i=o,o=n;(o=t.parent(o))!==i;)a.push(o);return{path:s.concat(a.reverse()),lca:i}}(t,e,o.v,o.w),s=i.path,a=i.lca,u=0,h=s[u],d=!0;r!==o.w;){if(n=t.node(r),d){for(;(h=s[u])!==a&&t.node(h).maxRank<n.rank;)u++;h===a&&(d=!1)}if(!d){for(;u<s.length-1&&t.node(h=s[u+1]).minRank<=n.rank;)u++;h=s[u]}t.setParent(r,h),r=t.successors(r)[0]}}))}},2738:(t,e,r)=>{"use strict";var n=r(5076),o=r(3374).Graph,i=r(6573);function s(t,e){var r={};return n.reduce(e,(function(e,o){var i=0,s=0,a=e.length,h=n.last(o);return n.forEach(o,(function(e,d){var c=function(t,e){if(t.node(e).dummy)return n.find(t.predecessors(e),(function(e){return t.node(e).dummy}))}(t,e),l=c?t.node(c).order:a;(c||e===h)&&(n.forEach(o.slice(s,d+1),(function(e){n.forEach(t.predecessors(e),(function(n){var o=t.node(n),s=o.order;!(s<i||l<s)||o.dummy&&t.node(e).dummy||u(r,n,e)}))})),s=d+1,i=l)})),o})),r}function a(t,e){var r={};function o(e,o,i,s,a){var h;n.forEach(n.range(o,i),(function(o){h=e[o],t.node(h).dummy&&n.forEach(t.predecessors(h),(function(e){var n=t.node(e);n.dummy&&(n.order<s||n.order>a)&&u(r,e,h)}))}))}return n.reduce(e,(function(e,r){var i,s=-1,a=0;return n.forEach(r,(function(n,u){if("border"===t.node(n).dummy){var h=t.predecessors(n);h.length&&(i=t.node(h[0]).order,o(r,a,u,s,i),a=u,s=i)}o(r,a,r.length,i,e.length)})),r})),r}function u(t,e,r){if(e>r){var n=e;e=r,r=n}var o=t[e];o||(t[e]=o={}),o[r]=!0}function h(t,e,r){if(e>r){var o=e;e=r,r=o}return n.has(t[e],r)}function d(t,e,r,o){var i={},s={},a={};return n.forEach(e,(function(t){n.forEach(t,(function(t,e){i[t]=t,s[t]=t,a[t]=e}))})),n.forEach(e,(function(t){var e=-1;n.forEach(t,(function(t){var u=o(t);if(u.length){u=n.sortBy(u,(function(t){return a[t]}));for(var d=(u.length-1)/2,c=Math.floor(d),l=Math.ceil(d);c<=l;++c){var f=u[c];s[t]===t&&e<a[f]&&!h(r,t,f)&&(s[f]=t,s[t]=i[t]=i[f],e=a[f])}}}))})),{root:i,align:s}}function c(t,e,r,i,s){var a={},u=function(t,e,r,i){var s=new o,a=t.graph(),u=function(t,e,r){return function(o,i,s){var a,u=o.node(i),h=o.node(s),d=0;if(d+=u.width/2,n.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(d+=r?a:-a),a=0,d+=(u.dummy?e:t)/2,d+=(h.dummy?e:t)/2,d+=h.width/2,n.has(h,"labelpos"))switch(h.labelpos.toLowerCase()){case"l":a=h.width/2;break;case"r":a=-h.width/2}return a&&(d+=r?a:-a),a=0,d}}(a.nodesep,a.edgesep,i);return n.forEach(e,(function(e){var o;n.forEach(e,(function(e){var n=r[e];if(s.setNode(n),o){var i=r[o],a=s.edge(i,n);s.setEdge(i,n,Math.max(u(t,e,o),a||0))}o=e}))})),s}(t,e,r,s),h=s?"borderLeft":"borderRight";function d(t,e){for(var r=u.nodes(),n=r.pop(),o={};n;)o[n]?t(n):(o[n]=!0,r.push(n),r=r.concat(e(n))),n=r.pop()}return d((function(t){a[t]=u.inEdges(t).reduce((function(t,e){return Math.max(t,a[e.v]+u.edge(e))}),0)}),u.predecessors.bind(u)),d((function(e){var r=u.outEdges(e).reduce((function(t,e){return Math.min(t,a[e.w]-u.edge(e))}),Number.POSITIVE_INFINITY),n=t.node(e);r!==Number.POSITIVE_INFINITY&&n.borderType!==h&&(a[e]=Math.max(a[e],r))}),u.successors.bind(u)),n.forEach(i,(function(t){a[t]=a[r[t]]})),a}function l(t,e){return n.minBy(n.values(e),(function(e){var r=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return n.forIn(e,(function(e,n){var i=function(t,e){return t.node(e).width}(t,n)/2;r=Math.max(e+i,r),o=Math.min(e-i,o)})),r-o}))}function f(t,e){var r=n.values(e),o=n.min(r),i=n.max(r);n.forEach(["u","d"],(function(r){n.forEach(["l","r"],(function(s){var a,u=r+s,h=t[u];if(h!==e){var d=n.values(h);(a="l"===s?o-n.min(d):i-n.max(d))&&(t[u]=n.mapValues(h,(function(t){return t+a})))}}))}))}function g(t,e){return n.mapValues(t.ul,(function(r,o){if(e)return t[e.toLowerCase()][o];var i=n.sortBy(n.map(t,o));return(i[1]+i[2])/2}))}t.exports={positionX:function(t){var e,r=i.buildLayerMatrix(t),o=n.merge(s(t,r),a(t,r)),u={};n.forEach(["u","d"],(function(i){e="u"===i?r:n.values(r).reverse(),n.forEach(["l","r"],(function(r){"r"===r&&(e=n.map(e,(function(t){return n.values(t).reverse()})));var s=("u"===i?t.predecessors:t.successors).bind(t),a=d(0,e,o,s),h=c(t,e,a.root,a.align,"r"===r);"r"===r&&(h=n.mapValues(h,(function(t){return-t}))),u[i+r]=h}))}));var h=l(t,u);return f(u,h),g(u,t.graph().align)},findType1Conflicts:s,findType2Conflicts:a,addConflict:u,hasConflict:h,verticalAlignment:d,horizontalCompaction:c,alignCoordinates:f,findSmallestWidthAlignment:l,balance:g}},9497:(t,e,r)=>{"use strict";var n=r(5076),o=r(6573),i=r(2738).positionX;t.exports=function(t){(function(t){var e=o.buildLayerMatrix(t),r=t.graph().ranksep,i=0;n.forEach(e,(function(e){var o=n.max(n.map(e,(function(e){return t.node(e).height})));n.forEach(e,(function(e){t.node(e).y=i+o/2})),i+=o+r}))})(t=o.asNonCompoundGraph(t)),n.forEach(i(t),(function(e,r){t.node(r).x=e}))}},9996:(t,e,r)=>{"use strict";var n=r(5076),o=r(3374).Graph,i=r(8666).slack;function s(t,e){return n.forEach(t.nodes(),(function r(o){n.forEach(e.nodeEdges(o),(function(n){var s=n.v,a=o===s?n.w:s;t.hasNode(a)||i(e,n)||(t.setNode(a,{}),t.setEdge(o,a,{}),r(a))}))})),t.nodeCount()}function a(t,e){return n.minBy(e.edges(),(function(r){if(t.hasNode(r.v)!==t.hasNode(r.w))return i(e,r)}))}function u(t,e,r){n.forEach(t.nodes(),(function(t){e.node(t).rank+=r}))}t.exports=function(t){var e,r,n=new o({directed:!1}),h=t.nodes()[0],d=t.nodeCount();for(n.setNode(h,{});s(n,t)<d;)e=a(n,t),r=n.hasNode(e.v)?i(t,e):-i(t,e),u(n,t,r);return n}},9472:(t,e,r)=>{"use strict";var n=r(8666).longestPath,o=r(9996),i=r(4502);t.exports=function(t){switch(t.graph().ranker){case"network-simplex":default:!function(t){i(t)}(t);break;case"tight-tree":!function(t){n(t),o(t)}(t);break;case"longest-path":s(t)}};var s=n},4502:(t,e,r)=>{"use strict";var n=r(5076),o=r(9996),i=r(8666).slack,s=r(8666).longestPath,a=r(3374).alg.preorder,u=r(3374).alg.postorder,h=r(6573).simplify;function d(t){t=h(t),s(t);var e,r=o(t);for(f(r),c(r,t);e=p(r);)m(r,t,e,v(r,t,e))}function c(t,e){var r=u(t,t.nodes());r=r.slice(0,r.length-1),n.forEach(r,(function(r){!function(t,e,r){var n=t.node(r).parent;t.edge(r,n).cutvalue=l(t,e,r)}(t,e,r)}))}function l(t,e,r){var o=t.node(r).parent,i=!0,s=e.edge(r,o),a=0;return s||(i=!1,s=e.edge(o,r)),a=s.weight,n.forEach(e.nodeEdges(r),(function(n){var s,u,h=n.v===r,d=h?n.w:n.v;if(d!==o){var c=h===i,l=e.edge(n).weight;if(a+=c?l:-l,s=r,u=d,t.hasEdge(s,u)){var f=t.edge(r,d).cutvalue;a+=c?-f:f}}})),a}function f(t,e){arguments.length<2&&(e=t.nodes()[0]),g(t,{},1,e)}function g(t,e,r,o,i){var s=r,a=t.node(o);return e[o]=!0,n.forEach(t.neighbors(o),(function(i){n.has(e,i)||(r=g(t,e,r,i,o))})),a.low=s,a.lim=r++,i?a.parent=i:delete a.parent,r}function p(t){return n.find(t.edges(),(function(e){return t.edge(e).cutvalue<0}))}function v(t,e,r){var o=r.v,s=r.w;e.hasEdge(o,s)||(o=r.w,s=r.v);var a=t.node(o),u=t.node(s),h=a,d=!1;a.lim>u.lim&&(h=u,d=!0);var c=n.filter(e.edges(),(function(e){return d===y(0,t.node(e.v),h)&&d!==y(0,t.node(e.w),h)}));return n.minBy(c,(function(t){return i(e,t)}))}function m(t,e,r,o){var i=r.v,s=r.w;t.removeEdge(i,s),t.setEdge(o.v,o.w,{}),f(t),c(t,e),function(t,e){var r=n.find(t.nodes(),(function(t){return!e.node(t).parent})),o=a(t,r);o=o.slice(1),n.forEach(o,(function(r){var n=t.node(r).parent,o=e.edge(r,n),i=!1;o||(o=e.edge(n,r),i=!0),e.node(r).rank=e.node(n).rank+(i?o.minlen:-o.minlen)}))}(t,e)}function y(t,e,r){return r.low<=e.lim&&e.lim<=r.lim}t.exports=d,d.initLowLimValues=f,d.initCutValues=c,d.calcCutValue=l,d.leaveEdge=p,d.enterEdge=v,d.exchangeEdges=m},8666:(t,e,r)=>{"use strict";var n=r(5076);t.exports={longestPath:function(t){var e={};n.forEach(t.sources(),(function r(o){var i=t.node(o);if(n.has(e,o))return i.rank;e[o]=!0;var s=n.min(n.map(t.outEdges(o),(function(e){return r(e.w)-t.edge(e).minlen})));return s!==Number.POSITIVE_INFINITY&&null!=s||(s=0),i.rank=s}))},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}}},6573:(t,e,r)=>{"use strict";var n=r(5076),o=r(3374).Graph;function i(t,e,r,o){var i;do{i=n.uniqueId(o)}while(t.hasNode(i));return r.dummy=e,t.setNode(i,r),i}function s(t){return n.max(n.map(t.nodes(),(function(e){var r=t.node(e).rank;if(!n.isUndefined(r))return r})))}t.exports={addDummyNode:i,simplify:function(t){var e=(new o).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){var n=e.edge(r.v,r.w)||{weight:0,minlen:1},o=t.edge(r);e.setEdge(r.v,r.w,{weight:n.weight+o.weight,minlen:Math.max(n.minlen,o.minlen)})})),e},asNonCompoundGraph:function(t){var e=new o({multigraph:t.isMultigraph()}).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){t.children(r).length||e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){e.setEdge(r,t.edge(r))})),e},successorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.outEdges(e),(function(e){r[e.w]=(r[e.w]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.inEdges(e),(function(e){r[e.v]=(r[e.v]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},intersectRect:function(t,e){var r,n,o=t.x,i=t.y,s=e.x-o,a=e.y-i,u=t.width/2,h=t.height/2;if(!s&&!a)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(a)*u>Math.abs(s)*h?(a<0&&(h=-h),r=h*s/a,n=h):(s<0&&(u=-u),r=u,n=u*a/s),{x:o+r,y:i+n}},buildLayerMatrix:function(t){var e=n.map(n.range(s(t)+1),(function(){return[]}));return n.forEach(t.nodes(),(function(r){var o=t.node(r),i=o.rank;n.isUndefined(i)||(e[i][o.order]=r)})),e},normalizeRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank})));n.forEach(t.nodes(),(function(r){var o=t.node(r);n.has(o,"rank")&&(o.rank-=e)}))},removeEmptyRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank}))),r=[];n.forEach(t.nodes(),(function(n){var o=t.node(n).rank-e;r[o]||(r[o]=[]),r[o].push(n)}));var o=0,i=t.graph().nodeRankFactor;n.forEach(r,(function(e,r){n.isUndefined(e)&&r%i!=0?--o:o&&n.forEach(e,(function(e){t.node(e).rank+=o}))}))},addBorderNode:function(t,e,r,n){var o={width:0,height:0};return arguments.length>=4&&(o.rank=r,o.order=n),i(t,"border",o,e)},maxRank:s,partition:function(t,e){var r={lhs:[],rhs:[]};return n.forEach(t,(function(t){e(t)?r.lhs.push(t):r.rhs.push(t)})),r},time:function(t,e){var r=n.now();try{return e()}finally{console.log(t+" time: "+(n.now()-r)+"ms")}},notime:function(t,e){return e()}}},6661:t=>{t.exports="0.8.5"},7423:(t,e,r)=>{var n=r(783);t.exports={Graph:n.Graph,json:r(2350),alg:r(2638),version:n.version}},3536:(t,e,r)=>{var n=r(782);t.exports=function(t){var e,r={},o=[];function i(o){n.has(r,o)||(r[o]=!0,e.push(o),n.each(t.successors(o),i),n.each(t.predecessors(o),i))}return n.each(t.nodes(),(function(t){e=[],i(t),e.length&&o.push(e)})),o}},4933:(t,e,r)=>{var n=r(782);function o(t,e,r,i,s,a){n.has(i,e)||(i[e]=!0,r||a.push(e),n.each(s(e),(function(e){o(t,e,r,i,s,a)})),r&&a.push(e))}t.exports=function(t,e,r){n.isArray(e)||(e=[e]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),s=[],a={};return n.each(e,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);o(t,e,"post"===r,a,i,s)})),s}},9032:(t,e,r)=>{var n=r(4102),o=r(782);t.exports=function(t,e,r){return o.transform(t.nodes(),(function(o,i){o[i]=n(t,i,e,r)}),{})}},4102:(t,e,r)=>{var n=r(782),o=r(2468);t.exports=function(t,e,r,n){return function(t,e,r,n){var i,s,a={},u=new o,h=function(t){var e=t.v!==i?t.v:t.w,n=a[e],o=r(t),h=s.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+o);h<n.distance&&(n.distance=h,n.predecessor=i,u.decrease(e,h))};for(t.nodes().forEach((function(t){var r=t===e?0:Number.POSITIVE_INFINITY;a[t]={distance:r},u.add(t,r)}));u.size()>0&&(i=u.removeMin(),(s=a[i]).distance!==Number.POSITIVE_INFINITY);)n(i).forEach(h);return a}(t,String(e),r||i,n||function(e){return t.outEdges(e)})};var i=n.constant(1)},3983:(t,e,r)=>{var n=r(782),o=r(3952);t.exports=function(t){return n.filter(o(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}},2329:(t,e,r)=>{var n=r(782);t.exports=function(t,e,r){return function(t,e,r){var n={},o=t.nodes();return o.forEach((function(t){n[t]={},n[t][t]={distance:0},o.forEach((function(e){t!==e&&(n[t][e]={distance:Number.POSITIVE_INFINITY})})),r(t).forEach((function(r){var o=r.v===t?r.w:r.v,i=e(r);n[t][o]={distance:i,predecessor:t}}))})),o.forEach((function(t){var e=n[t];o.forEach((function(r){var i=n[r];o.forEach((function(r){var n=i[t],o=e[r],s=i[r],a=n.distance+o.distance;a<s.distance&&(s.distance=a,s.predecessor=o.predecessor)}))}))})),n}(t,e||o,r||function(e){return t.outEdges(e)})};var o=n.constant(1)},2638:(t,e,r)=>{t.exports={components:r(3536),dijkstra:r(4102),dijkstraAll:r(9032),findCycles:r(3983),floydWarshall:r(2329),isAcyclic:r(8345),postorder:r(1600),preorder:r(39),prim:r(6280),tarjan:r(3952),topsort:r(7849)}},8345:(t,e,r)=>{var n=r(7849);t.exports=function(t){try{n(t)}catch(t){if(t instanceof n.CycleException)return!1;throw t}return!0}},1600:(t,e,r)=>{var n=r(4933);t.exports=function(t,e){return n(t,e,"post")}},39:(t,e,r)=>{var n=r(4933);t.exports=function(t,e){return n(t,e,"pre")}},6280:(t,e,r)=>{var n=r(782),o=r(1943),i=r(2468);t.exports=function(t,e){var r,s=new o,a={},u=new i;function h(t){var n=t.v===r?t.w:t.v,o=u.priority(n);if(void 0!==o){var i=e(t);i<o&&(a[n]=r,u.decrease(n,i))}}if(0===t.nodeCount())return s;n.each(t.nodes(),(function(t){u.add(t,Number.POSITIVE_INFINITY),s.setNode(t)})),u.decrease(t.nodes()[0],0);for(var d=!1;u.size()>0;){if(r=u.removeMin(),n.has(a,r))s.setEdge(r,a[r]);else{if(d)throw new Error("Input graph is not connected: "+t);d=!0}t.nodeEdges(r).forEach(h)}return s}},3952:(t,e,r)=>{var n=r(782);t.exports=function(t){var e=0,r=[],o={},i=[];function s(a){var u=o[a]={onStack:!0,lowlink:e,index:e++};if(r.push(a),t.successors(a).forEach((function(t){n.has(o,t)?o[t].onStack&&(u.lowlink=Math.min(u.lowlink,o[t].index)):(s(t),u.lowlink=Math.min(u.lowlink,o[t].lowlink))})),u.lowlink===u.index){var h,d=[];do{h=r.pop(),o[h].onStack=!1,d.push(h)}while(a!==h);i.push(d)}}return t.nodes().forEach((function(t){n.has(o,t)||s(t)})),i}},7849:(t,e,r)=>{var n=r(782);function o(t){var e={},r={},o=[];if(n.each(t.sinks(),(function s(a){if(n.has(r,a))throw new i;n.has(e,a)||(r[a]=!0,e[a]=!0,n.each(t.predecessors(a),s),delete r[a],o.push(a))})),n.size(e)!==t.nodeCount())throw new i;return o}function i(){}t.exports=o,o.CycleException=i,i.prototype=new Error},2468:(t,e,r)=>{var n=r(782);function o(){this._arr=[],this._keyIndices={}}t.exports=o,o.prototype.size=function(){return this._arr.length},o.prototype.keys=function(){return this._arr.map((function(t){return t.key}))},o.prototype.has=function(t){return n.has(this._keyIndices,t)},o.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},o.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},o.prototype.add=function(t,e){var r=this._keyIndices;if(t=String(t),!n.has(r,t)){var o=this._arr,i=o.length;return r[t]=i,o.push({key:t,priority:e}),this._decrease(i),!0}return!1},o.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},o.prototype.decrease=function(t,e){var r=this._keyIndices[t];if(e>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[r].priority+" New: "+e);this._arr[r].priority=e,this._decrease(r)},o.prototype._heapify=function(t){var e=this._arr,r=2*t,n=r+1,o=t;r<e.length&&(o=e[r].priority<e[o].priority?r:o,n<e.length&&(o=e[n].priority<e[o].priority?n:o),o!==t&&(this._swap(t,o),this._heapify(o)))},o.prototype._decrease=function(t){for(var e,r=this._arr,n=r[t].priority;0!==t&&!(r[e=t>>1].priority<n);)this._swap(t,e),t=e},o.prototype._swap=function(t,e){var r=this._arr,n=this._keyIndices,o=r[t],i=r[e];r[t]=i,r[e]=o,n[i.key]=t,n[o.key]=e}},1943:(t,e,r)=>{"use strict";var n=r(782);t.exports=a;var o="\0",i="\0",s="";function a(t){this._isDirected=!n.has(t,"directed")||t.directed,this._isMultigraph=!!n.has(t,"multigraph")&&t.multigraph,this._isCompound=!!n.has(t,"compound")&&t.compound,this._label=void 0,this._defaultNodeLabelFn=n.constant(void 0),this._defaultEdgeLabelFn=n.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[i]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function u(t,e){t[e]?t[e]++:t[e]=1}function h(t,e){--t[e]||delete t[e]}function d(t,e,r,i){var a=""+e,u=""+r;if(!t&&a>u){var h=a;a=u,u=h}return a+s+u+s+(n.isUndefined(i)?o:i)}function c(t,e){return d(t,e.v,e.w,e.name)}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(t){return this._label=t,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultNodeLabelFn=t,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return n.keys(this._nodes)},a.prototype.sources=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._in[e])}))},a.prototype.sinks=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._out[e])}))},a.prototype.setNodes=function(t,e){var r=arguments,o=this;return n.each(t,(function(t){r.length>1?o.setNode(t,e):o.setNode(t)})),this},a.prototype.setNode=function(t,e){return n.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=i,this._children[t]={},this._children[i][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},a.prototype.node=function(t){return this._nodes[t]},a.prototype.hasNode=function(t){return n.has(this._nodes,t)},a.prototype.removeNode=function(t){var e=this;if(n.has(this._nodes,t)){var r=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],n.each(this.children(t),(function(t){e.setParent(t)})),delete this._children[t]),n.each(n.keys(this._in[t]),r),delete this._in[t],delete this._preds[t],n.each(n.keys(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},a.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n.isUndefined(e))e=i;else{for(var r=e+="";!n.isUndefined(r);r=this.parent(r))if(r===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},a.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},a.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if(e!==i)return e}},a.prototype.children=function(t){if(n.isUndefined(t)&&(t=i),this._isCompound){var e=this._children[t];if(e)return n.keys(e)}else{if(t===i)return this.nodes();if(this.hasNode(t))return[]}},a.prototype.predecessors=function(t){var e=this._preds[t];if(e)return n.keys(e)},a.prototype.successors=function(t){var e=this._sucs[t];if(e)return n.keys(e)},a.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return n.union(e,this.successors(t))},a.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},a.prototype.filterNodes=function(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var r=this;n.each(this._nodes,(function(r,n){t(n)&&e.setNode(n,r)})),n.each(this._edgeObjs,(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,r.edge(t))}));var o={};function i(t){var n=r.parent(t);return void 0===n||e.hasNode(n)?(o[t]=n,n):n in o?o[n]:i(n)}return this._isCompound&&n.each(e.nodes(),(function(t){e.setParent(t,i(t))})),e},a.prototype.setDefaultEdgeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultEdgeLabelFn=t,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return n.values(this._edgeObjs)},a.prototype.setPath=function(t,e){var r=this,o=arguments;return n.reduce(t,(function(t,n){return o.length>1?r.setEdge(t,n,e):r.setEdge(t,n),n})),this},a.prototype.setEdge=function(){var t,e,r,o,i=!1,s=arguments[0];"object"==typeof s&&null!==s&&"v"in s?(t=s.v,e=s.w,r=s.name,2===arguments.length&&(o=arguments[1],i=!0)):(t=s,e=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],i=!0)),t=""+t,e=""+e,n.isUndefined(r)||(r=""+r);var a=d(this._isDirected,t,e,r);if(n.has(this._edgeLabels,a))return i&&(this._edgeLabels[a]=o),this;if(!n.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[a]=i?o:this._defaultEdgeLabelFn(t,e,r);var h=function(t,e,r,n){var o=""+e,i=""+r;if(!t&&o>i){var s=o;o=i,i=s}var a={v:o,w:i};return n&&(a.name=n),a}(this._isDirected,t,e,r);return t=h.v,e=h.w,Object.freeze(h),this._edgeObjs[a]=h,u(this._preds[e],t),u(this._sucs[t],e),this._in[e][a]=h,this._out[t][a]=h,this._edgeCount++,this},a.prototype.edge=function(t,e,r){var n=1===arguments.length?c(this._isDirected,arguments[0]):d(this._isDirected,t,e,r);return this._edgeLabels[n]},a.prototype.hasEdge=function(t,e,r){var o=1===arguments.length?c(this._isDirected,arguments[0]):d(this._isDirected,t,e,r);return n.has(this._edgeLabels,o)},a.prototype.removeEdge=function(t,e,r){var n=1===arguments.length?c(this._isDirected,arguments[0]):d(this._isDirected,t,e,r),o=this._edgeObjs[n];return o&&(t=o.v,e=o.w,delete this._edgeLabels[n],delete this._edgeObjs[n],h(this._preds[e],t),h(this._sucs[t],e),delete this._in[e][n],delete this._out[t][n],this._edgeCount--),this},a.prototype.inEdges=function(t,e){var r=this._in[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.v===e})):o}},a.prototype.outEdges=function(t,e){var r=this._out[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.w===e})):o}},a.prototype.nodeEdges=function(t,e){var r=this.inEdges(t,e);if(r)return r.concat(this.outEdges(t,e))}},783:(t,e,r)=>{t.exports={Graph:r(1943),version:r(1471)}},2350:(t,e,r)=>{var n=r(782),o=r(1943);function i(t){return n.map(t.nodes(),(function(e){var r=t.node(e),o=t.parent(e),i={v:e};return n.isUndefined(r)||(i.value=r),n.isUndefined(o)||(i.parent=o),i}))}function s(t){return n.map(t.edges(),(function(e){var r=t.edge(e),o={v:e.v,w:e.w};return n.isUndefined(e.name)||(o.name=e.name),n.isUndefined(r)||(o.value=r),o}))}t.exports={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:i(t),edges:s(t)};return n.isUndefined(t.graph())||(e.value=n.clone(t.graph())),e},read:function(t){var e=new o(t.options).setGraph(t.value);return n.each(t.nodes,(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)})),n.each(t.edges,(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),e}}},782:(t,e,r)=>{var n;try{n={clone:r(5402),constant:r(8295),each:r(958),filter:r(9969),has:r(4339),isArray:r(5874),isEmpty:r(2046),isFunction:r(7787),isUndefined:r(2895),keys:r(3511),map:r(9629),reduce:r(9285),size:r(3910),transform:r(3279),union:r(3344),values:r(3005)}}catch(t){}n||(n=window._),t.exports=n},1471:t=>{t.exports="2.1.8"},5229:(t,e,r)=>{"use strict";r.r(e),r.d(e,{isAnyArray:()=>o});const n=Object.prototype.toString;function o(t){const e=n.call(t);return e.endsWith("Array]")&&!e.includes("Big")}},6171:(t,e,r)=>{var n=r(4671)(r(714),"DataView");t.exports=n},6766:(t,e,r)=>{var n=r(2405),o=r(8341),i=r(9644),s=r(3784),a=r(6264);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},1022:(t,e,r)=>{var n=r(6821),o=r(7221),i=r(1596),s=r(1992),a=r(552);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},5870:(t,e,r)=>{var n=r(4671)(r(714),"Map");t.exports=n},8910:(t,e,r)=>{var n=r(4069),o=r(7477),i=r(476),s=r(984),a=r(4136);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},4665:(t,e,r)=>{var n=r(4671)(r(714),"Promise");t.exports=n},9612:(t,e,r)=>{var n=r(4671)(r(714),"Set");t.exports=n},2312:(t,e,r)=>{var n=r(8910),o=r(1945),i=r(4874);function s(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new n;++e<r;)this.add(t[e])}s.prototype.add=s.prototype.push=o,s.prototype.has=i,t.exports=s},7216:(t,e,r)=>{var n=r(1022),o=r(5331),i=r(7063),s=r(134),a=r(9842),u=r(9850);function h(t){var e=this.__data__=new n(t);this.size=e.size}h.prototype.clear=o,h.prototype.delete=i,h.prototype.get=s,h.prototype.has=a,h.prototype.set=u,t.exports=h},9006:(t,e,r)=>{var n=r(714).Symbol;t.exports=n},8851:(t,e,r)=>{var n=r(714).Uint8Array;t.exports=n},8154:(t,e,r)=>{var n=r(4671)(r(714),"WeakMap");t.exports=n},7156:t=>{t.exports=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}},7012:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}},2995:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var s=t[r];e(s,r,t)&&(i[o++]=s)}return i}},128:(t,e,r)=>{var n=r(8506);t.exports=function(t,e){return!(null==t||!t.length)&&n(t,e,0)>-1}},6184:t=>{t.exports=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1}},9754:(t,e,r)=>{var n=r(9605),o=r(79),i=r(5874),s=r(3601),a=r(1908),u=r(9046),h=Object.prototype.hasOwnProperty;t.exports=function(t,e){var r=i(t),d=!r&&o(t),c=!r&&!d&&s(t),l=!r&&!d&&!c&&u(t),f=r||d||c||l,g=f?n(t.length,String):[],p=g.length;for(var v in t)!e&&!h.call(t,v)||f&&("length"==v||c&&("offset"==v||"parent"==v)||l&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||a(v,p))||g.push(v);return g}},2275:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}},2525:t=>{t.exports=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}},8663:t=>{t.exports=function(t,e,r,n){var o=-1,i=null==t?0:t.length;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}},3525:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}},446:(t,e,r)=>{var n=r(8494)("length");t.exports=n},2430:(t,e,r)=>{var n=r(3077),o=r(5097);t.exports=function(t,e,r){(void 0!==r&&!o(t[e],r)||void 0===r&&!(e in t))&&n(t,e,r)}},5802:(t,e,r)=>{var n=r(3077),o=r(5097),i=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){var s=t[e];i.call(t,e)&&o(s,r)&&(void 0!==r||e in t)||n(t,e,r)}},9438:(t,e,r)=>{var n=r(5097);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},6902:(t,e,r)=>{var n=r(5532),o=r(3511);t.exports=function(t,e){return t&&n(e,o(e),t)}},5873:(t,e,r)=>{var n=r(5532),o=r(2844);t.exports=function(t,e){return t&&n(e,o(e),t)}},3077:(t,e,r)=>{var n=r(4856);t.exports=function(t,e,r){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}},9018:(t,e,r)=>{var n=r(7216),o=r(7012),i=r(5802),s=r(6902),a=r(5873),u=r(6743),h=r(310),d=r(5590),c=r(2209),l=r(2573),f=r(3918),g=r(9778),p=r(5290),v=r(4028),m=r(9168),y=r(5874),w=r(3601),x=r(4725),b=r(9400),E=r(7363),N=r(3511),M=r(2844),_="[object Arguments]",k="[object Function]",A="[object Object]",j={};j[_]=j["[object Array]"]=j["[object ArrayBuffer]"]=j["[object DataView]"]=j["[object Boolean]"]=j["[object Date]"]=j["[object Float32Array]"]=j["[object Float64Array]"]=j["[object Int8Array]"]=j["[object Int16Array]"]=j["[object Int32Array]"]=j["[object Map]"]=j["[object Number]"]=j[A]=j["[object RegExp]"]=j["[object Set]"]=j["[object String]"]=j["[object Symbol]"]=j["[object Uint8Array]"]=j["[object Uint8ClampedArray]"]=j["[object Uint16Array]"]=j["[object Uint32Array]"]=!0,j["[object Error]"]=j[k]=j["[object WeakMap]"]=!1,t.exports=function t(e,r,S,O,z,R){var I,C=1&r,D=2&r,P=4&r;if(S&&(I=z?S(e,O,z,R):S(e)),void 0!==I)return I;if(!b(e))return e;var T=y(e);if(T){if(I=p(e),!C)return h(e,I)}else{var L=g(e),F=L==k||"[object GeneratorFunction]"==L;if(w(e))return u(e,C);if(L==A||L==_||F&&!z){if(I=D||F?{}:m(e),!C)return D?c(e,a(I,e)):d(e,s(I,e))}else{if(!j[L])return z?e:{};I=v(e,L,C)}}R||(R=new n);var q=R.get(e);if(q)return q;R.set(e,I),E(e)?e.forEach((function(n){I.add(t(n,r,S,n,e,R))})):x(e)&&e.forEach((function(n,o){I.set(o,t(n,r,S,o,e,R))}));var V=T?void 0:(P?D?f:l:D?M:N)(e);return o(V||e,(function(n,o){V&&(n=e[o=n]),i(I,o,t(n,r,S,o,e,R))})),I}},1095:(t,e,r)=>{var n=r(9400),o=Object.create,i=function(){function t(){}return function(e){if(!n(e))return{};if(o)return o(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();t.exports=i},830:(t,e,r)=>{var n=r(7702),o=r(8678)(n);t.exports=o},5816:(t,e,r)=>{var n=r(975);t.exports=function(t,e,r){for(var o=-1,i=t.length;++o<i;){var s=t[o],a=e(s);if(null!=a&&(void 0===u?a==a&&!n(a):r(a,u)))var u=a,h=s}return h}},1329:(t,e,r)=>{var n=r(830);t.exports=function(t,e){var r=[];return n(t,(function(t,n,o){e(t,n,o)&&r.push(t)})),r}},166:t=>{t.exports=function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1}},9821:(t,e,r)=>{var n=r(2525),o=r(3542);t.exports=function t(e,r,i,s,a){var u=-1,h=e.length;for(i||(i=o),a||(a=[]);++u<h;){var d=e[u];r>0&&i(d)?r>1?t(d,r-1,i,s,a):n(a,d):s||(a[a.length]=d)}return a}},9128:(t,e,r)=>{var n=r(3600)();t.exports=n},7702:(t,e,r)=>{var n=r(9128),o=r(3511);t.exports=function(t,e){return t&&n(t,e,o)}},1855:(t,e,r)=>{var n=r(330),o=r(9628);t.exports=function(t,e){for(var r=0,i=(e=n(e,t)).length;null!=t&&r<i;)t=t[o(e[r++])];return r&&r==i?t:void 0}},5920:(t,e,r)=>{var n=r(2525),o=r(5874);t.exports=function(t,e,r){var i=e(t);return o(t)?i:n(i,r(t))}},5271:(t,e,r)=>{var n=r(9006),o=r(9650),i=r(6881),s=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":s&&s in Object(t)?o(t):i(t)}},4116:t=>{t.exports=function(t,e){return t>e}},3091:t=>{var e=Object.prototype.hasOwnProperty;t.exports=function(t,r){return null!=t&&e.call(t,r)}},5088:t=>{t.exports=function(t,e){return null!=t&&e in Object(t)}},8506:(t,e,r)=>{var n=r(166),o=r(8306),i=r(638);t.exports=function(t,e,r){return e==e?i(t,e,r):n(t,o,r)}},4047:(t,e,r)=>{var n=r(5271),o=r(7583);t.exports=function(t){return o(t)&&"[object Arguments]"==n(t)}},3899:(t,e,r)=>{var n=r(8309),o=r(7583);t.exports=function t(e,r,i,s,a){return e===r||(null==e||null==r||!o(e)&&!o(r)?e!=e&&r!=r:n(e,r,i,s,t,a))}},8309:(t,e,r)=>{var n=r(7216),o=r(3522),i=r(9481),s=r(8370),a=r(9778),u=r(5874),h=r(3601),d=r(9046),c="[object Arguments]",l="[object Array]",f="[object Object]",g=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,p,v,m){var y=u(t),w=u(e),x=y?l:a(t),b=w?l:a(e),E=(x=x==c?f:x)==f,N=(b=b==c?f:b)==f,M=x==b;if(M&&h(t)){if(!h(e))return!1;y=!0,E=!1}if(M&&!E)return m||(m=new n),y||d(t)?o(t,e,r,p,v,m):i(t,e,x,r,p,v,m);if(!(1&r)){var _=E&&g.call(t,"__wrapped__"),k=N&&g.call(e,"__wrapped__");if(_||k){var A=_?t.value():t,j=k?e.value():e;return m||(m=new n),v(A,j,r,p,m)}}return!!M&&(m||(m=new n),s(t,e,r,p,v,m))}},4965:(t,e,r)=>{var n=r(9778),o=r(7583);t.exports=function(t){return o(t)&&"[object Map]"==n(t)}},4014:(t,e,r)=>{var n=r(7216),o=r(3899);t.exports=function(t,e,r,i){var s=r.length,a=s,u=!i;if(null==t)return!a;for(t=Object(t);s--;){var h=r[s];if(u&&h[2]?h[1]!==t[h[0]]:!(h[0]in t))return!1}for(;++s<a;){var d=(h=r[s])[0],c=t[d],l=h[1];if(u&&h[2]){if(void 0===c&&!(d in t))return!1}else{var f=new n;if(i)var g=i(c,l,d,t,e,f);if(!(void 0===g?o(l,c,3,i,f):g))return!1}}return!0}},8306:t=>{t.exports=function(t){return t!=t}},4228:(t,e,r)=>{var n=r(7787),o=r(7827),i=r(9400),s=r(462),a=/^\[object .+?Constructor\]$/,u=Function.prototype,h=Object.prototype,d=u.toString,c=h.hasOwnProperty,l=RegExp("^"+d.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!i(t)||o(t))&&(n(t)?l:a).test(s(t))}},6499:(t,e,r)=>{var n=r(9778),o=r(7583);t.exports=function(t){return o(t)&&"[object Set]"==n(t)}},550:(t,e,r)=>{var n=r(5271),o=r(4583),i=r(7583),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,t.exports=function(t){return i(t)&&o(t.length)&&!!s[n(t)]}},4506:(t,e,r)=>{var n=r(6330),o=r(2363),i=r(9169),s=r(5874),a=r(6830);t.exports=function(t){return"function"==typeof t?t:null==t?i:"object"==typeof t?s(t)?o(t[0],t[1]):n(t):a(t)}},5351:(t,e,r)=>{var n=r(7894),o=r(2325),i=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return o(t);var e=[];for(var r in Object(t))i.call(t,r)&&"constructor"!=r&&e.push(r);return e}},1500:(t,e,r)=>{var n=r(9400),o=r(7894),i=r(5382),s=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return i(t);var e=o(t),r=[];for(var a in t)("constructor"!=a||!e&&s.call(t,a))&&r.push(a);return r}},2795:t=>{t.exports=function(t,e){return t<e}},4733:(t,e,r)=>{var n=r(830),o=r(3069);t.exports=function(t,e){var r=-1,i=o(t)?Array(t.length):[];return n(t,(function(t,n,o){i[++r]=e(t,n,o)})),i}},6330:(t,e,r)=>{var n=r(4014),o=r(6539),i=r(7316);t.exports=function(t){var e=o(t);return 1==e.length&&e[0][2]?i(e[0][0],e[0][1]):function(r){return r===t||n(r,t,e)}}},2363:(t,e,r)=>{var n=r(3899),o=r(5887),i=r(4016),s=r(759),a=r(7223),u=r(7316),h=r(9628);t.exports=function(t,e){return s(t)&&a(e)?u(h(t),e):function(r){var s=o(r,t);return void 0===s&&s===e?i(r,t):n(e,s,3)}}},4479:(t,e,r)=>{var n=r(7216),o=r(2430),i=r(9128),s=r(3857),a=r(9400),u=r(2844),h=r(6127);t.exports=function t(e,r,d,c,l){e!==r&&i(r,(function(i,u){if(l||(l=new n),a(i))s(e,r,u,d,t,c,l);else{var f=c?c(h(e,u),i,u+"",e,r,l):void 0;void 0===f&&(f=i),o(e,u,f)}}),u)}},3857:(t,e,r)=>{var n=r(2430),o=r(6743),i=r(1532),s=r(310),a=r(9168),u=r(79),h=r(5874),d=r(6882),c=r(3601),l=r(7787),f=r(9400),g=r(4108),p=r(9046),v=r(6127),m=r(339);t.exports=function(t,e,r,y,w,x,b){var E=v(t,r),N=v(e,r),M=b.get(N);if(M)n(t,r,M);else{var _=x?x(E,N,r+"",t,e,b):void 0,k=void 0===_;if(k){var A=h(N),j=!A&&c(N),S=!A&&!j&&p(N);_=N,A||j||S?h(E)?_=E:d(E)?_=s(E):j?(k=!1,_=o(N,!0)):S?(k=!1,_=i(N,!0)):_=[]:g(N)||u(N)?(_=E,u(E)?_=m(E):f(E)&&!l(E)||(_=a(N))):k=!1}k&&(b.set(N,_),w(_,N,y,x,b),b.delete(N)),n(t,r,_)}}},9586:(t,e,r)=>{var n=r(2275),o=r(1855),i=r(4506),s=r(4733),a=r(7070),u=r(8232),h=r(6395),d=r(9169),c=r(5874);t.exports=function(t,e,r){e=e.length?n(e,(function(t){return c(t)?function(e){return o(e,1===t.length?t[0]:t)}:t})):[d];var l=-1;e=n(e,u(i));var f=s(t,(function(t,r,o){return{criteria:n(e,(function(e){return e(t)})),index:++l,value:t}}));return a(f,(function(t,e){return h(t,e,r)}))}},4286:(t,e,r)=>{var n=r(8499),o=r(4016);t.exports=function(t,e){return n(t,e,(function(e,r){return o(t,r)}))}},8499:(t,e,r)=>{var n=r(1855),o=r(9435),i=r(330);t.exports=function(t,e,r){for(var s=-1,a=e.length,u={};++s<a;){var h=e[s],d=n(t,h);r(d,h)&&o(u,i(h,t),d)}return u}},8494:t=>{t.exports=function(t){return function(e){return null==e?void 0:e[t]}}},3644:(t,e,r)=>{var n=r(1855);t.exports=function(t){return function(e){return n(e,t)}}},8514:t=>{var e=Math.ceil,r=Math.max;t.exports=function(t,n,o,i){for(var s=-1,a=r(e((n-t)/(o||1)),0),u=Array(a);a--;)u[i?a:++s]=t,t+=o;return u}},8421:t=>{t.exports=function(t,e,r,n,o){return o(t,(function(t,o,i){r=n?(n=!1,t):e(r,t,o,i)})),r}},6965:(t,e,r)=>{var n=r(9169),o=r(5390),i=r(3232);t.exports=function(t,e){return i(o(t,e,n),t+"")}},9435:(t,e,r)=>{var n=r(5802),o=r(330),i=r(1908),s=r(9400),a=r(9628);t.exports=function(t,e,r,u){if(!s(t))return t;for(var h=-1,d=(e=o(e,t)).length,c=d-1,l=t;null!=l&&++h<d;){var f=a(e[h]),g=r;if("__proto__"===f||"constructor"===f||"prototype"===f)return t;if(h!=c){var p=l[f];void 0===(g=u?u(p,f,l):void 0)&&(g=s(p)?p:i(e[h+1])?[]:{})}n(l,f,g),l=l[f]}return t}},3431:(t,e,r)=>{var n=r(8295),o=r(4856),i=r(9169),s=o?function(t,e){return o(t,"toString",{configurable:!0,enumerable:!1,value:n(e),writable:!0})}:i;t.exports=s},7070:t=>{t.exports=function(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}},9605:t=>{t.exports=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}},8071:(t,e,r)=>{var n=r(9006),o=r(2275),i=r(5874),s=r(975),a=n?n.prototype:void 0,u=a?a.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(i(e))return o(e,t)+"";if(s(e))return u?u.call(e):"";var r=e+"";return"0"==r&&1/e==-1/0?"-0":r}},5103:(t,e,r)=>{var n=r(4997),o=/^\s+/;t.exports=function(t){return t?t.slice(0,n(t)+1).replace(o,""):t}},8232:t=>{t.exports=function(t){return function(e){return t(e)}}},3434:(t,e,r)=>{var n=r(2312),o=r(128),i=r(6184),s=r(5420),a=r(2196),u=r(6968);t.exports=function(t,e,r){var h=-1,d=o,c=t.length,l=!0,f=[],g=f;if(r)l=!1,d=i;else if(c>=200){var p=e?null:a(t);if(p)return u(p);l=!1,d=s,g=new n}else g=e?[]:f;t:for(;++h<c;){var v=t[h],m=e?e(v):v;if(v=r||0!==v?v:0,l&&m==m){for(var y=g.length;y--;)if(g[y]===m)continue t;e&&g.push(m),f.push(v)}else d(g,m,r)||(g!==f&&g.push(m),f.push(v))}return f}},989:(t,e,r)=>{var n=r(2275);t.exports=function(t,e){return n(e,(function(e){return t[e]}))}},2543:t=>{t.exports=function(t,e,r){for(var n=-1,o=t.length,i=e.length,s={};++n<o;){var a=n<i?e[n]:void 0;r(s,t[n],a)}return s}},5420:t=>{t.exports=function(t,e){return t.has(e)}},4041:(t,e,r)=>{var n=r(9169);t.exports=function(t){return"function"==typeof t?t:n}},330:(t,e,r)=>{var n=r(5874),o=r(759),i=r(9505),s=r(983);t.exports=function(t,e){return n(t)?t:o(t,e)?[t]:i(s(t))}},9270:(t,e,r)=>{var n=r(8851);t.exports=function(t){var e=new t.constructor(t.byteLength);return new n(e).set(new n(t)),e}},6743:(t,e,r)=>{t=r.nmd(t);var n=r(714),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o?n.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=a?a(r):new t.constructor(r);return t.copy(n),n}},5940:(t,e,r)=>{var n=r(9270);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}},5320:t=>{var e=/\w*$/;t.exports=function(t){var r=new t.constructor(t.source,e.exec(t));return r.lastIndex=t.lastIndex,r}},4937:(t,e,r)=>{var n=r(9006),o=n?n.prototype:void 0,i=o?o.valueOf:void 0;t.exports=function(t){return i?Object(i.call(t)):{}}},1532:(t,e,r)=>{var n=r(9270);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}},1141:(t,e,r)=>{var n=r(975);t.exports=function(t,e){if(t!==e){var r=void 0!==t,o=null===t,i=t==t,s=n(t),a=void 0!==e,u=null===e,h=e==e,d=n(e);if(!u&&!d&&!s&&t>e||s&&a&&h&&!u&&!d||o&&a&&h||!r&&h||!i)return 1;if(!o&&!s&&!d&&t<e||d&&r&&i&&!o&&!s||u&&r&&i||!a&&i||!h)return-1}return 0}},6395:(t,e,r)=>{var n=r(1141);t.exports=function(t,e,r){for(var o=-1,i=t.criteria,s=e.criteria,a=i.length,u=r.length;++o<a;){var h=n(i[o],s[o]);if(h)return o>=u?h:h*("desc"==r[o]?-1:1)}return t.index-e.index}},310:t=>{t.exports=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}},5532:(t,e,r)=>{var n=r(5802),o=r(3077);t.exports=function(t,e,r,i){var s=!r;r||(r={});for(var a=-1,u=e.length;++a<u;){var h=e[a],d=i?i(r[h],t[h],h,r,t):void 0;void 0===d&&(d=t[h]),s?o(r,h,d):n(r,h,d)}return r}},5590:(t,e,r)=>{var n=r(5532),o=r(9183);t.exports=function(t,e){return n(t,o(t),e)}},2209:(t,e,r)=>{var n=r(5532),o=r(596);t.exports=function(t,e){return n(t,o(t),e)}},6450:(t,e,r)=>{var n=r(714)["__core-js_shared__"];t.exports=n},1292:(t,e,r)=>{var n=r(6965),o=r(8819);t.exports=function(t){return n((function(e,r){var n=-1,i=r.length,s=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(s=t.length>3&&"function"==typeof s?(i--,s):void 0,a&&o(r[0],r[1],a)&&(s=i<3?void 0:s,i=1),e=Object(e);++n<i;){var u=r[n];u&&t(e,u,n,s)}return e}))}},8678:(t,e,r)=>{var n=r(3069);t.exports=function(t,e){return function(r,o){if(null==r)return r;if(!n(r))return t(r,o);for(var i=r.length,s=e?i:-1,a=Object(r);(e?s--:++s<i)&&!1!==o(a[s],s,a););return r}}},3600:t=>{t.exports=function(t){return function(e,r,n){for(var o=-1,i=Object(e),s=n(e),a=s.length;a--;){var u=s[t?a:++o];if(!1===r(i[u],u,i))break}return e}}},6057:(t,e,r)=>{var n=r(4506),o=r(3069),i=r(3511);t.exports=function(t){return function(e,r,s){var a=Object(e);if(!o(e)){var u=n(r,3);e=i(e),r=function(t){return u(a[t],t,a)}}var h=t(e,r,s);return h>-1?a[u?e[h]:h]:void 0}}},4590:(t,e,r)=>{var n=r(8514),o=r(8819),i=r(8265);t.exports=function(t){return function(e,r,s){return s&&"number"!=typeof s&&o(e,r,s)&&(r=s=void 0),e=i(e),void 0===r?(r=e,e=0):r=i(r),s=void 0===s?e<r?1:-1:i(s),n(e,r,s,t)}}},2196:(t,e,r)=>{var n=r(9612),o=r(3883),i=r(6968),s=n&&1/i(new n([,-0]))[1]==1/0?function(t){return new n(t)}:o;t.exports=s},4856:(t,e,r)=>{var n=r(4671),o=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},3522:(t,e,r)=>{var n=r(2312),o=r(3525),i=r(5420);t.exports=function(t,e,r,s,a,u){var h=1&r,d=t.length,c=e.length;if(d!=c&&!(h&&c>d))return!1;var l=u.get(t),f=u.get(e);if(l&&f)return l==e&&f==t;var g=-1,p=!0,v=2&r?new n:void 0;for(u.set(t,e),u.set(e,t);++g<d;){var m=t[g],y=e[g];if(s)var w=h?s(y,m,g,e,t,u):s(m,y,g,t,e,u);if(void 0!==w){if(w)continue;p=!1;break}if(v){if(!o(e,(function(t,e){if(!i(v,e)&&(m===t||a(m,t,r,s,u)))return v.push(e)}))){p=!1;break}}else if(m!==y&&!a(m,y,r,s,u)){p=!1;break}}return u.delete(t),u.delete(e),p}},9481:(t,e,r)=>{var n=r(9006),o=r(8851),i=r(5097),s=r(3522),a=r(8866),u=r(6968),h=n?n.prototype:void 0,d=h?h.valueOf:void 0;t.exports=function(t,e,r,n,h,c,l){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!c(new o(t),new o(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var f=a;case"[object Set]":var g=1&n;if(f||(f=u),t.size!=e.size&&!g)return!1;var p=l.get(t);if(p)return p==e;n|=2,l.set(t,e);var v=s(f(t),f(e),n,h,c,l);return l.delete(t),v;case"[object Symbol]":if(d)return d.call(t)==d.call(e)}return!1}},8370:(t,e,r)=>{var n=r(2573),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,i,s,a){var u=1&r,h=n(t),d=h.length;if(d!=n(e).length&&!u)return!1;for(var c=d;c--;){var l=h[c];if(!(u?l in e:o.call(e,l)))return!1}var f=a.get(t),g=a.get(e);if(f&&g)return f==e&&g==t;var p=!0;a.set(t,e),a.set(e,t);for(var v=u;++c<d;){var m=t[l=h[c]],y=e[l];if(i)var w=u?i(y,m,l,e,t,a):i(m,y,l,t,e,a);if(!(void 0===w?m===y||s(m,y,r,i,a):w)){p=!1;break}v||(v="constructor"==l)}if(p&&!v){var x=t.constructor,b=e.constructor;x==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof x&&x instanceof x&&"function"==typeof b&&b instanceof b||(p=!1)}return a.delete(t),a.delete(e),p}},4139:(t,e,r)=>{var n=r(7469),o=r(5390),i=r(3232);t.exports=function(t){return i(o(t,void 0,n),t+"")}},1603:(t,e,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;t.exports=n},2573:(t,e,r)=>{var n=r(5920),o=r(9183),i=r(3511);t.exports=function(t){return n(t,i,o)}},3918:(t,e,r)=>{var n=r(5920),o=r(596),i=r(2844);t.exports=function(t){return n(t,i,o)}},1200:(t,e,r)=>{var n=r(95);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},6539:(t,e,r)=>{var n=r(7223),o=r(3511);t.exports=function(t){for(var e=o(t),r=e.length;r--;){var i=e[r],s=t[i];e[r]=[i,s,n(s)]}return e}},4671:(t,e,r)=>{var n=r(4228),o=r(7559);t.exports=function(t,e){var r=o(t,e);return n(r)?r:void 0}},7556:(t,e,r)=>{var n=r(8546)(Object.getPrototypeOf,Object);t.exports=n},9650:(t,e,r)=>{var n=r(9006),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,a=n?n.toStringTag:void 0;t.exports=function(t){var e=i.call(t,a),r=t[a];try{t[a]=void 0;var n=!0}catch(t){}var o=s.call(t);return n&&(e?t[a]=r:delete t[a]),o}},9183:(t,e,r)=>{var n=r(2995),o=r(2982),i=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,a=s?function(t){return null==t?[]:(t=Object(t),n(s(t),(function(e){return i.call(t,e)})))}:o;t.exports=a},596:(t,e,r)=>{var n=r(2525),o=r(7556),i=r(9183),s=r(2982),a=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)n(e,i(t)),t=o(t);return e}:s;t.exports=a},9778:(t,e,r)=>{var n=r(6171),o=r(5870),i=r(4665),s=r(9612),a=r(8154),u=r(5271),h=r(462),d="[object Map]",c="[object Promise]",l="[object Set]",f="[object WeakMap]",g="[object DataView]",p=h(n),v=h(o),m=h(i),y=h(s),w=h(a),x=u;(n&&x(new n(new ArrayBuffer(1)))!=g||o&&x(new o)!=d||i&&x(i.resolve())!=c||s&&x(new s)!=l||a&&x(new a)!=f)&&(x=function(t){var e=u(t),r="[object Object]"==e?t.constructor:void 0,n=r?h(r):"";if(n)switch(n){case p:return g;case v:return d;case m:return c;case y:return l;case w:return f}return e}),t.exports=x},7559:t=>{t.exports=function(t,e){return null==t?void 0:t[e]}},9663:(t,e,r)=>{var n=r(330),o=r(79),i=r(5874),s=r(1908),a=r(4583),u=r(9628);t.exports=function(t,e,r){for(var h=-1,d=(e=n(e,t)).length,c=!1;++h<d;){var l=u(e[h]);if(!(c=null!=t&&r(t,l)))break;t=t[l]}return c||++h!=d?c:!!(d=null==t?0:t.length)&&a(d)&&s(l,d)&&(i(t)||o(t))}},3493:t=>{var e=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");t.exports=function(t){return e.test(t)}},2405:(t,e,r)=>{var n=r(8637);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},8341:t=>{t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},9644:(t,e,r)=>{var n=r(8637),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return o.call(e,t)?e[t]:void 0}},3784:(t,e,r)=>{var n=r(8637),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:o.call(e,t)}},6264:(t,e,r)=>{var n=r(8637);t.exports=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},5290:t=>{var e=Object.prototype.hasOwnProperty;t.exports=function(t){var r=t.length,n=new t.constructor(r);return r&&"string"==typeof t[0]&&e.call(t,"index")&&(n.index=t.index,n.input=t.input),n}},4028:(t,e,r)=>{var n=r(9270),o=r(5940),i=r(5320),s=r(4937),a=r(1532);t.exports=function(t,e,r){var u=t.constructor;switch(e){case"[object ArrayBuffer]":return n(t);case"[object Boolean]":case"[object Date]":return new u(+t);case"[object DataView]":return o(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return a(t,r);case"[object Map]":case"[object Set]":return new u;case"[object Number]":case"[object String]":return new u(t);case"[object RegExp]":return i(t);case"[object Symbol]":return s(t)}}},9168:(t,e,r)=>{var n=r(1095),o=r(7556),i=r(7894);t.exports=function(t){return"function"!=typeof t.constructor||i(t)?{}:n(o(t))}},3542:(t,e,r)=>{var n=r(9006),o=r(79),i=r(5874),s=n?n.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(s&&t&&t[s])}},1908:t=>{var e=/^(?:0|[1-9]\d*)$/;t.exports=function(t,r){var n=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<r}},8819:(t,e,r)=>{var n=r(5097),o=r(3069),i=r(1908),s=r(9400);t.exports=function(t,e,r){if(!s(r))return!1;var a=typeof e;return!!("number"==a?o(r)&&i(e,r.length):"string"==a&&e in r)&&n(r[e],t)}},759:(t,e,r)=>{var n=r(5874),o=r(975),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;t.exports=function(t,e){if(n(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!o(t))||s.test(t)||!i.test(t)||null!=e&&t in Object(e)}},95:t=>{t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},7827:(t,e,r)=>{var n,o=r(6450),i=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!i&&i in t}},7894:t=>{var e=Object.prototype;t.exports=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}},7223:(t,e,r)=>{var n=r(9400);t.exports=function(t){return t==t&&!n(t)}},6821:t=>{t.exports=function(){this.__data__=[],this.size=0}},7221:(t,e,r)=>{var n=r(9438),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,r=n(e,t);return!(r<0||(r==e.length-1?e.pop():o.call(e,r,1),--this.size,0))}},1596:(t,e,r)=>{var n=r(9438);t.exports=function(t){var e=this.__data__,r=n(e,t);return r<0?void 0:e[r][1]}},1992:(t,e,r)=>{var n=r(9438);t.exports=function(t){return n(this.__data__,t)>-1}},552:(t,e,r)=>{var n=r(9438);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}},4069:(t,e,r)=>{var n=r(6766),o=r(1022),i=r(5870);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},7477:(t,e,r)=>{var n=r(1200);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},476:(t,e,r)=>{var n=r(1200);t.exports=function(t){return n(this,t).get(t)}},984:(t,e,r)=>{var n=r(1200);t.exports=function(t){return n(this,t).has(t)}},4136:(t,e,r)=>{var n=r(1200);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},8866:t=>{t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}},7316:t=>{t.exports=function(t,e){return function(r){return null!=r&&r[t]===e&&(void 0!==e||t in Object(r))}}},2121:(t,e,r)=>{var n=r(8487);t.exports=function(t){var e=n(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}},8637:(t,e,r)=>{var n=r(4671)(Object,"create");t.exports=n},2325:(t,e,r)=>{var n=r(8546)(Object.keys,Object);t.exports=n},5382:t=>{t.exports=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}},6574:(t,e,r)=>{t=r.nmd(t);var n=r(1603),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o&&n.process,a=function(){try{return i&&i.require&&i.require("util").types||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=a},6881:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},8546:t=>{t.exports=function(t,e){return function(r){return t(e(r))}}},5390:(t,e,r)=>{var n=r(7156),o=Math.max;t.exports=function(t,e,r){return e=o(void 0===e?t.length-1:e,0),function(){for(var i=arguments,s=-1,a=o(i.length-e,0),u=Array(a);++s<a;)u[s]=i[e+s];s=-1;for(var h=Array(e+1);++s<e;)h[s]=i[s];return h[e]=r(u),n(t,this,h)}}},714:(t,e,r)=>{var n=r(1603),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},6127:t=>{t.exports=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}},1945:t=>{t.exports=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}},4874:t=>{t.exports=function(t){return this.__data__.has(t)}},6968:t=>{t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}},3232:(t,e,r)=>{var n=r(3431),o=r(1824)(n);t.exports=o},1824:t=>{var e=Date.now;t.exports=function(t){var r=0,n=0;return function(){var o=e(),i=16-(o-n);if(n=o,i>0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}},5331:(t,e,r)=>{var n=r(1022);t.exports=function(){this.__data__=new n,this.size=0}},7063:t=>{t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},134:t=>{t.exports=function(t){return this.__data__.get(t)}},9842:t=>{t.exports=function(t){return this.__data__.has(t)}},9850:(t,e,r)=>{var n=r(1022),o=r(5870),i=r(8910);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var s=r.__data__;if(!o||s.length<199)return s.push([t,e]),this.size=++r.size,this;r=this.__data__=new i(s)}return r.set(t,e),this.size=r.size,this}},638:t=>{t.exports=function(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}},6742:(t,e,r)=>{var n=r(446),o=r(3493),i=r(3870);t.exports=function(t){return o(t)?i(t):n(t)}},9505:(t,e,r)=>{var n=r(2121),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,s=n((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(o,(function(t,r,n,o){e.push(n?o.replace(i,"$1"):r||t)})),e}));t.exports=s},9628:(t,e,r)=>{var n=r(975);t.exports=function(t){if("string"==typeof t||n(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}},462:t=>{var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},4997:t=>{var e=/\s/;t.exports=function(t){for(var r=t.length;r--&&e.test(t.charAt(r)););return r}},3870:t=>{var e="\\ud800-\\udfff",r="["+e+"]",n="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",o="\\ud83c[\\udffb-\\udfff]",i="[^"+e+"]",s="(?:\\ud83c[\\udde6-\\uddff]){2}",a="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:"+n+"|"+o+")?",h="[\\ufe0e\\ufe0f]?",d=h+u+"(?:\\u200d(?:"+[i,s,a].join("|")+")"+h+u+")*",c="(?:"+[i+n+"?",n,s,a,r].join("|")+")",l=RegExp(o+"(?="+o+")|"+c+d,"g");t.exports=function(t){for(var e=l.lastIndex=0;l.test(t);)++e;return e}},5402:(t,e,r)=>{var n=r(9018);t.exports=function(t){return n(t,4)}},9136:(t,e,r)=>{var n=r(9018);t.exports=function(t){return n(t,5)}},8295:t=>{t.exports=function(t){return function(){return t}}},9529:(t,e,r)=>{var n=r(6965),o=r(5097),i=r(8819),s=r(2844),a=Object.prototype,u=a.hasOwnProperty,h=n((function(t,e){t=Object(t);var r=-1,n=e.length,h=n>2?e[2]:void 0;for(h&&i(e[0],e[1],h)&&(n=1);++r<n;)for(var d=e[r],c=s(d),l=-1,f=c.length;++l<f;){var g=c[l],p=t[g];(void 0===p||o(p,a[g])&&!u.call(t,g))&&(t[g]=d[g])}return t}));t.exports=h},958:(t,e,r)=>{t.exports=r(1117)},5097:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},9969:(t,e,r)=>{var n=r(2995),o=r(1329),i=r(4506),s=r(5874);t.exports=function(t,e){return(s(t)?n:o)(t,i(e,3))}},828:(t,e,r)=>{var n=r(6057)(r(8550));t.exports=n},8550:(t,e,r)=>{var n=r(166),o=r(4506),i=r(3758),s=Math.max;t.exports=function(t,e,r){var a=null==t?0:t.length;if(!a)return-1;var u=null==r?0:i(r);return u<0&&(u=s(a+u,0)),n(t,o(e,3),u)}},7469:(t,e,r)=>{var n=r(9821);t.exports=function(t){return null!=t&&t.length?n(t,1):[]}},1117:(t,e,r)=>{var n=r(7012),o=r(830),i=r(4041),s=r(5874);t.exports=function(t,e){return(s(t)?n:o)(t,i(e))}},4519:(t,e,r)=>{var n=r(9128),o=r(4041),i=r(2844);t.exports=function(t,e){return null==t?t:n(t,o(e),i)}},5887:(t,e,r)=>{var n=r(1855);t.exports=function(t,e,r){var o=null==t?void 0:n(t,e);return void 0===o?r:o}},4339:(t,e,r)=>{var n=r(3091),o=r(9663);t.exports=function(t,e){return null!=t&&o(t,e,n)}},4016:(t,e,r)=>{var n=r(5088),o=r(9663);t.exports=function(t,e){return null!=t&&o(t,e,n)}},9169:t=>{t.exports=function(t){return t}},79:(t,e,r)=>{var n=r(4047),o=r(7583),i=Object.prototype,s=i.hasOwnProperty,a=i.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(t){return o(t)&&s.call(t,"callee")&&!a.call(t,"callee")};t.exports=u},5874:t=>{var e=Array.isArray;t.exports=e},3069:(t,e,r)=>{var n=r(7787),o=r(4583);t.exports=function(t){return null!=t&&o(t.length)&&!n(t)}},6882:(t,e,r)=>{var n=r(3069),o=r(7583);t.exports=function(t){return o(t)&&n(t)}},3601:(t,e,r)=>{t=r.nmd(t);var n=r(714),o=r(6408),i=e&&!e.nodeType&&e,s=i&&t&&!t.nodeType&&t,a=s&&s.exports===i?n.Buffer:void 0,u=(a?a.isBuffer:void 0)||o;t.exports=u},2046:(t,e,r)=>{var n=r(5351),o=r(9778),i=r(79),s=r(5874),a=r(3069),u=r(3601),h=r(7894),d=r(9046),c=Object.prototype.hasOwnProperty;t.exports=function(t){if(null==t)return!0;if(a(t)&&(s(t)||"string"==typeof t||"function"==typeof t.splice||u(t)||d(t)||i(t)))return!t.length;var e=o(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(h(t))return!n(t).length;for(var r in t)if(c.call(t,r))return!1;return!0}},7787:(t,e,r)=>{var n=r(5271),o=r(9400);t.exports=function(t){if(!o(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},4583:t=>{t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},4725:(t,e,r)=>{var n=r(4965),o=r(8232),i=r(6574),s=i&&i.isMap,a=s?o(s):n;t.exports=a},9400:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},7583:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},4108:(t,e,r)=>{var n=r(5271),o=r(7556),i=r(7583),s=Function.prototype,a=Object.prototype,u=s.toString,h=a.hasOwnProperty,d=u.call(Object);t.exports=function(t){if(!i(t)||"[object Object]"!=n(t))return!1;var e=o(t);if(null===e)return!0;var r=h.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&u.call(r)==d}},7363:(t,e,r)=>{var n=r(6499),o=r(8232),i=r(6574),s=i&&i.isSet,a=s?o(s):n;t.exports=a},7462:(t,e,r)=>{var n=r(5271),o=r(5874),i=r(7583);t.exports=function(t){return"string"==typeof t||!o(t)&&i(t)&&"[object String]"==n(t)}},975:(t,e,r)=>{var n=r(5271),o=r(7583);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==n(t)}},9046:(t,e,r)=>{var n=r(550),o=r(8232),i=r(6574),s=i&&i.isTypedArray,a=s?o(s):n;t.exports=a},2895:t=>{t.exports=function(t){return void 0===t}},3511:(t,e,r)=>{var n=r(9754),o=r(5351),i=r(3069);t.exports=function(t){return i(t)?n(t):o(t)}},2844:(t,e,r)=>{var n=r(9754),o=r(1500),i=r(3069);t.exports=function(t){return i(t)?n(t,!0):o(t)}},5179:t=>{t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},9629:(t,e,r)=>{var n=r(2275),o=r(4506),i=r(4733),s=r(5874);t.exports=function(t,e){return(s(t)?n:i)(t,o(e,3))}},5551:(t,e,r)=>{var n=r(3077),o=r(7702),i=r(4506);t.exports=function(t,e){var r={};return e=i(e,3),o(t,(function(t,o,i){n(r,o,e(t,o,i))})),r}},4213:(t,e,r)=>{var n=r(5816),o=r(4116),i=r(9169);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},8487:(t,e,r)=>{var n=r(8910);function o(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var s=t.apply(this,n);return r.cache=i.set(o,s)||i,s};return r.cache=new(o.Cache||n),r}o.Cache=n,t.exports=o},2495:(t,e,r)=>{var n=r(4479),o=r(1292)((function(t,e,r){n(t,e,r)}));t.exports=o},9903:(t,e,r)=>{var n=r(5816),o=r(2795),i=r(9169);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},3262:(t,e,r)=>{var n=r(5816),o=r(4506),i=r(2795);t.exports=function(t,e){return t&&t.length?n(t,o(e,2),i):void 0}},3883:t=>{t.exports=function(){}},8835:(t,e,r)=>{var n=r(714);t.exports=function(){return n.Date.now()}},222:(t,e,r)=>{var n=r(4286),o=r(4139)((function(t,e){return null==t?{}:n(t,e)}));t.exports=o},6830:(t,e,r)=>{var n=r(8494),o=r(3644),i=r(759),s=r(9628);t.exports=function(t){return i(t)?n(s(t)):o(t)}},4978:(t,e,r)=>{var n=r(4590)();t.exports=n},9285:(t,e,r)=>{var n=r(8663),o=r(830),i=r(4506),s=r(8421),a=r(5874);t.exports=function(t,e,r){var u=a(t)?n:s,h=arguments.length<3;return u(t,i(e,4),r,h,o)}},3910:(t,e,r)=>{var n=r(5351),o=r(9778),i=r(3069),s=r(7462),a=r(6742);t.exports=function(t){if(null==t)return 0;if(i(t))return s(t)?a(t):t.length;var e=o(t);return"[object Map]"==e||"[object Set]"==e?t.size:n(t).length}},5246:(t,e,r)=>{var n=r(9821),o=r(9586),i=r(6965),s=r(8819),a=i((function(t,e){if(null==t)return[];var r=e.length;return r>1&&s(t,e[0],e[1])?e=[]:r>2&&s(e[0],e[1],e[2])&&(e=[e[0]]),o(t,n(e,1),[])}));t.exports=a},2982:t=>{t.exports=function(){return[]}},6408:t=>{t.exports=function(){return!1}},8265:(t,e,r)=>{var n=r(7639),o=1/0;t.exports=function(t){return t?(t=n(t))===o||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}},3758:(t,e,r)=>{var n=r(8265);t.exports=function(t){var e=n(t),r=e%1;return e==e?r?e-r:e:0}},7639:(t,e,r)=>{var n=r(5103),o=r(9400),i=r(975),s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,h=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return NaN;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=n(t);var r=a.test(t);return r||u.test(t)?h(t.slice(2),r?2:8):s.test(t)?NaN:+t}},339:(t,e,r)=>{var n=r(5532),o=r(2844);t.exports=function(t){return n(t,o(t))}},983:(t,e,r)=>{var n=r(8071);t.exports=function(t){return null==t?"":n(t)}},3279:(t,e,r)=>{var n=r(7012),o=r(1095),i=r(7702),s=r(4506),a=r(7556),u=r(5874),h=r(3601),d=r(7787),c=r(9400),l=r(9046);t.exports=function(t,e,r){var f=u(t),g=f||h(t)||l(t);if(e=s(e,4),null==r){var p=t&&t.constructor;r=g?f?new p:[]:c(t)&&d(p)?o(a(t)):{}}return(g?n:i)(t,(function(t,n,o){return e(r,t,n,o)})),r}},3344:(t,e,r)=>{var n=r(9821),o=r(6965),i=r(3434),s=r(6882),a=o((function(t){return i(n(t,1,s,!0))}));t.exports=a},761:(t,e,r)=>{var n=r(983),o=0;t.exports=function(t){var e=++o;return n(t)+e}},3005:(t,e,r)=>{var n=r(989),o=r(3511);t.exports=function(t){return null==t?[]:n(t,o(t))}},3679:(t,e,r)=>{var n=r(5802),o=r(2543);t.exports=function(t,e){return o(t||[],e||[],n)}},412:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>o});var n=r(5229);function o(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==r.output){if(!(0,n.isAnyArray)(r.output))throw new TypeError("output option must be an array if specified");e=r.output}else e=new Array(t.length);var o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,o=void 0===r?0:r,i=e.toIndex,s=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=o||s>t.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[o],u=o+1;u<s;u++)t[u]<a&&(a=t[u]);return a}(t),i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,o=void 0===r?0:r,i=e.toIndex,s=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=o||s>t.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[o],u=o+1;u<s;u++)t[u]>a&&(a=t[u]);return a}(t);if(o===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var s=r.min,a=void 0===s?r.autoMinMax?o:0:s,u=r.max,h=void 0===u?r.autoMinMax?i:1:u;if(a>=h)throw new RangeError("min option must be smaller than max option");for(var d=(h-a)/(i-o),c=0;c<t.length;c++)e[c]=(t[c]-o)*d+a;return e}},8917:(t,e,r)=>{"use strict";var n=r(5229),o=r(412);const i=" ".repeat(2),s=" ".repeat(4);function a(t,e={}){const{maxRows:r=15,maxColumns:n=10,maxNumSize:o=8,padMinus:a="auto"}=e;return`${t.constructor.name} {\n${i}[\n${s}${function(t,e,r,n,o){const{rows:i,columns:a}=t,h=Math.min(i,e),d=Math.min(a,r),c=[];if("auto"===o){o=!1;t:for(let e=0;e<h;e++)for(let r=0;r<d;r++)if(t.get(e,r)<0){o=!0;break t}}for(let e=0;e<h;e++){let r=[];for(let i=0;i<d;i++)r.push(u(t.get(e,i),n,o));c.push(`${r.join(" ")}`)}return d!==a&&(c[c.length-1]+=` ... ${a-r} more columns`),h!==i&&c.push(`... ${i-e} more rows`),c.join(`\n${s}`)}(t,r,n,o,a)}\n${i}]\n${i}rows: ${t.rows}\n${i}columns: ${t.columns}\n}`}function u(t,e,r){return(t>=0&&r?` ${h(t,e-1)}`:h(t,e)).padEnd(e)}function h(t,e){let r=t.toString();if(r.length<=e)return r;let n=t.toFixed(e);if(n.length>e&&(n=t.toFixed(Math.max(0,e-(n.length-e)))),n.length<=e&&!n.startsWith("0.000")&&!n.startsWith("-0.000"))return n;let o=t.toExponential(e);return o.length>e&&(o=t.toExponential(Math.max(0,e-(o.length-e)))),o.slice(0)}function d(t,e,r){let n=r?t.rows:t.rows-1;if(e<0||e>n)throw new RangeError("Row index out of range")}function c(t,e,r){let n=r?t.columns:t.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function l(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function f(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function g(t,e){if(!n.isAnyArray(e))throw new TypeError("row indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.rows)throw new RangeError("row indices are out of range")}function p(t,e){if(!n.isAnyArray(e))throw new TypeError("column indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.columns)throw new RangeError("column indices are out of range")}function v(t,e,r,n,o){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(y("startRow",e),y("endRow",r),y("startColumn",n),y("endColumn",o),e>r||n>o||e<0||e>=t.rows||r<0||r>=t.rows||n<0||n>=t.columns||o<0||o>=t.columns)throw new RangeError("Submatrix indices are out of range")}function m(t,e=0){let r=[];for(let n=0;n<t;n++)r.push(e);return r}function y(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function w(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class x{static from1DArray(t,e,r){if(t*e!==r.length)throw new RangeError("data length does not match given dimensions");let n=new E(t,e);for(let o=0;o<t;o++)for(let t=0;t<e;t++)n.set(o,t,r[o*e+t]);return n}static rowVector(t){let e=new E(1,t.length);for(let r=0;r<t.length;r++)e.set(0,r,t[r]);return e}static columnVector(t){let e=new E(t.length,1);for(let r=0;r<t.length;r++)e.set(r,0,t[r]);return e}static zeros(t,e){return new E(t,e)}static ones(t,e){return new E(t,e).fill(1)}static rand(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{random:n=Math.random}=r;let o=new E(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)o.set(r,t,n());return o}static randInt(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{min:n=0,max:o=1e3,random:i=Math.random}=r;if(!Number.isInteger(n))throw new TypeError("min must be an integer");if(!Number.isInteger(o))throw new TypeError("max must be an integer");if(n>=o)throw new RangeError("min must be smaller than max");let s=o-n,a=new E(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++){let e=n+Math.round(i()*s);a.set(r,t,e)}return a}static eye(t,e,r){void 0===e&&(e=t),void 0===r&&(r=1);let n=Math.min(t,e),o=this.zeros(t,e);for(let t=0;t<n;t++)o.set(t,t,r);return o}static diag(t,e,r){let n=t.length;void 0===e&&(e=n),void 0===r&&(r=e);let o=Math.min(n,e,r),i=this.zeros(e,r);for(let e=0;e<o;e++)i.set(e,e,t[e]);return i}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new E(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.min(t.get(i,r),e.get(i,r)));return o}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new this(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.max(t.get(i,r),e.get(i,r)));return o}static checkMatrix(t){return x.isMatrix(t)?t:new E(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.call(this,e,r);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.push(this.get(e,r));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let r=0;r<this.columns;r++)t[e].push(this.get(e,r))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let t=0;t<this.rows;t++)if(0!==this.get(t,t))return!1;return!0}isEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);t++}return n}isReducedEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);for(let r=e+1;r<this.rows;r++)0!==this.get(t,r)&&(n=!1);t++}return n}echelonForm(){let t=this.clone(),e=0,r=0;for(;e<t.rows&&r<t.columns;){let n=e;for(let o=e;o<t.rows;o++)t.get(o,r)>t.get(n,r)&&(n=o);if(0===t.get(n,r))r++;else{t.swapRows(e,n);let o=t.get(e,r);for(let n=r;n<t.columns;n++)t.set(e,n,t.get(e,n)/o);for(let n=e+1;n<t.rows;n++){let o=t.get(n,r)/t.get(e,r);t.set(n,r,0);for(let i=r+1;i<t.columns;i++)t.set(n,i,t.get(n,i)-t.get(e,i)*o)}e++,r++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,r=t.rows,n=r-1;for(;n>=0;)if(0===t.maxRow(n))n--;else{let o=0,i=!1;for(;o<r&&!1===i;)1===t.get(n,o)?i=!0:o++;for(let r=0;r<n;r++){let i=t.get(r,o);for(let s=o;s<e;s++){let e=t.get(r,s)-i*t.get(n,s);t.set(r,s,e)}}n--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:r=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(r)||r<=0)throw new TypeError("columns must be a positive integer");let n=new E(this.rows*e,this.columns*r);for(let t=0;t<e;t++)for(let e=0;e<r;e++)n.setSubMatrix(this,this.rows*t,this.columns*e);return n}fill(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,t);return this}neg(){return this.mulS(-1)}getRow(t){d(this,t);let e=[];for(let r=0;r<this.columns;r++)e.push(this.get(t,r));return e}getRowVector(t){return E.rowVector(this.getRow(t))}setRow(t,e){d(this,t),e=l(this,e);for(let r=0;r<this.columns;r++)this.set(t,r,e[r]);return this}swapRows(t,e){d(this,t),d(this,e);for(let r=0;r<this.columns;r++){let n=this.get(t,r);this.set(t,r,this.get(e,r)),this.set(e,r,n)}return this}getColumn(t){c(this,t);let e=[];for(let r=0;r<this.rows;r++)e.push(this.get(r,t));return e}getColumnVector(t){return E.columnVector(this.getColumn(t))}setColumn(t,e){c(this,t),e=f(this,e);for(let r=0;r<this.rows;r++)this.set(r,t,e[r]);return this}swapColumns(t,e){c(this,t),c(this,e);for(let r=0;r<this.rows;r++){let n=this.get(r,t);this.set(r,t,this.get(r,e)),this.set(r,e,n)}return this}addRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[r]);return this}subRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[r]);return this}mulRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[r]);return this}divRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[r]);return this}addColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[e]);return this}subColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[e]);return this}mulColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[e]);return this}divColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[e]);return this}mulRow(t,e){d(this,t);for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e);return this}mulColumn(t,e){c(this,t);for(let r=0;r<this.rows;r++)this.set(r,t,this.get(r,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){w(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){w(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}maxRow(t){if(d(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r));return e}maxRowIndex(t){d(this,t),w(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n),r[1]=n);return r}minRow(t){if(d(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r));return e}minRowIndex(t){d(this,t),w(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n),r[1]=n);return r}maxColumn(t){if(c(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t));return e}maxColumnIndex(t){c(this,t),w(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t),r[0]=n);return r}minColumn(t){if(c(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t));return e}minColumnIndex(t){c(this,t),w(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t),r[0]=n);return r}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let r=0;r<t;r++)e.push(this.get(r,r));return e}norm(t="frobenius"){switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${t}`)}}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t+=this.get(e,r),this.set(e,r,t);return this}dot(t){x.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let r=0;for(let n=0;n<e.length;n++)r+=e[n]*t[n];return r}mmul(t){t=E.checkMatrix(t);let e=this.rows,r=this.columns,n=t.columns,o=new E(e,n),i=new Float64Array(r);for(let s=0;s<n;s++){for(let e=0;e<r;e++)i[e]=t.get(e,s);for(let t=0;t<e;t++){let e=0;for(let n=0;n<r;n++)e+=this.get(t,n)*i[n];o.set(t,s,e)}}return o}strassen2x2(t){t=E.checkMatrix(t);let e=new E(2,2);const r=this.get(0,0),n=t.get(0,0),o=this.get(0,1),i=t.get(0,1),s=this.get(1,0),a=t.get(1,0),u=this.get(1,1),h=t.get(1,1),d=(r+u)*(n+h),c=(s+u)*n,l=r*(i-h),f=u*(a-n),g=(r+o)*h,p=d+f-g+(o-u)*(a+h),v=l+g,m=c+f,y=d-c+l+(s-r)*(n+i);return e.set(0,0,p),e.set(0,1,v),e.set(1,0,m),e.set(1,1,y),e}strassen3x3(t){t=E.checkMatrix(t);let e=new E(3,3);const r=this.get(0,0),n=this.get(0,1),o=this.get(0,2),i=this.get(1,0),s=this.get(1,1),a=this.get(1,2),u=this.get(2,0),h=this.get(2,1),d=this.get(2,2),c=t.get(0,0),l=t.get(0,1),f=t.get(0,2),g=t.get(1,0),p=t.get(1,1),v=t.get(1,2),m=t.get(2,0),y=t.get(2,1),w=t.get(2,2),x=(r-i)*(-l+p),b=(-r+i+s)*(c-l+p),N=(i+s)*(-c+l),M=r*c,_=(-r+u+h)*(c-f+v),k=(-r+u)*(f-v),A=(u+h)*(-c+f),j=(-o+h+d)*(p+m-y),S=(o-d)*(p-y),O=o*m,z=(h+d)*(-m+y),R=(-o+s+a)*(v+m-w),I=(o-a)*(v-w),C=(s+a)*(-m+w),D=M+O+n*g,P=(r+n+o-i-s-h-d)*p+b+N+M+j+O+z,T=M+_+A+(r+n+o-s-a-u-h)*v+O+R+C,L=x+s*(-c+l+g-p-v-m+w)+b+M+O+R+I,F=x+b+N+M+a*y,q=O+R+I+C+i*f,V=M+_+k+h*(-c+f+g-p-v-m+y)+j+S+O,B=j+S+O+z+u*l,U=M+_+k+A+d*w;return e.set(0,0,D),e.set(0,1,P),e.set(0,2,T),e.set(1,0,L),e.set(1,1,F),e.set(1,2,q),e.set(2,0,V),e.set(2,1,B),e.set(2,2,U),e}mmulStrassen(t){t=E.checkMatrix(t);let e=this.clone(),r=e.rows,n=e.columns,o=t.rows,i=t.columns;function s(t,e,r){let n=t.rows,o=t.columns;if(n===e&&o===r)return t;{let n=x.zeros(e,r);return n=n.setSubMatrix(t,0,0),n}}n!==o&&console.warn(`Multiplying ${r} x ${n} and ${o} x ${i} matrix: dimensions do not match.`);let a=Math.max(r,o),u=Math.max(n,i);return e=s(e,a,u),function t(e,r,n,o){if(n<=512||o<=512)return e.mmul(r);n%2==1&&o%2==1?(e=s(e,n+1,o+1),r=s(r,n+1,o+1)):n%2==1?(e=s(e,n+1,o),r=s(r,n+1,o)):o%2==1&&(e=s(e,n,o+1),r=s(r,n,o+1));let i=parseInt(e.rows/2,10),a=parseInt(e.columns/2,10),u=e.subMatrix(0,i-1,0,a-1),h=r.subMatrix(0,i-1,0,a-1),d=e.subMatrix(0,i-1,a,e.columns-1),c=r.subMatrix(0,i-1,a,r.columns-1),l=e.subMatrix(i,e.rows-1,0,a-1),f=r.subMatrix(i,r.rows-1,0,a-1),g=e.subMatrix(i,e.rows-1,a,e.columns-1),p=r.subMatrix(i,r.rows-1,a,r.columns-1),v=t(x.add(u,g),x.add(h,p),i,a),m=t(x.add(l,g),h,i,a),y=t(u,x.sub(c,p),i,a),w=t(g,x.sub(f,h),i,a),b=t(x.add(u,d),p,i,a),E=t(x.sub(l,u),x.add(h,c),i,a),N=t(x.sub(d,g),x.add(f,p),i,a),M=x.add(v,w);M.sub(b),M.add(N);let _=x.add(y,b),k=x.add(m,w),A=x.sub(v,m);A.add(y),A.add(E);let j=x.zeros(2*M.rows,2*M.columns);return j=j.setSubMatrix(M,0,0),j=j.setSubMatrix(_,M.rows,0),j=j.setSubMatrix(k,0,M.columns),j=j.setSubMatrix(A,M.rows,M.columns),j.subMatrix(0,n-1,0,o-1)}(e,t=s(t,a,u),a,u)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new E(this.rows,this.columns);for(let t=0;t<this.rows;t++){const i=this.getRow(t);i.length>0&&o(i,{min:e,max:r,output:i}),n.setRow(t,i)}return n}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new E(this.rows,this.columns);for(let t=0;t<this.columns;t++){const i=this.getColumn(t);i.length&&o(i,{min:e,max:r,output:i}),n.setColumn(t,i)}return n}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let r=0;r<t;r++){let t=this.get(e,r),n=this.get(e,this.columns-1-r);this.set(e,r,n),this.set(e,this.columns-1-r,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let r=0;r<t;r++){let t=this.get(r,e),n=this.get(this.rows-1-r,e);this.set(r,e,n),this.set(this.rows-1-r,e,t)}return this}kroneckerProduct(t){t=E.checkMatrix(t);let e=this.rows,r=this.columns,n=t.rows,o=t.columns,i=new E(e*n,r*o);for(let s=0;s<e;s++)for(let e=0;e<r;e++)for(let r=0;r<n;r++)for(let a=0;a<o;a++)i.set(n*s+r,o*e+a,this.get(s,e)*t.get(r,a));return i}kroneckerSum(t){if(t=E.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,r=t.rows,n=this.kroneckerProduct(E.eye(r,r)),o=E.eye(e,e).kroneckerProduct(t);return n.add(o)}transpose(){let t=new E(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(r,e,this.get(e,r));return t}sortRows(t=b){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=b){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,r,n){v(this,t,e,r,n);let o=new E(e-t+1,n-r+1);for(let i=t;i<=e;i++)for(let e=r;e<=n;e++)o.set(i-t,e-r,this.get(i,e));return o}subMatrixRow(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.columns-1),e>r||e<0||e>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");let n=new E(t.length,r-e+1);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.rows)throw new RangeError(`Row index out of range: ${t[o]}`);n.set(o,i-e,this.get(t[o],i))}return n}subMatrixColumn(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.rows-1),e>r||e<0||e>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");let n=new E(r-e+1,t.length);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.columns)throw new RangeError(`Column index out of range: ${t[o]}`);n.set(i-e,o,this.get(i,t[o]))}return n}setSubMatrix(t,e,r){if((t=E.checkMatrix(t)).isEmpty())return this;v(this,e,e+t.rows-1,r,r+t.columns-1);for(let n=0;n<t.rows;n++)for(let o=0;o<t.columns;o++)this.set(e+n,r+o,t.get(n,o));return this}selection(t,e){g(this,t),p(this,e);let r=new E(t.length,e.length);for(let n=0;n<t.length;n++){let o=t[n];for(let t=0;t<e.length;t++){let i=e[t];r.set(n,t,this.get(o,i))}}return r}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let r=0;r<t;r++)e+=this.get(r,r);return e}clone(){return this.constructor.copy(this,new E(this.rows,this.columns))}static copy(t,e){for(const[r,n,o]of t.entries())e.set(r,n,o);return e}sum(t){switch(t){case"row":return function(t){let e=m(t.rows);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]+=t.get(r,n);return e}(this);case"column":return function(t){let e=m(t.columns);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]+=t.get(r,n);return e}(this);case void 0:return function(t){let e=0;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e+=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=m(t.rows,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]*=t.get(r,n);return e}(this);case"column":return function(t){let e=m(t.columns,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]*=t.get(r,n);return e}(this);case void 0:return function(t){let e=1;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e*=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{unbiased:r=!0,mean:o=this.mean(t)}=e;if("boolean"!=typeof r)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!n.isAnyArray(o))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let s=0;s<n;s++){let n=0,a=0,u=0;for(let e=0;e<o;e++)u=t.get(s,e)-r[s],n+=u,a+=u*u;e?i.push((a-n*n/o)/(o-1)):i.push((a-n*n/o)/o)}return i}(this,r,o);case"column":if(!n.isAnyArray(o))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let s=0;s<o;s++){let o=0,a=0,u=0;for(let e=0;e<n;e++)u=t.get(e,s)-r[s],o+=u,a+=u*u;e?i.push((a-o*o/n)/(n-1)):i.push((a-o*o/n)/n)}return i}(this,r,o);case void 0:if("number"!=typeof o)throw new TypeError("mean must be a number");return function(t,e,r){const n=t.rows,o=t.columns,i=n*o;let s=0,a=0,u=0;for(let e=0;e<n;e++)for(let n=0;n<o;n++)u=t.get(e,n)-r,s+=u,a+=u*u;return e?(a-s*s/i)/(i-1):(a-s*s/i)/i}(this,r,o);default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const r=this.variance(t,e);if(void 0===t)return Math.sqrt(r);for(let t=0;t<r.length;t++)r[t]=Math.sqrt(r[t]);return r}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{center:r=this.mean(t)}=e;switch(t){case"row":if(!n.isAnyArray(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[r])}(this,r),this;case"column":if(!n.isAnyArray(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[n])}(this,r),this;case void 0:if("number"!=typeof r)throw new TypeError("center must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");let r=e.scale;switch(t){case"row":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.rows;r++){let n=0;for(let e=0;e<t.columns;e++)n+=Math.pow(t.get(r,e),2)/(t.columns-1);e.push(Math.sqrt(n))}return e}(this);else if(!n.isAnyArray(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[r])}(this,r),this;case"column":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.columns;r++){let n=0;for(let e=0;e<t.rows;e++)n+=Math.pow(t.get(e,r),2)/(t.rows-1);e.push(Math.sqrt(n))}return e}(this);else if(!n.isAnyArray(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[n])}(this,r),this;case void 0:if(void 0===r)r=function(t){const e=t.size-1;let r=0;for(let n=0;n<t.columns;n++)for(let o=0;o<t.rows;o++)r+=Math.pow(t.get(o,n),2)/e;return Math.sqrt(r)}(this);else if("number"!=typeof r)throw new TypeError("scale must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}toString(t){return a(this,t)}[Symbol.iterator](){return this.entries()}*entries(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield[t,e,this.get(t,e)]}*values(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield this.get(t,e)}}function b(t,e){return t-e}x.prototype.klass="Matrix","undefined"!=typeof Symbol&&(x.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return a(this)}),x.random=x.rand,x.randomInt=x.randInt,x.diagonal=x.diag,x.prototype.diagonal=x.prototype.diag,x.identity=x.eye,x.prototype.negate=x.prototype.neg,x.prototype.tensorProduct=x.prototype.kroneckerProduct;class E extends x{data;#t(t,e){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let r=0;r<t;r++)this.data.push(new Float64Array(e));this.rows=t,this.columns=e}constructor(t,e){if(super(),E.isMatrix(t))this.#t(t.rows,t.columns),E.copy(t,this);else if(Number.isInteger(t)&&t>=0)this.#t(t,e);else{if(!n.isAnyArray(t))throw new TypeError("First argument must be a positive number or an array");{const r=t;if("number"!=typeof(e=(t=r.length)?r[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let n=0;n<t;n++){if(r[n].length!==e)throw new RangeError("Inconsistent array dimensions");if(!r[n].every((t=>"number"==typeof t)))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(r[n]))}this.rows=t,this.columns=e}}}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}removeRow(t){return d(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),d(this,t,!0),e=Float64Array.from(l(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){c(this,t);for(let e=0;e<this.rows;e++){const r=new Float64Array(this.columns-1);for(let n=0;n<t;n++)r[n]=this.data[e][n];for(let n=t+1;n<this.columns;n++)r[n-1]=this.data[e][n];this.data[e]=r}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),c(this,t,!0),e=f(this,e);for(let r=0;r<this.rows;r++){const n=new Float64Array(this.columns+1);let o=0;for(;o<t;o++)n[o]=this.data[r][o];for(n[o++]=e[r];o<this.columns+1;o++)n[o]=this.data[r][o-1];this.data[r]=n}return this.columns+=1,this}}!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t.get(e,r));return this},t.add=function(t,r){return new e(t).add(r)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t.get(e,r));return this},t.sub=function(t,r){return new e(t).sub(r)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t.get(e,r));return this},t.mul=function(t,r){return new e(t).mul(r)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t.get(e,r));return this},t.div=function(t,r){return new e(t).div(r)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t.get(e,r));return this},t.mod=function(t,r){return new e(t).mod(r)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t.get(e,r));return this},t.and=function(t,r){return new e(t).and(r)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t.get(e,r));return this},t.or=function(t,r){return new e(t).or(r)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t.get(e,r));return this},t.xor=function(t,r){return new e(t).xor(r)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t.get(e,r));return this},t.leftShift=function(t,r){return new e(t).leftShift(r)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t.get(e,r));return this},t.signPropagatingRightShift=function(t,r){return new e(t).signPropagatingRightShift(r)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t.get(e,r));return this},t.rightShift=function(t,r){return new e(t).rightShift(r)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,r){return new e(t).pow(r)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t));return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t.get(e,r)));return this}}(x,E);class N extends x{#e;get size(){return this.#e.size}get rows(){return this.#e.rows}get columns(){return this.#e.columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(t){return E.isMatrix(t)&&"SymmetricMatrix"===t.klassType}static zeros(t){return new this(t)}static ones(t){return new this(t).fill(1)}constructor(t){if(super(),E.isMatrix(t)){if(!t.isSymmetric())throw new TypeError("not symmetric data");this.#e=E.copy(t,new E(t.rows,t.rows))}else if(Number.isInteger(t)&&t>=0)this.#e=new E(t,t);else if(this.#e=new E(t),!this.isSymmetric())throw new TypeError("not symmetric data")}clone(){const t=new N(this.diagonalSize);for(const[e,r,n]of this.upperRightEntries())t.set(e,r,n);return t}toMatrix(){return new E(this)}get(t,e){return this.#e.get(t,e)}set(t,e,r){return this.#e.set(t,e,r),this.#e.set(e,t,r),this}removeCross(t){return this.#e.removeRow(t),this.#e.removeColumn(t),this}addCross(t,e){void 0===e&&(e=t,t=this.diagonalSize);const r=e.slice();return r.splice(t,1),this.#e.addRow(t,r),this.#e.addColumn(t,e),this}applyMask(t){if(t.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const e=[];for(const[r,n]of t.entries())n||e.push(r);e.reverse();for(const t of e)this.removeCross(t);return this}toCompact(){const{diagonalSize:t}=this,e=new Array(t*(t+1)/2);for(let r=0,n=0,o=0;o<e.length;o++)e[o]=this.get(n,r),++r>=t&&(r=++n);return e}static fromCompact(t){const e=t.length,r=(Math.sqrt(8*e+1)-1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(t)}`);const n=new N(r);for(let o=0,i=0,s=0;s<e;s++)n.set(o,i,t[s]),++o>=r&&(o=++i);return n}*upperRightEntries(){for(let t=0,e=0;t<this.diagonalSize;void 0){const r=this.get(t,e);yield[t,e,r],++e>=this.diagonalSize&&(e=++t)}}*upperRightValues(){for(let t=0,e=0;t<this.diagonalSize;void 0){const r=this.get(t,e);yield r,++e>=this.diagonalSize&&(e=++t)}}}N.prototype.klassType="SymmetricMatrix";class M extends N{static isDistanceMatrix(t){return N.isSymmetricMatrix(t)&&"DistanceMatrix"===t.klassSubType}constructor(t){if(super(t),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(t,e,r){return t===e&&(r=0),super.set(t,e,r)}addCross(t,e){return void 0===e&&(e=t,t=this.diagonalSize),(e=e.slice())[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new N(this)}clone(){const t=new M(this.diagonalSize);for(const[e,r,n]of this.upperRightEntries())e!==r&&t.set(e,r,n);return t}toCompact(){const{diagonalSize:t}=this,e=new Array((t-1)*t/2);for(let r=1,n=0,o=0;o<e.length;o++)e[o]=this.get(n,r),++r>=t&&(r=1+ ++n);return e}static fromCompact(t){const e=t.length,r=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(t)}`);const n=new this(r);for(let o=1,i=0,s=0;s<e;s++)n.set(o,i,t[s]),++o>=r&&(o=1+ ++i);return n}}M.prototype.klassSubType="DistanceMatrix";class _ extends x{constructor(t,e,r){super(),this.matrix=t,this.rows=e,this.columns=r}}class k extends _{constructor(t,e,r){g(t,e),p(t,r),super(t,e.length,r.length),this.rowIndices=e,this.columnIndices=r}set(t,e,r){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],r),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class A extends x{constructor(t,e={}){const{rows:r=1}=e;if(t.length%r!=0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=r,this.columns=t.length/r,this.data=t}set(t,e,r){let n=this._calculateIndex(t,e);return this.data[n]=r,this}get(t,e){let r=this._calculateIndex(t,e);return this.data[r]}_calculateIndex(t,e){return t*this.columns+e}}class j extends x{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}}class S{constructor(t){let e,r,n,o,i,s,a,u,h,d=(t=j.checkMatrix(t)).clone(),c=d.rows,l=d.columns,f=new Float64Array(c),g=1;for(e=0;e<c;e++)f[e]=e;for(u=new Float64Array(c),r=0;r<l;r++){for(e=0;e<c;e++)u[e]=d.get(e,r);for(e=0;e<c;e++){for(h=Math.min(e,r),i=0,n=0;n<h;n++)i+=d.get(e,n)*u[n];u[e]-=i,d.set(e,r,u[e])}for(o=r,e=r+1;e<c;e++)Math.abs(u[e])>Math.abs(u[o])&&(o=e);if(o!==r){for(n=0;n<l;n++)s=d.get(o,n),d.set(o,n,d.get(r,n)),d.set(r,n,s);a=f[o],f[o]=f[r],f[r]=a,g=-g}if(r<c&&0!==d.get(r,r))for(e=r+1;e<c;e++)d.set(e,r,d.get(e,r)/d.get(r,r))}this.LU=d,this.pivotVector=f,this.pivotSign=g}isSingular(){let t=this.LU,e=t.columns;for(let r=0;r<e;r++)if(0===t.get(r,r))return!0;return!1}solve(t){t=E.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let r,n,o,i=t.columns,s=t.subMatrixRow(this.pivotVector,0,i-1),a=e.columns;for(o=0;o<a;o++)for(r=o+1;r<a;r++)for(n=0;n<i;n++)s.set(r,n,s.get(r,n)-s.get(o,n)*e.get(r,o));for(o=a-1;o>=0;o--){for(n=0;n<i;n++)s.set(o,n,s.get(o,n)/e.get(o,o));for(r=0;r<o;r++)for(n=0;n<i;n++)s.set(r,n,s.get(r,n)-s.get(o,n)*e.get(r,o))}return s}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,r=t.columns;for(let n=0;n<r;n++)e*=t.get(n,n);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,n=new E(e,r);for(let o=0;o<e;o++)for(let e=0;e<r;e++)o>e?n.set(o,e,t.get(o,e)):o===e?n.set(o,e,1):n.set(o,e,0);return n}get upperTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,n=new E(e,r);for(let o=0;o<e;o++)for(let e=0;e<r;e++)o<=e?n.set(o,e,t.get(o,e)):n.set(o,e,0);return n}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function O(t,e){let r=0;return Math.abs(t)>Math.abs(e)?(r=e/t,Math.abs(t)*Math.sqrt(1+r*r)):0!==e?(r=t/e,Math.abs(e)*Math.sqrt(1+r*r)):0}class z{constructor(t){let e,r,n,o,i=(t=j.checkMatrix(t)).clone(),s=t.rows,a=t.columns,u=new Float64Array(a);for(n=0;n<a;n++){let t=0;for(e=n;e<s;e++)t=O(t,i.get(e,n));if(0!==t){for(i.get(n,n)<0&&(t=-t),e=n;e<s;e++)i.set(e,n,i.get(e,n)/t);for(i.set(n,n,i.get(n,n)+1),r=n+1;r<a;r++){for(o=0,e=n;e<s;e++)o+=i.get(e,n)*i.get(e,r);for(o=-o/i.get(n,n),e=n;e<s;e++)i.set(e,r,i.get(e,r)+o*i.get(e,n))}}u[n]=-t}this.QR=i,this.Rdiag=u}solve(t){t=E.checkMatrix(t);let e=this.QR,r=e.rows;if(t.rows!==r)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let n,o,i,s,a=t.columns,u=t.clone(),h=e.columns;for(i=0;i<h;i++)for(o=0;o<a;o++){for(s=0,n=i;n<r;n++)s+=e.get(n,i)*u.get(n,o);for(s=-s/e.get(i,i),n=i;n<r;n++)u.set(n,o,u.get(n,o)+s*e.get(n,i))}for(i=h-1;i>=0;i--){for(o=0;o<a;o++)u.set(i,o,u.get(i,o)/this.Rdiag[i]);for(n=0;n<i;n++)for(o=0;o<a;o++)u.set(n,o,u.get(n,o)-u.get(i,o)*e.get(n,i))}return u.subMatrix(0,h-1,0,a-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(0===this.Rdiag[e])return!1;return!0}get upperTriangularMatrix(){let t,e,r=this.QR,n=r.columns,o=new E(n,n);for(t=0;t<n;t++)for(e=0;e<n;e++)t<e?o.set(t,e,r.get(t,e)):t===e?o.set(t,e,this.Rdiag[t]):o.set(t,e,0);return o}get orthogonalMatrix(){let t,e,r,n,o=this.QR,i=o.rows,s=o.columns,a=new E(i,s);for(r=s-1;r>=0;r--){for(t=0;t<i;t++)a.set(t,r,0);for(a.set(r,r,1),e=r;e<s;e++)if(0!==o.get(r,r)){for(n=0,t=r;t<i;t++)n+=o.get(t,r)*a.get(t,e);for(n=-n/o.get(r,r),t=r;t<i;t++)a.set(t,e,a.get(t,e)+n*o.get(t,r))}}return a}}class R{constructor(t,e={}){if((t=j.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let r=t.rows,n=t.columns;const{computeLeftSingularVectors:o=!0,computeRightSingularVectors:i=!0,autoTranspose:s=!1}=e;let a,u=Boolean(o),h=Boolean(i),d=!1;if(r<n)if(s){a=t.transpose(),r=a.rows,n=a.columns,d=!0;let e=u;u=h,h=e}else a=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else a=t.clone();let c=Math.min(r,n),l=Math.min(r+1,n),f=new Float64Array(l),g=new E(r,c),p=new E(n,n),v=new Float64Array(n),m=new Float64Array(r),y=new Float64Array(l);for(let t=0;t<l;t++)y[t]=t;let w=Math.min(r-1,n),x=Math.max(0,Math.min(n-2,r)),b=Math.max(w,x);for(let t=0;t<b;t++){if(t<w){f[t]=0;for(let e=t;e<r;e++)f[t]=O(f[t],a.get(e,t));if(0!==f[t]){a.get(t,t)<0&&(f[t]=-f[t]);for(let e=t;e<r;e++)a.set(e,t,a.get(e,t)/f[t]);a.set(t,t,a.get(t,t)+1)}f[t]=-f[t]}for(let e=t+1;e<n;e++){if(t<w&&0!==f[t]){let n=0;for(let o=t;o<r;o++)n+=a.get(o,t)*a.get(o,e);n=-n/a.get(t,t);for(let o=t;o<r;o++)a.set(o,e,a.get(o,e)+n*a.get(o,t))}v[e]=a.get(t,e)}if(u&&t<w)for(let e=t;e<r;e++)g.set(e,t,a.get(e,t));if(t<x){v[t]=0;for(let e=t+1;e<n;e++)v[t]=O(v[t],v[e]);if(0!==v[t]){v[t+1]<0&&(v[t]=0-v[t]);for(let e=t+1;e<n;e++)v[e]/=v[t];v[t+1]+=1}if(v[t]=-v[t],t+1<r&&0!==v[t]){for(let e=t+1;e<r;e++)m[e]=0;for(let e=t+1;e<r;e++)for(let r=t+1;r<n;r++)m[e]+=v[r]*a.get(e,r);for(let e=t+1;e<n;e++){let n=-v[e]/v[t+1];for(let o=t+1;o<r;o++)a.set(o,e,a.get(o,e)+n*m[o])}}if(h)for(let e=t+1;e<n;e++)p.set(e,t,v[e])}}let N=Math.min(n,r+1);if(w<n&&(f[w]=a.get(w,w)),r<N&&(f[N-1]=0),x+1<N&&(v[x]=a.get(x,N-1)),v[N-1]=0,u){for(let t=w;t<c;t++){for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}for(let t=w-1;t>=0;t--)if(0!==f[t]){for(let e=t+1;e<c;e++){let n=0;for(let o=t;o<r;o++)n+=g.get(o,t)*g.get(o,e);n=-n/g.get(t,t);for(let o=t;o<r;o++)g.set(o,e,g.get(o,e)+n*g.get(o,t))}for(let e=t;e<r;e++)g.set(e,t,-g.get(e,t));g.set(t,t,1+g.get(t,t));for(let e=0;e<t-1;e++)g.set(e,t,0)}else{for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}}if(h)for(let t=n-1;t>=0;t--){if(t<x&&0!==v[t])for(let e=t+1;e<n;e++){let r=0;for(let o=t+1;o<n;o++)r+=p.get(o,t)*p.get(o,e);r=-r/p.get(t+1,t);for(let o=t+1;o<n;o++)p.set(o,e,p.get(o,e)+r*p.get(o,t))}for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}let M=N-1,_=Number.EPSILON;for(;N>0;){let t,e;for(t=N-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+_*Math.abs(f[t]+Math.abs(f[t+1]));if(Math.abs(v[t])<=e||Number.isNaN(v[t])){v[t]=0;break}}if(t===N-2)e=4;else{let r;for(r=N-1;r>=t&&r!==t;r--){let e=(r!==N?Math.abs(v[r]):0)+(r!==t+1?Math.abs(v[r-1]):0);if(Math.abs(f[r])<=_*e){f[r]=0;break}}r===t?e=3:r===N-1?e=1:(e=2,t=r)}switch(t++,e){case 1:{let e=v[N-2];v[N-2]=0;for(let r=N-2;r>=t;r--){let o=O(f[r],e),i=f[r]/o,s=e/o;if(f[r]=o,r!==t&&(e=-s*v[r-1],v[r-1]=i*v[r-1]),h)for(let t=0;t<n;t++)o=i*p.get(t,r)+s*p.get(t,N-1),p.set(t,N-1,-s*p.get(t,r)+i*p.get(t,N-1)),p.set(t,r,o)}break}case 2:{let e=v[t-1];v[t-1]=0;for(let n=t;n<N;n++){let o=O(f[n],e),i=f[n]/o,s=e/o;if(f[n]=o,e=-s*v[n],v[n]=i*v[n],u)for(let e=0;e<r;e++)o=i*g.get(e,n)+s*g.get(e,t-1),g.set(e,t-1,-s*g.get(e,n)+i*g.get(e,t-1)),g.set(e,n,o)}break}case 3:{const e=Math.max(Math.abs(f[N-1]),Math.abs(f[N-2]),Math.abs(v[N-2]),Math.abs(f[t]),Math.abs(v[t])),o=f[N-1]/e,i=f[N-2]/e,s=v[N-2]/e,a=f[t]/e,d=v[t]/e,c=((i+o)*(i-o)+s*s)/2,l=o*s*(o*s);let m=0;0===c&&0===l||(m=c<0?0-Math.sqrt(c*c+l):Math.sqrt(c*c+l),m=l/(c+m));let y=(a+o)*(a-o)+m,w=a*d;for(let e=t;e<N-1;e++){let o=O(y,w);0===o&&(o=Number.MIN_VALUE);let i=y/o,s=w/o;if(e!==t&&(v[e-1]=o),y=i*f[e]+s*v[e],v[e]=i*v[e]-s*f[e],w=s*f[e+1],f[e+1]=i*f[e+1],h)for(let t=0;t<n;t++)o=i*p.get(t,e)+s*p.get(t,e+1),p.set(t,e+1,-s*p.get(t,e)+i*p.get(t,e+1)),p.set(t,e,o);if(o=O(y,w),0===o&&(o=Number.MIN_VALUE),i=y/o,s=w/o,f[e]=o,y=i*v[e]+s*f[e+1],f[e+1]=-s*v[e]+i*f[e+1],w=s*v[e+1],v[e+1]=i*v[e+1],u&&e<r-1)for(let t=0;t<r;t++)o=i*g.get(t,e)+s*g.get(t,e+1),g.set(t,e+1,-s*g.get(t,e)+i*g.get(t,e+1)),g.set(t,e,o)}v[N-2]=y;break}case 4:if(f[t]<=0&&(f[t]=f[t]<0?-f[t]:0,h))for(let e=0;e<=M;e++)p.set(e,t,-p.get(e,t));for(;t<M&&!(f[t]>=f[t+1]);){let e=f[t];if(f[t]=f[t+1],f[t+1]=e,h&&t<n-1)for(let r=0;r<n;r++)e=p.get(r,t+1),p.set(r,t+1,p.get(r,t)),p.set(r,t,e);if(u&&t<r-1)for(let n=0;n<r;n++)e=g.get(n,t+1),g.set(n,t+1,g.get(n,t)),g.set(n,t,e);t++}N--}}if(d){let t=p;p=g,g=t}this.m=r,this.n=n,this.s=f,this.U=g,this.V=p}solve(t){let e=t,r=this.threshold,n=this.s.length,o=E.zeros(n,n);for(let t=0;t<n;t++)Math.abs(this.s[t])<=r?o.set(t,t,0):o.set(t,t,1/this.s[t]);let i=this.U,s=this.rightSingularVectors,a=s.mmul(o),u=s.rows,h=i.rows,d=E.zeros(u,h);for(let t=0;t<u;t++)for(let e=0;e<h;e++){let r=0;for(let o=0;o<n;o++)r+=a.get(t,o)*i.get(e,o);d.set(t,e,r)}return d.mmul(e)}solveForDiagonal(t){return this.solve(E.diag(t))}inverse(){let t=this.V,e=this.threshold,r=t.rows,n=t.columns,o=new E(r,this.s.length);for(let i=0;i<r;i++)for(let r=0;r<n;r++)Math.abs(this.s[r])>e&&o.set(i,r,t.get(i,r)/this.s[r]);let i=this.U,s=i.rows,a=i.columns,u=new E(r,s);for(let t=0;t<r;t++)for(let e=0;e<s;e++){let r=0;for(let n=0;n<a;n++)r+=o.get(t,n)*i.get(e,n);u.set(t,e,r)}return u}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,r=this.s;for(let n=0,o=r.length;n<o;n++)r[n]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return E.diag(this.s)}}function I(t,e,r=!1){return t=j.checkMatrix(t),e=j.checkMatrix(e),r?new R(t).solve(e):t.isSquare()?new S(t).solve(e):new z(t).solve(e)}function C(t,e){let r=[];for(let n=0;n<t;n++)n!==e&&r.push(n);return r}function D(t,e,r,n=1e-9,o=1e-9){if(t>o)return new Array(e.rows+1).fill(0);{let t=e.addRow(r,[0]);for(let e=0;e<t.rows;e++)Math.abs(t.get(e,0))<n&&t.set(e,0,0);return t.to1DArray()}}class P{constructor(t,e={}){const{assumeSymmetric:r=!1}=e;if(!(t=j.checkMatrix(t)).isSquare())throw new Error("Matrix is not a square matrix");if(t.isEmpty())throw new Error("Matrix must be non-empty");let n,o,i=t.columns,s=new E(i,i),a=new Float64Array(i),u=new Float64Array(i),h=t,d=!1;if(d=!!r||t.isSymmetric(),d){for(n=0;n<i;n++)for(o=0;o<i;o++)s.set(n,o,h.get(n,o));!function(t,e,r,n){let o,i,s,a,u,h,d,c;for(u=0;u<t;u++)r[u]=n.get(t-1,u);for(a=t-1;a>0;a--){for(c=0,s=0,h=0;h<a;h++)c+=Math.abs(r[h]);if(0===c)for(e[a]=r[a-1],u=0;u<a;u++)r[u]=n.get(a-1,u),n.set(a,u,0),n.set(u,a,0);else{for(h=0;h<a;h++)r[h]/=c,s+=r[h]*r[h];for(o=r[a-1],i=Math.sqrt(s),o>0&&(i=-i),e[a]=c*i,s-=o*i,r[a-1]=o-i,u=0;u<a;u++)e[u]=0;for(u=0;u<a;u++){for(o=r[u],n.set(u,a,o),i=e[u]+n.get(u,u)*o,h=u+1;h<=a-1;h++)i+=n.get(h,u)*r[h],e[h]+=n.get(h,u)*o;e[u]=i}for(o=0,u=0;u<a;u++)e[u]/=s,o+=e[u]*r[u];for(d=o/(s+s),u=0;u<a;u++)e[u]-=d*r[u];for(u=0;u<a;u++){for(o=r[u],i=e[u],h=u;h<=a-1;h++)n.set(h,u,n.get(h,u)-(o*e[h]+i*r[h]));r[u]=n.get(a-1,u),n.set(a,u,0)}}r[a]=s}for(a=0;a<t-1;a++){if(n.set(t-1,a,n.get(a,a)),n.set(a,a,1),s=r[a+1],0!==s){for(h=0;h<=a;h++)r[h]=n.get(h,a+1)/s;for(u=0;u<=a;u++){for(i=0,h=0;h<=a;h++)i+=n.get(h,a+1)*n.get(h,u);for(h=0;h<=a;h++)n.set(h,u,n.get(h,u)-i*r[h])}}for(h=0;h<=a;h++)n.set(h,a+1,0)}for(u=0;u<t;u++)r[u]=n.get(t-1,u),n.set(t-1,u,0);n.set(t-1,t-1,1),e[0]=0}(i,u,a,s),function(t,e,r,n){let o,i,s,a,u,h,d,c,l,f,g,p,v,m,y,w;for(s=1;s<t;s++)e[s-1]=e[s];e[t-1]=0;let x=0,b=0,E=Number.EPSILON;for(h=0;h<t;h++){for(b=Math.max(b,Math.abs(r[h])+Math.abs(e[h])),d=h;d<t&&!(Math.abs(e[d])<=E*b);)d++;if(d>h)do{for(o=r[h],c=(r[h+1]-o)/(2*e[h]),l=O(c,1),c<0&&(l=-l),r[h]=e[h]/(c+l),r[h+1]=e[h]*(c+l),f=r[h+1],i=o-r[h],s=h+2;s<t;s++)r[s]-=i;for(x+=i,c=r[d],g=1,p=g,v=g,m=e[h+1],y=0,w=0,s=d-1;s>=h;s--)for(v=p,p=g,w=y,o=g*e[s],i=g*c,l=O(c,e[s]),e[s+1]=y*l,y=e[s]/l,g=c/l,c=g*r[s]-y*o,r[s+1]=i+y*(g*o+y*r[s]),u=0;u<t;u++)i=n.get(u,s+1),n.set(u,s+1,y*n.get(u,s)+g*i),n.set(u,s,g*n.get(u,s)-y*i);c=-y*w*v*m*e[h]/f,e[h]=y*c,r[h]=g*c}while(Math.abs(e[h])>E*b);r[h]=r[h]+x,e[h]=0}for(s=0;s<t-1;s++){for(u=s,c=r[s],a=s+1;a<t;a++)r[a]<c&&(u=a,c=r[a]);if(u!==s)for(r[u]=r[s],r[s]=c,a=0;a<t;a++)c=n.get(a,s),n.set(a,s,n.get(a,u)),n.set(a,u,c)}}(i,u,a,s)}else{let t=new E(i,i),e=new Float64Array(i);for(o=0;o<i;o++)for(n=0;n<i;n++)t.set(n,o,h.get(n,o));!function(t,e,r,n){let o,i,s,a,u,h,d,c=t-1;for(h=1;h<=c-1;h++){for(d=0,a=h;a<=c;a++)d+=Math.abs(e.get(a,h-1));if(0!==d){for(s=0,a=c;a>=h;a--)r[a]=e.get(a,h-1)/d,s+=r[a]*r[a];for(i=Math.sqrt(s),r[h]>0&&(i=-i),s-=r[h]*i,r[h]=r[h]-i,u=h;u<t;u++){for(o=0,a=c;a>=h;a--)o+=r[a]*e.get(a,u);for(o/=s,a=h;a<=c;a++)e.set(a,u,e.get(a,u)-o*r[a])}for(a=0;a<=c;a++){for(o=0,u=c;u>=h;u--)o+=r[u]*e.get(a,u);for(o/=s,u=h;u<=c;u++)e.set(a,u,e.get(a,u)-o*r[u])}r[h]=d*r[h],e.set(h,h-1,d*i)}}for(a=0;a<t;a++)for(u=0;u<t;u++)n.set(a,u,a===u?1:0);for(h=c-1;h>=1;h--)if(0!==e.get(h,h-1)){for(a=h+1;a<=c;a++)r[a]=e.get(a,h-1);for(u=h;u<=c;u++){for(i=0,a=h;a<=c;a++)i+=r[a]*n.get(a,u);for(i=i/r[h]/e.get(h,h-1),a=h;a<=c;a++)n.set(a,u,n.get(a,u)+i*r[a])}}}(i,t,e,s),function(t,e,r,n,o){let i,s,a,u,h,d,c,l,f,g,p,v,m,y,w,x=t-1,b=t-1,E=Number.EPSILON,N=0,M=0,_=0,k=0,A=0,j=0,S=0,O=0;for(i=0;i<t;i++)for((i<0||i>b)&&(r[i]=o.get(i,i),e[i]=0),s=Math.max(i-1,0);s<t;s++)M+=Math.abs(o.get(i,s));for(;x>=0;){for(u=x;u>0&&(j=Math.abs(o.get(u-1,u-1))+Math.abs(o.get(u,u)),0===j&&(j=M),!(Math.abs(o.get(u,u-1))<E*j));)u--;if(u===x)o.set(x,x,o.get(x,x)+N),r[x]=o.get(x,x),e[x]=0,x--,O=0;else if(u===x-1){if(c=o.get(x,x-1)*o.get(x-1,x),_=(o.get(x-1,x-1)-o.get(x,x))/2,k=_*_+c,S=Math.sqrt(Math.abs(k)),o.set(x,x,o.get(x,x)+N),o.set(x-1,x-1,o.get(x-1,x-1)+N),l=o.get(x,x),k>=0){for(S=_>=0?_+S:_-S,r[x-1]=l+S,r[x]=r[x-1],0!==S&&(r[x]=l-c/S),e[x-1]=0,e[x]=0,l=o.get(x,x-1),j=Math.abs(l)+Math.abs(S),_=l/j,k=S/j,A=Math.sqrt(_*_+k*k),_/=A,k/=A,s=x-1;s<t;s++)S=o.get(x-1,s),o.set(x-1,s,k*S+_*o.get(x,s)),o.set(x,s,k*o.get(x,s)-_*S);for(i=0;i<=x;i++)S=o.get(i,x-1),o.set(i,x-1,k*S+_*o.get(i,x)),o.set(i,x,k*o.get(i,x)-_*S);for(i=0;i<=b;i++)S=n.get(i,x-1),n.set(i,x-1,k*S+_*n.get(i,x)),n.set(i,x,k*n.get(i,x)-_*S)}else r[x-1]=l+_,r[x]=l+_,e[x-1]=S,e[x]=-S;x-=2,O=0}else{if(l=o.get(x,x),f=0,c=0,u<x&&(f=o.get(x-1,x-1),c=o.get(x,x-1)*o.get(x-1,x)),10===O){for(N+=l,i=0;i<=x;i++)o.set(i,i,o.get(i,i)-l);j=Math.abs(o.get(x,x-1))+Math.abs(o.get(x-1,x-2)),l=f=.75*j,c=-.4375*j*j}if(30===O&&(j=(f-l)/2,j=j*j+c,j>0)){for(j=Math.sqrt(j),f<l&&(j=-j),j=l-c/((f-l)/2+j),i=0;i<=x;i++)o.set(i,i,o.get(i,i)-j);N+=j,l=f=c=.964}for(O+=1,h=x-2;h>=u&&(S=o.get(h,h),A=l-S,j=f-S,_=(A*j-c)/o.get(h+1,h)+o.get(h,h+1),k=o.get(h+1,h+1)-S-A-j,A=o.get(h+2,h+1),j=Math.abs(_)+Math.abs(k)+Math.abs(A),_/=j,k/=j,A/=j,h!==u)&&!(Math.abs(o.get(h,h-1))*(Math.abs(k)+Math.abs(A))<E*(Math.abs(_)*(Math.abs(o.get(h-1,h-1))+Math.abs(S)+Math.abs(o.get(h+1,h+1)))));)h--;for(i=h+2;i<=x;i++)o.set(i,i-2,0),i>h+2&&o.set(i,i-3,0);for(a=h;a<=x-1&&(y=a!==x-1,a!==h&&(_=o.get(a,a-1),k=o.get(a+1,a-1),A=y?o.get(a+2,a-1):0,l=Math.abs(_)+Math.abs(k)+Math.abs(A),0!==l&&(_/=l,k/=l,A/=l)),0!==l);a++)if(j=Math.sqrt(_*_+k*k+A*A),_<0&&(j=-j),0!==j){for(a!==h?o.set(a,a-1,-j*l):u!==h&&o.set(a,a-1,-o.get(a,a-1)),_+=j,l=_/j,f=k/j,S=A/j,k/=_,A/=_,s=a;s<t;s++)_=o.get(a,s)+k*o.get(a+1,s),y&&(_+=A*o.get(a+2,s),o.set(a+2,s,o.get(a+2,s)-_*S)),o.set(a,s,o.get(a,s)-_*l),o.set(a+1,s,o.get(a+1,s)-_*f);for(i=0;i<=Math.min(x,a+3);i++)_=l*o.get(i,a)+f*o.get(i,a+1),y&&(_+=S*o.get(i,a+2),o.set(i,a+2,o.get(i,a+2)-_*A)),o.set(i,a,o.get(i,a)-_),o.set(i,a+1,o.get(i,a+1)-_*k);for(i=0;i<=b;i++)_=l*n.get(i,a)+f*n.get(i,a+1),y&&(_+=S*n.get(i,a+2),n.set(i,a+2,n.get(i,a+2)-_*A)),n.set(i,a,n.get(i,a)-_),n.set(i,a+1,n.get(i,a+1)-_*k)}}}if(0!==M){for(x=t-1;x>=0;x--)if(_=r[x],k=e[x],0===k)for(u=x,o.set(x,x,1),i=x-1;i>=0;i--){for(c=o.get(i,i)-_,A=0,s=u;s<=x;s++)A+=o.get(i,s)*o.get(s,x);if(e[i]<0)S=c,j=A;else if(u=i,0===e[i]?o.set(i,x,0!==c?-A/c:-A/(E*M)):(l=o.get(i,i+1),f=o.get(i+1,i),k=(r[i]-_)*(r[i]-_)+e[i]*e[i],d=(l*j-S*A)/k,o.set(i,x,d),o.set(i+1,x,Math.abs(l)>Math.abs(S)?(-A-c*d)/l:(-j-f*d)/S)),d=Math.abs(o.get(i,x)),E*d*d>1)for(s=i;s<=x;s++)o.set(s,x,o.get(s,x)/d)}else if(k<0)for(u=x-1,Math.abs(o.get(x,x-1))>Math.abs(o.get(x-1,x))?(o.set(x-1,x-1,k/o.get(x,x-1)),o.set(x-1,x,-(o.get(x,x)-_)/o.get(x,x-1))):(w=T(0,-o.get(x-1,x),o.get(x-1,x-1)-_,k),o.set(x-1,x-1,w[0]),o.set(x-1,x,w[1])),o.set(x,x-1,0),o.set(x,x,1),i=x-2;i>=0;i--){for(g=0,p=0,s=u;s<=x;s++)g+=o.get(i,s)*o.get(s,x-1),p+=o.get(i,s)*o.get(s,x);if(c=o.get(i,i)-_,e[i]<0)S=c,A=g,j=p;else if(u=i,0===e[i]?(w=T(-g,-p,c,k),o.set(i,x-1,w[0]),o.set(i,x,w[1])):(l=o.get(i,i+1),f=o.get(i+1,i),v=(r[i]-_)*(r[i]-_)+e[i]*e[i]-k*k,m=2*(r[i]-_)*k,0===v&&0===m&&(v=E*M*(Math.abs(c)+Math.abs(k)+Math.abs(l)+Math.abs(f)+Math.abs(S))),w=T(l*A-S*g+k*p,l*j-S*p-k*g,v,m),o.set(i,x-1,w[0]),o.set(i,x,w[1]),Math.abs(l)>Math.abs(S)+Math.abs(k)?(o.set(i+1,x-1,(-g-c*o.get(i,x-1)+k*o.get(i,x))/l),o.set(i+1,x,(-p-c*o.get(i,x)-k*o.get(i,x-1))/l)):(w=T(-A-f*o.get(i,x-1),-j-f*o.get(i,x),S,k),o.set(i+1,x-1,w[0]),o.set(i+1,x,w[1]))),d=Math.max(Math.abs(o.get(i,x-1)),Math.abs(o.get(i,x))),E*d*d>1)for(s=i;s<=x;s++)o.set(s,x-1,o.get(s,x-1)/d),o.set(s,x,o.get(s,x)/d)}for(i=0;i<t;i++)if(i<0||i>b)for(s=i;s<t;s++)n.set(i,s,o.get(i,s));for(s=t-1;s>=0;s--)for(i=0;i<=b;i++){for(S=0,a=0;a<=Math.min(s,b);a++)S+=n.get(i,a)*o.get(a,s);n.set(i,s,S)}}}(i,u,a,s,t)}this.n=i,this.e=u,this.d=a,this.V=s}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let t,e,r=this.n,n=this.e,o=this.d,i=new E(r,r);for(t=0;t<r;t++){for(e=0;e<r;e++)i.set(t,e,0);i.set(t,t,o[t]),n[t]>0?i.set(t,t+1,n[t]):n[t]<0&&i.set(t,t-1,n[t])}return i}}function T(t,e,r,n){let o,i;return Math.abs(r)>Math.abs(n)?(o=n/r,i=r+o*n,[(t+o*e)/i,(e-o*t)/i]):(o=r/n,i=n+o*r,[(o*t+e)/i,(o*e-t)/i])}class L{constructor(t){if(!(t=j.checkMatrix(t)).isSymmetric())throw new Error("Matrix is not symmetric");let e,r,n,o=t,i=o.rows,s=new E(i,i),a=!0;for(r=0;r<i;r++){let t=0;for(n=0;n<r;n++){let i=0;for(e=0;e<n;e++)i+=s.get(n,e)*s.get(r,e);i=(o.get(r,n)-i)/s.get(n,n),s.set(r,n,i),t+=i*i}for(t=o.get(r,r)-t,a&=t>0,s.set(r,r,Math.sqrt(Math.max(t,0))),n=r+1;n<i;n++)s.set(r,n,0)}this.L=s,this.positiveDefinite=Boolean(a)}isPositiveDefinite(){return this.positiveDefinite}solve(t){t=j.checkMatrix(t);let e=this.L,r=e.rows;if(t.rows!==r)throw new Error("Matrix dimensions do not match");if(!1===this.isPositiveDefinite())throw new Error("Matrix is not positive definite");let n,o,i,s=t.columns,a=t.clone();for(i=0;i<r;i++)for(o=0;o<s;o++){for(n=0;n<i;n++)a.set(i,o,a.get(i,o)-a.get(n,o)*e.get(i,n));a.set(i,o,a.get(i,o)/e.get(i,i))}for(i=r-1;i>=0;i--)for(o=0;o<s;o++){for(n=i+1;n<r;n++)a.set(i,o,a.get(i,o)-a.get(n,o)*e.get(n,i));a.set(i,o,a.get(i,o)/e.get(i,i))}return a}get lowerTriangularMatrix(){return this.L}}class F{constructor(t,e={}){t=j.checkMatrix(t);let{Y:r}=e;const{scaleScores:o=!1,maxIterations:i=1e3,terminationCriteria:s=1e-10}=e;let a;if(r){if(r=n.isAnyArray(r)&&"number"==typeof r[0]?E.columnVector(r):j.checkMatrix(r),r.rows!==t.rows)throw new Error("Y should have the same number of rows as X");a=r.getColumnVector(0)}else a=t.getColumnVector(0);let u,h,d,c,l=1;for(let e=0;e<i&&l>s;e++)d=t.transpose().mmul(a).div(a.transpose().mmul(a).get(0,0)),d=d.div(d.norm()),u=t.mmul(d).div(d.transpose().mmul(d).get(0,0)),e>0&&(l=u.clone().sub(c).pow(2).sum()),c=u.clone(),r?(h=r.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),h=h.div(h.norm()),a=r.mmul(h).div(h.transpose().mmul(h).get(0,0))):a=u;if(r){let e=t.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0));e=e.div(e.norm());let n=t.clone().sub(u.clone().mmul(e.transpose())),o=a.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),i=r.clone().sub(u.clone().mulS(o.get(0,0)).mmul(h.transpose()));this.t=u,this.p=e.transpose(),this.w=d.transpose(),this.q=h,this.u=a,this.s=u.transpose().mmul(u),this.xResidual=n,this.yResidual=i,this.betas=o}else this.w=d.transpose(),this.s=u.transpose().mmul(u).sqrt(),this.t=o?u.clone().div(this.s.get(0,0)):u,this.xResidual=t.sub(u.mmul(d.transpose()))}}e.y3=x,e.jy=L,e.oN=L,e.Hc=M,e.cg=P,e.hj=P,e.LU=S,e.Tb=S,e.uq=E,e.Zm=class extends _{constructor(t,e){p(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,r){return this.matrix.set(t,this.columnIndices[e],r),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}},e.Dq=class extends _{constructor(t,e){c(t,e),super(t,t.rows,1),this.column=e}set(t,e,r){return this.matrix.set(t,this.column,r),this}get(t){return this.matrix.get(t,this.column)}},e.__=class extends _{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(t,this.columns-e-1,r),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}},e.q0=class extends _{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(this.rows-t-1,e,r),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}},e.lh=class extends _{constructor(t,e){g(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,r){return this.matrix.set(this.rowIndices[t],e,r),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}},e.pI=class extends _{constructor(t,e){d(t,e),super(t,1,t.columns),this.row=e}set(t,e,r){return this.matrix.set(this.row,e,r),this}get(t,e){return this.matrix.get(this.row,e)}},e.zC=k,e.zg=class extends _{constructor(t,e,r,n,o){v(t,e,r,n,o),super(t,r-e+1,o-n+1),this.startRow=e,this.startColumn=n}set(t,e,r){return this.matrix.set(this.startRow+t,this.startColumn+e,r),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}},e.g6=class extends _{constructor(t){super(t,t.columns,t.rows)}set(t,e,r){return this.matrix.set(e,t,r),this}get(t,e){return this.matrix.get(e,t)}},e.OL=F,e.ks=F,e.QR=z,e.jp=z,e.mk=R,e.W2=R,e.l=N,e.KY=A,e.dv=j,e.BR=function(t,e=t,r={}){t=new E(t);let o=!1;if("object"!=typeof e||E.isMatrix(e)||n.isAnyArray(e)?e=new E(e):(r=e,e=t,o=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0,scale:s=!0}=r;i&&(t.center("column"),o||e.center("column")),s&&(t.scale("column"),o||e.scale("column"));const a=t.standardDeviation("column",{unbiased:!0}),u=o?a:e.standardDeviation("column",{unbiased:!0}),h=t.transpose().mmul(e);for(let e=0;e<h.rows;e++)for(let r=0;r<h.columns;r++)h.set(e,r,h.get(e,r)*(1/(a[e]*u[r]))*(1/(t.rows-1)));return h},e.Wu=function(t,e=t,r={}){t=new E(t);let o=!1;if("object"!=typeof e||E.isMatrix(e)||n.isAnyArray(e)?e=new E(e):(r=e,e=t,o=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0}=r;i&&(t=t.center("column"),o||(e=e.center("column")));const s=t.transpose().mmul(e);for(let e=0;e<s.rows;e++)for(let r=0;r<s.columns;r++)s.set(e,r,s.get(e,r)*(1/(t.rows-1)));return s},e.a4=function t(e){if((e=E.checkMatrix(e)).isSquare()){if(0===e.columns)return 1;let r,n,o,i;if(2===e.columns)return r=e.get(0,0),n=e.get(0,1),o=e.get(1,0),i=e.get(1,1),r*i-n*o;if(3===e.columns){let i,s,a;return i=new k(e,[1,2],[1,2]),s=new k(e,[1,2],[0,2]),a=new k(e,[1,2],[0,1]),r=e.get(0,0),n=e.get(0,1),o=e.get(0,2),r*t(i)-n*t(s)+o*t(a)}return new S(e).determinant}throw Error("determinant can only be calculated for a square matrix")},e.DI=function(t,e=!1){return t=j.checkMatrix(t),e?new R(t).inverse():I(t,E.eye(t.rows))},e.Jo=function(t,e={}){const{thresholdValue:r=1e-9,thresholdError:n=1e-9}=e;let o=(t=E.checkMatrix(t)).rows,i=new E(o,o);for(let e=0;e<o;e++){let s=E.columnVector(t.getRow(e)),a=t.subMatrixRow(C(o,e)).transpose(),u=new R(a).solve(s),h=E.sub(s,a.mmul(u)).abs().max();i.setRow(e,D(h,u,e,r,n))}return i},e.Zi=function(t,e=Number.EPSILON){if((t=E.checkMatrix(t)).isEmpty())return t.transpose();let r=new R(t,{autoTranspose:!0}),n=r.leftSingularVectors,o=r.rightSingularVectors,i=r.diagonal;for(let t=0;t<i.length;t++)Math.abs(i[t])>e?i[t]=1/i[t]:i[t]=0;return o.mmul(E.diag(i).mmul(n.transpose()))},e.kH=I,e.LV=function(t,e){if(n.isAnyArray(t))return t[0]&&n.isAnyArray(t[0])?new j(t):new A(t,e);throw new Error("the argument is not an array")}},2583:(t,e,r)=>{var n=r(6135),o=["stopLayout","calculateLayout"];t.exports=function(){var t=new Worker(URL.createObjectURL(new Blob(['(()=>{var t={4341:(t,e,r)=>{t.exports={graphlib:r(3374),layout:r(9407),debug:r(6978),util:{time:r(6573).time,notime:r(6573).notime},version:r(6661)}},9317:(t,e,r)=>{"use strict";var n=r(5076),o=r(3526);t.exports={run:function(t){var e="greedy"===t.graph().acyclicer?o(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],r={},o={};return n.forEach(t.nodes(),(function i(s){n.has(o,s)||(o[s]=!0,r[s]=!0,n.forEach(t.outEdges(s),(function(t){n.has(r,t.w)?e.push(t):i(t.w)})),delete r[s])})),e}(t);n.forEach(e,(function(e){var r=t.edge(e);t.removeEdge(e),r.forwardName=e.name,r.reversed=!0,t.setEdge(e.w,e.v,r,n.uniqueId("rev"))}))},undo:function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.reversed){t.removeEdge(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}}))}}},7840:(t,e,r)=>{var n=r(5076),o=r(6573);function i(t,e,r,n,i,s){var a={width:0,height:0,rank:s,borderType:e},u=i[e][s-1],h=o.addDummyNode(t,"border",a,r);i[e][s]=h,t.setParent(h,n),u&&t.setEdge(u,h,{weight:1})}t.exports=function(t){n.forEach(t.children(),(function e(r){var o=t.children(r),s=t.node(r);if(o.length&&n.forEach(o,e),n.has(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(var a=s.minRank,u=s.maxRank+1;a<u;++a)i(t,"borderLeft","_bl",r,s,a),i(t,"borderRight","_br",r,s,a)}}))}},5793:(t,e,r)=>{"use strict";var n=r(5076);function o(t){n.forEach(t.nodes(),(function(e){i(t.node(e))})),n.forEach(t.edges(),(function(e){i(t.edge(e))}))}function i(t){var e=t.width;t.width=t.height,t.height=e}function s(t){t.y=-t.y}function a(t){var e=t.x;t.x=t.y,t.y=e}t.exports={adjust:function(t){var e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||o(t)},undo:function(t){var e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){n.forEach(t.nodes(),(function(e){s(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.forEach(r.points,s),n.has(r,"y")&&s(r)}))}(t),"lr"!==e&&"rl"!==e||(function(t){n.forEach(t.nodes(),(function(e){a(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.forEach(r.points,a),n.has(r,"x")&&a(r)}))}(t),o(t))}}},5752:t=>{function e(){var t={};t._next=t._prev=t,this._sentinel=t}function r(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function n(t,e){if("_next"!==t&&"_prev"!==t)return e}t.exports=e,e.prototype.dequeue=function(){var t=this._sentinel,e=t._prev;if(e!==t)return r(e),e},e.prototype.enqueue=function(t){var e=this._sentinel;t._prev&&t._next&&r(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e},e.prototype.toString=function(){for(var t=[],e=this._sentinel,r=e._prev;r!==e;)t.push(JSON.stringify(r,n)),r=r._prev;return"["+t.join(", ")+"]"}},6978:(t,e,r)=>{var n=r(5076),o=r(6573),i=r(3374).Graph;t.exports={debugOrdering:function(t){var e=o.buildLayerMatrix(t),r=new i({compound:!0,multigraph:!0}).setGraph({});return n.forEach(t.nodes(),(function(e){r.setNode(e,{label:e}),r.setParent(e,"layer"+t.node(e).rank)})),n.forEach(t.edges(),(function(t){r.setEdge(t.v,t.w,{},t.name)})),n.forEach(e,(function(t,e){var o="layer"+e;r.setNode(o,{rank:"same"}),n.reduce(t,(function(t,e){return r.setEdge(t,e,{style:"invis"}),e}))})),r}}},3374:(t,e,r)=>{var n;try{n=r(7423)}catch(t){}n||(n=window.graphlib),t.exports=n},3526:(t,e,r)=>{var n=r(5076),o=r(3374).Graph,i=r(5752);t.exports=function(t,e){if(t.nodeCount()<=1)return[];var r=function(t,e){var r=new o,s=0,a=0;n.forEach(t.nodes(),(function(t){r.setNode(t,{v:t,in:0,out:0})})),n.forEach(t.edges(),(function(t){var n=r.edge(t.v,t.w)||0,o=e(t),i=n+o;r.setEdge(t.v,t.w,i),a=Math.max(a,r.node(t.v).out+=o),s=Math.max(s,r.node(t.w).in+=o)}));var h=n.range(a+s+3).map((function(){return new i})),d=s+1;return n.forEach(r.nodes(),(function(t){u(h,d,r.node(t))})),{graph:r,buckets:h,zeroIdx:d}}(t,e||s),h=function(t,e,r){for(var n,o=[],i=e[e.length-1],s=e[0];t.nodeCount();){for(;n=s.dequeue();)a(t,e,r,n);for(;n=i.dequeue();)a(t,e,r,n);if(t.nodeCount())for(var u=e.length-2;u>0;--u)if(n=e[u].dequeue()){o=o.concat(a(t,e,r,n,!0));break}}return o}(r.graph,r.buckets,r.zeroIdx);return n.flatten(n.map(h,(function(e){return t.outEdges(e.v,e.w)})),!0)};var s=n.constant(1);function a(t,e,r,o,i){var s=i?[]:void 0;return n.forEach(t.inEdges(o.v),(function(n){var o=t.edge(n),a=t.node(n.v);i&&s.push({v:n.v,w:n.w}),a.out-=o,u(e,r,a)})),n.forEach(t.outEdges(o.v),(function(n){var o=t.edge(n),i=n.w,s=t.node(i);s.in-=o,u(e,r,s)})),t.removeNode(o.v),s}function u(t,e,r){r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)}},9407:(t,e,r)=>{"use strict";var n=r(5076),o=r(9317),i=r(9934),s=r(9472),a=r(6573).normalizeRanks,u=r(9095),h=r(6573).removeEmptyRanks,d=r(9526),c=r(7840),l=r(5793),f=r(9186),g=r(9497),p=r(6573),v=r(3374).Graph;t.exports=function(t,e){var r=e&&e.debugTiming?p.time:p.notime;r("layout",(function(){var e=r(" buildLayoutGraph",(function(){return function(t){var e=new v({multigraph:!0,compound:!0}),r=k(t.graph());return e.setGraph(n.merge({},y,_(r,m),n.pick(r,w))),n.forEach(t.nodes(),(function(r){var o=k(t.node(r));e.setNode(r,n.defaults(_(o,x),b)),e.setParent(r,t.parent(r))})),n.forEach(t.edges(),(function(r){var o=k(t.edge(r));e.setEdge(r,n.merge({},N,_(o,E),n.pick(o,M)))})),e}(t)}));r(" runLayout",(function(){!function(t,e){e(" makeSpaceForEdgeLabels",(function(){!function(t){var e=t.graph();e.ranksep/=2,n.forEach(t.edges(),(function(r){var n=t.edge(r);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)}))}(t)})),e(" removeSelfEdges",(function(){!function(t){n.forEach(t.edges(),(function(e){if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}}))}(t)})),e(" acyclic",(function(){o.run(t)})),e(" nestingGraph.run",(function(){d.run(t)})),e(" rank",(function(){s(p.asNonCompoundGraph(t))})),e(" injectEdgeLabelProxies",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.width&&r.height){var n=t.node(e.v),o={rank:(t.node(e.w).rank-n.rank)/2+n.rank,e};p.addDummyNode(t,"edge-proxy",o,"_ep")}}))}(t)})),e(" removeEmptyRanks",(function(){h(t)})),e(" nestingGraph.cleanup",(function(){d.cleanup(t)})),e(" normalizeRanks",(function(){a(t)})),e(" assignRankMinMax",(function(){!function(t){var e=0;n.forEach(t.nodes(),(function(r){var o=t.node(r);o.borderTop&&(o.minRank=t.node(o.borderTop).rank,o.maxRank=t.node(o.borderBottom).rank,e=n.max(e,o.maxRank))})),t.graph().maxRank=e}(t)})),e(" removeEdgeLabelProxies",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);"edge-proxy"===r.dummy&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))}))}(t)})),e(" normalize.run",(function(){i.run(t)})),e(" parentDummyChains",(function(){u(t)})),e(" addBorderSegments",(function(){c(t)})),e(" order",(function(){f(t)})),e(" insertSelfEdges",(function(){!function(t){var e=p.buildLayerMatrix(t);n.forEach(e,(function(e){var r=0;n.forEach(e,(function(e,o){var i=t.node(e);i.order=o+r,n.forEach(i.selfEdges,(function(e){p.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:o+ ++r,e:e.e,label:e.label},"_se")})),delete i.selfEdges}))}))}(t)})),e(" adjustCoordinateSystem",(function(){l.adjust(t)})),e(" position",(function(){g(t)})),e(" positionSelfEdges",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),o=n.x+n.width/2,i=n.y,s=r.x-o,a=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{x:o+s,y:i},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.label.x=r.x,r.label.y=r.y}}))}(t)})),e(" removeBorderNodes",(function(){!function(t){n.forEach(t.nodes(),(function(e){if(t.children(e).length){var r=t.node(e),o=t.node(r.borderTop),i=t.node(r.borderBottom),s=t.node(n.last(r.borderLeft)),a=t.node(n.last(r.borderRight));r.width=Math.abs(a.x-s.x),r.height=Math.abs(i.y-o.y),r.x=s.x+r.width/2,r.y=o.y+r.height/2}})),n.forEach(t.nodes(),(function(e){"border"===t.node(e).dummy&&t.removeNode(e)}))}(t)})),e(" normalize.undo",(function(){i.undo(t)})),e(" fixupEdgeLabelCoords",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(n.has(r,"x"))switch("l"!==r.labelpos&&"r"!==r.labelpos||(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}}))}(t)})),e(" undoCoordinateSystem",(function(){l.undo(t)})),e(" translateGraph",(function(){!function(t){var e=Number.POSITIVE_INFINITY,r=0,o=Number.POSITIVE_INFINITY,i=0,s=t.graph(),a=s.marginx||0,u=s.marginy||0;function h(t){var n=t.x,s=t.y,a=t.width,u=t.height;e=Math.min(e,n-a/2),r=Math.max(r,n+a/2),o=Math.min(o,s-u/2),i=Math.max(i,s+u/2)}n.forEach(t.nodes(),(function(e){h(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.has(r,"x")&&h(r)})),e-=a,o-=u,n.forEach(t.nodes(),(function(r){var n=t.node(r);n.x-=e,n.y-=o})),n.forEach(t.edges(),(function(r){var i=t.edge(r);n.forEach(i.points,(function(t){t.x-=e,t.y-=o})),n.has(i,"x")&&(i.x-=e),n.has(i,"y")&&(i.y-=o)})),s.width=r-e+a,s.height=i-o+u}(t)})),e(" assignNodeIntersects",(function(){!function(t){n.forEach(t.edges(),(function(e){var r,n,o=t.edge(e),i=t.node(e.v),s=t.node(e.w);o.points?(r=o.points[0],n=o.points[o.points.length-1]):(o.points=[],r=s,n=i),o.points.unshift(p.intersectRect(i,r)),o.points.push(p.intersectRect(s,n))}))}(t)})),e(" reversePoints",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);r.reversed&&r.points.reverse()}))}(t)})),e(" acyclic.undo",(function(){o.undo(t)}))}(e,r)})),r(" updateInputGraph",(function(){!function(t,e){n.forEach(t.nodes(),(function(r){var n=t.node(r),o=e.node(r);n&&(n.x=o.x,n.y=o.y,e.children(r).length&&(n.width=o.width,n.height=o.height))})),n.forEach(t.edges(),(function(r){var o=t.edge(r),i=e.edge(r);o.points=i.points,n.has(i,"x")&&(o.x=i.x,o.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,e)}))}))};var m=["nodesep","edgesep","ranksep","marginx","marginy"],y={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},w=["acyclicer","ranker","rankdir","align"],x=["width","height"],b={width:0,height:0},E=["minlen","weight","width","height","labeloffset"],N={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},M=["labelpos"];function _(t,e){return n.mapValues(n.pick(t,e),Number)}function k(t){var e={};return n.forEach(t,(function(t,r){e[r.toLowerCase()]=t})),e}},5076:(t,e,r)=>{var n;try{n={cloneDeep:r(9136),constant:r(8295),defaults:r(9529),each:r(958),filter:r(9969),find:r(828),flatten:r(7469),forEach:r(1117),forIn:r(4519),has:r(4339),isUndefined:r(2895),last:r(5179),map:r(9629),mapValues:r(5551),max:r(4213),merge:r(2495),min:r(9903),minBy:r(3262),now:r(8835),pick:r(222),range:r(4978),reduce:r(9285),sortBy:r(5246),uniqueId:r(761),values:r(3005),zipObject:r(3679)}}catch(t){}n||(n=window._),t.exports=n},9526:(t,e,r)=>{var n=r(5076),o=r(6573);function i(t,e,r,s,a,u,h){var d=t.children(h);if(d.length){var c=o.addBorderNode(t,"_bt"),l=o.addBorderNode(t,"_bb"),f=t.node(h);t.setParent(c,h),f.borderTop=c,t.setParent(l,h),f.borderBottom=l,n.forEach(d,(function(n){i(t,e,r,s,a,u,n);var o=t.node(n),d=o.borderTop?o.borderTop:n,f=o.borderBottom?o.borderBottom:n,g=o.borderTop?s:2*s,p=d!==f?1:a-u[h]+1;t.setEdge(c,d,{weight:g,minlen:p,nestingEdge:!0}),t.setEdge(f,l,{weight:g,minlen:p,nestingEdge:!0})})),t.parent(h)||t.setEdge(e,c,{weight:0,minlen:a+u[h]})}else h!==e&&t.setEdge(e,h,{weight:0,minlen:r})}t.exports={run:function(t){var e=o.addDummyNode(t,"root",{},"_root"),r=function(t){var e={};function r(o,i){var s=t.children(o);s&&s.length&&n.forEach(s,(function(t){r(t,i+1)})),e[o]=i}return n.forEach(t.children(),(function(t){r(t,1)})),e}(t),s=n.max(n.values(r))-1,a=2*s+1;t.graph().nestingRoot=e,n.forEach(t.edges(),(function(e){t.edge(e).minlen*=a}));var u=function(t){return n.reduce(t.edges(),(function(e,r){return e+t.edge(r).weight}),0)}(t)+1;n.forEach(t.children(),(function(n){i(t,e,a,u,s,r,n)})),t.graph().nodeRankFactor=a},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,n.forEach(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}}},9934:(t,e,r)=>{"use strict";var n=r(5076),o=r(6573);t.exports={run:function(t){t.graph().dummyChains=[],n.forEach(t.edges(),(function(e){!function(t,e){var r,n,i,s=e.v,a=t.node(s).rank,u=e.w,h=t.node(u).rank,d=e.name,c=t.edge(e),l=c.labelRank;if(h!==a+1){for(t.removeEdge(e),i=0,++a;a<h;++i,++a)c.points=[],n={width:0,height:0,edgeLabel:c,edgeObj:e,rank:a},r=o.addDummyNode(t,"edge",n,"_d"),a===l&&(n.width=c.width,n.height=c.height,n.dummy="edge-label",n.labelpos=c.labelpos),t.setEdge(s,r,{weight:c.weight},d),0===i&&t.graph().dummyChains.push(r),s=r;t.setEdge(s,u,{weight:c.weight},d)}}(t,e)}))},undo:function(t){n.forEach(t.graph().dummyChains,(function(e){var r,n=t.node(e),o=n.edgeLabel;for(t.setEdge(n.edgeObj,o);n.dummy;)r=t.successors(e)[0],t.removeNode(e),o.points.push({x:n.x,y:n.y}),"edge-label"===n.dummy&&(o.x=n.x,o.y=n.y,o.width=n.width,o.height=n.height),e=r,n=t.node(e)}))}}},9841:(t,e,r)=>{var n=r(5076);t.exports=function(t,e,r){var o,i={};n.forEach(r,(function(r){for(var n,s,a=t.parent(r);a;){if((n=t.parent(a))?(s=i[n],i[n]=a):(s=o,o=a),s&&s!==a)return void e.setEdge(s,a);a=n}}))}},5458:(t,e,r)=>{var n=r(5076);t.exports=function(t,e){return n.map(e,(function(e){var r=t.inEdges(e);if(r.length){var o=n.reduce(r,(function(e,r){var n=t.edge(r),o=t.node(r.v);return{sum:e.sum+n.weight*o.order,weight:e.weight+n.weight}}),{sum:0,weight:0});return{v:e,barycenter:o.sum/o.weight,weight:o.weight}}return{v:e}}))}},6263:(t,e,r)=>{var n=r(5076),o=r(3374).Graph;t.exports=function(t,e,r){var i=function(t){for(var e;t.hasNode(e=n.uniqueId("_root")););return e}(t),s=new o({compound:!0}).setGraph({root:i}).setDefaultNodeLabel((function(e){return t.node(e)}));return n.forEach(t.nodes(),(function(o){var a=t.node(o),u=t.parent(o);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(s.setNode(o),s.setParent(o,u||i),n.forEach(t[r](o),(function(e){var r=e.v===o?e.w:e.v,i=s.edge(r,o),a=n.isUndefined(i)?0:i.weight;s.setEdge(r,o,{weight:t.edge(e).weight+a})})),n.has(a,"minRank")&&s.setNode(o,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))})),s}},6840:(t,e,r)=>{"use strict";var n=r(5076);function o(t,e,r){for(var o=n.zipObject(r,n.map(r,(function(t,e){return e}))),i=n.flatten(n.map(e,(function(e){return n.sortBy(n.map(t.outEdges(e),(function(e){return{pos:o[e.w],weight:t.edge(e).weight}})),"pos")})),!0),s=1;s<r.length;)s<<=1;var a=2*s-1;s-=1;var u=n.map(new Array(a),(function(){return 0})),h=0;return n.forEach(i.forEach((function(t){var e=t.pos+s;u[e]+=t.weight;for(var r=0;e>0;)e%2&&(r+=u[e+1]),u[e=e-1>>1]+=t.weight;h+=t.weight*r}))),h}t.exports=function(t,e){for(var r=0,n=1;n<e.length;++n)r+=o(t,e[n-1],e[n]);return r}},9186:(t,e,r)=>{"use strict";var n=r(5076),o=r(1879),i=r(6840),s=r(9387),a=r(6263),u=r(9841),h=r(3374).Graph,d=r(6573);function c(t,e,r){return n.map(e,(function(e){return a(t,e,r)}))}function l(t,e){var r=new h;n.forEach(t,(function(t){var o=t.graph().root,i=s(t,o,r,e);n.forEach(i.vs,(function(e,r){t.node(e).order=r})),u(t,r,i.vs)}))}function f(t,e){n.forEach(e,(function(e){n.forEach(e,(function(e,r){t.node(e).order=r}))}))}t.exports=function(t){var e=d.maxRank(t),r=c(t,n.range(1,e+1),"inEdges"),s=c(t,n.range(e-1,-1,-1),"outEdges"),a=o(t);f(t,a);for(var u,h=Number.POSITIVE_INFINITY,g=0,p=0;p<4;++g,++p){l(g%2?r:s,g%4>=2),a=d.buildLayerMatrix(t);var v=i(t,a);v<h&&(p=0,u=n.cloneDeep(a),h=v)}f(t,u)}},1879:(t,e,r)=>{"use strict";var n=r(5076);t.exports=function(t){var e={},r=n.filter(t.nodes(),(function(e){return!t.children(e).length})),o=n.max(n.map(r,(function(e){return t.node(e).rank}))),i=n.map(n.range(o+1),(function(){return[]})),s=n.sortBy(r,(function(e){return t.node(e).rank}));return n.forEach(s,(function r(o){if(!n.has(e,o)){e[o]=!0;var s=t.node(o);i[s.rank].push(o),n.forEach(t.successors(o),r)}})),i}},5912:(t,e,r)=>{"use strict";var n=r(5076);t.exports=function(t,e){var r={};return n.forEach(t,(function(t,e){var o=r[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};n.isUndefined(t.barycenter)||(o.barycenter=t.barycenter,o.weight=t.weight)})),n.forEach(e.edges(),(function(t){var e=r[t.v],o=r[t.w];n.isUndefined(e)||n.isUndefined(o)||(o.indegree++,e.out.push(r[t.w]))})),function(t){var e=[];function r(t){return function(e){var r,o,i,s;e.merged||(n.isUndefined(e.barycenter)||n.isUndefined(t.barycenter)||e.barycenter>=t.barycenter)&&(o=e,i=0,s=0,(r=t).weight&&(i+=r.barycenter*r.weight,s+=r.weight),o.weight&&(i+=o.barycenter*o.weight,s+=o.weight),r.vs=o.vs.concat(r.vs),r.barycenter=i/s,r.weight=s,r.i=Math.min(o.i,r.i),o.merged=!0)}}function o(e){return function(r){r.in.push(e),0==--r.indegree&&t.push(r)}}for(;t.length;){var i=t.pop();e.push(i),n.forEach(i.in.reverse(),r(i)),n.forEach(i.out,o(i))}return n.map(n.filter(e,(function(t){return!t.merged})),(function(t){return n.pick(t,["vs","i","barycenter","weight"])}))}(n.filter(r,(function(t){return!t.indegree})))}},9387:(t,e,r)=>{var n=r(5076),o=r(5458),i=r(5912),s=r(256);t.exports=function t(e,r,a,u){var h=e.children(r),d=e.node(r),c=d?d.borderLeft:void 0,l=d?d.borderRight:void 0,f={};c&&(h=n.filter(h,(function(t){return t!==c&&t!==l})));var g=o(e,h);n.forEach(g,(function(r){if(e.children(r.v).length){var o=t(e,r.v,a,u);f[r.v]=o,n.has(o,"barycenter")&&(i=r,s=o,n.isUndefined(i.barycenter)?(i.barycenter=s.barycenter,i.weight=s.weight):(i.barycenter=(i.barycenter*i.weight+s.barycenter*s.weight)/(i.weight+s.weight),i.weight+=s.weight))}var i,s}));var p=i(g,a);!function(t,e){n.forEach(t,(function(t){t.vs=n.flatten(t.vs.map((function(t){return e[t]?e[t].vs:t})),!0)}))}(p,f);var v=s(p,u);if(c&&(v.vs=n.flatten([c,v.vs,l],!0),e.predecessors(c).length)){var m=e.node(e.predecessors(c)[0]),y=e.node(e.predecessors(l)[0]);n.has(v,"barycenter")||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+m.order+y.order)/(v.weight+2),v.weight+=2}return v}},256:(t,e,r)=>{var n=r(5076),o=r(6573);function i(t,e,r){for(var o;e.length&&(o=n.last(e)).i<=r;)e.pop(),t.push(o.vs),r++;return r}t.exports=function(t,e){var r,s=o.partition(t,(function(t){return n.has(t,"barycenter")})),a=s.lhs,u=n.sortBy(s.rhs,(function(t){return-t.i})),h=[],d=0,c=0,l=0;a.sort((r=!!e,function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:r?e.i-t.i:t.i-e.i})),l=i(h,u,l),n.forEach(a,(function(t){l+=t.vs.length,h.push(t.vs),d+=t.barycenter*t.weight,c+=t.weight,l=i(h,u,l)}));var f={vs:n.flatten(h,!0)};return c&&(f.barycenter=d/c,f.weight=c),f}},9095:(t,e,r)=>{var n=r(5076);t.exports=function(t){var e=function(t){var e={},r=0;return n.forEach(t.children(),(function o(i){var s=r;n.forEach(t.children(i),o),e[i]={low:s,lim:r++}})),e}(t);n.forEach(t.graph().dummyChains,(function(r){for(var n=t.node(r),o=n.edgeObj,i=function(t,e,r,n){var o,i,s=[],a=[],u=Math.min(e[r].low,e[n].low),h=Math.max(e[r].lim,e[n].lim);o=r;do{o=t.parent(o),s.push(o)}while(o&&(e[o].low>u||h>e[o].lim));for(i=o,o=n;(o=t.parent(o))!==i;)a.push(o);return{path:s.concat(a.reverse()),lca:i}}(t,e,o.v,o.w),s=i.path,a=i.lca,u=0,h=s[u],d=!0;r!==o.w;){if(n=t.node(r),d){for(;(h=s[u])!==a&&t.node(h).maxRank<n.rank;)u++;h===a&&(d=!1)}if(!d){for(;u<s.length-1&&t.node(h=s[u+1]).minRank<=n.rank;)u++;h=s[u]}t.setParent(r,h),r=t.successors(r)[0]}}))}},2738:(t,e,r)=>{"use strict";var n=r(5076),o=r(3374).Graph,i=r(6573);function s(t,e){var r={};return n.reduce(e,(function(e,o){var i=0,s=0,a=e.length,h=n.last(o);return n.forEach(o,(function(e,d){var c=function(t,e){if(t.node(e).dummy)return n.find(t.predecessors(e),(function(e){return t.node(e).dummy}))}(t,e),l=c?t.node(c).order:a;(c||e===h)&&(n.forEach(o.slice(s,d+1),(function(e){n.forEach(t.predecessors(e),(function(n){var o=t.node(n),s=o.order;!(s<i||l<s)||o.dummy&&t.node(e).dummy||u(r,n,e)}))})),s=d+1,i=l)})),o})),r}function a(t,e){var r={};function o(e,o,i,s,a){var h;n.forEach(n.range(o,i),(function(o){h=e[o],t.node(h).dummy&&n.forEach(t.predecessors(h),(function(e){var n=t.node(e);n.dummy&&(n.order<s||n.order>a)&&u(r,e,h)}))}))}return n.reduce(e,(function(e,r){var i,s=-1,a=0;return n.forEach(r,(function(n,u){if("border"===t.node(n).dummy){var h=t.predecessors(n);h.length&&(i=t.node(h[0]).order,o(r,a,u,s,i),a=u,s=i)}o(r,a,r.length,i,e.length)})),r})),r}function u(t,e,r){if(e>r){var n=e;e=r,r=n}var o=t[e];o||(t[e]=o={}),o[r]=!0}function h(t,e,r){if(e>r){var o=e;e=r,r=o}return n.has(t[e],r)}function d(t,e,r,o){var i={},s={},a={};return n.forEach(e,(function(t){n.forEach(t,(function(t,e){i[t]=t,s[t]=t,a[t]=e}))})),n.forEach(e,(function(t){var e=-1;n.forEach(t,(function(t){var u=o(t);if(u.length){u=n.sortBy(u,(function(t){return a[t]}));for(var d=(u.length-1)/2,c=Math.floor(d),l=Math.ceil(d);c<=l;++c){var f=u[c];s[t]===t&&e<a[f]&&!h(r,t,f)&&(s[f]=t,s[t]=i[t]=i[f],e=a[f])}}}))})),{root:i,align:s}}function c(t,e,r,i,s){var a={},u=function(t,e,r,i){var s=new o,a=t.graph(),u=function(t,e,r){return function(o,i,s){var a,u=o.node(i),h=o.node(s),d=0;if(d+=u.width/2,n.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(d+=r?a:-a),a=0,d+=(u.dummy?e:t)/2,d+=(h.dummy?e:t)/2,d+=h.width/2,n.has(h,"labelpos"))switch(h.labelpos.toLowerCase()){case"l":a=h.width/2;break;case"r":a=-h.width/2}return a&&(d+=r?a:-a),a=0,d}}(a.nodesep,a.edgesep,i);return n.forEach(e,(function(e){var o;n.forEach(e,(function(e){var n=r[e];if(s.setNode(n),o){var i=r[o],a=s.edge(i,n);s.setEdge(i,n,Math.max(u(t,e,o),a||0))}o=e}))})),s}(t,e,r,s),h=s?"borderLeft":"borderRight";function d(t,e){for(var r=u.nodes(),n=r.pop(),o={};n;)o[n]?t(n):(o[n]=!0,r.push(n),r=r.concat(e(n))),n=r.pop()}return d((function(t){a[t]=u.inEdges(t).reduce((function(t,e){return Math.max(t,a[e.v]+u.edge(e))}),0)}),u.predecessors.bind(u)),d((function(e){var r=u.outEdges(e).reduce((function(t,e){return Math.min(t,a[e.w]-u.edge(e))}),Number.POSITIVE_INFINITY),n=t.node(e);r!==Number.POSITIVE_INFINITY&&n.borderType!==h&&(a[e]=Math.max(a[e],r))}),u.successors.bind(u)),n.forEach(i,(function(t){a[t]=a[r[t]]})),a}function l(t,e){return n.minBy(n.values(e),(function(e){var r=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return n.forIn(e,(function(e,n){var i=function(t,e){return t.node(e).width}(t,n)/2;r=Math.max(e+i,r),o=Math.min(e-i,o)})),r-o}))}function f(t,e){var r=n.values(e),o=n.min(r),i=n.max(r);n.forEach(["u","d"],(function(r){n.forEach(["l","r"],(function(s){var a,u=r+s,h=t[u];if(h!==e){var d=n.values(h);(a="l"===s?o-n.min(d):i-n.max(d))&&(t[u]=n.mapValues(h,(function(t){return t+a})))}}))}))}function g(t,e){return n.mapValues(t.ul,(function(r,o){if(e)return t[e.toLowerCase()][o];var i=n.sortBy(n.map(t,o));return(i[1]+i[2])/2}))}t.exports={positionX:function(t){var e,r=i.buildLayerMatrix(t),o=n.merge(s(t,r),a(t,r)),u={};n.forEach(["u","d"],(function(i){e="u"===i?r:n.values(r).reverse(),n.forEach(["l","r"],(function(r){"r"===r&&(e=n.map(e,(function(t){return n.values(t).reverse()})));var s=("u"===i?t.predecessors:t.successors).bind(t),a=d(0,e,o,s),h=c(t,e,a.root,a.align,"r"===r);"r"===r&&(h=n.mapValues(h,(function(t){return-t}))),u[i+r]=h}))}));var h=l(t,u);return f(u,h),g(u,t.graph().align)},findType1Conflicts:s,findType2Conflicts:a,addConflict:u,hasConflict:h,verticalAlignment:d,horizontalCompaction:c,alignCoordinates:f,findSmallestWidthAlignment:l,balance:g}},9497:(t,e,r)=>{"use strict";var n=r(5076),o=r(6573),i=r(2738).positionX;t.exports=function(t){(function(t){var e=o.buildLayerMatrix(t),r=t.graph().ranksep,i=0;n.forEach(e,(function(e){var o=n.max(n.map(e,(function(e){return t.node(e).height})));n.forEach(e,(function(e){t.node(e).y=i+o/2})),i+=o+r}))})(t=o.asNonCompoundGraph(t)),n.forEach(i(t),(function(e,r){t.node(r).x=e}))}},9996:(t,e,r)=>{"use strict";var n=r(5076),o=r(3374).Graph,i=r(8666).slack;function s(t,e){return n.forEach(t.nodes(),(function r(o){n.forEach(e.nodeEdges(o),(function(n){var s=n.v,a=o===s?n.w:s;t.hasNode(a)||i(e,n)||(t.setNode(a,{}),t.setEdge(o,a,{}),r(a))}))})),t.nodeCount()}function a(t,e){return n.minBy(e.edges(),(function(r){if(t.hasNode(r.v)!==t.hasNode(r.w))return i(e,r)}))}function u(t,e,r){n.forEach(t.nodes(),(function(t){e.node(t).rank+=r}))}t.exports=function(t){var e,r,n=new o({directed:!1}),h=t.nodes()[0],d=t.nodeCount();for(n.setNode(h,{});s(n,t)<d;)e=a(n,t),r=n.hasNode(e.v)?i(t,e):-i(t,e),u(n,t,r);return n}},9472:(t,e,r)=>{"use strict";var n=r(8666).longestPath,o=r(9996),i=r(4502);t.exports=function(t){switch(t.graph().ranker){case"network-simplex":default:!function(t){i(t)}(t);break;case"tight-tree":!function(t){n(t),o(t)}(t);break;case"longest-path":s(t)}};var s=n},4502:(t,e,r)=>{"use strict";var n=r(5076),o=r(9996),i=r(8666).slack,s=r(8666).longestPath,a=r(3374).alg.preorder,u=r(3374).alg.postorder,h=r(6573).simplify;function d(t){t=h(t),s(t);var e,r=o(t);for(f(r),c(r,t);e=p(r);)m(r,t,e,v(r,t,e))}function c(t,e){var r=u(t,t.nodes());r=r.slice(0,r.length-1),n.forEach(r,(function(r){!function(t,e,r){var n=t.node(r).parent;t.edge(r,n).cutvalue=l(t,e,r)}(t,e,r)}))}function l(t,e,r){var o=t.node(r).parent,i=!0,s=e.edge(r,o),a=0;return s||(i=!1,s=e.edge(o,r)),a=s.weight,n.forEach(e.nodeEdges(r),(function(n){var s,u,h=n.v===r,d=h?n.w:n.v;if(d!==o){var c=h===i,l=e.edge(n).weight;if(a+=c?l:-l,s=r,u=d,t.hasEdge(s,u)){var f=t.edge(r,d).cutvalue;a+=c?-f:f}}})),a}function f(t,e){arguments.length<2&&(e=t.nodes()[0]),g(t,{},1,e)}function g(t,e,r,o,i){var s=r,a=t.node(o);return e[o]=!0,n.forEach(t.neighbors(o),(function(i){n.has(e,i)||(r=g(t,e,r,i,o))})),a.low=s,a.lim=r++,i?a.parent=i:delete a.parent,r}function p(t){return n.find(t.edges(),(function(e){return t.edge(e).cutvalue<0}))}function v(t,e,r){var o=r.v,s=r.w;e.hasEdge(o,s)||(o=r.w,s=r.v);var a=t.node(o),u=t.node(s),h=a,d=!1;a.lim>u.lim&&(h=u,d=!0);var c=n.filter(e.edges(),(function(e){return d===y(0,t.node(e.v),h)&&d!==y(0,t.node(e.w),h)}));return n.minBy(c,(function(t){return i(e,t)}))}function m(t,e,r,o){var i=r.v,s=r.w;t.removeEdge(i,s),t.setEdge(o.v,o.w,{}),f(t),c(t,e),function(t,e){var r=n.find(t.nodes(),(function(t){return!e.node(t).parent})),o=a(t,r);o=o.slice(1),n.forEach(o,(function(r){var n=t.node(r).parent,o=e.edge(r,n),i=!1;o||(o=e.edge(n,r),i=!0),e.node(r).rank=e.node(n).rank+(i?o.minlen:-o.minlen)}))}(t,e)}function y(t,e,r){return r.low<=e.lim&&e.lim<=r.lim}t.exports=d,d.initLowLimValues=f,d.initCutValues=c,d.calcCutValue=l,d.leaveEdge=p,d.enterEdge=v,d.exchangeEdges=m},8666:(t,e,r)=>{"use strict";var n=r(5076);t.exports={longestPath:function(t){var e={};n.forEach(t.sources(),(function r(o){var i=t.node(o);if(n.has(e,o))return i.rank;e[o]=!0;var s=n.min(n.map(t.outEdges(o),(function(e){return r(e.w)-t.edge(e).minlen})));return s!==Number.POSITIVE_INFINITY&&null!=s||(s=0),i.rank=s}))},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}}},6573:(t,e,r)=>{"use strict";var n=r(5076),o=r(3374).Graph;function i(t,e,r,o){var i;do{i=n.uniqueId(o)}while(t.hasNode(i));return r.dummy=e,t.setNode(i,r),i}function s(t){return n.max(n.map(t.nodes(),(function(e){var r=t.node(e).rank;if(!n.isUndefined(r))return r})))}t.exports={addDummyNode:i,simplify:function(t){var e=(new o).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){var n=e.edge(r.v,r.w)||{weight:0,minlen:1},o=t.edge(r);e.setEdge(r.v,r.w,{weight:n.weight+o.weight,minlen:Math.max(n.minlen,o.minlen)})})),e},asNonCompoundGraph:function(t){var e=new o({multigraph:t.isMultigraph()}).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){t.children(r).length||e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){e.setEdge(r,t.edge(r))})),e},successorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.outEdges(e),(function(e){r[e.w]=(r[e.w]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.inEdges(e),(function(e){r[e.v]=(r[e.v]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},intersectRect:function(t,e){var r,n,o=t.x,i=t.y,s=e.x-o,a=e.y-i,u=t.width/2,h=t.height/2;if(!s&&!a)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(a)*u>Math.abs(s)*h?(a<0&&(h=-h),r=h*s/a,n=h):(s<0&&(u=-u),r=u,n=u*a/s),{x:o+r,y:i+n}},buildLayerMatrix:function(t){var e=n.map(n.range(s(t)+1),(function(){return[]}));return n.forEach(t.nodes(),(function(r){var o=t.node(r),i=o.rank;n.isUndefined(i)||(e[i][o.order]=r)})),e},normalizeRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank})));n.forEach(t.nodes(),(function(r){var o=t.node(r);n.has(o,"rank")&&(o.rank-=e)}))},removeEmptyRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank}))),r=[];n.forEach(t.nodes(),(function(n){var o=t.node(n).rank-e;r[o]||(r[o]=[]),r[o].push(n)}));var o=0,i=t.graph().nodeRankFactor;n.forEach(r,(function(e,r){n.isUndefined(e)&&r%i!=0?--o:o&&n.forEach(e,(function(e){t.node(e).rank+=o}))}))},addBorderNode:function(t,e,r,n){var o={width:0,height:0};return arguments.length>=4&&(o.rank=r,o.order=n),i(t,"border",o,e)},maxRank:s,partition:function(t,e){var r={lhs:[],rhs:[]};return n.forEach(t,(function(t){e(t)?r.lhs.push(t):r.rhs.push(t)})),r},time:function(t,e){var r=n.now();try{return e()}finally{console.log(t+" time: "+(n.now()-r)+"ms")}},notime:function(t,e){return e()}}},6661:t=>{t.exports="0.8.5"},7423:(t,e,r)=>{var n=r(783);t.exports={Graph:n.Graph,json:r(2350),alg:r(2638),version:n.version}},3536:(t,e,r)=>{var n=r(782);t.exports=function(t){var e,r={},o=[];function i(o){n.has(r,o)||(r[o]=!0,e.push(o),n.each(t.successors(o),i),n.each(t.predecessors(o),i))}return n.each(t.nodes(),(function(t){e=[],i(t),e.length&&o.push(e)})),o}},4933:(t,e,r)=>{var n=r(782);function o(t,e,r,i,s,a){n.has(i,e)||(i[e]=!0,r||a.push(e),n.each(s(e),(function(e){o(t,e,r,i,s,a)})),r&&a.push(e))}t.exports=function(t,e,r){n.isArray(e)||(e=[e]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),s=[],a={};return n.each(e,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);o(t,e,"post"===r,a,i,s)})),s}},9032:(t,e,r)=>{var n=r(4102),o=r(782);t.exports=function(t,e,r){return o.transform(t.nodes(),(function(o,i){o[i]=n(t,i,e,r)}),{})}},4102:(t,e,r)=>{var n=r(782),o=r(2468);t.exports=function(t,e,r,n){return function(t,e,r,n){var i,s,a={},u=new o,h=function(t){var e=t.v!==i?t.v:t.w,n=a[e],o=r(t),h=s.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+o);h<n.distance&&(n.distance=h,n.predecessor=i,u.decrease(e,h))};for(t.nodes().forEach((function(t){var r=t===e?0:Number.POSITIVE_INFINITY;a[t]={distance:r},u.add(t,r)}));u.size()>0&&(i=u.removeMin(),(s=a[i]).distance!==Number.POSITIVE_INFINITY);)n(i).forEach(h);return a}(t,String(e),r||i,n||function(e){return t.outEdges(e)})};var i=n.constant(1)},3983:(t,e,r)=>{var n=r(782),o=r(3952);t.exports=function(t){return n.filter(o(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}},2329:(t,e,r)=>{var n=r(782);t.exports=function(t,e,r){return function(t,e,r){var n={},o=t.nodes();return o.forEach((function(t){n[t]={},n[t][t]={distance:0},o.forEach((function(e){t!==e&&(n[t][e]={distance:Number.POSITIVE_INFINITY})})),r(t).forEach((function(r){var o=r.v===t?r.w:r.v,i=e(r);n[t][o]={distance:i,predecessor:t}}))})),o.forEach((function(t){var e=n[t];o.forEach((function(r){var i=n[r];o.forEach((function(r){var n=i[t],o=e[r],s=i[r],a=n.distance+o.distance;a<s.distance&&(s.distance=a,s.predecessor=o.predecessor)}))}))})),n}(t,e||o,r||function(e){return t.outEdges(e)})};var o=n.constant(1)},2638:(t,e,r)=>{t.exports={components:r(3536),dijkstra:r(4102),dijkstraAll:r(9032),findCycles:r(3983),floydWarshall:r(2329),isAcyclic:r(8345),postorder:r(1600),preorder:r(39),prim:r(6280),tarjan:r(3952),topsort:r(7849)}},8345:(t,e,r)=>{var n=r(7849);t.exports=function(t){try{n(t)}catch(t){if(t instanceof n.CycleException)return!1;throw t}return!0}},1600:(t,e,r)=>{var n=r(4933);t.exports=function(t,e){return n(t,e,"post")}},39:(t,e,r)=>{var n=r(4933);t.exports=function(t,e){return n(t,e,"pre")}},6280:(t,e,r)=>{var n=r(782),o=r(1943),i=r(2468);t.exports=function(t,e){var r,s=new o,a={},u=new i;function h(t){var n=t.v===r?t.w:t.v,o=u.priority(n);if(void 0!==o){var i=e(t);i<o&&(a[n]=r,u.decrease(n,i))}}if(0===t.nodeCount())return s;n.each(t.nodes(),(function(t){u.add(t,Number.POSITIVE_INFINITY),s.setNode(t)})),u.decrease(t.nodes()[0],0);for(var d=!1;u.size()>0;){if(r=u.removeMin(),n.has(a,r))s.setEdge(r,a[r]);else{if(d)throw new Error("Input graph is not connected: "+t);d=!0}t.nodeEdges(r).forEach(h)}return s}},3952:(t,e,r)=>{var n=r(782);t.exports=function(t){var e=0,r=[],o={},i=[];function s(a){var u=o[a]={onStack:!0,lowlink:e,index:e++};if(r.push(a),t.successors(a).forEach((function(t){n.has(o,t)?o[t].onStack&&(u.lowlink=Math.min(u.lowlink,o[t].index)):(s(t),u.lowlink=Math.min(u.lowlink,o[t].lowlink))})),u.lowlink===u.index){var h,d=[];do{h=r.pop(),o[h].onStack=!1,d.push(h)}while(a!==h);i.push(d)}}return t.nodes().forEach((function(t){n.has(o,t)||s(t)})),i}},7849:(t,e,r)=>{var n=r(782);function o(t){var e={},r={},o=[];if(n.each(t.sinks(),(function s(a){if(n.has(r,a))throw new i;n.has(e,a)||(r[a]=!0,e[a]=!0,n.each(t.predecessors(a),s),delete r[a],o.push(a))})),n.size(e)!==t.nodeCount())throw new i;return o}function i(){}t.exports=o,o.CycleException=i,i.prototype=new Error},2468:(t,e,r)=>{var n=r(782);function o(){this._arr=[],this._keyIndices={}}t.exports=o,o.prototype.size=function(){return this._arr.length},o.prototype.keys=function(){return this._arr.map((function(t){return t.key}))},o.prototype.has=function(t){return n.has(this._keyIndices,t)},o.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},o.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},o.prototype.add=function(t,e){var r=this._keyIndices;if(t=String(t),!n.has(r,t)){var o=this._arr,i=o.length;return r[t]=i,o.push({key:t,priority:e}),this._decrease(i),!0}return!1},o.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},o.prototype.decrease=function(t,e){var r=this._keyIndices[t];if(e>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[r].priority+" New: "+e);this._arr[r].priority=e,this._decrease(r)},o.prototype._heapify=function(t){var e=this._arr,r=2*t,n=r+1,o=t;r<e.length&&(o=e[r].priority<e[o].priority?r:o,n<e.length&&(o=e[n].priority<e[o].priority?n:o),o!==t&&(this._swap(t,o),this._heapify(o)))},o.prototype._decrease=function(t){for(var e,r=this._arr,n=r[t].priority;0!==t&&!(r[e=t>>1].priority<n);)this._swap(t,e),t=e},o.prototype._swap=function(t,e){var r=this._arr,n=this._keyIndices,o=r[t],i=r[e];r[t]=i,r[e]=o,n[i.key]=t,n[o.key]=e}},1943:(t,e,r)=>{"use strict";var n=r(782);t.exports=a;var o="\\0",i="\\0",s="";function a(t){this._isDirected=!n.has(t,"directed")||t.directed,this._isMultigraph=!!n.has(t,"multigraph")&&t.multigraph,this._isCompound=!!n.has(t,"compound")&&t.compound,this._label=void 0,this._defaultNodeLabelFn=n.constant(void 0),this._defaultEdgeLabelFn=n.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[i]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function u(t,e){t[e]?t[e]++:t[e]=1}function h(t,e){--t[e]||delete t[e]}function d(t,e,r,i){var a=""+e,u=""+r;if(!t&&a>u){var h=a;a=u,u=h}return a+s+u+s+(n.isUndefined(i)?o:i)}function c(t,e){return d(t,e.v,e.w,e.name)}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(t){return this._label=t,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultNodeLabelFn=t,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return n.keys(this._nodes)},a.prototype.sources=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._in[e])}))},a.prototype.sinks=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._out[e])}))},a.prototype.setNodes=function(t,e){var r=arguments,o=this;return n.each(t,(function(t){r.length>1?o.setNode(t,e):o.setNode(t)})),this},a.prototype.setNode=function(t,e){return n.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=i,this._children[t]={},this._children[i][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},a.prototype.node=function(t){return this._nodes[t]},a.prototype.hasNode=function(t){return n.has(this._nodes,t)},a.prototype.removeNode=function(t){var e=this;if(n.has(this._nodes,t)){var r=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],n.each(this.children(t),(function(t){e.setParent(t)})),delete this._children[t]),n.each(n.keys(this._in[t]),r),delete this._in[t],delete this._preds[t],n.each(n.keys(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},a.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n.isUndefined(e))e=i;else{for(var r=e+="";!n.isUndefined(r);r=this.parent(r))if(r===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},a.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},a.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if(e!==i)return e}},a.prototype.children=function(t){if(n.isUndefined(t)&&(t=i),this._isCompound){var e=this._children[t];if(e)return n.keys(e)}else{if(t===i)return this.nodes();if(this.hasNode(t))return[]}},a.prototype.predecessors=function(t){var e=this._preds[t];if(e)return n.keys(e)},a.prototype.successors=function(t){var e=this._sucs[t];if(e)return n.keys(e)},a.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return n.union(e,this.successors(t))},a.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},a.prototype.filterNodes=function(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var r=this;n.each(this._nodes,(function(r,n){t(n)&&e.setNode(n,r)})),n.each(this._edgeObjs,(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,r.edge(t))}));var o={};function i(t){var n=r.parent(t);return void 0===n||e.hasNode(n)?(o[t]=n,n):n in o?o[n]:i(n)}return this._isCompound&&n.each(e.nodes(),(function(t){e.setParent(t,i(t))})),e},a.prototype.setDefaultEdgeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultEdgeLabelFn=t,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return n.values(this._edgeObjs)},a.prototype.setPath=function(t,e){var r=this,o=arguments;return n.reduce(t,(function(t,n){return o.length>1?r.setEdge(t,n,e):r.setEdge(t,n),n})),this},a.prototype.setEdge=function(){var t,e,r,o,i=!1,s=arguments[0];"object"==typeof s&&null!==s&&"v"in s?(t=s.v,e=s.w,r=s.name,2===arguments.length&&(o=arguments[1],i=!0)):(t=s,e=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],i=!0)),t=""+t,e=""+e,n.isUndefined(r)||(r=""+r);var a=d(this._isDirected,t,e,r);if(n.has(this._edgeLabels,a))return i&&(this._edgeLabels[a]=o),this;if(!n.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[a]=i?o:this._defaultEdgeLabelFn(t,e,r);var h=function(t,e,r,n){var o=""+e,i=""+r;if(!t&&o>i){var s=o;o=i,i=s}var a={v:o,w:i};return n&&(a.name=n),a}(this._isDirected,t,e,r);return t=h.v,e=h.w,Object.freeze(h),this._edgeObjs[a]=h,u(this._preds[e],t),u(this._sucs[t],e),this._in[e][a]=h,this._out[t][a]=h,this._edgeCount++,this},a.prototype.edge=function(t,e,r){var n=1===arguments.length?c(this._isDirected,arguments[0]):d(this._isDirected,t,e,r);return this._edgeLabels[n]},a.prototype.hasEdge=function(t,e,r){var o=1===arguments.length?c(this._isDirected,arguments[0]):d(this._isDirected,t,e,r);return n.has(this._edgeLabels,o)},a.prototype.removeEdge=function(t,e,r){var n=1===arguments.length?c(this._isDirected,arguments[0]):d(this._isDirected,t,e,r),o=this._edgeObjs[n];return o&&(t=o.v,e=o.w,delete this._edgeLabels[n],delete this._edgeObjs[n],h(this._preds[e],t),h(this._sucs[t],e),delete this._in[e][n],delete this._out[t][n],this._edgeCount--),this},a.prototype.inEdges=function(t,e){var r=this._in[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.v===e})):o}},a.prototype.outEdges=function(t,e){var r=this._out[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.w===e})):o}},a.prototype.nodeEdges=function(t,e){var r=this.inEdges(t,e);if(r)return r.concat(this.outEdges(t,e))}},783:(t,e,r)=>{t.exports={Graph:r(1943),version:r(1471)}},2350:(t,e,r)=>{var n=r(782),o=r(1943);function i(t){return n.map(t.nodes(),(function(e){var r=t.node(e),o=t.parent(e),i={v:e};return n.isUndefined(r)||(i.value=r),n.isUndefined(o)||(i.parent=o),i}))}function s(t){return n.map(t.edges(),(function(e){var r=t.edge(e),o={v:e.v,w:e.w};return n.isUndefined(e.name)||(o.name=e.name),n.isUndefined(r)||(o.value=r),o}))}t.exports={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:i(t),edges:s(t)};return n.isUndefined(t.graph())||(e.value=n.clone(t.graph())),e},read:function(t){var e=new o(t.options).setGraph(t.value);return n.each(t.nodes,(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)})),n.each(t.edges,(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),e}}},782:(t,e,r)=>{var n;try{n={clone:r(5402),constant:r(8295),each:r(958),filter:r(9969),has:r(4339),isArray:r(5874),isEmpty:r(2046),isFunction:r(7787),isUndefined:r(2895),keys:r(3511),map:r(9629),reduce:r(9285),size:r(3910),transform:r(3279),union:r(3344),values:r(3005)}}catch(t){}n||(n=window._),t.exports=n},1471:t=>{t.exports="2.1.8"},5229:(t,e,r)=>{"use strict";r.r(e),r.d(e,{isAnyArray:()=>o});const n=Object.prototype.toString;function o(t){const e=n.call(t);return e.endsWith("Array]")&&!e.includes("Big")}},6171:(t,e,r)=>{var n=r(4671)(r(714),"DataView");t.exports=n},6766:(t,e,r)=>{var n=r(2405),o=r(8341),i=r(9644),s=r(3784),a=r(6264);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},1022:(t,e,r)=>{var n=r(6821),o=r(7221),i=r(1596),s=r(1992),a=r(552);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},5870:(t,e,r)=>{var n=r(4671)(r(714),"Map");t.exports=n},8910:(t,e,r)=>{var n=r(4069),o=r(7477),i=r(476),s=r(984),a=r(4136);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},4665:(t,e,r)=>{var n=r(4671)(r(714),"Promise");t.exports=n},9612:(t,e,r)=>{var n=r(4671)(r(714),"Set");t.exports=n},2312:(t,e,r)=>{var n=r(8910),o=r(1945),i=r(4874);function s(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new n;++e<r;)this.add(t[e])}s.prototype.add=s.prototype.push=o,s.prototype.has=i,t.exports=s},7216:(t,e,r)=>{var n=r(1022),o=r(5331),i=r(7063),s=r(134),a=r(9842),u=r(9850);function h(t){var e=this.__data__=new n(t);this.size=e.size}h.prototype.clear=o,h.prototype.delete=i,h.prototype.get=s,h.prototype.has=a,h.prototype.set=u,t.exports=h},9006:(t,e,r)=>{var n=r(714).Symbol;t.exports=n},8851:(t,e,r)=>{var n=r(714).Uint8Array;t.exports=n},8154:(t,e,r)=>{var n=r(4671)(r(714),"WeakMap");t.exports=n},7156:t=>{t.exports=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}},7012:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}},2995:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var s=t[r];e(s,r,t)&&(i[o++]=s)}return i}},128:(t,e,r)=>{var n=r(8506);t.exports=function(t,e){return!(null==t||!t.length)&&n(t,e,0)>-1}},6184:t=>{t.exports=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1}},9754:(t,e,r)=>{var n=r(9605),o=r(79),i=r(5874),s=r(3601),a=r(1908),u=r(9046),h=Object.prototype.hasOwnProperty;t.exports=function(t,e){var r=i(t),d=!r&&o(t),c=!r&&!d&&s(t),l=!r&&!d&&!c&&u(t),f=r||d||c||l,g=f?n(t.length,String):[],p=g.length;for(var v in t)!e&&!h.call(t,v)||f&&("length"==v||c&&("offset"==v||"parent"==v)||l&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||a(v,p))||g.push(v);return g}},2275:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}},2525:t=>{t.exports=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}},8663:t=>{t.exports=function(t,e,r,n){var o=-1,i=null==t?0:t.length;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}},3525:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}},446:(t,e,r)=>{var n=r(8494)("length");t.exports=n},2430:(t,e,r)=>{var n=r(3077),o=r(5097);t.exports=function(t,e,r){(void 0!==r&&!o(t[e],r)||void 0===r&&!(e in t))&&n(t,e,r)}},5802:(t,e,r)=>{var n=r(3077),o=r(5097),i=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){var s=t[e];i.call(t,e)&&o(s,r)&&(void 0!==r||e in t)||n(t,e,r)}},9438:(t,e,r)=>{var n=r(5097);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},6902:(t,e,r)=>{var n=r(5532),o=r(3511);t.exports=function(t,e){return t&&n(e,o(e),t)}},5873:(t,e,r)=>{var n=r(5532),o=r(2844);t.exports=function(t,e){return t&&n(e,o(e),t)}},3077:(t,e,r)=>{var n=r(4856);t.exports=function(t,e,r){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}},9018:(t,e,r)=>{var n=r(7216),o=r(7012),i=r(5802),s=r(6902),a=r(5873),u=r(6743),h=r(310),d=r(5590),c=r(2209),l=r(2573),f=r(3918),g=r(9778),p=r(5290),v=r(4028),m=r(9168),y=r(5874),w=r(3601),x=r(4725),b=r(9400),E=r(7363),N=r(3511),M=r(2844),_="[object Arguments]",k="[object Function]",A="[object Object]",j={};j[_]=j["[object Array]"]=j["[object ArrayBuffer]"]=j["[object DataView]"]=j["[object Boolean]"]=j["[object Date]"]=j["[object Float32Array]"]=j["[object Float64Array]"]=j["[object Int8Array]"]=j["[object Int16Array]"]=j["[object Int32Array]"]=j["[object Map]"]=j["[object Number]"]=j[A]=j["[object RegExp]"]=j["[object Set]"]=j["[object String]"]=j["[object Symbol]"]=j["[object Uint8Array]"]=j["[object Uint8ClampedArray]"]=j["[object Uint16Array]"]=j["[object Uint32Array]"]=!0,j["[object Error]"]=j[k]=j["[object WeakMap]"]=!1,t.exports=function t(e,r,S,O,z,R){var I,C=1&r,D=2&r,P=4&r;if(S&&(I=z?S(e,O,z,R):S(e)),void 0!==I)return I;if(!b(e))return e;var T=y(e);if(T){if(I=p(e),!C)return h(e,I)}else{var L=g(e),F=L==k||"[object GeneratorFunction]"==L;if(w(e))return u(e,C);if(L==A||L==_||F&&!z){if(I=D||F?{}:m(e),!C)return D?c(e,a(I,e)):d(e,s(I,e))}else{if(!j[L])return z?e:{};I=v(e,L,C)}}R||(R=new n);var q=R.get(e);if(q)return q;R.set(e,I),E(e)?e.forEach((function(n){I.add(t(n,r,S,n,e,R))})):x(e)&&e.forEach((function(n,o){I.set(o,t(n,r,S,o,e,R))}));var V=T?void 0:(P?D?f:l:D?M:N)(e);return o(V||e,(function(n,o){V&&(n=e[o=n]),i(I,o,t(n,r,S,o,e,R))})),I}},1095:(t,e,r)=>{var n=r(9400),o=Object.create,i=function(){function t(){}return function(e){if(!n(e))return{};if(o)return o(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();t.exports=i},830:(t,e,r)=>{var n=r(7702),o=r(8678)(n);t.exports=o},5816:(t,e,r)=>{var n=r(975);t.exports=function(t,e,r){for(var o=-1,i=t.length;++o<i;){var s=t[o],a=e(s);if(null!=a&&(void 0===u?a==a&&!n(a):r(a,u)))var u=a,h=s}return h}},1329:(t,e,r)=>{var n=r(830);t.exports=function(t,e){var r=[];return n(t,(function(t,n,o){e(t,n,o)&&r.push(t)})),r}},166:t=>{t.exports=function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1}},9821:(t,e,r)=>{var n=r(2525),o=r(3542);t.exports=function t(e,r,i,s,a){var u=-1,h=e.length;for(i||(i=o),a||(a=[]);++u<h;){var d=e[u];r>0&&i(d)?r>1?t(d,r-1,i,s,a):n(a,d):s||(a[a.length]=d)}return a}},9128:(t,e,r)=>{var n=r(3600)();t.exports=n},7702:(t,e,r)=>{var n=r(9128),o=r(3511);t.exports=function(t,e){return t&&n(t,e,o)}},1855:(t,e,r)=>{var n=r(330),o=r(9628);t.exports=function(t,e){for(var r=0,i=(e=n(e,t)).length;null!=t&&r<i;)t=t[o(e[r++])];return r&&r==i?t:void 0}},5920:(t,e,r)=>{var n=r(2525),o=r(5874);t.exports=function(t,e,r){var i=e(t);return o(t)?i:n(i,r(t))}},5271:(t,e,r)=>{var n=r(9006),o=r(9650),i=r(6881),s=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":s&&s in Object(t)?o(t):i(t)}},4116:t=>{t.exports=function(t,e){return t>e}},3091:t=>{var e=Object.prototype.hasOwnProperty;t.exports=function(t,r){return null!=t&&e.call(t,r)}},5088:t=>{t.exports=function(t,e){return null!=t&&e in Object(t)}},8506:(t,e,r)=>{var n=r(166),o=r(8306),i=r(638);t.exports=function(t,e,r){return e==e?i(t,e,r):n(t,o,r)}},4047:(t,e,r)=>{var n=r(5271),o=r(7583);t.exports=function(t){return o(t)&&"[object Arguments]"==n(t)}},3899:(t,e,r)=>{var n=r(8309),o=r(7583);t.exports=function t(e,r,i,s,a){return e===r||(null==e||null==r||!o(e)&&!o(r)?e!=e&&r!=r:n(e,r,i,s,t,a))}},8309:(t,e,r)=>{var n=r(7216),o=r(3522),i=r(9481),s=r(8370),a=r(9778),u=r(5874),h=r(3601),d=r(9046),c="[object Arguments]",l="[object Array]",f="[object Object]",g=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,p,v,m){var y=u(t),w=u(e),x=y?l:a(t),b=w?l:a(e),E=(x=x==c?f:x)==f,N=(b=b==c?f:b)==f,M=x==b;if(M&&h(t)){if(!h(e))return!1;y=!0,E=!1}if(M&&!E)return m||(m=new n),y||d(t)?o(t,e,r,p,v,m):i(t,e,x,r,p,v,m);if(!(1&r)){var _=E&&g.call(t,"__wrapped__"),k=N&&g.call(e,"__wrapped__");if(_||k){var A=_?t.value():t,j=k?e.value():e;return m||(m=new n),v(A,j,r,p,m)}}return!!M&&(m||(m=new n),s(t,e,r,p,v,m))}},4965:(t,e,r)=>{var n=r(9778),o=r(7583);t.exports=function(t){return o(t)&&"[object Map]"==n(t)}},4014:(t,e,r)=>{var n=r(7216),o=r(3899);t.exports=function(t,e,r,i){var s=r.length,a=s,u=!i;if(null==t)return!a;for(t=Object(t);s--;){var h=r[s];if(u&&h[2]?h[1]!==t[h[0]]:!(h[0]in t))return!1}for(;++s<a;){var d=(h=r[s])[0],c=t[d],l=h[1];if(u&&h[2]){if(void 0===c&&!(d in t))return!1}else{var f=new n;if(i)var g=i(c,l,d,t,e,f);if(!(void 0===g?o(l,c,3,i,f):g))return!1}}return!0}},8306:t=>{t.exports=function(t){return t!=t}},4228:(t,e,r)=>{var n=r(7787),o=r(7827),i=r(9400),s=r(462),a=/^\\[object .+?Constructor\\]$/,u=Function.prototype,h=Object.prototype,d=u.toString,c=h.hasOwnProperty,l=RegExp("^"+d.call(c).replace(/[\\\\^$.*+?()[\\]{}|]/g,"\\\\$&").replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!i(t)||o(t))&&(n(t)?l:a).test(s(t))}},6499:(t,e,r)=>{var n=r(9778),o=r(7583);t.exports=function(t){return o(t)&&"[object Set]"==n(t)}},550:(t,e,r)=>{var n=r(5271),o=r(4583),i=r(7583),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,t.exports=function(t){return i(t)&&o(t.length)&&!!s[n(t)]}},4506:(t,e,r)=>{var n=r(6330),o=r(2363),i=r(9169),s=r(5874),a=r(6830);t.exports=function(t){return"function"==typeof t?t:null==t?i:"object"==typeof t?s(t)?o(t[0],t[1]):n(t):a(t)}},5351:(t,e,r)=>{var n=r(7894),o=r(2325),i=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return o(t);var e=[];for(var r in Object(t))i.call(t,r)&&"constructor"!=r&&e.push(r);return e}},1500:(t,e,r)=>{var n=r(9400),o=r(7894),i=r(5382),s=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return i(t);var e=o(t),r=[];for(var a in t)("constructor"!=a||!e&&s.call(t,a))&&r.push(a);return r}},2795:t=>{t.exports=function(t,e){return t<e}},4733:(t,e,r)=>{var n=r(830),o=r(3069);t.exports=function(t,e){var r=-1,i=o(t)?Array(t.length):[];return n(t,(function(t,n,o){i[++r]=e(t,n,o)})),i}},6330:(t,e,r)=>{var n=r(4014),o=r(6539),i=r(7316);t.exports=function(t){var e=o(t);return 1==e.length&&e[0][2]?i(e[0][0],e[0][1]):function(r){return r===t||n(r,t,e)}}},2363:(t,e,r)=>{var n=r(3899),o=r(5887),i=r(4016),s=r(759),a=r(7223),u=r(7316),h=r(9628);t.exports=function(t,e){return s(t)&&a(e)?u(h(t),e):function(r){var s=o(r,t);return void 0===s&&s===e?i(r,t):n(e,s,3)}}},4479:(t,e,r)=>{var n=r(7216),o=r(2430),i=r(9128),s=r(3857),a=r(9400),u=r(2844),h=r(6127);t.exports=function t(e,r,d,c,l){e!==r&&i(r,(function(i,u){if(l||(l=new n),a(i))s(e,r,u,d,t,c,l);else{var f=c?c(h(e,u),i,u+"",e,r,l):void 0;void 0===f&&(f=i),o(e,u,f)}}),u)}},3857:(t,e,r)=>{var n=r(2430),o=r(6743),i=r(1532),s=r(310),a=r(9168),u=r(79),h=r(5874),d=r(6882),c=r(3601),l=r(7787),f=r(9400),g=r(4108),p=r(9046),v=r(6127),m=r(339);t.exports=function(t,e,r,y,w,x,b){var E=v(t,r),N=v(e,r),M=b.get(N);if(M)n(t,r,M);else{var _=x?x(E,N,r+"",t,e,b):void 0,k=void 0===_;if(k){var A=h(N),j=!A&&c(N),S=!A&&!j&&p(N);_=N,A||j||S?h(E)?_=E:d(E)?_=s(E):j?(k=!1,_=o(N,!0)):S?(k=!1,_=i(N,!0)):_=[]:g(N)||u(N)?(_=E,u(E)?_=m(E):f(E)&&!l(E)||(_=a(N))):k=!1}k&&(b.set(N,_),w(_,N,y,x,b),b.delete(N)),n(t,r,_)}}},9586:(t,e,r)=>{var n=r(2275),o=r(1855),i=r(4506),s=r(4733),a=r(7070),u=r(8232),h=r(6395),d=r(9169),c=r(5874);t.exports=function(t,e,r){e=e.length?n(e,(function(t){return c(t)?function(e){return o(e,1===t.length?t[0]:t)}:t})):[d];var l=-1;e=n(e,u(i));var f=s(t,(function(t,r,o){return{criteria:n(e,(function(e){return e(t)})),index:++l,value:t}}));return a(f,(function(t,e){return h(t,e,r)}))}},4286:(t,e,r)=>{var n=r(8499),o=r(4016);t.exports=function(t,e){return n(t,e,(function(e,r){return o(t,r)}))}},8499:(t,e,r)=>{var n=r(1855),o=r(9435),i=r(330);t.exports=function(t,e,r){for(var s=-1,a=e.length,u={};++s<a;){var h=e[s],d=n(t,h);r(d,h)&&o(u,i(h,t),d)}return u}},8494:t=>{t.exports=function(t){return function(e){return null==e?void 0:e[t]}}},3644:(t,e,r)=>{var n=r(1855);t.exports=function(t){return function(e){return n(e,t)}}},8514:t=>{var e=Math.ceil,r=Math.max;t.exports=function(t,n,o,i){for(var s=-1,a=r(e((n-t)/(o||1)),0),u=Array(a);a--;)u[i?a:++s]=t,t+=o;return u}},8421:t=>{t.exports=function(t,e,r,n,o){return o(t,(function(t,o,i){r=n?(n=!1,t):e(r,t,o,i)})),r}},6965:(t,e,r)=>{var n=r(9169),o=r(5390),i=r(3232);t.exports=function(t,e){return i(o(t,e,n),t+"")}},9435:(t,e,r)=>{var n=r(5802),o=r(330),i=r(1908),s=r(9400),a=r(9628);t.exports=function(t,e,r,u){if(!s(t))return t;for(var h=-1,d=(e=o(e,t)).length,c=d-1,l=t;null!=l&&++h<d;){var f=a(e[h]),g=r;if("__proto__"===f||"constructor"===f||"prototype"===f)return t;if(h!=c){var p=l[f];void 0===(g=u?u(p,f,l):void 0)&&(g=s(p)?p:i(e[h+1])?[]:{})}n(l,f,g),l=l[f]}return t}},3431:(t,e,r)=>{var n=r(8295),o=r(4856),i=r(9169),s=o?function(t,e){return o(t,"toString",{configurable:!0,enumerable:!1,value:n(e),writable:!0})}:i;t.exports=s},7070:t=>{t.exports=function(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}},9605:t=>{t.exports=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}},8071:(t,e,r)=>{var n=r(9006),o=r(2275),i=r(5874),s=r(975),a=n?n.prototype:void 0,u=a?a.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(i(e))return o(e,t)+"";if(s(e))return u?u.call(e):"";var r=e+"";return"0"==r&&1/e==-1/0?"-0":r}},5103:(t,e,r)=>{var n=r(4997),o=/^\\s+/;t.exports=function(t){return t?t.slice(0,n(t)+1).replace(o,""):t}},8232:t=>{t.exports=function(t){return function(e){return t(e)}}},3434:(t,e,r)=>{var n=r(2312),o=r(128),i=r(6184),s=r(5420),a=r(2196),u=r(6968);t.exports=function(t,e,r){var h=-1,d=o,c=t.length,l=!0,f=[],g=f;if(r)l=!1,d=i;else if(c>=200){var p=e?null:a(t);if(p)return u(p);l=!1,d=s,g=new n}else g=e?[]:f;t:for(;++h<c;){var v=t[h],m=e?e(v):v;if(v=r||0!==v?v:0,l&&m==m){for(var y=g.length;y--;)if(g[y]===m)continue t;e&&g.push(m),f.push(v)}else d(g,m,r)||(g!==f&&g.push(m),f.push(v))}return f}},989:(t,e,r)=>{var n=r(2275);t.exports=function(t,e){return n(e,(function(e){return t[e]}))}},2543:t=>{t.exports=function(t,e,r){for(var n=-1,o=t.length,i=e.length,s={};++n<o;){var a=n<i?e[n]:void 0;r(s,t[n],a)}return s}},5420:t=>{t.exports=function(t,e){return t.has(e)}},4041:(t,e,r)=>{var n=r(9169);t.exports=function(t){return"function"==typeof t?t:n}},330:(t,e,r)=>{var n=r(5874),o=r(759),i=r(9505),s=r(983);t.exports=function(t,e){return n(t)?t:o(t,e)?[t]:i(s(t))}},9270:(t,e,r)=>{var n=r(8851);t.exports=function(t){var e=new t.constructor(t.byteLength);return new n(e).set(new n(t)),e}},6743:(t,e,r)=>{t=r.nmd(t);var n=r(714),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o?n.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=a?a(r):new t.constructor(r);return t.copy(n),n}},5940:(t,e,r)=>{var n=r(9270);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}},5320:t=>{var e=/\\w*$/;t.exports=function(t){var r=new t.constructor(t.source,e.exec(t));return r.lastIndex=t.lastIndex,r}},4937:(t,e,r)=>{var n=r(9006),o=n?n.prototype:void 0,i=o?o.valueOf:void 0;t.exports=function(t){return i?Object(i.call(t)):{}}},1532:(t,e,r)=>{var n=r(9270);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}},1141:(t,e,r)=>{var n=r(975);t.exports=function(t,e){if(t!==e){var r=void 0!==t,o=null===t,i=t==t,s=n(t),a=void 0!==e,u=null===e,h=e==e,d=n(e);if(!u&&!d&&!s&&t>e||s&&a&&h&&!u&&!d||o&&a&&h||!r&&h||!i)return 1;if(!o&&!s&&!d&&t<e||d&&r&&i&&!o&&!s||u&&r&&i||!a&&i||!h)return-1}return 0}},6395:(t,e,r)=>{var n=r(1141);t.exports=function(t,e,r){for(var o=-1,i=t.criteria,s=e.criteria,a=i.length,u=r.length;++o<a;){var h=n(i[o],s[o]);if(h)return o>=u?h:h*("desc"==r[o]?-1:1)}return t.index-e.index}},310:t=>{t.exports=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}},5532:(t,e,r)=>{var n=r(5802),o=r(3077);t.exports=function(t,e,r,i){var s=!r;r||(r={});for(var a=-1,u=e.length;++a<u;){var h=e[a],d=i?i(r[h],t[h],h,r,t):void 0;void 0===d&&(d=t[h]),s?o(r,h,d):n(r,h,d)}return r}},5590:(t,e,r)=>{var n=r(5532),o=r(9183);t.exports=function(t,e){return n(t,o(t),e)}},2209:(t,e,r)=>{var n=r(5532),o=r(596);t.exports=function(t,e){return n(t,o(t),e)}},6450:(t,e,r)=>{var n=r(714)["__core-js_shared__"];t.exports=n},1292:(t,e,r)=>{var n=r(6965),o=r(8819);t.exports=function(t){return n((function(e,r){var n=-1,i=r.length,s=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(s=t.length>3&&"function"==typeof s?(i--,s):void 0,a&&o(r[0],r[1],a)&&(s=i<3?void 0:s,i=1),e=Object(e);++n<i;){var u=r[n];u&&t(e,u,n,s)}return e}))}},8678:(t,e,r)=>{var n=r(3069);t.exports=function(t,e){return function(r,o){if(null==r)return r;if(!n(r))return t(r,o);for(var i=r.length,s=e?i:-1,a=Object(r);(e?s--:++s<i)&&!1!==o(a[s],s,a););return r}}},3600:t=>{t.exports=function(t){return function(e,r,n){for(var o=-1,i=Object(e),s=n(e),a=s.length;a--;){var u=s[t?a:++o];if(!1===r(i[u],u,i))break}return e}}},6057:(t,e,r)=>{var n=r(4506),o=r(3069),i=r(3511);t.exports=function(t){return function(e,r,s){var a=Object(e);if(!o(e)){var u=n(r,3);e=i(e),r=function(t){return u(a[t],t,a)}}var h=t(e,r,s);return h>-1?a[u?e[h]:h]:void 0}}},4590:(t,e,r)=>{var n=r(8514),o=r(8819),i=r(8265);t.exports=function(t){return function(e,r,s){return s&&"number"!=typeof s&&o(e,r,s)&&(r=s=void 0),e=i(e),void 0===r?(r=e,e=0):r=i(r),s=void 0===s?e<r?1:-1:i(s),n(e,r,s,t)}}},2196:(t,e,r)=>{var n=r(9612),o=r(3883),i=r(6968),s=n&&1/i(new n([,-0]))[1]==1/0?function(t){return new n(t)}:o;t.exports=s},4856:(t,e,r)=>{var n=r(4671),o=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},3522:(t,e,r)=>{var n=r(2312),o=r(3525),i=r(5420);t.exports=function(t,e,r,s,a,u){var h=1&r,d=t.length,c=e.length;if(d!=c&&!(h&&c>d))return!1;var l=u.get(t),f=u.get(e);if(l&&f)return l==e&&f==t;var g=-1,p=!0,v=2&r?new n:void 0;for(u.set(t,e),u.set(e,t);++g<d;){var m=t[g],y=e[g];if(s)var w=h?s(y,m,g,e,t,u):s(m,y,g,t,e,u);if(void 0!==w){if(w)continue;p=!1;break}if(v){if(!o(e,(function(t,e){if(!i(v,e)&&(m===t||a(m,t,r,s,u)))return v.push(e)}))){p=!1;break}}else if(m!==y&&!a(m,y,r,s,u)){p=!1;break}}return u.delete(t),u.delete(e),p}},9481:(t,e,r)=>{var n=r(9006),o=r(8851),i=r(5097),s=r(3522),a=r(8866),u=r(6968),h=n?n.prototype:void 0,d=h?h.valueOf:void 0;t.exports=function(t,e,r,n,h,c,l){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!c(new o(t),new o(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var f=a;case"[object Set]":var g=1&n;if(f||(f=u),t.size!=e.size&&!g)return!1;var p=l.get(t);if(p)return p==e;n|=2,l.set(t,e);var v=s(f(t),f(e),n,h,c,l);return l.delete(t),v;case"[object Symbol]":if(d)return d.call(t)==d.call(e)}return!1}},8370:(t,e,r)=>{var n=r(2573),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,i,s,a){var u=1&r,h=n(t),d=h.length;if(d!=n(e).length&&!u)return!1;for(var c=d;c--;){var l=h[c];if(!(u?l in e:o.call(e,l)))return!1}var f=a.get(t),g=a.get(e);if(f&&g)return f==e&&g==t;var p=!0;a.set(t,e),a.set(e,t);for(var v=u;++c<d;){var m=t[l=h[c]],y=e[l];if(i)var w=u?i(y,m,l,e,t,a):i(m,y,l,t,e,a);if(!(void 0===w?m===y||s(m,y,r,i,a):w)){p=!1;break}v||(v="constructor"==l)}if(p&&!v){var x=t.constructor,b=e.constructor;x==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof x&&x instanceof x&&"function"==typeof b&&b instanceof b||(p=!1)}return a.delete(t),a.delete(e),p}},4139:(t,e,r)=>{var n=r(7469),o=r(5390),i=r(3232);t.exports=function(t){return i(o(t,void 0,n),t+"")}},1603:(t,e,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;t.exports=n},2573:(t,e,r)=>{var n=r(5920),o=r(9183),i=r(3511);t.exports=function(t){return n(t,i,o)}},3918:(t,e,r)=>{var n=r(5920),o=r(596),i=r(2844);t.exports=function(t){return n(t,i,o)}},1200:(t,e,r)=>{var n=r(95);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},6539:(t,e,r)=>{var n=r(7223),o=r(3511);t.exports=function(t){for(var e=o(t),r=e.length;r--;){var i=e[r],s=t[i];e[r]=[i,s,n(s)]}return e}},4671:(t,e,r)=>{var n=r(4228),o=r(7559);t.exports=function(t,e){var r=o(t,e);return n(r)?r:void 0}},7556:(t,e,r)=>{var n=r(8546)(Object.getPrototypeOf,Object);t.exports=n},9650:(t,e,r)=>{var n=r(9006),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,a=n?n.toStringTag:void 0;t.exports=function(t){var e=i.call(t,a),r=t[a];try{t[a]=void 0;var n=!0}catch(t){}var o=s.call(t);return n&&(e?t[a]=r:delete t[a]),o}},9183:(t,e,r)=>{var n=r(2995),o=r(2982),i=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,a=s?function(t){return null==t?[]:(t=Object(t),n(s(t),(function(e){return i.call(t,e)})))}:o;t.exports=a},596:(t,e,r)=>{var n=r(2525),o=r(7556),i=r(9183),s=r(2982),a=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)n(e,i(t)),t=o(t);return e}:s;t.exports=a},9778:(t,e,r)=>{var n=r(6171),o=r(5870),i=r(4665),s=r(9612),a=r(8154),u=r(5271),h=r(462),d="[object Map]",c="[object Promise]",l="[object Set]",f="[object WeakMap]",g="[object DataView]",p=h(n),v=h(o),m=h(i),y=h(s),w=h(a),x=u;(n&&x(new n(new ArrayBuffer(1)))!=g||o&&x(new o)!=d||i&&x(i.resolve())!=c||s&&x(new s)!=l||a&&x(new a)!=f)&&(x=function(t){var e=u(t),r="[object Object]"==e?t.constructor:void 0,n=r?h(r):"";if(n)switch(n){case p:return g;case v:return d;case m:return c;case y:return l;case w:return f}return e}),t.exports=x},7559:t=>{t.exports=function(t,e){return null==t?void 0:t[e]}},9663:(t,e,r)=>{var n=r(330),o=r(79),i=r(5874),s=r(1908),a=r(4583),u=r(9628);t.exports=function(t,e,r){for(var h=-1,d=(e=n(e,t)).length,c=!1;++h<d;){var l=u(e[h]);if(!(c=null!=t&&r(t,l)))break;t=t[l]}return c||++h!=d?c:!!(d=null==t?0:t.length)&&a(d)&&s(l,d)&&(i(t)||o(t))}},3493:t=>{var e=RegExp("[\\\\u200d\\\\ud800-\\\\udfff\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe2f\\\\u20d0-\\\\u20ff\\\\ufe0e\\\\ufe0f]");t.exports=function(t){return e.test(t)}},2405:(t,e,r)=>{var n=r(8637);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},8341:t=>{t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},9644:(t,e,r)=>{var n=r(8637),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return o.call(e,t)?e[t]:void 0}},3784:(t,e,r)=>{var n=r(8637),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:o.call(e,t)}},6264:(t,e,r)=>{var n=r(8637);t.exports=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},5290:t=>{var e=Object.prototype.hasOwnProperty;t.exports=function(t){var r=t.length,n=new t.constructor(r);return r&&"string"==typeof t[0]&&e.call(t,"index")&&(n.index=t.index,n.input=t.input),n}},4028:(t,e,r)=>{var n=r(9270),o=r(5940),i=r(5320),s=r(4937),a=r(1532);t.exports=function(t,e,r){var u=t.constructor;switch(e){case"[object ArrayBuffer]":return n(t);case"[object Boolean]":case"[object Date]":return new u(+t);case"[object DataView]":return o(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return a(t,r);case"[object Map]":case"[object Set]":return new u;case"[object Number]":case"[object String]":return new u(t);case"[object RegExp]":return i(t);case"[object Symbol]":return s(t)}}},9168:(t,e,r)=>{var n=r(1095),o=r(7556),i=r(7894);t.exports=function(t){return"function"!=typeof t.constructor||i(t)?{}:n(o(t))}},3542:(t,e,r)=>{var n=r(9006),o=r(79),i=r(5874),s=n?n.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(s&&t&&t[s])}},1908:t=>{var e=/^(?:0|[1-9]\\d*)$/;t.exports=function(t,r){var n=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<r}},8819:(t,e,r)=>{var n=r(5097),o=r(3069),i=r(1908),s=r(9400);t.exports=function(t,e,r){if(!s(r))return!1;var a=typeof e;return!!("number"==a?o(r)&&i(e,r.length):"string"==a&&e in r)&&n(r[e],t)}},759:(t,e,r)=>{var n=r(5874),o=r(975),i=/\\.|\\[(?:[^[\\]]*|(["\'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,s=/^\\w*$/;t.exports=function(t,e){if(n(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!o(t))||s.test(t)||!i.test(t)||null!=e&&t in Object(e)}},95:t=>{t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},7827:(t,e,r)=>{var n,o=r(6450),i=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!i&&i in t}},7894:t=>{var e=Object.prototype;t.exports=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}},7223:(t,e,r)=>{var n=r(9400);t.exports=function(t){return t==t&&!n(t)}},6821:t=>{t.exports=function(){this.__data__=[],this.size=0}},7221:(t,e,r)=>{var n=r(9438),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,r=n(e,t);return!(r<0||(r==e.length-1?e.pop():o.call(e,r,1),--this.size,0))}},1596:(t,e,r)=>{var n=r(9438);t.exports=function(t){var e=this.__data__,r=n(e,t);return r<0?void 0:e[r][1]}},1992:(t,e,r)=>{var n=r(9438);t.exports=function(t){return n(this.__data__,t)>-1}},552:(t,e,r)=>{var n=r(9438);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}},4069:(t,e,r)=>{var n=r(6766),o=r(1022),i=r(5870);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},7477:(t,e,r)=>{var n=r(1200);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},476:(t,e,r)=>{var n=r(1200);t.exports=function(t){return n(this,t).get(t)}},984:(t,e,r)=>{var n=r(1200);t.exports=function(t){return n(this,t).has(t)}},4136:(t,e,r)=>{var n=r(1200);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},8866:t=>{t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}},7316:t=>{t.exports=function(t,e){return function(r){return null!=r&&r[t]===e&&(void 0!==e||t in Object(r))}}},2121:(t,e,r)=>{var n=r(8487);t.exports=function(t){var e=n(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}},8637:(t,e,r)=>{var n=r(4671)(Object,"create");t.exports=n},2325:(t,e,r)=>{var n=r(8546)(Object.keys,Object);t.exports=n},5382:t=>{t.exports=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}},6574:(t,e,r)=>{t=r.nmd(t);var n=r(1603),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o&&n.process,a=function(){try{return i&&i.require&&i.require("util").types||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=a},6881:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},8546:t=>{t.exports=function(t,e){return function(r){return t(e(r))}}},5390:(t,e,r)=>{var n=r(7156),o=Math.max;t.exports=function(t,e,r){return e=o(void 0===e?t.length-1:e,0),function(){for(var i=arguments,s=-1,a=o(i.length-e,0),u=Array(a);++s<a;)u[s]=i[e+s];s=-1;for(var h=Array(e+1);++s<e;)h[s]=i[s];return h[e]=r(u),n(t,this,h)}}},714:(t,e,r)=>{var n=r(1603),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},6127:t=>{t.exports=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}},1945:t=>{t.exports=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}},4874:t=>{t.exports=function(t){return this.__data__.has(t)}},6968:t=>{t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}},3232:(t,e,r)=>{var n=r(3431),o=r(1824)(n);t.exports=o},1824:t=>{var e=Date.now;t.exports=function(t){var r=0,n=0;return function(){var o=e(),i=16-(o-n);if(n=o,i>0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}},5331:(t,e,r)=>{var n=r(1022);t.exports=function(){this.__data__=new n,this.size=0}},7063:t=>{t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},134:t=>{t.exports=function(t){return this.__data__.get(t)}},9842:t=>{t.exports=function(t){return this.__data__.has(t)}},9850:(t,e,r)=>{var n=r(1022),o=r(5870),i=r(8910);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var s=r.__data__;if(!o||s.length<199)return s.push([t,e]),this.size=++r.size,this;r=this.__data__=new i(s)}return r.set(t,e),this.size=r.size,this}},638:t=>{t.exports=function(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}},6742:(t,e,r)=>{var n=r(446),o=r(3493),i=r(3870);t.exports=function(t){return o(t)?i(t):n(t)}},9505:(t,e,r)=>{var n=r(2121),o=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g,i=/\\\\(\\\\)?/g,s=n((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(o,(function(t,r,n,o){e.push(n?o.replace(i,"$1"):r||t)})),e}));t.exports=s},9628:(t,e,r)=>{var n=r(975);t.exports=function(t){if("string"==typeof t||n(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}},462:t=>{var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},4997:t=>{var e=/\\s/;t.exports=function(t){for(var r=t.length;r--&&e.test(t.charAt(r)););return r}},3870:t=>{var e="\\\\ud800-\\\\udfff",r="["+e+"]",n="[\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe2f\\\\u20d0-\\\\u20ff]",o="\\\\ud83c[\\\\udffb-\\\\udfff]",i="[^"+e+"]",s="(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}",a="[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]",u="(?:"+n+"|"+o+")?",h="[\\\\ufe0e\\\\ufe0f]?",d=h+u+"(?:\\\\u200d(?:"+[i,s,a].join("|")+")"+h+u+")*",c="(?:"+[i+n+"?",n,s,a,r].join("|")+")",l=RegExp(o+"(?="+o+")|"+c+d,"g");t.exports=function(t){for(var e=l.lastIndex=0;l.test(t);)++e;return e}},5402:(t,e,r)=>{var n=r(9018);t.exports=function(t){return n(t,4)}},9136:(t,e,r)=>{var n=r(9018);t.exports=function(t){return n(t,5)}},8295:t=>{t.exports=function(t){return function(){return t}}},9529:(t,e,r)=>{var n=r(6965),o=r(5097),i=r(8819),s=r(2844),a=Object.prototype,u=a.hasOwnProperty,h=n((function(t,e){t=Object(t);var r=-1,n=e.length,h=n>2?e[2]:void 0;for(h&&i(e[0],e[1],h)&&(n=1);++r<n;)for(var d=e[r],c=s(d),l=-1,f=c.length;++l<f;){var g=c[l],p=t[g];(void 0===p||o(p,a[g])&&!u.call(t,g))&&(t[g]=d[g])}return t}));t.exports=h},958:(t,e,r)=>{t.exports=r(1117)},5097:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},9969:(t,e,r)=>{var n=r(2995),o=r(1329),i=r(4506),s=r(5874);t.exports=function(t,e){return(s(t)?n:o)(t,i(e,3))}},828:(t,e,r)=>{var n=r(6057)(r(8550));t.exports=n},8550:(t,e,r)=>{var n=r(166),o=r(4506),i=r(3758),s=Math.max;t.exports=function(t,e,r){var a=null==t?0:t.length;if(!a)return-1;var u=null==r?0:i(r);return u<0&&(u=s(a+u,0)),n(t,o(e,3),u)}},7469:(t,e,r)=>{var n=r(9821);t.exports=function(t){return null!=t&&t.length?n(t,1):[]}},1117:(t,e,r)=>{var n=r(7012),o=r(830),i=r(4041),s=r(5874);t.exports=function(t,e){return(s(t)?n:o)(t,i(e))}},4519:(t,e,r)=>{var n=r(9128),o=r(4041),i=r(2844);t.exports=function(t,e){return null==t?t:n(t,o(e),i)}},5887:(t,e,r)=>{var n=r(1855);t.exports=function(t,e,r){var o=null==t?void 0:n(t,e);return void 0===o?r:o}},4339:(t,e,r)=>{var n=r(3091),o=r(9663);t.exports=function(t,e){return null!=t&&o(t,e,n)}},4016:(t,e,r)=>{var n=r(5088),o=r(9663);t.exports=function(t,e){return null!=t&&o(t,e,n)}},9169:t=>{t.exports=function(t){return t}},79:(t,e,r)=>{var n=r(4047),o=r(7583),i=Object.prototype,s=i.hasOwnProperty,a=i.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(t){return o(t)&&s.call(t,"callee")&&!a.call(t,"callee")};t.exports=u},5874:t=>{var e=Array.isArray;t.exports=e},3069:(t,e,r)=>{var n=r(7787),o=r(4583);t.exports=function(t){return null!=t&&o(t.length)&&!n(t)}},6882:(t,e,r)=>{var n=r(3069),o=r(7583);t.exports=function(t){return o(t)&&n(t)}},3601:(t,e,r)=>{t=r.nmd(t);var n=r(714),o=r(6408),i=e&&!e.nodeType&&e,s=i&&t&&!t.nodeType&&t,a=s&&s.exports===i?n.Buffer:void 0,u=(a?a.isBuffer:void 0)||o;t.exports=u},2046:(t,e,r)=>{var n=r(5351),o=r(9778),i=r(79),s=r(5874),a=r(3069),u=r(3601),h=r(7894),d=r(9046),c=Object.prototype.hasOwnProperty;t.exports=function(t){if(null==t)return!0;if(a(t)&&(s(t)||"string"==typeof t||"function"==typeof t.splice||u(t)||d(t)||i(t)))return!t.length;var e=o(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(h(t))return!n(t).length;for(var r in t)if(c.call(t,r))return!1;return!0}},7787:(t,e,r)=>{var n=r(5271),o=r(9400);t.exports=function(t){if(!o(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},4583:t=>{t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},4725:(t,e,r)=>{var n=r(4965),o=r(8232),i=r(6574),s=i&&i.isMap,a=s?o(s):n;t.exports=a},9400:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},7583:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},4108:(t,e,r)=>{var n=r(5271),o=r(7556),i=r(7583),s=Function.prototype,a=Object.prototype,u=s.toString,h=a.hasOwnProperty,d=u.call(Object);t.exports=function(t){if(!i(t)||"[object Object]"!=n(t))return!1;var e=o(t);if(null===e)return!0;var r=h.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&u.call(r)==d}},7363:(t,e,r)=>{var n=r(6499),o=r(8232),i=r(6574),s=i&&i.isSet,a=s?o(s):n;t.exports=a},7462:(t,e,r)=>{var n=r(5271),o=r(5874),i=r(7583);t.exports=function(t){return"string"==typeof t||!o(t)&&i(t)&&"[object String]"==n(t)}},975:(t,e,r)=>{var n=r(5271),o=r(7583);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==n(t)}},9046:(t,e,r)=>{var n=r(550),o=r(8232),i=r(6574),s=i&&i.isTypedArray,a=s?o(s):n;t.exports=a},2895:t=>{t.exports=function(t){return void 0===t}},3511:(t,e,r)=>{var n=r(9754),o=r(5351),i=r(3069);t.exports=function(t){return i(t)?n(t):o(t)}},2844:(t,e,r)=>{var n=r(9754),o=r(1500),i=r(3069);t.exports=function(t){return i(t)?n(t,!0):o(t)}},5179:t=>{t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},9629:(t,e,r)=>{var n=r(2275),o=r(4506),i=r(4733),s=r(5874);t.exports=function(t,e){return(s(t)?n:i)(t,o(e,3))}},5551:(t,e,r)=>{var n=r(3077),o=r(7702),i=r(4506);t.exports=function(t,e){var r={};return e=i(e,3),o(t,(function(t,o,i){n(r,o,e(t,o,i))})),r}},4213:(t,e,r)=>{var n=r(5816),o=r(4116),i=r(9169);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},8487:(t,e,r)=>{var n=r(8910);function o(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var s=t.apply(this,n);return r.cache=i.set(o,s)||i,s};return r.cache=new(o.Cache||n),r}o.Cache=n,t.exports=o},2495:(t,e,r)=>{var n=r(4479),o=r(1292)((function(t,e,r){n(t,e,r)}));t.exports=o},9903:(t,e,r)=>{var n=r(5816),o=r(2795),i=r(9169);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},3262:(t,e,r)=>{var n=r(5816),o=r(4506),i=r(2795);t.exports=function(t,e){return t&&t.length?n(t,o(e,2),i):void 0}},3883:t=>{t.exports=function(){}},8835:(t,e,r)=>{var n=r(714);t.exports=function(){return n.Date.now()}},222:(t,e,r)=>{var n=r(4286),o=r(4139)((function(t,e){return null==t?{}:n(t,e)}));t.exports=o},6830:(t,e,r)=>{var n=r(8494),o=r(3644),i=r(759),s=r(9628);t.exports=function(t){return i(t)?n(s(t)):o(t)}},4978:(t,e,r)=>{var n=r(4590)();t.exports=n},9285:(t,e,r)=>{var n=r(8663),o=r(830),i=r(4506),s=r(8421),a=r(5874);t.exports=function(t,e,r){var u=a(t)?n:s,h=arguments.length<3;return u(t,i(e,4),r,h,o)}},3910:(t,e,r)=>{var n=r(5351),o=r(9778),i=r(3069),s=r(7462),a=r(6742);t.exports=function(t){if(null==t)return 0;if(i(t))return s(t)?a(t):t.length;var e=o(t);return"[object Map]"==e||"[object Set]"==e?t.size:n(t).length}},5246:(t,e,r)=>{var n=r(9821),o=r(9586),i=r(6965),s=r(8819),a=i((function(t,e){if(null==t)return[];var r=e.length;return r>1&&s(t,e[0],e[1])?e=[]:r>2&&s(e[0],e[1],e[2])&&(e=[e[0]]),o(t,n(e,1),[])}));t.exports=a},2982:t=>{t.exports=function(){return[]}},6408:t=>{t.exports=function(){return!1}},8265:(t,e,r)=>{var n=r(7639),o=1/0;t.exports=function(t){return t?(t=n(t))===o||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}},3758:(t,e,r)=>{var n=r(8265);t.exports=function(t){var e=n(t),r=e%1;return e==e?r?e-r:e:0}},7639:(t,e,r)=>{var n=r(5103),o=r(9400),i=r(975),s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,h=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return NaN;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=n(t);var r=a.test(t);return r||u.test(t)?h(t.slice(2),r?2:8):s.test(t)?NaN:+t}},339:(t,e,r)=>{var n=r(5532),o=r(2844);t.exports=function(t){return n(t,o(t))}},983:(t,e,r)=>{var n=r(8071);t.exports=function(t){return null==t?"":n(t)}},3279:(t,e,r)=>{var n=r(7012),o=r(1095),i=r(7702),s=r(4506),a=r(7556),u=r(5874),h=r(3601),d=r(7787),c=r(9400),l=r(9046);t.exports=function(t,e,r){var f=u(t),g=f||h(t)||l(t);if(e=s(e,4),null==r){var p=t&&t.constructor;r=g?f?new p:[]:c(t)&&d(p)?o(a(t)):{}}return(g?n:i)(t,(function(t,n,o){return e(r,t,n,o)})),r}},3344:(t,e,r)=>{var n=r(9821),o=r(6965),i=r(3434),s=r(6882),a=o((function(t){return i(n(t,1,s,!0))}));t.exports=a},761:(t,e,r)=>{var n=r(983),o=0;t.exports=function(t){var e=++o;return n(t)+e}},3005:(t,e,r)=>{var n=r(989),o=r(3511);t.exports=function(t){return null==t?[]:n(t,o(t))}},3679:(t,e,r)=>{var n=r(5802),o=r(2543);t.exports=function(t,e){return o(t||[],e||[],n)}},412:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>o});var n=r(5229);function o(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==r.output){if(!(0,n.isAnyArray)(r.output))throw new TypeError("output option must be an array if specified");e=r.output}else e=new Array(t.length);var o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,o=void 0===r?0:r,i=e.toIndex,s=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=o||s>t.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[o],u=o+1;u<s;u++)t[u]<a&&(a=t[u]);return a}(t),i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,o=void 0===r?0:r,i=e.toIndex,s=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=o||s>t.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[o],u=o+1;u<s;u++)t[u]>a&&(a=t[u]);return a}(t);if(o===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var s=r.min,a=void 0===s?r.autoMinMax?o:0:s,u=r.max,h=void 0===u?r.autoMinMax?i:1:u;if(a>=h)throw new RangeError("min option must be smaller than max option");for(var d=(h-a)/(i-o),c=0;c<t.length;c++)e[c]=(t[c]-o)*d+a;return e}},8917:(t,e,r)=>{"use strict";var n=r(5229),o=r(412);const i=" ".repeat(2),s=" ".repeat(4);function a(t,e={}){const{maxRows:r=15,maxColumns:n=10,maxNumSize:o=8,padMinus:a="auto"}=e;return`${t.constructor.name} {\\n${i}[\\n${s}${function(t,e,r,n,o){const{rows:i,columns:a}=t,h=Math.min(i,e),d=Math.min(a,r),c=[];if("auto"===o){o=!1;t:for(let e=0;e<h;e++)for(let r=0;r<d;r++)if(t.get(e,r)<0){o=!0;break t}}for(let e=0;e<h;e++){let r=[];for(let i=0;i<d;i++)r.push(u(t.get(e,i),n,o));c.push(`${r.join(" ")}`)}return d!==a&&(c[c.length-1]+=` ... ${a-r} more columns`),h!==i&&c.push(`... ${i-e} more rows`),c.join(`\\n${s}`)}(t,r,n,o,a)}\\n${i}]\\n${i}rows: ${t.rows}\\n${i}columns: ${t.columns}\\n}`}function u(t,e,r){return(t>=0&&r?` ${h(t,e-1)}`:h(t,e)).padEnd(e)}function h(t,e){let r=t.toString();if(r.length<=e)return r;let n=t.toFixed(e);if(n.length>e&&(n=t.toFixed(Math.max(0,e-(n.length-e)))),n.length<=e&&!n.startsWith("0.000")&&!n.startsWith("-0.000"))return n;let o=t.toExponential(e);return o.length>e&&(o=t.toExponential(Math.max(0,e-(o.length-e)))),o.slice(0)}function d(t,e,r){let n=r?t.rows:t.rows-1;if(e<0||e>n)throw new RangeError("Row index out of range")}function c(t,e,r){let n=r?t.columns:t.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function l(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function f(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function g(t,e){if(!n.isAnyArray(e))throw new TypeError("row indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.rows)throw new RangeError("row indices are out of range")}function p(t,e){if(!n.isAnyArray(e))throw new TypeError("column indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.columns)throw new RangeError("column indices are out of range")}function v(t,e,r,n,o){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(y("startRow",e),y("endRow",r),y("startColumn",n),y("endColumn",o),e>r||n>o||e<0||e>=t.rows||r<0||r>=t.rows||n<0||n>=t.columns||o<0||o>=t.columns)throw new RangeError("Submatrix indices are out of range")}function m(t,e=0){let r=[];for(let n=0;n<t;n++)r.push(e);return r}function y(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function w(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class x{static from1DArray(t,e,r){if(t*e!==r.length)throw new RangeError("data length does not match given dimensions");let n=new E(t,e);for(let o=0;o<t;o++)for(let t=0;t<e;t++)n.set(o,t,r[o*e+t]);return n}static rowVector(t){let e=new E(1,t.length);for(let r=0;r<t.length;r++)e.set(0,r,t[r]);return e}static columnVector(t){let e=new E(t.length,1);for(let r=0;r<t.length;r++)e.set(r,0,t[r]);return e}static zeros(t,e){return new E(t,e)}static ones(t,e){return new E(t,e).fill(1)}static rand(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{random:n=Math.random}=r;let o=new E(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)o.set(r,t,n());return o}static randInt(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{min:n=0,max:o=1e3,random:i=Math.random}=r;if(!Number.isInteger(n))throw new TypeError("min must be an integer");if(!Number.isInteger(o))throw new TypeError("max must be an integer");if(n>=o)throw new RangeError("min must be smaller than max");let s=o-n,a=new E(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++){let e=n+Math.round(i()*s);a.set(r,t,e)}return a}static eye(t,e,r){void 0===e&&(e=t),void 0===r&&(r=1);let n=Math.min(t,e),o=this.zeros(t,e);for(let t=0;t<n;t++)o.set(t,t,r);return o}static diag(t,e,r){let n=t.length;void 0===e&&(e=n),void 0===r&&(r=e);let o=Math.min(n,e,r),i=this.zeros(e,r);for(let e=0;e<o;e++)i.set(e,e,t[e]);return i}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new E(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.min(t.get(i,r),e.get(i,r)));return o}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new this(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.max(t.get(i,r),e.get(i,r)));return o}static checkMatrix(t){return x.isMatrix(t)?t:new E(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.call(this,e,r);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.push(this.get(e,r));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let r=0;r<this.columns;r++)t[e].push(this.get(e,r))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let t=0;t<this.rows;t++)if(0!==this.get(t,t))return!1;return!0}isEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);t++}return n}isReducedEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);for(let r=e+1;r<this.rows;r++)0!==this.get(t,r)&&(n=!1);t++}return n}echelonForm(){let t=this.clone(),e=0,r=0;for(;e<t.rows&&r<t.columns;){let n=e;for(let o=e;o<t.rows;o++)t.get(o,r)>t.get(n,r)&&(n=o);if(0===t.get(n,r))r++;else{t.swapRows(e,n);let o=t.get(e,r);for(let n=r;n<t.columns;n++)t.set(e,n,t.get(e,n)/o);for(let n=e+1;n<t.rows;n++){let o=t.get(n,r)/t.get(e,r);t.set(n,r,0);for(let i=r+1;i<t.columns;i++)t.set(n,i,t.get(n,i)-t.get(e,i)*o)}e++,r++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,r=t.rows,n=r-1;for(;n>=0;)if(0===t.maxRow(n))n--;else{let o=0,i=!1;for(;o<r&&!1===i;)1===t.get(n,o)?i=!0:o++;for(let r=0;r<n;r++){let i=t.get(r,o);for(let s=o;s<e;s++){let e=t.get(r,s)-i*t.get(n,s);t.set(r,s,e)}}n--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:r=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(r)||r<=0)throw new TypeError("columns must be a positive integer");let n=new E(this.rows*e,this.columns*r);for(let t=0;t<e;t++)for(let e=0;e<r;e++)n.setSubMatrix(this,this.rows*t,this.columns*e);return n}fill(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,t);return this}neg(){return this.mulS(-1)}getRow(t){d(this,t);let e=[];for(let r=0;r<this.columns;r++)e.push(this.get(t,r));return e}getRowVector(t){return E.rowVector(this.getRow(t))}setRow(t,e){d(this,t),e=l(this,e);for(let r=0;r<this.columns;r++)this.set(t,r,e[r]);return this}swapRows(t,e){d(this,t),d(this,e);for(let r=0;r<this.columns;r++){let n=this.get(t,r);this.set(t,r,this.get(e,r)),this.set(e,r,n)}return this}getColumn(t){c(this,t);let e=[];for(let r=0;r<this.rows;r++)e.push(this.get(r,t));return e}getColumnVector(t){return E.columnVector(this.getColumn(t))}setColumn(t,e){c(this,t),e=f(this,e);for(let r=0;r<this.rows;r++)this.set(r,t,e[r]);return this}swapColumns(t,e){c(this,t),c(this,e);for(let r=0;r<this.rows;r++){let n=this.get(r,t);this.set(r,t,this.get(r,e)),this.set(r,e,n)}return this}addRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[r]);return this}subRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[r]);return this}mulRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[r]);return this}divRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[r]);return this}addColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[e]);return this}subColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[e]);return this}mulColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[e]);return this}divColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[e]);return this}mulRow(t,e){d(this,t);for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e);return this}mulColumn(t,e){c(this,t);for(let r=0;r<this.rows;r++)this.set(r,t,this.get(r,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){w(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){w(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}maxRow(t){if(d(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r));return e}maxRowIndex(t){d(this,t),w(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n),r[1]=n);return r}minRow(t){if(d(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r));return e}minRowIndex(t){d(this,t),w(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n),r[1]=n);return r}maxColumn(t){if(c(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t));return e}maxColumnIndex(t){c(this,t),w(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t),r[0]=n);return r}minColumn(t){if(c(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t));return e}minColumnIndex(t){c(this,t),w(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t),r[0]=n);return r}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let r=0;r<t;r++)e.push(this.get(r,r));return e}norm(t="frobenius"){switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${t}`)}}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t+=this.get(e,r),this.set(e,r,t);return this}dot(t){x.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let r=0;for(let n=0;n<e.length;n++)r+=e[n]*t[n];return r}mmul(t){t=E.checkMatrix(t);let e=this.rows,r=this.columns,n=t.columns,o=new E(e,n),i=new Float64Array(r);for(let s=0;s<n;s++){for(let e=0;e<r;e++)i[e]=t.get(e,s);for(let t=0;t<e;t++){let e=0;for(let n=0;n<r;n++)e+=this.get(t,n)*i[n];o.set(t,s,e)}}return o}strassen2x2(t){t=E.checkMatrix(t);let e=new E(2,2);const r=this.get(0,0),n=t.get(0,0),o=this.get(0,1),i=t.get(0,1),s=this.get(1,0),a=t.get(1,0),u=this.get(1,1),h=t.get(1,1),d=(r+u)*(n+h),c=(s+u)*n,l=r*(i-h),f=u*(a-n),g=(r+o)*h,p=d+f-g+(o-u)*(a+h),v=l+g,m=c+f,y=d-c+l+(s-r)*(n+i);return e.set(0,0,p),e.set(0,1,v),e.set(1,0,m),e.set(1,1,y),e}strassen3x3(t){t=E.checkMatrix(t);let e=new E(3,3);const r=this.get(0,0),n=this.get(0,1),o=this.get(0,2),i=this.get(1,0),s=this.get(1,1),a=this.get(1,2),u=this.get(2,0),h=this.get(2,1),d=this.get(2,2),c=t.get(0,0),l=t.get(0,1),f=t.get(0,2),g=t.get(1,0),p=t.get(1,1),v=t.get(1,2),m=t.get(2,0),y=t.get(2,1),w=t.get(2,2),x=(r-i)*(-l+p),b=(-r+i+s)*(c-l+p),N=(i+s)*(-c+l),M=r*c,_=(-r+u+h)*(c-f+v),k=(-r+u)*(f-v),A=(u+h)*(-c+f),j=(-o+h+d)*(p+m-y),S=(o-d)*(p-y),O=o*m,z=(h+d)*(-m+y),R=(-o+s+a)*(v+m-w),I=(o-a)*(v-w),C=(s+a)*(-m+w),D=M+O+n*g,P=(r+n+o-i-s-h-d)*p+b+N+M+j+O+z,T=M+_+A+(r+n+o-s-a-u-h)*v+O+R+C,L=x+s*(-c+l+g-p-v-m+w)+b+M+O+R+I,F=x+b+N+M+a*y,q=O+R+I+C+i*f,V=M+_+k+h*(-c+f+g-p-v-m+y)+j+S+O,B=j+S+O+z+u*l,$=M+_+k+A+d*w;return e.set(0,0,D),e.set(0,1,P),e.set(0,2,T),e.set(1,0,L),e.set(1,1,F),e.set(1,2,q),e.set(2,0,V),e.set(2,1,B),e.set(2,2,$),e}mmulStrassen(t){t=E.checkMatrix(t);let e=this.clone(),r=e.rows,n=e.columns,o=t.rows,i=t.columns;function s(t,e,r){let n=t.rows,o=t.columns;if(n===e&&o===r)return t;{let n=x.zeros(e,r);return n=n.setSubMatrix(t,0,0),n}}n!==o&&console.warn(`Multiplying ${r} x ${n} and ${o} x ${i} matrix: dimensions do not match.`);let a=Math.max(r,o),u=Math.max(n,i);return e=s(e,a,u),function t(e,r,n,o){if(n<=512||o<=512)return e.mmul(r);n%2==1&&o%2==1?(e=s(e,n+1,o+1),r=s(r,n+1,o+1)):n%2==1?(e=s(e,n+1,o),r=s(r,n+1,o)):o%2==1&&(e=s(e,n,o+1),r=s(r,n,o+1));let i=parseInt(e.rows/2,10),a=parseInt(e.columns/2,10),u=e.subMatrix(0,i-1,0,a-1),h=r.subMatrix(0,i-1,0,a-1),d=e.subMatrix(0,i-1,a,e.columns-1),c=r.subMatrix(0,i-1,a,r.columns-1),l=e.subMatrix(i,e.rows-1,0,a-1),f=r.subMatrix(i,r.rows-1,0,a-1),g=e.subMatrix(i,e.rows-1,a,e.columns-1),p=r.subMatrix(i,r.rows-1,a,r.columns-1),v=t(x.add(u,g),x.add(h,p),i,a),m=t(x.add(l,g),h,i,a),y=t(u,x.sub(c,p),i,a),w=t(g,x.sub(f,h),i,a),b=t(x.add(u,d),p,i,a),E=t(x.sub(l,u),x.add(h,c),i,a),N=t(x.sub(d,g),x.add(f,p),i,a),M=x.add(v,w);M.sub(b),M.add(N);let _=x.add(y,b),k=x.add(m,w),A=x.sub(v,m);A.add(y),A.add(E);let j=x.zeros(2*M.rows,2*M.columns);return j=j.setSubMatrix(M,0,0),j=j.setSubMatrix(_,M.rows,0),j=j.setSubMatrix(k,0,M.columns),j=j.setSubMatrix(A,M.rows,M.columns),j.subMatrix(0,n-1,0,o-1)}(e,t=s(t,a,u),a,u)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new E(this.rows,this.columns);for(let t=0;t<this.rows;t++){const i=this.getRow(t);i.length>0&&o(i,{min:e,max:r,output:i}),n.setRow(t,i)}return n}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new E(this.rows,this.columns);for(let t=0;t<this.columns;t++){const i=this.getColumn(t);i.length&&o(i,{min:e,max:r,output:i}),n.setColumn(t,i)}return n}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let r=0;r<t;r++){let t=this.get(e,r),n=this.get(e,this.columns-1-r);this.set(e,r,n),this.set(e,this.columns-1-r,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let r=0;r<t;r++){let t=this.get(r,e),n=this.get(this.rows-1-r,e);this.set(r,e,n),this.set(this.rows-1-r,e,t)}return this}kroneckerProduct(t){t=E.checkMatrix(t);let e=this.rows,r=this.columns,n=t.rows,o=t.columns,i=new E(e*n,r*o);for(let s=0;s<e;s++)for(let e=0;e<r;e++)for(let r=0;r<n;r++)for(let a=0;a<o;a++)i.set(n*s+r,o*e+a,this.get(s,e)*t.get(r,a));return i}kroneckerSum(t){if(t=E.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,r=t.rows,n=this.kroneckerProduct(E.eye(r,r)),o=E.eye(e,e).kroneckerProduct(t);return n.add(o)}transpose(){let t=new E(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(r,e,this.get(e,r));return t}sortRows(t=b){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=b){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,r,n){v(this,t,e,r,n);let o=new E(e-t+1,n-r+1);for(let i=t;i<=e;i++)for(let e=r;e<=n;e++)o.set(i-t,e-r,this.get(i,e));return o}subMatrixRow(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.columns-1),e>r||e<0||e>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");let n=new E(t.length,r-e+1);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.rows)throw new RangeError(`Row index out of range: ${t[o]}`);n.set(o,i-e,this.get(t[o],i))}return n}subMatrixColumn(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.rows-1),e>r||e<0||e>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");let n=new E(r-e+1,t.length);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.columns)throw new RangeError(`Column index out of range: ${t[o]}`);n.set(i-e,o,this.get(i,t[o]))}return n}setSubMatrix(t,e,r){if((t=E.checkMatrix(t)).isEmpty())return this;v(this,e,e+t.rows-1,r,r+t.columns-1);for(let n=0;n<t.rows;n++)for(let o=0;o<t.columns;o++)this.set(e+n,r+o,t.get(n,o));return this}selection(t,e){g(this,t),p(this,e);let r=new E(t.length,e.length);for(let n=0;n<t.length;n++){let o=t[n];for(let t=0;t<e.length;t++){let i=e[t];r.set(n,t,this.get(o,i))}}return r}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let r=0;r<t;r++)e+=this.get(r,r);return e}clone(){return this.constructor.copy(this,new E(this.rows,this.columns))}static copy(t,e){for(const[r,n,o]of t.entries())e.set(r,n,o);return e}sum(t){switch(t){case"row":return function(t){let e=m(t.rows);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]+=t.get(r,n);return e}(this);case"column":return function(t){let e=m(t.columns);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]+=t.get(r,n);return e}(this);case void 0:return function(t){let e=0;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e+=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=m(t.rows,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]*=t.get(r,n);return e}(this);case"column":return function(t){let e=m(t.columns,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]*=t.get(r,n);return e}(this);case void 0:return function(t){let e=1;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e*=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{unbiased:r=!0,mean:o=this.mean(t)}=e;if("boolean"!=typeof r)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!n.isAnyArray(o))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let s=0;s<n;s++){let n=0,a=0,u=0;for(let e=0;e<o;e++)u=t.get(s,e)-r[s],n+=u,a+=u*u;e?i.push((a-n*n/o)/(o-1)):i.push((a-n*n/o)/o)}return i}(this,r,o);case"column":if(!n.isAnyArray(o))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let s=0;s<o;s++){let o=0,a=0,u=0;for(let e=0;e<n;e++)u=t.get(e,s)-r[s],o+=u,a+=u*u;e?i.push((a-o*o/n)/(n-1)):i.push((a-o*o/n)/n)}return i}(this,r,o);case void 0:if("number"!=typeof o)throw new TypeError("mean must be a number");return function(t,e,r){const n=t.rows,o=t.columns,i=n*o;let s=0,a=0,u=0;for(let e=0;e<n;e++)for(let n=0;n<o;n++)u=t.get(e,n)-r,s+=u,a+=u*u;return e?(a-s*s/i)/(i-1):(a-s*s/i)/i}(this,r,o);default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const r=this.variance(t,e);if(void 0===t)return Math.sqrt(r);for(let t=0;t<r.length;t++)r[t]=Math.sqrt(r[t]);return r}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{center:r=this.mean(t)}=e;switch(t){case"row":if(!n.isAnyArray(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[r])}(this,r),this;case"column":if(!n.isAnyArray(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[n])}(this,r),this;case void 0:if("number"!=typeof r)throw new TypeError("center must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");let r=e.scale;switch(t){case"row":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.rows;r++){let n=0;for(let e=0;e<t.columns;e++)n+=Math.pow(t.get(r,e),2)/(t.columns-1);e.push(Math.sqrt(n))}return e}(this);else if(!n.isAnyArray(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[r])}(this,r),this;case"column":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.columns;r++){let n=0;for(let e=0;e<t.rows;e++)n+=Math.pow(t.get(e,r),2)/(t.rows-1);e.push(Math.sqrt(n))}return e}(this);else if(!n.isAnyArray(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[n])}(this,r),this;case void 0:if(void 0===r)r=function(t){const e=t.size-1;let r=0;for(let n=0;n<t.columns;n++)for(let o=0;o<t.rows;o++)r+=Math.pow(t.get(o,n),2)/e;return Math.sqrt(r)}(this);else if("number"!=typeof r)throw new TypeError("scale must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}toString(t){return a(this,t)}[Symbol.iterator](){return this.entries()}*entries(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield[t,e,this.get(t,e)]}*values(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield this.get(t,e)}}function b(t,e){return t-e}x.prototype.klass="Matrix","undefined"!=typeof Symbol&&(x.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return a(this)}),x.random=x.rand,x.randomInt=x.randInt,x.diagonal=x.diag,x.prototype.diagonal=x.prototype.diag,x.identity=x.eye,x.prototype.negate=x.prototype.neg,x.prototype.tensorProduct=x.prototype.kroneckerProduct;class E extends x{data;#t(t,e){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let r=0;r<t;r++)this.data.push(new Float64Array(e));this.rows=t,this.columns=e}constructor(t,e){if(super(),E.isMatrix(t))this.#t(t.rows,t.columns),E.copy(t,this);else if(Number.isInteger(t)&&t>=0)this.#t(t,e);else{if(!n.isAnyArray(t))throw new TypeError("First argument must be a positive number or an array");{const r=t;if("number"!=typeof(e=(t=r.length)?r[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let n=0;n<t;n++){if(r[n].length!==e)throw new RangeError("Inconsistent array dimensions");if(!r[n].every((t=>"number"==typeof t)))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(r[n]))}this.rows=t,this.columns=e}}}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}removeRow(t){return d(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),d(this,t,!0),e=Float64Array.from(l(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){c(this,t);for(let e=0;e<this.rows;e++){const r=new Float64Array(this.columns-1);for(let n=0;n<t;n++)r[n]=this.data[e][n];for(let n=t+1;n<this.columns;n++)r[n-1]=this.data[e][n];this.data[e]=r}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),c(this,t,!0),e=f(this,e);for(let r=0;r<this.rows;r++){const n=new Float64Array(this.columns+1);let o=0;for(;o<t;o++)n[o]=this.data[r][o];for(n[o++]=e[r];o<this.columns+1;o++)n[o]=this.data[r][o-1];this.data[r]=n}return this.columns+=1,this}}!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t.get(e,r));return this},t.add=function(t,r){return new e(t).add(r)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t.get(e,r));return this},t.sub=function(t,r){return new e(t).sub(r)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t.get(e,r));return this},t.mul=function(t,r){return new e(t).mul(r)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t.get(e,r));return this},t.div=function(t,r){return new e(t).div(r)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t.get(e,r));return this},t.mod=function(t,r){return new e(t).mod(r)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t.get(e,r));return this},t.and=function(t,r){return new e(t).and(r)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t.get(e,r));return this},t.or=function(t,r){return new e(t).or(r)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t.get(e,r));return this},t.xor=function(t,r){return new e(t).xor(r)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t.get(e,r));return this},t.leftShift=function(t,r){return new e(t).leftShift(r)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t.get(e,r));return this},t.signPropagatingRightShift=function(t,r){return new e(t).signPropagatingRightShift(r)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t.get(e,r));return this},t.rightShift=function(t,r){return new e(t).rightShift(r)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,r){return new e(t).pow(r)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t));return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t.get(e,r)));return this}}(x,E);class N extends x{#e;get size(){return this.#e.size}get rows(){return this.#e.rows}get columns(){return this.#e.columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(t){return E.isMatrix(t)&&"SymmetricMatrix"===t.klassType}static zeros(t){return new this(t)}static ones(t){return new this(t).fill(1)}constructor(t){if(super(),E.isMatrix(t)){if(!t.isSymmetric())throw new TypeError("not symmetric data");this.#e=E.copy(t,new E(t.rows,t.rows))}else if(Number.isInteger(t)&&t>=0)this.#e=new E(t,t);else if(this.#e=new E(t),!this.isSymmetric())throw new TypeError("not symmetric data")}clone(){const t=new N(this.diagonalSize);for(const[e,r,n]of this.upperRightEntries())t.set(e,r,n);return t}toMatrix(){return new E(this)}get(t,e){return this.#e.get(t,e)}set(t,e,r){return this.#e.set(t,e,r),this.#e.set(e,t,r),this}removeCross(t){return this.#e.removeRow(t),this.#e.removeColumn(t),this}addCross(t,e){void 0===e&&(e=t,t=this.diagonalSize);const r=e.slice();return r.splice(t,1),this.#e.addRow(t,r),this.#e.addColumn(t,e),this}applyMask(t){if(t.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const e=[];for(const[r,n]of t.entries())n||e.push(r);e.reverse();for(const t of e)this.removeCross(t);return this}toCompact(){const{diagonalSize:t}=this,e=new Array(t*(t+1)/2);for(let r=0,n=0,o=0;o<e.length;o++)e[o]=this.get(n,r),++r>=t&&(r=++n);return e}static fromCompact(t){const e=t.length,r=(Math.sqrt(8*e+1)-1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(t)}`);const n=new N(r);for(let o=0,i=0,s=0;s<e;s++)n.set(o,i,t[s]),++o>=r&&(o=++i);return n}*upperRightEntries(){for(let t=0,e=0;t<this.diagonalSize;void 0){const r=this.get(t,e);yield[t,e,r],++e>=this.diagonalSize&&(e=++t)}}*upperRightValues(){for(let t=0,e=0;t<this.diagonalSize;void 0){const r=this.get(t,e);yield r,++e>=this.diagonalSize&&(e=++t)}}}N.prototype.klassType="SymmetricMatrix";class M extends N{static isDistanceMatrix(t){return N.isSymmetricMatrix(t)&&"DistanceMatrix"===t.klassSubType}constructor(t){if(super(t),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(t,e,r){return t===e&&(r=0),super.set(t,e,r)}addCross(t,e){return void 0===e&&(e=t,t=this.diagonalSize),(e=e.slice())[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new N(this)}clone(){const t=new M(this.diagonalSize);for(const[e,r,n]of this.upperRightEntries())e!==r&&t.set(e,r,n);return t}toCompact(){const{diagonalSize:t}=this,e=new Array((t-1)*t/2);for(let r=1,n=0,o=0;o<e.length;o++)e[o]=this.get(n,r),++r>=t&&(r=1+ ++n);return e}static fromCompact(t){const e=t.length,r=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(t)}`);const n=new this(r);for(let o=1,i=0,s=0;s<e;s++)n.set(o,i,t[s]),++o>=r&&(o=1+ ++i);return n}}M.prototype.klassSubType="DistanceMatrix";class _ extends x{constructor(t,e,r){super(),this.matrix=t,this.rows=e,this.columns=r}}class k extends _{constructor(t,e,r){g(t,e),p(t,r),super(t,e.length,r.length),this.rowIndices=e,this.columnIndices=r}set(t,e,r){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],r),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class A extends x{constructor(t,e={}){const{rows:r=1}=e;if(t.length%r!=0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=r,this.columns=t.length/r,this.data=t}set(t,e,r){let n=this._calculateIndex(t,e);return this.data[n]=r,this}get(t,e){let r=this._calculateIndex(t,e);return this.data[r]}_calculateIndex(t,e){return t*this.columns+e}}class j extends x{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}}class S{constructor(t){let e,r,n,o,i,s,a,u,h,d=(t=j.checkMatrix(t)).clone(),c=d.rows,l=d.columns,f=new Float64Array(c),g=1;for(e=0;e<c;e++)f[e]=e;for(u=new Float64Array(c),r=0;r<l;r++){for(e=0;e<c;e++)u[e]=d.get(e,r);for(e=0;e<c;e++){for(h=Math.min(e,r),i=0,n=0;n<h;n++)i+=d.get(e,n)*u[n];u[e]-=i,d.set(e,r,u[e])}for(o=r,e=r+1;e<c;e++)Math.abs(u[e])>Math.abs(u[o])&&(o=e);if(o!==r){for(n=0;n<l;n++)s=d.get(o,n),d.set(o,n,d.get(r,n)),d.set(r,n,s);a=f[o],f[o]=f[r],f[r]=a,g=-g}if(r<c&&0!==d.get(r,r))for(e=r+1;e<c;e++)d.set(e,r,d.get(e,r)/d.get(r,r))}this.LU=d,this.pivotVector=f,this.pivotSign=g}isSingular(){let t=this.LU,e=t.columns;for(let r=0;r<e;r++)if(0===t.get(r,r))return!0;return!1}solve(t){t=E.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let r,n,o,i=t.columns,s=t.subMatrixRow(this.pivotVector,0,i-1),a=e.columns;for(o=0;o<a;o++)for(r=o+1;r<a;r++)for(n=0;n<i;n++)s.set(r,n,s.get(r,n)-s.get(o,n)*e.get(r,o));for(o=a-1;o>=0;o--){for(n=0;n<i;n++)s.set(o,n,s.get(o,n)/e.get(o,o));for(r=0;r<o;r++)for(n=0;n<i;n++)s.set(r,n,s.get(r,n)-s.get(o,n)*e.get(r,o))}return s}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,r=t.columns;for(let n=0;n<r;n++)e*=t.get(n,n);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,n=new E(e,r);for(let o=0;o<e;o++)for(let e=0;e<r;e++)o>e?n.set(o,e,t.get(o,e)):o===e?n.set(o,e,1):n.set(o,e,0);return n}get upperTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,n=new E(e,r);for(let o=0;o<e;o++)for(let e=0;e<r;e++)o<=e?n.set(o,e,t.get(o,e)):n.set(o,e,0);return n}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function O(t,e){let r=0;return Math.abs(t)>Math.abs(e)?(r=e/t,Math.abs(t)*Math.sqrt(1+r*r)):0!==e?(r=t/e,Math.abs(e)*Math.sqrt(1+r*r)):0}class z{constructor(t){let e,r,n,o,i=(t=j.checkMatrix(t)).clone(),s=t.rows,a=t.columns,u=new Float64Array(a);for(n=0;n<a;n++){let t=0;for(e=n;e<s;e++)t=O(t,i.get(e,n));if(0!==t){for(i.get(n,n)<0&&(t=-t),e=n;e<s;e++)i.set(e,n,i.get(e,n)/t);for(i.set(n,n,i.get(n,n)+1),r=n+1;r<a;r++){for(o=0,e=n;e<s;e++)o+=i.get(e,n)*i.get(e,r);for(o=-o/i.get(n,n),e=n;e<s;e++)i.set(e,r,i.get(e,r)+o*i.get(e,n))}}u[n]=-t}this.QR=i,this.Rdiag=u}solve(t){t=E.checkMatrix(t);let e=this.QR,r=e.rows;if(t.rows!==r)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let n,o,i,s,a=t.columns,u=t.clone(),h=e.columns;for(i=0;i<h;i++)for(o=0;o<a;o++){for(s=0,n=i;n<r;n++)s+=e.get(n,i)*u.get(n,o);for(s=-s/e.get(i,i),n=i;n<r;n++)u.set(n,o,u.get(n,o)+s*e.get(n,i))}for(i=h-1;i>=0;i--){for(o=0;o<a;o++)u.set(i,o,u.get(i,o)/this.Rdiag[i]);for(n=0;n<i;n++)for(o=0;o<a;o++)u.set(n,o,u.get(n,o)-u.get(i,o)*e.get(n,i))}return u.subMatrix(0,h-1,0,a-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(0===this.Rdiag[e])return!1;return!0}get upperTriangularMatrix(){let t,e,r=this.QR,n=r.columns,o=new E(n,n);for(t=0;t<n;t++)for(e=0;e<n;e++)t<e?o.set(t,e,r.get(t,e)):t===e?o.set(t,e,this.Rdiag[t]):o.set(t,e,0);return o}get orthogonalMatrix(){let t,e,r,n,o=this.QR,i=o.rows,s=o.columns,a=new E(i,s);for(r=s-1;r>=0;r--){for(t=0;t<i;t++)a.set(t,r,0);for(a.set(r,r,1),e=r;e<s;e++)if(0!==o.get(r,r)){for(n=0,t=r;t<i;t++)n+=o.get(t,r)*a.get(t,e);for(n=-n/o.get(r,r),t=r;t<i;t++)a.set(t,e,a.get(t,e)+n*o.get(t,r))}}return a}}class R{constructor(t,e={}){if((t=j.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let r=t.rows,n=t.columns;const{computeLeftSingularVectors:o=!0,computeRightSingularVectors:i=!0,autoTranspose:s=!1}=e;let a,u=Boolean(o),h=Boolean(i),d=!1;if(r<n)if(s){a=t.transpose(),r=a.rows,n=a.columns,d=!0;let e=u;u=h,h=e}else a=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else a=t.clone();let c=Math.min(r,n),l=Math.min(r+1,n),f=new Float64Array(l),g=new E(r,c),p=new E(n,n),v=new Float64Array(n),m=new Float64Array(r),y=new Float64Array(l);for(let t=0;t<l;t++)y[t]=t;let w=Math.min(r-1,n),x=Math.max(0,Math.min(n-2,r)),b=Math.max(w,x);for(let t=0;t<b;t++){if(t<w){f[t]=0;for(let e=t;e<r;e++)f[t]=O(f[t],a.get(e,t));if(0!==f[t]){a.get(t,t)<0&&(f[t]=-f[t]);for(let e=t;e<r;e++)a.set(e,t,a.get(e,t)/f[t]);a.set(t,t,a.get(t,t)+1)}f[t]=-f[t]}for(let e=t+1;e<n;e++){if(t<w&&0!==f[t]){let n=0;for(let o=t;o<r;o++)n+=a.get(o,t)*a.get(o,e);n=-n/a.get(t,t);for(let o=t;o<r;o++)a.set(o,e,a.get(o,e)+n*a.get(o,t))}v[e]=a.get(t,e)}if(u&&t<w)for(let e=t;e<r;e++)g.set(e,t,a.get(e,t));if(t<x){v[t]=0;for(let e=t+1;e<n;e++)v[t]=O(v[t],v[e]);if(0!==v[t]){v[t+1]<0&&(v[t]=0-v[t]);for(let e=t+1;e<n;e++)v[e]/=v[t];v[t+1]+=1}if(v[t]=-v[t],t+1<r&&0!==v[t]){for(let e=t+1;e<r;e++)m[e]=0;for(let e=t+1;e<r;e++)for(let r=t+1;r<n;r++)m[e]+=v[r]*a.get(e,r);for(let e=t+1;e<n;e++){let n=-v[e]/v[t+1];for(let o=t+1;o<r;o++)a.set(o,e,a.get(o,e)+n*m[o])}}if(h)for(let e=t+1;e<n;e++)p.set(e,t,v[e])}}let N=Math.min(n,r+1);if(w<n&&(f[w]=a.get(w,w)),r<N&&(f[N-1]=0),x+1<N&&(v[x]=a.get(x,N-1)),v[N-1]=0,u){for(let t=w;t<c;t++){for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}for(let t=w-1;t>=0;t--)if(0!==f[t]){for(let e=t+1;e<c;e++){let n=0;for(let o=t;o<r;o++)n+=g.get(o,t)*g.get(o,e);n=-n/g.get(t,t);for(let o=t;o<r;o++)g.set(o,e,g.get(o,e)+n*g.get(o,t))}for(let e=t;e<r;e++)g.set(e,t,-g.get(e,t));g.set(t,t,1+g.get(t,t));for(let e=0;e<t-1;e++)g.set(e,t,0)}else{for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}}if(h)for(let t=n-1;t>=0;t--){if(t<x&&0!==v[t])for(let e=t+1;e<n;e++){let r=0;for(let o=t+1;o<n;o++)r+=p.get(o,t)*p.get(o,e);r=-r/p.get(t+1,t);for(let o=t+1;o<n;o++)p.set(o,e,p.get(o,e)+r*p.get(o,t))}for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}let M=N-1,_=Number.EPSILON;for(;N>0;){let t,e;for(t=N-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+_*Math.abs(f[t]+Math.abs(f[t+1]));if(Math.abs(v[t])<=e||Number.isNaN(v[t])){v[t]=0;break}}if(t===N-2)e=4;else{let r;for(r=N-1;r>=t&&r!==t;r--){let e=(r!==N?Math.abs(v[r]):0)+(r!==t+1?Math.abs(v[r-1]):0);if(Math.abs(f[r])<=_*e){f[r]=0;break}}r===t?e=3:r===N-1?e=1:(e=2,t=r)}switch(t++,e){case 1:{let e=v[N-2];v[N-2]=0;for(let r=N-2;r>=t;r--){let o=O(f[r],e),i=f[r]/o,s=e/o;if(f[r]=o,r!==t&&(e=-s*v[r-1],v[r-1]=i*v[r-1]),h)for(let t=0;t<n;t++)o=i*p.get(t,r)+s*p.get(t,N-1),p.set(t,N-1,-s*p.get(t,r)+i*p.get(t,N-1)),p.set(t,r,o)}break}case 2:{let e=v[t-1];v[t-1]=0;for(let n=t;n<N;n++){let o=O(f[n],e),i=f[n]/o,s=e/o;if(f[n]=o,e=-s*v[n],v[n]=i*v[n],u)for(let e=0;e<r;e++)o=i*g.get(e,n)+s*g.get(e,t-1),g.set(e,t-1,-s*g.get(e,n)+i*g.get(e,t-1)),g.set(e,n,o)}break}case 3:{const e=Math.max(Math.abs(f[N-1]),Math.abs(f[N-2]),Math.abs(v[N-2]),Math.abs(f[t]),Math.abs(v[t])),o=f[N-1]/e,i=f[N-2]/e,s=v[N-2]/e,a=f[t]/e,d=v[t]/e,c=((i+o)*(i-o)+s*s)/2,l=o*s*(o*s);let m=0;0===c&&0===l||(m=c<0?0-Math.sqrt(c*c+l):Math.sqrt(c*c+l),m=l/(c+m));let y=(a+o)*(a-o)+m,w=a*d;for(let e=t;e<N-1;e++){let o=O(y,w);0===o&&(o=Number.MIN_VALUE);let i=y/o,s=w/o;if(e!==t&&(v[e-1]=o),y=i*f[e]+s*v[e],v[e]=i*v[e]-s*f[e],w=s*f[e+1],f[e+1]=i*f[e+1],h)for(let t=0;t<n;t++)o=i*p.get(t,e)+s*p.get(t,e+1),p.set(t,e+1,-s*p.get(t,e)+i*p.get(t,e+1)),p.set(t,e,o);if(o=O(y,w),0===o&&(o=Number.MIN_VALUE),i=y/o,s=w/o,f[e]=o,y=i*v[e]+s*f[e+1],f[e+1]=-s*v[e]+i*f[e+1],w=s*v[e+1],v[e+1]=i*v[e+1],u&&e<r-1)for(let t=0;t<r;t++)o=i*g.get(t,e)+s*g.get(t,e+1),g.set(t,e+1,-s*g.get(t,e)+i*g.get(t,e+1)),g.set(t,e,o)}v[N-2]=y;break}case 4:if(f[t]<=0&&(f[t]=f[t]<0?-f[t]:0,h))for(let e=0;e<=M;e++)p.set(e,t,-p.get(e,t));for(;t<M&&!(f[t]>=f[t+1]);){let e=f[t];if(f[t]=f[t+1],f[t+1]=e,h&&t<n-1)for(let r=0;r<n;r++)e=p.get(r,t+1),p.set(r,t+1,p.get(r,t)),p.set(r,t,e);if(u&&t<r-1)for(let n=0;n<r;n++)e=g.get(n,t+1),g.set(n,t+1,g.get(n,t)),g.set(n,t,e);t++}N--}}if(d){let t=p;p=g,g=t}this.m=r,this.n=n,this.s=f,this.U=g,this.V=p}solve(t){let e=t,r=this.threshold,n=this.s.length,o=E.zeros(n,n);for(let t=0;t<n;t++)Math.abs(this.s[t])<=r?o.set(t,t,0):o.set(t,t,1/this.s[t]);let i=this.U,s=this.rightSingularVectors,a=s.mmul(o),u=s.rows,h=i.rows,d=E.zeros(u,h);for(let t=0;t<u;t++)for(let e=0;e<h;e++){let r=0;for(let o=0;o<n;o++)r+=a.get(t,o)*i.get(e,o);d.set(t,e,r)}return d.mmul(e)}solveForDiagonal(t){return this.solve(E.diag(t))}inverse(){let t=this.V,e=this.threshold,r=t.rows,n=t.columns,o=new E(r,this.s.length);for(let i=0;i<r;i++)for(let r=0;r<n;r++)Math.abs(this.s[r])>e&&o.set(i,r,t.get(i,r)/this.s[r]);let i=this.U,s=i.rows,a=i.columns,u=new E(r,s);for(let t=0;t<r;t++)for(let e=0;e<s;e++){let r=0;for(let n=0;n<a;n++)r+=o.get(t,n)*i.get(e,n);u.set(t,e,r)}return u}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,r=this.s;for(let n=0,o=r.length;n<o;n++)r[n]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return E.diag(this.s)}}function I(t,e,r=!1){return t=j.checkMatrix(t),e=j.checkMatrix(e),r?new R(t).solve(e):t.isSquare()?new S(t).solve(e):new z(t).solve(e)}function C(t,e){let r=[];for(let n=0;n<t;n++)n!==e&&r.push(n);return r}function D(t,e,r,n=1e-9,o=1e-9){if(t>o)return new Array(e.rows+1).fill(0);{let t=e.addRow(r,[0]);for(let e=0;e<t.rows;e++)Math.abs(t.get(e,0))<n&&t.set(e,0,0);return t.to1DArray()}}class P{constructor(t,e={}){const{assumeSymmetric:r=!1}=e;if(!(t=j.checkMatrix(t)).isSquare())throw new Error("Matrix is not a square matrix");if(t.isEmpty())throw new Error("Matrix must be non-empty");let n,o,i=t.columns,s=new E(i,i),a=new Float64Array(i),u=new Float64Array(i),h=t,d=!1;if(d=!!r||t.isSymmetric(),d){for(n=0;n<i;n++)for(o=0;o<i;o++)s.set(n,o,h.get(n,o));!function(t,e,r,n){let o,i,s,a,u,h,d,c;for(u=0;u<t;u++)r[u]=n.get(t-1,u);for(a=t-1;a>0;a--){for(c=0,s=0,h=0;h<a;h++)c+=Math.abs(r[h]);if(0===c)for(e[a]=r[a-1],u=0;u<a;u++)r[u]=n.get(a-1,u),n.set(a,u,0),n.set(u,a,0);else{for(h=0;h<a;h++)r[h]/=c,s+=r[h]*r[h];for(o=r[a-1],i=Math.sqrt(s),o>0&&(i=-i),e[a]=c*i,s-=o*i,r[a-1]=o-i,u=0;u<a;u++)e[u]=0;for(u=0;u<a;u++){for(o=r[u],n.set(u,a,o),i=e[u]+n.get(u,u)*o,h=u+1;h<=a-1;h++)i+=n.get(h,u)*r[h],e[h]+=n.get(h,u)*o;e[u]=i}for(o=0,u=0;u<a;u++)e[u]/=s,o+=e[u]*r[u];for(d=o/(s+s),u=0;u<a;u++)e[u]-=d*r[u];for(u=0;u<a;u++){for(o=r[u],i=e[u],h=u;h<=a-1;h++)n.set(h,u,n.get(h,u)-(o*e[h]+i*r[h]));r[u]=n.get(a-1,u),n.set(a,u,0)}}r[a]=s}for(a=0;a<t-1;a++){if(n.set(t-1,a,n.get(a,a)),n.set(a,a,1),s=r[a+1],0!==s){for(h=0;h<=a;h++)r[h]=n.get(h,a+1)/s;for(u=0;u<=a;u++){for(i=0,h=0;h<=a;h++)i+=n.get(h,a+1)*n.get(h,u);for(h=0;h<=a;h++)n.set(h,u,n.get(h,u)-i*r[h])}}for(h=0;h<=a;h++)n.set(h,a+1,0)}for(u=0;u<t;u++)r[u]=n.get(t-1,u),n.set(t-1,u,0);n.set(t-1,t-1,1),e[0]=0}(i,u,a,s),function(t,e,r,n){let o,i,s,a,u,h,d,c,l,f,g,p,v,m,y,w;for(s=1;s<t;s++)e[s-1]=e[s];e[t-1]=0;let x=0,b=0,E=Number.EPSILON;for(h=0;h<t;h++){for(b=Math.max(b,Math.abs(r[h])+Math.abs(e[h])),d=h;d<t&&!(Math.abs(e[d])<=E*b);)d++;if(d>h)do{for(o=r[h],c=(r[h+1]-o)/(2*e[h]),l=O(c,1),c<0&&(l=-l),r[h]=e[h]/(c+l),r[h+1]=e[h]*(c+l),f=r[h+1],i=o-r[h],s=h+2;s<t;s++)r[s]-=i;for(x+=i,c=r[d],g=1,p=g,v=g,m=e[h+1],y=0,w=0,s=d-1;s>=h;s--)for(v=p,p=g,w=y,o=g*e[s],i=g*c,l=O(c,e[s]),e[s+1]=y*l,y=e[s]/l,g=c/l,c=g*r[s]-y*o,r[s+1]=i+y*(g*o+y*r[s]),u=0;u<t;u++)i=n.get(u,s+1),n.set(u,s+1,y*n.get(u,s)+g*i),n.set(u,s,g*n.get(u,s)-y*i);c=-y*w*v*m*e[h]/f,e[h]=y*c,r[h]=g*c}while(Math.abs(e[h])>E*b);r[h]=r[h]+x,e[h]=0}for(s=0;s<t-1;s++){for(u=s,c=r[s],a=s+1;a<t;a++)r[a]<c&&(u=a,c=r[a]);if(u!==s)for(r[u]=r[s],r[s]=c,a=0;a<t;a++)c=n.get(a,s),n.set(a,s,n.get(a,u)),n.set(a,u,c)}}(i,u,a,s)}else{let t=new E(i,i),e=new Float64Array(i);for(o=0;o<i;o++)for(n=0;n<i;n++)t.set(n,o,h.get(n,o));!function(t,e,r,n){let o,i,s,a,u,h,d,c=t-1;for(h=1;h<=c-1;h++){for(d=0,a=h;a<=c;a++)d+=Math.abs(e.get(a,h-1));if(0!==d){for(s=0,a=c;a>=h;a--)r[a]=e.get(a,h-1)/d,s+=r[a]*r[a];for(i=Math.sqrt(s),r[h]>0&&(i=-i),s-=r[h]*i,r[h]=r[h]-i,u=h;u<t;u++){for(o=0,a=c;a>=h;a--)o+=r[a]*e.get(a,u);for(o/=s,a=h;a<=c;a++)e.set(a,u,e.get(a,u)-o*r[a])}for(a=0;a<=c;a++){for(o=0,u=c;u>=h;u--)o+=r[u]*e.get(a,u);for(o/=s,u=h;u<=c;u++)e.set(a,u,e.get(a,u)-o*r[u])}r[h]=d*r[h],e.set(h,h-1,d*i)}}for(a=0;a<t;a++)for(u=0;u<t;u++)n.set(a,u,a===u?1:0);for(h=c-1;h>=1;h--)if(0!==e.get(h,h-1)){for(a=h+1;a<=c;a++)r[a]=e.get(a,h-1);for(u=h;u<=c;u++){for(i=0,a=h;a<=c;a++)i+=r[a]*n.get(a,u);for(i=i/r[h]/e.get(h,h-1),a=h;a<=c;a++)n.set(a,u,n.get(a,u)+i*r[a])}}}(i,t,e,s),function(t,e,r,n,o){let i,s,a,u,h,d,c,l,f,g,p,v,m,y,w,x=t-1,b=t-1,E=Number.EPSILON,N=0,M=0,_=0,k=0,A=0,j=0,S=0,O=0;for(i=0;i<t;i++)for((i<0||i>b)&&(r[i]=o.get(i,i),e[i]=0),s=Math.max(i-1,0);s<t;s++)M+=Math.abs(o.get(i,s));for(;x>=0;){for(u=x;u>0&&(j=Math.abs(o.get(u-1,u-1))+Math.abs(o.get(u,u)),0===j&&(j=M),!(Math.abs(o.get(u,u-1))<E*j));)u--;if(u===x)o.set(x,x,o.get(x,x)+N),r[x]=o.get(x,x),e[x]=0,x--,O=0;else if(u===x-1){if(c=o.get(x,x-1)*o.get(x-1,x),_=(o.get(x-1,x-1)-o.get(x,x))/2,k=_*_+c,S=Math.sqrt(Math.abs(k)),o.set(x,x,o.get(x,x)+N),o.set(x-1,x-1,o.get(x-1,x-1)+N),l=o.get(x,x),k>=0){for(S=_>=0?_+S:_-S,r[x-1]=l+S,r[x]=r[x-1],0!==S&&(r[x]=l-c/S),e[x-1]=0,e[x]=0,l=o.get(x,x-1),j=Math.abs(l)+Math.abs(S),_=l/j,k=S/j,A=Math.sqrt(_*_+k*k),_/=A,k/=A,s=x-1;s<t;s++)S=o.get(x-1,s),o.set(x-1,s,k*S+_*o.get(x,s)),o.set(x,s,k*o.get(x,s)-_*S);for(i=0;i<=x;i++)S=o.get(i,x-1),o.set(i,x-1,k*S+_*o.get(i,x)),o.set(i,x,k*o.get(i,x)-_*S);for(i=0;i<=b;i++)S=n.get(i,x-1),n.set(i,x-1,k*S+_*n.get(i,x)),n.set(i,x,k*n.get(i,x)-_*S)}else r[x-1]=l+_,r[x]=l+_,e[x-1]=S,e[x]=-S;x-=2,O=0}else{if(l=o.get(x,x),f=0,c=0,u<x&&(f=o.get(x-1,x-1),c=o.get(x,x-1)*o.get(x-1,x)),10===O){for(N+=l,i=0;i<=x;i++)o.set(i,i,o.get(i,i)-l);j=Math.abs(o.get(x,x-1))+Math.abs(o.get(x-1,x-2)),l=f=.75*j,c=-.4375*j*j}if(30===O&&(j=(f-l)/2,j=j*j+c,j>0)){for(j=Math.sqrt(j),f<l&&(j=-j),j=l-c/((f-l)/2+j),i=0;i<=x;i++)o.set(i,i,o.get(i,i)-j);N+=j,l=f=c=.964}for(O+=1,h=x-2;h>=u&&(S=o.get(h,h),A=l-S,j=f-S,_=(A*j-c)/o.get(h+1,h)+o.get(h,h+1),k=o.get(h+1,h+1)-S-A-j,A=o.get(h+2,h+1),j=Math.abs(_)+Math.abs(k)+Math.abs(A),_/=j,k/=j,A/=j,h!==u)&&!(Math.abs(o.get(h,h-1))*(Math.abs(k)+Math.abs(A))<E*(Math.abs(_)*(Math.abs(o.get(h-1,h-1))+Math.abs(S)+Math.abs(o.get(h+1,h+1)))));)h--;for(i=h+2;i<=x;i++)o.set(i,i-2,0),i>h+2&&o.set(i,i-3,0);for(a=h;a<=x-1&&(y=a!==x-1,a!==h&&(_=o.get(a,a-1),k=o.get(a+1,a-1),A=y?o.get(a+2,a-1):0,l=Math.abs(_)+Math.abs(k)+Math.abs(A),0!==l&&(_/=l,k/=l,A/=l)),0!==l);a++)if(j=Math.sqrt(_*_+k*k+A*A),_<0&&(j=-j),0!==j){for(a!==h?o.set(a,a-1,-j*l):u!==h&&o.set(a,a-1,-o.get(a,a-1)),_+=j,l=_/j,f=k/j,S=A/j,k/=_,A/=_,s=a;s<t;s++)_=o.get(a,s)+k*o.get(a+1,s),y&&(_+=A*o.get(a+2,s),o.set(a+2,s,o.get(a+2,s)-_*S)),o.set(a,s,o.get(a,s)-_*l),o.set(a+1,s,o.get(a+1,s)-_*f);for(i=0;i<=Math.min(x,a+3);i++)_=l*o.get(i,a)+f*o.get(i,a+1),y&&(_+=S*o.get(i,a+2),o.set(i,a+2,o.get(i,a+2)-_*A)),o.set(i,a,o.get(i,a)-_),o.set(i,a+1,o.get(i,a+1)-_*k);for(i=0;i<=b;i++)_=l*n.get(i,a)+f*n.get(i,a+1),y&&(_+=S*n.get(i,a+2),n.set(i,a+2,n.get(i,a+2)-_*A)),n.set(i,a,n.get(i,a)-_),n.set(i,a+1,n.get(i,a+1)-_*k)}}}if(0!==M){for(x=t-1;x>=0;x--)if(_=r[x],k=e[x],0===k)for(u=x,o.set(x,x,1),i=x-1;i>=0;i--){for(c=o.get(i,i)-_,A=0,s=u;s<=x;s++)A+=o.get(i,s)*o.get(s,x);if(e[i]<0)S=c,j=A;else if(u=i,0===e[i]?o.set(i,x,0!==c?-A/c:-A/(E*M)):(l=o.get(i,i+1),f=o.get(i+1,i),k=(r[i]-_)*(r[i]-_)+e[i]*e[i],d=(l*j-S*A)/k,o.set(i,x,d),o.set(i+1,x,Math.abs(l)>Math.abs(S)?(-A-c*d)/l:(-j-f*d)/S)),d=Math.abs(o.get(i,x)),E*d*d>1)for(s=i;s<=x;s++)o.set(s,x,o.get(s,x)/d)}else if(k<0)for(u=x-1,Math.abs(o.get(x,x-1))>Math.abs(o.get(x-1,x))?(o.set(x-1,x-1,k/o.get(x,x-1)),o.set(x-1,x,-(o.get(x,x)-_)/o.get(x,x-1))):(w=T(0,-o.get(x-1,x),o.get(x-1,x-1)-_,k),o.set(x-1,x-1,w[0]),o.set(x-1,x,w[1])),o.set(x,x-1,0),o.set(x,x,1),i=x-2;i>=0;i--){for(g=0,p=0,s=u;s<=x;s++)g+=o.get(i,s)*o.get(s,x-1),p+=o.get(i,s)*o.get(s,x);if(c=o.get(i,i)-_,e[i]<0)S=c,A=g,j=p;else if(u=i,0===e[i]?(w=T(-g,-p,c,k),o.set(i,x-1,w[0]),o.set(i,x,w[1])):(l=o.get(i,i+1),f=o.get(i+1,i),v=(r[i]-_)*(r[i]-_)+e[i]*e[i]-k*k,m=2*(r[i]-_)*k,0===v&&0===m&&(v=E*M*(Math.abs(c)+Math.abs(k)+Math.abs(l)+Math.abs(f)+Math.abs(S))),w=T(l*A-S*g+k*p,l*j-S*p-k*g,v,m),o.set(i,x-1,w[0]),o.set(i,x,w[1]),Math.abs(l)>Math.abs(S)+Math.abs(k)?(o.set(i+1,x-1,(-g-c*o.get(i,x-1)+k*o.get(i,x))/l),o.set(i+1,x,(-p-c*o.get(i,x)-k*o.get(i,x-1))/l)):(w=T(-A-f*o.get(i,x-1),-j-f*o.get(i,x),S,k),o.set(i+1,x-1,w[0]),o.set(i+1,x,w[1]))),d=Math.max(Math.abs(o.get(i,x-1)),Math.abs(o.get(i,x))),E*d*d>1)for(s=i;s<=x;s++)o.set(s,x-1,o.get(s,x-1)/d),o.set(s,x,o.get(s,x)/d)}for(i=0;i<t;i++)if(i<0||i>b)for(s=i;s<t;s++)n.set(i,s,o.get(i,s));for(s=t-1;s>=0;s--)for(i=0;i<=b;i++){for(S=0,a=0;a<=Math.min(s,b);a++)S+=n.get(i,a)*o.get(a,s);n.set(i,s,S)}}}(i,u,a,s,t)}this.n=i,this.e=u,this.d=a,this.V=s}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let t,e,r=this.n,n=this.e,o=this.d,i=new E(r,r);for(t=0;t<r;t++){for(e=0;e<r;e++)i.set(t,e,0);i.set(t,t,o[t]),n[t]>0?i.set(t,t+1,n[t]):n[t]<0&&i.set(t,t-1,n[t])}return i}}function T(t,e,r,n){let o,i;return Math.abs(r)>Math.abs(n)?(o=n/r,i=r+o*n,[(t+o*e)/i,(e-o*t)/i]):(o=r/n,i=n+o*r,[(o*t+e)/i,(o*e-t)/i])}class L{constructor(t){if(!(t=j.checkMatrix(t)).isSymmetric())throw new Error("Matrix is not symmetric");let e,r,n,o=t,i=o.rows,s=new E(i,i),a=!0;for(r=0;r<i;r++){let t=0;for(n=0;n<r;n++){let i=0;for(e=0;e<n;e++)i+=s.get(n,e)*s.get(r,e);i=(o.get(r,n)-i)/s.get(n,n),s.set(r,n,i),t+=i*i}for(t=o.get(r,r)-t,a&=t>0,s.set(r,r,Math.sqrt(Math.max(t,0))),n=r+1;n<i;n++)s.set(r,n,0)}this.L=s,this.positiveDefinite=Boolean(a)}isPositiveDefinite(){return this.positiveDefinite}solve(t){t=j.checkMatrix(t);let e=this.L,r=e.rows;if(t.rows!==r)throw new Error("Matrix dimensions do not match");if(!1===this.isPositiveDefinite())throw new Error("Matrix is not positive definite");let n,o,i,s=t.columns,a=t.clone();for(i=0;i<r;i++)for(o=0;o<s;o++){for(n=0;n<i;n++)a.set(i,o,a.get(i,o)-a.get(n,o)*e.get(i,n));a.set(i,o,a.get(i,o)/e.get(i,i))}for(i=r-1;i>=0;i--)for(o=0;o<s;o++){for(n=i+1;n<r;n++)a.set(i,o,a.get(i,o)-a.get(n,o)*e.get(n,i));a.set(i,o,a.get(i,o)/e.get(i,i))}return a}get lowerTriangularMatrix(){return this.L}}class F{constructor(t,e={}){t=j.checkMatrix(t);let{Y:r}=e;const{scaleScores:o=!1,maxIterations:i=1e3,terminationCriteria:s=1e-10}=e;let a;if(r){if(r=n.isAnyArray(r)&&"number"==typeof r[0]?E.columnVector(r):j.checkMatrix(r),r.rows!==t.rows)throw new Error("Y should have the same number of rows as X");a=r.getColumnVector(0)}else a=t.getColumnVector(0);let u,h,d,c,l=1;for(let e=0;e<i&&l>s;e++)d=t.transpose().mmul(a).div(a.transpose().mmul(a).get(0,0)),d=d.div(d.norm()),u=t.mmul(d).div(d.transpose().mmul(d).get(0,0)),e>0&&(l=u.clone().sub(c).pow(2).sum()),c=u.clone(),r?(h=r.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),h=h.div(h.norm()),a=r.mmul(h).div(h.transpose().mmul(h).get(0,0))):a=u;if(r){let e=t.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0));e=e.div(e.norm());let n=t.clone().sub(u.clone().mmul(e.transpose())),o=a.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),i=r.clone().sub(u.clone().mulS(o.get(0,0)).mmul(h.transpose()));this.t=u,this.p=e.transpose(),this.w=d.transpose(),this.q=h,this.u=a,this.s=u.transpose().mmul(u),this.xResidual=n,this.yResidual=i,this.betas=o}else this.w=d.transpose(),this.s=u.transpose().mmul(u).sqrt(),this.t=o?u.clone().div(this.s.get(0,0)):u,this.xResidual=t.sub(u.mmul(d.transpose()))}}e.y3=x,e.jy=L,e.oN=L,e.Hc=M,e.cg=P,e.hj=P,e.LU=S,e.Tb=S,e.uq=E,e.Zm=class extends _{constructor(t,e){p(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,r){return this.matrix.set(t,this.columnIndices[e],r),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}},e.Dq=class extends _{constructor(t,e){c(t,e),super(t,t.rows,1),this.column=e}set(t,e,r){return this.matrix.set(t,this.column,r),this}get(t){return this.matrix.get(t,this.column)}},e.__=class extends _{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(t,this.columns-e-1,r),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}},e.q0=class extends _{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(this.rows-t-1,e,r),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}},e.lh=class extends _{constructor(t,e){g(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,r){return this.matrix.set(this.rowIndices[t],e,r),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}},e.pI=class extends _{constructor(t,e){d(t,e),super(t,1,t.columns),this.row=e}set(t,e,r){return this.matrix.set(this.row,e,r),this}get(t,e){return this.matrix.get(this.row,e)}},e.zC=k,e.zg=class extends _{constructor(t,e,r,n,o){v(t,e,r,n,o),super(t,r-e+1,o-n+1),this.startRow=e,this.startColumn=n}set(t,e,r){return this.matrix.set(this.startRow+t,this.startColumn+e,r),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}},e.g6=class extends _{constructor(t){super(t,t.columns,t.rows)}set(t,e,r){return this.matrix.set(e,t,r),this}get(t,e){return this.matrix.get(e,t)}},e.OL=F,e.ks=F,e.QR=z,e.jp=z,e.mk=R,e.W2=R,e.l=N,e.KY=A,e.dv=j,e.BR=function(t,e=t,r={}){t=new E(t);let o=!1;if("object"!=typeof e||E.isMatrix(e)||n.isAnyArray(e)?e=new E(e):(r=e,e=t,o=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0,scale:s=!0}=r;i&&(t.center("column"),o||e.center("column")),s&&(t.scale("column"),o||e.scale("column"));const a=t.standardDeviation("column",{unbiased:!0}),u=o?a:e.standardDeviation("column",{unbiased:!0}),h=t.transpose().mmul(e);for(let e=0;e<h.rows;e++)for(let r=0;r<h.columns;r++)h.set(e,r,h.get(e,r)*(1/(a[e]*u[r]))*(1/(t.rows-1)));return h},e.Wu=function(t,e=t,r={}){t=new E(t);let o=!1;if("object"!=typeof e||E.isMatrix(e)||n.isAnyArray(e)?e=new E(e):(r=e,e=t,o=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0}=r;i&&(t=t.center("column"),o||(e=e.center("column")));const s=t.transpose().mmul(e);for(let e=0;e<s.rows;e++)for(let r=0;r<s.columns;r++)s.set(e,r,s.get(e,r)*(1/(t.rows-1)));return s},e.a4=function t(e){if((e=E.checkMatrix(e)).isSquare()){if(0===e.columns)return 1;let r,n,o,i;if(2===e.columns)return r=e.get(0,0),n=e.get(0,1),o=e.get(1,0),i=e.get(1,1),r*i-n*o;if(3===e.columns){let i,s,a;return i=new k(e,[1,2],[1,2]),s=new k(e,[1,2],[0,2]),a=new k(e,[1,2],[0,1]),r=e.get(0,0),n=e.get(0,1),o=e.get(0,2),r*t(i)-n*t(s)+o*t(a)}return new S(e).determinant}throw Error("determinant can only be calculated for a square matrix")},e.DI=function(t,e=!1){return t=j.checkMatrix(t),e?new R(t).inverse():I(t,E.eye(t.rows))},e.Jo=function(t,e={}){const{thresholdValue:r=1e-9,thresholdError:n=1e-9}=e;let o=(t=E.checkMatrix(t)).rows,i=new E(o,o);for(let e=0;e<o;e++){let s=E.columnVector(t.getRow(e)),a=t.subMatrixRow(C(o,e)).transpose(),u=new R(a).solve(s),h=E.sub(s,a.mmul(u)).abs().max();i.setRow(e,D(h,u,e,r,n))}return i},e.Zi=function(t,e=Number.EPSILON){if((t=E.checkMatrix(t)).isEmpty())return t.transpose();let r=new R(t,{autoTranspose:!0}),n=r.leftSingularVectors,o=r.rightSingularVectors,i=r.diagonal;for(let t=0;t<i.length;t++)Math.abs(i[t])>e?i[t]=1/i[t]:i[t]=0;return o.mmul(E.diag(i).mmul(n.transpose()))},e.kH=I,e.LV=function(t,e){if(n.isAnyArray(t))return t[0]&&n.isAnyArray(t[0])?new j(t):new A(t,e);throw new Error("the argument is not an array")}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={id:n,loaded:!1,exports:{}};return t[n](i,i.exports,r),i.loaded=!0,i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var n={};(()=>{"use strict";function t(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}r.d(n,{calculateLayout:()=>Pn,stopLayout:()=>Dn}),Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;const e=function(){function t(){this._events={}}return t.prototype.on=function(t,e,r){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!r}),this},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.emit=function(t){for(var e=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=this._events[t]||[],i=this._events["*"]||[],s=function(n){for(var o=n.length,i=0;i<o;i++)if(n[i]){var s=n[i],a=s.callback;s.once&&(n.splice(i,1),0===n.length&&delete e._events[t],o--,i--),a.apply(e,r)}};s(o),s(i)},t.prototype.off=function(t,e){if(t)if(e){for(var r=this._events[t]||[],n=r.length,o=0;o<n;o++)r[o].callback===e&&(r.splice(o,1),n--,o--);0===r.length&&delete this._events[t]}else delete this._events[t];else this._events={};return this},t.prototype.getEvents=function(){return this._events},t}();function o(t,e,r,n){for(;t.length;){const o=t.shift();if(r(o))return!0;e.add(o.id),n(o.id).forEach((r=>{e.has(r.id)||(e.add(r.id),t.push(r))}))}return!1}function i(t,e,r,n){if(r(t))return!0;e.add(t.id);for(const o of n(t.id))if(!e.has(o.id)&&i(o,e,r,n))return!0;return!1}const s=()=>!0;class a{graph;nodeFilter;edgeFilter;cacheEnabled;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;allNodesMap=new Map;allEdgesMap=new Map;constructor(t){this.graph=t.graph;const e=t.nodeFilter||s,r=t.edgeFilter||s;this.nodeFilter=e,this.edgeFilter=t=>{const{source:n,target:o}=this.graph.getEdgeDetail(t.id);return!(!e(n)||!e(o))&&r(t,n,o)},"auto"===t.cache?(this.cacheEnabled=!0,this.startAutoCache()):"manual"===t.cache?this.cacheEnabled=!0:this.cacheEnabled=!1}clearCache=()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()};refreshCache=()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map((t=>t.id)))};updateCache=t=>{const e=new Set;t.forEach((t=>{const r=this.bothEdgesMap.get(t);if(r&&r.forEach((t=>e.add(t.id))),this.hasNode(t)){const r=this.graph.getRelatedEdges(t,"in").filter(this.edgeFilter),n=this.graph.getRelatedEdges(t,"out").filter(this.edgeFilter),o=Array.from(new Set([...r,...n]));o.forEach((t=>e.add(t.id))),this.inEdgesMap.set(t,r),this.outEdgesMap.set(t,n),this.bothEdgesMap.set(t,o),this.allNodesMap.set(t,this.graph.getNode(t))}else this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.bothEdgesMap.delete(t),this.allNodesMap.delete(t)})),e.forEach((t=>{this.hasEdge(t)?this.allEdgesMap.set(t,this.graph.getEdge(t)):this.allEdgesMap.delete(t)}))};startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}handleGraphChanged=t=>{const e=new Set;t.changes.forEach((r=>{switch(r.type){case"NodeAdded":case"NodeRemoved":e.add(r.value.id);break;case"NodeDataUpdated":e.add(r.id);break;case"EdgeAdded":case"EdgeRemoved":e.add(r.value.source),e.add(r.value.target);break;case"EdgeUpdated":"source"!==r.propertyName&&"target"!==r.propertyName||(e.add(r.oldValue),e.add(r.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(r.id)){const n=t.graph.getEdge(r.id);e.add(n.source),e.add(n.target)}}})),this.updateCache(e)};checkNodeExistence(t){this.getNode(t)}hasNode(t){if(!this.graph.hasNode(t))return!1;const e=this.graph.getNode(t);return this.nodeFilter(e)}areNeighbors(t,e){return this.checkNodeExistence(t),this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.graph.getNode(t);if(!this.nodeFilter(e))throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){return this.checkNodeExistence(t),this.cacheEnabled?"in"===e?this.inEdgesMap.get(t):"out"===e?this.outEdgesMap.get(t):this.bothEdgesMap.get(t):this.graph.getRelatedEdges(t,e).filter(this.edgeFilter)}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}hasEdge(t){if(!this.graph.hasEdge(t))return!1;const e=this.graph.getEdge(t);return this.edgeFilter(e)}getEdge(t){const e=this.graph.getEdge(t);if(!this.edgeFilter(e))throw new Error("Edge not found for id: "+t);return e}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}hasTreeStructure(t){return this.graph.hasTreeStructure(t)}getRoots(t){return this.graph.getRoots(t).filter(this.nodeFilter)}getChildren(t,e){return this.checkNodeExistence(t),this.graph.getChildren(t,e).filter(this.nodeFilter)}getParent(t,e){this.checkNodeExistence(t);const r=this.graph.getParent(t,e);return r&&this.nodeFilter(r)?r:null}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];o([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];i(this.getNode(t),new Set,e,n)}}class u extends e{nodeMap=new Map;edgeMap=new Map;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;treeIndices=new Map;changes=[];batchCount=0;onChanged=()=>{};constructor(t){super(),t&&(t.nodes&&this.addNodes(t.nodes),t.edges&&this.addEdges(t.edges),t.tree&&this.addTree(t.tree),t.onChanged&&(this.onChanged=t.onChanged))}batch=t=>{this.batchCount+=1,t(),this.batchCount-=1,this.batchCount||this.commit()};commit(){const t=this.changes;this.changes=[];const e={graph:this,changes:t};this.emit("changed",e),this.onChanged(e)}reduceChanges(t){let e=[];return t.forEach((t=>{switch(t.type){case"NodeRemoved":{let r=!1;e=e.filter((e=>{if("NodeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"NodeDataUpdated"===e.type?e.id!==t.value.id:"TreeStructureChanged"!==e.type||e.nodeId!==t.value.id})),r||e.push(t);break}case"EdgeRemoved":{let r=!1;e=e.filter((e=>{if("EdgeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"EdgeDataUpdated"!==e.type&&"EdgeUpdated"!==e.type||e.id!==t.value.id})),r||e.push(t);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const r=e.findIndex((e=>e.type===t.type&&e.id===t.id&&(void 0===t.propertyName||e.propertyName===t.propertyName))),n=e[r];n?void 0!==t.propertyName?n.newValue=t.newValue:(e.splice(r,1),e.push(t)):e.push(t);break}case"TreeStructureDetached":e=e.filter((e=>"TreeStructureAttached"===e.type?e.treeKey!==t.treeKey:"TreeStructureChanged"!==e.type||e.treeKey!==t.treeKey)),e.push(t);break;case"TreeStructureChanged":{const r=e.find((e=>"TreeStructureChanged"===e.type&&e.treeKey===t.treeKey&&e.nodeId===t.nodeId));r?r.newParentId=t.newParentId:e.push(t);break}default:e.push(t)}})),e}checkNodeExistence(t){this.getNode(t)}hasNode(t){return this.nodeMap.has(t)}areNeighbors(t,e){return this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.nodeMap.get(t);if(!e)throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),"in"===e){const e=this.inEdgesMap.get(t);return Array.from(e)}if("out"===e){const e=this.outEdgesMap.get(t);return Array.from(e)}{const e=this.bothEdgesMap.get(t);return Array.from(e)}}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}doAddNode(t){if(this.hasNode(t.id))throw new Error("Node already exists: "+t.id);this.nodeMap.set(t.id,t),this.inEdgesMap.set(t.id,new Set),this.outEdgesMap.set(t.id,new Set),this.bothEdgesMap.set(t.id,new Set),this.treeIndices.forEach((e=>{e.childrenMap.set(t.id,new Set)})),this.changes.push({type:"NodeAdded",value:t})}addNodes(t){this.batch((()=>{for(const e of t)this.doAddNode(e)}))}addNode(t){this.addNodes([t])}doRemoveNode(t){const e=this.getNode(t),r=this.bothEdgesMap.get(t);r?.forEach((t=>this.doRemoveEdge(t.id))),this.nodeMap.delete(t),this.treeIndices.forEach((e=>{e.childrenMap.get(t)?.forEach((t=>{e.parentMap.delete(t.id)})),e.parentMap.delete(t),e.childrenMap.delete(t)})),this.changes.push({type:"NodeRemoved",value:e})}removeNodes(t){this.batch((()=>{t.forEach((t=>this.doRemoveNode(t)))}))}removeNode(t){this.removeNodes([t])}updateNodeDataProperty(t,e,r){const n=this.getNode(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"NodeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}mergeNodeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateNodeDataProperty(t,e,r)}))}))}updateNodeData(...t){const e=t[0],r=this.getNode(e);if("string"==typeof t[1])return void this.updateNodeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"NodeDataUpdated",id:e,oldValue:t,newValue:o})}))}checkEdgeExistence(t){if(!this.hasEdge(t))throw new Error("Edge not found for id: "+t)}hasEdge(t){return this.edgeMap.has(t)}getEdge(t){return this.checkEdgeExistence(t),this.edgeMap.get(t)}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}doAddEdge(t){if(this.hasEdge(t.id))throw new Error("Edge already exists: "+t.id);this.checkNodeExistence(t.source),this.checkNodeExistence(t.target),this.edgeMap.set(t.id,t);const e=this.inEdgesMap.get(t.target),r=this.outEdgesMap.get(t.source),n=this.bothEdgesMap.get(t.source),o=this.bothEdgesMap.get(t.target);e.add(t),r.add(t),n.add(t),o.add(t),this.changes.push({type:"EdgeAdded",value:t})}addEdges(t){this.batch((()=>{for(const e of t)this.doAddEdge(e)}))}addEdge(t){this.addEdges([t])}doRemoveEdge(t){const e=this.getEdge(t),r=this.outEdgesMap.get(e.source),n=this.inEdgesMap.get(e.target),o=this.bothEdgesMap.get(e.source),i=this.bothEdgesMap.get(e.target);r.delete(e),n.delete(e),o.delete(e),i.delete(e),this.edgeMap.delete(t),this.changes.push({type:"EdgeRemoved",value:e})}removeEdges(t){this.batch((()=>{t.forEach((t=>this.doRemoveEdge(t)))}))}removeEdge(t){this.removeEdges([t])}updateEdgeSource(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.source,o=e;this.outEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.outEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.source=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"source",oldValue:n,newValue:o})}))}updateEdgeTarget(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.target,o=e;this.inEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.inEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.target=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"target",oldValue:n,newValue:o})}))}updateEdgeDataProperty(t,e,r){const n=this.getEdge(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"EdgeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}updateEdgeData(...t){const e=t[0],r=this.getEdge(e);if("string"==typeof t[1])return void this.updateEdgeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"EdgeDataUpdated",id:e,oldValue:t,newValue:o})}))}mergeEdgeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateEdgeDataProperty(t,e,r)}))}))}checkTreeExistence(t){if(!this.hasTreeStructure(t))throw new Error("Tree structure not found for treeKey: "+t)}hasTreeStructure(t){return this.treeIndices.has(t)}attachTreeStructure(t){this.treeIndices.has(t)||(this.treeIndices.set(t,{parentMap:new Map,childrenMap:new Map}),this.batch((()=>{this.changes.push({type:"TreeStructureAttached",treeKey:t})})))}detachTreeStructure(t){this.checkTreeExistence(t),this.treeIndices.delete(t),this.batch((()=>{this.changes.push({type:"TreeStructureDetached",treeKey:t})}))}addTree(t,e){this.batch((()=>{this.attachTreeStructure(e);const r=[],n=Array.isArray(t)?t:[t];for(;n.length;){const t=n.shift();r.push(t),t.children&&n.push(...t.children)}this.addNodes(r),r.forEach((t=>{t.children?.forEach((r=>{this.setParent(r.id,t.id,e)}))}))}))}getRoots(t){return this.checkTreeExistence(t),this.getAllNodes().filter((e=>!this.getParent(e.id,t)))}getChildren(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);const r=this.treeIndices.get(e).childrenMap.get(t);return Array.from(r||[])}getParent(t,e){return this.checkNodeExistence(t),this.checkTreeExistence(e),this.treeIndices.get(e).parentMap.get(t)||null}getAncestors(t,e){const r=[];let n,o=this.getNode(t);for(;n=this.getParent(o.id,e);)r.push(n),o=n;return r}setParent(t,e,r){this.checkTreeExistence(r);const n=this.treeIndices.get(r),o=this.getNode(t),i=n.parentMap.get(t);if(i?.id===e)return;if(void 0===e)return i&&n.childrenMap.get(i.id)?.delete(o),void n.parentMap.delete(t);const s=this.getNode(e);n.parentMap.set(t,s),i&&n.childrenMap.get(i.id)?.delete(o);let a=n.childrenMap.get(s.id);a||(a=new Set,n.childrenMap.set(s.id,a)),a.add(o),this.batch((()=>{this.changes.push({type:"TreeStructureChanged",treeKey:r,nodeId:t,oldParentId:i?.id,newParentId:s.id})}))}dfsTree(t,e,r){return i(this.getNode(t),new Set,e,(t=>this.getChildren(t,r)))}bfsTree(t,e,r){return o([this.getNode(t)],new Set,e,(t=>this.getChildren(t,r)))}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return o([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return i(this.getNode(t),new Set,e,n)}clone(){const t=this.getAllNodes().map((t=>({...t,data:{...t.data}}))),e=this.getAllEdges().map((t=>({...t,data:{...t.data}}))),r=new u({nodes:t,edges:e});return this.treeIndices.forEach((({parentMap:t,childrenMap:e},n)=>{const o=new Map;t.forEach(((t,e)=>{o.set(e,r.getNode(t.id))}));const i=new Map;e.forEach(((t,e)=>{i.set(e,new Set(Array.from(t).map((t=>r.getNode(t.id)))))})),r.treeIndices.set(n,{parentMap:o,childrenMap:i})})),r}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(t){return new a({graph:this,...t})}}var h={}.toString;const d=function(t,e){return h.call(t)==="[object "+e+"]"},c=function(t){return d(t,"Number")},l=(t,e)=>{if("next"!==t&&"prev"!==t)return e},f=t=>{t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev};class g{constructor(){const t={};t.prev=t,t.next=t.prev,this.shortcut=t}dequeue(){const t=this.shortcut,e=t.prev;if(e&&e!==t)return f(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&f(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e}toString(){const t=[],e=this.shortcut;let r=e.prev;for(;r!==e;)t.push(JSON.stringify(r,l)),r=null==r?void 0:r.prev;return`[${t.join(", ")}]`}}class p extends g{}const v=()=>1,m=(t,e,r,n,o)=>{var i,s;const a=[];return t.hasNode(n.v)&&(null===(i=t.getRelatedEdges(n.v,"in"))||void 0===i||i.forEach((n=>{const i=n.data.weight,s=t.getNode(n.source);o&&a.push({v:n.source,w:n.target,in:0,out:0}),void 0===s.data.out&&(s.data.out=0),s.data.out-=i,y(e,r,Object.assign({v:s.id},s.data))})),null===(s=t.getRelatedEdges(n.v,"out"))||void 0===s||s.forEach((n=>{const o=n.data.weight,i=n.target,s=t.getNode(i);void 0===s.data.in&&(s.data.in=0),s.data.in-=o,y(e,r,Object.assign({v:s.id},s.data))})),t.removeNode(n.v)),o?a:void 0},y=(t,e,r)=>{r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)},w=(t,e)=>{const r="greedy"===e?((t,e)=>{var r;if(t.getAllNodes().length<=1)return[];const n=((t,e)=>{const r=new u;let n=0,o=0;t.getAllNodes().forEach((t=>{r.addNode({id:t.id,data:{v:t.id,in:0,out:0}})})),t.getAllEdges().forEach((t=>{const i=r.getRelatedEdges(t.source,"out").find((e=>e.target===t.target)),s=(null==e?void 0:e(t))||1;i?r.updateEdgeData(null==i?void 0:i.id,Object.assign(Object.assign({},i.data),{weight:i.data.weight+s})):r.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:s}}),o=Math.max(o,r.getNode(t.source).data.out+=s),n=Math.max(n,r.getNode(t.target).data.in+=s)}));const i=[],s=o+n+3;for(let t=0;t<s;t++)i.push(new p);const a=n+1;return r.getAllNodes().forEach((t=>{y(i,a,Object.assign({v:t.id},r.getNode(t.id).data))})),{buckets:i,zeroIdx:a,graph:r}})(t,(t=>t.data.weight||1)||v);return null===(r=((t,e,r)=>{let n=[];const o=e[e.length-1],i=e[0];let s;for(;t.getAllNodes().length;){for(;s=i.dequeue();)m(t,e,r,s);for(;s=o.dequeue();)m(t,e,r,s);if(t.getAllNodes().length)for(let o=e.length-2;o>0;--o)if(s=e[o].dequeue(),s){n=n.concat(m(t,e,r,s,!0));break}}return n})(n.graph,n.buckets,n.zeroIdx).map((e=>t.getRelatedEdges(e.v,"out").filter((({target:t})=>t===e.w)))))||void 0===r?void 0:r.flat()})(t):x(t);null==r||r.forEach((e=>{const r=e.data;t.removeEdge(e.id),r.forwardName=e.data.name,r.reversed=!0,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign({},r)})}))},x=t=>{const e=[],r={},n={},o=i=>{n[i]||(n[i]=!0,r[i]=!0,t.getRelatedEdges(i,"out").forEach((t=>{r[t.target]?e.push(t):o(t.target)})),delete r[i])};return t.getAllNodes().forEach((t=>o(t.id))),e},b=(t,e,r,n)=>{let o;do{o=`${n}${Math.random()}`}while(t.hasNode(o));return r.dummy=e,t.addNode({id:o,data:r}),o},E=t=>{const e=new u;return t.getAllNodes().forEach((r=>{t.getChildren(r.id).length||e.addNode(Object.assign({},r))})),t.getAllEdges().forEach((t=>{e.addEdge(t)})),e},N=(t,e)=>{const r=Number(t.x),n=Number(t.y),o=Number(e.x)-r,i=Number(e.y)-n;let s,a,u=Number(t.width)/2,h=Number(t.height)/2;return o||i?(Math.abs(i)*u>Math.abs(o)*h?(i<0&&(h=-h),s=h*o/i,a=h):(o<0&&(u=-u),s=u,a=u*i/o),{x:r+s,y:n+a}):{x:0,y:0}},M=t=>{const e=[],r=k(t)+1;for(let t=0;t<r;t++)e.push([]);t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&e[r]&&e[r].push(t.id)}));for(let n=0;n<r;n++)e[n]=e[n].sort(((e,r)=>{return n=t.getNode(e).data.order,o=t.getNode(r).data.order,Number(n)-Number(o);var n,o}));return e},_=(t,e,r,n)=>{const o={width:0,height:0};return c(r)&&c(n)&&(o.rank=r,o.order=n),b(t,"border",o,e)},k=t=>{let e;return t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&(void 0===e||r>e)&&(e=r)})),e||(e=0),e},A=(t,e)=>t.reduce(((t,r)=>e(t)>e(r)?r:t)),j=(t,e,r,n,o,i)=>{n.includes(e.id)||(n.push(e.id),r||i.push(e.id),o(e.id).forEach((e=>j(t,e,r,n,o,i))),r&&i.push(e.id))},S=(t,e,r,n)=>{const o=Array.isArray(e)?e:[e],i=e=>n?t.getSuccessors(e):t.getNeighbors(e),s=[],a=[];return o.forEach((e=>{if(!t.hasNode(e.id))throw new Error(`Graph does not have node: ${e}`);j(t,e,"post"===r,a,i,s)})),s},O=(t,e,r,n,o,i)=>{const s={rank:i,borderType:e,width:0,height:0},a=o.data[e][i-1],u=b(t,"border",s,r);o.data[e][i]=u,t.setParent(u,n),a&&t.addEdge({id:`e${Math.random()}`,source:a,target:u,data:{weight:1}})},z=t=>{t.getAllNodes().forEach((t=>{R(t)})),t.getAllEdges().forEach((t=>{R(t)}))},R=t=>{const e=t.data.width;t.data.width=t.data.height,t.data.height=e},I=t=>{(null==t?void 0:t.y)&&(t.y=-t.y)},C=t=>{const e=t.x;t.x=t.y,t.y=e},D=(t,e,r,n,o,i,s)=>{const a=t.getChildren(s);if(!(null==a?void 0:a.length))return void(s!==e&&t.addEdge({id:`e${Math.random()}`,source:e,target:s,data:{weight:0,minlen:r}}));const u=_(t,"_bt"),h=_(t,"_bb"),d=t.getNode(s);t.setParent(u,s),d.data.borderTop=u,t.setParent(h,s),d.data.borderBottom=h,null==a||a.forEach((a=>{D(t,e,r,n,o,i,a.id);const d=a.data.borderTop?a.data.borderTop:a.id,c=a.data.borderBottom?a.data.borderBottom:a.id,l=a.data.borderTop?n:2*n,f=d!==c?1:o-i[s]+1;t.addEdge({id:`e${Math.random()}`,source:u,target:d,data:{minlen:f,weight:l,nestingEdge:!0}}),t.addEdge({id:`e${Math.random()}`,source:c,target:h,data:{minlen:f,weight:l,nestingEdge:!0}})})),t.getParent(s)||t.addEdge({id:`e${Math.random()}`,source:e,target:u,data:{weight:0,minlen:o+i[s]}})},P="edge-label",T=function(t){return Array.isArray?Array.isArray(t):d(t,"Array")};var L=function(t){if("object"!=typeof t||null===t)return t;var e;if(T(t)){e=[];for(var r=0,n=t.length;r<n;r++)"object"==typeof t[r]&&null!=t[r]?e[r]=L(t[r]):e[r]=t[r]}else for(var o in e={},t)"object"==typeof t[o]&&null!=t[o]?e[o]=L(t[o]):e[o]=t[o];return e};const F=L,q=(t,e,r)=>{const n=(s=r,a=r.map(((t,e)=>e)),null==s?void 0:s.reduce(((t,e,r)=>(t[e]=a[r],t)),{})),o=e.map((e=>{const r=t.getRelatedEdges(e,"out").map((t=>({pos:n[t.target]||0,weight:t.data.weight})));return null==r?void 0:r.sort(((t,e)=>t.pos-e.pos))})),i=o.flat().filter((t=>void 0!==t));var s,a;let u=1;for(;u<r.length;)u<<=1;const h=2*u-1;u-=1;const d=Array(h).fill(0,0,h);let c=0;return null==i||i.forEach((t=>{if(t){let e=t.pos+u;d[e]+=t.weight;let r=0;for(;e>0;)e%2&&(r+=d[e+1]),e=e-1>>1,d[e]+=t.weight;c+=t.weight*r}})),c},V=(t,e)=>{let r=0;for(let n=1;n<(null==e?void 0:e.length);n+=1)r+=q(t,e[n-1],e[n]);return r},B=t=>{const e={},r=t.getAllNodes(),n=r.map((t=>{var e;return null!==(e=t.data.rank)&&void 0!==e?e:-1/0})),o=Math.max(...n),i=[];for(let t=0;t<o+1;t++)i.push([]);const s=r.sort(((e,r)=>t.getNode(e.id).data.rank-t.getNode(r.id).data.rank)),a=s.filter((e=>void 0!==t.getNode(e.id).data.fixorder)).sort(((e,r)=>t.getNode(e.id).data.fixorder-t.getNode(r.id).data.fixorder));return null==a||a.forEach((r=>{isNaN(t.getNode(r.id).data.rank)||i[t.getNode(r.id).data.rank].push(r.id),e[r.id]=!0})),null==s||s.forEach((r=>t.dfsTree(r.id,(t=>{if(e.hasOwnProperty(t.id))return!0;e[t.id]=!0,isNaN(t.data.rank)||i[t.data.rank].push(t.id)})))),i},$=(t,e)=>{var r;let n=0,o=0;t.weight&&(n+=t.barycenter*t.weight,o+=t.weight),e.weight&&(n+=e.barycenter*e.weight,o+=e.weight),t.vs=null===(r=e.vs)||void 0===r?void 0:r.concat(t.vs),t.barycenter=n/o,t.weight=o,t.i=Math.min(e.i,t.i),e.merged=!0},U=(t,e)=>{var r,n,o;const i={};null==t||t.forEach(((t,e)=>{i[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};const r=i[t.v];void 0!==t.barycenter&&(r.barycenter=t.barycenter,r.weight=t.weight)})),null===(r=e.getAllEdges())||void 0===r||r.forEach((t=>{const e=i[t.source],r=i[t.target];void 0!==e&&void 0!==r&&(r.indegree++,e.out.push(i[t.target]))}));return(t=>{var e,r;const n=[];for(;null==t?void 0:t.length;){const o=t.pop();n.push(o),null===(e=o.in.reverse())||void 0===e||e.forEach((t=>{return(e=o,t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&$(e,t)})(t);var e})),null===(r=o.out)||void 0===r||r.forEach((e=>{return(r=o,e=>{e.in.push(r),0==--e.indegree&&t.push(e)})(e);var r}))}const o=n.filter((t=>!t.merged)),i=["vs","i","barycenter","weight"];return o.map((t=>{const e={};return null==i||i.forEach((r=>{void 0!==t[r]&&(e[r]=t[r])})),e}))})(null===(o=(n=Object.values(i)).filter)||void 0===o?void 0:o.call(n,(t=>!t.indegree)))},G=(t,e,r)=>{let n,o=r;for(;e.length&&(n=e[e.length-1]).i<=o;)e.pop(),null==t||t.push(n.vs),o++;return o},W=(t,e,r,n,o,i)=>{var s,a,u,h;let d=t.getChildren(e).map((t=>t.id));const c=t.getNode(e),l=c?c.data.borderLeft:void 0,f=c?c.data.borderRight:void 0,g={};l&&(d=null==d?void 0:d.filter((t=>t!==l&&t!==f)));const p=((t,e)=>e.map((e=>{const r=t.getRelatedEdges(e,"in");if(!(null==r?void 0:r.length))return{v:e};const n={sum:0,weight:0};return null==r||r.forEach((e=>{const r=t.getNode(e.source);n.sum+=e.data.weight*r.data.order,n.weight+=e.data.weight})),{v:e,barycenter:n.sum/n.weight,weight:n.weight}})))(t,d||[]);null==p||p.forEach((e=>{var o;if(null===(o=t.getChildren(e.v))||void 0===o?void 0:o.length){const o=W(t,e.v,r,n,i);g[e.v]=o,o.hasOwnProperty("barycenter")&&H(e,o)}}));const v=U(p,r);Y(v,g),null===(s=v.filter((t=>t.vs.length>0)))||void 0===s||s.forEach((e=>{const r=t.getNode(e.vs[0]);r&&(e.fixorder=r.data.fixorder,e.order=r.data.order)}));const m=((t,e,r,n)=>{const o=((t,e)=>{const r={lhs:[],rhs:[]};return null==t||t.forEach((t=>{(t=>{const e=t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder);return n?!e&&t.hasOwnProperty("barycenter"):e||t.hasOwnProperty("barycenter")})(t)?r.lhs.push(t):r.rhs.push(t)})),r})(t),i=o.lhs,s=o.rhs.sort(((t,e)=>-t.i- -e.i)),a=[];let u=0,h=0,d=0;null==i||i.sort(((t,e)=>(r,n)=>{if(void 0!==r.fixorder&&void 0!==n.fixorder)return r.fixorder-n.fixorder;if(r.barycenter<n.barycenter)return-1;if(r.barycenter>n.barycenter)return 1;if(e&&void 0!==r.order&&void 0!==n.order){if(r.order<n.order)return-1;if(r.order>n.order)return 1}return t?n.i-r.i:r.i-n.i})(!!e,!!r)),d=G(a,s,d),null==i||i.forEach((t=>{var e;d+=null===(e=t.vs)||void 0===e?void 0:e.length,a.push(t.vs),u+=t.barycenter*t.weight,h+=t.weight,d=G(a,s,d)}));const c={vs:a.flat()};return h&&(c.barycenter=u/h,c.weight=h),c})(v,n,o,i);if(l&&(m.vs=[l,m.vs,f].flat(),null===(a=t.getPredecessors(l))||void 0===a?void 0:a.length)){const e=t.getNode((null===(u=t.getPredecessors(l))||void 0===u?void 0:u[0].id)||""),r=t.getNode((null===(h=t.getPredecessors(f))||void 0===h?void 0:h[0].id)||"");m.hasOwnProperty("barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+e.data.order+r.data.order)/(m.weight+2),m.weight+=2}return m},Y=(t,e)=>{null==t||t.forEach((t=>{var r;const n=null===(r=t.vs)||void 0===r?void 0:r.map((t=>e[t]?e[t].vs:t));t.vs=n.flat()}))},H=(t,e)=>{void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)},K=(t,e,r)=>e.map((e=>((t,e,r)=>{const n=(t=>{let e;for(;t.hasNode(e=`_root${Math.random()}`););return e})(t),o=new u({tree:[{id:n,children:[],data:{}}]});return t.getAllNodes().forEach((i=>{const s=t.getParent(i.id);(i.data.rank===e||i.data.minRank<=e&&e<=i.data.maxRank)&&(o.hasNode(i.id)||o.addNode(Object.assign({},i)),(null==s?void 0:s.id)&&!o.hasNode(null==s?void 0:s.id)&&o.addNode(Object.assign({},s)),o.setParent(i.id,(null==s?void 0:s.id)||n),t.getRelatedEdges(i.id,r).forEach((e=>{const r=e.source===i.id?e.target:e.source;o.hasNode(r)||o.addNode(Object.assign({},t.getNode(r)));const n=o.getRelatedEdges(r,"out").find((({target:t})=>t===i.id)),s=void 0!==n?n.data.weight:0;n?o.updateEdgeData(n.id,Object.assign(Object.assign({},n.data),{weight:e.data.weight+s})):o.addEdge({id:e.id,source:r,target:i.id,data:{weight:e.data.weight+s}})})),i.data.hasOwnProperty("minRank")&&o.updateNodeData(i.id,Object.assign(Object.assign({},i.data),{borderLeft:i.data.borderLeft[e],borderRight:i.data.borderRight[e]})))})),o})(t,e,r))),J=(t,e,r,n)=>{const o=new u;null==t||t.forEach((t=>{var i;const s=t.getRoots()[0].id,a=W(t,s,o,e,r,n);for(let e=0;e<(null===(i=a.vs)||void 0===i?void 0:i.length);e++){const r=t.getNode(a.vs[e]);r&&(r.data.order=e)}((t,e,r)=>{const n={};let o;null==r||r.forEach((r=>{let i,s,a=t.getParent(r);for(;a;){if(i=t.getParent(a.id),i?(s=n[i.id],n[i.id]=a.id):(s=o,o=a.id),s&&s!==a.id)return e.hasNode(s)||e.addNode({id:s,data:{}}),e.hasNode(a.id)||e.addNode({id:a.id,data:{}}),void(e.hasEdge(`e${s}-${a.id}`)||e.addEdge({id:`e${s}-${a.id}`,source:s,target:a.id,data:{}}));a=i}}))})(t,o,a.vs)}))},Q=(t,e)=>{null==e||e.forEach((e=>{null==e||e.forEach(((e,r)=>{t.getNode(e).data.order=r}))}))},X=(t,e)=>{var r,n;if(null===(r=t.getNode(e))||void 0===r?void 0:r.data.dummy)return null===(n=t.getPredecessors(e))||void 0===n?void 0:n.find((e=>t.getNode(e.id).data.dummy))},Z=(t,e,r)=>{let n=e,o=r;if(n>o){const t=n;n=o,o=t}let i=t[n];i||(t[n]=i={}),i[o]=!0},tt=(t,e,r)=>{let n=e,o=r;return n>r&&(n=r,o=e),!!t[n]},et=(t,e,r,n,o,i)=>{const s=new u,a=rt(n,o,i);return null==e||e.forEach((e=>{let n;null==e||e.forEach((e=>{const o=r[e];if(s.hasNode(o)||s.addNode({id:o,data:{}}),n){const i=r[n],u=s.getRelatedEdges(i,"out").find((t=>t.target===o));u?s.updateEdgeData(u.id,Object.assign(Object.assign({},u.data),{weight:Math.max(a(t,e,n),u.data.weight||0)})):s.addEdge({id:`e${Math.random()}`,source:i,target:o,data:{weight:Math.max(a(t,e,n),0)}})}n=e}))})),s};const rt=(t,e,r)=>(n,o,i)=>{const s=n.getNode(o),a=n.getNode(i);let u=0,h=0;if(u+=s.data.width/2,s.data.hasOwnProperty("labelpos"))switch((s.data.labelpos||"").toLowerCase()){case"l":h=-s.data.width/2;break;case"r":h=s.data.width/2}if(h&&(u+=r?h:-h),h=0,u+=(s.data.dummy?e:t)/2,u+=(a.data.dummy?e:t)/2,u+=a.data.width/2,a.data.labelpos)switch((a.data.labelpos||"").toLowerCase()){case"l":h=a.data.width/2;break;case"r":h=-a.data.width/2}return h&&(u+=r?h:-h),h=0,u},nt=(t,e)=>t.getNode(e).data.width||0,ot=(t,e)=>{var r;const n=E(t);((t,e)=>{const{ranksep:r=0}=e||{},n=M(t);let o=0;null==n||n.forEach((e=>{const n=e.map((e=>t.getNode(e).data.height)),i=Math.max(...n,0);null==e||e.forEach((e=>{t.getNode(e).data.y=o+i/2})),o+=i+r}))})(n,e);const o=((t,e)=>{const{align:r,nodesep:n=0,edgesep:o=0}=e||{},i=M(t),s=Object.assign(((t,e)=>{const r={};return(null==e?void 0:e.length)&&e.reduce(((e,n)=>{let o=0,i=0;const s=e.length,a=null==n?void 0:n[(null==n?void 0:n.length)-1];return null==n||n.forEach(((e,u)=>{var h;const d=X(t,e),c=d?t.getNode(d.id).data.order:s;(d||e===a)&&(null===(h=n.slice(i,u+1))||void 0===h||h.forEach((e=>{var n;null===(n=t.getPredecessors(e))||void 0===n||n.forEach((n=>{var i;const s=t.getNode(n.id),a=s.data.order;!(a<o||c<a)||s.data.dummy&&(null===(i=t.getNode(e))||void 0===i?void 0:i.data.dummy)||Z(r,n.id,e)}))})),i=u+1,o=c)})),n})),r})(t,i),((t,e)=>{const r={};function n(e,n){const o=function(t){return JSON.stringify(t.slice(1))}(e);n.get(o)||(function(e,n,o,i,s){var a,u;let h;for(let d=n;d<o;d++)h=e[d],(null===(a=t.getNode(h))||void 0===a?void 0:a.data.dummy)&&(null===(u=t.getPredecessors(h))||void 0===u||u.forEach((e=>{const n=t.getNode(e.id);n.data.dummy&&(n.data.order<i||n.data.order>s)&&Z(r,e.id,h)})))}(...e),n.set(o,!0))}return(null==e?void 0:e.length)&&e.reduce(((e,r)=>{let o,i=-1,s=0;const a=new Map;return null==r||r.forEach(((u,h)=>{var d;if("border"===(null===(d=t.getNode(u))||void 0===d?void 0:d.data.dummy)){const e=t.getPredecessors(u)||[];e.length&&(o=t.getNode(e[0].id).data.order,n([r,s,h,i,o],a),s=h,i=o)}n([r,s,r.length,o,e.length],a)})),r})),r})(t,i)),a={};let u=[];["u","d"].forEach((e=>{u="u"===e?i:Object.values(i).reverse(),["l","r"].forEach((r=>{"r"===r&&(u=u.map((t=>Object.values(t).reverse())));const i=("u"===e?t.getPredecessors:t.getSuccessors).bind(t),h=((t,e,r,n)=>{const o={},i={},s={};return null==e||e.forEach((t=>{null==t||t.forEach(((t,e)=>{o[t]=t,i[t]=t,s[t]=e}))})),null==e||e.forEach((t=>{let e=-1;null==t||t.forEach((t=>{let a=n(t).map((t=>t.id));if(a.length){a=a.sort(((t,e)=>s[t]-s[e]));const n=(a.length-1)/2;for(let u=Math.floor(n),h=Math.ceil(n);u<=h;++u){const n=a[u];i[t]===t&&e<s[n]&&!tt(r,t,n)&&(i[n]=t,i[t]=o[t]=o[n],e=s[n])}}}))})),{root:o,align:i}})(0,u,s,i),d=((t,e,r,n,o,i,s)=>{var a;const u={},h=et(t,e,r,o,i,s),d=s?"borderLeft":"borderRight",c=(t,e)=>{let r=h.getAllNodes(),n=r.pop();const o={};for(;n;)o[n.id]?t(n.id):(o[n.id]=!0,r.push(n),r=r.concat(e(n.id))),n=r.pop()};return c((t=>{u[t]=(h.getRelatedEdges(t,"in")||[]).reduce(((t,e)=>Math.max(t,(u[e.source]||0)+e.data.weight)),0)}),h.getPredecessors.bind(h)),c((e=>{const r=(h.getRelatedEdges(e,"out")||[]).reduce(((t,e)=>Math.min(t,(u[e.target]||0)-e.data.weight)),Number.POSITIVE_INFINITY),n=t.getNode(e);r!==Number.POSITIVE_INFINITY&&n.data.borderType!==d&&(u[e]=Math.max(u[e],r))}),h.getSuccessors.bind(h)),null===(a=Object.values(n))||void 0===a||a.forEach((t=>{u[t]=u[r[t]]})),u})(t,u,h.root,h.align,n,o,"r"===r);"r"===r&&Object.keys(d).forEach((t=>d[t]=-d[t])),a[e+r]=d}))}));const h=((t,e)=>A(Object.values(e),(e=>{var r;let n=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return null===(r=Object.keys(e))||void 0===r||r.forEach((r=>{const i=e[r],s=nt(t,r)/2;n=Math.max(i+s,n),o=Math.min(i-s,o)})),n-o})))(t,a);return h&&function(t,e){const r=Object.values(e),n=Math.min(...r),o=Math.max(...r);["u","d"].forEach((r=>{["l","r"].forEach((i=>{const s=r+i,a=t[s];let u;if(a===e)return;const h=Object.values(a);u="l"===i?n-Math.min(...h):o-Math.max(...h),u&&(t[s]={},Object.keys(a).forEach((e=>{t[s][e]=a[e]+u})))}))}))}(a,h),((t,e)=>{const r={};return Object.keys(t.ul).forEach((n=>{if(e)r[n]=t[e.toLowerCase()][n];else{const e=Object.values(t).map((t=>t[n]));r[n]=(e[0]+e[1])/2}})),r})(a,r)})(n,e);null===(r=Object.keys(o))||void 0===r||r.forEach((t=>{n.getNode(t).data.x=o[t]}))},it=t=>{const e={},r=n=>{var o;const i=t.getNode(n);if(!i)return 0;if(e[n])return i.data.rank;let s;return e[n]=!0,null===(o=t.getRelatedEdges(n,"out"))||void 0===o||o.forEach((t=>{const e=r(t.target)-t.data.minlen;e&&(void 0===s||e<s)&&(s=e)})),s||(s=0),i.data.rank=s,s};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>r(t.id)))},st=(t,e)=>t.getNode(e.target).data.rank-t.getNode(e.source).data.rank-e.data.minlen,at=(t,e)=>{const r=n=>{e.getRelatedEdges(n,"both").forEach((o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||st(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},ut=(t,e)=>{const r=n=>{var o;null===(o=e.getRelatedEdges(n,"both"))||void 0===o||o.forEach((o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||void 0===e.getNode(s).data.layer&&st(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},ht=(t,e)=>A(e.getAllEdges(),(r=>t.hasNode(r.source)!==t.hasNode(r.target)?st(e,r):1/0)),dt=(t,e,r)=>{t.getAllNodes().forEach((t=>{const n=e.getNode(t.id);n.data.rank||(n.data.rank=0),n.data.rank+=r}))},ct=(t,e)=>{let r=S(t,t.getAllNodes(),"post",!1);r=r.slice(0,(null==r?void 0:r.length)-1),r.forEach((r=>{lt(t,e,r)}))},lt=(t,e,r)=>{const n=t.getNode(r).data.parent;t.getRelatedEdges(r,"both").find((t=>t.target===n||t.source===n)).data.cutvalue=ft(t,e,r)},ft=(t,e,r)=>{const n=t.getNode(r).data.parent;let o=!0,i=e.getRelatedEdges(r,"out").find((t=>t.target===n)),s=0;return i||(o=!1,i=e.getRelatedEdges(n,"out").find((t=>t.target===r))),s=i.data.weight,e.getRelatedEdges(r,"both").forEach((e=>{const i=e.source===r,a=i?e.target:e.source;if(a!==n){const n=i===o,u=e.data.weight;if(s+=n?u:-u,xt(t,r,a)){const e=t.getRelatedEdges(r,"both").find((t=>t.source===a||t.target===a)).data.cutvalue;s+=n?-e:e}}})),s},gt=(t,e=t.getAllNodes()[0].id)=>{pt(t,{},1,e)},pt=(t,e,r,n,o)=>{var i;const s=r;let a=r;const u=t.getNode(n);return e[n]=!0,null===(i=t.getNeighbors(n))||void 0===i||i.forEach((r=>{e[r.id]||(a=pt(t,e,a,r.id,n))})),u.data.low=s,u.data.lim=a++,o?u.data.parent=o:delete u.data.parent,a},vt=t=>t.getAllEdges().find((t=>t.data.cutvalue<0)),mt=(t,e,r)=>{let n=r.source,o=r.target;e.getRelatedEdges(n,"out").find((t=>t.target===o))||(n=r.target,o=r.source);const i=t.getNode(n),s=t.getNode(o);let a=i,u=!1;i.data.lim>s.data.lim&&(a=s,u=!0);const h=e.getAllEdges().filter((e=>u===bt(t.getNode(e.source),a)&&u!==bt(t.getNode(e.target),a)));return A(h,(t=>st(e,t)))},yt=(t,e,r,n)=>{const o=t.getRelatedEdges(r.source,"both").find((t=>t.source===r.target||t.target===r.target));o&&t.removeEdge(o.id),t.addEdge({id:`e${Math.random()}`,source:n.source,target:n.target,data:{}}),gt(t),ct(t,e),wt(t,e)},wt=(t,e)=>{const r=t.getAllNodes().find((t=>!t.data.parent));let n=S(t,r,"pre",!1);n=n.slice(1),n.forEach((r=>{const n=t.getNode(r).data.parent;let o=e.getRelatedEdges(r,"out").find((t=>t.target===n)),i=!1;!o&&e.hasNode(n)&&(o=e.getRelatedEdges(n,"out").find((t=>t.target===r)),i=!0),e.getNode(r).data.rank=(e.hasNode(n)&&e.getNode(n).data.rank||0)+(i?null==o?void 0:o.data.minlen:-(null==o?void 0:o.data.minlen))}))},xt=(t,e,r)=>t.getRelatedEdges(e,"both").find((t=>t.source===r||t.target===r)),bt=(t,e)=>e.data.low<=t.data.lim&&t.data.lim<=e.data.lim,Et=it,Nt=t=>{(t=>{const e=(t=>{const e=new u;return t.getAllNodes().forEach((t=>{e.addNode(Object.assign({},t))})),t.getAllEdges().forEach((t=>{const r=e.getRelatedEdges(t.source,"out").find((e=>e.target===t.target));r?e.updateEdgeData(null==r?void 0:r.id,Object.assign(Object.assign({},r.data),{weight:r.data.weight+t.data.weight||0,minlen:Math.max(r.data.minlen,t.data.minlen||1)})):e.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||0,minlen:t.data.minlen||1}})})),e})(t);it(e);const r=(t=>{const e=new u({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);at(e,t)<n;)o=ht(e,t),i=e.hasNode(o.source)?st(t,o):-st(t,o),dt(e,t,i);return e})(e);let n,o;for(gt(r),ct(r,e);n=vt(r);)o=mt(r,e,n),yt(r,e,n,o)})(t)},Mt=(t,e)=>{const{acyclicer:r,ranker:n,rankdir:o="tb",nodeOrder:i,keepNodeOrder:s,align:a,nodesep:h=50,edgesep:d=20,ranksep:c=50}=e;Lt(t),w(t,r);const{nestingRoot:l,nodeRankFactor:f}=(t=>{const e=b(t,"root",{},"_root"),r=(t=>{const e={},r=(n,o)=>{const i=t.getChildren(n);null==i||i.forEach((t=>r(t.id,o+1))),e[n]=o};return t.getRoots().forEach((t=>r(t.id,1))),e})(t);let n=Math.max(...Object.values(r));Math.abs(n)===1/0&&(n=1);const o=n-1,i=2*o+1;t.getAllEdges().forEach((t=>{t.data.minlen*=i}));const s=(t=>{let e=0;return t.getAllEdges().forEach((t=>{e+=t.data.weight})),e})(t)+1;return t.getRoots().forEach((n=>{D(t,e,i,s,o,r,n.id)})),{nestingRoot:e,nodeRankFactor:i}})(t);((t,e)=>{switch(e){case"network-simplex":Nt(t);break;case"tight-tree":default:(t=>{(t=>{const e={};let r;const n=o=>{var i;const s=t.getNode(o);if(!s)return 0;if(e[o])return s.data.rank;let a;return e[o]=!0,null===(i=t.getRelatedEdges(o,"out"))||void 0===i||i.forEach((t=>{const e=n(t.target)-t.data.minlen;e&&(void 0===a||e<a)&&(a=e)})),a||(a=0),(void 0===r||a<r)&&(r=a),s.data.rank=a,a};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>{t&&n(t.id)})),void 0===r&&(r=0);const o={},i=(e,r)=>{var n;const s=t.getNode(e),a=isNaN(s.data.layer)?r:s.data.layer;(void 0===s.data.rank||s.data.rank<a)&&(s.data.rank=a),o[e]||(o[e]=!0,null===(n=t.getRelatedEdges(e,"out"))||void 0===n||n.forEach((t=>{i(t.target,a+t.data.minlen)})))};t.getAllNodes().forEach((t=>{const e=t.data;e&&(isNaN(e.layer)?e.rank-=r:i(t.id,e.layer))}))})(t),(t=>{const e=new u({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);ut(e,t)<n;)o=ht(e,t),i=e.hasNode(o.source)?st(t,o):-st(t,o),dt(e,t,i)})(t)})(t);break;case"longest-path":Et(t)}})(E(t),n),Ot(t),((t,e=0)=>{const r=t.getAllNodes(),n=r.filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),o=Math.min(...n),i=[];r.forEach((t=>{const e=(t.data.rank||0)-o;i[e]||(i[e]=[]),i[e].push(t.id)}));let s=0;for(let r=0;r<i.length;r++){const n=i[r];void 0===n?r%e!=0&&(s-=1):s&&(null==n||n.forEach((e=>{const r=t.getNode(e);r&&(r.data.rank=r.data.rank||0,r.data.rank+=s)})))}})(t,f),((t,e)=>{e&&t.removeNode(e),t.getAllEdges().forEach((e=>{e.data.nestingEdge&&t.removeEdge(e.id)}))})(t,l),(t=>{const e=t.getAllNodes().filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),r=Math.min(...e);t.getAllNodes().forEach((t=>{t.data.hasOwnProperty("rank")&&r!==1/0&&(t.data.rank-=r)}))})(t),zt(t),Rt(t);const g=[];((t,e)=>{t.getAllEdges().forEach((r=>((t,e,r)=>{let n=e.source,o=t.getNode(n).data.rank;const i=e.target,s=t.getNode(i).data.rank,a=e.data.labelRank;if(s===o+1)return;let u,h,d;for(t.removeEdge(e.id),d=0,++o;o<s;++d,++o)e.data.points=[],h={originalEdge:e,width:0,height:0,rank:o},u=b(t,"edge",h,"_d"),o===a&&(h.width=e.data.width,h.height=e.data.height,h.dummy=P,h.labelpos=e.data.labelpos),t.addEdge({id:`e${Math.random()}`,source:n,target:u,data:{weight:e.data.weight}}),0===d&&r.push(u),n=u;t.addEdge({id:`e${Math.random()}`,source:n,target:i,data:{weight:e.data.weight}})})(t,r,e)))})(t,g),((t,e)=>{const r=(t=>{const e={};let r=0;const n=o=>{const i=r;t.getChildren(o).forEach((t=>n(t.id))),e[o]={low:i,lim:r++}};return t.getRoots().forEach((t=>n(t.id))),e})(t);e.forEach((e=>{var n,o;let i=e,s=t.getNode(i);const a=s.data.originalEdge;if(!a)return;const u=((t,e,r,n)=>{var o,i;const s=[],a=[],u=Math.min(e[r].low,e[n].low),h=Math.max(e[r].lim,e[n].lim);let d,c;d=r;do{d=null===(o=t.getParent(d))||void 0===o?void 0:o.id,s.push(d)}while(d&&(e[d].low>u||h>e[d].lim));for(c=d,d=n;d&&d!==c;)a.push(d),d=null===(i=t.getParent(d))||void 0===i?void 0:i.id;return{lca:c,path:s.concat(a.reverse())}})(t,r,a.source,a.target),h=u.path,d=u.lca;let c=0,l=h[c],f=!0;for(;i!==a.target;){if(s=t.getNode(i),f){for(;l!==d&&(null===(n=t.getNode(l))||void 0===n?void 0:n.data.maxRank)<s.data.rank;)c++,l=h[c];l===d&&(f=!1)}if(!f){for(;c<h.length-1&&(null===(o=t.getNode(h[c+1]))||void 0===o?void 0:o.data.minRank)<=s.data.rank;)c++;l=h[c]}t.hasNode(l)&&t.setParent(i,l),i=t.getSuccessors(i)[0].id}}))})(t,g),(t=>{const e=r=>{const n=t.getChildren(r),o=t.getNode(r);if((null==n?void 0:n.length)&&n.forEach((t=>e(t.id))),o.data.hasOwnProperty("minRank")){o.data.borderLeft=[],o.data.borderRight=[];for(let e=o.data.minRank,n=o.data.maxRank+1;e<n;e+=1)O(t,"borderLeft","_bl",r,o,e),O(t,"borderRight","_br",r,o,e)}};t.getRoots().forEach((t=>e(t.id)))})(t),s&&((t,e)=>{const r=t.getAllNodes().filter((e=>{var r;return!(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length)})).map((t=>t.data.rank)),n=Math.max(...r),o=[];for(let t=0;t<n+1;t++)o[t]=[];null==e||e.forEach((e=>{const r=t.getNode(e);r&&!r.data.dummy&&(isNaN(r.data.rank)||(r.data.fixorder=o[r.data.rank].length,o[r.data.rank].push(e)))}))})(t,i),((t,e)=>{const r=k(t),n=[],o=[];for(let t=1;t<r+1;t++)n.push(t);for(let t=r-1;t>-1;t--)o.push(t);const i=K(t,n,"in"),s=K(t,o,"out");let a=B(t);Q(t,a);let u,h=Number.POSITIVE_INFINITY;for(let r=0,n=0;n<4;++r,++n){J(r%2?i:s,r%4>=2,!1,e),a=M(t);const o=V(t,a);o<h&&(n=0,u=F(a),h=o)}a=B(t),Q(t,a);for(let r=0,n=0;n<4;++r,++n){J(r%2?i:s,r%4>=2,!0,e),a=M(t);const o=V(t,a);o<h&&(n=0,u=F(a),h=o)}Q(t,u)})(t,s),Ft(t),((t,e)=>{const r=e.toLowerCase();"lr"!==r&&"rl"!==r||z(t)})(t,o),ot(t,{align:a,nodesep:h,edgesep:d,ranksep:c}),qt(t),Tt(t),((t,e)=>{e.forEach((e=>{let r=t.getNode(e);const{data:n}=r,o=n.originalEdge;let i;o&&t.addEdge(o);let s=e;for(;r.data.dummy;)i=t.getSuccessors(s)[0],t.removeNode(s),o.data.points.push({x:r.data.x,y:r.data.y}),r.data.dummy===P&&(o.data.x=r.data.x,o.data.y=r.data.y,o.data.width=r.data.width,o.data.height=r.data.height),s=i.id,r=t.getNode(s)}))})(t,g),Dt(t),((t,e)=>{const r=e.toLowerCase();"bt"!==r&&"rl"!==r||(t=>{t.getAllNodes().forEach((t=>{I(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>I(t))),t.data.hasOwnProperty("y")&&I(t.data)}))})(t),"lr"!==r&&"rl"!==r||((t=>{t.getAllNodes().forEach((t=>{C(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>C(t))),t.data.hasOwnProperty("x")&&C(t.data)}))})(t),z(t))})(t,o);const{width:p,height:v}=It(t);return Ct(t),Pt(t),(t=>{t.getAllEdges().forEach((e=>{const r=e.data;if(r.reversed){t.removeEdge(e.id);const n=r.forwardName;delete r.reversed,delete r.forwardName,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign(Object.assign({},r),{forwardName:n})})}}))})(t),{width:p,height:v}},_t=["width","height","layer","fixorder"],kt={width:0,height:0},At=["minlen","weight","width","height","labeloffset"],jt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},St=["labelpos"],Ot=t=>{t.getAllEdges().forEach((e=>{if(e.data.width&&e.data.height){const r=t.getNode(e.source),n={e,rank:(t.getNode(e.target).data.rank-r.data.rank)/2+r.data.rank};b(t,"edge-proxy",n,"_ep")}}))},zt=t=>{let e=0;return t.getAllNodes().forEach((r=>{var n,o;r.data.borderTop&&(r.data.minRank=null===(n=t.getNode(r.data.borderTop))||void 0===n?void 0:n.data.rank,r.data.maxRank=null===(o=t.getNode(r.data.borderBottom))||void 0===o?void 0:o.data.rank,e=Math.max(e,r.data.maxRank||-1/0))})),e},Rt=t=>{t.getAllNodes().forEach((e=>{"edge-proxy"===e.data.dummy&&(t.getEdge(e.data.e.id).data.labelRank=e.data.rank,t.removeNode(e.id))}))},It=(t,e)=>{let r,n,o=0,i=0;const{marginx:s=0,marginy:a=0}=e||{},u=t=>{if(!t.data)return;const e=t.data.x,s=t.data.y,a=t.data.width,u=t.data.height;isNaN(e)||isNaN(a)||(void 0===r&&(r=e-a/2),r=Math.min(r,e-a/2),o=Math.max(o,e+a/2)),isNaN(s)||isNaN(u)||(void 0===n&&(n=s-u/2),n=Math.min(n,s-u/2),i=Math.max(i,s+u/2))};return t.getAllNodes().forEach((t=>{u(t)})),t.getAllEdges().forEach((t=>{(null==t?void 0:t.data.hasOwnProperty("x"))&&u(t)})),r-=s,n-=a,t.getAllNodes().forEach((t=>{t.data.x-=r,t.data.y-=n})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>{t.x-=r,t.y-=n})),t.data.hasOwnProperty("x")&&(t.data.x-=r),t.data.hasOwnProperty("y")&&(t.data.y-=n)})),{width:o-r+s,height:i-n+a}},Ct=t=>{t.getAllEdges().forEach((e=>{const r=t.getNode(e.source),n=t.getNode(e.target);let o,i;e.data.points?(o=e.data.points[0],i=e.data.points[e.data.points.length-1]):(e.data.points=[],o={x:n.data.x,y:n.data.y},i={x:r.data.x,y:r.data.y}),e.data.points.unshift(N(r.data,o)),e.data.points.push(N(n.data,i))}))},Dt=t=>{t.getAllEdges().forEach((t=>{if(t.data.hasOwnProperty("x"))switch("l"!==t.data.labelpos&&"r"!==t.data.labelpos||(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset}}))},Pt=t=>{t.getAllEdges().forEach((t=>{var e;t.data.reversed&&(null===(e=t.data.points)||void 0===e||e.reverse())}))},Tt=t=>{t.getAllNodes().forEach((e=>{var r,n,o;if(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length){const r=t.getNode(e.id),i=t.getNode(r.data.borderTop),s=t.getNode(r.data.borderBottom),a=t.getNode(r.data.borderLeft[(null===(n=r.data.borderLeft)||void 0===n?void 0:n.length)-1]),u=t.getNode(r.data.borderRight[(null===(o=r.data.borderRight)||void 0===o?void 0:o.length)-1]);r.data.width=Math.abs((null==u?void 0:u.data.x)-(null==a?void 0:a.data.x))||10,r.data.height=Math.abs((null==s?void 0:s.data.y)-(null==i?void 0:i.data.y))||10,r.data.x=((null==a?void 0:a.data.x)||0)+r.data.width/2,r.data.y=((null==i?void 0:i.data.y)||0)+r.data.height/2}})),t.getAllNodes().forEach((e=>{"border"===e.data.dummy&&t.removeNode(e.id)}))},Lt=t=>{t.getAllEdges().forEach((e=>{if(e.source===e.target){const r=t.getNode(e.source);r.data.selfEdges||(r.data.selfEdges=[]),r.data.selfEdges.push(e),t.removeEdge(e.id)}}))},Ft=t=>{const e=M(t);null==e||e.forEach((e=>{let r=0;null==e||e.forEach(((e,n)=>{var o;const i=t.getNode(e);i.data.order=n+r,null===(o=i.data.selfEdges)||void 0===o||o.forEach((e=>{b(t,"selfedge",{width:e.data.width,height:e.data.height,rank:i.data.rank,order:n+ ++r,e},"_se")})),delete i.data.selfEdges}))}))},qt=t=>{t.getAllNodes().forEach((e=>{const r=t.getNode(e.id);if("selfedge"===r.data.dummy){const n=t.getNode(r.data.e.source),o=n.data.x+n.data.width/2,i=n.data.y,s=r.data.x-o,a=n.data.height/2;t.hasEdge(r.data.e.id)?t.updateEdgeData(r.data.e.id,r.data.e.data):t.addEdge({id:r.data.e.id,source:r.data.e.source,target:r.data.e.target,data:r.data.e.data}),t.removeNode(e.id),r.data.e.data.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{y:i,x:o+s},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.data.e.data.x=r.data.x,r.data.e.data.y=r.data.y}}))},Vt=(t,e)=>{const r={};return null==e||e.forEach((e=>{void 0!==t[e]&&(r[e]=+t[e])})),r},Bt=(t={})=>{const e={};return Object.keys(t).forEach((r=>{e[r.toLowerCase()]=t[r]})),e},$t=function(t){return"function"==typeof t},Ut=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};function Gt(t,e){let r;return r=$t(e)?e:c(e)?()=>e:()=>t,r}function Wt(t,e,r=!0){return e||0===e?$t(e)?e:c(e)?()=>e:Array.isArray(e)?()=>{if(r){const r=Math.max(...e);return isNaN(r)?t:r}return e}:Ut(e)?()=>{if(r){const r=Math.max(e.width,e.height);return isNaN(r)?t:r}return[e.width,e.height]}:()=>t:e=>{const{size:r}=e.data||{};return r?Array.isArray(r)?r[0]>r[1]?r[0]:r[1]:Ut(r)?r.width>r.height?r.width:r.height:r:t}}const Yt=(t,e)=>{let r,n;return n=c(e)?()=>e:$t(e)?e:()=>0,r=t?Array.isArray(t)?e=>(t[0]>t[1]?t[0]:t[1])+n(e):$t(t)?t:e=>t+n(e):t=>{var e,r;if(null===(e=t.data)||void 0===e?void 0:e.bboxSize)return Math.max(t.data.bboxSize[0],t.data.bboxSize[1])+n(t);if(null===(r=t.data)||void 0===r?void 0:r.size){if(Array.isArray(t.data.size))return Math.max(t.data.size[0],t.data.size[1])+n(t);const e=t.data.size;return Ut(e)?(e.width>e.height?e.width:e.height)+n(t):e+n(t)}return 10+n(t)},r},Ht=t=>{if(null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array){const e=[];return t.forEach((t=>{e.push(t)})),e.map((t=>Ht(t)))}if("object"==typeof t){const e={};return Object.keys(t).forEach((r=>{e[r]=Ht(t[r])})),e}return t},Kt=(t,e)=>{const r=Ht(t);return r.data=r.data||{},e&&(c(r.data.x)||(r.data.x=Math.random()*e[0]),c(r.data.y)||(r.data.y=Math.random()*e[1])),r},Jt={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null},Qt=(t,e,r)=>{const n=t.getAllNodes(),o=t.getAllEdges();return(null==n?void 0:n.length)?1===n.length?(e&&t.mergeNodeData(n[0].id,{x:r[0],y:r[1]}),{nodes:[Object.assign(Object.assign({},n[0]),{data:Object.assign(Object.assign({},n[0].data),{x:r[0],y:r[1]})})],edges:o}):void 0:{nodes:[],edges:o}},Xt={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1},Zt=(t,e,r=!1)=>{const n=[Kt(e[0])],o={},i=e.length;o[e[0].id]=!0;let s=0;return e.forEach(((a,u)=>{if(0!==u)if(u!==i-1&&t.getDegree(a.id,"both")===t.getDegree(e[u+1].id,"both")&&!t.areNeighbors(n[s].id,a.id)||o[a.id]){const u=r?t.getSuccessors(n[s].id):t.getNeighbors(n[s].id);let h=!1;for(let e=0;e<u.length;e++){const r=u[e];if(t.getDegree(r.id)===t.getDegree(a.id)&&!o[r.id]){n.push(Kt(r)),o[r.id]=!0,h=!0;break}}let d=0;for(;!h&&(o[e[d].id]||(n.push(Kt(e[d])),o[e[d].id]=!0,h=!0),d++,d!==i););}else n.push(Kt(a)),o[a.id]=!0,s++})),n},te=function(t){return d(t,"String")},ee=Array.isArray,re={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class ne{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},re),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericConcentricLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){this.genericConcentricLayout(!0,e,r)}))}genericConcentricLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{center:o,width:i,height:s,sortBy:a,maxLevelDiff:u,sweep:h,clockwise:d,equidistant:l,preventOverlap:f,startAngle:g=1.5*Math.PI,nodeSize:p,nodeSpacing:v}=t,m=r.getAllNodes(),y=r.getAllEdges(),w=i||"undefined"==typeof window?i:window.innerWidth,x=s||"undefined"==typeof window?s:window.innerHeight,b=o||[w/2,x/2];if(!(null==m?void 0:m.length)||1===m.length)return Qt(r,e,b);const E=[];let N,M=0;ee(p)?N=Math.max(p[0],p[1]):$t(p)?(N=-1/0,m.forEach((t=>{const e=p(t);e>N&&(N=e)}))):N=p,ee(v)?M=Math.max(v[0],v[1]):c(v)&&(M=v),m.forEach((t=>{const e=Kt(t);E.push(e);let r=N;const{data:n}=e;ee(n.size)?r=Math.max(n.size[0],n.size[1]):c(n.size)?r=n.size:Ut(n.size)&&(r=Math.max(n.size.width,n.size.height)),N=Math.max(N,r),$t(v)&&(M=Math.max(v(t),M))}));const _={};E.forEach(((t,e)=>{_[t.id]=e}));let k=a;te(k)&&void 0!==E[0].data[k]||(k="degree"),"degree"===k?E.sort(((t,e)=>r.getDegree(e.id,"both")-r.getDegree(t.id,"both"))):E.sort(((t,e)=>e.data[k]-t.data[k]));const A=E[0],j=(u||("degree"===k?r.getDegree(A.id,"both"):A.data[k]))/4,S=[{nodes:[]}];let O=S[0];E.forEach((t=>{if(O.nodes.length>0){const e="degree"===k?Math.abs(r.getDegree(O.nodes[0].id,"both")-r.getDegree(t.id,"both")):Math.abs(O.nodes[0].data[k]-t.data[k]);j&&e>=j&&(O={nodes:[]},S.push(O))}O.nodes.push(t)}));let z=N+M;if(!f){const t=S.length>0&&S[0].nodes.length>1,e=(Math.min(w,x)/2-z)/(S.length+(t?1:0));z=Math.min(z,e)}let R=0;if(S.forEach((t=>{const e=void 0===h?2*Math.PI-2*Math.PI/t.nodes.length:h;if(t.dTheta=e/Math.max(1,t.nodes.length-1),t.nodes.length>1&&f){const e=Math.cos(t.dTheta)-Math.cos(0),r=Math.sin(t.dTheta)-Math.sin(0),n=Math.sqrt(z*z/(e*e+r*r));R=Math.max(n,R)}t.r=R,R+=z})),l){let t=0,e=0;for(let r=0;r<S.length;r++){const n=(S[r].r||0)-e;t=Math.max(t,n)}e=0,S.forEach(((r,n)=>{0===n&&(e=r.r||0),r.r=e,e+=t}))}return S.forEach((t=>{const e=t.dTheta||0,r=t.r||0;t.nodes.forEach(((t,n)=>{const o=g+(d?1:-1)*e*n;t.data.x=b[0]+r*Math.cos(o),t.data.y=b[1]+r*Math.sin(o)}))})),e&&E.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:E,edges:y}}))}}function oe(t,e,r,n){if(isNaN(e)||isNaN(r))return t;var o,i,s,a,u,h,d,c,l,f=t._root,g={data:n},p=t._x0,v=t._y0,m=t._x1,y=t._y1;if(!f)return t._root=g,t;for(;f.length;)if((h=e>=(i=(p+m)/2))?p=i:m=i,(d=r>=(s=(v+y)/2))?v=s:y=s,o=f,!(f=f[c=d<<1|h]))return o[c]=g,t;if(a=+t._x.call(null,f.data),u=+t._y.call(null,f.data),e===a&&r===u)return g.next=f,o?o[c]=g:t._root=g,t;do{o=o?o[c]=new Array(4):t._root=new Array(4),(h=e>=(i=(p+m)/2))?p=i:m=i,(d=r>=(s=(v+y)/2))?v=s:y=s}while((c=d<<1|h)==(l=(u>=s)<<1|a>=i));return o[l]=f,o[c]=g,t}function ie(t,e,r,n,o){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=o}function se(t){return t[0]}function ae(t){return t[1]}function ue(t,e,r){var n=new he(null==e?se:e,null==r?ae:r,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function he(t,e,r,n,o,i){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=o,this._y1=i,this._root=void 0}function de(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var ce=ue.prototype=he.prototype;function le(t,e,r,n,o){if(isNaN(e)||isNaN(r)||isNaN(n))return t;var i,s,a,u,h,d,c,l,f,g,p,v,m=t._root,y={data:o},w=t._x0,x=t._y0,b=t._z0,E=t._x1,N=t._y1,M=t._z1;if(!m)return t._root=y,t;for(;m.length;)if((l=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+N)/2))?x=a:N=a,(g=n>=(u=(b+M)/2))?b=u:M=u,i=m,!(m=m[p=g<<2|f<<1|l]))return i[p]=y,t;if(h=+t._x.call(null,m.data),d=+t._y.call(null,m.data),c=+t._z.call(null,m.data),e===h&&r===d&&n===c)return y.next=m,i?i[p]=y:t._root=y,t;do{i=i?i[p]=new Array(8):t._root=new Array(8),(l=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+N)/2))?x=a:N=a,(g=n>=(u=(b+M)/2))?b=u:M=u}while((p=g<<2|f<<1|l)==(v=(c>=u)<<2|(d>=a)<<1|h>=s));return i[v]=m,i[p]=y,t}function fe(t,e,r,n,o,i,s){this.node=t,this.x0=e,this.y0=r,this.z0=n,this.x1=o,this.y1=i,this.z1=s}function ge(t){return t[0]}function pe(t){return t[1]}function ve(t){return t[2]}function me(t,e,r,n){var o=new ye(null==e?ge:e,null==r?pe:r,null==n?ve:n,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?o:o.addAll(t)}function ye(t,e,r,n,o,i,s,a,u){this._x=t,this._y=e,this._z=r,this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this._root=void 0}function we(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}ce.copy=function(){var t,e,r=new he(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=de(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var o=0;o<4;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(4)}):n.target[o]=de(e));return r},ce.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t);return oe(this.cover(e,r),e,r,t)},ce.addAll=function(t){var e,r,n,o,i=t.length,s=new Array(i),a=new Array(i),u=1/0,h=1/0,d=-1/0,c=-1/0;for(r=0;r<i;++r)isNaN(n=+this._x.call(null,e=t[r]))||isNaN(o=+this._y.call(null,e))||(s[r]=n,a[r]=o,n<u&&(u=n),n>d&&(d=n),o<h&&(h=o),o>c&&(c=o));if(u>d||h>c)return this;for(this.cover(u,h).cover(d,c),r=0;r<i;++r)oe(this,s[r],a[r],t[r]);return this},ce.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var r=this._x0,n=this._y0,o=this._x1,i=this._y1;if(isNaN(r))o=(r=Math.floor(t))+1,i=(n=Math.floor(e))+1;else{for(var s,a,u=o-r||1,h=this._root;r>t||t>=o||n>e||e>=i;)switch(a=(e<n)<<1|t<r,(s=new Array(4))[a]=h,h=s,u*=2,a){case 0:o=r+u,i=n+u;break;case 1:r=o-u,i=n+u;break;case 2:o=r+u,n=i-u;break;case 3:r=o-u,n=i-u}this._root&&this._root.length&&(this._root=h)}return this._x0=r,this._y0=n,this._x1=o,this._y1=i,this},ce.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},ce.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]]},ce.find=function(t,e,r){var n,o,i,s,a,u,h,d=this._x0,c=this._y0,l=this._x1,f=this._y1,g=[],p=this._root;for(p&&g.push(new ie(p,d,c,l,f)),null==r?r=1/0:(d=t-r,c=e-r,l=t+r,f=e+r,r*=r);u=g.pop();)if(!(!(p=u.node)||(o=u.x0)>l||(i=u.y0)>f||(s=u.x1)<d||(a=u.y1)<c))if(p.length){var v=(o+s)/2,m=(i+a)/2;g.push(new ie(p[3],v,m,s,a),new ie(p[2],o,m,v,a),new ie(p[1],v,i,s,m),new ie(p[0],o,i,v,m)),(h=(e>=m)<<1|t>=v)&&(u=g[g.length-1],g[g.length-1]=g[g.length-1-h],g[g.length-1-h]=u)}else{var y=t-+this._x.call(null,p.data),w=e-+this._y.call(null,p.data),x=y*y+w*w;if(x<r){var b=Math.sqrt(r=x);d=t-b,c=e-b,l=t+b,f=e+b,n=p.data}}return n},ce.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t)))return this;var e,r,n,o,i,s,a,u,h,d,c,l,f=this._root,g=this._x0,p=this._y0,v=this._x1,m=this._y1;if(!f)return this;if(f.length)for(;;){if((h=i>=(a=(g+v)/2))?g=a:v=a,(d=s>=(u=(p+m)/2))?p=u:m=u,e=f,!(f=f[c=d<<1|h]))return this;if(!f.length)break;(e[c+1&3]||e[c+2&3]||e[c+3&3])&&(r=e,l=c)}for(;f.data!==t;)if(n=f,!(f=f.next))return this;return(o=f.next)&&delete f.next,n?(o?n.next=o:delete n.next,this):e?(o?e[c]=o:delete e[c],(f=e[0]||e[1]||e[2]||e[3])&&f===(e[3]||e[2]||e[1]||e[0])&&!f.length&&(r?r[l]=f:this._root=f),this):(this._root=o,this)},ce.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},ce.root=function(){return this._root},ce.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},ce.visit=function(t){var e,r,n,o,i,s,a=[],u=this._root;for(u&&a.push(new ie(u,this._x0,this._y0,this._x1,this._y1));e=a.pop();)if(!t(u=e.node,n=e.x0,o=e.y0,i=e.x1,s=e.y1)&&u.length){var h=(n+i)/2,d=(o+s)/2;(r=u[3])&&a.push(new ie(r,h,d,i,s)),(r=u[2])&&a.push(new ie(r,n,d,h,s)),(r=u[1])&&a.push(new ie(r,h,o,i,d)),(r=u[0])&&a.push(new ie(r,n,o,h,d))}return this},ce.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new ie(this._root,this._x0,this._y0,this._x1,this._y1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.y0,u=e.x1,h=e.y1,d=(s+u)/2,c=(a+h)/2;(i=o[0])&&r.push(new ie(i,s,a,d,c)),(i=o[1])&&r.push(new ie(i,d,a,u,c)),(i=o[2])&&r.push(new ie(i,s,c,d,h)),(i=o[3])&&r.push(new ie(i,d,c,u,h))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},ce.x=function(t){return arguments.length?(this._x=t,this):this._x},ce.y=function(t){return arguments.length?(this._y=t,this):this._y};var xe=me.prototype=ye.prototype;function be(t){let e=0,r=0,n=0,o=0,i=0;const s=t.length;if(s){for(let a=0;a<s;a++){const s=t[a];s&&s.weight&&(e+=s.weight,r+=s.x*s.weight,n+=s.y*s.weight,o+=s.z*s.weight,i+=s.size*s.weight)}t.x=r/e,t.y=n/e,t.z=o/e,t.size=i/e,t.weight=e}else{const e=t;t.x=e.data.x,t.y=e.data.y,t.z=e.data.z,t.size=e.data.size,t.weight=e.data.weight}}xe.copy=function(){var t,e,r=new ye(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root;if(!n)return r;if(!n.length)return r._root=we(n),r;for(t=[{source:n,target:r._root=new Array(8)}];n=t.pop();)for(var o=0;o<8;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(8)}):n.target[o]=we(e));return r},xe.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t),n=+this._z.call(null,t);return le(this.cover(e,r,n),e,r,n,t)},xe.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e),n=new Float64Array(e),o=new Float64Array(e);let i=1/0,s=1/0,a=1/0,u=-1/0,h=-1/0,d=-1/0;for(let c,l,f,g,p=0;p<e;++p)isNaN(l=+this._x.call(null,c=t[p]))||isNaN(f=+this._y.call(null,c))||isNaN(g=+this._z.call(null,c))||(r[p]=l,n[p]=f,o[p]=g,l<i&&(i=l),l>u&&(u=l),f<s&&(s=f),f>h&&(h=f),g<a&&(a=g),g>d&&(d=g));if(i>u||s>h||a>d)return this;this.cover(i,s,a).cover(u,h,d);for(let i=0;i<e;++i)le(this,r[i],n[i],o[i],t[i]);return this},xe.cover=function(t,e,r){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(r=+r))return this;var n=this._x0,o=this._y0,i=this._z0,s=this._x1,a=this._y1,u=this._z1;if(isNaN(n))s=(n=Math.floor(t))+1,a=(o=Math.floor(e))+1,u=(i=Math.floor(r))+1;else{for(var h,d,c=s-n||1,l=this._root;n>t||t>=s||o>e||e>=a||i>r||r>=u;)switch(d=(r<i)<<2|(e<o)<<1|t<n,(h=new Array(8))[d]=l,l=h,c*=2,d){case 0:s=n+c,a=o+c,u=i+c;break;case 1:n=s-c,a=o+c,u=i+c;break;case 2:s=n+c,o=a-c,u=i+c;break;case 3:n=s-c,o=a-c,u=i+c;break;case 4:s=n+c,a=o+c,i=u-c;break;case 5:n=s-c,a=o+c,i=u-c;break;case 6:s=n+c,o=a-c,i=u-c;break;case 7:n=s-c,o=a-c,i=u-c}this._root&&this._root.length&&(this._root=l)}return this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this},xe.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},xe.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},xe.find=function(t,e,r,n){var o,i,s,a,u,h,d,c,l,f=this._x0,g=this._y0,p=this._z0,v=this._x1,m=this._y1,y=this._z1,w=[],x=this._root;for(x&&w.push(new fe(x,f,g,p,v,m,y)),null==n?n=1/0:(f=t-n,g=e-n,p=r-n,v=t+n,m=e+n,y=r+n,n*=n);c=w.pop();)if(!(!(x=c.node)||(i=c.x0)>v||(s=c.y0)>m||(a=c.z0)>y||(u=c.x1)<f||(h=c.y1)<g||(d=c.z1)<p))if(x.length){var b=(i+u)/2,E=(s+h)/2,N=(a+d)/2;w.push(new fe(x[7],b,E,N,u,h,d),new fe(x[6],i,E,N,b,h,d),new fe(x[5],b,s,N,u,E,d),new fe(x[4],i,s,N,b,E,d),new fe(x[3],b,E,a,u,h,N),new fe(x[2],i,E,a,b,h,N),new fe(x[1],b,s,a,u,E,N),new fe(x[0],i,s,a,b,E,N)),(l=(r>=N)<<2|(e>=E)<<1|t>=b)&&(c=w[w.length-1],w[w.length-1]=w[w.length-1-l],w[w.length-1-l]=c)}else{var M=t-+this._x.call(null,x.data),_=e-+this._y.call(null,x.data),k=r-+this._z.call(null,x.data),A=M*M+_*_+k*k;if(A<n){var j=Math.sqrt(n=A);f=t-j,g=e-j,p=r-j,v=t+j,m=e+j,y=r+j,o=x.data}}return o},xe.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t))||isNaN(a=+this._z.call(null,t)))return this;var e,r,n,o,i,s,a,u,h,d,c,l,f,g,p,v=this._root,m=this._x0,y=this._y0,w=this._z0,x=this._x1,b=this._y1,E=this._z1;if(!v)return this;if(v.length)for(;;){if((c=i>=(u=(m+x)/2))?m=u:x=u,(l=s>=(h=(y+b)/2))?y=h:b=h,(f=a>=(d=(w+E)/2))?w=d:E=d,e=v,!(v=v[g=f<<2|l<<1|c]))return this;if(!v.length)break;(e[g+1&7]||e[g+2&7]||e[g+3&7]||e[g+4&7]||e[g+5&7]||e[g+6&7]||e[g+7&7])&&(r=e,p=g)}for(;v.data!==t;)if(n=v,!(v=v.next))return this;return(o=v.next)&&delete v.next,n?(o?n.next=o:delete n.next,this):e?(o?e[g]=o:delete e[g],(v=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&v===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!v.length&&(r?r[p]=v:this._root=v),this):(this._root=o,this)},xe.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},xe.root=function(){return this._root},xe.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},xe.visit=function(t){var e,r,n,o,i,s,a,u,h=[],d=this._root;for(d&&h.push(new fe(d,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=h.pop();)if(!t(d=e.node,n=e.x0,o=e.y0,i=e.z0,s=e.x1,a=e.y1,u=e.z1)&&d.length){var c=(n+s)/2,l=(o+a)/2,f=(i+u)/2;(r=d[7])&&h.push(new fe(r,c,l,f,s,a,u)),(r=d[6])&&h.push(new fe(r,n,l,f,c,a,u)),(r=d[5])&&h.push(new fe(r,c,o,f,s,l,u)),(r=d[4])&&h.push(new fe(r,n,o,f,c,l,u)),(r=d[3])&&h.push(new fe(r,c,l,i,s,a,f)),(r=d[2])&&h.push(new fe(r,n,l,i,c,a,f)),(r=d[1])&&h.push(new fe(r,c,o,i,s,l,f)),(r=d[0])&&h.push(new fe(r,n,o,i,c,l,f))}return this},xe.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new fe(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.y0,u=e.z0,h=e.x1,d=e.y1,c=e.z1,l=(s+h)/2,f=(a+d)/2,g=(u+c)/2;(i=o[0])&&r.push(new fe(i,s,a,u,l,f,g)),(i=o[1])&&r.push(new fe(i,l,a,u,h,f,g)),(i=o[2])&&r.push(new fe(i,s,f,u,l,d,g)),(i=o[3])&&r.push(new fe(i,l,f,u,h,d,g)),(i=o[4])&&r.push(new fe(i,s,a,g,l,f,c)),(i=o[5])&&r.push(new fe(i,l,a,g,h,f,c)),(i=o[6])&&r.push(new fe(i,s,f,g,l,d,c)),(i=o[7])&&r.push(new fe(i,l,f,g,h,d,c))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},xe.x=function(t){return arguments.length?(this._x=t,this):this._x},xe.y=function(t){return arguments.length?(this._y=t,this):this._y},xe.z=function(t){return arguments.length?(this._z=t,this):this._z};const Ee=(t,e,r,n,o,i,s)=>{var a;if((null===(a=t.data)||void 0===a?void 0:a.id)===i.id)return;const u=[r,n,o][s-1],h=i.x-t.x||.1,d=i.y-t.y||.1,c=i.z-t.z||.1,l=[h,d,c],f=u-e;let g=0;for(let t=0;t<s;t++)g+=l[t]*l[t];const p=Math.sqrt(g)*g;if(f*f*.81<g){const e=t.weight/p;return i.vx+=h*e,i.vy+=d*e,i.vz+=c*e,!0}if(t.length)return!1;if(t.data!==i){const e=t.data.weight/p;i.vx+=h*e,i.vy+=d*e,i.vz+=c*e}},Ne={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"};class Me{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},Ne),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericForceLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){this.genericForceLayout(!0,e,r)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;(this.judgingDistance>this.lastOptions.minMovement||e<1)&&e<t;e++)this.runOneStep(this.lastCalcGraph,this.lastGraph,e,this.lastVelMap,this.lastOptions),this.updatePosition(this.lastGraph,this.lastCalcGraph,this.lastVelMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericForceLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),o=r.getAllNodes(),i=r.getAllEdges(),s=this.formatOptions(t,r),{dimensions:a,width:h,height:d,nodeSize:l,getMass:f,nodeStrength:g,edgeStrength:p,linkDistance:v}=s,m=o.map(((t,e)=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{x:c(t.data.x)?t.data.x:Math.random()*h,y:c(t.data.y)?t.data.y:Math.random()*d,z:c(t.data.z)?t.data.z:Math.random()*Math.sqrt(h*d),size:l(t)||30,mass:f(t),nodeStrength:g(t)})}))),y=i.map((t=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{edgeStrength:p(t),linkDistance:v(t,r.getNode(t.source),r.getNode(t.target))})})));if(!(null==o?void 0:o.length))return this.lastResult={nodes:[],edges:i},{nodes:[],edges:i};const w={};o.forEach(((t,e)=>{w[t.id]={x:0,y:0,z:0}}));const x=new u({nodes:m,edges:y});this.formatCentripetal(s,x);const{maxIteration:b,minMovement:E,onTick:N}=s;if(this.lastLayoutNodes=m,this.lastLayoutEdges=y,this.lastAssign=e,this.lastGraph=r,this.lastCalcGraph=x,this.lastOptions=s,this.lastVelMap=w,"undefined"==typeof window)return;let M=0;return new Promise((t=>{this.timeInterval=window.setInterval((()=>{o&&this.running||t({nodes:Se(r,m),edges:i}),this.runOneStep(x,r,M,w,s),this.updatePosition(r,x,w,s),e&&m.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===a?t.data.z:void 0}))),null==N||N({nodes:Se(r,m),edges:i}),M++,(M>=b||this.judgingDistance<E)&&(window.clearInterval(this.timeInterval),t({nodes:Se(r,m),edges:i}))}),0),this.running=!0}))}))}formatOptions(t,e){const r=Object.assign({},t),{width:n,height:o,getMass:i,nodeSize:s}=t;r.width=n||"undefined"==typeof window?n:window.innerWidth,r.height=o||"undefined"==typeof window?o:window.innerHeight,t.center||(r.center=[r.width/2,r.height/2]),i||(r.getMass=t=>{let r=1;c(null==t?void 0:t.data.mass)&&(r=null==t?void 0:t.data.mass);const n=e.getDegree(t.id,"both");return!n||n<5?r:5*n*r});const a=Gt(0,t.nodeSpacing);let u;u=s?$t(s)?t=>s(t)+a(t):ee(s)?t=>{const e=s;return Math.max(e[0],e[1])+a(t)}:t=>s+a(t):t=>{const{size:e}=(null==t?void 0:t.data)||{};return e?ee(e)?Math.max(e[0],e[1])+a(t):Ut(e)?Math.max(e.width,e.height)+a(t):e+a(t):10+a(t)},r.nodeSize=u;const h=t.linkDistance?Gt(1,t.linkDistance):t=>1+r.nodeSize(e.getNode(t.source))+r.nodeSize(e.getNode(t.target));return r.linkDistance=h,r.nodeStrength=Gt(1,t.nodeStrength),r.edgeStrength=Gt(1,t.edgeStrength),r}formatCentripetal(t,e){const{dimensions:r,centripetalOptions:n,center:o,clusterNodeStrength:i,leafCluster:s,clustering:a,nodeClusterBy:u}=t,h=e.getAllNodes(),d=n||{leaf:2,single:2,others:1,center:t=>({x:o[0],y:o[1],z:3===r?o[2]:void 0})};let c,l;if("function"!=typeof i&&(t.clusterNodeStrength=t=>i),s&&u&&(c=_e(e,u),l=Array.from(new Set(null==h?void 0:h.map((t=>t.data[u]))))||[],t.centripetalOptions=Object.assign(d,{single:100,leaf:e=>{const{siblingLeaves:r,sameTypeLeaves:n}=c[e.id]||{};return(null==n?void 0:n.length)===(null==r?void 0:r.length)||1===(null==l?void 0:l.length)?1:t.clusterNodeStrength(e)},others:1,center:t=>{const r=e.getDegree(t.id,"both");if(!r)return{x:100,y:100,z:0};let n;if(1===r){const{sameTypeLeaves:e=[]}=c[t.id]||{};1===e.length?n=void 0:e.length>1&&(n=je(e))}else n=void 0;return{x:null==n?void 0:n.x,y:null==n?void 0:n.y,z:null==n?void 0:n.z}}})),a&&u){c||(c=_e(e,u)),l||(l=Array.from(new Set(h.map((t=>t.data[u]))))),l=l.filter((t=>void 0!==t));const r={};l.forEach((t=>{const n=h.filter((e=>e.data[u]===t)).map((t=>e.getNode(t.id)));r[t]=je(n)})),t.centripetalOptions=Object.assign(d,{single:e=>t.clusterNodeStrength(e),leaf:e=>t.clusterNodeStrength(e),others:e=>t.clusterNodeStrength(e),center:t=>{const e=r[t.data[u]];return{x:null==e?void 0:e.x,y:null==e?void 0:e.y,z:null==e?void 0:e.z}}})}const{leaf:f,single:g,others:p}=t.centripetalOptions||{};f&&"function"!=typeof f&&(t.centripetalOptions.leaf=()=>f),g&&"function"!=typeof g&&(t.centripetalOptions.single=()=>g),p&&"function"!=typeof p&&(t.centripetalOptions.others=()=>p)}runOneStep(t,e,r,n,o){const i={},s=t.getAllNodes(),a=t.getAllEdges();if(!(null==s?void 0:s.length))return;const{monitor:u}=o;this.calRepulsive(t,i,o),a&&this.calAttractive(t,i,o),this.calGravity(t,e,i,o),this.updateVelocity(t,i,n,o),u&&u({energy:this.calTotalEnergy(i,s),nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:r})}calTotalEnergy(t,e){if(!(null==e?void 0:e.length))return 0;let r=0;return e.forEach(((e,n)=>{const o=t[e.id].x,i=t[e.id].y,s=3===this.options.dimensions?t[e.id].z:0,a=o*o+i*i+s*s,{mass:u=1}=e.data;r+=u*a*.5})),r}calRepulsive(t,e,r){const{dimensions:n,factor:o,coulombDisScale:i}=r;!function(t,e,r,n,o=2){const i=e/r,s=t.getAllNodes(),a=s.map(((t,e)=>{const{nodeStrength:r,x:n,y:o,z:s,size:a}=t.data;return{x:n,y:o,z:s,size:a,index:e,id:t.id,vx:0,vy:0,vz:0,weight:i*r}})),u=(2===o?ue(a,(t=>t.x),(t=>t.y)):me(a,(t=>t.x),(t=>t.y),(t=>t.z))).visitAfter(be),h=new Map;a.forEach((t=>{h.set(t.id,t),function(t,e,r){e.visit(((e,n,o,i,s)=>Ee(e,n,o,i,s,t,r)))}(t,u,o)})),a.map(((t,e)=>{const{id:r,data:o}=s[e],{mass:i=1}=o;n[r]={x:t.vx/i,y:t.vy/i,z:t.vz/i}}))}(t,o,i*i,e,n)}calAttractive(t,e,r){const{dimensions:n,nodeSize:o}=r;t.getAllEdges().forEach(((r,i)=>{const{source:s,target:a}=r,u=t.getNode(s),h=t.getNode(a);if(!u||!h)return;let d=h.data.x-u.data.x,c=h.data.y-u.data.y,l=3===n?h.data.z-u.data.z:0;d||c||(d=.01*Math.random(),c=.01*Math.random(),3!==n||l||(l=.01*Math.random()));const f=Math.sqrt(d*d+c*c+l*l);if(f<o(u)+o(h))return;const g=d/f,p=c/f,v=l/f,{linkDistance:m=200,edgeStrength:y=200}=r.data||{},w=(m-f)*y,x=1/(u.data.mass||1),b=1/(h.data.mass||1),E=g*w,N=p*w,M=v*w;e[s].x-=E*x,e[s].y-=N*x,e[s].z-=M*x,e[a].x+=E*b,e[a].y+=N*b,e[a].z+=M*b}))}calGravity(t,e,r,n){const{getCenter:o}=n,i=t.getAllNodes(),s=e.getAllNodes(),a=e.getAllEdges(),{width:u,height:h,center:d,gravity:l,centripetalOptions:f}=n;i&&i.forEach((n=>{const{id:i,data:g}=n,{mass:p,x:v,y:m,z:y}=g,w=e.getNode(i);let x=0,b=0,E=0,N=l;const M=t.getDegree(i,"in"),_=t.getDegree(i,"out"),k=t.getDegree(i,"both"),A=null==o?void 0:o(w,k);if(A){const[t,e,r]=A;x=v-t,b=m-e,N=r}else x=v-d[0],b=m-d[1],E=y-d[2];if(N&&(r[i].x-=N*x/p,r[i].y-=N*b/p,r[i].z-=N*E/p),f){const{leaf:t,single:e,others:n,center:o}=f,{x:d,y:l,z:g,centerStrength:x}=(null==o?void 0:o(w,s,a,u,h))||{x:0,y:0,z:0,centerStrength:0};if(!c(d)||!c(l))return;const b=(v-d)/p,E=(m-l)/p,N=(y-g)/p;if(x&&(r[i].x-=x*b,r[i].y-=x*E,r[i].z-=x*N),0===k){const t=e(w);if(!t)return;return r[i].x-=t*b,r[i].y-=t*E,void(r[i].z-=t*N)}if(0===M||0===_){const e=t(w,s,a);if(!e)return;return r[i].x-=e*b,r[i].y-=e*E,void(r[i].z-=e*N)}const A=n(w);if(!A)return;r[i].x-=A*b,r[i].y-=A*E,r[i].z-=A*N}}))}updateVelocity(t,e,r,n){const{damping:o,maxSpeed:i,interval:s,dimensions:a}=n,u=t.getAllNodes();(null==u?void 0:u.length)&&u.forEach((t=>{const{id:n}=t;let u=(r[n].x+e[n].x*s)*o||.01,h=(r[n].y+e[n].y*s)*o||.01,d=3===a?(r[n].z+e[n].z*s)*o||.01:0;const c=Math.sqrt(u*u+h*h+d*d);if(c>i){const t=i/c;u*=t,h*=t,d*=t}r[n]={x:u,y:h,z:d}}))}updatePosition(t,e,r,n){const{distanceThresholdMode:o,interval:i,dimensions:s}=n,a=e.getAllNodes();if(!(null==a?void 0:a.length))return void(this.judgingDistance=0);let u=0;"max"===o?this.judgingDistance=-1/0:"min"===o&&(this.judgingDistance=1/0),a.forEach((n=>{const{id:a}=n,h=t.getNode(a);if(c(h.data.fx)&&c(h.data.fy))return void e.mergeNodeData(a,{x:h.data.fx,y:h.data.fy,z:3===s?h.data.fz:void 0});const d=r[a].x*i,l=r[a].y*i,f=3===s?r[a].z*i:0;e.mergeNodeData(a,{x:n.data.x+d,y:n.data.y+l,z:n.data.z+f});const g=Math.sqrt(d*d+l*l+f*f);switch(o){case"max":this.judgingDistance<g&&(this.judgingDistance=g);break;case"min":this.judgingDistance>g&&(this.judgingDistance=g);break;default:u+=g}})),o&&"mean"!==o||(this.judgingDistance=u/a.length)}}const _e=(t,e)=>{const r=t.getAllNodes();if(!(null==r?void 0:r.length))return{};const n={};return r.forEach(((r,o)=>{1===t.getDegree(r.id,"both")&&(n[r.id]=ke(t,"leaf",r,e))})),n},ke=(t,e,r,n)=>{const o=t.getDegree(r.id,"in"),i=t.getDegree(r.id,"out");let s=r,a=[];return 0===o?(s=t.getSuccessors(r.id)[0],a=t.getNeighbors(s.id)):0===i&&(s=t.getPredecessors(r.id)[0],a=t.getNeighbors(s.id)),a=a.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out"))),{coreNode:s,siblingLeaves:a,sameTypeLeaves:Ae(t,e,n,r,a)}},Ae=(t,e,r,n,o)=>{const i=n.data[r]||"";let s=(null==o?void 0:o.filter((t=>t.data[r]===i)))||[];return"leaf"===e&&(s=s.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out")))),s},je=t=>{const e={x:0,y:0};t.forEach((t=>{const{x:r,y:n}=t.data;e.x+=r||0,e.y+=n||0}));const r=t.length||1;return{x:e.x/r,y:e.y/r}},Se=(t,e)=>e.map((e=>{const{id:r,data:n}=e,o=t.getNode(r);return Object.assign(Object.assign({},o),{data:Object.assign(Object.assign({},o.data),{x:n.x,y:n.y,z:n.z})})}));var Oe=r(8917);Oe.y3,Oe.jy,Oe.oN,Oe.Hc,Oe.cg,Oe.hj,Oe.LU,Oe.Tb;const ze=Oe.uq,Re=(Oe.Zm,Oe.Dq,Oe.__,Oe.q0,Oe.lh,Oe.pI,Oe.zC,Oe.zg,Oe.g6,Oe.OL,Oe.ks,Oe.QR,Oe.jp,Oe.mk,Oe.W2),Ie=(Oe.l,Oe.KY,Oe.dv,Oe.BR,Oe.Wu,Oe.uq,Oe.uq,Oe.a4,Oe.DI,Oe.Jo,Oe.Zi,Oe.kH,Oe.LV,t=>{const e=[],r=t.length;for(let n=0;n<r;n+=1){e[n]=[];for(let o=0;o<r;o+=1)n===o?e[n][o]=0:0!==t[n][o]&&t[n][o]?e[n][o]=t[n][o]:e[n][o]=1/0}for(let t=0;t<r;t+=1)for(let n=0;n<r;n+=1)for(let o=0;o<r;o+=1)e[n][o]>e[n][t]+e[t][o]&&(e[n][o]=e[n][t]+e[t][o]);return e}),Ce=(t,e)=>{const{nodes:r,edges:n}=t,o=[],i={};if(!r)throw new Error("invalid nodes data!");return r&&r.forEach(((t,e)=>{i[t.id]=e,o.push([])})),null==n||n.forEach((t=>{const{source:r,target:n}=t,s=i[r],a=i[n];void 0!==s&&void 0!==a&&(o[s][a]=1,e||(o[a][s]=1))})),o},De=(t,e)=>Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)),Pe=(t,e,r,n="TB",o,i={})=>{if(!(null==e?void 0:e.length))return;const{stopBranchFn:s,stopAllFn:a}=i;for(let u=0;u<e.length;u++){const h=e[u];if(t.hasNode(h.id)&&!(null==s?void 0:s(h))){if(null==a?void 0:a(h))return;"TB"===n&&r(h),Pe(t,t.getChildren(h.id,o),r,n,o,i),"TB"!==n&&r(h)}}},Te={center:[0,0],linkDistance:50};class Le{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},Te),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericMDSLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){this.genericMDSLayout(!0,e,r)}))}genericMDSLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{center:o=[0,0],linkDistance:i=50}=t,s=r.getAllNodes(),a=r.getAllEdges();if(!(null==s?void 0:s.length)||1===s.length)return Qt(r,e,o);const u=Ce({nodes:s,edges:a},!1),h=Ie(u);Fe(h);const d=((t,e)=>{const r=[];return t.forEach((t=>{const n=[];t.forEach((t=>{n.push(t*e)})),r.push(n)})),r})(h,i),c=qe(d),l=[];return c.forEach(((t,e)=>{const r=Kt(s[e]);r.data.x=t[0]+o[0],r.data.y=t[1]+o[1],l.push(r)})),e&&l.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:l,edges:a}}))}}const Fe=t=>{let e=-999999;t.forEach((t=>{t.forEach((t=>{t!==1/0&&e<t&&(e=t)}))})),t.forEach(((r,n)=>{r.forEach(((r,o)=>{r===1/0&&(t[n][o]=e)}))}))},qe=t=>{const e=ze.mul(ze.pow(t,2),-.5),r=e.mean("row"),n=e.mean("column"),o=e.mean();e.add(o).subRowVector(r).subColumnVector(n);const i=new Re(e),s=ze.sqrt(i.diagonalMatrix).diagonal();return i.leftSingularVectors.toJSON().map((t=>ze.mul([t],[s]).toJSON()[0].splice(0,2)))},Ve={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},Be={center:[0,0],comboPadding:10,treeKey:"combo"},$e=function(t){if(!function(t){return"object"==typeof t&&null!==t}(t)||!d(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};function Ue(t,e){if(Object.hasOwn)return Object.hasOwn(t,e);if(null==t)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(t),e)}function Ge(t,e,r,n){for(var o in r=r||0,n=n||5,e)if(Ue(e,o)){var i=e[o];null!==i&&$e(i)?($e(t[o])||(t[o]={}),r<n?Ge(t[o],i,r+1,n):t[o]=e[o]):T(i)?(t[o]=[],t[o]=t[o].concat(i)):void 0!==i&&(t[o]=i)}}const We=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var n=0;n<e.length;n+=1)Ge(t,e[n]);return t};var Ye=Object.prototype.hasOwnProperty;const He=function(t,e){if(null===t||!$e(t))return{};var r={};return function(t,e){if(t)if(T(t))for(var r=0,n=t.length;r<n&&!1!==e(t[r],r);r++);else if(Ut(t))for(var o in t)if(t.hasOwnProperty(o)&&!1===e(t[o],o))break}(e,(function(e){Ye.call(t,e)&&(r[e]=t[e])})),r};function Ke(t){return function(){return t}}function Je(t){return 1e-6*(t()-.5)}function Qe(t){return t.index}function Xe(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function Ze(t){var e,r,n,o,i,s,a=Qe,u=function(t){return 1/Math.min(o[t.source.index],o[t.target.index])},h=Ke(30),d=1;function c(n){for(var o=0,a=t.length;o<d;++o)for(var u,h,c,l,f,g,p,v=0;v<a;++v)h=(u=t[v]).source,l=(c=u.target).x+c.vx-h.x-h.vx||Je(s),f=c.y+c.vy-h.y-h.vy||Je(s),l*=g=((g=Math.sqrt(l*l+f*f))-r[v])/g*n*e[v],f*=g,c.vx-=l*(p=i[v]),c.vy-=f*p,h.vx+=l*(p=1-p),h.vy+=f*p}function l(){if(n){var s,u,h=n.length,d=t.length,c=new Map(n.map(((t,e)=>[a(t,e,n),t])));for(s=0,o=new Array(h);s<d;++s)(u=t[s]).index=s,"object"!=typeof u.source&&(u.source=Xe(c,u.source)),"object"!=typeof u.target&&(u.target=Xe(c,u.target)),o[u.source.index]=(o[u.source.index]||0)+1,o[u.target.index]=(o[u.target.index]||0)+1;for(s=0,i=new Array(d);s<d;++s)u=t[s],i[s]=o[u.source.index]/(o[u.source.index]+o[u.target.index]);e=new Array(d),f(),r=new Array(d),g()}}function f(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+u(t[r],r,t)}function g(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+h(t[e],e,t)}return null==t&&(t=[]),c.initialize=function(t,e){n=t,s=e,l()},c.links=function(e){return arguments.length?(t=e,l(),c):t},c.id=function(t){return arguments.length?(a=t,c):a},c.iterations=function(t){return arguments.length?(d=+t,c):d},c.strength=function(t){return arguments.length?(u="function"==typeof t?t:Ke(+t),f(),c):u},c.distance=function(t){return arguments.length?(h="function"==typeof t?t:Ke(+t),g(),c):h},c}var tr={value:()=>{}};function er(){for(var t,e=0,r=arguments.length,n={};e<r;++e){if(!(t=arguments[e]+"")||t in n||/[\\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new rr(n)}function rr(t){this._=t}function nr(t,e){for(var r,n=0,o=t.length;n<o;++n)if((r=t[n]).name===e)return r.value}function or(t,e,r){for(var n=0,o=t.length;n<o;++n)if(t[n].name===e){t[n]=tr,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}rr.prototype=er.prototype={constructor:rr,on:function(t,e){var r,n,o=this._,i=(n=o,(t+"").trim().split(/^|\\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),s=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++s<a;)if(r=(t=i[s]).type)o[r]=or(o[r],t.name,e);else if(null==e)for(r in o)o[r]=or(o[r],t.name,null);return this}for(;++s<a;)if((r=(t=i[s]).type)&&(r=nr(o[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new rr(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,o=new Array(r),i=0;i<r;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,r=(n=this._[t]).length;i<r;++i)n[i].value.apply(e,o)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],o=0,i=n.length;o<i;++o)n[o].value.apply(e,r)}};const ir=er;var sr,ar,ur=0,hr=0,dr=0,cr=1e3,lr=0,fr=0,gr=0,pr="object"==typeof performance&&performance.now?performance:Date,vr="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function mr(){return fr||(vr(yr),fr=pr.now()+gr)}function yr(){fr=0}function wr(){this._call=this._time=this._next=null}function xr(t,e,r){var n=new wr;return n.restart(t,e,r),n}function br(){fr=(lr=pr.now())+gr,ur=hr=0;try{!function(){mr(),++ur;for(var t,e=sr;e;)(t=fr-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ur}()}finally{ur=0,function(){for(var t,e,r=sr,n=1/0;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:sr=e);ar=t,Nr(n)}(),fr=0}}function Er(){var t=pr.now(),e=t-lr;e>cr&&(gr-=e,lr=t)}function Nr(t){ur||(hr&&(hr=clearTimeout(hr)),t-fr>24?(t<1/0&&(hr=setTimeout(br,t-pr.now()-gr)),dr&&(dr=clearInterval(dr))):(dr||(lr=pr.now(),dr=setInterval(Er,cr)),ur=1,vr(br)))}wr.prototype=xr.prototype={constructor:wr,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?mr():+r)+(null==e?0:+e),this._next||ar===this||(ar?ar._next=this:sr=this,ar=this),this._call=t,this._time=r,Nr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Nr())}};const Mr=4294967296;function _r(t){return t.x}function kr(t){return t.y}var Ar=Math.PI*(3-Math.sqrt(5));function jr(){var t,e,r,n,o,i=Ke(-30),s=1,a=1/0,u=.81;function h(r){var o,i=t.length,s=ue(t,_r,kr).visitAfter(c);for(n=r,o=0;o<i;++o)e=t[o],s.visit(l)}function d(){if(t){var e,r,n=t.length;for(o=new Array(n),e=0;e<n;++e)r=t[e],o[r.index]=+i(r,e,t)}}function c(t){var e,r,n,i,s,a=0,u=0;if(t.length){for(n=i=s=0;s<4;++s)(e=t[s])&&(r=Math.abs(e.value))&&(a+=e.value,u+=r,n+=r*e.x,i+=r*e.y);t.x=n/u,t.y=i/u}else{(e=t).x=e.data.x,e.y=e.data.y;do{a+=o[e.data.index]}while(e=e.next)}t.value=a}function l(t,i,h,d){if(!t.value)return!0;var c=t.x-e.x,l=t.y-e.y,f=d-i,g=c*c+l*l;if(f*f/u<g)return g<a&&(0===c&&(g+=(c=Je(r))*c),0===l&&(g+=(l=Je(r))*l),g<s&&(g=Math.sqrt(s*g)),e.vx+=c*t.value*n/g,e.vy+=l*t.value*n/g),!0;if(!(t.length||g>=a)){(t.data!==e||t.next)&&(0===c&&(g+=(c=Je(r))*c),0===l&&(g+=(l=Je(r))*l),g<s&&(g=Math.sqrt(s*g)));do{t.data!==e&&(f=o[t.data.index]*n/g,e.vx+=c*f,e.vy+=l*f)}while(t=t.next)}}return h.initialize=function(e,n){t=e,r=n,d()},h.strength=function(t){return arguments.length?(i="function"==typeof t?t:Ke(+t),d(),h):i},h.distanceMin=function(t){return arguments.length?(s=t*t,h):Math.sqrt(s)},h.distanceMax=function(t){return arguments.length?(a=t*t,h):Math.sqrt(a)},h.theta=function(t){return arguments.length?(u=t*t,h):Math.sqrt(u)},h}function Sr(t,e){var r,n=1;function o(){var o,i,s=r.length,a=0,u=0;for(o=0;o<s;++o)a+=(i=r[o]).x,u+=i.y;for(a=(a/s-t)*n,u=(u/s-e)*n,o=0;o<s;++o)(i=r[o]).x-=a,i.y-=u}return null==t&&(t=0),null==e&&(e=0),o.initialize=function(t){r=t},o.x=function(e){return arguments.length?(t=+e,o):t},o.y=function(t){return arguments.length?(e=+t,o):e},o.strength=function(t){return arguments.length?(n=+t,o):n},o}function Or(t){return t.x+t.vx}function zr(t){return t.y+t.vy}function Rr(t){var e,r,n,o=1,i=1;function s(){for(var t,s,u,h,d,c,l,f=e.length,g=0;g<i;++g)for(s=ue(e,Or,zr).visitAfter(a),t=0;t<f;++t)u=e[t],c=r[u.index],l=c*c,h=u.x+u.vx,d=u.y+u.vy,s.visit(p);function p(t,e,r,i,s){var a=t.data,f=t.r,g=c+f;if(!a)return e>h+g||i<h-g||r>d+g||s<d-g;if(a.index>u.index){var p=h-a.x-a.vx,v=d-a.y-a.vy,m=p*p+v*v;m<g*g&&(0===p&&(m+=(p=Je(n))*p),0===v&&(m+=(v=Je(n))*v),m=(g-(m=Math.sqrt(m)))/m*o,u.vx+=(p*=m)*(g=(f*=f)/(l+f)),u.vy+=(v*=m)*g,a.vx-=p*(g=1-g),a.vy-=v*g)}}}function a(t){if(t.data)return t.r=r[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function u(){if(e){var n,o,i=e.length;for(r=new Array(i),n=0;n<i;++n)o=e[n],r[o.index]=+t(o,n,e)}}return"function"!=typeof t&&(t=Ke(null==t?1:+t)),s.initialize=function(t,r){e=t,n=r,u()},s.iterations=function(t){return arguments.length?(i=+t,s):i},s.strength=function(t){return arguments.length?(o=+t,s):o},s.radius=function(e){return arguments.length?(t="function"==typeof e?e:Ke(+e),u(),s):t},s}function Ir(t,e,r){var n,o,i,s=Ke(.1);function a(t){for(var s=0,a=n.length;s<a;++s){var u=n[s],h=u.x-e||1e-6,d=u.y-r||1e-6,c=Math.sqrt(h*h+d*d),l=(i[s]-c)*o[s]*t/c;u.vx+=h*l,u.vy+=d*l}}function u(){if(n){var e,r=n.length;for(o=new Array(r),i=new Array(r),e=0;e<r;++e)i[e]=+t(n[e],e,n),o[e]=isNaN(i[e])?0:+s(n[e],e,n)}}return"function"!=typeof t&&(t=Ke(+t)),null==e&&(e=0),null==r&&(r=0),a.initialize=function(t){n=t,u()},a.strength=function(t){return arguments.length?(s="function"==typeof t?t:Ke(+t),u(),a):s},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:Ke(+e),u(),a):t},a.x=function(t){return arguments.length?(e=+t,a):e},a.y=function(t){return arguments.length?(r=+t,a):r},a}function Cr(t){var e,r,n,o=Ke(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Ke(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Ke(+t),s(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:Ke(+e),s(),i):t},i}function Dr(t){var e,r,n,o=Ke(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Ke(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Ke(+t),s(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:Ke(+e),s(),i):t},i}class Pr{constructor(t){this.id="d3-force",this.config={inputNodeAttrs:["x","y","vx","vy","fx","fy"],outputNodeAttrs:["x","y","vx","vy"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource"]},this.forceMap={link:Ze,manyBody:jr,center:Sr,collide:Rr,radial:Ir,x:Cr,y:Dr},this.options={link:{id:t=>t.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},We(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericLayout(!0,e,r)}))}stop(){this.simulation.stop()}tick(t){return this.simulation.tick(t),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(t,e){const r=this.context.nodes.find((e=>e.id===t));r&&e.forEach(((t,e)=>{"number"!=typeof t&&null!==t||(r[["fx","fy","fz"][e]]=t)}))}getOptions(t){var e,r;const n=We({},this.options,t);return n.collide&&void 0===(null===(e=n.collide)||void 0===e?void 0:e.radius)&&(n.collide=n.collide||{},n.collide.radius=null!==(r=n.nodeSize)&&void 0!==r?r:10),void 0===n.iterations&&(n.link&&void 0===n.link.iterations&&(n.iterations=n.link.iterations),n.collide&&void 0===n.collide.iterations&&(n.iterations=n.collide.iterations)),this.context.options=n,n}genericLayout(e,r,n){var o;return t(this,void 0,void 0,(function*(){const t=this.getOptions(n),i=r.getAllNodes().map((({id:t,data:e})=>Object.assign({id:t,data:e},He(e,this.config.inputNodeAttrs)))),s=r.getAllEdges().map((t=>Object.assign({},t)));Object.assign(this.context,{assign:e,nodes:i,edges:s,graph:r});const a=new Promise((t=>{this.resolver=t})),u=this.setSimulation(t);return u.nodes(i),null===(o=u.force("link"))||void 0===o||o.links(s),a}))}getResult(){const{assign:t,nodes:e,edges:r,graph:n}=this.context,o=e.map((t=>({id:t.id,data:Object.assign(Object.assign({},t.data),He(t,this.config.outputNodeAttrs))}))),i=r.map((({id:t,source:e,target:r,data:n})=>({id:t,source:"object"==typeof e?e.id:e,target:"object"==typeof r?r.id:r,data:n})));return t&&o.forEach((t=>n.mergeNodeData(t.id,t.data))),{nodes:o,edges:i}}initSimulation(){return function(t){var e,r=1,n=.001,o=1-Math.pow(n,1/300),i=0,s=.6,a=new Map,u=xr(c),h=ir("tick","end"),d=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Mr)/Mr}();function c(){l(),h.call("tick",e),r<n&&(u.stop(),h.call("end",e))}function l(n){var u,h,d=t.length;void 0===n&&(n=1);for(var c=0;c<n;++c)for(r+=(i-r)*o,a.forEach((function(t){t(r)})),u=0;u<d;++u)null==(h=t[u]).fx?h.x+=h.vx*=s:(h.x=h.fx,h.vx=0),null==h.fy?h.y+=h.vy*=s:(h.y=h.fy,h.vy=0);return e}function f(){for(var e,r=0,n=t.length;r<n;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var o=10*Math.sqrt(.5+r),i=r*Ar;e.x=o*Math.cos(i),e.y=o*Math.sin(i)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function g(e){return e.initialize&&e.initialize(t,d),e}return null==t&&(t=[]),f(),e={tick:l,restart:function(){return u.restart(c),e},stop:function(){return u.stop(),e},nodes:function(r){return arguments.length?(t=r,f(),a.forEach(g),e):t},alpha:function(t){return arguments.length?(r=+t,e):r},alphaMin:function(t){return arguments.length?(n=+t,e):n},alphaDecay:function(t){return arguments.length?(o=+t,e):+o},alphaTarget:function(t){return arguments.length?(i=+t,e):i},velocityDecay:function(t){return arguments.length?(s=1-t,e):1-s},randomSource:function(t){return arguments.length?(d=t,a.forEach(g),e):d},force:function(t,r){return arguments.length>1?(null==r?a.delete(t):a.set(t,g(r)),e):a.get(t)},find:function(e,r,n){var o,i,s,a,u,h=0,d=t.length;for(null==n?n=1/0:n*=n,h=0;h<d;++h)(s=(o=e-(a=t[h]).x)*o+(i=r-a.y)*i)<n&&(u=a,n=s);return u},on:function(t,r){return arguments.length>1?(h.on(t,r),e):h.on(t)}}}()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",(()=>{var e;return null===(e=t.onTick)||void 0===e?void 0:e.call(t,this.getResult())})).on("end",(()=>{var t;return null===(t=this.resolver)||void 0===t?void 0:t.call(this,this.getResult())}))),Tr(e,this.config.simulationAttrs.map((e=>[e,t[e]]))),Object.entries(this.forceMap).forEach((([r,n])=>{const o=r;if(t[r]){let r=e.force(o);r||(r=n(),e.force(o,r)),Tr(r,Object.entries(t[o]))}else e.force(o,null)})),e}}const Tr=(t,e)=>e.reduce(((e,[r,n])=>e[r]&&void 0!==n?e[r].call(t,n):e),t);function Lr(t){return function(){return t}}function Fr(t){return 1e-6*(t()-.5)}function qr(t){return t.index}function Vr(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function Br(t){var e,r,n,o,i,s,a,u=qr,h=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},d=Lr(30),c=1;function l(n){for(var i=0,u=t.length;i<c;++i)for(var h,d,l,f,g,p=0,v=0,m=0,y=0;p<u;++p)d=(h=t[p]).source,v=(l=h.target).x+l.vx-d.x-d.vx||Fr(a),o>1&&(m=l.y+l.vy-d.y-d.vy||Fr(a)),o>2&&(y=l.z+l.vz-d.z-d.vz||Fr(a)),v*=f=((f=Math.sqrt(v*v+m*m+y*y))-r[p])/f*n*e[p],m*=f,y*=f,l.vx-=v*(g=s[p]),o>1&&(l.vy-=m*g),o>2&&(l.vz-=y*g),d.vx+=v*(g=1-g),o>1&&(d.vy+=m*g),o>2&&(d.vz+=y*g)}function f(){if(n){var o,a,h=n.length,d=t.length,c=new Map(n.map(((t,e)=>[u(t,e,n),t])));for(o=0,i=new Array(h);o<d;++o)(a=t[o]).index=o,"object"!=typeof a.source&&(a.source=Vr(c,a.source)),"object"!=typeof a.target&&(a.target=Vr(c,a.target)),i[a.source.index]=(i[a.source.index]||0)+1,i[a.target.index]=(i[a.target.index]||0)+1;for(o=0,s=new Array(d);o<d;++o)a=t[o],s[o]=i[a.source.index]/(i[a.source.index]+i[a.target.index]);e=new Array(d),g(),r=new Array(d),p()}}function g(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+h(t[r],r,t)}function p(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+d(t[e],e,t)}return null==t&&(t=[]),l.initialize=function(t,...e){n=t,a=e.find((t=>"function"==typeof t))||Math.random,o=e.find((t=>[1,2,3].includes(t)))||2,f()},l.links=function(e){return arguments.length?(t=e,f(),l):t},l.id=function(t){return arguments.length?(u=t,l):u},l.iterations=function(t){return arguments.length?(c=+t,l):c},l.strength=function(t){return arguments.length?(h="function"==typeof t?t:Lr(+t),g(),l):h},l.distance=function(t){return arguments.length?(d="function"==typeof t?t:Lr(+t),p(),l):d},l}function $r(t,e,r){if(isNaN(e))return t;var n,o,i,s,a,u,h=t._root,d={data:r},c=t._x0,l=t._x1;if(!h)return t._root=d,t;for(;h.length;)if((s=e>=(o=(c+l)/2))?c=o:l=o,n=h,!(h=h[a=+s]))return n[a]=d,t;if(e===(i=+t._x.call(null,h.data)))return d.next=h,n?n[a]=d:t._root=d,t;do{n=n?n[a]=new Array(2):t._root=new Array(2),(s=e>=(o=(c+l)/2))?c=o:l=o}while((a=+s)==(u=+(i>=o)));return n[u]=h,n[a]=d,t}function Ur(t,e,r){this.node=t,this.x0=e,this.x1=r}function Gr(t){return t[0]}function Wr(t,e){var r=new Yr(null==e?Gr:e,NaN,NaN);return null==t?r:r.addAll(t)}function Yr(t,e,r){this._x=t,this._x0=e,this._x1=r,this._root=void 0}function Hr(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var Kr=Wr.prototype=Yr.prototype;Kr.copy=function(){var t,e,r=new Yr(this._x,this._x0,this._x1),n=this._root;if(!n)return r;if(!n.length)return r._root=Hr(n),r;for(t=[{source:n,target:r._root=new Array(2)}];n=t.pop();)for(var o=0;o<2;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(2)}):n.target[o]=Hr(e));return r},Kr.add=function(t){const e=+this._x.call(null,t);return $r(this.cover(e),e,t)},Kr.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e);let n=1/0,o=-1/0;for(let i,s=0;s<e;++s)isNaN(i=+this._x.call(null,t[s]))||(r[s]=i,i<n&&(n=i),i>o&&(o=i));if(n>o)return this;this.cover(n).cover(o);for(let n=0;n<e;++n)$r(this,r[n],t[n]);return this},Kr.cover=function(t){if(isNaN(t=+t))return this;var e=this._x0,r=this._x1;if(isNaN(e))r=(e=Math.floor(t))+1;else{for(var n,o,i=r-e||1,s=this._root;e>t||t>=r;)switch(o=+(t<e),(n=new Array(2))[o]=s,s=n,i*=2,o){case 0:r=e+i;break;case 1:e=r-i}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._x1=r,this},Kr.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},Kr.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},Kr.find=function(t,e){var r,n,o,i,s,a=this._x0,u=this._x1,h=[],d=this._root;for(d&&h.push(new Ur(d,a,u)),null==e?e=1/0:(a=t-e,u=t+e);i=h.pop();)if(!(!(d=i.node)||(n=i.x0)>u||(o=i.x1)<a))if(d.length){var c=(n+o)/2;h.push(new Ur(d[1],c,o),new Ur(d[0],n,c)),(s=+(t>=c))&&(i=h[h.length-1],h[h.length-1]=h[h.length-1-s],h[h.length-1-s]=i)}else{var l=Math.abs(t-+this._x.call(null,d.data));l<e&&(e=l,a=t-l,u=t+l,r=d.data)}return r},Kr.remove=function(t){if(isNaN(i=+this._x.call(null,t)))return this;var e,r,n,o,i,s,a,u,h,d=this._root,c=this._x0,l=this._x1;if(!d)return this;if(d.length)for(;;){if((a=i>=(s=(c+l)/2))?c=s:l=s,e=d,!(d=d[u=+a]))return this;if(!d.length)break;e[u+1&1]&&(r=e,h=u)}for(;d.data!==t;)if(n=d,!(d=d.next))return this;return(o=d.next)&&delete d.next,n?(o?n.next=o:delete n.next,this):e?(o?e[u]=o:delete e[u],(d=e[0]||e[1])&&d===(e[1]||e[0])&&!d.length&&(r?r[h]=d:this._root=d),this):(this._root=o,this)},Kr.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},Kr.root=function(){return this._root},Kr.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},Kr.visit=function(t){var e,r,n,o,i=[],s=this._root;for(s&&i.push(new Ur(s,this._x0,this._x1));e=i.pop();)if(!t(s=e.node,n=e.x0,o=e.x1)&&s.length){var a=(n+o)/2;(r=s[1])&&i.push(new Ur(r,a,o)),(r=s[0])&&i.push(new Ur(r,n,a))}return this},Kr.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new Ur(this._root,this._x0,this._x1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.x1,u=(s+a)/2;(i=o[0])&&r.push(new Ur(i,s,u)),(i=o[1])&&r.push(new Ur(i,u,a))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.x1);return this},Kr.x=function(t){return arguments.length?(this._x=t,this):this._x};const Jr=4294967296;function Qr(t){return t.x}function Xr(t){return t.y}function Zr(t){return t.z}var tn=Math.PI*(3-Math.sqrt(5)),en=20*Math.PI/(9+Math.sqrt(221));function rn(){var t,e,r,n,o,i,s=Lr(-30),a=1,u=1/0,h=.81;function d(n){var i,s=t.length,a=(1===e?Wr(t,Qr):2===e?ue(t,Qr,Xr):3===e?me(t,Qr,Xr,Zr):null).visitAfter(l);for(o=n,i=0;i<s;++i)r=t[i],a.visit(f)}function c(){if(t){var e,r,n=t.length;for(i=new Array(n),e=0;e<n;++e)r=t[e],i[r.index]=+s(r,e,t)}}function l(t){var r,n,o,s,a,u,h=0,d=0,c=t.length;if(c){for(o=s=a=u=0;u<c;++u)(r=t[u])&&(n=Math.abs(r.value))&&(h+=r.value,d+=n,o+=n*(r.x||0),s+=n*(r.y||0),a+=n*(r.z||0));h*=Math.sqrt(4/c),t.x=o/d,e>1&&(t.y=s/d),e>2&&(t.z=a/d)}else{(r=t).x=r.data.x,e>1&&(r.y=r.data.y),e>2&&(r.z=r.data.z);do{h+=i[r.data.index]}while(r=r.next)}t.value=h}function f(t,s,d,c,l){if(!t.value)return!0;var f=[d,c,l][e-1],g=t.x-r.x,p=e>1?t.y-r.y:0,v=e>2?t.z-r.z:0,m=f-s,y=g*g+p*p+v*v;if(m*m/h<y)return y<u&&(0===g&&(y+=(g=Fr(n))*g),e>1&&0===p&&(y+=(p=Fr(n))*p),e>2&&0===v&&(y+=(v=Fr(n))*v),y<a&&(y=Math.sqrt(a*y)),r.vx+=g*t.value*o/y,e>1&&(r.vy+=p*t.value*o/y),e>2&&(r.vz+=v*t.value*o/y)),!0;if(!(t.length||y>=u)){(t.data!==r||t.next)&&(0===g&&(y+=(g=Fr(n))*g),e>1&&0===p&&(y+=(p=Fr(n))*p),e>2&&0===v&&(y+=(v=Fr(n))*v),y<a&&(y=Math.sqrt(a*y)));do{t.data!==r&&(m=i[t.data.index]*o/y,r.vx+=g*m,e>1&&(r.vy+=p*m),e>2&&(r.vz+=v*m))}while(t=t.next)}}return d.initialize=function(r,...o){t=r,n=o.find((t=>"function"==typeof t))||Math.random,e=o.find((t=>[1,2,3].includes(t)))||2,c()},d.strength=function(t){return arguments.length?(s="function"==typeof t?t:Lr(+t),c(),d):s},d.distanceMin=function(t){return arguments.length?(a=t*t,d):Math.sqrt(a)},d.distanceMax=function(t){return arguments.length?(u=t*t,d):Math.sqrt(u)},d.theta=function(t){return arguments.length?(h=t*t,d):Math.sqrt(h)},d}function nn(t,e,r){var n,o=1;function i(){var i,s,a=n.length,u=0,h=0,d=0;for(i=0;i<a;++i)u+=(s=n[i]).x||0,h+=s.y||0,d+=s.z||0;for(u=(u/a-t)*o,h=(h/a-e)*o,d=(d/a-r)*o,i=0;i<a;++i)s=n[i],u&&(s.x-=u),h&&(s.y-=h),d&&(s.z-=d)}return null==t&&(t=0),null==e&&(e=0),null==r&&(r=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.z=function(t){return arguments.length?(r=+t,i):r},i.strength=function(t){return arguments.length?(o=+t,i):o},i}function on(t){return t.x+t.vx}function sn(t){return t.y+t.vy}function an(t){return t.z+t.vz}function un(t){var e,r,n,o,i=1,s=1;function a(){for(var t,a,h,d,c,l,f,g,p=e.length,v=0;v<s;++v)for(a=(1===r?Wr(e,on):2===r?ue(e,on,sn):3===r?me(e,on,sn,an):null).visitAfter(u),t=0;t<p;++t)h=e[t],f=n[h.index],g=f*f,d=h.x+h.vx,r>1&&(c=h.y+h.vy),r>2&&(l=h.z+h.vz),a.visit(m);function m(t,e,n,s,a,u,p){var v=[e,n,s,a,u,p],m=v[0],y=v[1],w=v[2],x=v[r],b=v[r+1],E=v[r+2],N=t.data,M=t.r,_=f+M;if(!N)return m>d+_||x<d-_||r>1&&(y>c+_||b<c-_)||r>2&&(w>l+_||E<l-_);if(N.index>h.index){var k=d-N.x-N.vx,A=r>1?c-N.y-N.vy:0,j=r>2?l-N.z-N.vz:0,S=k*k+A*A+j*j;S<_*_&&(0===k&&(S+=(k=Fr(o))*k),r>1&&0===A&&(S+=(A=Fr(o))*A),r>2&&0===j&&(S+=(j=Fr(o))*j),S=(_-(S=Math.sqrt(S)))/S*i,h.vx+=(k*=S)*(_=(M*=M)/(g+M)),r>1&&(h.vy+=(A*=S)*_),r>2&&(h.vz+=(j*=S)*_),N.vx-=k*(_=1-_),r>1&&(N.vy-=A*_),r>2&&(N.vz-=j*_))}}}function u(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<Math.pow(2,r);++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function h(){if(e){var r,o,i=e.length;for(n=new Array(i),r=0;r<i;++r)o=e[r],n[o.index]=+t(o,r,e)}}return"function"!=typeof t&&(t=Lr(null==t?1:+t)),a.initialize=function(t,...n){e=t,o=n.find((t=>"function"==typeof t))||Math.random,r=n.find((t=>[1,2,3].includes(t)))||2,h()},a.iterations=function(t){return arguments.length?(s=+t,a):s},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:Lr(+e),h(),a):t},a}function hn(t,e,r,n){var o,i,s,a,u=Lr(.1);function h(t){for(var u=0,h=o.length;u<h;++u){var d=o[u],c=d.x-e||1e-6,l=(d.y||0)-r||1e-6,f=(d.z||0)-n||1e-6,g=Math.sqrt(c*c+l*l+f*f),p=(a[u]-g)*s[u]*t/g;d.vx+=c*p,i>1&&(d.vy+=l*p),i>2&&(d.vz+=f*p)}}function d(){if(o){var e,r=o.length;for(s=new Array(r),a=new Array(r),e=0;e<r;++e)a[e]=+t(o[e],e,o),s[e]=isNaN(a[e])?0:+u(o[e],e,o)}}return"function"!=typeof t&&(t=Lr(+t)),null==e&&(e=0),null==r&&(r=0),null==n&&(n=0),h.initialize=function(t,...e){o=t,i=e.find((t=>[1,2,3].includes(t)))||2,d()},h.strength=function(t){return arguments.length?(u="function"==typeof t?t:Lr(+t),d(),h):u},h.radius=function(e){return arguments.length?(t="function"==typeof e?e:Lr(+e),d(),h):t},h.x=function(t){return arguments.length?(e=+t,h):e},h.y=function(t){return arguments.length?(r=+t,h):r},h.z=function(t){return arguments.length?(n=+t,h):n},h}function dn(t){var e,r,n,o=Lr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Lr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Lr(+t),s(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:Lr(+e),s(),i):t},i}function cn(t){var e,r,n,o=Lr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Lr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Lr(+t),s(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:Lr(+e),s(),i):t},i}function ln(t){var e,r,n,o=Lr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vz+=(n[i]-o.z)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Lr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Lr(+t),s(),i):o},i.z=function(e){return arguments.length?(t="function"==typeof e?e:Lr(+e),s(),i):t},i}var fn=r(4341),gn=r.n(fn);class pn{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,pn.defaultOptions,t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,e,Object.assign(Object.assign({},this.options),r))}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,e,Object.assign(Object.assign({},this.options),r))}))}genericDagreLayout(e,r,n){return t(this,void 0,void 0,(function*(){const{nodeSize:t}=n,o=new fn.graphlib.Graph;o.setGraph(n),o.setDefaultEdgeLabel((()=>({}))),[...r.getAllNodes(),...r.getAllEdges()].some((({id:t})=>c(t)))&&console.error("Dagre layout only support string id, it will convert number to string."),r.getAllNodes().forEach((e=>{const{id:r}=e,n=Object.assign({},e.data);if(void 0!==t){const[r,o]=function(t){if(!t)return[0,0,0];if(c(t))return[t,t,t];if(0===t.length)return[0,0,0];const[e,r=e,n=e]=t;return[e,r,n]}($t(t)?t(e):t);Object.assign(n,{width:r,height:o})}o.setNode(r.toString(),n)})),r.getAllEdges().forEach((({id:t,source:e,target:r})=>{o.setEdge(e.toString(),r.toString(),{id:t})})),gn().layout(o);const i={nodes:[],edges:[]};return o.nodes().forEach((t=>{const n=o.node(t);i.nodes.push({id:t,data:n}),e&&r.mergeNodeData(t,n)})),o.edges().forEach((t=>{const n=o.edge(t),{id:s}=n,a=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(n,["id"]),{v:u,w:h}=t;i.edges.push({id:s,source:u,target:h,data:a}),e&&r.mergeEdgeData(s,a)})),i}))}}pn.defaultOptions={};class vn{constructor(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}distanceTo(t){const e=this.rx-t.rx,r=this.ry-t.ry;return Math.hypot(e,r)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,r=t.ry-this.ry;let n=Math.hypot(e,r);n=n<1e-4?1e-4:n;const o=this.g*(this.degree+1)*(t.degree+1)/n;this.fx+=o*e/n,this.fy+=o*r/n}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,r=(this.rx*this.mass+t.rx*t.mass)/e,n=(this.ry*this.mass+t.ry*t.mass)/e,o=this.degree+t.degree;return new vn({rx:r,ry:n,mass:e,degree:o})}}class mn{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const r=this.length/2;return t<=this.xmid+r&&t>=this.xmid-r&&e<=this.ymid+r&&e>=this.ymid-r}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new mn({xmid:t,ymid:e,length:r})}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new mn({xmid:t,ymid:e,length:r})}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new mn({xmid:t,ymid:e,length:r})}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new mn({xmid:t,ymid:e,length:r})}}class yn{constructor(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}insert(t){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new yn(this.quad.NW()),this.NE=new yn(this.quad.NE()),this.SW=new yn(this.quad.SW()),this.SE=new yn(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t)):this.body=t}_putBody(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))}_isExternal(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE}updateForce(t){null!=this.body&&t!==this.body&&(this._isExternal()||(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t)))}}const wn={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1},xn={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},bn={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300},En=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;return null==e?r=Math.min(n,o):Math.min(n,o)===t.rows?t.rows=e:t.cols=e,r},Nn=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;return null==e?r=Math.max(n,o):Math.max(n,o)===t.rows?t.rows=e:t.cols=e,r},Mn=(t,e)=>t[`c-${e.row}-${e.col}`]||!1,_n=(t,e)=>t[`c-${e.row}-${e.col}`]=!0,kn=(t,e)=>{const r=t.cols||5;e.col++,e.col>=r&&(e.col=0,e.row++)},An=(t,e,r,n,o,i,s,a)=>{let u,h;const d=o[t.id];if(d)u=d.col*r+r/2+e[0],h=d.row*n+n/2+e[1];else{for(;Mn(a,s);)kn(i,s);u=s.col*r+r/2+e[0],h=s.row*n+n/2+e[1],_n(a,s),kn(i,s)}t.data.x=u,t.data.y=h},jn={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},Sn=(t,e,r,n,o,i)=>{e.forEach(((s,a)=>{r[a]={x:0,y:0},e.forEach(((e,u)=>{if(a===u)return;if(o[a]!==o[u])return;let h=s.x-e.x,d=s.y-e.y,c=Math.sqrt(h*h+d*d);if(0===c){c=1;const t=a>u?1:-1;h=.01*t,d=.01*t}if(c<i(t[a])/2+i(t[u])/2){const t=n*n/c;r[a].x+=h/c*t,r[a].y+=d/c*t}}))}))},On=(t,e,r,n,o,i,s,a)=>{const u=i||s/10;return n&&e.forEach(((e,r)=>{const n=t[r].x-t[o].x,i=t[r].y-t[o].y,s=Math.sqrt(n*n+i*i);let a=i/s,u=-n/s;const h=Math.sqrt(e.x*e.x+e.y*e.y);let d=Math.acos((a*e.x+u*e.y)/h);d>Math.PI/2&&(d-=Math.PI/2,a*=-1,u*=-1);const c=Math.cos(d)*h;e.x=a*c,e.y=u*c})),t.forEach(((i,s)=>{if(s===o)return;const h=Math.sqrt(e[s].x*e[s].x+e[s].y*e[s].y);if(h>0&&s!==o){const d=Math.min(u*(r/800),h);if(i.x+=e[s].x/h*d,i.y+=e[s].y/h*d,n){let e=i.x-t[o].x,r=i.y-t[o].y;const n=Math.sqrt(e*e+r*r);e=e/n*a[s],r=r/n*a[s],i.x=t[o].x+e,i.y=t[o].y+r}}})),t},zn={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10},Rn={center:[0,0],width:300,height:300},In={circular:class{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},Xt),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericCircularLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericCircularLayout(!0,e,r)}))}genericCircularLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{width:o,height:i,center:s,divisions:a,startAngle:u=0,endAngle:h=2*Math.PI,angleRatio:d,ordering:c,clockwise:l,nodeSpacing:f,nodeSize:g}=t,p=r.getAllNodes(),v=r.getAllEdges(),[m,y,w]=((t,e,r)=>{let n=t,o=e,i=r;return n||"undefined"==typeof window||(n=window.innerWidth),o||"undefined"==typeof window||(o=window.innerHeight),i||(i=[n/2,o/2]),[n,o,i]})(o,i,s),x=null==p?void 0:p.length;if(!x||1===x)return Qt(r,e,w);const b=(h-u)/x;let{radius:E,startRadius:N,endRadius:M}=t;if(f){const t=Gt(10,f),e=Wt(10,g);let r=-1/0;p.forEach((t=>{const n=e(t);r<n&&(r=n)}));let n=0;p.forEach(((e,o)=>{n+=0===o?r||10:(t(e)||0)+(r||10)})),E=n/(2*Math.PI)}else E||N||M?!N&&M?N=M:N&&!M&&(M=N):E=Math.min(y,m)/2;const _=b*d;let k=[];k="topology"===c?Zt(r,p):"topology-directed"===c?Zt(r,p,!0):"degree"===c?function(t,e){const r=[];return e.forEach(((t,e)=>{r.push(Kt(t))})),r.sort(((e,r)=>t.getDegree(e.id,"both")-t.getDegree(r.id,"both"))),r}(r,p):p.map((t=>Kt(t)));const A=Math.ceil(x/a);for(let t=0;t<x;++t){let e=E;e||null===N||null===M||(e=N+t*(M-N)/(x-1)),e||(e=10+100*t/(x-1));let r=u+t%A*_+2*Math.PI/a*Math.floor(t/A);l||(r=h-t%A*_-2*Math.PI/a*Math.floor(t/A)),k[t].data.x=w[0]+Math.cos(r)*e,k[t].data.y=w[1]+Math.sin(r)*e}return e&&k.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),{nodes:k,edges:v}}))}},concentric:ne,mds:Le,random:class{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},Rn),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericRandomLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){this.genericRandomLayout(!0,e,r)}))}genericRandomLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{center:o,width:i,height:s}=t,a=r.getAllNodes(),u=i||"undefined"==typeof window?i:window.innerWidth,h=s||"undefined"==typeof window?s:window.innerHeight,d=o||[u/2,h/2],c=[];return a&&a.forEach((t=>{c.push({id:t.id,data:{x:.9*(Math.random()-.5)*u+d[0],y:.9*(Math.random()-.5)*h+d[1]}})})),e&&c.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:c,edges:r.getAllEdges()}}))}},grid:class{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},bn),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericGridLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){this.genericGridLayout(!0,e,r)}))}genericGridLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{begin:o=[0,0],condense:i,preventOverlapPadding:s,preventOverlap:a,rows:u,cols:h,nodeSpacing:d,nodeSize:l,width:f,height:g,position:p}=t;let{sortBy:v}=t;const m=r.getAllNodes(),y=r.getAllEdges(),w=null==m?void 0:m.length;if(!w||1===w)return Qt(r,e,o);const x=m.map((t=>Kt(t)));"id"===v||te(v)&&void 0!==x[0].data[v]||(v="degree"),"degree"===v?x.sort(((t,e)=>r.getDegree(e.id,"both")-r.getDegree(t.id,"both"))):"id"===v?x.sort(((t,e)=>c(e.id)&&c(t.id)?e.id-t.id:`${t.id}`.localeCompare(`${e.id}`))):x.sort(((t,e)=>e.data[v]-t.data[v]));const b=f||"undefined"==typeof window?f:window.innerWidth,E=g||"undefined"==typeof window?g:window.innerHeight,N=w,M={rows:u,cols:h};if(null!=u&&null!=h)M.rows=u,M.cols=h;else if(null!=u&&null==h)M.rows=u,M.cols=Math.ceil(N/M.rows);else if(null==u&&null!=h)M.cols=h,M.rows=Math.ceil(N/M.cols);else{const t=Math.sqrt(N*E/b);M.rows=Math.round(t),M.cols=Math.round(b/E*t)}if(M.rows=Math.max(M.rows,1),M.cols=Math.max(M.cols,1),M.cols*M.rows>N){const t=En(M),e=Nn(M);(t-1)*e>=N?En(M,t-1):(e-1)*t>=N&&Nn(M,e-1)}else for(;M.cols*M.rows<N;){const t=En(M),e=Nn(M);(e+1)*t>=N?Nn(M,e+1):En(M,t+1)}let _=i?0:b/M.cols,k=i?0:E/M.rows;if(a||d){const t=Gt(10,d),e=Wt(30,l,!1);x.forEach((n=>{n.data.x&&n.data.y||(n.data.x=0,n.data.y=0);const o=r.getNode(n.id),i=e(o)||30;let a,u;ee(i)?(a=i[0],u=i[1]):(a=i,u=i);const h=void 0!==t?t(n):s,d=a+h,c=u+h;_=Math.max(_,d),k=Math.max(k,c)}))}const A={},j={row:0,col:0},S={};for(let t=0;t<x.length;t++){const e=x[t];let n;if(p&&(n=p(r.getNode(e.id))),n&&(void 0!==n.row||void 0!==n.col)){const t={row:n.row,col:n.col};if(void 0===t.col)for(t.col=0;Mn(A,t);)t.col++;else if(void 0===t.row)for(t.row=0;Mn(A,t);)t.row++;S[e.id]=t,_n(A,t)}An(e,o,_,k,S,M,j,A)}const O={nodes:x,edges:y};return e&&x.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),O}))}},radial:class{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},zn),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericRadialLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){this.genericRadialLayout(!0,e,r)}))}genericRadialLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{width:o,height:i,center:s,focusNode:a,unitRadius:u,nodeSize:h,nodeSpacing:d,strictRadial:c,preventOverlap:l,maxPreventOverlapIteration:f,sortBy:g,linkDistance:p=50,sortStrength:v=10,maxIteration:m=1e3}=t,y=r.getAllNodes(),w=r.getAllEdges(),x=o||"undefined"==typeof window?o:window.innerWidth,b=i||"undefined"==typeof window?i:window.innerHeight,E=s||[x/2,b/2];if(!(null==y?void 0:y.length)||1===y.length)return Qt(r,e,E);let N=y[0];if(te(a)){for(let t=0;t<y.length;t++)if(y[t].id===a){N=y[t];break}}else N=a||y[0];const M=((t,e)=>{let r=-1;return t.forEach(((t,n)=>{t.id===e&&(r=n)})),Math.max(r,0)})(y,N.id),_=Ce({nodes:y,edges:w},!1),k=Ie(_),A=((t,e)=>{let r=0;for(let n=0;n<t[e].length;n++)t[e][n]!==1/0&&(r=t[e][n]>r?t[e][n]:r);return r})(k,M);((t,e,r)=>{const n=t.length;for(let o=0;o<n;o++)if(t[e][o]===1/0){t[e][o]=r,t[o][e]=r;for(let i=0;i<n;i++)t[o][i]!==1/0&&t[e][i]===1/0&&(t[e][i]=r+t[o][i],t[i][e]=r+t[o][i])}for(let r=0;r<n;r++)if(r!==e)for(let o=0;o<n;o++)if(t[r][o]===1/0){let n=Math.abs(t[e][r]-t[e][o]);n=0===n?1:n,t[r][o]=n}})(k,M,A+1);const j=k[M];let S=x-E[0]>E[0]?E[0]:x-E[0],O=b-E[1]>E[1]?E[1]:b-E[1];0===S&&(S=x/2),0===O&&(O=b/2);const z=Math.min(S,O),R=Math.max(...j),I=[],C=u||z/R;j.forEach(((t,e)=>{I[e]=t*C}));const D=((t,e,r,n,o,i,s)=>{if(!t)return[];const a=[];if(e){const u={};e.forEach(((e,h)=>{const d=[];e.forEach(((e,a)=>{var c,l;if(h===a)d.push(0);else if(n[h]===n[a])if("data"===i)d.push(e*(Math.abs(h-a)*s)/(n[h]/o));else if(i){let r,f;if(u[t[h].id])r=u[t[h].id];else{const e=("id"===i?t[h].id:null===(c=t[h].data)||void 0===c?void 0:c[i])||0;r=te(e)?e.charCodeAt(0):e,u[t[h].id]=r}if(u[t[a].id])f=u[t[a].id];else{const e=("id"===i?t[a].id:null===(l=t[a].data)||void 0===l?void 0:l[i])||0;f=te(e)?e.charCodeAt(0):e,u[t[a].id]=f}d.push(e*(Math.abs(r-f)*s)/(n[h]/o))}else d.push(e*r/(n[h]/o));else{const t=(r+o)/2;d.push(e*t)}})),a.push(d)}))}return a})(y,k,p,I,C,g,v),P=(t=>{const e=t.length,r=t[0].length,n=[];for(let o=0;o<e;o++){const e=[];for(let n=0;n<r;n++)0!==t[o][n]?e.push(1/(t[o][n]*t[o][n])):e.push(0);n.push(e)}return n})(D),T=((t,e,r)=>{try{const r=ze.mul(ze.pow(e,2),-.5),n=r.mean("row"),o=r.mean("column"),i=r.mean();r.add(i).subRowVector(n).subColumnVector(o);const s=new Re(r),a=ze.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map((e=>ze.mul([e],[a]).toJSON()[0].splice(0,t)))}catch(t){const n=[];for(let t=0;t<e.length;t++){const t=Math.random()*r,e=Math.random()*r;n.push([t,e])}return n}})(p,D,p);let L,F=T.map((([t,e])=>({x:(isNaN(t)?Math.random()*p:t)-T[M][0],y:(isNaN(e)?Math.random()*p:e)-T[M][1]})));if(this.run(m,F,P,D,I,M),l){L=Yt(h,d);const t={nodes:y,nodeSizeFunc:L,positions:F,radii:I,height:b,width:x,strictRadial:Boolean(c),focusIdx:M,iterations:f||200,k:F.length/4.5};F=((t,e)=>{const r=Object.assign(Object.assign({},jn),e),{positions:n,iterations:o,width:i,k:s,speed:a=100,strictRadial:u,focusIdx:h,radii:d=[],nodeSizeFunc:c}=r,l=t.getAllNodes(),f=[],g=i/10;for(let t=0;t<o;t++)n.forEach(((t,e)=>{f[e]={x:0,y:0}})),Sn(l,n,f,s,d,c),On(n,f,a,u,h,g,i,d);return n})(r,t)}const q=[];return F.forEach(((t,e)=>{const r=Kt(y[e]);r.data.x=t.x+E[0],r.data.y=t.y+E[1],q.push(r)})),e&&q.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:q,edges:w}}))}run(t,e,r,n,o,i){for(let s=0;s<=t;s++){const a=s/t;this.oneIteration(a,e,o,n,r,i)}}oneIteration(t,e,r,n,o,i){const s=1-t;e.forEach(((a,u)=>{const h=De(a,{x:0,y:0}),d=0===h?0:1/h;if(u===i)return;let c=0,l=0,f=0;e.forEach(((t,e)=>{if(u===e)return;const r=De(a,t),i=0===r?0:1/r,s=n[e][u];f+=o[u][e],c+=o[u][e]*(t.x+s*(a.x-t.x)*i),l+=o[u][e]*(t.y+s*(a.y-t.y)*i)}));const g=0===r[u]?0:1/r[u];f*=s,f+=t*g*g,c*=s,c+=t*g*a.x*d,a.x=c/f,l*=s,l+=t*g*a.y*d,a.y=l/f}))}},force:Me,d3force:Pr,"d3-force-3d":class extends Pr{constructor(){super(...arguments),this.id="d3-force-3d",this.config={inputNodeAttrs:["x","y","z","vx","vy","vz","fx","fy","fz"],outputNodeAttrs:["x","y","z","vx","vy","vz"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource","numDimensions"]},this.forceMap={link:Br,manyBody:rn,center:nn,collide:un,radial:hn,x:dn,y:cn,z:ln},this.options={numDimensions:3,link:{id:t=>t.id},manyBody:{},center:{x:0,y:0,z:0}}}initSimulation(){return function(t,e){e=e||2;var r,n=Math.min(3,Math.max(1,Math.round(e))),o=1,i=.001,s=1-Math.pow(i,1/300),a=0,u=.6,h=new Map,d=xr(f),c=ir("tick","end"),l=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Jr)/Jr}();function f(){g(),c.call("tick",r),o<i&&(d.stop(),c.call("end",r))}function g(e){var i,d,c=t.length;void 0===e&&(e=1);for(var l=0;l<e;++l)for(o+=(a-o)*s,h.forEach((function(t){t(o)})),i=0;i<c;++i)null==(d=t[i]).fx?d.x+=d.vx*=u:(d.x=d.fx,d.vx=0),n>1&&(null==d.fy?d.y+=d.vy*=u:(d.y=d.fy,d.vy=0)),n>2&&(null==d.fz?d.z+=d.vz*=u:(d.z=d.fz,d.vz=0));return r}function p(){for(var e,r=0,o=t.length;r<o;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),null!=e.fz&&(e.z=e.fz),isNaN(e.x)||n>1&&isNaN(e.y)||n>2&&isNaN(e.z)){var i=10*(n>2?Math.cbrt(.5+r):n>1?Math.sqrt(.5+r):r),s=r*tn,a=r*en;1===n?e.x=i:2===n?(e.x=i*Math.cos(s),e.y=i*Math.sin(s)):(e.x=i*Math.sin(s)*Math.cos(a),e.y=i*Math.cos(s),e.z=i*Math.sin(s)*Math.sin(a))}(isNaN(e.vx)||n>1&&isNaN(e.vy)||n>2&&isNaN(e.vz))&&(e.vx=0,n>1&&(e.vy=0),n>2&&(e.vz=0))}}function v(e){return e.initialize&&e.initialize(t,l,n),e}return null==t&&(t=[]),p(),r={tick:g,restart:function(){return d.restart(f),r},stop:function(){return d.stop(),r},numDimensions:function(t){return arguments.length?(n=Math.min(3,Math.max(1,Math.round(t))),h.forEach(v),r):n},nodes:function(e){return arguments.length?(t=e,p(),h.forEach(v),r):t},alpha:function(t){return arguments.length?(o=+t,r):o},alphaMin:function(t){return arguments.length?(i=+t,r):i},alphaDecay:function(t){return arguments.length?(s=+t,r):+s},alphaTarget:function(t){return arguments.length?(a=+t,r):a},velocityDecay:function(t){return arguments.length?(u=1-t,r):1-u},randomSource:function(t){return arguments.length?(l=t,h.forEach(v),r):l},force:function(t,e){return arguments.length>1?(null==e?h.delete(t):h.set(t,v(e)),r):h.get(t)},find:function(){var e,r,o,i,s,a,u=Array.prototype.slice.call(arguments),h=u.shift()||0,d=(n>1?u.shift():null)||0,c=(n>2?u.shift():null)||0,l=u.shift()||1/0,f=0,g=t.length;for(l*=l,f=0;f<g;++f)(i=(e=h-(s=t[f]).x)*e+(r=d-(s.y||0))*r+(o=c-(s.z||0))*o)<l&&(a=s,l=i);return a},on:function(t,e){return arguments.length>1?(c.on(t,e),r):c.on(t)}}}()}},fruchterman:class{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},xn),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericFruchtermanLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){this.genericFruchtermanLayout(!0,e,r)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;e<t;e++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericFruchtermanLayout(e,r,n){return t(this,void 0,void 0,(function*(){if(this.running)return;const t=this.formatOptions(n),{dimensions:o,width:i,height:s,center:a,clustering:h,nodeClusterBy:d,maxIteration:c,onTick:l}=t,f=r.getAllNodes(),g=r.getAllEdges();if(!(null==f?void 0:f.length)){const t={nodes:[],edges:g};return this.lastResult=t,t}if(1===f.length){e&&r.mergeNodeData(f[0].id,{x:a[0],y:a[1],z:3===o?a[2]:void 0});const t={nodes:[Object.assign(Object.assign({},f[0]),{data:Object.assign(Object.assign({},f[0].data),{x:a[0],y:a[1],z:3===o?a[2]:void 0})})],edges:g};return this.lastResult=t,t}const p=f.map((t=>Kt(t,[i,s]))),v=new u({nodes:p,edges:g}),m={};if(h&&p.forEach((t=>{const e=t.data[d];m[e]||(m[e]={name:e,cx:0,cy:0,count:0})})),this.lastLayoutNodes=p,this.lastLayoutEdges=g,this.lastAssign=e,this.lastGraph=v,this.lastOptions=t,this.lastClusterMap=m,"undefined"==typeof window)return;let y=0;return new Promise((n=>{this.timeInterval=window.setInterval((()=>{this.running?(this.runOneStep(v,m,t),e&&p.forEach((({id:t,data:e})=>r.mergeNodeData(t,{x:e.x,y:e.y,z:3===o?e.z:void 0}))),null==l||l({nodes:p,edges:g}),y++,y>=c&&(window.clearInterval(this.timeInterval),n({nodes:p,edges:g}))):n({nodes:p,edges:g})}),0),this.running=!0}))}))}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:r,nodeClusterBy:n}=e,{center:o,width:i,height:s}=e;return e.width=i||"undefined"==typeof window?i:window.innerWidth,e.height=s||"undefined"==typeof window?s:window.innerHeight,e.center=o||[e.width/2,e.height/2],e.clustering=r&&!!n,e}runOneStep(t,e,r){const{dimensions:n,height:o,width:i,gravity:s,center:a,speed:u,clustering:h,nodeClusterBy:d,clusterGravity:l}=r,f=o*i,g=Math.sqrt(f)/10,p=t.getAllNodes(),v=f/(p.length+1),m=Math.sqrt(v),y={};if(this.applyCalculate(t,y,m,v),h){for(const t in e)e[t].cx=0,e[t].cy=0,e[t].count=0;p.forEach((t=>{const{data:r}=t,n=e[r[d]];c(r.x)&&(n.cx+=r.x),c(r.y)&&(n.cy+=r.y),n.count++}));for(const t in e)e[t].cx/=e[t].count,e[t].cy/=e[t].count;const t=l||s;p.forEach(((r,n)=>{const{id:o,data:i}=r;if(!c(i.x)||!c(i.y))return;const s=e[i[d]],a=Math.sqrt((i.x-s.cx)*(i.x-s.cx)+(i.y-s.cy)*(i.y-s.cy)),u=m*t;y[o].x-=u*(i.x-s.cx)/a,y[o].y-=u*(i.y-s.cy)/a}))}p.forEach(((t,e)=>{const{id:r,data:o}=t;if(!c(o.x)||!c(o.y))return;const i=.01*m*s;y[r].x-=i*(o.x-a[0]),y[r].y-=i*(o.y-a[1]),3===n&&(y[r].z-=i*(o.z-a[2]))})),p.forEach(((e,r)=>{const{id:o,data:i}=e;if(c(i.fx)&&c(i.fy))return i.x=i.fx,i.y=i.fy,void(3===n&&(i.z=i.fz));if(!c(i.x)||!c(i.y))return;const s=Math.sqrt(y[o].x*y[o].x+y[o].y*y[o].y+(3===n?y[o].z*y[o].z:0));if(s>0){const e=Math.min(g*(u/800),s);t.mergeNodeData(o,{x:i.x+y[o].x/s*e,y:i.y+y[o].y/s*e,z:3===n?i.z+y[o].z/s*e:void 0})}}))}applyCalculate(t,e,r,n){this.calRepulsive(t,e,n),this.calAttractive(t,e,r)}calRepulsive(t,e,r){const n=t.getAllNodes();n.forEach((({data:t,id:o},i)=>{e[o]={x:0,y:0,z:0},n.forEach((({data:n,id:s},a)=>{if(i<=a||!c(t.x)||!c(n.x)||!c(t.y)||!c(n.y))return;let u=t.x-n.x,h=t.y-n.y,d=3===this.options.dimensions?t.z-n.z:0,l=u*u+h*h+d*d;0===l&&(l=1,u=.01,h=.01,d=.01);const f=r/l,g=u*f,p=h*f,v=d*f;e[o].x+=g,e[o].y+=p,e[s].x-=g,e[s].y-=p,3===this.options.dimensions&&(e[o].z+=v,e[s].z-=v)}))}))}calAttractive(t,e,r){t.getAllEdges().forEach((n=>{const{source:o,target:i}=n;if(!o||!i||o===i)return;const{data:s}=t.getNode(o),{data:a}=t.getNode(i);if(!(c(a.x)&&c(s.x)&&c(a.y)&&c(s.y)))return;const u=a.x-s.x,h=a.y-s.y,d=3===this.options.dimensions?a.z-s.z:0,l=Math.sqrt(u*u+h*h+d*d)/r,f=u*l,g=h*l,p=d*l;e[o].x+=f,e[o].y+=g,e[i].x-=f,e[i].y-=g,3===this.options.dimensions&&(e[o].z+=p,e[i].z-=p)}))}},forceAtlas2:class{constructor(t={}){this.options=t,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},wn),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericForceAtlas2Layout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){this.genericForceAtlas2Layout(!0,e,r)}))}genericForceAtlas2Layout(e,r,n){return t(this,void 0,void 0,(function*(){const t=r.getAllEdges(),o=r.getAllNodes(),i=this.formatOptions(n,o.length),{width:s,height:a,prune:h,maxIteration:d,nodeSize:c,center:l}=i;if(!(null==o?void 0:o.length)||1===o.length)return Qt(r,e,l);const f=o.map((t=>Kt(t,[s,a]))),g=t.filter((t=>{const{source:e,target:r}=t;return e!==r})),p=new u({nodes:f,edges:g}),v=this.getSizes(p,r,c);if(this.run(p,r,d,v,e,i),h){for(let t=0;t<g.length;t+=1){const{source:e,target:r}=g[t],n=p.getDegree(e),o=p.getDegree(e);if(n<=1){const t=p.getNode(r);p.mergeNodeData(e,{x:t.data.x,y:t.data.y})}else if(o<=1){const t=p.getNode(e);p.mergeNodeData(r,{x:t.data.x,y:t.data.y})}}const t=Object.assign(Object.assign({},i),{prune:!1,barnesHut:!1});this.run(p,r,100,v,e,t)}return{nodes:f,edges:t}}))}getSizes(t,e,r){const n=t.getAllNodes(),o={};for(let t=0;t<n.length;t+=1){const{id:i,data:s}=n[t];if(o[i]=10,c(s.size))o[i]=s.size;else if(ee(s.size))isNaN(s.size[0])||(o[i]=Math.max(s.size[0])),isNaN(s.size[1])||(o[i]=Math.max(s.size[1]));else if(Ut(s.size))o[i]=Math.max(s.size.width,s.size.height);else if($t(r)){const t=r(e.getNode(i));ee(t)?o[i]=Math.max(...t):o[i]=t}else ee(r)?o[i]=Math.max(...r):c(r)&&(o[i]=r)}return o}formatOptions(t={},e){const r=Object.assign(Object.assign({},this.options),t),{center:n,width:o,height:i,barnesHut:s,prune:a,maxIteration:u,kr:h,kg:d}=r;return r.width=o||"undefined"==typeof window?o:window.innerWidth,r.height=i||"undefined"==typeof window?i:window.innerHeight,r.center=n||[r.width/2,r.height/2],void 0===s&&e>250&&(r.barnesHut=!0),void 0===a&&e>100&&(r.prune=!0),0!==u||a?0===u&&a&&(r.maxIteration=100,e<=200&&e>100?r.maxIteration=500:e>200&&(r.maxIteration=950)):(r.maxIteration=250,e<=200&&e>100?r.maxIteration=1e3:e>200&&(r.maxIteration=1200)),h||(r.kr=50,e>100&&e<=500?r.kr=20:e>500&&(r.kr=1)),d||(r.kg=20,e>100&&e<=500?r.kg=10:e>500&&(r.kg=1)),r}run(t,e,r,n,o,i){const{kr:s,barnesHut:a,onTick:u}=i,h=t.getAllNodes();let d=0,c=r;const l={},f={},g={};for(let e=0;e<h.length;e+=1){const{data:r,id:n}=h[e];if(l[n]=[0,0],a){const o={id:e,rx:r.x,ry:r.y,mass:1,g:s,degree:t.getDegree(n)};g[n]=new vn(o)}}for(;c>0;)d=this.oneStep(t,{iter:c,preventOverlapIters:50,krPrime:100,sg:d,forces:l,preForces:f,bodies:g,sizes:n},i),c--,null==u||u({nodes:h,edges:e.getAllEdges()});return t}oneStep(t,e,r){const{iter:n,preventOverlapIters:o,krPrime:i,sg:s,preForces:a,bodies:u,sizes:h}=e;let{forces:d}=e;const{preventOverlap:c,barnesHut:l}=r,f=t.getAllNodes();for(let t=0;t<f.length;t+=1){const{id:e}=f[t];a[e]=[...d[e]],d[e]=[0,0]}return d=this.getAttrForces(t,n,o,h,d,r),d=l&&(c&&n>o||!c)?this.getOptRepGraForces(t,d,u,r):this.getRepGraForces(t,n,o,d,i,h,r),this.updatePos(t,d,a,s,r)}getAttrForces(t,e,r,n,o,i){const{preventOverlap:s,dissuadeHubs:a,mode:u,prune:h}=i,d=t.getAllEdges();for(let i=0;i<d.length;i+=1){const{source:c,target:l}=d[i],f=t.getNode(c),g=t.getNode(l),p=t.getDegree(c),v=t.getDegree(l);if(h&&(p<=1||v<=1))continue;const m=[g.data.x-f.data.x,g.data.y-f.data.y];let y=Math.hypot(m[0],m[1]);y=y<1e-4?1e-4:y,m[0]=m[0]/y,m[1]=m[1]/y,s&&e<r&&(y=y-n[c]-n[l]);let w=y,x=w;"linlog"===u&&(w=Math.log(1+y),x=w),a&&(w=y/p,x=y/v),s&&e<r&&y<=0?(w=0,x=0):s&&e<r&&y>0&&(w=y,x=y),o[c][0]+=w*m[0],o[l][0]-=x*m[0],o[c][1]+=w*m[1],o[l][1]-=x*m[1]}return o}getOptRepGraForces(t,e,r,n){const{kg:o,center:i,prune:s}=n,a=t.getAllNodes(),u=a.length;let h=9e10,d=-9e10,c=9e10,l=-9e10;for(let e=0;e<u;e+=1){const{id:n,data:o}=a[e];s&&t.getDegree(n)<=1||(r[n].setPos(o.x,o.y),o.x>=d&&(d=o.x),o.x<=h&&(h=o.x),o.y>=l&&(l=o.y),o.y<=c&&(c=o.y))}const f=Math.max(d-h,l-c),g=new mn({xmid:(d+h)/2,ymid:(l+c)/2,length:f,massCenter:i,mass:u}),p=new yn(g);for(let e=0;e<u;e+=1){const{id:n}=a[e];s&&t.getDegree(n)<=1||r[n].in(g)&&p.insert(r[n])}for(let n=0;n<u;n+=1){const{id:u,data:h}=a[n],d=t.getDegree(u);if(s&&d<=1)continue;r[u].resetForce(),p.updateForce(r[u]),e[u][0]-=r[u].fx,e[u][1]-=r[u].fy;const c=[h.x-i[0],h.y-i[1]];let l=Math.hypot(c[0],c[1]);l=l<1e-4?1e-4:l,c[0]=c[0]/l,c[1]=c[1]/l;const f=o*(d+1);e[u][0]-=f*c[0],e[u][1]-=f*c[1]}return e}getRepGraForces(t,e,r,n,o,i,s){const{preventOverlap:a,kr:u,kg:h,center:d,prune:c}=s,l=t.getAllNodes(),f=l.length;for(let s=0;s<f;s+=1){const g=l[s],p=t.getDegree(g.id);for(let h=s+1;h<f;h+=1){const s=l[h],d=t.getDegree(s.id);if(c&&(p<=1||d<=1))continue;const f=[s.data.x-g.data.x,s.data.y-g.data.y];let v=Math.hypot(f[0],f[1]);v=v<1e-4?1e-4:v,f[0]=f[0]/v,f[1]=f[1]/v,a&&e<r&&(v=v-i[g.id]-i[s.id]);let m=u*(p+1)*(d+1)/v;a&&e<r&&v<0?m=o*(p+1)*(d+1):a&&e<r&&0===v?m=0:a&&e<r&&v>0&&(m=u*(p+1)*(d+1)/v),n[g.id][0]-=m*f[0],n[s.id][0]+=m*f[0],n[g.id][1]-=m*f[1],n[s.id][1]+=m*f[1]}const v=[g.data.x-d[0],g.data.y-d[1]],m=Math.hypot(v[0],v[1]);v[0]=v[0]/m,v[1]=v[1]/m;const y=h*(p+1);n[g.id][0]-=y*v[0],n[g.id][1]-=y*v[1]}return n}updatePos(t,e,r,n,o){const{ks:i,tao:s,prune:a,ksmax:u}=o,h=t.getAllNodes(),d=h.length,l=[],f=[];let g=0,p=0,v=n;for(let n=0;n<d;n+=1){const{id:o}=h[n],i=t.getDegree(o);if(a&&i<=1)continue;const s=[e[o][0]-r[o][0],e[o][1]-r[o][1]],u=Math.hypot(s[0],s[1]),d=[e[o][0]+r[o][0],e[o][1]+r[o][1]],c=Math.hypot(d[0],d[1]);l[n]=u,f[n]=c/2,g+=(i+1)*l[n],p+=(i+1)*f[n]}const m=v;v=s*p/g,0!==m&&(v=v>1.5*m?1.5*m:v);for(let r=0;r<d;r+=1){const{id:n,data:o}=h[r],s=t.getDegree(n);if(a&&s<=1)continue;if(c(o.fx)&&c(o.fy))continue;let d=i*v/(1+v*Math.sqrt(l[r])),f=Math.hypot(e[n][0],e[n][1]);f=f<1e-4?1e-4:f;const g=u/f;d=d>g?g:d;const p=d*e[n][0],m=d*e[n][1];t.mergeNodeData(n,{x:o.x+p,y:o.y+m})}return v}},dagre:pn,antvDagre:class{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},Jt),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,e,r)}))}genericDagreLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{nodeSize:o,align:i,rankdir:s="TB",ranksep:a,nodesep:h,ranksepFunc:d,nodesepFunc:l,edgeLabelSpace:f,ranker:g,nodeOrder:p,begin:v,controlPoints:m,radial:y,sortByCombo:w,preset:x}=t,b=new u({tree:[]}),E=Gt(a||50,d),N=Gt(h||50,l);let M=N,_=E;"LR"!==s&&"RL"!==s||(M=E,_=N);const k=Yt(o,void 0),A=r.getAllNodes(),j=r.getAllEdges();let S;A.forEach((t=>{const e=k(t),r=_(t),n=e+2*M(t),o=e+2*r,i=t.data.layer;c(i)?b.addNode({id:t.id,data:{width:n,height:o,layer:i}}):b.addNode({id:t.id,data:{width:n,height:o}})})),w&&(b.attachTreeStructure("combo"),A.forEach((t=>{const{parentId:e}=t.data;void 0!==e&&b.hasNode(e)&&b.setParent(t.id,e,"combo")}))),j.forEach((t=>{b.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||1}})})),(null==x?void 0:x.length)&&(S=new u({nodes:x})),((t,e)=>{const{edgeLabelSpace:r,keepNodeOrder:n,prevGraph:o,rankdir:i,ranksep:s}=e;var a,h;!n&&o&&(h=o,(a=t).getAllNodes().forEach((t=>{const e=a.getNode(t.id);if(h.hasNode(t.id)){const r=h.getNode(t.id);e.data.fixorder=r.data._order,delete r.data._order}else delete e.data.fixorder})));const d=(t=>{const e=new u({tree:[]});return t.getAllNodes().forEach((r=>{const n=Bt(t.getNode(r.id).data),o=Object.assign(Object.assign({},kt),n),i=Vt(o,_t);e.hasNode(r.id)||e.addNode({id:r.id,data:Object.assign({},i)});const s=t.hasTreeStructure("combo")?t.getParent(r.id,"combo"):t.getParent(r.id);null==s||(e.hasNode(s.id)||e.addNode(Object.assign({},s)),e.setParent(r.id,s.id))})),t.getAllEdges().forEach((r=>{const n=Bt(t.getEdge(r.id).data),o={};null==St||St.forEach((t=>{void 0!==n[t]&&(o[t]=n[t])})),e.addEdge({id:r.id,source:r.source,target:r.target,data:Object.assign({},jt,Vt(n,At),o)})})),e})(t);let c;r&&(e.ranksep=((t,e)=>{const{ranksep:r=0,rankdir:n}=e;return t.getAllNodes().forEach((t=>{isNaN(t.data.layer)||t.data.layer||(t.data.layer=0)})),t.getAllEdges().forEach((t=>{var e;t.data.minlen*=2,"c"!==(null===(e=t.data.labelpos)||void 0===e?void 0:e.toLowerCase())&&("TB"===n||"BT"===n?t.data.width+=t.data.labeloffset:t.data.height+=t.data.labeloffset)})),r/2})(d,{rankdir:i,ranksep:s}));try{c=Mt(d,e)}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph\'s structure:\\n",t);throw t}((t,e)=>{t.getAllNodes().forEach((r=>{var n;const o=t.getNode(r.id);if(o){const t=e.getNode(r.id);o.data.x=t.data.x,o.data.y=t.data.y,o.data._order=t.data.order,o.data._rank=t.data.rank,(null===(n=e.getChildren(r.id))||void 0===n?void 0:n.length)&&(o.data.width=t.data.width,o.data.height=t.data.height)}})),t.getAllEdges().forEach((r=>{const n=t.getEdge(r.id),o=e.getEdge(r.id);n.data.points=o?o.data.points:[],o&&o.data.hasOwnProperty("x")&&(n.data.x=o.data.x,n.data.y=o.data.y)}))})(t,d)})(b,{prevGraph:S,edgeLabelSpace:f,keepNodeOrder:!!p,nodeOrder:p||[],acyclicer:"greedy",ranker:g,rankdir:s,nodesep:h,align:i});const O=[0,0];if(v){let t=1/0,e=1/0;b.getAllNodes().forEach((r=>{t>r.data.x&&(t=r.data.x),e>r.data.y&&(e=r.data.y)})),b.getAllEdges().forEach((r=>{var n;null===(n=r.data.points)||void 0===n||n.forEach((r=>{t>r.x&&(t=r.x),e>r.y&&(e=r.y)}))})),O[0]=v[0]-t,O[1]=v[1]-e}const z="LR"===s||"RL"===s;if(y);else{const t=new Set,e="BT"===s||"RL"===s?(t,e)=>e-t:(t,e)=>t-e;b.getAllNodes().forEach((e=>{e.data.x=e.data.x+O[0],e.data.y=e.data.y+O[1],t.add(z?e.data.x:e.data.y)}));const r=Array.from(t).sort(e),n=z?(t,e)=>t.x!==e.x:(t,e)=>t.y!==e.y,o=z?(t,e,r)=>{const n=Math.max(e.y,r.y),o=Math.min(e.y,r.y);return t.filter((t=>t.y<=n&&t.y>=o))}:(t,e,r)=>{const n=Math.max(e.x,r.x),o=Math.min(e.x,r.x);return t.filter((t=>t.x<=n&&t.x>=o))};b.getAllEdges().forEach(((t,e)=>{var i;f&&m&&"loop"!==t.data.type&&(t.data.controlPoints=((t,e,r,n,o,i,s)=>{let a=(null==t?void 0:t.slice(1,t.length-1))||[];if(e&&r){let{x:t,y:u}=e.data,{x:h,y:d}=r.data;if(o&&(t=e.data.y,u=e.data.x,h=r.data.y,d=r.data.x),d!==u&&t!==h){const c=n.indexOf(u),l=n[c+1];if(l){const t=a[0],e=o?{x:(u+l)/2,y:(null==t?void 0:t.y)||h}:{x:(null==t?void 0:t.x)||h,y:(u+l)/2};t&&!i(t,e)||a.unshift(e)}const f=n.indexOf(d),g=Math.abs(f-c);if(1===g)a=s(a,e.data,r.data),a.length||a.push(o?{x:(u+d)/2,y:t}:{x:t,y:(u+d)/2});else if(g>1){const e=n[f-1];if(e){const r=a[a.length-1],n=o?{x:(d+e)/2,y:(null==r?void 0:r.y)||h}:{x:(null==r?void 0:r.x)||t,y:(d+e)/2};r&&!i(r,n)||a.push(n)}}}}return a})(null===(i=t.data.points)||void 0===i?void 0:i.map((({x:t,y:e})=>({x:t+O[0],y:e+O[1]}))),b.getNode(t.source),b.getNode(t.target),r,z,n,o))}))}let R=[];R=b.getAllNodes().map((t=>Kt(t)));const I=b.getAllEdges();return e&&(R.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),I.forEach((t=>{r.mergeEdgeData(t.id,{controlPoints:t.data.controlPoints})}))),{nodes:R,edges:I}}))}},comboCombined:class{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},Be),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericComboCombinedLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericComboCombinedLayout(!0,e,r)}))}genericComboCombinedLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:o,treeKey:i,outerLayout:s}=t,a=r.getAllNodes().filter((t=>!t.data._isCombo)),h=r.getAllNodes().filter((t=>t.data._isCombo)),d=r.getAllEdges(),c=null==a?void 0:a.length;if(!c||1===c)return Qt(r,e,o);const l=[],f=new Map;a.forEach((t=>{f.set(t.id,t)}));const g=new Map;h.forEach((t=>{g.set(t.id,t)}));const p=new Map,v=this.getInnerGraphs(r,i,f,g,d,t,p);yield Promise.all(v);const m=new Map,y=[],w=new Map;let x=!0;r.getRoots(i).forEach((t=>{const e=p.get(t.id),n=g.get(t.id)||f.get(t.id),o={id:t.id,data:Object.assign(Object.assign({},t.data),{x:e.data.x||n.data.x,y:e.data.y||n.data.y,fx:e.data.fx||n.data.fx,fy:e.data.fy||n.data.fy,mass:e.data.mass||n.data.mass,size:e.data.size})};y.push(o),m.set(t.id,!0),isNaN(o.data.x)||0===o.data.x||isNaN(o.data.y)||0===o.data.y?(o.data.x=100*Math.random(),o.data.y=100*Math.random()):x=!1,Pe(r,[t],(e=>{e.id!==t.id&&w.set(e.id,t.id)}),"TB",i)}));const b=[];let E;if(d.forEach((t=>{const e=w.get(t.source)||t.source,r=w.get(t.target)||t.target;e!==r&&m.has(e)&&m.has(r)&&b.push({id:t.id,source:e,target:r,data:{}})})),null==y?void 0:y.length){if(1===y.length)y[0].data.x=o[0],y[0].data.y=o[1];else{const t=new u({nodes:y,edges:b}),e=s||new Me;if(x&&Ve[e.id]){const e=y.length<100?new Le:new ne;yield e.assign(t)}E=yield e.execute(t,Object.assign({center:o,kg:5,preventOverlap:!0,animate:!1},"force"===e.id?{gravity:1,factor:4,linkDistance:(t,e,r)=>(Math.max(...e.data.size)||32)/2+(Math.max(...r.data.size)||32)/2+200}:{}))}p.forEach((t=>{var e;const r=E.nodes.find((e=>e.id===t.id));if(r){const{x:e,y:n}=r.data;t.data.visited=!0,t.data.x=e,t.data.y=n,l.push({id:t.id,data:{x:e,y:n}})}const{x:n,y:o}=t.data;null===(e=t.data.nodes)||void 0===e||e.forEach((t=>{l.push({id:t.id,data:{x:t.data.x+n,y:t.data.y+o}})}))})),p.forEach((({data:t})=>{const{x:e,y:r,visited:n,nodes:o}=t;null==o||o.forEach((t=>{if(!n){const n=l.find((e=>e.id===t.id));n.data.x+=e||0,n.data.y+=r||0}}))}))}return e&&l.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),{nodes:l,edges:d}}))}initVals(t){const e=Object.assign({},t),{nodeSize:r,spacing:n,comboPadding:o}=t;let i,s,a;if(s=c(n)?()=>n:$t(n)?n:()=>0,e.spacing=s,r)if($t(r))i=t=>{const e=r(t),n=s(t);return ee(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+n)/2:((e||32)+n)/2};else if(ee(r)){const t=(r[0]>r[1]?r[0]:r[1])/2;i=e=>t+s(e)/2}else{const t=r/2;i=e=>t+s(e)/2}else i=t=>{const e=s(t);return t.size?ee(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+e)/2:Ut(t.size)?((t.size.width>t.size.height?t.size.width:t.size.height)+e)/2:(t.size+e)/2:32+e/2};return e.nodeSize=i,a=c(o)?()=>o:ee(o)?()=>Math.max.apply(null,o):$t(o)?o:()=>0,e.comboPadding=a,e}getInnerGraphs(e,r,n,o,i,s,a){const{nodeSize:h,comboPadding:d,spacing:l,innerLayout:f}=s,g=f||new ne({}),p={center:[0,0],preventOverlap:!0,nodeSpacing:l},v=[],m=t=>{let e=(null==d?void 0:d(t))||10;return ee(e)&&(e=Math.max(...e)),{size:e?[2*e,2*e]:[30,30],padding:e}};return e.getRoots(r).forEach((s=>{a.set(s.id,{id:s.id,data:{nodes:[],size:m(s).size}});let d=Promise.resolve();Pe(e,[s],(s=>{var l;if(!s.data._isCombo)return;const{size:f,padding:v}=m(s);if(null===(l=e.getChildren(s.id,r))||void 0===l?void 0:l.length){const l=a.get(s.id);a.set(s.id,{id:s.id,data:Object.assign({nodes:[]},null==l?void 0:l.data)});const f=new Map,m=e.getChildren(s.id,r).map((t=>{if(t.data._isCombo)return a.has(t.id)||a.set(t.id,{id:t.id,data:Object.assign({},t.data)}),f.set(t.id,!0),a.get(t.id);const e=n.get(t.id)||o.get(t.id);return f.set(t.id,!0),{id:t.id,data:Object.assign(Object.assign({},e.data),t.data)}})),y={nodes:m,edges:i.filter((t=>f.has(t.source)&&f.has(t.target)))};let w=1/0;m.forEach((t=>{var e;let{size:r}=t.data;r||(r=(null===(e=a.get(t.id))||void 0===e?void 0:e.data.size)||(null==h?void 0:h(t))||[30,30]),c(r)&&(r=[r,r]);const[n,o]=r;w>n&&(w=n),w>o&&(w=o),t.data.size=r})),d=d.then((()=>t(this,void 0,void 0,(function*(){const t=new u(y),e=yield g.assign(t,p),{minX:r,minY:n,maxX:o,maxY:i}=(t=>{let e=1/0,r=1/0,n=-1/0,o=-1/0;return t.forEach((t=>{let i=t.data.size;ee(i)?1===i.length&&(i=[i[0],i[0]]):c(i)?i=[i,i]:(void 0===i||isNaN(i))&&(i=[30,30]);const s=[i[0]/2,i[1]/2],a=t.data.x-s[0],u=t.data.x+s[0],h=t.data.y-s[1],d=t.data.y+s[1];e>a&&(e=a),r>h&&(r=h),n<u&&(n=u),o<d&&(o=d)})),{minX:e,minY:r,maxX:n,maxY:o}})(m),h=(o+r)/2,d=(i+n)/2;y.nodes.forEach((t=>{t.data.x-=h,t.data.y-=d}));const l=[Math.max(o-r,w)+2*v,Math.max(i-n,w)+2*v];return a.get(s.id).data.size=l,a.get(s.id).data.nodes=m,e}))))}else a.set(s.id,{id:s.id,data:Object.assign(Object.assign({},s.data),{size:f})});return!0}),"BT",r),v.push(d)})),v}}};let Cn;function Dn(){(null==Cn?void 0:Cn.stop)&&Cn.stop()}function Pn(e,r){return t(this,void 0,void 0,(function*(){const{layout:{id:t,options:n,iterations:o},nodes:i,edges:s}=e,a=new u({nodes:i,edges:s}),h=In[t];if(!h)throw new Error(`Unknown layout id: ${t}`);Cn=new h(n);let d=yield Cn.execute(a);return!!(c=Cn).tick&&!!c.stop&&(Cn.stop(),d=Cn.tick(o)),[d,r];var c}))}addEventListener("message",(function(t){var e,r=t.data,o=r.type,i=r.method,s=r.id,a=r.params;"RPC"===o&&i&&((e=n[i])?Promise.resolve().then((function(){return e.apply(n,a)})):Promise.reject("No such method")).then((function(t){postMessage({type:"RPC",id:s,result:t})})).catch((function(t){var e={message:t};t.stack&&(e.message=t.message,e.stack=t.stack,e.name=t.name),postMessage({type:"RPC",id:s,error:e})}))})),postMessage({type:"RPC",method:"ready"})})()})();\n//# sourceMappingURL=cd2b54bd55e0306c6ba1.worker.js.map'])),{name:"[fullhash].worker.js"});return URL.revokeObjectURL(URL.createObjectURL(new Blob(['(()=>{var t={4341:(t,e,r)=>{t.exports={graphlib:r(3374),layout:r(9407),debug:r(6978),util:{time:r(6573).time,notime:r(6573).notime},version:r(6661)}},9317:(t,e,r)=>{"use strict";var n=r(5076),o=r(3526);t.exports={run:function(t){var e="greedy"===t.graph().acyclicer?o(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],r={},o={};return n.forEach(t.nodes(),(function i(s){n.has(o,s)||(o[s]=!0,r[s]=!0,n.forEach(t.outEdges(s),(function(t){n.has(r,t.w)?e.push(t):i(t.w)})),delete r[s])})),e}(t);n.forEach(e,(function(e){var r=t.edge(e);t.removeEdge(e),r.forwardName=e.name,r.reversed=!0,t.setEdge(e.w,e.v,r,n.uniqueId("rev"))}))},undo:function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.reversed){t.removeEdge(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}}))}}},7840:(t,e,r)=>{var n=r(5076),o=r(6573);function i(t,e,r,n,i,s){var a={width:0,height:0,rank:s,borderType:e},u=i[e][s-1],h=o.addDummyNode(t,"border",a,r);i[e][s]=h,t.setParent(h,n),u&&t.setEdge(u,h,{weight:1})}t.exports=function(t){n.forEach(t.children(),(function e(r){var o=t.children(r),s=t.node(r);if(o.length&&n.forEach(o,e),n.has(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(var a=s.minRank,u=s.maxRank+1;a<u;++a)i(t,"borderLeft","_bl",r,s,a),i(t,"borderRight","_br",r,s,a)}}))}},5793:(t,e,r)=>{"use strict";var n=r(5076);function o(t){n.forEach(t.nodes(),(function(e){i(t.node(e))})),n.forEach(t.edges(),(function(e){i(t.edge(e))}))}function i(t){var e=t.width;t.width=t.height,t.height=e}function s(t){t.y=-t.y}function a(t){var e=t.x;t.x=t.y,t.y=e}t.exports={adjust:function(t){var e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||o(t)},undo:function(t){var e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){n.forEach(t.nodes(),(function(e){s(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.forEach(r.points,s),n.has(r,"y")&&s(r)}))}(t),"lr"!==e&&"rl"!==e||(function(t){n.forEach(t.nodes(),(function(e){a(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.forEach(r.points,a),n.has(r,"x")&&a(r)}))}(t),o(t))}}},5752:t=>{function e(){var t={};t._next=t._prev=t,this._sentinel=t}function r(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function n(t,e){if("_next"!==t&&"_prev"!==t)return e}t.exports=e,e.prototype.dequeue=function(){var t=this._sentinel,e=t._prev;if(e!==t)return r(e),e},e.prototype.enqueue=function(t){var e=this._sentinel;t._prev&&t._next&&r(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e},e.prototype.toString=function(){for(var t=[],e=this._sentinel,r=e._prev;r!==e;)t.push(JSON.stringify(r,n)),r=r._prev;return"["+t.join(", ")+"]"}},6978:(t,e,r)=>{var n=r(5076),o=r(6573),i=r(3374).Graph;t.exports={debugOrdering:function(t){var e=o.buildLayerMatrix(t),r=new i({compound:!0,multigraph:!0}).setGraph({});return n.forEach(t.nodes(),(function(e){r.setNode(e,{label:e}),r.setParent(e,"layer"+t.node(e).rank)})),n.forEach(t.edges(),(function(t){r.setEdge(t.v,t.w,{},t.name)})),n.forEach(e,(function(t,e){var o="layer"+e;r.setNode(o,{rank:"same"}),n.reduce(t,(function(t,e){return r.setEdge(t,e,{style:"invis"}),e}))})),r}}},3374:(t,e,r)=>{var n;try{n=r(7423)}catch(t){}n||(n=window.graphlib),t.exports=n},3526:(t,e,r)=>{var n=r(5076),o=r(3374).Graph,i=r(5752);t.exports=function(t,e){if(t.nodeCount()<=1)return[];var r=function(t,e){var r=new o,s=0,a=0;n.forEach(t.nodes(),(function(t){r.setNode(t,{v:t,in:0,out:0})})),n.forEach(t.edges(),(function(t){var n=r.edge(t.v,t.w)||0,o=e(t),i=n+o;r.setEdge(t.v,t.w,i),a=Math.max(a,r.node(t.v).out+=o),s=Math.max(s,r.node(t.w).in+=o)}));var h=n.range(a+s+3).map((function(){return new i})),d=s+1;return n.forEach(r.nodes(),(function(t){u(h,d,r.node(t))})),{graph:r,buckets:h,zeroIdx:d}}(t,e||s),h=function(t,e,r){for(var n,o=[],i=e[e.length-1],s=e[0];t.nodeCount();){for(;n=s.dequeue();)a(t,e,r,n);for(;n=i.dequeue();)a(t,e,r,n);if(t.nodeCount())for(var u=e.length-2;u>0;--u)if(n=e[u].dequeue()){o=o.concat(a(t,e,r,n,!0));break}}return o}(r.graph,r.buckets,r.zeroIdx);return n.flatten(n.map(h,(function(e){return t.outEdges(e.v,e.w)})),!0)};var s=n.constant(1);function a(t,e,r,o,i){var s=i?[]:void 0;return n.forEach(t.inEdges(o.v),(function(n){var o=t.edge(n),a=t.node(n.v);i&&s.push({v:n.v,w:n.w}),a.out-=o,u(e,r,a)})),n.forEach(t.outEdges(o.v),(function(n){var o=t.edge(n),i=n.w,s=t.node(i);s.in-=o,u(e,r,s)})),t.removeNode(o.v),s}function u(t,e,r){r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)}},9407:(t,e,r)=>{"use strict";var n=r(5076),o=r(9317),i=r(9934),s=r(9472),a=r(6573).normalizeRanks,u=r(9095),h=r(6573).removeEmptyRanks,d=r(9526),c=r(7840),l=r(5793),f=r(9186),g=r(9497),p=r(6573),v=r(3374).Graph;t.exports=function(t,e){var r=e&&e.debugTiming?p.time:p.notime;r("layout",(function(){var e=r(" buildLayoutGraph",(function(){return function(t){var e=new v({multigraph:!0,compound:!0}),r=k(t.graph());return e.setGraph(n.merge({},y,_(r,m),n.pick(r,w))),n.forEach(t.nodes(),(function(r){var o=k(t.node(r));e.setNode(r,n.defaults(_(o,x),b)),e.setParent(r,t.parent(r))})),n.forEach(t.edges(),(function(r){var o=k(t.edge(r));e.setEdge(r,n.merge({},N,_(o,E),n.pick(o,M)))})),e}(t)}));r(" runLayout",(function(){!function(t,e){e(" makeSpaceForEdgeLabels",(function(){!function(t){var e=t.graph();e.ranksep/=2,n.forEach(t.edges(),(function(r){var n=t.edge(r);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)}))}(t)})),e(" removeSelfEdges",(function(){!function(t){n.forEach(t.edges(),(function(e){if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}}))}(t)})),e(" acyclic",(function(){o.run(t)})),e(" nestingGraph.run",(function(){d.run(t)})),e(" rank",(function(){s(p.asNonCompoundGraph(t))})),e(" injectEdgeLabelProxies",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.width&&r.height){var n=t.node(e.v),o={rank:(t.node(e.w).rank-n.rank)/2+n.rank,e};p.addDummyNode(t,"edge-proxy",o,"_ep")}}))}(t)})),e(" removeEmptyRanks",(function(){h(t)})),e(" nestingGraph.cleanup",(function(){d.cleanup(t)})),e(" normalizeRanks",(function(){a(t)})),e(" assignRankMinMax",(function(){!function(t){var e=0;n.forEach(t.nodes(),(function(r){var o=t.node(r);o.borderTop&&(o.minRank=t.node(o.borderTop).rank,o.maxRank=t.node(o.borderBottom).rank,e=n.max(e,o.maxRank))})),t.graph().maxRank=e}(t)})),e(" removeEdgeLabelProxies",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);"edge-proxy"===r.dummy&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))}))}(t)})),e(" normalize.run",(function(){i.run(t)})),e(" parentDummyChains",(function(){u(t)})),e(" addBorderSegments",(function(){c(t)})),e(" order",(function(){f(t)})),e(" insertSelfEdges",(function(){!function(t){var e=p.buildLayerMatrix(t);n.forEach(e,(function(e){var r=0;n.forEach(e,(function(e,o){var i=t.node(e);i.order=o+r,n.forEach(i.selfEdges,(function(e){p.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:o+ ++r,e:e.e,label:e.label},"_se")})),delete i.selfEdges}))}))}(t)})),e(" adjustCoordinateSystem",(function(){l.adjust(t)})),e(" position",(function(){g(t)})),e(" positionSelfEdges",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),o=n.x+n.width/2,i=n.y,s=r.x-o,a=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{x:o+s,y:i},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.label.x=r.x,r.label.y=r.y}}))}(t)})),e(" removeBorderNodes",(function(){!function(t){n.forEach(t.nodes(),(function(e){if(t.children(e).length){var r=t.node(e),o=t.node(r.borderTop),i=t.node(r.borderBottom),s=t.node(n.last(r.borderLeft)),a=t.node(n.last(r.borderRight));r.width=Math.abs(a.x-s.x),r.height=Math.abs(i.y-o.y),r.x=s.x+r.width/2,r.y=o.y+r.height/2}})),n.forEach(t.nodes(),(function(e){"border"===t.node(e).dummy&&t.removeNode(e)}))}(t)})),e(" normalize.undo",(function(){i.undo(t)})),e(" fixupEdgeLabelCoords",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(n.has(r,"x"))switch("l"!==r.labelpos&&"r"!==r.labelpos||(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}}))}(t)})),e(" undoCoordinateSystem",(function(){l.undo(t)})),e(" translateGraph",(function(){!function(t){var e=Number.POSITIVE_INFINITY,r=0,o=Number.POSITIVE_INFINITY,i=0,s=t.graph(),a=s.marginx||0,u=s.marginy||0;function h(t){var n=t.x,s=t.y,a=t.width,u=t.height;e=Math.min(e,n-a/2),r=Math.max(r,n+a/2),o=Math.min(o,s-u/2),i=Math.max(i,s+u/2)}n.forEach(t.nodes(),(function(e){h(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.has(r,"x")&&h(r)})),e-=a,o-=u,n.forEach(t.nodes(),(function(r){var n=t.node(r);n.x-=e,n.y-=o})),n.forEach(t.edges(),(function(r){var i=t.edge(r);n.forEach(i.points,(function(t){t.x-=e,t.y-=o})),n.has(i,"x")&&(i.x-=e),n.has(i,"y")&&(i.y-=o)})),s.width=r-e+a,s.height=i-o+u}(t)})),e(" assignNodeIntersects",(function(){!function(t){n.forEach(t.edges(),(function(e){var r,n,o=t.edge(e),i=t.node(e.v),s=t.node(e.w);o.points?(r=o.points[0],n=o.points[o.points.length-1]):(o.points=[],r=s,n=i),o.points.unshift(p.intersectRect(i,r)),o.points.push(p.intersectRect(s,n))}))}(t)})),e(" reversePoints",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);r.reversed&&r.points.reverse()}))}(t)})),e(" acyclic.undo",(function(){o.undo(t)}))}(e,r)})),r(" updateInputGraph",(function(){!function(t,e){n.forEach(t.nodes(),(function(r){var n=t.node(r),o=e.node(r);n&&(n.x=o.x,n.y=o.y,e.children(r).length&&(n.width=o.width,n.height=o.height))})),n.forEach(t.edges(),(function(r){var o=t.edge(r),i=e.edge(r);o.points=i.points,n.has(i,"x")&&(o.x=i.x,o.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,e)}))}))};var m=["nodesep","edgesep","ranksep","marginx","marginy"],y={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},w=["acyclicer","ranker","rankdir","align"],x=["width","height"],b={width:0,height:0},E=["minlen","weight","width","height","labeloffset"],N={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},M=["labelpos"];function _(t,e){return n.mapValues(n.pick(t,e),Number)}function k(t){var e={};return n.forEach(t,(function(t,r){e[r.toLowerCase()]=t})),e}},5076:(t,e,r)=>{var n;try{n={cloneDeep:r(9136),constant:r(8295),defaults:r(9529),each:r(958),filter:r(9969),find:r(828),flatten:r(7469),forEach:r(1117),forIn:r(4519),has:r(4339),isUndefined:r(2895),last:r(5179),map:r(9629),mapValues:r(5551),max:r(4213),merge:r(2495),min:r(9903),minBy:r(3262),now:r(8835),pick:r(222),range:r(4978),reduce:r(9285),sortBy:r(5246),uniqueId:r(761),values:r(3005),zipObject:r(3679)}}catch(t){}n||(n=window._),t.exports=n},9526:(t,e,r)=>{var n=r(5076),o=r(6573);function i(t,e,r,s,a,u,h){var d=t.children(h);if(d.length){var c=o.addBorderNode(t,"_bt"),l=o.addBorderNode(t,"_bb"),f=t.node(h);t.setParent(c,h),f.borderTop=c,t.setParent(l,h),f.borderBottom=l,n.forEach(d,(function(n){i(t,e,r,s,a,u,n);var o=t.node(n),d=o.borderTop?o.borderTop:n,f=o.borderBottom?o.borderBottom:n,g=o.borderTop?s:2*s,p=d!==f?1:a-u[h]+1;t.setEdge(c,d,{weight:g,minlen:p,nestingEdge:!0}),t.setEdge(f,l,{weight:g,minlen:p,nestingEdge:!0})})),t.parent(h)||t.setEdge(e,c,{weight:0,minlen:a+u[h]})}else h!==e&&t.setEdge(e,h,{weight:0,minlen:r})}t.exports={run:function(t){var e=o.addDummyNode(t,"root",{},"_root"),r=function(t){var e={};function r(o,i){var s=t.children(o);s&&s.length&&n.forEach(s,(function(t){r(t,i+1)})),e[o]=i}return n.forEach(t.children(),(function(t){r(t,1)})),e}(t),s=n.max(n.values(r))-1,a=2*s+1;t.graph().nestingRoot=e,n.forEach(t.edges(),(function(e){t.edge(e).minlen*=a}));var u=function(t){return n.reduce(t.edges(),(function(e,r){return e+t.edge(r).weight}),0)}(t)+1;n.forEach(t.children(),(function(n){i(t,e,a,u,s,r,n)})),t.graph().nodeRankFactor=a},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,n.forEach(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}}},9934:(t,e,r)=>{"use strict";var n=r(5076),o=r(6573);t.exports={run:function(t){t.graph().dummyChains=[],n.forEach(t.edges(),(function(e){!function(t,e){var r,n,i,s=e.v,a=t.node(s).rank,u=e.w,h=t.node(u).rank,d=e.name,c=t.edge(e),l=c.labelRank;if(h!==a+1){for(t.removeEdge(e),i=0,++a;a<h;++i,++a)c.points=[],n={width:0,height:0,edgeLabel:c,edgeObj:e,rank:a},r=o.addDummyNode(t,"edge",n,"_d"),a===l&&(n.width=c.width,n.height=c.height,n.dummy="edge-label",n.labelpos=c.labelpos),t.setEdge(s,r,{weight:c.weight},d),0===i&&t.graph().dummyChains.push(r),s=r;t.setEdge(s,u,{weight:c.weight},d)}}(t,e)}))},undo:function(t){n.forEach(t.graph().dummyChains,(function(e){var r,n=t.node(e),o=n.edgeLabel;for(t.setEdge(n.edgeObj,o);n.dummy;)r=t.successors(e)[0],t.removeNode(e),o.points.push({x:n.x,y:n.y}),"edge-label"===n.dummy&&(o.x=n.x,o.y=n.y,o.width=n.width,o.height=n.height),e=r,n=t.node(e)}))}}},9841:(t,e,r)=>{var n=r(5076);t.exports=function(t,e,r){var o,i={};n.forEach(r,(function(r){for(var n,s,a=t.parent(r);a;){if((n=t.parent(a))?(s=i[n],i[n]=a):(s=o,o=a),s&&s!==a)return void e.setEdge(s,a);a=n}}))}},5458:(t,e,r)=>{var n=r(5076);t.exports=function(t,e){return n.map(e,(function(e){var r=t.inEdges(e);if(r.length){var o=n.reduce(r,(function(e,r){var n=t.edge(r),o=t.node(r.v);return{sum:e.sum+n.weight*o.order,weight:e.weight+n.weight}}),{sum:0,weight:0});return{v:e,barycenter:o.sum/o.weight,weight:o.weight}}return{v:e}}))}},6263:(t,e,r)=>{var n=r(5076),o=r(3374).Graph;t.exports=function(t,e,r){var i=function(t){for(var e;t.hasNode(e=n.uniqueId("_root")););return e}(t),s=new o({compound:!0}).setGraph({root:i}).setDefaultNodeLabel((function(e){return t.node(e)}));return n.forEach(t.nodes(),(function(o){var a=t.node(o),u=t.parent(o);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(s.setNode(o),s.setParent(o,u||i),n.forEach(t[r](o),(function(e){var r=e.v===o?e.w:e.v,i=s.edge(r,o),a=n.isUndefined(i)?0:i.weight;s.setEdge(r,o,{weight:t.edge(e).weight+a})})),n.has(a,"minRank")&&s.setNode(o,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))})),s}},6840:(t,e,r)=>{"use strict";var n=r(5076);function o(t,e,r){for(var o=n.zipObject(r,n.map(r,(function(t,e){return e}))),i=n.flatten(n.map(e,(function(e){return n.sortBy(n.map(t.outEdges(e),(function(e){return{pos:o[e.w],weight:t.edge(e).weight}})),"pos")})),!0),s=1;s<r.length;)s<<=1;var a=2*s-1;s-=1;var u=n.map(new Array(a),(function(){return 0})),h=0;return n.forEach(i.forEach((function(t){var e=t.pos+s;u[e]+=t.weight;for(var r=0;e>0;)e%2&&(r+=u[e+1]),u[e=e-1>>1]+=t.weight;h+=t.weight*r}))),h}t.exports=function(t,e){for(var r=0,n=1;n<e.length;++n)r+=o(t,e[n-1],e[n]);return r}},9186:(t,e,r)=>{"use strict";var n=r(5076),o=r(1879),i=r(6840),s=r(9387),a=r(6263),u=r(9841),h=r(3374).Graph,d=r(6573);function c(t,e,r){return n.map(e,(function(e){return a(t,e,r)}))}function l(t,e){var r=new h;n.forEach(t,(function(t){var o=t.graph().root,i=s(t,o,r,e);n.forEach(i.vs,(function(e,r){t.node(e).order=r})),u(t,r,i.vs)}))}function f(t,e){n.forEach(e,(function(e){n.forEach(e,(function(e,r){t.node(e).order=r}))}))}t.exports=function(t){var e=d.maxRank(t),r=c(t,n.range(1,e+1),"inEdges"),s=c(t,n.range(e-1,-1,-1),"outEdges"),a=o(t);f(t,a);for(var u,h=Number.POSITIVE_INFINITY,g=0,p=0;p<4;++g,++p){l(g%2?r:s,g%4>=2),a=d.buildLayerMatrix(t);var v=i(t,a);v<h&&(p=0,u=n.cloneDeep(a),h=v)}f(t,u)}},1879:(t,e,r)=>{"use strict";var n=r(5076);t.exports=function(t){var e={},r=n.filter(t.nodes(),(function(e){return!t.children(e).length})),o=n.max(n.map(r,(function(e){return t.node(e).rank}))),i=n.map(n.range(o+1),(function(){return[]})),s=n.sortBy(r,(function(e){return t.node(e).rank}));return n.forEach(s,(function r(o){if(!n.has(e,o)){e[o]=!0;var s=t.node(o);i[s.rank].push(o),n.forEach(t.successors(o),r)}})),i}},5912:(t,e,r)=>{"use strict";var n=r(5076);t.exports=function(t,e){var r={};return n.forEach(t,(function(t,e){var o=r[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};n.isUndefined(t.barycenter)||(o.barycenter=t.barycenter,o.weight=t.weight)})),n.forEach(e.edges(),(function(t){var e=r[t.v],o=r[t.w];n.isUndefined(e)||n.isUndefined(o)||(o.indegree++,e.out.push(r[t.w]))})),function(t){var e=[];function r(t){return function(e){var r,o,i,s;e.merged||(n.isUndefined(e.barycenter)||n.isUndefined(t.barycenter)||e.barycenter>=t.barycenter)&&(o=e,i=0,s=0,(r=t).weight&&(i+=r.barycenter*r.weight,s+=r.weight),o.weight&&(i+=o.barycenter*o.weight,s+=o.weight),r.vs=o.vs.concat(r.vs),r.barycenter=i/s,r.weight=s,r.i=Math.min(o.i,r.i),o.merged=!0)}}function o(e){return function(r){r.in.push(e),0==--r.indegree&&t.push(r)}}for(;t.length;){var i=t.pop();e.push(i),n.forEach(i.in.reverse(),r(i)),n.forEach(i.out,o(i))}return n.map(n.filter(e,(function(t){return!t.merged})),(function(t){return n.pick(t,["vs","i","barycenter","weight"])}))}(n.filter(r,(function(t){return!t.indegree})))}},9387:(t,e,r)=>{var n=r(5076),o=r(5458),i=r(5912),s=r(256);t.exports=function t(e,r,a,u){var h=e.children(r),d=e.node(r),c=d?d.borderLeft:void 0,l=d?d.borderRight:void 0,f={};c&&(h=n.filter(h,(function(t){return t!==c&&t!==l})));var g=o(e,h);n.forEach(g,(function(r){if(e.children(r.v).length){var o=t(e,r.v,a,u);f[r.v]=o,n.has(o,"barycenter")&&(i=r,s=o,n.isUndefined(i.barycenter)?(i.barycenter=s.barycenter,i.weight=s.weight):(i.barycenter=(i.barycenter*i.weight+s.barycenter*s.weight)/(i.weight+s.weight),i.weight+=s.weight))}var i,s}));var p=i(g,a);!function(t,e){n.forEach(t,(function(t){t.vs=n.flatten(t.vs.map((function(t){return e[t]?e[t].vs:t})),!0)}))}(p,f);var v=s(p,u);if(c&&(v.vs=n.flatten([c,v.vs,l],!0),e.predecessors(c).length)){var m=e.node(e.predecessors(c)[0]),y=e.node(e.predecessors(l)[0]);n.has(v,"barycenter")||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+m.order+y.order)/(v.weight+2),v.weight+=2}return v}},256:(t,e,r)=>{var n=r(5076),o=r(6573);function i(t,e,r){for(var o;e.length&&(o=n.last(e)).i<=r;)e.pop(),t.push(o.vs),r++;return r}t.exports=function(t,e){var r,s=o.partition(t,(function(t){return n.has(t,"barycenter")})),a=s.lhs,u=n.sortBy(s.rhs,(function(t){return-t.i})),h=[],d=0,c=0,l=0;a.sort((r=!!e,function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:r?e.i-t.i:t.i-e.i})),l=i(h,u,l),n.forEach(a,(function(t){l+=t.vs.length,h.push(t.vs),d+=t.barycenter*t.weight,c+=t.weight,l=i(h,u,l)}));var f={vs:n.flatten(h,!0)};return c&&(f.barycenter=d/c,f.weight=c),f}},9095:(t,e,r)=>{var n=r(5076);t.exports=function(t){var e=function(t){var e={},r=0;return n.forEach(t.children(),(function o(i){var s=r;n.forEach(t.children(i),o),e[i]={low:s,lim:r++}})),e}(t);n.forEach(t.graph().dummyChains,(function(r){for(var n=t.node(r),o=n.edgeObj,i=function(t,e,r,n){var o,i,s=[],a=[],u=Math.min(e[r].low,e[n].low),h=Math.max(e[r].lim,e[n].lim);o=r;do{o=t.parent(o),s.push(o)}while(o&&(e[o].low>u||h>e[o].lim));for(i=o,o=n;(o=t.parent(o))!==i;)a.push(o);return{path:s.concat(a.reverse()),lca:i}}(t,e,o.v,o.w),s=i.path,a=i.lca,u=0,h=s[u],d=!0;r!==o.w;){if(n=t.node(r),d){for(;(h=s[u])!==a&&t.node(h).maxRank<n.rank;)u++;h===a&&(d=!1)}if(!d){for(;u<s.length-1&&t.node(h=s[u+1]).minRank<=n.rank;)u++;h=s[u]}t.setParent(r,h),r=t.successors(r)[0]}}))}},2738:(t,e,r)=>{"use strict";var n=r(5076),o=r(3374).Graph,i=r(6573);function s(t,e){var r={};return n.reduce(e,(function(e,o){var i=0,s=0,a=e.length,h=n.last(o);return n.forEach(o,(function(e,d){var c=function(t,e){if(t.node(e).dummy)return n.find(t.predecessors(e),(function(e){return t.node(e).dummy}))}(t,e),l=c?t.node(c).order:a;(c||e===h)&&(n.forEach(o.slice(s,d+1),(function(e){n.forEach(t.predecessors(e),(function(n){var o=t.node(n),s=o.order;!(s<i||l<s)||o.dummy&&t.node(e).dummy||u(r,n,e)}))})),s=d+1,i=l)})),o})),r}function a(t,e){var r={};function o(e,o,i,s,a){var h;n.forEach(n.range(o,i),(function(o){h=e[o],t.node(h).dummy&&n.forEach(t.predecessors(h),(function(e){var n=t.node(e);n.dummy&&(n.order<s||n.order>a)&&u(r,e,h)}))}))}return n.reduce(e,(function(e,r){var i,s=-1,a=0;return n.forEach(r,(function(n,u){if("border"===t.node(n).dummy){var h=t.predecessors(n);h.length&&(i=t.node(h[0]).order,o(r,a,u,s,i),a=u,s=i)}o(r,a,r.length,i,e.length)})),r})),r}function u(t,e,r){if(e>r){var n=e;e=r,r=n}var o=t[e];o||(t[e]=o={}),o[r]=!0}function h(t,e,r){if(e>r){var o=e;e=r,r=o}return n.has(t[e],r)}function d(t,e,r,o){var i={},s={},a={};return n.forEach(e,(function(t){n.forEach(t,(function(t,e){i[t]=t,s[t]=t,a[t]=e}))})),n.forEach(e,(function(t){var e=-1;n.forEach(t,(function(t){var u=o(t);if(u.length){u=n.sortBy(u,(function(t){return a[t]}));for(var d=(u.length-1)/2,c=Math.floor(d),l=Math.ceil(d);c<=l;++c){var f=u[c];s[t]===t&&e<a[f]&&!h(r,t,f)&&(s[f]=t,s[t]=i[t]=i[f],e=a[f])}}}))})),{root:i,align:s}}function c(t,e,r,i,s){var a={},u=function(t,e,r,i){var s=new o,a=t.graph(),u=function(t,e,r){return function(o,i,s){var a,u=o.node(i),h=o.node(s),d=0;if(d+=u.width/2,n.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(d+=r?a:-a),a=0,d+=(u.dummy?e:t)/2,d+=(h.dummy?e:t)/2,d+=h.width/2,n.has(h,"labelpos"))switch(h.labelpos.toLowerCase()){case"l":a=h.width/2;break;case"r":a=-h.width/2}return a&&(d+=r?a:-a),a=0,d}}(a.nodesep,a.edgesep,i);return n.forEach(e,(function(e){var o;n.forEach(e,(function(e){var n=r[e];if(s.setNode(n),o){var i=r[o],a=s.edge(i,n);s.setEdge(i,n,Math.max(u(t,e,o),a||0))}o=e}))})),s}(t,e,r,s),h=s?"borderLeft":"borderRight";function d(t,e){for(var r=u.nodes(),n=r.pop(),o={};n;)o[n]?t(n):(o[n]=!0,r.push(n),r=r.concat(e(n))),n=r.pop()}return d((function(t){a[t]=u.inEdges(t).reduce((function(t,e){return Math.max(t,a[e.v]+u.edge(e))}),0)}),u.predecessors.bind(u)),d((function(e){var r=u.outEdges(e).reduce((function(t,e){return Math.min(t,a[e.w]-u.edge(e))}),Number.POSITIVE_INFINITY),n=t.node(e);r!==Number.POSITIVE_INFINITY&&n.borderType!==h&&(a[e]=Math.max(a[e],r))}),u.successors.bind(u)),n.forEach(i,(function(t){a[t]=a[r[t]]})),a}function l(t,e){return n.minBy(n.values(e),(function(e){var r=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return n.forIn(e,(function(e,n){var i=function(t,e){return t.node(e).width}(t,n)/2;r=Math.max(e+i,r),o=Math.min(e-i,o)})),r-o}))}function f(t,e){var r=n.values(e),o=n.min(r),i=n.max(r);n.forEach(["u","d"],(function(r){n.forEach(["l","r"],(function(s){var a,u=r+s,h=t[u];if(h!==e){var d=n.values(h);(a="l"===s?o-n.min(d):i-n.max(d))&&(t[u]=n.mapValues(h,(function(t){return t+a})))}}))}))}function g(t,e){return n.mapValues(t.ul,(function(r,o){if(e)return t[e.toLowerCase()][o];var i=n.sortBy(n.map(t,o));return(i[1]+i[2])/2}))}t.exports={positionX:function(t){var e,r=i.buildLayerMatrix(t),o=n.merge(s(t,r),a(t,r)),u={};n.forEach(["u","d"],(function(i){e="u"===i?r:n.values(r).reverse(),n.forEach(["l","r"],(function(r){"r"===r&&(e=n.map(e,(function(t){return n.values(t).reverse()})));var s=("u"===i?t.predecessors:t.successors).bind(t),a=d(0,e,o,s),h=c(t,e,a.root,a.align,"r"===r);"r"===r&&(h=n.mapValues(h,(function(t){return-t}))),u[i+r]=h}))}));var h=l(t,u);return f(u,h),g(u,t.graph().align)},findType1Conflicts:s,findType2Conflicts:a,addConflict:u,hasConflict:h,verticalAlignment:d,horizontalCompaction:c,alignCoordinates:f,findSmallestWidthAlignment:l,balance:g}},9497:(t,e,r)=>{"use strict";var n=r(5076),o=r(6573),i=r(2738).positionX;t.exports=function(t){(function(t){var e=o.buildLayerMatrix(t),r=t.graph().ranksep,i=0;n.forEach(e,(function(e){var o=n.max(n.map(e,(function(e){return t.node(e).height})));n.forEach(e,(function(e){t.node(e).y=i+o/2})),i+=o+r}))})(t=o.asNonCompoundGraph(t)),n.forEach(i(t),(function(e,r){t.node(r).x=e}))}},9996:(t,e,r)=>{"use strict";var n=r(5076),o=r(3374).Graph,i=r(8666).slack;function s(t,e){return n.forEach(t.nodes(),(function r(o){n.forEach(e.nodeEdges(o),(function(n){var s=n.v,a=o===s?n.w:s;t.hasNode(a)||i(e,n)||(t.setNode(a,{}),t.setEdge(o,a,{}),r(a))}))})),t.nodeCount()}function a(t,e){return n.minBy(e.edges(),(function(r){if(t.hasNode(r.v)!==t.hasNode(r.w))return i(e,r)}))}function u(t,e,r){n.forEach(t.nodes(),(function(t){e.node(t).rank+=r}))}t.exports=function(t){var e,r,n=new o({directed:!1}),h=t.nodes()[0],d=t.nodeCount();for(n.setNode(h,{});s(n,t)<d;)e=a(n,t),r=n.hasNode(e.v)?i(t,e):-i(t,e),u(n,t,r);return n}},9472:(t,e,r)=>{"use strict";var n=r(8666).longestPath,o=r(9996),i=r(4502);t.exports=function(t){switch(t.graph().ranker){case"network-simplex":default:!function(t){i(t)}(t);break;case"tight-tree":!function(t){n(t),o(t)}(t);break;case"longest-path":s(t)}};var s=n},4502:(t,e,r)=>{"use strict";var n=r(5076),o=r(9996),i=r(8666).slack,s=r(8666).longestPath,a=r(3374).alg.preorder,u=r(3374).alg.postorder,h=r(6573).simplify;function d(t){t=h(t),s(t);var e,r=o(t);for(f(r),c(r,t);e=p(r);)m(r,t,e,v(r,t,e))}function c(t,e){var r=u(t,t.nodes());r=r.slice(0,r.length-1),n.forEach(r,(function(r){!function(t,e,r){var n=t.node(r).parent;t.edge(r,n).cutvalue=l(t,e,r)}(t,e,r)}))}function l(t,e,r){var o=t.node(r).parent,i=!0,s=e.edge(r,o),a=0;return s||(i=!1,s=e.edge(o,r)),a=s.weight,n.forEach(e.nodeEdges(r),(function(n){var s,u,h=n.v===r,d=h?n.w:n.v;if(d!==o){var c=h===i,l=e.edge(n).weight;if(a+=c?l:-l,s=r,u=d,t.hasEdge(s,u)){var f=t.edge(r,d).cutvalue;a+=c?-f:f}}})),a}function f(t,e){arguments.length<2&&(e=t.nodes()[0]),g(t,{},1,e)}function g(t,e,r,o,i){var s=r,a=t.node(o);return e[o]=!0,n.forEach(t.neighbors(o),(function(i){n.has(e,i)||(r=g(t,e,r,i,o))})),a.low=s,a.lim=r++,i?a.parent=i:delete a.parent,r}function p(t){return n.find(t.edges(),(function(e){return t.edge(e).cutvalue<0}))}function v(t,e,r){var o=r.v,s=r.w;e.hasEdge(o,s)||(o=r.w,s=r.v);var a=t.node(o),u=t.node(s),h=a,d=!1;a.lim>u.lim&&(h=u,d=!0);var c=n.filter(e.edges(),(function(e){return d===y(0,t.node(e.v),h)&&d!==y(0,t.node(e.w),h)}));return n.minBy(c,(function(t){return i(e,t)}))}function m(t,e,r,o){var i=r.v,s=r.w;t.removeEdge(i,s),t.setEdge(o.v,o.w,{}),f(t),c(t,e),function(t,e){var r=n.find(t.nodes(),(function(t){return!e.node(t).parent})),o=a(t,r);o=o.slice(1),n.forEach(o,(function(r){var n=t.node(r).parent,o=e.edge(r,n),i=!1;o||(o=e.edge(n,r),i=!0),e.node(r).rank=e.node(n).rank+(i?o.minlen:-o.minlen)}))}(t,e)}function y(t,e,r){return r.low<=e.lim&&e.lim<=r.lim}t.exports=d,d.initLowLimValues=f,d.initCutValues=c,d.calcCutValue=l,d.leaveEdge=p,d.enterEdge=v,d.exchangeEdges=m},8666:(t,e,r)=>{"use strict";var n=r(5076);t.exports={longestPath:function(t){var e={};n.forEach(t.sources(),(function r(o){var i=t.node(o);if(n.has(e,o))return i.rank;e[o]=!0;var s=n.min(n.map(t.outEdges(o),(function(e){return r(e.w)-t.edge(e).minlen})));return s!==Number.POSITIVE_INFINITY&&null!=s||(s=0),i.rank=s}))},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}}},6573:(t,e,r)=>{"use strict";var n=r(5076),o=r(3374).Graph;function i(t,e,r,o){var i;do{i=n.uniqueId(o)}while(t.hasNode(i));return r.dummy=e,t.setNode(i,r),i}function s(t){return n.max(n.map(t.nodes(),(function(e){var r=t.node(e).rank;if(!n.isUndefined(r))return r})))}t.exports={addDummyNode:i,simplify:function(t){var e=(new o).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){var n=e.edge(r.v,r.w)||{weight:0,minlen:1},o=t.edge(r);e.setEdge(r.v,r.w,{weight:n.weight+o.weight,minlen:Math.max(n.minlen,o.minlen)})})),e},asNonCompoundGraph:function(t){var e=new o({multigraph:t.isMultigraph()}).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){t.children(r).length||e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){e.setEdge(r,t.edge(r))})),e},successorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.outEdges(e),(function(e){r[e.w]=(r[e.w]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.inEdges(e),(function(e){r[e.v]=(r[e.v]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},intersectRect:function(t,e){var r,n,o=t.x,i=t.y,s=e.x-o,a=e.y-i,u=t.width/2,h=t.height/2;if(!s&&!a)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(a)*u>Math.abs(s)*h?(a<0&&(h=-h),r=h*s/a,n=h):(s<0&&(u=-u),r=u,n=u*a/s),{x:o+r,y:i+n}},buildLayerMatrix:function(t){var e=n.map(n.range(s(t)+1),(function(){return[]}));return n.forEach(t.nodes(),(function(r){var o=t.node(r),i=o.rank;n.isUndefined(i)||(e[i][o.order]=r)})),e},normalizeRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank})));n.forEach(t.nodes(),(function(r){var o=t.node(r);n.has(o,"rank")&&(o.rank-=e)}))},removeEmptyRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank}))),r=[];n.forEach(t.nodes(),(function(n){var o=t.node(n).rank-e;r[o]||(r[o]=[]),r[o].push(n)}));var o=0,i=t.graph().nodeRankFactor;n.forEach(r,(function(e,r){n.isUndefined(e)&&r%i!=0?--o:o&&n.forEach(e,(function(e){t.node(e).rank+=o}))}))},addBorderNode:function(t,e,r,n){var o={width:0,height:0};return arguments.length>=4&&(o.rank=r,o.order=n),i(t,"border",o,e)},maxRank:s,partition:function(t,e){var r={lhs:[],rhs:[]};return n.forEach(t,(function(t){e(t)?r.lhs.push(t):r.rhs.push(t)})),r},time:function(t,e){var r=n.now();try{return e()}finally{console.log(t+" time: "+(n.now()-r)+"ms")}},notime:function(t,e){return e()}}},6661:t=>{t.exports="0.8.5"},7423:(t,e,r)=>{var n=r(783);t.exports={Graph:n.Graph,json:r(2350),alg:r(2638),version:n.version}},3536:(t,e,r)=>{var n=r(782);t.exports=function(t){var e,r={},o=[];function i(o){n.has(r,o)||(r[o]=!0,e.push(o),n.each(t.successors(o),i),n.each(t.predecessors(o),i))}return n.each(t.nodes(),(function(t){e=[],i(t),e.length&&o.push(e)})),o}},4933:(t,e,r)=>{var n=r(782);function o(t,e,r,i,s,a){n.has(i,e)||(i[e]=!0,r||a.push(e),n.each(s(e),(function(e){o(t,e,r,i,s,a)})),r&&a.push(e))}t.exports=function(t,e,r){n.isArray(e)||(e=[e]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),s=[],a={};return n.each(e,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);o(t,e,"post"===r,a,i,s)})),s}},9032:(t,e,r)=>{var n=r(4102),o=r(782);t.exports=function(t,e,r){return o.transform(t.nodes(),(function(o,i){o[i]=n(t,i,e,r)}),{})}},4102:(t,e,r)=>{var n=r(782),o=r(2468);t.exports=function(t,e,r,n){return function(t,e,r,n){var i,s,a={},u=new o,h=function(t){var e=t.v!==i?t.v:t.w,n=a[e],o=r(t),h=s.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+o);h<n.distance&&(n.distance=h,n.predecessor=i,u.decrease(e,h))};for(t.nodes().forEach((function(t){var r=t===e?0:Number.POSITIVE_INFINITY;a[t]={distance:r},u.add(t,r)}));u.size()>0&&(i=u.removeMin(),(s=a[i]).distance!==Number.POSITIVE_INFINITY);)n(i).forEach(h);return a}(t,String(e),r||i,n||function(e){return t.outEdges(e)})};var i=n.constant(1)},3983:(t,e,r)=>{var n=r(782),o=r(3952);t.exports=function(t){return n.filter(o(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}},2329:(t,e,r)=>{var n=r(782);t.exports=function(t,e,r){return function(t,e,r){var n={},o=t.nodes();return o.forEach((function(t){n[t]={},n[t][t]={distance:0},o.forEach((function(e){t!==e&&(n[t][e]={distance:Number.POSITIVE_INFINITY})})),r(t).forEach((function(r){var o=r.v===t?r.w:r.v,i=e(r);n[t][o]={distance:i,predecessor:t}}))})),o.forEach((function(t){var e=n[t];o.forEach((function(r){var i=n[r];o.forEach((function(r){var n=i[t],o=e[r],s=i[r],a=n.distance+o.distance;a<s.distance&&(s.distance=a,s.predecessor=o.predecessor)}))}))})),n}(t,e||o,r||function(e){return t.outEdges(e)})};var o=n.constant(1)},2638:(t,e,r)=>{t.exports={components:r(3536),dijkstra:r(4102),dijkstraAll:r(9032),findCycles:r(3983),floydWarshall:r(2329),isAcyclic:r(8345),postorder:r(1600),preorder:r(39),prim:r(6280),tarjan:r(3952),topsort:r(7849)}},8345:(t,e,r)=>{var n=r(7849);t.exports=function(t){try{n(t)}catch(t){if(t instanceof n.CycleException)return!1;throw t}return!0}},1600:(t,e,r)=>{var n=r(4933);t.exports=function(t,e){return n(t,e,"post")}},39:(t,e,r)=>{var n=r(4933);t.exports=function(t,e){return n(t,e,"pre")}},6280:(t,e,r)=>{var n=r(782),o=r(1943),i=r(2468);t.exports=function(t,e){var r,s=new o,a={},u=new i;function h(t){var n=t.v===r?t.w:t.v,o=u.priority(n);if(void 0!==o){var i=e(t);i<o&&(a[n]=r,u.decrease(n,i))}}if(0===t.nodeCount())return s;n.each(t.nodes(),(function(t){u.add(t,Number.POSITIVE_INFINITY),s.setNode(t)})),u.decrease(t.nodes()[0],0);for(var d=!1;u.size()>0;){if(r=u.removeMin(),n.has(a,r))s.setEdge(r,a[r]);else{if(d)throw new Error("Input graph is not connected: "+t);d=!0}t.nodeEdges(r).forEach(h)}return s}},3952:(t,e,r)=>{var n=r(782);t.exports=function(t){var e=0,r=[],o={},i=[];function s(a){var u=o[a]={onStack:!0,lowlink:e,index:e++};if(r.push(a),t.successors(a).forEach((function(t){n.has(o,t)?o[t].onStack&&(u.lowlink=Math.min(u.lowlink,o[t].index)):(s(t),u.lowlink=Math.min(u.lowlink,o[t].lowlink))})),u.lowlink===u.index){var h,d=[];do{h=r.pop(),o[h].onStack=!1,d.push(h)}while(a!==h);i.push(d)}}return t.nodes().forEach((function(t){n.has(o,t)||s(t)})),i}},7849:(t,e,r)=>{var n=r(782);function o(t){var e={},r={},o=[];if(n.each(t.sinks(),(function s(a){if(n.has(r,a))throw new i;n.has(e,a)||(r[a]=!0,e[a]=!0,n.each(t.predecessors(a),s),delete r[a],o.push(a))})),n.size(e)!==t.nodeCount())throw new i;return o}function i(){}t.exports=o,o.CycleException=i,i.prototype=new Error},2468:(t,e,r)=>{var n=r(782);function o(){this._arr=[],this._keyIndices={}}t.exports=o,o.prototype.size=function(){return this._arr.length},o.prototype.keys=function(){return this._arr.map((function(t){return t.key}))},o.prototype.has=function(t){return n.has(this._keyIndices,t)},o.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},o.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},o.prototype.add=function(t,e){var r=this._keyIndices;if(t=String(t),!n.has(r,t)){var o=this._arr,i=o.length;return r[t]=i,o.push({key:t,priority:e}),this._decrease(i),!0}return!1},o.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},o.prototype.decrease=function(t,e){var r=this._keyIndices[t];if(e>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[r].priority+" New: "+e);this._arr[r].priority=e,this._decrease(r)},o.prototype._heapify=function(t){var e=this._arr,r=2*t,n=r+1,o=t;r<e.length&&(o=e[r].priority<e[o].priority?r:o,n<e.length&&(o=e[n].priority<e[o].priority?n:o),o!==t&&(this._swap(t,o),this._heapify(o)))},o.prototype._decrease=function(t){for(var e,r=this._arr,n=r[t].priority;0!==t&&!(r[e=t>>1].priority<n);)this._swap(t,e),t=e},o.prototype._swap=function(t,e){var r=this._arr,n=this._keyIndices,o=r[t],i=r[e];r[t]=i,r[e]=o,n[i.key]=t,n[o.key]=e}},1943:(t,e,r)=>{"use strict";var n=r(782);t.exports=a;var o="\\0",i="\\0",s="";function a(t){this._isDirected=!n.has(t,"directed")||t.directed,this._isMultigraph=!!n.has(t,"multigraph")&&t.multigraph,this._isCompound=!!n.has(t,"compound")&&t.compound,this._label=void 0,this._defaultNodeLabelFn=n.constant(void 0),this._defaultEdgeLabelFn=n.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[i]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function u(t,e){t[e]?t[e]++:t[e]=1}function h(t,e){--t[e]||delete t[e]}function d(t,e,r,i){var a=""+e,u=""+r;if(!t&&a>u){var h=a;a=u,u=h}return a+s+u+s+(n.isUndefined(i)?o:i)}function c(t,e){return d(t,e.v,e.w,e.name)}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(t){return this._label=t,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultNodeLabelFn=t,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return n.keys(this._nodes)},a.prototype.sources=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._in[e])}))},a.prototype.sinks=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._out[e])}))},a.prototype.setNodes=function(t,e){var r=arguments,o=this;return n.each(t,(function(t){r.length>1?o.setNode(t,e):o.setNode(t)})),this},a.prototype.setNode=function(t,e){return n.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=i,this._children[t]={},this._children[i][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},a.prototype.node=function(t){return this._nodes[t]},a.prototype.hasNode=function(t){return n.has(this._nodes,t)},a.prototype.removeNode=function(t){var e=this;if(n.has(this._nodes,t)){var r=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],n.each(this.children(t),(function(t){e.setParent(t)})),delete this._children[t]),n.each(n.keys(this._in[t]),r),delete this._in[t],delete this._preds[t],n.each(n.keys(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},a.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n.isUndefined(e))e=i;else{for(var r=e+="";!n.isUndefined(r);r=this.parent(r))if(r===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},a.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},a.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if(e!==i)return e}},a.prototype.children=function(t){if(n.isUndefined(t)&&(t=i),this._isCompound){var e=this._children[t];if(e)return n.keys(e)}else{if(t===i)return this.nodes();if(this.hasNode(t))return[]}},a.prototype.predecessors=function(t){var e=this._preds[t];if(e)return n.keys(e)},a.prototype.successors=function(t){var e=this._sucs[t];if(e)return n.keys(e)},a.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return n.union(e,this.successors(t))},a.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},a.prototype.filterNodes=function(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var r=this;n.each(this._nodes,(function(r,n){t(n)&&e.setNode(n,r)})),n.each(this._edgeObjs,(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,r.edge(t))}));var o={};function i(t){var n=r.parent(t);return void 0===n||e.hasNode(n)?(o[t]=n,n):n in o?o[n]:i(n)}return this._isCompound&&n.each(e.nodes(),(function(t){e.setParent(t,i(t))})),e},a.prototype.setDefaultEdgeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultEdgeLabelFn=t,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return n.values(this._edgeObjs)},a.prototype.setPath=function(t,e){var r=this,o=arguments;return n.reduce(t,(function(t,n){return o.length>1?r.setEdge(t,n,e):r.setEdge(t,n),n})),this},a.prototype.setEdge=function(){var t,e,r,o,i=!1,s=arguments[0];"object"==typeof s&&null!==s&&"v"in s?(t=s.v,e=s.w,r=s.name,2===arguments.length&&(o=arguments[1],i=!0)):(t=s,e=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],i=!0)),t=""+t,e=""+e,n.isUndefined(r)||(r=""+r);var a=d(this._isDirected,t,e,r);if(n.has(this._edgeLabels,a))return i&&(this._edgeLabels[a]=o),this;if(!n.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[a]=i?o:this._defaultEdgeLabelFn(t,e,r);var h=function(t,e,r,n){var o=""+e,i=""+r;if(!t&&o>i){var s=o;o=i,i=s}var a={v:o,w:i};return n&&(a.name=n),a}(this._isDirected,t,e,r);return t=h.v,e=h.w,Object.freeze(h),this._edgeObjs[a]=h,u(this._preds[e],t),u(this._sucs[t],e),this._in[e][a]=h,this._out[t][a]=h,this._edgeCount++,this},a.prototype.edge=function(t,e,r){var n=1===arguments.length?c(this._isDirected,arguments[0]):d(this._isDirected,t,e,r);return this._edgeLabels[n]},a.prototype.hasEdge=function(t,e,r){var o=1===arguments.length?c(this._isDirected,arguments[0]):d(this._isDirected,t,e,r);return n.has(this._edgeLabels,o)},a.prototype.removeEdge=function(t,e,r){var n=1===arguments.length?c(this._isDirected,arguments[0]):d(this._isDirected,t,e,r),o=this._edgeObjs[n];return o&&(t=o.v,e=o.w,delete this._edgeLabels[n],delete this._edgeObjs[n],h(this._preds[e],t),h(this._sucs[t],e),delete this._in[e][n],delete this._out[t][n],this._edgeCount--),this},a.prototype.inEdges=function(t,e){var r=this._in[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.v===e})):o}},a.prototype.outEdges=function(t,e){var r=this._out[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.w===e})):o}},a.prototype.nodeEdges=function(t,e){var r=this.inEdges(t,e);if(r)return r.concat(this.outEdges(t,e))}},783:(t,e,r)=>{t.exports={Graph:r(1943),version:r(1471)}},2350:(t,e,r)=>{var n=r(782),o=r(1943);function i(t){return n.map(t.nodes(),(function(e){var r=t.node(e),o=t.parent(e),i={v:e};return n.isUndefined(r)||(i.value=r),n.isUndefined(o)||(i.parent=o),i}))}function s(t){return n.map(t.edges(),(function(e){var r=t.edge(e),o={v:e.v,w:e.w};return n.isUndefined(e.name)||(o.name=e.name),n.isUndefined(r)||(o.value=r),o}))}t.exports={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:i(t),edges:s(t)};return n.isUndefined(t.graph())||(e.value=n.clone(t.graph())),e},read:function(t){var e=new o(t.options).setGraph(t.value);return n.each(t.nodes,(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)})),n.each(t.edges,(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),e}}},782:(t,e,r)=>{var n;try{n={clone:r(5402),constant:r(8295),each:r(958),filter:r(9969),has:r(4339),isArray:r(5874),isEmpty:r(2046),isFunction:r(7787),isUndefined:r(2895),keys:r(3511),map:r(9629),reduce:r(9285),size:r(3910),transform:r(3279),union:r(3344),values:r(3005)}}catch(t){}n||(n=window._),t.exports=n},1471:t=>{t.exports="2.1.8"},5229:(t,e,r)=>{"use strict";r.r(e),r.d(e,{isAnyArray:()=>o});const n=Object.prototype.toString;function o(t){const e=n.call(t);return e.endsWith("Array]")&&!e.includes("Big")}},6171:(t,e,r)=>{var n=r(4671)(r(714),"DataView");t.exports=n},6766:(t,e,r)=>{var n=r(2405),o=r(8341),i=r(9644),s=r(3784),a=r(6264);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},1022:(t,e,r)=>{var n=r(6821),o=r(7221),i=r(1596),s=r(1992),a=r(552);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},5870:(t,e,r)=>{var n=r(4671)(r(714),"Map");t.exports=n},8910:(t,e,r)=>{var n=r(4069),o=r(7477),i=r(476),s=r(984),a=r(4136);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=s,u.prototype.set=a,t.exports=u},4665:(t,e,r)=>{var n=r(4671)(r(714),"Promise");t.exports=n},9612:(t,e,r)=>{var n=r(4671)(r(714),"Set");t.exports=n},2312:(t,e,r)=>{var n=r(8910),o=r(1945),i=r(4874);function s(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new n;++e<r;)this.add(t[e])}s.prototype.add=s.prototype.push=o,s.prototype.has=i,t.exports=s},7216:(t,e,r)=>{var n=r(1022),o=r(5331),i=r(7063),s=r(134),a=r(9842),u=r(9850);function h(t){var e=this.__data__=new n(t);this.size=e.size}h.prototype.clear=o,h.prototype.delete=i,h.prototype.get=s,h.prototype.has=a,h.prototype.set=u,t.exports=h},9006:(t,e,r)=>{var n=r(714).Symbol;t.exports=n},8851:(t,e,r)=>{var n=r(714).Uint8Array;t.exports=n},8154:(t,e,r)=>{var n=r(4671)(r(714),"WeakMap");t.exports=n},7156:t=>{t.exports=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}},7012:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}},2995:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var s=t[r];e(s,r,t)&&(i[o++]=s)}return i}},128:(t,e,r)=>{var n=r(8506);t.exports=function(t,e){return!(null==t||!t.length)&&n(t,e,0)>-1}},6184:t=>{t.exports=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1}},9754:(t,e,r)=>{var n=r(9605),o=r(79),i=r(5874),s=r(3601),a=r(1908),u=r(9046),h=Object.prototype.hasOwnProperty;t.exports=function(t,e){var r=i(t),d=!r&&o(t),c=!r&&!d&&s(t),l=!r&&!d&&!c&&u(t),f=r||d||c||l,g=f?n(t.length,String):[],p=g.length;for(var v in t)!e&&!h.call(t,v)||f&&("length"==v||c&&("offset"==v||"parent"==v)||l&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||a(v,p))||g.push(v);return g}},2275:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}},2525:t=>{t.exports=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}},8663:t=>{t.exports=function(t,e,r,n){var o=-1,i=null==t?0:t.length;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}},3525:t=>{t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}},446:(t,e,r)=>{var n=r(8494)("length");t.exports=n},2430:(t,e,r)=>{var n=r(3077),o=r(5097);t.exports=function(t,e,r){(void 0!==r&&!o(t[e],r)||void 0===r&&!(e in t))&&n(t,e,r)}},5802:(t,e,r)=>{var n=r(3077),o=r(5097),i=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){var s=t[e];i.call(t,e)&&o(s,r)&&(void 0!==r||e in t)||n(t,e,r)}},9438:(t,e,r)=>{var n=r(5097);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},6902:(t,e,r)=>{var n=r(5532),o=r(3511);t.exports=function(t,e){return t&&n(e,o(e),t)}},5873:(t,e,r)=>{var n=r(5532),o=r(2844);t.exports=function(t,e){return t&&n(e,o(e),t)}},3077:(t,e,r)=>{var n=r(4856);t.exports=function(t,e,r){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}},9018:(t,e,r)=>{var n=r(7216),o=r(7012),i=r(5802),s=r(6902),a=r(5873),u=r(6743),h=r(310),d=r(5590),c=r(2209),l=r(2573),f=r(3918),g=r(9778),p=r(5290),v=r(4028),m=r(9168),y=r(5874),w=r(3601),x=r(4725),b=r(9400),E=r(7363),N=r(3511),M=r(2844),_="[object Arguments]",k="[object Function]",A="[object Object]",j={};j[_]=j["[object Array]"]=j["[object ArrayBuffer]"]=j["[object DataView]"]=j["[object Boolean]"]=j["[object Date]"]=j["[object Float32Array]"]=j["[object Float64Array]"]=j["[object Int8Array]"]=j["[object Int16Array]"]=j["[object Int32Array]"]=j["[object Map]"]=j["[object Number]"]=j[A]=j["[object RegExp]"]=j["[object Set]"]=j["[object String]"]=j["[object Symbol]"]=j["[object Uint8Array]"]=j["[object Uint8ClampedArray]"]=j["[object Uint16Array]"]=j["[object Uint32Array]"]=!0,j["[object Error]"]=j[k]=j["[object WeakMap]"]=!1,t.exports=function t(e,r,S,O,z,R){var I,C=1&r,D=2&r,P=4&r;if(S&&(I=z?S(e,O,z,R):S(e)),void 0!==I)return I;if(!b(e))return e;var T=y(e);if(T){if(I=p(e),!C)return h(e,I)}else{var L=g(e),F=L==k||"[object GeneratorFunction]"==L;if(w(e))return u(e,C);if(L==A||L==_||F&&!z){if(I=D||F?{}:m(e),!C)return D?c(e,a(I,e)):d(e,s(I,e))}else{if(!j[L])return z?e:{};I=v(e,L,C)}}R||(R=new n);var q=R.get(e);if(q)return q;R.set(e,I),E(e)?e.forEach((function(n){I.add(t(n,r,S,n,e,R))})):x(e)&&e.forEach((function(n,o){I.set(o,t(n,r,S,o,e,R))}));var V=T?void 0:(P?D?f:l:D?M:N)(e);return o(V||e,(function(n,o){V&&(n=e[o=n]),i(I,o,t(n,r,S,o,e,R))})),I}},1095:(t,e,r)=>{var n=r(9400),o=Object.create,i=function(){function t(){}return function(e){if(!n(e))return{};if(o)return o(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();t.exports=i},830:(t,e,r)=>{var n=r(7702),o=r(8678)(n);t.exports=o},5816:(t,e,r)=>{var n=r(975);t.exports=function(t,e,r){for(var o=-1,i=t.length;++o<i;){var s=t[o],a=e(s);if(null!=a&&(void 0===u?a==a&&!n(a):r(a,u)))var u=a,h=s}return h}},1329:(t,e,r)=>{var n=r(830);t.exports=function(t,e){var r=[];return n(t,(function(t,n,o){e(t,n,o)&&r.push(t)})),r}},166:t=>{t.exports=function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1}},9821:(t,e,r)=>{var n=r(2525),o=r(3542);t.exports=function t(e,r,i,s,a){var u=-1,h=e.length;for(i||(i=o),a||(a=[]);++u<h;){var d=e[u];r>0&&i(d)?r>1?t(d,r-1,i,s,a):n(a,d):s||(a[a.length]=d)}return a}},9128:(t,e,r)=>{var n=r(3600)();t.exports=n},7702:(t,e,r)=>{var n=r(9128),o=r(3511);t.exports=function(t,e){return t&&n(t,e,o)}},1855:(t,e,r)=>{var n=r(330),o=r(9628);t.exports=function(t,e){for(var r=0,i=(e=n(e,t)).length;null!=t&&r<i;)t=t[o(e[r++])];return r&&r==i?t:void 0}},5920:(t,e,r)=>{var n=r(2525),o=r(5874);t.exports=function(t,e,r){var i=e(t);return o(t)?i:n(i,r(t))}},5271:(t,e,r)=>{var n=r(9006),o=r(9650),i=r(6881),s=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":s&&s in Object(t)?o(t):i(t)}},4116:t=>{t.exports=function(t,e){return t>e}},3091:t=>{var e=Object.prototype.hasOwnProperty;t.exports=function(t,r){return null!=t&&e.call(t,r)}},5088:t=>{t.exports=function(t,e){return null!=t&&e in Object(t)}},8506:(t,e,r)=>{var n=r(166),o=r(8306),i=r(638);t.exports=function(t,e,r){return e==e?i(t,e,r):n(t,o,r)}},4047:(t,e,r)=>{var n=r(5271),o=r(7583);t.exports=function(t){return o(t)&&"[object Arguments]"==n(t)}},3899:(t,e,r)=>{var n=r(8309),o=r(7583);t.exports=function t(e,r,i,s,a){return e===r||(null==e||null==r||!o(e)&&!o(r)?e!=e&&r!=r:n(e,r,i,s,t,a))}},8309:(t,e,r)=>{var n=r(7216),o=r(3522),i=r(9481),s=r(8370),a=r(9778),u=r(5874),h=r(3601),d=r(9046),c="[object Arguments]",l="[object Array]",f="[object Object]",g=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,p,v,m){var y=u(t),w=u(e),x=y?l:a(t),b=w?l:a(e),E=(x=x==c?f:x)==f,N=(b=b==c?f:b)==f,M=x==b;if(M&&h(t)){if(!h(e))return!1;y=!0,E=!1}if(M&&!E)return m||(m=new n),y||d(t)?o(t,e,r,p,v,m):i(t,e,x,r,p,v,m);if(!(1&r)){var _=E&&g.call(t,"__wrapped__"),k=N&&g.call(e,"__wrapped__");if(_||k){var A=_?t.value():t,j=k?e.value():e;return m||(m=new n),v(A,j,r,p,m)}}return!!M&&(m||(m=new n),s(t,e,r,p,v,m))}},4965:(t,e,r)=>{var n=r(9778),o=r(7583);t.exports=function(t){return o(t)&&"[object Map]"==n(t)}},4014:(t,e,r)=>{var n=r(7216),o=r(3899);t.exports=function(t,e,r,i){var s=r.length,a=s,u=!i;if(null==t)return!a;for(t=Object(t);s--;){var h=r[s];if(u&&h[2]?h[1]!==t[h[0]]:!(h[0]in t))return!1}for(;++s<a;){var d=(h=r[s])[0],c=t[d],l=h[1];if(u&&h[2]){if(void 0===c&&!(d in t))return!1}else{var f=new n;if(i)var g=i(c,l,d,t,e,f);if(!(void 0===g?o(l,c,3,i,f):g))return!1}}return!0}},8306:t=>{t.exports=function(t){return t!=t}},4228:(t,e,r)=>{var n=r(7787),o=r(7827),i=r(9400),s=r(462),a=/^\\[object .+?Constructor\\]$/,u=Function.prototype,h=Object.prototype,d=u.toString,c=h.hasOwnProperty,l=RegExp("^"+d.call(c).replace(/[\\\\^$.*+?()[\\]{}|]/g,"\\\\$&").replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!i(t)||o(t))&&(n(t)?l:a).test(s(t))}},6499:(t,e,r)=>{var n=r(9778),o=r(7583);t.exports=function(t){return o(t)&&"[object Set]"==n(t)}},550:(t,e,r)=>{var n=r(5271),o=r(4583),i=r(7583),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,t.exports=function(t){return i(t)&&o(t.length)&&!!s[n(t)]}},4506:(t,e,r)=>{var n=r(6330),o=r(2363),i=r(9169),s=r(5874),a=r(6830);t.exports=function(t){return"function"==typeof t?t:null==t?i:"object"==typeof t?s(t)?o(t[0],t[1]):n(t):a(t)}},5351:(t,e,r)=>{var n=r(7894),o=r(2325),i=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return o(t);var e=[];for(var r in Object(t))i.call(t,r)&&"constructor"!=r&&e.push(r);return e}},1500:(t,e,r)=>{var n=r(9400),o=r(7894),i=r(5382),s=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return i(t);var e=o(t),r=[];for(var a in t)("constructor"!=a||!e&&s.call(t,a))&&r.push(a);return r}},2795:t=>{t.exports=function(t,e){return t<e}},4733:(t,e,r)=>{var n=r(830),o=r(3069);t.exports=function(t,e){var r=-1,i=o(t)?Array(t.length):[];return n(t,(function(t,n,o){i[++r]=e(t,n,o)})),i}},6330:(t,e,r)=>{var n=r(4014),o=r(6539),i=r(7316);t.exports=function(t){var e=o(t);return 1==e.length&&e[0][2]?i(e[0][0],e[0][1]):function(r){return r===t||n(r,t,e)}}},2363:(t,e,r)=>{var n=r(3899),o=r(5887),i=r(4016),s=r(759),a=r(7223),u=r(7316),h=r(9628);t.exports=function(t,e){return s(t)&&a(e)?u(h(t),e):function(r){var s=o(r,t);return void 0===s&&s===e?i(r,t):n(e,s,3)}}},4479:(t,e,r)=>{var n=r(7216),o=r(2430),i=r(9128),s=r(3857),a=r(9400),u=r(2844),h=r(6127);t.exports=function t(e,r,d,c,l){e!==r&&i(r,(function(i,u){if(l||(l=new n),a(i))s(e,r,u,d,t,c,l);else{var f=c?c(h(e,u),i,u+"",e,r,l):void 0;void 0===f&&(f=i),o(e,u,f)}}),u)}},3857:(t,e,r)=>{var n=r(2430),o=r(6743),i=r(1532),s=r(310),a=r(9168),u=r(79),h=r(5874),d=r(6882),c=r(3601),l=r(7787),f=r(9400),g=r(4108),p=r(9046),v=r(6127),m=r(339);t.exports=function(t,e,r,y,w,x,b){var E=v(t,r),N=v(e,r),M=b.get(N);if(M)n(t,r,M);else{var _=x?x(E,N,r+"",t,e,b):void 0,k=void 0===_;if(k){var A=h(N),j=!A&&c(N),S=!A&&!j&&p(N);_=N,A||j||S?h(E)?_=E:d(E)?_=s(E):j?(k=!1,_=o(N,!0)):S?(k=!1,_=i(N,!0)):_=[]:g(N)||u(N)?(_=E,u(E)?_=m(E):f(E)&&!l(E)||(_=a(N))):k=!1}k&&(b.set(N,_),w(_,N,y,x,b),b.delete(N)),n(t,r,_)}}},9586:(t,e,r)=>{var n=r(2275),o=r(1855),i=r(4506),s=r(4733),a=r(7070),u=r(8232),h=r(6395),d=r(9169),c=r(5874);t.exports=function(t,e,r){e=e.length?n(e,(function(t){return c(t)?function(e){return o(e,1===t.length?t[0]:t)}:t})):[d];var l=-1;e=n(e,u(i));var f=s(t,(function(t,r,o){return{criteria:n(e,(function(e){return e(t)})),index:++l,value:t}}));return a(f,(function(t,e){return h(t,e,r)}))}},4286:(t,e,r)=>{var n=r(8499),o=r(4016);t.exports=function(t,e){return n(t,e,(function(e,r){return o(t,r)}))}},8499:(t,e,r)=>{var n=r(1855),o=r(9435),i=r(330);t.exports=function(t,e,r){for(var s=-1,a=e.length,u={};++s<a;){var h=e[s],d=n(t,h);r(d,h)&&o(u,i(h,t),d)}return u}},8494:t=>{t.exports=function(t){return function(e){return null==e?void 0:e[t]}}},3644:(t,e,r)=>{var n=r(1855);t.exports=function(t){return function(e){return n(e,t)}}},8514:t=>{var e=Math.ceil,r=Math.max;t.exports=function(t,n,o,i){for(var s=-1,a=r(e((n-t)/(o||1)),0),u=Array(a);a--;)u[i?a:++s]=t,t+=o;return u}},8421:t=>{t.exports=function(t,e,r,n,o){return o(t,(function(t,o,i){r=n?(n=!1,t):e(r,t,o,i)})),r}},6965:(t,e,r)=>{var n=r(9169),o=r(5390),i=r(3232);t.exports=function(t,e){return i(o(t,e,n),t+"")}},9435:(t,e,r)=>{var n=r(5802),o=r(330),i=r(1908),s=r(9400),a=r(9628);t.exports=function(t,e,r,u){if(!s(t))return t;for(var h=-1,d=(e=o(e,t)).length,c=d-1,l=t;null!=l&&++h<d;){var f=a(e[h]),g=r;if("__proto__"===f||"constructor"===f||"prototype"===f)return t;if(h!=c){var p=l[f];void 0===(g=u?u(p,f,l):void 0)&&(g=s(p)?p:i(e[h+1])?[]:{})}n(l,f,g),l=l[f]}return t}},3431:(t,e,r)=>{var n=r(8295),o=r(4856),i=r(9169),s=o?function(t,e){return o(t,"toString",{configurable:!0,enumerable:!1,value:n(e),writable:!0})}:i;t.exports=s},7070:t=>{t.exports=function(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}},9605:t=>{t.exports=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}},8071:(t,e,r)=>{var n=r(9006),o=r(2275),i=r(5874),s=r(975),a=n?n.prototype:void 0,u=a?a.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(i(e))return o(e,t)+"";if(s(e))return u?u.call(e):"";var r=e+"";return"0"==r&&1/e==-1/0?"-0":r}},5103:(t,e,r)=>{var n=r(4997),o=/^\\s+/;t.exports=function(t){return t?t.slice(0,n(t)+1).replace(o,""):t}},8232:t=>{t.exports=function(t){return function(e){return t(e)}}},3434:(t,e,r)=>{var n=r(2312),o=r(128),i=r(6184),s=r(5420),a=r(2196),u=r(6968);t.exports=function(t,e,r){var h=-1,d=o,c=t.length,l=!0,f=[],g=f;if(r)l=!1,d=i;else if(c>=200){var p=e?null:a(t);if(p)return u(p);l=!1,d=s,g=new n}else g=e?[]:f;t:for(;++h<c;){var v=t[h],m=e?e(v):v;if(v=r||0!==v?v:0,l&&m==m){for(var y=g.length;y--;)if(g[y]===m)continue t;e&&g.push(m),f.push(v)}else d(g,m,r)||(g!==f&&g.push(m),f.push(v))}return f}},989:(t,e,r)=>{var n=r(2275);t.exports=function(t,e){return n(e,(function(e){return t[e]}))}},2543:t=>{t.exports=function(t,e,r){for(var n=-1,o=t.length,i=e.length,s={};++n<o;){var a=n<i?e[n]:void 0;r(s,t[n],a)}return s}},5420:t=>{t.exports=function(t,e){return t.has(e)}},4041:(t,e,r)=>{var n=r(9169);t.exports=function(t){return"function"==typeof t?t:n}},330:(t,e,r)=>{var n=r(5874),o=r(759),i=r(9505),s=r(983);t.exports=function(t,e){return n(t)?t:o(t,e)?[t]:i(s(t))}},9270:(t,e,r)=>{var n=r(8851);t.exports=function(t){var e=new t.constructor(t.byteLength);return new n(e).set(new n(t)),e}},6743:(t,e,r)=>{t=r.nmd(t);var n=r(714),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o?n.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=a?a(r):new t.constructor(r);return t.copy(n),n}},5940:(t,e,r)=>{var n=r(9270);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}},5320:t=>{var e=/\\w*$/;t.exports=function(t){var r=new t.constructor(t.source,e.exec(t));return r.lastIndex=t.lastIndex,r}},4937:(t,e,r)=>{var n=r(9006),o=n?n.prototype:void 0,i=o?o.valueOf:void 0;t.exports=function(t){return i?Object(i.call(t)):{}}},1532:(t,e,r)=>{var n=r(9270);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}},1141:(t,e,r)=>{var n=r(975);t.exports=function(t,e){if(t!==e){var r=void 0!==t,o=null===t,i=t==t,s=n(t),a=void 0!==e,u=null===e,h=e==e,d=n(e);if(!u&&!d&&!s&&t>e||s&&a&&h&&!u&&!d||o&&a&&h||!r&&h||!i)return 1;if(!o&&!s&&!d&&t<e||d&&r&&i&&!o&&!s||u&&r&&i||!a&&i||!h)return-1}return 0}},6395:(t,e,r)=>{var n=r(1141);t.exports=function(t,e,r){for(var o=-1,i=t.criteria,s=e.criteria,a=i.length,u=r.length;++o<a;){var h=n(i[o],s[o]);if(h)return o>=u?h:h*("desc"==r[o]?-1:1)}return t.index-e.index}},310:t=>{t.exports=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}},5532:(t,e,r)=>{var n=r(5802),o=r(3077);t.exports=function(t,e,r,i){var s=!r;r||(r={});for(var a=-1,u=e.length;++a<u;){var h=e[a],d=i?i(r[h],t[h],h,r,t):void 0;void 0===d&&(d=t[h]),s?o(r,h,d):n(r,h,d)}return r}},5590:(t,e,r)=>{var n=r(5532),o=r(9183);t.exports=function(t,e){return n(t,o(t),e)}},2209:(t,e,r)=>{var n=r(5532),o=r(596);t.exports=function(t,e){return n(t,o(t),e)}},6450:(t,e,r)=>{var n=r(714)["__core-js_shared__"];t.exports=n},1292:(t,e,r)=>{var n=r(6965),o=r(8819);t.exports=function(t){return n((function(e,r){var n=-1,i=r.length,s=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(s=t.length>3&&"function"==typeof s?(i--,s):void 0,a&&o(r[0],r[1],a)&&(s=i<3?void 0:s,i=1),e=Object(e);++n<i;){var u=r[n];u&&t(e,u,n,s)}return e}))}},8678:(t,e,r)=>{var n=r(3069);t.exports=function(t,e){return function(r,o){if(null==r)return r;if(!n(r))return t(r,o);for(var i=r.length,s=e?i:-1,a=Object(r);(e?s--:++s<i)&&!1!==o(a[s],s,a););return r}}},3600:t=>{t.exports=function(t){return function(e,r,n){for(var o=-1,i=Object(e),s=n(e),a=s.length;a--;){var u=s[t?a:++o];if(!1===r(i[u],u,i))break}return e}}},6057:(t,e,r)=>{var n=r(4506),o=r(3069),i=r(3511);t.exports=function(t){return function(e,r,s){var a=Object(e);if(!o(e)){var u=n(r,3);e=i(e),r=function(t){return u(a[t],t,a)}}var h=t(e,r,s);return h>-1?a[u?e[h]:h]:void 0}}},4590:(t,e,r)=>{var n=r(8514),o=r(8819),i=r(8265);t.exports=function(t){return function(e,r,s){return s&&"number"!=typeof s&&o(e,r,s)&&(r=s=void 0),e=i(e),void 0===r?(r=e,e=0):r=i(r),s=void 0===s?e<r?1:-1:i(s),n(e,r,s,t)}}},2196:(t,e,r)=>{var n=r(9612),o=r(3883),i=r(6968),s=n&&1/i(new n([,-0]))[1]==1/0?function(t){return new n(t)}:o;t.exports=s},4856:(t,e,r)=>{var n=r(4671),o=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},3522:(t,e,r)=>{var n=r(2312),o=r(3525),i=r(5420);t.exports=function(t,e,r,s,a,u){var h=1&r,d=t.length,c=e.length;if(d!=c&&!(h&&c>d))return!1;var l=u.get(t),f=u.get(e);if(l&&f)return l==e&&f==t;var g=-1,p=!0,v=2&r?new n:void 0;for(u.set(t,e),u.set(e,t);++g<d;){var m=t[g],y=e[g];if(s)var w=h?s(y,m,g,e,t,u):s(m,y,g,t,e,u);if(void 0!==w){if(w)continue;p=!1;break}if(v){if(!o(e,(function(t,e){if(!i(v,e)&&(m===t||a(m,t,r,s,u)))return v.push(e)}))){p=!1;break}}else if(m!==y&&!a(m,y,r,s,u)){p=!1;break}}return u.delete(t),u.delete(e),p}},9481:(t,e,r)=>{var n=r(9006),o=r(8851),i=r(5097),s=r(3522),a=r(8866),u=r(6968),h=n?n.prototype:void 0,d=h?h.valueOf:void 0;t.exports=function(t,e,r,n,h,c,l){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!c(new o(t),new o(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var f=a;case"[object Set]":var g=1&n;if(f||(f=u),t.size!=e.size&&!g)return!1;var p=l.get(t);if(p)return p==e;n|=2,l.set(t,e);var v=s(f(t),f(e),n,h,c,l);return l.delete(t),v;case"[object Symbol]":if(d)return d.call(t)==d.call(e)}return!1}},8370:(t,e,r)=>{var n=r(2573),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,i,s,a){var u=1&r,h=n(t),d=h.length;if(d!=n(e).length&&!u)return!1;for(var c=d;c--;){var l=h[c];if(!(u?l in e:o.call(e,l)))return!1}var f=a.get(t),g=a.get(e);if(f&&g)return f==e&&g==t;var p=!0;a.set(t,e),a.set(e,t);for(var v=u;++c<d;){var m=t[l=h[c]],y=e[l];if(i)var w=u?i(y,m,l,e,t,a):i(m,y,l,t,e,a);if(!(void 0===w?m===y||s(m,y,r,i,a):w)){p=!1;break}v||(v="constructor"==l)}if(p&&!v){var x=t.constructor,b=e.constructor;x==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof x&&x instanceof x&&"function"==typeof b&&b instanceof b||(p=!1)}return a.delete(t),a.delete(e),p}},4139:(t,e,r)=>{var n=r(7469),o=r(5390),i=r(3232);t.exports=function(t){return i(o(t,void 0,n),t+"")}},1603:(t,e,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;t.exports=n},2573:(t,e,r)=>{var n=r(5920),o=r(9183),i=r(3511);t.exports=function(t){return n(t,i,o)}},3918:(t,e,r)=>{var n=r(5920),o=r(596),i=r(2844);t.exports=function(t){return n(t,i,o)}},1200:(t,e,r)=>{var n=r(95);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},6539:(t,e,r)=>{var n=r(7223),o=r(3511);t.exports=function(t){for(var e=o(t),r=e.length;r--;){var i=e[r],s=t[i];e[r]=[i,s,n(s)]}return e}},4671:(t,e,r)=>{var n=r(4228),o=r(7559);t.exports=function(t,e){var r=o(t,e);return n(r)?r:void 0}},7556:(t,e,r)=>{var n=r(8546)(Object.getPrototypeOf,Object);t.exports=n},9650:(t,e,r)=>{var n=r(9006),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,a=n?n.toStringTag:void 0;t.exports=function(t){var e=i.call(t,a),r=t[a];try{t[a]=void 0;var n=!0}catch(t){}var o=s.call(t);return n&&(e?t[a]=r:delete t[a]),o}},9183:(t,e,r)=>{var n=r(2995),o=r(2982),i=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,a=s?function(t){return null==t?[]:(t=Object(t),n(s(t),(function(e){return i.call(t,e)})))}:o;t.exports=a},596:(t,e,r)=>{var n=r(2525),o=r(7556),i=r(9183),s=r(2982),a=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)n(e,i(t)),t=o(t);return e}:s;t.exports=a},9778:(t,e,r)=>{var n=r(6171),o=r(5870),i=r(4665),s=r(9612),a=r(8154),u=r(5271),h=r(462),d="[object Map]",c="[object Promise]",l="[object Set]",f="[object WeakMap]",g="[object DataView]",p=h(n),v=h(o),m=h(i),y=h(s),w=h(a),x=u;(n&&x(new n(new ArrayBuffer(1)))!=g||o&&x(new o)!=d||i&&x(i.resolve())!=c||s&&x(new s)!=l||a&&x(new a)!=f)&&(x=function(t){var e=u(t),r="[object Object]"==e?t.constructor:void 0,n=r?h(r):"";if(n)switch(n){case p:return g;case v:return d;case m:return c;case y:return l;case w:return f}return e}),t.exports=x},7559:t=>{t.exports=function(t,e){return null==t?void 0:t[e]}},9663:(t,e,r)=>{var n=r(330),o=r(79),i=r(5874),s=r(1908),a=r(4583),u=r(9628);t.exports=function(t,e,r){for(var h=-1,d=(e=n(e,t)).length,c=!1;++h<d;){var l=u(e[h]);if(!(c=null!=t&&r(t,l)))break;t=t[l]}return c||++h!=d?c:!!(d=null==t?0:t.length)&&a(d)&&s(l,d)&&(i(t)||o(t))}},3493:t=>{var e=RegExp("[\\\\u200d\\\\ud800-\\\\udfff\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe2f\\\\u20d0-\\\\u20ff\\\\ufe0e\\\\ufe0f]");t.exports=function(t){return e.test(t)}},2405:(t,e,r)=>{var n=r(8637);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},8341:t=>{t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},9644:(t,e,r)=>{var n=r(8637),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return o.call(e,t)?e[t]:void 0}},3784:(t,e,r)=>{var n=r(8637),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:o.call(e,t)}},6264:(t,e,r)=>{var n=r(8637);t.exports=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},5290:t=>{var e=Object.prototype.hasOwnProperty;t.exports=function(t){var r=t.length,n=new t.constructor(r);return r&&"string"==typeof t[0]&&e.call(t,"index")&&(n.index=t.index,n.input=t.input),n}},4028:(t,e,r)=>{var n=r(9270),o=r(5940),i=r(5320),s=r(4937),a=r(1532);t.exports=function(t,e,r){var u=t.constructor;switch(e){case"[object ArrayBuffer]":return n(t);case"[object Boolean]":case"[object Date]":return new u(+t);case"[object DataView]":return o(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return a(t,r);case"[object Map]":case"[object Set]":return new u;case"[object Number]":case"[object String]":return new u(t);case"[object RegExp]":return i(t);case"[object Symbol]":return s(t)}}},9168:(t,e,r)=>{var n=r(1095),o=r(7556),i=r(7894);t.exports=function(t){return"function"!=typeof t.constructor||i(t)?{}:n(o(t))}},3542:(t,e,r)=>{var n=r(9006),o=r(79),i=r(5874),s=n?n.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(s&&t&&t[s])}},1908:t=>{var e=/^(?:0|[1-9]\\d*)$/;t.exports=function(t,r){var n=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<r}},8819:(t,e,r)=>{var n=r(5097),o=r(3069),i=r(1908),s=r(9400);t.exports=function(t,e,r){if(!s(r))return!1;var a=typeof e;return!!("number"==a?o(r)&&i(e,r.length):"string"==a&&e in r)&&n(r[e],t)}},759:(t,e,r)=>{var n=r(5874),o=r(975),i=/\\.|\\[(?:[^[\\]]*|(["\'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,s=/^\\w*$/;t.exports=function(t,e){if(n(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!o(t))||s.test(t)||!i.test(t)||null!=e&&t in Object(e)}},95:t=>{t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},7827:(t,e,r)=>{var n,o=r(6450),i=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!i&&i in t}},7894:t=>{var e=Object.prototype;t.exports=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}},7223:(t,e,r)=>{var n=r(9400);t.exports=function(t){return t==t&&!n(t)}},6821:t=>{t.exports=function(){this.__data__=[],this.size=0}},7221:(t,e,r)=>{var n=r(9438),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,r=n(e,t);return!(r<0||(r==e.length-1?e.pop():o.call(e,r,1),--this.size,0))}},1596:(t,e,r)=>{var n=r(9438);t.exports=function(t){var e=this.__data__,r=n(e,t);return r<0?void 0:e[r][1]}},1992:(t,e,r)=>{var n=r(9438);t.exports=function(t){return n(this.__data__,t)>-1}},552:(t,e,r)=>{var n=r(9438);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}},4069:(t,e,r)=>{var n=r(6766),o=r(1022),i=r(5870);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},7477:(t,e,r)=>{var n=r(1200);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},476:(t,e,r)=>{var n=r(1200);t.exports=function(t){return n(this,t).get(t)}},984:(t,e,r)=>{var n=r(1200);t.exports=function(t){return n(this,t).has(t)}},4136:(t,e,r)=>{var n=r(1200);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},8866:t=>{t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}},7316:t=>{t.exports=function(t,e){return function(r){return null!=r&&r[t]===e&&(void 0!==e||t in Object(r))}}},2121:(t,e,r)=>{var n=r(8487);t.exports=function(t){var e=n(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}},8637:(t,e,r)=>{var n=r(4671)(Object,"create");t.exports=n},2325:(t,e,r)=>{var n=r(8546)(Object.keys,Object);t.exports=n},5382:t=>{t.exports=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}},6574:(t,e,r)=>{t=r.nmd(t);var n=r(1603),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o&&n.process,a=function(){try{return i&&i.require&&i.require("util").types||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=a},6881:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},8546:t=>{t.exports=function(t,e){return function(r){return t(e(r))}}},5390:(t,e,r)=>{var n=r(7156),o=Math.max;t.exports=function(t,e,r){return e=o(void 0===e?t.length-1:e,0),function(){for(var i=arguments,s=-1,a=o(i.length-e,0),u=Array(a);++s<a;)u[s]=i[e+s];s=-1;for(var h=Array(e+1);++s<e;)h[s]=i[s];return h[e]=r(u),n(t,this,h)}}},714:(t,e,r)=>{var n=r(1603),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},6127:t=>{t.exports=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}},1945:t=>{t.exports=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}},4874:t=>{t.exports=function(t){return this.__data__.has(t)}},6968:t=>{t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}},3232:(t,e,r)=>{var n=r(3431),o=r(1824)(n);t.exports=o},1824:t=>{var e=Date.now;t.exports=function(t){var r=0,n=0;return function(){var o=e(),i=16-(o-n);if(n=o,i>0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}},5331:(t,e,r)=>{var n=r(1022);t.exports=function(){this.__data__=new n,this.size=0}},7063:t=>{t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},134:t=>{t.exports=function(t){return this.__data__.get(t)}},9842:t=>{t.exports=function(t){return this.__data__.has(t)}},9850:(t,e,r)=>{var n=r(1022),o=r(5870),i=r(8910);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var s=r.__data__;if(!o||s.length<199)return s.push([t,e]),this.size=++r.size,this;r=this.__data__=new i(s)}return r.set(t,e),this.size=r.size,this}},638:t=>{t.exports=function(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}},6742:(t,e,r)=>{var n=r(446),o=r(3493),i=r(3870);t.exports=function(t){return o(t)?i(t):n(t)}},9505:(t,e,r)=>{var n=r(2121),o=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g,i=/\\\\(\\\\)?/g,s=n((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(o,(function(t,r,n,o){e.push(n?o.replace(i,"$1"):r||t)})),e}));t.exports=s},9628:(t,e,r)=>{var n=r(975);t.exports=function(t){if("string"==typeof t||n(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}},462:t=>{var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},4997:t=>{var e=/\\s/;t.exports=function(t){for(var r=t.length;r--&&e.test(t.charAt(r)););return r}},3870:t=>{var e="\\\\ud800-\\\\udfff",r="["+e+"]",n="[\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe2f\\\\u20d0-\\\\u20ff]",o="\\\\ud83c[\\\\udffb-\\\\udfff]",i="[^"+e+"]",s="(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}",a="[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]",u="(?:"+n+"|"+o+")?",h="[\\\\ufe0e\\\\ufe0f]?",d=h+u+"(?:\\\\u200d(?:"+[i,s,a].join("|")+")"+h+u+")*",c="(?:"+[i+n+"?",n,s,a,r].join("|")+")",l=RegExp(o+"(?="+o+")|"+c+d,"g");t.exports=function(t){for(var e=l.lastIndex=0;l.test(t);)++e;return e}},5402:(t,e,r)=>{var n=r(9018);t.exports=function(t){return n(t,4)}},9136:(t,e,r)=>{var n=r(9018);t.exports=function(t){return n(t,5)}},8295:t=>{t.exports=function(t){return function(){return t}}},9529:(t,e,r)=>{var n=r(6965),o=r(5097),i=r(8819),s=r(2844),a=Object.prototype,u=a.hasOwnProperty,h=n((function(t,e){t=Object(t);var r=-1,n=e.length,h=n>2?e[2]:void 0;for(h&&i(e[0],e[1],h)&&(n=1);++r<n;)for(var d=e[r],c=s(d),l=-1,f=c.length;++l<f;){var g=c[l],p=t[g];(void 0===p||o(p,a[g])&&!u.call(t,g))&&(t[g]=d[g])}return t}));t.exports=h},958:(t,e,r)=>{t.exports=r(1117)},5097:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},9969:(t,e,r)=>{var n=r(2995),o=r(1329),i=r(4506),s=r(5874);t.exports=function(t,e){return(s(t)?n:o)(t,i(e,3))}},828:(t,e,r)=>{var n=r(6057)(r(8550));t.exports=n},8550:(t,e,r)=>{var n=r(166),o=r(4506),i=r(3758),s=Math.max;t.exports=function(t,e,r){var a=null==t?0:t.length;if(!a)return-1;var u=null==r?0:i(r);return u<0&&(u=s(a+u,0)),n(t,o(e,3),u)}},7469:(t,e,r)=>{var n=r(9821);t.exports=function(t){return null!=t&&t.length?n(t,1):[]}},1117:(t,e,r)=>{var n=r(7012),o=r(830),i=r(4041),s=r(5874);t.exports=function(t,e){return(s(t)?n:o)(t,i(e))}},4519:(t,e,r)=>{var n=r(9128),o=r(4041),i=r(2844);t.exports=function(t,e){return null==t?t:n(t,o(e),i)}},5887:(t,e,r)=>{var n=r(1855);t.exports=function(t,e,r){var o=null==t?void 0:n(t,e);return void 0===o?r:o}},4339:(t,e,r)=>{var n=r(3091),o=r(9663);t.exports=function(t,e){return null!=t&&o(t,e,n)}},4016:(t,e,r)=>{var n=r(5088),o=r(9663);t.exports=function(t,e){return null!=t&&o(t,e,n)}},9169:t=>{t.exports=function(t){return t}},79:(t,e,r)=>{var n=r(4047),o=r(7583),i=Object.prototype,s=i.hasOwnProperty,a=i.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(t){return o(t)&&s.call(t,"callee")&&!a.call(t,"callee")};t.exports=u},5874:t=>{var e=Array.isArray;t.exports=e},3069:(t,e,r)=>{var n=r(7787),o=r(4583);t.exports=function(t){return null!=t&&o(t.length)&&!n(t)}},6882:(t,e,r)=>{var n=r(3069),o=r(7583);t.exports=function(t){return o(t)&&n(t)}},3601:(t,e,r)=>{t=r.nmd(t);var n=r(714),o=r(6408),i=e&&!e.nodeType&&e,s=i&&t&&!t.nodeType&&t,a=s&&s.exports===i?n.Buffer:void 0,u=(a?a.isBuffer:void 0)||o;t.exports=u},2046:(t,e,r)=>{var n=r(5351),o=r(9778),i=r(79),s=r(5874),a=r(3069),u=r(3601),h=r(7894),d=r(9046),c=Object.prototype.hasOwnProperty;t.exports=function(t){if(null==t)return!0;if(a(t)&&(s(t)||"string"==typeof t||"function"==typeof t.splice||u(t)||d(t)||i(t)))return!t.length;var e=o(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(h(t))return!n(t).length;for(var r in t)if(c.call(t,r))return!1;return!0}},7787:(t,e,r)=>{var n=r(5271),o=r(9400);t.exports=function(t){if(!o(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},4583:t=>{t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},4725:(t,e,r)=>{var n=r(4965),o=r(8232),i=r(6574),s=i&&i.isMap,a=s?o(s):n;t.exports=a},9400:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},7583:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},4108:(t,e,r)=>{var n=r(5271),o=r(7556),i=r(7583),s=Function.prototype,a=Object.prototype,u=s.toString,h=a.hasOwnProperty,d=u.call(Object);t.exports=function(t){if(!i(t)||"[object Object]"!=n(t))return!1;var e=o(t);if(null===e)return!0;var r=h.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&u.call(r)==d}},7363:(t,e,r)=>{var n=r(6499),o=r(8232),i=r(6574),s=i&&i.isSet,a=s?o(s):n;t.exports=a},7462:(t,e,r)=>{var n=r(5271),o=r(5874),i=r(7583);t.exports=function(t){return"string"==typeof t||!o(t)&&i(t)&&"[object String]"==n(t)}},975:(t,e,r)=>{var n=r(5271),o=r(7583);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==n(t)}},9046:(t,e,r)=>{var n=r(550),o=r(8232),i=r(6574),s=i&&i.isTypedArray,a=s?o(s):n;t.exports=a},2895:t=>{t.exports=function(t){return void 0===t}},3511:(t,e,r)=>{var n=r(9754),o=r(5351),i=r(3069);t.exports=function(t){return i(t)?n(t):o(t)}},2844:(t,e,r)=>{var n=r(9754),o=r(1500),i=r(3069);t.exports=function(t){return i(t)?n(t,!0):o(t)}},5179:t=>{t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},9629:(t,e,r)=>{var n=r(2275),o=r(4506),i=r(4733),s=r(5874);t.exports=function(t,e){return(s(t)?n:i)(t,o(e,3))}},5551:(t,e,r)=>{var n=r(3077),o=r(7702),i=r(4506);t.exports=function(t,e){var r={};return e=i(e,3),o(t,(function(t,o,i){n(r,o,e(t,o,i))})),r}},4213:(t,e,r)=>{var n=r(5816),o=r(4116),i=r(9169);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},8487:(t,e,r)=>{var n=r(8910);function o(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var s=t.apply(this,n);return r.cache=i.set(o,s)||i,s};return r.cache=new(o.Cache||n),r}o.Cache=n,t.exports=o},2495:(t,e,r)=>{var n=r(4479),o=r(1292)((function(t,e,r){n(t,e,r)}));t.exports=o},9903:(t,e,r)=>{var n=r(5816),o=r(2795),i=r(9169);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},3262:(t,e,r)=>{var n=r(5816),o=r(4506),i=r(2795);t.exports=function(t,e){return t&&t.length?n(t,o(e,2),i):void 0}},3883:t=>{t.exports=function(){}},8835:(t,e,r)=>{var n=r(714);t.exports=function(){return n.Date.now()}},222:(t,e,r)=>{var n=r(4286),o=r(4139)((function(t,e){return null==t?{}:n(t,e)}));t.exports=o},6830:(t,e,r)=>{var n=r(8494),o=r(3644),i=r(759),s=r(9628);t.exports=function(t){return i(t)?n(s(t)):o(t)}},4978:(t,e,r)=>{var n=r(4590)();t.exports=n},9285:(t,e,r)=>{var n=r(8663),o=r(830),i=r(4506),s=r(8421),a=r(5874);t.exports=function(t,e,r){var u=a(t)?n:s,h=arguments.length<3;return u(t,i(e,4),r,h,o)}},3910:(t,e,r)=>{var n=r(5351),o=r(9778),i=r(3069),s=r(7462),a=r(6742);t.exports=function(t){if(null==t)return 0;if(i(t))return s(t)?a(t):t.length;var e=o(t);return"[object Map]"==e||"[object Set]"==e?t.size:n(t).length}},5246:(t,e,r)=>{var n=r(9821),o=r(9586),i=r(6965),s=r(8819),a=i((function(t,e){if(null==t)return[];var r=e.length;return r>1&&s(t,e[0],e[1])?e=[]:r>2&&s(e[0],e[1],e[2])&&(e=[e[0]]),o(t,n(e,1),[])}));t.exports=a},2982:t=>{t.exports=function(){return[]}},6408:t=>{t.exports=function(){return!1}},8265:(t,e,r)=>{var n=r(7639),o=1/0;t.exports=function(t){return t?(t=n(t))===o||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}},3758:(t,e,r)=>{var n=r(8265);t.exports=function(t){var e=n(t),r=e%1;return e==e?r?e-r:e:0}},7639:(t,e,r)=>{var n=r(5103),o=r(9400),i=r(975),s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,h=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return NaN;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=n(t);var r=a.test(t);return r||u.test(t)?h(t.slice(2),r?2:8):s.test(t)?NaN:+t}},339:(t,e,r)=>{var n=r(5532),o=r(2844);t.exports=function(t){return n(t,o(t))}},983:(t,e,r)=>{var n=r(8071);t.exports=function(t){return null==t?"":n(t)}},3279:(t,e,r)=>{var n=r(7012),o=r(1095),i=r(7702),s=r(4506),a=r(7556),u=r(5874),h=r(3601),d=r(7787),c=r(9400),l=r(9046);t.exports=function(t,e,r){var f=u(t),g=f||h(t)||l(t);if(e=s(e,4),null==r){var p=t&&t.constructor;r=g?f?new p:[]:c(t)&&d(p)?o(a(t)):{}}return(g?n:i)(t,(function(t,n,o){return e(r,t,n,o)})),r}},3344:(t,e,r)=>{var n=r(9821),o=r(6965),i=r(3434),s=r(6882),a=o((function(t){return i(n(t,1,s,!0))}));t.exports=a},761:(t,e,r)=>{var n=r(983),o=0;t.exports=function(t){var e=++o;return n(t)+e}},3005:(t,e,r)=>{var n=r(989),o=r(3511);t.exports=function(t){return null==t?[]:n(t,o(t))}},3679:(t,e,r)=>{var n=r(5802),o=r(2543);t.exports=function(t,e){return o(t||[],e||[],n)}},412:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>o});var n=r(5229);function o(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==r.output){if(!(0,n.isAnyArray)(r.output))throw new TypeError("output option must be an array if specified");e=r.output}else e=new Array(t.length);var o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,o=void 0===r?0:r,i=e.toIndex,s=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=o||s>t.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[o],u=o+1;u<s;u++)t[u]<a&&(a=t[u]);return a}(t),i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,o=void 0===r?0:r,i=e.toIndex,s=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=o||s>t.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[o],u=o+1;u<s;u++)t[u]>a&&(a=t[u]);return a}(t);if(o===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var s=r.min,a=void 0===s?r.autoMinMax?o:0:s,u=r.max,h=void 0===u?r.autoMinMax?i:1:u;if(a>=h)throw new RangeError("min option must be smaller than max option");for(var d=(h-a)/(i-o),c=0;c<t.length;c++)e[c]=(t[c]-o)*d+a;return e}},8917:(t,e,r)=>{"use strict";var n=r(5229),o=r(412);const i=" ".repeat(2),s=" ".repeat(4);function a(t,e={}){const{maxRows:r=15,maxColumns:n=10,maxNumSize:o=8,padMinus:a="auto"}=e;return`${t.constructor.name} {\\n${i}[\\n${s}${function(t,e,r,n,o){const{rows:i,columns:a}=t,h=Math.min(i,e),d=Math.min(a,r),c=[];if("auto"===o){o=!1;t:for(let e=0;e<h;e++)for(let r=0;r<d;r++)if(t.get(e,r)<0){o=!0;break t}}for(let e=0;e<h;e++){let r=[];for(let i=0;i<d;i++)r.push(u(t.get(e,i),n,o));c.push(`${r.join(" ")}`)}return d!==a&&(c[c.length-1]+=` ... ${a-r} more columns`),h!==i&&c.push(`... ${i-e} more rows`),c.join(`\\n${s}`)}(t,r,n,o,a)}\\n${i}]\\n${i}rows: ${t.rows}\\n${i}columns: ${t.columns}\\n}`}function u(t,e,r){return(t>=0&&r?` ${h(t,e-1)}`:h(t,e)).padEnd(e)}function h(t,e){let r=t.toString();if(r.length<=e)return r;let n=t.toFixed(e);if(n.length>e&&(n=t.toFixed(Math.max(0,e-(n.length-e)))),n.length<=e&&!n.startsWith("0.000")&&!n.startsWith("-0.000"))return n;let o=t.toExponential(e);return o.length>e&&(o=t.toExponential(Math.max(0,e-(o.length-e)))),o.slice(0)}function d(t,e,r){let n=r?t.rows:t.rows-1;if(e<0||e>n)throw new RangeError("Row index out of range")}function c(t,e,r){let n=r?t.columns:t.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function l(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function f(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function g(t,e){if(!n.isAnyArray(e))throw new TypeError("row indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.rows)throw new RangeError("row indices are out of range")}function p(t,e){if(!n.isAnyArray(e))throw new TypeError("column indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.columns)throw new RangeError("column indices are out of range")}function v(t,e,r,n,o){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(y("startRow",e),y("endRow",r),y("startColumn",n),y("endColumn",o),e>r||n>o||e<0||e>=t.rows||r<0||r>=t.rows||n<0||n>=t.columns||o<0||o>=t.columns)throw new RangeError("Submatrix indices are out of range")}function m(t,e=0){let r=[];for(let n=0;n<t;n++)r.push(e);return r}function y(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function w(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class x{static from1DArray(t,e,r){if(t*e!==r.length)throw new RangeError("data length does not match given dimensions");let n=new E(t,e);for(let o=0;o<t;o++)for(let t=0;t<e;t++)n.set(o,t,r[o*e+t]);return n}static rowVector(t){let e=new E(1,t.length);for(let r=0;r<t.length;r++)e.set(0,r,t[r]);return e}static columnVector(t){let e=new E(t.length,1);for(let r=0;r<t.length;r++)e.set(r,0,t[r]);return e}static zeros(t,e){return new E(t,e)}static ones(t,e){return new E(t,e).fill(1)}static rand(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{random:n=Math.random}=r;let o=new E(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)o.set(r,t,n());return o}static randInt(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{min:n=0,max:o=1e3,random:i=Math.random}=r;if(!Number.isInteger(n))throw new TypeError("min must be an integer");if(!Number.isInteger(o))throw new TypeError("max must be an integer");if(n>=o)throw new RangeError("min must be smaller than max");let s=o-n,a=new E(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++){let e=n+Math.round(i()*s);a.set(r,t,e)}return a}static eye(t,e,r){void 0===e&&(e=t),void 0===r&&(r=1);let n=Math.min(t,e),o=this.zeros(t,e);for(let t=0;t<n;t++)o.set(t,t,r);return o}static diag(t,e,r){let n=t.length;void 0===e&&(e=n),void 0===r&&(r=e);let o=Math.min(n,e,r),i=this.zeros(e,r);for(let e=0;e<o;e++)i.set(e,e,t[e]);return i}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new E(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.min(t.get(i,r),e.get(i,r)));return o}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new this(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.max(t.get(i,r),e.get(i,r)));return o}static checkMatrix(t){return x.isMatrix(t)?t:new E(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.call(this,e,r);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.push(this.get(e,r));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let r=0;r<this.columns;r++)t[e].push(this.get(e,r))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let t=0;t<this.rows;t++)if(0!==this.get(t,t))return!1;return!0}isEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);t++}return n}isReducedEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);for(let r=e+1;r<this.rows;r++)0!==this.get(t,r)&&(n=!1);t++}return n}echelonForm(){let t=this.clone(),e=0,r=0;for(;e<t.rows&&r<t.columns;){let n=e;for(let o=e;o<t.rows;o++)t.get(o,r)>t.get(n,r)&&(n=o);if(0===t.get(n,r))r++;else{t.swapRows(e,n);let o=t.get(e,r);for(let n=r;n<t.columns;n++)t.set(e,n,t.get(e,n)/o);for(let n=e+1;n<t.rows;n++){let o=t.get(n,r)/t.get(e,r);t.set(n,r,0);for(let i=r+1;i<t.columns;i++)t.set(n,i,t.get(n,i)-t.get(e,i)*o)}e++,r++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,r=t.rows,n=r-1;for(;n>=0;)if(0===t.maxRow(n))n--;else{let o=0,i=!1;for(;o<r&&!1===i;)1===t.get(n,o)?i=!0:o++;for(let r=0;r<n;r++){let i=t.get(r,o);for(let s=o;s<e;s++){let e=t.get(r,s)-i*t.get(n,s);t.set(r,s,e)}}n--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:r=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(r)||r<=0)throw new TypeError("columns must be a positive integer");let n=new E(this.rows*e,this.columns*r);for(let t=0;t<e;t++)for(let e=0;e<r;e++)n.setSubMatrix(this,this.rows*t,this.columns*e);return n}fill(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,t);return this}neg(){return this.mulS(-1)}getRow(t){d(this,t);let e=[];for(let r=0;r<this.columns;r++)e.push(this.get(t,r));return e}getRowVector(t){return E.rowVector(this.getRow(t))}setRow(t,e){d(this,t),e=l(this,e);for(let r=0;r<this.columns;r++)this.set(t,r,e[r]);return this}swapRows(t,e){d(this,t),d(this,e);for(let r=0;r<this.columns;r++){let n=this.get(t,r);this.set(t,r,this.get(e,r)),this.set(e,r,n)}return this}getColumn(t){c(this,t);let e=[];for(let r=0;r<this.rows;r++)e.push(this.get(r,t));return e}getColumnVector(t){return E.columnVector(this.getColumn(t))}setColumn(t,e){c(this,t),e=f(this,e);for(let r=0;r<this.rows;r++)this.set(r,t,e[r]);return this}swapColumns(t,e){c(this,t),c(this,e);for(let r=0;r<this.rows;r++){let n=this.get(r,t);this.set(r,t,this.get(r,e)),this.set(r,e,n)}return this}addRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[r]);return this}subRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[r]);return this}mulRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[r]);return this}divRowVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[r]);return this}addColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[e]);return this}subColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[e]);return this}mulColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[e]);return this}divColumnVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[e]);return this}mulRow(t,e){d(this,t);for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e);return this}mulColumn(t,e){c(this,t);for(let r=0;r<this.rows;r++)this.set(r,t,this.get(r,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){w(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){w(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}maxRow(t){if(d(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r));return e}maxRowIndex(t){d(this,t),w(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n),r[1]=n);return r}minRow(t){if(d(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r));return e}minRowIndex(t){d(this,t),w(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n),r[1]=n);return r}maxColumn(t){if(c(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t));return e}maxColumnIndex(t){c(this,t),w(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t),r[0]=n);return r}minColumn(t){if(c(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t));return e}minColumnIndex(t){c(this,t),w(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t),r[0]=n);return r}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let r=0;r<t;r++)e.push(this.get(r,r));return e}norm(t="frobenius"){switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${t}`)}}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t+=this.get(e,r),this.set(e,r,t);return this}dot(t){x.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let r=0;for(let n=0;n<e.length;n++)r+=e[n]*t[n];return r}mmul(t){t=E.checkMatrix(t);let e=this.rows,r=this.columns,n=t.columns,o=new E(e,n),i=new Float64Array(r);for(let s=0;s<n;s++){for(let e=0;e<r;e++)i[e]=t.get(e,s);for(let t=0;t<e;t++){let e=0;for(let n=0;n<r;n++)e+=this.get(t,n)*i[n];o.set(t,s,e)}}return o}strassen2x2(t){t=E.checkMatrix(t);let e=new E(2,2);const r=this.get(0,0),n=t.get(0,0),o=this.get(0,1),i=t.get(0,1),s=this.get(1,0),a=t.get(1,0),u=this.get(1,1),h=t.get(1,1),d=(r+u)*(n+h),c=(s+u)*n,l=r*(i-h),f=u*(a-n),g=(r+o)*h,p=d+f-g+(o-u)*(a+h),v=l+g,m=c+f,y=d-c+l+(s-r)*(n+i);return e.set(0,0,p),e.set(0,1,v),e.set(1,0,m),e.set(1,1,y),e}strassen3x3(t){t=E.checkMatrix(t);let e=new E(3,3);const r=this.get(0,0),n=this.get(0,1),o=this.get(0,2),i=this.get(1,0),s=this.get(1,1),a=this.get(1,2),u=this.get(2,0),h=this.get(2,1),d=this.get(2,2),c=t.get(0,0),l=t.get(0,1),f=t.get(0,2),g=t.get(1,0),p=t.get(1,1),v=t.get(1,2),m=t.get(2,0),y=t.get(2,1),w=t.get(2,2),x=(r-i)*(-l+p),b=(-r+i+s)*(c-l+p),N=(i+s)*(-c+l),M=r*c,_=(-r+u+h)*(c-f+v),k=(-r+u)*(f-v),A=(u+h)*(-c+f),j=(-o+h+d)*(p+m-y),S=(o-d)*(p-y),O=o*m,z=(h+d)*(-m+y),R=(-o+s+a)*(v+m-w),I=(o-a)*(v-w),C=(s+a)*(-m+w),D=M+O+n*g,P=(r+n+o-i-s-h-d)*p+b+N+M+j+O+z,T=M+_+A+(r+n+o-s-a-u-h)*v+O+R+C,L=x+s*(-c+l+g-p-v-m+w)+b+M+O+R+I,F=x+b+N+M+a*y,q=O+R+I+C+i*f,V=M+_+k+h*(-c+f+g-p-v-m+y)+j+S+O,B=j+S+O+z+u*l,$=M+_+k+A+d*w;return e.set(0,0,D),e.set(0,1,P),e.set(0,2,T),e.set(1,0,L),e.set(1,1,F),e.set(1,2,q),e.set(2,0,V),e.set(2,1,B),e.set(2,2,$),e}mmulStrassen(t){t=E.checkMatrix(t);let e=this.clone(),r=e.rows,n=e.columns,o=t.rows,i=t.columns;function s(t,e,r){let n=t.rows,o=t.columns;if(n===e&&o===r)return t;{let n=x.zeros(e,r);return n=n.setSubMatrix(t,0,0),n}}n!==o&&console.warn(`Multiplying ${r} x ${n} and ${o} x ${i} matrix: dimensions do not match.`);let a=Math.max(r,o),u=Math.max(n,i);return e=s(e,a,u),function t(e,r,n,o){if(n<=512||o<=512)return e.mmul(r);n%2==1&&o%2==1?(e=s(e,n+1,o+1),r=s(r,n+1,o+1)):n%2==1?(e=s(e,n+1,o),r=s(r,n+1,o)):o%2==1&&(e=s(e,n,o+1),r=s(r,n,o+1));let i=parseInt(e.rows/2,10),a=parseInt(e.columns/2,10),u=e.subMatrix(0,i-1,0,a-1),h=r.subMatrix(0,i-1,0,a-1),d=e.subMatrix(0,i-1,a,e.columns-1),c=r.subMatrix(0,i-1,a,r.columns-1),l=e.subMatrix(i,e.rows-1,0,a-1),f=r.subMatrix(i,r.rows-1,0,a-1),g=e.subMatrix(i,e.rows-1,a,e.columns-1),p=r.subMatrix(i,r.rows-1,a,r.columns-1),v=t(x.add(u,g),x.add(h,p),i,a),m=t(x.add(l,g),h,i,a),y=t(u,x.sub(c,p),i,a),w=t(g,x.sub(f,h),i,a),b=t(x.add(u,d),p,i,a),E=t(x.sub(l,u),x.add(h,c),i,a),N=t(x.sub(d,g),x.add(f,p),i,a),M=x.add(v,w);M.sub(b),M.add(N);let _=x.add(y,b),k=x.add(m,w),A=x.sub(v,m);A.add(y),A.add(E);let j=x.zeros(2*M.rows,2*M.columns);return j=j.setSubMatrix(M,0,0),j=j.setSubMatrix(_,M.rows,0),j=j.setSubMatrix(k,0,M.columns),j=j.setSubMatrix(A,M.rows,M.columns),j.subMatrix(0,n-1,0,o-1)}(e,t=s(t,a,u),a,u)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new E(this.rows,this.columns);for(let t=0;t<this.rows;t++){const i=this.getRow(t);i.length>0&&o(i,{min:e,max:r,output:i}),n.setRow(t,i)}return n}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new E(this.rows,this.columns);for(let t=0;t<this.columns;t++){const i=this.getColumn(t);i.length&&o(i,{min:e,max:r,output:i}),n.setColumn(t,i)}return n}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let r=0;r<t;r++){let t=this.get(e,r),n=this.get(e,this.columns-1-r);this.set(e,r,n),this.set(e,this.columns-1-r,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let r=0;r<t;r++){let t=this.get(r,e),n=this.get(this.rows-1-r,e);this.set(r,e,n),this.set(this.rows-1-r,e,t)}return this}kroneckerProduct(t){t=E.checkMatrix(t);let e=this.rows,r=this.columns,n=t.rows,o=t.columns,i=new E(e*n,r*o);for(let s=0;s<e;s++)for(let e=0;e<r;e++)for(let r=0;r<n;r++)for(let a=0;a<o;a++)i.set(n*s+r,o*e+a,this.get(s,e)*t.get(r,a));return i}kroneckerSum(t){if(t=E.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,r=t.rows,n=this.kroneckerProduct(E.eye(r,r)),o=E.eye(e,e).kroneckerProduct(t);return n.add(o)}transpose(){let t=new E(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(r,e,this.get(e,r));return t}sortRows(t=b){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=b){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,r,n){v(this,t,e,r,n);let o=new E(e-t+1,n-r+1);for(let i=t;i<=e;i++)for(let e=r;e<=n;e++)o.set(i-t,e-r,this.get(i,e));return o}subMatrixRow(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.columns-1),e>r||e<0||e>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");let n=new E(t.length,r-e+1);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.rows)throw new RangeError(`Row index out of range: ${t[o]}`);n.set(o,i-e,this.get(t[o],i))}return n}subMatrixColumn(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.rows-1),e>r||e<0||e>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");let n=new E(r-e+1,t.length);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.columns)throw new RangeError(`Column index out of range: ${t[o]}`);n.set(i-e,o,this.get(i,t[o]))}return n}setSubMatrix(t,e,r){if((t=E.checkMatrix(t)).isEmpty())return this;v(this,e,e+t.rows-1,r,r+t.columns-1);for(let n=0;n<t.rows;n++)for(let o=0;o<t.columns;o++)this.set(e+n,r+o,t.get(n,o));return this}selection(t,e){g(this,t),p(this,e);let r=new E(t.length,e.length);for(let n=0;n<t.length;n++){let o=t[n];for(let t=0;t<e.length;t++){let i=e[t];r.set(n,t,this.get(o,i))}}return r}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let r=0;r<t;r++)e+=this.get(r,r);return e}clone(){return this.constructor.copy(this,new E(this.rows,this.columns))}static copy(t,e){for(const[r,n,o]of t.entries())e.set(r,n,o);return e}sum(t){switch(t){case"row":return function(t){let e=m(t.rows);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]+=t.get(r,n);return e}(this);case"column":return function(t){let e=m(t.columns);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]+=t.get(r,n);return e}(this);case void 0:return function(t){let e=0;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e+=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=m(t.rows,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]*=t.get(r,n);return e}(this);case"column":return function(t){let e=m(t.columns,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]*=t.get(r,n);return e}(this);case void 0:return function(t){let e=1;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e*=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{unbiased:r=!0,mean:o=this.mean(t)}=e;if("boolean"!=typeof r)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!n.isAnyArray(o))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let s=0;s<n;s++){let n=0,a=0,u=0;for(let e=0;e<o;e++)u=t.get(s,e)-r[s],n+=u,a+=u*u;e?i.push((a-n*n/o)/(o-1)):i.push((a-n*n/o)/o)}return i}(this,r,o);case"column":if(!n.isAnyArray(o))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let s=0;s<o;s++){let o=0,a=0,u=0;for(let e=0;e<n;e++)u=t.get(e,s)-r[s],o+=u,a+=u*u;e?i.push((a-o*o/n)/(n-1)):i.push((a-o*o/n)/n)}return i}(this,r,o);case void 0:if("number"!=typeof o)throw new TypeError("mean must be a number");return function(t,e,r){const n=t.rows,o=t.columns,i=n*o;let s=0,a=0,u=0;for(let e=0;e<n;e++)for(let n=0;n<o;n++)u=t.get(e,n)-r,s+=u,a+=u*u;return e?(a-s*s/i)/(i-1):(a-s*s/i)/i}(this,r,o);default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const r=this.variance(t,e);if(void 0===t)return Math.sqrt(r);for(let t=0;t<r.length;t++)r[t]=Math.sqrt(r[t]);return r}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{center:r=this.mean(t)}=e;switch(t){case"row":if(!n.isAnyArray(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[r])}(this,r),this;case"column":if(!n.isAnyArray(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[n])}(this,r),this;case void 0:if("number"!=typeof r)throw new TypeError("center must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");let r=e.scale;switch(t){case"row":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.rows;r++){let n=0;for(let e=0;e<t.columns;e++)n+=Math.pow(t.get(r,e),2)/(t.columns-1);e.push(Math.sqrt(n))}return e}(this);else if(!n.isAnyArray(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[r])}(this,r),this;case"column":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.columns;r++){let n=0;for(let e=0;e<t.rows;e++)n+=Math.pow(t.get(e,r),2)/(t.rows-1);e.push(Math.sqrt(n))}return e}(this);else if(!n.isAnyArray(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[n])}(this,r),this;case void 0:if(void 0===r)r=function(t){const e=t.size-1;let r=0;for(let n=0;n<t.columns;n++)for(let o=0;o<t.rows;o++)r+=Math.pow(t.get(o,n),2)/e;return Math.sqrt(r)}(this);else if("number"!=typeof r)throw new TypeError("scale must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}toString(t){return a(this,t)}[Symbol.iterator](){return this.entries()}*entries(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield[t,e,this.get(t,e)]}*values(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield this.get(t,e)}}function b(t,e){return t-e}x.prototype.klass="Matrix","undefined"!=typeof Symbol&&(x.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return a(this)}),x.random=x.rand,x.randomInt=x.randInt,x.diagonal=x.diag,x.prototype.diagonal=x.prototype.diag,x.identity=x.eye,x.prototype.negate=x.prototype.neg,x.prototype.tensorProduct=x.prototype.kroneckerProduct;class E extends x{data;#t(t,e){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let r=0;r<t;r++)this.data.push(new Float64Array(e));this.rows=t,this.columns=e}constructor(t,e){if(super(),E.isMatrix(t))this.#t(t.rows,t.columns),E.copy(t,this);else if(Number.isInteger(t)&&t>=0)this.#t(t,e);else{if(!n.isAnyArray(t))throw new TypeError("First argument must be a positive number or an array");{const r=t;if("number"!=typeof(e=(t=r.length)?r[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let n=0;n<t;n++){if(r[n].length!==e)throw new RangeError("Inconsistent array dimensions");if(!r[n].every((t=>"number"==typeof t)))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(r[n]))}this.rows=t,this.columns=e}}}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}removeRow(t){return d(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),d(this,t,!0),e=Float64Array.from(l(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){c(this,t);for(let e=0;e<this.rows;e++){const r=new Float64Array(this.columns-1);for(let n=0;n<t;n++)r[n]=this.data[e][n];for(let n=t+1;n<this.columns;n++)r[n-1]=this.data[e][n];this.data[e]=r}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),c(this,t,!0),e=f(this,e);for(let r=0;r<this.rows;r++){const n=new Float64Array(this.columns+1);let o=0;for(;o<t;o++)n[o]=this.data[r][o];for(n[o++]=e[r];o<this.columns+1;o++)n[o]=this.data[r][o-1];this.data[r]=n}return this.columns+=1,this}}!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t.get(e,r));return this},t.add=function(t,r){return new e(t).add(r)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t.get(e,r));return this},t.sub=function(t,r){return new e(t).sub(r)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t.get(e,r));return this},t.mul=function(t,r){return new e(t).mul(r)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t.get(e,r));return this},t.div=function(t,r){return new e(t).div(r)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t.get(e,r));return this},t.mod=function(t,r){return new e(t).mod(r)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t.get(e,r));return this},t.and=function(t,r){return new e(t).and(r)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t.get(e,r));return this},t.or=function(t,r){return new e(t).or(r)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t.get(e,r));return this},t.xor=function(t,r){return new e(t).xor(r)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t.get(e,r));return this},t.leftShift=function(t,r){return new e(t).leftShift(r)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t.get(e,r));return this},t.signPropagatingRightShift=function(t,r){return new e(t).signPropagatingRightShift(r)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t.get(e,r));return this},t.rightShift=function(t,r){return new e(t).rightShift(r)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,r){return new e(t).pow(r)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t));return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t.get(e,r)));return this}}(x,E);class N extends x{#e;get size(){return this.#e.size}get rows(){return this.#e.rows}get columns(){return this.#e.columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(t){return E.isMatrix(t)&&"SymmetricMatrix"===t.klassType}static zeros(t){return new this(t)}static ones(t){return new this(t).fill(1)}constructor(t){if(super(),E.isMatrix(t)){if(!t.isSymmetric())throw new TypeError("not symmetric data");this.#e=E.copy(t,new E(t.rows,t.rows))}else if(Number.isInteger(t)&&t>=0)this.#e=new E(t,t);else if(this.#e=new E(t),!this.isSymmetric())throw new TypeError("not symmetric data")}clone(){const t=new N(this.diagonalSize);for(const[e,r,n]of this.upperRightEntries())t.set(e,r,n);return t}toMatrix(){return new E(this)}get(t,e){return this.#e.get(t,e)}set(t,e,r){return this.#e.set(t,e,r),this.#e.set(e,t,r),this}removeCross(t){return this.#e.removeRow(t),this.#e.removeColumn(t),this}addCross(t,e){void 0===e&&(e=t,t=this.diagonalSize);const r=e.slice();return r.splice(t,1),this.#e.addRow(t,r),this.#e.addColumn(t,e),this}applyMask(t){if(t.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const e=[];for(const[r,n]of t.entries())n||e.push(r);e.reverse();for(const t of e)this.removeCross(t);return this}toCompact(){const{diagonalSize:t}=this,e=new Array(t*(t+1)/2);for(let r=0,n=0,o=0;o<e.length;o++)e[o]=this.get(n,r),++r>=t&&(r=++n);return e}static fromCompact(t){const e=t.length,r=(Math.sqrt(8*e+1)-1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(t)}`);const n=new N(r);for(let o=0,i=0,s=0;s<e;s++)n.set(o,i,t[s]),++o>=r&&(o=++i);return n}*upperRightEntries(){for(let t=0,e=0;t<this.diagonalSize;void 0){const r=this.get(t,e);yield[t,e,r],++e>=this.diagonalSize&&(e=++t)}}*upperRightValues(){for(let t=0,e=0;t<this.diagonalSize;void 0){const r=this.get(t,e);yield r,++e>=this.diagonalSize&&(e=++t)}}}N.prototype.klassType="SymmetricMatrix";class M extends N{static isDistanceMatrix(t){return N.isSymmetricMatrix(t)&&"DistanceMatrix"===t.klassSubType}constructor(t){if(super(t),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(t,e,r){return t===e&&(r=0),super.set(t,e,r)}addCross(t,e){return void 0===e&&(e=t,t=this.diagonalSize),(e=e.slice())[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new N(this)}clone(){const t=new M(this.diagonalSize);for(const[e,r,n]of this.upperRightEntries())e!==r&&t.set(e,r,n);return t}toCompact(){const{diagonalSize:t}=this,e=new Array((t-1)*t/2);for(let r=1,n=0,o=0;o<e.length;o++)e[o]=this.get(n,r),++r>=t&&(r=1+ ++n);return e}static fromCompact(t){const e=t.length,r=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(t)}`);const n=new this(r);for(let o=1,i=0,s=0;s<e;s++)n.set(o,i,t[s]),++o>=r&&(o=1+ ++i);return n}}M.prototype.klassSubType="DistanceMatrix";class _ extends x{constructor(t,e,r){super(),this.matrix=t,this.rows=e,this.columns=r}}class k extends _{constructor(t,e,r){g(t,e),p(t,r),super(t,e.length,r.length),this.rowIndices=e,this.columnIndices=r}set(t,e,r){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],r),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class A extends x{constructor(t,e={}){const{rows:r=1}=e;if(t.length%r!=0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=r,this.columns=t.length/r,this.data=t}set(t,e,r){let n=this._calculateIndex(t,e);return this.data[n]=r,this}get(t,e){let r=this._calculateIndex(t,e);return this.data[r]}_calculateIndex(t,e){return t*this.columns+e}}class j extends x{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}}class S{constructor(t){let e,r,n,o,i,s,a,u,h,d=(t=j.checkMatrix(t)).clone(),c=d.rows,l=d.columns,f=new Float64Array(c),g=1;for(e=0;e<c;e++)f[e]=e;for(u=new Float64Array(c),r=0;r<l;r++){for(e=0;e<c;e++)u[e]=d.get(e,r);for(e=0;e<c;e++){for(h=Math.min(e,r),i=0,n=0;n<h;n++)i+=d.get(e,n)*u[n];u[e]-=i,d.set(e,r,u[e])}for(o=r,e=r+1;e<c;e++)Math.abs(u[e])>Math.abs(u[o])&&(o=e);if(o!==r){for(n=0;n<l;n++)s=d.get(o,n),d.set(o,n,d.get(r,n)),d.set(r,n,s);a=f[o],f[o]=f[r],f[r]=a,g=-g}if(r<c&&0!==d.get(r,r))for(e=r+1;e<c;e++)d.set(e,r,d.get(e,r)/d.get(r,r))}this.LU=d,this.pivotVector=f,this.pivotSign=g}isSingular(){let t=this.LU,e=t.columns;for(let r=0;r<e;r++)if(0===t.get(r,r))return!0;return!1}solve(t){t=E.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let r,n,o,i=t.columns,s=t.subMatrixRow(this.pivotVector,0,i-1),a=e.columns;for(o=0;o<a;o++)for(r=o+1;r<a;r++)for(n=0;n<i;n++)s.set(r,n,s.get(r,n)-s.get(o,n)*e.get(r,o));for(o=a-1;o>=0;o--){for(n=0;n<i;n++)s.set(o,n,s.get(o,n)/e.get(o,o));for(r=0;r<o;r++)for(n=0;n<i;n++)s.set(r,n,s.get(r,n)-s.get(o,n)*e.get(r,o))}return s}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,r=t.columns;for(let n=0;n<r;n++)e*=t.get(n,n);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,n=new E(e,r);for(let o=0;o<e;o++)for(let e=0;e<r;e++)o>e?n.set(o,e,t.get(o,e)):o===e?n.set(o,e,1):n.set(o,e,0);return n}get upperTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,n=new E(e,r);for(let o=0;o<e;o++)for(let e=0;e<r;e++)o<=e?n.set(o,e,t.get(o,e)):n.set(o,e,0);return n}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function O(t,e){let r=0;return Math.abs(t)>Math.abs(e)?(r=e/t,Math.abs(t)*Math.sqrt(1+r*r)):0!==e?(r=t/e,Math.abs(e)*Math.sqrt(1+r*r)):0}class z{constructor(t){let e,r,n,o,i=(t=j.checkMatrix(t)).clone(),s=t.rows,a=t.columns,u=new Float64Array(a);for(n=0;n<a;n++){let t=0;for(e=n;e<s;e++)t=O(t,i.get(e,n));if(0!==t){for(i.get(n,n)<0&&(t=-t),e=n;e<s;e++)i.set(e,n,i.get(e,n)/t);for(i.set(n,n,i.get(n,n)+1),r=n+1;r<a;r++){for(o=0,e=n;e<s;e++)o+=i.get(e,n)*i.get(e,r);for(o=-o/i.get(n,n),e=n;e<s;e++)i.set(e,r,i.get(e,r)+o*i.get(e,n))}}u[n]=-t}this.QR=i,this.Rdiag=u}solve(t){t=E.checkMatrix(t);let e=this.QR,r=e.rows;if(t.rows!==r)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let n,o,i,s,a=t.columns,u=t.clone(),h=e.columns;for(i=0;i<h;i++)for(o=0;o<a;o++){for(s=0,n=i;n<r;n++)s+=e.get(n,i)*u.get(n,o);for(s=-s/e.get(i,i),n=i;n<r;n++)u.set(n,o,u.get(n,o)+s*e.get(n,i))}for(i=h-1;i>=0;i--){for(o=0;o<a;o++)u.set(i,o,u.get(i,o)/this.Rdiag[i]);for(n=0;n<i;n++)for(o=0;o<a;o++)u.set(n,o,u.get(n,o)-u.get(i,o)*e.get(n,i))}return u.subMatrix(0,h-1,0,a-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(0===this.Rdiag[e])return!1;return!0}get upperTriangularMatrix(){let t,e,r=this.QR,n=r.columns,o=new E(n,n);for(t=0;t<n;t++)for(e=0;e<n;e++)t<e?o.set(t,e,r.get(t,e)):t===e?o.set(t,e,this.Rdiag[t]):o.set(t,e,0);return o}get orthogonalMatrix(){let t,e,r,n,o=this.QR,i=o.rows,s=o.columns,a=new E(i,s);for(r=s-1;r>=0;r--){for(t=0;t<i;t++)a.set(t,r,0);for(a.set(r,r,1),e=r;e<s;e++)if(0!==o.get(r,r)){for(n=0,t=r;t<i;t++)n+=o.get(t,r)*a.get(t,e);for(n=-n/o.get(r,r),t=r;t<i;t++)a.set(t,e,a.get(t,e)+n*o.get(t,r))}}return a}}class R{constructor(t,e={}){if((t=j.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let r=t.rows,n=t.columns;const{computeLeftSingularVectors:o=!0,computeRightSingularVectors:i=!0,autoTranspose:s=!1}=e;let a,u=Boolean(o),h=Boolean(i),d=!1;if(r<n)if(s){a=t.transpose(),r=a.rows,n=a.columns,d=!0;let e=u;u=h,h=e}else a=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else a=t.clone();let c=Math.min(r,n),l=Math.min(r+1,n),f=new Float64Array(l),g=new E(r,c),p=new E(n,n),v=new Float64Array(n),m=new Float64Array(r),y=new Float64Array(l);for(let t=0;t<l;t++)y[t]=t;let w=Math.min(r-1,n),x=Math.max(0,Math.min(n-2,r)),b=Math.max(w,x);for(let t=0;t<b;t++){if(t<w){f[t]=0;for(let e=t;e<r;e++)f[t]=O(f[t],a.get(e,t));if(0!==f[t]){a.get(t,t)<0&&(f[t]=-f[t]);for(let e=t;e<r;e++)a.set(e,t,a.get(e,t)/f[t]);a.set(t,t,a.get(t,t)+1)}f[t]=-f[t]}for(let e=t+1;e<n;e++){if(t<w&&0!==f[t]){let n=0;for(let o=t;o<r;o++)n+=a.get(o,t)*a.get(o,e);n=-n/a.get(t,t);for(let o=t;o<r;o++)a.set(o,e,a.get(o,e)+n*a.get(o,t))}v[e]=a.get(t,e)}if(u&&t<w)for(let e=t;e<r;e++)g.set(e,t,a.get(e,t));if(t<x){v[t]=0;for(let e=t+1;e<n;e++)v[t]=O(v[t],v[e]);if(0!==v[t]){v[t+1]<0&&(v[t]=0-v[t]);for(let e=t+1;e<n;e++)v[e]/=v[t];v[t+1]+=1}if(v[t]=-v[t],t+1<r&&0!==v[t]){for(let e=t+1;e<r;e++)m[e]=0;for(let e=t+1;e<r;e++)for(let r=t+1;r<n;r++)m[e]+=v[r]*a.get(e,r);for(let e=t+1;e<n;e++){let n=-v[e]/v[t+1];for(let o=t+1;o<r;o++)a.set(o,e,a.get(o,e)+n*m[o])}}if(h)for(let e=t+1;e<n;e++)p.set(e,t,v[e])}}let N=Math.min(n,r+1);if(w<n&&(f[w]=a.get(w,w)),r<N&&(f[N-1]=0),x+1<N&&(v[x]=a.get(x,N-1)),v[N-1]=0,u){for(let t=w;t<c;t++){for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}for(let t=w-1;t>=0;t--)if(0!==f[t]){for(let e=t+1;e<c;e++){let n=0;for(let o=t;o<r;o++)n+=g.get(o,t)*g.get(o,e);n=-n/g.get(t,t);for(let o=t;o<r;o++)g.set(o,e,g.get(o,e)+n*g.get(o,t))}for(let e=t;e<r;e++)g.set(e,t,-g.get(e,t));g.set(t,t,1+g.get(t,t));for(let e=0;e<t-1;e++)g.set(e,t,0)}else{for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}}if(h)for(let t=n-1;t>=0;t--){if(t<x&&0!==v[t])for(let e=t+1;e<n;e++){let r=0;for(let o=t+1;o<n;o++)r+=p.get(o,t)*p.get(o,e);r=-r/p.get(t+1,t);for(let o=t+1;o<n;o++)p.set(o,e,p.get(o,e)+r*p.get(o,t))}for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}let M=N-1,_=Number.EPSILON;for(;N>0;){let t,e;for(t=N-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+_*Math.abs(f[t]+Math.abs(f[t+1]));if(Math.abs(v[t])<=e||Number.isNaN(v[t])){v[t]=0;break}}if(t===N-2)e=4;else{let r;for(r=N-1;r>=t&&r!==t;r--){let e=(r!==N?Math.abs(v[r]):0)+(r!==t+1?Math.abs(v[r-1]):0);if(Math.abs(f[r])<=_*e){f[r]=0;break}}r===t?e=3:r===N-1?e=1:(e=2,t=r)}switch(t++,e){case 1:{let e=v[N-2];v[N-2]=0;for(let r=N-2;r>=t;r--){let o=O(f[r],e),i=f[r]/o,s=e/o;if(f[r]=o,r!==t&&(e=-s*v[r-1],v[r-1]=i*v[r-1]),h)for(let t=0;t<n;t++)o=i*p.get(t,r)+s*p.get(t,N-1),p.set(t,N-1,-s*p.get(t,r)+i*p.get(t,N-1)),p.set(t,r,o)}break}case 2:{let e=v[t-1];v[t-1]=0;for(let n=t;n<N;n++){let o=O(f[n],e),i=f[n]/o,s=e/o;if(f[n]=o,e=-s*v[n],v[n]=i*v[n],u)for(let e=0;e<r;e++)o=i*g.get(e,n)+s*g.get(e,t-1),g.set(e,t-1,-s*g.get(e,n)+i*g.get(e,t-1)),g.set(e,n,o)}break}case 3:{const e=Math.max(Math.abs(f[N-1]),Math.abs(f[N-2]),Math.abs(v[N-2]),Math.abs(f[t]),Math.abs(v[t])),o=f[N-1]/e,i=f[N-2]/e,s=v[N-2]/e,a=f[t]/e,d=v[t]/e,c=((i+o)*(i-o)+s*s)/2,l=o*s*(o*s);let m=0;0===c&&0===l||(m=c<0?0-Math.sqrt(c*c+l):Math.sqrt(c*c+l),m=l/(c+m));let y=(a+o)*(a-o)+m,w=a*d;for(let e=t;e<N-1;e++){let o=O(y,w);0===o&&(o=Number.MIN_VALUE);let i=y/o,s=w/o;if(e!==t&&(v[e-1]=o),y=i*f[e]+s*v[e],v[e]=i*v[e]-s*f[e],w=s*f[e+1],f[e+1]=i*f[e+1],h)for(let t=0;t<n;t++)o=i*p.get(t,e)+s*p.get(t,e+1),p.set(t,e+1,-s*p.get(t,e)+i*p.get(t,e+1)),p.set(t,e,o);if(o=O(y,w),0===o&&(o=Number.MIN_VALUE),i=y/o,s=w/o,f[e]=o,y=i*v[e]+s*f[e+1],f[e+1]=-s*v[e]+i*f[e+1],w=s*v[e+1],v[e+1]=i*v[e+1],u&&e<r-1)for(let t=0;t<r;t++)o=i*g.get(t,e)+s*g.get(t,e+1),g.set(t,e+1,-s*g.get(t,e)+i*g.get(t,e+1)),g.set(t,e,o)}v[N-2]=y;break}case 4:if(f[t]<=0&&(f[t]=f[t]<0?-f[t]:0,h))for(let e=0;e<=M;e++)p.set(e,t,-p.get(e,t));for(;t<M&&!(f[t]>=f[t+1]);){let e=f[t];if(f[t]=f[t+1],f[t+1]=e,h&&t<n-1)for(let r=0;r<n;r++)e=p.get(r,t+1),p.set(r,t+1,p.get(r,t)),p.set(r,t,e);if(u&&t<r-1)for(let n=0;n<r;n++)e=g.get(n,t+1),g.set(n,t+1,g.get(n,t)),g.set(n,t,e);t++}N--}}if(d){let t=p;p=g,g=t}this.m=r,this.n=n,this.s=f,this.U=g,this.V=p}solve(t){let e=t,r=this.threshold,n=this.s.length,o=E.zeros(n,n);for(let t=0;t<n;t++)Math.abs(this.s[t])<=r?o.set(t,t,0):o.set(t,t,1/this.s[t]);let i=this.U,s=this.rightSingularVectors,a=s.mmul(o),u=s.rows,h=i.rows,d=E.zeros(u,h);for(let t=0;t<u;t++)for(let e=0;e<h;e++){let r=0;for(let o=0;o<n;o++)r+=a.get(t,o)*i.get(e,o);d.set(t,e,r)}return d.mmul(e)}solveForDiagonal(t){return this.solve(E.diag(t))}inverse(){let t=this.V,e=this.threshold,r=t.rows,n=t.columns,o=new E(r,this.s.length);for(let i=0;i<r;i++)for(let r=0;r<n;r++)Math.abs(this.s[r])>e&&o.set(i,r,t.get(i,r)/this.s[r]);let i=this.U,s=i.rows,a=i.columns,u=new E(r,s);for(let t=0;t<r;t++)for(let e=0;e<s;e++){let r=0;for(let n=0;n<a;n++)r+=o.get(t,n)*i.get(e,n);u.set(t,e,r)}return u}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,r=this.s;for(let n=0,o=r.length;n<o;n++)r[n]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return E.diag(this.s)}}function I(t,e,r=!1){return t=j.checkMatrix(t),e=j.checkMatrix(e),r?new R(t).solve(e):t.isSquare()?new S(t).solve(e):new z(t).solve(e)}function C(t,e){let r=[];for(let n=0;n<t;n++)n!==e&&r.push(n);return r}function D(t,e,r,n=1e-9,o=1e-9){if(t>o)return new Array(e.rows+1).fill(0);{let t=e.addRow(r,[0]);for(let e=0;e<t.rows;e++)Math.abs(t.get(e,0))<n&&t.set(e,0,0);return t.to1DArray()}}class P{constructor(t,e={}){const{assumeSymmetric:r=!1}=e;if(!(t=j.checkMatrix(t)).isSquare())throw new Error("Matrix is not a square matrix");if(t.isEmpty())throw new Error("Matrix must be non-empty");let n,o,i=t.columns,s=new E(i,i),a=new Float64Array(i),u=new Float64Array(i),h=t,d=!1;if(d=!!r||t.isSymmetric(),d){for(n=0;n<i;n++)for(o=0;o<i;o++)s.set(n,o,h.get(n,o));!function(t,e,r,n){let o,i,s,a,u,h,d,c;for(u=0;u<t;u++)r[u]=n.get(t-1,u);for(a=t-1;a>0;a--){for(c=0,s=0,h=0;h<a;h++)c+=Math.abs(r[h]);if(0===c)for(e[a]=r[a-1],u=0;u<a;u++)r[u]=n.get(a-1,u),n.set(a,u,0),n.set(u,a,0);else{for(h=0;h<a;h++)r[h]/=c,s+=r[h]*r[h];for(o=r[a-1],i=Math.sqrt(s),o>0&&(i=-i),e[a]=c*i,s-=o*i,r[a-1]=o-i,u=0;u<a;u++)e[u]=0;for(u=0;u<a;u++){for(o=r[u],n.set(u,a,o),i=e[u]+n.get(u,u)*o,h=u+1;h<=a-1;h++)i+=n.get(h,u)*r[h],e[h]+=n.get(h,u)*o;e[u]=i}for(o=0,u=0;u<a;u++)e[u]/=s,o+=e[u]*r[u];for(d=o/(s+s),u=0;u<a;u++)e[u]-=d*r[u];for(u=0;u<a;u++){for(o=r[u],i=e[u],h=u;h<=a-1;h++)n.set(h,u,n.get(h,u)-(o*e[h]+i*r[h]));r[u]=n.get(a-1,u),n.set(a,u,0)}}r[a]=s}for(a=0;a<t-1;a++){if(n.set(t-1,a,n.get(a,a)),n.set(a,a,1),s=r[a+1],0!==s){for(h=0;h<=a;h++)r[h]=n.get(h,a+1)/s;for(u=0;u<=a;u++){for(i=0,h=0;h<=a;h++)i+=n.get(h,a+1)*n.get(h,u);for(h=0;h<=a;h++)n.set(h,u,n.get(h,u)-i*r[h])}}for(h=0;h<=a;h++)n.set(h,a+1,0)}for(u=0;u<t;u++)r[u]=n.get(t-1,u),n.set(t-1,u,0);n.set(t-1,t-1,1),e[0]=0}(i,u,a,s),function(t,e,r,n){let o,i,s,a,u,h,d,c,l,f,g,p,v,m,y,w;for(s=1;s<t;s++)e[s-1]=e[s];e[t-1]=0;let x=0,b=0,E=Number.EPSILON;for(h=0;h<t;h++){for(b=Math.max(b,Math.abs(r[h])+Math.abs(e[h])),d=h;d<t&&!(Math.abs(e[d])<=E*b);)d++;if(d>h)do{for(o=r[h],c=(r[h+1]-o)/(2*e[h]),l=O(c,1),c<0&&(l=-l),r[h]=e[h]/(c+l),r[h+1]=e[h]*(c+l),f=r[h+1],i=o-r[h],s=h+2;s<t;s++)r[s]-=i;for(x+=i,c=r[d],g=1,p=g,v=g,m=e[h+1],y=0,w=0,s=d-1;s>=h;s--)for(v=p,p=g,w=y,o=g*e[s],i=g*c,l=O(c,e[s]),e[s+1]=y*l,y=e[s]/l,g=c/l,c=g*r[s]-y*o,r[s+1]=i+y*(g*o+y*r[s]),u=0;u<t;u++)i=n.get(u,s+1),n.set(u,s+1,y*n.get(u,s)+g*i),n.set(u,s,g*n.get(u,s)-y*i);c=-y*w*v*m*e[h]/f,e[h]=y*c,r[h]=g*c}while(Math.abs(e[h])>E*b);r[h]=r[h]+x,e[h]=0}for(s=0;s<t-1;s++){for(u=s,c=r[s],a=s+1;a<t;a++)r[a]<c&&(u=a,c=r[a]);if(u!==s)for(r[u]=r[s],r[s]=c,a=0;a<t;a++)c=n.get(a,s),n.set(a,s,n.get(a,u)),n.set(a,u,c)}}(i,u,a,s)}else{let t=new E(i,i),e=new Float64Array(i);for(o=0;o<i;o++)for(n=0;n<i;n++)t.set(n,o,h.get(n,o));!function(t,e,r,n){let o,i,s,a,u,h,d,c=t-1;for(h=1;h<=c-1;h++){for(d=0,a=h;a<=c;a++)d+=Math.abs(e.get(a,h-1));if(0!==d){for(s=0,a=c;a>=h;a--)r[a]=e.get(a,h-1)/d,s+=r[a]*r[a];for(i=Math.sqrt(s),r[h]>0&&(i=-i),s-=r[h]*i,r[h]=r[h]-i,u=h;u<t;u++){for(o=0,a=c;a>=h;a--)o+=r[a]*e.get(a,u);for(o/=s,a=h;a<=c;a++)e.set(a,u,e.get(a,u)-o*r[a])}for(a=0;a<=c;a++){for(o=0,u=c;u>=h;u--)o+=r[u]*e.get(a,u);for(o/=s,u=h;u<=c;u++)e.set(a,u,e.get(a,u)-o*r[u])}r[h]=d*r[h],e.set(h,h-1,d*i)}}for(a=0;a<t;a++)for(u=0;u<t;u++)n.set(a,u,a===u?1:0);for(h=c-1;h>=1;h--)if(0!==e.get(h,h-1)){for(a=h+1;a<=c;a++)r[a]=e.get(a,h-1);for(u=h;u<=c;u++){for(i=0,a=h;a<=c;a++)i+=r[a]*n.get(a,u);for(i=i/r[h]/e.get(h,h-1),a=h;a<=c;a++)n.set(a,u,n.get(a,u)+i*r[a])}}}(i,t,e,s),function(t,e,r,n,o){let i,s,a,u,h,d,c,l,f,g,p,v,m,y,w,x=t-1,b=t-1,E=Number.EPSILON,N=0,M=0,_=0,k=0,A=0,j=0,S=0,O=0;for(i=0;i<t;i++)for((i<0||i>b)&&(r[i]=o.get(i,i),e[i]=0),s=Math.max(i-1,0);s<t;s++)M+=Math.abs(o.get(i,s));for(;x>=0;){for(u=x;u>0&&(j=Math.abs(o.get(u-1,u-1))+Math.abs(o.get(u,u)),0===j&&(j=M),!(Math.abs(o.get(u,u-1))<E*j));)u--;if(u===x)o.set(x,x,o.get(x,x)+N),r[x]=o.get(x,x),e[x]=0,x--,O=0;else if(u===x-1){if(c=o.get(x,x-1)*o.get(x-1,x),_=(o.get(x-1,x-1)-o.get(x,x))/2,k=_*_+c,S=Math.sqrt(Math.abs(k)),o.set(x,x,o.get(x,x)+N),o.set(x-1,x-1,o.get(x-1,x-1)+N),l=o.get(x,x),k>=0){for(S=_>=0?_+S:_-S,r[x-1]=l+S,r[x]=r[x-1],0!==S&&(r[x]=l-c/S),e[x-1]=0,e[x]=0,l=o.get(x,x-1),j=Math.abs(l)+Math.abs(S),_=l/j,k=S/j,A=Math.sqrt(_*_+k*k),_/=A,k/=A,s=x-1;s<t;s++)S=o.get(x-1,s),o.set(x-1,s,k*S+_*o.get(x,s)),o.set(x,s,k*o.get(x,s)-_*S);for(i=0;i<=x;i++)S=o.get(i,x-1),o.set(i,x-1,k*S+_*o.get(i,x)),o.set(i,x,k*o.get(i,x)-_*S);for(i=0;i<=b;i++)S=n.get(i,x-1),n.set(i,x-1,k*S+_*n.get(i,x)),n.set(i,x,k*n.get(i,x)-_*S)}else r[x-1]=l+_,r[x]=l+_,e[x-1]=S,e[x]=-S;x-=2,O=0}else{if(l=o.get(x,x),f=0,c=0,u<x&&(f=o.get(x-1,x-1),c=o.get(x,x-1)*o.get(x-1,x)),10===O){for(N+=l,i=0;i<=x;i++)o.set(i,i,o.get(i,i)-l);j=Math.abs(o.get(x,x-1))+Math.abs(o.get(x-1,x-2)),l=f=.75*j,c=-.4375*j*j}if(30===O&&(j=(f-l)/2,j=j*j+c,j>0)){for(j=Math.sqrt(j),f<l&&(j=-j),j=l-c/((f-l)/2+j),i=0;i<=x;i++)o.set(i,i,o.get(i,i)-j);N+=j,l=f=c=.964}for(O+=1,h=x-2;h>=u&&(S=o.get(h,h),A=l-S,j=f-S,_=(A*j-c)/o.get(h+1,h)+o.get(h,h+1),k=o.get(h+1,h+1)-S-A-j,A=o.get(h+2,h+1),j=Math.abs(_)+Math.abs(k)+Math.abs(A),_/=j,k/=j,A/=j,h!==u)&&!(Math.abs(o.get(h,h-1))*(Math.abs(k)+Math.abs(A))<E*(Math.abs(_)*(Math.abs(o.get(h-1,h-1))+Math.abs(S)+Math.abs(o.get(h+1,h+1)))));)h--;for(i=h+2;i<=x;i++)o.set(i,i-2,0),i>h+2&&o.set(i,i-3,0);for(a=h;a<=x-1&&(y=a!==x-1,a!==h&&(_=o.get(a,a-1),k=o.get(a+1,a-1),A=y?o.get(a+2,a-1):0,l=Math.abs(_)+Math.abs(k)+Math.abs(A),0!==l&&(_/=l,k/=l,A/=l)),0!==l);a++)if(j=Math.sqrt(_*_+k*k+A*A),_<0&&(j=-j),0!==j){for(a!==h?o.set(a,a-1,-j*l):u!==h&&o.set(a,a-1,-o.get(a,a-1)),_+=j,l=_/j,f=k/j,S=A/j,k/=_,A/=_,s=a;s<t;s++)_=o.get(a,s)+k*o.get(a+1,s),y&&(_+=A*o.get(a+2,s),o.set(a+2,s,o.get(a+2,s)-_*S)),o.set(a,s,o.get(a,s)-_*l),o.set(a+1,s,o.get(a+1,s)-_*f);for(i=0;i<=Math.min(x,a+3);i++)_=l*o.get(i,a)+f*o.get(i,a+1),y&&(_+=S*o.get(i,a+2),o.set(i,a+2,o.get(i,a+2)-_*A)),o.set(i,a,o.get(i,a)-_),o.set(i,a+1,o.get(i,a+1)-_*k);for(i=0;i<=b;i++)_=l*n.get(i,a)+f*n.get(i,a+1),y&&(_+=S*n.get(i,a+2),n.set(i,a+2,n.get(i,a+2)-_*A)),n.set(i,a,n.get(i,a)-_),n.set(i,a+1,n.get(i,a+1)-_*k)}}}if(0!==M){for(x=t-1;x>=0;x--)if(_=r[x],k=e[x],0===k)for(u=x,o.set(x,x,1),i=x-1;i>=0;i--){for(c=o.get(i,i)-_,A=0,s=u;s<=x;s++)A+=o.get(i,s)*o.get(s,x);if(e[i]<0)S=c,j=A;else if(u=i,0===e[i]?o.set(i,x,0!==c?-A/c:-A/(E*M)):(l=o.get(i,i+1),f=o.get(i+1,i),k=(r[i]-_)*(r[i]-_)+e[i]*e[i],d=(l*j-S*A)/k,o.set(i,x,d),o.set(i+1,x,Math.abs(l)>Math.abs(S)?(-A-c*d)/l:(-j-f*d)/S)),d=Math.abs(o.get(i,x)),E*d*d>1)for(s=i;s<=x;s++)o.set(s,x,o.get(s,x)/d)}else if(k<0)for(u=x-1,Math.abs(o.get(x,x-1))>Math.abs(o.get(x-1,x))?(o.set(x-1,x-1,k/o.get(x,x-1)),o.set(x-1,x,-(o.get(x,x)-_)/o.get(x,x-1))):(w=T(0,-o.get(x-1,x),o.get(x-1,x-1)-_,k),o.set(x-1,x-1,w[0]),o.set(x-1,x,w[1])),o.set(x,x-1,0),o.set(x,x,1),i=x-2;i>=0;i--){for(g=0,p=0,s=u;s<=x;s++)g+=o.get(i,s)*o.get(s,x-1),p+=o.get(i,s)*o.get(s,x);if(c=o.get(i,i)-_,e[i]<0)S=c,A=g,j=p;else if(u=i,0===e[i]?(w=T(-g,-p,c,k),o.set(i,x-1,w[0]),o.set(i,x,w[1])):(l=o.get(i,i+1),f=o.get(i+1,i),v=(r[i]-_)*(r[i]-_)+e[i]*e[i]-k*k,m=2*(r[i]-_)*k,0===v&&0===m&&(v=E*M*(Math.abs(c)+Math.abs(k)+Math.abs(l)+Math.abs(f)+Math.abs(S))),w=T(l*A-S*g+k*p,l*j-S*p-k*g,v,m),o.set(i,x-1,w[0]),o.set(i,x,w[1]),Math.abs(l)>Math.abs(S)+Math.abs(k)?(o.set(i+1,x-1,(-g-c*o.get(i,x-1)+k*o.get(i,x))/l),o.set(i+1,x,(-p-c*o.get(i,x)-k*o.get(i,x-1))/l)):(w=T(-A-f*o.get(i,x-1),-j-f*o.get(i,x),S,k),o.set(i+1,x-1,w[0]),o.set(i+1,x,w[1]))),d=Math.max(Math.abs(o.get(i,x-1)),Math.abs(o.get(i,x))),E*d*d>1)for(s=i;s<=x;s++)o.set(s,x-1,o.get(s,x-1)/d),o.set(s,x,o.get(s,x)/d)}for(i=0;i<t;i++)if(i<0||i>b)for(s=i;s<t;s++)n.set(i,s,o.get(i,s));for(s=t-1;s>=0;s--)for(i=0;i<=b;i++){for(S=0,a=0;a<=Math.min(s,b);a++)S+=n.get(i,a)*o.get(a,s);n.set(i,s,S)}}}(i,u,a,s,t)}this.n=i,this.e=u,this.d=a,this.V=s}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let t,e,r=this.n,n=this.e,o=this.d,i=new E(r,r);for(t=0;t<r;t++){for(e=0;e<r;e++)i.set(t,e,0);i.set(t,t,o[t]),n[t]>0?i.set(t,t+1,n[t]):n[t]<0&&i.set(t,t-1,n[t])}return i}}function T(t,e,r,n){let o,i;return Math.abs(r)>Math.abs(n)?(o=n/r,i=r+o*n,[(t+o*e)/i,(e-o*t)/i]):(o=r/n,i=n+o*r,[(o*t+e)/i,(o*e-t)/i])}class L{constructor(t){if(!(t=j.checkMatrix(t)).isSymmetric())throw new Error("Matrix is not symmetric");let e,r,n,o=t,i=o.rows,s=new E(i,i),a=!0;for(r=0;r<i;r++){let t=0;for(n=0;n<r;n++){let i=0;for(e=0;e<n;e++)i+=s.get(n,e)*s.get(r,e);i=(o.get(r,n)-i)/s.get(n,n),s.set(r,n,i),t+=i*i}for(t=o.get(r,r)-t,a&=t>0,s.set(r,r,Math.sqrt(Math.max(t,0))),n=r+1;n<i;n++)s.set(r,n,0)}this.L=s,this.positiveDefinite=Boolean(a)}isPositiveDefinite(){return this.positiveDefinite}solve(t){t=j.checkMatrix(t);let e=this.L,r=e.rows;if(t.rows!==r)throw new Error("Matrix dimensions do not match");if(!1===this.isPositiveDefinite())throw new Error("Matrix is not positive definite");let n,o,i,s=t.columns,a=t.clone();for(i=0;i<r;i++)for(o=0;o<s;o++){for(n=0;n<i;n++)a.set(i,o,a.get(i,o)-a.get(n,o)*e.get(i,n));a.set(i,o,a.get(i,o)/e.get(i,i))}for(i=r-1;i>=0;i--)for(o=0;o<s;o++){for(n=i+1;n<r;n++)a.set(i,o,a.get(i,o)-a.get(n,o)*e.get(n,i));a.set(i,o,a.get(i,o)/e.get(i,i))}return a}get lowerTriangularMatrix(){return this.L}}class F{constructor(t,e={}){t=j.checkMatrix(t);let{Y:r}=e;const{scaleScores:o=!1,maxIterations:i=1e3,terminationCriteria:s=1e-10}=e;let a;if(r){if(r=n.isAnyArray(r)&&"number"==typeof r[0]?E.columnVector(r):j.checkMatrix(r),r.rows!==t.rows)throw new Error("Y should have the same number of rows as X");a=r.getColumnVector(0)}else a=t.getColumnVector(0);let u,h,d,c,l=1;for(let e=0;e<i&&l>s;e++)d=t.transpose().mmul(a).div(a.transpose().mmul(a).get(0,0)),d=d.div(d.norm()),u=t.mmul(d).div(d.transpose().mmul(d).get(0,0)),e>0&&(l=u.clone().sub(c).pow(2).sum()),c=u.clone(),r?(h=r.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),h=h.div(h.norm()),a=r.mmul(h).div(h.transpose().mmul(h).get(0,0))):a=u;if(r){let e=t.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0));e=e.div(e.norm());let n=t.clone().sub(u.clone().mmul(e.transpose())),o=a.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),i=r.clone().sub(u.clone().mulS(o.get(0,0)).mmul(h.transpose()));this.t=u,this.p=e.transpose(),this.w=d.transpose(),this.q=h,this.u=a,this.s=u.transpose().mmul(u),this.xResidual=n,this.yResidual=i,this.betas=o}else this.w=d.transpose(),this.s=u.transpose().mmul(u).sqrt(),this.t=o?u.clone().div(this.s.get(0,0)):u,this.xResidual=t.sub(u.mmul(d.transpose()))}}e.y3=x,e.jy=L,e.oN=L,e.Hc=M,e.cg=P,e.hj=P,e.LU=S,e.Tb=S,e.uq=E,e.Zm=class extends _{constructor(t,e){p(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,r){return this.matrix.set(t,this.columnIndices[e],r),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}},e.Dq=class extends _{constructor(t,e){c(t,e),super(t,t.rows,1),this.column=e}set(t,e,r){return this.matrix.set(t,this.column,r),this}get(t){return this.matrix.get(t,this.column)}},e.__=class extends _{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(t,this.columns-e-1,r),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}},e.q0=class extends _{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(this.rows-t-1,e,r),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}},e.lh=class extends _{constructor(t,e){g(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,r){return this.matrix.set(this.rowIndices[t],e,r),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}},e.pI=class extends _{constructor(t,e){d(t,e),super(t,1,t.columns),this.row=e}set(t,e,r){return this.matrix.set(this.row,e,r),this}get(t,e){return this.matrix.get(this.row,e)}},e.zC=k,e.zg=class extends _{constructor(t,e,r,n,o){v(t,e,r,n,o),super(t,r-e+1,o-n+1),this.startRow=e,this.startColumn=n}set(t,e,r){return this.matrix.set(this.startRow+t,this.startColumn+e,r),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}},e.g6=class extends _{constructor(t){super(t,t.columns,t.rows)}set(t,e,r){return this.matrix.set(e,t,r),this}get(t,e){return this.matrix.get(e,t)}},e.OL=F,e.ks=F,e.QR=z,e.jp=z,e.mk=R,e.W2=R,e.l=N,e.KY=A,e.dv=j,e.BR=function(t,e=t,r={}){t=new E(t);let o=!1;if("object"!=typeof e||E.isMatrix(e)||n.isAnyArray(e)?e=new E(e):(r=e,e=t,o=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0,scale:s=!0}=r;i&&(t.center("column"),o||e.center("column")),s&&(t.scale("column"),o||e.scale("column"));const a=t.standardDeviation("column",{unbiased:!0}),u=o?a:e.standardDeviation("column",{unbiased:!0}),h=t.transpose().mmul(e);for(let e=0;e<h.rows;e++)for(let r=0;r<h.columns;r++)h.set(e,r,h.get(e,r)*(1/(a[e]*u[r]))*(1/(t.rows-1)));return h},e.Wu=function(t,e=t,r={}){t=new E(t);let o=!1;if("object"!=typeof e||E.isMatrix(e)||n.isAnyArray(e)?e=new E(e):(r=e,e=t,o=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0}=r;i&&(t=t.center("column"),o||(e=e.center("column")));const s=t.transpose().mmul(e);for(let e=0;e<s.rows;e++)for(let r=0;r<s.columns;r++)s.set(e,r,s.get(e,r)*(1/(t.rows-1)));return s},e.a4=function t(e){if((e=E.checkMatrix(e)).isSquare()){if(0===e.columns)return 1;let r,n,o,i;if(2===e.columns)return r=e.get(0,0),n=e.get(0,1),o=e.get(1,0),i=e.get(1,1),r*i-n*o;if(3===e.columns){let i,s,a;return i=new k(e,[1,2],[1,2]),s=new k(e,[1,2],[0,2]),a=new k(e,[1,2],[0,1]),r=e.get(0,0),n=e.get(0,1),o=e.get(0,2),r*t(i)-n*t(s)+o*t(a)}return new S(e).determinant}throw Error("determinant can only be calculated for a square matrix")},e.DI=function(t,e=!1){return t=j.checkMatrix(t),e?new R(t).inverse():I(t,E.eye(t.rows))},e.Jo=function(t,e={}){const{thresholdValue:r=1e-9,thresholdError:n=1e-9}=e;let o=(t=E.checkMatrix(t)).rows,i=new E(o,o);for(let e=0;e<o;e++){let s=E.columnVector(t.getRow(e)),a=t.subMatrixRow(C(o,e)).transpose(),u=new R(a).solve(s),h=E.sub(s,a.mmul(u)).abs().max();i.setRow(e,D(h,u,e,r,n))}return i},e.Zi=function(t,e=Number.EPSILON){if((t=E.checkMatrix(t)).isEmpty())return t.transpose();let r=new R(t,{autoTranspose:!0}),n=r.leftSingularVectors,o=r.rightSingularVectors,i=r.diagonal;for(let t=0;t<i.length;t++)Math.abs(i[t])>e?i[t]=1/i[t]:i[t]=0;return o.mmul(E.diag(i).mmul(n.transpose()))},e.kH=I,e.LV=function(t,e){if(n.isAnyArray(t))return t[0]&&n.isAnyArray(t[0])?new j(t):new A(t,e);throw new Error("the argument is not an array")}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={id:n,loaded:!1,exports:{}};return t[n](i,i.exports,r),i.loaded=!0,i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var n={};(()=>{"use strict";function t(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}r.d(n,{calculateLayout:()=>Pn,stopLayout:()=>Dn}),Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;const e=function(){function t(){this._events={}}return t.prototype.on=function(t,e,r){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!r}),this},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.emit=function(t){for(var e=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=this._events[t]||[],i=this._events["*"]||[],s=function(n){for(var o=n.length,i=0;i<o;i++)if(n[i]){var s=n[i],a=s.callback;s.once&&(n.splice(i,1),0===n.length&&delete e._events[t],o--,i--),a.apply(e,r)}};s(o),s(i)},t.prototype.off=function(t,e){if(t)if(e){for(var r=this._events[t]||[],n=r.length,o=0;o<n;o++)r[o].callback===e&&(r.splice(o,1),n--,o--);0===r.length&&delete this._events[t]}else delete this._events[t];else this._events={};return this},t.prototype.getEvents=function(){return this._events},t}();function o(t,e,r,n){for(;t.length;){const o=t.shift();if(r(o))return!0;e.add(o.id),n(o.id).forEach((r=>{e.has(r.id)||(e.add(r.id),t.push(r))}))}return!1}function i(t,e,r,n){if(r(t))return!0;e.add(t.id);for(const o of n(t.id))if(!e.has(o.id)&&i(o,e,r,n))return!0;return!1}const s=()=>!0;class a{graph;nodeFilter;edgeFilter;cacheEnabled;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;allNodesMap=new Map;allEdgesMap=new Map;constructor(t){this.graph=t.graph;const e=t.nodeFilter||s,r=t.edgeFilter||s;this.nodeFilter=e,this.edgeFilter=t=>{const{source:n,target:o}=this.graph.getEdgeDetail(t.id);return!(!e(n)||!e(o))&&r(t,n,o)},"auto"===t.cache?(this.cacheEnabled=!0,this.startAutoCache()):"manual"===t.cache?this.cacheEnabled=!0:this.cacheEnabled=!1}clearCache=()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()};refreshCache=()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map((t=>t.id)))};updateCache=t=>{const e=new Set;t.forEach((t=>{const r=this.bothEdgesMap.get(t);if(r&&r.forEach((t=>e.add(t.id))),this.hasNode(t)){const r=this.graph.getRelatedEdges(t,"in").filter(this.edgeFilter),n=this.graph.getRelatedEdges(t,"out").filter(this.edgeFilter),o=Array.from(new Set([...r,...n]));o.forEach((t=>e.add(t.id))),this.inEdgesMap.set(t,r),this.outEdgesMap.set(t,n),this.bothEdgesMap.set(t,o),this.allNodesMap.set(t,this.graph.getNode(t))}else this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.bothEdgesMap.delete(t),this.allNodesMap.delete(t)})),e.forEach((t=>{this.hasEdge(t)?this.allEdgesMap.set(t,this.graph.getEdge(t)):this.allEdgesMap.delete(t)}))};startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}handleGraphChanged=t=>{const e=new Set;t.changes.forEach((r=>{switch(r.type){case"NodeAdded":case"NodeRemoved":e.add(r.value.id);break;case"NodeDataUpdated":e.add(r.id);break;case"EdgeAdded":case"EdgeRemoved":e.add(r.value.source),e.add(r.value.target);break;case"EdgeUpdated":"source"!==r.propertyName&&"target"!==r.propertyName||(e.add(r.oldValue),e.add(r.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(r.id)){const n=t.graph.getEdge(r.id);e.add(n.source),e.add(n.target)}}})),this.updateCache(e)};checkNodeExistence(t){this.getNode(t)}hasNode(t){if(!this.graph.hasNode(t))return!1;const e=this.graph.getNode(t);return this.nodeFilter(e)}areNeighbors(t,e){return this.checkNodeExistence(t),this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.graph.getNode(t);if(!this.nodeFilter(e))throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){return this.checkNodeExistence(t),this.cacheEnabled?"in"===e?this.inEdgesMap.get(t):"out"===e?this.outEdgesMap.get(t):this.bothEdgesMap.get(t):this.graph.getRelatedEdges(t,e).filter(this.edgeFilter)}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}hasEdge(t){if(!this.graph.hasEdge(t))return!1;const e=this.graph.getEdge(t);return this.edgeFilter(e)}getEdge(t){const e=this.graph.getEdge(t);if(!this.edgeFilter(e))throw new Error("Edge not found for id: "+t);return e}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}hasTreeStructure(t){return this.graph.hasTreeStructure(t)}getRoots(t){return this.graph.getRoots(t).filter(this.nodeFilter)}getChildren(t,e){return this.checkNodeExistence(t),this.graph.getChildren(t,e).filter(this.nodeFilter)}getParent(t,e){this.checkNodeExistence(t);const r=this.graph.getParent(t,e);return r&&this.nodeFilter(r)?r:null}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];o([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];i(this.getNode(t),new Set,e,n)}}class u extends e{nodeMap=new Map;edgeMap=new Map;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;treeIndices=new Map;changes=[];batchCount=0;onChanged=()=>{};constructor(t){super(),t&&(t.nodes&&this.addNodes(t.nodes),t.edges&&this.addEdges(t.edges),t.tree&&this.addTree(t.tree),t.onChanged&&(this.onChanged=t.onChanged))}batch=t=>{this.batchCount+=1,t(),this.batchCount-=1,this.batchCount||this.commit()};commit(){const t=this.changes;this.changes=[];const e={graph:this,changes:t};this.emit("changed",e),this.onChanged(e)}reduceChanges(t){let e=[];return t.forEach((t=>{switch(t.type){case"NodeRemoved":{let r=!1;e=e.filter((e=>{if("NodeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"NodeDataUpdated"===e.type?e.id!==t.value.id:"TreeStructureChanged"!==e.type||e.nodeId!==t.value.id})),r||e.push(t);break}case"EdgeRemoved":{let r=!1;e=e.filter((e=>{if("EdgeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"EdgeDataUpdated"!==e.type&&"EdgeUpdated"!==e.type||e.id!==t.value.id})),r||e.push(t);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const r=e.findIndex((e=>e.type===t.type&&e.id===t.id&&(void 0===t.propertyName||e.propertyName===t.propertyName))),n=e[r];n?void 0!==t.propertyName?n.newValue=t.newValue:(e.splice(r,1),e.push(t)):e.push(t);break}case"TreeStructureDetached":e=e.filter((e=>"TreeStructureAttached"===e.type?e.treeKey!==t.treeKey:"TreeStructureChanged"!==e.type||e.treeKey!==t.treeKey)),e.push(t);break;case"TreeStructureChanged":{const r=e.find((e=>"TreeStructureChanged"===e.type&&e.treeKey===t.treeKey&&e.nodeId===t.nodeId));r?r.newParentId=t.newParentId:e.push(t);break}default:e.push(t)}})),e}checkNodeExistence(t){this.getNode(t)}hasNode(t){return this.nodeMap.has(t)}areNeighbors(t,e){return this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.nodeMap.get(t);if(!e)throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),"in"===e){const e=this.inEdgesMap.get(t);return Array.from(e)}if("out"===e){const e=this.outEdgesMap.get(t);return Array.from(e)}{const e=this.bothEdgesMap.get(t);return Array.from(e)}}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}doAddNode(t){if(this.hasNode(t.id))throw new Error("Node already exists: "+t.id);this.nodeMap.set(t.id,t),this.inEdgesMap.set(t.id,new Set),this.outEdgesMap.set(t.id,new Set),this.bothEdgesMap.set(t.id,new Set),this.treeIndices.forEach((e=>{e.childrenMap.set(t.id,new Set)})),this.changes.push({type:"NodeAdded",value:t})}addNodes(t){this.batch((()=>{for(const e of t)this.doAddNode(e)}))}addNode(t){this.addNodes([t])}doRemoveNode(t){const e=this.getNode(t),r=this.bothEdgesMap.get(t);r?.forEach((t=>this.doRemoveEdge(t.id))),this.nodeMap.delete(t),this.treeIndices.forEach((e=>{e.childrenMap.get(t)?.forEach((t=>{e.parentMap.delete(t.id)})),e.parentMap.delete(t),e.childrenMap.delete(t)})),this.changes.push({type:"NodeRemoved",value:e})}removeNodes(t){this.batch((()=>{t.forEach((t=>this.doRemoveNode(t)))}))}removeNode(t){this.removeNodes([t])}updateNodeDataProperty(t,e,r){const n=this.getNode(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"NodeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}mergeNodeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateNodeDataProperty(t,e,r)}))}))}updateNodeData(...t){const e=t[0],r=this.getNode(e);if("string"==typeof t[1])return void this.updateNodeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"NodeDataUpdated",id:e,oldValue:t,newValue:o})}))}checkEdgeExistence(t){if(!this.hasEdge(t))throw new Error("Edge not found for id: "+t)}hasEdge(t){return this.edgeMap.has(t)}getEdge(t){return this.checkEdgeExistence(t),this.edgeMap.get(t)}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}doAddEdge(t){if(this.hasEdge(t.id))throw new Error("Edge already exists: "+t.id);this.checkNodeExistence(t.source),this.checkNodeExistence(t.target),this.edgeMap.set(t.id,t);const e=this.inEdgesMap.get(t.target),r=this.outEdgesMap.get(t.source),n=this.bothEdgesMap.get(t.source),o=this.bothEdgesMap.get(t.target);e.add(t),r.add(t),n.add(t),o.add(t),this.changes.push({type:"EdgeAdded",value:t})}addEdges(t){this.batch((()=>{for(const e of t)this.doAddEdge(e)}))}addEdge(t){this.addEdges([t])}doRemoveEdge(t){const e=this.getEdge(t),r=this.outEdgesMap.get(e.source),n=this.inEdgesMap.get(e.target),o=this.bothEdgesMap.get(e.source),i=this.bothEdgesMap.get(e.target);r.delete(e),n.delete(e),o.delete(e),i.delete(e),this.edgeMap.delete(t),this.changes.push({type:"EdgeRemoved",value:e})}removeEdges(t){this.batch((()=>{t.forEach((t=>this.doRemoveEdge(t)))}))}removeEdge(t){this.removeEdges([t])}updateEdgeSource(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.source,o=e;this.outEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.outEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.source=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"source",oldValue:n,newValue:o})}))}updateEdgeTarget(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.target,o=e;this.inEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.inEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.target=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"target",oldValue:n,newValue:o})}))}updateEdgeDataProperty(t,e,r){const n=this.getEdge(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"EdgeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}updateEdgeData(...t){const e=t[0],r=this.getEdge(e);if("string"==typeof t[1])return void this.updateEdgeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"EdgeDataUpdated",id:e,oldValue:t,newValue:o})}))}mergeEdgeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateEdgeDataProperty(t,e,r)}))}))}checkTreeExistence(t){if(!this.hasTreeStructure(t))throw new Error("Tree structure not found for treeKey: "+t)}hasTreeStructure(t){return this.treeIndices.has(t)}attachTreeStructure(t){this.treeIndices.has(t)||(this.treeIndices.set(t,{parentMap:new Map,childrenMap:new Map}),this.batch((()=>{this.changes.push({type:"TreeStructureAttached",treeKey:t})})))}detachTreeStructure(t){this.checkTreeExistence(t),this.treeIndices.delete(t),this.batch((()=>{this.changes.push({type:"TreeStructureDetached",treeKey:t})}))}addTree(t,e){this.batch((()=>{this.attachTreeStructure(e);const r=[],n=Array.isArray(t)?t:[t];for(;n.length;){const t=n.shift();r.push(t),t.children&&n.push(...t.children)}this.addNodes(r),r.forEach((t=>{t.children?.forEach((r=>{this.setParent(r.id,t.id,e)}))}))}))}getRoots(t){return this.checkTreeExistence(t),this.getAllNodes().filter((e=>!this.getParent(e.id,t)))}getChildren(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);const r=this.treeIndices.get(e).childrenMap.get(t);return Array.from(r||[])}getParent(t,e){return this.checkNodeExistence(t),this.checkTreeExistence(e),this.treeIndices.get(e).parentMap.get(t)||null}getAncestors(t,e){const r=[];let n,o=this.getNode(t);for(;n=this.getParent(o.id,e);)r.push(n),o=n;return r}setParent(t,e,r){this.checkTreeExistence(r);const n=this.treeIndices.get(r),o=this.getNode(t),i=n.parentMap.get(t);if(i?.id===e)return;if(void 0===e)return i&&n.childrenMap.get(i.id)?.delete(o),void n.parentMap.delete(t);const s=this.getNode(e);n.parentMap.set(t,s),i&&n.childrenMap.get(i.id)?.delete(o);let a=n.childrenMap.get(s.id);a||(a=new Set,n.childrenMap.set(s.id,a)),a.add(o),this.batch((()=>{this.changes.push({type:"TreeStructureChanged",treeKey:r,nodeId:t,oldParentId:i?.id,newParentId:s.id})}))}dfsTree(t,e,r){return i(this.getNode(t),new Set,e,(t=>this.getChildren(t,r)))}bfsTree(t,e,r){return o([this.getNode(t)],new Set,e,(t=>this.getChildren(t,r)))}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return o([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return i(this.getNode(t),new Set,e,n)}clone(){const t=this.getAllNodes().map((t=>({...t,data:{...t.data}}))),e=this.getAllEdges().map((t=>({...t,data:{...t.data}}))),r=new u({nodes:t,edges:e});return this.treeIndices.forEach((({parentMap:t,childrenMap:e},n)=>{const o=new Map;t.forEach(((t,e)=>{o.set(e,r.getNode(t.id))}));const i=new Map;e.forEach(((t,e)=>{i.set(e,new Set(Array.from(t).map((t=>r.getNode(t.id)))))})),r.treeIndices.set(n,{parentMap:o,childrenMap:i})})),r}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(t){return new a({graph:this,...t})}}var h={}.toString;const d=function(t,e){return h.call(t)==="[object "+e+"]"},c=function(t){return d(t,"Number")},l=(t,e)=>{if("next"!==t&&"prev"!==t)return e},f=t=>{t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev};class g{constructor(){const t={};t.prev=t,t.next=t.prev,this.shortcut=t}dequeue(){const t=this.shortcut,e=t.prev;if(e&&e!==t)return f(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&f(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e}toString(){const t=[],e=this.shortcut;let r=e.prev;for(;r!==e;)t.push(JSON.stringify(r,l)),r=null==r?void 0:r.prev;return`[${t.join(", ")}]`}}class p extends g{}const v=()=>1,m=(t,e,r,n,o)=>{var i,s;const a=[];return t.hasNode(n.v)&&(null===(i=t.getRelatedEdges(n.v,"in"))||void 0===i||i.forEach((n=>{const i=n.data.weight,s=t.getNode(n.source);o&&a.push({v:n.source,w:n.target,in:0,out:0}),void 0===s.data.out&&(s.data.out=0),s.data.out-=i,y(e,r,Object.assign({v:s.id},s.data))})),null===(s=t.getRelatedEdges(n.v,"out"))||void 0===s||s.forEach((n=>{const o=n.data.weight,i=n.target,s=t.getNode(i);void 0===s.data.in&&(s.data.in=0),s.data.in-=o,y(e,r,Object.assign({v:s.id},s.data))})),t.removeNode(n.v)),o?a:void 0},y=(t,e,r)=>{r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)},w=(t,e)=>{const r="greedy"===e?((t,e)=>{var r;if(t.getAllNodes().length<=1)return[];const n=((t,e)=>{const r=new u;let n=0,o=0;t.getAllNodes().forEach((t=>{r.addNode({id:t.id,data:{v:t.id,in:0,out:0}})})),t.getAllEdges().forEach((t=>{const i=r.getRelatedEdges(t.source,"out").find((e=>e.target===t.target)),s=(null==e?void 0:e(t))||1;i?r.updateEdgeData(null==i?void 0:i.id,Object.assign(Object.assign({},i.data),{weight:i.data.weight+s})):r.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:s}}),o=Math.max(o,r.getNode(t.source).data.out+=s),n=Math.max(n,r.getNode(t.target).data.in+=s)}));const i=[],s=o+n+3;for(let t=0;t<s;t++)i.push(new p);const a=n+1;return r.getAllNodes().forEach((t=>{y(i,a,Object.assign({v:t.id},r.getNode(t.id).data))})),{buckets:i,zeroIdx:a,graph:r}})(t,(t=>t.data.weight||1)||v);return null===(r=((t,e,r)=>{let n=[];const o=e[e.length-1],i=e[0];let s;for(;t.getAllNodes().length;){for(;s=i.dequeue();)m(t,e,r,s);for(;s=o.dequeue();)m(t,e,r,s);if(t.getAllNodes().length)for(let o=e.length-2;o>0;--o)if(s=e[o].dequeue(),s){n=n.concat(m(t,e,r,s,!0));break}}return n})(n.graph,n.buckets,n.zeroIdx).map((e=>t.getRelatedEdges(e.v,"out").filter((({target:t})=>t===e.w)))))||void 0===r?void 0:r.flat()})(t):x(t);null==r||r.forEach((e=>{const r=e.data;t.removeEdge(e.id),r.forwardName=e.data.name,r.reversed=!0,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign({},r)})}))},x=t=>{const e=[],r={},n={},o=i=>{n[i]||(n[i]=!0,r[i]=!0,t.getRelatedEdges(i,"out").forEach((t=>{r[t.target]?e.push(t):o(t.target)})),delete r[i])};return t.getAllNodes().forEach((t=>o(t.id))),e},b=(t,e,r,n)=>{let o;do{o=`${n}${Math.random()}`}while(t.hasNode(o));return r.dummy=e,t.addNode({id:o,data:r}),o},E=t=>{const e=new u;return t.getAllNodes().forEach((r=>{t.getChildren(r.id).length||e.addNode(Object.assign({},r))})),t.getAllEdges().forEach((t=>{e.addEdge(t)})),e},N=(t,e)=>{const r=Number(t.x),n=Number(t.y),o=Number(e.x)-r,i=Number(e.y)-n;let s,a,u=Number(t.width)/2,h=Number(t.height)/2;return o||i?(Math.abs(i)*u>Math.abs(o)*h?(i<0&&(h=-h),s=h*o/i,a=h):(o<0&&(u=-u),s=u,a=u*i/o),{x:r+s,y:n+a}):{x:0,y:0}},M=t=>{const e=[],r=k(t)+1;for(let t=0;t<r;t++)e.push([]);t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&e[r]&&e[r].push(t.id)}));for(let n=0;n<r;n++)e[n]=e[n].sort(((e,r)=>{return n=t.getNode(e).data.order,o=t.getNode(r).data.order,Number(n)-Number(o);var n,o}));return e},_=(t,e,r,n)=>{const o={width:0,height:0};return c(r)&&c(n)&&(o.rank=r,o.order=n),b(t,"border",o,e)},k=t=>{let e;return t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&(void 0===e||r>e)&&(e=r)})),e||(e=0),e},A=(t,e)=>t.reduce(((t,r)=>e(t)>e(r)?r:t)),j=(t,e,r,n,o,i)=>{n.includes(e.id)||(n.push(e.id),r||i.push(e.id),o(e.id).forEach((e=>j(t,e,r,n,o,i))),r&&i.push(e.id))},S=(t,e,r,n)=>{const o=Array.isArray(e)?e:[e],i=e=>n?t.getSuccessors(e):t.getNeighbors(e),s=[],a=[];return o.forEach((e=>{if(!t.hasNode(e.id))throw new Error(`Graph does not have node: ${e}`);j(t,e,"post"===r,a,i,s)})),s},O=(t,e,r,n,o,i)=>{const s={rank:i,borderType:e,width:0,height:0},a=o.data[e][i-1],u=b(t,"border",s,r);o.data[e][i]=u,t.setParent(u,n),a&&t.addEdge({id:`e${Math.random()}`,source:a,target:u,data:{weight:1}})},z=t=>{t.getAllNodes().forEach((t=>{R(t)})),t.getAllEdges().forEach((t=>{R(t)}))},R=t=>{const e=t.data.width;t.data.width=t.data.height,t.data.height=e},I=t=>{(null==t?void 0:t.y)&&(t.y=-t.y)},C=t=>{const e=t.x;t.x=t.y,t.y=e},D=(t,e,r,n,o,i,s)=>{const a=t.getChildren(s);if(!(null==a?void 0:a.length))return void(s!==e&&t.addEdge({id:`e${Math.random()}`,source:e,target:s,data:{weight:0,minlen:r}}));const u=_(t,"_bt"),h=_(t,"_bb"),d=t.getNode(s);t.setParent(u,s),d.data.borderTop=u,t.setParent(h,s),d.data.borderBottom=h,null==a||a.forEach((a=>{D(t,e,r,n,o,i,a.id);const d=a.data.borderTop?a.data.borderTop:a.id,c=a.data.borderBottom?a.data.borderBottom:a.id,l=a.data.borderTop?n:2*n,f=d!==c?1:o-i[s]+1;t.addEdge({id:`e${Math.random()}`,source:u,target:d,data:{minlen:f,weight:l,nestingEdge:!0}}),t.addEdge({id:`e${Math.random()}`,source:c,target:h,data:{minlen:f,weight:l,nestingEdge:!0}})})),t.getParent(s)||t.addEdge({id:`e${Math.random()}`,source:e,target:u,data:{weight:0,minlen:o+i[s]}})},P="edge-label",T=function(t){return Array.isArray?Array.isArray(t):d(t,"Array")};var L=function(t){if("object"!=typeof t||null===t)return t;var e;if(T(t)){e=[];for(var r=0,n=t.length;r<n;r++)"object"==typeof t[r]&&null!=t[r]?e[r]=L(t[r]):e[r]=t[r]}else for(var o in e={},t)"object"==typeof t[o]&&null!=t[o]?e[o]=L(t[o]):e[o]=t[o];return e};const F=L,q=(t,e,r)=>{const n=(s=r,a=r.map(((t,e)=>e)),null==s?void 0:s.reduce(((t,e,r)=>(t[e]=a[r],t)),{})),o=e.map((e=>{const r=t.getRelatedEdges(e,"out").map((t=>({pos:n[t.target]||0,weight:t.data.weight})));return null==r?void 0:r.sort(((t,e)=>t.pos-e.pos))})),i=o.flat().filter((t=>void 0!==t));var s,a;let u=1;for(;u<r.length;)u<<=1;const h=2*u-1;u-=1;const d=Array(h).fill(0,0,h);let c=0;return null==i||i.forEach((t=>{if(t){let e=t.pos+u;d[e]+=t.weight;let r=0;for(;e>0;)e%2&&(r+=d[e+1]),e=e-1>>1,d[e]+=t.weight;c+=t.weight*r}})),c},V=(t,e)=>{let r=0;for(let n=1;n<(null==e?void 0:e.length);n+=1)r+=q(t,e[n-1],e[n]);return r},B=t=>{const e={},r=t.getAllNodes(),n=r.map((t=>{var e;return null!==(e=t.data.rank)&&void 0!==e?e:-1/0})),o=Math.max(...n),i=[];for(let t=0;t<o+1;t++)i.push([]);const s=r.sort(((e,r)=>t.getNode(e.id).data.rank-t.getNode(r.id).data.rank)),a=s.filter((e=>void 0!==t.getNode(e.id).data.fixorder)).sort(((e,r)=>t.getNode(e.id).data.fixorder-t.getNode(r.id).data.fixorder));return null==a||a.forEach((r=>{isNaN(t.getNode(r.id).data.rank)||i[t.getNode(r.id).data.rank].push(r.id),e[r.id]=!0})),null==s||s.forEach((r=>t.dfsTree(r.id,(t=>{if(e.hasOwnProperty(t.id))return!0;e[t.id]=!0,isNaN(t.data.rank)||i[t.data.rank].push(t.id)})))),i},$=(t,e)=>{var r;let n=0,o=0;t.weight&&(n+=t.barycenter*t.weight,o+=t.weight),e.weight&&(n+=e.barycenter*e.weight,o+=e.weight),t.vs=null===(r=e.vs)||void 0===r?void 0:r.concat(t.vs),t.barycenter=n/o,t.weight=o,t.i=Math.min(e.i,t.i),e.merged=!0},U=(t,e)=>{var r,n,o;const i={};null==t||t.forEach(((t,e)=>{i[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};const r=i[t.v];void 0!==t.barycenter&&(r.barycenter=t.barycenter,r.weight=t.weight)})),null===(r=e.getAllEdges())||void 0===r||r.forEach((t=>{const e=i[t.source],r=i[t.target];void 0!==e&&void 0!==r&&(r.indegree++,e.out.push(i[t.target]))}));return(t=>{var e,r;const n=[];for(;null==t?void 0:t.length;){const o=t.pop();n.push(o),null===(e=o.in.reverse())||void 0===e||e.forEach((t=>{return(e=o,t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&$(e,t)})(t);var e})),null===(r=o.out)||void 0===r||r.forEach((e=>{return(r=o,e=>{e.in.push(r),0==--e.indegree&&t.push(e)})(e);var r}))}const o=n.filter((t=>!t.merged)),i=["vs","i","barycenter","weight"];return o.map((t=>{const e={};return null==i||i.forEach((r=>{void 0!==t[r]&&(e[r]=t[r])})),e}))})(null===(o=(n=Object.values(i)).filter)||void 0===o?void 0:o.call(n,(t=>!t.indegree)))},G=(t,e,r)=>{let n,o=r;for(;e.length&&(n=e[e.length-1]).i<=o;)e.pop(),null==t||t.push(n.vs),o++;return o},W=(t,e,r,n,o,i)=>{var s,a,u,h;let d=t.getChildren(e).map((t=>t.id));const c=t.getNode(e),l=c?c.data.borderLeft:void 0,f=c?c.data.borderRight:void 0,g={};l&&(d=null==d?void 0:d.filter((t=>t!==l&&t!==f)));const p=((t,e)=>e.map((e=>{const r=t.getRelatedEdges(e,"in");if(!(null==r?void 0:r.length))return{v:e};const n={sum:0,weight:0};return null==r||r.forEach((e=>{const r=t.getNode(e.source);n.sum+=e.data.weight*r.data.order,n.weight+=e.data.weight})),{v:e,barycenter:n.sum/n.weight,weight:n.weight}})))(t,d||[]);null==p||p.forEach((e=>{var o;if(null===(o=t.getChildren(e.v))||void 0===o?void 0:o.length){const o=W(t,e.v,r,n,i);g[e.v]=o,o.hasOwnProperty("barycenter")&&H(e,o)}}));const v=U(p,r);Y(v,g),null===(s=v.filter((t=>t.vs.length>0)))||void 0===s||s.forEach((e=>{const r=t.getNode(e.vs[0]);r&&(e.fixorder=r.data.fixorder,e.order=r.data.order)}));const m=((t,e,r,n)=>{const o=((t,e)=>{const r={lhs:[],rhs:[]};return null==t||t.forEach((t=>{(t=>{const e=t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder);return n?!e&&t.hasOwnProperty("barycenter"):e||t.hasOwnProperty("barycenter")})(t)?r.lhs.push(t):r.rhs.push(t)})),r})(t),i=o.lhs,s=o.rhs.sort(((t,e)=>-t.i- -e.i)),a=[];let u=0,h=0,d=0;null==i||i.sort(((t,e)=>(r,n)=>{if(void 0!==r.fixorder&&void 0!==n.fixorder)return r.fixorder-n.fixorder;if(r.barycenter<n.barycenter)return-1;if(r.barycenter>n.barycenter)return 1;if(e&&void 0!==r.order&&void 0!==n.order){if(r.order<n.order)return-1;if(r.order>n.order)return 1}return t?n.i-r.i:r.i-n.i})(!!e,!!r)),d=G(a,s,d),null==i||i.forEach((t=>{var e;d+=null===(e=t.vs)||void 0===e?void 0:e.length,a.push(t.vs),u+=t.barycenter*t.weight,h+=t.weight,d=G(a,s,d)}));const c={vs:a.flat()};return h&&(c.barycenter=u/h,c.weight=h),c})(v,n,o,i);if(l&&(m.vs=[l,m.vs,f].flat(),null===(a=t.getPredecessors(l))||void 0===a?void 0:a.length)){const e=t.getNode((null===(u=t.getPredecessors(l))||void 0===u?void 0:u[0].id)||""),r=t.getNode((null===(h=t.getPredecessors(f))||void 0===h?void 0:h[0].id)||"");m.hasOwnProperty("barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+e.data.order+r.data.order)/(m.weight+2),m.weight+=2}return m},Y=(t,e)=>{null==t||t.forEach((t=>{var r;const n=null===(r=t.vs)||void 0===r?void 0:r.map((t=>e[t]?e[t].vs:t));t.vs=n.flat()}))},H=(t,e)=>{void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)},K=(t,e,r)=>e.map((e=>((t,e,r)=>{const n=(t=>{let e;for(;t.hasNode(e=`_root${Math.random()}`););return e})(t),o=new u({tree:[{id:n,children:[],data:{}}]});return t.getAllNodes().forEach((i=>{const s=t.getParent(i.id);(i.data.rank===e||i.data.minRank<=e&&e<=i.data.maxRank)&&(o.hasNode(i.id)||o.addNode(Object.assign({},i)),(null==s?void 0:s.id)&&!o.hasNode(null==s?void 0:s.id)&&o.addNode(Object.assign({},s)),o.setParent(i.id,(null==s?void 0:s.id)||n),t.getRelatedEdges(i.id,r).forEach((e=>{const r=e.source===i.id?e.target:e.source;o.hasNode(r)||o.addNode(Object.assign({},t.getNode(r)));const n=o.getRelatedEdges(r,"out").find((({target:t})=>t===i.id)),s=void 0!==n?n.data.weight:0;n?o.updateEdgeData(n.id,Object.assign(Object.assign({},n.data),{weight:e.data.weight+s})):o.addEdge({id:e.id,source:r,target:i.id,data:{weight:e.data.weight+s}})})),i.data.hasOwnProperty("minRank")&&o.updateNodeData(i.id,Object.assign(Object.assign({},i.data),{borderLeft:i.data.borderLeft[e],borderRight:i.data.borderRight[e]})))})),o})(t,e,r))),J=(t,e,r,n)=>{const o=new u;null==t||t.forEach((t=>{var i;const s=t.getRoots()[0].id,a=W(t,s,o,e,r,n);for(let e=0;e<(null===(i=a.vs)||void 0===i?void 0:i.length);e++){const r=t.getNode(a.vs[e]);r&&(r.data.order=e)}((t,e,r)=>{const n={};let o;null==r||r.forEach((r=>{let i,s,a=t.getParent(r);for(;a;){if(i=t.getParent(a.id),i?(s=n[i.id],n[i.id]=a.id):(s=o,o=a.id),s&&s!==a.id)return e.hasNode(s)||e.addNode({id:s,data:{}}),e.hasNode(a.id)||e.addNode({id:a.id,data:{}}),void(e.hasEdge(`e${s}-${a.id}`)||e.addEdge({id:`e${s}-${a.id}`,source:s,target:a.id,data:{}}));a=i}}))})(t,o,a.vs)}))},Q=(t,e)=>{null==e||e.forEach((e=>{null==e||e.forEach(((e,r)=>{t.getNode(e).data.order=r}))}))},X=(t,e)=>{var r,n;if(null===(r=t.getNode(e))||void 0===r?void 0:r.data.dummy)return null===(n=t.getPredecessors(e))||void 0===n?void 0:n.find((e=>t.getNode(e.id).data.dummy))},Z=(t,e,r)=>{let n=e,o=r;if(n>o){const t=n;n=o,o=t}let i=t[n];i||(t[n]=i={}),i[o]=!0},tt=(t,e,r)=>{let n=e,o=r;return n>r&&(n=r,o=e),!!t[n]},et=(t,e,r,n,o,i)=>{const s=new u,a=rt(n,o,i);return null==e||e.forEach((e=>{let n;null==e||e.forEach((e=>{const o=r[e];if(s.hasNode(o)||s.addNode({id:o,data:{}}),n){const i=r[n],u=s.getRelatedEdges(i,"out").find((t=>t.target===o));u?s.updateEdgeData(u.id,Object.assign(Object.assign({},u.data),{weight:Math.max(a(t,e,n),u.data.weight||0)})):s.addEdge({id:`e${Math.random()}`,source:i,target:o,data:{weight:Math.max(a(t,e,n),0)}})}n=e}))})),s};const rt=(t,e,r)=>(n,o,i)=>{const s=n.getNode(o),a=n.getNode(i);let u=0,h=0;if(u+=s.data.width/2,s.data.hasOwnProperty("labelpos"))switch((s.data.labelpos||"").toLowerCase()){case"l":h=-s.data.width/2;break;case"r":h=s.data.width/2}if(h&&(u+=r?h:-h),h=0,u+=(s.data.dummy?e:t)/2,u+=(a.data.dummy?e:t)/2,u+=a.data.width/2,a.data.labelpos)switch((a.data.labelpos||"").toLowerCase()){case"l":h=a.data.width/2;break;case"r":h=-a.data.width/2}return h&&(u+=r?h:-h),h=0,u},nt=(t,e)=>t.getNode(e).data.width||0,ot=(t,e)=>{var r;const n=E(t);((t,e)=>{const{ranksep:r=0}=e||{},n=M(t);let o=0;null==n||n.forEach((e=>{const n=e.map((e=>t.getNode(e).data.height)),i=Math.max(...n,0);null==e||e.forEach((e=>{t.getNode(e).data.y=o+i/2})),o+=i+r}))})(n,e);const o=((t,e)=>{const{align:r,nodesep:n=0,edgesep:o=0}=e||{},i=M(t),s=Object.assign(((t,e)=>{const r={};return(null==e?void 0:e.length)&&e.reduce(((e,n)=>{let o=0,i=0;const s=e.length,a=null==n?void 0:n[(null==n?void 0:n.length)-1];return null==n||n.forEach(((e,u)=>{var h;const d=X(t,e),c=d?t.getNode(d.id).data.order:s;(d||e===a)&&(null===(h=n.slice(i,u+1))||void 0===h||h.forEach((e=>{var n;null===(n=t.getPredecessors(e))||void 0===n||n.forEach((n=>{var i;const s=t.getNode(n.id),a=s.data.order;!(a<o||c<a)||s.data.dummy&&(null===(i=t.getNode(e))||void 0===i?void 0:i.data.dummy)||Z(r,n.id,e)}))})),i=u+1,o=c)})),n})),r})(t,i),((t,e)=>{const r={};function n(e,n){const o=function(t){return JSON.stringify(t.slice(1))}(e);n.get(o)||(function(e,n,o,i,s){var a,u;let h;for(let d=n;d<o;d++)h=e[d],(null===(a=t.getNode(h))||void 0===a?void 0:a.data.dummy)&&(null===(u=t.getPredecessors(h))||void 0===u||u.forEach((e=>{const n=t.getNode(e.id);n.data.dummy&&(n.data.order<i||n.data.order>s)&&Z(r,e.id,h)})))}(...e),n.set(o,!0))}return(null==e?void 0:e.length)&&e.reduce(((e,r)=>{let o,i=-1,s=0;const a=new Map;return null==r||r.forEach(((u,h)=>{var d;if("border"===(null===(d=t.getNode(u))||void 0===d?void 0:d.data.dummy)){const e=t.getPredecessors(u)||[];e.length&&(o=t.getNode(e[0].id).data.order,n([r,s,h,i,o],a),s=h,i=o)}n([r,s,r.length,o,e.length],a)})),r})),r})(t,i)),a={};let u=[];["u","d"].forEach((e=>{u="u"===e?i:Object.values(i).reverse(),["l","r"].forEach((r=>{"r"===r&&(u=u.map((t=>Object.values(t).reverse())));const i=("u"===e?t.getPredecessors:t.getSuccessors).bind(t),h=((t,e,r,n)=>{const o={},i={},s={};return null==e||e.forEach((t=>{null==t||t.forEach(((t,e)=>{o[t]=t,i[t]=t,s[t]=e}))})),null==e||e.forEach((t=>{let e=-1;null==t||t.forEach((t=>{let a=n(t).map((t=>t.id));if(a.length){a=a.sort(((t,e)=>s[t]-s[e]));const n=(a.length-1)/2;for(let u=Math.floor(n),h=Math.ceil(n);u<=h;++u){const n=a[u];i[t]===t&&e<s[n]&&!tt(r,t,n)&&(i[n]=t,i[t]=o[t]=o[n],e=s[n])}}}))})),{root:o,align:i}})(0,u,s,i),d=((t,e,r,n,o,i,s)=>{var a;const u={},h=et(t,e,r,o,i,s),d=s?"borderLeft":"borderRight",c=(t,e)=>{let r=h.getAllNodes(),n=r.pop();const o={};for(;n;)o[n.id]?t(n.id):(o[n.id]=!0,r.push(n),r=r.concat(e(n.id))),n=r.pop()};return c((t=>{u[t]=(h.getRelatedEdges(t,"in")||[]).reduce(((t,e)=>Math.max(t,(u[e.source]||0)+e.data.weight)),0)}),h.getPredecessors.bind(h)),c((e=>{const r=(h.getRelatedEdges(e,"out")||[]).reduce(((t,e)=>Math.min(t,(u[e.target]||0)-e.data.weight)),Number.POSITIVE_INFINITY),n=t.getNode(e);r!==Number.POSITIVE_INFINITY&&n.data.borderType!==d&&(u[e]=Math.max(u[e],r))}),h.getSuccessors.bind(h)),null===(a=Object.values(n))||void 0===a||a.forEach((t=>{u[t]=u[r[t]]})),u})(t,u,h.root,h.align,n,o,"r"===r);"r"===r&&Object.keys(d).forEach((t=>d[t]=-d[t])),a[e+r]=d}))}));const h=((t,e)=>A(Object.values(e),(e=>{var r;let n=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return null===(r=Object.keys(e))||void 0===r||r.forEach((r=>{const i=e[r],s=nt(t,r)/2;n=Math.max(i+s,n),o=Math.min(i-s,o)})),n-o})))(t,a);return h&&function(t,e){const r=Object.values(e),n=Math.min(...r),o=Math.max(...r);["u","d"].forEach((r=>{["l","r"].forEach((i=>{const s=r+i,a=t[s];let u;if(a===e)return;const h=Object.values(a);u="l"===i?n-Math.min(...h):o-Math.max(...h),u&&(t[s]={},Object.keys(a).forEach((e=>{t[s][e]=a[e]+u})))}))}))}(a,h),((t,e)=>{const r={};return Object.keys(t.ul).forEach((n=>{if(e)r[n]=t[e.toLowerCase()][n];else{const e=Object.values(t).map((t=>t[n]));r[n]=(e[0]+e[1])/2}})),r})(a,r)})(n,e);null===(r=Object.keys(o))||void 0===r||r.forEach((t=>{n.getNode(t).data.x=o[t]}))},it=t=>{const e={},r=n=>{var o;const i=t.getNode(n);if(!i)return 0;if(e[n])return i.data.rank;let s;return e[n]=!0,null===(o=t.getRelatedEdges(n,"out"))||void 0===o||o.forEach((t=>{const e=r(t.target)-t.data.minlen;e&&(void 0===s||e<s)&&(s=e)})),s||(s=0),i.data.rank=s,s};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>r(t.id)))},st=(t,e)=>t.getNode(e.target).data.rank-t.getNode(e.source).data.rank-e.data.minlen,at=(t,e)=>{const r=n=>{e.getRelatedEdges(n,"both").forEach((o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||st(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},ut=(t,e)=>{const r=n=>{var o;null===(o=e.getRelatedEdges(n,"both"))||void 0===o||o.forEach((o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||void 0===e.getNode(s).data.layer&&st(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},ht=(t,e)=>A(e.getAllEdges(),(r=>t.hasNode(r.source)!==t.hasNode(r.target)?st(e,r):1/0)),dt=(t,e,r)=>{t.getAllNodes().forEach((t=>{const n=e.getNode(t.id);n.data.rank||(n.data.rank=0),n.data.rank+=r}))},ct=(t,e)=>{let r=S(t,t.getAllNodes(),"post",!1);r=r.slice(0,(null==r?void 0:r.length)-1),r.forEach((r=>{lt(t,e,r)}))},lt=(t,e,r)=>{const n=t.getNode(r).data.parent;t.getRelatedEdges(r,"both").find((t=>t.target===n||t.source===n)).data.cutvalue=ft(t,e,r)},ft=(t,e,r)=>{const n=t.getNode(r).data.parent;let o=!0,i=e.getRelatedEdges(r,"out").find((t=>t.target===n)),s=0;return i||(o=!1,i=e.getRelatedEdges(n,"out").find((t=>t.target===r))),s=i.data.weight,e.getRelatedEdges(r,"both").forEach((e=>{const i=e.source===r,a=i?e.target:e.source;if(a!==n){const n=i===o,u=e.data.weight;if(s+=n?u:-u,xt(t,r,a)){const e=t.getRelatedEdges(r,"both").find((t=>t.source===a||t.target===a)).data.cutvalue;s+=n?-e:e}}})),s},gt=(t,e=t.getAllNodes()[0].id)=>{pt(t,{},1,e)},pt=(t,e,r,n,o)=>{var i;const s=r;let a=r;const u=t.getNode(n);return e[n]=!0,null===(i=t.getNeighbors(n))||void 0===i||i.forEach((r=>{e[r.id]||(a=pt(t,e,a,r.id,n))})),u.data.low=s,u.data.lim=a++,o?u.data.parent=o:delete u.data.parent,a},vt=t=>t.getAllEdges().find((t=>t.data.cutvalue<0)),mt=(t,e,r)=>{let n=r.source,o=r.target;e.getRelatedEdges(n,"out").find((t=>t.target===o))||(n=r.target,o=r.source);const i=t.getNode(n),s=t.getNode(o);let a=i,u=!1;i.data.lim>s.data.lim&&(a=s,u=!0);const h=e.getAllEdges().filter((e=>u===bt(t.getNode(e.source),a)&&u!==bt(t.getNode(e.target),a)));return A(h,(t=>st(e,t)))},yt=(t,e,r,n)=>{const o=t.getRelatedEdges(r.source,"both").find((t=>t.source===r.target||t.target===r.target));o&&t.removeEdge(o.id),t.addEdge({id:`e${Math.random()}`,source:n.source,target:n.target,data:{}}),gt(t),ct(t,e),wt(t,e)},wt=(t,e)=>{const r=t.getAllNodes().find((t=>!t.data.parent));let n=S(t,r,"pre",!1);n=n.slice(1),n.forEach((r=>{const n=t.getNode(r).data.parent;let o=e.getRelatedEdges(r,"out").find((t=>t.target===n)),i=!1;!o&&e.hasNode(n)&&(o=e.getRelatedEdges(n,"out").find((t=>t.target===r)),i=!0),e.getNode(r).data.rank=(e.hasNode(n)&&e.getNode(n).data.rank||0)+(i?null==o?void 0:o.data.minlen:-(null==o?void 0:o.data.minlen))}))},xt=(t,e,r)=>t.getRelatedEdges(e,"both").find((t=>t.source===r||t.target===r)),bt=(t,e)=>e.data.low<=t.data.lim&&t.data.lim<=e.data.lim,Et=it,Nt=t=>{(t=>{const e=(t=>{const e=new u;return t.getAllNodes().forEach((t=>{e.addNode(Object.assign({},t))})),t.getAllEdges().forEach((t=>{const r=e.getRelatedEdges(t.source,"out").find((e=>e.target===t.target));r?e.updateEdgeData(null==r?void 0:r.id,Object.assign(Object.assign({},r.data),{weight:r.data.weight+t.data.weight||0,minlen:Math.max(r.data.minlen,t.data.minlen||1)})):e.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||0,minlen:t.data.minlen||1}})})),e})(t);it(e);const r=(t=>{const e=new u({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);at(e,t)<n;)o=ht(e,t),i=e.hasNode(o.source)?st(t,o):-st(t,o),dt(e,t,i);return e})(e);let n,o;for(gt(r),ct(r,e);n=vt(r);)o=mt(r,e,n),yt(r,e,n,o)})(t)},Mt=(t,e)=>{const{acyclicer:r,ranker:n,rankdir:o="tb",nodeOrder:i,keepNodeOrder:s,align:a,nodesep:h=50,edgesep:d=20,ranksep:c=50}=e;Lt(t),w(t,r);const{nestingRoot:l,nodeRankFactor:f}=(t=>{const e=b(t,"root",{},"_root"),r=(t=>{const e={},r=(n,o)=>{const i=t.getChildren(n);null==i||i.forEach((t=>r(t.id,o+1))),e[n]=o};return t.getRoots().forEach((t=>r(t.id,1))),e})(t);let n=Math.max(...Object.values(r));Math.abs(n)===1/0&&(n=1);const o=n-1,i=2*o+1;t.getAllEdges().forEach((t=>{t.data.minlen*=i}));const s=(t=>{let e=0;return t.getAllEdges().forEach((t=>{e+=t.data.weight})),e})(t)+1;return t.getRoots().forEach((n=>{D(t,e,i,s,o,r,n.id)})),{nestingRoot:e,nodeRankFactor:i}})(t);((t,e)=>{switch(e){case"network-simplex":Nt(t);break;case"tight-tree":default:(t=>{(t=>{const e={};let r;const n=o=>{var i;const s=t.getNode(o);if(!s)return 0;if(e[o])return s.data.rank;let a;return e[o]=!0,null===(i=t.getRelatedEdges(o,"out"))||void 0===i||i.forEach((t=>{const e=n(t.target)-t.data.minlen;e&&(void 0===a||e<a)&&(a=e)})),a||(a=0),(void 0===r||a<r)&&(r=a),s.data.rank=a,a};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>{t&&n(t.id)})),void 0===r&&(r=0);const o={},i=(e,r)=>{var n;const s=t.getNode(e),a=isNaN(s.data.layer)?r:s.data.layer;(void 0===s.data.rank||s.data.rank<a)&&(s.data.rank=a),o[e]||(o[e]=!0,null===(n=t.getRelatedEdges(e,"out"))||void 0===n||n.forEach((t=>{i(t.target,a+t.data.minlen)})))};t.getAllNodes().forEach((t=>{const e=t.data;e&&(isNaN(e.layer)?e.rank-=r:i(t.id,e.layer))}))})(t),(t=>{const e=new u({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);ut(e,t)<n;)o=ht(e,t),i=e.hasNode(o.source)?st(t,o):-st(t,o),dt(e,t,i)})(t)})(t);break;case"longest-path":Et(t)}})(E(t),n),Ot(t),((t,e=0)=>{const r=t.getAllNodes(),n=r.filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),o=Math.min(...n),i=[];r.forEach((t=>{const e=(t.data.rank||0)-o;i[e]||(i[e]=[]),i[e].push(t.id)}));let s=0;for(let r=0;r<i.length;r++){const n=i[r];void 0===n?r%e!=0&&(s-=1):s&&(null==n||n.forEach((e=>{const r=t.getNode(e);r&&(r.data.rank=r.data.rank||0,r.data.rank+=s)})))}})(t,f),((t,e)=>{e&&t.removeNode(e),t.getAllEdges().forEach((e=>{e.data.nestingEdge&&t.removeEdge(e.id)}))})(t,l),(t=>{const e=t.getAllNodes().filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),r=Math.min(...e);t.getAllNodes().forEach((t=>{t.data.hasOwnProperty("rank")&&r!==1/0&&(t.data.rank-=r)}))})(t),zt(t),Rt(t);const g=[];((t,e)=>{t.getAllEdges().forEach((r=>((t,e,r)=>{let n=e.source,o=t.getNode(n).data.rank;const i=e.target,s=t.getNode(i).data.rank,a=e.data.labelRank;if(s===o+1)return;let u,h,d;for(t.removeEdge(e.id),d=0,++o;o<s;++d,++o)e.data.points=[],h={originalEdge:e,width:0,height:0,rank:o},u=b(t,"edge",h,"_d"),o===a&&(h.width=e.data.width,h.height=e.data.height,h.dummy=P,h.labelpos=e.data.labelpos),t.addEdge({id:`e${Math.random()}`,source:n,target:u,data:{weight:e.data.weight}}),0===d&&r.push(u),n=u;t.addEdge({id:`e${Math.random()}`,source:n,target:i,data:{weight:e.data.weight}})})(t,r,e)))})(t,g),((t,e)=>{const r=(t=>{const e={};let r=0;const n=o=>{const i=r;t.getChildren(o).forEach((t=>n(t.id))),e[o]={low:i,lim:r++}};return t.getRoots().forEach((t=>n(t.id))),e})(t);e.forEach((e=>{var n,o;let i=e,s=t.getNode(i);const a=s.data.originalEdge;if(!a)return;const u=((t,e,r,n)=>{var o,i;const s=[],a=[],u=Math.min(e[r].low,e[n].low),h=Math.max(e[r].lim,e[n].lim);let d,c;d=r;do{d=null===(o=t.getParent(d))||void 0===o?void 0:o.id,s.push(d)}while(d&&(e[d].low>u||h>e[d].lim));for(c=d,d=n;d&&d!==c;)a.push(d),d=null===(i=t.getParent(d))||void 0===i?void 0:i.id;return{lca:c,path:s.concat(a.reverse())}})(t,r,a.source,a.target),h=u.path,d=u.lca;let c=0,l=h[c],f=!0;for(;i!==a.target;){if(s=t.getNode(i),f){for(;l!==d&&(null===(n=t.getNode(l))||void 0===n?void 0:n.data.maxRank)<s.data.rank;)c++,l=h[c];l===d&&(f=!1)}if(!f){for(;c<h.length-1&&(null===(o=t.getNode(h[c+1]))||void 0===o?void 0:o.data.minRank)<=s.data.rank;)c++;l=h[c]}t.hasNode(l)&&t.setParent(i,l),i=t.getSuccessors(i)[0].id}}))})(t,g),(t=>{const e=r=>{const n=t.getChildren(r),o=t.getNode(r);if((null==n?void 0:n.length)&&n.forEach((t=>e(t.id))),o.data.hasOwnProperty("minRank")){o.data.borderLeft=[],o.data.borderRight=[];for(let e=o.data.minRank,n=o.data.maxRank+1;e<n;e+=1)O(t,"borderLeft","_bl",r,o,e),O(t,"borderRight","_br",r,o,e)}};t.getRoots().forEach((t=>e(t.id)))})(t),s&&((t,e)=>{const r=t.getAllNodes().filter((e=>{var r;return!(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length)})).map((t=>t.data.rank)),n=Math.max(...r),o=[];for(let t=0;t<n+1;t++)o[t]=[];null==e||e.forEach((e=>{const r=t.getNode(e);r&&!r.data.dummy&&(isNaN(r.data.rank)||(r.data.fixorder=o[r.data.rank].length,o[r.data.rank].push(e)))}))})(t,i),((t,e)=>{const r=k(t),n=[],o=[];for(let t=1;t<r+1;t++)n.push(t);for(let t=r-1;t>-1;t--)o.push(t);const i=K(t,n,"in"),s=K(t,o,"out");let a=B(t);Q(t,a);let u,h=Number.POSITIVE_INFINITY;for(let r=0,n=0;n<4;++r,++n){J(r%2?i:s,r%4>=2,!1,e),a=M(t);const o=V(t,a);o<h&&(n=0,u=F(a),h=o)}a=B(t),Q(t,a);for(let r=0,n=0;n<4;++r,++n){J(r%2?i:s,r%4>=2,!0,e),a=M(t);const o=V(t,a);o<h&&(n=0,u=F(a),h=o)}Q(t,u)})(t,s),Ft(t),((t,e)=>{const r=e.toLowerCase();"lr"!==r&&"rl"!==r||z(t)})(t,o),ot(t,{align:a,nodesep:h,edgesep:d,ranksep:c}),qt(t),Tt(t),((t,e)=>{e.forEach((e=>{let r=t.getNode(e);const{data:n}=r,o=n.originalEdge;let i;o&&t.addEdge(o);let s=e;for(;r.data.dummy;)i=t.getSuccessors(s)[0],t.removeNode(s),o.data.points.push({x:r.data.x,y:r.data.y}),r.data.dummy===P&&(o.data.x=r.data.x,o.data.y=r.data.y,o.data.width=r.data.width,o.data.height=r.data.height),s=i.id,r=t.getNode(s)}))})(t,g),Dt(t),((t,e)=>{const r=e.toLowerCase();"bt"!==r&&"rl"!==r||(t=>{t.getAllNodes().forEach((t=>{I(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>I(t))),t.data.hasOwnProperty("y")&&I(t.data)}))})(t),"lr"!==r&&"rl"!==r||((t=>{t.getAllNodes().forEach((t=>{C(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>C(t))),t.data.hasOwnProperty("x")&&C(t.data)}))})(t),z(t))})(t,o);const{width:p,height:v}=It(t);return Ct(t),Pt(t),(t=>{t.getAllEdges().forEach((e=>{const r=e.data;if(r.reversed){t.removeEdge(e.id);const n=r.forwardName;delete r.reversed,delete r.forwardName,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign(Object.assign({},r),{forwardName:n})})}}))})(t),{width:p,height:v}},_t=["width","height","layer","fixorder"],kt={width:0,height:0},At=["minlen","weight","width","height","labeloffset"],jt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},St=["labelpos"],Ot=t=>{t.getAllEdges().forEach((e=>{if(e.data.width&&e.data.height){const r=t.getNode(e.source),n={e,rank:(t.getNode(e.target).data.rank-r.data.rank)/2+r.data.rank};b(t,"edge-proxy",n,"_ep")}}))},zt=t=>{let e=0;return t.getAllNodes().forEach((r=>{var n,o;r.data.borderTop&&(r.data.minRank=null===(n=t.getNode(r.data.borderTop))||void 0===n?void 0:n.data.rank,r.data.maxRank=null===(o=t.getNode(r.data.borderBottom))||void 0===o?void 0:o.data.rank,e=Math.max(e,r.data.maxRank||-1/0))})),e},Rt=t=>{t.getAllNodes().forEach((e=>{"edge-proxy"===e.data.dummy&&(t.getEdge(e.data.e.id).data.labelRank=e.data.rank,t.removeNode(e.id))}))},It=(t,e)=>{let r,n,o=0,i=0;const{marginx:s=0,marginy:a=0}=e||{},u=t=>{if(!t.data)return;const e=t.data.x,s=t.data.y,a=t.data.width,u=t.data.height;isNaN(e)||isNaN(a)||(void 0===r&&(r=e-a/2),r=Math.min(r,e-a/2),o=Math.max(o,e+a/2)),isNaN(s)||isNaN(u)||(void 0===n&&(n=s-u/2),n=Math.min(n,s-u/2),i=Math.max(i,s+u/2))};return t.getAllNodes().forEach((t=>{u(t)})),t.getAllEdges().forEach((t=>{(null==t?void 0:t.data.hasOwnProperty("x"))&&u(t)})),r-=s,n-=a,t.getAllNodes().forEach((t=>{t.data.x-=r,t.data.y-=n})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>{t.x-=r,t.y-=n})),t.data.hasOwnProperty("x")&&(t.data.x-=r),t.data.hasOwnProperty("y")&&(t.data.y-=n)})),{width:o-r+s,height:i-n+a}},Ct=t=>{t.getAllEdges().forEach((e=>{const r=t.getNode(e.source),n=t.getNode(e.target);let o,i;e.data.points?(o=e.data.points[0],i=e.data.points[e.data.points.length-1]):(e.data.points=[],o={x:n.data.x,y:n.data.y},i={x:r.data.x,y:r.data.y}),e.data.points.unshift(N(r.data,o)),e.data.points.push(N(n.data,i))}))},Dt=t=>{t.getAllEdges().forEach((t=>{if(t.data.hasOwnProperty("x"))switch("l"!==t.data.labelpos&&"r"!==t.data.labelpos||(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset}}))},Pt=t=>{t.getAllEdges().forEach((t=>{var e;t.data.reversed&&(null===(e=t.data.points)||void 0===e||e.reverse())}))},Tt=t=>{t.getAllNodes().forEach((e=>{var r,n,o;if(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length){const r=t.getNode(e.id),i=t.getNode(r.data.borderTop),s=t.getNode(r.data.borderBottom),a=t.getNode(r.data.borderLeft[(null===(n=r.data.borderLeft)||void 0===n?void 0:n.length)-1]),u=t.getNode(r.data.borderRight[(null===(o=r.data.borderRight)||void 0===o?void 0:o.length)-1]);r.data.width=Math.abs((null==u?void 0:u.data.x)-(null==a?void 0:a.data.x))||10,r.data.height=Math.abs((null==s?void 0:s.data.y)-(null==i?void 0:i.data.y))||10,r.data.x=((null==a?void 0:a.data.x)||0)+r.data.width/2,r.data.y=((null==i?void 0:i.data.y)||0)+r.data.height/2}})),t.getAllNodes().forEach((e=>{"border"===e.data.dummy&&t.removeNode(e.id)}))},Lt=t=>{t.getAllEdges().forEach((e=>{if(e.source===e.target){const r=t.getNode(e.source);r.data.selfEdges||(r.data.selfEdges=[]),r.data.selfEdges.push(e),t.removeEdge(e.id)}}))},Ft=t=>{const e=M(t);null==e||e.forEach((e=>{let r=0;null==e||e.forEach(((e,n)=>{var o;const i=t.getNode(e);i.data.order=n+r,null===(o=i.data.selfEdges)||void 0===o||o.forEach((e=>{b(t,"selfedge",{width:e.data.width,height:e.data.height,rank:i.data.rank,order:n+ ++r,e},"_se")})),delete i.data.selfEdges}))}))},qt=t=>{t.getAllNodes().forEach((e=>{const r=t.getNode(e.id);if("selfedge"===r.data.dummy){const n=t.getNode(r.data.e.source),o=n.data.x+n.data.width/2,i=n.data.y,s=r.data.x-o,a=n.data.height/2;t.hasEdge(r.data.e.id)?t.updateEdgeData(r.data.e.id,r.data.e.data):t.addEdge({id:r.data.e.id,source:r.data.e.source,target:r.data.e.target,data:r.data.e.data}),t.removeNode(e.id),r.data.e.data.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{y:i,x:o+s},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.data.e.data.x=r.data.x,r.data.e.data.y=r.data.y}}))},Vt=(t,e)=>{const r={};return null==e||e.forEach((e=>{void 0!==t[e]&&(r[e]=+t[e])})),r},Bt=(t={})=>{const e={};return Object.keys(t).forEach((r=>{e[r.toLowerCase()]=t[r]})),e},$t=function(t){return"function"==typeof t},Ut=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};function Gt(t,e){let r;return r=$t(e)?e:c(e)?()=>e:()=>t,r}function Wt(t,e,r=!0){return e||0===e?$t(e)?e:c(e)?()=>e:Array.isArray(e)?()=>{if(r){const r=Math.max(...e);return isNaN(r)?t:r}return e}:Ut(e)?()=>{if(r){const r=Math.max(e.width,e.height);return isNaN(r)?t:r}return[e.width,e.height]}:()=>t:e=>{const{size:r}=e.data||{};return r?Array.isArray(r)?r[0]>r[1]?r[0]:r[1]:Ut(r)?r.width>r.height?r.width:r.height:r:t}}const Yt=(t,e)=>{let r,n;return n=c(e)?()=>e:$t(e)?e:()=>0,r=t?Array.isArray(t)?e=>(t[0]>t[1]?t[0]:t[1])+n(e):$t(t)?t:e=>t+n(e):t=>{var e,r;if(null===(e=t.data)||void 0===e?void 0:e.bboxSize)return Math.max(t.data.bboxSize[0],t.data.bboxSize[1])+n(t);if(null===(r=t.data)||void 0===r?void 0:r.size){if(Array.isArray(t.data.size))return Math.max(t.data.size[0],t.data.size[1])+n(t);const e=t.data.size;return Ut(e)?(e.width>e.height?e.width:e.height)+n(t):e+n(t)}return 10+n(t)},r},Ht=t=>{if(null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array){const e=[];return t.forEach((t=>{e.push(t)})),e.map((t=>Ht(t)))}if("object"==typeof t){const e={};return Object.keys(t).forEach((r=>{e[r]=Ht(t[r])})),e}return t},Kt=(t,e)=>{const r=Ht(t);return r.data=r.data||{},e&&(c(r.data.x)||(r.data.x=Math.random()*e[0]),c(r.data.y)||(r.data.y=Math.random()*e[1])),r},Jt={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null},Qt=(t,e,r)=>{const n=t.getAllNodes(),o=t.getAllEdges();return(null==n?void 0:n.length)?1===n.length?(e&&t.mergeNodeData(n[0].id,{x:r[0],y:r[1]}),{nodes:[Object.assign(Object.assign({},n[0]),{data:Object.assign(Object.assign({},n[0].data),{x:r[0],y:r[1]})})],edges:o}):void 0:{nodes:[],edges:o}},Xt={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1},Zt=(t,e,r=!1)=>{const n=[Kt(e[0])],o={},i=e.length;o[e[0].id]=!0;let s=0;return e.forEach(((a,u)=>{if(0!==u)if(u!==i-1&&t.getDegree(a.id,"both")===t.getDegree(e[u+1].id,"both")&&!t.areNeighbors(n[s].id,a.id)||o[a.id]){const u=r?t.getSuccessors(n[s].id):t.getNeighbors(n[s].id);let h=!1;for(let e=0;e<u.length;e++){const r=u[e];if(t.getDegree(r.id)===t.getDegree(a.id)&&!o[r.id]){n.push(Kt(r)),o[r.id]=!0,h=!0;break}}let d=0;for(;!h&&(o[e[d].id]||(n.push(Kt(e[d])),o[e[d].id]=!0,h=!0),d++,d!==i););}else n.push(Kt(a)),o[a.id]=!0,s++})),n},te=function(t){return d(t,"String")},ee=Array.isArray,re={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class ne{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},re),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericConcentricLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){this.genericConcentricLayout(!0,e,r)}))}genericConcentricLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{center:o,width:i,height:s,sortBy:a,maxLevelDiff:u,sweep:h,clockwise:d,equidistant:l,preventOverlap:f,startAngle:g=1.5*Math.PI,nodeSize:p,nodeSpacing:v}=t,m=r.getAllNodes(),y=r.getAllEdges(),w=i||"undefined"==typeof window?i:window.innerWidth,x=s||"undefined"==typeof window?s:window.innerHeight,b=o||[w/2,x/2];if(!(null==m?void 0:m.length)||1===m.length)return Qt(r,e,b);const E=[];let N,M=0;ee(p)?N=Math.max(p[0],p[1]):$t(p)?(N=-1/0,m.forEach((t=>{const e=p(t);e>N&&(N=e)}))):N=p,ee(v)?M=Math.max(v[0],v[1]):c(v)&&(M=v),m.forEach((t=>{const e=Kt(t);E.push(e);let r=N;const{data:n}=e;ee(n.size)?r=Math.max(n.size[0],n.size[1]):c(n.size)?r=n.size:Ut(n.size)&&(r=Math.max(n.size.width,n.size.height)),N=Math.max(N,r),$t(v)&&(M=Math.max(v(t),M))}));const _={};E.forEach(((t,e)=>{_[t.id]=e}));let k=a;te(k)&&void 0!==E[0].data[k]||(k="degree"),"degree"===k?E.sort(((t,e)=>r.getDegree(e.id,"both")-r.getDegree(t.id,"both"))):E.sort(((t,e)=>e.data[k]-t.data[k]));const A=E[0],j=(u||("degree"===k?r.getDegree(A.id,"both"):A.data[k]))/4,S=[{nodes:[]}];let O=S[0];E.forEach((t=>{if(O.nodes.length>0){const e="degree"===k?Math.abs(r.getDegree(O.nodes[0].id,"both")-r.getDegree(t.id,"both")):Math.abs(O.nodes[0].data[k]-t.data[k]);j&&e>=j&&(O={nodes:[]},S.push(O))}O.nodes.push(t)}));let z=N+M;if(!f){const t=S.length>0&&S[0].nodes.length>1,e=(Math.min(w,x)/2-z)/(S.length+(t?1:0));z=Math.min(z,e)}let R=0;if(S.forEach((t=>{const e=void 0===h?2*Math.PI-2*Math.PI/t.nodes.length:h;if(t.dTheta=e/Math.max(1,t.nodes.length-1),t.nodes.length>1&&f){const e=Math.cos(t.dTheta)-Math.cos(0),r=Math.sin(t.dTheta)-Math.sin(0),n=Math.sqrt(z*z/(e*e+r*r));R=Math.max(n,R)}t.r=R,R+=z})),l){let t=0,e=0;for(let r=0;r<S.length;r++){const n=(S[r].r||0)-e;t=Math.max(t,n)}e=0,S.forEach(((r,n)=>{0===n&&(e=r.r||0),r.r=e,e+=t}))}return S.forEach((t=>{const e=t.dTheta||0,r=t.r||0;t.nodes.forEach(((t,n)=>{const o=g+(d?1:-1)*e*n;t.data.x=b[0]+r*Math.cos(o),t.data.y=b[1]+r*Math.sin(o)}))})),e&&E.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:E,edges:y}}))}}function oe(t,e,r,n){if(isNaN(e)||isNaN(r))return t;var o,i,s,a,u,h,d,c,l,f=t._root,g={data:n},p=t._x0,v=t._y0,m=t._x1,y=t._y1;if(!f)return t._root=g,t;for(;f.length;)if((h=e>=(i=(p+m)/2))?p=i:m=i,(d=r>=(s=(v+y)/2))?v=s:y=s,o=f,!(f=f[c=d<<1|h]))return o[c]=g,t;if(a=+t._x.call(null,f.data),u=+t._y.call(null,f.data),e===a&&r===u)return g.next=f,o?o[c]=g:t._root=g,t;do{o=o?o[c]=new Array(4):t._root=new Array(4),(h=e>=(i=(p+m)/2))?p=i:m=i,(d=r>=(s=(v+y)/2))?v=s:y=s}while((c=d<<1|h)==(l=(u>=s)<<1|a>=i));return o[l]=f,o[c]=g,t}function ie(t,e,r,n,o){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=o}function se(t){return t[0]}function ae(t){return t[1]}function ue(t,e,r){var n=new he(null==e?se:e,null==r?ae:r,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function he(t,e,r,n,o,i){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=o,this._y1=i,this._root=void 0}function de(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var ce=ue.prototype=he.prototype;function le(t,e,r,n,o){if(isNaN(e)||isNaN(r)||isNaN(n))return t;var i,s,a,u,h,d,c,l,f,g,p,v,m=t._root,y={data:o},w=t._x0,x=t._y0,b=t._z0,E=t._x1,N=t._y1,M=t._z1;if(!m)return t._root=y,t;for(;m.length;)if((l=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+N)/2))?x=a:N=a,(g=n>=(u=(b+M)/2))?b=u:M=u,i=m,!(m=m[p=g<<2|f<<1|l]))return i[p]=y,t;if(h=+t._x.call(null,m.data),d=+t._y.call(null,m.data),c=+t._z.call(null,m.data),e===h&&r===d&&n===c)return y.next=m,i?i[p]=y:t._root=y,t;do{i=i?i[p]=new Array(8):t._root=new Array(8),(l=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+N)/2))?x=a:N=a,(g=n>=(u=(b+M)/2))?b=u:M=u}while((p=g<<2|f<<1|l)==(v=(c>=u)<<2|(d>=a)<<1|h>=s));return i[v]=m,i[p]=y,t}function fe(t,e,r,n,o,i,s){this.node=t,this.x0=e,this.y0=r,this.z0=n,this.x1=o,this.y1=i,this.z1=s}function ge(t){return t[0]}function pe(t){return t[1]}function ve(t){return t[2]}function me(t,e,r,n){var o=new ye(null==e?ge:e,null==r?pe:r,null==n?ve:n,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?o:o.addAll(t)}function ye(t,e,r,n,o,i,s,a,u){this._x=t,this._y=e,this._z=r,this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this._root=void 0}function we(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}ce.copy=function(){var t,e,r=new he(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=de(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var o=0;o<4;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(4)}):n.target[o]=de(e));return r},ce.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t);return oe(this.cover(e,r),e,r,t)},ce.addAll=function(t){var e,r,n,o,i=t.length,s=new Array(i),a=new Array(i),u=1/0,h=1/0,d=-1/0,c=-1/0;for(r=0;r<i;++r)isNaN(n=+this._x.call(null,e=t[r]))||isNaN(o=+this._y.call(null,e))||(s[r]=n,a[r]=o,n<u&&(u=n),n>d&&(d=n),o<h&&(h=o),o>c&&(c=o));if(u>d||h>c)return this;for(this.cover(u,h).cover(d,c),r=0;r<i;++r)oe(this,s[r],a[r],t[r]);return this},ce.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var r=this._x0,n=this._y0,o=this._x1,i=this._y1;if(isNaN(r))o=(r=Math.floor(t))+1,i=(n=Math.floor(e))+1;else{for(var s,a,u=o-r||1,h=this._root;r>t||t>=o||n>e||e>=i;)switch(a=(e<n)<<1|t<r,(s=new Array(4))[a]=h,h=s,u*=2,a){case 0:o=r+u,i=n+u;break;case 1:r=o-u,i=n+u;break;case 2:o=r+u,n=i-u;break;case 3:r=o-u,n=i-u}this._root&&this._root.length&&(this._root=h)}return this._x0=r,this._y0=n,this._x1=o,this._y1=i,this},ce.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},ce.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]]},ce.find=function(t,e,r){var n,o,i,s,a,u,h,d=this._x0,c=this._y0,l=this._x1,f=this._y1,g=[],p=this._root;for(p&&g.push(new ie(p,d,c,l,f)),null==r?r=1/0:(d=t-r,c=e-r,l=t+r,f=e+r,r*=r);u=g.pop();)if(!(!(p=u.node)||(o=u.x0)>l||(i=u.y0)>f||(s=u.x1)<d||(a=u.y1)<c))if(p.length){var v=(o+s)/2,m=(i+a)/2;g.push(new ie(p[3],v,m,s,a),new ie(p[2],o,m,v,a),new ie(p[1],v,i,s,m),new ie(p[0],o,i,v,m)),(h=(e>=m)<<1|t>=v)&&(u=g[g.length-1],g[g.length-1]=g[g.length-1-h],g[g.length-1-h]=u)}else{var y=t-+this._x.call(null,p.data),w=e-+this._y.call(null,p.data),x=y*y+w*w;if(x<r){var b=Math.sqrt(r=x);d=t-b,c=e-b,l=t+b,f=e+b,n=p.data}}return n},ce.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t)))return this;var e,r,n,o,i,s,a,u,h,d,c,l,f=this._root,g=this._x0,p=this._y0,v=this._x1,m=this._y1;if(!f)return this;if(f.length)for(;;){if((h=i>=(a=(g+v)/2))?g=a:v=a,(d=s>=(u=(p+m)/2))?p=u:m=u,e=f,!(f=f[c=d<<1|h]))return this;if(!f.length)break;(e[c+1&3]||e[c+2&3]||e[c+3&3])&&(r=e,l=c)}for(;f.data!==t;)if(n=f,!(f=f.next))return this;return(o=f.next)&&delete f.next,n?(o?n.next=o:delete n.next,this):e?(o?e[c]=o:delete e[c],(f=e[0]||e[1]||e[2]||e[3])&&f===(e[3]||e[2]||e[1]||e[0])&&!f.length&&(r?r[l]=f:this._root=f),this):(this._root=o,this)},ce.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},ce.root=function(){return this._root},ce.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},ce.visit=function(t){var e,r,n,o,i,s,a=[],u=this._root;for(u&&a.push(new ie(u,this._x0,this._y0,this._x1,this._y1));e=a.pop();)if(!t(u=e.node,n=e.x0,o=e.y0,i=e.x1,s=e.y1)&&u.length){var h=(n+i)/2,d=(o+s)/2;(r=u[3])&&a.push(new ie(r,h,d,i,s)),(r=u[2])&&a.push(new ie(r,n,d,h,s)),(r=u[1])&&a.push(new ie(r,h,o,i,d)),(r=u[0])&&a.push(new ie(r,n,o,h,d))}return this},ce.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new ie(this._root,this._x0,this._y0,this._x1,this._y1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.y0,u=e.x1,h=e.y1,d=(s+u)/2,c=(a+h)/2;(i=o[0])&&r.push(new ie(i,s,a,d,c)),(i=o[1])&&r.push(new ie(i,d,a,u,c)),(i=o[2])&&r.push(new ie(i,s,c,d,h)),(i=o[3])&&r.push(new ie(i,d,c,u,h))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},ce.x=function(t){return arguments.length?(this._x=t,this):this._x},ce.y=function(t){return arguments.length?(this._y=t,this):this._y};var xe=me.prototype=ye.prototype;function be(t){let e=0,r=0,n=0,o=0,i=0;const s=t.length;if(s){for(let a=0;a<s;a++){const s=t[a];s&&s.weight&&(e+=s.weight,r+=s.x*s.weight,n+=s.y*s.weight,o+=s.z*s.weight,i+=s.size*s.weight)}t.x=r/e,t.y=n/e,t.z=o/e,t.size=i/e,t.weight=e}else{const e=t;t.x=e.data.x,t.y=e.data.y,t.z=e.data.z,t.size=e.data.size,t.weight=e.data.weight}}xe.copy=function(){var t,e,r=new ye(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root;if(!n)return r;if(!n.length)return r._root=we(n),r;for(t=[{source:n,target:r._root=new Array(8)}];n=t.pop();)for(var o=0;o<8;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(8)}):n.target[o]=we(e));return r},xe.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t),n=+this._z.call(null,t);return le(this.cover(e,r,n),e,r,n,t)},xe.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e),n=new Float64Array(e),o=new Float64Array(e);let i=1/0,s=1/0,a=1/0,u=-1/0,h=-1/0,d=-1/0;for(let c,l,f,g,p=0;p<e;++p)isNaN(l=+this._x.call(null,c=t[p]))||isNaN(f=+this._y.call(null,c))||isNaN(g=+this._z.call(null,c))||(r[p]=l,n[p]=f,o[p]=g,l<i&&(i=l),l>u&&(u=l),f<s&&(s=f),f>h&&(h=f),g<a&&(a=g),g>d&&(d=g));if(i>u||s>h||a>d)return this;this.cover(i,s,a).cover(u,h,d);for(let i=0;i<e;++i)le(this,r[i],n[i],o[i],t[i]);return this},xe.cover=function(t,e,r){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(r=+r))return this;var n=this._x0,o=this._y0,i=this._z0,s=this._x1,a=this._y1,u=this._z1;if(isNaN(n))s=(n=Math.floor(t))+1,a=(o=Math.floor(e))+1,u=(i=Math.floor(r))+1;else{for(var h,d,c=s-n||1,l=this._root;n>t||t>=s||o>e||e>=a||i>r||r>=u;)switch(d=(r<i)<<2|(e<o)<<1|t<n,(h=new Array(8))[d]=l,l=h,c*=2,d){case 0:s=n+c,a=o+c,u=i+c;break;case 1:n=s-c,a=o+c,u=i+c;break;case 2:s=n+c,o=a-c,u=i+c;break;case 3:n=s-c,o=a-c,u=i+c;break;case 4:s=n+c,a=o+c,i=u-c;break;case 5:n=s-c,a=o+c,i=u-c;break;case 6:s=n+c,o=a-c,i=u-c;break;case 7:n=s-c,o=a-c,i=u-c}this._root&&this._root.length&&(this._root=l)}return this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this},xe.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},xe.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},xe.find=function(t,e,r,n){var o,i,s,a,u,h,d,c,l,f=this._x0,g=this._y0,p=this._z0,v=this._x1,m=this._y1,y=this._z1,w=[],x=this._root;for(x&&w.push(new fe(x,f,g,p,v,m,y)),null==n?n=1/0:(f=t-n,g=e-n,p=r-n,v=t+n,m=e+n,y=r+n,n*=n);c=w.pop();)if(!(!(x=c.node)||(i=c.x0)>v||(s=c.y0)>m||(a=c.z0)>y||(u=c.x1)<f||(h=c.y1)<g||(d=c.z1)<p))if(x.length){var b=(i+u)/2,E=(s+h)/2,N=(a+d)/2;w.push(new fe(x[7],b,E,N,u,h,d),new fe(x[6],i,E,N,b,h,d),new fe(x[5],b,s,N,u,E,d),new fe(x[4],i,s,N,b,E,d),new fe(x[3],b,E,a,u,h,N),new fe(x[2],i,E,a,b,h,N),new fe(x[1],b,s,a,u,E,N),new fe(x[0],i,s,a,b,E,N)),(l=(r>=N)<<2|(e>=E)<<1|t>=b)&&(c=w[w.length-1],w[w.length-1]=w[w.length-1-l],w[w.length-1-l]=c)}else{var M=t-+this._x.call(null,x.data),_=e-+this._y.call(null,x.data),k=r-+this._z.call(null,x.data),A=M*M+_*_+k*k;if(A<n){var j=Math.sqrt(n=A);f=t-j,g=e-j,p=r-j,v=t+j,m=e+j,y=r+j,o=x.data}}return o},xe.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t))||isNaN(a=+this._z.call(null,t)))return this;var e,r,n,o,i,s,a,u,h,d,c,l,f,g,p,v=this._root,m=this._x0,y=this._y0,w=this._z0,x=this._x1,b=this._y1,E=this._z1;if(!v)return this;if(v.length)for(;;){if((c=i>=(u=(m+x)/2))?m=u:x=u,(l=s>=(h=(y+b)/2))?y=h:b=h,(f=a>=(d=(w+E)/2))?w=d:E=d,e=v,!(v=v[g=f<<2|l<<1|c]))return this;if(!v.length)break;(e[g+1&7]||e[g+2&7]||e[g+3&7]||e[g+4&7]||e[g+5&7]||e[g+6&7]||e[g+7&7])&&(r=e,p=g)}for(;v.data!==t;)if(n=v,!(v=v.next))return this;return(o=v.next)&&delete v.next,n?(o?n.next=o:delete n.next,this):e?(o?e[g]=o:delete e[g],(v=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&v===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!v.length&&(r?r[p]=v:this._root=v),this):(this._root=o,this)},xe.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},xe.root=function(){return this._root},xe.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},xe.visit=function(t){var e,r,n,o,i,s,a,u,h=[],d=this._root;for(d&&h.push(new fe(d,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=h.pop();)if(!t(d=e.node,n=e.x0,o=e.y0,i=e.z0,s=e.x1,a=e.y1,u=e.z1)&&d.length){var c=(n+s)/2,l=(o+a)/2,f=(i+u)/2;(r=d[7])&&h.push(new fe(r,c,l,f,s,a,u)),(r=d[6])&&h.push(new fe(r,n,l,f,c,a,u)),(r=d[5])&&h.push(new fe(r,c,o,f,s,l,u)),(r=d[4])&&h.push(new fe(r,n,o,f,c,l,u)),(r=d[3])&&h.push(new fe(r,c,l,i,s,a,f)),(r=d[2])&&h.push(new fe(r,n,l,i,c,a,f)),(r=d[1])&&h.push(new fe(r,c,o,i,s,l,f)),(r=d[0])&&h.push(new fe(r,n,o,i,c,l,f))}return this},xe.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new fe(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.y0,u=e.z0,h=e.x1,d=e.y1,c=e.z1,l=(s+h)/2,f=(a+d)/2,g=(u+c)/2;(i=o[0])&&r.push(new fe(i,s,a,u,l,f,g)),(i=o[1])&&r.push(new fe(i,l,a,u,h,f,g)),(i=o[2])&&r.push(new fe(i,s,f,u,l,d,g)),(i=o[3])&&r.push(new fe(i,l,f,u,h,d,g)),(i=o[4])&&r.push(new fe(i,s,a,g,l,f,c)),(i=o[5])&&r.push(new fe(i,l,a,g,h,f,c)),(i=o[6])&&r.push(new fe(i,s,f,g,l,d,c)),(i=o[7])&&r.push(new fe(i,l,f,g,h,d,c))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},xe.x=function(t){return arguments.length?(this._x=t,this):this._x},xe.y=function(t){return arguments.length?(this._y=t,this):this._y},xe.z=function(t){return arguments.length?(this._z=t,this):this._z};const Ee=(t,e,r,n,o,i,s)=>{var a;if((null===(a=t.data)||void 0===a?void 0:a.id)===i.id)return;const u=[r,n,o][s-1],h=i.x-t.x||.1,d=i.y-t.y||.1,c=i.z-t.z||.1,l=[h,d,c],f=u-e;let g=0;for(let t=0;t<s;t++)g+=l[t]*l[t];const p=Math.sqrt(g)*g;if(f*f*.81<g){const e=t.weight/p;return i.vx+=h*e,i.vy+=d*e,i.vz+=c*e,!0}if(t.length)return!1;if(t.data!==i){const e=t.data.weight/p;i.vx+=h*e,i.vy+=d*e,i.vz+=c*e}},Ne={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"};class Me{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},Ne),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericForceLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){this.genericForceLayout(!0,e,r)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;(this.judgingDistance>this.lastOptions.minMovement||e<1)&&e<t;e++)this.runOneStep(this.lastCalcGraph,this.lastGraph,e,this.lastVelMap,this.lastOptions),this.updatePosition(this.lastGraph,this.lastCalcGraph,this.lastVelMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericForceLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),o=r.getAllNodes(),i=r.getAllEdges(),s=this.formatOptions(t,r),{dimensions:a,width:h,height:d,nodeSize:l,getMass:f,nodeStrength:g,edgeStrength:p,linkDistance:v}=s,m=o.map(((t,e)=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{x:c(t.data.x)?t.data.x:Math.random()*h,y:c(t.data.y)?t.data.y:Math.random()*d,z:c(t.data.z)?t.data.z:Math.random()*Math.sqrt(h*d),size:l(t)||30,mass:f(t),nodeStrength:g(t)})}))),y=i.map((t=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{edgeStrength:p(t),linkDistance:v(t,r.getNode(t.source),r.getNode(t.target))})})));if(!(null==o?void 0:o.length))return this.lastResult={nodes:[],edges:i},{nodes:[],edges:i};const w={};o.forEach(((t,e)=>{w[t.id]={x:0,y:0,z:0}}));const x=new u({nodes:m,edges:y});this.formatCentripetal(s,x);const{maxIteration:b,minMovement:E,onTick:N}=s;if(this.lastLayoutNodes=m,this.lastLayoutEdges=y,this.lastAssign=e,this.lastGraph=r,this.lastCalcGraph=x,this.lastOptions=s,this.lastVelMap=w,"undefined"==typeof window)return;let M=0;return new Promise((t=>{this.timeInterval=window.setInterval((()=>{o&&this.running||t({nodes:Se(r,m),edges:i}),this.runOneStep(x,r,M,w,s),this.updatePosition(r,x,w,s),e&&m.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===a?t.data.z:void 0}))),null==N||N({nodes:Se(r,m),edges:i}),M++,(M>=b||this.judgingDistance<E)&&(window.clearInterval(this.timeInterval),t({nodes:Se(r,m),edges:i}))}),0),this.running=!0}))}))}formatOptions(t,e){const r=Object.assign({},t),{width:n,height:o,getMass:i,nodeSize:s}=t;r.width=n||"undefined"==typeof window?n:window.innerWidth,r.height=o||"undefined"==typeof window?o:window.innerHeight,t.center||(r.center=[r.width/2,r.height/2]),i||(r.getMass=t=>{let r=1;c(null==t?void 0:t.data.mass)&&(r=null==t?void 0:t.data.mass);const n=e.getDegree(t.id,"both");return!n||n<5?r:5*n*r});const a=Gt(0,t.nodeSpacing);let u;u=s?$t(s)?t=>s(t)+a(t):ee(s)?t=>{const e=s;return Math.max(e[0],e[1])+a(t)}:t=>s+a(t):t=>{const{size:e}=(null==t?void 0:t.data)||{};return e?ee(e)?Math.max(e[0],e[1])+a(t):Ut(e)?Math.max(e.width,e.height)+a(t):e+a(t):10+a(t)},r.nodeSize=u;const h=t.linkDistance?Gt(1,t.linkDistance):t=>1+r.nodeSize(e.getNode(t.source))+r.nodeSize(e.getNode(t.target));return r.linkDistance=h,r.nodeStrength=Gt(1,t.nodeStrength),r.edgeStrength=Gt(1,t.edgeStrength),r}formatCentripetal(t,e){const{dimensions:r,centripetalOptions:n,center:o,clusterNodeStrength:i,leafCluster:s,clustering:a,nodeClusterBy:u}=t,h=e.getAllNodes(),d=n||{leaf:2,single:2,others:1,center:t=>({x:o[0],y:o[1],z:3===r?o[2]:void 0})};let c,l;if("function"!=typeof i&&(t.clusterNodeStrength=t=>i),s&&u&&(c=_e(e,u),l=Array.from(new Set(null==h?void 0:h.map((t=>t.data[u]))))||[],t.centripetalOptions=Object.assign(d,{single:100,leaf:e=>{const{siblingLeaves:r,sameTypeLeaves:n}=c[e.id]||{};return(null==n?void 0:n.length)===(null==r?void 0:r.length)||1===(null==l?void 0:l.length)?1:t.clusterNodeStrength(e)},others:1,center:t=>{const r=e.getDegree(t.id,"both");if(!r)return{x:100,y:100,z:0};let n;if(1===r){const{sameTypeLeaves:e=[]}=c[t.id]||{};1===e.length?n=void 0:e.length>1&&(n=je(e))}else n=void 0;return{x:null==n?void 0:n.x,y:null==n?void 0:n.y,z:null==n?void 0:n.z}}})),a&&u){c||(c=_e(e,u)),l||(l=Array.from(new Set(h.map((t=>t.data[u]))))),l=l.filter((t=>void 0!==t));const r={};l.forEach((t=>{const n=h.filter((e=>e.data[u]===t)).map((t=>e.getNode(t.id)));r[t]=je(n)})),t.centripetalOptions=Object.assign(d,{single:e=>t.clusterNodeStrength(e),leaf:e=>t.clusterNodeStrength(e),others:e=>t.clusterNodeStrength(e),center:t=>{const e=r[t.data[u]];return{x:null==e?void 0:e.x,y:null==e?void 0:e.y,z:null==e?void 0:e.z}}})}const{leaf:f,single:g,others:p}=t.centripetalOptions||{};f&&"function"!=typeof f&&(t.centripetalOptions.leaf=()=>f),g&&"function"!=typeof g&&(t.centripetalOptions.single=()=>g),p&&"function"!=typeof p&&(t.centripetalOptions.others=()=>p)}runOneStep(t,e,r,n,o){const i={},s=t.getAllNodes(),a=t.getAllEdges();if(!(null==s?void 0:s.length))return;const{monitor:u}=o;this.calRepulsive(t,i,o),a&&this.calAttractive(t,i,o),this.calGravity(t,e,i,o),this.updateVelocity(t,i,n,o),u&&u({energy:this.calTotalEnergy(i,s),nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:r})}calTotalEnergy(t,e){if(!(null==e?void 0:e.length))return 0;let r=0;return e.forEach(((e,n)=>{const o=t[e.id].x,i=t[e.id].y,s=3===this.options.dimensions?t[e.id].z:0,a=o*o+i*i+s*s,{mass:u=1}=e.data;r+=u*a*.5})),r}calRepulsive(t,e,r){const{dimensions:n,factor:o,coulombDisScale:i}=r;!function(t,e,r,n,o=2){const i=e/r,s=t.getAllNodes(),a=s.map(((t,e)=>{const{nodeStrength:r,x:n,y:o,z:s,size:a}=t.data;return{x:n,y:o,z:s,size:a,index:e,id:t.id,vx:0,vy:0,vz:0,weight:i*r}})),u=(2===o?ue(a,(t=>t.x),(t=>t.y)):me(a,(t=>t.x),(t=>t.y),(t=>t.z))).visitAfter(be),h=new Map;a.forEach((t=>{h.set(t.id,t),function(t,e,r){e.visit(((e,n,o,i,s)=>Ee(e,n,o,i,s,t,r)))}(t,u,o)})),a.map(((t,e)=>{const{id:r,data:o}=s[e],{mass:i=1}=o;n[r]={x:t.vx/i,y:t.vy/i,z:t.vz/i}}))}(t,o,i*i,e,n)}calAttractive(t,e,r){const{dimensions:n,nodeSize:o}=r;t.getAllEdges().forEach(((r,i)=>{const{source:s,target:a}=r,u=t.getNode(s),h=t.getNode(a);if(!u||!h)return;let d=h.data.x-u.data.x,c=h.data.y-u.data.y,l=3===n?h.data.z-u.data.z:0;d||c||(d=.01*Math.random(),c=.01*Math.random(),3!==n||l||(l=.01*Math.random()));const f=Math.sqrt(d*d+c*c+l*l);if(f<o(u)+o(h))return;const g=d/f,p=c/f,v=l/f,{linkDistance:m=200,edgeStrength:y=200}=r.data||{},w=(m-f)*y,x=1/(u.data.mass||1),b=1/(h.data.mass||1),E=g*w,N=p*w,M=v*w;e[s].x-=E*x,e[s].y-=N*x,e[s].z-=M*x,e[a].x+=E*b,e[a].y+=N*b,e[a].z+=M*b}))}calGravity(t,e,r,n){const{getCenter:o}=n,i=t.getAllNodes(),s=e.getAllNodes(),a=e.getAllEdges(),{width:u,height:h,center:d,gravity:l,centripetalOptions:f}=n;i&&i.forEach((n=>{const{id:i,data:g}=n,{mass:p,x:v,y:m,z:y}=g,w=e.getNode(i);let x=0,b=0,E=0,N=l;const M=t.getDegree(i,"in"),_=t.getDegree(i,"out"),k=t.getDegree(i,"both"),A=null==o?void 0:o(w,k);if(A){const[t,e,r]=A;x=v-t,b=m-e,N=r}else x=v-d[0],b=m-d[1],E=y-d[2];if(N&&(r[i].x-=N*x/p,r[i].y-=N*b/p,r[i].z-=N*E/p),f){const{leaf:t,single:e,others:n,center:o}=f,{x:d,y:l,z:g,centerStrength:x}=(null==o?void 0:o(w,s,a,u,h))||{x:0,y:0,z:0,centerStrength:0};if(!c(d)||!c(l))return;const b=(v-d)/p,E=(m-l)/p,N=(y-g)/p;if(x&&(r[i].x-=x*b,r[i].y-=x*E,r[i].z-=x*N),0===k){const t=e(w);if(!t)return;return r[i].x-=t*b,r[i].y-=t*E,void(r[i].z-=t*N)}if(0===M||0===_){const e=t(w,s,a);if(!e)return;return r[i].x-=e*b,r[i].y-=e*E,void(r[i].z-=e*N)}const A=n(w);if(!A)return;r[i].x-=A*b,r[i].y-=A*E,r[i].z-=A*N}}))}updateVelocity(t,e,r,n){const{damping:o,maxSpeed:i,interval:s,dimensions:a}=n,u=t.getAllNodes();(null==u?void 0:u.length)&&u.forEach((t=>{const{id:n}=t;let u=(r[n].x+e[n].x*s)*o||.01,h=(r[n].y+e[n].y*s)*o||.01,d=3===a?(r[n].z+e[n].z*s)*o||.01:0;const c=Math.sqrt(u*u+h*h+d*d);if(c>i){const t=i/c;u*=t,h*=t,d*=t}r[n]={x:u,y:h,z:d}}))}updatePosition(t,e,r,n){const{distanceThresholdMode:o,interval:i,dimensions:s}=n,a=e.getAllNodes();if(!(null==a?void 0:a.length))return void(this.judgingDistance=0);let u=0;"max"===o?this.judgingDistance=-1/0:"min"===o&&(this.judgingDistance=1/0),a.forEach((n=>{const{id:a}=n,h=t.getNode(a);if(c(h.data.fx)&&c(h.data.fy))return void e.mergeNodeData(a,{x:h.data.fx,y:h.data.fy,z:3===s?h.data.fz:void 0});const d=r[a].x*i,l=r[a].y*i,f=3===s?r[a].z*i:0;e.mergeNodeData(a,{x:n.data.x+d,y:n.data.y+l,z:n.data.z+f});const g=Math.sqrt(d*d+l*l+f*f);switch(o){case"max":this.judgingDistance<g&&(this.judgingDistance=g);break;case"min":this.judgingDistance>g&&(this.judgingDistance=g);break;default:u+=g}})),o&&"mean"!==o||(this.judgingDistance=u/a.length)}}const _e=(t,e)=>{const r=t.getAllNodes();if(!(null==r?void 0:r.length))return{};const n={};return r.forEach(((r,o)=>{1===t.getDegree(r.id,"both")&&(n[r.id]=ke(t,"leaf",r,e))})),n},ke=(t,e,r,n)=>{const o=t.getDegree(r.id,"in"),i=t.getDegree(r.id,"out");let s=r,a=[];return 0===o?(s=t.getSuccessors(r.id)[0],a=t.getNeighbors(s.id)):0===i&&(s=t.getPredecessors(r.id)[0],a=t.getNeighbors(s.id)),a=a.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out"))),{coreNode:s,siblingLeaves:a,sameTypeLeaves:Ae(t,e,n,r,a)}},Ae=(t,e,r,n,o)=>{const i=n.data[r]||"";let s=(null==o?void 0:o.filter((t=>t.data[r]===i)))||[];return"leaf"===e&&(s=s.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out")))),s},je=t=>{const e={x:0,y:0};t.forEach((t=>{const{x:r,y:n}=t.data;e.x+=r||0,e.y+=n||0}));const r=t.length||1;return{x:e.x/r,y:e.y/r}},Se=(t,e)=>e.map((e=>{const{id:r,data:n}=e,o=t.getNode(r);return Object.assign(Object.assign({},o),{data:Object.assign(Object.assign({},o.data),{x:n.x,y:n.y,z:n.z})})}));var Oe=r(8917);Oe.y3,Oe.jy,Oe.oN,Oe.Hc,Oe.cg,Oe.hj,Oe.LU,Oe.Tb;const ze=Oe.uq,Re=(Oe.Zm,Oe.Dq,Oe.__,Oe.q0,Oe.lh,Oe.pI,Oe.zC,Oe.zg,Oe.g6,Oe.OL,Oe.ks,Oe.QR,Oe.jp,Oe.mk,Oe.W2),Ie=(Oe.l,Oe.KY,Oe.dv,Oe.BR,Oe.Wu,Oe.uq,Oe.uq,Oe.a4,Oe.DI,Oe.Jo,Oe.Zi,Oe.kH,Oe.LV,t=>{const e=[],r=t.length;for(let n=0;n<r;n+=1){e[n]=[];for(let o=0;o<r;o+=1)n===o?e[n][o]=0:0!==t[n][o]&&t[n][o]?e[n][o]=t[n][o]:e[n][o]=1/0}for(let t=0;t<r;t+=1)for(let n=0;n<r;n+=1)for(let o=0;o<r;o+=1)e[n][o]>e[n][t]+e[t][o]&&(e[n][o]=e[n][t]+e[t][o]);return e}),Ce=(t,e)=>{const{nodes:r,edges:n}=t,o=[],i={};if(!r)throw new Error("invalid nodes data!");return r&&r.forEach(((t,e)=>{i[t.id]=e,o.push([])})),null==n||n.forEach((t=>{const{source:r,target:n}=t,s=i[r],a=i[n];void 0!==s&&void 0!==a&&(o[s][a]=1,e||(o[a][s]=1))})),o},De=(t,e)=>Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)),Pe=(t,e,r,n="TB",o,i={})=>{if(!(null==e?void 0:e.length))return;const{stopBranchFn:s,stopAllFn:a}=i;for(let u=0;u<e.length;u++){const h=e[u];if(t.hasNode(h.id)&&!(null==s?void 0:s(h))){if(null==a?void 0:a(h))return;"TB"===n&&r(h),Pe(t,t.getChildren(h.id,o),r,n,o,i),"TB"!==n&&r(h)}}},Te={center:[0,0],linkDistance:50};class Le{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},Te),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericMDSLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){this.genericMDSLayout(!0,e,r)}))}genericMDSLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{center:o=[0,0],linkDistance:i=50}=t,s=r.getAllNodes(),a=r.getAllEdges();if(!(null==s?void 0:s.length)||1===s.length)return Qt(r,e,o);const u=Ce({nodes:s,edges:a},!1),h=Ie(u);Fe(h);const d=((t,e)=>{const r=[];return t.forEach((t=>{const n=[];t.forEach((t=>{n.push(t*e)})),r.push(n)})),r})(h,i),c=qe(d),l=[];return c.forEach(((t,e)=>{const r=Kt(s[e]);r.data.x=t[0]+o[0],r.data.y=t[1]+o[1],l.push(r)})),e&&l.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:l,edges:a}}))}}const Fe=t=>{let e=-999999;t.forEach((t=>{t.forEach((t=>{t!==1/0&&e<t&&(e=t)}))})),t.forEach(((r,n)=>{r.forEach(((r,o)=>{r===1/0&&(t[n][o]=e)}))}))},qe=t=>{const e=ze.mul(ze.pow(t,2),-.5),r=e.mean("row"),n=e.mean("column"),o=e.mean();e.add(o).subRowVector(r).subColumnVector(n);const i=new Re(e),s=ze.sqrt(i.diagonalMatrix).diagonal();return i.leftSingularVectors.toJSON().map((t=>ze.mul([t],[s]).toJSON()[0].splice(0,2)))},Ve={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},Be={center:[0,0],comboPadding:10,treeKey:"combo"},$e=function(t){if(!function(t){return"object"==typeof t&&null!==t}(t)||!d(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};function Ue(t,e){if(Object.hasOwn)return Object.hasOwn(t,e);if(null==t)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(t),e)}function Ge(t,e,r,n){for(var o in r=r||0,n=n||5,e)if(Ue(e,o)){var i=e[o];null!==i&&$e(i)?($e(t[o])||(t[o]={}),r<n?Ge(t[o],i,r+1,n):t[o]=e[o]):T(i)?(t[o]=[],t[o]=t[o].concat(i)):void 0!==i&&(t[o]=i)}}const We=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var n=0;n<e.length;n+=1)Ge(t,e[n]);return t};var Ye=Object.prototype.hasOwnProperty;const He=function(t,e){if(null===t||!$e(t))return{};var r={};return function(t,e){if(t)if(T(t))for(var r=0,n=t.length;r<n&&!1!==e(t[r],r);r++);else if(Ut(t))for(var o in t)if(t.hasOwnProperty(o)&&!1===e(t[o],o))break}(e,(function(e){Ye.call(t,e)&&(r[e]=t[e])})),r};function Ke(t){return function(){return t}}function Je(t){return 1e-6*(t()-.5)}function Qe(t){return t.index}function Xe(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function Ze(t){var e,r,n,o,i,s,a=Qe,u=function(t){return 1/Math.min(o[t.source.index],o[t.target.index])},h=Ke(30),d=1;function c(n){for(var o=0,a=t.length;o<d;++o)for(var u,h,c,l,f,g,p,v=0;v<a;++v)h=(u=t[v]).source,l=(c=u.target).x+c.vx-h.x-h.vx||Je(s),f=c.y+c.vy-h.y-h.vy||Je(s),l*=g=((g=Math.sqrt(l*l+f*f))-r[v])/g*n*e[v],f*=g,c.vx-=l*(p=i[v]),c.vy-=f*p,h.vx+=l*(p=1-p),h.vy+=f*p}function l(){if(n){var s,u,h=n.length,d=t.length,c=new Map(n.map(((t,e)=>[a(t,e,n),t])));for(s=0,o=new Array(h);s<d;++s)(u=t[s]).index=s,"object"!=typeof u.source&&(u.source=Xe(c,u.source)),"object"!=typeof u.target&&(u.target=Xe(c,u.target)),o[u.source.index]=(o[u.source.index]||0)+1,o[u.target.index]=(o[u.target.index]||0)+1;for(s=0,i=new Array(d);s<d;++s)u=t[s],i[s]=o[u.source.index]/(o[u.source.index]+o[u.target.index]);e=new Array(d),f(),r=new Array(d),g()}}function f(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+u(t[r],r,t)}function g(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+h(t[e],e,t)}return null==t&&(t=[]),c.initialize=function(t,e){n=t,s=e,l()},c.links=function(e){return arguments.length?(t=e,l(),c):t},c.id=function(t){return arguments.length?(a=t,c):a},c.iterations=function(t){return arguments.length?(d=+t,c):d},c.strength=function(t){return arguments.length?(u="function"==typeof t?t:Ke(+t),f(),c):u},c.distance=function(t){return arguments.length?(h="function"==typeof t?t:Ke(+t),g(),c):h},c}var tr={value:()=>{}};function er(){for(var t,e=0,r=arguments.length,n={};e<r;++e){if(!(t=arguments[e]+"")||t in n||/[\\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new rr(n)}function rr(t){this._=t}function nr(t,e){for(var r,n=0,o=t.length;n<o;++n)if((r=t[n]).name===e)return r.value}function or(t,e,r){for(var n=0,o=t.length;n<o;++n)if(t[n].name===e){t[n]=tr,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}rr.prototype=er.prototype={constructor:rr,on:function(t,e){var r,n,o=this._,i=(n=o,(t+"").trim().split(/^|\\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),s=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++s<a;)if(r=(t=i[s]).type)o[r]=or(o[r],t.name,e);else if(null==e)for(r in o)o[r]=or(o[r],t.name,null);return this}for(;++s<a;)if((r=(t=i[s]).type)&&(r=nr(o[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new rr(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,o=new Array(r),i=0;i<r;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,r=(n=this._[t]).length;i<r;++i)n[i].value.apply(e,o)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],o=0,i=n.length;o<i;++o)n[o].value.apply(e,r)}};const ir=er;var sr,ar,ur=0,hr=0,dr=0,cr=1e3,lr=0,fr=0,gr=0,pr="object"==typeof performance&&performance.now?performance:Date,vr="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function mr(){return fr||(vr(yr),fr=pr.now()+gr)}function yr(){fr=0}function wr(){this._call=this._time=this._next=null}function xr(t,e,r){var n=new wr;return n.restart(t,e,r),n}function br(){fr=(lr=pr.now())+gr,ur=hr=0;try{!function(){mr(),++ur;for(var t,e=sr;e;)(t=fr-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ur}()}finally{ur=0,function(){for(var t,e,r=sr,n=1/0;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:sr=e);ar=t,Nr(n)}(),fr=0}}function Er(){var t=pr.now(),e=t-lr;e>cr&&(gr-=e,lr=t)}function Nr(t){ur||(hr&&(hr=clearTimeout(hr)),t-fr>24?(t<1/0&&(hr=setTimeout(br,t-pr.now()-gr)),dr&&(dr=clearInterval(dr))):(dr||(lr=pr.now(),dr=setInterval(Er,cr)),ur=1,vr(br)))}wr.prototype=xr.prototype={constructor:wr,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?mr():+r)+(null==e?0:+e),this._next||ar===this||(ar?ar._next=this:sr=this,ar=this),this._call=t,this._time=r,Nr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Nr())}};const Mr=4294967296;function _r(t){return t.x}function kr(t){return t.y}var Ar=Math.PI*(3-Math.sqrt(5));function jr(){var t,e,r,n,o,i=Ke(-30),s=1,a=1/0,u=.81;function h(r){var o,i=t.length,s=ue(t,_r,kr).visitAfter(c);for(n=r,o=0;o<i;++o)e=t[o],s.visit(l)}function d(){if(t){var e,r,n=t.length;for(o=new Array(n),e=0;e<n;++e)r=t[e],o[r.index]=+i(r,e,t)}}function c(t){var e,r,n,i,s,a=0,u=0;if(t.length){for(n=i=s=0;s<4;++s)(e=t[s])&&(r=Math.abs(e.value))&&(a+=e.value,u+=r,n+=r*e.x,i+=r*e.y);t.x=n/u,t.y=i/u}else{(e=t).x=e.data.x,e.y=e.data.y;do{a+=o[e.data.index]}while(e=e.next)}t.value=a}function l(t,i,h,d){if(!t.value)return!0;var c=t.x-e.x,l=t.y-e.y,f=d-i,g=c*c+l*l;if(f*f/u<g)return g<a&&(0===c&&(g+=(c=Je(r))*c),0===l&&(g+=(l=Je(r))*l),g<s&&(g=Math.sqrt(s*g)),e.vx+=c*t.value*n/g,e.vy+=l*t.value*n/g),!0;if(!(t.length||g>=a)){(t.data!==e||t.next)&&(0===c&&(g+=(c=Je(r))*c),0===l&&(g+=(l=Je(r))*l),g<s&&(g=Math.sqrt(s*g)));do{t.data!==e&&(f=o[t.data.index]*n/g,e.vx+=c*f,e.vy+=l*f)}while(t=t.next)}}return h.initialize=function(e,n){t=e,r=n,d()},h.strength=function(t){return arguments.length?(i="function"==typeof t?t:Ke(+t),d(),h):i},h.distanceMin=function(t){return arguments.length?(s=t*t,h):Math.sqrt(s)},h.distanceMax=function(t){return arguments.length?(a=t*t,h):Math.sqrt(a)},h.theta=function(t){return arguments.length?(u=t*t,h):Math.sqrt(u)},h}function Sr(t,e){var r,n=1;function o(){var o,i,s=r.length,a=0,u=0;for(o=0;o<s;++o)a+=(i=r[o]).x,u+=i.y;for(a=(a/s-t)*n,u=(u/s-e)*n,o=0;o<s;++o)(i=r[o]).x-=a,i.y-=u}return null==t&&(t=0),null==e&&(e=0),o.initialize=function(t){r=t},o.x=function(e){return arguments.length?(t=+e,o):t},o.y=function(t){return arguments.length?(e=+t,o):e},o.strength=function(t){return arguments.length?(n=+t,o):n},o}function Or(t){return t.x+t.vx}function zr(t){return t.y+t.vy}function Rr(t){var e,r,n,o=1,i=1;function s(){for(var t,s,u,h,d,c,l,f=e.length,g=0;g<i;++g)for(s=ue(e,Or,zr).visitAfter(a),t=0;t<f;++t)u=e[t],c=r[u.index],l=c*c,h=u.x+u.vx,d=u.y+u.vy,s.visit(p);function p(t,e,r,i,s){var a=t.data,f=t.r,g=c+f;if(!a)return e>h+g||i<h-g||r>d+g||s<d-g;if(a.index>u.index){var p=h-a.x-a.vx,v=d-a.y-a.vy,m=p*p+v*v;m<g*g&&(0===p&&(m+=(p=Je(n))*p),0===v&&(m+=(v=Je(n))*v),m=(g-(m=Math.sqrt(m)))/m*o,u.vx+=(p*=m)*(g=(f*=f)/(l+f)),u.vy+=(v*=m)*g,a.vx-=p*(g=1-g),a.vy-=v*g)}}}function a(t){if(t.data)return t.r=r[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function u(){if(e){var n,o,i=e.length;for(r=new Array(i),n=0;n<i;++n)o=e[n],r[o.index]=+t(o,n,e)}}return"function"!=typeof t&&(t=Ke(null==t?1:+t)),s.initialize=function(t,r){e=t,n=r,u()},s.iterations=function(t){return arguments.length?(i=+t,s):i},s.strength=function(t){return arguments.length?(o=+t,s):o},s.radius=function(e){return arguments.length?(t="function"==typeof e?e:Ke(+e),u(),s):t},s}function Ir(t,e,r){var n,o,i,s=Ke(.1);function a(t){for(var s=0,a=n.length;s<a;++s){var u=n[s],h=u.x-e||1e-6,d=u.y-r||1e-6,c=Math.sqrt(h*h+d*d),l=(i[s]-c)*o[s]*t/c;u.vx+=h*l,u.vy+=d*l}}function u(){if(n){var e,r=n.length;for(o=new Array(r),i=new Array(r),e=0;e<r;++e)i[e]=+t(n[e],e,n),o[e]=isNaN(i[e])?0:+s(n[e],e,n)}}return"function"!=typeof t&&(t=Ke(+t)),null==e&&(e=0),null==r&&(r=0),a.initialize=function(t){n=t,u()},a.strength=function(t){return arguments.length?(s="function"==typeof t?t:Ke(+t),u(),a):s},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:Ke(+e),u(),a):t},a.x=function(t){return arguments.length?(e=+t,a):e},a.y=function(t){return arguments.length?(r=+t,a):r},a}function Cr(t){var e,r,n,o=Ke(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Ke(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Ke(+t),s(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:Ke(+e),s(),i):t},i}function Dr(t){var e,r,n,o=Ke(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Ke(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Ke(+t),s(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:Ke(+e),s(),i):t},i}class Pr{constructor(t){this.id="d3-force",this.config={inputNodeAttrs:["x","y","vx","vy","fx","fy"],outputNodeAttrs:["x","y","vx","vy"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource"]},this.forceMap={link:Ze,manyBody:jr,center:Sr,collide:Rr,radial:Ir,x:Cr,y:Dr},this.options={link:{id:t=>t.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},We(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericLayout(!0,e,r)}))}stop(){this.simulation.stop()}tick(t){return this.simulation.tick(t),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(t,e){const r=this.context.nodes.find((e=>e.id===t));r&&e.forEach(((t,e)=>{"number"!=typeof t&&null!==t||(r[["fx","fy","fz"][e]]=t)}))}getOptions(t){var e,r;const n=We({},this.options,t);return n.collide&&void 0===(null===(e=n.collide)||void 0===e?void 0:e.radius)&&(n.collide=n.collide||{},n.collide.radius=null!==(r=n.nodeSize)&&void 0!==r?r:10),void 0===n.iterations&&(n.link&&void 0===n.link.iterations&&(n.iterations=n.link.iterations),n.collide&&void 0===n.collide.iterations&&(n.iterations=n.collide.iterations)),this.context.options=n,n}genericLayout(e,r,n){var o;return t(this,void 0,void 0,(function*(){const t=this.getOptions(n),i=r.getAllNodes().map((({id:t,data:e})=>Object.assign({id:t,data:e},He(e,this.config.inputNodeAttrs)))),s=r.getAllEdges().map((t=>Object.assign({},t)));Object.assign(this.context,{assign:e,nodes:i,edges:s,graph:r});const a=new Promise((t=>{this.resolver=t})),u=this.setSimulation(t);return u.nodes(i),null===(o=u.force("link"))||void 0===o||o.links(s),a}))}getResult(){const{assign:t,nodes:e,edges:r,graph:n}=this.context,o=e.map((t=>({id:t.id,data:Object.assign(Object.assign({},t.data),He(t,this.config.outputNodeAttrs))}))),i=r.map((({id:t,source:e,target:r,data:n})=>({id:t,source:"object"==typeof e?e.id:e,target:"object"==typeof r?r.id:r,data:n})));return t&&o.forEach((t=>n.mergeNodeData(t.id,t.data))),{nodes:o,edges:i}}initSimulation(){return function(t){var e,r=1,n=.001,o=1-Math.pow(n,1/300),i=0,s=.6,a=new Map,u=xr(c),h=ir("tick","end"),d=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Mr)/Mr}();function c(){l(),h.call("tick",e),r<n&&(u.stop(),h.call("end",e))}function l(n){var u,h,d=t.length;void 0===n&&(n=1);for(var c=0;c<n;++c)for(r+=(i-r)*o,a.forEach((function(t){t(r)})),u=0;u<d;++u)null==(h=t[u]).fx?h.x+=h.vx*=s:(h.x=h.fx,h.vx=0),null==h.fy?h.y+=h.vy*=s:(h.y=h.fy,h.vy=0);return e}function f(){for(var e,r=0,n=t.length;r<n;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var o=10*Math.sqrt(.5+r),i=r*Ar;e.x=o*Math.cos(i),e.y=o*Math.sin(i)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function g(e){return e.initialize&&e.initialize(t,d),e}return null==t&&(t=[]),f(),e={tick:l,restart:function(){return u.restart(c),e},stop:function(){return u.stop(),e},nodes:function(r){return arguments.length?(t=r,f(),a.forEach(g),e):t},alpha:function(t){return arguments.length?(r=+t,e):r},alphaMin:function(t){return arguments.length?(n=+t,e):n},alphaDecay:function(t){return arguments.length?(o=+t,e):+o},alphaTarget:function(t){return arguments.length?(i=+t,e):i},velocityDecay:function(t){return arguments.length?(s=1-t,e):1-s},randomSource:function(t){return arguments.length?(d=t,a.forEach(g),e):d},force:function(t,r){return arguments.length>1?(null==r?a.delete(t):a.set(t,g(r)),e):a.get(t)},find:function(e,r,n){var o,i,s,a,u,h=0,d=t.length;for(null==n?n=1/0:n*=n,h=0;h<d;++h)(s=(o=e-(a=t[h]).x)*o+(i=r-a.y)*i)<n&&(u=a,n=s);return u},on:function(t,r){return arguments.length>1?(h.on(t,r),e):h.on(t)}}}()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",(()=>{var e;return null===(e=t.onTick)||void 0===e?void 0:e.call(t,this.getResult())})).on("end",(()=>{var t;return null===(t=this.resolver)||void 0===t?void 0:t.call(this,this.getResult())}))),Tr(e,this.config.simulationAttrs.map((e=>[e,t[e]]))),Object.entries(this.forceMap).forEach((([r,n])=>{const o=r;if(t[r]){let r=e.force(o);r||(r=n(),e.force(o,r)),Tr(r,Object.entries(t[o]))}else e.force(o,null)})),e}}const Tr=(t,e)=>e.reduce(((e,[r,n])=>e[r]&&void 0!==n?e[r].call(t,n):e),t);function Lr(t){return function(){return t}}function Fr(t){return 1e-6*(t()-.5)}function qr(t){return t.index}function Vr(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function Br(t){var e,r,n,o,i,s,a,u=qr,h=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},d=Lr(30),c=1;function l(n){for(var i=0,u=t.length;i<c;++i)for(var h,d,l,f,g,p=0,v=0,m=0,y=0;p<u;++p)d=(h=t[p]).source,v=(l=h.target).x+l.vx-d.x-d.vx||Fr(a),o>1&&(m=l.y+l.vy-d.y-d.vy||Fr(a)),o>2&&(y=l.z+l.vz-d.z-d.vz||Fr(a)),v*=f=((f=Math.sqrt(v*v+m*m+y*y))-r[p])/f*n*e[p],m*=f,y*=f,l.vx-=v*(g=s[p]),o>1&&(l.vy-=m*g),o>2&&(l.vz-=y*g),d.vx+=v*(g=1-g),o>1&&(d.vy+=m*g),o>2&&(d.vz+=y*g)}function f(){if(n){var o,a,h=n.length,d=t.length,c=new Map(n.map(((t,e)=>[u(t,e,n),t])));for(o=0,i=new Array(h);o<d;++o)(a=t[o]).index=o,"object"!=typeof a.source&&(a.source=Vr(c,a.source)),"object"!=typeof a.target&&(a.target=Vr(c,a.target)),i[a.source.index]=(i[a.source.index]||0)+1,i[a.target.index]=(i[a.target.index]||0)+1;for(o=0,s=new Array(d);o<d;++o)a=t[o],s[o]=i[a.source.index]/(i[a.source.index]+i[a.target.index]);e=new Array(d),g(),r=new Array(d),p()}}function g(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+h(t[r],r,t)}function p(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+d(t[e],e,t)}return null==t&&(t=[]),l.initialize=function(t,...e){n=t,a=e.find((t=>"function"==typeof t))||Math.random,o=e.find((t=>[1,2,3].includes(t)))||2,f()},l.links=function(e){return arguments.length?(t=e,f(),l):t},l.id=function(t){return arguments.length?(u=t,l):u},l.iterations=function(t){return arguments.length?(c=+t,l):c},l.strength=function(t){return arguments.length?(h="function"==typeof t?t:Lr(+t),g(),l):h},l.distance=function(t){return arguments.length?(d="function"==typeof t?t:Lr(+t),p(),l):d},l}function $r(t,e,r){if(isNaN(e))return t;var n,o,i,s,a,u,h=t._root,d={data:r},c=t._x0,l=t._x1;if(!h)return t._root=d,t;for(;h.length;)if((s=e>=(o=(c+l)/2))?c=o:l=o,n=h,!(h=h[a=+s]))return n[a]=d,t;if(e===(i=+t._x.call(null,h.data)))return d.next=h,n?n[a]=d:t._root=d,t;do{n=n?n[a]=new Array(2):t._root=new Array(2),(s=e>=(o=(c+l)/2))?c=o:l=o}while((a=+s)==(u=+(i>=o)));return n[u]=h,n[a]=d,t}function Ur(t,e,r){this.node=t,this.x0=e,this.x1=r}function Gr(t){return t[0]}function Wr(t,e){var r=new Yr(null==e?Gr:e,NaN,NaN);return null==t?r:r.addAll(t)}function Yr(t,e,r){this._x=t,this._x0=e,this._x1=r,this._root=void 0}function Hr(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var Kr=Wr.prototype=Yr.prototype;Kr.copy=function(){var t,e,r=new Yr(this._x,this._x0,this._x1),n=this._root;if(!n)return r;if(!n.length)return r._root=Hr(n),r;for(t=[{source:n,target:r._root=new Array(2)}];n=t.pop();)for(var o=0;o<2;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(2)}):n.target[o]=Hr(e));return r},Kr.add=function(t){const e=+this._x.call(null,t);return $r(this.cover(e),e,t)},Kr.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e);let n=1/0,o=-1/0;for(let i,s=0;s<e;++s)isNaN(i=+this._x.call(null,t[s]))||(r[s]=i,i<n&&(n=i),i>o&&(o=i));if(n>o)return this;this.cover(n).cover(o);for(let n=0;n<e;++n)$r(this,r[n],t[n]);return this},Kr.cover=function(t){if(isNaN(t=+t))return this;var e=this._x0,r=this._x1;if(isNaN(e))r=(e=Math.floor(t))+1;else{for(var n,o,i=r-e||1,s=this._root;e>t||t>=r;)switch(o=+(t<e),(n=new Array(2))[o]=s,s=n,i*=2,o){case 0:r=e+i;break;case 1:e=r-i}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._x1=r,this},Kr.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},Kr.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},Kr.find=function(t,e){var r,n,o,i,s,a=this._x0,u=this._x1,h=[],d=this._root;for(d&&h.push(new Ur(d,a,u)),null==e?e=1/0:(a=t-e,u=t+e);i=h.pop();)if(!(!(d=i.node)||(n=i.x0)>u||(o=i.x1)<a))if(d.length){var c=(n+o)/2;h.push(new Ur(d[1],c,o),new Ur(d[0],n,c)),(s=+(t>=c))&&(i=h[h.length-1],h[h.length-1]=h[h.length-1-s],h[h.length-1-s]=i)}else{var l=Math.abs(t-+this._x.call(null,d.data));l<e&&(e=l,a=t-l,u=t+l,r=d.data)}return r},Kr.remove=function(t){if(isNaN(i=+this._x.call(null,t)))return this;var e,r,n,o,i,s,a,u,h,d=this._root,c=this._x0,l=this._x1;if(!d)return this;if(d.length)for(;;){if((a=i>=(s=(c+l)/2))?c=s:l=s,e=d,!(d=d[u=+a]))return this;if(!d.length)break;e[u+1&1]&&(r=e,h=u)}for(;d.data!==t;)if(n=d,!(d=d.next))return this;return(o=d.next)&&delete d.next,n?(o?n.next=o:delete n.next,this):e?(o?e[u]=o:delete e[u],(d=e[0]||e[1])&&d===(e[1]||e[0])&&!d.length&&(r?r[h]=d:this._root=d),this):(this._root=o,this)},Kr.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},Kr.root=function(){return this._root},Kr.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},Kr.visit=function(t){var e,r,n,o,i=[],s=this._root;for(s&&i.push(new Ur(s,this._x0,this._x1));e=i.pop();)if(!t(s=e.node,n=e.x0,o=e.x1)&&s.length){var a=(n+o)/2;(r=s[1])&&i.push(new Ur(r,a,o)),(r=s[0])&&i.push(new Ur(r,n,a))}return this},Kr.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new Ur(this._root,this._x0,this._x1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.x1,u=(s+a)/2;(i=o[0])&&r.push(new Ur(i,s,u)),(i=o[1])&&r.push(new Ur(i,u,a))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.x1);return this},Kr.x=function(t){return arguments.length?(this._x=t,this):this._x};const Jr=4294967296;function Qr(t){return t.x}function Xr(t){return t.y}function Zr(t){return t.z}var tn=Math.PI*(3-Math.sqrt(5)),en=20*Math.PI/(9+Math.sqrt(221));function rn(){var t,e,r,n,o,i,s=Lr(-30),a=1,u=1/0,h=.81;function d(n){var i,s=t.length,a=(1===e?Wr(t,Qr):2===e?ue(t,Qr,Xr):3===e?me(t,Qr,Xr,Zr):null).visitAfter(l);for(o=n,i=0;i<s;++i)r=t[i],a.visit(f)}function c(){if(t){var e,r,n=t.length;for(i=new Array(n),e=0;e<n;++e)r=t[e],i[r.index]=+s(r,e,t)}}function l(t){var r,n,o,s,a,u,h=0,d=0,c=t.length;if(c){for(o=s=a=u=0;u<c;++u)(r=t[u])&&(n=Math.abs(r.value))&&(h+=r.value,d+=n,o+=n*(r.x||0),s+=n*(r.y||0),a+=n*(r.z||0));h*=Math.sqrt(4/c),t.x=o/d,e>1&&(t.y=s/d),e>2&&(t.z=a/d)}else{(r=t).x=r.data.x,e>1&&(r.y=r.data.y),e>2&&(r.z=r.data.z);do{h+=i[r.data.index]}while(r=r.next)}t.value=h}function f(t,s,d,c,l){if(!t.value)return!0;var f=[d,c,l][e-1],g=t.x-r.x,p=e>1?t.y-r.y:0,v=e>2?t.z-r.z:0,m=f-s,y=g*g+p*p+v*v;if(m*m/h<y)return y<u&&(0===g&&(y+=(g=Fr(n))*g),e>1&&0===p&&(y+=(p=Fr(n))*p),e>2&&0===v&&(y+=(v=Fr(n))*v),y<a&&(y=Math.sqrt(a*y)),r.vx+=g*t.value*o/y,e>1&&(r.vy+=p*t.value*o/y),e>2&&(r.vz+=v*t.value*o/y)),!0;if(!(t.length||y>=u)){(t.data!==r||t.next)&&(0===g&&(y+=(g=Fr(n))*g),e>1&&0===p&&(y+=(p=Fr(n))*p),e>2&&0===v&&(y+=(v=Fr(n))*v),y<a&&(y=Math.sqrt(a*y)));do{t.data!==r&&(m=i[t.data.index]*o/y,r.vx+=g*m,e>1&&(r.vy+=p*m),e>2&&(r.vz+=v*m))}while(t=t.next)}}return d.initialize=function(r,...o){t=r,n=o.find((t=>"function"==typeof t))||Math.random,e=o.find((t=>[1,2,3].includes(t)))||2,c()},d.strength=function(t){return arguments.length?(s="function"==typeof t?t:Lr(+t),c(),d):s},d.distanceMin=function(t){return arguments.length?(a=t*t,d):Math.sqrt(a)},d.distanceMax=function(t){return arguments.length?(u=t*t,d):Math.sqrt(u)},d.theta=function(t){return arguments.length?(h=t*t,d):Math.sqrt(h)},d}function nn(t,e,r){var n,o=1;function i(){var i,s,a=n.length,u=0,h=0,d=0;for(i=0;i<a;++i)u+=(s=n[i]).x||0,h+=s.y||0,d+=s.z||0;for(u=(u/a-t)*o,h=(h/a-e)*o,d=(d/a-r)*o,i=0;i<a;++i)s=n[i],u&&(s.x-=u),h&&(s.y-=h),d&&(s.z-=d)}return null==t&&(t=0),null==e&&(e=0),null==r&&(r=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.z=function(t){return arguments.length?(r=+t,i):r},i.strength=function(t){return arguments.length?(o=+t,i):o},i}function on(t){return t.x+t.vx}function sn(t){return t.y+t.vy}function an(t){return t.z+t.vz}function un(t){var e,r,n,o,i=1,s=1;function a(){for(var t,a,h,d,c,l,f,g,p=e.length,v=0;v<s;++v)for(a=(1===r?Wr(e,on):2===r?ue(e,on,sn):3===r?me(e,on,sn,an):null).visitAfter(u),t=0;t<p;++t)h=e[t],f=n[h.index],g=f*f,d=h.x+h.vx,r>1&&(c=h.y+h.vy),r>2&&(l=h.z+h.vz),a.visit(m);function m(t,e,n,s,a,u,p){var v=[e,n,s,a,u,p],m=v[0],y=v[1],w=v[2],x=v[r],b=v[r+1],E=v[r+2],N=t.data,M=t.r,_=f+M;if(!N)return m>d+_||x<d-_||r>1&&(y>c+_||b<c-_)||r>2&&(w>l+_||E<l-_);if(N.index>h.index){var k=d-N.x-N.vx,A=r>1?c-N.y-N.vy:0,j=r>2?l-N.z-N.vz:0,S=k*k+A*A+j*j;S<_*_&&(0===k&&(S+=(k=Fr(o))*k),r>1&&0===A&&(S+=(A=Fr(o))*A),r>2&&0===j&&(S+=(j=Fr(o))*j),S=(_-(S=Math.sqrt(S)))/S*i,h.vx+=(k*=S)*(_=(M*=M)/(g+M)),r>1&&(h.vy+=(A*=S)*_),r>2&&(h.vz+=(j*=S)*_),N.vx-=k*(_=1-_),r>1&&(N.vy-=A*_),r>2&&(N.vz-=j*_))}}}function u(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<Math.pow(2,r);++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function h(){if(e){var r,o,i=e.length;for(n=new Array(i),r=0;r<i;++r)o=e[r],n[o.index]=+t(o,r,e)}}return"function"!=typeof t&&(t=Lr(null==t?1:+t)),a.initialize=function(t,...n){e=t,o=n.find((t=>"function"==typeof t))||Math.random,r=n.find((t=>[1,2,3].includes(t)))||2,h()},a.iterations=function(t){return arguments.length?(s=+t,a):s},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:Lr(+e),h(),a):t},a}function hn(t,e,r,n){var o,i,s,a,u=Lr(.1);function h(t){for(var u=0,h=o.length;u<h;++u){var d=o[u],c=d.x-e||1e-6,l=(d.y||0)-r||1e-6,f=(d.z||0)-n||1e-6,g=Math.sqrt(c*c+l*l+f*f),p=(a[u]-g)*s[u]*t/g;d.vx+=c*p,i>1&&(d.vy+=l*p),i>2&&(d.vz+=f*p)}}function d(){if(o){var e,r=o.length;for(s=new Array(r),a=new Array(r),e=0;e<r;++e)a[e]=+t(o[e],e,o),s[e]=isNaN(a[e])?0:+u(o[e],e,o)}}return"function"!=typeof t&&(t=Lr(+t)),null==e&&(e=0),null==r&&(r=0),null==n&&(n=0),h.initialize=function(t,...e){o=t,i=e.find((t=>[1,2,3].includes(t)))||2,d()},h.strength=function(t){return arguments.length?(u="function"==typeof t?t:Lr(+t),d(),h):u},h.radius=function(e){return arguments.length?(t="function"==typeof e?e:Lr(+e),d(),h):t},h.x=function(t){return arguments.length?(e=+t,h):e},h.y=function(t){return arguments.length?(r=+t,h):r},h.z=function(t){return arguments.length?(n=+t,h):n},h}function dn(t){var e,r,n,o=Lr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Lr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Lr(+t),s(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:Lr(+e),s(),i):t},i}function cn(t){var e,r,n,o=Lr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Lr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Lr(+t),s(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:Lr(+e),s(),i):t},i}function ln(t){var e,r,n,o=Lr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vz+=(n[i]-o.z)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Lr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Lr(+t),s(),i):o},i.z=function(e){return arguments.length?(t="function"==typeof e?e:Lr(+e),s(),i):t},i}var fn=r(4341),gn=r.n(fn);class pn{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,pn.defaultOptions,t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,e,Object.assign(Object.assign({},this.options),r))}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,e,Object.assign(Object.assign({},this.options),r))}))}genericDagreLayout(e,r,n){return t(this,void 0,void 0,(function*(){const{nodeSize:t}=n,o=new fn.graphlib.Graph;o.setGraph(n),o.setDefaultEdgeLabel((()=>({}))),[...r.getAllNodes(),...r.getAllEdges()].some((({id:t})=>c(t)))&&console.error("Dagre layout only support string id, it will convert number to string."),r.getAllNodes().forEach((e=>{const{id:r}=e,n=Object.assign({},e.data);if(void 0!==t){const[r,o]=function(t){if(!t)return[0,0,0];if(c(t))return[t,t,t];if(0===t.length)return[0,0,0];const[e,r=e,n=e]=t;return[e,r,n]}($t(t)?t(e):t);Object.assign(n,{width:r,height:o})}o.setNode(r.toString(),n)})),r.getAllEdges().forEach((({id:t,source:e,target:r})=>{o.setEdge(e.toString(),r.toString(),{id:t})})),gn().layout(o);const i={nodes:[],edges:[]};return o.nodes().forEach((t=>{const n=o.node(t);i.nodes.push({id:t,data:n}),e&&r.mergeNodeData(t,n)})),o.edges().forEach((t=>{const n=o.edge(t),{id:s}=n,a=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(n,["id"]),{v:u,w:h}=t;i.edges.push({id:s,source:u,target:h,data:a}),e&&r.mergeEdgeData(s,a)})),i}))}}pn.defaultOptions={};class vn{constructor(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}distanceTo(t){const e=this.rx-t.rx,r=this.ry-t.ry;return Math.hypot(e,r)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,r=t.ry-this.ry;let n=Math.hypot(e,r);n=n<1e-4?1e-4:n;const o=this.g*(this.degree+1)*(t.degree+1)/n;this.fx+=o*e/n,this.fy+=o*r/n}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,r=(this.rx*this.mass+t.rx*t.mass)/e,n=(this.ry*this.mass+t.ry*t.mass)/e,o=this.degree+t.degree;return new vn({rx:r,ry:n,mass:e,degree:o})}}class mn{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const r=this.length/2;return t<=this.xmid+r&&t>=this.xmid-r&&e<=this.ymid+r&&e>=this.ymid-r}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new mn({xmid:t,ymid:e,length:r})}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new mn({xmid:t,ymid:e,length:r})}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new mn({xmid:t,ymid:e,length:r})}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new mn({xmid:t,ymid:e,length:r})}}class yn{constructor(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}insert(t){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new yn(this.quad.NW()),this.NE=new yn(this.quad.NE()),this.SW=new yn(this.quad.SW()),this.SE=new yn(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t)):this.body=t}_putBody(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))}_isExternal(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE}updateForce(t){null!=this.body&&t!==this.body&&(this._isExternal()||(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t)))}}const wn={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1},xn={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},bn={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300},En=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;return null==e?r=Math.min(n,o):Math.min(n,o)===t.rows?t.rows=e:t.cols=e,r},Nn=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;return null==e?r=Math.max(n,o):Math.max(n,o)===t.rows?t.rows=e:t.cols=e,r},Mn=(t,e)=>t[`c-${e.row}-${e.col}`]||!1,_n=(t,e)=>t[`c-${e.row}-${e.col}`]=!0,kn=(t,e)=>{const r=t.cols||5;e.col++,e.col>=r&&(e.col=0,e.row++)},An=(t,e,r,n,o,i,s,a)=>{let u,h;const d=o[t.id];if(d)u=d.col*r+r/2+e[0],h=d.row*n+n/2+e[1];else{for(;Mn(a,s);)kn(i,s);u=s.col*r+r/2+e[0],h=s.row*n+n/2+e[1],_n(a,s),kn(i,s)}t.data.x=u,t.data.y=h},jn={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},Sn=(t,e,r,n,o,i)=>{e.forEach(((s,a)=>{r[a]={x:0,y:0},e.forEach(((e,u)=>{if(a===u)return;if(o[a]!==o[u])return;let h=s.x-e.x,d=s.y-e.y,c=Math.sqrt(h*h+d*d);if(0===c){c=1;const t=a>u?1:-1;h=.01*t,d=.01*t}if(c<i(t[a])/2+i(t[u])/2){const t=n*n/c;r[a].x+=h/c*t,r[a].y+=d/c*t}}))}))},On=(t,e,r,n,o,i,s,a)=>{const u=i||s/10;return n&&e.forEach(((e,r)=>{const n=t[r].x-t[o].x,i=t[r].y-t[o].y,s=Math.sqrt(n*n+i*i);let a=i/s,u=-n/s;const h=Math.sqrt(e.x*e.x+e.y*e.y);let d=Math.acos((a*e.x+u*e.y)/h);d>Math.PI/2&&(d-=Math.PI/2,a*=-1,u*=-1);const c=Math.cos(d)*h;e.x=a*c,e.y=u*c})),t.forEach(((i,s)=>{if(s===o)return;const h=Math.sqrt(e[s].x*e[s].x+e[s].y*e[s].y);if(h>0&&s!==o){const d=Math.min(u*(r/800),h);if(i.x+=e[s].x/h*d,i.y+=e[s].y/h*d,n){let e=i.x-t[o].x,r=i.y-t[o].y;const n=Math.sqrt(e*e+r*r);e=e/n*a[s],r=r/n*a[s],i.x=t[o].x+e,i.y=t[o].y+r}}})),t},zn={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10},Rn={center:[0,0],width:300,height:300},In={circular:class{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},Xt),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericCircularLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericCircularLayout(!0,e,r)}))}genericCircularLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{width:o,height:i,center:s,divisions:a,startAngle:u=0,endAngle:h=2*Math.PI,angleRatio:d,ordering:c,clockwise:l,nodeSpacing:f,nodeSize:g}=t,p=r.getAllNodes(),v=r.getAllEdges(),[m,y,w]=((t,e,r)=>{let n=t,o=e,i=r;return n||"undefined"==typeof window||(n=window.innerWidth),o||"undefined"==typeof window||(o=window.innerHeight),i||(i=[n/2,o/2]),[n,o,i]})(o,i,s),x=null==p?void 0:p.length;if(!x||1===x)return Qt(r,e,w);const b=(h-u)/x;let{radius:E,startRadius:N,endRadius:M}=t;if(f){const t=Gt(10,f),e=Wt(10,g);let r=-1/0;p.forEach((t=>{const n=e(t);r<n&&(r=n)}));let n=0;p.forEach(((e,o)=>{n+=0===o?r||10:(t(e)||0)+(r||10)})),E=n/(2*Math.PI)}else E||N||M?!N&&M?N=M:N&&!M&&(M=N):E=Math.min(y,m)/2;const _=b*d;let k=[];k="topology"===c?Zt(r,p):"topology-directed"===c?Zt(r,p,!0):"degree"===c?function(t,e){const r=[];return e.forEach(((t,e)=>{r.push(Kt(t))})),r.sort(((e,r)=>t.getDegree(e.id,"both")-t.getDegree(r.id,"both"))),r}(r,p):p.map((t=>Kt(t)));const A=Math.ceil(x/a);for(let t=0;t<x;++t){let e=E;e||null===N||null===M||(e=N+t*(M-N)/(x-1)),e||(e=10+100*t/(x-1));let r=u+t%A*_+2*Math.PI/a*Math.floor(t/A);l||(r=h-t%A*_-2*Math.PI/a*Math.floor(t/A)),k[t].data.x=w[0]+Math.cos(r)*e,k[t].data.y=w[1]+Math.sin(r)*e}return e&&k.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),{nodes:k,edges:v}}))}},concentric:ne,mds:Le,random:class{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},Rn),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericRandomLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){this.genericRandomLayout(!0,e,r)}))}genericRandomLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{center:o,width:i,height:s}=t,a=r.getAllNodes(),u=i||"undefined"==typeof window?i:window.innerWidth,h=s||"undefined"==typeof window?s:window.innerHeight,d=o||[u/2,h/2],c=[];return a&&a.forEach((t=>{c.push({id:t.id,data:{x:.9*(Math.random()-.5)*u+d[0],y:.9*(Math.random()-.5)*h+d[1]}})})),e&&c.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:c,edges:r.getAllEdges()}}))}},grid:class{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},bn),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericGridLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){this.genericGridLayout(!0,e,r)}))}genericGridLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{begin:o=[0,0],condense:i,preventOverlapPadding:s,preventOverlap:a,rows:u,cols:h,nodeSpacing:d,nodeSize:l,width:f,height:g,position:p}=t;let{sortBy:v}=t;const m=r.getAllNodes(),y=r.getAllEdges(),w=null==m?void 0:m.length;if(!w||1===w)return Qt(r,e,o);const x=m.map((t=>Kt(t)));"id"===v||te(v)&&void 0!==x[0].data[v]||(v="degree"),"degree"===v?x.sort(((t,e)=>r.getDegree(e.id,"both")-r.getDegree(t.id,"both"))):"id"===v?x.sort(((t,e)=>c(e.id)&&c(t.id)?e.id-t.id:`${t.id}`.localeCompare(`${e.id}`))):x.sort(((t,e)=>e.data[v]-t.data[v]));const b=f||"undefined"==typeof window?f:window.innerWidth,E=g||"undefined"==typeof window?g:window.innerHeight,N=w,M={rows:u,cols:h};if(null!=u&&null!=h)M.rows=u,M.cols=h;else if(null!=u&&null==h)M.rows=u,M.cols=Math.ceil(N/M.rows);else if(null==u&&null!=h)M.cols=h,M.rows=Math.ceil(N/M.cols);else{const t=Math.sqrt(N*E/b);M.rows=Math.round(t),M.cols=Math.round(b/E*t)}if(M.rows=Math.max(M.rows,1),M.cols=Math.max(M.cols,1),M.cols*M.rows>N){const t=En(M),e=Nn(M);(t-1)*e>=N?En(M,t-1):(e-1)*t>=N&&Nn(M,e-1)}else for(;M.cols*M.rows<N;){const t=En(M),e=Nn(M);(e+1)*t>=N?Nn(M,e+1):En(M,t+1)}let _=i?0:b/M.cols,k=i?0:E/M.rows;if(a||d){const t=Gt(10,d),e=Wt(30,l,!1);x.forEach((n=>{n.data.x&&n.data.y||(n.data.x=0,n.data.y=0);const o=r.getNode(n.id),i=e(o)||30;let a,u;ee(i)?(a=i[0],u=i[1]):(a=i,u=i);const h=void 0!==t?t(n):s,d=a+h,c=u+h;_=Math.max(_,d),k=Math.max(k,c)}))}const A={},j={row:0,col:0},S={};for(let t=0;t<x.length;t++){const e=x[t];let n;if(p&&(n=p(r.getNode(e.id))),n&&(void 0!==n.row||void 0!==n.col)){const t={row:n.row,col:n.col};if(void 0===t.col)for(t.col=0;Mn(A,t);)t.col++;else if(void 0===t.row)for(t.row=0;Mn(A,t);)t.row++;S[e.id]=t,_n(A,t)}An(e,o,_,k,S,M,j,A)}const O={nodes:x,edges:y};return e&&x.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),O}))}},radial:class{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},zn),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericRadialLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){this.genericRadialLayout(!0,e,r)}))}genericRadialLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{width:o,height:i,center:s,focusNode:a,unitRadius:u,nodeSize:h,nodeSpacing:d,strictRadial:c,preventOverlap:l,maxPreventOverlapIteration:f,sortBy:g,linkDistance:p=50,sortStrength:v=10,maxIteration:m=1e3}=t,y=r.getAllNodes(),w=r.getAllEdges(),x=o||"undefined"==typeof window?o:window.innerWidth,b=i||"undefined"==typeof window?i:window.innerHeight,E=s||[x/2,b/2];if(!(null==y?void 0:y.length)||1===y.length)return Qt(r,e,E);let N=y[0];if(te(a)){for(let t=0;t<y.length;t++)if(y[t].id===a){N=y[t];break}}else N=a||y[0];const M=((t,e)=>{let r=-1;return t.forEach(((t,n)=>{t.id===e&&(r=n)})),Math.max(r,0)})(y,N.id),_=Ce({nodes:y,edges:w},!1),k=Ie(_),A=((t,e)=>{let r=0;for(let n=0;n<t[e].length;n++)t[e][n]!==1/0&&(r=t[e][n]>r?t[e][n]:r);return r})(k,M);((t,e,r)=>{const n=t.length;for(let o=0;o<n;o++)if(t[e][o]===1/0){t[e][o]=r,t[o][e]=r;for(let i=0;i<n;i++)t[o][i]!==1/0&&t[e][i]===1/0&&(t[e][i]=r+t[o][i],t[i][e]=r+t[o][i])}for(let r=0;r<n;r++)if(r!==e)for(let o=0;o<n;o++)if(t[r][o]===1/0){let n=Math.abs(t[e][r]-t[e][o]);n=0===n?1:n,t[r][o]=n}})(k,M,A+1);const j=k[M];let S=x-E[0]>E[0]?E[0]:x-E[0],O=b-E[1]>E[1]?E[1]:b-E[1];0===S&&(S=x/2),0===O&&(O=b/2);const z=Math.min(S,O),R=Math.max(...j),I=[],C=u||z/R;j.forEach(((t,e)=>{I[e]=t*C}));const D=((t,e,r,n,o,i,s)=>{if(!t)return[];const a=[];if(e){const u={};e.forEach(((e,h)=>{const d=[];e.forEach(((e,a)=>{var c,l;if(h===a)d.push(0);else if(n[h]===n[a])if("data"===i)d.push(e*(Math.abs(h-a)*s)/(n[h]/o));else if(i){let r,f;if(u[t[h].id])r=u[t[h].id];else{const e=("id"===i?t[h].id:null===(c=t[h].data)||void 0===c?void 0:c[i])||0;r=te(e)?e.charCodeAt(0):e,u[t[h].id]=r}if(u[t[a].id])f=u[t[a].id];else{const e=("id"===i?t[a].id:null===(l=t[a].data)||void 0===l?void 0:l[i])||0;f=te(e)?e.charCodeAt(0):e,u[t[a].id]=f}d.push(e*(Math.abs(r-f)*s)/(n[h]/o))}else d.push(e*r/(n[h]/o));else{const t=(r+o)/2;d.push(e*t)}})),a.push(d)}))}return a})(y,k,p,I,C,g,v),P=(t=>{const e=t.length,r=t[0].length,n=[];for(let o=0;o<e;o++){const e=[];for(let n=0;n<r;n++)0!==t[o][n]?e.push(1/(t[o][n]*t[o][n])):e.push(0);n.push(e)}return n})(D),T=((t,e,r)=>{try{const r=ze.mul(ze.pow(e,2),-.5),n=r.mean("row"),o=r.mean("column"),i=r.mean();r.add(i).subRowVector(n).subColumnVector(o);const s=new Re(r),a=ze.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map((e=>ze.mul([e],[a]).toJSON()[0].splice(0,t)))}catch(t){const n=[];for(let t=0;t<e.length;t++){const t=Math.random()*r,e=Math.random()*r;n.push([t,e])}return n}})(p,D,p);let L,F=T.map((([t,e])=>({x:(isNaN(t)?Math.random()*p:t)-T[M][0],y:(isNaN(e)?Math.random()*p:e)-T[M][1]})));if(this.run(m,F,P,D,I,M),l){L=Yt(h,d);const t={nodes:y,nodeSizeFunc:L,positions:F,radii:I,height:b,width:x,strictRadial:Boolean(c),focusIdx:M,iterations:f||200,k:F.length/4.5};F=((t,e)=>{const r=Object.assign(Object.assign({},jn),e),{positions:n,iterations:o,width:i,k:s,speed:a=100,strictRadial:u,focusIdx:h,radii:d=[],nodeSizeFunc:c}=r,l=t.getAllNodes(),f=[],g=i/10;for(let t=0;t<o;t++)n.forEach(((t,e)=>{f[e]={x:0,y:0}})),Sn(l,n,f,s,d,c),On(n,f,a,u,h,g,i,d);return n})(r,t)}const q=[];return F.forEach(((t,e)=>{const r=Kt(y[e]);r.data.x=t.x+E[0],r.data.y=t.y+E[1],q.push(r)})),e&&q.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:q,edges:w}}))}run(t,e,r,n,o,i){for(let s=0;s<=t;s++){const a=s/t;this.oneIteration(a,e,o,n,r,i)}}oneIteration(t,e,r,n,o,i){const s=1-t;e.forEach(((a,u)=>{const h=De(a,{x:0,y:0}),d=0===h?0:1/h;if(u===i)return;let c=0,l=0,f=0;e.forEach(((t,e)=>{if(u===e)return;const r=De(a,t),i=0===r?0:1/r,s=n[e][u];f+=o[u][e],c+=o[u][e]*(t.x+s*(a.x-t.x)*i),l+=o[u][e]*(t.y+s*(a.y-t.y)*i)}));const g=0===r[u]?0:1/r[u];f*=s,f+=t*g*g,c*=s,c+=t*g*a.x*d,a.x=c/f,l*=s,l+=t*g*a.y*d,a.y=l/f}))}},force:Me,d3force:Pr,"d3-force-3d":class extends Pr{constructor(){super(...arguments),this.id="d3-force-3d",this.config={inputNodeAttrs:["x","y","z","vx","vy","vz","fx","fy","fz"],outputNodeAttrs:["x","y","z","vx","vy","vz"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource","numDimensions"]},this.forceMap={link:Br,manyBody:rn,center:nn,collide:un,radial:hn,x:dn,y:cn,z:ln},this.options={numDimensions:3,link:{id:t=>t.id},manyBody:{},center:{x:0,y:0,z:0}}}initSimulation(){return function(t,e){e=e||2;var r,n=Math.min(3,Math.max(1,Math.round(e))),o=1,i=.001,s=1-Math.pow(i,1/300),a=0,u=.6,h=new Map,d=xr(f),c=ir("tick","end"),l=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Jr)/Jr}();function f(){g(),c.call("tick",r),o<i&&(d.stop(),c.call("end",r))}function g(e){var i,d,c=t.length;void 0===e&&(e=1);for(var l=0;l<e;++l)for(o+=(a-o)*s,h.forEach((function(t){t(o)})),i=0;i<c;++i)null==(d=t[i]).fx?d.x+=d.vx*=u:(d.x=d.fx,d.vx=0),n>1&&(null==d.fy?d.y+=d.vy*=u:(d.y=d.fy,d.vy=0)),n>2&&(null==d.fz?d.z+=d.vz*=u:(d.z=d.fz,d.vz=0));return r}function p(){for(var e,r=0,o=t.length;r<o;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),null!=e.fz&&(e.z=e.fz),isNaN(e.x)||n>1&&isNaN(e.y)||n>2&&isNaN(e.z)){var i=10*(n>2?Math.cbrt(.5+r):n>1?Math.sqrt(.5+r):r),s=r*tn,a=r*en;1===n?e.x=i:2===n?(e.x=i*Math.cos(s),e.y=i*Math.sin(s)):(e.x=i*Math.sin(s)*Math.cos(a),e.y=i*Math.cos(s),e.z=i*Math.sin(s)*Math.sin(a))}(isNaN(e.vx)||n>1&&isNaN(e.vy)||n>2&&isNaN(e.vz))&&(e.vx=0,n>1&&(e.vy=0),n>2&&(e.vz=0))}}function v(e){return e.initialize&&e.initialize(t,l,n),e}return null==t&&(t=[]),p(),r={tick:g,restart:function(){return d.restart(f),r},stop:function(){return d.stop(),r},numDimensions:function(t){return arguments.length?(n=Math.min(3,Math.max(1,Math.round(t))),h.forEach(v),r):n},nodes:function(e){return arguments.length?(t=e,p(),h.forEach(v),r):t},alpha:function(t){return arguments.length?(o=+t,r):o},alphaMin:function(t){return arguments.length?(i=+t,r):i},alphaDecay:function(t){return arguments.length?(s=+t,r):+s},alphaTarget:function(t){return arguments.length?(a=+t,r):a},velocityDecay:function(t){return arguments.length?(u=1-t,r):1-u},randomSource:function(t){return arguments.length?(l=t,h.forEach(v),r):l},force:function(t,e){return arguments.length>1?(null==e?h.delete(t):h.set(t,v(e)),r):h.get(t)},find:function(){var e,r,o,i,s,a,u=Array.prototype.slice.call(arguments),h=u.shift()||0,d=(n>1?u.shift():null)||0,c=(n>2?u.shift():null)||0,l=u.shift()||1/0,f=0,g=t.length;for(l*=l,f=0;f<g;++f)(i=(e=h-(s=t[f]).x)*e+(r=d-(s.y||0))*r+(o=c-(s.z||0))*o)<l&&(a=s,l=i);return a},on:function(t,e){return arguments.length>1?(c.on(t,e),r):c.on(t)}}}()}},fruchterman:class{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},xn),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericFruchtermanLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){this.genericFruchtermanLayout(!0,e,r)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;e<t;e++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericFruchtermanLayout(e,r,n){return t(this,void 0,void 0,(function*(){if(this.running)return;const t=this.formatOptions(n),{dimensions:o,width:i,height:s,center:a,clustering:h,nodeClusterBy:d,maxIteration:c,onTick:l}=t,f=r.getAllNodes(),g=r.getAllEdges();if(!(null==f?void 0:f.length)){const t={nodes:[],edges:g};return this.lastResult=t,t}if(1===f.length){e&&r.mergeNodeData(f[0].id,{x:a[0],y:a[1],z:3===o?a[2]:void 0});const t={nodes:[Object.assign(Object.assign({},f[0]),{data:Object.assign(Object.assign({},f[0].data),{x:a[0],y:a[1],z:3===o?a[2]:void 0})})],edges:g};return this.lastResult=t,t}const p=f.map((t=>Kt(t,[i,s]))),v=new u({nodes:p,edges:g}),m={};if(h&&p.forEach((t=>{const e=t.data[d];m[e]||(m[e]={name:e,cx:0,cy:0,count:0})})),this.lastLayoutNodes=p,this.lastLayoutEdges=g,this.lastAssign=e,this.lastGraph=v,this.lastOptions=t,this.lastClusterMap=m,"undefined"==typeof window)return;let y=0;return new Promise((n=>{this.timeInterval=window.setInterval((()=>{this.running?(this.runOneStep(v,m,t),e&&p.forEach((({id:t,data:e})=>r.mergeNodeData(t,{x:e.x,y:e.y,z:3===o?e.z:void 0}))),null==l||l({nodes:p,edges:g}),y++,y>=c&&(window.clearInterval(this.timeInterval),n({nodes:p,edges:g}))):n({nodes:p,edges:g})}),0),this.running=!0}))}))}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:r,nodeClusterBy:n}=e,{center:o,width:i,height:s}=e;return e.width=i||"undefined"==typeof window?i:window.innerWidth,e.height=s||"undefined"==typeof window?s:window.innerHeight,e.center=o||[e.width/2,e.height/2],e.clustering=r&&!!n,e}runOneStep(t,e,r){const{dimensions:n,height:o,width:i,gravity:s,center:a,speed:u,clustering:h,nodeClusterBy:d,clusterGravity:l}=r,f=o*i,g=Math.sqrt(f)/10,p=t.getAllNodes(),v=f/(p.length+1),m=Math.sqrt(v),y={};if(this.applyCalculate(t,y,m,v),h){for(const t in e)e[t].cx=0,e[t].cy=0,e[t].count=0;p.forEach((t=>{const{data:r}=t,n=e[r[d]];c(r.x)&&(n.cx+=r.x),c(r.y)&&(n.cy+=r.y),n.count++}));for(const t in e)e[t].cx/=e[t].count,e[t].cy/=e[t].count;const t=l||s;p.forEach(((r,n)=>{const{id:o,data:i}=r;if(!c(i.x)||!c(i.y))return;const s=e[i[d]],a=Math.sqrt((i.x-s.cx)*(i.x-s.cx)+(i.y-s.cy)*(i.y-s.cy)),u=m*t;y[o].x-=u*(i.x-s.cx)/a,y[o].y-=u*(i.y-s.cy)/a}))}p.forEach(((t,e)=>{const{id:r,data:o}=t;if(!c(o.x)||!c(o.y))return;const i=.01*m*s;y[r].x-=i*(o.x-a[0]),y[r].y-=i*(o.y-a[1]),3===n&&(y[r].z-=i*(o.z-a[2]))})),p.forEach(((e,r)=>{const{id:o,data:i}=e;if(c(i.fx)&&c(i.fy))return i.x=i.fx,i.y=i.fy,void(3===n&&(i.z=i.fz));if(!c(i.x)||!c(i.y))return;const s=Math.sqrt(y[o].x*y[o].x+y[o].y*y[o].y+(3===n?y[o].z*y[o].z:0));if(s>0){const e=Math.min(g*(u/800),s);t.mergeNodeData(o,{x:i.x+y[o].x/s*e,y:i.y+y[o].y/s*e,z:3===n?i.z+y[o].z/s*e:void 0})}}))}applyCalculate(t,e,r,n){this.calRepulsive(t,e,n),this.calAttractive(t,e,r)}calRepulsive(t,e,r){const n=t.getAllNodes();n.forEach((({data:t,id:o},i)=>{e[o]={x:0,y:0,z:0},n.forEach((({data:n,id:s},a)=>{if(i<=a||!c(t.x)||!c(n.x)||!c(t.y)||!c(n.y))return;let u=t.x-n.x,h=t.y-n.y,d=3===this.options.dimensions?t.z-n.z:0,l=u*u+h*h+d*d;0===l&&(l=1,u=.01,h=.01,d=.01);const f=r/l,g=u*f,p=h*f,v=d*f;e[o].x+=g,e[o].y+=p,e[s].x-=g,e[s].y-=p,3===this.options.dimensions&&(e[o].z+=v,e[s].z-=v)}))}))}calAttractive(t,e,r){t.getAllEdges().forEach((n=>{const{source:o,target:i}=n;if(!o||!i||o===i)return;const{data:s}=t.getNode(o),{data:a}=t.getNode(i);if(!(c(a.x)&&c(s.x)&&c(a.y)&&c(s.y)))return;const u=a.x-s.x,h=a.y-s.y,d=3===this.options.dimensions?a.z-s.z:0,l=Math.sqrt(u*u+h*h+d*d)/r,f=u*l,g=h*l,p=d*l;e[o].x+=f,e[o].y+=g,e[i].x-=f,e[i].y-=g,3===this.options.dimensions&&(e[o].z+=p,e[i].z-=p)}))}},forceAtlas2:class{constructor(t={}){this.options=t,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},wn),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericForceAtlas2Layout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){this.genericForceAtlas2Layout(!0,e,r)}))}genericForceAtlas2Layout(e,r,n){return t(this,void 0,void 0,(function*(){const t=r.getAllEdges(),o=r.getAllNodes(),i=this.formatOptions(n,o.length),{width:s,height:a,prune:h,maxIteration:d,nodeSize:c,center:l}=i;if(!(null==o?void 0:o.length)||1===o.length)return Qt(r,e,l);const f=o.map((t=>Kt(t,[s,a]))),g=t.filter((t=>{const{source:e,target:r}=t;return e!==r})),p=new u({nodes:f,edges:g}),v=this.getSizes(p,r,c);if(this.run(p,r,d,v,e,i),h){for(let t=0;t<g.length;t+=1){const{source:e,target:r}=g[t],n=p.getDegree(e),o=p.getDegree(e);if(n<=1){const t=p.getNode(r);p.mergeNodeData(e,{x:t.data.x,y:t.data.y})}else if(o<=1){const t=p.getNode(e);p.mergeNodeData(r,{x:t.data.x,y:t.data.y})}}const t=Object.assign(Object.assign({},i),{prune:!1,barnesHut:!1});this.run(p,r,100,v,e,t)}return{nodes:f,edges:t}}))}getSizes(t,e,r){const n=t.getAllNodes(),o={};for(let t=0;t<n.length;t+=1){const{id:i,data:s}=n[t];if(o[i]=10,c(s.size))o[i]=s.size;else if(ee(s.size))isNaN(s.size[0])||(o[i]=Math.max(s.size[0])),isNaN(s.size[1])||(o[i]=Math.max(s.size[1]));else if(Ut(s.size))o[i]=Math.max(s.size.width,s.size.height);else if($t(r)){const t=r(e.getNode(i));ee(t)?o[i]=Math.max(...t):o[i]=t}else ee(r)?o[i]=Math.max(...r):c(r)&&(o[i]=r)}return o}formatOptions(t={},e){const r=Object.assign(Object.assign({},this.options),t),{center:n,width:o,height:i,barnesHut:s,prune:a,maxIteration:u,kr:h,kg:d}=r;return r.width=o||"undefined"==typeof window?o:window.innerWidth,r.height=i||"undefined"==typeof window?i:window.innerHeight,r.center=n||[r.width/2,r.height/2],void 0===s&&e>250&&(r.barnesHut=!0),void 0===a&&e>100&&(r.prune=!0),0!==u||a?0===u&&a&&(r.maxIteration=100,e<=200&&e>100?r.maxIteration=500:e>200&&(r.maxIteration=950)):(r.maxIteration=250,e<=200&&e>100?r.maxIteration=1e3:e>200&&(r.maxIteration=1200)),h||(r.kr=50,e>100&&e<=500?r.kr=20:e>500&&(r.kr=1)),d||(r.kg=20,e>100&&e<=500?r.kg=10:e>500&&(r.kg=1)),r}run(t,e,r,n,o,i){const{kr:s,barnesHut:a,onTick:u}=i,h=t.getAllNodes();let d=0,c=r;const l={},f={},g={};for(let e=0;e<h.length;e+=1){const{data:r,id:n}=h[e];if(l[n]=[0,0],a){const o={id:e,rx:r.x,ry:r.y,mass:1,g:s,degree:t.getDegree(n)};g[n]=new vn(o)}}for(;c>0;)d=this.oneStep(t,{iter:c,preventOverlapIters:50,krPrime:100,sg:d,forces:l,preForces:f,bodies:g,sizes:n},i),c--,null==u||u({nodes:h,edges:e.getAllEdges()});return t}oneStep(t,e,r){const{iter:n,preventOverlapIters:o,krPrime:i,sg:s,preForces:a,bodies:u,sizes:h}=e;let{forces:d}=e;const{preventOverlap:c,barnesHut:l}=r,f=t.getAllNodes();for(let t=0;t<f.length;t+=1){const{id:e}=f[t];a[e]=[...d[e]],d[e]=[0,0]}return d=this.getAttrForces(t,n,o,h,d,r),d=l&&(c&&n>o||!c)?this.getOptRepGraForces(t,d,u,r):this.getRepGraForces(t,n,o,d,i,h,r),this.updatePos(t,d,a,s,r)}getAttrForces(t,e,r,n,o,i){const{preventOverlap:s,dissuadeHubs:a,mode:u,prune:h}=i,d=t.getAllEdges();for(let i=0;i<d.length;i+=1){const{source:c,target:l}=d[i],f=t.getNode(c),g=t.getNode(l),p=t.getDegree(c),v=t.getDegree(l);if(h&&(p<=1||v<=1))continue;const m=[g.data.x-f.data.x,g.data.y-f.data.y];let y=Math.hypot(m[0],m[1]);y=y<1e-4?1e-4:y,m[0]=m[0]/y,m[1]=m[1]/y,s&&e<r&&(y=y-n[c]-n[l]);let w=y,x=w;"linlog"===u&&(w=Math.log(1+y),x=w),a&&(w=y/p,x=y/v),s&&e<r&&y<=0?(w=0,x=0):s&&e<r&&y>0&&(w=y,x=y),o[c][0]+=w*m[0],o[l][0]-=x*m[0],o[c][1]+=w*m[1],o[l][1]-=x*m[1]}return o}getOptRepGraForces(t,e,r,n){const{kg:o,center:i,prune:s}=n,a=t.getAllNodes(),u=a.length;let h=9e10,d=-9e10,c=9e10,l=-9e10;for(let e=0;e<u;e+=1){const{id:n,data:o}=a[e];s&&t.getDegree(n)<=1||(r[n].setPos(o.x,o.y),o.x>=d&&(d=o.x),o.x<=h&&(h=o.x),o.y>=l&&(l=o.y),o.y<=c&&(c=o.y))}const f=Math.max(d-h,l-c),g=new mn({xmid:(d+h)/2,ymid:(l+c)/2,length:f,massCenter:i,mass:u}),p=new yn(g);for(let e=0;e<u;e+=1){const{id:n}=a[e];s&&t.getDegree(n)<=1||r[n].in(g)&&p.insert(r[n])}for(let n=0;n<u;n+=1){const{id:u,data:h}=a[n],d=t.getDegree(u);if(s&&d<=1)continue;r[u].resetForce(),p.updateForce(r[u]),e[u][0]-=r[u].fx,e[u][1]-=r[u].fy;const c=[h.x-i[0],h.y-i[1]];let l=Math.hypot(c[0],c[1]);l=l<1e-4?1e-4:l,c[0]=c[0]/l,c[1]=c[1]/l;const f=o*(d+1);e[u][0]-=f*c[0],e[u][1]-=f*c[1]}return e}getRepGraForces(t,e,r,n,o,i,s){const{preventOverlap:a,kr:u,kg:h,center:d,prune:c}=s,l=t.getAllNodes(),f=l.length;for(let s=0;s<f;s+=1){const g=l[s],p=t.getDegree(g.id);for(let h=s+1;h<f;h+=1){const s=l[h],d=t.getDegree(s.id);if(c&&(p<=1||d<=1))continue;const f=[s.data.x-g.data.x,s.data.y-g.data.y];let v=Math.hypot(f[0],f[1]);v=v<1e-4?1e-4:v,f[0]=f[0]/v,f[1]=f[1]/v,a&&e<r&&(v=v-i[g.id]-i[s.id]);let m=u*(p+1)*(d+1)/v;a&&e<r&&v<0?m=o*(p+1)*(d+1):a&&e<r&&0===v?m=0:a&&e<r&&v>0&&(m=u*(p+1)*(d+1)/v),n[g.id][0]-=m*f[0],n[s.id][0]+=m*f[0],n[g.id][1]-=m*f[1],n[s.id][1]+=m*f[1]}const v=[g.data.x-d[0],g.data.y-d[1]],m=Math.hypot(v[0],v[1]);v[0]=v[0]/m,v[1]=v[1]/m;const y=h*(p+1);n[g.id][0]-=y*v[0],n[g.id][1]-=y*v[1]}return n}updatePos(t,e,r,n,o){const{ks:i,tao:s,prune:a,ksmax:u}=o,h=t.getAllNodes(),d=h.length,l=[],f=[];let g=0,p=0,v=n;for(let n=0;n<d;n+=1){const{id:o}=h[n],i=t.getDegree(o);if(a&&i<=1)continue;const s=[e[o][0]-r[o][0],e[o][1]-r[o][1]],u=Math.hypot(s[0],s[1]),d=[e[o][0]+r[o][0],e[o][1]+r[o][1]],c=Math.hypot(d[0],d[1]);l[n]=u,f[n]=c/2,g+=(i+1)*l[n],p+=(i+1)*f[n]}const m=v;v=s*p/g,0!==m&&(v=v>1.5*m?1.5*m:v);for(let r=0;r<d;r+=1){const{id:n,data:o}=h[r],s=t.getDegree(n);if(a&&s<=1)continue;if(c(o.fx)&&c(o.fy))continue;let d=i*v/(1+v*Math.sqrt(l[r])),f=Math.hypot(e[n][0],e[n][1]);f=f<1e-4?1e-4:f;const g=u/f;d=d>g?g:d;const p=d*e[n][0],m=d*e[n][1];t.mergeNodeData(n,{x:o.x+p,y:o.y+m})}return v}},dagre:pn,antvDagre:class{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},Jt),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,e,r)}))}genericDagreLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},this.options),n),{nodeSize:o,align:i,rankdir:s="TB",ranksep:a,nodesep:h,ranksepFunc:d,nodesepFunc:l,edgeLabelSpace:f,ranker:g,nodeOrder:p,begin:v,controlPoints:m,radial:y,sortByCombo:w,preset:x}=t,b=new u({tree:[]}),E=Gt(a||50,d),N=Gt(h||50,l);let M=N,_=E;"LR"!==s&&"RL"!==s||(M=E,_=N);const k=Yt(o,void 0),A=r.getAllNodes(),j=r.getAllEdges();let S;A.forEach((t=>{const e=k(t),r=_(t),n=e+2*M(t),o=e+2*r,i=t.data.layer;c(i)?b.addNode({id:t.id,data:{width:n,height:o,layer:i}}):b.addNode({id:t.id,data:{width:n,height:o}})})),w&&(b.attachTreeStructure("combo"),A.forEach((t=>{const{parentId:e}=t.data;void 0!==e&&b.hasNode(e)&&b.setParent(t.id,e,"combo")}))),j.forEach((t=>{b.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||1}})})),(null==x?void 0:x.length)&&(S=new u({nodes:x})),((t,e)=>{const{edgeLabelSpace:r,keepNodeOrder:n,prevGraph:o,rankdir:i,ranksep:s}=e;var a,h;!n&&o&&(h=o,(a=t).getAllNodes().forEach((t=>{const e=a.getNode(t.id);if(h.hasNode(t.id)){const r=h.getNode(t.id);e.data.fixorder=r.data._order,delete r.data._order}else delete e.data.fixorder})));const d=(t=>{const e=new u({tree:[]});return t.getAllNodes().forEach((r=>{const n=Bt(t.getNode(r.id).data),o=Object.assign(Object.assign({},kt),n),i=Vt(o,_t);e.hasNode(r.id)||e.addNode({id:r.id,data:Object.assign({},i)});const s=t.hasTreeStructure("combo")?t.getParent(r.id,"combo"):t.getParent(r.id);null==s||(e.hasNode(s.id)||e.addNode(Object.assign({},s)),e.setParent(r.id,s.id))})),t.getAllEdges().forEach((r=>{const n=Bt(t.getEdge(r.id).data),o={};null==St||St.forEach((t=>{void 0!==n[t]&&(o[t]=n[t])})),e.addEdge({id:r.id,source:r.source,target:r.target,data:Object.assign({},jt,Vt(n,At),o)})})),e})(t);let c;r&&(e.ranksep=((t,e)=>{const{ranksep:r=0,rankdir:n}=e;return t.getAllNodes().forEach((t=>{isNaN(t.data.layer)||t.data.layer||(t.data.layer=0)})),t.getAllEdges().forEach((t=>{var e;t.data.minlen*=2,"c"!==(null===(e=t.data.labelpos)||void 0===e?void 0:e.toLowerCase())&&("TB"===n||"BT"===n?t.data.width+=t.data.labeloffset:t.data.height+=t.data.labeloffset)})),r/2})(d,{rankdir:i,ranksep:s}));try{c=Mt(d,e)}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph\'s structure:\\n",t);throw t}((t,e)=>{t.getAllNodes().forEach((r=>{var n;const o=t.getNode(r.id);if(o){const t=e.getNode(r.id);o.data.x=t.data.x,o.data.y=t.data.y,o.data._order=t.data.order,o.data._rank=t.data.rank,(null===(n=e.getChildren(r.id))||void 0===n?void 0:n.length)&&(o.data.width=t.data.width,o.data.height=t.data.height)}})),t.getAllEdges().forEach((r=>{const n=t.getEdge(r.id),o=e.getEdge(r.id);n.data.points=o?o.data.points:[],o&&o.data.hasOwnProperty("x")&&(n.data.x=o.data.x,n.data.y=o.data.y)}))})(t,d)})(b,{prevGraph:S,edgeLabelSpace:f,keepNodeOrder:!!p,nodeOrder:p||[],acyclicer:"greedy",ranker:g,rankdir:s,nodesep:h,align:i});const O=[0,0];if(v){let t=1/0,e=1/0;b.getAllNodes().forEach((r=>{t>r.data.x&&(t=r.data.x),e>r.data.y&&(e=r.data.y)})),b.getAllEdges().forEach((r=>{var n;null===(n=r.data.points)||void 0===n||n.forEach((r=>{t>r.x&&(t=r.x),e>r.y&&(e=r.y)}))})),O[0]=v[0]-t,O[1]=v[1]-e}const z="LR"===s||"RL"===s;if(y);else{const t=new Set,e="BT"===s||"RL"===s?(t,e)=>e-t:(t,e)=>t-e;b.getAllNodes().forEach((e=>{e.data.x=e.data.x+O[0],e.data.y=e.data.y+O[1],t.add(z?e.data.x:e.data.y)}));const r=Array.from(t).sort(e),n=z?(t,e)=>t.x!==e.x:(t,e)=>t.y!==e.y,o=z?(t,e,r)=>{const n=Math.max(e.y,r.y),o=Math.min(e.y,r.y);return t.filter((t=>t.y<=n&&t.y>=o))}:(t,e,r)=>{const n=Math.max(e.x,r.x),o=Math.min(e.x,r.x);return t.filter((t=>t.x<=n&&t.x>=o))};b.getAllEdges().forEach(((t,e)=>{var i;f&&m&&"loop"!==t.data.type&&(t.data.controlPoints=((t,e,r,n,o,i,s)=>{let a=(null==t?void 0:t.slice(1,t.length-1))||[];if(e&&r){let{x:t,y:u}=e.data,{x:h,y:d}=r.data;if(o&&(t=e.data.y,u=e.data.x,h=r.data.y,d=r.data.x),d!==u&&t!==h){const c=n.indexOf(u),l=n[c+1];if(l){const t=a[0],e=o?{x:(u+l)/2,y:(null==t?void 0:t.y)||h}:{x:(null==t?void 0:t.x)||h,y:(u+l)/2};t&&!i(t,e)||a.unshift(e)}const f=n.indexOf(d),g=Math.abs(f-c);if(1===g)a=s(a,e.data,r.data),a.length||a.push(o?{x:(u+d)/2,y:t}:{x:t,y:(u+d)/2});else if(g>1){const e=n[f-1];if(e){const r=a[a.length-1],n=o?{x:(d+e)/2,y:(null==r?void 0:r.y)||h}:{x:(null==r?void 0:r.x)||t,y:(d+e)/2};r&&!i(r,n)||a.push(n)}}}}return a})(null===(i=t.data.points)||void 0===i?void 0:i.map((({x:t,y:e})=>({x:t+O[0],y:e+O[1]}))),b.getNode(t.source),b.getNode(t.target),r,z,n,o))}))}let R=[];R=b.getAllNodes().map((t=>Kt(t)));const I=b.getAllEdges();return e&&(R.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),I.forEach((t=>{r.mergeEdgeData(t.id,{controlPoints:t.data.controlPoints})}))),{nodes:R,edges:I}}))}},comboCombined:class{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},Be),t)}execute(e,r){return t(this,void 0,void 0,(function*(){return this.genericComboCombinedLayout(!1,e,r)}))}assign(e,r){return t(this,void 0,void 0,(function*(){yield this.genericComboCombinedLayout(!0,e,r)}))}genericComboCombinedLayout(e,r,n){return t(this,void 0,void 0,(function*(){const t=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:o,treeKey:i,outerLayout:s}=t,a=r.getAllNodes().filter((t=>!t.data._isCombo)),h=r.getAllNodes().filter((t=>t.data._isCombo)),d=r.getAllEdges(),c=null==a?void 0:a.length;if(!c||1===c)return Qt(r,e,o);const l=[],f=new Map;a.forEach((t=>{f.set(t.id,t)}));const g=new Map;h.forEach((t=>{g.set(t.id,t)}));const p=new Map,v=this.getInnerGraphs(r,i,f,g,d,t,p);yield Promise.all(v);const m=new Map,y=[],w=new Map;let x=!0;r.getRoots(i).forEach((t=>{const e=p.get(t.id),n=g.get(t.id)||f.get(t.id),o={id:t.id,data:Object.assign(Object.assign({},t.data),{x:e.data.x||n.data.x,y:e.data.y||n.data.y,fx:e.data.fx||n.data.fx,fy:e.data.fy||n.data.fy,mass:e.data.mass||n.data.mass,size:e.data.size})};y.push(o),m.set(t.id,!0),isNaN(o.data.x)||0===o.data.x||isNaN(o.data.y)||0===o.data.y?(o.data.x=100*Math.random(),o.data.y=100*Math.random()):x=!1,Pe(r,[t],(e=>{e.id!==t.id&&w.set(e.id,t.id)}),"TB",i)}));const b=[];let E;if(d.forEach((t=>{const e=w.get(t.source)||t.source,r=w.get(t.target)||t.target;e!==r&&m.has(e)&&m.has(r)&&b.push({id:t.id,source:e,target:r,data:{}})})),null==y?void 0:y.length){if(1===y.length)y[0].data.x=o[0],y[0].data.y=o[1];else{const t=new u({nodes:y,edges:b}),e=s||new Me;if(x&&Ve[e.id]){const e=y.length<100?new Le:new ne;yield e.assign(t)}E=yield e.execute(t,Object.assign({center:o,kg:5,preventOverlap:!0,animate:!1},"force"===e.id?{gravity:1,factor:4,linkDistance:(t,e,r)=>(Math.max(...e.data.size)||32)/2+(Math.max(...r.data.size)||32)/2+200}:{}))}p.forEach((t=>{var e;const r=E.nodes.find((e=>e.id===t.id));if(r){const{x:e,y:n}=r.data;t.data.visited=!0,t.data.x=e,t.data.y=n,l.push({id:t.id,data:{x:e,y:n}})}const{x:n,y:o}=t.data;null===(e=t.data.nodes)||void 0===e||e.forEach((t=>{l.push({id:t.id,data:{x:t.data.x+n,y:t.data.y+o}})}))})),p.forEach((({data:t})=>{const{x:e,y:r,visited:n,nodes:o}=t;null==o||o.forEach((t=>{if(!n){const n=l.find((e=>e.id===t.id));n.data.x+=e||0,n.data.y+=r||0}}))}))}return e&&l.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),{nodes:l,edges:d}}))}initVals(t){const e=Object.assign({},t),{nodeSize:r,spacing:n,comboPadding:o}=t;let i,s,a;if(s=c(n)?()=>n:$t(n)?n:()=>0,e.spacing=s,r)if($t(r))i=t=>{const e=r(t),n=s(t);return ee(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+n)/2:((e||32)+n)/2};else if(ee(r)){const t=(r[0]>r[1]?r[0]:r[1])/2;i=e=>t+s(e)/2}else{const t=r/2;i=e=>t+s(e)/2}else i=t=>{const e=s(t);return t.size?ee(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+e)/2:Ut(t.size)?((t.size.width>t.size.height?t.size.width:t.size.height)+e)/2:(t.size+e)/2:32+e/2};return e.nodeSize=i,a=c(o)?()=>o:ee(o)?()=>Math.max.apply(null,o):$t(o)?o:()=>0,e.comboPadding=a,e}getInnerGraphs(e,r,n,o,i,s,a){const{nodeSize:h,comboPadding:d,spacing:l,innerLayout:f}=s,g=f||new ne({}),p={center:[0,0],preventOverlap:!0,nodeSpacing:l},v=[],m=t=>{let e=(null==d?void 0:d(t))||10;return ee(e)&&(e=Math.max(...e)),{size:e?[2*e,2*e]:[30,30],padding:e}};return e.getRoots(r).forEach((s=>{a.set(s.id,{id:s.id,data:{nodes:[],size:m(s).size}});let d=Promise.resolve();Pe(e,[s],(s=>{var l;if(!s.data._isCombo)return;const{size:f,padding:v}=m(s);if(null===(l=e.getChildren(s.id,r))||void 0===l?void 0:l.length){const l=a.get(s.id);a.set(s.id,{id:s.id,data:Object.assign({nodes:[]},null==l?void 0:l.data)});const f=new Map,m=e.getChildren(s.id,r).map((t=>{if(t.data._isCombo)return a.has(t.id)||a.set(t.id,{id:t.id,data:Object.assign({},t.data)}),f.set(t.id,!0),a.get(t.id);const e=n.get(t.id)||o.get(t.id);return f.set(t.id,!0),{id:t.id,data:Object.assign(Object.assign({},e.data),t.data)}})),y={nodes:m,edges:i.filter((t=>f.has(t.source)&&f.has(t.target)))};let w=1/0;m.forEach((t=>{var e;let{size:r}=t.data;r||(r=(null===(e=a.get(t.id))||void 0===e?void 0:e.data.size)||(null==h?void 0:h(t))||[30,30]),c(r)&&(r=[r,r]);const[n,o]=r;w>n&&(w=n),w>o&&(w=o),t.data.size=r})),d=d.then((()=>t(this,void 0,void 0,(function*(){const t=new u(y),e=yield g.assign(t,p),{minX:r,minY:n,maxX:o,maxY:i}=(t=>{let e=1/0,r=1/0,n=-1/0,o=-1/0;return t.forEach((t=>{let i=t.data.size;ee(i)?1===i.length&&(i=[i[0],i[0]]):c(i)?i=[i,i]:(void 0===i||isNaN(i))&&(i=[30,30]);const s=[i[0]/2,i[1]/2],a=t.data.x-s[0],u=t.data.x+s[0],h=t.data.y-s[1],d=t.data.y+s[1];e>a&&(e=a),r>h&&(r=h),n<u&&(n=u),o<d&&(o=d)})),{minX:e,minY:r,maxX:n,maxY:o}})(m),h=(o+r)/2,d=(i+n)/2;y.nodes.forEach((t=>{t.data.x-=h,t.data.y-=d}));const l=[Math.max(o-r,w)+2*v,Math.max(i-n,w)+2*v];return a.get(s.id).data.size=l,a.get(s.id).data.nodes=m,e}))))}else a.set(s.id,{id:s.id,data:Object.assign(Object.assign({},s.data),{size:f})});return!0}),"BT",r),v.push(d)})),v}}};let Cn;function Dn(){(null==Cn?void 0:Cn.stop)&&Cn.stop()}function Pn(e,r){return t(this,void 0,void 0,(function*(){const{layout:{id:t,options:n,iterations:o},nodes:i,edges:s}=e,a=new u({nodes:i,edges:s}),h=In[t];if(!h)throw new Error(`Unknown layout id: ${t}`);Cn=new h(n);let d=yield Cn.execute(a);return!!(c=Cn).tick&&!!c.stop&&(Cn.stop(),d=Cn.tick(o)),[d,r];var c}))}addEventListener("message",(function(t){var e,r=t.data,o=r.type,i=r.method,s=r.id,a=r.params;"RPC"===o&&i&&((e=n[i])?Promise.resolve().then((function(){return e.apply(n,a)})):Promise.reject("No such method")).then((function(t){postMessage({type:"RPC",id:s,result:t})})).catch((function(t){var e={message:t};t.stack&&(e.message=t.message,e.stack=t.stack,e.name=t.name),postMessage({type:"RPC",id:s,error:e})}))})),postMessage({type:"RPC",method:"ready"})})()})();\n//# sourceMappingURL=cd2b54bd55e0306c6ba1.worker.js.map']))),n(t,o),t}},6135:t=>{t.exports=function(t,e){var r=0,n={};t.addEventListener("message",(function(e){var r=e.data;if("RPC"===r.type)if(r.id){var o=n[r.id];o&&(delete n[r.id],r.error?o[1](Object.assign(Error(r.error.message),r.error)):o[0](r.result))}else{var i=document.createEvent("Event");i.initEvent(r.method,!1,!1),i.data=r.params,t.dispatchEvent(i)}})),e.forEach((function(e){t[e]=function(){var o=arguments;return new Promise((function(i,s){var a=++r;n[a]=[i,s],t.postMessage({type:"RPC",id:a,method:e,params:[].slice.call(o)})}))}}))}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={id:n,loaded:!1,exports:{}};return t[n](i,i.exports,r),i.loaded=!0,i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var n={};return(()=>{"use strict";function t(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}function e(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}r.r(n),r.d(n,{AntVDagreLayout:()=>ee,CircularLayout:()=>ie,ComboCombinedLayout:()=>Ze,ConcentricLayout:()=>ce,D3Force3DLayout:()=>Mn,D3ForceLayout:()=>Kr,DagreLayout:()=>An,ForceAtlas2Layout:()=>Rn,ForceLayout:()=>Re,FruchtermanLayout:()=>Cn,GridLayout:()=>Pn,MDSLayout:()=>Ye,RadialLayout:()=>Kn,RandomLayout:()=>to,Supervisor:()=>a,clone:()=>Xt,cloneFormatData:()=>Zt,floydWarshall:()=>Ve,formatNodeSize:()=>Qt,formatNumberFn:()=>Ht,formatSizeFn:()=>Jt,getAdjMatrix:()=>Be,getEuclideanDistance:()=>Ge,getLayoutBBox:()=>$e,graphTreeDfs:()=>We,isArray:()=>he,isLayoutWithIterations:()=>ro,registry:()=>eo,scaleMatrix:()=>Ue}),Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;const o=function(){function t(){this._events={}}return t.prototype.on=function(t,e,r){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!r}),this},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.emit=function(t){for(var e=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=this._events[t]||[],i=this._events["*"]||[],s=function(n){for(var o=n.length,i=0;i<o;i++)if(n[i]){var s=n[i],a=s.callback;s.once&&(n.splice(i,1),0===n.length&&delete e._events[t],o--,i--),a.apply(e,r)}};s(o),s(i)},t.prototype.off=function(t,e){if(t)if(e){for(var r=this._events[t]||[],n=r.length,o=0;o<n;o++)r[o].callback===e&&(r.splice(o,1),n--,o--);0===r.length&&delete this._events[t]}else delete this._events[t];else this._events={};return this},t.prototype.getEvents=function(){return this._events},t}();var i=r(2583),s=r.n(i);class a extends o{constructor(t,e,r){super(),this.graph=t,this.layout=e,this.options=r,this.spawnWorker()}spawnWorker(){this.worker&&this.worker.terminate(),this.worker=s()(),this.running&&(this.running=!1,this.execute())}execute(){var r;return e(this,void 0,void 0,(function*(){if(this.running)return this;this.running=!0;const e=this.layout.options,{onTick:n}=e,o=t(e,["onTick"]),i={layout:{id:this.layout.id,options:o,iterations:null===(r=this.options)||void 0===r?void 0:r.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},s=new Float32Array([0]),[a]=yield this.worker.calculateLayout(i,[s]);return a}))}stop(){return this.running=!1,this.worker.stopLayout(),this}kill(){this.worker&&this.worker.terminate()}isRunning(){return this.running}}function u(t,e,r,n){for(;t.length;){const o=t.shift();if(r(o))return!0;e.add(o.id),n(o.id).forEach((r=>{e.has(r.id)||(e.add(r.id),t.push(r))}))}return!1}function h(t,e,r,n){if(r(t))return!0;e.add(t.id);for(const o of n(t.id))if(!e.has(o.id)&&h(o,e,r,n))return!0;return!1}const d=()=>!0;class c{graph;nodeFilter;edgeFilter;cacheEnabled;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;allNodesMap=new Map;allEdgesMap=new Map;constructor(t){this.graph=t.graph;const e=t.nodeFilter||d,r=t.edgeFilter||d;this.nodeFilter=e,this.edgeFilter=t=>{const{source:n,target:o}=this.graph.getEdgeDetail(t.id);return!(!e(n)||!e(o))&&r(t,n,o)},"auto"===t.cache?(this.cacheEnabled=!0,this.startAutoCache()):"manual"===t.cache?this.cacheEnabled=!0:this.cacheEnabled=!1}clearCache=()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()};refreshCache=()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map((t=>t.id)))};updateCache=t=>{const e=new Set;t.forEach((t=>{const r=this.bothEdgesMap.get(t);if(r&&r.forEach((t=>e.add(t.id))),this.hasNode(t)){const r=this.graph.getRelatedEdges(t,"in").filter(this.edgeFilter),n=this.graph.getRelatedEdges(t,"out").filter(this.edgeFilter),o=Array.from(new Set([...r,...n]));o.forEach((t=>e.add(t.id))),this.inEdgesMap.set(t,r),this.outEdgesMap.set(t,n),this.bothEdgesMap.set(t,o),this.allNodesMap.set(t,this.graph.getNode(t))}else this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.bothEdgesMap.delete(t),this.allNodesMap.delete(t)})),e.forEach((t=>{this.hasEdge(t)?this.allEdgesMap.set(t,this.graph.getEdge(t)):this.allEdgesMap.delete(t)}))};startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}handleGraphChanged=t=>{const e=new Set;t.changes.forEach((r=>{switch(r.type){case"NodeAdded":case"NodeRemoved":e.add(r.value.id);break;case"NodeDataUpdated":e.add(r.id);break;case"EdgeAdded":case"EdgeRemoved":e.add(r.value.source),e.add(r.value.target);break;case"EdgeUpdated":"source"!==r.propertyName&&"target"!==r.propertyName||(e.add(r.oldValue),e.add(r.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(r.id)){const n=t.graph.getEdge(r.id);e.add(n.source),e.add(n.target)}}})),this.updateCache(e)};checkNodeExistence(t){this.getNode(t)}hasNode(t){if(!this.graph.hasNode(t))return!1;const e=this.graph.getNode(t);return this.nodeFilter(e)}areNeighbors(t,e){return this.checkNodeExistence(t),this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.graph.getNode(t);if(!this.nodeFilter(e))throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){return this.checkNodeExistence(t),this.cacheEnabled?"in"===e?this.inEdgesMap.get(t):"out"===e?this.outEdgesMap.get(t):this.bothEdgesMap.get(t):this.graph.getRelatedEdges(t,e).filter(this.edgeFilter)}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}hasEdge(t){if(!this.graph.hasEdge(t))return!1;const e=this.graph.getEdge(t);return this.edgeFilter(e)}getEdge(t){const e=this.graph.getEdge(t);if(!this.edgeFilter(e))throw new Error("Edge not found for id: "+t);return e}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}hasTreeStructure(t){return this.graph.hasTreeStructure(t)}getRoots(t){return this.graph.getRoots(t).filter(this.nodeFilter)}getChildren(t,e){return this.checkNodeExistence(t),this.graph.getChildren(t,e).filter(this.nodeFilter)}getParent(t,e){this.checkNodeExistence(t);const r=this.graph.getParent(t,e);return r&&this.nodeFilter(r)?r:null}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];u([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];h(this.getNode(t),new Set,e,n)}}class l extends o{nodeMap=new Map;edgeMap=new Map;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;treeIndices=new Map;changes=[];batchCount=0;onChanged=()=>{};constructor(t){super(),t&&(t.nodes&&this.addNodes(t.nodes),t.edges&&this.addEdges(t.edges),t.tree&&this.addTree(t.tree),t.onChanged&&(this.onChanged=t.onChanged))}batch=t=>{this.batchCount+=1,t(),this.batchCount-=1,this.batchCount||this.commit()};commit(){const t=this.changes;this.changes=[];const e={graph:this,changes:t};this.emit("changed",e),this.onChanged(e)}reduceChanges(t){let e=[];return t.forEach((t=>{switch(t.type){case"NodeRemoved":{let r=!1;e=e.filter((e=>{if("NodeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"NodeDataUpdated"===e.type?e.id!==t.value.id:"TreeStructureChanged"!==e.type||e.nodeId!==t.value.id})),r||e.push(t);break}case"EdgeRemoved":{let r=!1;e=e.filter((e=>{if("EdgeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"EdgeDataUpdated"!==e.type&&"EdgeUpdated"!==e.type||e.id!==t.value.id})),r||e.push(t);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const r=e.findIndex((e=>e.type===t.type&&e.id===t.id&&(void 0===t.propertyName||e.propertyName===t.propertyName))),n=e[r];n?void 0!==t.propertyName?n.newValue=t.newValue:(e.splice(r,1),e.push(t)):e.push(t);break}case"TreeStructureDetached":e=e.filter((e=>"TreeStructureAttached"===e.type?e.treeKey!==t.treeKey:"TreeStructureChanged"!==e.type||e.treeKey!==t.treeKey)),e.push(t);break;case"TreeStructureChanged":{const r=e.find((e=>"TreeStructureChanged"===e.type&&e.treeKey===t.treeKey&&e.nodeId===t.nodeId));r?r.newParentId=t.newParentId:e.push(t);break}default:e.push(t)}})),e}checkNodeExistence(t){this.getNode(t)}hasNode(t){return this.nodeMap.has(t)}areNeighbors(t,e){return this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.nodeMap.get(t);if(!e)throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),"in"===e){const e=this.inEdgesMap.get(t);return Array.from(e)}if("out"===e){const e=this.outEdgesMap.get(t);return Array.from(e)}{const e=this.bothEdgesMap.get(t);return Array.from(e)}}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}doAddNode(t){if(this.hasNode(t.id))throw new Error("Node already exists: "+t.id);this.nodeMap.set(t.id,t),this.inEdgesMap.set(t.id,new Set),this.outEdgesMap.set(t.id,new Set),this.bothEdgesMap.set(t.id,new Set),this.treeIndices.forEach((e=>{e.childrenMap.set(t.id,new Set)})),this.changes.push({type:"NodeAdded",value:t})}addNodes(t){this.batch((()=>{for(const e of t)this.doAddNode(e)}))}addNode(t){this.addNodes([t])}doRemoveNode(t){const e=this.getNode(t),r=this.bothEdgesMap.get(t);r?.forEach((t=>this.doRemoveEdge(t.id))),this.nodeMap.delete(t),this.treeIndices.forEach((e=>{e.childrenMap.get(t)?.forEach((t=>{e.parentMap.delete(t.id)})),e.parentMap.delete(t),e.childrenMap.delete(t)})),this.changes.push({type:"NodeRemoved",value:e})}removeNodes(t){this.batch((()=>{t.forEach((t=>this.doRemoveNode(t)))}))}removeNode(t){this.removeNodes([t])}updateNodeDataProperty(t,e,r){const n=this.getNode(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"NodeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}mergeNodeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateNodeDataProperty(t,e,r)}))}))}updateNodeData(...t){const e=t[0],r=this.getNode(e);if("string"==typeof t[1])return void this.updateNodeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"NodeDataUpdated",id:e,oldValue:t,newValue:o})}))}checkEdgeExistence(t){if(!this.hasEdge(t))throw new Error("Edge not found for id: "+t)}hasEdge(t){return this.edgeMap.has(t)}getEdge(t){return this.checkEdgeExistence(t),this.edgeMap.get(t)}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}doAddEdge(t){if(this.hasEdge(t.id))throw new Error("Edge already exists: "+t.id);this.checkNodeExistence(t.source),this.checkNodeExistence(t.target),this.edgeMap.set(t.id,t);const e=this.inEdgesMap.get(t.target),r=this.outEdgesMap.get(t.source),n=this.bothEdgesMap.get(t.source),o=this.bothEdgesMap.get(t.target);e.add(t),r.add(t),n.add(t),o.add(t),this.changes.push({type:"EdgeAdded",value:t})}addEdges(t){this.batch((()=>{for(const e of t)this.doAddEdge(e)}))}addEdge(t){this.addEdges([t])}doRemoveEdge(t){const e=this.getEdge(t),r=this.outEdgesMap.get(e.source),n=this.inEdgesMap.get(e.target),o=this.bothEdgesMap.get(e.source),i=this.bothEdgesMap.get(e.target);r.delete(e),n.delete(e),o.delete(e),i.delete(e),this.edgeMap.delete(t),this.changes.push({type:"EdgeRemoved",value:e})}removeEdges(t){this.batch((()=>{t.forEach((t=>this.doRemoveEdge(t)))}))}removeEdge(t){this.removeEdges([t])}updateEdgeSource(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.source,o=e;this.outEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.outEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.source=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"source",oldValue:n,newValue:o})}))}updateEdgeTarget(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.target,o=e;this.inEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.inEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.target=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"target",oldValue:n,newValue:o})}))}updateEdgeDataProperty(t,e,r){const n=this.getEdge(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"EdgeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}updateEdgeData(...t){const e=t[0],r=this.getEdge(e);if("string"==typeof t[1])return void this.updateEdgeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"EdgeDataUpdated",id:e,oldValue:t,newValue:o})}))}mergeEdgeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateEdgeDataProperty(t,e,r)}))}))}checkTreeExistence(t){if(!this.hasTreeStructure(t))throw new Error("Tree structure not found for treeKey: "+t)}hasTreeStructure(t){return this.treeIndices.has(t)}attachTreeStructure(t){this.treeIndices.has(t)||(this.treeIndices.set(t,{parentMap:new Map,childrenMap:new Map}),this.batch((()=>{this.changes.push({type:"TreeStructureAttached",treeKey:t})})))}detachTreeStructure(t){this.checkTreeExistence(t),this.treeIndices.delete(t),this.batch((()=>{this.changes.push({type:"TreeStructureDetached",treeKey:t})}))}addTree(t,e){this.batch((()=>{this.attachTreeStructure(e);const r=[],n=Array.isArray(t)?t:[t];for(;n.length;){const t=n.shift();r.push(t),t.children&&n.push(...t.children)}this.addNodes(r),r.forEach((t=>{t.children?.forEach((r=>{this.setParent(r.id,t.id,e)}))}))}))}getRoots(t){return this.checkTreeExistence(t),this.getAllNodes().filter((e=>!this.getParent(e.id,t)))}getChildren(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);const r=this.treeIndices.get(e).childrenMap.get(t);return Array.from(r||[])}getParent(t,e){return this.checkNodeExistence(t),this.checkTreeExistence(e),this.treeIndices.get(e).parentMap.get(t)||null}getAncestors(t,e){const r=[];let n,o=this.getNode(t);for(;n=this.getParent(o.id,e);)r.push(n),o=n;return r}setParent(t,e,r){this.checkTreeExistence(r);const n=this.treeIndices.get(r),o=this.getNode(t),i=n.parentMap.get(t);if(i?.id===e)return;if(void 0===e)return i&&n.childrenMap.get(i.id)?.delete(o),void n.parentMap.delete(t);const s=this.getNode(e);n.parentMap.set(t,s),i&&n.childrenMap.get(i.id)?.delete(o);let a=n.childrenMap.get(s.id);a||(a=new Set,n.childrenMap.set(s.id,a)),a.add(o),this.batch((()=>{this.changes.push({type:"TreeStructureChanged",treeKey:r,nodeId:t,oldParentId:i?.id,newParentId:s.id})}))}dfsTree(t,e,r){return h(this.getNode(t),new Set,e,(t=>this.getChildren(t,r)))}bfsTree(t,e,r){return u([this.getNode(t)],new Set,e,(t=>this.getChildren(t,r)))}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return u([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return h(this.getNode(t),new Set,e,n)}clone(){const t=this.getAllNodes().map((t=>({...t,data:{...t.data}}))),e=this.getAllEdges().map((t=>({...t,data:{...t.data}}))),r=new l({nodes:t,edges:e});return this.treeIndices.forEach((({parentMap:t,childrenMap:e},n)=>{const o=new Map;t.forEach(((t,e)=>{o.set(e,r.getNode(t.id))}));const i=new Map;e.forEach(((t,e)=>{i.set(e,new Set(Array.from(t).map((t=>r.getNode(t.id)))))})),r.treeIndices.set(n,{parentMap:o,childrenMap:i})})),r}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(t){return new c({graph:this,...t})}}var f={}.toString;const g=function(t,e){return f.call(t)==="[object "+e+"]"},p=function(t){return g(t,"Number")},v=(t,e)=>{if("next"!==t&&"prev"!==t)return e},m=t=>{t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev};class y{constructor(){const t={};t.prev=t,t.next=t.prev,this.shortcut=t}dequeue(){const t=this.shortcut,e=t.prev;if(e&&e!==t)return m(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&m(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e}toString(){const t=[],e=this.shortcut;let r=e.prev;for(;r!==e;)t.push(JSON.stringify(r,v)),r=null==r?void 0:r.prev;return`[${t.join(", ")}]`}}class w extends y{}const x=()=>1,b=(t,e,r,n,o)=>{var i,s;const a=[];return t.hasNode(n.v)&&(null===(i=t.getRelatedEdges(n.v,"in"))||void 0===i||i.forEach((n=>{const i=n.data.weight,s=t.getNode(n.source);o&&a.push({v:n.source,w:n.target,in:0,out:0}),void 0===s.data.out&&(s.data.out=0),s.data.out-=i,E(e,r,Object.assign({v:s.id},s.data))})),null===(s=t.getRelatedEdges(n.v,"out"))||void 0===s||s.forEach((n=>{const o=n.data.weight,i=n.target,s=t.getNode(i);void 0===s.data.in&&(s.data.in=0),s.data.in-=o,E(e,r,Object.assign({v:s.id},s.data))})),t.removeNode(n.v)),o?a:void 0},E=(t,e,r)=>{r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)},N=(t,e)=>{const r="greedy"===e?((t,e)=>{var r;if(t.getAllNodes().length<=1)return[];const n=((t,e)=>{const r=new l;let n=0,o=0;t.getAllNodes().forEach((t=>{r.addNode({id:t.id,data:{v:t.id,in:0,out:0}})})),t.getAllEdges().forEach((t=>{const i=r.getRelatedEdges(t.source,"out").find((e=>e.target===t.target)),s=(null==e?void 0:e(t))||1;i?r.updateEdgeData(null==i?void 0:i.id,Object.assign(Object.assign({},i.data),{weight:i.data.weight+s})):r.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:s}}),o=Math.max(o,r.getNode(t.source).data.out+=s),n=Math.max(n,r.getNode(t.target).data.in+=s)}));const i=[],s=o+n+3;for(let t=0;t<s;t++)i.push(new w);const a=n+1;return r.getAllNodes().forEach((t=>{E(i,a,Object.assign({v:t.id},r.getNode(t.id).data))})),{buckets:i,zeroIdx:a,graph:r}})(t,(t=>t.data.weight||1)||x);return null===(r=((t,e,r)=>{let n=[];const o=e[e.length-1],i=e[0];let s;for(;t.getAllNodes().length;){for(;s=i.dequeue();)b(t,e,r,s);for(;s=o.dequeue();)b(t,e,r,s);if(t.getAllNodes().length)for(let o=e.length-2;o>0;--o)if(s=e[o].dequeue(),s){n=n.concat(b(t,e,r,s,!0));break}}return n})(n.graph,n.buckets,n.zeroIdx).map((e=>t.getRelatedEdges(e.v,"out").filter((({target:t})=>t===e.w)))))||void 0===r?void 0:r.flat()})(t):M(t);null==r||r.forEach((e=>{const r=e.data;t.removeEdge(e.id),r.forwardName=e.data.name,r.reversed=!0,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign({},r)})}))},M=t=>{const e=[],r={},n={},o=i=>{n[i]||(n[i]=!0,r[i]=!0,t.getRelatedEdges(i,"out").forEach((t=>{r[t.target]?e.push(t):o(t.target)})),delete r[i])};return t.getAllNodes().forEach((t=>o(t.id))),e},_=(t,e,r,n)=>{let o;do{o=`${n}${Math.random()}`}while(t.hasNode(o));return r.dummy=e,t.addNode({id:o,data:r}),o},k=t=>{const e=new l;return t.getAllNodes().forEach((r=>{t.getChildren(r.id).length||e.addNode(Object.assign({},r))})),t.getAllEdges().forEach((t=>{e.addEdge(t)})),e},A=(t,e)=>{const r=Number(t.x),n=Number(t.y),o=Number(e.x)-r,i=Number(e.y)-n;let s,a,u=Number(t.width)/2,h=Number(t.height)/2;return o||i?(Math.abs(i)*u>Math.abs(o)*h?(i<0&&(h=-h),s=h*o/i,a=h):(o<0&&(u=-u),s=u,a=u*i/o),{x:r+s,y:n+a}):{x:0,y:0}},j=t=>{const e=[],r=O(t)+1;for(let t=0;t<r;t++)e.push([]);t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&e[r]&&e[r].push(t.id)}));for(let n=0;n<r;n++)e[n]=e[n].sort(((e,r)=>{return n=t.getNode(e).data.order,o=t.getNode(r).data.order,Number(n)-Number(o);var n,o}));return e},S=(t,e,r,n)=>{const o={width:0,height:0};return p(r)&&p(n)&&(o.rank=r,o.order=n),_(t,"border",o,e)},O=t=>{let e;return t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&(void 0===e||r>e)&&(e=r)})),e||(e=0),e},z=(t,e)=>t.reduce(((t,r)=>e(t)>e(r)?r:t)),R=(t,e,r,n,o,i)=>{n.includes(e.id)||(n.push(e.id),r||i.push(e.id),o(e.id).forEach((e=>R(t,e,r,n,o,i))),r&&i.push(e.id))},I=(t,e,r,n)=>{const o=Array.isArray(e)?e:[e],i=e=>n?t.getSuccessors(e):t.getNeighbors(e),s=[],a=[];return o.forEach((e=>{if(!t.hasNode(e.id))throw new Error(`Graph does not have node: ${e}`);R(t,e,"post"===r,a,i,s)})),s},C=(t,e,r,n,o,i)=>{const s={rank:i,borderType:e,width:0,height:0},a=o.data[e][i-1],u=_(t,"border",s,r);o.data[e][i]=u,t.setParent(u,n),a&&t.addEdge({id:`e${Math.random()}`,source:a,target:u,data:{weight:1}})},D=t=>{t.getAllNodes().forEach((t=>{P(t)})),t.getAllEdges().forEach((t=>{P(t)}))},P=t=>{const e=t.data.width;t.data.width=t.data.height,t.data.height=e},T=t=>{(null==t?void 0:t.y)&&(t.y=-t.y)},L=t=>{const e=t.x;t.x=t.y,t.y=e},F=(t,e,r,n,o,i,s)=>{const a=t.getChildren(s);if(!(null==a?void 0:a.length))return void(s!==e&&t.addEdge({id:`e${Math.random()}`,source:e,target:s,data:{weight:0,minlen:r}}));const u=S(t,"_bt"),h=S(t,"_bb"),d=t.getNode(s);t.setParent(u,s),d.data.borderTop=u,t.setParent(h,s),d.data.borderBottom=h,null==a||a.forEach((a=>{F(t,e,r,n,o,i,a.id);const d=a.data.borderTop?a.data.borderTop:a.id,c=a.data.borderBottom?a.data.borderBottom:a.id,l=a.data.borderTop?n:2*n,f=d!==c?1:o-i[s]+1;t.addEdge({id:`e${Math.random()}`,source:u,target:d,data:{minlen:f,weight:l,nestingEdge:!0}}),t.addEdge({id:`e${Math.random()}`,source:c,target:h,data:{minlen:f,weight:l,nestingEdge:!0}})})),t.getParent(s)||t.addEdge({id:`e${Math.random()}`,source:e,target:u,data:{weight:0,minlen:o+i[s]}})},q="edge-label",V=function(t){return Array.isArray?Array.isArray(t):g(t,"Array")};var B=function(t){if("object"!=typeof t||null===t)return t;var e;if(V(t)){e=[];for(var r=0,n=t.length;r<n;r++)"object"==typeof t[r]&&null!=t[r]?e[r]=B(t[r]):e[r]=t[r]}else for(var o in e={},t)"object"==typeof t[o]&&null!=t[o]?e[o]=B(t[o]):e[o]=t[o];return e};const U=B,$=(t,e,r)=>{const n=(s=r,a=r.map(((t,e)=>e)),null==s?void 0:s.reduce(((t,e,r)=>(t[e]=a[r],t)),{})),o=e.map((e=>{const r=t.getRelatedEdges(e,"out").map((t=>({pos:n[t.target]||0,weight:t.data.weight})));return null==r?void 0:r.sort(((t,e)=>t.pos-e.pos))})),i=o.flat().filter((t=>void 0!==t));var s,a;let u=1;for(;u<r.length;)u<<=1;const h=2*u-1;u-=1;const d=Array(h).fill(0,0,h);let c=0;return null==i||i.forEach((t=>{if(t){let e=t.pos+u;d[e]+=t.weight;let r=0;for(;e>0;)e%2&&(r+=d[e+1]),e=e-1>>1,d[e]+=t.weight;c+=t.weight*r}})),c},G=(t,e)=>{let r=0;for(let n=1;n<(null==e?void 0:e.length);n+=1)r+=$(t,e[n-1],e[n]);return r},W=t=>{const e={},r=t.getAllNodes(),n=r.map((t=>{var e;return null!==(e=t.data.rank)&&void 0!==e?e:-1/0})),o=Math.max(...n),i=[];for(let t=0;t<o+1;t++)i.push([]);const s=r.sort(((e,r)=>t.getNode(e.id).data.rank-t.getNode(r.id).data.rank)),a=s.filter((e=>void 0!==t.getNode(e.id).data.fixorder)).sort(((e,r)=>t.getNode(e.id).data.fixorder-t.getNode(r.id).data.fixorder));return null==a||a.forEach((r=>{isNaN(t.getNode(r.id).data.rank)||i[t.getNode(r.id).data.rank].push(r.id),e[r.id]=!0})),null==s||s.forEach((r=>t.dfsTree(r.id,(t=>{if(e.hasOwnProperty(t.id))return!0;e[t.id]=!0,isNaN(t.data.rank)||i[t.data.rank].push(t.id)})))),i},K=(t,e)=>{var r;let n=0,o=0;t.weight&&(n+=t.barycenter*t.weight,o+=t.weight),e.weight&&(n+=e.barycenter*e.weight,o+=e.weight),t.vs=null===(r=e.vs)||void 0===r?void 0:r.concat(t.vs),t.barycenter=n/o,t.weight=o,t.i=Math.min(e.i,t.i),e.merged=!0},Y=(t,e)=>{var r,n,o;const i={};null==t||t.forEach(((t,e)=>{i[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};const r=i[t.v];void 0!==t.barycenter&&(r.barycenter=t.barycenter,r.weight=t.weight)})),null===(r=e.getAllEdges())||void 0===r||r.forEach((t=>{const e=i[t.source],r=i[t.target];void 0!==e&&void 0!==r&&(r.indegree++,e.out.push(i[t.target]))}));return(t=>{var e,r;const n=[];for(;null==t?void 0:t.length;){const o=t.pop();n.push(o),null===(e=o.in.reverse())||void 0===e||e.forEach((t=>{return(e=o,t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&K(e,t)})(t);var e})),null===(r=o.out)||void 0===r||r.forEach((e=>{return(r=o,e=>{e.in.push(r),0==--e.indegree&&t.push(e)})(e);var r}))}const o=n.filter((t=>!t.merged)),i=["vs","i","barycenter","weight"];return o.map((t=>{const e={};return null==i||i.forEach((r=>{void 0!==t[r]&&(e[r]=t[r])})),e}))})(null===(o=(n=Object.values(i)).filter)||void 0===o?void 0:o.call(n,(t=>!t.indegree)))},H=(t,e,r)=>{let n,o=r;for(;e.length&&(n=e[e.length-1]).i<=o;)e.pop(),null==t||t.push(n.vs),o++;return o},J=(t,e,r,n,o,i)=>{var s,a,u,h;let d=t.getChildren(e).map((t=>t.id));const c=t.getNode(e),l=c?c.data.borderLeft:void 0,f=c?c.data.borderRight:void 0,g={};l&&(d=null==d?void 0:d.filter((t=>t!==l&&t!==f)));const p=((t,e)=>e.map((e=>{const r=t.getRelatedEdges(e,"in");if(!(null==r?void 0:r.length))return{v:e};const n={sum:0,weight:0};return null==r||r.forEach((e=>{const r=t.getNode(e.source);n.sum+=e.data.weight*r.data.order,n.weight+=e.data.weight})),{v:e,barycenter:n.sum/n.weight,weight:n.weight}})))(t,d||[]);null==p||p.forEach((e=>{var o;if(null===(o=t.getChildren(e.v))||void 0===o?void 0:o.length){const o=J(t,e.v,r,n,i);g[e.v]=o,o.hasOwnProperty("barycenter")&&X(e,o)}}));const v=Y(p,r);Q(v,g),null===(s=v.filter((t=>t.vs.length>0)))||void 0===s||s.forEach((e=>{const r=t.getNode(e.vs[0]);r&&(e.fixorder=r.data.fixorder,e.order=r.data.order)}));const m=((t,e,r,n)=>{const o=((t,e)=>{const r={lhs:[],rhs:[]};return null==t||t.forEach((t=>{(t=>{const e=t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder);return n?!e&&t.hasOwnProperty("barycenter"):e||t.hasOwnProperty("barycenter")})(t)?r.lhs.push(t):r.rhs.push(t)})),r})(t),i=o.lhs,s=o.rhs.sort(((t,e)=>-t.i- -e.i)),a=[];let u=0,h=0,d=0;null==i||i.sort(((t,e)=>(r,n)=>{if(void 0!==r.fixorder&&void 0!==n.fixorder)return r.fixorder-n.fixorder;if(r.barycenter<n.barycenter)return-1;if(r.barycenter>n.barycenter)return 1;if(e&&void 0!==r.order&&void 0!==n.order){if(r.order<n.order)return-1;if(r.order>n.order)return 1}return t?n.i-r.i:r.i-n.i})(!!e,!!r)),d=H(a,s,d),null==i||i.forEach((t=>{var e;d+=null===(e=t.vs)||void 0===e?void 0:e.length,a.push(t.vs),u+=t.barycenter*t.weight,h+=t.weight,d=H(a,s,d)}));const c={vs:a.flat()};return h&&(c.barycenter=u/h,c.weight=h),c})(v,n,o,i);if(l&&(m.vs=[l,m.vs,f].flat(),null===(a=t.getPredecessors(l))||void 0===a?void 0:a.length)){const e=t.getNode((null===(u=t.getPredecessors(l))||void 0===u?void 0:u[0].id)||""),r=t.getNode((null===(h=t.getPredecessors(f))||void 0===h?void 0:h[0].id)||"");m.hasOwnProperty("barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+e.data.order+r.data.order)/(m.weight+2),m.weight+=2}return m},Q=(t,e)=>{null==t||t.forEach((t=>{var r;const n=null===(r=t.vs)||void 0===r?void 0:r.map((t=>e[t]?e[t].vs:t));t.vs=n.flat()}))},X=(t,e)=>{void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)},Z=(t,e,r)=>e.map((e=>((t,e,r)=>{const n=(t=>{let e;for(;t.hasNode(e=`_root${Math.random()}`););return e})(t),o=new l({tree:[{id:n,children:[],data:{}}]});return t.getAllNodes().forEach((i=>{const s=t.getParent(i.id);(i.data.rank===e||i.data.minRank<=e&&e<=i.data.maxRank)&&(o.hasNode(i.id)||o.addNode(Object.assign({},i)),(null==s?void 0:s.id)&&!o.hasNode(null==s?void 0:s.id)&&o.addNode(Object.assign({},s)),o.setParent(i.id,(null==s?void 0:s.id)||n),t.getRelatedEdges(i.id,r).forEach((e=>{const r=e.source===i.id?e.target:e.source;o.hasNode(r)||o.addNode(Object.assign({},t.getNode(r)));const n=o.getRelatedEdges(r,"out").find((({target:t})=>t===i.id)),s=void 0!==n?n.data.weight:0;n?o.updateEdgeData(n.id,Object.assign(Object.assign({},n.data),{weight:e.data.weight+s})):o.addEdge({id:e.id,source:r,target:i.id,data:{weight:e.data.weight+s}})})),i.data.hasOwnProperty("minRank")&&o.updateNodeData(i.id,Object.assign(Object.assign({},i.data),{borderLeft:i.data.borderLeft[e],borderRight:i.data.borderRight[e]})))})),o})(t,e,r))),tt=(t,e,r,n)=>{const o=new l;null==t||t.forEach((t=>{var i;const s=t.getRoots()[0].id,a=J(t,s,o,e,r,n);for(let e=0;e<(null===(i=a.vs)||void 0===i?void 0:i.length);e++){const r=t.getNode(a.vs[e]);r&&(r.data.order=e)}((t,e,r)=>{const n={};let o;null==r||r.forEach((r=>{let i,s,a=t.getParent(r);for(;a;){if(i=t.getParent(a.id),i?(s=n[i.id],n[i.id]=a.id):(s=o,o=a.id),s&&s!==a.id)return e.hasNode(s)||e.addNode({id:s,data:{}}),e.hasNode(a.id)||e.addNode({id:a.id,data:{}}),void(e.hasEdge(`e${s}-${a.id}`)||e.addEdge({id:`e${s}-${a.id}`,source:s,target:a.id,data:{}}));a=i}}))})(t,o,a.vs)}))},et=(t,e)=>{null==e||e.forEach((e=>{null==e||e.forEach(((e,r)=>{t.getNode(e).data.order=r}))}))},rt=(t,e)=>{var r,n;if(null===(r=t.getNode(e))||void 0===r?void 0:r.data.dummy)return null===(n=t.getPredecessors(e))||void 0===n?void 0:n.find((e=>t.getNode(e.id).data.dummy))},nt=(t,e,r)=>{let n=e,o=r;if(n>o){const t=n;n=o,o=t}let i=t[n];i||(t[n]=i={}),i[o]=!0},ot=(t,e,r)=>{let n=e,o=r;return n>r&&(n=r,o=e),!!t[n]},it=(t,e,r,n,o,i)=>{const s=new l,a=st(n,o,i);return null==e||e.forEach((e=>{let n;null==e||e.forEach((e=>{const o=r[e];if(s.hasNode(o)||s.addNode({id:o,data:{}}),n){const i=r[n],u=s.getRelatedEdges(i,"out").find((t=>t.target===o));u?s.updateEdgeData(u.id,Object.assign(Object.assign({},u.data),{weight:Math.max(a(t,e,n),u.data.weight||0)})):s.addEdge({id:`e${Math.random()}`,source:i,target:o,data:{weight:Math.max(a(t,e,n),0)}})}n=e}))})),s};const st=(t,e,r)=>(n,o,i)=>{const s=n.getNode(o),a=n.getNode(i);let u=0,h=0;if(u+=s.data.width/2,s.data.hasOwnProperty("labelpos"))switch((s.data.labelpos||"").toLowerCase()){case"l":h=-s.data.width/2;break;case"r":h=s.data.width/2}if(h&&(u+=r?h:-h),h=0,u+=(s.data.dummy?e:t)/2,u+=(a.data.dummy?e:t)/2,u+=a.data.width/2,a.data.labelpos)switch((a.data.labelpos||"").toLowerCase()){case"l":h=a.data.width/2;break;case"r":h=-a.data.width/2}return h&&(u+=r?h:-h),h=0,u},at=(t,e)=>t.getNode(e).data.width||0,ut=(t,e)=>{var r;const n=k(t);((t,e)=>{const{ranksep:r=0}=e||{},n=j(t);let o=0;null==n||n.forEach((e=>{const n=e.map((e=>t.getNode(e).data.height)),i=Math.max(...n,0);null==e||e.forEach((e=>{t.getNode(e).data.y=o+i/2})),o+=i+r}))})(n,e);const o=((t,e)=>{const{align:r,nodesep:n=0,edgesep:o=0}=e||{},i=j(t),s=Object.assign(((t,e)=>{const r={};return(null==e?void 0:e.length)&&e.reduce(((e,n)=>{let o=0,i=0;const s=e.length,a=null==n?void 0:n[(null==n?void 0:n.length)-1];return null==n||n.forEach(((e,u)=>{var h;const d=rt(t,e),c=d?t.getNode(d.id).data.order:s;(d||e===a)&&(null===(h=n.slice(i,u+1))||void 0===h||h.forEach((e=>{var n;null===(n=t.getPredecessors(e))||void 0===n||n.forEach((n=>{var i;const s=t.getNode(n.id),a=s.data.order;!(a<o||c<a)||s.data.dummy&&(null===(i=t.getNode(e))||void 0===i?void 0:i.data.dummy)||nt(r,n.id,e)}))})),i=u+1,o=c)})),n})),r})(t,i),((t,e)=>{const r={};function n(e,n){const o=function(t){return JSON.stringify(t.slice(1))}(e);n.get(o)||(function(e,n,o,i,s){var a,u;let h;for(let d=n;d<o;d++)h=e[d],(null===(a=t.getNode(h))||void 0===a?void 0:a.data.dummy)&&(null===(u=t.getPredecessors(h))||void 0===u||u.forEach((e=>{const n=t.getNode(e.id);n.data.dummy&&(n.data.order<i||n.data.order>s)&&nt(r,e.id,h)})))}(...e),n.set(o,!0))}return(null==e?void 0:e.length)&&e.reduce(((e,r)=>{let o,i=-1,s=0;const a=new Map;return null==r||r.forEach(((u,h)=>{var d;if("border"===(null===(d=t.getNode(u))||void 0===d?void 0:d.data.dummy)){const e=t.getPredecessors(u)||[];e.length&&(o=t.getNode(e[0].id).data.order,n([r,s,h,i,o],a),s=h,i=o)}n([r,s,r.length,o,e.length],a)})),r})),r})(t,i)),a={};let u=[];["u","d"].forEach((e=>{u="u"===e?i:Object.values(i).reverse(),["l","r"].forEach((r=>{"r"===r&&(u=u.map((t=>Object.values(t).reverse())));const i=("u"===e?t.getPredecessors:t.getSuccessors).bind(t),h=((t,e,r,n)=>{const o={},i={},s={};return null==e||e.forEach((t=>{null==t||t.forEach(((t,e)=>{o[t]=t,i[t]=t,s[t]=e}))})),null==e||e.forEach((t=>{let e=-1;null==t||t.forEach((t=>{let a=n(t).map((t=>t.id));if(a.length){a=a.sort(((t,e)=>s[t]-s[e]));const n=(a.length-1)/2;for(let u=Math.floor(n),h=Math.ceil(n);u<=h;++u){const n=a[u];i[t]===t&&e<s[n]&&!ot(r,t,n)&&(i[n]=t,i[t]=o[t]=o[n],e=s[n])}}}))})),{root:o,align:i}})(0,u,s,i),d=((t,e,r,n,o,i,s)=>{var a;const u={},h=it(t,e,r,o,i,s),d=s?"borderLeft":"borderRight",c=(t,e)=>{let r=h.getAllNodes(),n=r.pop();const o={};for(;n;)o[n.id]?t(n.id):(o[n.id]=!0,r.push(n),r=r.concat(e(n.id))),n=r.pop()};return c((t=>{u[t]=(h.getRelatedEdges(t,"in")||[]).reduce(((t,e)=>Math.max(t,(u[e.source]||0)+e.data.weight)),0)}),h.getPredecessors.bind(h)),c((e=>{const r=(h.getRelatedEdges(e,"out")||[]).reduce(((t,e)=>Math.min(t,(u[e.target]||0)-e.data.weight)),Number.POSITIVE_INFINITY),n=t.getNode(e);r!==Number.POSITIVE_INFINITY&&n.data.borderType!==d&&(u[e]=Math.max(u[e],r))}),h.getSuccessors.bind(h)),null===(a=Object.values(n))||void 0===a||a.forEach((t=>{u[t]=u[r[t]]})),u})(t,u,h.root,h.align,n,o,"r"===r);"r"===r&&Object.keys(d).forEach((t=>d[t]=-d[t])),a[e+r]=d}))}));const h=((t,e)=>z(Object.values(e),(e=>{var r;let n=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return null===(r=Object.keys(e))||void 0===r||r.forEach((r=>{const i=e[r],s=at(t,r)/2;n=Math.max(i+s,n),o=Math.min(i-s,o)})),n-o})))(t,a);return h&&function(t,e){const r=Object.values(e),n=Math.min(...r),o=Math.max(...r);["u","d"].forEach((r=>{["l","r"].forEach((i=>{const s=r+i,a=t[s];let u;if(a===e)return;const h=Object.values(a);u="l"===i?n-Math.min(...h):o-Math.max(...h),u&&(t[s]={},Object.keys(a).forEach((e=>{t[s][e]=a[e]+u})))}))}))}(a,h),((t,e)=>{const r={};return Object.keys(t.ul).forEach((n=>{if(e)r[n]=t[e.toLowerCase()][n];else{const e=Object.values(t).map((t=>t[n]));r[n]=(e[0]+e[1])/2}})),r})(a,r)})(n,e);null===(r=Object.keys(o))||void 0===r||r.forEach((t=>{n.getNode(t).data.x=o[t]}))},ht=t=>{const e={},r=n=>{var o;const i=t.getNode(n);if(!i)return 0;if(e[n])return i.data.rank;let s;return e[n]=!0,null===(o=t.getRelatedEdges(n,"out"))||void 0===o||o.forEach((t=>{const e=r(t.target)-t.data.minlen;e&&(void 0===s||e<s)&&(s=e)})),s||(s=0),i.data.rank=s,s};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>r(t.id)))},dt=(t,e)=>t.getNode(e.target).data.rank-t.getNode(e.source).data.rank-e.data.minlen,ct=(t,e)=>{const r=n=>{e.getRelatedEdges(n,"both").forEach((o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||dt(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},lt=(t,e)=>{const r=n=>{var o;null===(o=e.getRelatedEdges(n,"both"))||void 0===o||o.forEach((o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||void 0===e.getNode(s).data.layer&&dt(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},ft=(t,e)=>z(e.getAllEdges(),(r=>t.hasNode(r.source)!==t.hasNode(r.target)?dt(e,r):1/0)),gt=(t,e,r)=>{t.getAllNodes().forEach((t=>{const n=e.getNode(t.id);n.data.rank||(n.data.rank=0),n.data.rank+=r}))},pt=(t,e)=>{let r=I(t,t.getAllNodes(),"post",!1);r=r.slice(0,(null==r?void 0:r.length)-1),r.forEach((r=>{vt(t,e,r)}))},vt=(t,e,r)=>{const n=t.getNode(r).data.parent;t.getRelatedEdges(r,"both").find((t=>t.target===n||t.source===n)).data.cutvalue=mt(t,e,r)},mt=(t,e,r)=>{const n=t.getNode(r).data.parent;let o=!0,i=e.getRelatedEdges(r,"out").find((t=>t.target===n)),s=0;return i||(o=!1,i=e.getRelatedEdges(n,"out").find((t=>t.target===r))),s=i.data.weight,e.getRelatedEdges(r,"both").forEach((e=>{const i=e.source===r,a=i?e.target:e.source;if(a!==n){const n=i===o,u=e.data.weight;if(s+=n?u:-u,Mt(t,r,a)){const e=t.getRelatedEdges(r,"both").find((t=>t.source===a||t.target===a)).data.cutvalue;s+=n?-e:e}}})),s},yt=(t,e=t.getAllNodes()[0].id)=>{wt(t,{},1,e)},wt=(t,e,r,n,o)=>{var i;const s=r;let a=r;const u=t.getNode(n);return e[n]=!0,null===(i=t.getNeighbors(n))||void 0===i||i.forEach((r=>{e[r.id]||(a=wt(t,e,a,r.id,n))})),u.data.low=s,u.data.lim=a++,o?u.data.parent=o:delete u.data.parent,a},xt=t=>t.getAllEdges().find((t=>t.data.cutvalue<0)),bt=(t,e,r)=>{let n=r.source,o=r.target;e.getRelatedEdges(n,"out").find((t=>t.target===o))||(n=r.target,o=r.source);const i=t.getNode(n),s=t.getNode(o);let a=i,u=!1;i.data.lim>s.data.lim&&(a=s,u=!0);const h=e.getAllEdges().filter((e=>u===_t(t.getNode(e.source),a)&&u!==_t(t.getNode(e.target),a)));return z(h,(t=>dt(e,t)))},Et=(t,e,r,n)=>{const o=t.getRelatedEdges(r.source,"both").find((t=>t.source===r.target||t.target===r.target));o&&t.removeEdge(o.id),t.addEdge({id:`e${Math.random()}`,source:n.source,target:n.target,data:{}}),yt(t),pt(t,e),Nt(t,e)},Nt=(t,e)=>{const r=t.getAllNodes().find((t=>!t.data.parent));let n=I(t,r,"pre",!1);n=n.slice(1),n.forEach((r=>{const n=t.getNode(r).data.parent;let o=e.getRelatedEdges(r,"out").find((t=>t.target===n)),i=!1;!o&&e.hasNode(n)&&(o=e.getRelatedEdges(n,"out").find((t=>t.target===r)),i=!0),e.getNode(r).data.rank=(e.hasNode(n)&&e.getNode(n).data.rank||0)+(i?null==o?void 0:o.data.minlen:-(null==o?void 0:o.data.minlen))}))},Mt=(t,e,r)=>t.getRelatedEdges(e,"both").find((t=>t.source===r||t.target===r)),_t=(t,e)=>e.data.low<=t.data.lim&&t.data.lim<=e.data.lim,kt=ht,At=t=>{(t=>{const e=(t=>{const e=new l;return t.getAllNodes().forEach((t=>{e.addNode(Object.assign({},t))})),t.getAllEdges().forEach((t=>{const r=e.getRelatedEdges(t.source,"out").find((e=>e.target===t.target));r?e.updateEdgeData(null==r?void 0:r.id,Object.assign(Object.assign({},r.data),{weight:r.data.weight+t.data.weight||0,minlen:Math.max(r.data.minlen,t.data.minlen||1)})):e.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||0,minlen:t.data.minlen||1}})})),e})(t);ht(e);const r=(t=>{const e=new l({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);ct(e,t)<n;)o=ft(e,t),i=e.hasNode(o.source)?dt(t,o):-dt(t,o),gt(e,t,i);return e})(e);let n,o;for(yt(r),pt(r,e);n=xt(r);)o=bt(r,e,n),Et(r,e,n,o)})(t)},jt=(t,e)=>{const{acyclicer:r,ranker:n,rankdir:o="tb",nodeOrder:i,keepNodeOrder:s,align:a,nodesep:u=50,edgesep:h=20,ranksep:d=50}=e;Bt(t),N(t,r);const{nestingRoot:c,nodeRankFactor:f}=(t=>{const e=_(t,"root",{},"_root"),r=(t=>{const e={},r=(n,o)=>{const i=t.getChildren(n);null==i||i.forEach((t=>r(t.id,o+1))),e[n]=o};return t.getRoots().forEach((t=>r(t.id,1))),e})(t);let n=Math.max(...Object.values(r));Math.abs(n)===1/0&&(n=1);const o=n-1,i=2*o+1;t.getAllEdges().forEach((t=>{t.data.minlen*=i}));const s=(t=>{let e=0;return t.getAllEdges().forEach((t=>{e+=t.data.weight})),e})(t)+1;return t.getRoots().forEach((n=>{F(t,e,i,s,o,r,n.id)})),{nestingRoot:e,nodeRankFactor:i}})(t);((t,e)=>{switch(e){case"network-simplex":At(t);break;case"tight-tree":default:(t=>{(t=>{const e={};let r;const n=o=>{var i;const s=t.getNode(o);if(!s)return 0;if(e[o])return s.data.rank;let a;return e[o]=!0,null===(i=t.getRelatedEdges(o,"out"))||void 0===i||i.forEach((t=>{const e=n(t.target)-t.data.minlen;e&&(void 0===a||e<a)&&(a=e)})),a||(a=0),(void 0===r||a<r)&&(r=a),s.data.rank=a,a};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>{t&&n(t.id)})),void 0===r&&(r=0);const o={},i=(e,r)=>{var n;const s=t.getNode(e),a=isNaN(s.data.layer)?r:s.data.layer;(void 0===s.data.rank||s.data.rank<a)&&(s.data.rank=a),o[e]||(o[e]=!0,null===(n=t.getRelatedEdges(e,"out"))||void 0===n||n.forEach((t=>{i(t.target,a+t.data.minlen)})))};t.getAllNodes().forEach((t=>{const e=t.data;e&&(isNaN(e.layer)?e.rank-=r:i(t.id,e.layer))}))})(t),(t=>{const e=new l({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);lt(e,t)<n;)o=ft(e,t),i=e.hasNode(o.source)?dt(t,o):-dt(t,o),gt(e,t,i)})(t)})(t);break;case"longest-path":kt(t)}})(k(t),n),Ct(t),((t,e=0)=>{const r=t.getAllNodes(),n=r.filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),o=Math.min(...n),i=[];r.forEach((t=>{const e=(t.data.rank||0)-o;i[e]||(i[e]=[]),i[e].push(t.id)}));let s=0;for(let r=0;r<i.length;r++){const n=i[r];void 0===n?r%e!=0&&(s-=1):s&&(null==n||n.forEach((e=>{const r=t.getNode(e);r&&(r.data.rank=r.data.rank||0,r.data.rank+=s)})))}})(t,f),((t,e)=>{e&&t.removeNode(e),t.getAllEdges().forEach((e=>{e.data.nestingEdge&&t.removeEdge(e.id)}))})(t,c),(t=>{const e=t.getAllNodes().filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),r=Math.min(...e);t.getAllNodes().forEach((t=>{t.data.hasOwnProperty("rank")&&r!==1/0&&(t.data.rank-=r)}))})(t),Dt(t),Pt(t);const g=[];((t,e)=>{t.getAllEdges().forEach((r=>((t,e,r)=>{let n=e.source,o=t.getNode(n).data.rank;const i=e.target,s=t.getNode(i).data.rank,a=e.data.labelRank;if(s===o+1)return;let u,h,d;for(t.removeEdge(e.id),d=0,++o;o<s;++d,++o)e.data.points=[],h={originalEdge:e,width:0,height:0,rank:o},u=_(t,"edge",h,"_d"),o===a&&(h.width=e.data.width,h.height=e.data.height,h.dummy=q,h.labelpos=e.data.labelpos),t.addEdge({id:`e${Math.random()}`,source:n,target:u,data:{weight:e.data.weight}}),0===d&&r.push(u),n=u;t.addEdge({id:`e${Math.random()}`,source:n,target:i,data:{weight:e.data.weight}})})(t,r,e)))})(t,g),((t,e)=>{const r=(t=>{const e={};let r=0;const n=o=>{const i=r;t.getChildren(o).forEach((t=>n(t.id))),e[o]={low:i,lim:r++}};return t.getRoots().forEach((t=>n(t.id))),e})(t);e.forEach((e=>{var n,o;let i=e,s=t.getNode(i);const a=s.data.originalEdge;if(!a)return;const u=((t,e,r,n)=>{var o,i;const s=[],a=[],u=Math.min(e[r].low,e[n].low),h=Math.max(e[r].lim,e[n].lim);let d,c;d=r;do{d=null===(o=t.getParent(d))||void 0===o?void 0:o.id,s.push(d)}while(d&&(e[d].low>u||h>e[d].lim));for(c=d,d=n;d&&d!==c;)a.push(d),d=null===(i=t.getParent(d))||void 0===i?void 0:i.id;return{lca:c,path:s.concat(a.reverse())}})(t,r,a.source,a.target),h=u.path,d=u.lca;let c=0,l=h[c],f=!0;for(;i!==a.target;){if(s=t.getNode(i),f){for(;l!==d&&(null===(n=t.getNode(l))||void 0===n?void 0:n.data.maxRank)<s.data.rank;)c++,l=h[c];l===d&&(f=!1)}if(!f){for(;c<h.length-1&&(null===(o=t.getNode(h[c+1]))||void 0===o?void 0:o.data.minRank)<=s.data.rank;)c++;l=h[c]}t.hasNode(l)&&t.setParent(i,l),i=t.getSuccessors(i)[0].id}}))})(t,g),(t=>{const e=r=>{const n=t.getChildren(r),o=t.getNode(r);if((null==n?void 0:n.length)&&n.forEach((t=>e(t.id))),o.data.hasOwnProperty("minRank")){o.data.borderLeft=[],o.data.borderRight=[];for(let e=o.data.minRank,n=o.data.maxRank+1;e<n;e+=1)C(t,"borderLeft","_bl",r,o,e),C(t,"borderRight","_br",r,o,e)}};t.getRoots().forEach((t=>e(t.id)))})(t),s&&((t,e)=>{const r=t.getAllNodes().filter((e=>{var r;return!(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length)})).map((t=>t.data.rank)),n=Math.max(...r),o=[];for(let t=0;t<n+1;t++)o[t]=[];null==e||e.forEach((e=>{const r=t.getNode(e);r&&!r.data.dummy&&(isNaN(r.data.rank)||(r.data.fixorder=o[r.data.rank].length,o[r.data.rank].push(e)))}))})(t,i),((t,e)=>{const r=O(t),n=[],o=[];for(let t=1;t<r+1;t++)n.push(t);for(let t=r-1;t>-1;t--)o.push(t);const i=Z(t,n,"in"),s=Z(t,o,"out");let a=W(t);et(t,a);let u,h=Number.POSITIVE_INFINITY;for(let r=0,n=0;n<4;++r,++n){tt(r%2?i:s,r%4>=2,!1,e),a=j(t);const o=G(t,a);o<h&&(n=0,u=U(a),h=o)}a=W(t),et(t,a);for(let r=0,n=0;n<4;++r,++n){tt(r%2?i:s,r%4>=2,!0,e),a=j(t);const o=G(t,a);o<h&&(n=0,u=U(a),h=o)}et(t,u)})(t,s),Ut(t),((t,e)=>{const r=e.toLowerCase();"lr"!==r&&"rl"!==r||D(t)})(t,o),ut(t,{align:a,nodesep:u,edgesep:h,ranksep:d}),$t(t),Vt(t),((t,e)=>{e.forEach((e=>{let r=t.getNode(e);const{data:n}=r,o=n.originalEdge;let i;o&&t.addEdge(o);let s=e;for(;r.data.dummy;)i=t.getSuccessors(s)[0],t.removeNode(s),o.data.points.push({x:r.data.x,y:r.data.y}),r.data.dummy===q&&(o.data.x=r.data.x,o.data.y=r.data.y,o.data.width=r.data.width,o.data.height=r.data.height),s=i.id,r=t.getNode(s)}))})(t,g),Ft(t),((t,e)=>{const r=e.toLowerCase();"bt"!==r&&"rl"!==r||(t=>{t.getAllNodes().forEach((t=>{T(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>T(t))),t.data.hasOwnProperty("y")&&T(t.data)}))})(t),"lr"!==r&&"rl"!==r||((t=>{t.getAllNodes().forEach((t=>{L(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>L(t))),t.data.hasOwnProperty("x")&&L(t.data)}))})(t),D(t))})(t,o);const{width:p,height:v}=Tt(t);return Lt(t),qt(t),(t=>{t.getAllEdges().forEach((e=>{const r=e.data;if(r.reversed){t.removeEdge(e.id);const n=r.forwardName;delete r.reversed,delete r.forwardName,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign(Object.assign({},r),{forwardName:n})})}}))})(t),{width:p,height:v}},St=["width","height","layer","fixorder"],Ot={width:0,height:0},zt=["minlen","weight","width","height","labeloffset"],Rt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},It=["labelpos"],Ct=t=>{t.getAllEdges().forEach((e=>{if(e.data.width&&e.data.height){const r=t.getNode(e.source),n={e,rank:(t.getNode(e.target).data.rank-r.data.rank)/2+r.data.rank};_(t,"edge-proxy",n,"_ep")}}))},Dt=t=>{let e=0;return t.getAllNodes().forEach((r=>{var n,o;r.data.borderTop&&(r.data.minRank=null===(n=t.getNode(r.data.borderTop))||void 0===n?void 0:n.data.rank,r.data.maxRank=null===(o=t.getNode(r.data.borderBottom))||void 0===o?void 0:o.data.rank,e=Math.max(e,r.data.maxRank||-1/0))})),e},Pt=t=>{t.getAllNodes().forEach((e=>{"edge-proxy"===e.data.dummy&&(t.getEdge(e.data.e.id).data.labelRank=e.data.rank,t.removeNode(e.id))}))},Tt=(t,e)=>{let r,n,o=0,i=0;const{marginx:s=0,marginy:a=0}=e||{},u=t=>{if(!t.data)return;const e=t.data.x,s=t.data.y,a=t.data.width,u=t.data.height;isNaN(e)||isNaN(a)||(void 0===r&&(r=e-a/2),r=Math.min(r,e-a/2),o=Math.max(o,e+a/2)),isNaN(s)||isNaN(u)||(void 0===n&&(n=s-u/2),n=Math.min(n,s-u/2),i=Math.max(i,s+u/2))};return t.getAllNodes().forEach((t=>{u(t)})),t.getAllEdges().forEach((t=>{(null==t?void 0:t.data.hasOwnProperty("x"))&&u(t)})),r-=s,n-=a,t.getAllNodes().forEach((t=>{t.data.x-=r,t.data.y-=n})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>{t.x-=r,t.y-=n})),t.data.hasOwnProperty("x")&&(t.data.x-=r),t.data.hasOwnProperty("y")&&(t.data.y-=n)})),{width:o-r+s,height:i-n+a}},Lt=t=>{t.getAllEdges().forEach((e=>{const r=t.getNode(e.source),n=t.getNode(e.target);let o,i;e.data.points?(o=e.data.points[0],i=e.data.points[e.data.points.length-1]):(e.data.points=[],o={x:n.data.x,y:n.data.y},i={x:r.data.x,y:r.data.y}),e.data.points.unshift(A(r.data,o)),e.data.points.push(A(n.data,i))}))},Ft=t=>{t.getAllEdges().forEach((t=>{if(t.data.hasOwnProperty("x"))switch("l"!==t.data.labelpos&&"r"!==t.data.labelpos||(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset}}))},qt=t=>{t.getAllEdges().forEach((t=>{var e;t.data.reversed&&(null===(e=t.data.points)||void 0===e||e.reverse())}))},Vt=t=>{t.getAllNodes().forEach((e=>{var r,n,o;if(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length){const r=t.getNode(e.id),i=t.getNode(r.data.borderTop),s=t.getNode(r.data.borderBottom),a=t.getNode(r.data.borderLeft[(null===(n=r.data.borderLeft)||void 0===n?void 0:n.length)-1]),u=t.getNode(r.data.borderRight[(null===(o=r.data.borderRight)||void 0===o?void 0:o.length)-1]);r.data.width=Math.abs((null==u?void 0:u.data.x)-(null==a?void 0:a.data.x))||10,r.data.height=Math.abs((null==s?void 0:s.data.y)-(null==i?void 0:i.data.y))||10,r.data.x=((null==a?void 0:a.data.x)||0)+r.data.width/2,r.data.y=((null==i?void 0:i.data.y)||0)+r.data.height/2}})),t.getAllNodes().forEach((e=>{"border"===e.data.dummy&&t.removeNode(e.id)}))},Bt=t=>{t.getAllEdges().forEach((e=>{if(e.source===e.target){const r=t.getNode(e.source);r.data.selfEdges||(r.data.selfEdges=[]),r.data.selfEdges.push(e),t.removeEdge(e.id)}}))},Ut=t=>{const e=j(t);null==e||e.forEach((e=>{let r=0;null==e||e.forEach(((e,n)=>{var o;const i=t.getNode(e);i.data.order=n+r,null===(o=i.data.selfEdges)||void 0===o||o.forEach((e=>{_(t,"selfedge",{width:e.data.width,height:e.data.height,rank:i.data.rank,order:n+ ++r,e},"_se")})),delete i.data.selfEdges}))}))},$t=t=>{t.getAllNodes().forEach((e=>{const r=t.getNode(e.id);if("selfedge"===r.data.dummy){const n=t.getNode(r.data.e.source),o=n.data.x+n.data.width/2,i=n.data.y,s=r.data.x-o,a=n.data.height/2;t.hasEdge(r.data.e.id)?t.updateEdgeData(r.data.e.id,r.data.e.data):t.addEdge({id:r.data.e.id,source:r.data.e.source,target:r.data.e.target,data:r.data.e.data}),t.removeNode(e.id),r.data.e.data.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{y:i,x:o+s},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.data.e.data.x=r.data.x,r.data.e.data.y=r.data.y}}))},Gt=(t,e)=>{const r={};return null==e||e.forEach((e=>{void 0!==t[e]&&(r[e]=+t[e])})),r},Wt=(t={})=>{const e={};return Object.keys(t).forEach((r=>{e[r.toLowerCase()]=t[r]})),e},Kt=function(t){return"function"==typeof t},Yt=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};function Ht(t,e){let r;return r=Kt(e)?e:p(e)?()=>e:()=>t,r}function Jt(t,e,r=!0){return e||0===e?Kt(e)?e:p(e)?()=>e:Array.isArray(e)?()=>{if(r){const r=Math.max(...e);return isNaN(r)?t:r}return e}:Yt(e)?()=>{if(r){const r=Math.max(e.width,e.height);return isNaN(r)?t:r}return[e.width,e.height]}:()=>t:e=>{const{size:r}=e.data||{};return r?Array.isArray(r)?r[0]>r[1]?r[0]:r[1]:Yt(r)?r.width>r.height?r.width:r.height:r:t}}const Qt=(t,e)=>{let r,n;return n=p(e)?()=>e:Kt(e)?e:()=>0,r=t?Array.isArray(t)?e=>(t[0]>t[1]?t[0]:t[1])+n(e):Kt(t)?t:e=>t+n(e):t=>{var e,r;if(null===(e=t.data)||void 0===e?void 0:e.bboxSize)return Math.max(t.data.bboxSize[0],t.data.bboxSize[1])+n(t);if(null===(r=t.data)||void 0===r?void 0:r.size){if(Array.isArray(t.data.size))return Math.max(t.data.size[0],t.data.size[1])+n(t);const e=t.data.size;return Yt(e)?(e.width>e.height?e.width:e.height)+n(t):e+n(t)}return 10+n(t)},r},Xt=t=>{if(null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array){const e=[];return t.forEach((t=>{e.push(t)})),e.map((t=>Xt(t)))}if("object"==typeof t){const e={};return Object.keys(t).forEach((r=>{e[r]=Xt(t[r])})),e}return t},Zt=(t,e)=>{const r=Xt(t);return r.data=r.data||{},e&&(p(r.data.x)||(r.data.x=Math.random()*e[0]),p(r.data.y)||(r.data.y=Math.random()*e[1])),r},te={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};class ee{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},te),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,t,r)}))}genericDagreLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{nodeSize:o,align:i,rankdir:s="TB",ranksep:a,nodesep:u,ranksepFunc:h,nodesepFunc:d,edgeLabelSpace:c,ranker:f,nodeOrder:g,begin:v,controlPoints:m,radial:y,sortByCombo:w,preset:x}=e,b=new l({tree:[]}),E=Ht(a||50,h),N=Ht(u||50,d);let M=N,_=E;"LR"!==s&&"RL"!==s||(M=E,_=N);const k=Qt(o,void 0),A=r.getAllNodes(),j=r.getAllEdges();let S;A.forEach((t=>{const e=k(t),r=_(t),n=e+2*M(t),o=e+2*r,i=t.data.layer;p(i)?b.addNode({id:t.id,data:{width:n,height:o,layer:i}}):b.addNode({id:t.id,data:{width:n,height:o}})})),w&&(b.attachTreeStructure("combo"),A.forEach((t=>{const{parentId:e}=t.data;void 0!==e&&b.hasNode(e)&&b.setParent(t.id,e,"combo")}))),j.forEach((t=>{b.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||1}})})),(null==x?void 0:x.length)&&(S=new l({nodes:x})),((t,e)=>{const{edgeLabelSpace:r,keepNodeOrder:n,prevGraph:o,rankdir:i,ranksep:s}=e;var a,u;!n&&o&&(u=o,(a=t).getAllNodes().forEach((t=>{const e=a.getNode(t.id);if(u.hasNode(t.id)){const r=u.getNode(t.id);e.data.fixorder=r.data._order,delete r.data._order}else delete e.data.fixorder})));const h=(t=>{const e=new l({tree:[]});return t.getAllNodes().forEach((r=>{const n=Wt(t.getNode(r.id).data),o=Object.assign(Object.assign({},Ot),n),i=Gt(o,St);e.hasNode(r.id)||e.addNode({id:r.id,data:Object.assign({},i)});const s=t.hasTreeStructure("combo")?t.getParent(r.id,"combo"):t.getParent(r.id);null==s||(e.hasNode(s.id)||e.addNode(Object.assign({},s)),e.setParent(r.id,s.id))})),t.getAllEdges().forEach((r=>{const n=Wt(t.getEdge(r.id).data),o={};null==It||It.forEach((t=>{void 0!==n[t]&&(o[t]=n[t])})),e.addEdge({id:r.id,source:r.source,target:r.target,data:Object.assign({},Rt,Gt(n,zt),o)})})),e})(t);let d;r&&(e.ranksep=((t,e)=>{const{ranksep:r=0,rankdir:n}=e;return t.getAllNodes().forEach((t=>{isNaN(t.data.layer)||t.data.layer||(t.data.layer=0)})),t.getAllEdges().forEach((t=>{var e;t.data.minlen*=2,"c"!==(null===(e=t.data.labelpos)||void 0===e?void 0:e.toLowerCase())&&("TB"===n||"BT"===n?t.data.width+=t.data.labeloffset:t.data.height+=t.data.labeloffset)})),r/2})(h,{rankdir:i,ranksep:s}));try{d=jt(h,e)}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:\n",t);throw t}((t,e)=>{t.getAllNodes().forEach((r=>{var n;const o=t.getNode(r.id);if(o){const t=e.getNode(r.id);o.data.x=t.data.x,o.data.y=t.data.y,o.data._order=t.data.order,o.data._rank=t.data.rank,(null===(n=e.getChildren(r.id))||void 0===n?void 0:n.length)&&(o.data.width=t.data.width,o.data.height=t.data.height)}})),t.getAllEdges().forEach((r=>{const n=t.getEdge(r.id),o=e.getEdge(r.id);n.data.points=o?o.data.points:[],o&&o.data.hasOwnProperty("x")&&(n.data.x=o.data.x,n.data.y=o.data.y)}))})(t,h)})(b,{prevGraph:S,edgeLabelSpace:c,keepNodeOrder:!!g,nodeOrder:g||[],acyclicer:"greedy",ranker:f,rankdir:s,nodesep:u,align:i});const O=[0,0];if(v){let t=1/0,e=1/0;b.getAllNodes().forEach((r=>{t>r.data.x&&(t=r.data.x),e>r.data.y&&(e=r.data.y)})),b.getAllEdges().forEach((r=>{var n;null===(n=r.data.points)||void 0===n||n.forEach((r=>{t>r.x&&(t=r.x),e>r.y&&(e=r.y)}))})),O[0]=v[0]-t,O[1]=v[1]-e}const z="LR"===s||"RL"===s;if(y);else{const t=new Set,e="BT"===s||"RL"===s?(t,e)=>e-t:(t,e)=>t-e;b.getAllNodes().forEach((e=>{e.data.x=e.data.x+O[0],e.data.y=e.data.y+O[1],t.add(z?e.data.x:e.data.y)}));const r=Array.from(t).sort(e),n=z?(t,e)=>t.x!==e.x:(t,e)=>t.y!==e.y,o=z?(t,e,r)=>{const n=Math.max(e.y,r.y),o=Math.min(e.y,r.y);return t.filter((t=>t.y<=n&&t.y>=o))}:(t,e,r)=>{const n=Math.max(e.x,r.x),o=Math.min(e.x,r.x);return t.filter((t=>t.x<=n&&t.x>=o))};b.getAllEdges().forEach(((t,e)=>{var i;c&&m&&"loop"!==t.data.type&&(t.data.controlPoints=re(null===(i=t.data.points)||void 0===i?void 0:i.map((({x:t,y:e})=>({x:t+O[0],y:e+O[1]}))),b.getNode(t.source),b.getNode(t.target),r,z,n,o))}))}let R=[];R=b.getAllNodes().map((t=>Zt(t)));const I=b.getAllEdges();return t&&(R.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),I.forEach((t=>{r.mergeEdgeData(t.id,{controlPoints:t.data.controlPoints})}))),{nodes:R,edges:I}}))}}const re=(t,e,r,n,o,i,s)=>{let a=(null==t?void 0:t.slice(1,t.length-1))||[];if(e&&r){let{x:t,y:u}=e.data,{x:h,y:d}=r.data;if(o&&(t=e.data.y,u=e.data.x,h=r.data.y,d=r.data.x),d!==u&&t!==h){const c=n.indexOf(u),l=n[c+1];if(l){const t=a[0],e=o?{x:(u+l)/2,y:(null==t?void 0:t.y)||h}:{x:(null==t?void 0:t.x)||h,y:(u+l)/2};t&&!i(t,e)||a.unshift(e)}const f=n.indexOf(d),g=Math.abs(f-c);if(1===g)a=s(a,e.data,r.data),a.length||a.push(o?{x:(u+d)/2,y:t}:{x:t,y:(u+d)/2});else if(g>1){const e=n[f-1];if(e){const r=a[a.length-1],n=o?{x:(d+e)/2,y:(null==r?void 0:r.y)||h}:{x:(null==r?void 0:r.x)||t,y:(d+e)/2};r&&!i(r,n)||a.push(n)}}}}return a},ne=(t,e,r)=>{const n=t.getAllNodes(),o=t.getAllEdges();return(null==n?void 0:n.length)?1===n.length?(e&&t.mergeNodeData(n[0].id,{x:r[0],y:r[1]}),{nodes:[Object.assign(Object.assign({},n[0]),{data:Object.assign(Object.assign({},n[0].data),{x:r[0],y:r[1]})})],edges:o}):void 0:{nodes:[],edges:o}},oe={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1};class ie{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},oe),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericCircularLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericCircularLayout(!0,t,r)}))}genericCircularLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{width:o,height:i,center:s,divisions:a,startAngle:u=0,endAngle:h=2*Math.PI,angleRatio:d,ordering:c,clockwise:l,nodeSpacing:f,nodeSize:g}=e,p=r.getAllNodes(),v=r.getAllEdges(),[m,y,w]=ae(o,i,s),x=null==p?void 0:p.length;if(!x||1===x)return ne(r,t,w);const b=(h-u)/x;let{radius:E,startRadius:N,endRadius:M}=e;if(f){const t=Ht(10,f),e=Jt(10,g);let r=-1/0;p.forEach((t=>{const n=e(t);r<n&&(r=n)}));let n=0;p.forEach(((e,o)=>{n+=0===o?r||10:(t(e)||0)+(r||10)})),E=n/(2*Math.PI)}else E||N||M?!N&&M?N=M:N&&!M&&(M=N):E=Math.min(y,m)/2;const _=b*d;let k=[];k="topology"===c?se(r,p):"topology-directed"===c?se(r,p,!0):"degree"===c?function(t,e){const r=[];return e.forEach(((t,e)=>{r.push(Zt(t))})),r.sort(((e,r)=>t.getDegree(e.id,"both")-t.getDegree(r.id,"both"))),r}(r,p):p.map((t=>Zt(t)));const A=Math.ceil(x/a);for(let t=0;t<x;++t){let e=E;e||null===N||null===M||(e=N+t*(M-N)/(x-1)),e||(e=10+100*t/(x-1));let r=u+t%A*_+2*Math.PI/a*Math.floor(t/A);l||(r=h-t%A*_-2*Math.PI/a*Math.floor(t/A)),k[t].data.x=w[0]+Math.cos(r)*e,k[t].data.y=w[1]+Math.sin(r)*e}return t&&k.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),{nodes:k,edges:v}}))}}const se=(t,e,r=!1)=>{const n=[Zt(e[0])],o={},i=e.length;o[e[0].id]=!0;let s=0;return e.forEach(((a,u)=>{if(0!==u)if(u!==i-1&&t.getDegree(a.id,"both")===t.getDegree(e[u+1].id,"both")&&!t.areNeighbors(n[s].id,a.id)||o[a.id]){const u=r?t.getSuccessors(n[s].id):t.getNeighbors(n[s].id);let h=!1;for(let e=0;e<u.length;e++){const r=u[e];if(t.getDegree(r.id)===t.getDegree(a.id)&&!o[r.id]){n.push(Zt(r)),o[r.id]=!0,h=!0;break}}let d=0;for(;!h&&(o[e[d].id]||(n.push(Zt(e[d])),o[e[d].id]=!0,h=!0),d++,d!==i););}else n.push(Zt(a)),o[a.id]=!0,s++})),n},ae=(t,e,r)=>{let n=t,o=e,i=r;return n||"undefined"==typeof window||(n=window.innerWidth),o||"undefined"==typeof window||(o=window.innerHeight),i||(i=[n/2,o/2]),[n,o,i]},ue=function(t){return g(t,"String")},he=Array.isArray,de={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class ce{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},de),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericConcentricLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericConcentricLayout(!0,t,r)}))}genericConcentricLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{center:o,width:i,height:s,sortBy:a,maxLevelDiff:u,sweep:h,clockwise:d,equidistant:c,preventOverlap:l,startAngle:f=1.5*Math.PI,nodeSize:g,nodeSpacing:v}=e,m=r.getAllNodes(),y=r.getAllEdges(),w=i||"undefined"==typeof window?i:window.innerWidth,x=s||"undefined"==typeof window?s:window.innerHeight,b=o||[w/2,x/2];if(!(null==m?void 0:m.length)||1===m.length)return ne(r,t,b);const E=[];let N,M=0;he(g)?N=Math.max(g[0],g[1]):Kt(g)?(N=-1/0,m.forEach((t=>{const e=g(t);e>N&&(N=e)}))):N=g,he(v)?M=Math.max(v[0],v[1]):p(v)&&(M=v),m.forEach((t=>{const e=Zt(t);E.push(e);let r=N;const{data:n}=e;he(n.size)?r=Math.max(n.size[0],n.size[1]):p(n.size)?r=n.size:Yt(n.size)&&(r=Math.max(n.size.width,n.size.height)),N=Math.max(N,r),Kt(v)&&(M=Math.max(v(t),M))}));const _={};E.forEach(((t,e)=>{_[t.id]=e}));let k=a;ue(k)&&void 0!==E[0].data[k]||(k="degree"),"degree"===k?E.sort(((t,e)=>r.getDegree(e.id,"both")-r.getDegree(t.id,"both"))):E.sort(((t,e)=>e.data[k]-t.data[k]));const A=E[0],j=(u||("degree"===k?r.getDegree(A.id,"both"):A.data[k]))/4,S=[{nodes:[]}];let O=S[0];E.forEach((t=>{if(O.nodes.length>0){const e="degree"===k?Math.abs(r.getDegree(O.nodes[0].id,"both")-r.getDegree(t.id,"both")):Math.abs(O.nodes[0].data[k]-t.data[k]);j&&e>=j&&(O={nodes:[]},S.push(O))}O.nodes.push(t)}));let z=N+M;if(!l){const t=S.length>0&&S[0].nodes.length>1,e=(Math.min(w,x)/2-z)/(S.length+(t?1:0));z=Math.min(z,e)}let R=0;if(S.forEach((t=>{const e=void 0===h?2*Math.PI-2*Math.PI/t.nodes.length:h;if(t.dTheta=e/Math.max(1,t.nodes.length-1),t.nodes.length>1&&l){const e=Math.cos(t.dTheta)-Math.cos(0),r=Math.sin(t.dTheta)-Math.sin(0),n=Math.sqrt(z*z/(e*e+r*r));R=Math.max(n,R)}t.r=R,R+=z})),c){let t=0,e=0;for(let r=0;r<S.length;r++){const n=(S[r].r||0)-e;t=Math.max(t,n)}e=0,S.forEach(((r,n)=>{0===n&&(e=r.r||0),r.r=e,e+=t}))}return S.forEach((t=>{const e=t.dTheta||0,r=t.r||0;t.nodes.forEach(((t,n)=>{const o=f+(d?1:-1)*e*n;t.data.x=b[0]+r*Math.cos(o),t.data.y=b[1]+r*Math.sin(o)}))})),t&&E.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:E,edges:y}}))}}function le(t,e,r,n){if(isNaN(e)||isNaN(r))return t;var o,i,s,a,u,h,d,c,l,f=t._root,g={data:n},p=t._x0,v=t._y0,m=t._x1,y=t._y1;if(!f)return t._root=g,t;for(;f.length;)if((h=e>=(i=(p+m)/2))?p=i:m=i,(d=r>=(s=(v+y)/2))?v=s:y=s,o=f,!(f=f[c=d<<1|h]))return o[c]=g,t;if(a=+t._x.call(null,f.data),u=+t._y.call(null,f.data),e===a&&r===u)return g.next=f,o?o[c]=g:t._root=g,t;do{o=o?o[c]=new Array(4):t._root=new Array(4),(h=e>=(i=(p+m)/2))?p=i:m=i,(d=r>=(s=(v+y)/2))?v=s:y=s}while((c=d<<1|h)==(l=(u>=s)<<1|a>=i));return o[l]=f,o[c]=g,t}function fe(t,e,r,n,o){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=o}function ge(t){return t[0]}function pe(t){return t[1]}function ve(t,e,r){var n=new me(null==e?ge:e,null==r?pe:r,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function me(t,e,r,n,o,i){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=o,this._y1=i,this._root=void 0}function ye(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var we=ve.prototype=me.prototype;function xe(t,e,r,n,o){if(isNaN(e)||isNaN(r)||isNaN(n))return t;var i,s,a,u,h,d,c,l,f,g,p,v,m=t._root,y={data:o},w=t._x0,x=t._y0,b=t._z0,E=t._x1,N=t._y1,M=t._z1;if(!m)return t._root=y,t;for(;m.length;)if((l=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+N)/2))?x=a:N=a,(g=n>=(u=(b+M)/2))?b=u:M=u,i=m,!(m=m[p=g<<2|f<<1|l]))return i[p]=y,t;if(h=+t._x.call(null,m.data),d=+t._y.call(null,m.data),c=+t._z.call(null,m.data),e===h&&r===d&&n===c)return y.next=m,i?i[p]=y:t._root=y,t;do{i=i?i[p]=new Array(8):t._root=new Array(8),(l=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+N)/2))?x=a:N=a,(g=n>=(u=(b+M)/2))?b=u:M=u}while((p=g<<2|f<<1|l)==(v=(c>=u)<<2|(d>=a)<<1|h>=s));return i[v]=m,i[p]=y,t}function be(t,e,r,n,o,i,s){this.node=t,this.x0=e,this.y0=r,this.z0=n,this.x1=o,this.y1=i,this.z1=s}function Ee(t){return t[0]}function Ne(t){return t[1]}function Me(t){return t[2]}function _e(t,e,r,n){var o=new ke(null==e?Ee:e,null==r?Ne:r,null==n?Me:n,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?o:o.addAll(t)}function ke(t,e,r,n,o,i,s,a,u){this._x=t,this._y=e,this._z=r,this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this._root=void 0}function Ae(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}we.copy=function(){var t,e,r=new me(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=ye(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var o=0;o<4;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(4)}):n.target[o]=ye(e));return r},we.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t);return le(this.cover(e,r),e,r,t)},we.addAll=function(t){var e,r,n,o,i=t.length,s=new Array(i),a=new Array(i),u=1/0,h=1/0,d=-1/0,c=-1/0;for(r=0;r<i;++r)isNaN(n=+this._x.call(null,e=t[r]))||isNaN(o=+this._y.call(null,e))||(s[r]=n,a[r]=o,n<u&&(u=n),n>d&&(d=n),o<h&&(h=o),o>c&&(c=o));if(u>d||h>c)return this;for(this.cover(u,h).cover(d,c),r=0;r<i;++r)le(this,s[r],a[r],t[r]);return this},we.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var r=this._x0,n=this._y0,o=this._x1,i=this._y1;if(isNaN(r))o=(r=Math.floor(t))+1,i=(n=Math.floor(e))+1;else{for(var s,a,u=o-r||1,h=this._root;r>t||t>=o||n>e||e>=i;)switch(a=(e<n)<<1|t<r,(s=new Array(4))[a]=h,h=s,u*=2,a){case 0:o=r+u,i=n+u;break;case 1:r=o-u,i=n+u;break;case 2:o=r+u,n=i-u;break;case 3:r=o-u,n=i-u}this._root&&this._root.length&&(this._root=h)}return this._x0=r,this._y0=n,this._x1=o,this._y1=i,this},we.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},we.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]]},we.find=function(t,e,r){var n,o,i,s,a,u,h,d=this._x0,c=this._y0,l=this._x1,f=this._y1,g=[],p=this._root;for(p&&g.push(new fe(p,d,c,l,f)),null==r?r=1/0:(d=t-r,c=e-r,l=t+r,f=e+r,r*=r);u=g.pop();)if(!(!(p=u.node)||(o=u.x0)>l||(i=u.y0)>f||(s=u.x1)<d||(a=u.y1)<c))if(p.length){var v=(o+s)/2,m=(i+a)/2;g.push(new fe(p[3],v,m,s,a),new fe(p[2],o,m,v,a),new fe(p[1],v,i,s,m),new fe(p[0],o,i,v,m)),(h=(e>=m)<<1|t>=v)&&(u=g[g.length-1],g[g.length-1]=g[g.length-1-h],g[g.length-1-h]=u)}else{var y=t-+this._x.call(null,p.data),w=e-+this._y.call(null,p.data),x=y*y+w*w;if(x<r){var b=Math.sqrt(r=x);d=t-b,c=e-b,l=t+b,f=e+b,n=p.data}}return n},we.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t)))return this;var e,r,n,o,i,s,a,u,h,d,c,l,f=this._root,g=this._x0,p=this._y0,v=this._x1,m=this._y1;if(!f)return this;if(f.length)for(;;){if((h=i>=(a=(g+v)/2))?g=a:v=a,(d=s>=(u=(p+m)/2))?p=u:m=u,e=f,!(f=f[c=d<<1|h]))return this;if(!f.length)break;(e[c+1&3]||e[c+2&3]||e[c+3&3])&&(r=e,l=c)}for(;f.data!==t;)if(n=f,!(f=f.next))return this;return(o=f.next)&&delete f.next,n?(o?n.next=o:delete n.next,this):e?(o?e[c]=o:delete e[c],(f=e[0]||e[1]||e[2]||e[3])&&f===(e[3]||e[2]||e[1]||e[0])&&!f.length&&(r?r[l]=f:this._root=f),this):(this._root=o,this)},we.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},we.root=function(){return this._root},we.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},we.visit=function(t){var e,r,n,o,i,s,a=[],u=this._root;for(u&&a.push(new fe(u,this._x0,this._y0,this._x1,this._y1));e=a.pop();)if(!t(u=e.node,n=e.x0,o=e.y0,i=e.x1,s=e.y1)&&u.length){var h=(n+i)/2,d=(o+s)/2;(r=u[3])&&a.push(new fe(r,h,d,i,s)),(r=u[2])&&a.push(new fe(r,n,d,h,s)),(r=u[1])&&a.push(new fe(r,h,o,i,d)),(r=u[0])&&a.push(new fe(r,n,o,h,d))}return this},we.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new fe(this._root,this._x0,this._y0,this._x1,this._y1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.y0,u=e.x1,h=e.y1,d=(s+u)/2,c=(a+h)/2;(i=o[0])&&r.push(new fe(i,s,a,d,c)),(i=o[1])&&r.push(new fe(i,d,a,u,c)),(i=o[2])&&r.push(new fe(i,s,c,d,h)),(i=o[3])&&r.push(new fe(i,d,c,u,h))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},we.x=function(t){return arguments.length?(this._x=t,this):this._x},we.y=function(t){return arguments.length?(this._y=t,this):this._y};var je=_e.prototype=ke.prototype;function Se(t){let e=0,r=0,n=0,o=0,i=0;const s=t.length;if(s){for(let a=0;a<s;a++){const s=t[a];s&&s.weight&&(e+=s.weight,r+=s.x*s.weight,n+=s.y*s.weight,o+=s.z*s.weight,i+=s.size*s.weight)}t.x=r/e,t.y=n/e,t.z=o/e,t.size=i/e,t.weight=e}else{const e=t;t.x=e.data.x,t.y=e.data.y,t.z=e.data.z,t.size=e.data.size,t.weight=e.data.weight}}je.copy=function(){var t,e,r=new ke(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root;if(!n)return r;if(!n.length)return r._root=Ae(n),r;for(t=[{source:n,target:r._root=new Array(8)}];n=t.pop();)for(var o=0;o<8;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(8)}):n.target[o]=Ae(e));return r},je.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t),n=+this._z.call(null,t);return xe(this.cover(e,r,n),e,r,n,t)},je.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e),n=new Float64Array(e),o=new Float64Array(e);let i=1/0,s=1/0,a=1/0,u=-1/0,h=-1/0,d=-1/0;for(let c,l,f,g,p=0;p<e;++p)isNaN(l=+this._x.call(null,c=t[p]))||isNaN(f=+this._y.call(null,c))||isNaN(g=+this._z.call(null,c))||(r[p]=l,n[p]=f,o[p]=g,l<i&&(i=l),l>u&&(u=l),f<s&&(s=f),f>h&&(h=f),g<a&&(a=g),g>d&&(d=g));if(i>u||s>h||a>d)return this;this.cover(i,s,a).cover(u,h,d);for(let i=0;i<e;++i)xe(this,r[i],n[i],o[i],t[i]);return this},je.cover=function(t,e,r){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(r=+r))return this;var n=this._x0,o=this._y0,i=this._z0,s=this._x1,a=this._y1,u=this._z1;if(isNaN(n))s=(n=Math.floor(t))+1,a=(o=Math.floor(e))+1,u=(i=Math.floor(r))+1;else{for(var h,d,c=s-n||1,l=this._root;n>t||t>=s||o>e||e>=a||i>r||r>=u;)switch(d=(r<i)<<2|(e<o)<<1|t<n,(h=new Array(8))[d]=l,l=h,c*=2,d){case 0:s=n+c,a=o+c,u=i+c;break;case 1:n=s-c,a=o+c,u=i+c;break;case 2:s=n+c,o=a-c,u=i+c;break;case 3:n=s-c,o=a-c,u=i+c;break;case 4:s=n+c,a=o+c,i=u-c;break;case 5:n=s-c,a=o+c,i=u-c;break;case 6:s=n+c,o=a-c,i=u-c;break;case 7:n=s-c,o=a-c,i=u-c}this._root&&this._root.length&&(this._root=l)}return this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this},je.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},je.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},je.find=function(t,e,r,n){var o,i,s,a,u,h,d,c,l,f=this._x0,g=this._y0,p=this._z0,v=this._x1,m=this._y1,y=this._z1,w=[],x=this._root;for(x&&w.push(new be(x,f,g,p,v,m,y)),null==n?n=1/0:(f=t-n,g=e-n,p=r-n,v=t+n,m=e+n,y=r+n,n*=n);c=w.pop();)if(!(!(x=c.node)||(i=c.x0)>v||(s=c.y0)>m||(a=c.z0)>y||(u=c.x1)<f||(h=c.y1)<g||(d=c.z1)<p))if(x.length){var b=(i+u)/2,E=(s+h)/2,N=(a+d)/2;w.push(new be(x[7],b,E,N,u,h,d),new be(x[6],i,E,N,b,h,d),new be(x[5],b,s,N,u,E,d),new be(x[4],i,s,N,b,E,d),new be(x[3],b,E,a,u,h,N),new be(x[2],i,E,a,b,h,N),new be(x[1],b,s,a,u,E,N),new be(x[0],i,s,a,b,E,N)),(l=(r>=N)<<2|(e>=E)<<1|t>=b)&&(c=w[w.length-1],w[w.length-1]=w[w.length-1-l],w[w.length-1-l]=c)}else{var M=t-+this._x.call(null,x.data),_=e-+this._y.call(null,x.data),k=r-+this._z.call(null,x.data),A=M*M+_*_+k*k;if(A<n){var j=Math.sqrt(n=A);f=t-j,g=e-j,p=r-j,v=t+j,m=e+j,y=r+j,o=x.data}}return o},je.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t))||isNaN(a=+this._z.call(null,t)))return this;var e,r,n,o,i,s,a,u,h,d,c,l,f,g,p,v=this._root,m=this._x0,y=this._y0,w=this._z0,x=this._x1,b=this._y1,E=this._z1;if(!v)return this;if(v.length)for(;;){if((c=i>=(u=(m+x)/2))?m=u:x=u,(l=s>=(h=(y+b)/2))?y=h:b=h,(f=a>=(d=(w+E)/2))?w=d:E=d,e=v,!(v=v[g=f<<2|l<<1|c]))return this;if(!v.length)break;(e[g+1&7]||e[g+2&7]||e[g+3&7]||e[g+4&7]||e[g+5&7]||e[g+6&7]||e[g+7&7])&&(r=e,p=g)}for(;v.data!==t;)if(n=v,!(v=v.next))return this;return(o=v.next)&&delete v.next,n?(o?n.next=o:delete n.next,this):e?(o?e[g]=o:delete e[g],(v=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&v===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!v.length&&(r?r[p]=v:this._root=v),this):(this._root=o,this)},je.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},je.root=function(){return this._root},je.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},je.visit=function(t){var e,r,n,o,i,s,a,u,h=[],d=this._root;for(d&&h.push(new be(d,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=h.pop();)if(!t(d=e.node,n=e.x0,o=e.y0,i=e.z0,s=e.x1,a=e.y1,u=e.z1)&&d.length){var c=(n+s)/2,l=(o+a)/2,f=(i+u)/2;(r=d[7])&&h.push(new be(r,c,l,f,s,a,u)),(r=d[6])&&h.push(new be(r,n,l,f,c,a,u)),(r=d[5])&&h.push(new be(r,c,o,f,s,l,u)),(r=d[4])&&h.push(new be(r,n,o,f,c,l,u)),(r=d[3])&&h.push(new be(r,c,l,i,s,a,f)),(r=d[2])&&h.push(new be(r,n,l,i,c,a,f)),(r=d[1])&&h.push(new be(r,c,o,i,s,l,f)),(r=d[0])&&h.push(new be(r,n,o,i,c,l,f))}return this},je.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new be(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.y0,u=e.z0,h=e.x1,d=e.y1,c=e.z1,l=(s+h)/2,f=(a+d)/2,g=(u+c)/2;(i=o[0])&&r.push(new be(i,s,a,u,l,f,g)),(i=o[1])&&r.push(new be(i,l,a,u,h,f,g)),(i=o[2])&&r.push(new be(i,s,f,u,l,d,g)),(i=o[3])&&r.push(new be(i,l,f,u,h,d,g)),(i=o[4])&&r.push(new be(i,s,a,g,l,f,c)),(i=o[5])&&r.push(new be(i,l,a,g,h,f,c)),(i=o[6])&&r.push(new be(i,s,f,g,l,d,c)),(i=o[7])&&r.push(new be(i,l,f,g,h,d,c))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},je.x=function(t){return arguments.length?(this._x=t,this):this._x},je.y=function(t){return arguments.length?(this._y=t,this):this._y},je.z=function(t){return arguments.length?(this._z=t,this):this._z};const Oe=(t,e,r,n,o,i,s)=>{var a;if((null===(a=t.data)||void 0===a?void 0:a.id)===i.id)return;const u=[r,n,o][s-1],h=i.x-t.x||.1,d=i.y-t.y||.1,c=i.z-t.z||.1,l=[h,d,c],f=u-e;let g=0;for(let t=0;t<s;t++)g+=l[t]*l[t];const p=Math.sqrt(g)*g;if(f*f*.81<g){const e=t.weight/p;return i.vx+=h*e,i.vy+=d*e,i.vz+=c*e,!0}if(t.length)return!1;if(t.data!==i){const e=t.data.weight/p;i.vx+=h*e,i.vy+=d*e,i.vz+=c*e}},ze={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"};class Re{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},ze),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericForceLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericForceLayout(!0,t,r)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;(this.judgingDistance>this.lastOptions.minMovement||e<1)&&e<t;e++)this.runOneStep(this.lastCalcGraph,this.lastGraph,e,this.lastVelMap,this.lastOptions),this.updatePosition(this.lastGraph,this.lastCalcGraph,this.lastVelMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericForceLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),o=r.getAllNodes(),i=r.getAllEdges(),s=this.formatOptions(e,r),{dimensions:a,width:u,height:h,nodeSize:d,getMass:c,nodeStrength:f,edgeStrength:g,linkDistance:v}=s,m=o.map(((t,e)=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{x:p(t.data.x)?t.data.x:Math.random()*u,y:p(t.data.y)?t.data.y:Math.random()*h,z:p(t.data.z)?t.data.z:Math.random()*Math.sqrt(u*h),size:d(t)||30,mass:c(t),nodeStrength:f(t)})}))),y=i.map((t=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{edgeStrength:g(t),linkDistance:v(t,r.getNode(t.source),r.getNode(t.target))})})));if(!(null==o?void 0:o.length))return this.lastResult={nodes:[],edges:i},{nodes:[],edges:i};const w={};o.forEach(((t,e)=>{w[t.id]={x:0,y:0,z:0}}));const x=new l({nodes:m,edges:y});this.formatCentripetal(s,x);const{maxIteration:b,minMovement:E,onTick:N}=s;if(this.lastLayoutNodes=m,this.lastLayoutEdges=y,this.lastAssign=t,this.lastGraph=r,this.lastCalcGraph=x,this.lastOptions=s,this.lastVelMap=w,"undefined"==typeof window)return;let M=0;return new Promise((e=>{this.timeInterval=window.setInterval((()=>{o&&this.running||e({nodes:Te(r,m),edges:i}),this.runOneStep(x,r,M,w,s),this.updatePosition(r,x,w,s),t&&m.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===a?t.data.z:void 0}))),null==N||N({nodes:Te(r,m),edges:i}),M++,(M>=b||this.judgingDistance<E)&&(window.clearInterval(this.timeInterval),e({nodes:Te(r,m),edges:i}))}),0),this.running=!0}))}))}formatOptions(t,e){const r=Object.assign({},t),{width:n,height:o,getMass:i,nodeSize:s}=t;r.width=n||"undefined"==typeof window?n:window.innerWidth,r.height=o||"undefined"==typeof window?o:window.innerHeight,t.center||(r.center=[r.width/2,r.height/2]),i||(r.getMass=t=>{let r=1;p(null==t?void 0:t.data.mass)&&(r=null==t?void 0:t.data.mass);const n=e.getDegree(t.id,"both");return!n||n<5?r:5*n*r});const a=Ht(0,t.nodeSpacing);let u;u=s?Kt(s)?t=>s(t)+a(t):he(s)?t=>{const e=s;return Math.max(e[0],e[1])+a(t)}:t=>s+a(t):t=>{const{size:e}=(null==t?void 0:t.data)||{};return e?he(e)?Math.max(e[0],e[1])+a(t):Yt(e)?Math.max(e.width,e.height)+a(t):e+a(t):10+a(t)},r.nodeSize=u;const h=t.linkDistance?Ht(1,t.linkDistance):t=>1+r.nodeSize(e.getNode(t.source))+r.nodeSize(e.getNode(t.target));return r.linkDistance=h,r.nodeStrength=Ht(1,t.nodeStrength),r.edgeStrength=Ht(1,t.edgeStrength),r}formatCentripetal(t,e){const{dimensions:r,centripetalOptions:n,center:o,clusterNodeStrength:i,leafCluster:s,clustering:a,nodeClusterBy:u}=t,h=e.getAllNodes(),d=n||{leaf:2,single:2,others:1,center:t=>({x:o[0],y:o[1],z:3===r?o[2]:void 0})};let c,l;if("function"!=typeof i&&(t.clusterNodeStrength=t=>i),s&&u&&(c=Ie(e,u),l=Array.from(new Set(null==h?void 0:h.map((t=>t.data[u]))))||[],t.centripetalOptions=Object.assign(d,{single:100,leaf:e=>{const{siblingLeaves:r,sameTypeLeaves:n}=c[e.id]||{};return(null==n?void 0:n.length)===(null==r?void 0:r.length)||1===(null==l?void 0:l.length)?1:t.clusterNodeStrength(e)},others:1,center:t=>{const r=e.getDegree(t.id,"both");if(!r)return{x:100,y:100,z:0};let n;if(1===r){const{sameTypeLeaves:e=[]}=c[t.id]||{};1===e.length?n=void 0:e.length>1&&(n=Pe(e))}else n=void 0;return{x:null==n?void 0:n.x,y:null==n?void 0:n.y,z:null==n?void 0:n.z}}})),a&&u){c||(c=Ie(e,u)),l||(l=Array.from(new Set(h.map((t=>t.data[u]))))),l=l.filter((t=>void 0!==t));const r={};l.forEach((t=>{const n=h.filter((e=>e.data[u]===t)).map((t=>e.getNode(t.id)));r[t]=Pe(n)})),t.centripetalOptions=Object.assign(d,{single:e=>t.clusterNodeStrength(e),leaf:e=>t.clusterNodeStrength(e),others:e=>t.clusterNodeStrength(e),center:t=>{const e=r[t.data[u]];return{x:null==e?void 0:e.x,y:null==e?void 0:e.y,z:null==e?void 0:e.z}}})}const{leaf:f,single:g,others:p}=t.centripetalOptions||{};f&&"function"!=typeof f&&(t.centripetalOptions.leaf=()=>f),g&&"function"!=typeof g&&(t.centripetalOptions.single=()=>g),p&&"function"!=typeof p&&(t.centripetalOptions.others=()=>p)}runOneStep(t,e,r,n,o){const i={},s=t.getAllNodes(),a=t.getAllEdges();if(!(null==s?void 0:s.length))return;const{monitor:u}=o;this.calRepulsive(t,i,o),a&&this.calAttractive(t,i,o),this.calGravity(t,e,i,o),this.updateVelocity(t,i,n,o),u&&u({energy:this.calTotalEnergy(i,s),nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:r})}calTotalEnergy(t,e){if(!(null==e?void 0:e.length))return 0;let r=0;return e.forEach(((e,n)=>{const o=t[e.id].x,i=t[e.id].y,s=3===this.options.dimensions?t[e.id].z:0,a=o*o+i*i+s*s,{mass:u=1}=e.data;r+=u*a*.5})),r}calRepulsive(t,e,r){const{dimensions:n,factor:o,coulombDisScale:i}=r;!function(t,e,r,n,o=2){const i=e/r,s=t.getAllNodes(),a=s.map(((t,e)=>{const{nodeStrength:r,x:n,y:o,z:s,size:a}=t.data;return{x:n,y:o,z:s,size:a,index:e,id:t.id,vx:0,vy:0,vz:0,weight:i*r}})),u=(2===o?ve(a,(t=>t.x),(t=>t.y)):_e(a,(t=>t.x),(t=>t.y),(t=>t.z))).visitAfter(Se),h=new Map;a.forEach((t=>{h.set(t.id,t),function(t,e,r){e.visit(((e,n,o,i,s)=>Oe(e,n,o,i,s,t,r)))}(t,u,o)})),a.map(((t,e)=>{const{id:r,data:o}=s[e],{mass:i=1}=o;n[r]={x:t.vx/i,y:t.vy/i,z:t.vz/i}}))}(t,o,i*i,e,n)}calAttractive(t,e,r){const{dimensions:n,nodeSize:o}=r;t.getAllEdges().forEach(((r,i)=>{const{source:s,target:a}=r,u=t.getNode(s),h=t.getNode(a);if(!u||!h)return;let d=h.data.x-u.data.x,c=h.data.y-u.data.y,l=3===n?h.data.z-u.data.z:0;d||c||(d=.01*Math.random(),c=.01*Math.random(),3!==n||l||(l=.01*Math.random()));const f=Math.sqrt(d*d+c*c+l*l);if(f<o(u)+o(h))return;const g=d/f,p=c/f,v=l/f,{linkDistance:m=200,edgeStrength:y=200}=r.data||{},w=(m-f)*y,x=1/(u.data.mass||1),b=1/(h.data.mass||1),E=g*w,N=p*w,M=v*w;e[s].x-=E*x,e[s].y-=N*x,e[s].z-=M*x,e[a].x+=E*b,e[a].y+=N*b,e[a].z+=M*b}))}calGravity(t,e,r,n){const{getCenter:o}=n,i=t.getAllNodes(),s=e.getAllNodes(),a=e.getAllEdges(),{width:u,height:h,center:d,gravity:c,centripetalOptions:l}=n;i&&i.forEach((n=>{const{id:i,data:f}=n,{mass:g,x:v,y:m,z:y}=f,w=e.getNode(i);let x=0,b=0,E=0,N=c;const M=t.getDegree(i,"in"),_=t.getDegree(i,"out"),k=t.getDegree(i,"both"),A=null==o?void 0:o(w,k);if(A){const[t,e,r]=A;x=v-t,b=m-e,N=r}else x=v-d[0],b=m-d[1],E=y-d[2];if(N&&(r[i].x-=N*x/g,r[i].y-=N*b/g,r[i].z-=N*E/g),l){const{leaf:t,single:e,others:n,center:o}=l,{x:d,y:c,z:f,centerStrength:x}=(null==o?void 0:o(w,s,a,u,h))||{x:0,y:0,z:0,centerStrength:0};if(!p(d)||!p(c))return;const b=(v-d)/g,E=(m-c)/g,N=(y-f)/g;if(x&&(r[i].x-=x*b,r[i].y-=x*E,r[i].z-=x*N),0===k){const t=e(w);if(!t)return;return r[i].x-=t*b,r[i].y-=t*E,void(r[i].z-=t*N)}if(0===M||0===_){const e=t(w,s,a);if(!e)return;return r[i].x-=e*b,r[i].y-=e*E,void(r[i].z-=e*N)}const A=n(w);if(!A)return;r[i].x-=A*b,r[i].y-=A*E,r[i].z-=A*N}}))}updateVelocity(t,e,r,n){const{damping:o,maxSpeed:i,interval:s,dimensions:a}=n,u=t.getAllNodes();(null==u?void 0:u.length)&&u.forEach((t=>{const{id:n}=t;let u=(r[n].x+e[n].x*s)*o||.01,h=(r[n].y+e[n].y*s)*o||.01,d=3===a?(r[n].z+e[n].z*s)*o||.01:0;const c=Math.sqrt(u*u+h*h+d*d);if(c>i){const t=i/c;u*=t,h*=t,d*=t}r[n]={x:u,y:h,z:d}}))}updatePosition(t,e,r,n){const{distanceThresholdMode:o,interval:i,dimensions:s}=n,a=e.getAllNodes();if(!(null==a?void 0:a.length))return void(this.judgingDistance=0);let u=0;"max"===o?this.judgingDistance=-1/0:"min"===o&&(this.judgingDistance=1/0),a.forEach((n=>{const{id:a}=n,h=t.getNode(a);if(p(h.data.fx)&&p(h.data.fy))return void e.mergeNodeData(a,{x:h.data.fx,y:h.data.fy,z:3===s?h.data.fz:void 0});const d=r[a].x*i,c=r[a].y*i,l=3===s?r[a].z*i:0;e.mergeNodeData(a,{x:n.data.x+d,y:n.data.y+c,z:n.data.z+l});const f=Math.sqrt(d*d+c*c+l*l);switch(o){case"max":this.judgingDistance<f&&(this.judgingDistance=f);break;case"min":this.judgingDistance>f&&(this.judgingDistance=f);break;default:u+=f}})),o&&"mean"!==o||(this.judgingDistance=u/a.length)}}const Ie=(t,e)=>{const r=t.getAllNodes();if(!(null==r?void 0:r.length))return{};const n={};return r.forEach(((r,o)=>{1===t.getDegree(r.id,"both")&&(n[r.id]=Ce(t,"leaf",r,e))})),n},Ce=(t,e,r,n)=>{const o=t.getDegree(r.id,"in"),i=t.getDegree(r.id,"out");let s=r,a=[];return 0===o?(s=t.getSuccessors(r.id)[0],a=t.getNeighbors(s.id)):0===i&&(s=t.getPredecessors(r.id)[0],a=t.getNeighbors(s.id)),a=a.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out"))),{coreNode:s,siblingLeaves:a,sameTypeLeaves:De(t,e,n,r,a)}},De=(t,e,r,n,o)=>{const i=n.data[r]||"";let s=(null==o?void 0:o.filter((t=>t.data[r]===i)))||[];return"leaf"===e&&(s=s.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out")))),s},Pe=t=>{const e={x:0,y:0};t.forEach((t=>{const{x:r,y:n}=t.data;e.x+=r||0,e.y+=n||0}));const r=t.length||1;return{x:e.x/r,y:e.y/r}},Te=(t,e)=>e.map((e=>{const{id:r,data:n}=e,o=t.getNode(r);return Object.assign(Object.assign({},o),{data:Object.assign(Object.assign({},o.data),{x:n.x,y:n.y,z:n.z})})}));var Le=r(8917);Le.y3,Le.jy,Le.oN,Le.Hc,Le.cg,Le.hj,Le.LU,Le.Tb;const Fe=Le.uq,qe=(Le.Zm,Le.Dq,Le.__,Le.q0,Le.lh,Le.pI,Le.zC,Le.zg,Le.g6,Le.OL,Le.ks,Le.QR,Le.jp,Le.mk,Le.W2),Ve=(Le.l,Le.KY,Le.dv,Le.BR,Le.Wu,Le.uq,Le.uq,Le.a4,Le.DI,Le.Jo,Le.Zi,Le.kH,Le.LV,t=>{const e=[],r=t.length;for(let n=0;n<r;n+=1){e[n]=[];for(let o=0;o<r;o+=1)n===o?e[n][o]=0:0!==t[n][o]&&t[n][o]?e[n][o]=t[n][o]:e[n][o]=1/0}for(let t=0;t<r;t+=1)for(let n=0;n<r;n+=1)for(let o=0;o<r;o+=1)e[n][o]>e[n][t]+e[t][o]&&(e[n][o]=e[n][t]+e[t][o]);return e}),Be=(t,e)=>{const{nodes:r,edges:n}=t,o=[],i={};if(!r)throw new Error("invalid nodes data!");return r&&r.forEach(((t,e)=>{i[t.id]=e,o.push([])})),null==n||n.forEach((t=>{const{source:r,target:n}=t,s=i[r],a=i[n];void 0!==s&&void 0!==a&&(o[s][a]=1,e||(o[a][s]=1))})),o},Ue=(t,e)=>{const r=[];return t.forEach((t=>{const n=[];t.forEach((t=>{n.push(t*e)})),r.push(n)})),r},$e=t=>{let e=1/0,r=1/0,n=-1/0,o=-1/0;return t.forEach((t=>{let i=t.data.size;he(i)?1===i.length&&(i=[i[0],i[0]]):p(i)?i=[i,i]:(void 0===i||isNaN(i))&&(i=[30,30]);const s=[i[0]/2,i[1]/2],a=t.data.x-s[0],u=t.data.x+s[0],h=t.data.y-s[1],d=t.data.y+s[1];e>a&&(e=a),r>h&&(r=h),n<u&&(n=u),o<d&&(o=d)})),{minX:e,minY:r,maxX:n,maxY:o}},Ge=(t,e)=>Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)),We=(t,e,r,n="TB",o,i={})=>{if(!(null==e?void 0:e.length))return;const{stopBranchFn:s,stopAllFn:a}=i;for(let u=0;u<e.length;u++){const h=e[u];if(t.hasNode(h.id)&&!(null==s?void 0:s(h))){if(null==a?void 0:a(h))return;"TB"===n&&r(h),We(t,t.getChildren(h.id,o),r,n,o,i),"TB"!==n&&r(h)}}},Ke={center:[0,0],linkDistance:50};class Ye{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},Ke),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericMDSLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericMDSLayout(!0,t,r)}))}genericMDSLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{center:o=[0,0],linkDistance:i=50}=e,s=r.getAllNodes(),a=r.getAllEdges();if(!(null==s?void 0:s.length)||1===s.length)return ne(r,t,o);const u=Be({nodes:s,edges:a},!1),h=Ve(u);He(h);const d=Ue(h,i),c=Je(d),l=[];return c.forEach(((t,e)=>{const r=Zt(s[e]);r.data.x=t[0]+o[0],r.data.y=t[1]+o[1],l.push(r)})),t&&l.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:l,edges:a}}))}}const He=t=>{let e=-999999;t.forEach((t=>{t.forEach((t=>{t!==1/0&&e<t&&(e=t)}))})),t.forEach(((r,n)=>{r.forEach(((r,o)=>{r===1/0&&(t[n][o]=e)}))}))},Je=t=>{const e=Fe.mul(Fe.pow(t,2),-.5),r=e.mean("row"),n=e.mean("column"),o=e.mean();e.add(o).subRowVector(r).subColumnVector(n);const i=new qe(e),s=Fe.sqrt(i.diagonalMatrix).diagonal();return i.leftSingularVectors.toJSON().map((t=>Fe.mul([t],[s]).toJSON()[0].splice(0,2)))},Qe={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},Xe={center:[0,0],comboPadding:10,treeKey:"combo"};class Ze{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},Xe),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericComboCombinedLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericComboCombinedLayout(!0,t,r)}))}genericComboCombinedLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:o,treeKey:i,outerLayout:s}=e,a=r.getAllNodes().filter((t=>!t.data._isCombo)),u=r.getAllNodes().filter((t=>t.data._isCombo)),h=r.getAllEdges(),d=null==a?void 0:a.length;if(!d||1===d)return ne(r,t,o);const c=[],f=new Map;a.forEach((t=>{f.set(t.id,t)}));const g=new Map;u.forEach((t=>{g.set(t.id,t)}));const p=new Map,v=this.getInnerGraphs(r,i,f,g,h,e,p);yield Promise.all(v);const m=new Map,y=[],w=new Map;let x=!0;r.getRoots(i).forEach((t=>{const e=p.get(t.id),n=g.get(t.id)||f.get(t.id),o={id:t.id,data:Object.assign(Object.assign({},t.data),{x:e.data.x||n.data.x,y:e.data.y||n.data.y,fx:e.data.fx||n.data.fx,fy:e.data.fy||n.data.fy,mass:e.data.mass||n.data.mass,size:e.data.size})};y.push(o),m.set(t.id,!0),isNaN(o.data.x)||0===o.data.x||isNaN(o.data.y)||0===o.data.y?(o.data.x=100*Math.random(),o.data.y=100*Math.random()):x=!1,We(r,[t],(e=>{e.id!==t.id&&w.set(e.id,t.id)}),"TB",i)}));const b=[];let E;if(h.forEach((t=>{const e=w.get(t.source)||t.source,r=w.get(t.target)||t.target;e!==r&&m.has(e)&&m.has(r)&&b.push({id:t.id,source:e,target:r,data:{}})})),null==y?void 0:y.length){if(1===y.length)y[0].data.x=o[0],y[0].data.y=o[1];else{const t=new l({nodes:y,edges:b}),e=s||new Re;if(x&&Qe[e.id]){const e=y.length<100?new Ye:new ce;yield e.assign(t)}E=yield e.execute(t,Object.assign({center:o,kg:5,preventOverlap:!0,animate:!1},"force"===e.id?{gravity:1,factor:4,linkDistance:(t,e,r)=>(Math.max(...e.data.size)||32)/2+(Math.max(...r.data.size)||32)/2+200}:{}))}p.forEach((t=>{var e;const r=E.nodes.find((e=>e.id===t.id));if(r){const{x:e,y:n}=r.data;t.data.visited=!0,t.data.x=e,t.data.y=n,c.push({id:t.id,data:{x:e,y:n}})}const{x:n,y:o}=t.data;null===(e=t.data.nodes)||void 0===e||e.forEach((t=>{c.push({id:t.id,data:{x:t.data.x+n,y:t.data.y+o}})}))})),p.forEach((({data:t})=>{const{x:e,y:r,visited:n,nodes:o}=t;null==o||o.forEach((t=>{if(!n){const n=c.find((e=>e.id===t.id));n.data.x+=e||0,n.data.y+=r||0}}))}))}return t&&c.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),{nodes:c,edges:h}}))}initVals(t){const e=Object.assign({},t),{nodeSize:r,spacing:n,comboPadding:o}=t;let i,s,a;if(s=p(n)?()=>n:Kt(n)?n:()=>0,e.spacing=s,r)if(Kt(r))i=t=>{const e=r(t),n=s(t);return he(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+n)/2:((e||32)+n)/2};else if(he(r)){const t=(r[0]>r[1]?r[0]:r[1])/2;i=e=>t+s(e)/2}else{const t=r/2;i=e=>t+s(e)/2}else i=t=>{const e=s(t);return t.size?he(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+e)/2:Yt(t.size)?((t.size.width>t.size.height?t.size.width:t.size.height)+e)/2:(t.size+e)/2:32+e/2};return e.nodeSize=i,a=p(o)?()=>o:he(o)?()=>Math.max.apply(null,o):Kt(o)?o:()=>0,e.comboPadding=a,e}getInnerGraphs(t,r,n,o,i,s,a){const{nodeSize:u,comboPadding:h,spacing:d,innerLayout:c}=s,f=c||new ce({}),g={center:[0,0],preventOverlap:!0,nodeSpacing:d},v=[],m=t=>{let e=(null==h?void 0:h(t))||10;return he(e)&&(e=Math.max(...e)),{size:e?[2*e,2*e]:[30,30],padding:e}};return t.getRoots(r).forEach((s=>{a.set(s.id,{id:s.id,data:{nodes:[],size:m(s).size}});let h=Promise.resolve();We(t,[s],(s=>{var d;if(!s.data._isCombo)return;const{size:c,padding:v}=m(s);if(null===(d=t.getChildren(s.id,r))||void 0===d?void 0:d.length){const d=a.get(s.id);a.set(s.id,{id:s.id,data:Object.assign({nodes:[]},null==d?void 0:d.data)});const c=new Map,m=t.getChildren(s.id,r).map((t=>{if(t.data._isCombo)return a.has(t.id)||a.set(t.id,{id:t.id,data:Object.assign({},t.data)}),c.set(t.id,!0),a.get(t.id);const e=n.get(t.id)||o.get(t.id);return c.set(t.id,!0),{id:t.id,data:Object.assign(Object.assign({},e.data),t.data)}})),y={nodes:m,edges:i.filter((t=>c.has(t.source)&&c.has(t.target)))};let w=1/0;m.forEach((t=>{var e;let{size:r}=t.data;r||(r=(null===(e=a.get(t.id))||void 0===e?void 0:e.data.size)||(null==u?void 0:u(t))||[30,30]),p(r)&&(r=[r,r]);const[n,o]=r;w>n&&(w=n),w>o&&(w=o),t.data.size=r})),h=h.then((()=>e(this,void 0,void 0,(function*(){const t=new l(y),e=yield f.assign(t,g),{minX:r,minY:n,maxX:o,maxY:i}=$e(m),u=(o+r)/2,h=(i+n)/2;y.nodes.forEach((t=>{t.data.x-=u,t.data.y-=h}));const d=[Math.max(o-r,w)+2*v,Math.max(i-n,w)+2*v];return a.get(s.id).data.size=d,a.get(s.id).data.nodes=m,e}))))}else a.set(s.id,{id:s.id,data:Object.assign(Object.assign({},s.data),{size:c})});return!0}),"BT",r),v.push(h)})),v}}const tr=function(t){if(!function(t){return"object"==typeof t&&null!==t}(t)||!g(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};function er(t,e){if(Object.hasOwn)return Object.hasOwn(t,e);if(null==t)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(t),e)}function rr(t,e,r,n){for(var o in r=r||0,n=n||5,e)if(er(e,o)){var i=e[o];null!==i&&tr(i)?(tr(t[o])||(t[o]={}),r<n?rr(t[o],i,r+1,n):t[o]=e[o]):V(i)?(t[o]=[],t[o]=t[o].concat(i)):void 0!==i&&(t[o]=i)}}const nr=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var n=0;n<e.length;n+=1)rr(t,e[n]);return t};var or=Object.prototype.hasOwnProperty;const ir=function(t,e){if(null===t||!tr(t))return{};var r={};return function(t,e){if(t)if(V(t))for(var r=0,n=t.length;r<n&&!1!==e(t[r],r);r++);else if(Yt(t))for(var o in t)if(t.hasOwnProperty(o)&&!1===e(t[o],o))break}(e,(function(e){or.call(t,e)&&(r[e]=t[e])})),r};function sr(t){return function(){return t}}function ar(t){return 1e-6*(t()-.5)}function ur(t){return t.index}function hr(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function dr(t){var e,r,n,o,i,s,a=ur,u=function(t){return 1/Math.min(o[t.source.index],o[t.target.index])},h=sr(30),d=1;function c(n){for(var o=0,a=t.length;o<d;++o)for(var u,h,c,l,f,g,p,v=0;v<a;++v)h=(u=t[v]).source,l=(c=u.target).x+c.vx-h.x-h.vx||ar(s),f=c.y+c.vy-h.y-h.vy||ar(s),l*=g=((g=Math.sqrt(l*l+f*f))-r[v])/g*n*e[v],f*=g,c.vx-=l*(p=i[v]),c.vy-=f*p,h.vx+=l*(p=1-p),h.vy+=f*p}function l(){if(n){var s,u,h=n.length,d=t.length,c=new Map(n.map(((t,e)=>[a(t,e,n),t])));for(s=0,o=new Array(h);s<d;++s)(u=t[s]).index=s,"object"!=typeof u.source&&(u.source=hr(c,u.source)),"object"!=typeof u.target&&(u.target=hr(c,u.target)),o[u.source.index]=(o[u.source.index]||0)+1,o[u.target.index]=(o[u.target.index]||0)+1;for(s=0,i=new Array(d);s<d;++s)u=t[s],i[s]=o[u.source.index]/(o[u.source.index]+o[u.target.index]);e=new Array(d),f(),r=new Array(d),g()}}function f(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+u(t[r],r,t)}function g(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+h(t[e],e,t)}return null==t&&(t=[]),c.initialize=function(t,e){n=t,s=e,l()},c.links=function(e){return arguments.length?(t=e,l(),c):t},c.id=function(t){return arguments.length?(a=t,c):a},c.iterations=function(t){return arguments.length?(d=+t,c):d},c.strength=function(t){return arguments.length?(u="function"==typeof t?t:sr(+t),f(),c):u},c.distance=function(t){return arguments.length?(h="function"==typeof t?t:sr(+t),g(),c):h},c}var cr={value:()=>{}};function lr(){for(var t,e=0,r=arguments.length,n={};e<r;++e){if(!(t=arguments[e]+"")||t in n||/[\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new fr(n)}function fr(t){this._=t}function gr(t,e){for(var r,n=0,o=t.length;n<o;++n)if((r=t[n]).name===e)return r.value}function pr(t,e,r){for(var n=0,o=t.length;n<o;++n)if(t[n].name===e){t[n]=cr,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}fr.prototype=lr.prototype={constructor:fr,on:function(t,e){var r,n,o=this._,i=(n=o,(t+"").trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),s=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++s<a;)if(r=(t=i[s]).type)o[r]=pr(o[r],t.name,e);else if(null==e)for(r in o)o[r]=pr(o[r],t.name,null);return this}for(;++s<a;)if((r=(t=i[s]).type)&&(r=gr(o[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new fr(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,o=new Array(r),i=0;i<r;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,r=(n=this._[t]).length;i<r;++i)n[i].value.apply(e,o)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],o=0,i=n.length;o<i;++o)n[o].value.apply(e,r)}};const vr=lr;var mr,yr,wr=0,xr=0,br=0,Er=1e3,Nr=0,Mr=0,_r=0,kr="object"==typeof performance&&performance.now?performance:Date,Ar="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function jr(){return Mr||(Ar(Sr),Mr=kr.now()+_r)}function Sr(){Mr=0}function Or(){this._call=this._time=this._next=null}function zr(t,e,r){var n=new Or;return n.restart(t,e,r),n}function Rr(){Mr=(Nr=kr.now())+_r,wr=xr=0;try{!function(){jr(),++wr;for(var t,e=mr;e;)(t=Mr-e._time)>=0&&e._call.call(void 0,t),e=e._next;--wr}()}finally{wr=0,function(){for(var t,e,r=mr,n=1/0;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:mr=e);yr=t,Cr(n)}(),Mr=0}}function Ir(){var t=kr.now(),e=t-Nr;e>Er&&(_r-=e,Nr=t)}function Cr(t){wr||(xr&&(xr=clearTimeout(xr)),t-Mr>24?(t<1/0&&(xr=setTimeout(Rr,t-kr.now()-_r)),br&&(br=clearInterval(br))):(br||(Nr=kr.now(),br=setInterval(Ir,Er)),wr=1,Ar(Rr)))}Or.prototype=zr.prototype={constructor:Or,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?jr():+r)+(null==e?0:+e),this._next||yr===this||(yr?yr._next=this:mr=this,yr=this),this._call=t,this._time=r,Cr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Cr())}};const Dr=4294967296;function Pr(t){return t.x}function Tr(t){return t.y}var Lr=Math.PI*(3-Math.sqrt(5));function Fr(){var t,e,r,n,o,i=sr(-30),s=1,a=1/0,u=.81;function h(r){var o,i=t.length,s=ve(t,Pr,Tr).visitAfter(c);for(n=r,o=0;o<i;++o)e=t[o],s.visit(l)}function d(){if(t){var e,r,n=t.length;for(o=new Array(n),e=0;e<n;++e)r=t[e],o[r.index]=+i(r,e,t)}}function c(t){var e,r,n,i,s,a=0,u=0;if(t.length){for(n=i=s=0;s<4;++s)(e=t[s])&&(r=Math.abs(e.value))&&(a+=e.value,u+=r,n+=r*e.x,i+=r*e.y);t.x=n/u,t.y=i/u}else{(e=t).x=e.data.x,e.y=e.data.y;do{a+=o[e.data.index]}while(e=e.next)}t.value=a}function l(t,i,h,d){if(!t.value)return!0;var c=t.x-e.x,l=t.y-e.y,f=d-i,g=c*c+l*l;if(f*f/u<g)return g<a&&(0===c&&(g+=(c=ar(r))*c),0===l&&(g+=(l=ar(r))*l),g<s&&(g=Math.sqrt(s*g)),e.vx+=c*t.value*n/g,e.vy+=l*t.value*n/g),!0;if(!(t.length||g>=a)){(t.data!==e||t.next)&&(0===c&&(g+=(c=ar(r))*c),0===l&&(g+=(l=ar(r))*l),g<s&&(g=Math.sqrt(s*g)));do{t.data!==e&&(f=o[t.data.index]*n/g,e.vx+=c*f,e.vy+=l*f)}while(t=t.next)}}return h.initialize=function(e,n){t=e,r=n,d()},h.strength=function(t){return arguments.length?(i="function"==typeof t?t:sr(+t),d(),h):i},h.distanceMin=function(t){return arguments.length?(s=t*t,h):Math.sqrt(s)},h.distanceMax=function(t){return arguments.length?(a=t*t,h):Math.sqrt(a)},h.theta=function(t){return arguments.length?(u=t*t,h):Math.sqrt(u)},h}function qr(t,e){var r,n=1;function o(){var o,i,s=r.length,a=0,u=0;for(o=0;o<s;++o)a+=(i=r[o]).x,u+=i.y;for(a=(a/s-t)*n,u=(u/s-e)*n,o=0;o<s;++o)(i=r[o]).x-=a,i.y-=u}return null==t&&(t=0),null==e&&(e=0),o.initialize=function(t){r=t},o.x=function(e){return arguments.length?(t=+e,o):t},o.y=function(t){return arguments.length?(e=+t,o):e},o.strength=function(t){return arguments.length?(n=+t,o):n},o}function Vr(t){return t.x+t.vx}function Br(t){return t.y+t.vy}function Ur(t){var e,r,n,o=1,i=1;function s(){for(var t,s,u,h,d,c,l,f=e.length,g=0;g<i;++g)for(s=ve(e,Vr,Br).visitAfter(a),t=0;t<f;++t)u=e[t],c=r[u.index],l=c*c,h=u.x+u.vx,d=u.y+u.vy,s.visit(p);function p(t,e,r,i,s){var a=t.data,f=t.r,g=c+f;if(!a)return e>h+g||i<h-g||r>d+g||s<d-g;if(a.index>u.index){var p=h-a.x-a.vx,v=d-a.y-a.vy,m=p*p+v*v;m<g*g&&(0===p&&(m+=(p=ar(n))*p),0===v&&(m+=(v=ar(n))*v),m=(g-(m=Math.sqrt(m)))/m*o,u.vx+=(p*=m)*(g=(f*=f)/(l+f)),u.vy+=(v*=m)*g,a.vx-=p*(g=1-g),a.vy-=v*g)}}}function a(t){if(t.data)return t.r=r[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function u(){if(e){var n,o,i=e.length;for(r=new Array(i),n=0;n<i;++n)o=e[n],r[o.index]=+t(o,n,e)}}return"function"!=typeof t&&(t=sr(null==t?1:+t)),s.initialize=function(t,r){e=t,n=r,u()},s.iterations=function(t){return arguments.length?(i=+t,s):i},s.strength=function(t){return arguments.length?(o=+t,s):o},s.radius=function(e){return arguments.length?(t="function"==typeof e?e:sr(+e),u(),s):t},s}function $r(t,e,r){var n,o,i,s=sr(.1);function a(t){for(var s=0,a=n.length;s<a;++s){var u=n[s],h=u.x-e||1e-6,d=u.y-r||1e-6,c=Math.sqrt(h*h+d*d),l=(i[s]-c)*o[s]*t/c;u.vx+=h*l,u.vy+=d*l}}function u(){if(n){var e,r=n.length;for(o=new Array(r),i=new Array(r),e=0;e<r;++e)i[e]=+t(n[e],e,n),o[e]=isNaN(i[e])?0:+s(n[e],e,n)}}return"function"!=typeof t&&(t=sr(+t)),null==e&&(e=0),null==r&&(r=0),a.initialize=function(t){n=t,u()},a.strength=function(t){return arguments.length?(s="function"==typeof t?t:sr(+t),u(),a):s},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:sr(+e),u(),a):t},a.x=function(t){return arguments.length?(e=+t,a):e},a.y=function(t){return arguments.length?(r=+t,a):r},a}function Gr(t){var e,r,n,o=sr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=sr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:sr(+t),s(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:sr(+e),s(),i):t},i}function Wr(t){var e,r,n,o=sr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=sr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:sr(+t),s(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:sr(+e),s(),i):t},i}class Kr{constructor(t){this.id="d3-force",this.config={inputNodeAttrs:["x","y","vx","vy","fx","fy"],outputNodeAttrs:["x","y","vx","vy"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource"]},this.forceMap={link:dr,manyBody:Fr,center:qr,collide:Ur,radial:$r,x:Gr,y:Wr},this.options={link:{id:t=>t.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},nr(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericLayout(!0,t,r)}))}stop(){this.simulation.stop()}tick(t){return this.simulation.tick(t),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(t,e){const r=this.context.nodes.find((e=>e.id===t));r&&e.forEach(((t,e)=>{"number"!=typeof t&&null!==t||(r[["fx","fy","fz"][e]]=t)}))}getOptions(t){var e,r;const n=nr({},this.options,t);return n.collide&&void 0===(null===(e=n.collide)||void 0===e?void 0:e.radius)&&(n.collide=n.collide||{},n.collide.radius=null!==(r=n.nodeSize)&&void 0!==r?r:10),void 0===n.iterations&&(n.link&&void 0===n.link.iterations&&(n.iterations=n.link.iterations),n.collide&&void 0===n.collide.iterations&&(n.iterations=n.collide.iterations)),this.context.options=n,n}genericLayout(t,r,n){var o;return e(this,void 0,void 0,(function*(){const e=this.getOptions(n),i=r.getAllNodes().map((({id:t,data:e})=>Object.assign({id:t,data:e},ir(e,this.config.inputNodeAttrs)))),s=r.getAllEdges().map((t=>Object.assign({},t)));Object.assign(this.context,{assign:t,nodes:i,edges:s,graph:r});const a=new Promise((t=>{this.resolver=t})),u=this.setSimulation(e);return u.nodes(i),null===(o=u.force("link"))||void 0===o||o.links(s),a}))}getResult(){const{assign:t,nodes:e,edges:r,graph:n}=this.context,o=e.map((t=>({id:t.id,data:Object.assign(Object.assign({},t.data),ir(t,this.config.outputNodeAttrs))}))),i=r.map((({id:t,source:e,target:r,data:n})=>({id:t,source:"object"==typeof e?e.id:e,target:"object"==typeof r?r.id:r,data:n})));return t&&o.forEach((t=>n.mergeNodeData(t.id,t.data))),{nodes:o,edges:i}}initSimulation(){return function(t){var e,r=1,n=.001,o=1-Math.pow(n,1/300),i=0,s=.6,a=new Map,u=zr(c),h=vr("tick","end"),d=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Dr)/Dr}();function c(){l(),h.call("tick",e),r<n&&(u.stop(),h.call("end",e))}function l(n){var u,h,d=t.length;void 0===n&&(n=1);for(var c=0;c<n;++c)for(r+=(i-r)*o,a.forEach((function(t){t(r)})),u=0;u<d;++u)null==(h=t[u]).fx?h.x+=h.vx*=s:(h.x=h.fx,h.vx=0),null==h.fy?h.y+=h.vy*=s:(h.y=h.fy,h.vy=0);return e}function f(){for(var e,r=0,n=t.length;r<n;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var o=10*Math.sqrt(.5+r),i=r*Lr;e.x=o*Math.cos(i),e.y=o*Math.sin(i)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function g(e){return e.initialize&&e.initialize(t,d),e}return null==t&&(t=[]),f(),e={tick:l,restart:function(){return u.restart(c),e},stop:function(){return u.stop(),e},nodes:function(r){return arguments.length?(t=r,f(),a.forEach(g),e):t},alpha:function(t){return arguments.length?(r=+t,e):r},alphaMin:function(t){return arguments.length?(n=+t,e):n},alphaDecay:function(t){return arguments.length?(o=+t,e):+o},alphaTarget:function(t){return arguments.length?(i=+t,e):i},velocityDecay:function(t){return arguments.length?(s=1-t,e):1-s},randomSource:function(t){return arguments.length?(d=t,a.forEach(g),e):d},force:function(t,r){return arguments.length>1?(null==r?a.delete(t):a.set(t,g(r)),e):a.get(t)},find:function(e,r,n){var o,i,s,a,u,h=0,d=t.length;for(null==n?n=1/0:n*=n,h=0;h<d;++h)(s=(o=e-(a=t[h]).x)*o+(i=r-a.y)*i)<n&&(u=a,n=s);return u},on:function(t,r){return arguments.length>1?(h.on(t,r),e):h.on(t)}}}()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",(()=>{var e;return null===(e=t.onTick)||void 0===e?void 0:e.call(t,this.getResult())})).on("end",(()=>{var t;return null===(t=this.resolver)||void 0===t?void 0:t.call(this,this.getResult())}))),Yr(e,this.config.simulationAttrs.map((e=>[e,t[e]]))),Object.entries(this.forceMap).forEach((([r,n])=>{const o=r;if(t[r]){let r=e.force(o);r||(r=n(),e.force(o,r)),Yr(r,Object.entries(t[o]))}else e.force(o,null)})),e}}const Yr=(t,e)=>e.reduce(((e,[r,n])=>e[r]&&void 0!==n?e[r].call(t,n):e),t);function Hr(t){return function(){return t}}function Jr(t){return 1e-6*(t()-.5)}function Qr(t){return t.index}function Xr(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function Zr(t){var e,r,n,o,i,s,a,u=Qr,h=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},d=Hr(30),c=1;function l(n){for(var i=0,u=t.length;i<c;++i)for(var h,d,l,f,g,p=0,v=0,m=0,y=0;p<u;++p)d=(h=t[p]).source,v=(l=h.target).x+l.vx-d.x-d.vx||Jr(a),o>1&&(m=l.y+l.vy-d.y-d.vy||Jr(a)),o>2&&(y=l.z+l.vz-d.z-d.vz||Jr(a)),v*=f=((f=Math.sqrt(v*v+m*m+y*y))-r[p])/f*n*e[p],m*=f,y*=f,l.vx-=v*(g=s[p]),o>1&&(l.vy-=m*g),o>2&&(l.vz-=y*g),d.vx+=v*(g=1-g),o>1&&(d.vy+=m*g),o>2&&(d.vz+=y*g)}function f(){if(n){var o,a,h=n.length,d=t.length,c=new Map(n.map(((t,e)=>[u(t,e,n),t])));for(o=0,i=new Array(h);o<d;++o)(a=t[o]).index=o,"object"!=typeof a.source&&(a.source=Xr(c,a.source)),"object"!=typeof a.target&&(a.target=Xr(c,a.target)),i[a.source.index]=(i[a.source.index]||0)+1,i[a.target.index]=(i[a.target.index]||0)+1;for(o=0,s=new Array(d);o<d;++o)a=t[o],s[o]=i[a.source.index]/(i[a.source.index]+i[a.target.index]);e=new Array(d),g(),r=new Array(d),p()}}function g(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+h(t[r],r,t)}function p(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+d(t[e],e,t)}return null==t&&(t=[]),l.initialize=function(t,...e){n=t,a=e.find((t=>"function"==typeof t))||Math.random,o=e.find((t=>[1,2,3].includes(t)))||2,f()},l.links=function(e){return arguments.length?(t=e,f(),l):t},l.id=function(t){return arguments.length?(u=t,l):u},l.iterations=function(t){return arguments.length?(c=+t,l):c},l.strength=function(t){return arguments.length?(h="function"==typeof t?t:Hr(+t),g(),l):h},l.distance=function(t){return arguments.length?(d="function"==typeof t?t:Hr(+t),p(),l):d},l}function tn(t,e,r){if(isNaN(e))return t;var n,o,i,s,a,u,h=t._root,d={data:r},c=t._x0,l=t._x1;if(!h)return t._root=d,t;for(;h.length;)if((s=e>=(o=(c+l)/2))?c=o:l=o,n=h,!(h=h[a=+s]))return n[a]=d,t;if(e===(i=+t._x.call(null,h.data)))return d.next=h,n?n[a]=d:t._root=d,t;do{n=n?n[a]=new Array(2):t._root=new Array(2),(s=e>=(o=(c+l)/2))?c=o:l=o}while((a=+s)==(u=+(i>=o)));return n[u]=h,n[a]=d,t}function en(t,e,r){this.node=t,this.x0=e,this.x1=r}function rn(t){return t[0]}function nn(t,e){var r=new on(null==e?rn:e,NaN,NaN);return null==t?r:r.addAll(t)}function on(t,e,r){this._x=t,this._x0=e,this._x1=r,this._root=void 0}function sn(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var an=nn.prototype=on.prototype;an.copy=function(){var t,e,r=new on(this._x,this._x0,this._x1),n=this._root;if(!n)return r;if(!n.length)return r._root=sn(n),r;for(t=[{source:n,target:r._root=new Array(2)}];n=t.pop();)for(var o=0;o<2;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(2)}):n.target[o]=sn(e));return r},an.add=function(t){const e=+this._x.call(null,t);return tn(this.cover(e),e,t)},an.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e);let n=1/0,o=-1/0;for(let i,s=0;s<e;++s)isNaN(i=+this._x.call(null,t[s]))||(r[s]=i,i<n&&(n=i),i>o&&(o=i));if(n>o)return this;this.cover(n).cover(o);for(let n=0;n<e;++n)tn(this,r[n],t[n]);return this},an.cover=function(t){if(isNaN(t=+t))return this;var e=this._x0,r=this._x1;if(isNaN(e))r=(e=Math.floor(t))+1;else{for(var n,o,i=r-e||1,s=this._root;e>t||t>=r;)switch(o=+(t<e),(n=new Array(2))[o]=s,s=n,i*=2,o){case 0:r=e+i;break;case 1:e=r-i}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._x1=r,this},an.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},an.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},an.find=function(t,e){var r,n,o,i,s,a=this._x0,u=this._x1,h=[],d=this._root;for(d&&h.push(new en(d,a,u)),null==e?e=1/0:(a=t-e,u=t+e);i=h.pop();)if(!(!(d=i.node)||(n=i.x0)>u||(o=i.x1)<a))if(d.length){var c=(n+o)/2;h.push(new en(d[1],c,o),new en(d[0],n,c)),(s=+(t>=c))&&(i=h[h.length-1],h[h.length-1]=h[h.length-1-s],h[h.length-1-s]=i)}else{var l=Math.abs(t-+this._x.call(null,d.data));l<e&&(e=l,a=t-l,u=t+l,r=d.data)}return r},an.remove=function(t){if(isNaN(i=+this._x.call(null,t)))return this;var e,r,n,o,i,s,a,u,h,d=this._root,c=this._x0,l=this._x1;if(!d)return this;if(d.length)for(;;){if((a=i>=(s=(c+l)/2))?c=s:l=s,e=d,!(d=d[u=+a]))return this;if(!d.length)break;e[u+1&1]&&(r=e,h=u)}for(;d.data!==t;)if(n=d,!(d=d.next))return this;return(o=d.next)&&delete d.next,n?(o?n.next=o:delete n.next,this):e?(o?e[u]=o:delete e[u],(d=e[0]||e[1])&&d===(e[1]||e[0])&&!d.length&&(r?r[h]=d:this._root=d),this):(this._root=o,this)},an.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},an.root=function(){return this._root},an.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},an.visit=function(t){var e,r,n,o,i=[],s=this._root;for(s&&i.push(new en(s,this._x0,this._x1));e=i.pop();)if(!t(s=e.node,n=e.x0,o=e.x1)&&s.length){var a=(n+o)/2;(r=s[1])&&i.push(new en(r,a,o)),(r=s[0])&&i.push(new en(r,n,a))}return this},an.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new en(this._root,this._x0,this._x1));e=r.pop();){var o=e.node;if(o.length){var i,s=e.x0,a=e.x1,u=(s+a)/2;(i=o[0])&&r.push(new en(i,s,u)),(i=o[1])&&r.push(new en(i,u,a))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.x1);return this},an.x=function(t){return arguments.length?(this._x=t,this):this._x};const un=4294967296;function hn(t){return t.x}function dn(t){return t.y}function cn(t){return t.z}var ln=Math.PI*(3-Math.sqrt(5)),fn=20*Math.PI/(9+Math.sqrt(221));function gn(){var t,e,r,n,o,i,s=Hr(-30),a=1,u=1/0,h=.81;function d(n){var i,s=t.length,a=(1===e?nn(t,hn):2===e?ve(t,hn,dn):3===e?_e(t,hn,dn,cn):null).visitAfter(l);for(o=n,i=0;i<s;++i)r=t[i],a.visit(f)}function c(){if(t){var e,r,n=t.length;for(i=new Array(n),e=0;e<n;++e)r=t[e],i[r.index]=+s(r,e,t)}}function l(t){var r,n,o,s,a,u,h=0,d=0,c=t.length;if(c){for(o=s=a=u=0;u<c;++u)(r=t[u])&&(n=Math.abs(r.value))&&(h+=r.value,d+=n,o+=n*(r.x||0),s+=n*(r.y||0),a+=n*(r.z||0));h*=Math.sqrt(4/c),t.x=o/d,e>1&&(t.y=s/d),e>2&&(t.z=a/d)}else{(r=t).x=r.data.x,e>1&&(r.y=r.data.y),e>2&&(r.z=r.data.z);do{h+=i[r.data.index]}while(r=r.next)}t.value=h}function f(t,s,d,c,l){if(!t.value)return!0;var f=[d,c,l][e-1],g=t.x-r.x,p=e>1?t.y-r.y:0,v=e>2?t.z-r.z:0,m=f-s,y=g*g+p*p+v*v;if(m*m/h<y)return y<u&&(0===g&&(y+=(g=Jr(n))*g),e>1&&0===p&&(y+=(p=Jr(n))*p),e>2&&0===v&&(y+=(v=Jr(n))*v),y<a&&(y=Math.sqrt(a*y)),r.vx+=g*t.value*o/y,e>1&&(r.vy+=p*t.value*o/y),e>2&&(r.vz+=v*t.value*o/y)),!0;if(!(t.length||y>=u)){(t.data!==r||t.next)&&(0===g&&(y+=(g=Jr(n))*g),e>1&&0===p&&(y+=(p=Jr(n))*p),e>2&&0===v&&(y+=(v=Jr(n))*v),y<a&&(y=Math.sqrt(a*y)));do{t.data!==r&&(m=i[t.data.index]*o/y,r.vx+=g*m,e>1&&(r.vy+=p*m),e>2&&(r.vz+=v*m))}while(t=t.next)}}return d.initialize=function(r,...o){t=r,n=o.find((t=>"function"==typeof t))||Math.random,e=o.find((t=>[1,2,3].includes(t)))||2,c()},d.strength=function(t){return arguments.length?(s="function"==typeof t?t:Hr(+t),c(),d):s},d.distanceMin=function(t){return arguments.length?(a=t*t,d):Math.sqrt(a)},d.distanceMax=function(t){return arguments.length?(u=t*t,d):Math.sqrt(u)},d.theta=function(t){return arguments.length?(h=t*t,d):Math.sqrt(h)},d}function pn(t,e,r){var n,o=1;function i(){var i,s,a=n.length,u=0,h=0,d=0;for(i=0;i<a;++i)u+=(s=n[i]).x||0,h+=s.y||0,d+=s.z||0;for(u=(u/a-t)*o,h=(h/a-e)*o,d=(d/a-r)*o,i=0;i<a;++i)s=n[i],u&&(s.x-=u),h&&(s.y-=h),d&&(s.z-=d)}return null==t&&(t=0),null==e&&(e=0),null==r&&(r=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.z=function(t){return arguments.length?(r=+t,i):r},i.strength=function(t){return arguments.length?(o=+t,i):o},i}function vn(t){return t.x+t.vx}function mn(t){return t.y+t.vy}function yn(t){return t.z+t.vz}function wn(t){var e,r,n,o,i=1,s=1;function a(){for(var t,a,h,d,c,l,f,g,p=e.length,v=0;v<s;++v)for(a=(1===r?nn(e,vn):2===r?ve(e,vn,mn):3===r?_e(e,vn,mn,yn):null).visitAfter(u),t=0;t<p;++t)h=e[t],f=n[h.index],g=f*f,d=h.x+h.vx,r>1&&(c=h.y+h.vy),r>2&&(l=h.z+h.vz),a.visit(m);function m(t,e,n,s,a,u,p){var v=[e,n,s,a,u,p],m=v[0],y=v[1],w=v[2],x=v[r],b=v[r+1],E=v[r+2],N=t.data,M=t.r,_=f+M;if(!N)return m>d+_||x<d-_||r>1&&(y>c+_||b<c-_)||r>2&&(w>l+_||E<l-_);if(N.index>h.index){var k=d-N.x-N.vx,A=r>1?c-N.y-N.vy:0,j=r>2?l-N.z-N.vz:0,S=k*k+A*A+j*j;S<_*_&&(0===k&&(S+=(k=Jr(o))*k),r>1&&0===A&&(S+=(A=Jr(o))*A),r>2&&0===j&&(S+=(j=Jr(o))*j),S=(_-(S=Math.sqrt(S)))/S*i,h.vx+=(k*=S)*(_=(M*=M)/(g+M)),r>1&&(h.vy+=(A*=S)*_),r>2&&(h.vz+=(j*=S)*_),N.vx-=k*(_=1-_),r>1&&(N.vy-=A*_),r>2&&(N.vz-=j*_))}}}function u(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<Math.pow(2,r);++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function h(){if(e){var r,o,i=e.length;for(n=new Array(i),r=0;r<i;++r)o=e[r],n[o.index]=+t(o,r,e)}}return"function"!=typeof t&&(t=Hr(null==t?1:+t)),a.initialize=function(t,...n){e=t,o=n.find((t=>"function"==typeof t))||Math.random,r=n.find((t=>[1,2,3].includes(t)))||2,h()},a.iterations=function(t){return arguments.length?(s=+t,a):s},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:Hr(+e),h(),a):t},a}function xn(t,e,r,n){var o,i,s,a,u=Hr(.1);function h(t){for(var u=0,h=o.length;u<h;++u){var d=o[u],c=d.x-e||1e-6,l=(d.y||0)-r||1e-6,f=(d.z||0)-n||1e-6,g=Math.sqrt(c*c+l*l+f*f),p=(a[u]-g)*s[u]*t/g;d.vx+=c*p,i>1&&(d.vy+=l*p),i>2&&(d.vz+=f*p)}}function d(){if(o){var e,r=o.length;for(s=new Array(r),a=new Array(r),e=0;e<r;++e)a[e]=+t(o[e],e,o),s[e]=isNaN(a[e])?0:+u(o[e],e,o)}}return"function"!=typeof t&&(t=Hr(+t)),null==e&&(e=0),null==r&&(r=0),null==n&&(n=0),h.initialize=function(t,...e){o=t,i=e.find((t=>[1,2,3].includes(t)))||2,d()},h.strength=function(t){return arguments.length?(u="function"==typeof t?t:Hr(+t),d(),h):u},h.radius=function(e){return arguments.length?(t="function"==typeof e?e:Hr(+e),d(),h):t},h.x=function(t){return arguments.length?(e=+t,h):e},h.y=function(t){return arguments.length?(r=+t,h):r},h.z=function(t){return arguments.length?(n=+t,h):n},h}function bn(t){var e,r,n,o=Hr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Hr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Hr(+t),s(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:Hr(+e),s(),i):t},i}function En(t){var e,r,n,o=Hr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Hr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Hr(+t),s(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:Hr(+e),s(),i):t},i}function Nn(t){var e,r,n,o=Hr(.1);function i(t){for(var o,i=0,s=e.length;i<s;++i)(o=e[i]).vz+=(n[i]-o.z)*r[i]*t}function s(){if(e){var i,s=e.length;for(r=new Array(s),n=new Array(s),i=0;i<s;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Hr(null==t?0:+t)),i.initialize=function(t){e=t,s()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Hr(+t),s(),i):o},i.z=function(e){return arguments.length?(t="function"==typeof e?e:Hr(+e),s(),i):t},i}class Mn extends Kr{constructor(){super(...arguments),this.id="d3-force-3d",this.config={inputNodeAttrs:["x","y","z","vx","vy","vz","fx","fy","fz"],outputNodeAttrs:["x","y","z","vx","vy","vz"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource","numDimensions"]},this.forceMap={link:Zr,manyBody:gn,center:pn,collide:wn,radial:xn,x:bn,y:En,z:Nn},this.options={numDimensions:3,link:{id:t=>t.id},manyBody:{},center:{x:0,y:0,z:0}}}initSimulation(){return function(t,e){e=e||2;var r,n=Math.min(3,Math.max(1,Math.round(e))),o=1,i=.001,s=1-Math.pow(i,1/300),a=0,u=.6,h=new Map,d=zr(f),c=vr("tick","end"),l=function(){let t=1;return()=>(t=(1664525*t+1013904223)%un)/un}();function f(){g(),c.call("tick",r),o<i&&(d.stop(),c.call("end",r))}function g(e){var i,d,c=t.length;void 0===e&&(e=1);for(var l=0;l<e;++l)for(o+=(a-o)*s,h.forEach((function(t){t(o)})),i=0;i<c;++i)null==(d=t[i]).fx?d.x+=d.vx*=u:(d.x=d.fx,d.vx=0),n>1&&(null==d.fy?d.y+=d.vy*=u:(d.y=d.fy,d.vy=0)),n>2&&(null==d.fz?d.z+=d.vz*=u:(d.z=d.fz,d.vz=0));return r}function p(){for(var e,r=0,o=t.length;r<o;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),null!=e.fz&&(e.z=e.fz),isNaN(e.x)||n>1&&isNaN(e.y)||n>2&&isNaN(e.z)){var i=10*(n>2?Math.cbrt(.5+r):n>1?Math.sqrt(.5+r):r),s=r*ln,a=r*fn;1===n?e.x=i:2===n?(e.x=i*Math.cos(s),e.y=i*Math.sin(s)):(e.x=i*Math.sin(s)*Math.cos(a),e.y=i*Math.cos(s),e.z=i*Math.sin(s)*Math.sin(a))}(isNaN(e.vx)||n>1&&isNaN(e.vy)||n>2&&isNaN(e.vz))&&(e.vx=0,n>1&&(e.vy=0),n>2&&(e.vz=0))}}function v(e){return e.initialize&&e.initialize(t,l,n),e}return null==t&&(t=[]),p(),r={tick:g,restart:function(){return d.restart(f),r},stop:function(){return d.stop(),r},numDimensions:function(t){return arguments.length?(n=Math.min(3,Math.max(1,Math.round(t))),h.forEach(v),r):n},nodes:function(e){return arguments.length?(t=e,p(),h.forEach(v),r):t},alpha:function(t){return arguments.length?(o=+t,r):o},alphaMin:function(t){return arguments.length?(i=+t,r):i},alphaDecay:function(t){return arguments.length?(s=+t,r):+s},alphaTarget:function(t){return arguments.length?(a=+t,r):a},velocityDecay:function(t){return arguments.length?(u=1-t,r):1-u},randomSource:function(t){return arguments.length?(l=t,h.forEach(v),r):l},force:function(t,e){return arguments.length>1?(null==e?h.delete(t):h.set(t,v(e)),r):h.get(t)},find:function(){var e,r,o,i,s,a,u=Array.prototype.slice.call(arguments),h=u.shift()||0,d=(n>1?u.shift():null)||0,c=(n>2?u.shift():null)||0,l=u.shift()||1/0,f=0,g=t.length;for(l*=l,f=0;f<g;++f)(i=(e=h-(s=t[f]).x)*e+(r=d-(s.y||0))*r+(o=c-(s.z||0))*o)<l&&(a=s,l=i);return a},on:function(t,e){return arguments.length>1?(c.on(t,e),r):c.on(t)}}}()}}var _n=r(4341),kn=r.n(_n);class An{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,An.defaultOptions,t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,t,Object.assign(Object.assign({},this.options),r))}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,t,Object.assign(Object.assign({},this.options),r))}))}genericDagreLayout(r,n,o){return e(this,void 0,void 0,(function*(){const{nodeSize:e}=o,i=new _n.graphlib.Graph;i.setGraph(o),i.setDefaultEdgeLabel((()=>({}))),[...n.getAllNodes(),...n.getAllEdges()].some((({id:t})=>p(t)))&&console.error("Dagre layout only support string id, it will convert number to string."),n.getAllNodes().forEach((t=>{const{id:r}=t,n=Object.assign({},t.data);if(void 0!==e){const[r,o]=function(t){if(!t)return[0,0,0];if(p(t))return[t,t,t];if(0===t.length)return[0,0,0];const[e,r=e,n=e]=t;return[e,r,n]}(Kt(e)?e(t):e);Object.assign(n,{width:r,height:o})}i.setNode(r.toString(),n)})),n.getAllEdges().forEach((({id:t,source:e,target:r})=>{i.setEdge(e.toString(),r.toString(),{id:t})})),kn().layout(i);const s={nodes:[],edges:[]};return i.nodes().forEach((t=>{const e=i.node(t);s.nodes.push({id:t,data:e}),r&&n.mergeNodeData(t,e)})),i.edges().forEach((e=>{const o=i.edge(e),{id:a}=o,u=t(o,["id"]),{v:h,w:d}=e;s.edges.push({id:a,source:h,target:d,data:u}),r&&n.mergeEdgeData(a,u)})),s}))}}An.defaultOptions={};class jn{constructor(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}distanceTo(t){const e=this.rx-t.rx,r=this.ry-t.ry;return Math.hypot(e,r)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,r=t.ry-this.ry;let n=Math.hypot(e,r);n=n<1e-4?1e-4:n;const o=this.g*(this.degree+1)*(t.degree+1)/n;this.fx+=o*e/n,this.fy+=o*r/n}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,r=(this.rx*this.mass+t.rx*t.mass)/e,n=(this.ry*this.mass+t.ry*t.mass)/e,o=this.degree+t.degree;return new jn({rx:r,ry:n,mass:e,degree:o})}}class Sn{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const r=this.length/2;return t<=this.xmid+r&&t>=this.xmid-r&&e<=this.ymid+r&&e>=this.ymid-r}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new Sn({xmid:t,ymid:e,length:r})}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new Sn({xmid:t,ymid:e,length:r})}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new Sn({xmid:t,ymid:e,length:r})}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new Sn({xmid:t,ymid:e,length:r})}}class On{constructor(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}insert(t){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new On(this.quad.NW()),this.NE=new On(this.quad.NE()),this.SW=new On(this.quad.SW()),this.SE=new On(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t)):this.body=t}_putBody(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))}_isExternal(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE}updateForce(t){null!=this.body&&t!==this.body&&(this._isExternal()||(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t)))}}const zn={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1};class Rn{constructor(t={}){this.options=t,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},zn),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericForceAtlas2Layout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericForceAtlas2Layout(!0,t,r)}))}genericForceAtlas2Layout(t,r,n){return e(this,void 0,void 0,(function*(){const e=r.getAllEdges(),o=r.getAllNodes(),i=this.formatOptions(n,o.length),{width:s,height:a,prune:u,maxIteration:h,nodeSize:d,center:c}=i;if(!(null==o?void 0:o.length)||1===o.length)return ne(r,t,c);const f=o.map((t=>Zt(t,[s,a]))),g=e.filter((t=>{const{source:e,target:r}=t;return e!==r})),p=new l({nodes:f,edges:g}),v=this.getSizes(p,r,d);if(this.run(p,r,h,v,t,i),u){for(let t=0;t<g.length;t+=1){const{source:e,target:r}=g[t],n=p.getDegree(e),o=p.getDegree(e);if(n<=1){const t=p.getNode(r);p.mergeNodeData(e,{x:t.data.x,y:t.data.y})}else if(o<=1){const t=p.getNode(e);p.mergeNodeData(r,{x:t.data.x,y:t.data.y})}}const e=Object.assign(Object.assign({},i),{prune:!1,barnesHut:!1});this.run(p,r,100,v,t,e)}return{nodes:f,edges:e}}))}getSizes(t,e,r){const n=t.getAllNodes(),o={};for(let t=0;t<n.length;t+=1){const{id:i,data:s}=n[t];if(o[i]=10,p(s.size))o[i]=s.size;else if(he(s.size))isNaN(s.size[0])||(o[i]=Math.max(s.size[0])),isNaN(s.size[1])||(o[i]=Math.max(s.size[1]));else if(Yt(s.size))o[i]=Math.max(s.size.width,s.size.height);else if(Kt(r)){const t=r(e.getNode(i));he(t)?o[i]=Math.max(...t):o[i]=t}else he(r)?o[i]=Math.max(...r):p(r)&&(o[i]=r)}return o}formatOptions(t={},e){const r=Object.assign(Object.assign({},this.options),t),{center:n,width:o,height:i,barnesHut:s,prune:a,maxIteration:u,kr:h,kg:d}=r;return r.width=o||"undefined"==typeof window?o:window.innerWidth,r.height=i||"undefined"==typeof window?i:window.innerHeight,r.center=n||[r.width/2,r.height/2],void 0===s&&e>250&&(r.barnesHut=!0),void 0===a&&e>100&&(r.prune=!0),0!==u||a?0===u&&a&&(r.maxIteration=100,e<=200&&e>100?r.maxIteration=500:e>200&&(r.maxIteration=950)):(r.maxIteration=250,e<=200&&e>100?r.maxIteration=1e3:e>200&&(r.maxIteration=1200)),h||(r.kr=50,e>100&&e<=500?r.kr=20:e>500&&(r.kr=1)),d||(r.kg=20,e>100&&e<=500?r.kg=10:e>500&&(r.kg=1)),r}run(t,e,r,n,o,i){const{kr:s,barnesHut:a,onTick:u}=i,h=t.getAllNodes();let d=0,c=r;const l={},f={},g={};for(let e=0;e<h.length;e+=1){const{data:r,id:n}=h[e];if(l[n]=[0,0],a){const o={id:e,rx:r.x,ry:r.y,mass:1,g:s,degree:t.getDegree(n)};g[n]=new jn(o)}}for(;c>0;)d=this.oneStep(t,{iter:c,preventOverlapIters:50,krPrime:100,sg:d,forces:l,preForces:f,bodies:g,sizes:n},i),c--,null==u||u({nodes:h,edges:e.getAllEdges()});return t}oneStep(t,e,r){const{iter:n,preventOverlapIters:o,krPrime:i,sg:s,preForces:a,bodies:u,sizes:h}=e;let{forces:d}=e;const{preventOverlap:c,barnesHut:l}=r,f=t.getAllNodes();for(let t=0;t<f.length;t+=1){const{id:e}=f[t];a[e]=[...d[e]],d[e]=[0,0]}return d=this.getAttrForces(t,n,o,h,d,r),d=l&&(c&&n>o||!c)?this.getOptRepGraForces(t,d,u,r):this.getRepGraForces(t,n,o,d,i,h,r),this.updatePos(t,d,a,s,r)}getAttrForces(t,e,r,n,o,i){const{preventOverlap:s,dissuadeHubs:a,mode:u,prune:h}=i,d=t.getAllEdges();for(let i=0;i<d.length;i+=1){const{source:c,target:l}=d[i],f=t.getNode(c),g=t.getNode(l),p=t.getDegree(c),v=t.getDegree(l);if(h&&(p<=1||v<=1))continue;const m=[g.data.x-f.data.x,g.data.y-f.data.y];let y=Math.hypot(m[0],m[1]);y=y<1e-4?1e-4:y,m[0]=m[0]/y,m[1]=m[1]/y,s&&e<r&&(y=y-n[c]-n[l]);let w=y,x=w;"linlog"===u&&(w=Math.log(1+y),x=w),a&&(w=y/p,x=y/v),s&&e<r&&y<=0?(w=0,x=0):s&&e<r&&y>0&&(w=y,x=y),o[c][0]+=w*m[0],o[l][0]-=x*m[0],o[c][1]+=w*m[1],o[l][1]-=x*m[1]}return o}getOptRepGraForces(t,e,r,n){const{kg:o,center:i,prune:s}=n,a=t.getAllNodes(),u=a.length;let h=9e10,d=-9e10,c=9e10,l=-9e10;for(let e=0;e<u;e+=1){const{id:n,data:o}=a[e];s&&t.getDegree(n)<=1||(r[n].setPos(o.x,o.y),o.x>=d&&(d=o.x),o.x<=h&&(h=o.x),o.y>=l&&(l=o.y),o.y<=c&&(c=o.y))}const f=Math.max(d-h,l-c),g=new Sn({xmid:(d+h)/2,ymid:(l+c)/2,length:f,massCenter:i,mass:u}),p=new On(g);for(let e=0;e<u;e+=1){const{id:n}=a[e];s&&t.getDegree(n)<=1||r[n].in(g)&&p.insert(r[n])}for(let n=0;n<u;n+=1){const{id:u,data:h}=a[n],d=t.getDegree(u);if(s&&d<=1)continue;r[u].resetForce(),p.updateForce(r[u]),e[u][0]-=r[u].fx,e[u][1]-=r[u].fy;const c=[h.x-i[0],h.y-i[1]];let l=Math.hypot(c[0],c[1]);l=l<1e-4?1e-4:l,c[0]=c[0]/l,c[1]=c[1]/l;const f=o*(d+1);e[u][0]-=f*c[0],e[u][1]-=f*c[1]}return e}getRepGraForces(t,e,r,n,o,i,s){const{preventOverlap:a,kr:u,kg:h,center:d,prune:c}=s,l=t.getAllNodes(),f=l.length;for(let s=0;s<f;s+=1){const g=l[s],p=t.getDegree(g.id);for(let h=s+1;h<f;h+=1){const s=l[h],d=t.getDegree(s.id);if(c&&(p<=1||d<=1))continue;const f=[s.data.x-g.data.x,s.data.y-g.data.y];let v=Math.hypot(f[0],f[1]);v=v<1e-4?1e-4:v,f[0]=f[0]/v,f[1]=f[1]/v,a&&e<r&&(v=v-i[g.id]-i[s.id]);let m=u*(p+1)*(d+1)/v;a&&e<r&&v<0?m=o*(p+1)*(d+1):a&&e<r&&0===v?m=0:a&&e<r&&v>0&&(m=u*(p+1)*(d+1)/v),n[g.id][0]-=m*f[0],n[s.id][0]+=m*f[0],n[g.id][1]-=m*f[1],n[s.id][1]+=m*f[1]}const v=[g.data.x-d[0],g.data.y-d[1]],m=Math.hypot(v[0],v[1]);v[0]=v[0]/m,v[1]=v[1]/m;const y=h*(p+1);n[g.id][0]-=y*v[0],n[g.id][1]-=y*v[1]}return n}updatePos(t,e,r,n,o){const{ks:i,tao:s,prune:a,ksmax:u}=o,h=t.getAllNodes(),d=h.length,c=[],l=[];let f=0,g=0,v=n;for(let n=0;n<d;n+=1){const{id:o}=h[n],i=t.getDegree(o);if(a&&i<=1)continue;const s=[e[o][0]-r[o][0],e[o][1]-r[o][1]],u=Math.hypot(s[0],s[1]),d=[e[o][0]+r[o][0],e[o][1]+r[o][1]],p=Math.hypot(d[0],d[1]);c[n]=u,l[n]=p/2,f+=(i+1)*c[n],g+=(i+1)*l[n]}const m=v;v=s*g/f,0!==m&&(v=v>1.5*m?1.5*m:v);for(let r=0;r<d;r+=1){const{id:n,data:o}=h[r],s=t.getDegree(n);if(a&&s<=1)continue;if(p(o.fx)&&p(o.fy))continue;let d=i*v/(1+v*Math.sqrt(c[r])),l=Math.hypot(e[n][0],e[n][1]);l=l<1e-4?1e-4:l;const f=u/l;d=d>f?f:d;const g=d*e[n][0],m=d*e[n][1];t.mergeNodeData(n,{x:o.x+g,y:o.y+m})}return v}}const In={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"};class Cn{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},In),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericFruchtermanLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericFruchtermanLayout(!0,t,r)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;e<t;e++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericFruchtermanLayout(t,r,n){return e(this,void 0,void 0,(function*(){if(this.running)return;const e=this.formatOptions(n),{dimensions:o,width:i,height:s,center:a,clustering:u,nodeClusterBy:h,maxIteration:d,onTick:c}=e,f=r.getAllNodes(),g=r.getAllEdges();if(!(null==f?void 0:f.length)){const t={nodes:[],edges:g};return this.lastResult=t,t}if(1===f.length){t&&r.mergeNodeData(f[0].id,{x:a[0],y:a[1],z:3===o?a[2]:void 0});const e={nodes:[Object.assign(Object.assign({},f[0]),{data:Object.assign(Object.assign({},f[0].data),{x:a[0],y:a[1],z:3===o?a[2]:void 0})})],edges:g};return this.lastResult=e,e}const p=f.map((t=>Zt(t,[i,s]))),v=new l({nodes:p,edges:g}),m={};if(u&&p.forEach((t=>{const e=t.data[h];m[e]||(m[e]={name:e,cx:0,cy:0,count:0})})),this.lastLayoutNodes=p,this.lastLayoutEdges=g,this.lastAssign=t,this.lastGraph=v,this.lastOptions=e,this.lastClusterMap=m,"undefined"==typeof window)return;let y=0;return new Promise((n=>{this.timeInterval=window.setInterval((()=>{this.running?(this.runOneStep(v,m,e),t&&p.forEach((({id:t,data:e})=>r.mergeNodeData(t,{x:e.x,y:e.y,z:3===o?e.z:void 0}))),null==c||c({nodes:p,edges:g}),y++,y>=d&&(window.clearInterval(this.timeInterval),n({nodes:p,edges:g}))):n({nodes:p,edges:g})}),0),this.running=!0}))}))}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:r,nodeClusterBy:n}=e,{center:o,width:i,height:s}=e;return e.width=i||"undefined"==typeof window?i:window.innerWidth,e.height=s||"undefined"==typeof window?s:window.innerHeight,e.center=o||[e.width/2,e.height/2],e.clustering=r&&!!n,e}runOneStep(t,e,r){const{dimensions:n,height:o,width:i,gravity:s,center:a,speed:u,clustering:h,nodeClusterBy:d,clusterGravity:c}=r,l=o*i,f=Math.sqrt(l)/10,g=t.getAllNodes(),v=l/(g.length+1),m=Math.sqrt(v),y={};if(this.applyCalculate(t,y,m,v),h){for(const t in e)e[t].cx=0,e[t].cy=0,e[t].count=0;g.forEach((t=>{const{data:r}=t,n=e[r[d]];p(r.x)&&(n.cx+=r.x),p(r.y)&&(n.cy+=r.y),n.count++}));for(const t in e)e[t].cx/=e[t].count,e[t].cy/=e[t].count;const t=c||s;g.forEach(((r,n)=>{const{id:o,data:i}=r;if(!p(i.x)||!p(i.y))return;const s=e[i[d]],a=Math.sqrt((i.x-s.cx)*(i.x-s.cx)+(i.y-s.cy)*(i.y-s.cy)),u=m*t;y[o].x-=u*(i.x-s.cx)/a,y[o].y-=u*(i.y-s.cy)/a}))}g.forEach(((t,e)=>{const{id:r,data:o}=t;if(!p(o.x)||!p(o.y))return;const i=.01*m*s;y[r].x-=i*(o.x-a[0]),y[r].y-=i*(o.y-a[1]),3===n&&(y[r].z-=i*(o.z-a[2]))})),g.forEach(((e,r)=>{const{id:o,data:i}=e;if(p(i.fx)&&p(i.fy))return i.x=i.fx,i.y=i.fy,void(3===n&&(i.z=i.fz));if(!p(i.x)||!p(i.y))return;const s=Math.sqrt(y[o].x*y[o].x+y[o].y*y[o].y+(3===n?y[o].z*y[o].z:0));if(s>0){const e=Math.min(f*(u/800),s);t.mergeNodeData(o,{x:i.x+y[o].x/s*e,y:i.y+y[o].y/s*e,z:3===n?i.z+y[o].z/s*e:void 0})}}))}applyCalculate(t,e,r,n){this.calRepulsive(t,e,n),this.calAttractive(t,e,r)}calRepulsive(t,e,r){const n=t.getAllNodes();n.forEach((({data:t,id:o},i)=>{e[o]={x:0,y:0,z:0},n.forEach((({data:n,id:s},a)=>{if(i<=a||!p(t.x)||!p(n.x)||!p(t.y)||!p(n.y))return;let u=t.x-n.x,h=t.y-n.y,d=3===this.options.dimensions?t.z-n.z:0,c=u*u+h*h+d*d;0===c&&(c=1,u=.01,h=.01,d=.01);const l=r/c,f=u*l,g=h*l,v=d*l;e[o].x+=f,e[o].y+=g,e[s].x-=f,e[s].y-=g,3===this.options.dimensions&&(e[o].z+=v,e[s].z-=v)}))}))}calAttractive(t,e,r){t.getAllEdges().forEach((n=>{const{source:o,target:i}=n;if(!o||!i||o===i)return;const{data:s}=t.getNode(o),{data:a}=t.getNode(i);if(!(p(a.x)&&p(s.x)&&p(a.y)&&p(s.y)))return;const u=a.x-s.x,h=a.y-s.y,d=3===this.options.dimensions?a.z-s.z:0,c=Math.sqrt(u*u+h*h+d*d)/r,l=u*c,f=h*c,g=d*c;e[o].x+=l,e[o].y+=f,e[i].x-=l,e[i].y-=f,3===this.options.dimensions&&(e[o].z+=g,e[i].z-=g)}))}}const Dn={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300};class Pn{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},Dn),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericGridLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericGridLayout(!0,t,r)}))}genericGridLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{begin:o=[0,0],condense:i,preventOverlapPadding:s,preventOverlap:a,rows:u,cols:h,nodeSpacing:d,nodeSize:c,width:l,height:f,position:g}=e;let{sortBy:v}=e;const m=r.getAllNodes(),y=r.getAllEdges(),w=null==m?void 0:m.length;if(!w||1===w)return ne(r,t,o);const x=m.map((t=>Zt(t)));"id"===v||ue(v)&&void 0!==x[0].data[v]||(v="degree"),"degree"===v?x.sort(((t,e)=>r.getDegree(e.id,"both")-r.getDegree(t.id,"both"))):"id"===v?x.sort(((t,e)=>p(e.id)&&p(t.id)?e.id-t.id:`${t.id}`.localeCompare(`${e.id}`))):x.sort(((t,e)=>e.data[v]-t.data[v]));const b=l||"undefined"==typeof window?l:window.innerWidth,E=f||"undefined"==typeof window?f:window.innerHeight,N=w,M={rows:u,cols:h};if(null!=u&&null!=h)M.rows=u,M.cols=h;else if(null!=u&&null==h)M.rows=u,M.cols=Math.ceil(N/M.rows);else if(null==u&&null!=h)M.cols=h,M.rows=Math.ceil(N/M.cols);else{const t=Math.sqrt(N*E/b);M.rows=Math.round(t),M.cols=Math.round(b/E*t)}if(M.rows=Math.max(M.rows,1),M.cols=Math.max(M.cols,1),M.cols*M.rows>N){const t=Tn(M),e=Ln(M);(t-1)*e>=N?Tn(M,t-1):(e-1)*t>=N&&Ln(M,e-1)}else for(;M.cols*M.rows<N;){const t=Tn(M),e=Ln(M);(e+1)*t>=N?Ln(M,e+1):Tn(M,t+1)}let _=i?0:b/M.cols,k=i?0:E/M.rows;if(a||d){const t=Ht(10,d),e=Jt(30,c,!1);x.forEach((n=>{n.data.x&&n.data.y||(n.data.x=0,n.data.y=0);const o=r.getNode(n.id),i=e(o)||30;let a,u;he(i)?(a=i[0],u=i[1]):(a=i,u=i);const h=void 0!==t?t(n):s,d=a+h,c=u+h;_=Math.max(_,d),k=Math.max(k,c)}))}const A={},j={row:0,col:0},S={};for(let t=0;t<x.length;t++){const e=x[t];let n;if(g&&(n=g(r.getNode(e.id))),n&&(void 0!==n.row||void 0!==n.col)){const t={row:n.row,col:n.col};if(void 0===t.col)for(t.col=0;Fn(A,t);)t.col++;else if(void 0===t.row)for(t.row=0;Fn(A,t);)t.row++;S[e.id]=t,qn(A,t)}Bn(e,o,_,k,S,M,j,A)}const O={nodes:x,edges:y};return t&&x.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),O}))}}const Tn=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;return null==e?r=Math.min(n,o):Math.min(n,o)===t.rows?t.rows=e:t.cols=e,r},Ln=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;return null==e?r=Math.max(n,o):Math.max(n,o)===t.rows?t.rows=e:t.cols=e,r},Fn=(t,e)=>t[`c-${e.row}-${e.col}`]||!1,qn=(t,e)=>t[`c-${e.row}-${e.col}`]=!0,Vn=(t,e)=>{const r=t.cols||5;e.col++,e.col>=r&&(e.col=0,e.row++)},Bn=(t,e,r,n,o,i,s,a)=>{let u,h;const d=o[t.id];if(d)u=d.col*r+r/2+e[0],h=d.row*n+n/2+e[1];else{for(;Fn(a,s);)Vn(i,s);u=s.col*r+r/2+e[0],h=s.row*n+n/2+e[1],qn(a,s),Vn(i,s)}t.data.x=u,t.data.y=h},Un={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},$n=(t,e,r,n,o,i)=>{e.forEach(((s,a)=>{r[a]={x:0,y:0},e.forEach(((e,u)=>{if(a===u)return;if(o[a]!==o[u])return;let h=s.x-e.x,d=s.y-e.y,c=Math.sqrt(h*h+d*d);if(0===c){c=1;const t=a>u?1:-1;h=.01*t,d=.01*t}if(c<i(t[a])/2+i(t[u])/2){const t=n*n/c;r[a].x+=h/c*t,r[a].y+=d/c*t}}))}))},Gn=(t,e,r,n,o,i,s,a)=>{const u=i||s/10;return n&&e.forEach(((e,r)=>{const n=t[r].x-t[o].x,i=t[r].y-t[o].y,s=Math.sqrt(n*n+i*i);let a=i/s,u=-n/s;const h=Math.sqrt(e.x*e.x+e.y*e.y);let d=Math.acos((a*e.x+u*e.y)/h);d>Math.PI/2&&(d-=Math.PI/2,a*=-1,u*=-1);const c=Math.cos(d)*h;e.x=a*c,e.y=u*c})),t.forEach(((i,s)=>{if(s===o)return;const h=Math.sqrt(e[s].x*e[s].x+e[s].y*e[s].y);if(h>0&&s!==o){const d=Math.min(u*(r/800),h);if(i.x+=e[s].x/h*d,i.y+=e[s].y/h*d,n){let e=i.x-t[o].x,r=i.y-t[o].y;const n=Math.sqrt(e*e+r*r);e=e/n*a[s],r=r/n*a[s],i.x=t[o].x+e,i.y=t[o].y+r}}})),t},Wn={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};class Kn{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},Wn),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericRadialLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericRadialLayout(!0,t,r)}))}genericRadialLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{width:o,height:i,center:s,focusNode:a,unitRadius:u,nodeSize:h,nodeSpacing:d,strictRadial:c,preventOverlap:l,maxPreventOverlapIteration:f,sortBy:g,linkDistance:p=50,sortStrength:v=10,maxIteration:m=1e3}=e,y=r.getAllNodes(),w=r.getAllEdges(),x=o||"undefined"==typeof window?o:window.innerWidth,b=i||"undefined"==typeof window?i:window.innerHeight,E=s||[x/2,b/2];if(!(null==y?void 0:y.length)||1===y.length)return ne(r,t,E);let N=y[0];if(ue(a)){for(let t=0;t<y.length;t++)if(y[t].id===a){N=y[t];break}}else N=a||y[0];const M=Jn(y,N.id),_=Be({nodes:y,edges:w},!1),k=Ve(_),A=Xn(k,M);Qn(k,M,A+1);const j=k[M];let S=x-E[0]>E[0]?E[0]:x-E[0],O=b-E[1]>E[1]?E[1]:b-E[1];0===S&&(S=x/2),0===O&&(O=b/2);const z=Math.min(S,O),R=Math.max(...j),I=[],C=u||z/R;j.forEach(((t,e)=>{I[e]=t*C}));const D=Yn(y,k,p,I,C,g,v),P=Hn(D),T=((t,e,r)=>{try{const r=Fe.mul(Fe.pow(e,2),-.5),n=r.mean("row"),o=r.mean("column"),i=r.mean();r.add(i).subRowVector(n).subColumnVector(o);const s=new qe(r),a=Fe.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map((e=>Fe.mul([e],[a]).toJSON()[0].splice(0,t)))}catch(t){const n=[];for(let t=0;t<e.length;t++){const t=Math.random()*r,e=Math.random()*r;n.push([t,e])}return n}})(p,D,p);let L,F=T.map((([t,e])=>({x:(isNaN(t)?Math.random()*p:t)-T[M][0],y:(isNaN(e)?Math.random()*p:e)-T[M][1]})));if(this.run(m,F,P,D,I,M),l){L=Qt(h,d);const t={nodes:y,nodeSizeFunc:L,positions:F,radii:I,height:b,width:x,strictRadial:Boolean(c),focusIdx:M,iterations:f||200,k:F.length/4.5};F=((t,e)=>{const r=Object.assign(Object.assign({},Un),e),{positions:n,iterations:o,width:i,k:s,speed:a=100,strictRadial:u,focusIdx:h,radii:d=[],nodeSizeFunc:c}=r,l=t.getAllNodes(),f=[],g=i/10;for(let t=0;t<o;t++)n.forEach(((t,e)=>{f[e]={x:0,y:0}})),$n(l,n,f,s,d,c),Gn(n,f,a,u,h,g,i,d);return n})(r,t)}const q=[];return F.forEach(((t,e)=>{const r=Zt(y[e]);r.data.x=t.x+E[0],r.data.y=t.y+E[1],q.push(r)})),t&&q.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:q,edges:w}}))}run(t,e,r,n,o,i){for(let s=0;s<=t;s++){const a=s/t;this.oneIteration(a,e,o,n,r,i)}}oneIteration(t,e,r,n,o,i){const s=1-t;e.forEach(((a,u)=>{const h=Ge(a,{x:0,y:0}),d=0===h?0:1/h;if(u===i)return;let c=0,l=0,f=0;e.forEach(((t,e)=>{if(u===e)return;const r=Ge(a,t),i=0===r?0:1/r,s=n[e][u];f+=o[u][e],c+=o[u][e]*(t.x+s*(a.x-t.x)*i),l+=o[u][e]*(t.y+s*(a.y-t.y)*i)}));const g=0===r[u]?0:1/r[u];f*=s,f+=t*g*g,c*=s,c+=t*g*a.x*d,a.x=c/f,l*=s,l+=t*g*a.y*d,a.y=l/f}))}}const Yn=(t,e,r,n,o,i,s)=>{if(!t)return[];const a=[];if(e){const u={};e.forEach(((e,h)=>{const d=[];e.forEach(((e,a)=>{var c,l;if(h===a)d.push(0);else if(n[h]===n[a])if("data"===i)d.push(e*(Math.abs(h-a)*s)/(n[h]/o));else if(i){let r,f;if(u[t[h].id])r=u[t[h].id];else{const e=("id"===i?t[h].id:null===(c=t[h].data)||void 0===c?void 0:c[i])||0;r=ue(e)?e.charCodeAt(0):e,u[t[h].id]=r}if(u[t[a].id])f=u[t[a].id];else{const e=("id"===i?t[a].id:null===(l=t[a].data)||void 0===l?void 0:l[i])||0;f=ue(e)?e.charCodeAt(0):e,u[t[a].id]=f}d.push(e*(Math.abs(r-f)*s)/(n[h]/o))}else d.push(e*r/(n[h]/o));else{const t=(r+o)/2;d.push(e*t)}})),a.push(d)}))}return a},Hn=t=>{const e=t.length,r=t[0].length,n=[];for(let o=0;o<e;o++){const e=[];for(let n=0;n<r;n++)0!==t[o][n]?e.push(1/(t[o][n]*t[o][n])):e.push(0);n.push(e)}return n},Jn=(t,e)=>{let r=-1;return t.forEach(((t,n)=>{t.id===e&&(r=n)})),Math.max(r,0)},Qn=(t,e,r)=>{const n=t.length;for(let o=0;o<n;o++)if(t[e][o]===1/0){t[e][o]=r,t[o][e]=r;for(let i=0;i<n;i++)t[o][i]!==1/0&&t[e][i]===1/0&&(t[e][i]=r+t[o][i],t[i][e]=r+t[o][i])}for(let r=0;r<n;r++)if(r!==e)for(let o=0;o<n;o++)if(t[r][o]===1/0){let n=Math.abs(t[e][r]-t[e][o]);n=0===n?1:n,t[r][o]=n}},Xn=(t,e)=>{let r=0;for(let n=0;n<t[e].length;n++)t[e][n]!==1/0&&(r=t[e][n]>r?t[e][n]:r);return r},Zn={center:[0,0],width:300,height:300};class to{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},Zn),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericRandomLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){this.genericRandomLayout(!0,t,r)}))}genericRandomLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{center:o,width:i,height:s}=e,a=r.getAllNodes(),u=i||"undefined"==typeof window?i:window.innerWidth,h=s||"undefined"==typeof window?s:window.innerHeight,d=o||[u/2,h/2],c=[];return a&&a.forEach((t=>{c.push({id:t.id,data:{x:.9*(Math.random()-.5)*u+d[0],y:.9*(Math.random()-.5)*h+d[1]}})})),t&&c.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),{nodes:c,edges:r.getAllEdges()}}))}}const eo={circular:ie,concentric:ce,mds:Ye,random:to,grid:Pn,radial:Kn,force:Re,d3force:Kr,"d3-force-3d":Mn,fruchterman:Cn,forceAtlas2:Rn,dagre:An,antvDagre:ee,comboCombined:Ze};function ro(t){return!!t.tick&&!!t.stop}})(),n})()));
|
|
2
2
|
//# sourceMappingURL=index.min.js.map
|